content stringlengths 5 1.05M |
|---|
local list = {'.'} --'app', 'lib', 'tests', 'util', 'importacoes', 'api'}
for _, dir in ipairs(list) do
local list = os.glob(dir, '\\.txt$', true)
for fileName in list:each() do
print(fileName)
local buffer = os.read(fileName)
local buffer = buffer:replace('charon', 'arken')
local buffer = buffer:replace('CHARON', 'ARKEN')
local buffer = buffer:replace('Charon', 'Arken')
local file = io.open(fileName, 'w')
file:write(buffer)
file:close()
end
end
|
module("shadows.Object", package.seeall)
Object = {}
Object.__index = Object
Object.__type = "Object"
function Object:typeOf(Name)
local Metatable = getmetatable(self)
while Metatable do
if Metatable.__type == Name then
return true
end
Metatable = getmetatable(Metatable)
end
return false
end
function Object:type()
return self.__type
end
return Object |
---@diagnostic disable: trailing-space
local milky = require "milky"
milky.render_rectangles = false
function love.load()
love.window.setMode(800, 600)
grid_size = 10
-- data structs init
-- DEFINES
CHANCE_FOR_A_POTION_TO_SPOIL = 0.0001
-- flags
map_build_flag = {}
-- lists
ALIVE_RATS = {}
ALIVE_HEROES = {}
ALIVE_CHARS = {}
-- kingdom
kingdom_wealth = 0
hunt_budget = 0
REWARD = 10
POTION_PRICE = 10
FOOD_PRICE = 2
INVESTMENT_TYPE = {}
INVESTMENT_TYPE.TREASURY = 0
INVESTMENT_TYPE.HUNT = 1
BUDGET_RATIO = {}
BUDGET_RATIO[INVESTMENT_TYPE.TREASURY] = 100
BUDGET_RATIO[INVESTMENT_TYPE.HUNT] = 0
INCOME_TAX = 90
-- character states
CHAR_STATE = {}
init_occupation_vars()
-- responses
CHANGE_HP_RESPONSE = {}
CHANGE_HP_RESPONSE.DEAD = 0
CHANGE_HP_RESPONSE.ALIVE = 1
CHAR_ATTACK_RESPONSE = {}
CHAR_ATTACK_RESPONSE.KILL = 0
CHAR_ATTACK_RESPONSE.DAMAGE = 1
CHAR_ATTACK_RESPONSE.NO_DAMAGE = 2
---- init arrays
-- characters
init_chars_arrays()
init_food_array()
-- buildings
last_building = 1
buildings_i = {}
buildings_j = {}
buildings_wealth_before_taxes = {}
buildings_wealth_after_taxes = {}
buildings_type = {}
buildings_char_amount = {}
buildings_stash = {}
building_is_state_owned = {}
BUILDING_TYPES = {}
BUILDING_TYPES.ALCHEMIST = 0
BUILDING_TYPES.CASTLE = 1
BUILDING_TYPES.RAT_LAIR = 2
BUILDING_TYPES.FOOD_SHOP = 3
-- game data
kingdom_wealth = 500
new_building(BUILDING_TYPES.CASTLE, 30, 30)
local tmp = new_building(BUILDING_TYPES.ALCHEMIST, 37, 23)
buildings_stash[tmp] = 200
building_is_state_owned[tmp] = true
new_building(BUILDING_TYPES.RAT_LAIR, 7, 8)
new_building(BUILDING_TYPES.RAT_LAIR, 3, 50)
new_building(BUILDING_TYPES.RAT_LAIR, 53, 37)
new_tax_collector()
local t = new_hero(100)
chars_occupation[t] = CHAR_OCCUPATION.FOOD_COLLECTOR
for i = 1, 100 do
for j = 1, 100 do
if (map_build_flag[i] == nil) or (map_build_flag[i][j] == nil) then
local dice = math.random()
if dice > 0.9 then
new_food(i, j)
end
end
end
end
-- camera setup
cam = {0, 0}
map_control_ui = milky.panel:new(milky, nil, nil, nil)
:position(0, 0)
:size(602, 600)
:toogle_background()
-- interface init
main_ui = milky.panel:new(milky, nil, nil, nil)
:position(602,0)
:size(198, 600)
:toogle_background()
gold_widget = milky.panel:new(milky, main_ui)
:position(3, 3)
:size(192, 54)
:toogle_border()
wealth_label = milky.panel:new(milky, gold_widget, 'TREASURY'):position(5, 6)
wealth_widget = milky.panel:new(milky, gold_widget, "???", nil):position(150, 6)
hunt_label = milky.panel:new(milky, gold_widget, 'HUNT INVESTED'):position(5, 26)
hunt_widget = milky.panel:new(milky, gold_widget, "???", nil):position(150, 26)
invest_widget = milky.panel:new(milky, main_ui)
:position(3, 60)
:size(192, 100)
:toogle_border()
income_invest_label = milky.panel:new(milky, invest_widget, 'ROYAL INVESTMENTS'):position(4, 5)
treasury_invest_body, treasury_invest_value = create_invest_row(invest_widget, "TREASURY", INVESTMENT_TYPE.TREASURY)
hunt_invest_body, hunt_invest_value = create_invest_row(invest_widget, "HUNT", INVESTMENT_TYPE.HUNT)
treasury_invest_body:position(10, 35)
hunt_invest_body:position(10, 55)
rewards_widget = milky.panel:new(milky, main_ui)
:position(3, 163)
:size(192, 70)
:toogle_border()
rewards_label = milky.panel:new(milky, rewards_widget, 'REWARDS'):position(4, 5)
rewards_label_rat = milky.panel:new(milky, rewards_widget, 'RAT'):position(10, 35)
rewards_label_rat_value = milky.panel:new(milky, rewards_widget, '10'):position(120, 35)
tax_widget = milky.panel:new(milky, main_ui)
:position(3, 236)
:size(192, 70)
:toogle_border()
tax_label = milky.panel:new(milky, tax_widget, 'TAXES'):position(4, 5)
inc_tax_label = milky.panel:new(milky, tax_widget, 'INCOME TAX'):position(10, 35)
inc_tax_value = milky.panel:new(milky, tax_widget, '0%'):position(120, 35)
hire_button = milky.panel:new(milky, main_ui)
:position(3, 500)
:size(192, 24)
:button(milky, function (self, button) hire_hero() end)
:toogle_border()
hire_button_label = milky.panel:new(milky, hire_button, "HIRE A HERO (100)"):position(5, 2)
add_hunt_budget_button = milky.panel:new(milky, main_ui)
:position(3, 527)
:size(192, 24)
:button(milky, function (self, button) add_hunt_budget() end)
:toogle_border()
add_hunt_budget_label = milky.panel:new(milky, add_hunt_budget_button, "ADD HUNT MONEY (100)"):position(5, 2)
end
-- ui manipulations
function create_invest_row(parent, label, it)
local body = milky.panel:new(milky, parent):size(187, 25):position(0, 0)
local label = milky.panel:new(milky, body, label):position(0, 5):size(80, 17)
local value = milky.panel:new(milky, body, '???'):position(120, 5):size(35, 17)
local bd = milky.panel:new(milky, body, " -"):position(90, 5):size(15, 15):button(milky, function (self, button) dec_inv(it) end):toogle_border()
local bi = milky.panel:new(milky, body, " +"):position(160, 5):size(15, 15):button(milky, function (self, button) inc_inv(it) end):toogle_border()
return body, value
end
-- draw loop
function love.draw()
love.graphics.setColor(1, 1, 0)
for i = 1, last_char - 1 do
if (ALIVE_CHARS[i]) then
love.graphics.circle('line', chars_x[i], chars_y[i], 2)
end
end
for i = 1, last_building - 1 do
love.graphics.rectangle('line', buildings_i[i] * grid_size, buildings_j[i] * grid_size, grid_size, grid_size)
end
for i = 1, last_food - 1 do
if food_cooldown[i] == 0 then
love.graphics.setColor(1, 0, 0)
else
love.graphics.setColor(0.3, 0, 0)
end
c_x = food_pos[i].x * grid_size + grid_size / 2
c_y = food_pos[i].y * grid_size + grid_size / 2
love.graphics.circle('line', c_x, c_y, 3)
end
love.graphics.setColor(1, 1, 0)
main_ui:draw()
end
-- game logic loop
time_passed = 0
tps = 20
tick = 1 / tps / 10--/ 50
function love.update(dt)
time_passed = time_passed + dt
while time_passed > tick do
time_passed = time_passed - tick
-- chars update
for i, h in ipairs(chars_hunger) do
chars_hunger[i] = h + 1
end
for i, h in ipairs(chars_cooldown) do
if h > 0 then
chars_cooldown[i] = h - 1
end
end
for i = 1, last_char - 1 do
if ALIVE_CHARS[i] then
local dice = math.random()
if dice < CHANCE_FOR_A_POTION_TO_SPOIL then
if chars_potions[i] > 0 then
chars_potions[i] = chars_potions[i] - 1
end
end
AGENT_LOGIC[chars_occupation[i]](i)
end
end
for i = 1, last_building - 1 do
if buildings_type[i] == BUILDING_TYPES.RAT_LAIR then
if buildings_char_amount[i] < 100 then
local dice = math.random()
if dice > 0.999 then
new_rat(i)
buildings_char_amount[i] = buildings_char_amount[i] + 1
end
end
end
end
for i = 1, last_food - 1 do
if food_cooldown[i] > 0 then
food_cooldown[i] = food_cooldown[i] - 1
end
end
end
-- interface update
wealth_widget:update_label(tostring(kingdom_wealth))
hunt_widget:update_label(tostring(hunt_budget))
hunt_invest_value:update_label(tostring(BUDGET_RATIO[INVESTMENT_TYPE.HUNT]) .. '%')
treasury_invest_value:update_label(tostring(BUDGET_RATIO[INVESTMENT_TYPE.TREASURY]) .. '%')
inc_tax_value:update_label(tostring(INCOME_TAX) .. '%')
end
function love.mousepressed(x, y, button, istouch)
milky:onClick(x, y, button)
end
function love.mousereleased(x, y, button, istouch)
milky:onRelease(x, y, button)
end
function love.mousemoved(x, y, dx, dy, istouch)
milky:onHover(x, y)
end
-- data initialization
function init_chars_arrays()
last_char = 1
chars_hp = {}
chars_weapon = {}
chars_weapon_d = {}
chars_armour = {}
chars_armour_d = {}
chars_x = {}
chars_y = {}
chars_state = {}
chars_target = {}
chars_state_target = {}
chars_wealth = {}
chars_potions = {}
chars_home = {}
chars_occupation = {}
chars_cooldown = {}
chars_hunger = {}
end
function init_food_array()
last_food = 1
food_pos = {}
food_cooldown = {}
end
last_state_id = 0
function new_state_id()
last_state_id = last_state_id + 1
return last_state_id
end
-- getters
function char_dist(i, j)
return dist(chars_x[i], chars_y[i], chars_x[j], chars_y[j])
end
function char_build_dist(i, j)
return dist(chars_x[i], chars_y[i], buildings_x(j), buildings_y(j))
end
function dist(a, b, c, d)
local t1 = math.abs(a - c)
local t2 = math.abs(b - d)
return math.max(t1, t2) + t1 + t2
end
function buildings_x(i)
return buildings_i[i] * grid_size + grid_size/2
end
function buildings_y(i)
return buildings_j[i] * grid_size + grid_size/2
end
D_list = {}
D_list[1] = {0, 1}
D_list[2] = {0, -1}
D_list[3] = {1, 1}
D_list[4] = {1, -1}
D_list[5] = {-1, 1}
D_list[6] = {-1, -1}
D_list[7] = {1, 0}
D_list[8] = {-1, 0}
function get_new_building_location()
local r = 2
local c_x = buildings_i[1]
local c_y = buildings_j[1]
while r < 10 do
for _, i in ipairs(D_list) do
local t_x = i[1] * r + c_x
local t_y = i[2] * r + c_y
if (map_build_flag[t_x] == nil) or (map_build_flag[t_x][t_y] == nil) then
local dice = math.random()
if dice > 0.7 then
return t_x, t_y
end
end
end
end
end
function find_closest_food_shop(i)
local closest = nil
local opt_dist = 0
local x = chars_x[i]
local y = chars_y[i]
for j = 1, last_building - 1 do
local p_x = buildings_x(j)
local p_y = buildings_y(j)
local dist = dist(x, y, p_x, p_y)
if ((closest == nil) or (opt_dist > dist)) and (buildings_type[j] == BUILDING_TYPES.FOOD_SHOP) and (buildings_stash[j] > 0) then
closest = j
opt_dist = dist
end
end
return closest
end
function find_closest_potion_shop(i)
local closest = nil
local opt_dist = 0
local x = chars_x[i]
local y = chars_y[i]
for j = 1, last_building - 1 do
local p_x = buildings_x(j)
local p_y = buildings_y(j)
local dist = dist(x, y, p_x, p_y)
if ((closest == nil) or (opt_dist > dist)) and (buildings_type[j] == BUILDING_TYPES.ALCHEMIST) and (buildings_stash[j] > 0) then
closest = j
opt_dist = dist
end
end
return closest
end
-- constructors
function new_char(hp, wealth, state, home)
chars_hp[last_char] = hp
chars_wealth[last_char] = wealth
chars_weapon[last_char] = 3
chars_armour[last_char] = 1
chars_state[last_char] = state
chars_target[last_char] = {}
chars_state_target[last_char] = nil
chars_home[last_char] = home
chars_x[last_char] = buildings_i[chars_home[last_char]] * grid_size + grid_size/2
chars_y[last_char] = buildings_j[chars_home[last_char]] * grid_size + grid_size/2
chars_occupation[last_char] = CHAR_OCCUPATION.HUNTER
chars_potions[last_char] = 0
chars_cooldown[last_char] = 0
ALIVE_CHARS[last_char] = true
chars_hunger[last_char] = 0
last_char = last_char + 1
end
function new_food(x, y)
food_pos[last_food] = {}
food_pos[last_food].x = x
food_pos[last_food].y = y
food_cooldown[last_food] = 0
last_food = last_food + 1
end
function new_tax_collector()
new_char(50, 0, CHAR_STATE.TAX_COLLECTOR_WAIT_IN_CASTLE, 1)
chars_occupation[last_char - 1] = CHAR_OCCUPATION.TAX_COLLECTOR
end
function new_hero(wealth)
ALIVE_HEROES[last_char] = true
new_char(100, wealth, CHAR_STATE.WANDERING, 1)
chars_weapon[last_char - 1] = 2
return last_char - 1
end
function new_rat(nest)
chars_hp[last_char] = 30
chars_wealth[last_char] = 0
chars_weapon[last_char] = 2
chars_weapon_d[last_char] = 100
chars_armour[last_char] = 1
chars_armour_d[last_char] = 100
chars_state[last_char] = CHAR_STATE.PROTECT_THE_LAIR
chars_target[last_char] = {}
chars_home[last_char] = nest
chars_potions[last_char] = 0
chars_x[last_char] = buildings_i[chars_home[last_char]] * grid_size + grid_size/2
chars_y[last_char] = buildings_j[chars_home[last_char]] * grid_size + grid_size/2
chars_occupation[last_char] = CHAR_OCCUPATION.RAT
ALIVE_RATS[last_char] = true
ALIVE_CHARS[last_char] = true
chars_hunger[last_char] = 0
last_char = last_char + 1
end
function new_building(buiding_type, i, j)
if map_build_flag[i] == nil then
map_build_flag[i] = {}
end
map_build_flag[i][j] = true
buildings_i[last_building] = i
buildings_j[last_building] = j
buildings_type[last_building] = buiding_type
buildings_wealth_before_taxes[last_building] = 0
buildings_wealth_after_taxes[last_building] = 0
buildings_char_amount[last_building] = 0
buildings_stash[last_building] = 0
building_is_state_owned[last_building] = false
last_building = last_building + 1
return last_building - 1
end
-- character manipulation functions
MOVEMENT_RESPONCES = {}
MOVEMENT_RESPONCES.TARGET_REACHED = 1
MOVEMENT_RESPONCES.STILL_MOVING = 2
function char_move_to_target(i)
if chars_target[i].x == nil then
return
end
local dx = chars_target[i].x - chars_x[i]
local dy = chars_target[i].y - chars_y[i]
local norm = math.sqrt(dx * dx + dy * dy)
if (norm > 1) then
chars_x[i] = chars_x[i] + dx / norm
chars_y[i] = chars_y[i] + dy / norm
return MOVEMENT_RESPONCES.STILL_MOVING
else
chars_x[i] = chars_x[i] + dx
chars_y[i] = chars_y[i] + dy
return MOVEMENT_RESPONCES.TARGET_REACHED
end
end
function char_buy_potions(i, shop)
if chars_wealth[i] >= POTION_PRICE then
buildings_wealth_before_taxes[shop] = buildings_wealth_before_taxes[shop] + POTION_PRICE
chars_wealth[i] = chars_wealth[i] - POTION_PRICE
chars_potions[i] = chars_potions[i] + 1
end
end
function char_buy_food(i, shop)
if chars_wealth[i] >= FOOD_PRICE then
buildings_wealth_before_taxes[shop] = buildings_wealth_before_taxes[shop] + FOOD_PRICE
chars_wealth[i] = chars_wealth[i] - FOOD_PRICE
buildings_stash[shop] = buildings_stash[shop] - 1
char_change_hp(i, 10)
chars_hunger[i] = 0
end
end
function char_tax_building(i, shop)
local tax = 0
if building_is_state_owned[i] then
tax = buildings_wealth_before_taxes[shop]
else
tax = math.floor(buildings_wealth_before_taxes[shop] * INCOME_TAX / 100)
end
chars_wealth[i] = chars_wealth[i] + tax
buildings_wealth_after_taxes[shop] = buildings_wealth_before_taxes[shop] - tax
buildings_wealth_before_taxes[shop] = 0
end
function char_return_tax(i)
kingdom_income(chars_wealth[i])
chars_wealth[i] = 0
end
function char_attack_char(i, j)
if chars_weapon[i] > chars_armour[j] then
local tmp = char_change_hp(j, -10 + chars_armour[j] - chars_weapon[i])
if tmp == CHANGE_HP_RESPONSE.DEAD then
chars_wealth[i] = chars_wealth[i] + chars_wealth[j]
chars_wealth[j] = 0
return CHAR_ATTACK_RESPONSE.KILL
end
return CHAR_ATTACK_RESPONSE.DAMAGE
end
return CHAR_ATTACK_RESPONSE.NO_DAMAGE
end
function char_drink_pot(i)
if chars_potions[i] > 0 then
chars_potions[i] = chars_potions[i] - 1
char_change_hp(i, 30)
end
end
function char_change_hp(i, dh)
if chars_hp[i] + dh > 0 then
chars_hp[i] = chars_hp[i] + dh
return CHANGE_HP_RESPONSE.ALIVE
else
ALIVE_HEROES[i] = nil
ALIVE_RATS[i] = nil
ALIVE_CHARS[i] = nil
return CHANGE_HP_RESPONSE.DEAD
end
end
function char_recieve_reward(i)
if hunt_budget > REWARD then
chars_wealth[i] = chars_wealth[i] + REWARD
hunt_budget = hunt_budget - REWARD
else
chars_wealth[i] = chars_wealth[i] + hunt_budget
hunt_budget = 0
end
end
function char_change_state(i, state)
if (state == nil) then
error("character state changed to nil")
end
if (chars_state[i] == state) then
return
end
chars_state[i] = state
chars_target[i].x = nil
chars_target[i].y = nil
chars_state_target[i] = nil
end
function char_set_home(a, b)
chars_home[a] = b
end
function char_collect_food(i, j)
food_cooldown[j] = 10000
end
function char_transfer_item_building(i, j)
buildings_stash[j] = buildings_stash[j] + 1
end
function char_collect_money_from_building(i, j)
local tmp = buildings_wealth_after_taxes[j]
buildings_wealth_after_taxes[j] = 0
chars_wealth[i] = chars_wealth[i] + tmp
end
-- actions of a king
function hire_hero()
if kingdom_wealth >= 100 then
kingdom_wealth = kingdom_wealth - 100
new_hero(100)
end
end
function add_hunt_budget()
if kingdom_wealth >= 100 then
kingdom_wealth = kingdom_wealth - 100
hunt_budget = hunt_budget + 100
else
hunt_budget = hunt_budget + kingdom_wealth
kingdom_wealth = 0
end
end
function dec_inv(it)
if BUDGET_RATIO[it] > 0 then
BUDGET_RATIO[it] = BUDGET_RATIO[it] - 10
BUDGET_RATIO[INVESTMENT_TYPE.TREASURY] = BUDGET_RATIO[INVESTMENT_TYPE.TREASURY] + 10
end
end
function inc_inv(it)
if BUDGET_RATIO[INVESTMENT_TYPE.TREASURY] > 0 then
BUDGET_RATIO[it] = BUDGET_RATIO[it] + 10
BUDGET_RATIO[INVESTMENT_TYPE.TREASURY] = BUDGET_RATIO[INVESTMENT_TYPE.TREASURY] - 10
end
end
function dec_tax(it)
if INCOME_TAX > 0 then
INCOME_TAX = INCOME_TAX - 10
end
end
function inc_tax(it)
if INCOME_TAX < 100 then
INCOME_TAX = INCOME_TAX + 10
end
end
-- kingdom manipulatino
function kingdom_income(t)
local tmp = math.floor(BUDGET_RATIO[INVESTMENT_TYPE.HUNT] * t / 100)
kingdom_wealth = kingdom_wealth + t - tmp
hunt_budget = hunt_budget + tmp
end
function init_occupation_vars()
-- occupation list
CHAR_OCCUPATION = {}
CHAR_OCCUPATION.TAX_COLLECTOR = 1 -- character that collects taxes in buildings and returns them to castle
CHAR_OCCUPATION.HUNTER = 2 -- character that, if there is a hunting reward, hunts on corresponding targets
CHAR_OCCUPATION.GUARD = 3 -- character that guards his home
CHAR_OCCUPATION.RAT = 4
CHAR_OCCUPATION.FOOD_COLLECTOR = 5
-- occupation logic
AGENT_LOGIC = {}
STATE_LOGIC = {}
-- TAX COLLECTOR
-- TAX COLLECTOR SETTINGS
MIN_GOLD_TO_TAX = 9
MAX_GOLD_TO_CARRY = 100
-- TAX_COLLECTOR STATES
CHAR_STATE.TAX_COLLECTOR_COLLECT_TAXES = new_state_id()
CHAR_STATE.TAX_COLLECTOR_RETURN_TAXES = new_state_id()
CHAR_STATE.TAX_COLLECTOR_WAIT_IN_CASTLE = new_state_id()
-- TAX COLLECTOR RESPONCES
TAX_COLLECTOR_RESPONCES = {}
TAX_COLLECTOR_RESPONCES.NO_TAXABLE_BUILDINGS = 1
TAX_COLLECTOR_RESPONCES.FOUND_TARGET = 2
TAX_COLLECTOR_RESPONCES.ON_MY_WAY = 3
TAX_COLLECTOR_RESPONCES.IN_CASTLE = 4
TAX_COLLECTOR_RESPONCES.GOT_TAX = 5
TAX_COLLECTOR_RESPONCES.MAX_GOLD_REACHED = 6
AGENT_LOGIC[CHAR_OCCUPATION.TAX_COLLECTOR] = function (i)
if chars_state[i] == CHAR_STATE.TAX_COLLECTOR_COLLECT_TAXES then
res = TAX_COLLECTOR_COLLECT_TAXES(i)
if res == TAX_COLLECTOR_RESPONCES.MAX_GOLD_REACHED then
char_change_state(i, CHAR_STATE.TAX_COLLECTOR_RETURN_TAXES)
end
if res == TAX_COLLECTOR_RESPONCES.NO_TAXABLE_BUILDINGS then
char_change_state(i, CHAR_STATE.TAX_COLLECTOR_RETURN_TAXES)
end
if res == TAX_COLLECTOR_RESPONCES.FOUND_TARGET then
-- ok
end
if res == TAX_COLLECTOR_RESPONCES.GOT_TAX then
-- ok
end
if res == TAX_COLLECTOR_RESPONCES.ON_MY_WAY then
-- ok
end
end
if chars_state[i] == CHAR_STATE.TAX_COLLECTOR_RETURN_TAXES then
res = TAX_COLLECTOR_RETURN_TAXES(i)
if res == TAX_COLLECTOR_RESPONCES.IN_CASTLE then
char_change_state(i, CHAR_STATE.TAX_COLLECTOR_WAIT_IN_CASTLE)
end
end
if chars_state[i] == CHAR_STATE.TAX_COLLECTOR_WAIT_IN_CASTLE then
res = TAX_COLLECTOR_WAIT_IN_CASTLE(i)
if res == TAX_COLLECTOR_RESPONCES.FOUND_TARGET then
char_change_state(i, CHAR_STATE.TAX_COLLECTOR_COLLECT_TAXES)
end
end
end
function TAX_COLLECTOR_COLLECT_TAXES(i)
if chars_wealth[i] > MAX_GOLD_TO_CARRY then
return TAX_COLLECTOR_RESPONCES.MAX_GOLD_REACHED
end
if chars_state_target[i] == nil then
-- if no target, then find the most optimal (wealth to tax / distance) building and set it as a target
local optimal = 0
local final_target = nil
for j, w in ipairs(buildings_wealth_before_taxes) do
if (w > MIN_GOLD_TO_TAX) and (w / char_build_dist(i, j) > optimal) then
optimal = w / char_build_dist(i, j)
final_target = j
end
end
if final_target == nil then
return TAX_COLLECTOR_RESPONCES.NO_TAXABLE_BUILDINGS
end
chars_state_target[i] = final_target
chars_target[i].x = buildings_x(final_target)
chars_target[i].y = buildings_y(final_target)
return TAX_COLLECTOR_RESPONCES.FOUND_TARGET
elseif chars_state_target[i] ~= nil then
if char_build_dist(i, chars_state_target[i]) < 0.5 then
char_tax_building(i, chars_state_target[i])
chars_state_target[i] = nil
return TAX_COLLECTOR_RESPONCES.GOT_TAX
else
char_move_to_target(i)
return TAX_COLLECTOR_RESPONCES.ON_MY_WAY
end
end
end
function TAX_COLLECTOR_RETURN_TAXES(i)
if chars_state_target[i] == nil then
local closest_tax_storage = 1
chars_state_target[i] = 1
chars_target[i].x = buildings_x(closest_tax_storage)
chars_target[i].y = buildings_y(closest_tax_storage)
elseif chars_state_target[i] ~= nil then
if dist(chars_target[i].x, chars_target[i].y, chars_x[i], chars_y[i]) < 0.5 then
char_return_tax(i)
chars_state_target[i] = nil
return TAX_COLLECTOR_RESPONCES.IN_CASTLE
else
char_move_to_target(i)
return TAX_COLLECTOR_RESPONCES.ON_MY_WAY
end
end
end
function TAX_COLLECTOR_WAIT_IN_CASTLE(i)
local optimal, final_target = FIND_OPTIMAL_BUILDING_TO_TAX(i)
if final_target == nil then
return TAX_COLLECTOR_RESPONCES.NO_TAXABLE_BUILDINGS
end
chars_state_target[i] = final_target
chars_target[i].x = buildings_x(final_target)
chars_target[i].y = buildings_y(final_target)
return TAX_COLLECTOR_RESPONCES.FOUND_TARGET
end
function FIND_OPTIMAL_BUILDING_TO_TAX(i)
local optimal = 0
local final_target = nil
for j, w in ipairs(buildings_wealth_before_taxes) do
if (w > MIN_GOLD_TO_TAX) and (w / char_build_dist(i, j) > optimal) then
optimal = w / char_build_dist(i, j)
final_target = j
end
end
return optimal, final_target
end
-- HUNTER
-- HUNTER SETTINGS
HUNTER_DESIRED_AMOUNT_OF_POTIONS = 5
HUNTER_DESIRE_TO_HUNT_PER_MISSING_POTION = -2
HUNTER_DESITE_TO_HUNT_FOR_REWARD = 3
HUNTER_DESITE_TO_HUNT_WITHOUT_REWARD = -3
HUNTER_DESIRE_TO_CONTINUE_HUNT = 1
HUNTER_NO_RATS_HUNT_COOLDOWN = 100
-- HUNTER STATES
CHAR_STATE.HUNTER_BUY_POTION = new_state_id()
CHAR_STATE.HUNTER_BUY_FOOD = new_state_id()
CHAR_STATE.HUNTER_HUNT = new_state_id()
CHAR_STATE.HUNTER_WANDER = new_state_id()
-- HUNTER RESPONCES
HUNTER_RESPONCES = {}
HUNTER_RESPONCES.ON_MY_WAY = 1
HUNTER_RESPONCES.FOUND_TARGET = 2
HUNTER_RESPONCES.BOUGHT_POTION = 3
HUNTER_RESPONCES.TARGET_REACHED = 4
HUNTER_RESPONCES.NO_RATS = 5
HUNTER_RESPONCES.BOUGHT_FOOD = 6
--HUNTER DESIRES
HUNTER_DESIRE = {}
HUNTER_DESIRE.POTION = 1
HUNTER_DESIRE.FOOD = 2
HUNTER_DESIRE.HUNT = 3
HUNTER_DESIRE_CALC = {}
HUNTER_DESIRE_CALC[HUNTER_DESIRE.POTION] = function(i)
if (chars_wealth[i] < POTION_PRICE) then
return 0
end
return -(HUNTER_DESIRED_AMOUNT_OF_POTIONS - chars_potions[i]) * HUNTER_DESIRE_TO_HUNT_PER_MISSING_POTION
end
HUNTER_DESIRE_CALC[HUNTER_DESIRE.FOOD] = function(i)
if (chars_wealth[i] < FOOD_PRICE) then
return 0
end
return chars_hunger[i] / 1000 - 2
end
HUNTER_DESIRE_CALC[HUNTER_DESIRE.HUNT] = function(i)
local hunting_desire = HUNTER_DESITE_TO_HUNT_WITHOUT_REWARD
if (REWARD > hunt_budget) then
return hunting_desire
end
hunting_desire = hunting_desire + HUNTER_DESITE_TO_HUNT_FOR_REWARD - HUNTER_DESITE_TO_HUNT_WITHOUT_REWARD
if chars_cooldown[i] > 0 then
hunting_desire = hunting_desire - 1000
end
if chars_wealth[i] < 2 * POTION_PRICE then
hunting_desire = hunting_desire + HUNTER_DESITE_TO_HUNT_FOR_REWARD * 2
end
if chars_state[i] == CHAR_STATE.HUNTER_HUNT then
hunting_desire = hunting_desire + HUNTER_DESIRE_TO_CONTINUE_HUNT
end
return hunting_desire
end
AGENT_LOGIC[CHAR_OCCUPATION.HUNTER] = function (i)
if chars_hp[i] < 60 then
char_drink_pot(i)
end
if chars_state[i] == nil then
char_change_state(i, CHAR_STATE.HUNTER_WANDER)
end
local desire = {}
desire[HUNTER_DESIRE.POTION] = HUNTER_DESIRE_CALC[HUNTER_DESIRE.POTION](i)
desire[HUNTER_DESIRE.FOOD] = HUNTER_DESIRE_CALC[HUNTER_DESIRE.FOOD](i)
desire[HUNTER_DESIRE.HUNT] = HUNTER_DESIRE_CALC[HUNTER_DESIRE.HUNT](i)
local max_desire = 0
for j = 1, 3 do
if (max_desire == 0) or (desire[max_desire] < desire[j]) then
max_desire = j
end
end
-- print(desire[1], desire[2], desire[3])
if desire[max_desire] < 1 then
char_change_state(i, CHAR_STATE.HUNTER_WANDER)
elseif max_desire == HUNTER_DESIRE.POTION then
char_change_state(i, CHAR_STATE.HUNTER_BUY_POTION)
elseif max_desire == HUNTER_DESIRE.FOOD then
char_change_state(i, CHAR_STATE.HUNTER_BUY_FOOD)
elseif max_desire == HUNTER_DESIRE.HUNT then
char_change_state(i, CHAR_STATE.HUNTER_HUNT)
else
char_change_state(i, CHAR_STATE.HUNTER_WANDER)
end
if chars_state[i] == CHAR_STATE.HUNTER_HUNT then
res = HUNTER_HUNT(i)
if res == HUNTER_RESPONCES.NO_RATS then
chars_cooldown[i] = HUNTER_NO_RATS_HUNT_COOLDOWN
char_change_state(i, CHAR_STATE.HUNTER_WANDER)
end
end
if chars_state[i] == CHAR_STATE.HUNTER_WANDER then
res = HUNTER_WANDER(i)
if res == HUNTER_RESPONCES.TARGET_REACHED then
chars_state_target[i] = nil
end
end
if chars_state[i] == CHAR_STATE.HUNTER_BUY_POTION then
res = HUNTER_BUY_POTION(i)
if res == HUNTER_RESPONCES.BOUGHT_POTION then
char_change_state(i, CHAR_STATE.HUNTER_WANDER)
end
end
if chars_state[i] == CHAR_STATE.HUNTER_BUY_FOOD then
res = HUNTER_BUY_FOOD(i)
if res == HUNTER_RESPONCES.BOUGHT_FOOD then
char_change_state(i, CHAR_STATE.HUNTER_WANDER)
end
end
end
function HUNTER_HUNT(i)
local closest_rat = nil
local curr_dist = 99999
for j, f in pairs(ALIVE_RATS) do
if f then
local tmp = char_dist(j, i)
if (closest_rat == nil) or (tmp < curr_dist) then
closest_rat = j
curr_dist = tmp
end
end
end
if closest_rat ~= nil then
chars_target[i].x = chars_x[closest_rat]
chars_target[i].y = chars_y[closest_rat]
chars_state_target[i] = closest_rat
if curr_dist > 1 then
char_move_to_target(i)
else
local tmp = char_attack_char(i, closest_rat)
if (tmp == CHAR_ATTACK_RESPONSE.KILL) then
char_recieve_reward(i)
end
end
chars_state_target[i] = nil
end
if (chars_state_target[i] == nil) and (closest_rat == nil) then
return HUNTER_RESPONCES.NO_RATS
end
end
function HUNTER_WANDER(i)
if chars_state_target[i] == nil then
chars_state_target[i] = -1
local dice = math.random() - 0.5
chars_target[i].x = dice * dice * dice * 400 + buildings_x(chars_home[i])
local dice = math.random() - 0.5
chars_target[i].y = dice * dice * dice * 400 + buildings_y(chars_home[i])
else
local res = char_move_to_target(i)
if res == MOVEMENT_RESPONCES.STILL_MOVING then
return HUNTER_RESPONCES.ON_MY_WAY
end
if res == MOVEMENT_RESPONCES.TARGET_REACHED then
return HUNTER_RESPONCES.TARGET_REACHED
end
end
end
function HUNTER_BUY_POTION(i)
if chars_state_target[i] == nil then
local closest = find_closest_potion_shop(i)
if closest ~= nil then
chars_state_target[i] = closest
chars_target[i].x = buildings_x(closest)
chars_target[i].y = buildings_y(closest)
end
elseif dist(chars_target[i].x, chars_target[i].y, chars_x[i], chars_y[i]) < 0.5 then
char_buy_potions(i, chars_state_target[i])
return HUNTER_RESPONCES.BOUGHT_POTION
else
char_move_to_target(i)
return HUNTER_RESPONCES.ON_MY_WAY
end
end
function HUNTER_BUY_FOOD(i)
if chars_state_target[i] == nil then
local closest = find_closest_food_shop(i)
if closest ~= nil then
chars_state_target[i] = closest
chars_target[i].x = buildings_x(closest)
chars_target[i].y = buildings_y(closest)
end
elseif dist(chars_target[i].x, chars_target[i].y, chars_x[i], chars_y[i]) < 0.5 then
char_buy_food(i, chars_state_target[i])
return HUNTER_RESPONCES.BOUGHT_FOOD
else
char_move_to_target(i)
return HUNTER_RESPONCES.ON_MY_WAY
end
end
-- RAT
---- rats are common vermin that hurts your early stage of the kingdom
-- RAT SETTINGS
RAT_DISTANCE_FROM_LAIR = 410
-- RAT STATES
CHAR_STATE.RAT_PROTECT_LAIR = new_state_id()
-- HUNTER RESPONCES
RAT_RESPONCES = {}
RAT_RESPONCES.ON_MY_WAY = 1
RAT_RESPONCES.FOUND_TARGET = 2
RAT_RESPONCES.TARGET_REACHED = 3
RAT_RESPONCES.NO_ENEMIES = 4
AGENT_LOGIC[CHAR_OCCUPATION.RAT] = function (i)
RAT_PROTECT_LAIR(i)
end
function RAT_PROTECT_LAIR(i)
local closest_hero = nil
local curr_dist = 20
for j, f in pairs(ALIVE_HEROES) do
if f then
local tmp = char_dist(j, i)
if ((closest_hero == nil) and (tmp < curr_dist)) or (tmp < curr_dist) then
closest_hero = j
curr_dist = tmp
end
end
end
local from_home_dist = char_build_dist(i, chars_home[i])
if (closest_hero ~= nil) and (from_home_dist < RAT_DISTANCE_FROM_LAIR) then
chars_target[i] = {}
chars_target[i].x = chars_x[closest_hero]
chars_target[i].y = chars_y[closest_hero]
if curr_dist > 1 then
char_move_to_target(i)
else
char_attack_char(i, closest_hero)
end
elseif chars_target[i].x == nil then
local dice = math.random() - 0.5
chars_target[i].x = dice * dice * dice * 800 + buildings_x(chars_home[i])
local dice = math.random() - 0.5
chars_target[i].y = dice * dice * dice * 800 + buildings_y(chars_home[i])
elseif chars_target[i].x ~= nil then
res = char_move_to_target(i)
if res == MOVEMENT_RESPONCES.TARGET_REACHED then
chars_target[i].x = nil
chars_target[i].y = nil
end
end
end
-- FOOD_COLLECTOR
---- food collector is an agent that goes to food that randomly grows around the map, +
---- collects it and sells it in his shop, which he sets up not far from the castle +
---- during collection, he could hurt himself, so he is carrying a bit of potions with him -
---- he can carry only one food item in hands +
---- one food item restores full hp and removes hunger but can't be carried like a potion
---- so other agents should prioritise eating to using potions, if they are not engaged in other activities
---- income: selling food
---- expenses: potions, taxes
CHAR_STATE.FOOD_COLLECTOR_SET_UP_SHOP = new_state_id()
CHAR_STATE.FOOD_COLLECTOR_COLLECT_FOOD = new_state_id()
CHAR_STATE.FOOD_COLLECTOR_RETURN_FOOD = new_state_id()
CHAR_STATE.FOOD_COLLECTOR_FIND_FOOD = new_state_id()
CHAR_STATE.FOOD_COLLECTOR_BUY_POTION = new_state_id()
CHAR_STATE.FOOD_COLLECTOR_STAY_IN_SHOP = new_state_id()
FOOD_COLLECTOR_RESPONCES = {}
FOOD_COLLECTOR_RESPONCES.GOT_FOOD = 1
FOOD_COLLECTOR_RESPONCES.AT_HOME = 2
FOOD_COLLECTOR_RESPONCES.NO_FOOD_AROUND = 3
FOOD_COLLECTOR_RESPONCES.NO_FOOD_LEFT = 4
--FOOD_COLLECTOR DESIRES
FOOD_COLLECTOR_POTIONS_TARGET = 2
FOOD_COLLECTOR_DESIRE_TO_BUY_POTION_PER_MISSING_UNIT = 1
FOOD_COLLECTOR_FOOD_TARGET = 10
FOOD_COLLECTOR_DESIRE_TO_COLLECT_FOOD_PER_MISSING_UNIT = 1
FOOD_COLLECTOR_DESIRE_TO_CONTINUE_COLLECT_FOOD = 5
FOOD_COLLECTOR_DESIRE = {}
FOOD_COLLECTOR_DESIRE.POTION = 11
FOOD_COLLECTOR_DESIRE.FOOD = 12
FOOD_COLLECTOR_DESIRE.COLLECT_FOOD = 13
DESIRE_CALC = {}
DESIRE_CALC[FOOD_COLLECTOR_DESIRE.POTION] = function(i)
if (chars_wealth[i] < POTION_PRICE) then
return 0
end
return (FOOD_COLLECTOR_POTIONS_TARGET - chars_potions[i]) * FOOD_COLLECTOR_DESIRE_TO_BUY_POTION_PER_MISSING_UNIT
end
DESIRE_CALC[FOOD_COLLECTOR_DESIRE.FOOD] = function(i)
return chars_hunger[i] / 1000 - 2
end
DESIRE_CALC[FOOD_COLLECTOR_DESIRE.COLLECT_FOOD] = function(i)
local home = chars_home[i]
local tmp = 0
if chars_state[i] == CHAR_STATE.FOOD_COLLECTOR_COLLECT_FOOD then
tmp = FOOD_COLLECTOR_DESIRE_TO_CONTINUE_COLLECT_FOOD
end
return tmp + (FOOD_COLLECTOR_FOOD_TARGET - buildings_stash[home]) * FOOD_COLLECTOR_DESIRE_TO_BUY_POTION_PER_MISSING_UNIT
end
AGENT_LOGIC[CHAR_OCCUPATION.FOOD_COLLECTOR] = function (i)
if chars_hp[i] < 60 then
char_drink_pot(i)
end
if chars_state[i] == nil then
chars_state[i] = CHAR_STATE.FOOD_COLLECTOR_SET_UP_SHOP
end
if chars_state[i] == CHAR_STATE.FOOD_COLLECTOR_SET_UP_SHOP then
local x, y = get_new_building_location()
local bid = new_building(BUILDING_TYPES.FOOD_SHOP, x, y)
char_set_home(i, bid)
char_change_state(i, CHAR_STATE.FOOD_COLLECTOR_COLLECT_FOOD)
end
if chars_state[i] == CHAR_STATE.FOOD_COLLECTOR_STAY_IN_SHOP then
local desire = {}
desire[FOOD_COLLECTOR_DESIRE.POTION] = DESIRE_CALC[FOOD_COLLECTOR_DESIRE.POTION](i)
desire[FOOD_COLLECTOR_DESIRE.FOOD] = DESIRE_CALC[FOOD_COLLECTOR_DESIRE.FOOD](i)
desire[FOOD_COLLECTOR_DESIRE.COLLECT_FOOD] = DESIRE_CALC[FOOD_COLLECTOR_DESIRE.COLLECT_FOOD](i)
local max_desire = 0
for j = 11, 13 do
if (max_desire == 0) or (desire[max_desire] < desire[j]) then
max_desire = j
end
end
if desire[max_desire] < 1 then
char_change_state(i, CHAR_STATE.FOOD_COLLECTOR_STAY_IN_SHOP)
elseif max_desire == FOOD_COLLECTOR_DESIRE.POTION then
char_change_state(i, CHAR_STATE.FOOD_COLLECTOR_BUY_POTION)
elseif max_desire == FOOD_COLLECTOR_DESIRE.FOOD then
char_change_state(i, CHAR_STATE.FOOD_COLLECTOR_FIND_FOOD)
elseif max_desire == FOOD_COLLECTOR_DESIRE.COLLECT_FOOD then
char_change_state(i, CHAR_STATE.FOOD_COLLECTOR_COLLECT_FOOD)
else
char_change_state(i, CHAR_STATE.FOOD_COLLECTOR_STAY_IN_SHOP)
end
if chars_state[i] == CHAR_STATE.FOOD_COLLECTOR_STAY_IN_SHOP then
local res = FOOD_COLLECTOR_STAY_IN_SHOP(i)
if res == FOOD_COLLECTOR_RESPONCES.NO_FOOD_LEFT then
char_change_state(i, CHAR_STATE.FOOD_COLLECTOR_COLLECT_FOOD)
end
end
end
if chars_state[i] == CHAR_STATE.FOOD_COLLECTOR_COLLECT_FOOD then
local res = FOOD_COLLECTOR_COLLECT_FOOD(i)
if res == FOOD_COLLECTOR_RESPONCES.GOT_FOOD then
char_change_state(i, CHAR_STATE.FOOD_COLLECTOR_RETURN_FOOD)
end
elseif chars_state[i] == CHAR_STATE.FOOD_COLLECTOR_RETURN_FOOD then
local res = FOOD_COLLECTOR_RETURN_FOOD(i)
if res == FOOD_COLLECTOR_RESPONCES.AT_HOME then
char_change_state(i, CHAR_STATE.FOOD_COLLECTOR_STAY_IN_SHOP)
end
elseif chars_state[i] == CHAR_STATE.FOOD_COLLECTOR_BUY_POTION then
local res = FOOD_COLLECTOR_BUY_POTION(i)
if res == HUNTER_RESPONCES.BOUGHT_POTION then
char_change_state(i, CHAR_STATE.FOOD_COLLECTOR_STAY_IN_SHOP)
end
elseif chars_state[i] == CHAR_STATE.FOOD_COLLECTOR_FIND_FOOD then
local res = FOOD_COLLECTOR_COLLECT_FOOD(i)
if res == FOOD_COLLECTOR_RESPONCES.GOT_FOOD then
chars_hunger[i] = 0
char_change_state(i, CHAR_STATE.FOOD_COLLECTOR_STAY_IN_SHOP)
end
end
end
function FOOD_COLLECTOR_COLLECT_FOOD(i)
if chars_state_target[i] == nil then
local optimal_dist = 0
local optimal_food = nil
local x = chars_x[i]
local y = chars_y[i]
for f, pos in ipairs(food_pos) do
local p_x = pos.x * grid_size + grid_size/2
local p_y = pos.y * grid_size + grid_size/2
local dist = dist(x, y, p_x, p_y)
if ((optimal_food == nil) or (optimal_dist > dist)) and (food_cooldown[f] == 0) then
optimal_food = f
optimal_dist = dist
end
end
if optimal_food == nil then
return FOOD_COLLECTOR_RESPONCES.NO_FOOD_AROUND
end
chars_state_target[i] = optimal_food
chars_target[i].x = food_pos[optimal_food].x * grid_size + grid_size/2
chars_target[i].y = food_pos[optimal_food].y * grid_size + grid_size/2
else
local res = char_move_to_target(i)
if res == MOVEMENT_RESPONCES.TARGET_REACHED then
char_collect_food(i, chars_state_target[i])
return FOOD_COLLECTOR_RESPONCES.GOT_FOOD
end
end
end
function FOOD_COLLECTOR_RETURN_FOOD(i)
local home = chars_home[i]
if chars_state_target[i] == nil then
chars_state_target[i] = home
chars_target[i].x = buildings_x(home)
chars_target[i].y = buildings_y(home)
else
local res = char_move_to_target(i)
if res == MOVEMENT_RESPONCES.TARGET_REACHED then
char_transfer_item_building(i, home)
char_collect_money_from_building(i, home)
return FOOD_COLLECTOR_RESPONCES.AT_HOME
end
end
end
function FOOD_COLLECTOR_STAY_IN_SHOP(i)
local home = chars_home[i]
if chars_state_target[i] == nil then
chars_state_target[i] = home
chars_target[i].x = buildings_x(home)
chars_target[i].y = buildings_y(home)
else
local res = char_move_to_target(i)
if res == MOVEMENT_RESPONCES.TARGET_REACHED then
char_collect_money_from_building(i, home)
if buildings_stash[home] == 0 then
return FOOD_COLLECTOR_RESPONCES.NO_FOOD_LEFT
end
end
end
end
function FOOD_COLLECTOR_BUY_POTION(i)
if chars_state_target[i] == nil then
local closest = find_closest_potion_shop(i)
if closest ~= nil then
chars_state_target[i] = closest
chars_target[i].x = buildings_x(closest)
chars_target[i].y = buildings_y(closest)
end
elseif dist(chars_target[i].x, chars_target[i].y, chars_x[i], chars_y[i]) < 0.5 then
char_buy_potions(i, chars_state_target[i])
return HUNTER_RESPONCES.BOUGHT_POTION
else
char_move_to_target(i)
return HUNTER_RESPONCES.ON_MY_WAY
end
end
-- HERBALIST
---- herbalist
---- collects plants around,
---- brews potions out of them for sell (ensuring that he always have enough for himself)
---- potions can expire, so his goods are always needed
---- buys herbs from other heroes
---- income: selling potions
---- expenses: buying plants, buying food, taxes
end |
-- This file is under copyright, and is bound to the agreement stated in the EULA.
-- Any 3rd party content has been used as either public domain or with permission.
-- © Copyright 2016-2017 Aritz Beobide-Cardinal All rights reserved.
--ENUMS FOR ARC BANKING SYSTEM!
--137164355
ARCPhone = ARCPhone or {}
function ARCPhone.Msg(msg)
Msg("ARCPhone: "..tostring(msg).."\n")
if !ARCPhone then return end
if ARCPhone.LogFileWritten then
file.Append(ARCPhone.LogFile, os.date("%Y-%m-%d %H:%M:%S").." > "..tostring(msg).."\r\n")
end
end
ARCPhone.Msg("Running...\n ____ ____ _ ___ ___ ____ ____ ____ ____ _ _ ____ ____ ___ _ _ ____ _ _ ____ \n |__| |__/ | | / | |__/ |__| | |_/ |___ |__/ |__] |__| | | |\\ | |___ \n | | | \\ | | /__ |___ | \\ | | |___ | \\_ |___ | \\ | | | |__| | \\| |___ \n")
ARCPhone.Msg(table.Random({"HOLY SHIT HE'S FINALLY WORKING ON IT??","RIIING RIIIING!!!","ARitz Cracker's NEXT BIG PROJECT!","fone","Call your friends!","Super fukin' Sexy edition!","3rd party app support!"}))
ARCPhone.Msg("© Copyright 2016-2017 Aritz Beobide-Cardinal (ARitz Cracker) All rights reserved.")
ARCPhone.Update = "June 5th 2018"
ARCPhone.Version = "0.9.2f"
NULLFUNC = function(...) end
-- STATUSES
ARCPHONE_ERROR_RINGING = -4
ARCPHONE_ERROR_CALL_ENDED = -3
ARCPHONE_ERROR_ABORTED = -2
ARCPHONE_ERROR_DIALING = -1
ARCPHONE_ERROR_NONE = 0
ARCPHONE_NO_ERROR = 0
ARCPHONE_ERROR_CALL_RUNNING = 0
-- CALLING ERRORS
ARCPHONE_ERROR_UNREACHABLE = 1
ARCPHONE_ERROR_INVALID_CODE = 2
ARCPHONE_ERROR_TOO_MANY_CALLS = 3
ARCPHONE_ERROR_NUMBER_BLOCKED = 4
ARCPHONE_ERROR_BLOCKED_NUMBER = 4
ARCPHONE_ERROR_PLAYER_OFFLINE = 5
ARCPHONE_ERROR_BUSY = 6
ARCPHONE_ERROR_NIL_NUMBER = 7
-- DIALING ERRORS
ARCPHONE_ERROR_NO_RECEPTION = 16
ARCPHONE_ERROR_CALL_DROPPED = 17
ARCPHONE_ERROR_INVALID_PLAN = 18
--OTHER ERRORS
ARCPHONE_ERROR_NOT_LOADED = -127
ARCPHONE_ERROR_UNKNOWN = -128
ARCPHONE_ERRORBITRATE = 8
--Message box types
ARCPHONE_MSGBOX_OK = 1
ARCPHONE_MSGBOX_YESNO = 2
ARCPHONE_MSGBOX_OKCANCEL = 3
ARCPHONE_MSGBOX_RETRYABORT = 4
ARCPHONE_MSGBOX_REPLY = 5
ARCPHONE_MSGBOX_YESNOCANCEL = 6
ARCPHONE_MSGBOX_ABORTRETRYIGNORE = 7
ARCPHONE_MSGBOX_CALL = 8
ARCPhone.Msg("Version: "..ARCPhone.Version)
ARCPhone.Msg("Updated on: "..ARCPhone.Update)
if SERVER then
resource.AddWorkshop( "404863548" )
function ARCPhone.MsgCL(ply,msg)
--net.Start( "ARCPhone_Msg" )
--net.WriteString( msg )
if !ply || !ply:IsPlayer() then
ARCPhone.Msg(tostring(msg))
else
ply:PrintMessage( HUD_PRINTTALK, "ARCPhone: "..tostring(msg))
--net.Send(ply)
end
end
end
return "ARCPhone","ARCPhone",{"arclib"}
|
-- wifi_ap
local wifiAp = {}
local wifi_ap_cfg ={}
wifi_ap_cfg.ssid = "IoT_Button"
wifi_ap_cfg.pwd = "iotbutton"
function wifiAp.Start(callback)
print("wifi ap start"..wifi_ap_cfg)
wifi.setmode(wifi.SOFTAP)
tmr.alarm(0, 1000, 0, function()
wifi.ap.config(wifi_ap_cfg)
end)
end
return wifiAp
|
-- Copyright (C) 2018 David Capello
--
-- This file is released under the terms of the MIT license.
-- Read LICENSE.txt for more information.
assert(ColorMode.RGB == 0)
assert(ColorMode.GRAYSCALE == 1)
assert(ColorMode.INDEXED == 2)
|
DS = {}
DS.Config = {}
-- Be sure to restart the server changing any of these
-- Is the addon enabled?
DS.Enabled = true
-- Override Gamemodes? (Recommended = true!)
-- Known Gamemodes with compatability issues are:
-- Trouble in terrorist town
-- Zombie Survival
-- Flood
DS.OverrideGamemodes = true
-- Disables the addon on any of the maps listed in the table
-- If you don't want to disable any maps, just leave it blank.
-- An example of the table --> DS.Config.DisableOnMaps = {"gm_construct", "gm_flatgrass"}
DS.DisableOnMaps = {""}
----------------------------------------------------------
-- Drowning Settings --
----------------------------------------------------------
-- Is the drowning system on?
DS.Config.DrowningSystem = true
-- How long can a player be submerged before drowning (in seconds)
DS.Config.TimeBeforeDrowning = 7
-- Damage by percent of player health?
DS.Config.DrownByPercent = true
-- Percent of damage to deal to the player's health
-- Only works if "DrownByPercent" is true
DS.Config.DrownByPercentDamage = 6
-- How much damage will the player take per second.
-- Only works if "DrownByPercent" is false
DS.Config.DrowningDamage = 20
----------------------------------------------------------
-- VIP System Settings --
----------------------------------------------------------
-- Enabled the extra air VIP system?
DS.Config.EnableVIPSystem = true
-- How many seconds extra does the VIP Get?
-- Overwrites the TimeBeforeDrowning config for VIPs only
DS.Config.VIPTimeBeforeDrowning = 10.3
-- Do we ever want the value of the stat to never go over 100%?
DS.Config.CapAt100 = true
-- Input the groups that are vip or donators that will
-- recieve the extra air under water.
DS.Config.VIPGroups = { "owner", "furfag", "superadmin", "admin", "lightdonator", "donator", "superdonator", "defiance", "serenity", "lostsouls", "communitydeveloper" }
----------------------------------------------------------
-- Water Damage System Settings --
----------------------------------------------------------
-- Does water hurt every damage cycle a player is in it?
DS.Config.WaterHurts = false
-- How fast should the player take damage (in seconds)
DS.Config.WaterDamageCycle = 0.5
-- Damage done every cycle of the timer
DS.Config.WaterDamage = 1
----------------------------------------------------------
-- Client Side Settings --
----------------------------------------------------------
-- Draw the Hud?
DS.Config.DrawDrowningHud = true
-- Use sound effects?
DS.Config.SoundEffects = true
-- Name of the oxygen or "air" stat
DS.Config.StatName = "Oxygen"
-- The font style you would like to use for the text of the stat
DS.Config.StatFont = "TargetID" |
local lines = 10 -- number of scores to display
local frameWidth = capWideScale(160, 260)
local framex = SCREEN_WIDTH-frameWidth-WideScale(get43size(40),40)/2
local framey = 110
local spacing = 34
local steps = GAMESTATE:GetCurrentSteps()
--Input event for mouse clicks
local function input(event)
local scoreBoard = SCREENMAN:GetTopScreen():GetChildren().scoreBoard
if event.DeviceInput.button == "DeviceButton_left mouse button" and scoreBoard then
if event.type == "InputEventType_Release" then
for i = 1, #multiscores do
if isOver(scoreBoard:GetChildren()[tostring(i)]:GetChild("mouseOver")) then
--SCREENMAN:GetTopScreen():SetCurrentPlayer(i)
scoreBoard:GetChild(i):GetChild("grade"):visible(not scoreBoard:GetChild(i):GetChild("grade"):GetVisible())
scoreBoard:GetChild(i):GetChild("clear"):visible(not scoreBoard:GetChild(i):GetChild("clear"):GetVisible())
scoreBoard:GetChild(i):GetChild("wife"):visible(not scoreBoard:GetChild(i):GetChild("wife"):GetVisible())
scoreBoard:GetChild(i):GetChild("combo"):visible(not scoreBoard:GetChild(i):GetChild("combo"):GetVisible())
scoreBoard:GetChild(i):GetChild("judge"):visible(not scoreBoard:GetChild(i):GetChild("judge"):GetVisible())
scoreBoard:GetChild(i):GetChild("option"):visible(not scoreBoard:GetChild(i):GetChild("option"):GetVisible())
end
end
end
end
return false
end
local function Update(self)
for i = 1, lines do
if isOver(self:GetChild(i):GetChild("mouseOver")) then
self:GetChild(i):GetChild("mouseOver"):diffusealpha(0.2)
else
self:GetChild(i):GetChild("mouseOver"):diffusealpha(0)
self:GetChild(i):GetChild("grade"):visible(true)
self:GetChild(i):GetChild("wife"):visible(true)
self:GetChild(i):GetChild("combo"):visible(true)
self:GetChild(i):GetChild("judge"):visible(true)
self:GetChild(i):GetChild("clear"):visible(true)
self:GetChild(i):GetChild("option"):visible(false)
end
end
end
local sortFunction = function(first, second)
return first["highscore"]:GetWifeScore() > second["highscore"]:GetWifeScore()
end
local t =
Def.ActorFrame {
Name = "scoreBoard",
InitCommand = function(self)
self:SetUpdateFunction(Update)
end,
BeginCommand = function(self)
SCREENMAN:GetTopScreen():AddInputCallback(input)
multiscores = NSMAN:GetEvalScores()
table.sort(multiscores, sortFunction)
for i = 1, math.min(#multiscores) do
self:GetChild(i):queuecommand("UpdateNetScore")
end
end,
NewMultiScoreMessageCommand = function(self)
multiscores = NSMAN:GetEvalScores()
table.sort(multiscores, sortFunction)
for i = 1, math.min(#multiscores) do
self:GetChild(i):queuecommand("UpdateNetScore")
end
end
}
local function scoreitem(pn, i)
local t =
Def.ActorFrame {
Name = tostring(i),
InitCommand = function(self)
self:visible(false)
end,
UpdateNetScoreCommand = function(self)
self:visible(i <= #multiscores)
end,
--The main quad
Def.Quad {
InitCommand = function(self)
self:xy(framex, framey + ((i - 1) * spacing) - 4):zoomto(frameWidth, 30):halign(0):valign(0):diffuse(getMainColor("frame")):diffusealpha(0.8)
end
},
--Highlight quad for the current score
Def.Quad {
InitCommand = function(self)
self:xy(framex, framey + ((i - 1) * spacing) - 4):zoomto(frameWidth, 30):halign(0):valign(0):diffuse(getMainColor("highlight")):diffusealpha(0.3)
end,
UpdateNetScoreCommand = function(self)
self:visible(SCREENMAN:GetTopScreen():GetCurrentPlayer() == i)
end,
UpdateNetEvalStatsMessageCommand = function(self)
self:visible(SCREENMAN:GetTopScreen():GetCurrentPlayer() == i)
end
},
--Quad that will act as the bounding box for mouse rollover/click stuff.
Def.Quad {
Name = "mouseOver",
UpdateNetScoreCommand = function(self)
self:xy(framex, framey + ((i - 1) * spacing) - 4):zoomto(frameWidth * 2, 30):halign(0):valign(0):diffuse(
getMainColor("highlight")
):diffusealpha(0.05)
end
},
--ClearType lamps
Def.Quad {
UpdateNetScoreCommand = function(self)
self:xy(framex, framey + ((i - 1) * spacing) - 4):zoomto(8, 30):halign(0):valign(0):diffuse(
getClearTypeColor(getClearType(PLAYER_1, steps, multiscores[i].highscore))
)
end
},
--rank
LoadFont("Common normal") ..
{
InitCommand = function(self)
self:xy(framex - 8, framey + 12 + ((i - 1) * spacing)):zoom(0.35)
end,
UpdateNetScoreCommand = function(self)
self:settext(i)
if SCREENMAN:GetTopScreen():GetCurrentPlayer() == i then
self:diffuseshift()
self:effectcolor1(color(colorConfig:get_data().evaluation.BackgroundText))
self:effectcolor2(color("#3399cc"))
self:effectperiod(0.1)
else
self:stopeffect()
self:diffuse(color(colorConfig:get_data().evaluation.BackgroundText))
end
end,
UpdateNetEvalStatsMessageCommand = function(self)
self:playcommand("UpdateNetScore")
end
},
LoadFont("Common normal") ..
{
Name = "wife",
InitCommand = function(self)
self:xy(framex + 10, framey + 11 + ((i - 1) * spacing)):zoom(0.35):halign(0):maxwidth((frameWidth - 15) / 0.3)
end,
UpdateNetScoreCommand = function(self)
self:settextf(
"%05.2f%% (%s) - %sx",
notShit.floor(multiscores[i].highscore:GetWifeScore() * 10000) / 100,
"Wife",
string.format("%.2f", multiscores[i].highscore:GetMusicRate()):gsub("%.?0+$", "")
)
end
},
LoadFont("Common normal") ..
{
Name = "user",
InitCommand = function(self)
self:xy(framex + 10, framey + 1 + ((i - 1) * spacing)):zoom(0.35):halign(0):maxwidth((frameWidth - 15) / 0.3)
end,
UpdateNetScoreCommand = function(self)
self:settextf(multiscores[i].user)
if Grade:Reverse()[GetGradeFromPercent(multiscores[i].highscore:GetWifeScore())] < 2 then -- this seeems right -mina
self:rainbowscroll(true)
end
end
},
LoadFont("Common normal") ..
{
Name = "option",
InitCommand = function(self)
self:xy(framex + 10, framey + 11 + ((i - 1) * spacing)):zoom(0.35):halign(0):maxwidth((frameWidth - 15) / 0.35)
end,
UpdateNetScoreCommand = function(self)
self:settext(multiscores[i].highscore:GetModifiers())
self:visible(false)
end
},
LoadFont("Common normal") ..
{
Name = "grade",
InitCommand = function(self)
self:xy(framex + 130 + capWideScale(get43size(0), 50), framey + 2 + ((i - 1) * spacing)):zoom(0.35):halign(0.5):maxwidth(
(frameWidth - 15) / 0.35
)
end,
UpdateNetScoreCommand = function(self)
self:settext(getGradeStrings(multiscores[i].highscore:GetWifeGrade()))
self:diffuse(getGradeColor(multiscores[i].highscore:GetWifeGrade()))
end
},
LoadFont("Common normal") ..
{
Name = "clear",
InitCommand = function(self)
self:xy(framex + 130 + capWideScale(get43size(0), 50), framey + 12 + ((i - 1) * spacing)):zoom(0.35):halign(0.5):maxwidth(
(frameWidth - 15) / 0.35
)
end,
UpdateNetScoreCommand = function(self)
self:settext(getClearTypeText(getClearType(PLAYER_1, steps, multiscores[i].highscore)))
self:diffuse(getClearTypeColor(getClearType(PLAYER_1, steps, multiscores[i].highscore)))
end
},
LoadFont("Common normal") ..
{
Name = "combo",
InitCommand = function(self)
self:xy(framex + 130 + capWideScale(get43size(0), 50), framey + 21 + ((i - 1) * spacing)):zoom(0.35):halign(0.5):maxwidth(
(frameWidth - 15) / 0.35
)
end,
UpdateNetScoreCommand = function(self)
self:settextf("%sx", multiscores[i].highscore:GetMaxCombo())
end
},
LoadFont("Common normal") ..
{
Name = "judge",
InitCommand = function(self)
self:xy(framex + 10, framey + 20 + ((i - 1) * spacing)):zoom(0.35):halign(0):maxwidth((frameWidth - 15) / 0.35)
end,
UpdateNetScoreCommand = function(self)
self:settextf(
"%d / %d / %d / %d / %d / %d",
multiscores[i].highscore:GetTapNoteScore("TapNoteScore_W1"),
multiscores[i].highscore:GetTapNoteScore("TapNoteScore_W2"),
multiscores[i].highscore:GetTapNoteScore("TapNoteScore_W3"),
multiscores[i].highscore:GetTapNoteScore("TapNoteScore_W4"),
multiscores[i].highscore:GetTapNoteScore("TapNoteScore_W5"),
multiscores[i].highscore:GetTapNoteScore("TapNoteScore_Miss")
)
end
}
}
return t
end
for i = 1, lines do
t[#t + 1] = scoreitem(1, i)
end
return t
|
--アマゾネス女帝王
--
--Script by Trishula9
function c100427034.initial_effect(c)
--fusion material
c:EnableReviveLimit()
aux.AddFusionProcFun2(c,c100427034.matfilter,aux.FilterBoolFunction(Card.IsFusionSetCard,0x4),true)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCountLimit(1,100427034)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCondition(c100427034.spcon)
e1:SetTarget(c100427034.sptg)
e1:SetOperation(c100427034.spop)
c:RegisterEffect(e1)
--indes
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e2:SetRange(LOCATION_MZONE)
e2:SetTargetRange(LOCATION_ONFIELD,0)
e2:SetTarget(c100427034.indtg)
e2:SetValue(aux.indoval)
c:RegisterEffect(e2)
--cannot be target
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e3:SetRange(LOCATION_MZONE)
e3:SetTargetRange(LOCATION_ONFIELD,0)
e3:SetTarget(c100427034.indtg)
e3:SetValue(aux.tgoval)
c:RegisterEffect(e3)
--multi attack
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e4:SetCode(EVENT_SPSUMMON_SUCCESS)
e4:SetCondition(c100427034.condition)
e4:SetOperation(c100427034.operation)
c:RegisterEffect(e4)
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetCode(EFFECT_MATERIAL_CHECK)
e5:SetValue(c100427034.valcheck)
e5:SetLabelObject(e4)
c:RegisterEffect(e5)
end
function c100427034.matfilter(c)
return c:IsFusionType(TYPE_FUSION) and c:IsFusionSetCard(0x4)
end
function c100427034.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION)
end
function c100427034.spfilter(c,e,tp)
return c:IsSetCard(0x4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c100427034.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c100427034.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c100427034.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c100427034.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
function c100427034.indtg(e,c)
return c:IsSetCard(0x4) and c~=e:GetHandler()
end
function c100427034.valcheck(e,c)
e:GetLabelObject():SetLabel(c:GetMaterial():FilterCount(Card.IsCode,nil,4591250,15951532))
end
function c100427034.condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION)
end
function c100427034.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct=e:GetLabel()
if ct>=1 then
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(100427034,1))
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EXTRA_ATTACK)
e1:SetProperty(EFFECT_FLAG_CLIENT_HINT)
e1:SetValue(1)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e1)
end
end
|
local state = {}
local util = require "util"
function state.new()
return setmetatable({}, {__index = state})
end
function state:contains(other)
for k,v in pairs(other) do
if type(v) == "boolean" then
if not self[k] == v then
return false
end
elseif type(v) == "number" then
if math.abs(v - (self[k] or 0)) > 10e-5 then
return false
end
else
if not ((self[k] or 0) <= v) then
return false
end
end
end
return true
end
function state:eq(other)
return self:contains(other) and other:contains(self)
end
function state:apply(changes)
local next = self:copy()
for k,v in pairs(changes) do
next[k] = v
end
return next
end
function state:copy()
return setmetatable(util.deep_copy(self), {__index = state})
end
return state
|
---------------------------------------------------------------------------
-- do as much setup work as possible in another file to keep default.lua
-- from becoming overly cluttered
local setup = LoadActor("./Setup.lua")
if setup == nil then
return LoadActor(THEME:GetPathB("ScreenSelectMusicCasual", "overlay/NoValidSongs.lua"))
end
local steps_type = setup.steps_type
local Groups = setup.Groups
local group_index = setup.group_index
local group_info = setup.group_info
local OptionRows = setup.OptionRows
local OptionsWheel = setup.OptionsWheel
local GroupWheel = setmetatable({}, sick_wheel_mt)
local SongWheel = setmetatable({}, sick_wheel_mt)
local row = setup.row
local col = setup.col
local TransitionTime = 0.5
local songwheel_y_offset = -13
---------------------------------------------------------------------------
-- a table of params from this file that we pass into the InputHandler file
-- so that the code there can work with them easily
local params_for_input = { GroupWheel=GroupWheel, SongWheel=SongWheel, OptionsWheel=OptionsWheel, OptionRows=OptionRows }
---------------------------------------------------------------------------
-- load the InputHandler and pass it the table of params
local Input = LoadActor( "./Input.lua", params_for_input )
-- metatables
local group_mt = LoadActor("./GroupMT.lua", {GroupWheel,SongWheel,TransitionTime,steps_type,row,col,Input})
local song_mt = LoadActor("./SongMT.lua", {SongWheel,TransitionTime,row,col})
local optionrow_mt = LoadActor("./OptionRowMT.lua")
local optionrow_item_mt = LoadActor("./OptionRowItemMT.lua")
---------------------------------------------------------------------------
local t = Def.ActorFrame {
InitCommand=function(self)
GroupWheel:set_info_set(Groups, group_index)
self:GetChild("GroupWheel"):SetDrawByZPosition(true)
self:queuecommand("Capture")
end,
OnCommand=function(self)
if PREFSMAN:GetPreference("MenuTimer") then self:queuecommand("Listen") end
end,
ListenCommand=function(self)
local topscreen = SCREENMAN:GetTopScreen()
local seconds = topscreen:GetChild("Timer"):GetSeconds()
-- if necessary, force the players into Gameplay because the MenuTimer has run out
if not Input.AllPlayersAreAtLastRow() and seconds <= 0 then
-- if we we're not currently in the optionrows,
-- we'll need to iniitialize them for the current song, first
if Input.WheelWithFocus ~= OptionsWheel then
setup.InitOptionRowsForSingleSong()
end
for player in ivalues(GAMESTATE:GetHumanPlayers()) do
for index=1, #OptionRows-1 do
local choice = OptionsWheel[player][index]:get_info_at_focus_pos()
local choices= OptionRows[index].choices
local values = OptionRows[index].values
OptionRows[index]:OnSave(player, choice, choices, values)
end
end
topscreen:StartTransitioningScreen("SM_GoToNextScreen")
else
self:sleep(0.5):queuecommand("Listen")
end
end,
CaptureCommand=function(self)
-- One element of the Input table is an internal function, Handler
SCREENMAN:GetTopScreen():AddInputCallback( Input.Handler )
-- set up initial variable states and the players' OptionRows
Input:Init()
-- It should be safe to enable input for players now
self:queuecommand("EnableInput")
end,
CodeMessageCommand=function(self, params)
-- I'm using Metrics-based code detection because the engine is already good at handling
-- simultaneous button presses (CancelSingleSong when ThreeKeyNavigation=1),
-- as well as long input patterns (Exit from EventMode) and I see no need to
-- reinvent that funtionality for the Lua InputCallback that I'm using otherwise.
if params.Name == "Exit" then
if PREFSMAN:GetPreference("EventMode") then
SCREENMAN:GetTopScreen():SetNextScreenName( Branch.SSMCancel() ):StartTransitioningScreen("SM_GoToNextScreen")
else
if SL.Global.Stages.PlayedThisGame == 0 then
SL.Global.GameMode = "Competitive"
SetGameModePreferences()
THEME:ReloadMetrics()
SCREENMAN:GetTopScreen():SetNextScreenName("ScreenReloadSSM"):StartTransitioningScreen("SM_GoToNextScreen")
end
end
end
if params.Name == "CancelSingleSong" then
-- if focus is not on OptionsWheel, we don't want to do anything
if Input.WheelWithFocus ~= OptionsWheel then return end
-- otherwise, run the function to cancel this single song choice
Input.CancelSongChoice()
end
end,
-- a hackish solution to prevent users from button-spamming and breaking input :O
SwitchFocusToSongsMessageCommand=function(self)
self:sleep(TransitionTime):queuecommand("EnableInput")
end,
SwitchFocusToGroupsMessageCommand=function(self)
self:sleep(TransitionTime):queuecommand("EnableInput")
end,
SwitchFocusToSingleSongMessageCommand=function(self)
setup.InitOptionRowsForSingleSong()
self:sleep(TransitionTime):queuecommand("EnableInput")
end,
EnableInputCommand=function(self)
Input.Enabled = true
end,
LoadActor("./PlayerOptionsShared.lua", {row, col, Input}),
LoadActor("./SongWheelShared.lua", {row, col, songwheel_y_offset}),
-- commented out for now
-- LoadActor("./GroupWheelShared.lua", {row, col, group_info}),
SongWheel:create_actors( "SongWheel", 12, song_mt, 0, songwheel_y_offset),
LoadActor("./Header.lua", row),
GroupWheel:create_actors( "GroupWheel", row.how_many * col.how_many, group_mt, 0, 0, true),
LoadActor("FooterHelpText.lua"),
}
-- Add player options ActorFrames to our primary ActorFrame
for pn in ivalues( {PLAYER_1, PLAYER_2} ) do
local x_offset = (pn==PLAYER_1 and -1) or 1
-- create an optionswheel that has enough items to handle the number of optionrows necessary
t[#t+1] = OptionsWheel[pn]:create_actors("OptionsWheel"..ToEnumShortString(pn), #OptionRows, optionrow_mt, _screen.cx - 100 + 140 * x_offset, _screen.cy - 30)
for i=1,#OptionRows do
-- Create sub-wheels for each optionrow with 3 items each.
-- Regardless of how many items are actually in that row,
-- we only display 1 at a time.
t[#t+1] = OptionsWheel[pn][i]:create_actors(ToEnumShortString(pn).."OptionWheel"..i, 3, optionrow_item_mt, WideScale(30, 130) + 140 * x_offset, _screen.cy - 5 + i * 62)
end
end
-- FIXME: This is dumb. Add the player option StartButton visual last so it
-- draws over everything else and we can hide cusors behind it when needed...
t[#t+1] = LoadActor("./StartButton.lua")
return t |
local galactic_hq_0 = DoorSlot("galactic_hq","0")
local galactic_hq_0_hub = DoorSlotHub("galactic_hq","0",galactic_hq_0)
galactic_hq_0:setHubIcon(galactic_hq_0_hub)
local galactic_hq_1 = DoorSlot("galactic_hq","1")
local galactic_hq_1_hub = DoorSlotHub("galactic_hq","1",galactic_hq_1)
galactic_hq_1:setHubIcon(galactic_hq_1_hub)
local galactic_hq_2 = DoorSlot("galactic_hq","2")
local galactic_hq_2_hub = DoorSlotHub("galactic_hq","2",galactic_hq_2)
galactic_hq_2:setHubIcon(galactic_hq_2_hub)
local galactic_hq_3 = DoorSlot("galactic_hq","3")
local galactic_hq_3_hub = DoorSlotHub("galactic_hq","3",galactic_hq_3)
galactic_hq_3:setHubIcon(galactic_hq_3_hub)
local galactic_hq_4 = DoorSlot("galactic_hq","4")
local galactic_hq_4_hub = DoorSlotHub("galactic_hq","4",galactic_hq_4)
galactic_hq_4:setHubIcon(galactic_hq_4_hub)
local galactic_hq_5 = DoorSlot("galactic_hq","5")
local galactic_hq_5_hub = DoorSlotHub("galactic_hq","5",galactic_hq_5)
galactic_hq_5:setHubIcon(galactic_hq_5_hub)
local galactic_hq_6 = DoorSlot("galactic_hq","6")
local galactic_hq_6_hub = DoorSlotHub("galactic_hq","6",galactic_hq_6)
galactic_hq_6:setHubIcon(galactic_hq_6_hub)
local galactic_hq_7 = DoorSlot("galactic_hq","7")
local galactic_hq_7_hub = DoorSlotHub("galactic_hq","7",galactic_hq_7)
galactic_hq_7:setHubIcon(galactic_hq_7_hub)
local galactic_hq_8 = DoorSlot("galactic_hq","8")
local galactic_hq_8_hub = DoorSlotHub("galactic_hq","8",galactic_hq_8)
galactic_hq_8:setHubIcon(galactic_hq_8_hub)
local galactic_hq_9 = DoorSlot("galactic_hq","9")
local galactic_hq_9_hub = DoorSlotHub("galactic_hq","9",galactic_hq_9)
galactic_hq_9:setHubIcon(galactic_hq_9_hub)
local galactic_hq_10 = DoorSlot("galactic_hq","10")
local galactic_hq_10_hub = DoorSlotHub("galactic_hq","10",galactic_hq_10)
galactic_hq_10:setHubIcon(galactic_hq_10_hub)
local galactic_hq_11 = DoorSlot("galactic_hq","11")
local galactic_hq_11_hub = DoorSlotHub("galactic_hq","11",galactic_hq_11)
galactic_hq_11:setHubIcon(galactic_hq_11_hub)
local galactic_hq_12 = DoorSlot("galactic_hq","12")
local galactic_hq_12_hub = DoorSlotHub("galactic_hq","12",galactic_hq_12)
galactic_hq_12:setHubIcon(galactic_hq_12_hub)
local galactic_hq_13 = DoorSlot("galactic_hq","13")
local galactic_hq_13_hub = DoorSlotHub("galactic_hq","13",galactic_hq_13)
galactic_hq_13:setHubIcon(galactic_hq_13_hub)
local galactic_hq_14 = DoorSlot("galactic_hq","14")
local galactic_hq_14_hub = DoorSlotHub("galactic_hq","14",galactic_hq_14)
galactic_hq_14:setHubIcon(galactic_hq_14_hub)
local galactic_hq_15 = DoorSlot("galactic_hq","15")
local galactic_hq_15_hub = DoorSlotHub("galactic_hq","15",galactic_hq_15)
galactic_hq_15:setHubIcon(galactic_hq_15_hub)
local galactic_hq_16 = DoorSlot("galactic_hq","16")
local galactic_hq_16_hub = DoorSlotHub("galactic_hq","16",galactic_hq_16)
galactic_hq_16:setHubIcon(galactic_hq_16_hub)
local galactic_hq_17 = DoorSlot("galactic_hq","17")
local galactic_hq_17_hub = DoorSlotHub("galactic_hq","17",galactic_hq_17)
galactic_hq_17:setHubIcon(galactic_hq_17_hub)
local galactic_hq_18 = DoorSlot("galactic_hq","18")
local galactic_hq_18_hub = DoorSlotHub("galactic_hq","18",galactic_hq_18)
galactic_hq_18:setHubIcon(galactic_hq_18_hub)
local galactic_hq_19 = DoorSlot("galactic_hq","19")
local galactic_hq_19_hub = DoorSlotHub("galactic_hq","19",galactic_hq_19)
galactic_hq_19:setHubIcon(galactic_hq_19_hub)
local galactic_hq_20 = DoorSlot("galactic_hq","20")
local galactic_hq_20_hub = DoorSlotHub("galactic_hq","20",galactic_hq_20)
galactic_hq_20:setHubIcon(galactic_hq_20_hub)
local galactic_hq_21 = DoorSlot("galactic_hq","21")
local galactic_hq_21_hub = DoorSlotHub("galactic_hq","21",galactic_hq_21)
galactic_hq_21:setHubIcon(galactic_hq_21_hub)
local galactic_hq_22 = DoorSlot("galactic_hq","22")
local galactic_hq_22_hub = DoorSlotHub("galactic_hq","22",galactic_hq_22)
galactic_hq_22:setHubIcon(galactic_hq_22_hub)
local galactic_hq_23 = DoorSlot("galactic_hq","23")
local galactic_hq_23_hub = DoorSlotHub("galactic_hq","23",galactic_hq_23)
galactic_hq_23:setHubIcon(galactic_hq_23_hub)
|
--- A scroll box.
-- @module[kind=component] scrollbox
local args = { ... }
local path = fs.combine(args[2], "../../")
local scrollbox = {}
local marquee = require("/" .. fs.combine(path, "components", "marquee"))
local scrollboxes = {}
--- Create a new scroll box.
-- @tparam number id The ID of the scrollbox.
-- @tparam number x The X position of the scrollbox.
-- @tparam number y The Y position of the scrollbox.
-- @tparam number w The width of the scrollbox.
-- @tparam number h The height of the scrollbox.
-- @tparam table parent The parent terminal of the scrollbox.
-- @return A terminal-like instance, with a couple more functions.
function scrollbox.create(id, x, y, w, h, parent)
local newScrollbox = marquee.create(x, y, w, h, parent)
scrollboxes[id] = {
scrollbox = newScrollbox,
x = x,
y = y,
w = w,
h = h
}
return newScrollbox
end
--- Removes a scrollbox's event listener. Notice this does not clear it, you will have to clear the screen to remove it.
-- @tparam number id The ID of the scroll box.
function scrollbox.remove(id)
scrollboxes[id] = nil
end
--- Initalizes the event manager for the scrollbox.
-- @tparam table manager The event manager.
function scrollbox.init(manager)
manager.inject(function(e)
if e[1] == "mouse_scroll" then
local d, x, y = e[2], e[3], e[4]
for i, v in pairs(scrollboxes) do
if x >= v.x and x <= v.x + v.w - 1 and y >= v.y and y <= v.y + v.h - 1 then
local sX, sY = v.scrollbox.getScroll()
local ssX, ssY = v.scrollbox.getSize()
local canscroll = false
if d == 1 then -- down
canscroll = sY < ssY - 2
elseif d == -1 then -- up
canscroll = sY >= 0
end
if canscroll == true then v.scrollbox.scroll(d) end
end
end
end
end)
end
return scrollbox |
Auctionator.Selling.Events.RefreshHistory = "selling_refresh_history"
Auctionator.Selling.Events.SellSearchStart = "sell_search_start"
Auctionator.Selling.Events.PriceSelected = "price_selected"
Auctionator.Selling.Events.RefreshSearch = "selling_refresh_search"
Auctionator.Selling.Events.ConfirmCallback = "selling_confirm_commodity_callback"
|
----------------------------------------
-- Group Calendar 5 Copyright (c) 2018 John Stephen
-- This software is licensed under the MIT license.
-- See the included LICENSE.txt file for more information.
----------------------------------------
if GetLocale() == "ruRU" then
GroupCalendar.cTitle = "Организатор %s"
GroupCalendar.cCantReloadUI = "Вам необходимо перезапустить WoW для обновления Group Calendar"
GroupCalendar.cHelpHeader = "Group Calendar Commands"
GroupCalendar.cHelpHelp = "Shows this list of commands"
GroupCalendar.cHelpReset = "Resets all saved data and settings"
GroupCalendar.cHelpDebug = "Enables or disables the debug code"
GroupCalendar.cHelpClock = "Sets the minimap clock to display local time or server time"
GroupCalendar.cHelpiCal = "Generates iCal data (default is 'all')"
GroupCalendar.cHelpReminder = "Turns reminders on or off"
GroupCalendar.cHelpBirth = "Turns birthday announcements on or off"
GroupCalendar.cHelpAttend = "Turns attendance reminders on or off"
GroupCalendar.cHelpShow = "Shows the calendar window"
GroupCalendar.cTooltipScheduleItemFormat = "%s (%s)"
GroupCalendar.cForeignRealmFormat = "%s из %s"
GroupCalendar.cSingleItemFormat = "%s"
GroupCalendar.cTwoItemFormat = "%s и %s"
GroupCalendar.cMultiItemFormat = "%s{{, %s}} и %s"
-- Event names
GroupCalendar.cGeneralEventGroup = "Общий"
GroupCalendar.cPersonalEventGroup = "Личные (не общий)"
GroupCalendar.cRaidClassicEventGroup = "Рейды (Азерот)"
GroupCalendar.cTBCRaidEventGroup = "Рейды (Запределье)"
GroupCalendar.cWotLKRaidEventGroup = "Рейды (WotLK)"
GroupCalendar.cDungeonEventGroup = "Инстансы (Азерот)"
GroupCalendar.cOutlandsDungeonEventGroup = "Инстансы (Запределье)"
GroupCalendar.cWotLKDungeonEventGroup = "Инстансы (WotLK)"
GroupCalendar.cOutlandsHeroicDungeonEventGroup = "Героики (Запределье)"
GroupCalendar.cWotLKHeroicDungeonEventGroup = "Героики (WotLK)"
GroupCalendar.cBattlegroundEventGroup = "ПвП"
GroupCalendar.cOutdoorRaidEventGroup = "Внешние Рейды"
GroupCalendar.cMeetingEventName = "Собрание"
GroupCalendar.cBirthdayEventName = "День рождения"
GroupCalendar.cRoleplayEventName = "Ролевая игра"
GroupCalendar.cHolidayEventName = "Развлечения"
GroupCalendar.cDentistEventName = "Дантист"
GroupCalendar.cDoctorEventName = "Доктор"
GroupCalendar.cVacationEventName = "Дуэли, тренинг ПвП"
GroupCalendar.cOtherEventName = "Другое"
GroupCalendar.cCooldownEventName = "%s Доступна"
GroupCalendar.cPersonalEventOwner = "Личный"
GroupCalendar.cBlizzardOwner = "Blizzard"
GroupCalendar.cNone = "None"
GroupCalendar.cAvailableMinutesFormat = "%s через %d минуты"
GroupCalendar.cAvailableMinuteFormat = "%s через %d минут"
GroupCalendar.cStartsMinutesFormat = "%s старт через %d минут"
GroupCalendar.cStartsMinuteFormat = "%s старт через %d минуты"
GroupCalendar.cStartingNowFormat = "%s уже начинается"
GroupCalendar.cAlreadyStartedFormat = "%s уже начался"
GroupCalendar.cHappyBirthdayFormat = "С днем рождения %s!"
GroupCalendar.cLocalTimeNote = "(%s local)"
GroupCalendar.cServerTimeNote = "(%s server)"
-- Roles
GroupCalendar.cHRole = "Целитель"
GroupCalendar.cTRole = "Танк"
GroupCalendar.cRRole = "Снайпер"
GroupCalendar.cMRole = "ДД"
GroupCalendar.cHPluralRole = "Целитель"
GroupCalendar.cTPluralRole = "Танк"
GroupCalendar.cRPluralRole = "Снайпер"
GroupCalendar.cMPluralRole = "Паразит"
GroupCalendar.cHPluralLabel = GroupCalendar.cHPluralRole..":"
GroupCalendar.cTPluralLabel = GroupCalendar.cTPluralRole..":"
GroupCalendar.cRPluralLabel = GroupCalendar.cRPluralRole..":"
GroupCalendar.cMPluralLabel = GroupCalendar.cMPluralRole..":"
-- iCalendar export
GroupCalendar.cExportTitle = "Export to iCalendar"
GroupCalendar.cExportSummary = "Addons can not write files directly to your computer for you, so exporting the iCalendar data requires a few easy steps you must complete yourself"
GroupCalendar.cExportInstructions =
{
"Step 1: "..HIGHLIGHT_FONT_COLOR_CODE.."Select the event types to be included",
"Step 2: "..HIGHLIGHT_FONT_COLOR_CODE.."Copy the text in the Data box",
"Step 3: "..HIGHLIGHT_FONT_COLOR_CODE.."Create a new file using any text editor and paste in the text",
"Step 4: "..HIGHLIGHT_FONT_COLOR_CODE.."Save the file with an extension of '.ics' (ie, Calendar.ics)",
RED_FONT_COLOR_CODE.."IMPORTANT: "..HIGHLIGHT_FONT_COLOR_CODE.."You must save the file as plain text or it will not be usable",
"Step 5: "..HIGHLIGHT_FONT_COLOR_CODE.."Import the file into your calendar application",
}
GroupCalendar.cPrivateEvents = "Private events"
GroupCalendar.cGuildEvents = "Guild events"
GroupCalendar.cHolidays = "Holidays"
GroupCalendar.cTradeskills = "Cooldown events"
GroupCalendar.cPersonalEvents = "Personal events"
GroupCalendar.cAlts = "Alts"
GroupCalendar.cOthers = "Others"
GroupCalendar.cExportData = "Data"
-- Event Edit tab
GroupCalendar.cLevelRangeFormat = "С уровня %i до %i"
GroupCalendar.cMinLevelFormat = "С уровня %i и выше"
GroupCalendar.cMaxLevelFormat = "До уровня %i"
GroupCalendar.cAllLevels = "Все уровни"
GroupCalendar.cSingleLevel = "Только %i уровня"
GroupCalendar.cYes = "Да! Я буду на этом событии"
GroupCalendar.cNo = "Нет! Я не буду на этом событии"
GroupCalendar.cMaybe = "Возможно. Запишите в список резерва"
GroupCalendar.cStatusFormat = "Status: %s"
GroupCalendar.cInvitedByFormat = "Invited by %s"
GroupCalendar.cInvitedStatus = "Invited, awaiting your response"
GroupCalendar.cAcceptedStatus = "Accepted, awaiting confirmation"
GroupCalendar.cDeclinedStatus = CALENDAR_STATUS_DECLINED
GroupCalendar.cConfirmedStatus = CALENDAR_STATUS_CONFIRMED
GroupCalendar.cOutStatus = CALENDAR_STATUS_OUT
GroupCalendar.cStandbyStatus = CALENDAR_STATUS_STANDBY
GroupCalendar.cSignedUpStatus = CALENDAR_STATUS_SIGNEDUP
GroupCalendar.cNotSignedUpStatus = CALENDAR_STATUS_NOT_SIGNEDUP
GroupCalendar.cAllDay = "All day"
GroupCalendar.cEventModeLabel = "Mode:"
GroupCalendar.cTimeLabel = "Время:"
GroupCalendar.cDurationLabel = "Длина:"
GroupCalendar.cEventLabel = "Событие:"
GroupCalendar.cTitleLabel = "Название:"
GroupCalendar.cLevelsLabel = "Уровни:"
GroupCalendar.cLevelRangeSeparator = "до"
GroupCalendar.cDescriptionLabel = "Описание:"
GroupCalendar.cCommentLabel = "Заметка:"
GroupCalendar.cRepeatLabel = "Repeat:"
GroupCalendar.cAutoConfirmLabel = "Auto confirm"
GroupCalendar.cLockoutLabel = "Auto-close:"
GroupCalendar.cEventClosedLabel = "Signups closed"
GroupCalendar.cAutoConfirmRoleLimitsTitle = "Auto confirm limits"
GroupCalendar.cAutoConfirmLimitsLabel = "Limits..."
GroupCalendar.cNormalMode = "Private event"
GroupCalendar.cAnnounceMode = "Guild announcement"
GroupCalendar.cSignupMode = "Guild event"
GroupCalendar.cCommunityMode = "Community event"
GroupCalendar.cLockout0 = "at the start"
GroupCalendar.cLockout15 = "15 minutes early"
GroupCalendar.cLockout30 = "30 minutes early"
GroupCalendar.cLockout60 = "1 hour early"
GroupCalendar.cLockout120 = "2 hours early"
GroupCalendar.cLockout180 = "3 hours early"
GroupCalendar.cLockout1440 = "1 day early"
GroupCalendar.cPluralMinutesFormat = "%d минут"
GroupCalendar.cSingularHourFormat = "%d час"
GroupCalendar.cPluralHourFormat = "%d часа"
GroupCalendar.cSingularHourPluralMinutes = "%d час %d минут"
GroupCalendar.cPluralHourPluralMinutes = "%d часа %d минут"
GroupCalendar.cNewerVersionMessage = "Доступна новая версия (%s)"
GroupCalendar.cDelete = "Удалить"
-- Event Group tab
GroupCalendar.cViewGroupBy = "Группы по"
GroupCalendar.cViewByStatus = "Статусу"
GroupCalendar.cViewByClass = "Классу"
GroupCalendar.cViewByRole = "Роли"
GroupCalendar.cViewSortBy = "Сортировать"
GroupCalendar.cViewByDate = "По дате"
GroupCalendar.cViewByRank = "По рангу"
GroupCalendar.cViewByName = "По Имени"
GroupCalendar.cInviteButtonTitle = "Пригласить"
GroupCalendar.cAutoSelectButtonTitle = "Выбрать игроков..."
GroupCalendar.cAutoSelectWindowTitle = "Выбрать игроков"
GroupCalendar.cNoSelection = "Нет выбранных игроков"
GroupCalendar.cSingleSelection = "1 игрок выбран"
GroupCalendar.cMultiSelection = "%d игрока выбраны"
GroupCalendar.cInviteNeedSelectionStatus = "Выбрать для приглашения"
GroupCalendar.cInviteReadyStatus = "Готовы для приглашения"
GroupCalendar.cInviteInitialInvitesStatus = "Отправить приглашение"
GroupCalendar.cInviteAwaitingAcceptanceStatus = "Ожидание приема"
GroupCalendar.cInviteConvertingToRaidStatus = "Конвертировать в рейд"
GroupCalendar.cInviteInvitingStatus = "Рассылка приглашений"
GroupCalendar.cInviteCompleteStatus = "Приглашение закончено"
GroupCalendar.cInviteReadyToRefillStatus = "Заполнения свободных мест готово"
GroupCalendar.cInviteNoMoreAvailableStatus = "Нет больше игроков чтобы вступить в группу"
GroupCalendar.cRaidFull = "Рейд полон"
GroupCalendar.cWhisperPrefix = "[Организатор]"
GroupCalendar.cInviteWhisperFormat = "%s Приветствую! Я приглашаю вас для Участия в событии '%s'. Если вы можете, то прошу принять участие в этом событии."
GroupCalendar.cAlreadyGroupedWhisper = "%s Вы уже в группе :(. Пожалуйста /w отпишите, когда вы покинете группу."
GroupCalendar.cJoinedGroupStatus = "Присоединен"
GroupCalendar.cInvitedGroupStatus = "Приглашен"
GroupCalendar.cReadyGroupStatus = "Готов"
GroupCalendar.cGroupedGroupStatus = "В другой группе"
GroupCalendar.cStandbyGroupStatus = "Резерв"
GroupCalendar.cMaybeGroupStatus = "Возможно"
GroupCalendar.cDeclinedGroupStatus = "Отклонил приглашение"
GroupCalendar.cOfflineGroupStatus = "Не в сети"
GroupCalendar.cLeftGroupStatus = "Покинул группу"
GroupCalendar.cTotalLabel = "Total:"
GroupCalendar.cAutoConfirmationTitle = "Авто подтвердить по классу"
GroupCalendar.cRoleConfirmationTitle = "Авто подтвердить по роли"
GroupCalendar.cManualConfirmationTitle = "Ручное подтверждение"
GroupCalendar.cClosedEventTitle = "Закрытое событие"
GroupCalendar.cMinLabel = "мин"
GroupCalendar.cMaxLabel = "макс"
GroupCalendar.cStandby = CALENDAR_STATUS_STANDBY
-- Limits dialog
GroupCalendar.cMaxPartySizeLabel = "Макс размер группы:"
GroupCalendar.cMinPartySizeLabel = "Мин размер группы:"
GroupCalendar.cNoMinimum = "Нет минимума"
GroupCalendar.cNoMaximum = "Не ограничено"
GroupCalendar.cPartySizeFormat = "%d игроков"
GroupCalendar.cAddPlayerTitle = "Добавить..."
GroupCalendar.cAutoConfirmButtonTitle = "Настройки..."
GroupCalendar.cClassLimitDescription = "В области ниже, установите минимальное и максимальное количество каждого класса. Игроки не попавшие в лимит автоматически попадают в резерв. Дополнительные места будут заполнены в порядке ответа до достижения максимума."
GroupCalendar.cRoleLimitDescription = "В области ниже, установите минимальное и максимальное количество каждой роли. Игроки не попавшие в лимит автоматически попадают в резерв. Дополнительные места будут заполнены в порядке ответа до достижения максимума.. Вы можете по выбору установить число минимума классов по роли (запрашивая одного удаленного дамагера шадов приста для примера)"
GroupCalendar.cPriorityLabel = "Приоритет:"
GroupCalendar.cPriorityDate = "Дата"
GroupCalendar.cPriorityRank = "Ранг"
GroupCalendar.cCachedEventStatus = "This event is a cached copy from $Name's calendar\rLast refreshed on $Date at $Time"
-- Class names
GroupCalendar.cClassName =
{
DRUID = {Male = LOCALIZED_CLASS_NAMES_MALE.DRUID, Female = LOCALIZED_CLASS_NAMES_FEMALE.DRUID, Plural = "Друиды"},
HUNTER = {Male = LOCALIZED_CLASS_NAMES_MALE.HUNTER, Female = LOCALIZED_CLASS_NAMES_FEMALE.HUNTER, Plural = "Охотники"},
MAGE = {Male = LOCALIZED_CLASS_NAMES_MALE.MAGE, Female = LOCALIZED_CLASS_NAMES_FEMALE.MAGE, Plural = "Маги"},
PALADIN = {Male = LOCALIZED_CLASS_NAMES_MALE.PALADIN, Female = LOCALIZED_CLASS_NAMES_FEMALE.PALADIN, Plural = "Паладины"},
PRIEST = {Male = LOCALIZED_CLASS_NAMES_MALE.PRIEST, Female = LOCALIZED_CLASS_NAMES_FEMALE.PRIEST, Plural = "Жрецы"},
ROGUE = {Male = LOCALIZED_CLASS_NAMES_MALE.ROGUE, Female = LOCALIZED_CLASS_NAMES_FEMALE.ROGUE, Plural = "Разбойники"},
SHAMAN = {Male = LOCALIZED_CLASS_NAMES_MALE.SHAMAN, Female = LOCALIZED_CLASS_NAMES_FEMALE.SHAMAN, Plural = "Шаманы"},
WARLOCK = {Male = LOCALIZED_CLASS_NAMES_MALE.WARLOCK, Female = LOCALIZED_CLASS_NAMES_FEMALE.WARLOCK, Plural = "Чернокнижники"},
WARRIOR = {Male = LOCALIZED_CLASS_NAMES_MALE.WARRIOR, Female = LOCALIZED_CLASS_NAMES_FEMALE.WARRIOR, Plural = "Воины"},
DEATHKNIGHT = {Male = LOCALIZED_CLASS_NAMES_MALE.DEATHKNIGHT, Female = LOCALIZED_CLASS_NAMES_FEMALE.DEATHKNIGHT, Plural = "Death Knights"},
MONK = {Male = LOCALIZED_CLASS_NAMES_MALE.MONK, Female = LOCALIZED_CLASS_NAMES_FEMALE.MONK, Plural = "Monks"},
DEMONHUNTER = {Male = LOCALIZED_CLASS_NAMES_MALE.DEMONHUNTER, Female = LOCALIZED_CLASS_NAMES_FEMALE.DEMONHUNTER, Plural = "Demon Hunters"},
}
GroupCalendar.cCurrentPartyOrRaid = "Current party or raid"
GroupCalendar.cViewByFormat = "View by %s / %s"
GroupCalendar.cConfirm = "Confirm"
GroupCalendar.cSingleTimeDateFormat = "%s\r%s"
GroupCalendar.cTimeDateRangeFormat = "%s\rc %s до %s"
GroupCalendar.cStartEventHelp = "Click Start to begin forming your party or raid"
GroupCalendar.cResumeEventHelp = "Click Resume to continue forming your party or raid"
GroupCalendar.cShowClassReservations = "Reservations >>>"
GroupCalendar.cHideClassReservations = "<<< Reservations"
GroupCalendar.cInviteStatusText =
{
JOINED = "|cff00ff00Присоединен",
CONFIRMED = "|cff88ff00Готов",
STANDBY = "|cffffff00Резерв",
INVITED = "|cff00ff00Приглашен",
DECLINED = "|cffff0000Отклонил приглашение",
BUSY = "|cffff0000В другой группе",
OFFLINE = "|cff888888Не в сети",
LEFT = "|cff0000ffПокинул группу",
}
GroupCalendar.cStart = "Start"
GroupCalendar.cPause = "Pause"
GroupCalendar.cResume = "Resume"
GroupCalendar.cRestart = "Restart"
-- About tab
GroupCalendar.cAboutTitle = "Об Организаторе %s"
GroupCalendar.cAboutAuthor = "Разработал и написал аддон John Stephen"
GroupCalendar.cAboutThanks = "Many thanks to all fans and supporters. I hope my addons add to your gaming enjoyment as much as building them adds to mine."
-- Partners tab
GroupCalendar.cPartnersTitle = "Multi-guild partnerships"
GroupCalendar.cPartnersDescription1 = "Multi-guild partnerships make it easy to coordinate events across guilds by sharing guild rosters (name, rank, class and level only) with your partner guilds"
GroupCalendar.cPartnersDescription2 = "To create a partnership, add a player using the Add Player button at the bottom of this window"
GroupCalendar.cAddPlayer = "Добавить игрока..."
GroupCalendar.cRemovePlayer = "Remove Player..."
GroupCalendar.cPartnersLabel = NORMAL_FONT_COLOR_CODE.."Partners:"..FONT_COLOR_CODE_CLOSE.." %s"
GroupCalendar.cSync = "Sync"
GroupCalendar.cConfirmDeletePartnerGuild = "Are you sure you want to delete your partnership with <%s>?"
GroupCalendar.cConfirmDeletePartner = "Are you sure you want to remove %s from your partnerships?"
GroupCalendar.cConfirmPartnerRequest = "[Group Calendar]: %s is requesting a partnership with you."
GroupCalendar.cLastPartnerUpdate = "Last synchronized %s %s"
GroupCalendar.cNoPartnerUpdate = "Not synchronized"
GroupCalendar.cPartnerStatus =
{
PARTNER_SYNC_CONNECTING = "Connecting to %s",
PARTNER_SYNC_CONNECTED = "Synchronizing with %s",
}
-- Settings tab
GroupCalendar.cSettingsTitle = "Settings"
GroupCalendar.cThemeLabel = "Theme"
GroupCalendar.cParchmentThemeName = "Parchment"
GroupCalendar.cLightParchmentThemeName = "Light Parchment"
GroupCalendar.cSeasonalThemeName = "Seasonal"
GroupCalendar.cTwentyFourHourTime = "24 hour time"
GroupCalendar.cAnnounceBirthdays = "Show birthday reminders"
GroupCalendar.cAnnounceEvents = "Show event reminders"
GroupCalendar.cAnnounceTradeskills = "Show tradeskill reminders"
GroupCalendar.cRecordTradeskills = "Record tradeskill cooldowns"
GroupCalendar.cRememberInvites = "Remember event invitations for use in future events"
GroupCalendar.cUnderConstruction = "This area is under construction"
GroupCalendar.cUnknown = "Неизвестно"
-- Invite tab
GroupCalendar.cModeratorTooltipTitle = "Moderator"
GroupCalendar.cModeratorTooltipDescription = "Turn this on to allow this player or group to co-manage your event"
-- Main window
GroupCalendar.cCalendar = "Календарь"
GroupCalendar.cSettings = "Установки"
GroupCalendar.cPartners = "Partners"
GroupCalendar.cExport = "Export"
GroupCalendar.cAbout = "О Аддоне"
GroupCalendar.cUseServerDateTime = "Дата и Время сервера"
GroupCalendar.cUseServerDateTimeDescription = "Включите, для использования серверного время и даты для событий, либо выключите, чтобы использовалось локальное время и дата"
GroupCalendar.cShowCalendarLabel = "Show:"
GroupCalendar.cShowAlts = "Show alts"
GroupCalendar.cShowAltsDescription = "Turn on to show events cached from your other characters"
GroupCalendar.cShowDarkmoonCalendarDescription = "Turn on to show the Darkmoon Faire schedule"
GroupCalendar.cShowWeeklyCalendarDescription = "Turn on to show weekly events such as the Fishing Extravaganza"
GroupCalendar.cShowPvPCalendarDescription = "Turn on to show PvP weekends"
GroupCalendar.cShowLockoutCalendarDescription = "Turn on to show you active dungeon lockouts"
GroupCalendar.cMinimapButtonHint = "Left-click to show Group Calendar."
GroupCalendar.cMinimapButtonHint2 = "Right-click to show the WoW calendar."
GroupCalendar.cNewEvent = "New Event..."
GroupCalendar.cPasteEvent = "Paste Event"
GroupCalendar.cConfirmDelete = "Are you sure you want to delete this event? This will remove the event from all calendars, including other players."
GroupCalendar.cGermanLocalization = "German Localization"
GroupCalendar.cChineseLocalization = "Chinese Localization"
GroupCalendar.cFrenchLocalization = "French Localization"
GroupCalendar.cSpanishLocalization = "Spanish Localization"
GroupCalendar.cRussianLocalization = "Russian Localization"
GroupCalendar.cContributingDeveloper = "Contributing Developer"
GroupCalendar.cGuildCreditFormat = "The guild of %s"
GroupCalendar.cExpiredEventNote = "This event has already occurred and can no longer be modified"
GroupCalendar.cMore = "more..."
GroupCalendar.cRespondedDateFormat = "Responded on %s"
GroupCalendar.cStartDayLabel = "Start week on:"
end -- ruRU
|
local cli = require('neogit.lib.git.cli')
local util = require('neogit.lib.util')
local M = {}
function M.pull_interactive(remote, branch, args)
local cmd = "git pull " .. remote .. " " .. branch .. " " .. args
return cli.interactive_git_cmd(cmd)
end
local function update_unpulled(state)
if not state.upstream.branch then return end
local result =
cli.log.oneline.for_range('..@{upstream}').show_popup(false).call()
state.unpulled.files = util.map(result, function (x)
return { name = x }
end)
end
function M.register(meta)
meta.update_unpulled = update_unpulled
end
return M
|
require("dapui").setup({
icons = { expanded = "▾", collapsed = "▸" },
mappings = {
expand = { "<CR>", "<2-LeftMouse>" },
open = "o",
remove = "d",
edit = "e",
repl = "r",
toggle = "t",
},
sidebar = {
elements = {
{
id = "scopes",
size = 0.25,
},
{ id = "breakpoints", size = 0.25 },
{ id = "stacks", size = 0.25 },
{ id = "watches", size = 00.25 },
},
size = 40,
position = "left",
},
tray = {
elements = { "repl" },
size = 10,
position = "bottom",
},
floating = {
max_height = nil,
max_width = nil,
border = "single",
mappings = {
close = { "q", "<Esc>" },
},
},
windows = { indent = 1 },
})
local dap, dapui = require("dap"), require("dapui")
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end
|
local zmq = require "lzmq"
local zloop = require "lzmq.loop"
local zassert = zmq.assert
require "utils"
print_version(zmq)
main_loop = zloop.new()
local ECHO_ADDR = {
"inproc://echo";
"tcp://127.0.0.1:5555";
}
local ECHO_TIME = 1000
main_loop:add_new_bind(zmq.REP, ECHO_ADDR, function(skt)
local msg = zassert(print_msg("SRV RECV: ",skt:recv_all()))
msg[2] = os.time()
zassert(skt:send_all(msg))
end)
local cli = main_loop:add_new_connect(zmq.REQ, ECHO_ADDR, function(skt,events,loop)
local msg = zassert(print_msg("CLI RECV: ", skt:recv_all()))
loop:add_once(ECHO_TIME, function(ev,loop)
zassert(skt:send_all(msg))
end)
end)
main_loop:add_once(2000, function(ev, loop)
zassert(cli:send_all{'hello', os.time()})
end)
main_loop:start()
|
-- Copyright 2016-2019, Firaxis Games
-- Non-interactive messages (e.g., Gossip and combat results) that appear in the upper-center of the screen.
include( "InstanceManager" );
include("cui_settings"); -- CUI
-- ===========================================================================
-- CONSTANTS
-- ===========================================================================
local debug_testActive :boolean = false; -- (false) Enable test messages and hot keys D, and G
local DEFAULT_TIME_TO_DISPLAY :number = 7; -- Seconds to display the message
local TXT_PLAYER_CONNECTED_CHAT :string = Locale.Lookup( "LOC_MP_PLAYER_CONNECTED_CHAT" );
local TXT_PLAYER_DISCONNECTED_CHAT :string = Locale.Lookup( "LOC_MP_PLAYER_DISCONNECTED_CHAT" );
local TXT_PLAYER_KICKED_CHAT :string = Locale.Lookup( "LOC_MP_PLAYER_KICKED_CHAT" );
-- ===========================================================================
-- MEMBERS
-- ===========================================================================
local m_gossipIM :table = InstanceManager:new( "GossipMessageInstance", "Root", Controls.GossipStack );
local m_statusIM :table = InstanceManager:new( "StatusMessageInstance", "Root", Controls.DefaultStack );
local m_kGossip :table = {};
local m_isGossipExpanded:boolean = false;
local m_kMessages :table = {};
-- ===========================================================================
-- FUNCTIONS
-- ===========================================================================
-- ===========================================================================
-- EVENT
-- subType when gossip it's the db enum for the gossip type
-- ===========================================================================
function OnStatusMessage( message:string, displayTime:number, type:number, subType:number )
if (type == ReportingStatusTypes.GOSSIP) then
-- CUI >>
local cui_UseVanilaGossip = CuiSettings:GetBoolean(CuiSettings.DF_GOSSIP_LOG);
if (not cui_UseVanilaGossip) then
return;
end
-- << CUI
AddGossip( subType, message, displayTime );
end
if (type == ReportingStatusTypes.DEFAULT) then
-- CUI >>
local cui_UseVanilaCombat = CuiSettings:GetBoolean(CuiSettings.DF_COMBAT_LOG);
if (not cui_UseVanilaCombat) then
return;
end
-- << CUI
AddDefault( message, displayTime );
end
RealizeMainAreaPosition();
end
-- ===========================================================================
-- Realize the first Gossip in the list.
-- ===========================================================================
function RealizeFirstGossip()
local num:number = table.count(m_kGossip);
if num < 1 then
return;
end
local uiInstance:table= m_kGossip[1].uiInstance;
if uiInstance.Root:IsHidden() then
uiInstance.Root:SetHide( false );
end
uiInstance.ExpandButton:SetHide( num == 1 );
uiInstance.ExpandButton:SetSelected( m_isGossipExpanded );
end
-- ===========================================================================
-- Add a gossip entry.
-- ===========================================================================
function AddGossip( eGossipType:number, message:string, optionalDisplayTime:number )
if optionalDisplayTime == nil or optionalDisplayTime == 0 then
optionalDisplayTime = DEFAULT_TIME_TO_DISPLAY;
end
-- Add visually
local uiInstance :table = m_gossipIM:GetInstance();
local kGossipData :table = GameInfo.Gossips[eGossipType]; -- Lookup via hash
if kGossipData then
uiInstance.Icon:SetIcon("ICON_GOSSIP_"..kGossipData.GroupType);
uiInstance.IconBack:SetIcon("ICON_GOSSIP_"..kGossipData.GroupType);
else
UI.DataError("The gossip type '"..tostring(eGossipType).."' could not be found in the database; icon will not be set.");
end
uiInstance.Message:SetText( message );
-- Add the data (including reference to visual)
local kEntry:table = {
eGossipType = eGossipType,
message = message,
displayTime = optionalDisplayTime,
uiInstance = uiInstance
};
table.insert( m_kGossip, kEntry);
local GOSSIP_VERTICAL_PADDING :number = 20;
local verticalSpace :number = uiInstance.Message:GetSizeY() + GOSSIP_VERTICAL_PADDING;
uiInstance.Root:SetHide( false );
uiInstance.Content:SetSizeY( verticalSpace );
uiInstance.Anim:SetEndPauseTime( optionalDisplayTime );
uiInstance.Anim:SetToBeginning();
uiInstance.ExpandButton:SetHide( true );
-- This may or may not be the first button and if this is the second gossip
-- then the first gossip needs to be realized to show the collapse button.
RealizeFirstGossip( uiInstance );
-- If showing all gossips or if this is the first in the list, then start animation.
local isFirstGossip:boolean = table.count(m_kGossip)==1;
if m_isGossipExpanded or (m_isGossipExpanded==false and isFirstGossip) then
uiInstance.Anim:Play();
end
-- Now thata data exists, create lambdas that passes it in.
uiInstance.Anim:RegisterEndCallback( function() OnGossipEndAnim(kEntry,uiInstance) end );
uiInstance.Button:RegisterCallback( Mouse.eLClick, function() OnGossipClicked(kEntry,uiInstance); end );
uiInstance.Button:RegisterCallback( Mouse.eRClick, function() OnGossipClicked(kEntry,uiInstance); end );
uiInstance.ExpandButton:RegisterCallback( Mouse.eLClick,function() OnToggleGossipExpand(kEntry,uiInstance); end );
-- Hide this if not the first and list is collapsed.
local numGossips:number = table.count(m_kGossip);
if m_isGossipExpanded==false and (numGossips > 1) then
uiInstance.Root:SetHide( true );
end
end
-- ===========================================================================
function RemoveGossip( kEntry:table, uiInstance:table )
-- Remove callbacks and visuals
uiInstance.Anim:ClearEndCallback();
uiInstance.Anim:ClearAnimCallback();
m_gossipIM:ReleaseInstance( uiInstance );
-- Remove data
for i,kTableEntry in ipairs(m_kGossip) do
if kTableEntry == kEntry then
table.remove( m_kGossip, i, 1);
break;
end
end
-- Look through and set animation appropriately.
for i,kTableEntry in ipairs(m_kGossip) do
local uiInstance :table = kTableEntry.uiInstance;
uiInstance.Anim:SetToEnd();
if i==1 then
uiInstance.Anim:Play();
else
uiInstance.Anim:Stop();
end
uiInstance.Root:SetHide( m_isGossipExpanded==false );
end
RealizeFirstGossip();
Controls.DefaultStack:CalculateSize();
end
-- ===========================================================================
function RemoveAllGossip()
if table.count(m_kGossip) == 0 then
return;
end
for i,kTableEntry in ipairs(m_kGossip) do
local uiInstance :table = kTableEntry.uiInstance;
uiInstance.Anim:Stop();
uiInstance.Root:SetHide( true );
end
m_gossipIM:ResetInstances();
m_kGossip = {};
end
-- ===========================================================================
-- UI Callback
-- Clicked to dismiss message
-- ===========================================================================
function OnGossipClicked( kEntry:table, uiInstance:table )
UI.PlaySound("Play_UI_Click");
RemoveGossip(kEntry, uiInstance );
end
-- ===========================================================================
-- UI Callback
-- Clicked to dismiss message
-- ===========================================================================
function OnToggleGossipExpand( kEntry:table, uiInstance:table )
m_isGossipExpanded = not m_isGossipExpanded;
-- Expanded: Show all and reset animation.
if m_isGossipExpanded then
for i,kGossip in ipairs(m_kGossip) do
local uiInstance:table = kGossip.uiInstance;
uiInstance.Root:SetHide( false );
uiInstance.ExpandButton:SetSelected( true );
uiInstance.Anim:SetToEnd();
if i==1 then
uiInstance.Anim:Play();
else
uiInstance.Anim:Stop();
end
end
return;
end
-- Collapsed: only showing the first gossip.
for i,kGossip in ipairs(m_kGossip) do
local uiInstance:table = kGossip.uiInstance;
uiInstance.Root:SetHide( i>1 );
uiInstance.ExpandButton:SetSelected( false );
uiInstance.Anim:SetToEnd();
if i==1 then
uiInstance.Anim:Play();
else
uiInstance.Anim:Stop();
uiInstance.ExpandButton:SetHide( true );
end
end
end
-- ===========================================================================
function OnGossipEndAnim( kEntry:table, uiInstance:table )
RemoveGossip( kEntry, uiInstance );
end
-- ===========================================================================
-- Add default message (e.g., combat messages)
-- ===========================================================================
function AddDefault( message, displayTime )
-- TODO: Simplify
local type = ReportingStatusTypes.DEFAULT
local kTypeEntry :table = m_kMessages[type];
if (kTypeEntry == nil) then
-- New type
m_kMessages[type] = {
InstanceManager = nil,
MessageInstances= {}
};
kTypeEntry = m_kMessages[type];
kTypeEntry.InstanceManager = m_statusIM;
end
local uiInstance:table = kTypeEntry.InstanceManager:GetInstance();
table.insert( kTypeEntry.MessageInstances, uiInstance );
if displayTime==nil or displayTime==0 then
displayTime = DEFAULT_TIME_TO_DISPLAY;
end
uiInstance.Message:SetText( message );
uiInstance.Button:RegisterCallback( Mouse.eLClick, function() OnMessageClicked(kTypeEntry,uiInstance) end );
uiInstance.Anim:SetEndPauseTime( displayTime );
uiInstance.Anim:RegisterEndCallback( function() OnEndAnim(kTypeEntry,uiInstance) end );
uiInstance.Anim:SetToBeginning();
uiInstance.Anim:Play();
Controls.DefaultStack:CalculateSize();
end
-- ===========================================================================
function RemoveMessage( kTypeEntry:table, uiInstance:table )
uiInstance.Anim:ClearEndCallback();
Controls.DefaultStack:CalculateSize();
kTypeEntry.InstanceManager:ReleaseInstance( uiInstance );
end
-- ===========================================================================
function OnEndAnim( kTypeEntry:table, uiInstance:table )
RemoveMessage( kTypeEntry, uiInstance );
end
-- ===========================================================================
function OnMessageClicked( kTypeEntry:table, uiInstance:table )
RemoveMessage( kTypeEntry, uiInstance );
end
-- ===========================================================================
-- EVENT
-- ===========================================================================
function OnMultplayerPlayerConnected( playerID:number )
if playerID == -1 or playerID == 1000 then
return;
end
if( ContextPtr:IsHidden() == false and GameConfiguration.IsNetworkMultiplayer() ) then
local pPlayerConfig :table = PlayerConfigurations[playerID];
local statusMessage :string= Locale.Lookup(pPlayerConfig:GetPlayerName()) .. " " .. TXT_PLAYER_CONNECTED_CHAT;
OnStatusMessage( statusMessage, DEFAULT_TIME_TO_DISPLAY, ReportingStatusTypes.DEFAULT );
end
end
-- ===========================================================================
-- EVENT
-- ===========================================================================
function OnMultiplayerPrePlayerDisconnected( playerID:number )
if playerID == -1 or playerID == 1000 then
return;
end
if( ContextPtr:IsHidden() == false and GameConfiguration.IsNetworkMultiplayer() ) then
local pPlayerConfig :table = PlayerConfigurations[playerID];
local statusMessage :string= Locale.Lookup(pPlayerConfig:GetPlayerName());
if(Network.IsPlayerKicked(playerID)) then
statusMessage = statusMessage .. " " .. TXT_PLAYER_KICKED_CHAT;
else
statusMessage = statusMessage .. " " .. TXT_PLAYER_DISCONNECTED_CHAT;
end
OnStatusMessage(statusMessage, DEFAULT_TIME_TO_DISPLAY, ReportingStatusTypes.DEFAULT);
end
end
-- ===========================================================================
-- EVENT
-- ===========================================================================
function OnLocalTurnEnd( a,b,c )
local playerID :number = Game.GetLocalPlayer();
if playerID == -1 or playerID == 1000 then return; end;
RemoveAllGossip();
end
-- ===========================================================================
-- Testing: When on the "G" and "D" keys generate messages.
-- ===========================================================================
function DebugTest()
OnStatusMessage("Press D,F or G to generate gossip. Hold Shift+D or G to generate notifications.", 7, ReportingStatusTypes.DEFAULT );
ContextPtr:SetInputHandler(
function( pInputStruct )
local uiMsg = pInputStruct:GetMessageType();
if uiMsg == KeyEvents.KeyUp then
local key = pInputStruct:GetKey();
local type = pInputStruct:IsShiftDown() and ReportingStatusTypes.DEFAULT or ReportingStatusTypes.GOSSIP ;
local subType = DB.MakeHash("GOSSIP_MAKE_DOW");
if key == Keys.D then OnStatusMessage("Testing out status message ajsdkl akds dk dkdkj dkdkd ajksaksdkjkjd dkadkj f djkdkjdkj dak sdkjdjkal dkd kd dk adkj dkkadj kdjd kdkjd jkd jd dkj djkd dkdkdjdkdkjdkd djkd dkd dkjd kdjdkj d", 7, type, subType); return true; end
if key == Keys.F then OnStatusMessage("The rain in Spain will dry quickly in Madrid.", 7, type, subType); return true; end
if key == Keys.G then OnStatusMessage("Testing out gossip message", nil, type, subType ); return true; end
end
return false;
end, true);
end
-- ===========================================================================
-- Position to just below the height of the diplomacy ribbon scroll area
-- ===========================================================================
function RealizeMainAreaPosition()
local m_uiRibbonScroll :table = ContextPtr:LookUpControl( "/InGame/DiplomacyRibbon/ScrollContainer" );
if m_uiRibbonScroll == nil then
return
end
local ribbonHeight:number = m_uiRibbonScroll:GetSizeY();
-- Bail if no change.
local EXTRA_CLEARANCE :number = 50;
local currentOffsetY :number = Controls.MainArea:GetOffsetY();
if currentOffsetY == (ribbonHeight + EXTRA_CLEARANCE) then
return;
end
-- Set starting height of stack to just below ribbon.
Controls.MainArea:SetOffsetY( ribbonHeight + EXTRA_CLEARANCE );
end
-- ===========================================================================
-- UI Callback
-- ===========================================================================
function OnShutdown()
Events.LocalPlayerTurnEnd.Remove( OnLocalTurnEnd );
Events.StatusMessage.Remove( OnStatusMessage );
Events.MultiplayerPlayerConnected.Remove( OnMultplayerPlayerConnected );
Events.MultiplayerPrePlayerDisconnected.Remove( OnMultiplayerPrePlayerDisconnected );
end
-- ===========================================================================
function LateInitialize()
RealizeMainAreaPosition();
Events.LocalPlayerTurnEnd.Add( OnLocalTurnEnd );
Events.StatusMessage.Add( OnStatusMessage );
Events.MultiplayerPlayerConnected.Add( OnMultplayerPlayerConnected );
Events.MultiplayerPrePlayerDisconnected.Add( OnMultiplayerPrePlayerDisconnected );
end
-- ===========================================================================
-- UI Callback
-- ===========================================================================
function OnInit()
LateInitialize();
end
-- ===========================================================================
--
-- ===========================================================================
function Initialize()
ContextPtr:SetInitHandler( OnInit );
ContextPtr:SetShutdown( OnShutdown );
if debug_testActive then DebugTest(); end -- Enable debug mode?
end
if GameCapabilities.HasCapability("CAPABILITY_DISPLAY_HUD_GOSSIP_LIST") then
Initialize();
end
|
--[[
Copyright (C) 2018 ZTE, Inc. and others. All rights reserved. (ZTE)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--]]
local _M = {}
_M._VERSION = '1.0.0'
local floor = math.floor
local str_byte = string.byte
local tab_sort = table.sort
local tab_insert = table.insert
local MOD = 2 ^ 32
local REPLICAS = 20
local LUCKY_NUM = 13
local tbl_util = require('lib.utils.table_util')
local tbl_isempty = tbl_util.isempty
local tablex = require('pl.tablex')
local peerwatcher = require "core.peerwatcher"
local ngx_var = ngx.var
local hash_data = {}
local function hash_string(str)
local key = 0
for i = 1, #str do
key = (key * 31 + str_byte(str, i)) % MOD
end
return key
end
local function init_consistent_hash_state(servers)
local weight_sum = 0
local weight = 1
for _, srv in ipairs(servers) do
if srv.weight and srv.weight ~= 0 then
weight = srv.weight
end
weight_sum = weight_sum + weight
end
local circle, members = {}, 0
for index, srv in ipairs(servers) do
local key = ("%s:%s"):format(srv.ip, srv.port)
local base_hash = hash_string(key)
for c = 1, REPLICAS * weight_sum do
local hash = (base_hash * c * LUCKY_NUM) % MOD
tab_insert(circle, { hash, index })
end
members = members + 1
end
tab_sort(circle, function(a, b) return a[1] < b[1] end)
return { circle = circle, members = members }
end
local function update_consistent_hash_state(hash_data,servers,svckey)
-- compare servers in ctx with servers in cache
-- update the hash data if changes occur
local serverscache = tablex.deepcopy(hash_data[svckey].servers)
tab_sort(serverscache, function(a, b) return a.ip < b.ip end)
tab_sort(servers, function(a, b) return a.ip < b.ip end)
if not tablex.deepcompare(serverscache, servers, false) then
local tmp_chash = init_consistent_hash_state(servers)
hash_data[svckey].servers =servers
hash_data[svckey].chash = tmp_chash
end
end
local function binary_search(circle, key)
local size = #circle
local st, ed, mid = 1, size
while st <= ed do
mid = floor((st + ed) / 2)
if circle[mid][1] < key then
st = mid + 1
else
ed = mid - 1
end
end
return st == size + 1 and 1 or st
end
function _M.select_backserver(servers,svckey)
if hash_data[svckey] == nil then
local tbl = {}
tbl['servers'] = {}
tbl['chash'] = {}
hash_data[svckey] = tbl
end
if tbl_isempty(hash_data[svckey].servers) then
local tmp_chash = init_consistent_hash_state(servers)
hash_data[svckey].servers = servers
hash_data[svckey].chash = tmp_chash
else
update_consistent_hash_state(hash_data,servers,svckey)
end
local chash = hash_data[svckey].chash
local circle = chash.circle
local hash_key = ngx_var.remote_addr
local st = binary_search(circle, hash_string(hash_key))
local size = #circle
local ed = st + size - 1
for i = st, ed do
local idx = circle[(i - 1) % size + 1][2]
if peerwatcher.is_server_ok(svckey,hash_data[svckey].servers[idx]) then
return hash_data[svckey].servers[idx]
end
end
return nil, "consistent hash: no servers available"
end
return _M
|
if tweak_data and tweak_data.SCSuiteConfiguration.mute_bain_enabled then
if not STFUBain then
if not DialogManager then return end
STFUBain = true
local ingredient_dialog = {}
ingredient_dialog["pln_rt1_20"] = "Muriatic Acid"
ingredient_dialog["pln_rt1_22"] = "Caustic Soda"
ingredient_dialog["pln_rt1_24"] = "Hydrogen Chloride"
ingredient_dialog["pln_rat_stage1_20"] = "Muriatic Acid"
ingredient_dialog["pln_rat_stage1_22"] = "Caustic Soda"
ingredient_dialog["pln_rat_stage1_24"] = "Hydrogen Chloride"
local _queue_dialog_orig = DialogManager.queue_dialog
function DialogManager:queue_dialog(id, ...)
if ingredient_dialog[id] then
local mute_bain_rats = string.gsub(tweak_data.SCSuiteConfiguration.localization_strings["mute_bain_rats"], "{1}", ingredient_dialog[id])
if tweak_data.SCSuiteConfiguration.mute_bain_broadcast_toggle then
managers.chat:send_message(ChatManager.GAME, managers.network.account:username() or "Offline", mute_bain_rats)
else
managers.chat:_receive_message(1, "scSuite", mute_bain_rats, tweak_data.system_chat_color)
end
end
return _queue_dialog_orig(self, id, ...)
end
if managers.job:current_level_id() ~= "big" and managers.job:current_level_id() ~= "roberts" and managers.job:current_level_id() ~= "mia_1" then
function DialogManager:_play_dialog(dialog, params, line)
return
end
end
end
end |
--for your safety it is recommended you save a copy of your project file before running this script
--if you do not understand how this script works then you should probably not use it
local shouldDestroy = false
local SearchFor = {
"#",
"$",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"0",
}
local Selection = game:GetService("Selection")
for _, object in pairs(Selection:Get()) do
for i,v in pairs(object:GetDescendants()) do
if v:IsA("Script") then
print("Script: "..v.Name)
for j,k in pairs(SearchFor) do
if string.find(v.Name, k) then
if shouldDestroy == false then
warn("SCRIPT: "..v.Name)
else
--v:Destroy() --this is commented out for your protection. uncomment it once you understand the script. you will also need to set the first variable to true
print("DESTROYED: "..v.Name)
end
end
end
end
end
end
|
-- import
local candy = require "candy"
local EditorCommandModule = require 'candy_edit.common.EditorCommand'
local CanvasView = require 'candy_edit.EditorCanvas.CanvasView'
-- module
local SceneViewModule = {}
local function prioritySortFunc ( a, b )
return a._priority < b._priority
end
--------------------------------------------------------------------
local currentSceneView = false
function getCurrentSceneView ()
return currentSceneView
end
function startAdhocSceneTool ( toolID, context )
if not currentSceneView then return false end
return currentSceneView:startAdhocTool ( toolID, context )
end
function stopAdhocSceneTool ( toolID )
if not currentSceneView then return false end
return currentSceneView:stopAdhocTool ()
end
--------------------------------------------------------------------
---@class SceneViewDrag
local SceneViewDrag = CLASS: SceneViewDrag ()
:MODEL {}
function SceneViewDrag:onStart ( view, x, y )
-- print( 'start drag', x, y )
end
function SceneViewDrag:onMove ( view, x, y )
-- print( 'moving drag', x, y )
end
function SceneViewDrag:onFinish ( view, x, y )
-- print( 'finishing drag', x, y )
end
function SceneViewDrag:onStop ( view )
-- print( 'stop drag' )
end
--------------------------------------------------------------------
---@class SceneViewDragFactory
local SceneViewDragFactory = CLASS: SceneViewDragFactory ()
:MODEL {}
function SceneViewDragFactory:create ( view, mimeType, data, x, y )
return false
end
--------------------------------------------------------------------
---@class SceneView : CanvasView
local SceneView = CLASS: SceneView ( CanvasView )
function SceneView:__init()
self.dragFactoryList = {}
end
function SceneView:onInit ()
self:connect ( 'scene.pre_serialize', 'preSceneSerialize' )
self:connect ( 'scene.post_deserialize', 'postSceneDeserialize' )
self:readConfig ()
self.gizmoManager:updateConstantSize ()
self.itemManager:updateAllItemScale ()
self.activeDrags = {}
end
function SceneView:registerDragFactory ( factory, priority )
factory._priority = priority or 0
table.insert ( self.dragFactoryList, factory )
table.sort ( self.dragFactoryList, prioritySortFunc )
end
function SceneView:readConfig ()
local cfg = self.scene:getMetaData ( 'scene_view' )
if cfg then
local cameraCfg = cfg[ 'camera' ]
if cameraCfg then
self.camera:setLoc ( unpack ( cameraCfg[ 'loc' ] ) )
self.navi.zoom = cameraCfg[ 'zoom' ]
local cameraCom = self.camera:getComponent ( candy_edit.EditorCanvasCamera )
cameraCom:setZoom ( cameraCfg[ 'zoom' ] )
end
local gridCfg = cfg[ 'grid' ]
if gridCfg then
self:setGridSize ( unpack ( gridCfg[ 'size' ] or { 100, 100 } ) )
self:setGridVisible ( gridCfg[ 'visible' ]~=false )
self:setGridSnapping ( gridCfg[ 'snap' ]==true )
end
else
self:loadDefaultConfig ()
end
end
function SceneView:loadDefaultConfig ()
end
function SceneView:saveConfig ()
local cam = self.camera
local cfg = {}
self.scene:setMetaData ( 'scene_view', cfg )
---
cfg[ 'camera' ] = {
loc = { cam:getLoc () },
zoom = cam:getComponent ( candy_edit.EditorCanvasCamera ):getZoom (),
}
---
cfg[ 'grid' ] = {
size = { self:getGridSize () },
visible = self:isGridVisible (),
snap = self:isGridSnapping ()
}
---
cfg[ 'gizmo' ] = {
visible = self:isGizmoVisible ()
}
end
function SceneView:focusSelection ()
local selection = candy_editor.getSelection ( 'scene' )
for _, a in ipairs ( selection ) do
if isInstance ( a, candy.Entity ) then
self.camera:setLoc ( a:getWorldLoc () )
end
end
--todo: fit viewport to entity bound/ multiple selection
self:updateCanvas ()
end
function SceneView:preSceneSerialize ( scene )
if scene ~= self.scene then return end
self:saveConfig ()
end
function SceneView:postSceneDeserialize ( scene )
if scene ~= self.scene then return end
self.gizmoManager:refresh ()
self.pickingManager:refresh ()
end
function SceneView:makeCurrent ()
currentSceneView = self
end
function SceneView:onDestroy ()
if currentSceneView == self then
currentSceneView = false
end
end
function SceneView:pushObjectAttributeHistory ()
end
function SceneView:startDrag ( mimeType, dataString, x, y )
local accepted = false
local data = MOAIJsonParser.decode ( dataString )
for i, fac in ipairs ( self.dragFactoryList ) do
local drag = fac:create ( self, mimeType, data, x, y )
if drag then
drag.view = self
local drags
if isInstance ( drag, SceneViewDrag ) then
drags = { drag }
elseif type ( drag ) == 'table' then
drags = drag
end
for _, drag in ipairs ( drags ) do
if isInstance ( drag, SceneViewDrag ) then
self.activeDrags[ drag ] = true
drag:onStart ( self, x, y )
accepted = true
else
_warn ( 'unkown drag type' )
end
end
if accepted then return true end
end
end
return false
end
function SceneView:stopDrag ()
for drag in pairs ( self.activeDrags ) do
drag:onStop ( self )
end
self.activeDrags = {}
end
function SceneView:finishDrag ( x, y )
for drag in pairs ( self.activeDrags ) do
drag:onFinish ( self, x, y )
end
self.activeDrags = {}
end
function SceneView:moveDrag ( x, y )
for drag in pairs ( self.activeDrags ) do
drag:onMove ( self, x, y )
end
end
function SceneView:disableCamera ()
self:getCameraComponent ():setActive ( false )
end
function SceneView:enableCamera ()
self:getCameraComponent ():setActive ( true )
end
function SceneView:getCurrentToolId ()
local sceneToolManager = candy_editor.getModule ( 'scene_tool_manager' )
if sceneToolManager then
return sceneToolManager:getCurrentToolId ()
end
end
function SceneView:changeTool ( id, t )
local sceneToolManager = candy_editor.getModule ( 'scene_tool_manager' )
if sceneToolManager then
local dict = candy.tableToDictPlain ( t or {} )
sceneToolManager:changeToolD ( id, dict )
end
end
--function SceneView:startAdhocTool( id, t )
-- local sceneToolManager = candy.getModule( 'scene_tool_manager' )
-- if sceneToolManager then
-- local dict = gii.tableToDictPlain( t or {} )
-- sceneToolManager:startAdhocToolD( id, dict )
-- end
--end
--
--function SceneView:stopAdhocTool()
-- local sceneToolManager = candy.getModule( 'scene_tool_manager' )
-- if sceneToolManager then
-- sceneToolManager:stopAdhocTool()
-- end
--end
--------------------------------------------------------------------
---@class SceneViewFactory
local SceneViewFactory = CLASS: SceneViewFactory ()
function SceneViewFactory:__init ()
self.priority = 0
end
function SceneViewFactory:createSceneView ( scene, env )
local view = SceneView ( env )
return view
end
--------------------------------------------------------------------
local SceneViewFactories = {}
function registerSceneViewFactory ( key, factory, priority )
SceneViewFactories[ key ] = factory
end
function createSceneView ( scene, env )
local factoryList = {}
for k, f in pairs ( SceneViewFactories ) do
table.insert ( factoryList, f )
end
table.sort ( factoryList, prioritySortFunc )
for i, factory in pairs ( factoryList ) do
local view = factory:createSceneView ( scene, env )
if view then
view:setName ( 'FLAG_EDITOR_SCENE_VIEW')
return view
end
end
--fallback
return SceneView ( env )
end
--------------------------------------------------------------------
---@class CmdFocusSelection : EditorCommandNoHistory
local CmdFocusSelection = CLASS: CmdFocusSelection ( EditorCommandModule.EditorCommandNoHistory )
:register ( 'scene_editor/focus_selection' )
function CmdFocusSelection:init ( option )
local view = getCurrentSceneView ()
if view then
view:focusSelection ()
end
end
SceneViewModule.SceneViewDrag = SceneViewDrag
SceneViewModule.SceneViewDragFactory = SceneViewDragFactory
SceneViewModule.SceneView = SceneView
SceneViewModule.SceneViewFactory = SceneViewFactory
SceneViewModule.registerSceneViewFactory = registerSceneViewFactory
SceneViewModule.createSceneView = createSceneView
SceneViewModule.CmdFocusSelection = CmdFocusSelection
return SceneViewModule |
if Query == nil then
Query = class({})
end
function Query:findItemByName(unit, itemName)
if unit ~= nil and unit:HasInventory() then
for i=DOTA_ITEM_SLOT_1, DOTA_STASH_SLOT_6 do
local item = unit:GetItemInSlot(i);
if item:GetName() == itemName then
return item
end
end
end
return nil
end
|
local OVALE, Ovale = ...
local OvaleScripts = Ovale.OvaleScripts
do
local name = "icyveins_druid_guardian"
local desc = "[7.1.5] Icy-Veins: Druid Guardian"
local code = [[
Include(ovale_common)
Include(ovale_trinkets_mop)
Include(ovale_trinkets_wod)
Include(ovale_druid_spells)
AddCheckBox(opt_interrupt L(interrupt) default specialization=guardian)
AddCheckBox(opt_melee_range L(not_in_melee_range) specialization=guardian)
AddCheckBox(opt_legendary_ring_tank ItemName(legendary_ring_bonus_armor) default specialization=guardian)
AddCheckBox(opt_druid_guardian_aoe L(AOE) default specialization=guardian)
AddFunction GuardianHealMe
{
if IncomingDamage(5) / MaxHealth() >= 0.5 Spell(frenzied_regeneration)
if ((IncomingDamage(5) / MaxHealth() / 2 <= HealthMissing() / MaxHealth()) and (IncomingDamage(5) / MaxHealth() / 2 > 0.1) and SpellCharges(frenzied_regeneration) >= 2) Spell(frenzied_regeneration)
if HealthPercent() <= 50 Spell(lunar_beam)
if HealthPercent() <= 50 and IncomingDamage(5 physical=1) == 0 Spell(regrowth)
if HealthPercent() <= 80 and not InCombat() Spell(regrowth)
}
AddFunction GuardianGetInMeleeRange
{
if CheckBoxOn(opt_melee_range) and Stance(druid_bear_form) and not target.InRange(mangle) or { Stance(druid_cat_form) or Stance(druid_claws_of_shirvallah) } and not target.InRange(shred)
{
if target.InRange(wild_charge) Spell(wild_charge)
Texture(misc_arrowlup help=L(not_in_melee_range))
}
}
AddFunction GuardianDefaultShortCDActions
{
GuardianHealMe()
if InCombat() and BuffExpires(bristling_fur_buff)
{
if IncomingDamage(3 physical=1) Spell(ironfur)
}
if BuffExpires(survival_instincts_buff) and BuffExpires(rage_of_the_sleeper_buff) and BuffExpires(barkskin_buff) Spell(bristling_fur)
# range check
GuardianGetInMeleeRange()
}
#
# Single-Target
#
AddFunction GuardianDefaultMainActions
{
if not Stance(druid_bear_form) Spell(bear_form)
if not BuffExpires(galactic_guardian_buff) Spell(moonfire)
Spell(mangle)
Spell(thrash_bear)
if target.DebuffStacks(thrash_bear_debuff) >= 3 Spell(pulverize)
if target.DebuffRefreshable(moonfire_debuff) Spell(moonfire)
if RageDeficit() <= 20 Spell(maul)
Spell(swipe_bear)
}
#
# AOE
#
AddFunction GuardianDefaultAoEActions
{
if not Stance(druid_bear_form) Spell(bear_form)
if Enemies() >= 4 and HealthPercent() <= 80 Spell(lunar_beam)
if not BuffExpires(galactic_guardian_buff) Spell(moonfire)
Spell(thrash_bear)
Spell(mangle)
if target.DebuffStacks(thrash_bear_debuff) >= 2 Spell(pulverize)
if Enemies() <= 3 and target.DebuffRefreshable(moonfire_debuff) Spell(moonfire)
if RageDeficit() <= 20 Spell(maul)
Spell(swipe_bear)
}
AddFunction GuardianDefaultCdActions
{
GuardianInterruptActions()
Spell(incarnation_guardian_of_ursoc)
if HasArtifactTrait(embrace_of_the_nightmare) Spell(rage_of_the_sleeper)
if CheckBoxOn(opt_legendary_ring_tank) Item(legendary_ring_bonus_armor usable=1)
Item(Trinket0Slot usable=1 text=13)
Item(Trinket1Slot usable=1 text=14)
if BuffExpires(bristling_fur_buff) and BuffExpires(survival_instincts_buff) and BuffExpires(rage_of_the_sleeper_buff) and BuffExpires(barkskin_buff) and BuffExpires(potion_buff)
{
Spell(barkskin)
Spell(rage_of_the_sleeper)
Spell(survival_instincts)
Item(unbending_potion usable=1)
}
}
AddFunction GuardianInterruptActions
{
if CheckBoxOn(opt_interrupt) and not target.IsFriend() and target.Casting()
{
if target.InRange(skull_bash) and target.IsInterruptible() Spell(skull_bash)
if not target.Classification(worldboss)
{
Spell(mighty_bash)
if target.Distance(less 10) Spell(incapacitating_roar)
if target.Distance(less 8) Spell(war_stomp)
if target.Distance(less 15) Spell(typhoon)
}
}
}
AddIcon help=shortcd specialization=guardian
{
GuardianDefaultShortCDActions()
}
AddIcon enemies=1 help=main specialization=guardian
{
GuardianDefaultMainActions()
}
AddIcon checkbox=opt_druid_guardian_aoe help=aoe specialization=guardian
{
GuardianDefaultAoEActions()
}
AddIcon help=cd specialization=guardian
{
GuardianDefaultCdActions()
}
]]
OvaleScripts:RegisterScript("DRUID", "guardian", name, desc, code, "script")
end
-- THE REST OF THIS FILE IS AUTOMATICALLY GENERATED.
-- ANY CHANGES MADE BELOW THIS POINT WILL BE LOST.
do
local name = "simulationcraft_druid_balance_t19p"
local desc = "[7.0] SimulationCraft: Druid_Balance_T19P"
local code = [[
# Based on SimulationCraft profile "Druid_Balance_T19P".
# class=druid
# spec=balance
# talents=3200233
Include(ovale_common)
Include(ovale_trinkets_mop)
Include(ovale_trinkets_wod)
Include(ovale_druid_spells)
AddCheckBox(opt_interrupt L(interrupt) default specialization=balance)
AddCheckBox(opt_use_consumables L(opt_use_consumables) default specialization=balance)
AddFunction BalanceInterruptActions
{
if CheckBoxOn(opt_interrupt) and not target.IsFriend() and target.Casting()
{
if target.InRange(solar_beam) and target.IsInterruptible() Spell(solar_beam)
if target.InRange(mighty_bash) and not target.Classification(worldboss) Spell(mighty_bash)
if target.Distance(less 5) and not target.Classification(worldboss) Spell(war_stomp)
if target.Distance(less 15) and not target.Classification(worldboss) Spell(typhoon)
}
}
### actions.default
AddFunction BalanceDefaultMainActions
{
#blessing_of_elune,if=active_enemies<=2&talent.blessing_of_the_ancients.enabled&buff.blessing_of_elune.down
if Enemies() <= 2 and Talent(blessing_of_the_ancients_talent) and BuffExpires(blessing_of_elune_buff) Spell(blessing_of_elune)
#blessing_of_elune,if=active_enemies>=3&talent.blessing_of_the_ancients.enabled&buff.blessing_of_anshe.down
if Enemies() >= 3 and Talent(blessing_of_the_ancients_talent) and BuffExpires(blessing_of_anshe_buff) Spell(blessing_of_elune)
#call_action_list,name=fury_of_elune,if=talent.fury_of_elune.enabled&cooldown.fury_of_elue.remains<target.time_to_die
if Talent(fury_of_elune_talent) and SpellCooldown(fury_of_elune) < target.TimeToDie() BalanceFuryOfEluneMainActions()
unless Talent(fury_of_elune_talent) and SpellCooldown(fury_of_elune) < target.TimeToDie() and BalanceFuryOfEluneMainPostConditions()
{
#call_action_list,name=ed,if=equipped.the_emerald_dreamcatcher&active_enemies<=2
if HasEquippedItem(the_emerald_dreamcatcher) and Enemies() <= 2 BalanceEdMainActions()
unless HasEquippedItem(the_emerald_dreamcatcher) and Enemies() <= 2 and BalanceEdMainPostConditions()
{
#new_moon,if=(charges=2&recharge_time<5)|charges=3
if { Charges(new_moon) == 2 and SpellChargeCooldown(new_moon) < 5 or Charges(new_moon) == 3 } and not SpellKnown(half_moon) and not SpellKnown(full_moon) Spell(new_moon)
#half_moon,if=(charges=2&recharge_time<5)|charges=3|(target.time_to_die<15&charges=2)
if { Charges(half_moon) == 2 and SpellChargeCooldown(half_moon) < 5 or Charges(half_moon) == 3 or target.TimeToDie() < 15 and Charges(half_moon) == 2 } and SpellKnown(half_moon) Spell(half_moon)
#full_moon,if=(charges=2&recharge_time<5)|charges=3|target.time_to_die<15
if { Charges(full_moon) == 2 and SpellChargeCooldown(full_moon) < 5 or Charges(full_moon) == 3 or target.TimeToDie() < 15 } and SpellKnown(full_moon) Spell(full_moon)
#stellar_flare,cycle_targets=1,max_cycle_targets=4,if=active_enemies<4&remains<7.2&astral_power>=15
if DebuffCountOnAny(stellar_flare_debuff) < Enemies() and DebuffCountOnAny(stellar_flare_debuff) <= 4 and Enemies() < 4 and target.DebuffRemaining(stellar_flare_debuff) < 7.2 and AstralPower() >= 15 Spell(stellar_flare)
#moonfire,cycle_targets=1,if=(talent.natures_balance.enabled&remains<3)|(remains<6.6&!talent.natures_balance.enabled)
if Talent(natures_balance_talent) and target.DebuffRemaining(moonfire_debuff) < 3 or target.DebuffRemaining(moonfire_debuff) < 6.6 and not Talent(natures_balance_talent) Spell(moonfire)
#sunfire,if=(talent.natures_balance.enabled&remains<3)|(remains<5.4&!talent.natures_balance.enabled)
if Talent(natures_balance_talent) and target.DebuffRemaining(sunfire_debuff) < 3 or target.DebuffRemaining(sunfire_debuff) < 5.4 and not Talent(natures_balance_talent) Spell(sunfire)
#starfall,if=buff.oneths_overconfidence.up
if BuffPresent(oneths_overconfidence_buff) Spell(starfall)
#solar_wrath,if=buff.solar_empowerment.stack=3
if BuffStacks(solar_empowerment_buff) == 3 Spell(solar_wrath)
#lunar_strike,if=buff.lunar_empowerment.stack=3
if BuffStacks(lunar_empowerment_buff) == 3 Spell(lunar_strike_balance)
#call_action_list,name=celestial_alignment_phase,if=buff.celestial_alignment.up|buff.incarnation.up
if BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) BalanceCelestialAlignmentPhaseMainActions()
unless { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and BalanceCelestialAlignmentPhaseMainPostConditions()
{
#call_action_list,name=single_target
BalanceSingleTargetMainActions()
}
}
}
}
AddFunction BalanceDefaultMainPostConditions
{
Talent(fury_of_elune_talent) and SpellCooldown(fury_of_elune) < target.TimeToDie() and BalanceFuryOfEluneMainPostConditions() or HasEquippedItem(the_emerald_dreamcatcher) and Enemies() <= 2 and BalanceEdMainPostConditions() or { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and BalanceCelestialAlignmentPhaseMainPostConditions() or BalanceSingleTargetMainPostConditions()
}
AddFunction BalanceDefaultShortCdActions
{
unless Enemies() <= 2 and Talent(blessing_of_the_ancients_talent) and BuffExpires(blessing_of_elune_buff) and Spell(blessing_of_elune) or Enemies() >= 3 and Talent(blessing_of_the_ancients_talent) and BuffExpires(blessing_of_anshe_buff) and Spell(blessing_of_elune)
{
#call_action_list,name=fury_of_elune,if=talent.fury_of_elune.enabled&cooldown.fury_of_elue.remains<target.time_to_die
if Talent(fury_of_elune_talent) and SpellCooldown(fury_of_elune) < target.TimeToDie() BalanceFuryOfEluneShortCdActions()
unless Talent(fury_of_elune_talent) and SpellCooldown(fury_of_elune) < target.TimeToDie() and BalanceFuryOfEluneShortCdPostConditions()
{
#call_action_list,name=ed,if=equipped.the_emerald_dreamcatcher&active_enemies<=2
if HasEquippedItem(the_emerald_dreamcatcher) and Enemies() <= 2 BalanceEdShortCdActions()
unless HasEquippedItem(the_emerald_dreamcatcher) and Enemies() <= 2 and BalanceEdShortCdPostConditions() or { Charges(new_moon) == 2 and SpellChargeCooldown(new_moon) < 5 or Charges(new_moon) == 3 } and not SpellKnown(half_moon) and not SpellKnown(full_moon) and Spell(new_moon) or { Charges(half_moon) == 2 and SpellChargeCooldown(half_moon) < 5 or Charges(half_moon) == 3 or target.TimeToDie() < 15 and Charges(half_moon) == 2 } and SpellKnown(half_moon) and Spell(half_moon) or { Charges(full_moon) == 2 and SpellChargeCooldown(full_moon) < 5 or Charges(full_moon) == 3 or target.TimeToDie() < 15 } and SpellKnown(full_moon) and Spell(full_moon) or DebuffCountOnAny(stellar_flare_debuff) < Enemies() and DebuffCountOnAny(stellar_flare_debuff) <= 4 and Enemies() < 4 and target.DebuffRemaining(stellar_flare_debuff) < 7.2 and AstralPower() >= 15 and Spell(stellar_flare) or { Talent(natures_balance_talent) and target.DebuffRemaining(moonfire_debuff) < 3 or target.DebuffRemaining(moonfire_debuff) < 6.6 and not Talent(natures_balance_talent) } and Spell(moonfire) or { Talent(natures_balance_talent) and target.DebuffRemaining(sunfire_debuff) < 3 or target.DebuffRemaining(sunfire_debuff) < 5.4 and not Talent(natures_balance_talent) } and Spell(sunfire)
{
#astral_communion,if=astral_power.deficit>=75
if AstralPowerDeficit() >= 75 Spell(astral_communion)
unless BuffPresent(oneths_overconfidence_buff) and Spell(starfall) or BuffStacks(solar_empowerment_buff) == 3 and Spell(solar_wrath) or BuffStacks(lunar_empowerment_buff) == 3 and Spell(lunar_strike_balance)
{
#call_action_list,name=celestial_alignment_phase,if=buff.celestial_alignment.up|buff.incarnation.up
if BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) BalanceCelestialAlignmentPhaseShortCdActions()
unless { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and BalanceCelestialAlignmentPhaseShortCdPostConditions()
{
#call_action_list,name=single_target
BalanceSingleTargetShortCdActions()
}
}
}
}
}
}
AddFunction BalanceDefaultShortCdPostConditions
{
Enemies() <= 2 and Talent(blessing_of_the_ancients_talent) and BuffExpires(blessing_of_elune_buff) and Spell(blessing_of_elune) or Enemies() >= 3 and Talent(blessing_of_the_ancients_talent) and BuffExpires(blessing_of_anshe_buff) and Spell(blessing_of_elune) or Talent(fury_of_elune_talent) and SpellCooldown(fury_of_elune) < target.TimeToDie() and BalanceFuryOfEluneShortCdPostConditions() or HasEquippedItem(the_emerald_dreamcatcher) and Enemies() <= 2 and BalanceEdShortCdPostConditions() or { Charges(new_moon) == 2 and SpellChargeCooldown(new_moon) < 5 or Charges(new_moon) == 3 } and not SpellKnown(half_moon) and not SpellKnown(full_moon) and Spell(new_moon) or { Charges(half_moon) == 2 and SpellChargeCooldown(half_moon) < 5 or Charges(half_moon) == 3 or target.TimeToDie() < 15 and Charges(half_moon) == 2 } and SpellKnown(half_moon) and Spell(half_moon) or { Charges(full_moon) == 2 and SpellChargeCooldown(full_moon) < 5 or Charges(full_moon) == 3 or target.TimeToDie() < 15 } and SpellKnown(full_moon) and Spell(full_moon) or DebuffCountOnAny(stellar_flare_debuff) < Enemies() and DebuffCountOnAny(stellar_flare_debuff) <= 4 and Enemies() < 4 and target.DebuffRemaining(stellar_flare_debuff) < 7.2 and AstralPower() >= 15 and Spell(stellar_flare) or { Talent(natures_balance_talent) and target.DebuffRemaining(moonfire_debuff) < 3 or target.DebuffRemaining(moonfire_debuff) < 6.6 and not Talent(natures_balance_talent) } and Spell(moonfire) or { Talent(natures_balance_talent) and target.DebuffRemaining(sunfire_debuff) < 3 or target.DebuffRemaining(sunfire_debuff) < 5.4 and not Talent(natures_balance_talent) } and Spell(sunfire) or BuffPresent(oneths_overconfidence_buff) and Spell(starfall) or BuffStacks(solar_empowerment_buff) == 3 and Spell(solar_wrath) or BuffStacks(lunar_empowerment_buff) == 3 and Spell(lunar_strike_balance) or { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and BalanceCelestialAlignmentPhaseShortCdPostConditions() or BalanceSingleTargetShortCdPostConditions()
}
AddFunction BalanceDefaultCdActions
{
#potion,name=deadly_grace,if=buff.celestial_alignment.up|buff.incarnation.up
if { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and CheckBoxOn(opt_use_consumables) and target.Classification(worldboss) Item(deadly_grace_potion usable=1)
#solar_beam
BalanceInterruptActions()
unless Enemies() <= 2 and Talent(blessing_of_the_ancients_talent) and BuffExpires(blessing_of_elune_buff) and Spell(blessing_of_elune) or Enemies() >= 3 and Talent(blessing_of_the_ancients_talent) and BuffExpires(blessing_of_anshe_buff) and Spell(blessing_of_elune)
{
#blood_fury,if=buff.celestial_alignment.up|buff.incarnation.up
if BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) Spell(blood_fury_apsp)
#berserking,if=buff.celestial_alignment.up|buff.incarnation.up
if BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) Spell(berserking)
#arcane_torrent,if=buff.celestial_alignment.up|buff.incarnation.up
if BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) Spell(arcane_torrent_energy)
#call_action_list,name=fury_of_elune,if=talent.fury_of_elune.enabled&cooldown.fury_of_elue.remains<target.time_to_die
if Talent(fury_of_elune_talent) and SpellCooldown(fury_of_elune) < target.TimeToDie() BalanceFuryOfEluneCdActions()
unless Talent(fury_of_elune_talent) and SpellCooldown(fury_of_elune) < target.TimeToDie() and BalanceFuryOfEluneCdPostConditions()
{
#call_action_list,name=ed,if=equipped.the_emerald_dreamcatcher&active_enemies<=2
if HasEquippedItem(the_emerald_dreamcatcher) and Enemies() <= 2 BalanceEdCdActions()
unless HasEquippedItem(the_emerald_dreamcatcher) and Enemies() <= 2 and BalanceEdCdPostConditions() or { Charges(new_moon) == 2 and SpellChargeCooldown(new_moon) < 5 or Charges(new_moon) == 3 } and not SpellKnown(half_moon) and not SpellKnown(full_moon) and Spell(new_moon) or { Charges(half_moon) == 2 and SpellChargeCooldown(half_moon) < 5 or Charges(half_moon) == 3 or target.TimeToDie() < 15 and Charges(half_moon) == 2 } and SpellKnown(half_moon) and Spell(half_moon) or { Charges(full_moon) == 2 and SpellChargeCooldown(full_moon) < 5 or Charges(full_moon) == 3 or target.TimeToDie() < 15 } and SpellKnown(full_moon) and Spell(full_moon) or DebuffCountOnAny(stellar_flare_debuff) < Enemies() and DebuffCountOnAny(stellar_flare_debuff) <= 4 and Enemies() < 4 and target.DebuffRemaining(stellar_flare_debuff) < 7.2 and AstralPower() >= 15 and Spell(stellar_flare) or { Talent(natures_balance_talent) and target.DebuffRemaining(moonfire_debuff) < 3 or target.DebuffRemaining(moonfire_debuff) < 6.6 and not Talent(natures_balance_talent) } and Spell(moonfire) or { Talent(natures_balance_talent) and target.DebuffRemaining(sunfire_debuff) < 3 or target.DebuffRemaining(sunfire_debuff) < 5.4 and not Talent(natures_balance_talent) } and Spell(sunfire) or AstralPowerDeficit() >= 75 and Spell(astral_communion)
{
#incarnation,if=astral_power>=40
if AstralPower() >= 40 Spell(incarnation_chosen_of_elune)
#celestial_alignment,if=astral_power>=40
if AstralPower() >= 40 Spell(celestial_alignment)
unless BuffPresent(oneths_overconfidence_buff) and Spell(starfall) or BuffStacks(solar_empowerment_buff) == 3 and Spell(solar_wrath) or BuffStacks(lunar_empowerment_buff) == 3 and Spell(lunar_strike_balance)
{
#call_action_list,name=celestial_alignment_phase,if=buff.celestial_alignment.up|buff.incarnation.up
if BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) BalanceCelestialAlignmentPhaseCdActions()
unless { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and BalanceCelestialAlignmentPhaseCdPostConditions()
{
#call_action_list,name=single_target
BalanceSingleTargetCdActions()
}
}
}
}
}
}
AddFunction BalanceDefaultCdPostConditions
{
Enemies() <= 2 and Talent(blessing_of_the_ancients_talent) and BuffExpires(blessing_of_elune_buff) and Spell(blessing_of_elune) or Enemies() >= 3 and Talent(blessing_of_the_ancients_talent) and BuffExpires(blessing_of_anshe_buff) and Spell(blessing_of_elune) or Talent(fury_of_elune_talent) and SpellCooldown(fury_of_elune) < target.TimeToDie() and BalanceFuryOfEluneCdPostConditions() or HasEquippedItem(the_emerald_dreamcatcher) and Enemies() <= 2 and BalanceEdCdPostConditions() or { Charges(new_moon) == 2 and SpellChargeCooldown(new_moon) < 5 or Charges(new_moon) == 3 } and not SpellKnown(half_moon) and not SpellKnown(full_moon) and Spell(new_moon) or { Charges(half_moon) == 2 and SpellChargeCooldown(half_moon) < 5 or Charges(half_moon) == 3 or target.TimeToDie() < 15 and Charges(half_moon) == 2 } and SpellKnown(half_moon) and Spell(half_moon) or { Charges(full_moon) == 2 and SpellChargeCooldown(full_moon) < 5 or Charges(full_moon) == 3 or target.TimeToDie() < 15 } and SpellKnown(full_moon) and Spell(full_moon) or DebuffCountOnAny(stellar_flare_debuff) < Enemies() and DebuffCountOnAny(stellar_flare_debuff) <= 4 and Enemies() < 4 and target.DebuffRemaining(stellar_flare_debuff) < 7.2 and AstralPower() >= 15 and Spell(stellar_flare) or { Talent(natures_balance_talent) and target.DebuffRemaining(moonfire_debuff) < 3 or target.DebuffRemaining(moonfire_debuff) < 6.6 and not Talent(natures_balance_talent) } and Spell(moonfire) or { Talent(natures_balance_talent) and target.DebuffRemaining(sunfire_debuff) < 3 or target.DebuffRemaining(sunfire_debuff) < 5.4 and not Talent(natures_balance_talent) } and Spell(sunfire) or AstralPowerDeficit() >= 75 and Spell(astral_communion) or BuffPresent(oneths_overconfidence_buff) and Spell(starfall) or BuffStacks(solar_empowerment_buff) == 3 and Spell(solar_wrath) or BuffStacks(lunar_empowerment_buff) == 3 and Spell(lunar_strike_balance) or { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and BalanceCelestialAlignmentPhaseCdPostConditions() or BalanceSingleTargetCdPostConditions()
}
### actions.celestial_alignment_phase
AddFunction BalanceCelestialAlignmentPhaseMainActions
{
#starfall,if=((active_enemies>=2&talent.stellar_drift.enabled)|active_enemies>=3)
if Enemies() >= 2 and Talent(stellar_drift_talent) or Enemies() >= 3 Spell(starfall)
#starsurge,if=active_enemies<=2
if Enemies() <= 2 Spell(starsurge_moonkin)
#lunar_strike,if=buff.warrior_of_elune.up
if BuffPresent(warrior_of_elune_buff) Spell(lunar_strike_balance)
#solar_wrath,if=buff.solar_empowerment.up
if BuffPresent(solar_empowerment_buff) Spell(solar_wrath)
#lunar_strike,if=buff.lunar_empowerment.up
if BuffPresent(lunar_empowerment_buff) Spell(lunar_strike_balance)
#solar_wrath,if=talent.natures_balance.enabled&dot.sunfire_dmg.remains<5&cast_time<dot.sunfire_dmg.remains
if Talent(natures_balance_talent) and target.DebuffRemaining(sunfire_dmg_debuff) < 5 and CastTime(solar_wrath) < target.DebuffRemaining(sunfire_dmg_debuff) Spell(solar_wrath)
#lunar_strike,if=(talent.natures_balance.enabled&dot.moonfire_dmg.remains<5&cast_time<dot.moonfire_dmg.remains)|active_enemies>=2
if Talent(natures_balance_talent) and target.DebuffRemaining(moonfire_dmg_debuff) < 5 and CastTime(lunar_strike_balance) < target.DebuffRemaining(moonfire_dmg_debuff) or Enemies() >= 2 Spell(lunar_strike_balance)
#solar_wrath
Spell(solar_wrath)
}
AddFunction BalanceCelestialAlignmentPhaseMainPostConditions
{
}
AddFunction BalanceCelestialAlignmentPhaseShortCdActions
{
unless { Enemies() >= 2 and Talent(stellar_drift_talent) or Enemies() >= 3 } and Spell(starfall) or Enemies() <= 2 and Spell(starsurge_moonkin)
{
#warrior_of_elune
Spell(warrior_of_elune)
}
}
AddFunction BalanceCelestialAlignmentPhaseShortCdPostConditions
{
{ Enemies() >= 2 and Talent(stellar_drift_talent) or Enemies() >= 3 } and Spell(starfall) or Enemies() <= 2 and Spell(starsurge_moonkin) or BuffPresent(warrior_of_elune_buff) and Spell(lunar_strike_balance) or BuffPresent(solar_empowerment_buff) and Spell(solar_wrath) or BuffPresent(lunar_empowerment_buff) and Spell(lunar_strike_balance) or Talent(natures_balance_talent) and target.DebuffRemaining(sunfire_dmg_debuff) < 5 and CastTime(solar_wrath) < target.DebuffRemaining(sunfire_dmg_debuff) and Spell(solar_wrath) or { Talent(natures_balance_talent) and target.DebuffRemaining(moonfire_dmg_debuff) < 5 and CastTime(lunar_strike_balance) < target.DebuffRemaining(moonfire_dmg_debuff) or Enemies() >= 2 } and Spell(lunar_strike_balance) or Spell(solar_wrath)
}
AddFunction BalanceCelestialAlignmentPhaseCdActions
{
}
AddFunction BalanceCelestialAlignmentPhaseCdPostConditions
{
{ Enemies() >= 2 and Talent(stellar_drift_talent) or Enemies() >= 3 } and Spell(starfall) or Enemies() <= 2 and Spell(starsurge_moonkin) or BuffPresent(warrior_of_elune_buff) and Spell(lunar_strike_balance) or BuffPresent(solar_empowerment_buff) and Spell(solar_wrath) or BuffPresent(lunar_empowerment_buff) and Spell(lunar_strike_balance) or Talent(natures_balance_talent) and target.DebuffRemaining(sunfire_dmg_debuff) < 5 and CastTime(solar_wrath) < target.DebuffRemaining(sunfire_dmg_debuff) and Spell(solar_wrath) or { Talent(natures_balance_talent) and target.DebuffRemaining(moonfire_dmg_debuff) < 5 and CastTime(lunar_strike_balance) < target.DebuffRemaining(moonfire_dmg_debuff) or Enemies() >= 2 } and Spell(lunar_strike_balance) or Spell(solar_wrath)
}
### actions.ed
AddFunction BalanceEdMainActions
{
#starsurge,if=(buff.celestial_alignment.up&buff.celestial_alignment.remains<(10))|(buff.incarnation.up&buff.incarnation.remains<(3*execute_time)&astral_power>78)|(buff.incarnation.up&buff.incarnation.remains<(2*execute_time)&astral_power>52)|(buff.incarnation.up&buff.incarnation.remains<execute_time&astral_power>26)
if BuffPresent(celestial_alignment_buff) and BuffRemaining(celestial_alignment_buff) < 10 or BuffPresent(incarnation_chosen_of_elune_buff) and BuffRemaining(incarnation_chosen_of_elune_buff) < 3 * ExecuteTime(starsurge_moonkin) and AstralPower() > 78 or BuffPresent(incarnation_chosen_of_elune_buff) and BuffRemaining(incarnation_chosen_of_elune_buff) < 2 * ExecuteTime(starsurge_moonkin) and AstralPower() > 52 or BuffPresent(incarnation_chosen_of_elune_buff) and BuffRemaining(incarnation_chosen_of_elune_buff) < ExecuteTime(starsurge_moonkin) and AstralPower() > 26 Spell(starsurge_moonkin)
#stellar_flare,cycle_targets=1,max_cycle_targets=4,if=active_enemies<4&remains<7.2&astral_power>=15
if DebuffCountOnAny(stellar_flare_debuff) < Enemies() and DebuffCountOnAny(stellar_flare_debuff) <= 4 and Enemies() < 4 and target.DebuffRemaining(stellar_flare_debuff) < 7.2 and AstralPower() >= 15 Spell(stellar_flare)
#moonfire,if=((talent.natures_balance.enabled&remains<3)|(remains<6.6&!talent.natures_balance.enabled))&(buff.the_emerald_dreamcatcher.remains>gcd.max|!buff.the_emerald_dreamcatcher.up)
if { Talent(natures_balance_talent) and target.DebuffRemaining(moonfire_debuff) < 3 or target.DebuffRemaining(moonfire_debuff) < 6.6 and not Talent(natures_balance_talent) } and { BuffRemaining(the_emerald_dreamcatcher_buff) > GCD() or not BuffPresent(the_emerald_dreamcatcher_buff) } Spell(moonfire)
#sunfire,if=((talent.natures_balance.enabled&remains<3)|(remains<5.4&!talent.natures_balance.enabled))&(buff.the_emerald_dreamcatcher.remains>gcd.max|!buff.the_emerald_dreamcatcher.up)
if { Talent(natures_balance_talent) and target.DebuffRemaining(sunfire_debuff) < 3 or target.DebuffRemaining(sunfire_debuff) < 5.4 and not Talent(natures_balance_talent) } and { BuffRemaining(the_emerald_dreamcatcher_buff) > GCD() or not BuffPresent(the_emerald_dreamcatcher_buff) } Spell(sunfire)
#starfall,if=buff.oneths_overconfidence.up&buff.the_emerald_dreamcatcher.remains>execute_time&remains<2
if BuffPresent(oneths_overconfidence_buff) and BuffRemaining(the_emerald_dreamcatcher_buff) > ExecuteTime(starfall) and BuffRemaining(starfall_buff) < 2 Spell(starfall)
#half_moon,if=astral_power<=80&buff.the_emerald_dreamcatcher.remains>execute_time&astral_power>=6
if AstralPower() <= 80 and BuffRemaining(the_emerald_dreamcatcher_buff) > ExecuteTime(half_moon) and AstralPower() >= 6 and SpellKnown(half_moon) Spell(half_moon)
#full_moon,if=astral_power<=60&buff.the_emerald_dreamcatcher.remains>execute_time
if AstralPower() <= 60 and BuffRemaining(the_emerald_dreamcatcher_buff) > ExecuteTime(full_moon) and SpellKnown(full_moon) Spell(full_moon)
#solar_wrath,if=buff.solar_empowerment.stack>1&buff.the_emerald_dreamcatcher.remains>2*execute_time&astral_power>=6&(dot.moonfire.remains>5|(dot.sunfire.remains<5.4&dot.moonfire.remains>6.6))&(!(buff.celestial_alignment.up|buff.incarnation.up)&astral_power<=90|(buff.celestial_alignment.up|buff.incarnation.up)&astral_power<=85)
if BuffStacks(solar_empowerment_buff) > 1 and BuffRemaining(the_emerald_dreamcatcher_buff) > 2 * ExecuteTime(solar_wrath) and AstralPower() >= 6 and { target.DebuffRemaining(moonfire_debuff) > 5 or target.DebuffRemaining(sunfire_debuff) < 5.4 and target.DebuffRemaining(moonfire_debuff) > 6.6 } and { not { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and AstralPower() <= 90 or { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and AstralPower() <= 85 } Spell(solar_wrath)
#lunar_strike,if=buff.lunar_empowerment.up&buff.the_emerald_dreamcatcher.remains>execute_time&astral_power>=11&(!(buff.celestial_alignment.up|buff.incarnation.up)&astral_power<=85|(buff.celestial_alignment.up|buff.incarnation.up)&astral_power<=77.5)
if BuffPresent(lunar_empowerment_buff) and BuffRemaining(the_emerald_dreamcatcher_buff) > ExecuteTime(lunar_strike_balance) and AstralPower() >= 11 and { not { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and AstralPower() <= 85 or { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and AstralPower() <= 77.5 } Spell(lunar_strike_balance)
#solar_wrath,if=buff.solar_empowerment.up&buff.the_emerald_dreamcatcher.remains>execute_time&astral_power>=16&(!(buff.celestial_alignment.up|buff.incarnation.up)&astral_power<=90|(buff.celestial_alignment.up|buff.incarnation.up)&astral_power<=85)
if BuffPresent(solar_empowerment_buff) and BuffRemaining(the_emerald_dreamcatcher_buff) > ExecuteTime(solar_wrath) and AstralPower() >= 16 and { not { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and AstralPower() <= 90 or { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and AstralPower() <= 85 } Spell(solar_wrath)
#starsurge,if=(buff.the_emerald_dreamcatcher.up&buff.the_emerald_dreamcatcher.remains<gcd.max)|astral_power>90|((buff.celestial_alignment.up|buff.incarnation.up)&astral_power>=85)|(buff.the_emerald_dreamcatcher.up&astral_power>=77.5&(buff.celestial_alignment.up|buff.incarnation.up))
if BuffPresent(the_emerald_dreamcatcher_buff) and BuffRemaining(the_emerald_dreamcatcher_buff) < GCD() or AstralPower() > 90 or { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and AstralPower() >= 85 or BuffPresent(the_emerald_dreamcatcher_buff) and AstralPower() >= 77.5 and { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } Spell(starsurge_moonkin)
#starfall,if=buff.oneths_overconfidence.up&remains<2
if BuffPresent(oneths_overconfidence_buff) and BuffRemaining(starfall_buff) < 2 Spell(starfall)
#new_moon,if=astral_power<=90
if AstralPower() <= 90 and not SpellKnown(half_moon) and not SpellKnown(full_moon) Spell(new_moon)
#half_moon,if=astral_power<=80
if AstralPower() <= 80 and SpellKnown(half_moon) Spell(half_moon)
#full_moon,if=astral_power<=60&((cooldown.incarnation.remains>65&cooldown.full_moon.charges>0)|(cooldown.incarnation.remains>50&cooldown.full_moon.charges>1)|(cooldown.incarnation.remains>25&cooldown.full_moon.charges>2))
if AstralPower() <= 60 and { SpellCooldown(incarnation_chosen_of_elune) > 65 and SpellCharges(full_moon) > 0 or SpellCooldown(incarnation_chosen_of_elune) > 50 and SpellCharges(full_moon) > 1 or SpellCooldown(incarnation_chosen_of_elune) > 25 and SpellCharges(full_moon) > 2 } and SpellKnown(full_moon) Spell(full_moon)
#solar_wrath,if=buff.solar_empowerment.up
if BuffPresent(solar_empowerment_buff) Spell(solar_wrath)
#lunar_strike,if=buff.lunar_empowerment.up
if BuffPresent(lunar_empowerment_buff) Spell(lunar_strike_balance)
#solar_wrath
Spell(solar_wrath)
}
AddFunction BalanceEdMainPostConditions
{
}
AddFunction BalanceEdShortCdActions
{
#astral_communion,if=astral_power.deficit>=75&buff.the_emerald_dreamcatcher.up
if AstralPowerDeficit() >= 75 and BuffPresent(the_emerald_dreamcatcher_buff) Spell(astral_communion)
}
AddFunction BalanceEdShortCdPostConditions
{
{ BuffPresent(celestial_alignment_buff) and BuffRemaining(celestial_alignment_buff) < 10 or BuffPresent(incarnation_chosen_of_elune_buff) and BuffRemaining(incarnation_chosen_of_elune_buff) < 3 * ExecuteTime(starsurge_moonkin) and AstralPower() > 78 or BuffPresent(incarnation_chosen_of_elune_buff) and BuffRemaining(incarnation_chosen_of_elune_buff) < 2 * ExecuteTime(starsurge_moonkin) and AstralPower() > 52 or BuffPresent(incarnation_chosen_of_elune_buff) and BuffRemaining(incarnation_chosen_of_elune_buff) < ExecuteTime(starsurge_moonkin) and AstralPower() > 26 } and Spell(starsurge_moonkin) or DebuffCountOnAny(stellar_flare_debuff) < Enemies() and DebuffCountOnAny(stellar_flare_debuff) <= 4 and Enemies() < 4 and target.DebuffRemaining(stellar_flare_debuff) < 7.2 and AstralPower() >= 15 and Spell(stellar_flare) or { Talent(natures_balance_talent) and target.DebuffRemaining(moonfire_debuff) < 3 or target.DebuffRemaining(moonfire_debuff) < 6.6 and not Talent(natures_balance_talent) } and { BuffRemaining(the_emerald_dreamcatcher_buff) > GCD() or not BuffPresent(the_emerald_dreamcatcher_buff) } and Spell(moonfire) or { Talent(natures_balance_talent) and target.DebuffRemaining(sunfire_debuff) < 3 or target.DebuffRemaining(sunfire_debuff) < 5.4 and not Talent(natures_balance_talent) } and { BuffRemaining(the_emerald_dreamcatcher_buff) > GCD() or not BuffPresent(the_emerald_dreamcatcher_buff) } and Spell(sunfire) or BuffPresent(oneths_overconfidence_buff) and BuffRemaining(the_emerald_dreamcatcher_buff) > ExecuteTime(starfall) and BuffRemaining(starfall_buff) < 2 and Spell(starfall) or AstralPower() <= 80 and BuffRemaining(the_emerald_dreamcatcher_buff) > ExecuteTime(half_moon) and AstralPower() >= 6 and SpellKnown(half_moon) and Spell(half_moon) or AstralPower() <= 60 and BuffRemaining(the_emerald_dreamcatcher_buff) > ExecuteTime(full_moon) and SpellKnown(full_moon) and Spell(full_moon) or BuffStacks(solar_empowerment_buff) > 1 and BuffRemaining(the_emerald_dreamcatcher_buff) > 2 * ExecuteTime(solar_wrath) and AstralPower() >= 6 and { target.DebuffRemaining(moonfire_debuff) > 5 or target.DebuffRemaining(sunfire_debuff) < 5.4 and target.DebuffRemaining(moonfire_debuff) > 6.6 } and { not { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and AstralPower() <= 90 or { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and AstralPower() <= 85 } and Spell(solar_wrath) or BuffPresent(lunar_empowerment_buff) and BuffRemaining(the_emerald_dreamcatcher_buff) > ExecuteTime(lunar_strike_balance) and AstralPower() >= 11 and { not { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and AstralPower() <= 85 or { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and AstralPower() <= 77.5 } and Spell(lunar_strike_balance) or BuffPresent(solar_empowerment_buff) and BuffRemaining(the_emerald_dreamcatcher_buff) > ExecuteTime(solar_wrath) and AstralPower() >= 16 and { not { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and AstralPower() <= 90 or { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and AstralPower() <= 85 } and Spell(solar_wrath) or { BuffPresent(the_emerald_dreamcatcher_buff) and BuffRemaining(the_emerald_dreamcatcher_buff) < GCD() or AstralPower() > 90 or { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and AstralPower() >= 85 or BuffPresent(the_emerald_dreamcatcher_buff) and AstralPower() >= 77.5 and { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } } and Spell(starsurge_moonkin) or BuffPresent(oneths_overconfidence_buff) and BuffRemaining(starfall_buff) < 2 and Spell(starfall) or AstralPower() <= 90 and not SpellKnown(half_moon) and not SpellKnown(full_moon) and Spell(new_moon) or AstralPower() <= 80 and SpellKnown(half_moon) and Spell(half_moon) or AstralPower() <= 60 and { SpellCooldown(incarnation_chosen_of_elune) > 65 and SpellCharges(full_moon) > 0 or SpellCooldown(incarnation_chosen_of_elune) > 50 and SpellCharges(full_moon) > 1 or SpellCooldown(incarnation_chosen_of_elune) > 25 and SpellCharges(full_moon) > 2 } and SpellKnown(full_moon) and Spell(full_moon) or BuffPresent(solar_empowerment_buff) and Spell(solar_wrath) or BuffPresent(lunar_empowerment_buff) and Spell(lunar_strike_balance) or Spell(solar_wrath)
}
AddFunction BalanceEdCdActions
{
unless AstralPowerDeficit() >= 75 and BuffPresent(the_emerald_dreamcatcher_buff) and Spell(astral_communion)
{
#incarnation,if=astral_power>=85&!buff.the_emerald_dreamcatcher.up|buff.bloodlust.up
if AstralPower() >= 85 and not BuffPresent(the_emerald_dreamcatcher_buff) or BuffPresent(burst_haste_buff any=1) Spell(incarnation_chosen_of_elune)
#celestial_alignment,if=astral_power>=85&!buff.the_emerald_dreamcatcher.up
if AstralPower() >= 85 and not BuffPresent(the_emerald_dreamcatcher_buff) Spell(celestial_alignment)
}
}
AddFunction BalanceEdCdPostConditions
{
AstralPowerDeficit() >= 75 and BuffPresent(the_emerald_dreamcatcher_buff) and Spell(astral_communion) or { BuffPresent(celestial_alignment_buff) and BuffRemaining(celestial_alignment_buff) < 10 or BuffPresent(incarnation_chosen_of_elune_buff) and BuffRemaining(incarnation_chosen_of_elune_buff) < 3 * ExecuteTime(starsurge_moonkin) and AstralPower() > 78 or BuffPresent(incarnation_chosen_of_elune_buff) and BuffRemaining(incarnation_chosen_of_elune_buff) < 2 * ExecuteTime(starsurge_moonkin) and AstralPower() > 52 or BuffPresent(incarnation_chosen_of_elune_buff) and BuffRemaining(incarnation_chosen_of_elune_buff) < ExecuteTime(starsurge_moonkin) and AstralPower() > 26 } and Spell(starsurge_moonkin) or DebuffCountOnAny(stellar_flare_debuff) < Enemies() and DebuffCountOnAny(stellar_flare_debuff) <= 4 and Enemies() < 4 and target.DebuffRemaining(stellar_flare_debuff) < 7.2 and AstralPower() >= 15 and Spell(stellar_flare) or { Talent(natures_balance_talent) and target.DebuffRemaining(moonfire_debuff) < 3 or target.DebuffRemaining(moonfire_debuff) < 6.6 and not Talent(natures_balance_talent) } and { BuffRemaining(the_emerald_dreamcatcher_buff) > GCD() or not BuffPresent(the_emerald_dreamcatcher_buff) } and Spell(moonfire) or { Talent(natures_balance_talent) and target.DebuffRemaining(sunfire_debuff) < 3 or target.DebuffRemaining(sunfire_debuff) < 5.4 and not Talent(natures_balance_talent) } and { BuffRemaining(the_emerald_dreamcatcher_buff) > GCD() or not BuffPresent(the_emerald_dreamcatcher_buff) } and Spell(sunfire) or BuffPresent(oneths_overconfidence_buff) and BuffRemaining(the_emerald_dreamcatcher_buff) > ExecuteTime(starfall) and BuffRemaining(starfall_buff) < 2 and Spell(starfall) or AstralPower() <= 80 and BuffRemaining(the_emerald_dreamcatcher_buff) > ExecuteTime(half_moon) and AstralPower() >= 6 and SpellKnown(half_moon) and Spell(half_moon) or AstralPower() <= 60 and BuffRemaining(the_emerald_dreamcatcher_buff) > ExecuteTime(full_moon) and SpellKnown(full_moon) and Spell(full_moon) or BuffStacks(solar_empowerment_buff) > 1 and BuffRemaining(the_emerald_dreamcatcher_buff) > 2 * ExecuteTime(solar_wrath) and AstralPower() >= 6 and { target.DebuffRemaining(moonfire_debuff) > 5 or target.DebuffRemaining(sunfire_debuff) < 5.4 and target.DebuffRemaining(moonfire_debuff) > 6.6 } and { not { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and AstralPower() <= 90 or { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and AstralPower() <= 85 } and Spell(solar_wrath) or BuffPresent(lunar_empowerment_buff) and BuffRemaining(the_emerald_dreamcatcher_buff) > ExecuteTime(lunar_strike_balance) and AstralPower() >= 11 and { not { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and AstralPower() <= 85 or { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and AstralPower() <= 77.5 } and Spell(lunar_strike_balance) or BuffPresent(solar_empowerment_buff) and BuffRemaining(the_emerald_dreamcatcher_buff) > ExecuteTime(solar_wrath) and AstralPower() >= 16 and { not { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and AstralPower() <= 90 or { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and AstralPower() <= 85 } and Spell(solar_wrath) or { BuffPresent(the_emerald_dreamcatcher_buff) and BuffRemaining(the_emerald_dreamcatcher_buff) < GCD() or AstralPower() > 90 or { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } and AstralPower() >= 85 or BuffPresent(the_emerald_dreamcatcher_buff) and AstralPower() >= 77.5 and { BuffPresent(celestial_alignment_buff) or BuffPresent(incarnation_chosen_of_elune_buff) } } and Spell(starsurge_moonkin) or BuffPresent(oneths_overconfidence_buff) and BuffRemaining(starfall_buff) < 2 and Spell(starfall) or AstralPower() <= 90 and not SpellKnown(half_moon) and not SpellKnown(full_moon) and Spell(new_moon) or AstralPower() <= 80 and SpellKnown(half_moon) and Spell(half_moon) or AstralPower() <= 60 and { SpellCooldown(incarnation_chosen_of_elune) > 65 and SpellCharges(full_moon) > 0 or SpellCooldown(incarnation_chosen_of_elune) > 50 and SpellCharges(full_moon) > 1 or SpellCooldown(incarnation_chosen_of_elune) > 25 and SpellCharges(full_moon) > 2 } and SpellKnown(full_moon) and Spell(full_moon) or BuffPresent(solar_empowerment_buff) and Spell(solar_wrath) or BuffPresent(lunar_empowerment_buff) and Spell(lunar_strike_balance) or Spell(solar_wrath)
}
### actions.fury_of_elune
AddFunction BalanceFuryOfEluneMainActions
{
#new_moon,if=((charges=2&recharge_time<5)|charges=3)&&(buff.fury_of_elune_up.up|(cooldown.fury_of_elune.remains>gcd*3&astral_power<=90))
if { Charges(new_moon) == 2 and SpellChargeCooldown(new_moon) < 5 or Charges(new_moon) == 3 } and { BuffPresent(fury_of_elune_up_buff) or SpellCooldown(fury_of_elune) > GCD() * 3 and AstralPower() <= 90 } and not SpellKnown(half_moon) and not SpellKnown(full_moon) Spell(new_moon)
#half_moon,if=((charges=2&recharge_time<5)|charges=3)&&(buff.fury_of_elune_up.up|(cooldown.fury_of_elune.remains>gcd*3&astral_power<=80))
if { Charges(half_moon) == 2 and SpellChargeCooldown(half_moon) < 5 or Charges(half_moon) == 3 } and { BuffPresent(fury_of_elune_up_buff) or SpellCooldown(fury_of_elune) > GCD() * 3 and AstralPower() <= 80 } and SpellKnown(half_moon) Spell(half_moon)
#full_moon,if=((charges=2&recharge_time<5)|charges=3)&&(buff.fury_of_elune_up.up|(cooldown.fury_of_elune.remains>gcd*3&astral_power<=60))
if { Charges(full_moon) == 2 and SpellChargeCooldown(full_moon) < 5 or Charges(full_moon) == 3 } and { BuffPresent(fury_of_elune_up_buff) or SpellCooldown(fury_of_elune) > GCD() * 3 and AstralPower() <= 60 } and SpellKnown(full_moon) Spell(full_moon)
#lunar_strike,if=buff.warrior_of_elune.up&(astral_power<=90|(astral_power<=85&buff.incarnation.up))
if BuffPresent(warrior_of_elune_buff) and { AstralPower() <= 90 or AstralPower() <= 85 and BuffPresent(incarnation_chosen_of_elune_buff) } Spell(lunar_strike_balance)
#new_moon,if=astral_power<=90&buff.fury_of_elune_up.up
if AstralPower() <= 90 and BuffPresent(fury_of_elune_up_buff) and not SpellKnown(half_moon) and not SpellKnown(full_moon) Spell(new_moon)
#half_moon,if=astral_power<=80&buff.fury_of_elune_up.up&astral_power>cast_time*12
if AstralPower() <= 80 and BuffPresent(fury_of_elune_up_buff) and AstralPower() > CastTime(half_moon) * 12 and SpellKnown(half_moon) Spell(half_moon)
#full_moon,if=astral_power<=60&buff.fury_of_elune_up.up&astral_power>cast_time*12
if AstralPower() <= 60 and BuffPresent(fury_of_elune_up_buff) and AstralPower() > CastTime(full_moon) * 12 and SpellKnown(full_moon) Spell(full_moon)
#moonfire,if=buff.fury_of_elune_up.down&remains<=6.6
if BuffExpires(fury_of_elune_up_buff) and target.DebuffRemaining(moonfire_debuff) <= 6.6 Spell(moonfire)
#sunfire,if=buff.fury_of_elune_up.down&remains<5.4
if BuffExpires(fury_of_elune_up_buff) and target.DebuffRemaining(sunfire_debuff) < 5.4 Spell(sunfire)
#stellar_flare,if=remains<7.2&active_enemies=1
if target.DebuffRemaining(stellar_flare_debuff) < 7.2 and Enemies() == 1 Spell(stellar_flare)
#starfall,if=(active_enemies>=2&talent.stellar_flare.enabled|active_enemies>=3)&buff.fury_of_elune_up.down&cooldown.fury_of_elune.remains>10
if { Enemies() >= 2 and Talent(stellar_flare_talent) or Enemies() >= 3 } and BuffExpires(fury_of_elune_up_buff) and SpellCooldown(fury_of_elune) > 10 Spell(starfall)
#starsurge,if=active_enemies<=2&buff.fury_of_elune_up.down&cooldown.fury_of_elune.remains>7
if Enemies() <= 2 and BuffExpires(fury_of_elune_up_buff) and SpellCooldown(fury_of_elune) > 7 Spell(starsurge_moonkin)
#starsurge,if=buff.fury_of_elune_up.down&((astral_power>=92&cooldown.fury_of_elune.remains>gcd*3)|(cooldown.warrior_of_elune.remains<=5&cooldown.fury_of_elune.remains>=35&buff.lunar_empowerment.stack<2))
if BuffExpires(fury_of_elune_up_buff) and { AstralPower() >= 92 and SpellCooldown(fury_of_elune) > GCD() * 3 or SpellCooldown(warrior_of_elune) <= 5 and SpellCooldown(fury_of_elune) >= 35 and BuffStacks(lunar_empowerment_buff) < 2 } Spell(starsurge_moonkin)
#solar_wrath,if=buff.solar_empowerment.up
if BuffPresent(solar_empowerment_buff) Spell(solar_wrath)
#lunar_strike,if=buff.lunar_empowerment.stack=3|(buff.lunar_empowerment.remains<5&buff.lunar_empowerment.up)|active_enemies>=2
if BuffStacks(lunar_empowerment_buff) == 3 or BuffRemaining(lunar_empowerment_buff) < 5 and BuffPresent(lunar_empowerment_buff) or Enemies() >= 2 Spell(lunar_strike_balance)
#solar_wrath
Spell(solar_wrath)
}
AddFunction BalanceFuryOfEluneMainPostConditions
{
}
AddFunction BalanceFuryOfEluneShortCdActions
{
#fury_of_elune,if=astral_power>=95
if AstralPower() >= 95 Spell(fury_of_elune)
unless { Charges(new_moon) == 2 and SpellChargeCooldown(new_moon) < 5 or Charges(new_moon) == 3 } and { BuffPresent(fury_of_elune_up_buff) or SpellCooldown(fury_of_elune) > GCD() * 3 and AstralPower() <= 90 } and not SpellKnown(half_moon) and not SpellKnown(full_moon) and Spell(new_moon) or { Charges(half_moon) == 2 and SpellChargeCooldown(half_moon) < 5 or Charges(half_moon) == 3 } and { BuffPresent(fury_of_elune_up_buff) or SpellCooldown(fury_of_elune) > GCD() * 3 and AstralPower() <= 80 } and SpellKnown(half_moon) and Spell(half_moon) or { Charges(full_moon) == 2 and SpellChargeCooldown(full_moon) < 5 or Charges(full_moon) == 3 } and { BuffPresent(fury_of_elune_up_buff) or SpellCooldown(fury_of_elune) > GCD() * 3 and AstralPower() <= 60 } and SpellKnown(full_moon) and Spell(full_moon)
{
#astral_communion,if=buff.fury_of_elune_up.up&astral_power<=25
if BuffPresent(fury_of_elune_up_buff) and AstralPower() <= 25 Spell(astral_communion)
#warrior_of_elune,if=buff.fury_of_elune_up.up|(cooldown.fury_of_elune.remains>=35&buff.lunar_empowerment.up)
if BuffPresent(fury_of_elune_up_buff) or SpellCooldown(fury_of_elune) >= 35 and BuffPresent(lunar_empowerment_buff) Spell(warrior_of_elune)
}
}
AddFunction BalanceFuryOfEluneShortCdPostConditions
{
{ Charges(new_moon) == 2 and SpellChargeCooldown(new_moon) < 5 or Charges(new_moon) == 3 } and { BuffPresent(fury_of_elune_up_buff) or SpellCooldown(fury_of_elune) > GCD() * 3 and AstralPower() <= 90 } and not SpellKnown(half_moon) and not SpellKnown(full_moon) and Spell(new_moon) or { Charges(half_moon) == 2 and SpellChargeCooldown(half_moon) < 5 or Charges(half_moon) == 3 } and { BuffPresent(fury_of_elune_up_buff) or SpellCooldown(fury_of_elune) > GCD() * 3 and AstralPower() <= 80 } and SpellKnown(half_moon) and Spell(half_moon) or { Charges(full_moon) == 2 and SpellChargeCooldown(full_moon) < 5 or Charges(full_moon) == 3 } and { BuffPresent(fury_of_elune_up_buff) or SpellCooldown(fury_of_elune) > GCD() * 3 and AstralPower() <= 60 } and SpellKnown(full_moon) and Spell(full_moon) or BuffPresent(warrior_of_elune_buff) and { AstralPower() <= 90 or AstralPower() <= 85 and BuffPresent(incarnation_chosen_of_elune_buff) } and Spell(lunar_strike_balance) or AstralPower() <= 90 and BuffPresent(fury_of_elune_up_buff) and not SpellKnown(half_moon) and not SpellKnown(full_moon) and Spell(new_moon) or AstralPower() <= 80 and BuffPresent(fury_of_elune_up_buff) and AstralPower() > CastTime(half_moon) * 12 and SpellKnown(half_moon) and Spell(half_moon) or AstralPower() <= 60 and BuffPresent(fury_of_elune_up_buff) and AstralPower() > CastTime(full_moon) * 12 and SpellKnown(full_moon) and Spell(full_moon) or BuffExpires(fury_of_elune_up_buff) and target.DebuffRemaining(moonfire_debuff) <= 6.6 and Spell(moonfire) or BuffExpires(fury_of_elune_up_buff) and target.DebuffRemaining(sunfire_debuff) < 5.4 and Spell(sunfire) or target.DebuffRemaining(stellar_flare_debuff) < 7.2 and Enemies() == 1 and Spell(stellar_flare) or { Enemies() >= 2 and Talent(stellar_flare_talent) or Enemies() >= 3 } and BuffExpires(fury_of_elune_up_buff) and SpellCooldown(fury_of_elune) > 10 and Spell(starfall) or Enemies() <= 2 and BuffExpires(fury_of_elune_up_buff) and SpellCooldown(fury_of_elune) > 7 and Spell(starsurge_moonkin) or BuffExpires(fury_of_elune_up_buff) and { AstralPower() >= 92 and SpellCooldown(fury_of_elune) > GCD() * 3 or SpellCooldown(warrior_of_elune) <= 5 and SpellCooldown(fury_of_elune) >= 35 and BuffStacks(lunar_empowerment_buff) < 2 } and Spell(starsurge_moonkin) or BuffPresent(solar_empowerment_buff) and Spell(solar_wrath) or { BuffStacks(lunar_empowerment_buff) == 3 or BuffRemaining(lunar_empowerment_buff) < 5 and BuffPresent(lunar_empowerment_buff) or Enemies() >= 2 } and Spell(lunar_strike_balance) or Spell(solar_wrath)
}
AddFunction BalanceFuryOfEluneCdActions
{
#incarnation,if=astral_power>=95&cooldown.fury_of_elune.remains<=gcd
if AstralPower() >= 95 and SpellCooldown(fury_of_elune) <= GCD() Spell(incarnation_chosen_of_elune)
}
AddFunction BalanceFuryOfEluneCdPostConditions
{
AstralPower() >= 95 and Spell(fury_of_elune) or { Charges(new_moon) == 2 and SpellChargeCooldown(new_moon) < 5 or Charges(new_moon) == 3 } and { BuffPresent(fury_of_elune_up_buff) or SpellCooldown(fury_of_elune) > GCD() * 3 and AstralPower() <= 90 } and not SpellKnown(half_moon) and not SpellKnown(full_moon) and Spell(new_moon) or { Charges(half_moon) == 2 and SpellChargeCooldown(half_moon) < 5 or Charges(half_moon) == 3 } and { BuffPresent(fury_of_elune_up_buff) or SpellCooldown(fury_of_elune) > GCD() * 3 and AstralPower() <= 80 } and SpellKnown(half_moon) and Spell(half_moon) or { Charges(full_moon) == 2 and SpellChargeCooldown(full_moon) < 5 or Charges(full_moon) == 3 } and { BuffPresent(fury_of_elune_up_buff) or SpellCooldown(fury_of_elune) > GCD() * 3 and AstralPower() <= 60 } and SpellKnown(full_moon) and Spell(full_moon) or BuffPresent(fury_of_elune_up_buff) and AstralPower() <= 25 and Spell(astral_communion) or BuffPresent(warrior_of_elune_buff) and { AstralPower() <= 90 or AstralPower() <= 85 and BuffPresent(incarnation_chosen_of_elune_buff) } and Spell(lunar_strike_balance) or AstralPower() <= 90 and BuffPresent(fury_of_elune_up_buff) and not SpellKnown(half_moon) and not SpellKnown(full_moon) and Spell(new_moon) or AstralPower() <= 80 and BuffPresent(fury_of_elune_up_buff) and AstralPower() > CastTime(half_moon) * 12 and SpellKnown(half_moon) and Spell(half_moon) or AstralPower() <= 60 and BuffPresent(fury_of_elune_up_buff) and AstralPower() > CastTime(full_moon) * 12 and SpellKnown(full_moon) and Spell(full_moon) or BuffExpires(fury_of_elune_up_buff) and target.DebuffRemaining(moonfire_debuff) <= 6.6 and Spell(moonfire) or BuffExpires(fury_of_elune_up_buff) and target.DebuffRemaining(sunfire_debuff) < 5.4 and Spell(sunfire) or target.DebuffRemaining(stellar_flare_debuff) < 7.2 and Enemies() == 1 and Spell(stellar_flare) or { Enemies() >= 2 and Talent(stellar_flare_talent) or Enemies() >= 3 } and BuffExpires(fury_of_elune_up_buff) and SpellCooldown(fury_of_elune) > 10 and Spell(starfall) or Enemies() <= 2 and BuffExpires(fury_of_elune_up_buff) and SpellCooldown(fury_of_elune) > 7 and Spell(starsurge_moonkin) or BuffExpires(fury_of_elune_up_buff) and { AstralPower() >= 92 and SpellCooldown(fury_of_elune) > GCD() * 3 or SpellCooldown(warrior_of_elune) <= 5 and SpellCooldown(fury_of_elune) >= 35 and BuffStacks(lunar_empowerment_buff) < 2 } and Spell(starsurge_moonkin) or BuffPresent(solar_empowerment_buff) and Spell(solar_wrath) or { BuffStacks(lunar_empowerment_buff) == 3 or BuffRemaining(lunar_empowerment_buff) < 5 and BuffPresent(lunar_empowerment_buff) or Enemies() >= 2 } and Spell(lunar_strike_balance) or Spell(solar_wrath)
}
### actions.precombat
AddFunction BalancePrecombatMainActions
{
#flask,type=flask_of_the_whispered_pact
#food,type=azshari_salad
#augmentation,type=defiled
#moonkin_form
Spell(moonkin_form)
#blessing_of_elune
Spell(blessing_of_elune)
#new_moon
if not SpellKnown(half_moon) and not SpellKnown(full_moon) Spell(new_moon)
}
AddFunction BalancePrecombatMainPostConditions
{
}
AddFunction BalancePrecombatShortCdActions
{
}
AddFunction BalancePrecombatShortCdPostConditions
{
Spell(moonkin_form) or Spell(blessing_of_elune) or not SpellKnown(half_moon) and not SpellKnown(full_moon) and Spell(new_moon)
}
AddFunction BalancePrecombatCdActions
{
unless Spell(moonkin_form) or Spell(blessing_of_elune)
{
#snapshot_stats
#potion,name=deadly_grace
if CheckBoxOn(opt_use_consumables) and target.Classification(worldboss) Item(deadly_grace_potion usable=1)
}
}
AddFunction BalancePrecombatCdPostConditions
{
Spell(moonkin_form) or Spell(blessing_of_elune) or not SpellKnown(half_moon) and not SpellKnown(full_moon) and Spell(new_moon)
}
### actions.single_target
AddFunction BalanceSingleTargetMainActions
{
#new_moon,if=astral_power<=90
if AstralPower() <= 90 and not SpellKnown(half_moon) and not SpellKnown(full_moon) Spell(new_moon)
#half_moon,if=astral_power<=80
if AstralPower() <= 80 and SpellKnown(half_moon) Spell(half_moon)
#full_moon,if=astral_power<=60
if AstralPower() <= 60 and SpellKnown(full_moon) Spell(full_moon)
#starfall,if=((active_enemies>=2&talent.stellar_drift.enabled)|active_enemies>=3)
if Enemies() >= 2 and Talent(stellar_drift_talent) or Enemies() >= 3 Spell(starfall)
#starsurge,if=active_enemies<=2
if Enemies() <= 2 Spell(starsurge_moonkin)
#lunar_strike,if=buff.warrior_of_elune.up
if BuffPresent(warrior_of_elune_buff) Spell(lunar_strike_balance)
#solar_wrath,if=buff.solar_empowerment.up
if BuffPresent(solar_empowerment_buff) Spell(solar_wrath)
#lunar_strike,if=buff.lunar_empowerment.up
if BuffPresent(lunar_empowerment_buff) Spell(lunar_strike_balance)
#solar_wrath,if=talent.natures_balance.enabled&dot.sunfire_dmg.remains<5&cast_time<dot.sunfire_dmg.remains
if Talent(natures_balance_talent) and target.DebuffRemaining(sunfire_dmg_debuff) < 5 and CastTime(solar_wrath) < target.DebuffRemaining(sunfire_dmg_debuff) Spell(solar_wrath)
#lunar_strike,if=(talent.natures_balance.enabled&dot.moonfire_dmg.remains<5&cast_time<dot.moonfire_dmg.remains)|active_enemies>=2
if Talent(natures_balance_talent) and target.DebuffRemaining(moonfire_dmg_debuff) < 5 and CastTime(lunar_strike_balance) < target.DebuffRemaining(moonfire_dmg_debuff) or Enemies() >= 2 Spell(lunar_strike_balance)
#solar_wrath
Spell(solar_wrath)
}
AddFunction BalanceSingleTargetMainPostConditions
{
}
AddFunction BalanceSingleTargetShortCdActions
{
unless AstralPower() <= 90 and not SpellKnown(half_moon) and not SpellKnown(full_moon) and Spell(new_moon) or AstralPower() <= 80 and SpellKnown(half_moon) and Spell(half_moon) or AstralPower() <= 60 and SpellKnown(full_moon) and Spell(full_moon) or { Enemies() >= 2 and Talent(stellar_drift_talent) or Enemies() >= 3 } and Spell(starfall) or Enemies() <= 2 and Spell(starsurge_moonkin)
{
#warrior_of_elune
Spell(warrior_of_elune)
}
}
AddFunction BalanceSingleTargetShortCdPostConditions
{
AstralPower() <= 90 and not SpellKnown(half_moon) and not SpellKnown(full_moon) and Spell(new_moon) or AstralPower() <= 80 and SpellKnown(half_moon) and Spell(half_moon) or AstralPower() <= 60 and SpellKnown(full_moon) and Spell(full_moon) or { Enemies() >= 2 and Talent(stellar_drift_talent) or Enemies() >= 3 } and Spell(starfall) or Enemies() <= 2 and Spell(starsurge_moonkin) or BuffPresent(warrior_of_elune_buff) and Spell(lunar_strike_balance) or BuffPresent(solar_empowerment_buff) and Spell(solar_wrath) or BuffPresent(lunar_empowerment_buff) and Spell(lunar_strike_balance) or Talent(natures_balance_talent) and target.DebuffRemaining(sunfire_dmg_debuff) < 5 and CastTime(solar_wrath) < target.DebuffRemaining(sunfire_dmg_debuff) and Spell(solar_wrath) or { Talent(natures_balance_talent) and target.DebuffRemaining(moonfire_dmg_debuff) < 5 and CastTime(lunar_strike_balance) < target.DebuffRemaining(moonfire_dmg_debuff) or Enemies() >= 2 } and Spell(lunar_strike_balance) or Spell(solar_wrath)
}
AddFunction BalanceSingleTargetCdActions
{
}
AddFunction BalanceSingleTargetCdPostConditions
{
AstralPower() <= 90 and not SpellKnown(half_moon) and not SpellKnown(full_moon) and Spell(new_moon) or AstralPower() <= 80 and SpellKnown(half_moon) and Spell(half_moon) or AstralPower() <= 60 and SpellKnown(full_moon) and Spell(full_moon) or { Enemies() >= 2 and Talent(stellar_drift_talent) or Enemies() >= 3 } and Spell(starfall) or Enemies() <= 2 and Spell(starsurge_moonkin) or BuffPresent(warrior_of_elune_buff) and Spell(lunar_strike_balance) or BuffPresent(solar_empowerment_buff) and Spell(solar_wrath) or BuffPresent(lunar_empowerment_buff) and Spell(lunar_strike_balance) or Talent(natures_balance_talent) and target.DebuffRemaining(sunfire_dmg_debuff) < 5 and CastTime(solar_wrath) < target.DebuffRemaining(sunfire_dmg_debuff) and Spell(solar_wrath) or { Talent(natures_balance_talent) and target.DebuffRemaining(moonfire_dmg_debuff) < 5 and CastTime(lunar_strike_balance) < target.DebuffRemaining(moonfire_dmg_debuff) or Enemies() >= 2 } and Spell(lunar_strike_balance) or Spell(solar_wrath)
}
### Balance icons.
AddCheckBox(opt_druid_balance_aoe L(AOE) default specialization=balance)
AddIcon checkbox=!opt_druid_balance_aoe enemies=1 help=shortcd specialization=balance
{
if not InCombat() BalancePrecombatShortCdActions()
unless not InCombat() and BalancePrecombatShortCdPostConditions()
{
BalanceDefaultShortCdActions()
}
}
AddIcon checkbox=opt_druid_balance_aoe help=shortcd specialization=balance
{
if not InCombat() BalancePrecombatShortCdActions()
unless not InCombat() and BalancePrecombatShortCdPostConditions()
{
BalanceDefaultShortCdActions()
}
}
AddIcon enemies=1 help=main specialization=balance
{
if not InCombat() BalancePrecombatMainActions()
unless not InCombat() and BalancePrecombatMainPostConditions()
{
BalanceDefaultMainActions()
}
}
AddIcon checkbox=opt_druid_balance_aoe help=aoe specialization=balance
{
if not InCombat() BalancePrecombatMainActions()
unless not InCombat() and BalancePrecombatMainPostConditions()
{
BalanceDefaultMainActions()
}
}
AddIcon checkbox=!opt_druid_balance_aoe enemies=1 help=cd specialization=balance
{
if not InCombat() BalancePrecombatCdActions()
unless not InCombat() and BalancePrecombatCdPostConditions()
{
BalanceDefaultCdActions()
}
}
AddIcon checkbox=opt_druid_balance_aoe help=cd specialization=balance
{
if not InCombat() BalancePrecombatCdActions()
unless not InCombat() and BalancePrecombatCdPostConditions()
{
BalanceDefaultCdActions()
}
}
### Required symbols
# arcane_torrent_energy
# astral_communion
# berserking
# blessing_of_anshe_buff
# blessing_of_elune
# blessing_of_elune_buff
# blessing_of_the_ancients_talent
# blood_fury_apsp
# celestial_alignment
# celestial_alignment_buff
# deadly_grace_potion
# full_moon
# fury_of_elune
# fury_of_elune_talent
# fury_of_elune_up_buff
# half_moon
# incarnation_chosen_of_elune
# incarnation_chosen_of_elune_buff
# lunar_empowerment_buff
# lunar_strike_balance
# mighty_bash
# moonfire
# moonfire_debuff
# moonfire_dmg_debuff
# moonkin_form
# natures_balance_talent
# new_moon
# oneths_overconfidence_buff
# solar_beam
# solar_empowerment_buff
# solar_wrath
# starfall
# starfall_buff
# starsurge_moonkin
# stellar_drift_talent
# stellar_flare
# stellar_flare_debuff
# stellar_flare_talent
# sunfire
# sunfire_debuff
# sunfire_dmg_debuff
# the_emerald_dreamcatcher
# the_emerald_dreamcatcher_buff
# typhoon
# war_stomp
# warrior_of_elune
# warrior_of_elune_buff
]]
OvaleScripts:RegisterScript("DRUID", "balance", name, desc, code, "script")
end
do
local name = "simulationcraft_druid_feral_t19p"
local desc = "[7.0] SimulationCraft: Druid_Feral_T19P"
local code = [[
# Based on SimulationCraft profile "Druid_Feral_T19P".
# class=druid
# spec=feral
# talents=3323322
Include(ovale_common)
Include(ovale_trinkets_mop)
Include(ovale_trinkets_wod)
Include(ovale_druid_spells)
AddCheckBox(opt_interrupt L(interrupt) default specialization=feral)
AddCheckBox(opt_melee_range L(not_in_melee_range) specialization=feral)
AddCheckBox(opt_use_consumables L(opt_use_consumables) default specialization=feral)
AddFunction FeralInterruptActions
{
if CheckBoxOn(opt_interrupt) and not target.IsFriend() and target.Casting()
{
if target.InRange(skull_bash) and target.IsInterruptible() Spell(skull_bash)
if target.InRange(mighty_bash) and not target.Classification(worldboss) Spell(mighty_bash)
if target.InRange(maim) and not target.Classification(worldboss) Spell(maim)
if target.Distance(less 5) and not target.Classification(worldboss) Spell(war_stomp)
if target.Distance(less 15) and not target.Classification(worldboss) Spell(typhoon)
}
}
AddFunction FeralUseItemActions
{
Item(Trinket0Slot text=13 usable=1)
Item(Trinket1Slot text=14 usable=1)
}
AddFunction FeralGetInMeleeRange
{
if CheckBoxOn(opt_melee_range) and Stance(druid_bear_form) and not target.InRange(mangle) or { Stance(druid_cat_form) or Stance(druid_claws_of_shirvallah) } and not target.InRange(shred)
{
if target.InRange(wild_charge) Spell(wild_charge)
Texture(misc_arrowlup help=L(not_in_melee_range))
}
}
### actions.default
AddFunction FeralDefaultMainActions
{
#cat_form
Spell(cat_form)
#rake,if=buff.prowl.up|buff.shadowmeld.up
if BuffPresent(prowl_buff) or BuffPresent(shadowmeld_buff) Spell(rake)
#ferocious_bite,cycle_targets=1,if=dot.rip.ticking&dot.rip.remains<3&target.time_to_die>3&(target.health.pct<25|talent.sabertooth.enabled)
if target.DebuffPresent(rip_debuff) and target.DebuffRemaining(rip_debuff) < 3 and target.TimeToDie() > 3 and { target.HealthPercent() < 25 or Talent(sabertooth_talent) } Spell(ferocious_bite)
#regrowth,if=talent.bloodtalons.enabled&buff.predatory_swiftness.up&buff.bloodtalons.down&(combo_points>=5|buff.predatory_swiftness.remains<1.5|(talent.bloodtalons.enabled&combo_points=2&cooldown.ashamanes_frenzy.remains<gcd)|(talent.elunes_guidance.enabled&((cooldown.elunes_guidance.remains<gcd&combo_points=0)|(buff.elunes_guidance.up&combo_points>=4))))
if Talent(bloodtalons_talent) and BuffPresent(predatory_swiftness_buff) and BuffExpires(bloodtalons_buff) and { ComboPoints() >= 5 or BuffRemaining(predatory_swiftness_buff) < 1.5 or Talent(bloodtalons_talent) and ComboPoints() == 2 and SpellCooldown(ashamanes_frenzy) < GCD() or Talent(elunes_guidance_talent) and { SpellCooldown(elunes_guidance) < GCD() and ComboPoints() == 0 or BuffPresent(elunes_guidance_buff) and ComboPoints() >= 4 } } Spell(regrowth)
#call_action_list,name=sbt_opener,if=talent.sabertooth.enabled&time<20
if Talent(sabertooth_talent) and TimeInCombat() < 20 FeralSbtOpenerMainActions()
unless Talent(sabertooth_talent) and TimeInCombat() < 20 and FeralSbtOpenerMainPostConditions()
{
#regrowth,if=equipped.ailuro_pouncers&talent.bloodtalons.enabled&buff.predatory_swiftness.stack>1&buff.bloodtalons.down
if HasEquippedItem(ailuro_pouncers) and Talent(bloodtalons_talent) and BuffStacks(predatory_swiftness_buff) > 1 and BuffExpires(bloodtalons_buff) Spell(regrowth)
#call_action_list,name=finisher
FeralFinisherMainActions()
unless FeralFinisherMainPostConditions()
{
#call_action_list,name=generator
FeralGeneratorMainActions()
}
}
}
AddFunction FeralDefaultMainPostConditions
{
Talent(sabertooth_talent) and TimeInCombat() < 20 and FeralSbtOpenerMainPostConditions() or FeralFinisherMainPostConditions() or FeralGeneratorMainPostConditions()
}
AddFunction FeralDefaultShortCdActions
{
unless Spell(cat_form)
{
#wild_charge
FeralGetInMeleeRange()
#displacer_beast,if=movement.distance>10
if target.Distance() > 10 Spell(displacer_beast)
unless { BuffPresent(prowl_buff) or BuffPresent(shadowmeld_buff) } and Spell(rake)
{
#auto_attack
FeralGetInMeleeRange()
#tigers_fury,if=(!buff.clearcasting.react&energy.deficit>=60)|energy.deficit>=80|(t18_class_trinket&buff.berserk.up&buff.tigers_fury.down)
if not BuffPresent(clearcasting_buff) and EnergyDeficit() >= 60 or EnergyDeficit() >= 80 or HasTrinket(t18_class_trinket) and BuffPresent(berserk_cat_buff) and BuffExpires(tigers_fury_buff) Spell(tigers_fury)
unless target.DebuffPresent(rip_debuff) and target.DebuffRemaining(rip_debuff) < 3 and target.TimeToDie() > 3 and { target.HealthPercent() < 25 or Talent(sabertooth_talent) } and Spell(ferocious_bite) or Talent(bloodtalons_talent) and BuffPresent(predatory_swiftness_buff) and BuffExpires(bloodtalons_buff) and { ComboPoints() >= 5 or BuffRemaining(predatory_swiftness_buff) < 1.5 or Talent(bloodtalons_talent) and ComboPoints() == 2 and SpellCooldown(ashamanes_frenzy) < GCD() or Talent(elunes_guidance_talent) and { SpellCooldown(elunes_guidance) < GCD() and ComboPoints() == 0 or BuffPresent(elunes_guidance_buff) and ComboPoints() >= 4 } } and Spell(regrowth)
{
#call_action_list,name=sbt_opener,if=talent.sabertooth.enabled&time<20
if Talent(sabertooth_talent) and TimeInCombat() < 20 FeralSbtOpenerShortCdActions()
unless Talent(sabertooth_talent) and TimeInCombat() < 20 and FeralSbtOpenerShortCdPostConditions() or HasEquippedItem(ailuro_pouncers) and Talent(bloodtalons_talent) and BuffStacks(predatory_swiftness_buff) > 1 and BuffExpires(bloodtalons_buff) and Spell(regrowth)
{
#call_action_list,name=finisher
FeralFinisherShortCdActions()
unless FeralFinisherShortCdPostConditions()
{
#call_action_list,name=generator
FeralGeneratorShortCdActions()
}
}
}
}
}
}
AddFunction FeralDefaultShortCdPostConditions
{
Spell(cat_form) or { BuffPresent(prowl_buff) or BuffPresent(shadowmeld_buff) } and Spell(rake) or target.DebuffPresent(rip_debuff) and target.DebuffRemaining(rip_debuff) < 3 and target.TimeToDie() > 3 and { target.HealthPercent() < 25 or Talent(sabertooth_talent) } and Spell(ferocious_bite) or Talent(bloodtalons_talent) and BuffPresent(predatory_swiftness_buff) and BuffExpires(bloodtalons_buff) and { ComboPoints() >= 5 or BuffRemaining(predatory_swiftness_buff) < 1.5 or Talent(bloodtalons_talent) and ComboPoints() == 2 and SpellCooldown(ashamanes_frenzy) < GCD() or Talent(elunes_guidance_talent) and { SpellCooldown(elunes_guidance) < GCD() and ComboPoints() == 0 or BuffPresent(elunes_guidance_buff) and ComboPoints() >= 4 } } and Spell(regrowth) or Talent(sabertooth_talent) and TimeInCombat() < 20 and FeralSbtOpenerShortCdPostConditions() or HasEquippedItem(ailuro_pouncers) and Talent(bloodtalons_talent) and BuffStacks(predatory_swiftness_buff) > 1 and BuffExpires(bloodtalons_buff) and Spell(regrowth) or FeralFinisherShortCdPostConditions() or FeralGeneratorShortCdPostConditions()
}
AddFunction FeralDefaultCdActions
{
#dash,if=!buff.cat_form.up
if not BuffPresent(cat_form_buff) Spell(dash)
unless Spell(cat_form) or target.Distance() > 10 and Spell(displacer_beast)
{
#dash,if=movement.distance&buff.displacer_beast.down&buff.wild_charge_movement.down
if target.Distance() and BuffExpires(displacer_beast_buff) and True(wild_charge_movement_down) Spell(dash)
unless { BuffPresent(prowl_buff) or BuffPresent(shadowmeld_buff) } and Spell(rake)
{
#skull_bash
FeralInterruptActions()
#berserk,if=buff.tigers_fury.up
if BuffPresent(tigers_fury_buff) Spell(berserk_cat)
#incarnation,if=cooldown.tigers_fury.remains<gcd
if SpellCooldown(tigers_fury) < GCD() Spell(incarnation_king_of_the_jungle)
#use_item,slot=trinket2,if=(buff.tigers_fury.up&(target.time_to_die>trinket.stat.any.cooldown|target.time_to_die<45))|buff.incarnation.remains>20
if BuffPresent(tigers_fury_buff) and { target.TimeToDie() > BuffCooldownDuration(trinket_stat_any_buff) or target.TimeToDie() < 45 } or BuffRemaining(incarnation_king_of_the_jungle_buff) > 20 FeralUseItemActions()
#potion,name=old_war,if=((buff.berserk.remains>10|buff.incarnation.remains>20)&(target.time_to_die<180|(trinket.proc.all.react&target.health.pct<25)))|target.time_to_die<=40
if { { BuffRemaining(berserk_cat_buff) > 10 or BuffRemaining(incarnation_king_of_the_jungle_buff) > 20 } and { target.TimeToDie() < 180 or BuffPresent(trinket_proc_any_buff) and target.HealthPercent() < 25 } or target.TimeToDie() <= 40 } and CheckBoxOn(opt_use_consumables) and target.Classification(worldboss) Item(old_war_potion usable=1)
#incarnation,if=energy.time_to_max>1&energy>=35
if TimeToMaxEnergy() > 1 and Energy() >= 35 Spell(incarnation_king_of_the_jungle)
unless target.DebuffPresent(rip_debuff) and target.DebuffRemaining(rip_debuff) < 3 and target.TimeToDie() > 3 and { target.HealthPercent() < 25 or Talent(sabertooth_talent) } and Spell(ferocious_bite) or Talent(bloodtalons_talent) and BuffPresent(predatory_swiftness_buff) and BuffExpires(bloodtalons_buff) and { ComboPoints() >= 5 or BuffRemaining(predatory_swiftness_buff) < 1.5 or Talent(bloodtalons_talent) and ComboPoints() == 2 and SpellCooldown(ashamanes_frenzy) < GCD() or Talent(elunes_guidance_talent) and { SpellCooldown(elunes_guidance) < GCD() and ComboPoints() == 0 or BuffPresent(elunes_guidance_buff) and ComboPoints() >= 4 } } and Spell(regrowth)
{
#call_action_list,name=sbt_opener,if=talent.sabertooth.enabled&time<20
if Talent(sabertooth_talent) and TimeInCombat() < 20 FeralSbtOpenerCdActions()
unless Talent(sabertooth_talent) and TimeInCombat() < 20 and FeralSbtOpenerCdPostConditions() or HasEquippedItem(ailuro_pouncers) and Talent(bloodtalons_talent) and BuffStacks(predatory_swiftness_buff) > 1 and BuffExpires(bloodtalons_buff) and Spell(regrowth)
{
#call_action_list,name=finisher
FeralFinisherCdActions()
unless FeralFinisherCdPostConditions()
{
#call_action_list,name=generator
FeralGeneratorCdActions()
}
}
}
}
}
}
AddFunction FeralDefaultCdPostConditions
{
Spell(cat_form) or target.Distance() > 10 and Spell(displacer_beast) or { BuffPresent(prowl_buff) or BuffPresent(shadowmeld_buff) } and Spell(rake) or target.DebuffPresent(rip_debuff) and target.DebuffRemaining(rip_debuff) < 3 and target.TimeToDie() > 3 and { target.HealthPercent() < 25 or Talent(sabertooth_talent) } and Spell(ferocious_bite) or Talent(bloodtalons_talent) and BuffPresent(predatory_swiftness_buff) and BuffExpires(bloodtalons_buff) and { ComboPoints() >= 5 or BuffRemaining(predatory_swiftness_buff) < 1.5 or Talent(bloodtalons_talent) and ComboPoints() == 2 and SpellCooldown(ashamanes_frenzy) < GCD() or Talent(elunes_guidance_talent) and { SpellCooldown(elunes_guidance) < GCD() and ComboPoints() == 0 or BuffPresent(elunes_guidance_buff) and ComboPoints() >= 4 } } and Spell(regrowth) or Talent(sabertooth_talent) and TimeInCombat() < 20 and FeralSbtOpenerCdPostConditions() or HasEquippedItem(ailuro_pouncers) and Talent(bloodtalons_talent) and BuffStacks(predatory_swiftness_buff) > 1 and BuffExpires(bloodtalons_buff) and Spell(regrowth) or FeralFinisherCdPostConditions() or FeralGeneratorCdPostConditions()
}
### actions.finisher
AddFunction FeralFinisherMainActions
{
#pool_resource,for_next=1
#savage_roar,if=!buff.savage_roar.up&(combo_points=5|(talent.brutal_slash.enabled&spell_targets.brutal_slash>desired_targets&action.brutal_slash.charges>0))
if not BuffPresent(savage_roar_buff) and { ComboPoints() == 5 or Talent(brutal_slash_talent) and Enemies() > Enemies(tagged=1) and Charges(brutal_slash) > 0 } Spell(savage_roar)
unless not BuffPresent(savage_roar_buff) and { ComboPoints() == 5 or Talent(brutal_slash_talent) and Enemies() > Enemies(tagged=1) and Charges(brutal_slash) > 0 } and SpellUsable(savage_roar) and SpellCooldown(savage_roar) < TimeToEnergyFor(savage_roar)
{
#pool_resource,for_next=1
#thrash_cat,cycle_targets=1,if=remains<=duration*0.3&spell_targets.thrash_cat>=5
if target.DebuffRemaining(thrash_cat_debuff) <= BaseDuration(thrash_cat_debuff) * 0.3 and Enemies() >= 5 Spell(thrash_cat)
unless target.DebuffRemaining(thrash_cat_debuff) <= BaseDuration(thrash_cat_debuff) * 0.3 and Enemies() >= 5 and SpellUsable(thrash_cat) and SpellCooldown(thrash_cat) < TimeToEnergyFor(thrash_cat)
{
#pool_resource,for_next=1
#swipe_cat,if=spell_targets.swipe_cat>=8
if Enemies() >= 8 Spell(swipe_cat)
unless Enemies() >= 8 and SpellUsable(swipe_cat) and SpellCooldown(swipe_cat) < TimeToEnergyFor(swipe_cat)
{
#rip,cycle_targets=1,if=(!ticking|(remains<8&target.health.pct>25&!talent.sabertooth.enabled)|persistent_multiplier>dot.rip.pmultiplier)&target.time_to_die-remains>tick_time*4&combo_points=5&(energy.time_to_max<1|buff.berserk.up|buff.incarnation.up|buff.elunes_guidance.up|cooldown.tigers_fury.remains<3|set_bonus.tier18_4pc|(buff.clearcasting.react&energy>65)|talent.soul_of_the_forest.enabled|!dot.rip.ticking|(dot.rake.remains<1.5&spell_targets.swipe_cat<6))
if { not target.DebuffPresent(rip_debuff) or target.DebuffRemaining(rip_debuff) < 8 and target.HealthPercent() > 25 and not Talent(sabertooth_talent) or PersistentMultiplier(rip_debuff) > target.DebuffPersistentMultiplier(rip_debuff) } and target.TimeToDie() - target.DebuffRemaining(rip_debuff) > target.TickTime(rip_debuff) * 4 and ComboPoints() == 5 and { TimeToMaxEnergy() < 1 or BuffPresent(berserk_cat_buff) or BuffPresent(incarnation_king_of_the_jungle_buff) or BuffPresent(elunes_guidance_buff) or SpellCooldown(tigers_fury) < 3 or ArmorSetBonus(T18 4) or BuffPresent(clearcasting_buff) and Energy() > 65 or Talent(soul_of_the_forest_talent) or not target.DebuffPresent(rip_debuff) or target.DebuffRemaining(rake_debuff) < 1.5 and Enemies() < 6 } Spell(rip)
#savage_roar,if=((buff.savage_roar.remains<=10.5&talent.jagged_wounds.enabled)|(buff.savage_roar.remains<=7.2))&combo_points=5&(energy.time_to_max<1|buff.berserk.up|buff.incarnation.up|buff.elunes_guidance.up|cooldown.tigers_fury.remains<3|set_bonus.tier18_4pc|(buff.clearcasting.react&energy>65)|talent.soul_of_the_forest.enabled|!dot.rip.ticking|(dot.rake.remains<1.5&spell_targets.swipe_cat<6))
if { BuffRemaining(savage_roar_buff) <= 10.5 and Talent(jagged_wounds_talent) or BuffRemaining(savage_roar_buff) <= 7.2 } and ComboPoints() == 5 and { TimeToMaxEnergy() < 1 or BuffPresent(berserk_cat_buff) or BuffPresent(incarnation_king_of_the_jungle_buff) or BuffPresent(elunes_guidance_buff) or SpellCooldown(tigers_fury) < 3 or ArmorSetBonus(T18 4) or BuffPresent(clearcasting_buff) and Energy() > 65 or Talent(soul_of_the_forest_talent) or not target.DebuffPresent(rip_debuff) or target.DebuffRemaining(rake_debuff) < 1.5 and Enemies() < 6 } Spell(savage_roar)
#swipe_cat,if=combo_points=5&(spell_targets.swipe_cat>=6|(spell_targets.swipe_cat>=3&!talent.bloodtalons.enabled))&combo_points=5&(energy.time_to_max<1|buff.berserk.up|buff.incarnation.up|buff.elunes_guidance.up|cooldown.tigers_fury.remains<3|set_bonus.tier18_4pc|(talent.moment_of_clarity.enabled&buff.clearcasting.react))
if ComboPoints() == 5 and { Enemies() >= 6 or Enemies() >= 3 and not Talent(bloodtalons_talent) } and ComboPoints() == 5 and { TimeToMaxEnergy() < 1 or BuffPresent(berserk_cat_buff) or BuffPresent(incarnation_king_of_the_jungle_buff) or BuffPresent(elunes_guidance_buff) or SpellCooldown(tigers_fury) < 3 or ArmorSetBonus(T18 4) or Talent(moment_of_clarity_talent) and BuffPresent(clearcasting_buff) } Spell(swipe_cat)
#maim,,if=combo_points=5&buff.fiery_red_maimers.up&(energy.time_to_max<1|buff.berserk.up|buff.incarnation.up|buff.elunes_guidance.up|cooldown.tigers_fury.remains<3)
if ComboPoints() == 5 and BuffPresent(fiery_red_maimers_buff) and { TimeToMaxEnergy() < 1 or BuffPresent(berserk_cat_buff) or BuffPresent(incarnation_king_of_the_jungle_buff) or BuffPresent(elunes_guidance_buff) or SpellCooldown(tigers_fury) < 3 } Spell(maim)
#ferocious_bite,max_energy=1,cycle_targets=1,if=combo_points=5&(energy.time_to_max<1|buff.berserk.up|buff.incarnation.up|buff.elunes_guidance.up|cooldown.tigers_fury.remains<3)
if Energy() >= EnergyCost(ferocious_bite max=1) and ComboPoints() == 5 and { TimeToMaxEnergy() < 1 or BuffPresent(berserk_cat_buff) or BuffPresent(incarnation_king_of_the_jungle_buff) or BuffPresent(elunes_guidance_buff) or SpellCooldown(tigers_fury) < 3 } Spell(ferocious_bite)
}
}
}
}
AddFunction FeralFinisherMainPostConditions
{
}
AddFunction FeralFinisherShortCdActions
{
}
AddFunction FeralFinisherShortCdPostConditions
{
not BuffPresent(savage_roar_buff) and { ComboPoints() == 5 or Talent(brutal_slash_talent) and Enemies() > Enemies(tagged=1) and Charges(brutal_slash) > 0 } and Spell(savage_roar) or not { not BuffPresent(savage_roar_buff) and { ComboPoints() == 5 or Talent(brutal_slash_talent) and Enemies() > Enemies(tagged=1) and Charges(brutal_slash) > 0 } and SpellUsable(savage_roar) and SpellCooldown(savage_roar) < TimeToEnergyFor(savage_roar) } and { target.DebuffRemaining(thrash_cat_debuff) <= BaseDuration(thrash_cat_debuff) * 0.3 and Enemies() >= 5 and Spell(thrash_cat) or not { target.DebuffRemaining(thrash_cat_debuff) <= BaseDuration(thrash_cat_debuff) * 0.3 and Enemies() >= 5 and SpellUsable(thrash_cat) and SpellCooldown(thrash_cat) < TimeToEnergyFor(thrash_cat) } and { Enemies() >= 8 and Spell(swipe_cat) or not { Enemies() >= 8 and SpellUsable(swipe_cat) and SpellCooldown(swipe_cat) < TimeToEnergyFor(swipe_cat) } and { { not target.DebuffPresent(rip_debuff) or target.DebuffRemaining(rip_debuff) < 8 and target.HealthPercent() > 25 and not Talent(sabertooth_talent) or PersistentMultiplier(rip_debuff) > target.DebuffPersistentMultiplier(rip_debuff) } and target.TimeToDie() - target.DebuffRemaining(rip_debuff) > target.TickTime(rip_debuff) * 4 and ComboPoints() == 5 and { TimeToMaxEnergy() < 1 or BuffPresent(berserk_cat_buff) or BuffPresent(incarnation_king_of_the_jungle_buff) or BuffPresent(elunes_guidance_buff) or SpellCooldown(tigers_fury) < 3 or ArmorSetBonus(T18 4) or BuffPresent(clearcasting_buff) and Energy() > 65 or Talent(soul_of_the_forest_talent) or not target.DebuffPresent(rip_debuff) or target.DebuffRemaining(rake_debuff) < 1.5 and Enemies() < 6 } and Spell(rip) or { BuffRemaining(savage_roar_buff) <= 10.5 and Talent(jagged_wounds_talent) or BuffRemaining(savage_roar_buff) <= 7.2 } and ComboPoints() == 5 and { TimeToMaxEnergy() < 1 or BuffPresent(berserk_cat_buff) or BuffPresent(incarnation_king_of_the_jungle_buff) or BuffPresent(elunes_guidance_buff) or SpellCooldown(tigers_fury) < 3 or ArmorSetBonus(T18 4) or BuffPresent(clearcasting_buff) and Energy() > 65 or Talent(soul_of_the_forest_talent) or not target.DebuffPresent(rip_debuff) or target.DebuffRemaining(rake_debuff) < 1.5 and Enemies() < 6 } and Spell(savage_roar) or ComboPoints() == 5 and { Enemies() >= 6 or Enemies() >= 3 and not Talent(bloodtalons_talent) } and ComboPoints() == 5 and { TimeToMaxEnergy() < 1 or BuffPresent(berserk_cat_buff) or BuffPresent(incarnation_king_of_the_jungle_buff) or BuffPresent(elunes_guidance_buff) or SpellCooldown(tigers_fury) < 3 or ArmorSetBonus(T18 4) or Talent(moment_of_clarity_talent) and BuffPresent(clearcasting_buff) } and Spell(swipe_cat) or ComboPoints() == 5 and BuffPresent(fiery_red_maimers_buff) and { TimeToMaxEnergy() < 1 or BuffPresent(berserk_cat_buff) or BuffPresent(incarnation_king_of_the_jungle_buff) or BuffPresent(elunes_guidance_buff) or SpellCooldown(tigers_fury) < 3 } and Spell(maim) or Energy() >= EnergyCost(ferocious_bite max=1) and ComboPoints() == 5 and { TimeToMaxEnergy() < 1 or BuffPresent(berserk_cat_buff) or BuffPresent(incarnation_king_of_the_jungle_buff) or BuffPresent(elunes_guidance_buff) or SpellCooldown(tigers_fury) < 3 } and Spell(ferocious_bite) } } }
}
AddFunction FeralFinisherCdActions
{
}
AddFunction FeralFinisherCdPostConditions
{
not BuffPresent(savage_roar_buff) and { ComboPoints() == 5 or Talent(brutal_slash_talent) and Enemies() > Enemies(tagged=1) and Charges(brutal_slash) > 0 } and Spell(savage_roar) or not { not BuffPresent(savage_roar_buff) and { ComboPoints() == 5 or Talent(brutal_slash_talent) and Enemies() > Enemies(tagged=1) and Charges(brutal_slash) > 0 } and SpellUsable(savage_roar) and SpellCooldown(savage_roar) < TimeToEnergyFor(savage_roar) } and { target.DebuffRemaining(thrash_cat_debuff) <= BaseDuration(thrash_cat_debuff) * 0.3 and Enemies() >= 5 and Spell(thrash_cat) or not { target.DebuffRemaining(thrash_cat_debuff) <= BaseDuration(thrash_cat_debuff) * 0.3 and Enemies() >= 5 and SpellUsable(thrash_cat) and SpellCooldown(thrash_cat) < TimeToEnergyFor(thrash_cat) } and { Enemies() >= 8 and Spell(swipe_cat) or not { Enemies() >= 8 and SpellUsable(swipe_cat) and SpellCooldown(swipe_cat) < TimeToEnergyFor(swipe_cat) } and { { not target.DebuffPresent(rip_debuff) or target.DebuffRemaining(rip_debuff) < 8 and target.HealthPercent() > 25 and not Talent(sabertooth_talent) or PersistentMultiplier(rip_debuff) > target.DebuffPersistentMultiplier(rip_debuff) } and target.TimeToDie() - target.DebuffRemaining(rip_debuff) > target.TickTime(rip_debuff) * 4 and ComboPoints() == 5 and { TimeToMaxEnergy() < 1 or BuffPresent(berserk_cat_buff) or BuffPresent(incarnation_king_of_the_jungle_buff) or BuffPresent(elunes_guidance_buff) or SpellCooldown(tigers_fury) < 3 or ArmorSetBonus(T18 4) or BuffPresent(clearcasting_buff) and Energy() > 65 or Talent(soul_of_the_forest_talent) or not target.DebuffPresent(rip_debuff) or target.DebuffRemaining(rake_debuff) < 1.5 and Enemies() < 6 } and Spell(rip) or { BuffRemaining(savage_roar_buff) <= 10.5 and Talent(jagged_wounds_talent) or BuffRemaining(savage_roar_buff) <= 7.2 } and ComboPoints() == 5 and { TimeToMaxEnergy() < 1 or BuffPresent(berserk_cat_buff) or BuffPresent(incarnation_king_of_the_jungle_buff) or BuffPresent(elunes_guidance_buff) or SpellCooldown(tigers_fury) < 3 or ArmorSetBonus(T18 4) or BuffPresent(clearcasting_buff) and Energy() > 65 or Talent(soul_of_the_forest_talent) or not target.DebuffPresent(rip_debuff) or target.DebuffRemaining(rake_debuff) < 1.5 and Enemies() < 6 } and Spell(savage_roar) or ComboPoints() == 5 and { Enemies() >= 6 or Enemies() >= 3 and not Talent(bloodtalons_talent) } and ComboPoints() == 5 and { TimeToMaxEnergy() < 1 or BuffPresent(berserk_cat_buff) or BuffPresent(incarnation_king_of_the_jungle_buff) or BuffPresent(elunes_guidance_buff) or SpellCooldown(tigers_fury) < 3 or ArmorSetBonus(T18 4) or Talent(moment_of_clarity_talent) and BuffPresent(clearcasting_buff) } and Spell(swipe_cat) or ComboPoints() == 5 and BuffPresent(fiery_red_maimers_buff) and { TimeToMaxEnergy() < 1 or BuffPresent(berserk_cat_buff) or BuffPresent(incarnation_king_of_the_jungle_buff) or BuffPresent(elunes_guidance_buff) or SpellCooldown(tigers_fury) < 3 } and Spell(maim) or Energy() >= EnergyCost(ferocious_bite max=1) and ComboPoints() == 5 and { TimeToMaxEnergy() < 1 or BuffPresent(berserk_cat_buff) or BuffPresent(incarnation_king_of_the_jungle_buff) or BuffPresent(elunes_guidance_buff) or SpellCooldown(tigers_fury) < 3 } and Spell(ferocious_bite) } } }
}
### actions.generator
AddFunction FeralGeneratorMainActions
{
#brutal_slash,if=spell_targets.brutal_slash>desired_targets&combo_points<5
if Enemies() > Enemies(tagged=1) and ComboPoints() < 5 Spell(brutal_slash)
#pool_resource,if=talent.elunes_guidance.enabled&combo_points=0&energy<action.ferocious_bite.cost+25-energy.regen*cooldown.elunes_guidance.remains
unless Talent(elunes_guidance_talent) and ComboPoints() == 0 and Energy() < PowerCost(ferocious_bite) + 25 - EnergyRegenRate() * SpellCooldown(elunes_guidance)
{
#pool_resource,for_next=1
#thrash_cat,if=talent.brutal_slash.enabled&spell_targets.thrash_cat>=9
if Talent(brutal_slash_talent) and Enemies() >= 9 Spell(thrash_cat)
unless Talent(brutal_slash_talent) and Enemies() >= 9 and SpellUsable(thrash_cat) and SpellCooldown(thrash_cat) < TimeToEnergyFor(thrash_cat)
{
#pool_resource,for_next=1
#swipe_cat,if=spell_targets.swipe_cat>=6
if Enemies() >= 6 Spell(swipe_cat)
unless Enemies() >= 6 and SpellUsable(swipe_cat) and SpellCooldown(swipe_cat) < TimeToEnergyFor(swipe_cat)
{
#pool_resource,for_next=1
#rake,cycle_targets=1,if=combo_points<5&(!ticking|(!talent.bloodtalons.enabled&remains<duration*0.3)|(talent.bloodtalons.enabled&buff.bloodtalons.up&(!talent.soul_of_the_forest.enabled&remains<=7|remains<=5)&persistent_multiplier>dot.rake.pmultiplier*0.80))&target.time_to_die-remains>tick_time
if ComboPoints() < 5 and { not target.DebuffPresent(rake_debuff) or not Talent(bloodtalons_talent) and target.DebuffRemaining(rake_debuff) < BaseDuration(rake_debuff) * 0.3 or Talent(bloodtalons_talent) and BuffPresent(bloodtalons_buff) and { not Talent(soul_of_the_forest_talent) and target.DebuffRemaining(rake_debuff) <= 7 or target.DebuffRemaining(rake_debuff) <= 5 } and PersistentMultiplier(rake_debuff) > target.DebuffPersistentMultiplier(rake_debuff) * 0.8 } and target.TimeToDie() - target.DebuffRemaining(rake_debuff) > target.TickTime(rake_debuff) Spell(rake)
unless ComboPoints() < 5 and { not target.DebuffPresent(rake_debuff) or not Talent(bloodtalons_talent) and target.DebuffRemaining(rake_debuff) < BaseDuration(rake_debuff) * 0.3 or Talent(bloodtalons_talent) and BuffPresent(bloodtalons_buff) and { not Talent(soul_of_the_forest_talent) and target.DebuffRemaining(rake_debuff) <= 7 or target.DebuffRemaining(rake_debuff) <= 5 } and PersistentMultiplier(rake_debuff) > target.DebuffPersistentMultiplier(rake_debuff) * 0.8 } and target.TimeToDie() - target.DebuffRemaining(rake_debuff) > target.TickTime(rake_debuff) and SpellUsable(rake) and SpellCooldown(rake) < TimeToEnergyFor(rake)
{
#moonfire_cat,cycle_targets=1,if=combo_points<5&remains<=4.2&target.time_to_die-remains>tick_time*2
if ComboPoints() < 5 and target.DebuffRemaining(moonfire_cat_debuff) <= 4.2 and target.TimeToDie() - target.DebuffRemaining(moonfire_cat_debuff) > target.TickTime(moonfire_cat_debuff) * 2 Spell(moonfire_cat)
#pool_resource,for_next=1
#thrash_cat,cycle_targets=1,if=remains<=duration*0.3&spell_targets.swipe_cat>=2
if target.DebuffRemaining(thrash_cat_debuff) <= BaseDuration(thrash_cat_debuff) * 0.3 and Enemies() >= 2 Spell(thrash_cat)
unless target.DebuffRemaining(thrash_cat_debuff) <= BaseDuration(thrash_cat_debuff) * 0.3 and Enemies() >= 2 and SpellUsable(thrash_cat) and SpellCooldown(thrash_cat) < TimeToEnergyFor(thrash_cat)
{
#brutal_slash,if=combo_points<5&((raid_event.adds.exists&raid_event.adds.in>(1+max_charges-charges_fractional)*15)|(!raid_event.adds.exists&(charges_fractional>2.66&time>10)))
if ComboPoints() < 5 and { False(raid_event_adds_exists) and 600 > { 1 + SpellMaxCharges(brutal_slash) - Charges(brutal_slash count=0) } * 15 or not False(raid_event_adds_exists) and Charges(brutal_slash count=0) > 2.66 and TimeInCombat() > 10 } Spell(brutal_slash)
#swipe_cat,if=combo_points<5&spell_targets.swipe_cat>=3
if ComboPoints() < 5 and Enemies() >= 3 Spell(swipe_cat)
#shred,if=combo_points<5&(spell_targets.swipe_cat<3|talent.brutal_slash.enabled)
if ComboPoints() < 5 and { Enemies() < 3 or Talent(brutal_slash_talent) } Spell(shred)
}
}
}
}
}
}
AddFunction FeralGeneratorMainPostConditions
{
}
AddFunction FeralGeneratorShortCdActions
{
unless Enemies() > Enemies(tagged=1) and ComboPoints() < 5 and Spell(brutal_slash)
{
#ashamanes_frenzy,if=combo_points<=2&buff.elunes_guidance.down&(buff.bloodtalons.up|!talent.bloodtalons.enabled)&(buff.savage_roar.up|!talent.savage_roar.enabled)
if ComboPoints() <= 2 and BuffExpires(elunes_guidance_buff) and { BuffPresent(bloodtalons_buff) or not Talent(bloodtalons_talent) } and { BuffPresent(savage_roar_buff) or not Talent(savage_roar_talent) } Spell(ashamanes_frenzy)
#pool_resource,if=talent.elunes_guidance.enabled&combo_points=0&energy<action.ferocious_bite.cost+25-energy.regen*cooldown.elunes_guidance.remains
unless Talent(elunes_guidance_talent) and ComboPoints() == 0 and Energy() < PowerCost(ferocious_bite) + 25 - EnergyRegenRate() * SpellCooldown(elunes_guidance)
{
#elunes_guidance,if=talent.elunes_guidance.enabled&combo_points=0&energy>=action.ferocious_bite.cost+25
if Talent(elunes_guidance_talent) and ComboPoints() == 0 and Energy() >= PowerCost(ferocious_bite) + 25 Spell(elunes_guidance)
}
}
}
AddFunction FeralGeneratorShortCdPostConditions
{
Enemies() > Enemies(tagged=1) and ComboPoints() < 5 and Spell(brutal_slash) or not { Talent(elunes_guidance_talent) and ComboPoints() == 0 and Energy() < PowerCost(ferocious_bite) + 25 - EnergyRegenRate() * SpellCooldown(elunes_guidance) } and { Talent(brutal_slash_talent) and Enemies() >= 9 and Spell(thrash_cat) or not { Talent(brutal_slash_talent) and Enemies() >= 9 and SpellUsable(thrash_cat) and SpellCooldown(thrash_cat) < TimeToEnergyFor(thrash_cat) } and { Enemies() >= 6 and Spell(swipe_cat) or not { Enemies() >= 6 and SpellUsable(swipe_cat) and SpellCooldown(swipe_cat) < TimeToEnergyFor(swipe_cat) } and { ComboPoints() < 5 and { not target.DebuffPresent(rake_debuff) or not Talent(bloodtalons_talent) and target.DebuffRemaining(rake_debuff) < BaseDuration(rake_debuff) * 0.3 or Talent(bloodtalons_talent) and BuffPresent(bloodtalons_buff) and { not Talent(soul_of_the_forest_talent) and target.DebuffRemaining(rake_debuff) <= 7 or target.DebuffRemaining(rake_debuff) <= 5 } and PersistentMultiplier(rake_debuff) > target.DebuffPersistentMultiplier(rake_debuff) * 0.8 } and target.TimeToDie() - target.DebuffRemaining(rake_debuff) > target.TickTime(rake_debuff) and Spell(rake) or not { ComboPoints() < 5 and { not target.DebuffPresent(rake_debuff) or not Talent(bloodtalons_talent) and target.DebuffRemaining(rake_debuff) < BaseDuration(rake_debuff) * 0.3 or Talent(bloodtalons_talent) and BuffPresent(bloodtalons_buff) and { not Talent(soul_of_the_forest_talent) and target.DebuffRemaining(rake_debuff) <= 7 or target.DebuffRemaining(rake_debuff) <= 5 } and PersistentMultiplier(rake_debuff) > target.DebuffPersistentMultiplier(rake_debuff) * 0.8 } and target.TimeToDie() - target.DebuffRemaining(rake_debuff) > target.TickTime(rake_debuff) and SpellUsable(rake) and SpellCooldown(rake) < TimeToEnergyFor(rake) } and { ComboPoints() < 5 and target.DebuffRemaining(moonfire_cat_debuff) <= 4.2 and target.TimeToDie() - target.DebuffRemaining(moonfire_cat_debuff) > target.TickTime(moonfire_cat_debuff) * 2 and Spell(moonfire_cat) or target.DebuffRemaining(thrash_cat_debuff) <= BaseDuration(thrash_cat_debuff) * 0.3 and Enemies() >= 2 and Spell(thrash_cat) or not { target.DebuffRemaining(thrash_cat_debuff) <= BaseDuration(thrash_cat_debuff) * 0.3 and Enemies() >= 2 and SpellUsable(thrash_cat) and SpellCooldown(thrash_cat) < TimeToEnergyFor(thrash_cat) } and { ComboPoints() < 5 and { False(raid_event_adds_exists) and 600 > { 1 + SpellMaxCharges(brutal_slash) - Charges(brutal_slash count=0) } * 15 or not False(raid_event_adds_exists) and Charges(brutal_slash count=0) > 2.66 and TimeInCombat() > 10 } and Spell(brutal_slash) or ComboPoints() < 5 and Enemies() >= 3 and Spell(swipe_cat) or ComboPoints() < 5 and { Enemies() < 3 or Talent(brutal_slash_talent) } and Spell(shred) } } } } }
}
AddFunction FeralGeneratorCdActions
{
unless Enemies() > Enemies(tagged=1) and ComboPoints() < 5 and Spell(brutal_slash) or ComboPoints() <= 2 and BuffExpires(elunes_guidance_buff) and { BuffPresent(bloodtalons_buff) or not Talent(bloodtalons_talent) } and { BuffPresent(savage_roar_buff) or not Talent(savage_roar_talent) } and Spell(ashamanes_frenzy)
{
#pool_resource,if=talent.elunes_guidance.enabled&combo_points=0&energy<action.ferocious_bite.cost+25-energy.regen*cooldown.elunes_guidance.remains
unless Talent(elunes_guidance_talent) and ComboPoints() == 0 and Energy() < PowerCost(ferocious_bite) + 25 - EnergyRegenRate() * SpellCooldown(elunes_guidance)
{
unless Talent(elunes_guidance_talent) and ComboPoints() == 0 and Energy() >= PowerCost(ferocious_bite) + 25 and Spell(elunes_guidance)
{
#pool_resource,for_next=1
#thrash_cat,if=talent.brutal_slash.enabled&spell_targets.thrash_cat>=9
unless Talent(brutal_slash_talent) and Enemies() >= 9 and SpellUsable(thrash_cat) and SpellCooldown(thrash_cat) < TimeToEnergyFor(thrash_cat)
{
#pool_resource,for_next=1
#swipe_cat,if=spell_targets.swipe_cat>=6
unless Enemies() >= 6 and SpellUsable(swipe_cat) and SpellCooldown(swipe_cat) < TimeToEnergyFor(swipe_cat)
{
#shadowmeld,if=combo_points<5&energy>=action.rake.cost&dot.rake.pmultiplier<2.1&buff.tigers_fury.up&(buff.bloodtalons.up|!talent.bloodtalons.enabled)&(!talent.incarnation.enabled|cooldown.incarnation.remains>18)&!buff.incarnation.up
if ComboPoints() < 5 and Energy() >= PowerCost(rake) and target.DebuffPersistentMultiplier(rake_debuff) < 2.1 and BuffPresent(tigers_fury_buff) and { BuffPresent(bloodtalons_buff) or not Talent(bloodtalons_talent) } and { not Talent(incarnation_talent) or SpellCooldown(incarnation_king_of_the_jungle) > 18 } and not BuffPresent(incarnation_king_of_the_jungle_buff) Spell(shadowmeld)
}
}
}
}
}
}
AddFunction FeralGeneratorCdPostConditions
{
Enemies() > Enemies(tagged=1) and ComboPoints() < 5 and Spell(brutal_slash) or ComboPoints() <= 2 and BuffExpires(elunes_guidance_buff) and { BuffPresent(bloodtalons_buff) or not Talent(bloodtalons_talent) } and { BuffPresent(savage_roar_buff) or not Talent(savage_roar_talent) } and Spell(ashamanes_frenzy) or not { Talent(elunes_guidance_talent) and ComboPoints() == 0 and Energy() < PowerCost(ferocious_bite) + 25 - EnergyRegenRate() * SpellCooldown(elunes_guidance) } and { Talent(elunes_guidance_talent) and ComboPoints() == 0 and Energy() >= PowerCost(ferocious_bite) + 25 and Spell(elunes_guidance) or not { Talent(brutal_slash_talent) and Enemies() >= 9 and SpellUsable(thrash_cat) and SpellCooldown(thrash_cat) < TimeToEnergyFor(thrash_cat) } and not { Enemies() >= 6 and SpellUsable(swipe_cat) and SpellCooldown(swipe_cat) < TimeToEnergyFor(swipe_cat) } and { ComboPoints() < 5 and { not target.DebuffPresent(rake_debuff) or not Talent(bloodtalons_talent) and target.DebuffRemaining(rake_debuff) < BaseDuration(rake_debuff) * 0.3 or Talent(bloodtalons_talent) and BuffPresent(bloodtalons_buff) and { not Talent(soul_of_the_forest_talent) and target.DebuffRemaining(rake_debuff) <= 7 or target.DebuffRemaining(rake_debuff) <= 5 } and PersistentMultiplier(rake_debuff) > target.DebuffPersistentMultiplier(rake_debuff) * 0.8 } and target.TimeToDie() - target.DebuffRemaining(rake_debuff) > target.TickTime(rake_debuff) and Spell(rake) or not { ComboPoints() < 5 and { not target.DebuffPresent(rake_debuff) or not Talent(bloodtalons_talent) and target.DebuffRemaining(rake_debuff) < BaseDuration(rake_debuff) * 0.3 or Talent(bloodtalons_talent) and BuffPresent(bloodtalons_buff) and { not Talent(soul_of_the_forest_talent) and target.DebuffRemaining(rake_debuff) <= 7 or target.DebuffRemaining(rake_debuff) <= 5 } and PersistentMultiplier(rake_debuff) > target.DebuffPersistentMultiplier(rake_debuff) * 0.8 } and target.TimeToDie() - target.DebuffRemaining(rake_debuff) > target.TickTime(rake_debuff) and SpellUsable(rake) and SpellCooldown(rake) < TimeToEnergyFor(rake) } and { ComboPoints() < 5 and target.DebuffRemaining(moonfire_cat_debuff) <= 4.2 and target.TimeToDie() - target.DebuffRemaining(moonfire_cat_debuff) > target.TickTime(moonfire_cat_debuff) * 2 and Spell(moonfire_cat) or target.DebuffRemaining(thrash_cat_debuff) <= BaseDuration(thrash_cat_debuff) * 0.3 and Enemies() >= 2 and Spell(thrash_cat) or not { target.DebuffRemaining(thrash_cat_debuff) <= BaseDuration(thrash_cat_debuff) * 0.3 and Enemies() >= 2 and SpellUsable(thrash_cat) and SpellCooldown(thrash_cat) < TimeToEnergyFor(thrash_cat) } and { ComboPoints() < 5 and { False(raid_event_adds_exists) and 600 > { 1 + SpellMaxCharges(brutal_slash) - Charges(brutal_slash count=0) } * 15 or not False(raid_event_adds_exists) and Charges(brutal_slash count=0) > 2.66 and TimeInCombat() > 10 } and Spell(brutal_slash) or ComboPoints() < 5 and Enemies() >= 3 and Spell(swipe_cat) or ComboPoints() < 5 and { Enemies() < 3 or Talent(brutal_slash_talent) } and Spell(shred) } } } }
}
### actions.precombat
AddFunction FeralPrecombatMainActions
{
#flask,type=flask_of_the_seventh_demon
#food,type=nightborne_delicacy_platter
#augmentation,type=defiled
#regrowth,if=talent.bloodtalons.enabled
if Talent(bloodtalons_talent) Spell(regrowth)
#cat_form
Spell(cat_form)
}
AddFunction FeralPrecombatMainPostConditions
{
}
AddFunction FeralPrecombatShortCdActions
{
unless Talent(bloodtalons_talent) and Spell(regrowth) or Spell(cat_form)
{
#prowl
Spell(prowl)
}
}
AddFunction FeralPrecombatShortCdPostConditions
{
Talent(bloodtalons_talent) and Spell(regrowth) or Spell(cat_form)
}
AddFunction FeralPrecombatCdActions
{
unless Talent(bloodtalons_talent) and Spell(regrowth) or Spell(cat_form)
{
#snapshot_stats
#potion,name=old_war
if CheckBoxOn(opt_use_consumables) and target.Classification(worldboss) Item(old_war_potion usable=1)
}
}
AddFunction FeralPrecombatCdPostConditions
{
Talent(bloodtalons_talent) and Spell(regrowth) or Spell(cat_form)
}
### actions.sbt_opener
AddFunction FeralSbtOpenerMainActions
{
#regrowth,if=talent.bloodtalons.enabled&combo_points=5&!buff.bloodtalons.up&!dot.rip.ticking
if Talent(bloodtalons_talent) and ComboPoints() == 5 and not BuffPresent(bloodtalons_buff) and not target.DebuffPresent(rip_debuff) Spell(regrowth)
}
AddFunction FeralSbtOpenerMainPostConditions
{
}
AddFunction FeralSbtOpenerShortCdActions
{
unless Talent(bloodtalons_talent) and ComboPoints() == 5 and not BuffPresent(bloodtalons_buff) and not target.DebuffPresent(rip_debuff) and Spell(regrowth)
{
#tigers_fury,if=!dot.rip.ticking&combo_points=5
if not target.DebuffPresent(rip_debuff) and ComboPoints() == 5 Spell(tigers_fury)
}
}
AddFunction FeralSbtOpenerShortCdPostConditions
{
Talent(bloodtalons_talent) and ComboPoints() == 5 and not BuffPresent(bloodtalons_buff) and not target.DebuffPresent(rip_debuff) and Spell(regrowth)
}
AddFunction FeralSbtOpenerCdActions
{
}
AddFunction FeralSbtOpenerCdPostConditions
{
Talent(bloodtalons_talent) and ComboPoints() == 5 and not BuffPresent(bloodtalons_buff) and not target.DebuffPresent(rip_debuff) and Spell(regrowth)
}
### Feral icons.
AddCheckBox(opt_druid_feral_aoe L(AOE) default specialization=feral)
AddIcon checkbox=!opt_druid_feral_aoe enemies=1 help=shortcd specialization=feral
{
if not InCombat() FeralPrecombatShortCdActions()
unless not InCombat() and FeralPrecombatShortCdPostConditions()
{
FeralDefaultShortCdActions()
}
}
AddIcon checkbox=opt_druid_feral_aoe help=shortcd specialization=feral
{
if not InCombat() FeralPrecombatShortCdActions()
unless not InCombat() and FeralPrecombatShortCdPostConditions()
{
FeralDefaultShortCdActions()
}
}
AddIcon enemies=1 help=main specialization=feral
{
if not InCombat() FeralPrecombatMainActions()
unless not InCombat() and FeralPrecombatMainPostConditions()
{
FeralDefaultMainActions()
}
}
AddIcon checkbox=opt_druid_feral_aoe help=aoe specialization=feral
{
if not InCombat() FeralPrecombatMainActions()
unless not InCombat() and FeralPrecombatMainPostConditions()
{
FeralDefaultMainActions()
}
}
AddIcon checkbox=!opt_druid_feral_aoe enemies=1 help=cd specialization=feral
{
if not InCombat() FeralPrecombatCdActions()
unless not InCombat() and FeralPrecombatCdPostConditions()
{
FeralDefaultCdActions()
}
}
AddIcon checkbox=opt_druid_feral_aoe help=cd specialization=feral
{
if not InCombat() FeralPrecombatCdActions()
unless not InCombat() and FeralPrecombatCdPostConditions()
{
FeralDefaultCdActions()
}
}
### Required symbols
# ailuro_pouncers
# ashamanes_frenzy
# berserk_cat
# berserk_cat_buff
# bloodtalons_buff
# bloodtalons_talent
# brutal_slash
# brutal_slash_talent
# cat_form
# cat_form_buff
# clearcasting_buff
# dash
# displacer_beast
# displacer_beast_buff
# elunes_guidance
# elunes_guidance_buff
# elunes_guidance_talent
# ferocious_bite
# fiery_red_maimers_buff
# incarnation_king_of_the_jungle
# incarnation_king_of_the_jungle_buff
# incarnation_talent
# jagged_wounds_talent
# maim
# mangle
# mighty_bash
# moment_of_clarity_talent
# moonfire_cat
# moonfire_cat_debuff
# old_war_potion
# predatory_swiftness_buff
# prowl
# prowl_buff
# rake
# rake_debuff
# regrowth
# rip
# rip_debuff
# sabertooth_talent
# savage_roar
# savage_roar_buff
# savage_roar_talent
# shadowmeld
# shadowmeld_buff
# shred
# skull_bash
# soul_of_the_forest_talent
# swipe_cat
# t18_class_trinket
# thrash_cat
# thrash_cat_debuff
# tigers_fury
# tigers_fury_buff
# typhoon
# war_stomp
# wild_charge
# wild_charge_bear
# wild_charge_cat
]]
OvaleScripts:RegisterScript("DRUID", "feral", name, desc, code, "script")
end
do
local name = "simulationcraft_druid_guardian_t19p"
local desc = "[7.0] SimulationCraft: Druid_Guardian_T19P"
local code = [[
# Based on SimulationCraft profile "Druid_Guardian_T19P".
# class=druid
# spec=guardian
# talents=3323323
Include(ovale_common)
Include(ovale_trinkets_mop)
Include(ovale_trinkets_wod)
Include(ovale_druid_spells)
AddCheckBox(opt_interrupt L(interrupt) default specialization=guardian)
AddCheckBox(opt_melee_range L(not_in_melee_range) specialization=guardian)
AddFunction GuardianInterruptActions
{
if CheckBoxOn(opt_interrupt) and not target.IsFriend() and target.Casting()
{
if target.InRange(skull_bash) and target.IsInterruptible() Spell(skull_bash)
if target.InRange(mighty_bash) and not target.Classification(worldboss) Spell(mighty_bash)
if target.Distance(less 10) and not target.Classification(worldboss) Spell(incapacitating_roar)
if target.Distance(less 5) and not target.Classification(worldboss) Spell(war_stomp)
if target.Distance(less 15) and not target.Classification(worldboss) Spell(typhoon)
}
}
AddFunction GuardianUseItemActions
{
Item(Trinket0Slot text=13 usable=1)
Item(Trinket1Slot text=14 usable=1)
}
AddFunction GuardianGetInMeleeRange
{
if CheckBoxOn(opt_melee_range) and Stance(druid_bear_form) and not target.InRange(mangle) or { Stance(druid_cat_form) or Stance(druid_claws_of_shirvallah) } and not target.InRange(shred)
{
if target.InRange(wild_charge) Spell(wild_charge)
Texture(misc_arrowlup help=L(not_in_melee_range))
}
}
### actions.default
AddFunction GuardianDefaultMainActions
{
#frenzied_regeneration,if=incoming_damage_5s%health.max>=0.5|health<=health.max*0.4
if IncomingDamage(5) / MaxHealth() >= 0.5 or Health() <= MaxHealth() * 0.4 Spell(frenzied_regeneration)
#ironfur,if=(buff.ironfur.up=0)|(buff.gory_fur.up=1)|(rage>=80)
if BuffPresent(ironfur_buff) == 0 or BuffPresent(gory_fur_buff) == 1 or Rage() >= 80 Spell(ironfur)
#moonfire,if=buff.incarnation.up=1&dot.moonfire.remains<=4.8
if BuffPresent(incarnation_guardian_of_ursoc_buff) == 1 and target.DebuffRemaining(moonfire_debuff) <= 4.8 Spell(moonfire)
#thrash_bear,if=buff.incarnation.up=1&dot.thrash.remains<=4.5
if BuffPresent(incarnation_guardian_of_ursoc_buff) == 1 and target.DebuffRemaining(thrash_bear_debuff) <= 4.5 Spell(thrash_bear)
#mangle
Spell(mangle)
#thrash_bear
Spell(thrash_bear)
#pulverize,if=buff.pulverize.up=0|buff.pulverize.remains<=6
if { BuffPresent(pulverize_buff) == 0 or BuffRemaining(pulverize_buff) <= 6 } and target.DebuffGain(thrash_bear_debuff) <= BaseDuration(thrash_bear_debuff) Spell(pulverize)
#moonfire,if=buff.galactic_guardian.up=1&(!ticking|dot.moonfire.remains<=4.8)
if BuffPresent(galactic_guardian_buff) == 1 and { not target.DebuffPresent(moonfire_debuff) or target.DebuffRemaining(moonfire_debuff) <= 4.8 } Spell(moonfire)
#moonfire,if=buff.galactic_guardian.up=1
if BuffPresent(galactic_guardian_buff) == 1 Spell(moonfire)
#moonfire,if=dot.moonfire.remains<=4.8
if target.DebuffRemaining(moonfire_debuff) <= 4.8 Spell(moonfire)
#swipe_bear
Spell(swipe_bear)
}
AddFunction GuardianDefaultMainPostConditions
{
}
AddFunction GuardianDefaultShortCdActions
{
#auto_attack
GuardianGetInMeleeRange()
#rage_of_the_sleeper
Spell(rage_of_the_sleeper)
#lunar_beam
Spell(lunar_beam)
unless { IncomingDamage(5) / MaxHealth() >= 0.5 or Health() <= MaxHealth() * 0.4 } and Spell(frenzied_regeneration)
{
#bristling_fur,if=buff.ironfur.stack=1|buff.ironfur.down
if BuffStacks(ironfur_buff) == 1 or BuffExpires(ironfur_buff) Spell(bristling_fur)
}
}
AddFunction GuardianDefaultShortCdPostConditions
{
{ IncomingDamage(5) / MaxHealth() >= 0.5 or Health() <= MaxHealth() * 0.4 } and Spell(frenzied_regeneration) or { BuffPresent(ironfur_buff) == 0 or BuffPresent(gory_fur_buff) == 1 or Rage() >= 80 } and Spell(ironfur) or BuffPresent(incarnation_guardian_of_ursoc_buff) == 1 and target.DebuffRemaining(moonfire_debuff) <= 4.8 and Spell(moonfire) or BuffPresent(incarnation_guardian_of_ursoc_buff) == 1 and target.DebuffRemaining(thrash_bear_debuff) <= 4.5 and Spell(thrash_bear) or Spell(mangle) or Spell(thrash_bear) or { BuffPresent(pulverize_buff) == 0 or BuffRemaining(pulverize_buff) <= 6 } and target.DebuffGain(thrash_bear_debuff) <= BaseDuration(thrash_bear_debuff) and Spell(pulverize) or BuffPresent(galactic_guardian_buff) == 1 and { not target.DebuffPresent(moonfire_debuff) or target.DebuffRemaining(moonfire_debuff) <= 4.8 } and Spell(moonfire) or BuffPresent(galactic_guardian_buff) == 1 and Spell(moonfire) or target.DebuffRemaining(moonfire_debuff) <= 4.8 and Spell(moonfire) or Spell(swipe_bear)
}
AddFunction GuardianDefaultCdActions
{
#skull_bash
GuardianInterruptActions()
#blood_fury
Spell(blood_fury_apsp)
#berserking
Spell(berserking)
#arcane_torrent
Spell(arcane_torrent_energy)
#use_item,slot=trinket2
GuardianUseItemActions()
#incarnation
Spell(incarnation_guardian_of_ursoc)
}
AddFunction GuardianDefaultCdPostConditions
{
Spell(rage_of_the_sleeper) or Spell(lunar_beam) or { IncomingDamage(5) / MaxHealth() >= 0.5 or Health() <= MaxHealth() * 0.4 } and Spell(frenzied_regeneration) or { BuffPresent(ironfur_buff) == 0 or BuffPresent(gory_fur_buff) == 1 or Rage() >= 80 } and Spell(ironfur) or BuffPresent(incarnation_guardian_of_ursoc_buff) == 1 and target.DebuffRemaining(moonfire_debuff) <= 4.8 and Spell(moonfire) or BuffPresent(incarnation_guardian_of_ursoc_buff) == 1 and target.DebuffRemaining(thrash_bear_debuff) <= 4.5 and Spell(thrash_bear) or Spell(mangle) or Spell(thrash_bear) or { BuffPresent(pulverize_buff) == 0 or BuffRemaining(pulverize_buff) <= 6 } and target.DebuffGain(thrash_bear_debuff) <= BaseDuration(thrash_bear_debuff) and Spell(pulverize) or BuffPresent(galactic_guardian_buff) == 1 and { not target.DebuffPresent(moonfire_debuff) or target.DebuffRemaining(moonfire_debuff) <= 4.8 } and Spell(moonfire) or BuffPresent(galactic_guardian_buff) == 1 and Spell(moonfire) or target.DebuffRemaining(moonfire_debuff) <= 4.8 and Spell(moonfire) or Spell(swipe_bear)
}
### actions.precombat
AddFunction GuardianPrecombatMainActions
{
#flask,type=flask_of_the_seventh_demon
#food,type=azshari_salad
#augmentation,type=defiled
#bear_form
Spell(bear_form)
}
AddFunction GuardianPrecombatMainPostConditions
{
}
AddFunction GuardianPrecombatShortCdActions
{
}
AddFunction GuardianPrecombatShortCdPostConditions
{
Spell(bear_form)
}
AddFunction GuardianPrecombatCdActions
{
}
AddFunction GuardianPrecombatCdPostConditions
{
Spell(bear_form)
}
### Guardian icons.
AddCheckBox(opt_druid_guardian_aoe L(AOE) default specialization=guardian)
AddIcon checkbox=!opt_druid_guardian_aoe enemies=1 help=shortcd specialization=guardian
{
if not InCombat() GuardianPrecombatShortCdActions()
unless not InCombat() and GuardianPrecombatShortCdPostConditions()
{
GuardianDefaultShortCdActions()
}
}
AddIcon checkbox=opt_druid_guardian_aoe help=shortcd specialization=guardian
{
if not InCombat() GuardianPrecombatShortCdActions()
unless not InCombat() and GuardianPrecombatShortCdPostConditions()
{
GuardianDefaultShortCdActions()
}
}
AddIcon enemies=1 help=main specialization=guardian
{
if not InCombat() GuardianPrecombatMainActions()
unless not InCombat() and GuardianPrecombatMainPostConditions()
{
GuardianDefaultMainActions()
}
}
AddIcon checkbox=opt_druid_guardian_aoe help=aoe specialization=guardian
{
if not InCombat() GuardianPrecombatMainActions()
unless not InCombat() and GuardianPrecombatMainPostConditions()
{
GuardianDefaultMainActions()
}
}
AddIcon checkbox=!opt_druid_guardian_aoe enemies=1 help=cd specialization=guardian
{
if not InCombat() GuardianPrecombatCdActions()
unless not InCombat() and GuardianPrecombatCdPostConditions()
{
GuardianDefaultCdActions()
}
}
AddIcon checkbox=opt_druid_guardian_aoe help=cd specialization=guardian
{
if not InCombat() GuardianPrecombatCdActions()
unless not InCombat() and GuardianPrecombatCdPostConditions()
{
GuardianDefaultCdActions()
}
}
### Required symbols
# arcane_torrent_energy
# bear_form
# berserking
# blood_fury_apsp
# bristling_fur
# frenzied_regeneration
# galactic_guardian_buff
# gory_fur_buff
# incapacitating_roar
# incarnation_guardian_of_ursoc
# incarnation_guardian_of_ursoc_buff
# ironfur
# ironfur_buff
# lunar_beam
# mangle
# mighty_bash
# moonfire
# moonfire_debuff
# pulverize
# pulverize_buff
# rage_of_the_sleeper
# shred
# skull_bash
# swipe_bear
# thrash_bear
# thrash_bear_debuff
# typhoon
# war_stomp
# wild_charge
# wild_charge_bear
# wild_charge_cat
]]
OvaleScripts:RegisterScript("DRUID", "guardian", name, desc, code, "script")
end
|
-- Variables
Controlkey = {["generalChat"] = {245,"T"}}
RegisterNetEvent("event:control:update")
AddEventHandler("event:control:update", function(table)
Controlkey["generalChat"] = table["generalChat"]
end)
local chatInputActive = false
local chatInputActivating = false
local chatHidden = true
local chatLoaded = false
-- Functions
local function refreshThemes()
local themes = {}
for resIdx = 0, GetNumResources() - 1 do
local resource = GetResourceByFindIndex(resIdx)
if GetResourceState(resource) == "started" then
local numThemes = GetNumResourceMetadata(resource, "chat_theme")
if numThemes > 0 then
local themeName = GetResourceMetadata(resource, "chat_theme")
local themeData = json.decode(GetResourceMetadata(resource, "chat_theme_extra") or "null")
if themeName and themeData then
themeData.baseUrl = "nui://" .. resource .. "/"
themes[themeName] = themeData
end
end
end
end
SendNUIMessage({
type = "ON_UPDATE_THEMES",
themes = themes
})
end
-- Internal events
RegisterNetEvent("__cfx_internal:serverPrint")
AddEventHandler("__cfx_internal:serverPrint", function(msg)
print(msg)
SendNUIMessage({
type = "ON_MESSAGE",
message = {
color = { 0, 0, 0 },
multiline = true,
args = { msg }
}
})
end)
RegisterNetEvent("_chat:messageEntered")
-- NUI Callbacks
RegisterNUICallback("loaded", function(data, cb)
TriggerServerEvent("chat:init")
chatLoaded = true
refreshThemes()
cb("ok")
end)
RegisterNUICallback("chatResult", function(data, cb)
chatInputActive = false
SetNuiFocus(false)
TriggerServerEvent("caue-chat:texting", false)
if not data.canceled then
TriggerServerEvent("_chat:messageEntered", data.message)
end
cb("ok")
end)
-- Events
RegisterNetEvent("chatMessage")
AddEventHandler("chatMessage", function(author, color, text)
if color == 8 then
TriggerEvent("phone:addnotification",author,text)
return
end
local args = { text }
if author ~= "" then
table.insert(args, 1, author)
end
SendNUIMessage({
type = "ON_MESSAGE",
message = {
color = color,
multiline = true,
args = args
}
})
end)
RegisterNetEvent("chat:addMessage")
AddEventHandler("chat:addMessage", function(message)
SendNUIMessage({
type = "ON_MESSAGE",
message = message
})
end)
RegisterNetEvent("chat:addSuggestion")
AddEventHandler("chat:addSuggestion", function(name, help, params)
SendNUIMessage({
type = "ON_SUGGESTION_ADD",
suggestion = {
name = name,
help = help,
params = params or nil
}
})
end)
RegisterNetEvent("chat:addSuggestions")
AddEventHandler("chat:addSuggestions", function(suggestions)
for _, suggestion in ipairs(suggestions) do
SendNUIMessage({
type = "ON_SUGGESTION_ADD",
suggestion = suggestion
})
end
end)
RegisterNetEvent("chat:removeSuggestion")
AddEventHandler("chat:removeSuggestion", function(name)
SendNUIMessage({
type = "ON_SUGGESTION_REMOVE",
name = name
})
end)
RegisterNetEvent("chat:removeSuggestions")
AddEventHandler("chat:removeSuggestions", function()
SendNUIMessage({
type = "ON_SUGGESTION_REMOVE_ALL"
})
end)
RegisterNetEvent("chat:addTemplate")
AddEventHandler("chat:addTemplate", function(id, html)
SendNUIMessage({
type = "ON_TEMPLATE_ADD",
template = {
id = id,
html = html
}
})
end)
RegisterNetEvent("chat:close")
AddEventHandler("chat:close", function()
SendNUIMessage({
type = "ON_CLOSE_CHAT"
})
end)
RegisterNetEvent("chat:clear")
AddEventHandler("chat:clear", function()
SendNUIMessage({
type = "ON_CLEAR"
})
end)
-- Threads
Citizen.CreateThread(function()
SetTextChatEnabled(false)
SetNuiFocus(false)
chatInputActive = false
chatInputActivating = false
while true do
Wait(0)
if not chatInputActive then
if IsControlPressed(0,245) then
chatInputActive = true
chatInputActivating = true
TriggerServerEvent("caue-chat:texting", true)
SendNUIMessage({
type = "ON_OPEN"
})
end
end
if chatInputActivating then
if not IsControlPressed(0,245) then
SetNuiFocus(true)
chatInputActivating = false
end
end
if chatLoaded then
local shouldBeHidden = false
if IsScreenFadedOut() or IsPauseMenuActive() then
shouldBeHidden = true
end
if (shouldBeHidden and not chatHidden) or (not shouldBeHidden and chatHidden) then
chatHidden = shouldBeHidden
SendNUIMessage({
type = "ON_SCREEN_STATE_CHANGE",
shouldHide = shouldBeHidden
})
end
end
end
end) |
local KEY = {}
local KEY_INDEX = {}
function KEY:__index(key)
local metafunction = KEY_INDEX[key]
if metafunction ~= nil then
return metafunction
end
local selfdata = rawget(self, key)
if selfdata ~= nil then
return selfdata
end
return KEY_INDEX.Find(self, key)
end
function KEY:__newindex(key, value)
KEY_INDEX.Add(self, key, value)
end
function KEY_INDEX:GetName()
return self.name
end
function KEY_INDEX:Add(index, data)
local pos, unique = self:Find(data)
if pos ~= nil then
return false
end
self.lookup[index] = unique
self.lookup[unique] = index
return true, unique
end
function KEY_INDEX:Remove(index)
if self.lookup[index] == nil then
return false
end
local unique
if isnumber(index) then
unique = self.lookup[index]
else
unique = index
index = self.lookup[unique]
end
self.lookup[index] = nil
self.lookup[unique] = nil
return true
end
function KEY_INDEX:Find(data)
local unique = self:GetUnique(data)
return unique ~= nil and self.lookup[unique] or nil, unique
end
function KEY_INDEX:GetUnique(data)
local unique
for i = 1, #self.columns do
local column = self.columns[i]
local piece = data[column:GetName()] or (column:IsOptional() and column:GetDefault() or nil)
if piece == nil then
return
end
piece = tostring(piece)
if unique ~= nil then
unique = unique .. "/" .. piece
else
unique = piece
end
end
return unique
end
function KEY_INDEX:GetColumns()
return self.columns
end
function KEY_INDEX:GetColumn(index)
return self.columns[index]
end
return KEY
|
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName = "bp_base"
ENT.Spawnable = false
ENT.Category = "Blue's Pharmaceuticals"
function ENT:SetupDataTables()
self:NetworkVar("Entity", 1, "owning_ent")
end |
---@class LegacyModule: ModuleBase
local LegacyModule = ModuleBase:createModule('Legacy');
LegacyModule.sharedContext = {
string = {},
table = {},
VaildChar = Char.IsValidCharIndex,
NL = {},
Char = {},
Battle = {},
Item = {},
Pet = {},
Recipe = {},
Field = {},
Data = {},
NLG = {},
Protocol = {},
Obj = {},
SQL = {},
};
local sharedContext = LegacyModule.sharedContext;
function LegacyModule:loadFile(file, cb, name)
if not cb then
self:logError('callback is null', name, file, cb);
error('callback is null');
end
if file then
local moduleName = findLegacyModuleName(file);
if not moduleName then
loadModule(moduleName or file, { path = file, simpleModule = true, forceReload = true, absolutePath = true });
end
end
local key = '__callInCtx' .. cb;
_G[key] = function(...)
return self:callInCtx(cb, ...);
end
return key;
end
function LegacyModule:callInCtx(name, ...)
return self.sharedContext[name](...)
end
sharedContext.NL.CreateNpc = function(file, cb)
return NL.CreateNpc(nil, LegacyModule:loadFile(file, cb, 'NL.CreateNpc'));
end
sharedContext.Protocol.OnRecv = function(file, cb, header)
return Protocol.OnRecv(nil, LegacyModule:loadFile(file, cb, 'Protocol.OnRecv'), header);
end
for f, n in pairs({ Char = Char, Battle = Battle }) do
for i, v in pairs(n) do
if string.sub(i, 1, 3) == 'Set' and string.sub(i, #i - 4) == 'Event' then
sharedContext[f][i] = function(file, cb, ...)
return v(nil, LegacyModule:loadFile(file, cb, string.format('%s.%s', f, i)), ...)
end
end
end
end
for i, v in pairs(NL) do
if string.sub(i, 1, 3) == 'Reg' then
sharedContext.NL[i] = function(file, cb, ...)
return v(nil, LegacyModule:loadFile(file, cb, string.format('NL.%s', i)), ...)
end
end
end
sharedContext.string = setmetatable(sharedContext.string, { __index = string });
sharedContext.table = setmetatable(sharedContext.table, { __index = table });
sharedContext.NL = setmetatable(sharedContext.NL, { __index = NL });
sharedContext.Char = setmetatable(sharedContext.Char, { __index = Char });
sharedContext.Battle = setmetatable(sharedContext.Battle, { __index = Battle });
sharedContext.Item = setmetatable(sharedContext.Item, { __index = Item });
sharedContext.Pet = setmetatable(sharedContext.Pet, { __index = Pet });
sharedContext.Recipe = setmetatable(sharedContext.Recipe, { __index = Recipe });
sharedContext.Field = setmetatable(sharedContext.Field, { __index = Field });
sharedContext.Data = setmetatable(sharedContext.Data, { __index = Data });
sharedContext.NLG = setmetatable(sharedContext.NLG, { __index = NLG });
sharedContext.Protocol = setmetatable(sharedContext.Protocol, { __index = Protocol });
sharedContext.Obj = setmetatable(sharedContext.Obj, { __index = Obj });
sharedContext.SQL = setmetatable(sharedContext.SQL, { __index = SQL });
setmetatable(sharedContext, { __index = _G })
---@return LegacyModule
function LegacyModule:new(name)
---@type LegacyModule
local o = {};
setmetatable(o, LegacyModule)
o.name = LegacyModule.name .. ':' .. name;
o.rawName = name;
o.callbacks = {};
o.lastIx = 0;
o:createContext();
return o;
end
function LegacyModule:createDelegate()
local Delegate = {};
self.Delegate = Delegate;
for k, _ff in pairs(NL) do
if string.sub(k, 1, 3) == 'Reg' then
local key = string.sub(k, 4);
Delegate['RegDel' .. key] = function(fn)
if type(fn) == 'string' then
if self['_t_' .. key] then
return
end
self['_t_' .. key] = fn;
self:regCallback(key, function(...)
return self:callInCtx(fn, ...);
end)
elseif type(fn) == 'function' then
self:regCallback(key, fn);
end
end
Delegate['Reg' .. key] = Delegate['RegDel' .. key];
end
end
Delegate.RegProtocolOnRecv = function(callback, head)
local fn = callback
local key = 'ProtocolOnRecv'
if type(fn) == 'string' then
if self['_t_' .. key] then
return
end
self['_t_' .. key] = fn;
self:regCallback(key, function(...)
return self:callInCtx(fn, ...);
end, head)
elseif type(fn) == 'function' then
self:regCallback(key, fn, head);
end
end
Delegate.RegAllOutEvent = function(callback)
Delegate.RegLogoutEvent(callback);
Delegate.RegDropEvent(callback);
end
Delegate.RegDelAllOutEvent = Delegate.RegAllOutEvent
Delegate.RegDelProtocolOnRecv = Delegate.RegProtocolOnRecv;
return Delegate;
end
function LegacyModule:createContext()
self.context = {};
setmetatable(self.context, {
__index = self.sharedContext,
__newindex = function(table, key, value)
if rawget(table, key) then
rawset(table, key, value)
return
end
self.sharedContext[key] = value;
end
})
self.context.dofile = function(path)
return loadfile(path, 'bt', self.context)();
end
self.context.load = function(path, name, mode, env)
return load(path, name, mode or 'bt', env or self.context);
end
self.context.loadfile = function(path, mode, env)
return loadfile(path, mode or 'bt', env or self.context);
end
self.context.currentModule = self;
self.context.print = function(msg, ...)
if msg == nil then
msg = ''
end
self:logInfo(msg, ...)
end
self.context.Delegate = self:createDelegate();
end
function LegacyModule:onLoad()
self:logInfo('onLoad');
local r, msg = pcall(function()
local fn, m = loadfile(self.___aPath, 'bt', self.context);
if m then
error(m);
end
fn();
end)
if r == false then
self:logError('load error', msg);
end
end
function LegacyModule:onUnload()
self:logInfo('onUnload');
end
_G.LegacyModule = LegacyModule;
|
--
-- Created by IntelliJ IDEA.
-- User: qiang
-- Date: 2019/9/28
-- Time: 7:11 PM
-- To change this template use File | Settings | File Templates.
--
-- #######################调用案例##################################
--[[
local consulConfig = config.get('consul')
local client = consul:new(nil,consulConfig)
local result = {}
local time = ngx.time()
result.create = client:kvCreateDir("lion")
result.set = client:kvSet("lion/version","1.0.0")
result.set = client:kvSet("lion/version/t"..time,time)
result.getValue, result.getValueStatus = client:kvGetValue("lion/version/t1569747432")
result.get, result.getStatus = client:kvGet("lion/version/t1569747432")
result.getAll, result.getAllStatus = client:kvGetAll("lion")
result.delete = client:kvDelete("lion/version")
result.deleteDir = client:kvDeleteDir("lion")
result.serviceList, result.serviceListStatus = client:serviceList()
result.datacenterList, result.datacenterStatus = client:dcList()
result.nodeList, result.nodeListStatus = client:nodeList()
result.nodeListByName, result.nodeListByNameStatus = client:getNodeListByName("consul")
-- 定义服务
local service = {
ID= "40e4a748-2192-161a-0510-9bf59fe950b5",
Node= "foobar",
Address= "192.168.10.10",
TaggedAddresses = {
lan= "192.168.10.10",
wan= "10.0.10.10"
},
NodeMeta= {
somekey= "somevalue"
},
Service= {
ID= "redis1",
Service= "redis",
Tags= {
"primary",
"v1"
},
Address= "127.0.0.1",
TaggedAddresses= {
lan= {
address= "127.0.0.1",
port= 8000
},
wan= {
address= "198.18.0.1",
port= 80
}
},
Meta= {
redis_version= "4.0"
},
Port= 8000
},
Check = {
Node = "foobar",
CheckID = "service=redis1",
Name = "Redis health check",
Notes= "Script based health check",
Status= "passing",
ServiceID= "redis1",
Definition= {
TCP= "localhost=8888",
Interval= "5s",
Timeout= "1s",
DeregisterCriticalServiceAfter= "30s"
}
},
SkipNodeUpdate = false
};
result.register = client:register(service)
result.deregister = client:deregister("foobar")
json.encode(result)
]]
local http = require "lion.ext.http"
local Client = require "lion.client.client"
local ext = require "lion.extension"
local tableExt = require "lion.ext.table"
local json = require "cjson"
local _M = {
_VERSION = "1.0.0",
node = "http://127.0.0.1:8500",
datacenter = "dc1",
token = ""
}
---
-- @param client
-- @param config
--
function _M:new (client,config)
client = client or Client:new(client)
setmetatable(client, self)
self.__index = self
if config and ext.isTable(config) then
self = ext.block(self,config)
end
return client
end
--- 发送请求
-- @param method
-- @param path
-- @param params
-- @param header
--
function _M:request(method, path, params, header)
header = header or {}
if not ext.empty(self.token) then
header["X-Consul-Token"] = self.token
end
local url = self.node..path
return http.request(method,url,params,header)
end
--region #############################1.catalog操作###########################
--- 数据中心列表
--
function _M:dcList()
local status, body, headers = self:request("GET","/v1/catalog/datacenters")
if status ~= 200 then
return nil, false
end
return json.decode(body), true
end
--- 注册服务
--- @param params table
--- @example
--[[
{
ID= "40e4a748-2192-161a-0510-9bf59fe950b5",
Node= "foobar",
Address= "192.168.10.10",
TaggedAddresses = {
lan= "192.168.10.10",
wan= "10.0.10.10"
},
NodeMeta= {
somekey= "somevalue"
},
Service= {
ID= "redis1",
Service= "redis",
Tags= {
"primary",
"v1"
},
Address= "127.0.0.1",
TaggedAddresses= {
lan= {
address= "127.0.0.1",
port= 8000
},
wan= {
address= "198.18.0.1",
port= 80
}
},
Meta= {
redis_version= "4.0"
},
Port= 8000
},
Check = {
Node = "foobar",
CheckID = "service=redis1",
Name = "Redis health check",
Notes= "Script based health check",
Status= "passing",
ServiceID= "redis1",
Definition= {
TCP= "localhost=8888",
Interval= "5s",
Timeout= "1s",
DeregisterCriticalServiceAfter= "30s"
}
},
SkipNodeUpdate = false
}
]]
--
function _M:register(params)
params = params or {}
params = tableExt.merge({
Datacenter = self.datacenter
},params)
local status, body, headers = self:request("PUT", "/v1/catalog/register", json.encode(params))
return body == "true"
end
--- 服务注销
--- @param node string
--- @param params table
--
function _M:deregister(node, params)
params = params or {}
params.Node = node
params = tableExt.merge({
Datacenter = self.datacenter
},params)
local status, body, headers = self:request("PUT","/v1/catalog/deregister",json.encode(params))
return body == "true"
end
--- node列表
--- @param params table
--
function _M:nodeList(params)
params = params or {}
params = tableExt.merge({
dc = self.datacenter
},params)
local status, body, headers = self:request("GET","/v1/catalog/nodes",params)
if status ~= 200 then
return nil, false
end
return json.decode(body), true
end
--- service列表
--- @param params table
--
function _M:serviceList(params)
params = params or {}
params = tableExt.merge({
dc = self.datacenter
},params)
local status, body, headers = self:request("GET","/v1/catalog/services",params)
if status ~= 200 then
return nil, false
end
return json.decode(body), true
end
--- 根据服务名称获取节点列表
--- @param name string
--- @param params table
--
function _M:getNodeListByName(name,params)
params = params or {}
params = tableExt.merge({
dc = self.datacenter
},params)
local status, body, headers = self:request("GET","/v1/catalog/service/"..name,params)
if status ~= 200 then
return nil, false
end
return json.decode(body), true
end
--endregion
--region #############################2.kv操作##################################
---
--- @param key string
--- @param value any
--- @param params table
--
function _M:kvSet(key, value, params)
params = params or {}
params = tableExt.merge({
dc = self.datacenter
},params)
local status, body, headers = self:request("PUT", http.httpBuildQuery(params,"/v1/kv/"..key), value)
return body == "true"
end
--- 创建目录
--- @param dir string
--
function _M:kvCreateDir(dir)
if string.sub(dir,-1) ~= "/" then
dir = dir.."/"
end
return self:kvSet(dir)
end
---
--- @param key string
--- @param params table
--- @param decrypt boolean 是否自动解密
--
function _M:kvGet(key, params, decrypt)
params = params or {}
params = tableExt.merge({
dc = self.datacenter
},params)
local status, body, headers = self:request("GET", "/v1/kv/"..key, params)
if status ~= 200 then
return nil, false
end
local values = json.decode(body)
if decrypt == nil then
decrypt = true
end
if decrypt then
for k,value in pairs(values) do
if ext.empty(value["Value"]) then
values[ k ]["Value"] = "null"
else
values[ k ]["Value"] = ngx.decode_base64(value["Value"])
end
end
end
return values, true
end
---
--- @param key string
--
function _M:kvGetValue(key)
local values, status = self:kvGet(key)
-- 请求失败
if status == false then
return nil, false
end
if ext.empty(values) then
return values, true
end
return values[1]["Value"], true
end
--- 获取整个目录下所有值
--- @param dir string
--
function _M:kvGetAll(dir)
local values, status = self:kvGet(dir,{
recurse = 1
})
-- 请求失败
if status == false then
return nil, false
end
if ext.empty(values) then
return values, true
end
local kvList = {}
for key,value in pairs(values) do
kvList[ value["Key"] ] = value["Value"]
end
return kvList, true
end
--- 删除key
--- @param key string
--- @param params table
--
function _M:kvDelete(key, params)
params = params or {}
params = tableExt.merge({
dc = self.datacenter
},params)
local status, body, headers = self:request("DELETE", http.httpBuildQuery(params,"/v1/kv/"..key))
return body == "true"
end
--- 删除目录
--- @param dir string
--
function _M:kvDeleteDir(dir)
return self:kvDelete(dir,{
recurse = 1
})
end
--endregion
return _M
|
function Job.accumulate_results(results)
return function(err, data)
if data == nil then
if results[#results] == '' then
table.remove(results, #results)
end
return
end
if results[1] == nil then
results[1] = ''
end
-- Get rid of pesky \r
data = data:gsub("\r", "")
local line, start, found_newline
while true do
start = string.find(data, "\n") or #data
found_newline = string.find(data, "\n")
line = string.sub(data, 1, start)
data = string.sub(data, start + 1, -1)
line = line:gsub("\r", "")
line = line:gsub("\n", "")
results[#results] = (results[#results] or '') .. line
if found_newline then
table.insert(results, '')
else
break
end
end
-- if found_newline and results[#results] == '' then
-- table.remove(results, #results)
-- end
-- if string.find(data, "\n") then
-- for _, line in ipairs(vim.fn.split(data, "\n")) do
-- line = line:gsub("\n", "")
-- line = line:gsub("\r", "")
-- table.insert(results, line)
-- end
-- else
-- results[#results] = results[#results] .. data
-- end
end
end
|
local ffi = require 'ffiex.init'
local lib
-- initialize cc
local cc
local function error_callback(self, msg)
msg = ffi.string(msg)
-- print(msg)
if self.error then
self.error = (self.error .. "\n" .. msg)
else
self.error = msg
end
end
local function new_tcc()
if not lib then
-- import libtcc
ffi.cdef [[
//libtcc define following macro on runtime to adjust target platform
//it should be matched with luaJIT's. so make reverse definition.
#if !defined(__SIZE_TYPE__)
#define __SIZE_TYPE__ size_t
#endif
#if !defined(__PTRDIFF_TYPE__)
#define __PTRDIFF_TYPE__ ptrdiff_t
#endif
#if !defined(__WINT_TYPE__)
#define __WINT_TYPE__ wchar_t
#endif
#if !defined(__WCHAR_TYPE__)
#define __WCHAR_TYPE__ wchar_t
#endif
#include "libtcc.h"
]]
lib = ffi.load("tcc")
end
local state = lib.tcc_new()
lib.tcc_set_options(state, "-nostdlib")
lib.tcc_set_output_type(state, ffi.defs.TCC_OUTPUT_DLL)
lib.tcc_set_error_func(state, nil, function (opq, msg)
error_callback(cc, msg)
end)
return state
end
local function clear_option(self)
if self.state then
lib.tcc_delete(self.state)
end
self.state = new_tcc()
self.opts = nil
self.option_applied = nil
self.build_once = nil
end
--[[
options = {
path = {
include = { path1, path2, ... },
sys_include = { syspath1, syspath2, ... },
lib = { libpath1, libpath2, ... }
},
lib = { libname1, libname2, ... },
extra = { opt1, opt2, ... },
define = { booldef1, booldef2, ... def1 = val1, def2 = val2 }
}
]]
local function apply_option(self)
local opts = self.opts
if opts.path then
if type(opts.path.include) == 'table' then
for _,p in ipairs(opts.path.include) do
lib.tcc_add_include_path(self.state, p)
end
end
if type(opts.path.sys_include) == 'table' then
for _,p in ipairs(opts.path.sys_include) do
lib.tcc_add_sysinclude_path(self.state, p)
end
end
if type(opts.path.lib) == 'table' then
for _,p in ipairs(opts.path.lib) do
lib.tcc_add_library_path(self.state, p)
end
end
end
if type(opts.lib) == 'table' then
for _,l in ipairs(opts.lib) do
lib.tcc_add_library(self.state, l)
end
end
if type(opts.define) == 'table' then
for k,v in pairs(opts.define) do
if type(k) == 'number' then
lib.tcc_define_symbol(self.state, v, "")
else
lib.tcc_define_symbol(self.state, k, v)
end
end
end
if type(opts.extra) == 'table' then
lib.tcc_set_options(self.state, table.concat(opts.extra, " "))
end
end
cc = {}
-- define method
local builder = {}
function builder.new()
return setmetatable({}, {__index = cc})
end
function cc:init(state)
end
function cc:exit(state)
end
function cc:build(code)
if self.build_once then
if self.state then
lib.tcc_delete(self.state)
end
self.state = new_tcc()
self.build_once = nil
self.option_applied = nil
end
if not self.option_applied then
self.option_applied = true
apply_option(self)
end
if lib.tcc_compile_string(self.state, code) < 0 then
self.build_once = true
return nil, self.error
end
local tmp = os.tmpname()
if lib.tcc_output_file(self.state, tmp) < 0 then
self.build_once = true
return nil, "output error:to:"..tmp
end
self.build_once = true
return tmp, nil
end
function cc:option(opts)
clear_option(self)
self.opts = opts
end
function cc:get_option()
return self.opts
end
return builder
|
--[[
spoonacular API
The spoonacular Nutrition, Recipe, and Food API allows you to access over 380,000 recipes, thousands of ingredients, 800,000 food products, and 100,000 menu items. Our food ontology and semantic recipe search engine makes it possible to search for recipes using natural language queries, such as \"gluten free brownies without sugar\" or \"low fat vegan cupcakes.\" You can automatically calculate the nutritional information for any recipe, analyze recipe costs, visualize ingredient lists, find recipes for what's in your fridge, find recipes based on special diets, nutritional requirements, or favorite ingredients, classify recipes into types and cuisines, convert ingredient amounts, or even compute an entire meal plan. With our powerful API, you can create many kinds of food and especially nutrition apps. Special diets/dietary requirements currently available include: vegan, vegetarian, pescetarian, gluten free, grain free, dairy free, high protein, whole 30, low sodium, low carb, Paleo, ketogenic, FODMAP, and Primal.
The version of the OpenAPI document: 1.0
Contact: mail@spoonacular.com
Generated by: https://openapi-generator.tech
]]
-- inline_response_200_31_comparable_products class
local inline_response_200_31_comparable_products = {}
local inline_response_200_31_comparable_products_mt = {
__name = "inline_response_200_31_comparable_products";
__index = inline_response_200_31_comparable_products;
}
local function cast_inline_response_200_31_comparable_products(t)
return setmetatable(t, inline_response_200_31_comparable_products_mt)
end
local function new_inline_response_200_31_comparable_products(calories, likes, price, protein, spoonacular_score, sugar)
return cast_inline_response_200_31_comparable_products({
["calories"] = calories;
["likes"] = likes;
["price"] = price;
["protein"] = protein;
["spoonacularScore"] = spoonacular_score;
["sugar"] = sugar;
})
end
return {
cast = cast_inline_response_200_31_comparable_products;
new = new_inline_response_200_31_comparable_products;
}
|
-------------------- Vars --------------------
local AddOn = LibStub("AceAddon-3.0"):NewAddon("TalentProfiles", "AceConsole-3.0", "AceEvent-3.0", "AceHook-3.0");
local const__numTalentCols = 3 -- TODO: Get this from the API
local cdn, playerClass, cid = UnitClass("player"); -- playerClass is localisation independent
local isElvUILoaded = true
local isAUIRLoaded = false
local DB = {}
local E, L, P, G = unpack(ElvUI)
local S = E:GetModule("Skins")
local L = {}
--WOW API Cache
local GetSpecialization = GetSpecialization
local GetNumSpecializations = GetNumSpecializations
local GetMaxTalentTier = GetMaxTalentTier
local tinsert, tremove = table.insert, table.remove
local GetTalentInfo = GetTalentInfo
local GetActiveSpecGroup = GetActiveSpecGroup
local GetLocale = GetLocale
if GetLocale() == 'zhCN' then
L["Error: Too many talents selected"] = "错误:太多天赋被选项"
L["Added a new profile: "] = "添加新配置"
L["Unable to load the selected profile"] = "不能载入选择的配置"
L["Saved profile: "] = "保存配置"
L["Removed a profile: "] = "移除一个配置"
L["Enter Profile Name:"] = "输入配置名称:"
L["Save"] = "保存"
L["Cancel"] = "取消"
L["Do you want to remove the profile '%s'?"] = "你想移除配置文件 '%s'?"
L["Yes"] = "是"
L["No"] = "否"
L["Unable to load talent configuration for the selected profile"] = "不能截入选择配置中的天赋设置"
L["Activated profile: "] = "已激活配置: "
L["Add new profile"] = "添加新配置"
L["Apply"] = "应用"
L["Save"] = "保存"
L["Remove"] = "移除"
L["Migration: Starting"] = "迁移:开始"
L["Migration: Done: No specs found for this character"] = "迁移:当前角色无天赋"
L["Migration: Info: No profiles found for spec #"] = "迁移:当前专精无配置 #"
L["Migration: Info: Migrated profile "] = "迁移:合并配置 "
L["Migration: Done: Successfully migrated "] = "迁移:成功合并 "
elseif GetLocale() == 'zhTW' then
L["Error: Too many talents selected"] = "錯誤:太多天賦被選項"
L["Added a new profile: "] = "添加新配置"
L["Unable to load the selected profile"] = "不能載入選擇的配置"
L["Saved profile: "] = "保存配置"
L["Removed a profile: "] = "移除一個配置"
L["Enter Profile Name:"] = "輸入配置名稱:"
L["Save"] = "保存"
L["Cancel"] = "取消"
L["Do you want to remove the profile '%s'?"] = "你想移除設定檔 '%s'?"
L["Yes"] = "是"
L["No"] = "否"
L["Unable to load talent configuration for the selected profile"] = "不能截入選擇配置中的天賦設置"
L["Activated profile: "] = "已啟動配置: "
L["Add new profile"] = "添加新配置"
L["Apply"] = "應用"
L["Save"] = "保存"
L["Remove"] = "移除"
L["Migration: Starting"] = "遷移:開始"
L["Migration: Done: No specs found for this character"] = "遷移:當前角色無天賦"
L["Migration: Info: No profiles found for spec #"] = "遷移:當前專精無配置 #"
L["Migration: Info: Migrated profile "] = "遷移:合併配置 "
L["Migration: Done: Successfully migrated "] = "遷移:成功合併"
else
L["Error: Too many talents selected"] = "Error: Too many talents selected"
L["Added a new profile: "] = "Added a new profile: "
L["Unable to load the selected profile"] = "Unable to load the selected profile"
L["Saved profile: "] = "Saved profile: "
L["Removed a profile: "] = "Removed a profile: "
L["Enter Profile Name:"] = "Enter Profile Name:"
L["Save"] = "Save"
L["Cancel"] = "Cancel"
L["Do you want to remove the profile '%s'?"] = "Do you want to remove the profile '%s'?"
L["Yes"] = "Yes"
L["No"] = "No"
L["Unable to load talent configuration for the selected profile"] = "Unable to load talent configuration for the selected profile"
L["Activated profile: "] = "Activated profile: : "
L["Add new profile"] = "Add new profile"
L["Apply"] = "Apply"
L["Save"] = "Save"
L["Remove"] = "Remove"
L["Migration: Starting"] = "Migration: Starting"
L["Migration: Done: No specs found for this character"] = "Migration: Done: No specs found for this character"
L["Migration: Info: No profiles found for spec #"] = "Migration: Info: No profiles found for spec #"
L["Migration: Info: Migrated profile "] ="Migration: Info: Migrated profile "
L["Migration: Done: Successfully migrated "] = "Migration: Done: Successfully migrated "
end
-------------------- LUA Extensions --------------------
-- Prints all the key value pairs in the given table (See python's dir() function)
function dir(t)
for k, v in pairs(t) do
print(k, v)
end
end
-- Returns the length of the given table
function table.length(t)
local count = 0
for k, v in pairs(t) do
count = count + 1
end
return count
end
function AddOn:Print(msg, arg1) --by eui.cc
if L[msg] then
msg = L[msg]
end
if arg1 then
msg = msg.. arg1
end
print(msg)
end
---------- Database ----------
-- Ensure the database is valid
function DB:Verify()
-- Make sure the base DB table exists
if TalentProfilesGlobalDB == nil then TalentProfilesGlobalDB = {} end
-- Make sure the current class DB exists
if TalentProfilesGlobalDB[playerClass] == nil then TalentProfilesGlobalDB[playerClass] = {} end
-- Make sure the current class' specs table exists
if TalentProfilesGlobalDB[playerClass].specs == nil then TalentProfilesGlobalDB[playerClass].specs = {} end
-- Make sure each spec exists
for i = 1, GetNumSpecializations() do
-- Make sure the current spec's table exists
if TalentProfilesGlobalDB[playerClass].specs[i] == nil then TalentProfilesGlobalDB[playerClass].specs[i] = {} end
-- Make sure the profiles DB exists
if TalentProfilesGlobalDB[playerClass].specs[i].profiles == nil then TalentProfilesGlobalDB[playerClass].specs[i].profiles = {} end
end
end
-- Returns a profile at the given index
function DB:GetProfile(index)
return TalentProfilesGlobalDB[playerClass].specs[GetSpecialization()].profiles[index]
end
-- Returns a list of all profiles for the current spec
function DB:GetAllProfiles()
return TalentProfilesGlobalDB[playerClass].specs[GetSpecialization()].profiles
end
-- Inserts a new profile into the current spec's DB
function DB:InsertProfile(profile)
tinsert(TalentProfilesGlobalDB[playerClass].specs[GetSpecialization()].profiles, profile)
end
-- Removes the profile at the given index from the current spec's DB
function DB:RemoveProfile(index)
tremove(TalentProfilesGlobalDB[playerClass].specs[GetSpecialization()].profiles, index)
end
-- Returns the talent info for each talent the user currently has available
function GetTalentInfos()
local talentInfos = {}
local k = 1
for i = 1, GetMaxTalentTier() do
for j = 1, const__numTalentCols do
local talentID, name, texture, selected, available, spellid, tier, column = GetTalentInfo(i, j, GetActiveSpecGroup())
talentInfos[k] = { }
talentInfos[k].talentID = talentID
talentInfos[k].name = name
talentInfos[k].texture = texture
talentInfos[k].selected = selected
talentInfos[k].available = available
talentInfos[k].spellid = spellid
talentInfos[k].tier = tier
talentInfos[k].column = column
k = k + 1
end
end
return talentInfos
end
-- Adds a new profile to the database
function AddProfile(name)
-- Ensure the database is ready
DB:Verify()
-- Get basic info
local talentInfos = GetTalentInfos()
local profile = {}
profile.name = name
profile.talents = {}
-- Get the currently selected talents
local i = 1
for k, v in pairs(talentInfos) do
if v.selected == true then
profile.talents[i] = v.talentID
i = i + 1
end
end
-- Make sure the data is valid
if i > 8 then
AddOn:Print("Error: Too many talents selected")
end
-- Save the profile to the database
DB:InsertProfile(profile)
-- Rebuild the frame with the new data
BuildFrame()
-- Inform the user a profile was added
AddOn:Print("Added a new profile: '" .. profile.name .. "'")
end
-- Saves the current talent configuration to the current profile
function SaveProfile(index)
-- Don't try and save a profile that doesn't exist
if table.length(DB:GetAllProfiles()) == 0 then
return
end
-- Don't activate the placeholder profile
if index ~= "new" then
-- Get the profile, checking for errors on the way
local profile = DB:GetProfile(index)
if profile == nil then
AddOn:Print("Unable to load the selected profile")
return
end
-- Update the selected talents
local talentInfos = GetTalentInfos()
local i = 1
for k, v in pairs(talentInfos) do
if v.selected == true then
profile.talents[i] = v.talentID
i = i + 1
end
end
-- Inform the user a profile was activated
AddOn:Print("Saved profile: '" .. profile.name .. "'")
end
end
function PopupHandler_AddProfile(sender)
AddProfile(sender.editBox:GetText())
end
-- Remove a profile from the database
function RemoveProfile(index)
local key = nil
local i = 1
for k, v in pairs(DB:GetProfile(index)) do
if i == index then
key = k
end
i = i + 1
end
-- Cache the name
local name = DB:GetProfile(index).name
-- Remove the profile
DB:RemoveProfile(index)
BuildFrame()
-- Inform the user a profile was removed
AddOn:Print("Removed a profile: '" .. name .. "'")
end
function PopupHandler_RemoveProfile(sender)
RemoveProfile(TalentProfiles_profilesDropDown.selectedID)
end
-- Dialogue that enables the user to name a new profile
StaticPopupDialogs["TALENTPROFILES_ADD_PROFILE"] = {
text = L["Enter Profile Name:"],
button1 = L["Save"],
button2 = L["Cancel"],
OnAccept = PopupHandler_AddProfile,
timeout = 0,
whileDead = true,
hideOnEscape = true,
preferredIndex = 3,
hasEditBox = true,
}
function StaticPopupShow_Add()
StaticPopup_Show("TALENTPROFILES_ADD_PROFILE")
end
-- Dialogue that enables the user to confirm the removal of a profile
StaticPopupDialogs["TALENTPROFILES_REMOVE_PROFILE"] = {
text = L["Do you want to remove the profile '%s'?"],
button1 = L["Yes"],
button2 = L["No"],
OnAccept = PopupHandler_RemoveProfile,
timeout = 0,
whileDead = true,
hideOnEscape = true,
preferredIndex = 3,
}
function StaticPopupShow_Remove()
local index = TalentProfiles_profilesDropDown.selectedID
local name = DB:GetProfile(index).name
StaticPopup_Show("TALENTPROFILES_REMOVE_PROFILE", name)
end
-- Activates the profile at the given index
function ActivateProfile(index)
-- Don't activate the placeholder profile
if index ~= "new" then
-- Get the profile, checking for errors on the way
local profile = DB:GetProfile(index)
if profile == nil or profile.talents == nil then
AddOn:Print("Unable to load talent configuration for the selected profile")
return
end
for i = 1, GetMaxTalentTier() do
LearnTalent(profile.talents[i])
end
-- Inform the user a profile was activated
AddOn:Print("Activated profile: '" .. profile.name .. "'")
end
end
-------------------- TalentProfiles Event Handlers --------------------
-- Fired when the "Activate" button is clicked
function Handler_ActivateProfile(sender)
DB:Verify()
-- Check if any profiles exists
if table.length(DB:GetAllProfiles()) == 0 then
return
end
-- Activate the profile
ActivateProfile(TalentProfiles_profilesDropDown.selectedID)
end
-- Fired when the "Save" button is clicked
function Handler_SaveProfile(sender)
SaveProfile(TalentProfiles_profilesDropDown.selectedID)
end
-- Fired when the "Remove" button is clicked
function Handler_RemoveProfile(sender)
DB:Verify()
-- Check if any profiles exists
if table.length(DB:GetAllProfiles()) == 0 then
return
end
StaticPopupShow_Remove()
end
-------------------- Dropdown functions --------------------
function ProfilesDropDown_OnClick(sender)
UIDropDownMenu_SetSelectedID(TalentProfiles_profilesDropDown, sender:GetID())
end
function ProfilesDropDown_OnClick_NewProfile(sender)
StaticPopupShow_Add()
end
function ProfilesDropDown_Initialise(sender, level)
DB:Verify()
local items = DB:GetAllProfiles()
local i = 1
for k, v in pairs(items) do
local info = UIDropDownMenu_CreateInfo()
info.text = v.name
info.value = i
info.func = ProfilesDropDown_OnClick
UIDropDownMenu_AddButton(info, level)
i = i + 1
end
-- Add the new profile item
local info = UIDropDownMenu_CreateInfo()
info.text = " "..L["Add new profile"]
info.value = "new"
info.func = ProfilesDropDown_OnClick_NewProfile
info.rgb = { 1.0, 0.0, 1.0, 1.0 }
UIDropDownMenu_AddButton(info, level)
end
function BuildFrame()
local btn_sepX = 10
local btn_offsetY = 0
local btn_width = 80
local btn_height = 23
-- Set up main frame, if it doesnt already exist
local mainFrame = TalentProfiles_main
if TalentProfiles_main == nil then
mainFrame = CreateFrame("Frame", "TalentProfiles_main", PlayerTalentFrame)
mainFrame:SetSize(PlayerTalentFrame.TopTileStreaks:GetWidth(), PlayerTalentFrame.TopTileStreaks:GetHeight())
if isElvUILoaded then
mainFrame:SetPoint("CENTER", PlayerTalentFrame.TopTileStreaks, "CENTER", 0, 0)
else
mainFrame:SetPoint("TOPLEFT", PlayerTalentFrame.TopTileStreaks, "TOPLEFT", 45, -7)
end
end
-- Set up profiles dropdown, if it doesnt already exist
local dropdown = TalentProfiles_profilesDropDown
if TalentProfiles_profilesDropDown == nil then
dropdown = CreateFrame("Button", "TalentProfiles_profilesDropDown", TalentProfiles_main, "UIDropDownMenuTemplate")
if isElvUILoaded then
dropdown:SetPoint("TOPLEFT", TalentProfiles_main, "TOPLEFT", 100, -13)
-- elvui dropdown skinning is bugged and makes the arrow button far too wide
S:HandleDropDownBox(dropdown)
-- so make it the correct size
TalentProfiles_profilesDropDownButton:SetWidth(TalentProfiles_profilesDropDownButton:GetHeight())
-- and allow th euser to open the dropdown by clicking anywhere on the control
TalentProfiles_profilesDropDown:SetScript("OnClick", function(...) TalentProfiles_profilesDropDownButton:Click() end)
-- make the dropdown the same height as the buttons
TalentProfiles_profilesDropDown:SetHeight(btn_height)
else
UIDropDownMenu_SetWidth(dropdown, 125)
UIDropDownMenu_SetButtonWidth(dropdown, 125)
dropdown:SetPoint("TOPLEFT", TalentProfiles_main, "TOPLEFT", 0, 0)
end
end
-- Repopulate the dropdown, even if it already exists
UIDropDownMenu_Initialize(dropdown, ProfilesDropDown_Initialise)
UIDropDownMenu_SetSelectedID(dropdown, 1)
UIDropDownMenu_JustifyText(dropdown, "LEFT")
dropdown:Show()
-- Set up the action buttons
local btnApply = TalentProfiles_btnApply
if TalentProfiles_btnApply == nil then
btnApply = CreateFrame("Button", "TalentProfiles_btnApply", TalentProfiles_main, "UIPanelButtonTemplate")
btnApply:SetSize(btn_width, btn_height)
btnApply:SetText(L["Apply"])
if isElvUILoaded then
btnApply:SetPoint("TOPLEFT", dropdown, "TOPRIGHT", btn_sepX, -2)
S:HandleButton(btnApply)
else
btnApply:SetPoint("TOPLEFT", TalentProfiles_profilesDropDown, "TOPRIGHT", btn_sepX, -2)
end
btnApply:SetScript("OnClick", Handler_ActivateProfile)
btnApply:Show()
end
local btnSave = TalentProfiles_btnSave
if TalentProfiles_btnSave == nil then
btnSave = CreateFrame("Button", "TalentProfiles_btnSave", TalentProfiles_main, "UIPanelButtonTemplate")
btnSave:SetSize(btn_width, btn_height) -- was w100
btnSave:SetText(L["Save"])
if isElvUILoaded then
btnSave:SetPoint("TOPLEFT", btnApply, "TOPRIGHT", btn_sepX, 0)
S:HandleButton(btnSave)
else
btnSave:SetPoint("TOPLEFT", btnApply, "TOPRIGHT", btn_sepX, 0)
end
btnSave:SetScript("OnClick", Handler_SaveProfile)
btnSave:Show()
end
local btnRemove = TalentProfiles_btnRemove
if TalentProfiles_btnRemove == nil then
btnRemove = CreateFrame("Button", "TalentProfiles_btnRemove", TalentProfiles_main, "UIPanelButtonTemplate")
btnRemove:SetSize(btn_width, btn_height)
btnRemove:SetText(L["Remove"])
if isElvUILoaded then
btnRemove:SetPoint("TOPLEFT", btnSave, "TOPRIGHT", btn_sepX, 0)
S:HandleButton(btnRemove)
else
btnRemove:SetPoint("TOPLEFT", btnSave, "TOPRIGHT", btn_sepX, 0)
end
btnRemove:SetScript("OnClick", Handler_RemoveProfile)
btnRemove:Show()
end
end
-------------------- Wow API Events/Hooks --------------------
-- Fired when talent the talent frame is toggled
function AddOn:ToggleTalentFrame()
-- This is raw hooked, so call the origanal function
self.hooks.ToggleTalentFrame()
-- Don't continue if the player doesn't have a talent frame yet (under level 10)
if PlayerTalentFrame == nil then
return
end
local selectedTab = PanelTemplates_GetSelectedTab(PlayerTalentFrame)
if selectedTab == 2 then -- Only show when the talents tab is open
-- Build the frame
BuildFrame()
-- Set the visibility of the profile selector to that of the talent frame
TalentProfiles_main:SetShown(PlayerTalentFrame:IsVisible())
end
end
function AddOn:PanelTemplates_SetTab(...)
-- This is raw hooked, so call the origanal function
self.hooks.PanelTemplates_SetTab(...)
-- Don't continue if the player doesn't have a talent frame yet (under level 10)
if PlayerTalentFrame == nil then
return
end
local selectedTab = PanelTemplates_GetSelectedTab(PlayerTalentFrame)
if selectedTab == 2 then -- Only show when the talents tab is open
-- Build the frame
BuildFrame()
-- Set the visibility of the profile selector to that of the talent frame
TalentProfiles_main:Show()
else
if TalentProfiles_main ~= nil then
TalentProfiles_main:Hide()
end
end
end
-------------------- DB Migration --------------------
function DB:Migrate()
if TalentProfilesDB ~= nil then
AddOn:Print("Migration: Starting")
if TalentProfilesDB.specs == nil then
AddOn:Print("Migration: Done: No specs found for this character")
TalentProfilesDB = nil
return
end
local count = 0
for k_spec, spec in pairs(TalentProfilesDB.specs) do
if spec.profiles == nil then
AddOn:Print("Migration: Info: No profiles found for spec #" .. k)
else
for k_profile, profile in pairs(spec.profiles) do
table.insert(TalentProfilesGlobalDB[playerClass].specs[k_spec].profiles, profile)
AddOn:Print("Migration: Info: Migrated profile " .. profile.name)
count = count + 1
end
end
end
TalentProfilesDB = nil
AddOn:Print("Migration: Done: Successfully migrated " .. count .. " profiles")
end
end
-------------------- Ace Events --------------------
function AddOn:OnInitialize()
if IsAddOnLoaded("TalentProfiles") then return; end
if not E.db.euiscript.talentSetManager then return; end
-- Load DB
DB:Verify()
-- Migrate old DB
DB:Migrate()
-- Check if ElvUI or AUIR is Loaded
isAUIRLoaded = IsAddOnLoaded("ArwicUIRework")
isElvUILoaded = true
-- Hook functions
self:RawHook("ToggleTalentFrame", true)
self:RawHook("PanelTemplates_SetTab", true)
end
|
local fio = require('fio')
local t = require('luatest')
local g = t.group()
local helpers = require('test.helper')
g.before_each(function()
g.datadir = fio.tempdir()
g.cluster = helpers.Cluster:new({
datadir = g.datadir,
server_command = helpers.entrypoint('srv_basic'),
cookie = require('digest').urandom(6):hex(),
replicasets = {{
uuid = helpers.uuid('a'),
roles = {},
servers = {
{
alias = 'main',
instance_uuid = helpers.uuid('a', 'a', 1),
advertise_port = 13301,
http_port = 8081,
}
}
}}
})
end)
g.after_each(function()
g.cluster:stop()
fio.rmtree(g.datadir)
end)
function g.test_defaults()
g.cluster:start()
t.assert_items_equals(
fio.listdir(g.cluster.main_server.workdir),
{
'.tarantool.cookie', 'config',
'00000000000000000000.snap',
'00000000000000000000.xlog',
}
)
end
function g.test_abspath()
local memtx_dir = fio.pathjoin(g.datadir, 'memtx')
local vinyl_dir = fio.pathjoin(g.datadir, 'vinyl')
local wal_dir = fio.pathjoin(g.datadir, 'wal')
g.cluster.servers[1].env['TARANTOOL_VINYL_DIR'] = vinyl_dir
g.cluster.servers[1].env['TARANTOOL_MEMTX_DIR'] = memtx_dir
g.cluster.servers[1].env['TARANTOOL_WAL_DIR'] = wal_dir
g.cluster:start()
local workdir = g.cluster.main_server.workdir
t.assert_items_equals(
fio.listdir(g.datadir),
{'wal', 'memtx', 'vinyl', fio.basename(workdir), 'upload'}
)
t.assert_items_equals(
fio.listdir(workdir),
{'.tarantool.cookie', 'config'}
)
t.assert_equals(
fio.listdir(wal_dir),
{'00000000000000000000.xlog'}
)
t.assert_equals(
fio.listdir(memtx_dir),
{'00000000000000000000.snap'}
)
t.assert_equals(
fio.listdir(vinyl_dir),
{}
)
end
function g.test_relpath()
g.cluster.servers[1].env['TARANTOOL_VINYL_DIR'] = './vinyl'
g.cluster.servers[1].env['TARANTOOL_MEMTX_DIR'] = './memtx'
g.cluster.servers[1].env['TARANTOOL_WAL_DIR'] = 'wal'
g.cluster:start()
local workdir = g.cluster.main_server.workdir
t.assert_items_equals(
fio.listdir(workdir),
{'wal', 'config', 'memtx', 'vinyl', '.tarantool.cookie'}
)
t.assert_equals(
fio.listdir(fio.pathjoin(workdir, 'wal')),
{'00000000000000000000.xlog'}
)
t.assert_equals(
fio.listdir(fio.pathjoin(workdir, 'memtx')),
{'00000000000000000000.snap'}
)
t.assert_equals(
fio.listdir(fio.pathjoin(workdir, 'vinyl')),
{}
)
end
function g.test_chdir()
local chdir = fio.pathjoin(g.datadir, 'cd')
local wal_dir = fio.pathjoin(g.datadir, 'wal')
local memtx_dir = '../memtx'
g.cluster.servers[1].env['TARANTOOL_WAL_DIR'] = wal_dir
g.cluster.servers[1].env['TARANTOOL_MEMTX_DIR'] = memtx_dir
g.cluster.servers[1].env['TARANTOOL_WORK_DIR'] = chdir
g.cluster:start()
local workdir = g.cluster.main_server.workdir
t.assert_items_equals(
fio.listdir(g.datadir),
{'cd', 'wal', 'memtx', fio.basename(workdir), 'upload'}
)
t.assert_items_equals(
fio.listdir(workdir),
{'config', '.tarantool.cookie'}
)
t.assert_equals(
fio.listdir(chdir),
{}
)
t.assert_equals(
fio.listdir(wal_dir),
{'00000000000000000000.xlog'}
)
t.assert_equals(
fio.listdir(fio.pathjoin(g.datadir, 'memtx')),
{'00000000000000000000.snap'}
)
end
|
azura_gaze_of_exile = class({})
LinkLuaModifier( "modifier_azura_gaze_of_exile", "custom_abilities/azura_gaze_of_exile/modifier_azura_gaze_of_exile", LUA_MODIFIER_MOTION_NONE )
LinkLuaModifier( "modifier_azura_gaze_of_exile_buff", "custom_abilities/azura_gaze_of_exile/modifier_azura_gaze_of_exile_buff", LUA_MODIFIER_MOTION_NONE )
LinkLuaModifier( "modifier_azura_gaze_of_exile_debuff", "custom_abilities/azura_gaze_of_exile/modifier_azura_gaze_of_exile_debuff", LUA_MODIFIER_MOTION_NONE )
--------------------------------------------------------------------------------
-- Ability Start
function azura_gaze_of_exile:OnSpellStart()
-- unit identifier
caster = self:GetCaster()
target = self:GetCursorTarget()
point = self:GetCursorPosition()
-- load data
local duration_tooltip = self:GetSpecialValueFor("duration_tooltip")
-- Add modifier
target:AddNewModifier(
caster, -- player source
self, -- ability source
"modifier_azura_gaze_of_exile", -- modifier name
{ duration = duration_tooltip } -- kv
)
-- play effects
self:PlayEffects( target )
end
--------------------------------------------------------------------------------
function azura_gaze_of_exile:PlayEffects( target )
-- get resources
local sound_target = "Hero_Terrorblade.Sunder.Target"
-- play effects
-- local nFXIndex = ParticleManager:CreateParticle( particle_target, PATTACH_WORLDORIGIN, nil )
-- ParticleManager:SetParticleControl( nFXIndex, 0, target:GetOrigin() )
-- ParticleManager:SetParticleControl( nFXIndex, 1, target:GetOrigin() )
-- ParticleManager:ReleaseParticleIndex( nFXIndex )
-- play sounds
-- EmitSoundOnLocationWithCaster( vTargetPosition, sound_location, self:GetCaster() )
EmitSoundOn( sound_target, target )
end |
local ts_utils = require "nvim-treesitter.ts_utils"
local npairs = require "nvim-autopairs"
local cond = require "nvim-autopairs.conds"
local Rule = require "nvim-autopairs.rule"
local indent = require "modules.indent"
npairs.setup {
enable_check_bracket_line = false,
fast_wrap = {},
map_bs = false,
check_ts = true,
}
require("nvim-autopairs.completion.cmp").setup {
map_cr = true,
map_complete = true,
}
local function check_node_type(types, node)
local node_type = node:type()
local result = false
for _, type in pairs(types) do
if node_type == type then
result = true
break
end
end
return result
end
npairs.add_rules {
Rule(" ", " "):with_pair(function(options)
local pair = options.line:sub(options.col - 1, options.col)
return vim.tbl_contains({ "()", "{}", "[]" }, pair)
end),
Rule("( ", " )")
:with_pair(function(_)
return false
end)
:with_move(function(options)
return options.prev_char:match ".%)" ~= nil
end)
:use_key ")",
Rule("{ ", " }")
:with_pair(function(_)
return false
end)
:with_move(function(options)
return options.prev_char:match ".%}" ~= nil
end)
:use_key "}",
Rule('"""', '"""', "toml"),
Rule("[ ", " ]")
:with_pair(function(_)
return false
end)
:with_move(function(options)
return options.prev_char:match ".%]" ~= nil
end)
:use_key "}",
Rule("=", "")
:with_pair(cond.not_inside_quote())
:with_pair(function(options)
local last_char = options.line:sub(options.col - 1, options.col - 1)
return last_char:match "[%w%=%s]"
end)
:replace_endpair(function(options)
local previous_2char = options.line:sub(options.col - 2, options.col - 1)
local next_char = options.line:sub(options.col, options.col)
next_char = next_char == " " and "" or " "
local node = ts_utils.get_node_at_cursor()
local ft = vim.opt_local.filetype:get()
if ft == "python" and not O.python.spaces_between_default_param then
if check_node_type({ "parameters", "argument_list" }, node) then
return ""
end
elseif ft == "html" then
if check_node_type({ "start_tag", "fragment", "element" }, node) then
return ""
end
elseif ft == "vue" then
if node:type() == "component" then
return ""
end
elseif ft == "svelte" then
if check_node_type({ "document", "start_tag", "element" }, node) then
return ""
end
elseif ft == "php" then
if check_node_type({ "fragment", "start_tag", "element" }, node) then
return ""
end
elseif vim.tbl_contains({ "javascriptreact", "javascript.jsx", "typescriptreact", "typescript.tsx" }, ft) then
if check_node_type({ "jsx_opening_element", "jsx_text" }, node) then
return ""
end
end
if previous_2char:match "%w$" then
return "<bs> =" .. next_char
end
if previous_2char:match "%=$" then
return next_char
end
if previous_2char:match "=" then
return "<bs><bs>=" .. next_char
end
return ""
end)
:set_end_pair_length(0)
:with_move(cond.none())
:with_del(cond.none()),
}
npairs.add_rules(require "nvim-autopairs.rules.endwise-lua")
npairs.add_rules(require "nvim-autopairs.rules.endwise-ruby")
-- move up current line and delete old line.
-- this function is used by backspace smart indent feature.
-- @param line_string current line in string.
-- You can get this by following: `tostring(vim.api.nvim_win_get_cursor(0)[1])`
function _G.MPairs.move_and_delete(line_string)
vim.cmd [[ nohlsearch ]]
vim.cmd(line_string .. "d")
vim.api.nvim_input "<esc>==wi"
end
-- replace autopairs' backspace function
function _G.MPairs.check_bs()
local line, column = unpack(vim.api.nvim_win_get_cursor(0))
local spaces = vim.api.nvim_get_current_line():match "^%s+"
local _previous_lines = vim.api.nvim_buf_get_lines(0, line - 1, line - 1, false)
local previous_line = #_previous_lines <= 0 and "" or _previous_lines[1]
local function bs()
vim.api.nvim_feedkeys(npairs.autopairs_bs(), "n", true)
end
if spaces == nil then
bs()
return
end
local matched = vim.api.nvim_get_current_line():match "^%s+$"
-- Delete current line if the line is spaces
if matched ~= nil then
if indent.get_indents() ~= #matched then
bs()
return
end
local old_line = vim.api.nvim_win_get_cursor(0)[1]
-- Check if the cursor is on last line
-- If true, the cursor do not move up after deleting line
if old_line == vim.fn.line "$" then
vim.api.nvim_del_current_line()
local new_line = vim.api.nvim_win_get_cursor(0)[1]
vim.api.nvim_win_set_cursor(0, { new_line, 9999 })
vim.api.nvim_input "<Tab>"
vim.defer_fn(function()
vim.api.nvim_input "<C-e>"
end, 85)
return
end
vim.api.nvim_del_current_line()
local new_line = vim.api.nvim_win_get_cursor(0)[1]
vim.api.nvim_win_set_cursor(0, { new_line - 1, 9999 })
vim.api.nvim_input "<Tab>"
elseif column == #spaces then
if previous_line == nil then
_G.MPairs.move_and_delete(tostring(line - 1))
elseif string.match(previous_line, "^%s*$") ~= nil then
_G.MPairs.move_and_delete(tostring(line - 1))
else
bs()
end
else
bs()
end
return
end
|
require('scripts.align')
|
local Prop = {}
Prop.Name = "Bazaar Shop 7"
Prop.Cat = "Stores"
Prop.Price = 250
Prop.Doors = {
Vector( -13553, -11141, 359 ),
Vector( -13697, -11370, 359 ),
}
GM.Property:Register( Prop ) |
-- Luapress
-- File: lib/table_to_lua.lua
-- Desc: helper to convert a table object into a Lua string
-- Originally from: https://github.com/Fizzadar/Lua-Bits/blob/master/tableToLuaFile.lua
-- Takes a Lua table object and outputs a Lua string
local function table_to_lua(table, indent)
indent = indent or 1
local out = ''
for k, v in pairs(table) do
out = out .. '\n'
for i = 1, indent * 4 do
out = out .. ' '
end
if type(v) == 'table' then
if type(k) == 'string' and k:find('%.') then
out = out .. '[\'' .. k .. '\'] = ' .. table_to_lua(v, indent + 1)
else
out = out .. k .. ' = ' .. table_to_lua(v, indent + 1)
end
out = out .. ','
else
if type(v) == 'string' then v = "'" .. v .. "'" end
if type(v) == 'boolean' then v = tostring(v) end
if type(k) == 'number' then k = '' else k = k .. ' = ' end
out = out .. k .. v .. ','
end
end
-- Strip final commas (optional, ofc!)
out = out:sub(0, out:len() - 1)
-- Ensure the final } lines up with any indent
out = '{' .. out .. '\n'
if indent > 1 then
for i = 1, (indent - 1) * 4 do
out = out .. ' '
end
end
return out .. '}'
end
-- Export
return table_to_lua
|
DeriveGamemode("gearfox")
AddLuaSHFolder("shared")
AddLuaCSFolder("hud")
AddLuaCSFolder("client")
AddLuaSVFolder("server")
GM.Name = "Maw's Zombie Survival"
GM.Author = "The Maw"
GM.Email = "cjbremer@gmail.com"
GM.Website = "www.devinity2.com"
function GM:PlayerHurt( Vict, Att, HPLeft, Dmg )
if (Vict.Zomb and Att.Zomb) then return false end
if (!Vict.Zomb and !Att.Zomb) then return false end
end |
local jsonConfig = {}
jsonConfig.data = {}
--
-- public functions
--
function jsonConfig.Load(name, default, keyOrderArray)
local filename = jsonConfig.GetFileName(name)
local result = fileDrive.LoadAsync(filename)
if not result.content then
fileDrive.SaveAsync(filename, jsonInterface.encode(default, keyOrderArray))
jsonConfig.data[name] = default
else
jsonConfig.data[name] = jsonInterface.decode(result.content)
end
return jsonConfig.data[name]
end
--
-- private functions
--
function jsonConfig.GetFileName(name)
return 'custom/config__' .. name .. '.json'
end
return jsonConfig
|
NightSisterStrongholdScreenPlay = ScreenPlay:new {
numberOfActs = 1,
screenplayName = "NightSisterStrongholdScreenPlay",
lootContainers = {
5035775
},
lootLevel = 38,
lootGroups = {
{
groups = {
{group = "color_crystals", chance = 3500000},
{group = "junk", chance = 3500000},
{group = "rifles", chance = 1000000},
{group = "pistols", chance = 1000000},
{group = "clothing_attachments", chance = 500000},
{group = "armor_attachments", chance = 500000}
},
lootChance = 8000000
}
},
lootContainerRespawn = 1800, -- 30 minutes
axkvaGuards = {
{ -88.44, -102.87, -118.02 },
{ -95.26, -102.39, -121.17 },
{ -93.95, -103.28, -127.98 },
{ -80.15, -101.58, -119.85 },
{ -82.63, -102.43, -124.82 },
{ -95.73, -102.72, -122.55 }
}
}
registerScreenPlay("NightSisterStrongholdScreenPlay", true)
function NightSisterStrongholdScreenPlay:start()
if (isZoneEnabled("dathomir")) then
self:spawnMobiles()
self:initializeLootContainers()
end
end
function NightSisterStrongholdScreenPlay:spawnMobiles()
--outside the walls
spawnMobile("dathomir", "nightsister_sentinel",720,-4059.4,123.3,-285.0,-114,0)
spawnMobile("dathomir", "nightsister_sentinel",720,-4068.8,124.4,-270.5,-140,0)
spawnMobile("dathomir", "nightsister_sentry",600,-4074.6,125.2,-287.0,-136,0)
spawnMobile("dathomir", "nightsister_sentry",600,-4159.6,135.4,-191.9,-173,0)
spawnMobile("dathomir", "nightsister_sentry",600,-4167.0,134.6,-190.7,-91,0)
spawnMobile("dathomir", "nightsister_sentinel",720,-4175.3,132.6,-178.0,-89,0)
spawnMobile("dathomir", "nightsister_rancor_tamer",720,-4243.1,135.7,-83.4,-74,0)
spawnMobile("dathomir", "nightsister_bull_rancor",720,-4247.2,135.4,-89.5,-74,0)
spawnMobile("dathomir", "nightsister_sentinel",720,-4121.4,121.6,-43.7,-70,0)
spawnMobile("dathomir", "nightsister_ranger",720,-4128.9,120.7,-41.5,0,0)
spawnMobile("dathomir", "nightsister_protector",1200,-4005.1,119.0,-60.0,-164,0)
spawnMobile("dathomir", "nightsister_initiate",600,-4001.0,119.0,-62.4,-165,0)
spawnMobile("dathomir", "nightsister_sentinel",720,-3994.1,124.7,-76.1,102,0)
spawnMobile("dathomir", "nightsister_sentinel",720,-4032.2,123.5,-65.6,14,0)
spawnMobile("dathomir", "nightsister_slave",300,-4013.9,106.0,-42.5,140,0)
spawnMobile("dathomir", "nightsister_slave",300,-4010.3,106.0,-46.9,40,0)
spawnMobile("dathomir", "nightsister_slave",300,-4006.7,106.0,-42.2,90,0)
--inside the walls (not in the building)
spawnMobile("dathomir", "nightsister_elder",3600,-3976.1,131.5,-171.3,-169,0)
spawnMobile("dathomir", "nightsister_elder",3600,-4003.5,121,-270.1,-54,0)
spawnMobile("dathomir", "nightsister_elder",3600,-4155.3,121.0,-99.8,51,0)
spawnMobile("dathomir", "nightsister_rancor_tamer",720,-4107.2,126.3,-100,-24,0)
spawnMobile("dathomir", "nightsister_protector",1200,-4105.6,126.8,-94.5,178,0)
spawnMobile("dathomir", "nightsister_spell_weaver",720,-4100.6,126.7,-95.5,-110,0)
spawnMobile("dathomir", "nightsister_rancor_tamer",720,-4016.0,130.3,-139.0,6,0)
spawnMobile("dathomir", "nightsister_protector",1200,-4014.0,130.4,-136.8,-100,0)
spawnMobile("dathomir", "nightsister_spell_weaver",720,-4019.4,129.8,-137.7,80,0)
spawnMobile("dathomir", "nightsister_rancor_tamer",720,-3984.0,123.4,-231.0,0,0)
spawnMobile("dathomir", "nightsister_protector",1200,-3983.0,124.4,-226.9,-166,0)
spawnMobile("dathomir", "nightsister_protector",1200,-4017.5,121.0,-249.5,-64,0)
spawnMobile("dathomir", "nightsister_spell_weaver",720,-3986.7,124.2,-225.4,178,0)
spawnMobile("dathomir", "nightsister_sentinel",720,-4059.9,128.0,-157.0,0,0)
spawnMobile("dathomir", "nightsister_sentry",600,-4058.3,127.8,-150.9,-175,0)
spawnMobile("dathomir", "nightsister_stalker",720,-4062.8,128.3,-152.9,116,0)
spawnMobile("dathomir", "nightsister_initiate",600,-4046.1,120.8,-188.7,37,0)
spawnMobile("dathomir", "nightsister_rancor_tamer",720,-4039.4,120.7,-194.8,19,0)
spawnMobile("dathomir", "nightsister_spell_weaver",720,-4035.4,121.2,-194.1,-4,0)
spawnMobile("dathomir", "nightsister_protector",1200,-4042.3,118.8,-230.7,-134,0)
spawnMobile("dathomir", "nightsister_spell_weaver",720,-4047.7,119.1,-232.2,101,0)
spawnMobile("dathomir", "nightsister_ranger",720,-4045.0,120.2,-261.8,-54,0)
spawnMobile("dathomir", "nightsister_initiate",600,-3965.2,125.1,-237.1,-65,0)
spawnMobile("dathomir", "nightsister_protector",1200,-4150.9,134.6,-176.0,-62,0)
spawnMobile("dathomir", "nightsister_spell_weaver",720,-4157.6,134.0,-173.4,111,0)
spawnMobile("dathomir", "nightsister_sentinel",720,-4152.9,133.5,-168.5,178,0)
spawnMobile("dathomir", "nightsister_protector",1200,-4142.0,126.9,-136.8,-52,0)
spawnMobile("dathomir", "nightsister_ranger",720,-4192.0,125.2,-132.9,110,0)
spawnMobile("dathomir", "nightsister_ranger",720,-4190.3,124.7,-124.8,98,0)
spawnMobile("dathomir", "nightsister_protector",1200,-4139.9,121.0,-82.8,84,0)
spawnMobile("dathomir", "nightsister_spell_weaver",720,-4117.0,126.7,-116.6,-125,0)
spawnMobile("dathomir", "nightsister_stalker",720,-4122.8,126.2,-120.6,54,0)
spawnMobile("dathomir", "nightsister_protector",1200,-4066.6,130.5,-105.8,38,0)
spawnMobile("dathomir", "nightsister_protector",1200,-4060.1,130.5,-111.9,46,0)
spawnMobile("dathomir", "nightsister_sentry",600,-4067.4,126.3,-83.5,167,0)
spawnMobile("dathomir", "nightsister_protector",1200,-3993.8,131.2,-194.4,-138,0)
spawnMobile("dathomir", "nightsister_spell_weaver",720,-4028.1,126.3,-109.2,52,0)
spawnMobile("dathomir", "nightsister_ranger",720,-3992.4,129.6,-108.1,-64,0)
spawnMobile("dathomir", "nightsister_sentry",600,-3955.8,131.9,-204.4,-158,0)
spawnMobile("dathomir", "nightsister_sentry",600,-4084.6,133.6,-210.4,26,0)
spawnMobile("dathomir", "nightsister_spell_weaver",720,-4080.4,132.9,-207.0,-105,0)
spawnMobile("dathomir", "nightsister_sentry",600,-4113.8,122.5,-57.2,-156,0)
spawnMobile("dathomir", "nightsister_protector",1200,-4024.4,126.7,-111.9,2,0)
--main building
spawnMobile("dathomir", "nightsister_initiate",600,-5.9,0.8,3.3,82,189375)
spawnMobile("dathomir", "nightsister_initiate",600,5.5,0.8,2.6,-92,189375)
spawnMobile("dathomir", "nightsister_spell_weaver",720,5.8,0.8,-13.2,-90,189376)
spawnMobile("dathomir", "nightsister_slave",300,14.3,0.8,-22.6,152,189377)
spawnMobile("dathomir", "nightsister_slave",300,18.1,0.8,-28.0,-100,189377)
spawnMobile("dathomir", "nightsister_slave",300,10.6,0.8,-30.1,32,189377)
spawnMobile("dathomir", "nightsister_ranger",720,-13.4,0.8,-13.4,14,189378)
spawnMobile("dathomir", "nightsister_sentinel",720,-1.2,0.8,-44.4,-85,189379)
spawnMobile("dathomir", "nightsister_protector",1200,0.2,0.8,-54.7,-5,189379)
spawnMobile("dathomir", "nightsister_elder",3600,-5.8,7.2,-3.0,135,189383)
spawnMobile("dathomir", "nightsister_slave",300,-15.0,7.2,-14.3,3,189384)
--in the cave, make difficulty 'scale' as player progresses into the cave, listed here from bottom to top:
spawnMobile("dathomir", "nightsister_sentinel",2400,-89.6414,-100.547,-149.769,54,4115626)
spawnMobile("dathomir", "grovo",2400,-82.0,-99.7,-93.1,-174,4115629)
spawnMobile("dathomir", "nightsister_spell_weaver",2400,-82.2,-100.0,-103.6,-161,4115629)
spawnMobile("dathomir", "nightsister_sentinel",720,-28.3439,-80.1922,-151.496,7,4115628)
spawnMobile("dathomir", "nightsister_sentinel",720,-22.2057,-80.5683,-151.813,2,4115628)
spawnMobile("dathomir", "nightsister_enraged_bull_rancor",2400,-58.3,-92.2,-146.4,77,4115628)
spawnMobile("dathomir", "nightsister_spell_weaver",720,-12.9025,-68.921,-96.3403,7,4115627)
spawnMobile("dathomir", "nightsister_sentinel",720,-19.9525,-69.7168,-92.0932,2,4115627)
spawnMobile("dathomir", "nightsister_ranger",1200,-52.8,-68.7,-103.5,20,4115627)
spawnMobile("dathomir", "nightsister_sentinel",720,-66.3095,-70.9,-84.3193,2,4115627)
spawnMobile("dathomir", "nightsister_bull_rancor",720,-27.2,-70.7,-114.8,-32,4115627)
spawnMobile("dathomir", "nightsister_rancor",720,-47.1,-69.8,-83.0,149,4115627)
spawnMobile("dathomir", "nightsister_ranger",1200,-107.147,-68.531,-113.11,7,4115626)
spawnMobile("dathomir", "nightsister_stalker",720,-118.707,-69.6862,-123.213,2,4115626)
spawnMobile("dathomir", "nightsister_spell_weaver",1200,-122.558,-69.332,-138.946,7,4115626)
spawnMobile("dathomir", "nightsister_stalker",720,-104.958,-71.5983,-176.399,2,4115626)
spawnMobile("dathomir", "nightsister_stalker",720,-115.398,-69.2239,-172.659,7,4115626)
spawnMobile("dathomir", "nightsister_spell_weaver",1200,-121.94,-69.8514,-182.011,2,4115626)
spawnMobile("dathomir", "nightsister_spell_weaver",1200,-115.618,-69.9586,-198.215,7,4115626)
spawnMobile("dathomir", "nightsister_sentinel",720,-101.324,-68.9513,-203.529,2,4115626)
spawnMobile("dathomir", "nightsister_rancor",720,-84.3,-70.2,-122.6,-89,4115626)
spawnMobile("dathomir", "nightsister_rancor_tamer",720,-68.4386,-69.8099,-196.707,7,4115626)
spawnMobile("dathomir", "nightsister_bull_rancor",720,-61.3,-69.9,-194.0,12,4115626)
spawnMobile("dathomir", "nightsister_enraged_rancor",720,-65.5,-69.7,-162.9,165,4115626)
spawnMobile("dathomir", "nightsister_sentinel",720,-20.5611,-64.3706,-179.909,2,4115624)
spawnMobile("dathomir", "nightsister_enraged_rancor",720,-13.1121,-64.7617,-221.124,2,4115625)
spawnMobile("dathomir", "nightsister_spell_weaver",720,-93.1,-73.3,-174.5,-6,4115626)
spawnMobile("dathomir", "nightsister_sentinel",720,-94.4,-73.2,-166.3,88,4115626)
spawnMobile("dathomir", "nightsister_enraged_rancor",720,-20.9,-65.1,-213.2,20,4115625)
spawnMobile("dathomir", "ancient_bull_rancor",2400,-19.7,-63.2,-260.3,-7,4115625)
spawnMobile("dathomir", "nightsister_enraged_bull_rancor",1200,-8.3,-64.0,-228.4,-7,4115625)
spawnMobile("dathomir", "nightsister_stalker",720,64.9,-48.3,-131.0,-105,4115623)
spawnMobile("dathomir", "nightsister_spell_weaver",720,60.9,-52.4,-142.4,-92,4115623)
spawnMobile("dathomir", "nightsister_rancor_tamer",1200,1.9,-63.2,-233.7,-89,4115625)
spawnMobile("dathomir", "nightsister_rancor",720,-5.85405,-66.7536,-214.372,2,4115625)
spawnMobile("dathomir", "nightsister_sentinel",720,14.0655,-63.2116,-184.377,2,4115624)
spawnMobile("dathomir", "nightsister_protector",720,-12.4,-64.0,-188.3,-2,4115624)
spawnMobile("dathomir", "nightsister_sentinel",720,57.2187,-56.7709,-178.97,2,4115623)
spawnMobile("dathomir", "nightsister_protector",1200,61.2023,-57.0517,-174.241,-134,4115623)
spawnMobile("dathomir", "nightsister_stalker",600,65.0699,-55.58,-159.308,2,4115623)
spawnMobile("dathomir", "nightsister_sentinel",720,65.4328,-55.1946,-157.441,-167,4115623)
spawnMobile("dathomir", "nightsister_sentinel",720,38.9,-53.2,-145.1,-38,4115623)
spawnMobile("dathomir", "nightsister_spell_weaver",1200,37.6899,-52.6698,-143.418,7,4115623)
spawnMobile("dathomir", "nightsister_sentry",720,17.99,-47.6612,-133.802,2,4115623)
spawnMobile("dathomir", "nightsister_spell_weaver",1200,-7.9093,-45.001,-143.0,9,4115623)
spawnMobile("dathomir", "nightsister_rancor",720,20.7,-46.0,-111.6,35,4115623)
spawnMobile("dathomir", "nightsister_enraged_rancor",1200,-3.6,-46.2,-149.1,-11,4115623)
spawnMobile("dathomir", "nightsister_ranger",720,0.0473984,-45.1734,-143.086,7,4115623)
spawnMobile("dathomir", "nightsister_enraged_rancor",1200,25.9,-60.8,-176.4,64,4115623)
spawnMobile("dathomir", "nightsister_ranger",720,38.3645,-45.6514,-94.5238,2,4115622)
spawnMobile("dathomir", "nightsister_sentry",600,40.565,-46.6515,-76.2628,7,4115622)
spawnMobile("dathomir", "nightsister_outcast",720,48.2317,-47.0278,-54.4734,2,4115622)
spawnMobile("dathomir", "nightsister_outcast",720,44.0373,-46.6601,-51.444,7,4115622)
spawnMobile("dathomir", "nightsister_sentry",720,31.0654,-45.1049,-56.1405,-100,4115622)
spawnMobile("dathomir", "nightsister_rancor",720,52.1,-45.9,-95.7,-68,4115622)
spawnMobile("dathomir", "nightsister_ranger",1200,15.027,-40.2011,-76.6327,7,4115621)
spawnMobile("dathomir", "nightsister_rancor",720,16.3,-42.3,-64.0,-137,4115621)
spawnMobile("dathomir", "nightsister_sentry",720,-5.96411,-40.5602,-65.8697,2,4115621)
spawnMobile("dathomir", "nightsister_bull_rancor",1200,2.6,-40.3,-66.4,-60,4115621)
spawnMobile("dathomir", "nightsister_outcast",720,-10.1746,-39.3909,-54.6325,2,4115621)
spawnMobile("dathomir", "nightsister_initiate",600,-9.30522,-31.6686,-33.0453,7,4115620)
spawnMobile("dathomir", "nightsister_initiate",600,5.27219,-24.4314,-26.0931,2,4115620)
spawnMobile("dathomir", "nightsister_initiate",600,2.20982,-11.8595,-2.93477,7,4115619)
self:respawnAxkvaMin()
local pTrap = spawnSceneObject("dathomir", "object/static/terrain/corellia/rock_crystl_shrpbush_med.iff", -11.5, -64.6, -202.2, 4115624, 0.707107, 0, 0.707107, 0)
if (pTrap ~= nil) then
local pActiveArea = spawnActiveArea("dathomir", "object/active_area.iff", -3987.5, 50.23, 188.99, 4, 4115624)
if pActiveArea ~= nil then
createObserver(ENTEREDAREA, "NightSisterStrongholdScreenPlay", "notifyEnteredTrapArea", pActiveArea)
end
local pSwitch = spawnSceneObject("dathomir", "object/tangible/dungeon/cave_stalagmite_ice_style_01.iff", -8.88, -65, -189.23, 4115624, 0.707107, 0, 0.707107, 0)
if (pSwitch ~= nil) then
createObserver(OBJECTRADIALUSED, "NightSisterStrongholdScreenPlay", "notifyTrapSwitchUsed", pSwitch);
spawnSceneObject("dathomir", "object/static/particle/pt_light_blink_blue.iff", -8.88, -65, -189.23, 4115624, 0.707107, 0, 0.707107, 0)
self:enableTrap()
end
end
end
function NightSisterStrongholdScreenPlay:enableTrap()
local pTrapEffect = spawnSceneObject("dathomir", "object/static/particle/pt_poi_electricity_2x2.iff", -11.5, -64.6, -202.2, 4115624, 0.707107, 0, 0.707107, 0)
if (pTrapEffect ~= nil) then
writeData("NightSisterStrongholdScreenPlay:trapEffect", SceneObject(pTrapEffect):getObjectID())
end
end
function NightSisterStrongholdScreenPlay:notifyTrapSwitchUsed(pSwitch, pPlayer)
if (pSwitch == nil) then
return 1
end
if (pPlayer == nil) then
return 0
end
local effectID = readData("NightSisterStrongholdScreenPlay:trapEffect")
if (effectID == 0) then
CreatureObject(pPlayer):sendSystemMessage("@dungeon/nightsister_rancor_cave:power_already_off")
else
local pEffect = getSceneObject(effectID)
if (pEffect ~= nil) then
SceneObject(pEffect):destroyObjectFromWorld()
end
CreatureObject(pPlayer):sendSystemMessage("@dungeon/nightsister_rancor_cave:power_off")
deleteData("NightSisterStrongholdScreenPlay:trapEffect")
createEvent(7 * 1000, "NightSisterStrongholdScreenPlay", "enableTrap", nil, "")
end
return 0
end
function NightSisterStrongholdScreenPlay:notifyEnteredTrapArea(pActiveArea, pPlayer)
if (pActiveArea == nil) then
return 1
end
if (pPlayer == nil) then
return 0
end
if (readData("NightSisterStrongholdScreenPlay:trapEffect") == 0) then
return 0
end
spawnSceneObject("dathomir", "object/static/particle/pt_magic_sparks.iff", -11.5, -64.6, -202.2, 4115624, 0.707107, 0, 0.707107, 0)
playClientEffectLoc(SceneObject(pPlayer):getObjectID(), "clienteffect/trap_electric_01.cef", "dathomir", -11.5, -64.6, -202.2, 4115624)
CreatureObject(pPlayer):sendSystemMessage("@dungeon/nightsister_rancor_cave:shock")
local trapDmg = getRandomNumber(400, 700)
CreatureObject(pPlayer):inflictDamage(pPlayer, 0, trapDmg, 1)
return 0
end
function NightSisterStrongholdScreenPlay:respawnAxkvaMin()
local pAxkvaMin = spawnMobile("dathomir", "axkva_min", 0, -90.5, -101, -102.2, 172, 4115629)
if (pAxkvaMin ~= nil) then
createObserver(STARTCOMBAT, "NightSisterStrongholdScreenPlay", "spawnGuards", pAxkvaMin)
createObserver(OBJECTDESTRUCTION, "NightSisterStrongholdScreenPlay", "axkvaKilled", pAxkvaMin)
end
end
function NightSisterStrongholdScreenPlay:axkvaKilled(pAxkvaMin)
createEvent(86400 * 1000, "NightSisterStrongholdScreenPlay", "respawnAxkvaMin", nil, "")
return 1
end
function NightSisterStrongholdScreenPlay:spawnGuards(pAxkvaMin)
if (pAxkvaMin == nil or CreatureObject(pAxkvaMin):isDead()) then
return 1
end
spatialChat(pAxkvaMin, "@dungeon/nightsister_rancor_cave:protect")
for i = 1, #self.axkvaGuards, 1 do
local guardID = readData("axkvaGuard:" .. i)
local pGuard = getSceneObject(guardID)
if (pGuard == nil or CreatureObject(pGuard):isDead()) then
local guardData = self.axkvaGuards[i]
pGuard = spawnMobile("dathomir", "nightsister_protector", 0, guardData[1], guardData[2], guardData[3], 0, 4115629)
if (pGuard ~= nil) then
writeData("axkvaGuard:" .. i, SceneObject(pGuard):getObjectID())
end
end
end
return 1
end
|
local OV = angelsmods.functions.OV
local rawmulti = angelsmods.marathon.rawmulti
local special_vanilla = clowns.special_vanilla
local ore_table = clowns.tables.ores
-------------------------------------------
------------BEGIN LOOKUP TABLES------------
-------------------------------------------
clowns.tables.get_trigger_name = {
--[[V]]["iron-ore"] = "iron",
--[[V]]["angels-iron-nugget"] = special_vanilla and "iron" or "unused", -- special vanilla only
--[[V]]["angels-iron-pebbles"] = special_vanilla and "iron" or "unused", -- special vanilla only
--[[V]]["angels-iron-slag"] = special_vanilla and "iron" or "unused", -- special vanilla only
--[[V]]["copper-ore"] = "copper",
--[[V]]["angels-copper-nugget"] = special_vanilla and "copper" or "unused", -- special vanilla only
--[[V]]["angels-copper-pebbles"] = special_vanilla and "copper" or "unused", -- special vanilla only
--[[V]]["angels-copper-slag"] = special_vanilla and "copper" or "unused", -- special vanilla only
--[[A/B]]["tin-ore"] = "tin",
--[[A/B]]["lead-ore"] = "lead",
--[[A/B]]["quartz"] = "silicon",
--[[A/B]]["nickel-ore"] = "nickel",
--[[A/B]]["manganese-ore"] = "manganese",
--[[A/B]]["zinc-ore"] = "zinc",
--[[A/B]]["bauxite-ore"] = "aluminium",
--[[A/B]]["cobalt-ore"] = "cobalt",
--[[A/B]]["silver-ore"] = "silver",
--[[A/B]]["gold-ore"] = "gold",
--[[A/B]]["rutile-ore"] = "titanium",
--[[A/B]]["uranium-ore"] = "uranium",
--[[A/B]]["tungsten-ore"] = "tungsten",
--[[A/B]]["thorium-ore"] = "thorium",
--[[A/B]]["chrome-ore"] = "chrome",
--[[A/B]]["platinum-ore"] = "platinum",
--[[C]]["phosphorus-ore"] = "phosphorus",
--[[C]]["magnesium-ore"] = "magnesium",
--[[C]]["osmium-ore"] = "osmium",
--[[A]]["solid-limestone"] = "limestone",
--[[A]]["solid-calcium-sulfate"] = "calcium-sulfate",
--[[A]]["solid-lithium"] = "solid-lithium",
--[[A]]["solid-sand"] = "sand",
--[[A]]["solid-sodium-carbonate"] = "sodium-carbonate",
--[[A]]["fluorite-ore"] = "fluorite", -- byproduct
--[[P]]["raw-borax"] = "borax", --pycoal
--[[P]]["nexelit-ore"] = "nexelit", --pycoal
--[[P]]["rare-earth-dust"] = "rare-earth-dust", --pycoal, from processing sand
--[[P]]["niobium-ore"] ="niobium", --pycoal
--[[P]]["molybdenum-ore"] ="molybdenum", --pyfusion
--[[P]]["regolite-rock"] ="regolites", --pyfusion
--[[P]]["kimberlite-rock"] ="kimberlite", --pyfusion diamond mine on volcanic-tube
}
local icon_lookup_table_fallback = {icon = "__angelsrefining__/graphics/icons/void.png"}
clowns.tables.icon_lookup_table = {
["bauxite-ore"] = mods["angelssmelting"] and {icon = "__angelssmelting__/graphics/icons/ore-bauxite.png"} or
mods["bobores"] and {icon = "__bobores__/graphics/icons/bauxite-ore.png"} or
mods["bobplates"] and {icon = "__bobplates__/graphics/icons/ore/bauxite-ore.png"} or
icon_lookup_table_fallback,
["cobalt-ore"] = mods["angelssmelting"] and {icon = "__angelssmelting__/graphics/icons/ore-cobalt.png"} or
mods["bobores"] and {icon = "__bobores__/graphics/icons/cobalt-ore.png"} or
mods["bobplates"] and {icon = "__bobplates__/graphics/icons/ore/cobalt-ore.png"} or
icon_lookup_table_fallback,
["copper-nugget"] = {icon = "__angelsrefining__/graphics/icons/copper-nugget.png"},
["copper-ore"] = {icon = "__base__/graphics/icons/copper-ore.png", icon_size = 64},
["copper-slag"] = {icon = "__angelsrefining__/graphics/icons/copper-slag.png"},
["fluorite-ore"] = {icon = "__angelsrefining__/graphics/icons/ore-fluorite.png"},
["gold-ore"] = mods["angelssmelting"] and {icon = "__angelssmelting__/graphics/icons/ore-gold.png"} or
mods["bobores"] and {icon = "__bobores__/graphics/icons/gold-ore.png"} or
mods["bobplates"] and {icon = "__bobplates__/graphics/icons/ore/gold-ore.png"} or
icon_lookup_table_fallback,
["iron-nugget"] = {icon = "__angelsrefining__/graphics/icons/iron-nugget.png"},
["iron-ore"] = {icon = "__base__/graphics/icons/iron-ore.png", icon_size = 64},
["iron-slag"] = {icon = "__angelsrefining__/graphics/icons/iron-slag.png"},
["solid-lithium"] = {icon = "__angelsrefining__/graphics/icons/solid-lithium.png"},
["lead-ore"] = mods["angelssmelting"] and {icon = "__angelssmelting__/graphics/icons/ore-lead.png"} or
mods["bobores"] and {icon = "__bobores__/graphics/icons/lead-ore.png"} or
mods["bobplates"] and {icon = "__bobplates__/graphics/icons/ore/lead-ore.png"} or
icon_lookup_table_fallback,
["nickel-ore"] = mods["angelssmelting"] and {icon = "__angelssmelting__/graphics/icons/ore-nickel.png"} or
mods["bobores"] and {icon = "__bobores__/graphics/icons/nickel-ore.png"} or
mods["bobplates"] and {icon = "__bobplates__/graphics/icons/ore/nickel-ore.png"} or
icon_lookup_table_fallback,
["platinum-ore"] = mods["angelssmelting"] and {icon = "__angelssmelting__/graphics/icons/ore-platinum.png"} or
icon_lookup_table_fallback,
["rutile-ore"] = mods["angelssmelting"] and {icon = "__angelssmelting__/graphics/icons/ore-rutile.png"} or
mods["bobores"] and {icon = "__bobores__/graphics/icons/rutile-ore.png"} or
mods["bobplates"] and {icon = "__bobplates__/graphics/icons/ore/rutile-ore.png"} or
icon_lookup_table_fallback,
["quartz"] = mods["angelssmelting"] and {icon = "__angelssmelting__/graphics/icons/ore-silica.png"} or
mods["bobores"] and {icon = "__bobores__/graphics/icons/quartz.png"} or
mods["bobplates"] and {icon = "__bobplates__/graphics/icons/ore/quartz.png"} or
icon_lookup_table_fallback,
["silver-ore"] = mods["angelssmelting"] and {icon = "__angelssmelting__/graphics/icons/ore-silver.png"} or
mods["bobores"] and {icon = "__bobores__/graphics/icons/silver-ore.png"} or
mods["bobplates"] and {icon = "__bobplates__/graphics/icons/ore/silver-ore.png"} or
icon_lookup_table_fallback,
["thorium-ore"] = mods["angelsindustries"] and angelsmods.industries.overhaul and {icon = "__angelssmelting__/graphics/icons/ore-thorium.png", icon_size = 64} or
mods["bobplates"] and {icon = "__boblibrary__/graphics/icons/ore-5.png", tint = {b = 0.25, g = 1, r = 1}} or
icon_lookup_table_fallback,
["tin-ore"] = mods["angelssmelting"] and {icon = "__angelssmelting__/graphics/icons/ore-tin.png"} or
mods["bobores"] and {icon = "__bobores__/graphics/icons/tin-ore.png"} or
mods["bobplates"] and {icon = "__bobplates__/graphics/icons/ore/tin-ore.png"} or
icon_lookup_table_fallback,
["tungsten-ore"] = mods["angelssmelting"] and {icon = "__angelssmelting__/graphics/icons/ore-tungsten.png"} or
mods["bobores"] and {icon = "__bobores__/graphics/icons/tungsten-ore.png"} or
mods["bobplates"] and {icon = "__bobplates__/graphics/icons/ore/tungsten-ore.png"} or
icon_lookup_table_fallback,
["uranium-ore"] = {icon = "__base__/graphics/icons/uranium-ore.png", icon_size = 64},
["zinc-ore"] = mods["angelssmelting"] and {icon = "__angelssmelting__/graphics/icons/ore-zinc.png"} or
mods["bobores"] and {icon = "__bobores__/graphics/icons/zinc-ore.png"} or
mods["bobplates"] and {icon = "__bobplates__/graphics/icons/ore/zinc-ore.png"} or
icon_lookup_table_fallback,
["phosphorus-ore"] = {icon = "__Clowns-Processing__/graphics/icons/phosphorus-ore.png"},
["osmium-ore"] = {icon = "__Clowns-Processing__/graphics/icons/osmium-ore.png"},
["manganese-ore"] = {icon = "__angelssmelting__/graphics/icons/ore-manganese.png"},
["magnesium-ore"] = {icon = "__Clowns-Processing__/graphics/icons/magnesium-ore.png"},
["chrome-ore"] = {icon = "__angelssmelting__/graphics/icons/ore-chrome.png"},
["raw-borax"] = {icon = "__pycoalprocessinggraphics__/graphics/icons/mip/raw-borax.png", icon_size = 64} or
icon_lookup_table_fallback,
["nexelit-ore"] = {icon = "__pycoalprocessinggraphics__/graphics/icons/mip/nexelit-ore.png", icon_size = 64} or
icon_lookup_table_fallback,
["niobium-ore"] = {icon = "__pycoalprocessinggraphics__/graphics/icons/mip/niobium-ore.png", icon_size = 64} or
icon_lookup_table_fallback,
["rare-earth-dust"] = {icon = "__pycoalprocessinggraphics__/graphics/icons/rare-earth-dust.png", icon_size = 32} or
icon_lookup_table_fallback,
["molybdenum-ore"] = {icon = "__pyfusionenergygraphics__/graphics/icons/mip/moly-01.png", icon_size = 64} or
icon_lookup_table_fallback,
["kimberlite-rock"] = {icon = "__pyfusionenergygraphics__/graphics/icons/ores/kimberlite-rock.png", icon_size = 32} or
icon_lookup_table_fallback,
["regolite-rock"] = {icon = "__pyfusionenergygraphics__/graphics/icons/ores/regolite-rock.png", icon_size = 32} or
icon_lookup_table_fallback,
}
clowns.tables.tweaked_icon_lookup = function(icon_name, scale, shift)
if not clowns.tables.icon_lookup_table[icon_name] then return icon_lookup_table_fallback end
if not clowns.tables.icon_lookup_table[icon_name].icon then return icon_lookup_table_fallback end
return {
icon = clowns.tables.icon_lookup_table[icon_name].icon,
icon_size = clowns.tables.icon_lookup_table[icon_name].icon_size,
scale = 32/(clowns.tables.icon_lookup_table[icon_name].icon_size or 32) * (scale or 1),
shift = (shift[1] or shift['x'] or shift[2] or shift['y']) and {
shift[1] or shift['x'] or 0,
shift[2] or shift['y'] or 0
} or nil,
tint = clowns.tables.icon_lookup_table[icon_name].tint
}
end
----------------------------
--== ORE SORTING TABLES ==--
----------------------------
clowns.tables.ore_combos = { --these are hidden when spec-vanilla is on anyway
--LIST OF ORES USED IN EACH RECIPE (i.e. permutations), THE TIER IS SET IN THE CALL FUNCTION
[1] = --[[crushed mix]]{
--[[Fe]]{"clowns-ore1","clowns-ore2","angels-ore8"},
--[[Cu]]{"clowns-ore4","clowns-ore7","angels-ore9"},
--[[Sn]]{"angels-ore6","angels-ore9","clowns-ore4"},
--[[Pb]]{"angels-ore5","clowns-ore3","clowns-ore7"},
--[[Mn]]{"angels-ore8","clowns-ore8","angels-ore6"},
--[[P]] {"clowns-ore5","angels-ore6","clowns-resource1"},
--[[Bo]]{"clowns-ore7","angels-ore4","clowns-resource1"} --py borax
},
[2] = --[[chunk mix]]{
--[[F]] {"clowns-ore1","angels-ore5","clowns-ore6","angels-ore3"},-- spec vanilla and c1,c5
--[[Si]]{"angels-ore1","clowns-ore6","angels-ore9","clowns-ore9"},
--[[Ni]]{"angels-ore8","clowns-ore2","clowns-ore4","clowns-ore8"},
--[[Zn]]{"clowns-ore4","clowns-ore3","clowns-ore8","angels-ore2"},
--[[Al]]{"angels-ore2","clowns-ore2","angels-ore4","clowns-ore5"},
--[[Co]]{"clowns-ore7","angels-ore8","angels-ore6","angels-ore3"},
--[[Nx]]{"clowns-ore4","clowns-resource2","angels-ore2","angels-ore1"}, --py nexelit
--[[Ny]]{"clowns-ore4","clowns-resource1","clowns-resource2","clowns-ore7"}, --py niobium
--[[RE]]{"angels-ore4","clowns-ore1","clowns-ore7","clowns-resource2"} --py rare-earth-dust
},
[3] = --[[crystal mix]]{
--[[Ag]]{"angels-ore2","angels-ore4","clowns-ore3","clowns-ore6","angels-ore9"},
--[[Au]]{"angels-ore9","clowns-ore4","angels-ore3","angels-ore5","angels-ore4"},
--[[Ti]]{"angels-ore5","clowns-ore9","clowns-ore1","angels-ore1","angels-ore3"},
--[[U]] {"clowns-ore5","angels-ore3","angels-ore1","angels-ore4","angels-ore6"},
--[[Mg]]{"clowns-ore2","clowns-ore7","clowns-ore8","clowns-ore4","angels-ore6"},-- spec vanilla and c4,c7
--[[Mo]]{"clowns-ore2","clowns-ore5","angels-ore8","clowns-ore13","angels-ore5"}, --py molybdenum
--[[Re]]{"clowns-ore1","clowns-ore3","clowns-ore9","clowns-ore11","angels-ore9"}, --py regolites
},
[4] = --[[pure mix]]{
--[[W]] {"angels-ore2","angels-ore3","angels-ore6","angels-ore8","clowns-ore4"},
--[[Th]]{"angels-ore8","angels-ore9","clowns-ore3","clowns-ore5","clowns-ore7"},
--[[Cr]]{"angels-ore1","angels-ore8","clowns-ore1","clowns-ore2","clowns-ore7"},
--[[Pt]]{"angels-ore5","angels-ore9","clowns-ore2","clowns-ore7","clowns-resource2"},
--[[Os]]{"angels-ore4","clowns-ore6","clowns-ore8","clowns-ore9","clowns-resource2"}, --spec vanilla and r2, c1, c7
--[[Ki]]{"angels-ore4","angels-ore2","clowns-ore1","clowns-ore7","clowns-resource2"} --py kimberlite
},
}
----------------------------------------------
-- Normal ore tier sorting -------------------
----------------------------------------------
clowns.tables.adamantite = {
["!!"] = {special_vanilla, special_vanilla, special_vanilla, true},
["iron-ore"] = special_vanilla and {1, 2, 3, 4} or {2, 2, 3, 3},
["angels-iron-nugget"] = special_vanilla and {1, 1, 4, 2},
["angels-iron-pebbles"] = special_vanilla and {2, 3, 1, 2},
["angels-iron-slag"] = special_vanilla and {0, 0, 1, 4},
["tin-ore"] = (not special_vanilla) and {1, 1, 1, 2},
["fluorite-ore"] = {0, 1, 1, 1}, -- forced on all the time from processing
["chrome-ore"] = (not special_vanilla) and {0, 1, 1, 1},
["rutile-ore"] = (not special_vanilla) and {0, 0, 1, 1},
["osmium-ore"] = {0, 0, 0, 1}
}
clowns.tables.antitate = {
["!!"] = (not special_vanilla) and {false, false, false, true},
["tin-ore"] = (not special_vanilla) and {2, 2, 3, 3},
["solid-lithium"] = (not special_vanilla) and {1, 1, 1, 2},
["nickel-ore"] = (not special_vanilla) and {0, 1, 1, 1},
["bauxite-ore"] = (not special_vanilla) and {0, 1, 1, 1},
["chrome-ore"] = (not special_vanilla) and {0, 0, 1, 1},
["platinum-ore"] = (not special_vanilla) and {0, 0, 0, 1}
}
clowns.tables.progalena = {
["!!"] = (not special_vanilla) and {false, false, false, true},
["lead-ore"] = (not special_vanilla) and {2, 2, 3, 3},
["solid-calcium-sulfate"] = (not special_vanilla) and {1, 1, 1, 2},
["silver-ore"] = (not special_vanilla) and {0, 1, 1, 1},
["zinc-ore"] = (not special_vanilla) and {0, 1, 1, 1},
["thorium-ore"] = (not special_vanilla) and {0, 0, 1, 1},
["uranium-ore"] = (not special_vanilla) and {0, 0, 0, 1}
}
clowns.tables.orichalcite = {
["!!"] = {special_vanilla, special_vanilla, special_vanilla, true},
["copper-ore"] = special_vanilla and {1, 2, 3, 4} or {2, 2, 3, 3},
["angels-copper-nugget"] = special_vanilla and {1, 2, 4, 3},
["angels-copper-pebbles"] = special_vanilla and {2, 3, 1, 2},
["angels-copper-slag"] = special_vanilla and {0, 0, 2, 4},
["manganese-ore"] = (not special_vanilla) and {1, 1, 1, 2},
["nickel-ore"] = (not special_vanilla) and {0, 1, 1, 1},
["zinc-ore"] = (not special_vanilla) and {0, 1, 1, 1},
["gold-ore"] = (not special_vanilla) and {0, 0, 1, 1},
["tungsten-ore"] = (not special_vanilla) and {0, 0, 0, 1},
}
clowns.tables.phosphorite = {
["!!"] = {special_vanilla, special_vanilla, special_vanilla, true},
["iron-ore"] = special_vanilla and {3, 3, 3, 3} or {0, 1, 1, 1},
["angels-iron-nugget"] = special_vanilla and {0, 1, 2, 3},
["angels-iron-pebbles"] = special_vanilla and {1, 3, 1, 4},
["angels-iron-slag"] = special_vanilla and {1, 1, 2, 2},
["phosphorus-ore"] = {2, 2, 3, 3},
["solid-limestone"] = {1, 1, 1, 2}, --always active with processing/petrochem
["uranium-ore"] = {0, 0, 1, 1},
["lead-ore"] = (not special_vanilla) and {0, 1, 1, 1},
["thorium-ore"] = (not special_vanilla) and {0, 0, 0, 1}
}
clowns.tables.sanguinate = {
["!!"] = (not special_vanilla) and {false, false, false, true},
["manganese-ore"] = (not special_vanilla) and {2, 2, 3, 3},
["quartz"] = (not special_vanilla) and {1, 1, 1, 2},
["solid-calcium-sulfate"] = (not special_vanilla) and {0, 1, 1, 1}, --always active with processing/petrochem
["fluorite-ore"] = (not special_vanilla) and {0, 1, 1, 1}, --always active with processing/petrochem
["phosphorus-ore"] = (not special_vanilla) and {0, 0, 1, 1},
["rutile-ore"] = (not special_vanilla) and {0, 0, 0, 1}
}
clowns.tables.elionagate = {
["!!"] = {special_vanilla, special_vanilla, special_vanilla, true},
["copper-ore"] = special_vanilla and {4, 3, 2, 1} or {2, 2, 3, 3},
["angels-copper-nugget"] = special_vanilla and {0, 0, 2, 3},
["angels-copper-pebbles"] = special_vanilla and {0, 5, 5, 6},
["angels-copper-slag"] = special_vanilla and {1, 2, 3, 4},
["lead-ore"] = (not special_vanilla) and {1, 1, 1, 2},
["cobalt-ore"] = (not special_vanilla) and {0, 1, 1, 1},
["chrome-ore"] = (not special_vanilla) and {0, 1, 1, 1},
["thorium-ore"] = (not special_vanilla) and {0, 0, 1, 1},
["platinum-ore"] = (not special_vanilla) and {0, 0, 0, 1},
}
clowns.tables.metagarnierite = {
["!!"] = (not special_vanilla) and {false, false, false, true},
["magnesium-ore"] = (not special_vanilla) and {2, 2, 3, 3},
["iron-ore"] = (not special_vanilla) and {1, 1, 1, 2},
["nickel-ore"] = (not special_vanilla) and {0, 1, 1, 1},
["manganese-ore"] = (not special_vanilla) and {0, 1, 1, 1},
["bauxite-ore"] = (not special_vanilla) and {0, 0, 1, 1},
["zinc-ore"] = (not special_vanilla) and {0, 0, 0, 1}
}
clowns.tables.novaleucoxene = {
["!!"] = (not special_vanilla) and {false, false, false, true},
["iron-ore"] = (not special_vanilla) and {2, 1, 2, 2},
["quartz"] = (not special_vanilla) and {1, 1, 1, 2},
["solid-calcium-sulfate"] = (not special_vanilla) and {0, 1, 1, 1},
["rutile-ore"] = (not special_vanilla) and {0, 2, 2, 2},
["solid-sodium-carbonate"] = (not special_vanilla) and {0, 0, 1, 1},
["bauxite-ore"] = (not special_vanilla) and {0, 0, 0, 1}
}
clowns.tables.stannic = {
["!!"] = (not special_vanilla) and {true, true, true, true},
["tin-ore"] = (not special_vanilla) and {2, 3, 4, 4},
["quartz"] = (not special_vanilla) and {2, 2, 2, 2},
["silver-ore"] = (not special_vanilla) and {0, 1, 1, 1},
["zinc-ore"] = (not special_vanilla) and {0, 0, 1, 1},
["platinum-ore"] = (not special_vanilla) and {0, 0, 0, 1}
}
clowns.tables.plumbic = {
["!!"] = (not special_vanilla) and {true, true, true, true},
["lead-ore"] = (not special_vanilla) and {2, 3, 4, 4},
["solid-calcium-sulfate"] = (not special_vanilla) and {2, 2, 2, 2},
["silver-ore"] = (not special_vanilla) and {0, 1, 1, 1},
["gold-ore"] = (not special_vanilla) and {0, 0, 1, 1},
["thorium-ore"] = (not special_vanilla) and {0, 0, 0, 1}
}
clowns.tables.manganic = {
["!!"] = (not special_vanilla) and {true, true, true, true},
["manganese-ore"] = (not special_vanilla) and {2, 3, 4, 4},
["magnesium-ore"] = (not special_vanilla) and {2, 2, 2, 2},
["bauxite-ore"] = (not special_vanilla) and {0, 1, 1, 1},
["solid-sodium-carbonate"] = (not special_vanilla) and {0, 0, 1, 1},
["chrome-ore"] = (not special_vanilla) and {0, 0, 0, 1}
}
clowns.tables.titanic = {
["!!"] = (not special_vanilla) and {true, true, true, true},
["iron-ore"] = (not special_vanilla) and {2, 3, 4, 4},
["nickel-ore"] = (not special_vanilla) and {2, 2, 2, 2},
["rutile-ore"] = (not special_vanilla) and {0, 1, 1, 1},
["cobalt-ore"] = (not special_vanilla) and {0, 0, 1, 1},
["tungsten-ore"] = (not special_vanilla) and {0, 0, 0, 1}
}
clowns.tables.phosphic = {
["!!"] = (not special_vanilla) and {true, true, true, true},
["phosphorus-ore"] = (not special_vanilla) and {2, 3, 4, 4},
["copper-ore"] = (not special_vanilla) and {2, 2, 2, 2},
["quartz"] = (not special_vanilla) and {0, 1, 1, 1},
["solid-limestone"] = (not special_vanilla) and {0, 0, 1, 1},
["uranium-ore"] = (not special_vanilla) and {0, 0, 0, 1}
}
clowns.functions.get_icon_table = function(table)
local list = {}
for i,icon in pairs(table) do
if type(icon) =="table" then
list[i]={
{icon = "__angelsrefining__/graphics/icons/sort-icon.png"},
clowns.tables.tweaked_icon_lookup(table[i].name, 0.5, {10, 10}),
{icon = "__Clowns-Processing__/graphics/icons/advsorting-overlay.png"}
}
else --if false
list[i]=icon_lookup_table_fallback
end
end
return list
end
clowns.tables.crushed_mix_processing = {
special_vanilla and {type = "item", name = "phosphorus-ore", amount = 4} or {type = "item", name = "iron-ore", amount = 9},
(not special_vanilla) and {type = "item", name = "copper-ore", amount = 9},
(not special_vanilla) and {type = "item", name = "tin-ore", amount = 9},
(not special_vanilla) and {type = "item", name = "lead-ore", amount = 9},
(not special_vanilla) and {type = "item", name = "manganese-ore", amount = 9},
(not special_vanilla) and {type = "item", name = "phosphorus-ore", amount = 9},
{type = "item", name = "raw-borax", amount = special_vanilla and 6 or 9},
}
clowns.tables.chunk_mix_processing = {
{type = "item", name = "fluorite-ore", amount = special_vanilla and 3 or 8},
(not special_vanilla) and {type = "item", name = "quartz", amount = 8},
(not special_vanilla) and {type = "item", name = "nickel-ore", amount = 8},
(not special_vanilla) and {type = "item", name = "zinc-ore", amount = 8},
(not special_vanilla) and {type = "item", name = "bauxite-ore", amount = 8},
(not special_vanilla) and {type = "item", name = "cobalt-ore", amount = 8},
{type = "item", name = "niobium-ore", amount = 8}, --these are temp placeholders, the base ores are not declared until data-updates
{type = "item", name = "nexelit-ore", amount = 8},
{type = "item", name = "rare-earth-dust", amount = 8}
}
clowns.tables.crystal_mix_processing = {
(not special_vanilla) and {type = "item", name = "silver-ore", amount = 7},
(not special_vanilla) and {type = "item", name = "gold-ore", amount = 7},
(not special_vanilla) and {type = "item", name = "rutile-ore", amount = 7},
(not special_vanilla) and {type = "item", name = "uranium-ore", amount = 7},
{type = "item", name = "magnesium-ore", amount = special_vanlla and 4 or 7},
{type = "item", name = "molybdenum-ore", amount = 8}, --these are temp placeholders, the base ores are not declared until data-updates
{type = "item", name = "regolite-rock", amount = 8}
}
clowns.tables.pure_mix_processing = {
(not special_vanilla) and {type = "item", name = "tungsten-ore", amount = 5},
(not special_vanilla) and {type = "item", name = "thorium-ore", amount = 5},
(not special_vanilla) and {type = "item", name = "chrome-ore", amount = 5},
(not special_vanilla) and {type = "item", name = "platinum-ore", amount = 5},
{type = "item", name = "osmium-ore", amount = special_vanlla and 6 or 5},
{type = "item", name = "kimberlite-rock", amount = 8} --these are temp placeholders, the base ores are not declared until data-updates
} |
local Timer = require "lib.timer"
local pre_state = {
load = function(self)
self.font = love.graphics.newFont("assets/mr_pixel/Mister Pixel Regular.otf", 40)
love.graphics.setFont(self.font)
self.logo = love.graphics.newImage("assets/erik.png")
local text_list = {
[[
I remember leaving a few wafer bars in
one of my toy boxes. I have to find
them.
]],
[[
There was a lot of chocolate on my
birthday. My friends couldn't have
eaten them all. It must be somewhere.
I'll start searching from the wardrobe
first.
]],
[[
I know I'm not the only one eating
chocolate in this house. Where could
they be hiding the chocolates? No
pressure. Just relax and watch it
happen!
]],
[[
I have to look a little more! I
should have little happy little sweets
over there. We don't make mistakes. We
just have happy candies!
]],
[[
Every day is a good day when I eat
chocolates. Talk to the chocolates,
make friends with it.
]]
}
self.text = text_list[math.floor(math.random(1, #text_list))]
Timer.after(5, function()
sm:setState("game_state")
end)
end,
update = function(self, dt)
end,
draw = function(self, dt, alpha)
love.graphics.clear(43 / 255, 40 / 255, 33 / 255, 1)
love.graphics.setColor(121 / 255, 121 / 255, 121 / 255, alpha)
love.graphics.print(self.text, (680 - self.font:getWidth(self.text)) / 2,
(680 - self.font:getHeight(self.text)) / 3)
love.graphics.setColor(255, 255, 255, alpha)
-- love.graphics.draw(self.logo, (680 - self.logo:getWidth()) / 2, (680 - self.logo:getHeight()) / 2 - 30)
end,
keypressed = function(self, key)
end
}
return pre_state
|
-- fortwars 3 killfeed system, created by legendofrobbo
local Gunkills = {
"#V was ventilated by #K",
"#V got shot up by #K",
"#V was shot to pieces by #K",
"#V got blasted by #K",
"#V was capped by #K",
"#V ate a load of #K's hot lead",
"#V was perforated by #K",
"#V was gunned down by #K",
"#V couldn't beat #K to the draw",
"#V bit #K's bullet",
}
local HSkills = {
"#V's brains were liberated from his skull by #K",
"#V copped #K's bullet right between the eyes",
"#V's head was sent rolling by #K",
"#V tried to catch #K's bullet between his teeth",
"#V was headshotted by #K",
"#K's bullet was the last thing that went through #V's head",
"#V was topped off by #K",
}
local Knifekills = {
"#V was sliced and diced by #K",
"#V was stuck by #K",
"#V was chopped up by #K",
"#V's insides were turned into outsides by #K",
"#V was given a too-short haircut by #K",
"#V lost a game of knifey-spooney to #K",
"#V was butchered by #K",
"#V was stabbed in the face by #K",
"#V was hunted down by #K",
}
local Bombkills = {
"#V was vaporized by #K",
"#V was blown to pieces by #K",
"#V was roasted by #K",
"#V was allahu ackbar'd by #K",
"#V was splattered all over the walls by #K",
"#V was ripped apart by #K's shrapnel",
"#V was BBQ'd by #K",
"#V was spontaneously combusted by #K",
"#V was turned into a charred corpse by #K",
"Bang! Zoom! #K sent #V straight to the moon!",
}
local Zapkills = {
"#V was electrified by #K",
"#V couldn't handle #K's voltage",
"#V was energized by #K",
"#V was shown divine power by #K",
"#V was lit up by #K",
"#V took #K's big black rod a bit too hard",
"#V was levitated straight up to heaven by #K",
}
local Ballkills = {
"#K crushed #V with the ball",
"#K slam dunked #V with the ball",
"#K bowled over #V with the ball",
"#K squished #V with the ball",
"#K punted #V with the ball",
"#K scored a goal on #V's face with the ball",
}
local Fallkills = {
"#V lost the fight to gravity",
"#V left a stain on the pavement",
"#V believed he could fly. he was wrong",
"#V couldn't beat the laws of physics",
"#V stood too close to the edge",
"#V failed to reach escape velocity",
}
local Worldkills = {
"#V was killed by unknown forces",
"#V should have watched where he was going",
"#V got sent back to great big special-ed class in the sky",
"#V has returned to his people",
"#V died mysteriously",
"#V spontaneously vanished",
"#V wasted his time on earth",
}
local Suicidekills = {
"#V offed himself",
"#V couldn't take it anymore",
"#V an hero'd",
"#V ate the muzzle of his own gun",
"#V gave himself a shotgun mouthwash",
"#V took the easy way out",
"#V pussied out",
"#V necked himself",
}
local BombSelfkills = {
"#V vaporized himself",
"#V blasted himself to pieces",
"#V shouldn't have played with explosives",
"#V stood too close to the bomb",
"#V got his 72 virgins",
"#V exploded himself",
"#V anniholated himself",
}
if SERVER then
util.AddNetworkString("Killfeed_Notify")
local playa = FindMetaTable("Player")
function playa:IsClass( cls )
if !self:IsValid() or !self:IsPlayer() or !self.Class then return false end
return Classes[self.Class].NAME == cls
end
hook.Add("GravGunPunt", "fixballkills", function(ply, ent)
if ent:GetClass() == "ball" then ent.LastPunter = ply end
end)
hook.Add("GravGunOnPickedUp", "fixballkills2", function(ply, ent)
if ent:GetClass() == "ball" then ent.LastPunter = ply end
end)
local function FormatKillString( str, ply, killer )
local vs = "Unkown"
local ks = "Unkown"
if ply:IsValid() then vs = ply:Nick() end
if killer:IsValid() and killer:IsPlayer() then ks = killer:Nick() end
local str1 = string.Replace( str, "#V", vs )
local str2 = string.Replace( str1, "#K", ks )
return str2
end
local function SelectKillMessage( tab, ply, killer )
local rtab, rnum = table.Random( tab )
net.Start("Killfeed_Notify")
net.WriteString( FormatKillString( rtab, ply, killer ) )
local tcol = Color(0,0,0)
if killer:IsValid() and killer:IsPlayer() and killer != ply then
tcol = team.GetColor(killer:Team())
end
net.WriteColor( tcol )
net.Broadcast()
end
local function Killfeed( ply, killer, dmg )
if !killer:IsValid() and dmg:IsFallDamage() then SelectKillMessage( Fallkills, ply, killer ) return elseif !killer:IsValid() then SelectKillMessage( Worldkills, ply, killer ) return end
if ply == killer then SelectKillMessage( Suicidekills, ply, killer ) return end
if dmg:GetInflictor():GetClass() == "ball" and dmg:GetInflictor().LastPunter:IsValid() then
SelectKillMessage( Ballkills, ply, dmg:GetInflictor().LastPunter )
return
end
if killer:IsClass( "Predator" ) and killer:GetActiveWeapon():GetClass() == "pred_gun" then
SelectKillMessage( Knifekills, ply, killer )
return
end
if killer:IsClass( "Sorcerer" ) and killer:GetActiveWeapon():IsValid() and killer:GetActiveWeapon():GetClass() == "sorcerer_gun" then
SelectKillMessage( Zapkills, ply, killer )
return
end
if dmg:IsBulletDamage() then
if ply:LastHitGroup() == 1 then SelectKillMessage( HSkills, ply, killer ) else SelectKillMessage( Gunkills, ply, killer ) end
return
end
if dmg:IsExplosionDamage() then
if !killer:IsPlayer() then SelectKillMessage( BombSelfkills, ply, killer ) return end
SelectKillMessage( Bombkills, ply, killer )
return
end
end
hook.Add("DoPlayerDeath", "killfeedhook", Killfeed )
end
if CLIENT then
surface.CreateFont( "Killfeed_Font", { font = "Trebuchet", size = 18, weight = 400, antialias = true } )
local killfeed = {}
net.Receive( "Killfeed_Notify", function( len )
local str, col = net.ReadString(), net.ReadColor()
table.insert( killfeed, { str, CurTime() + 8, col } )
MsgC( Color(255,255,255), "Kill: ", col, str, Color(255,255,255), "\n" )
end)
hook.Add("HUDPaint", "killfeed_drawkills", function()
local i = 20
for k, v in pairs(killfeed) do
surface.SetFont( "Killfeed_Font" )
local xmin = surface.GetTextSize(v[1])
draw.RoundedBox( 10, (ScrW() - xmin) - 30, i, xmin + 20, 25, Color(v[3].r / 2,v[3].g / 2,v[3].b / 2, (v[2] - CurTime()) * 22) )
draw.SimpleText(v[1],"Killfeed_Font",ScrW() - 20, i + 2,Color(255,255,255, (v[2] - CurTime()) * 42.5),2,0)
i = i + 30
if v[2] < CurTime() then table.remove( killfeed, k ) end
end
end)
end |
local config = require("pulls.config")
local git = require("pulls.git")
local request = require('pulls.github.request')
local encode = vim.fn.json_encode
local decode = vim.fn.json_decode
local M = {}
function M.get()
local repo_info = git.get_repo_info()
local branch = git.current_branch()
local head = repo_info.owner .. ":" .. branch
local pull_reqs = request.get({ --
url = request.base_url() .. "/pulls",
query = {state = "open", head = head},
headers = request.headers
})
return decode(pull_reqs.body)
end
function M.get_diff(pull_req_no)
local url = string.format("%s/pulls/%i", request.base_url(), pull_req_no)
-- needs header Accept: application/vnd.github.v3.diff
local custom_headers = {}
for k, v in pairs(request.headers) do custom_headers[k] = v end
custom_headers["Accept"] = "application/vnd.github.v3.diff"
local req = {url = url, headers = custom_headers}
local resp = request.get(req)
if resp.status ~= 200 then return {success = false, error = request.format_error_resp(resp)} end
-- not json, do not decode
return {success = true, data = resp.body}
end
function M.update(pull_req_no, opts)
-- fields are:
-- title
-- body
-- state (open/closed)
-- base (branch to merge to)
-- maintainer_can_modify (https://docs.github.com/en/github/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork)
local url = string.format("%s/pulls/%i", request.base_url(), pull_req_no)
local resp = request.patch({url = url, headers = request.headers, body = encode(opts), dry_run = config.debug or false})
if config.debug then
print(vim.inspect(resp))
return {success = true}
end
if resp.status ~= 200 then return {success = false, error = request.format_error_resp(resp)} end
return {success = true, data = decode(resp.body)}
end
function M.get_files(pull_req_no)
local url = string.format("%s/pulls/%i/files", request.base_url(), pull_req_no)
local resp = request.get({url = url, headers = request.headers})
if resp.status ~= 200 then return {success = false, error = request.format_error_resp(resp)} end
local files = decode(resp.body)
return {success = true, data = files}
end
return M
|
local content = { _VERSION = "1.0:0" }
content["msg-error"] = "[Zeus] An error occurred while trying to perfom this action!"
content["msg-no-permission"] = "[Zeus] You have no permissions to do that!"
content["msg-argument-missing"] = "[Zeus] Failed to executed because Argument {1} is missing!"
content["msg-argument-invalid"] = "[Zeus] Failed to executed because Argument {1} is invalid!"
content["msg-mod-success"] = "[Zeus] Module {1} was successfully executed!"
content["msg-mod-disabled"] = "[Zeus] Module {1} was successfully disabled!"
content["msg-mod-failed"] = "[Zeus] Module {1} failed because {2}!"
content["msg-banned"] = "You are banned: {1}"
content["msg-veh-model-not-exist"] = "[Zeus] The Vehicle Model {1} does not exist!"
content["custom-chat"] = false -- coming soon: mysql
content["store-type"] = "LOCAL" -- or MYSQL
--[[
INFORMATION ABOUT THE DEV MODE
By default the dev mode is on, as long as the dev mode is on, all players are considered admin and
have all rights over the server and Zeus. Please only use this mode as long as nobody is admin,
because without an admin nobody can do anything with Zeus. To appoint someone as an admin,
open Zeus with /zeus and select the "Make Admin" module under Administration.
Then you only have to select a player and click on Activate. The player will then be appointed as admin.
Then you can turn off the dev mode, restart the server and administrate your server without any problems.
]]--
content["dev-mode"] = true
content["db-host"] = "localhost"
content["db-user"] = "zeus-db"
content["db-password"] = "this-is-a-safe-pw"
content["db-name"] = "zeus-db"
content["db-charset"] = "utf8mb4"
function GetDatabaseConnection()
return content["db-host"], content["db-user"], content["db-password"], content["db-name"]
end
function IsLocalStorage()
return content["store-type"] == "LOCAL"
end
function FormatMsg(key, ...)
local msg = content[key]
for key, value in pairs({ ... }) do
msg = string.gsub(msg, "{" .. key .. "}", value)
end
return msg
end
return content |
object_tangible_furniture_all_frn_all_trophy_finned_blaggart_new = object_tangible_furniture_all_shared_frn_all_trophy_finned_blaggart_new:new {
}
ObjectTemplates:addTemplate(object_tangible_furniture_all_frn_all_trophy_finned_blaggart_new, "object/tangible/furniture/all/frn_all_trophy_finned_blaggart_new.iff")
|
local text = "Information on Offline Training:\n 1. You need to have a Premium account in order to train here.\n 2. Choose a skill you'd like to train. Shielding is ALWAYS included.\n 3. If you're not sure which statue trains what, read the inscriptions.\n 4. Use a statue to be logged out of the game and train the skills associated with that statue.\n 5. When you log back into the game, your skills will have improved depending on how long you trained.\n 6. You have to be logged out of the game for at least 10 minutes in order for the training to take effect.\n 7. After 12 hours of constant offline training, your skills will not improve any further. Similar to stamina, your training bar will regenerate if you are not training offline."
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
player:showTextDialog(item.itemid, text)
return true
end
|
local pairs = pairs
local type = type
local next = next
local error = error
local tonumber = tonumber
local utf8_char = utf8.char
local table_concat = table.concat
local string_char = string.char
local math_type = math.type
local setmetatable = setmetatable
local Inf = math.huge
local json = {}
json.null = function() end
-------------------------------------------------------------------------------
-- Encode
-------------------------------------------------------------------------------
local encode
local escape_char_map = {
[ "\\" ] = "\\\\",
[ "/" ] = "\\/",
[ "\"" ] = "\\\"",
[ "\b" ] = "\\b",
[ "\f" ] = "\\f",
[ "\n" ] = "\\n",
[ "\r" ] = "\\r",
[ "\t" ] = "\\t",
}
local escape_char_map_inv = { [ "\\/" ] = "/" }
for k, v in pairs(escape_char_map) do
escape_char_map_inv[v] = k
end
local function escape_char(c)
return escape_char_map[c] or ("\\u%04x"):format(c:byte())
end
local function encode_nil()
return "null"
end
local function encode_null(val)
if val == json.null then
return "null"
end
error "cannot serialise function: type not supported"
end
local function encode_string(val)
return '"' .. val:gsub('[%z\1-\31\127\\"/]', escape_char) .. '"'
end
local function encode_number(val)
if val ~= val or val <= -Inf or val >= Inf then
error("unexpected number value '" .. tostring(val) .. "'")
end
return ("%.14g"):format(val):gsub(',', '.')
end
local function encode_table(val, stack)
local first_val = next(val)
if first_val == nil then
local meta = getmetatable(val)
if meta and meta.__name == 'json.object' then
return "{}"
else
return "[]"
end
elseif type(first_val) == 'number' then
local max = 0
for k in pairs(val) do
if math_type(k) ~= "integer" then
error("invalid table: mixed or invalid key types")
end
max = max > k and max or k
end
local res = {}
stack = stack or {}
if stack[val] then error("circular reference") end
stack[val] = true
for i = 1, max do
res[#res+1] = encode(val[i], stack)
end
stack[val] = nil
return "[" .. table_concat(res, ",") .. "]"
else
local res = {}
stack = stack or {}
if stack[val] then error("circular reference") end
stack[val] = true
for k, v in pairs(val) do
if type(k) ~= "string" then
error("invalid table: mixed or invalid key types")
end
res[#res+1] = encode_string(k) .. ":" .. encode(v, stack)
end
stack[val] = nil
return "{" .. table_concat(res, ",") .. "}"
end
end
local type_func_map = {
[ "nil" ] = encode_nil,
[ "table" ] = encode_table,
[ "string" ] = encode_string,
[ "number" ] = encode_number,
[ "boolean" ] = tostring,
[ "function" ] = encode_null,
}
encode = function(val, stack)
local t = type(val)
local f = type_func_map[t]
if f then
return f(val, stack)
end
error("unexpected type '" .. t .. "'")
end
function json.encode(val)
return encode(val)
end
-------------------------------------------------------------------------------
-- Decode
-------------------------------------------------------------------------------
local decode
local _buf
local _pos
local escape_chars = {
[ "\\" ] = true,
[ "/" ] = true,
[ '"' ] = true,
[ "b" ] = true,
[ "f" ] = true,
[ "n" ] = true,
[ "r" ] = true,
[ "t" ] = true,
[ "u" ] = true,
}
local literal_map = {
[ "true" ] = true,
[ "false" ] = false,
[ "null" ] = json.null,
}
local function next_word()
local f = _pos
local idx = _buf:find("[ \t\r\n%]},]", _pos)
_pos = idx and idx or (#_buf + 1)
return _buf:sub(f, _pos - 1), f
end
local function next_nonspace()
local idx = _buf:find("[^ \t\r\n]", _pos)
_pos = idx and idx or (#_buf + 1)
end
local function decode_error(msg, idx)
idx = idx or _pos
local line_count = 1
local col_count = 1
for i = 1, idx - 1 do
col_count = col_count + 1
if _buf:sub(i, i) == "\n" then
line_count = line_count + 1
col_count = 1
end
end
error(("%s at line %d col %d"):format(msg, line_count, col_count))
end
local function parse_unicode_escape(s)
local n1 = tonumber(s:sub(3, 6), 16)
local n2 = tonumber(s:sub(9, 12), 16)
if n2 then
return utf8_char((n1 - 0xd800) * 0x400 + (n2 - 0xdc00) + 0x10000)
else
return utf8_char(n1)
end
end
local function parse_string()
local has_unicode_escape = false
local has_surrogate_escape = false
local has_escape = false
local last
for j = _pos + 1, #_buf do
local x = _buf:byte(j)
if x < 32 then
decode_error("control character in string", j)
end
if last == 92 then -- "\\" (escape char)
if x == 117 then -- "u" (unicode escape sequence)
local hex = _buf:sub(j + 1, j + 5)
if not hex:find("%x%x%x%x") then
decode_error("invalid unicode escape in string", j)
end
if hex:find("^[dD][89aAbB]") then
if not _buf:sub(j + 5, j + 10):match('\\u%x%x%x%x') then
decode_error("missing low surrogate", j)
end
has_surrogate_escape = true
else
has_unicode_escape = true
end
else
local c = string_char(x)
if not escape_chars[c] then
decode_error("invalid escape char '" .. c .. "' in string", j)
end
has_escape = true
end
last = nil
elseif x == 34 then -- '"' (end of string)
local s = _buf:sub(_pos + 1, j - 1)
if has_surrogate_escape then
s = s:gsub("\\u[dD][89aAbB]..\\u....", parse_unicode_escape)
end
if has_unicode_escape then
s = s:gsub("\\u....", parse_unicode_escape)
end
if has_escape then
s = s:gsub("\\.", escape_char_map_inv)
end
_pos = j + 1
return s
else
last = x
end
end
decode_error("expected closing quote for string")
end
local function parse_number()
local word, f = next_word()
local n = tonumber(word)
if not n or word:find '[^-+.%deE]' or word:match '^0[1-9]' then
decode_error("invalid number '" .. word .. "'", f)
end
return n
end
local function parse_literal()
local word, f = next_word()
if literal_map[word] == nil then
decode_error("invalid literal '" .. word .. "'", f)
end
return literal_map[word]
end
local function parse_array()
_pos = _pos + 1
next_nonspace()
if _buf:sub(_pos, _pos) == "]" then
_pos = _pos + 1
return {}
end
local res = {}
local n = 1
while true do
res[n] = decode()
n = n + 1
next_nonspace()
local chr = _buf:sub(_pos, _pos)
_pos = _pos + 1
next_nonspace()
if chr == "]" then return res end
if chr ~= "," then decode_error("expected ']' or ','") end
end
end
local function parse_object()
local res = {}
_pos = _pos + 1
while true do
next_nonspace()
if _buf:sub(_pos, _pos) == "}" then
_pos = _pos + 1
break
end
if _buf:sub(_pos, _pos) ~= '"' then
decode_error("expected string for key")
end
local key = decode()
next_nonspace()
if _buf:sub(_pos, _pos) ~= ":" then
decode_error("expected ':' after key")
end
_pos = _pos + 1
next_nonspace()
local val = decode()
res[key] = val
next_nonspace()
local chr = _buf:sub(_pos, _pos)
_pos = _pos + 1
if chr == "}" then break end
if chr ~= "," then decode_error("expected '}' or ','") end
end
if next(res) == nil then
setmetatable(res, {__name = 'json.object'})
end
return res
end
local char_func_map = {
[ '"' ] = parse_string,
[ "0" ] = parse_number,
[ "1" ] = parse_number,
[ "2" ] = parse_number,
[ "3" ] = parse_number,
[ "4" ] = parse_number,
[ "5" ] = parse_number,
[ "6" ] = parse_number,
[ "7" ] = parse_number,
[ "8" ] = parse_number,
[ "9" ] = parse_number,
[ "-" ] = parse_number,
[ "t" ] = parse_literal,
[ "f" ] = parse_literal,
[ "n" ] = parse_literal,
[ "[" ] = parse_array,
[ "{" ] = parse_object,
}
decode = function()
local chr = _buf:sub(_pos, _pos)
local f = char_func_map[chr]
if f then
return f()
end
decode_error("unexpected character '" .. chr .. "'")
end
function json.decode(str)
if type(str) ~= "string" then
error("expected argument of type string, got " .. type(str))
end
_buf = str
_pos = 1
next_nonspace()
local res = decode()
next_nonspace()
if _pos <= #str then
decode_error("trailing garbage")
end
return res
end
return json
|
local ftcsv = require 'ftcsv'
local tpl_dir = 'tpl/'
local function load_tpl(name)
local path = tpl_dir..name..'.csv'
local t = ftcsv.parse(path, ",", {headers=false})
local meta = {}
local inputs = {}
local funcs = {}
local packets = {}
for k,v in ipairs(t) do
if #v > 1 then
if v[1] == 'META' then
meta.name = v[2]
meta.desc = v[3]
meta.series = v[4]
end
if v[1] == 'PMC_RANGE' then
local input = {
name = v[2],
desc = v[3],
}
if string.len(v[4]) > 0 then
input.vt = v[4]
end
input.pack = v[5]
input.rate = tonumber(v[6])
input.offset = tonumber(v[7] or '')
table.insert(inputs, input)
end
if v[1] == 'PMC_PACKET' then
local pack = {
name = v[2],
desc = v[3],
addr_type = v[4],
data_type = v[5],
start = v[6],
len = v[7],
}
table.insert(packets, pack)
end
if v[1] == 'CNC_FUNC' then
local func = {
name = v[2],
desc = v[3],
}
if string.len(v[4]) > 0 then
func.vt = v[4]
end
func.rate = tonumber(v[5])
func.func = v[6]
func.params = {}
for i = 7, 15 do
if not v[i] then
break
end
local val = math.tointeger(v[i]) or tonumber(v[i]) or v[i]
table.insert(func.params, val)
end
table.insert(funcs, func)
end
end
end
for _, pack in ipairs(packets) do
pack.inputs = {}
for _, input in ipairs(inputs) do
if input.pack == pack.name then
pack.inputs[#pack.inputs + 1] = input
end
end
end
return {
meta = meta,
inputs = inputs,
packets = packets,
funcs = funcs,
}
end
--[[
--local cjson = require 'cjson.safe'
local tpl = load_tpl('bms')
print(cjson.encode(tpl))
]]--
return {
load_tpl = load_tpl,
init = function(dir)
tpl_dir = dir.."/tpl/"
end
}
|
--ZFUNC-separator-v1
local function separator() --> sep
return _G.package.config:sub( 1, 1 )
end
return separator
|
local http = require("socket.http")
local test_support = require("test_support")
require 'busted.runner'()
describe("when accessing the protected resource without token", function()
test_support.start_server()
teardown(test_support.stop_server)
local _, status, headers = http.request({
url = "http://127.0.0.1/default/t",
redirect = false
})
it("redirects to the authorization endpoint", function()
assert.are.equals(302, status)
assert.truthy(string.match(headers["location"], "http://127.0.0.1/authorize%?.*client_id=client_id.*"))
end)
it("HTTP Caching is disabled", function()
assert.are.equals("no-cache, no-store, max-age=0", headers["cache-control"])
end)
it("requests the authorization code grant flow", function()
assert.truthy(string.match(headers["location"], ".*response_type=code.*"))
end)
it("uses the configured redirect uri", function()
local redir_escaped = test_support.urlescape_for_regex("http://127.0.0.1/default/redirect_uri")
-- lower as url.escape uses %2f for a slash, openidc uses %2F
assert.truthy(string.match(string.lower(headers["location"]),
".*redirect_uri=" .. string.lower(redir_escaped) .. ".*"))
end)
it("uses a state parameter", function()
assert.truthy(string.match(headers["location"], ".*state=.*"))
end)
it("uses a nonce parameter", function()
assert.truthy(string.match(headers["location"], ".*nonce=.*"))
end)
it("uses the default scopes", function()
assert.truthy(string.match(headers["location"],
".*scope=" .. test_support.urlescape_for_regex("openid email profile") .. ".*"))
end)
it("doesn't use the prompt parameter", function()
assert.falsy(string.match(headers["location"], ".*prompt=.*"))
end)
end)
describe("when accessing the custom protected resource without token", function()
test_support.start_server({oidc_opts = {scope = "my-scope"}})
teardown(test_support.stop_server)
local _, status, headers = http.request({
url = "http://127.0.0.1/default/t",
redirect = false
})
it("uses the configured scope", function()
assert.truthy(string.match(headers["location"], ".*scope=my%-scope.*"))
end)
end)
describe("when explicitly asking for a prompt parameter", function()
test_support.start_server({oidc_opts = {prompt = "none"}})
teardown(test_support.stop_server)
local _, status, headers = http.request({
url = "http://127.0.0.1/default/t",
redirect = false
})
it("then it is included", function()
assert.truthy(string.match(headers["location"], ".*prompt=none.*"))
end)
end)
describe("when explicitly asking for a display parameter", function()
test_support.start_server({oidc_opts = {display = "page"}})
teardown(test_support.stop_server)
local _, status, headers = http.request({
url = "http://127.0.0.1/default/t",
redirect = false
})
it("then it is included", function()
assert.truthy(string.match(headers["location"], ".*display=page.*"))
end)
end)
describe("when explicitly asking for custom parameters", function()
test_support.start_server({
oidc_opts = {
["authorization_params"] = {
test = "abc",
foo = "bar",
}
}
})
teardown(test_support.stop_server)
local _, status, headers = http.request({
url = "http://127.0.0.1/default/t",
redirect = false
})
it("then they are included", function()
assert.truthy(string.match(headers["location"], ".*test=abc.*"))
assert.truthy(string.match(headers["location"], ".*foo=bar.*"))
end)
end)
describe("when discovery data must be loaded", function()
test_support.start_server({
oidc_opts = {
discovery = "http://127.0.0.1/discovery"
}
})
teardown(test_support.stop_server)
local _, status, headers = http.request({
url = "http://127.0.0.1/default/t",
redirect = false
})
it("the authorization request redirects to the discovered authorization endpoint", function()
assert.are.equals(302, status)
assert.truthy(string.match(headers["location"], "http://127.0.0.1/authorize%?.*client_id=client_id.*"))
end)
end)
describe("when discovery endpoint is not resolvable", function()
test_support.start_server({
oidc_opts = {
discovery = "http://foo.example.org/"
},
})
teardown(test_support.stop_server)
local _, status, headers = http.request({
url = "http://127.0.0.1/default/t",
redirect = false
})
it("the response is invalid", function()
assert.are.equals(401, status)
end)
it("an error has been logged", function()
assert.error_log_contains("authenticate failed: accessing discovery url.*foo.example.org could not be resolved.*")
end)
end)
describe("when discovery endpoint is not reachable", function()
test_support.start_server({
oidc_opts = {
discovery = "http://192.0.2.1/"
},
})
teardown(test_support.stop_server)
local _, status = http.request({
url = "http://127.0.0.1/default/t",
redirect = false
})
it("the response is invalid", function()
assert.are.equals(401, status)
end)
it("an error has been logged", function()
assert.error_log_contains("authenticate failed: accessing discovery url.*%(http://192.0.2.1/%) failed")
end)
end)
describe("when discovery endpoint is slow and no timeout is configured", function()
test_support.start_server({
delay_response = { discovery = 1000 },
oidc_opts = {
discovery = "http://127.0.0.1/discovery"
},
})
teardown(test_support.stop_server)
local _, status = http.request({
url = "http://127.0.0.1/default/t",
redirect = false
})
it("the response is a redirect", function()
assert.are.equals(302, status)
end)
end)
describe("when discovery endpoint is slow and a simple timeout is configured", function()
test_support.start_server({
delay_response = { discovery = 1000 },
oidc_opts = {
timeout = 200,
discovery = "http://127.0.0.1/discovery"
},
})
teardown(test_support.stop_server)
local _, status = http.request({
url = "http://127.0.0.1/default/t",
redirect = false
})
it("the response is invalid", function()
assert.are.equals(401, status)
end)
it("an error has been logged", function()
assert.error_log_contains("authenticate failed: accessing discovery url.*%(http://127.0.0.1/discovery%) failed: timeout")
end)
end)
describe("when discovery endpoint is slow and a table timeout is configured", function()
test_support.start_server({
delay_response = { discovery = 1000 },
oidc_opts = {
timeout = { read = 200 },
discovery = "http://127.0.0.1/discovery"
},
})
teardown(test_support.stop_server)
local _, status = http.request({
url = "http://127.0.0.1/default/t",
redirect = false
})
it("the response is invalid", function()
assert.are.equals(401, status)
end)
it("an error has been logged", function()
assert.error_log_contains("authenticate failed: accessing discovery url.*%(http://127.0.0.1/discovery%) failed: timeout")
end)
end)
describe("when discovery endpoint sends a 4xx status", function()
test_support.start_server({
oidc_opts = {
discovery = "http://127.0.0.1/not-there"
},
})
teardown(test_support.stop_server)
local _, status = http.request({
url = "http://127.0.0.1/default/t",
redirect = false
})
it("the response is invalid", function()
assert.are.equals(401, status)
end)
it("an error has been logged", function()
assert.error_log_contains("authenticate failed:.*response indicates failure, status=404,")
end)
end)
describe("when discovery endpoint doesn't return proper JSON", function()
test_support.start_server({
oidc_opts = {
discovery = "http://127.0.0.1/t"
},
})
teardown(test_support.stop_server)
local _, status = http.request({
url = "http://127.0.0.1/default/t",
redirect = false
})
it("the response is invalid", function()
assert.are.equals(401, status)
end)
it("an error has been logged", function()
assert.error_log_contains("authenticate failed:.*JSON decoding failed")
end)
end)
describe("when accessing the protected resource without token and x-forwarded headers exist", function()
test_support.start_server()
teardown(test_support.stop_server)
local _, status, headers = http.request({
url = "http://127.0.0.1/default/t",
headers = {
["x-forwarded-proto"] = "https",
["x-forwarded-host"] = "example.org",
},
redirect = false
})
it("the configured forwarded information is used in redirect uri", function()
assert.are.equals(302, status)
local redir_escaped = test_support.urlescape_for_regex("https://example.org/default/redirect_uri")
assert.truthy(string.match(string.lower(headers["location"]),
".*redirect_uri=" .. string.lower(redir_escaped) .. ".*"))
end)
end)
describe("when redir scheme is configured explicitly", function()
test_support.start_server({
oidc_opts = {
redirect_uri_scheme = 'https',
},
})
teardown(test_support.stop_server)
local _, status, headers = http.request({
url = "http://127.0.0.1/default/t",
redirect = false
})
it("it overrides the scheme actually used", function()
assert.are.equals(302, status)
local redir_escaped = test_support.urlescape_for_regex("https://127.0.0.1/default/redirect_uri")
assert.truthy(string.match(string.lower(headers["location"]),
".*redirect_uri=" .. string.lower(redir_escaped) .. ".*"))
end)
end)
describe("when accessing the protected resource without token and x-forwarded-host contains a comma separated list", function()
test_support.start_server()
teardown(test_support.stop_server)
local _, status, headers = http.request({
url = "http://127.0.0.1/default/t",
headers = {
["x-forwarded-proto"] = "https",
["x-forwarded-host"] = " example.org , example.com, foo.example.net"
},
redirect = false
})
it("the configured forwarded information is used in redirect uri", function()
assert.are.equals(302, status)
local redir_escaped = test_support.urlescape_for_regex("https://example.org/default/redirect_uri")
assert.truthy(string.match(string.lower(headers["location"]),
".*redirect_uri=" .. string.lower(redir_escaped) .. ".*"))
end)
end)
describe("when accessing the protected resource without token and x-forwarded-* contain whitespace", function()
test_support.start_server()
teardown(test_support.stop_server)
local _, status, headers = http.request({
url = "http://127.0.0.1/default/t",
headers = {
["x-forwarded-proto"] = " https ",
["x-forwarded-host"] = " example.org "
},
redirect = false
})
it("the values are trimmed", function()
assert.are.equals(302, status)
local redir_escaped = test_support.urlescape_for_regex("https://example.org/default/redirect_uri")
assert.truthy(string.match(string.lower(headers["location"]),
".*redirect_uri=" .. string.lower(redir_escaped) .. ".*"))
end)
end)
describe("when accessing the protected resource without token and multiple x-forwarded-host headers", function()
test_support.start_server()
teardown(test_support.stop_server)
-- the http module doesn't support specifying multiple headers
local r = io.popen("curl -H 'X-Forwarded-Host: example.org' -H 'X-Forwarded-Host: example.com'"
.. " -o /dev/null -v --max-redirs 0 http://127.0.0.1/default/t 2>&1")
local o = r:read("*a")
r:close()
it("the first header is used", function()
assert.truthy(string.match(string.lower(o), ".*http/.* 302"))
local redir_escaped = test_support.urlescape_for_regex("http://example.org/default/redirect_uri")
assert.truthy(string.match(string.lower(o),
".*location: %S+redirect_uri=" .. string.lower(redir_escaped) .. ".*"))
end)
end)
describe("when accessing the protected resource without token and a forwarded header exists", function()
test_support.start_server()
teardown(test_support.stop_server)
local _, status, headers = http.request({
url = "http://127.0.0.1/default/t",
headers = {
["forwarded"] = "proto=https;Host=example.org",
},
redirect = false
})
it("the configured forwarded information is used in redirect uri", function()
assert.are.equals(302, status)
local redir_escaped = test_support.urlescape_for_regex("https://example.org/default/redirect_uri")
assert.truthy(string.match(string.lower(headers["location"]),
".*redirect_uri=" .. string.lower(redir_escaped) .. ".*"))
end)
end)
describe("when accessing the protected resource without token and a forwarded header values are quoted", function()
test_support.start_server()
teardown(test_support.stop_server)
local _, status, headers = http.request({
url = "http://127.0.0.1/default/t",
headers = {
["forwarded"] = 'proTo="https";Host="example.org"',
},
redirect = false
})
it("the configured forwarded information is used unquoted in redirect uri", function()
assert.are.equals(302, status)
local redir_escaped = test_support.urlescape_for_regex("https://example.org/default/redirect_uri")
assert.truthy(string.match(string.lower(headers["location"]),
".*redirect_uri=" .. string.lower(redir_escaped) .. ".*"))
end)
end)
describe("when accessing the protected resource without token and a forwarded header has multiple fields", function()
test_support.start_server()
teardown(test_support.stop_server)
local _, status, headers = http.request({
url = "http://127.0.0.1/default/t",
headers = {
["forwarded"] = 'proTo="https";Host="example.org",host=example.com',
},
redirect = false
})
it("the configured forwarded information is used unquoted in redirect uri", function()
assert.are.equals(302, status)
local redir_escaped = test_support.urlescape_for_regex("https://example.org/default/redirect_uri")
assert.truthy(string.match(string.lower(headers["location"]),
".*redirect_uri=" .. string.lower(redir_escaped) .. ".*"))
end)
end)
describe("when accessing the protected resource without token and multiple forwarded headers", function()
test_support.start_server()
teardown(test_support.stop_server)
-- the http module doesn't support specifying multiple headers
local r = io.popen("curl -H 'Forwarded: host=example.org' -H 'Forwarded: host=example.com'"
.. " -o /dev/null -v --max-redirs 0 http://127.0.0.1/default/t 2>&1")
local o = r:read("*a")
r:close()
it("the first header is used", function()
assert.truthy(string.match(string.lower(o), ".*http/.* 302"))
local redir_escaped = test_support.urlescape_for_regex("http://example.org/default/redirect_uri")
assert.truthy(string.match(string.lower(o),
".*location: %S+redirect_uri=" .. string.lower(redir_escaped) .. ".*"))
end)
end)
|
data:extend({
{
type = "int-setting",
name = "Energy_consumption_m",
setting_type = "startup",
minimum_value = 3,
default_value = 3
}
})
|
--***********************************************************
--** ROBERT JOHNSON **
--***********************************************************
---@class ISUIHandler
ISUIHandler = {};
ISUIHandler.allUIVisible = true;
ISUIHandler.visibleUI = {};
ISUIHandler.setVisibleAllUI = function(visible)
local ui = UIManager.getUI();
-- if we asked for not visible, we're gonna fetch all our UI, and if they are visible we get them invisible + we keep wich one we closed
-- into a map, so when we're going to set them visible, we know exactly wich one to set visible
if not visible then
for i=0,ui:size()-1 do
if ui:get(i):isVisible() then
table.insert(ISUIHandler.visibleUI, ui:get(i):toString());
ui:get(i):setVisible(false);
end
end
else
for i,v in ipairs(ISUIHandler.visibleUI) do
for i=0,ui:size()-1 do
if v == ui:get(i):toString() then
ui:get(i):setVisible(true);
break;
end
end
end
table.wipe(ISUIHandler.visibleUI);
end
UIManager.setVisibleAllUI(visible)
end
ISUIHandler.toggleUI = function()
ISUIHandler.allUIVisible = not ISUIHandler.allUIVisible;
ISUIHandler.setVisibleAllUI(ISUIHandler.allUIVisible);
end
--ISUIHandler.showPing = function()
-- getCore():setShowPing(not getCore():isShowPing());
--end
ISUIHandler.onKeyStartPressed = function(key)
local playerObj = getSpecificPlayer(0)
if not playerObj then return end
if playerObj:isDead() then return end
if key == getCore():getKey("VehicleRadialMenu") and playerObj then
-- 'V' can be 'Toggle UI' when outside a vehicle
if key == getCore():getKey("Toggle UI") and getCore():getGameMode() ~= "Tutorial" and not ISVehicleMenu.getVehicleToInteractWith(playerObj) then
ISUIHandler.toggleUI()
return
end
ISVehicleMenu.showRadialMenu(playerObj)
end
end
ISUIHandler.onKeyPressed = function(key)
local playerObj = getSpecificPlayer(0)
if key == getCore():getKey("VehicleRadialMenu") and playerObj then
-- 'V' can be 'Toggle UI' when outside a vehicle
if key == getCore():getKey("Toggle UI") and not ISVehicleMenu.getVehicleToInteractWith(playerObj) then
return
end
if playerObj:isDead() then return end
if not getCore():getOptionRadialMenuKeyToggle() then
-- Hide radial menu when 'V' is released.
local menu = getPlayerRadialMenu(0)
if menu:isReallyVisible() then
ISVehicleMenu.showRadialMenu(playerObj)
end
end
return
end
if key == getCore():getKey("Toggle UI") and playerObj and getCore():getGameMode() ~= "Tutorial" then
ISUIHandler.toggleUI();
-- getGameTime():thunderStart();
-- getGameTime():doThunder();
-- getAmbientStreamManager():addRandomAmbient();
-- getAmbientStreamManager():doGunEvent();
end
-- if key == getCore():getKey("Show Ping") and isClient() then
-- ISUIHandler.showPing();
-- end
end
Events.OnKeyStartPressed.Add(ISUIHandler.onKeyStartPressed);
Events.OnKeyPressed.Add(ISUIHandler.onKeyPressed);
|
local status_ok, go = pcall(require, "go")
if not status_ok then
return
end
local lsp_status_ok, _ = pcall(require, "nvim-lsp-installer")
if not lsp_status_ok then
return
end
local path = require 'nvim-lsp-installer.path'
local install_root_dir = path.concat {vim.fn.stdpath 'data', 'lsp_servers'}
go.setup({
go='go', -- go command, can be go[default] or go1.18beta1
goimport='gopls', -- goimport command, can be gopls[default] or goimport
fillstruct = 'gopls', -- can be nil (use fillstruct, slower) and gopls
gofmt = 'gofumpt', --gofmt cmd,
max_line_len = 120, -- max line length in goline format
tag_transform = false, -- tag_transfer check gomodifytags for details
test_template = '', -- g:go_nvim_tests_template check gotests for details
test_template_dir = '', -- default to nil if not set; g:go_nvim_tests_template_dir check gotests for details
comment_placeholder = '' , -- comment_placeholder your cool placeholder e.g. ﳑ
icons = {breakpoint = '🧘', currentpos = '🏃'},
verbose = false, -- output loginf in messages
lsp_cfg = false, -- true: use non-default gopls setup specified in go/lsp.lua
-- false: do nothing
-- if lsp_cfg is a table, merge table with with non-default gopls setup in go/lsp.lua, e.g.
-- lsp_cfg = {settings={gopls={matcher='CaseInsensitive', ['local'] = 'your_local_module_path', gofumpt = true }}}
lsp_gofumpt = false, -- true: set default gofmt in gopls format to gofumpt
lsp_on_attach = nil, -- nil: use on_attach function defined in go/lsp.lua,
-- when lsp_cfg is true
-- if lsp_on_attach is a function: use this function as on_attach function for gopls
lsp_codelens = true, -- set to false to disable codelens, true by default
lsp_diag_hdlr = true, -- hook lsp diag handler
-- virtual text setup
lsp_diag_virtual_text = { space = 0, prefix = "" },
lsp_diag_signs = true,
lsp_diag_update_in_insert = false,
lsp_document_formatting = true,
-- set to true: use gopls to format
-- false if you want to use other formatter tool(e.g. efm, nulls)
gopls_cmd = {install_root_dir .. '/go/gopls'}, -- if you need to specify gopls path and cmd, e.g {"/home/user/lsp/gopls", "-logfile","/var/log/gopls.log" }
gopls_remote_auto = true, -- add -remote=auto to gopls
dap_debug = true, -- set to false to disable dap
dap_debug_keymap = true, -- true: use keymap for debugger defined in go/dap.lua
-- false: do not use keymap in go/dap.lua. you must define your own.
dap_debug_gui = true, -- set to true to enable dap gui, highly recommand
dap_debug_vt = true, -- set to true to enable dap virtual text
build_tags = nil, -- set default build tags
textobjects = true, -- enable default text jobects through treesittter-text-objects
test_runner = 'go', -- richgo, go test, richgo, dlv, ginkgo
run_in_floaterm = false, -- set to true to run in float window.
--float term recommand if you use richgo/ginkgo with terminal color
})
-- Run gofmt + goimport on save
vim.api.nvim_exec([[ autocmd BufWritePre *.go :silent! lua require('go.format').goimport() ]], false)
|
local core = require "sys.core"
local netssl = require "sys.netssl.c"
local type = type
local assert = assert
local socket_pool = {}
local ssl = {}
local EVENT = {}
local function new_socket(fd)
local s = {
fd = fd,
delim = false,
co = false,
sslbuff = false
}
s.sslbuff = netssl.create(fd)
assert(socket_pool[fd] == nil,
"new_socket incorrect" .. fd .. "not be closed")
socket_pool[fd] = s
end
function EVENT.accept(fd, _, portid, addr)
assert(false, "ssl don't support accept")
end
function EVENT.close(fd, _, errno)
local s = socket_pool[fd]
if s == nil then
return
end
if s.co then
local co = s.co
s.co = false
core.wakeup(co, false)
end
socket_pool[fd] = nil
end
function EVENT.data(fd, message)
local s = socket_pool[fd]
if not s then
return
end
s.sslbuff = netssl.message(s.sslbuff, message)
if not s.delim then --non suspend read
assert(not s.co)
return
end
if type(s.delim) == "number" then
assert(s.co)
local dat = netssl.read(s.sslbuff, s.delim)
if dat then
local co = s.co
s.co = false
s.delim = false
core.wakeup(co, dat)
end
elseif s.delim == "\n" then
assert(s.co)
local dat = netssl.readline(s.sslbuff)
if dat then
local co = s.co
s.co = false
s.delim = false
core.wakeup(co, dat)
end
elseif s.delim == "~" then
assert(s.co)
local ok = netssl.handshake(s.sslbuff)
if ok then
local co = s.co
s.co = false
s.delim = false
core.wakeup(co, true)
end
end
end
local function socket_dispatch(type, fd, message, ...)
assert(EVENT[type])(fd, message, ...)
end
local function suspend(s)
assert(not s.co)
local co = core.running()
s.co = co
return core.wait(co)
end
function ssl.connect(ip, bind)
local fd = core.connect(ip, socket_dispatch, bind)
if not fd then
return nil
end
assert(fd >= 0)
new_socket(fd)
local s = socket_pool[fd]
local ok = netssl.handshake(s.sslbuff)
if ok then
return fd
end
s.delim = "~"
ok = suspend(s)
if ok then
return fd
end
ssl.close(fd)
return nil
end
function ssl.close(fd)
local s = socket_pool[fd]
if s == nil then
return
end
if s.so then
core.wakeup(s.so, false)
end
socket_pool[fd] = nil
core.close(fd)
end
function ssl.read(fd, n)
local s = socket_pool[fd]
if not s then
return nil
end
if n <= 0 then
return ""
end
local r = netssl.read(s.sslbuff, n)
if r then
return r
end
s.delim = n
local ok = suspend(s)
if not ok then --occurs error
return nil
end
return ok
end
function ssl.readline(fd)
local s = socket_pool[fd]
if not s then
return nil
end
local r = netssl.readline(s.sslbuff)
if r then
return r
end
s.delim = "\n"
local ok = suspend(s)
if not ok then --occurs error
return nil
end
return ok
end
function ssl.write(fd, str)
local s = socket_pool[fd]
if not s then
return false, "already closed"
end
netssl.write(s.sslbuff, str)
return true
end
return ssl
|
return require('keycloak_role_check')
|
require('hlslens').setup({
calm_down = true,
nearest_only = true,
})
local activate_hlslens = function(direction)
local cmd = string.format("normal! %s%szzzv", vim.v.count1, direction)
local status, msg = pcall(vim.fn.execute, cmd)
-- 13 is the index where real error message starts
msg = msg:sub(13)
if not status then
vim.api.nvim_echo({{msg, "ErrorMsg"}}, false, {})
return
end
require('hlslens').start()
end
vim.keymap.set('n', 'n', '',
{
noremap = true,
silent = true,
callback = function() activate_hlslens('n') end
})
vim.keymap.set('n', 'N', '',
{
noremap = true,
silent = true,
callback = function() activate_hlslens('N') end
})
vim.keymap.set('n', '*', "<Plug>(asterisk-z*)<Cmd>lua require('hlslens').start()<CR>", { silent = true })
vim.keymap.set('n', '#', "<Plug>(asterisk-z#)<Cmd>lua require('hlslens').start()<CR>", { silent = true })
|
require "fufusion.prototypes.item"
require "fufusion.prototypes.technology"
require "fufusion.prototypes.recipe"
require "fufusion.prototypes.fluid"
|
local _M = {
_VERSION = "2.3.1"
}
local lock = require "resty.lock"
local shdict = require "shdict"
local JOBS = shdict.new("jobs")
local ipairs = ipairs
local update_time = ngx.update_time
local ngx_now = ngx.now
local worker_exiting = ngx.worker.exiting
local timer_at = ngx.timer.at
local ngx_log = ngx.log
local INFO, ERR, WARN, DEBUG = ngx.INFO, ngx.ERR, ngx.WARN, ngx.DEBUG
local xpcall, setmetatable = xpcall, setmetatable
local worker_pid = ngx.worker.pid
local tinsert = table.insert
local assert = assert
local random = math.random
local workers = ngx.worker.count()
local function now()
update_time()
return ngx_now()
end
local main
local function make_key(self, key)
return self.key .. "$" .. key
end
local function set_next_time(self, interval)
local next_time = now() + (interval or self.interval)
JOBS:set(make_key(self, "next"), next_time)
return next_time
end
local function get_next_time(self)
local next_time = JOBS:get(make_key(self, "next"))
if not next_time then
next_time = now()
JOBS:set(make_key(self, "next"), next_time)
end
return next_time
end
--- @param #Job self
local function run_job(self, delay, ...)
if worker_exiting() then
return self:finish(...)
end
local ok, err = timer_at(delay, main, self, ...)
if not ok then
ngx_log(ERR, self.key .. " failed to add timer: ", err)
self:stop()
self:clean()
return false
end
return true
end
local function wait_others(self)
local wait_others = self.wait_others
for i=1,#wait_others
do
if not wait_others[i]:completed(true) then
return false
end
end
self.wait_others = {}
return true
end
main = function(premature, self, ...)
if premature or not self:running() then
return self:finish(...)
end
if not wait_others(self) then
return run_job(self, 1, ...)
end
local remains = self.mutex:lock(make_key(self, "mtx"))
if not remains then
return run_job(self, 0.2, ...)
end
if self:suspended() then
self.mutex:unlock()
return run_job(self, 1, ...)
end
if not self:running() then
self.mutex:unlock()
return self:finish(...)
end
local next_time = get_next_time(self)
if now() >= next_time then
local counter = JOBS:incr(make_key(self, "counter"), 1, -1)
local ok, err = xpcall(self.callback, function(err)
ngx.log(ngx.ERR, debug.traceback())
return err
end, { counter = counter, hup = self.pid == nil }, ...)
if not self.pid then
self.pid = worker_pid()
end
if not ok then
ngx_log(WARN, "job ", self.key, ": ", err)
end
local new_next_time = get_next_time(self)
if new_next_time == next_time then
next_time = set_next_time(self)
else
-- next time changed from outside
next_time = new_next_time
end
end
local delay = next_time - now() + random(0, workers - 1) / 10
run_job(self, delay, ...)
self.mutex:unlock()
end
--- @type Job
local job = {}
-- public api
--- @return #Job
function _M.new(name, callback, interval, finish)
local j = {
callback = callback,
finish_fn = finish,
interval = interval,
key = name,
wait_others = {},
pid = nil,
cached = {},
mutex = lock:new("jobs", { timeout = 0.2, exptime = 600, step = 0.2 })
}
return setmetatable(j, { __index = job })
end
--- @param #Job self
function job:run(...)
if not self:completed(true) then
if not self:running(true) then
ngx_log(INFO, "job ", self.key, " start")
JOBS:set(make_key(self, "running"), 1)
end
self:running(true)
return assert(run_job(self, 0, ...))
end
ngx_log(DEBUG, "job ", self.key, " already completed")
return nil, "completed"
end
--- @param #Job self
function job:touch()
self.mutex:expire()
end
--- @param #Job self
function job:set_next(interval)
return set_next_time(self, interval)
end
--- @param #Job self
function job:suspend()
if not self:suspended() then
ngx_log(INFO, "job ", self.key, " suspended")
JOBS:set(make_key(self, "suspended"), 1)
end
end
--- @param #Job self
function job:resume()
if self:suspended() then
ngx_log(INFO, "job ", self.key, " resumed")
JOBS:delete(make_key(self, "suspended"))
end
end
--- @param #Job self
function job:stop()
JOBS:delete(make_key(self, "running"))
JOBS:set(make_key(self, "completed"), 1)
ngx_log(INFO, "job ", self.key, " stopped")
end
local function check_cached(self, flag, nocache)
local sec = now()
local c = self.cached[flag]
if not c or nocache or sec - c.last > 1 then
if not c then
c = {}
self.cached[flag] = c
end
c.b = JOBS:get(make_key(self, flag)) == 1
c.last = sec
end
return c.b
end
--- @param #Job self
function job:completed(nocache)
return check_cached(self, "completed", nocache)
end
--- @param #Job self
function job:running(nocache)
return check_cached(self, "running", nocache)
end
--- @param #Job self
function job:suspended(nocache)
return check_cached(self, "suspended", nocache)
end
--- @param #Job self
function job:finish(...)
if self.finish_fn then
self.finish_fn(...)
end
return true
end
--- @param #Job self
function job:wait_for(other)
tinsert(self.wait_others, other)
end
--- @param #Job self
function job:clean()
local retval = self:running(true)
JOBS:delete(make_key(self, "running"))
JOBS:delete(make_key(self, "completed"))
JOBS:delete(make_key(self, "suspended"))
return retval
end
--- @param #Job self
function job:reset()
JOBS:delete(make_key(self, "completed"))
JOBS:delete(make_key(self, "suspended"))
return self:running(true)
end
return _M
|
-- Copyright (c) 2018 Redfern, Trevor <trevorredfern@gmail.com>
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
describe("Terrain", function()
local Terrain = require "terrain"
it("grass", function()
local g = Terrain:grass()
assert.not_equals(nil, g)
end)
it("defines dirt", function()
local d = Terrain:dirt()
assert.not_equals(nil, d)
end)
it("returns the same terrain type after registering one", function()
local g = Terrain:grass()
local g2 = Terrain:grass()
assert.equal(g, g2)
end)
it("can return a loaded terrain by name", function()
local g = Terrain:grass()
assert.equal(g, Terrain:get_terrain("grass"))
end)
end)
|
local image = require("Image")
local GUI = require("GUI")
local keyboard = require("Keyboard")
------------------------------------------------------
local workspace, window, menu = select(1, ...), select(2, ...), select(3, ...)
local tool = {}
local locale = select(4, ...)
tool.shortcut = "Brs"
tool.keyCode = 48
tool.about = locale.tool5
local backgroundSwitch = window.newSwitch(locale.drawBack, true)
local foregroundSwitch = window.newSwitch(locale.drawFor, true)
local alphaSwitch = window.newSwitch(locale.drawAlpha, true)
local symbolSwitch = window.newSwitch(locale.drawSym, true)
local symbolInput = window.newInput("", locale.symToDraw)
symbolInput.onInputFinished = function()
symbolInput.text = unicode.sub(symbolInput.text, 1, 1)
end
local alphaSlider = window.newSlider(0, 255, 0, false, locale.alphaVal, "")
local radiusSlider = window.newSlider(1, 8, 1, false, locale.radius, " px")
radiusSlider.height = 2
tool.onSelection = function()
window.currentToolLayout:addChild(backgroundSwitch)
window.currentToolLayout:addChild(foregroundSwitch)
window.currentToolLayout:addChild(alphaSwitch)
window.currentToolLayout:addChild(symbolSwitch)
window.currentToolLayout:addChild(symbolInput)
window.currentToolLayout:addChild(alphaSlider)
window.currentToolLayout:addChild(radiusSlider)
end
tool.eventHandler = function(workspace, object, e1, e2, e3, e4)
if e1 == "touch" or e1 == "drag" then
local x, y = e3 - window.image.x + 1, e4 - window.image.y + 1
local meow = math.floor(radiusSlider.value)
for j = y - meow + 1, y + meow - 1 do
for i = x - meow + 1, x + meow - 1 do
if i >= 1 and i <= window.image.width and j >= 1 and j <= window.image.height then
local background, foreground, alpha, symbol = image.get(window.image.data, i, j)
image.set(window.image.data, i, j,
backgroundSwitch.switch.state and window.primaryColorSelector.color or background,
foregroundSwitch.switch.state and window.secondaryColorSelector.color or foreground,
alphaSwitch.switch.state and alphaSlider.value / 255 or alpha,
symbolSwitch.switch.state and (symbolInput.text == "" and " " or symbolInput.text) or symbol
)
end
end
end
workspace:draw()
end
end
------------------------------------------------------
return tool
|
return {
version = "1.2",
luaversion = "5.1",
tiledversion = "1.3.2",
orientation = "orthogonal",
renderorder = "right-down",
width = 95,
height = 95,
tilewidth = 24,
tileheight = 24,
nextlayerid = 17,
nextobjectid = 21,
properties = {},
tilesets = {
{
name = "tiles",
firstgid = 1,
filename = "tiles.tsx",
tilewidth = 24,
tileheight = 24,
spacing = 0,
margin = 0,
columns = 10,
image = "tiles.png",
imagewidth = 240,
imageheight = 240,
tileoffset = {
x = 0,
y = 0
},
grid = {
orientation = "orthogonal",
width = 24,
height = 24
},
properties = {},
terrains = {},
tilecount = 100,
tiles = {
{
id = 1,
properties = {
["collidable"] = true
}
},
{
id = 2,
properties = {
["collidable"] = true
}
},
{
id = 5,
properties = {
["collidable"] = true
}
},
{
id = 6,
properties = {
["collidable"] = true
}
},
{
id = 7,
properties = {
["collidable"] = true
}
},
{
id = 10,
properties = {
["collidable"] = true
}
},
{
id = 14,
properties = {
["collidable"] = true
}
},
{
id = 18,
animation = {
{
tileid = 18,
duration = 500
},
{
tileid = 28,
duration = 500
}
}
},
{
id = 20,
properties = {
["collidable"] = true
}
},
{
id = 21,
properties = {
["collidable"] = true
}
},
{
id = 22,
properties = {
["collidable"] = false
}
},
{
id = 23,
properties = {
["collidable"] = false
}
},
{
id = 24,
properties = {
["collidable"] = true
}
},
{
id = 25,
properties = {
["collidable"] = true
}
},
{
id = 26,
properties = {
["collidable"] = true
}
},
{
id = 27,
properties = {
["collidable"] = true
}
},
{
id = 33,
properties = {
["collidable"] = true
}
},
{
id = 34,
properties = {
["collidable"] = true
}
},
{
id = 38,
properties = {
["collidable"] = true
},
animation = {
{
tileid = 38,
duration = 600
},
{
tileid = 48,
duration = 600
}
}
},
{
id = 40,
properties = {
["collidable"] = true
}
},
{
id = 41,
properties = {
["collidable"] = true
}
},
{
id = 42,
properties = {
["collidable"] = true
},
animation = {
{
tileid = 42,
duration = 500
},
{
tileid = 41,
duration = 500
}
}
},
{
id = 43,
properties = {
["collidable"] = true
}
},
{
id = 44,
properties = {
["collidable"] = true
}
},
{
id = 46,
properties = {
["collidable"] = true
}
},
{
id = 47,
properties = {
["collidable"] = true
}
},
{
id = 48,
properties = {
["collidable"] = true
}
},
{
id = 76,
properties = {
["collidable"] = true
}
},
{
id = 77,
properties = {
["collidable"] = true
}
},
{
id = 78,
properties = {
["collidable"] = true
}
},
{
id = 86,
properties = {
["collidable"] = true
}
},
{
id = 87,
properties = {
["collidable"] = true
}
},
{
id = 88,
properties = {
["collidable"] = true
}
},
{
id = 90,
animation = {
{
tileid = 90,
duration = 900
},
{
tileid = 80,
duration = 400
}
}
},
{
id = 96,
properties = {
["collidable"] = true
}
},
{
id = 97,
properties = {
["collidable"] = true
}
},
{
id = 98,
properties = {
["collidable"] = true
}
}
}
}
},
layers = {
{
type = "tilelayer",
id = 1,
name = "Water",
x = 0,
y = 0,
width = 95,
height = 95,
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
properties = {},
encoding = "base64",
compression = "zlib",
data = "eAHt0EEKgDAMBMD+xv//UC+FEkywsccRRNN09zBjeAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQ2BG4nsvx3cm72xOI5nHutUpVAtE4m6sOu55AZh3Pe+1SlUA0zuaqw64vkHmv5/12yUpgNc7+q7zdP4HMfJ7/a5euBKbx27fK2Z0TWO3PtWoiQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQOCLwA3HCQwK"
},
{
type = "tilelayer",
id = 2,
name = "Ground",
x = 0,
y = 0,
width = 95,
height = 95,
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
properties = {},
encoding = "base64",
compression = "zlib",
data = "eAGF1EuKbclyreHTE3kf9KwlqHK5kioqq//9kP8wPzFwVuYJMMxsvMxn7GCfv/3tb//z1bn9v7/6h9vtehgtvs5D155Ob14uj6zwzWpPT2OHyYRv94609PU0fPrm/+LTpZG5Pvn5lLzlzHLSmstrp3En7Ne8WBolz15emFw9nnazzPU06beb6eTVy8PX33IP7kb75pnr8hfj15fzrXFmd31LXHM+GjtN3BlNurdo8lSyFg9rr9Z/7r6ednx4+vqZwoe9mfTuyH79eL1M93bO517a9iqtaselbbbX052v4ptl4uxxYbvv7OZ7w72Xf3HZ3Sm3TtNuDm9P3yyXZr1mmjLcMesyaXnxevjOb178es/dq3T5mutyFqPBpVXp1kfjvTh4Pa/3mfXwZrn19ny8Yfx42N4NW8/O53KVe81u5JO7d5Y356vo3dzcMO9KW4XBecqEme3rjzu3YDqMN3yz6eDbm/O9mPt1cxp6b8Gdj5PjLfxu8KVfbHPzxOu49vWk2XvtsHB7nrxhcD4YPI877/3NiaPzprybS7M4T5i81x+nvI+mvTle1i/NYmlXL4u/ToNzhya8OTytnbe9igujlRPXDKfF6/BztWaeMOVGO93mN+P4lw/D53+5dpVOBm1ceB3WLpeeLk0YnGfxxZpxbqx35/Pl0rdXm9fuPm89TVw37Is1K7705jqfjPgqH16naadxT6eNp8m3e5r0m7cYPI1c/jh43b1w3Ku1u9Gel/6d6es8NDxxzfHNlffQwtq3ZMhOFwZPG6boZLhJn66ZDk7/q6eVY6Yrb6s8uzltGO/yceE0uDo8rqz3rfFhdOeb280825vjlZx2ect5m9y45l8+b63T6DhvKacKp6/DVlfG4ns73A04vYz39t5pXt7voIxXB6PXe0M+Zedvz7t+nB6X/3zdvB6a+qtrL4t+92a7N8rC2cvY23wvnyZM0enhsvZdzWnWTxeOq9PKcsv7dHh6tTn8burhMmD5ZIQ10+zsZv18mniZzeHti4fh6mXvbbfqfO8tN/nxcvFy7XWYDttdTlhlP7PnC6+/8xk8rr2ia5bpbpi53i4bvlnx4Vsy4yo5epiMtNVymwWH0ZdRlbOc/c1fX/r4sPN1Gdvj08lK+4sPx9XfXH5Z7te9C1fnjz/fvhlh7XJk8NXl1M3unYtV4fX0sujDK566Ck/Ho7vjHeHmerU+HH+dx6yf8Ya9OWFplts5zn0zT3gz3rv0bqm8zXoaPljd7A1p9h4ffL9Hfhnxde/Tw+jqZjfo9PSymqs88etfTbP97We4Znc2L0/7YquV6e1xFdwOC6d9384TTrdvWiyNnDTnK17a8Fe7erPbfC8uB95OW354uxzv0Gn56ePPLXjzejbTnJZGDi5/9Qvn46Wlr3uP94Y1y6tXZ3qeN3s9eJgstzZvOXO+7m3nhcXD8slcnJauvRnO0165r9PngTXL4NNpzqdPZ65Xq03Ps73Znbr9PHhZYXqzcluHuyMX3l6VxeMuDm7PC9vvCts32fnc4Kl369xK4669HgZ//XnSVJu1M66+WbybGdaeFh6mwqv2spr3be3rpwmXAWsPX39z/rfo6lXeNKuHh6k3Z/H0VRpv0dPF1Zffm/sGPj0ffj3msiuaZm/jDavSVPuWcs6tuox6mL1ZJlx2Groy5PzKoHN/s5pfXJZb+t7Jp+JVWDqe9mozX543nLbuG83xr4bXN6atwt/Oj4vniwuvL9Z8bsX9msPkrQ/mpi5HL3t9dPU0+quLe6scWel56+24xWXEN6epn6/bw/jiVPxqmuk2G/5yvPUy3V4dHEeb5le9b+Wr48pUm2embW/W+fduOfS6nDgVVuV9+XznFj9N+3rC01XN9PY6j7m9eXPCZNVVmq3zcTJl8e8bFsu3Hjp53hIOS1/t3py2Lr/ZG5tl49sXe3Pz5N9bYXzuyaCtw/R8ctZHmw6eDv72cujMvOG8ccs3u5++nc9cdy8On8+cZnd62fZ0PGEqLC59WHOYnV+evpr1rG/nzTbj8yv57enaK/fq8PNx8tpx9G5srjxZ/LybY67/VSZeFl97vnZF4x6+vje8WQbeHr8aed3B4cMqXl1mumY4H75+vkrTXDfz09vTNctrr9IttnN8tRr307lbt6eHp22ur2/n1coIO1+9GWnozHq+5s3HnYtX+Lo79Ty0y52LV97RHK+7Wd+8eJU+v4yd0/y6T+stevqd29PW3Ze/GTR538J5hy5n7y0mp9sVLv++xf7ycDm7N7vL134+PKy5DqfT4bLaYXnD6zLePTxMXtr89M3x1c58tOs/V1uF1St+GfLhaWBp6OD1yr3VuM1fJoy+PVzJh7efj+fZnHTxW2Fp36x86XR8WHM9r9t0L56W7s3wtjzNqv3VlhHuXny1WP71ucvjnjt4+2bK5umOW3F529fb7hY/Da5e4WXJ8abVNLvXvFpcmCzZi6WrwuoVnp6fxv72vDAZ9b/6dp58zZVv5QuT02x3g14GvE5bT1ffSkOPr/sOs317Ph54e7W5O5/LpeVtDqOp7+6+Hp+Hz632nfFvLu/eocWVc27trebw98av/M02ly3jfHO9PFz8+5b29+Zi5/KVtzXL2azwdm9olrNvoNkuu34+X30LV34VB3Nn3xVH++rb49X6z8W9rVlms3vNaepVOA/cje3N6Su4zHy8O8enXf3y8PNp3p62DCWr7h4ub7O+mrD2+vraw2V4G2/46sPpw5vPLTq+5eJfXEZdpfP+Zh7a5eXraeLtZnl1mn3r8nn4NidsvbuH4/T4cmWXBUsjW18tXZyKl62nq3Dh7unyeVaTt4Ll2cLV5TWX2b5va3cDfkbTvNlpva2ON7fTuCU/rqKtyw5Pt3sYTbOcNG5sFu1ifLy4MuJ0vNxw2noFS9OsN++eFiejvcItzht/Pt2bieNPl0YPX8/eMqflfzFvWM3mhfPU42RtXzyP3VzPXzXj65XsuApOh7fTwXsLjLc9XtG8797MuArGI7Ms/M7n4u11Ge356ipuZ3fOxTd38bgqXz2uXsnPa4fVzW6meXX7Jjf05dYXXpWv86Sr4upwnrD1yEj3vrcdtp53dqNeubX4+bJk2uv0uHzuwtKkVXhvwb/3N4sWVhZ9XTasvTub7T16WnozLn/lrh6WJn1ztbM9jdth65GVLzy+Gd7OG7/euL0nI/0/3vqnqX/+tPnjZfLAz+W20nmPOZ5Plr2c+Mpb47Zwed3l01dPk48HLyvNFn67t9K156/cwIXlrat2OnPdm9L1e/+vW/vzH3fp36J/g/znq82XI9edOixfuwwcr++ph53Rhr2VhlfPo9K71xz+3swXhk9TvbdkxeWpV7zu7z3ZyzXDefud/+et9/d+of/7+eNOsmV48+anOV81x7X7Hl5ZcD0tTXO1mfL49XQy6vB6e77mevv5yi16O92L58M1u/nqdjdvz9v+77f+3s8fV8B77uz7tvemNHjv8tb2Znva5nPLbA9T7vKF07m33Ztkpm+G7zs2k26z8es107XnlduMq3fb+3i97f9d7t9u/dXPH5ekL0922N40189X7vOE04U1l1OdW/Thy9nl8Iavx5tk0buRPq7ilR3GT787Pc7d9bkX9hauHBl/72//j6t97/CWLzNs92bYdrfraermstziWU3Yq42vVi8DJ3fxZr59Q/PeSYMPd4cGV0+Lb16Mvu723/vb/+PLS1/W2zf/fJq6Ob7qprubEXZuhVXtMs+dK1yzDDpcnte/GF0ZzfWt12t3p24uV23uqyk/LE36X/4/+9v/l6v//5/n3J5fl+WeG/Fm3fva19dc+c5zZ5qw9nidjqdOnyYe1l7R2unDq3Czm2F/lsXjLeWpMBW2mmbe881h/e3/6y3/9/c7b+/3fm6VU6+8E/ZmhrsRlwdWN6fhhdfPp4lTYYpvOffS4F99e/l8PKuP+/U+2vd99rLzplus+d3dD5db92/gbz1Mnn4uls872+PqbtndWa230OZLL//NxtfNtHr5cTJlyMWnaQ43p22u5MHS0uPSwZvhe7M5fHXN4bKX/6tZ7mbJwO1+7o2qTLnLN1fLm+nrafbm+TCa9qq9npavbsa52W6mq4erdrfltMfz1tuVjHBvqdPB8Pl4mhXMXfrNkSuT59WWGValkWmWw3cebXxYxcsTJtc76vi4NO115Ra8XrYdz6/Hb/kGvPy6rDre+/m28/LliQ+H1RWczg2dx81furB0uPc9drfSwnTvaU9XNcteHU5Po7zDDW+C54G5tXc2083N5klXJn29grnh7t6Ig+expwlXbsnCt59bMtth4fTlyKANo9k5jL4uw826DFp6eJ7NbIetv9kNd+x0Or6bYTLbzbzt4etdP64Op8XB9zvcDdt5d/56VU7V7H3b1wvn6QZffXezd3pPuxwdtlm4Oi8sHW3cW+XFV69fRh0Hy+ctZYafW/Ll2uPk6Gnw/OkUfvVx7oa77R5PeFq9OT1d+5Z3bB7tZtB5Uxlu0uuy0qzvzYsvb3szXXmV99dxZjz8fJ56GF7W7i//etyAe0d7M15meHO5+DAFdze8We2e315ms0zcdndlx3mX/LBmPvj58PbmijasnM3C1d1d/lwcVzfTwNLJf+c0ODfkeCe8vYo/X7engbkfB+etp+NzfzOb7WllNC8Hr8uD7R08rF2+XnY4Dv7mylp9c/q4Zj3vL78M78njXvP6aOKbNztt+BZstYvJ84b3rvzNzKPKUmnCt/MvDsu3d/nSxlXNNO28tO1V+/nm7bL4vMPOVw9z780PV+7RdE9umJKFs9O3N9PD5e970q5+uXxV2Ha58uLKgLdX7ZsNy7eZdN7CU6eTbV9tnOw6zS9cNk27bBlxlfs88RWcZnfY6pord2g211vj0m6mOVxGGDwPP01cGM7N7bL0OPpy7DB5cetphtXp63ZZq+2N8b5jtWEv3u4Nep5mHE9Ydb7uTXw83pWOdz3NNG7IXR2vfDtPHUZTLmx18t1t5zdv7x2VPJlhfM08e8sNnaadp25f797JR9+cHm+Pr2S41R7O08zz9vWuzpy+WWaz3LdvVrM9j7uw7fEqXVw7j7nO5104e28K0/H1KhxX37z2ctytx68eF0bvvXTtMP1crLKnNdffXFo34sMq2ublm6vwMnHtzWFulmGmW2w5PrrzeVcPq3tfvjxh7tflwNLlOV/h5eu83qPHqzTlvNow74njbeZN07zesNXkC6unba7/yoPRysljruMXD1tNc5UGx6f7Dj5a3Tvxdd7F6MOa5dbb3V8+TIXL43WHBl5eM7zO+3LpZL89Ln14Gc1u8G2PT6vLa6drLqt9Z2/l3zfLweVVZcBluCVj+ebwfJVdx8lIE2ZPp+THnVvtChaevr6ce+Eqvjkuv91cr+SZ6c7H19OoeBnNFS783JLVLF/u66Ghk21PH7bZeSo4j335fZvbdThMhlya8H3L6tO21/nThvHZNw+vy5ezO015y6+m+b2XFr4ZYfZmGu+vq/PwtOHVe3P5uDRh7tWrsNXS4PXz6f+se2edp56+zLqC0+HtdW/amZ/erfB09ddHG4eXuZ50tL4FZs/vZr29kgery4qX0/yLg705u5fx673h7pZPx6vHvXfiwuTShMnc3iy/OZ+Mc+fqzaLB8bdX9noVtpnmevy+IW0VV6/k8G1mvJzmil5u3beZ07ixubLSna/c21w59fD6m7e5vPVwWj554fLWA1vdGW14msXcgadZvlnx08Lr+1Y4XT0+//v2tHL3Lbz0MtJXy9vT7tz+ZsP0Nyd/XNWc37vbcdtX00zXvPk88bi9Q8vfHl83x1WL0ZQpD8bnXXmr8HrFxwvzRrfCcbQ6jb0O46lv4d15vWnThK/GDquH8fPY6cPP39HS1OXnh+cP31qO1m0ZNOFqsXTh9XMrjne55dOocDr55+PD0714+/m4eru7tO1xlXx5cNpwXFhzGhnyF2vmr7dXcrwnrJmmGReWXn9nPp76+Ty4vScnjZm3nb+erzrTm9fXzk+vp4tvN7uRp1mdO1dpce0KJotvb5t50tDLlZMmbCuskpO/Oc35ylz3hhdLy6fTxHmXDHp5NO07yygzfP3tVVw+naZ9seZz630L/d4Oe738ZZjrq8W50b656auwav3lyDof304XVm1GO4+sxZrD63LqdpjMxZu9Ca57V7u7ZanwLXfCvLc5vF7BdVlu0err6Q1w3wvLr/Kks8tOq2B04WH1c8sdWDsOL6NehW/H/7opL6654nWHH16Ps8s9H7Y5uM3gc0te/iqcrzmsvc6r498eH7ZVhh1/PqweJjet3W0anCx7PSzdYmZ5dbr63kz7ljvb07Trss9gsuXv7sZiOy8fXq4bcc00cSrMXOflweXHyYLB5Yevz40X/6Upq8qzfW/uHRr6MmF1e/4q7MV53ZCft2rX0zTL2h3mfr4/472Bp0x6WHs6GXLXi8tf2dPQeT+ODk8bD1tPWJzKr7yxzrMZvOmbXx1+37b+fHH5aNYjD7+cmUZuHSfbfi5X5dlOB1+92+l5YNvdTfNrlplHhTWf6WHtfh/NryaMLs77YXUzLl2YrPD3Bl8dD1s/32LN1XLt55a79PLt29OXAUsLq1dxVTMe9mc+mXlWEy7D29vTtK9vebO7PHwy7ZsVdr7sdLxhVTysmT5Oweply6m3w+uyzsw8m4PfThdGK0+2e3zhCrfdW9OH19M3ez+NHS8Hby9DpV1f+L4nLiyvCuPbbDMu/bn1ZuDdwet5+MLStVft5S4Og+v5mt0737x7mCy+MLOep4pzr94e7g4NHz6cnpYmXGZYdb7O9/J0dffzpGv/s3IrbV67O7B4Wa8mLn292nm1i5u9N93e2pzwdrzMsEpWc5wu275c2FYZ6VV7te/ip2lfnV0/l/eGsOb6mXrvro5eRj7ZddrVpVHhzcvLgrmfzrdsX39zN+uV/Pcd7WWkabab8/GmC4fRLi8LRn+ur1qPGd5Oj3NLXlrfTNsev/7V51meLrySt5owunA3aOrnq3Q70+cJj3/zZMPp6mY325tp3ZZrp9EXT9teP9/cvthyaSpZzW+e+69Pbp64Ld8Qlk6+DP1XBu/5MmnW0ywzXXM9bdx6zDg6fnh7c3xzObLkw+rnFk8+sx6/5U6Y3GZ6fL2KW107jfvt66epV3Fp3y43/Hz83nUnbrXNVTiN7JeDp12ufblywtJ4QzNNWLPavTntuWVO1xwmozlMhYdtdz+8kivDm+xl8ZtltDfbz+zN+dbzZqfhTafocL/2vN61vXn3vLTLhS/nnWlxYc3ycPXFdg/3He5tNq3cvUGn/8rKj29WtPWwNJXZW9rf7w5b374Nzh+3/vDuLO42TA9Pv35zXU79TL235afha16dd9Gm29t8POmWLy9NXYbMsIqXzx6Xl5+vnLgKlmb9fLT4PL8qbzjfat4buLLp9bj08tzXNwuWJ3+9Cuevx9HSvTn06dS58+u389vTVr7DzfgKVy8/nrcOWx+sLgN2LlbB9dWGwctNL99OU4elK0fx0LZX7TTN5xauOa5O9792XBAy"
},
{
type = "tilelayer",
id = 3,
name = "Path",
x = 0,
y = 0,
width = 95,
height = 95,
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
properties = {},
encoding = "base64",
compression = "zlib",
data = "eAHt2dENwgAMQ8F+wCDsvyTyFE9VjgUMFysN8DxeBAgQIECAAAECBAgQIECAAAEClwV+lz98/NnZdwNgz74T6JL1nn0n0CXrPftOoEvWe/adQJes9+w7gS5Z71t7/q1/l347We+7+bNv7fm3/l367WS97+Y/e/6tf5d+O1n32/nbO52/7nf2S+bf+7fv4G667rez/7bxp9PZd+Nn39m79Tv7Txd9Onmdt3OaCnBv3Jdq3zT22zfsO/smWarbsumA+6ZxX6rOs+8EmuTd9Hrf2LsrG/el+i7LvhPoku36xn67nn1n3yRLdeN0HbBvOnv3ZWev9+w7gS7Zs5Z9J9Al631nv2etW6f179JvJ/vvpJ2/O7/z93tmZ79kz9zO395p7d37nT/7zt7O7+zXe93v/HW/s3fvdPaSCRAgQIAAAQIECBAgQIAAAQIECLxZ4A+TsQfh"
},
{
type = "tilelayer",
id = 4,
name = "House Void",
x = 0,
y = 0,
width = 95,
height = 95,
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
properties = {},
encoding = "base64",
compression = "zlib",
data = "eAHt0MEJACAMA0BXcP9l1Q0M5KFwhf5CaG8MQ4AAAQIECLwqMPdht/vqD7/edet+cqYrwL7rmbSxT7S6WfZdz6SNfaLVzbLvemojQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgkAosb6UFHg=="
},
{
type = "tilelayer",
id = 5,
name = "House",
x = 0,
y = 0,
width = 95,
height = 95,
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
properties = {},
encoding = "base64",
compression = "zlib",
data = "eAHt0DEKgDAMBdBO6ihOot7/nNa10x8yVHiBDKWfkLzWFAECBAgQIDCrwNIXW4PeZj3gx3vt4e5HmBPLBdjnVtVJ9tWi+Tz2uVV1kn21aD7v6tF76HN4f/9Pb0WAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAQL3ACxVfAh4="
},
{
type = "tilelayer",
id = 6,
name = "WellBase",
x = 0,
y = 0,
width = 95,
height = 95,
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
properties = {},
encoding = "base64",
compression = "zlib",
data = "eAHt0AENAAAIwzAcgX91IIMnnYKlVSJAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQI5Aj0rU7OrlMCBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECLwUWq4QAYA=="
},
{
type = "tilelayer",
id = 7,
name = "Trees",
x = 0,
y = 0,
width = 95,
height = 95,
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
properties = {},
encoding = "base64",
compression = "zlib",
data = "eAHF1FuuJgdShVE/MAGG0Q0MBXhEPELPfw5UtLzQpyAyz8Wm6kipHbFvkX+W5b/+9ttv//Tj+WvQjJ+9z/DVrp2/mkzxSefxLpAfukPfqKcoi2uHuR6zbjlY/snLU5y5j77inp92vaNvT7W3+XqX+tt98XRYT7vNfU9e2t51brx8m7Pv7HUfNxkPrnnaW/f2Xz08u0/vhbzt48PxFPctXnz3t776PjvztXc4fGfvjONp1rxRph081XQW6XB3dOdp/rqDa7azHj57e3E8zZuhHK/9qUOOv3vnnW+vLM4uL1udh/a20y4crvw1u9H75cyy3cvNbN+oG9LtUAcdjs4DaYNf+ZO7OnFu7H2y8p3rk33T65HV270d5ssn84ZycLzm4tNcf+/8Wd9+7rrdW7iimW/vfb96+ODWhqeZn1C2+JlZ33g9btr18NLtfN/99nr06nN37/x4e5G2kWf4zttXfXzdefF7f+rdvL09OJ3u7l3mK9+ct12d9+29b+/s3sNsh/gnvG58lN0Z/vJPHE9x3s37lddRjXfwO3/N71vu4XuX1ryZBi9eJ88T9qYeHHzKXjyu2XIXP7qHPtjnO9++d/WX019u+6o9vZvM1mXfdJ5mcUVz37mceaPe4T24p67qk/nO3/Ue7rX/mp+y+/277+6tdTcP7vvtqcZL3/v2bn32zclsvvt3vr3ejd6h/ePhK7+9dt7mNletnfW1r3yznfUUdZTbXdX4n3qrm7/y/Xu7d/c93dsvw1+9nLk9vLh2lbt4fUW+je4Ud64Z85vnSesNPf33GA6vww7xRdqg2a2Lk6225+brL99bPLB95XZ++3RCfoiX2+gWf/fOk+vf7rE3s+fxDMdr3xy9/FMXD1326uYpXv5Lx+mFw+uop/rmnzRdRdl+++q64Gj//LsZ6pAbrwd3odz2Xjvv1cM/yGemyV08TRY2i9vIs3F8OJnZy9N/0P/7R4cyOsbou8/8Lz+eevl1y9mryxWf/Hje9rVzz9tnb0+797z75OrTWW99+M3N9+tfe8zVO/s38B5uyOE31re12ek0O+SZ3fPE4Yud5a/u8XmqN19dF+7yVeu3nLn+rc0+/53PH5xZ39Pt8tc8nLtPej29J7c5/O7j23p9POXMg7L1db68uPG9/VWf2T39zeLqMfdeZ524J3997kDZa9999dJ0N4/jL9Lg1vTA3pHpd/to1vMZ7K09e0/v0L437+WXfcvRNuob3qPvSeMrbu/e653ZjY++d3WdUKcuvfjuzdS/PXw8dp34a6fJbHTrI57vws9w3mO8Hhzsd/3M3B7v4HfYi/Xzuc1nh83Us3kabD8O7u7yM9thu/Zsb679T7puuc987+3Zd3rLXE9vluetbqZtpA92rm/mPny4Zpvbvmrmevasd6MslNvf9TO7DujW7LjOl+4+Pw9+73yQbh80twNPg/WYtxcPq7/N/LA3cYNf/WvWfZwb+At5izP3aa68ed/Z/Ozbo5MXljfL7h779j3t+8bl+8z31+M+bJ+5XvNoZnj5y8nguuuA1d78fHLF5vg2V77ZPTdHk529+kffn1+PvR3lzEWzzOwe3CCu/s11f5p1tkd/kQ9X/573LZmNfLrbs7l6O/s3efLzfgV1DU6u2PnSqnd2H7d3fPFpdrd6uc1vjY4f7DO6Z/PNjGf+6t0zPx4+9Y5OM8vYdUL6Z/Z2NydbHbfv7l1m+/mKM3vk6PJw+7Z/vn29Zr7B+cO/9T29g67q5T7D8wyadcCt2eGTr/zM/IPdzZDPfuFwHn32H9Lf/+yD7fxd/j+/tx6dUEc7N3fl+Wn67Lujez3lO9dj3vjmp+2MnQ6Hn/nacfN965n97U+nm097O92Cbxm929tdfjj8hXTaztF7k7eaudiu5vFQxjfFD/rrjHvD6WyPG/jRPDgod+3D7Wf76bt/+6r3Fh7Srt7NNUNrng553r7l1v71B/Fv6/n3ZdK779gHr/faufpkt0fPk1fuQl2wHtzu33sz17x7mh//V/7+43fzXxL6z8wz7n7vdPHe7bMe/gvfOqrJ4gZxsNz20fA7s/X6zHB9utd1vn2/+8z727s972R2y3teuD1XlqfoDq67eSPvYDUzfu9y5T/D8W/8cf7Tf//1w/nfcc/8t+wz7veee33o3rn7fjcevL0ZXD3mQQ+fLL7eS+N70tpbz2f4+V5/5t++3992zdu/9/72rc3e561fdvtl6PbrrixP9/ov/bvf+B++ENx3+5u2Zi/uefZyfi+k19OZD27NProZbm74arvTLlf/Fz7ht629511w3hvSi7w4OyzfWef28RR5N4eHo5thOfPWZu/z7Y/5xaD32ej9nnD8Hu/djs7t4N3c9tP3Dbye6u0w89v5oR44/Hf+vvL/mul/eq++B0+RjvM7Bmm47nvmubDdck/o7tVTTR5nh80P9//xN729411w3mX7utdjlteH3zl6UZZXdnu2bpevf3fYmzFDPbx/1vfX6/3cg3T7hRcnBy8PjmdwuPJ7r4cPtqdzO8wb23vN5f7ot3dbJxx+z93pw3l2197l+bs/eTc/e/PXXM/OX/7NNTNa++zD/dG/fcd7lHe7aOb3Tt0vTm7Q3AwetuMzHM9gs9eNre+MfWfl/si3b3dnt4bzuFcNV8/F6X7DS8P15nDlr907wCdPdTfKNdeb9Xz3++tw1y2IL25tv1O9Zpnt3fzb3mznuWHf+d7v/OQv317Zzbn31e8vp9cOe+fimjNvnNzmuu9efljvzPjm8Ljt+Yh3ozkcvLRyM3/2b7ye9uMGh7fzFLeHt3h1NPfU98bvfPenWd+l0+B4PLhBXJGO+2F7/eO/+mi6njyj02TeUB/cXn3tLFe/Dvre27Fzdlleuy48P+SjX/twT3/64e7BD7pZxBdl2rX1J+2tm/bWX8+evQMe6oPDm4v1dx5PM7Ry1/fnk+eH5Z+829N95u5XLw+sp5z7dKi/KLc5mXaZd4YXz1fc/bxvvH8HHn323UEv1ju8zJ67N7PnnW9uZvt35523f+Y9Li9u0Hx10WB/J25jPZ3H9/a4r29nn3Q8P3y6RYe918zo1fjL81fr3Ly5GTNs9+7ZHvtgve2gfRX1NTezx43uONm9t+vSdG3fkxfPP3u5q4+32uZ0FM28s29OJ22jbH1vs/6i+crp5xnsvPV28PHQoC7IJ7d5OT64/c3J8Nib5ef57t5Od546q7tXrvNnOsa/fe2g8+zdO8BmL46up2juLX5dRX6e7u1opjw/rmjWPbtnc1fP9vJc2L6P9P1e9e/Z/vYuPBubMcPx9sHDaubRZoblN/cZn1uysNntqdb7nZtpp+zm8MWnPh4dvdWM+c0vW2/91TvzyI2GMz/tMvSNvdOu+nTUi4O0YrWZ9W/P3uWaMeuwF2e2f9SpB36U0+fGxje9mnsb93399XXm57PzlKfheDZWH61PO+QuP9/Obr57Z7nh9nNpuMH6u3fmkZvdzPeEzco9ce3cfTJFHpz8tfPWc3HNmgeb67476jMXdeJ04buPZ/NytGtvRt/2b099vJenPrp32Dt+95WnFelXHw7KzS5X5IM0/ouvxj+Iv2aavuL225sZDm+GfG967/FvbF/9erd/e/jaY672lNO/M9vPB6/uzdl3V2/x4Hb/045vN05n991/5crV/8Tz9B7v5ngvfXu3p1nzxsnogbjuOLh77PSN1Uej7xtbozd/cW99/DxuQN31XV4+Gj/E6y1uj32ws8zF4z6Luoqy5To/6eXNgzu7d97ht//y1icrB+XsxZmvZ/fqgM1cXjf46zE/eXTLXr4njRfWp5cGvQ+8eBrkGexcvdrwHjxspvPufdLasz3VzO295unw7MzVj4M744bO7bt23qsLd3nc4rHX25lvc7PTdHTH7RyPPL17PeV5P9N95ZrfN7a2825C/vp08lxYz6Xro+39M/m+m3w5HTS3IF6Gn26nF3nKdabrKNY385O3moye7vVV3718m7fTn5Bv8Gl+y8rUM/P18BZntrcDV+SF9e/52ofDt7ccHgfx+3b38Xr4d746T7F9m5fd+OTTBa9cs3Tc7LJwczLl92znvfq3xtO722Pf2Cxtc3b6Rnfrw43XTO9+cbv/6uDRxYOH9I38+O6yuI07Qx++81f3yfbZ+WrubM7ebL3D96Hx2/Vs3Nn6d8f2Vm9v+Z3h+wzP04z3c+PC5ug6YHkzdIMXju7ZHnzxytGrvXXxbZyeJ4523cIV3W8Od+F1Vx//1YXjaY88pMng7Trw/HD7nvjLp7PYPH448+C1lzND2e4z2zfyQ17Yd5DlvTS5C+Wq6dAN8c10rq+8eZAH0uyDT0+99Tz18jzp+orNlNdBh/iiuR7cxvHgOg/nwdeHG5znH3/y0/t9L7N3t7/5L6/fBXdPdx43rj7+S5MrPs07P/uv+Pb7/ex+5+zlrvfm3bizej7C3WPffcP3obe/c3vkZH72t9/3vQf+6V2r8zyh3063X7d4Bj38dp4rX85cvLKjD/+rv/31+/b7+i28e8fLQT6/tVgNL3f10XjleZ94uaL5Z3977wz77m/v732LZjk7xMPhqw1fzY7rXk4H5NN/8Vf+V3z7vuN+z/077MVmzO30O2k7y1tfOTzUU+THXTfki+bJ/Ypv7/6F5Z7m6/eO98lfzTfDNaMX8sjg7XRY/amXZ/Sf/e33e/ddOvf3lJfHFattvn39Lh/xvPr48d1x3oPWvfOv/PbeA3rX4pOGH/Sbm3viNq9nZ+2Xjtu37W7Y6y/3s799f9N+RztP0TuXq7+/j0eGhm9uc09eXfzdm9m8W/jiz/72vd356R3xxZk9Ouize3hoe5eF9ObN9eDae+n1Xd2/4tv3Pff7X++7PX4HbOaa9z19b96tuSX70e4mbE73r/72fbf9fvv3XV6/o9nO1fXpKXaur/w1u/U/uYVUCw=="
},
{
type = "objectgroup",
id = 8,
name = "Fishing Spots",
visible = false,
opacity = 1,
offsetx = 0,
offsety = 0,
draworder = "topdown",
properties = {},
objects = {
{
id = 20,
name = "",
type = "FishingSpot",
shape = "rectangle",
x = 336,
y = 960,
width = 288,
height = 246.667,
rotation = 0,
visible = true,
properties = {}
}
}
},
{
type = "objectgroup",
id = 9,
name = "Triggers",
visible = false,
opacity = 1,
offsetx = 0,
offsety = 0,
draworder = "topdown",
properties = {},
objects = {
{
id = 3,
name = "CantFaceThat",
type = "ThoughtText",
shape = "rectangle",
x = 624,
y = 456,
width = 24,
height = 24,
rotation = 0,
visible = true,
properties = {
["thoughtText"] = "I can't face them right now..."
}
},
{
id = 11,
name = "",
type = "ThoughtText",
shape = "rectangle",
x = 720,
y = 864,
width = 96,
height = 48,
rotation = 0,
visible = true,
properties = {
["thoughtText"] = "Have to protect...\nFood one day"
}
}
}
},
{
type = "objectgroup",
id = 10,
name = "Sprites",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
draworder = "topdown",
properties = {},
objects = {}
},
{
type = "tilelayer",
id = 11,
name = "Invisible Walls",
x = 0,
y = 0,
width = 95,
height = 95,
visible = false,
opacity = 1,
offsetx = 0,
offsety = 0,
properties = {},
encoding = "base64",
compression = "zlib",
data = "eAHt1kEKwCAMBEDv/f9/29wtGFhQYQJeZEninBxDESBAgAABAqcKPN9iq+fUN9y616p75VRWgH3Ws9ONfUcrm2Wf9ex0Y9/RymZn9jXh7z47XTcCBAgQIECAAAECBHYK1L9fESBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAvsFXl+SA1A="
},
{
type = "objectgroup",
id = 12,
name = "Spawns",
visible = false,
opacity = 1,
offsetx = 0,
offsety = 0,
draworder = "topdown",
properties = {},
objects = {
{
id = 2,
name = "Player",
type = "",
shape = "rectangle",
x = 480,
y = 384,
width = 24,
height = 24,
rotation = 0,
visible = true,
properties = {}
}
}
},
{
type = "objectgroup",
id = 13,
name = "Warps",
visible = false,
opacity = 1,
offsetx = 0,
offsety = 0,
draworder = "topdown",
properties = {},
objects = {
{
id = 1,
name = "",
type = "Warp",
shape = "rectangle",
x = 480,
y = 264,
width = 24,
height = 24,
rotation = 0,
visible = true,
properties = {
["map"] = "maps/house",
["x"] = 16,
["y"] = 14
}
},
{
id = 7,
name = "",
type = "Warp",
shape = "rectangle",
x = 648,
y = 1944,
width = 24,
height = 24,
rotation = 0,
visible = true,
properties = {
["map"] = "maps/pond 1.lua",
["x"] = 19,
["y"] = 20
}
}
}
},
{
type = "tilelayer",
id = 14,
name = "WellTop",
x = 0,
y = 0,
width = 95,
height = 95,
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
properties = {},
encoding = "base64",
compression = "zlib",
data = "eAHt0CEBAAAIA8GVgf4RoQIOcdN7c4kRIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECV4HaoK+RPwECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBJ4IDKioAEw="
},
{
type = "tilelayer",
id = 15,
name = "Notes",
x = 0,
y = 0,
width = 95,
height = 95,
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
properties = {},
encoding = "base64",
compression = "zlib",
data = "eAHt0IEAAAAAw6D5Ux/khVBhwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwMDTwACNBAAB"
},
{
type = "objectgroup",
id = 16,
name = "Water",
visible = false,
opacity = 1,
offsetx = 0,
offsety = 0,
draworder = "topdown",
properties = {},
objects = {
{
id = 16,
name = "",
type = "Water",
shape = "rectangle",
x = 408,
y = 504,
width = 48,
height = 72,
rotation = 0,
visible = true,
properties = {}
}
}
}
}
}
|
local rainbow = {
"#a89984", "#b16286", "#d79921", "#689d6a", "#d65d0e", "#458588"
}
require("nvim-treesitter.configs").setup({
ensure_installed = {
"python", "cpp", "lua", "vim", "java", "typescript", "javascript",
"html", "css"
},
ignore_install = {
"beancount", "clojure", "commonlisp", "c_sharp", "cuda", "d",
"devicetree", "dot", "elixir", "erlang", "elm", "fennel", "foam",
"fusion", "go", "godot", "glsl", "glimmer", "gowork", "gomod",
"graphql", "godot_resource", "gdscript", "hcl", "heex", "hjson",
"julia", "kotlin", "ledger", "llvm", "ninja", "nix", "ocaml",
"ocaml_interface", "ocamllex", "pascal", "php", "pioasm", "prisma",
"pug", "ql", "query", "r", "rasi", "rst", "ruby", "rust", "scala",
"sparql", "supercollider", "surface", "svelte", "teal", "tlaplus",
"toml", "turtle", "verilog", "vue", "yang", "zig"
}, -- List of parsers to ignore installing
highlight = {
enable = true, -- false will disable the whole extension
disable = {"rust", "go"} -- list of language that will be disabled
},
rainbow = {
enable = true,
extended_mode = true,
colors = rainbow,
termcolors = rainbow,
max_file_lines = nil
}
})
for i, c in ipairs(rainbow) do -- p00f/rainbow#81
vim.cmd(("hi rainbowcol%d guifg=%s"):format(i, c))
end
|
---Test program for InputMangler.
local input = require "inputmangler"
local commandbuff = {} --record of recently given inputs
local mapping = nil --command we're in the process of mapping, if any
function love.load()
--Establish a new context, map keys 1-4, F1-F4 and buttons a, b, x, y, and set modifiers shift, alt, ctrl, meta
input:addContext("test")
input:addKeyCommand("command 1", "1", "test")
input:addKeyCommand("command 2", "2", "test")
input:addKeyCommand("command 3", "3", "test")
input:addKeyCommand("command 4", "4", "test")
input:addKeyCommand("set 1", "f1", "test")
input:addKeyCommand("set 2", "f2", "test")
input:addKeyCommand("set 3", "f3", "test")
input:addKeyCommand("set 4", "f4", "test")
input:addButtonCommand("command 1", "a", "test")
input:addButtonCommand("command 2", "b", "test")
input:addButtonCommand("command 3", "x", "test")
input:addButtonCommand("command 4", "y", "test")
input:addModifierKey("shift", "test")
input:addModifierKey("alt", "test")
input:addModifierKey("ctrl", "test")
input:addModifierKey("meta", "test")
end
--assembles all the control mappings in a table, complete with modifiers, for pretty-printing.
--Recursive and ugly. Don't try this at home, kids.
local function striptree(tree)
local returnthis = {}
for key, entry in pairs(tree) do
if key == "cmd" then
table.insert(returnthis, entry)
elseif (key == "shift") or (key == "alt") or (key == "ctrl") or (key == "meta") then
local temp = striptree(entry)
for subkey, subentry in pairs(temp) do
table.insert(returnthis, "+" .. key .. ": " .. subentry)
end
else
local temp = striptree(entry)
for subkey, subentry in pairs(temp) do
table.insert(returnthis, key .. ": " .. subentry)
end
end
end
return returnthis
end
---draws a column of text on the left side of the window, fading them out as we move down.
--@param text table of strings to draw
local function drawLeft(text)
if not text then
return
end
local halfwidth = math.floor(love.graphics.getWidth() / 2) - 20
for i, str in ipairs(text) do
love.graphics.setColor(255, 255, 255, math.max(255 - ((i - 1) * 32), 64))
love.graphics.printf(str, 10, 10 + ((i - 1) * 15), halfwidth)
end
end
---draws a column of text on the right side of the window.
--@param text table of strings to draw
local function drawRight(text)
local halfwidth = math.floor(love.graphics.getWidth() / 2) - 20
love.graphics.setColor(0, 255, 0, 255) --green (why not?)
for i, str in ipairs(text) do
love.graphics.printf(str, 20 + halfwidth, 10 + ((i - 1) * 15), halfwidth)
end
end
function love.draw()
drawLeft(commandbuff)
local right = {}
if mapping then
table.insert(right, "Mapping " .. mapping)
else
table.insert(right, "There are four commands (that don't actually do anything).")
table.insert(right, "To bind a new key or button to a given command,")
table.insert(right, "press the corresponding function key (F1-F4).")
table.insert(right, "----------------------------------------------")
local subright = striptree(input.contexts["test"].keys)
table.sort(subright)
for _, entry in pairs(subright) do
table.insert(right, "key " .. entry)
end
table.insert(right, "----------------------------------------------")
subright = striptree(input.contexts["test"].buttons)
table.sort(subright)
for _, entry in pairs(subright) do
table.insert(right, "button " .. entry)
end
end
drawRight(right)
end
function love.mousepressed(x, y, button, istouch)
if mapping and not input:isButtonModifier(button, "test") then
input:addButtonCommand(mapping, button, "test", input:getModifiers("test"))
mapping = nil
else
local cmd = input:testButton(button, "test")
if cmd then
table.insert(commandbuff, 1, "Pressed mouse " .. button .. " mapped to " .. cmd)
end
end
end
function love.keypressed(key, scancode, isrepeat)
local cmd = input:testKey(key, "test")
if mapping and (not input:isKeyModifier(key, "test")) and (not cmd or not (string.find(cmd, "^set %d$"))) then
--map new key
input:addKeyCommand(mapping, key, "test", input:getModifiers("test"))
mapping = nil
elseif cmd then
if string.find(cmd, "^set %d$") then
--enter command mapping mode
local _, __, d = string.find(cmd, "^set (%d)$")
mapping = "command " .. d
elseif input:getModifiers("test") then
--record the command chord
table.insert(commandbuff, 1, "Pressed key " .. key .. "+" .. table.concat(input:getModifiers("test"), "+") .. " mapped to " .. cmd)
else
--record the command
table.insert(commandbuff, 1, "Pressed key " .. key .. " mapped to " .. cmd)
end
end
end
function love.gamepadpressed(joystick, button)
if mapping and not input:isButtonModifier(button, "test") then
input:addButtonCommand(mapping, button, "test", input:getModifiers("test"))
mapping = nil
else
local cmd = input:testButton(button, "test")
if cmd then
table.insert(commandbuff, 1, "Pressed gamepad " .. button .. " mapped to " .. cmd)
end
end
end
function love.gamepadaxis(joystick, axis, value)
if mapping and not input:isButtonModifier(axis, "test") then
input:addButtonCommand(mapping, axis, "test", input:getModifiers("test"))
mapping = nil
else
local cmd = input:testButton(axis, "test")
if cmd then
table.insert(commandbuff, 1, "Pressed axis " .. axis .. " mapped to " .. cmd)
end
end
end
|
dnl autoconf rules for NS Emulator (NSE)
dnl $Id: configure.in.nse,v 1.3 2000/03/10 01:49:32 salehi Exp $
dnl
dnl Look for ethernet.h
dnl
dnl Now look for supporting structures
dnl
AC_MSG_CHECKING([for struct ether_header])
AC_TRY_COMPILE([
#include <stdio.h>
#include <net/ethernet.h>
], [
int main()
{
struct ether_header etherHdr;
return 1;
}
], [
AC_DEFINE(HAVE_ETHER_HEADER_STRUCT)
AC_MSG_RESULT(found)
], [
AC_MSG_RESULT(not found)
])
dnl
dnl Look for ether_addr
dnl
AC_MSG_CHECKING([for struct ether_addr])
AC_TRY_COMPILE([
#include <stdio.h>
#include <net/ethernet.h>
], [
int main()
{
struct ether_addr etherAddr;
return 0;
}
], [
AC_DEFINE(HAVE_ETHER_ADDRESS_STRUCT)
AC_MSG_RESULT(found)
], [
AC_MSG_RESULT(not found)
])
cross_compiling=no
dnl
dnl Look for addr2ascii function
dnl
AC_CHECK_FUNCS(addr2ascii)
dnl
dnl look for SIOCGIFHWADDR
dnl
AC_TRY_RUN(
#include <stdio.h>
#include <sys/ioctl.h>
int main()
{
int i = SIOCGIFHWADDR;
return 0;
}
, AC_DEFINE(HAVE_SIOCGIFHWADDR), , echo 1
)
|
tips_proto = {
[1] = { tips_type = 1, },
[2] = { tips_type = 2, },
[3] = { tips_type = 3, },
[4] = { tips_type = 4, },
[5] = { tips_type = 5, },
[6] = { tips_type = 6, },
[7] = { tips_type = 7, },
[8] = { tips_type = 8, },
[9] = { tips_type = 9, },
[10] = { tips_type = 10, },
[11] = { tips_type = 11, },
[12] = { tips_type = 1, },
[20] = { tips_type = 4, },
[30] = { tips_type = 1, },
[31] = { tips_type = 1, },
[32] = { tips_type = 1, },
[33] = { tips_type = 1, },
[40] = { tips_type = 1, },
[41] = { tips_type = 1, },
[42] = { tips_type = 6, },
[43] = { tips_type = 1, },
[50] = { tips_type = 6, },
[51] = { tips_type = 1, },
[52] = { tips_type = 1, },
[60] = { tips_type = 1, },
[61] = { tips_type = 1, },
[70] = { tips_type = 1, },
[71] = { tips_type = 1, },
[80] = { tips_type = 6, },
[81] = { tips_type = 1, },
[82] = { tips_type = 6, },
[83] = { tips_type = 1, },
[90] = { tips_type = 6, },
[91] = { tips_type = 1, },
[92] = { tips_type = 1, },
[93] = { tips_type = 6, },
[94] = { tips_type = 6, },
[110] = { tips_type = 1, },
[111] = { tips_type = 1, },
[112] = { tips_type = 1, },
[113] = { tips_type = 1, },
[120] = { tips_type = 1, },
[121] = { tips_type = 1, },
[122] = { tips_type = 1, },
[123] = { tips_type = 1, },
[130] = { tips_type = 1, },
[141] = { tips_type = 1, },
[142] = { tips_type = 1, },
[143] = { tips_type = 1, },
[144] = { tips_type = 1, },
[145] = { tips_type = 5, },
[146] = { tips_type = 6, },
[147] = { tips_type = 6, },
[150] = { tips_type = 1, },
[155] = { tips_type = 1, },
[156] = { tips_type = 1, },
[157] = { tips_type = 1, },
[158] = { tips_type = 1, },
[159] = { tips_type = 1, },
[160] = { tips_type = 1, },
[161] = { tips_type = 1, },
[162] = { tips_type = 1, },
[163] = { tips_type = 1, },
[164] = { tips_type = 1, },
[165] = { tips_type = 1, },
[166] = { tips_type = 1, },
[167] = { tips_type = 1, },
[168] = { tips_type = 1, },
[169] = { tips_type = 1, },
[170] = { tips_type = 1, },
[171] = { tips_type = 1, },
[180] = { tips_type = 1, },
[190] = { tips_type = 1, },
[191] = { tips_type = 1, },
[192] = { tips_type = 1, },
[193] = { tips_type = 1, },
[194] = { tips_type = 1, },
[195] = { tips_type = 1, },
[196] = { tips_type = 1, },
[197] = { tips_type = 1, },
[198] = { tips_type = 1, },
[199] = { tips_type = 1, },
[200] = { tips_type = 6, },
[201] = { tips_type = 1, },
[202] = { tips_type = 6, },
[203] = { tips_type = 6, },
[204] = { tips_type = 1, },
[205] = { tips_type = 1, },
[210] = { tips_type = 6, },
[220] = { tips_type = 1, },
[221] = { tips_type = 1, },
[222] = { tips_type = 1, },
[223] = { tips_type = 1, },
[230] = { tips_type = 1, },
[231] = { tips_type = 1, },
[232] = { tips_type = 1, },
[233] = { tips_type = 1, },
[234] = { tips_type = 1, },
[235] = { tips_type = 1, },
[236] = { tips_type = 1, },
[237] = { tips_type = 6, },
[238] = { tips_type = 1, },
}
return tips_proto
|
function onCreate()
-- background shit
makeLuaSprite('poop', 'poop', -500, -300);
setLuaSpriteScrollFactor('poop', 0.9, 0.9);
addLuaSprite('poop', false);
close(true); --For performance reasons, close this script once the stage is fully loaded, as this script won't be used anymore after loading the stage
end |
local theme={colors={normal={blue={0.28235294117647,0.72941176470588,0.76078431372549,1},green={0.21960784313725,0.47058823529412,0.10980392156863,1},cyan={0.17647058823529,0.41960784313725,0.69411764705882,1},white={0.094117647058824,0.094117647058824,0.094117647058824,1},red={0.61176470588235,0.35294117647059,0.007843137254902,1},magenta={0.66274509803922,0.27058823529412,0.59607843137255,1},black={0.96470588235294,0.96470588235294,0.96470588235294,1},yellow={0.76862745098039,0.50980392156863,0.094117647058824,1}},primary={background={0.96470588235294,0.96470588235294,0.96470588235294,1},foreground={0.094117647058824,0.094117647058824,0.094117647058824,1}},bright={blue={0.46274509803922,0.46274509803922,0.46274509803922,1},green={0.87058823529412,0.87058823529412,0.87058823529412,1},cyan={0.54509803921569,0.42352941176471,0.2156862745098,1},white={0.97254901960784,0.97254901960784,0.97254901960784,1},red={0.76862745098039,0.24313725490196,0.094117647058824,1},magenta={0.90980392156863,0.90980392156863,0.90980392156863,1},black={0.53725490196078,0.53725490196078,0.53725490196078,1},yellow={0.74117647058824,0.89803921568627,0.94901960784314,1}},cursor={text={0.96470588235294,0.96470588235294,0.96470588235294,1},cursor={0.094117647058824,0.094117647058824,0.094117647058824,1}}}}
return theme.colors |
local mod = {}
--self代表root标签
function mod.onCreate(self)
self:setColor(0xffff0000)
end
return mod; |
LhdController.initProtoFunc = function (slot0)
if slot0.netProtoFunc == nil then
slot0.netProtoFunc = {
[LHD_SUB_S_GAME_FREE] = {
bodyStr = "LHD_CMD_S_GameFree",
func = slot0.protoTransferGamingFree
},
[LHD_SUB_S_GAME_START] = {
bodyStr = "LHD_CMD_S_GameStart",
func = slot0.protoTransferGamingBet
},
[LHD_SUB_S_GAME_END] = {
bodyStr = "LHD_CMD_S_GameEnd",
func = slot0.protoTransferGamingEnd
},
[LHD_SUB_S_JETTON] = {
bodyStr = "LHD_CMD_S_PlaceBet",
func = slot0.protoTransferGamingJetton
},
[LHD_SUB_S_JETTON_EX] = {
bodyStr = "LHD_CMD_S_PlaceBetEx",
func = slot0.protoTransferGamingRemandJetton
}
}
end
end
LhdController.reqBet2Server = function (slot0, slot1, slot2)
doReqServerViaStruct("请求下注", {
cbBetArea = slot1,
lBetScore = slot2
}, "LHD_CMD_C_PlaceBet", MDM_GF_GAME, LHD_SUB_C_JETTON, "true")
end
LhdController.reqRemandBet2Server = function (slot0, slot1, slot2, slot3)
slot4 = {
cbBetArea = slot1,
lBetScore = slot2,
lBetNumber = slot3
}
for slot8 = 1, 10, 1 do
if slot4.lBetScore[slot8] == nil then
slot4.lBetScore[slot8] = 0
slot4.lBetNumber[slot8] = 0
end
end
doReqServerViaStruct("请求批量下注", slot4, "LHD_CMD_C_PlaceBetEx", MDM_GF_GAME, LHD_SUB_C_JETTON_EX, "true")
end
LhdController.onGameMessage = function (slot0, slot1, slot2)
if slot0.model:getCurShowingViewType() ~= VIEW_TYPE_BATTLE then
return
end
if slot0:getProtoFuncById(slot2) == nil then
return
end
if ffiMgr:isSizeEqual(slot1, slot3.bodyStr) then
slot3.func(slot0, ffiMgr:castStruct2TableByLuaStr(slot1, slot3.bodyStr))
end
end
LhdController.onGameSceneByServer = function (slot0, slot1)
if ffiMgr:isSizeEqual(slot1, "LHD_CMD_S_Status") then
slot0:protoTransferRecoverGameScene(ffiMgr:castStruct2TableByLuaStr(slot1, "LHD_CMD_S_Status"))
end
end
LhdController.protoTransferGamingFree = function (slot0, slot1)
slot0:protoGamingFree({
leftTimer = slot1.cbTimeLeave
})
end
LhdController.protoTransferGamingBet = function (slot0, slot1)
slot0:protoGamingBet({
leftTimer = slot1.cbTimeLeave,
selfCanBetMaxScore = slot1.lPlayBetScore,
areaSelfLimitBetScore = slot1.lUserLimitScore,
areaAllLimitBetScore = slot1.lAreaLimitScore
})
end
LhdController.protoTransferGamingEnd = function (slot0, slot1)
LhdPrintAndPrintTable("protoTransferGamingEnd", slot1)
slot0:protoGamingEnd({
leftTimer = slot1.cbTimeLeave,
winner = slot1.cbWinner,
selfWinScore = slot1.lPlayAllScore,
areaAllScore = slot1.lAllPlayScore,
areaSelfScore = slot1.lPlayScore,
pokerData = slot1.cbTableCardArray,
balanceHisCount = slot1.dwResultIndex
})
end
LhdController.protoTransferGamingJetton = function (slot0, slot1)
slot0:protoGamingJetton({
betAreaIdx = slot1.cbBetArea,
betScore = slot1.lBetScore,
chairId = slot1.wChairID
})
end
LhdController.protoTransferGamingRemandJetton = function (slot0, slot1)
if slot1.bSucees == true then
slot0:protoGamingRemandJetton({
chairId = slot1.wChairID,
betAreaIdx = slot1.cbBetArea,
betScore = slot1.lBetScore,
betNumber = slot1.lBetNumber,
succeed = slot1.bSucees
})
end
end
LhdController.protoTransferRecoverGameScene = function (slot0, slot1)
LhdPrintAndPrintTable("protoTransferRecoverGameScene", slot1)
slot0:protoRecoverGameScene({
gameStatus = slot1.cbGameStatus,
leftTimer = slot1.cbTimeLeave,
selfCanBetMaxScore = slot1.lPlayBetScore,
areaAllLimitBetScore = slot1.lAreaLimitScore,
areaSelfLimitBetScore = slot1.lUserLimitScore,
balanceHistoryData = slot1.dwResultHistory,
balanceHisCount = slot1.dwResultIndex,
areaAllBet = slot1.lAllBet,
areaSelfBet = slot1.lPlayBet,
balanceData = {
winner = slot1.cbWinner,
selfWinScore = slot1.lPlayAllScore,
areaAllScore = slot1.lAllPlayScore,
areaSelfScore = slot1.lPlayScore,
pokerData = slot1.cbTableCardArray,
balanceHisCount = slot1.dwResultIndex
}
})
end
return
|
--[[
####### Aseprite - MSX image files importer script #######
Copyright by Natalia Pujol (2021)
This file is released under the terms of the MIT license.
Info:
- MSX Graphics Screen modes:
https://www.msx.org/wiki/Yamaha_V9958
http://map.grauw.nl/resources/video/yamaha_v9958.pdf
- YJK modes:
http://map.grauw.nl/articles/yjk/
- MAG MAX file format:
https://mooncore.eu/bunny/txt/makichan.htm
Code inspired by
https://github.com/kettek/aseprite-scripts/blob/master/import-apng.lua
--]]
local version = "v1.2"
local plugin
-- Utils classes
dofile("./utils.lua")
-- MSX Screen modes definitions
dofile("./screen_modes.lua")
-- MSX images readers classes
dofile("./readers.lua")
-- MSX images writers classes
dofile("./writers.lua")
function init(globalPlugin)
print("MSX image files plugin initialized...")
plugin = globalPlugin
-- initialize extension preferences
if plugin.preferences.sprRender == nil then
plugin.preferences.sprRender = true
end
if plugin.preferences.spr16 == nil then
plugin.preferences.spr16 = true
end
if plugin.preferences.tilesLayer == nil then
plugin.preferences.tilesLayer = true
end
if plugin.preferences.alert_pixelratio == nil then
plugin.preferences.alert_pixelratio = true
end
-- add new option at "File" menu
plugin:newCommand{
id="msx_image_import",
title="Import MSX image file",
group="file_import",
onclick=function()
startLoadDialog()
end
}
-- add new option at "File" menu
plugin:newCommand{
id="msx_image_export",
title="Export MSX image file",
group="file_export",
onclick=function()
startSaveDialog()
end
}
end
function exit(plugin)
print("MSX image files plugin closing...")
end
-- ########################################################
-- Dialog management
-- ########################################################
function showLoadFileInfo(dlg)
local ret = nil
local newType = "<unknown file format>"
local newInfo = ""
local newTilesLayer = false
local newBtnOkEnabled = true
local newInfoVisible = false
local newRenderSprites = true
if dlg.data.filename == nil then
newType = "<none>"
newBtnOkEnabled = false
else
local scrMode = getFileInfo(dlg.data.filename)
if scrMode ~= nil then
newType = scrMode.descName
newInfo = scrMode.descFormat
ret = scrMode.screen.mode
newTilesLayer = ret==1 or ret==2 or ret==4
newRenderSprites = ret < 8
end
end
if newInfo ~= "" then
newInfoVisible = true
else
newInfo = "<unknown file format>"
newBtnOkEnabled = false
ret = nil
end
local spritesEnabled = newRenderSprites and plugin.preferences.sprRender
-- filetype
dlg:modify{ id="file_type", text=newType }
dlg:modify{ id="file_info", text=newInfo, visible=newInfoVisible }
-- render sprites
dlg:modify{ id="chk_sprRender",
selected = spritesEnabled,
enabled = newRenderSprites
}
dlg:modify{ id="spr8", enabled = spritesEnabled }
dlg:modify{ id="spr16", enabled = spritesEnabled }
-- raw tiles layer
dlg:modify{ id="chk_tilesLayer",
visible=newTilesLayer,
enabled=newTilesLayer ,
selected=newTilesLayer and plugin.preferences.tilesLayer
}
-- buttons
dlg:modify{ id="ok", enabled=newBtnOkEnabled }
return ret
end
function showSaveFileInfo(dlg)
local ret = nil
local newType = "<unknown file format>"
local newInfo = ""
local newBtnOkEnabled = true
if dlg.data.filename == nil then
newType = "<none>"
newBtnOkEnabled = false
else
local scrMode = getFileInfo(dlg.data.filename)
if scrMode ~= nil then
newType = scrMode.descName
newInfo = scrMode.descFormat
ret = scrMode.screen.mode
end
end
if newInfo ~= "" then
newInfoVisible = true
else
newInfo = "<unknown file format>"
newBtnOkEnabled = false
ret = nil
end
-- filetype
dlg:modify{ id="file_type", text=newType }
dlg:modify{ id="file_info", text=newInfo, visible=newInfoVisible }
-- buttons
dlg:modify{ id="ok", enabled=newBtnOkEnabled }
return ret
end
function getFileInfo(filename)
local ret = nil
local ext = filename:upper():sub(-4)
if ext:sub(1,3) == ".SC" then
ext = ext:sub(-1)
ret = tonumber("0x"..ext)
return ScreenMode:getInstance(ret)
end
return nil
end
function typeof(var)
local _type = type(var);
if(_type ~= "table" and _type ~= "userdata") then
return _type;
end
local _meta = getmetatable(var);
if(_meta ~= nil and _meta._NAME ~= nil) then
return _meta._NAME;
else
return _type;
end
end
--! Script Body !--
function startLoadDialog()
if not app.isUIAvailable then
return
end
local scrMode = 0
local dlg = nil
local data = nil
local cancel = false
repeat
dlg = Dialog("Import MSX image file "..version)
data = dlg
:file{
id="filename",
label="MSX image file:",
open=true,
focus=true,
filetypes={ "SC1", "SC2", "SC3", "SC4", "SC5", "SC6", "SC7", "SC8", "SCA", "SCC" },
onchange=function() scrMode = showLoadFileInfo(dlg) end }
:separator()
:label{ id="file_type", label="Selected image:", text="<none>" }
:newrow()
:label{ id="file_info", text="", visible=false }
:separator()
:check{ id="chk_sprRender",
label="Render sprites:",
text="Sprite size:",
selected=plugin.preferences.sprRender,
onclick = function()
plugin.preferences.sprRender = dlg.data.chk_sprRender
dlg:modify{ id="spr8", enabled=dlg.data.chk_sprRender }
dlg:modify{ id="spr16", enabled=dlg.data.chk_sprRender }
end }
:radio{ id="spr8",
text="8x8 pixels",
selected=plugin.preferences.spr16==false,
onclick = function()
plugin.preferences.spr16 = false
end }
:radio{ id="spr16",
text="16x16 pixels",
selected=plugin.preferences.spr16==true,
onclick = function()
plugin.preferences.spr16 = true
end }
:check{ id="chk_tilesLayer",
label="Add layer w/ raw tiles:",
selected=false,
visible=false,
onclick = function()
plugin.preferences.tilesLayer = dlg.data.chk_tilesLayer
end }
:label{ label="-----------------", text="----------------------------------" }
:button{ id="ok", text="Ok", enabled=false }
:button{ id="cancel", text="Cancel" }
:label{ label="by NataliaPC'2021" }
:show().data
data.scrMode = scrMode
if data.ok and data.filename == "" then
app.alert(" Select a file first ")
end
until data.filename ~= "" or data.cancel or (data.cancel or data.ok)==false
if data.ok then
if app.fs.isFile(data.filename) == false then
app.alert(" File not found ")
else
-- From here we can read sprite.filename into our MSX reader.
local rdr = Reader:getInstance(data)
if rdr ~= nil then
local err = nil
if rdr.className ~= nil and rdr.className ~= Err.className then
err = rdr:decode()
else
err = rdr
end
if err ~= nil then
app.alert(err:string())
else
if data.scrMode==6 or data.scrMode==7 then
if app.version >= Version("1.2.27") then
rdr.spr.pixelRatio = Size(1,2)
elseif plugin.preferences.alert_pixelratio then
local dlg = Dialog("ADVICE: Pixel aspect ratio")
dlg
:label{ text="You need to change manually the Pixel Aspect Ratio to (1:2)" }
:newrow()
:label{ text="Press [Ctrl+P] after closing this message." }
:check{ id="chk_showAgain",
text="Always show this alert",
selected=true,
onclick = function()
plugin.preferences.alert_pixelratio = dlg.data.chk_showAgain
end }
:button{ id="ok", text="Close", focus=true }
:show()
end
end
end
end
end
end
end
function startSaveDialog()
if not app.isUIAvailable then
return
end
if app.activeSprite==nil then
app.alert(" No active image found! ")
return
end
local w = app.activeSprite.width
local h = app.activeSprite.height
local ext = nil;
if w==512 and h==212 then
ext = { "SC6", "SC7" }
elseif (w==256) then
if h==212 then
ext = { "SC5", "SC8", "SCA", "SCC" }
elseif h==192 then
ext = { "SC1", "SC2", "SC3", "SC4" }
end
end
if ext==nil then
app.alert(" Current valid image sizes are: 256x192, 256x212 and 512x212 ")
return
end
local layers = {}
for i=1,#app.activeSprite.layers do
layers[i] = app.activeSprite.layers[i].name
end
local scrMode = 0
local dlg = nil
local data = nil
local cancel = false
local info1 = app.activeSprite.width.."x"..app.activeSprite.height
local info2 = ""
if app.activeSprite.colorMode == ColorMode.INDEXED then
info1 = info1.." Indexed image"
info2 = countColors(app.activeSprite).." solid colors"
else
info1 = info1.." Bitmap image"
end
repeat
dlg = Dialog("Export MSX image file "..version)
data = dlg
:label{ label="Current image:", text=info1 }
:newrow()
:label{ text=info2, visible=info2~="" }
:separator()
:file{
id="filename",
label="MSX image file:",
open=false,
save=true,
focus=true,
filetypes=ext,
onchange=function() scrMode = showSaveFileInfo(dlg) end }
:combobox{ id="layer", label="Layer to save:",
option=layers[1],
options=layers }
:separator()
:label{ id="file_type", label="Selected format:", text="<none>" }
:newrow()
:label{ id="file_info", text="", visible=false }
:label{ label="-----------------", text="----------------------------------" }
:button{ id="ok", text="Ok", enabled=false }
:button{ id="cancel", text="Cancel" }
:label{ label="by NataliaPC'2021" }
:show().data
data.scrMode = scrMode
if data.ok and data.filename == "" then
app.alert(" Select an output file first ")
end
until data.filename ~= "" or data.cancel or (data.cancel or data.ok)==false
if data.ok then
-- From here we can write sprite.filename with our MSX writer.
local wrt = Writer:getInstance(data)
if wrt ~= nil then
local err = nil
if wrt.className ~= nil and wrt.className ~= Err.className then
err = wrt:encode()
else
err = wrt
end
if err ~= nil then
app.alert(err:string())
end
end
end
end
|
local TAG = "MotionBlurRender"
local MotionBlurRender = {
vs = [[
precision highp float;
attribute vec4 aPosition;
attribute vec4 aTextureCoord;
varying vec2 vTexCoord;
void main()
{
gl_Position = aPosition;
vTexCoord = aTextureCoord.xy;
}
]],
blur_fs = [[
precision highp float;
varying vec2 vTexCoord;
uniform sampler2D uTex0;
uniform sampler2D uTex1;
uniform float uBlurStrength;
void main()
{
vec4 lastColor = texture2D(uTex0, vTexCoord);
vec4 curColor = texture2D(uTex1, vTexCoord);
gl_FragColor = vec4(mix(curColor.rgb, lastColor.rgb, uBlurStrength), curColor.a);
}
]],
_blurPass = nil,
_blurStrength = 0.0,
_lastTex = nil
}
function MotionBlurRender:initRenderer(context, filter)
OF_LOGI("MotionBlurRender", "MotionBlurRender:initRenderer")
self._blurPass = context:createCustomShaderPass(self.vs, self.blur_fs)
return OF_Result_Success
end
function MotionBlurRender:teardown(context, filter)
OF_LOGI("MotionBlurRender", "MotionBlurRender:teardown")
context:destroyCustomShaderPass(self._blurPass)
self._blurPass = nil
if self._lastTex ~= nil then
context:releaseTexture(self._lastTex)
self._lastTex = nil
end
return OF_Result_Success
end
function MotionBlurRender:initParams(context, filter)
--filter:insertFloatParam("Time", 0.0, 1.0, 0.4)
-- filter:insertFloatParam("Pow", 0.0, 2.0, 1.0)
-- filter:insertIntParam("BlurFrame", 0, 4, 1)
filter:insertFloatParam("BlurStrength", 0.0, 0.95, 0.3)
return OF_Result_Success
end
function MotionBlurRender:onApplyParams(context, filter, dirtyTable)
self._blurStrength = filter:floatParam("BlurStrength")
return OF_Result_Success
end
function MotionBlurRender:draw(context, inTex, outTex)
local width = outTex.width
local height = outTex.height
local blurStrength = self._blurStrength
if self._lastTex == nil then
self._lastTex = context:getTexture(width, height)
context:copyTexture(inTex, self._lastTex:toOFTexture())
end
local render = context:sharedQuadRender()
context:bindFBO(outTex)
context:setViewport(0, 0, width, height)
self._blurPass:use()
self._blurPass:setUniformTexture("uTex0", 0, self._lastTex:textureID(), GL_TEXTURE_2D)
self._blurPass:setUniformTexture("uTex1", 1, inTex.textureID, GL_TEXTURE_2D)
self._blurPass:setUniform1f("uBlurStrength", blurStrength)
render:draw(self._blurPass, false)
context:copyTexture(outTex, self._lastTex:toOFTexture())
return OF_Result_Success
end
return MotionBlurRender
|
require('constants')
require('quest')
-- Hild requires a large supply of whiteflower to be able to fulfill
-- her various orders.
local function hild_weaving_start_fn()
add_message_with_pause("HILD_WEAVING_QUEST_START_SID")
add_message_with_pause("HILD_WEAVING_QUEST_START2_SID")
clear_and_add_message("HILD_WEAVING_QUEST_START3_SID")
end
-- 10 whiteflowers are required
local function hild_weaving_completion_condition_fn()
return (get_item_count(PLAYER_ID, "_whiteflower") >= 10)
end
-- Hild will teach weaving, if the player does not know it.
-- If the player knows how to weave, she presents the Mantle of Wintersea
-- instead.
local function hild_weaving_completion_fn()
local skill_value = get_skill_value(PLAYER_ID, CSKILL_GENERAL_WEAVING)
if (skill_value < 80) then
-- If the player hasn't come close to mastering weaving, Hild
-- will teach him or her a little more.
local weaving_incr = RNG_range(15, 25)
set_skill_value(PLAYER_ID, CSKILL_GENERAL_WEAVING, skill_value + weaving_incr)
clear_and_add_message("HILD_WEAVING_QUEST_COMPLETE_SID")
else
-- Set the skill to the maximum value, and then grant the mantle.
set_skill_value(PLAYER_ID, CSKILL_GENERAL_WEAVING, 100)
add_object_to_player_tile("wintersea_mantle")
add_message_with_pause("HILD_WEAVING_QUEST_COMPLETE_SPECIAL_SID")
add_message_with_pause("HILD_WEAVING_QUEST_COMPLETE_SPECIAL2_SID")
clear_and_add_message("HILD_WEAVING_QUEST_COMPLETE_SPECIAL3_SID")
end
remove_object_from_player("_whiteflower", 10)
return true
end
hild_quest = Quest:new("hild_weaving",
"HILD_WEAVING_QUEST_TITLE_SID",
"HILD_SHORT_DESCRIPTION_SID",
"HILD_WEAVING_QUEST_DESCRIPTION_SID",
"HILD_WEAVING_QUEST_COMPLETE_SID",
"HILD_WEAVING_QUEST_REMINDER_SID",
truefn,
hild_weaving_start_fn,
hild_weaving_completion_condition_fn,
hild_weaving_completion_fn)
if hild_quest:execute() == false then
add_message("HILD_SPEECH_TEXT_SID")
end
|
local cartographer = require 'cartographer'
local testMap = cartographer.load 'demo/groups.lua'
function love.update(dt)
testMap:update(dt)
end
function love.draw()
testMap:draw()
love.graphics.print(love.timer.getFPS())
end |
local slib = slib
local snet = slib.Components.Network
local timer = timer
local isfunction = isfunction
local SERVER = SERVER
--
local netowrk_name_to_client = slib.GetNetworkString('SNet', 'CL_ValidatorForServer')
local netowrk_name_to_server = slib.GetNetworkString('SNet', 'SV_ValidatorForServer')
if SERVER then
snet.Callback(netowrk_name_to_server, function(ply, uid, validator_name, ...)
local success = false
local validator_method = snet.GetValidator(validator_name)
if validator_method == nil then return end
success = validator_method(ply, uid, ...)
snet.Request(netowrk_name_to_client, uid, success).Invoke(ply)
end).Period(0.1, 5)
else
local callback_data = {}
function snet.IsValidForServer(func_callback, validator_name, ...)
validator_name = validator_name or 'entity'
local uid = slib.GenerateUid(validator_name)
local func = func_callback
callback_data[uid] = function(ply, result)
timer.Remove('SNetServerValidatorTimeout_' .. uid)
if func and isfunction(func) then
func(ply, result)
end
callback_data[uid] = nil
end
timer.Create('SNetServerValidatorTimeout_' .. uid, 1.5, 1, function()
local data_callback = callback_data[uid]
if data_callback then
data_callback(LocalPlayer(), false)
end
end)
snet.Request(netowrk_name_to_server, uid, validator_name, ...).InvokeServer()
end
snet.Callback(netowrk_name_to_client, function(ply, uid, success)
local data_callback = callback_data[uid]
if data_callback then
data_callback(ply, success)
end
end)
end |
player_manager.AddValidModel( "PMC4_01", "models/player/PMC_4/PMC__01.mdl" ) list.Set( "PlayerOptionsModel", "PMC4_01", "models/player/PMC_4/PMC__01.mdl" ) |
--==========================================================
-- SocialPolicy Chooser Popup
-- Modified by bc1 from 1.0.3.276 code using Notepad++
--==========================================================
Events.SequenceGameInitComplete.Add(function()
include "GameInfoCache" -- warning! booleans are true, not 1, and use iterator ONLY with table field conditions, NOT string SQL query
local GameInfoPolicies = GameInfoCache.Policies
local GameInfoPolicyBranchTypes = GameInfoCache.PolicyBranchTypes
local GameInfoEras = GameInfoCache.Eras
local GameInfoPrereqPolicies = GameInfoCache.Policy_PrereqPolicies
include "IconHookup"
local IconHookup = IconHookup
local CivIconHookup = CivIconHookup
--==========================================================
-- Minor lua optimizations
--==========================================================
local ipairs = ipairs
local abs = math.abs
local ceil = math.ceil
local huge = math.huge
local min = math.min
local print = print
local tostring = tostring
local insert = table.insert
local concat = table.concat
local ButtonPopupTypes = ButtonPopupTypes
local ContextPtr = ContextPtr
local Controls = Controls
local Events = Events
local GetActivePlayer = Game.GetActivePlayer
local IsOption = Game.IsOption
local GameDefines = GameDefines
local GameInfoTypes = GameInfoTypes
local GameOptionTypes = GameOptionTypes
local KeyEvents = KeyEvents
local Keys = Keys
local ToUpper = Locale.ToUpper
local L = Locale.ConvertTextKey
local eLClick = Mouse.eLClick
local eRClick = Mouse.eRClick
local Network = Network
local OptionsManager = OptionsManager
local Players = Players
local PopupPriority = PopupPriority
local PublicOpinionTypes = PublicOpinionTypes
local Teams = Teams
local incTurnTimerSemaphore = UI.incTurnTimerSemaphore
local decTurnTimerSemaphore = UI.decTurnTimerSemaphore
local UIManager = UIManager
local bnw_mode = Game.GetActiveLeague ~= nil
local g_PolicyBranchPanels = {
POLICY_BRANCH_LIBERTY = Controls.LibertyPanel,
POLICY_BRANCH_TRADITION = Controls.TraditionPanel,
POLICY_BRANCH_HONOR = Controls.HonorPanel,
POLICY_BRANCH_PIETY = Controls.PietyPanel,
POLICY_BRANCH_AESTHETICS = Controls.AestheticsPanel,
POLICY_BRANCH_PATRONAGE = Controls.PatronagePanel,
POLICY_BRANCH_COMMERCE = Controls.CommercePanel,
POLICY_BRANCH_EXPLORATION = Controls.ExplorationPanel,
POLICY_BRANCH_RATIONALISM = Controls.RationalismPanel,
POLICY_BRANCH_FREEDOM = Controls.FreedomPanel,
POLICY_BRANCH_ORDER = Controls.OrderPanel,
POLICY_BRANCH_AUTOCRACY = Controls.AutocracyPanel,
}
local g_PopupInfo
local g_FullColor = {x = 1, y = 1, z = 1, w = 1}
local g_FadeColor = {x = 1, y = 1, z = 1, w = 0}
local g_FadeColorRV = {x = 1, y = 1, z = 1, w = 0.2}
local g_PolicyButtons = {}
local TabSelect
local g_Tabs = {
SocialPolicies = {
Button = Controls.TabButtonSocialPolicies,
Panel = Controls.SocialPolicyPane,
SelectHighlight = Controls.TabButtonSocialPoliciesHL,
},
Ideologies = {
Button = Controls.TabButtonIdeologies,
Panel = Controls.IdeologyPane,
SelectHighlight = Controls.TabButtonIdeologiesHL,
},
}
local g_IdeologyBackgrounds = {
POLICY_BRANCH_AUTOCRACY = "SocialPoliciesAutocracy.dds",
POLICY_BRANCH_FREEDOM = "SocialPoliciesFreedom.dds",
POLICY_BRANCH_ORDER = "SocialPoliciesOrder.dds",
}
local PolicyTooltip = LuaEvents.PolicyTooltip.Call
local PolicyBranchTooltip = LuaEvents.PolicyBranchTooltip.Call
local TenetToolTip = LuaEvents.TenetToolTip.Call
local ShowTextToolTipAndPicture = LuaEvents.ShowTextToolTipAndPicture.Call
local function SetToolTipCallback( control, f )
control:SetToolTipCallback( function( control )
control:SetToolTipCallback( f )
control:SetToolTipType( "EUI_ItemTooltip" )
end)
end
local SearchForPediaEntry = Events.SearchForPediaEntry.Call
local function OnClose()
UIManager:DequeuePopup( ContextPtr );
end
Controls.CloseButton:RegisterCallback( eLClick, OnClose );
-------------------------------------------------
-- Policy Selection
local function PolicySelect( policyID )
--print("Clicked on Policy: " .. tostring(policyID));
local policyInfo = GameInfoPolicies[ policyID ]
local player = Players[GetActivePlayer()];
if policyInfo and player then
local bHasPolicy = player:HasPolicy(policyID);
local bCanAdoptPolicy = player:CanAdoptPolicy(policyID);
--print("bHasPolicy: " .. tostring(bHasPolicy));
--print("bCanAdoptPolicy: " .. tostring(bCanAdoptPolicy));
--print("Policy Blocked: " .. tostring(player:IsPolicyBlocked(policyID)));
local bPolicyBlocked = false;
-- If we can get this, OR we already have it, see if we can unblock it first
if bHasPolicy or bCanAdoptPolicy then
-- Policy blocked off right now? If so, try to activate
if player:IsPolicyBlocked(policyID) then
bPolicyBlocked = true;
Events.SerialEventGameMessagePopup{ Type = ButtonPopupTypes.BUTTONPOPUP_CONFIRM_POLICY_BRANCH_SWITCH, Data1 = GameInfoTypes[ policyInfo.PolicyBranchType ] }
end
end
-- Can adopt Policy right now - don't try this if we're going to unblock the Policy instead
if bCanAdoptPolicy and not bPolicyBlocked then
Controls.Yes:SetVoids( policyID, 1 )
Controls.PolicyConfirm:SetHide(false);
Controls.BGBlock:SetHide(true);
end
end
end
local function PolicyPedia( policyID )
SearchForPediaEntry( GameInfoPolicies[ policyID ]._Name )
end
-------------------------------------------------
-- Policy Branch Selection
local function PolicyBranchSelect( policyBranchID )
--print("Clicked on PolicyBranch:", policyBranchID)
local player = Players[GetActivePlayer()]
if player and GameInfoPolicyBranchTypes[ policyBranchID ] then
local bHasPolicyBranch = player:IsPolicyBranchUnlocked(policyBranchID);
local bCanAdoptPolicyBranch = player:CanUnlockPolicyBranch(policyBranchID);
--print("bHasPolicyBranch:", bHasPolicyBranch)
--print("bCanAdoptPolicyBranch:", bCanAdoptPolicyBranch)
--print("PolicyBranch Blocked:", player:IsPolicyBranchBlocked(policyBranchID))
local bUnblockingPolicyBranch = false;
-- If we can get this, OR we already have it, see if we can unblock it first
if bHasPolicyBranch or bCanAdoptPolicyBranch then
-- Policy Branch blocked off right now? If so, try to activate
if player:IsPolicyBranchBlocked(policyBranchID) then
bUnblockingPolicyBranch = true;
Events.SerialEventGameMessagePopup{ Type = ButtonPopupTypes.BUTTONPOPUP_CONFIRM_POLICY_BRANCH_SWITCH, Data1 = policyBranchID }
end
end
-- Can adopt Policy Branch right now - don't try this if we're going to unblock the Policy Branch instead
if bCanAdoptPolicyBranch and not bUnblockingPolicyBranch then
Controls.Yes:SetVoids( policyBranchID, 0 )
Controls.PolicyConfirm:SetHide(false);
Controls.BGBlock:SetHide(true);
end
end
end
local function PolicyBranchPedia( policyBranchID )
SearchForPediaEntry( GameInfoPolicyBranchTypes[ policyBranchID ]._Name )
end
-------------------------------------------------
-- Ideology Selection
if bnw_mode then
include "StackInstanceManager"
include "CommonBehaviors"
local g_TenetInstanceManager = StackInstanceManager( "TenetChoice", "TenetButton", Controls.TenetStack )
SetToolTipCallback( Controls.TenetConfirmYes, TenetToolTip )
Controls.SwitchIdeologyButton:RegisterCallback( eLClick, function()
local player = Players[GetActivePlayer()]
local iAnarchyTurns = GameDefines["SWITCH_POLICY_BRANCHES_ANARCHY_TURNS"];
local eCurrentIdeology = player:GetLateGamePolicyTree();
local iCurrentIdeologyTenets = player:GetNumPoliciesInBranch(eCurrentIdeology);
local iPreferredIdeologyTenets = iCurrentIdeologyTenets - GameDefines["SWITCH_POLICY_BRANCHES_TENETS_LOST"];
if iPreferredIdeologyTenets < 0 then
iPreferredIdeologyTenets = 0
end
local iUnhappiness = player:GetPublicOpinionUnhappiness();
local strCurrentIdeology = GameInfoPolicyBranchTypes[eCurrentIdeology].Description;
local ePreferredIdeology = player:GetPublicOpinionPreferredIdeology();
local strPreferredIdeology = tostring((GameInfoPolicyBranchTypes[ePreferredIdeology] or {}).Description);
Controls.LabelConfirmChangeIdeology:LocalizeAndSetText("TXT_KEY_POLICYSCREEN_CONFIRM_CHANGE_IDEOLOGY", iAnarchyTurns, iCurrentIdeologyTenets, strCurrentIdeology, iPreferredIdeologyTenets, strPreferredIdeology, iUnhappiness);
Controls.ChangeIdeologyConfirm:SetHide(false);
end)
local function ChooseTenet( tenetID, tenetLevel )
local tenet = GameInfoPolicies[ tenetID ]
if tenet then
Controls.TenetConfirmYes:SetVoids( tenetID, tenetLevel )
Controls.LabelConfirmTenet:LocalizeAndSetText( "TXT_KEY_POLICYSCREEN_CONFIRM_TENET", tenet.Description )
Controls.TenetConfirm:SetHide( false )
end
end
function TenetSelect( tenetID, tenetLevel )
local player = Players[GetActivePlayer()];
if player then
g_TenetInstanceManager:ResetInstances();
for _,tenetID in ipairs(player:GetAvailableTenets(tenetLevel)) do
local tenet = GameInfoPolicies[ tenetID ]
if tenet then
local instance = g_TenetInstanceManager:GetInstance();
instance.TenetLabel:LocalizeAndSetText( tenet.Help or tenet.Description )
local newHeight = instance.TenetLabel:GetSizeY() + 30;
instance.TenetButton:SetSizeY( newHeight );
instance.Box:SetSizeY( newHeight );
instance.TenetButton:ReprocessAnchoring();
instance.TenetButton:RegisterCallback( eLClick, ChooseTenet )
instance.TenetButton:SetVoids( tenetID, tenetLevel )
end
end
Controls.ChooseTenet:SetHide(false);
Controls.BGBlock:SetHide(true);
end
end
Controls.TenetCancelButton:RegisterCallback( eLClick, function()
Controls.ChooseTenet:SetHide(true)
Controls.BGBlock:SetHide(false)
end)
Controls.TenetConfirmYes:RegisterCallback( eLClick, function( tenetID )
Controls.TenetConfirm:SetHide(true)
Controls.ChooseTenet:SetHide(true)
Controls.BGBlock:SetHide(false)
if GameInfoPolicies[ tenetID ] then
Network.SendUpdatePolicies( tenetID, true, true )
Events.AudioPlay2DSound("AS2D_INTERFACE_POLICY")
end
end)
Controls.TenetConfirmNo:RegisterCallback( eLClick, function()
Controls.TenetConfirm:SetHide(true)
Controls.BGBlock:SetHide(false)
end)
Controls.ChangeIdeologyConfirmYes:RegisterCallback( eLClick, function()
local player = Players[GetActivePlayer()]
local ePreferredIdeology = player:GetPublicOpinionPreferredIdeology()
Controls.ChangeIdeologyConfirm:SetHide(true)
Network.SendChangeIdeology()
if ePreferredIdeology < 0 then
Events.SerialEventGameMessagePopup{ Type = ButtonPopupTypes.BUTTONPOPUP_CHOOSE_IDEOLOGY }
OnClose()
end
Events.AudioPlay2DSound("AS2D_INTERFACE_POLICY")
end)
Controls.ChangeIdeologyConfirmNo:RegisterCallback( eLClick, function()
Controls.ChangeIdeologyConfirm:SetHide(true)
end)
SetToolTipCallback( Controls.PublicOpinion, function()
return ShowTextToolTipAndPicture( Players[GetActivePlayer()]:GetPublicOpinionTooltip() )
end)
SetToolTipCallback( Controls.PublicOpinionUnhappiness, function()
return ShowTextToolTipAndPicture( Players[GetActivePlayer()]:GetPublicOpinionUnhappinessTooltip() )
end)
-- Register tabbing behavior and assign global TabSelect routine.
TabSelect = RegisterTabBehavior( g_Tabs, g_Tabs.SocialPolicies )
Controls.ToIdeologyTab:RegisterCallback( eLClick, function()
TabSelect( g_Tabs.Ideologies )
end)
end
-------------------------------------------------
-- Screen Refresh
local function UpdateDisplay()
local player = Players[GetActivePlayer()];
if not player then return end
local pTeam = Teams[player:GetTeam()];
local playerHasNoCities = player:GetNumCities() < 1
local bShowAll = OptionsManager.GetPolicyInfo();
Controls.NextCost:LocalizeAndSetText( "TXT_KEY_NEXT_POLICY_COST_LABEL", player:GetNextPolicyCost() )
Controls.CurrentCultureLabel:LocalizeAndSetText( "TXT_KEY_CURRENT_CULTURE_LABEL", player:GetJONSCulture() )
Controls.CulturePerTurnLabel:LocalizeAndSetText( "TXT_KEY_CULTURE_PER_TURN_LABEL", player:GetTotalJONSCulturePerTurn() )
local cultureNeeded = player:GetNextPolicyCost() - player:GetJONSCulture()
local culturePerTurn = player:GetTotalJONSCulturePerTurn()
Controls.NextPolicyTurnLabel:LocalizeAndSetText( "TXT_KEY_NEXT_POLICY_TURN_LABEL", cultureNeeded <= 0 and 0 or ( culturePerTurn <= 0 and "?" or ceil( cultureNeeded / culturePerTurn ) ) )
-- Player Title
local dominantBranch = GameInfoPolicyBranchTypes[ player:GetDominantPolicyBranchForTitle() ]
if dominantBranch then
Controls.PlayerTitleLabel:SetHide(false);
Controls.PlayerTitleLabel:LocalizeAndSetText( dominantBranch.Title, player:GetNameKey(), player:GetCivilizationShortDescriptionKey() );
else
Controls.PlayerTitleLabel:SetHide(true);
end
-- Free Policies
local iNumFreePolicies = player:GetNumFreePolicies();
if iNumFreePolicies > 0 then
Controls.FreePoliciesLabel:LocalizeAndSetText( "TXT_KEY_FREE_POLICIES_LABEL", iNumFreePolicies );
Controls.FreePoliciesLabel:SetHide( false );
else
Controls.FreePoliciesLabel:SetHide( true );
end
-- Adjust Policy Branches
local policyBranchID
for policyBranchInfo in GameInfoPolicyBranchTypes() do
if not policyBranchInfo.PurchaseByLevel then
policyBranchID = policyBranchInfo.ID
local thisButton = Controls[ "BranchButton"..policyBranchID ]
local thisBack = Controls[ "BranchBack"..policyBranchID ]
local thisDisabledBox = Controls[ "DisabledBox"..policyBranchID ]
local thisLockedBox = Controls[ "LockedBox"..policyBranchID ]
local thisImageMask = Controls[ "ImageMask"..policyBranchID ]
local thisDisabledMask = Controls[ "DisabledMask"..policyBranchID ]
local thisLock = Controls[ "Lock"..policyBranchID ]
-- Era Prereq
local iEraPrereq = GameInfoTypes[ policyBranchInfo.EraPrereq ]
local bEraLock = iEraPrereq and pTeam:GetCurrentEra() < iEraPrereq
-- Branch is not yet unlocked
if not player:IsPolicyBranchUnlocked( policyBranchID ) then
-- Cannot adopt this branch right now
if policyBranchInfo.LockedWithoutReligion and IsOption(GameOptionTypes.GAMEOPTION_NO_RELIGION) then
elseif not player:CanUnlockPolicyBranch( policyBranchID ) then
-- Not in prereq Era
if bEraLock then
thisButton:LocalizeAndSetText( GameInfoEras[iEraPrereq].Description )
-- Don't have enough Culture Yet
else
thisButton:SetHide( false )
thisButton:LocalizeAndSetText "TXT_KEY_POP_ADOPT_BUTTON"
end
thisLock:SetHide( false );
thisButton:SetDisabled( true );
-- Can adopt this branch right now
else
thisLock:SetHide( true );
thisButton:SetDisabled( false );
thisButton:SetHide( false );
thisButton:LocalizeAndSetText "TXT_KEY_POP_ADOPT_BUTTON"
end
if playerHasNoCities then
thisButton:SetDisabled(true);
end
thisBack:SetColor( g_FadeColor );
thisLockedBox:SetHide(false);
thisImageMask:SetHide(true);
thisDisabledMask:SetHide(false);
-- Branch is unlocked, but blocked by another branch
elseif player:IsPolicyBranchBlocked( policyBranchID ) then
thisButton:SetHide( false );
thisBack:SetColor( g_FadeColor );
thisLock:SetHide( false );
thisLockedBox:SetHide(true);
-- Branch is unlocked already
else
thisButton:SetHide( true );
thisBack:SetColor( g_FullColor );
thisLockedBox:SetHide(true);
thisImageMask:SetHide(false);
thisDisabledMask:SetHide(true);
end
-- If the player doesn't have the era prereq, then dim out the branch
if bEraLock then
thisDisabledBox:SetHide(false);
thisLockedBox:SetHide(true);
else
thisDisabledBox:SetHide(true);
end
if bShowAll then
thisDisabledBox:SetHide(true);
thisLockedBox:SetHide(true);
end
end
end
-- Adjust Policy buttons
local policyID, policyBranchInfo, instance, atlas, disabled, color
for policyInfo in GameInfoPolicies() do
policyBranchInfo = GameInfoPolicyBranchTypes[ policyInfo.PolicyBranchType ]
-- If this is nil it means the Policy is a freebie handed out with the Branch, so don't display it
if policyBranchInfo and not policyBranchInfo.PurchaseByLevel then
policyID = policyInfo.ID
instance = g_PolicyButtons[ policyID ]
atlas = policyInfo.IconAtlas
disabled = true
color = g_FadeColorRV
-- Player already has Policy
if player:HasPolicy( policyID ) then
color = g_FullColor
atlas = policyInfo.IconAtlasAchieved
elseif playerHasNoCities then
-- Can adopt the Policy right now
elseif player:CanAdoptPolicy( policyID ) then
color = g_FullColor
disabled = false
end
instance.MouseOverContainer:SetHide( disabled )
instance.PolicyIcon:SetDisabled( disabled )
instance.PolicyImage:SetColor( color )
IconHookup( policyInfo.PortraitIndex, 64, atlas, instance.PolicyImage )
end
end
-- Adjust Ideology
if bnw_mode then
CivIconHookup( player:GetID(), 64, Controls.CivIcon, Controls.CivIconBG, Controls.CivIconShadow, false, true );
Controls.InfoStack2:ReprocessAnchoring();
local ideologyID = player:GetLateGamePolicyTree();
local upperLevelCount = ideologyID >=0 and huge or 0
local tenetsPerLevel = { 7, 4, 3 }
for tenetLevel = 1, 3 do
local levelCount = 0
local thisLevelTenets = {}
for i = 1, tenetsPerLevel[tenetLevel] do
local tenetID = player:GetTenet( ideologyID, tenetLevel, i )
thisLevelTenets[i] = tenetID
local buttonControl = Controls["IdeologyButton"..tenetLevel..i]
local labelControl = Controls["IdeologyButtonLabel"..tenetLevel..i]
local lockControl = Controls["Lock"..tenetLevel..i]
buttonControl:SetDisabled( true )
buttonControl:ClearCallback( eLClick )
local tenet = GameInfoPolicies[ tenetID ]
if tenet then
levelCount = levelCount + 1
labelControl:LocalizeAndSetText( tenet.Description )
lockControl:SetHide( true )
else
if upperLevelCount > i and i == levelCount+1 then
tenetID = -1
labelControl:LocalizeAndSetText( "TXT_KEY_POLICYSCREEN_ADD_TENET" )
lockControl:SetHide( true )
if player:GetJONSCulture() >= player:GetNextPolicyCost() or player:GetNumFreePolicies() > 0 or player:GetNumFreeTenets() > 0 then
buttonControl:RegisterCallback( eLClick, TenetSelect )
buttonControl:SetDisabled( false )
else
tenetID = -2
end
else
lockControl:SetHide( false )
labelControl:SetString()
if upperLevelCount == i then
tenetID = -3
else
tenetID = -4
end
end
end
buttonControl:SetVoids( tenetID, tenetLevel )
SetToolTipCallback( buttonControl, TenetToolTip )
end
Controls["Level"..tenetLevel.."Tenets"]:LocalizeAndSetText( "TXT_KEY_POLICYSCREEN_IDEOLOGY_L"..tenetLevel.."TENETS", levelCount )
upperLevelCount = levelCount
end
local ideology = GameInfoPolicyBranchTypes[ideologyID];
if ideology then
-- Free Tenets
local iNumFreeTenets = player:GetNumFreeTenets();
if iNumFreeTenets > 0 then
Controls.FreeTenetsLabel:LocalizeAndSetText( "TXT_KEY_FREE_TENETS_LABEL", iNumFreeTenets )
Controls.FreeTenetsLabel:SetHide( false );
else
Controls.FreeTenetsLabel:SetHide( true );
end
local ideologyName = L("TXT_KEY_POLICYSCREEN_IDEOLOGY_TITLE", player:GetCivilizationAdjectiveKey(), ideology.Description);
Controls.IdeologyHeader:SetText(ideologyName);
Controls.IdeologyImage1:SetTexture(g_IdeologyBackgrounds[ideology.Type]);
Controls.IdeologyImage2:SetTexture(g_IdeologyBackgrounds[ideology.Type]);
Controls.TenetsStack:CalculateSize();
Controls.TenetsStack:ReprocessAnchoring();
local ideologyTitle = ToUpper(ideologyName);
Controls.IdeologyTitle:SetText(ideologyTitle);
Controls.ChooseTenetTitle:SetText(ideologyTitle);
Controls.NoIdeology:SetHide(true);
Controls.DisabledIdeology:SetHide(true);
Controls.HasIdeology:SetHide(false);
Controls.IdeologyGenericHeader:SetHide(true);
Controls.IdeologyDetails:SetHide(false);
local szOpinionString;
local iOpinion = player:GetPublicOpinionType();
if iOpinion == PublicOpinionTypes.PUBLIC_OPINION_DISSIDENTS then
szOpinionString = L("TXT_KEY_CO_PUBLIC_OPINION_DISSIDENTS");
elseif iOpinion == PublicOpinionTypes.PUBLIC_OPINION_CIVIL_RESISTANCE then
szOpinionString = L("TXT_KEY_CO_PUBLIC_OPINION_CIVIL_RESISTANCE");
elseif iOpinion == PublicOpinionTypes.PUBLIC_OPINION_REVOLUTIONARY_WAVE then
szOpinionString = L("TXT_KEY_CO_PUBLIC_OPINION_REVOLUTIONARY_WAVE");
else
szOpinionString = L("TXT_KEY_CO_PUBLIC_OPINION_CONTENT");
end
Controls.PublicOpinion:SetText(szOpinionString);
local iUnhappiness = -1 * player:GetPublicOpinionUnhappiness();
local strPublicOpinionUnhappiness = tostring(0);
if iUnhappiness < 0 then
strPublicOpinionUnhappiness = L("TXT_KEY_CO_PUBLIC_OPINION_UNHAPPINESS", iUnhappiness);
Controls.SwitchIdeologyButton:SetDisabled(false);
local preferredIdeologyInfo = GameInfoPolicyBranchTypes[ player:GetPublicOpinionPreferredIdeology() ] or {}
Controls.SwitchIdeologyButton:LocalizeAndSetToolTip( "TXT_KEY_POLICYSCREEN_CHANGE_IDEOLOGY_TT", preferredIdeologyInfo.Description or "???", -iUnhappiness, 2 )
else
Controls.SwitchIdeologyButton:SetDisabled( true )
Controls.SwitchIdeologyButton:LocalizeAndSetToolTip( "TXT_KEY_POLICYSCREEN_CHANGE_IDEOLOGY_DISABLED_TT" )
end
Controls.PublicOpinionUnhappiness:SetText(strPublicOpinionUnhappiness);
Controls.PublicOpinionHeader:SetHide(false);
Controls.PublicOpinion:SetHide(false);
Controls.PublicOpinionUnhappinessHeader:SetHide(false);
Controls.PublicOpinionUnhappiness:SetHide(false);
Controls.SwitchIdeologyButton:SetHide(false);
else
Controls.IdeologyImage1:SetTexture( "PolicyBranch_Ideology.dds" );
Controls.HasIdeology:SetHide(true);
Controls.IdeologyGenericHeader:SetHide(false);
Controls.IdeologyDetails:SetHide(true);
Controls.PublicOpinionHeader:SetHide(true);
Controls.PublicOpinion:SetHide(true);
Controls.PublicOpinionUnhappinessHeader:SetHide(true);
Controls.PublicOpinionUnhappiness:SetHide(true);
Controls.SwitchIdeologyButton:SetHide(true);
local bDisablePolicies = IsOption(GameOptionTypes.GAMEOPTION_NO_POLICIES);
Controls.NoIdeology:SetHide(bDisablePolicies);
Controls.DisabledIdeology:SetHide(not bDisablePolicies);
end
else
Controls.AnarchyBlock:SetHide( not player:IsAnarchy() );
end
Controls.InfoStack:ReprocessAnchoring();
end
Events.EventPoliciesDirty.Add( UpdateDisplay )
-------------------------------------------------
-- Initialization
local bDisablePolicies = IsOption(GameOptionTypes.GAMEOPTION_NO_POLICIES);
Controls.LabelPoliciesDisabled:SetHide(not bDisablePolicies);
Controls.InfoStack:SetHide(bDisablePolicies);
Controls.InfoStack2:SetHide(bDisablePolicies);
local blockSpacingX = 28
local blockSpacingY = 68
local blockOffsetX = 16 - blockSpacingX
local blockOffsetY = 12 - blockSpacingY
local connectorElbowSizeX = 19 -- connector texture width
local connectorElbowSizeY = 19 -- connector texture height
local connectorOffsetX = 3
local connectorStartOffsetY = blockOffsetY + 48 - 1
local connectorEndOffsetY = blockOffsetY + 1
local connectorElbowOffsetY = connectorEndOffsetY - connectorElbowSizeY
local connectorHorizontalOffsetY = connectorOffsetX + connectorElbowSizeX
local function GetConnectorPipe( panel, x, y, texture )
local pipe = {}
ContextPtr:BuildInstanceForControl( "ConnectorPipe", pipe, panel )
pipe = pipe.ConnectorImage
pipe:SetOffsetVal( x, y )
pipe:SetTextureAndResize( texture )
return pipe
end
local prereq, policy, x1, x2, y1, y2, height, width, panel, pipe, x, y, instance, thisButton
-- Create straight connector instances first
for row in GameInfoPrereqPolicies() do
prereq = GameInfoPolicies[row.PrereqPolicy]
policy = GameInfoPolicies[row.PolicyType]
if policy and prereq then
panel = g_PolicyBranchPanels[ policy.PolicyBranchType ]
if panel then
y1 = prereq.GridY*blockSpacingY + connectorStartOffsetY
y2 = policy.GridY*blockSpacingY + connectorEndOffsetY
width = abs( policy.GridX - prereq.GridX ) * blockSpacingX
-- horizontal connector
if width > 0 then
y2 = y2 - connectorElbowSizeY
width = width - connectorElbowSizeX
if width > 0 then
pipe = GetConnectorPipe( panel, min(policy.GridX, prereq.GridX) * blockSpacingX + connectorHorizontalOffsetY, y2, "Connect_H.dds" )
x, y = pipe:GetSizeVal()
pipe:SetSizeX( width )
-- graphic engine bug workaround
if width < x then
pipe:SetTextureSizeVal( width, y )
pipe:SetTexture( "Connect_H.dds" )
end
end
end
-- vertical connector
height = y2 - y1
if height > 0 then
pipe = GetConnectorPipe( panel, prereq.GridX*blockSpacingX + connectorOffsetX, y1, "Connect_V.dds" )
x, y = pipe:GetSizeVal()
pipe:SetSizeY( height )
-- graphic engine bug workaround
if height < y then
pipe:SetTextureSizeVal( x, height )
pipe:SetTexture( "Connect_V.dds" )
end
end
end
end
end
-- Create elbow connector intances next
for row in GameInfoPrereqPolicies() do
prereq = GameInfoPolicies[row.PrereqPolicy]
policy = GameInfoPolicies[row.PolicyType]
if policy and prereq then
panel = g_PolicyBranchPanels[ policy.PolicyBranchType ]
if panel then
x1 = prereq.GridX
x2 = policy.GridX
y = policy.GridY*blockSpacingY + connectorElbowOffsetY
if x1 > x2 then
GetConnectorPipe( panel, x1*blockSpacingX + connectorOffsetX, y, "Connect_JonCurve_BottomRight.dds" ) -- _|
GetConnectorPipe( panel, x2*blockSpacingX + connectorOffsetX, y, "Connect_JonCurve_TopLeft.dds" ) -- |¯
elseif x1 < x2 then
GetConnectorPipe( panel, x1*blockSpacingX + connectorOffsetX, y, "Connect_JonCurve_BottomLeft.dds" ) -- |_
GetConnectorPipe( panel, x2*blockSpacingX + connectorOffsetX, y, "Connect_JonCurve_TopRight.dds" ) -- ¯|
end
end
end
end
-- Create policy button instances last
for policyInfo in GameInfoPolicies() do
panel = g_PolicyBranchPanels[ policyInfo.PolicyBranchType ]
-- If this is nil it means the Policy is a freebie handed out with the Branch, so don't display it
if panel then
instance = {}
ContextPtr:BuildInstanceForControl( "PolicyButton", instance, panel )
-- store this away for later
g_PolicyButtons[ policyInfo.ID ] = instance
thisButton = instance.PolicyIcon
thisButton:SetOffsetVal( policyInfo.GridX*blockSpacingX+blockOffsetX, policyInfo.GridY*blockSpacingY+blockOffsetY )
thisButton:SetVoid1( policyInfo.ID )
thisButton:RegisterCallback( eLClick, PolicySelect )
thisButton:RegisterCallback( eRClick, PolicyPedia )
SetToolTipCallback( thisButton, PolicyTooltip )
end
end
-- Set Yes & No policy choice confirmation handlers
Controls.Yes:RegisterCallback( eLClick, function( policyID, isAdoptingPolicy )
Controls.PolicyConfirm:SetHide(true);
Controls.BGBlock:SetHide(false);
if GameInfoPolicies[ policyID ] then
Network.SendUpdatePolicies( policyID, isAdoptingPolicy > 0, true);
Events.AudioPlay2DSound("AS2D_INTERFACE_POLICY");
end
end)
SetToolTipCallback( Controls.Yes, function(control) (control:GetVoid2()>0 and PolicyTooltip or PolicyBranchTooltip)( control ) end )
Controls.No:RegisterCallback( eLClick, function()
Controls.PolicyConfirm:SetHide(true);
Controls.BGBlock:SetHide(false);
end)
-- Handlers for the horrible hardcoded static branch buttons
for policyBranchInfo in GameInfoPolicyBranchTypes() do
if not policyBranchInfo.PurchaseByLevel then
thisButton = Controls["BranchButton"..policyBranchInfo.ID]
thisButton:SetVoid1( policyBranchInfo.ID )
thisButton:RegisterCallback( eLClick, PolicyBranchSelect )
thisButton:RegisterCallback( eRClick, PolicyBranchPedia )
SetToolTipCallback( thisButton, PolicyBranchTooltip )
end
end
-- Display Mode Toggle
Controls.PolicyInfo:RegisterCheckHandler( function( bIsChecked )
local bUpdateScreen = bIsChecked ~= OptionsManager.GetPolicyInfo()
OptionsManager.SetPolicyInfo_Cached( bIsChecked );
OptionsManager.CommitGameOptions();
if bUpdateScreen then
Events.EventPoliciesDirty();
end
end)
-- Key Down Processing
do
local VK_RETURN = Keys.VK_RETURN
local VK_ESCAPE = Keys.VK_ESCAPE
local KeyDown = KeyEvents.KeyDown
ContextPtr:SetInputHandler( function( uiMsg, wParam )
if uiMsg == KeyDown then
if wParam == VK_ESCAPE or wParam == VK_RETURN then
if bnw_mode then
if Controls.PolicyConfirm:IsHidden() and Controls.TenetConfirm:IsHidden() and Controls.ChooseTenet:IsHidden() and Controls.ChangeIdeologyConfirm:IsHidden() then
OnClose();
elseif Controls.TenetConfirm:IsHidden() then
Controls.ChooseTenet:SetHide(true);
Controls.PolicyConfirm:SetHide(true);
Controls.BGBlock:SetHide(false);
else
Controls.TenetConfirm:SetHide(true);
end
elseif Controls.PolicyConfirm:IsHidden() then
OnClose();
else
Controls.PolicyConfirm:SetHide(true);
Controls.BGBlock:SetHide(false);
end
end
return true
end
end)
end
-- Show/hide handler
ContextPtr:SetShowHideHandler( function( bIsHide, bInitState )
if not bInitState then
Controls.PolicyInfo:SetCheck( OptionsManager.GetPolicyInfo() );
if not bIsHide then
incTurnTimerSemaphore();
Events.SerialEventGameMessagePopupShown(g_PopupInfo);
else
decTurnTimerSemaphore();
Events.SerialEventGameMessagePopupProcessed.CallImmediate(ButtonPopupTypes.BUTTONPOPUP_CHOOSEPOLICY, 0);
end
end
end)
-- Active player change handler
Events.GameplaySetActivePlayer.Add( function()
if bnw_mode then
if not Controls.PolicyConfirm:IsHidden() or not Controls.TenetConfirm:IsHidden() or not Controls.ChangeIdeologyConfirm:IsHidden() then
Controls.TenetConfirm:SetHide(true);
Controls.ChangeIdeologyConfirm:SetHide(true);
Controls.PolicyConfirm:SetHide(true);
Controls.BGBlock:SetHide(false);
end
elseif not Controls.PolicyConfirm:IsHidden() then
Controls.PolicyConfirm:SetHide(true);
Controls.BGBlock:SetHide(false);
end
OnClose();
end)
-------------------------------------------------
-- Hookup Popup
AddSerialEventGameMessagePopup( function(popupInfo)
if popupInfo.Type == ButtonPopupTypes.BUTTONPOPUP_CHOOSEPOLICY then
g_PopupInfo = popupInfo;
UpdateDisplay();
if bnw_mode then
local player = Players[GetActivePlayer()]
if g_PopupInfo.Data2 == 2 or (player and player:GetNumFreeTenets() > 0) then
TabSelect( g_Tabs.Ideologies )
else
TabSelect( g_Tabs.SocialPolicies )
end
end
if g_PopupInfo.Data1 == 1 then
if ContextPtr:IsHidden() then
UIManager:QueuePopup( ContextPtr, PopupPriority.InGameUtmost )
else
OnClose()
end
else
UIManager:QueuePopup( ContextPtr, PopupPriority.SocialPolicy )
end
end
end, ButtonPopupTypes.BUTTONPOPUP_CHOOSEPOLICY )
end) |
-- LuaBox library
-- Copyright (c) 2017 Lobachevskiy Vitaliy
local strrep_limit = tonumber(minetest.settings:get("libluabox.string_rep_limit")) or 65536
function string.strstr(haystack, needle, base)
return string.find(haystack, needle, base or 1, true)
end
local rstring = {}
function rstring.find(s, pattern, init, plain)
assert(plain == true, "Only plain find is allowed")
return string.find(s, pattern, init, true)
end
function rstring.rep(s, n)
assert(type(s) == "string")
if n * #s > strrep_limit then
error("String repeat limit exceeded")
end
return string.rep(s, n)
end
local rtime = {}
rtime.clock = os.clock
rtime.difftime = os.difftime
rtime.time = os.time
function rtime.date(format, time)
assert(format == nil or format == "%c" or format == "*t" or format == "!*t",
"Date formats are restricted")
return os.date(format, time)
end
libluabox.register_library("rstring", {string = rstring}, true)
libluabox.register_library("rtime", {os = rtime})
|
function a()
local var = 1
for something in all(something) do
for key, value in pairs(something) do
target[key] = value
end
end
end
function indentedfunction(value)
return flr(value / cell_size)
end
local var = 1
local indentedvar = 1
function f(x, y)
return get(nestedcall(x), nestedcall(y))
end
local object = {
varying = 1,
indentation = 2,
levels = 3
}
local nestedobject = {
a = 1,
b = {
c = 2
}
}
if something then
indentation
end
if something then
varying
indentation
levels
if (singlelineif) something
indentationshouldremainthesame
end
while something do
doing
end
lineends with then
indentationshouldincrease
end
{
{
foreach
indentationshouldbe 3
end
end)
}
indentationshouldbe 0
|
AddCSLuaFile()
ENT.RenderGroup = RENDERGROUP_OPAQUE
ENT.Base = "base_anim"
ENT.Type = "anim"
ENT.Spawnable = true
ENT.CopySubmodels = true
ENT.Model = "wa2000"
ENT.Scale = 1
ENT.Debug = true
function ENT:Initialize()
self:SetModel("models/hunter/blocks/cube025x025x025.mdl")
self:SetupPhysics()
self:DrawShadow(false)
self:EnableCustomCollisions(true)
if CLIENT then
if self.CopySubmodels then
self.Submodels = table.Copy(self:GetVModel().Submodels)
else
self.Submodels = {}
end
self:UpdateRenderBounds()
end
end
function ENT:SetupPhysics()
local mins, maxs = self:GetVModel():GetBounds()
mins = mins * self.Scale
maxs = maxs * self.Scale
if IsValid(self.PhysCollide) then
self.PhysCollide:Destroy()
end
self.PhysCollide = CreatePhysCollideBox(mins, maxs)
if SERVER then
self:PhysicsInitBox(mins, maxs)
self:SetSolid(SOLID_VPHYSICS)
local phys = self:GetPhysicsObject()
if IsValid(phys) then
phys:EnableMotion(false)
end
end
end
function ENT:GetVModel()
return voxel.Models[self.Model]
end
function ENT:TestCollision(start, delta, isbox, extends)
if not IsValid(self.PhysCollide) then
return
end
local max = extends
local min = -extends
max.z = max.z - min.z
min.z = 0
local hit, norm, frac = self.PhysCollide:TraceBox(self:GetPos(), self:GetAngles(), start, start + delta, min, max)
if not hit then
return
end
return {
HitPos = hit,
Normal = norm,
Fraction = frac
}
end
function ENT:GetVAttachment(attachment)
attachment = self:GetVModel().Attachments[attachment]
return LocalToWorld(attachment.Offset * self.Scale, attachment.Angles, self:GetPos(), self:GetAngles())
end
if CLIENT then
function ENT:GetVRenderBounds()
local mins = Vector(math.huge, math.huge, math.huge)
local maxs = Vector(-math.huge, -math.huge, -math.huge)
self:GetVModel():GetRenderBounds(mins, maxs, self.Submodels)
return mins, maxs
end
function ENT:UpdateRenderBounds()
self:SetRenderBounds(self:GetVRenderBounds())
end
function ENT:Draw()
self:DrawModel()
local matrix = self:GetWorldTransformMatrix()
matrix:SetScale(Vector(self.Scale, self.Scale, self.Scale))
cam.PushModelMatrix(matrix, true)
local color = self:GetColor()
render.SetColorModulation(color.r / 255, color.g / 255, color.b / 255)
self:GetVModel():Draw(self.Submodels, false, self.Debug)
render.SetColorModulation(1, 1, 1)
cam.PopModelMatrix()
end
function ENT:GetRenderMesh()
local vModel = self:GetVModel()
local vMesh = vModel:GetVMesh()
local renderMesh
local renderMat
if vMesh then
renderMesh = vMesh.Mesh
renderMat = vMesh.Mat
else
renderMesh = voxel.Cube
renderMat = voxel.Mat
end
local matrix = Matrix()
matrix:SetScale(Vector(self.Scale, self.Scale, self.Scale))
return {
Mesh = renderMesh,
Material = renderMat,
Matrix = matrix
}
end
end
|
local P = {}
imgfun = P
function P.img2mat(img)
return torch.reshape(img, 3, img:size()[2]*img:size()[3]):t()
end
function P.mat2img(mat, h, w)
return torch.reshape(mat:t(), 3, h,w)
end
function P.assign_means(means, mat)
-- means: K x d
-- mat -- N x d
-- returns N x 1 assignments
local K = means:size()[1]
local N = mat:size()[1]
local kdists = torch.zeros(K, N)
for i = 1,K do
kdists[{i, {}}] = (means[{i, {}}]:repeatTensor(N,1)-mat):pow(2):sum(2):sqrt()
end
local mins, indices = kdists:min(1)
return indices:t()
end
function P.compute_means(clusters, mat, K)
-- clusters: N x 1 cluster assignments for pmat, has entries from 1..K
-- mat: N x d
-- K: Number of clusters
local N = mat:size()[1]
local d = mat:size()[2]
local means = torch.zeros(K, d)
for i=1,K do
local members = clusters:eq(i):reshape(N, 1)
local num_points = members:sum()
if num_points > 0 then
means[{i, {}}] = members:repeatTensor(1, d):double():cmul(mat):sum(1) / num_points
end
end
return means
end
function P.kmeans(mat, K, mini, maxi)
local means = torch.randn(K, 3) * (maxi - mini) + mini
local N = mat:size()[1]
local d = mat:size()[2]
local prev_clusters = torch.LongTensor(N, 1)
local clusters = prev_clusters:clone()
local iters = 0
while true do
iters = iters + 1
clusters = P.assign_means(means, mat)
local agreements = torch.eq(prev_clusters, clusters):sum()
if agreements == N then
break
end
means = P.compute_means(clusters, mat, K)
prev_clusters:set(clusters)
end
print("Kmeans iterations: ", iters)
return means, clusters
end
function P.gen_kmeans_image(img, K)
local imat = P.img2mat(img)
local N = imat:size()[1]
local m, clusters = P.kmeans(imat, K, 0, 1)
local img2 = torch.zeros(N, 3)
local x1 = m[{clusters[1], {}}]
local y1 = img2[{1, {}}]
for i=1,N do
img2[{i, {}}] = m[{clusters[i][1], {}}]
end
return P.mat2img(img2, img:size()[2], img:size()[3])
end
return P
|
require "util"
require "config"
local TrainPlan = require "models/TrainPlan"
local TrainBuild = {}
TrainBuild.__index = TrainBuild
TrainBuild.version = 1
function TrainBuild.new(depot, train, storage, parameters)
local self = setmetatable({}, TrainBuild)
self.type = "TrainBuild"
self.version = TrainBuild.version
self.train_plan = TrainPlan.new(depot, train, parameters)
self.current_stock_index = 1
self.current_progress = 0
self.built_stock = {}
self.train = nil
self.depot = depot
self.storage = storage
return self
end
function TrainBuild:calculate_progress_from_ticks(ticks)
local progress = 0
-- TODO: static for now, but affected by modules in the future
progress = progress + (100 * ((ticks / 60) / _CONFIG._UNMODULED_STOCK_PER_SEC))
return progress -- math.ceil(progress)
end
function TrainBuild:can_place_next()
return self.train_plan:can_place(self.current_stock_index)
end
function TrainBuild:can_place_all_remaining()
local is_clear = true
local length = self.train_plan:length()
for index = self.current_stock_index, length do
local offset = 0
if index == length then
offset = 3 -- TODO: connection_distance/joint_distance?
end
is_clear = is_clear and self.train_plan:can_place(self.depot, index, offset)
end
return is_clear
end
function TrainBuild.can_place_clone_at_depot(depot, train)
local num = #train.carriages
local can_place = true
for stock_index = 1, num do
local stock_plan = {name = "cargo-wagon"}
local offset = 0
if stock_index == num then
offset = 3 -- TODO: connection_distance/joint_distance?
end
can_place = can_place and TrainPlan.can_place_at_depot(depot, stock_plan, stock_index, offset)
end
return can_place
end
function TrainBuild:valid()
local valid = true
if self.train and not self.train.valid then
valid = false
end
return valid
end
function TrainBuild:update(ticks)
local complete = false
local auto_scheduled = false
self.current_progress = self.current_progress + self:calculate_progress_from_ticks(ticks)
-- util.print("current_progress: " .. self.current_progress)
if self.current_progress >= 100 then
local stock = nil
if self:can_place_all_remaining() then
util.print("building: " .. self.current_stock_index .. " of " .. self.train_plan:length())
stock = self.train_plan:place(self.depot.surface, self.current_stock_index, self.storage)
else
util.print("waiting for clearance")
end
if stock then
self.built_stock[self.current_stock_index] = stock
-- train id changes every time we add stock to it, so keep it updated
self.train = stock.train
self.current_progress = self.current_progress % 100
self.current_stock_index = self.current_stock_index + 1
else
-- TODO: check validity of TrainBuild
self.current_progress = 100 -- clamp while we wait for the stock to be placeable
end
end
if self.current_stock_index > self.train_plan:length() then
auto_scheduled = self.train_plan:finalize(self.train)
complete = true
end
return complete, auto_scheduled
end
function TrainBuild:serialize()
self.train_plan_serialized = self.train_plan and self.train_plan:serialize() or nil
return self
end
function TrainBuild.deserialize(data)
if type(data) == "table" and data.type == "TrainBuild" and data.version <= TrainBuild.version then
local self = setmetatable(data, TrainBuild)
self.train_plan = TrainPlan.deserialize(data.train_plan_serialized)
self.version = TrainBuild.version
return self
end
return nil
end
return TrainBuild
|
QznnbPlayerInfoCcsPane = class("QznnbPlayerInfoCcsPane")
QznnbPlayerInfoCcsPane.onCreationComplete = function (slot0)
createSetterGetter(slot0, "data", nil, nil, nil, nil, nil, handler(slot0, slot0.onData))
slot0.spProgress:deploy(slot0.controller:getParticlePath("touxianglizi.plist"), 124, 171, 14, 2, 1, true)
slot0.model.isShowingCdChangedSignal:add(slot0.onIsShowingCd, slot0)
slot0.model.playerCdsDicChangedSignal:add(slot0.onPlayerCdChanged, slot0)
slot0:onPlayerCdChanged()
slot0.spBankerEffect:setVisible(false)
slot0:setProgressPlaying(true, 15)
end
QznnbPlayerInfoCcsPane.onIsShowingCd = function (slot0)
DisplayUtil.setVisible(slot0.spProgress, slot0.model:getIsShowingCd())
end
QznnbPlayerInfoCcsPane.onPlayerCdChanged = function (slot0)
if slot0._data and slot0.model:getPlayerCdsDic()[slot0._data.wChairID] then
if not slot1.hasStart then
slot1.hasStart = true
slot0:setProgressPlaying(true, slot1.durationS)
end
return
end
slot0:setProgressPlaying(false)
end
QznnbPlayerInfoCcsPane.setProgressPlaying = function (slot0, slot1, slot2)
slot0.spProgress:setProgressPlaying(slot1 and slot0.model:getIsShowingCd(), slot2)
end
QznnbPlayerInfoCcsPane.onData = function (slot0)
slot0:setVisible(slot0._data ~= nil and slot0._data.cbUserStatus ~= US_FREE)
if slot0._data ~= nil and slot0._data.cbUserStatus ~= US_FREE then
slot0.txtName_tf:setHtmlText(HtmlUtil.createWhiteTxt(slot2, 22))
slot0.txtName_tf:setPositionY(37)
slot0.head:setUserData(slot0._data, true)
slot0:onUserScore()
else
slot0:resetEffect()
end
slot0:onPlayerCdChanged()
end
QznnbPlayerInfoCcsPane.onUserScore = function (slot0)
if slot0._data then
slot1 = gameMgr:getUserData(slot0._data.dwUserID)
slot0.lScore = slot0.lScore or 0
if slot1 and slot1.lScore and slot0.lScore ~= slot1.lScore then
slot3 = (slot1.lScore > 0 and slot1.lScore) or 0
slot0.txtMoney_tf:setHtmlText(HtmlUtil.createColorTxt(MathUtil.cookNumWithHansUnits, "#E5EC8D", 22))
slot0.lScore = slot1.lScore
slot0.controller:setHeadBg(slot0.head, GAME_STATE.BATTLE, slot1.wGender)
slot0.head:setUserData(slot1, true)
end
end
end
QznnbPlayerInfoCcsPane.createRepeatAction = function (slot0, slot1, slot2, slot3, slot4, slot5, slot6)
if slot3 >= 1 then
slot9 = 0.8
return cc.Sequence:create(cc.DelayTime:create((slot3 > 1 and (slot2 + 1) * 0.07 * slot5 * 0.9 - slot1 * 0.07 * slot5 * 0.9) or 0), cc.CallFunc:create(function (slot0)
if slot0 == 0 and slot1 then
slot2:getParent():getParent().layerMask:setVisible(false)
slot2.getParent().getParent().layerMask:playBankerEffect(slot0)
end
end), cc.Sequence:create(cc.FadeIn:create(0.01 * 0.07 * slot5), cc.EaseSineIn:create(cc.FadeOut:create(0.99 * 0.07 * slot5 * 2))), cc.DelayTime:create((slot3 > 1 and slot1 * 0.07 * slot5 * 0.9) or 0), cc.CallFunc:create(function (slot0)
if slot0 == 0 and slot1 then
DisplayUtil.switchParentTo(slot2.spineBanker, )
applyFunction(slot2.spineBanker)
end
end))
else
return cc.FadeOut:create(0)
end
end
QznnbPlayerInfoCcsPane.playBankerRandomEffect = function (slot0, slot1, slot2, slot3, slot4)
slot0.spBankerEffect:setTexture(slot5)
slot0.spBankerEffect:setOpacity(255)
slot0.spBankerEffect:setVisible(true)
slot6 = math.random(1, 2)
DisplayUtil.switchParentTo2(slot0.spBankerEffect, slot0:getParent():getParent().layerWinSpine)
slot0.spBankerEffect:stopAllActions()
slot0.spBankerEffect:runAction(cc.Sequence:create(cc.FadeOut:create(0), slot0:createRepeatAction(slot1, slot2, slot3, slot4, 1.6), slot0:createRepeatAction(slot1, slot2, slot3, slot4, 1.8), slot0:createRepeatAction(slot1, slot2, slot3, slot4, 3.5, true), cc.CallFunc:create(function (slot0)
return
end), cc.DelayTime:create(1.5), cc.CallFunc:create(function (slot0)
slot0:stopBankerEffect(slot0.stopBankerEffect)
end)))
end
QznnbPlayerInfoCcsPane.playBankerEffect = function (slot0, slot1)
if slot0:isVisible() and slot1 == 0 then
slot2, slot3 = slot0.bg:getPosition()
spPoolMgr:put(slot0.spineBanker)
slot0.spineBanker = slot0.controller:createSpineByPool("qznnb_kuangeffect")
slot0.spineBanker:setPosition(slot4)
slot0.spineBanker:setAnimation(0, "animation", true)
slot0:addChild(slot0.spineBanker, 15)
DisplayUtil.switchParentTo(slot0.spineBanker, slot0:getParent():getParent().layerWinSpine)
end
end
QznnbPlayerInfoCcsPane.stopBankerEffect = function (slot0, slot1)
if slot1 == 0 then
spPoolMgr:put(slot0.spineBanker)
end
end
QznnbPlayerInfoCcsPane.resetBankerEffect = function (slot0)
slot0.spBankerEffect:stopAllActions()
spPoolMgr:put(slot0.spineBanker)
slot0.spBankerEffect:setVisible(false)
DisplayUtil.switchParentTo2(slot0.spBankerEffect, slot0)
end
QznnbPlayerInfoCcsPane.resetEffect = function (slot0)
if slot0.spine then
spPoolMgr:put(slot0.spine)
slot0.spine = nil
end
if slot0.animation and not tolua.isnull(spine) then
slot0.animation:removeFromParent()
slot0.animation = nil
end
slot0:resetBankerEffect()
end
QznnbPlayerInfoCcsPane.playWinEffect = function (slot0)
if slot0:isVisible() then
slot0.spine = slot0.controller:createSpineWithEvent("renx", __emptyFunction)
slot0.spine:setPosition(slot1)
slot0:addChild(slot0.spine, 5)
DisplayUtil.switchParentTo(slot0.spine, slot0:getParent():getParent().layerWinSpine)
end
end
QznnbPlayerInfoCcsPane.playMoneyEffect = function (slot0)
if slot0:isVisible() then
slot0.animation = AnimationUtil.createWithSpriteSheet("gameres/module/qznnb/spritesheet/", "spritesheet_anim_gold.plist", 30, 1, __emptyFunction)
slot0.animation:setPosition(cc.p(cc.p(slot0.bg:getPosition()).x, cc.p(slot0.bg.getPosition()).y + 40))
slot0:addChild(slot0.animation, 10)
end
end
QznnbPlayerInfoCcsPane.destroy = function (slot0)
slot0.model.isShowingCdChangedSignal:remove(slot0.onIsShowingCd, slot0)
slot0.model.playerCdsDicChangedSignal:remove(slot0.onPlayerCdChanged, slot0)
slot0:resetEffect()
destroySomeObj(slot0.txtMoney_tf)
destroySomeObj(slot0.txtName_tf)
destroySomeObj(slot0.head)
destroySomeObj(slot0.spProgress)
end
return
|
local vs={}
for i,k in ipairs(KEYS) do
local ov=false
local st=false
local ms=false
local ttl=false
local tp=redis.call('TYPE',k)['ok']
if tp == 'hash' then
st=0
if ARGV[1] == '1' then
ov=redis.call('HMGET',k,_GET_FIELDS_)
else
ov=redis.call('HGETALL',k)
end
elseif tp == 'none' then
st=0
else
st=1
end
if tp == 'hash' or tp == 'none' then
if ARGV[2] == 'EX' then
ttl=redis.call('TTL',k)
elseif ARGV[2] == ('PX') then
ttl=redis.call('PTTL',k)
end
local lt=tonumber(ARGV[3])
ms=redis.call('HMSET',k,_SET_KVS_)['ok']
if lt > 0 and ms == 'OK' then
if ARGV[2] == 'EX' then
redis.call('EXPIRE',k,lt)
else
redis.call('PEXPIRE',k,lt)
end
end
end
vs[i]={ k,st,ov,ttl,ms }
end
return vs
|
local lfs = require "lfs"
local screen_width, screen_height, flags = 1600, 900, { fullscreen = false }
local newFont = function()
return {
getWidth = function() return 10 end,
getHeight = function() return 10 end,
getWrap = function(_, text)
local t={}
for str in string.gmatch(text, "([^:]+)") do
table.insert(t, str)
end
return 10, t
end
}
end
local newImage = function()
return setmetatable({
width = 100,
height = 100,
getWidth = function(self) return self.width end,
getHeight = function(self) return self.height end,
getDimensions = function(self) return self:getWidth(), self:getHeight() end,
}, { __newindex = function() error("Love does not allow this") end })
end
local newQuad = function(x, y, w, h, sw, sh)
return {
getViewport = function()
return x, y, w, h
end,
getTextureDimensions = function()
return sw, sh
end
}
end
local function newAudioClip()
return setmetatable({
_isPlaying = false, _isPaused = false, _isLooping = false,
clone = function() return newAudioClip() end,
isLooping = function(self) return self._isLooping end,
isPaused = function(self) return self._isPaused end,
isPlaying = function(self) return self._isPlaying end,
pause = function(self) self._isPaused = true end,
play = function(self) self._isPlaying = true end,
seek = function() end,
setLooping = function(self) self._isLooping = true end,
setPitch = function() end,
setVolume = function() end,
stop = function(self) self._isPlaying = false end,
}, { __newindex = function() error("Love does not allow this") end })
end
local newParticleSystem = function()
return setmetatable({
setColors = function() end,
setEmissionArea = function() end,
setEmissionRate = function() end,
setLinearAcceleration = function() end,
setParticleLifetime = function() end,
setSizes = function() end,
setSizeVariation = function() end,
setTangentialAcceleration = function() end,
update = function() end,
}, { __newindex = function() error("Love does not allow this") end })
end
local newText = function()
return {
set = function() end,
setf = function() end,
getDimensions = function() return 10, 10 end
}
end
local key_down = {}
local mouse_down = {}
local mouse_x, mouse_y = 0, 0
love = {
audio = {
newSource = function() return newAudioClip() end,
play = function() end,
},
event = {
quit = function() end,
},
getVersion = function() return 11 end,
graphics = {
getDimensions = function() return screen_width, screen_height end,
getFont = function() return newFont() end,
getHeight = function() return screen_height end,
getStats = function() return { } end,
getWidth = function() return screen_width end,
line = function() end,
newCanvas = function() return newImage() end,
newFont = function() return newFont() end,
newParticleSystem = function() return newParticleSystem() end,
newQuad = newQuad,
newImage = newImage,
newText = function() return newText() end,
origin = function() end,
pop = function() end,
print = function() end,
push = function() end,
rectangle = function(mode, x, y, w, h) end,
reset = function() end,
scale = function() end,
setCanvas = function() end,
setColor = function() end,
setFont = function() end,
setLineWidth = function() end,
setScissor = function() end,
translate = function() end,
},
filesystem = {
getDirectoryItems = function(path)
local results = { }
for file in lfs.dir(path) do
if file ~= "." and file ~= ".." then
results[#results + 1] = file
end
end
return results
end,
getInfo = function(path)
local results = { }
local attr = lfs.attributes(path)
if attr then
results.type = attr.mode
else
results = nil
end
return results
end,
read = function(path)
local file = io.open(path, "rb") -- r read mode and b binary mode
if not file then return nil end
local content = file:read "*a" -- *a or *all reads the whole file
file:close()
return content
end
},
keyboard = {
isDown = function(key)
return key_down[key] ~= nil
end
},
math ={
random = function(...) return math.random(...) end
},
mouse = {
getPosition = function()
return mouse_x, mouse_y
end,
isDown = function(button)
return mouse_down[button] ~= nil
end,
},
timer = {
getDelta = function() return 0.03 end,
getFPS = function() return 29 end,
getTime = function() return os.clock() end
},
window = {
getFullscreenModes = function()
return {
{ width = 320, height = 240 },
{ width = 640, height = 480 },
{ width = 800, height = 600 },
}
end,
getMode = function()
return screen_width, screen_height, flags
end,
setMode = function(w, h, fs)
screen_width, screen_height, flags = w, h, fs
end
},
handlers = { }
}
local original_methods = {}
return {
mock = function(tbl, method, replace)
original_methods[tostring(tbl) .. method] = tbl[method]
tbl[method] = replace
end,
reset = function(tbl, method)
if original_methods[tostring(tbl) .. method] then
tbl[method] = original_methods[tostring(tbl) .. method]
end
end,
override_graphics = function(v, r)
love.graphics[v] = r
end,
simulate_key_down = function(key)
key_down[key] = true
end,
simulate_key_up = function(key)
key_down[key] = nil
end,
simulate_button_down = function(button)
mouse_down[button] = true
end,
simulate_button_up = function(button)
mouse_down[button] = nil
end,
moveMouse = function(x, y)
mouse_x, mouse_y = x, y
end,
reset_mouse = function()
mouse_x, mouse_y = 0, 0
mouse_down = {}
end,
reset_keyboard = function()
key_down = {}
end,
newAudioClip = newAudioClip,
newImage = newImage,
newText = newText,
newFont = newFont
}
|
local night_blue = bundle_file('tm_night_blue.moon')
howl.ui.theme.register('Tomorrow Night Blue', night_blue)
local unload = function()
howl.ui.theme.unregister 'Tomorrow Night Blue'
end
return {
info = {
author = 'Tomorrow themes adapted by Nordman <nino at nordman.org>',
description = [[
The Tomorrow themes designed by Chris Kempson.
Adapted for the howl editor by Nils Nordman.
]],
license = 'MIT',
},
unload = unload
}
|
--[[
Going to leave this as my bullshit lua file.
So I can test stuff.
]]
|
--- Client async writer class.
-- @classmod grpc_lua.client.async.ClientAsyncWriter
local ClientAsyncWriter = {}
local c = require("grpc_lua.c") -- from grpc_lua.so
local pb = require("luapbintf")
-------------------------------------------------------------------------------
--- Public functions.
-- @section public
--- Constructor.
-- @param c_stub c.ServiceStub object
-- @string request_name like "/routeguide.RouteGuide/ListFeatures"
-- @string request_type
-- @string response_type
-- @tparam number|nil timeout_sec nil means no timeout
-- @treturn table object
function ClientAsyncWriter:new(c_stub, request_name, request_type,
response_type, timeout_sec)
assert("userdata" == type(c_stub))
assert("string" == type(request_name))
assert("string" == type(request_type))
assert("string" == type(response_type))
local writer = {
-- private:
_c_writer = c.ClientAsyncWriter(c_stub, request_name, timeout_sec),
_request_type = request_type,
_response_type = response_type,
}
setmetatable(writer, self)
self.__index = self
return writer
end -- new()
--- Write message.
-- @table message
-- @treturn boolean return false on error
function ClientAsyncWriter:write(message)
assert("table" == type(message))
local msg_str = pb.encode(self._request_type, message)
self._c_writer:write(msg_str)
end -- write()
--- Wrap close callback.
-- `function(table|nil, error_str, status_code)` ->
-- `function(string|nil, error_str, status_code)`
local function wrap_close_cb(close_cb, response_type)
if not close_cb then return nil end
return function(resp_str, error_str, status_code)
if not resp_str then
close_cb(nil, error_str, status_code)
return
end
assert("string" == type(resp_str))
local resp = pb.decode(response_type, resp_str)
if resp then
close_cb(resp, error_str, status_code)
return
end
-- GRPC_STATUS_INTERNAL = 13
local err = "Failed to decode response " .. response_type
close_cb(nil, err, 13)
end
end -- wrap_close_cb()
--- Async close and get response.
-- @tparam func|nil close_cb close callback function, or nil to ignore response.
-- `function(table|nil, error_str|nil, status_code)`
-- @usage
-- writer:close(
-- function(response, error_str, status_code)
-- assert(not response or "table" == type(response))
-- assert(not error_str or "string" == type(error_str))
-- assert("number" == type(status_code))
-- end)
function ClientAsyncWriter:close(close_cb)
assert(not close_cb or "function" == type(close_cb))
self._c_writer:close(wrap_close_cb(close_cb, self._response_type))
end -- close()
-------------------------------------------------------------------------------
--- Private functions.
-- @section private
return ClientAsyncWriter
|
local CloakThink
local function Cloak(ply, cmd, args)
local targets = FAdmin.FindPlayer(args[1]) or {ply}
for _, target in pairs(targets) do
if not FAdmin.Access.PlayerHasPrivilege(ply, "Cloak", target) then FAdmin.Messages.SendMessage(ply, 5, "No access!") return false end
if IsValid(target) and not target:FAdmin_GetGlobal("FAdmin_cloaked") then
target:FAdmin_SetGlobal("FAdmin_cloaked", true)
target:SetNoDraw(true)
for _, v in ipairs(target:GetWeapons()) do
v:SetNoDraw(true)
end
for _, v in ipairs(ents.FindByClass("physgun_beam")) do
if v:GetParent() == target then
v:SetNoDraw(true)
end
end
hook.Add("Think", "FAdmin_Cloak", CloakThink)
end
end
FAdmin.Messages.ActionMessage(ply, targets, "You have cloaked %s", "You were cloaked by %s", "Cloaked %s")
return true, targets
end
local function UnCloak(ply, cmd, args)
local targets = FAdmin.FindPlayer(args[1]) or {ply}
for _, target in pairs(targets) do
if not FAdmin.Access.PlayerHasPrivilege(ply, "Cloak", target) then FAdmin.Messages.SendMessage(ply, 5, "No access!") return false end
if IsValid(target) and target:FAdmin_GetGlobal("FAdmin_cloaked") then
target:FAdmin_SetGlobal("FAdmin_cloaked", false)
target:SetNoDraw(false)
for _, v in ipairs(target:GetWeapons()) do
v:SetNoDraw(false)
end
for _, v in ipairs(ents.FindByClass("physgun_beam")) do
if v:GetParent() == target then
v:SetNoDraw(false)
end
end
target.FAdmin_CloakWeapon = nil
local RemoveThink = true
for _, v in ipairs(player.GetAll()) do
if v:FAdmin_GetGlobal("FAdmin_cloaked") then
RemoveThink = false
break
end
end
if RemoveThink then hook.Remove("Think", "FAdmin_Cloak") end
end
end
FAdmin.Messages.ActionMessage(ply, targets, "You have uncloaked %s", "You were uncloaked by %s", "Uncloaked %s")
return true, targets
end
FAdmin.StartHooks["Cloak"] = function()
FAdmin.Commands.AddCommand("Cloak", Cloak)
FAdmin.Commands.AddCommand("Uncloak", UnCloak)
FAdmin.Access.AddPrivilege("Cloak", 2)
end
function CloakThink()
for _, v in ipairs(player.GetAll()) do
local ActiveWeapon = v:GetActiveWeapon()
if v:FAdmin_GetGlobal("FAdmin_cloaked") and ActiveWeapon:IsValid() and ActiveWeapon ~= v.FAdmin_CloakWeapon then
v.FAdmin_CloakWeapon = ActiveWeapon
ActiveWeapon:SetNoDraw(true)
if ActiveWeapon:GetClass() == "weapon_physgun" then
for a,b in ipairs(ents.FindByClass("physgun_beam")) do
if b:GetParent() == v then
b:SetNoDraw(true)
end
end
end
end
end
end
|
--- Developer
-- @script Developer
local Developer = {}
setmetatable(Developer, {__index = require("stdlib/data/core")})
local Data = require("stdlib/data/data")
local function make_no_controls()
local controls = {}
for name in pairs(data.raw["autoplace-control"]) do
controls[name] = {size = "none", frequency = "very-low", richness = "very-low"}
end
return controls
end
--- Make entities for easier mod testing.
-- @tparam string name The name of your mod
-- @usage
-- --data.lua
-- local Developer = require('stdlib/data/develper/developer')
-- Developer.make_test_entities("ModName")
function Developer.make_test_entities(name)
if not data.raw["simple-entity"]["debug-chunk-marker"] then
if not name then error("developer chunk markers need mod name") end
Data {
type = "simple-entity",
name = "debug-chunk-marker",
localised_name = "Debug Chunk Markers",
flags = {"placeable-off-grid"},
selectable_in_game = false,
collision_mask = {},
render_layer = "light-effect",
max_health = 200,
pictures =
{
{
filename = "__"..name.."__/stdlib/data/developer/debug-chunk-marker.png",
priority = "extra-high-no-scale",
width = 64,
height = 64,
shift = {0, 0}
},
{
filename = "__"..name.."__/stdlib/data/developer/debug-chunk-marker-horizontal.png",
priority = "extra-high-no-scale",
width = 64,
height = 64,
shift = {0, 0}
},
{
filename = "__"..name.."__/stdlib/data/developer/debug-chunk-marker-vertical.png",
priority = "extra-high-no-scale",
width = 64,
height = 64,
shift = {0, 0}
}
}
}
end
if not data.raw["electric-energy-interface"]["debug-energy-interface"] then
local power = Data.duplicate("electric-energy-interface", "electric-energy-interface", "debug-energy-interface")
power.flags = {"placeable-off-grid"}
power.localised_name = "Debug power source"
power.icon = data.raw["item"]["electric-energy-interface"].icon
power.minable = nil
power.collision_box = nil
power.collision_mask = {}
power.selection_box = {{0.0, -0.5}, {0.5, 0.5}}
power.picture = Developer.empty_picture()
power.vehicle_impact_sound = nil
power.working_sound = nil
data:extend{power}
end
if not data.raw["electric-pole"]["debug-substation"] then
local pole = Data.duplicate("electric-pole", "substation", "debug-substation")
pole.localised_name = "Debug power substation"
pole.flags = {"placeable-off-grid"}
pole.icon = data.raw["item"]["substation"].icon
pole.minable = nil
pole.collision_box = nil
pole.selection_box = {{-0.5, -0.5}, {0.0, 0.5}}
pole.collision_mask = {}
pole.pictures = Developer.empty_pictures()
pole.maximum_wire_distance = 64
pole.supply_area_distance = 64
pole.connection_points = Developer.empty_connection_points(1)
pole.vehicle_impact_sound = nil
pole.working_sound = nil
data:extend{pole}
end
data.raw.tile["lab-dark-1"].map_color = {r=100, g=100, b=100}
data.raw.tile["lab-dark-2"].map_color = {r=50, g=50, b=50}
data.raw["map-gen-presets"]["default"]["debug"] = {
type = "map-gen-presets",
name = "debug",
localised_name = "Debug",
localised_description = "Default settings for a debug world",
order = "z",
basic_settings = {
terrain_segmentation = "very-low",
water = "none",
autoplace_controls = make_no_controls(),
height = 128,
width = 128,
}
}
end
return Developer
|
--[[ Command ]]
CommandManager.Command("ping", function(Args, Payload)
Payload:reply {
embed = {
["title"] = "Pong",
["image"] = {
["url"] = "https://media1.tenor.com/images/6f1d20bb80a1c3f7fbe3ffb80e3bbf4e/tenor.gif"
},
["color"] = Config.EmbedColour
}
}
end):SetCategory("Fun Commands"):SetDescription("Pong.") |
local ElementNode = require("htmlparser/ElementNode.lua")
local voidelements = require("htmlparser/voidelements.lua")
local HtmlParser = {}
local function parse(text)
local index = 0
local root = ElementNode:new(index, text)
local node, descend, tpos, opentags = root, true, 1, {}
while true do
local openstart, name
openstart, tpos, name = string.find(root._text,
"<" .. -- an uncaptured starting "<"
"([%w-]+)" .. -- name = the first word, directly following the "<"
"[^>]*>", -- include, but not capture everything up to the next ">"
tpos)
if not name then break end
index = index + 1
local tag = ElementNode:new(index, name, node, descend, openstart, tpos)
node = tag
local tagst, apos = tag:gettext(), 1
while true do
local start, k, eq, quote, v
start, apos, k, eq, quote = string.find(tagst,
"%s+" .. -- some uncaptured space
"([^%s=/>]+)" .. -- k = an unspaced string up to an optional "=" or the "/" or ">"
"(=?)" .. -- eq = the optional; "=", else ""
"(['\"]?)", -- quote = an optional "'" or '"' following the "=", or ""
apos)
if not k or k == "/>" or k == ">" then break end
if eq == "=" then
local pattern = "=([^%s>]*)"
if quote ~= "" then
pattern = quote .. "([^" .. quote .. "]*)" .. quote
end
start, apos, v = string.find(tagst, pattern, apos)
end
tag:addattribute(k, v or "")
end
if voidelements[string.lower(tag.name)] then
descend = false
tag:close()
else
opentags[tag.name] = opentags[tag.name] or {}
table.insert(opentags[tag.name], tag)
end
local closeend = tpos
while true do
local closestart, closing, closename
closestart, closeend, closing, closename = string.find(root._text, "[^<]*<(/?)([%w-]+)", closeend)
if not closing or closing == "" then break end
tag = table.remove(opentags[closename] or {}) or tag -- kludges for the cases of closing void or non-opened tags
closestart = string.find(root._text, "<", closestart)
tag:close(closestart, closeend + 1)
node = tag.parent
descend = true
end
end
return root
end
HtmlParser.parse = parse
return HtmlParser
|
function createStore(reducer)
local currentReducer = reducer
local currentState = nil
function getState()
return currentState
end
function dispatch(action)
currentState = currentReducer(currentState, action)
return action
end
dispatch({type = '__INIT__'})
return {
getState = getState,
dispatch = dispatch,
}
end
return createStore
|
make_tests(
"general", {
["traits"] = {nil, nil},
["primitive"] = {nil, nil},
})
|
--[[
- SKYNET SIMPLE ( https://github.com/viticm/skynet-simple )
- $Id preload.lua
- @link https://github.com/viticm/skynet-simple for the canonical source repository
- @copyright Copyright (c) 2020 viticm( viticm.ti@gmail.com )
- @license
- @user viticm( viticm.ti@gmail.com )
- @date 2020/11/25 19:56
- @uses The preload script.
--]]
print('preload')
--[[
local lreload = require 'debug.lua_reload'
function lreload.ShouldReload(fileName)
print('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxfile:', fileName)
return true
end
lreload.Inject()
--]]
local lreload = require 'debug.hot_update'
lreload.init(nil, nil, print)
_G.RELOAD = lreload
|
--
-- Copyright 2010-2014 Branimir Karadzic. All rights reserved.
-- License: http://www.opensource.org/licenses/BSD-2-Clause
--
function bgfxProject(_name, _kind, _defines)
project ("bgfx" .. _name)
uuid (os.uuid("bgfx" .. _name))
kind (_kind)
if _kind == "SharedLib" then
defines {
"BGFX_SHARED_LIB_BUILD=1",
}
end
includedirs {
BGFX_DIR .. "../bx/include",
}
defines {
_defines,
}
configuration { "Debug" }
defines {
"BGFX_CONFIG_DEBUG=1",
}
configuration { "android*" }
links {
"EGL",
"GLESv2",
}
configuration { "windows", "not vs201*" }
includedirs {
"$(DXSDK_DIR)/include",
}
configuration { "windows" }
links {
"gdi32",
}
configuration { "xcode4 or osx or ios*" }
files {
BGFX_DIR .. "src/**.mm",
}
configuration { "osx" }
links {
"Cocoa.framework",
}
configuration { "vs* or linux or mingw or xcode4 or osx or ios* or rpi" }
includedirs {
--nacl has GLES2 headers modified...
BGFX_DIR .. "3rdparty/khronos",
}
configuration { "x64", "vs* or mingw" }
defines {
"_WIN32_WINNT=0x601",
}
configuration {}
includedirs {
BGFX_DIR .. "include",
}
files {
BGFX_DIR .. "include/**.h",
BGFX_DIR .. "src/**.cpp",
BGFX_DIR .. "src/**.h",
}
excludes {
BGFX_DIR .. "src/**.bin.h",
}
configuration {}
copyLib()
end
|
local K, C, L = unpack(select(2, ...))
local Module = K:GetModule("Installer")
local _G = _G
local table_wipe = _G.table.wipe
-- local function ForceZygorOptions()
-- if not IsAddOnLoaded("Zygor") then
-- return
-- end
-- if Zygor then
-- table_wipe(Zygor)
-- end
-- end
local function ForceHekiliOptions()
if not IsAddOnLoaded("Hekili") then
return
end
if HekiliDB then
table_wipe(HekiliDB)
end
HekiliDB = {
["profiles"] = {
["KkthnxUI"] = {
["toggles"] = {
["potions"] = {
["value"] = true,
},
["interrupts"] = {
["value"] = true,
["separate"] = true,
},
["cooldowns"] = {
["value"] = true,
["override"] = true,
},
["mode"] = {
["aoe"] = true,
},
["defensives"] = {
["value"] = true,
["separate"] = true,
},
},
["displays"] = {
["AOE"] = {
["rel"] = "CENTER",
["delays"] = {
["font"] = "KkthnxUIFont",
["fontSize"] = 16,
},
["captions"] = {
["fontSize"] = 16,
["font"] = "KkthnxUIFont",
},
["y"] = -231,
["targets"] = {
["font"] = "KkthnxUIFont",
["fontSize"] = 16,
},
["keybindings"] = {
["fontSize"] = 16,
["font"] = "KkthnxUIFont",
},
},
["Primary"] = {
["rel"] = "CENTER",
["delays"] = {
["font"] = "KkthnxUIFont",
["fontSize"] = 16,
},
["captions"] = {
["fontSize"] = 16,
["font"] = "KkthnxUIFont",
},
["y"] = -286,
["targets"] = {
["font"] = "KkthnxUIFont",
["fontSize"] = 16,
},
["keybindings"] = {
["fontSize"] = 16,
["font"] = "KkthnxUIFont",
},
},
["Defensives"] = {
["rel"] = "CENTER",
["delays"] = {
["font"] = "KkthnxUIFont",
["fontSize"] = 16,
},
["captions"] = {
["fontSize"] = 16,
["font"] = "KkthnxUIFont",
},
["y"] = -48,
["x"] = -244,
["targets"] = {
["font"] = "KkthnxUIFont",
["fontSize"] = 16,
},
["keybindings"] = {
["fontSize"] = 16,
["font"] = "KkthnxUIFont",
},
},
["Interrupts"] = {
["rel"] = "CENTER",
["delays"] = {
["font"] = "KkthnxUIFont",
["fontSize"] = 16,
},
["captions"] = {
["fontSize"] = 16,
["font"] = "KkthnxUIFont",
},
["y"] = -48,
["x"] = 244,
["targets"] = {
["font"] = "KkthnxUIFont",
["fontSize"] = 16,
},
["keybindings"] = {
["fontSize"] = 16,
["font"] = "KkthnxUIFont",
},
},
},
},
},
}
KkthnxUIDB.Variables["HekiliRequest"] = false
end
local function ForceMaxDPSOptions()
if not IsAddOnLoaded("MaxDps") then
return
end
if MaxDpsOptions then
table_wipe(MaxDpsOptions)
end
MaxDpsOptions = {
["global"] = {
["customRotations"] = {
},
["customTexture"] = "Interface\\BUTTONS\\CheckButtonHilight-Blue",
["debugMode"] = false,
["disableButtonGlow"] = true,
["disabledInfo"] = true,
["sizeMult"] = 1.8,
["texture"] = "Interface\\Cooldown\\star4",
},
}
KkthnxUIDB.Variables["MaxDpsRequest"] = false
end
-- DBM bars
local function ForceDBMOptions()
if not IsAddOnLoaded("DBM-Core") then
return
end
if DBT_AllPersistentOptions then
table_wipe(DBT_AllPersistentOptions)
end
DBT_AllPersistentOptions = {
["Default"] = {
["DBM"] = {
["Scale"] = 1,
["HugeScale"] = 1,
["ExpandUpwards"] = true,
["ExpandUpwardsLarge"] = true,
["BarXOffset"] = 0,
["BarYOffset"] = 15,
["TimerPoint"] = "LEFT",
["TimerX"] = 122,
["TimerY"] = -300,
["Width"] = 174,
["Height"] = 20,
["HugeWidth"] = 210,
["HugeBarXOffset"] = 0,
["HugeBarYOffset"] = 15,
["HugeTimerPoint"] = "CENTER",
["HugeTimerX"] = 330,
["HugeTimerY"] = -42,
["FontSize"] = 10,
["StartColorR"] = 1,
["StartColorG"] = .7,
["StartColorB"] = 0,
["EndColorR"] = 1,
["EndColorG"] = 0,
["EndColorB"] = 0,
["Texture"] = C["Media"].Statusbars.KkthnxUIStatusbar,
},
},
}
if not _G.DBM_AllSavedOptions["Default"] then
_G.DBM_AllSavedOptions["Default"] = {}
end
_G.DBM_AllSavedOptions["Default"]["WarningY"] = -170
_G.DBM_AllSavedOptions["Default"]["WarningX"] = 0
_G.DBM_AllSavedOptions["Default"]["WarningFontStyle"] = "OUTLINE"
_G.DBM_AllSavedOptions["Default"]["SpecialWarningX"] = 0
_G.DBM_AllSavedOptions["Default"]["SpecialWarningY"] = -260
_G.DBM_AllSavedOptions["Default"]["SpecialWarningFontStyle"] = "OUTLINE"
_G.DBM_AllSavedOptions["Default"]["HideObjectivesFrame"] = false
_G.DBM_AllSavedOptions["Default"]["WarningFontSize"] = 18
_G.DBM_AllSavedOptions["Default"]["SpecialWarningFontSize2"] = 24
KkthnxUIDB.Variables["DBMRequest"] = false
end
-- Skada
local function ForceSkadaOptions()
if not IsAddOnLoaded("Skada") then
return
end
if SkadaDB then
table_wipe(SkadaDB)
end
SkadaDB = {
["hasUpgraded"] = true,
["profiles"] = {
["Default"] = {
["windows"] = {
{ ["barheight"] = 18,
["classicons"] = false,
["barslocked"] = true,
["y"] = 28,
["x"] = -3,
["title"] = {
["color"] = {
["a"] = 0.3,
["b"] = 0,
["g"] = 0,
["r"] = 0,
},
["font"] = "",
["borderthickness"] = 0,
["fontflags"] = "OUTLINE",
["fontsize"] = 14,
["texture"] = "normTex",
},
["barfontflags"] = "OUTLINE",
["point"] = "BOTTOMRIGHT",
["mode"] = "",
["barwidth"] = 300,
["barbgcolor"] = {
["a"] = 0,
["b"] = 0,
["g"] = 0,
["r"] = 0,
},
["barfontsize"] = 14,
["background"] = {
["height"] = 180,
["texture"] = "None",
["bordercolor"] = {
["a"] = 0,
},
},
["bartexture"] = "KKUI_Statusbar",
}, -- [1]
},
["tooltiprows"] = 10,
["setstokeep"] = 30,
["tooltippos"] = "topleft",
["reset"] = {
["instance"] = 3,
["join"] = 1,
},
},
},
}
KkthnxUIDB.Variables["SkadaRequest"] = false
end
local function ForceCursorTrail()
if not IsAddOnLoaded("CursorTrail") then
return
end
if CursorTrail_PlayerConfig then
table_wipe(CursorTrail_PlayerConfig)
end
CursorTrail_PlayerConfig = {
["FadeOut"] = false,
["UserOfsY"] = 0,
["UserShowMouseLook"] = false,
["ModelID"] = 166492,
["UserAlpha"] = 0.9,
["UserOfsX"] = 0.1,
["UserScale"] = 0.4,
["UserShadowAlpha"] = 0,
["UserShowOnlyInCombat"] = false,
["Strata"] = "HIGH",
}
KkthnxUIDB.Variables["CursorTrailRequest"] = false
end
-- BigWigs
local function ForceBigwigs()
if not IsAddOnLoaded("BigWigs") then
return
end
if BigWigs3DB then
table_wipe(BigWigs3DB)
end
BigWigs3DB = {
["namespaces"] = {
["BigWigs_Plugins_Bars"] = {
["profiles"] = {
["Default"] = {
["outline"] = "OUTLINE",
["fontSize"] = 12,
["BigWigsAnchor_y"] = 336,
["BigWigsAnchor_x"] = 16,
["BigWigsAnchor_width"] = 175,
["growup"] = true,
["interceptMouse"] = false,
["barStyle"] = "KKUI_Statusbar",
["LeftButton"] = {
["emphasize"] = false,
},
["font"] = "KKUI_Normal",
["onlyInterceptOnKeypress"] = true,
["emphasizeMultiplier"] = 1,
["BigWigsEmphasizeAnchor_x"] = 810,
["BigWigsEmphasizeAnchor_y"] = 350,
["BigWigsEmphasizeAnchor_width"] = 220,
["emphasizeGrowup"] = true,
},
},
},
["BigWigs_Plugins_Super Emphasize"] = {
["profiles"] = {
["Default"] = {
["fontSize"] = 28,
["font"] = "KKUI_Normal",
},
},
},
["BigWigs_Plugins_Messages"] = {
["profiles"] = {
["Default"] = {
["fontSize"] = 18,
["font"] = "KKUI_Normal",
["BWEmphasizeCountdownMessageAnchor_x"] = 665,
["BWMessageAnchor_x"] = 616,
["BWEmphasizeCountdownMessageAnchor_y"] = 530,
["BWMessageAnchor_y"] = 305,
},
},
},
["BigWigs_Plugins_Proximity"] = {
["profiles"] = {
["Default"] = {
["fontSize"] = 18,
["font"] = "KKUI_Normal",
["posy"] = 346,
["width"] = 140,
["posx"] = 1024,
["height"] = 120,
},
},
},
["BigWigs_Plugins_Alt Power"] = {
["profiles"] = {
["Default"] = {
["posx"] = 1002,
["fontSize"] = 14,
["font"] = "KKUI_Normal",
["fontOutline"] = "OUTLINE",
["posy"] = 490,
},
},
},
},
["profiles"] = {
["Default"] = {
["fakeDBMVersion"] = true,
},
},
}
KkthnxUIDB.Variables["BWRequest"] = false
end
function Module:ForceAddonSkins()
if KkthnxUIDB.Variables["DBMRequest"] then
ForceDBMOptions()
end
if KkthnxUIDB.Variables["SkadaRequest"] then
ForceSkadaOptions()
end
if KkthnxUIDB.Variables["BWRequest"] then
ForceBigwigs()
end
if KkthnxUIDB.Variables["MaxDpsRequest"] then
ForceMaxDPSOptions()
end
if KkthnxUIDB.Variables["CursorTrailRequest"] then
ForceCursorTrail()
end
if KkthnxUIDB.Variables["HekiliRequest"] then
ForceHekiliOptions()
end
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.