2020
PK
mPaV,$ $ campaign/record_vehicle.xml
recordsheet
minimized_npcnpc_headervehicle_mainvehicle_combatnpc_abilitiesmaincombatabilitiesnotestab_mainmaintab_combatcombattab_otherabilitiestab_notesnotesnpctoken_emptycharsheet_characteristicspilotname.weaponlistweapon_line_shortweapon*weapons
PK .P campaign/scripts/PK
zK욇 campaign/scripts/abilities.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
local dropnode = nil;
local drop_class = nil;
local drop_id = nil;
local drop_description = nil;
function onDrop(x, y, draginfo)
local data = {name=draginfo.getDescription(), attributes={}, text="."};
drop_description = draginfo.getDescription();
if draginfo.isType("shortcut") then
drop_class, drop_id = draginfo.getShortcutData();
-- Interface.dialogMessage("Id "..tostring(drop_id));
-- source = draginfo.getDatabaseNode();
if drop_class == "power" then
-- pipp.err();
--data.name = draginfo.getDescription();
--data.text = source.createChild("text", "string").getValue();
--draginfo.reset();
--draginfo.setType("power");
--draginfo.setCustomData(data);
--if super and super.onDrop then
-- return super.onDrop(x, y, draginfo);
-- end
else
drop_id = nil;
end
end
end
function onListChanged()
local target = getLastElement();
if target and drop_description then
if drop_description then
target.name.setValue(drop_description);
drop_description = nil;
end
if drop_class == "referencetext" or drop_class == "referencetextwide" then
-- do nothing and default to power
elseif drop_class == "power" then
target.shortcut.getDatabaseNode().createChild("systems", "string").setValue(nil);
else
local class, id = target.shortcut.getValue();
target.shortcut.setValue(drop_class, id);
end
end
end
function getLastElement()
local target = nil;
local target_id = nil;
local w_id = nil;
for i, w in ipairs(getWindows()) do
_, w_id = w.shortcut.getValue();
-- Interface.dialogMessage(tostring(i).." "..tostring(w_id));
if target_id == nil or w_id > target_id then
target = w;
_, target_id = target.shortcut.getValue();
end
end
-- Interface.dialogMessage(tostring(target_id));
return target;
end
PK
*P $ campaign/scripts/characteristics.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function onInit()
update();
end
function update()
-- GameSystem.evaluateAttributes(parentcontrol.window.getDatabaseNode());
end
function onDoubleClick(x, y)
GameSystem.evaluateAttributes(parentcontrol.window.getDatabaseNode());
endPK
Ι0KR$zPN N campaign/scripts/charsheet.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function onInit()
if User.isLocal() then
speak.setVisible(false);
portrait.setVisible(false);
localportrait.setVisible(true);
end
OptionsManager.registerCallback("RD100.Other", toggleOther);
toggleOther("RD100.Other", true);
end
function toggleOther(key, direct)
if direct then
tabs.toggleTab(6, OptionsManager.isOption(key, "on"));
else
tabs.toggleTab(6, not OptionsManager.isOption(key, "on"));
end
end
PK
kPn
campaign/scripts/char_skill.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function onInit()
-- Set the displays to what should be shown
setTraitVisibility();
end
function initValues()
if name.getValue() and name.getValue() ~= "" then
label.subwindow.label.setValue(name.getValue());
name.setValue("");
bonus.setValue(evaluateBase());
end
end
function evaluateBase()
local char = getDatabaseNode().getParent().getParent();
local b1, b2;
local result = 0;
if not char or not base1 or not base2 then
return 0;
end
b1 = char.getChild(string.lower(base1.getValue()));
b2 = char.getChild(string.lower(base2.getValue()));
if base1.getValue() and base1.getValue() ~= "" and b1 then
result = result + b1.getValue();
else
return -1;
end
if base2.getValue() and base2.getValue() ~= "" and b2 then
result = result + b2.getValue();
else
return -2;
end
return result;
end
--
-- SECTION VISIBILITY FUNCTIONS
--
function setTraitVisibility()
local v = false;
if activatetraits.getValue() == 1 then
v = true;
end
-- effecticon.setVisible(v);
-- effects.setVisible(v);
-- effects_iadd.setVisible(v);
-- for _,w in pairs(effects.getWindows()) do
-- w.idelete.setValue(0);
-- end
traits.setVisible (v);
summary.setVisible(not v);
summary.onTagsChanged();
end
function onClick(x, y)
activatetraits.onButtonPressed();
end
-- ---------------
-- SKILL FUNCTIONS
-- ---------------
function onDragStart(button, x, y, draginfo)
-- useful?
if label.getValue() == "" and bonus.getValue() == 0 then
return nil;
end
draginfo.setType("number");
draginfo.setDescription(label.getValue());
draginfo.setStringData(label.getValue());
draginfo.setNumberData(bonus.getValue());
return true;
end
function onDoubleClick(x, y, label_trait)
local trait = "";
local mod = 0;
if label_trait ~= nil then
trait = " ["..label_trait.."]";
-- mod = 30;
end
local rRoll = { sType = "dice",
sDesc = label.getValue()..trait,
aDice = GameSystem.getPercentileDice(),
nMod = mod};
ActionsManager.performAction(nil,
ActorManager.getActor("..", windowlist.window.getDatabaseNode()),
rRoll);
return true;
end
function onDrop(x, y, draginfo)
-- deprecated
local sDragType = draginfo.getType();
if sDragType == "dice" then
local aDropDice = draginfo.getDieList();
for _,vDie in ipairs(aDropDice) do
-- dice.addDie(vDie.type);
end
return true;
end
end
PK aP campaign/scripts/controls/PK
@(KS]3 * campaign/scripts/controls/attack_ready.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function onButtonPress()
if(getValue() > 0) then
if window.attack_sr.getValue() > 0 and window.equipped.getValue() > 0 then
window.windowlist.attack_ready(window);
else
setValue(0);
end
else
window.windowlist.attack_ready(nil);
end
end
PK
[J^m m - campaign/scripts/controls/button_bubbling.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
-- button_cycler_type.lua
--
function onClickRelease(button, x, y)
if super and super.onClickRelease then
super.onClickRelease(button, x, y);
end
if bubbling then
if type(bubbling[1]) == "string" and string.len(bubbling[1]) > 0 then
if window[bubbling[1]] then
window[bubbling[1]](getValue());
return true;
end
elseif window.update then
window.update(getValue());
return true;
end
end
return false;
end
PK
^P5j j , campaign/scripts/controls/button_generic.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function getStrikeRank()
return GameSystem.readiness(self.getNode());
end
function getOpeningLabel()
if not window.level or window.level.getValue() == 2 then
return "generic";
else
return "action";
end
end
PK
^Pk; ; * campaign/scripts/controls/button_melee.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function getStrikeRank()
return self.getNode().getChild("init").getValue()
+ self.getNode().getChild("reach").getValue();
-- use weapn reach directly?
end
function getOpeningLabel()
return "melee";
end
function getSrExpenditure()
local weapon = self.getWeapon("melee");
if not self.hasOpened() and weapon.special_opening then
return weapon.reach;
else
return weapon.attack_sr;
end
end
PK
jN] * campaign/scripts/controls/button_power.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function getStrikeRank()
return self.getNode().getChild("dex").getValue()+5;
end
function getOpeningLabel()
return "power";
end
PK
jN,8 8 + campaign/scripts/controls/button_ranged.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function getStrikeRank()
-- return self.getNode().getChild("dex").getValue()+20;
-- Debug.console("Working on " .. self.getNode().getPath());
return self.getNode().getChild("dex").getValue()+5;
end
function getOpeningLabel()
return "ranged";
end
function getSrExpenditure()
local weapon = self.getWeapon("ranged");
if self.hasOpened() then
return weapon.attack_sr;
else
return 20;
end
end
PK
KP(yV ' campaign/scripts/controls/button_sr.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
local node;
local opening;
local opened;
function onInit()
linkNode()
end
function linkNode()
node = window.getDatabaseNode();
if node.getChild("..").getPath() == "combattracker.list" and window.link
and window.link.getTargetDatabaseNode() then
node = window.link.getTargetDatabaseNode();
end
if not node.isOwner() and window.link
and window.link.getTargetDatabaseNode() then
Debug.console("Warning: not owner, using node or link");
node = window.link.getTargetDatabaseNode();
end
opening = node.createChild("opening", "string");
opened = node.createChild("opened", "string");
end
function getStrikeRank()
return 0;
end
function getNode()
-- addition of actual link may take place later, check again
if not node.getChild("init") then
linkNode();
end
return node;
end
function onButtonPress()
local sr = 0;
local initresult = node.createChild("initresult", "number");
if self.canAct() then
return false;
end
if(window.health and window.health.getValue() < 0 ) then
sr = sr + window.health.getValue();
end
if opening and string.len(opening.getValue()) == 0 and self.getStrikeRank() > 0 then
initresult.setValue(self.getStrikeRank()+sr);
opening.setValue(self.getOpeningLabel());
opened.setValue(nil);
return true;
elseif opening and opening.getValue() ~= self.getOpeningLabel() and self.getStrikeRank() > 0 then
opening.setValue(self.getOpeningLabel());
if initresult.getValue() > 5 then
initresult.setValue(initresult.getValue()-5);
else
initresult.setValue(0);
end
return true;
else
return false;
end
end
function getOpeningLabel()
return nil; -- pure virtual function
end
function getOpening()
return opening.getValue();
end
function setOpening(v)
opening.setValue(v);
end
function hasOpened()
return string.len(opened.getValue()) > 0;
end
function open(v)
opened.setValue(v);
end
function getSrExpenditure()
return 5;
end
function canAct()
return false;
end
PK
K@l ' campaign/scripts/controls/charsheet.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
-- charsjeet.lua
--
function onInit()
if User.isLocal() then
speak.setVisible(false);
portrait.setVisible(false);
localportrait.setVisible(true);
end
OptionsManager.registerCallback("RD100.Vehicles", toggleVehicles);
toggleVehicles();
end
function toggleVehicles()
if OptionsManager.isOption("RD100.Vehicles", "On") then
tabs.setTab(5, tabs.tab[5].subwindow[1], tabs.tab[5].icon[1]);
--vehicle.setVisible(true);
else
tabs.hideControls(5);
tabs.setTab(5, "tabtop", "");
-- vehicle.setVisible(false);
end
end
PK
4(Ky + campaign/scripts/controls/defence_ready.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function onButtonPress()
if(getValue() > 0) then
if window.defence_sr.getValue() > 0 and window.equipped.getValue() > 0 then
window.windowlist.defence_ready(window);
else
setValue(0);
end
else
window.windowlist.defence_ready(nil);
end
end
PK
N'K , campaign/scripts/controls/list_charskill.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function onListChanged()
update();
end
function update()
local sEdit = getName() .. "_iedit";
if window[sEdit] then
local bEdit = (window[sEdit].getValue() == 1);
for _,wCategory in ipairs(getWindows()) do
wCategory.idelete.setVisibility(bEdit);
wCategory.traits_iadd.setVisible(bEdit);
wCategory.traits.update(bEdit);
-- wCategory.activatetraits.setValue(window[sEdit].getValue());
wCategory.activatetraits.setVisible(not bEdit);
end
end
end
function addEntry(bFocus)
local w = createWindow();
if bFocus then
-- w.header.subwindow.label.setFocus();
end
return w;
end
PK
Uu
Km " campaign/scripts/controls/tabs.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
-- tabs.lua
--
function onInit()
if super and super.onInit then
super.onInit();
end
end
function toggleTab(index, activate)
if activate then
setTab(index, tab[index].subwindow[1], tab[index].icon[1]);
else
hideControls(index);
setTab(index, nil, nil);
end
end
PK
b8K7! $ campaign/scripts/header_lockable.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function onInit()
if lockable_fiels then
for _,i in ipairs(lockable_field) do
self[i].setVisible(string.len(self[i].getValue()) > 0);
end
end
update();
end
function update()
local bReadOnly = WindowManager.getReadOnlyState(getDatabaseNode());
name.setReadOnly(bReadOnly);
if lockable_fields then
for _,i in ipairs(lockable_field) do
self[i].setReadOnly(bReadOnly);
end
end
if activate then
if bReadOnly then
activate.setValue(0);
end
activate.setVisible(not bReadOnly);
end
end
PK
5N # campaign/scripts/list_charskill.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function onListChanged()
update();
end
function update()
local sEdit = getName() .. "_iedit";
if window[sEdit] then
local bEdit = (window[sEdit].getValue() == 1);
for _,wCategory in ipairs(getWindows()) do
wCategory.idelete.setVisibility(bEdit);
wCategory.traits_iadd.setVisible(bEdit);
wCategory.traits.update(bEdit);
wCategory.activatetraits.setValue(window[sEdit].getValue());
wCategory.activatetraits.setVisible(not bEdit);
end
end
end
function addEntry(bFocus)
local w = createWindow();
if bFocus then
-- w.header.subwindow.label.setFocus();
end
return w;
end
PK
vN # campaign/scripts/list_chartrait.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function onListChanged()
window.windowlist.onListChanged();
end
function update(bEdit)
for _,wAttribute in ipairs(getWindows()) do
wAttribute.idelete.setVisibility(bEdit);
end
end
function addEntry(bFocus)
local w = createWindow();
if bFocus then
w.label.setFocus();
end
return w;
end
function onDrop(x, y, draginfo)
local sDragType = draginfo.getType();
if sDragType == "number" then
local w = addEntry(true);
if w then
w.label.setValue(draginfo.getDescription());
w.bonus.setValue(draginfo.getNumberData());
end
return true;
elseif sDragType == "dice" then
local aDropDice = draginfo.getDieList();
local w = getWindowAt(x,y);
if w then
for _,vDie in ipairs(aDropDice) do
w.dice.addDie(vDie.type);
end
end
return true;
end
end
PK
b8K- campaign/scripts/negative.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function onValueChange()
if getValue() < 0 then
setColor("#00FF0000");
else
setColor("#00000000");
end
end
PK
P campaign/scripts/npc.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function onInit()
onLockChanged();
DB.addHandler(DB.getPath(getDatabaseNode(), "locked"), "onUpdate", onLockChanged);
end
function onClose()
DB.removeHandler(DB.getPath(getDatabaseNode(), "locked"), "onUpdate", onLockChanged);
end
function onLockChanged()
if header.subwindow then
header.subwindow.update();
end
if main.subwindow then
main.subwindow.update();
end
if combat.subwindow then
combat.subwindow.update();
end
if abilities.subwindow then
abilities.subwindow.update();
end
local bReadOnly = WindowManager.getReadOnlyState(getDatabaseNode());
notes.setReadOnly(bReadOnly);
end
PK
c8K E campaign/scripts/npc_attack.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
-- File is largely a port of npc_roll.lua from CoreRPG
local bParsed = false;
local aComponents = {};
local bClicked = false;
local bDragging = false;
local nDragIndex = nil;
function parseComponents()
aComponents = {};
-- Get the comma-separated strings
local aClauses, aClauseStats = StringManager.split(getValue(), "%%,;\r", true);
-- Check each comma-separated string for a potential skill roll or auto-complete opportunity
for i = 1, #aClauses do
local nStarts, nEnds, sMod = string.find(aClauses[i], "([d%dF%+%-]+)%s*$");
-- local nStarts, nEnds, sMod = string.find(aClauses[i], "([%-%+]?)(%d+)d?([%dF]*)");
if nStarts then
local sLabel = "";
if nStarts > 1 then
sLabel = StringManager.trim(aClauses[i]:sub(1, nStarts - 1));
end
local aDice, nMod = StringManager.convertStringToDice(sMod);
-- Insert the possible skill into the skill list
table.insert(aComponents, {nStart = aClauseStats[i].startpos, nLabelEnd = aClauseStats[i].startpos + nEnds, nEnd = aClauseStats[i].endpos, sLabel = sLabel, aDice = aDice, nMod = nMod });
end
end
bParsed = true;
end
function onValueChanged()
bParsed = false;
end
-- Reset selection when the cursor leaves the control
function onHover(bOnControl)
if bOnControl then
return;
end
if not bDragging then
onDragEnd();
end
end
-- Hilight skill hovered on
function onHoverUpdate(x, y)
if bDragging or bClicked then
return;
end
if not bParsed then
parseComponents();
end
local nMouseIndex = getIndexAt(x, y);
for i = 1, #aComponents, 1 do
if aComponents[i].nStart <= nMouseIndex and aComponents[i].nEnd > nMouseIndex then
setCursorPosition(aComponents[i].nStart);
setSelectionPosition(aComponents[i].nEnd);
nDragIndex = i;
setHoverCursor("hand");
return;
end
end
nDragIndex = nil;
setHoverCursor("arrow");
end
function getActor()
local nodeActor = nil;
local node = getDatabaseNode();
if node then
nodeActor = node.getChild("....");
Debug.console("Node "..node.getPath().." actor "..nodeActor.getPath());
end
return ActorManager.getActor("..", nodeActor);
end
function action(draginfo)
local rActor = getActor();
Debug.console("Actor "..table.getn(rActor));
if nDragIndex then
if draginfo then
if #(aComponents[nDragIndex].aDice) > 0 then
local rRoll = { sType = "attack",
sDesc = aComponents[nDragIndex].sLabel,
aDice = aComponents[nDragIndex].aDice,
nMod = aComponents[nDragIndex].nMod };
ActionsManager.performAction(draginfo, rActor, rRoll);
else
draginfo.setType("number");
draginfo.setDescription(aComponents[nDragIndex].sLabel);
draginfo.setStringData(aComponents[nDragIndex].sLabel);
draginfo.setNumberData(aComponents[nDragIndex].nMod);
end
else
if #(aComponents[nDragIndex].aDice) > 0 then
local rRoll = { sType = "attack",
sDesc = aComponents[nDragIndex].sLabel,
aDice = aComponents[nDragIndex].aDice,
nMod = aComponents[nDragIndex].nMod };
ActionsManager.performAction(nil, rActor, rRoll);
else
ActionsManager.performAction(nil, rActor,
{ sType = "dice",
sDesc = aComponents[nDragIndex].sLabel,
aDice = {"d100", "d10"},
nMod = 0});
-- ModifierStack.addSlot(aComponents[nDragIndex].sLabel, aComponents[nDragIndex].nMod);
end
end
end
end
function onDoubleClick(x, y)
action();
return true;
end
function onDragStart(button, x, y, draginfo)
action(draginfo);
bClicked = false;
bDragging = true;
return true;
end
function onDragEnd(draginfo)
bClicked = false;
bDragging = false;
nDragIndex = nil;
setHoverCursor("arrow");
setCursorPosition(0);
setSelectionPosition(0);
end
-- Suppress default processing to support dragging
function onClickDown(button, x, y)
bClicked = true;
return true;
end
-- On mouse click, set focus, set cursor position and clear selection
function onClickRelease(button, x, y)
bClicked = false;
setFocus();
local n = getIndexAt(x, y);
setSelectionPosition(n);
setCursorPosition(n);
return true;
end
PK
dP! ! campaign/scripts/npc_roll.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
-- File is largely a port of npc_roll.lua from CoreRPG
local bParsed = false;
local aComponents = {};
local bClicked = false;
local bDragging = false;
local nDragIndex = nil;
function parseComponents()
aComponents = {};
-- Get the comma-separated strings
local aClauses, aClauseStats = StringManager.split(getValue(), ",;\r", true);
-- Check each comma-separated string for a potential skill roll or auto-complete opportunity
for i = 1, #aClauses do
local nStarts, nEnds, sMod = string.find(aClauses[i], "([d%dF%+%-]+)%s*$");
-- local nStarts, nEnds, sMod = string.find(aClauses[i], "([%-%+]?)(%d+)d?([%dF]*)");
if nStarts then
local sLabel = "";
if nStarts > 1 then
sLabel = StringManager.trim(aClauses[i]:sub(1, nStarts - 1));
end
local aDice, nMod = StringManager.convertStringToDice(sMod);
-- Insert the possible skill into the skill list
table.insert(aComponents, {nStart = aClauseStats[i].startpos, nLabelEnd = aClauseStats[i].startpos + nEnds, nEnd = aClauseStats[i].endpos, sLabel = sLabel, aDice = aDice, nMod = nMod });
end
end
bParsed = true;
end
function onValueChanged()
bParsed = false;
end
-- Reset selection when the cursor leaves the control
function onHover(bOnControl)
if bOnControl then
return;
end
if not bDragging then
onDragEnd();
end
end
-- Hilight skill hovered on
function onHoverUpdate(x, y)
if bDragging or bClicked then
return;
end
if not bParsed then
parseComponents();
end
local nMouseIndex = getIndexAt(x, y);
for i = 1, #aComponents, 1 do
if aComponents[i].nStart <= nMouseIndex and aComponents[i].nEnd > nMouseIndex then
setCursorPosition(aComponents[i].nStart);
setSelectionPosition(aComponents[i].nEnd);
nDragIndex = i;
setHoverCursor("hand");
return;
end
end
nDragIndex = nil;
setHoverCursor("arrow");
end
function getActor()
local nodeActor = nil;
local node = getDatabaseNode();
if node then
nodeActor = node.getChild("..");
end
return ActorManager.getActor("..", nodeActor);
end
function action(draginfo)
local rActor = getActor();
if nDragIndex then
if draginfo then
if #(aComponents[nDragIndex].aDice) > 0 then
local rRoll = { sType = "attack", sDesc = aComponents[nDragIndex].sLabel, aDice = aComponents[nDragIndex].aDice, nMod = aComponents[nDragIndex].nMod };
ActionsManager.performAction(draginfo, rActor, rRoll);
else
draginfo.setType("number");
draginfo.setDescription(aComponents[nDragIndex].sLabel);
draginfo.setStringData(aComponents[nDragIndex].sLabel);
draginfo.setNumberData(aComponents[nDragIndex].nMod);
end
else
if #(aComponents[nDragIndex].aDice) > 0 then
local rRoll = { sType = "attack", sDesc = aComponents[nDragIndex].sLabel, aDice = aComponents[nDragIndex].aDice, nMod = aComponents[nDragIndex].nMod };
ActionsManager.performAction(nil, rActor, rRoll);
else
ActionsManager.performAction(nil, rActor,
{ sType = "dice",
sDesc = aComponents[nDragIndex].sLabel,
aDice = GameSystem.getPercentileDice(),
nMod = 0});
-- ModifierStack.addSlot(aComponents[nDragIndex].sLabel, aComponents[nDragIndex].nMod);
end
end
end
end
function onDoubleClick(x, y)
action();
return true;
end
function onDragStart(button, x, y, draginfo)
action(draginfo);
bClicked = false;
bDragging = true;
return true;
end
function onDragEnd(draginfo)
bClicked = false;
bDragging = false;
nDragIndex = nil;
setHoverCursor("arrow");
setCursorPosition(0);
setSelectionPosition(0);
end
-- Suppress default processing to support dragging
function onClickDown(button, x, y)
bClicked = true;
return true;
end
-- On mouse click, set focus, set cursor position and clear selection
function onClickRelease(button, x, y)
bClicked = false;
setFocus();
local n = getIndexAt(x, y);
setSelectionPosition(n);
setCursorPosition(n);
return true;
end
PK
c8K;ǀd d campaign/scripts/power.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function onInit()
onLockChanged();
DB.addHandler(DB.getPath(getDatabaseNode(), "locked"), "onUpdate", onLockChanged);
end
function onClose()
DB.removeHandler(DB.getPath(getDatabaseNode(), "locked"), "onUpdate", onLockChanged);
end
function onLockChanged()
if header.subwindow and header.subwindow.update then
header.subwindow.update();
end
local bReadOnly = WindowManager.getReadOnlyState(getDatabaseNode());
text.setReadOnly(bReadOnly);
end
PK
P1;d d campaign/scripts/weapon.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function onInit()
update();
end
function setRanged()
reach.setValue(0);
reach_label.setVisible(false);
reach.setVisible(false);
might_label.setVisible(true);
might.setVisible(true);
defence_sr.setValue(0);
defence_sr.setEnabled(false);
--range.setVisible(true);
--range_label.setVisible(true);
end
function setMelee()
reach_label.setVisible(true);
reach.setVisible(true);
might_label.setVisible(false);
might.setVisible(false);
defence_sr.setEnabled(true);
--range.setVisible(false);
--range_label.setVisible(false);
end
function setRangeMetric()
range_metric.setValue(GameSystem.getRangeNumberFromLevel(range.getStringValue()));
end
function setRange()
range.setStringValue(GameSystem.getRangeLevelFromNumber(range_metric.getValue()));
end
function setCost()
end
function update()
local sType = type.getValue();
if super and super.update then
super.update();
end
if not GameSystem.mustBeReadied(getDatabaseNode()) then
equipped.setValue(1);
equipped.setEnabled(false);
else
equipped.setEnabled(true);
end
if GameSystem.isRanged(sType) then
setRanged();
else
setMelee();
end
end
PK
5PUQPe e campaign/scripts/weapons.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function onInit()
end
function equip(weapon)
local other, over = findOther(weapon);
if over ~= nil and GameSystem.mustBeReadied(weapon.getDatabaseNode()) then
-- rollback
weapon.equipped.setValue(0);
else
local opening = window.getDatabaseNode().createChild("opening", "string")
if string.len(opening.getValue()) > 0 then
-- pay sr and equip
local sr = window.getDatabaseNode().createChild("initresult", "number");
local expenditure = 0;
local msg = Interface.getString("message_equip").." "..weapon.name.getValue();
if weapon.defence_sr.getValue() > 0 then
expenditure = weapon.defence_sr.getValue();
else
expenditure = weapon.attack_sr.getValue();
end
--if sr.getValue() < expenditure then
-- sr.setValue(0);
--else
-- sr.setValue(sr.getValue()-expenditure)
--end
--msg = msg.." ("..tostring(expenditure).." sr)";
ChatManager.Message(msg,
not (User.isHost() and OptionsManager.isOption("REVL", "off")),
ActorManager.getActorFromCT(window.getDatabaseNode()));
end
if other == nil or other.attack_ready.getValue() == 0
or other.attack_sr.getValue() < weapon.attack_sr.getValue() then
if weapon.attack_sr.getValue() > 0 then
attack_ready(weapon);
end
end
if other == nil or other.defence_ready.getValue() == 0
or other.defence_sr.getValue() > weapon.defence_sr.getValue() then
if weapon.defence_sr.getValue() > 0 then
defence_ready(weapon);
end
end
end
end
function unequip(weapon)
local opening = window.getDatabaseNode().createChild("opening", "string");
local other, over = findOther(weapon);
if string.len(opening.getValue()) > 0 then
local sr = window.getDatabaseNode().createChild("initresult", "number");
local expenditure = 0;
local msg = Interface.getString("message_unequip").." "..weapon.name.getValue();
if weapon.defence_sr.getValue() > 0 then
expenditure = weapon.defence_sr.getValue();
else
expenditure = weapon.attack_sr.getValue();
end
--if sr.getValue() < expenditure then
-- sr.setValue(0);
--else
-- sr.setValue(sr.getValue()-expenditure)
--end
--msg = msg.." ("..tostring(expenditure).." sr)";
ChatManager.Message(msg,
not (User.isHost() and OptionsManager.isOption("REVL", "off")),
ActorManager.getActorFromCT(window.getDatabaseNode()));
end
if other ~= nil and other.attack_sr.getValue() > 0 then
attack_ready(other);
end
if other ~= nil and other.defence_sr.getValue() > 0 then
defence_ready(other);
end
end
function findOther(weapon)
local w1 = nil;
local w2 = nil;
for _,item in ipairs(getWindows()) do
if item ~= weapon and item.equipped.getValue() > 0
and GameSystem.mustBeReadied(item.getDatabaseNode()) then
if w1 ~= nil then
w2 = item;
return w1, w2;
else
w1 = item;
end
end
end
return w1, w2;
end
function attack_ready(weapon)
local r = window.getDatabaseNode().createChild("reach", "number");
for _,item in ipairs(getWindows()) do
if item ~= weapon then
item.attack_ready.setValue(0);
end
end
if weapon then
weapon.attack_ready.setValue(1);
r.setValue(weapon.getDatabaseNode().getChild("reach").getValue());
else
r.setValue(0);
end
end
function defence_ready(weapon)
for _,item in ipairs(getWindows()) do
if item ~= weapon then
item.defence_ready.setValue(0);
end
end
if weapon then
weapon.defence_ready.setValue(1);
end
end
-- NOTE: Lua sort function expects the opposite boolean value compared to built-in FG sorting
function onSortCompare(w1, w2)
-- Debug.sortValue(w10);
return sortValue(w1) < sortValue(w2);
end
function sortValue(node)
return node.equipped.getValue() * 8
+ node.attack_ready.getValue() * 4
+ node.defence_ready.getValue() * 2
+ bool_to_number(not GameSystem.mustBeReadied(node.getDatabaseNode()));
end
function bool_to_number(value)
return value and 1 or 0
endPK
c8K
" campaign/scripts/weapon_damage.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
local bParsed = false;
local aComponents = {};
local bClicked = false;
local bDragging = false;
local nDragIndex = nil;
-- includes description part that is not actually used
function parseComponents()
aComponents = {};
-- Get the comma-separated strings
local aClauses, aClauseStats = StringManager.split(getValue(), "%%,;\r", true);
-- Check each comma-separated string for a potential skill roll or auto-complete opportunity
for i = 1, #aClauses do
local nStarts, nEnds, sMod = string.find(aClauses[i], "([d%dF%+%-]+)%s*$");
-- local nStarts, nEnds, sMod = string.find(aClauses[i], "([%-%+]?)(%d+)d?([%dF]*)");
if nStarts then
local sLabel = "";
if nStarts > 1 then
sLabel = StringManager.trim(aClauses[i]:sub(1, nStarts - 1));
end
local aDice, nMod = StringManager.convertStringToDice(sMod);
-- Insert the possible skill into the skill list
table.insert(aComponents, {nStart = aClauseStats[i].startpos, nLabelEnd = aClauseStats[i].startpos + nEnds, nEnd = aClauseStats[i].endpos, sLabel = sLabel, aDice = aDice, nMod = nMod });
end
end
bParsed = true;
end
function onValueChanged()
bParsed = false;
end
-- Reset selection when the cursor leaves the control
function onHover(bOnControl)
if bOnControl then
return;
end
if not bDragging then
onDragEnd();
end
end
-- Hilight skill hovered on
function onHoverUpdate(x, y)
if bDragging or bClicked then
return;
end
if not bParsed then
parseComponents();
end
local nMouseIndex = getIndexAt(x, y);
for i = 1, #aComponents, 1 do
if aComponents[i].nStart <= nMouseIndex and aComponents[i].nEnd > nMouseIndex then
setCursorPosition(aComponents[i].nStart);
setSelectionPosition(aComponents[i].nEnd);
nDragIndex = i;
setHoverCursor("hand");
return;
end
end
nDragIndex = nil;
setHoverCursor("arrow");
end
function getActor()
local nodeActor = nil;
local node = getDatabaseNode();
if node then
nodeActor = node.getChild("....");
end
return ActorManager.getActor("..", nodeActor);
end
function action(draginfo)
local rActor = getActor();
if nDragIndex then
if window.name then
aComponents[nDragIndex].sLabel = window.name.getValue().." damage";
end
if draginfo then
if #(aComponents[nDragIndex].aDice) > 0 then
local rRoll = { sType = "attack",
sDesc = aComponents[nDragIndex].sLabel,
aDice = aComponents[nDragIndex].aDice,
nMod = aComponents[nDragIndex].nMod };
ActionsManager.performAction(draginfo, rActor, rRoll);
end
else
if #(aComponents[nDragIndex].aDice) > 0 then
local rRoll = { sType = "attack",
sDesc = aComponents[nDragIndex].sLabel,
aDice = aComponents[nDragIndex].aDice,
nMod = aComponents[nDragIndex].nMod };
ActionsManager.performAction(nil, rActor, rRoll);
-- ModifierStack.addSlot(aComponents[nDragIndex].sLabel, aComponents[nDragIndex].nMod);
end
end
end
end
function onDoubleClick(x, y)
action();
return true;
end
function onDragStart(button, x, y, draginfo)
action(draginfo);
bClicked = false;
bDragging = true;
return true;
end
function onDragEnd(draginfo)
bClicked = false;
bDragging = false;
nDragIndex = nil;
setHoverCursor("arrow");
setCursorPosition(0);
setSelectionPosition(0);
end
-- Suppress default processing to support dragging
function onClickDown(button, x, y)
bClicked = true;
return true;
end
-- On mouse click, set focus, set cursor position and clear selection
function onClickRelease(button, x, y)
bClicked = false;
setFocus();
local n = getIndexAt(x, y);
setSelectionPosition(n);
setCursorPosition(n);
return true;
end
PK
64K Qk k $ campaign/scripts/weapon_equipped.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function onButtonPress()
if(getValue() > 0) then
window.windowlist.equip(window);
else
window.windowlist.unequip(window);
window.attack_ready.setValue(0);
window.defence_ready.setValue(0);
end
end
PK
H(Kv campaign/scripts/weapon_line.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
local actor;
function onInit()
local parent = window;
if not parent then
parent = windowlist.window;
end
actor = parent.getDatabaseNode();
if actor and actor.getChild("..").getPath() == "combattracker.list"
and parent.link then
actor = parent.link.getTargetDatabaseNode();
end
end
function getActor()
return actor;
end
function equip(weapon)
for _,item in ipairs(windowlist.getWindows()) do
if item ~= weapon then
item.equipped.setValue(0);
end
end
-- windowlist.window.equipped = weapon;
end
PK
/c8K_ campaign/scripts/wounds.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function onLoseFocus()
if getValue() < 0 then
setValue(-1);
end
end
PK
UMOh^ campaign/template_campaign.xml
20Click to Edit. Linked to Combat Tracker.Click to Edit. Double Click to Spend/Use.
sheettext
1100
PK
INkE E campaign/template_char.xml
char_main_category.maincategorylistlabel.attributelistchar_attributelabelchar_skill.skillslabelskillbase1base2name.traitschar_traitlabeltraits
sheetlabelmini
PK aP common/PK
ՒFxh h common/funky_dice.xml
dFicond2dFicond3dFicond5dFicond7dFicond14dFicond16dFicond24dFicond30
PK aP common/scripts/PK
;c8Kx common/scripts/button_expand.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function onInit()
local node = window.getDatabaseNode();
setVisible(node and not node.isReadOnly());
end
function onValueChanged()
setVisibility();
end
function setVisibility()
local expanded = getValue() ~= 0;
if(collapse) then
window[collapse[1]].setVisible(not expanded);
end
if(expand) then
window[expand[1]].setVisible(expanded);
if type(window[expand[1]]) == "windowlist" and window[expand[1]].getWindowCount()== 0 then
window[expand[1]].addEntry(true);
end
end
end
PK
!8KD common/scripts/link_token.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function onInit()
end
function onDragStart(button, x, y, dragdata)
if window.shortcut and not window.shortcut.isEmpty() then
return loadData(dragdata, window.shortcut);
elseif window.listlink and not window.listlink.isEmpty() then
return loadData(dragdata, window.listlink);
elseif window.link and not window.link.isEmpty() then
return loadData(dragdata, window.link);
end
type = dragdata.getType()
if type == "shortcut" then
type, id = dragdata.getShortcutData();
Debug.console("drag start, class: "..type.." id: "..id);
else
Debug.console("drag start, type: "..type);
end;
return true;
end
function onClickDown( button, x, y )
return true;
end
function onClickRelease( button, x, y )
if window.shortcut and not window.shortcut.isEmpty() then
return window.shortcut.activate() ~= nil;
elseif window.listlink and not window.listlink.isEmpty() then
return window.listlink.activate() ~= nil;
elseif window.link and not window.link.isEmpty() then
return window.link.activate() ~= nil;
end
end
function loadData(dragdata, link)
local type, id = link.getValue();
local descr = "link";
dragdata.reset();
dragdata.setType("shortcut");
dragdata.setShortcutData(type, id);
local node = DB.findNode(id);
if node and node.getChild("name") then
dragdata.setDescription(node.getChild("name").getValue());
else
dragdata.setIcon("button_expand");
end
return true;
end
function onDragEnd(dragdata)
local type = dragdata.getType()
if type == "shortcut" then
local id;
type, id = dragdata.getShortcutData();
Debug.console("drag end, class: "..type.." id: "..id);
else
Debug.console("drag end, type: "..type);
end;
end
PK
Cc8KU common/scripts/tag_summary.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function onInit()
onTagsChanged();
DB.addHandler(DB.getPath(window.getDatabaseNode(), getTagName()), "onChildUpdate", onTagsChanged);
end
function onClose()
DB.removeHandler(DB.getPath(window.getDatabaseNode(), getTagName()), "onChildUpdate", onTagsChanged);
end
function checkVisibility()
local expand_button = getExpandButton();
if expand_button then
setVisible(expand_button.getValue() ~= 1);
onTagsChanged();
end
end
function onClickDown(button, x, y)
if clickable then
local expand_button = getExpandButton();
if expand_button then
expand_button.setValue(1);
setVisible(false);
end
end
end
function onTagsChanged()
-- Set the effect summary string
local sTags = getTagString();
if sTags ~= "" then
setValue(sTags);
else
setValue(nil);
end
end
function getTagName()
if tags then
return tags[1];
else
return "tags";
end
end
function getExpandButton()
if expand_button then
return window[expand_button[1]];
else
return nil;
end
end
function getTagString()
-- Start with an empty tag list string
local aOutputTags = {};
-- Iterate through each tag
local aSorted = {};
for _,nodeChild in pairs(DB.getChildren(window.getDatabaseNode(), getTagName())) do
table.insert(aSorted, nodeChild);
end
table.sort(aSorted, function (a, b) return a.getName() < b.getName() end);
for _,v in pairs(aSorted) do
local sLabel = DB.getValue(v, "name", "");
local sScore = DB.getValue(v, "score", "");
if string.len(sScore) > 0 then
sLabel = sLabel.." "..sScore;
end
if string.len(sLabel) > 0 then
table.insert(aOutputTags, sLabel);
end
end
-- Return the final effect list string
return table.concat(aOutputTags, ", ");
end
PK
4jlK68 8 common/template_common.xml
16
sheettext
PK aP ct/PK
ȕP. &K K ct/ct_client.xml
ctbox
ct_window_title5,65,-41,-68labelslist
ctentrybox
00.weaponlistweapon_line_short
PK
LPVoqI qI ct/ct_host.xml
ctbox
ct_window_title5,66,-43,-6756,20,70,29list
ctentrybox
0,0,0,00,0,0,00,0,0,00100button_target_downct_targetsbutton_sword_downname.weaponlistweapon_line_shortweapon*button_shield_down20button_effect_down.effectsct_effecteffects.targetsct_target26-45,2,20,20-20,2,20,20
PK aP ct/scripts/PK
xP, , ct/scripts/button_action.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
local expanded;
function onInit()
if super and super.onInit then
super.onInit();
end
expanded = window.expanded;
end
function getOpeningLabel()
return "action";
end
function getExpanded()
return expanded.getValue();
end
function setExpanded(v)
expanded.setValue(v);
end
function getActor()
return ActorManager.getActorFromCT(self.getNode());
end
function onButtonPress()
if not super.onButtonPress() then
if self.getLevel() ~= 2 or getExpanded() > 0 then
action();
setExpanded(0);
else
setExpanded(1);
end
window.updateDisplay();
end
end
function getNode()
return super.getNode();
end
function getOpening()
return super.getOpening();
end
function updateSR()
if getLevel() == 2 then
local sr = self.getNode().createChild("initresult", "number").getValue();
sr = sr - self.getSrExpenditure();
self.getNode().getChild("initresult").setValue(sr);
self.open("*");
end
end
function getLevel()
if window.level then
return window.level.getValue();
else
return 0;
end
end
function getWeapon(type)
local control = "";
if type == "defence" then
control = "defence_ready";
elseif type == "ranged" or type == "melee" or type == "attack" then
control = "attack_ready";
else
return { reach=0, attack_sr=3, defence_sr=5 };
end
local weapons = window.getDatabaseNode().getChild("weaponlist");
if not weapons and window.link and window.link.getTargetDatabaseNode() then
weapons = window.link.getTargetDatabaseNode().getChild("weaponlist");
end
if weapons then
for _,weapon in pairs(weapons.getChildren()) do
if weapon.getChild(control).getValue() > 0 then
return { name=weapon.getChild("name").getValue(),
reach=weapon.getChild("reach").getValue(),
attack_sr=weapon.getChild("attack_sr").getValue(),
defence_sr=weapon.getChild("defence_sr").getValue(),
special_opening=weapon.createChild("special_opening", "string").getValue() };
end
end
end
if window.attacks then
for _,weapon in ipairs(window.attacks.getWindows()) do
if weapon[control].getValue() > 0 then
return { name=weapon.name.getValue(),
reach=weapon.reach.getValue(),
attack_sr=weapon.attack_sr.getValue(),
defence_sr=weapon.defence_sr.getValue(),
special_opening=weapon.special_opening.getValue() };
end
end
end
return { reach=0, attack_sr=3, defence_sr=5 };
end
function canAct()
return self.getLevel() < 2 or (string.len(getOpening()) > 0
and (getOpening() == getOpeningLabel() or action))
end
function action()
local weapon = self.getWeapon(self.getOpeningLabel());
local rRoll = { sType = "action",
sDesc = Interface.getString("message_"..self.getOpeningLabel()),
aDice = {},
nMod = self.getSrExpenditure() };
if self.canAct() then
if window.getDatabaseNode().getChild("skill") then
rRoll.sDesc = window.getDatabaseNode().getChild("skill").getValue();
if skill == nil or skill:len() == 0 then
rRoll.sDesc = Interface.getString("message_"..self.getOpeningLabel());
end
end
rRoll.sType = "attack";
rRoll.aDice = GameSystem.getPercentileDice();
rRoll.nMod = 0;
end
if weapon and weapon.name then
rRoll.sDesc = rRoll.sDesc.." with "..weapon.name;
end
if window.getDatabaseNode().getChild("trait") then
local trait = window.getDatabaseNode().getChild("trait").getValue();
if trait and trait ~= "" then
trait = " ["..trait.."]";
else
trait = "";
end
rRoll.sDesc = rRoll.sDesc..trait;
end
if getLevel() == 2 then
local cost = self.getSrExpenditure();
self.updateSR();
if cost > 0 then
rRoll.sDesc = rRoll.sDesc.." ("..tostring(cost).." sr)"
end
end
if #rRoll.aDice > 0 then
AttackManager.performRoll(nil, getActor(), rRoll);
else
ChatManager.Message(rRoll.sDesc,
not (User.isHost() and OptionsManager.isOption("REVL", "off")),
getActor());
end
end
PK
2P.I|T T ct/scripts/button_ctaction.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function getActor()
local node = window.getDatabaseNode();
return ActorManager.getActorFromCT(node);
end
function onButtonPress()
if window.opening and window.opening.getValue() == nil then
if super and super.onButtonPress then
super.onButtonPress();
end
window.opening.setValue(getOpeningValue());
if window.update then
window.update()
end
else
action();
end
end
function getOpeningValue()
return nil;
end
function action()
local trait = "";
local mod = 0;
local skill = "Roll";
if window.getDatabaseNode().getChild("skill") then
skill = window.getDatabaseNode().getChild("skill").getValue();
if skill == nil or skill:len() == 0 then
skill = "Roll";
end
end
if window.getDatabaseNode().getChild("trait") then
trait = window.getDatabaseNode().getChild("trait").getValue();
if trait and trait ~= "" then
trait = " ["..trait.."]";
else
trait = "";
end
-- mod = 30;
end
local rRoll = { sType = "attack",
sDesc = skill..trait,
aDice = GameSystem.getPercentileDice(),
nMod = mod};
AttackManager.performRoll(nil, getActor(), rRoll);
end
PK
[c8K; ct/scripts/button_ct_endturn.lua--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function onButtonPress()
if window.getLevel() ~= 2 then
CombatManager.notifyEndTurn();
end
end
PK
dc8Kv<