content
stringlengths
5
1.05M
require("prototypes.sci.sct-pre-recipe") -- additional item --------------------------- require("prototypes.advanced-plastics") -- ------------------------------------------- require("prototypes.angel-tweak") require("prototypes.game-progress") -- recipe tweak ------------------------------ require("prototypes.recipe.assembler") require("prototypes.recipe.sandclay") require("prototypes.recipe.bobs-electrolysis") require("prototypes.recipe.logistic") require("prototypes.recipe.miner") require("prototypes.recipe.misc") require("prototypes.recipe.angels-machine") require("prototypes.recipe.module") -- ------------------------------------------- require("prototypes.sci.recipe") require("prototypes.sci.sci30recipe") require("prototypes.sci.sci30extreme") require("prototypes.bobextended.bobextended-update") require("prototypes.buff-solar") require("prototypes.expensive") if momoTweak.mods.sct or momoTweak.py.coal then momoTweak.require.SctPreRecipe() end -- recipe science ------------------------------ momoTweak.isLoadScienceRecipeInUpdates = ( not momoTweak.mods.sct ) and ( not momoTweak.py.coal ) if momoTweak.isLoadScienceRecipeInUpdates then momoTweak.require.SciRecipe() momoTweak.require.Sci30Recipe() momoTweak.require.Sci30Extreme() end momoTweak.logisticSciencePackIngredients = momoTweak.get_ingredients(momoTweak.sciLogistic) -- --------------------------------------------- if settings.startup["momo-harder-module"].value then momoTweak.require.RecipeModule() end if momoTweak.settings.isLoadBobExtended then momoTweak.require.ExtendedUpdate() end if (momoTweak.mods.angelBio) then momoTweak.angelBio.Update() end if momoTweak.mods.modularChests then momoTweak.compatibility.modularChests.Recipe() momoTweak.compatibility.modularChests.Technology() end if momoTweak.mods.undergroundPipePack then momoTweak.compatibility.underGroundPipePack.Recipe() end -- still dont support py -- require("pycom.update")
--------------------------------------------------------------------------------------------------- -- --filename: game.mgr.data.RoomData --date:2019/10/17 11:58:22 --author:heguang --desc:管理房间数据 -- --------------------------------------------------------------------------------------------------- local strClassName = 'game.mgr.data.RoomData' local RoomData = lua_declare(strClassName, lua_class(strClassName)) function RoomData:SetRoomID(room_id) self.roomID = room_id self.room_data = cfg_room[room_id] self.mapIds = self.room_data.mapIDs self.currentMapIdx = 1 self.waveIdx = 1 end function RoomData:GetAllMaps() if self.maps == nil then self.maps = {} for i=1,#self.mapIds do local mapId = self.mapIds[i] local map = cfg_map[mapId] if map ~= nil then table.insert(self.maps, map) end end end return self.maps end function RoomData:GetCurrentMap() local mapId = self.mapIds[self.currentMapIdx] return cfg_map[mapId].mapRes end function RoomData:GetMapMonsters() local mapId = self.mapIds[self.currentMapIdx] local waveGroup = cfg_map[mapId].monsterWaveGroup local waveGroups = cfg_map_monster_waves[waveGroup] if waveGroups == nil then return nil end local waveMonster = waveGroups[self.waveIdx] if waveMonster == nil then return nil end return waveMonster end function RoomData:EnterMap(mapId) for i=1,#self.mapIds do if self.mapIds[i] == mapId then self.currentMapIdx = i self.waveIdx = 1 break end end end function RoomData:EnterNextMap() if self.currentMapIdx < #self.mapIds then self.currentMapIdx = self.currentMapIdx + 1 self.waveIdx = 1 return true, self:GetCurrentMap() end return false end return RoomData
--Variable local amount = "666" local remote = game.ReplicatedStorage.introfired --Stats remote:FireServer("Ninjutsu", amount) remote:FireServer("Genjutsu", amount) remote:FireServer("Taijutsu", amount) remote:FireServer("Speed", amount) remote:FireServer("Weapon", amount) remote:FireServer("Strength", amount)
ai = {} --TODO: Use an item (probably split them up based on healing vs attacking) --TODO: Notice items, move towards them and pick them up --TODO: Handle pack animal behavior --TODO: Dedicated decision-making for healing --TODO: Swapping equipment if you find something better --Possible arguments: "noRunning", "forceStupid", "noRanged", "forceWander" ai['basic'] = function(self,args) args = args or {} --If you're not close to the player, just move randomly: if not self:has_ai_flag('stoic') and not self.target and not self:has_ai_flag('playerstalker') and (args.forceWander or calc_distance(self.x,self.y,player.x,player.y) > player.perception*2) then return ai.wander(self,args) end --Handle noticing creatures (and running, for creatures with a minimum distance to maintain) local creats = self:get_seen_creatures() local enemies,defRun = ai.handlenotice(self,creats,args) --Decrease fear, and if you don't see any enemies, decrease alertness. Also decrease memory of seen creatures local fearDec = 1 --base fear decrease by 1 every turn if (enemies == 0) then self.alert = math.max(self.alert - 1,0) --if you can't see any enemies, you alert will decrease by 1 fearDec = fearDec+1 --and your fear will decrease by 2 if self.alert < 1 then fearDec=fearDec+1 --if your "alert" state is over, your fear will be decreased by 3 total end end self.fear = math.max(self.fear - fearDec,0) self:decrease_notice(creats) local fearRun = self:get_fear() > self:get_bravery() --If you're too afraid, run away! if (defRun == true or fearRun == true) and args.noRunning ~= true then return ai.run(self,(fearRun and 'fleeing' or 'defensive'),args) --pass it off to another function, don't deal with that shit here! end --end fear --Handle targeting ai.target(self,args) --Deal with "target's last seen location" value if self.target and self.target.baseType == "creature" then self.lastSeen = {x=self.target.x,y=self.target.y} --this stores the value of the last seen location of target elseif not self.target and self.lastSeen then --so that if you're not able to reach your target, it'll set that location as your new target if self.lastSeen.x == self.x and self.lastSeen.y == self.y then self.lastSeen = nil else self.target = self.lastSeen end end --Ranged attacks/spells: If you have a ranged attack, and are able/willing to attack them if not args.noRanged and self.ranged_chance and random(0,100) <= self.ranged_chance and (args.forceStupid or not self:is_type('intelligent') or currMap:is_passable_for(self.x,self.y,self.pathType,true)) then --I always get confused what this last clause is doing: Basically, don't use a ranged attack if you're standing in a hazardous area, unless you're too stupid to care local finished = ai.rangedAttack(self,args) if finished == true then return true end end --end ranged chance if --If you're next to your target, attack them: if self.target and self.target.baseType == "creature" and self:touching(self.target) and (args.forceStupid or not self:is_type('intelligent') or currMap:is_passable_for(self.x,self.y,self.pathType,true)) and self:attack(self.target) then return true end --If you don't have a target, and you're not mindless, set a random point in the dungeon as your target and start heading there --[[if self.target == nil and self:is_type('mindless') == false then local tX,tY = math.min(math.max(self.x+random(-self.perception,self.perception),2),currMap.width-1),math.min(math.max(self.y+random(-self.perception,self.perception),2),currMap.height-1) if (self:can_move_to(tX,tY) and currMap:findPath(self.x,self.y,tX,tY)) then self.target = {x=tX,y=tY} end --end findPath if end --end random target]] --If you have a target and didn't cast a spell or use a ranged attack, move towards them, if it won't put you too close local moved = ai.moveToTarget(self,args) if moved == true then return true end --If you don't have a target or are too close to your target, just wander around, or cast a "random" spell. Later: head towards suspicious noise? for _, id in ipairs(self:get_spells()) do local spell = possibleSpells[id] if spell.flags['random'] == true and self.cooldowns[id] == nil then --cast friendly spells first local target = spell:decide(self,self,'random') if target == true then target = self.target end if target and target.x and target.y and (not spell.range or math.floor(calc_distance(self.x,self.y,target.x,target.y)) <= spell.range) then --if there's a valid target to the spell within range if spell:use(target,self) then return true end --this is on a seperate line because I want the rest to be skipped if the spell fails for some reason. end --end friendly spell range check end --end random flag check end --end spell for local goX,goY = nil,nil --If you have a master, go towards them if (self.master and calc_distance(self.x,self.y,self.master.x,self.master.y) > tweak(2)) then local path = currMap:findPath(self.x,self.y,self.master.x,self.master.y,self.pathType) if (type(path) == "table" and #path>1) then goX,goY = path[2]['x'],path[2]['y'] end --end if path == table end --end self.master if --Move to a random nearby spot: --Move to a random nearby spot: if not goX or not goY then if not self:has_ai_flag('stoic') then return ai.wander(self,args) end else self:moveTo(goX,goY) end --end goX/goY if end -- end basic ai function --This function causes the creature to randomly wander ai['wander'] = function(self,args) if not self.direction or currMap:is_passable_for(self.x+self.direction.x,self.y+self.direction.y,self.pathType) == false or random(1,5) == 1 then local xMod,yMod = random(-1,1),random(-1,1) local count = 0 while (count < 10) and ((xMod == 0 and yMod == 0) or (currMap:is_passable_for(self.x+xMod,self.y+yMod,self.pathType) == false)) do xMod,yMod = random(-1,1),random(-1,1) count = count+1 end --end while self.direction={x=xMod,y=yMod} end --end self.direction if local goX,goY = self.x+self.direction.x,self.y+self.direction.y self:moveTo(goX,goY) end --This function handles noticing nearby enemies (and running, if this creature has a minimum distance they like to maintain) ai['handlenotice'] = function(self,creats,args) local enemies,defRun = 0,false --First, get all seen creatures. See if enemy creatures are noticed. Go on alert if enemy targets are noticed: for _,creat in pairs(creats) do --Loop through all seen creatures local notice = self:does_notice(creat) local enemy = self:is_enemy(creat) --if you haven't already notice them, see if you notice them: --this is commented out because now the first time a turn you check for whether or not a creature is noticed, it should also run the "do you notice them now" check --[[if notice == false then if self:can_notice(creat) then notice = true end end --end notice if]] --if they're an enemy and you notice them, keep count of enemies and go on alert: if enemy and notice then enemies = enemies+1 if (self.alert < self.memory) then self.alert = self.memory end self.notices[creat] = math.ceil(self.memory/2) end --If you're too close to an enemy for comfort, run away from them: if enemy and self.min_distance and run == false and self:does_notice(creat) and math.floor(calc_distance(self.x,self.y,creat.x,creat.y)) < self.min_distance and (self.run_chance == nil or random(0,100) < self.run_chance) then defRun = true self.fear = self.fear + 2 end --If you notice an enemy, see if you actually become hostile: if self:is_enemy(creat) and random(0,100) <= self:get_aggression() and self:does_notice(creat) and (self.shitlist == nil or self.shitlist[creat] == nil) and (self.ignore_distance == nil or calc_distance(creat.x,creat.y,self.x,self.y) < self.ignore_distance) then self:become_hostile(creat) end --end aggression check end --end for return enemies,defRun end --This function handles targeting ai['target'] = function(self,args) --If you have a master and they have a target, take your master's target if self:has_ai_flag('playerhater') and self:can_sense_creature(player) and self:does_notice(player) then self.target = player elseif self.master and self.master.target then self.target = self.master.target end --If your target no longer makes sense, drop it if self.target and ((self.target == self) or (self.target == self.lastSeen) or -- go ahead and erase this, so that an actual creature could become the next target if one is available (self.target.baseType == "creature" and self.target.hp < 1) or (self.x == self.target.x and self.y == self.target.y) or (not self.target.x or not self.target.y) or (self.target.baseType and currMap.contents[self.target.x][self.target.y][self.target] == nil) or (self.master and self.target.master and self.master == self.target.master) or (self.master and self.target == self.master) or (self.target.baseType == "creature" and (not self:has_ai_flag('stalker') and not self:can_sense_creature(self.target)))) then self.target = nil end if not self.target and self:has_ai_flag('playerstalker') then --for player stalkers, if they don't already have a target, they will head towards the player self.target = player end --If you're next to any (noticed and hostile-towards) enemy, set them as your target, even if you already have one (except for stubborn creatures and player haters): if self.target == nil or (not self:has_ai_flag('stubborn') and not (self:has_ai_flag('playerhater') and self.target == player)) then for x=self.x-1,self.x+1,1 do for y=self.y-1,self.y+1,1 do local creat = currMap:get_tile_creature(x,y) if creat and self.shitlist[creat] and self:does_notice(creat) then self.target = creat end --end enemy if end --end fory end --end forx end --If you have no target and there are nearby enemies, select one if self.target == nil and next(self.shitlist) ~= nil then if self:has_ai_flag('bully') or self:has_ai_flag('giantkiller') then --bullies and giantkillers will select least or most health, respectively local bully = self:has_ai_flag('bully') --assumption: if not bully, then giantkiller local currTar = nil local most = nil local least = nil for creat,_ in pairs(self.shitlist) do local hp = creat.hp if hp > 0 and self:can_sense_creature(creat) and self:does_notice(creat) then if not bully and (most == nil or hp > most) then currTar = creat most = hp end if bully and (least == nil or hp < least) then currTar = creat least = hp end end --end basic can-sense check end --end for if currTar then self.target = currTar end else --everyone else target a random enemy creat = get_random_key(self.shitlist) if creat.hp > 0 and self:can_sense_creature(creat) and self:does_notice(creat) then self.target = creat end end end --end target if end --This function handles moving towards your target ai['moveToTarget'] = function(self,args) if self.target and (self.target.baseType ~= "creature" or self:touching(self.target) == false) and (self.target.baseType ~= "creature" or self.min_distance == nil or math.floor(calc_distance(self.x,self.y,self.target.x,self.target.y)) > self.min_distance) and (self.target.baseType ~= "creature" or self.approach_chance == nil or random(0,100) <= self.approach_chance) and (self.target.baseType ~= "creature" or self:can_sense_creature(self.target) or self:has_ai_flag('stalker') or (self.target == player and self:has_ai_flag('playerstalker'))) then if not args.forceStupid and self:is_type('intelligent') == true and calc_distance(self.x,self.y,self.target.x,self.target.y) <= self:get_perception() then --Intelligent creatures: first, see if you can draw a straight line to your target local path, complete = currMap:get_line(self.x,self.y,self.target.x,self.target.y,self.pathType) if complete and #path >= 1 and currMap:is_passable_for(path[1][1],path[1][2],self.pathType,true) then --if the path completed and it's safe to go to the first location on the path, do it! if self.min_distance == nil or math.floor(calc_distance(self.target.x,self.target.y,path[1][1],path[1][2])) > self.min_distance then --if following the path wouldn't put you too close to your target, do it! self:moveTo(path[1][1],path[1][2]) return true end --end min_distance check else --If the line thing didn't work, make a Dijkstra map (to navigate hazards), and then go: if ai.dijkstra(self,args) then return end end --end line vs Dijkstra map if else --nonintelligent creatures or intelligent creatures out of range local complete = ai.dumbpathfind(self,args) if complete then return true end end --end intelligence check end --end have target/target min distance end --This function handles determining if you use a ranged attack ai['rangedAttack'] = function(self,args) --Try regular ranged attack first: if (self.target and self.target.baseType == "creature" and not self.target:is_type('ghost')) and self:touching(self.target) == false and (self.ranged_attack ~= nil and (rangedAttacks[self.ranged_attack].projectile == false or self:can_shoot_tile(self.target.x,self.target.y)) and rangedAttacks[self.ranged_attack]:use(self.target,self)) then return true end -- Then cast a spell, if possible for _, id in ipairs(self:get_spells()) do local spell = possibleSpells[id] if spell.flags['friendly'] == true and self.cooldowns[id] == nil then --cast friendly spells first local target = spell:decide(self,self,'friendly') if target == true then target = self.target end if target and target.x and target.y and (not spell.range or math.floor(calc_distance(self.x,self.y,target.x,target.y)) <= spell.range) then --if there's a valid target to the spell within range if spell:use(target,self) then return true end --this is on a seperate line because I want the rest to be skipped if the spell fails for some reason. end --end friendly spell range check elseif (self.target and self.target.baseType == "creature" and not self.target:is_type('ghost')) and (spell.flags['aggressive'] == true and self.cooldowns[id] == nil and (not spell.range or math.floor(calc_distance(self.x,self.y,self.target.x,self.target.y)) <= spell.range)) then local target = spell:decide(self.target,self,'aggressive') if target ~= false and (target == nil or target == true or target.x == nil or target.y == nil) then target = self.target end --if for some reason the decide function doesn't return an acceptable target if (target ~= false and spell:use(target,self)) then return true end --end if spell use end --end aggressive/friendly if end --end spell for end --This function handles running away ai['run'] = function(self,runType,args) args = args or {} local sTime = os.clock() runType = runType or "fleeing" if self.ranged_chance and random(0,100) <= self.ranged_chance then -- Cast a defensive/fleeing spell, if possible for _, id in ipairs(self:get_spells()) do local spell = possibleSpells[id] if spell.flags[runType] == true and self.cooldowns[id] == nil then local target = spell:decide(self,self,runType) if target ~= false and (target == nil or target.x == nil or target.y == nil) then target = self.target end --if for some reason the decide function doesn't return an acceptable target if (target ~= false and spell:use(target,self)) then return true end --end if spell use end --end if spell fleeing and no cooldowns end --end spell for end --end ranged chance if --[[local lMap = {} local cW,cH=currMap.width-1,currMap.height-1 local sX,sY,perc = self.x,self.y,self.perception for x=sX-perc,sX+perc,1 do for y=sY-perc,sY+perc,1 do if (x>1 and y>1 and x<cW and y<cH) then if (lMap[x] == nil) then lMap[x] = {} end local creat = currMap:get_tile_creature(x,y) if (creat == false and self:can_move_to(x,y) == false) then lMap[x][y] = false elseif creat and self:is_enemy(creat) then lMap[x][y] = 0 else lMap[x][y] = 10 end end --end range check end --end yfor end --end xfor local changed = true while (changed) do changed = false for x=sX-perc,sX+perc,1 do for y=sY-perc,sY+perc,1 do if (lMap[x] and lMap[x][y]) then local min = nil for ix=x-1,x+1,1 do for iy=y-1,y+1,1 do if (ix>1 and iy>1 and ix<cW and iy<cH and lMap[ix] and lMap[ix][iy]) and (min == nil or lMap[ix][iy] < min) then min = lMap[ix][iy] end --end min if end --end yfor end --end xfor if (min and min+2 < lMap[x][y]) then lMap[x][y] = min+1 changed = true end end --end tile check end --end yfor end --end xfor end -- end while]] local lMap = self:make_fear_map() local largest = nil local largestX,largestY = nil,nil for x=self.x-1,self.x+1,1 do for y=self.y-1,self.y+1,1 do if lMap[x] and lMap[x][y] and (largest == nil or lMap[x][y] > largest) and self:can_move_to(x,y) then largest = lMap[x][y] largestX,largestY = x,y end --end if end --end fory end --end forx if largest then self:moveTo(largestX,largestY) else --nowhere to run! args.noRunning = true ai.basic(self,args) end --output:out("Time to calc fear map: " .. tostring(os.clock()-sTime)) end --and AI run --This function pathfinds to an enemy, ignoring hazards ai['dijkstra'] = function(self,args) local sTime = os.clock() local lMap = {} local hazards = {} local cW,cH=currMap.width-1,currMap.height-1 local sX,sY,perc = self.x,self.y,self:get_perception() for x=sX-perc,sX+perc,1 do for y=sY-perc,sY+perc,1 do if (x>1 and y>1 and x<cW and y<cH) then if (lMap[x] == nil) then lMap[x] = {} end local creat = currMap:get_tile_creature(x,y) if (creat == false and self:can_move_to(x,y) == false) then lMap[x][y] = false elseif creat and self:is_enemy(creat) then lMap[x][y] = 0 elseif creat then lMap[x][y] = false -- if there's a creature who's not an enemy, you can't move there else lMap[x][y] = 10 end --Add hazard score: if hazards[x] == nil then hazards[x] = {} end hazards[x][y] = 0 if type(currMap[x][y]) == "table" then --if the tile is hazardous, add hazard score tile = currMap[x][y] if tile.hazard and tile:is_hazardous_for(ctype) then hazards[x][y] = hazards[x][y] + tile.hazard/10 end end --end tile hazard if for _,feat in pairs(currMap:get_tile_features(x,y)) do if feat.hazard and feat:is_hazardous_for(ctype) then hazards[x][y] = hazards[x][y] + feat.hazard/10 end end --end feature for for _, eff in pairs(currMap:get_tile_effects(x,y)) do if eff.hazard and eff:is_hazardous_for(ctype) then hazards[x][y] = hazards[x][y] + eff.hazard/10 end end end --end range check end --end yfor end --end xfor local changed = true while (changed) do changed = false for x=sX-perc,sX+perc,1 do for y=sY-perc,sY+perc,1 do if (lMap[x] and lMap[x][y]) then local min = nil --look at the tiles next to this tile, and set the score of this tile to be 1 higher than the lowest score of any neighbors for ix=x-1,x+1,1 do for iy=y-1,y+1,1 do if (ix>1 and iy>1 and ix<cW and iy<cH and lMap[ix] and lMap[ix][iy]) and (min == nil or lMap[ix][iy] < min) then min = lMap[ix][iy] end --end min if end --end yfor end --end xfor if (min and min+2 < lMap[x][y]-hazards[x][y]) then lMap[x][y] = min+1+hazards[x][y] changed = true end --end min check end --end tile check end --end yfor end --end xfor end -- end while --Figure out what the smallest value is: local smallest = nil local smallestX,smallestY = nil,nil local ctype = self.pathType for x=self.x-1,self.x+1,1 do for y=self.y-1,self.y+1,1 do if lMap[x] and lMap[x][y] then if (smallest == nil or lMap[x][y] < smallest or (lMap[x][y] == smallest and random(1,2) == 1)) and self:can_move_to(x,y) then smallest = lMap[x][y] smallestX,smallestY = x,y end --end largest if if smallest == 1 then break end end --end if map exists if end --end fory end --end forx if smallest then self:moveTo(smallestX,smallestY) return true end return false end --This function handles pathfinding to an enemy, not avoiding hazards ai['dumbpathfind'] = function(self,args) --Just dumbly walk in a straight line to your target, if possible. If not, pathfind. local path, complete = currMap:get_line(self.x,self.y,self.target.x,self.target.y) local creat = (path[1] and currMap:get_tile_creature(path[1][1],path[1][2]) or false) --is there a creature if (path[1] and path[#path]) and (complete or self:can_move_to(path[#path][1],path[#path][2])) and self:can_move_to(path[1][1],path[1][2]) then --if the path completed, or was blocked due to a dangerous feature, who cares, keep going if you can if self.min_distance == nil or math.floor(calc_distance(self.target.x,self.target.y,path[1][1],path[1][2])) > self.min_distance then --if it doesn't put you too close to your target self:moveTo(path[1][1],path[1][2]) return true end --end min_distance check elseif complete == false and creat then -- if the first tile in the path is blocked by a creature if self:is_enemy(creat) then --if it's an enemy, attack them self:attack(creat) return true else --if the blocking creature is not an enemy, move around them local dist = calc_distance(self.x,self.y,self.target.x,self.target.y) --how far you are already local xDir,yDir = (random(1,2) == 1 and 1 or -1),(random(1,2) == 1 and 1 or -1) --pick random starting direction, so the creatures don't always start at the upper left or whatever for x=self.x-xDir,self.x+xDir,xDir do for y=self.y-yDir,self.y+yDir,yDir do if calc_distance(x,y,self.target.x,self.target.y) < dist and self:can_move_to(x,y) then -- just move to the first open square you check that's closer self:moveTo(x,y) return true end --end calc_dist if end --end fory end --end forx end --end block creature ifs else --if the straight line won't work, do pathfinding --if (self.target.baseType == "creature" and self.target ~= player) then currMap:set_blocked(self.target.x,self.target.y,0) end local path = currMap:findPath(self.x,self.y,self.target.x,self.target.y,self.pathType) --if (self.target.baseType == "creature" and self.target ~= player) then currMap:set_blocked(self.target.x,self.target.y,1) end if type(path) == "table" and #path>1 then if self.min_distance == nil or math.floor(calc_distance(self.target.x,self.target.y,path[2]['x'],path[2]['y'])) > self.min_distance then self:moveTo(path[2]['x'],path[2]['y']) return true end --end min_distance check else --can't path there? if (self.target.baseType == "creature") then if debugMode then output:out(self:get_name() .. " unable to path to " .. self.target:get_name()) end else if debugMode then output:out(self:get_name() .. " unable to path to " .. self.target.x .. ", " .. self.target.y) end end --end target type if self.target = nil end--end if path == table end --end line vs path if end --Special AI: ai['enemypossessor'] = function(self,args) --First things first: If you're standing on a corpse, possess it! local corpse = currMap:tile_has_feature(self.x,self.y,"corpse") if corpse then return possibleSpells['enemypossession']:cast(corpse,self) end --Are you standing next to a possessable, non-player creature? Possess it! for x=self.x-1,self.x+1,1 do for y=self.y-1,self.y+1,1 do local creat = currMap:get_tile_creature(x,y) if creat and creat ~= player and creat:get_possession_chance() > 0 then return possibleSpells['enemypossession']:cast(creat,self) end --end if creat end --end fory end --end forx --Otherwise, move using custom dijkstra map local sTime = os.clock() local lMap = {} local hazards = {} local cW,cH=currMap.width-1,currMap.height-1 local sX,sY,perc = self.x,self.y,self:get_perception() for x=sX-perc,sX+perc,1 do for y=sY-perc,sY+perc,1 do if (x>1 and y>1 and x<cW and y<cH) then if (lMap[x] == nil) then lMap[x] = {} end local creat = currMap:get_tile_creature(x,y) local corpse = currMap:tile_has_feature(x,y,"corpse") if (creat == false and self:can_move_to(x,y) == false) then lMap[x][y] = false elseif creat and creat ~= player and creat ~= self then lMap[x][y] = 0 --creatures are potential targets elseif corpse then lMap[x][y] = 0 --corpses are potential target else lMap[x][y] = 10 end end --end range check end --end yfor end --end xfor local changed = true while (changed) do changed = false for x=sX-perc,sX+perc,1 do for y=sY-perc,sY+perc,1 do if (lMap[x] and lMap[x][y]) then local min = nil --look at the tiles next to this tile, and set the score of this tile to be 1 higher than the lowest score of any neighbors for ix=x-1,x+1,1 do for iy=y-1,y+1,1 do if (ix>1 and iy>1 and ix<cW and iy<cH and lMap[ix] and lMap[ix][iy]) and (min == nil or lMap[ix][iy] < min) then min = lMap[ix][iy] end --end min if end --end yfor end --end xfor if (min and min+2 < lMap[x][y]) then lMap[x][y] = min+1 changed = true end --end min check end --end tile check end --end yfor end --end xfor end -- end while --Figure out what the smallest value is: local smallest = nil local smallestX,smallestY = nil,nil local ctype = self.pathType for x=self.x-1,self.x+1,1 do for y=self.y-1,self.y+1,1 do if lMap[x] and lMap[x][y] then local val = lMap[x][y]+(lMap[x][y] == 0 and 0 or math.max(6-calc_distance(x,y,player.x,player.y),0)) if (smallest == nil or val < smallest or (val == smallest and random(1,2) == 1)) and not player:touching({x=x,y=y}) and self:can_move_to(x,y) then smallest = val smallestX,smallestY = x,y end --end largest if if smallest == 0 then break end end --end if map exists if end --end fory end --end forx --currMap.lMap = lMap if smallest then self:moveTo(smallestX,smallestY) return true end --This should only fire if the ghost is trapped: if not self.cooldowns['blink'] then possibleSpells['blink']:cast(self,self) end end --[[ai['basicold'] = function(creature) -- Next to allied creature? attack them instead for x=creature.x-1,creature.x+1,1 do for y=creature.y-1,creature.y+1,1 do local creat = currMap:get_tile_creature(x,y) if creat and creat.ai == "ally" then creature:attack(creat) return true end end end if (creature:can_see_tile(player.x,player.y) and calc_distance(creature.x,creature.y,player.x,player.y) <= creature.aggression) then -- can you see the player? -- First commit the player to memory (trying to be more complicated than we are ;) if (creature.alert == 0) then if (player:can_see_tile(creature.x,creature.y)) then output:out(creature:get_name() .. " notices you!") currMap:add_effect(Effect('dmgpopup'),creature.x,creature.y) end creature.alert = creature.aggression end creature.lastSawPlayer.x = player.x creature.lastSawPlayer.y = player.y -- cast a spell, if possible for _, id in ipairs(creature.spells) do local spell = possibleSpells[id] if (spell.aggressive == true and creature.cooldowns[id] == nil and player.name ~= "ghost") then if (spell:use(player,creature) == true) then return true end end end -- head to player local path = currMap:findPath(creature.x,creature.y,player.x,player.y) if (type(path) == "table") then creature:moveTo(path[2]['x'],path[2]['y']) end else -- can't see player if (creature.lastSawPlayer.x ~= nil and creature.alert > 0) then -- if you recently saw the player creature.alert = creature.alert - 1 -- calm down if (creature.lastSawPlayer.x == creature.x and creature.lastSawPlayer.y == creature.y or creature.alert == 0) then --reached last seen player location? -- reset "last seen" counters creature.lastSawPlayer.x = nil creature.lastSawPlayer.y = nil else --haven't reached last seen location? local path = currMap:findPath(creature.x,creature.y,creature.lastSawPlayer.x,creature.lastSawPlayer.y) if (type(path) == "table") then creature:moveTo(path[2]['x'],path[2]['y']) end end else -- can't see player now, haven't seen player recently, do a random move if (creature.alert > 0) then creature.alert = creature.alert - 1 -- calm down end local direction = random(1,5) if (direction == 1) then creature:moveTo(creature.x,creature.y-1) elseif (direction == 2) then creature:moveTo(creature.x+1,creature.y) elseif (direction == 3) then creature:moveTo(creature.x,creature.y+1) elseif (direction == 4) then creature:moveTo(creature.x-1,creature.y) end end end end ai['ally'] = function(self) if (target and target.hp > 0) then self.target = target end -- if the player has a target, take it as your own -- Next to unallied creature? attack them for x=self.x-1,self.x+1,1 do for y=self.y-1,self.y+1,1 do local creat = currMap:get_tile_creature(x,y) if creat and creat.ai ~= "ally" and creat ~= player then self:attack(creat) return true end end end if (self.target) then --if you already have a target, move towards them if (self.target == player or (self:can_see_tile(self.target.x,self.target.y) == false and player:can_see_tile(self.target.x,self.target.y) == false) or self.target.hp < 1) then -- if you can't see them or they're dead, clear it all and start over self.target = nil elseif (self:touching(self.target)) then --if you're next to them, attack them! self:attack(self.target) else currMap.pathfinder.grid.map[self.target.y][self.target.x] = 0 local path = currMap:findPath(self.x,self.y,self.target.x,self.target.y) -- move towards them if (type(path) == "table") then self:moveTo(path[2]['x'],path[2]['y']) end currMap.pathfinder.grid.map[self.target.y][self.target.x] = 1 end else -- if there's no target -- find one -- if none's found, walk to player local path = currMap:findPath(self.x,self.y,player.x,player.y) if (type(path) == "table") then self:moveTo(path[2]['x'],path[2]['y']) end end end]]
-- RP Tags -- by Oraibi, Moon Guard (US) server -- This work is licensed under the Creative Commons Attribution 4.0 International -- (CC BY 4.0) license. local RPTAGS = RPTAGS; RPTAGS.queue:WaitUntil("UTILS_COLOR", function(self, event, ...) RPTAGS.utils = RPTAGS.utils or {}; RPTAGS.utils.color = RPTAGS.utils.color or {}; local LibColor = LibStub("LibColorManipulation-1.0"); local Utils = RPTAGS.utils; local Color = Utils.color; local Config = Utils.config; local isnum = Utils.text.isnum; local function hsvToRgb(h, s, v) return LibColor.convert("rgb", "hsv", h, s, v, 1) end; local function hslToRgb(h, s, L) return LibColor.convert("rgb", "hsl", h, s, L, 1) end; local function rgbToHsl(r, g, b) return LibColor.convert("hsl", "rgb", r, g, b, 1) end; local function rgbToHsv(r, g, b) return LibColor.convert("hsv", "rgb", r, g, b, 1) end; -- returns a hue value (for HSV color) based on the values of three numbers local function redToGreenHue(value, lowValue, highValue, optionalInvert) local GREEN = 120; -- degrees for the starting color of green in HSV -- these normalize the values so we don't get weird range errors if lowValue > highValue then local tempValue = highValue; highValue = lowValue; lowValue = tempValue; end; if value > highValue then value = highValue; end; if value < lowValue then value = lowValue; end; local width = highValue - lowValue; if width == 0 then width = 1;end; -- because we divide by width below local valuePos = value - lowValue; -- position within width local valueFraction = valuePos / width; -- fractional distance through width if not optionalInvert then return (GREEN/360) * valueFraction; else return (GREEN/360) - (GREEN/360) * valueFraction; end; -- if end; -- function to take two values and return either COLOR_LESSTHAN, COLOR_GREATERTHAN, or COLOR_EQUALISH local function compareColor(firstValue, secondValue, isExact) if not isnum(firstValue) or not isnum(secondValue) then return ""; end; -- don't change the color local sum = math.abs(firstValue) + math.abs(secondValue); local sigma = sum * 0.05; if not isExact then sigma = sigma *2; end; if math.abs(firstValue - secondValue) < sigma then return "|cff" .. Config.get("COLOR_EQUALISH"); elseif firstValue - secondValue > 0 then return "|cff" .. Config.get("COLOR_LESSTHAN"); else return "|cff" .. Config.get("COLOR_GREATERTHAN"); end; -- if end; local function integerToHex(number) return string.format("%02", math.floor(number)); end; local function colorCode(r, g, b) return string.format("|cff%02x%02x%02x", r, g, b); end; local function integersToColor(r, g, b) return string.format("%02x%02x%02x", r, g, b); end; local function decimalsToColor(r, g, b) return string.format("%02x%02x%02x", math.min(255, math.floor(r * 255)), math.min(255, math.floor(g * 255)), math.min(255, math.floor(b * 255))); end; local function rgbToIntegers(rgb) if rgb:len() == 0 then return nil end; rgb = rgb:gsub("^|cff",""):gsub("^#",""); -- just in case if not rgb:match("^%x%x%x%x%x%x$") then return nil end; return tonumber(rgb:sub(1, 2), 16), tonumber(rgb:sub(3, 4), 16), tonumber(rgb:sub(5, 6), 16); -- 16 = base 16 (hexadecimal) end; -- function local function colorToDecimals(rgb) local r, g, b = rgbToIntegers(rgb); if not r then return nil; else return r/255, g/255, b/255, 1; end; end; -- Utilities available via RPTAGS.utils.color -- Color.colorCode = colorCode; -- replace Color.compare = compareColor; Color.numberToHexa = integerToHex; Color.redToGreenHue = redToGreenHue; Color.hexaToNumber = rgbToIntegers; Color.integersToColor = integersToColor; Color.decimalsToColor = decimalsToColor; Color.colorToDecimals = colorToDecimals; Color.hsvToRgb = hsvToRgb; Color.hslToRgb = hslToRgb; Color.rgbToHsl = rgbToHsl; Color.rgbToHsv = rgbToHsv; end);
--[[ TheNexusAvenger Implementation of a command. --]] local BaseCommand = require(script.Parent.Parent:WaitForChild("BaseCommand")) local ScrollingTextWindow = require(script.Parent.Parent:WaitForChild("Resources"):WaitForChild("ScrollingTextWindow")) local Command = BaseCommand:Extend() --[[ Creates the command. --]] function Command:__new() self:InitializeSuper("usage","Administrative","Displays the usage information of Nexus Admin.") self.Prefix = {"!",self.API.Configuration.CommandPrefix} end --[[ Runs the command. --]] function Command:Run(CommandContext) self.super:Run(CommandContext) --Display the text window. local Window = ScrollingTextWindow.new(true) Window.Title = "About" Window.GetTextLines = function(_) return { "Welcome to Nexus Admin (by TheNexusAvenger).", "Built on Cmdr (by evaera)", self.API.Configuration.Version, "", "View commands using !cmds or :cmds.", "Use \\ to open the Cmdr command line.", "Prefixes are only needed for the chat.", "", "Cmdr information: https://eryn.io/Cmdr/", "Nexus Admin information: https://github.com/thenexusavenger/nexus-admin", } end Window:Show() end return Command
local surface_SetDrawColor = surface.SetDrawColor local surface_DrawTexturedRect = surface.DrawTexturedRect local surface_DrawRect = surface.DrawRect local surface_SetMaterial = surface.SetMaterial local gU = Material("vgui/gradient_up") local gD = Material("vgui/gradient_down") local gR = Material("vgui/gradient-r") local gL = Material("vgui/gradient-l") local function GDN(mat, x, y, w, h, col) surface_SetDrawColor(col) surface_DrawRect(x,y,w,h) surface_SetMaterial(mat) if mat == gU then mat = gU elseif mat == gD then mat = gD elseif mat == gR then mat = gR elseif mat == gL then mat = gL end surface_SetDrawColor(col.r - 45,col.g - 45,col.b - 45) surface_DrawTexturedRect(x,y,w,h) end
require("compiler-ssr/src") require("compiler-ssr/__tests__/utils") describe('ssr: text', function() test('static text', function() expect(getCompiledString()):toMatchInlineSnapshot() end ) test('static text with template string special chars', function() expect(getCompiledString()):toMatchInlineSnapshot() end ) test('static text with char escape', function() expect(getCompiledString()):toMatchInlineSnapshot() end ) test('comments', function() expect(getCompiledString()):toMatchInlineSnapshot() end ) test('static text escape', function() expect(getCompiledString()):toMatchInlineSnapshot() end ) test('nested elements with static text', function() expect(getCompiledString()):toMatchInlineSnapshot() end ) test('interpolation', function() expect(compile().code):toMatchInlineSnapshot() end ) test('nested elements with interpolation', function() expect(compile().code):toMatchInlineSnapshot() end ) end )
project "CEGUIDirect3D9Renderer" language "C++" kind "SharedLib" targetname "CEGUIDirect3D9Renderer" targetdir(buildpath("mta")) includedirs { "../../include", "../../../freetype/include", "../../dependencies/pcre-8.12" } links { "CEGUI-0.8.7", "freetype", "pcre-8.12", "dbghelp", "winmm", "d3d9", } defines { "CEGUIDIRECT3D9RENDERER_EXPORTS", "_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING" } vpaths { ["Headers/*"] = "../../include/CEGUI/RendererModules/Direct3D9/**.h", ["Sources/*"] = "**.cpp", ["Sources/*"] = "**.c", ["*"] = "premake5.lua" } files { "premake5.lua", "**.cpp", "**.c", "../../include/CEGUI/RendererModules/Direct3D9/**.h", } filter "architecture:x64" flags { "ExcludeFromBuild" } filter "system:not windows" flags { "ExcludeFromBuild" } filter {"system:windows"} linkoptions { "/ignore:4221" } disablewarnings { "4221" } configuration "Debug" links { "d3dx9d" } configuration "Release" links { "d3dx9" } configuration {}
module("shadows.Star", package.seeall) Shadows = require("shadows") Light = require("shadows.Light") Transform = require("shadows.Transform") Star = setmetatable( {}, Light ) Star.__index = Star Star.__type = "Star" Star.Star = true Star.Blur = true halfPi = math.pi * 0.5 function Star:new(World, Radius) -- Class constructor if World and Radius then local self = setmetatable({}, Star) local Width, Height = World.Canvas:getDimensions() self.Transform = Transform:new() self.Transform:SetLocalPosition(0, 0, 1) self.Transform.Object = self self.Radius = Radius self.Width = Width self.Height = Height self.Canvas = love.graphics.newCanvas( Width, Height ) self.ShadowCanvas = love.graphics.newCanvas( Width, Height ) self.Shapes = {} World:AddStar(self) return self end end function Star:GetCanvasCenter() local x, y, z = self.Transform:GetPosition() local wx, wy, wz = self.World:GetPosition() return ( x - wx ) * wz, ( y - wy ) * wz, z * wz end function Star:Update() if self.Transform.HasChanged then self.Transform.HasChanged = false self.Changed = true end if self.Changed or self.World.Changed or self.World.UpdateStars then local x, y, z = self.Transform:GetPosition() local wx, wy, wz = self.World:GetPosition() -- Generate new content for the shadow canvas love.graphics.setCanvas(self.ShadowCanvas) love.graphics.setShader() love.graphics.clear(255, 255, 255, 255) -- Move all the objects so that their position are corrected love.graphics.origin() love.graphics.translate(-wx * wz, -wy * wz) love.graphics.scale(wz, wz) self:GenerateDarkness(x, y, z) -- Draw custom shadows love.graphics.setBlendMode("subtract", "alphamultiply") love.graphics.setColor(1, 1, 1, 1) self.World:DrawShadows(self) -- Draw the sprites so that shadows don't cover them love.graphics.setShader(Shadows.ShapeShader) love.graphics.setBlendMode("add", "alphamultiply") love.graphics.setColor(1, 1, 1, 1) self.World:DrawSprites(self) -- Now stop using the shadow canvas and generate the light love.graphics.setCanvas(self.Canvas) love.graphics.setShader() love.graphics.clear() love.graphics.origin() --love.graphics.translate((x - wx - self.Radius) * wz, (y - wy - self.Radius) * wz) if self.Image then -- If there's a image to be used as light texture, use it love.graphics.setBlendMode("lighten", "premultiplied") love.graphics.setColor(self.R / 255, self.G / 255, self.B / 255, self.A / 255) love.graphics.draw(self.Image, self.Radius * wz, self.Radius * wz) else -- Use a shader to generate the light Shadows.LightShader:send("Radius", self.Radius * wz) Shadows.LightShader:send("Center", { self:GetCanvasCenter() }) -- Calculate the rotation of the light local Arc = math.rad(self.Arc * 0.5) local Angle = self.Transform:GetRadians(-halfPi) -- Set the light shader love.graphics.setShader(Shadows.LightShader) love.graphics.setBlendMode("alpha", "premultiplied") -- Filling it with a arc is more efficient than with a rectangle for this case love.graphics.setColor(self.R / 255, self.G / 255, self.B / 255, self.A / 255) love.graphics.rectangle("fill", 0, 0, self.Width, self.Height) -- Unset the shader love.graphics.setShader() end if self.Blur then -- Generate a radial blur (to make the light softer) love.graphics.origin() love.graphics.setShader(Shadows.RadialBlurShader) Shadows.RadialBlurShader:send("Size", { self.Canvas:getDimensions() }) Shadows.RadialBlurShader:send("Position", { self:GetCanvasCenter() }) Shadows.RadialBlurShader:send("Radius", self.Radius * wz) end -- Draw the shadow shapes over the canvas love.graphics.setBlendMode("multiply", "premultiplied") love.graphics.draw(self.ShadowCanvas, 0, 0) -- Reset the blending mode love.graphics.setBlendMode("alpha", "alphamultiply") love.graphics.setShader() -- Tell the world it needs to update it's canvas self.Changed = nil self.World.UpdateCanvas = true end end function Star:Resize(Width, Height) local w, h = self.Canvas:getDimensions() if Width ~= w or Height ~= h then self.Width = Width self.Height = Height self.Canvas = love.graphics.newCanvas(Width, Height) self.ShadowCanvas = love.graphics.newCanvas(Width, Height) self.Changed = true end end function Star:Remove() self.World.Stars[self.ID] = nil self.World.Changed = true self.Transform:SetParent(nil) end return Star
includeexternal ("../function.lua") create_console_project("020_Real-time Approximation to Large Convolution Kernel")
-- Atlas configuration -- -- This is the implementation of the configuration interface -- and should be considered private API. local luv = require "luv" local default_config = require "atlas.default_config" local Configuration = {} Configuration.__index = Configuration local function _init(_, user_config) local self = setmetatable({}, Configuration) -- Shallow copy the defaults. for config_key, config_value in pairs(default_config) do self[config_key] = config_value end self.has_user_config = false if user_config then -- Merge. for user_key, user_value in pairs(user_config) do self[user_key] = user_value end self.has_user_config = true end if self.log_file ~= "" then self.log_file_fd = luv.fs_open(self.log_file, "w", 0666) else self.log_file_fd = 1 -- stdout end return self end setmetatable(Configuration, {__call = _init}) return Configuration
local test_env = require("test/test_environment") local lfs = require("lfs") local run = test_env.run local testing_paths = test_env.testing_paths local env_variables = test_env.env_variables describe("Basic tests #blackbox #b_util", function() before_each(function() test_env.setup_specs() end) it("LuaRocks version", function() assert.is_true(run.luarocks_bool("--version")) end) it("LuaRocks unknown command", function() assert.is_false(run.luarocks_bool("unknown_command")) end) it("LuaRocks arguments fail", function() assert.is_false(run.luarocks_bool("--porcelain=invalid")) assert.is_false(run.luarocks_bool("--invalid-flag")) assert.is_false(run.luarocks_bool("--server")) assert.is_false(run.luarocks_bool("--server --porcelain")) assert.is_false(run.luarocks_bool("--invalid-flag=abc")) assert.is_false(run.luarocks_bool("invalid=5")) end) it("LuaRocks execute from not existing directory #unix", function() local main_path = lfs.currentdir() assert.is_true(lfs.mkdir("idontexist")) assert.is_true(lfs.chdir("idontexist")) local delete_path = lfs.currentdir() assert.is_true(os.remove(delete_path)) local output = run.luarocks("") assert.is.falsy(output:find("LuaRocks scm, a module deployment system for Lua")) assert.is_true(lfs.chdir(main_path)) output = run.luarocks("") assert.is.truthy(output:find("LuaRocks scm, a module deployment system for Lua")) end) it("LuaRocks timeout", function() assert.is.truthy(run.luarocks("--timeout=10")) end) it("LuaRocks timeout invalid", function() assert.is_false(run.luarocks_bool("--timeout=abc")) end) it("LuaRocks only server=testing", function() assert.is.truthy(run.luarocks("--only-server=testing")) end) it("LuaRocks test site config", function() assert.is.truthy(os.rename("src/luarocks/site_config.lua", "src/luarocks/site_config.lua.tmp")) assert.is.falsy(lfs.attributes("src/luarocks/site_config.lua")) assert.is.truthy(lfs.attributes("src/luarocks/site_config.lua.tmp")) assert.is.truthy(run.luarocks("")) assert.is.truthy(os.rename("src/luarocks/site_config.lua.tmp", "src/luarocks/site_config.lua")) assert.is.falsy(lfs.attributes("src/luarocks/site_config.lua.tmp")) assert.is.truthy(lfs.attributes("src/luarocks/site_config.lua")) end) -- Disable versioned config temporarily, because it always takes -- precedence over config.lua (config-5.x.lua is installed by default on Windows, -- but not on Unix, so on Unix the os.rename commands below will fail silently, but this is harmless) describe("LuaRocks config - more complex tests", function() local scdir = testing_paths.testing_lrprefix .. "/etc/luarocks" local versioned_scname = scdir .. "/config-" .. env_variables.LUA_VERSION .. ".lua" local scname = scdir .. "/config.lua" local configfile if test_env.TEST_TARGET_OS == "windows" then configfile = versioned_scname else configfile = scname end it("LuaRocks fail system config", function() os.rename(versioned_scname, versioned_scname .. "bak") local ok = run.luarocks_bool("config --system-config") os.rename(versioned_scname .. ".bak", versioned_scname) assert.is_false(ok) end) it("LuaRocks system config", function() lfs.mkdir(testing_paths.testing_lrprefix) lfs.mkdir(testing_paths.testing_lrprefix .. "/etc/") lfs.mkdir(scdir) local sysconfig = io.open(configfile, "w+") sysconfig:write(" ") sysconfig:close() local output = run.luarocks("config --system-config") os.remove(configfile) assert.are.same(output, configfile) end) it("LuaRocks fail system config invalid", function() lfs.mkdir(testing_paths.testing_lrprefix) lfs.mkdir(testing_paths.testing_lrprefix .. "/etc/") lfs.mkdir(scdir) local sysconfig = io.open(configfile, "w+") sysconfig:write("if if if") sysconfig:close() local ok = run.luarocks_bool("config --system-config") os.remove(configfile) assert.is_false(ok) end) end) end) test_env.unload_luarocks() local util = require("luarocks.util") describe("Luarocks util test #whitebox #w_util", function() describe("util.sortedpairs", function() local function collect(iter, state, var) local collected = {} while true do local returns = {iter(state, var)} if returns[1] == nil then return collected else table.insert(collected, returns) var = returns[1] end end end it("default sort", function() assert.are.same({}, collect(util.sortedpairs({}))) assert.are.same({ {1, "v1"}, {2, "v2"}, {3, "v3"}, {"bar", "v5"}, {"foo", "v4"} }, collect(util.sortedpairs({"v1", "v2", "v3", foo = "v4", bar = "v5"}))) end) it("sort by function", function() local function compare(a, b) return a > b end assert.are.same({}, collect(util.sortedpairs({}, compare))) assert.are.same({ {3, "v3"}, {2, "v2"}, {1, "v1"} }, collect(util.sortedpairs({"v1", "v2", "v3"}, compare))) end) it("sort by priority table", function() assert.are.same({}, collect(util.sortedpairs({}, {"k1", "k2"}))) assert.are.same({ {"k3", "v3"}, {"k2", "v2", {"sub order"}}, {"k1", "v1"}, {"k4", "v4"}, {"k5", "v5"}, }, collect(util.sortedpairs({ k1 = "v1", k2 = "v2", k3 = "v3", k4 = "v4", k5 = "v5" }, {"k3", {"k2", {"sub order"}}, "k1"}))) end) end) end)
if SERVER then include("firewagon/sv_firewagon.lua") AddCSLuaFile("firewagon/cl_firewagon.lua") end if CLIENT then include("firewagon/cl_firewagon.lua") end
Cellmap = Object:extend() function Cellmap:new(cell_x, cell_y, cell_width, cell_height) self.cell_x = cell_x self.cell_y = cell_y self.cell_width = cell_width self.cell_height = cell_height self.cells = {} end function Cellmap:init() local hor_bound_up = self.cell_height local hor_bound_down = love.graphics:getHeight() - (2 * self.cell_height) local ver_bound_left = self.cell_width local ver_bound_right = love.graphics:getWidth() - (2 * self.cell_width) local row = {} for i=hor_bound_up,hor_bound_down,self.cell_height do for i=ver_bound_left,ver_bound_right,self.cell_width do table.insert(row, 0) end table.insert(self.cells, row) row = {} end end function Cellmap:draw(liveimage, deadimage) for i=1,#cellmap.cells do for j=1,#cellmap.cells[i] do if cellmap.cells[i][j] == 0 then love.graphics.draw(deadimage, j * cellmap.cell_width, i * cellmap.cell_height) else love.graphics.draw(liveimage, j * cellmap.cell_width, i * cellmap.cell_height) end end end end function Cellmap:checkpress(x, y, button) if button == 1 then local j = math.ceil((x - cellmap.cell_width) / cellmap.cell_width) local i = math.ceil((y - cellmap.cell_height) / cellmap.cell_height) if i <= #cellmap.cells and cellmap.cells[i] ~= nil and j <= #cellmap.cells[i] and cellmap.cells[i][j] ~= nil then cellmap.cells[i][j] = (cellmap.cells[i][j] + 1) % 2 end end end function Cellmap:check_neighbours(i, j) local count=0 if i-1>0 then if j-1>0 then count = count + cellmap.cells[i-1][j-1] count = count + cellmap.cells[i][j-1] if i+1<=#cellmap.cells then count = count + cellmap.cells[i+1][j-1] end end if j+1<=#cellmap.cells[i] then count = count + cellmap.cells[i-1][j+1] count = count + cellmap.cells[i][j+1] if i+1<=#cellmap.cells then count = count + cellmap.cells[i+1][j+1] count = count + cellmap.cells[i+1][j] end end count = count + cellmap.cells[i-1][j] end return count end
local PushUISize, PushUIColor, PushUIStyle, PushUIAPI, PushUIConfig, PushUIFrames = unpack(select(2, ...)) local _sysdockPrefixName = "PushUIFramesSystemDock" local _colorUsage = {0.22, 0.56, 0.66} local _colorSysStat = {0.81, 0.71, 0.5} local lcontainer = "PushUIFramesLeftDockContainer" local ltint = "PushUIFrameLeftTintContainer" local rcontainer = "PushUIFramesRightDockContainer" local rtint = "PushUIFrameRightTintContainer" local _lpanelContainer = _G[lcontainer] local _ltintContainer = _G[ltint] local _rpanelContainer = _G[rcontainer] local _rtintContainer = _G[rtint] local _addonUsageDock = PushUIFrames.DockFrame.CreateNewDock( _sysdockPrefixName.."AddonUsage", _colorUsage, "BOTTOM", _lpanelContainer, _ltintContainer) _addonUsageDock.__name = _sysdockPrefixName.."AddonUsage" _addonUsageDock.panelAvailable = false; PushUIConfig.skinTooltipType(_addonUsageDock.floatPanel) _addonUsageDock.addonListLabel = PushUIFrames.Label.Create(_addonUsageDock.__name.."ListLabel", _addonUsageDock.floatPanel) _addonUsageDock.memUsageLabel = PushUIFrames.Label.Create(_addonUsageDock.__name.."Memlabel", _addonUsageDock.floatPanel) _addonUsageDock.addonListLabel:SetPoint("TOPLEFT", _addonUsageDock.floatPanel, "TOPLEFT") _addonUsageDock.memUsageLabel:SetPoint("TOPRIGHT", _addonUsageDock.floatPanel, "TOPRIGHT") _addonUsageDock.addonListLabel.SetFont(nil, 14) _addonUsageDock.memUsageLabel.SetFont(nil, 14) -- _addonUsageDock.addonListLabel.SetForceWidth(200) _addonUsageDock.memUsageLabel.SetForceWidth(100) _addonUsageDock.addonListLabel.SetJustifyH("LEFT") _addonUsageDock.memUsageLabel.SetJustifyH("RIGHT") _addonUsageDock.addonListLabel.SetMaxLines(999) _addonUsageDock.memUsageLabel.SetMaxLines(999) _addonUsageDock.floatPanel:SetWidth(300) _addonUsageDock.allAddonList = {} local _c_addonCount = GetNumAddOns() local _addonNameString = "" for i = 1, _c_addonCount do repeat local _name, _, _, _loadable = GetAddOnInfo(i) if not _loadable then break end _addonUsageDock.allAddonList[#_addonUsageDock.allAddonList + 1] = _name if _addonNameString == "" then _addonNameString = _name else _addonNameString = _addonNameString.."\n".._name end until true end _addonUsageDock.addonListLabel.SetTextString(_addonNameString) local _addonHeight = _addonUsageDock.addonListLabel:GetHeight() local _addonWidth = _addonUsageDock.addonListLabel:GetWidth() _addonUsageDock.floatPanel:SetWidth(_addonWidth + 100) _addonUsageDock.floatPanel:SetHeight(_addonHeight) _addonUsageDock.__gatherAddonInfo = function() local _addonMems = "" local _c_loadedAddons = #_addonUsageDock.allAddonList for i = 1, _c_loadedAddons do local _name = _addonUsageDock.allAddonList[i] local _mem = GetAddOnMemoryUsage(_name) if _mem >= 1024 then _mem = _mem / 1024 _mem = ("%.2f"):format(_mem).."MB" else _mem = ("%.2f"):format(_mem).."KB" end if _addonMems == "" then _addonMems = _mem else _addonMems = _addonMems.."\n".._mem end end _addonUsageDock.memUsageLabel.SetTextString(_addonMems) end _addonUsageDock.__refreshTimer = PushUIFrames.Timer.Create(1, _addonUsageDock.__gatherAddonInfo) _addonUsageDock.floatPanel.WillAppear = function() _addonUsageDock.__gatherAddonInfo() _addonUsageDock.__refreshTimer.StartTimer() end _addonUsageDock.floatPanel.WillDisappear = function() _addonUsageDock.__refreshTimer:StopTimer() end _ltintContainer.Push(_addonUsageDock.tintBar) -- -- System Status local _sysstatDock = PushUIFrames.DockFrame.CreateNewDock( _sysdockPrefixName.."SysStat", _colorSysStat, "BOTTOM", _lpanelContainer, _ltintContainer) _sysstatDock.__name = _sysdockPrefixName.."SysStat" _sysstatDock.panelAvailable = false; PushUIConfig.skinTooltipType(_sysstatDock.floatPanel) local _netStatTitleLabel = PushUIFrames.Label.Create(_sysstatDock.__name.."NetTitleState", _sysstatDock.floatPanel) local _netStatLabel = PushUIFrames.Label.Create(_sysstatDock.__name.."NetState", _sysstatDock.floatPanel) _netStatTitleLabel.SetMaxLines(4) _netStatTitleLabel.SetForceWidth(150) _netStatTitleLabel.SetFont(nil, 14) _netStatTitleLabel.SetJustifyH("LEFT") _netStatTitleLabel:SetPoint("TOPLEFT", _sysstatDock.floatPanel, "TOPLEFT") _netStatLabel.SetMaxLines(4) _netStatLabel.SetForceWidth(100) _netStatLabel.SetFont(nil, 14) _netStatLabel.SetJustifyH("RIGHT") _netStatLabel:SetPoint("TOPRIGHT", _sysstatDock.floatPanel, "TOPRIGHT") local _fpsTitleLabel = PushUIFrames.Label.Create(_sysstatDock.__name.."FPSTitle", _sysstatDock.floatPanel) local _fpsLabel = PushUIFrames.Label.Create(_sysstatDock.__name.."FPS", _sysstatDock.floatPanel) _fpsTitleLabel.SetForceWidth(150) _fpsTitleLabel.SetFont(nil, 14) _fpsTitleLabel.SetJustifyH("LEFT") _fpsTitleLabel:SetPoint("TOPLEFT", _netStatTitleLabel, "BOTTOMLEFT") _fpsLabel.SetMaxLines(4) _fpsLabel.SetForceWidth(100) _fpsLabel.SetFont(nil, 14) _fpsLabel.SetJustifyH("RIGHT") _fpsLabel:SetPoint("TOPRIGHT", _netStatLabel, "BOTTOMRIGHT") _sysstatDock.floatPanel:SetWidth(250) _netStatTitleLabel.SetTextString("Downloading:\nUploading:\nLatency Home:\nLatency World:") _fpsTitleLabel.SetTextString("FPS:") _sysstatDock.floatPanel:SetHeight(_netStatTitleLabel:GetHeight() + _fpsTitleLabel:GetHeight()) _sysstatDock.__gatherSysInfo = function() local _down, _up, _lhome, _lworld = GetNetStats() if _down == nil then _down = 0 end if _up == nil then _up = 0 end if _down >= 1024 then _down = _down / 1024 _down = ("%.2f"):format(_down).."MB/s" else _down = ("%.2f"):format(_down).."KB/s" end if _up >= 1024 then _up = _up / 1024 _up = ("%.2f"):format(_up).."MB/s" else _up = ("%.2f"):format(_up).."KB/s" end if _lhome == nil then _lhome = 0 end if _lworld == nil then _lworld = 0 end local _sys = _down.."\n".._up.."\n".._lhome.."ms\n".._lworld.."ms" _netStatLabel.SetTextString(_sys) _fpsLabel.SetTextString(("%.2f"):format(GetFramerate())) end _sysstatDock.__gatherSysInfo() _sysstatDock.__refreshTimer = PushUIFrames.Timer.Create(1, _sysstatDock.__gatherSysInfo) _sysstatDock.floatPanel.WillAppear = function() _sysstatDock.__refreshTimer:StartTimer() end _sysstatDock.floatPanel.WillDisappear = function() _sysstatDock.__refreshTimer:StopTimer() end _ltintContainer.Push(_sysstatDock.tintBar)
object_tangible_loot_creature_loot_collections_meatlump_newspaper_07 = object_tangible_loot_creature_loot_collections_shared_meatlump_newspaper_07:new { } ObjectTemplates:addTemplate(object_tangible_loot_creature_loot_collections_meatlump_newspaper_07, "object/tangible/loot/creature/loot/collections/meatlump_newspaper_07.iff")
-- 用户信息 local user = { usr = "201413640731", -- 在这里输入用户名 pwd = "yourpasswd", -- 在这里输入密码 net = "SNET", -- 网络类型,SNET: 校园网(school net),INET: 互联网(internet),默认为SNET ispc = "true", -- login as a PC if @ispc is true, else login as a mobile phone } -- 软件设置 local sys = { ser = "10.255.0.204", -- 服务器地址,不再必须填写 path = "/a70.htm", } return { user = user, sys = sys, }
local TwodyObject = { Abstract = require "Abstract.init", Class = require('Class.init'), ClassType = require('ClassType.init'), Interface = require('Interface.init'), Object = require('Object.init'), } return TwodyObject
require("Menu/MainMenu/mainMenuStyle.lua") --this = SceneNode() ExportForm = {} function ExportForm.new() local self = {} local form local optionsForm local exportPanel local loadingSprite local pathTextField function self.hide() form:setVisible(false) end function self.show() -- form:setVisible(true) end function self.export(filePath) local bilboard = Core.getGlobalBillboard("MapEditor") bilboard:setString("exportToFile", filePath) pathTextField:setText(filePath) form:update()--force the text to be updated optionsForm:setVisible(true) end function self.update() if optionsForm:getVisible() then optionsForm:update() elseif form:getVisible() then local height = Core.getScreenResolution().y * 0.035 -- print("\nheight: "..height.."\n") -- print("pos: "..(exportPanel:getMaxPos().x-height*0.5)..", "..(exportPanel:getMaxPos().y-height*0.5).."\n") loadingSprite:setSize(Vec2(height)) local localMat = Matrix(Vec3(exportPanel:getMaxPos().x-height*0.7 - exportPanel:getMinPos().x, exportPanel:getMaxPos().y-height*0.7 - exportPanel:getMinPos().y, 0)) localMat:rotate(Vec3(0,0,1), Core.getGameTime() * math.pi) loadingSprite:setLocalMatrix(localMat) form:update() end end local function startExport() local bilboard = Core.getGlobalBillboard("MapEditor") bilboard:setString("exportToFile", pathTextField:getText():toString()) bilboard:setBool("exportLuaFiles",checkBoxAddLuaFiles:getSelected()) local worker = Worker("MapEditor/exportScript.lua",false) worker:addCallbackFinished(self.hide) worker:start() form:setVisible(true) optionsForm:setVisible(false) end local function quitExport() optionsForm:setVisible(false) end local function init() --camera = Camera() local camera = this:getRootNode():findNodeByName("MainCamera") --export question form optionsForm = Form( camera, PanelSize(Vec2(-1,0.15), Vec2(2.8,1)), Alignment.MIDDLE_CENTER); optionsForm:setBackground(Gradient(MainMenuStyle.backgroundTopColor, MainMenuStyle.backgroundDownColor)); optionsForm:setLayout(FallLayout(PanelSize(Vec2(MainMenuStyle.borderSize)))); optionsForm:setBorder(Border(BorderSize(Vec4(MainMenuStyle.borderSize)), MainMenuStyle.borderColor)); optionsForm:setPadding(BorderSize(Vec4(MainMenuStyle.borderSize * 3))); optionsForm:setFormOffset(PanelSize(Vec2(0.005), Vec2(1))); optionsForm:setRenderLevel(1) optionsForm:add(Label(PanelSize(Vec2(-1,0.03)), "Export", MainMenuStyle.textColorHighLighted, Alignment.MIDDLE_CENTER)) MainMenuStyle.createBreakLine(optionsForm) local optionsPanel = optionsForm:add(Panel(PanelSize(Vec2(-1)))) optionsPanel:setLayout(FallLayout(Alignment.BOTTOM_RIGHT)) local bottomPanel = optionsPanel:add(Panel(PanelSize(Vec2(-1,0.03)))) MainMenuStyle.createBreakLine(optionsPanel) local mainPanel = optionsPanel:add(Panel(PanelSize(Vec2(-1)))) mainPanel:setLayout(FallLayout(Alignment.TOP_LEFT)) --Button Panel bottomPanel:setLayout(FlowLayout(Alignment.TOP_CENTER)) local exportButton = bottomPanel:add(MainMenuStyle.createButton(Vec2(-1), Vec2(4,1), "Export")) local quitExportButton = bottomPanel:add(MainMenuStyle.createButton(Vec2(-1), Vec2(4,1), "Cancel")) exportButton:addEventCallbackExecute(startExport) quitExportButton:addEventCallbackExecute(quitExport) --Main Options form Panel local row = mainPanel:add(Panel(PanelSize(Vec2(-1,0.03)))) row:add(Label(PanelSize(Vec2(-1),Vec2(4.5,1)), "Export path: ", MainMenuStyle.textColor, Alignment.MIDDLE_RIGHT )) local endOfRow = row:add(Panel(PanelSize(Vec2(-1)))) endOfRow:setLayout(FlowLayout(Alignment.TOP_RIGHT)) -- local changeFileButton = endOfRow:add(MainMenuStyle.createButton(Vec2(-1),Vec2(2,1),"...")) pathTextField = endOfRow:add(MainMenuStyle.createTextField(Vec2(-1),Vec2(), "Path/Path")) pathTextField:setWhiteList("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ._-/") row = mainPanel:add(Panel(PanelSize(Vec2(-1,0.03)))) row:add(Label(PanelSize(Vec2(-1),Vec2(4.5,1)), "Include lua: ", MainMenuStyle.textColor, Alignment.MIDDLE_RIGHT )) checkBoxAddLuaFiles = row:add(CheckBox(PanelSize(Vec2(-1), Vec2(1)), false)) --Exporting form form = Form( camera, PanelSize(Vec2(1, 1)), Alignment.TOP_LEFT); form:getPanelSize():setFitChildren(false, false); form:setLayout(FlowLayout(Alignment.MIDDLE_CENTER)); form:setRenderLevel(50) form:setVisible(false) form:setBackground(Sprite(Vec4(0,0,0,0.6))) exportPanel = form:add(Panel(PanelSize(Vec2(1,0.15),Vec2(4,1)))) exportPanel:setPadding(BorderSize(Vec4(0.003), true)) exportPanel:setBackground(Gradient(Vec4(MainMenuStyle.backgroundTopColor:toVec3(), 0.9), Vec4(MainMenuStyle.backgroundDownColor:toVec3(), 0.75))) exportPanel:setBorder(Border(BorderSize(Vec4(MainMenuStyle.borderSize),true), MainMenuStyle.borderColor)) local label = exportPanel:add(Label(PanelSize(Vec2(-1)), "Exporting the map.\nThis can take a few minutes.",Alignment.MIDDLE_CENTER)) label:setTextColor(MainMenuStyle.textColor) label:setTextHeight(0.02) local texture = Core.getTexture("icon_table") loadingSprite = Sprite(texture) loadingSprite:setAnchor(Anchor.MIDDLE_CENTER) loadingSprite:setUvCoord(Vec2(0.775,0.0625), Vec2(1.0,0.1875)) local height = Core.getScreenResolution().y * 0.035 loadingSprite:setSize(Vec2(height)) exportPanel:addRenderObject(loadingSprite) local localMat = Matrix(Vec3(loadingSprite:getLocalPosition(),0)) localMat:rotate(Vec3(0,0,1), Core.getGameTime()) loadingSprite:setLocalMatrix(localMat) end init() return self end
local Log = require "log" local date = require "date" local string = require "string" local schar = string.char local sbyte = string.byte local sformat = string.format local ssub = string.sub local tn = tonumber local M = {} function M.pack(msg, lvl, now) local Y, M, D = now:getdate() local h, m, s = now:gettime() local now_s = sformat("%.4d-%.2d-%.2d %.2d:%.2d:%.2d", Y, M, D, h, m, s) return schar(lvl) .. now_s .. msg end function M.unpack(str) local lvl = sbyte( ssub(str, 1, 1) ) if not Log.LVL_NAMES[lvl] then return end local now_s = ssub(str, 2, 20 ) local Y, M, D = ssub(str, 2, 5 ), ssub(str, 7, 8 ), ssub(str, 10, 11 ) local h, m, s = ssub(str, 13, 14 ), ssub(str, 16, 17 ), ssub(str, 19, 20 ) Y, M, D, h, m, s = tn(Y), tn(M), tn(D), tn(h), tn(m), tn(s) if not (Y and M and D and h and m and s) then return end return ssub(str, 21), lvl, date(Y, M, D, h, m, s) end return M
-- Copyright 2022 SmartThings -- -- 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 devices = { YALE_SIREN = { MATCHING_MATRIX = { mfrs = 0x0129, product_types = 0x6F01, product_ids = 0x0001 }, CONFIGURATION = { {parameter_number = 1, size = 1, configuration_value = 10}, {parameter_number = 2, size = 1, configuration_value = 1}, {parameter_number = 3, size = 1, configuration_value = 0}, {parameter_number = 4, size = 1, configuration_value = 0}, } }, EVERSPRING_SIREN = { MATCHING_MATRIX = { mfrs = 0x0060, product_types = 0x000C, product_ids = 0x0002 }, CONFIGURATION = { {parameter_number = 1, size = 2, configuration_value = 180} } }, ZIPATO_SIREN = { MATCHING_MATRIX = { mfrs = 0x0131, product_types = 0x0003, product_ids = 0x1083 }, CONFIGURATION = { {parameter_number = 1, size = 1, configuration_value = 3}, {parameter_number = 2, size = 1, configuration_value = 2}, {parameter_number = 5, size = 1, configuration_value = 10} } } } local configurations = {} configurations.get_device_configuration = function(zw_device) for _, device in pairs(devices) do if zw_device:id_match( device.MATCHING_MATRIX.mfrs, device.MATCHING_MATRIX.product_types, device.MATCHING_MATRIX.product_ids) then return device.CONFIGURATION end end return nil end return configurations
local bench = script and require(script.Parent.bench_support) or require("bench_support") function test() local ts0 = os.clock() for i=1,100000 do local t = { a = 1, b = 2, c = 3, d = 4, e = 5, f = 6 } end local ts1 = os.clock() return ts1-ts0 end bench.runCode(test, "LargeTableCtor: hash")
--- -- An animation element using the @{love:AnAL} library. -- @classmod Animation -- @alias Animation local class = require("middleclass") local AnAL = require("AnAL") local Base = require("silicone.elements.Base") local Animation = class("silicone.Animation", Base) --- -- Internal. -- Internal methods -- @section Internal --- -- Initializes an Animation element -- @tparam table spec Menu specification -- @tparam Root root Root element function Animation:initialize(spec, root) self.type = "Animation" self.angle = 0 self.xScale = 1 self.yScale = 1 self.autoScale = true Base.initialize(self, spec, root) if not spec.height and not spec.heightOffset then self.heightOffset = spec.frameHeight end if not spec.width and not spec.widthOffset then self.widthOffset = spec.frameWidth end self._animation = AnAL.newAnimation(spec.animation, spec.frameWidth, spec.frameHeight, spec.delay, spec.frames) end --- -- Getters/Setters. -- Getters and setters for element properties -- @section Getters/Setters --- -- Returns an animation's angle -- @treturn number angle function Animation:getAngle() return self.angle end --- -- Sets an animation's angle -- @tparam number angle angle function Animation:setAngle(angle) self.angle = angle end --- -- Returns an animation's X scale -- @treturn number X scale function Animation:getXScale() return self.xScale end --- -- Sets an animation's X scale -- @tparam number x X scale function Animation:setXScale(x) self.autoScale = false self.xScale = x end --- -- Returns an animation's Y scale -- @treturn number Y scale function Animation:getYScale() return self.yScale end --- -- Sets an animation's Y scale -- @tparam number y Y scale function Animation:setYScale(y) self.autoScale = false self.yScale = y end --- -- Returns an animation's scale -- @treturn number X scale -- @treturn number Y scale function Animation:getScale() return self:getXScale(), self:getYScale() end --- -- Sets an animation's scale -- @tparam number x X scale -- @tparam number y Y scale function Animation:setScale(x, y) self:setXScale(x) self:setYScale(y) end --- -- Returns whether or not the animation is set to auto scale -- @treturn bool autoscale function Animation:getAutoScale() return self.autoScale end --- -- Sets whether or not the animation should auto scale -- @tparam bool scale autoscale function Animation:setAutoScale(scale) self.autoScale = scale end --- -- LÖVE Callbacks. -- LÖVE callback handlers for Silicone elements -- @section LÖVE Callbacks --- -- Updates an Animation -- @tparam number dt Time since the last update in seconds function Animation:update(dt) self._animation:update(dt) end --- -- AnAL Functions. -- AnAL convenience functions for Silicone Animations -- @section AnAL Functions --- -- Generic AnAL function. -- -- The Animation element implements all of AnAL's functions so you can -- manipulate them just like you would a normal AnAL animation. -- @function Animation:AnALFunction -- @param ... -- @see love:AnAL -- @usage -- -- ... -- -- Create Animation 'animation' -- -- ... -- -- -- Set an Animation's speed to ~30 FPS -- animation:setSpeed(0.333) function Animation:addFrame(...) self._animation:addFrame(...) end function Animation:getCurrentFrame() return self._animation:getCurrentFrame() end function Animation:getSize() return self._animation:getSize() end function Animation:play() self._animation:play() end function Animation:reset() self._animation:reset() end function Animation:seek(...) self._animation:seek(...) end function Animation:setDelay(...) self._animation:setDelay(...) end function Animation:setMode(...) self._animation:setMode(...) end function Animation:setSpeed(...) self._animation:setSpeed(...) end function Animation:stop() self._animation:stop() end return Animation
local jifenRecordView_layout= { name="jifenRecordView_layout",type=0,typeName="View",time=0,report=0,x=0,y=0,width=1280,height=720,visible=1,fillParentWidth=1,fillParentHeight=1,nodeAlign=kAlignTopLeft, { name="shadeBg",type=1,typeName="Image",time=31057625,report=0,x=0,y=0,width=1280,height=720,visible=1,fillParentWidth=1,fillParentHeight=1,nodeAlign=kAlignCenter,file="isolater/bg_shiled.png" }, { name="contentViewRecord",type=0,typeName="View",time=77698533,report=0,x=0,y=0,width=780,height=652,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignCenter, { name="bg",type=1,typeName="Image",time=77699401,report=0,x=0,y=0,width=780,height=652,visible=1,fillParentWidth=1,fillParentHeight=1,nodeAlign=kAlignTopLeft,file="hall/common/popupWindow/popupWindow_bg_55_55_55_55.png",gridLeft=55,gridRight=55,gridTop=55,gridBottom=55 }, { name="titleBg",type=1,typeName="Image",time=77698535,report=0,x=0,y=-55,width=617,height=190,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignTop,file="hall/common/popupWindow/popupWindow_title.png", { name="title",type=4,typeName="Text",time=77698536,report=0,x=0,y=-5,width=136,height=50,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignCenter,fontSize=34,textAlign=kAlignCenter,colorRed=255,colorGreen=235,colorBlue=186,string=[[玩牌记录]],colorA=1 } }, { name="closeBtn",type=1,typeName="Button",time=0,x=-14,y=-15,width=64,height=64,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignTopRight,file="isolater/popupWindow/popupWindow_close.png" }, { name="recordView",type=0,typeName="View",time=0,x=0,y=95,width=746,height=495,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignTop, { name="titleView",type=0,typeName="View",time=0,x=0,y=0,width=746,height=58,visible=1,fillParentWidth=1,fillParentHeight=0,nodeAlign=kAlignTop }, { name="recordInfo",type=0,typeName="View",time=0,x=0,y=0,width=742,height=495,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignTop, { name="bg",type=1,typeName="Image",time=0,x=0,y=0,width=746,height=495,visible=1,fillParentWidth=0,fillParentHeight=1,nodeAlign=kAlignCenter,file="isolater/popupWindow/popupWindow_content_bg_25_25_65_25.png",gridLeft=25,gridRight=25,gridTop=65,gridBottom=25 } }, { name="recordEmptyTips",type=4,typeName="Text",time=0,x=0,y=0,width=324,height=100,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignCenter,fontSize=36,textAlign=kAlignCenter,colorRed=141,colorGreen=92,colorBlue=31,string=[[您目前没有玩牌记录]],colorA=1 } } }, { name="contentViewOver",type=0,typeName="View",time=77698533,report=0,x=0,y=-40,width=780,height=550,visible=0,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignCenter, { name="btnView",type=0,typeName="View",time=30964892,report=0,x=0,y=-100,width=572,height=74,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignBottom, { name="saveBtn",type=2,typeName="Button",time=30962483,report=0,x=0,y=0,width=250,height=85,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignLeft,file="hall/common/btns/btn_orange_164x89_l25_r25_t25_b25.png",gridLeft=25,gridRight=25,gridTop=25,gridBottom=25, { name="img",type=1,typeName="Image",time=0,x=20,y=0,width=45,height=37,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignLeft,file="games/common/jifen/jifenRecord/prcIcon.png" }, { name="text",type=4,typeName="Text",time=0,x=80,y=0,width=144,height=41,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignLeft,fontSize=36,textAlign=kAlignLeft,colorRed=255,colorGreen=250,colorBlue=200,string=[[截图保存]],colorA=1 } }, { name="playAgainBtn",type=2,typeName="Button",time=30962525,report=0,x=0,y=0,width=250,height=85,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignRight,file="hall/common/btns/btn_green_164x89_l25_r25_t25_b25.png",gridLeft=25,gridRight=25,gridTop=25,gridBottom=25, { name="text",type=4,typeName="Text",time=30963332,report=0,x=0,y=0,width=250,height=41,visible=1,fillParentWidth=1,fillParentHeight=0,nodeAlign=kAlignCenter,fontSize=36,textAlign=kAlignCenter,colorRed=255,colorGreen=250,colorBlue=200,string=[[下一局]],colorA=1 } } }, { name="shareView",type=0,typeName="View",time=0,x=0,y=0,width=780,height=550,visible=1,fillParentWidth=1,fillParentHeight=1,nodeAlign=kAlignCenter, { name="gameInfo",type=0,typeName="View",time=0,x=20,y=15,width=400,height=40,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignBottomLeft, { name="text",type=4,typeName="Text",time=0,x=0,y=0,width=204,height=34,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignLeft,fontSize=28,textAlign=kAlignLeft,colorRed=143,colorGreen=92,colorBlue=31,colorA=1 } }, { name="qrCode",type=1,typeName="Image",time=31057625,report=0,x=28,y=10,width=80,height=80,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignTopRight,file="games/common/match/qrcode.png" } }, { name="contentView",type=0,typeName="View",time=0,x=317,y=179,width=780,height=550,visible=1,fillParentWidth=1,fillParentHeight=1,nodeAlign=kAlignTopLeft, { name="bg",type=1,typeName="Image",time=77699401,report=0,x=0,y=0,width=780,height=550,visible=1,fillParentWidth=1,fillParentHeight=1,nodeAlign=kAlignTopLeft,file="hall/common/popupWindow/popupWindow_bg_55_55_55_55.png",gridLeft=55,gridRight=55,gridTop=55,gridBottom=55 }, { name="titleBg",type=1,typeName="Image",time=77698535,report=0,x=0,y=-55,width=617,height=190,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignTop,file="hall/common/popupWindow/popupWindow_title.png", { name="title",type=4,typeName="Text",time=77698536,report=0,x=0,y=-5,width=136,height=50,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignCenter,fontSize=34,textAlign=kAlignCenter,colorRed=255,colorGreen=235,colorBlue=186,string=[[本局战绩]],colorA=1 } }, { name="overView",type=0,typeName="View",time=0,x=0,y=95,width=746,height=395,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignTop, { name="titleView",type=0,typeName="View",time=0,x=0,y=0,width=746,height=58,visible=1,fillParentWidth=1,fillParentHeight=0,nodeAlign=kAlignTop }, { name="overInfo",type=1,typeName="Image",time=0,x=0,y=0,width=746,height=395,visible=1,fillParentWidth=1,fillParentHeight=1,nodeAlign=kAlignTop,file="isolater/popupWindow/popupWindow_content_bg_25_25_65_25.png",gridLeft=25,gridRight=25,gridTop=65,gridBottom=25 } } }, { name="closeBtn",type=1,typeName="Button",time=0,x=-14,y=-15,width=64,height=64,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignTopRight,file="isolater/popupWindow/popupWindow_close.png" } } } return jifenRecordView_layout;
object_tangible_component_weapon_quest_blaster_power_handler_faux_bowcaster = object_tangible_component_weapon_quest_shared_blaster_power_handler_faux_bowcaster:new { } ObjectTemplates:addTemplate(object_tangible_component_weapon_quest_blaster_power_handler_faux_bowcaster, "object/tangible/component/weapon/quest/blaster_power_handler_faux_bowcaster.iff")
otherScript = nil; timeToCallOtherScript = 0.0; function Init() otherScript = self; timeToCallOtherScript = 0.0; end function Kill() end function Update() local deltaT = Timer:GetSecDelta(); if(otherScript ~= nil) then timeToCallOtherScript = timeToCallOtherScript - deltaT; if(timeToCallOtherScript < 0.0) then otherScript:Call("TestCallFromOtherScript", self); otherScript:Call("TestCallFromOtherScript2", 123, 10.0); timeToCallOtherScript = 0.5; end end local pos = Vector3.new(1, 2, 3); local pos2 = Vector3.new(pos); pos2:SetX(4); pos2 = pos2 * 10; pos = pos * pos2; pos = pos + pos2; pos = -pos; local object = self:GetGameObject(); local renderComp = object:GetRenderComponent(); if(renderComp ~= nil) then end object:GetTransform():SetPosition(pos); print("x = ", object:GetTransform():GetPosition():GetX()); -- Static function test local mat = Matrix4.CreateTranslation(Vector3.new(100.0, 2.0, 0.0)); end function TestCallFromOtherScript(caller) print("TestCallFromOtherScript called by ", caller:GetGameObject():GetName()); end function TestCallFromOtherScript2(arg1, arg2) print("TestCallFromOtherScript2 called with: ", arg1, ", ", arg2); end function Function1() print("Function1 called"); end function Function2(a1, a2) print("Function2 called with: ", a1, ", ", a2); end function Function3(str) print("Function3 called with: ", str); end
local resty_redis = require 'resty.redis' local index = require 'resty.redimension' local concat = table.concat local redis = resty_redis:new() redis:set_timeout(1000) local ok, err = redis:connect('127.0.0.1', 6379) if not ok then print('error:', err) end local idx = index:new(redis, 'people-by-salary', 2) idx:index({45, 120000}, 'Josh') idx:index({50, 110000}, 'Pamela') idx:index({30, 125000}, 'Angela') print "first test" local result = idx:query({{45, 50}, {100000, 115000}}) for i = 1, #result do print(concat(result[i],' -> ')) end
local M = {} local composer = require( "composer" ) local physics = require( "physics" ) -- define vars local spawnHandlerTimer local group local lastSpawnGroundObjects local lastSpawnFloatingObjects local lastSpawnObstacle local lastSpawnObsSeq local outlineCache -- to reduce CPU usage -- assets dir local pickDir = "assets/items/pickables/" -- pickables dir local obsDir = "assets/items/obstacles/" -- obstacles dir -- ---------------------------------------------------------------------------- -- private functions -- ---------------------------------------------------------------------------- local function spawnGroundObjects() local gameSpeed = composer.getVariable( "gameSpeed" ) -- spawn cooldown local spawnCooldown = 10/gameSpeed -- cooldown seconds if ( (os.time() - lastSpawnGroundObjects) < spawnCooldown ) then return end lastSpawnGroundObjects = os.time() -- generate a random number of pickable items local randNum = math.random( 1, math.floor(gameSpeed)+1 ) for i=1, randNum do -- select random asset local randAsset = math.random( 5 ) local paint = { type = "image", filename = pickDir .. "barrel/" .. randAsset .. ".png" } -- create object local scaleFact = 0.18 local newPickable = display.newRect( group, display.contentWidth + math.random(600, 1400), display.contentHeight, 349*scaleFact, 512*scaleFact ) newPickable.fill = paint newPickable.anchorY = 1 newPickable.myType = "pickableObject" newPickable.myName = "groundObject" newPickable.mySeaLife = true -- used in updateSeaLife() to avoid counting the same object more than 1 time local collFiltParams = composer.getVariable( "collFiltParams" ) -- get collision filter params physics.addBody( newPickable, { radius=50, isSensor=true, filter=collFiltParams.pickableObjectFilter } ) newPickable.gravityScale = 0 -- remove gravity from this -- rand rotation local randRot = math.random( 2 ) if (randRot == 2) then newPickable.rotation = 90 newPickable.y = newPickable.y - 30 end -- add to table table.insert( composer.getVariable( "screenObjectsTable" ), newPickable ) -- set speed newPickable:setLinearVelocity( -450*gameSpeed, 0 ) end end local function spawnFloatingObjects() local gameSpeed = composer.getVariable( "gameSpeed" ) -- check spawn cooldown local spawnCooldown = 6/gameSpeed -- cooldown seconds if ( (os.time() - lastSpawnFloatingObjects) < spawnCooldown ) then return end lastSpawnFloatingObjects = os.time() -- set random spawn center on the Y axis local spawnCenterY = math.random(400, display.contentHeight-400) -- generate a random number of pickable items local randNum = math.random( 2, math.floor(gameSpeed*2)+2 ) for i=1, randNum do -- select random asset local randAsset = math.random( 5 ) local paint = { type = "image", filename = pickDir .. "bottle/" .. randAsset .. ".png" } -- create object local scaleFact = 0.18 local spawnPosY = math.random( spawnCenterY - 100, spawnCenterY + 100 ) local spawnPosX = display.contentWidth + 450 + (i * 150) + math.random( -50, 50 ) local newPickable = display.newRect( group, spawnPosX, spawnPosY, 233*scaleFact, 512*scaleFact ) newPickable.fill = paint newPickable.myType = "pickableObject" newPickable.myName = "floatingObject" newPickable.mySeaLife = true -- used in updateSeaLife() to avoid counting the same object more than 1 time local collFiltParams = composer.getVariable( "collFiltParams" ) -- get collision filter params physics.addBody( newPickable, { radius=50, isSensor=true, filter=collFiltParams.pickableObjectFilter } ) newPickable.gravityScale = 0 -- remove gravity from this -- rand spin local randRot = math.random( -8, 8 ) newPickable:applyTorque( randRot ) -- add to table table.insert( composer.getVariable( "screenObjectsTable" ), newPickable ) -- set speed newPickable:setLinearVelocity( -450*gameSpeed, 0 ) end end local function spawnObstacle( assetPath, location, xPos, yPos, linearVelocity ) -- select asset with random scale -- NOTE: here we use assets already scaled because outline function works on -- the real dimension in pixels of the asset to be outlined local assetPathScaled = assetPath .. "x" .. math.random( 12, 15 ) .. ".png" -- outline asset image -- NOTE: here we dynamically cache the graphics.newOutline() output to improve perfomance and reduce CPU usage if ( outlineCache[ assetPathScaled ] == nil ) then outlineCache[ assetPathScaled ] = graphics.newOutline( 2, assetPathScaled ) end local assetOutline = outlineCache[ assetPathScaled ] -- create object and select the right scale local newObstacle = display.newImage( group, assetPathScaled, xPos, yPos ) newObstacle.myType = "obstacleObject" newObstacle.myName = "obstacle" -- adapt to location if ( location == "floor" ) then newObstacle.anchorY = 1 elseif ( location == "ceiling" ) then newObstacle.rotation = 180 newObstacle.anchorY = 1 end -- set physics local collFiltParams = composer.getVariable( "collFiltParams" ) -- get collision filter params physics.addBody( newObstacle, "kinematic", { isSensor=true, outline=assetOutline,filter=collFiltParams.obstacleFilter } ) -- add to table table.insert( composer.getVariable( "screenObjectsTable" ), newObstacle ) -- set speed newObstacle:setLinearVelocity( linearVelocity, 0 ) end local function spawnObstacleSequence ( length, location ) local gameSpeed = composer.getVariable( "gameSpeed" ) for i=1, length do -- set random obstlacle properties and spawn it local assetPath = obsDir .. "stone/" .. math.random( 1, 2 ) local linearVelocity = -450 * gameSpeed local xPos = display.contentWidth + 300 + (350 * i) if ( location == "mix" ) then if ( math.random( 2 ) == 1 ) then spawnObstacle( assetPath, "floor", xPos, display.contentHeight+30, linearVelocity ) else spawnObstacle( assetPath, "ceiling", xPos, -20, linearVelocity ) end elseif ( location == "floor" ) then spawnObstacle( assetPath, "floor", xPos, display.contentHeight+20, linearVelocity ) else spawnObstacle( assetPath, "ceiling", xPos, -20, linearVelocity ) end end end local function spawnHandler() local gameSpeed = composer.getVariable( "gameSpeed" ) -- select random spawn event based on probabilities local randEvent = math.random( 100 ) if ( randEvent <= 85 ) then -- 85% prob of pickable objects or single obstacle -- select random spawn object based on probabilities local randObj = math.random( 100 ) if ( randObj <= 45 ) then -- 45% prob of floating obj spawnFloatingObjects() elseif ( randObj <= 80 ) then -- 35% prob of ground obj spawnGroundObjects() elseif ( randObj <= 100 ) then -- 20% prob of obstacle -- check cooldowns local obstacleSpawnCooldown = 8/gameSpeed -- cooldown seconds if ( (os.time() - lastSpawnObstacle) < obstacleSpawnCooldown ) then return end lastSpawnObstacle = os.time() -- set random obstlacle properties and spawn it local linearVelocity = -450 * gameSpeed local xPos = display.contentWidth + 600 if ( math.random( 2 ) == 1 ) then local assetPath = obsDir .. "stone/" .. math.random( 3, 4 ) spawnObstacle( assetPath, "floor", xPos, display.contentHeight+20, linearVelocity ) else local assetPath = obsDir .. "stone/" .. math.random( 1, 2 ) spawnObstacle( assetPath, "ceiling", xPos, -20, linearVelocity ) end end elseif ( randEvent <= 100 ) then -- 15% prob of obstacle sequence -- check cooldowns local obsSeqSpawnCooldown = 17/gameSpeed -- cooldown seconds if ( (os.time() - lastSpawnObsSeq) < obsSeqSpawnCooldown ) then return end lastSpawnObsSeq = os.time() -- select rand seq kind local randSeqKind = math.random( 6 ) local randSeqLen = math.random( 8, 16 ) -- length of seq in pieces if ( randSeqKind == 1 ) then spawnObstacleSequence ( randSeqLen, "floor" ) -- 1/6 prob elseif ( randSeqKind == 2 ) then spawnObstacleSequence ( randSeqLen, "ceiling" ) -- 1/6 prob else spawnObstacleSequence ( randSeqLen, "mix" ) -- 4/6 prob end end end -- ---------------------------------------------------------------------------- -- public functions -- ---------------------------------------------------------------------------- -- insert in scene:create() function M.create( mainGroup ) -- init vars group = mainGroup lastSpawnGroundObjects = os.time() lastSpawnFloatingObjects = os.time() lastSpawnObstacle = os.time() lastSpawnObsSeq = os.time() outlineCache = {} end -- insert in scene:show() in "did" phase function M.showDid() -- set spawn timers spawnHandlerTimer = timer.performWithDelay( 500, spawnHandler, 0 ) end -- insert in scene:hide() in "did" phase function M.hideDid() -- remove Runtime listeners -- cancel timers timer.cancel( spawnHandlerTimer ) -- cancel transitions end -- return module table return M
local qrgen = {} local mattata = require('mattata') local URL = require('socket.url') function qrgen:init(configuration) qrgen.arguments = 'qrgen <string>' qrgen.commands = mattata.commands(self.info.username, configuration.commandPrefix):c('qrgen').table qrgen.help = configuration.commandPrefix .. 'qrgen - Converts the given string to an QR code.' end function qrgen:onMessage(message) local input = mattata.input(message.text) if not input then mattata.sendMessage(message.chat.id, qrgen.help, nil, true, false, message.message_id) return end local res = mattata.sendPhoto(message.from.id, 'http://chart.apis.google.com/chart?cht=qr&chs=500x500&chl=' .. URL.escape(input) .. '&chld=H|0.png', nil, false) if not res then mattata.sendMessage(message.chat.id, 'Please [message me in a private chat](http://telegram.me/' .. self.info.username .. ') so I can send you the QR code.', 'Markdown', true, false, message.message_id) else mattata.sendChatAction(message.from.id, 'upload_photo') mattata.sendMessage(message.chat.id, 'I have sent you your QR code via a private message.', nil, true, false, message.message_id) end end return qrgen
-------------------------------- -- @module Event -- @extend Ref -- @parent_module cc -------------------------------- -- @function [parent=#Event] isStopped -- @param self -- @return bool#bool ret (return value: bool) -------------------------------- -- @function [parent=#Event] getType -- @param self -- @return Event::Type#Event::Type ret (return value: cc.Event::Type) -------------------------------- -- @function [parent=#Event] getCurrentTarget -- @param self -- @return Node#Node ret (return value: cc.Node) -------------------------------- -- @function [parent=#Event] stopPropagation -- @param self return nil
pg = pg or {} pg.enemy_data_statistics_311 = { [14500901] = { cannon = 55, reload = 150, speed_growth = 0, cannon_growth = 0, rarity = 3, air = 85, torpedo = 0, dodge = 11, durability_growth = 0, antiaircraft = 125, luck = 0, reload_growth = 0, dodge_growth = 156, hit_growth = 210, star = 4, hit = 14, antisub_growth = 0, air_growth = 0, battle_unit_type = 95, base = 252, durability = 7800, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, speed = 18, armor = 0, id = 14500901, antiaircraft_growth = 0, antisub = 0, appear_fx = { "bossguangxiao", "appearQ" }, equipment_list = { 760001, 760002 } }, [14500902] = { cannon = 120, reload = 150, speed_growth = 0, cannon_growth = 0, pilot_ai_template_id = 10001, air = 0, battle_unit_type = 95, dodge = 13, base = 516, durability_growth = 0, antiaircraft = 135, reload_growth = 0, dodge_growth = 156, speed = 20, luck = 0, hit = 14, antisub_growth = 0, air_growth = 0, antiaircraft_growth = 0, torpedo = 80, durability = 11000, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, hit_growth = 210, armor = 0, id = 14500902, antisub = 0, equipment_list = { 760101, 760102, 760103, 760104, 760105, 760106 }, buff_list = { { ID = 50500, LV = 1 } } }, [14500903] = { cannon = 42, reload = 150, speed_growth = 0, cannon_growth = 0, battle_unit_type = 95, air = 75, base = 243, dodge = 11, durability_growth = 0, antiaircraft = 125, speed = 18, reload_growth = 0, dodge_growth = 156, luck = 0, antiaircraft_growth = 0, hit = 14, antisub_growth = 0, air_growth = 0, antisub = 0, torpedo = 0, durability = 7000, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, hit_growth = 210, armor = 0, id = 14500903, appear_fx = { "bossguangxiao", "appearQ" }, equipment_list = { 760201 } }, [14500904] = { cannon = 42, reload = 150, speed_growth = 0, cannon_growth = 0, battle_unit_type = 94, air = 75, base = 244, dodge = 11, durability_growth = 0, antiaircraft = 125, speed = 18, reload_growth = 0, dodge_growth = 156, luck = 5, antiaircraft_growth = 0, hit = 14, antisub_growth = 0, air_growth = 0, antisub = 0, torpedo = 0, durability = 7000, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, hit_growth = 210, armor = 0, id = 14500904, appear_fx = { "bossguangxiao", "appearQ" }, equipment_list = { 760201 } }, [14501001] = { cannon = 5, reload = 150, speed_growth = 0, cannon_growth = 300, pilot_ai_template_id = 20005, air = 0, battle_unit_type = 25, dodge = 0, base = 517, durability_growth = 4000, antiaircraft = 25, reload_growth = 0, dodge_growth = 0, speed = 15, luck = 0, hit = 10, antisub_growth = 0, air_growth = 0, antiaircraft_growth = 800, torpedo = 27, durability = 105, armor_growth = 0, torpedo_growth = 3000, luck_growth = 0, hit_growth = 144, armor = 0, antisub = 0, id = 14501001, equipment_list = { 1100011, 1100091, 1100506 } }, [14501002] = { cannon = 10, reload = 150, speed_growth = 0, cannon_growth = 800, battle_unit_type = 30, air = 0, base = 495, dodge = 0, durability_growth = 5920, antiaircraft = 45, speed = 15, reload_growth = 0, dodge_growth = 0, luck = 0, antiaircraft_growth = 1600, hit = 10, antisub_growth = 0, air_growth = 0, antisub = 0, torpedo = 22, durability = 180, armor_growth = 0, torpedo_growth = 2000, luck_growth = 0, hit_growth = 144, armor = 0, id = 14501002, appear_fx = { "appearsmall" }, equipment_list = { 1100241, 1100271, 1100476, 1002016 } }, [14501003] = { cannon = 12, reload = 150, speed_growth = 0, cannon_growth = 1500, pilot_ai_template_id = 20004, air = 0, battle_unit_type = 35, dodge = 0, base = 496, durability_growth = 16000, antiaircraft = 35, reload_growth = 0, dodge_growth = 0, speed = 15, luck = 0, hit = 10, antisub_growth = 0, air_growth = 0, antiaircraft_growth = 1000, torpedo = 15, durability = 270, armor_growth = 0, torpedo_growth = 1200, luck_growth = 0, hit_growth = 144, armor = 0, id = 14501003, antisub = 0, appear_fx = { "appearsmall" }, equipment_list = { 1100566, 1100371, 1100606, 1100476 } }, [14501004] = { cannon = 35, reload = 150, speed_growth = 0, cannon_growth = 2000, pilot_ai_template_id = 20004, air = 0, battle_unit_type = 60, dodge = 0, base = 497, durability_growth = 33600, antiaircraft = 40, reload_growth = 0, dodge_growth = 0, speed = 15, luck = 0, hit = 10, antisub_growth = 0, air_growth = 0, antiaircraft_growth = 1200, torpedo = 0, durability = 650, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, hit_growth = 144, armor = 0, id = 14501004, antisub = 0, appear_fx = { "appearsmall" }, equipment_list = { 1100256, 1100606, 1100916, 1100921, 1100476 } }, [14501005] = { cannon = 0, reload = 150, speed_growth = 0, cannon_growth = 0, pilot_ai_template_id = 20004, air = 35, battle_unit_type = 65, dodge = 0, base = 498, durability_growth = 27200, antiaircraft = 40, reload_growth = 0, dodge_growth = 0, speed = 15, luck = 0, hit = 10, antisub_growth = 0, air_growth = 1800, antiaircraft_growth = 1200, torpedo = 0, durability = 560, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, hit_growth = 144, armor = 0, id = 14501005, antisub = 0, appear_fx = { "appearsmall" }, equipment_list = { 1100091, 1100956, 1100966, 1100966, 1100966 } }, [14501006] = { cannon = 45, reload = 150, speed_growth = 0, cannon_growth = 0, pilot_ai_template_id = 80000, air = 0, battle_unit_type = 15, dodge = 0, base = 499, durability_growth = 2550, antiaircraft = 0, reload_growth = 0, dodge_growth = 0, speed = 30, luck = 0, hit = 81, antisub_growth = 0, air_growth = 0, antiaircraft_growth = 0, torpedo = 85, durability = 60, armor_growth = 0, torpedo_growth = 900, luck_growth = 0, hit_growth = 1200, armor = 0, id = 14501006, antisub = 0, appear_fx = { "appearsmall" }, equipment_list = { 1000861, 1000906 } }, [14501007] = { cannon = 8, reload = 150, speed_growth = 0, cannon_growth = 310, pilot_ai_template_id = 10002, air = 0, battle_unit_type = 65, dodge = 0, base = 506, durability_growth = 2000, antiaircraft = 0, reload_growth = 0, dodge_growth = 0, speed = 10, luck = 0, hit = 8, antisub_growth = 0, air_growth = 0, antiaircraft_growth = 0, torpedo = 30, durability = 60, armor_growth = 0, torpedo_growth = 2300, luck_growth = 0, hit_growth = 120, armor = 0, antisub = 0, id = 14501007, equipment_list = { 1100696, 1100711 } }, [14501101] = { cannon = 8, reload = 150, speed_growth = 0, cannon_growth = 560, battle_unit_type = 25, air = 0, base = 417, dodge = 0, durability_growth = 13200, antiaircraft = 80, speed = 18, reload_growth = 0, dodge_growth = 0, luck = 0, antiaircraft_growth = 1000, hit = 10, antisub_growth = 0, air_growth = 0, antisub = 0, torpedo = 36, durability = 640, armor_growth = 0, torpedo_growth = 3250, luck_growth = 0, hit_growth = 144, armor = 0, id = 14501101, equipment_list = { 1002002, 1002007, 1002012 } }, [14501102] = { cannon = 16, reload = 150, speed_growth = 0, cannon_growth = 880, battle_unit_type = 30, air = 0, base = 418, dodge = 0, durability_growth = 20800, antiaircraft = 160, speed = 15, reload_growth = 0, dodge_growth = 0, luck = 0, antiaircraft_growth = 2250, hit = 10, antisub_growth = 0, air_growth = 0, antisub = 0, torpedo = 28, durability = 890, armor_growth = 0, torpedo_growth = 2250, luck_growth = 0, hit_growth = 144, armor = 0, id = 14501102, equipment_list = { 1002017, 1002022 } }, [14501103] = { cannon = 21, reload = 150, speed_growth = 0, cannon_growth = 1800, battle_unit_type = 35, air = 0, base = 419, dodge = 0, durability_growth = 36800, antiaircraft = 125, speed = 15, reload_growth = 0, dodge_growth = 0, luck = 0, antiaircraft_growth = 1400, hit = 10, antisub_growth = 0, air_growth = 0, antisub = 0, torpedo = 18, durability = 1700, armor_growth = 0, torpedo_growth = 1250, luck_growth = 0, hit_growth = 144, armor = 0, id = 14501103, equipment_list = { 1002027, 1002032, 1002037 } }, [14501104] = { cannon = 47, reload = 150, speed_growth = 0, cannon_growth = 2200, battle_unit_type = 60, air = 0, base = 420, dodge = 0, durability_growth = 70400, antiaircraft = 135, speed = 15, reload_growth = 0, dodge_growth = 0, luck = 0, antiaircraft_growth = 1400, hit = 10, antisub_growth = 0, air_growth = 0, antisub = 0, torpedo = 0, durability = 5270, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, hit_growth = 144, armor = 0, id = 14501104, equipment_list = { 1002042, 1002047, 1002052 } }, [14501105] = { cannon = 0, reload = 150, speed_growth = 0, cannon_growth = 0, battle_unit_type = 65, air = 55, base = 421, dodge = 0, durability_growth = 65600, antiaircraft = 150, speed = 15, reload_growth = 0, dodge_growth = 0, luck = 0, antiaircraft_growth = 1800, hit = 10, antisub_growth = 0, air_growth = 2000, antisub = 0, torpedo = 0, durability = 4680, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, hit_growth = 144, armor = 0, id = 14501105, bound_bone = { cannon = { { 1.8, 1.14, 0 } }, torpedo = { { 1.07, 0.24, 0 } }, antiaircraft = { { 1.8, 1.14, 0 } }, plane = { { 1.8, 1.14, 0 } } }, equipment_list = { 1002057, 1002062, 1002067, 1002072 } } } return
KEY = "F5"; fn = { window = {}, tab = {}, tabpanel = {}, edit = {}, button = {}, label = {}, gridlist = {}, combobox = {} } local screenW, screenH = guiGetScreenSize() fn.window[1] = guiCreateWindow((screenW - 453) / 2, (screenH - 313) / 2, 453, 313, "Finans ("..KEY..")", false) guiWindowSetSizable(fn.window[1], false) guiWindowSetMovable (fn.window[1], false); guiSetVisible (fn.window[1], false); fn.tabpanel[1] = guiCreateTabPanel(0.02, 0.07, 0.96, 0.89, true, fn.window[1]) fn.tab[1] = guiCreateTab("Havale", fn.tabpanel[1]) fn.label[1] = guiCreateLabel(0.17, 0.33, 0.14, 0.09, "Kullanıcı", true, fn.tab[1]) fn.label[2] = guiCreateLabel(0.17, 0.45, 0.14, 0.09, "Miktar", true, fn.tab[1]) fn.edit[1] = guiCreateEdit(0.33, 0.33, 0.48, 0.09, "", true, fn.tab[1]) fn.edit[2] = guiCreateEdit(0.33, 0.45, 0.48, 0.09, "", true, fn.tab[1]) fn.label[3] = guiCreateLabel(0, 0, 434, 18, "Günlük Limit: ", false, fn.tab[1]) guiSetFont(fn.label[3], "default-bold-small") guiLabelSetHorizontalAlign(fn.label[3], "center", false) guiLabelSetVerticalAlign(fn.label[3], "center") fn.button[1] = guiCreateButton(0.44, 0.64, 0.19, 0.09, "Gönder", true, fn.tab[1]) guiSetProperty(fn.button[1], "NormalTextColour", "FFAAAAAA") fn.tab[2] = guiCreateTab("Kredi", fn.tabpanel[1]) fn.tabpanel[2] = guiCreateTabPanel(0.00, 0.00, 0.97, 0.96, true, fn.tab[2]) fn.tab[3] = guiCreateTab("Kredi Başvurusu", fn.tabpanel[2]) fn.edit[3] = guiCreateEdit(0.18, 0.08, 0.57, 0.12, "", true, fn.tab[3]) fn.label[4] = guiCreateLabel(0.01, 0.09, 0.14, 0.11, "Miktar", true, fn.tab[3]) guiLabelSetVerticalAlign(fn.label[4], "center") fn.combobox[1] = guiCreateComboBox(76, 53, 241, 151, "", false, fn.tab[3]) fn.label[5] = guiCreateLabel(0.01, 0.22, 0.14, 0.11, "Vade", true, fn.tab[3]) guiLabelSetVerticalAlign(fn.label[5], "center") fn.button[2] = guiCreateButton(0.81, 0.23, 0.16, 0.11, "Başvur", true, fn.tab[3]) guiSetProperty(fn.button[2], "NormalTextColour", "FFAAAAAA") fn.tab[4] = guiCreateTab("Kredilerim", fn.tabpanel[2]) fn.gridlist[1] = guiCreateGridList(0.01, 0.02, 0.99, 0.81, true, fn.tab[4]) guiGridListAddColumn(fn.gridlist[1], "Açıklama", 0.35) guiGridListAddColumn(fn.gridlist[1], "Son Ödeme Tarihi", 0.2) guiGridListAddColumn(fn.gridlist[1], "Borç", 0.2) guiGridListAddColumn(fn.gridlist[1], "Taksit Tutarı", 0.2) guiGridListSetSortingEnabled (fn.gridlist[1], false); fn.button[3] = guiCreateButton(0.01, 0.85, 0.25, 0.10, "Borcu öde", true, fn.tab[4]) guiSetProperty(fn.button[3], "NormalTextColour", "FFAAAAAA") fn.button[4] = guiCreateButton(0.73, 0.85, 0.25, 0.10, "Taksidi öde", true, fn.tab[4]) guiSetProperty(fn.button[4], "NormalTextColour", "FFAAAAAA") function ts (name, ...) return triggerServerEvent (name, localPlayer, ...); end gt = function (g, column) if g then local item = guiGridListGetSelectedItem (g); if item == -1 then return false; end return guiGridListGetItemText (g, item, column or 1); end end gd = function (g, column) if g then local item = guiGridListGetSelectedItem (g); if item == -1 then return false; end return guiGridListGetItemData (g, item, column or 1); end end
-- Converted From LST file data\pathfinder\paizo\roleplaying_game\core_rulebook\cr_classes.lst -- From repository https://github.com/pcgen/pcgen at commit 11ceb52482855f2e5f0f6c108c3dc665b12af237 SetSource({ SourceLong="Core Rulebook", SourceShort="CR", SourceWeb="http://paizo.com/store/downloads/pathfinder/pathfinderRPG/v5748btpy88yj", SourceDate="2009-08", }) DefineClass({ Name="Barbarian", ExClass="Ex-Barbarian", HitDie=12, MaxLevel=20, SkillPointsPerLevel=Formula("4"), SourcePage="p.31", Bonuses={ { Category="COMBAT", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Type={ Name="Base", Replace=true, }, Conditions={ function (character, item, sources) return (character.Variables["UseAlternateBABProgression"] == 0) end, }, Variables={ "BASEAB", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/2+2"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Fortitude", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/3"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Reflex", "BASE.Will", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalBAB"] == 1) end, }, Variables={ "ClassBABFull", }, }, { Category="VAR", Formula=Formula("CL"), Variables={ "BarbarianLVL", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Will", }, }, }, Conditions={ function (character, item, sources) return not (character.IsAlignment("LG") or character.IsAlignment("LN") or character.IsAlignment("LE")) or (character.Variables["BypassClassAlignment_Barbarian"] == 1) end, }, Roles={ "Combat", "Skill", }, Types={ "Base", "PC", }, Facts={ ClassType="PC", Abb="Brb", }, Levels={ { Level="1", Abilities={ { Category="Class", Nature="AUTOMATIC", Names={ "Barbarian", }, }, }, }, }, }) DefineClass({ Name="Ex-Barbarian", HitDie=12, MaxLevel=20, SkillPointsPerLevel=Formula("4"), Visible=false, Bonuses={ { Category="COMBAT", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Type={ Name="Base", Replace=true, }, Conditions={ function (character, item, sources) return (character.Variables["UseAlternateBABProgression"] == 0) end, }, Variables={ "BASEAB", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/2+2"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Fortitude", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/3"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Reflex", "BASE.Will", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalBAB"] == 1) end, }, Variables={ "ClassBABFull", }, }, { Category="VAR", Formula=Formula("CL"), Variables={ "BarbarianLVL", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Will", }, }, }, Roles={ "Combat", "Skill", }, Types={ "Base", "PC", }, Facts={ ClassType="PC", Abb="Brb", }, Levels={ { Level="1", Abilities={ { Category="Class", Nature="AUTOMATIC", Names={ "Barbarian", }, }, }, }, }, }) DefineClass({ Name="Bard", HitDie=8, MaxLevel=20, Memorize=false, SkillPointsPerLevel=Formula("6"), SourcePage="p.34", SpellStat="CHA", Bonuses={ { Category="COMBAT", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")*3/4"), Type={ Name="Base", Replace=true, }, Conditions={ function (character, item, sources) return (character.Variables["UseAlternateBABProgression"] == 0) end, }, Variables={ "BASEAB", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/2+2"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Reflex", "BASE.Will", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/3"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalBAB"] == 1) end, }, Variables={ "ClassBABModerate", }, }, { Category="VAR", Formula=Formula("CL"), Variables={ "BardLVL", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Will", }, }, { Category="VAR", Formula=Formula("Caster_Level_Bard-CasterLevelBLBard"), Variables={ "Caster_Level_BL_Stripped_Bard", }, }, { Category="VAR", Formula=Formula("CL+Caster_Level_Bonus+CasterLevelBLBard"), Variables={ "Caster_Level_Bard", }, }, { Category="VAR", Formula=Formula("charbonusto(\"PCLEVEL\",\"Bard\")"), Variables={ "CasterLevelBL_x_Bard", }, }, { Category="VAR", Formula=Formula("Caster_Level_Bard"), Type={ Name="Base", }, Variables={ "Caster_Level_Highest__Arcane", }, }, { Category="VAR", Formula=Formula("Caster_Level_Bard"), Variables={ "Caster_Level_Total__Arcane", }, }, { Category="CASTERLEVEL", Formula=Formula("Caster_Level_BL_Stripped_Bard"), Variables={ "Bard", }, }, }, Roles={ "Skill", }, Types={ "Base", "PC", "SpontaneousArcane", "Spontaneous", }, Facts={ ClassType="PC", Abb="Brd", SpellType="Arcane", }, Levels={ { Level="1", SpellsPerDay={ Formula("0"), Formula("1"), }, SpellsKnown={ Formula("4"), Formula("2"), }, }, { Level="2", SpellsPerDay={ Formula("0"), Formula("2"), }, SpellsKnown={ Formula("5"), Formula("3"), }, }, { Level="3", SpellsPerDay={ Formula("0"), Formula("3"), }, SpellsKnown={ Formula("6"), Formula("4"), }, }, { Level="4", SpellsPerDay={ Formula("0"), Formula("3"), Formula("1"), }, SpellsKnown={ Formula("6"), Formula("4"), Formula("2"), }, }, { Level="5", SpellsPerDay={ Formula("0"), Formula("4"), Formula("2"), }, SpellsKnown={ Formula("6"), Formula("4"), Formula("3"), }, }, { Level="6", SpellsPerDay={ Formula("0"), Formula("4"), Formula("3"), }, SpellsKnown={ Formula("6"), Formula("4"), Formula("4"), }, }, { Level="7", SpellsPerDay={ Formula("0"), Formula("4"), Formula("3"), Formula("1"), }, SpellsKnown={ Formula("6"), Formula("5"), Formula("4"), Formula("2"), }, }, { Level="8", SpellsPerDay={ Formula("0"), Formula("4"), Formula("4"), Formula("2"), }, SpellsKnown={ Formula("6"), Formula("5"), Formula("4"), Formula("3"), }, }, { Level="9", SpellsPerDay={ Formula("0"), Formula("5"), Formula("4"), Formula("3"), }, SpellsKnown={ Formula("6"), Formula("5"), Formula("4"), Formula("4"), }, }, { Level="10", SpellsPerDay={ Formula("0"), Formula("5"), Formula("4"), Formula("3"), Formula("1"), }, SpellsKnown={ Formula("6"), Formula("5"), Formula("5"), Formula("4"), Formula("2"), }, }, { Level="11", SpellsPerDay={ Formula("0"), Formula("5"), Formula("4"), Formula("4"), Formula("2"), }, SpellsKnown={ Formula("6"), Formula("6"), Formula("5"), Formula("4"), Formula("3"), }, }, { Level="12", SpellsPerDay={ Formula("0"), Formula("5"), Formula("5"), Formula("4"), Formula("3"), }, SpellsKnown={ Formula("6"), Formula("6"), Formula("5"), Formula("4"), Formula("4"), }, }, { Level="13", SpellsPerDay={ Formula("0"), Formula("5"), Formula("5"), Formula("4"), Formula("3"), Formula("1"), }, SpellsKnown={ Formula("6"), Formula("6"), Formula("5"), Formula("5"), Formula("4"), Formula("2"), }, }, { Level="14", SpellsPerDay={ Formula("0"), Formula("5"), Formula("5"), Formula("4"), Formula("4"), Formula("2"), }, SpellsKnown={ Formula("6"), Formula("6"), Formula("6"), Formula("5"), Formula("4"), Formula("3"), }, }, { Level="15", SpellsPerDay={ Formula("0"), Formula("5"), Formula("5"), Formula("5"), Formula("4"), Formula("3"), }, SpellsKnown={ Formula("6"), Formula("6"), Formula("6"), Formula("5"), Formula("4"), Formula("4"), }, }, { Level="16", SpellsPerDay={ Formula("0"), Formula("5"), Formula("5"), Formula("5"), Formula("4"), Formula("3"), Formula("1"), }, SpellsKnown={ Formula("6"), Formula("6"), Formula("6"), Formula("5"), Formula("5"), Formula("4"), Formula("2"), }, }, { Level="17", SpellsPerDay={ Formula("0"), Formula("5"), Formula("5"), Formula("5"), Formula("4"), Formula("4"), Formula("2"), }, SpellsKnown={ Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("5"), Formula("4"), Formula("3"), }, }, { Level="18", SpellsPerDay={ Formula("0"), Formula("5"), Formula("5"), Formula("5"), Formula("5"), Formula("4"), Formula("3"), }, SpellsKnown={ Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("5"), Formula("4"), Formula("4"), }, }, { Level="19", SpellsPerDay={ Formula("0"), Formula("5"), Formula("5"), Formula("5"), Formula("5"), Formula("5"), Formula("4"), }, SpellsKnown={ Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("5"), Formula("5"), Formula("4"), }, }, { Level="20", SpellsPerDay={ Formula("0"), Formula("5"), Formula("5"), Formula("5"), Formula("5"), Formula("5"), Formula("5"), }, SpellsKnown={ Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("5"), Formula("5"), }, }, { Level="1", Abilities={ { Category="Class", Nature="AUTOMATIC", Names={ "Bard", }, }, }, }, }, }) DefineClass({ Name="Cleric", HitDie=8, MaxLevel=20, SkillPointsPerLevel=Formula("2"), SourcePage="p.38", SpellStat="WIS", AutomaticKnownSpells={ { Level=0, }, { Level=1, }, { Level=2, }, { Level=3, }, { Level=4, }, { Level=5, }, { Level=6, }, { Level=7, }, { Level=8, }, { Level=9, }, }, Bonuses={ { Category="COMBAT", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")*3/4"), Type={ Name="Base", Replace=true, }, Conditions={ function (character, item, sources) return (character.Variables["UseAlternateBABProgression"] == 0) end, }, Variables={ "BASEAB", }, }, { Category="DOMAIN", Formula=Formula("ClericDomainCount"), Variables={ "NUMBER", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/2+2"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Fortitude", "BASE.Will", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/3"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalBAB"] == 1) end, }, Variables={ "ClassBABModerate", }, }, { Category="VAR", Formula=Formula("CL"), Variables={ "ClericLVL", }, }, { Category="VAR", Formula=Formula("ClericLVL"), Variables={ "DomainLVL", }, }, { Category="VAR", Formula=Formula("2"), Variables={ "ClericDomainCount", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Will", }, }, { Category="VAR", Formula=Formula("Caster_Level_Cleric-CasterLevelBLCleric"), Variables={ "Caster_Level_BL_Stripped_Cleric", }, }, { Category="VAR", Formula=Formula("CL+Caster_Level_Bonus+CasterLevelBLCleric"), Variables={ "Caster_Level_Cleric", }, }, { Category="VAR", Formula=Formula("charbonusto(\"PCLEVEL\",\"Cleric\")"), Variables={ "CasterLevelBL_x_Cleric", }, }, { Category="VAR", Formula=Formula("Caster_Level_Cleric"), Type={ Name="Base", }, Variables={ "Caster_Level_Highest__Divine", }, }, { Category="CASTERLEVEL", Formula=Formula("Caster_Level_BL_Stripped_Cleric"), Variables={ "Cleric", }, }, }, BonusLanguages={ { Name="Abyssal", }, { Name="Celestial", }, { Name="Infernal", }, }, Roles={ "Cleric", }, Types={ "Base", "PC", }, Facts={ ClassType="PC", Abb="Clr", SpellType="Divine", }, Levels={ { Level="1", ProhibitedSpells={ { Alignments={ "Good", }, Conditions={ function (character, item, sources) return (character.Variables["ProhibitSpell_Alignment_Good"] == 1) end, }, }, }, }, { Level="1", ProhibitedSpells={ { Alignments={ "Evil", }, Conditions={ function (character, item, sources) return (character.Variables["ProhibitSpell_Alignment_Evil"] == 1) end, }, }, }, }, { Level="1", ProhibitedSpells={ { Alignments={ "Lawful", }, Conditions={ function (character, item, sources) return (character.Variables["ProhibitSpell_Alignment_Lawful"] == 1) end, }, }, }, }, { Level="1", ProhibitedSpells={ { Alignments={ "Chaotic", }, Conditions={ function (character, item, sources) return (character.Variables["ProhibitSpell_Alignment_Chaotic"] == 1) end, }, }, }, }, { Level="1", Abilities={ { Category="Class", Nature="AUTOMATIC", Names={ "Cleric", }, }, }, }, { Level="Start=1,Repeat=1", Bonuses={ { Category="SKILLPOOL", Formula=Formula("ClericSkillPts"), Variables={ "NUMBER", }, }, }, }, { Level="1", SpellsPerDay={ Formula("3"), Formula("1"), }, }, { Level="2", SpellsPerDay={ Formula("4"), Formula("2"), }, }, { Level="3", SpellsPerDay={ Formula("4"), Formula("2"), Formula("1"), }, }, { Level="4", SpellsPerDay={ Formula("4"), Formula("3"), Formula("2"), }, }, { Level="5", SpellsPerDay={ Formula("4"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="6", SpellsPerDay={ Formula("4"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="7", SpellsPerDay={ Formula("4"), Formula("4"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="8", SpellsPerDay={ Formula("4"), Formula("4"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="9", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="10", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="11", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="12", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="13", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="14", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="15", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="16", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="17", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="18", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="19", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("3"), }, }, { Level="20", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), }, }, }, }) DefineClass({ Name="Druid", HitDie=8, MaxLevel=20, SkillPointsPerLevel=Formula("4"), SourcePage="p.48", SpellStat="WIS", AutomaticKnownSpells={ { Level=0, }, { Level=1, }, { Level=2, }, { Level=3, }, { Level=4, }, { Level=5, }, { Level=6, }, { Level=7, }, { Level=8, }, { Level=9, }, }, AutomaticLanguages={ { Selector=function (language) return stringMatch(language.Name, "Druidic") end, }, }, Bonuses={ { Category="COMBAT", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")*3/4"), Type={ Name="Base", Replace=true, }, Conditions={ function (character, item, sources) return (character.Variables["UseAlternateBABProgression"] == 0) end, }, Variables={ "BASEAB", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/2+2"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Fortitude", "BASE.Will", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/3"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalBAB"] == 1) end, }, Variables={ "ClassBABModerate", }, }, { Category="VAR", Formula=Formula("CL"), Variables={ "DruidLVL", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Will", }, }, { Category="VAR", Formula=Formula("Caster_Level_Druid-CasterLevelBLDruid"), Variables={ "Caster_Level_BL_Stripped_Druid", }, }, { Category="VAR", Formula=Formula("CL+Caster_Level_Bonus+CasterLevelBLDruid"), Variables={ "Caster_Level_Druid", }, }, { Category="VAR", Formula=Formula("charbonusto(\"PCLEVEL\",\"Druid\")"), Variables={ "CasterLevelBL_x_Druid", }, }, { Category="VAR", Formula=Formula("Caster_Level_Druid"), Type={ Name="Base", }, Variables={ "Caster_Level_Highest__Divine", }, }, { Category="CASTERLEVEL", Formula=Formula("Caster_Level_BL_Stripped_Druid"), Variables={ "Druid", }, }, }, BonusLanguages={ { Name="Sylvan", }, }, Conditions={ function (character, item, sources) return character.IsAlignment("NG") or character.IsAlignment("LN") or character.IsAlignment("TN") or character.IsAlignment("CN") or character.IsAlignment("NE") or (character.Variables["BypassClassAlignment_Druid"] == 1) end, }, Roles={ "Druid", }, Types={ "Base", "PC", }, Facts={ ClassType="PC", Abb="Drd", SpellType="Divine", }, Levels={ { Level="1", Abilities={ { Category="Class", Nature="AUTOMATIC", Names={ "Druid", }, }, }, }, { Level="1", ProhibitedSpells={ { Alignments={ "Good", }, Conditions={ function (character, item, sources) return (character.Variables["ProhibitSpell_Alignment_Good"] == 1) end, }, }, }, }, { Level="1", ProhibitedSpells={ { Alignments={ "Evil", }, Conditions={ function (character, item, sources) return (character.Variables["ProhibitSpell_Alignment_Evil"] == 1) end, }, }, }, }, { Level="1", ProhibitedSpells={ { Alignments={ "Lawful", }, Conditions={ function (character, item, sources) return (character.Variables["ProhibitSpell_Alignment_Lawful"] == 1) end, }, }, }, }, { Level="1", ProhibitedSpells={ { Alignments={ "Chaotic", }, Conditions={ function (character, item, sources) return (character.Variables["ProhibitSpell_Alignment_Chaotic"] == 1) end, }, }, }, }, { Level="0", Domains={ { Names={ "Air", }, Conditions={ function (character, item, sources) return character.HasAnyAbility(function (ability) if ability.Category ~= "Special Ability" then return false end if ability.Name == "Druid Domain ~ Air" then return true end return false end) end, }, }, }, }, { Level="0", Domains={ { Names={ "Animal", }, Conditions={ function (character, item, sources) return character.HasAnyAbility(function (ability) if ability.Category ~= "Special Ability" then return false end if ability.Name == "Druid Domain ~ Animal" then return true end return false end) end, }, }, }, }, { Level="0", Domains={ { Names={ "Earth", }, Conditions={ function (character, item, sources) return character.HasAnyAbility(function (ability) if ability.Category ~= "Special Ability" then return false end if ability.Name == "Druid Domain ~ Earth" then return true end return false end) end, }, }, }, }, { Level="0", Domains={ { Names={ "Fire", }, Conditions={ function (character, item, sources) return character.HasAnyAbility(function (ability) if ability.Category ~= "Special Ability" then return false end if ability.Name == "Druid Domain ~ Fire" then return true end return false end) end, }, }, }, }, { Level="0", Domains={ { Names={ "Plant", }, Conditions={ function (character, item, sources) return character.HasAnyAbility(function (ability) if ability.Category ~= "Special Ability" then return false end if ability.Name == "Druid Domain ~ Plant" then return true end return false end) end, }, }, }, }, { Level="0", Domains={ { Names={ "Water", }, Conditions={ function (character, item, sources) return character.HasAnyAbility(function (ability) if ability.Category ~= "Special Ability" then return false end if ability.Name == "Druid Domain ~ Water" then return true end return false end) end, }, }, }, }, { Level="0", Domains={ { Names={ "Weather", }, Conditions={ function (character, item, sources) return character.HasAnyAbility(function (ability) if ability.Category ~= "Special Ability" then return false end if ability.Name == "Druid Domain ~ Weather" then return true end return false end) end, }, }, }, }, { Level="1", SpellsPerDay={ Formula("3"), Formula("1"), }, }, { Level="2", SpellsPerDay={ Formula("4"), Formula("2"), }, }, { Level="3", SpellsPerDay={ Formula("4"), Formula("2"), Formula("1"), }, }, { Level="4", SpellsPerDay={ Formula("4"), Formula("3"), Formula("2"), }, }, { Level="5", SpellsPerDay={ Formula("4"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="6", SpellsPerDay={ Formula("4"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="7", SpellsPerDay={ Formula("4"), Formula("4"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="8", SpellsPerDay={ Formula("4"), Formula("4"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="9", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="10", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="11", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="12", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="13", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="14", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="15", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="16", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="17", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="18", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="19", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("3"), }, }, { Level="20", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), }, }, }, }) DefineClass({ Name="Fighter", HitDie=10, MaxLevel=20, SkillPointsPerLevel=Formula("2"), SourcePage="p.55", Bonuses={ { Category="COMBAT", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Type={ Name="Base", Replace=true, }, Conditions={ function (character, item, sources) return (character.Variables["UseAlternateBABProgression"] == 0) end, }, Variables={ "BASEAB", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/2+2"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Fortitude", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/3"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Reflex", "BASE.Will", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalBAB"] == 1) end, }, Variables={ "ClassBABFull", }, }, { Category="VAR", Formula=Formula("CL"), Variables={ "FighterLVL", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Will", }, }, }, Roles={ "Combat", "Skill", }, Types={ "Base", "PC", }, Facts={ ClassType="PC", Abb="Ftr", }, Levels={ { Level="1", Abilities={ { Category="Class", Nature="AUTOMATIC", Names={ "Fighter", }, }, }, }, }, }) DefineClass({ Name="Monk", HitDie=10, MaxLevel=20, SkillPointsPerLevel=Formula("4"), SourcePage="p.56", Bonuses={ { Category="VAR", Formula=Formula("1"), Variables={ "FlurryOfBlows", }, }, { Category="VAR", Formula=Formula("CL"), Variables={ "MonkLVL", }, }, { Category="VAR", Formula=Formula("1"), Variables={ "KiPoolWis", }, }, { Category="VAR", Formula=Formula("1"), Variables={ "KiPool", }, }, }, Conditions={ function (character, item, sources) return character.IsAlignment("LG") or character.IsAlignment("LN") or character.IsAlignment("LE") or (character.Variables["BypassClassAlignment_Monk"] == 1) end, }, Roles={ "None", }, Types={ "Base", "PC", }, Facts={ ClassType="PC", Abb="Mnk", }, Levels={ { Level="1", Abilities={ { Category="Class", Nature="AUTOMATIC", Names={ "Monk", }, }, }, }, { Level="1", StartingKitCount=1, StartingKitChoices={ "Monk Flurry of Blows", }, }, }, }) DefineClass({ Name="Paladin", ExClass="Ex-Paladin", HitDie=10, ItemCreationCasterLevel=Formula("CL-3"), MaxLevel=20, SkillPointsPerLevel=Formula("2"), SourcePage="p.60", SpellStat="CHA", Visible=true, AutomaticKnownSpells={ { Level=1, }, { Level=2, }, { Level=3, }, { Level=4, }, }, Bonuses={ { Category="COMBAT", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Type={ Name="Base", Replace=true, }, Conditions={ function (character, item, sources) return (character.Variables["UseAlternateBABProgression"] == 0) end, }, Variables={ "BASEAB", }, }, { Category="DOMAIN", Formula=Formula("PaladinDomainCount"), Variables={ "NUMBER", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/2+2"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Fortitude", "BASE.Will", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/3"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalBAB"] == 1) end, }, Variables={ "ClassBABFull", }, }, { Category="VAR", Formula=Formula("CL"), Variables={ "PaladinLVL", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Will", }, }, { Category="VAR", Formula=Formula("Caster_Level_Paladin-CasterLevelBLPaladin"), Variables={ "Caster_Level_BL_Stripped_Paladin", }, }, { Category="VAR", Formula=Formula("CL+Caster_Level_Bonus-3+CasterLevelBLPaladin"), Variables={ "Caster_Level_Paladin", }, }, { Category="VAR", Formula=Formula("charbonusto(\"PCLEVEL\",\"Paladin\")"), Variables={ "CasterLevelBL_x_Paladin", }, }, { Category="VAR", Formula=Formula("Caster_Level_Paladin"), Type={ Name="Base", }, Variables={ "Caster_Level_Highest__Divine", }, }, { Category="CASTERLEVEL", Formula=Formula("Caster_Level_BL_Stripped_Paladin"), Conditions={ function (character, item, sources) return ((character.GetLevelOfClass("Paladin") >= 4)) >= 1 end, }, Variables={ "Paladin", }, }, }, Conditions={ function (character, item, sources) return character.IsAlignment("LG") or (character.Variables["BypassClassAlignment_Paladin"] == 1) end, }, Roles={ "None", }, Types={ "Base", "PC", }, Facts={ ClassType="PC", Abb="Pld", SpellType="Divine", }, Levels={ { Level="1", Abilities={ { Category="Class", Nature="AUTOMATIC", Names={ "Paladin", }, }, }, }, { Level="4", SpellsPerDay={ Formula("0"), Formula("0"), }, }, { Level="5", SpellsPerDay={ Formula("0"), Formula("1"), }, }, { Level="6", SpellsPerDay={ Formula("0"), Formula("1"), }, }, { Level="7", SpellsPerDay={ Formula("0"), Formula("1"), Formula("0"), }, }, { Level="8", SpellsPerDay={ Formula("0"), Formula("1"), Formula("1"), }, }, { Level="9", SpellsPerDay={ Formula("0"), Formula("2"), Formula("1"), }, }, { Level="10", SpellsPerDay={ Formula("0"), Formula("2"), Formula("1"), Formula("0"), }, }, { Level="11", SpellsPerDay={ Formula("0"), Formula("2"), Formula("1"), Formula("1"), }, }, { Level="12", SpellsPerDay={ Formula("0"), Formula("2"), Formula("2"), Formula("1"), }, }, { Level="13", SpellsPerDay={ Formula("0"), Formula("3"), Formula("2"), Formula("1"), Formula("0"), }, }, { Level="14", SpellsPerDay={ Formula("0"), Formula("3"), Formula("2"), Formula("1"), Formula("1"), }, }, { Level="15", SpellsPerDay={ Formula("0"), Formula("3"), Formula("2"), Formula("2"), Formula("1"), }, }, { Level="16", SpellsPerDay={ Formula("0"), Formula("3"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="17", SpellsPerDay={ Formula("0"), Formula("4"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="18", SpellsPerDay={ Formula("0"), Formula("4"), Formula("3"), Formula("2"), Formula("2"), }, }, { Level="19", SpellsPerDay={ Formula("0"), Formula("4"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="20", SpellsPerDay={ Formula("0"), Formula("4"), Formula("4"), Formula("3"), Formula("3"), }, }, }, }) DefineClass({ Name="Ex-Paladin", HitDie=10, MaxLevel=20, SkillPointsPerLevel=Formula("2"), Visible=false, Bonuses={ { Category="COMBAT", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Type={ Name="Base", Replace=true, }, Conditions={ function (character, item, sources) return (character.Variables["UseAlternateBABProgression"] == 0) end, }, Variables={ "BASEAB", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/2+2"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Fortitude", "BASE.Will", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/3"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalBAB"] == 1) end, }, Variables={ "ClassBABFull", }, }, { Category="VAR", Formula=Formula("CL"), Variables={ "PaladinLVL", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Will", }, }, }, Types={ "Base", "PC", }, Facts={ ClassType="PC", Abb="XPal", }, Levels={ { Level="1", Abilities={ { Category="Class", Nature="AUTOMATIC", Names={ "Paladin", }, }, }, }, { Level="1", Abilities={ { Category="Special Ability", Nature="AUTOMATIC", Names={ "Weapon and Armor Proficiency ~ Paladin", }, Conditions={ function (character, item, sources) return not (character.HasAnyAbility(function (ability) if ability.Category ~= "Archetype" then return false end if ability.IsAnyType("PaladinWeaponProficiencies", "PaladinArmorProficiency", "PaladinArmorProficiencyHeavy", "PaladinArmorProficiencyLight", "PaladinArmorProficiencyMedium", "PaladinArmorProficiency", "PaladinShieldProf", "PaladinShieldProficiency") then return true end return false end)) end, }, }, }, }, { Level="1", Abilities={ { Category="Internal", Nature="AUTOMATIC", Names={ "Weapon Prof ~ Martial", "Weapon Prof ~ Simple", }, Conditions={ function (character, item, sources) return not (character.HasAnyAbility(function (ability) if ability.Category ~= "Archetype" then return false end if ability.IsAnyType("PaladinWeaponProficiencies") then return true end return false end)) end, }, }, }, }, { Level="1", Abilities={ { Category="Internal", Nature="AUTOMATIC", Names={ "Armor Prof ~ Heavy", }, Conditions={ function (character, item, sources) return not (character.HasAnyAbility(function (ability) if ability.Category ~= "Archetype" then return false end if ability.IsAnyType("PaladinArmorProficiency", "PaladinArmorProficiencyHeavy") then return true end return false end)) end, }, }, }, }, { Level="1", Abilities={ { Category="Internal", Nature="AUTOMATIC", Names={ "Armor Prof ~ Light", }, Conditions={ function (character, item, sources) return not (character.HasAnyAbility(function (ability) if ability.Category ~= "Archetype" then return false end if ability.IsAnyType("PaladinArmorProficiency", "PaladinArmorProficiencyLight") then return true end return false end)) end, }, }, }, }, { Level="1", Abilities={ { Category="Internal", Nature="AUTOMATIC", Names={ "Armor Prof ~ Medium", }, Conditions={ function (character, item, sources) return not (character.HasAnyAbility(function (ability) if ability.Category ~= "Archetype" then return false end if ability.IsAnyType("PaladinArmorProficiency", "PaladinArmorProficiencyMedium") then return true end return false end)) end, }, }, }, }, { Level="1", Abilities={ { Category="Internal", Nature="AUTOMATIC", Names={ "Shield Prof", }, Conditions={ function (character, item, sources) return not (character.HasAnyAbility(function (ability) if ability.Category ~= "Archetype" then return false end if ability.IsAnyType("PaladinArmorProficiency", "PaladinShieldProf", "PaladinShieldProficiency") then return true end return false end)) end, }, }, }, }, }, }) DefineClass({ Name="Ranger", HitDie=10, ItemCreationCasterLevel=Formula("CL-3"), MaxLevel=20, SkillPointsPerLevel=Formula("6"), SourcePage="p.64", SpellStat="WIS", Abilities={ { Category="Internal", Nature="AUTOMATIC", Names={ "Class Skills ~ Ranger", }, Conditions={ function (character, item, sources) return not (character.HasAnyAbility(function (ability) if ability.Category ~= "Archetype" then return false end if ability.IsAnyType("RangerClassSkills") then return true end return false end)) end, }, }, }, AutomaticKnownSpells={ { Level=1, }, { Level=2, }, { Level=3, }, { Level=4, }, }, Bonuses={ { Category="COMBAT", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Type={ Name="Base", Replace=true, }, Conditions={ function (character, item, sources) return (character.Variables["UseAlternateBABProgression"] == 0) end, }, Variables={ "BASEAB", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/2+2"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Fortitude", "BASE.Reflex", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/3"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Will", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalBAB"] == 1) end, }, Variables={ "ClassBABFull", }, }, { Category="VAR", Formula=Formula("CL"), Variables={ "RangerLVL", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Will", }, }, { Category="VAR", Formula=Formula("Caster_Level_Ranger-CasterLevelBLRanger"), Variables={ "Caster_Level_BL_Stripped_Ranger", }, }, { Category="VAR", Formula=Formula("CL+Caster_Level_Bonus-3+CasterLevelBLRanger"), Variables={ "Caster_Level_Ranger", }, }, { Category="VAR", Formula=Formula("charbonusto(\"PCLEVEL\",\"Ranger\")"), Variables={ "CasterLevelBL_x_Ranger", }, }, { Category="VAR", Formula=Formula("Caster_Level_Ranger"), Type={ Name="Base", }, Variables={ "Caster_Level_Highest__Divine", }, }, { Category="CASTERLEVEL", Formula=Formula("Caster_Level_Ranger"), Conditions={ function (character, item, sources) return ((character.GetLevelOfClass("Ranger") >= 4)) >= 1 end, }, Variables={ "Ranger", }, }, }, Roles={ "Combat", "Skill", }, Types={ "Base", "PC", }, Facts={ ClassType="PC", Abb="Rgr", SpellType="Divine", }, Levels={ { Level="1", Abilities={ { Category="Class", Nature="AUTOMATIC", Names={ "Ranger", }, }, }, }, { Level="4", SpellsPerDay={ Formula("0"), Formula("0"), }, }, { Level="5", SpellsPerDay={ Formula("0"), Formula("1"), }, }, { Level="6", SpellsPerDay={ Formula("0"), Formula("1"), }, }, { Level="7", SpellsPerDay={ Formula("0"), Formula("1"), Formula("0"), }, }, { Level="8", SpellsPerDay={ Formula("0"), Formula("1"), Formula("1"), }, }, { Level="9", SpellsPerDay={ Formula("0"), Formula("2"), Formula("1"), }, }, { Level="10", SpellsPerDay={ Formula("0"), Formula("2"), Formula("1"), Formula("0"), }, }, { Level="11", SpellsPerDay={ Formula("0"), Formula("2"), Formula("1"), Formula("1"), }, }, { Level="12", SpellsPerDay={ Formula("0"), Formula("2"), Formula("2"), Formula("1"), }, }, { Level="13", SpellsPerDay={ Formula("0"), Formula("3"), Formula("2"), Formula("1"), Formula("0"), }, }, { Level="14", SpellsPerDay={ Formula("0"), Formula("3"), Formula("2"), Formula("1"), Formula("1"), }, }, { Level="15", SpellsPerDay={ Formula("0"), Formula("3"), Formula("2"), Formula("2"), Formula("1"), }, }, { Level="16", SpellsPerDay={ Formula("0"), Formula("3"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="17", SpellsPerDay={ Formula("0"), Formula("4"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="18", SpellsPerDay={ Formula("0"), Formula("4"), Formula("3"), Formula("2"), Formula("2"), }, }, { Level="19", SpellsPerDay={ Formula("0"), Formula("4"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="20", SpellsPerDay={ Formula("0"), Formula("4"), Formula("4"), Formula("3"), Formula("3"), }, }, { Level="1", Bonuses={ { Category="VAR", Formula=Formula("1"), Conditions={ function (character, item, sources) return character.HasAnyAbility(function (ability) if ability.Category ~= "Archetype" then return false end if ability.IsAnyType("RangerHuntersBond") then return true end return false end) end, }, Variables={ "DisableRangerHuntersBond", }, }, }, }, }, }) DefineClass({ Name="Rogue", HitDie=8, MaxLevel=20, SkillPointsPerLevel=Formula("8"), SourcePage="p.67", Bonuses={ { Category="COMBAT", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")*3/4"), Type={ Name="Base", Replace=true, }, Conditions={ function (character, item, sources) return (character.Variables["UseAlternateBABProgression"] == 0) end, }, Variables={ "BASEAB", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/2+2"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Reflex", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/3"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Fortitude", "BASE.Will", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalBAB"] == 1) end, }, Variables={ "ClassBABModerate", }, }, { Category="VAR", Formula=Formula("CL"), Variables={ "RogueLVL", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Will", }, }, }, Roles={ "Skill", }, Types={ "Base", "PC", "Rogue", }, Facts={ ClassType="PC", Abb="Rog", }, Levels={ { Level="1", Abilities={ { Category="Special Ability", Nature="AUTOMATIC", Names={ "Weapon and Armor Proficiency ~ Rogue", }, }, }, }, { Level="1", Abilities={ { Category="Class", Nature="AUTOMATIC", Names={ "Rogue", }, }, }, }, }, }) DefineClass({ Name="Sorcerer", HitDie=6, MaxLevel=20, Memorize=false, SkillPointsPerLevel=Formula("2"), SourcePage="p.70", SpellStat="CHA", Bonuses={ { Category="COMBAT", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/2"), Type={ Name="Base", Replace=true, }, Conditions={ function (character, item, sources) return (character.Variables["UseAlternateBABProgression"] == 0) end, }, Variables={ "BASEAB", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/2+2"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Will", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/3"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Fortitude", "BASE.Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalBAB"] == 1) end, }, Variables={ "ClassBABPoor", }, }, { Category="VAR", Formula=Formula("CL"), Variables={ "SorcererLVL", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Will", }, }, { Category="VAR", Formula=Formula("Caster_Level_Sorcerer-CasterLevelBLSorcerer"), Variables={ "Caster_Level_BL_Stripped_Sorcerer", }, }, { Category="VAR", Formula=Formula("CL+Caster_Level_Bonus+CasterLevelBLSorcerer"), Variables={ "Caster_Level_Sorcerer", }, }, { Category="VAR", Formula=Formula("charbonusto(\"PCLEVEL\",\"Sorcerer\")"), Variables={ "CasterLevelBL_x_Sorcerer", }, }, { Category="VAR", Formula=Formula("Caster_Level_Sorcerer"), Type={ Name="Base", }, Variables={ "Caster_Level_Highest__Arcane", }, }, { Category="VAR", Formula=Formula("Caster_Level_Sorcerer"), Variables={ "Caster_Level_Total__Arcane", }, }, { Category="CASTERLEVEL", Formula=Formula("Caster_Level_BL_Stripped_Sorcerer"), Variables={ "Sorcerer", }, }, }, Roles={ "Sorcerer", }, Types={ "Base", "PC", "SpontaneousArcane", "Spontaneous", }, Facts={ ClassType="PC", Abb="Sor", SpellType="Arcane", }, Levels={ { Level="1", Abilities={ { Category="Class", Nature="AUTOMATIC", Names={ "Sorcerer", }, }, }, }, { Level="1", SpellsPerDay={ Formula("0"), Formula("3"), }, SpellsKnown={ Formula("4"), Formula("2"), }, }, { Level="2", SpellsPerDay={ Formula("0"), Formula("4"), }, SpellsKnown={ Formula("5"), Formula("2"), }, }, { Level="3", SpellsPerDay={ Formula("0"), Formula("5"), }, SpellsKnown={ Formula("5"), Formula("3"), }, }, { Level="4", SpellsPerDay={ Formula("0"), Formula("6"), Formula("3"), }, SpellsKnown={ Formula("6"), Formula("3"), Formula("1"), }, }, { Level="5", SpellsPerDay={ Formula("0"), Formula("6"), Formula("4"), }, SpellsKnown={ Formula("6"), Formula("4"), Formula("2"), }, }, { Level="6", SpellsPerDay={ Formula("0"), Formula("6"), Formula("5"), Formula("3"), }, SpellsKnown={ Formula("7"), Formula("4"), Formula("2"), Formula("1"), }, }, { Level="7", SpellsPerDay={ Formula("0"), Formula("6"), Formula("6"), Formula("4"), }, SpellsKnown={ Formula("7"), Formula("5"), Formula("3"), Formula("2"), }, }, { Level="8", SpellsPerDay={ Formula("0"), Formula("6"), Formula("6"), Formula("5"), Formula("3"), }, SpellsKnown={ Formula("8"), Formula("5"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="9", SpellsPerDay={ Formula("0"), Formula("6"), Formula("6"), Formula("6"), Formula("4"), }, SpellsKnown={ Formula("8"), Formula("5"), Formula("4"), Formula("3"), Formula("2"), }, }, { Level="10", SpellsPerDay={ Formula("0"), Formula("6"), Formula("6"), Formula("6"), Formula("5"), Formula("3"), }, SpellsKnown={ Formula("9"), Formula("5"), Formula("4"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="11", SpellsPerDay={ Formula("0"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("4"), }, SpellsKnown={ Formula("9"), Formula("5"), Formula("5"), Formula("4"), Formula("3"), Formula("2"), }, }, { Level="12", SpellsPerDay={ Formula("0"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("5"), Formula("3"), }, SpellsKnown={ Formula("9"), Formula("5"), Formula("5"), Formula("4"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="13", SpellsPerDay={ Formula("0"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("4"), }, SpellsKnown={ Formula("9"), Formula("5"), Formula("5"), Formula("4"), Formula("4"), Formula("3"), Formula("2"), }, }, { Level="14", SpellsPerDay={ Formula("0"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("5"), Formula("3"), }, SpellsKnown={ Formula("9"), Formula("5"), Formula("5"), Formula("4"), Formula("4"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="15", SpellsPerDay={ Formula("0"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("4"), }, SpellsKnown={ Formula("9"), Formula("5"), Formula("5"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("2"), }, }, { Level="16", SpellsPerDay={ Formula("0"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("5"), Formula("3"), }, SpellsKnown={ Formula("9"), Formula("5"), Formula("5"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="17", SpellsPerDay={ Formula("0"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("4"), }, SpellsKnown={ Formula("9"), Formula("5"), Formula("5"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="18", SpellsPerDay={ Formula("0"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("5"), Formula("3"), }, SpellsKnown={ Formula("9"), Formula("5"), Formula("5"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="19", SpellsPerDay={ Formula("0"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("4"), }, SpellsKnown={ Formula("9"), Formula("5"), Formula("5"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="20", SpellsPerDay={ Formula("0"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), Formula("6"), }, SpellsKnown={ Formula("9"), Formula("5"), Formula("5"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("3"), Formula("3"), Formula("3"), }, }, }, }) DefineClass({ Name="Wizard", AllowBaseClass=false, HitDie=6, MaxLevel=20, SkillPointsPerLevel=Formula("2"), SourcePage="p.77", SpellBook=true, SpellStat="INT", Visible=true, Bonuses={ { Category="COMBAT", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/2"), Type={ Name="Base", Replace=true, }, Conditions={ function (character, item, sources) return (character.Variables["UseAlternateBABProgression"] == 0) end, }, Variables={ "BASEAB", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/2+2"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Will", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/3"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Fortitude", "BASE.Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalBAB"] == 1) end, }, Variables={ "ClassBABPoor", }, }, { Category="VAR", Formula=Formula("CL"), Variables={ "WizardLVL", }, }, { Category="VAR", Formula=Formula("1"), Variables={ "SpellMasteryQualify", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Will", }, }, { Category="VAR", Formula=Formula("Caster_Level_Wizard-CasterLevelBLWizard"), Variables={ "Caster_Level_BL_Stripped_Wizard", }, }, { Category="VAR", Formula=Formula("WizardLVL+Caster_Level_Bonus+CasterLevelBLWizard"), Variables={ "Caster_Level_Wizard", }, }, { Category="VAR", Formula=Formula("charbonusto(\"PCLEVEL\",\"Wizard\")"), Variables={ "CasterLevelBL_x_Wizard", }, }, { Category="VAR", Formula=Formula("Caster_Level_Wizard"), Type={ Name="Base", }, Variables={ "Caster_Level_Highest__Arcane", }, }, { Category="VAR", Formula=Formula("Caster_Level_Wizard"), Variables={ "Caster_Level_Total__Arcane", }, }, { Category="CASTERLEVEL", Formula=Formula("Caster_Level_BL_Stripped_Wizard"), Variables={ "Wizard", }, }, }, Roles={ "Wizard", }, Types={ "Base", "PC", }, Facts={ ClassType="PC", Abb="Wiz", SpellType="Arcane", }, Levels={ { Level="1", Abilities={ { Category="Class", Nature="AUTOMATIC", Names={ "Wizard", }, }, }, }, { Level="1", SpellsPerDay={ Formula("3"), Formula("1"), }, }, { Level="2", SpellsPerDay={ Formula("4"), Formula("2"), }, }, { Level="3", SpellsPerDay={ Formula("4"), Formula("2"), Formula("1"), }, }, { Level="4", SpellsPerDay={ Formula("4"), Formula("3"), Formula("2"), }, }, { Level="5", SpellsPerDay={ Formula("4"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="6", SpellsPerDay={ Formula("4"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="7", SpellsPerDay={ Formula("4"), Formula("4"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="8", SpellsPerDay={ Formula("4"), Formula("4"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="9", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="10", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="11", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="12", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="13", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="14", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="15", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="16", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="17", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="18", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="19", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("3"), Formula("3"), }, }, { Level="20", SpellsPerDay={ Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), Formula("4"), }, }, }, SubClasses={ { Choice={ Kind="SCHOOL", Value="Abjuration", }, Levels={ { Level="1", Abilities={ { Category="Wizard Class Feature", Nature="AUTOMATIC", Names={ "Abjuration School", }, }, }, Conditions={ function (character, item, sources) return (character.Variables["Wizard_CF_ArcaneSchool"] == 0) end, }, }, }, Name="Abjurer", Cost=0, }, { Choice={ Kind="SCHOOL", Value="Conjuration", }, Levels={ { Level="1", Abilities={ { Category="Wizard Class Feature", Nature="AUTOMATIC", Names={ "Conjuration School", }, }, }, Conditions={ function (character, item, sources) return (character.Variables["Wizard_CF_ArcaneSchool"] == 0) end, }, }, }, Name="Conjurer", Cost=0, }, { Choice={ Kind="SCHOOL", Value="Divination", }, Levels={ { Level="1", Abilities={ { Category="Wizard Class Feature", Nature="AUTOMATIC", Names={ "Divination School", }, }, }, Conditions={ function (character, item, sources) return (character.Variables["Wizard_CF_ArcaneSchool"] == 0) end, }, }, }, Name="Diviner", Cost=0, }, { Choice={ Kind="SCHOOL", Value="Enchantment", }, Levels={ { Level="1", Abilities={ { Category="Wizard Class Feature", Nature="AUTOMATIC", Names={ "Enchantment School", }, }, }, Conditions={ function (character, item, sources) return (character.Variables["Wizard_CF_ArcaneSchool"] == 0) end, }, }, }, Name="Enchanter", Cost=0, }, { Choice={ Kind="SCHOOL", Value="Evocation", }, Levels={ { Level="1", Abilities={ { Category="Wizard Class Feature", Nature="AUTOMATIC", Names={ "Evocation School", }, }, }, Conditions={ function (character, item, sources) return (character.Variables["Wizard_CF_ArcaneSchool"] == 0) end, }, }, }, Name="Evoker", Cost=0, }, { Choice={ Kind="SCHOOL", Value="Illusion", }, Levels={ { Level="1", Abilities={ { Category="Wizard Class Feature", Nature="AUTOMATIC", Names={ "Illusion School", }, }, }, Conditions={ function (character, item, sources) return (character.Variables["Wizard_CF_ArcaneSchool"] == 0) end, }, }, }, Name="Illusionist", Cost=0, }, { Choice={ Kind="SCHOOL", Value="Necromancy", }, Levels={ { Level="1", Abilities={ { Category="Wizard Class Feature", Nature="AUTOMATIC", Names={ "Necromancy School", }, }, }, Conditions={ function (character, item, sources) return (character.Variables["Wizard_CF_ArcaneSchool"] == 0) end, }, }, }, Name="Necromancer", Cost=0, }, { Choice={ Kind="SCHOOL", Value="Transmutation", }, Levels={ { Level="1", Abilities={ { Category="Wizard Class Feature", Nature="AUTOMATIC", Names={ "Transmutation School", }, }, }, Conditions={ function (character, item, sources) return (character.Variables["Wizard_CF_ArcaneSchool"] == 0) end, }, }, }, Name="Transmuter", Cost=0, }, { Choice={ }, Levels={ { Level="1", Abilities={ { Category="Wizard Class Feature", Nature="AUTOMATIC", Names={ "Universal School", }, Conditions={ function (character, item, sources) return (character.Variables["Wizard_CF_ArcaneSchool"] == 0) end, function (character, item, sources) return (character.Variables["DisallowWizardArcaneSchoolArchetype"] == 0) end, }, }, }, }, }, Name="Universalist", Cost=0, }, }, }) DefineClass({ Name="Arcane Archer", HitDie=10, MaxLevel=10, SkillPointsPerLevel=Formula("4"), SourcePage="p.374", Bonuses={ { Category="COMBAT", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Type={ Name="Base", Replace=true, }, Conditions={ function (character, item, sources) return (character.Variables["UseAlternateBABProgression"] == 0) end, }, Variables={ "BASEAB", }, }, { Category="SAVE", Formula=Formula("(classlevel(\"APPLIEDAS=NONEPIC\")+1)/3"), Variables={ "BASE.Will", }, }, { Category="SAVE", Formula=Formula("(classlevel(\"APPLIEDAS=NONEPIC\")+1)/2"), Variables={ "BASE.Fortitude", "BASE.Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalBAB"] == 1) end, }, Variables={ "ClassBABFull", }, }, { Category="VAR", Formula=Formula("CL"), Variables={ "ArcaneArcherLVL", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Will", }, }, }, ClassSkills={ "Perception", "Ride", "Stealth", "Survival", }, Conditions={ function (character, item, sources) return 2 <= character.CountAbilities(function (ability) if ability.Category ~= "FEAT" then return false end if ability.Name == "Point-Blank Shot" then return true end if ability.Name == "Precise Shot" then return true end return false end) end, function (character, item, sources) return character.HasAnyAbility(function (ability) if ability.Category ~= "FEAT" then return false end if ability.Name == "Weapon Focus (Longbow)" then return true end if ability.Name == "Weapon Focus (Shortbow)" then return true end return false end) end, function (character, item, sources) return (character.SpellCount("Arcane", 1)) >= 1 end, function (character, item, sources) return character.TotalAttackBonus >= 6 end, }, Types={ "PC", "Prestige", }, Facts={ ClassType="PC", Abb="Arc", }, Levels={ { Level="1", Abilities={ { Category="CLASS", Nature="AUTOMATIC", Names={ "Arcane Archer", }, }, }, }, { Level="2", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, }, }, { Level="3", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, }, }, { Level="4", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, }, }, { Level="6", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, }, }, { Level="7", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, }, }, { Level="8", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, }, }, { Level="10", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, }, }, }, }) DefineClass({ Name="Arcane Trickster", HitDie=6, MaxLevel=10, SkillPointsPerLevel=Formula("4"), SourcePage="p.376", Bonuses={ { Category="COMBAT", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/2"), Type={ Name="Base", Replace=true, }, Conditions={ function (character, item, sources) return (character.Variables["UseAlternateBABProgression"] == 0) end, }, Variables={ "BASEAB", }, }, { Category="SAVE", Formula=Formula("(classlevel(\"APPLIEDAS=NONEPIC\")+1)/3"), Variables={ "BASE.Fortitude", }, }, { Category="SAVE", Formula=Formula("(classlevel(\"APPLIEDAS=NONEPIC\")+1)/2"), Variables={ "BASE.Reflex", "BASE.Will", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalBAB"] == 1) end, }, Variables={ "ClassBABPoor", }, }, { Category="VAR", Formula=Formula("CL"), Variables={ "ArcaneTricksterLVL", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Will", }, }, }, ClassSkills={ "Acrobatics", "Appraise", "Bluff", "Climb", "Diplomacy", "Disable Device", "Disguise", "Escape Artist", "TYPE=Knowledge", "Perception", "Sense Motive", "Sleight of Hand", "Spellcraft", "Stealth", "Swim", }, Conditions={ function (character, item, sources) return character.IsAlignment("NG") or character.IsAlignment("TN") or character.IsAlignment("NE") or character.IsAlignment("CG") or character.IsAlignment("CN") or character.IsAlignment("CE") or (character.Variables["BypassClassAlignment_Arcane_Trickster"] == 1) end, function (character, item, sources) return (character.Skill("Disable Device").ranks >= 4) and (character.Skill("Escape Artist").ranks >= 4) and (character.Skill("Knowledge (Arcana)").ranks >= 4) end, function (character, item, sources) return (countTrue(character.HasSpell("Mage Hand"))) >= 1 end, function (character, item, sources) return (character.SpellCount("Arcane", 2)) >= 1 end, function (character, item, sources) return (character.Variables["SneakAttackDice"] >= 2) end, }, Types={ "PC", "Prestige", }, Facts={ ClassType="PC", Abb="Art", }, Levels={ { Level="1", Add={ { Kind="SpellCasterLevel", }, }, }, { Level="2", Add={ { Kind="SpellCasterLevel", }, }, }, { Level="3", Add={ { Kind="SpellCasterLevel", }, }, }, { Level="4", Add={ { Kind="SpellCasterLevel", }, }, }, { Level="5", Add={ { Kind="SpellCasterLevel", }, }, }, { Level="6", Add={ { Kind="SpellCasterLevel", }, }, }, { Level="7", Add={ { Kind="SpellCasterLevel", }, }, }, { Level="8", Add={ { Kind="SpellCasterLevel", }, }, }, { Level="9", Add={ { Kind="SpellCasterLevel", }, }, }, { Level="10", Add={ { Kind="SpellCasterLevel", }, }, }, { Level="1", Abilities={ { Category="Class", Nature="AUTOMATIC", Names={ "Arcane Trickster", }, }, }, }, }, }) DefineClass({ Name="Assassin", HitDie=8, MaxLevel=10, SkillPointsPerLevel=Formula("4"), SourcePage="p.378", Bonuses={ { Category="COMBAT", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")*3/4"), Type={ Name="Base", Replace=true, }, Conditions={ function (character, item, sources) return (character.Variables["UseAlternateBABProgression"] == 0) end, }, Variables={ "BASEAB", }, }, { Category="SAVE", Formula=Formula("(classlevel(\"APPLIEDAS=NONEPIC\")+1)/2"), Variables={ "BASE.Reflex", }, }, { Category="SAVE", Formula=Formula("(classlevel(\"APPLIEDAS=NONEPIC\")+1)/3"), Variables={ "BASE.Fortitude", "BASE.Will", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalBAB"] == 1) end, }, Variables={ "ClassBABModerate", }, }, { Category="VAR", Formula=Formula("CL"), Variables={ "AssassinLVL", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Will", }, }, }, ClassSkills={ "Acrobatics", "Bluff", "Climb", "Diplomacy", "Disable Device", "Disguise", "Escape Artist", "Intimidate", "Linguistics", "Perception", "Sense Motive", "Sleight of Hand", "Stealth", "Swim", "Use Magic Device", }, Conditions={ function (character, item, sources) return character.IsAlignment("LE") or character.IsAlignment("NE") or character.IsAlignment("CE") or (character.Variables["BypassClassAlignment_Assassin"] == 1) end, function (character, item, sources) return (character.Skill("Disguise").ranks >= 2) and (character.Skill("Stealth").ranks >= 5) end, }, Types={ "PC", "Prestige", }, Facts={ ClassType="PC", Abb="Asn", }, Levels={ { Level="1", Abilities={ { Category="Class", Nature="AUTOMATIC", Names={ "Assassin", }, }, }, }, }, }) DefineClass({ Name="Dragon Disciple", HitDie=12, MaxLevel=10, SkillPointsPerLevel=Formula("2"), SourcePage="p.380", Bonuses={ { Category="COMBAT", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")*3/4"), Type={ Name="Base", Replace=true, }, Conditions={ function (character, item, sources) return (character.Variables["UseAlternateBABProgression"] == 0) end, }, Variables={ "BASEAB", }, }, { Category="SAVE", Formula=Formula("(classlevel(\"APPLIEDAS=NONEPIC\")+1)/2"), Variables={ "BASE.Fortitude", "BASE.Will", }, }, { Category="SAVE", Formula=Formula("(classlevel(\"APPLIEDAS=NONEPIC\")+1)/3"), Variables={ "BASE.Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalBAB"] == 1) end, }, Variables={ "ClassBABFull", }, }, { Category="VAR", Formula=Formula("CL"), Variables={ "DragonDiscipleLVL", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Will", }, }, }, ClassSkills={ "Diplomacy", "Escape Artist", "Fly", "TYPE=Knowledge", "Perception", "Spellcraft", }, Conditions={ function (character, item, sources) return ((character.HasLanguageMatching("Draconic") and 1 or 0)) >= 1 end, function (character, item, sources) return character.Facts["ABILITY"]["QualifiedForDragonDisciple"] == "true" or any(character.Classes, function (class) return class.Memorize == false end) and any(character.Classes, function (class) class.IsType("Arcane") end) and not (((character.GetLevelOfClass("Sorcerer") >= 1)) >= 1) or ((character.GetLevelOfClass("Sorcerer") >= 1)) >= 1 and character.HasAnyAbility(function (ability) if ability.Category ~= "Special Ability" then return false end if ability.Name == "Sorcerer Bloodline ~ Draconic" then return true end return false end) end, function (character, item, sources) return not ((any(character.Race.RaceTypes, function (type) stringMatch(type, "Dragon") end))) end, function (character, item, sources) return (character.Skill("Knowledge (Arcana)").ranks >= 5) end, function (character, item, sources) return not ((any(character.Templates, function (template) return stringMatch(template.Name, "Half Dragon") end))) end, }, Types={ "PC", "Prestige", }, Facts={ ClassType="PC", Abb="DrD", }, Levels={ { Level="2", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, }, }, { Level="3", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, }, }, { Level="4", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, }, }, { Level="6", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, }, }, { Level="7", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, }, }, { Level="8", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, }, }, { Level="10", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, }, }, { Level="1", Abilities={ { Category="Class", Nature="AUTOMATIC", Names={ "Dragon Disciple", }, }, }, }, }, }) DefineClass({ Name="Duelist", HitDie=10, MaxLevel=10, SkillPointsPerLevel=Formula("4"), SourcePage="p.382", Bonuses={ { Category="COMBAT", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Type={ Name="Base", Replace=true, }, Conditions={ function (character, item, sources) return (character.Variables["UseAlternateBABProgression"] == 0) end, }, Variables={ "BASEAB", }, }, { Category="SAVE", Formula=Formula("(classlevel(\"APPLIEDAS=NONEPIC\")+1)/2"), Variables={ "BASE.Reflex", }, }, { Category="SAVE", Formula=Formula("(classlevel(\"APPLIEDAS=NONEPIC\")+1)/3"), Variables={ "BASE.Fortitude", "BASE.Will", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalBAB"] == 1) end, }, Variables={ "ClassBABFull", }, }, { Category="VAR", Formula=Formula("CL"), Variables={ "DuelistLVL", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Will", }, }, }, ClassSkills={ "Acrobatics", "Bluff", "Escape Artist", "Perception", "TYPE=Perform", "Sense Motive", }, Conditions={ function (character, item, sources) return 3 <= character.CountAbilities(function (ability) if ability.Category ~= "FEAT" then return false end if ability.Name == "Dodge" then return true end if ability.Name == "Mobility" then return true end if ability.Name == "Weapon Finesse" then return true end return false end) end, function (character, item, sources) return (character.Skill("Acrobatics").ranks >= 2) and (character.BestSkillOfType("Perform").ranks >= 2) end, function (character, item, sources) return character.TotalAttackBonus >= 6 end, }, Types={ "PC", "Prestige", }, Facts={ ClassType="PC", Abb="Dul", }, Levels={ { Level="1", Abilities={ { Category="Class", Nature="AUTOMATIC", Names={ "Duelist", }, }, }, }, }, }) DefineClass({ Name="Eldritch Knight", HitDie=10, MaxLevel=10, SkillPointsPerLevel=Formula("2"), SourcePage="p.384", Bonuses={ { Category="COMBAT", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Type={ Name="Base", Replace=true, }, Conditions={ function (character, item, sources) return (character.Variables["UseAlternateBABProgression"] == 0) end, }, Variables={ "BASEAB", }, }, { Category="SAVE", Formula=Formula("(classlevel(\"APPLIEDAS=NONEPIC\")+1)/2"), Variables={ "BASE.Fortitude", }, }, { Category="SAVE", Formula=Formula("(classlevel(\"APPLIEDAS=NONEPIC\")+1)/3"), Variables={ "BASE.Reflex", "BASE.Will", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalBAB"] == 1) end, }, Variables={ "ClassBABFull", }, }, { Category="VAR", Formula=Formula("CL"), Variables={ "EldritchKnightLVL", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Will", }, }, }, ClassSkills={ "Climb", "Knowledge (Arcana)", "Knowledge (Nobility)", "Linguistics", "Ride", "Sense Motive", "Spellcraft", "Swim", }, Conditions={ function (character, item, sources) return character.HasAnyAbility(function (ability) if ability.Category ~= "Internal" then return false end if ability.Name == "Weapon Prof ~ Martial" then return true end return false end) end, function (character, item, sources) return (character.SpellCount("Arcane", 3)) >= 1 end, }, Types={ "PC", "Prestige", }, Facts={ ClassType="PC", Abb="Elk", }, Levels={ { Level="2", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, }, }, { Level="3", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, }, }, { Level="4", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, }, }, { Level="5", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, }, }, { Level="6", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, }, }, { Level="7", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, }, }, { Level="8", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, }, }, { Level="9", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, }, }, { Level="10", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, }, }, { Level="1", Abilities={ { Category="Class", Nature="AUTOMATIC", Names={ "Eldritch Knight", }, }, }, }, }, }) DefineClass({ Name="Loremaster", HitDie=6, MaxLevel=10, SkillPointsPerLevel=Formula("4"), SourcePage="p.385", Bonuses={ { Category="COMBAT", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/2"), Type={ Name="Base", Replace=true, }, Conditions={ function (character, item, sources) return (character.Variables["UseAlternateBABProgression"] == 0) end, }, Variables={ "BASEAB", }, }, { Category="SAVE", Formula=Formula("(classlevel(\"APPLIEDAS=NONEPIC\")+1)/2"), Variables={ "BASE.Will", }, }, { Category="SAVE", Formula=Formula("(classlevel(\"APPLIEDAS=NONEPIC\")+1)/3"), Variables={ "BASE.Fortitude", "BASE.Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalBAB"] == 1) end, }, Variables={ "ClassBABPoor", }, }, { Category="VAR", Formula=Formula("CL"), Variables={ "LoremasterLVL", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Will", }, }, }, ClassSkills={ "Appraise", "Diplomacy", "Handle Animal", "Heal", "TYPE=Knowledge", "Linguistics", "TYPE=Perform", "Spellcraft", "Use Magic Device", }, Conditions={ function (character, item, sources) return character.HasAnyAbility(function (ability) if ability.Category ~= "FEAT" then return false end if ability.Name == "Skill Focus (Knowledge%)" then return true end return false end) end, function (character, item, sources) return 3 <= character.CountAbilities(function (ability) if ability.Category ~= "FEAT" then return false end if ability.Name == "TYPE=Metamagic" then return true end if ability.Name == "TYPE=ItemCreation" then return true end return false end) end, function (character, item, sources) return (character.BestSkillOfType("Knowledge").ranks >= 7) and (character.BestSkillOfType("Knowledge").ranks >= 7) end, function (character, item, sources) return ((#filter(character.SpellsKnown, function (spell) return spell.School == "Divination" and spell.Level >= 3 end))) >= 1 end, function (character, item, sources) return ((#filter(character.SpellsKnown, function (spell) return spell.School == "Divination" and spell.Level >= 0 end))) >= 7 end, }, Types={ "PC", "Prestige", }, Facts={ ClassType="PC", Abb="Lor", }, Levels={ { Level="1", Add={ { Kind="SpellCasterLevel", }, }, }, { Level="2", Add={ { Kind="SpellCasterLevel", }, }, }, { Level="3", Add={ { Kind="SpellCasterLevel", }, }, }, { Level="4", Add={ { Kind="SpellCasterLevel", }, }, }, { Level="5", Add={ { Kind="SpellCasterLevel", }, }, }, { Level="6", Add={ { Kind="SpellCasterLevel", }, }, }, { Level="7", Add={ { Kind="SpellCasterLevel", }, }, }, { Level="8", Add={ { Kind="SpellCasterLevel", }, }, }, { Level="9", Add={ { Kind="SpellCasterLevel", }, }, }, { Level="10", Add={ { Kind="SpellCasterLevel", }, }, }, { Level="1", Abilities={ { Category="Class", Nature="AUTOMATIC", Names={ "Loremaster", }, }, }, }, }, }) DefineClass({ Name="Mystic Theurge", HitDie=6, MaxLevel=10, SkillPointsPerLevel=Formula("2"), SourcePage="p.387", Bonuses={ { Category="COMBAT", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/2"), Type={ Name="Base", Replace=true, }, Conditions={ function (character, item, sources) return (character.Variables["UseAlternateBABProgression"] == 0) end, }, Variables={ "BASEAB", }, }, { Category="SAVE", Formula=Formula("(classlevel(\"APPLIEDAS=NONEPIC\")+1)/2"), Variables={ "BASE.Will", }, }, { Category="SAVE", Formula=Formula("(classlevel(\"APPLIEDAS=NONEPIC\")+1)/3"), Variables={ "BASE.Fortitude", "BASE.Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalBAB"] == 1) end, }, Variables={ "ClassBABPoor", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Will", }, }, }, ClassSkills={ "Knowledge (Arcana)", "Knowledge (Religion)", "Sense Motive", "Spellcraft", }, Conditions={ function (character, item, sources) return (character.Skill("Knowledge (Arcana)").ranks >= 3) and (character.Skill("Knowledge (Religion)").ranks >= 3) end, function (character, item, sources) return (character.SpellCount("Divine", 2)) >= 1 end, function (character, item, sources) return (character.SpellCount("Arcane", 2)) >= 1 end, }, Types={ "PC", "Prestige", }, Facts={ ClassType="PC", Abb="Myt", }, Levels={ { Level="1", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, { Kind="SpellCasterLevel", Type="Divine", }, }, }, { Level="2", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, { Kind="SpellCasterLevel", Type="Divine", }, }, }, { Level="3", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, { Kind="SpellCasterLevel", Type="Divine", }, }, }, { Level="4", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, { Kind="SpellCasterLevel", Type="Divine", }, }, }, { Level="5", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, { Kind="SpellCasterLevel", Type="Divine", }, }, }, { Level="6", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, { Kind="SpellCasterLevel", Type="Divine", }, }, }, { Level="7", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, { Kind="SpellCasterLevel", Type="Divine", }, }, }, { Level="8", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, { Kind="SpellCasterLevel", Type="Divine", }, }, }, { Level="9", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, { Kind="SpellCasterLevel", Type="Divine", }, }, }, { Level="10", Add={ { Kind="SpellCasterLevel", Type="Arcane", }, { Kind="SpellCasterLevel", Type="Divine", }, }, }, { Level="1", Abilities={ { Category="Class", Nature="AUTOMATIC", Names={ "Mystic Theurge", }, }, }, }, }, }) DefineClass({ Name="Pathfinder Chronicler", HitDie=8, MaxLevel=10, SkillPointsPerLevel=Formula("8"), SourcePage="p.388", Bonuses={ { Category="COMBAT", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")*3/4"), Type={ Name="Base", Replace=true, }, Conditions={ function (character, item, sources) return (character.Variables["UseAlternateBABProgression"] == 0) end, }, Variables={ "BASEAB", }, }, { Category="SAVE", Formula=Formula("(classlevel(\"APPLIEDAS=NONEPIC\")+1)/2"), Variables={ "BASE.Will", }, }, { Category="SAVE", Formula=Formula("(classlevel(\"APPLIEDAS=NONEPIC\")+1)/3"), Variables={ "BASE.Reflex", "BASE.Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalBAB"] == 1) end, }, Variables={ "ClassBABModerate", }, }, { Category="VAR", Formula=Formula("CL"), Variables={ "PathfinderChroniclerLVL", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Will", }, }, }, ClassSkills={ "Appraise", "Bluff", "Diplomacy", "Disguise", "Escape Artist", "Intimidate", "TYPE=Knowledge", "Linguistics", "Perception", "TYPE=Perform", "Ride", "Sense Motive", "Sleight of Hand", "Survival", "Use Magic Device", }, Conditions={ function (character, item, sources) return (character.Skill("Linguistics").ranks >= 3) and (character.Skill("Perform (Oratory)").ranks >= 5) and (character.Skill("Profession (Scribe)").ranks >= 5) end, }, Types={ "PC", "Prestige", }, Facts={ ClassType="PC", Abb="PfC", }, Levels={ { Level="1", Abilities={ { Category="Class", Nature="AUTOMATIC", Names={ "Pathfinder Chronicler", }, }, }, }, }, }) DefineClass({ Name="Shadowdancer", HitDie=8, MaxLevel=10, SkillPointsPerLevel=Formula("6"), SourcePage="p.391", Bonuses={ { Category="COMBAT", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")*3/4"), Type={ Name="Base", Replace=true, }, Conditions={ function (character, item, sources) return (character.Variables["UseAlternateBABProgression"] == 0) end, }, Variables={ "BASEAB", }, }, { Category="SAVE", Formula=Formula("(classlevel(\"APPLIEDAS=NONEPIC\")+1)/2"), Variables={ "BASE.Reflex", }, }, { Category="SAVE", Formula=Formula("(classlevel(\"APPLIEDAS=NONEPIC\")+1)/3"), Variables={ "BASE.Fortitude", "BASE.Will", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalBAB"] == 1) end, }, Variables={ "ClassBABModerate", }, }, { Category="VAR", Formula=Formula("CL"), Variables={ "ShadowdancerLVL", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Will", }, }, }, ClassSkills={ "Acrobatics", "Bluff", "Diplomacy", "Disguise", "Escape Artist", "Perception", "TYPE=Perform", "Sleight of Hand", "Stealth", }, Conditions={ function (character, item, sources) return 3 <= character.CountAbilities(function (ability) if ability.Category ~= "FEAT" then return false end if ability.Name == "Combat Reflexes" then return true end if ability.Name == "Dodge" then return true end if ability.Name == "Mobility" then return true end return false end) end, function (character, item, sources) return (character.Skill("Stealth").ranks >= 5) and (character.Skill("Perform (Dance)").ranks >= 2) end, }, Types={ "PC", "Prestige", }, Facts={ ClassType="PC", Abb="Shd", }, Levels={ { Level="1", Abilities={ { Category="Class", Nature="AUTOMATIC", Names={ "Shadowdancer", }, }, }, }, }, }) DefineClass({ Name="Adept", HitDie=6, MaxLevel=20, SkillPointsPerLevel=Formula("2"), SourcePage="p.448", SpellListChoiceCount=1, SpellStat="WIS", AutomaticKnownSpells={ { Level=0, }, { Level=1, }, { Level=2, }, { Level=3, }, { Level=4, }, { Level=5, }, }, Bonuses={ { Category="COMBAT", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/2"), Type={ Name="Base", Replace=true, }, Conditions={ function (character, item, sources) return (character.Variables["UseAlternateBABProgression"] == 0) end, }, Variables={ "BASEAB", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/3"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Fortitude", "BASE.Reflex", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/2+2"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Will", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalBAB"] == 1) end, }, Variables={ "ClassBABPoor", }, }, { Category="VAR", Formula=Formula("CL"), Variables={ "AdeptLVL", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Will", }, }, { Category="VAR", Formula=Formula("Caster_Level_Adept-CasterLevelBLAdept"), Variables={ "Caster_Level_BL_Stripped_Adept", }, }, { Category="VAR", Formula=Formula("AdeptLVL+Caster_Level_Bonus+CasterLevelBLAdept"), Variables={ "Caster_Level_Adept", }, }, { Category="VAR", Formula=Formula("charbonusto(\"PCLEVEL\",\"Adept\")"), Variables={ "CasterLevelBL_x_Adept", }, }, { Category="VAR", Formula=Formula("Caster_Level_Adept"), Type={ Name="Base", }, Variables={ "Caster_Level_Highest__Divine", }, }, { Category="CASTERLEVEL", Formula=Formula("Caster_Level_BL_Stripped_Adept"), Variables={ "Adept", }, }, }, ClassSkills={ "TYPE=Craft", "Handle Animal", "Heal", "TYPE=Knowledge", "TYPE=Profession", "Spellcraft", "Survival", }, SpellListChoices={ "Adept", }, Types={ "Base", "NPC", }, Facts={ ClassType="NPC", Abb="Adp", SpellType="Divine", }, Levels={ { Level="1", SpellLists={ { Kind="Class", Name="Adept", Levels={ { SpellLevel=0, Spells={ "Create Water", "Detect Magic", "Ghost Sound", "Guidance", "Light", "Mending", "Purify Food and Drink", "Read Magic", "Stabilize", "Touch of Fatigue", }, }, }, }, }, }, { Level="1", SpellLists={ { Kind="Class", Name="Adept", Levels={ { SpellLevel=1, Spells={ "Bless", "Burning Hands", "Cause Fear", "Command", "Comprehend Languages", "Cure Light Wounds", "Detect Chaos", "Detect Evil", "Detect Good", "Detect Law", "Endure Elements", "Obscuring Mist", "Protection from Chaos", "Protection from Evil", "Protection from Good", "Protection from Law", "Sleep", }, }, }, }, }, }, { Level="1", SpellLists={ { Kind="Class", Name="Adept", Levels={ { SpellLevel=2, Spells={ "Aid", "Animal Trance", "Bear's Endurance", "Bull's Strength", "Cat's Grace", "Cure Moderate Wounds", "Darkness", "Delay Poison", "Invisibility", "Mirror Image", "Resist Energy", "Scorching Ray", "See Invisibility", "Web", }, }, }, }, }, }, { Level="1", SpellLists={ { Kind="Class", Name="Adept", Levels={ { SpellLevel=3, Spells={ "Animate Dead", "Bestow Curse", "Contagion", "Continual Flame", "Cure Serious Wounds", "Daylight", "Deeper Darkness", "Lightning Bolt", "Neutralize Poison", "Remove Curse", "Remove Disease", "Tongues", }, }, }, }, }, }, { Level="1", SpellLists={ { Kind="Class", Name="Adept", Levels={ { SpellLevel=4, Spells={ "Cure Critical Wounds", "Minor Creation", "Polymorph", "Restoration", "Stoneskin", "Wall of Fire", }, }, }, }, }, }, { Level="1", SpellLists={ { Kind="Class", Name="Adept", Levels={ { SpellLevel=5, Spells={ "Baleful Polymorph", "Break Enchantment", "Commune", "Heal", "Major Creation", "Raise Dead", "True Seeing", "Wall of Stone", }, }, }, }, }, }, { Level="1", Abilities={ { Category="Special Ability", Nature="AUTOMATIC", Names={ "All Automatic Proficiencies", }, }, { Category="FEAT", Nature="AUTOMATIC", Names={ "Simple Weapon Proficiency", }, }, }, }, { Level="1", SpellsPerDay={ Formula("3"), Formula("1"), }, }, { Level="2", SpellsPerDay={ Formula("3"), Formula("1"), }, Abilities={ { Category="Special Ability", Nature="AUTOMATIC", Names={ "Arcane Bond ~ Familiar", }, }, }, Bonuses={ { Category="VAR", Formula=Formula("CL"), Variables={ "FamiliarMasterLVL", }, }, }, }, { Level="3", SpellsPerDay={ Formula("3"), Formula("2"), }, }, { Level="4", SpellsPerDay={ Formula("3"), Formula("2"), Formula("0"), }, }, { Level="5", SpellsPerDay={ Formula("3"), Formula("2"), Formula("1"), }, }, { Level="6", SpellsPerDay={ Formula("3"), Formula("2"), Formula("1"), }, }, { Level="7", SpellsPerDay={ Formula("3"), Formula("3"), Formula("2"), }, }, { Level="8", SpellsPerDay={ Formula("3"), Formula("3"), Formula("2"), Formula("0"), }, }, { Level="9", SpellsPerDay={ Formula("3"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="10", SpellsPerDay={ Formula("3"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="11", SpellsPerDay={ Formula("3"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="12", SpellsPerDay={ Formula("3"), Formula("3"), Formula("3"), Formula("2"), Formula("0"), }, }, { Level="13", SpellsPerDay={ Formula("3"), Formula("3"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="14", SpellsPerDay={ Formula("3"), Formula("3"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="15", SpellsPerDay={ Formula("3"), Formula("3"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="16", SpellsPerDay={ Formula("3"), Formula("3"), Formula("3"), Formula("3"), Formula("2"), Formula("0"), }, }, { Level="17", SpellsPerDay={ Formula("3"), Formula("3"), Formula("3"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="18", SpellsPerDay={ Formula("3"), Formula("3"), Formula("3"), Formula("3"), Formula("2"), Formula("1"), }, }, { Level="19", SpellsPerDay={ Formula("3"), Formula("3"), Formula("3"), Formula("3"), Formula("3"), Formula("2"), }, }, { Level="20", SpellsPerDay={ Formula("3"), Formula("3"), Formula("3"), Formula("3"), Formula("3"), Formula("2"), }, }, }, }) DefineClass({ Name="Aristocrat", HitDie=8, MaxLevel=20, SkillPointsPerLevel=Formula("4"), SourcePage="p.449", Bonuses={ { Category="COMBAT", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")*3/4"), Type={ Name="Base", Replace=true, }, Conditions={ function (character, item, sources) return (character.Variables["UseAlternateBABProgression"] == 0) end, }, Variables={ "BASEAB", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/3"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Fortitude", "BASE.Reflex", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/2+2"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Will", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalBAB"] == 1) end, }, Variables={ "ClassBABModerate", }, }, { Category="VAR", Formula=Formula("CL"), Variables={ "AristocratLVL", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Will", }, }, }, ClassSkills={ "Appraise", "Bluff", "TYPE=Craft", "Diplomacy", "Disguise", "Handle Animal", "Intimidate", "TYPE=Knowledge", "Linguistics", "Perception", "TYPE=Perform", "TYPE=Profession", "Ride", "Sense Motive", "Swim", "Survival", }, Types={ "Base", "NPC", }, Facts={ ClassType="NPC", Abb="Ari", }, Levels={ { Level="1", Abilities={ { Category="Special Ability", Nature="AUTOMATIC", Names={ "All Automatic Proficiencies", "All Martial Weapon Proficiencies", }, }, { Category="FEAT", Nature="AUTOMATIC", Names={ "Martial Weapon Proficiency Output", "Simple Weapon Proficiency", }, }, }, }, { Level="1", Abilities={ { Category="FEAT", Nature="AUTOMATIC", Names={ "Armor Proficiency (Heavy)", "Armor Proficiency (Light)", "Armor Proficiency (Medium)", }, }, }, }, { Level="1", Abilities={ { Category="FEAT", Nature="AUTOMATIC", Names={ "Shield Proficiency", "Tower Shield Proficiency", }, }, }, }, }, }) DefineClass({ Name="Commoner", HitDie=6, MaxLevel=20, SkillPointsPerLevel=Formula("2"), SourcePage="p.449", Bonuses={ { Category="COMBAT", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/2"), Type={ Name="Base", Replace=true, }, Conditions={ function (character, item, sources) return (character.Variables["UseAlternateBABProgression"] == 0) end, }, Variables={ "BASEAB", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/3"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Fortitude", "BASE.Reflex", "BASE.Will", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalBAB"] == 1) end, }, Variables={ "ClassBABPoor", }, }, { Category="VAR", Formula=Formula("CL"), Variables={ "CommonerLVL", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Will", }, }, }, ClassSkills={ "Climb", "TYPE=Craft", "Handle Animal", "Perception", "TYPE=Profession", "Ride", "Swim", }, Types={ "Base", "NPC", }, WeaponBonusProficiencySelections={ { "TYPE=Simple", }, }, Facts={ ClassType="NPC", Abb="Com", }, Levels={ { Level="1", Abilities={ { Category="Special Ability", Nature="AUTOMATIC", Names={ "All Automatic Proficiencies", "Weapon and Armor Proficiency ~ Commoner", }, }, }, }, }, }) DefineClass({ Name="Expert", HitDie=8, MaxLevel=20, SkillPointsPerLevel=Formula("6"), SourcePage="p.450", Bonuses={ { Category="COMBAT", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")*3/4"), Type={ Name="Base", Replace=true, }, Conditions={ function (character, item, sources) return (character.Variables["UseAlternateBABProgression"] == 0) end, }, Variables={ "BASEAB", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/3"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Fortitude", "BASE.Reflex", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/2+2"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Will", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalBAB"] == 1) end, }, Variables={ "ClassBABModerate", }, }, { Category="VAR", Formula=Formula("CL"), Variables={ "ExpertLVL", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Will", }, }, }, Types={ "Base", "NPC", }, Facts={ ClassType="NPC", Abb="Exp", }, Levels={ { Level="1", Abilities={ { Category="Special Ability", Nature="AUTOMATIC", Names={ "All Automatic Proficiencies", }, }, { Category="FEAT", Nature="AUTOMATIC", Names={ "Simple Weapon Proficiency", }, }, }, }, { Level="1", Abilities={ { Category="FEAT", Nature="AUTOMATIC", Names={ "Armor Proficiency (Light)", }, }, }, }, { Level="1", Bonuses={ { Category="ABILITYPOOL", Formula=Formula("10"), Variables={ "Expert Class Skills", }, }, }, }, }, }) DefineClass({ Name="Warrior", HitDie=10, MaxLevel=20, SkillPointsPerLevel=Formula("2"), SourcePage="p.450", Bonuses={ { Category="COMBAT", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Type={ Name="Base", Replace=true, }, Conditions={ function (character, item, sources) return (character.Variables["UseAlternateBABProgression"] == 0) end, }, Variables={ "BASEAB", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/2+2"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Fortitude", }, }, { Category="SAVE", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")/3"), Conditions={ function (character, item, sources) return (character.Variables["UseAlternateSaveProgression"] == 0) end, }, Variables={ "BASE.Reflex", "BASE.Will", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalBAB"] == 1) end, }, Variables={ "ClassBABFull", }, }, { Category="VAR", Formula=Formula("CL"), Variables={ "WarriorLVL", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSaveGood_Fortitude", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Reflex", }, }, { Category="VAR", Formula=Formula("classlevel(\"APPLIEDAS=NONEPIC\")"), Conditions={ function (character, item, sources) return (character.Variables["UseFractionalSave"] == 1) end, }, Variables={ "ClassSavePoor_Will", }, }, }, ClassSkills={ "Climb", "TYPE=Craft", "Handle Animal", "Intimidate", "TYPE=Profession", "Ride", "Swim", }, Types={ "Base", "NPC", }, Facts={ ClassType="NPC", Abb="War", }, Levels={ { Level="1", Abilities={ { Category="Special Ability", Nature="AUTOMATIC", Names={ "All Automatic Proficiencies", "All Martial Weapon Proficiencies", }, }, { Category="FEAT", Nature="AUTOMATIC", Names={ "Martial Weapon Proficiency Output", "Simple Weapon Proficiency", }, }, }, }, { Level="1", Abilities={ { Category="FEAT", Nature="AUTOMATIC", Names={ "Armor Proficiency (Heavy)", "Armor Proficiency (Light)", "Armor Proficiency (Medium)", }, }, }, }, { Level="1", Abilities={ { Category="FEAT", Nature="AUTOMATIC", Names={ "Shield Proficiency", "Tower Shield Proficiency", }, }, }, }, }, })
local M = {} M.functions = {} function M.execute(id) local func = M.functions[id] if not func then error("Function doest not exist: " .. id) end return func() end local map = function(mode, key, cmd, opts, defaults) opts = vim.tbl_deep_extend("force", { silent = true }, defaults or {}, opts or {}) if type(cmd) == "function" then table.insert(M.functions, cmd) if opts.expr then cmd = ([[luaeval('require("lib.keymapping").execute(%d)')]]):format(#M.functions) else cmd = ("<cmd>lua require('lib.keymapping').execute(%d)<cr>"):format(#M.functions) end end if opts.buffer ~= nil then local buffer = opts.buffer opts.buffer = nil return vim.api.nvim_buf_set_keymap(buffer, mode, key, cmd, opts) else return vim.api.nvim_set_keymap(mode, key, cmd, opts) end end function M.map(mode, key, cmd, opt, defaults) return map(mode, key, cmd, opt, defaults) end function M.nmap(key, cmd, opts) return map("n", key, cmd, opts) end function M.vmap(key, cmd, opts) return map("v", key, cmd, opts) end function M.xmap(key, cmd, opts) return map("x", key, cmd, opts) end function M.imap(key, cmd, opts) return map("i", key, cmd, opts) end function M.omap(key, cmd, opts) return map("o", key, cmd, opts) end function M.smap(key, cmd, opts) return map("s", key, cmd, opts) end function M.nnoremap(key, cmd, opts) return map("n", key, cmd, opts, { noremap = true }) end function M.vnoremap(key, cmd, opts) return map("v", key, cmd, opts, { noremap = true }) end function M.xnoremap(key, cmd, opts) return map("x", key, cmd, opts, { noremap = true }) end function M.inoremap(key, cmd, opts) return map("i", key, cmd, opts, { noremap = true }) end function M.onoremap(key, cmd, opts) return map("o", key, cmd, opts, { noremap = true }) end function M.snoremap(key, cmd, opts) return map("s", key, cmd, opts, { noremap = true }) end return M
local cpath = select(1, ...) or "" -- callee path local function nTimes(n, f, x) for i = 0, n - 1 do x = f(x) end return x end -- calls n times f(x) local function rmlast(str) return str:sub(1, -2):match(".+[%./]") or "" end -- removes last dir / file from the callee path local cpppdpath = nTimes(4, rmlast, cpath) -- callee parent parent of parent dir path local _ss = require (cpppdpath .. "Settings/Static_Settings") return function() local J_SUBWAY = 1 if getServer() ~= "None" then local ss = _ss() J_SUBWAY = ss.J_SUBWAY end local JohtoMap = {} JohtoMap["Abandoned Desert Village"] = {["Desert Lagoon"] = {1}, ["Desert Cave"] = {1}} JohtoMap["Amazon Forest Entrance"] = {["Amazon Forest"] = {1}, ["Dock Island"] = {1}} JohtoMap["Amazon Forest"] = {["Desert Cave"] = {1}, ["Amazon Forest Entrance"] = {1}} JohtoMap["Azalea House1"] = {["Azalea Town"] = {1}} JohtoMap["Azalea Kurts House"] = {["Azalea Town"] = {1}} JohtoMap["Azalea Pokemart"] = {["Azalea Town"] = {1}} JohtoMap["Azalea Town Gym"] = {["Azalea Town"] = {1}} JohtoMap["Azalea Town Subway"] = {["Pokecenter Azalea"] = {0.2}, ["Olivine City Subway"] = {J_SUBWAY}, ["Violet City Subway"] = {J_SUBWAY}, ["Mahogany Town Subway"] = {J_SUBWAY}, ["Blackthorn City Subway"] = {J_SUBWAY}, ["Cherrygrove City Subway"] = {J_SUBWAY}, ["Ecruteak City Subway"] = {J_SUBWAY}, ["Goldenrod City Subway"] = {J_SUBWAY}} JohtoMap["Azalea Town"] = {["Azalea Town Gym"] = {1}, ["Azalea House1"] = {1}, ["Azalea Kurts House"] = {1}, ["Azalea Pokemart"] = {1}, ["Ilex Forest Stop House"] = {1}, ["Pokecenter Azalea"] = {1}, ["Route 33"] = {1}, ["Slowpoke Well"] = {1}} JohtoMap["Battle Road House_A"] = {["Battle Road"] = {1}} JohtoMap["Battle Road House_B"] = {["Battle Road"] = {1}} JohtoMap["Battle Road"] = {["Battle Tower Entrance"] = {1}, ["Battle Road House_A"] = {1}, ["Battle Road House_B"] = {1}, ["Route 40"] = {1}} JohtoMap["Battle Tower Entrance"] = {["Battle Road"] = {1}} JohtoMap["Bell Tower Barrier Station 1F"] = {["Ecruteak City"] = {1}, ["Bell Tower Barrier Station B1F"] = {1}} JohtoMap["Bell Tower Barrier Station B1F"] = {["Bell Tower Barrier Station 1F"] = {1}, ["Bell Tower"] = {1}} JohtoMap["Bell Tower Floor 10"] = {["Bell Tower Floor 9_B"] = {1}, ["Bell Tower Roof"] = {1}} JohtoMap["Bell Tower Floor 2"] = {["Bell Tower"] = {1}, ["Bell Tower Floor 3"] = {1}} JohtoMap["Bell Tower Floor 3"] = {["Bell Tower Floor 2"] = {1}, ["Bell Tower Floor 4_A"] = {1}} JohtoMap["Bell Tower Floor 4_A"] = {["Bell Tower Floor 3"] = {1}, ["Bell Tower Floor 4_B"] = {1}, ["Bell Tower Floor 5_A"] = {1}} JohtoMap["Bell Tower Floor 4_B"] = {["Bell Tower Floor 5_D"] = {1}, ["Bell Tower Floor 4_C"] = {1}} JohtoMap["Bell Tower Floor 4_C"] = {["Bell Tower Floor 5_B"] = {1}, ["Bell Tower Floor 4_A"] = {1}} JohtoMap["Bell Tower Floor 5_A"] = {["Bell Tower Floor 4_A"] = {1}, ["Bell Tower Floor 5_C"] = {1}, ["Bell Tower Floor 5_E"] = {1}} JohtoMap["Bell Tower Floor 5_B"] = {["Bell Tower Floor 4_C"] = {1}} JohtoMap["Bell Tower Floor 5_C"] = {["Bell Tower Floor 5_E"] = {1}, ["Bell Tower Floor 5_F"] = {1}} JohtoMap["Bell Tower Floor 5_D"] = {["Bell Tower Floor 4_B"] = {1}} JohtoMap["Bell Tower Floor 5_E"] = {["Bell Tower Floor 5_D"] = {1}} JohtoMap["Bell Tower Floor 5_F"] = {["Bell Tower Floor 5_B"] = {1}, ["Bell Tower Floor 5_E"] = {1}, ["Bell Tower Floor 5_G"] = {1}} JohtoMap["Bell Tower Floor 5_G"] = {["Bell Tower Floor 5_B"] = {1}, ["Bell Tower Floor 6"] = {1}} JohtoMap["Bell Tower Floor 6"] = {["Bell Tower Floor 5_G"] = {1}, ["Bell Tower Floor 7_A"] = {1}} JohtoMap["Bell Tower Floor 7_A"] = {["Bell Tower Floor 6"] = {1}, ["Bell Tower Floor 8_A"] = {1}, ["Bell Tower Floor 7_B"] = {1}} JohtoMap["Bell Tower Floor 7_B"] = {["Bell Tower Floor 7_A"] = {1}, ["Bell Tower Floor 8_C"] = {1}} JohtoMap["Bell Tower Floor 8_A"] = {["Bell Tower Floor 7_A"] = {1}, ["Bell Tower Floor 9_A"] = {1}, ["Bell Tower Floor 9_C"] = {1}} JohtoMap["Bell Tower Floor 8_B"] = {["Bell Tower Floor 9_A"] = {1}, ["Bell Tower Floor 9_B"] = {1}} JohtoMap["Bell Tower Floor 8_C"] = {["Bell Tower Floor 7_B"] = {1}} JohtoMap["Bell Tower Floor 9_A"] = {["Bell Tower Floor 8_A"] = {1}, ["Bell Tower Floor 8_B"] = {1}} JohtoMap["Bell Tower Floor 9_B"] = {["Bell Tower Floor 8_B"] = {1}, ["Bell Tower Floor 10"] = {1}} JohtoMap["Bell Tower Floor 9_C"] = {["Bell Tower Floor 8_A"] = {1}} JohtoMap["Bell Tower Roof"] = {["Bell Tower Floor 10"] = {1}} JohtoMap["Bell Tower"] = {["Bell Tower Barrier Station B1F"] = {1}, ["Bell Tower Floor 2"] = {1}} JohtoMap["Blackthorn City Dragon Club 1F"] = {["Blackthorn City Dragon Club 2F"] = {1}, ["Blackthorn City"] = {1}} JohtoMap["Blackthorn City Dragon Club 2F"] = {["Blackthorn City Dragon Club 3F"] = {1}, ["Blackthorn City Dragon Club 1F"] = {1}} JohtoMap["Blackthorn City Dragon Club 3F"] = {["Blackthorn City Dragon Club 2F"] = {1}} JohtoMap["Blackthorn City Gym"] = {["Blackthorn City"] = {1}} JohtoMap["Blackthorn City House 1"] = {["Blackthorn City"] = {1}} JohtoMap["Blackthorn City House 2"] = {["Blackthorn City"] = {1}} JohtoMap["Blackthorn City House 3"] = {["Blackthorn City"] = {1}} JohtoMap["Blackthorn City Pokemart"] = {["Blackthorn City"] = {1}} JohtoMap["Blackthorn City Subway"] = {["Pokecenter Blackthorn"] = {0.2}, ["Olivine City Subway"] = {J_SUBWAY}, ["Violet City Subway"] = {J_SUBWAY}, ["Azalea Town Subway"] = {J_SUBWAY}, ["Mahogany Town Subway"] = {J_SUBWAY}, ["Cherrygrove City Subway"] = {J_SUBWAY}, ["Ecruteak City Subway"] = {J_SUBWAY}, ["Goldenrod City Subway"] = {J_SUBWAY}} JohtoMap["Blackthorn City"] = {["Blackthorn City Dragon Club 1F"] = {1}, ["Blackthorn City Gym"] = {1}, ["Blackthorn City House 1"] = {1}, ["Blackthorn City House 2"] = {1}, ["Blackthorn City House 3"] = {1}, ["Blackthorn City Pokemart"] = {1}, ["Route 44"] = {1, {["abilities"] = {"dig"}}}, ["Dragons Den Entrance"] = {1, {["abilities"] = {"surf"}}}, ["Ice Path 1F_B"] = {1}, ["Pokecenter Blackthorn"] = {1}, ["Route 45_A"] = {1}} JohtoMap["Burned Tower Floor 2"] = {["Burned Tower Top Floor"] = {1}} JohtoMap["Burned Tower Top Floor"] = {["Ecruteak City"] = {1}, ["Burned Tower Floor 2"] = {1}} JohtoMap["Cherrygrove City House 1"] = {["Cherrygrove City_A"] = {1}} JohtoMap["Cherrygrove City House 2"] = {["Cherrygrove City_A"] = {1}} JohtoMap["Cherrygrove City House 3"] = {["Cherrygrove City_A"] = {1}} JohtoMap["Cherrygrove City Subway"] = {["Pokecenter Cherrygrove City"] = {0.2}, ["Olivine City Subway"] = {J_SUBWAY}, ["Violet City Subway"] = {J_SUBWAY}, ["Azalea Town Subway"] = {J_SUBWAY}, ["Blackthorn City Subway"] = {J_SUBWAY}, ["Mahogany Town Subway"] = {J_SUBWAY}, ["Ecruteak City Subway"] = {J_SUBWAY}, ["Goldenrod City Subway"] = {J_SUBWAY}} JohtoMap["Cherrygrove City_A"] = {["Cherrygrove City House 1"] = {1}, ["Cherrygrove City House 2"] = {1}, ["Cherrygrove City House 3"] = {1}, ["Mart Cherrygrove City"] = {1}, ["Pokecenter Cherrygrove City"] = {1}, ["Route 29"] = {1}, ["Route 30"] = {1}} JohtoMap["Cherrygrove City_B"] = {["Route 30"] = {1}} JohtoMap["Cianwood City Gym"] = {["Cianwood City"] = {1}} JohtoMap["Cianwood City"] = {["Cianwood Shop"] = {1}, ["Cianwood City Gym"] = {1}, ["Cianwood House 1"] = {1}, ["Cianwood House 2"] = {1}, ["Cianwood House 3"] = {1}, ["Cianwood House 4"] = {1}, ["Cliff Edge Gate"] = {1}, ["Pokecenter Cianwood"] = {1}, ["Route 41"] = {1, {["abilities"] = {"surf"}}}} JohtoMap["Cianwood House 1"] = {["Cianwood City"] = {1}} JohtoMap["Cianwood House 2"] = {["Cianwood City"] = {1}} JohtoMap["Cianwood House 3"] = {["Cianwood City"] = {1}} JohtoMap["Cianwood House 4"] = {["Cianwood City"] = {1}} JohtoMap["Cianwood Shop"] = {["Cianwood City"] = {1}} JohtoMap["Cliff Cave 1F"] = {["Cliff Cave 2F"] = {1}, ["Cliff Cave B1F"] = {1}, ["Route 47_A"] = {1}} JohtoMap["Cliff Cave 2F"] = {["Cliff Cave 1F"] = {1}, ["Route 47_C"] = {1}} JohtoMap["Cliff Cave B1F"] = {["Cliff Cave 1F"] = {1}, ["Route 47_B"] = {1}} JohtoMap["Cliff Edge Gate"] = {["Cianwood City"] = {1}, ["Route 47_A"] = {1}} JohtoMap["Dark Cave North_A"] = {["Route 45_A"] = {2}, ["Dark Cave North_B"] = {2, {["abilities"] = {"surf"}}}} JohtoMap["Dark Cave North_B"] = {["Dark Cave South_B"] = {0.5}} JohtoMap["Dark Cave South_A"] = {["Route 31"] = {1}, ["Dark Cave South_B"] = {1, {["abilities"] = {"surf"}}}, ["Dark Cave South_C"] = {1, {["abilities"] = {"rock smash"}}}} JohtoMap["Dark Cave South_B"] = {["Dark Cave South_A"] = {0.5}, ["Dark Cave South_C"] = {0.5}, ["Dark Cave North_B"] = {0.5}} JohtoMap["Dark Cave South_C"] = {["Dark Cave South_B"] = {1.5, {["abilities"] = {"surf"}}}, ["Dark Cave South_A"] = {1.5, {["abilities"] = {"rock smash"}}}, ["Dark Cave South_D"] = {1.5}} JohtoMap["Dark Cave South_D"] = {["Dark Cave South_C"] = {0.5, {["abilities"] = {"rock smash"}}}, ["Route 46_A"] = {0.5}} JohtoMap["Desert Cave"] = {["Abandoned Desert Village"] = {1}, ["Amazon Forest"] = {1}} JohtoMap["Desert Lagoon"] = {["Abandoned Desert Village"] = {1}} JohtoMap["Dock Island"] = {["Amazon Forest Entrance"] = {1}, ["Olivine City"] = {1}} JohtoMap["Dragons Den B1F"] = {["Dragons Den"] = {1, {["abilities"] = {"surf"}}}} JohtoMap["Dragons Den Entrance"] = {["Blackthorn City"] = {1}, ["Dragons Den"] = {1}} JohtoMap["Dragons Den"] = {["Dragons Den B1F"] = {1, {["abilities"] = {"surf"}}}, ["Dragons Den Entrance"] = {1}} JohtoMap["Ecruteak City Costume Mart"] = {["Ecruteak City"] = {1}} JohtoMap["Ecruteak City House 1"] = {["Ecruteak City"] = {1}} JohtoMap["Ecruteak City House 2"] = {["Ecruteak City"] = {1}} JohtoMap["Ecruteak City Subway"] = {["Pokecenter Ecruteak"] = {0.2}, ["Olivine City Subway"] = {J_SUBWAY}, ["Violet City Subway"] = {J_SUBWAY}, ["Azalea Town Subway"] = {J_SUBWAY}, ["Blackthorn City Subway"] = {J_SUBWAY}, ["Cherrygrove City Subway"] = {J_SUBWAY}, ["Mahogany Town Subway"] = {J_SUBWAY}, ["Goldenrod City Subway"] = {J_SUBWAY}} JohtoMap["Ecruteak City"] = {["Ecruteak City Costume Mart"] = {1}, ["Ecruteak Dance Theater"] = {1}, ["Ecruteak City House 1"] = {1}, ["Ecruteak City House 2"] = {1}, ["Ecruteak Gym"] = {1}, ["Ecruteak Mart"] = {1}, ["Ecruteak Stop House 1"] = {1}, ["Ecruteak Stop House 2"] = {1}, ["Pokecenter Ecruteak"] = {1}, ["Route 37"] = {1}, ["Burned Tower Top Floor"] = {1}, ["Bell Tower Barrier Station 1F"] = {1--[[npc maybe]]}} JohtoMap["Ecruteak Dance Theater"] = {["Ecruteak City"] = {1}} JohtoMap["Ecruteak Gym"] = {["Ecruteak City"] = {1}} JohtoMap["Ecruteak Mart"] = {["Ecruteak City"] = {1}} JohtoMap["Ecruteak Stop House 1"] = {["Ecruteak City"] = {0.2}, ["Route 38"] = {0.2}} JohtoMap["Ecruteak Stop House 2"] = {["Ecruteak City"] = {0.2}, ["Route 42_A"] = {0.2}} JohtoMap["Glitter Lighthouse 1F"] = {["Olivine City"] = {1}, ["Glitter Lighthouse 2F_A"] = {1}} JohtoMap["Glitter Lighthouse 2F_A"] = {["Glitter Lighthouse 1F"] = {1}, ["Glitter Lighthouse 3F_B"] = {1}} JohtoMap["Glitter Lighthouse 2F_B"] = {["Glitter Lighthouse 3F_A"] = {1}, ["Glitter Lighthouse 3F_B"] = {1}} JohtoMap["Glitter Lighthouse 3F_A"] = {["Glitter Lighthouse 2F_B"] = {1}, ["Glitter Lighthouse 4F"] = {1}} JohtoMap["Glitter Lighthouse 3F_B"] = {["Glitter Lighthouse 2F_B"] = {1}, ["Glitter Lighthouse 2F_A"] = {1}} JohtoMap["Glitter Lighthouse 4F"] = {["Glitter Lighthouse 3F_A"] = {1}, ["Glitter Lighthouse 5F"] = {1}} JohtoMap["Glitter Lighthouse 5F"] = {["Glitter Lighthouse 4F"] = {1}} JohtoMap["Goldenrod City Bike Shop"] = {["Goldenrod City"] = {1}} JohtoMap["Goldenrod City Bills House"] = {["Goldenrod City"] = {1}} JohtoMap["Goldenrod City Flower Shop"] = {["Goldenrod City"] = {1}} JohtoMap["Goldenrod City Fortune Teller Tent"] = {["Goldenrod City"] = {1}} JohtoMap["Goldenrod City Game Corner"] = {["Goldenrod City"] = {1}} JohtoMap["Goldenrod City Gym"] = {["Goldenrod City"] = {1}} JohtoMap["Goldenrod City House 1"] = {["Goldenrod City"] = {1}} JohtoMap["Goldenrod City House 2"] = {["Goldenrod City"] = {1}} JohtoMap["Goldenrod City Station Floor 2"] = {["Goldenrod City Station_B"] = {0.5}, ["Trainers Valley Station Floor 2"] = {999}} JohtoMap["Goldenrod City Station_A"] = {["Goldenrod City Station_B"] = {0.5}, ["Goldenrod City"] = {0.5}} JohtoMap["Goldenrod City Station_B"] = {["Goldenrod City Station Floor 2"] = {1}, ["Goldenrod City Station_A"] = {0.5}} JohtoMap["Goldenrod City Subway"] = {["Pokecenter Goldenrod"] = {0.2}, ["Olivine City Subway"] = {J_SUBWAY}, ["Violet City Subway"] = {J_SUBWAY}, ["Azalea Town Subway"] = {J_SUBWAY}, ["Blackthorn City Subway"] = {J_SUBWAY}, ["Cherrygrove City Subway"] = {J_SUBWAY}, ["Ecruteak City Subway"] = {J_SUBWAY}, ["Mahogany Town Subway"] = {J_SUBWAY}} JohtoMap["Goldenrod City"] = {["Goldenrod Global Station"] = {1}, ["Goldenrod Radio Station Floor 1"] = {1}, ["Goldenrod City Flower Shop"] = {1}, ["Goldenrod City Gym"] = {1}, ["Goldenrod City Fortune Teller Tent"] = {1}, ["Goldenrod City Bills House"] = {1}, ["Goldenrod City Game Corner"] = {1}, ["Goldenrod City House 1"] = {1}, ["Goldenrod City House 2"] = {1}, ["Goldenrod City Bike Shop"] = {1}, ["Goldenrod Mart 1"] = {1}, ["Pokecenter Goldenrod"] = {1}, ["Route 34_A"] = {1}, ["Route 35 Stop House"] = {1}, ["Goldenrod City Station_A"] = {1}, ["Goldenrod Underground Entrance Top"] = {1}, ["Goldenrod Underground Entrance Bottom"] = {1}} JohtoMap["Goldenrod Global Station"] = {["Goldenrod City"] = {1}} JohtoMap["Goldenrod Mart 1"] = {["Goldenrod Mart 2"] = {1}, ["Goldenrod Mart Elevator"] = {1}, ["Goldenrod City"] = {1}} JohtoMap["Goldenrod Mart 2"] = {["Goldenrod Mart 1"] = {1}, ["Goldenrod Mart Elevator"] = {1}, ["Goldenrod Mart 3"] = {1}} JohtoMap["Goldenrod Mart 3"] = {["Goldenrod Mart 2"] = {1}, ["Goldenrod Mart Elevator"] = {1}, ["Goldenrod Mart 4"] = {1}} JohtoMap["Goldenrod Mart 4"] = {["Goldenrod Mart 3"] = {1}, ["Goldenrod Mart Elevator"] = {1}, ["Goldenrod Mart 5"] = {1}} JohtoMap["Goldenrod Mart 5"] = {["Goldenrod Mart 4"] = {1}, ["Goldenrod Mart Elevator"] = {1}, ["Goldenrod Mart 6"] = {1}} JohtoMap["Goldenrod Mart 6"] = {["Goldenrod Mart 5"] = {1}, ["Goldenrod Mart Elevator"] = {1}} JohtoMap["Goldenrod Mart B1F"] = {["Goldenrod Mart Elevator"] = {1}, ["Underground Warehouse"] = {1}} JohtoMap["Goldenrod Mart Elevator"] = {["Goldenrod Mart 2"] = {0.2}, ["Goldenrod Mart 1"] = {0.2}, ["Goldenrod Mart 4"] = {0.2}, ["Goldenrod Mart 3"] = {0.2}, ["Goldenrod Mart 5"] = {0.2}, ["Goldenrod Mart 6"] = {0.2}, ["Goldenrod Mart B1F"] = {0.2}} JohtoMap["Goldenrod Radio Station Floor 1"] = {["Goldenrod City"] = {1}} JohtoMap["Goldenrod Underground Entrance Bottom"] = {["Goldenrod City"] = {0.2}, ["Goldenrod Underground Path"] = {0.2}} JohtoMap["Goldenrod Underground Entrance Top"] = {["Goldenrod City"] = {0.2}, ["Goldenrod Underground Path"] = {0.2}} JohtoMap["Goldenrod Underground Path"] = {["Goldenrod Underground Entrance Top"] = {1}, ["Goldenrod Underground Entrance Bottom"] = {1}, ["Underground Warehouse"] = {1}} JohtoMap["Ice Path 1F_A"] = {["Route 44"] = {3}, ["Ice Path B1F_A"] = {3}} JohtoMap["Ice Path 1F_B"] = {["Blackthorn City"] = {1}, ["Ice Path B1F_B"] = {1}} JohtoMap["Ice Path B1F_A"] = {["Ice Path B2F_A"] = {0.5}, ["Ice Path 1F_A"] = {1.5}} JohtoMap["Ice Path B1F_B"] = {["Ice Path B2F_B"] = {1}, ["Ice Path 1F_B"] = {1}} JohtoMap["Ice Path B2F_A"] = {["Ice Path B3F"] = {1}, ["Ice Path B1F_A"] = {1}} JohtoMap["Ice Path B2F_B"] = {["Ice Path B3F"] = {1}, ["Ice Path B1F_B"] = {1}} JohtoMap["Ice Path B3F"] = {["Ice Path B2F_A"] = {1}, ["Ice Path B2F_B"] = {1}} JohtoMap["Ilex Forest Stop House"] = {["Azalea Town"] = {0.2}, ["Ilex Forest_A"] = {0.2}} JohtoMap["Ilex Forest_A"] = {["Ilex Forest Stop House"] = {1}, ["Ilex Forest_B"] = {1, {["abilities"] = {"cut"}}}} JohtoMap["Ilex Forest_B"] = {["Ilex Forest_A"] = {2, {["abilities"] = {"cut"}}}, ["Route 34 Stop House"] = {2}} JohtoMap["Item Maniac Johto"] = {["Ruins Of Alph_A"] = {1}} JohtoMap["Johto Safari Entrance"] = {["Safari Johto Wet Zone"] = {1}, ["Safari Johto Mountain Zone"] = {1}, ["Safari Johto Snow Zone"] = {1}, ["Safari Johto Grass and Swamp Zone"] = {1}} JohtoMap["Johto Safari Zone Lobby"] = {["Route 48"] = {1}, ["Johto Safari Entrance"] = {1}} JohtoMap["Lake of Rage House 1"] = {["Lake of Rage_A"] = {1}} JohtoMap["Lake of Rage House 2"] = {["Lake of Rage_E"] = {1}} JohtoMap["Lake of Rage_A"] = {["Lake of Rage House 1"] = {1}, ["Route 43"] = {1}, ["Lake of Rage_C"] = {1, {["abilities"] = {"cut"}}}} JohtoMap["Lake of Rage_B"] = {["Route 43"] = {1}, ["Lake of Rage_E"] = {1, {["abilities"] = {"cut"}}}} JohtoMap["Lake of Rage_C"] = {["Lake of Rage_A"] = {1, {["abilities"] = {"cut"}}}} JohtoMap["Lake of Rage_D"] = {["Lake of Rage_B"] = {1, {["abilities"] = {"cut"}}}} JohtoMap["Lake of Rage_E"] = {["Lake of Rage House 2"] = {1}, ["Lake of Rage_B"] = {1, {["abilities"] = {"cut"}}}, ["Lake of Rage_D"] = {1, {["abilities"] = {"cut"}}}} JohtoMap["Mahogany Town Gym_A"] = {["Mahogany Town Gym_B"] = {1}, ["Mahogany Town"] = {1}} JohtoMap["Mahogany Town Gym_B"] = {["Mahogany Town Gym_A"] = {1}, ["Mahogany Town Gym_C"] = {1}} JohtoMap["Mahogany Town Gym_C"] = {["Mahogany Town Gym_B"] = {1}} JohtoMap["Mahogany Town House"] = {["Mahogany Town"] = {1}} JohtoMap["Mahogany Town Shop"] = {["Mahogany Town"] = {1}} JohtoMap["Mahogany Town Subway"] = {["Pokecenter Mahogany"] = {0.2}, ["Olivine City Subway"] = {J_SUBWAY}, ["Violet City Subway"] = {J_SUBWAY}, ["Azalea Town Subway"] = {J_SUBWAY}, ["Blackthorn City Subway"] = {J_SUBWAY}, ["Cherrygrove City Subway"] = {J_SUBWAY}, ["Ecruteak City Subway"] = {J_SUBWAY}, ["Goldenrod City Subway"] = {J_SUBWAY}} JohtoMap["Mahogany Town"] = {["Mahogany Town House"] = {1}, ["Mahogany Town Gym_A"] = {1}, ["Mahogany Town Shop"] = {1}, ["Pokecenter Mahogany"] = {1}, ["Route 42_D"] = {1}, ["Route 43"] = {1}, ["Route 44"] = {1}} JohtoMap["Mart Cherrygrove City"] = {["Cherrygrove City_A"] = {1}} JohtoMap["Miltank Barn"] = {["Route 39"] = {1}} JohtoMap["Mt. Mortar 1F_A"] = {["Mt. Mortar Lower Cave"] = {1}, ["Route 42_A"] = {1}} JohtoMap["Mt. Mortar 1F_B"] = {["Mt. Mortar B1F_A"] = {1}, ["Route 42_B"] = {1}} JohtoMap["Mt. Mortar 1F_C"] = {["Mt. Mortar Lower Cave"] = {1}, ["Route 42_D"] = {1}} JohtoMap["Mt. Mortar 1F_D"] = {["Mt. Mortar Lower Cave"] = {1.5}, ["Route 42_C"] = {1}} JohtoMap["Mt. Mortar 1F_E"] = {["Mt. Mortar Lower Cave"] = {1}} JohtoMap["Mt. Mortar 1F_F"] = {["Mt. Mortar Upper Cave"] = {1}} JohtoMap["Mt. Mortar 1F_G"] = {["Mt. Mortar Lower Cave"] = {1}} JohtoMap["Mt. Mortar B1F_A"] = {["Mt. Mortar 1F_B"] = {1}, ["Mt. Mortar B1F_B"] = {1, {["abilities"] = {"surf"}}}} JohtoMap["Mt. Mortar B1F_B"] = {["Mt. Mortar B1F_A"] = {1, {["abilities"] = {"surf"}}}, ["Mt. Mortar Lower Cave"] = {1}} JohtoMap["Mt. Mortar Lower Cave"] = {["Mt. Mortar 1F_C"] = {1.5}, ["Mt. Mortar 1F_A"] = {1.5}, ["Mt. Mortar 1F_E"] = {1.5}, ["Mt. Mortar 1F_G"] = {1.5}, ["Mt. Mortar 1F_D"] = {2}, ["Mt. Mortar B1F_B"] = {2.5}, ["Mt. Mortar Upper Cave"] = {2.5}} JohtoMap["Mt. Mortar Upper Cave"] = {["Mt. Mortar Lower Cave"] = {1.5, {["abilities"] = {"surf"}}}, ["Mt. Mortar 1F_F"] = {2}} JohtoMap["National Park Stop House 1"] = {["National Park"] = {0.2}, ["Route 35_A"] = {0.2}} JohtoMap["National Park Stop"] = {["National Park"] = {0.2}, ["Route 36"] = {0.2}} JohtoMap["National Park"] = {["National Park Stop"] = {1.5}, ["National Park Stop House 1"] = {1.5}} JohtoMap["New Bark Town House 2"] = {["New Bark Town"] = {1}} JohtoMap["New Bark Town House"] = {["New Bark Town"] = {1}} JohtoMap["New Bark Town Player House Bedroom"] = {["New Bark Town Player House"] = {1}} JohtoMap["New Bark Town Player House"] = {["New Bark Town Player House Bedroom"] = {1}, ["New Bark Town"] = {1}} JohtoMap["New Bark Town"] = {["New Bark Town House 2"] = {1}, ["New Bark Town House"] = {1}, ["Professor Elms House"] = {1}, ["Professor Elms Lab"] = {1}, ["New Bark Town Player House"] = {1}, ["Route 29"] = {1}} JohtoMap["Olivine Cafe"] = {["Olivine City"] = {1}} JohtoMap["Olivine City Gym"] = {["Olivine City"] = {1}} JohtoMap["Olivine City Subway"] = {["Olivine Pokecenter"] = {0.2}, ["Mahogany Town Subway"] = {J_SUBWAY}, ["Violet City Subway"] = {J_SUBWAY}, ["Azalea Town Subway"] = {J_SUBWAY}, ["Blackthorn City Subway"] = {J_SUBWAY}, ["Cherrygrove City Subway"] = {J_SUBWAY}, ["Ecruteak City Subway"] = {J_SUBWAY}, ["Goldenrod City Subway"] = {J_SUBWAY}} JohtoMap["Olivine City"] = {["Glitter Lighthouse 1F"] = {1}, ["Olivine Cafe"] = {1}, ["Olivine City Gym"] = {1}, ["Olivine Pokecenter"] = {1}, ["Olivine Pokemart"] = {1}, ["Route 39"] = {1}, ["Route 40"] = {1}, ["Olivine House 1"] = {1}, ["Olivine House 2"] = {1}, ["Olivine House 3"] = {1}, ["Dock Island"] = {0.2}} JohtoMap["Olivine House 1"] = {["Olivine City"] = {1}} JohtoMap["Olivine House 2"] = {["Olivine City"] = {1}} JohtoMap["Olivine House 3"] = {["Olivine City"] = {1}} JohtoMap["Olivine Pokecenter"] = {["Olivine City"] = {1}, ["Olivine City Subway"] = {0.2}} JohtoMap["Olivine Pokemart"] = {["Olivine City"] = {1}} JohtoMap["Pokecenter Azalea"] = {["Azalea Town"] = {1}, ["Azalea Town Subway"] = {0.2}} JohtoMap["Pokecenter Blackthorn"] = {["Blackthorn City"] = {1}, ["Blackthorn City Subway"] = {0.2}} JohtoMap["Pokecenter Cherrygrove City"] = {["Cherrygrove City_A"] = {1}, ["Cherrygrove City Subway"] = {0.2}} JohtoMap["Pokecenter Cianwood"] = {["Cianwood City"] = {1}} JohtoMap["Pokecenter Ecruteak"] = {["Ecruteak City"] = {1}, ["Ecruteak City Subway"] = {0.2}} JohtoMap["Pokecenter Goldenrod"] = {["Goldenrod City"] = {1}, ["Goldenrod City Subway"] = {0.2}} JohtoMap["Pokecenter Mahogany"] = {["Mahogany Town"] = {1}, ["Mahogany Town Subway"] = {0.2}} JohtoMap["Pokecenter Route 32"] = {["Route 32"] = {1}} JohtoMap["Pokecenter Route 48"] = {["Route 48"] = {1}} JohtoMap["Pokecenter Violet City"] = {["Violet City"] = {1}, ["Violet City Subway"] = {0.2}} JohtoMap["Professor Elms House"] = {["New Bark Town"] = {1}} JohtoMap["Professor Elms Lab"] = {["New Bark Town"] = {1}} JohtoMap["Route 29 Stop House"] = {["Route 29"] = {0.2}, ["Route 46_B"] = {0.2}} JohtoMap["Route 29"] = {["Cherrygrove City_A"] = {1}, ["New Bark Town"] = {1}, ["Route 29 Stop House"] = {1}} JohtoMap["Route 30 House 1"] = {["Route 30"] = {1}} JohtoMap["Route 30 House 2"] = {["Route 30"] = {1}} JohtoMap["Route 30"] = {["Route 30 House 2"] = {1}, ["Route 30 House 1"] = {1}, ["Cherrygrove City_A"] = {1.5}, ["Cherrygrove City_B"] = {1.5, {["abilities"] = {"surf"}}}, ["Route 31"] = {1.5}} JohtoMap["Route 31"] = {["Dark Cave South_A"] = {1}, ["Route 30"] = {1}, ["Violet City Stop House"] = {1}, ["Route 45_A"] = {1, {["abilities"] = {"dig"}}}} JohtoMap["Route 32"] = {["Pokecenter Route 32"] = {1.5}, ["Ruins Of Alph Stop House"] = {1.5}, ["Union Cave 1F_C"] = {1.5}, ["Violet City"] = {1.5}, ["Route 33"] = {1.5, {["abilities"] = {"dig"}}}} JohtoMap["Route 33"] = {["Azalea Town"] = {1}, ["Union Cave 1F_C"] = {1}, ["Route 32"] = {1, {["abilities"] = {"dig"}}}} JohtoMap["Route 34 Stop House"] = {["Ilex Forest_B"] = {0.2}, ["Route 34_A"] = {0.2}} JohtoMap["Route 34_A"] = {["Goldenrod City"] = {1}, ["Route 34 Stop House"] = {1}, ["Route 34_B"] = {1, {["abilities"] = {"surf"}}}} JohtoMap["Route 34_B"] = {["Route 34_A"] = {1, {["abilities"] = {"surf"}}}} JohtoMap["Route 35 Stop House"] = {["Goldenrod City"] = {0.2}, ["Route 35_A"] = {0.2}} JohtoMap["Route 35_A"] = {["National Park Stop House 1"] = {1}, ["Route 35 Stop House"] = {1}, ["Route 35_B"] = {1, {["abilities"] = {"cut"}}}} JohtoMap["Route 35_B"] = {["Route 35_A"] = {0, {["abilities"] = {"cut"}}}, ["Route 36"] = {0.2}} JohtoMap["Route 36 Stop"] = {["Route 36"] = {0.2}, ["Violet City"] = {0.2}} JohtoMap["Route 36"] = {["Route 35_B"] = {1}, ["Route 36 Stop"] = {1}, ["Route 37"] = {1}, ["Ruins Of Alph Stop House 1"] = {1}} JohtoMap["Route 37"] = {["Ecruteak City"] = {1}, ["Route 36"] = {1}} JohtoMap["Route 38"] = {["Ecruteak Stop House 1"] = {1}, ["Route 39"] = {1}} JohtoMap["Route 39 House"] = {["Route 39"] = {1}} JohtoMap["Route 39"] = {["Route 39 House"] = {1}, ["Miltank Barn"] = {1}, ["Olivine City"] = {1}, ["Route 38"] = {1}} JohtoMap["Route 40"] = {["Battle Road"] = {1}, ["Olivine City"] = {1}, ["Route 41"] = {2, {["abilities"] = {"surf"}}}} JohtoMap["Route 41"] = {["Cianwood City"] = {2}, ["Route 40"] = {2}, ["Whirl Islands 1F NorthEast_A"] = {2}, ["Whirl Islands 1F NorthWest"] = {2}, ["Whirl Islands 1F SouthWest"] = {2}} JohtoMap["Route 42_A"] = {["Ecruteak Stop House 2"] = {0.2}, ["Mt. Mortar 1F_A"] = {0.2}, ["Route 42_D"] = {0, {["abilities"] = {"dig"}}}} JohtoMap["Route 42_B"] = {["Mt. Mortar 1F_B"] = {0.2}, ["Route 42_A"] = {0.2, {["abilities"] = {"surf"}}}, ["Route 42_C"] = {0.2, {["abilities"] = {"surf"}}}, ["Route 42_D"] = {0.2, {["abilities"] = {"surf"}}}} JohtoMap["Route 42_C"] = {["Mt. Mortar 1F_D"] = {0.2}, ["Route 42_B"] = {0.2, {["abilities"] = {"surf"}}}, ["Route 42_D"] = {0.2, {["abilities"] = {"surf"}}}} JohtoMap["Route 42_D"] = {["Mahogany Town"] = {0.2}, ["Mt. Mortar 1F_C"] = {0.2}, ["Route 42_A"] = {0, {["abilities"] = {"dig"}}}, ["Route 42_C"] = {0.2, {["abilities"] = {"surf"}}}, ["Route 42_B"] = {0.2, {["abilities"] = {"surf"}}}, ["Route 42_E"] = {0, {["abilities"] = {"rock climb"}}}} JohtoMap["Route 42_E"] = {["Route 42_D"] = {0}} JohtoMap["Route 43"] = {["Lake of Rage_A"] = {1}, ["Lake of Rage_B"] = {1}, ["Mahogany Town"] = {1}} JohtoMap["Route 44"] = {["Ice Path 1F_A"] = {1}, ["Mahogany Town"] = {1}, ["Blackthorn City"] = {1, {["abilities"] = {"dig"}}}} JohtoMap["Route 45_A"] = {["Blackthorn City"] = {0.5}, ["Dark Cave North_A"] = {0.5}, ["Route 45_B"] = {0.5}, ["Route 31"] = {0.5, {["abilities"] = {"dig"}}}} JohtoMap["Route 45_B"] = {["Route 46_A"] = {1.5}} JohtoMap["Route 46_A"] = {["Route 46_B"] = {0.5}, ["Route 45_B"] = {0.5}, ["Dark Cave South_D"] = {0.5}} JohtoMap["Route 46_B"] = {["Route 29 Stop House"] = {0.5}} JohtoMap["Route 47_A"] = {["Cliff Cave 1F"] = {1}, ["Cliff Edge Gate"] = {1}} JohtoMap["Route 47_B"] = {["Cliff Cave B1F"] = {1}} JohtoMap["Route 47_C"] = {["Cliff Cave 2F"] = {2}, ["Route 48"] = {2}} JohtoMap["Route 48"] = {["Johto Safari Zone Lobby"] = {1}, ["Pokecenter Route 48"] = {1}, ["Route 47_C"] = {1}} JohtoMap["Ruins Of Alph Stop House 1"--[[npcs entrance]]] = {["Route 36"] = {0.2}, ["Ruins Of Alph_A"] = {0.2, {["items"] = {"Zephyr Badge"}}}} JohtoMap["Ruins Of Alph Stop House"--[[npcs entrance]]] = {["Route 32"] = {1}, ["Ruins Of Alph_A"] = {0.2, {["items"] = {"Zephyr Badge"}}}} JohtoMap["Ruins Of Alph_A"--[[npcs entrance]]] = {["Item Maniac Johto"] = {1}, ["Ruins Research Center"] = {1}, ["Ruins Of Alph Stop House"] = {1}, ["Ruins Of Alph Stop House 1"] = {1}, ["Ruins Of Alph_D"] = {1, {["abilities"] = {"surf"}}}} JohtoMap["Ruins Of Alph_B"] = {["Union Cave 1F_B"] = {1}} JohtoMap["Ruins Of Alph_C"] = {["Ruins Of Alph_D"] = {0.2}, ["Union Cave 1F_A"] = {0.2}} JohtoMap["Ruins Of Alph_D"] = {["Ruins Of Alph_A"] = {0.5, {["abilities"] = {"surf"}}}} JohtoMap["Ruins Research Center"] = {["Ruins Of Alph_A"] = {1}} JohtoMap["Safari Johto Grass and Swamp Zone"] = {["Johto Safari Entrance"] = {1}} JohtoMap["Safari Johto Mountain Zone"] = {["Johto Safari Entrance"] = {1}} JohtoMap["Safari Johto Snow Zone"] = {["Johto Safari Entrance"] = {1}} JohtoMap["Safari Johto Wet Zone"] = {["Johto Safari Entrance"] = {1}} JohtoMap["Slowpoke Well L1"] = {["Slowpoke Well"] = {1, {["abilities"] = {"surf"}}}} JohtoMap["Slowpoke Well"] = {["Azalea Town"] = {1}, ["Slowpoke Well L1"] = {1, {["abilities"] = {"surf"}}--[[npc maybe]]}} JohtoMap["Sprout Tower F1_A"] = {["Violet City"] = {1}, ["Sprout Tower F2_A"] = {1}} JohtoMap["Sprout Tower F1_B"] = {["Sprout Tower F2_A"] = {1}, ["Sprout Tower F2_B"] = {1}} JohtoMap["Sprout Tower F2_A"] = {["Sprout Tower F1_A"] = {1}, ["Sprout Tower F1_B"] = {1}} JohtoMap["Sprout Tower F2_B"] = {["Sprout Tower F1_B"] = {1}, ["Sprout Tower F3"] = {1}} JohtoMap["Sprout Tower F3"] = {["Sprout Tower F2_B"] = {1}} JohtoMap["Underground Warehouse"] = {["Goldenrod Mart B1F"] = {1}, ["Goldenrod Underground Path"] = {1}} JohtoMap["Union Cave 1F_A"] = {["Union Cave B2F_A"] = {0.5}, ["Ruins Of Alph_C"] = {0.5}} JohtoMap["Union Cave 1F_B"] = {["Union Cave B2F_B"] = {0.5}, ["Ruins Of Alph_B"] = {0.5}} JohtoMap["Union Cave 1F_C"] = {["Union Cave 1F_D"] = {2.5, {["abilities"] = {"surf"}}}, ["Route 32"] = {2.5}, ["Route 33"] = {2.5}, ["Union Cave B1F_A"] = {2.5}} JohtoMap["Union Cave 1F_D"] = {["Union Cave 1F_C"] = {0, {["abilities"] = {"surf"}}}, ["Union Cave B1F_C"] = {0.5}} JohtoMap["Union Cave B1F_A"] = {["Union Cave 1F_C"] = {0.5}, ["Union Cave B1F_B"] = {0.5, {["abilities"] = {"surf"}}}} JohtoMap["Union Cave B1F_B"] = {["Union Cave B2F_A"] = {1.5}, ["Union Cave B2F_B"] = {1.5}, ["Union Cave B1F_A"] = {1.5, {["abilities"] = {"surf"}}}} JohtoMap["Union Cave B1F_C"] = {["Union Cave 1F_D"] = {1, {["abilities"] = {"surf"}}}, ["Union Cave B2F_C"] = {1, {["abilities"] = {"surf"}}}} JohtoMap["Union Cave B2F_A"] = {["Union Cave 1F_A"] = {1}, ["Union Cave B1F_B"] = {1}} JohtoMap["Union Cave B2F_B"] = {["Union Cave 1F_B"] = {1}, ["Union Cave B1F_B"] = {1}} JohtoMap["Union Cave B2F_C"] = {["Union Cave B1F_C"] = {1}} JohtoMap["Violet City Gym Entrance"] = {["Violet City"] = {1}, ["Violet City Gym"] = {1}} JohtoMap["Violet City Gym"] = {["Violet City Gym Entrance"] = {1}} JohtoMap["Violet City House 1"] = {["Violet City"] = {1}} JohtoMap["Violet City House 2"] = {["Violet City"] = {1}} JohtoMap["Violet City Pokemart"] = {["Violet City"] = {1}} JohtoMap["Violet City School"] = {["Violet City"] = {1}} JohtoMap["Violet City Stop House"] = {["Route 31"] = {0.2}, ["Violet City"] = {0.2}} JohtoMap["Violet City Subway"] = {["Pokecenter Violet City"] = {0.2}, ["Olivine City Subway"] = {J_SUBWAY}, ["Mahogany Town Subway"] = {J_SUBWAY}, ["Azalea Town Subway"] = {J_SUBWAY}, ["Blackthorn City Subway"] = {J_SUBWAY}, ["Cherrygrove City Subway"] = {J_SUBWAY}, ["Ecruteak City Subway"] = {J_SUBWAY}, ["Goldenrod City Subway"] = {J_SUBWAY}} JohtoMap["Violet City"] = {["Violet City House 1"] = {1}, ["Violet City House 2"] = {1}, ["Violet City Gym Entrance"] = {1}, ["Violet City School"] = {1}, ["Pokecenter Violet City"] = {1}, ["Route 32"] = {1}, ["Route 36 Stop"] = {1}, ["Violet City Pokemart"] = {1}, ["Violet City Stop House"] = {1}, ["Sprout Tower F1_A"] = {1}} JohtoMap["Whirl Islands 1F NorthEast_A"] = {["Route 41"] = {0.2}, ["Whirl Islands 1F NorthEast_B"] = {0}} JohtoMap["Whirl Islands 1F NorthEast_B"] = {["Whirl Islands 1F NorthEast_C"] = {0}, ["Whirl Islands 1F NorthEast_D"] = {0}} JohtoMap["Whirl Islands 1F NorthEast_C"] = {["Whirl Islands B1F_A"] = {0.5}} JohtoMap["Whirl Islands 1F NorthEast_D"] = {["Whirl Islands B1F_C"] = {0.5}} JohtoMap["Whirl Islands 1F NorthWest"] = {["Route 41"] = {0.5}, ["Whirl Islands B1F_A"] ={0.5}} JohtoMap["Whirl Islands 1F SouthEast"] = {["Route 41"] = {1}, ["Whirl Islands B1F_B"] = {1}} JohtoMap["Whirl Islands 1F SouthWest"] = {["Route 41"] = {1}, ["Whirl Islands B1F_B"] = {1}} JohtoMap["Whirl Islands B1F_A"] = {["Whirl Islands 1F NorthWest"] = {2}, ["Whirl Islands 1F NorthEast_C"] = {2}, ["Whirl Islands B1F_B"] = {1.5}, ["Whirl Islands B2F"] = {1.5}} JohtoMap["Whirl Islands B1F_B"] = {["Whirl Islands 1F SouthWest"] = {1}, ["Whirl Islands 1F SouthEast"] = {1}} JohtoMap["Whirl Islands B1F_C"] = {["Whirl Islands B1F_B"] = {2}, ["Whirl Islands 1F NorthEast_D"] = {2}, ["Whirl Islands B2F"] = {1.5}} JohtoMap["Whirl Islands B2F"] = {["Whirl Islands B1F_A"] = {1}, ["Whirl Islands B1F_C"] = {1}, ["Whirl Islands B3F"] = {1}, ["Whirl Islands B4F"] = {1}} JohtoMap["Whirl Islands B3F"] = {["Whirl Islands B2F"] = {1}} JohtoMap["Whirl Islands B4F"] = {["Whirl Islands B2F"] = {1}} -- JohtoMap["node"] = {["link"] = {distance, {["restrictionType"] = {"restriction"}}}} return JohtoMap end
function sysCall_threadmain() targetHandle = sim.getObjectHandle('Target') pathHandle = sim.getObjectHandle('PathPickRelease') sim.followPath(targetHandle, pathHandle, 1, 0, 0.01, 0) end function sysCall_cleanup() end
-- -- Name: premake-wix/wix.lua -- Purpose: Define the WindowsPhone action(s). -- Author: Michael Schwarcz -- Created: 2016/11/03 -- Copyright: (c) 2016 Michael Schwarcz -- local p = premake p.modules.wp = {} local m = p.modules.wp function p.config.isArmArch(cfg) return cfg.architecture == p.ARM or cfg.architecture == p.ARM64 end -- -- Patch actions -- include( "_preload.lua" ) include( "actions/vstudio.lua" ) return m
--Start of Global Scope--------------------------------------------------------- -- Create tcp ip client -- luacheck: globals gClient gClient = TCPIPClient.create() if not gClient then print('Could not create TCPIPClient') end TCPIPClient.setIPAddress(gClient, '127.0.0.1') TCPIPClient.setPort(gClient, 2120) TCPIPClient.setFraming(gClient, '\02', '\03', '\02', '\03') -- STX/ETX framing for transmit and receive TCPIPClient.register(gClient, 'OnReceive', 'gHandleReceive') TCPIPClient.connect(gClient) --End of Global Scope----------------------------------------------------------- --Start of Function and Event Scope--------------------------------------------- -- Function is called when data is received -- luacheck: globals gHandleReceive function gHandleReceive(data) if (data == 'Hello') then TCPIPClient.transmit(gClient, 'Hello Server') end end --End of Function and Event Scope------------------------------------------------
setenv("JDK32",1)
local load_time_start = os.clock() local funcs = {} function funcs.pos_to_string(pos) return "("..pos.x.."|"..pos.y.."|"..pos.z..")" end local r_corr = 0.25 --remove a bit more nodes (if shooting diagonal) to let it look like a hole (sth like antialiasing) -- this doesn't need to be calculated every time local f_1 = 0.5-r_corr local f_2 = 0.5+r_corr --returns information about the direction local function get_used_dir(dir) local abs_dir = {x=math.abs(dir.x), y=math.abs(dir.y), z=math.abs(dir.z)} local dir_max = math.max(abs_dir.x, abs_dir.y, abs_dir.z) if dir_max == abs_dir.x then local tab = {"x", {x=1, y=dir.y/dir.x, z=dir.z/dir.x}} if dir.x >= 0 then tab[3] = "+" end return tab end if dir_max == abs_dir.y then local tab = {"y", {x=dir.x/dir.y, y=1, z=dir.z/dir.y}} if dir.y >= 0 then tab[3] = "+" end return tab end local tab = {"z", {x=dir.x/dir.z, y=dir.y/dir.z, z=1}} if dir.z >= 0 then tab[3] = "+" end return tab end local function node_tab(z, d) local n1 = math.floor(z*d+f_1) local n2 = math.floor(z*d+f_2) if n1 == n2 then return {n1} end return {n1, n2} end local function return_line(pos, dir, range) --range ~= length local tab = {} local num = 1 local t_dir = get_used_dir(dir) local dir_typ = t_dir[1] if t_dir[3] == "+" then f_tab = {0, range, 1} else f_tab = {0, -range, -1} end local d_ch = t_dir[2] if dir_typ == "x" then for d = f_tab[1],f_tab[2],f_tab[3] do local x = d local ytab = node_tab(d_ch.y, d) local ztab = node_tab(d_ch.z, d) for _,y in ipairs(ytab) do for _,z in ipairs(ztab) do tab[num] = {x=pos.x+x, y=pos.y+y, z=pos.z+z} num = num+1 end end end elseif dir_typ == "y" then for d = f_tab[1],f_tab[2],f_tab[3] do local xtab = node_tab(d_ch.x, d) local y = d local ztab = node_tab(d_ch.z, d) for _,x in ipairs(xtab) do for _,z in ipairs(ztab) do tab[num] = {x=pos.x+x, y=pos.y+y, z=pos.z+z} num = num+1 end end end else for d = f_tab[1],f_tab[2],f_tab[3] do local xtab = node_tab(d_ch.x, d) local ytab = node_tab(d_ch.y, d) local z = d for _,x in ipairs(xtab) do for _,y in ipairs(ytab) do tab[num] = {x=pos.x+x, y=pos.y+y, z=pos.z+z} num = num+1 end end end end return tab end local function table_contains2(t, v) for i = #t, 1, -1 do if t[i] == v then return true end end return false end local function return_fine_line(pos, dir, range, scale) local ps1 = return_line(vector.round(vector.multiply(pos, scale)), dir, range*scale) local ps2 = {} local ps2_num = 1 for _,p1 in ipairs(ps1) do local p2 = vector.round(vector.divide(p1, scale)) if not table_contains2(ps2, p2) then ps2[ps2_num] = p2 ps2_num = ps2_num+1 end end return ps2 end function funcs.fine_line(pos, dir, range, scale) --assert_vector(pos) if not range then --dir = pos2 dir = vector.direction(pos, dir) range = vector.distance(pos, dir) end return return_fine_line(pos, dir, range, scale) end function funcs.line(pos, dir, range, alt) --assert_vector(pos) if alt then if not range then --dir = pos2 dir, range = vector.direction(pos, dir), vector.distance(pos, dir) end return return_line(pos, dir, range) end if range then --dir = pos2 dir = vector.round(vector.multiply(dir, range)) else dir = vector.subtract(dir, pos) end local line,n = {},1 for _,i in ipairs(vector.threeline(dir.x, dir.y, dir.z)) do line[n] = {x=pos.x+i[1], y=pos.y+i[2], z=pos.z+i[3]} n = n+1 end return line end local twolines = {} function funcs.twoline(x, y) local pstr = x.." "..y local line = twolines[pstr] if line then return line end line = {} local n = 1 local dirx = 1 if x < 0 then dirx = -dirx end local ymin, ymax = 0, y if y < 0 then ymin, ymax = ymax, ymin end local m = y/x --y/0 works too local dir = 1 if m < 0 then dir = -dir end for i = 0,x,dirx do local p1 = math.max(math.min(math.floor((i-0.5)*m+0.5), ymax), ymin) local p2 = math.max(math.min(math.floor((i+0.5)*m+0.5), ymax), ymin) for j = p1,p2,dir do line[n] = {i, j} n = n+1 end end twolines[pstr] = line return line end local threelines = {} function funcs.threeline(x, y, z) local pstr = x.." "..y.." "..z local line = threelines[pstr] if line then return line end if x ~= math.floor(x) then minetest.log("error", "[vector_extras] INFO: The position used for vector.threeline isn't round.") end local two_line = vector.twoline(x, y) line = {} local n = 1 local zmin, zmax = 0, z if z < 0 then zmin, zmax = zmax, zmin end local m = z/math.hypot(x, y) local dir = 1 if m < 0 then dir = -dir end for _,i in ipairs(two_line) do local px, py = unpack(i) local ph = math.hypot(px, py) local z1 = math.max(math.min(math.floor((ph-0.5)*m+0.5), zmax), zmin) local z2 = math.max(math.min(math.floor((ph+0.5)*m+0.5), zmax), zmin) for pz = z1,z2,dir do line[n] = {px, py, pz} n = n+1 end end threelines[pstr] = line return line end function funcs.sort(ps, preferred_coords) preferred_coords = preferred_coords or {"z", "y", "x"} local a,b,c = unpack(preferred_coords) local function ps_sorting(p1, p2) if p1[a] == p2[a] then if p1[b] == p2[a] then if p1[c] < p2[c] then return true end elseif p1[b] < p2[b] then return true end elseif p1[a] < p2[a] then return true end end table.sort(ps, ps_sorting) end function funcs.scalar(v1, v2) return v1.x*v2.x + v1.y*v2.y + v1.z*v2.z end function funcs.cross(v1, v2) return { x = v1.y*v2.z - v1.z*v2.y, y = v1.z*v2.x - v1.x*v2.z, z = v1.x*v2.y - v1.y*v2.x } end --not optimized --local areas = {} function funcs.plane(ps) -- sort positions and imagine the first one (A) as vector.zero ps = vector.sort(ps) local pos = ps[1] local B = vector.subtract(ps[2], pos) local C = vector.subtract(ps[3], pos) -- get the positions for the fors local cube_p1 = {x=0, y=0, z=0} local cube_p2 = {x=0, y=0, z=0} for i in pairs(cube_p1) do cube_p1[i] = math.min(B[i], C[i], 0) cube_p2[i] = math.max(B[i], C[i], 0) end cube_p1 = vector.apply(cube_p1, math.floor) cube_p2 = vector.apply(cube_p2, math.ceil) local vn = vector.normalize(vector.cross(B, C)) local nAB = vector.normalize(B) local nAC = vector.normalize(C) local angle_BAC = math.acos(vector.scalar(nAB, nAC)) local nBA = vector.multiply(nAB, -1) local nBC = vector.normalize(vector.subtract(C, B)) local angle_ABC = math.acos(vector.scalar(nBA, nBC)) for z = cube_p1.z, cube_p2.z do for y = cube_p1.y, cube_p2.y do for x = cube_p1.x, cube_p2.x do local p = {x=x, y=y, z=z} local n = -vector.scalar(p, vn)/vector.scalar(vn, vn) if math.abs(n) <= 0.5 then local ep = vector.add(p, vector.multiply(vn, n)) local nep = vector.normalize(ep) local angle_BAep = math.acos(vector.scalar(nAB, nep)) local angle_CAep = math.acos(vector.scalar(nAC, nep)) local angldif = angle_BAC - (angle_BAep+angle_CAep) if math.abs(angldif) < 0.001 then ep = vector.subtract(ep, B) nep = vector.normalize(ep) local angle_ABep = math.acos(vector.scalar(nBA, nep)) local angle_CBep = math.acos(vector.scalar(nBC, nep)) local angldif = angle_ABC - (angle_ABep+angle_CBep) if math.abs(angldif) < 0.001 then table.insert(ps, vector.add(pos, p)) end end end end end end return ps end function funcs.straightdelay(s, v, a) if not a then return s/v end return (math.sqrt(v*v+2*a*s)-v)/a end vector.zero = vector.new() function funcs.sun_dir(time) if not time then time = minetest.get_timeofday() end local t = (time-0.5)*5/6+0.5 --the sun rises at 5 o'clock, not at 6 if t < 0.25 or t > 0.75 then return end local tmp = math.cos(math.pi*(2*t-0.5)) return {x=tmp, y=math.sqrt(1-tmp*tmp), z=0} end function funcs.inside(pos, minp, maxp) for _,i in pairs({"x", "y", "z"}) do if pos[i] < minp[i] or pos[i] > maxp[i] then return false end end return true end function funcs.minmax(p1, p2) local p1 = vector.new(p1) local p2 = vector.new(p2) for _,i in ipairs({"x", "y", "z"}) do if p1[i] > p2[i] then p1[i], p2[i] = p2[i], p1[i] end end return p1, p2 end function funcs.move(p1, p2, s) return vector.round( vector.add( vector.multiply( vector.direction( p1, p2 ), s ), p1 ) ) end function funcs.from_number(i) return {x=i, y=i, z=i} end local explosion_tables = {} function funcs.explosion_table(r) local table = explosion_tables[r] if table then return table end local t1 = os.clock() local tab, n = {}, 1 local tmp = r*r + r for x=-r,r do for y=-r,r do for z=-r,r do local rc = x*x+y*y+z*z if rc <= tmp then local np={x=x, y=y, z=z} if math.floor(math.sqrt(rc) +0.5) > r-1 then tab[n] = {np, true} else tab[n] = {np} end n = n+1 end end end end explosion_tables[r] = tab minetest.log("info", string.format("[vector_extras] table created after ca. %.2fs", os.clock() - t1)) return tab end local default_nparams = { offset = 0, scale = 1, seed = 1337, octaves = 6, persist = 0.6 } function funcs.explosion_perlin(rmin, rmax, nparams) local t1 = os.clock() local r = math.ceil(rmax) nparams = nparams or {} for i,v in pairs(default_nparams) do nparams[i] = nparams[i] or v end nparams.spread = nparams.spread or vector.from_number(r*5) local pos = {x=math.random(-30000, 30000), y=math.random(-30000, 30000), z=math.random(-30000, 30000)} local map = minetest.get_perlin_map(nparams, vector.from_number(r+r+1)):get3dMap_flat(pos) local id = 1 local bare_maxdist = rmax*rmax local bare_mindist = rmin*rmin local mindist = math.sqrt(bare_mindist) local dist_diff = math.sqrt(bare_maxdist)-mindist mindist = mindist/dist_diff local pval_min, pval_max local tab, n = {}, 1 for z=-r,r do local bare_dist = z*z for y=-r,r do local bare_dist = bare_dist+y*y for x=-r,r do local bare_dist = bare_dist+x*x local add = bare_dist < bare_mindist local pval, distdiv if not add and bare_dist <= bare_maxdist then distdiv = math.sqrt(bare_dist)/dist_diff-mindist pval = math.abs(map[id]) -- strange perlin values… if not pval_min then pval_min = pval pval_max = pval else pval_min = math.min(pval, pval_min) pval_max = math.max(pval, pval_max) end add = true--distdiv < 1-math.abs(map[id]) end if add then tab[n] = {{x=x, y=y, z=z}, pval, distdiv} n = n+1 end id = id+1 end end end -- change strange values local pval_diff = pval_max - pval_min pval_min = pval_min/pval_diff for n,i in pairs(tab) do if i[2] then local new_pval = math.abs(i[2]/pval_diff - pval_min) if i[3]+0.33 < new_pval then tab[n] = {i[1]} elseif i[3] < new_pval then tab[n] = {i[1], true} else tab[n] = nil end end end minetest.log("info", string.format("[vector_extras] table created after ca. %.2fs", os.clock() - t1)) return tab end local circle_tables = {} function funcs.circle(r) local table = circle_tables[r] if table then return table end local t1 = os.clock() local tab, n = {}, 1 for i = -r, r do for j = -r, r do if math.floor(math.sqrt(i*i+j*j)+0.5) == r then tab[n] = {x=i, y=0, z=j} n = n+1 end end end circle_tables[r] = tab minetest.log("info", string.format("[vector_extras] table created after ca. %.2fs", os.clock() - t1)) return tab end local ring_tables = {} function funcs.ring(r) local table = ring_tables[r] if table then return table end local t1 = os.clock() local tab, n = {}, 1 local tmp = r*r local p = {x=math.floor(r+0.5), z=0} while p.x > 0 do tab[n] = p n = n+1 local p1, p2 = {x=p.x-1, z=p.z}, {x=p.x, z=p.z+1} local dif1 = math.abs(tmp-p1.x*p1.x-p1.z*p1.z) local dif2 = math.abs(tmp-p2.x*p2.x-p2.z*p2.z) if dif1 <= dif2 then p = p1 else p = p2 end end local tab2, n = {}, 1 for _,i in ipairs(tab) do for _,j in ipairs({ {i.x, i.z}, {-i.z, i.x}, {-i.x, -i.z}, {i.z, -i.x}, }) do tab2[n] = {x=j[1], y=0, z=j[2]} n = n+1 end end ring_tables[r] = tab2 minetest.log("info", string.format("[vector_extras] table created after ca. %.2fs", os.clock() - t1)) return tab2 end function funcs.chunkcorner(pos) return {x=pos.x-pos.x%16, y=pos.y-pos.y%16, z=pos.z-pos.z%16} end function funcs.point_distance_minmax(p1, p2) local p1 = vector.new(p1) local p2 = vector.new(p2) local min, max, vmin, vmax, num for _,i in ipairs({"x", "y", "z"}) do num = math.abs(p1[i] - p2[i]) if not vmin or num < vmin then vmin = num min = i end if not vmax or num > vmax then vmax = num max = i end end return min, max end function funcs.collision(p1, p2) local clear, node_pos, collision_pos, max, min, dmax, dcmax, pt clear, node_pos = minetest.line_of_sight(p1, p2) if clear then return false end collision_pos = {} min, max = funcs.point_distance_minmax(node_pos, p2) if node_pos[max] > p2[max] then collision_pos[max] = node_pos[max] - 0.5 else collision_pos[max] = node_pos[max] + 0.5 end dmax = p2[max] - node_pos[max] dcmax = p2[max] - collision_pos[max] pt = dcmax/dmax for _,i in ipairs({"x", "y", "z"}) do collision_pos[i] = p2[i] - (p2[i] - node_pos[i]) * pt end return true, collision_pos, node_pos end function funcs.get_data_from_pos(tab, z,y,x) local data = tab[z] if data then data = data[y] if data then return data[x] end end end function funcs.set_data_to_pos(tab, z,y,x, data) if tab[z] then if tab[z][y] then tab[z][y][x] = data return end tab[z][y] = {[x] = data} return end tab[z] = {[y] = {[x] = data}} end function funcs.set_data_to_pos_optional(tab, z,y,x, data) if vector.get_data_from_pos(tab, z,y,x) ~= nil then return end funcs.set_data_to_pos(tab, z,y,x, data) end function funcs.remove_data_from_pos(tab, z,y,x) if vector.get_data_from_pos(tab, z,y,x) == nil then return end tab[z][y][x] = nil if not next(tab[z][y]) then tab[z][y] = nil end if not next(tab[z]) then tab[z] = nil end end function funcs.get_data_pos_table(tab) local t,n = {},1 local minz, miny, minx, maxz, maxy, maxx for z,yxs in pairs(tab) do if not minz then minz = z maxz = z else minz = math.min(minz, z) maxz = math.max(maxz, z) end for y,xs in pairs(yxs) do if not miny then miny = y maxy = y else miny = math.min(miny, y) maxy = math.max(maxy, y) end for x,v in pairs(xs) do if not minx then minx = x maxx = x else minx = math.min(minx, x) maxx = math.max(maxx, x) end t[n] = {z,y,x, v} n = n+1 end end end return t, {x=minx, y=miny, z=minz}, {x=maxx, y=maxy, z=maxz}, n-1 end function funcs.update_minp_maxp(minp, maxp, pos) for _,i in pairs({"z", "y", "x"}) do minp[i] = math.min(minp[i], pos[i]) maxp[i] = math.max(maxp[i], pos[i]) end end function funcs.quickadd(pos, z,y,x) if z then pos.z = pos.z+z end if y then pos.y = pos.y+y end if x then pos.x = pos.x+x end end function funcs.unpack(pos) return pos.z, pos.y, pos.x end dofile(minetest.get_modpath("vector_extras").."/vector_meta.lua") for name,func in pairs(funcs) do vector[name] = vector[name] or func end minetest.log("info", string.format("[vector_extras] loaded after ca. %.2fs", os.clock() - load_time_start))
gg.alert("BAKIMDA")
--[[ - Author: yoosan, SYSUDNLP Group - Date: 16/3/11, 2016. - Licence MIT --]] require('torch') require('sys') require('lfs') require('nn') require('nngraph') require('optim') require('xlua') include('utils/misc.lua') include('utils/data.lua') include('model/GRU.lua') include('model/LSTM.lua')
ABILITY_ATTACK = 3 ABILITY_ICE = 5 ABILITY_SLASH = 6 ABILITY_THROW = 7 ABILITY_KICK = 8 ABILITY_PLANT = 9 ABILITY_FIRE = 10 ABILITY_ROLL = 11 ABILITY_BURROW = 12 ABILITY_HEAL = 13 function play_sample_later(name, delay) local t if (delay > 0) then t = create_idle_tween(delay) else t = {} end append_tween(t, create_play_sample_tween(name)) new_tween(t) end function add_heal_drop(tween, id, elapsed) local drop = add_particle( tween.pgid, 1, 1, 1, 1, 1, 1, 0, 0, true, false ) set_particle_position(drop, tween.x, tween.y) set_particle_blackboard(drop, 0, tween.entity_start_x) set_particle_blackboard(drop, 1, tween.entity_start_y) set_particle_blackboard(drop, 2, tween.entity_id) set_particle_blackboard(drop, 3, 0) set_particle_blackboard(drop, 4, 18) set_particle_blackboard(drop, 5, 2) set_particle_blackboard(drop, 6, 0) return true end function heal_player(tween, id, elapsed) play_sample("sfx/heal_drop.ogg") increase_hp(tween.entity_id, tween.amount) local x, y = get_entity_position(tween.entity_id) local pgid = add_particle_group( "heal_part", 0, PARTICLE_HURT_NONE, "heal_star/1", "heal_star/2", "heal_star/3", "heal_star/4", "heal_star/5", "heal_star/6", "heal_star/7", "heal_star/8" ) local star = add_particle( pgid, 1, 1, 1, 1, 1, 1, 0, 0, true, false ) local w, h = get_entity_animation_size(tween.entity_id) set_particle_position(star, x, y-32) set_particle_blackboard(star, 0, x) set_particle_blackboard(star, 1, y) set_particle_blackboard(star, 2, tween.entity_id) set_particle_blackboard(star, 3, 0) set_particle_blackboard(star, 4, 8) set_particle_blackboard(star, 5, 4) set_particle_blackboard(star, 6, 0) pgid = add_particle_group( "heal_part", 0, PARTICLE_HURT_NONE, "heal_drop/1", "heal_drop/2", "heal_drop/3", "heal_drop/4", "heal_drop/5", "heal_drop/6", "heal_drop/7", "heal_drop/8", "heal_drop/9", "heal_drop/10", "heal_drop/11", "heal_drop/12", "heal_drop/13", "heal_drop/14", "heal_drop/15", "heal_drop/16", "heal_drop/17", "heal_drop/18" ) for i=0,31 do local t = create_idle_tween(LOGIC_MILLIS/1000*i) append_tween(t, { run=add_heal_drop, x=x-32+i*2, y=y-24, entity_start_x=x, entity_start_y=y, entity_id=tween.entity_id, pgid=pgid }) new_tween(t) end return true end function heal(id, amount) local t = create_idle_tween(0.2) append_tween(t, { run = heal_player, entity_id = id, amount = amount }) new_tween(t) end function player_ability_button(player_id, ability) for i=0,3 do if (get_ability_name(player_id, true, i) == ability) then return i end end return nil end
-- A component to render metrics from the user input local convert = require "convert" local Glyph = require "glyph" local Metric = require "metric" local Box = require "box" local Actions = { canvas = nil, style = { skew_yx = 0.1, skew_xy = -0.2, margin_right = 50, margin_bottom = 80, color = { 1, 1, 1, 0.8 }, dim = { 1, 1, 1, 0.4 } } } function Actions:new (canvas, data) local o = setmetatable ({}, self) self.__index = self o.canvas = canvas o.data = data o.score = Metric:new (o.canvas, o.data.total, nil, "%06d", 32, o.style.color) o.hand = Glyph:new (o.canvas, Glyph.Hand, 48, o.style.color) o.tags = { Glyph:new (o.canvas, Glyph.Infinity, 36, o.style.dim) } local scalar = convert.round (o.data.scrolls_rate, 2) o.scrolls = Box:new (o.canvas, scalar, 52, Glyph.Scroll) scalar = convert.round (o.data.moves_rate, 2) o.moves = Box:new (o.canvas, scalar, 52, Glyph.Move) scalar = convert.round (o.data.clicks_rate, 2) o.clicks = Box:new (o.canvas, scalar, 52, Glyph.Click) scalar = convert.round (o.data.strokes_rate, 2) o.strokes = Box:new (o.canvas, scalar, 52, Glyph.Stroke) o.x = 0 o.y = 0 return o end function Actions:locate (x, y) self.x = x self.y = y end function Actions:render () local scale = self.canvas.scale local skew_yx = self.style.skew_yx local skew_xy = self.style.skew_xy local margin_right = self.style.margin_right * scale local margin_bottom = self.style.margin_bottom * scale local x = self.x - margin_right local y = self.y - margin_bottom local dx = -1 * skew_xy * y local dy = -1 * skew_yx * x self.canvas:apply_transform (1, skew_yx, skew_xy, 1, dx, dy) self.hand:locate (x - self.hand.width, y) self.hand:render () for i = 1, table.getn (self.tags) do local tag_x = self.hand.x + self.hand.width - self.tags[i].width local tag_y = self.hand.y + (32 * scale) if i > 1 then local tag_x = self.tags[i - 1].x - self.tags[i].width - (6 * scale) end self.tags[i]:locate (tag_x, tag_y) self.tags[i]:render () end local x1 = self.hand.x - (4 * scale) local y1 = self.hand.y + (6 * scale) local x2 = self.hand.x + self.hand.width + (6 * scale) local y2 = y1 self.canvas:draw_line (x1, y1, x2, y2, 1 * scale, self.style.dim) y1 = self.hand.y - self.hand.height - (6 * scale) y2 = y1 self.canvas:draw_line (x1, y1, x2, y2, 1 * scale, self.style.dim) self.score:locate ( self.hand.x + self.hand.width - self.score.width, self.hand.y - self.hand.height - (18 * scale)) self.score:render () self.scrolls:locate ( self.hand.x - self.scrolls.width - (25 * scale), self.hand.y - (self.hand.height / 2) + (self.scrolls.height / 2) - (2 * scale)) self.scrolls:render () self.moves:locate ( self.scrolls.x - self.moves.width - (10 * scale), self.scrolls.y) self.moves:render () self.clicks:locate ( self.moves.x - self.clicks.width - (10 * scale), self.moves.y) self.clicks:render () x1 = self.clicks.x - (15 * scale) y1 = self.clicks.y - (2 * scale) x2 = x1 y2 = y1 - self.clicks.height + (4 * scale) self.canvas:draw_line (x1, y1, x2, y2, 1 * scale, self.style.dim) self.strokes:locate ( self.clicks.x - self.strokes.width - (30 * scale), self.clicks.y) self.strokes:render () self.canvas:restore_transform () end return Actions
function love.keypressed(key, scancode, isrepeat) local x, y = love.mouse.getPosition() local mx, my = fromScreen(x, y) if key == "return" then app.enterPressed = true end -- first handle actions that are allowed to repeat when holding key local dx, dy = 0, 0 if key == "left" then dx = -1 end if key == "right" then dx = 1 end if key == "up" then dy = -1 end if key == "down" then dy = 1 end if project.selection then project.selection.x = project.selection.x + dx*8 project.selection.y = project.selection.y + dy*8 end -- Ctrl+Z, Ctrl+Shift+Z if love.keyboard.isDown("lctrl") then if key == "z" then if love.keyboard.isDown("lshift") then redo() else undo() end end end -- room switching / swapping if key == "down" or key == "up" then if app.room then local n1 = app.room local n2 = key == "down" and app.room + 1 or app.room - 1 if project.rooms[n1] and project.rooms[n2] then if love.keyboard.isDown("lctrl") then -- swap local tmp = project.rooms[n1] project.rooms[n1] = project.rooms[n2] project.rooms[n2] = tmp end app.room = n2 end end end if isrepeat then return end -- non-repeatable global shortcuts if love.keyboard.isDown("lctrl") or love.keyboard.isDown("rctrl") then -- Ctrl+O if key == "o" then local filename = filedialog.open() local openOk = false if filename then local ext = string.match(filename, ".(%w+)$") if ext == "ahm" then openOk = openMap(filename) elseif ext == "p8" then openOk = openPico8(filename) end if openOk then app.history = {} app.historyN = 0 pushHistory() end end if openOk then showMessage("Opened "..string.match(filename, psep.."([^"..psep.."]*)$")) else showMessage("Failed to open file") end -- Ctrl+R elseif key == "r" then if app.openFileName then local data = loadpico8(app.openFileName) p8data.spritesheet = data.spritesheet showMessage("Reloaded") end -- Ctrl+S elseif key == "s" then local filename if app.saveFileName and not love.keyboard.isDown("lshift") then filename = app.saveFileName else filename = filedialog.save() end if filename and savePico8(filename) then showMessage("Saved "..string.match(filename, psep.."([^"..psep.."]*)$")) else showMessage("Failed to save cart") end -- Ctrl+X elseif key == "x" then if love.keyboard.isDown("lshift") then -- cut entire room if activeRoom() then local s = dumplua {"room", activeRoom()} love.system.setClipboardText(s) table.remove(project.rooms, app.room) app.room = nil showMessage("Cut room") end else -- cut selection if project.selection then local s = dumplua {"selection", project.selection} love.system.setClipboardText(s) project.selection = nil showMessage("Cut") end end -- Ctrl+C elseif key == "c" then if love.keyboard.isDown("lshift") then -- copy entire room if activeRoom() then local s = dumplua {"room", activeRoom()} love.system.setClipboardText(s) showMessage("Copied room") end else -- copy selection if project.selection then local s = dumplua {"selection", project.selection} love.system.setClipboardText(s) placeSelection() showMessage("Copied") end end -- Ctrl+V elseif key == "v" then placeSelection() -- to clean selection first local t, err = loadlua(love.system.getClipboardText()) if not err then if type(t) == "table" then if t[1] == "selection" then local s = t[2] project.selection = s project.selection.x = roundto8(mx - s.w*4) project.selection.y = roundto8(my - s.h*4) app.tool = "select" showMessage("Pasted") elseif t[1] == "room" then local r = t[2] r.x = roundto8(mx - r.w*4) r.y = roundto8(my - r.h*4) table.insert(project.rooms, r) app.room = #project.rooms else err = true end else err = true end end if err then showMessage("Failed to paste (did you paste something you're not supposed to?)") end elseif key == "a" then if activeRoom() then app.tool = "select" select(0, 0, activeRoom().w - 1, activeRoom().h - 1) end elseif key=="h" then app.showGarbageTiles=not app.showGarbageTiles end else -- if ctrl is not down if key == "delete" and love.keyboard.isDown("lshift") then if app.room then table.remove(project.rooms, app.room) if not activeRoom() then app.room = #project.rooms end end end end -- now pass to nuklear and return if consumed if ui:keypressed(key, scancode, isrepeat) then return end -- now editing things (that shouldn't happen if you have a nuklear window focused or something) if key == "n" then local room = newRoom(roundto8(mx), roundto8(my), 16, 16) -- disabled that shit -- generate alphabetic room title --local n, title = 0, nil --while true do --title = b26(n) --local exists = false --for _, otherRoom in ipairs(project.rooms) do --if otherRoom.title == title then --exists = true --end --end --if not exists then --break --end --n = n + 1 --end --room.title = title room.title = "" table.insert(project.rooms, room) app.room = #project.rooms app.roomAdded = true elseif key == "space" then app.showToolPanel = not app.showToolPanel elseif key == "return" then placeSelection() elseif key == "tab" and not love.keyboard.isDown("lalt") then if not app.playtesting then app.playtesting = 1 elseif app.playtesting == 1 then app.playtesting = 2 else app.playtesting = false end elseif key == "delete" then local room=activeRoom() if project.selected_camtrigger and room then --TODO: make sure to unselect camtriggers on room switch for i,v in ipairs(room.camtriggers) do if v==project.selected_camtrigger then table.remove(room.camtriggers, i) project.selected_camtrigger=nil break end end end end end function love.keyreleased(key, scancode) -- just save history every time a key is released lol pushHistory() if ui:keyreleased(key, scancode) then return end end function love.textinput(text) ui:textinput(text) end
--*********************************************************** --** ROBERT JOHNSON ** --*********************************************************** ---@class ISTicketsUI : ISPanel ISTicketsUI = ISPanel:derive("ISTicketsUI"); ISTicketsUI.messages = {}; local FONT_HGT_SMALL = getTextManager():getFontHeight(UIFont.Small) local FONT_HGT_MEDIUM = getTextManager():getFontHeight(UIFont.Medium) local FONT_HGT_LARGE = getTextManager():getFontHeight(UIFont.Large) local HEADER_HGT = FONT_HGT_SMALL + 2 * 2 --************************************************************************-- --** ISTicketsUI:initialise --** --************************************************************************-- function ISTicketsUI:initialise() ISPanel.initialise(self); local btnWid = 100 local btnHgt = math.max(25, FONT_HGT_SMALL + 3 * 2) local btnHgt2 = 18 local padBottom = 10 self.no = ISButton:new(10, self:getHeight() - padBottom - btnHgt, btnWid, btnHgt, getText("UI_Cancel"), self, ISTicketsUI.onClick); self.no.internal = "CANCEL"; self.no.anchorTop = false self.no.anchorBottom = true self.no:initialise(); self.no:instantiate(); self.no.borderColor = {r=1, g=1, b=1, a=0.1}; self:addChild(self.no); local y = 20 + FONT_HGT_MEDIUM + HEADER_HGT self.datas = ISScrollingListBox:new(10, y, self.width - 20, self.height - padBottom - btnHgt - padBottom - y); self.datas:initialise(); self.datas:instantiate(); self.datas.itemheight = FONT_HGT_SMALL + 2 * 2; self.datas.selected = 0; self.datas.joypadParent = self; self.datas.font = UIFont.NewSmall; self.datas.doDrawItem = self.drawDatas; self.datas.drawBorder = true; self:addChild(self.datas); self.addTicketBtn = ISButton:new(self:getWidth() - btnWid - 10, self:getHeight() - padBottom - btnHgt, btnWid, btnHgt, getText("IGUI_TicketUI_AddTicket"), self, ISTicketsUI.onClick); self.addTicketBtn.internal = "ADDTICKET"; self.addTicketBtn.anchorTop = false self.addTicketBtn.anchorBottom = true self.addTicketBtn:initialise(); self.addTicketBtn:instantiate(); self.addTicketBtn.borderColor = {r=1, g=1, b=1, a=0.1}; self.addTicketBtn:setWidthToTitle(btnWid) self.addTicketBtn:setX(self.width - self.addTicketBtn.width - 10) self:addChild(self.addTicketBtn); self:getTickets(); end function ISTicketsUI:getTickets() getTickets(self.player:getUsername()); end function ISTicketsUI:populateList() self.datas:clear(); for i=0,self.tickets:size()-1 do local ticket = self.tickets:get(i); local item = {} item.ticket = ticket item.richText = ISRichTextLayout:new(self.datas:getWidth() - 100 - 10 * 2) item.richText.marginLeft = 0 item.richText.marginTop = 0 item.richText.marginRight = 0 item.richText.marginBottom = 0 item.richText:setText(ticket:getMessage()) item.richText:initialise() item.richText:paginate() if ticket:getAnswer() then item.richText2 = ISRichTextLayout:new(self.datas:getWidth() - 20 - 10 * 2) item.richText2.marginLeft = 0 item.richText2.marginTop = 0 item.richText2.marginRight = 0 item.richText2.marginBottom = 0 item.richText2:setText(ticket:getAnswer():getAuthor() .. ": " .. ticket:getAnswer():getMessage()) item.richText2:initialise() item.richText2:paginate() end self.datas:addItem(ticket:getAuthor(), item); end end function ISTicketsUI:drawDatas(y, item, alt) local a = 0.9; local answerHeight = 0; -- self.parent.selectedFaction = nil; self:drawRectBorder(0, (y), self:getWidth(), item.height - 1, a, self.borderColor.r, self.borderColor.g, self.borderColor.b); if self.selected == item.index then self:drawRect(0, (y), self:getWidth(), item.height - 1, 0.3, 0.7, 0.35, 0.15); -- self.parent.viewBtn.enable = true; -- self.parent.selectedFaction = item.item; end local ticket = item.item.ticket self:drawText(ticket:getTicketID() .. "", 10, y + 2, 1, 1, 1, a, self.font); item.item.richText:render(110, y + 2, self) local messageHeight = math.max(item.item.richText:getHeight() + 4, self.itemheight) if ticket:getAnswer() then answerHeight = math.max(item.item.richText2:getHeight() + 4, self.itemheight) -- self:drawText("Answer", 30, y + 2 + messageHeight, 1, 1, 1, a, self.font); item.item.richText2:render(20, y + 2 + messageHeight, self) self:drawRect(0, (y + messageHeight), self:getWidth(), answerHeight - 1, 0.15, 1, 1, 1); end self:drawRect(100, y-1, 1, messageHeight, 1, self.borderColor.r, self.borderColor.g, self.borderColor.b); return y + messageHeight + answerHeight; end function ISTicketsUI:prerender() local z = 10; self:drawRect(0, 0, self.width, self.height, self.backgroundColor.a, self.backgroundColor.r, self.backgroundColor.g, self.backgroundColor.b); self:drawRectBorder(0, 0, self.width, self.height, self.borderColor.a, self.borderColor.r, self.borderColor.g, self.borderColor.b); self:drawText(getText("UI_userpanel_tickets"), self.width/2 - (getTextManager():MeasureStringX(UIFont.Medium, getText("UI_userpanel_tickets")) / 2), z, 1,1,1,1, UIFont.Medium); end function ISTicketsUI:render() self:drawRectBorder(self.datas.x, self.datas.y - HEADER_HGT, self.datas:getWidth(), HEADER_HGT + 1, 1, self.borderColor.r, self.borderColor.g, self.borderColor.b); self:drawRect(self.datas.x, 1 + self.datas.y - HEADER_HGT, self.datas.width, HEADER_HGT,self.listHeaderColor.a,self.listHeaderColor.r, self.listHeaderColor.g, self.listHeaderColor.b); self:drawRect(self.datas.x + 100, 1 + self.datas.y - HEADER_HGT, 1, HEADER_HGT,1,self.borderColor.r, self.borderColor.g, self.borderColor.b); self:drawText("TicketID", self.datas.x + 5, self.datas.y - HEADER_HGT + 2, 1,1,1,1,UIFont.Small); self:drawText("Message", self.datas.x + 110, self.datas.y - HEADER_HGT + 2, 1,1,1,1,UIFont.Small); end function ISTicketsUI:onClick(button) if button.internal == "CANCEL" then self:close() end if button.internal == "ADDTICKET" then local inset = 2 local btnHgt = math.max(25, FONT_HGT_SMALL + 3 * 2) local titleBarHeight = 16 local height = titleBarHeight + 8 + FONT_HGT_SMALL + 8 + FONT_HGT_MEDIUM * 5 + inset * 2 + btnHgt + 10 * 2 height = math.max(height, 200) local modal = ISTextBox:new(self.x + 50, 200, 400, height, getText("IGUI_TicketUI_AddTicket"), "", self, ISTicketsUI.onAddTicket); modal:setNumberOfLines(5) modal:setMaxLines(5) modal:setMultipleLine(true) modal.changedName = button.changedName; modal:initialise(); modal:addToUIManager(); end end function ISTicketsUI:close() self:setVisible(false) self:removeFromUIManager() end ISTicketsUI.gotTickets = function(tickets) if ISTicketsUI.instance and ISTicketsUI.instance:isVisible() then ISTicketsUI.instance.tickets = tickets; ISTicketsUI.instance:populateList(); end end function ISTicketsUI:onAddTicket(button) if button.internal == "OK" then if (button.parent.entry:getText() and button.parent.entry:getText() ~= "")then addTicket(self.player:getUsername(), button.parent.entry:getText(), -1); end end end --************************************************************************-- --** ISTicketsUI:new --** --************************************************************************-- function ISTicketsUI:new(x, y, width, height, player) local o = {} x = getCore():getScreenWidth() / 2 - (width / 2); y = getCore():getScreenHeight() / 2 - (height / 2); o = ISPanel:new(x, y, width, height); setmetatable(o, self) self.__index = self o.borderColor = {r=0.4, g=0.4, b=0.4, a=1}; o.backgroundColor = {r=0, g=0, b=0, a=0.8}; o.listHeaderColor = {r=0.4, g=0.4, b=0.4, a=0.3}; o.width = width; o.height = height; o.player = player; o.selectedFaction = nil; o.moveWithMouse = true; o.tickets = nil; ISTicketsUI.instance = o; return o; end Events.ViewTickets.Add(ISTicketsUI.gotTickets)
----------------------------------- -- Attachment: Flashbulb ----------------------------------- require("scripts/globals/status") ----------------------------------- function onEquip(pet) pet:addListener("AUTOMATON_ATTACHMENT_CHECK", "ATTACHMENT_FLASHBULB", function(automaton, target) local master = automaton:getMaster() if not automaton:hasRecast(tpz.recast.ABILITY, 1947) and master and master:countEffect(tpz.effect.LIGHT_MANEUVER) > 0 and (automaton:checkDistance(target) - target:getModelSize()) < 7 then automaton:useMobAbility(1947) end end) end function onUnequip(pet) pet:removeListener("ATTACHMENT_FLASHBULB") end function onManeuverGain(pet, maneuvers) end function onManeuverLose(pet, maneuvers) end
hook_enabled = false function hook(ev) if not hook_enabled then return end local info=debug.getinfo(2) for k, v in pairs(info) do io.write(" "..tostring(k)..":"..tostring(v).." |") end for i = 1, 5 do local k, v = debug.getlocal(2, i) io.write("| "..tostring(k)..":"..tostring(v).." ") end io.write("\n") end function trace(fn, ...) print("---") debug.sethook(hook, "c") hook_enabled = true local ret = {fn(...)} hook_enabled = false debug.sethook(nil) print("---") return unpack(ret) end fib = function(x,y,z) return ((x<2) and x) or (fib(x-2)+fib(x-1)) end print("result:", trace(fib,2))
-- Angel's Petrochemical Processing seablock.overwrite_setting('bool-setting', 'angels-disable-bobs-electrolysers', true) seablock.overwrite_setting('bool-setting', 'angels-disable-bobs-chemical-plants', true) seablock.overwrite_setting('bool-setting', 'angels-disable-bobs-distilleries', true) seablock.overwrite_setting('bool-setting', 'angels-enable-acids', true) seablock.set_setting_default_value('bool-setting', 'angels-enable-converter', false)
object_static_structure_dathomir_static_zombie_arm = object_static_structure_dathomir_shared_static_zombie_arm:new { } ObjectTemplates:addTemplate(object_static_structure_dathomir_static_zombie_arm, "object/static/structure/dathomir/static_zombie_arm.iff")
-- Цены на тюнинг local tuningPrices = { -- Покраска кузова body_color = {0, 1}, -- Смена номерного знака numberplate = {0, 1}, -- Смена высоты подвески suspension = {0, 1}, -- Спойлеры spoiler_color = {0, 1}, spoilers = { {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1} }, -- Колёса wheels_size = {0, 1}, wheels_advanced = {0, 1}, wheels_color = {0, 1}, wheels = { {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1} }, exhausts = { {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, }, -- Улучшения upgrades_level = 1, upgrade_price_drift = 0, upgrade_price_street = 0, } function getTuningPrices(name) if name then if tuningPrices[name] then return tuningPrices[name] else return {0, 1, false} end end end
local class = require 'lib.middleclass' local inspect = require 'lib.inspect' local Blocks = require 'src.blocks' local MapSystem = require 'src.mapsystem' local Entity = require 'src.entity' local Player = class('Player', Entity) local frc, acc, dec, top, low = 700, 500, 6000, 350, 50 local jumpAccel = -100 function Player:initialize(world, x,y,w,h) Entity.initialize(self, world, x, y, w, h) self.jumpFactor = -435 self.jumpCount, self.jumpCountMax = 0, 2 self.keyCount = 0 self.isDoor = false self.onGround = false end local function collisionFilter(item, other) return 'slide' end function Player:changeVelocityByKeys(dt) local lk = love.keyboard local vx, vy = self.vx, self.vy if lk.isDown('right') then if vx < 0 then vx = vx + dec * dt elseif vx < top then vx = vx + acc * dt end elseif lk.isDown('left') then if vx > 0 then vx = vx - dec * dt elseif vx > -top then vx = vx - acc * dt end else if math.abs(vx) < low then vx = 0 elseif vx > 0 then vx = vx - frc * dt elseif vx < 0 then vx = vx + frc * dt end end self.vx, self.vy = vx, vy end function Player:checkIfOnGround(ny) if ny < 0 then self.onGround = true end end function Player:checkJumpCount(ny) if ny < 0 then self.jumpCount = 0 end end function Player:setPosition(x, y) self.x, self.y = x, y end local debugStr = {'','','','',''} function Player:moveCollide(dt) local world = self.world self.onGround = false local futureX, futureY = self.x + (self.vx * dt), self.y + (self.vy * dt) local nextX, nextY, cols, len = world:move(self, futureX, futureY, collisionFilter) for i=1, len do local col = cols[i] if col.other.type == 'Key' then self:addKey() world:remove(col.other) MapSystem:removeTile(col.other.x, col.other.y) end if col.other.type == 'Door' then self.isDoor = true else self.isDoor = false end if col.other.type == 'Enemy' then gameState = "dead" end local tileIndex = MapSystem:getTileIndex(col.other.x, col.other.y) debugStr[5] = 'Current: '..col.other.type..' x: '..col.other.x..' y: '..col.other.y..' i: '..tileIndex self:changeVelocityByCollisionNormal(col.normal.x, col.normal.y, bounciness) self:checkIfOnGround(col.normal.y) self:checkJumpCount(col.normal.y) end self.x, self.y = nextX, nextY end function Player:addKey() if self.keyCount ~= nil then self.keyCount = self.keyCount + 1 else self.keyCount = 1 end end function Player:canPassLevel(maxItemCount) if self.keyCount ~= nil then if self.keyCount >= maxItemCount and self.isDoor then return true else return false end end end function Player:resetValues() self.xvel, self.yvel = 0, 0 self.keyCount = 0 end function Player:resetPlayer(x, y) local x = x or 0 local y = y or 0 self:setPosition(x, y) self:resetValues() end function Player:jump(key) if (key == ' ' or key == 'up') and (self.onGround or self.jumpCount < self.jumpCountMax) then if self.jumpCount < 1 then self.vy = self.jumpFactor else self.vy = self.jumpFactor - 50 end self.jumpCount = self.jumpCount + 1 end end function Player:shootArrow(key) if key == "s" then return true end end function Player:cameraLogic(cam) cam:setX(self.x) cam:setY(self.y) end function Player:update(dt) Player:changeVelocityByGravity(dt) Player:changeVelocityByKeys(dt) Player:moveCollide(dt) Player:cameraLogic(cam) end function Player:drawPlayer() love.graphics.setColor(255,255,255) love.graphics.rectangle('fill', self.x, self.y, self.w, self.h) end function Player:drawDebugStrings(x, y) for i=1, #debugStr do love.graphics.print(debugStr[i], x+15, y+15*i) end end return Player
--local ide_debug = require('ide-debug') --ide_debug.enable_debugger(9999) local test = require('luatest') local group = test.group('unit') group.prototype_and_inheritance = function() local Object = require('object') function Object.symbol() return '!' end local Cat = Object:extend() function Cat:voice() return 'Miaoww'..self.symbol() end local Dog = Object:extend() function Dog:voice() return 'Woff'..self.symbol() end local DogBob = Dog:extend() function DogBob:voice() return 'Aghh! Aghh!'..self.symbol() end local DogRichard = Dog:extend() local dogBob = DogBob:new() test.assert_equals(dogBob:voice(), 'Aghh! Aghh!!', 'Class DogBob has its own method') local dogRichard = DogRichard:new() test.assert_equals(dogRichard:voice(), 'Woff!', 'Class DogRichard has an inherited method') local cat = Cat:new() test.assert_equals(cat:voice(), 'Miaoww!', 'Class Cat has its own method') end group.is_instance = function() local Object = require('object') local Cat = Object:extend() local Dog = Object:extend() local dog = Dog:new() local cat = Cat:new() test.assert(dog:isInstance(Dog), 'dog is instance class Dog') test.assert(dog:isInstance(Object), 'dog is instance class Object') test.assert(dog:isInstance(require('object')), 'dog is instance class Object over require()') test.assert(cat:isInstance(Cat), 'cat is instance class Cat') test.assert(cat:isInstance(Object), 'cat is instance class Object') test.assert_not(dog:isInstance(Cat), 'dog is not a Сat') test.assert_not(cat:isInstance(Dog), 'cat is not a Dog') end
--- 模块功能:通话功能测试. -- @author openLuat -- @module call.testCall -- @license MIT -- @copyright openLuat -- @release 2018.03.20 module(...,package.seeall) require"cc" require"audio" --来电铃声播放协程ID local coIncoming local function callVolTest() local curVol = audio.getCallVolume() curVol = (curVol>=7) and 1 or (curVol+1) log.info("testCall.setCallVolume",curVol) audio.setCallVolume(curVol) end --- “通话已建立”消息处理函数 -- @string num,建立通话的对方号码 -- @return 无 local function connected(num) log.info("testCall.connected") coIncoming = nil --通话中音量测试 sys.timerLoopStart(callVolTest,5000) --110秒之后主动结束通话 sys.timerStart(cc.hangUp,110000,num) end --- “通话已结束”消息处理函数 -- @return 无 local function disconnected() coIncoming = nil log.info("testCall.disconnected") sys.timerStopAll(cc.hangUp) sys.timerStop(callVolTest) audio.stop() end --- “来电”消息处理函数 -- @string num,来电号码 -- @return 无 local function incoming(num) log.info("testCall.incoming:"..num) if not coIncoming then coIncoming = sys.taskInit(function() while true do --audio.play(1,"TTS","来电话啦",4,function() sys.publish("PLAY_INCOMING_RING_IND") end,true) audio.play(1,"FILE","/lua/call.mp3",4,function() sys.publish("PLAY_INCOMING_RING_IND") end,true) sys.waitUntil("PLAY_INCOMING_RING_IND") break end end) sys.subscribe("POWER_KEY_IND",function() audio.stop(function() cc.accept(num) end) end) end --[[ if not coIncoming then coIncoming = sys.taskInit(function() for i=1,7 do --audio.play(1,"TTS","来电话啦",i,function() sys.publish("PLAY_INCOMING_RING_IND") end) audio.play(1,"FILE","/lua/call.mp3",i,function() sys.publish("PLAY_INCOMING_RING_IND") end) sys.waitUntil("PLAY_INCOMING_RING_IND") end --接听来电 --cc.accept(num) end) end]] --接听来电 --cc.accept(num) end --- “通话功能模块准备就绪””消息处理函数 -- @return 无 local function ready() log.info("tesCall.ready") --呼叫10086 --sys.timerStart(cc.dial,10000,"10086") end --- “通话中收到对方的DTMF”消息处理函数 -- @string dtmf,收到的DTMF字符 -- @return 无 local function dtmfDetected(dtmf) log.info("testCall.dtmfDetected",dtmf) end --订阅消息的用户回调函数 --sys.subscribe("CALL_READY",ready) sys.subscribe("NET_STATE_REGISTERED",ready) sys.subscribe("CALL_INCOMING",incoming) sys.subscribe("CALL_CONNECTED",connected) sys.subscribe("CALL_DISCONNECTED",disconnected) cc.dtmfDetect(true) sys.subscribe("CALL_DTMF_DETECT",dtmfDetected)
-- NEW SPELLS local _DimensionalRift = 196586; local _Eradication = 196412; local _LifeTap = 1454; local _SummonDarkglare = 205180; local _CallDreadstalkers = 104316; local _GrimoireFelguard = 111898; local _DemonicEmpowerment = 193396; local _ThalkielsConsumption = 211714; local _Demonbolt = 157695; local _HandofDoom = 152107; local _GrimoireofService = 108501; local _GrimoireofSupremacy = 152107; local _GrimoireofSacrifice = 108503; -- SPELLS local _ShadowBolt = 686; local _Metamorphosis = 103958; local _HandOfGuldan = 105174; local _SoulFire = 104027; local _Doom = 603; local _TouchOfChaos = 103964; local _ChaosWave = 124916 local _DarkSoulKnowledge = 113861; local _DarkSoulMisery = 113860; local _DarkSoulInstability = 113858; local _FireAndBrimstone = 108683; local _GrimoireDoomguard = 157900; local _Cataclysm = 152108; local _Felstorm = 119914; local _Havoc = 80240; local _Conflagrate = 17962; local _Incinerate = 29722; local _Immolate = 348; local _ChaosBolt = 116858; local _Shadowburn = 17877; local _Soulburn = 74434; local _Haunt = 48181; local _SoulSwap = 86121; local _SummonDoomguard = 18540; -- Affliction local _Agony = 980; local _Corruption = 172; local _SiphonLife = 63106; local _UnstableAffliction = 30108; local _SoulConduit = 215941; local _ReapSouls = 216698; local _DrainSoul = 198590; local _SoulEffigy = 205178; local _SeedofCorruption = 27243; local _SoulHarvest = 196098; local _WrathofConsumption = 199472; local _CompoundingHorror = 199282; local _Contagion = 196105; local _AbsoluteCorruption = 196103; local _EmpoweredLifeTap = 235157; local _SummonFelhunter = 691; local _DemonicCircle = 48018; local _DarkPact = 108416; local _UnendingResolve = 104773; local _SummonInfernal = 1122; local _PhantomSingularity = 205179; local _DeadwindHarvester = 216708; local _TormentedSouls = 216695; -- Demonology local _LordofFlames = 224103; local _GrimoireImp = 111859; local _ChannelDemonfire = 196447; local _Cataclysm = 152108; -- AURAS local _MoltenCore = 140074; local _HauntingSpirits = 157698; local wasEra = false; local willBeEra = false; MaxDps.Warlock = {}; function MaxDps.Warlock.CheckTalents() MaxDps:CheckTalents(); talents = MaxDps.PlayerTalents; _isChannelDemonfire = MaxDps:HasTalent(_ChannelDemonfire); _isCataclysm = MaxDps:HasTalent(_Cataclysm); end function MaxDps:EnableRotationModule(mode) mode = mode or 1; MaxDps.Description = 'Warlock Module [Affliction, Demonology, Destruction]'; MaxDps.ModuleOnEnable = MaxDps.Warlock.CheckTalents; if mode == 1 then MaxDps.NextSpell = MaxDps.Warlock.Affliction end; if mode == 2 then MaxDps.NextSpell = MaxDps.Warlock.Demonology end; if mode == 3 then MaxDps.NextSpell = MaxDps.Warlock.Destruction end; end function MaxDps.Warlock.Affliction(_, timeShift, currentSpell, gcd, talents) local ss = UnitPower('player', SPELL_POWER_SOUL_SHARDS); local mana = MaxDps:Mana(0, timeShift); local uaCount, uaCd = MaxDps.Warlock.UACount(timeShift); if talents[_PhantomSingularity] then MaxDps:GlowCooldown(_PhantomSingularity, MaxDps:SpellAvailable(_PhantomSingularity, timeShift)); end if mana < 0.2 then return _LifeTap; end if not MaxDps:TargetAura(_Agony, timeShift + 5) then return _Agony; end if talents[_AbsoluteCorruption] then local spellName = GetSpellInfo(_Corruption); local aura = UnitAura('target', spellName, nil, 'PLAYER|HARMFUL'); if not aura then return _Corruption; end else if not MaxDps:TargetAura(_Corruption, timeShift + 4) then return _Corruption; end end if talents[_SiphonLife] and not MaxDps:TargetAura(_SiphonLife, timeShift + 4) then return _SiphonLife; end if ss >= 3 then return _UnstableAffliction; end if MaxDps:PersistentAura(_TormentedSouls) and (not MaxDps:Aura(_DeadwindHarvester, timeShift + 1) and uaCount >= 2) then return _ReapSouls; end return _DrainSoul; end function MaxDps.Warlock.Demonology(_, timeShift, currentSpell, gcd, talents) local ss = UnitPower('player', SPELL_POWER_SOUL_SHARDS); local mana = MaxDps:Mana(0, timeShift); local doom = MaxDps:TargetAura(_Doom, timeShift + 5); local demoEmp = MaxDps:UnitAura(_DemonicEmpowerment, timeShift + 5, 'pet'); local doomguard = MaxDps:SpellAvailable(_SummonDoomguard, timeShift); local tk = MaxDps:SpellAvailable(_ThalkielsConsumption, timeShift); if MaxDps:SameSpell(currentSpell, _CallDreadstalkers) then ss = ss - 2; elseif MaxDps:SameSpell(currentSpell, _HandOfGuldan) then ss = ss - 4; if ss < 0 then ss = 0; end end if not talents[_GrimoireofSupremacy] then MaxDps:GlowCooldown(_SummonDoomguard, doomguard); end if mana < 0.2 then return _LifeTap; end if not talents[_HandofDoom] and not doom then return _Doom; end if talents[_SummonDarkglare] and MaxDps:SpellAvailable(_SummonDarkglare, timeShift) and ss > 0 then return _SummonDarkglare; end if MaxDps:SpellAvailable(_CallDreadstalkers, timeShift) and ss > 1 and not MaxDps:SameSpell(currentSpell, _CallDreadstalkers) then return _CallDreadstalkers; end if talents[_GrimoireofService]and MaxDps:SpellAvailable(_GrimoireFelguard, timeShift) and ss > 0 then return _GrimoireFelguard; end if ss > 3 and not MaxDps:SameSpell(currentSpell, _HandOfGuldan) then return _HandOfGuldan; end if not demoEmp and not MaxDps:SameSpell(currentSpell, _DemonicEmpowerment) then return _DemonicEmpowerment; end if talents[_SoulHarvest] and MaxDps:SpellAvailable(_SoulHarvest, timeShift) then return _SoulHarvest; end if tk and not MaxDps:SameSpell(currentSpell, _ThalkielsConsumption) then return _ThalkielsConsumption; end if MaxDps:SpellAvailable(_Felstorm, timeShift) then return _Felstorm; end if talents[_Demonbolt] then return _Demonbolt; else return _ShadowBolt; end end ---------------------------------------------- -- Main rotation: Destruction ---------------------------------------------- function MaxDps.Warlock.Destruction(_, timeShift, currentSpell, gcd, talents) local ss = UnitPower('player', SPELL_POWER_SOUL_SHARDS); local immo = MaxDps:TargetAura(_Immolate, timeShift + 5); local health = UnitHealth('target'); local era = MaxDps:TargetAura(_Eradication, timeShift + 2); local mana = MaxDps:Mana(0, timeShift); local doomguard = MaxDps:SpellAvailable(_SummonDoomguard, timeShift); local targetPh = MaxDps:TargetPercentHealth(); local cata = MaxDps:SpellAvailable(_Cataclysm, timeShift); if wasEra and not era then -- eradication went off willBeEra = false; end wasEra = era; if not talents[_GrimoireofSupremacy] then MaxDps:GlowCooldown(_SummonDoomguard, doomguard); end if MaxDps:SameSpell(currentSpell, _ChaosBolt) then willBeEra = true; ss = ss - 2; end MaxDps:GlowCooldown(_GrimoireDoomguard, MaxDps:SpellAvailable(_GrimoireDoomguard, timeShift)); MaxDps:GlowCooldown(_Havoc, MaxDps:SpellAvailable(_Havoc, timeShift)); if talents[_SoulHarvest] then MaxDps:GlowCooldown(_SoulHarvest, MaxDps:SpellAvailable(_SoulHarvest, timeShift)); end if mana < 0.1 then return _LifeTap; end local immo1 = MaxDps:TargetAura(_Immolate, timeShift + 1); if not immo1 and not MaxDps:SameSpell(currentSpell, _Immolate) then return _Immolate; end if talents[_EmpoweredLifeTap] and not MaxDps:Aura(_EmpoweredLifeTap, timeShift) then return _LifeTap; end if MaxDps:SpellAvailable(_GrimoireofSacrifice, timeShift) then return _GrimoireofSacrifice end if MaxDps:SpellAvailable(_LordofFlames, timeShift) then return _SummonInfernal; end if cata then return _Cataclysm; end if ss >= 5 then return _ChaosBolt; end if talents[_Eradication] and not era and not willBeEra and ss > 1 and not MaxDps:SameSpell(currentSpell, _ChaosBolt) then return _ChaosBolt; end local drCD, drCharges, drMax = MaxDps:SpellCharges(_DimensionalRift, timeShift); if drCharges >= 2 then return _DimensionalRift end if MaxDps:SpellAvailable(_GrimoireImp, timeShift) then return _GrimoireImp; end if MaxDps:SpellAvailable(_ChannelDemonfire, timeShift) and talents[_ChannelDemonfire] then return _ChannelDemonfire; end if talents[_Shadowburn] then local sbCD, sbCharges = MaxDps:SpellCharges(_Shadowburn, timeShift); if sbCharges > 1.5 then return _Shadowburn; end else local conCD, conCharges, conMax = MaxDps:SpellCharges(_Conflagrate, timeShift); if conCharges > 1 or (conCharges >= 1 and conCD < 2) then return _Conflagrate; end end if ss >= 2 then return _ChaosBolt; end if not immo and not MaxDps:SameSpell(currentSpell, _Immolate) then return _Immolate; end return _Incinerate; end function MaxDps.Warlock.UACount(timeShift) local name = _UnstableAffliction; timeShift = timeShift or 0; local spellName = GetSpellInfo(name) or name; local totalCd = nil; local c = 0; for i = 1, 40 do local uname, _, _, _, _, _, expirationTime = UnitAura('target', i, 'PLAYER|HARMFUL'); if uname == spellName and expirationTime ~= nil and (expirationTime - GetTime()) > timeShift then c = c + 1; local cd = expirationTime - GetTime() - (timeShift or 0); if (totalCd == nil) or cd < totalCd then totalCd = cd; end end end return c, totalCd; end
--Default random balancer. this balancer randomly select upstreams from given --list. if one upstream is blamed, this upstream will be unselectable for given --suspendSpan time. local tableUtils=require "suproxy.utils.tableUtils" local utils=require "suproxy.utils.utils" local OrderedTable=tableUtils.OrderedTable local _M={} local function getKey(ip,port) return string.format("ip%sport%s",ip,port) end function _M:new(upstreams,suspendSpan) math.randomseed(utils.getTime()) local o=setmetatable({},{__index=self}) assert(upstreams,"upstreams can not be nil") o.upstreams=OrderedTable:new() o.blameList={} o.suspendSpan=suspendSpan or 30 for i,v in ipairs(upstreams) do assert(v.ip,"upstream ip address cannot be null") assert(v.port,"upstream ip address cannot be null") o.upstreams[getKey(v.ip,v.port)]=v end return o end function _M:getBest() for k,v in pairs (self.blameList) do if v.addTime+self.suspendSpan<=utils.getTime() then self.upstreams[k]=v.value end end if #self.upstreams ==0 then return nil end local i=math.ceil(math.random(1,#self.upstreams)) if self.upstreams[i] then return self.upstreams[i].value end end function _M:blame(upstream) assert(upstream.ip,"upstream ip address cannot be null") assert(upstream.port,"upstream ip address cannot be null") local key=getKey(upstream.ip,upstream.port) if self.upstreams[key] then self.blameList[key]={addTime=utils.getTime(),value=self.upstreams[key]} self.upstreams:remove(key) end end _M.unitTest={} function _M.test() print("------------running balancer test") local suspendSpan=5 local a=_M:new({{ip=1,port=1},{ip=2,port=2},{ip=3,port=3}},suspendSpan) print(tableUtils.printTableF(a:getBest(),{inline=true})) print(tableUtils.printTableF(a:getBest(),{inline=true})) print(tableUtils.printTableF(a:getBest(),{inline=true})) print(tableUtils.printTableF(a:getBest(),{inline=true})) print(tableUtils.printTableF(a:getBest(),{inline=true})) print(tableUtils.printTableF(a:getBest(),{inline=true})) print(tableUtils.printTableF(a:getBest(),{inline=true})) assert(#(a.upstreams)==3) a:blame({ip=1,port=1}) assert(#(a.upstreams)==2) assert(a.upstreams[getKey(1,1)]==nil) assert(a.upstreams[getKey(2,2)]) assert(a.upstreams[getKey(3,3)]) assert(a.blameList[getKey(1,1)]) assert(a.blameList[getKey(1,1)].value.ip==1) print("------------wait ",suspendSpan," seconds") local t0 = os.clock() while os.clock() - t0 <= 5 do end a:getBest() print(tableUtils.printTableF(a.upstreams)) assert(#(a.upstreams)==3) assert(#(a.blameList)==0) print("------------balancer test finished") end return _M
--- ObjectBridge module. SB_COMMAND_DIR = SB_DIR .. "command/" SB.Include(SB_COMMAND_DIR .. 'command.lua') SB.IncludeDir(SB_COMMAND_DIR) SB_STATE_DIR = SB_DIR .. "state/" SB.Include(SB_STATE_DIR .. 'state_manager.lua') SB.Include(SB_STATE_DIR .. 'abstract_state.lua') SB.IncludeDir(SB_STATE_DIR) --- ObjectBridge class. Use to represent objects in the game world. -- It can use the s11n API to provide serialization support. Consult https://github.com/Spring-SpringBoard/SpringBoard-Core/tree/master/libs/s11n for details. -- @string humanName Human readable name. -- @bool NoHorizontalDrag If true, disables horizontal drag -- @tparam function ValidObject Function accepting objectID number. Returns true if objectID is valid. -- @tparam function OnSelect Function accepting objectIDs table, invoked when selected. -- @tparam function DrawObject Function invoked when drawing objects manually. Accepts objectID number and obj table as params. -- @tparam function OnDoubleClick Function invoked when double clicked on an object in the game world. -- @tparam function OnClick Function invoked when clicked on an object in the game world. Accepts objectID, x, y and z as parameters. -- @tparam function GetObjectAt Function that returns an object at location x, z (if any exists). -- @tparam function OnLuaUIAdded Function invoked when LuaUI gets notification that an object was added. Accepts (objectID, object). -- @tparam function OnLuaUIRemoved Function invoked when LuaUI gets notification that an object was removed. Accepts (objectID). -- @tparam function OnLuaUIUpdated Function invoked when LuaUI gets notification that an object was updated. Accepts (objectID, name, value). -- @table ObjectBridge ObjectBridge = LCS.class.abstract{} function ObjectBridge.getObjectSpringID(modelID) return modelID end function ObjectBridge.getObjectModelID(objectID) return objectID end function ObjectBridge.setObjectModelID(objectID, modelID) end function ObjectBridge.ValidObject(objectID) return true end local objectBridges = {} --- Register new bridge. -- @tparam string name Name of the bridge. -- @tparam ObjectBridge objectBridge Instance of a class implementing the ObjectBridge interface. function ObjectBridge.Register(name, objectBridge) objectBridge.name = name objectBridges[name] = objectBridge end --- Get a associative array of name->objectBridge for all objectBridges. -- @return table. function ObjectBridge.GetObjectBridges() return objectBridges end --- Get a specific objectBridge -- @tparam string name Name of the ObjectBridge. -- @return ObjectBridge. function ObjectBridge.GetObjectBridge(name) return objectBridges[name] end function DrawObject(params, bridge) gl.PushMatrix() local pos = params.pos local angle = params.angle local objectDefID = params.objectDefID local objectTeamID = params.objectTeamID local color = params.color gl.Color(color.r, color.g, color.b, color.a) gl.Translate(pos.x, pos.y, pos.z) gl.Rotate(angle.x, 1, 0, 0) gl.Rotate(angle.y, 0, 1, 0) gl.Rotate(angle.z, 0, 0, 1) bridge.glObjectShapeTextures(objectDefID, true) bridge.glObjectShape(objectDefID, objectTeamID, true) bridge.glObjectShapeTextures(objectDefID, false) gl.PopMatrix() end ObjectBridge.blockedFields = {} ObjectBridge.s11nFieldOrder = {"pos"}
return {'hso'}
--- This module will simplify automation of many common tasks such -- as waiting for various asynchronous operations to finish. -- All functions expect to be run inside a coroutine (this is what -- cucumber already does in the wire server). -- To use this module you need to make sure to call update() and -- on_message(). local M = {} -- stack of things we're waiting for -- the top-most instance will be checked local instance_stack = {} local sequence_count = 0 local automation_scripts = {} local function create_instance(timeout) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") sequence_count = sequence_count + 1 local instance = { id = sequence_count, co = co, timeout = socket.gettime() + timeout, } function instance.update(fn) instance.update_fn = true local dt = 0 while not fn(dt) do dt = coroutine.yield() end end function instance.on_message(fn) instance.on_message_fn = true local message_id, message, sender while not fn(message_id, message, sender) do message_id, message, sender = coroutine.yield() end end table.insert(instance_stack, instance) return instance end local function remove_instance(instance) for k,v in pairs(instance_stack) do if v.id == instance.id then instance_stack[k] = nil return end end end --- Register an automation script -- This will be done automatically by the automation.script -- Required to be able to call switch_context to ensure that -- certain steps are run in the correct collection -- @param Optional url to register. Defaults to msg.url() function M.register_automation_script(url) url = url or msg.url() automation_scripts[url.socket] = url end --- Wait until a function invokes a callback -- @param fn Function that must accept a callback as first argument -- @param timeout Optional timeout in seconds function M.until_callback(fn, timeout) local instance = create_instance(timeout or 10) local yielded = false local done = false fn(function() done = true if yielded then coroutine.resume(instance.co) end end) if not done then yielded = true coroutine.yield() end remove_instance(instance) end --- Wait until a function returns true when called -- @param fn Function that must return true, will receive dt as its only argument -- @param timeout Optional timeout in seconds function M.until_true(fn, timeout) local instance = create_instance(timeout or 10) instance.update(function(dt) if fn(dt) then return true end end) remove_instance(instance) end --- Wait until a message is received -- @param fn Function that will receive message and return true if message is the correct one -- @param timeout Optional timeout in seconds function M.until_message(fn, timeout) local instance = create_instance(timeout or 10) instance.on_message(function(message_id, message, sender) if fn(message_id, message, sender) then return true end end) remove_instance(instance) end --- Wait until a certain number of seconds have elapsed -- @param seconds Seconds to wait function M.seconds(seconds) assert(seconds and seconds >= 0, "You must provide a positive number of seconds to wait") M.until_true(function(dt) seconds = seconds - dt return seconds <= 0 end) end --- Wait a single frame function M.one_frame() M.until_true(function(dt) return true end) end --- Load a collection proxy and wait until it is loaded function M.load_proxy(url) url = msg.url(url) msg.post(url, "load") M.until_message(function(message_id, message, sender) return message_id == hash("proxy_loaded") and sender == url end) msg.post(url, "enable") end --- Unload a collection proxy and wait until it is unloaded function M.unload_proxy(url) url = msg.url(url) msg.post(url, "disable") msg.post(url, "final") msg.post(url, "unload") M.until_message(function(message_id, message, sender) return message_id == hash("proxy_unloaded") and sender == url end) end --- Post a message to the specified URL and wait for an answer -- Requires the automation.script somewhere in the collection -- This is needed for some tests where game objects and components -- need to be manipulated (you cannot call go.* functions from a script -- outside the collection where the game object resides) -- @param url function M.switch_context(url) url = msg.url(url) local automation_script_url = automation_scripts[url.socket] assert(automation_script_url, ("No automation script registered for %s"):format(tostring(url))) msg.post(automation_script_url, "switch_cucumber_context") M.until_message(function(message_id, message, sender) return message_id == hash("switch_cucumber_context") end) end --- Update the current instance if it's waiting for an update. -- If the instance is dead it will be removed and the next -- instance in the stack will be updated instead. function M.update(dt) for i=#instance_stack,1,-1 do local instance = instance_stack[i] if coroutine.status(instance.co) == "dead" then instance_stack[i] = nil else if instance.timeout and socket.gettime() > instance.timeout then instance_stack[i] = nil elseif instance.update_fn then local ok, err = coroutine.resume(instance.co, dt) if not ok then print(err) instance_stack[i] = nil end end return end end end --- Pass a message to the current instance if it's waiting -- for a message. If the instance is dead it's removed -- and the next one in the stack will be checked instead. function M.on_message(message_id, message, sender) for i=#instance_stack,1,-1 do local instance = instance_stack[i] if coroutine.status(instance.co) == "dead" then instance_stack[i] = nil else if instance.on_message_fn then local ok, err = coroutine.resume(instance.co, message_id, message, sender) if not ok then print(err) instance_stack[i] = nil end end return end end end return M
--MoveCurve --H_Tohka/JumpFlash JumpFlash return { filePath = "H_Tohka/JumpFlash", startTime = Fixed64(9437184) --[[9]], startRealTime = Fixed64(47186) --[[0.045]], endTime = Fixed64(87031808) --[[83]], endRealTime = Fixed64(435159) --[[0.415]], isZoom = false, isCompensate = false, curve = { [1] = { time = 0 --[[0]], value = 0 --[[0]], inTangent = 4194304 --[[4]], outTangent = 4194304 --[[4]], }, [2] = { time = 1048576 --[[1]], value = 4194304 --[[4]], inTangent = 4194304 --[[4]], outTangent = 4194304 --[[4]], }, }, }
--------------------------------------------------------------------------------------------------- -- --filename: game.dialog.MessageBox --date:2019/11/20 11:30:06 --author:heguang --desc:通用消息框 -- --------------------------------------------------------------------------------------------------- local strClassName = 'game.dialog.MessageBox' local MessageBox = lua_declare(strClassName, lua_class(strClassName)) function MessageBox:Start() self.messageText = self.transform:FindChild("Text"):GetComponent(UnityEngine.UI.Text) local btnClose = self.transform:FindChild("ButtonClose").gameObject self.btnList = self.transform:FindChild("btn") local btnCancel = self.btnList:FindChild("ButtonCancel").gameObject if btnCancel ~= nil then self.cancelText = LuaGameUtil.GetTextComponent(self.btnList, "ButtonCancel/Text") end local btnOK = self.btnList:FindChild("ButtonOK").gameObject if btnOK ~= nil then self.okText = LuaGameUtil.GetTextComponent(self.btnList, "ButtonOK/Text") end EventListener.Get(btnClose, self).onClick = self.CloseHandler EventListener.Get(btnCancel, self).onClick = self.CancelHandler EventListener.Get(btnOK, self).onClick = self.OKHandler self.dialogType = "normal" end function MessageBox:CloseHandler(go) if self.dialogType == "normal" then Dialog.Hide(DialogState.CLOSE, nil) elseif self.dialogType == "dialogEx" then Dialog.HideEx(self.transform.gameObject, DialogState.CLOSE) end end function MessageBox:CancelHandler(go) if self.dialogType == "normal" then Dialog.Hide(DialogState.CANCEL, nil) elseif self.dialogType == "dialogEx" then Dialog.HideEx(self.transform.gameObject, DialogState.CANCEL) end end function MessageBox:OKHandler(go) if self.dialogType == "normal" then Dialog.Hide(DialogState.OK, nil) elseif self.dialogType == "dialogEx" then Dialog.HideEx(self.transform.gameObject, DialogState.OK) end end function MessageBox:SetCancelText(strCancel) if self.cancelText ~= nil then self.cancelText.text = strCancel end end function MessageBox:SetOkText(strOk) if self.okText ~= nil then self.okText.text = strOk end end function MessageBox:SetMessageText(messageText, messageBoxType) if messageBoxType ~= nil then self.dialogType = messageBoxType end self.messageText.text = messageText end return MessageBox
-- Rafael Alcalde Azpiazu - 20 Apr 2018 -- Facultade de Informática da Coruña - Universidade da Coruña -- This table defines all common constants. local Constants = { -- Cell map types CellType = { SEA = "sea", -- Represents a sea bioma cell OCEAN = "ocean", -- Represents a ocean bioma cell GLACIER = "glacier", -- Represents a glacier bioma cell LAKE = "lake", -- Represents a lake bioma cell PLAIN = "plain", -- Represents a plain bioma cell GRASS = "grass", -- Represents a grass bioma cell FOREST = "forest", -- Represents a forest bioma cell JUNGLE = "jungle", -- Represents a jungle bioma cell TRUNDA = "trunda", -- Represents a trunda bioma cell SWAMP = "swamp", -- Represents a swamp bioma cell DESERT = "desert", -- Represents a desert bioma cell HILLS = "hills", -- Represents a hill bioma cell MOUNTAIN = "mountain", -- Represents a mountain bioma cell VOID = "void" -- Represents a void cell }, -- Tile types TileType = { SELECTOR = "selector", -- Represents the selector image SEA = "sea", -- Represents a sea bioma tile OCEAN = "ocean", -- Represents a ocean bioma tile GLACIER = "glacier", -- Represents a glacier bioma tile LAKE = "lake", -- Represents a lake bioma tile PLAIN = "plain", -- Represents a plain bioma tile GRASS = "grass", -- Represents a grass bioma tile FOREST = "forest", -- Represents a forest bioma tile JUNGLE = "jungle", -- Represents a jungle bioma tile TRUNDA = "trunda", -- Represents a trunda bioma tile SWAMP = "swamp", -- Represents a swamp bioma tile HILLS = "hills", -- Represents a hill bioma tile MOUNTAIN = "mountain", -- Represents a mountain bioma tile VOID = "void", -- Represents a void tile BLANK = "blank", -- Represents a border tile (this is for set water cells) SPAWN = "spawn" -- Represents the spawn image }, -- Tile position map TilePosition = { SINGLE = "single", UPPER = "upper", BOTTOM = "bottom", LEFT = "left", RIGHT = "right", UPPER_LEFT = "upper_left", UPPER_RIGHT = "upper_right", UPPER_BOTTOM = "upper_bottom", BOTTOM_RIGHT = "bottom_right", BOTTOM_LEFT = "bottom_left", LEFT_RIGHT = "left_right", UPPER_LEFT_RIGHT = "upper_left_right", UPPER_LEFT_BOTTOM = "upper_left_bottom", UPPER_RIGHT_BOTTOM = "upper_right_bottom", BOTTOM_LEFT_RIGHT = "bottom_left_right", SURROUNDED = "surrounded" }, -- Matrix types MatrixType = { NUMBER = "number", STRING = "string", BOOLEAN = "boolean", FUNCTION = "function", TABLE = "table", ALL = "all" }, -- Some regular expressions that the exporter uses to convert the scenario template -- into a valid Freeciv map TemplateRegex = { NAME = "::NAME::", ROWS = "::ROWS::", COLS = "::COLS::", PLAYER_NUM = "::PLAYER_NUM::", PLAYERS = "::PLAYERS::", TERRAIN = "::TERRAIN::", PLAYER_LIST = "::PLAYER_LIST::", LAYER_B = "::LAYER_B::", LAYER_R = "::LAYER_R::" } } return Constants
context('Disabling aliases ', function() local _ = require 'allen' test('Not defining ALLEN_ALIASES before calling Allen will not import aliases', function() assert_nil(_.capFirst) assert_nil(_.capEach) assert_nil(_.caps) assert_nil(_.cap) assert_nil(_.isLower) assert_nil(_.isUpper) assert_nil(_.startsLower) assert_nil(_.startsUpper) assert_nil(_.split) assert_nil(_.trim) assert_nil(_.esc) assert_nil(_.subst) assert_nil(_.interpolate) assert_nil(_.isNum) assert_nil(_.charAt) assert_nil(_.next) assert_nil(_.numFmt) assert_nil(_.rjust) assert_nil(_.ljust) assert_nil(_.center) assert_nil(_.isLuaKword) assert_nil(_.isReserved) assert_nil(_.isOperator) assert_nil(_.isOp) assert_nil(_.isIden) assert_nil(_.isVarName) assert_nil(_.stats) end) end) context('Enabling aliases', function() package.loaded.allen = nil _G.ALLEN_ALIASES = true local _ = require 'allen' test('Setting ALLEN_ALIASES to true before calling Allen will import aliases', function() assert_not_nil(_.capFirst) assert_not_nil(_.capEach) assert_not_nil(_.caps) assert_not_nil(_.cap) assert_not_nil(_.isLower) assert_not_nil(_.isUpper) assert_not_nil(_.startsLower) assert_not_nil(_.startsUpper) assert_not_nil(_.split) assert_not_nil(_.trim) assert_not_nil(_.esc) assert_not_nil(_.subst) assert_not_nil(_.interpolate) assert_not_nil(_.isNum) assert_not_nil(_.charAt) assert_not_nil(_.next) assert_not_nil(_.numFmt) assert_not_nil(_.rjust) assert_not_nil(_.ljust) assert_not_nil(_.center) assert_not_nil(_.isLuaKword) assert_not_nil(_.isReserved) assert_not_nil(_.isOperator) assert_not_nil(_.isOp) assert_not_nil(_.isIden) assert_not_nil(_.isVarName) assert_not_nil(_.stats) end) end)
function config.init() bind = {} var = {} function config.updateVar() var = {} function add(name, default) --if (default ~= console[name]) then table.insert(var, "launcher config "..name.." \""..console[name].."\"") --end end function _add(name, default, value) --if (default ~= value) then if (value ~= nil) then table.insert(var, "launcher config "..name.." \""..value.."\"") else table.insert(var, "launcher config "..name.." \""..default.."\"") end --end end add("p0_aim_accel", 0.169988) add("p0_aim_friction", 0) add("p0_aim_speed", 1.69998) add("p0_name", "GusPlayer") add("p0_rope_adjust_speed", 0.5) add("p0_viewport_follow", 0.1) add("p1_aim_accel", 0.169988) add("p1_aim_friction", 0) add("p1_aim_speed", 1.69998) add("p1_name", "GusPlayer") add("p1_rope_adjust_speed", 0.5) add("p1_viewport_follow", 0.1) add("cl_showdebug", 0) add("cl_showfps", 1) add("cl_show_map_debug", 0) add("con_font", "minifont") add("con_height", 120) add("con_speed", 4) add("net_autodownloads", 1) add("net_check_crc", 1) add("net_down_bpp", 200) add("net_down_pps", 20) add("net_register", 1) add("net_server_desc", "") add("net_server_name", "") add("net_server_port", 9898) add("net_sim_lag", 0) add("net_sim_loss", -1) add("net_up_limit", 10000) add("sfx_output_mode", "AUTO") add("sfx_volume", 256) add("vid_bitdepth", 32) add("vid_clear_buffer", 0) add("vid_doubleres", 0) add("vid_driver", "AUTO") add("vid_filter", "NOFILTER") add("vid_fullscreen", 0) add("vid_vsync", 0) _add("cg_enemybox", 0, cg_enemybox) _add("cg_enemycolor", "0\" \"255\" \"0", cg_enemycolor) _add("cg_teambox", 0, cg_teambox) _add("cg_teamcolor", "0\" \"0\" \"255", cg_teamcolor) _add("ch_bloodscreen", 1, ch_bloodscreen) _add("ch_crosshaircolor", "0\" \"255\" \"0", ch_crosshaircolor) _add("ch_crosshairdist", 25, ch_crosshairdist) _add("ch_crosshairtype", 5, ch_crosshairtype) _add("ch_playerhealth", 1, ch_playerhealth) _add("ch_playerhealth_own", 0, ch_playerhealth_own) _add("ch_playernames", 1, ch_playernames) _add("ch_spectator", 1, ch_spectator) _add("ch_radar", 0, ch_radar) _add("ch_radartype", 0, ch_radartype) _add("ch_reloadtimer", 0, ch_reloadtimer) _add("ch_showtime", 1, ch_showtime) _add("ch_statusbar", 2, ch_statusbar) _add("cl_weapons", "1 1 1 1 1", cl_weapons) _add("sv_deathslimit", 20, sv_deathslimit) _add("sv_killslimit", 20, sv_killslimit) _add("sv_maxclients", 4, sv_maxclients) _add("sv_timelimit", 15, sv_timelimit) _add("ch_messages_x", 315, ch_messages_x) _add("ch_messages_y", 2, ch_messages_y) _add("ch_messages_visible", 1, ch_messages_visible) _add("ch_messages_timer", 1000, ch_messages_timer) _add("ch_messages_align", 1, ch_messages_align) _add("cg_lasercolor", "255\" \"0\" \"0", cg_lasercolor) _add("ch_weaponsinfo", 1, ch_weaponsinfo) _add("cg_gibs", 6, cg_gibs) _add("cg_draw2d", 1, cg_draw2d) _add("cg_autoscreenshot", 1, cg_autoscreenshot) _add("sv_healthpacks", 0, sv_healthpacks) _add("sv_healthpacks_delay", 60, sv_healthpacks_delay) _add("sv_password", "", sv_password) _add("cg_logstats", 1, cg_logstats) end function config.updateBind() bind = {} function add(name, value) if (value ~= "NULL") then table.insert(bind, "launcher config bind "..value.." \""..name.."\"") end end add("+p0_up", upEd:text()) add("+p0_down", downEd:text()) add("+p0_left", leftEd:text()) add("+p0_right", rightEd:text()) add("+p0_fire", fireEd:text()) add("+p0_change", changeEd:text()) add("+p0_jump", jumpEd:text()) add("+p1_up", up1Ed:text()) add("+p1_down", down1Ed:text()) add("+p1_left", left1Ed:text()) add("+p1_right", right1Ed:text()) add("+p1_fire", fire1Ed:text()) add("+p1_change", change1Ed:text()) add("+p1_jump", jump1Ed:text()) add("showmenu", showmenuEd:text()) add("showchat", showchatEd:text()) add("showteammenu", "f4") add("+scores", showscoreEd:text()) add("+stats", "lshift") add("p0_vote yes", "f1") add("p0_vote no", "f2") end function config.save() config.updateBind() config.updateVar() for i = 1, #bind do print(bind[i]) end for i = 1, #var do print(var[i]) end print("launcher savecfg;") end end
type Person = { id: string, name: string, age: int, fn: (number, number) => number } type C2<S> = { id: string, name: string, storage: S, sayHi: (int) => S } type G1<T1, T2, T3> = { a: T1, b: T2, c: T3 } type G2<T> = G1<int, T, C2<Person> > type G3 = G2<string> let M: C2<Person> = {} let storage: Person = M.storage let age: int = storage.age let not_found = storage.not_found
object_static_structure_general_decontamination_chamber = object_static_structure_general_shared_decontamination_chamber:new { } ObjectTemplates:addTemplate(object_static_structure_general_decontamination_chamber, "object/static/structure/general/decontamination_chamber.iff")
Unpack = table.unpack or unpack local Conversion = {} Conversion.__index = Conversion function Conversion:new() local class = {} ----------VARIABLES------------- ----------VARIABLES------------- setmetatable( class, Conversion ) return class end function Conversion:CNameToNameString(name) local conName = tostring(name) conName = self:StringSplit(conName, "--[[ ")[2] conName = self:StringSplit(conName, " --]]")[1] return conName end function Conversion:StringSplit(source, separator, limit) if limit == nil then limit = 4294967295 end if limit == 0 then return {} end local out = {} local index = 0 local count = 0 if (separator == nil) or (separator == "") then while (index < (#source - 1)) and (count < limit) do out[count + 1] = self:StringAccess(source, index) count = count + 1 index = index + 1 end else local separatorLength = #separator local nextIndex = (string.find(source, separator, nil, true) or 0) - 1 while (nextIndex >= 0) and (count < limit) do out[count + 1] = self:StringSubstring(source, index, nextIndex) count = count + 1 index = nextIndex + separatorLength nextIndex = (string.find( source, separator, math.max(index + 1, 1), true ) or 0) - 1 end end if count < limit then out[count + 1] = self:StringSubstring(source, index) end return out end function Conversion: StringSubstring(self, start, ____end) if ____end ~= ____end then ____end = 0 end if (____end ~= nil) and (start > ____end) then start, ____end = Unpack({____end, start}) end if start >= 0 then start = start + 1 else start = 1 end if (____end ~= nil) and (____end < 0) then ____end = 0 end return string.sub(self, start, ____end) end function Conversion:StringAccess(self, index) if (index >= 0) and (index < #self) then return string.sub(self, index + 1, index + 1) end end return Conversion:new()
--[[ MrInfoQuest1.lua Copyright (C) 2016 Kano Computing Ltd. License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPLv2 This is the dialogue you can have with Mr Info in Overworld on the Beach. ]]-- return { type = "quest", dialogues = { --- 1) Help to check the map --------------------- { type = "copy", copy = { "mrInfoQuest1" }, arguments = {'USERNAME'}, options = { { checkMap = "GAME_EVENT_MINIMAP" } , }, }, --- 2) World Explanation------------------------ { type = "copy", copy = { "mrInfoQuest2" }, arguments = {}, options = {}, }, --- 3) Explore Areas explanation ----------------------- { type = "copy", copy = { "mrInfoQuest3" }, arguments = {}, options = {}, }, --- 4) Congratulations you explored lots of areas ------------------------ { type = "copy", copy = { "mrInfoQuest4" }, arguments = {}, options = {}, }, --- the end --- } }
--[[ https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm 1 function Dijkstra(Graph, source): 2 dist[source] ← 0 // Initialization 3 4 create vertex set Q 5 6 for each vertex v in Graph: 7 if v ≠ source 8 dist[v] ← INFINITY // Unknown distance from source to v 9 prev[v] ← UNDEFINED // Predecessor of v 10 11 Q.add_with_priority(v, dist[v]) 12 13 14 while Q is not empty: // The main loop 15 u ← Q.extract_min() // Remove and return best vertex 16 for each neighbor v of u: // only v that are still in Q 17 alt ← dist[u] + length(u, v) 18 if alt < dist[v] 19 dist[v] ← alt 20 prev[v] ← u 21 Q.decrease_priority(v, alt) 22 23 return dist, prev ]]-- function shortestpath (actor, target, targets) -- (elves[i], 'G', grems) or (grems[i], 'E', elves) local source = pos2hash(actor.x, actor.y) local dist = {[source]=0} local Q = newheap() local prev = {} Q:push(source, 0) local founds = {} -- for x = 1, dimx do -- for y = 1, dimy do -- if arena[y][x] ~= '#' and actor.x ~= x and actor.y ~= y then -- local v = pos2hash(x,y) -- -- dist[v] = 100000000 -- test below will default -- -- Q:push(v, 100000000) -- Q:decr will push if not there -- end -- end -- end local found = 0 while not Q:isempty() do local u,_ = Q:pop() local ux,uy = hash2pos(u) for y = uy-1, uy+1 do -- search for a path in "reading order" for x = ux-1, ux+1 do if (x == ux or y == uy) -- no diagonal and (x ~= ux or y ~= uy) -- different node and x >= 1 and x <= xdim and y >= 1 and y <= ydim -- in bounds and arena[y][x] ~= '#' -- not a wall then local alt = dist[u] + 1 local v = pos2hash(x,y) if alt < (dist[v] or 100000000) then dist[v] = alt prev[v] = u Q:decr(v, alt) end if arena[y][x] == target and not founds[v] then founds[v] = true found = found + 1 end end end end if found >= #targets then break end end actor.targets = found actor.dist = dist -- maps pos2hash(x,y) to distance actor.prev = prev -- maps path in reverse: pos2hash(x,y) -> pos2hash(x',y') end function distances (unit) local source = pos2hash(unit.x, unit.y) local dist = {[source]=0} local Q = newheap() Q:push(source, 0) while not Q:isempty() do local u,_ = Q:pop() local ux,uy = hash2pos(u) for y = uy-1, uy+1 do -- search for a path in "reading order" for x = ux-1, ux+1 do if (x == ux or y == uy) -- no diagonal and (x ~= ux or y ~= uy) -- different node and x >= 1 and x <= xdim and y >= 1 and y <= ydim -- in bounds and arena[y][x] ~= '#' -- not a wall and arena[y][x] == '.' -- ????????????????????????????? then local alt = dist[u] + 1 local v = pos2hash(x,y) if alt < (dist[v] or 100000000) then dist[v] = alt if arena[y][x] == '.' then -- TODO: only those, right? Q:decr(v, alt) end end end end end end return dist -- maps pos2hash(x,y) to distance end
local args = ... local player = args.player local pn = ToEnumShortString(player) local percent if args.side then percent = args.side else local stats = STATSMAN:GetCurStageStats():GetPlayerStageStats(pn) local PercentDP = stats:GetPercentDancePoints() percent = FormatPercentScore(PercentDP) -- Format the Percentage string, removing the % symbol percent = percent:gsub("%%", "") end return Def.ActorFrame{ Name="PercentageContainer"..pn, InitCommand=function(self) self:x( -115 ) self:y( _screen.cy-40 ) end, -- dark background quad behind player percent score Def.Quad{ InitCommand=function(self) self:diffuse( color("#101519") ) :y(-2) :zoomto(70, 28) end }, LoadFont("Wendy/_wendy white")..{ Text=percent, Name="Percent", InitCommand=function(self) self:horizalign(right):zoom(0.25):xy( 30, -2) end, } }
local a=require("computer")local b=require("filesystem")local c=require("term")local d=require("text")local e=require("unicode")local f={C_NAME="XAF Core",C_INSTANCE=false,C_INHERIT=false,static={}}function f:getExecutorInstance()local g={}g.run=function(self,h,...)assert(type(h)=="function","[XAF Core] Expected FUNCTION as argument #1")local i={...}local j=h;local k={}k={pcall(j,table.unpack(i))}return table.unpack(k)end;g.runExternal=function(self,l,...)assert(type(l)=="string","[XAF Core] Expected STRING as argument #1")local m=l;local j=nil;local i={...}local k={}if b.exists(m)==true then local n=b.open(m,'r')local o=""local p=n:read(math.huge)while p do o=o..tostring(p)p=n:read(math.huge)end;n:close()j=load(o)k={pcall(j,table.unpack(i))}return table.unpack(k)else error("[XAF Error] File '"..m.."' does not exist")end end;g.stop=function(self,q)assert(type(q)=="boolean","[XAF Core] Expected BOOLEAN as argument #1")if q==true then c.clear()end;a.pushSignal("")coroutine.yield()os.exit()end;return g end;function f:getMathInstance()local g={}g.checkInteger=function(self,r)assert(type(r)=="number","[XAF Core] Expected NUMBER as argument #1")local s=math.floor(r)local t=math.ceil(r)if s==t then return true else return false end end;g.checkNatural=function(self,r,u)assert(type(r)=="number","[XAF Core] Expected NUMBER as argument #1")assert(type(u)=="boolean","[XAF Core] Expected BOOLEAN as argument #2")local s=math.floor(r)local t=math.ceil(r)if s==t then if u==true then return r>0 else return r>=0 end else return false end end;g.getAdditiveInverse=function(self,r)assert(type(r)=="number","[XAF Core] Expected NUMBER as argument #1")local v=r;local w=v*-1;return w end;g.getGreatestCommonDivisor=function(self,x,y)assert(type(x)=="number","[XAF Core] Expected NUMBER as argument #1")assert(type(y)=="number","[XAF Core] Expected NUMBER as argument #2")if g:checkInteger(x)==false or g:checkInteger(y)==false then error("[XAF Error] Greatest common divisor must be calculated on integer numbers")else local z=0;local A=x;while y~=0 do z=A%y;A=y;y=z end;return math.abs(A)end end;g.getLowestCommonMultiple=function(self,x,y)assert(type(x)=="number","[XAF Core] Expected NUMBER as argument #1")assert(type(y)=="number","[XAF Core] Expected NUMBER as argument #2")if g:checkInteger(x)==false or g:checkInteger(y)==false then error("[XAF Error] Lowest common multiple must be calculated on integer numbers")else local B=math.abs(x*y)local C=B/g:getGreatestCommonDivisor(x,y)return C end end;g.getMultiplicativeInverse=function(self,r)assert(type(r)=="number","[XAF Core] Expected NUMBER as argument #1")local v=r;local D=1/v;return D end;return g end;function f:getSecurityInstance()local g={}g.convertBinaryToHex=function(self,E,F)assert(type(E)=="string","[XAF Core] Expected STRING as argument #1")assert(type(F)=="boolean","[XAF Core] Expected BOOLEAN as argument #2")local G=E;local H=e.wlen(G)local I={string.byte(G,1,H)}local J=""local K=F;for L=1,H do J=J..string.format("%02x",I[L])end;if K==true then J=string.upper(J)end;return J end;g.getRandomHash=function(self,M,F)assert(type(M)=="number","[XAF Core] Expected NUMBER as argument #1")assert(type(F)=="boolean","[XAF Core] Expected BOOLEAN as argument #2")local N={'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'}local O=M;local P=""local Q=F;for L=1,O do P=P..N[math.random(1,16)]end;if Q==true then P=string.upper(P)end;return P end;g.getRandomUuid=function(self,F)assert(type(F)=="boolean","[XAF Core] Expected BOOLEAN as argument #1")local R={'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'}local S=""local T=""local U=F;for L=1,30 do T=T..R[math.random(1,16)]end;S=S..string.sub(T,1,8)S=S.."-"..string.sub(T,9,12)S=S.."-4"..string.sub(T,13,15)S=S.."-"..R[math.random(9,12)]..string.sub(T,16,18)S=S.."-"..string.sub(T,19,30)if U==true then S=string.upper(S)end;return S end;g.isUuid=function(self,S)assert(type(S)=="string","[XAF Core] Expected STRING as argument #1")local V=S;local W=e.wlen(S)local X="(%x%x%x%x%x%x%x%x[-]%x%x%x%x[-]%x%x%x%x[-]%x%x%x%x[-]%x%x%x%x%x%x%x%x%x%x%x%x)"local Y=false;if W==36 and string.match(V,X)==V then Y=true end;return Y end;return g end;function f:getStringInstance()local g={}g.checkControlCharacter=function(self,Z)assert(type(Z)=="string","[XAF Core] Expected STRING as argument #1")local _=Z;local a0="[\0-\31\127]"local a1=false;if string.find(_,a0)then a1=true end;return a1 end;g.checkSpecialCharacter=function(self,Z)assert(type(Z)=="string","[XAF Core] Expected STRING as argument #1")local _=Z;local a2="[\a\b\f\n\r\t\v\\\"\'/]"local a1=false;if string.find(_,a2)then a1=true end;return a1 end;g.checkWhitespace=function(self,Z)assert(type(Z)=="string","[XAF Core] Expected STRING as argument #1")local _=Z;local a3="[\n\r\t\v ]"local a1=false;if string.find(_,a3)then a1=true end;return a1 end;return g end;function f:getTableInstance()local g={}g.getLength=function(self,a4)assert(type(a4)=="table","[XAF Core] Expected TABLE as argument #1")local a5=a4;local a6=0;for a7,a8 in pairs(a5)do a6=a6+1 end;return a6 end;g.loadFromFile=function(self,l)assert(type(l)=="string","[XAF Core] Expected STRING as argument #1")local a9=string.char(13,10)local aa=l;local ab={}if b.exists(aa)==true then local ac=b.open(aa,'r')local ad=''local ae=''while ae do ad=ad..ae;ae=ac:read(math.huge)end;ae=''ac:close()ab=g:loadFromString(ad)else error("[XAF Error] File '"..aa.."' does not exist")end;return ab end;g.loadFromString=function(self,af)assert(type(af)=="string","[XAF Core] Expected STRING as argument #1")local a9=string.char(13,10)local ag=af;local ab={}for ah in string.gmatch(ag,"[^"..a9 .."]+")do local ai=string.find(ah," = ")local a7=nil;local a8=nil;if string.sub(ah,1,3)~="[#]"then if ai then local aj=string.sub(ah,1,3)local ak=string.sub(ah,5,ai-1)local al=string.sub(ah,ai+3,ai+5)local am=string.sub(ah,ai+7)if aj=="[S]"then a7=tostring(ak)elseif aj=="[N]"then a7=tonumber(ak)elseif aj=="[B]"then if ak=="true"then a7=true elseif ak=="false"then a7=false end elseif aj=="[?]"then else error("[XAF Error] Invalid table line syntax - invalid key marker")end;if al=="[S]"then a8=tostring(am)elseif al=="[N]"then a8=tonumber(am)elseif al=="[B]"then if am=="true"then a8=true elseif am=="false"then a8=false end elseif al=="[?]"then a8=nil else error("[XAF Error] Invalid table line syntax - invalid value marker")end;if a7 then ab[a7]=a8 end else error("[XAF Error] Invalid table data syntax - delimiter not found")end end end;return ab end;g.saveToFile=function(self,a4,l,an)assert(type(a4)=="table","[XAF Core] Expected TABLE as argument #1")assert(type(l)=="string","[XAF Core] Expected STRING as argument #2")assert(type(an)=="boolean","[XAF Core] Expected BOOLEAN as argument #3")local ao=a4;local ap=l;local aq=an==true and'a'or'w'local ar=b.open(ap,aq)for a7,a8 in g:sortByKey(ao,false)do local as=type(a7)local aj=''local at=type(a8)local al=''aj=as=="string"and"[S]"or as=="number"and"[N]"or as=="boolean"and"[B]"or"[?]"al=at=="string"and"[S]"or at=="number"and"[N]"or at=="boolean"and"[B]"or"[?]"ar:write(aj..' '..tostring(a7).." = ")ar:write(al..' '..tostring(a8)..'\n')end;ar:close()return true end;g.searchByValue=function(self,a4,a8,au)assert(type(a4)=="table","[XAF Core] Expected TABLE as argument #1")assert(type(a8)~="nil","[XAF Core] Expected ANYTHING as argument #2")assert(type(au)=="number","[XAF Core] Expected NUMBER as argument #3")local av=a4;local aw=a8;local ax=au;local ay={}for a7,a8 in pairs(av)do if ax==0 then if a8==aw then table.insert(ay,a7)end elseif ax>0 then if a8>aw then table.insert(ay,a7)end elseif ax<0 then if a8<aw then table.insert(ay,a7)end end end;return ay end;g.sortByKey=function(self,az,aA)assert(type(az)=="table","[XAF Core] Expected TABLE as argument #1")assert(type(aA)=="boolean","[XAF Core] Expected BOOLEAN as argument #2")local aB=az;local aC=aA;local aD={}local aE={}local aF={}local aG={}local aH=function(aI,aJ)return aI<aJ end;local aK=function(aI,aJ)return aI>aJ end;local aL={}local aM=1;local aN=0;for a7,a8 in pairs(aB)do local as=type(a7)if as=="number"then table.insert(aD,a7)elseif as=="string"then table.insert(aE,a7)elseif as=="boolean"then table.insert(aF,tostring(a7))else table.insert(aG,a7)end;aM=aM+1 end;if aC==true then table.sort(aD,aK)table.sort(aE,aK)table.sort(aF,aK)else table.sort(aD,aH)table.sort(aE,aH)table.sort(aF,aH)end;if aC==true then for a7,a8 in ipairs(aG)do table.insert(aL,a8)end;for a7,a8 in ipairs(aF)do if a8=="true"then table.insert(aL,true)elseif a8=="false"then table.insert(aL,false)end end;for a7,a8 in ipairs(aE)do table.insert(aL,a8)end;for a7,a8 in ipairs(aD)do table.insert(aL,a8)end else for a7,a8 in ipairs(aD)do table.insert(aL,a8)end;for a7,a8 in ipairs(aE)do table.insert(aL,a8)end;for a7,a8 in ipairs(aF)do if a8=="true"then table.insert(aL,true)elseif a8=="false"then table.insert(aL,false)end end;for a7,a8 in ipairs(aG)do table.insert(aL,a8)end end;return function()aN=aN+1;if aN<aM then local a7=aL[aN]local a8=aB[a7]return a7,a8 end end end;return g end;function f:getTextInstance()local g={}g.convertLinesToString=function(self,aO,ai)assert(type(aO)=="table","[XAF Core] Expected TABLE as argument #1")assert(type(ai)=="string","[XAF Core] Expected STRING as argument #2")local aP=aO;local aQ=ai;local aR=""for a7,a8 in ipairs(aO)do aR=aR..tostring(a8)..aQ end;aR=string.sub(aR,1,e.wlen(aR)-e.wlen(aQ))return aR end;g.convertStringToLines=function(self,aS,aT)assert(type(aS)=="string","[XAF Core] Expected STRING as argument #1")assert(type(aT)=="number","[XAF Core] Expected NUMBER as argument #2")local aU=aS;local aV=aT;local aO={}for aS in d.wrappedLines(aU,aV,aV)do table.insert(aO,aS)end;return aO end;g.padCenter=function(self,aS,aT)assert(type(aS)=="string","[XAF Core] Expected STRING as argument #1")assert(type(aT)=="number","[XAF Core] Expected NUMBER as argument #2")local aV=math.floor(aT)local aW=string.sub(aS,1,aV)local aX=e.wlen(aW)local aY=aV-aX;local aZ=math.floor(aY/2)local a_=aY-aZ;local b0=string.rep(" ",aZ)..aW..string.rep(" ",a_)return b0 end;g.padLeft=function(self,aS,aT)assert(type(aS)=="string","[XAF Core] Expected STRING as argument #1")assert(type(aT)=="number","[XAF Core] Expected NUMBER as argument #2")local aV=math.floor(aT)local aW=string.sub(aS,1,aV)local aX=e.wlen(aW)local aY=aV-aX;local b0=aW..string.rep(" ",aY)return b0 end;g.padRight=function(self,aS,aT)assert(type(aS)=="string","[XAF Core] Expected STRING as argument #1")assert(type(aT)=="number","[XAF Core] Expected NUMBER as argument #2")local aV=math.floor(aT)local aW=string.sub(aS,1,aV)local aX=e.wlen(aW)local aY=aV-aX;local b0=string.rep(" ",aY)..aW;return b0 end;g.split=function(self,aS,ai,b1)assert(type(aS)=="string","[XAF Core] Expected STRING as argument #1")assert(type(ai)=="string","[XAF Core] Expected STRING as argument #2")assert(type(b1)=="boolean","[XAF Core] Expected BOOLEAN as argument #3")local b2=#aS;local b3=0;local b4={}while true do local b5,b6=string.find(aS,ai,b3,true)if b5 and b6 then local b7=string.sub(aS,b3,b5-1)if b7==''then if b1==false then table.insert(b4,b7)end else table.insert(b4,b7)end;b3=b6+1 else if b3-1<b2 then table.insert(b4,string.sub(aS,b3))else if b1==false then table.insert(b4,'')end end;break end end;return b4 end;return g end;return f
----------------------------------------- -- ID: 5009 -- Scroll of Hunters Prelude -- Teaches the song Hunters Prelude ----------------------------------------- function onItemCheck(target) return target:canLearnSpell(401) end function onItemUse(target) target:addSpell(401) end
local FramesCounter = { frames = 0.0, next = 0.0, time = 0.0, fps = 0.0 } function FramesCounter.getFPS(dt) FramesCounter.frames = FramesCounter.frames + 1 FramesCounter.time = FramesCounter.time + dt if FramesCounter.time > FramesCounter.next then FramesCounter.fps = FramesCounter.frames / FramesCounter.time FramesCounter.time = 0.0 FramesCounter.frames = 0.0 FramesCounter.next = 0.25 end if FramesCounter.fps == 0 then FramesCounter.fps = 1 / dt end return FramesCounter.fps end return FramesCounter
--[[ @cond ___LICENSE___ -- Copyright (c) 2017 Zefiros Software. -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -- THE SOFTWARE. -- -- @endcond --]] Solution = newclass "Solution" function Solution:init(solver, tree, cursor, cursorPtr) self.solver = solver if not self.root then self.root = self end if not tree then self.tree = { package = self.solver.root, public = {}, private = {}, open = { public = {{}}, private = {} }, closed = { public = {}, all = {} }, optionals = { }, isRoot = true } else self.tree = tree end self.cursor = self.tree self.cursorPtr = {} self.indices = nil self.failed = false self.isRoot = false end function Solution:loadFromLock(lock) return self:_loadNodeFromLock(self.tree, self.tree, lock) end function Solution:_loadNodeFromLock(tree, node, lock) if not lock then return end node.definition = node.package:findPackageDefinition(lock.hash, lock.tag, node) local dpkgs = {} for _, access in ipairs({"public", "private"}) do node[access] = {} if lock[access] then for type, pkgs in pairs(lock[access]) do for _, pkg in pairs(pkgs) do local vendor, name = zpm.package.splitName(pkg.name) local package = self.solver.loader[type]:get(vendor, name) if not package then return false end package.definition = pkg.definition package.repository = pkg.repository package:load(pkg.hash) local lnode = { package = package, type = type, name = pkg.name, tag = pkg.tag, version = pkg.version, optionals = pkg.optionals, versionRequirement = pkg.versionRequirement, hash = pkg.hash } table.insert(node[access], lnode) zpm.util.insertTable(dpkgs, {access, type, pkg.name}, iif(pkg.version == nil, pkg.tag, pkg.version)) if not self:_loadNodeFromLock(tree, lnode, pkg) then return false end local index = {type, package:getHash(), pkg.tag} local semver = nil if pkg.version then semver = zpm.semver(pkg.version) end local cost = 0 if zpm.cli.update() then cost = package:getCost({ tag = pkg.tag, version = pkg.version, semver = semver, hash = pkg.hash }) end zpm.util.setTable(self.tree.closed.all, index, { cost = cost, package = package, version = iif(pkg.version, pkg.version, pkg.tag) }) if access == "public" then zpm.util.setTable(self.tree.closed.public, {type, package:getHash()}, { cost = cost, package = package, version = iif(pkg.version, pkg.version, pkg.tag) }) end end end end end for _, access in ipairs({"public", "private"}) do -- check whether the lockfile version is a complete solution if node.definition and node.definition[access] then for ptype, pubs in pairs(node.definition[access]) do for i, pub in ipairs(pubs) do if not pub.optional then if zpm.util.indexTable(dpkgs, {access, ptype, pub.name}) then local vcheckFailed = false local lversion for _, version in ipairs(dpkgs[access][ptype][pub.name]) do lversion = version if pub.version and not premake.checkVersion(version, pub.version) then vcheckFailed = true else for _, upkg in ipairs(node[access]) do if upkg.type == ptype and upkg.name == pub.name then upkg.settings = pub.settings end end end end if vcheckFailed then warningf("Package '%s' by '%s' locked on version '%s' does not match '%s'", pub.name, node.package.name, lversion, pub.version) return false end else if node.isRoot then warningf("Package '%s' missing in lockfile", pub.name) else warningf("Package '%s' required by '%s' missing in lockfile", pub.name, node.name) end return false end end end end end end return true end function Solution:isOpen() return self.indices ~= nil end function Solution:expand(best, beam) local solutions = {} while true do if not self:isOpen() then self:nextCursor() if not self:load() then return {} end end local versions = self:_enumerateVersions() -- when no versions are valid we skip this expension round if not versions then break end --print(table.tostring(versions,2)) local l = self:_carthesian(table.deepcopy(versions), beam) --print(table.tostring(l,2)) for _, solved in ipairs(l) do for i=1,#self.cursor.private do self.cursor.private[i].tag = solved[i].tag self.cursor.private[i].version = solved[i].version self.cursor.private[i].hash = solved[i].hash end for i=1,#self.cursor.public do self.cursor.public[i].tag = solved[#self.cursor.private + i].tag self.cursor.public[i].version = solved[#self.cursor.private + i].version self.cursor.public[i].hash = solved[#self.cursor.private + i].hash end local tree = self:_copyTree() local solution = Solution(self.solver, tree) for i=1,#self.cursor.private do local index = { self.cursor.private[i].type, self.cursor.private[i].package:getHash(), self.cursor.private[i].tag } --print(self.cursor.private[i].tag, solved[i].cost) zpm.util.setTable(solution.tree.closed.all, index, { cost = solved[i].cost, package = self.cursor.private[i].package, version = iif(self.cursor.private[i].version, self.cursor.private[i].version, self.cursor.private[i].tag) }) end for i=1,#self.cursor.public do local index = { self.cursor.public[i].type, self.cursor.public[i].package:getHash(), self.cursor.public[i].tag } --print(self.cursor.public[i].tag, solved[#self.cursor.private + i].cost) local package = { cost = solved[#self.cursor.private + i].cost, package = self.cursor.public[i].package, version = iif(self.cursor.public[i].version, self.cursor.public[i].version, self.cursor.public[i].tag) } zpm.util.setTable(solution.tree.closed.all, index, package) zpm.util.setTable(solution.tree.closed.public, {self.cursor.public[i].type, self.cursor.public[i].package:getHash()}, package) end table.insert(solutions, solution) end if #solutions ~= 0 or not self.cursorPtr then return solutions end end return solutions end function Solution:nextCursor() local ptr = nil if #table.keys(self.tree.open.public) > 0 then local i, ptr = next(self.tree.open.public) self.cursorPtr = ptr self.tree.open.public[i] = nil elseif #table.keys(self.tree.open.private) > 0 then local i, ptr = next(self.tree.open.private) self.cursorPtr = ptr self.tree.open.private[i] = nil else self.cursorPtr = nil end if self.cursorPtr then self.cursor = zpm.util.indexTable(self.tree, self.cursorPtr) self.cursor = iif(self.cursor ~= nil, self.cursor, self.tree) self.indices = nil end end function Solution:_copyTree() local root = self:_copyNode(self.tree) root.open = table.deepcopy(self.tree.open) root.closed = { public = {}, all = {} } for _, access in ipairs({"public", "all"}) do for type, pkgs in pairs(self.tree.closed[access]) do for hash, versions in pairs(pkgs) do if access == "all" then for version, pkg in pairs(versions) do --print(table.tostring(pkg)) zpm.util.setTable(root.closed, {access, type, hash, version},{ cost = pkg.cost, version = pkg.version, package = pkg.package }) end else --print(table.tostring(versions)) zpm.util.setTable(root.closed, {access, type, hash},{ cost = versions.cost, version = versions.version, package = versions.package }) end end end end return root end function Solution:_copyNode(node) local public = {} local private = {} if node.public then for _, n in pairs(node.public) do table.insert(public, self:_copyNode(n)) end end if node.private then for _, n in pairs(node.private) do table.insert(private, self:_copyNode(n)) end end return { package = node.package, public = public, private = private, type = node.type, name = node.name, settings = node.settings, version = node.version, definition = node.definition, optionals = table.deepcopy(node.optionals), versionRequirement = node.versionRequirement, tag = node.tag, hash = node.hash } end function Solution:extract(isLock) if isLock then return self:_extractNode(self.tree, isLock) end return Tree(self.solver.loader, self:_extractNode(self.tree, isLock)) end function Solution:isComplete() return (#table.keys(self.tree.open.public) + #table.keys(self.tree.open.private)) == 0 and not self.failed end function Solution:getCost() local cost = 0 -- count each library included as cost the cost of a major version too -- such that we also try to minimise the amount of libraries (HEAD is 0 cost) for type, libs in pairs(self.tree.closed.all) do for name, lib in pairs(libs) do for tag, v in pairs(lib) do --print(name, tag, v.cost) cost = cost + v.cost + zpm.package.semverDist(zpm.semver(1,0,0), zpm.semver(0,0,0)) end end end return cost end function Solution:load() self.cursor.definition = self.cursor.package:findPackageDefinition(self.cursor.hash, self.cursor.tag) if not self.cursor.private then self.cursor.private = {} end if not self.cursor.public then self.cursor.public = {} end for _, type in ipairs(self.solver.loader.manifests:getLoadOrder()) do if self.cursor.definition.private and self.cursor.definition.private[type] then local ptr = zpm.util.concat(table.deepcopy(self.cursorPtr), {"private"}) for _, d in pairs(self.cursor.definition.private[type]) do local dep, idx = self:_loadDependency(self.cursor.private, d, type, self.solver.loader[type]) if not dep then self.failed = true return end table.insert(self.tree.open.private, zpm.util.concat(table.deepcopy(ptr), {idx})) end end if self.cursor.definition.public and self.cursor.definition.public[type] then local ptr = zpm.util.concat(table.deepcopy(self.cursorPtr), {"public"}) for _, d in pairs(self.cursor.definition.public[type]) do if not d.optional then local dep, idx = self:_loadDependency(self.cursor.public, d, type, self.solver.loader[type]) if not dep then self.failed = true return end table.insert(self.tree.open.public, zpm.util.concat(table.deepcopy(ptr), {idx})) else if not self.cursor.optionals then self.cursor.optionals = {} end zpm.util.insertTable(self.cursor.optionals, {type}, { name = d.name, versionRequirement = d.version }) end end end end --print(self.cursor.name) --print(self:isComplete(), self:isOpen()) return true end function Solution:_loadDependency(cursor, d, type, loader) local vendor, name = zpm.package.splitName(d.name) local dependency = { name = d.name, versionRequirement = d.version, package = loader:get(vendor, name), settings = d.settings, type = type } if self.isRoot then if d.repository then dependency.package.repository = d.repository -- repository is now also the definition path when it is a directory, unless given otherwise if os.isdir(d.repository) then dependency.package.definition = d.repository -- define as if the directory were @head if not d.version then --dependency.versionRequirement = "@head" end end end if d.definition then dependency.package.definition = d.definition end end if dependency.package then dependency.package:load() local idx = #cursor + 1 cursor[idx] = dependency return dependency, idx end warningf("Package '%s/%s' does not exist", vendor, name) return nil end function Solution:_enumerateVersions() local pubVersions = self:_enumeratePublicVersions() if pubVersions then local privVersions = self:_enumeratePrivateVersions() if privVersions then return zpm.util.concat(privVersions, pubVersions) end end return nil end function Solution:_enumeratePublicVersions() local pubVersions = {} for _, d in pairs(self.cursor.public) do for _, c in pairs(self.tree.closed.public) do c = zpm.util.indexTable(self.tree, c) if c and d.package == c.package then if c.path or premake.checkVersion(c.version, d.versionRequirement) then table.insert(pubVersions, {c.version}) else return nil end end end local vs = d.package:getVersions(d.versionRequirement) if table.isempty(vs) then warningOncef("Package '%s' has no release that matches '%s'", d.package.fullName, d.versionRequirement) return nil else table.insert(pubVersions, vs) end end return pubVersions end function Solution:_enumeratePrivateVersions() local privVersions = {} for _, d in pairs(self.cursor.private) do local vs = d.package:getVersions(d.versionRequirement) if table.isempty(vs) then warningOncef("Package '%s' has no release that matches '%s'", d.package.fullName, d.versionRequirement) return nil else table.insert(privVersions, vs) end end return privVersions end function Solution:_extractNode(node, isLock) local result = { public = {}, private = {}, name = node.package.fullName, definition = node.package.definition, repository = node.package.repository, versionRequirement = node.versionRequirement, version = node.version, optionals = table.deepcopy(node.optionals), hash = node.hash, settings = node.settings, tag = node.tag } if not isLock then result.closed = node.closed node.meta = node.definition end self:_extractDependencies(node.private, result.private, isLock) self:_extractDependencies(node.public, result.public, isLock) if table.isempty(result.public) then result.public = nil end if table.isempty(result.private) then result.private = nil end --print(table.tostring(node), "\n") return result end function Solution:_extractDependencies(dependencies, result, isLock) if not dependencies then return end for _, d in pairs(dependencies) do local c = result if d.type then if not result[d.type] then result[d.type] = {} end c = result[d.type] end local extract = self:_extractNode(d, isLock) if not isLock then extract.package = d.package end table.insert(c, extract) end end function Solution:_carthesian(lists, amount) if not lists or #lists == 0 then return {} end local indices = {} if not self.indices or table.isempty(self.indices) then for i=1,#lists do table.insert(indices, 1) end else indices = table.deepcopy(self.indices) end local abort = false local result = {} while #result < amount and not abort do local l = {} for list,i in zpm.util.zip(lists, indices) do table.insert(l, list[i]) end table.insert(result,l) local j = #indices while true do indices[j] = indices[j] + 1 if indices[j] <= #lists[j] then break end indices[j] = 1 j = j - 1 if j <= 0 then abort = true indices = nil j = 1 break end end end self.indices = indices return result end
-- utf8 vim.g.encoding = "UTF-8" vim.o.fileencoding = 'utf-8' -- jkhl keep 8 line arround cursor vim.o.scrolloff = 8 vim.o.sidescrolloff = 8 -- relative number vim.wo.number = true vim.wo.relativenumber = true vim.wo.cursorline = true vim.wo.signcolumn = "yes" vim.wo.colorcolumn = "80" -- tab space vim.o.tabstop = 4 vim.bo.tabstop = 4 vim.o.softtabstop = 4 vim.o.shiftround = true vim.o.shiftwidth = 4 vim.bo.shiftwidth = 4 vim.o.expandtab = true vim.bo.expandtab = true vim.o.autoindent = true vim.bo.autoindent = true vim.o.smartindent = true vim.o.ignorecase = true vim.o.smartcase = true vim.o.hlsearch = true vim.o.incsearch = true vim.o.cmdheight = 1 vim.o.autoread = true vim.bo.autoread = true vim.wo.wrap = false vim.o.whichwrap = '<,>,[,]' vim.o.hidden = true vim.o.mouse = "a" vim.o.backup = false vim.o.writebackup = false vim.o.swapfile = false vim.o.updatetime = 300 vim.o.timeoutlen = 500 vim.o.splitbelow = true vim.o.splitright = true vim.g.completeopt = "menu,menuone,noselect,noinsert" vim.o.background = "dark" vim.o.termguicolors = true vim.opt.termguicolors = true vim.o.list = false vim.o.listchars = "space:·" vim.o.wildmenu = true vim.o.shortmess = vim.o.shortmess .. 'c' vim.o.pumheight = 10 vim.o.showtabline = 2 vim.o.showmode = false vim.o.clipboard = "unnamedplus"
local http = require "socket.http" local cjson = require "cjson" local crypt = require "crypt" local Answer = require "app.answer" function exit() os.exit(0) end function help() print([=[ connect(ip,port,[master_linkid]) -> tcp connect to ip:port and return a linkobj e.g: linkobj = connect("127.0.0.1",8888) kcp_connect(ip,port,[master_linkid]) -> kcp connect to ip:port and return a kcpobj e.g: linkobj = kcp_connect("127.0.0.1",8889) websocket_connect(ip,port,[master_linkid]) -> websocket connect to ip:port and return a kcpobj e.g: linkobj = websocket_connect("127.0.0.1",8887) quicklogin(linkobj,account,roleid) -> use account#roleid to login,if account donn't exist,auto register it if account's role donn't exist,auto create role(roleid may diffrence) e.g: quicklogin(linkobj,"lgl",1000000) entergame(linkobj,account,roleid) -> use roleid to debuglogin,if role donn't exist,auto create role debuglogin's features: 1. client can control the roleid when create role 2. do not communicate with account center when create role, so donn't use it except you really understand e.g: entergame(linkobj,"lgl",1000000) linkobj:send_request(proto,request,[callback]) -> use linkobj to send a request e.g: linkobj:send_request("C2GS_Ping",{str="hello,world!"}) linkobj:send_response(proto,response,session) -> use linkobj to send a response linkobj:quite() -> stop/start print linkobj receive message ]=]) end function connect(ip,port,master_linkid) local tcp = require "app.client.tcp" local tcpobj = tcp.new() tcpobj.master_linkid = master_linkid tcpobj:connect(ip,port) return tcpobj end function kcp_connect(ip,port,master_linkid) local kcp = require "app.client.kcp" local kcpobj = kcp.new() kcpobj.master_linkid = master_linkid kcpobj:connect(ip,port) return kcpobj end function websocket_connect(ip,port,master_linkid) local websocket = require "app.client.websocket" local wbobj = websocket.new() wbobj.master_linkid = master_linkid wbobj:connect(ip,port) return wbobj end -- 使用特定角色进入游戏,角色不存在会自动创建,不传递token默认为debug登录, -- debug登录特点: -- 1. 创建角色时客户端可以控制角色ID -- 2. 创建角色时不经过账号中心(即不会校验账号的存在性) function entergame(linkobj,account,roleid,token) local function fail(fmt,...) fmt = string.format("[linktype=%s,account=%s,roleid=%s] %s",linkobj.linktype,linkobj.account or account,roleid,fmt) print(string.format(fmt,...)) end local name = tostring(roleid) local token = token or "debug" local forward = "EnterGame" linkobj:send_request("C2GS_CheckToken",{account=account,token=token,forward=forward,version="99.99.99"}) linkobj:wait("GS2C_CheckTokenResult",function (linkobj,message) local args = message.args local status = args.status local code = args.code if status ~= 200 or code ~= Answer.code.OK then fail("checktoken fail: status=%s,code=%s",status,code) return end linkobj:send_request("C2GS_EnterGame",{roleid=roleid}) linkobj:wait("GS2C_ReEnterGame",function (linkobj,message) linkobj:ignore_one("GS2C_EnterGameResult") local args = message.args local token = args.token local roleid = args.roleid local go_serverid = args.go_serverid local ip = args.ip local new_linkobj if linkobj.linktype == "tcp" then new_linkobj = connect(ip,args.tcp_port) elseif linkobj.linktype == "kcp" then new_linkobj = kcp_connect(ip,args.kcp_port) elseif linkobj.linktype == "websocket" then new_linkobj = websocket_connect(ip,args.websocket_port) end linkobj.child = new_linkobj entergame(new_linkobj,account,roleid,token) end) linkobj:wait("GS2C_EnterGameResult",function (linkobj,message) linkobj:ignore_one("GS2C_ReEnterGame") local args = message.args local status = args.status local code = args.code if status ~= 200 or (code ~= Answer.code.OK and code ~= Answer.code.ROLE_NOEXIST) then fail("entergame fail: status=%s,code=%s",status,code) return end if code == Answer.code.ROLE_NOEXIST then linkobj:send_request("C2GS_CreateRole",{account=account,name=name,roleid=roleid}) linkobj:wait("GS2C_CreateRoleResult",function (linkobj,message) local args = message.args local status = args.status local code = args.code if status ~= 200 or code ~= Answer.code.OK then fail("createrole fail: status=%s,code=%s",status,code) return end local role = args.role roleid = assert(role.roleid) print(string.format("op=createrole,account=%s,roleid=%s",account,roleid)) entergame(linkobj,account,roleid,token) end) return end linkobj.account = args.account fail("login success") end) end) end local function signature(str,secret) if type(str) == "table" then str = table.ksort(str,"&",{sign=true}) end return crypt.base64encode(crypt.hmac_sha1(secret,str)) end local function make_request(request,secret) secret = secret or app.config.loginserver.appkey request.sign = signature(request,secret) return cjson.encode(request) end local function unpack_response(response) response = cjson.decode(response) return response end -- 类似entergame,但是会先进行账密校验,账号不存在还会自动注册账号 function quicklogin(linkobj,account,roleid) local function fail(fmt,...) fmt = string.format("[linktype=%s,account=%s,roleid=%s] %s",linkobj.linktype,linkobj.account or account,roleid,fmt) print(string.format(fmt,...)) end local passwd = "1" local name = roleid local loginserver = app.config.loginserver local appid = app.config.appid local url = string.format("http://%s:%s/api/account/login",loginserver.ip,loginserver.port) local req = make_request({ appid = appid, account = account, passwd = passwd, }) local response,status = http.request(url,req) if not response or status ~= 200 then fail("login fail,status:%s",status) return end response = unpack_response(response) local code = response.code if code == Answer.code.ACCT_NOEXIST then -- register account local url = string.format("http://%s:%s/api/account/register",loginserver.ip,loginserver.port) local req = make_request({ appid = appid, account = account, passwd = passwd, sdk = "local", platform = "local", }) local response,status = http.request(url,req) if not response or status ~= 200 then fail("register fail: status=%s",status) return end response = unpack_response(response) local code = response.code if code ~= Answer.code.OK then fail("register fail: code=%s,message=%s",code,response.message) return end quicklogin(linkobj,account,roleid) return elseif code ~= Answer.code.OK then fail("login fail: code=%s,message=%s",code,response.message) return end local token = response.data.token account = response.data.account or account entergame(linkobj,account,roleid,token) end
---------------------------------------- -- Forge ---------------------------------------- gForge_GlobalSettings = {} gForge_CharacterSettings = {} function Forge:Initialize() if self.Initialized then return end self.Initialized = true Forge.CharacterSettings = gForge_CharacterSettings self.CharacterSettings = gForge_CharacterSettings self.GlobalSettings = gForge_GlobalSettings -- -- Window stuff should be moved to ForgeUI --self.CharacterSettings.WindowSettings = self.WindowLib:VariablesLoaded(self.CharacterSettings.WindowSettings) -- Slash commands SlashCmdList.FORGE = function (...) Forge:ExecuteCommand(...) end SLASH_FORGE1 = "/forge" self:AddSlashCommand("help", self.ShowAllHelp, self, nil, "Shows this list") -- Window stuff should be moved to ForgeUI --self:AddSlashCommand("show", self.ShowMainWindow, self, nil, "Shows the main window") --self:AddSlashCommand("hide", self.HideMainWindow, self, nil, "Hides the main window") self:AddSlashCommand("id", self.IdentifyFramesUnderCursor, self, nil, "Identifies frames and regions under the mouse point") -- Create the main window -- Window stuff should be moved to ForgeUI --self.MainWindow = Forge._MainWindow:New() --self.MainWindow:Hide() --self.RaidLib:RegisterEvent("JOINED_RAID", self.PlayerJoinedRaid, self) --self.RaidLib:RegisterEvent("LEFT_RAID", self.PlayerLeftRaid, self) -- self:NoteMessage("Use /forge for a list of commands") self.EventLib:DispatchEvent("FORGE_INIT") end ---------------------------------------- -- Main window ---------------------------------------- --[[ function Forge:ShowMainWindow() self.MainWindow:Show() end function Forge:HideMainWindow() self.MainWindow:Hide() end function Forge:PlayerJoinedRaid() self:ShowMainWindow() end function Forge:PlayerLeftRaid() self:HideMainWindow() end ---------------------------------------- Forge._MainWindow = {} ---------------------------------------- Forge._MainWindow._Inherits = Forge.WindowLib._SimpleWindowFrame function Forge._MainWindow:New() return Forge.WindowLib:NewWindow("ForgeMainWindow", self, "Forge", UIParent, 300, 400) end function Forge._MainWindow:Construct() Forge.WindowLib._SimpleWindowFrame.Construct(self) self.HeaderBackground = Forge._SolidFrameBackground:New(self.ContentFrame) self.HeaderBackground:SetHeight(70) self.HeaderBackground:Show() self.ContentFrame:Stack(self.HeaderBackground, "TOP") end ---------------------------------------- Forge._SolidFrameBackground = {} ---------------------------------------- function Forge._SolidFrameBackground:New(pParent) local vFrame = CreateFrame("Frame", nil, pParent) Forge.WindowLib:ConstructFrame(vFrame, self) return vFrame end Forge._SolidFrameBackground.cTextureWidth = 128 Forge._SolidFrameBackground.cTextureHeight = 32 Forge._SolidFrameBackground.cLeftWidth = 8 Forge._SolidFrameBackground.cRightWidth = 8 Forge._SolidFrameBackground.cTopHeight = 8 Forge._SolidFrameBackground.cBottomHeight = 8 Forge._SolidFrameBackground.cLeftOffset = 44 Forge._SolidFrameBackground.cHorizTexCoord0 = Forge._SolidFrameBackground.cLeftOffset / Forge._SolidFrameBackground.cTextureWidth Forge._SolidFrameBackground.cHorizTexCoord1 = (Forge._SolidFrameBackground.cLeftOffset + Forge._SolidFrameBackground.cLeftWidth) / Forge._SolidFrameBackground.cTextureWidth Forge._SolidFrameBackground.cHorizTexCoord2 = (Forge._SolidFrameBackground.cTextureWidth - Forge._SolidFrameBackground.cRightWidth) / Forge._SolidFrameBackground.cTextureWidth Forge._SolidFrameBackground.cHorizTexCoord3 = 1 Forge._SolidFrameBackground.cVertTexCoord0 = 0 Forge._SolidFrameBackground.cVertTexCoord1 = Forge._SolidFrameBackground.cTopHeight / Forge._SolidFrameBackground.cTextureHeight Forge._SolidFrameBackground.cVertTexCoord2 = (Forge._SolidFrameBackground.cTextureHeight - Forge._SolidFrameBackground.cBottomHeight) / Forge._SolidFrameBackground.cTextureHeight Forge._SolidFrameBackground.cVertTexCoord3 = 1 function Forge._SolidFrameBackground:Construct() self.TopLeft = self:CreateTexture(nil, "BACKGROUND") self.TopLeft:SetTexture("Interface\\Addons\\Forge\\Textures\\RoleBackground") self.TopLeft:SetTexCoord(self.cHorizTexCoord0, self.cHorizTexCoord1, self.cVertTexCoord0, self.cVertTexCoord1) self.TopLeft:SetWidth(self.cLeftWidth) self.TopLeft:SetHeight(self.cTopHeight) self.TopLeft:SetPoint("TOPLEFT", self, "TOPLEFT") self.BottomLeft = self:CreateTexture(nil, "BACKGROUND") self.BottomLeft:SetTexture("Interface\\Addons\\Forge\\Textures\\RoleBackground") self.BottomLeft:SetTexCoord(self.cHorizTexCoord0, self.cHorizTexCoord1, self.cVertTexCoord2, self.cVertTexCoord3) self.BottomLeft:SetWidth(self.cLeftWidth) self.BottomLeft:SetHeight(self.cBottomHeight) self.BottomLeft:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT") self.Left = self:CreateTexture(nil, "BACKGROUND") self.Left:SetTexture("Interface\\Addons\\Forge\\Textures\\RoleBackground") self.Left:SetTexCoord(self.cHorizTexCoord0, self.cHorizTexCoord1, self.cVertTexCoord1, self.cVertTexCoord2) self.Left:SetWidth(self.cLeftWidth) self.Left:SetPoint("TOPLEFT", self.TopLeft, "BOTTOMLEFT") self.Left:SetPoint("BOTTOMLEFT", self.BottomLeft, "TOPLEFT") self.TopRight = self:CreateTexture(nil, "BACKGROUND") self.TopRight:SetTexture("Interface\\Addons\\Forge\\Textures\\RoleBackground") self.TopRight:SetTexCoord(self.cHorizTexCoord2, self.cHorizTexCoord3, self.cVertTexCoord0, self.cVertTexCoord1) self.TopRight:SetWidth(self.cRightWidth) self.TopRight:SetHeight(self.cTopHeight) self.TopRight:SetPoint("TOPRIGHT", self, "TOPRIGHT") self.BottomRight = self:CreateTexture(nil, "BACKGROUND") self.BottomRight:SetTexture("Interface\\Addons\\Forge\\Textures\\RoleBackground") self.BottomRight:SetTexCoord(self.cHorizTexCoord2, self.cHorizTexCoord3, self.cVertTexCoord2, self.cVertTexCoord3) self.BottomRight:SetWidth(self.cRightWidth) self.BottomRight:SetHeight(self.cBottomHeight) self.BottomRight:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT") self.Right = self:CreateTexture(nil, "BACKGROUND") self.Right:SetTexture("Interface\\Addons\\Forge\\Textures\\RoleBackground") self.Right:SetTexCoord(self.cHorizTexCoord2, self.cHorizTexCoord3, self.cVertTexCoord1, self.cVertTexCoord2) self.Right:SetWidth(self.cRightWidth) self.Right:SetPoint("TOPRIGHT", self.TopRight, "BOTTOMRIGHT") self.Right:SetPoint("BOTTOMRIGHT", self.BottomRight, "TOPRIGHT") self.Top = self:CreateTexture(nil, "BACKGROUND") self.Top:SetTexture("Interface\\Addons\\Forge\\Textures\\RoleBackground") self.Top:SetTexCoord(self.cHorizTexCoord1, self.cHorizTexCoord2, self.cVertTexCoord0, self.cVertTexCoord1) self.Top:SetHeight(self.cTopHeight) self.Top:SetPoint("TOPLEFT", self.TopLeft, "TOPRIGHT") self.Top:SetPoint("TOPRIGHT", self.TopRight, "TOPLEFT") self.Bottom = self:CreateTexture(nil, "BACKGROUND") self.Bottom:SetTexture("Interface\\Addons\\Forge\\Textures\\RoleBackground") self.Bottom:SetTexCoord(self.cHorizTexCoord1, self.cHorizTexCoord2, self.cVertTexCoord2, self.cVertTexCoord3) self.Bottom:SetHeight(self.cBottomHeight) self.Bottom:SetPoint("BOTTOMLEFT", self.BottomLeft, "BOTTOMRIGHT") self.Bottom:SetPoint("BOTTOMRIGHT", self.BottomRight, "BOTTOMLEFT") self.Middle = self:CreateTexture(nil, "BACKGROUND") self.Middle:SetTexture("Interface\\Addons\\Forge\\Textures\\RoleBackground") self.Middle:SetTexCoord(self.cHorizTexCoord1, self.cHorizTexCoord2, self.cVertTexCoord1, self.cVertTexCoord2) self.Middle:SetPoint("TOPLEFT", self.TopLeft, "BOTTOMRIGHT") self.Middle:SetPoint("TOPRIGHT", self.TopRight, "BOTTOMLEFT") self.Middle:SetPoint("BOTTOMLEFT", self.BottomLeft, "TOPRIGHT") self.Middle:SetPoint("BOTTOMRIGHT", self.BottomRight, "TOPLEFT") end ]] ---------------------------------------- -- DecodeItemLink ---------------------------------------- Forge.cItemLinkFormat = "|Hitem:(-?%d+):(-?%d+):(-?%d+):(-?%d+):(-?%d+):(-?%d+):(-?%d+):(-?%d+):(-?%d+):(-?%d+):(-?%d+):(-?%d+):(-?%d+)|h%[([^%]]*)%]|h" function Forge:DecodeItemLink(pItemLink) if not pItemLink then return nil end local vStartIndex, vEndIndex, vLinkColor, vItemCode, vItemEnchantCode, vItemJewelCode1, vItemJewelCode2, vItemJewelCode3, vItemJewelCode4, vItemSubCode, vUnknownCode5, vItemName = strfind(pItemLink, Forge.cItemLinkFormat) if not vStartIndex then return nil end local vLinkInfo = { Link = pItemLink, Name = vItemName, Code = tonumber(vItemCode), SubCode = tonumber(vItemSubCode), EnchantCode = tonumber(vItemEnchantCode), JewelCode1 = tonumber(vItemJewelCode1), JewelCode2 = tonumber(vItemJewelCode2), JewelCode3 = tonumber(vItemJewelCode3), JewelCode4 = tonumber(vItemJewelCode4), } return vLinkInfo end Forge.cDeformat = { s = "(.-)", d = "(-?[%d]+)", f = "(-?[%d%.]+)", g = "(-?[%d%.]+)", ["%"] = "%%", } function Forge:ConvertFormatStringToSearchPattern(pFormat) local vEscapedFormat = pFormat:gsub( "[%[%]%.]", function (pChar) return "%"..pChar end) return vEscapedFormat:gsub( "%%[%-%d%.]-([sdgf%%])", self.cDeformat) end ---------------------------------------- -- Slash commands ---------------------------------------- Forge.SlashCommands = {} Forge.OrderedSlashCommands = {} function Forge:ExecuteCommand(pCommandString) local vStartIndex, vEndIndex, vCommand, vParameter = string.find(pCommandString, "([^%s]+) ?(.*)") if not vStartIndex then self:ShowAllHelp() return end local vCommandInfo = self.SlashCommands[string.lower(vCommand)] if not vCommandInfo then self:ShowAllHelp() return end vCommandInfo.Func(vCommandInfo.Param, vCommand, vParameter) end function Forge:AddSlashCommand(pCommand, pFunction, pParam, pHelpParameters, pHelpDescription) local vSlashCommand = { Command = string.lower(pCommand), Func = pFunction, Param = pParam, HelpParams = pHelpParameters, HelpDesc = pHelpDescription, } table.insert(self.OrderedSlashCommands, vSlashCommand) self.SlashCommands[vSlashCommand.Command] = vSlashCommand end function Forge:ShowAllHelp(pCommand, pParameter) for _, vSlashCommand in ipairs(self.OrderedSlashCommands) do self:NoteMessage(HIGHLIGHT_FONT_COLOR_CODE.."/forge %s %s"..NORMAL_FONT_COLOR_CODE..": %s", vSlashCommand.Command, vSlashCommand.HelpParams or "", vSlashCommand.HelpDesc or "No description available") end end function Forge:ShowCommandHelp(pCommand) local vSlashCommand = self.SlashCommands[pCommand] if not vSlashCommand then return end self:NoteMessage(HIGHLIGHT_FONT_COLOR_CODE.."/forge %s %s"..NORMAL_FONT_COLOR_CODE..": %s", pCommand, vSlashCommand.HelpParams or "", vSlashCommand.HelpDesc or "No description available") return end function Forge:GetUnitDistanceRange(pUnitID) if UnitIsUnit(pUnitID, "player") then return 0, 0 end if not UnitIsVisible(pUnitID) then return 100, nil elseif CheckInteractDistance(pUnitID, 3) then return 0, 10 elseif CheckInteractDistance(pUnitID, 2) then return 10, 11.11 elseif CheckInteractDistance(pUnitID, 4) then return 11.11, 28 else return 28, 100 end end function Forge:GetFrameMaxLevel(pFrame, pUseDepth, pFrameLevel) local vLevel = pFrameLevel or pFrame:GetFrameLevel() local vChildren = {pFrame:GetChildren()} for _, vChildFrame in pairs(vChildren) do local vChildLevel if pUseDepth then vChildLevel = vLevel + 1 end vChildLevel = self:GetFrameMaxLevel(vChildFrame, pUseDepth, vChildLevel) if vChildLevel > vLevel then vLevel = vChildLevel end end return vLevel end function Forge:IdentifyFramesUnderCursor() local vCursorX, vCursorY = GetCursorPosition() self:IdentifyChildrenUnderPoint(UIParent, vCursorX, vCursorY) end function Forge:IdentifyChildrenUnderPoint(pFrame, pX, pY, pPrefix) local vEffectiveScale = pFrame:GetEffectiveScale() if not pPrefix then pPrefix = "" end for _, vRegion in pairs({pFrame:GetRegions()}) do if self:PointInRegion(vRegion, pX, pY, vEffectiveScale) then local vRegionName = pPrefix.."Region: "..(vRegion:GetName() or "<unnamed>") DEFAULT_CHAT_FRAME:AddMessage(vRegionName) end end for _, vFrame in pairs({pFrame:GetChildren()}) do if not vFrame:IsForbidden() then if self:PointInFrame(vFrame, pX, pY) then local vFrameName = pPrefix.."Frame: "..(vFrame:GetName() or "<unnamed>").." level "..tostring(vFrame:GetFrameLevel()) DEFAULT_CHAT_FRAME:AddMessage(vFrameName) end self:IdentifyChildrenUnderPoint(vFrame, pX, pY, pPrefix.." ") end end end function Forge:PointInFrame(pFrame, pPointX, pPointY) return self:PointInRegion(pFrame, pPointX, pPointY, pFrame:GetEffectiveScale()) end function Forge:PointInRegion(pFrame, pPointX, pPointY, pScale) return pFrame:IsVisible() and pFrame:GetLeft() ~= nil and pPointX >= (pFrame:GetLeft() * pScale) and pPointX < (pFrame:GetRight() * pScale) and pPointY <= (pFrame:GetTop() * pScale) and pPointY > (pFrame:GetBottom() * pScale) end ---------------------------------------- -- Object-oriented ---------------------------------------- function Forge:New(pMethodTable, ...) local vObject if pMethodTable.New then vObject = pMethodTable:New(...) else vObject = {} end return Forge:Construct(vObject, pMethodTable, ...) end function Forge:Construct(pObject, pMethodTable, ...) if not pMethodTable then self:ErrorMessage("ConstructObject called with nil method table") self:DebugStack() return end for vIndex, vValue in pairs(pMethodTable) do pObject[vIndex] = vValue end if pMethodTable.Construct then return pObject, pMethodTable.Construct(pObject, ...) else return pObject end end ---------------------------------------- ---------------------------------------- Forge.EventLib:RegisterEvent("PLAYER_ENTERING_WORLD", Forge.Initialize, Forge)
if data.raw["lab"]["lab-2"] and data.raw["item"]["fu_space_probe_science_item"] then table.insert(data.raw["lab"]["lab-2"].inputs, "fu_space_probe_science_item") end
print("This was made for @[{_VERSION}]")
#!/usr/bin/lua local DHCP_FILE = '/tmp/dhcp.leases' local dhcp_parser = {} dhcp_parser.__index = dhcp_parser function dhcp_parser.new() log("dhcp_parser.new()") local self = setmetatable({}, dhcp_parser) if info.io == nil then info.io = {} end if info.io.dhcp == nil then info.io.dhcp = {} info.io.dhcp._updated = os.date("*t") end if info.mqtt == nil then info.mqtt = {} end -- if info.mqtt.subscription_loaders == nil then -- info.mqtt.subscription_loaders = {} -- end -- if info.mqtt.announcer_loaders == nil then -- info.mqtt.announcer_loaders = {} -- end -- info.mqtt.subscription_loaders['dhcp'] = self.subscribe -- info.mqtt.announcer_loaders['dhcp'] = self.announce return self end function dhcp_parser:read_dhcp() local update local file_mod_time_string = file_mod_time(DHCP_FILE) if file_mod_time_string ~= info.io.dhcp._file_update_time then info.io.dhcp._file_update_time = file_mod_time_string log('dhcp_parser:read_dhcp(): reading:', DHCP_FILE) -- Read dhcp leases file to see what's actually been on the network recently. local file_handle = io.open(DHCP_FILE, "r") if file_handle then for line in file_handle:lines() do local mac, address, name = string.match(line, "^%s*%d+%s+([%x:]+)%s+([%d\.]+)%s+([%w_-%*]+)") mac = sanitize_mac_address(mac) address = sanitize_network_address(address) name = sanitize_text(name) if info.io.dhcp[mac] == nil then log('dhcp_parser:read_dhcp(): new record:', mac) info.io.dhcp[mac] = {} info.io.dhcp[mac].__update = true end if info.io.dhcp[mac].address ~= address then log('dhcp_parser:read_dhcp(): updated network address:', address) info.io.dhcp[mac].address = address info.io.dhcp[mac].__update = true end if info.io.dhcp[mac].dhcp_name ~= name then log('dhcp_parser:read_dhcp(): updated dhcp_name:', name) info.io.dhcp[mac].dhcp_name = name info.io.dhcp[mac].__update = true end end file_handle:close() end end -- Check devices are actually reachable on the network. for stored_mac, device in pairs(info.io.dhcp) do if string.sub(stored_mac, 1, 1) ~= '_' then local reachable = false -- Android devices (and presumably others) running on battery will not reply -- to ICMP requests (eg, ping) but an arping will still elicit a response. if device.address and os.execute('arping -c5 -f ' .. device.address .. ' 1> /dev/null') == 0 then -- Is reachable. reachable = true end if info.io.dhcp[stored_mac].reachable ~= reachable then log('dhcp_parser:read_dhcp(): updated reachable:', stored_mac, device.address, reachable) info.io.dhcp[stored_mac].reachable = reachable info.io.dhcp[stored_mac].__update = true end end end local since_force_update = math.abs(os.date("*t").min - info.io.dhcp._updated.min) if (since_force_update >= 5) then -- A force update is happening this round so reset timer. -- TODO Make the "5" delay configurable. info.io.dhcp._updated = os.date("*t") end self:publish_dhcp(since_force_update < 5) return end function dhcp_parser:publish_one_record(mac_address, check_if_updated) if string.sub(mac_address, 1, 1) == '_' then return end if type(info.io.dhcp[mac_address]) ~= 'table' then return end if (check_if_updated == true and info.io.dhcp[mac_address].__update ~= true) then return end info.io.dhcp[mac_address].__update = nil local topic = "homeautomation/0/dhcp/_announce" local payload = "_subject : dhcp/" .. mac_address for label, data in pairs(info.io.dhcp[mac_address]) do if data ~= nil then payload = payload .. ", _" .. label .. " : " .. tostring(data) end end log(topic, payload) mqtt_instance:publish(topic, payload) -- Make sure we are subscribed to messages sent to this target. -- We need to do this here because a dhcp lease may not have been given yet when -- dhcp_parser:subscribe() was called. subscribe_to_all(self, 'dhcp', mac_address) end function dhcp_parser:publish_dhcp(check_if_updated) for mac_address, data in pairs(info.io.dhcp) do self:publish_one_record(mac_address, check_if_updated) end end -- Called when MQTT connects and returns a list of topics this module should subscribe to. function dhcp_parser:subscribe() local subscritions = {} -- TODO Subscribe to updates from other DHCP servers on the network. -- subscribe_to["homeautomation/+/dhcp"] = true for dhcp_lease, things in pairs(info.io.dhcp) do if type(things) == 'table' then subscritions[#subscritions +1] = {role = 'dhcp', address = dhcp_lease} end end return subscritions end -- Publishes topics this module knows about. function dhcp_parser:announce() log("dhcp_parser:announce()") self:publish_dhcp() end -- This gets called whenever a topic this module is subscribed to appears on the bus. function dhcp_parser:callback(path, incoming_data) log("dhcp_parser:callback", path, incoming_data._command) path = var_to_path(path) local incoming_command = incoming_data._command local role, identifier = path:match('(.-)/(.+)') if role == '_all' then role = 'dhcp' end if role == 'dhcp' and info.io[role] and incoming_command == 'solicit' then if identifier == '_all' then for mac_address, _ in pairs(info.io[role]) do if is_sanitized_mac_address(mac_address) then self:publish_one_record(mac_address, false) end end elseif info.io[role][identifier] then self:publish_one_record(identifier, false) end end end return dhcp_parser
Brama = createObject (2990, 1527.4000244141, 663.59997558594, 13.60000038147, 0, 0, 359.75) function OtworzBrame () moveObject ( Brama, 1000, 1527.4000244141, 663.59997558594, 13.60000038147 ) end addCommandHandler("c2", OtworzBrame ) function ZamknijBrame () moveObject ( Brama, 1000, 1527.4000244141, 663.59997558594, 5.4000000953674 ) end addCommandHandler("o2", ZamknijBrame ) -- <script src="brama.lua" />
local ChargeInfoUI = class("ChargeInfoUI", BaseUI) function ChargeInfoUI:ctor() self:load(UriConst.ui_chargeInfo, UIType.PopUp, UIAnim.MiddleAppear) end function ChargeInfoUI:Refresh() local data = Player.info if data then self.input_name.text = Player.info.recharge_name self.input_phone.text = Player.info.recharge_phone self.input_email.text = Player.info.recharge_email end end function ChargeInfoUI:ReqBind() local data = {} data.recharge_name = self.input_name.text data.recharge_phone = self.input_phone.text data.recharge_email = self.input_email.text App.RetrieveProxy("MainProxy"):ChargeBindReq(data) end function ChargeInfoUI:onClick(go, name) if name == "btn_ok" then self:ReqBind() end self:closePage() end return ChargeInfoUI
local build_dir = "build/" .. _ACTION -------------------------------------------------------------------------------- workspace "Grisu" configurations { "release", "debug" } platforms { "x64", "x86" } filter { "platforms:x64" } architecture "x86_64" filter { "platforms:x86" } architecture "x86" filter {} location (build_dir) objdir (build_dir .. "/obj") warnings "Extra" -- exceptionhandling "Off" -- rtti "Off" flags { "StaticRuntime", } configuration { "debug" } targetdir (build_dir .. "/bin/debug") configuration { "release" } targetdir (build_dir .. "/bin/release") configuration { "debug" } defines { "_DEBUG" } symbols "On" configuration { "release" } defines { "NDEBUG" } symbols "On" -- for profiling... optimize "Full" -- On ==> -O2 -- Full ==> -O3 configuration { "gmake" } buildoptions { "-std=c++11", "-march=native", "-Wformat", -- "-Wsign-compare", -- "-Wsign-conversion", -- "-pedantic", -- "-fno-omit-frame-pointer", -- "-ftime-report", } configuration { "gmake", "debug", "linux" } buildoptions { -- "-fno-omit-frame-pointer", -- "-fsanitize=undefined", -- "-fsanitize=address", -- "-fsanitize=memory", -- "-fsanitize-memory-track-origins", } linkoptions { -- "-fsanitize=undefined", -- "-fsanitize=address", -- "-fsanitize=memory", } configuration { "vs*" } buildoptions { "/utf-8", -- "/std:c++latest", -- "/EHsc", -- "/arch:AVX2", -- "/GR-", } defines { -- "_CRT_SECURE_NO_WARNINGS=1", -- "_SCL_SECURE_NO_WARNINGS=1", -- "_HAS_EXCEPTIONS=0", } configuration { "windows" } characterset "MBCS" -------------------------------------------------------------------------------- group "Libs" project "double-conversion" language "C++" kind "StaticLib" files { "ext/double-conversion/*.cc", "ext/double-conversion/*.h", } includedirs { "ext/", } -------------------------------------------------------------------------------- group "Tests" project "test" language "C++" kind "ConsoleApp" files { "src/fast_dtoa.h", "test/test.cc", } includedirs { "ext/", } links { "double-conversion", }
-- Super Mario Land autosplitter for LiveSplit -- Trysdyn Black, 2016 https://github.com/trysdyn/bizhawk-speedrun-lua -- Requires LiveSplit 1.7+ world = -1 stage = -1 boss = false local function init_livesplit() pipe_handle = io.open("//./pipe/LiveSplit", 'a') if not pipe_handle then error("\nFailed to open LiveSplit named pipe!\n" .. "Please make sure LiveSplit is running and is at least 1.7, " .. "then load this script again") end pipe_handle:write("reset\r\n") pipe_handle:flush() return pipe_handle end local function next_stage() -- When the stage changes, we want to check if it's time to split. -- This function checks what stage we just moved into, and does the -- needful based on that. -- The stage number as displayed at the start of a new stage local this_world = memory.readbyte(0x982C) local this_stage = memory.readbyte(0x982E) -- In some cases the stage bytes are written without changing -- In those cases, just return, we don't want to do anything if world == this_world and stage == this_stage then return end -- Save the world/stage as globals for comparison purposes above world = this_world stage = this_stage -- Title screen is "0-0". Reset on this if stage == 0 then pipe_handle:write("reset\r\n") pipe_handle:flush() -- 1-1 is the start so start timer here elseif stage == 1 and world == 1 then pipe_handle:write("starttimer\r\n") pipe_handle:flush() -- 44-44 is an "Interim" stage. Discard it elseif stage == 44 then -- In any other case, split else pipe_handle:write("split\r\n") pipe_handle:flush() end end local function final_split() -- d10c is the boss HP but it's used by a ton of other stuff -- 216 is the boss initial HP, and seems to never show up otherwise -- So if d10c is 216, we start considering it boss HP and split when -- it hits 0. -- Grab 0xD10C and if it's 216, turn on the flag that says we're at the boss local d10c = memory.readbyte(0xD10C) if d10c == 216 then boss = true end -- If the boss flag is on and 0xD10C becomes 0, we just finished the game -- so split :) if d10c == 0 and boss == true then pipe_handle:write("split\r\n") pipe_handle:flush() boss = false end end -- Set up our TCP socket to LiveSplit and send a reset to be sure pipe_handle = init_livesplit() -- Set our memory domain for memory grabs in next_stage() -- "System Bus" exposes the entire memory map: VRAM, WRAM, ROM, etc. memory.usememorydomain("System Bus") -- Catch when the stage number changes and handle splits -- What these two addresses do is further explained in next_stage() and -- final_split() event.onmemorywrite(next_stage, 0x982E) event.onmemorywrite(final_split, 0xD10C) -- Bizhawk Lua requires the script to busy-loop or it'll exit while true do emu.frameadvance() end
require "classes.constants.screen" require "sqlite3" SQLite={} function SQLite:new() local this = display.newGroup() local public = this local private = {} local background = display.newImageRect("img/backgroundNotifications.png", 360, 570) local labelTitle = display.newText("SQLite demo", 20, 30, native.systemFontBold, 20) local labelSubtitle = display.newText("Creates or opens a local database", 20, 50, native.systemFont, 14) local labelInfo = display.newText("(Data is shown below)", 20, 90, native.systemFont, 14) local db = sqlite3.open(system.pathForFile("data.db", system.DocumentsDirectory)) local word = {'Hello', 'World', 'Lua'} function private.SQLite() background.x = screen.centerX background.y = screen.centerY labelTitle.anchorX = 0 labelTitle.anchorY = 0 labelTitle:setFillColor(190/255, 190/255, 255/255) labelSubtitle.anchorX = 0 labelSubtitle.anchorY = 0 labelSubtitle:setFillColor(190/255, 190/255, 255/255) labelInfo.anchorX = 0 labelInfo.anchorY = 0 labelInfo:setFillColor(255/255, 255/255, 255/255) this:insert(background) this:insert(labelTitle) this:insert(labelSubtitle) this:insert(labelInfo) db:exec([[ CREATE TABLE IF NOT EXISTS WordsTable(id INTEGER PRIMARY KEY, word1, word2); ]]) db:exec([[ INSERT INTO WordsTable VALUES (NULL, ']]..word[1]..[[',']]..word[2]..[['); ]]) db:exec([[ INSERT INTO WordsTable VALUES (NULL, ']]..word[2]..[[',']]..word[1]..[['); ]]) db:exec([[ INSERT INTO WordsTable VALUES (NULL, ']]..word[1]..[[',']]..word[3]..[['); ]]) for row in db:nrows("SELECT * FROM WordsTable") do local textTwoWords = row.word1.." "..row.word2 local labelTwoWords = display.newText(textTwoWords, 20, 120 + (20 * row.id), native.systemFont, 16) labelTwoWords.anchorX=0 labelTwoWords.anchorY=0 labelTwoWords:setFillColor(255/255, 0/255, 255/255) this:insert(labelTwoWords) end Runtime:addEventListener("system", private.onApplicationExit) end function private.onApplicationExit(event) if event.type == "applicationExit" then db:close() end end function public:destroy() Runtime:removeEventListener("system", private.onApplicationExit) background:removeSelf() background = nil labelTitle:removeSelf() labelTitle = nil labelSubtitle:removeSelf() labelSubtitle = nil labelInfo:removeSelf() labelInfo = nil this:removeSelf() this = nil end private.SQLite() return this end return SQLite
-- The Great Computer Language Shootout -- http://shootout.alioth.debian.org/ -- contributed by Mike Pall require 'benchmarks/bench' local co = coroutine local wrap, yield = co.wrap, co.yield if co.cstacksize then co.cstacksize(1) end -- Use minimum C stack. local function link(n) if n > 1 then local cofunc = wrap(link) cofunc(n-1) yield() repeat yield(cofunc() + 1) until false else repeat yield(1) until false end end for pass = 1,2 do local N = tonumber(arg and arg[1]) or 10 local cofunc = wrap(link) cofunc(500) local count = 0 for i = 1,N do count = count + cofunc() end io.write(count, "\n") logPass(pass) end logEnd()
local stack = Stack.New() stack:Push("v1") stack:Push("v2") assert(stack:GetCount() == 2) assert(stack:Peek() == "v2") assert(stack:Pop() == "v2") assert(stack:Peek() == "v1") assert(stack:GetCount() == 1) stack:Clear() assert(stack:GetCount() == 0)
---------------------------------------------------------- -- Load RayUI Environment ---------------------------------------------------------- RayUI:LoadEnv("ActionBar") local AB = _ActionBar function R:TestBossButton() if ExtraActionBarFrame:IsShown() then ExtraActionBarFrame.intro:Stop() ExtraActionBarFrame.outro:Play() else ExtraActionBarFrame.button:Show() ExtraActionBarFrame:Show() ExtraActionBarFrame.outro:Stop() ExtraActionBarFrame.intro:Play() ExtraActionBarFrame.button.style:SetTexture("Interface\\ExtraButton\\ChampionLight") ExtraActionBarFrame.button.style:Show() if not ExtraActionBarFrame.button.icon:GetTexture() then ExtraActionBarFrame.button.icon:SetTexture("Interface\\ICONS\\ABILITY_SEAL") ExtraActionBarFrame.button.icon:Show() end end end function AB:CreateExtraButton() local holder = CreateFrame("Frame", nil, R.UIParent) holder:Point("CENTER", R.UIParent, "BOTTOM", 500, 510) holder:Size(ExtraActionBarFrame:GetSize()) local draenorholder = CreateFrame("Frame", nil, R.UIParent) draenorholder:Point("BOTTOM", ExtraActionBarFrame, "TOP", 0, 20) draenorholder:Size(ExtraActionBarFrame:GetSize()) ExtraActionBarFrame:SetParent(holder) ExtraActionBarFrame:ClearAllPoints() ExtraActionBarFrame:SetPoint("CENTER", holder, "CENTER") ZoneAbilityFrame:SetParent(draenorholder) ZoneAbilityFrame:ClearAllPoints() ZoneAbilityFrame:SetPoint("CENTER", draenorholder, "CENTER") ExtraActionBarFrame.ignoreFramePositionManager = true ZoneAbilityFrame.ignoreFramePositionManager = true for i=1, ExtraActionBarFrame:GetNumChildren() do local button = _G["ExtraActionButton"..i] if button then -- button.Hide = R.dummy -- button:Show() button.noResize = true button.pushed = true button.checked = true self:Style(button) button:StyleButton(true) local tex = button:CreateTexture(nil, 'OVERLAY') tex:SetColorTexture(0.9, 0.8, 0.1, 0.3) tex:SetAllPoints() button:SetCheckedTexture(tex) _G["ExtraActionButton"..i.."Icon"]:SetDrawLayer("ARTWORK") _G["ExtraActionButton"..i.."Cooldown"]:SetFrameLevel(button:GetFrameLevel()+2) end end do local button = ZoneAbilityFrame.SpellButton -- button.Hide = R.dummy -- button:Show() button.pushed = true button.checked = true button:StyleButton(true) button:CreateShadow("Background") button.Cooldown:SetFrameLevel(button:GetFrameLevel()+2) button.border:SetFrameLevel(button:GetFrameLevel()) button.NormalTexture:SetDrawLayer("BACKGROUND") button.NormalTexture:Kill() button.Icon:SetDrawLayer("ARTWORK") button.Icon:SetTexCoord(.08, .92, .08, .92) button.Style:SetDrawLayer("BACKGROUND") end if HasExtraActionBar() then ExtraActionBarFrame:Show() end R:CreateMover(holder, "BossButtonMover", L["额外按钮"], true, nil, "ALL,ACTIONBARS,RAID") R:CreateMover(draenorholder, "DraenorButtonMover", L["要塞按钮"], true, nil, "ALL,ACTIONBARS,RAID") end
local args, options = require("shell").parse(...) if options.help then print([[`echo` writes the provided string(s) to the standard output. -n do not output the trialing newline --help display this help and exit]]) return end io.write(table.concat(args," ")) if not options.n then print() end
--[[ desc: TIME, a lib that encapsulate time function. author: Musoucrow since: 2018-5-8 alter: 2018-12-17 ]]-- local _delta = 0 local _time = 0 local _fps = 0 local _stddt = 17 local _updateTime = 0 local _frame = 0 local _calmness = false local _TIME = {} ---@class Lib.TIME ---@return number function _TIME.GetDelta() return _stddt end ---@return number function _TIME.GetTime() return _time end ---@return number function _TIME.GetFPS() return _fps end ---@return int function _TIME.GetFrame() return _frame end function _TIME.Calmness() _calmness = true end function _TIME.CanUpdate() return _updateTime >= _stddt end ---@param dt number function _TIME.Update(dt) if (_calmness) then _calmness = false _delta = 0 else _delta = math.floor(dt * 1000) end _time = love.timer.getTime() _fps = love.timer.getFPS() _updateTime = _updateTime + _delta end function _TIME.LateUpdate() _updateTime = _updateTime - _stddt end function _TIME.FrameUpdate() _frame = _frame + 1 end return _TIME
function MakeHat(name) local fname = "hat_"..name local symname = name.."hat" local texture = symname..".tex" local prefabname = symname local assets= { Asset("ANIM", "anim/"..fname..".zip"), --Asset("IMAGE", texture), } if name == "miner" then table.insert(assets, Asset("ANIM", "anim/hat_miner_off.zip")) end local function onequip(inst, owner, fname_override) local build = fname_override or fname owner.AnimState:OverrideSymbol("swap_hat", build, "swap_hat") owner.AnimState:Show("HAT") owner.AnimState:Show("HAT_HAIR") owner.AnimState:Hide("HAIR_NOHAT") owner.AnimState:Hide("HAIR") if owner:HasTag("player") then owner.AnimState:Hide("HEAD") owner.AnimState:Show("HEAD_HAIR") end if inst.components.fueled then inst.components.fueled:StartConsuming() end end local function onunequip(inst, owner) owner.AnimState:Hide("HAT") owner.AnimState:Hide("HAT_HAIR") owner.AnimState:Show("HAIR_NOHAT") owner.AnimState:Show("HAIR") if owner:HasTag("player") then owner.AnimState:Show("HEAD") owner.AnimState:Hide("HEAD_HAIR") end if inst.components.fueled then inst.components.fueled:StopConsuming() end end local function opentop_onequip(inst, owner) owner.AnimState:OverrideSymbol("swap_hat", fname, "swap_hat") owner.AnimState:Show("HAT") owner.AnimState:Hide("HAT_HAIR") owner.AnimState:Show("HAIR_NOHAT") owner.AnimState:Show("HAIR") owner.AnimState:Show("HEAD") owner.AnimState:Hide("HEAD_HAIR") if inst.components.fueled then inst.components.fueled:StartConsuming() end end local function simple() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() MakeInventoryPhysics(inst) inst.AnimState:SetBank(symname) inst.AnimState:SetBuild(fname) inst.AnimState:PlayAnimation("anim") inst:AddTag("hat") inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst:AddComponent("tradable") inst:AddComponent("equippable") inst.components.equippable.equipslot = EQUIPSLOTS.HEAD inst.components.equippable:SetOnEquip( onequip ) inst.components.equippable:SetOnUnequip( onunequip ) return inst end local function bee() local inst = simple() inst:AddComponent("armor") inst.components.armor:InitCondition(TUNING.ARMOR_BEEHAT, TUNING.ARMOR_BEEHAT_ABSORPTION) inst.components.armor:SetTags({"bee"}) return inst end local function generic_perish(inst) inst:Remove() end local function earmuffs() local inst = simple() inst:AddComponent("insulator") inst.components.insulator.insulation = TUNING.INSULATION_SMALL inst.components.equippable:SetOnEquip( opentop_onequip ) inst:AddComponent("fueled") inst.components.fueled.fueltype = "USAGE" inst.components.fueled:InitializeFuelLevel(TUNING.EARMUFF_PERISHTIME) inst.components.fueled:SetDepletedFn(generic_perish) inst.AnimState:SetRayTestOnBB(true) return inst end local function winter() local inst = simple() inst:AddComponent("dapperness") inst.components.dapperness.dapperness = TUNING.DAPPERNESS_TINY inst:AddComponent("insulator") inst.components.insulator.insulation = TUNING.INSULATION_MED inst:AddComponent("fueled") inst.components.fueled.fueltype = "USAGE" inst.components.fueled:InitializeFuelLevel(TUNING.WINTERHAT_PERISHTIME) inst.components.fueled:SetDepletedFn(generic_perish) return inst end local function football() local inst = simple() inst:AddComponent("armor") inst.components.armor:InitCondition(TUNING.ARMOR_FOOTBALLHAT, TUNING.ARMOR_FOOTBALLHAT_ABSORPTION) return inst end local function ruinshat_proc(inst, owner) inst:AddTag("forcefield") inst.components.armor:SetAbsorption(TUNING.FULL_ABSORPTION) local fx = SpawnPrefab("forcefieldfx") fx.entity:SetParent(owner.entity) fx.Transform:SetPosition(0, 0.2, 0) local fx_hitanim = function() fx.AnimState:PlayAnimation("hit") fx.AnimState:PushAnimation("idle_loop") end fx:ListenForEvent("blocked", fx_hitanim, owner) inst.components.armor.ontakedamage = function(inst, damage_amount) if owner then local sanity = owner.components.sanity if sanity then local unsaneness = damage_amount * TUNING.ARMOR_RUINSHAT_DMG_AS_SANITY sanity:DoDelta(-unsaneness, false) end end end inst.active = true owner:DoTaskInTime(--[[Duration]] TUNING.ARMOR_RUINSHAT_DURATION, function() fx:RemoveEventCallback("blocked", fx_hitanim, owner) fx.kill_fx(fx) if inst:IsValid() then inst:RemoveTag("forcefield") inst.components.armor.ontakedamage = nil inst.components.armor:SetAbsorption(TUNING.ARMOR_RUINSHAT_ABSORPTION) owner:DoTaskInTime(--[[Cooldown]] TUNING.ARMOR_RUINSHAT_COOLDOWN, function() inst.active = false end) end end) end local function tryproc(inst, owner) if not inst.active and math.random() < --[[ Chance to proc ]] TUNING.ARMOR_RUINSHAT_PROC_CHANCE then ruinshat_proc(inst, owner) end end local function ruins_onunequip(inst, owner) owner.AnimState:Hide("HAT") owner.AnimState:Hide("HAT_HAIR") owner.AnimState:Show("HAIR_NOHAT") owner.AnimState:Show("HAIR") if owner:HasTag("player") then owner.AnimState:Show("HEAD") owner.AnimState:Hide("HEAD_HAIR") end owner:RemoveEventCallback("attacked", inst.procfn) end local function ruins_onequip(inst, owner) owner.AnimState:OverrideSymbol("swap_hat", fname, "swap_hat") owner.AnimState:Show("HAT") owner.AnimState:Hide("HAT_HAIR") owner.AnimState:Show("HAIR_NOHAT") owner.AnimState:Show("HAIR") owner.AnimState:Show("HEAD") owner.AnimState:Hide("HEAD_HAIR") inst.procfn = function() tryproc(inst, owner) end owner:ListenForEvent("attacked", inst.procfn) end local function ruins() local inst = simple() inst:AddComponent("armor") inst:AddTag("metal") inst.components.armor:InitCondition(TUNING.ARMOR_RUINSHAT, TUNING.ARMOR_RUINSHAT_ABSORPTION) inst.components.equippable:SetOnEquip(ruins_onequip) inst.components.equippable:SetOnUnequip(ruins_onunequip) return inst end local function feather_equip(inst, owner) onequip(inst, owner) local ground = GetWorld() if ground and ground.components.birdspawner then ground.components.birdspawner:SetSpawnTimes(TUNING.BIRD_SPAWN_DELAY_FEATHERHAT) ground.components.birdspawner:SetMaxBirds(TUNING.BIRD_SPAWN_MAX_FEATHERHAT) end end local function feather_unequip(inst, owner) onunequip(inst, owner) local ground = GetWorld() if ground and ground.components.birdspawner then ground.components.birdspawner:SetSpawnTimes(TUNING.BIRD_SPAWN_DELAY) ground.components.birdspawner:SetMaxBirds(TUNING.BIRD_SPAWN_MAX) end end local function feather() local inst = simple() inst:AddComponent("dapperness") inst.components.dapperness.dapperness = TUNING.DAPPERNESS_SMALL inst.components.equippable:SetOnEquip( feather_equip ) inst.components.equippable:SetOnUnequip( feather_unequip ) inst:AddComponent("fueled") inst.components.fueled.fueltype = "USAGE" inst.components.fueled:InitializeFuelLevel(TUNING.FEATHERHAT_PERISHTIME) inst.components.fueled:SetDepletedFn(generic_perish) return inst end local function beefalo_equip(inst, owner) onequip(inst, owner) owner:AddTag("beefalo") end local function beefalo_unequip(inst, owner) onunequip(inst, owner) owner:RemoveTag("beefalo") end local function beefalo() local inst = simple() inst.components.equippable:SetOnEquip( beefalo_equip ) inst.components.equippable:SetOnUnequip( beefalo_unequip ) inst:AddComponent("insulator") inst.components.insulator.insulation = TUNING.INSULATION_LARGE inst:AddComponent("fueled") inst.components.fueled.fueltype = "USAGE" inst.components.fueled:InitializeFuelLevel(TUNING.BEEFALOHAT_PERISHTIME) inst.components.fueled:SetDepletedFn(generic_perish) return inst end local function walrus() local inst = simple() inst:AddComponent("dapperness") inst.components.dapperness.dapperness = TUNING.DAPPERNESS_LARGE inst:AddComponent("insulator") inst.components.insulator.insulation = TUNING.INSULATION_MED inst:AddComponent("fueled") inst.components.fueled.fueltype = "USAGE" inst.components.fueled:InitializeFuelLevel(TUNING.WALRUSHAT_PERISHTIME) inst.components.fueled:SetDepletedFn(generic_perish) return inst end local function miner_turnon(inst) local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner if inst.components.fueled:IsEmpty() then if owner then onequip(inst, owner, "hat_miner_off") end else if owner then onequip(inst, owner) end inst.components.fueled:StartConsuming() inst.SoundEmitter:PlaySound("dontstarve/common/minerhatAddFuel") inst.Light:Enable(true) end end local function miner_turnoff(inst, ranout) if inst.components.equippable and inst.components.equippable:IsEquipped() then local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner if owner then onequip(inst, owner, "hat_miner_off") end end inst.components.fueled:StopConsuming() inst.SoundEmitter:PlaySound("dontstarve/common/minerhatOut") inst.Light:Enable(false) end local function miner_equip(inst, owner) miner_turnon(inst) end local function miner_unequip(inst, owner) onunequip(inst, owner) miner_turnoff(inst) end local function miner_perish(inst) local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner if owner then owner:PushEvent("torchranout", {torch = inst}) end miner_turnoff(inst) end local function miner_drop(inst) miner_turnoff(inst) end local function miner_takefuel(inst) if inst.components.equippable and inst.components.equippable:IsEquipped() then miner_turnon(inst) end end local function miner() local inst = simple() inst.entity:AddSoundEmitter() local light = inst.entity:AddLight() light:SetFalloff(0.4) light:SetIntensity(.7) light:SetRadius(2.5) light:SetColour(180/255, 195/255, 150/255) light:Enable(false) inst.components.inventoryitem:SetOnDroppedFn( miner_drop ) inst.components.equippable:SetOnEquip( miner_equip ) inst.components.equippable:SetOnUnequip( miner_unequip ) inst:AddComponent("fueled") inst.components.fueled.fueltype = "CAVE" inst.components.fueled:InitializeFuelLevel(TUNING.MINERHAT_LIGHTTIME) inst.components.fueled:SetDepletedFn(miner_perish) inst.components.fueled.ontakefuelfn = miner_takefuel inst.components.fueled.accepting = true return inst end local function spider_disable(inst) if inst.updatetask then inst.updatetask:Cancel() inst.updatetask = nil end local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner if owner and owner.components.leader then owner:RemoveTag("monster") for k,v in pairs(owner.components.leader.followers) do if k:HasTag("spider") and k.components.combat then k.components.combat:SuggestTarget(owner) end end owner.components.leader:RemoveFollowersByTag("spider") end end local function spider_update(inst) local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner if owner and owner.components.leader then owner.components.leader:RemoveFollowersByTag("pig") local x,y,z = owner.Transform:GetWorldPosition() local ents = TheSim:FindEntities(x,y,z, TUNING.SPIDERHAT_RANGE, {"spider"}) for k,v in pairs(ents) do if v.components.follower and not v.components.follower.leader and not owner.components.leader:IsFollower(v) and owner.components.leader.numfollowers < 10 then owner.components.leader:AddFollower(v) end end end end local function spider_enable(inst) local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner if owner and owner.components.leader then owner.components.leader:RemoveFollowersByTag("pig") owner:AddTag("monster") end inst.updatetask = inst:DoPeriodicTask(0.5, spider_update, 1) end local function spider_equip(inst, owner) onequip(inst, owner) spider_enable(inst) end local function spider_unequip(inst, owner) onunequip(inst, owner) spider_disable(inst) end local function spider_perish(inst) spider_disable(inst) inst:Remove() end local function top() local inst = simple() inst:AddComponent("dapperness") inst.components.dapperness.dapperness = TUNING.DAPPERNESS_MED inst:AddComponent("fueled") inst.components.fueled.fueltype = "USAGE" inst.components.fueled:InitializeFuelLevel(TUNING.TOPHAT_PERISHTIME) inst.components.fueled:SetDepletedFn(generic_perish) return inst end local function spider() local inst = simple() inst:AddComponent("dapperness") inst.components.dapperness.dapperness = -TUNING.DAPPERNESS_SMALL inst.components.inventoryitem:SetOnDroppedFn( spider_disable ) inst.components.equippable:SetOnEquip( spider_equip ) inst.components.equippable:SetOnUnequip( spider_unequip ) inst:AddComponent("fueled") inst.components.fueled.fueltype = "SPIDERHAT" inst.components.fueled:InitializeFuelLevel(TUNING.SPIDERHAT_PERISHTIME) inst.components.fueled:SetDepletedFn(spider_perish) return inst end local function stopusingbush(inst, data) local hat = inst.components.inventory and inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HEAD) if hat and not (data.statename == "hide_idle" or data.statename == "hide") then hat.components.useableitem:StopUsingItem() end end local function onequipbush(inst, owner) owner.AnimState:OverrideSymbol("swap_hat", fname, "swap_hat") owner.AnimState:Show("HAT") owner.AnimState:Show("HAT_HAIR") owner.AnimState:Hide("HAIR_NOHAT") owner.AnimState:Hide("HAIR") if owner:HasTag("player") then owner.AnimState:Hide("HEAD") owner.AnimState:Show("HEAD_HAIR") end if inst.components.fueled then inst.components.fueled:StartConsuming() end inst:ListenForEvent("newstate", stopusingbush, owner) end local function onunequipbush(inst, owner) owner.AnimState:Hide("HAT") owner.AnimState:Hide("HAT_HAIR") owner.AnimState:Show("HAIR_NOHAT") owner.AnimState:Show("HAIR") if owner:HasTag("player") then owner.AnimState:Show("HEAD") owner.AnimState:Hide("HEAD_HAIR") end if inst.components.fueled then inst.components.fueled:StopConsuming() end inst:RemoveEventCallback("newstate", stopusingbush, owner) end local function onusebush(inst) local owner = inst.components.inventoryitem.owner if owner then owner.sg:GoToState("hide") end end local function bush() local inst = simple() inst:AddTag("hide") inst.components.inventoryitem.foleysound = "dontstarve/movement/foley/bushhat" inst:AddComponent("useableitem") inst.components.useableitem:SetOnUseFn(onusebush) inst.components.equippable:SetOnEquip( onequipbush ) inst.components.equippable:SetOnUnequip( onunequipbush ) return inst end local function flower() local inst = simple() inst:AddComponent("dapperness") inst.components.dapperness.dapperness = TUNING.DAPPERNESS_TINY --[[ inst:AddComponent("edible") inst.components.edible.healthvalue = TUNING.HEALING_SMALL inst.components.edible.hungervalue = 0 inst.components.edible.sanityvalue = TUNING.SANITY_SMALL inst.components.edible.foodtype = "VEGGIE" --]] inst:AddTag("show_spoilage") inst:AddComponent("perishable") inst.components.perishable:SetPerishTime(TUNING.PERISH_FAST) inst.components.perishable:StartPerishing() inst.components.perishable:SetOnPerishFn(generic_perish) inst.components.equippable:SetOnEquip( opentop_onequip ) return inst end local function slurtle() local inst = simple() inst:AddComponent("armor") inst.components.armor:InitCondition(TUNING.ARMOR_SLURTLEHAT, TUNING.ARMOR_SLURTLEHAT_ABSORPTION) return inst end local fn = nil local prefabs = nil if name == "bee" then fn = bee elseif name == "top" then fn = top elseif name == "feather" then fn = feather elseif name == "football" then fn = football elseif name == "flower" then fn = flower elseif name == "spider" then fn = spider elseif name == "miner" then fn = miner prefabs = { "strawhat", } elseif name == "earmuffs" then fn = earmuffs elseif name == "winter" then fn = winter elseif name == "beefalo" then fn = beefalo elseif name == "bush" then fn = bush elseif name == "walrus" then fn = walrus elseif name == "slurtle" then fn = slurtle elseif name == "ruins" then prefabs = {"forcefieldfx"} fn = ruins end return Prefab( "common/inventory/"..prefabname, fn or simple, assets, prefabs) end return MakeHat("straw"), MakeHat("top"), MakeHat("beefalo"), MakeHat("feather"), MakeHat("bee"), MakeHat("miner"), MakeHat("spider"), MakeHat("football"), MakeHat("earmuffs"), MakeHat("winter"), MakeHat("bush"), MakeHat("flower"), MakeHat("walrus"), MakeHat("slurtle"), MakeHat("ruins")
#!/usr/bin/env tarantool uuid = require('uuid'); box.cfg { listen = '0.0.0.0:3333' } box.once('init', function() box.schema.user.grant('guest', 'read,write,execute', 'universe') local mapping_space = box.schema.create_space('mapping') mapping_space:format({ {name='resource_id', type='unsigned'}, {name='client_address', type='string'}, {name='private_key', type='string'}, {name='funding_address', type='string'}, {name='uuid', type='string'}, {name='created_at', type='unsigned'}, {name='recheck_at', type='unsigned'}, {name='expired_at', type='unsigned'}, {name='tx', type='string'}, }) mapping_space:create_index('primary', {type = 'tree', parts = {1, 'unsigned'}}) -- mapping_space:create_index('active', {type = 'tree', unique = false, parts = {2, 'unsigned', 4, 'str'}}) -- mapping_space:create_index('address', {type = 'tree', unique = false, parts = {2, 'unsigned', 7, 'str'}}) -- mapping_space:create_index('unique', {type = 'tree', unique = true, parts = {5, 'str', 7, 'str'}}) -- mapping_space:create_index('resource',{type = 'tree', unique = false, parts = {2, 'unsigned'}}) -- mapping_space:create_index('uuid', {type = 'hash', parts = {8, 'str'}}) mapping_space:create_index('expired', { type = 'tree', unique = false, parts={9, 'unsigned'}}) -- mapping_space:create_index('address', {type = 'tree', unique = false, parts = {2, 'unsigned', 7, 'str'}}) mapping_space:create_index('unique', {type = 'tree', unique = true, parts = {3, 'str', 5, 'str'}}) -- mapping_space:create_index('resource',{type = 'tree', unique = false, parts = {2, 'unsigned'}}) mapping_space:create_index('uuid', {type = 'hash', parts = {6, 'str'}}) local resource_space = box.schema.create_space('resource') resource_space:create_index('primary', {type = 'tree', parts = {1, 'unsigned'}}) resource_space:create_index('uuid', {type = 'hash', parts = {2, 'str'}}) resource_space:create_index('name', {type = 'tree', unique = true, parts = {3, 'str'}}) resource_space:format({ {name='id', type='unsigned'}, {name='uuid', type='string'}, {name='name', type='string'}, {name='description', type='string'}, {name='contract_address', type='string'}, {name='network_name', type='string'}, {name='active', type='bool'}, }) end) box.once("db_version:0.1", function() local account_space = box.schema.create_space('account') account_space:create_index('primary', {type = 'tree', parts = {1, 'unsigned'}}) account_space:create_index('uuid', {type = 'hash', parts = {3, 'str'}}) account_space:create_index('address', {type = 'tree', unique = false, parts = {4, 'str'}}) account_space:create_index('email', {type = 'tree', unique = true, parts = {5, 'str'}}) account_space:format({ {name='id', type='unsigned'}, {name='resource_id', type='unsigned'}, {name='uuid', type='string'}, {name='address',type='string'}, {name='email', type='string'}, {name='name', type='string'}, {name='created_at', type='unsigned'}, {name='active', type='bool'}, }) end) box.once("db_version:0.2", function () box.space.account.index.address:alter({type = 'tree', unique = false, parts = {4, 'str'}}) end) function get_client(client_uuid) local result = box.space.mapping.index.uuid:select({client_uuid}) if #result > 0 then return ({ ["client_address"]=result[1][3], ["funding_address"]=result[1][5], ["uuid"]=result[1][6], }) end end function get_client_by_addresses(target_address, funding_address) local result = box.space.mapping.index.unique:select({target_address, funding_address}) if #result > 0 then return ({ ["client_address"]=result[1][3], ["funding_address"]=result[1][5], ["uuid"]=result[1][6], }) end end function get_account(account_uuid) local result = box.space.account.index.uuid:select(client_uuid) if #result > 0 then return ({ ["uuid"]=result[1][3], ["resource"]=get_resource(result[1][2]), }) end end function get_account_by_email(email) local result = box.space.account.index.email:select(email) if #result > 0 then return ({ ["uuid"]=result[1][3], ["resource"]=get_resource(result[1][2]), }) end end function register_resource(name, description, contract_address, network_name) print("Create resource", name, description, contract_address, network_name) local resource_uuid = uuid.str() local result = box.space.resource.index.name:select({name}) if #result > 0 then return result[1] end if network_name ~= 'ropsten' and network_name ~= 'mainnet' and network_name ~= 'rinkeby' and network_name ~= 'kovan' then return error("wrong network_name") end return box.space.resource:auto_increment({resource_uuid, name, description, contract_address, network_name, t}) end function get_resource( resource_id ) local resource = box.space.resource.index.primary:select({resource_id})[1] return { ["uuid"]=resource[2], ["name"]=resource[3], ["description"]=resource[4], ["address"]=resource[5], ["network_type"]=resource[6], } end function assign_tx_id(uuid, tx_id) mapping_id = box.space.mapping.index.uuid:select(uuid)[1][1] box.space.mapping:update(mapping_id, {{'=', 10, tx_id}}) end function update_recheck(uuid, period) mapping = box.space.mapping.index.uuid:select(uuid)[1] local created_at = mapping[7] local recheck_at = mapping[8] box.space.mapping:update(mapping[1], {{'=', 8, created_at + period * (((recheck_at - created_at) / period) + 1)}}) end function get_mappings() local mappings = {} local results = box.space.mapping.index.expired:select({os.time()}, {iterator = 'GE'}) if #results == 0 then return {} end local index = 1 for i = 1, #results do if results[i][8] < os.time() and results[i][10] == nil then local resource_id = results[i][2] local resource = get_resource(resource_id) mappings[index] = { ["resource"]=resource, ["client_address"]=results[i][3], ["private_key"]=results[i][4], ["funding_address"]=results[i][5], ["uuid"]=results[i][6], } index = index + 1 end end return mappings end function register_client(resource_uuid, target_address, private_key, funding_address, expired_at) print("Get mapping ETH", resource_uuid, target_address, private_key, funding_address, expired_at) local result = box.space.resource.index.uuid:select({resource_uuid}) if #result == 0 then return end local resource_id = result[1][1] local client_uuid = uuid.str() result = get_client_by_addresses(target_address, funding_address) if result then return result end box.space.mapping:auto_increment({resource_id, target_address, private_key, funding_address, client_uuid, os.time(), os.time(), expired_at, nil}) return get_client(client_uuid) end function create_account(resource_uuid, target_address, email, name) print("Create account", resource_uuid, target_address, email, name) local result = box.space.resource.index.uuid:select({resource_uuid}) if #result == 0 then return end local resource_id = result[1][1] local client_uuid = uuid.str() result = get_account_by_email(email) if result then return result end box.space.account:auto_increment({resource_id, client_uuid, target_address, email, name, os.time()}) return get_account(client_uuid) end
local M = {} local defaults = require "formatter.defaults" local util = require "formatter.util" M.jsbeautify = util.copyf(defaults.jsbeautify) M.prettydiff = util.withl(defaults.prettydiff, "javascript") M.prettier = util.copyf(defaults.prettier) M.prettierd = util.copyf(defaults.prettierd) M.denofmt = util.copyf(defaults.denofmt) function M.jq() return { exe = "jq", args = ".", } end function M.fixjson() return { exe = "fixjson", args = { "--stdin-filename", util.get_current_buffer_file_name() }, stdin = true, try_node_modules = true, } end return M
local noxy_trees = {} local mathfloor = math.floor local mathceil = math.ceil noxy_trees.disabled = { -- Disables the spreading of these specific entities. ["dead-dry-hairy-tree"] = true, ["dead-grey-trunk"] = true, ["dead-tree"] = true, ["dead-tree-desert"] = true, ["dry-hairy-tree"] = true, ["dry-tree"] = true, ["green-coral"] = true, -- Angels Bio Processings special trees. ["temperate-tree"] = true, ["swamp-tree"] = true, ["desert-tree"] = true, ["temperate-garden"] = true, ["swamp-garden"] = true, ["desert-garden"] = true, ["puffer-nest"] = true, } noxy_trees.degradable = { -- The floor tiles that can be degraded and into what. -- Vanilla tiles 0.18 ["refined-concrete"] = "concrete", ["refined-hazard-concrete-left"] = "refined-concrete", ["refined-hazard-concrete-right"] = "refined-concrete", ["red-refined-concrete"] = "refined-concrete", ["green-refined-concrete"] = "refined-concrete", ["blue-refined-concrete"] = "refined-concrete", ["orange-refined-concrete"] = "refined-concrete", ["yellow-refined-concrete"] = "refined-concrete", ["pink-refined-concrete"] = "refined-concrete", ["purple-refined-concrete"] = "refined-concrete", ["black-refined-concrete"] = "refined-concrete", ["brown-refined-concrete"] = "refined-concrete", ["cyan-refined-concrete"] = "refined-concrete", ["acid-refined-concrete"] = "refined-concrete", -- Vanilla tiles ["concrete"] = "stone-path", ["stone-path"] = true, ["hazard-concrete-left"] = "stone-path", ["hazard-concrete-right"] = "stone-path", ["lab-dark-1"] = "concrete", ["lab-dark-2"] = "concrete", -- More Floors 0.15 ["alien-metal"] = "circuit-floor", ["express-arrow-grate"] = "concrete", ["express-arrow-grate-right"] = "concrete", ["express-arrow-grate-down"] = "concrete", ["express-arrow-grate-left"] = "concrete", ["fast-arrow-grate"] = "concrete", ["fast-arrow-grate-right"] = "concrete", ["fast-arrow-grate-down"] = "concrete", ["fast-arrow-grate-left"] = "concrete", ["nitinol-arrow-grate"] = "concrete", ["nitinol-arrow-grate-right"] = "concrete", ["nitinol-arrow-grate-down"] = "concrete", ["nitinol-arrow-grate-left"] = "concrete", ["titanium-arrow-grate"] = "concrete", ["titanium-arrow-grate-right"] = "concrete", ["titanium-arrow-grate-down"] = "concrete", ["titanium-arrow-grate-left"] = "concrete", ["arrow-grate"] = "concrete", ["arrow-grate-right"] = "concrete", ["arrow-grate-down"] = "concrete", ["arrow-grate-left"] = "concrete", ["asphalt"] = "concrete", ["checkerboard"] = "stone-path", ["circuit-floor"] = "concrete", ["mf-concrete-blue"] = "concrete", ["mf-concrete-darkgrey"] = "concrete", ["mf-concrete-gold"] = "concrete", ["mf-concrete-green"] = "concrete", ["mf-concrete-limegreen"] = "concrete", ["mf-concrete-magenta"] = "concrete", ["mf-concrete-orange"] = "concrete", ["mf-concrete-pink"] = "concrete", ["mf-concrete-purple"] = "concrete", ["mf-concrete-red"] = "concrete", ["mf-concrete-skyblue"] = "concrete", ["mf-concrete-white"] = "concrete", ["mf-concrete-yellow"] = "concrete", ["mf-concrete-black"] = "concrete", ["cobblestone"] = true, ["decal1"] = "stone-path", ["decal2"] = "stone-path", ["decal3"] = "stone-path", ["decal4"] = "stone-path", ["diamond-plate"] = "concrete", ["mf_dirt_dark"] = true, ["mf_dirt"] = true, ["dirt_dark_blueprint"] = true, ["dirt_blueprint"] = true, ["experiment"] = "stone-path", ["mf_green_grass"] = true, ["mf_grass_dry"] = true, ["mf_grass_dry_blueprint"] = true, ["mf_green_grass_blueprint"] = true, ["gravel"] = true, ["hexagonb"] = "metal-scraps", ["lava"] = true, ["metal-scraps"] = true, ["redbrick"] = true, ["reinforced-concrete"] = "concrete", ["road-line"] = "asphalt", ["road-line-right"] = "asphalt", ["road-line-down"] = "asphalt", ["road-line-left"] = "asphalt", ["rusty-metal"] = "metal-scraps", ["rusty-grate"] = "metal-scraps", ["mf_sand_dark"] = true, ["mf_sand_light"] = true, ["sand_dark_blueprint"] = true, ["sand_light_blueprint"] = true, ["smooth-concrete"] = "stone-path", ["snow"] = true, -- ["tar"] = true, -- Makes this stuff look weird (incorrect edges everywhere) -- ["toxic"] = true, -- Makes this stuff look weird (incorrect edges everywhere) ["wood-floor"] = true, ["darkwood"] = true, ["herringbone"] = true, ["yellowbrick"] = true, -- Asphalt Roads ["Arci-asphalt"] = true, ["Arci-asphalt-zebra-crossing-horizontal"] = "Arci-asphalt", ["Arci-asphalt-zebra-crossing-vertical"] = "Arci-asphalt", ["Arci-asphalt-triangle-white-up"] = "Arci-asphalt", ["Arci-asphalt-triangle-white-right"] = "Arci-asphalt", ["Arci-asphalt-triangle-white-down"] = "Arci-asphalt", ["Arci-asphalt-triangle-white-left"] = "Arci-asphalt", ["Arci-asphalt-hazard-white-right"] = "Arci-asphalt", ["Arci-asphalt-hazard-white-left"] = "Arci-asphalt", ["Arci-asphalt-hazard-yellow-right"] = "Arci-asphalt", ["Arci-asphalt-hazard-yellow-left"] = "Arci-asphalt", ["Arci-asphalt-hazard-red-right"] = "Arci-asphalt", ["Arci-asphalt-hazard-red-left"] = "Arci-asphalt", ["Arci-asphalt-hazard-blue-right"] = "Arci-asphalt", ["Arci-asphalt-hazard-blue-left"] = "Arci-asphalt", ["Arci-asphalt-hazard-green-right"] = "Arci-asphalt", ["Arci-asphalt-hazard-green-left"] = "Arci-asphalt", ["Arci-marking-white-straight-horizontal"] = "Arci-asphalt", ["Arci-marking-white-straight-vertical"] = "Arci-asphalt", ["Arci-marking-white-diagonal-left"] = "Arci-asphalt", ["Arci-marking-white-diagonal-right"] = "Arci-asphalt", ["Arci-marking-white-right-turn-up"] = "Arci-asphalt", ["Arci-marking-white-right-turn-right"] = "Arci-asphalt", ["Arci-marking-white-right-turn-down"] = "Arci-asphalt", ["Arci-marking-white-right-turn-left"] = "Arci-asphalt", ["Arci-marking-white-left-turn-up"] = "Arci-asphalt", ["Arci-marking-white-left-turn-right"] = "Arci-asphalt", ["Arci-marking-white-left-turn-down"] = "Arci-asphalt", ["Arci-marking-white-left-turn-left"] = "Arci-asphalt", ["Arci-marking-white-dl-straight-horizontal"] = "Arci-asphalt", ["Arci-marking-white-dl-straight-vertical"] = "Arci-asphalt", ["Arci-marking-white-dl-diagonal-left"] = "Arci-asphalt", ["Arci-marking-white-dl-diagonal-right"] = "Arci-asphalt", ["Arci-marking-white-dl-right-turn-up"] = "Arci-asphalt", ["Arci-marking-white-dl-right-turn-right"] = "Arci-asphalt", ["Arci-marking-white-dl-right-turn-down"] = "Arci-asphalt", ["Arci-marking-white-dl-right-turn-left"] = "Arci-asphalt", ["Arci-marking-white-dl-left-turn-up"] = "Arci-asphalt", ["Arci-marking-white-dl-left-turn-right"] = "Arci-asphalt", ["Arci-marking-white-dl-left-turn-down"] = "Arci-asphalt", ["Arci-marking-white-dl-left-turn-left"] = "Arci-asphalt", ["Arci-marking-yellow-straight-horizontal"] = "Arci-asphalt", ["Arci-marking-yellow-straight-vertical"] = "Arci-asphalt", ["Arci-marking-yellow-diagonal-left"] = "Arci-asphalt", ["Arci-marking-yellow-diagonal-right"] = "Arci-asphalt", ["Arci-marking-yellow-right-turn-up"] = "Arci-asphalt", ["Arci-marking-yellow-right-turn-right"] = "Arci-asphalt", ["Arci-marking-yellow-right-turn-down"] = "Arci-asphalt", ["Arci-marking-yellow-right-turn-left"] = "Arci-asphalt", ["Arci-marking-yellow-left-turn-up"] = "Arci-asphalt", ["Arci-marking-yellow-left-turn-right"] = "Arci-asphalt", ["Arci-marking-yellow-left-turn-down"] = "Arci-asphalt", ["Arci-marking-yellow-left-turn-left"] = "Arci-asphalt", ["Arci-marking-yellow-dl-straight-horizontal"] = "Arci-asphalt", ["Arci-marking-yellow-dl-straight-vertical"] = "Arci-asphalt", ["Arci-marking-yellow-dl-diagonal-left"] = "Arci-asphalt", ["Arci-marking-yellow-dl-diagonal-right"] = "Arci-asphalt", ["Arci-marking-yellow-dl-right-turn-up"] = "Arci-asphalt", ["Arci-marking-yellow-dl-right-turn-right"] = "Arci-asphalt", ["Arci-marking-yellow-dl-right-turn-down"] = "Arci-asphalt", ["Arci-marking-yellow-dl-right-turn-left"] = "Arci-asphalt", ["Arci-marking-yellow-dl-left-turn-up"] = "Arci-asphalt", ["Arci-marking-yellow-dl-left-turn-right"] = "Arci-asphalt", ["Arci-marking-yellow-dl-left-turn-down"] = "Arci-asphalt", ["Arci-marking-yellow-dl-left-turn-left"] = "Arci-asphalt", -- Dectorio ["dect-wood-floor"] = true, ["dect-concrete-grid"] = true, ["dect-stone-gravel"] = true, ["dect-iron-ore-gravel"] = true, ["dect-copper-ore-gravel"] = true, ["dect-coal-gravel"] = true, ["dect-paint-danger-left"] = "stone-path", ["dect-paint-danger-right"] = "stone-path", ["dect-paint-emergency-left"] = "stone-path", ["dect-paint-emergency-right"] = "stone-path", ["dect-paint-caution-left"] = "stone-path", ["dect-paint-caution-right"] = "stone-path", ["dect-paint-radiation-left"] = "stone-path", ["dect-paint-radiation-right"] = "stone-path", ["dect-paint-defect-left"] = "stone-path", ["dect-paint-defect-right"] = "stone-path", ["dect-paint-operations-left"] = "stone-path", ["dect-paint-operations-right"] = "stone-path", ["dect-paint-safety-left"] = "stone-path", ["dect-paint-safety-right"] = "stone-path", -- Other mods ["wood floors_brick speed"] = true, } -- Create a list for use in a filter function based of the degradable tiles. noxy_trees.tilefilter = {} for k,_ in pairs(noxy_trees.degradable) do noxy_trees.tilefilter[#noxy_trees.tilefilter + 1] = k end noxy_trees.fertility = { -- Tiles not listed here are considered non fertile (no spreading at all). -- Vanilla 0.16 ["dirt-1"] = 0.1, ["dirt-2"] = 0.15, ["dirt-3"] = 0.2, ["dirt-4"] = 0.3, ["dirt-5"] = 0.35, ["dirt-6"] = 0.4, ["dirt-7"] = 0.45, ["dry-dirt"] = 0.1, ["grass-1"] = 0.9, ["grass-2"] = 1, ["grass-3"] = 0.95, ["grass-4"] = 0.75, ["red-desert-0"] = 0.6, ["red-desert-1"] = 0.3, ["red-desert-2"] = 0.2, ["red-desert-3"] = 0.1, ["sand-1"] = 0.05, ["sand-2"] = 0.1, ["sand-3"] = 0.05, ["sand-4"] = 0.15, -- Seems to not be used / defined -- Vanilla 0.15 ["grass-medium"] = 1, -- The most fertile ["grass"] = 0.9, ["grass-dry"] = 0.75, ["dirt-dark"] = 0.45, ["dirt"] = 0.35, ["red-desert"] = 0.2, ["red-desert-dark"] = 0.15, ["sand-dark"] = 0.15, ["sand"] = 0.1, -- Alien biomes 0.15 ["grass-red"] = 1, ["grass-orange"] = 1, ["grass-yellow"] = 1, ["grass-yellow-fade"] = 0.9, ["grass-purple-fade"] = 0.9, ["grass-purple"] = 1, ["dirt-red-dark"] = 0.45, ["dirt-brown-dark"] = 0.45, ["grass-blue-fade"] = 0.9, ["grass-blue"] = 1, ["dirt-red"] = 0.35, ["dirt-brown"] = 0.35, ["dirt-tan-dark"] = 0.45, ["dirt-dull-dark"] = 0.45, ["dirt-grey-dark"] = 0.45, ["dirt-tan"] = 0.25, ["dirt-dull"] = 0.25, ["dirt-grey"] = 0.25, ["sand-red-dark"] = 0.15, ["sand-orange-dark"] = 0.15, ["sand-gold-dark"] = 0.15, ["sand-dull-dark"] = 0.1, ["sand-grey-dark"] = 0.1, ["sand-red"] = 0.1, ["sand-orange"] = 0.1, ["sand-gold"] = 0.1, ["sand-dull"] = 0.075, ["sand-grey"] = 0.075, ["snow"] = 0.25, ["volcanic-cool"] = 0.1, -- Alien biomes 0.16 ["mineral-purple-dirt-1"] = 0.45, ["mineral-purple-dirt-2"] = 0.45, ["mineral-purple-dirt-3"] = 0.45, ["mineral-purple-dirt-4"] = 0.45, ["mineral-purple-dirt-5"] = 0.45, ["mineral-purple-dirt-6"] = 0.45, ["mineral-purple-sand-1"] = 0.15, ["mineral-purple-sand-2"] = 0.15, ["mineral-purple-sand-3"] = 0.15, ["mineral-violet-dirt-1"] = 0.45, ["mineral-violet-dirt-2"] = 0.45, ["mineral-violet-dirt-3"] = 0.45, ["mineral-violet-dirt-4"] = 0.45, ["mineral-violet-dirt-5"] = 0.45, ["mineral-violet-dirt-6"] = 0.45, ["mineral-violet-sand-1"] = 0.15, ["mineral-violet-sand-2"] = 0.15, ["mineral-violet-sand-3"] = 0.15, ["mineral-red-dirt-1"] = 0.45, ["mineral-red-dirt-2"] = 0.45, ["mineral-red-dirt-3"] = 0.45, ["mineral-red-dirt-4"] = 0.45, ["mineral-red-dirt-5"] = 0.45, ["mineral-red-dirt-6"] = 0.45, ["mineral-red-sand-1"] = 0.15, ["mineral-red-sand-2"] = 0.15, ["mineral-red-sand-3"] = 0.15, ["mineral-brown-dirt-1"] = 0.45, ["mineral-brown-dirt-2"] = 0.45, ["mineral-brown-dirt-3"] = 0.45, ["mineral-brown-dirt-4"] = 0.45, ["mineral-brown-dirt-5"] = 0.45, ["mineral-brown-dirt-6"] = 0.45, ["mineral-brown-sand-1"] = 0.15, ["mineral-brown-sand-2"] = 0.15, ["mineral-brown-sand-3"] = 0.15, ["mineral-tan-dirt-1"] = 0.45, ["mineral-tan-dirt-2"] = 0.45, ["mineral-tan-dirt-3"] = 0.45, ["mineral-tan-dirt-4"] = 0.45, ["mineral-tan-dirt-5"] = 0.45, ["mineral-tan-dirt-6"] = 0.45, ["mineral-tan-sand-1"] = 0.15, ["mineral-tan-sand-2"] = 0.15, ["mineral-tan-sand-3"] = 0.15, ["mineral-aubergine-dirt-1"] = 0.45, ["mineral-aubergine-dirt-2"] = 0.45, ["mineral-aubergine-dirt-3"] = 0.45, ["mineral-aubergine-dirt-4"] = 0.45, ["mineral-aubergine-dirt-5"] = 0.45, ["mineral-aubergine-dirt-6"] = 0.45, ["mineral-aubergine-sand-1"] = 0.15, ["mineral-aubergine-sand-2"] = 0.15, ["mineral-aubergine-sand-3"] = 0.15, ["mineral-dustyrose-dirt-1"] = 0.45, ["mineral-dustyrose-dirt-2"] = 0.45, ["mineral-dustyrose-dirt-3"] = 0.45, ["mineral-dustyrose-dirt-4"] = 0.45, ["mineral-dustyrose-dirt-5"] = 0.45, ["mineral-dustyrose-dirt-6"] = 0.45, ["mineral-dustyrose-sand-1"] = 0.15, ["mineral-dustyrose-sand-2"] = 0.15, ["mineral-dustyrose-sand-3"] = 0.15, ["mineral-beige-dirt-1"] = 0.45, ["mineral-beige-dirt-2"] = 0.45, ["mineral-beige-dirt-3"] = 0.45, ["mineral-beige-dirt-4"] = 0.45, ["mineral-beige-dirt-5"] = 0.45, ["mineral-beige-dirt-6"] = 0.45, ["mineral-beige-sand-1"] = 0.15, ["mineral-beige-sand-2"] = 0.15, ["mineral-beige-sand-3"] = 0.15, ["mineral-cream-dirt-1"] = 0.45, ["mineral-cream-dirt-2"] = 0.45, ["mineral-cream-dirt-3"] = 0.45, ["mineral-cream-dirt-4"] = 0.45, ["mineral-cream-dirt-5"] = 0.45, ["mineral-cream-dirt-6"] = 0.45, ["mineral-cream-sand-1"] = 0.15, ["mineral-cream-sand-2"] = 0.15, ["mineral-cream-sand-3"] = 0.15, ["mineral-black-dirt-1"] = 0.45, ["mineral-black-dirt-2"] = 0.45, ["mineral-black-dirt-3"] = 0.45, ["mineral-black-dirt-4"] = 0.45, ["mineral-black-dirt-5"] = 0.45, ["mineral-black-dirt-6"] = 0.45, ["mineral-black-sand-1"] = 0.15, ["mineral-black-sand-2"] = 0.15, ["mineral-black-sand-3"] = 0.15, ["mineral-grey-dirt-1"] = 0.45, ["mineral-grey-dirt-2"] = 0.45, ["mineral-grey-dirt-3"] = 0.45, ["mineral-grey-dirt-4"] = 0.45, ["mineral-grey-dirt-5"] = 0.45, ["mineral-grey-dirt-6"] = 0.45, ["mineral-grey-sand-1"] = 0.15, ["mineral-grey-sand-2"] = 0.15, ["mineral-grey-sand-3"] = 0.15, ["mineral-white-dirt-1"] = 0.45, ["mineral-white-dirt-2"] = 0.45, ["mineral-white-dirt-3"] = 0.45, ["mineral-white-dirt-4"] = 0.45, ["mineral-white-dirt-5"] = 0.45, ["mineral-white-dirt-6"] = 0.45, ["mineral-white-sand-1"] = 0.15, ["mineral-white-sand-2"] = 0.15, ["mineral-white-sand-3"] = 0.15, ["vegetation-turquoise-grass-1"] = 0.95, ["vegetation-turquoise-grass-2"] = 0.95, ["vegetation-green-grass-1"] = 1, ["vegetation-green-grass-2"] = 1, ["vegetation-green-grass-3"] = 1, ["vegetation-green-grass-4"] = 1, ["vegetation-olive-grass-1"] = 1, ["vegetation-olive-grass-2"] = 1, ["vegetation-yellow-grass-1"] = 0.85, ["vegetation-yellow-grass-2"] = 0.85, ["vegetation-orange-grass-1"] = 0.85, ["vegetation-orange-grass-2"] = 0.85, ["vegetation-red-grass-1"] = 0.85, ["vegetation-red-grass-2"] = 0.85, ["vegetation-violet-grass-1"] = 0.95, ["vegetation-violet-grass-2"] = 0.95, ["vegetation-purple-grass-1"] = 0.95, ["vegetation-purple-grass-2"] = 0.95, ["vegetation-mauve-grass-1"] = 0.95, ["vegetation-mauve-grass-2"] = 0.95, ["vegetation-blue-grass-1"] = 0.95, ["vegetation-blue-grass-2"] = 0.95, ["volcanic-orange-heat-1"] = 0.05, ["volcanic-orange-heat-2"] = 0.05, ["volcanic-orange-heat-3"] = 0.05, ["volcanic-orange-heat-4"] = 0.05, ["volcanic-green-heat-1"] = 0.15, ["volcanic-green-heat-2"] = 0.15, ["volcanic-green-heat-3"] = 0.15, ["volcanic-green-heat-4"] = 0.15, ["volcanic-blue-heat-1"] = 0.05, ["volcanic-blue-heat-2"] = 0.05, ["volcanic-blue-heat-3"] = 0.05, ["volcanic-blue-heat-4"] = 0.05, ["volcanic-purple-heat-1"] = 0.05, ["volcanic-purple-heat-2"] = 0.05, ["volcanic-purple-heat-3"] = 0.05, ["volcanic-purple-heat-4"] = 0.05, ["frozen-snow-0"] = 0.5, ["frozen-snow-1"] = 0.5, ["frozen-snow-2"] = 0.5, ["frozen-snow-3"] = 0.5, ["frozen-snow-4"] = 0.5, ["frozen-snow-5"] = 0.5, ["frozen-snow-6"] = 0.5, ["frozen-snow-7"] = 0.5, ["frozen-snow-8"] = 0.5, ["frozen-snow-9"] = 0.5, } noxy_trees.deathselector = { "dead-grey-trunk", "dry-hairy-tree", "dead-tree-desert" } noxy_trees.dead = { ["dry-tree"] = true, ["dry-hairy-tree"] = "dead-dry-hairy-tree", ["dead-grey-trunk"] = "dry-tree", ["dead-dry-hairy-tree"] = true, ["dead-tree-desert"] = "dry-tree", } noxy_trees.alive = { "tree-01", "tree-01", "tree-02-red", "tree-03", "tree-04", "tree-05", "tree-06", "tree-06-brown", "tree-07", "tree-08", "tree-08-brown", "tree-08-red", "tree-09", "tree-09-brown", "tree-09-red", -- Alien Biomes "tree-wetland-a", "tree-wetland-b", "tree-wetland-c", "tree-wetland-d", "tree-wetland-e", "tree-wetland-f", "tree-wetland-g", "tree-wetland-h", "tree-wetland-i", "tree-wetland-j", "tree-wetland-k", "tree-wetland-l", "tree-wetland-m", "tree-wetland-n", "tree-wetland-o", "tree-grassland-a", "tree-grassland-b", "tree-grassland-c", "tree-grassland-d", "tree-grassland-e", "tree-grassland-f", "tree-grassland-g", "tree-grassland-h", "tree-grassland-h2", "tree-grassland-h3", "tree-grassland-i", "tree-grassland-k", "tree-grassland-l", "tree-grassland-m", "tree-grassland-n", "tree-grassland-0", "tree-grassland-p", "tree-grassland-q", "tree-dryland-a", "tree-dryland-b", "tree-dryland-c", "tree-dryland-d", "tree-dryland-e", "tree-dryland-f", "tree-dryland-g", "tree-dryland-h", "tree-dryland-i", "tree-dryland-j", "tree-dryland-k", "tree-dryland-l", "tree-dryland-m", "tree-dryland-n", "tree-dryland-o", "tree-desert-a", "tree-desert-b", "tree-desert-c", "tree-desert-d", "tree-desert-e", "tree-desert-f", "tree-desert-g", "tree-desert-h", "tree-desert-i", "tree-desert-j", "tree-desert-k", "tree-desert-l", "tree-desert-m", "tree-desert-n", "tree-snow-a", "tree-volcanic-a" } local function round(num, numDecimalPlaces) local mult = 10^(numDecimalPlaces or 0) return mathfloor(num * mult + 0.5) / mult end local function cache_forces() for _, force in pairs(game.forces) do if #force.players > 0 then global.forces[#global.forces + 1] = force.name end end end local function initialize() global.chunks = {} global.chunkindex = 0 global.surfaces = {1} global.last_surface = nil global.forces = {} global.tick = 0 global.rng = game.create_random_generator() global.chunkcycles = 0 global.spawnedcount = 0 global.deadedcount = 0 global.killedcount = 0 global.degradedcount = 0 global.resurrected = 0 global.lastdebugmessage = 0 global.lasttotalchunks = 0 cache_forces() end local config = {} local function cache_settings() config.enabled = settings.global["Noxys_Trees-enabled"].value config.debug = settings.global["Noxys_Trees-debug"].value config.debug_interval = settings.global["Noxys_Trees-debug-interval"].value config.degrade_tiles = settings.global["Noxys_Trees-degrade-tiles"].value config.overpopulation_kills_trees = settings.global["Noxys_Trees-overpopulation-kills-trees"].value config.kill_trees_near_unwanted = settings.global["Noxys_Trees-kill-trees-near-unwanted"].value config.ticks_between_operations = settings.global["Noxys_Trees-ticks-between-operations"].value config.chunks_per_operation = settings.global["Noxys_Trees-chunks-per-operation"].value config.chunks_per_operation_enable_scaling = settings.global["Noxys_Trees-chunks-per-operation-enable-scaling"].value config.chunks_per_operation_scaling_bias = settings.global["Noxys_Trees-chunks-per-operation-scaling-bias"].value config.minimum_distance_between_tree = settings.global["Noxys_Trees-minimum-distance-between-tree"].value config.minimum_distance_to_enemies = settings.global["Noxys_Trees-minimum-distance-to-enemies"].value config.minimum_distance_to_uranium = settings.global["Noxys_Trees-minimum-distance-to-uranium"].value config.minimum_distance_to_player_entities = settings.global["Noxys_Trees-minimum-distance-to-player-entities"].value config.minimum_distance_to_degradetiles = settings.global["Noxys_Trees-minimum-distance-to-degradeable-tiles"].value config.deaths_by_lack_of_fertility_minimum = settings.global["Noxys_Trees-deaths-by-lack-of-fertility-minimum"].value config.deaths_by_pollution_bias = settings.global["Noxys_Trees-deaths-by-pollution-bias"].value config.trees_to_grow_per_chunk_percentage = settings.global["Noxys_Trees-trees-to-grow-per-chunk-percentage"].value config.maximum_trees_per_chunk = settings.global["Noxys_Trees-maximum-trees-per-chunk"].value config.expansion_distance = settings.global["Noxys_Trees-expansion-distance"].value end cache_settings() local function nx_debug(message) if config.debug then game.print("NX Debug: " .. message) end end local function get_trees_in_chunk(surface, chunk) return surface.find_entities_filtered{area = {{ chunk.x * 32, chunk.y * 32}, {chunk.x * 32 + 32, chunk.y * 32 + 32}}, type = "tree"} end local function deadening_tree(surface, tree) if noxy_trees.dead[tree.name] then if noxy_trees.dead[tree.name] == true then tree.die() global.killedcount = global.killedcount + 1 else surface.create_entity{name = noxy_trees.dead[tree.name], position = tree.position} tree.die() global.deadedcount = global.deadedcount + 1 end else local deadtree = noxy_trees.deathselector[global.rng(1, #noxy_trees.deathselector)] surface.create_entity{name = deadtree, position = tree.position} tree.die() global.deadedcount = global.deadedcount + 1 end end local function spawn_trees(surface, parent, tilestoupdate, newpos) if noxy_trees.disabled[parent.name] then return end if not newpos then local distance = config.expansion_distance newpos = { parent.position.x + global.rng(distance * 2) - distance + (global.rng() - 0.5), parent.position.y + global.rng(distance * 2) - distance + (global.rng() - 0.5), } end local tile = surface.get_tile(newpos[1], newpos[2]) if tile and tile.valid == true then -- Tile degradation if config.degrade_tiles and noxy_trees.degradable[tile.name] then if noxy_trees.degradable[tile.name] == true then if tile.hidden_tile then tilestoupdate[#tilestoupdate + 1] = {["name"] = tile.hidden_tile, ["position"] = tile.position} else nx_debug("ERROR: Can't degrade tile because no hidden_tile: " .. tile.name) end else if game.tile_prototypes[noxy_trees.degradable[tile.name]] then tilestoupdate[#tilestoupdate + 1] = {["name"] = noxy_trees.degradable[tile.name], ["position"] = tile.position} else nx_debug("ERROR: Invalid tile?: " .. noxy_trees.degradable[tile.name] .. " Tried to convert from: " .. tile.name) end end elseif -- Tree spreading (noxy_trees.fertility[tile.name] or 0) > 0 and not noxy_trees.dead[parent.name] and -- Stop dead trees from spreading. noxy_trees.fertility[tile.name] > global.rng() and surface.can_place_entity{name = parent.name, position = newpos} then local r = config.minimum_distance_between_tree / noxy_trees.fertility[tile.name] if surface.count_entities_filtered{position = newpos, radius = r, type = "tree", limit = 1} > 0 then return end local rp = config.minimum_distance_to_player_entities if rp > 0 then for _, force in pairs(game.forces) do if #force.players > 0 then if surface.count_entities_filtered{position = newpos, radius = rp, force = force, limit = 1} > 0 then return end end end end local er = config.minimum_distance_to_enemies if surface.count_entities_filtered{position = newpos, radius = er, type = "unit-spawner", force = "enemy", limit = 1} > 0 or surface.count_entities_filtered{position = newpos, radius = er, type = "turret", force = "enemy", limit = 1} > 0 then return end local ur = config.minimum_distance_to_uranium if surface.count_entities_filtered{position = newpos, radius = ur, type = "resource", name = "uranium-ore", limit = 1} > 0 then return end local tr = config.minimum_distance_to_degradetiles if tr > 0 then if surface.count_tiles_filtered{position = newpos, radius = tr, name = noxy_trees.tilefilter, limit = 1, has_hidden_tile = true} > 0 then return end end surface.create_entity{name = parent.name, position = newpos} global.spawnedcount = global.spawnedcount + 1 elseif -- Tree resurrections (noxy_trees.fertility[tile.name] or 0) > 0 and noxy_trees.dead[parent.name] and noxy_trees.fertility[tile.name] > global.rng() then -- Only if polution is low enough we do a resurrect (which can also be seen as a mutation) if surface.get_pollution{parent.position.x, parent.position.y} / config.deaths_by_pollution_bias < 1 + global.rng() then -- We can skip the distance checks here since the parent tree already exists and we are just going to replace that one. local newname = noxy_trees.combined[global.rng(#noxy_trees.combined)] newpos = parent.position parent.destroy() surface.create_entity{name = newname, position = newpos} global.resurrected = global.resurrected + 1 end end end end local function process_chunk(surface, chunk) if not chunk then return end local tilestoupdate = {} local trees = get_trees_in_chunk(surface, chunk) local trees_count = #trees if trees_count >= config.maximum_trees_per_chunk then if config.overpopulation_kills_trees then local tokill = 1 + (trees_count / config.maximum_trees_per_chunk) repeat local tree = trees[global.rng(1, trees_count)] if tree and tree.valid == true then deadening_tree(surface, tree) end tokill = tokill - 1 until tokill < 1 end elseif trees_count > 0 then -- Grow new trees local togen = 1 + mathceil(trees_count * config.trees_to_grow_per_chunk_percentage) repeat local parent = trees[global.rng(1, trees_count)] if parent.valid then spawn_trees(surface, parent, tilestoupdate) end togen = togen - 1 until togen <= 0 end if trees_count < 1 then return end -- Check random trees for things that would kill them nearby (enemies / uranium / players / fertility) if config.kill_trees_near_unwanted then local tokill = 1 + mathceil(trees_count * config.trees_to_grow_per_chunk_percentage) if config.deaths_by_pollution_bias > 0 then tokill = tokill + mathceil(surface.get_pollution{chunk.x * 32 + 16, chunk.y * 32 + 16} / config.deaths_by_pollution_bias) end repeat local treetocheck = trees[global.rng(1, trees_count)] if treetocheck and treetocheck.valid == true then local er = config.minimum_distance_to_enemies local ur = config.minimum_distance_to_uranium if surface.count_entities_filtered{position = treetocheck.position, radius = er, type = "unit-spawner", force = "enemy", limit = 1} > 0 or surface.count_entities_filtered{position = treetocheck.position, radius = er, type = "turret", force = "enemy", limit = 1} > 0 then deadening_tree(surface, treetocheck) elseif surface.count_entities_filtered{position = treetocheck.position, radius = ur, type = "resource", name = "uranium-ore", limit = 1} > 0 then deadening_tree(surface, treetocheck) else local rp = config.minimum_distance_to_player_entities if rp > 0 then for _, force in pairs(game.forces) do if #force.players > 0 then if surface.count_entities_filtered{position = treetocheck.position, radius = rp, force = force, limit = 1} > 0 then deadening_tree(surface, treetocheck) break end end end end end end if treetocheck and treetocheck.valid == true then local tile = surface.get_tile(treetocheck.position.x, treetocheck.position.y) if tile and tile.valid == true then local fertility = 0 if noxy_trees.fertility[tile.name] then fertility = noxy_trees.fertility[tile.name] end if fertility < config.deaths_by_lack_of_fertility_minimum and fertility < global.rng() then if trees_count / config.maximum_trees_per_chunk > global.rng() then deadening_tree(surface, treetocheck) end end end end if config.deaths_by_pollution_bias > 0 then if treetocheck and treetocheck.valid == true then if surface.get_pollution{treetocheck.position.x, treetocheck.position.y} / config.deaths_by_pollution_bias > 1 + global.rng() then deadening_tree(surface, treetocheck) end end end tokill = tokill - 1 until tokill <= 0 end if #tilestoupdate > 0 then surface.set_tiles(tilestoupdate) global.degradedcount = global.degradedcount + #tilestoupdate end end script.on_configuration_changed(function() if global.noxy_trees then for k,v in pairs(global.noxy_trees) do global[k] = v end global.noxy_trees = nil end initialize() end) script.on_init(function () initialize() end) script.on_event({defines.events.on_runtime_mod_setting_changed}, cache_settings) script.on_event({defines.events.on_forces_merging, defines.events.on_player_changed_force}, cache_forces) script.on_event({defines.events.on_tick}, function(event) local global = global if config.enabled then global.tick = global.tick - 1 -- Check alive trees this should only run once if not noxy_trees.combined then noxy_trees.combined = {} for _, tree in pairs(noxy_trees.alive) do if game.entity_prototypes[tree] then noxy_trees.combined[#noxy_trees.combined + 1] = tree end end end -- Debug if config.debug then if global.lastdebugmessage + config.debug_interval < event.tick then local timegap = (event.tick - global.lastdebugmessage) / 60 if not global.chunkcycles then global.chunkcycles = 0 end nx_debug("Chunks: " .. global.chunkindex .. "/" .. #global.chunks .. "(" .. global.lasttotalchunks .. ")." .. " Grown: " .. global.spawnedcount .. " (" .. round(global.spawnedcount / timegap, 2) .. "/s)." .. " Deaded: " .. global.deadedcount .. " (" .. round(global.deadedcount / timegap, 2) .. "/s)." .. " Killed: " .. global.killedcount .. " (" .. round(global.killedcount / timegap, 2) .. "/s)." .. " Degrade: " .. global.degradedcount .. " (" .. round(global.degradedcount / timegap, 2) .. "/s)." .. " Rezzed: " .. global.resurrected .. " (" .. round(global.resurrected / timegap, 2) .. "/s)." .. " Chunk Cycle: " .. global.chunkcycles .. "." ) global.lastdebugmessage = event.tick global.spawnedcount = 0 global.deadedcount = 0 global.killedcount = 0 global.degradedcount = 0 global.resurrected = 0 end end if global.tick <= 0 or global.tick == nil then global.tick = config.ticks_between_operations -- Do the stuff local last_surface, surface_index = next(global.surfaces, global.last_surface) if surface_index then local surface = game.surfaces[surface_index] if surface and surface.valid then local chunksdone = 0 local chunkstodo = config.chunks_per_operation if config.chunks_per_operation_enable_scaling then --todo: Add cap on number of chunks per operation; maybe change the scaling so that it increases how often it runs instead of how many chunks chunkstodo = mathfloor(chunkstodo * (global.lasttotalchunks / config.chunks_per_operation_scaling_bias)) end if chunkstodo < 1 then chunkstodo = 1 end repeat if #global.chunks < 1 then -- populate our chunk array for chunk in surface.get_chunks() do global.chunks[#global.chunks + 1] = chunk end global.chunkcycles = global.chunkcycles + 1 global.lasttotalchunks = #global.chunks end if #global.chunks < 1 then nx_debug("Bailing because no chunks!") break end -- Select a chunk global.chunkindex = global.chunkindex + 1 if global.chunkindex > #global.chunks then global.chunkindex = 0 global.chunks = {} break end process_chunk(surface, global.chunks[global.chunkindex]) -- Done chunksdone = chunksdone + 1 until chunksdone >= chunkstodo end end global.last_surface = last_surface end if global.tick > config.ticks_between_operations then global.tick = config.ticks_between_operations end end end)
test_run = require('test_run').new() test_run:cmd("restart server default") -- Deploy a cluster. SERVERS = { 'autobootstrap1', 'autobootstrap2', 'autobootstrap3' } test_run:create_cluster(SERVERS, "replication", {args="0.03"}) test_run:wait_fullmesh(SERVERS) -- gh-3247 - Sequence-generated value is not replicated in case -- the request was sent via iproto. test_run:cmd("switch autobootstrap1") net_box = require('net.box') _ = box.schema.space.create('space1') _ = box.schema.sequence.create('seq') _ = box.space.space1:create_index('primary', {sequence = true} ) _ = box.space.space1:create_index('secondary', {parts = {2, 'unsigned'}}) box.schema.user.grant('guest', 'read,write', 'space', 'space1') c = net_box.connect(box.cfg.listen) c.space.space1:insert{box.NULL, "data"} -- fails, but bumps sequence value c.space.space1:insert{box.NULL, 1, "data"} box.space.space1:select{} vclock = test_run:get_vclock("autobootstrap1") vclock[0] = nil _ = test_run:wait_vclock("autobootstrap2", vclock) test_run:cmd("switch autobootstrap2") box.space.space1:select{} test_run:cmd("switch autobootstrap1") box.space.space1:drop() test_run:cmd("switch default") test_run:drop_cluster(SERVERS) test_run:cleanup_cluster()
----------------------------------------- -- ID: 5480 -- Black Mage Die -- Teaches the job ability Wizard's Roll ----------------------------------------- function onItemCheck(target) return target:canLearnAbility(tpz.jobAbility.WIZARDS_ROLL) end function onItemUse(target) target:addLearnedAbility(tpz.jobAbility.WIZARDS_ROLL) end
return { [11] = {id=11,text={key='/demo/1',text="测试1"},}, [12] = {id=12,text={key='/demo/2',text="测试2"},}, [13] = {id=13,text={key='/demo/3',text="测试3"},}, [14] = {id=14,text={key='',text=""},}, [15] = {id=15,text={key='/demo/5',text="测试5"},}, [16] = {id=16,text={key='/demo/6',text="测试6"},}, [17] = {id=17,text={key='/demo/7',text="测试7"},}, [18] = {id=18,text={key='/demo/8',text="测试8"},}, }
dofilepath("data:scripts/debug.lua") dout("Loading Crate_locate.lua of Turanic") crate_Motherships = { "tur_shipyard", } crate_Carriers = { "tur_carrier", "tur_resourcecontroller", }
local utils = require "telescope.utils" local K = {} K._get_resources = function(opts) local resource_list = utils.get_os_command_output({"kubectl", "get", opts["resource"], "-A"}) table.remove(resource_list, 1) return resource_list end K._describe_resource = function(entry, opts) local tmp_table = vim.split(entry.value, " +") if vim.tbl_isempty(tmp_table) then return { "echo", "Empty resource"} end if opts["namespaced"] == "true" then return { "kubectl", "describe", opts["resource"], tmp_table[2], "-n", tmp_table[1] } else return { "kubectl", "describe", opts["resource"], tmp_table[1] } end end K._list_api_resources = function() local resource_types = utils.get_os_command_output({"kubectl", "api-resources"}) table.remove(resource_types , 1) return resource_types end return K