diff --git a/games/aground/Aground.js b/games/aground/Aground.js new file mode 100644 index 00000000..d6cebea4 --- /dev/null +++ b/games/aground/Aground.js @@ -0,0 +1,123511 @@ +// Generated by Haxe 3.4.4 +(function ($hx_exports, $global) { "use strict"; +$hx_exports["openfl"] = $hx_exports["openfl"] || {}; +$hx_exports["lime"] = $hx_exports["lime"] || {}; +var $hxClasses = {},$estr = function() { return js_Boot.__string_rec(this,''); }; +function $extend(from, fields) { + function Inherit() {} Inherit.prototype = from; var proto = new Inherit(); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var AbstractClass = function() { }; +$hxClasses["AbstractClass"] = AbstractClass; +AbstractClass.__name__ = ["AbstractClass"]; +var ApplicationMain = function() { }; +$hxClasses["ApplicationMain"] = ApplicationMain; +ApplicationMain.__name__ = ["ApplicationMain"]; +ApplicationMain.config = null; +ApplicationMain.preloader = null; +ApplicationMain.create = function() { + var app = new openfl_display_Application(); + app.create(ApplicationMain.config); + var display = new com_davidmaletz_mining_ui_Preloader(); + ApplicationMain.preloader = new openfl_display_Preloader(display); + app.setPreloader(ApplicationMain.preloader); + ApplicationMain.preloader.onComplete.add(ApplicationMain.init); + ApplicationMain.preloader.create(ApplicationMain.config); + var urls = []; + var types = []; + urls.push("data/core/mod.xml"); + types.push("TEXT"); + urls.push("data/ui/title_full.jpg"); + types.push("IMAGE"); + urls.push("data/core/achievements.png"); + types.push("IMAGE"); + urls.push("data/core/achievements.xml"); + types.push("TEXT"); + urls.push("data/core/animals/animals.xml"); + types.push("TEXT"); + urls.push("data/core/animals/baby_dragon.png"); + types.push("IMAGE"); + urls.push("data/core/animals/baby_dragon.xml"); + types.push("TEXT"); + urls.push("data/core/animals/cat.png"); + types.push("IMAGE"); + urls.push("data/core/animals/cat.xml"); + types.push("TEXT"); + urls.push("data/core/animals/chicken.png"); + types.push("IMAGE"); + urls.push("data/core/animals/cockatiel.png"); + types.push("IMAGE"); + urls.push("data/core/animals/cockatiel.xml"); + types.push("TEXT"); + urls.push("data/core/animals/cow.png"); + types.push("IMAGE"); + urls.push("data/core/animals/owl.png"); + types.push("IMAGE"); + urls.push("data/core/animals/owl.xml"); + types.push("TEXT"); + urls.push("data/core/animals/rat.png"); + types.push("IMAGE"); + urls.push("data/core/animals/redbreast.png"); + types.push("IMAGE"); + urls.push("data/core/animals/seagull.png"); + types.push("IMAGE"); + urls.push("data/core/animals/wolf.png"); + types.push("IMAGE"); + urls.push("data/core/elements.xml"); + types.push("TEXT"); + urls.push("data/core/enemies/adult_dragon.png"); + types.push("IMAGE"); + urls.push("data/core/enemies/adult_dragon.xml"); + types.push("TEXT"); + urls.push("data/core/enemies/boar.png"); + types.push("IMAGE"); + urls.push("data/core/enemies/enemies.xml"); + types.push("TEXT"); + urls.push("data/core/enemies/explosion.png"); + types.push("IMAGE"); + urls.push("data/core/enemies/explosion.xml"); + types.push("TEXT"); + urls.push("data/core/enemies/fire.png"); + types.push("IMAGE"); + urls.push("data/core/enemies/fireball_small.png"); + types.push("IMAGE"); + urls.push("data/core/enemies/fire_bird.png"); + types.push("IMAGE"); + urls.push("data/core/enemies/fire_boar.png"); + types.push("IMAGE"); + urls.push("data/core/enemies/flame.png"); + types.push("IMAGE"); + urls.push("data/core/enemies/freeze.png"); + types.push("IMAGE"); + urls.push("data/core/enemies/ghost.png"); + types.push("IMAGE"); + urls.push("data/core/enemies/golem.png"); + types.push("IMAGE"); + urls.push("data/core/enemies/icy_wind.png"); + types.push("IMAGE"); + urls.push("data/core/enemies/shadow_cat.png"); + types.push("IMAGE"); + urls.push("data/core/enemies/shadow_cat.xml"); + types.push("TEXT"); + urls.push("data/core/enemies/smoke.png"); + types.push("IMAGE"); + urls.push("data/core/enemies/smoke.xml"); + types.push("TEXT"); + urls.push("data/core/enemies/snowball.png"); + types.push("IMAGE"); + urls.push("data/core/enemies/spider.png"); + types.push("IMAGE"); + urls.push("data/core/enemies/spider.xml"); + types.push("TEXT"); + urls.push("data/core/enemies/traps.png"); + types.push("IMAGE"); + urls.push("data/core/enemies/wyrm.png"); + types.push("IMAGE"); + urls.push("data/core/enemies/yeti.png"); + types.push("IMAGE"); + urls.push("data/core/enemies/yeti.xml"); + types.push("TEXT"); + urls.push("data/core/enemies/young_dragon.png"); + types.push("IMAGE"); + urls.push("data/core/enemies/young_dragon.xml"); + types.push("TEXT"); + urls.push("data/core/farm/cotton.png"); + types.push("IMAGE"); + urls.push("data/core/farm/farm.xml"); + types.push("TEXT"); + urls.push("data/core/farm/orchard.png"); + types.push("IMAGE"); + urls.push("data/core/farm/pumpkin.png"); + types.push("IMAGE"); + urls.push("data/core/farm/sugar.png"); + types.push("IMAGE"); + urls.push("data/core/farm/wheat.png"); + types.push("IMAGE"); + urls.push("data/core/items/armors.png"); + types.push("IMAGE"); + urls.push("data/core/items/armors.xml"); + types.push("TEXT"); + urls.push("data/core/items/arrows.png"); + types.push("IMAGE"); + urls.push("data/core/items/backpacks.png"); + types.push("IMAGE"); + urls.push("data/core/items/backpacks.xml"); + types.push("TEXT"); + urls.push("data/core/items/blueprints.xml"); + types.push("TEXT"); + urls.push("data/core/items/campfire.png"); + types.push("IMAGE"); + urls.push("data/core/items/earth_armor.png"); + types.push("IMAGE"); + urls.push("data/core/items/earth_armor.xml"); + types.push("TEXT"); + urls.push("data/core/items/equipment.xml"); + types.push("TEXT"); + urls.push("data/core/items/explosion.png"); + types.push("IMAGE"); + urls.push("data/core/items/fishing.png"); + types.push("IMAGE"); + urls.push("data/core/items/fishing.xml"); + types.push("TEXT"); + urls.push("data/core/items/food.xml"); + types.push("TEXT"); + urls.push("data/core/items/icons.png"); + types.push("IMAGE"); + urls.push("data/core/items/icons.xml"); + types.push("TEXT"); + urls.push("data/core/items/items.png"); + types.push("IMAGE"); + urls.push("data/core/items/items.xml"); + types.push("TEXT"); + urls.push("data/core/items/lantern.png"); + types.push("IMAGE"); + urls.push("data/core/items/rails.png"); + types.push("IMAGE"); + urls.push("data/core/items/shadow_cape.png"); + types.push("IMAGE"); + urls.push("data/core/items/snowman.png"); + types.push("IMAGE"); + urls.push("data/core/items/torch.png"); + types.push("IMAGE"); + urls.push("data/core/items/weps.png"); + types.push("IMAGE"); + urls.push("data/core/items/weps.xml"); + types.push("TEXT"); + urls.push("data/core/lang/en_US.xml"); + types.push("TEXT"); + urls.push("data/core/lang/fonts/drachenklaue.fnt"); + types.push("TEXT"); + urls.push("data/core/lang/fonts/drachenklaue.png"); + types.push("IMAGE"); + urls.push("data/core/lang/fonts/uni.fnt"); + types.push("TEXT"); + urls.push("data/core/lang/fonts/uni.png"); + types.push("IMAGE"); + urls.push("data/core/lang/languages.xml"); + types.push("TEXT"); + urls.push("data/core/lang/pt_BR.xml"); + types.push("TEXT"); + urls.push("data/core/lang/ru_RU.xml"); + types.push("TEXT"); + urls.push("data/core/magic1/enemies/alien.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/enemies/alien_fx.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/enemies/alien_fx.xml"); + types.push("TEXT"); + urls.push("data/core/magic1/enemies/crawler.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/enemies/elementals.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/enemies/elementals.xml"); + types.push("TEXT"); + urls.push("data/core/magic1/enemies/enemies.xml"); + types.push("TEXT"); + urls.push("data/core/magic1/enemies/fire_elemental.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/enemies/golemech.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/enemies/golemech.xml"); + types.push("TEXT"); + urls.push("data/core/magic1/enemies/icer.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/enemies/jelly.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/enemies/leech.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/enemies/leech.xml"); + types.push("TEXT"); + urls.push("data/core/magic1/enemies/magic_beam.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/enemies/magic_fx.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/enemies/magic_wyrm.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/enemies/oldone.xml"); + types.push("TEXT"); + urls.push("data/core/magic1/enemies/skyfish.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/enemies/skyfish.xml"); + types.push("TEXT"); + urls.push("data/core/magic1/enemies/tree.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/enemies/tree.xml"); + types.push("TEXT"); + urls.push("data/core/magic1/enemies/wyrm_queen.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/enemies/wyrm_queen.xml"); + types.push("TEXT"); + urls.push("data/core/magic1/items/dragarmor.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/items/dragarmor.xml"); + types.push("TEXT"); + urls.push("data/core/magic1/items/goggles.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/items/items.xml"); + types.push("TEXT"); + urls.push("data/core/magic1/items/spirit_detector.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/magic1.xml"); + types.push("TEXT"); + urls.push("data/core/magic1/npcs.xml"); + types.push("TEXT"); + urls.push("data/core/magic1/parallax/clouds.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/parallax/clouds.xml"); + types.push("TEXT"); + urls.push("data/core/magic1/parallax/mountains.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/parallax/parallax.xml"); + types.push("TEXT"); + urls.push("data/core/magic1/parallax/rocks.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/scenes/alchemist/alchemist.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/scenes/alchemist/alchemist.xml"); + types.push("TEXT"); + urls.push("data/core/magic1/scenes/alchemist/bg.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/scenes/alchemist/scene.xml"); + types.push("TEXT"); + urls.push("data/core/magic1/scenes/alien/alien.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/scenes/alien/alien.xml"); + types.push("TEXT"); + urls.push("data/core/magic1/scenes/alien/bg.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/scenes/alien/scene.xml"); + types.push("TEXT"); + urls.push("data/core/magic1/scenes/scenes.xml"); + types.push("TEXT"); + urls.push("data/core/magic1/structures/house.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/structures/ice_door.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/structures/pillar.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/structures/struc.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/structures/struc.xml"); + types.push("TEXT"); + urls.push("data/core/magic1/structures/structures.xml"); + types.push("TEXT"); + urls.push("data/core/magic1/structures/wyrm_door.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/structures/wyrm_hive.png"); + types.push("IMAGE"); + urls.push("data/core/magic1/structures/wyrm_tunnel.png"); + types.push("IMAGE"); + urls.push("data/core/music/music.xml"); + types.push("TEXT"); + urls.push("data/core/nav/nav.png"); + types.push("IMAGE"); + urls.push("data/core/nav/nav.xml"); + types.push("TEXT"); + urls.push("data/core/nav/navigation.xml"); + types.push("TEXT"); + urls.push("data/core/nav/nav_bg.png"); + types.push("IMAGE"); + urls.push("data/core/nav/nav_planet.png"); + types.push("IMAGE"); + urls.push("data/core/nav/nav_planet.xml"); + types.push("TEXT"); + urls.push("data/core/npc/alchemist.png"); + types.push("IMAGE"); + urls.push("data/core/npc/alchemist.xml"); + types.push("TEXT"); + urls.push("data/core/npc/builder.xml"); + types.push("TEXT"); + urls.push("data/core/npc/builder_dead.png"); + types.push("IMAGE"); + urls.push("data/core/npc/devs.png"); + types.push("IMAGE"); + urls.push("data/core/npc/devs.xml"); + types.push("TEXT"); + urls.push("data/core/npc/expressions.png"); + types.push("IMAGE"); + urls.push("data/core/npc/farmer.xml"); + types.push("TEXT"); + urls.push("data/core/npc/hunter.png"); + types.push("IMAGE"); + urls.push("data/core/npc/hunter.xml"); + types.push("TEXT"); + urls.push("data/core/npc/hunter_sheet.xml"); + types.push("TEXT"); + urls.push("data/core/npc/miner.xml"); + types.push("TEXT"); + urls.push("data/core/npc/npc.png"); + types.push("IMAGE"); + urls.push("data/core/npc/npcs.xml"); + types.push("TEXT"); + urls.push("data/core/npc/trader.xml"); + types.push("TEXT"); + urls.push("data/core/player/death.png"); + types.push("IMAGE"); + urls.push("data/core/player/layers.png"); + types.push("IMAGE"); + urls.push("data/core/player/layers.xml"); + types.push("TEXT"); + urls.push("data/core/player/light128.png"); + types.push("IMAGE"); + urls.push("data/core/player/light192.png"); + types.push("IMAGE"); + urls.push("data/core/player/light256.png"); + types.push("IMAGE"); + urls.push("data/core/player/light32.png"); + types.push("IMAGE"); + urls.push("data/core/player/light64.png"); + types.push("IMAGE"); + urls.push("data/core/player/player.xml"); + types.push("TEXT"); + urls.push("data/core/scenes/hunter/forest.png"); + types.push("IMAGE"); + urls.push("data/core/scenes/hunter/hunter.png"); + types.push("IMAGE"); + urls.push("data/core/scenes/hunter/hunter.xml"); + types.push("TEXT"); + urls.push("data/core/scenes/hunter/scene.xml"); + types.push("TEXT"); + urls.push("data/core/scenes/hunter/tent.png"); + types.push("IMAGE"); + urls.push("data/core/scenes/hunter/wolf.png"); + types.push("IMAGE"); + urls.push("data/core/scenes/hut/alchemist.png"); + types.push("IMAGE"); + urls.push("data/core/scenes/hut/builder.png"); + types.push("IMAGE"); + urls.push("data/core/scenes/hut/farmer.png"); + types.push("IMAGE"); + urls.push("data/core/scenes/hut/fire.png"); + types.push("IMAGE"); + urls.push("data/core/scenes/hut/hut.png"); + types.push("IMAGE"); + urls.push("data/core/scenes/hut/miner.png"); + types.push("IMAGE"); + urls.push("data/core/scenes/hut/scene.xml"); + types.push("TEXT"); + urls.push("data/core/scenes/hut/trader.png"); + types.push("IMAGE"); + urls.push("data/core/scenes/intro/intro.xml"); + types.push("TEXT"); + urls.push("data/core/scenes/intro/sheet1.png"); + types.push("IMAGE"); + urls.push("data/core/scenes/intro/sheet2.png"); + types.push("IMAGE"); + urls.push("data/core/scenes/intro/sheet3.png"); + types.push("IMAGE"); + urls.push("data/core/scenes/intro/sheet4.png"); + types.push("IMAGE"); + urls.push("data/core/scenes/scenes.xml"); + types.push("TEXT"); + urls.push("data/core/science1/enemies/bandit_combo.png"); + types.push("IMAGE"); + urls.push("data/core/science1/enemies/bandit_combo.xml"); + types.push("TEXT"); + urls.push("data/core/science1/enemies/bandit_heavy.png"); + types.push("IMAGE"); + urls.push("data/core/science1/enemies/bandit_knives.png"); + types.push("IMAGE"); + urls.push("data/core/science1/enemies/bandit_ranged.png"); + types.push("IMAGE"); + urls.push("data/core/science1/enemies/cyborg_heavy_gun.png"); + types.push("IMAGE"); + urls.push("data/core/science1/enemies/cyborg_heavy_gun.xml"); + types.push("TEXT"); + urls.push("data/core/science1/enemies/diode_wolf.png"); + types.push("IMAGE"); + urls.push("data/core/science1/enemies/enemies.xml"); + types.push("TEXT"); + urls.push("data/core/science1/enemies/lightning.png"); + types.push("IMAGE"); + urls.push("data/core/science1/enemies/lightning.xml"); + types.push("TEXT"); + urls.push("data/core/science1/enemies/minotaur.png"); + types.push("IMAGE"); + urls.push("data/core/science1/enemies/mirrows.png"); + types.push("IMAGE"); + urls.push("data/core/science1/enemies/mirrows.xml"); + types.push("TEXT"); + urls.push("data/core/science1/enemies/steel_wyrm.png"); + types.push("IMAGE"); + urls.push("data/core/science1/enemies/stinger.png"); + types.push("IMAGE"); + urls.push("data/core/science1/enemies/throwing_knife.png"); + types.push("IMAGE"); + urls.push("data/core/science1/items/bullets.png"); + types.push("IMAGE"); + urls.push("data/core/science1/items/cyborg.png"); + types.push("IMAGE"); + urls.push("data/core/science1/items/cyborg.xml"); + types.push("TEXT"); + urls.push("data/core/science1/items/cyborg_pack.png"); + types.push("IMAGE"); + urls.push("data/core/science1/items/cyborg_pack.xml"); + types.push("TEXT"); + urls.push("data/core/science1/items/drill.png"); + types.push("IMAGE"); + urls.push("data/core/science1/items/drill.xml"); + types.push("TEXT"); + urls.push("data/core/science1/items/headlamp.png"); + types.push("IMAGE"); + urls.push("data/core/science1/items/headlamp_light.png"); + types.push("IMAGE"); + urls.push("data/core/science1/items/items.xml"); + types.push("TEXT"); + urls.push("data/core/science1/npc/fisher.xml"); + types.push("TEXT"); + urls.push("data/core/science1/npc/fisherman.png"); + types.push("IMAGE"); + urls.push("data/core/science1/npc/fisherman.xml"); + types.push("TEXT"); + urls.push("data/core/science1/npc/fisherman_boat.png"); + types.push("IMAGE"); + urls.push("data/core/science1/npc/lurker.png"); + types.push("IMAGE"); + urls.push("data/core/science1/npc/lurker.xml"); + types.push("TEXT"); + urls.push("data/core/science1/npc/mechanic.xml"); + types.push("TEXT"); + urls.push("data/core/science1/npc/mirrows.xml"); + types.push("TEXT"); + urls.push("data/core/science1/npc/npcs.png"); + types.push("IMAGE"); + urls.push("data/core/science1/npc/npcs.xml"); + types.push("TEXT"); + urls.push("data/core/science1/npc/townfolk.png"); + types.push("IMAGE"); + urls.push("data/core/science1/npc/townfolk.xml"); + types.push("TEXT"); + urls.push("data/core/science1/parallax/bg320.png"); + types.push("IMAGE"); + urls.push("data/core/science1/parallax/bg320.xml"); + types.push("TEXT"); + urls.push("data/core/science1/parallax/bg640.png"); + types.push("IMAGE"); + urls.push("data/core/science1/parallax/bg640.xml"); + types.push("TEXT"); + urls.push("data/core/science1/parallax/desert.png"); + types.push("IMAGE"); + urls.push("data/core/science1/parallax/parallax.xml"); + types.push("TEXT"); + urls.push("data/core/science1/parallax/town.png"); + types.push("IMAGE"); + urls.push("data/core/science1/sand.png"); + types.push("IMAGE"); + urls.push("data/core/science1/scenes/fisherman/bg.png"); + types.push("IMAGE"); + urls.push("data/core/science1/scenes/fisherman/scene.xml"); + types.push("TEXT"); + urls.push("data/core/science1/scenes/fisherman/sheet.png"); + types.push("IMAGE"); + urls.push("data/core/science1/scenes/fisherman/sheet.xml"); + types.push("TEXT"); + urls.push("data/core/science1/scenes/inn/bg.png"); + types.push("IMAGE"); + urls.push("data/core/science1/scenes/inn/innkeeper.png"); + types.push("IMAGE"); + urls.push("data/core/science1/scenes/inn/innkeeper.xml"); + types.push("TEXT"); + urls.push("data/core/science1/scenes/inn/scene.xml"); + types.push("TEXT"); + urls.push("data/core/science1/scenes/mechanic/bg.png"); + types.push("IMAGE"); + urls.push("data/core/science1/scenes/mechanic/mechanic.png"); + types.push("IMAGE"); + urls.push("data/core/science1/scenes/mechanic/mechanic.xml"); + types.push("TEXT"); + urls.push("data/core/science1/scenes/mechanic/scene.xml"); + types.push("TEXT"); + urls.push("data/core/science1/scenes/mirrows/bg.png"); + types.push("IMAGE"); + urls.push("data/core/science1/scenes/mirrows/bridge.xml"); + types.push("TEXT"); + urls.push("data/core/science1/scenes/mirrows/scene.xml"); + types.push("TEXT"); + urls.push("data/core/science1/scenes/mirrows/sheet.png"); + types.push("IMAGE"); + urls.push("data/core/science1/scenes/mirrows/sheet.xml"); + types.push("TEXT"); + urls.push("data/core/science1/scenes/scenes.xml"); + types.push("TEXT"); + urls.push("data/core/science1/science1.xml"); + types.push("TEXT"); + urls.push("data/core/science1/ship.png"); + types.push("IMAGE"); + urls.push("data/core/science1/structures/bridge.png"); + types.push("IMAGE"); + urls.push("data/core/science1/structures/bridge.xml"); + types.push("TEXT"); + urls.push("data/core/science1/structures/crashed_ship.png"); + types.push("IMAGE"); + urls.push("data/core/science1/structures/dock.png"); + types.push("IMAGE"); + urls.push("data/core/science1/structures/dock_front.png"); + types.push("IMAGE"); + urls.push("data/core/science1/structures/elevator.png"); + types.push("IMAGE"); + urls.push("data/core/science1/structures/elevator_chain.png"); + types.push("IMAGE"); + urls.push("data/core/science1/structures/elevator_winch.png"); + types.push("IMAGE"); + urls.push("data/core/science1/structures/factory.png"); + types.push("IMAGE"); + urls.push("data/core/science1/structures/food_market.png"); + types.push("IMAGE"); + urls.push("data/core/science1/structures/inn.png"); + types.push("IMAGE"); + urls.push("data/core/science1/structures/inn_door.png"); + types.push("IMAGE"); + urls.push("data/core/science1/structures/light.png"); + types.push("IMAGE"); + urls.push("data/core/science1/structures/lights.png"); + types.push("IMAGE"); + urls.push("data/core/science1/structures/lights.xml"); + types.push("TEXT"); + urls.push("data/core/science1/structures/markets.png"); + types.push("IMAGE"); + urls.push("data/core/science1/structures/medicom.png"); + types.push("IMAGE"); + urls.push("data/core/science1/structures/medivat.png"); + types.push("IMAGE"); + urls.push("data/core/science1/structures/medivat.xml"); + types.push("TEXT"); + urls.push("data/core/science1/structures/minodoor.png"); + types.push("IMAGE"); + urls.push("data/core/science1/structures/operate.png"); + types.push("IMAGE"); + urls.push("data/core/science1/structures/operate.xml"); + types.push("TEXT"); + urls.push("data/core/science1/structures/powerline1.png"); + types.push("IMAGE"); + urls.push("data/core/science1/structures/powerline2.png"); + types.push("IMAGE"); + urls.push("data/core/science1/structures/power_plant.png"); + types.push("IMAGE"); + urls.push("data/core/science1/structures/ship_crack1.png"); + types.push("IMAGE"); + urls.push("data/core/science1/structures/ship_crack2.png"); + types.push("IMAGE"); + urls.push("data/core/science1/structures/ship_door.png"); + types.push("IMAGE"); + urls.push("data/core/science1/structures/ship_door_light.png"); + types.push("IMAGE"); + urls.push("data/core/science1/structures/structures.xml"); + types.push("TEXT"); + urls.push("data/core/science1/structures/warehouse.png"); + types.push("IMAGE"); + urls.push("data/core/science1/water_cave.png"); + types.push("IMAGE"); + urls.push("data/core/science1/water_cave.xml"); + types.push("TEXT"); + urls.push("data/core/sound/sounds.xml"); + types.push("TEXT"); + urls.push("data/core/specials/ant.png"); + types.push("IMAGE"); + urls.push("data/core/specials/ant.xml"); + types.push("TEXT"); + urls.push("data/core/specials/specials.xml"); + types.push("TEXT"); + urls.push("data/core/specials/tank.png"); + types.push("IMAGE"); + urls.push("data/core/specials/tank.xml"); + types.push("TEXT"); + urls.push("data/core/specials/weps.png"); + types.push("IMAGE"); + urls.push("data/core/specials/weps.xml"); + types.push("TEXT"); + urls.push("data/core/start/mountain.xml"); + types.push("TEXT"); + urls.push("data/core/start/ocean.png"); + types.push("IMAGE"); + urls.push("data/core/start/ocean.xml"); + types.push("TEXT"); + urls.push("data/core/start/parallax/bg.png"); + types.push("IMAGE"); + urls.push("data/core/start/parallax/clouds.png"); + types.push("IMAGE"); + urls.push("data/core/start/parallax/moon1.png"); + types.push("IMAGE"); + urls.push("data/core/start/parallax/moon2.png"); + types.push("IMAGE"); + urls.push("data/core/start/parallax/night_bg.png"); + types.push("IMAGE"); + urls.push("data/core/start/parallax/parallax.xml"); + types.push("TEXT"); + urls.push("data/core/start/parallax/sun.png"); + types.push("IMAGE"); + urls.push("data/core/start/parallax/tiles256.png"); + types.push("IMAGE"); + urls.push("data/core/start/parallax/tiles256.xml"); + types.push("TEXT"); + urls.push("data/core/start/parallax/tiles512.png"); + types.push("IMAGE"); + urls.push("data/core/start/parallax/tiles512.xml"); + types.push("TEXT"); + urls.push("data/core/start/parallax/water.png"); + types.push("IMAGE"); + urls.push("data/core/start/parallax/waves.png"); + types.push("IMAGE"); + urls.push("data/core/start/start.xml"); + types.push("TEXT"); + urls.push("data/core/structures/boat.png"); + types.push("IMAGE"); + urls.push("data/core/structures/boat_rail.png"); + types.push("IMAGE"); + urls.push("data/core/structures/cage.png"); + types.push("IMAGE"); + urls.push("data/core/structures/cave.png"); + types.push("IMAGE"); + urls.push("data/core/structures/crafting.xml"); + types.push("TEXT"); + urls.push("data/core/structures/dock.png"); + types.push("IMAGE"); + urls.push("data/core/structures/dockhouse.png"); + types.push("IMAGE"); + urls.push("data/core/structures/dock_front.png"); + types.push("IMAGE"); + urls.push("data/core/structures/doorway.png"); + types.push("IMAGE"); + urls.push("data/core/structures/dragon_lair.png"); + types.push("IMAGE"); + urls.push("data/core/structures/dragon_lair_fx.png"); + types.push("IMAGE"); + urls.push("data/core/structures/dragon_lair_fx.xml"); + types.push("TEXT"); + urls.push("data/core/structures/farm.png"); + types.push("IMAGE"); + urls.push("data/core/structures/farm_halloween.png"); + types.push("IMAGE"); + urls.push("data/core/structures/food_market.png"); + types.push("IMAGE"); + urls.push("data/core/structures/golem.png"); + types.push("IMAGE"); + urls.push("data/core/structures/golemfactory.png"); + types.push("IMAGE"); + urls.push("data/core/structures/hut.png"); + types.push("IMAGE"); + urls.push("data/core/structures/kitchen.png"); + types.push("IMAGE"); + urls.push("data/core/structures/kitchen2.png"); + types.push("IMAGE"); + urls.push("data/core/structures/lab.png"); + types.push("IMAGE"); + urls.push("data/core/structures/markets.png"); + types.push("IMAGE"); + urls.push("data/core/structures/pen.png"); + types.push("IMAGE"); + urls.push("data/core/structures/smelter.png"); + types.push("IMAGE"); + urls.push("data/core/structures/storehouse.png"); + types.push("IMAGE"); + urls.push("data/core/structures/structures.xml"); + types.push("TEXT"); + urls.push("data/core/structures/tent.png"); + types.push("IMAGE"); + urls.push("data/core/structures/workshop.png"); + types.push("IMAGE"); + urls.push("data/core/structures/wreath.png"); + types.push("IMAGE"); + urls.push("data/core/tiles/crack.png"); + types.push("IMAGE"); + urls.push("data/core/tiles/debris.png"); + types.push("IMAGE"); + urls.push("data/core/tiles/lava_glow.png"); + types.push("IMAGE"); + urls.push("data/core/tiles/mountain_snow.png"); + types.push("IMAGE"); + urls.push("data/core/tiles/tiles.png"); + types.push("IMAGE"); + urls.push("data/core/tiles/tiles.xml"); + types.push("TEXT"); + urls.push("data/core/tiles/whirlpool.png"); + types.push("IMAGE"); + urls.push("data/core/trees/bush.png"); + types.push("IMAGE"); + urls.push("data/core/trees/ice_bush.png"); + types.push("IMAGE"); + urls.push("data/core/trees/red_bush.png"); + types.push("IMAGE"); + urls.push("data/core/trees/tree.png"); + types.push("IMAGE"); + urls.push("data/core/trees/tree.xml"); + types.push("TEXT"); + urls.push("data/core/trees/trees.xml"); + types.push("TEXT"); + urls.push("data/fonts/damage.fnt"); + types.push("TEXT"); + urls.push("data/fonts/font.fnt"); + types.push("TEXT"); + urls.push("data/fonts/font.png"); + types.push("IMAGE"); + urls.push("data/fonts/heal.fnt"); + types.push("TEXT"); + urls.push("data/fonts/numbers.png"); + types.push("IMAGE"); + urls.push("data/keyboards/default.xml"); + types.push("TEXT"); + urls.push("data/mods/chinese/fonts/zpix.fnt.z"); + types.push("TEXT"); + urls.push("data/mods/chinese/fonts/zpix_0.png"); + types.push("IMAGE"); + urls.push("data/mods/chinese/mod.xml"); + types.push("TEXT"); + urls.push("data/mods/chinese/zh_CN.xml"); + types.push("TEXT"); + urls.push("data/mods/chinese/zh_TW.xml"); + types.push("TEXT"); + urls.push("data/mods/fan_translations/de_DE.xml"); + types.push("TEXT"); + urls.push("data/mods/fan_translations/es.xml"); + types.push("TEXT"); + urls.push("data/mods/fan_translations/fonts/uni.fnt"); + types.push("TEXT"); + urls.push("data/mods/fan_translations/fonts/uni.png"); + types.push("IMAGE"); + urls.push("data/mods/fan_translations/fr.xml"); + types.push("TEXT"); + urls.push("data/mods/fan_translations/it_IT.xml"); + types.push("TEXT"); + urls.push("data/mods/fan_translations/mod.xml"); + types.push("TEXT"); + urls.push("data/ui/achievement_bg.png"); + types.push("IMAGE"); + urls.push("data/ui/achievement_flash.png"); + types.push("IMAGE"); + urls.push("data/ui/ancient_scroll.png"); + types.push("IMAGE"); + urls.push("data/ui/ancient_window.png"); + types.push("IMAGE"); + urls.push("data/ui/bar.png"); + types.push("IMAGE"); + urls.push("data/ui/bar_fuel.png"); + types.push("IMAGE"); + urls.push("data/ui/black.png"); + types.push("IMAGE"); + urls.push("data/ui/buttons.png"); + types.push("IMAGE"); + urls.push("data/ui/ellipse.png"); + types.push("IMAGE"); + urls.push("data/ui/equip.png"); + types.push("IMAGE"); + urls.push("data/ui/game_over.png"); + types.push("IMAGE"); + urls.push("data/ui/gradient.png"); + types.push("IMAGE"); + urls.push("data/ui/icons.png"); + types.push("IMAGE"); + urls.push("data/ui/inventory.png"); + types.push("IMAGE"); + urls.push("data/ui/keys.png"); + types.push("IMAGE"); + urls.push("data/ui/noise.png"); + types.push("IMAGE"); + urls.push("data/ui/options.png"); + types.push("IMAGE"); + urls.push("data/ui/points.png"); + types.push("IMAGE"); + urls.push("data/ui/quest.png"); + types.push("IMAGE"); + urls.push("data/ui/questlog.png"); + types.push("IMAGE"); + urls.push("data/ui/speech.png"); + types.push("IMAGE"); + urls.push("data/ui/sticky.png"); + types.push("IMAGE"); + urls.push("data/ui/sync.png"); + types.push("IMAGE"); + urls.push("data/ui/title.png"); + types.push("IMAGE"); + urls.push("data/ui/title_full.jpg"); + types.push("IMAGE"); + urls.push("data/ui/ui.png"); + types.push("IMAGE"); + urls.push("data/ui/ui.xml"); + types.push("TEXT"); + urls.push("data/core/sound/achievement.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/alien_death.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/ancient_axe.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/arrow_hit.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/attack.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/axe.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/axe_tree.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/bandit_combo_death.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/bandit_heavy_death.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/bandit_knives_death.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/bandit_knives_hit1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/bandit_knives_hit2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/bandit_knives_slash.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/bandit_knives_throw1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/bandit_knives_throw2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/bandit_knives_throw3.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/bandit_ranged_attack.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/bandit_ranged_death.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/bandit_ranged_hit.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/bark1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/bark2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/blocked.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/boar_attack.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/boar_death1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/boar_death2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/boar_death3.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/bolt_hit.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/bow.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/build.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/bullet.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/buy.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/cancel.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/chainsaw.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/chest_open.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/crawler_attack1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/crawler_attack2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/crawler_death1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/crawler_death2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/cyborg_death.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/death.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/diode_wolf_attack1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/diode_wolf_attack2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/diode_wolf_death1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/diode_wolf_death2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/diode_wolf_howl.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/dragonsword.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/dragon_atk.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/dragon_death.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/dragon_hit1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/dragon_hit2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/dragon_hit3.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/dragon_transform.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/dragon_wings.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/drill.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/drinking.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/drop.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/earthhammer.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/earth_spirit_attack.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/eat.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/elevator.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/equip.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/familiar_collect.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/fire.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/fireball.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/fire_bird_death1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/fire_bird_death2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/fire_boar_death1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/fire_boar_death2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/fishing.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/fishingrod.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/flamethrower.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/fuel.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/game_saved.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/ggolem_death1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/ggolem_death2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/goggles.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/goldensword.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/golem.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/golemech_death.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/golemech_laser.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/golem_attack.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/golem_death1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/golem_death2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/hide.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/icer_death.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/item.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/item_found.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/kitchen.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/leech_attack.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/leech_death1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/leech_death2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/levelup.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/low_hp.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/machine_gun.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/magic.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/magicwyrm_attack.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/magic_wyrm_death.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/map.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/mecha_wyrm_attack1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/mecha_wyrm_attack2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/mech_wyrm_death1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/mech_wyrm_death2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/meow.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/minotaur_charge1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/minotaur_charge2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/minotaur_charge3.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/minotaur_charge4.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/minotaur_death1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/minotaur_death2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/minotaur_impale.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/mirrow_d_death.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/mirrow_energyball.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/mirrow_lightning1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/mirrow_lightning2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/mirrow_lightning3.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/mirrow_n_death.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/mirrow_tentacle1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/mirrow_tentacle2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/miss.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/move.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/ocean_enter.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/ocean_exit.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/oldone_beam.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/oldone_open.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/orb_impact.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/orb_spawn.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/owl1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/owl2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/pick.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/place.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/plant_seed.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/plant_spirit_attack.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/player_death.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/purple_golem_death1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/purple_golem_death2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/purr.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/radioactive_bolt1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/radioactive_bolt2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/rain.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/rat_death1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/rat_death2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/rat_death3.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/recurvebow.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/revolver.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/rock_door.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/sailing.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/sail_open.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/select.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/shadowcat_attack.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/shadowcat_death1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/shadowcat_death2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/shell.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/shotgun1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/shotgun2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/skyfish_death1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/skyfish_death2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/skyfish_fire.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/skyfish_impact.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/smelter.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/smelter_loop.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/spider_attack.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/spider_death1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/spider_death2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/steel_axe.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/stinger_attack1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/stinger_attack2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/stinger_death1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/stinger_death2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/summon.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/sword.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/sword_swing.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/talking1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/talking2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/talking4.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/talking5.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/talking6.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/talking7.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/thunder.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/tree_felled.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/warning.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/whirlpool.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/whirlpool_portal.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/workshop.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/wyrmqueen_spawn.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/wyrm_attack.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/wyrm_death.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/wyrm_drill.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/wyrm_queen_death.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/yeti_breath.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/yeti_death1.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/yeti_death2.ogg"); + types.push("SOUND"); + urls.push("data/core/sound/yeti_snowball.ogg"); + types.push("SOUND"); + urls.push("data/core/music/boss.ogg"); + types.push("MUSIC"); + urls.push("data/core/music/Cutscene9.ogg"); + types.push("MUSIC"); + urls.push("data/core/music/game_over.ogg"); + types.push("MUSIC"); + urls.push("data/core/music/intro.ogg"); + types.push("MUSIC"); + urls.push("data/core/music/magic1.ogg"); + types.push("MUSIC"); + urls.push("data/core/music/nightly.ogg"); + types.push("MUSIC"); + urls.push("data/core/music/no_boundaries.ogg"); + types.push("MUSIC"); + urls.push("data/core/music/science1.ogg"); + types.push("MUSIC"); + urls.push("data/core/music/title.ogg"); + types.push("MUSIC"); + urls.push("data/core/music/underground.ogg"); + types.push("MUSIC"); + if(ApplicationMain.config.assetsPrefix != null) { + var _g1 = 0; + var _g = urls.length; + while(_g1 < _g) { + var i = _g1++; + if(types[i] != "FONT") { + urls[i] = ApplicationMain.config.assetsPrefix + urls[i]; + } + } + } + ApplicationMain.preloader.load(urls,types); + var result = app.exec(); +}; +ApplicationMain.init = function() { + var loaded = 0; + var total = 0; + var library_onLoad = function(__) { + loaded += 1; + if(loaded == total) { + ApplicationMain.start(); + } + }; + ApplicationMain.preloader = null; + if(total == 0) { + ApplicationMain.start(); + } +}; +ApplicationMain.main = function() { + ApplicationMain.config = { build : "45522", company : "Fancy Fish Games", file : "Aground", fps : 60, name : "Aground", orientation : "", packageName : "com.davidmaletz.mining.Aground", version : "2.0.7", windows : [{ antialiasing : 0, background : 0, borderless : false, depthBuffer : false, display : 0, fullscreen : false, hardware : true, height : 0, parameters : "{}", resizable : true, stencilBuffer : true, title : "Aground", vsync : false, width : 0, x : null, y : null}]}; +}; +ApplicationMain.start = function() { + var hasMain = false; + var entryPoint = Type.resolveClass("com.davidmaletz.mining.Main"); + var _g = 0; + var _g1 = Type.getClassFields(entryPoint); + while(_g < _g1.length) { + var methodName = _g1[_g]; + ++_g; + if(methodName == "main") { + hasMain = true; + break; + } + } + lime_Assets.initialize(); + if(hasMain) { + Reflect.callMethod(entryPoint,Reflect.field(entryPoint,"main"),[]); + } else { + var instance = Type.createInstance(DocumentClass,[]); + } + if(openfl_Lib.current.stage.window.get_fullscreen()) { + openfl_Lib.current.stage.dispatchEvent(new openfl_events_FullScreenEvent("fullScreen",false,false,true,true)); + } + openfl_Lib.current.stage.dispatchEvent(new openfl_events_Event("resize",false,false)); +}; +var openfl_events_IEventDispatcher = function() { }; +$hxClasses["openfl.events.IEventDispatcher"] = openfl_events_IEventDispatcher; +openfl_events_IEventDispatcher.__name__ = ["openfl","events","IEventDispatcher"]; +openfl_events_IEventDispatcher.prototype = { + addEventListener: null + ,dispatchEvent: null + ,removeEventListener: null + ,__class__: openfl_events_IEventDispatcher +}; +var openfl_events_EventDispatcher = function(target) { + if(target != null) { + this.__targetDispatcher = target; + } +}; +$hxClasses["openfl.events.EventDispatcher"] = openfl_events_EventDispatcher; +openfl_events_EventDispatcher.__name__ = ["openfl","events","EventDispatcher"]; +openfl_events_EventDispatcher.__interfaces__ = [openfl_events_IEventDispatcher]; +openfl_events_EventDispatcher.throwCriticalError = function(e) { + if(openfl_events_EventDispatcher.criticalError != null) { + openfl_events_EventDispatcher.criticalError(e); + } else { + throw $hx_rethrow; + } +}; +openfl_events_EventDispatcher.__sortByPriority = function(l1,l2) { + if(l1.priority == l2.priority) { + return 0; + } else if(l1.priority > l2.priority) { + return -1; + } else { + return 1; + } +}; +openfl_events_EventDispatcher.prototype = { + __dispatching: null + ,__targetDispatcher: null + ,__eventMap: null + ,__newEventMap: null + ,addEventListener: function(type,listener,useCapture,priority,useWeakReference) { + if(useWeakReference == null) { + useWeakReference = false; + } + if(priority == null) { + priority = 0; + } + if(useCapture == null) { + useCapture = false; + } + if(this.__eventMap == null) { + this.__dispatching = new haxe_ds_StringMap(); + this.__eventMap = new haxe_ds_StringMap(); + this.__newEventMap = new haxe_ds_StringMap(); + } + if(!this.__eventMap.exists(type)) { + var list = []; + list.push(new openfl_events__$EventDispatcher_Listener(listener,useCapture,priority)); + this.__eventMap.set(type,list); + } else { + var list1; + if(this.__dispatching.get(type) == true) { + if(!this.__newEventMap.exists(type)) { + list1 = this.__eventMap.get(type).slice(); + this.__newEventMap.set(type,list1); + } else { + list1 = this.__newEventMap.get(type); + } + } else { + list1 = this.__eventMap.get(type); + } + var _g1 = 0; + var _g = list1.length; + while(_g1 < _g) { + var i = _g1++; + if(Reflect.compareMethods(list1[i].callback,listener)) { + return; + } + } + list1.push(new openfl_events__$EventDispatcher_Listener(listener,useCapture,priority)); + list1.sort(openfl_events_EventDispatcher.__sortByPriority); + } + } + ,dispatchEvent: function(event) { + if(this.__targetDispatcher != null) { + event.target = this.__targetDispatcher; + } else { + event.target = this; + } + return this.__dispatchEvent(event); + } + ,hasEventListener: function(type) { + if(this.__eventMap == null) { + return false; + } + if(this.__dispatching.get(type) == true && this.__newEventMap.exists(type)) { + return this.__newEventMap.get(type).length > 0; + } else { + return this.__eventMap.exists(type); + } + } + ,removeEventListener: function(type,listener,useCapture) { + if(useCapture == null) { + useCapture = false; + } + if(this.__eventMap == null) { + return; + } + var list = this.__eventMap.get(type); + if(list == null) { + return; + } + var dispatching = this.__dispatching.get(type) == true; + if(dispatching) { + if(!this.__newEventMap.exists(type)) { + list = this.__eventMap.get(type).slice(); + this.__newEventMap.set(type,list); + } else { + list = this.__newEventMap.get(type); + } + } + var _g1 = 0; + var _g = list.length; + while(_g1 < _g) { + var i = _g1++; + if(list[i].match(listener,useCapture)) { + list.splice(i,1); + break; + } + } + if(!dispatching) { + if(list.length == 0) { + this.__eventMap.remove(type); + } + if(!this.__eventMap.iterator().hasNext()) { + this.__eventMap = null; + this.__newEventMap = null; + } + } + } + ,__dispatchEvent: function(event) { + try { + if(this.__eventMap == null || event == null) { + return false; + } + var type = event.type; + var list; + if(this.__dispatching.get(type) == true) { + list = this.__newEventMap.get(type); + if(list == null) { + return false; + } + list = list.slice(); + } else { + list = this.__eventMap.get(type); + if(list == null) { + return false; + } + this.__dispatching.set(type,true); + } + if(event.target == null) { + if(this.__targetDispatcher != null) { + event.target = this.__targetDispatcher; + } else { + event.target = this; + } + } + event.currentTarget = this; + var capture = event.eventPhase == 1; + var index = 0; + var listener; + while(index < list.length) { + listener = list[index]; + if(listener.useCapture == capture) { + listener.callback(event); + if(event.__isCanceledNow) { + break; + } + } + if(listener == list[index]) { + ++index; + } + } + if(this.__newEventMap != null && this.__newEventMap.exists(type)) { + var list1 = this.__newEventMap.get(type); + if(list1.length > 0) { + this.__eventMap.set(type,list1); + } else { + this.__eventMap.remove(type); + } + if(!this.__eventMap.iterator().hasNext()) { + this.__eventMap = null; + this.__newEventMap = null; + } else { + this.__newEventMap.remove(type); + } + } + this.__dispatching.set(event.type,false); + return true; + } catch( e ) { + haxe_CallStack.lastException = e; + if (e instanceof js__$Boot_HaxeError) e = e.val; + openfl_events_EventDispatcher.throwCriticalError(e); + return true; + } + } + ,__class__: openfl_events_EventDispatcher +}; +var openfl_display_IBitmapDrawable = function() { }; +$hxClasses["openfl.display.IBitmapDrawable"] = openfl_display_IBitmapDrawable; +openfl_display_IBitmapDrawable.__name__ = ["openfl","display","IBitmapDrawable"]; +openfl_display_IBitmapDrawable.prototype = { + __worldColorTransform: null + ,__blendMode: null + ,__cacheAsBitmap: null + ,__renderGL: null + ,__updateChildren: null + ,__updateTransforms: null + ,__class__: openfl_display_IBitmapDrawable +}; +var openfl_display_DisplayObject = function() { + this.__cacheAsBitmapSmooth = true; + this.__cacheAsBitmap = false; + this.__maskCached = false; + openfl_events_EventDispatcher.call(this); + this.__alpha = 1; + this.__transform = new openfl_geom_Matrix(); + this.__visible = true; + this.__rotation = 0; + this.__rotationSine = 0; + this.__rotationCosine = 1; + this.__renderTransform = new openfl_geom_Matrix(); + this.__offset = new openfl_geom_Point(); + this.__worldOffset = new openfl_geom_Point(); + this.__worldAlpha = 1; + this.__worldTransform = new openfl_geom_Matrix(); + this.__worldColorTransform = new openfl_geom_ColorTransform(); + this.set_name("instance" + ++openfl_display_DisplayObject.__instanceCount); +}; +$hxClasses["openfl.display.DisplayObject"] = openfl_display_DisplayObject; +openfl_display_DisplayObject.__name__ = ["openfl","display","DisplayObject"]; +openfl_display_DisplayObject.__interfaces__ = [openfl_display_IBitmapDrawable]; +openfl_display_DisplayObject.__super__ = openfl_events_EventDispatcher; +openfl_display_DisplayObject.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + blendMode: null + ,cacheAsBitmapBounds: null + ,loaderInfo: null + ,parent: null + ,__unused: null + ,shader: null + ,stage: null + ,__renderTransform: null + ,__worldColorTransform: null + ,__worldOffset: null + ,__worldTransform: null + ,__alpha: null + ,__blendMode: null + ,__children: null + ,__filters: null + ,__graphics: null + ,__isMask: null + ,__mask: null + ,__maskGraphics: null + ,__maskCached: null + ,__name: null + ,__objectTransform: null + ,__offset: null + ,__renderable: null + ,__renderDirty: null + ,__rotation: null + ,__rotationCosine: null + ,__rotationSine: null + ,__scrollRect: null + ,__shader: null + ,__transform: null + ,__transformDirty: null + ,__visible: null + ,__worldAlpha: null + ,__cacheAsBitmap: null + ,__cacheAsBitmapMatrix: null + ,__cacheAsBitmapSmooth: null + ,__updateCachedBitmap: null + ,__cachedBitmap: null + ,__cachedBitmapBounds: null + ,__cachedFilterBounds: null + ,__cacheGLMatrix: null + ,__updateFilters: null + ,getBounds: function(targetCoordinateSpace) { + var matrix; + if(targetCoordinateSpace != null) { + matrix = this.__getWorldTransform().clone(); + matrix.concat(targetCoordinateSpace.__getWorldTransform().clone().invert()); + } else { + matrix = openfl_geom_Matrix.__temp; + matrix.identity(); + } + var bounds = new openfl_geom_Rectangle(); + this.__getBounds(bounds,matrix); + return bounds; + } + ,globalToLocal: function(pos) { + pos = pos.clone(); + this.__getWorldTransform().__transformInversePoint(pos); + return pos; + } + ,localToGlobal: function(point) { + return this.__getWorldTransform().transformPoint(point); + } + ,__broadcast: function(event,notifyChilden) { + if(this.__eventMap != null && this.hasEventListener(event.type)) { + var result = openfl_events_EventDispatcher.prototype.__dispatchEvent.call(this,event); + if(event.__isCanceled) { + return true; + } + return result; + } + return false; + } + ,__dispatchEvent: function(event) { + var result = openfl_events_EventDispatcher.prototype.__dispatchEvent.call(this,event); + if(event.__isCanceled) { + return true; + } + if(event.bubbles && this.parent != null && this.parent != this) { + event.eventPhase = 3; + if(event.target == null) { + event.target = this; + } + this.parent.__dispatchEvent(event); + } + return result; + } + ,__enterFrame: function(deltaTime) { + } + ,__getBounds: function(rect,matrix) { + if(this.__graphics != null) { + this.__graphics.__getBounds(rect,matrix); + } + } + ,__getCursor: function() { + return null; + } + ,__getInteractive: function(stack) { + return false; + } + ,__getLocalBounds: function(rect) { + this.__getBounds(rect,this.__transform); + } + ,__getRenderBounds: function(rect,matrix) { + if(this.__scrollRect == null) { + this.__getBounds(rect,matrix); + } else { + var r = openfl_geom_Rectangle.__temp; + r.copyFrom(this.__scrollRect); + r.__transform(r,matrix); + rect.__expand(matrix.tx,matrix.ty,r.width,r.height); + } + } + ,__getWorldTransform: function() { + if(this.__transformDirty || openfl_display_DisplayObject.__worldTransformDirty > 0) { + var list = []; + var current = this; + var transformDirty = this.__transformDirty; + if(this.parent == null) { + if(transformDirty) { + this.__update(true,false); + } + } else { + while(current.parent != null) { + list.push(current); + current = current.parent; + if(current.__transformDirty) { + transformDirty = true; + } + } + } + if(transformDirty) { + var i = list.length; + while(--i >= 0) list[i].__update(true,false); + } + } + return this.__worldTransform; + } + ,__hitTest: function(x,y,shapeFlag,stack,interactiveOnly,hitObject) { + if(this.__graphics != null) { + if(!hitObject.get_visible() || this.__isMask) { + return false; + } + if(this.get_mask() != null && !this.get_mask().__hitTestMask(x,y)) { + return false; + } + if(this.__graphics.__hitTest(x,y,shapeFlag,this.__getWorldTransform())) { + if(stack != null && !interactiveOnly) { + stack.push(hitObject); + } + return true; + } + } + return false; + } + ,__hitTestMask: function(x,y) { + if(this.__graphics != null) { + if(this.__graphics.__hitTest(x,y,true,this.__getWorldTransform())) { + return true; + } + } + return false; + } + ,__renderCairo: function(renderSession) { + if(this.__graphics != null) { + openfl__$internal_renderer_cairo_CairoShape.render(this,renderSession); + } + } + ,__renderCairoMask: function(renderSession) { + if(this.__graphics != null) { + openfl__$internal_renderer_cairo_CairoGraphics.renderMask(this.__graphics,renderSession); + } + } + ,__renderCanvas: function(renderSession) { + if(this.__graphics != null) { + openfl__$internal_renderer_canvas_CanvasShape.render(this,renderSession); + } + } + ,__renderCanvasMask: function(renderSession) { + if(this.__graphics != null) { + openfl__$internal_renderer_canvas_CanvasGraphics.renderMask(this.__graphics,renderSession); + } + } + ,__renderGL: function(renderSession) { + if(!this.__renderable || this.__worldAlpha <= 0) { + return; + } + if(this.__cacheAsBitmap) { + this.__cacheGL(renderSession); + return; + } + this.__preRenderGL(renderSession); + this.__drawGraphicsGL(renderSession); + this.__postRenderGL(renderSession); + } + ,__drawGraphicsGL: function(renderSession) { + if(this.__graphics != null) { + openfl__$internal_renderer_opengl_utils_GraphicsRenderer.render(this,renderSession); + } + } + ,__preRenderGL: function(renderSession) { + if(this.__scrollRect != null) { + renderSession.maskManager.pushRect(this.__scrollRect,this.__renderTransform); + } + if(this.__mask != null && this.__maskGraphics != null && this.__maskGraphics.__commands.get_length() > 0) { + renderSession.maskManager.pushMask(this); + } + } + ,__postRenderGL: function(renderSession) { + if(this.__mask != null && this.__maskGraphics != null && this.__maskGraphics.__commands.get_length() > 0) { + renderSession.maskManager.popMask(); + } + if(this.__scrollRect != null) { + renderSession.maskManager.popRect(); + } + } + ,__cacheGL: function(renderSession) { + var hasCacheMatrix = this.__cacheAsBitmapMatrix != null; + var x = this.__cachedBitmapBounds.x; + var y = this.__cachedBitmapBounds.y; + var w = this.__cachedBitmapBounds.width; + var h = this.__cachedBitmapBounds.height; + if(this.__cacheGLMatrix == null) { + this.__cacheGLMatrix = new openfl_geom_Matrix(); + } + if(hasCacheMatrix) { + var bmpBounds = openfl_geom_Rectangle.__temp; + this.__cachedBitmapBounds.__transform(bmpBounds,this.__cacheAsBitmapMatrix); + x = bmpBounds.x; + y = bmpBounds.y; + w = bmpBounds.width; + h = bmpBounds.height; + this.__cacheGLMatrix = this.__cacheAsBitmapMatrix.clone(); + } else { + this.__cacheGLMatrix.identity(); + } + if(w <= 0 && h <= 0) { + return; + } + if(this.__updateCachedBitmap || this.__updateFilters) { + if(this.__cachedFilterBounds != null) { + w += Math.abs(this.__cachedFilterBounds.x) + Math.abs(this.__cachedFilterBounds.width); + h += Math.abs(this.__cachedFilterBounds.y) + Math.abs(this.__cachedFilterBounds.height); + } + if(this.__cachedBitmap == null) { + this.__cachedBitmap = openfl_display_BitmapData.__asRenderTexture(); + } + this.__cachedBitmap.__resize(Math.ceil(w),Math.ceil(h)); + var m = this.__cacheGLMatrix.clone(); + m.translate(-x,-y); + var shader = this.__shader; + this.__shader = null; + this.__cachedBitmap.__drawGL(renderSession,this,m,null,null,null,true,false,true); + this.__shader = shader; + this.__updateCachedBitmap = false; + } + if(this.__updateFilters) { + openfl_filters_BitmapFilter.__applyFilters(this.__filters,renderSession,this.__cachedBitmap,this.__cachedBitmap,null,null); + this.__updateFilters = false; + } + this.__cacheGLMatrix.invert(); + this.__cacheGLMatrix.__translateTransformed(x,y); + this.__cacheGLMatrix.concat(this.__renderTransform); + this.__cacheGLMatrix.translate(this.__offset.x,this.__offset.y); + renderSession.spriteBatch.renderBitmapData(this.__cachedBitmap,this.__cacheAsBitmapSmooth,this.__cacheGLMatrix,this.__worldColorTransform,this.__worldAlpha,this.blendMode,this.__shader,0); + } + ,__setStageReference: function(stage) { + if(this.stage != stage) { + if(this.stage != null) { + if(this.stage.get_focus() == this) { + this.stage.set_focus(null); + } + this.dispatchEvent(new openfl_events_Event("removedFromStage",false,false)); + if(this.__graphics != null) { + this.__graphics.dispose(); + } + } + this.stage = stage; + if(stage != null) { + this.dispatchEvent(new openfl_events_Event("addedToStage",false,false)); + } + } + } + ,__setRenderDirty: function() { + if(!this.__renderDirty) { + this.__updateCachedBitmap = true; + this.__updateFilters = this.get_filters() != null && this.get_filters().length > 0; + this.__renderDirty = true; + openfl_display_DisplayObject.__worldRenderDirty++; + } + } + ,__setTransformDirty: function() { + if(!this.__transformDirty) { + this.__transformDirty = true; + openfl_display_DisplayObject.__worldTransformDirty++; + } + } + ,__update: function(transformOnly,updateChildren,maskGraphics) { + this.__renderable = this.get_visible() && this.get_scaleX() != 0 && this.get_scaleY() != 0 && !this.__isMask; + this.__updateTransforms(); + if(this.parent != null && this.__isMask) { + this.__maskCached = false; + } + if(updateChildren && this.__transformDirty) { + this.__transformDirty = false; + openfl_display_DisplayObject.__worldTransformDirty--; + } + if(!transformOnly && this.__mask != null && !this.__mask.__maskCached) { + if(this.__maskGraphics == null) { + this.__maskGraphics = new openfl_display_Graphics(); + } + this.__maskGraphics.clear(); + this.__mask.__update(true,true,this.__maskGraphics); + this.__mask.__maskCached = true; + } + if(maskGraphics != null) { + this.__updateMask(maskGraphics); + } + if(!transformOnly && this.__cacheAsBitmap) { + if(this.__updateCachedBitmap || this.__updateFilters) { + if(this.__cachedBitmapBounds == null) { + this.__cachedBitmapBounds = new openfl_geom_Rectangle(); + } + if(this.cacheAsBitmapBounds != null) { + this.__cachedBitmapBounds.copyFrom(this.cacheAsBitmapBounds); + } else { + this.__cachedBitmapBounds.setEmpty(); + this.__getRenderBounds(this.__cachedBitmapBounds,openfl_geom_Matrix.__identity); + } + if(this.__filters != null) { + if(this.__cachedFilterBounds == null) { + this.__cachedFilterBounds = new openfl_geom_Rectangle(); + } + this.__cachedFilterBounds.setEmpty(); + openfl_filters_BitmapFilter.__expandBounds(this.__filters,this.__cachedFilterBounds,openfl_geom_Matrix.__identity); + this.__cachedBitmapBounds.x += this.__cachedFilterBounds.x; + this.__cachedBitmapBounds.y += this.__cachedFilterBounds.y; + } + } + } + if(!transformOnly) { + if(!this.__worldColorTransform.__equals(this.get_transform().get_colorTransform())) { + this.__worldColorTransform = this.get_transform().get_colorTransform().__clone(); + } + if(this.parent != null) { + this.__worldAlpha = this.get_alpha() * this.parent.__worldAlpha; + this.__worldColorTransform.__combine(this.parent.__worldColorTransform); + if(this.blendMode == null || this.blendMode == 10) { + this.__blendMode = this.parent.__blendMode; + } + if(this.shader == null) { + this.__shader = this.parent.__shader; + } + } else { + this.__worldAlpha = this.get_alpha(); + } + if(updateChildren && this.__renderDirty) { + this.__renderDirty = false; + } + } + } + ,__updateChildren: function(transformOnly) { + this.__renderable = this.get_visible() && this.get_scaleX() != 0 && this.get_scaleY() != 0 && !this.__isMask; + if(!this.__renderable && !this.__isMask) { + return; + } + this.__worldAlpha = this.get_alpha(); + if(this.__transformDirty) { + this.__transformDirty = false; + openfl_display_DisplayObject.__worldTransformDirty--; + } + } + ,__updateMask: function(maskGraphics) { + if(this.__graphics != null) { + maskGraphics.__commands.overrideMatrix(this.__worldTransform); + maskGraphics.__commands.append(this.__graphics.__commands); + maskGraphics.set___dirty(true); + maskGraphics.__visible = true; + if(maskGraphics.__bounds == null) { + maskGraphics.__bounds = new openfl_geom_Rectangle(); + } + this.__graphics.__getBounds(maskGraphics.__bounds,openfl_geom_Matrix.__identity); + } + } + ,__updateTransforms: function(overrideTransform) { + var overrided = overrideTransform != null; + var local = overrided ? overrideTransform.clone() : this.__transform; + if(this.__worldTransform == null) { + this.__worldTransform = new openfl_geom_Matrix(); + } + if(!overrided && this.parent != null) { + var parentTransform = this.parent.__worldTransform; + this.__worldTransform.a = local.a * parentTransform.a + local.b * parentTransform.c; + this.__worldTransform.b = local.a * parentTransform.b + local.b * parentTransform.d; + this.__worldTransform.c = local.c * parentTransform.a + local.d * parentTransform.c; + this.__worldTransform.d = local.c * parentTransform.b + local.d * parentTransform.d; + this.__worldTransform.tx = local.tx * parentTransform.a + local.ty * parentTransform.c + parentTransform.tx; + this.__worldTransform.ty = local.tx * parentTransform.b + local.ty * parentTransform.d + parentTransform.ty; + this.__worldOffset.copyFrom(this.parent.__worldOffset); + } else { + this.__worldTransform.copyFrom(local); + this.__worldOffset.setTo(0,0); + } + if(this.__scrollRect != null) { + this.__offset = this.__worldTransform.deltaTransformPoint(this.__scrollRect.get_topLeft()); + this.__worldOffset.offset(this.__offset.x,this.__offset.y); + } else { + this.__offset.setTo(0,0); + } + this.__renderTransform.copyFrom(this.__worldTransform); + this.__renderTransform.translate(-this.__worldOffset.x,-this.__worldOffset.y); + } + ,get_alpha: function() { + return this.__alpha; + } + ,set_alpha: function(value) { + if(value > 1.0) { + value = 1.0; + } + if(value != this.__alpha) { + this.__setRenderDirty(); + } + return this.__alpha = value; + } + ,get_cacheAsBitmap: function() { + return this.__cacheAsBitmap; + } + ,get_filters: function() { + if(this.__filters == null) { + return []; + } else { + return this.__filters.slice(); + } + } + ,get_mask: function() { + return this.__mask; + } + ,set_name: function(value) { + return this.__name = value; + } + ,get_rotation: function() { + return this.__rotation; + } + ,set_rotation: function(value) { + if(value != this.__rotation) { + this.__rotation = value; + var radians = this.__rotation * (Math.PI / 180); + this.__rotationSine = Math.sin(radians); + this.__rotationCosine = Math.cos(radians); + var __scaleX = this.get_scaleX(); + var __scaleY = this.get_scaleY(); + this.__transform.a = this.__rotationCosine * __scaleX; + this.__transform.b = this.__rotationSine * __scaleX; + this.__transform.c = -this.__rotationSine * __scaleY; + this.__transform.d = this.__rotationCosine * __scaleY; + this.__setTransformDirty(); + } + return value; + } + ,get_scaleX: function() { + if(this.__transform.b == 0) { + return this.__transform.a; + } else { + return Math.sqrt(this.__transform.a * this.__transform.a + this.__transform.b * this.__transform.b); + } + } + ,set_scaleX: function(value) { + if(this.__transform.c == 0) { + if(value != this.__transform.a) { + this.__setTransformDirty(); + } + this.__transform.a = value; + } else { + var a = this.__rotationCosine * value; + var b = this.__rotationSine * value; + if(this.__transform.a != a || this.__transform.b != b) { + this.__setTransformDirty(); + } + this.__transform.a = a; + this.__transform.b = b; + } + return value; + } + ,get_scaleY: function() { + if(this.__transform.c == 0) { + return this.__transform.d; + } else { + return Math.sqrt(this.__transform.c * this.__transform.c + this.__transform.d * this.__transform.d); + } + } + ,set_scaleY: function(value) { + if(this.__transform.c == 0) { + if(value != this.__transform.d) { + this.__setTransformDirty(); + } + this.__transform.d = value; + } else { + var c = -this.__rotationSine * value; + var d = this.__rotationCosine * value; + if(this.__transform.d != d || this.__transform.c != c) { + this.__setTransformDirty(); + } + this.__transform.c = c; + this.__transform.d = d; + } + return value; + } + ,get_scrollRect: function() { + if(this.__scrollRect == null) { + return null; + } + return this.__scrollRect.clone(); + } + ,get_transform: function() { + if(this.__objectTransform == null) { + this.__objectTransform = new openfl_geom_Transform(this); + } + return this.__objectTransform; + } + ,get_visible: function() { + return this.__visible; + } + ,set_visible: function(value) { + if(value != this.__visible) { + this.__setRenderDirty(); + } + return this.__visible = value; + } + ,get_width: function() { + var bounds = new openfl_geom_Rectangle(); + this.__getLocalBounds(bounds); + return bounds.width; + } + ,get_x: function() { + return this.__transform.tx; + } + ,set_x: function(value) { + if(value != this.__transform.tx) { + this.__setTransformDirty(); + } + return this.__transform.tx = value; + } + ,get_y: function() { + return this.__transform.ty; + } + ,set_y: function(value) { + if(value != this.__transform.ty) { + this.__setTransformDirty(); + } + return this.__transform.ty = value; + } + ,__class__: openfl_display_DisplayObject + ,__properties__: {set_y:"set_y",get_y:"get_y",set_x:"set_x",get_x:"get_x",get_width:"get_width",set_visible:"set_visible",get_visible:"get_visible",get_transform:"get_transform",get_scrollRect:"get_scrollRect",set_scaleY:"set_scaleY",get_scaleY:"get_scaleY",set_scaleX:"set_scaleX",get_scaleX:"get_scaleX",set_rotation:"set_rotation",get_rotation:"get_rotation",set_name:"set_name",get_mask:"get_mask",get_filters:"get_filters",get_cacheAsBitmap:"get_cacheAsBitmap",set_alpha:"set_alpha",get_alpha:"get_alpha"} +}); +var openfl_display_InteractiveObject = function() { + openfl_display_DisplayObject.call(this); + this.doubleClickEnabled = false; + this.mouseEnabled = true; + this.needsSoftKeyboard = false; + this.__tabEnabled = false; + this.tabIndex = -1; +}; +$hxClasses["openfl.display.InteractiveObject"] = openfl_display_InteractiveObject; +openfl_display_InteractiveObject.__name__ = ["openfl","display","InteractiveObject"]; +openfl_display_InteractiveObject.__super__ = openfl_display_DisplayObject; +openfl_display_InteractiveObject.prototype = $extend(openfl_display_DisplayObject.prototype,{ + doubleClickEnabled: null + ,mouseEnabled: null + ,needsSoftKeyboard: null + ,tabIndex: null + ,__tabEnabled: null + ,__getInteractive: function(stack) { + if(stack != null) { + stack.push(this); + if(this.parent != null) { + this.parent.__getInteractive(stack); + } + } + return true; + } + ,__hitTest: function(x,y,shapeFlag,stack,interactiveOnly,hitObject) { + if(!hitObject.get_visible() || this.__isMask || interactiveOnly && !this.mouseEnabled) { + return false; + } + return openfl_display_DisplayObject.prototype.__hitTest.call(this,x,y,shapeFlag,stack,interactiveOnly,hitObject); + } + ,get_tabEnabled: function() { + return this.__tabEnabled; + } + ,__class__: openfl_display_InteractiveObject + ,__properties__: $extend(openfl_display_DisplayObject.prototype.__properties__,{get_tabEnabled:"get_tabEnabled"}) +}); +var openfl_display_DisplayObjectContainer = function() { + openfl_display_InteractiveObject.call(this); + this.mouseChildren = true; + this.__children = []; +}; +$hxClasses["openfl.display.DisplayObjectContainer"] = openfl_display_DisplayObjectContainer; +openfl_display_DisplayObjectContainer.__name__ = ["openfl","display","DisplayObjectContainer"]; +openfl_display_DisplayObjectContainer.__super__ = openfl_display_InteractiveObject; +openfl_display_DisplayObjectContainer.prototype = $extend(openfl_display_InteractiveObject.prototype,{ + mouseChildren: null + ,addChild: function(child) { + if(child != null) { + if(child.parent != null) { + child.parent.removeChild(child); + } + this.__children.push(child); + child.parent = this; + if(this.stage != null) { + child.__setStageReference(this.stage); + } + child.__setTransformDirty(); + child.__setRenderDirty(); + this.__setRenderDirty(); + var event = new openfl_events_Event("added",true); + event.target = child; + child.__dispatchEvent(event); + } + return child; + } + ,addChildAt: function(child,index) { + if(index > this.__children.length || index < 0) { + throw new js__$Boot_HaxeError("Invalid index position " + index); + } + if(child.parent == this) { + HxOverrides.remove(this.__children,child); + } else { + if(child.parent != null) { + child.parent.removeChild(child); + } + child.parent = this; + if(this.stage != null) { + child.__setStageReference(this.stage); + } + child.__setTransformDirty(); + child.__setRenderDirty(); + this.__setRenderDirty(); + var event = new openfl_events_Event("added",true); + event.target = child; + child.__dispatchEvent(event); + } + this.__children.splice(index,0,child); + return child; + } + ,getChildAt: function(index) { + if(index >= 0 && index < this.__children.length) { + return this.__children[index]; + } + return null; + } + ,getChildIndex: function(child) { + var _g1 = 0; + var _g = this.__children.length; + while(_g1 < _g) { + var i = _g1++; + if(this.__children[i] == child) { + return i; + } + } + return -1; + } + ,removeChild: function(child) { + if(child != null && child.parent == this) { + child.__dispatchEvent(new openfl_events_Event("removed",true)); + if(child.stage != null) { + child.__setStageReference(null); + } + child.parent = null; + HxOverrides.remove(this.__children,child); + child.__setTransformDirty(); + child.__setRenderDirty(); + this.__setRenderDirty(); + } + return child; + } + ,removeChildAt: function(index) { + if(index >= 0 && index < this.__children.length) { + return this.removeChild(this.__children[index]); + } + return null; + } + ,setChildIndex: function(child,index) { + if(index >= 0 && index <= this.__children.length && child.parent == this) { + HxOverrides.remove(this.__children,child); + this.__children.splice(index,0,child); + } + } + ,__broadcast: function(event,notifyChilden) { + if(event.target == null) { + event.target = this; + } + var result = openfl_display_InteractiveObject.prototype.__broadcast.call(this,event,notifyChilden); + if(!event.__isCanceled && notifyChilden) { + var _g = 0; + var _g1 = this.__children; + while(_g < _g1.length) { + var child = _g1[_g]; + ++_g; + child.__broadcast(event,true); + if(event.__isCanceled) { + return true; + } + } + } + return result; + } + ,__enterFrame: function(deltaTime) { + var _g = 0; + var _g1 = this.__children; + while(_g < _g1.length) { + var child = _g1[_g]; + ++_g; + child.__enterFrame(deltaTime); + } + } + ,__getBounds: function(rect,matrix) { + openfl_display_InteractiveObject.prototype.__getBounds.call(this,rect,matrix); + if(this.__children.length == 0) { + return; + } + if(matrix != null) { + this.__updateTransforms(matrix); + this.__updateChildren(true); + } + var _g = 0; + var _g1 = this.__children; + while(_g < _g1.length) { + var child = _g1[_g]; + ++_g; + if(child.get_scaleX() == 0 || child.get_scaleY() == 0) { + continue; + } + child.__getBounds(rect,child.__worldTransform); + } + if(matrix != null) { + this.__updateTransforms(); + this.__updateChildren(true); + } + } + ,__getRenderBounds: function(rect,matrix) { + if(this.__scrollRect != null) { + openfl_display_InteractiveObject.prototype.__getRenderBounds.call(this,rect,matrix); + return; + } else { + openfl_display_InteractiveObject.prototype.__getBounds.call(this,rect,matrix); + } + if(this.__children.length == 0) { + return; + } + if(matrix != null) { + this.__updateTransforms(matrix); + this.__updateChildren(true); + } + var _g = 0; + var _g1 = this.__children; + while(_g < _g1.length) { + var child = _g1[_g]; + ++_g; + if(child.get_scaleX() == 0 || child.get_scaleY() == 0 || child.__isMask) { + continue; + } + child.__getRenderBounds(rect,child.__worldTransform); + } + if(matrix != null) { + this.__updateTransforms(); + this.__updateChildren(true); + } + } + ,__hitTest: function(x,y,shapeFlag,stack,interactiveOnly,hitObject) { + if(!hitObject.get_visible() || this.__isMask || interactiveOnly && !this.mouseEnabled && !this.mouseChildren) { + return false; + } + if(this.get_mask() != null && !this.get_mask().__hitTestMask(x,y)) { + return false; + } + if(this.get_scrollRect() != null && !this.get_scrollRect().containsPoint(this.globalToLocal(new openfl_geom_Point(x,y)))) { + return false; + } + var i = this.__children.length; + if(interactiveOnly) { + if(stack == null || !this.mouseChildren) { + while(--i >= 0) if(this.__children[i].__hitTest(x,y,shapeFlag,null,true,this.__children[i])) { + if(stack != null) { + stack.push(hitObject); + } + return true; + } + } else if(stack != null) { + var length = stack.length; + var interactive = false; + var hitTest = false; + while(--i >= 0) { + interactive = this.__children[i].__getInteractive(null); + if(interactive || this.mouseEnabled && !hitTest) { + if(this.__children[i].__hitTest(x,y,shapeFlag,stack,true,this.__children[i])) { + hitTest = true; + if(interactive) { + break; + } + } + } + } + if(hitTest) { + stack.splice(length,0,hitObject); + return true; + } + } + } else { + while(--i >= 0) this.__children[i].__hitTest(x,y,shapeFlag,stack,false,this.__children[i]); + } + return false; + } + ,__hitTestMask: function(x,y) { + var i = this.__children.length; + while(--i >= 0) if(this.__children[i].__hitTestMask(x,y)) { + return true; + } + return false; + } + ,__renderCairo: function(renderSession) { + if(!this.__renderable || this.__worldAlpha <= 0) { + return; + } + openfl_display_InteractiveObject.prototype.__renderCairo.call(this,renderSession); + if(this.get_scrollRect() != null) { + renderSession.maskManager.pushRect(this.get_scrollRect(),this.__worldTransform); + } + if(this.__mask != null) { + renderSession.maskManager.pushMask(this.__mask); + } + var _g = 0; + var _g1 = this.__children; + while(_g < _g1.length) { + var child = _g1[_g]; + ++_g; + child.__renderCairo(renderSession); + } + if(this.__mask != null) { + renderSession.maskManager.popMask(); + } + if(this.get_scrollRect() != null) { + renderSession.maskManager.popRect(); + } + } + ,__renderCairoMask: function(renderSession) { + if(this.__graphics != null) { + openfl__$internal_renderer_cairo_CairoGraphics.renderMask(this.__graphics,renderSession); + } + var _g = 0; + var _g1 = this.__children; + while(_g < _g1.length) { + var child = _g1[_g]; + ++_g; + child.__renderCairoMask(renderSession); + } + } + ,__renderCanvas: function(renderSession) { + if(!this.__renderable || this.__worldAlpha <= 0) { + return; + } + openfl_display_InteractiveObject.prototype.__renderCanvas.call(this,renderSession); + if(this.get_scrollRect() != null) { + renderSession.maskManager.pushRect(this.get_scrollRect(),this.__worldTransform); + } + if(this.__mask != null) { + renderSession.maskManager.pushMask(this.__mask); + } + var _g = 0; + var _g1 = this.__children; + while(_g < _g1.length) { + var child = _g1[_g]; + ++_g; + child.__renderCanvas(renderSession); + } + if(this.__mask != null) { + renderSession.maskManager.popMask(); + } + if(this.get_scrollRect() != null) { + renderSession.maskManager.popRect(); + } + } + ,__renderCanvasMask: function(renderSession) { + if(this.__graphics != null) { + openfl__$internal_renderer_canvas_CanvasGraphics.renderMask(this.__graphics,renderSession); + } + var bounds = new openfl_geom_Rectangle(); + this.__getLocalBounds(bounds); + renderSession.context.rect(0,0,bounds.width,bounds.height); + } + ,__renderGL: function(renderSession) { + if(!this.__renderable || this.__worldAlpha <= 0) { + return; + } + if(this.__cacheAsBitmap) { + this.__cacheGL(renderSession); + return; + } + this.__preRenderGL(renderSession); + this.__drawGraphicsGL(renderSession); + var _g = 0; + var _g1 = this.__children; + while(_g < _g1.length) { + var child = _g1[_g]; + ++_g; + child.__renderGL(renderSession); + } + this.__postRenderGL(renderSession); + } + ,__setStageReference: function(stage) { + if(this.stage != stage) { + if(this.stage != null) { + this.__dispatchEvent(new openfl_events_Event("removedFromStage",false,false)); + if(this.__graphics != null) { + this.__graphics.dispose(); + } + } + this.stage = stage; + if(stage != null) { + this.__dispatchEvent(new openfl_events_Event("addedToStage",false,false)); + } + if(this.__children != null) { + var _g = 0; + var _g1 = this.__children; + while(_g < _g1.length) { + var child = _g1[_g]; + ++_g; + child.__setStageReference(stage); + } + } + } + } + ,__update: function(transformOnly,updateChildren,maskGraphics) { + openfl_display_InteractiveObject.prototype.__update.call(this,transformOnly,updateChildren,maskGraphics); + if(!this.__renderable && !this.__isMask) { + return; + } + if(updateChildren) { + var _g = 0; + var _g1 = this.__children; + while(_g < _g1.length) { + var child = _g1[_g]; + ++_g; + child.__update(transformOnly,true,maskGraphics); + } + } + } + ,__updateChildren: function(transformOnly) { + openfl_display_InteractiveObject.prototype.__updateChildren.call(this,transformOnly); + var _g = 0; + var _g1 = this.__children; + while(_g < _g1.length) { + var child = _g1[_g]; + ++_g; + child.__update(transformOnly,true); + } + } + ,get_numChildren: function() { + return this.__children.length; + } + ,__class__: openfl_display_DisplayObjectContainer + ,__properties__: $extend(openfl_display_InteractiveObject.prototype.__properties__,{get_numChildren:"get_numChildren"}) +}); +var openfl_display_Sprite = function() { + openfl_display_DisplayObjectContainer.call(this); + this.buttonMode = false; + this.useHandCursor = true; + this.loaderInfo = openfl_display_LoaderInfo.create(null); +}; +$hxClasses["openfl.display.Sprite"] = openfl_display_Sprite; +openfl_display_Sprite.__name__ = ["openfl","display","Sprite"]; +openfl_display_Sprite.__super__ = openfl_display_DisplayObjectContainer; +openfl_display_Sprite.prototype = $extend(openfl_display_DisplayObjectContainer.prototype,{ + buttonMode: null + ,hitArea: null + ,useHandCursor: null + ,__getCursor: function() { + if(this.buttonMode && this.useHandCursor) { + return lime_ui_MouseCursor.POINTER; + } else { + return null; + } + } + ,__hitTest: function(x,y,shapeFlag,stack,interactiveOnly,hitObject) { + if(this.hitArea != null) { + if(!this.hitArea.mouseEnabled) { + this.hitArea.mouseEnabled = true; + var hitTest = this.hitArea.__hitTest(x,y,shapeFlag,null,true,hitObject); + this.hitArea.mouseEnabled = false; + if(hitTest) { + stack[stack.length] = hitObject; + } + return hitTest; + } + } else { + if(!hitObject.get_visible() || this.__isMask || interactiveOnly && !this.mouseEnabled && !this.mouseChildren) { + return false; + } + if(this.get_mask() != null && !this.get_mask().__hitTestMask(x,y)) { + return false; + } + if(openfl_display_DisplayObjectContainer.prototype.__hitTest.call(this,x,y,shapeFlag,stack,interactiveOnly,hitObject)) { + return interactiveOnly; + } else if((!interactiveOnly || this.mouseEnabled) && this.__graphics != null && this.__graphics.__hitTest(x,y,shapeFlag,this.__getWorldTransform())) { + if(stack != null) { + stack.push(hitObject); + } + return true; + } + } + return false; + } + ,__hitTestMask: function(x,y) { + if(openfl_display_DisplayObjectContainer.prototype.__hitTestMask.call(this,x,y)) { + return true; + } else if(this.__graphics != null && this.__graphics.__hitTest(x,y,true,this.__getWorldTransform())) { + return true; + } + return false; + } + ,get_graphics: function() { + if(this.__graphics == null) { + this.__graphics = new openfl_display_Graphics(); + this.__graphics.__owner = this; + } + return this.__graphics; + } + ,get_tabEnabled: function() { + if(!this.__tabEnabled) { + return this.buttonMode; + } else { + return true; + } + } + ,__class__: openfl_display_Sprite + ,__properties__: $extend(openfl_display_DisplayObjectContainer.prototype.__properties__,{get_graphics:"get_graphics"}) +}); +var com_davidmaletz_faengfl_InitSprite = function() { + openfl_display_Sprite.call(this); + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); +}; +$hxClasses["com.davidmaletz.faengfl.InitSprite"] = com_davidmaletz_faengfl_InitSprite; +com_davidmaletz_faengfl_InitSprite.__name__ = ["com","davidmaletz","faengfl","InitSprite"]; +com_davidmaletz_faengfl_InitSprite.__super__ = openfl_display_Sprite; +com_davidmaletz_faengfl_InitSprite.prototype = $extend(openfl_display_Sprite.prototype,{ + init: function(e) { + throw new js__$Boot_HaxeError("This should never be called."); + } + ,destroy: function(e) { + throw new js__$Boot_HaxeError("This should never be called."); + } + ,__class__: com_davidmaletz_faengfl_InitSprite +}); +var com_davidmaletz_lerp_Lerpable = function() { }; +$hxClasses["com.davidmaletz.lerp.Lerpable"] = com_davidmaletz_lerp_Lerpable; +com_davidmaletz_lerp_Lerpable.__name__ = ["com","davidmaletz","lerp","Lerpable"]; +var com_davidmaletz_lerp_LerpSpriteBase = function() { + this.frameSpeed = 1; + com_davidmaletz_faengfl_InitSprite.call(this); +}; +$hxClasses["com.davidmaletz.lerp.LerpSpriteBase"] = com_davidmaletz_lerp_LerpSpriteBase; +com_davidmaletz_lerp_LerpSpriteBase.__name__ = ["com","davidmaletz","lerp","LerpSpriteBase"]; +com_davidmaletz_lerp_LerpSpriteBase.__interfaces__ = [com_davidmaletz_lerp_Lerpable]; +com_davidmaletz_lerp_LerpSpriteBase.__super__ = com_davidmaletz_faengfl_InitSprite; +com_davidmaletz_lerp_LerpSpriteBase.prototype = $extend(com_davidmaletz_faengfl_InitSprite.prototype,{ + tracks: null + ,frameSpeed: null + ,__dispatcher: null + ,hasTrack: function(cls) { + if(this.tracks != null) { + return this.tracks.hasTrack(cls); + } else { + return false; + } + } + ,getLerp: function(cls) { + return this.tracks.getTrack(cls).getTo(); + } + ,getFrame: function(cls) { + return this.tracks.getTrack(cls).getFrame(); + } + ,hasLerp: function() { + return this.tracks != null; + } + ,clearLerp: function() { + this.tracks = null; + } + ,canAdvanceModal: function() { + return true; + } + ,clearTrack: function(cls) { + if(this.tracks != null) { + this.tracks.removeTrack(cls); + } + } + ,finishTrack: function(cls) { + if(this.hasTrack(cls)) { + var k = this.getLerp(cls); + if(k != null) { + k.apply(this); + } + this.clearTrack(cls); + } + } + ,getTrack: function(cls) { + return this.tracks.getTrack(cls); + } + ,lerp: function(k,frames,onComplete) { + if(this.tracks == null) { + this.tracks = new com_davidmaletz_lerp_LerpTracks(); + } + this.tracks.getTrack(Type.getClass(k)).setLerp(this,k,frames,onComplete); + } + ,advanceTracks: function(df) { + if(this.tracks != null) { + this.tracks.advanceFrame(this,df); + if(this.tracks != null && this.tracks.isEmpty()) { + this.tracks = null; + } + } + } + ,advanceFrame: function(df) { + this.advanceTracks(df); + } + ,set_scaleX: function(s) { + var b = this.__dispatcher != null && s != this.get_scaleX(); + var ret = com_davidmaletz_faengfl_InitSprite.prototype.set_scaleX.call(this,s); + if(b) { + this.__dispatcher.dispatchEvent(new openfl_events_Event("update_facing")); + } + return ret; + } + ,__class__: com_davidmaletz_lerp_LerpSpriteBase +}); +var com_davidmaletz_lerp_LerpSprite = function() { + com_davidmaletz_lerp_LerpSpriteBase.call(this); +}; +$hxClasses["com.davidmaletz.lerp.LerpSprite"] = com_davidmaletz_lerp_LerpSprite; +com_davidmaletz_lerp_LerpSprite.__name__ = ["com","davidmaletz","lerp","LerpSprite"]; +com_davidmaletz_lerp_LerpSprite.__super__ = com_davidmaletz_lerp_LerpSpriteBase; +com_davidmaletz_lerp_LerpSprite.prototype = $extend(com_davidmaletz_lerp_LerpSpriteBase.prototype,{ + myPriority: null + ,init: function(e) { + this.destroy(null); + this.myPriority = com_davidmaletz_lerp_LerpSprite.priority; + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.handle_frame),false,PriorityManager.getPriority()); + } + ,destroy: function(e) { + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.handle_frame)); + } + ,handle_frame: function(e) { + if(this.myPriority >= com_davidmaletz_lerp_LerpSprite.priority && this.frameSpeed > 0) { + this.advanceFrame(com_davidmaletz_faengfl_FaengFL.frameTime * this.frameSpeed); + } + } + ,canAdvanceModal: function() { + return false; + } + ,__class__: com_davidmaletz_lerp_LerpSprite +}); +var com_davidmaletz_faengfl_Application = function(id,font,w,h,smooth,framebuffer,pScale) { + if(pScale == null) { + pScale = 1; + } + if(framebuffer == null) { + framebuffer = false; + } + if(smooth == null) { + smooth = true; + } + com_davidmaletz_lerp_LerpSprite.call(this); + com_davidmaletz_faengfl_Application.instance = this; + new com_davidmaletz_faengfl_TouchAdapter(); + com_davidmaletz_faengfl_TextSprite.SMOOTH = smooth; + com_fancyfish_faeng_text_FontManager.defaultFont.set(com_fancyfish_faeng_common_Lang.getFontCached(font,false)); + this._width = w; + this._height = h; + var canCancel = function() { + return com_davidmaletz_faengfl_Application.getFocus() == null; + }; + window.addEventListener("keydown", function(e) {if(canCancel() && [32, 37, 38, 39, 40].indexOf(e.keyCode) > -1) {e.preventDefault();}}, false); + this.container = framebuffer ? new com_davidmaletz_faengfl_FramebufferSprite(w,h,pScale) : new com_davidmaletz_faengfl_ContainerSprite(w,h); + this.top = new openfl_display_Sprite(); +}; +$hxClasses["com.davidmaletz.faengfl.Application"] = com_davidmaletz_faengfl_Application; +com_davidmaletz_faengfl_Application.__name__ = ["com","davidmaletz","faengfl","Application"]; +com_davidmaletz_faengfl_Application.instance = null; +com_davidmaletz_faengfl_Application.getWidth = function() { + return com_davidmaletz_faengfl_Application.instance._width; +}; +com_davidmaletz_faengfl_Application.getHeight = function() { + return com_davidmaletz_faengfl_Application.instance._height; +}; +com_davidmaletz_faengfl_Application._getScale = function() { + var s = com_davidmaletz_faengfl_Application.instance.container; + if(s.get_numChildren() > 0) { + return s.getChildAt(0).get_scaleX(); + } else { + return 1; + } +}; +com_davidmaletz_faengfl_Application.setFocus = function(f,e) { + com_davidmaletz_controls_Controller.instance.releaseAll(); + com_davidmaletz_faengfl_adv_AdvApp.shiftDown = false; + com_davidmaletz_faengfl_adv_AdvApp.ctrlDown = false; + if(com_davidmaletz_faengfl_Application.focus != f) { + var old = com_davidmaletz_faengfl_Application.focus; + com_davidmaletz_faengfl_Application.focus = f; + if(old != null) { + old.loseFocus(); + } + openfl_Lib.current.stage.set_focus(f); + if(com_davidmaletz_faengfl_Application.focus != null) { + com_davidmaletz_faengfl_Application.focus.gainFocus(e); + } + } else { + openfl_Lib.current.stage.set_focus(f); + } +}; +com_davidmaletz_faengfl_Application.getFocus = function() { + return com_davidmaletz_faengfl_Application.focus; +}; +com_davidmaletz_faengfl_Application.button_factory = null; +com_davidmaletz_faengfl_Application.__super__ = com_davidmaletz_lerp_LerpSprite; +com_davidmaletz_faengfl_Application.prototype = $extend(com_davidmaletz_lerp_LerpSprite.prototype,{ + _width: null + ,_height: null + ,container: null + ,top: null + ,init: function(e) { + com_davidmaletz_lerp_LerpSprite.prototype.init.call(this,e); + com_davidmaletz_faengfl_FaengFL.init(); + openfl_Lib.current.stage.addEventListener("resize",$bind(this,this.resize)); + this.resize(null); + this.addChild(this.container); + this.addChild(this.top); + } + ,destroy: function(e) { + com_davidmaletz_lerp_LerpSprite.prototype.destroy.call(this,e); + com_davidmaletz_faengfl_FaengFL.destroy(); + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this); + openfl_Lib.current.stage.removeEventListener("resize",$bind(this,this.resize)); + } + ,resize: function(e) { + var w = this.stage.stageWidth; + var h = this.stage.stageHeight; + var x = 0.0; + var iw = this._width; + var ih = this._height; + var s = Math.min(w / iw,h / ih); + this.container.set_scaleX(this.container.set_scaleY(s)); + this.container.set_x((w - iw * s) * 0.5 + x * s); + this.container.set_y((h - ih * s) * 0.5); + var g = this.top.get_graphics(); + g.clear(); + var b = new openfl_geom_Rectangle(this.container.get_x() - x * s,this.container.get_y(),iw * s,ih * s); + if(b.get_left() > 0) { + g.beginFill(0); + g.drawRect(0,0,b.get_left(),h); + g.drawRect(b.get_right(),0,w - b.get_right(),h); + g.endFill(); + } + if(b.get_top() > 0) { + g.beginFill(0); + g.drawRect(0,0,w,b.get_top()); + g.drawRect(0,b.get_bottom(),w,h - b.get_bottom()); + g.endFill(); + } + } + ,__class__: com_davidmaletz_faengfl_Application +}); +var com_davidmaletz_faengfl_adv_AdvApp = function(title,fnt,w,h,key,smooth,framebuffer,pScale) { + if(pScale == null) { + pScale = 1; + } + if(framebuffer == null) { + framebuffer = false; + } + if(smooth == null) { + smooth = true; + } + if(!openfl_display_OpenGLView.get_isSupported() || this.stage.window.renderer.type != lime_graphics_RendererType.OPENGL) { + alert('WebGL is not enabled! The game will not render correctly. Please enable webgl in your browser settings.'); + } + com_davidmaletz_faengfl_DeveloperConsole.begin(com_fancyfish_faeng_common_Lang.getFontCached(fnt,false),$bind(this,this.handleAction)); + openfl__$internal_renderer_opengl_utils_BlendModeManager.ALPHA_VALUE = 0; + var tid = StringTools.replace(title.toLowerCase()," ",""); + com_davidmaletz_faengfl_adv_AdvApp.settings = openfl_net_SharedObject.getLocal("settings",tid); + com_davidmaletz_faengfl_adv_AdvApp._saves = openfl_net_SharedObject.getLocal("saves",tid); + var _g = 0; + var _g1 = Reflect.fields(com_davidmaletz_faengfl_adv_AdvApp._saves.data); + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + com_davidmaletz_faengfl_adv_AdvApp.saves.set(s,Reflect.field(com_davidmaletz_faengfl_adv_AdvApp._saves.data,s)); + } + com_davidmaletz_controls_ClickableHandler.globalOnSelect = com_davidmaletz_faengfl_adv_AdvApp.select; + com_davidmaletz_controls_ClickableHandler.globalOnCancel = com_davidmaletz_faengfl_adv_AdvApp.cancel; + com_davidmaletz_controls_ClickableHandler.globalOnMove = com_davidmaletz_faengfl_adv_AdvApp.move; + com_davidmaletz_faengfl_Button.globalOnRelease = com_davidmaletz_faengfl_adv_AdvApp.select; + com_davidmaletz_faengfl_EventHandler.additionalVars = $bind(this,this.additionalVars); + com_davidmaletz_faengfl_EventHandler.getResource = com_davidmaletz_faengfl_adv_AdvApp._getResource; + com_davidmaletz_faengfl_Application.call(this,title,fnt,w,h,smooth,framebuffer,pScale); + com_davidmaletz_faengfl_adv_AdvApp.keyCenter = key; + com_davidmaletz_faengfl_controls_AbstractKey.key_bitmap = com_davidmaletz_faengfl_AutoTileBitmap.get("data/ui/keys.png",Math.round(com_davidmaletz_faengfl_adv_AdvApp.keyCenter.x * 2),Math.round(com_davidmaletz_faengfl_adv_AdvApp.keyCenter.y * 2),com_davidmaletz_faengfl_adv_AdvApp.keyCenter); + com_davidmaletz_faengfl_adv_AdvApp.initFullscreen(); + openfl_Lib.current.stage.addEventListener("activate",$bind(this,this.gain_focus)); + openfl_Lib.current.stage.addEventListener("deactivate",$bind(this,this.lose_focus)); +}; +$hxClasses["com.davidmaletz.faengfl.adv.AdvApp"] = com_davidmaletz_faengfl_adv_AdvApp; +com_davidmaletz_faengfl_adv_AdvApp.__name__ = ["com","davidmaletz","faengfl","adv","AdvApp"]; +com_davidmaletz_faengfl_adv_AdvApp.__interfaces__ = [AbstractClass]; +com_davidmaletz_faengfl_adv_AdvApp.settings = null; +com_davidmaletz_faengfl_adv_AdvApp._saves = null; +com_davidmaletz_faengfl_adv_AdvApp.keyCenter = null; +com_davidmaletz_faengfl_adv_AdvApp.isPaused = function() { + var i = com_davidmaletz_faengfl_adv_AdvApp.getInstance(); + if(i != null) { + return i.__isPaused(); + } else { + return false; + } +}; +com_davidmaletz_faengfl_adv_AdvApp.getInstance = function() { + return js_Boot.__cast(com_davidmaletz_faengfl_Application.instance , com_davidmaletz_faengfl_adv_AdvApp); +}; +com_davidmaletz_faengfl_adv_AdvApp.getContainer = function() { + return com_davidmaletz_faengfl_Application.instance.container; +}; +com_davidmaletz_faengfl_adv_AdvApp._getResource = function(path,id) { + return com_davidmaletz_faengfl_adv_AdvApp.getResource(path,id); +}; +com_davidmaletz_faengfl_adv_AdvApp.getResource = function(path,id,ext) { + if(ext == null) { + ext = true; + } + if(ext && id.indexOf(".") == -1) { + return id; + } + if(StringTools.startsWith(id,"{core}")) { + return "data/core" + id.substring(6); + } else if(StringTools.startsWith(id,"{mod:")) { + try { + var i = id.indexOf("}",5); + var mod = id.substring(5,i); + return com_davidmaletz_faengfl_adv_ModHandler.getModPath(mod) + id.substring(i + 1); + } catch( e ) { + haxe_CallStack.lastException = e; + return path + id; + } + } else { + return path + id; + } +}; +com_davidmaletz_faengfl_adv_AdvApp.getSprite = function(layer) { + var s = com_davidmaletz_faengfl_Application.instance.container; + if(layer > s.get_numChildren()) { + return null; + } else { + return s.getChildAt(layer); + } +}; +com_davidmaletz_faengfl_adv_AdvApp.layersBelowVisible = function(layer,visible) { + var s = com_davidmaletz_faengfl_Application.instance.container; + var len = s.get_numChildren(); + if(layer > len) { + layer = len; + } + var _g1 = 0; + var _g = layer; + while(_g1 < _g) { + var i = _g1++; + s.getChildAt(i).set_visible(visible); + } +}; +com_davidmaletz_faengfl_adv_AdvApp.showUI = function(visible) { + var s = com_davidmaletz_faengfl_Application.instance.container; + var len = s.get_numChildren(); + var UI = com_davidmaletz_faengfl_adv_AdvApp.getInstance().getUILayer(); + var _g1 = UI; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + s.getChildAt(i).set_visible(visible); + } +}; +com_davidmaletz_faengfl_adv_AdvApp.showPopup = function(d) { + com_davidmaletz_faengfl_adv_AdvApp.getContainer().addDisplay(d,com_davidmaletz_faengfl_adv_AdvApp.getInstance().getUILayer()); +}; +com_davidmaletz_faengfl_adv_AdvApp.dualFunc = function(f1,f2) { + if(f1 != null) { + f1(); + } + if(f2 != null) { + f2(); + } +}; +com_davidmaletz_faengfl_adv_AdvApp.closeWindows = function(onComplete) { + var c = com_davidmaletz_faengfl_Application.instance.container; + var UI = com_davidmaletz_faengfl_adv_AdvApp.getInstance().getUILayer(); + if(c.get_numChildren() <= UI) { + if(onComplete != null) { + onComplete(); + } + return; + } + var ui = js_Boot.__cast(c.getChildAt(UI) , openfl_display_Sprite); + var len = ui.get_numChildren(); + var ct = 0; + var func = onComplete == null ? null : function() { + ct -= 1; + if(ct <= 0 && onComplete != null) { + onComplete(); + onComplete = null; + } + }; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + var c1 = ui.getChildAt(i); + if(Std["is"](c1,com_davidmaletz_faengfl_Window)) { + var wnd = js_Boot.__cast(c1 , com_davidmaletz_faengfl_Window); + if(onComplete != null) { + ct += 1; + wnd.onClose = (function(f2,f1) { + return function() { + com_davidmaletz_faengfl_adv_AdvApp.dualFunc(f1[0],f2[0]); + }; + })([func],[wnd.onClose]); + } + wnd.close(); + } + } + if(onComplete != null && ct == 0) { + onComplete(); + } +}; +com_davidmaletz_faengfl_adv_AdvApp.fullscreenChange = function() { + var f = new openfl_events_FullScreenEvent("fullScreen"); + f.fullScreen = com_davidmaletz_faengfl_adv_AdvApp.isFullscreen(); + openfl_Lib.current.stage.dispatchEvent(f); +}; +com_davidmaletz_faengfl_adv_AdvApp.initFullscreen = function() { + var e = com_davidmaletz_faengfl_adv_AdvApp.getElement(); + if(com_davidmaletz_faengfl_adv_AdvApp.getRequestMethod(e)) { + com_davidmaletz_faengfl_adv_AdvApp.getInstance().addFullscreenOption(); + var func = com_davidmaletz_faengfl_adv_AdvApp.fullscreenChange; + document.onfullscreenchange = func; + document.onwebkitfullscreenchange = func; + document.onmozfullscreenchange = func; + document.MSFullscreenChange = func; + } +}; +com_davidmaletz_faengfl_adv_AdvApp.getElement = function() { + return window.document.getElementById('openfl-content'); +}; +com_davidmaletz_faengfl_adv_AdvApp.getRequestMethod = function(e) { + return e.requestFullScreen || e.webkitRequestFullScreen || e.mozRequestFullScreen || e.msRequestFullScreen; +}; +com_davidmaletz_faengfl_adv_AdvApp.toggleFullscreen = function() { + if(com_davidmaletz_faengfl_adv_AdvApp.isFullscreen()) { + + if(document.exitFullscreen) document.exitFullscreen(); + else if(document.msExitFullscreen) document.msExitFullscreen(); + else if(document.mozCancelFullScreen) document.mozCancelFullScreen(); + else if(document.webkitExitFullscreen) document.webkitExitFullscreen(); + ; + } else { + var e = com_davidmaletz_faengfl_adv_AdvApp.getElement(); + var req = com_davidmaletz_faengfl_adv_AdvApp.getRequestMethod(e); + if(req) { + req.call(e); + } + } +}; +com_davidmaletz_faengfl_adv_AdvApp.isFullscreen = function() { + return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement; +}; +com_davidmaletz_faengfl_adv_AdvApp.select = function() { + com_davidmaletz_faengfl_adv_sound_Sound.play("select"); +}; +com_davidmaletz_faengfl_adv_AdvApp.cancel = function() { + com_davidmaletz_faengfl_adv_sound_Sound.play("cancel"); +}; +com_davidmaletz_faengfl_adv_AdvApp.move = function() { + com_davidmaletz_faengfl_adv_sound_Sound.play("move"); +}; +com_davidmaletz_faengfl_adv_AdvApp.__super__ = com_davidmaletz_faengfl_Application; +com_davidmaletz_faengfl_adv_AdvApp.prototype = $extend(com_davidmaletz_faengfl_Application.prototype,{ + __isPaused: function() { + return com_davidmaletz_faengfl_Window.window_ct > 0; + } + ,start: function() { + com_davidmaletz_faengfl_adv_ModHandler.loadData(); + com_davidmaletz_faengfl_SoundManager.init(com_davidmaletz_faengfl_adv_AdvApp.settings,$bind(this,this.splash)); + } + ,splash: function() { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,getUILayer: function() { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,getTransitionLayer: function() { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,updatePlayerVars: function(vars) { + return vars; + } + ,getForcedTrack: function() { + return null; + } + ,getPlayerPos: function() { + return null; + } + ,addFrameListener: function(func) { + var _gthis = this; + var f = null; + f = function(e) { + if(!func()) { + _gthis.removeEventListener("enterFrame",f); + } + }; + this.addEventListener("enterFrame",f); + } + ,init: function(e) { + com_davidmaletz_faengfl_Application.prototype.init.call(this,e); + openfl_Lib.current.stage.addEventListener("keyDown",$bind(this,this.key_down),false,100); + openfl_Lib.current.stage.addEventListener("keyUp",$bind(this,this.key_up),false,100); + } + ,destroy: function(e) { + com_davidmaletz_faengfl_Application.prototype.destroy.call(this,e); + openfl_Lib.current.stage.removeEventListener("keyDown",$bind(this,this.key_down)); + openfl_Lib.current.stage.removeEventListener("keyUp",$bind(this,this.key_up)); + } + ,handleAction: function(t,vars,item) { + return com_davidmaletz_faengfl_DeveloperConsole.defaultAction(t,vars,item); + } + ,updatePlayer: function() { + } + ,handleShift: function(down) { + com_davidmaletz_faengfl_adv_AdvApp.shiftDown = down; + } + ,key_down: function(e) { + if(e.keyCode == 16) { + this.handleShift(true); + } else { + this.handleShift(e.shiftKey); + } + if(e.keyCode == 17) { + com_davidmaletz_faengfl_adv_AdvApp.ctrlDown = true; + } else { + com_davidmaletz_faengfl_adv_AdvApp.ctrlDown = e.ctrlKey; + } + if(e.altKey && e.keyCode == 13) { + e.stopImmediatePropagation(); + } + if(e.shiftKey && e.ctrlKey && e.keyCode == 68) { + e.stopImmediatePropagation(); + } + } + ,key_up: function(e) { + if(e.keyCode == 16) { + this.handleShift(false); + } + if(e.keyCode == 17) { + com_davidmaletz_faengfl_adv_AdvApp.ctrlDown = false; + } + if(e.altKey && e.keyCode == 13) { + com_davidmaletz_faengfl_adv_AdvApp.toggleFullscreen(); + com_davidmaletz_faengfl_adv_AdvApp.settings.flush(); + e.stopImmediatePropagation(); + } + if(e.shiftKey && e.ctrlKey && e.keyCode == 68) { + com_davidmaletz_faengfl_DeveloperConsole.toggle(); + this.updatePlayer(); + e.stopImmediatePropagation(); + } + } + ,reload: function() { + com_davidmaletz_faengfl_adv_ModHandler.reloadData(); + } + ,focus_popup: null + ,gain_focus: function(e) { + if(this.focus_popup != null && this.focus_popup.stage != null) { + var d = this.focus_popup; + var tmp = function() { + com_davidmaletz_faengfl_FaengFL.remove(d); + }; + this.focus_popup.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),10,tmp); + } + this.addFrameListener(function() { + com_davidmaletz_faengfl_adv_AdvApp.hasFocus = true; + return false; + }); + com_davidmaletz_faengfl_SoundManager.setMuted(Reflect.field(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"muted") == true,false); + } + ,lose_focus: function(e) { + com_davidmaletz_controls_Controller.instance.releaseAll(); + com_davidmaletz_faengfl_adv_AdvApp.shiftDown = false; + com_davidmaletz_faengfl_adv_AdvApp.ctrlDown = false; + com_davidmaletz_faengfl_adv_AdvApp.hasFocus = false; + if(this.focus_popup == null) { + this.focus_popup = new com_davidmaletz_lerp_LerpSprite(); + this.focus_popup.set_x(this._width * 0.5); + this.focus_popup.set_y(this._height * 0.5); + com_davidmaletz_faengfl_ui_Tooltip.draw(this.focus_popup,com_fancyfish_faeng_common_Lang.getText("warning","focus")); + } + if(this.focus_popup.stage == null) { + this.focus_popup.set_alpha(0); + this.focus_popup.get_graphics().clear(); + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this.focus_popup); + com_davidmaletz_faengfl_ui_Tooltip.draw(this.focus_popup,com_fancyfish_faeng_common_Lang.getText("warning","focus")); + this.focus_popup.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),10); + com_davidmaletz_faengfl_adv_AdvApp.getContainer().addDisplay(this.focus_popup,this.getTransitionLayer() + 1); + } + com_davidmaletz_faengfl_SoundManager.setMuted(true,false); + } + ,addFullscreenOption: function() { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,additionalVars: function(v) { + com_davidmaletz_faengfl_adv_ModHandler.addVars(v); + } + ,__class__: com_davidmaletz_faengfl_adv_AdvApp +}); +var com_davidmaletz_faengfl_EnterFrameHandler = function() { }; +$hxClasses["com.davidmaletz.faengfl.EnterFrameHandler"] = com_davidmaletz_faengfl_EnterFrameHandler; +com_davidmaletz_faengfl_EnterFrameHandler.__name__ = ["com","davidmaletz","faengfl","EnterFrameHandler"]; +com_davidmaletz_faengfl_EnterFrameHandler.prototype = { + enter_frame: null + ,__class__: com_davidmaletz_faengfl_EnterFrameHandler +}; +var com_davidmaletz_mining_Main = function() { + this.game_time = -1; + try { + com_davidmaletz_faengfl_DeveloperConsole.promptSendReport = com_davidmaletz_mining_Main.promptSendReport; + com_davidmaletz_faengfl_FaengFL.isPaused = com_davidmaletz_mining_Main.isPaused; + com_davidmaletz_faengfl_adv_ModHandler.dispatcher.addEventListener("reload",function(e) { + com_davidmaletz_mining_item_Recipe.fixCreates(); + }); + com_davidmaletz_mining_Main.damageFont = new com_fancyfish_faeng_common_mutable_Mutable(); + com_davidmaletz_mining_Main.healFont = new com_fancyfish_faeng_common_mutable_Mutable(); + com_davidmaletz_mining_Main.damageFont.set(com_fancyfish_faeng_common_Lang.getFontCached("data/fonts/damage.fnt",false)); + com_davidmaletz_mining_Main.healFont.set(com_fancyfish_faeng_common_Lang.getFontCached("data/fonts/heal.fnt",false)); + com_davidmaletz_mining_Main.label_factory = new com_davidmaletz_mining_ui_LabelFactory(false); + com_davidmaletz_mining_Main.icon_factory = new com_davidmaletz_mining_ui_LabelFactory(true); + com_davidmaletz_faengfl_Application.button_factory = new com_davidmaletz_mining_ui_MyButtonFactory(); + com_davidmaletz_mining_Main.window_factory = new com_davidmaletz_mining_ui_WindowFactory(); + var s = new com_davidmaletz_mining_ui_ScrollbarUI(); + com_davidmaletz_controls_scroll_Scrollbar.ui = s; + com_davidmaletz_controls_Slider.ui = new com_davidmaletz_mining_ui_MySliderUI(s); + com_davidmaletz_faengfl_adv_AdvApp.call(this,"Aground","data/fonts/font.fnt",256,144,new openfl_geom_Point(16,16),false,true,com_davidmaletz_mining_Main.PSCALE); + com_davidmaletz_lerp_PositionKeyframe.ROUND = true; + com_davidmaletz_faengfl_ui_FormattedTooltip.createFormattedText = com_davidmaletz_mining_Main.myCreateFormattedText; + var settings = com_davidmaletz_faengfl_adv_AdvApp.settings; + var c = new com_davidmaletz_mining_MyController(settings); + c.addEventListener("tap",$bind(this,this.onKey),false,1000); + c.addEventListener("press",$bind(this,this.onKeyDown),false,1000); + c.addEventListener("release",$bind(this,this.onKeyUp),false,1000); + new com_davidmaletz_mining_MyAchievements(settings); + com_davidmaletz_faengfl_adv_ModHandler.addActionEntries = com_davidmaletz_mining_Main.addActionEntries; + com_davidmaletz_faengfl_adv_ModHandler.onReset = com_davidmaletz_mining_Main.resetEntries; + var d = Reflect.field(settings.data,"text_speed"); + if(d != null) { + com_davidmaletz_faengfl_RevealText.TEXT_SPEED = d; + } + var d1 = Reflect.field(settings.data,"notify_away"); + if(d1 != null) { + com_davidmaletz_mining_npc_NPC.NOTIFY_AWAY = d1; + } + var d2 = Reflect.field(settings.data,"auto_heal"); + if(d2 != null) { + com_davidmaletz_mining_Player.AUTO_HEAL = d2; + } + var d3 = Reflect.field(settings.data,"auto_stamina"); + if(d3 != null) { + com_davidmaletz_mining_Player.AUTO_STAMINA = d3; + } + var d4 = Reflect.field(settings.data,"mine_walkways"); + if(d4 != null) { + com_davidmaletz_mining_world_Area.MINE_WALKWAYS = d4; + } + var d5 = Reflect.field(settings.data,"blueprint_all"); + if(d5 != null) { + com_davidmaletz_mining_ui_InventoryList.BLUEPRINT_ALL = d5; + } + var d6 = Reflect.field(settings.data,"notifications"); + if(d6 != null) { + com_davidmaletz_mining_ui_NotificationQueue.OPTIONS = d6; + } + var d7 = Reflect.field(settings.data,"max_overweight"); + if(d7 != null) { + com_davidmaletz_mining_renderer_PlayerRenderer.max_overweight = d7; + } + var d8 = Reflect.field(settings.data,"move_all"); + if(d8 != null) { + com_davidmaletz_mining_Player.MOVE_ALL = d8; + } + var d9 = Reflect.field(settings.data,"fade_ui"); + if(d9 != null) { + com_davidmaletz_mining_ui_GUI.FADE = d9; + } + var d10 = Reflect.field(settings.data,"no_count"); + if(d10 != null) { + com_davidmaletz_mining_Main.NO_COUNT = d10; + } + var d11 = Reflect.field(settings.data,"allow_flash"); + if(d11 != null) { + com_davidmaletz_mining_Main.ALLOW_FLASH = d11; + } + var d12 = Reflect.field(settings.data,"warn_toss"); + if(d12 != null) { + com_davidmaletz_mining_Player.WARN_TOSS = d12; + } + var d13 = Reflect.field(settings.data,"item_discover"); + if(d13 != null) { + com_davidmaletz_mining_Player.ITEM_DISCOVER = d13; + } + var d14 = Reflect.field(settings.data,"blueprint_place"); + if(d14 != null) { + com_davidmaletz_mining_Player.BLUEPRINT_PLACE = d14; + } + var d15 = Reflect.field(settings.data,"talk_quest"); + if(d15 != null) { + com_davidmaletz_mining_Player.TALK_QUEST = d15; + } + var d16 = Reflect.field(settings.data,"auto_collect"); + if(d16 != null) { + com_davidmaletz_mining_Player.AUTO_COLLECT = typeof(d16) == "boolean" ? d16 ? 0 : -1 : d16; + } + var d17 = Reflect.field(settings.data,"hotkey_switch"); + if(d17 != null) { + com_davidmaletz_mining_Player.HOTKEY_SWITCH = d17; + } + var d18 = Reflect.field(settings.data,"storehouse_priority"); + if(d18 != null) { + com_davidmaletz_mining_Player.STOREHOUSE_PRIORITY = d18; + } + this.fullRes = new com_davidmaletz_faengfl_ContainerSprite(256,144); + this.start(); + com_davidmaletz_mining_world_ObjectInfo.loadInfo(new com_davidmaletz_mining_world_BlueprintInfo()); + com_davidmaletz_mining_network_CloudSaves.init(); + var elem = window.document.getElementById('openfl-content'); + elem.addEventListener("dragover",com_davidmaletz_mining_Main.preventDefault,false); + elem.addEventListener("dragleave",com_davidmaletz_mining_Main.preventDefault,false); + elem.addEventListener("drop",com_davidmaletz_mining_Main.dropFile,false); + if(com_davidmaletz_faengfl_adv_ModHandler.getModInfo("full_version") == null) { + com_davidmaletz_mining_Main.allowMultiplayer = false; + } + var d19 = Reflect.field(settings.data,"difficulty"); + if(d19 != null) { + com_davidmaletz_mining_DifficultyMode.__current = com_davidmaletz_mining_DifficultyMode.get(Std.string(d19)); + } + } catch( e1 ) { + haxe_CallStack.lastException = e1; + if (e1 instanceof js__$Boot_HaxeError) e1 = e1.val; + openfl_events_EventDispatcher.throwCriticalError(e1); + } +}; +$hxClasses["com.davidmaletz.mining.Main"] = com_davidmaletz_mining_Main; +com_davidmaletz_mining_Main.__name__ = ["com","davidmaletz","mining","Main"]; +com_davidmaletz_mining_Main.__interfaces__ = [com_davidmaletz_faengfl_EnterFrameHandler]; +com_davidmaletz_mining_Main.damageFont = null; +com_davidmaletz_mining_Main.healFont = null; +com_davidmaletz_mining_Main.promptSendReport = function(func) { + var c = com_davidmaletz_mining_Main.getFullRes(); + com_davidmaletz_faengfl_Application.instance.addChild(c); + var i = com_davidmaletz_faengfl_adv_ModHandler.getModInfo("core"); + if(i == null || i.error || !openfl_Assets.exists("data/ui/achievement_bg.png") || !openfl_Assets.exists("data/ui/title_full.jpg")) { + c.addDisplay(new com_davidmaletz_mining_ui_Prompt(c,com_fancyfish_faeng_common_Lang.getText("warning","load_fail_js"),null),2); + } else { + c.addDisplay(new com_davidmaletz_mining_ui_Prompt(c,com_fancyfish_faeng_common_Lang.getText("warning","send_bug_report"),func),2); + } +}; +com_davidmaletz_mining_Main.updateDevVars = function(vars) { + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p == null) { + com_davidmaletz_mining_npc_NPCEventHandler.clearPlayerVariables(vars); + } else { + com_davidmaletz_mining_npc_NPCEventHandler.setPlayerVariables(vars,p); + } + return p; +}; +com_davidmaletz_mining_Main.myCreateFormattedText = function(w,align) { + return new com_davidmaletz_mining_ui_MyFormattedText(w,true,null,align); +}; +com_davidmaletz_mining_Main.isTitleScreen = function() { + var c = com_davidmaletz_faengfl_Application.instance.container; + if(c.get_numChildren() > 0) { + var child = js_Boot.__cast(c.getChildAt(0) , openfl_display_Sprite); + if(child.get_numChildren() > 0) { + return Std["is"](child.getChildAt(0),com_davidmaletz_mining_ui_TitleScreen); + } else { + return false; + } + } else { + return false; + } +}; +com_davidmaletz_mining_Main.preventDefault = function(e) { + e.stopPropagation(); + e.preventDefault(); +}; +com_davidmaletz_mining_Main.importFile = function(e) { + var a1 = e.target.result; + com_davidmaletz_mining_Main.closeWindows(function() { + com_davidmaletz_mining_ui_Options.importFile(a1); + }); +}; +com_davidmaletz_mining_Main.dropFile = function(e) { + com_davidmaletz_mining_Main.preventDefault(e); + var files = e.target.files || e.dataTransfer.files; + if(files && files.length > 0) { + if(!com_davidmaletz_mining_Main.isTitleScreen()) { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_DialogueBox(c,com_fancyfish_faeng_common_Lang.getText("options","import_save").get()),2); + return; + } + var reader = new FileReader(); + reader.onload = com_davidmaletz_mining_Main.importFile; + reader.readAsText(files[0]); + } +}; +com_davidmaletz_mining_Main.setGameScale = function(scale) { + var s = com_davidmaletz_faengfl_Application.instance.container; + if(s.get_numChildren() <= 1) { + return; + } + var a = s.getChildAt(0); + var b = s.getChildAt(1); + a.set_scaleX(b.set_scaleX(a.set_scaleY(b.set_scaleY(1.0 / scale)))); +}; +com_davidmaletz_mining_Main._getScale = function() { + return com_davidmaletz_faengfl_Application._getScale(); +}; +com_davidmaletz_mining_Main.getGameScale = function() { + return Math.round(1.0 / com_davidmaletz_mining_Main._getScale()); +}; +com_davidmaletz_mining_Main.isNight = function() { + var t = (js_Boot.__cast(com_davidmaletz_faengfl_Application.instance , com_davidmaletz_mining_Main)).game_time; + if(!(t < 5)) { + return t > 20; + } else { + return true; + } +}; +com_davidmaletz_mining_Main._getGameTime = function() { + return (js_Boot.__cast(com_davidmaletz_faengfl_Application.instance , com_davidmaletz_mining_Main)).getGameTime(); +}; +com_davidmaletz_mining_Main._setGameTime = function(t,frames,forwards,onComplete) { + if(forwards == null) { + forwards = true; + } + if(frames == null) { + frames = 0; + } + var s = com_davidmaletz_mining_Main.getLocalState(); + var f = Math.round(frames); + if(s != null) { + s.dispatchEvent(new com_davidmaletz_mining_TimeEvent("set_time",t,f,forwards)); + } + com_davidmaletz_mining_Main.__setGameTime(t,f,forwards); + if(onComplete != null) { + if(f <= 0) { + onComplete(); + } else { + var m = js_Boot.__cast(com_davidmaletz_faengfl_Application.instance , com_davidmaletz_mining_Main); + m.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),f,onComplete); + } + } +}; +com_davidmaletz_mining_Main.__setGameTime = function(t,f,forwards) { + if(forwards == null) { + forwards = true; + } + if(f == null) { + f = 0; + } + var m = js_Boot.__cast(com_davidmaletz_faengfl_Application.instance , com_davidmaletz_mining_Main); + if(f <= 0) { + m.setGameTime(t); + } else { + t = com_fancyfish_faeng_common_Utils.mod(t,24); + var from = com_davidmaletz_mining_Main._getGameTime(); + if(forwards) { + if(t < from) { + t += 24; + } + } else if(t > from) { + t -= 24; + } + m.lerp(new com_davidmaletz_mining_TimeKeyframe(t),f); + } +}; +com_davidmaletz_mining_Main._addEventListener = function(type,listener) { + com_davidmaletz_faengfl_Application.instance.addEventListener(type,listener); +}; +com_davidmaletz_mining_Main._removeEventListener = function(type,listener) { + com_davidmaletz_faengfl_Application.instance.removeEventListener(type,listener); +}; +com_davidmaletz_mining_Main.getContainer = function() { + return com_davidmaletz_faengfl_adv_AdvApp.getContainer(); +}; +com_davidmaletz_mining_Main.getSprite = function(layer) { + return com_davidmaletz_faengfl_adv_AdvApp.getSprite(layer); +}; +com_davidmaletz_mining_Main.layersBelowVisible = function(layer,visible) { + com_davidmaletz_faengfl_adv_AdvApp.layersBelowVisible(layer,visible); +}; +com_davidmaletz_mining_Main.showUI = function(visible) { + com_davidmaletz_faengfl_adv_AdvApp.showUI(visible); +}; +com_davidmaletz_mining_Main.showLight = function(visible) { + var s = com_davidmaletz_faengfl_Application.instance.container; + if(s.get_numChildren() > 1) { + s.getChildAt(1).set_visible(visible); + } +}; +com_davidmaletz_mining_Main.getFullRes = function() { + return (js_Boot.__cast(com_davidmaletz_faengfl_Application.instance , com_davidmaletz_mining_Main)).fullRes; +}; +com_davidmaletz_mining_Main.setColorMatrix = function(m) { + (js_Boot.__cast(com_davidmaletz_faengfl_Application.instance.container , com_davidmaletz_faengfl_FramebufferSprite)).colorMatrix = m; +}; +com_davidmaletz_mining_Main.updateSettings = function(data) { + var settings = com_davidmaletz_faengfl_adv_AdvApp.settings; + settings.data = data; + com_davidmaletz_mining_ui_Options.updateSettings(); + com_davidmaletz_controls_Controller.instance.updateSettings(); + com_davidmaletz_faengfl_achievement_Achievements.instance.updateSettings(); + com_davidmaletz_faengfl_SoundManager.updateSettings(); + settings.flush(); +}; +com_davidmaletz_mining_Main.slot = null; +com_davidmaletz_mining_Main.saveTime = null; +com_davidmaletz_mining_Main.loadTime = null; +com_davidmaletz_mining_Main.lastSaveTime = null; +com_davidmaletz_mining_Main.writeHeader = function(b,player) { + var area = player.getCurrentArea(); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,area == null ? null : area.get_name()); + b.writeInt8(Math.floor((js_Boot.__cast(com_davidmaletz_faengfl_Application.instance , com_davidmaletz_mining_Main)).getTargetTime())); + com_davidmaletz_mining_world_Object.save(player,b); + com_davidmaletz_mining_Main.lastSaveTime = com_davidmaletz_mining_Main.time(); + var t = Math.round(com_davidmaletz_mining_Main.saveTime + com_davidmaletz_mining_Main.lastSaveTime - com_davidmaletz_mining_Main.loadTime); + b.writeInt32(t); +}; +com_davidmaletz_mining_Main.time = function() { + return new Date().getTime() / 1000.0; +}; +com_davidmaletz_mining_Main.sinceLastSave = function() { + return com_davidmaletz_mining_Main.time() - com_davidmaletz_mining_Main.lastSaveTime; +}; +com_davidmaletz_mining_Main.readHeader = function(b,version) { + var n = version < 43 ? null : com_fancyfish_faeng_common_UTFUtils.readUTF(b); + var ver = version; + var gt = 6; + if(version >= 51) { + gt = b.readInt8(); + } + var p = null; + com_davidmaletz_mining_world_Object.load(b,version,function(o) { + p = o; + }); + if(version < 31) { + p.location = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + } + var t = b.readInt32(); + return { player : p, area : p.location, area_name : n, time : t, version : ver, game_time : gt}; +}; +com_davidmaletz_mining_Main.getSlotHeader = function(slot) { + var save = com_davidmaletz_faengfl_adv_AdvApp.saves.get(slot); + try { + var b = com_davidmaletz_mining_Main._load(save); + var ver = b.readUInt16(); + if(!com_davidmaletz_mining_Main.canLoad(ver)) { + throw new js__$Boot_HaxeError("Bad save version."); + } + return com_davidmaletz_mining_Main.readHeader(b,ver); + } catch( e ) { + haxe_CallStack.lastException = e; + if (e instanceof js__$Boot_HaxeError) e = e.val; + if(save != null) { + com_fancyfish_faeng_common_Utils.printExceptionTrace(e); + } + return save == null; + } +}; +com_davidmaletz_mining_Main.exportSlot = function(slot) { + var save = com_davidmaletz_faengfl_adv_AdvApp.saves.get(slot); + try { + return haxe_crypto_Base64.encode(save); + } catch( e ) { + haxe_CallStack.lastException = e; + return null; + } +}; +com_davidmaletz_mining_Main.importSlot = function(data) { + try { + var bytes = haxe_crypto_Base64.decode(data); + var b = new haxe_io_BytesInput(bytes); + var ver = b.readUInt16(); + if(!com_davidmaletz_mining_Main.canLoad(ver)) { + throw new js__$Boot_HaxeError("Bad save version: " + ver); + } + var h = com_davidmaletz_mining_Main.readHeader(b,ver); + return { data : bytes, header : h, version : ver}; + } catch( e ) { + haxe_CallStack.lastException = e; + if (e instanceof js__$Boot_HaxeError) e = e.val; + com_fancyfish_faeng_common_Utils.printExceptionTrace(e); + return null; + } +}; +com_davidmaletz_mining_Main.makeSave = function(player,remotePlayers,a) { + var m = com_davidmaletz_mining_Main.getInstance(); + var old = m.player; + m.player = player; + var b = new haxe_io_BytesOutput(); + b.writeUInt16(81); + com_davidmaletz_mining_Main.writeHeader(b,player); + player.state.write(b); + player.areas.write(b); + var s = remotePlayers.keys(); + while(s.hasNext()) { + var s1 = s.next(); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,s1); + com_davidmaletz_mining_Main.saveRemotePlayer(remotePlayers.get(s1),b); + } + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + if(a.vehicle != null) { + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,a.vehicle.info.id); + b.writeInt32(a.vehicle.xPos); + b.writeInt32(a.vehicle.yTile); + var loc = a.vehicle.area.id; + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,loc); + if(!player.areas.exists(loc)) { + a.vehicle.area.write(b); + } + } else { + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + if(!player.areas.exists(player.location)) { + a.write(b); + } + } + b.flush(); + b.close(); + m.player = old; + return b.getBytes(); +}; +com_davidmaletz_mining_Main.save = function(player) { + if(player.vehicle != null) { + player.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","no_use_vehicle")); + return; + } + var a = player.getCurrentArea(); + if(a == null && player.location != null) { + a = com_davidmaletz_mining_world_Area.getById(player.__location_id,null); + } + if(a == null || com_davidmaletz_mining_Main.slot == null || com_davidmaletz_mining_Main.sinceLastSave() < 1) { + return; + } + com_davidmaletz_mining_Main.setSlot(com_davidmaletz_mining_Main.slot,com_davidmaletz_mining_Main.makeSave(player,com_davidmaletz_mining_Main.getInstance().remotePlayers,a)); + com_davidmaletz_mining_Main.getContainer().addDisplay(new com_davidmaletz_faengfl_ui_Popup(128.,72.,0,com_fancyfish_faeng_common_Lang.getText("common","save")),3); + com_davidmaletz_faengfl_adv_sound_Sound.play("game_saved"); +}; +com_davidmaletz_mining_Main["delete"] = function(slot) { + var _saves = com_davidmaletz_faengfl_adv_AdvApp._saves; + com_davidmaletz_faengfl_adv_AdvApp.saves.remove(slot); + if(Reflect.field(_saves.data,slot) != null) { + Reflect.setField(_saves.data,slot,null); + _saves.flush(); + return true; + } else { + return false; + } +}; +com_davidmaletz_mining_Main.deleteSave = function(slot,popup) { + if(com_davidmaletz_mining_Main["delete"](slot)) { + if(popup) { + new com_davidmaletz_faengfl_ui_Popup(128.,72.,0,com_fancyfish_faeng_common_Lang.getText("common","del_save")); + } + com_davidmaletz_mining_network_CloudSaves.updateSlot(slot,null); + } +}; +com_davidmaletz_mining_Main.setSlot = function(slot,data,upload) { + if(upload == null) { + upload = true; + } + var _saves = com_davidmaletz_faengfl_adv_AdvApp._saves; + var b = data; + com_davidmaletz_faengfl_adv_AdvApp.saves.set(slot,b); + Reflect.setField(_saves.data,slot,b); + _saves.flush(); + if(upload) { + com_davidmaletz_mining_network_CloudSaves.updateSlot(slot,data); + } +}; +com_davidmaletz_mining_Main.canLoad = function(ver) { + if(ver >= 11) { + return ver <= 81; + } else { + return false; + } +}; +com_davidmaletz_mining_Main._load = function(data) { + if(data == null) { + throw new js__$Boot_HaxeError("No save data."); + } + var b = new haxe_io_BytesInput(data); + return b; +}; +com_davidmaletz_mining_Main.hasSave = function(slot) { + return com_davidmaletz_faengfl_adv_AdvApp.saves.get(slot) != null; +}; +com_davidmaletz_mining_Main.slotToId = function(slot) { + return "slot" + slot; +}; +com_davidmaletz_mining_Main.idToSlot = function(slot) { + return com_davidmaletz_mining_Main.parseInt(HxOverrides.substr(slot,4,null)); +}; +com_davidmaletz_mining_Main.getArea = function(player,id,b,ver) { + if(player.areas.exists(id)) { + return player.areas.__get(id); + } else { + return com_davidmaletz_mining_world_Area.readArea(id,b,ver); + } +}; +com_davidmaletz_mining_Main.getVehicle = function(area,vehicle,x,y) { + var o = area.getObjectsInTile(Math.round(x / com_davidmaletz_tiles_Tile.SIZE),Math.round(y / com_davidmaletz_tiles_Tile.SIZE)); + while(o.hasNext()) { + var o1 = o.next(); + if(o1.info.id == vehicle && o1.xPos == x && o1.yTile == y && Std["is"](o1,com_davidmaletz_mining_world_RideableObject)) { + return o1; + } + } + return null; +}; +com_davidmaletz_mining_Main.saveRemotePlayer = function(p,b) { + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,p.__ban_data); + var v = p.vehicle; + var a = p.area; + var old_loc = p.location; + var old_prev = p.prevLocation; + var old_x = p.prevX; + var old_y = p.prevY; + if(v != null) { + v.checkDroneArea(); + var i = v.getInfo(); + if(i.interior != null && v.health > 0) { + p.setPosition(i.interior.operateX,i.interior.operateY); + a = v.getInterior(p.areas,i); + } else if(v.droneArea == null) { + v.dismountPos(p); + a = v.area; + } else { + p.setPosition(v.droneX,v.droneY); + a = v.droneArea; + p.prevLocation = v.dronePrevArea; + p.prevX = v.dronePrevX; + p.prevY = v.dronePrevY; + } + if(a != null) { + p.location = a.id; + } + p.set_vehicle(null); + } + com_davidmaletz_mining_world_Object.save(p,b); + p.location = old_loc; + p.prevLocation = old_prev; + p.prevX = old_x; + p.prevY = old_y; + p.set_vehicle(v); + if(a == null) { + a = com_davidmaletz_mining_world_Area.getById(p.__location_id,null); + } + if(a != null && a.vehicle != null) { + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,a.vehicle.info.id); + b.writeInt32(a.vehicle.xPos); + b.writeInt32(a.vehicle.yTile); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,a.vehicle.area.id); + } else { + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + } +}; +com_davidmaletz_mining_Main.loadRemotePlayer = function(areas,b,ver) { + var ban = ver >= 77 ? com_fancyfish_faeng_common_UTFUtils.readUTF(b) : null; + var player = null; + com_davidmaletz_mining_world_Object.load(b,ver,function(o) { + player = o; + }); + player.__ban_data = ban; + var vid = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + var area = null; + if(vid != null) { + var vx = b.readInt32(); + var vy = b.readInt32(); + var va = areas.__get(com_fancyfish_faeng_common_UTFUtils.readUTF(b)); + if(va == null) { + return player; + } + var v = com_davidmaletz_mining_Main.getVehicle(va,vid,vx,vy); + if(v == null) { + player.location = va.id; + area = va; + player.setPosition(vx,vy); + } else { + area = v.getInterior(areas,v.getRideableInfo()); + } + } else { + area = areas.__get(player.location); + } + if(area != null) { + player.__location_id = area.__id; + } + return player; +}; +com_davidmaletz_mining_Main.runOnLoad = function(p,ver) { + var v = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(p); + v.set("version",ver); + com_davidmaletz_mining_Main.runNext(p,v,com_davidmaletz_faengfl_adv_ModHandler.onLoad.length - 1); + p.dispatchEvent(new openfl_events_Event("teleport")); +}; +com_davidmaletz_mining_Main.runNext = function(p,v,i) { + if(i < 0) { + return; + } + var p1 = p; + var v1 = v; + var i1 = i - 1; + var n = function() { + com_davidmaletz_mining_Main.runNext(p1,v1,i1); + }; + var n1 = new com_davidmaletz_mining_npc_NPCEventHandler(com_davidmaletz_faengfl_adv_ModHandler.onLoad[i].elements(),p,null,n,v); + n1.__is_action_key = true; + n1.runAll(); +}; +com_davidmaletz_mining_Main.switchBg = function(player,r) { + var p = com_davidmaletz_mining_renderer_Parallax.instance; + if(p == null) { + com_davidmaletz_faengfl_adv_AdvApp.getSprite(0).removeChildAt(0); + } else { + com_davidmaletz_faengfl_FaengFL.remove(p); + if(p.top != null) { + com_davidmaletz_faengfl_FaengFL.remove(p.top); + } + } + com_davidmaletz_mining_Main.addBG(player,com_davidmaletz_mining_Main.getContainer(),r); +}; +com_davidmaletz_mining_Main.addBG = function(player,c,r) { + var v = r.area.vehicle; + var bg = com_davidmaletz_mining_world_Generate.getBackground(v == null ? r.area.id : v.area.id); + if(bg == "black") { + com_davidmaletz_mining_renderer_Parallax.clear(); + c.addDisplay(r.parallax_back,0,true); + return null; + } else { + var p = com_davidmaletz_mining_renderer_Parallax.create(player,r,bg); + if(p == null) { + com_davidmaletz_mining_renderer_Parallax.clear(); + c.addDisplay(r.parallax_back,0,true); + } else { + c.addDisplay(p,0,true); + var xml = com_davidmaletz_mining_world_Generate.get(r.area.id); + if(xml != null && xml.exists("forceTime")) { + p.forceTime = com_davidmaletz_mining_Main.parseFloat(xml.get("forceTime")); + } + if(v != null) { + com_davidmaletz_lerp_DarkenKeyframe.setDarkness(p,0.3); + } + if(p.top != null && v == null) { + c.addDisplay(p.top,1); + } + } + return p; + } +}; +com_davidmaletz_mining_Main.setAmbient = function(area,c) { + var s = com_davidmaletz_faengfl_Application.instance.container; + if(com_davidmaletz_mining_Main.getLocalPlayer() == null || s.get_numChildren() == 0 || !s.getChildAt(0).get_visible()) { + return; + } + var d = area == null ? 1 : com_fancyfish_faeng_common_Utils.clamp(1.0 + area.get_y() * area.area.getDropoff(),0,1); + if(s.get_numChildren() > 2) { + var r = c.r * d * 0.4 + 0.6; + var g = c.g * d * 0.4 + 0.6; + var b = c.b * d * 0.4 + 0.6; + var len = s.get_numChildren(); + var _g1 = 2; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + com_davidmaletz_mining_renderer_Parallax.setColor(s.getChildAt(i),r,g,b); + } + } +}; +com_davidmaletz_mining_Main.currentAreaRenderer = null; +com_davidmaletz_mining_Main.clearAll = function() { + com_davidmaletz_mining_Main.currentAreaRenderer = null; + com_davidmaletz_faengfl_FaengFL.removeAllChildren(com_davidmaletz_faengfl_Application.instance.container); + com_davidmaletz_faengfl_DeveloperConsole.hide(); +}; +com_davidmaletz_mining_Main.setArea = function(scale,area,ver,vr) { + if(ver == null) { + ver = 81; + } + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + com_davidmaletz_mining_world_Object.blocker_obj = null; + com_davidmaletz_mining_world_Object.blocker_struc = null; + var s = com_davidmaletz_faengfl_Application.instance.container; + var ot = s.get_numChildren() > 5 ? s.getChildAt(5) : null; + com_davidmaletz_mining_Main.clearAll(); + s.addChild(new com_davidmaletz_lerp_LerpSpriteFL()); + var _g = 1; + while(_g < 5) { + var i = _g++; + s.addChild(new openfl_display_Sprite()); + } + if(ot != null) { + s.addChild(ot); + } + var c = com_davidmaletz_mining_Main.getContainer(); + var player = com_davidmaletz_mining_Main.getLocalPlayer(); + player.load(area); + if(scale != 1) { + com_davidmaletz_mining_Main.setGameScale(scale); + } + var r = new com_davidmaletz_mining_renderer_AreaRenderer(area); + var sl = area.shouldLight() && openfl_display_OpenGLView.get_isSupported(); + com_davidmaletz_mining_Main.currentAreaRenderer = r; + if(sl) { + var l = com_davidmaletz_mining_renderer_DarkLight.create(r,c); + r.light = l; + c.addDisplay(l,1); + } else { + com_davidmaletz_mining_renderer_DarkLight.clear(); + } + var o = player.vehicle == null ? player : player.vehicle; + var x = o.getCenterX(); + var y = o.getCenterY(); + if(vr != null) { + var r1 = js_Boot.__cast(vr , com_davidmaletz_mining_world_vehicle_VehicleRenderer); + x += r1.getCamOffX(); + y += r1.getCamOffY(); + } + r.centerOn(x,y,o != player || player.cameraCentered(),true); + com_davidmaletz_mining_Main.addBG(player,c,r); + com_davidmaletz_mining_renderer_Parallax.setTime(com_davidmaletz_mining_Main._getGameTime()); + c.addDisplay(r,0); + com_davidmaletz_mining_Main.setAmbient(r,sl ? com_davidmaletz_mining_renderer_Parallax.getAmbientColor() : com_fancyfish_faeng_renderer_Color.WHITE); + area.onLoad(r,player,ver); + com_davidmaletz_mining_Main.getInstance().updatePlayer(); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; +}; +com_davidmaletz_mining_Main.getLocalState = function() { + return (js_Boot.__cast(com_davidmaletz_faengfl_Application.instance , com_davidmaletz_mining_Main)).state; +}; +com_davidmaletz_mining_Main.getLocalPlayer = function() { + return (js_Boot.__cast(com_davidmaletz_faengfl_Application.instance , com_davidmaletz_mining_Main)).player; +}; +com_davidmaletz_mining_Main.getLocalName = function() { + return null; +}; +com_davidmaletz_mining_Main.getRemotePlayer = function(user) { + if(user == null) { + return null; + } else { + var map = (js_Boot.__cast(com_davidmaletz_faengfl_Application.instance , com_davidmaletz_mining_Main)).remotePlayers; + if(map == null) { + return null; + } else { + return map.get(user); + } + } +}; +com_davidmaletz_mining_Main.getPlayerNames = function() { + return null; +}; +com_davidmaletz_mining_Main.getRemotePlayers = function() { + var map = (js_Boot.__cast(com_davidmaletz_faengfl_Application.instance , com_davidmaletz_mining_Main)).remotePlayers; + if(map == null) { + return new com_fancyfish_faeng_common_NullIterator(); + } else { + return map.iterator(); + } +}; +com_davidmaletz_mining_Main.getRemotePlayerNames = function() { + var map = (js_Boot.__cast(com_davidmaletz_faengfl_Application.instance , com_davidmaletz_mining_Main)).remotePlayers; + if(map == null) { + return new com_fancyfish_faeng_common_NullIterator(); + } else { + return map.keys(); + } +}; +com_davidmaletz_mining_Main.getInstance = function() { + return js_Boot.__cast(com_davidmaletz_faengfl_Application.instance , com_davidmaletz_mining_Main); +}; +com_davidmaletz_mining_Main.loadSave = function(slot,colors,offsets,entry) { + return (js_Boot.__cast(com_davidmaletz_faengfl_Application.instance , com_davidmaletz_mining_Main)).load(slot,colors,offsets,entry); +}; +com_davidmaletz_mining_Main.loadLastSave = function(old) { + var p = com_davidmaletz_mining_Main.loadSave(com_davidmaletz_mining_Main.slot,old.colors,old.offsets,com_davidmaletz_faengfl_adv_ModHandler.getEntryById(old.entry)); + return p; +}; +com_davidmaletz_mining_Main.showCredits = function(player,onComplete) { + var c = com_davidmaletz_mining_Main.getContainer(); + if(player != null) { + player.clearOverlap(); + } + c.addDisplay(new com_davidmaletz_mining_ui_Credits(c,onComplete),3); +}; +com_davidmaletz_mining_Main.getResource = function(path,id,ext) { + if(ext == null) { + ext = true; + } + return com_davidmaletz_faengfl_adv_AdvApp.getResource(path,id,ext); +}; +com_davidmaletz_mining_Main.addInvokeLater = function(i) { + if(com_davidmaletz_mining_Main.invokes == null) { + com_davidmaletz_mining_Main.invokes = [i]; + } else { + com_davidmaletz_mining_Main.invokes.push(i); + } + i.onRemoved = com_davidmaletz_mining_Main.removeInvokeLater; +}; +com_davidmaletz_mining_Main.removeInvokeLater = function(i) { + if(com_davidmaletz_mining_Main.invokes != null) { + HxOverrides.remove(com_davidmaletz_mining_Main.invokes,i); + } +}; +com_davidmaletz_mining_Main.destroyPlayer = function() { + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p != null) { + p.areas.destroy(p); + } + return p; +}; +com_davidmaletz_mining_Main.titleScreen = function() { + com_davidmaletz_mining_Main.destroyPlayer(); + com_davidmaletz_mining_Main.clearAll(); + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_TitleScreen(),0); + var i = com_davidmaletz_mining_Main.getInstance(); + i.exitGame(); + com_davidmaletz_faengfl_adv_sound_FadeMusic.set("title",60); + i.updatePlayer(); +}; +com_davidmaletz_mining_Main.gameOver = function() { + com_davidmaletz_mining_Main.clearAll(); + var p; + var i = com_davidmaletz_mining_Main.getInstance(); + p = com_davidmaletz_mining_Main.destroyPlayer(); + i.exitGame(); + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_GameOver(p),0); + com_davidmaletz_faengfl_adv_sound_FadeMusic.set("game_over",60,false); + i.updatePlayer(); +}; +com_davidmaletz_mining_Main.closeWindows = function(onComplete) { + com_davidmaletz_faengfl_adv_AdvApp.closeWindows(onComplete); +}; +com_davidmaletz_mining_Main.getEvent = function(event,p,xml,o,onComplete,vars) { + var local = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p == null && local == null || p != null && p != local) { + return null; + } + var i = xml.elementPathsNamed(event); + if(i.hasNext()) { + var ar = []; + while(i.hasNext()) ar.push(i.next().elements()); + return new com_davidmaletz_mining_npc_NPCEventHandler(new com_fancyfish_faeng_common_CompoundIterator(HxOverrides.iter(ar)),p,o,onComplete,vars); + } else { + return null; + } +}; +com_davidmaletz_mining_Main.runEvent = function(event,p,xml,o,onComplete,vars) { + var e = com_davidmaletz_mining_Main.getEvent(event,p,xml,o,onComplete,vars); + if(e != null) { + e.runAll(); + } else if(onComplete != null) { + onComplete(); + } +}; +com_davidmaletz_mining_Main.beforeDate = function(month,day,year) { + return new Date().getTime() < new Date(year,month - 1,day,23,59,59).getTime(); +}; +com_davidmaletz_mining_Main.isDate = function(month,day,fuzzy) { + if(fuzzy == null) { + fuzzy = 0; + } + var d = new Date(); + if(fuzzy == 0) { + if(d.getMonth() == month - 1) { + return d.getDate() == day; + } else { + return false; + } + } else { + var t = Math.abs(d.getTime() - new Date(d.getFullYear(),month - 1,day,0,0,0).getTime()); + t = Math.min(t,Math.abs(d.getTime() - new Date(d.getFullYear() - 1,month - 1,day,0,0,0).getTime())); + t = Math.min(t,Math.abs(d.getTime() - new Date(d.getFullYear() + 1,month - 1,day,0,0,0).getTime())); + return t < fuzzy * 24 * 60 * 60 * 1000; + } +}; +com_davidmaletz_mining_Main.runProcedure = function(v,id,func,p) { + var proc = v.get(id); + if(p == null) { + p = v.get("player"); + } + if(Std["is"](proc,com_davidmaletz_faengfl_IXml)) { + var map = new haxe_ds_StringMap(); + com_davidmaletz_faengfl_adv_ModHandler.copyVars(v,map); + new com_davidmaletz_mining_npc_NPCEventHandler((js_Boot.__cast(proc , com_davidmaletz_faengfl_IXml)).elements(),p,null,func,map).runAll(); + } +}; +com_davidmaletz_mining_Main.getProcedure = function(v,id) { + return function() { + var area = v.get("area"); + if(area != null && area.isActivePlayer()) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + com_davidmaletz_mining_Main.runProcedure(v,id,null,null); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + }; +}; +com_davidmaletz_mining_Main.randInt = function(from,to) { + return Math.floor(Math.random() * (to - from) + from); +}; +com_davidmaletz_mining_Main.itemName = function(item,name) { + var m; + if(com_davidmaletz_mining_item_ItemInfo.exists(item)) { + m = com_davidmaletz_mining_item_ItemInfo.get(item).getName(); + } else { + m = com_fancyfish_faeng_common_Lang.getTextFromTitle(item); + } + if(m == null) { + return name; + } else { + return com_davidmaletz_mining_item_Item._getName(m,name).get(); + } +}; +com_davidmaletz_mining_Main.setGameSpeed = function(f) { + com_davidmaletz_faengfl_FaengFL.speed_mod = f; +}; +com_davidmaletz_mining_Main.getSunlight = function(area,y) { + return com_davidmaletz_mining_renderer_Parallax.getSunlight(com_davidmaletz_mining_world_Generate.getBackground(area.id),com_davidmaletz_mining_Main._getGameTime()) * com_fancyfish_faeng_common_Utils.clamp(1.0 + (72. - y) * area.getDropoff(),0,1); +}; +com_davidmaletz_mining_Main.shuffle = function(ar) { + com_fancyfish_faeng_common_Utils.shuffle(ar,Math.random); +}; +com_davidmaletz_mining_Main.shuffleN = function(ar,ct) { + com_fancyfish_faeng_common_Utils.shuffleN(ar,ct,Math.random); +}; +com_davidmaletz_mining_Main.isMultiplayer = function() { + return false; +}; +com_davidmaletz_mining_Main.isPaused = function() { + return com_davidmaletz_faengfl_Window.window_ct > 0; +}; +com_davidmaletz_mining_Main.resetAll = function() { + com_davidmaletz_faengfl_adv_AdvApp.settings.clear(); + com_davidmaletz_faengfl_adv_AdvApp._saves.clear(); + com_davidmaletz_faengfl_adv_AdvApp.saves = new haxe_ds_StringMap(); + com_davidmaletz_mining_ui_Options.updateSettings(); + com_davidmaletz_controls_Controller.instance.updateSettings(); + com_davidmaletz_faengfl_achievement_Achievements.instance.updateSettings(); + com_davidmaletz_faengfl_SoundManager.updateSettings(); + com_davidmaletz_mining_network_CloudSaves.logout(); + com_davidmaletz_faengfl_adv_ModHandler.reloadData(); + (js_Boot.__cast(com_davidmaletz_faengfl_Application.instance , com_davidmaletz_mining_Main)).reload(); +}; +com_davidmaletz_mining_Main.onSailBoat = function() { +}; +com_davidmaletz_mining_Main.allowFlash = function() { + return com_davidmaletz_mining_Main.ALLOW_FLASH; +}; +com_davidmaletz_mining_Main.resetEntries = function() { + com_davidmaletz_mining_MyAchievements.reset(); + com_davidmaletz_mining_ui_Credits.reset(); + com_davidmaletz_mining_world_ObjectInfo.reset(); + com_davidmaletz_mining_world_ObjectInfo.loadInfo(new com_davidmaletz_mining_world_BlueprintInfo()); + com_davidmaletz_mining_ColorInfo.reset(); + com_davidmaletz_mining_OffsetInfo.reset(); + com_davidmaletz_mining_npc_Quest.reset(); + com_davidmaletz_mining_item_CropInfo.reset(); + com_davidmaletz_mining_item_Recipe.reset(); + com_davidmaletz_mining_structure_StructureInfo.reset(); + com_davidmaletz_mining_renderer_Parallax.reset(); + com_davidmaletz_mining_world_Element.reset(); + com_davidmaletz_mining_ui_StatusBars.reset(); + com_davidmaletz_mining_Skill.reset(); + com_davidmaletz_mining_world_Generate.reset(); + com_davidmaletz_mining_world_Area.reset(); + com_davidmaletz_mining_item_ItemInfo.reset(); + com_davidmaletz_mining_item_ItemCategory.reset(); + com_davidmaletz_mining_familiar_FamiliarType.reset(); + com_davidmaletz_mining_effects_Scene.reset(); + com_davidmaletz_mining_world_Planet.reset(); + com_davidmaletz_mining_DifficultyMode.reset(); + com_davidmaletz_mining_world_SolarSystem.reset(); + com_davidmaletz_mining_ui_MyFormattedText.reset(); +}; +com_davidmaletz_mining_Main.addActionEntries = function(action_map) { + action_map.set("player",function(e,path) { + com_davidmaletz_mining_world_ObjectInfo.loadInfo(new com_davidmaletz_mining_PlayerInfo(com_davidmaletz_faengfl_adv_ModHandler.makeXML(e,path,com_davidmaletz_mining_world_ObjectInfo.get))); + }); + action_map.set("enemy",function(e1,path1) { + com_davidmaletz_mining_world_ObjectInfo.loadInfo(new com_davidmaletz_mining_enemy_EnemyInfo(com_davidmaletz_faengfl_adv_ModHandler.makeXML(e1,path1,com_davidmaletz_mining_world_ObjectInfo.get))); + }); + action_map.set("vehicle",function(e2,path2) { + com_davidmaletz_mining_world_ObjectInfo.loadInfo(new com_davidmaletz_mining_world_vehicle_VehicleInfo(com_davidmaletz_faengfl_adv_ModHandler.makeXML(e2,path2,com_davidmaletz_mining_world_ObjectInfo.get))); + }); + action_map.set("tree",function(e3,path3) { + com_davidmaletz_mining_world_ObjectInfo.loadInfo(new com_davidmaletz_mining_world_TreeInfo(com_davidmaletz_faengfl_adv_ModHandler.makeXML(e3,path3,com_davidmaletz_mining_world_ObjectInfo.get))); + }); + action_map.set("bush",function(e4,path4) { + com_davidmaletz_mining_world_ObjectInfo.loadInfo(new com_davidmaletz_mining_world_BushInfo(com_davidmaletz_faengfl_adv_ModHandler.makeXML(e4,path4,com_davidmaletz_mining_world_ObjectInfo.get))); + }); + action_map.set("npc",function(e5,path5) { + com_davidmaletz_mining_world_ObjectInfo.loadInfo(new com_davidmaletz_mining_npc_NPCInfo(com_davidmaletz_faengfl_adv_ModHandler.makeXML(e5,path5,com_davidmaletz_mining_world_ObjectInfo.get))); + }); + action_map.set("object",function(e6,path6) { + com_davidmaletz_mining_world_ObjectInfo.loadInfo(new com_davidmaletz_mining_world_BasicObjectInfo(com_davidmaletz_faengfl_adv_ModHandler.makeXML(e6,path6,com_davidmaletz_mining_world_ObjectInfo.get))); + }); + action_map.set("itemObject",function(e7,path7) { + var i = com_davidmaletz_mining_world_ObjectInfo._get(e7.get("id")); + if(i != null && Std["is"](i,com_davidmaletz_mining_world_ItemObjectInfo)) { + (js_Boot.__cast(i , com_davidmaletz_mining_world_ItemObjectInfo)).loadAdditional(e7); + } + }); + action_map.set("defaultFishing",com_davidmaletz_mining_effects_Fishing.setDefault); + action_map.set("quest",function(e8,path8) { + com_davidmaletz_mining_npc_Quest.loadQuest(com_davidmaletz_faengfl_adv_ModHandler.makeXML(e8,path8,com_davidmaletz_mining_npc_Quest.get)); + }); + action_map.set("animal",function(e9,path9) { + com_davidmaletz_mining_item_CropInfo.loadCrop(new com_davidmaletz_faengfl_XmlPath(e9,path9),true); + }); + action_map.set("crop",function(e10,path10) { + com_davidmaletz_mining_item_CropInfo.loadCrop(new com_davidmaletz_faengfl_XmlPath(e10,path10),false); + }); + action_map.set("recipe",function(e11,path11) { + com_davidmaletz_mining_item_Recipe.loadRecipe(new com_davidmaletz_faengfl_XmlPath(e11,path11)); + }); + action_map.set("structure",function(e12,path12) { + com_davidmaletz_mining_structure_StructureInfo.set(e12.get("id"),new com_davidmaletz_mining_structure_StructureInfo(com_davidmaletz_faengfl_adv_ModHandler.makeXML(e12,path12,com_davidmaletz_mining_structure_StructureInfo.getStructure))); + }); + action_map.set("compound",function(e13,path13) { + com_davidmaletz_mining_structure_StructureInfo.set(e13.get("id"),new com_davidmaletz_mining_structure_CompoundStructure(e13)); + }); + action_map.set("element",function(e14,path14) { + com_davidmaletz_mining_world_Element.loadElement(com_davidmaletz_faengfl_adv_ModHandler.makeXML(e14,path14,com_davidmaletz_mining_world_Element.get,true)); + }); + action_map.set("planet",function(e15,path15) { + com_davidmaletz_mining_world_Planet.set(new com_davidmaletz_mining_world_Planet(com_davidmaletz_faengfl_adv_ModHandler.makeXML(e15,path15,com_davidmaletz_mining_world_Planet.get))); + }); + action_map.set("system",function(e16,path16) { + com_davidmaletz_mining_world_SolarSystem.set(new com_davidmaletz_mining_world_SolarSystem(com_davidmaletz_faengfl_adv_ModHandler.makeXML(e16,path16,com_davidmaletz_mining_world_SolarSystem.get))); + }); + action_map.set("skill",com_davidmaletz_mining_Skill.load); + action_map.set("difficultyMode",function(e17,path17) { + com_davidmaletz_mining_DifficultyMode.load(com_davidmaletz_faengfl_adv_ModHandler.makeXML(e17,path17,com_davidmaletz_mining_DifficultyMode.get)); + }); + action_map.set("bar",function(e18,path18) { + if(e18.get("id") == "fuel+progress") { + com_davidmaletz_mining_Main.PROGRESS_COL = com_davidmaletz_mining_Main.parseInt("0x" + e18.get("color")); + } else { + com_davidmaletz_mining_ui_StatusBars.loadBar(e18.get("id"),e18.get("tile"),com_davidmaletz_mining_Main.parseInt("0x" + e18.get("color"))); + } + }); + action_map.set("area",function(e19,path19) { + com_davidmaletz_mining_world_Generate.set(com_davidmaletz_faengfl_adv_ModHandler.makeXML2(e19,path19,com_davidmaletz_mining_world_Generate.get)); + }); + action_map.set("dig",function(e20,path20) { + com_davidmaletz_mining_world_Area.setDig(com_davidmaletz_faengfl_adv_ModHandler.makeXML2(e20,path20,com_davidmaletz_mining_world_Area._getDig)); + }); + action_map.set("ore",function(e21,path21) { + com_davidmaletz_mining_world_Area.setOre(com_davidmaletz_faengfl_adv_ModHandler.makeXML2(e21,path21,com_davidmaletz_mining_world_Area.getOre)); + }); + action_map.set("itemtype",function(e22,path22) { + com_davidmaletz_mining_item_ItemCategory.load(e22); + }); + action_map.set("item",function(e23,path23) { + com_davidmaletz_mining_item_ItemInfo.loadItem(com_davidmaletz_faengfl_adv_ModHandler.makeXML(e23,path23,com_davidmaletz_mining_item_ItemInfo.get)); + }); + action_map.set("familiar",function(e24,path24) { + com_davidmaletz_mining_familiar_FamiliarType.loadFamiliar(com_davidmaletz_faengfl_adv_ModHandler.makeXML2(e24,path24,com_davidmaletz_mining_familiar_FamiliarType.get)); + }); + action_map.set("scene",function(e25,path25) { + com_davidmaletz_mining_effects_Scene.loadScene(com_davidmaletz_faengfl_adv_ModHandler.makeXML2(e25,path25,com_davidmaletz_mining_effects_Scene.getXML)); + }); + action_map.set("parallax",function(e26,path26) { + com_davidmaletz_mining_renderer_Parallax.loadParallax(com_davidmaletz_faengfl_adv_ModHandler.makeXML2(e26,path26,com_davidmaletz_mining_renderer_Parallax.get)); + }); + action_map.set("hitEffect",function(e27,path27) { + com_davidmaletz_mining_world_ObjectInfo.loadHitEffect(com_davidmaletz_faengfl_adv_ModHandler.makeXML2(e27,path27,com_davidmaletz_mining_world_ObjectInfo.getHitEffectById)); + }); + action_map.set("colors",function(e28,path28) { + com_davidmaletz_mining_ColorInfo.load(e28); + }); + action_map.set("offsets",function(e29,path29) { + com_davidmaletz_mining_OffsetInfo.load(e29); + }); + action_map.set("achievement",($_=(js_Boot.__cast(com_davidmaletz_faengfl_achievement_Achievements.instance , com_davidmaletz_mining_MyAchievements)),$bind($_,$_.add))); + action_map.set("credits",function(e30,path30) { + if(e30.firstChild() != null) { + var s = com_fancyfish_faeng_common_Lang.escape(e30.firstChild().get_nodeValue()); + if(s.length > 0) { + com_davidmaletz_mining_ui_Credits.addSegment(s,e30.exists("time") ? com_davidmaletz_mining_Main.parseInt(e30.get("time")) : 0,e30.get("title")); + } + } + }); +}; +com_davidmaletz_mining_Main.countMap = function(map,str) { + if(str == null) { + var ct = 0; + var s = map.keys(); + while(s.hasNext()) { + var s1 = s.next(); + ct += map.get(s1).length; + } + return ct; + } else { + return map.get(str).length; + } +}; +com_davidmaletz_mining_Main.len = function(ar) { + if(ar == null) { + return 0; + } else { + return ar.length; + } +}; +com_davidmaletz_mining_Main.window_factory = null; +com_davidmaletz_mining_Main.label_factory = null; +com_davidmaletz_mining_Main.icon_factory = null; +com_davidmaletz_mining_Main.parseInt = function(s) { + if(s == null) { + return 0; + } else { + var r = Std.parseInt(s); + var ret = r == null ? 0 : r; + return ret; + } +}; +com_davidmaletz_mining_Main.parseFloat = function(s) { + if(s == null) { + return 0; + } else { + var r = Std.parseFloat(s); + var ret = r == null ? 0 : r; + return ret; + } +}; +com_davidmaletz_mining_Main.__super__ = com_davidmaletz_faengfl_adv_AdvApp; +com_davidmaletz_mining_Main.prototype = $extend(com_davidmaletz_faengfl_adv_AdvApp.prototype,{ + state: null + ,player: null + ,fullRes: null + ,remotePlayers: null + ,handleAction: function(t,vars,item) { + var p = com_davidmaletz_mining_Main.updateDevVars(vars); + t = StringTools.trim(t); + if(p != null && HxOverrides.cca(t,0) == 60) { + return function() { + try { + var n = new com_davidmaletz_mining_npc_NPCEventHandler(new com_davidmaletz_faengfl_XmlPath(Xml.parse(t),"data/").elements(),p,null,com_davidmaletz_faengfl_DeveloperConsole.toggle,vars); + n.__is_action_key = true; + n.runAll(); + } catch( e ) { + haxe_CallStack.lastException = e; + if (e instanceof js__$Boot_HaxeError) e = e.val; + com_fancyfish_faeng_common_Utils.printExceptionTrace(e); + } + }; + } else { + return com_davidmaletz_faengfl_adv_AdvApp.prototype.handleAction.call(this,t,vars,item); + } + } + ,updatePlayer: function() { + if(com_davidmaletz_faengfl_DeveloperConsole.instance != null) { + com_davidmaletz_mining_Main.updateDevVars(com_davidmaletz_faengfl_DeveloperConsole.instance.vars); + } + } + ,addFullscreenOption: function() { + com_davidmaletz_mining_ui_Options.addFullscreenOption(); + } + ,handleShift: function(down) { + } + ,onKeyDown: function(e) { + if(e.key == "walk") { + com_davidmaletz_faengfl_adv_AdvApp.shiftDown = true; + } + } + ,onKeyUp: function(e) { + if(e.key == "walk") { + com_davidmaletz_faengfl_adv_AdvApp.shiftDown = false; + } + } + ,onKey: function(e) { + if(e.key == "mute") { + com_davidmaletz_faengfl_SoundManager.toggleMute(); + com_davidmaletz_faengfl_adv_AdvApp.settings.flush(); + this.dispatchEvent(new openfl_events_Event("mute")); + new com_davidmaletz_faengfl_ui_Popup(128.,72.,0,com_fancyfish_faeng_common_Lang.getText("common",com_davidmaletz_faengfl_SoundManager.isMuted() ? "muted" : "unmuted"),16777215,-16777216,30,30,30); + } else if(com_davidmaletz_faengfl_Window.window_ct == 0 && e.key == "cancel" && this.player != null && this.player.getCurrentArea() == null) { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_Options(c,true),2); + } + } + ,game_time: null + ,enter_frame: function(frames) { + var pause = com_davidmaletz_faengfl_Window.window_ct > 0; + if(this.player != null && pause != this.player.paused.get()) { + this.player.paused.set(pause); + } + this.setGameTime(this.game_time + 0.00066666666666666664 * frames); + } + ,getGameTime: function() { + return this.game_time; + } + ,getTargetTime: function() { + if(this.hasTrack(com_davidmaletz_mining_TimeKeyframe)) { + var l = this.getLerp(com_davidmaletz_mining_TimeKeyframe); + if(l != null) { + return com_fancyfish_faeng_common_Utils.mod((js_Boot.__cast(l , com_davidmaletz_mining_TimeKeyframe)).time,24); + } + } + return this.getGameTime(); + } + ,setGameTime: function(t) { + if(this.game_time != t) { + this.game_time = com_fancyfish_faeng_common_Utils.mod(t,24); + com_davidmaletz_mining_renderer_Parallax.setTime(t); + } + } + ,resize: function(e) { + com_davidmaletz_faengfl_adv_AdvApp.prototype.resize.call(this,e); + this.fullRes.set_scaleX(this.container.get_scaleX()); + this.fullRes.set_scaleY(this.container.get_scaleY()); + this.fullRes.set_rotation(this.container.get_rotation()); + this.fullRes.set_x(this.container.get_x()); + this.fullRes.set_y(this.container.get_y()); + } + ,init: function(e) { + com_davidmaletz_faengfl_adv_AdvApp.prototype.init.call(this,e); + this.addChildAt(this.fullRes,1); + com_davidmaletz_faengfl_FaengFL.addEnterFrame(this); + } + ,destroy: function(e) { + com_davidmaletz_faengfl_adv_AdvApp.prototype.destroy.call(this,e); + com_davidmaletz_faengfl_FaengFL.removeEnterFrame(this); + } + ,load: function(slot,colors,offsets,entry) { + com_davidmaletz_mining_Main.slot = slot; + return this.loadData(com_davidmaletz_faengfl_adv_AdvApp.saves.get(slot),colors,offsets,entry); + } + ,loadData: function(save,colors,offsets,entry) { + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p != null && p.areas != null) { + p.areas.destroy(p); + } + var area; + var ver = 81; + var newGame = false; + var time = 6; + this.exitGame(); + this.remotePlayers = new haxe_ds_StringMap(); + try { + com_davidmaletz_mining_Main.error = false; + var b = com_davidmaletz_mining_Main._load(save); + ver = b.readUInt16(); + if(!com_davidmaletz_mining_Main.canLoad(ver)) { + throw new js__$Boot_HaxeError("Bad save version."); + } + this.state = new com_davidmaletz_mining_State(); + var header = com_davidmaletz_mining_Main.readHeader(b,ver); + time = header.game_time; + this.player = header.player; + if(ver >= 66) { + this.state.read(b,ver); + } + this.player.areas = com_davidmaletz_mining_world_Areas.read(b,ver); + if(ver >= 75) { + var s; + while(true) { + s = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(!(s != null)) { + break; + } + this.remotePlayers.set(s,com_davidmaletz_mining_Main.loadRemotePlayer(this.player.areas,b,ver)); + } + } + com_davidmaletz_mining_Main.saveTime = header.time; + if(ver >= 61) { + var vehicle = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(vehicle != null) { + var x = b.readInt32(); + var y = b.readInt32(); + var loc = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + var varea = com_davidmaletz_mining_Main.getArea(this.player,loc,b,ver); + var v = com_davidmaletz_mining_Main.getVehicle(varea,vehicle,x,y); + if(v == null) { + this.player.location = varea.id; + area = varea; + this.player.setPosition(x,y); + } else { + area = v.getInterior(this.player.areas,v.getRideableInfo()); + } + } else { + area = com_davidmaletz_mining_Main.getArea(this.player,this.player.location,b,ver); + } + } else { + area = com_davidmaletz_mining_Main.getArea(this.player,this.player.location,b,ver); + } + if(area == null) { + throw new js__$Boot_HaxeError("Area Corrupt"); + } + if(ver < 70) { + var seen = this.player.seen_items; + var a = this.player.areas.iterator(); + while(a.hasNext()) { + var a1 = a.next(); + var s1 = a1.getStructures(); + while(s1.hasNext()) { + var s2 = s1.next(); + var inv = s2.accessInventory(); + if(inv != null) { + var i = inv.getItems(); + while(i.hasNext()) { + var i1 = i.next(); + seen.set(i1.item.id,true); + } + } + } + } + } + } catch( e ) { + haxe_CallStack.lastException = e; + if (e instanceof js__$Boot_HaxeError) e = e.val; + if(save != null) { + com_fancyfish_faeng_common_Utils.printExceptionTrace(e); + new com_davidmaletz_faengfl_ui_Popup(128.,72.,0,com_fancyfish_faeng_common_Lang.getText("common","save_corrupt"),16777215,-16777216,30,100,30,null,true,true); + if(this.player != null && this.player.areas != null && this.player.areas.exists("start")) { + area = this.player.areas.get("start"); + this.player.location = "start"; + this.player.setPosition(0,-com_davidmaletz_tiles_Tile.SIZE); + } else { + return null; + } + } else { + if(entry == null) { + if(com_davidmaletz_faengfl_adv_ModHandler.entries.length > 0) { + entry = com_davidmaletz_faengfl_adv_ModHandler.entries[0]; + } + if(entry == null) { + return null; + } + } + this.state = new com_davidmaletz_mining_State(); + this.player = com_davidmaletz_mining_world_Generate.loadPlayer(entry); + this.player.areas = new com_davidmaletz_mining_world_Areas(); + newGame = true; + com_davidmaletz_mining_Main.saveTime = 0; + area = this.player.areas.get(this.player.location); + } + } + if(this.player == null) { + throw new js__$Boot_HaxeError("No player found!"); + } + if(colors != null) { + var c = colors.keys(); + while(c.hasNext()) { + var c1 = c.next(); + this.player.colors.set(c1,colors.get(c1)); + } + } + if(offsets != null) { + var o = offsets.keys(); + while(o.hasNext()) { + var o1 = o.next(); + this.player.offsets.set(o1,offsets.get(o1)); + } + } + var ret = this._doLoad(this.player,area,time,ver); + if(newGame) { + new com_davidmaletz_mining_ui_MoveTooltip(); + } + return ret; + } + ,_doLoad: function(p,area,time,ver) { + p.__location_id = area.__id; + com_davidmaletz_mining_Main.lastSaveTime = com_davidmaletz_mining_Main.loadTime = com_davidmaletz_mining_Main.time(); + this.game_time = time; + com_davidmaletz_mining_Main.setArea(com_davidmaletz_mining_Main.getGameScale(),area,ver); + this.player.areas.init(this.player); + com_davidmaletz_mining_Main.runOnLoad(this.player,ver); + this.player.init(); + if(com_davidmaletz_mining_Main.error) { + new com_davidmaletz_faengfl_ui_Popup(128.,72.,0,com_fancyfish_faeng_common_Lang.getText("common","save_incomplete"),16777215,-16777216,30,200,30,null,true,true); + com_davidmaletz_mining_Main.error = false; + } + return this.player; + } + ,changePlayer: function(id,forward) { + if(forward == null) { + forward = true; + } + if(this.player == null) { + return null; + } + var p = js_Boot.__cast(com_davidmaletz_mining_world_ObjectInfo.make(id,this.player.xPos,this.player.yTile) , com_davidmaletz_mining_Player); + p.areas = this.player.areas; + p.entry = this.player.entry; + return this.setPlayer(p,true,forward); + } + ,setPlayer: function(p,copyColors,forward) { + if(forward == null) { + forward = true; + } + if(copyColors == null) { + copyColors = false; + } + if(p == null || this.player == null || p == this.player || this.player.area == null) { + return null; + } + if(p.areas == null) { + throw new js__$Boot_HaxeError("Bad player object!"); + } + var changeAreas = this.player.areas != p.areas; + this.player.familiar.destroy(); + var r = this.player.area.renderer; + var i = 0; + var parent = null; + com_davidmaletz_mining_Main.temporary_remove = true; + var c = com_davidmaletz_faengfl_Window.window_ct; + com_davidmaletz_faengfl_Window.window_ct = 0; + if(r != null && r.parent != null) { + parent = r.parent; + i = parent.getChildIndex(r); + parent.removeChild(r); + } + if(changeAreas) { + this.player.areas.destroy(this.player); + } + if(copyColors) { + var c1 = this.player.colors.keys(); + while(c1.hasNext()) { + var c2 = c1.next(); + p.colors.set(c2,this.player.colors.get(c2)); + } + var o = this.player.offsets.keys(); + while(o.hasNext()) { + var o1 = o.next(); + p.offsets.set(o1,this.player.offsets.get(o1)); + } + } + this.player.equipment.destroy(this.player); + var a = this.player.area; + p.location = this.player.location; + p.__location_id = this.player.__location_id; + a.removeObject(this.player); + this.player.renderer = null; + p.renderer = null; + this.player = p; + a.addObject(this.player); + if(changeAreas) { + this.player.areas.init(this.player); + } + if(parent != null) { + parent.addChildAt(r,i); + } + com_davidmaletz_mining_Main.temporary_remove = false; + com_davidmaletz_faengfl_Window.window_ct = c; + return this.player; + } + ,updatePlayerVars: function(vars) { + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(vars == null) { + vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(p); + } else if(p != null) { + com_davidmaletz_mining_npc_NPCEventHandler.setPlayerVariables(vars,p); + } + return vars; + } + ,getForcedTrack: function() { + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p == null || p.vehicle == null) { + return null; + } else { + return p.vehicle.getInfo().bgm; + } + } + ,getPlayerPos: function() { + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p == null) { + return null; + } else { + return new openfl_geom_Point(p.getTileCenX(),p.getTileCenY()); + } + } + ,getUILayer: function() { + var s = com_davidmaletz_faengfl_Application.instance.container; + if(s.get_numChildren() > 2 && !s.getChildAt(2).get_visible()) { + return 3; + } else { + return 2; + } + } + ,getTransitionLayer: function() { + return 4; + } + ,reload: function() { + com_davidmaletz_faengfl_adv_AdvApp.prototype.reload.call(this); + if(this.player == null || this.player.getCurrentArea() == null) { + com_davidmaletz_faengfl_adv_AdvApp.closeWindows(); + } else { + var p = this.player; + var map = com_davidmaletz_mining_Main.getInstance().remotePlayers; + com_davidmaletz_mining_Main.destroyPlayer(); + this.exitGame(); + this.loadData(com_davidmaletz_mining_Main.makeSave(p,map,p.getCurrentArea())); + } + } + ,splash: function() { + var bmp = openfl_Assets.getBitmapData("data/ui/title_full.jpg"); + var b = new openfl_display_Bitmap(bmp,1,true); + b.set_scaleX(b.set_scaleY(256 / bmp.width)); + var s = new com_davidmaletz_lerp_LerpSprite(); + s.addChild(b); + var func = function() { + var d = s; + var func1 = function() { + com_davidmaletz_faengfl_FaengFL.remove(d); + }; + s.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),60,func1); + (js_Boot.__cast(com_davidmaletz_faengfl_achievement_Achievements.instance , com_davidmaletz_mining_MyAchievements)).init(); + }; + s.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),60,func); + this.fullRes.addDisplay(s,0); + new com_davidmaletz_faengfl_transition_Modal(s,null); + com_davidmaletz_mining_Main.titleScreen(); + new com_davidmaletz_faengfl_transition_Modal(s,com_davidmaletz_mining_ui_Preloader.onStart); + } + ,exitGame: function() { + this.state = null; + this.player = null; + this.remotePlayers = null; + com_davidmaletz_mining_world_Area.resetIds(); + if(com_davidmaletz_mining_Main.invokes != null) { + var _g = 0; + var _g1 = com_davidmaletz_mining_Main.invokes; + while(_g < _g1.length) { + var i = _g1[_g]; + ++_g; + i.destroy(); + } + com_davidmaletz_mining_Main.invokes = null; + } + com_davidmaletz_mining_Player.PVP = false; + } + ,__isPaused: function() { + return com_davidmaletz_mining_Main.isPaused(); + } + ,additionalVars: function(v) { + var _gthis = this; + com_davidmaletz_faengfl_adv_AdvApp.prototype.additionalVars.call(this,v); + v.set("getObject",com_davidmaletz_mining_world_ObjectInfo.get); + v.set("getQuest",com_davidmaletz_mining_npc_Quest.get); + v.set("getRecipe",com_davidmaletz_mining_item_Recipe.get); + v.set("getElement",com_davidmaletz_mining_world_Element.get); + v.set("DifficultyMode",com_davidmaletz_mining_DifficultyMode); + v.set("getStructure",com_davidmaletz_mining_structure_StructureInfo.get); + v.set("getAreaXML",com_davidmaletz_mining_world_Generate.get); + v.set("getItem",com_davidmaletz_mining_item_ItemInfo._get); + v.set("getPlanet",com_davidmaletz_mining_world_Planet.get); + v.set("getFamiliar",com_davidmaletz_mining_familiar_FamiliarType.getType); + v.set("getScene",com_davidmaletz_mining_effects_Scene.get); + v.set("getCrop",com_davidmaletz_mining_item_CropInfo.get); + v.set("toHex",StringTools.hex); + v.set("getSkill",com_davidmaletz_mining_Skill.get); + v.set("Area",com_davidmaletz_mining_world_Area); + v.set("Action",com_davidmaletz_mining_item_Action); + v.set("getSystem",com_davidmaletz_mining_world_SolarSystem.get); + v.set("getColors",com_davidmaletz_mining_ColorInfo.get); + v.set("getOffsets",com_davidmaletz_mining_OffsetInfo.get); + v.set("PlayerInfo",com_davidmaletz_mining_PlayerInfo); + v.set("EnemyInfo",com_davidmaletz_mining_enemy_EnemyInfo); + v.set("VehicleInfo",com_davidmaletz_mining_world_vehicle_VehicleInfo); + v.set("NPCInfo",com_davidmaletz_mining_npc_NPCInfo); + v.set("getParallaxLayer",com_davidmaletz_mining_renderer_Parallax.getLayer); + v.set("TreeInfo",com_davidmaletz_mining_world_TreeInfo); + v.set("BushInfo",com_davidmaletz_mining_world_BushInfo); + v.set("reloadData",function() { + com_davidmaletz_faengfl_adv_ModHandler.reloadData(); + _gthis.reload(); + }); + v.set("Event",openfl_events_Event); + v.set("EReg",EReg); + v.set("Quest",com_davidmaletz_mining_npc_Quest); + v.set("Item",com_davidmaletz_mining_item_ItemInfo); + v.set("Recipe",com_davidmaletz_mining_item_Recipe); + v.set("Tile",com_davidmaletz_tiles_Tile); + v.set("hasStorm",com_davidmaletz_mining_effects_Storm.hasStorm); + v.set("ObjectInfo",com_davidmaletz_mining_world_ObjectInfo); + v.set("FarmInfo",com_davidmaletz_mining_item_FarmInfo); + v.set("StructureInfo",com_davidmaletz_mining_structure_StructureInfo); + v.set("Movement",com_davidmaletz_mining_world_Movement); + v.set("ObjectLayer",com_davidmaletz_mining_world_ObjectLayer); + v.set("isDate",com_davidmaletz_mining_Main.isDate); + v.set("shuffle",com_davidmaletz_mining_Main.shuffle); + v.set("Object",com_davidmaletz_mining_world_Object); + v.set("ObjectEvent",com_davidmaletz_faengfl_events_ObjectEvent); + var v1 = v; + v.set("runProcedure",function(id,a1,p) { + com_davidmaletz_mining_Main.runProcedure(v1,id,a1,p); + }); + var v2 = v; + v.set("getProcedure",function(id1) { + return com_davidmaletz_mining_Main.getProcedure(v2,id1); + }); + v.set("shuffleN",com_davidmaletz_mining_Main.shuffleN); + v.set("Utils",com_fancyfish_faeng_common_Utils); + v.set("random",Math.random); + v.set("randInt",com_davidmaletz_mining_Main.randInt); + v.set("itemName",com_davidmaletz_mining_Main.itemName); + v.set("getResource",com_davidmaletz_mining_Main.getResource); + v.set("clearStaticDisplays",com_davidmaletz_mining_ui_GUI.clearStaticDisplays); + v.set("setGameSpeed",com_davidmaletz_mining_Main.setGameSpeed); + var m = js_Boot.__cast(com_davidmaletz_faengfl_Application.instance , com_davidmaletz_mining_Main); + v.set("getSunlight",com_davidmaletz_mining_Main.getSunlight); + v.set("sign",com_fancyfish_faeng_common_Utils.sign); + v.set("setGameTime",com_davidmaletz_mining_Main._setGameTime); + v.set("setGameScale",com_davidmaletz_mining_Main.setGameScale); + v.set("getGameScale",com_davidmaletz_mining_Main.getGameScale); + v.set("ItemCt",com_davidmaletz_mining_item_ItemCt); + v.set("getGameTime",$bind(m,m.getGameTime)); + v.set("getTargetTime",$bind(m,m.getTargetTime)); + v.set("isNight",com_davidmaletz_mining_Main.isNight); + v.set("setColorMatrix",com_davidmaletz_mining_Main.setColorMatrix); + v.set("makeColorMatrix",function(ar) { + var this1; + if(ar != null) { + this1 = new Float32Array(ar); + } else { + this1 = null; + } + return lime_math__$Matrix4_Matrix4_$Impl_$._new(this1); + }); + v.set("Structure",com_davidmaletz_mining_structure_Structure); + v.set("isPaused",function() { + return com_davidmaletz_faengfl_Window.window_ct > 0; + }); + v.set("showUI",com_davidmaletz_mining_Main.showUI); + v.set("showLight",com_davidmaletz_mining_Main.showLight); + v.set("resetAll",com_davidmaletz_mining_Main.resetAll); + v.set("allowFlash",com_davidmaletz_mining_Main.allowFlash); + v.set("onSailBoat",com_davidmaletz_mining_Main.onSailBoat); + v.set("BACK_LAYER",3); + v.set("BASE_LAYER",0); + v.set("ORE_LAYER",1); + v.set("FLAG_CRITICAL",1); + v.set("FLAG_IGNORE_DEFENSE",2); + v.set("AlphaKeyframe",com_davidmaletz_lerp_AlphaKeyframe); + v.set("FLAG_HIDE_ATTACKER",4); + v.set("FLAG_NO_KILL",8); + v.set("NO_ATTACK",1); + v.set("setSpriteColor",com_davidmaletz_faengfl_TextSprite.setColor); + v.set("getParallax",function() { + return com_davidmaletz_mining_renderer_Parallax.instance; + }); + v.set("getColor",com_davidmaletz_mining_ColorInfo.get); + v.set("BUSH_LAYER",1); + v.set("ITEM_LAYER",2); + v.set("PLAYER_LAYER",6); + v.set("NPC_LAYER",3); + v.set("ENEMY_LAYER",4); + v.set("TRAP_LAYER",5); + v.set("addPress",function(func) { + com_davidmaletz_controls_Controller.instance.addEventListener("press",func); + }); + v.set("Projectile",com_davidmaletz_mining_world_Projectile); + v.set("addTap",function(func1) { + com_davidmaletz_controls_Controller.instance.addEventListener("tap",func1); + }); + v.set("addRelease",function(func2) { + com_davidmaletz_controls_Controller.instance.addEventListener("release",func2); + }); + v.set("removePress",function(func3) { + com_davidmaletz_controls_Controller.instance.removeEventListener("press",func3); + }); + v.set("removeTap",function(func4) { + com_davidmaletz_controls_Controller.instance.removeEventListener("tap",func4); + }); + v.set("removeRelease",function(func5) { + com_davidmaletz_controls_Controller.instance.removeEventListener("release",func5); + }); + v.set("addMouseDown",function(func6) { + com_davidmaletz_faengfl_TouchAdapter.instance.addEventListener("touch_down",func6); + }); + v.set("addMouseUp",function(func7) { + com_davidmaletz_faengfl_TouchAdapter.instance.addEventListener("touch_up",func7); + }); + v.set("addMouseMove",function(func8) { + com_davidmaletz_faengfl_TouchAdapter.instance.addEventListener("touch_move",func8); + }); + v.set("removeMouseDown",function(func9) { + com_davidmaletz_faengfl_TouchAdapter.instance.removeEventListener("touch_down",func9); + }); + v.set("removeMouseUp",function(func10) { + com_davidmaletz_faengfl_TouchAdapter.instance.removeEventListener("touch_up",func10); + }); + v.set("removeMouseMove",function(func11) { + com_davidmaletz_faengfl_TouchAdapter.instance.removeEventListener("touch_move",func11); + }); + v.set("getMousePos",function(e) { + var p1 = new openfl_geom_Point(e.stageX,e.stageY); + return com_davidmaletz_faengfl_Application.instance.container.globalToLocal(p1); + }); + v.set("setDarkness",function(s,f) { + com_davidmaletz_lerp_DarkenKeyframe.setDarkness(s,f); + }); + v.set("getContainer",com_davidmaletz_mining_Main.getContainer); + v.set("learnRecipe",function(r,addTo,message,onComplete) { + return com_davidmaletz_mining_structure_EnchantRecipe._addRecipe(com_davidmaletz_mining_Main.getLocalPlayer(),r,function(p2) { + p2.state.addRecipe(addTo,r); + if(onComplete != null) { + onComplete(); + } + },message); + }); + v.set("StringMap",haxe_ds_StringMap); + v.set("IntMap",haxe_ds_IntMap); + v.set("Date",Date); + v.set("getLocator",function() { + return com_davidmaletz_mining_ui_NPCLocator.instance; + }); + v.set("WIDTH",256); + v.set("HEIGHT",144); + v.set("parseJson",JSON.parse); + v.set("stringifyJson",JSON.stringify); + v.set("getLocalPlayer",com_davidmaletz_mining_Main.getLocalPlayer); + v.set("getLocalName",com_davidmaletz_mining_Main.getLocalName); + v.set("TileOffset",com_davidmaletz_faengfl_TileOffset); + v.set("getListeners",function(o,str) { + return com_davidmaletz_mining_Main.countMap(o.__eventMap,str); + }); + v.set("getFrameListeners",function() { + return com_davidmaletz_mining_Main.len(com_davidmaletz_faengfl_FaengFL.listeners) + com_davidmaletz_mining_Main.len(com_davidmaletz_faengfl_FaengFL.listeners_modify); + }); + v.set("getControllerListeners",function(str1) { + return com_davidmaletz_mining_Main.countMap(com_davidmaletz_controls_Controller.instance.__eventMap,str1); + }); + v.set("getTouchListeners",function(str2) { + return com_davidmaletz_mining_Main.countMap(com_davidmaletz_faengfl_TouchAdapter.instance.__eventMap,str2); + }); + v.set("getModListeners",function(str3) { + return com_davidmaletz_mining_Main.countMap(com_davidmaletz_faengfl_adv_ModHandler.dispatcher.__eventMap,str3); + }); + v.set("getGlobals",com_davidmaletz_faengfl_EventHandler.getGlobals); + v.set("setBGMSpeed",function(s1) { + }); + v.set("getGUIElements",function() { + var ret = com_davidmaletz_mining_ui_GUI.static_elements.length; + var g = com_davidmaletz_mining_ui_GUI.instance; + if(g != null) { + ret += g.elements.length; + } + return ret; + }); + v.set("copyMap",function(from,to) { + while(true) { + var i = to.keys(); + if(i.hasNext()) { + to.remove(i.next()); + } else { + break; + } + } + var k = from.keys(); + while(k.hasNext()) { + var k1 = k.next(); + to.set(k1,from.get(k1)); + } + }); + v.set("getTimer",openfl_Lib.getTimer); + v.set("getRemotePlayer",com_davidmaletz_mining_Main.getRemotePlayer); + v.set("getRemotePlayers",com_davidmaletz_mining_Main.getRemotePlayers); + v.set("getRemotePlayerNames",com_davidmaletz_mining_Main.getRemotePlayerNames); + v.set("getPlayerNames",com_davidmaletz_mining_Main.getPlayerNames); + v.set("isServer",function() { + return false; + }); + v.set("isClient",function() { + return false; + }); + v.set("isPlayerAction",function() { + return com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + }); + v.set("Generate",com_davidmaletz_mining_world_Generate); + v.set("Xml",Xml); + v.set("KeyboardKey",com_davidmaletz_faengfl_controls_KeyboardKey); + v.set("MouseKey",com_davidmaletz_faengfl_controls_MouseKey); + v.set("ControllerKey",com_davidmaletz_faengfl_controls_ControllerKey); + v.set("AxisKey",com_davidmaletz_faengfl_controls_AxisKey); + v.set("setPVP",function(v3) { + com_davidmaletz_mining_Player.PVP = v3; + }); + } + ,__class__: com_davidmaletz_mining_Main +}); +var DocumentClass = function() { + openfl_Lib.current.addChild(this); + com_davidmaletz_mining_Main.call(this); + this.dispatchEvent(new openfl_events_Event("addedToStage",false,false)); +}; +$hxClasses["DocumentClass"] = DocumentClass; +DocumentClass.__name__ = ["DocumentClass"]; +DocumentClass.__super__ = com_davidmaletz_mining_Main; +DocumentClass.prototype = $extend(com_davidmaletz_mining_Main.prototype,{ + __class__: DocumentClass +}); +var lime_AssetLibrary = function() { + this.onChange = new lime_app_Event_$Void_$Void(); +}; +$hxClasses["lime.AssetLibrary"] = lime_AssetLibrary; +lime_AssetLibrary.__name__ = ["lime","AssetLibrary"]; +lime_AssetLibrary.prototype = { + onChange: null + ,exists: function(id,type) { + return false; + } + ,getBytes: function(id) { + return null; + } + ,getImage: function(id) { + return null; + } + ,getPath: function(id) { + return null; + } + ,getText: function(id) { + var bytes = this.getBytes(id); + if(bytes == null) { + return null; + } else { + return bytes.getString(0,bytes.length); + } + } + ,isLocal: function(id,type) { + return true; + } + ,list: function(type) { + return null; + } + ,loadImage: function(id) { + var _gthis = this; + return new lime_app_Future(function() { + return _gthis.getImage(id); + }); + } + ,unload: function() { + } + ,__class__: lime_AssetLibrary +}; +var DefaultAssetLibrary = function() { + this.type = new haxe_ds_StringMap(); + this.path = new haxe_ds_StringMap(); + lime_AssetLibrary.call(this); + var id = "data/core/mod.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/ui/title_full.jpg"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/achievements.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/achievements.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/animals/animals.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/animals/baby_dragon.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/animals/baby_dragon.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/animals/cat.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/animals/cat.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/animals/chicken.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/animals/cockatiel.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/animals/cockatiel.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/animals/cow.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/animals/owl.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/animals/owl.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/animals/rat.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/animals/redbreast.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/animals/seagull.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/animals/wolf.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/elements.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/enemies/adult_dragon.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/enemies/adult_dragon.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/enemies/boar.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/enemies/enemies.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/enemies/explosion.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/enemies/explosion.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/enemies/fire.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/enemies/fireball_small.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/enemies/fire_bird.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/enemies/fire_boar.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/enemies/flame.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/enemies/freeze.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/enemies/ghost.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/enemies/golem.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/enemies/icy_wind.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/enemies/shadow_cat.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/enemies/shadow_cat.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/enemies/smoke.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/enemies/smoke.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/enemies/snowball.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/enemies/spider.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/enemies/spider.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/enemies/traps.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/enemies/wyrm.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/enemies/yeti.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/enemies/yeti.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/enemies/young_dragon.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/enemies/young_dragon.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/farm/cotton.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/farm/farm.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/farm/orchard.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/farm/pumpkin.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/farm/sugar.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/farm/wheat.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/items/armors.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/items/armors.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/items/arrows.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/items/backpacks.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/items/backpacks.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/items/blueprints.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/items/campfire.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/items/earth_armor.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/items/earth_armor.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/items/equipment.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/items/explosion.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/items/fishing.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/items/fishing.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/items/food.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/items/icons.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/items/icons.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/items/items.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/items/items.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/items/lantern.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/items/rails.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/items/shadow_cape.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/items/snowman.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/items/torch.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/items/weps.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/items/weps.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/lang/en_US.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/lang/fonts/drachenklaue.fnt"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/lang/fonts/drachenklaue.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/lang/fonts/uni.fnt"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/lang/fonts/uni.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/lang/languages.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/lang/pt_BR.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/lang/ru_RU.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/magic1/enemies/alien.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/enemies/alien_fx.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/enemies/alien_fx.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/magic1/enemies/crawler.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/enemies/elementals.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/enemies/elementals.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/magic1/enemies/enemies.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/magic1/enemies/fire_elemental.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/enemies/golemech.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/enemies/golemech.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/magic1/enemies/icer.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/enemies/jelly.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/enemies/leech.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/enemies/leech.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/magic1/enemies/magic_beam.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/enemies/magic_fx.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/enemies/magic_wyrm.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/enemies/oldone.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/magic1/enemies/skyfish.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/enemies/skyfish.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/magic1/enemies/tree.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/enemies/tree.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/magic1/enemies/wyrm_queen.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/enemies/wyrm_queen.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/magic1/items/dragarmor.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/items/dragarmor.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/magic1/items/goggles.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/items/items.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/magic1/items/spirit_detector.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/magic1.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/magic1/npcs.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/magic1/parallax/clouds.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/parallax/clouds.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/magic1/parallax/mountains.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/parallax/parallax.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/magic1/parallax/rocks.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/scenes/alchemist/alchemist.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/scenes/alchemist/alchemist.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/magic1/scenes/alchemist/bg.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/scenes/alchemist/scene.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/magic1/scenes/alien/alien.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/scenes/alien/alien.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/magic1/scenes/alien/bg.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/scenes/alien/scene.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/magic1/scenes/scenes.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/magic1/structures/house.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/structures/ice_door.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/structures/pillar.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/structures/struc.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/structures/struc.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/magic1/structures/structures.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/magic1/structures/wyrm_door.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/structures/wyrm_hive.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/magic1/structures/wyrm_tunnel.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/music/music.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/nav/nav.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/nav/nav.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/nav/navigation.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/nav/nav_bg.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/nav/nav_planet.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/nav/nav_planet.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/npc/alchemist.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/npc/alchemist.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/npc/builder.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/npc/builder_dead.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/npc/devs.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/npc/devs.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/npc/expressions.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/npc/farmer.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/npc/hunter.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/npc/hunter.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/npc/hunter_sheet.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/npc/miner.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/npc/npc.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/npc/npcs.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/npc/trader.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/player/death.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/player/layers.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/player/layers.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/player/light128.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/player/light192.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/player/light256.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/player/light32.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/player/light64.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/player/player.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/scenes/hunter/forest.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/scenes/hunter/hunter.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/scenes/hunter/hunter.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/scenes/hunter/scene.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/scenes/hunter/tent.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/scenes/hunter/wolf.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/scenes/hut/alchemist.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/scenes/hut/builder.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/scenes/hut/farmer.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/scenes/hut/fire.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/scenes/hut/hut.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/scenes/hut/miner.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/scenes/hut/scene.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/scenes/hut/trader.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/scenes/intro/intro.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/scenes/intro/sheet1.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/scenes/intro/sheet2.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/scenes/intro/sheet3.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/scenes/intro/sheet4.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/scenes/scenes.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/enemies/bandit_combo.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/enemies/bandit_combo.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/enemies/bandit_heavy.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/enemies/bandit_knives.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/enemies/bandit_ranged.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/enemies/cyborg_heavy_gun.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/enemies/cyborg_heavy_gun.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/enemies/diode_wolf.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/enemies/enemies.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/enemies/lightning.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/enemies/lightning.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/enemies/minotaur.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/enemies/mirrows.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/enemies/mirrows.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/enemies/steel_wyrm.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/enemies/stinger.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/enemies/throwing_knife.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/items/bullets.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/items/cyborg.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/items/cyborg.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/items/cyborg_pack.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/items/cyborg_pack.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/items/drill.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/items/drill.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/items/headlamp.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/items/headlamp_light.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/items/items.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/npc/fisher.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/npc/fisherman.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/npc/fisherman.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/npc/fisherman_boat.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/npc/lurker.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/npc/lurker.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/npc/mechanic.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/npc/mirrows.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/npc/npcs.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/npc/npcs.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/npc/townfolk.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/npc/townfolk.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/parallax/bg320.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/parallax/bg320.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/parallax/bg640.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/parallax/bg640.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/parallax/desert.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/parallax/parallax.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/parallax/town.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/sand.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/scenes/fisherman/bg.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/scenes/fisherman/scene.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/scenes/fisherman/sheet.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/scenes/fisherman/sheet.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/scenes/inn/bg.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/scenes/inn/innkeeper.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/scenes/inn/innkeeper.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/scenes/inn/scene.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/scenes/mechanic/bg.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/scenes/mechanic/mechanic.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/scenes/mechanic/mechanic.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/scenes/mechanic/scene.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/scenes/mirrows/bg.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/scenes/mirrows/bridge.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/scenes/mirrows/scene.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/scenes/mirrows/sheet.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/scenes/mirrows/sheet.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/scenes/scenes.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/science1.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/ship.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/structures/bridge.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/structures/bridge.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/structures/crashed_ship.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/structures/dock.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/structures/dock_front.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/structures/elevator.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/structures/elevator_chain.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/structures/elevator_winch.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/structures/factory.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/structures/food_market.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/structures/inn.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/structures/inn_door.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/structures/light.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/structures/lights.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/structures/lights.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/structures/markets.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/structures/medicom.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/structures/medivat.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/structures/medivat.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/structures/minodoor.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/structures/operate.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/structures/operate.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/structures/powerline1.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/structures/powerline2.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/structures/power_plant.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/structures/ship_crack1.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/structures/ship_crack2.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/structures/ship_door.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/structures/ship_door_light.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/structures/structures.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/science1/structures/warehouse.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/water_cave.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/science1/water_cave.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/sound/sounds.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/specials/ant.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/specials/ant.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/specials/specials.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/specials/tank.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/specials/tank.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/specials/weps.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/specials/weps.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/start/mountain.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/start/ocean.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/start/ocean.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/start/parallax/bg.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/start/parallax/clouds.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/start/parallax/moon1.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/start/parallax/moon2.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/start/parallax/night_bg.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/start/parallax/parallax.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/start/parallax/sun.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/start/parallax/tiles256.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/start/parallax/tiles256.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/start/parallax/tiles512.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/start/parallax/tiles512.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/start/parallax/water.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/start/parallax/waves.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/start/start.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/structures/boat.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/structures/boat_rail.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/structures/cage.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/structures/cave.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/structures/crafting.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/structures/dock.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/structures/dockhouse.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/structures/dock_front.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/structures/doorway.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/structures/dragon_lair.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/structures/dragon_lair_fx.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/structures/dragon_lair_fx.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/structures/farm.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/structures/farm_halloween.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/structures/food_market.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/structures/golem.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/structures/golemfactory.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/structures/hut.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/structures/kitchen.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/structures/kitchen2.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/structures/lab.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/structures/markets.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/structures/pen.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/structures/smelter.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/structures/storehouse.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/structures/structures.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/structures/tent.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/structures/workshop.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/structures/wreath.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/tiles/crack.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/tiles/debris.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/tiles/lava_glow.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/tiles/mountain_snow.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/tiles/tiles.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/tiles/tiles.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/tiles/whirlpool.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/trees/bush.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/trees/ice_bush.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/trees/red_bush.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/trees/tree.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/core/trees/tree.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/trees/trees.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/fonts/damage.fnt"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/fonts/font.fnt"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/fonts/font.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/fonts/heal.fnt"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/fonts/numbers.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/keyboards/default.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/mods/chinese/fonts/zpix.fnt.z"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/mods/chinese/fonts/zpix_0.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/mods/chinese/mod.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/mods/chinese/zh_CN.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/mods/chinese/zh_TW.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/mods/fan_translations/de_DE.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/mods/fan_translations/es.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/mods/fan_translations/fonts/uni.fnt"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/mods/fan_translations/fonts/uni.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/mods/fan_translations/fr.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/mods/fan_translations/it_IT.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/mods/fan_translations/mod.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/ui/achievement_bg.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/ui/achievement_flash.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/ui/ancient_scroll.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/ui/ancient_window.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/ui/bar.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/ui/bar_fuel.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/ui/black.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/ui/buttons.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/ui/ellipse.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/ui/equip.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/ui/game_over.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/ui/gradient.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/ui/icons.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/ui/inventory.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/ui/keys.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/ui/noise.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/ui/options.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/ui/points.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/ui/quest.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/ui/questlog.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/ui/speech.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/ui/sticky.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/ui/sync.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/ui/title.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/ui/title_full.jpg"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/ui/ui.png"; + this.path.set(id,id); + this.type.set(id,"IMAGE"); + id = "data/ui/ui.xml"; + this.path.set(id,id); + this.type.set(id,"TEXT"); + id = "data/core/sound/achievement.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/alien_death.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/ancient_axe.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/arrow_hit.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/attack.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/axe.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/axe_tree.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/bandit_combo_death.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/bandit_heavy_death.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/bandit_knives_death.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/bandit_knives_hit1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/bandit_knives_hit2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/bandit_knives_slash.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/bandit_knives_throw1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/bandit_knives_throw2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/bandit_knives_throw3.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/bandit_ranged_attack.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/bandit_ranged_death.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/bandit_ranged_hit.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/bark1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/bark2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/blocked.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/boar_attack.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/boar_death1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/boar_death2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/boar_death3.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/bolt_hit.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/bow.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/build.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/bullet.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/buy.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/cancel.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/chainsaw.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/chest_open.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/crawler_attack1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/crawler_attack2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/crawler_death1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/crawler_death2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/cyborg_death.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/death.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/diode_wolf_attack1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/diode_wolf_attack2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/diode_wolf_death1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/diode_wolf_death2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/diode_wolf_howl.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/dragonsword.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/dragon_atk.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/dragon_death.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/dragon_hit1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/dragon_hit2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/dragon_hit3.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/dragon_transform.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/dragon_wings.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/drill.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/drinking.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/drop.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/earthhammer.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/earth_spirit_attack.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/eat.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/elevator.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/equip.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/familiar_collect.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/fire.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/fireball.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/fire_bird_death1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/fire_bird_death2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/fire_boar_death1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/fire_boar_death2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/fishing.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/fishingrod.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/flamethrower.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/fuel.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/game_saved.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/ggolem_death1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/ggolem_death2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/goggles.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/goldensword.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/golem.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/golemech_death.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/golemech_laser.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/golem_attack.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/golem_death1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/golem_death2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/hide.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/icer_death.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/item.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/item_found.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/kitchen.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/leech_attack.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/leech_death1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/leech_death2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/levelup.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/low_hp.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/machine_gun.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/magic.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/magicwyrm_attack.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/magic_wyrm_death.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/map.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/mecha_wyrm_attack1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/mecha_wyrm_attack2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/mech_wyrm_death1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/mech_wyrm_death2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/meow.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/minotaur_charge1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/minotaur_charge2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/minotaur_charge3.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/minotaur_charge4.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/minotaur_death1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/minotaur_death2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/minotaur_impale.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/mirrow_d_death.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/mirrow_energyball.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/mirrow_lightning1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/mirrow_lightning2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/mirrow_lightning3.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/mirrow_n_death.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/mirrow_tentacle1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/mirrow_tentacle2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/miss.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/move.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/ocean_enter.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/ocean_exit.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/oldone_beam.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/oldone_open.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/orb_impact.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/orb_spawn.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/owl1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/owl2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/pick.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/place.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/plant_seed.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/plant_spirit_attack.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/player_death.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/purple_golem_death1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/purple_golem_death2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/purr.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/radioactive_bolt1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/radioactive_bolt2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/rain.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/rat_death1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/rat_death2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/rat_death3.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/recurvebow.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/revolver.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/rock_door.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/sailing.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/sail_open.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/select.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/shadowcat_attack.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/shadowcat_death1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/shadowcat_death2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/shell.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/shotgun1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/shotgun2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/skyfish_death1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/skyfish_death2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/skyfish_fire.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/skyfish_impact.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/smelter.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/smelter_loop.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/spider_attack.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/spider_death1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/spider_death2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/steel_axe.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/stinger_attack1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/stinger_attack2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/stinger_death1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/stinger_death2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/summon.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/sword.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/sword_swing.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/talking1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/talking2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/talking4.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/talking5.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/talking6.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/talking7.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/thunder.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/tree_felled.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/warning.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/whirlpool.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/whirlpool_portal.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/workshop.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/wyrmqueen_spawn.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/wyrm_attack.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/wyrm_death.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/wyrm_drill.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/wyrm_queen_death.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/yeti_breath.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/yeti_death1.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/yeti_death2.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/sound/yeti_snowball.ogg"; + this.path.set(id,id); + this.type.set(id,"SOUND"); + id = "data/core/music/boss.ogg"; + this.path.set(id,id); + this.type.set(id,"MUSIC"); + id = "data/core/music/Cutscene9.ogg"; + this.path.set(id,id); + this.type.set(id,"MUSIC"); + id = "data/core/music/game_over.ogg"; + this.path.set(id,id); + this.type.set(id,"MUSIC"); + id = "data/core/music/intro.ogg"; + this.path.set(id,id); + this.type.set(id,"MUSIC"); + id = "data/core/music/magic1.ogg"; + this.path.set(id,id); + this.type.set(id,"MUSIC"); + id = "data/core/music/nightly.ogg"; + this.path.set(id,id); + this.type.set(id,"MUSIC"); + id = "data/core/music/no_boundaries.ogg"; + this.path.set(id,id); + this.type.set(id,"MUSIC"); + id = "data/core/music/science1.ogg"; + this.path.set(id,id); + this.type.set(id,"MUSIC"); + id = "data/core/music/title.ogg"; + this.path.set(id,id); + this.type.set(id,"MUSIC"); + id = "data/core/music/underground.ogg"; + this.path.set(id,id); + this.type.set(id,"MUSIC"); + var assetsPrefix = null; + if(ApplicationMain.config != null && Reflect.hasField(ApplicationMain.config,"assetsPrefix")) { + assetsPrefix = ApplicationMain.config.assetsPrefix; + } + if(assetsPrefix != null) { + var k = this.path.keys(); + while(k.hasNext()) { + var k1 = k.next(); + this.path.set(k1,assetsPrefix + this.path.get(k1)); + } + } +}; +$hxClasses["DefaultAssetLibrary"] = DefaultAssetLibrary; +DefaultAssetLibrary.__name__ = ["DefaultAssetLibrary"]; +DefaultAssetLibrary.__super__ = lime_AssetLibrary; +DefaultAssetLibrary.prototype = $extend(lime_AssetLibrary.prototype,{ + path: null + ,type: null + ,exists: function(id,type) { + var requestedType = type != null ? js_Boot.__cast(type , String) : null; + var assetType = this.type.get(id); + if(assetType != null) { + if(assetType == requestedType || (requestedType == "SOUND" || requestedType == "MUSIC") && (assetType == "MUSIC" || assetType == "SOUND")) { + return true; + } + if(requestedType == "BINARY" || requestedType == null || assetType == "BINARY" && requestedType == "TEXT") { + return true; + } + } + return false; + } + ,getBytes: function(id) { + var loader = lime_app_Preloader.loaders.get(this.path.get(id)); + if(loader == null) { + return null; + } + var bytes = loader.bytes; + if(bytes != null) { + return bytes; + } else { + return null; + } + } + ,getImage: function(id) { + return lime_graphics_Image.fromImageElement(lime_app_Preloader.images.get(this.path.get(id))); + } + ,getPath: function(id) { + return this.path.get(id); + } + ,getText: function(id) { + var loader = lime_app_Preloader.loaders.get(this.path.get(id)); + if(loader == null) { + return null; + } + var bytes = loader.bytes; + if(bytes != null) { + return bytes.getString(0,bytes.length); + } else { + return null; + } + } + ,isLocal: function(id,type) { + var requestedType = type != null ? js_Boot.__cast(type , String) : null; + return true; + } + ,list: function(type) { + var requestedType = type != null ? js_Boot.__cast(type , String) : null; + var items = []; + var id = this.type.keys(); + while(id.hasNext()) { + var id1 = id.next(); + if(requestedType == null || this.exists(id1,type)) { + items.push(id1); + } + } + return items; + } + ,loadImage: function(id) { + var promise = new lime_app_Promise(); + if(this.path.exists(id)) { + var image = new Image(); + image.onload = function(_) { + var tmp = lime_graphics_Image.fromImageElement(image); + promise.complete(tmp); + }; + image.onerror = $bind(promise,promise.error); + var tmp1 = this.path.get(id) + "?"; + image.src = tmp1 + lime_Assets.cache.version; + } else { + var tmp2 = this.getImage(id); + promise.complete(tmp2); + } + return promise.future; + } + ,__class__: DefaultAssetLibrary +}); +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +$hxClasses["EReg"] = EReg; +EReg.__name__ = ["EReg"]; +EReg.prototype = { + r: null + ,match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw new js__$Boot_HaxeError("EReg::matched"); + } + } + ,replace: function(s,by) { + return s.replace(this.r,by); + } + ,__class__: EReg +}; +var HxOverrides = function() { }; +$hxClasses["HxOverrides"] = HxOverrides; +HxOverrides.__name__ = ["HxOverrides"]; +HxOverrides.dateStr = function(date) { + var m = date.getMonth() + 1; + var d = date.getDate(); + var h = date.getHours(); + var mi = date.getMinutes(); + var s = date.getSeconds(); + return date.getFullYear() + "-" + (m < 10 ? "0" + m : "" + m) + "-" + (d < 10 ? "0" + d : "" + d) + " " + (h < 10 ? "0" + h : "" + h) + ":" + (mi < 10 ? "0" + mi : "" + mi) + ":" + (s < 10 ? "0" + s : "" + s); +}; +HxOverrides.strDate = function(s) { + var _g = s.length; + switch(_g) { + case 8: + var k = s.split(":"); + var d = new Date(); + d["setTime"](0); + d["setUTCHours"](k[0]); + d["setUTCMinutes"](k[1]); + d["setUTCSeconds"](k[2]); + return d; + case 10: + var k1 = s.split("-"); + return new Date(k1[0],k1[1] - 1,k1[2],0,0,0); + case 19: + var k2 = s.split(" "); + var y = k2[0].split("-"); + var t = k2[1].split(":"); + return new Date(y[0],y[1] - 1,y[2],t[0],t[1],t[2]); + default: + throw new js__$Boot_HaxeError("Invalid date format : " + s); + } +}; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return js_Lib.get_undefined(); + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.remove = function(a,obj) { + var i = a.indexOf(obj); + if(i == -1) { + return false; + } + a.splice(i,1); + return true; +}; +HxOverrides.iter = function(a) { + return { cur : 0, arr : a, hasNext : function() { + return this.cur < this.arr.length; + }, next : function() { + return this.arr[this.cur++]; + }}; +}; +var IntIterator = function(min,max) { + this.min = min; + this.max = max; +}; +$hxClasses["IntIterator"] = IntIterator; +IntIterator.__name__ = ["IntIterator"]; +IntIterator.prototype = { + min: null + ,max: null + ,hasNext: function() { + return this.min < this.max; + } + ,next: function() { + return this.min++; + } + ,__class__: IntIterator +}; +var Lambda = function() { }; +$hxClasses["Lambda"] = Lambda; +Lambda.__name__ = ["Lambda"]; +Lambda.exists = function(it,f) { + var x = $iterator(it)(); + while(x.hasNext()) { + var x1 = x.next(); + if(f(x1)) { + return true; + } + } + return false; +}; +var List = function() { + this.length = 0; +}; +$hxClasses["List"] = List; +List.__name__ = ["List"]; +List.prototype = { + h: null + ,q: null + ,length: null + ,add: function(item) { + var x = new _$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,iterator: function() { + return new _$List_ListIterator(this.h); + } + ,__class__: List +}; +var _$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +$hxClasses["_List.ListNode"] = _$List_ListNode; +_$List_ListNode.__name__ = ["_List","ListNode"]; +_$List_ListNode.prototype = { + item: null + ,next: null + ,__class__: _$List_ListNode +}; +var _$List_ListIterator = function(head) { + this.head = head; +}; +$hxClasses["_List.ListIterator"] = _$List_ListIterator; +_$List_ListIterator.__name__ = ["_List","ListIterator"]; +_$List_ListIterator.prototype = { + head: null + ,hasNext: function() { + return this.head != null; + } + ,next: function() { + var val = this.head.item; + this.head = this.head.next; + return val; + } + ,__class__: _$List_ListIterator +}; +Math.__name__ = ["Math"]; +var NMEPreloader = function() { + openfl_display_Sprite.call(this); + var backgroundColor = this.getBackgroundColor(); + var r = backgroundColor >> 16 & 255; + var g = backgroundColor >> 8 & 255; + var b = backgroundColor & 255; + var perceivedLuminosity = 0.299 * r + 0.587 * g + 0.114 * b; + var color = 0; + if(perceivedLuminosity < 70) { + color = 16777215; + } + var x = 30; + var height = 7; + var y = this.getHeight() / 2 - height / 2; + var width = this.getWidth() - x * 2; + var padding = 2; + this.outline = new openfl_display_Sprite(); + this.outline.get_graphics().beginFill(color,0.07); + this.outline.get_graphics().drawRect(0,0,width,height); + this.outline.set_x(x); + this.outline.set_y(y); + this.addChild(this.outline); + this.progress = new openfl_display_Sprite(); + this.progress.get_graphics().beginFill(color,0.35); + this.progress.get_graphics().drawRect(0,0,width - padding * 2,height - padding * 2); + this.progress.set_x(x + padding); + this.progress.set_y(y + padding); + this.progress.set_scaleX(0); + this.addChild(this.progress); +}; +$hxClasses["NMEPreloader"] = NMEPreloader; +NMEPreloader.__name__ = ["NMEPreloader"]; +NMEPreloader.__super__ = openfl_display_Sprite; +NMEPreloader.prototype = $extend(openfl_display_Sprite.prototype,{ + outline: null + ,progress: null + ,getBackgroundColor: function() { + return 0; + } + ,getHeight: function() { + var height = 0; + if(height > 0) { + return height; + } else { + return openfl_Lib.current.stage.stageHeight; + } + } + ,getWidth: function() { + var width = 0; + if(width > 0) { + return width; + } else { + return openfl_Lib.current.stage.stageWidth; + } + } + ,onInit: function() { + } + ,onLoaded: function(p) { + this.dispatchEvent(new openfl_events_Event("complete")); + } + ,onUpdate: function(bytesLoaded,bytesTotal) { + var percentLoaded = bytesLoaded / bytesTotal; + if(percentLoaded > 1) { + percentLoaded = 1; + } + this.progress.set_scaleX(percentLoaded); + } + ,__class__: NMEPreloader +}); +var PriorityManager = function() { }; +$hxClasses["PriorityManager"] = PriorityManager; +PriorityManager.__name__ = ["PriorityManager"]; +PriorityManager.getPriority = function() { + return PriorityManager.priority + 1; +}; +var Reflect = function() { }; +$hxClasses["Reflect"] = Reflect; +Reflect.__name__ = ["Reflect"]; +Reflect.hasField = function(o,field) { + return Object.prototype.hasOwnProperty.call(o,field); +}; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( e ) { + haxe_CallStack.lastException = e; + return null; + } +}; +Reflect.setField = function(o,field,value) { + o[field] = value; +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.setProperty = function(o,field,value) { + var tmp; + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["set_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + o[tmp](value); + } else { + o[field] = value; + } +}; +Reflect.callMethod = function(o,func,args) { + return func.apply(o,args); +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isFunction = function(f) { + if(typeof(f) == "function") { + return !(js_Boot.isClass(f) || js_Boot.isEnum(f)); + } else { + return false; + } +}; +Reflect.compare = function(a,b) { + if(a == b) { + return 0; + } else if(a > b) { + return 1; + } else { + return -1; + } +}; +Reflect.compareMethods = function(f1,f2) { + if(f1 == f2) { + return true; + } + if(!Reflect.isFunction(f1) || !Reflect.isFunction(f2)) { + return false; + } + if(f1.scope == f2.scope && f1.method == f2.method) { + return f1.method != null; + } else { + return false; + } +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (js_Boot.isClass(v) || js_Boot.isEnum(v)) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.isEnumValue = function(v) { + if(v != null) { + return v.__enum__ != null; + } else { + return false; + } +}; +Reflect.deleteField = function(o,field) { + if(!Reflect.hasField(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.makeVarArgs = function(f) { + return function() { + var a = Array.prototype.slice.call(arguments); + return f(a); + }; +}; +var Std = function() { }; +$hxClasses["Std"] = Std; +Std.__name__ = ["Std"]; +Std["is"] = function(v,t) { + return js_Boot.__instanceof(v,t); +}; +Std.instance = function(value,c) { + if((value instanceof c)) { + return value; + } else { + return null; + } +}; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std["int"] = function(x) { + return x | 0; +}; +Std.parseInt = function(x) { + var v = parseInt(x,10); + if(v == 0 && (HxOverrides.cca(x,1) == 120 || HxOverrides.cca(x,1) == 88)) { + v = parseInt(x); + } + if(isNaN(v)) { + return null; + } + return v; +}; +Std.parseFloat = function(x) { + return parseFloat(x); +}; +Std.random = function(x) { + if(x <= 0) { + return 0; + } else { + return Math.floor(Math.random() * x); + } +}; +var StringBuf = function() { + this.b = ""; +}; +$hxClasses["StringBuf"] = StringBuf; +StringBuf.__name__ = ["StringBuf"]; +StringBuf.prototype = { + b: null + ,get_length: function() { + return this.b.length; + } + ,add: function(x) { + this.b += Std.string(x); + } + ,addChar: function(c) { + this.b += String.fromCharCode(c); + } + ,addSub: function(s,pos,len) { + this.b += len == null ? HxOverrides.substr(s,pos,null) : HxOverrides.substr(s,pos,len); + } + ,toString: function() { + return this.b; + } + ,__class__: StringBuf + ,__properties__: {get_length:"get_length"} +}; +var StringTools = function() { }; +$hxClasses["StringTools"] = StringTools; +StringTools.__name__ = ["StringTools"]; +StringTools.urlEncode = function(s) { + return encodeURIComponent(s); +}; +StringTools.urlDecode = function(s) { + return decodeURIComponent(s.split("+").join(" ")); +}; +StringTools.htmlEscape = function(s,quotes) { + s = s.split("&").join("&").split("<").join("<").split(">").join(">"); + if(quotes) { + return s.split("\"").join(""").split("'").join("'"); + } else { + return s; + } +}; +StringTools.htmlUnescape = function(s) { + return s.split(">").join(">").split("<").join("<").split(""").join("\"").split("'").join("'").split("&").join("&"); +}; +StringTools.startsWith = function(s,start) { + if(s.length >= start.length) { + return HxOverrides.substr(s,0,start.length) == start; + } else { + return false; + } +}; +StringTools.endsWith = function(s,end) { + var elen = end.length; + var slen = s.length; + if(slen >= elen) { + return HxOverrides.substr(s,slen - elen,elen) == end; + } else { + return false; + } +}; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.lpad = function(s,c,l) { + if(c.length <= 0) { + return s; + } + while(s.length < l) s = c + s; + return s; +}; +StringTools.rpad = function(s,c,l) { + if(c.length <= 0) { + return s; + } + while(s.length < l) s += c; + return s; +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +StringTools.hex = function(n,digits) { + var s = ""; + var hexChars = "0123456789ABCDEF"; + while(true) { + s = hexChars.charAt(n & 15) + s; + n >>>= 4; + if(!(n > 0)) { + break; + } + } + if(digits != null) { + while(s.length < digits) s = "0" + s; + } + return s; +}; +StringTools.fastCodeAt = function(s,index) { + return s.charCodeAt(index); +}; +StringTools.isEof = function(c) { + return c != c; +}; +StringTools.quoteUnixArg = function(argument) { + if(argument == "") { + return "''"; + } + if(!new EReg("[^a-zA-Z0-9_@%+=:,./-]","").match(argument)) { + return argument; + } + return "'" + StringTools.replace(argument,"'","'\"'\"'") + "'"; +}; +StringTools.quoteWinArg = function(argument,escapeMetaCharacters) { + if(!new EReg("^[^ \t\\\\\"]+$","").match(argument)) { + var result = new StringBuf(); + var needquote = argument.indexOf(" ") != -1 || argument.indexOf("\t") != -1 || argument == ""; + if(needquote) { + result.add("\""); + } + var bs_buf = new StringBuf(); + var _g1 = 0; + var _g = argument.length; + while(_g1 < _g) { + var i = _g1++; + var _g2 = HxOverrides.cca(argument,i); + if(_g2 == null) { + var c = _g2; + if(bs_buf.get_length() > 0) { + result.add(bs_buf.toString()); + bs_buf = new StringBuf(); + } + result.addChar(c); + } else { + switch(_g2) { + case 34: + var bs = bs_buf.toString(); + result.add(bs); + result.add(bs); + bs_buf = new StringBuf(); + result.add("\\\""); + break; + case 92: + bs_buf.add("\\"); + break; + default: + var c1 = _g2; + if(bs_buf.get_length() > 0) { + result.add(bs_buf.toString()); + bs_buf = new StringBuf(); + } + result.addChar(c1); + } + } + } + result.add(bs_buf.toString()); + if(needquote) { + result.add(bs_buf.toString()); + result.add("\""); + } + argument = result.toString(); + } + if(escapeMetaCharacters) { + var result1 = new StringBuf(); + var _g11 = 0; + var _g3 = argument.length; + while(_g11 < _g3) { + var i1 = _g11++; + var c2 = HxOverrides.cca(argument,i1); + if(StringTools.winMetaCharacters.indexOf(c2) >= 0) { + result1.addChar(94); + } + result1.addChar(c2); + } + return result1.toString(); + } else { + return argument; + } +}; +var ValueType = $hxClasses["ValueType"] = { __ename__ : ["ValueType"], __constructs__ : ["TNull","TInt","TFloat","TBool","TObject","TFunction","TClass","TEnum","TUnknown"] }; +ValueType.TNull = ["TNull",0]; +ValueType.TNull.toString = $estr; +ValueType.TNull.__enum__ = ValueType; +ValueType.TInt = ["TInt",1]; +ValueType.TInt.toString = $estr; +ValueType.TInt.__enum__ = ValueType; +ValueType.TFloat = ["TFloat",2]; +ValueType.TFloat.toString = $estr; +ValueType.TFloat.__enum__ = ValueType; +ValueType.TBool = ["TBool",3]; +ValueType.TBool.toString = $estr; +ValueType.TBool.__enum__ = ValueType; +ValueType.TObject = ["TObject",4]; +ValueType.TObject.toString = $estr; +ValueType.TObject.__enum__ = ValueType; +ValueType.TFunction = ["TFunction",5]; +ValueType.TFunction.toString = $estr; +ValueType.TFunction.__enum__ = ValueType; +ValueType.TClass = function(c) { var $x = ["TClass",6,c]; $x.__enum__ = ValueType; $x.toString = $estr; return $x; }; +ValueType.TEnum = function(e) { var $x = ["TEnum",7,e]; $x.__enum__ = ValueType; $x.toString = $estr; return $x; }; +ValueType.TUnknown = ["TUnknown",8]; +ValueType.TUnknown.toString = $estr; +ValueType.TUnknown.__enum__ = ValueType; +var Type = function() { }; +$hxClasses["Type"] = Type; +Type.__name__ = ["Type"]; +Type.getClass = function(o) { + if(o == null) { + return null; + } else { + return js_Boot.getClass(o); + } +}; +Type.getClassName = function(c) { + var a = c.__name__; + if(a == null) { + return null; + } + return a.join("."); +}; +Type.getEnumName = function(e) { + var a = e.__ename__; + return a.join("."); +}; +Type.resolveClass = function(name) { + var cl = $hxClasses[name]; + if(cl == null || !js_Boot.isClass(cl)) { + return null; + } + return cl; +}; +Type.resolveEnum = function(name) { + var e = $hxClasses[name]; + if(e == null || !js_Boot.isEnum(e)) { + return null; + } + return e; +}; +Type.createInstance = function(cl,args) { + var _g = args.length; + switch(_g) { + case 0: + return new cl(); + case 1: + return new cl(args[0]); + case 2: + return new cl(args[0],args[1]); + case 3: + return new cl(args[0],args[1],args[2]); + case 4: + return new cl(args[0],args[1],args[2],args[3]); + case 5: + return new cl(args[0],args[1],args[2],args[3],args[4]); + case 6: + return new cl(args[0],args[1],args[2],args[3],args[4],args[5]); + case 7: + return new cl(args[0],args[1],args[2],args[3],args[4],args[5],args[6]); + case 8: + return new cl(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7]); + case 9: + return new cl(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8]); + case 10: + return new cl(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9]); + case 11: + return new cl(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10]); + case 12: + return new cl(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10],args[11]); + case 13: + return new cl(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10],args[11],args[12]); + case 14: + return new cl(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10],args[11],args[12],args[13]); + default: + throw new js__$Boot_HaxeError("Too many arguments"); + } +}; +Type.createEmptyInstance = function(cl) { + function empty() {}; empty.prototype = cl.prototype; + return new empty(); +}; +Type.createEnum = function(e,constr,params) { + var f = Reflect.field(e,constr); + if(f == null) { + throw new js__$Boot_HaxeError("No such constructor " + constr); + } + if(Reflect.isFunction(f)) { + if(params == null) { + throw new js__$Boot_HaxeError("Constructor " + constr + " need parameters"); + } + return Reflect.callMethod(e,f,params); + } + if(params != null && params.length != 0) { + throw new js__$Boot_HaxeError("Constructor " + constr + " does not need parameters"); + } + return f; +}; +Type.getInstanceFields = function(c) { + var a = []; + for(var i in c.prototype) a.push(i); + HxOverrides.remove(a,"__class__"); + HxOverrides.remove(a,"__properties__"); + return a; +}; +Type.getClassFields = function(c) { + var a = Reflect.fields(c); + HxOverrides.remove(a,"__name__"); + HxOverrides.remove(a,"__interfaces__"); + HxOverrides.remove(a,"__properties__"); + HxOverrides.remove(a,"__super__"); + HxOverrides.remove(a,"__meta__"); + HxOverrides.remove(a,"prototype"); + return a; +}; +Type.getEnumConstructs = function(e) { + return e.__constructs__.slice(); +}; +Type["typeof"] = function(v) { + var _g = typeof(v); + switch(_g) { + case "boolean": + return ValueType.TBool; + case "function": + if(js_Boot.isClass(v) || js_Boot.isEnum(v)) { + return ValueType.TObject; + } + return ValueType.TFunction; + case "number": + if(Math.ceil(v) == v % 2147483648.0) { + return ValueType.TInt; + } + return ValueType.TFloat; + case "object": + if(v == null) { + return ValueType.TNull; + } + var e = v.__enum__; + if(e != null) { + return ValueType.TEnum(e); + } + var c = js_Boot.getClass(v); + if(c != null) { + return ValueType.TClass(c); + } + return ValueType.TObject; + case "string": + return ValueType.TClass(String); + case "undefined": + return ValueType.TNull; + default: + return ValueType.TUnknown; + } +}; +Type.enumEq = function(a,b) { + if(a == b) { + return true; + } + try { + if(a[0] != b[0]) { + return false; + } + var _g1 = 2; + var _g = a.length; + while(_g1 < _g) { + var i = _g1++; + if(!Type.enumEq(a[i],b[i])) { + return false; + } + } + var e = a.__enum__; + if(e != b.__enum__ || e == null) { + return false; + } + } catch( e1 ) { + haxe_CallStack.lastException = e1; + return false; + } + return true; +}; +Type.enumConstructor = function(e) { + return e[0]; +}; +Type.enumParameters = function(e) { + return e.slice(2); +}; +Type.enumIndex = function(e) { + return e[1]; +}; +var _$UInt_UInt_$Impl_$ = {}; +$hxClasses["_UInt.UInt_Impl_"] = _$UInt_UInt_$Impl_$; +_$UInt_UInt_$Impl_$.__name__ = ["_UInt","UInt_Impl_"]; +_$UInt_UInt_$Impl_$.toFloat = function(this1) { + var $int = this1; + if($int < 0) { + return 4294967296.0 + $int; + } else { + return $int + 0.0; + } +}; +var Xml = function(nodeType) { + this.nodeType = nodeType; + this.children = []; + this.attributeMap = new haxe_ds_StringMap(); +}; +$hxClasses["Xml"] = Xml; +Xml.__name__ = ["Xml"]; +Xml.parse = function(str) { + return haxe_xml_Parser.parse(str); +}; +Xml.createElement = function(name) { + var xml = new Xml(Xml.Element); + xml.set_nodeName(name); + return xml; +}; +Xml.createPCData = function(data) { + var xml = new Xml(Xml.PCData); + xml.set_nodeValue(data); + return xml; +}; +Xml.createCData = function(data) { + var xml = new Xml(Xml.CData); + xml.set_nodeValue(data); + return xml; +}; +Xml.createComment = function(data) { + var xml = new Xml(Xml.Comment); + xml.set_nodeValue(data); + return xml; +}; +Xml.createDocType = function(data) { + var xml = new Xml(Xml.DocType); + xml.set_nodeValue(data); + return xml; +}; +Xml.createProcessingInstruction = function(data) { + var xml = new Xml(Xml.ProcessingInstruction); + xml.set_nodeValue(data); + return xml; +}; +Xml.createDocument = function() { + return new Xml(Xml.Document); +}; +Xml.prototype = { + nodeType: null + ,nodeName: null + ,nodeValue: null + ,parent: null + ,children: null + ,attributeMap: null + ,get_nodeName: function() { + if(this.nodeType != Xml.Element) { + throw new js__$Boot_HaxeError("Bad node type, expected Element but found " + this.nodeType); + } + return this.nodeName; + } + ,set_nodeName: function(v) { + if(this.nodeType != Xml.Element) { + throw new js__$Boot_HaxeError("Bad node type, expected Element but found " + this.nodeType); + } + return this.nodeName = v; + } + ,get_nodeValue: function() { + if(this.nodeType == Xml.Document || this.nodeType == Xml.Element) { + throw new js__$Boot_HaxeError("Bad node type, unexpected " + this.nodeType); + } + return this.nodeValue; + } + ,set_nodeValue: function(v) { + if(this.nodeType == Xml.Document || this.nodeType == Xml.Element) { + throw new js__$Boot_HaxeError("Bad node type, unexpected " + this.nodeType); + } + return this.nodeValue = v; + } + ,get: function(att) { + if(this.nodeType != Xml.Element) { + throw new js__$Boot_HaxeError("Bad node type, expected Element but found " + this.nodeType); + } + return this.attributeMap.get(att); + } + ,set: function(att,value) { + if(this.nodeType != Xml.Element) { + throw new js__$Boot_HaxeError("Bad node type, expected Element but found " + this.nodeType); + } + this.attributeMap.set(att,value); + } + ,exists: function(att) { + if(this.nodeType != Xml.Element) { + throw new js__$Boot_HaxeError("Bad node type, expected Element but found " + this.nodeType); + } + return this.attributeMap.exists(att); + } + ,attributes: function() { + if(this.nodeType != Xml.Element) { + throw new js__$Boot_HaxeError("Bad node type, expected Element but found " + this.nodeType); + } + return this.attributeMap.keys(); + } + ,iterator: function() { + this.ensureElementType(); + return HxOverrides.iter(this.children); + } + ,elements: function() { + this.ensureElementType(); + var _g = []; + var _g1 = 0; + var _g2 = this.children; + while(_g1 < _g2.length) { + var child = _g2[_g1]; + ++_g1; + if(child.nodeType == Xml.Element) { + _g.push(child); + } + } + var ret = _g; + return HxOverrides.iter(ret); + } + ,elementsNamed: function(name) { + this.ensureElementType(); + var _g = []; + var _g1 = 0; + var _g2 = this.children; + while(_g1 < _g2.length) { + var child = _g2[_g1]; + ++_g1; + if(child.nodeType == Xml.Element && child.get_nodeName() == name) { + _g.push(child); + } + } + var ret = _g; + return HxOverrides.iter(ret); + } + ,firstChild: function() { + this.ensureElementType(); + return this.children[0]; + } + ,firstElement: function() { + this.ensureElementType(); + var _g = 0; + var _g1 = this.children; + while(_g < _g1.length) { + var child = _g1[_g]; + ++_g; + if(child.nodeType == Xml.Element) { + return child; + } + } + return null; + } + ,addChild: function(x) { + this.ensureElementType(); + if(x.parent != null) { + x.parent.removeChild(x); + } + this.children.push(x); + x.parent = this; + } + ,removeChild: function(x) { + this.ensureElementType(); + if(HxOverrides.remove(this.children,x)) { + x.parent = null; + return true; + } + return false; + } + ,toString: function() { + return haxe_xml_Printer.print(this); + } + ,ensureElementType: function() { + if(this.nodeType != Xml.Document && this.nodeType != Xml.Element) { + throw new js__$Boot_HaxeError("Bad node type, expected Element or Document but found " + this.nodeType); + } + } + ,__class__: Xml + ,__properties__: {set_nodeValue:"set_nodeValue",get_nodeValue:"get_nodeValue",set_nodeName:"set_nodeName",get_nodeName:"get_nodeName"} +}; +var com_davidmaletz_controls_ClickableColumns = function() { }; +$hxClasses["com.davidmaletz.controls.ClickableColumns"] = com_davidmaletz_controls_ClickableColumns; +com_davidmaletz_controls_ClickableColumns.__name__ = ["com","davidmaletz","controls","ClickableColumns"]; +com_davidmaletz_controls_ClickableColumns.prototype = { + getCount: null + ,getParent: null + ,get: null + ,clear: null + ,addClickable: null + ,changeSelected: null + ,inBounds: null + ,getYOffset: null + ,setAddListener: null + ,canSelect: null + ,__class__: com_davidmaletz_controls_ClickableColumns +}; +var com_davidmaletz_controls_ArrayClickableColumns = function() { + this.clickables = []; + this.parents = []; +}; +$hxClasses["com.davidmaletz.controls.ArrayClickableColumns"] = com_davidmaletz_controls_ArrayClickableColumns; +com_davidmaletz_controls_ArrayClickableColumns.__name__ = ["com","davidmaletz","controls","ArrayClickableColumns"]; +com_davidmaletz_controls_ArrayClickableColumns.__interfaces__ = [com_davidmaletz_controls_ClickableColumns]; +com_davidmaletz_controls_ArrayClickableColumns.prototype = { + clickables: null + ,parents: null + ,getCount: function() { + return this.clickables.length; + } + ,getParent: function(col) { + return this.parents[col]; + } + ,get: function(col) { + return this.clickables[col]; + } + ,clear: function() { + com_fancyfish_faeng_common_Utils.clear(this.clickables); + com_fancyfish_faeng_common_Utils.clear(this.parents); + } + ,addColumn: function(col,c,parent) { + this.clickables.splice(col,0,[c]); + this.parents.splice(col,0,parent); + } + ,addClickable: function(c,parent,w) { + var b = c.getPos(); + var len = this.getCount(); + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + var ar = this.get(i); + var x = ar[0].getPos().x; + if(b.x < x) { + this.addColumn(i,c,parent); + this.fireAdd(c,parent,i,w); + return; + } else if(b.x == x) { + var pos = com_davidmaletz_controls_ClickableHandler.lower_bound(ar,b.y); + ar.splice(pos,0,c); + this.fireAdd(c,parent,i,w); + return; + } + } + var i1 = this.getCount(); + this.addColumn(i1,c,parent); + this.fireAdd(c,parent,i1,w); + } + ,changeSelected: function(selected,col) { + } + ,inBounds: function(col,p) { + return true; + } + ,getYOffset: function(col) { + return 0; + } + ,listener: null + ,setAddListener: function(func) { + this.listener = func; + } + ,fireAdd: function(c,parent,i,w) { + if(w > 1) { + var s = i + 1; + var e = i + w; + var len = this.getCount(); + var b = c.getPos(); + var _g1 = s; + var _g = e; + while(_g1 < _g) { + var j = _g1++; + if(j < len) { + var ar = this.get(j); + var pos = com_davidmaletz_controls_ClickableHandler.lower_bound(ar,b.y); + ar.splice(pos,0,c); + } else { + this.addColumn(j,c,parent); + } + } + } + if(this.listener != null) { + this.listener(); + } + } + ,canSelect: function(col,c) { + return c.canSelect(); + } + ,__class__: com_davidmaletz_controls_ArrayClickableColumns +}; +var com_davidmaletz_controls_Clickable = function() { }; +$hxClasses["com.davidmaletz.controls.Clickable"] = com_davidmaletz_controls_Clickable; +com_davidmaletz_controls_Clickable.__name__ = ["com","davidmaletz","controls","Clickable"]; +com_davidmaletz_controls_Clickable.prototype = { + getPos: null + ,onHover: null + ,onClick: null + ,canSelect: null + ,__class__: com_davidmaletz_controls_Clickable +}; +var com_davidmaletz_controls_Button = function(x,y,bg,hover,text,col,scale,fnt) { + if(scale == null) { + scale = 1; + } + if(col == null) { + col = 0; + } + this.onClickFunc = null; + openfl_display_Sprite.call(this); + var w = bg.getWidth(); + var h = bg.getHeight(); + this._bounds = new openfl_geom_Rectangle(x,y,w,h); + this.bg = bg.create(0,0); + this.hover = hover.create(0,0); + this.set_x(x); + this.set_y(y); + if(this.bg != null) { + this.addChild(this.bg); + } + if(this.hover != null) { + this.hover.set_visible(false); + this.addChild(this.hover); + } + if(text != null) { + var t = new com_davidmaletz_faengfl_TextSprite(text,new com_fancyfish_faeng_text_CharacterPlacer(w,this.getTextAlign()),col,scale,fnt); + t.set_y((h - scale * (t.lineHeight() - 2)) * 0.5 - 1); + this.addChild(t); + } +}; +$hxClasses["com.davidmaletz.controls.Button"] = com_davidmaletz_controls_Button; +com_davidmaletz_controls_Button.__name__ = ["com","davidmaletz","controls","Button"]; +com_davidmaletz_controls_Button.__interfaces__ = [com_davidmaletz_controls_Clickable]; +com_davidmaletz_controls_Button.__super__ = openfl_display_Sprite; +com_davidmaletz_controls_Button.prototype = $extend(openfl_display_Sprite.prototype,{ + _bounds: null + ,bg: null + ,hover: null + ,onClickFunc: null + ,getTextAlign: function() { + return 1; + } + ,getPos: function() { + return this._bounds; + } + ,onHover: function(hover) { + if(this.bg != null) { + this.bg.set_visible(!hover); + } + if(this.hover != null) { + this.hover.set_visible(hover); + } + } + ,onClick: function() { + if(this.onClickFunc != null) { + this.onClickFunc(); + } + return true; + } + ,canSelect: function() { + return this.get_visible(); + } + ,__class__: com_davidmaletz_controls_Button +}); +var com_davidmaletz_controls_ClickableHandler = function(l,cols) { + this.selected = null; + this.pressed = null; + this.allowLoop = true; + this.isInit = false; + this.clickables = cols == null ? new com_davidmaletz_controls_ArrayClickableColumns() : cols; + this.listener = l; + this.clickables.setAddListener($bind(this,this.addListener)); +}; +$hxClasses["com.davidmaletz.controls.ClickableHandler"] = com_davidmaletz_controls_ClickableHandler; +com_davidmaletz_controls_ClickableHandler.__name__ = ["com","davidmaletz","controls","ClickableHandler"]; +com_davidmaletz_controls_ClickableHandler.lower_bound = function(ar,y) { + var count = ar.length; + var cur = 0; + var step; + while(count > 0) { + step = count >> 1; + var val = ar[cur + step].getPos().y; + if(val < y) { + cur += step + 1; + count -= step + 1; + } else if(val == y) { + return cur + step; + } else { + count = step; + } + } + return cur; +}; +com_davidmaletz_controls_ClickableHandler.point = null; +com_davidmaletz_controls_ClickableHandler.prototype = { + clickables: null + ,isInit: null + ,init: function() { + com_davidmaletz_controls_Controller.instance.addEventListener("tap",$bind(this,this.tap),false,com_davidmaletz_faengfl_Window.window_ct); + com_davidmaletz_controls_Controller.instance.addEventListener("press",$bind(this,this.modal),false,com_davidmaletz_faengfl_Window.window_ct); + com_davidmaletz_controls_Controller.instance.addEventListener("release",$bind(this,this.modal),false,com_davidmaletz_faengfl_Window.window_ct); + openfl_Lib.current.stage.addEventListener("keyDown",$bind(this,this.key),false,com_davidmaletz_faengfl_Window.window_ct); + if(this.selected == null) { + this.moveSelection(1,0); + } + this.isInit = true; + } + ,destroy: function() { + this.isInit = false; + com_davidmaletz_controls_Controller.instance.removeEventListener("tap",$bind(this,this.tap)); + com_davidmaletz_controls_Controller.instance.removeEventListener("press",$bind(this,this.modal)); + com_davidmaletz_controls_Controller.instance.removeEventListener("release",$bind(this,this.modal)); + openfl_Lib.current.stage.removeEventListener("keyDown",$bind(this,this.key)); + } + ,modal: function(e) { + e.stopImmediatePropagation(); + } + ,addClickable: function(c,parent,w) { + if(w == null) { + w = 1; + } + this.clickables.addClickable(c,parent,w); + } + ,addListener: function() { + if(this.selected != null) { + var len = this.clickables.getCount(); + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var x = _g1++; + var ar = this.clickables.get(x); + var l = ar.length; + var _g3 = 0; + var _g2 = l; + while(_g3 < _g2) { + var y = _g3++; + if(ar[y] == this.selected) { + this.setSelected(this.selected,x,y); + return; + } + } + } + this.setSelected(null,0,0); + } + } + ,clickOnSelect: function(c,x,y) { + return false; + } + ,doClick: function() { + if(this.selected != null && this.clickables.canSelect(this.sel_x,this.selected) && this.listener.canSelect(this.selected)) { + if(this.selected.onClick() && com_davidmaletz_controls_ClickableHandler.globalOnSelect != null) { + com_davidmaletz_controls_ClickableHandler.globalOnSelect(); + } + } + } + ,allowLoop: null + ,moveSelection: function(dx,dy,clamp) { + if(clamp == null) { + clamp = false; + } + var len = this.clickables.getCount(); + if(len == 0) { + return; + } + if(!this.allowLoop) { + clamp = true; + } + if(this.selected == null || !this.clickables.canSelect(this.sel_x,this.selected)) { + var y = this.clickables.getYOffset(0); + var ar = this.clickables.get(0); + if(y >= ar.length) { + y = ar.length - 1; + } + this.setSelected(ar[y],0,y); + } else { + var x = this.sel_x + dx; + var y1 = this.sel_y + dy; + if(clamp) { + if(x < 0) { + x = 0; + } else if(x >= len) { + x = len - 1; + } + } else if(x < 0 || x >= len) { + return; + } + if(x != this.sel_x) { + y1 += this.clickables.getYOffset(x) - this.clickables.getYOffset(this.sel_x); + } + var ar1 = this.clickables.get(x); + if(y1 < 0) { + if(clamp) { + y1 = 0; + } else if(dy == -1) { + y1 = ar1.length; + } else { + return; + } + } + var s = com_fancyfish_faeng_common_Utils.sign(dx); + if(s != 0) { + --len; + var _x = x; + while(s > 0 ? x < len : x > 0) { + if(ar1.length <= y1 || ar1[y1] != this.selected) { + break; + } + x += s; + ar1 = this.clickables.get(x); + } + if(s < 0) { + var cur = ar1[y1]; + while(s > 0 ? x < len : x > 0) { + var a = this.clickables.get(x + s); + if(a.length <= y1 || a[y1] != cur) { + break; + } + x += s; + ar1 = a; + } + } + } + if(y1 >= ar1.length) { + if(!clamp && dy == 1) { + y1 = 0; + } else { + y1 = ar1.length - 1; + } + } + if(this.clickables.canSelect(x,ar1[y1]) && this.setSelected(ar1[y1],x,y1)) { + if(this.clickOnSelect(this.selected,x,y1)) { + this.doClick(); + } else if(this.isInit && com_davidmaletz_controls_ClickableHandler.globalOnMove != null) { + com_davidmaletz_controls_ClickableHandler.globalOnMove(); + } + } + } + } + ,listener: null + ,tap: function(e) { + this.modal(e); + if(this.pressed == null) { + var _g = e.key; + switch(_g) { + case "cancel": + if(this.listener != null) { + if(com_davidmaletz_controls_ClickableHandler.globalOnCancel != null) { + com_davidmaletz_controls_ClickableHandler.globalOnCancel(); + } + this.listener.onCancel(); + } + break; + case "down": + this.moveSelection(0,1); + break; + case "left": + this.moveSelection(-1,0); + break; + case "right": + this.moveSelection(1,0); + break; + case "select": + if(this.selected != null) { + this.doClick(); + } else if(this.listener != null && this.listener.canSelect(null)) { + this.listener.onEmptySelect(); + } + break; + case "up": + this.moveSelection(0,-1); + break; + } + } + } + ,key: function(e) { + var _g = e.keyCode; + switch(_g) { + case 33: + this.moveSelection(0,-10,true); + e.stopImmediatePropagation(); + e.preventDefault(); + break; + case 34: + this.moveSelection(0,10,true); + e.stopImmediatePropagation(); + e.preventDefault(); + break; + case 35: + this.moveSelection(10,0,true); + e.stopImmediatePropagation(); + e.preventDefault(); + break; + case 36: + this.moveSelection(-10,0,true); + e.stopImmediatePropagation(); + e.preventDefault(); + break; + } + } + ,pressed: null + ,selected: null + ,sel_x: null + ,sel_y: null + ,changeSelected: function() { + this.clickables.changeSelected(this.selected,this.sel_x); + } + ,setSelection: function(x,y) { + return this.setSelected(this.clickables.get(x)[y],x,y); + } + ,setSelected: function(c,x,y) { + if(this.selected != c) { + if(this.selected != null) { + this.selected.onHover(false); + } + this.selected = c; + if(this.selected != null) { + this.selected.onHover(true); + this.sel_x = x; + this.sel_y = y; + this.changeSelected(); + } + return true; + } else { + this.sel_x = x; + this.sel_y = y; + return false; + } + } + ,setSelectedItem: function(c) { + var len = this.clickables.getCount(); + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + var ar = this.clickables.get(i); + var arlen = ar.length; + var _g3 = 0; + var _g2 = arlen; + while(_g3 < _g2) { + var j = _g3++; + if(ar[j] == c) { + this.setSelected(c,i,j); + return; + } + } + } + } + ,getSelected: function() { + return this.selected; + } + ,getSelectedParent: function() { + return this.clickables.getParent(this.sel_x); + } + ,getClickable: function(e) { + if(com_davidmaletz_controls_ClickableHandler.point == null) { + com_davidmaletz_controls_ClickableHandler.point = new openfl_geom_Point(e.stageX,e.stageY); + } else { + com_davidmaletz_controls_ClickableHandler.point.setTo(e.stageX,e.stageY); + } + var len = this.clickables.getCount(); + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + if(!this.clickables.getParent(i).get_visible()) { + continue; + } + var p = this.clickables.getParent(i).globalToLocal(com_davidmaletz_controls_ClickableHandler.point); + var ar = this.clickables.get(i); + if(!this.clickables.inBounds(i,p)) { + continue; + } + var j = com_davidmaletz_controls_ClickableHandler.lower_bound(ar,p.y); + if(j > 0) { + var c = ar[j - 1]; + if(c.getPos().containsPoint(p)) { + return { clickable : c, x : i, y : j - 1}; + } + } + } + return null; + } + ,down: function(e) { + var c = this.getClickable(e); + if(c != null) { + this.setSelected(c.clickable,c.x,c.y); + this.pressed = c.clickable; + } else { + this.setSelected(null,0,0); + if(this.listener != null && this.listener.canSelect(null)) { + this.listener.onEmptySelect(); + } + } + } + ,up: function(e) { + if(this.pressed != null) { + if(this.pressed != this.selected) { + this.pressed = null; + return; + } + if(com_davidmaletz_controls_ClickableHandler.point == null) { + com_davidmaletz_controls_ClickableHandler.point = new openfl_geom_Point(e.stageX,e.stageY); + } else { + com_davidmaletz_controls_ClickableHandler.point.setTo(e.stageX,e.stageY); + } + var p = this.clickables.getParent(this.sel_x).globalToLocal(com_davidmaletz_controls_ClickableHandler.point); + if(this.pressed.getPos().containsPoint(p)) { + this.doClick(); + } + this.pressed = null; + } + } + ,move: function(e) { + this.reset(e); + } + ,reset: function(e) { + var c = this.getClickable(e); + if(c != null) { + this.setSelected(c.clickable,c.x,c.y); + } else { + this.setSelected(null,0,0); + } + } + ,__class__: com_davidmaletz_controls_ClickableHandler +}; +var com_davidmaletz_controls_Listener = function() { }; +$hxClasses["com.davidmaletz.controls.Listener"] = com_davidmaletz_controls_Listener; +com_davidmaletz_controls_Listener.__name__ = ["com","davidmaletz","controls","Listener"]; +com_davidmaletz_controls_Listener.prototype = { + onEmptySelect: null + ,onCancel: null + ,canSelect: null + ,__class__: com_davidmaletz_controls_Listener +}; +var com_davidmaletz_controls_ClickableSprite = function() { + this.clickables = new com_davidmaletz_controls_ClickableHandler(this,this.createClickables()); + com_davidmaletz_lerp_LerpSprite.call(this); +}; +$hxClasses["com.davidmaletz.controls.ClickableSprite"] = com_davidmaletz_controls_ClickableSprite; +com_davidmaletz_controls_ClickableSprite.__name__ = ["com","davidmaletz","controls","ClickableSprite"]; +com_davidmaletz_controls_ClickableSprite.__interfaces__ = [com_davidmaletz_controls_Listener]; +com_davidmaletz_controls_ClickableSprite.__super__ = com_davidmaletz_lerp_LerpSprite; +com_davidmaletz_controls_ClickableSprite.prototype = $extend(com_davidmaletz_lerp_LerpSprite.prototype,{ + clickables: null + ,createClickables: function() { + return null; + } + ,init: function(e) { + com_davidmaletz_lerp_LerpSprite.prototype.init.call(this,e); + com_davidmaletz_faengfl_TouchAdapter.instance.addEventListener("touch_down",$bind(this,this.down),false,com_davidmaletz_faengfl_Window.window_ct); + com_davidmaletz_faengfl_TouchAdapter.instance.addEventListener("touch_up",$bind(this,this.up),false,com_davidmaletz_faengfl_Window.window_ct); + com_davidmaletz_faengfl_TouchAdapter.instance.addEventListener("touch_move",$bind(this,this.move),false,com_davidmaletz_faengfl_Window.window_ct); + this.clickables.init(); + } + ,destroy: function(e) { + com_davidmaletz_lerp_LerpSprite.prototype.destroy.call(this,e); + com_davidmaletz_faengfl_TouchAdapter.instance.removeEventListener("touch_down",$bind(this,this.down)); + com_davidmaletz_faengfl_TouchAdapter.instance.removeEventListener("touch_up",$bind(this,this.up)); + com_davidmaletz_faengfl_TouchAdapter.instance.removeEventListener("touch_move",$bind(this,this.move)); + this.clickables.destroy(); + } + ,down: function(e) { + e.stopImmediatePropagation(); + this.clickables.down(e); + } + ,up: function(e) { + e.stopImmediatePropagation(); + this.clickables.up(e); + } + ,move: function(e) { + e.stopImmediatePropagation(); + this.clickables.move(e); + } + ,addClickable: function(c) { + if(Std["is"](c,openfl_display_DisplayObject)) { + this.addChild(js_Boot.__cast(c , openfl_display_DisplayObject)); + } + this.clickables.addClickable(c,this); + } + ,onEmptySelect: function() { + } + ,onCancel: function() { + } + ,canSelect: function(c) { + if(!this.hasLerp()) { + return this.parent != null; + } else { + return false; + } + } + ,__class__: com_davidmaletz_controls_ClickableSprite +}); +var com_davidmaletz_faengfl_Window = function(container,draw,modal,allowDarken,anim,halign,valign,offY) { + if(offY == null) { + offY = 0; + } + if(valign == null) { + valign = 0.5; + } + if(halign == null) { + halign = 0.5; + } + if(anim == null) { + anim = true; + } + if(allowDarken == null) { + allowDarken = true; + } + if(modal == null) { + modal = true; + } + this.onClose = null; + com_davidmaletz_lerp_LerpSprite.call(this); + var w = container == null ? 0 : container.getWidth(); + var h = container == null ? 0 : container.getHeight(); + this.isModal = modal; + if(this.isModal && allowDarken) { + this.darken = new openfl_display_Sprite(); + var g = this.darken.get_graphics(); + g.beginFill(0,0.25); + g.drawRect(0,0,w,h); + g.endFill(); + } + if(draw != null) { + this.bg = draw; + this.set_x(Math.round((w - draw.getWidth()) * halign)); + var s = draw.create(0,0); + if(s != null) { + this.addChild(s); + } + var ty = Math.round((h - draw.getHeight()) * valign) + offY; + if(anim) { + if(valign < 0.25) { + this.closePosY = this.set_y(-draw.getHeight()); + } else { + this.closePosY = this.set_y(h); + } + this.lerp(new com_davidmaletz_lerp_YKeyframe(ty),10,$bind(this,this.onOpened)); + } else { + this.set_y(ty); + this.closePosY = NaN; + } + } +}; +$hxClasses["com.davidmaletz.faengfl.Window"] = com_davidmaletz_faengfl_Window; +com_davidmaletz_faengfl_Window.__name__ = ["com","davidmaletz","faengfl","Window"]; +com_davidmaletz_faengfl_Window.addTextTo = function(parent,txt,x,y,color,scale,w) { + if(w == null) { + w = 0; + } + if(scale == null) { + scale = 1; + } + var t = new com_davidmaletz_faengfl_TextSprite(txt,new com_fancyfish_faeng_text_CharacterPlacer(w,w == 0 ? 0 : 1),color,scale); + t.set_x(x); + t.set_y(y); + parent.addChild(t); +}; +com_davidmaletz_faengfl_Window.__super__ = com_davidmaletz_lerp_LerpSprite; +com_davidmaletz_faengfl_Window.prototype = $extend(com_davidmaletz_lerp_LerpSprite.prototype,{ + isModal: null + ,darken: null + ,closePosY: null + ,bg: null + ,onOpened: function() { + } + ,init: function(e) { + com_davidmaletz_lerp_LerpSprite.prototype.init.call(this,e); + if(this.isModal) { + com_davidmaletz_faengfl_Window.window_ct += 4; + com_davidmaletz_faengfl_Window.dispatcher.dispatchEvent(new openfl_events_Event("add_window")); + com_davidmaletz_faengfl_TouchAdapter.instance.addEventListener("touch_down",$bind(this,this.down),false,com_davidmaletz_faengfl_Window.window_ct); + com_davidmaletz_faengfl_TouchAdapter.instance.addEventListener("touch_up",$bind(this,this.up),false,com_davidmaletz_faengfl_Window.window_ct); + com_davidmaletz_faengfl_TouchAdapter.instance.addEventListener("touch_move",$bind(this,this.move),false,com_davidmaletz_faengfl_Window.window_ct); + } + if(this.parent != null && this.darken != null) { + this.parent.addChildAt(this.darken,this.parent.getChildIndex(this)); + } + } + ,destroy: function(e) { + com_davidmaletz_lerp_LerpSprite.prototype.destroy.call(this,e); + if(this.isModal) { + com_davidmaletz_faengfl_Window.window_ct -= 2; + if(e != null) { + com_davidmaletz_faengfl_Window.dispatcher.dispatchEvent(new openfl_events_Event("rem_window")); + } + com_davidmaletz_faengfl_TouchAdapter.instance.removeEventListener("touch_down",$bind(this,this.down)); + com_davidmaletz_faengfl_TouchAdapter.instance.removeEventListener("touch_up",$bind(this,this.up)); + com_davidmaletz_faengfl_TouchAdapter.instance.removeEventListener("touch_move",$bind(this,this.move)); + } + if(this.darken != null && this.darken.parent != null) { + this.darken.parent.removeChild(this.darken); + } + } + ,down: function(e) { + this.modal(e); + } + ,up: function(e) { + this.modal(e); + } + ,move: function(e) { + this.modal(e); + } + ,modal: function(e) { + e.stopImmediatePropagation(); + } + ,onClose: null + ,doClose: function() { + if(this.parent != null) { + this.parent.removeChild(this); + } + if(this.onClose != null) { + var f = this.onClose; + this.onClose = null; + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + f(); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + } + ,close: function() { + if(this.parent == null) { + return; + } + if(isNaN(this.closePosY)) { + this.doClose(); + } else if(!this.hasTrack(com_davidmaletz_lerp_YKeyframe)) { + this.lerp(new com_davidmaletz_lerp_YKeyframe(this.closePosY),10,$bind(this,this.doClose)); + } + } + ,__class__: com_davidmaletz_faengfl_Window +}); +var com_davidmaletz_controls_ClickableWindow = function(container,draw,modal,darken,anim,halign,valign,offY) { + if(offY == null) { + offY = 0; + } + if(valign == null) { + valign = 0.5; + } + if(halign == null) { + halign = 0.5; + } + if(anim == null) { + anim = true; + } + if(darken == null) { + darken = true; + } + if(modal == null) { + modal = true; + } + this.clickables = new com_davidmaletz_controls_ClickableHandler(this,this.createClickables()); + if(draw != null) { + this.__width = draw.getWidth(); + this.__height = draw.getHeight(); + } + com_davidmaletz_faengfl_Window.call(this,container,draw,modal,darken,anim,halign,valign,offY); +}; +$hxClasses["com.davidmaletz.controls.ClickableWindow"] = com_davidmaletz_controls_ClickableWindow; +com_davidmaletz_controls_ClickableWindow.__name__ = ["com","davidmaletz","controls","ClickableWindow"]; +com_davidmaletz_controls_ClickableWindow.__interfaces__ = [com_davidmaletz_controls_Listener]; +com_davidmaletz_controls_ClickableWindow.__super__ = com_davidmaletz_faengfl_Window; +com_davidmaletz_controls_ClickableWindow.prototype = $extend(com_davidmaletz_faengfl_Window.prototype,{ + clickables: null + ,__width: null + ,__height: null + ,createClickables: function() { + return null; + } + ,init: function(e) { + com_davidmaletz_faengfl_Window.prototype.init.call(this,e); + if(this.isModal) { + this.clickables.init(); + } + } + ,destroy: function(e) { + com_davidmaletz_faengfl_Window.prototype.destroy.call(this,e); + if(this.isModal) { + this.clickables.destroy(); + } + } + ,down: function(e) { + this.modal(e); + this.clickables.down(e); + } + ,up: function(e) { + this.modal(e); + this.clickables.up(e); + } + ,move: function(e) { + this.modal(e); + this.clickables.move(e); + } + ,addClickable: function(c,w) { + if(w == null) { + w = 1; + } + if(Std["is"](c,openfl_display_DisplayObject)) { + this.addChild(js_Boot.__cast(c , openfl_display_DisplayObject)); + } + this.clickables.addClickable(c,this,w); + } + ,onEmptySelect: function() { + } + ,onCancel: function() { + if(this.darken != null) { + this.close(); + } + } + ,canSelect: function(c) { + if(!this.hasLerp() && this.parent != null) { + return this.get_y() != this.closePosY; + } else { + return false; + } + } + ,__class__: com_davidmaletz_controls_ClickableWindow +}); +var com_davidmaletz_controls_CloseButton = function(closeable,x,y) { + com_davidmaletz_controls_Button.call(this,x,y,com_davidmaletz_faengfl_Application.button_factory.createBG(-1,-1),com_davidmaletz_faengfl_Application.button_factory.createHover(-1,-1),new com_fancyfish_faeng_common_mutable_Static("X")); + this.closeable = closeable; +}; +$hxClasses["com.davidmaletz.controls.CloseButton"] = com_davidmaletz_controls_CloseButton; +com_davidmaletz_controls_CloseButton.__name__ = ["com","davidmaletz","controls","CloseButton"]; +com_davidmaletz_controls_CloseButton.__super__ = com_davidmaletz_controls_Button; +com_davidmaletz_controls_CloseButton.prototype = $extend(com_davidmaletz_controls_Button.prototype,{ + closeable: null + ,onClick: function() { + this.closeable.close(); + return true; + } + ,__class__: com_davidmaletz_controls_CloseButton +}); +var com_davidmaletz_controls_CompoundClickableColumns = function(cols,leftPos) { + this.columns = []; + this.columns.push(null); + var _g = 0; + while(_g < cols.length) { + var c = cols[_g]; + ++_g; + this.columns.push(c); + this.columns.push(null); + } + this.leftPos = leftPos; +}; +$hxClasses["com.davidmaletz.controls.CompoundClickableColumns"] = com_davidmaletz_controls_CompoundClickableColumns; +com_davidmaletz_controls_CompoundClickableColumns.__name__ = ["com","davidmaletz","controls","CompoundClickableColumns"]; +com_davidmaletz_controls_CompoundClickableColumns.__interfaces__ = [com_davidmaletz_controls_ClickableColumns]; +com_davidmaletz_controls_CompoundClickableColumns.prototype = { + columns: null + ,leftPos: null + ,getCount: function() { + var ret = 0; + var _g = 0; + var _g1 = this.columns; + while(_g < _g1.length) { + var c = _g1[_g]; + ++_g; + ret += c == null ? 0 : c.getCount(); + } + return ret; + } + ,setColumn: function(idx,c) { + this.columns[idx * 2 + 1] = c; + c.setAddListener(this.listener); + } + ,clear: function() { + var _g = 0; + var _g1 = this.columns; + while(_g < _g1.length) { + var c = _g1[_g]; + ++_g; + c.clear(); + } + } + ,getColumn: function(col) { + var i = 0; + var _g = 0; + var _g1 = this.columns; + while(_g < _g1.length) { + var c = _g1[_g]; + ++_g; + if(c != null) { + var ct = c.getCount(); + if(col < ct) { + return { child : c, column : col, index : i}; + } + col -= ct; + } + ++i; + } + return null; + } + ,getParent: function(col) { + var c = this.getColumn(col); + return c.child.getParent(c.column); + } + ,get: function(col) { + var c = this.getColumn(col); + return c.child.get(c.column); + } + ,canSelect: function(col,c) { + var col1 = this.getColumn(col); + return col1.child.canSelect(col1.column,c); + } + ,getC: function(i) { + var c = this.columns[i]; + if(c == null) { + c = new com_davidmaletz_controls_ArrayClickableColumns(); + this.columns[i] = c; + c.setAddListener(this.listener); + } + return c; + } + ,addClickable: function(c,parent,w) { + var b = c.getPos(); + var len = this.leftPos.length; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + if(b.x <= this.leftPos[i]) { + this.getC(i * 2).addClickable(c,parent,w); + return; + } + } + this.getC(this.columns.length - 1).addClickable(c,parent,w); + } + ,changeSelected: function(selected,col) { + var c = this.getColumn(col); + c.child.changeSelected(selected,c.column); + } + ,inBounds: function(col,p) { + var c = this.getColumn(col); + return c.child.inBounds(c.column,p); + } + ,getYOffset: function(col) { + var c = this.getColumn(col); + return c.child.getYOffset(c.column); + } + ,listener: null + ,setAddListener: function(func) { + this.listener = func; + var _g = 0; + var _g1 = this.columns; + while(_g < _g1.length) { + var c = _g1[_g]; + ++_g; + if(c != null) { + c.setAddListener(this.listener); + } + } + } + ,__class__: com_davidmaletz_controls_CompoundClickableColumns +}; +var com_davidmaletz_faengfl_controls_ControlListener = function() { }; +$hxClasses["com.davidmaletz.faengfl.controls.ControlListener"] = com_davidmaletz_faengfl_controls_ControlListener; +com_davidmaletz_faengfl_controls_ControlListener.__name__ = ["com","davidmaletz","faengfl","controls","ControlListener"]; +com_davidmaletz_faengfl_controls_ControlListener.prototype = { + press: null + ,release: null + ,getKeyCode: null + ,validateControls: null + ,defaultKeyboard: null + ,defaultGamepad: null + ,__class__: com_davidmaletz_faengfl_controls_ControlListener +}; +var com_davidmaletz_controls_Controller = function(settings,holdKeys) { + if(holdKeys == null) { + holdKeys = ["up","down","left","right"]; + } + openfl_events_EventDispatcher.call(this); + com_davidmaletz_controls_Controller.instance = this; + this.holdKeys = holdKeys; + this.tap_data = []; + var _g = 0; + while(_g < holdKeys.length) { + var k = holdKeys[_g]; + ++_g; + this.tap_data.push(-Infinity); + } + this.handler = new com_davidmaletz_faengfl_controls_ControlHandler(settings,this,this.tap_data.length * 2); + openfl_Lib.current.stage.addEventListener("keyDown",$bind(this,this.onKeyDown)); + openfl_Lib.current.stage.addEventListener("keyUp",$bind(this,this.onKeyUp)); + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.enter_frame)); + openfl_Lib.current.stage.addEventListener("mouseDown",$bind(this,this.onMouseDown)); + openfl_Lib.current.stage.addEventListener("mouseUp",$bind(this,this.onMouseUp)); + openfl_Lib.current.stage.addEventListener("rightMouseDown",$bind(this,this.onMouseDownR)); + openfl_Lib.current.stage.addEventListener("rightMouseUp",$bind(this,this.onMouseUpR)); + lime_ui_Gamepad.onConnect.add($bind(this,this.onGamepadConnect)); + var g = lime_ui_Gamepad.devices.iterator(); + while(g.hasNext()) { + var g1 = g.next(); + this.onGamepadConnect(g1); + } +}; +$hxClasses["com.davidmaletz.controls.Controller"] = com_davidmaletz_controls_Controller; +com_davidmaletz_controls_Controller.__name__ = ["com","davidmaletz","controls","Controller"]; +com_davidmaletz_controls_Controller.__interfaces__ = [com_davidmaletz_faengfl_controls_ControlListener]; +com_davidmaletz_controls_Controller.instance = null; +com_davidmaletz_controls_Controller.getLayout = function() { + if(com_davidmaletz_controls_Controller.layout == -1) { + com_davidmaletz_controls_Controller.layout = com_davidmaletz_controls_Controller.__getLayout(); + } + return com_davidmaletz_controls_Controller.layout; +}; +com_davidmaletz_controls_Controller.__getLayout = function() { + return 0; +}; +com_davidmaletz_controls_Controller.__super__ = openfl_events_EventDispatcher; +com_davidmaletz_controls_Controller.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + dispatchEvent: function(event) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + var ret = openfl_events_EventDispatcher.prototype.dispatchEvent.call(this,event); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + return ret; + } + ,handler: null + ,holdKeys: null + ,updateSettings: function() { + this.handler.updateSettings(); + } + ,resetListeners: function() { + openfl_Lib.current.stage.removeEventListener("keyDown",$bind(this,this.onKeyDown)); + openfl_Lib.current.stage.removeEventListener("keyUp",$bind(this,this.onKeyUp)); + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.enter_frame)); + openfl_Lib.current.stage.removeEventListener("mouseDown",$bind(this,this.onMouseDown)); + openfl_Lib.current.stage.removeEventListener("mouseUp",$bind(this,this.onMouseUp)); + openfl_Lib.current.stage.removeEventListener("rightMouseDown",$bind(this,this.onMouseDownR)); + openfl_Lib.current.stage.removeEventListener("rightMouseUp",$bind(this,this.onMouseUpR)); + openfl_Lib.current.stage.addEventListener("keyDown",$bind(this,this.onKeyDown)); + openfl_Lib.current.stage.addEventListener("keyUp",$bind(this,this.onKeyUp)); + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.enter_frame)); + openfl_Lib.current.stage.addEventListener("mouseDown",$bind(this,this.onMouseDown)); + openfl_Lib.current.stage.addEventListener("mouseUp",$bind(this,this.onMouseUp)); + openfl_Lib.current.stage.addEventListener("rightMouseDown",$bind(this,this.onMouseDownR)); + openfl_Lib.current.stage.addEventListener("rightMouseUp",$bind(this,this.onMouseUpR)); + } + ,getCurrentDevice: function() { + return this.handler.getCurrentDevice(); + } + ,getControls: function(device) { + return this.handler.getControls(device); + } + ,setControls: function(device,controls) { + this.handler.setControls(device,controls); + } + ,tap_data: null + ,handleTap: function(i,type,pressed) { + if(pressed) { + var d = this.tap_data[i] - com_davidmaletz_faengfl_FaengFL.frameTime; + if(d <= 0) { + this.dispatchEvent(new com_davidmaletz_controls_CEvent("tap",type)); + this.tap_data[i] = d == -Infinity ? 10 : 3; + } else { + this.tap_data[i] = d; + } + } else { + this.tap_data[i] = -Infinity; + } + } + ,releaseAll: function() { + var i = 0; + var _g = 0; + var _g1 = this.holdKeys; + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + if(this.isPressed(i * 2)) { + this.release(k,i * 2); + } + ++i; + } + this.handler.releaseAll(); + var len = this.tap_data.length; + var _g11 = 0; + var _g2 = len; + while(_g11 < _g2) { + var i1 = _g11++; + this.tap_data[i1] = -Infinity; + } + } + ,enter_frame: function(e) { + var i = 0; + var _g = 0; + var _g1 = this.holdKeys; + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + this.handleTap(i,k,this.isPressed(i * 2)); + ++i; + } + } + ,getKeyBinding: function(key) { + return this.handler.getKey(key); + } + ,onKeyDown: function(e) { + this.handler.onKeyDown(e.keyCode); + } + ,onKeyUp: function(e) { + this.handler.onKeyUp(e.keyCode); + } + ,onMouseDown: function(e) { + this.handler.onMouseDown(0); + } + ,onMouseUp: function(e) { + this.handler.onMouseUp(0); + } + ,onMouseDownR: function(e) { + this.handler.onMouseDown(2); + } + ,onMouseUpR: function(e) { + this.handler.onMouseUp(2); + } + ,onButtonDown: function(g,button) { + try { + this.handler.onGamepadDown(g.id,button); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ControllerButtonEvent("button_down",g.id,button)); + } catch( e ) { + haxe_CallStack.lastException = e; + if (e instanceof js__$Boot_HaxeError) e = e.val; + openfl_events_EventDispatcher.throwCriticalError(e); + } + } + ,onButtonUp: function(g,button) { + try { + this.handler.onGamepadUp(g.id,button); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ControllerButtonEvent("button_up",g.id,button)); + } catch( e ) { + haxe_CallStack.lastException = e; + if (e instanceof js__$Boot_HaxeError) e = e.val; + openfl_events_EventDispatcher.throwCriticalError(e); + } + } + ,onAxisMove: function(g,a,value) { + if(a == 4 || a == 5) { + if(value < com_davidmaletz_controls_Controller.DEADZONE) { + value = 0.0; + } else { + value = (value - com_davidmaletz_controls_Controller.DEADZONE) / (1.0 - com_davidmaletz_controls_Controller.DEADZONE); + } + } else { + var len = Math.abs(value); + value *= len < com_davidmaletz_controls_Controller.DEADZONE ? 0 : (len - com_davidmaletz_controls_Controller.DEADZONE) / (1.0 - com_davidmaletz_controls_Controller.DEADZONE) / len; + } + try { + this.handler.onGamepadAxis(g.id,a,value); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ControllerAxisEvent("axis_move",g.id,a,value,-1)); + } catch( e ) { + haxe_CallStack.lastException = e; + if (e instanceof js__$Boot_HaxeError) e = e.val; + openfl_events_EventDispatcher.throwCriticalError(e); + } + } + ,onGamepadConnect: function(g) { + try { + var f = $bind(this,this.onButtonDown); + var g1 = g; + var tmp = function(a1) { + f(g1,a1); + }; + g.onButtonDown.add(tmp); + var f1 = $bind(this,this.onButtonUp); + var g2 = g; + var tmp1 = function(a11) { + f1(g2,a11); + }; + g.onButtonUp.add(tmp1); + var f2 = $bind(this,this.onAxisMove); + var g3 = g; + var tmp2 = function(a,a12) { + f2(g3,a,a12); + }; + g.onAxisMove.add(tmp2); + var f3 = $bind(this,this.onGamepadDisconnect); + var g4 = g; + var tmp3 = function() { + f3(g4); + }; + g.onDisconnect.add(tmp3); + } catch( e ) { + haxe_CallStack.lastException = e; + if (e instanceof js__$Boot_HaxeError) e = e.val; + openfl_events_EventDispatcher.throwCriticalError(e); + } + } + ,onGamepadDisconnect: function(g) { + this.releaseAll(); + try { + if(this.handler.getControllerID() == g.id) { + this.handler.setCurrentDevice(0); + } + } catch( e ) { + haxe_CallStack.lastException = e; + if (e instanceof js__$Boot_HaxeError) e = e.val; + openfl_events_EventDispatcher.throwCriticalError(e); + } + } + ,isPressed: function(key) { + return this.handler.isPressed(key); + } + ,press: function(type,key) { + if(type == null || key != -1 && this.isPressed(key)) { + return; + } + if(StringTools.endsWith(type,"_alt")) { + type = type.substring(0,type.length - 4); + } + if(key != -1) { + this.handler.setPressed(key,true); + } + this.dispatchEvent(new com_davidmaletz_controls_CEvent("press",type)); + } + ,release: function(type,key) { + if(type == null || key != -1 && !this.isPressed(key)) { + return; + } + if(StringTools.endsWith(type,"_alt")) { + type = type.substring(0,type.length - 4); + } + if(key == -1) { + this.dispatchEvent(new com_davidmaletz_controls_CEvent("tap",type)); + } else { + this.handler.setPressed(key,false); + } + this.dispatchEvent(new com_davidmaletz_controls_CEvent("release",type)); + } + ,getKeyCode: function(key) { + if(key == null) { + return -1; + } + var alt = StringTools.endsWith(key,"_alt"); + if(alt) { + key = key.substring(0,key.length - 4); + } + var i = this.holdKeys.indexOf(key); + if(i == -1) { + return -1; + } else { + return i * 2 + (alt ? 1 : 0); + } + } + ,validateControls: function(device,controls) { + if(device == 0) { + this.fixAltKeyboard(controls); + } else { + this.fixAltGamepad(controls); + } + } + ,fixAltKeyboard: function(controls) { + var up = new com_davidmaletz_faengfl_controls_KeyboardKey(38); + if(controls.getValue(up) == null) { + controls.setKey("up_alt",up); + } + var down = new com_davidmaletz_faengfl_controls_KeyboardKey(40); + if(controls.getValue(down) == null) { + controls.setKey("down_alt",down); + } + var left = new com_davidmaletz_faengfl_controls_KeyboardKey(37); + if(controls.getValue(left) == null) { + controls.setKey("left_alt",left); + } + var right = new com_davidmaletz_faengfl_controls_KeyboardKey(39); + if(controls.getValue(right) == null) { + controls.setKey("right_alt",right); + } + var select = new com_davidmaletz_faengfl_controls_KeyboardKey(13); + if(controls.getValue(select) == null) { + controls.setKey("select_alt",select); + } + var cancel = new com_davidmaletz_faengfl_controls_KeyboardKey(27); + if(controls.getValue(cancel) == null) { + controls.setKey("cancel_alt",cancel); + } + } + ,fixAltGamepad: function(controls) { + var up = new com_davidmaletz_faengfl_controls_AxisKey(1,false); + if(controls.getValue(up) == null) { + controls.setKey("up_alt",up); + } + var down = new com_davidmaletz_faengfl_controls_AxisKey(1,true); + if(controls.getValue(down) == null) { + controls.setKey("down_alt",down); + } + var left = new com_davidmaletz_faengfl_controls_AxisKey(0,false); + if(controls.getValue(left) == null) { + controls.setKey("left_alt",left); + } + var right = new com_davidmaletz_faengfl_controls_AxisKey(0,true); + if(controls.getValue(right) == null) { + controls.setKey("right_alt",right); + } + var select = new com_davidmaletz_faengfl_controls_ControllerKey(6); + if(controls.getValue(select) == null) { + controls.setKey("select_alt",select); + } + var cancel = new com_davidmaletz_faengfl_controls_ControllerKey(4); + if(controls.getValue(cancel) == null) { + controls.setKey("cancel_alt",cancel); + } + } + ,defaultKeyboard: function(controls) { + var layout = com_davidmaletz_controls_Controller.getLayout(); + if(layout == 2) { + controls.setKey("up",new com_davidmaletz_faengfl_controls_KeyboardKey(90)); + controls.setKey("down",new com_davidmaletz_faengfl_controls_KeyboardKey(83)); + controls.setKey("left",new com_davidmaletz_faengfl_controls_KeyboardKey(81)); + controls.setKey("right",new com_davidmaletz_faengfl_controls_KeyboardKey(68)); + controls.setKey("select",new com_davidmaletz_faengfl_controls_KeyboardKey(87)); + } else { + controls.setKey("up",new com_davidmaletz_faengfl_controls_KeyboardKey(87)); + controls.setKey("down",new com_davidmaletz_faengfl_controls_KeyboardKey(83)); + controls.setKey("left",new com_davidmaletz_faengfl_controls_KeyboardKey(65)); + controls.setKey("right",new com_davidmaletz_faengfl_controls_KeyboardKey(68)); + controls.setKey("select",new com_davidmaletz_faengfl_controls_KeyboardKey(layout == 1 ? 89 : 90)); + } + controls.setKey("cancel",new com_davidmaletz_faengfl_controls_KeyboardKey(88)); + controls.setKey("up_alt",new com_davidmaletz_faengfl_controls_KeyboardKey(38)); + controls.setKey("down_alt",new com_davidmaletz_faengfl_controls_KeyboardKey(40)); + controls.setKey("left_alt",new com_davidmaletz_faengfl_controls_KeyboardKey(37)); + controls.setKey("right_alt",new com_davidmaletz_faengfl_controls_KeyboardKey(39)); + controls.setKey("select_alt",new com_davidmaletz_faengfl_controls_KeyboardKey(13)); + controls.setKey("cancel_alt",new com_davidmaletz_faengfl_controls_KeyboardKey(27)); + } + ,defaultGamepad: function(controls) { + controls.setKey("up",new com_davidmaletz_faengfl_controls_AxisKey(1,false)); + controls.setKey("down",new com_davidmaletz_faengfl_controls_AxisKey(1,true)); + controls.setKey("left",new com_davidmaletz_faengfl_controls_AxisKey(0,false)); + controls.setKey("right",new com_davidmaletz_faengfl_controls_AxisKey(0,true)); + controls.setKey("select",new com_davidmaletz_faengfl_controls_ControllerKey(0)); + controls.setKey("cancel",new com_davidmaletz_faengfl_controls_ControllerKey(1)); + controls.setKey("up_alt",new com_davidmaletz_faengfl_controls_ControllerKey(11)); + controls.setKey("down_alt",new com_davidmaletz_faengfl_controls_ControllerKey(12)); + controls.setKey("left_alt",new com_davidmaletz_faengfl_controls_ControllerKey(13)); + controls.setKey("right_alt",new com_davidmaletz_faengfl_controls_ControllerKey(14)); + controls.setKey("select_alt",new com_davidmaletz_faengfl_controls_ControllerKey(6)); + controls.setKey("cancel_alt",new com_davidmaletz_faengfl_controls_ControllerKey(4)); + } + ,__class__: com_davidmaletz_controls_Controller +}); +var openfl_events_Event = function(type,bubbles,cancelable) { + if(cancelable == null) { + cancelable = false; + } + if(bubbles == null) { + bubbles = false; + } + this.type = type; + this.bubbles = bubbles; + this.cancelable = cancelable; + this.eventPhase = 2; +}; +$hxClasses["openfl.events.Event"] = openfl_events_Event; +openfl_events_Event.__name__ = ["openfl","events","Event"]; +openfl_events_Event.prototype = { + bubbles: null + ,cancelable: null + ,currentTarget: null + ,eventPhase: null + ,target: null + ,type: null + ,__isCanceled: null + ,__isCanceledNow: null + ,__preventDefault: null + ,preventDefault: function() { + if(this.cancelable) { + this.__preventDefault = true; + } + } + ,stopImmediatePropagation: function() { + this.__isCanceled = true; + this.__isCanceledNow = true; + } + ,__class__: openfl_events_Event +}; +var com_davidmaletz_controls_CEvent = function(type,key) { + openfl_events_Event.call(this,type); + this.key = key; +}; +$hxClasses["com.davidmaletz.controls.CEvent"] = com_davidmaletz_controls_CEvent; +com_davidmaletz_controls_CEvent.__name__ = ["com","davidmaletz","controls","CEvent"]; +com_davidmaletz_controls_CEvent.__super__ = openfl_events_Event; +com_davidmaletz_controls_CEvent.prototype = $extend(openfl_events_Event.prototype,{ + key: null + ,__class__: com_davidmaletz_controls_CEvent +}); +var com_davidmaletz_controls_SliderUI = function() { }; +$hxClasses["com.davidmaletz.controls.SliderUI"] = com_davidmaletz_controls_SliderUI; +com_davidmaletz_controls_SliderUI.__name__ = ["com","davidmaletz","controls","SliderUI"]; +com_davidmaletz_controls_SliderUI.prototype = { + getHeight: null + ,getKnobWidth: null + ,createBar: null + ,createKnob: null + ,__class__: com_davidmaletz_controls_SliderUI +}; +var com_davidmaletz_controls_DefaultSliderUI = function(bar,knob) { + this.bar_factory = bar == null ? new com_davidmaletz_faengfl_SolidDrawableFactory(16777215) : bar; + this.knob_factory = knob == null ? new com_davidmaletz_faengfl_SolidDrawableFactory(11711154) : knob; +}; +$hxClasses["com.davidmaletz.controls.DefaultSliderUI"] = com_davidmaletz_controls_DefaultSliderUI; +com_davidmaletz_controls_DefaultSliderUI.__name__ = ["com","davidmaletz","controls","DefaultSliderUI"]; +com_davidmaletz_controls_DefaultSliderUI.__interfaces__ = [com_davidmaletz_controls_SliderUI]; +com_davidmaletz_controls_DefaultSliderUI.prototype = { + bar_factory: null + ,knob_factory: null + ,getHeight: function() { + return 6; + } + ,getKnobWidth: function() { + return 10; + } + ,createBar: function(w) { + return this.bar_factory.create(w,6).create(0,0); + } + ,createKnob: function() { + return this.knob_factory.create(10,6).create(0,0); + } + ,__class__: com_davidmaletz_controls_DefaultSliderUI +}; +var com_davidmaletz_controls_ItemHandler = function() { }; +$hxClasses["com.davidmaletz.controls.ItemHandler"] = com_davidmaletz_controls_ItemHandler; +com_davidmaletz_controls_ItemHandler.__name__ = ["com","davidmaletz","controls","ItemHandler"]; +com_davidmaletz_controls_ItemHandler.prototype = { + onSelect: null + ,onHover: null + ,isEnabled: null + ,__class__: com_davidmaletz_controls_ItemHandler +}; +var com_davidmaletz_faengfl_TileLayer = function() { + openfl_display_Sprite.call(this); + this.handler = new com_davidmaletz_faengfl_TileHandler(); +}; +$hxClasses["com.davidmaletz.faengfl.TileLayer"] = com_davidmaletz_faengfl_TileLayer; +com_davidmaletz_faengfl_TileLayer.__name__ = ["com","davidmaletz","faengfl","TileLayer"]; +com_davidmaletz_faengfl_TileLayer.__super__ = openfl_display_Sprite; +com_davidmaletz_faengfl_TileLayer.prototype = $extend(openfl_display_Sprite.prototype,{ + handler: null + ,userData: null + ,clear: function() { + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this); + this.get_graphics().clear(); + } + ,start: function(flags,smooth) { + if(flags == null) { + flags = 0; + } + this.clear(); + this.handler.start(this.get_graphics(),flags,smooth); + } + ,finish: function() { + this.handler.finish(); + } + ,__class__: com_davidmaletz_faengfl_TileLayer +}); +var com_davidmaletz_controls_KeyRenderer = function(key,x,y,controls) { + com_davidmaletz_faengfl_TileLayer.call(this); + this.key = key; + this.tx = x; + this.ty = y; + if(controls == null) { + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); + } else { + this.drawKey(controls.getKey(key)); + } +}; +$hxClasses["com.davidmaletz.controls.KeyRenderer"] = com_davidmaletz_controls_KeyRenderer; +com_davidmaletz_controls_KeyRenderer.__name__ = ["com","davidmaletz","controls","KeyRenderer"]; +com_davidmaletz_controls_KeyRenderer.__super__ = com_davidmaletz_faengfl_TileLayer; +com_davidmaletz_controls_KeyRenderer.prototype = $extend(com_davidmaletz_faengfl_TileLayer.prototype,{ + key: null + ,tx: null + ,ty: null + ,init: function(e) { + this.destroy(e); + com_davidmaletz_controls_Controller.instance.handler.addEventListener("controls_changed",$bind(this,this.update)); + this.update(null); + } + ,destroy: function(e) { + com_davidmaletz_controls_Controller.instance.handler.removeEventListener("controls_changed",$bind(this,this.update)); + } + ,update: function(e) { + this.drawKey(com_davidmaletz_controls_Controller.instance.getKeyBinding(this.key)); + } + ,drawKey: function(key) { + this.start(16); + if(key == null) { + com_davidmaletz_faengfl_controls_KeyboardKey.drawText(this,com_fancyfish_faeng_common_Lang.getText("common","none"),this.tx,this.ty,0); + } else { + key.draw(this,this.tx,this.ty); + } + this.finish(); + } + ,__class__: com_davidmaletz_controls_KeyRenderer +}); +var com_davidmaletz_controls_ListItemRenderer = function() { }; +$hxClasses["com.davidmaletz.controls.ListItemRenderer"] = com_davidmaletz_controls_ListItemRenderer; +com_davidmaletz_controls_ListItemRenderer.__name__ = ["com","davidmaletz","controls","ListItemRenderer"]; +com_davidmaletz_controls_ListItemRenderer.prototype = { + create: null + ,update: null + ,getWidth: null + ,getHeight: null + ,__class__: com_davidmaletz_controls_ListItemRenderer +}; +var com_davidmaletz_controls_ListSprite = function(renderer,rows,cols) { + this.offsetY = 0; + this.offsetX = 0; + openfl_display_Sprite.call(this); + this.rows = rows; + this.cols = cols; + this.renderer = renderer; + this.curHeight = 0; + this.rowHeight = 0; + this.curCol = -1; +}; +$hxClasses["com.davidmaletz.controls.ListSprite"] = com_davidmaletz_controls_ListSprite; +com_davidmaletz_controls_ListSprite.__name__ = ["com","davidmaletz","controls","ListSprite"]; +com_davidmaletz_controls_ListSprite.__super__ = openfl_display_Sprite; +com_davidmaletz_controls_ListSprite.prototype = $extend(openfl_display_Sprite.prototype,{ + rows: null + ,cols: null + ,renderer: null + ,offsetX: null + ,offsetY: null + ,curHeight: null + ,rowHeight: null + ,curCol: null + ,addItem: function(clickables,i,w,r) { + if(w == null) { + w = 1; + } + if(r == null) { + r = this.renderer; + } + this.curCol++; + if(this.curCol >= this.cols) { + this.curCol = 0; + this.curHeight += this.rowHeight; + this.rowHeight = 0; + } + this.rowHeight = Math.max(this.rowHeight,r.getHeight(i)); + var c = r.create(i,this.curCol * r.getWidth() + this.offsetX,this.curHeight + this.offsetY); + if(c != null) { + this.addChild(c); + if(Std["is"](c,com_davidmaletz_controls_Clickable)) { + clickables.addClickable(c,this,w); + } + var _g1 = 1; + var _g = w; + while(_g1 < _g) { + var i1 = _g1++; + this.addItem(clickables,null); + } + } + return c; + } + ,getWidth: function() { + return this.renderer.getWidth() * this.cols; + } + ,getHeight: function() { + return this.renderer.getHeight(null) * this.rows; + } + ,__class__: com_davidmaletz_controls_ListSprite +}); +var com_davidmaletz_controls_ListWindow = function(container,factory,renderer,rows,cols,darken,anim,closeButton,halign,valign,offY) { + if(offY == null) { + offY = 0; + } + if(valign == null) { + valign = 0.5; + } + if(halign == null) { + halign = 0.5; + } + if(closeButton == null) { + closeButton = true; + } + if(anim == null) { + anim = true; + } + if(darken == null) { + darken = true; + } + this.sprite = new com_davidmaletz_controls_ListSprite(renderer,rows,cols); + this.sprite.offsetX = 4; + this.sprite.offsetY = 4; + com_davidmaletz_controls_ClickableWindow.call(this,container,factory.create(this.getWidth(),this.getHeight()),true,darken,anim,halign,valign,offY); + this.addChild(this.sprite); + if(closeButton) { + var close = new com_davidmaletz_controls_CloseButton(this,this.getWidth(),0); + this.addChild(close); + this.clickables.addClickable(close,this); + } +}; +$hxClasses["com.davidmaletz.controls.ListWindow"] = com_davidmaletz_controls_ListWindow; +com_davidmaletz_controls_ListWindow.__name__ = ["com","davidmaletz","controls","ListWindow"]; +com_davidmaletz_controls_ListWindow.__super__ = com_davidmaletz_controls_ClickableWindow; +com_davidmaletz_controls_ListWindow.prototype = $extend(com_davidmaletz_controls_ClickableWindow.prototype,{ + sprite: null + ,addItem: function(i,w,r) { + if(w == null) { + w = 1; + } + return this.sprite.addItem(this.clickables,i,w,r); + } + ,getWidth: function() { + return this.sprite.getWidth() + 8; + } + ,getHeight: function() { + return this.sprite.getHeight() + 8; + } + ,__class__: com_davidmaletz_controls_ListWindow +}); +var com_davidmaletz_controls_ProgressBar = function(w,h,color,percent,lines,bg) { + if(bg == null) { + bg = true; + } + if(lines == null) { + lines = true; + } + if(percent == null) { + percent = 1; + } + openfl_display_Sprite.call(this); + if(bg) { + this.get_graphics().beginFill(16777215); + this.get_graphics().drawRect(0,0,w,h); + this.get_graphics().endFill(); + } + if(lines) { + var s = new openfl_display_Sprite(); + var g = s.get_graphics(); + g.beginFill(0); + g.drawRect(-1,-1,w + 2,1); + g.endFill(); + this.addChild(s); + var s1 = new openfl_display_Sprite(); + var g1 = s1.get_graphics(); + g1.beginFill(0); + g1.drawRect(-1,h,w + 2,1); + g1.endFill(); + this.addChild(s1); + var s2 = new openfl_display_Sprite(); + var g2 = s2.get_graphics(); + g2.beginFill(0); + g2.drawRect(-1,0,1,h); + g2.endFill(); + this.addChild(s2); + var s3 = new openfl_display_Sprite(); + var g3 = s3.get_graphics(); + g3.beginFill(0); + g3.drawRect(w,0,1,h); + g3.endFill(); + this.addChild(s3); + } + this.progress = new com_davidmaletz_lerp_LerpSprite(); + var g4 = this.progress.get_graphics(); + g4.beginFill(color); + g4.drawRect(0,0,w,h); + g4.endFill(); + this.progress.set_scaleX(percent); + this.addChild(this.progress); +}; +$hxClasses["com.davidmaletz.controls.ProgressBar"] = com_davidmaletz_controls_ProgressBar; +com_davidmaletz_controls_ProgressBar.__name__ = ["com","davidmaletz","controls","ProgressBar"]; +com_davidmaletz_controls_ProgressBar.__super__ = openfl_display_Sprite; +com_davidmaletz_controls_ProgressBar.prototype = $extend(openfl_display_Sprite.prototype,{ + progress: null + ,setProgress: function(percent,frames,complete) { + if(frames == null) { + frames = 0; + } + if(frames == 0) { + this.progress.set_scaleX(percent); + if(complete != null) { + complete(); + } + } else { + var hasLerp = this.progress.hasLerp(); + this.progress.lerp(new com_davidmaletz_lerp_ScaleKeyframe(percent,1),frames,complete); + if(hasLerp) { + this.progress.handle_frame(null); + } + } + } + ,__class__: com_davidmaletz_controls_ProgressBar +}); +var com_davidmaletz_controls_Slider = function(w,val) { + openfl_display_Sprite.call(this); + this._width = w; + this.addChild(com_davidmaletz_controls_Slider.getUI().createBar(w)); + this.knob = new com_davidmaletz_controls_SliderKnob(this); + this.addChild(this.knob); + this.value = -1; + this.setValue(val); +}; +$hxClasses["com.davidmaletz.controls.Slider"] = com_davidmaletz_controls_Slider; +com_davidmaletz_controls_Slider.__name__ = ["com","davidmaletz","controls","Slider"]; +com_davidmaletz_controls_Slider.ui = null; +com_davidmaletz_controls_Slider.getUI = function() { + if(com_davidmaletz_controls_Slider.ui == null) { + com_davidmaletz_controls_Slider.ui = new com_davidmaletz_controls_DefaultSliderUI(); + } + return com_davidmaletz_controls_Slider.ui; +}; +com_davidmaletz_controls_Slider.__super__ = openfl_display_Sprite; +com_davidmaletz_controls_Slider.prototype = $extend(openfl_display_Sprite.prototype,{ + knob: null + ,_width: null + ,value: null + ,setValue: function(v) { + if(v < 0) { + v = 0; + } else if(v > 1) { + v = 1; + } + if(this.value != v) { + this.value = v; + this.knob.set_x(Math.round(this.value * (this._width - this.knob.getWidth()))); + this.dispatchEvent(new openfl_events_Event("value_changed")); + } + } + ,setKnobPos: function(x) { + this.setValue(x / (this._width - this.knob.getWidth())); + } + ,getValue: function() { + return this.value; + } + ,getWidth: function() { + return this._width; + } + ,getHeight: function() { + return com_davidmaletz_controls_Slider.getUI().getHeight(); + } + ,__class__: com_davidmaletz_controls_Slider +}); +var com_davidmaletz_controls_SliderKnob = function(bar) { + this.downX = 0; + this.pressed = null; + this.repeat_ct = -Infinity; + com_davidmaletz_lerp_LerpSprite.call(this); + this.bar = bar; + this.addChild(com_davidmaletz_controls_Slider.getUI().createKnob()); + com_davidmaletz_lerp_DarkenKeyframe.setDarkness(this,1.0); +}; +$hxClasses["com.davidmaletz.controls.SliderKnob"] = com_davidmaletz_controls_SliderKnob; +com_davidmaletz_controls_SliderKnob.__name__ = ["com","davidmaletz","controls","SliderKnob"]; +com_davidmaletz_controls_SliderKnob.point = null; +com_davidmaletz_controls_SliderKnob.__super__ = com_davidmaletz_lerp_LerpSprite; +com_davidmaletz_controls_SliderKnob.prototype = $extend(com_davidmaletz_lerp_LerpSprite.prototype,{ + bar: null + ,getWidth: function() { + return com_davidmaletz_controls_Slider.getUI().getKnobWidth(); + } + ,init: function(e) { + com_davidmaletz_lerp_LerpSprite.prototype.init.call(this,e); + com_davidmaletz_faengfl_TouchAdapter.instance.addEventListener("touch_down",$bind(this,this.down),false,com_davidmaletz_faengfl_Window.window_ct + 1); + com_davidmaletz_faengfl_TouchAdapter.instance.addEventListener("touch_up",$bind(this,this.up),false,com_davidmaletz_faengfl_Window.window_ct + 1); + com_davidmaletz_faengfl_TouchAdapter.instance.addEventListener("touch_move",$bind(this,this.move),false,com_davidmaletz_faengfl_Window.window_ct + 1); + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.checkRepeat)); + } + ,destroy: function(e) { + com_davidmaletz_lerp_LerpSprite.prototype.destroy.call(this,e); + com_davidmaletz_faengfl_TouchAdapter.instance.removeEventListener("touch_down",$bind(this,this.down)); + com_davidmaletz_faengfl_TouchAdapter.instance.removeEventListener("touch_up",$bind(this,this.up)); + com_davidmaletz_faengfl_TouchAdapter.instance.removeEventListener("touch_move",$bind(this,this.move)); + com_davidmaletz_controls_Controller.instance.removeEventListener("tap",$bind(this,this.modal)); + com_davidmaletz_controls_Controller.instance.removeEventListener("press",$bind(this,this.modal)); + com_davidmaletz_controls_Controller.instance.removeEventListener("release",$bind(this,this.modal)); + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.checkRepeat)); + } + ,repeat_ct: null + ,checkRepeat: function(e) { + if(this.pressed != null && isNaN(this.downX)) { + this.repeat_ct -= com_davidmaletz_faengfl_FaengFL.frameTime; + if(this.repeat_ct <= 0) { + this.repeat_ct = this.repeat_ct == -Infinity ? 20 : 5; + this.updateBar(); + } + } + } + ,updateBar: function() { + var target = this.pressed.x - this.getWidth() * 0.5; + var d = Math.abs(target - this.get_x()); + if(d > 20) { + if(target > this.get_x()) { + target = this.get_x() + 20; + } else { + target = this.get_x() - 20; + } + } + this.bar.setKnobPos(target); + } + ,pressed: null + ,hovered: null + ,downX: null + ,move: function(e) { + if(!this.get_visible()) { + return; + } + if(com_davidmaletz_controls_SliderKnob.point == null) { + com_davidmaletz_controls_SliderKnob.point = new openfl_geom_Point(e.stageX,e.stageY); + } else { + com_davidmaletz_controls_SliderKnob.point.setTo(e.stageX,e.stageY); + } + var p = this.bar.globalToLocal(com_davidmaletz_controls_SliderKnob.point); + if(this.pressed == null) { + var h = this.inBounds(p); + if(h != this.hovered) { + this.hovered = h; + this.lerp(new com_davidmaletz_lerp_DarkenKeyframe(this.hovered ? 0.7 : 1.0),10); + } + return; + } + e.stopImmediatePropagation(); + if(isNaN(this.downX)) { + this.pressed = p; + } else { + this.bar.setKnobPos(this.downX + p.x - this.pressed.x); + } + } + ,inBounds: function(p,fuzzy) { + if(fuzzy == null) { + fuzzy = 0; + } + if(p.x >= this.get_x() && p.y >= this.get_y() && p.x <= this.getWidth() + this.get_x()) { + return p.y <= this.bar.getHeight() + this.get_y() + fuzzy; + } else { + return false; + } + } + ,inScrollBounds: function(p,fuzzy) { + if(fuzzy == null) { + fuzzy = 0; + } + if(p.x >= 0 && p.y >= 0 && p.x <= this.bar.getWidth()) { + return p.y <= this.bar.getHeight() + fuzzy; + } else { + return false; + } + } + ,modal: function(e) { + e.stopImmediatePropagation(); + } + ,down: function(e) { + if(!this.get_visible()) { + return; + } + if(com_davidmaletz_controls_SliderKnob.point == null) { + com_davidmaletz_controls_SliderKnob.point = new openfl_geom_Point(e.stageX,e.stageY); + } else { + com_davidmaletz_controls_SliderKnob.point.setTo(e.stageX,e.stageY); + } + var p = this.bar.globalToLocal(com_davidmaletz_controls_SliderKnob.point); + if(this.inScrollBounds(p,0)) { + this.pressed = p; + this.downX = this.inBounds(p,0) ? this.get_x() : NaN; + this.repeat_ct = -Infinity; + this.lerp(new com_davidmaletz_lerp_DarkenKeyframe(0.5),10); + e.stopImmediatePropagation(); + com_davidmaletz_controls_Controller.instance.addEventListener("tap",$bind(this,this.modal),false,com_davidmaletz_faengfl_Window.window_ct + 1); + com_davidmaletz_controls_Controller.instance.addEventListener("press",$bind(this,this.modal),false,com_davidmaletz_faengfl_Window.window_ct + 1); + com_davidmaletz_controls_Controller.instance.addEventListener("release",$bind(this,this.modal),false,com_davidmaletz_faengfl_Window.window_ct + 1); + } + } + ,up: function(e) { + if(!this.get_visible()) { + return; + } + if(this.pressed != null) { + this.pressed = null; + this.lerp(new com_davidmaletz_lerp_DarkenKeyframe(1.0),10); + this.hovered = false; + e.stopImmediatePropagation(); + com_davidmaletz_controls_Controller.instance.removeEventListener("tap",$bind(this,this.modal)); + com_davidmaletz_controls_Controller.instance.removeEventListener("press",$bind(this,this.modal)); + com_davidmaletz_controls_Controller.instance.removeEventListener("release",$bind(this,this.modal)); + } + } + ,__class__: com_davidmaletz_controls_SliderKnob +}); +var com_davidmaletz_controls_Spinner = function(c,min,max,val,ht) { + if(ht == null) { + ht = 10; + } + com_davidmaletz_faengfl_InitSprite.call(this); + var ht1 = ht + 2; + this.addChild(new com_davidmaletz_faengfl_SolidDrawable(16777215,32,ht1,1).create(0,0)); + this.min = min; + this.max = max; + this.value = val; + this.field = new com_davidmaletz_controls__$Spinner_MyTextField(this,c,30,this.getValue(),ht1); + this.field.set_x(1); + this.field.set_y(1); + this.addChild(this.field); + var arrow = new com_fancyfish_faeng_common_mutable_Static(">"); + var f = com_davidmaletz_faengfl_Application.button_factory; + var bg = f.createBG(12,7); + var hover = f.createHover(12,7); + this.up = new com_davidmaletz_controls_StaticButton(31,0,bg,hover,arrow); + this.up.onClickFunc = $bind(this,this.spinUp); + this.addChild(this.up); + this.down = new com_davidmaletz_controls_StaticButton(31,ht1 * 0.5,bg,hover,arrow); + this.down.onClickFunc = $bind(this,this.spinDown); + this.addChild(this.down); + var c1 = this.up.getChildAt(this.up.get_numChildren() - 1); + c1.set_rotation(-90); + c1.set_x(2); + c1.set_y(9); + var c2 = this.down.getChildAt(this.up.get_numChildren() - 1); + c2.set_rotation(90); + c2.set_x(11); + c2.set_y(-2); +}; +$hxClasses["com.davidmaletz.controls.Spinner"] = com_davidmaletz_controls_Spinner; +com_davidmaletz_controls_Spinner.__name__ = ["com","davidmaletz","controls","Spinner"]; +com_davidmaletz_controls_Spinner.__super__ = com_davidmaletz_faengfl_InitSprite; +com_davidmaletz_controls_Spinner.prototype = $extend(com_davidmaletz_faengfl_InitSprite.prototype,{ + field: null + ,up: null + ,down: null + ,min: null + ,max: null + ,value: null + ,setFocused: function(e) { + com_davidmaletz_faengfl_Application.setFocus(this.field,e); + } + ,hasFocus: function() { + return this.field == com_davidmaletz_faengfl_Application.getFocus(); + } + ,getWidth: function() { + return 42; + } + ,getHeight: function() { + return this.field.HT + 2; + } + ,init: function(e) { + this.destroy(e); + com_davidmaletz_controls_Controller.instance.addEventListener("tap",$bind(this,this.tap),false,com_davidmaletz_faengfl_Window.window_ct + 1); + com_davidmaletz_controls_Controller.instance.addEventListener("release",$bind(this,this.release),false,com_davidmaletz_faengfl_Window.window_ct + 2); + } + ,destroy: function(e) { + com_davidmaletz_controls_Controller.instance.removeEventListener("tap",$bind(this,this.tap)); + com_davidmaletz_controls_Controller.instance.removeEventListener("release",$bind(this,this.release)); + } + ,tap: function(e) { + var _g = e.key; + switch(_g) { + case "down": + this.down.onHover(true); + this.down.onClick(); + e.stopImmediatePropagation(); + break; + case "up": + this.up.onHover(true); + this.up.onClick(); + e.stopImmediatePropagation(); + break; + } + } + ,release: function(e) { + if(e.key == "up") { + this.up.onHover(false); + } + if(e.key == "down") { + this.down.onHover(false); + } + } + ,getValue: function() { + return this.value; + } + ,setValue: function(v,updateText) { + if(updateText == null) { + updateText = true; + } + v = com_fancyfish_faeng_common_Utils.clampi(v,this.min,this.max); + if(v != this.value) { + this.value = v; + if(updateText) { + this.field.setText(Std.string(this.value)); + } + this.dispatchEvent(new openfl_events_Event("change_value")); + return true; + } else { + return false; + } + } + ,spinUp: function() { + this.setValue(this.value == this.max ? this.min : this.value + 1); + } + ,spinDown: function() { + this.setValue(this.value == this.min ? this.max : this.value - 1); + } + ,__class__: com_davidmaletz_controls_Spinner +}); +var com_davidmaletz_faengfl_Focusable = function() { }; +$hxClasses["com.davidmaletz.faengfl.Focusable"] = com_davidmaletz_faengfl_Focusable; +com_davidmaletz_faengfl_Focusable.__name__ = ["com","davidmaletz","faengfl","Focusable"]; +com_davidmaletz_faengfl_Focusable.prototype = { + gainFocus: null + ,loseFocus: null + ,__class__: com_davidmaletz_faengfl_Focusable +}; +var com_davidmaletz_faengfl_ui_TextField = function(c,width,initial,align,sz,color,bg,font,max_length,ht) { + if(ht == null) { + ht = 10; + } + if(max_length == null) { + max_length = -1; + } + if(bg == null) { + bg = 16777215; + } + if(color == null) { + color = 0; + } + if(sz == null) { + sz = 1; + } + if(align == null) { + align = 0; + } + if(initial == null) { + initial = ""; + } + this.HT = ht; + com_davidmaletz_faengfl_InitSprite.call(this); + this.text = js_Browser.get_document().createElement("input"); + this.text.type = "text"; + this.text.value = initial; + this.text.style.border = "none"; + var tmp = StringTools.hex(color,6); + this.text.style.color = "#" + tmp; + if(bg == 0) { + this.text.style.background = "none"; + } else { + var tmp1 = StringTools.hex(bg,6); + this.text.style.backgroundColor = "#" + tmp1; + } + this.text.style.position = "absolute"; + this.text.style.top = "0px"; + this.text.style.left = "0px"; + this._width = width; + if(align != 0) { + this.text.style.textAlign = align == 1 ? "right" : "center"; + } + if(max_length >= 0) { + this.text.maxLength = max_length; + } + this.text.onfocus = $bind(this,this.setFocus); + this.text.onblur = $bind(this,this.clearFocus); +}; +$hxClasses["com.davidmaletz.faengfl.ui.TextField"] = com_davidmaletz_faengfl_ui_TextField; +com_davidmaletz_faengfl_ui_TextField.__name__ = ["com","davidmaletz","faengfl","ui","TextField"]; +com_davidmaletz_faengfl_ui_TextField.__interfaces__ = [com_davidmaletz_faengfl_Focusable]; +com_davidmaletz_faengfl_ui_TextField.point = null; +com_davidmaletz_faengfl_ui_TextField.__super__ = com_davidmaletz_faengfl_InitSprite; +com_davidmaletz_faengfl_ui_TextField.prototype = $extend(com_davidmaletz_faengfl_InitSprite.prototype,{ + HT: null + ,text: null + ,_width: null + ,init: function(e) { + this.destroy(null); + var container = js_Browser.get_document().getElementById("openfl-content"); + container.appendChild(this.text); + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.enter_frame)); + this.enter_frame(null); + } + ,destroy: function(e) { + if(this.text.parentNode != null) { + this.text.parentNode.removeChild(this.text); + } + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.enter_frame)); + if(e != null && this.hasFocus()) { + com_davidmaletz_faengfl_Application.setFocus(null); + } + } + ,hasFocus: function() { + return com_davidmaletz_faengfl_Application.getFocus() == this; + } + ,transformPoint: function(x,y) { + if(com_davidmaletz_faengfl_ui_TextField.point == null) { + com_davidmaletz_faengfl_ui_TextField.point = new openfl_geom_Point(x,y); + } else { + com_davidmaletz_faengfl_ui_TextField.point.setTo(x,y); + } + return this.localToGlobal(com_davidmaletz_faengfl_ui_TextField.point); + } + ,enter_frame: function(e) { + var p = this.transformPoint(0,0); + var l = Math.round(p.x); + var t = Math.round(p.y); + this.text.style.left = l + "px"; + this.text.style.top = t + "px"; + p = this.transformPoint(this._width,this.HT); + this.text.style.width = Math.round(Math.min(p.x,openfl_Lib.current.stage.stageWidth) - l) + "px"; + var ht = Math.round(p.y - t); + this.text.style.height = ht + "px"; + this.text.style.fontSize = Math.round(ht * 0.8) + "px"; + } + ,getText: function() { + return this.text.value; + } + ,setText: function(t) { + this.text.value = t; + } + ,selectAll: function() { + this.text.setSelectionRange(0,this.text.value.length); + } + ,oldKeyDown: null + ,oldKeyUp: null + ,gainFocus: function(e) { + try { + this.text.focus(); + } catch( e1 ) { + haxe_CallStack.lastException = e1; + } + if(this.oldKeyDown == null) { + this.oldKeyDown = openfl_Lib.current.stage.window.onKeyDown.__listeners; + openfl_Lib.current.stage.window.onKeyDown.__listeners = [$bind(this,this.keyCheck)]; + } + if(this.oldKeyUp == null) { + this.oldKeyUp = openfl_Lib.current.stage.window.onKeyUp.__listeners; + openfl_Lib.current.stage.window.onKeyUp.__listeners = []; + } + } + ,keyCheck: function(e,m) { + if(e == 27) { + this.clearFocus(); + } else if(e == 13) { + this.action(true); + } + } + ,loseFocus: function() { + openfl_Lib.current.stage.set_focus(null); + try { + this.text.blur(); + } catch( e ) { + haxe_CallStack.lastException = e; + } + this.action(false); + if(this.oldKeyDown != null) { + openfl_Lib.current.stage.window.onKeyDown.__listeners = this.oldKeyDown; + this.oldKeyDown = null; + } + if(this.oldKeyUp != null) { + openfl_Lib.current.stage.window.onKeyUp.__listeners = this.oldKeyUp; + this.oldKeyUp = null; + } + } + ,setFocus: function() { + if(!this.hasFocus()) { + com_davidmaletz_faengfl_Application.setFocus(this); + } + } + ,clearFocus: function() { + if(this.hasFocus()) { + com_davidmaletz_faengfl_Application.setFocus(null); + } + } + ,action: function(enter) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + if(enter) { + this.dispatchEvent(new openfl_events_Event("action")); + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + ,__class__: com_davidmaletz_faengfl_ui_TextField +}); +var com_davidmaletz_controls__$Spinner_MyTextField = function(s,c,width,value,ht) { + com_davidmaletz_faengfl_ui_TextField.call(this,c,width,value == null ? "null" : "" + value,1,1,0,0,null,-1,ht); + this.spinner = s; + this.text.oninput = $bind(this,this.updated); +}; +$hxClasses["com.davidmaletz.controls._Spinner.MyTextField"] = com_davidmaletz_controls__$Spinner_MyTextField; +com_davidmaletz_controls__$Spinner_MyTextField.__name__ = ["com","davidmaletz","controls","_Spinner","MyTextField"]; +com_davidmaletz_controls__$Spinner_MyTextField.__super__ = com_davidmaletz_faengfl_ui_TextField; +com_davidmaletz_controls__$Spinner_MyTextField.prototype = $extend(com_davidmaletz_faengfl_ui_TextField.prototype,{ + spinner: null + ,gainFocus: function(e) { + com_davidmaletz_faengfl_ui_TextField.prototype.gainFocus.call(this,e); + this.selectAll(); + } + ,action: function(enter) { + var v = Std.parseFloat(StringTools.replace(this.getText(),",","")); + if(isNaN(v) || !this.spinner.setValue(Math.round(v))) { + this.setText(Std.string(this.spinner.getValue())); + } + if(com_davidmaletz_faengfl_Application.getFocus() == this) { + com_davidmaletz_faengfl_Application.setFocus(null); + } + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + if(enter) { + this.spinner.dispatchEvent(new openfl_events_Event("action")); + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + ,updated: function(e) { + var v = Std.parseFloat(StringTools.replace(this.getText(),",","")); + if(!isNaN(v)) { + this.spinner.setValue(Math.round(v),false); + } + } + ,onUp: function(up) { + (up ? this.spinner.up : this.spinner.down).onClick(); + } + ,keyCheck: function(e,m) { + if(e == 1073741906 || e == 1073741905) { + this.onUp(e == 1073741906); + } else { + com_davidmaletz_faengfl_ui_TextField.prototype.keyCheck.call(this,e,m); + } + } + ,__class__: com_davidmaletz_controls__$Spinner_MyTextField +}); +var com_davidmaletz_controls_StaticButton = function(x,y,bg,hover,text,col,scale,fnt) { + if(scale == null) { + scale = 1; + } + if(col == null) { + col = 0; + } + this.clickCt = 0; + this.touch = -1; + com_davidmaletz_controls_Button.call(this,x,y,bg,hover,text,col,scale,fnt); + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); +}; +$hxClasses["com.davidmaletz.controls.StaticButton"] = com_davidmaletz_controls_StaticButton; +com_davidmaletz_controls_StaticButton.__name__ = ["com","davidmaletz","controls","StaticButton"]; +com_davidmaletz_controls_StaticButton.point = null; +com_davidmaletz_controls_StaticButton.__super__ = com_davidmaletz_controls_Button; +com_davidmaletz_controls_StaticButton.prototype = $extend(com_davidmaletz_controls_Button.prototype,{ + init: function(e) { + this.destroy(e); + com_davidmaletz_faengfl_TouchAdapter.instance.addEventListener("touch_down",$bind(this,this.down),false,com_davidmaletz_faengfl_Window.window_ct + 1); + com_davidmaletz_faengfl_TouchAdapter.instance.addEventListener("touch_up",$bind(this,this.up),false,com_davidmaletz_faengfl_Window.window_ct + 1); + com_davidmaletz_faengfl_TouchAdapter.instance.addEventListener("touch_move",$bind(this,this.move),false,com_davidmaletz_faengfl_Window.window_ct + 1); + openfl_Lib.current.stage.addEventListener("fullScreen",$bind(this,this.fullscreen)); + } + ,destroy: function(e) { + com_davidmaletz_faengfl_TouchAdapter.instance.removeEventListener("touch_down",$bind(this,this.down)); + com_davidmaletz_faengfl_TouchAdapter.instance.removeEventListener("touch_up",$bind(this,this.up)); + com_davidmaletz_faengfl_TouchAdapter.instance.removeEventListener("touch_move",$bind(this,this.move)); + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.enter_frame)); + openfl_Lib.current.stage.removeEventListener("fullScreen",$bind(this,this.fullscreen)); + } + ,touch: null + ,clickCt: null + ,enter_frame: function(e) { + this.clickCt -= com_davidmaletz_faengfl_FaengFL.frameTime; + if(this.clickCt <= 0 && this.touch != -1) { + this.onClick(); + this.clickCt = 3; + } + } + ,inBounds: function(e) { + if(this.parent == null) { + return false; + } + if(com_davidmaletz_controls_StaticButton.point == null) { + com_davidmaletz_controls_StaticButton.point = new openfl_geom_Point(e.stageX,e.stageY); + } else { + com_davidmaletz_controls_StaticButton.point.setTo(e.stageX,e.stageY); + } + var p = this.parent.globalToLocal(com_davidmaletz_controls_StaticButton.point); + return this.getPos().containsPoint(p); + } + ,down: function(e) { + if(this.inBounds(e)) { + e.stopImmediatePropagation(); + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.enter_frame)); + this.touch = e.id; + this.onClick(); + this.clickCt = 10; + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.enter_frame)); + } + } + ,up: function(e) { + if(e.id == this.touch) { + e.stopImmediatePropagation(); + this.touch = -1; + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.enter_frame)); + } + } + ,move: function(e) { + if(this.touch != -1) { + e.stopImmediatePropagation(); + } else { + this.onHover(this.inBounds(e)); + } + } + ,fullscreen: function(e) { + this.touch = -1; + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.enter_frame)); + } + ,__class__: com_davidmaletz_controls_StaticButton +}); +var com_davidmaletz_controls_scroll_ScrollUI = function() { }; +$hxClasses["com.davidmaletz.controls.scroll.ScrollUI"] = com_davidmaletz_controls_scroll_ScrollUI; +com_davidmaletz_controls_scroll_ScrollUI.__name__ = ["com","davidmaletz","controls","scroll","ScrollUI"]; +com_davidmaletz_controls_scroll_ScrollUI.prototype = { + isAlwaysVisible: null + ,getWidth: null + ,getMinKnobHeight: null + ,createScrollbar: null + ,createKnob: null + ,setKnobHeight: null + ,__class__: com_davidmaletz_controls_scroll_ScrollUI +}; +var com_davidmaletz_controls_scroll_DefaultScrollUI = function(scrollbar,knob) { + this.scrollbar_factory = scrollbar == null ? new com_davidmaletz_faengfl_SolidDrawableFactory(16777215) : scrollbar; + this.knob_factory = knob == null ? new com_davidmaletz_faengfl_SolidDrawableFactory(11711154) : knob; +}; +$hxClasses["com.davidmaletz.controls.scroll.DefaultScrollUI"] = com_davidmaletz_controls_scroll_DefaultScrollUI; +com_davidmaletz_controls_scroll_DefaultScrollUI.__name__ = ["com","davidmaletz","controls","scroll","DefaultScrollUI"]; +com_davidmaletz_controls_scroll_DefaultScrollUI.__interfaces__ = [com_davidmaletz_controls_scroll_ScrollUI]; +com_davidmaletz_controls_scroll_DefaultScrollUI.prototype = { + scrollbar_factory: null + ,knob_factory: null + ,isAlwaysVisible: function() { + return false; + } + ,getWidth: function() { + return 6; + } + ,getMinKnobHeight: function() { + return 10; + } + ,createScrollbar: function(h) { + return this.scrollbar_factory.create(6,h).create(0,0); + } + ,createKnob: function() { + return this.knob_factory.create(6,1).create(0,0); + } + ,setKnobHeight: function(knob,h) { + knob.set_scaleY(h); + } + ,__class__: com_davidmaletz_controls_scroll_DefaultScrollUI +}; +var com_davidmaletz_faengfl_ScissorSprite = function(w,h,m,c,x,y) { + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + this.minChildren = 1; + this._width = w; + this._height = h; + this._mask = m; + this.sx = x; + this.sy = y; + if(c != null && Std["is"](c,com_davidmaletz_faengfl_FramebufferSprite)) { + this.container = c; + this.pScale = (js_Boot.__cast(c , com_davidmaletz_faengfl_FramebufferSprite)).pScale; + } else { + this.container = null; + this.pScale = 1; + } + openfl_display_Sprite.call(this); +}; +$hxClasses["com.davidmaletz.faengfl.ScissorSprite"] = com_davidmaletz_faengfl_ScissorSprite; +com_davidmaletz_faengfl_ScissorSprite.__name__ = ["com","davidmaletz","faengfl","ScissorSprite"]; +com_davidmaletz_faengfl_ScissorSprite.point = null; +com_davidmaletz_faengfl_ScissorSprite.__super__ = openfl_display_Sprite; +com_davidmaletz_faengfl_ScissorSprite.prototype = $extend(openfl_display_Sprite.prototype,{ + _width: null + ,_height: null + ,_mask: null + ,minChildren: null + ,container: null + ,sx: null + ,sy: null + ,pScale: null + ,toGlobal: function(p) { + p = this._mask.localToGlobal(p); + if(this.container != null && Std["is"](this.container,openfl_display_DisplayObject)) { + p = (js_Boot.__cast(this.container , openfl_display_DisplayObject)).globalToLocal(p); + } + return p; + } + ,__renderGL: function(renderSession) { + if(this._height > 0 && this._width > 0 && this._mask.get_scaleX() > 0 && this._mask.stage != null && this.get_numChildren() >= this.minChildren) { + if(com_davidmaletz_faengfl_ScissorSprite.point == null) { + com_davidmaletz_faengfl_ScissorSprite.point = new openfl_geom_Point(this.sx,this.sy); + } else { + com_davidmaletz_faengfl_ScissorSprite.point.setTo(this.sx,this.sy); + } + var st = this.toGlobal(com_davidmaletz_faengfl_ScissorSprite.point); + com_davidmaletz_faengfl_ScissorSprite.point.setTo(this._width + this.sx,this._height + this.sy); + var end = this.toGlobal(com_davidmaletz_faengfl_ScissorSprite.point); + var w = this.container == null ? this._mask.stage.stageWidth : this.container.getWidth() + 1; + var ht = this.container == null ? this._mask.stage.stageHeight : this.container.getHeight() + 1; + if(end.x >= 0 && ht - 1 - st.y >= 0 && st.x <= w && ht - 1 - end.y <= ht) { + renderSession.spriteBatch.flush(); + renderSession.gl.enable(renderSession.gl.SCISSOR_TEST); + renderSession.gl.scissor(Math.round(st.x) * this.pScale,Math.round(ht - 1 - end.y) * this.pScale,Math.round(end.x - st.x) * this.pScale,Math.round(end.y - st.y) * this.pScale); + openfl_display_Sprite.prototype.__renderGL.call(this,renderSession); + renderSession.spriteBatch.flush(); + renderSession.gl.disable(renderSession.gl.SCISSOR_TEST); + } + } + } + ,__class__: com_davidmaletz_faengfl_ScissorSprite +}); +var com_davidmaletz_controls_scroll_ListGrid = function(w,h,m,c,list) { + com_davidmaletz_faengfl_ScissorSprite.call(this,w,h,m,c,0,0); + this.curHeight = 0; + this.rowHeight = 0; + this.curCol = -1; + this.rows = []; + this.clickables = new com_davidmaletz_controls_scroll_ScrollClickableColumns(list); +}; +$hxClasses["com.davidmaletz.controls.scroll.ListGrid"] = com_davidmaletz_controls_scroll_ListGrid; +com_davidmaletz_controls_scroll_ListGrid.__name__ = ["com","davidmaletz","controls","scroll","ListGrid"]; +com_davidmaletz_controls_scroll_ListGrid.__super__ = com_davidmaletz_faengfl_ScissorSprite; +com_davidmaletz_controls_scroll_ListGrid.prototype = $extend(com_davidmaletz_faengfl_ScissorSprite.prototype,{ + clickables: null + ,rows: null + ,curHeight: null + ,rowHeight: null + ,curCol: null + ,rowCount: function() { + return this.rows.length + 1; + } + ,yToRow: function(y) { + return com_fancyfish_faeng_common_Utils.drawCDF(this.rows,y + 0.01,false); + } + ,getRowY: function(row) { + if(row >= this.rows.length) { + return this.getHeight(); + } else if(row < 0) { + return 0; + } else { + return this.rows[row]; + } + } + ,getHeight: function() { + return this.curHeight + this.rowHeight; + } + ,clear: function() { + this.curHeight = 0; + this.rowHeight = 0; + this.curCol = -1; + com_fancyfish_faeng_common_Utils.clear(this.rows); + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this); + this.clickables.clear(); + } + ,addItem: function(renderer,i,cols,w,rw) { + if(rw == null) { + rw = -1; + } + if(w == null) { + w = 1; + } + this.curCol++; + if(this.curCol >= cols) { + this.curCol = 0; + this.curHeight += this.rowHeight; + this.rows.push(this.curHeight); + this.rowHeight = 0; + } + if(renderer == null) { + return null; + } + if(rw < 0) { + rw = renderer.getWidth(); + } + this.rowHeight = Math.max(this.rowHeight,renderer.getHeight(i)); + var c = renderer.create(i,this.curCol * rw,this.curHeight); + if(c != null) { + this.addChild(c); + if(Std["is"](c,com_davidmaletz_controls_Clickable)) { + this.clickables.addClickable(c,this,w); + } + var _g1 = 1; + var _g = w; + while(_g1 < _g) { + var i1 = _g1++; + this.addItem(null,null,cols); + } + } + return c; + } + ,__class__: com_davidmaletz_controls_scroll_ListGrid +}); +var com_davidmaletz_controls_scroll_ScrollClickableColumns = function(list) { + com_davidmaletz_controls_ArrayClickableColumns.call(this); + this.list = list; +}; +$hxClasses["com.davidmaletz.controls.scroll.ScrollClickableColumns"] = com_davidmaletz_controls_scroll_ScrollClickableColumns; +com_davidmaletz_controls_scroll_ScrollClickableColumns.__name__ = ["com","davidmaletz","controls","scroll","ScrollClickableColumns"]; +com_davidmaletz_controls_scroll_ScrollClickableColumns.__super__ = com_davidmaletz_controls_ArrayClickableColumns; +com_davidmaletz_controls_scroll_ScrollClickableColumns.prototype = $extend(com_davidmaletz_controls_ArrayClickableColumns.prototype,{ + list: null + ,changeSelected: function(selected,col) { + this.list.ensureVisible(selected.getPos()); + } + ,inBounds: function(col,p) { + var y = p.y - this.list.getScrollY(); + if(p.x >= 0 && p.x < this.list.getWidth() && y > 0) { + return y < this.list.getViewportHeight(); + } else { + return false; + } + } + ,getYOffset: function(col) { + return this.list.yToRow(this.list.getScrollY()); + } + ,canSelect: function(col,c) { + return true; + } + ,__class__: com_davidmaletz_controls_scroll_ScrollClickableColumns +}); +var com_davidmaletz_controls_scroll_ScrollKnob = function(bar) { + this.downY = 0; + this.pressed = null; + this.repeat_ct = -Infinity; + this._height = 1; + com_davidmaletz_lerp_LerpSprite.call(this); + this.bar = bar; + this.addChild(com_davidmaletz_controls_scroll_Scrollbar.getUI().createKnob()); + com_davidmaletz_lerp_DarkenKeyframe.setDarkness(this,1.0); +}; +$hxClasses["com.davidmaletz.controls.scroll.ScrollKnob"] = com_davidmaletz_controls_scroll_ScrollKnob; +com_davidmaletz_controls_scroll_ScrollKnob.__name__ = ["com","davidmaletz","controls","scroll","ScrollKnob"]; +com_davidmaletz_controls_scroll_ScrollKnob.point = null; +com_davidmaletz_controls_scroll_ScrollKnob.__super__ = com_davidmaletz_lerp_LerpSprite; +com_davidmaletz_controls_scroll_ScrollKnob.prototype = $extend(com_davidmaletz_lerp_LerpSprite.prototype,{ + bar: null + ,_height: null + ,getHeight: function() { + return this._height; + } + ,setHeight: function(ht) { + var ui = com_davidmaletz_controls_scroll_Scrollbar.getUI(); + ht = Math.max(ui.getMinKnobHeight(),ht); + if(this._height != ht) { + this._height = ht; + if(this.stage != null) { + ui.setKnobHeight(this.getChildAt(0),ht); + } + } + } + ,init: function(e) { + com_davidmaletz_lerp_LerpSprite.prototype.init.call(this,e); + com_davidmaletz_faengfl_TouchAdapter.instance.addEventListener("touch_down",$bind(this,this.down),false,com_davidmaletz_faengfl_Window.window_ct + 1); + com_davidmaletz_faengfl_TouchAdapter.instance.addEventListener("touch_up",$bind(this,this.up),false,com_davidmaletz_faengfl_Window.window_ct + 1); + com_davidmaletz_faengfl_TouchAdapter.instance.addEventListener("touch_move",$bind(this,this.move),false,com_davidmaletz_faengfl_Window.window_ct + 1); + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.checkRepeat)); + if(this._height > 1) { + com_davidmaletz_controls_scroll_Scrollbar.getUI().setKnobHeight(this.getChildAt(0),this._height); + } + } + ,destroy: function(e) { + com_davidmaletz_lerp_LerpSprite.prototype.destroy.call(this,e); + com_davidmaletz_faengfl_TouchAdapter.instance.removeEventListener("touch_down",$bind(this,this.down)); + com_davidmaletz_faengfl_TouchAdapter.instance.removeEventListener("touch_up",$bind(this,this.up)); + com_davidmaletz_faengfl_TouchAdapter.instance.removeEventListener("touch_move",$bind(this,this.move)); + com_davidmaletz_controls_Controller.instance.removeEventListener("tap",$bind(this,this.modal)); + com_davidmaletz_controls_Controller.instance.removeEventListener("press",$bind(this,this.modal)); + com_davidmaletz_controls_Controller.instance.removeEventListener("release",$bind(this,this.modal)); + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.checkRepeat)); + } + ,repeat_ct: null + ,checkRepeat: function(e) { + if(this.pressed != null && isNaN(this.downY)) { + this.repeat_ct -= com_davidmaletz_faengfl_FaengFL.frameTime; + if(this.repeat_ct <= 0) { + this.repeat_ct = this.repeat_ct == -Infinity ? 20 : 5; + this.updateBar(); + } + } + } + ,updateBar: function() { + var target = this.pressed.y - this._height * 0.5; + var d = Math.abs(target - this.get_y()); + if(d > 20) { + if(target > this.get_y()) { + target = this.get_y() + 20; + } else { + target = this.get_y() - 20; + } + } + this.bar.setKnobPos(target); + } + ,pressed: null + ,hovered: null + ,downY: null + ,move: function(e) { + if(!this.get_visible()) { + return; + } + if(com_davidmaletz_controls_scroll_ScrollKnob.point == null) { + com_davidmaletz_controls_scroll_ScrollKnob.point = new openfl_geom_Point(e.stageX,e.stageY); + } else { + com_davidmaletz_controls_scroll_ScrollKnob.point.setTo(e.stageX,e.stageY); + } + var p = this.bar.globalToLocal(com_davidmaletz_controls_scroll_ScrollKnob.point); + if(this.pressed == null) { + var h = this.inBounds(p); + if(h != this.hovered) { + this.hovered = h; + this.lerp(new com_davidmaletz_lerp_DarkenKeyframe(this.hovered ? 0.7 : 1.0),10); + } + return; + } + e.stopImmediatePropagation(); + if(isNaN(this.downY)) { + this.pressed = p; + } else { + this.bar.setKnobPos(this.downY + p.y - this.pressed.y); + } + } + ,inBounds: function(p,fuzzy) { + if(fuzzy == null) { + fuzzy = 0; + } + if(p.x >= this.get_x() && p.y >= this.get_y() && p.x <= this.bar.getWidth() + this.get_x() + fuzzy) { + return p.y <= this._height + this.get_y(); + } else { + return false; + } + } + ,inScrollBounds: function(p,fuzzy) { + if(fuzzy == null) { + fuzzy = 0; + } + if(p.x >= 0 && p.y >= 0 && p.x <= this.bar.getWidth() + fuzzy) { + return p.y <= this.bar.getHeight(); + } else { + return false; + } + } + ,modal: function(e) { + e.stopImmediatePropagation(); + } + ,down: function(e) { + if(!this.get_visible()) { + return; + } + if(com_davidmaletz_controls_scroll_ScrollKnob.point == null) { + com_davidmaletz_controls_scroll_ScrollKnob.point = new openfl_geom_Point(e.stageX,e.stageY); + } else { + com_davidmaletz_controls_scroll_ScrollKnob.point.setTo(e.stageX,e.stageY); + } + var p = this.bar.globalToLocal(com_davidmaletz_controls_scroll_ScrollKnob.point); + if(this.inScrollBounds(p,0)) { + this.pressed = p; + this.downY = this.inBounds(p,0) ? this.get_y() : NaN; + this.repeat_ct = -Infinity; + this.lerp(new com_davidmaletz_lerp_DarkenKeyframe(0.5),10); + e.stopImmediatePropagation(); + com_davidmaletz_controls_Controller.instance.addEventListener("tap",$bind(this,this.modal),false,com_davidmaletz_faengfl_Window.window_ct + 1); + com_davidmaletz_controls_Controller.instance.addEventListener("press",$bind(this,this.modal),false,com_davidmaletz_faengfl_Window.window_ct + 1); + com_davidmaletz_controls_Controller.instance.addEventListener("release",$bind(this,this.modal),false,com_davidmaletz_faengfl_Window.window_ct + 1); + } + } + ,up: function(e) { + if(!this.get_visible()) { + return; + } + if(this.pressed != null) { + this.pressed = null; + this.lerp(new com_davidmaletz_lerp_DarkenKeyframe(1.0),10); + this.hovered = false; + e.stopImmediatePropagation(); + com_davidmaletz_controls_Controller.instance.removeEventListener("tap",$bind(this,this.modal)); + com_davidmaletz_controls_Controller.instance.removeEventListener("press",$bind(this,this.modal)); + com_davidmaletz_controls_Controller.instance.removeEventListener("release",$bind(this,this.modal)); + } + } + ,__class__: com_davidmaletz_controls_scroll_ScrollKnob +}); +var com_davidmaletz_controls_scroll_ScrollList = function(container,renderer,rows,cols) { + openfl_display_Sprite.call(this); + this.cols = cols; + this.renderer = renderer; + this.viewportHeight = renderer.getHeight(null) * rows; + this.list = new com_davidmaletz_controls_scroll_ListGrid(this.getViewportWidth(),this.viewportHeight,this,container,this); + this.addChild(this.list); + this.scrollbar = this.makeScrollbar(); + this.addChild(this.scrollbar); + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); +}; +$hxClasses["com.davidmaletz.controls.scroll.ScrollList"] = com_davidmaletz_controls_scroll_ScrollList; +com_davidmaletz_controls_scroll_ScrollList.__name__ = ["com","davidmaletz","controls","scroll","ScrollList"]; +com_davidmaletz_controls_scroll_ScrollList.preSwitch = function(clickables) { + var c = clickables.getSelected(); + var p = null; + if(c != null) { + var pos = c.getPos(); + var x = pos.x + pos.width * 0.5; + var y = pos.y + pos.height * 0.5; + if(com_davidmaletz_controls_scroll_ScrollList.point == null) { + com_davidmaletz_controls_scroll_ScrollList.point = new openfl_geom_Point(x,y); + } else { + com_davidmaletz_controls_scroll_ScrollList.point.setTo(x,y); + } + p = clickables.getSelectedParent().localToGlobal(com_davidmaletz_controls_scroll_ScrollList.point); + } + return p; +}; +com_davidmaletz_controls_scroll_ScrollList.postSwitch = function(clickables,p) { + if(p != null) { + clickables.reset(new com_davidmaletz_faengfl_events_TEvent("",0,p.x,p.y,0)); + } +}; +com_davidmaletz_controls_scroll_ScrollList.point = null; +com_davidmaletz_controls_scroll_ScrollList.__super__ = openfl_display_Sprite; +com_davidmaletz_controls_scroll_ScrollList.prototype = $extend(openfl_display_Sprite.prototype,{ + list: null + ,scrollbar: null + ,viewportHeight: null + ,cols: null + ,renderer: null + ,setHeight: function(ht) { + if(this.viewportHeight != ht) { + this.viewportHeight = ht; + this.list._height = ht; + var sht = this.getScrollHeight(); + var s = this.getScrollY(); + var h = sht - ht; + if(s > h) { + s = h; + } + this.scrollbar.updateHeight(); + this.list.set_y(-s); + this.scrollbar.update(); + var len = this.list.rowCount(); + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + this.updateRowVisible(i); + } + } + } + ,makeScrollbar: function() { + return new com_davidmaletz_controls_scroll_Scrollbar(this); + } + ,window_ct: null + ,init: function(e) { + this.destroy(null); + this.window_ct = com_davidmaletz_faengfl_Window.window_ct + 1; + window.addEventListener("wheel", this); + } + ,destroy: function(e) { + window.removeEventListener("wheel", this); + } + ,getRenderer: function() { + return this.renderer; + } + ,getCols: function() { + return this.cols; + } + ,getList: function() { + return this.list; + } + ,isCurrent: function(grid) { + return this.list == grid; + } + ,switchList: function(grid) { + if(this.list == grid) { + return; + } + this.removeChild(this.list); + this.list = grid; + this.addChildAt(this.list,0); + this.list.set_y(0); + this.scrollbar.update(); + var len = this.list.rowCount(); + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + this.updateRowVisible(i); + } + } + ,handleWheel: function(x,y,delta) { + if(com_davidmaletz_controls_scroll_ScrollList.point == null) { + com_davidmaletz_controls_scroll_ScrollList.point = new openfl_geom_Point(x,y); + } else { + com_davidmaletz_controls_scroll_ScrollList.point.setTo(x,y); + } + var p = this.globalToLocal(com_davidmaletz_controls_scroll_ScrollList.point); + if(p.x < 0 || p.y < 0 || p.x >= this.getWidth() || p.y >= this.getHeight()) { + return false; + } + var ht = this.getViewportHeight(); + var sht = this.getScrollHeight(); + if(ht >= sht) { + return true; + } + var s = this.getScrollY() - com_fancyfish_faeng_common_Utils.sign(delta) * this.renderer.getHeight(null) * 0.5; + if(s < 0) { + s = 0; + } + ht = sht - ht; + if(s > ht) { + s = ht; + } + this.updateScroll(s); + return true; + } + ,handleEvent: function(e) { + if(this.window_ct < com_davidmaletz_faengfl_Window.window_ct) { + return; + } + if(this.handleWheel(e.offsetX,e.offsetY,-e.deltaY)) { + if(e.preventDefault) { + e.preventDefault(); + } + e.returnValue = false; + } + } + ,clear: function() { + this.list.clear(); + } + ,addItem: function(i) { + return this.addMixedItem(i,this.renderer); + } + ,addMixedItem: function(i,renderer,w) { + if(w == null) { + w = 1; + } + var c = this.list.addItem(renderer,i,this.cols,w,this.renderer.getWidth()); + if(c != null) { + c.set_visible(this.inView(this.list.curHeight,this.list.getHeight())); + } + this.scrollbar.update(); + return c; + } + ,ensureVisible: function(bounds) { + var sy = bounds.y + this.list.get_y(); + var ey = sy + bounds.height; + var ht = this.getViewportHeight(); + var s; + if(ey > ht) { + s = bounds.y + bounds.height - ht; + } else if(sy < 0) { + s = bounds.y; + } else { + return; + } + if(s < 0) { + s = 0; + } + var ht1 = this.getScrollHeight() - this.getViewportHeight(); + if(s > ht1) { + s = ht1; + } + this.updateScroll(s); + } + ,inView: function(startY,endY) { + var sy = this.getScrollY(); + if(startY - sy < this.getViewportHeight()) { + return endY - sy > 0; + } else { + return false; + } + } + ,updateRowVisible: function(row) { + var st = row * this.cols; + var end = st + this.cols; + if(end > this.list.get_numChildren()) { + end = this.list.get_numChildren(); + } + var v = this.inView(this.list.getRowY(row - 1),this.list.getRowY(row)); + var _g1 = st; + var _g = end; + while(_g1 < _g) { + var i = _g1++; + this.list.getChildAt(i).set_visible(v); + } + } + ,updateScroll: function(y,updateBar) { + if(updateBar == null) { + updateBar = true; + } + y = Math.round(y); + var cur = this.getScrollY(); + if(cur == y) { + return; + } + var ht = this.getViewportHeight(); + this.list.set_y(-y); + if(updateBar) { + this.scrollbar.update(); + } + if(cur < y) { + var tmp = y; + y = cur; + cur = tmp; + } + var st = this.list.yToRow(y); + var end = this.list.yToRow(Math.min(y + ht,cur)) + 1; + var _g1 = st; + var _g = end; + while(_g1 < _g) { + var i = _g1++; + this.updateRowVisible(i); + } + st = this.list.yToRow(Math.max(y + ht,cur)); + end = this.list.yToRow(cur + ht) + 1; + var _g11 = st; + var _g2 = end; + while(_g11 < _g2) { + var i1 = _g11++; + this.updateRowVisible(i1); + } + } + ,yToRow: function(y) { + return this.list.yToRow(y); + } + ,getItemWidth: function() { + return this.renderer.getWidth(); + } + ,getViewportWidth: function() { + return this.renderer.getWidth() * this.cols; + } + ,getViewportHeight: function() { + return this.viewportHeight; + } + ,getScrollHeight: function() { + return this.list.getHeight(); + } + ,getScrollY: function() { + return -this.list.get_y(); + } + ,getWidth: function() { + return this.getViewportWidth() + this.scrollbar.getWidth() - 3; + } + ,getHeight: function() { + return this.getViewportHeight(); + } + ,__class__: com_davidmaletz_controls_scroll_ScrollList +}); +var com_davidmaletz_controls_scroll_ScrollWindow = function(container,factory,renderer,rows,cols,halign,valign,modal,darken,anim,closeButton) { + if(closeButton == null) { + closeButton = true; + } + if(anim == null) { + anim = true; + } + if(darken == null) { + darken = true; + } + if(modal == null) { + modal = true; + } + if(valign == null) { + valign = 0.5; + } + if(halign == null) { + halign = 0.5; + } + this.list = new com_davidmaletz_controls_scroll_ScrollList(container,renderer,rows,cols); + this.list.set_x(4); + this.list.set_y(4); + com_davidmaletz_controls_ClickableWindow.call(this,container,this.makeDrawable(factory),modal,darken,anim,halign,valign); + this.addChild(this.list); + if(closeButton) { + var close = new com_davidmaletz_controls_CloseButton(this,this.getWidth(),0); + this.addChild(close); + this.clickables.addClickable(close,this); + } +}; +$hxClasses["com.davidmaletz.controls.scroll.ScrollWindow"] = com_davidmaletz_controls_scroll_ScrollWindow; +com_davidmaletz_controls_scroll_ScrollWindow.__name__ = ["com","davidmaletz","controls","scroll","ScrollWindow"]; +com_davidmaletz_controls_scroll_ScrollWindow.__super__ = com_davidmaletz_controls_ClickableWindow; +com_davidmaletz_controls_scroll_ScrollWindow.prototype = $extend(com_davidmaletz_controls_ClickableWindow.prototype,{ + list: null + ,makeDrawable: function(factory) { + return factory.create(this.getWidth(),this.getHeight()); + } + ,switchList: function(grid) { + if(this.list.isCurrent(grid)) { + return; + } + var p = com_davidmaletz_controls_scroll_ScrollList.preSwitch(this.clickables); + this.list.switchList(grid); + (js_Boot.__cast(this.clickables.clickables , com_davidmaletz_controls_CompoundClickableColumns)).setColumn(0,grid.clickables); + com_davidmaletz_controls_scroll_ScrollList.postSwitch(this.clickables,p); + } + ,createClickables: function() { + return new com_davidmaletz_controls_CompoundClickableColumns([this.list.getList().clickables],[this.list.get_y()]); + } + ,addItem: function(i) { + return this.list.addItem(i); + } + ,getWidth: function() { + return this.list.getWidth() + this.list.get_x() + 4; + } + ,getHeight: function() { + return this.list.getHeight() + this.list.get_y() + 4; + } + ,__class__: com_davidmaletz_controls_scroll_ScrollWindow +}); +var com_davidmaletz_controls_scroll_Scrollbar = function(list) { + openfl_display_Sprite.call(this); + this.list = list; + this.set_x(list.getViewportWidth()); + this.addChild(com_davidmaletz_controls_scroll_Scrollbar.getUI().createScrollbar(list.getViewportHeight())); + this.knob = new com_davidmaletz_controls_scroll_ScrollKnob(this); + this.addChild(this.knob); + this.getV().set_visible(false); +}; +$hxClasses["com.davidmaletz.controls.scroll.Scrollbar"] = com_davidmaletz_controls_scroll_Scrollbar; +com_davidmaletz_controls_scroll_Scrollbar.__name__ = ["com","davidmaletz","controls","scroll","Scrollbar"]; +com_davidmaletz_controls_scroll_Scrollbar.ui = null; +com_davidmaletz_controls_scroll_Scrollbar.getUI = function() { + if(com_davidmaletz_controls_scroll_Scrollbar.ui == null) { + com_davidmaletz_controls_scroll_Scrollbar.ui = new com_davidmaletz_controls_scroll_DefaultScrollUI(); + } + return com_davidmaletz_controls_scroll_Scrollbar.ui; +}; +com_davidmaletz_controls_scroll_Scrollbar.__super__ = openfl_display_Sprite; +com_davidmaletz_controls_scroll_Scrollbar.prototype = $extend(openfl_display_Sprite.prototype,{ + list: null + ,knob: null + ,getV: function() { + if(com_davidmaletz_controls_scroll_Scrollbar.getUI().isAlwaysVisible()) { + return this.knob; + } else { + return this; + } + } + ,update: function() { + var ht = this.list.getViewportHeight(); + var sht = this.list.getScrollHeight(); + var y = this.list.getScrollY(); + if(ht >= sht) { + this.getV().set_visible(false); + return; + } + this.getV().set_visible(true); + this.knob.setHeight(ht - (sht - ht)); + this.knob.set_y(Math.round(y * (ht - this.knob.getHeight()) / (sht - ht))); + } + ,setKnobPos: function(pos) { + var ht = this.list.getViewportHeight(); + var sht = this.list.getScrollHeight(); + if(ht >= sht) { + return; + } + var e = ht - this.knob.getHeight(); + if(pos < 0) { + pos = 0; + } + if(pos > e) { + pos = e; + } + this.knob.set_y(Math.round(pos)); + this.list.updateScroll(pos * (sht - ht) / e,false); + } + ,getWidth: function() { + return com_davidmaletz_controls_scroll_Scrollbar.getUI().getWidth(); + } + ,getHeight: function() { + return this.list.getViewportHeight(); + } + ,updateHeight: function() { + this.removeChildAt(0); + this.addChildAt(com_davidmaletz_controls_scroll_Scrollbar.getUI().createScrollbar(this.list.getViewportHeight()),0); + } + ,__class__: com_davidmaletz_controls_scroll_Scrollbar +}); +var com_davidmaletz_faengfl_DrawableFactory = function() { }; +$hxClasses["com.davidmaletz.faengfl.DrawableFactory"] = com_davidmaletz_faengfl_DrawableFactory; +com_davidmaletz_faengfl_DrawableFactory.__name__ = ["com","davidmaletz","faengfl","DrawableFactory"]; +com_davidmaletz_faengfl_DrawableFactory.prototype = { + create: null + ,__class__: com_davidmaletz_faengfl_DrawableFactory +}; +var com_davidmaletz_faengfl_AbstractDrawableFactory = function() { +}; +$hxClasses["com.davidmaletz.faengfl.AbstractDrawableFactory"] = com_davidmaletz_faengfl_AbstractDrawableFactory; +com_davidmaletz_faengfl_AbstractDrawableFactory.__name__ = ["com","davidmaletz","faengfl","AbstractDrawableFactory"]; +com_davidmaletz_faengfl_AbstractDrawableFactory.__interfaces__ = [AbstractClass,com_davidmaletz_faengfl_DrawableFactory]; +com_davidmaletz_faengfl_AbstractDrawableFactory.prototype = { + map: null + ,makeDrawable: function(w,h) { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,getHash: function(w,h) { + return Math.round(h) * 4096 + Math.round(w); + } + ,create: function(w,h) { + if(this.map == null) { + this.map = new haxe_ds_IntMap(); + } + var k = this.getHash(w,h); + var d = this.map.get(k); + if(d == null) { + d = this.makeDrawable(w,h); + this.map.set(k,d); + } + return d; + } + ,__class__: com_davidmaletz_faengfl_AbstractDrawableFactory +}; +var com_davidmaletz_faengfl_TileBitmap = function(bitmap,center) { + this.bitmap = bitmap; + this.sheet = new openfl_display_Tilesheet(bitmap); + this.center = center; +}; +$hxClasses["com.davidmaletz.faengfl.TileBitmap"] = com_davidmaletz_faengfl_TileBitmap; +com_davidmaletz_faengfl_TileBitmap.__name__ = ["com","davidmaletz","faengfl","TileBitmap"]; +com_davidmaletz_faengfl_TileBitmap.prototype = { + sheet: null + ,bitmap: null + ,center: null + ,getInnerBitmap: function() { + return this.bitmap; + } + ,addTileRect: function(r) { + return this.sheet.addTileRect(r,this.center); + } + ,getTileRect: function(idx) { + return this.sheet.getTileRect(idx); + } + ,__class__: com_davidmaletz_faengfl_TileBitmap +}; +var com_davidmaletz_faengfl_AutoTileBitmap = function(id,bitmap,tileWidth,tileHeight,center) { + this.frames = null; + this.id = id; + com_davidmaletz_faengfl_TileBitmap.call(this,bitmap,center); + this.tileWidth = tileWidth; + this.tileHeight = tileHeight; + this.tiles_width = 0; +}; +$hxClasses["com.davidmaletz.faengfl.AutoTileBitmap"] = com_davidmaletz_faengfl_AutoTileBitmap; +com_davidmaletz_faengfl_AutoTileBitmap.__name__ = ["com","davidmaletz","faengfl","AutoTileBitmap"]; +com_davidmaletz_faengfl_AutoTileBitmap.bitmaps = null; +com_davidmaletz_faengfl_AutoTileBitmap.sheets = null; +com_davidmaletz_faengfl_AutoTileBitmap.xmls = null; +com_davidmaletz_faengfl_AutoTileBitmap.reset = function() { + com_davidmaletz_faengfl_AutoTileBitmap.bitmaps = null; + com_davidmaletz_faengfl_AutoTileBitmap.sheets = null; + com_davidmaletz_faengfl_AutoTileBitmap.xmls = null; +}; +com_davidmaletz_faengfl_AutoTileBitmap.getXml = function(id) { + if(com_davidmaletz_faengfl_AutoTileBitmap.xmls == null) { + return null; + } else { + return com_davidmaletz_faengfl_AutoTileBitmap.xmls.get(id); + } +}; +com_davidmaletz_faengfl_AutoTileBitmap.get = function(id,tileWidth,tileHeight,center,xml) { + if(tileHeight == null) { + tileHeight = -1; + } + if(com_davidmaletz_faengfl_AutoTileBitmap.bitmaps == null) { + com_davidmaletz_faengfl_AutoTileBitmap.bitmaps = new haxe_ds_StringMap(); + } + var b = com_davidmaletz_faengfl_AutoTileBitmap.bitmaps.get(id); + if(b == null) { + var bmp; + if(xml != null && xml.exists("layers")) { + var l = com_davidmaletz_faengfl_LayerManager.create(xml.get("layers"),com_davidmaletz_faengfl_LayerManager.colorsFromXml(xml),com_davidmaletz_faengfl_LayerManager.offsetsFromXml(xml)); + bmp = l.bitmap; + tileWidth = l.width; + tileHeight = l.height; + } else { + if(xml != null && xml.exists("name")) { + if(com_davidmaletz_faengfl_AutoTileBitmap.xmls == null) { + com_davidmaletz_faengfl_AutoTileBitmap.xmls = new haxe_ds_StringMap(); + } + com_davidmaletz_faengfl_AutoTileBitmap.xmls.set(xml.get("name"),xml); + } + if(xml != null && xml.exists("sheet")) { + if(com_davidmaletz_faengfl_AutoTileBitmap.sheets == null) { + com_davidmaletz_faengfl_AutoTileBitmap.sheets = new haxe_ds_StringMap(); + } + var sheet = id.substring(0,id.lastIndexOf("/") + 1) + xml.get("sheet"); + bmp = com_davidmaletz_faengfl_AutoTileBitmap.sheets.get(sheet); + if(bmp == null) { + bmp = openfl_Assets.getBitmapData(sheet); + com_davidmaletz_faengfl_AutoTileBitmap.sheets.set(sheet,bmp); + } + } else { + bmp = openfl_Assets.getBitmapData(id); + } + if(tileWidth < 0) { + tileWidth = bmp.width; + tileHeight = bmp.height; + } else if(tileHeight < 0) { + tileHeight = tileWidth; + } + } + b = new com_davidmaletz_faengfl_AutoTileBitmap(id,bmp,tileWidth,tileHeight,center); + if(xml != null) { + var iter = xml.elementsNamed("image"); + var offX = xml.exists("offsetX") ? Std.parseInt(xml.get("offsetX")) : 0; + var offY = xml.exists("offsetY") ? Std.parseInt(xml.get("offsetY")) : 0; + var dx = xml.exists("dx") ? Std.parseInt(xml.get("dx")) : 0; + var dy = xml.exists("dy") ? Std.parseInt(xml.get("dy")) : 0; + if(iter.hasNext()) { + b.loadImages(iter,offX,offY,dx,dy); + } else { + b.loadGrid(); + } + } else { + b.loadGrid(); + } + com_davidmaletz_faengfl_AutoTileBitmap.bitmaps.set(id,b); + } + return b; +}; +com_davidmaletz_faengfl_AutoTileBitmap.fromLayers = function(l) { + var b = new com_davidmaletz_faengfl_AutoTileBitmap("",l.bitmap,l.width,l.height); + b.loadGrid(); + return b; +}; +com_davidmaletz_faengfl_AutoTileBitmap.__super__ = com_davidmaletz_faengfl_TileBitmap; +com_davidmaletz_faengfl_AutoTileBitmap.prototype = $extend(com_davidmaletz_faengfl_TileBitmap.prototype,{ + tileWidth: null + ,tileHeight: null + ,tiles_width: null + ,frames: null + ,id: null + ,render: function(getNeighbors,layer,x,y,offX,offY) { + this.addTile(layer.handler,offX,offY,Math.round(x * com_davidmaletz_tiles_Tile.SIZE),Math.round(y * com_davidmaletz_tiles_Tile.SIZE)); + } + ,getTileWidth: function(offX,offY) { + return this.tileWidth; + } + ,getTileHeight: function(offX,offY) { + return this.tileHeight; + } + ,loadGrid: function() { + var w = Math.floor(this.bitmap.width / this.tileWidth); + var h = Math.floor(this.bitmap.height / this.tileHeight); + var dx = this.bitmap.width - w * this.tileWidth; + var _g1 = 0; + var _g = h; + while(_g1 < _g) { + var y = _g1++; + var _g3 = 0; + var _g2 = w; + while(_g3 < _g2) { + var x = _g3++; + this.addTileRect(new openfl_geom_Rectangle(x * this.tileWidth,y * this.tileHeight,this.tileWidth,this.tileHeight)); + } + if(dx > 0) { + this.addTileRect(new openfl_geom_Rectangle(this.bitmap.width - dx,y * this.tileHeight,dx,this.tileHeight)); + } + } + var dy = this.bitmap.height - h * this.tileHeight; + if(dy > 0) { + var _g11 = 0; + var _g4 = w; + while(_g11 < _g4) { + var x1 = _g11++; + this.addTileRect(new openfl_geom_Rectangle(x1 * this.tileWidth,this.bitmap.height - dy,this.tileWidth,dy)); + } + } + this.tiles_width = Math.ceil(this.bitmap.width / this.tileWidth); + } + ,loadImages: function(iter,offsetX,offsetY,dx,dy) { + this.frames = []; + var i = 0; + var e = iter; + while(e.hasNext()) { + var e1 = e.next(); + var offX = offsetX + (e1.exists("offsetX") ? Std.parseInt(e1.get("offsetX")) : 0); + var offY = offsetY + (e1.exists("offsetY") ? Std.parseInt(e1.get("offsetY")) : 0); + if(e1.exists("equals")) { + this.frames[Std.parseInt(e1.get("frame"))] = new com_davidmaletz_faengfl__$AutoTileBitmap_TileFrame(this.frames[Std.parseInt(e1.get("equals"))].id,offX,offY); + } else { + var x = e1.exists("x") ? Std.parseInt(e1.get("x")) : 0; + var y = e1.exists("y") ? Std.parseInt(e1.get("y")) : 0; + var w = e1.exists("width") ? Std.parseInt(e1.get("width")) : this.tileWidth; + var h = e1.exists("height") ? Std.parseInt(e1.get("height")) : this.tileHeight; + this.frames[Std.parseInt(e1.get("frame"))] = new com_davidmaletz_faengfl__$AutoTileBitmap_TileFrame(i,offX,offY); + this.addTileRect(new openfl_geom_Rectangle(x + dx,y + dy,w,h)); + ++i; + } + } + } + ,addTile: function(handler,tile_x,tile_y,offsetX,offsetY,alpha,a,b,c,d) { + if(d == null) { + d = 1; + } + if(c == null) { + c = 0; + } + if(b == null) { + b = 0; + } + if(a == null) { + a = 1; + } + if(alpha == null) { + alpha = 1; + } + if(this.tiles_width > 0 && tile_x >= this.tiles_width) { + var ct = Math.floor(tile_x / this.tiles_width); + tile_x -= ct * this.tiles_width; + tile_y += ct; + } + var f = this.getFrame(tile_x,tile_y); + var idx; + if(f == null) { + idx = this.getIdx(tile_x,tile_y); + } else { + idx = f.id; + offsetX += f.offsetX; + offsetY += f.offsetY; + } + handler.addTile(this.sheet,offsetX,offsetY,idx,alpha,a,b,c,d); + } + ,getTileRect2: function(tile_x,tile_y) { + var f = this.getFrame(tile_x,tile_y); + return this.getTileRect(f == null ? this.getIdx(tile_x,tile_y) : f.id); + } + ,getIdx: function(x,y) { + return y * this.tiles_width + x; + } + ,getFrame: function(x,y) { + if(this.frames == null) { + return null; + } else { + return this.frames[x]; + } + } + ,__class__: com_davidmaletz_faengfl_AutoTileBitmap +}); +var com_davidmaletz_faengfl__$AutoTileBitmap_TileFrame = function(id,x,y) { + this.id = id; + this.offsetX = x; + this.offsetY = y; +}; +$hxClasses["com.davidmaletz.faengfl._AutoTileBitmap.TileFrame"] = com_davidmaletz_faengfl__$AutoTileBitmap_TileFrame; +com_davidmaletz_faengfl__$AutoTileBitmap_TileFrame.__name__ = ["com","davidmaletz","faengfl","_AutoTileBitmap","TileFrame"]; +com_davidmaletz_faengfl__$AutoTileBitmap_TileFrame.prototype = { + id: null + ,offsetX: null + ,offsetY: null + ,__class__: com_davidmaletz_faengfl__$AutoTileBitmap_TileFrame +}; +var com_davidmaletz_faengfl_Drawable = function() { }; +$hxClasses["com.davidmaletz.faengfl.Drawable"] = com_davidmaletz_faengfl_Drawable; +com_davidmaletz_faengfl_Drawable.__name__ = ["com","davidmaletz","faengfl","Drawable"]; +com_davidmaletz_faengfl_Drawable.prototype = { + getWidth: null + ,getHeight: null + ,create: null + ,__class__: com_davidmaletz_faengfl_Drawable +}; +var com_davidmaletz_faengfl_BitmapDrawable = function(b,s) { + if(s == null) { + s = 1; + } + this.bmp = b; + this._width = this.bmp.width; + this._height = this.bmp.height; + this.scale = s; +}; +$hxClasses["com.davidmaletz.faengfl.BitmapDrawable"] = com_davidmaletz_faengfl_BitmapDrawable; +com_davidmaletz_faengfl_BitmapDrawable.__name__ = ["com","davidmaletz","faengfl","BitmapDrawable"]; +com_davidmaletz_faengfl_BitmapDrawable.__interfaces__ = [com_davidmaletz_faengfl_Drawable]; +com_davidmaletz_faengfl_BitmapDrawable.prototype = { + bmp: null + ,_width: null + ,_height: null + ,scale: null + ,getWidth: function() { + return this._width * this.scale; + } + ,getHeight: function() { + return this._height * this.scale; + } + ,create: function(tx,ty) { + var b = new openfl_display_Bitmap(this.bmp,1,com_davidmaletz_faengfl_TextSprite.SMOOTH); + b.set_x(tx); + b.set_y(ty); + b.set_scaleX(b.set_scaleY(this.scale)); + return b; + } + ,__class__: com_davidmaletz_faengfl_BitmapDrawable +}; +var com_davidmaletz_faengfl_Button = function(press,release,b,key,controller_key) { + if(controller_key == null) { + controller_key = -1; + } + if(key == null) { + key = -1; + } + this.touch = -1; + com_davidmaletz_lerp_LerpSprite.call(this); + this.onPress = press; + this.onRelease = release; + this.key = key; + this.controllerButton = controller_key; + if(b != null) { + this._width = b.getWidth(); + this._height = b.getHeight(); + var s = b.create(0,0); + if(s != null) { + this.addChild(s); + } + } +}; +$hxClasses["com.davidmaletz.faengfl.Button"] = com_davidmaletz_faengfl_Button; +com_davidmaletz_faengfl_Button.__name__ = ["com","davidmaletz","faengfl","Button"]; +com_davidmaletz_faengfl_Button.point = null; +com_davidmaletz_faengfl_Button.__super__ = com_davidmaletz_lerp_LerpSprite; +com_davidmaletz_faengfl_Button.prototype = $extend(com_davidmaletz_lerp_LerpSprite.prototype,{ + _width: null + ,_height: null + ,key: null + ,controllerButton: null + ,onPress: null + ,onRelease: null + ,getWindowCt: function() { + return com_davidmaletz_faengfl_Window.window_ct; + } + ,init: function(e) { + com_davidmaletz_lerp_LerpSprite.prototype.init.call(this,e); + com_davidmaletz_faengfl_TouchAdapter.instance.addEventListener("touch_down",$bind(this,this.mouse_down),false,this.getWindowCt() + 1); + com_davidmaletz_faengfl_TouchAdapter.instance.addEventListener("touch_up",$bind(this,this.mouse_up),false,this.getWindowCt() + 1); + if(this.key >= 0) { + openfl_Lib.current.stage.addEventListener("keyDown",$bind(this,this.key_down)); + openfl_Lib.current.stage.addEventListener("keyUp",$bind(this,this.key_up)); + } + if(this.controllerButton != -1) { + com_davidmaletz_faengfl_controls_Gamepad.instance.addEventListener("button_down",$bind(this,this.button_down)); + com_davidmaletz_faengfl_controls_Gamepad.instance.addEventListener("button_up",$bind(this,this.button_up)); + } + } + ,destroy: function(e) { + com_davidmaletz_lerp_LerpSprite.prototype.destroy.call(this,e); + com_davidmaletz_faengfl_TouchAdapter.instance.removeEventListener("touch_down",$bind(this,this.mouse_down)); + com_davidmaletz_faengfl_TouchAdapter.instance.removeEventListener("touch_up",$bind(this,this.mouse_up)); + if(this.key >= 0) { + openfl_Lib.current.stage.removeEventListener("keyDown",$bind(this,this.key_down)); + openfl_Lib.current.stage.removeEventListener("keyUp",$bind(this,this.key_up)); + } + if(this.controllerButton != -1) { + com_davidmaletz_faengfl_controls_Gamepad.instance.removeEventListener("button_down",$bind(this,this.button_down)); + com_davidmaletz_faengfl_controls_Gamepad.instance.removeEventListener("button_up",$bind(this,this.button_up)); + } + } + ,touch: null + ,inBounds: function(e) { + if(!this.get_visible()) { + return false; + } + if(com_davidmaletz_faengfl_Button.point == null) { + com_davidmaletz_faengfl_Button.point = new openfl_geom_Point(e.stageX,e.stageY); + } else { + com_davidmaletz_faengfl_Button.point.setTo(e.stageX,e.stageY); + } + var p = this.globalToLocal(com_davidmaletz_faengfl_Button.point); + if(p.x >= 0 && p.y >= 0 && p.x < this._width) { + return p.y < this._height; + } else { + return false; + } + } + ,mouse_down: function(e) { + if(this.inBounds(e)) { + this.touch = e.id; + if(this.onPress != null) { + this.onPress(); + } + e.stopImmediatePropagation(); + } + } + ,action: function() { + if(this.get_visible()) { + if(com_davidmaletz_faengfl_Button.globalOnRelease != null) { + com_davidmaletz_faengfl_Button.globalOnRelease(); + } + if(this.onRelease != null) { + this.onRelease(); + } + } + } + ,mouse_up: function(e) { + if(e.id == this.touch) { + this.touch = -1; + this.action(); + e.stopImmediatePropagation(); + } + } + ,key_down: function(e) { + if(e.keyCode == this.key && this.onPress != null) { + this.onPress(); + } + } + ,key_up: function(e) { + if(e.keyCode == this.key) { + this.action(); + } + } + ,button_down: function(e) { + if(e.button == this.controllerButton && this.onPress != null) { + this.onPress(); + } + } + ,button_up: function(e) { + if(e.button == this.controllerButton) { + this.action(); + } + } + ,__class__: com_davidmaletz_faengfl_Button +}); +var com_davidmaletz_faengfl_ButtonFactory = function() { }; +$hxClasses["com.davidmaletz.faengfl.ButtonFactory"] = com_davidmaletz_faengfl_ButtonFactory; +com_davidmaletz_faengfl_ButtonFactory.__name__ = ["com","davidmaletz","faengfl","ButtonFactory"]; +com_davidmaletz_faengfl_ButtonFactory.prototype = { + defaultHeight: null + ,createBG: null + ,createHover: null + ,__class__: com_davidmaletz_faengfl_ButtonFactory +}; +var com_davidmaletz_faengfl_CompoundDrawable = function() { + this.drawables = []; + this.points = []; + this.width = 0; + this.height = 0; +}; +$hxClasses["com.davidmaletz.faengfl.CompoundDrawable"] = com_davidmaletz_faengfl_CompoundDrawable; +com_davidmaletz_faengfl_CompoundDrawable.__name__ = ["com","davidmaletz","faengfl","CompoundDrawable"]; +com_davidmaletz_faengfl_CompoundDrawable.__interfaces__ = [com_davidmaletz_faengfl_Drawable]; +com_davidmaletz_faengfl_CompoundDrawable.prototype = { + drawables: null + ,points: null + ,width: null + ,height: null + ,add: function(d,x,y) { + this.drawables.push(d); + this.points.push(new openfl_geom_Point(x,y)); + var w = d.getWidth() + x; + var h = d.getHeight() + y; + if(w > this.width) { + this.width = w; + } + if(h > this.height) { + this.height = h; + } + } + ,getWidth: function() { + return this.width; + } + ,getHeight: function() { + return this.height; + } + ,create: function(tx,ty) { + var s = new openfl_display_Sprite(); + var len = this.drawables.length; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + var p = this.points[i]; + s.addChild(this.drawables[i].create(p.x,p.y)); + } + s.set_x(tx); + s.set_y(ty); + return s; + } + ,__class__: com_davidmaletz_faengfl_CompoundDrawable +}; +var com_davidmaletz_faengfl_Container = function() { }; +$hxClasses["com.davidmaletz.faengfl.Container"] = com_davidmaletz_faengfl_Container; +com_davidmaletz_faengfl_Container.__name__ = ["com","davidmaletz","faengfl","Container"]; +com_davidmaletz_faengfl_Container.prototype = { + getWidth: null + ,getHeight: null + ,addDisplay: null + ,globalToLocal: null + ,__class__: com_davidmaletz_faengfl_Container +}; +var com_davidmaletz_faengfl_ContainerSprite = function(w,h) { + openfl_display_Sprite.call(this); + this._width = w; + this._height = h; +}; +$hxClasses["com.davidmaletz.faengfl.ContainerSprite"] = com_davidmaletz_faengfl_ContainerSprite; +com_davidmaletz_faengfl_ContainerSprite.__name__ = ["com","davidmaletz","faengfl","ContainerSprite"]; +com_davidmaletz_faengfl_ContainerSprite.__interfaces__ = [com_davidmaletz_faengfl_Container]; +com_davidmaletz_faengfl_ContainerSprite.__super__ = openfl_display_Sprite; +com_davidmaletz_faengfl_ContainerSprite.prototype = $extend(openfl_display_Sprite.prototype,{ + _width: null + ,_height: null + ,getWidth: function() { + return this._width; + } + ,getHeight: function() { + return this._height; + } + ,addDisplay: function(d,layer,addFirst) { + if(addFirst == null) { + addFirst = false; + } + var i = this.get_numChildren(); + while(i <= layer) { + this.addChild(new openfl_display_Sprite()); + ++i; + } + var s = js_Boot.__cast(this.getChildAt(layer) , openfl_display_Sprite); + if(addFirst) { + s.addChildAt(d,0); + } else { + s.addChild(d); + } + } + ,__class__: com_davidmaletz_faengfl_ContainerSprite +}); +var com_davidmaletz_faengfl_DefaultButtonFactory = function(bg,hover) { + this.bg = bg; + this.hover = hover; +}; +$hxClasses["com.davidmaletz.faengfl.DefaultButtonFactory"] = com_davidmaletz_faengfl_DefaultButtonFactory; +com_davidmaletz_faengfl_DefaultButtonFactory.__name__ = ["com","davidmaletz","faengfl","DefaultButtonFactory"]; +com_davidmaletz_faengfl_DefaultButtonFactory.__interfaces__ = [com_davidmaletz_faengfl_ButtonFactory]; +com_davidmaletz_faengfl_DefaultButtonFactory.prototype = { + bg: null + ,hover: null + ,createBG: function(w,h) { + return this.bg.create(w,h < 0 ? this.defaultHeight() : h); + } + ,createHover: function(w,h) { + return this.hover.create(w,h < 0 ? this.defaultHeight() : h); + } + ,defaultHeight: function() { + return com_fancyfish_faeng_text_FontManager.lineHeight() + 4; + } + ,__class__: com_davidmaletz_faengfl_DefaultButtonFactory +}; +var com_davidmaletz_faengfl_DeveloperConsole = function() { + this.cur_item = 0; + this.selectable_items = []; + this.canClose = true; + this.watch = []; + var r = new com_davidmaletz_faengfl__$DeveloperConsole_ConsoleRenderer(); + com_davidmaletz_controls_scroll_ScrollWindow.call(this,null,new com_davidmaletz_faengfl_SolidDrawableFactory(0,0,0,0.75),r,10,1,0,0,true,false,false,false); + if(com_davidmaletz_faengfl_DeveloperConsole.items != null) { + var _g = 0; + var _g1 = com_davidmaletz_faengfl_DeveloperConsole.items; + while(_g < _g1.length) { + var i = _g1[_g]; + ++_g; + this.addItem(i); + } + com_davidmaletz_faengfl_DeveloperConsole.items = null; + } + var tf = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Static(">"),new com_fancyfish_faeng_text_CharacterPlacer(0),16777215,1,com_davidmaletz_faengfl_DeveloperConsole.font); + this.bottom = new openfl_display_Sprite(); + this.bottom.set_y(com_davidmaletz_controls_scroll_ScrollWindow.prototype.getHeight.call(this)); + tf.set_x(4); + tf.set_y(-4); + this.bottom.addChild(tf); + this.text = new com_davidmaletz_faengfl__$DeveloperConsole_MyTextField(Math.round(r.getWidth() - com_davidmaletz_faengfl_DeveloperConsole.TXT_HT),$bind(this,this.onUp)); + this.text.addEventListener("action",$bind(this,this.confirm)); + this.text.set_x(tf.get_x() + com_davidmaletz_faengfl_DeveloperConsole.TXT_HT); + this.text.set_y(tf.get_y()); + this.bottom.addChild(this.text); + this.vars = com_davidmaletz_faengfl_EventHandler.createVariables(); + this.updateVars(); + this.addChild(this.bottom); + var f = com_davidmaletz_faengfl_Application.button_factory; + if(f != null) { + var w = 6 * com_fancyfish_faeng_text_FontManager.lineHeight(); + var copy = new com_davidmaletz_controls_Button(this.getWidth(),this.getHeight() - this.bottom.get_y() + 2,f.createBG(w,-1),f.createHover(w,-1),new com_fancyfish_faeng_common_mutable_Static("Copy Log"),0,1); + copy.onClickFunc = $bind(this,this.copyText); + this.bottom.addChild(copy); + this.clickables.addClickable(copy,this.bottom); + copy.set_x(0); + copy.getPos().x = 0; + } + var h = openfl_Lib.current.stage.stageHeight * 10 / com_davidmaletz_faengfl_DeveloperConsole.TXT_HT; + h *= 1.51; + if(h >= 864) { + this.set_scaleX(this.set_scaleY(2)); + this.setHeight(30 * com_davidmaletz_faengfl_DeveloperConsole.TXT_HT); + } else if(h >= 576) { + this.setHeight(20 * com_davidmaletz_faengfl_DeveloperConsole.TXT_HT); + } else { + this.setHeight(10 * com_davidmaletz_faengfl_DeveloperConsole.TXT_HT); + } +}; +$hxClasses["com.davidmaletz.faengfl.DeveloperConsole"] = com_davidmaletz_faengfl_DeveloperConsole; +com_davidmaletz_faengfl_DeveloperConsole.__name__ = ["com","davidmaletz","faengfl","DeveloperConsole"]; +com_davidmaletz_faengfl_DeveloperConsole.TXT_HT = null; +com_davidmaletz_faengfl_DeveloperConsole.font = null; +com_davidmaletz_faengfl_DeveloperConsole.handleAction = null; +com_davidmaletz_faengfl_DeveloperConsole.hide = function() { + if(com_davidmaletz_faengfl_DeveloperConsole.instance != null) { + com_davidmaletz_faengfl_DeveloperConsole.instance.doClose(); + } +}; +com_davidmaletz_faengfl_DeveloperConsole.reset = function() { + if(com_davidmaletz_faengfl_DeveloperConsole.instance != null) { + com_davidmaletz_faengfl_DeveloperConsole.instance.vars = com_davidmaletz_faengfl_EventHandler.createVariables(); + com_davidmaletz_faengfl_DeveloperConsole.instance.updateVars(); + } +}; +com_davidmaletz_faengfl_DeveloperConsole.utfsafe = function(s) { + var r = new EReg("[\\x7f-\\xff]","g"); + return r.replace(s,""); +}; +com_davidmaletz_faengfl_DeveloperConsole.toggle = function() { + if(com_davidmaletz_faengfl_DeveloperConsole.instance == null) { + com_davidmaletz_faengfl_DeveloperConsole.instance = new com_davidmaletz_faengfl_DeveloperConsole(); + } + com_davidmaletz_faengfl_DeveloperConsole.resize(null); + com_davidmaletz_faengfl_DeveloperConsole.instance._toggle(); +}; +com_davidmaletz_faengfl_DeveloperConsole.clear = function() { + com_davidmaletz_faengfl_DeveloperConsole.items = null; + if(com_davidmaletz_faengfl_DeveloperConsole.instance != null) { + com_davidmaletz_faengfl_DeveloperConsole.instance.list.clear(); + } +}; +com_davidmaletz_faengfl_DeveloperConsole.oldTrace = null; +com_davidmaletz_faengfl_DeveloperConsole.items = null; +com_davidmaletz_faengfl_DeveloperConsole.instance = null; +com_davidmaletz_faengfl_DeveloperConsole.defaultAction = function(t,vars,item) { + var v = com_davidmaletz_faengfl_EventHandler._execute(t,vars); + com_davidmaletz_faengfl_DeveloperConsole.showResult(item,v); + return null; +}; +com_davidmaletz_faengfl_DeveloperConsole.showResult = function(item,v) { + item.secondColor = 11184810; + item.add(com_davidmaletz_faengfl_DeveloperConsole.utfsafe(com_davidmaletz_faengfl_DeveloperConsole.string(v))); +}; +com_davidmaletz_faengfl_DeveloperConsole.startDate = null; +com_davidmaletz_faengfl_DeveloperConsole.begin = function(fnt,action) { + com_davidmaletz_faengfl_DeveloperConsole.startDate = new Date(); + if(action == null) { + com_davidmaletz_faengfl_DeveloperConsole.handleAction = com_davidmaletz_faengfl_DeveloperConsole.defaultAction; + } else { + com_davidmaletz_faengfl_DeveloperConsole.handleAction = action; + } + com_davidmaletz_faengfl_DeveloperConsole.oldTrace = haxe_Log.trace; + haxe_Log.trace = com_davidmaletz_faengfl_DeveloperConsole._trace; + openfl_events_EventDispatcher.criticalError = com_davidmaletz_faengfl_DeveloperConsole.onError; + com_davidmaletz_faengfl_DeveloperConsole.font = new com_fancyfish_faeng_common_mutable_Static(fnt); + com_davidmaletz_faengfl_DeveloperConsole.TXT_HT = Math.ceil(fnt.lineHeight); + openfl_Lib.current.stage.addEventListener("resize",com_davidmaletz_faengfl_DeveloperConsole.resize); +}; +com_davidmaletz_faengfl_DeveloperConsole.resize = function(e) { + if(com_davidmaletz_faengfl_DeveloperConsole.instance != null) { + var scroll = com_davidmaletz_faengfl_DeveloperConsole.instance.list.scrollbar; + scroll.set_x(openfl_Lib.current.stage.stageWidth / com_davidmaletz_faengfl_DeveloperConsole.instance.get_scaleX() - scroll.getWidth() - 4); + if(e != null) { + com_davidmaletz_faengfl_DeveloperConsole.instance.resetHeight(); + } + } +}; +com_davidmaletz_faengfl_DeveloperConsole.sendReport = function(e) { + var b = new StringBuf(); + var config = openfl_Lib.application.config; + b.add("--------------------------------------\n"); + b.add("Filename: " + config.file + "\n"); + b.add("Package: " + config.packageName + "\n"); + b.add("Version: " + config.version + "\n"); + var osName = "HTML5"; + b.add("OS: " + osName + "\n"); + b.add("URL: " + js_Browser.get_window().location.href + "\n"); + b.add("Browser: " + js_Browser.get_window().navigator.userAgent + "\n"); + b.add("Started: " + HxOverrides.dateStr(com_davidmaletz_faengfl_DeveloperConsole.startDate) + "\n"); + b.add("Crashed: " + HxOverrides.dateStr(new Date()) + "\n"); + b.add("--------------------------------------\n"); + b.add("Error: " + com_davidmaletz_faengfl_DeveloperConsole.utfsafe(com_davidmaletz_faengfl_DeveloperConsole.string(e)) + "\n"); + b.add("Log:"); + if(com_davidmaletz_faengfl_DeveloperConsole.instance == null) { + if(com_davidmaletz_faengfl_DeveloperConsole.items != null) { + var _g = 0; + var _g1 = com_davidmaletz_faengfl_DeveloperConsole.items; + while(_g < _g1.length) { + var item = _g1[_g]; + ++_g; + var len = item.getLineCount(); + var _g3 = 0; + var _g2 = len; + while(_g3 < _g2) { + var i = _g3++; + b.add("\n"); + b.add(item.lines[i]); + } + } + } + } else { + com_davidmaletz_faengfl_DeveloperConsole.instance.addConsoleText(b); + } + haxe_Log.trace("Sending report...",{ fileName : "DeveloperConsole.hx", lineNumber : 199, className : "com.davidmaletz.faengfl.DeveloperConsole", methodName : "sendReport"}); + var req = new haxe_Http("http://fancyfishgames.com/bug_report.php"); + req.onData = function(s) { + haxe_Log.trace("Report sent!",{ fileName : "DeveloperConsole.hx", lineNumber : 201, className : "com.davidmaletz.faengfl.DeveloperConsole", methodName : "sendReport"}); + }; + req.onError = function(s1) { + haxe_Log.trace("Failed to send: " + s1,{ fileName : "DeveloperConsole.hx", lineNumber : 202, className : "com.davidmaletz.faengfl.DeveloperConsole", methodName : "sendReport"}); + }; + req.setPostData(b.toString()); + com_fancyfish_faeng_common_HttpAsync.send(req,true); +}; +com_davidmaletz_faengfl_DeveloperConsole.show = function() { + if(com_davidmaletz_faengfl_DeveloperConsole.instance == null) { + com_davidmaletz_faengfl_DeveloperConsole.instance = new com_davidmaletz_faengfl_DeveloperConsole(); + } + com_davidmaletz_faengfl_DeveloperConsole.resize(null); + com_davidmaletz_faengfl_DeveloperConsole.instance.set_y(0); + com_davidmaletz_faengfl_Application.instance.addChild(com_davidmaletz_faengfl_DeveloperConsole.instance); + com_davidmaletz_faengfl_DeveloperConsole.instance.clearLerp(); +}; +com_davidmaletz_faengfl_DeveloperConsole.onError = function(e) { + com_fancyfish_faeng_common_Utils.printExceptionTrace(e); + try { + openfl_Lib.current.stage.__eventMap.remove("enterFrame"); + openfl_Lib.current.stage.__newEventMap.remove("enterFrame"); + com_davidmaletz_faengfl_FaengFL.removeAllChildren(com_davidmaletz_faengfl_Application.instance.container); + com_davidmaletz_controls_Controller.instance.resetListeners(); + com_davidmaletz_faengfl_TouchAdapter.instance.addMouseListeners(); + } catch( e1 ) { + haxe_CallStack.lastException = e1; + } + com_davidmaletz_faengfl_DeveloperConsole.show(); + com_davidmaletz_faengfl_DeveloperConsole.instance.canClose = false; + if(com_davidmaletz_faengfl_DeveloperConsole.promptSendReport != null) { + var e2 = e; + var tmp = function() { + com_davidmaletz_faengfl_DeveloperConsole.sendReport(e2); + }; + com_davidmaletz_faengfl_DeveloperConsole.promptSendReport(tmp); + } +}; +com_davidmaletz_faengfl_DeveloperConsole.string = function(v) { + if(v == null) { + return Std.string(v); + } + var c = Type.getClass(v); + if(c == null) { + return Std.string(v); + } + var s = Type.getClassName(c); + if(s == null) { + return Std.string(v); + } + var i = s.lastIndexOf("."); + if(i == -1) { + return Std.string(v); + } else { + return "[" + s.substring(i + 1) + "]"; + } +}; +com_davidmaletz_faengfl_DeveloperConsole.makeItem = function(v,infos) { + var s = com_davidmaletz_faengfl_DeveloperConsole.utfsafe(com_davidmaletz_faengfl_DeveloperConsole.string(v)); + if(infos != null && infos.fileName == "Utils.hx") { + return new com_davidmaletz_faengfl_LogItem(s,16711680); + } else { + return new com_davidmaletz_faengfl_LogItem(infos == null ? s : infos.fileName + ":" + infos.lineNumber + ": " + s,16776960); + } +}; +com_davidmaletz_faengfl_DeveloperConsole.log = function(v,col) { + if(col == null) { + col = 16777215; + } + var i = new com_davidmaletz_faengfl_LogItem(com_davidmaletz_faengfl_DeveloperConsole.utfsafe(com_davidmaletz_faengfl_DeveloperConsole.string(v)),col); + if(com_davidmaletz_faengfl_DeveloperConsole.instance == null) { + if(com_davidmaletz_faengfl_DeveloperConsole.items == null) { + com_davidmaletz_faengfl_DeveloperConsole.items = [i]; + } else { + com_davidmaletz_faengfl_DeveloperConsole.items.push(i); + } + } else { + com_davidmaletz_faengfl_DeveloperConsole.instance.addItem(i); + } +}; +com_davidmaletz_faengfl_DeveloperConsole._trace = function(v,infos) { + haxe_Log.trace = com_davidmaletz_faengfl_DeveloperConsole.oldTrace; + if(com_davidmaletz_faengfl_DeveloperConsole.instance == null) { + if(com_davidmaletz_faengfl_DeveloperConsole.items == null) { + com_davidmaletz_faengfl_DeveloperConsole.items = [com_davidmaletz_faengfl_DeveloperConsole.makeItem(v,infos)]; + } else { + com_davidmaletz_faengfl_DeveloperConsole.items.push(com_davidmaletz_faengfl_DeveloperConsole.makeItem(v,infos)); + } + } else { + com_davidmaletz_faengfl_DeveloperConsole.instance.addItem(com_davidmaletz_faengfl_DeveloperConsole.makeItem(v,infos)); + } + com_davidmaletz_faengfl_DeveloperConsole.oldTrace(v,infos); + haxe_Log.trace = com_davidmaletz_faengfl_DeveloperConsole._trace; +}; +com_davidmaletz_faengfl_DeveloperConsole.__super__ = com_davidmaletz_controls_scroll_ScrollWindow; +com_davidmaletz_faengfl_DeveloperConsole.prototype = $extend(com_davidmaletz_controls_scroll_ScrollWindow.prototype,{ + text: null + ,vars: null + ,watch: null + ,canClose: null + ,bottom: null + ,_height: null + ,updateVars: function() { + this.vars.set("exists",$bind(this,this.exists)); + this.vars.set("getVars",$bind(this,this.getVars)); + } + ,exists: function(id) { + return this.vars.exists(id); + } + ,getVars: function() { + return this.vars; + } + ,makeDrawable: function(factory) { + return factory.create(this.getWidth(),1); + } + ,setHeight: function(ht) { + var e = Math.round(openfl_Lib.current.stage.stageHeight - this.get_scaleY() * 30); + var ht1 = com_fancyfish_faeng_common_Utils.clampi(ht,com_fancyfish_faeng_common_Utils.min(e,Math.round(50 * this.get_scaleY())),e); + if(this._height != ht1) { + this._height = ht1; + this.list.setHeight(this._height / this.get_scaleY()); + this.getChildAt(0).set_scaleY(this.getHeight()); + this.bottom.set_y(com_davidmaletz_controls_scroll_ScrollWindow.prototype.getHeight.call(this)); + com_davidmaletz_faengfl_DeveloperConsole.resize(null); + } + } + ,resetHeight: function() { + var ht = this._height; + this._height = -1; + this.setHeight(ht); + } + ,copyText: function() { + try { + var b = new StringBuf(); + this.addConsoleText(b); + var txt = b.toString(); + var elem = js_Browser.get_document().createElement("textarea"); + elem.innerHTML = txt; + js_Browser.get_document().body.appendChild(elem); + elem.select(); + if(!js_Browser.get_document().execCommand("Copy")) { + throw new js__$Boot_HaxeError(0); + } + js_Browser.get_document().body.removeChild(elem); + com_davidmaletz_faengfl_Application.instance.addChild(new com_davidmaletz_faengfl_ui_Popup(5,this.getHeight() + 3,0,new com_fancyfish_faeng_common_mutable_Static("Log Copied to Clipboard"),16777215,-16777216,30,60,30,null,false,false,0)); + } catch( e ) { + haxe_CallStack.lastException = e; + } + } + ,addConsoleText: function(b) { + var list = com_davidmaletz_faengfl_DeveloperConsole.instance.list.list; + var len = list.get_numChildren(); + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + var c = js_Boot.__cast(list.getChildAt(i) , openfl_display_Sprite); + var l = c.get_numChildren(); + var _g3 = 0; + var _g2 = l; + while(_g3 < _g2) { + var j = _g3++; + var t = c.getChildAt(j); + if(Std["is"](t,com_davidmaletz_faengfl_TextSprite)) { + b.add("\n"); + b.add((js_Boot.__cast(t , com_davidmaletz_faengfl_TextSprite)).getText().get()); + } + } + } + } + ,debug_info: null + ,debugInfo: function(d) { + if(d) { + if(this.debug_info == null) { + this.debug_info = new com_davidmaletz_faengfl__$DeveloperConsole_DebugInfo(this.watch,this); + } + com_davidmaletz_faengfl_Application.instance.addChild(this.debug_info); + } else if(this.debug_info != null) { + com_davidmaletz_faengfl_FaengFL.remove(this.debug_info); + } + } + ,getHeight: function() { + return com_davidmaletz_controls_scroll_ScrollWindow.prototype.getHeight.call(this) + com_davidmaletz_faengfl_DeveloperConsole.TXT_HT - 3; + } + ,onOpened: function() { + this.text.setText(""); + com_davidmaletz_faengfl_Application.setFocus(this.text); + } + ,confirm: function(e) { + if(this.stage == null) { + return; + } + var t = this.text.getText(); + var item = new com_davidmaletz_faengfl_LogItem(t,16777215); + this.text.setText(""); + if(item.getLineCount() == 0) { + return; + } + try { + if(t == "clear") { + if(this.canClose) { + com_davidmaletz_faengfl_DeveloperConsole.clear(); + } + } else if(t == "totalMemory") { + com_davidmaletz_faengfl_DeveloperConsole.showResult(item,openfl_system_System.get_totalMemory()); + } else if(StringTools.startsWith(t,"debug")) { + this.debugInfo(t.substring(6) != "hide"); + } else if(StringTools.startsWith(t,"watch")) { + var w = t.substring(6); + if(w.length > 0 && this.watch.indexOf(w) == -1) { + this.watch.push(w); + } + this.debugInfo(true); + } else if(StringTools.startsWith(t,"unwatch")) { + var w1 = t.substring(8); + if(w1 == "all") { + com_fancyfish_faeng_common_Utils.clear(this.watch); + } else { + HxOverrides.remove(this.watch,w1); + } + } else if(StringTools.startsWith(t,"size")) { + var _g = t.substring(5); + switch(_g) { + case "large": + this.set_scaleX(this.set_scaleY(4)); + this.resetHeight(); + break; + case "medium": + this.set_scaleX(this.set_scaleY(3)); + this.resetHeight(); + break; + case "small": + this.set_scaleX(this.set_scaleY(2)); + this.resetHeight(); + break; + case "tiny": + this.set_scaleX(this.set_scaleY(1)); + this.resetHeight(); + break; + case "xlarge": + this.set_scaleX(this.set_scaleY(6)); + this.resetHeight(); + break; + } + } else if(StringTools.startsWith(t,"height")) { + this.setHeight(Std.parseInt(t.substring(7))); + } else { + var func = com_davidmaletz_faengfl_DeveloperConsole.handleAction(t,this.vars,item); + if(func != null && this.canClose) { + this.onClose = func; + this.lerp(new com_davidmaletz_lerp_PositionKeyframe(0,-this.getHeight()),10,$bind(this,this.doClose)); + } + } + } catch( e1 ) { + haxe_CallStack.lastException = e1; + if (e1 instanceof js__$Boot_HaxeError) e1 = e1.val; + item.secondColor = 16711680; + item.add(com_davidmaletz_faengfl_DeveloperConsole.utfsafe(com_davidmaletz_faengfl_DeveloperConsole.string(e1))); + } + this.addItem(item); + this.selectable_items.push(t); + this.cur_item = this.selectable_items.length; + } + ,selectable_items: null + ,cur_item: null + ,onUp: function(up) { + if(up) { + this.cur_item--; + } else { + this.cur_item++; + } + if(this.cur_item >= 0 && this.cur_item < this.selectable_items.length) { + this.text.setText(this.selectable_items[this.cur_item]); + } else if(up) { + this.cur_item = 0; + } else { + this.cur_item = this.selectable_items.length; + this.text.setText(""); + } + } + ,onCancel: function() { + if(this.stage != null) { + this._toggle(); + } + } + ,_toggle: function() { + if(this.stage != null && this.hasLerp() && this.get_y() > -this.getHeight()) { + return; + } + if(this.stage == null) { + com_davidmaletz_faengfl_Application.instance.addChild(this); + this.set_y(-this.getHeight()); + this.lerp(new com_davidmaletz_lerp_PositionKeyframe(0,0),10,$bind(this,this.onOpened)); + } else if(this.canClose) { + var d = this; + var tmp = function() { + com_davidmaletz_faengfl_FaengFL.remove(d); + }; + this.lerp(new com_davidmaletz_lerp_PositionKeyframe(0,-this.getHeight()),10,tmp); + } + } + ,addItem: function(i) { + var s = com_davidmaletz_controls_scroll_ScrollWindow.prototype.addItem.call(this,i); + this.list.updateScroll(this.list.getScrollHeight() - this.list.getViewportHeight()); + return s; + } + ,__class__: com_davidmaletz_faengfl_DeveloperConsole +}); +var com_davidmaletz_faengfl__$DeveloperConsole_ConsoleRenderer = function() { +}; +$hxClasses["com.davidmaletz.faengfl._DeveloperConsole.ConsoleRenderer"] = com_davidmaletz_faengfl__$DeveloperConsole_ConsoleRenderer; +com_davidmaletz_faengfl__$DeveloperConsole_ConsoleRenderer.__name__ = ["com","davidmaletz","faengfl","_DeveloperConsole","ConsoleRenderer"]; +com_davidmaletz_faengfl__$DeveloperConsole_ConsoleRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_faengfl__$DeveloperConsole_ConsoleRenderer.prototype = { + create: function(item,x,y) { + var s = new openfl_display_Sprite(); + var len = item.getLineCount(); + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + var t = new com_fancyfish_faeng_common_mutable_Static(item.lines[i]); + var t1 = i == 0 ? item.color : item.secondColor; + var t2 = new com_davidmaletz_faengfl_TextSprite(t,new com_fancyfish_faeng_text_CharacterPlacer(0),t1,1,com_davidmaletz_faengfl_DeveloperConsole.font); + t2.set_x(x); + t2.set_y(y); + y += com_davidmaletz_faengfl_DeveloperConsole.TXT_HT; + s.addChild(t2); + } + return s; + } + ,update: function(s,item) { + } + ,getWidth: function() { + return 4096; + } + ,getHeight: function(item) { + return com_davidmaletz_faengfl_DeveloperConsole.TXT_HT * (item == null ? 1 : item.getLineCount()); + } + ,__class__: com_davidmaletz_faengfl__$DeveloperConsole_ConsoleRenderer +}; +var com_davidmaletz_faengfl_LogItem = function(t,col) { + this.lines = []; + this.add(t,true); + this.color = col; + this.secondColor = col; +}; +$hxClasses["com.davidmaletz.faengfl.LogItem"] = com_davidmaletz_faengfl_LogItem; +com_davidmaletz_faengfl_LogItem.__name__ = ["com","davidmaletz","faengfl","LogItem"]; +com_davidmaletz_faengfl_LogItem.prototype = { + lines: null + ,color: null + ,secondColor: null + ,add: function(t,first) { + if(first == null) { + first = false; + } + var ar = t.split("\n"); + var i = 0; + var _g = 0; + while(_g < ar.length) { + var s = ar[_g]; + ++_g; + var l = StringTools.trim(s); + var len = l.length; + var array = l.charAt(0) == "[" && l.charAt(l.length - 1) == "]"; + if(first) { + first = false; + } else { + l = " " + l; + } + if(len > 0) { + this.lines.push(len > 200 && !array ? haxe_Utf8.sub(l,0,200) : l); + } + } + } + ,getLineCount: function() { + return this.lines.length; + } + ,__class__: com_davidmaletz_faengfl_LogItem +}; +var com_davidmaletz_faengfl__$DeveloperConsole_MyTextField = function(width,onUp) { + com_davidmaletz_faengfl_ui_TextField.call(this,null,width,"",0,1,16777215,0,com_davidmaletz_faengfl_DeveloperConsole.font,-1,com_davidmaletz_faengfl_DeveloperConsole.TXT_HT); + this.onUp = onUp; +}; +$hxClasses["com.davidmaletz.faengfl._DeveloperConsole.MyTextField"] = com_davidmaletz_faengfl__$DeveloperConsole_MyTextField; +com_davidmaletz_faengfl__$DeveloperConsole_MyTextField.__name__ = ["com","davidmaletz","faengfl","_DeveloperConsole","MyTextField"]; +com_davidmaletz_faengfl__$DeveloperConsole_MyTextField.__super__ = com_davidmaletz_faengfl_ui_TextField; +com_davidmaletz_faengfl__$DeveloperConsole_MyTextField.prototype = $extend(com_davidmaletz_faengfl_ui_TextField.prototype,{ + onUp: null + ,keyCheck: function(e,m) { + if(e == 100 && lime_ui__$KeyModifier_KeyModifier_$Impl_$.get_shiftKey(m) && lime_ui__$KeyModifier_KeyModifier_$Impl_$.get_ctrlKey(m)) { + this.clearFocus(); + openfl_Lib.current.stage.window.onKeyDown.cancel(); + } else if(e == 1073741906 || e == 1073741905) { + this.onUp(e == 1073741906); + } else { + com_davidmaletz_faengfl_ui_TextField.prototype.keyCheck.call(this,e,m); + } + } + ,__class__: com_davidmaletz_faengfl__$DeveloperConsole_MyTextField +}); +var com_davidmaletz_faengfl__$DeveloperConsole_DebugInfo = function(w,c) { + openfl_display_Sprite.call(this); + var bg = new openfl_display_Sprite(); + this.addChild(bg); + this.addChild(new com_davidmaletz_faengfl__$DeveloperConsole_DebugInfoText(w,c,bg)); +}; +$hxClasses["com.davidmaletz.faengfl._DeveloperConsole.DebugInfo"] = com_davidmaletz_faengfl__$DeveloperConsole_DebugInfo; +com_davidmaletz_faengfl__$DeveloperConsole_DebugInfo.__name__ = ["com","davidmaletz","faengfl","_DeveloperConsole","DebugInfo"]; +com_davidmaletz_faengfl__$DeveloperConsole_DebugInfo.__super__ = openfl_display_Sprite; +com_davidmaletz_faengfl__$DeveloperConsole_DebugInfo.prototype = $extend(openfl_display_Sprite.prototype,{ + __class__: com_davidmaletz_faengfl__$DeveloperConsole_DebugInfo +}); +var com_davidmaletz_faengfl_Bounded = function() { }; +$hxClasses["com.davidmaletz.faengfl.Bounded"] = com_davidmaletz_faengfl_Bounded; +com_davidmaletz_faengfl_Bounded.__name__ = ["com","davidmaletz","faengfl","Bounded"]; +com_davidmaletz_faengfl_Bounded.prototype = { + getRectangle: null + ,__class__: com_davidmaletz_faengfl_Bounded +}; +var com_davidmaletz_faengfl_TextSprite = function(text,placer,color,size,font) { + openfl_display_Sprite.call(this); + if(text == null) { + com_fancyfish_faeng_common_Utils.printStackTrace("Null Text!"); + this.text = new com_fancyfish_faeng_common_mutable_Static(""); + } else { + this.text = text; + } + this.placer = placer; + this.scale = size; + if(color != 16777215) { + com_davidmaletz_faengfl_TextSprite.setColor(this,color); + } + if(font == null) { + font = com_fancyfish_faeng_text_FontManager.defaultFont; + } + this.font = font; + this.bounds = new com_fancyfish_faeng_display_Rectangle2D(); + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); +}; +$hxClasses["com.davidmaletz.faengfl.TextSprite"] = com_davidmaletz_faengfl_TextSprite; +com_davidmaletz_faengfl_TextSprite.__name__ = ["com","davidmaletz","faengfl","TextSprite"]; +com_davidmaletz_faengfl_TextSprite.__interfaces__ = [com_davidmaletz_faengfl_Bounded]; +com_davidmaletz_faengfl_TextSprite.setColor = function(s,color,white,power,scale) { + if(scale == null) { + scale = 1; + } + if(power == null) { + power = 1; + } + if(white == null) { + white = 255.0; + } + var c = s.get_transform().get_colorTransform(); + com_davidmaletz_faengfl_TextSprite.makeColor(c,color,white,power,scale); + s.get_transform().set_colorTransform(c); +}; +com_davidmaletz_faengfl_TextSprite.makeColor = function(c,color,white,power,scale) { + if(scale == null) { + scale = 1; + } + if(power == null) { + power = 1; + } + if(white == null) { + white = 255.0; + } + c.redMultiplier = com_fancyfish_faeng_common_Utils.interp(1,(color >> 16 & 255) / white,power) * scale; + c.greenMultiplier = com_fancyfish_faeng_common_Utils.interp(1,(color >> 8 & 255) / white,power) * scale; + c.blueMultiplier = com_fancyfish_faeng_common_Utils.interp(1,(color & 255) / white,power) * scale; +}; +com_davidmaletz_faengfl_TextSprite.getRenderer = function(font) { + var fr; + if(font.userData != null) { + fr = font.userData; + } else { + fr = new com_davidmaletz_faengfl__$TextSprite_FontRenderer(font); + font.userData = fr; + } + return fr; +}; +com_davidmaletz_faengfl_TextSprite.getChars = function(font,text,x,y,placer,specialChars) { + var fr = com_davidmaletz_faengfl_TextSprite.getRenderer(font); + var len = text.length; + var prev = -1; + var ret = 0; + com_davidmaletz_faengfl_TextSprite.char_ct = 0; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + var id = haxe_Utf8.charCodeAt(text,i); + var c = specialChars == null ? null : specialChars(id,null); + if(c == null) { + c = font.getCharacter(id); + } + if(id == 10) { + placer.newLine(font,1); + } + if(c != null) { + ret += c.getXAdvance(prev) + placer.spacing; + var cp = placer.place(c,prev,1,i); + if(cp != null) { + com_davidmaletz_faengfl_TextSprite.chars[com_davidmaletz_faengfl_TextSprite.char_ct++] = cp; + } + } + prev = id; + } + placer.finish(); + return ret; +}; +com_davidmaletz_faengfl_TextSprite.drawText = function(font,g,text,x,y,placer,updateChars,specialChars,bounds) { + var ret = com_davidmaletz_faengfl_TextSprite.getChars(font,text,x,y,placer,specialChars); + if(updateChars != null) { + updateChars(com_davidmaletz_faengfl_TextSprite.chars,com_davidmaletz_faengfl_TextSprite.char_ct); + } + com_davidmaletz_faengfl_TextSprite.drawCharacters(com_davidmaletz_faengfl_TextSprite.chars,com_davidmaletz_faengfl_TextSprite.char_ct,g,x,y,specialChars,bounds); + return ret; +}; +com_davidmaletz_faengfl_TextSprite.drawCharacters = function(chars,char_ct,g,x,y,specialChars,bounds) { + if(bounds != null) { + bounds.reset(); + } + com_davidmaletz_faengfl_TextSprite.ct = 0; + var font = null; + var fr = null; + var _g1 = 0; + var _g = char_ct; + while(_g1 < _g) { + var i = _g1++; + var cp = chars[i]; + if(cp.character.isDisplayable() && cp.character.x >= 0) { + if(bounds != null) { + bounds.addRect(new com_fancyfish_faeng_display_Rectangle2D(x + cp.get_x(),y + cp.get_y(),cp.character.getWidth(),cp.character.getHeight())); + } + com_davidmaletz_faengfl_TextSprite.data[com_davidmaletz_faengfl_TextSprite.ct++] = x + cp.get_x(); + com_davidmaletz_faengfl_TextSprite.data[com_davidmaletz_faengfl_TextSprite.ct++] = y + cp.get_y(); + if(font == null) { + font = cp.character.font; + fr = com_davidmaletz_faengfl_TextSprite.getRenderer(font); + } + var val = fr.map.get(cp.character.id); + com_davidmaletz_faengfl_TextSprite.data[com_davidmaletz_faengfl_TextSprite.ct++] = val; + if(font.internalScale != 1) { + com_davidmaletz_faengfl_TextSprite.data[com_davidmaletz_faengfl_TextSprite.ct++] = font.internalScale; + } + if(specialChars != null) { + specialChars(val,cp); + } + } else if(specialChars != null) { + specialChars(-1,cp); + } + } + if(g != null && font != null) { + com_davidmaletz_faengfl_TextSprite.drawTiles(font,g,0,com_davidmaletz_faengfl_TextSprite.ct); + } +}; +com_davidmaletz_faengfl_TextSprite.getTilesLength = function() { + return com_davidmaletz_faengfl_TextSprite.ct; +}; +com_davidmaletz_faengfl_TextSprite.drawTiles = function(font,g,from,to) { + var fr = com_davidmaletz_faengfl_TextSprite.getRenderer(font); + var flags = font.internalScale == 1 ? 0 : 1; + fr.tilesheet.drawTiles(g,com_davidmaletz_faengfl_TextSprite.data.slice(from,to),com_davidmaletz_faengfl_TextSprite.SMOOTH,flags); +}; +com_davidmaletz_faengfl_TextSprite.__super__ = openfl_display_Sprite; +com_davidmaletz_faengfl_TextSprite.prototype = $extend(openfl_display_Sprite.prototype,{ + text: null + ,scale: null + ,placer: null + ,font: null + ,bounds: null + ,getRectangle: function() { + return this.bounds; + } + ,getText: function() { + return this.text; + } + ,lineHeight: function() { + return Math.round(this.font.get().lineHeight); + } + ,setText: function(txt) { + if(this.text != txt) { + this.text.removeEventListener("updated",$bind(this,this.handleEvent)); + this.text = txt; + if(this.stage != null) { + this.text.addEventListener("updated",$bind(this,this.handleEvent)); + this.draw(); + } + } + } + ,init: function(e) { + this.destroy(e); + this.text.addEventListener("updated",$bind(this,this.handleEvent)); + this.draw(); + } + ,destroy: function(e) { + this.text.removeEventListener("updated",$bind(this,this.handleEvent)); + } + ,handleEvent: function(e) { + this.draw(); + } + ,updateChars: function(chars,len) { + } + ,draw: function(specialChars) { + this.get_graphics().clear(); + this.placer.reset(); + var font = this.font.get(); + if(font == null) { + return 0; + } + var s = this.scale; + var w = this.placer.width; + this.placer.width /= s; + var ret = com_davidmaletz_faengfl_TextSprite.drawText(font,this.get_graphics(),this.text.get(),0,0,this.placer,$bind(this,this.updateChars),specialChars,this.bounds); + this.set_scaleX(this.set_scaleY(s)); + this.placer.width = w; + return ret * s; + } + ,__class__: com_davidmaletz_faengfl_TextSprite +}); +var com_davidmaletz_faengfl__$DeveloperConsole_DebugInfoText = function(w,c,bg) { + this._height = 0; + this.times = []; + com_davidmaletz_faengfl_TextSprite.call(this,new com_fancyfish_faeng_common_mutable_Mutable(),new com_fancyfish_faeng_text_WrapCharacterPlacer(4096),16777215,1,com_davidmaletz_faengfl_DeveloperConsole.font); + this.set_x(10); + this.set_y(10); + this.watch = w; + this.console = c; + this.bg = bg; + bg.set_x(this.get_x()); + bg.set_y(this.get_y()); +}; +$hxClasses["com.davidmaletz.faengfl._DeveloperConsole.DebugInfoText"] = com_davidmaletz_faengfl__$DeveloperConsole_DebugInfoText; +com_davidmaletz_faengfl__$DeveloperConsole_DebugInfoText.__name__ = ["com","davidmaletz","faengfl","_DeveloperConsole","DebugInfoText"]; +com_davidmaletz_faengfl__$DeveloperConsole_DebugInfoText.__super__ = com_davidmaletz_faengfl_TextSprite; +com_davidmaletz_faengfl__$DeveloperConsole_DebugInfoText.prototype = $extend(com_davidmaletz_faengfl_TextSprite.prototype,{ + times: null + ,watch: null + ,console: null + ,_height: null + ,bg: null + ,init: function(e) { + this.update(null); + com_davidmaletz_faengfl_TextSprite.prototype.init.call(this,e); + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.update)); + } + ,destroy: function(e) { + com_davidmaletz_faengfl_TextSprite.prototype.destroy.call(this,e); + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.update)); + } + ,update: function(e) { + var now = openfl_Lib.getTimer(); + this.times.push(now); + while(this.times[0] < now - 1000) this.times.shift(); + var bd = 0; + var bu = 0; + var l = 0.0; + var mem = Math.round(openfl_system_System.get_totalMemory() / 1024 / 1024 * 100) / 100; + var b = new StringBuf(); + b.add("FPS: "); + b.add(this.times.length); + b.add("\nMEM: "); + b.add(mem); + b.add(" MB"); + if(bd > 0 || bu > 0) { + b.add("\nUP: "); + b.add(Math.round(bu * 100 / 125) / 100); + b.add(" Kbps"); + b.add("\nDOWN: "); + b.add(Math.round(bd * 100 / 125) / 100); + b.add(" Kbps"); + b.add("\nLATENCY: "); + b.add(Math.round(l)); + b.add(" ms"); + } + var _g = 0; + var _g1 = this.watch; + while(_g < _g1.length) { + var w = _g1[_g]; + ++_g; + b.add("\n"); + b.add(w); + b.add(": "); + var v; + try { + v = com_davidmaletz_faengfl_EventHandler._execute(w,this.console.vars); + } catch( e1 ) { + haxe_CallStack.lastException = e1; + if (e1 instanceof js__$Boot_HaxeError) e1 = e1.val; + v = e1; + } + b.add(com_davidmaletz_faengfl_DeveloperConsole.utfsafe(com_davidmaletz_faengfl_DeveloperConsole.string(v))); + } + this.text.set(b.toString()); + this.draw(); + var ht = Math.ceil(this.bounds.height * this.get_scaleY()); + if(ht != this._height) { + this._height = ht; + this.bg.get_graphics().clear(); + this.bg.get_graphics().beginFill(0,0.75); + this.bg.get_graphics().drawRect(-2,-2,256,ht + 4); + this.bg.get_graphics().endFill(); + } + } + ,__class__: com_davidmaletz_faengfl__$DeveloperConsole_DebugInfoText +}); +var com_davidmaletz_faengfl_EmptyDrawable = function(w,h) { + this.w = w; + this.h = h; +}; +$hxClasses["com.davidmaletz.faengfl.EmptyDrawable"] = com_davidmaletz_faengfl_EmptyDrawable; +com_davidmaletz_faengfl_EmptyDrawable.__name__ = ["com","davidmaletz","faengfl","EmptyDrawable"]; +com_davidmaletz_faengfl_EmptyDrawable.__interfaces__ = [com_davidmaletz_faengfl_Drawable]; +com_davidmaletz_faengfl_EmptyDrawable.prototype = { + w: null + ,h: null + ,getWidth: function() { + return this.w; + } + ,getHeight: function() { + return this.h; + } + ,create: function(tx,ty) { + return null; + } + ,__class__: com_davidmaletz_faengfl_EmptyDrawable +}; +var com_davidmaletz_faengfl_EventHandler = function(xml,func,vars) { + this.node = null; + this.currentFile = null; + this.locals = new haxe_ds_StringMap(); + this.cur = xml; + this.onComplete = func; + if(vars == null) { + vars = com_davidmaletz_faengfl_EventHandler.createVariables(); + } + this.vars = vars; + this.setLocal("evalXml",$bind(this,this.evalXml)); +}; +$hxClasses["com.davidmaletz.faengfl.EventHandler"] = com_davidmaletz_faengfl_EventHandler; +com_davidmaletz_faengfl_EventHandler.__name__ = ["com","davidmaletz","faengfl","EventHandler"]; +com_davidmaletz_faengfl_EventHandler.parser = null; +com_davidmaletz_faengfl_EventHandler.interp = null; +com_davidmaletz_faengfl_EventHandler.parseString = function(str) { + if(str == null) { + return null; + } + if(com_davidmaletz_faengfl_EventHandler.parser == null) { + com_davidmaletz_faengfl_EventHandler.parser = new hscript_Parser(); + } + return com_davidmaletz_faengfl_EventHandler.parser.parseString(com_fancyfish_faeng_common_Lang.escape(str)); +}; +com_davidmaletz_faengfl_EventHandler.interpret = function(expr,vars,locals) { + if(com_davidmaletz_faengfl_EventHandler.interp == null) { + com_davidmaletz_faengfl_EventHandler.interp = new hscript_Interp(com_davidmaletz_faengfl_EventHandler.createVariables()); + } + var old = com_davidmaletz_faengfl_EventHandler.interp.variables; + var ret = null; + com_davidmaletz_faengfl_EventHandler.interp.variables = vars; + try { + ret = com_davidmaletz_faengfl_EventHandler.interp.execute(expr,locals); + } catch( e ) { + haxe_CallStack.lastException = e; + if (e instanceof js__$Boot_HaxeError) e = e.val; + com_davidmaletz_faengfl_EventHandler.interp.variables = old; + throw js__$Boot_HaxeError.wrap(e); + } + com_davidmaletz_faengfl_EventHandler.interp.variables = old; + return ret; +}; +com_davidmaletz_faengfl_EventHandler._execute = function(str,vars,locals) { + var p = com_davidmaletz_faengfl_EventHandler.parseString(str); + if(p == null) { + return null; + } else { + return com_davidmaletz_faengfl_EventHandler.interpret(p,vars,locals); + } +}; +com_davidmaletz_faengfl_EventHandler.execute = function(str,vars,locals) { + try { + return com_davidmaletz_faengfl_EventHandler._execute(str,vars,locals); + } catch( e ) { + haxe_CallStack.lastException = e; + if (e instanceof js__$Boot_HaxeError) e = e.val; + com_fancyfish_faeng_common_Utils.printExceptionTrace("Script Error: " + Std.string(e) + "\n" + com_fancyfish_faeng_common_Lang.escape(str)); + return null; + } +}; +com_davidmaletz_faengfl_EventHandler.setGlobal = function(id,val) { + com_davidmaletz_faengfl_EventHandler.getGlobals().set(id,val); +}; +com_davidmaletz_faengfl_EventHandler.getGlobal = function(id) { + return com_davidmaletz_faengfl_EventHandler.getGlobals().get(id); +}; +com_davidmaletz_faengfl_EventHandler.exists = function(vars,id) { + return vars.exists(id); +}; +com_davidmaletz_faengfl_EventHandler.getVars = function(vars) { + return vars; +}; +com_davidmaletz_faengfl_EventHandler["eval"] = function(vars,str) { + return com_davidmaletz_faengfl_EventHandler.execute(str,vars); +}; +com_davidmaletz_faengfl_EventHandler._conditionMet = function(cond,vars) { + try { + return com_davidmaletz_faengfl_EventHandler._execute(cond,vars) == true; + } catch( e ) { + haxe_CallStack.lastException = e; + return false; + } +}; +com_davidmaletz_faengfl_EventHandler.getResource = function(path,id) { + return path + id; +}; +com_davidmaletz_faengfl_EventHandler.makeRect = function(x,y,w,h) { + return new openfl_geom_Rectangle(x,y,w,h); +}; +com_davidmaletz_faengfl_EventHandler.createVariables = function() { + var v = new haxe_ds_StringMap(); + v.set("null",null); + v.set("true",true); + v.set("false",false); + v.set("Math",Math); + v.set("trace",function(e) { + haxe_Log.trace(Std.string(e),{ fileName : "hscript", lineNumber : 0}); + }); + v.set("Std",Std); + v.set("remove",com_davidmaletz_faengfl_FaengFL.remove); + v.set("makeRect",com_davidmaletz_faengfl_EventHandler.makeRect); + var a1 = v; + v.set("exists",function(id) { + return com_davidmaletz_faengfl_EventHandler.exists(a1,id); + }); + var a11 = v; + v.set("getVars",function() { + return com_davidmaletz_faengfl_EventHandler.getVars(a11); + }); + v.set("setGlobal",com_davidmaletz_faengfl_EventHandler.setGlobal); + v.set("getGlobal",com_davidmaletz_faengfl_EventHandler.getGlobal); + var a12 = v; + v.set("eval",function(a2) { + return com_davidmaletz_faengfl_EventHandler["eval"](a12,a2); + }); + v.set("Int",Int); + v.set("Float",Float); + v.set("String",String); + v.set("Array",Array); + v.set("Bool",Bool); + v.set("log",com_davidmaletz_faengfl_DeveloperConsole.log); + if(com_davidmaletz_faengfl_EventHandler.additionalVars != null) { + com_davidmaletz_faengfl_EventHandler.additionalVars(v); + } + return v; +}; +com_davidmaletz_faengfl_EventHandler.parse = function(file,action_map,vars) { + if(!openfl_Assets.exists(file)) { + return; + } + var xml = Xml.parse(openfl_Assets.getText(file)).firstElement(); + var i = file.lastIndexOf("/"); + var path = i == -1 ? "/" : file.substring(0,i + 1); + com_davidmaletz_faengfl_EventHandler._parse(new com_davidmaletz_faengfl_XmlPath(xml,path),action_map,vars).start(); +}; +com_davidmaletz_faengfl_EventHandler._parse = function(xml,action_map,vars) { + return new com_davidmaletz_faengfl__$EventHandler_MapEventHandler(xml,action_map,vars); +}; +com_davidmaletz_faengfl_EventHandler.globals = null; +com_davidmaletz_faengfl_EventHandler.getGlobals = function() { + if(com_davidmaletz_faengfl_EventHandler.globals == null) { + com_davidmaletz_faengfl_EventHandler.globals = new haxe_ds_StringMap(); + } + return com_davidmaletz_faengfl_EventHandler.globals; +}; +com_davidmaletz_faengfl_EventHandler.prototype = { + cur: null + ,stack: null + ,onComplete: null + ,vars: null + ,onStop: null + ,locals: null + ,setLocal: function(name,value) { + var ref = { r : value}; + this.locals.set(name,ref); + } + ,evalXml: function(xml) { + this.enterChild(Xml.parse(xml)); + } + ,start: function() { + this.handleNext(); + } + ,enterChild: function(n,path,func) { + this.enterIterator(n.elements(),path,func); + } + ,enterIterator: function(i,path,func) { + if(this.cur != null) { + if(path == null) { + path = this.getCurrentPath(); + } + if(this.stack == null) { + this.stack = [this.cur]; + } else { + this.stack.push(this.cur); + } + } + this.cur = new com_davidmaletz_faengfl_ENode(i,path,func); + } + ,enterIteratorPath: function(i) { + if(this.cur != null) { + if(this.stack == null) { + this.stack = [this.cur]; + } else { + this.stack.push(this.cur); + } + } + this.cur = i; + } + ,conditionMet: function(cond) { + return com_davidmaletz_faengfl_EventHandler._conditionMet(cond,this.vars); + } + ,handleGroup: function(g) { + var children = []; + var e = g.elements(); + while(e.hasNext()) { + var e1 = e.next(); + if(!e1.exists("if") || this.conditionMet(e1.get("if"))) { + children.push(e1); + } + } + if(children.length == 0) { + return false; + } + if(com_davidmaletz_faengfl_EventHandler.lastGroup == g) { + com_davidmaletz_faengfl_EventHandler.lastSel++; + if(com_davidmaletz_faengfl_EventHandler.lastSel >= children.length) { + com_davidmaletz_faengfl_EventHandler.lastSel = 0; + } + } else { + com_davidmaletz_faengfl_EventHandler.lastGroup = g; + com_davidmaletz_faengfl_EventHandler.lastSel = 0; + } + return this.runNode(children[com_davidmaletz_faengfl_EventHandler.lastSel]); + } + ,choose: function(iter) { + var e = iter; + while(e.hasNext()) { + var e1 = e.next(); + if(!e1.exists("if") || this.conditionMet(e1.get("if"))) { + return e1; + } + } + return null; + } + ,handleChoose: function(iter) { + var e = this.choose(iter); + if(e == null) { + return false; + } else { + return this.runNode(e); + } + } + ,getAvailable: function(iter) { + var ar = []; + var e = iter; + while(e.hasNext()) { + var e1 = e.next(); + if(!e1.exists("if") || this.conditionMet(e1.get("if"))) { + ar.push(e1); + } + } + return ar; + } + ,currentFile: null + ,getRun: function(n) { + if(n.exists("procedure") && this.vars.exists(n.get("procedure"))) { + return this.vars.get(n.get("procedure")); + } else { + return null; + } + } + ,queueProcedure: function(id) { + if(this.vars.exists(id)) { + this.enterIteratorPath((js_Boot.__cast(this.vars.get(id) , com_davidmaletz_faengfl_IXml)).elements()); + } + } + ,canAct: function() { + return true; + } + ,handleNode: function(n) { + var _g = n.get_nodeName(); + switch(_g) { + case "action": + if(!this.canAct()) { + return false; + } + com_davidmaletz_faengfl_EventHandler.execute(com_fancyfish_faeng_common_Lang.escape(n.firstChild().get_nodeValue()),this.vars,this.locals); + break; + case "choose": + return this.handleChoose(n.elements()); + case "function": + if(!this.canAct()) { + return false; + } + var object = n.exists("object") ? com_davidmaletz_faengfl_EventHandler.execute(n.get("object"),this.vars) : null; + var ret; + if(object == null) { + this.vars.set("handleNext",$bind(this,this.handleNext)); + ret = com_davidmaletz_faengfl_EventHandler.execute(n.get("run") + "(" + n.get("args") + ",handleNext)",this.vars); + this.vars.remove("handleNext"); + } else { + var args = n.exists("args") ? com_davidmaletz_faengfl_EventHandler.execute("[" + n.get("args") + "]",this.vars) : [n]; + args.push($bind(this,this.handleNext)); + ret = Reflect.callMethod(object,Reflect.field(object,n.get("run")),args); + } + if(ret == null) { + return true; + } else { + var flags = ret; + if((flags & 1) != 0) { + this.enterChild(n); + } + if((flags & 2) != 0) { + return true; + } + } + break; + case "group": + return this.handleGroup(n); + case "include": + var f = com_davidmaletz_faengfl_EventHandler.getResource(this.getCurrentPath(),n.get("id")); + if(openfl_Assets.exists(f)) { + this.currentFile = f; + var xml = Xml.parse(openfl_Assets.getText(f)); + if(n.get("includeRoot") != "true") { + xml = xml.firstElement(); + } + if(n.exists("child")) { + var i = xml.elementsNamed(n.get("child")); + if(i.hasNext()) { + xml = i.next(); + } + } + this.enterChild(xml,f.substring(0,f.lastIndexOf("/") + 1)); + } else { + haxe_Log.trace("Warning: cannot include \"" + f + "\", asset does not exist.",{ fileName : "EventHandler.hx", lineNumber : 98, className : "com.davidmaletz.faengfl.EventHandler", methodName : "handleNode"}); + } + break; + case "procedure": + var id = n.get("id"); + if(this.vars.exists(id)) { + haxe_Log.trace("Overwrite Procedure: " + id,{ fileName : "EventHandler.hx", lineNumber : 107, className : "com.davidmaletz.faengfl.EventHandler", methodName : "handleNode"}); + } + var xml1 = new com_davidmaletz_faengfl_XmlPath(n,this.getCurrentPath()); + if(n.exists("extends")) { + var e = n.get("extends"); + var v = this.vars.get(e); + if(v != null) { + xml1 = new com_davidmaletz_faengfl_XmlDual(xml1,v); + } + } + this.vars.set(id,xml1); + break; + case "repeat": + var count = com_davidmaletz_faengfl_EventHandler.execute(n.get("count"),this.vars); + var _g1 = 0; + var _g2 = count; + while(_g1 < _g2) { + var i1 = _g1++; + this.enterChild(n); + } + break; + case "run": + var xml2 = this.getRun(n); + if(xml2 != null) { + this.enterIteratorPath(xml2.elements()); + } + break; + case "section": + this.enterChild(n); + break; + case "select": + var count1 = com_davidmaletz_faengfl_EventHandler.execute(n.get("count"),this.vars); + var ar = this.getAvailable(n.elements()); + var len = ar.length; + if(count1 < len) { + var _g11 = count1; + var _g3 = len; + while(_g11 < _g3) { + var i2 = _g11++; + ar.splice(Math.floor(Math.random() * ar.length),1); + } + } + this.enterIterator(HxOverrides.iter(ar)); + break; + case "set": + var id1 = n.get("id"); + var v1 = com_davidmaletz_faengfl_EventHandler.execute(n.get("value"),this.vars); + this.vars.set(id1,v1); + if(n.get("global") == "true") { + com_davidmaletz_faengfl_EventHandler.getGlobals().set(id1,v1); + } + break; + case "stop": + if(n.get("complete") == "true") { + this.fireComplete(); + } + this.fireStop(); + return true; + } + return false; + } + ,node: null + ,getCurrentPath: function() { + return this.node.path; + } + ,executeNode: function(n) { + if(!this.handleNode(n)) { + this.handleNext(); + } + } + ,handleTransition: function(n,trans,func) { + return false; + } + ,runNode: function(n) { + if(n.exists("if") && !this.conditionMet(n.get("if"))) { + return false; + } + if(n.exists("with")) { + var f = $bind(this,this.executeNode); + var n1 = n; + var tmp = function() { + f(n1); + }; + if(this.handleTransition(n,n.get("with"),tmp)) { + return true; + } + } + return this.handleNode(n); + } + ,handleNext: function() { + if(this.cur != null) { + while(this.cur.hasNext()) { + this.node = this.cur.next(); + if(this.runNode(this.node.xml)) { + return; + } + } + } + if(this.stack != null) { + this.cur = this.stack.pop(); + if(this.stack.length == 0) { + this.stack = null; + } + this.handleNext(); + } else { + this.fireComplete(); + } + } + ,fireComplete: function() { + if(this.onComplete != null) { + this.onComplete(); + } + } + ,fireStop: function() { + if(this.onStop != null) { + this.onStop(); + } + } + ,peekNode: function(n,values) { + var _g = n.get_nodeName(); + switch(_g) { + case "choose": + var e = this.choose(n.elements()); + if(e == null) { + return null; + } else { + return this.peekNode(e,values); + } + break; + case "group": + var e1 = this.choose(n.elements()); + if(e1 == null) { + return null; + } else { + return this.peekNode(e1,values); + } + break; + case "include": + var f = this.getCurrentPath() + n.get("id"); + if(openfl_Assets.exists(f)) { + this.enterChild(Xml.parse(openfl_Assets.getText(f)).firstElement(),f.substring(0,f.lastIndexOf("/") + 1)); + } + return null; + case "repeat": + this.enterChild(n); + return null; + case "run": + var xml = this.getRun(n); + if(xml != null) { + this.enterIteratorPath(xml.elements()); + } + return null; + case "section": + this.enterChild(n); + return null; + default: + if(values.indexOf(n.get_nodeName()) != -1) { + return n; + } else { + return null; + } + } + } + ,_getFirst: function(values) { + if(this.cur != null) { + while(this.cur.hasNext()) { + this.node = this.cur.next(); + var n = this.node.xml; + if(n.exists("if") && !this.conditionMet(n.get("if"))) { + continue; + } + if(n.get_nodeName() == "stop") { + return null; + } + var e = this.peekNode(n,values); + if(e != null) { + return e; + } + } + } + if(this.stack != null) { + this.cur = this.stack.pop(); + if(this.stack.length == 0) { + this.stack = null; + } + return this._getFirst(values); + } else { + return null; + } + } + ,getFirst: function(values) { + return this._getFirst(values); + } + ,__class__: com_davidmaletz_faengfl_EventHandler +}; +var com_davidmaletz_faengfl__$EventHandler_MapEventHandler = function(xml,map,vars) { + com_davidmaletz_faengfl_EventHandler.call(this,xml.elements(),null,vars); + this.action_map = map; +}; +$hxClasses["com.davidmaletz.faengfl._EventHandler.MapEventHandler"] = com_davidmaletz_faengfl__$EventHandler_MapEventHandler; +com_davidmaletz_faengfl__$EventHandler_MapEventHandler.__name__ = ["com","davidmaletz","faengfl","_EventHandler","MapEventHandler"]; +com_davidmaletz_faengfl__$EventHandler_MapEventHandler.__super__ = com_davidmaletz_faengfl_EventHandler; +com_davidmaletz_faengfl__$EventHandler_MapEventHandler.prototype = $extend(com_davidmaletz_faengfl_EventHandler.prototype,{ + action_map: null + ,handleNode: function(n) { + if(this.action_map.exists(n.get_nodeName())) { + (this.action_map.get(n.get_nodeName()))(n,this.getCurrentPath()); + return false; + } else { + return com_davidmaletz_faengfl_EventHandler.prototype.handleNode.call(this,n); + } + } + ,__class__: com_davidmaletz_faengfl__$EventHandler_MapEventHandler +}); +var com_davidmaletz_faengfl_ENode = function(i,p,func) { + this.iterator = i; + this.path = p; + this.onStart = func; +}; +$hxClasses["com.davidmaletz.faengfl.ENode"] = com_davidmaletz_faengfl_ENode; +com_davidmaletz_faengfl_ENode.__name__ = ["com","davidmaletz","faengfl","ENode"]; +com_davidmaletz_faengfl_ENode.prototype = { + iterator: null + ,path: null + ,onStart: null + ,hasNext: function() { + return this.iterator.hasNext(); + } + ,next: function() { + if(this.onStart != null) { + this.onStart(); + this.onStart = null; + } + return new com_davidmaletz_faengfl_XmlPath(this.iterator.next(),this.path); + } + ,__class__: com_davidmaletz_faengfl_ENode +}; +var com_davidmaletz_faengfl_IXml = function() { }; +$hxClasses["com.davidmaletz.faengfl.IXml"] = com_davidmaletz_faengfl_IXml; +com_davidmaletz_faengfl_IXml.__name__ = ["com","davidmaletz","faengfl","IXml"]; +com_davidmaletz_faengfl_IXml.prototype = { + exists: null + ,get: null + ,set: null + ,getPathForAttr: null + ,firstElement: null + ,elementsNamed: null + ,elementPathsNamed: null + ,elements: null + ,nodeName: null + ,toString: null + ,__class__: com_davidmaletz_faengfl_IXml +}; +var com_davidmaletz_faengfl_EmptyXml = function() { +}; +$hxClasses["com.davidmaletz.faengfl.EmptyXml"] = com_davidmaletz_faengfl_EmptyXml; +com_davidmaletz_faengfl_EmptyXml.__name__ = ["com","davidmaletz","faengfl","EmptyXml"]; +com_davidmaletz_faengfl_EmptyXml.__interfaces__ = [com_davidmaletz_faengfl_IXml]; +com_davidmaletz_faengfl_EmptyXml.prototype = { + exists: function(att) { + return false; + } + ,get: function(att) { + return null; + } + ,set: function(att,val) { + } + ,getPathForAttr: function(att) { + return null; + } + ,firstElement: function() { + return null; + } + ,elementsNamed: function(elem) { + return new com_fancyfish_faeng_common_NullIterator(); + } + ,elementPathsNamed: function(elem) { + return new com_fancyfish_faeng_common_NullIterator(); + } + ,elements: function() { + return new com_fancyfish_faeng_common_NullIterator(); + } + ,nodeName: function() { + return ""; + } + ,toString: function() { + return ""; + } + ,__class__: com_davidmaletz_faengfl_EmptyXml +}; +var com_davidmaletz_faengfl_XmlPath = function(e,p) { + this.xml = e; + this.path = p; +}; +$hxClasses["com.davidmaletz.faengfl.XmlPath"] = com_davidmaletz_faengfl_XmlPath; +com_davidmaletz_faengfl_XmlPath.__name__ = ["com","davidmaletz","faengfl","XmlPath"]; +com_davidmaletz_faengfl_XmlPath.__interfaces__ = [com_davidmaletz_faengfl_IXml]; +com_davidmaletz_faengfl_XmlPath.prototype = { + xml: null + ,path: null + ,exists: function(att) { + return this.xml.exists(att); + } + ,get: function(att) { + return this.xml.get(att); + } + ,set: function(att,val) { + this.xml.set(att,val); + } + ,getPathForAttr: function(att) { + return this.path; + } + ,firstElement: function() { + var r = this.xml.firstElement(); + if(r == null) { + return null; + } else { + return new com_davidmaletz_faengfl_XmlPath(r,this.path); + } + } + ,elementsNamed: function(elem) { + return this.xml.elementsNamed(elem); + } + ,elementPathsNamed: function(elem) { + return new com_davidmaletz_faengfl_ENode(this.xml.elementsNamed(elem),this.path); + } + ,elements: function() { + return new com_davidmaletz_faengfl_ENode(this.xml.elements(),this.path); + } + ,nodeName: function() { + return this.xml.get_nodeName(); + } + ,toString: function() { + return this.xml.toString(); + } + ,__class__: com_davidmaletz_faengfl_XmlPath +}; +var com_davidmaletz_faengfl_XmlDual = function(f,s) { + this.first = f; + this.second = s; +}; +$hxClasses["com.davidmaletz.faengfl.XmlDual"] = com_davidmaletz_faengfl_XmlDual; +com_davidmaletz_faengfl_XmlDual.__name__ = ["com","davidmaletz","faengfl","XmlDual"]; +com_davidmaletz_faengfl_XmlDual.__interfaces__ = [com_davidmaletz_faengfl_IXml]; +com_davidmaletz_faengfl_XmlDual.prototype = { + first: null + ,second: null + ,exists: function(att) { + if(this.first.get(att) != "") { + if(!this.first.exists(att)) { + return this.second.exists(att); + } else { + return true; + } + } else { + return false; + } + } + ,get: function(att) { + return (this.first.exists(att) ? this.first : this.second).get(att); + } + ,set: function(att,val) { + this.first.set(att,val); + } + ,getPathForAttr: function(att) { + return (this.first.exists(att) ? this.first : this.second).getPathForAttr(att); + } + ,firstElement: function() { + var r = this.first.firstElement(); + if(r == null) { + return this.second.firstElement(); + } else { + return r; + } + } + ,elementsNamed: function(elem) { + return new com_fancyfish_faeng_common_DoubleIterator(this.first.elementsNamed(elem),this.second.elementsNamed(elem)); + } + ,elementPathsNamed: function(elem) { + return new com_fancyfish_faeng_common_DoubleIterator(this.first.elementPathsNamed(elem),this.second.elementPathsNamed(elem)); + } + ,elements: function() { + return new com_fancyfish_faeng_common_DoubleIterator(this.first.elements(),this.second.elements()); + } + ,nodeName: function() { + return this.first.nodeName(); + } + ,toString: function() { + return this.first.toString(); + } + ,__class__: com_davidmaletz_faengfl_XmlDual +}; +var com_davidmaletz_faengfl_XmlDualReverse = function(f,s) { + com_davidmaletz_faengfl_XmlDual.call(this,f,s); +}; +$hxClasses["com.davidmaletz.faengfl.XmlDualReverse"] = com_davidmaletz_faengfl_XmlDualReverse; +com_davidmaletz_faengfl_XmlDualReverse.__name__ = ["com","davidmaletz","faengfl","XmlDualReverse"]; +com_davidmaletz_faengfl_XmlDualReverse.__super__ = com_davidmaletz_faengfl_XmlDual; +com_davidmaletz_faengfl_XmlDualReverse.prototype = $extend(com_davidmaletz_faengfl_XmlDual.prototype,{ + firstElement: function() { + var r = this.second.firstElement(); + if(r == null) { + return this.first.firstElement(); + } else { + return r; + } + } + ,elementsNamed: function(elem) { + return new com_fancyfish_faeng_common_DoubleIterator(this.second.elementsNamed(elem),this.first.elementsNamed(elem)); + } + ,elementPathsNamed: function(elem) { + return new com_fancyfish_faeng_common_DoubleIterator(this.second.elementPathsNamed(elem),this.first.elementPathsNamed(elem)); + } + ,elements: function() { + return new com_fancyfish_faeng_common_DoubleIterator(this.second.elements(),this.first.elements()); + } + ,__class__: com_davidmaletz_faengfl_XmlDualReverse +}); +var com_davidmaletz_faengfl_FaengFL = function() { }; +$hxClasses["com.davidmaletz.faengfl.FaengFL"] = com_davidmaletz_faengfl_FaengFL; +com_davidmaletz_faengfl_FaengFL.__name__ = ["com","davidmaletz","faengfl","FaengFL"]; +com_davidmaletz_faengfl_FaengFL.removeAllChildren = function(s,from) { + if(from == null) { + from = 0; + } + while(s.get_numChildren() > from) s.removeChildAt(from); +}; +com_davidmaletz_faengfl_FaengFL.init = function() { + openfl_Lib.current.stage.addEventListener("enterFrame",com_davidmaletz_faengfl_FaengFL.enter_frame,false,1000); +}; +com_davidmaletz_faengfl_FaengFL.destroy = function() { + openfl_Lib.current.stage.removeEventListener("enterFrame",com_davidmaletz_faengfl_FaengFL.enter_frame); +}; +com_davidmaletz_faengfl_FaengFL.hasWindow = function() { + return com_davidmaletz_faengfl_Window.window_ct > 0; +}; +com_davidmaletz_faengfl_FaengFL.enter_frame = function(e) { + var frames; + var t = openfl_Lib.getTimer(); + if(com_davidmaletz_faengfl_FaengFL.lastTime < 0) { + com_davidmaletz_faengfl_FaengFL.lastTime = t; + frames = 1; + } else { + frames = Math.min(2,(t - com_davidmaletz_faengfl_FaengFL.lastTime) * 50 / 1000); + com_davidmaletz_faengfl_FaengFL.lastTime = t; + } + frames *= com_davidmaletz_faengfl_FaengFL.speed_mod; + com_davidmaletz_faengfl_FaengFL.frameTime = frames; + if(com_davidmaletz_faengfl_FaengFL.speed_mod != 0 && !com_davidmaletz_faengfl_FaengFL.isPaused()) { + if(com_davidmaletz_faengfl_FaengFL.listeners != null) { + com_davidmaletz_faengfl_FaengFL.dispatching = true; + var _g = 0; + var _g1 = com_davidmaletz_faengfl_FaengFL.listeners; + while(_g < _g1.length) { + var l = _g1[_g]; + ++_g; + l.enter_frame(frames); + } + com_davidmaletz_faengfl_FaengFL.dispatching = false; + if(com_davidmaletz_faengfl_FaengFL.listeners_modify != null && com_davidmaletz_faengfl_FaengFL.listeners_modify.length > 0) { + var len = com_davidmaletz_faengfl_FaengFL.listeners_modify.length; + var _g11 = 0; + var _g2 = len; + while(_g11 < _g2) { + var i = _g11++; + if(com_davidmaletz_faengfl_FaengFL.listeners_add[i]) { + com_davidmaletz_faengfl_FaengFL.addEnterFrame(com_davidmaletz_faengfl_FaengFL.listeners_modify[i]); + } else { + com_davidmaletz_faengfl_FaengFL.removeEnterFrame(com_davidmaletz_faengfl_FaengFL.listeners_modify[i]); + } + } + com_fancyfish_faeng_common_Utils.clear(com_davidmaletz_faengfl_FaengFL.listeners_modify); + com_fancyfish_faeng_common_Utils.clear(com_davidmaletz_faengfl_FaengFL.listeners_add); + } + } + } +}; +com_davidmaletz_faengfl_FaengFL.addEnterFrame = function(e,first) { + if(first == null) { + first = false; + } + if(com_davidmaletz_faengfl_FaengFL.dispatching) { + if(com_davidmaletz_faengfl_FaengFL.listeners_modify == null) { + com_davidmaletz_faengfl_FaengFL.listeners_modify = [e]; + com_davidmaletz_faengfl_FaengFL.listeners_add = [true]; + } else { + com_davidmaletz_faengfl_FaengFL.listeners_modify.push(e); + com_davidmaletz_faengfl_FaengFL.listeners_add.push(true); + } + } else { + if(com_davidmaletz_faengfl_FaengFL.listeners == null) { + com_davidmaletz_faengfl_FaengFL.listeners = []; + } + if(first) { + com_davidmaletz_faengfl_FaengFL.listeners.unshift(e); + } else { + com_davidmaletz_faengfl_FaengFL.listeners.push(e); + } + } +}; +com_davidmaletz_faengfl_FaengFL.removeEnterFrame = function(e) { + if(com_davidmaletz_faengfl_FaengFL.dispatching) { + if(com_davidmaletz_faengfl_FaengFL.listeners_modify == null) { + com_davidmaletz_faengfl_FaengFL.listeners_modify = [e]; + com_davidmaletz_faengfl_FaengFL.listeners_add = [false]; + } else { + com_davidmaletz_faengfl_FaengFL.listeners_modify.push(e); + com_davidmaletz_faengfl_FaengFL.listeners_add.push(false); + } + } else if(com_davidmaletz_faengfl_FaengFL.listeners != null) { + HxOverrides.remove(com_davidmaletz_faengfl_FaengFL.listeners,e); + } +}; +com_davidmaletz_faengfl_FaengFL.remove = function(d) { + if(d.parent != null) { + d.parent.removeChild(d); + } +}; +com_davidmaletz_faengfl_FaengFL.point = null; +com_davidmaletz_faengfl_FaengFL.onScreen = function(d,bounds) { + if(com_davidmaletz_faengfl_FaengFL.point == null) { + com_davidmaletz_faengfl_FaengFL.point = new openfl_geom_Point(bounds.x,bounds.y); + } else { + com_davidmaletz_faengfl_FaengFL.point.setTo(bounds.x,bounds.y); + } + var p = d.localToGlobal(com_davidmaletz_faengfl_FaengFL.point); + com_davidmaletz_faengfl_FaengFL.point.setTo(bounds.x + bounds.width,bounds.y + bounds.height); + var e = d.localToGlobal(com_davidmaletz_faengfl_FaengFL.point); + if(d.get_scaleX() < 0) { + var tmp = p.x; + p.x = e.x; + e.x = tmp; + } + if(d.get_scaleY() < 0) { + var tmp1 = p.y; + p.y = e.y; + e.y = tmp1; + } + var w = openfl_Lib.current.stage.stageWidth; + var h = openfl_Lib.current.stage.stageHeight; + if(e.x > 0 && p.x < w && e.y > 0) { + return p.y < h; + } else { + return false; + } +}; +com_davidmaletz_faengfl_FaengFL.onScreenPt = function(d,x,y,c,padx,pady) { + if(pady == null) { + pady = 0; + } + if(padx == null) { + padx = 0; + } + if(com_davidmaletz_faengfl_FaengFL.point == null) { + com_davidmaletz_faengfl_FaengFL.point = new openfl_geom_Point(x,y); + } else { + com_davidmaletz_faengfl_FaengFL.point.setTo(x,y); + } + var p = d.localToGlobal(com_davidmaletz_faengfl_FaengFL.point); + var w; + var h; + if(c != null) { + p = c.globalToLocal(p); + w = c.getWidth(); + h = c.getHeight(); + } else { + w = openfl_Lib.current.stage.stageWidth; + h = openfl_Lib.current.stage.stageHeight; + } + if(p.x > padx && p.x < w - padx && p.y > pady) { + return p.y < h - pady; + } else { + return false; + } +}; +var com_davidmaletz_faengfl_FormattedTextBase = function(width,multiline,align,word,linePadding) { + if(linePadding == null) { + linePadding = 0; + } + if(word == null) { + word = true; + } + if(align == null) { + align = 0; + } + this.default_color = 0; + this.default_size = 16; + openfl_display_Sprite.call(this); + this.setStyle(width,multiline,align,word,linePadding); + this.default_font = com_fancyfish_faeng_text_FontManager.defaultFont; + this.bold = this.getFont("bold"); + this.italic = this.getFont("italic"); +}; +$hxClasses["com.davidmaletz.faengfl.FormattedTextBase"] = com_davidmaletz_faengfl_FormattedTextBase; +com_davidmaletz_faengfl_FormattedTextBase.__name__ = ["com","davidmaletz","faengfl","FormattedTextBase"]; +com_davidmaletz_faengfl_FormattedTextBase.placeCharacters = function(chrs,font,text,placer,scale) { + if(scale == null) { + scale = 1; + } + var len = text.length; + var prev = -1; + scale = 1; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + var id = haxe_Utf8.charCodeAt(text,i); + var c = font.getCharacter(id); + if(id == 10) { + placer.newLine(font,scale); + } + if(c != null) { + var cp = placer.place(c,prev,scale,id); + if(cp != null && c.isDisplayable()) { + chrs.push(cp); + } + } + prev = id; + } +}; +com_davidmaletz_faengfl_FormattedTextBase.parseInt = function(s) { + if(s == null) { + return 0; + } else { + var r = Std.parseInt(s); + var ret = r == null ? 0 : r; + return ret; + } +}; +com_davidmaletz_faengfl_FormattedTextBase.__super__ = openfl_display_Sprite; +com_davidmaletz_faengfl_FormattedTextBase.prototype = $extend(openfl_display_Sprite.prototype,{ + default_font: null + ,default_size: null + ,default_color: null + ,bold: null + ,italic: null + ,placer: null + ,setStyle: function(width,multiline,align,word,linePadding) { + if(linePadding == null) { + linePadding = 0; + } + if(word == null) { + word = true; + } + if(align == null) { + align = 0; + } + this.placer = multiline ? new com_fancyfish_faeng_text_WrapCharacterPlacer(width,align,word,linePadding) : new com_fancyfish_faeng_text_CharacterPlacer(width,align); + } + ,getArray: function(map,fnt,color) { + var cmap = map.get(fnt); + if(cmap == null) { + cmap = new haxe_ds_IntMap(); + map.set(fnt,cmap); + } + var ar = cmap.get(color); + if(ar == null) { + ar = []; + cmap.set(color,ar); + } + return ar; + } + ,addText: function(txt,f,map,size,color) { + var fnt = f.get(); + var scale = size / fnt.size; + com_davidmaletz_faengfl_FormattedTextBase.placeCharacters(this.getArray(map,fnt,color),fnt,txt,this.placer,scale); + } + ,startCustomTag: function(code,data,map,insertText) { + return false; + } + ,endCustomTag: function(code) { + return false; + } + ,getFont: function(name) { + var font = com_fancyfish_faeng_text_FontManager.get(name); + if(font == null || font.get() == null) { + font = this.default_font; + } + return font; + } + ,parseFormattedText: function(str,map) { + var font = this.default_font; + var size = this.default_size; + var color = this.default_color; + var colorStack = []; + var i = 0; + var len = str.length; + var cur = 0; + var insertText = function(s) { + str = s + str.substring(i); + i = 0; + len = str.length; + }; + while(i < len) { + var n = str.indexOf("[",i); + if(n == -1) { + this.addText(str.substring(i),font,map,size,color); + break; + } + if(n != i) { + this.addText(str.substring(i,n),font,map,size,color); + } + i = n + 1; + if(n < str.length - 1 && str.charAt(n + 1) == "[") { + this.addText("[",font,map,size,color); + i += 1; + continue; + } + n = str.indexOf("]",i); + if(n == -1) { + this.addText(str.substring(i - 1),font,map,size,color); + break; + } + var code = str.substring(i,n); + i = n + 1; + if(HxOverrides.cca(code,0) == 47) { + code = code.substring(1); + switch(code) { + case "b": + font = this.default_font; + break; + case "color": + if(colorStack.length > 0) { + color = colorStack.pop(); + } else { + color = this.default_color; + } + break; + case "font": + font = this.default_font; + break; + case "i": + font = this.default_font; + break; + case "size": + size = this.default_size; + break; + default: + this.endCustomTag(code); + } + } else { + var id = code.indexOf("="); + var data = null; + if(id != -1) { + data = code.substring(id + 1); + code = code.substring(0,id); + } + switch(code) { + case "b": + font = this.bold; + break; + case "color": + if(data != null) { + colorStack.push(color); + color = com_davidmaletz_faengfl_FormattedTextBase.parseInt("0x" + data); + } + break; + case "font": + if(data != null) { + font = this.getFont(data); + } + break; + case "i": + font = this.italic; + break; + case "size": + if(data != null) { + size = com_davidmaletz_faengfl_FormattedTextBase.parseInt(data); + } + break; + default: + this.startCustomTag(code,data,map,insertText); + } + } + } + } + ,renderText: function(map) { + } + ,prepareMap: function(map) { + } + ,setText: function(txt) { + this.placer.reset(); + var map = new haxe_ds_ObjectMap(); + this.prepareMap(map); + this.parseFormattedText(txt,map); + this.placer.finish(); + this.renderText(map); + } + ,__class__: com_davidmaletz_faengfl_FormattedTextBase +}); +var com_davidmaletz_faengfl_FormattedText = function(width,multiline,txt,align,word) { + if(word == null) { + word = true; + } + if(align == null) { + align = 0; + } + com_davidmaletz_faengfl_FormattedTextBase.call(this,width,multiline,align,word); + this.text = new haxe_ds_ObjectMap(); + this.bounds = new com_fancyfish_faeng_display_Rectangle2D(); + if(txt != null) { + this.setText(txt); + } +}; +$hxClasses["com.davidmaletz.faengfl.FormattedText"] = com_davidmaletz_faengfl_FormattedText; +com_davidmaletz_faengfl_FormattedText.__name__ = ["com","davidmaletz","faengfl","FormattedText"]; +com_davidmaletz_faengfl_FormattedText.__interfaces__ = [com_davidmaletz_faengfl_Bounded]; +com_davidmaletz_faengfl_FormattedText.__super__ = com_davidmaletz_faengfl_FormattedTextBase; +com_davidmaletz_faengfl_FormattedText.prototype = $extend(com_davidmaletz_faengfl_FormattedTextBase.prototype,{ + text: null + ,bounds: null + ,getRectangle: function() { + return this.bounds; + } + ,renderIcons: function(c) { + if(c.character.userData != null) { + var i = js_Boot.__cast(c.character.userData() , openfl_display_DisplayObject); + i.set_x(c.get_x()); + i.set_y(c.get_y()); + this.addChild(i); + this.bounds.addRectangle(c.get_x(),c.get_y(),c.character.getWidth(),c.character.getHeight()); + return false; + } else { + return true; + } + } + ,renderText: function(map) { + this.bounds.reset(); + var fnt = map.keys(); + while(fnt.hasNext()) { + var fnt1 = fnt.next(); + var cmap = map.get(fnt1); + var ctext = this.text.get(fnt1); + var col = cmap.keys(); + while(col.hasNext()) { + var col1 = col.next(); + var chars = cmap.get(col1); + var text = ctext == null ? null : ctext.get(col1); + if(chars.length == 0) { + if(text != null) { + this.removeChild(text); + ctext.remove(col1); + } + } else { + chars = chars.filter($bind(this,this.renderIcons)); + if(text != null) { + text.update(chars); + } else { + text = new com_davidmaletz_faengfl_InnerText(chars,col1); + if(ctext == null) { + ctext = new haxe_ds_IntMap(); + this.text.set(fnt1,ctext); + } + this.addChild(text); + ctext.set(col1,text); + } + this.bounds.addRect(text.bounds); + } + } + } + } + ,prepareMap: function(map) { + var fnt = this.text.keys(); + while(fnt.hasNext()) { + var fnt1 = fnt.next(); + var m = new haxe_ds_IntMap(); + var col = this.text.get(fnt1).keys(); + while(col.hasNext()) { + var col1 = col.next(); + m.set(col1,[]); + } + map.set(fnt1,m); + } + } + ,__class__: com_davidmaletz_faengfl_FormattedText +}); +var com_davidmaletz_faengfl_InnerText = function(chrs,col) { + openfl_display_Sprite.call(this); + com_davidmaletz_faengfl_TextSprite.setColor(this,col); + this.bounds = new com_fancyfish_faeng_display_Rectangle2D(); + this.update(chrs); +}; +$hxClasses["com.davidmaletz.faengfl.InnerText"] = com_davidmaletz_faengfl_InnerText; +com_davidmaletz_faengfl_InnerText.__name__ = ["com","davidmaletz","faengfl","InnerText"]; +com_davidmaletz_faengfl_InnerText.__super__ = openfl_display_Sprite; +com_davidmaletz_faengfl_InnerText.prototype = $extend(openfl_display_Sprite.prototype,{ + bounds: null + ,update: function(chrs) { + this.get_graphics().clear(); + com_davidmaletz_faengfl_TextSprite.drawCharacters(chrs,chrs.length,this.get_graphics(),0,0,null,this.bounds); + } + ,__class__: com_davidmaletz_faengfl_InnerText +}); +var com_davidmaletz_faengfl_FramebufferSprite = function(w,h,pScale) { + if(pScale == null) { + pScale = 1; + } + this.colorMatrix = null; + com_davidmaletz_faengfl_ContainerSprite.call(this,w,h); + this.projection = new openfl_geom_Matrix(2.0 / w,0,0,-2.0 / h,-1,1); + this.pScale = pScale; +}; +$hxClasses["com.davidmaletz.faengfl.FramebufferSprite"] = com_davidmaletz_faengfl_FramebufferSprite; +com_davidmaletz_faengfl_FramebufferSprite.__name__ = ["com","davidmaletz","faengfl","FramebufferSprite"]; +com_davidmaletz_faengfl_FramebufferSprite._buffer = null; +com_davidmaletz_faengfl_FramebufferSprite._program = null; +com_davidmaletz_faengfl_FramebufferSprite._color_program = null; +com_davidmaletz_faengfl_FramebufferSprite._vertexSlot = null; +com_davidmaletz_faengfl_FramebufferSprite._transformSlot = null; +com_davidmaletz_faengfl_FramebufferSprite._colorVertexSlot = null; +com_davidmaletz_faengfl_FramebufferSprite._colorTransformSlot = null; +com_davidmaletz_faengfl_FramebufferSprite._colorMatrixSlot = null; +com_davidmaletz_faengfl_FramebufferSprite.getVertexShader = function() { + return "#ifdef GL_ES\nprecision mediump float;\n#endif\nattribute vec4 vertex; varying vec2 texCoord; uniform mat3 transform; void main(){texCoord = vertex.xy*0.5+0.5; vec3 v = transform*vertex.xyw; gl_Position = vec4(v.xy, 0.0, 1.0);}"; +}; +com_davidmaletz_faengfl_FramebufferSprite.getFragmentShader = function() { + return "#ifdef GL_ES\nprecision mediump float;\n#endif\nvarying vec2 texCoord; uniform sampler2D texture; void main(){vec4 c = texture2D(texture, texCoord); gl_FragColor = vec4(c.rgb, 1.0);}"; +}; +com_davidmaletz_faengfl_FramebufferSprite.compileProgram = function(GL,vert,frag) { + var program = GL.createProgram(); + var vs = com_davidmaletz_faengfl_FramebufferSprite.createShader(GL,vert,GL.VERTEX_SHADER); + var fs = com_davidmaletz_faengfl_FramebufferSprite.createShader(GL,frag,GL.FRAGMENT_SHADER); + GL.attachShader(program,vs); + GL.attachShader(program,fs); + GL.linkProgram(program); + if(GL.getProgramParameter(program,GL.LINK_STATUS) == 0) { + haxe_Log.trace(GL.getProgramInfoLog(program),{ fileName : "FramebufferSprite.hx", lineNumber : 104, className : "com.davidmaletz.faengfl.FramebufferSprite", methodName : "compileProgram"}); + haxe_Log.trace("VALIDATE_STATUS: " + Std.string(GL.getProgramParameter(program,GL.VALIDATE_STATUS)),{ fileName : "FramebufferSprite.hx", lineNumber : 105, className : "com.davidmaletz.faengfl.FramebufferSprite", methodName : "compileProgram"}); + haxe_Log.trace("ERROR: " + GL.getError(),{ fileName : "FramebufferSprite.hx", lineNumber : 106, className : "com.davidmaletz.faengfl.FramebufferSprite", methodName : "compileProgram"}); + throw new js__$Boot_HaxeError("Program Link Error"); + } + GL.deleteShader(vs); + GL.deleteShader(fs); + return program; +}; +com_davidmaletz_faengfl_FramebufferSprite.bindScreenProgram = function(GL,transform,colorMatrix) { + var transformSlot; + var vertexSlot; + if(colorMatrix == null) { + if(com_davidmaletz_faengfl_FramebufferSprite._program == null) { + com_davidmaletz_faengfl_FramebufferSprite._program = com_davidmaletz_faengfl_FramebufferSprite.compileProgram(GL,com_davidmaletz_faengfl_FramebufferSprite.getVertexShader(),com_davidmaletz_faengfl_FramebufferSprite.getFragmentShader()); + GL.useProgram(com_davidmaletz_faengfl_FramebufferSprite._program); + com_davidmaletz_faengfl_FramebufferSprite._vertexSlot = GL.getAttribLocation(com_davidmaletz_faengfl_FramebufferSprite._program,"vertex"); + com_davidmaletz_faengfl_FramebufferSprite._transformSlot = GL.getUniformLocation(com_davidmaletz_faengfl_FramebufferSprite._program,"transform"); + GL.uniform1i(GL.getUniformLocation(com_davidmaletz_faengfl_FramebufferSprite._program,"texture"),0); + } + GL.useProgram(com_davidmaletz_faengfl_FramebufferSprite._program); + transformSlot = com_davidmaletz_faengfl_FramebufferSprite._transformSlot; + vertexSlot = com_davidmaletz_faengfl_FramebufferSprite._vertexSlot; + } else { + if(com_davidmaletz_faengfl_FramebufferSprite._color_program == null) { + com_davidmaletz_faengfl_FramebufferSprite._color_program = com_davidmaletz_faengfl_FramebufferSprite.compileProgram(GL,com_davidmaletz_faengfl_FramebufferSprite.getColorVertexShader(),com_davidmaletz_faengfl_FramebufferSprite.getColorFragmentShader()); + GL.useProgram(com_davidmaletz_faengfl_FramebufferSprite._color_program); + com_davidmaletz_faengfl_FramebufferSprite._colorVertexSlot = GL.getAttribLocation(com_davidmaletz_faengfl_FramebufferSprite._color_program,"vertex"); + com_davidmaletz_faengfl_FramebufferSprite._colorTransformSlot = GL.getUniformLocation(com_davidmaletz_faengfl_FramebufferSprite._color_program,"transform"); + GL.uniform1i(GL.getUniformLocation(com_davidmaletz_faengfl_FramebufferSprite._color_program,"texture"),0); + com_davidmaletz_faengfl_FramebufferSprite._colorMatrixSlot = GL.getUniformLocation(com_davidmaletz_faengfl_FramebufferSprite._color_program,"colorMatrix"); + } + GL.useProgram(com_davidmaletz_faengfl_FramebufferSprite._color_program); + transformSlot = com_davidmaletz_faengfl_FramebufferSprite._colorTransformSlot; + vertexSlot = com_davidmaletz_faengfl_FramebufferSprite._colorVertexSlot; + if(com_davidmaletz_faengfl_FramebufferSprite.tmp_matrix == null) { + com_davidmaletz_faengfl_FramebufferSprite.tmp_matrix = lime_math__$Matrix4_Matrix4_$Impl_$.clone(colorMatrix); + } else { + lime_math__$Matrix4_Matrix4_$Impl_$.copyFrom(com_davidmaletz_faengfl_FramebufferSprite.tmp_matrix,colorMatrix); + } + lime_math__$Matrix4_Matrix4_$Impl_$.transpose(com_davidmaletz_faengfl_FramebufferSprite.tmp_matrix); + GL.uniformMatrix4fv(com_davidmaletz_faengfl_FramebufferSprite._colorMatrixSlot,false,com_davidmaletz_faengfl_FramebufferSprite.tmp_matrix); + } + GL.uniformMatrix3fv(transformSlot,false,transform.toArray(true)); + return vertexSlot; +}; +com_davidmaletz_faengfl_FramebufferSprite.getColorVertexShader = function() { + return com_davidmaletz_faengfl_FramebufferSprite.getVertexShader(); +}; +com_davidmaletz_faengfl_FramebufferSprite.getColorFragmentShader = function() { + return "#ifdef GL_ES\nprecision mediump float;\n#endif\nvarying vec2 texCoord; uniform sampler2D texture; uniform mat4 colorMatrix; void main(){vec4 c = texture2D(texture, texCoord); gl_FragColor = colorMatrix*vec4(c.rgb, 1.0);}"; +}; +com_davidmaletz_faengfl_FramebufferSprite.createShader = function(GL,source,type) { + var shader = GL.createShader(type); + GL.shaderSource(shader,source); + GL.compileShader(shader); + if(GL.getShaderParameter(shader,GL.COMPILE_STATUS) == 0) { + haxe_Log.trace(GL.getShaderInfoLog(shader),{ fileName : "FramebufferSprite.hx", lineNumber : 140, className : "com.davidmaletz.faengfl.FramebufferSprite", methodName : "createShader"}); + throw new js__$Boot_HaxeError("Shader Compile Error"); + } + return shader; +}; +com_davidmaletz_faengfl_FramebufferSprite.tmp_matrix = null; +com_davidmaletz_faengfl_FramebufferSprite.drawQuad = function(GL,vertexSlot) { + if(com_davidmaletz_faengfl_FramebufferSprite._buffer == null) { + var vertices = [-1.0,-1.0,1.0,-1.0,-1.0,1.0,1.0,-1.0,1.0,1.0,-1.0,1.0]; + com_davidmaletz_faengfl_FramebufferSprite._buffer = GL.createBuffer(); + GL.bindBuffer(GL.ARRAY_BUFFER,com_davidmaletz_faengfl_FramebufferSprite._buffer); + var GL1 = GL.ARRAY_BUFFER; + var this1; + if(vertices != null) { + this1 = new Float32Array(vertices); + } else { + this1 = null; + } + GL.bufferData(GL1,this1,GL.STATIC_DRAW); + GL.bindBuffer(GL.ARRAY_BUFFER,null); + } + GL.enableVertexAttribArray(vertexSlot); + GL.bindBuffer(GL.ARRAY_BUFFER,com_davidmaletz_faengfl_FramebufferSprite._buffer); + GL.vertexAttribPointer(vertexSlot,2,GL.FLOAT,false,0,0); + GL.drawArrays(GL.TRIANGLES,0,6); + GL.bindBuffer(GL.ARRAY_BUFFER,null); + GL.bindTexture(GL.TEXTURE_2D,null); + GL.disableVertexAttribArray(vertexSlot); +}; +com_davidmaletz_faengfl_FramebufferSprite.__super__ = com_davidmaletz_faengfl_ContainerSprite; +com_davidmaletz_faengfl_FramebufferSprite.prototype = $extend(com_davidmaletz_faengfl_ContainerSprite.prototype,{ + framebuffer: null + ,texture: null + ,projection: null + ,colorMatrix: null + ,pScale: null + ,setupFBO: function(GL,width,height) { + this.framebuffer = GL.createFramebuffer(); + this.texture = GL.createTexture(); + GL.bindTexture(GL.TEXTURE_2D,this.texture); + GL.texImage2D(GL.TEXTURE_2D,0,GL.RGBA,width,height,0,GL.RGBA,GL.UNSIGNED_BYTE,null); + GL.texParameteri(GL.TEXTURE_2D,GL.TEXTURE_WRAP_S,GL.CLAMP_TO_EDGE); + GL.texParameteri(GL.TEXTURE_2D,GL.TEXTURE_WRAP_T,GL.CLAMP_TO_EDGE); + GL.texParameteri(GL.TEXTURE_2D,GL.TEXTURE_MIN_FILTER,GL.NEAREST); + GL.texParameteri(GL.TEXTURE_2D,GL.TEXTURE_MAG_FILTER,GL.NEAREST); + GL.bindFramebuffer(GL.FRAMEBUFFER,this.framebuffer); + GL.framebufferTexture2D(GL.FRAMEBUFFER,GL.COLOR_ATTACHMENT0,GL.TEXTURE_2D,this.texture,0); + var status = GL.checkFramebufferStatus(GL.FRAMEBUFFER); + if(status != GL.FRAMEBUFFER_COMPLETE) { + haxe_Log.trace("Framebuffer error: " + status,{ fileName : "FramebufferSprite.hx", lineNumber : 92, className : "com.davidmaletz.faengfl.FramebufferSprite", methodName : "setupFBO"}); + } + } + ,getOldFramebuffer: function() { + return null; + } + ,getTransform: function() { + return this.__getWorldTransform().clone().invert(); + } + ,renderAll: function(renderSession) { + com_davidmaletz_faengfl_ContainerSprite.prototype.__renderGL.call(this,renderSession); + } + ,renderFramebuffer: function(renderSession,clear) { + if(clear == null) { + clear = true; + } + var GL = renderSession.gl; + var old = renderSession.projectionMatrix.clone(); + var m = this.getTransform(); + m.concat(this.projection); + renderSession.projectionMatrix.copyFrom(m); + if(this.framebuffer == null) { + var old_program = renderSession.shaderManager.currentShader.program; + this.setupFBO(GL,Math.round(this._width * this.pScale),Math.round(this._height * this.pScale)); + GL.useProgram(old_program); + } else { + GL.bindFramebuffer(GL.FRAMEBUFFER,this.framebuffer); + } + GL.viewport(0,0,Math.round(this._width * this.pScale),Math.round(this._height * this.pScale)); + if(clear) { + GL.clear(GL.COLOR_BUFFER_BIT); + } + this.renderAll(renderSession); + renderSession.spriteBatch.flush(); + renderSession.projectionMatrix.copyFrom(old); + return old; + } + ,makeTransform: function(old) { + var m = this.projection.clone().invert(); + m.concat(this.__getWorldTransform()); + m.concat(old); + return m; + } + ,toScreen: function(renderSession,old) { + var GL = renderSession.gl; + var old_program = renderSession.shaderManager.currentShader.program; + var fb = this.getOldFramebuffer(); + GL.bindFramebuffer(GL.FRAMEBUFFER,fb == null ? null : fb.framebuffer); + var vertexSlot = com_davidmaletz_faengfl_FramebufferSprite.bindScreenProgram(GL,this.makeTransform(old),this.colorMatrix); + GL.viewport(0,0,fb == null ? this.stage.stageWidth : Math.round(fb.getWidth() * fb.pScale),fb == null ? this.stage.stageHeight : Math.round(fb.getHeight() * fb.pScale)); + GL.activeTexture(GL.TEXTURE0); + GL.bindTexture(GL.TEXTURE_2D,this.texture); + com_davidmaletz_faengfl_FramebufferSprite.drawQuad(GL,vertexSlot); + GL.useProgram(old_program); + } + ,__renderGL: function(renderSession) { + if(this.get_visible() && this.stage != null && this.get_numChildren() != 0) { + renderSession.spriteBatch.flush(); + this.toScreen(renderSession,this.renderFramebuffer(renderSession)); + } + } + ,__class__: com_davidmaletz_faengfl_FramebufferSprite +}); +var com_davidmaletz_faengfl_GlowSprite = function() { + openfl_display_Sprite.call(this); +}; +$hxClasses["com.davidmaletz.faengfl.GlowSprite"] = com_davidmaletz_faengfl_GlowSprite; +com_davidmaletz_faengfl_GlowSprite.__name__ = ["com","davidmaletz","faengfl","GlowSprite"]; +com_davidmaletz_faengfl_GlowSprite.makeGlow = function(__renderGL,renderSession) { + renderSession.spriteBatch.flush(); + openfl__$internal_renderer_opengl_utils_BlendModeManager.ALPHA_VALUE = 1; + renderSession.blendModeManager.setBlendMode(null); + __renderGL(renderSession); + renderSession.spriteBatch.flush(); + openfl__$internal_renderer_opengl_utils_BlendModeManager.ALPHA_VALUE = 0; + renderSession.blendModeManager.setBlendMode(null); +}; +com_davidmaletz_faengfl_GlowSprite.__super__ = openfl_display_Sprite; +com_davidmaletz_faengfl_GlowSprite.prototype = $extend(openfl_display_Sprite.prototype,{ + superRenderGL: function(renderSession) { + openfl_display_Sprite.prototype.__renderGL.call(this,renderSession); + } + ,__renderGL: function(renderSession) { + com_davidmaletz_faengfl_GlowSprite.makeGlow($bind(this,this.superRenderGL),renderSession); + } + ,__class__: com_davidmaletz_faengfl_GlowSprite +}); +var com_davidmaletz_faengfl_IScrollable = function() { }; +$hxClasses["com.davidmaletz.faengfl.IScrollable"] = com_davidmaletz_faengfl_IScrollable; +com_davidmaletz_faengfl_IScrollable.__name__ = ["com","davidmaletz","faengfl","IScrollable"]; +com_davidmaletz_faengfl_IScrollable.prototype = { + updateScroll: null + ,__class__: com_davidmaletz_faengfl_IScrollable +}; +var com_davidmaletz_faengfl_InvokeLater = function(func,f,paused) { + if(paused == null) { + paused = false; + } + this.onRemoved = null; + this.onComplete = func; + this.frames = f; + this.paused = paused; + if(paused) { + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.handle_frame),false,PriorityManager.getPriority()); + } else { + com_davidmaletz_faengfl_FaengFL.addEnterFrame(this); + } +}; +$hxClasses["com.davidmaletz.faengfl.InvokeLater"] = com_davidmaletz_faengfl_InvokeLater; +com_davidmaletz_faengfl_InvokeLater.__name__ = ["com","davidmaletz","faengfl","InvokeLater"]; +com_davidmaletz_faengfl_InvokeLater.__interfaces__ = [com_davidmaletz_faengfl_EnterFrameHandler]; +com_davidmaletz_faengfl_InvokeLater.prototype = { + onComplete: null + ,frames: null + ,onRemoved: null + ,paused: null + ,destroy: function() { + com_davidmaletz_faengfl_FaengFL.removeEnterFrame(this); + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.handle_frame)); + } + ,enter_frame: function(frames) { + if(this.paused || com_davidmaletz_faengfl_Window.window_ct == 0) { + if(this.frames > 0) { + this.frames -= frames; + return; + } + this.destroy(); + if(this.onRemoved != null) { + this.onRemoved(this); + } + this.onComplete(); + } + } + ,handle_frame: function(e) { + this.enter_frame(com_davidmaletz_faengfl_FaengFL.frameTime); + } + ,__class__: com_davidmaletz_faengfl_InvokeLater +}; +var openfl_geom_Point = function(x,y) { + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + this.x = x; + this.y = y; +}; +$hxClasses["openfl.geom.Point"] = openfl_geom_Point; +openfl_geom_Point.__name__ = ["openfl","geom","Point"]; +openfl_geom_Point.distance = function(pt1,pt2) { + var dx = pt1.x - pt2.x; + var dy = pt1.y - pt2.y; + return Math.sqrt(dx * dx + dy * dy); +}; +openfl_geom_Point.interpolate = function(pt1,pt2,f) { + return new openfl_geom_Point(pt2.x + f * (pt1.x - pt2.x),pt2.y + f * (pt1.y - pt2.y)); +}; +openfl_geom_Point.polar = function(len,angle) { + return new openfl_geom_Point(len * Math.cos(angle),len * Math.sin(angle)); +}; +openfl_geom_Point.prototype = { + x: null + ,y: null + ,clone: function() { + return new openfl_geom_Point(this.x,this.y); + } + ,copyFrom: function(sourcePoint) { + this.x = sourcePoint.x; + this.y = sourcePoint.y; + } + ,offset: function(dx,dy) { + this.x += dx; + this.y += dy; + } + ,setTo: function(xa,ya) { + this.x = xa; + this.y = ya; + } + ,__toLimeVector2: function() { + return new lime_math_Vector2(this.x,this.y); + } + ,__class__: openfl_geom_Point +}; +var openfl_geom_Rectangle = function(x,y,width,height) { + if(height == null) { + height = 0; + } + if(width == null) { + width = 0; + } + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + this.x = x; + this.y = y; + this.width = width; + this.height = height; +}; +$hxClasses["openfl.geom.Rectangle"] = openfl_geom_Rectangle; +openfl_geom_Rectangle.__name__ = ["openfl","geom","Rectangle"]; +openfl_geom_Rectangle.prototype = { + height: null + ,width: null + ,x: null + ,y: null + ,clone: function() { + return new openfl_geom_Rectangle(this.x,this.y,this.width,this.height); + } + ,contains: function(x,y) { + if(x >= this.x && y >= this.y && x < this.get_right()) { + return y < this.get_bottom(); + } else { + return false; + } + } + ,containsPoint: function(point) { + return this.contains(point.x,point.y); + } + ,containsRect: function(rect) { + if(rect.width <= 0 || rect.height <= 0) { + if(rect.x > this.x && rect.y > this.y && rect.get_right() < this.get_right()) { + return rect.get_bottom() < this.get_bottom(); + } else { + return false; + } + } else if(rect.x >= this.x && rect.y >= this.y && rect.get_right() <= this.get_right()) { + return rect.get_bottom() <= this.get_bottom(); + } else { + return false; + } + } + ,copyFrom: function(sourceRect) { + this.x = sourceRect.x; + this.y = sourceRect.y; + this.width = sourceRect.width; + this.height = sourceRect.height; + } + ,inflate: function(dx,dy) { + this.x -= dx; + this.width += dx * 2; + this.y -= dy; + this.height += dy * 2; + } + ,intersection: function(toIntersect) { + var x0 = this.x < toIntersect.x ? toIntersect.x : this.x; + var x1 = this.get_right() > toIntersect.get_right() ? toIntersect.get_right() : this.get_right(); + if(x1 <= x0) { + return new openfl_geom_Rectangle(); + } + var y0 = this.y < toIntersect.y ? toIntersect.y : this.y; + var y1 = this.get_bottom() > toIntersect.get_bottom() ? toIntersect.get_bottom() : this.get_bottom(); + if(y1 <= y0) { + return new openfl_geom_Rectangle(); + } + return new openfl_geom_Rectangle(x0,y0,x1 - x0,y1 - y0); + } + ,intersects: function(toIntersect) { + var x0 = this.x < toIntersect.x ? toIntersect.x : this.x; + var x1 = this.get_right() > toIntersect.get_right() ? toIntersect.get_right() : this.get_right(); + if(x1 <= x0) { + return false; + } + var y0 = this.y < toIntersect.y ? toIntersect.y : this.y; + var y1 = this.get_bottom() > toIntersect.get_bottom() ? toIntersect.get_bottom() : this.get_bottom(); + return y1 > y0; + } + ,isEmpty: function() { + if(!(this.width <= 0)) { + return this.height <= 0; + } else { + return true; + } + } + ,setEmpty: function() { + this.x = this.y = this.width = this.height = 0; + } + ,setTo: function(xa,ya,widtha,heighta) { + this.x = xa; + this.y = ya; + this.width = widtha; + this.height = heighta; + } + ,__expand: function(x,y,width,height) { + if(this.width == 0 && this.height == 0) { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + return; + } + var cacheRight = this.get_right(); + var cacheBottom = this.get_bottom(); + if(this.x > x) { + this.x = x; + this.width = cacheRight - x; + } + if(this.y > y) { + this.y = y; + this.height = cacheBottom - y; + } + if(cacheRight < x + width) { + this.width = x + width - this.x; + } + if(cacheBottom < y + height) { + this.height = y + height - this.y; + } + } + ,__toLimeRectangle: function() { + return new lime_math_Rectangle(this.x,this.y,this.width,this.height); + } + ,__transform: function(rect,m) { + var tx0 = m.a * this.x + m.c * this.y; + var tx1 = tx0; + var ty0 = m.b * this.x + m.d * this.y; + var ty1 = ty0; + var tx = m.a * (this.x + this.width) + m.c * this.y; + var ty = m.b * (this.x + this.width) + m.d * this.y; + if(tx < tx0) { + tx0 = tx; + } + if(ty < ty0) { + ty0 = ty; + } + if(tx > tx1) { + tx1 = tx; + } + if(ty > ty1) { + ty1 = ty; + } + tx = m.a * (this.x + this.width) + m.c * (this.y + this.height); + ty = m.b * (this.x + this.width) + m.d * (this.y + this.height); + if(tx < tx0) { + tx0 = tx; + } + if(ty < ty0) { + ty0 = ty; + } + if(tx > tx1) { + tx1 = tx; + } + if(ty > ty1) { + ty1 = ty; + } + tx = m.a * this.x + m.c * (this.y + this.height); + ty = m.b * this.x + m.d * (this.y + this.height); + if(tx < tx0) { + tx0 = tx; + } + if(ty < ty0) { + ty0 = ty; + } + if(tx > tx1) { + tx1 = tx; + } + if(ty > ty1) { + ty1 = ty; + } + rect.setTo(tx0 + m.tx,ty0 + m.ty,tx1 - tx0,ty1 - ty0); + } + ,get_bottom: function() { + return this.y + this.height; + } + ,set_bottom: function(b) { + this.height = b - this.y; + return b; + } + ,get_left: function() { + return this.x; + } + ,set_left: function(l) { + this.width -= l - this.x; + this.x = l; + return l; + } + ,get_right: function() { + return this.x + this.width; + } + ,set_right: function(r) { + this.width = r - this.x; + return r; + } + ,get_top: function() { + return this.y; + } + ,set_top: function(t) { + this.height -= t - this.y; + this.y = t; + return t; + } + ,get_topLeft: function() { + return new openfl_geom_Point(this.x,this.y); + } + ,__class__: openfl_geom_Rectangle + ,__properties__: {get_topLeft:"get_topLeft",set_top:"set_top",get_top:"get_top",set_right:"set_right",get_right:"get_right",set_left:"set_left",get_left:"get_left",set_bottom:"set_bottom",get_bottom:"get_bottom"} +}; +var openfl_geom_ColorTransform = function(redMultiplier,greenMultiplier,blueMultiplier,alphaMultiplier,redOffset,greenOffset,blueOffset,alphaOffset) { + if(alphaOffset == null) { + alphaOffset = 0; + } + if(blueOffset == null) { + blueOffset = 0; + } + if(greenOffset == null) { + greenOffset = 0; + } + if(redOffset == null) { + redOffset = 0; + } + if(alphaMultiplier == null) { + alphaMultiplier = 1; + } + if(blueMultiplier == null) { + blueMultiplier = 1; + } + if(greenMultiplier == null) { + greenMultiplier = 1; + } + if(redMultiplier == null) { + redMultiplier = 1; + } + this.redMultiplier = redMultiplier; + this.greenMultiplier = greenMultiplier; + this.blueMultiplier = blueMultiplier; + this.alphaMultiplier = alphaMultiplier; + this.redOffset = redOffset; + this.greenOffset = greenOffset; + this.blueOffset = blueOffset; + this.alphaOffset = alphaOffset; +}; +$hxClasses["openfl.geom.ColorTransform"] = openfl_geom_ColorTransform; +openfl_geom_ColorTransform.__name__ = ["openfl","geom","ColorTransform"]; +openfl_geom_ColorTransform.prototype = { + alphaMultiplier: null + ,alphaOffset: null + ,blueMultiplier: null + ,blueOffset: null + ,greenMultiplier: null + ,greenOffset: null + ,redMultiplier: null + ,redOffset: null + ,__clone: function() { + return new openfl_geom_ColorTransform(this.redMultiplier,this.greenMultiplier,this.blueMultiplier,this.alphaMultiplier,this.redOffset,this.greenOffset,this.blueOffset,this.alphaOffset); + } + ,__combine: function(ct) { + this.redMultiplier *= ct.redMultiplier; + this.greenMultiplier *= ct.greenMultiplier; + this.blueMultiplier *= ct.blueMultiplier; + this.alphaMultiplier *= ct.alphaMultiplier; + this.redOffset += ct.redOffset; + this.greenOffset += ct.greenOffset; + this.blueOffset += ct.blueOffset; + this.alphaOffset += ct.alphaOffset; + } + ,__equals: function(ct,skipAlphaMultiplier) { + if(skipAlphaMultiplier == null) { + skipAlphaMultiplier = false; + } + if(ct != null && this.redMultiplier == ct.redMultiplier && this.greenMultiplier == ct.greenMultiplier && this.blueMultiplier == ct.blueMultiplier && (skipAlphaMultiplier || this.alphaMultiplier == ct.alphaMultiplier) && this.redOffset == ct.redOffset && this.greenOffset == ct.greenOffset && this.blueOffset == ct.blueOffset) { + return this.alphaOffset == ct.alphaOffset; + } else { + return false; + } + } + ,__isDefault: function() { + if(this.redMultiplier == 1 && this.greenMultiplier == 1 && this.blueMultiplier == 1 && this.alphaMultiplier == 1 && this.redOffset == 0 && this.greenOffset == 0 && this.blueOffset == 0) { + return this.alphaOffset == 0; + } else { + return false; + } + } + ,__toLimeColorMatrix: function() { + var array = [this.redMultiplier,0,0,0,this.redOffset / 255,0,this.greenMultiplier,0,0,this.greenOffset / 255,0,0,this.blueMultiplier,0,this.blueOffset / 255,0,0,0,this.alphaMultiplier,this.alphaOffset / 255]; + var this1; + if(array != null) { + this1 = new Float32Array(array); + } else { + this1 = null; + } + return this1; + } + ,__class__: openfl_geom_ColorTransform +}; +var com_davidmaletz_faengfl_LayerManager = function(b,w,h,c,r,map) { + this.bitmap = b; + this.width = w; + this.height = h; + this.cols = c; + this.rows = r; + this.colors = map; +}; +$hxClasses["com.davidmaletz.faengfl.LayerManager"] = com_davidmaletz_faengfl_LayerManager; +com_davidmaletz_faengfl_LayerManager.__name__ = ["com","davidmaletz","faengfl","LayerManager"]; +com_davidmaletz_faengfl_LayerManager.map = null; +com_davidmaletz_faengfl_LayerManager.tinted = null; +com_davidmaletz_faengfl_LayerManager.getColor = function(colors,s) { + var ret = s == null ? null : colors.get(s); + if(ret == null) { + return 10724259; + } else { + return ret; + } +}; +com_davidmaletz_faengfl_LayerManager.getOffset = function(offsets,s) { + var ret = offsets == null || s == null ? null : offsets.get(s); + return ret; +}; +com_davidmaletz_faengfl_LayerManager.generate = function(colors,offsets,xml) { + var width = Std.parseInt(xml.get("width")); + var height = Std.parseInt(xml.get("height")); + var cols = Std.parseInt(xml.get("cols")); + var rows = Std.parseInt(xml.get("rows")); + var b = new openfl_display_BitmapData(width * cols,height * rows,true,0); + var l = xml.elementsNamed("layer"); + while(l.hasNext()) { + var l1 = l.next(); + com_davidmaletz_faengfl_LayerManager.addLayer(colors,offsets,b,l1,width,height,cols); + } + return new com_davidmaletz_faengfl_LayerManager(b,width,height,cols,rows,colors); +}; +com_davidmaletz_faengfl_LayerManager.getBitmap = function(sheet,color) { + var b = sheet.getInnerBitmap(); + if(color == 10724259) { + return b; + } + var id = sheet.id + StringTools.hex(color,6); + if(com_davidmaletz_faengfl_LayerManager.tinted == null) { + com_davidmaletz_faengfl_LayerManager.tinted = new haxe_ds_StringMap(); + } + var ret = com_davidmaletz_faengfl_LayerManager.tinted.get(id); + if(ret == null) { + com_davidmaletz_faengfl_TextSprite.makeColor(com_davidmaletz_faengfl_LayerManager.transform,color,163); + com_davidmaletz_faengfl_LayerManager.rect.setTo(0,0,b.width,b.height); + com_davidmaletz_faengfl_LayerManager.point.setTo(0,0); + ret = new openfl_display_BitmapData(b.width,b.height,true,0); + ret.copyPixels(b,com_davidmaletz_faengfl_LayerManager.rect,com_davidmaletz_faengfl_LayerManager.point); + ret.colorTransform(com_davidmaletz_faengfl_LayerManager.rect,com_davidmaletz_faengfl_LayerManager.transform); + com_davidmaletz_faengfl_LayerManager.tinted.set(id,ret); + } + return ret; +}; +com_davidmaletz_faengfl_LayerManager.addLayer = function(colors,offsets,b,xml,w,h,cols) { + var offset = com_davidmaletz_faengfl_LayerManager.getOffset(offsets,xml.get("offset")); + if(offset != null && offset.hidden) { + return; + } + var tile = com_davidmaletz_tiles_Tile.get(offset == null || offset.tile == null ? xml.get("tile") : offset.tile); + var color = com_davidmaletz_faengfl_LayerManager.getColor(colors,xml.get("color")); + if(tile == null) { + return; + } + var base = tile.getTileBase(); + if(base == null) { + return; + } + var a = new com_davidmaletz_tiles_TileAnimation("",xml); + var ct = Math.round(a.getMaxTime()); + var _g1 = 0; + var _g = ct; + while(_g1 < _g) { + var i = _g1++; + var f = a.getFrame(a.getFrameAtTime(i + 1)); + var row = Math.floor(i / cols); + if(!f.visible) { + continue; + } + var tx = f.x + base.x + (offset == null ? 0 : offset.offset); + var ty = f.y + base.y; + var offX = 0; + var offY = 0; + var sf = base.sheet.getFrame(tx,ty); + var idx; + if(sf == null) { + idx = base.sheet.getIdx(tx,ty); + } else { + idx = sf.id; + offX = sf.offsetX; + offY = sf.offsetY; + } + var bitmap = com_davidmaletz_faengfl_LayerManager.getBitmap(base.sheet,color); + var r = base.sheet.getTileRect(idx); + if(r == null) { + return; + } + var oy = offY + base.offsetY + f.offsetY; + com_davidmaletz_faengfl_LayerManager.point.setTo(offX + base.offsetX + f.offsetX + (i - row * cols) * w,oy + row * h); + if(offset != null && offset.clipY > oy) { + oy = offset.clipY - oy; + r = r.clone(); + var _g2 = r; + _g2.set_top(_g2.get_top() + oy); + com_davidmaletz_faengfl_LayerManager.point.y += oy; + } + b.copyPixels(bitmap,r,com_davidmaletz_faengfl_LayerManager.point,null,null,true); + } +}; +com_davidmaletz_faengfl_LayerManager.create = function(id,colors,offsets) { + var xml = com_davidmaletz_faengfl_LayerManager.get(id); + if(xml == null) { + return null; + } + if(com_davidmaletz_faengfl_LayerManager.map == null) { + com_davidmaletz_faengfl_LayerManager.map = new haxe_ds_StringMap(); + } + var buf = new StringBuf(); + buf.add(id); + var c = colors.keys(); + while(c.hasNext()) { + var c1 = c.next(); + buf.add(c1); + buf.add(StringTools.hex(colors.get(c1),6)); + } + if(offsets != null) { + var c2 = offsets.keys(); + while(c2.hasNext()) { + var c3 = c2.next(); + var off = offsets.get(c3); + buf.add(c3); + if(off == null) { + buf.add("0null000000"); + } else if(off.hidden) { + buf.add("hide"); + } else { + buf.add((off.clipY == null ? "null" : "" + off.clipY) + off.tile + StringTools.hex(off.offset,6)); + } + } + } + var i = buf.toString(); + var b = com_davidmaletz_faengfl_LayerManager.map.get(i); + if(b == null) { + b = com_davidmaletz_faengfl_LayerManager.generate(colors,offsets,xml); + com_davidmaletz_faengfl_LayerManager.map.set(i,b); + } + return b; +}; +com_davidmaletz_faengfl_LayerManager.colorsFromXml = function(xml) { + var colors = new haxe_ds_StringMap(); + var e = xml.elementsNamed("color"); + while(e.hasNext()) { + var e1 = e.next(); + colors.set(e1.get("id"),Std.parseInt("0x" + e1.get("value"))); + } + return colors; +}; +com_davidmaletz_faengfl_LayerManager.offsetsFromXml = function(xml) { + var offsets = new haxe_ds_StringMap(); + var ct = 0; + var e = xml.elementsNamed("offset"); + while(e.hasNext()) { + var e1 = e.next(); + offsets.set(e1.get("id"),com_davidmaletz_faengfl_TileOffset.fromXML(e1)); + ++ct; + } + if(ct == 0) { + return null; + } else { + return offsets; + } +}; +com_davidmaletz_faengfl_LayerManager.layers = null; +com_davidmaletz_faengfl_LayerManager.load = function(e) { + if(com_davidmaletz_faengfl_LayerManager.layers == null) { + com_davidmaletz_faengfl_LayerManager.layers = new haxe_ds_StringMap(); + } + var id = e.get("id"); + if(com_davidmaletz_faengfl_LayerManager.layers.exists(id)) { + haxe_Log.trace("Overwrite Layers: " + id,{ fileName : "LayerManager.hx", lineNumber : 102, className : "com.davidmaletz.faengfl.LayerManager", methodName : "load"}); + } + com_davidmaletz_faengfl_LayerManager.layers.set(id,e); +}; +com_davidmaletz_faengfl_LayerManager.get = function(id) { + if(com_davidmaletz_faengfl_LayerManager.layers == null) { + return null; + } else { + return com_davidmaletz_faengfl_LayerManager.layers.get(id); + } +}; +com_davidmaletz_faengfl_LayerManager.reset = function() { + com_davidmaletz_faengfl_LayerManager.layers = null; +}; +com_davidmaletz_faengfl_LayerManager.prototype = { + bitmap: null + ,width: null + ,height: null + ,cols: null + ,rows: null + ,colors: null + ,tile_bitmap: null + ,toBitmap: function() { + if(this.tile_bitmap == null) { + this.tile_bitmap = com_davidmaletz_faengfl_AutoTileBitmap.fromLayers(this); + } + return this.tile_bitmap; + } + ,__class__: com_davidmaletz_faengfl_LayerManager +}; +var com_davidmaletz_faengfl_Preview = function(id,colors,offsets,frame) { + if(frame == null) { + frame = 0; + } + openfl_display_Sprite.call(this); + var xml = com_davidmaletz_faengfl_LayerManager.get(id); + this.colors = new haxe_ds_StringMap(); + this.offsets = new haxe_ds_StringMap(); + if(xml != null) { + var l = xml.elementsNamed("layer"); + while(l.hasNext()) { + var l1 = l.next(); + this.addLayer(l1,frame,colors,offsets); + } + } +}; +$hxClasses["com.davidmaletz.faengfl.Preview"] = com_davidmaletz_faengfl_Preview; +com_davidmaletz_faengfl_Preview.__name__ = ["com","davidmaletz","faengfl","Preview"]; +com_davidmaletz_faengfl_Preview.__super__ = openfl_display_Sprite; +com_davidmaletz_faengfl_Preview.prototype = $extend(openfl_display_Sprite.prototype,{ + colors: null + ,offsets: null + ,setColor: function(id,color) { + var ar = this.colors.get(id); + if(ar != null) { + var _g = 0; + while(_g < ar.length) { + var s = ar[_g]; + ++_g; + com_davidmaletz_faengfl_TextSprite.setColor(s,color,163); + } + } + } + ,setOffset: function(id,off) { + var ar = this.offsets.get(id); + if(ar != null) { + var _g = 0; + while(_g < ar.length) { + var s = ar[_g]; + ++_g; + s.setOffset(off); + } + } + } + ,addLayer: function(xml,f,colors,offsets) { + var tile = com_davidmaletz_tiles_Tile.get(xml.get("tile")); + if(tile == null) { + return; + } + var a = new com_davidmaletz_tiles_TileAnimation("",xml); + a.tile = null; + ++f; + if(f >= a.getMaxTime()) { + return; + } + var s; + if(offsets != null && xml.exists("offset")) { + var id = xml.get("offset"); + var off = com_davidmaletz_faengfl_LayerManager.getOffset(offsets,id); + var o = new com_davidmaletz_faengfl__$LayerManager_OffsetSprite(tile,off,a,a.getFrameAtTime(f)); + var ar = this.offsets.get(id); + if(ar == null) { + ar = []; + this.offsets.set(id,ar); + } + ar.push(o); + s = o; + } else { + s = a.createLayerForFrame(tile,a.getFrameAtTime(f)); + } + var id1 = xml.get("color"); + if(id1 != null) { + var ar1 = this.colors.get(id1); + if(ar1 == null) { + ar1 = []; + this.colors.set(id1,ar1); + } + ar1.push(s); + } + com_davidmaletz_faengfl_TextSprite.setColor(s,com_davidmaletz_faengfl_LayerManager.getColor(colors,id1),163); + this.addChild(s); + } + ,addOffsetLayer: function(color,offset,colors,offsets,a,f) { + if(f == null) { + f = 0; + } + if(f >= a.getMaxTime()) { + return; + } + var off = com_davidmaletz_faengfl_LayerManager.getOffset(offsets,offset); + var s = new com_davidmaletz_faengfl__$LayerManager_OffsetSprite(null,off,a,a.getFrameAtTime(f)); + var ar = this.offsets.get(offset); + if(ar == null) { + ar = []; + this.offsets.set(offset,ar); + } + ar.push(s); + if(color != null) { + var ar1 = this.colors.get(color); + if(ar1 == null) { + ar1 = []; + this.colors.set(color,ar1); + } + ar1.push(s); + } + com_davidmaletz_faengfl_TextSprite.setColor(s,com_davidmaletz_faengfl_LayerManager.getColor(colors,color),163); + this.addChild(s); + } + ,__class__: com_davidmaletz_faengfl_Preview +}); +var com_davidmaletz_faengfl__$LayerManager_OffsetSprite = function(t,off,a,f) { + openfl_display_Sprite.call(this); + this.set_visible(off == null || !off.hidden); + this.default_tile = t; + this.tile = new com_davidmaletz_tiles_render_TileOffsetRenderer(t,0,0); + this.animation = a; + this.frame = f; + this.setOffset(off); +}; +$hxClasses["com.davidmaletz.faengfl._LayerManager.OffsetSprite"] = com_davidmaletz_faengfl__$LayerManager_OffsetSprite; +com_davidmaletz_faengfl__$LayerManager_OffsetSprite.__name__ = ["com","davidmaletz","faengfl","_LayerManager","OffsetSprite"]; +com_davidmaletz_faengfl__$LayerManager_OffsetSprite.__super__ = openfl_display_Sprite; +com_davidmaletz_faengfl__$LayerManager_OffsetSprite.prototype = $extend(openfl_display_Sprite.prototype,{ + tile: null + ,default_tile: null + ,animation: null + ,frame: null + ,setOffset: function(off) { + if(off != null && off.hidden) { + this.set_visible(false); + return; + } + var t = off == null || off.tile == null ? this.default_tile : com_davidmaletz_tiles_Tile.get(off.tile); + if(t == null) { + this.set_visible(false); + return; + } + var offset = off == null ? 0 : off.offset; + this.set_visible(true); + if(this.tile.tile != t || offset != this.tile.offsetX) { + this.tile.tile = t; + this.tile.offsetX = offset; + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this); + this.addChild(this.animation.createLayerForFrame(this.tile,this.frame)); + } + } + ,__class__: com_davidmaletz_faengfl__$LayerManager_OffsetSprite +}); +var com_davidmaletz_faengfl_TileOffset = function(t,o,hide) { + this.clipY = 0; + this.tile = t; + this.offset = o == null ? 0 : o; + this.hidden = hide; +}; +$hxClasses["com.davidmaletz.faengfl.TileOffset"] = com_davidmaletz_faengfl_TileOffset; +com_davidmaletz_faengfl_TileOffset.__name__ = ["com","davidmaletz","faengfl","TileOffset"]; +com_davidmaletz_faengfl_TileOffset.read = function(b) { + var i = b.readInt32(); + if(i == 16777215) { + return com_davidmaletz_faengfl_TileOffset.HIDDEN; + } else { + return new com_davidmaletz_faengfl_TileOffset(com_fancyfish_faeng_common_UTFUtils.readUTF(b),i,false); + } +}; +com_davidmaletz_faengfl_TileOffset.fromXML = function(e) { + return new com_davidmaletz_faengfl_TileOffset(e.get("tile"),e.exists("offset") ? Std.parseInt(e.get("offset")) : Std.parseInt(e.get("value")),e.get("hidden") == "true"); +}; +com_davidmaletz_faengfl_TileOffset.prototype = { + tile: null + ,offset: null + ,hidden: null + ,clipY: null + ,equals: function(o) { + if(o == null) { + if(this.tile == null && this.offset == 0) { + return !this.hidden; + } else { + return false; + } + } else if(this.hidden) { + return o.hidden; + } else if(this.tile == o.tile) { + return this.offset == o.offset; + } else { + return false; + } + } + ,write: function(b) { + if(this.hidden) { + b.writeInt32(16777215); + } else { + b.writeInt32(this.offset); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.tile); + } + } + ,__class__: com_davidmaletz_faengfl_TileOffset +}; +var com_davidmaletz_faengfl_LocationSound = function(d,sound,vol,center,loops,scale,stopOnRemove) { + if(stopOnRemove == null) { + stopOnRemove = true; + } + if(scale == null) { + scale = 1; + } + if(loops == null) { + loops = false; + } + this.played = false; + this.scaleX = this.scaleY = scale; + if(Std["is"](d,com_davidmaletz_faengfl_Soundable)) { + var s = js_Boot.__cast(d , com_davidmaletz_faengfl_Soundable); + this.scaleX *= s.getSoundRange(false); + this.scaleY *= s.getSoundRange(true); + } + this.object = d; + this.center = center; + this.peak = vol; + this.sound = sound; + this.loops = loops; + d.addEventListener("addedToStage",$bind(this,this.init)); + if(stopOnRemove) { + d.addEventListener("removedFromStage",$bind(this,this.destroy)); + } + this.volume = 0; + if(d.stage != null) { + this.init(null); + } +}; +$hxClasses["com.davidmaletz.faengfl.LocationSound"] = com_davidmaletz_faengfl_LocationSound; +com_davidmaletz_faengfl_LocationSound.__name__ = ["com","davidmaletz","faengfl","LocationSound"]; +com_davidmaletz_faengfl_LocationSound.prototype = { + object: null + ,center: null + ,sound: null + ,loops: null + ,played: null + ,channel: null + ,scaleX: null + ,scaleY: null + ,volume: null + ,peak: null + ,getId: function() { + return this.sound; + } + ,init: function(e) { + if(this.played) { + return; + } + this.played = true; + this.destroy(null); + var vol = this.peak; + if(this.scaleX > 0 || this.scaleY > 0) { + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.enter_frame)); + vol = this.getVol(); + } + this.channel = vol == 0 && !this.loops ? null : com_davidmaletz_faengfl_SoundManager.playSFX(this.sound,this.loops,vol); + if(this.channel == null) { + this.kill(e); + } else { + this.channel.addEventListener("soundComplete",$bind(this,this.kill)); + } + } + ,destroy: function(e) { + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.enter_frame)); + if(this.channel != null) { + this.channel.removeEventListener("soundComplete",$bind(this,this.kill)); + this.channel.stop(); + this.channel = null; + } + } + ,kill: function(e) { + this.destroy(e); + this.object.removeEventListener("addedToStage",$bind(this,this.init)); + this.object.removeEventListener("removedFromStage",$bind(this,this.destroy)); + } + ,isStopped: function() { + return this.channel == null; + } + ,stop: function() { + this.kill(null); + } + ,enter_frame: function(e) { + if(this.channel == null) { + return; + } + this.volume = this.volume * 0.8 + 0.2 * this.getVol(); + com_davidmaletz_faengfl_SoundManager.setPanVolS(this.channel,(com_davidmaletz_faengfl_SoundManager.getPanS(this.channel) + Math.min(1,Math.max(-1,this.dx))) * 0.5,com_davidmaletz_faengfl_SoundManager.getSFXVolume(this.volume)); + } + ,dx: null + ,getVol: function() { + var w = openfl_Lib.current.stage.stageWidth; + var h = openfl_Lib.current.stage.stageHeight; + var w2 = w * 0.5; + var h2 = h * 0.5; + if(w2 <= 0 || h2 <= 0) { + return this.peak; + } + var p = this.object.localToGlobal(this.center); + this.dx = this.scaleX <= 0 ? 0 : (p.x - w2) / (w2 * this.scaleX); + var dy = this.scaleY <= 0 ? 0 : (p.y - h2) / (h2 * this.scaleY); + if(this.dx > 0) { + this.dx = Math.max(0,this.dx - this.scaleX * 0.25); + } else { + this.dx = Math.min(0,this.dx + this.scaleX * 0.25); + } + if(dy > 0) { + dy = Math.max(0,dy - this.scaleY * 0.25); + } else { + dy = Math.min(0,dy + this.scaleY * 0.25); + } + return this.peak * Math.max(0,1.0 - Math.sqrt(this.dx * this.dx + dy * dy)); + } + ,__class__: com_davidmaletz_faengfl_LocationSound +}; +var com_davidmaletz_faengfl_Soundable = function() { }; +$hxClasses["com.davidmaletz.faengfl.Soundable"] = com_davidmaletz_faengfl_Soundable; +com_davidmaletz_faengfl_Soundable.__name__ = ["com","davidmaletz","faengfl","Soundable"]; +com_davidmaletz_faengfl_Soundable.prototype = { + getSoundRange: null + ,__class__: com_davidmaletz_faengfl_Soundable +}; +var com_davidmaletz_faengfl_RevealText = function(c,width,multiline,txt,align,word,linePadding) { + if(linePadding == null) { + linePadding = 0; + } + if(word == null) { + word = true; + } + if(align == null) { + align = 0; + } + this.onComplete = null; + this.lines = []; + com_davidmaletz_faengfl_FormattedTextBase.call(this,width,multiline,align,word,linePadding); + this.bounds = null; + this._mask = new openfl_display_Sprite(); + this.addChild(new openfl_display_Sprite()); + this.addChild(new com_davidmaletz_faengfl_ScissorSprite(1,1,this._mask,c)); + var s = new openfl_display_Sprite(); + s.set_visible(false); + this.addChild(s); + this.addChild(this._mask); + if(txt != null) { + this.setText(txt); + } + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); +}; +$hxClasses["com.davidmaletz.faengfl.RevealText"] = com_davidmaletz_faengfl_RevealText; +com_davidmaletz_faengfl_RevealText.__name__ = ["com","davidmaletz","faengfl","RevealText"]; +com_davidmaletz_faengfl_RevealText.__interfaces__ = [com_davidmaletz_faengfl_EnterFrameHandler]; +com_davidmaletz_faengfl_RevealText.getTextSpeed = function() { + if(com_davidmaletz_faengfl_RevealText.TEXT_SPEED < 0.125) { + return 999999; + } else { + return com_davidmaletz_faengfl_RevealText.TEXT_SPEED; + } +}; +com_davidmaletz_faengfl_RevealText.__super__ = com_davidmaletz_faengfl_FormattedTextBase; +com_davidmaletz_faengfl_RevealText.prototype = $extend(com_davidmaletz_faengfl_FormattedTextBase.prototype,{ + lines: null + ,bounds: null + ,_mask: null + ,onComplete: null + ,pause: null + ,startCustomTag: function(code,data,map,insertText) { + if(code == "pause") { + var line = Math.round(this.placer.getCurrentY() / this.placer.getLineHeight(this.default_font.get(),1)); + if(this.pause == null) { + this.pause = new haxe_ds_IntMap(); + } + var ar = this.pause.get(line); + if(ar == null) { + ar = new com_fancyfish_faeng_common_SortedArray(com_fancyfish_faeng_common_SortedArray.sortableValue); + this.pause.set(line,ar); + } + ar.insert(new com_davidmaletz_faengfl__$RevealText_Pause(this.placer.getCurrentX(),data)); + return true; + } else { + return false; + } + } + ,setText: function(txt) { + com_fancyfish_faeng_common_Utils.clear(this.lines); + this.pause = null; + this.bounds = null; + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this.get(0)); + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this.get(1)); + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this.get(2)); + com_davidmaletz_faengfl_FormattedTextBase.prototype.setText.call(this,txt); + } + ,init: function(e) { + this.destroy(e); + com_davidmaletz_faengfl_FaengFL.addEnterFrame(this); + } + ,destroy: function(e) { + com_davidmaletz_faengfl_FaengFL.removeEnterFrame(this); + } + ,setStyle: function(width,multiline,align,word,linePadding) { + if(linePadding == null) { + linePadding = 0; + } + if(word == null) { + word = true; + } + if(align == null) { + align = 0; + } + this.placer = multiline ? new com_davidmaletz_faengfl__$RevealText_LineCharacterPlacer(this.lines,width,align,word,linePadding) : new com_fancyfish_faeng_text_CharacterPlacer(width,align); + } + ,renderCharacter: function(c,fnt,col) { + this.lines[com_fancyfish_faeng_common_Utils.min(this.lines.length - 1,c.line)].addCharacter(c,fnt,col); + } + ,renderText: function(map) { + var _g = 0; + var _g1 = this.lines; + while(_g < _g1.length) { + var l = _g1[_g]; + ++_g; + l.start(); + } + this.bounds = null; + var fnt = map.keys(); + while(fnt.hasNext()) { + var fnt1 = fnt.next(); + var cmap = map.get(fnt1); + var col = cmap.keys(); + while(col.hasNext()) { + var col1 = col.next(); + var chars = cmap.get(col1); + var _g2 = 0; + while(_g2 < chars.length) { + var c = chars[_g2]; + ++_g2; + this.renderCharacter(c,fnt1,col1); + } + } + } + var _g3 = 0; + var _g11 = this.lines; + while(_g3 < _g11.length) { + var l1 = _g11[_g3]; + ++_g3; + l1.finish(); + this.get(2).addChild(l1); + } + } + ,getHeight: function() { + if(this.lines.length == 0) { + return 0; + } else { + return this.lines[this.lines.length - 1].bottom; + } + } + ,get: function(i) { + return js_Boot.__cast(this.getChildAt(i) , openfl_display_Sprite); + } + ,advanceReveal: function(frames) { + var revealing = this.get(1); + var revealed = this.get(0); + var hidden = this.get(2); + while(frames > 0) { + var line; + if(revealing.get_numChildren() == 0) { + if(hidden.get_numChildren() == 0) { + var f = this.onComplete; + this.onComplete = null; + if(f != null) { + f(); + } + return frames; + } + line = js_Boot.__cast(hidden.removeChildAt(0) , com_davidmaletz_faengfl__$RevealText_Line); + revealing.addChild(line); + this._mask.set_x(line.bounds.x); + this._mask.set_y(line.bounds.y - 1); + this._mask.set_scaleX(0); + this._mask.set_scaleY(line.bounds.height + 2); + } else { + line = js_Boot.__cast(revealing.getChildAt(0) , com_davidmaletz_faengfl__$RevealText_Line); + } + var max = line.bounds.width; + var v = this._mask.get_scaleX() + frames; + var ar; + var tmp; + if(this.pause != null) { + ar = this.pause.get(revealed.get_numChildren()); + tmp = ar != null; + } else { + tmp = false; + } + if(tmp) { + var p = ar.getByValue(this._mask.get_scaleX()); + if(p != null && p.length > 0 && p.x < v) { + p.length -= v - p.x; + v = p.x; + if(p.length < 0) { + v -= p.length; + } + } + } + if(v > max) { + frames -= Math.max(0,max - this._mask.get_scaleX()); + revealed.addChild(line); + } else { + this._mask.set_scaleX(v); + break; + } + } + return 0; + } + ,enter_frame: function(frames) { + this.advanceReveal(frames * com_davidmaletz_faengfl_RevealText.getTextSpeed()); + } + ,__class__: com_davidmaletz_faengfl_RevealText +}); +var com_davidmaletz_faengfl__$RevealText_Line = function(bot) { + openfl_display_Sprite.call(this); + this.bounds = new com_fancyfish_faeng_display_Rectangle2D(); + this.bottom = bot; +}; +$hxClasses["com.davidmaletz.faengfl._RevealText.Line"] = com_davidmaletz_faengfl__$RevealText_Line; +com_davidmaletz_faengfl__$RevealText_Line.__name__ = ["com","davidmaletz","faengfl","_RevealText","Line"]; +com_davidmaletz_faengfl__$RevealText_Line.__super__ = openfl_display_Sprite; +com_davidmaletz_faengfl__$RevealText_Line.prototype = $extend(openfl_display_Sprite.prototype,{ + map: null + ,bounds: null + ,bottom: null + ,start: function() { + this.bounds.reset(); + this.map = new haxe_ds_ObjectMap(); + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this); + } + ,addCharacter: function(c,fnt,col) { + if(c.character.userData != null) { + var i = js_Boot.__cast(c.character.userData() , openfl_display_DisplayObject); + i.set_x(c.get_x()); + i.set_y(c.get_y()); + this.addChild(i); + this.bounds.addRectangle(c.get_x(),c.get_y(),c.character.getWidth(),c.character.getHeight()); + return; + } + var cmap = this.map.get(fnt); + if(cmap == null) { + cmap = new haxe_ds_IntMap(); + this.map.set(fnt,cmap); + } + var ar = cmap.get(col); + if(ar == null) { + ar = []; + cmap.set(col,ar); + } + ar.push(c); + } + ,finish: function() { + var fnt = this.map.keys(); + while(fnt.hasNext()) { + var fnt1 = fnt.next(); + var cmap = this.map.get(fnt1); + var col = cmap.keys(); + while(col.hasNext()) { + var col1 = col.next(); + var chars = cmap.get(col1); + if(chars.length > 0) { + var text = new com_davidmaletz_faengfl_InnerText(chars,col1); + this.addChild(text); + this.bounds.addRect(text.bounds); + } + } + } + this.map = null; + } + ,__class__: com_davidmaletz_faengfl__$RevealText_Line +}); +var com_fancyfish_faeng_text_CharacterPlacer = function(w,align,s,charHt) { + if(charHt == null) { + charHt = false; + } + if(s == null) { + s = 0; + } + if(align == null) { + align = 0; + } + this.startY = 0; + this.tx = 0; + this.width = w; + this.line = []; + this.alignment = align; + this.spacing = s; + this.incCharacterHeight = charHt; +}; +$hxClasses["com.fancyfish.faeng.text.CharacterPlacer"] = com_fancyfish_faeng_text_CharacterPlacer; +com_fancyfish_faeng_text_CharacterPlacer.__name__ = ["com","fancyfish","faeng","text","CharacterPlacer"]; +com_fancyfish_faeng_text_CharacterPlacer.prototype = { + incCharacterHeight: null + ,startY: null + ,tx: null + ,width: null + ,line: null + ,alignment: null + ,spacing: null + ,place: function(c,prev,scale,id) { + var x = this.tx + c.getXOffset(prev) * scale; + var y = c.getYOffset() * scale; + this.tx += (c.getXAdvance(prev) + this.spacing) * scale; + var cp = new com_fancyfish_faeng_text_CharacterPos(c,x,y,scale,id,0); + this.line.push(cp); + return cp; + } + ,getCurrentX: function() { + return this.tx; + } + ,getCurrentY: function() { + return 0; + } + ,reset: function() { + this.tx = 0; + this.line = []; + } + ,finish: function() { + this.finishLine(); + } + ,newLine: function(font,scale) { + } + ,lineWidth: function() { + if(this.line.length == 0) { + return 0; + } + var c = this.line[this.line.length - 1]; + var prev = this.line.length > 1 ? this.line[this.line.length - 2].character.id : -1; + return c.get_x() + c.character.getXAdvance(prev) * c.scale; + } + ,getOffsetX: function() { + return Math.round((this.width - this.lineWidth()) * (this.alignment * 0.5)); + } + ,getLineHeight: function(font,scale) { + return font.lineHeight * scale; + } + ,getCharHeight: function(c) { + if(c.character.userData == null) { + return this.getLineHeight(c.character.font,c.scale); + } else { + return c.character.getHeight() / c.character.font.baseline; + } + } + ,finishLine: function() { + var offX = this.getOffsetX(); + var height = 0; + var _g = 0; + var _g1 = this.line; + while(_g < _g1.length) { + var c = _g1[_g]; + ++_g; + var lineHeight = this.getCharHeight(c); + if(this.incCharacterHeight) { + lineHeight = Math.max(lineHeight,c.character.getHeight() * c.scale); + } + if(lineHeight > height) { + height = lineHeight; + } + var _g2 = c; + _g2.set_x(_g2.get_x() + offX); + } + var _g3 = 0; + var _g11 = this.line; + while(_g3 < _g11.length) { + var c1 = _g11[_g3]; + ++_g3; + var _g21 = c1; + _g21.set_y(_g21.get_y() + (this.startY + (height - this.getLineHeight(c1.character.font,c1.scale)) * c1.character.font.baseline)); + } + return height; + } + ,__class__: com_fancyfish_faeng_text_CharacterPlacer +}; +var com_fancyfish_faeng_text_WrapCharacterPlacer = function(w,align,word,linePadding,charHt) { + if(charHt == null) { + charHt = false; + } + if(linePadding == null) { + linePadding = 0; + } + if(word == null) { + word = true; + } + if(align == null) { + align = 0; + } + com_fancyfish_faeng_text_CharacterPlacer.call(this,w,align,0,charHt); + this.ty = 0; + this.wordWrap = word; + this.linePadding = linePadding; + this.currentLine = 0; +}; +$hxClasses["com.fancyfish.faeng.text.WrapCharacterPlacer"] = com_fancyfish_faeng_text_WrapCharacterPlacer; +com_fancyfish_faeng_text_WrapCharacterPlacer.__name__ = ["com","fancyfish","faeng","text","WrapCharacterPlacer"]; +com_fancyfish_faeng_text_WrapCharacterPlacer.__super__ = com_fancyfish_faeng_text_CharacterPlacer; +com_fancyfish_faeng_text_WrapCharacterPlacer.prototype = $extend(com_fancyfish_faeng_text_CharacterPlacer.prototype,{ + ty: null + ,wordWrap: null + ,linePadding: null + ,currentLine: null + ,wrapLine: function() { + var len = this.line.length; + var i = len - 1; + var newline = []; + if(len == 0) { + return newline; + } + while(i >= 0) { + var c = this.line[i]; + if(!c.character.isDisplayable()) { + break; + } + --i; + } + if(i > 0) { + var _g1 = i + 1; + var _g = len; + while(_g1 < _g) { + var c1 = _g1++; + var cp = this.line[c1]; + cp.line++; + newline.push(cp); + } + var _g11 = i; + var _g2 = len; + while(_g11 < _g2) { + var c2 = _g11++; + this.line.pop(); + } + i = this.line.length - 1; + while(i >= 0) { + var c3 = this.line[i]; + if(c3.character.isDisplayable()) { + break; + } + this.line.pop(); + --i; + } + return newline; + } else { + var cp1 = this.line.pop(); + cp1.line++; + return [cp1]; + } + } + ,place: function(c,prev,scale,id) { + var cp = com_fancyfish_faeng_text_CharacterPlacer.prototype.place.call(this,c,prev,scale,id); + cp.line = this.currentLine; + var _g = cp; + _g.set_y(_g.get_y() + this.ty); + if(this.tx > this.width) { + var newline; + if(this.wordWrap) { + newline = this.wrapLine(); + } else { + cp = this.line.pop(); + cp.line++; + newline = [cp]; + } + this.tx = 0; + this.advanceLine(); + this.line = newline; + var prev1 = -1; + var _g1 = 0; + var _g11 = this.line; + while(_g1 < _g11.length) { + var c1 = _g11[_g1]; + ++_g1; + c1.set_x(this.tx + c1.character.getXOffset(prev1) * c1.scale); + c1.set_y(this.ty + c1.character.getYOffset() * c1.scale); + this.tx += c1.character.getXAdvance(prev1) * c1.scale; + prev1 = c1.character.id; + } + } + return cp; + } + ,getCurrentY: function() { + return this.ty; + } + ,reset: function() { + com_fancyfish_faeng_text_CharacterPlacer.prototype.reset.call(this); + this.ty = 0; + this.currentLine = 0; + } + ,advanceLine: function() { + this.ty += this.finishLine(); + this.currentLine++; + } + ,finish: function() { + this.advanceLine(); + } + ,newLine: function(font,scale) { + this.tx = 0; + this.ty += Math.max(this.getLineHeight(font,scale),this.finishLine()); + this.currentLine++; + this.line = []; + } + ,getLineHeight: function(font,scale) { + return com_fancyfish_faeng_text_CharacterPlacer.prototype.getLineHeight.call(this,font,scale) + this.linePadding; + } + ,__class__: com_fancyfish_faeng_text_WrapCharacterPlacer +}); +var com_davidmaletz_faengfl__$RevealText_LineCharacterPlacer = function(l,w,align,word,linePadding) { + if(linePadding == null) { + linePadding = 0; + } + if(word == null) { + word = true; + } + if(align == null) { + align = 0; + } + this.lines = l; + com_fancyfish_faeng_text_WrapCharacterPlacer.call(this,w,align,word,linePadding,true); +}; +$hxClasses["com.davidmaletz.faengfl._RevealText.LineCharacterPlacer"] = com_davidmaletz_faengfl__$RevealText_LineCharacterPlacer; +com_davidmaletz_faengfl__$RevealText_LineCharacterPlacer.__name__ = ["com","davidmaletz","faengfl","_RevealText","LineCharacterPlacer"]; +com_davidmaletz_faengfl__$RevealText_LineCharacterPlacer.__super__ = com_fancyfish_faeng_text_WrapCharacterPlacer; +com_davidmaletz_faengfl__$RevealText_LineCharacterPlacer.prototype = $extend(com_fancyfish_faeng_text_WrapCharacterPlacer.prototype,{ + lines: null + ,reset: function() { + var _g = 0; + var _g1 = this.lines; + while(_g < _g1.length) { + var l = _g1[_g]; + ++_g; + if(l.parent != null) { + l.parent.removeChild(l); + } + } + com_fancyfish_faeng_common_Utils.clear(this.lines); + com_fancyfish_faeng_text_WrapCharacterPlacer.prototype.reset.call(this); + } + ,advanceLine: function() { + com_fancyfish_faeng_text_WrapCharacterPlacer.prototype.advanceLine.call(this); + this.lines.push(new com_davidmaletz_faengfl__$RevealText_Line(this.ty)); + } + ,newLine: function(font,scale) { + com_fancyfish_faeng_text_WrapCharacterPlacer.prototype.newLine.call(this,font,scale); + this.lines.push(new com_davidmaletz_faengfl__$RevealText_Line(this.ty)); + } + ,__class__: com_davidmaletz_faengfl__$RevealText_LineCharacterPlacer +}); +var com_davidmaletz_faengfl__$RevealText_Pause = function(x,len) { + this.x = x; + if(len == null) { + this.length = 1; + } else { + this.length = Std.parseFloat(len); + } + this.length *= 60; +}; +$hxClasses["com.davidmaletz.faengfl._RevealText.Pause"] = com_davidmaletz_faengfl__$RevealText_Pause; +com_davidmaletz_faengfl__$RevealText_Pause.__name__ = ["com","davidmaletz","faengfl","_RevealText","Pause"]; +com_davidmaletz_faengfl__$RevealText_Pause.prototype = { + x: null + ,length: null + ,getSortValue: function() { + return this.x; + } + ,__class__: com_davidmaletz_faengfl__$RevealText_Pause +}; +var com_davidmaletz_faengfl_SolidDrawable = function(color,w,h,thickness,lineColor,a) { + if(a == null) { + a = 1; + } + if(lineColor == null) { + lineColor = 0; + } + if(thickness == null) { + thickness = 0; + } + this.color = color; + this.w = w; + this.h = h; + this.thickness = thickness; + this.lineColor = lineColor; + this.alpha = a; +}; +$hxClasses["com.davidmaletz.faengfl.SolidDrawable"] = com_davidmaletz_faengfl_SolidDrawable; +com_davidmaletz_faengfl_SolidDrawable.__name__ = ["com","davidmaletz","faengfl","SolidDrawable"]; +com_davidmaletz_faengfl_SolidDrawable.__interfaces__ = [com_davidmaletz_faengfl_Drawable]; +com_davidmaletz_faengfl_SolidDrawable.prototype = { + color: null + ,w: null + ,h: null + ,thickness: null + ,lineColor: null + ,alpha: null + ,getWidth: function() { + return this.w; + } + ,getHeight: function() { + return this.h; + } + ,create: function(tx,ty) { + var s = new openfl_display_Sprite(); + if(this.thickness == 0 && this.alpha == 0) { + return s; + } + var g = s.get_graphics(); + if(this.thickness > 0) { + g.lineStyle(this.thickness,this.lineColor); + } + if(this.alpha > 0) { + g.beginFill(this.color); + } + g.drawRect(0,0,this.w,this.h); + g.endFill(); + if(this.alpha > 0) { + s.set_alpha(this.alpha); + } + s.set_x(tx); + s.set_y(ty); + return s; + } + ,__class__: com_davidmaletz_faengfl_SolidDrawable +}; +var com_davidmaletz_faengfl_SolidDrawableFactory = function(col,thickness,lineColor,a) { + if(a == null) { + a = 1; + } + if(lineColor == null) { + lineColor = 0; + } + if(thickness == null) { + thickness = 0; + } + com_davidmaletz_faengfl_AbstractDrawableFactory.call(this); + this.color = col; + this.thickness = thickness; + this.lineColor = lineColor; + this.alpha = a; +}; +$hxClasses["com.davidmaletz.faengfl.SolidDrawableFactory"] = com_davidmaletz_faengfl_SolidDrawableFactory; +com_davidmaletz_faengfl_SolidDrawableFactory.__name__ = ["com","davidmaletz","faengfl","SolidDrawableFactory"]; +com_davidmaletz_faengfl_SolidDrawableFactory.__super__ = com_davidmaletz_faengfl_AbstractDrawableFactory; +com_davidmaletz_faengfl_SolidDrawableFactory.prototype = $extend(com_davidmaletz_faengfl_AbstractDrawableFactory.prototype,{ + color: null + ,thickness: null + ,lineColor: null + ,alpha: null + ,makeDrawable: function(w,h) { + return new com_davidmaletz_faengfl_SolidDrawable(this.color,w,h,this.thickness,this.lineColor,this.alpha); + } + ,__class__: com_davidmaletz_faengfl_SolidDrawableFactory +}); +var com_davidmaletz_faengfl_SoundManager = function() { }; +$hxClasses["com.davidmaletz.faengfl.SoundManager"] = com_davidmaletz_faengfl_SoundManager; +com_davidmaletz_faengfl_SoundManager.__name__ = ["com","davidmaletz","faengfl","SoundManager"]; +com_davidmaletz_faengfl_SoundManager.SFX_VOL = null; +com_davidmaletz_faengfl_SoundManager.BGM_VOL = null; +com_davidmaletz_faengfl_SoundManager.bgmc = null; +com_davidmaletz_faengfl_SoundManager.cur_bgm = null; +com_davidmaletz_faengfl_SoundManager._exists = function(s) { + return openfl_Assets.exists(s); +}; +com_davidmaletz_faengfl_SoundManager.getSound = function(name) { + var s = name + ".ogg"; + if(com_davidmaletz_faengfl_SoundManager._exists(s)) { + try { + return openfl_Assets.getSound(s,false); + } catch( e ) { + haxe_CallStack.lastException = e; + if (e instanceof js__$Boot_HaxeError) e = e.val; + com_fancyfish_faeng_common_Utils.printExceptionTrace(e); + return null; + } + } else { + return null; + } +}; +com_davidmaletz_faengfl_SoundManager.getMusic = function(name) { + var s = name + ".ogg"; + if(com_davidmaletz_faengfl_SoundManager._exists(s)) { + try { + return openfl_Assets.getSound(s,false); + } catch( e ) { + haxe_CallStack.lastException = e; + if (e instanceof js__$Boot_HaxeError) e = e.val; + com_fancyfish_faeng_common_Utils.printExceptionTrace(e); + return null; + } + } else { + return null; + } +}; +com_davidmaletz_faengfl_SoundManager.settings = null; +com_davidmaletz_faengfl_SoundManager.init = function(settings,func) { + com_davidmaletz_faengfl_SoundManager.settings = settings; + com_davidmaletz_faengfl_SoundManager.updateSettings(); + func(); +}; +com_davidmaletz_faengfl_SoundManager.updateSettings = function() { + var d = Reflect.field(com_davidmaletz_faengfl_SoundManager.settings.data,"bgm_vol"); + com_davidmaletz_faengfl_SoundManager.setBGMVol(d == null ? 1 : d,false); + d = Reflect.field(com_davidmaletz_faengfl_SoundManager.settings.data,"sfx_vol"); + com_davidmaletz_faengfl_SoundManager.setSFXVol(d == null ? 1 : d,false); + com_davidmaletz_faengfl_SoundManager.setMuted(Reflect.field(com_davidmaletz_faengfl_SoundManager.settings.data,"muted") == true,false); +}; +com_davidmaletz_faengfl_SoundManager.getCachedSound = function(name) { + var ret = com_davidmaletz_faengfl_SoundManager.sound_cache.get(name); + if(ret == null) { + ret = com_davidmaletz_faengfl_SoundManager.getSound(name); + if(ret != null) { + com_davidmaletz_faengfl_SoundManager.sound_cache.set(name,ret); + } + } + return ret; +}; +com_davidmaletz_faengfl_SoundManager.getCachedMusic = function(name) { + var ret = com_davidmaletz_faengfl_SoundManager.music_cache.get(name); + if(ret == null) { + ret = com_davidmaletz_faengfl_SoundManager.getMusic(name); + if(ret != null) { + com_davidmaletz_faengfl_SoundManager.music_cache.set(name,ret); + } + } + return ret; +}; +com_davidmaletz_faengfl_SoundManager.playBGM = function(name,vol,loops,onComplete) { + if(loops == null) { + loops = true; + } + if(vol == null) { + vol = 1; + } + if(com_davidmaletz_faengfl_SoundManager.cur_bgm == name) { + return; + } + if(name == null) { + com_davidmaletz_faengfl_SoundManager.stopBGM(); + return; + } + var s = com_davidmaletz_faengfl_SoundManager.getCachedMusic(name); + if(s == null) { + com_davidmaletz_faengfl_SoundManager.stopBGM(); + return; + } + if(com_davidmaletz_faengfl_SoundManager.bgmc != null) { + com_davidmaletz_faengfl_SoundManager._stopBGM(); + } + com_davidmaletz_faengfl_SoundManager.cur_bgm = name; + com_davidmaletz_faengfl_SoundManager.bgm_vol = vol * com_davidmaletz_faengfl_SoundManager.bgm_peak; + var start = 0.0; + if(loops) { + var pos = com_davidmaletz_faengfl_SoundManager.musicPos.get(com_davidmaletz_faengfl_SoundManager.cur_bgm); + if(pos != null && pos > 0) { + start = pos; + } + } + com_davidmaletz_faengfl_SoundManager.bgmc = com_davidmaletz_faengfl_SoundManager._playMusic(s,start,loops,com_davidmaletz_faengfl_SoundManager.BGM_VOL * com_davidmaletz_faengfl_SoundManager.MAIN_VOL * com_davidmaletz_faengfl_SoundManager.bgm_vol); + if(onComplete != null) { + com_davidmaletz_faengfl_SoundManager.bgmc.addEventListener("soundComplete",function(e) { + if(com_davidmaletz_faengfl_SoundManager.bgmc != null) { + com_davidmaletz_faengfl_SoundManager._stopBGM(); + com_davidmaletz_faengfl_SoundManager.bgmc = null; + } + onComplete(); + }); + } +}; +com_davidmaletz_faengfl_SoundManager.getBGM = function() { + return com_davidmaletz_faengfl_SoundManager.cur_bgm; +}; +com_davidmaletz_faengfl_SoundManager._stopBGM = function() { + if(com_davidmaletz_faengfl_SoundManager.cur_bgm != null) { + com_davidmaletz_faengfl_SoundManager.musicPos.set(com_davidmaletz_faengfl_SoundManager.cur_bgm,com_davidmaletz_faengfl_SoundManager.bgmc.get_position()); + } + com_davidmaletz_faengfl_SoundManager.bgmc.stop(); +}; +com_davidmaletz_faengfl_SoundManager.stopBGM = function() { + if(com_davidmaletz_faengfl_SoundManager.bgmc != null) { + com_davidmaletz_faengfl_SoundManager._stopBGM(); + } + com_davidmaletz_faengfl_SoundManager.cur_bgm = null; +}; +com_davidmaletz_faengfl_SoundManager.setVolumeS = function(c,vol) { + c.set_soundTransform(new openfl_media_SoundTransform(vol)); +}; +com_davidmaletz_faengfl_SoundManager.getPanS = function(c) { + return c.get_soundTransform().pan; +}; +com_davidmaletz_faengfl_SoundManager.setPanVolS = function(c,pan,vol) { + var t = c.get_soundTransform(); + t.volume = vol; + t.pan = pan; + c.set_soundTransform(t); +}; +com_davidmaletz_faengfl_SoundManager.setVolume = function(c,vol) { + c.set_soundTransform(new openfl_media_SoundTransform(vol)); +}; +com_davidmaletz_faengfl_SoundManager.fadeBGM = function(f,stop) { + if(stop == null) { + stop = true; + } + if(f <= 0 && stop) { + if(com_davidmaletz_faengfl_SoundManager.bgmc != null) { + com_davidmaletz_faengfl_SoundManager._stopBGM(); + com_davidmaletz_faengfl_SoundManager.bgmc = null; + } + } else if(com_davidmaletz_faengfl_SoundManager.bgmc != null) { + com_davidmaletz_faengfl_SoundManager.setVolume(com_davidmaletz_faengfl_SoundManager.bgmc,com_davidmaletz_faengfl_SoundManager.BGM_VOL * com_davidmaletz_faengfl_SoundManager.MAIN_VOL * com_davidmaletz_faengfl_SoundManager.bgm_vol * f); + } +}; +com_davidmaletz_faengfl_SoundManager.getSFXVolume = function(f) { + return com_davidmaletz_faengfl_SoundManager.SFX_VOL * f * com_davidmaletz_faengfl_SoundManager.MAIN_VOL * 0.5; +}; +com_davidmaletz_faengfl_SoundManager.sound_count = null; +com_davidmaletz_faengfl_SoundManager.getCount = function(name) { + if(com_davidmaletz_faengfl_SoundManager.sound_count == null || !com_davidmaletz_faengfl_SoundManager.sound_count.exists(name)) { + return 1; + } else { + return com_davidmaletz_faengfl_SoundManager.sound_count.get(name); + } +}; +com_davidmaletz_faengfl_SoundManager._playMusic = function(s,start,loops,v) { + return s.play(start,loops ? 1073741823 : 0,new openfl_media_SoundTransform(v)); +}; +com_davidmaletz_faengfl_SoundManager._playSound = function(s,start,loops,v) { + return s.play(start,loops ? 1073741823 : 0,new openfl_media_SoundTransform(v)); +}; +com_davidmaletz_faengfl_SoundManager.playSFX = function(name,loops,vol) { + if(vol == null) { + vol = 1; + } + if(loops == null) { + loops = false; + } + var cooldown = com_davidmaletz_faengfl_SoundManager.sound_cooldown.get(name); + var time = openfl_Lib.getTimer(); + if(cooldown != null && cooldown > time) { + return null; + } else { + com_davidmaletz_faengfl_SoundManager.sound_cooldown.set(name,time + 150); + } + var s = com_davidmaletz_faengfl_SoundManager.getCachedSound(name); + if(s == null) { + var v = com_davidmaletz_faengfl_SoundManager.getCount(name); + s = com_davidmaletz_faengfl_SoundManager.getCachedSound(name + v); + if(s == null && v == 1) { + return null; + } + if(s == null) { + v = 1; + s = com_davidmaletz_faengfl_SoundManager.getCachedSound(name + v); + } + if(com_davidmaletz_faengfl_SoundManager.sound_count == null) { + com_davidmaletz_faengfl_SoundManager.sound_count = new haxe_ds_StringMap(); + } + com_davidmaletz_faengfl_SoundManager.sound_count.set(name,v + 1); + } + var c = com_davidmaletz_faengfl_SoundManager._playSound(s,0,loops,com_davidmaletz_faengfl_SoundManager.getSFXVolume(vol)); + if(loops && com_davidmaletz_faengfl_Window.window_ct == 0) { + new com_davidmaletz_faengfl__$SoundManager_LoopSfxHandler(c,vol); + } + return c; +}; +com_davidmaletz_faengfl_SoundManager.getSFXVol = function() { + return com_davidmaletz_faengfl_SoundManager.SFX_VOL; +}; +com_davidmaletz_faengfl_SoundManager.setSFXVol = function(v,updateSettings) { + if(updateSettings == null) { + updateSettings = true; + } + com_davidmaletz_faengfl_SoundManager.SFX_VOL = v; + if(updateSettings) { + Reflect.setField(com_davidmaletz_faengfl_SoundManager.settings.data,"sfx_vol",com_davidmaletz_faengfl_SoundManager.SFX_VOL); + } +}; +com_davidmaletz_faengfl_SoundManager.getBGMVol = function() { + return com_davidmaletz_faengfl_SoundManager.BGM_VOL; +}; +com_davidmaletz_faengfl_SoundManager.setBGMVol = function(v,updateSettings) { + if(updateSettings == null) { + updateSettings = true; + } + com_davidmaletz_faengfl_SoundManager.BGM_VOL = v; + if(com_davidmaletz_faengfl_SoundManager.bgmc != null) { + com_davidmaletz_faengfl_SoundManager.setVolume(com_davidmaletz_faengfl_SoundManager.bgmc,com_davidmaletz_faengfl_SoundManager.BGM_VOL * com_davidmaletz_faengfl_SoundManager.MAIN_VOL * com_davidmaletz_faengfl_SoundManager.bgm_vol); + } + if(updateSettings) { + Reflect.setField(com_davidmaletz_faengfl_SoundManager.settings.data,"bgm_vol",com_davidmaletz_faengfl_SoundManager.BGM_VOL); + } +}; +com_davidmaletz_faengfl_SoundManager.setBGMPeak = function(v) { + if(v != com_davidmaletz_faengfl_SoundManager.bgm_peak) { + com_davidmaletz_faengfl_SoundManager.bgm_vol *= v / com_davidmaletz_faengfl_SoundManager.bgm_peak; + com_davidmaletz_faengfl_SoundManager.bgm_peak = v; + if(com_davidmaletz_faengfl_SoundManager.bgmc != null) { + com_davidmaletz_faengfl_SoundManager.setVolume(com_davidmaletz_faengfl_SoundManager.bgmc,com_davidmaletz_faengfl_SoundManager.BGM_VOL * com_davidmaletz_faengfl_SoundManager.MAIN_VOL * com_davidmaletz_faengfl_SoundManager.bgm_vol); + } + } +}; +com_davidmaletz_faengfl_SoundManager.isMuted = function() { + return com_davidmaletz_faengfl_SoundManager.MAIN_VOL == 0; +}; +com_davidmaletz_faengfl_SoundManager.setMuted = function(muted,updateSettings) { + if(updateSettings == null) { + updateSettings = true; + } + if(muted == com_davidmaletz_faengfl_SoundManager.isMuted()) { + return; + } + com_davidmaletz_faengfl_SoundManager.MAIN_VOL = muted ? 0 : 1; + if(com_davidmaletz_faengfl_SoundManager.bgmc != null) { + com_davidmaletz_faengfl_SoundManager.setVolume(com_davidmaletz_faengfl_SoundManager.bgmc,com_davidmaletz_faengfl_SoundManager.BGM_VOL * com_davidmaletz_faengfl_SoundManager.MAIN_VOL * com_davidmaletz_faengfl_SoundManager.bgm_vol); + } + if(updateSettings) { + Reflect.setField(com_davidmaletz_faengfl_SoundManager.settings.data,"muted",muted); + } +}; +com_davidmaletz_faengfl_SoundManager.toggleMute = function() { + com_davidmaletz_faengfl_SoundManager.setMuted(!com_davidmaletz_faengfl_SoundManager.isMuted()); +}; +var com_davidmaletz_faengfl__$SoundManager_LoopSfxHandler = function(c,v) { + this.channel = c; + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.enter_frame)); + this.vol = v; + this.volume = com_davidmaletz_faengfl_SoundManager.getSFXVolume(this.vol); +}; +$hxClasses["com.davidmaletz.faengfl._SoundManager.LoopSfxHandler"] = com_davidmaletz_faengfl__$SoundManager_LoopSfxHandler; +com_davidmaletz_faengfl__$SoundManager_LoopSfxHandler.__name__ = ["com","davidmaletz","faengfl","_SoundManager","LoopSfxHandler"]; +com_davidmaletz_faengfl__$SoundManager_LoopSfxHandler.prototype = { + channel: null + ,vol: null + ,volume: null + ,isPlaying: function() { + if(this.channel.__soundInstance != null) { + return this.channel.__soundInstance.playState == "playSucceeded"; + } else { + return false; + } + } + ,enter_frame: function(e) { + if(!this.isPlaying()) { + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.enter_frame)); + return; + } + var v = com_davidmaletz_faengfl_Window.window_ct > 0 ? 0 : com_davidmaletz_faengfl_SoundManager.getSFXVolume(this.vol); + if(v != this.volume) { + this.volume = v; + com_davidmaletz_faengfl_SoundManager.setVolumeS(this.channel,v); + } + } + ,__class__: com_davidmaletz_faengfl__$SoundManager_LoopSfxHandler +}; +var com_davidmaletz_faengfl__$TextSprite_FontRenderer = function(f,b) { + if(b == null) { + b = openfl_Assets.getBitmapData(f.file); + } + this.tilesheet = new openfl_display_Tilesheet(b); + this.map = new haxe_ds_IntMap(); + var ct = 0; + var c = f.iterator(); + while(c.hasNext()) { + var c1 = c.next(); + if(c1.isDisplayable()) { + this.tilesheet.addTileRect(new openfl_geom_Rectangle(c1.x,c1.y,c1.width,c1.height)); + this.map.set(c1.id,ct++); + } + } +}; +$hxClasses["com.davidmaletz.faengfl._TextSprite.FontRenderer"] = com_davidmaletz_faengfl__$TextSprite_FontRenderer; +com_davidmaletz_faengfl__$TextSprite_FontRenderer.__name__ = ["com","davidmaletz","faengfl","_TextSprite","FontRenderer"]; +com_davidmaletz_faengfl__$TextSprite_FontRenderer.prototype = { + map: null + ,tilesheet: null + ,__class__: com_davidmaletz_faengfl__$TextSprite_FontRenderer +}; +var com_davidmaletz_faengfl_TileHandler = function() { + this.smooth = false; + this.data = []; + this.ct = 0; + this.last = null; +}; +$hxClasses["com.davidmaletz.faengfl.TileHandler"] = com_davidmaletz_faengfl_TileHandler; +com_davidmaletz_faengfl_TileHandler.__name__ = ["com","davidmaletz","faengfl","TileHandler"]; +com_davidmaletz_faengfl_TileHandler.prototype = { + data: null + ,ct: null + ,last: null + ,graphics: null + ,flags: null + ,smooth: null + ,renderLast: function() { + if(this.last == null || this.ct == 0) { + this.ct = 0; + } else { + this.last.drawTiles(this.graphics,this.data.slice(0,this.ct),this.smooth,this.flags); + this.last = null; + this.ct = 0; + } + } + ,start: function(g,flags,smooth) { + if(flags == null) { + flags = 0; + } + this.graphics = g; + this.ct = 0; + this.flags = flags; + this.smooth = smooth == null ? com_davidmaletz_faengfl_TextSprite.SMOOTH : smooth; + } + ,addTile: function(sheet,x,y,idx,alpha,a,b,c,d) { + if(d == null) { + d = 1; + } + if(c == null) { + c = 0; + } + if(b == null) { + b = 0; + } + if(a == null) { + a = 1; + } + if(alpha == null) { + alpha = 1; + } + if(sheet != this.last) { + this.renderLast(); + this.last = sheet; + } + this.data[this.ct++] = x; + this.data[this.ct++] = y; + this.data[this.ct++] = idx; + if((this.flags & 8) != 0) { + this.data[this.ct++] = alpha; + } + if((this.flags & 16) != 0) { + this.data[this.ct++] = a; + this.data[this.ct++] = b; + this.data[this.ct++] = c; + this.data[this.ct++] = d; + } + } + ,finish: function() { + this.renderLast(); + } + ,__class__: com_davidmaletz_faengfl_TileHandler +}; +var com_davidmaletz_faengfl_TouchAdapter = function() { + openfl_events_EventDispatcher.call(this); + com_davidmaletz_faengfl_TouchAdapter.instance = this; + this.addMouseListeners(); +}; +$hxClasses["com.davidmaletz.faengfl.TouchAdapter"] = com_davidmaletz_faengfl_TouchAdapter; +com_davidmaletz_faengfl_TouchAdapter.__name__ = ["com","davidmaletz","faengfl","TouchAdapter"]; +com_davidmaletz_faengfl_TouchAdapter.instance = null; +com_davidmaletz_faengfl_TouchAdapter.__super__ = openfl_events_EventDispatcher; +com_davidmaletz_faengfl_TouchAdapter.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + dispatchEvent: function(event) { + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + var ret = openfl_events_EventDispatcher.prototype.dispatchEvent.call(this,event); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + return ret; + } + ,addMouseListeners: function() { + openfl_Lib.current.stage.removeEventListener("mouseDown",$bind(this,this.mouse_down)); + openfl_Lib.current.stage.removeEventListener("mouseUp",$bind(this,this.mouse_up)); + openfl_Lib.current.stage.removeEventListener("mouseMove",$bind(this,this.mouse_move)); + openfl_Lib.current.stage.addEventListener("mouseDown",$bind(this,this.mouse_down),false,1); + openfl_Lib.current.stage.addEventListener("mouseUp",$bind(this,this.mouse_up),false,1); + openfl_Lib.current.stage.addEventListener("mouseMove",$bind(this,this.mouse_move),false,1); + } + ,getModifiers: function(e) { + var ret = 0; + if(e.shiftKey) { + ret |= 1; + } + if(e.ctrlKey) { + ret |= 2; + } + if(e.altKey) { + ret |= 4; + } + return ret; + } + ,mouse_down: function(e) { + var ev = new com_davidmaletz_faengfl_events_TEvent("touch_down",0,e.stageX,e.stageY,this.getModifiers(e)); + this.dispatchEvent(ev); + if(ev.__isCanceled) { + e.stopImmediatePropagation(); + } + } + ,mouse_up: function(e) { + var ev = new com_davidmaletz_faengfl_events_TEvent("touch_up",0,e.stageX,e.stageY,this.getModifiers(e)); + this.dispatchEvent(ev); + if(ev.__isCanceled) { + e.stopImmediatePropagation(); + } + } + ,mouse_move: function(e) { + var ev = new com_davidmaletz_faengfl_events_TEvent("touch_move",0,e.stageX,e.stageY,this.getModifiers(e)); + this.dispatchEvent(ev); + if(ev.__isCanceled) { + e.stopImmediatePropagation(); + } + } + ,__class__: com_davidmaletz_faengfl_TouchAdapter +}); +var com_davidmaletz_faengfl_achievement_Achievements = function(settings) { + openfl_events_EventDispatcher.call(this); + this.settings = settings; + this.scores = new haxe_ds_StringMap(); + this.updateSettings(); + com_davidmaletz_faengfl_achievement_Achievements.instance = this; +}; +$hxClasses["com.davidmaletz.faengfl.achievement.Achievements"] = com_davidmaletz_faengfl_achievement_Achievements; +com_davidmaletz_faengfl_achievement_Achievements.__name__ = ["com","davidmaletz","faengfl","achievement","Achievements"]; +com_davidmaletz_faengfl_achievement_Achievements.instance = null; +com_davidmaletz_faengfl_achievement_Achievements.__super__ = openfl_events_EventDispatcher; +com_davidmaletz_faengfl_achievement_Achievements.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + map: null + ,scores: null + ,settings: null + ,updateSettings: function() { + this.map = new haxe_ds_StringMap(); + var data = Reflect.field(this.settings.data,"achievements"); + if(data != null) { + var b = new haxe_io_BytesInput(data); + this.readAchievements(b); + } + } + ,clear: function() { + this.map = new haxe_ds_StringMap(); + this.updateAchievements(); + } + ,isAchievement: function(a) { + return true; + } + ,hasAchievement: function(a) { + return this.map.exists(a); + } + ,gainAchievement: function(a,silent) { + if(silent == null) { + silent = false; + } + if(!this.isAchievement(a) || this.hasAchievement(a)) { + return false; + } else { + this.map.set(a,true); + this.postAchievement(a,silent); + return true; + } + } + ,updateAchievements: function() { + var b = new haxe_io_BytesOutput(); + this.writeAchievements(b); + b.flush(); + b.close(); + Reflect.setField(this.settings.data,"achievements",b.getBytes()); + this.settings.flush(); + } + ,postAchievement: function(a,silent) { + this.updateAchievements(); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("gain_achievement",a)); + } + ,writeAchievements: function(b) { + var i = this.map.keys(); + while(i.hasNext()) { + var i1 = i.next(); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,i1); + } + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + } + ,readAchievements: function(b) { + while(true) { + var a = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(a == null) { + break; + } + this.map.set(a,true); + } + } + ,iterator: function() { + return this.map.keys(); + } + ,submitScore: function(board,score) { + var s = this.scores.get(board); + if(s == null || s < score) { + this.scores.set(board,score); + return true; + } else { + return false; + } + } + ,__class__: com_davidmaletz_faengfl_achievement_Achievements +}); +var com_davidmaletz_faengfl_adv_ModHandler = function() { }; +$hxClasses["com.davidmaletz.faengfl.adv.ModHandler"] = com_davidmaletz_faengfl_adv_ModHandler; +com_davidmaletz_faengfl_adv_ModHandler.__name__ = ["com","davidmaletz","faengfl","adv","ModHandler"]; +com_davidmaletz_faengfl_adv_ModHandler.modInfo = null; +com_davidmaletz_faengfl_adv_ModHandler.enabled = null; +com_davidmaletz_faengfl_adv_ModHandler.loadData = function() { + com_davidmaletz_faengfl_adv_ModHandler.modInfo = new haxe_ds_StringMap(); + com_fancyfish_faeng_common_Utils.clear(com_davidmaletz_faengfl_adv_ModHandler.entries); + com_fancyfish_faeng_common_Utils.clear(com_davidmaletz_faengfl_adv_ModHandler.onLoad); + com_fancyfish_faeng_common_Utils.clear(com_davidmaletz_faengfl_adv_ModHandler.mods); + com_davidmaletz_faengfl_adv_ModHandler.vars = null; + com_davidmaletz_faengfl_adv_ModHandler.vars = com_davidmaletz_faengfl_EventHandler.createVariables(); + var mods = ["data/core/mod.xml"]; + com_davidmaletz_faengfl_adv_ModHandler.enabled = new haxe_ds_StringMap(); + var _g = 0; + var _g1 = openfl_Assets.list(); + while(_g < _g1.length) { + var asset = _g1[_g]; + ++_g; + if(StringTools.startsWith(asset,"data/mods/") && StringTools.endsWith(asset,"/mod.xml") && asset.substring(10,asset.length - 8).indexOf("/") == -1) { + mods.push(asset); + } + } + var action_map = com_davidmaletz_faengfl_adv_ModHandler.createActionMap(); + com_davidmaletz_faengfl_EventHandler.parse("data/ui/ui.xml",action_map,com_davidmaletz_faengfl_adv_ModHandler.vars); + com_davidmaletz_faengfl_adv_ModHandler.loadMods(mods,action_map); +}; +com_davidmaletz_faengfl_adv_ModHandler.getEntryById = function(id) { + var i = com_davidmaletz_faengfl_adv_ModHandler._getEntryById(id); + if(i == -1) { + if(com_davidmaletz_faengfl_adv_ModHandler.entries.length == 0) { + return null; + } else { + return com_davidmaletz_faengfl_adv_ModHandler.entries[0]; + } + } else { + return com_davidmaletz_faengfl_adv_ModHandler.entries[i]; + } +}; +com_davidmaletz_faengfl_adv_ModHandler._getEntryById = function(id) { + var len = com_davidmaletz_faengfl_adv_ModHandler.entries.length; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + if(com_davidmaletz_faengfl_adv_ModHandler.entries[i].get("id") == id) { + return i; + } + } + return -1; +}; +com_davidmaletz_faengfl_adv_ModHandler.data = null; +com_davidmaletz_faengfl_adv_ModHandler.dataOrdered = null; +com_davidmaletz_faengfl_adv_ModHandler.parseData = function(type,expr,e,path) { + if(com_davidmaletz_faengfl_adv_ModHandler.data == null) { + com_davidmaletz_faengfl_adv_ModHandler.data = new haxe_ds_StringMap(); + com_davidmaletz_faengfl_adv_ModHandler.dataOrdered = new haxe_ds_StringMap(); + } + var map = com_davidmaletz_faengfl_adv_ModHandler.data.get(type); + if(map == null) { + map = new haxe_ds_StringMap(); + com_davidmaletz_faengfl_adv_ModHandler.data.set(type,map); + com_davidmaletz_faengfl_adv_ModHandler.dataOrdered.set(type,[]); + } + var _id = e.get("id"); + if(map.exists(_id)) { + haxe_Log.trace("Overwrite Data[" + type + "]: " + _id,{ fileName : "ModHandler.hx", lineNumber : 81, className : "com.davidmaletz.faengfl.adv.ModHandler", methodName : "parseData"}); + } + var a1 = type; + var o = { id : _id, xml : com_davidmaletz_faengfl_adv_ModHandler.makeXML(e,path,function(id) { + return com_davidmaletz_faengfl_adv_ModHandler.getData(a1,id); + })}; + if(expr != null) { + try { + var v = com_davidmaletz_faengfl_EventHandler.createVariables(); + v.set("this",o); + com_davidmaletz_faengfl_EventHandler.interpret(expr,v); + } catch( e1 ) { + haxe_CallStack.lastException = e1; + } + } + map.set(_id,o); + com_davidmaletz_faengfl_adv_ModHandler.dataOrdered.get(type).push(o); +}; +com_davidmaletz_faengfl_adv_ModHandler.getData = function(type,id) { + if(type != null && id != null && com_davidmaletz_faengfl_adv_ModHandler.data != null && com_davidmaletz_faengfl_adv_ModHandler.data.exists(type)) { + var r = com_davidmaletz_faengfl_adv_ModHandler.data.get(type).get(id); + if(r == null) { + haxe_Log.trace("No Data[" + type + "] found: " + id,{ fileName : "ModHandler.hx", lineNumber : 88, className : "com.davidmaletz.faengfl.adv.ModHandler", methodName : "getData"}); + } + return r; + } else { + return null; + } +}; +com_davidmaletz_faengfl_adv_ModHandler.getExpr = function(xml) { + if(xml.firstChild() == null) { + return null; + } else { + try { + return com_davidmaletz_faengfl_EventHandler.parseString(com_fancyfish_faeng_common_Lang.escape(xml.firstChild().get_nodeValue())); + } catch( e ) { + haxe_CallStack.lastException = e; + return null; + } + } +}; +com_davidmaletz_faengfl_adv_ModHandler.getDataByType = function(type) { + if(type != null && com_davidmaletz_faengfl_adv_ModHandler.dataOrdered != null && com_davidmaletz_faengfl_adv_ModHandler.dataOrdered.exists(type)) { + return HxOverrides.iter(com_davidmaletz_faengfl_adv_ModHandler.dataOrdered.get(type)); + } else { + return new com_fancyfish_faeng_common_NullIterator(); + } +}; +com_davidmaletz_faengfl_adv_ModHandler.getDataArray = function(type) { + if(type != null && com_davidmaletz_faengfl_adv_ModHandler.dataOrdered != null && com_davidmaletz_faengfl_adv_ModHandler.dataOrdered.exists(type)) { + return com_davidmaletz_faengfl_adv_ModHandler.dataOrdered.get(type).slice(); + } else { + return null; + } +}; +com_davidmaletz_faengfl_adv_ModHandler.dataExists = function(type,id) { + if(type != null && id != null && com_davidmaletz_faengfl_adv_ModHandler.data != null && com_davidmaletz_faengfl_adv_ModHandler.data.exists(type)) { + return com_davidmaletz_faengfl_adv_ModHandler.data.get(type).exists(id); + } else { + return false; + } +}; +com_davidmaletz_faengfl_adv_ModHandler.createActionMap = function() { + var action_map = new haxe_ds_StringMap(); + action_map.set("entry",function(e,path) { + var id = e.get("id"); + var i = com_davidmaletz_faengfl_adv_ModHandler._getEntryById(id); + if(i == -1) { + com_davidmaletz_faengfl_adv_ModHandler.entries.push(e); + } else { + haxe_Log.trace("Overwrite Entry: " + id,{ fileName : "ModHandler.hx", lineNumber : 101, className : "com.davidmaletz.faengfl.adv.ModHandler", methodName : "createActionMap"}); + com_davidmaletz_faengfl_adv_ModHandler.entries[i] = e; + } + }); + action_map.set("data",function(e1,path1) { + var type = e1.get("type"); + var expr = com_davidmaletz_faengfl_adv_ModHandler.getExpr(e1); + if(!action_map.exists(type)) { + var a1 = type; + var a2 = expr; + var tmp = function(e2,a3) { + com_davidmaletz_faengfl_adv_ModHandler.parseData(a1,a2,e2,a3); + }; + action_map.set(type,tmp); + } + }); + action_map.set("onLoad",function(e3,path2) { + com_davidmaletz_faengfl_adv_ModHandler.onLoad.push(new com_davidmaletz_faengfl_XmlPath(e3,path2)); + }); + action_map.set("lang",com_fancyfish_faeng_common_Lang.loadLanguage); + action_map.set("font",function(e4,path3) { + com_fancyfish_faeng_text_FontManager.set(e4.get("id"),com_fancyfish_faeng_common_Lang.getFontCached(com_davidmaletz_faengfl_adv_AdvApp.getResource(path3,e4.get("path")),false)); + }); + action_map.set("tilesheet",function(e5,path4) { + com_davidmaletz_tiles_Tile.loadTilesheet(com_davidmaletz_faengfl_adv_AdvApp.getResource(path4,e5.get("id")),com_davidmaletz_faengfl_adv_ModHandler.makeXML2(e5,path4,com_davidmaletz_faengfl_AutoTileBitmap.getXml)); + }); + action_map.set("tile",function(e6,path5) { + var id1 = e6.get("id"); + com_davidmaletz_tiles_Tile.setTile(id1,path5,e6); + }); + action_map.set("autotile",function(e7,path6) { + com_davidmaletz_tiles_Autotile.setAutotile(e7.get("id"),e7); + }); + action_map.set("animation",function(e8,path7) { + com_davidmaletz_tiles_TileAnimation.setAnimation(e8.get("id"),e8); + }); + action_map.set("volume",com_davidmaletz_faengfl_adv_sound_Sound.loadVolume); + action_map.set("sound",com_davidmaletz_faengfl_adv_sound_Sound.load); + action_map.set("soundSet",function(e9,path8) { + com_davidmaletz_faengfl_adv_sound_Sound.loadSet(e9); + }); + action_map.set("music",function(e10,path9) { + com_davidmaletz_faengfl_adv_sound_Music.load(com_davidmaletz_faengfl_adv_ModHandler.makeXML(e10,path9,com_davidmaletz_faengfl_adv_sound_Music.get)); + }); + action_map.set("layers",function(e11,path10) { + com_davidmaletz_faengfl_LayerManager.load(com_davidmaletz_faengfl_adv_ModHandler.makeXML2(e11,path10,com_davidmaletz_faengfl_LayerManager.get)); + }); + if(com_davidmaletz_faengfl_adv_ModHandler.addActionEntries != null) { + com_davidmaletz_faengfl_adv_ModHandler.addActionEntries(action_map); + } + return action_map; +}; +com_davidmaletz_faengfl_adv_ModHandler.checkRequires = function(i,loadAfter) { + var _g = 0; + var _g1 = i.requires; + while(_g < _g1.length) { + var r = _g1[_g]; + ++_g; + if(!com_davidmaletz_faengfl_adv_ModHandler.enabled.exists(r)) { + return false; + } + } + if(loadAfter) { + var _g2 = 0; + var _g11 = i.load_after; + while(_g2 < _g11.length) { + var r1 = _g11[_g2]; + ++_g2; + var info; + var tmp; + var tmp1; + info = com_davidmaletz_faengfl_adv_ModHandler.getModInfo(r1); + if(info != null) { + tmp1 = com_davidmaletz_faengfl_adv_ModHandler.shouldEnable(info); + } else { + tmp1 = false; + } + if(tmp1) { + tmp = !com_davidmaletz_faengfl_adv_ModHandler.enabled.exists(r1); + } else { + tmp = false; + } + if(tmp) { + return false; + } + } + } + return true; +}; +com_davidmaletz_faengfl_adv_ModHandler.missingRequires = function(i) { + var ret = []; + var _g = 0; + var _g1 = i.requires; + while(_g < _g1.length) { + var r = _g1[_g]; + ++_g; + if(!com_davidmaletz_faengfl_adv_ModHandler.enabled.exists(r)) { + ret.push(r); + } + } + return ret; +}; +com_davidmaletz_faengfl_adv_ModHandler.modNameToId = function(name) { + return StringTools.replace(name.toLowerCase()," ","_"); +}; +com_davidmaletz_faengfl_adv_ModHandler.defaultShouldEnable = function(info) { + return info.shouldEnable(); +}; +com_davidmaletz_faengfl_adv_ModHandler.loadMods = function(mods,action_map) { + var modlist = new com_fancyfish_faeng_common_Dequeue(); + var _g = 0; + while(_g < mods.length) { + var mod = mods[_g]; + ++_g; + if(openfl_Assets.exists(mod)) { + var file = mod; + try { + var info = new com_davidmaletz_faengfl_adv_ModInfo(mod); + if(com_davidmaletz_faengfl_adv_ModHandler.shouldEnable(info)) { + modlist.addLast(info); + } + com_davidmaletz_faengfl_adv_ModHandler.modInfo.set(com_davidmaletz_faengfl_adv_ModHandler.modNameToId(info.name),info); + com_davidmaletz_faengfl_adv_ModHandler.mods.push(info); + } catch( e ) { + haxe_CallStack.lastException = e; + if (e instanceof js__$Boot_HaxeError) e = e.val; + com_fancyfish_faeng_common_Utils.printExceptionTrace("Failed to load mod: " + mod + "\nFile: " + file + "\nError: " + Std.string(e)); + } + } else { + haxe_Log.trace("Warning: Mod doesn't exist: " + mod + "!",{ fileName : "ModHandler.hx", lineNumber : 146, className : "com.davidmaletz.faengfl.adv.ModHandler", methodName : "loadMods"}); + } + } + var last = false; + while(true) { + var ct = 0; + var sz = modlist.size(); + var _g1 = 0; + var _g2 = sz; + while(_g1 < _g2) { + var i = _g1++; + var info1 = modlist.removeFirst(); + if(com_davidmaletz_faengfl_adv_ModHandler.checkRequires(info1,!last)) { + var h = info1.enable(action_map,com_davidmaletz_faengfl_adv_ModHandler.vars); + try { + h.start(); + haxe_Log.trace("Enable Mod: " + info1.name,{ fileName : "ModHandler.hx", lineNumber : 151, className : "com.davidmaletz.faengfl.adv.ModHandler", methodName : "loadMods"}); + info1.enabled = true; + ++ct; + com_davidmaletz_faengfl_adv_ModHandler.enabled.set(info1.name,true); + } catch( ex ) { + haxe_CallStack.lastException = ex; + if (ex instanceof js__$Boot_HaxeError) ex = ex.val; + info1.error = true; + com_fancyfish_faeng_common_Utils.printExceptionTrace("Failed to load mod: " + info1.name + "\nFile: " + h.currentFile + "\nError: " + Std.string(ex)); + } + } else { + modlist.addLast(info1); + } + } + if(last) { + break; + } + if(ct == 0) { + last = true; + } + } + var m = modlist.iterator(); + while(m.hasNext()) { + var m1 = m.next(); + m1.error = true; + haxe_Log.trace("Failed to load mod: " + m1.name + "\nMissing requirements: " + Std.string(com_davidmaletz_faengfl_adv_ModHandler.missingRequires(m1)),{ fileName : "ModHandler.hx", lineNumber : 154, className : "com.davidmaletz.faengfl.adv.ModHandler", methodName : "loadMods"}); + } + var lang = Reflect.field(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"language"); + if(lang == null || !com_fancyfish_faeng_common_Lang.exists(lang)) { + lang = com_fancyfish_faeng_common_Lang.getDefaultLanguage(); + } + com_fancyfish_faeng_common_Lang.setLang(lang); + com_davidmaletz_faengfl_adv_ModHandler.dispatcher.dispatchEvent(new openfl_events_Event("reload")); +}; +com_davidmaletz_faengfl_adv_ModHandler.makeXML = function(e,path,get,reverseChildren) { + if(reverseChildren == null) { + reverseChildren = false; + } + var xml = new com_davidmaletz_faengfl_XmlPath(e,path); + if(e.exists("extendAppend")) { + reverseChildren = e.get("extendAppend") == "true"; + } + if(e.exists("extends")) { + var i = get(e.get("extends")); + if(i != null && i.xml != null) { + if(reverseChildren) { + xml = new com_davidmaletz_faengfl_XmlDualReverse(xml,i.xml); + } else { + xml = new com_davidmaletz_faengfl_XmlDual(xml,i.xml); + } + } + } + return xml; +}; +com_davidmaletz_faengfl_adv_ModHandler.makeXML2 = function(e,path,get,reverseChildren) { + if(reverseChildren == null) { + reverseChildren = false; + } + var xml = new com_davidmaletz_faengfl_XmlPath(e,path); + if(e.exists("extendAppend")) { + reverseChildren = e.get("extendAppend") == "true"; + } + if(e.exists("extends")) { + var i = get(e.get("extends")); + if(i != null) { + if(reverseChildren) { + xml = new com_davidmaletz_faengfl_XmlDualReverse(xml,i); + } else { + xml = new com_davidmaletz_faengfl_XmlDual(xml,i); + } + } + } + return xml; +}; +com_davidmaletz_faengfl_adv_ModHandler.reloadData = function() { + com_fancyfish_faeng_text_FontManager.reset(); + com_fancyfish_faeng_common_Lang.reset(); + com_davidmaletz_faengfl_AutoTileBitmap.reset(); + com_davidmaletz_tiles_Tile.reset(); + com_davidmaletz_tiles_TileAnimation.reset(); + com_davidmaletz_tiles_Autotile.reset(); + com_davidmaletz_faengfl_LayerManager.reset(); + com_davidmaletz_faengfl_adv_sound_Sound.reset(); + com_davidmaletz_faengfl_adv_sound_Music.reset(); + com_davidmaletz_tiles_TileFormattedText.reset(); + com_davidmaletz_faengfl_adv_ModHandler.data = null; + com_davidmaletz_faengfl_adv_ModHandler.dataOrdered = null; + if(com_davidmaletz_faengfl_adv_ModHandler.onReset != null) { + com_davidmaletz_faengfl_adv_ModHandler.onReset(); + } + com_davidmaletz_faengfl_adv_ModHandler.loadData(); + com_davidmaletz_faengfl_DeveloperConsole.reset(); +}; +com_davidmaletz_faengfl_adv_ModHandler.getMods = function() { + return HxOverrides.iter(com_davidmaletz_faengfl_adv_ModHandler.mods); +}; +com_davidmaletz_faengfl_adv_ModHandler.getModInfo = function(mod) { + if(com_davidmaletz_faengfl_adv_ModHandler.modInfo == null) { + return null; + } else { + return com_davidmaletz_faengfl_adv_ModHandler.modInfo.get(com_davidmaletz_faengfl_adv_ModHandler.modNameToId(mod)); + } +}; +com_davidmaletz_faengfl_adv_ModHandler.modEnabled = function(mod) { + var m = com_davidmaletz_faengfl_adv_ModHandler.getModInfo(mod); + if(m == null) { + return false; + } else { + return m.isEnabled(); + } +}; +com_davidmaletz_faengfl_adv_ModHandler.getModPath = function(mod) { + var i = com_davidmaletz_faengfl_adv_ModHandler.getModInfo(mod); + if(i == null) { + return null; + } else { + return i.path.substring(0,i.path.length - 1); + } +}; +com_davidmaletz_faengfl_adv_ModHandler.vars = null; +com_davidmaletz_faengfl_adv_ModHandler.addVars = function(v) { + v.set("getTile",com_davidmaletz_tiles_Tile.get); + v.set("getAnimation",com_davidmaletz_tiles_TileAnimation.get); + v.set("getAutotile",com_davidmaletz_tiles_Autotile.get); + v.set("getText",com_fancyfish_faeng_common_Lang.getTextFromTitle); + v.set("achievements",com_davidmaletz_faengfl_achievement_Achievements.instance); + v.set("getMusic",com_davidmaletz_faengfl_adv_sound_Music.get); + v.set("XmlPath",com_davidmaletz_faengfl_XmlPath); + v.set("StringBuf",StringBuf); + v.set("StringTools",StringTools); + v.set("getData",com_davidmaletz_faengfl_adv_ModHandler.getData); + v.set("getDataByType",com_davidmaletz_faengfl_adv_ModHandler.getDataByType); + v.set("dataExists",com_davidmaletz_faengfl_adv_ModHandler.dataExists); + v.set("getDataArray",com_davidmaletz_faengfl_adv_ModHandler.getDataArray); + v.set("getMod",com_davidmaletz_faengfl_adv_ModHandler.getModInfo); + v.set("getMods",com_davidmaletz_faengfl_adv_ModHandler.getMods); + v.set("modEnabled",com_davidmaletz_faengfl_adv_ModHandler.modEnabled); + if(com_davidmaletz_faengfl_adv_ModHandler.vars != null) { + com_davidmaletz_faengfl_adv_ModHandler.copyVars(com_davidmaletz_faengfl_adv_ModHandler.vars,v); + } + v.set("classFields",function(o) { + if(Std["is"](o,Class)) { + return Type.getClassFields(o); + } else { + return Type.getInstanceFields(Type.getClass(o)); + } + }); + v.set("Reflect",hscript_SafeReflect); +}; +com_davidmaletz_faengfl_adv_ModHandler.copyVars = function(from,to) { + var k = from.keys(); + while(k.hasNext()) { + var k1 = k.next(); + if(!to.exists(k1)) { + to.set(k1,from.get(k1)); + } + } +}; +var com_davidmaletz_faengfl_adv_ModInfo = function(mod) { + this.tags = []; + this.load_after = []; + this.requires = []; + this.enabled = false; + this.error = false; + var _gthis = this; + var action_map = new haxe_ds_StringMap(); + action_map.set("name",function(e,path) { + _gthis.name = com_davidmaletz_faengfl_adv_ModInfo.getText(e); + }); + action_map.set("description",function(e1,path1) { + _gthis.description = com_davidmaletz_faengfl_adv_ModInfo.getText(e1); + }); + action_map.set("author",function(e2,path2) { + _gthis.author = com_davidmaletz_faengfl_adv_ModInfo.getText(e2); + }); + action_map.set("version",function(e3,path3) { + _gthis.version = com_davidmaletz_faengfl_adv_ModInfo.getText(e3); + }); + action_map.set("website",function(e4,path4) { + _gthis.website = com_davidmaletz_faengfl_adv_ModInfo.getText(e4); + }); + action_map.set("disableWarning",function(e5,path5) { + _gthis.disableWarning = com_davidmaletz_faengfl_adv_ModInfo.getText(e5); + }); + action_map.set("versionCheck",function(e6,path6) { + _gthis.versionCheck = com_davidmaletz_faengfl_adv_ModInfo.getText(e6); + }); + action_map.set("requires",function(e7,path7) { + _gthis.requires.push(com_davidmaletz_faengfl_adv_ModInfo.getText(e7)); + }); + action_map.set("loadAfter",function(e8,path8) { + _gthis.load_after.push(com_davidmaletz_faengfl_adv_ModInfo.getText(e8)); + }); + action_map.set("tag",function(e9,path9) { + _gthis.tags.push(com_davidmaletz_faengfl_adv_ModInfo.getText(e9)); + }); + action_map.set("init",function(e10,p) { + _gthis.init = e10; + _gthis.path = p; + }); + com_davidmaletz_faengfl_EventHandler.parse(mod,action_map); + if(this.init == null) { + throw new js__$Boot_HaxeError("No init block."); + } +}; +$hxClasses["com.davidmaletz.faengfl.adv.ModInfo"] = com_davidmaletz_faengfl_adv_ModInfo; +com_davidmaletz_faengfl_adv_ModInfo.__name__ = ["com","davidmaletz","faengfl","adv","ModInfo"]; +com_davidmaletz_faengfl_adv_ModInfo.getText = function(xml) { + return com_fancyfish_faeng_common_Lang.escape(xml.firstChild().get_nodeValue()); +}; +com_davidmaletz_faengfl_adv_ModInfo.prototype = { + name: null + ,description: null + ,author: null + ,version: null + ,init: null + ,path: null + ,error: null + ,enabled: null + ,website: null + ,disableWarning: null + ,versionCheck: null + ,requires: null + ,load_after: null + ,tags: null + ,multiplayerSync: function() { + return this.init.get("multiplayerSync") != "false"; + } + ,shouldEnable: function() { + if(this.path != null) { + return Reflect.field(com_davidmaletz_faengfl_adv_AdvApp.settings.data,this.path) != false; + } else { + return false; + } + } + ,isEnabled: function() { + return this.enabled; + } + ,setEnabled: function(e) { + if(this.path != null) { + Reflect.setField(com_davidmaletz_faengfl_adv_AdvApp.settings.data,this.path,e); + com_davidmaletz_faengfl_adv_AdvApp.settings.flush(); + } + } + ,enable: function(action_map,vars) { + return com_davidmaletz_faengfl_EventHandler._parse(new com_davidmaletz_faengfl_XmlPath(this.init,this.path),action_map,vars); + } + ,__class__: com_davidmaletz_faengfl_adv_ModInfo +}; +var com_davidmaletz_faengfl_adv_sound_FadeMusic = function(m,to,frames,loops) { + this.music = m; + this.to = to; + this.frames = this.maxFrames = frames; + this.loops = loops; + com_davidmaletz_faengfl_adv_sound_FadeMusic.instance = this; + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.handle_frame),false,PriorityManager.getPriority()); +}; +$hxClasses["com.davidmaletz.faengfl.adv.sound.FadeMusic"] = com_davidmaletz_faengfl_adv_sound_FadeMusic; +com_davidmaletz_faengfl_adv_sound_FadeMusic.__name__ = ["com","davidmaletz","faengfl","adv","sound","FadeMusic"]; +com_davidmaletz_faengfl_adv_sound_FadeMusic.instance = null; +com_davidmaletz_faengfl_adv_sound_FadeMusic.set = function(to,frames,loops) { + if(loops == null) { + loops = true; + } + if(to == com_davidmaletz_faengfl_adv_sound_FadeMusic.get()) { + return; + } + var m = com_davidmaletz_faengfl_adv_sound_Music.get(to); + com_davidmaletz_faengfl_adv_sound_FadeMusic.setTrack(m,m == null ? null : m.getTrack(),frames,loops); +}; +com_davidmaletz_faengfl_adv_sound_FadeMusic.setTrack = function(m,to,frames,loops) { + if(loops == null) { + loops = true; + } + com_davidmaletz_faengfl_adv_sound_Music.current = m; + if(com_davidmaletz_faengfl_adv_sound_FadeMusic.isTrack(to)) { + if(com_davidmaletz_faengfl_adv_sound_FadeMusic.instance != null) { + com_davidmaletz_faengfl_adv_sound_FadeMusic.instance.updateTrack(m,to,loops); + } + return; + } + if(frames <= 0) { + if(com_davidmaletz_faengfl_adv_sound_FadeMusic.instance != null) { + com_davidmaletz_faengfl_adv_sound_FadeMusic.instance.stop(); + } + if(to == null) { + com_davidmaletz_faengfl_SoundManager.stopBGM(); + } else { + to.play(1,loops); + } + } else if(com_davidmaletz_faengfl_adv_sound_FadeMusic.instance != null) { + com_davidmaletz_faengfl_adv_sound_FadeMusic.instance.updateTrack(m,to,loops); + } else { + com_davidmaletz_faengfl_adv_sound_FadeMusic.instance = new com_davidmaletz_faengfl_adv_sound_FadeMusic(m,to,frames,loops); + } +}; +com_davidmaletz_faengfl_adv_sound_FadeMusic.get = function() { + var m = com_davidmaletz_faengfl_adv_sound_FadeMusic.instance == null || com_davidmaletz_faengfl_adv_sound_FadeMusic.instance.to == null ? com_davidmaletz_faengfl_adv_sound_Music.current : com_davidmaletz_faengfl_adv_sound_FadeMusic.instance.to.music; + if(m == null) { + return null; + } else { + return m.id; + } +}; +com_davidmaletz_faengfl_adv_sound_FadeMusic.isTrack = function(t) { + var id = t == null ? null : t.path; + return com_davidmaletz_faengfl_adv_sound_FadeMusic.getBGM() == id; +}; +com_davidmaletz_faengfl_adv_sound_FadeMusic.getBGM = function() { + if(com_davidmaletz_faengfl_adv_sound_FadeMusic.instance == null) { + return com_davidmaletz_faengfl_SoundManager.getBGM(); + } else if(com_davidmaletz_faengfl_adv_sound_FadeMusic.instance.to == null) { + return null; + } else { + return com_davidmaletz_faengfl_adv_sound_FadeMusic.instance.to.path; + } +}; +com_davidmaletz_faengfl_adv_sound_FadeMusic.clear = function(frames) { + com_davidmaletz_faengfl_adv_sound_FadeMusic.set(null,frames); +}; +com_davidmaletz_faengfl_adv_sound_FadeMusic.prototype = { + music: null + ,to: null + ,frames: null + ,maxFrames: null + ,loops: null + ,stop: function() { + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.handle_frame)); + com_davidmaletz_faengfl_adv_sound_FadeMusic.instance = null; + } + ,finish: function() { + if(this.to == null) { + com_davidmaletz_faengfl_SoundManager.stopBGM(); + com_davidmaletz_faengfl_adv_sound_Music.current = this.music; + this.stop(); + } else { + this.to.play(1,this.loops); + if(this.loops) { + com_davidmaletz_faengfl_SoundManager.fadeBGM(0,false); + this.frames = -this.maxFrames; + } else { + com_davidmaletz_faengfl_SoundManager.fadeBGM(1); + this.stop(); + } + } + } + ,handle_frame: function(e) { + if(this.frames <= 0) { + this.frames += com_davidmaletz_faengfl_FaengFL.frameTime; + if(this.frames >= 0) { + com_davidmaletz_faengfl_SoundManager.fadeBGM(1); + this.stop(); + } else { + com_davidmaletz_faengfl_SoundManager.fadeBGM(1 + this.frames / this.maxFrames,false); + } + } else { + this.frames -= com_davidmaletz_faengfl_FaengFL.frameTime; + if(this.frames <= 0) { + this.finish(); + } else { + com_davidmaletz_faengfl_SoundManager.fadeBGM(this.frames / this.maxFrames); + } + } + } + ,updateTrack: function(m,to,loops) { + this.music = m; + this.to = to; + this.loops = loops; + if(this.frames < 0) { + this.finish(); + } + } + ,__class__: com_davidmaletz_faengfl_adv_sound_FadeMusic +}; +var com_davidmaletz_faengfl_adv_sound_Music = function(xml) { + this.id = xml.get("id"); + this.xml = xml; + this.tracks = []; + this.map = new haxe_ds_StringMap(); + this.allowOverride = xml.get("allowOverride") != "false"; + var e = xml.elementPathsNamed("track"); + while(e.hasNext()) { + var e1 = e.next(); + var t = com_davidmaletz_faengfl_adv_sound_Track.fromXML(this,e1.xml,e1.path); + this.map.set(t.path,true); + this.tracks.push(t); + } + if(this.tracks.length == 0) { + var t1 = com_davidmaletz_faengfl_adv_sound_Track.fromXML(this,xml,xml.getPathForAttr("id")); + this.map.set(t1.path,true); + this.tracks.push(t1); + } +}; +$hxClasses["com.davidmaletz.faengfl.adv.sound.Music"] = com_davidmaletz_faengfl_adv_sound_Music; +com_davidmaletz_faengfl_adv_sound_Music.__name__ = ["com","davidmaletz","faengfl","adv","sound","Music"]; +com_davidmaletz_faengfl_adv_sound_Music.vars = null; +com_davidmaletz_faengfl_adv_sound_Music.update = function() { + if(com_davidmaletz_faengfl_adv_sound_Music.current != null) { + com_davidmaletz_faengfl_adv_sound_Music.current._update(); + } +}; +com_davidmaletz_faengfl_adv_sound_Music.music = null; +com_davidmaletz_faengfl_adv_sound_Music.load = function(e) { + com_davidmaletz_faengfl_adv_sound_Music._load(new com_davidmaletz_faengfl_adv_sound_Music(e)); +}; +com_davidmaletz_faengfl_adv_sound_Music._load = function(m) { + if(com_davidmaletz_faengfl_adv_sound_Music.music == null) { + com_davidmaletz_faengfl_adv_sound_Music.music = new haxe_ds_StringMap(); + } + if(com_davidmaletz_faengfl_adv_sound_Music.music.exists(m.id)) { + haxe_Log.trace("Overwrite Music: " + m.id,{ fileName : "Music.hx", lineNumber : 37, className : "com.davidmaletz.faengfl.adv.sound.Music", methodName : "_load"}); + } + com_davidmaletz_faengfl_adv_sound_Music.music.set(m.id,m); +}; +com_davidmaletz_faengfl_adv_sound_Music.fromSound = function(id) { + var m = Type.createEmptyInstance(com_davidmaletz_faengfl_adv_sound_Music); + m.id = id; + m.tracks = []; + m.map = new haxe_ds_StringMap(); + var t = new com_davidmaletz_faengfl_adv_sound_Track(m,id,com_davidmaletz_faengfl_adv_sound_Sound.get(id)); + m.map.set(t.path,true); + m.tracks.push(t); + return m; +}; +com_davidmaletz_faengfl_adv_sound_Music.get = function(id) { + var ret = com_davidmaletz_faengfl_adv_sound_Music._get(id); + if(id != null && id.length > 0 && ret == null) { + if(com_davidmaletz_faengfl_adv_sound_Sound.exists(id)) { + ret = com_davidmaletz_faengfl_adv_sound_Music.fromSound(id); + } else { + haxe_Log.trace("No Music found: " + id,{ fileName : "Music.hx", lineNumber : 46, className : "com.davidmaletz.faengfl.adv.sound.Music", methodName : "get"}); + } + } + return ret; +}; +com_davidmaletz_faengfl_adv_sound_Music._get = function(id) { + if(id == null || com_davidmaletz_faengfl_adv_sound_Music.music == null) { + return null; + } else { + return com_davidmaletz_faengfl_adv_sound_Music.music.get(id); + } +}; +com_davidmaletz_faengfl_adv_sound_Music.exists = function(id) { + if(id != null && com_davidmaletz_faengfl_adv_sound_Music.music != null) { + return com_davidmaletz_faengfl_adv_sound_Music.music.exists(id); + } else { + return false; + } +}; +com_davidmaletz_faengfl_adv_sound_Music.reset = function() { + com_davidmaletz_faengfl_adv_sound_Music.music = null; +}; +com_davidmaletz_faengfl_adv_sound_Music.prototype = { + xml: null + ,forceTrack: null + ,id: null + ,tracks: null + ,map: null + ,allowOverride: null + ,getTrack: function() { + var a = com_davidmaletz_faengfl_adv_AdvApp.getInstance(); + var t = this.allowOverride ? a.getForcedTrack() : null; + var m; + var tmp; + var tmp1; + if(t != null) { + m = com_davidmaletz_faengfl_adv_sound_Music._get(t); + tmp1 = m != null; + } else { + tmp1 = false; + } + if(tmp1) { + tmp = m.tracks.length > 0; + } else { + tmp = false; + } + if(tmp) { + var track = m.tracks[m.tracks.length - 1]; + this.map.set(track.path,true); + if(this.forceTrack == null) { + this.forceTrack = new com_davidmaletz_faengfl_adv_sound_Track(this,track.id,track.path); + } else { + this.forceTrack.id = track.id; + this.forceTrack.path = track.path; + } + return this.forceTrack; + } + var vars = a.updatePlayerVars(com_davidmaletz_faengfl_adv_sound_Music.vars); + var _g = 0; + var _g1 = this.tracks; + while(_g < _g1.length) { + var t1 = _g1[_g]; + ++_g; + if(t1.enabled(vars,com_davidmaletz_faengfl_adv_sound_FadeMusic.getBGM() == t1.path)) { + return t1; + } + } + return null; + } + ,_update: function() { + var bgm = com_davidmaletz_faengfl_adv_sound_FadeMusic.getBGM(); + if(bgm != null && !this.map.exists(bgm)) { + return; + } + var t = this.getTrack(); + if(t == null) { + if(bgm != null) { + com_davidmaletz_faengfl_adv_sound_FadeMusic.setTrack(this,null,60,true); + } + return; + } + if(bgm != t.path) { + com_davidmaletz_faengfl_adv_sound_FadeMusic.setTrack(this,t,60,true); + } + } + ,__class__: com_davidmaletz_faengfl_adv_sound_Music +}; +var com_davidmaletz_faengfl_adv_sound_Sound = function() { }; +$hxClasses["com.davidmaletz.faengfl.adv.sound.Sound"] = com_davidmaletz_faengfl_adv_sound_Sound; +com_davidmaletz_faengfl_adv_sound_Sound.__name__ = ["com","davidmaletz","faengfl","adv","sound","Sound"]; +com_davidmaletz_faengfl_adv_sound_Sound.play = function(id,loops,vol) { + if(vol == null) { + vol = 1; + } + if(loops == null) { + loops = false; + } + var s = com_davidmaletz_faengfl_adv_sound_Sound._get(id); + if(s == null) { + return null; + } else { + return com_davidmaletz_faengfl_SoundManager.playSFX(s,loops,vol * com_davidmaletz_faengfl_adv_sound_Sound.getVolume(id)); + } +}; +com_davidmaletz_faengfl_adv_sound_Sound.resolveDefault = function(xml,id) { + if(xml.exists("sfx")) { + return xml.get("sfx"); + } else { + return com_davidmaletz_faengfl_adv_sound_Sound.resolve(null,xml,id); + } +}; +com_davidmaletz_faengfl_adv_sound_Sound.resolveExtend = function(xml,id) { + while(true) { + var s = com_davidmaletz_faengfl_adv_sound_Sound.resolve(null,xml,id); + if(com_davidmaletz_faengfl_adv_sound_Sound.exists(s)) { + return s; + } + var i = id.lastIndexOf("_"); + if(i == -1) { + break; + } + id = HxOverrides.substr(id,0,i); + } + return null; +}; +com_davidmaletz_faengfl_adv_sound_Sound.resolve = function(sounds,xml,id) { + if(sounds != null && sounds.exists(id)) { + return sounds.get(id); + } + var s = xml.get(id + "_sfx"); + if(s != null) { + return s; + } + s = xml.get("sounds"); + if(s != null && com_davidmaletz_faengfl_adv_sound_Sound.sets != null) { + var set = com_davidmaletz_faengfl_adv_sound_Sound.sets.get(s); + if(set != null && set.exists(id)) { + return set.get(id); + } + } + return id; +}; +com_davidmaletz_faengfl_adv_sound_Sound.playLoc = function(id,renderer,pt,loop,scale,stopOnRemove) { + if(stopOnRemove == null) { + stopOnRemove = true; + } + if(scale == null) { + scale = 1; + } + if(loop == null) { + loop = false; + } + if(renderer == null) { + return null; + } + var vol = com_davidmaletz_faengfl_adv_sound_Sound.getVolume(id); + id = com_davidmaletz_faengfl_adv_sound_Sound._get(id); + if(id == null) { + return null; + } + if(pt == null) { + pt = new openfl_geom_Point(); + } + return new com_davidmaletz_faengfl_LocationSound(renderer,id,vol,pt,loop,scale,stopOnRemove); +}; +com_davidmaletz_faengfl_adv_sound_Sound.sound = null; +com_davidmaletz_faengfl_adv_sound_Sound.sets = null; +com_davidmaletz_faengfl_adv_sound_Sound.load = function(e,path) { + if(com_davidmaletz_faengfl_adv_sound_Sound.sound == null) { + com_davidmaletz_faengfl_adv_sound_Sound.sound = new haxe_ds_StringMap(); + } + var id = e.get("id"); + if(com_davidmaletz_faengfl_adv_sound_Sound.sound.exists(id)) { + haxe_Log.trace("Overwrite Sound: " + id,{ fileName : "Sound.hx", lineNumber : 42, className : "com.davidmaletz.faengfl.adv.sound.Sound", methodName : "load"}); + } + com_davidmaletz_faengfl_adv_sound_Sound.sound.set(id,e.exists("equals") ? com_davidmaletz_faengfl_adv_sound_Sound.sound.get(e.get("equals")) : com_davidmaletz_faengfl_adv_AdvApp.getResource(path,e.exists("path") ? e.get("path") : id,false)); +}; +com_davidmaletz_faengfl_adv_sound_Sound.loadSet = function(e) { + if(com_davidmaletz_faengfl_adv_sound_Sound.sets == null) { + com_davidmaletz_faengfl_adv_sound_Sound.sets = new haxe_ds_StringMap(); + } + var id = e.get("id"); + if(com_davidmaletz_faengfl_adv_sound_Sound.sets.exists(id)) { + haxe_Log.trace("Overwrite Sound Set: " + id,{ fileName : "Sound.hx", lineNumber : 46, className : "com.davidmaletz.faengfl.adv.sound.Sound", methodName : "loadSet"}); + } + com_davidmaletz_faengfl_adv_sound_Sound.sets.set(id,com_davidmaletz_faengfl_adv_sound_Sound.parseSoundSet(e)); +}; +com_davidmaletz_faengfl_adv_sound_Sound.get = function(id) { + var ret = com_davidmaletz_faengfl_adv_sound_Sound._get(id); + if(id != null && id.length > 0 && ret == null) { + haxe_Log.trace("No Sound found: " + id,{ fileName : "Sound.hx", lineNumber : 49, className : "com.davidmaletz.faengfl.adv.sound.Sound", methodName : "get"}); + } + return ret; +}; +com_davidmaletz_faengfl_adv_sound_Sound._get = function(id) { + if(id == null || com_davidmaletz_faengfl_adv_sound_Sound.sound == null) { + return null; + } else { + return com_davidmaletz_faengfl_adv_sound_Sound.sound.get(id); + } +}; +com_davidmaletz_faengfl_adv_sound_Sound.exists = function(id) { + if(id != null && com_davidmaletz_faengfl_adv_sound_Sound.sound != null) { + return com_davidmaletz_faengfl_adv_sound_Sound.sound.exists(id); + } else { + return false; + } +}; +com_davidmaletz_faengfl_adv_sound_Sound.reset = function() { + com_davidmaletz_faengfl_adv_sound_Sound.sound = null; + com_davidmaletz_faengfl_adv_sound_Sound.sets = null; + com_davidmaletz_faengfl_adv_sound_Sound.sound_volume = null; +}; +com_davidmaletz_faengfl_adv_sound_Sound.parseSoundSet = function(xml) { + var sounds = null; + var e = xml.elementsNamed("sound"); + while(e.hasNext()) { + var e1 = e.next(); + if(sounds == null) { + sounds = new haxe_ds_StringMap(); + } + sounds.set(e1.get("id"),e1.get("value")); + } + return sounds; +}; +com_davidmaletz_faengfl_adv_sound_Sound.sound_volume = null; +com_davidmaletz_faengfl_adv_sound_Sound.loadVolume = function(v,path) { + if(v.exists("name") && v.exists("value")) { + if(com_davidmaletz_faengfl_adv_sound_Sound.sound_volume == null) { + com_davidmaletz_faengfl_adv_sound_Sound.sound_volume = new haxe_ds_StringMap(); + } + com_davidmaletz_faengfl_adv_sound_Sound.sound_volume.set(v.get("name"),Std.parseFloat(v.get("value")) / 100); + } +}; +com_davidmaletz_faengfl_adv_sound_Sound.getVolume = function(name) { + if(name == null || com_davidmaletz_faengfl_adv_sound_Sound.sound_volume == null) { + return 1; + } else { + var ret = com_davidmaletz_faengfl_adv_sound_Sound.sound_volume.get(name); + if(ret == null) { + ret = 1; + } + return ret; + } +}; +var com_davidmaletz_faengfl_adv_sound_Track = function(parent,id,path) { + this.id = id; + this.music = parent; + this.fade = 0; + this.cond = null; + this.bounds = new com_fancyfish_faeng_common_Bounds2D_$Int(); + this.path = path; + this.bounds.max_x = 100000; + this.bounds.min_x = -this.bounds.max_x; + this.bounds.max_y = this.bounds.max_x; + this.bounds.min_y = this.bounds.min_x; +}; +$hxClasses["com.davidmaletz.faengfl.adv.sound.Track"] = com_davidmaletz_faengfl_adv_sound_Track; +com_davidmaletz_faengfl_adv_sound_Track.__name__ = ["com","davidmaletz","faengfl","adv","sound","Track"]; +com_davidmaletz_faengfl_adv_sound_Track.fromXML = function(m,e,path) { + var id = e.get("id"); + var t = new com_davidmaletz_faengfl_adv_sound_Track(m,id,com_davidmaletz_faengfl_adv_AdvApp.getResource(path,e.exists("path") ? e.get("path") : id,false)); + if(e.exists("if")) { + try { + t.cond = com_davidmaletz_faengfl_EventHandler.parseString(e.get("if")); + } catch( e1 ) { + haxe_CallStack.lastException = e1; + } + } + if(e.exists("x")) { + var tmp = e.get("x"); + t.bounds.min_x = Std.parseInt(tmp); + } + if(e.exists("y")) { + var tmp1 = e.get("y"); + t.bounds.min_y = Std.parseInt(tmp1); + } + if(e.exists("width")) { + var t1 = t.bounds.min_x; + var tmp2 = Std.parseInt(e.get("width")); + t.bounds.max_x = t1 + tmp2; + } + if(e.exists("height")) { + var t2 = t.bounds.min_y; + var tmp3 = Std.parseInt(e.get("height")); + t.bounds.max_y = t2 + tmp3; + } + if(e.exists("fade_tiles")) { + t.fade = Std.parseInt(e.get("fade_tiles")); + } + return t; +}; +com_davidmaletz_faengfl_adv_sound_Track.prototype = { + id: null + ,path: null + ,music: null + ,cond: null + ,bounds: null + ,fade: null + ,play: function(vol,loop) { + if(loop == null) { + loop = true; + } + if(vol == null) { + vol = 1; + } + com_davidmaletz_faengfl_adv_sound_Music.current = this.music; + com_davidmaletz_faengfl_SoundManager.playBGM(this.path,vol * com_davidmaletz_faengfl_adv_sound_Sound.getVolume(this.id),loop); + return; + } + ,isTrue: function(vars) { + try { + return com_davidmaletz_faengfl_EventHandler.interpret(this.cond,vars) == true; + } catch( e ) { + haxe_CallStack.lastException = e; + return false; + } + } + ,enabled: function(vars,fuzzy) { + var p = com_davidmaletz_faengfl_adv_AdvApp.getInstance().getPlayerPos(); + if(p == null || this.bounds.contains(p.x,p.y,fuzzy ? this.fade : 0)) { + if(this.cond != null) { + return this.isTrue(vars); + } else { + return true; + } + } else { + return false; + } + } + ,__class__: com_davidmaletz_faengfl_adv_sound_Track +}; +var com_davidmaletz_faengfl_controls_Key = function() { }; +$hxClasses["com.davidmaletz.faengfl.controls.Key"] = com_davidmaletz_faengfl_controls_Key; +com_davidmaletz_faengfl_controls_Key.__name__ = ["com","davidmaletz","faengfl","controls","Key"]; +com_davidmaletz_faengfl_controls_Key.prototype = { + draw: null + ,save: null + ,load: null + ,hashCode: null + ,equals: null + ,__class__: com_davidmaletz_faengfl_controls_Key +}; +var com_davidmaletz_faengfl_controls_AbstractKey = function() { +}; +$hxClasses["com.davidmaletz.faengfl.controls.AbstractKey"] = com_davidmaletz_faengfl_controls_AbstractKey; +com_davidmaletz_faengfl_controls_AbstractKey.__name__ = ["com","davidmaletz","faengfl","controls","AbstractKey"]; +com_davidmaletz_faengfl_controls_AbstractKey.__interfaces__ = [com_davidmaletz_faengfl_controls_Key]; +com_davidmaletz_faengfl_controls_AbstractKey.key_bitmap = null; +com_davidmaletz_faengfl_controls_AbstractKey.drawKey = function(l,x,y,key_x,key_y,flip,rot) { + if(rot == null) { + rot = 0; + } + if(flip == null) { + flip = false; + } + var tx = flip ? -1 : 1; + var ty = 1; + var a; + var b; + var c; + var d; + if(rot == 0) { + a = tx; + b = 0; + c = 0; + d = ty; + } else { + var cos = Math.cos(rot); + var sin = Math.sin(rot); + a = cos * tx; + b = -sin * tx; + c = sin * ty; + d = cos * ty; + } + com_davidmaletz_faengfl_controls_AbstractKey.key_bitmap.addTile(l.handler,key_x,key_y,x,y,1,a,b,c,d); +}; +com_davidmaletz_faengfl_controls_AbstractKey.prototype = { + getKeyX: function() { + return 0; + } + ,getKeyY: function() { + return 0; + } + ,draw: function(l,x,y) { + com_davidmaletz_faengfl_controls_AbstractKey.drawKey(l,x,y,this.getKeyX(),this.getKeyY()); + } + ,save: function(b) { + } + ,load: function(b) { + } + ,hashCode: function() { + return 0; + } + ,equals: function(h) { + return false; + } + ,__class__: com_davidmaletz_faengfl_controls_AbstractKey +}; +var com_davidmaletz_faengfl_controls_AxisKey = function(a,positive) { + com_davidmaletz_faengfl_controls_AbstractKey.call(this); + this.setAxis(a,positive); +}; +$hxClasses["com.davidmaletz.faengfl.controls.AxisKey"] = com_davidmaletz_faengfl_controls_AxisKey; +com_davidmaletz_faengfl_controls_AxisKey.__name__ = ["com","davidmaletz","faengfl","controls","AxisKey"]; +com_davidmaletz_faengfl_controls_AxisKey.__super__ = com_davidmaletz_faengfl_controls_AbstractKey; +com_davidmaletz_faengfl_controls_AxisKey.prototype = $extend(com_davidmaletz_faengfl_controls_AbstractKey.prototype,{ + axis: null + ,key_x: null + ,key_y: null + ,dir: null + ,setAxis: function(a,positive) { + this.axis = a; + this.dir = 0; + this.key_x = 3; + this.key_y = 0; + switch(a) { + case 0: + this.key_x = 3; + this.key_y = 2; + this.dir = positive ? 1 : -1; + break; + case 1: + this.key_x = 3; + this.key_y = 2; + this.dir = positive ? 2 : -2; + break; + case 2: + this.key_x = 4; + this.key_y = 2; + this.dir = positive ? 1 : -1; + break; + case 3: + this.key_x = 4; + this.key_y = 2; + this.dir = positive ? 2 : -2; + break; + case 4: + this.key_x = 2; + this.key_y = 3; + break; + case 5: + this.key_x = 3; + this.key_y = 3; + break; + } + } + ,draw: function(l,x,y) { + com_davidmaletz_faengfl_controls_AbstractKey.prototype.draw.call(this,l,x,y); + var u = 2; + var v = 4; + var _g = this.dir; + switch(_g) { + case -2: + com_davidmaletz_faengfl_controls_AbstractKey.drawKey(l,x,y,u,v,false,0.5 * Math.PI); + break; + case -1: + com_davidmaletz_faengfl_controls_AbstractKey.drawKey(l,x,y,u,v,false,Math.PI); + break; + case 1: + com_davidmaletz_faengfl_controls_AbstractKey.drawKey(l,x,y,u,v); + break; + case 2: + com_davidmaletz_faengfl_controls_AbstractKey.drawKey(l,x,y,u,v,false,-0.5 * Math.PI); + break; + } + } + ,getKeyX: function() { + return this.key_x; + } + ,getKeyY: function() { + return this.key_y; + } + ,save: function(b) { + b.writeByte(this.axis << 1 | (this.dir >= 0 ? 1 : 0)); + } + ,load: function(b) { + var v = b.readByte(); + this.setAxis(v >> 1,(v & 1) != 0); + } + ,hashCode: function() { + return this.axis + 100; + } + ,equals: function(h) { + if(Std["is"](h,com_davidmaletz_faengfl_controls_AxisKey)) { + var a = js_Boot.__cast(h , com_davidmaletz_faengfl_controls_AxisKey); + if(a.axis == this.axis) { + return a.dir == this.dir; + } else { + return false; + } + } else { + return false; + } + } + ,__class__: com_davidmaletz_faengfl_controls_AxisKey +}); +var com_davidmaletz_faengfl_controls_ControlHandler = function(settings,listener,keyCount) { + this.keyHandler = null; + this.canChangeDevice = true; + this.axis_dx = []; + openfl_events_EventDispatcher.call(this); + this.keys = []; + var _g1 = 0; + var _g = keyCount; + while(_g1 < _g) { + var i = _g1++; + this.keys.push(false); + } + this.settings = settings; + this.listener = listener; + this.updateSettings(); + this.device = 0; +}; +$hxClasses["com.davidmaletz.faengfl.controls.ControlHandler"] = com_davidmaletz_faengfl_controls_ControlHandler; +com_davidmaletz_faengfl_controls_ControlHandler.__name__ = ["com","davidmaletz","faengfl","controls","ControlHandler"]; +com_davidmaletz_faengfl_controls_ControlHandler.getDeviceNames = function() { + return [com_fancyfish_faeng_common_Lang.getText("options","keyboard"),com_fancyfish_faeng_common_Lang.getText("options","controller")]; +}; +com_davidmaletz_faengfl_controls_ControlHandler.keyboardKey = function(key) { + return new com_davidmaletz_faengfl_controls_KeyboardKey(key); +}; +com_davidmaletz_faengfl_controls_ControlHandler.mouseKey = function(button) { + return new com_davidmaletz_faengfl_controls_MouseKey(button,false); +}; +com_davidmaletz_faengfl_controls_ControlHandler.controllerButtonKey = function(button) { + return new com_davidmaletz_faengfl_controls_ControllerKey(button); +}; +com_davidmaletz_faengfl_controls_ControlHandler.__super__ = openfl_events_EventDispatcher; +com_davidmaletz_faengfl_controls_ControlHandler.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + controls: null + ,device: null + ,controllerId: null + ,settings: null + ,listener: null + ,updateSettings: function() { + this.controls = []; + var _g = 0; + while(_g < 2) { + var i = _g++; + this.controls.push(new com_davidmaletz_faengfl_controls_ControlSettings()); + } + if(Reflect.hasField(this.settings.data,"controls")) { + try { + var b = new haxe_io_BytesInput(Reflect.field(this.settings.data,"controls")); + var _g1 = 0; + while(_g1 < 2) { + var i1 = _g1++; + this.controls[i1].load(b); + this.listener.validateControls(i1,this.controls[i1]); + } + b.close(); + } catch( e ) { + haxe_CallStack.lastException = e; + this.listener.defaultKeyboard(this.controls[0]); + this.listener.defaultGamepad(this.controls[1]); + } + } else { + this.listener.defaultKeyboard(this.controls[0]); + this.listener.defaultGamepad(this.controls[1]); + } + } + ,save: function() { + var b = new haxe_io_BytesOutput(); + var _g = 0; + while(_g < 2) { + var i = _g++; + this.controls[i].save(b); + } + b.flush(); + b.close(); + Reflect.setField(this.settings.data,"controls",b.getBytes()); + this.settings.flush(); + } + ,keys: null + ,isPressed: function(key) { + if(!this.keys[key]) { + return this.keys[key + 1]; + } else { + return true; + } + } + ,setPressed: function(key,pressed) { + this.keys[key] = pressed; + } + ,releaseAll: function() { + var len = this.keys.length; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + this.keys[i] = false; + } + } + ,onKeyDown: function(key) { + if(this.setDevice(0,true)) { + this.handleDown(com_davidmaletz_faengfl_controls_ControlHandler.keyboardKey(key)); + } + } + ,onKeyUp: function(key) { + if(this.setDevice(0)) { + this.handleUp(com_davidmaletz_faengfl_controls_ControlHandler.keyboardKey(key)); + } + } + ,onMouseDown: function(button) { + if(com_davidmaletz_faengfl_adv_AdvApp.hasFocus && this.setDevice(0,true)) { + this.handleDown(com_davidmaletz_faengfl_controls_ControlHandler.mouseKey(button)); + } + } + ,onMouseUp: function(button) { + if(com_davidmaletz_faengfl_adv_AdvApp.hasFocus && this.setDevice(0)) { + this.handleUp(com_davidmaletz_faengfl_controls_ControlHandler.mouseKey(button)); + } + } + ,onGamepadDown: function(dev,button) { + if(this.setDevice(1,true,dev)) { + this.handleDown(com_davidmaletz_faengfl_controls_ControlHandler.controllerButtonKey(button)); + } + } + ,onGamepadUp: function(dev,button) { + if(this.setDevice(1,false,dev)) { + this.handleUp(com_davidmaletz_faengfl_controls_ControlHandler.controllerButtonKey(button)); + } + } + ,axis_dx: null + ,canChangeDevice: null + ,onGamepadAxis: function(dev,axis,value) { + var dx = Math.floor(value + 0.5); + var i = dev << 4 | axis & 15; + if(i >= this.axis_dx.length) { + var len = i - this.axis_dx.length + 1; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var j = _g1++; + this.axis_dx.push(0); + } + } + var old = this.axis_dx[i]; + if(dx == old) { + return; + } + this.axis_dx[i] = dx; + if(!this.setDevice(1,true,dev)) { + return; + } + if(old < 0) { + this.handleUp(new com_davidmaletz_faengfl_controls_AxisKey(axis,false)); + } else if(old > 0) { + this.handleUp(new com_davidmaletz_faengfl_controls_AxisKey(axis,true)); + } + if(dx < 0) { + this.handleDown(new com_davidmaletz_faengfl_controls_AxisKey(axis,false)); + } else if(dx > 0) { + this.handleDown(new com_davidmaletz_faengfl_controls_AxisKey(axis,true)); + } + } + ,setDevice: function(dev,down,controller) { + if(controller == null) { + controller = -1; + } + if(down == null) { + down = false; + } + if(this.device != dev) { + if(!this.canChangeDevice) { + if(this.keyHandler != null && this.keyHandler(null,down)) { + this.keyHandler = null; + } else if(!down) { + this.listener.release("back",-1); + } + return false; + } + this.device = dev; + this.releaseAll(); + this.dispatchEvent(new openfl_events_Event("controls_changed")); + } + this.controllerId = controller; + return true; + } + ,getControllerID: function() { + return this.controllerId; + } + ,keyHandler: null + ,handleDown: function(key) { + if(this.keyHandler != null) { + if(this.keyHandler(key,true)) { + this.keyHandler = null; + } + return; + } + var v = this.getValue(key); + var code = this.listener.getKeyCode(v); + this.listener.press(v,code); + if(code != -1) { + this.keys[code] = true; + } + } + ,handleUp: function(key) { + if(this.keyHandler != null) { + if(this.keyHandler(key,false)) { + this.keyHandler = null; + } + return; + } + var v = this.getValue(key); + var code = this.listener.getKeyCode(v); + this.listener.release(v,code); + if(code != -1) { + this.keys[code] = false; + } + } + ,getCurrentDevice: function() { + return this.device; + } + ,setCurrentDevice: function(dev) { + this.device = dev; + } + ,getControls: function(device) { + return this.getSettings(device).clone(); + } + ,setControls: function(device,controls) { + var old = this.device; + this.listener.validateControls(device,controls); + this.device = -2; + this.controls[device] = controls; + this.save(); + this.setDevice(old,false,this.controllerId); + } + ,getSettings: function(device) { + return this.controls[device]; + } + ,getKey: function(str) { + return this.getSettings(this.device).getKey(str); + } + ,getValue: function(key) { + return this.getSettings(this.device).getValue(key); + } + ,__class__: com_davidmaletz_faengfl_controls_ControlHandler +}); +var com_davidmaletz_faengfl_controls_ControlSettings = function(initial) { + if(initial == null) { + this.key_map = new com_fancyfish_faeng_common_HashMap(); + } else { + this.key_map = initial.clone(); + } +}; +$hxClasses["com.davidmaletz.faengfl.controls.ControlSettings"] = com_davidmaletz_faengfl_controls_ControlSettings; +com_davidmaletz_faengfl_controls_ControlSettings.__name__ = ["com","davidmaletz","faengfl","controls","ControlSettings"]; +com_davidmaletz_faengfl_controls_ControlSettings.prototype = { + key_map: null + ,setKey: function(k,key) { + var old = this.getKey(k); + if(old != null) { + this.key_map.remove(old); + } + if(key != null) { + this.key_map.set(key,k); + } + } + ,getKey: function(key) { + return this.key_map.getKey(key); + } + ,getValue: function(key) { + return this.key_map.get(key); + } + ,clone: function() { + return new com_davidmaletz_faengfl_controls_ControlSettings(this.key_map); + } + ,save: function(b) { + var e = this.key_map.iterator(); + while(e.hasNext()) { + var e1 = e.next(); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,e1.value); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,Type.getClassName(Type.getClass(e1.key))); + e1.key.save(b); + } + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,""); + } + ,load: function(b) { + var first = true; + while(true) { + var k = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(k.length == 0) { + if(first) { + throw new js__$Boot_HaxeError("Empty settings!"); + } + break; + } + first = false; + var key = Type.createEmptyInstance(Type.resolveClass(com_fancyfish_faeng_common_UTFUtils.readUTF(b))); + key.load(b); + this.key_map.set(key,k); + } + } + ,__class__: com_davidmaletz_faengfl_controls_ControlSettings +}; +var com_davidmaletz_faengfl_controls_ControllerKey = function(b) { + com_davidmaletz_faengfl_controls_AbstractKey.call(this); + this.setKey(b); +}; +$hxClasses["com.davidmaletz.faengfl.controls.ControllerKey"] = com_davidmaletz_faengfl_controls_ControllerKey; +com_davidmaletz_faengfl_controls_ControllerKey.__name__ = ["com","davidmaletz","faengfl","controls","ControllerKey"]; +com_davidmaletz_faengfl_controls_ControllerKey.__super__ = com_davidmaletz_faengfl_controls_AbstractKey; +com_davidmaletz_faengfl_controls_ControllerKey.prototype = $extend(com_davidmaletz_faengfl_controls_AbstractKey.prototype,{ + key: null + ,key_x: null + ,key_y: null + ,setKey: function(b) { + this.key = b; + this.key_x = 3; + this.key_y = 0; + switch(b) { + case 0: + this.key_x = 0; + this.key_y = 1; + break; + case 1: + this.key_x = 1; + this.key_y = 1; + break; + case 2: + this.key_x = 2; + this.key_y = 1; + break; + case 3: + this.key_x = 3; + this.key_y = 1; + break; + case 4: + this.key_x = 4; + this.key_y = 3; + break; + case 5: + this.key_x = 0; + this.key_y = 4; + break; + case 6: + this.key_x = 1; + this.key_y = 4; + break; + case 7: + this.key_x = 3; + this.key_y = 2; + break; + case 8: + this.key_x = 4; + this.key_y = 2; + break; + case 9: + this.key_x = 0; + this.key_y = 3; + break; + case 10: + this.key_x = 1; + this.key_y = 3; + break; + case 11: + this.key_x = 2; + this.key_y = 2; + break; + case 12: + this.key_x = 4; + this.key_y = 1; + break; + case 13: + this.key_x = 0; + this.key_y = 2; + break; + case 14: + this.key_x = 1; + this.key_y = 2; + break; + } + } + ,getKeyX: function() { + return this.key_x; + } + ,getKeyY: function() { + return this.key_y; + } + ,save: function(b) { + b.writeByte(this.key); + } + ,load: function(b) { + this.setKey(b.readByte()); + } + ,hashCode: function() { + return this.key; + } + ,equals: function(h) { + if(Std["is"](h,com_davidmaletz_faengfl_controls_ControllerKey)) { + return (js_Boot.__cast(h , com_davidmaletz_faengfl_controls_ControllerKey)).key == this.key; + } else { + return false; + } + } + ,__class__: com_davidmaletz_faengfl_controls_ControllerKey +}); +var com_davidmaletz_faengfl_controls_Gamepad = function() { }; +$hxClasses["com.davidmaletz.faengfl.controls.Gamepad"] = com_davidmaletz_faengfl_controls_Gamepad; +com_davidmaletz_faengfl_controls_Gamepad.__name__ = ["com","davidmaletz","faengfl","controls","Gamepad"]; +com_davidmaletz_faengfl_controls_Gamepad.instance = null; +com_davidmaletz_faengfl_controls_Gamepad.__super__ = openfl_events_EventDispatcher; +com_davidmaletz_faengfl_controls_Gamepad.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + __class__: com_davidmaletz_faengfl_controls_Gamepad +}); +var com_davidmaletz_faengfl_controls_KeyboardKey = function(key) { + com_davidmaletz_faengfl_controls_AbstractKey.call(this); + if(key > 0) { + this.setKey(key); + } else { + this.key = -1; + this.mutable = null; + } +}; +$hxClasses["com.davidmaletz.faengfl.controls.KeyboardKey"] = com_davidmaletz_faengfl_controls_KeyboardKey; +com_davidmaletz_faengfl_controls_KeyboardKey.__name__ = ["com","davidmaletz","faengfl","controls","KeyboardKey"]; +com_davidmaletz_faengfl_controls_KeyboardKey.drawText = function(s,str,x,y,col) { + if(col == null) { + col = 13487565; + } + if(str == null) { + return; + } + var w = com_davidmaletz_faengfl_controls_AbstractKey.key_bitmap.tileWidth; + var h = com_davidmaletz_faengfl_controls_AbstractKey.key_bitmap.tileHeight; + var text = new com_davidmaletz_faengfl_TextSprite(str,new com_fancyfish_faeng_text_CharacterPlacer(w,1),col,1); + text.draw(); + var dy = (h - text.bounds.height * text.get_scaleY()) * 0.5 - 1; + text.set_x(Math.round(x - w * 0.5)); + text.set_y(Math.round(y + dy - h * 0.5)); + s.addChild(text); +}; +com_davidmaletz_faengfl_controls_KeyboardKey.getKeyName = function(key) { + switch(key) { + case 8: + return "BACKSPACE"; + case 9: + return "TAB"; + case 13: + return "ENTER"; + case 16: + return "LSHIFT"; + case 17: + return "LCTRL"; + case 18: + return "LALT"; + case 20: + return "CAPS_LOCK"; + case 27: + return "ESCAPE"; + case 32: + return "SPACE"; + case 33: + return "PAGE_UP"; + case 34: + return "PAGE_DOWN"; + case 35: + return "END"; + case 36: + return "HOME"; + case 37: + return "LEFT"; + case 38: + return "UP"; + case 39: + return "RIGHT"; + case 40: + return "DOWN"; + case 45: + return "INSERT"; + case 46: + return "DELETE"; + case 48: + return "KEY_0"; + case 49: + return "KEY_1"; + case 50: + return "KEY_2"; + case 51: + return "KEY_3"; + case 52: + return "KEY_4"; + case 53: + return "KEY_5"; + case 54: + return "KEY_6"; + case 55: + return "KEY_7"; + case 56: + return "KEY_8"; + case 57: + return "KEY_9"; + case 65: + return "KEY_A"; + case 66: + return "KEY_B"; + case 67: + return "KEY_C"; + case 68: + return "KEY_D"; + case 69: + return "KEY_E"; + case 70: + return "KEY_F"; + case 71: + return "KEY_G"; + case 72: + return "KEY_H"; + case 73: + return "KEY_I"; + case 74: + return "KEY_J"; + case 75: + return "KEY_K"; + case 76: + return "KEY_L"; + case 77: + return "KEY_M"; + case 78: + return "KEY_N"; + case 79: + return "KEY_O"; + case 80: + return "KEY_P"; + case 81: + return "KEY_Q"; + case 82: + return "KEY_R"; + case 83: + return "KEY_S"; + case 84: + return "KEY_T"; + case 85: + return "KEY_U"; + case 86: + return "KEY_V"; + case 87: + return "KEY_W"; + case 88: + return "KEY_X"; + case 89: + return "KEY_Y"; + case 90: + return "KEY_Z"; + case 96: + return "NUMPAD_0"; + case 97: + return "NUMPAD_1"; + case 98: + return "NUMPAD_2"; + case 99: + return "NUMPAD_3"; + case 100: + return "NUMPAD_4"; + case 101: + return "NUMPAD_5"; + case 102: + return "NUMPAD_6"; + case 103: + return "NUMPAD_7"; + case 104: + return "NUMPAD_8"; + case 105: + return "NUMPAD_9"; + case 112: + return "F1"; + case 113: + return "F2"; + case 114: + return "F3"; + case 115: + return "F4"; + case 116: + return "F5"; + case 117: + return "F6"; + case 118: + return "F7"; + case 119: + return "F8"; + case 120: + return "F9"; + case 121: + return "F10"; + case 122: + return "F11"; + case 123: + return "F12"; + case 144: + return "NUM_LOCK"; + case 186: + return "SEMICOLON"; + case 187: + return "EQUALS"; + case 188: + return "COMMA"; + case 189: + return "MINUS"; + case 190: + return "PERIOD"; + case 191: + return "SLASH"; + case 192: + return "BACK_QUOTE"; + case 219: + return "LEFT_BRACKET"; + case 220: + return "BACKSLASH"; + case 221: + return "RIGHT_BRACKET"; + case 222: + return "QUOTE"; + default: + return "?"; + } +}; +com_davidmaletz_faengfl_controls_KeyboardKey.__super__ = com_davidmaletz_faengfl_controls_AbstractKey; +com_davidmaletz_faengfl_controls_KeyboardKey.prototype = $extend(com_davidmaletz_faengfl_controls_AbstractKey.prototype,{ + key: null + ,mutable: null + ,setKey: function(key) { + this.key = key; + this.mutable = com_fancyfish_faeng_common_Lang.getKeyByName(com_davidmaletz_faengfl_controls_KeyboardKey.getKeyName(key)); + } + ,getKeyX: function() { + if(this.mutable == null) { + return 0; + } else { + return this.mutable.get().type + 1; + } + } + ,getKeyY: function() { + return 0; + } + ,draw: function(l,x,y) { + if(this.mutable == null) { + return; + } + var k = this.mutable.get(); + if(k.type >= 0) { + com_davidmaletz_faengfl_controls_AbstractKey.prototype.draw.call(this,l,x,y); + } + com_davidmaletz_faengfl_controls_KeyboardKey.drawText(l,this.mutable.getText(),x,y); + if(k.icon != null) { + var u = 3; + var v = 4; + var _g = k.icon; + switch(_g) { + case "down_arrow": + com_davidmaletz_faengfl_controls_AbstractKey.drawKey(l,x,y,u,v,false,Math.PI); + break; + case "left_arrow": + com_davidmaletz_faengfl_controls_AbstractKey.drawKey(l,x,y,u,v,false,0.5 * Math.PI); + break; + case "right_arrow": + com_davidmaletz_faengfl_controls_AbstractKey.drawKey(l,x,y,u,v,false,-0.5 * Math.PI); + break; + case "up_arrow": + com_davidmaletz_faengfl_controls_AbstractKey.drawKey(l,x,y,u,v); + break; + } + } + } + ,save: function(b) { + b.writeInt16(this.key > 32767 ? 0 : this.key); + } + ,load: function(b) { + this.setKey(b.readInt16()); + } + ,hashCode: function() { + return this.key; + } + ,equals: function(h) { + if(Std["is"](h,com_davidmaletz_faengfl_controls_KeyboardKey)) { + return (js_Boot.__cast(h , com_davidmaletz_faengfl_controls_KeyboardKey)).key == this.key; + } else { + return false; + } + } + ,__class__: com_davidmaletz_faengfl_controls_KeyboardKey +}); +var com_davidmaletz_faengfl_controls_MouseKey = function(b,flash) { + com_davidmaletz_faengfl_controls_AbstractKey.call(this); + this.button = b; + this.flash_ct = flash ? 0 : -1; +}; +$hxClasses["com.davidmaletz.faengfl.controls.MouseKey"] = com_davidmaletz_faengfl_controls_MouseKey; +com_davidmaletz_faengfl_controls_MouseKey.__name__ = ["com","davidmaletz","faengfl","controls","MouseKey"]; +com_davidmaletz_faengfl_controls_MouseKey.__super__ = com_davidmaletz_faengfl_controls_AbstractKey; +com_davidmaletz_faengfl_controls_MouseKey.prototype = $extend(com_davidmaletz_faengfl_controls_AbstractKey.prototype,{ + button: null + ,flash_ct: null + ,getKeyX: function() { + return 0; + } + ,getKeyY: function() { + return 0; + } + ,drawButton: function(l,x,y) { + com_davidmaletz_faengfl_controls_AbstractKey.drawKey(l,x,y,4,this.button == 1 ? 4 : 0,this.button == 2); + } + ,draw: function(l,x,y) { + com_davidmaletz_faengfl_controls_AbstractKey.prototype.draw.call(this,l,x,y); + if(this.flash_ct >= 0) { + this.flash_ct++; + if(this.flash_ct <= 30) { + this.drawButton(l,x,y); + } else if(this.flash_ct >= 60) { + this.flash_ct = 0; + } + } else { + this.drawButton(l,x,y); + } + } + ,save: function(b) { + b.writeByte(this.button); + } + ,load: function(b) { + this.button = b.readByte(); + this.flash_ct = -1; + } + ,hashCode: function() { + return this.button; + } + ,equals: function(h) { + if(Std["is"](h,com_davidmaletz_faengfl_controls_MouseKey)) { + return (js_Boot.__cast(h , com_davidmaletz_faengfl_controls_MouseKey)).button == this.button; + } else { + return false; + } + } + ,__class__: com_davidmaletz_faengfl_controls_MouseKey +}); +var com_davidmaletz_faengfl_effects_Particles = function(w,bounds,p,n_particles) { + this.cleared = true; + com_davidmaletz_lerp_LerpSprite.call(this); + this.world = w; + this.bounds = bounds; + this.particles = []; + this.num_particles = n_particles; + this.power = p; + this.partial = 0; + if(w != null) { + this.old_x = w.get_x(); + this.old_y = w.get_y(); + } +}; +$hxClasses["com.davidmaletz.faengfl.effects.Particles"] = com_davidmaletz_faengfl_effects_Particles; +com_davidmaletz_faengfl_effects_Particles.__name__ = ["com","davidmaletz","faengfl","effects","Particles"]; +com_davidmaletz_faengfl_effects_Particles.__interfaces__ = [AbstractClass]; +com_davidmaletz_faengfl_effects_Particles.__super__ = com_davidmaletz_lerp_LerpSprite; +com_davidmaletz_faengfl_effects_Particles.prototype = $extend(com_davidmaletz_lerp_LerpSprite.prototype,{ + num_particles: null + ,power: null + ,particles: null + ,partial: null + ,world: null + ,bounds: null + ,cleared: null + ,handlParticle: function(frames,dx,dy,particle) { + var s = com_davidmaletz_faengfl_Application._getScale(); + var aw = com_davidmaletz_faengfl_Application.getWidth(); + var wrapLeft = true; + var wrapRight = true; + if(this.world != null) { + wrapLeft = (this.world.get_x() + this.bounds.max_x) * s >= aw; + wrapRight = (this.world.get_x() + this.bounds.min_x) * s <= 0; + } + particle.x += dx; + particle.y += dy; + if(particle.x < 0 && wrapLeft) { + particle.x += aw; + } + if(particle.x > aw && wrapRight) { + particle.x -= aw; + } + if(particle.y > com_davidmaletz_faengfl_Application.getHeight()) { + return false; + } + var hitGround = this.world != null && particle.y + particle.velY * frames > (this.world.get_y() + this.bounds.max_y) * s; + particle.step(frames,hitGround ? ((this.world.get_y() + this.bounds.max_y) * s - particle.y) / (particle.velY * frames) : 1,this.get_graphics()); + return !hitGround; + } + ,spawnParticles: function(ct,left,right,top) { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,prepareRender: function() { + } + ,old_x: null + ,old_y: null + ,handle_frame: function(e) { + com_davidmaletz_lerp_LerpSprite.prototype.handle_frame.call(this,e); + var frames = com_davidmaletz_faengfl_FaengFL.frameTime; + var s = com_davidmaletz_faengfl_Application._getScale(); + var dx = 0.0; + var dy = 0.0; + var aw = com_davidmaletz_faengfl_Application.getWidth(); + var left = 0.0; + var right = aw; + var top = 0.0; + var p = this.power * frames; + if(this.world != null) { + var ah = com_davidmaletz_faengfl_Application.getHeight(); + if((this.world.get_y() + this.bounds.max_y) * s <= 0 || (this.world.get_y() + this.bounds.min_y - 20) * s > ah || (this.world.get_x() + this.bounds.max_x + 60) * s <= 0 || (this.world.get_x() + this.bounds.min_x - 60) * s > aw) { + if(!this.cleared) { + this.get_graphics().clear(); + this.cleared = true; + } + return; + } + dx = this.world.get_x() - this.old_x; + dy = this.world.get_y() * s - this.old_y; + this.old_x = this.world.get_x(); + this.old_y = this.world.get_y() * s; + var t = (this.world.get_y() + this.bounds.min_y) * s; + if(t > 0) { + top = t; + p *= (ah - t) / ah; + } + var l = (this.world.get_x() + this.bounds.min_x) * s; + if(l > 0) { + left = l; + p *= (aw - l) / aw; + } + var r = (this.world.get_x() + this.bounds.max_x) * s; + if(r < aw) { + right = r; + p *= r / aw; + } + if(right < left) { + p = 0; + } + } + this.set_scaleX(this.set_scaleY(1.0 / s)); + var spawn = Math.floor(p); + if(p > spawn) { + this.partial += p - spawn; + if(this.partial > 1) { + ++spawn; + this.partial -= 1; + } + } + var i = this.particles.length; + this.spawnParticles(com_fancyfish_faeng_common_Utils.min(this.num_particles - i,spawn),left,right,top); + if(!this.cleared) { + this.get_graphics().clear(); + } else { + this.cleared = false; + } + this.prepareRender(); + var f = $bind(this,this.handlParticle); + var a1 = frames; + var dx1 = dx; + var dy1 = dy; + var tmp = function(a2) { + return f(a1,dx1,dy1,a2); + }; + this.particles = this.particles.filter(tmp); + } + ,__class__: com_davidmaletz_faengfl_effects_Particles +}); +var com_davidmaletz_faengfl_effects_Particle = function() { +}; +$hxClasses["com.davidmaletz.faengfl.effects.Particle"] = com_davidmaletz_faengfl_effects_Particle; +com_davidmaletz_faengfl_effects_Particle.__name__ = ["com","davidmaletz","faengfl","effects","Particle"]; +com_davidmaletz_faengfl_effects_Particle.__interfaces__ = [AbstractClass]; +com_davidmaletz_faengfl_effects_Particle.prototype = { + x: null + ,y: null + ,velY: null + ,step: function(frames,scale,g) { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,__class__: com_davidmaletz_faengfl_effects_Particle +}; +var com_davidmaletz_faengfl_effects_Rain = function(w,bounds,p,theta,vel,n_drops) { + if(n_drops == null) { + n_drops = 500; + } + if(vel == null) { + vel = 30; + } + if(theta == null) { + theta = 0.4; + } + if(p == null) { + p = 2; + } + com_davidmaletz_faengfl_effects_Particles.call(this,w,bounds,p,n_drops); + this.setAngle(theta,vel); +}; +$hxClasses["com.davidmaletz.faengfl.effects.Rain"] = com_davidmaletz_faengfl_effects_Rain; +com_davidmaletz_faengfl_effects_Rain.__name__ = ["com","davidmaletz","faengfl","effects","Rain"]; +com_davidmaletz_faengfl_effects_Rain.__super__ = com_davidmaletz_faengfl_effects_Particles; +com_davidmaletz_faengfl_effects_Rain.prototype = $extend(com_davidmaletz_faengfl_effects_Particles.prototype,{ + velX: null + ,velY: null + ,setAngle: function(theta,vel) { + this.velX = Math.sin(theta) * vel; + this.velY = Math.cos(theta) * vel; + } + ,spawnParticles: function(ct,minx,maxx,top) { + var ah = com_davidmaletz_faengfl_Application.getHeight(); + if(this.velX > 0) { + minx -= ah * (this.velX / this.velY); + } else { + maxx -= ah * (this.velX / this.velY); + } + var _g1 = 0; + var _g = ct; + while(_g1 < _g) { + var i = _g1++; + var drop = new com_davidmaletz_faengfl_effects__$Rain_Drop(); + drop.x = minx + Math.random() * (maxx - minx); + drop.y = top; + drop.velX = this.velX * (Math.random() * 0.4 + 0.8); + drop.velY = this.velY * (Math.random() * 0.4 + 0.8); + var n = Math.random(); + drop.x -= drop.velX * n; + drop.y -= drop.velY * n; + this.particles.push(drop); + } + } + ,prepareRender: function() { + this.get_graphics().lineStyle(1,13421823,0.6); + } + ,__class__: com_davidmaletz_faengfl_effects_Rain +}); +var com_davidmaletz_faengfl_effects__$Rain_Drop = function() { + com_davidmaletz_faengfl_effects_Particle.call(this); +}; +$hxClasses["com.davidmaletz.faengfl.effects._Rain.Drop"] = com_davidmaletz_faengfl_effects__$Rain_Drop; +com_davidmaletz_faengfl_effects__$Rain_Drop.__name__ = ["com","davidmaletz","faengfl","effects","_Rain","Drop"]; +com_davidmaletz_faengfl_effects__$Rain_Drop.__super__ = com_davidmaletz_faengfl_effects_Particle; +com_davidmaletz_faengfl_effects__$Rain_Drop.prototype = $extend(com_davidmaletz_faengfl_effects_Particle.prototype,{ + velX: null + ,step: function(frames,scale,g) { + var velX = this.velX * frames; + var velY = this.velY * frames; + if(scale < 1) { + velY *= scale; + velX *= scale; + var x = this.x + velX; + var y = this.y + velY; + g.moveTo(x,y); + g.lineTo(x + velX * 0.25,y - velY * 0.25); + } + g.moveTo(this.x,this.y); + g.lineTo(this.x + velX,this.y + velY); + if(scale >= 1) { + this.x += velX; + this.y += velY; + this.velX += Math.random() * 0.5 - 0.25; + } + } + ,__class__: com_davidmaletz_faengfl_effects__$Rain_Drop +}); +var com_davidmaletz_faengfl_effects_Snow = function(w,bounds,p,n_flakes) { + if(n_flakes == null) { + n_flakes = 80; + } + if(p == null) { + p = 0.125; + } + com_davidmaletz_faengfl_effects_Particles.call(this,w,bounds,p,n_flakes); +}; +$hxClasses["com.davidmaletz.faengfl.effects.Snow"] = com_davidmaletz_faengfl_effects_Snow; +com_davidmaletz_faengfl_effects_Snow.__name__ = ["com","davidmaletz","faengfl","effects","Snow"]; +com_davidmaletz_faengfl_effects_Snow.__super__ = com_davidmaletz_faengfl_effects_Particles; +com_davidmaletz_faengfl_effects_Snow.prototype = $extend(com_davidmaletz_faengfl_effects_Particles.prototype,{ + spawnParticles: function(ct,minx,maxx,top) { + var _g1 = 0; + var _g = ct; + while(_g1 < _g) { + var i = _g1++; + var flake = new com_davidmaletz_faengfl_effects__$Snow_Flake(); + flake.alpha = 0.4 + Math.random() * 0.6; + flake.x = minx + Math.random() * (maxx - minx); + flake.y = top - Math.random() * 20; + flake.ang = Math.random() * 0.4 - 0.2; + this.particles.push(flake); + } + } + ,__class__: com_davidmaletz_faengfl_effects_Snow +}); +var com_davidmaletz_faengfl_effects__$Snow_Flake = function() { + com_davidmaletz_faengfl_effects_Particle.call(this); + this.rot = Math.random() * Math.PI * 2; + this.velY = 2; +}; +$hxClasses["com.davidmaletz.faengfl.effects._Snow.Flake"] = com_davidmaletz_faengfl_effects__$Snow_Flake; +com_davidmaletz_faengfl_effects__$Snow_Flake.__name__ = ["com","davidmaletz","faengfl","effects","_Snow","Flake"]; +com_davidmaletz_faengfl_effects__$Snow_Flake.__super__ = com_davidmaletz_faengfl_effects_Particle; +com_davidmaletz_faengfl_effects__$Snow_Flake.prototype = $extend(com_davidmaletz_faengfl_effects_Particle.prototype,{ + ang: null + ,alpha: null + ,rot: null + ,step: function(frames,scale,g) { + var cos = Math.cos(this.rot); + var sin = Math.sin(this.rot); + this.rot += (Math.random() - 0.5) * 0.5; + g.lineStyle(1.5,16777215,this.alpha); + g.moveTo(this.x - cos,this.y - sin); + g.lineTo(this.x + cos,this.y + sin); + this.x += Math.sin(this.ang) * frames; + this.y += Math.cos(this.ang) * frames; + } + ,__class__: com_davidmaletz_faengfl_effects__$Snow_Flake +}); +var com_davidmaletz_faengfl_events_ControllerAxisEvent = function(type,id,a,x,y) { + openfl_events_Event.call(this,type); + this.id = id; + this.axis = a; + this.x = x; + this.y = y; +}; +$hxClasses["com.davidmaletz.faengfl.events.ControllerAxisEvent"] = com_davidmaletz_faengfl_events_ControllerAxisEvent; +com_davidmaletz_faengfl_events_ControllerAxisEvent.__name__ = ["com","davidmaletz","faengfl","events","ControllerAxisEvent"]; +com_davidmaletz_faengfl_events_ControllerAxisEvent.__super__ = openfl_events_Event; +com_davidmaletz_faengfl_events_ControllerAxisEvent.prototype = $extend(openfl_events_Event.prototype,{ + id: null + ,axis: null + ,x: null + ,y: null + ,__class__: com_davidmaletz_faengfl_events_ControllerAxisEvent +}); +var com_davidmaletz_faengfl_events_ControllerButtonEvent = function(type,id,b) { + openfl_events_Event.call(this,type); + this.id = id; + this.button = b; +}; +$hxClasses["com.davidmaletz.faengfl.events.ControllerButtonEvent"] = com_davidmaletz_faengfl_events_ControllerButtonEvent; +com_davidmaletz_faengfl_events_ControllerButtonEvent.__name__ = ["com","davidmaletz","faengfl","events","ControllerButtonEvent"]; +com_davidmaletz_faengfl_events_ControllerButtonEvent.__super__ = openfl_events_Event; +com_davidmaletz_faengfl_events_ControllerButtonEvent.prototype = $extend(openfl_events_Event.prototype,{ + id: null + ,button: null + ,__class__: com_davidmaletz_faengfl_events_ControllerButtonEvent +}); +var com_davidmaletz_faengfl_events_FloatEvent = function(type,v) { + openfl_events_Event.call(this,type); + this.value = v; +}; +$hxClasses["com.davidmaletz.faengfl.events.FloatEvent"] = com_davidmaletz_faengfl_events_FloatEvent; +com_davidmaletz_faengfl_events_FloatEvent.__name__ = ["com","davidmaletz","faengfl","events","FloatEvent"]; +com_davidmaletz_faengfl_events_FloatEvent.__super__ = openfl_events_Event; +com_davidmaletz_faengfl_events_FloatEvent.prototype = $extend(openfl_events_Event.prototype,{ + value: null + ,__class__: com_davidmaletz_faengfl_events_FloatEvent +}); +var com_davidmaletz_faengfl_events_IntEvent = function(type,v) { + openfl_events_Event.call(this,type); + this.value = v; +}; +$hxClasses["com.davidmaletz.faengfl.events.IntEvent"] = com_davidmaletz_faengfl_events_IntEvent; +com_davidmaletz_faengfl_events_IntEvent.__name__ = ["com","davidmaletz","faengfl","events","IntEvent"]; +com_davidmaletz_faengfl_events_IntEvent.__super__ = openfl_events_Event; +com_davidmaletz_faengfl_events_IntEvent.prototype = $extend(openfl_events_Event.prototype,{ + value: null + ,__class__: com_davidmaletz_faengfl_events_IntEvent +}); +var com_davidmaletz_faengfl_events_ObjectEvent = function(type,v) { + openfl_events_Event.call(this,type); + this.value = v; +}; +$hxClasses["com.davidmaletz.faengfl.events.ObjectEvent"] = com_davidmaletz_faengfl_events_ObjectEvent; +com_davidmaletz_faengfl_events_ObjectEvent.__name__ = ["com","davidmaletz","faengfl","events","ObjectEvent"]; +com_davidmaletz_faengfl_events_ObjectEvent.__super__ = openfl_events_Event; +com_davidmaletz_faengfl_events_ObjectEvent.prototype = $extend(openfl_events_Event.prototype,{ + value: null + ,__class__: com_davidmaletz_faengfl_events_ObjectEvent +}); +var com_davidmaletz_faengfl_events_TEvent = function(type,id,x,y,m) { + openfl_events_Event.call(this,type); + this.id = id; + this.stageX = x; + this.stageY = y; + this.modifiers = m; +}; +$hxClasses["com.davidmaletz.faengfl.events.TEvent"] = com_davidmaletz_faengfl_events_TEvent; +com_davidmaletz_faengfl_events_TEvent.__name__ = ["com","davidmaletz","faengfl","events","TEvent"]; +com_davidmaletz_faengfl_events_TEvent.__super__ = openfl_events_Event; +com_davidmaletz_faengfl_events_TEvent.prototype = $extend(openfl_events_Event.prototype,{ + id: null + ,stageX: null + ,stageY: null + ,modifiers: null + ,__class__: com_davidmaletz_faengfl_events_TEvent +}); +var com_davidmaletz_faengfl_transition_Transition = function() { + com_davidmaletz_controls_ClickableWindow.call(this,com_davidmaletz_faengfl_adv_AdvApp.getContainer(),null,true,false,false); +}; +$hxClasses["com.davidmaletz.faengfl.transition.Transition"] = com_davidmaletz_faengfl_transition_Transition; +com_davidmaletz_faengfl_transition_Transition.__name__ = ["com","davidmaletz","faengfl","transition","Transition"]; +com_davidmaletz_faengfl_transition_Transition.__super__ = com_davidmaletz_controls_ClickableWindow; +com_davidmaletz_faengfl_transition_Transition.prototype = $extend(com_davidmaletz_controls_ClickableWindow.prototype,{ + add: function() { + com_davidmaletz_faengfl_adv_AdvApp.getContainer().addDisplay(this,com_davidmaletz_faengfl_adv_AdvApp.getInstance().getTransitionLayer()); + } + ,remove: function() { + if(this.parent != null) { + this.doClose(); + } + } + ,onEmptySelect: function() { + if(this.parent != null) { + this.doClose(); + } + } + ,onCancel: function() { + this.onEmptySelect(); + } + ,canSelect: function(c) { + return true; + } + ,__class__: com_davidmaletz_faengfl_transition_Transition +}); +var com_davidmaletz_faengfl_transition_EllipseFade = function(func,frames,offX,offY) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + com_davidmaletz_faengfl_transition_Transition.call(this); + this.func = func; + var mw = com_davidmaletz_faengfl_Application.getWidth(); + var mh = com_davidmaletz_faengfl_Application.getHeight(); + var w = mw * 16; + var h = mh * 16; + var b = openfl_Assets.getBitmapData("data/ui/ellipse.png"); + this.get_graphics().beginBitmapFill(b,new openfl_geom_Matrix(1,0,0,1,-b.width * 0.5,-b.height * 0.5),false); + this.get_graphics().drawRect(-w * 0.5,-h * 0.5,w,h); + this.get_graphics().endFill(); + this.set_x(mw * 0.5 + offX); + this.set_y(mh * 0.5 + offY); + this.dark = new com_davidmaletz_lerp_LerpSprite(); + var g = this.dark.get_graphics(); + g.beginFill(0); + g.drawRect(-w * 0.5,-h * 0.5,w,h); + g.endFill(); + this.dark.set_alpha(0); + this.addChild(this.dark); + var tmp = this.dark; + var tmp1 = new com_davidmaletz_lerp_AlphaKeyframe(0); + var f = ($_=this.dark,$bind($_,$_.lerp)); + var k = new com_davidmaletz_lerp_AlphaKeyframe(1); + tmp.lerp(tmp1,frames - 20,function() { + f(k,20); + }); + this.set_alpha(0); + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),10); + this.__is_action_key = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + this.set_scaleX(this.set_scaleY(1.5)); + var f1 = $bind(this,this.finish); + var a1 = frames; + var tmp2 = function() { + f1(a1); + }; + this.lerp(new com_davidmaletz_lerp_ScaleKeyframe(0.125,0.125),frames,tmp2); + this.add(); +}; +$hxClasses["com.davidmaletz.faengfl.transition.EllipseFade"] = com_davidmaletz_faengfl_transition_EllipseFade; +com_davidmaletz_faengfl_transition_EllipseFade.__name__ = ["com","davidmaletz","faengfl","transition","EllipseFade"]; +com_davidmaletz_faengfl_transition_EllipseFade.__super__ = com_davidmaletz_faengfl_transition_Transition; +com_davidmaletz_faengfl_transition_EllipseFade.prototype = $extend(com_davidmaletz_faengfl_transition_Transition.prototype,{ + dark: null + ,func: null + ,__is_action_key: null + ,runComplete: function() { + if(this.func != null) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = this.__is_action_key; + this.func(); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + this.func = null; + } + } + ,onEmptySelect: function() { + if(this.parent != null) { + this.runComplete(); + this.remove(); + } + } + ,finish: function(frames) { + if(this.parent != null) { + this.runComplete(); + if(this.stage == null) { + this.add(); + } + this.lerp(new com_davidmaletz_lerp_ScaleKeyframe(1.5,1.5),frames,$bind(this,this.remove)); + this.dark.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),20); + var tmp = new com_davidmaletz_lerp_AlphaKeyframe(1); + var f = $bind(this,this.lerp); + var k = new com_davidmaletz_lerp_AlphaKeyframe(0); + this.lerp(tmp,frames - 10,function() { + f(k,10); + }); + } + } + ,__class__: com_davidmaletz_faengfl_transition_EllipseFade +}); +var com_davidmaletz_faengfl_transition_FadeOut = function(func,frames) { + com_davidmaletz_faengfl_transition_Transition.call(this); + this.func = func; + this.get_graphics().beginFill(0); + this.get_graphics().drawRect(0,0,com_davidmaletz_faengfl_Application.getWidth(),com_davidmaletz_faengfl_Application.getHeight()); + this.get_graphics().endFill(); + this.set_alpha(0); + var f = $bind(this,this.fade); + var a1 = frames; + var tmp = function() { + f(a1); + }; + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(),frames,tmp); + this.__is_action_key = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + this.add(); +}; +$hxClasses["com.davidmaletz.faengfl.transition.FadeOut"] = com_davidmaletz_faengfl_transition_FadeOut; +com_davidmaletz_faengfl_transition_FadeOut.__name__ = ["com","davidmaletz","faengfl","transition","FadeOut"]; +com_davidmaletz_faengfl_transition_FadeOut.__super__ = com_davidmaletz_faengfl_transition_Transition; +com_davidmaletz_faengfl_transition_FadeOut.prototype = $extend(com_davidmaletz_faengfl_transition_Transition.prototype,{ + func: null + ,__is_action_key: null + ,runComplete: function() { + if(this.func != null) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = this.__is_action_key; + this.func(); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + this.func = null; + } + } + ,onEmptySelect: function() { + if(this.parent != null) { + this.runComplete(); + this.remove(); + } + } + ,fade: function(frames) { + if(this.parent != null) { + this.runComplete(); + if(this.stage == null) { + this.add(); + } + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),frames,$bind(this,this.remove)); + } + } + ,__class__: com_davidmaletz_faengfl_transition_FadeOut +}); +var com_davidmaletz_faengfl_transition_LerpModal = function(s,func,frame,o,lerpOnly,updateCamera) { + if(updateCamera == null) { + updateCamera = false; + } + if(lerpOnly == null) { + lerpOnly = false; + } + if(frame == null) { + frame = true; + } + this.first = true; + com_davidmaletz_faengfl_transition_Transition.call(this); + s.addEventListener("addedToStage",$bind(this,this.init)); + s.addEventListener("removedFromStage",$bind(this,this.kill)); + this.sprite = s; + this.onClose = func; + this.frameFunc = frame; + this.updateCamera = updateCamera; + if(updateCamera) { + this.scrollable = s; + } + if(!Std["is"](o,com_davidmaletz_lerp_LerpSprite) && !Std["is"](o,com_davidmaletz_tiles_render_StaticPlayAnimation)) { + this.other = o; + this.lerpOnly = lerpOnly; + } + if(s.stage != null) { + this.init(null); + } +}; +$hxClasses["com.davidmaletz.faengfl.transition.LerpModal"] = com_davidmaletz_faengfl_transition_LerpModal; +com_davidmaletz_faengfl_transition_LerpModal.__name__ = ["com","davidmaletz","faengfl","transition","LerpModal"]; +com_davidmaletz_faengfl_transition_LerpModal.__super__ = com_davidmaletz_faengfl_transition_Transition; +com_davidmaletz_faengfl_transition_LerpModal.prototype = $extend(com_davidmaletz_faengfl_transition_Transition.prototype,{ + first: null + ,sprite: null + ,other: null + ,frameFunc: null + ,lerpOnly: null + ,updateCamera: null + ,scrollable: null + ,kill: function(e) { + this.sprite.removeEventListener("addedToStage",$bind(this,this.init)); + this.sprite.removeEventListener("removedFromStage",$bind(this,this.kill)); + if(this.other != null) { + this.other.advanceTracks(99999); + } + if(this.first) { + this.destroy(e); + this.first = false; + if(this.onClose != null) { + this.onClose(); + } + } + } + ,onEmptySelect: function() { + if(this.first) { + this.sprite.advanceFrame(99999); + if(this.updateCamera) { + this.scrollable.updateScroll(true); + } + this.kill(null); + } + } + ,init: function(e) { + com_davidmaletz_faengfl_transition_Transition.prototype.init.call(this,e); + if(this.frameFunc) { + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.enter_frame)); + } + } + ,destroy: function(e) { + com_davidmaletz_faengfl_transition_Transition.prototype.destroy.call(this,e); + if(this.frameFunc) { + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.enter_frame)); + } + if(e != null) { + this.sprite.removeEventListener("addedToStage",$bind(this,this.init)); + this.sprite.removeEventListener("removedFromStage",$bind(this,this.kill)); + } + } + ,enter_frame: function(e) { + if(this.sprite.canAdvanceModal()) { + this.sprite.advanceFrame(com_davidmaletz_faengfl_FaengFL.frameTime); + } + if(this.updateCamera) { + this.scrollable.updateScroll(true); + } + if(this.other != null && this.other.canAdvanceModal()) { + if(this.lerpOnly) { + this.other.advanceTracks(com_davidmaletz_faengfl_FaengFL.frameTime); + } else { + this.other.advanceFrame(com_davidmaletz_faengfl_FaengFL.frameTime); + } + } + if(!this.sprite.hasLerp()) { + this.kill(null); + } + } + ,__class__: com_davidmaletz_faengfl_transition_LerpModal +}); +var com_davidmaletz_faengfl_transition_Modal = function(s,func,advanceFrames) { + if(advanceFrames == null) { + advanceFrames = false; + } + this.first = true; + com_davidmaletz_faengfl_transition_Transition.call(this); + s.addEventListener("addedToStage",$bind(this,this.init)); + s.addEventListener("removedFromStage",$bind(this,this.kill)); + this.listen = s; + this.onClose = func; + if(advanceFrames && Std["is"](s,com_davidmaletz_lerp_LerpSpriteBase) && !Std["is"](s,com_davidmaletz_lerp_LerpSprite) && !Std["is"](s,com_davidmaletz_tiles_render_StaticPlayAnimation)) { + this.sprite = s; + } + if(s.stage != null) { + this.init(null); + } +}; +$hxClasses["com.davidmaletz.faengfl.transition.Modal"] = com_davidmaletz_faengfl_transition_Modal; +com_davidmaletz_faengfl_transition_Modal.__name__ = ["com","davidmaletz","faengfl","transition","Modal"]; +com_davidmaletz_faengfl_transition_Modal.__super__ = com_davidmaletz_faengfl_transition_Transition; +com_davidmaletz_faengfl_transition_Modal.prototype = $extend(com_davidmaletz_faengfl_transition_Transition.prototype,{ + first: null + ,sprite: null + ,listen: null + ,init: function(e) { + com_davidmaletz_faengfl_transition_Transition.prototype.init.call(this,e); + if(this.sprite != null) { + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.enter_frame)); + } + } + ,destroy: function(e) { + com_davidmaletz_faengfl_transition_Transition.prototype.destroy.call(this,e); + if(this.sprite != null) { + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.enter_frame)); + } + if(e != null) { + this.listen.removeEventListener("addedToStage",$bind(this,this.init)); + this.listen.removeEventListener("removedFromStage",$bind(this,this.kill)); + } + } + ,enter_frame: function(e) { + if(this.sprite.canAdvanceModal()) { + this.sprite.advanceFrame(com_davidmaletz_faengfl_FaengFL.frameTime); + } + } + ,kill: function(e) { + if(this.first) { + this.first = false; + if(this.sprite != null) { + this.sprite.advanceFrame(99999); + } + this.destroy(e); + if(this.onClose != null) { + this.onClose(); + } + } + this.listen.removeEventListener("addedToStage",$bind(this,this.init)); + this.listen.removeEventListener("removedFromStage",$bind(this,this.kill)); + } + ,onEmptySelect: function() { + if(this.onClose != null) { + this.kill(null); + } + } + ,__class__: com_davidmaletz_faengfl_transition_Modal +}); +var com_davidmaletz_faengfl_transition_ModalAnimation = function(tile,animation,fps,onComplete,other) { + com_davidmaletz_faengfl_transition_Transition.call(this); + this.onClose = onComplete; + this.anim = new com_davidmaletz_tiles_render_TileAnimationRenderer(tile,fps); + this.anim.setAnimation(animation); + this.addChild(this.anim); + this.other = other; + this.add(); +}; +$hxClasses["com.davidmaletz.faengfl.transition.ModalAnimation"] = com_davidmaletz_faengfl_transition_ModalAnimation; +com_davidmaletz_faengfl_transition_ModalAnimation.__name__ = ["com","davidmaletz","faengfl","transition","ModalAnimation"]; +com_davidmaletz_faengfl_transition_ModalAnimation.__super__ = com_davidmaletz_faengfl_transition_Transition; +com_davidmaletz_faengfl_transition_ModalAnimation.prototype = $extend(com_davidmaletz_faengfl_transition_Transition.prototype,{ + anim: null + ,other: null + ,handle_frame: function(e) { + com_davidmaletz_faengfl_transition_Transition.prototype.handle_frame.call(this,e); + this.anim.incFrame(com_davidmaletz_faengfl_FaengFL.frameTime); + if(this.other != null && this.other.canAdvanceModal()) { + this.other.advanceFrame(com_davidmaletz_faengfl_FaengFL.frameTime); + } + if(this.anim.getAnimFrame() >= this.anim.getMaxFrame() - 0.001) { + this.remove(); + } + } + ,__class__: com_davidmaletz_faengfl_transition_ModalAnimation +}); +var com_davidmaletz_faengfl_transition_PlayModal = function(s,func,skippable,o,t) { + if(t == null) { + t = false; + } + com_davidmaletz_faengfl_transition_Modal.call(this,s,func,true); + this.renderer = s; + this.skippable = skippable; + if(!Std["is"](o,com_davidmaletz_lerp_LerpSprite) && !Std["is"](o,com_davidmaletz_tiles_render_StaticPlayAnimation)) { + this.other = o; + } + this.otherTracks = t; +}; +$hxClasses["com.davidmaletz.faengfl.transition.PlayModal"] = com_davidmaletz_faengfl_transition_PlayModal; +com_davidmaletz_faengfl_transition_PlayModal.__name__ = ["com","davidmaletz","faengfl","transition","PlayModal"]; +com_davidmaletz_faengfl_transition_PlayModal.__super__ = com_davidmaletz_faengfl_transition_Modal; +com_davidmaletz_faengfl_transition_PlayModal.prototype = $extend(com_davidmaletz_faengfl_transition_Modal.prototype,{ + animation: null + ,skippable: null + ,other: null + ,otherTracks: null + ,renderer: null + ,initAnim: function() { + this.animation = this.renderer.animation; + } + ,enter_frame: function(e) { + com_davidmaletz_faengfl_transition_Modal.prototype.enter_frame.call(this,e); + if(this.renderer.animation != this.animation) { + this.kill(null); + } + if(this.other != null && this.other.canAdvanceModal()) { + if(this.otherTracks) { + this.other.advanceTracks(com_davidmaletz_faengfl_FaengFL.frameTime); + } else { + this.other.advanceFrame(com_davidmaletz_faengfl_FaengFL.frameTime); + } + } + } + ,onEmptySelect: function() { + if(this.skippable) { + com_davidmaletz_faengfl_transition_Modal.prototype.onEmptySelect.call(this); + } + } + ,__class__: com_davidmaletz_faengfl_transition_PlayModal +}); +var com_davidmaletz_faengfl_transition_Block = function() { + com_davidmaletz_faengfl_transition_Transition.call(this); + this.add(); +}; +$hxClasses["com.davidmaletz.faengfl.transition.Block"] = com_davidmaletz_faengfl_transition_Block; +com_davidmaletz_faengfl_transition_Block.__name__ = ["com","davidmaletz","faengfl","transition","Block"]; +com_davidmaletz_faengfl_transition_Block.__super__ = com_davidmaletz_faengfl_transition_Transition; +com_davidmaletz_faengfl_transition_Block.prototype = $extend(com_davidmaletz_faengfl_transition_Transition.prototype,{ + onEmptySelect: function() { + } + ,__class__: com_davidmaletz_faengfl_transition_Block +}); +var com_davidmaletz_faengfl_transition_Wait = function(frames,onComplete,s,onSelect) { + com_davidmaletz_faengfl_transition_Transition.call(this); + this.set_visible(false); + this.frames = frames; + this.onClose = onComplete; + this.sprites = s; + this.onSelect = onSelect; + this.add(); +}; +$hxClasses["com.davidmaletz.faengfl.transition.Wait"] = com_davidmaletz_faengfl_transition_Wait; +com_davidmaletz_faengfl_transition_Wait.__name__ = ["com","davidmaletz","faengfl","transition","Wait"]; +com_davidmaletz_faengfl_transition_Wait.__super__ = com_davidmaletz_faengfl_transition_Transition; +com_davidmaletz_faengfl_transition_Wait.prototype = $extend(com_davidmaletz_faengfl_transition_Transition.prototype,{ + frames: null + ,sprites: null + ,onSelect: null + ,onEmptySelect: function() { + if(this.onSelect != null) { + this.onSelect(); + } + com_davidmaletz_faengfl_transition_Transition.prototype.onEmptySelect.call(this); + } + ,onCancel: function() { + com_davidmaletz_faengfl_transition_Transition.prototype.onEmptySelect.call(this); + } + ,handle_frame: function(e) { + if(this.sprites != null) { + var _g = 0; + var _g1 = this.sprites; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + if(s.canAdvanceModal()) { + s.advanceFrame(com_davidmaletz_faengfl_FaengFL.frameTime); + } + } + } + com_davidmaletz_faengfl_transition_Transition.prototype.handle_frame.call(this,e); + if(this.frames > 0) { + this.frames -= com_davidmaletz_faengfl_FaengFL.frameTime; + if(this.frames <= 0) { + this.remove(); + } + } + } + ,__class__: com_davidmaletz_faengfl_transition_Wait +}); +var com_davidmaletz_faengfl_ui_Tooltip = function(x,y,text,col,bg,font,formatted,multiline,align) { + if(align == null) { + align = 1; + } + if(multiline == null) { + multiline = false; + } + if(formatted == null) { + formatted = false; + } + if(bg == null) { + bg = -16777216; + } + if(col == null) { + col = 16777215; + } + com_davidmaletz_lerp_LerpSprite.call(this); + if(text != null) { + this._height = formatted ? com_davidmaletz_faengfl_ui_FormattedTooltip.draw(this,text.get(),multiline,col,bg,align) : com_davidmaletz_faengfl_ui_Tooltip.draw(this,text,col,bg,font,align); + } + this.set_x(Math.round(x)); + this.set_y(Math.round(y)); + com_davidmaletz_faengfl_adv_AdvApp.showPopup(this); +}; +$hxClasses["com.davidmaletz.faengfl.ui.Tooltip"] = com_davidmaletz_faengfl_ui_Tooltip; +com_davidmaletz_faengfl_ui_Tooltip.__name__ = ["com","davidmaletz","faengfl","ui","Tooltip"]; +com_davidmaletz_faengfl_ui_Tooltip.draw = function(s,text,col,bg,font,align) { + if(align == null) { + align = 1; + } + if(bg == null) { + bg = -16777216; + } + if(col == null) { + col = 16777215; + } + var t = new com_davidmaletz_faengfl_TextSprite(text,new com_fancyfish_faeng_text_CharacterPlacer(0,align),col,1,font); + s.addChild(t); + var alpha = (bg >> 24 & 255) / 255; + if(alpha > 0) { + t.draw(); + s.get_graphics().beginFill(bg & 16777215,alpha); + var ht = t.bounds.height * t.get_scaleY() + 4; + s.get_graphics().drawRect(t.get_x() + t.bounds.x * t.get_scaleX() - 2,-1.,t.get_y() + t.bounds.width * t.get_scaleX() + 4,ht); + s.get_graphics().endFill(); + return ht; + } else { + return 0; + } +}; +com_davidmaletz_faengfl_ui_Tooltip.__super__ = com_davidmaletz_lerp_LerpSprite; +com_davidmaletz_faengfl_ui_Tooltip.prototype = $extend(com_davidmaletz_lerp_LerpSprite.prototype,{ + _height: null + ,show: function(instant) { + if(instant == null) { + instant = false; + } + this.set_alpha(0); + if(instant) { + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(),10); + } else { + var tmp = new com_davidmaletz_lerp_AlphaKeyframe(0); + var f = $bind(this,this.lerp); + var k = new com_davidmaletz_lerp_AlphaKeyframe(); + this.lerp(tmp,20,function() { + f(k,10); + }); + } + } + ,__class__: com_davidmaletz_faengfl_ui_Tooltip +}); +var com_fancyfish_faeng_display_Rectangle = function(x,y,width,height) { + this.set(x,y,width,height); +}; +$hxClasses["com.fancyfish.faeng.display.Rectangle"] = com_fancyfish_faeng_display_Rectangle; +com_fancyfish_faeng_display_Rectangle.__name__ = ["com","fancyfish","faeng","display","Rectangle"]; +com_fancyfish_faeng_display_Rectangle.prototype = { + x: null + ,y: null + ,width: null + ,height: null + ,setPos: function(x,y) { + this.x = x; + this.y = y; + } + ,setSize: function(width,height) { + this.width = width; + this.height = height; + } + ,set: function(x,y,width,height) { + this.setPos(x,y); + this.setSize(width,height); + } + ,toString: function() { + return "Rect [" + Std.string(this.x) + "," + Std.string(this.y) + ", " + Std.string(this.width) + "," + Std.string(this.height) + "]"; + } + ,__class__: com_fancyfish_faeng_display_Rectangle +}; +var com_fancyfish_faeng_display_Rectangle2D = function(x,y,width,height) { + if(height == null) { + height = 0; + } + if(width == null) { + width = 0; + } + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + com_fancyfish_faeng_display_Rectangle.call(this,x,y,width,height); +}; +$hxClasses["com.fancyfish.faeng.display.Rectangle2D"] = com_fancyfish_faeng_display_Rectangle2D; +com_fancyfish_faeng_display_Rectangle2D.__name__ = ["com","fancyfish","faeng","display","Rectangle2D"]; +com_fancyfish_faeng_display_Rectangle2D.__super__ = com_fancyfish_faeng_display_Rectangle; +com_fancyfish_faeng_display_Rectangle2D.prototype = $extend(com_fancyfish_faeng_display_Rectangle.prototype,{ + reset: function() { + this.x = 100000; + this.y = this.x; + this.width = -this.x * 2; + this.height = this.width; + } + ,addRectangle: function(rx,ry,rwidth,rheight) { + var x2 = Math.max(this.x + this.width,rx + rwidth); + var y2 = Math.max(this.y + this.height,ry + rheight); + this.x = Math.min(this.x,rx); + this.y = Math.min(this.y,ry); + this.width = x2 - this.x; + this.height = y2 - this.y; + } + ,addRect: function(r) { + this.addRectangle(r.x,r.y,r.width,r.height); + } + ,__class__: com_fancyfish_faeng_display_Rectangle2D +}); +var com_fancyfish_faeng_common_mutable_Mutable = function() { + openfl_events_EventDispatcher.call(this); + this.value = null; +}; +$hxClasses["com.fancyfish.faeng.common.mutable.Mutable"] = com_fancyfish_faeng_common_mutable_Mutable; +com_fancyfish_faeng_common_mutable_Mutable.__name__ = ["com","fancyfish","faeng","common","mutable","Mutable"]; +com_fancyfish_faeng_common_mutable_Mutable.__super__ = openfl_events_EventDispatcher; +com_fancyfish_faeng_common_mutable_Mutable.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + value: null + ,getValue: function() { + return null; + } + ,get: function() { + if(this.value == null) { + this.value = this.getValue(); + } + return this.value; + } + ,set: function(v) { + if(this.value != v) { + this.value = v; + this.dispatchEvent(new openfl_events_Event("updated")); + } + } + ,update: function() { + this.value = null; + this.dispatchEvent(new openfl_events_Event("updated")); + } + ,__class__: com_fancyfish_faeng_common_mutable_Mutable +}); +var com_fancyfish_faeng_text_FontManager = function() { }; +$hxClasses["com.fancyfish.faeng.text.FontManager"] = com_fancyfish_faeng_text_FontManager; +com_fancyfish_faeng_text_FontManager.__name__ = ["com","fancyfish","faeng","text","FontManager"]; +com_fancyfish_faeng_text_FontManager.get = function(name) { + return com_fancyfish_faeng_text_FontManager.font_map.get(name); +}; +com_fancyfish_faeng_text_FontManager.set = function(name,f) { + var m = com_fancyfish_faeng_text_FontManager.font_map.get(name); + if(m == null) { + m = new com_fancyfish_faeng_common_mutable_Mutable(); + com_fancyfish_faeng_text_FontManager.font_map.set(name,m); + } + m.set(f); +}; +com_fancyfish_faeng_text_FontManager.reset = function() { + var m = com_fancyfish_faeng_text_FontManager.font_map.iterator(); + while(m.hasNext()) { + var m1 = m.next(); + m1.set(null); + } +}; +com_fancyfish_faeng_text_FontManager.lineHeight = function() { + return Math.round(com_fancyfish_faeng_text_FontManager.defaultFont.get().lineHeight); +}; +var js_Browser = function() { }; +$hxClasses["js.Browser"] = js_Browser; +js_Browser.__name__ = ["js","Browser"]; +js_Browser.__properties__ = {get_location:"get_location",get_document:"get_document",get_window:"get_window"}; +js_Browser.get_window = function() { + return window; +}; +js_Browser.get_document = function() { + return window.document; +}; +js_Browser.get_location = function() { + return window.location; +}; +js_Browser.getLocalStorage = function() { + try { + var s = js_Browser.get_window().localStorage; + s.getItem(""); + return s; + } catch( e ) { + haxe_CallStack.lastException = e; + return null; + } +}; +js_Browser.createXMLHttpRequest = function() { + if(typeof XMLHttpRequest != "undefined") { + return new XMLHttpRequest(); + } + if(typeof ActiveXObject != "undefined") { + return new ActiveXObject("Microsoft.XMLHTTP"); + } + throw new js__$Boot_HaxeError("Unable to create XMLHttpRequest object."); +}; +var openfl_display_LoaderInfo = function() { + openfl_events_EventDispatcher.call(this); + this.applicationDomain = openfl_system_ApplicationDomain.currentDomain; + this.bytesLoaded = 0; + this.bytesTotal = 0; + this.childAllowsParent = true; + this.parameters = { }; +}; +$hxClasses["openfl.display.LoaderInfo"] = openfl_display_LoaderInfo; +openfl_display_LoaderInfo.__name__ = ["openfl","display","LoaderInfo"]; +openfl_display_LoaderInfo.create = function(loader) { + var loaderInfo = new openfl_display_LoaderInfo(); + loaderInfo.uncaughtErrorEvents = new openfl_events_UncaughtErrorEvents(); + if(loader != null) { + loaderInfo.loader = loader; + } else { + loaderInfo.url = openfl_display_LoaderInfo.__rootURL; + } + return loaderInfo; +}; +openfl_display_LoaderInfo.__super__ = openfl_events_EventDispatcher; +openfl_display_LoaderInfo.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + applicationDomain: null + ,bytesLoaded: null + ,bytesTotal: null + ,childAllowsParent: null + ,loader: null + ,parameters: null + ,uncaughtErrorEvents: null + ,url: null + ,__class__: openfl_display_LoaderInfo +}); +var openfl_system_ApplicationDomain = function(parentDomain) { + if(parentDomain != null) { + this.parentDomain = parentDomain; + } else { + this.parentDomain = openfl_system_ApplicationDomain.currentDomain; + } +}; +$hxClasses["openfl.system.ApplicationDomain"] = openfl_system_ApplicationDomain; +openfl_system_ApplicationDomain.__name__ = ["openfl","system","ApplicationDomain"]; +openfl_system_ApplicationDomain.prototype = { + parentDomain: null + ,__class__: openfl_system_ApplicationDomain +}; +var openfl_events_UncaughtErrorEvents = function() { + openfl_events_EventDispatcher.call(this); +}; +$hxClasses["openfl.events.UncaughtErrorEvents"] = openfl_events_UncaughtErrorEvents; +openfl_events_UncaughtErrorEvents.__name__ = ["openfl","events","UncaughtErrorEvents"]; +openfl_events_UncaughtErrorEvents.__super__ = openfl_events_EventDispatcher; +openfl_events_UncaughtErrorEvents.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + __class__: openfl_events_UncaughtErrorEvents +}); +var openfl_geom_Matrix = function(a,b,c,d,tx,ty) { + if(ty == null) { + ty = 0; + } + if(tx == null) { + tx = 0; + } + if(d == null) { + d = 1; + } + if(c == null) { + c = 0; + } + if(b == null) { + b = 0; + } + if(a == null) { + a = 1; + } + this.a = a; + this.b = b; + this.c = c; + this.d = d; + this.tx = tx; + this.ty = ty; +}; +$hxClasses["openfl.geom.Matrix"] = openfl_geom_Matrix; +openfl_geom_Matrix.__name__ = ["openfl","geom","Matrix"]; +openfl_geom_Matrix.prototype = { + a: null + ,b: null + ,c: null + ,d: null + ,tx: null + ,ty: null + ,__array: null + ,clone: function() { + return new openfl_geom_Matrix(this.a,this.b,this.c,this.d,this.tx,this.ty); + } + ,concat: function(m) { + var a1 = this.a * m.a + this.b * m.c; + this.b = this.a * m.b + this.b * m.d; + this.a = a1; + var c1 = this.c * m.a + this.d * m.c; + this.d = this.c * m.b + this.d * m.d; + this.c = c1; + var tx1 = this.tx * m.a + this.ty * m.c + m.tx; + this.ty = this.tx * m.b + this.ty * m.d + m.ty; + this.tx = tx1; + } + ,copyFrom: function(sourceMatrix) { + this.a = sourceMatrix.a; + this.b = sourceMatrix.b; + this.c = sourceMatrix.c; + this.d = sourceMatrix.d; + this.tx = sourceMatrix.tx; + this.ty = sourceMatrix.ty; + } + ,deltaTransformPoint: function(point) { + return new openfl_geom_Point(point.x * this.a + point.y * this.c,point.x * this.b + point.y * this.d); + } + ,identity: function() { + this.a = 1; + this.b = 0; + this.c = 0; + this.d = 1; + this.tx = 0; + this.ty = 0; + } + ,invert: function() { + var norm = this.a * this.d - this.b * this.c; + if(norm == 0) { + this.a = this.b = this.c = this.d = 0; + this.tx = -this.tx; + this.ty = -this.ty; + } else { + norm = 1.0 / norm; + var a1 = this.d * norm; + this.d = this.a * norm; + this.a = a1; + this.b *= -norm; + this.c *= -norm; + var tx1 = -this.a * this.tx - this.c * this.ty; + this.ty = -this.b * this.tx - this.d * this.ty; + this.tx = tx1; + } + return this; + } + ,rotate: function(theta) { + var cos = Math.cos(theta); + var sin = Math.sin(theta); + var a1 = this.a * cos - this.b * sin; + this.b = this.a * sin + this.b * cos; + this.a = a1; + var c1 = this.c * cos - this.d * sin; + this.d = this.c * sin + this.d * cos; + this.c = c1; + var tx1 = this.tx * cos - this.ty * sin; + this.ty = this.tx * sin + this.ty * cos; + this.tx = tx1; + } + ,scale: function(sx,sy) { + this.a *= sx; + this.b *= sy; + this.c *= sx; + this.d *= sy; + this.tx *= sx; + this.ty *= sy; + } + ,setTo: function(a,b,c,d,tx,ty) { + this.a = a; + this.b = b; + this.c = c; + this.d = d; + this.tx = tx; + this.ty = ty; + } + ,transformPoint: function(pos) { + return new openfl_geom_Point(this.__transformX(pos.x,pos.y),this.__transformY(pos.x,pos.y)); + } + ,translate: function(dx,dy) { + this.tx += dx; + this.ty += dy; + } + ,toArray: function(transpose) { + if(transpose == null) { + transpose = false; + } + if(this.__array == null) { + var this1 = new Float32Array(9); + this.__array = this1; + } + if(transpose) { + this.__array[0] = this.a; + this.__array[1] = this.b; + this.__array[2] = 0; + this.__array[3] = this.c; + this.__array[4] = this.d; + this.__array[5] = 0; + this.__array[6] = this.tx; + this.__array[7] = this.ty; + this.__array[8] = 1; + } else { + this.__array[0] = this.a; + this.__array[1] = this.c; + this.__array[2] = this.tx; + this.__array[3] = this.b; + this.__array[4] = this.d; + this.__array[5] = this.ty; + this.__array[6] = 0; + this.__array[7] = 0; + this.__array[8] = 1; + } + return this.__array; + } + ,__toMatrix3: function() { + return new lime_math_Matrix3(this.a,this.b,this.c,this.d,this.tx,this.ty); + } + ,__transformInversePoint: function(point) { + var norm = this.a * this.d - this.b * this.c; + if(norm == 0) { + point.x = -this.tx; + point.y = -this.ty; + } else { + var px = 1.0 / norm * (this.c * (this.ty - point.y) + this.d * (point.x - this.tx)); + point.y = 1.0 / norm * (this.a * (point.y - this.ty) + this.b * (this.tx - point.x)); + point.x = px; + } + } + ,__transformInverseX: function(px,py) { + var norm = this.a * this.d - this.b * this.c; + if(norm == 0) { + return -this.tx; + } else { + return 1.0 / norm * (this.c * (this.ty - py) + this.d * (px - this.tx)); + } + } + ,__transformInverseY: function(px,py) { + var norm = this.a * this.d - this.b * this.c; + if(norm == 0) { + return -this.ty; + } else { + return 1.0 / norm * (this.a * (py - this.ty) + this.b * (this.tx - px)); + } + } + ,__transformX: function(px,py) { + return px * this.a + py * this.c + this.tx; + } + ,__transformY: function(px,py) { + return px * this.b + py * this.d + this.ty; + } + ,__translateTransformed: function(px,py) { + this.tx = this.__transformX(px,py); + this.ty = this.__transformY(px,py); + } + ,__class__: openfl_geom_Matrix +}; +var com_davidmaletz_faengfl_ui_FormattedTooltip = function(x,y,message,multiline,col,bg) { + if(bg == null) { + bg = -16777216; + } + if(col == null) { + col = 16777215; + } + com_davidmaletz_faengfl_ui_Tooltip.call(this,x,y,new com_fancyfish_faeng_common_mutable_Static(message),col,bg,null,true,multiline); +}; +$hxClasses["com.davidmaletz.faengfl.ui.FormattedTooltip"] = com_davidmaletz_faengfl_ui_FormattedTooltip; +com_davidmaletz_faengfl_ui_FormattedTooltip.__name__ = ["com","davidmaletz","faengfl","ui","FormattedTooltip"]; +com_davidmaletz_faengfl_ui_FormattedTooltip.defaultCreate = function(w,align) { + return new com_davidmaletz_faengfl_FormattedText(w,true,null,align); +}; +com_davidmaletz_faengfl_ui_FormattedTooltip.draw = function(s,text,multiline,col,bg,align) { + if(align == null) { + align = 1; + } + if(bg == null) { + bg = -16777216; + } + if(col == null) { + col = 16777215; + } + var w = com_davidmaletz_faengfl_Application.getWidth() - 16; + if(!multiline) { + w *= 2; + } + var t = com_davidmaletz_faengfl_ui_FormattedTooltip.createFormattedText(w,align); + var _g = t; + _g.set_x(_g.get_x() - w * 0.5); + t.default_color = col; + t.setText(text); + s.addChild(t); + var alpha = (bg >> 24 & 255) / 255; + if(alpha > 0) { + s.get_graphics().beginFill(bg & 16777215,alpha); + var ht = (t.bounds.y + t.bounds.height) * t.get_scaleY() + 4; + s.get_graphics().drawRect(t.bounds.x * t.get_scaleX() + t.get_x() - 2,-2,t.bounds.width * t.get_scaleX() + 4,ht); + s.get_graphics().endFill(); + return ht; + } else { + return 0; + } +}; +com_davidmaletz_faengfl_ui_FormattedTooltip.__super__ = com_davidmaletz_faengfl_ui_Tooltip; +com_davidmaletz_faengfl_ui_FormattedTooltip.prototype = $extend(com_davidmaletz_faengfl_ui_Tooltip.prototype,{ + __class__: com_davidmaletz_faengfl_ui_FormattedTooltip +}); +var com_davidmaletz_faengfl_ui_PasswordField = function(c,width,initial,align,sz,color,bg,font,max_length) { + if(max_length == null) { + max_length = -1; + } + if(bg == null) { + bg = 16777215; + } + if(color == null) { + color = 0; + } + if(sz == null) { + sz = 1; + } + if(align == null) { + align = 0; + } + if(initial == null) { + initial = ""; + } + com_davidmaletz_faengfl_ui_TextField.call(this,c,width,initial,align,sz,color,bg,font,max_length); + this.text.type = "password"; +}; +$hxClasses["com.davidmaletz.faengfl.ui.PasswordField"] = com_davidmaletz_faengfl_ui_PasswordField; +com_davidmaletz_faengfl_ui_PasswordField.__name__ = ["com","davidmaletz","faengfl","ui","PasswordField"]; +com_davidmaletz_faengfl_ui_PasswordField.__super__ = com_davidmaletz_faengfl_ui_TextField; +com_davidmaletz_faengfl_ui_PasswordField.prototype = $extend(com_davidmaletz_faengfl_ui_TextField.prototype,{ + __class__: com_davidmaletz_faengfl_ui_PasswordField +}); +var com_davidmaletz_faengfl_ui_Popup = function(x,y,dy,text,col,bg,fadeIn,hold,fadeOut,font,formatted,multiline,align) { + if(align == null) { + align = 1; + } + if(multiline == null) { + multiline = false; + } + if(formatted == null) { + formatted = false; + } + if(fadeOut == null) { + fadeOut = 20; + } + if(hold == null) { + hold = 20; + } + if(fadeIn == null) { + fadeIn = 20; + } + if(bg == null) { + bg = -16777216; + } + if(col == null) { + col = 16777215; + } + this.onComplete = null; + com_davidmaletz_faengfl_ui_Tooltip.call(this,x,y,text,col,bg,font,formatted,multiline,align); + this.set_alpha(0); + this.hold = hold; + this.fadeOut = fadeOut; + if(dy != 0) { + this.lerp(new com_davidmaletz_lerp_PositionKeyframe(x,y + dy),fadeIn + hold + fadeOut); + } + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),fadeIn,$bind(this,this.next)); +}; +$hxClasses["com.davidmaletz.faengfl.ui.Popup"] = com_davidmaletz_faengfl_ui_Popup; +com_davidmaletz_faengfl_ui_Popup.__name__ = ["com","davidmaletz","faengfl","ui","Popup"]; +com_davidmaletz_faengfl_ui_Popup.__super__ = com_davidmaletz_faengfl_ui_Tooltip; +com_davidmaletz_faengfl_ui_Popup.prototype = $extend(com_davidmaletz_faengfl_ui_Tooltip.prototype,{ + hold: null + ,fadeOut: null + ,onComplete: null + ,next: function() { + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),this.hold,$bind(this,this.hide)); + } + ,hide: function() { + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),this.fadeOut,$bind(this,this.remove)); + } + ,remove: function() { + if(this.parent != null) { + this.parent.removeChild(this); + } + if(this.onComplete != null) { + this.onComplete(); + } + } + ,__class__: com_davidmaletz_faengfl_ui_Popup +}); +var com_davidmaletz_lerp_Keyframe = function() { }; +$hxClasses["com.davidmaletz.lerp.Keyframe"] = com_davidmaletz_lerp_Keyframe; +com_davidmaletz_lerp_Keyframe.__name__ = ["com","davidmaletz","lerp","Keyframe"]; +com_davidmaletz_lerp_Keyframe.prototype = { + set: null + ,setFromObject: null + ,getFrame: null + ,setFrame: null + ,interp: null + ,apply: null + ,__class__: com_davidmaletz_lerp_Keyframe +}; +var com_davidmaletz_lerp_AlphaKeyframe = function(a) { + if(a == null) { + a = 1; + } + this.alpha = a; +}; +$hxClasses["com.davidmaletz.lerp.AlphaKeyframe"] = com_davidmaletz_lerp_AlphaKeyframe; +com_davidmaletz_lerp_AlphaKeyframe.__name__ = ["com","davidmaletz","lerp","AlphaKeyframe"]; +com_davidmaletz_lerp_AlphaKeyframe.__interfaces__ = [com_davidmaletz_lerp_Keyframe]; +com_davidmaletz_lerp_AlphaKeyframe.prototype = { + frame: null + ,alpha: null + ,set: function(from) { + var k = js_Boot.__cast(from , com_davidmaletz_lerp_AlphaKeyframe); + this.alpha = k.alpha; + } + ,setFromObject: function(d) { + var a = js_Boot.__cast(d , openfl_display_Sprite); + this.alpha = a.get_alpha(); + } + ,getFrame: function() { + return this.frame; + } + ,setFrame: function(f) { + this.frame = f; + } + ,interp: function(track,other,f) { + var k = js_Boot.__cast(other , com_davidmaletz_lerp_AlphaKeyframe); + return new com_davidmaletz_lerp_AlphaKeyframe(track.interp(this.alpha,k.alpha,f)); + } + ,apply: function(d) { + var a = js_Boot.__cast(d , openfl_display_Sprite); + a.set_alpha(this.alpha); + } + ,toString: function() { + return "ALPHA " + this.frame + " " + this.alpha; + } + ,__class__: com_davidmaletz_lerp_AlphaKeyframe +}; +var com_davidmaletz_lerp_BounceKeyframe = function(_y,dy,ct) { + if(ct == null) { + ct = 0; + } + if(dy == null) { + dy = 0; + } + if(_y == null) { + _y = 0; + } + this.y = _y; + this.dy = dy; + this.bounceCt = ct; +}; +$hxClasses["com.davidmaletz.lerp.BounceKeyframe"] = com_davidmaletz_lerp_BounceKeyframe; +com_davidmaletz_lerp_BounceKeyframe.__name__ = ["com","davidmaletz","lerp","BounceKeyframe"]; +com_davidmaletz_lerp_BounceKeyframe.__interfaces__ = [com_davidmaletz_lerp_Keyframe]; +com_davidmaletz_lerp_BounceKeyframe.prototype = { + frame: null + ,y: null + ,dy: null + ,bounceCt: null + ,set: function(from) { + var k = js_Boot.__cast(from , com_davidmaletz_lerp_BounceKeyframe); + this.y = k.y; + this.dy = k.dy; + this.bounceCt = k.bounceCt; + } + ,setFromObject: function(a) { + this.y = a.get_y(); + this.dy = 0; + this.bounceCt = 0; + } + ,getFrame: function() { + return this.frame; + } + ,setFrame: function(f) { + this.frame = f; + } + ,interp: function(track,other,f) { + var k = js_Boot.__cast(other , com_davidmaletz_lerp_BounceKeyframe); + return new com_davidmaletz_lerp_BounceKeyframe(track.interp(this.y,k.y,f),track.interp(k.dy,this.dy,f),track.interp(this.bounceCt,k.bounceCt,f)); + } + ,apply: function(a) { + var ty = this.y + this.dy * Math.abs(Math.cos(this.bounceCt)); + if(com_davidmaletz_lerp_PositionKeyframe.ROUND) { + a.set_y(Math.round(ty)); + } else { + a.set_y(ty); + } + } + ,toString: function() { + return "BOUNCE " + this.frame + " [" + this.y + "," + this.dy + "]"; + } + ,__class__: com_davidmaletz_lerp_BounceKeyframe +}; +var com_davidmaletz_lerp_ColorKeyframe = function(_r,_g,_b) { + if(_b == null) { + _b = 0; + } + if(_g == null) { + _g = 0; + } + if(_r == null) { + _r = 0; + } + this.r = _r; + this.g = _g; + this.b = _b; +}; +$hxClasses["com.davidmaletz.lerp.ColorKeyframe"] = com_davidmaletz_lerp_ColorKeyframe; +com_davidmaletz_lerp_ColorKeyframe.__name__ = ["com","davidmaletz","lerp","ColorKeyframe"]; +com_davidmaletz_lerp_ColorKeyframe.__interfaces__ = [com_davidmaletz_lerp_Keyframe]; +com_davidmaletz_lerp_ColorKeyframe.fromInt = function(color,white) { + if(white == null) { + white = 255.0; + } + return new com_davidmaletz_lerp_ColorKeyframe((color >> 16 & 255) / white,(color >> 8 & 255) / white,(color & 255) / white); +}; +com_davidmaletz_lerp_ColorKeyframe.prototype = { + frame: null + ,r: null + ,g: null + ,b: null + ,set: function(from) { + var k = js_Boot.__cast(from , com_davidmaletz_lerp_ColorKeyframe); + this.r = k.r; + this.g = k.g; + this.b = k.b; + } + ,setFromObject: function(a) { + var c = a.get_transform().get_colorTransform(); + this.r = c.redMultiplier; + this.g = c.greenMultiplier; + this.b = c.blueMultiplier; + } + ,getFrame: function() { + return this.frame; + } + ,setFrame: function(f) { + this.frame = f; + } + ,interp: function(track,other,f) { + var k = js_Boot.__cast(other , com_davidmaletz_lerp_ColorKeyframe); + return new com_davidmaletz_lerp_ColorKeyframe(track.interp(this.r,k.r,f),track.interp(this.g,k.g,f),track.interp(this.b,k.b,f)); + } + ,apply: function(a) { + var c = a.get_transform().get_colorTransform(); + c.redMultiplier = this.r; + c.greenMultiplier = this.g; + c.blueMultiplier = this.b; + a.get_transform().set_colorTransform(c); + } + ,toString: function() { + return "COLOR " + this.frame + " [" + this.r + "," + this.g + "," + this.b + "]"; + } + ,__class__: com_davidmaletz_lerp_ColorKeyframe +}; +var com_davidmaletz_lerp_DarkenKeyframe = function(a) { + if(a == null) { + a = 1; + } + this.darken = a; +}; +$hxClasses["com.davidmaletz.lerp.DarkenKeyframe"] = com_davidmaletz_lerp_DarkenKeyframe; +com_davidmaletz_lerp_DarkenKeyframe.__name__ = ["com","davidmaletz","lerp","DarkenKeyframe"]; +com_davidmaletz_lerp_DarkenKeyframe.__interfaces__ = [com_davidmaletz_lerp_Keyframe]; +com_davidmaletz_lerp_DarkenKeyframe.setDarkness = function(s,d) { + var a = s.get_transform().get_colorTransform(); + a.redMultiplier = a.greenMultiplier = a.blueMultiplier = d; + s.get_transform().set_colorTransform(a); +}; +com_davidmaletz_lerp_DarkenKeyframe.prototype = { + frame: null + ,darken: null + ,set: function(from) { + var k = js_Boot.__cast(from , com_davidmaletz_lerp_DarkenKeyframe); + this.darken = k.darken; + } + ,setFromObject: function(a) { + this.darken = a.get_transform().get_colorTransform().redMultiplier; + } + ,getFrame: function() { + return this.frame; + } + ,setFrame: function(f) { + this.frame = f; + } + ,interp: function(track,other,f) { + var k = js_Boot.__cast(other , com_davidmaletz_lerp_DarkenKeyframe); + return new com_davidmaletz_lerp_DarkenKeyframe(track.interp(this.darken,k.darken,f)); + } + ,apply: function(a) { + com_davidmaletz_lerp_DarkenKeyframe.setDarkness(a,this.darken); + } + ,toString: function() { + return "DARKEN " + this.frame + " " + this.darken; + } + ,__class__: com_davidmaletz_lerp_DarkenKeyframe +}; +var com_davidmaletz_lerp_LerpSpriteFL = function() { + com_davidmaletz_lerp_LerpSpriteBase.call(this); +}; +$hxClasses["com.davidmaletz.lerp.LerpSpriteFL"] = com_davidmaletz_lerp_LerpSpriteFL; +com_davidmaletz_lerp_LerpSpriteFL.__name__ = ["com","davidmaletz","lerp","LerpSpriteFL"]; +com_davidmaletz_lerp_LerpSpriteFL.__interfaces__ = [com_davidmaletz_faengfl_EnterFrameHandler]; +com_davidmaletz_lerp_LerpSpriteFL.__super__ = com_davidmaletz_lerp_LerpSpriteBase; +com_davidmaletz_lerp_LerpSpriteFL.prototype = $extend(com_davidmaletz_lerp_LerpSpriteBase.prototype,{ + init: function(e) { + this.destroy(null); + com_davidmaletz_faengfl_FaengFL.addEnterFrame(this); + } + ,destroy: function(e) { + com_davidmaletz_faengfl_FaengFL.removeEnterFrame(this); + } + ,enter_frame: function(frames) { + if(this.frameSpeed > 0) { + this.advanceFrame(frames * this.frameSpeed); + } + } + ,canAdvanceModal: function() { + return com_davidmaletz_faengfl_adv_AdvApp.isPaused(); + } + ,__class__: com_davidmaletz_lerp_LerpSpriteFL +}); +var com_davidmaletz_lerp_LerpTrack = function(cls) { + this.keyframe_class = cls; + this.frame = 0; +}; +$hxClasses["com.davidmaletz.lerp.LerpTrack"] = com_davidmaletz_lerp_LerpTrack; +com_davidmaletz_lerp_LerpTrack.__name__ = ["com","davidmaletz","lerp","LerpTrack"]; +com_davidmaletz_lerp_LerpTrack.prototype = { + keyframe_class: null + ,frame: null + ,from: null + ,to: null + ,onComplete: null + ,newKeyframe: function() { + return Type.createEmptyInstance(this.keyframe_class); + } + ,setLerp: function(a,to,frames,onComplete) { + this.from = this.newKeyframe(); + this.from.set(to); + this.from.setFromObject(a); + this.from.setFrame(0); + this.frame = 0; + this.to = to; + to.setFrame(frames); + this.onComplete = onComplete; + } + ,clear: function(a) { + this.from = null; + this.to = null; + this.frame = 0; + } + ,hasKeyframes: function() { + if(this.from != null) { + return this.to != null; + } else { + return false; + } + } + ,getKeyframe: function(f) { + var pf = this.from.getFrame(); + var nf = this.to.getFrame(); + if(f <= pf) { + return this.from; + } else if(f >= nf) { + return this.to; + } else { + return this.from.interp(this,this.to,(f - pf) / (nf - pf)); + } + } + ,getTo: function() { + return this.to; + } + ,getFrame: function() { + return this.frame; + } + ,interp: function(a,b,f) { + return a * (1 - f) + b * f; + } + ,advanceFrame: function(a,df,complete) { + if(this.hasKeyframes()) { + this.frame += df; + if(this.frame < 0) { + this.frame = 0; + } + var k = this.getKeyframe(this.frame); + k.apply(a); + if(k == this.to) { + this.clear(a); + if(this.onComplete != null) { + if(complete != null) { + complete.push(this.onComplete); + } + this.onComplete = null; + } + return false; + } else { + return true; + } + } else { + return false; + } + } + ,__class__: com_davidmaletz_lerp_LerpTrack +}; +var com_davidmaletz_lerp_Tracks = function() { + this.tracks = new haxe_ds_StringMap(); +}; +$hxClasses["com.davidmaletz.lerp.Tracks"] = com_davidmaletz_lerp_Tracks; +com_davidmaletz_lerp_Tracks.__name__ = ["com","davidmaletz","lerp","Tracks"]; +com_davidmaletz_lerp_Tracks.prototype = { + tracks: null + ,hasTrack: function(cls) { + return this.tracks.exists(Type.getClassName(cls)); + } + ,getTrack: function(cls) { + var n = Type.getClassName(cls); + var t = this.tracks.get(n); + if(t == null) { + t = this.createTrack(cls); + this.tracks.set(n,t); + } + return t; + } + ,removeTrack: function(cls) { + this.tracks.remove(Type.getClassName(cls)); + } + ,createTrack: function(cls) { + return null; + } + ,__class__: com_davidmaletz_lerp_Tracks +}; +var com_davidmaletz_lerp_LerpTracks = function() { + com_davidmaletz_lerp_Tracks.call(this); + this.complete = []; +}; +$hxClasses["com.davidmaletz.lerp.LerpTracks"] = com_davidmaletz_lerp_LerpTracks; +com_davidmaletz_lerp_LerpTracks.__name__ = ["com","davidmaletz","lerp","LerpTracks"]; +com_davidmaletz_lerp_LerpTracks.__super__ = com_davidmaletz_lerp_Tracks; +com_davidmaletz_lerp_LerpTracks.prototype = $extend(com_davidmaletz_lerp_Tracks.prototype,{ + complete: null + ,createTrack: function(cls) { + return new com_davidmaletz_lerp_LerpTrack(cls); + } + ,advanceTrack: function(cls,a,df) { + if(this.hasTrack(cls)) { + com_fancyfish_faeng_common_Utils.clear(this.complete); + if(!this.getTrack(cls).advanceFrame(a,df,this.complete)) { + this.removeTrack(cls); + } + var _g = 0; + var _g1 = this.complete; + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + f(); + } + } + } + ,advanceFrame: function(a,df) { + com_fancyfish_faeng_common_Utils.clear(this.complete); + com_fancyfish_faeng_common_Utils.clear(com_davidmaletz_lerp_LerpTracks.remove); + var key = this.tracks.keys(); + while(key.hasNext()) { + var key1 = key.next(); + var t = this.tracks.get(key1); + if(t != null && !t.advanceFrame(a,df,this.complete)) { + com_davidmaletz_lerp_LerpTracks.remove.push(key1); + } + } + var _g = 0; + var _g1 = com_davidmaletz_lerp_LerpTracks.remove; + while(_g < _g1.length) { + var r = _g1[_g]; + ++_g; + this.tracks.remove(r); + } + var _g2 = 0; + var _g11 = this.complete; + while(_g2 < _g11.length) { + var f = _g11[_g2]; + ++_g2; + f(); + } + } + ,isEmpty: function() { + var track = this.tracks.iterator(); + while(track.hasNext()) { + var track1 = track.next(); + if(track1.hasKeyframes()) { + return false; + } + } + return true; + } + ,__class__: com_davidmaletz_lerp_LerpTracks +}); +var com_davidmaletz_lerp_PositionKeyframe = function(_x,_y) { + if(_y == null) { + _y = 0; + } + if(_x == null) { + _x = 0; + } + this.x = _x; + this.y = _y; +}; +$hxClasses["com.davidmaletz.lerp.PositionKeyframe"] = com_davidmaletz_lerp_PositionKeyframe; +com_davidmaletz_lerp_PositionKeyframe.__name__ = ["com","davidmaletz","lerp","PositionKeyframe"]; +com_davidmaletz_lerp_PositionKeyframe.__interfaces__ = [com_davidmaletz_lerp_Keyframe]; +com_davidmaletz_lerp_PositionKeyframe.prototype = { + frame: null + ,x: null + ,y: null + ,set: function(from) { + var k = js_Boot.__cast(from , com_davidmaletz_lerp_PositionKeyframe); + this.x = k.x; + this.y = k.y; + } + ,setPos: function(x,y) { + if(this.x != x || this.y != y) { + this.x = x; + this.y = y; + return true; + } else { + return false; + } + } + ,setFromObject: function(a) { + this.x = a.get_x(); + this.y = a.get_y(); + } + ,getFrame: function() { + return this.frame; + } + ,setFrame: function(f) { + this.frame = f; + } + ,interp: function(track,other,f) { + var k = js_Boot.__cast(other , com_davidmaletz_lerp_PositionKeyframe); + return new com_davidmaletz_lerp_PositionKeyframe(track.interp(this.x,k.x,f),track.interp(this.y,k.y,f)); + } + ,apply: function(a) { + if(com_davidmaletz_lerp_PositionKeyframe.ROUND) { + a.set_x(Math.round(this.x)); + a.set_y(Math.round(this.y)); + } else { + a.set_x(this.x); + a.set_y(this.y); + } + } + ,toString: function() { + return "POS " + this.frame + " [" + this.x + "," + this.y + "]"; + } + ,__class__: com_davidmaletz_lerp_PositionKeyframe +}; +var com_davidmaletz_lerp_RotationKeyframe = function(r) { + if(r == null) { + r = 0; + } + this.rotation = r; +}; +$hxClasses["com.davidmaletz.lerp.RotationKeyframe"] = com_davidmaletz_lerp_RotationKeyframe; +com_davidmaletz_lerp_RotationKeyframe.__name__ = ["com","davidmaletz","lerp","RotationKeyframe"]; +com_davidmaletz_lerp_RotationKeyframe.__interfaces__ = [com_davidmaletz_lerp_Keyframe]; +com_davidmaletz_lerp_RotationKeyframe.prototype = { + frame: null + ,rotation: null + ,set: function(from) { + var k = js_Boot.__cast(from , com_davidmaletz_lerp_RotationKeyframe); + this.rotation = k.rotation; + } + ,setFromObject: function(d) { + var a = js_Boot.__cast(d , openfl_display_Sprite); + this.rotation = a.get_rotation(); + } + ,getFrame: function() { + return this.frame; + } + ,setFrame: function(f) { + this.frame = f; + } + ,interp: function(track,other,f) { + var k = js_Boot.__cast(other , com_davidmaletz_lerp_RotationKeyframe); + return new com_davidmaletz_lerp_RotationKeyframe(track.interp(this.rotation,k.rotation,f)); + } + ,apply: function(d) { + var a = js_Boot.__cast(d , openfl_display_Sprite); + a.set_rotation(this.rotation); + } + ,toString: function() { + return "ROTATION " + this.frame + " " + this.rotation; + } + ,__class__: com_davidmaletz_lerp_RotationKeyframe +}; +var com_davidmaletz_lerp_ScaleKeyframe = function(_x,_y) { + if(_y == null) { + _y = 1; + } + if(_x == null) { + _x = 1; + } + this.x = _x; + this.y = _y; +}; +$hxClasses["com.davidmaletz.lerp.ScaleKeyframe"] = com_davidmaletz_lerp_ScaleKeyframe; +com_davidmaletz_lerp_ScaleKeyframe.__name__ = ["com","davidmaletz","lerp","ScaleKeyframe"]; +com_davidmaletz_lerp_ScaleKeyframe.__interfaces__ = [com_davidmaletz_lerp_Keyframe]; +com_davidmaletz_lerp_ScaleKeyframe.prototype = { + frame: null + ,x: null + ,y: null + ,set: function(from) { + var k = js_Boot.__cast(from , com_davidmaletz_lerp_ScaleKeyframe); + this.x = k.x; + this.y = k.y; + } + ,setFromObject: function(a) { + this.x = a.get_scaleX(); + this.y = a.get_scaleY(); + } + ,getFrame: function() { + return this.frame; + } + ,setFrame: function(f) { + this.frame = f; + } + ,interp: function(track,other,f) { + var k = js_Boot.__cast(other , com_davidmaletz_lerp_ScaleKeyframe); + return new com_davidmaletz_lerp_ScaleKeyframe(track.interp(this.x,k.x,f),track.interp(this.y,k.y,f)); + } + ,apply: function(a) { + a.set_scaleX(this.x); + a.set_scaleY(this.y); + } + ,toString: function() { + return "SCALE " + this.frame + " [" + this.x + "," + this.y + "]"; + } + ,__class__: com_davidmaletz_lerp_ScaleKeyframe +}; +var com_davidmaletz_lerp_ShakeKeyframe = function(ct,dx,dy,sx,sy) { + if(sy == null) { + sy = 0; + } + if(sx == null) { + sx = 0; + } + if(dy == null) { + dy = 0; + } + if(dx == null) { + dx = 1; + } + if(ct == null) { + ct = 0; + } + this.ct = ct * Math.PI; + this.dx = dx; + this.dy = dy; + this.sx = sx; + this.sy = sy; +}; +$hxClasses["com.davidmaletz.lerp.ShakeKeyframe"] = com_davidmaletz_lerp_ShakeKeyframe; +com_davidmaletz_lerp_ShakeKeyframe.__name__ = ["com","davidmaletz","lerp","ShakeKeyframe"]; +com_davidmaletz_lerp_ShakeKeyframe.__interfaces__ = [com_davidmaletz_lerp_Keyframe]; +com_davidmaletz_lerp_ShakeKeyframe.prototype = { + frame: null + ,ct: null + ,dx: null + ,dy: null + ,sx: null + ,sy: null + ,set: function(from) { + var k = js_Boot.__cast(from , com_davidmaletz_lerp_ShakeKeyframe); + this.ct = k.ct; + this.dx = k.dx; + this.dy = k.dy; + this.sx = k.sx; + this.sy = k.sy; + } + ,setFromObject: function(a) { + this.ct = 0; + this.sx = a.get_x(); + this.sy = a.get_y(); + } + ,getFrame: function() { + return this.frame; + } + ,setFrame: function(f) { + this.frame = f; + } + ,interp: function(track,other,f) { + var k = js_Boot.__cast(other , com_davidmaletz_lerp_ShakeKeyframe); + return new com_davidmaletz_lerp_ShakeKeyframe(track.interp(this.ct,k.ct,f),track.interp(this.dx,k.dx,f),track.interp(this.dy,k.dy,f),track.interp(this.sx,k.sx,f),track.interp(this.sy,k.sy,f)); + } + ,apply: function(a) { + if(this.dx != 0) { + a.set_x(this.sx + this.dx * Math.sin(this.ct)); + } + if(this.dy != 0) { + a.set_y(this.sy + this.dy * Math.sin(this.ct)); + } + } + ,toString: function() { + return "SHAKE " + this.frame + " " + this.ct + " [" + this.dx + "," + this.dy + "]"; + } + ,__class__: com_davidmaletz_lerp_ShakeKeyframe +}; +var com_davidmaletz_lerp_XKeyframe = function(_x) { + if(_x == null) { + _x = 0; + } + this.x = _x; +}; +$hxClasses["com.davidmaletz.lerp.XKeyframe"] = com_davidmaletz_lerp_XKeyframe; +com_davidmaletz_lerp_XKeyframe.__name__ = ["com","davidmaletz","lerp","XKeyframe"]; +com_davidmaletz_lerp_XKeyframe.__interfaces__ = [com_davidmaletz_lerp_Keyframe]; +com_davidmaletz_lerp_XKeyframe.prototype = { + frame: null + ,x: null + ,set: function(from) { + var k = js_Boot.__cast(from , com_davidmaletz_lerp_XKeyframe); + this.x = k.x; + } + ,setFromObject: function(a) { + this.x = a.get_x(); + } + ,getFrame: function() { + return this.frame; + } + ,setFrame: function(f) { + this.frame = f; + } + ,interp: function(track,other,f) { + var k = js_Boot.__cast(other , com_davidmaletz_lerp_XKeyframe); + return new com_davidmaletz_lerp_XKeyframe(track.interp(this.x,k.x,f)); + } + ,apply: function(a) { + if(com_davidmaletz_lerp_PositionKeyframe.ROUND) { + a.set_x(Math.round(this.x)); + } else { + a.set_x(this.x); + } + } + ,toString: function() { + return "X " + this.frame + " " + this.x; + } + ,__class__: com_davidmaletz_lerp_XKeyframe +}; +var com_davidmaletz_lerp_YKeyframe = function(_y) { + if(_y == null) { + _y = 0; + } + this.y = _y; +}; +$hxClasses["com.davidmaletz.lerp.YKeyframe"] = com_davidmaletz_lerp_YKeyframe; +com_davidmaletz_lerp_YKeyframe.__name__ = ["com","davidmaletz","lerp","YKeyframe"]; +com_davidmaletz_lerp_YKeyframe.__interfaces__ = [com_davidmaletz_lerp_Keyframe]; +com_davidmaletz_lerp_YKeyframe.prototype = { + frame: null + ,y: null + ,set: function(from) { + var k = js_Boot.__cast(from , com_davidmaletz_lerp_YKeyframe); + this.y = k.y; + } + ,setFromObject: function(a) { + this.y = a.get_y(); + } + ,getFrame: function() { + return this.frame; + } + ,setFrame: function(f) { + this.frame = f; + } + ,setY: function(y) { + if(this.y != y) { + this.y = y; + return true; + } else { + return false; + } + } + ,interp: function(track,other,f) { + var k = js_Boot.__cast(other , com_davidmaletz_lerp_YKeyframe); + return new com_davidmaletz_lerp_YKeyframe(track.interp(this.y,k.y,f)); + } + ,apply: function(a) { + if(com_davidmaletz_lerp_PositionKeyframe.ROUND) { + a.set_y(Math.round(this.y)); + } else { + a.set_y(this.y); + } + } + ,toString: function() { + return "Y " + this.frame + " " + this.y; + } + ,__class__: com_davidmaletz_lerp_YKeyframe +}; +var com_davidmaletz_mining_AchievementInfo = function(xml,path) { + this.id = xml.get("id"); + this.hidden = xml.get("hidden") == "true"; + this.locked = com_davidmaletz_mining_AchievementInfo.parseTile(xml,path,"locked"); + this.unlocked = com_davidmaletz_mining_AchievementInfo.parseTile(xml,path,"unlocked",this.locked); +}; +$hxClasses["com.davidmaletz.mining.AchievementInfo"] = com_davidmaletz_mining_AchievementInfo; +com_davidmaletz_mining_AchievementInfo.__name__ = ["com","davidmaletz","mining","AchievementInfo"]; +com_davidmaletz_mining_AchievementInfo.parseTile = function(xml,path,attr,prev) { + var sheet = xml.exists("sheet") ? com_davidmaletz_faengfl_AutoTileBitmap.get(com_davidmaletz_mining_Main.getResource(path,xml.get("sheet")),-1) : null; + var i = xml.get(attr); + var c = i.charAt(0); + if(prev != null && (c == "-" || c == "+")) { + return new com_davidmaletz_tiles_render_TileOffsetRenderer(prev,com_davidmaletz_mining_Main.parseInt(i),0); + } else if(com_davidmaletz_tiles_Tile.exists(i)) { + return com_davidmaletz_tiles_Tile.get(i); + } else { + return new com_davidmaletz_tiles_render_TileOffsetRenderer(sheet,com_davidmaletz_mining_Main.parseInt(i),0); + } +}; +com_davidmaletz_mining_AchievementInfo.prototype = { + id: null + ,hidden: null + ,locked: null + ,unlocked: null + ,getName: function() { + return com_fancyfish_faeng_common_Lang.getText("achievement.names",this.id); + } + ,getDesc: function() { + return com_fancyfish_faeng_common_Lang.getText("achievement.descriptions",this.id); + } + ,getLocked: function(hide) { + if(hide && this.hidden) { + return com_davidmaletz_tiles_Tile.get("achievement.hidden"); + } else { + return this.locked; + } + } + ,__class__: com_davidmaletz_mining_AchievementInfo +}; +var com_davidmaletz_mining_ColorInfo = function(i,id,t,col) { + this.i = i; + this.id = id; + this.type = t; + this.color = col; +}; +$hxClasses["com.davidmaletz.mining.ColorInfo"] = com_davidmaletz_mining_ColorInfo; +com_davidmaletz_mining_ColorInfo.__name__ = ["com","davidmaletz","mining","ColorInfo"]; +com_davidmaletz_mining_ColorInfo.colors = null; +com_davidmaletz_mining_ColorInfo.load = function(xml) { + if(com_davidmaletz_mining_ColorInfo.colors == null) { + com_davidmaletz_mining_ColorInfo.colors = new haxe_ds_StringMap(); + } + var type = xml.get("type"); + if(xml.exists("equals")) { + com_davidmaletz_mining_ColorInfo.colors.set(type,com_davidmaletz_mining_ColorInfo.get(xml.get("equals"))); + } else { + var ar = com_davidmaletz_mining_ColorInfo.get(type); + var e = xml.elementsNamed("color"); + while(e.hasNext()) { + var e1 = e.next(); + ar.push(new com_davidmaletz_mining_ColorInfo(ar.length,e1.get("id"),type,com_davidmaletz_mining_Main.parseInt("0x" + e1.get("value")))); + } + } +}; +com_davidmaletz_mining_ColorInfo.get = function(type) { + if(type == null || com_davidmaletz_mining_ColorInfo.colors == null) { + return []; + } else { + var r = com_davidmaletz_mining_ColorInfo.colors.get(type); + if(r == null) { + r = []; + com_davidmaletz_mining_ColorInfo.colors.set(type,r); + } + return r; + } +}; +com_davidmaletz_mining_ColorInfo.reset = function() { + com_davidmaletz_mining_ColorInfo.colors = null; +}; +com_davidmaletz_mining_ColorInfo.prototype = { + i: null + ,id: null + ,type: null + ,color: null + ,getName: function() { + if(this.id == null || this.id.length == 0) { + return new com_fancyfish_faeng_common_mutable_Static(Std.string(this.i + 1)); + } else { + return com_fancyfish_faeng_common_Lang.getText("colors",this.id); + } + } + ,__class__: com_davidmaletz_mining_ColorInfo +}; +var js_Lib = function() { }; +$hxClasses["js.Lib"] = js_Lib; +js_Lib.__name__ = ["js","Lib"]; +js_Lib.__properties__ = {get_undefined:"get_undefined"}; +js_Lib.get_undefined = function() { + return undefined; +}; +var com_davidmaletz_mining_DifficultyMode = function(e) { + this.eatCooldown = 0; + this.maxShieldBlock = 50; + this.overweightB = 1; + this.overweightA = 0.1; + this.capacityB = 1; + this.capacityA = 1; + this.pointsB = 1; + this.pointsA = 1; + this.damageB = 1; + this.damageA = 1; + this.xml = e; + if(e == null) { + this.id = "default"; + this.value = 1; + } else { + this.id = e.get("id"); + if(e.exists("maxShieldBlock")) { + this.maxShieldBlock = com_davidmaletz_mining_Main.parseInt(e.get("maxShieldBlock")); + } + if(e.exists("eatCooldown")) { + this.eatCooldown = com_davidmaletz_mining_Main.parseInt(e.get("eatCooldown")); + } + if(e.exists("value")) { + this.value = com_davidmaletz_mining_Main.parseFloat(e.get("value")); + } + var i = e.elementsNamed("damage"); + if(i.hasNext()) { + var xml = i.next(); + if(xml.exists("a")) { + this.damageA = com_davidmaletz_mining_Main.parseFloat(xml.get("a")); + } + if(xml.exists("b")) { + this.damageB = com_davidmaletz_mining_Main.parseFloat(xml.get("b")); + } + } + var i1 = e.elementsNamed("points"); + if(i1.hasNext()) { + var xml1 = i1.next(); + if(xml1.exists("a")) { + this.pointsA = com_davidmaletz_mining_Main.parseFloat(xml1.get("a")); + } + if(xml1.exists("b")) { + this.pointsB = com_davidmaletz_mining_Main.parseFloat(xml1.get("b")); + } + } + var i2 = e.elementsNamed("capacity"); + if(i2.hasNext()) { + var xml2 = i2.next(); + if(xml2.exists("a")) { + this.capacityA = com_davidmaletz_mining_Main.parseFloat(xml2.get("a")); + } + if(xml2.exists("b")) { + this.capacityB = com_davidmaletz_mining_Main.parseFloat(xml2.get("b")); + } + } + var i3 = e.elementsNamed("overweight"); + if(i3.hasNext()) { + var xml3 = i3.next(); + if(xml3.exists("a")) { + this.overweightA = com_davidmaletz_mining_Main.parseFloat(xml3.get("a")); + } + if(xml3.exists("b")) { + this.overweightB = com_davidmaletz_mining_Main.parseFloat(xml3.get("b")); + } + } + } +}; +$hxClasses["com.davidmaletz.mining.DifficultyMode"] = com_davidmaletz_mining_DifficultyMode; +com_davidmaletz_mining_DifficultyMode.__name__ = ["com","davidmaletz","mining","DifficultyMode"]; +com_davidmaletz_mining_DifficultyMode.modes = null; +com_davidmaletz_mining_DifficultyMode.array = null; +com_davidmaletz_mining_DifficultyMode.load = function(xml) { + if(com_davidmaletz_mining_DifficultyMode.modes == null) { + com_davidmaletz_mining_DifficultyMode.modes = new haxe_ds_StringMap(); + } + var m = new com_davidmaletz_mining_DifficultyMode(xml); + if(com_davidmaletz_mining_DifficultyMode.modes.exists(m.id)) { + haxe_Log.trace("Overwrite Difficulty Mode: " + m.id,{ fileName : "DifficultyMode.hx", lineNumber : 52, className : "com.davidmaletz.mining.DifficultyMode", methodName : "load"}); + } + com_davidmaletz_mining_DifficultyMode.modes.set(m.id,m); + if(m.id == "default") { + com_davidmaletz_mining_DifficultyMode.DEFAULT = m; + } + if(com_davidmaletz_mining_DifficultyMode.__current == null || com_davidmaletz_mining_DifficultyMode.__current.id == m.id) { + com_davidmaletz_mining_DifficultyMode.__current = m; + } + return m; +}; +com_davidmaletz_mining_DifficultyMode.get = function(id) { + if(id == null || com_davidmaletz_mining_DifficultyMode.modes == null || !com_davidmaletz_mining_DifficultyMode.modes.exists(id)) { + return com_davidmaletz_mining_DifficultyMode.DEFAULT; + } else { + return com_davidmaletz_mining_DifficultyMode.modes.get(id); + } +}; +com_davidmaletz_mining_DifficultyMode.sortValue = function(a,b) { + return com_fancyfish_faeng_common_Utils.sign(a.value - b.value); +}; +com_davidmaletz_mining_DifficultyMode.createArray = function() { + com_davidmaletz_mining_DifficultyMode.array = []; + var m = com_davidmaletz_mining_DifficultyMode.modes.iterator(); + while(m.hasNext()) { + var m1 = m.next(); + com_davidmaletz_mining_DifficultyMode.array.push(m1); + } + com_davidmaletz_mining_DifficultyMode.array.sort(com_davidmaletz_mining_DifficultyMode.sortValue); +}; +com_davidmaletz_mining_DifficultyMode.getIndex = function(d) { + if(com_davidmaletz_mining_DifficultyMode.array == null) { + com_davidmaletz_mining_DifficultyMode.createArray(); + } + return com_davidmaletz_mining_DifficultyMode.array.indexOf(d); +}; +com_davidmaletz_mining_DifficultyMode.getByIndex = function(i) { + if(com_davidmaletz_mining_DifficultyMode.array == null) { + com_davidmaletz_mining_DifficultyMode.createArray(); + } + if(i >= com_davidmaletz_mining_DifficultyMode.array.length) { + return null; + } else { + return com_davidmaletz_mining_DifficultyMode.array[i]; + } +}; +com_davidmaletz_mining_DifficultyMode.getCount = function() { + if(com_davidmaletz_mining_DifficultyMode.array == null) { + com_davidmaletz_mining_DifficultyMode.createArray(); + } + return com_davidmaletz_mining_DifficultyMode.array.length; +}; +com_davidmaletz_mining_DifficultyMode.exists = function(id) { + if(id != null && com_davidmaletz_mining_DifficultyMode.modes != null) { + return com_davidmaletz_mining_DifficultyMode.modes.exists(id); + } else { + return false; + } +}; +com_davidmaletz_mining_DifficultyMode.reset = function() { + com_davidmaletz_mining_DifficultyMode.modes = null; + com_davidmaletz_mining_DifficultyMode.array = null; + com_davidmaletz_mining_DifficultyMode.load(null); +}; +com_davidmaletz_mining_DifficultyMode.__current = null; +com_davidmaletz_mining_DifficultyMode.setCurrent = function(d) { + if(com_davidmaletz_mining_DifficultyMode.__current != d) { + com_davidmaletz_mining_DifficultyMode.__current = d; + Reflect.setField(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"difficulty",d.id); + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p != null) { + p.setDifficulty(d); + } + } +}; +com_davidmaletz_mining_DifficultyMode.getCurrent = function() { + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p == null) { + return com_davidmaletz_mining_DifficultyMode.__current; + } else { + return p.getDifficulty(); + } +}; +com_davidmaletz_mining_DifficultyMode.prototype = { + id: null + ,xml: null + ,value: null + ,damageA: null + ,damageB: null + ,pointsA: null + ,pointsB: null + ,capacityA: null + ,capacityB: null + ,overweightA: null + ,overweightB: null + ,maxShieldBlock: null + ,eatCooldown: null + ,modify: function(base,a,b) { + if(b == 1) { + return base * a; + } else { + return Math.pow(base,b) * a; + } + } + ,modifyDamage: function(dmg) { + return Math.round(Math.max(1,this.modify(dmg,this.damageA,this.damageB))); + } + ,modifyPoints: function(pts) { + return Math.round(Math.max(0,this.modify(pts,this.pointsA,this.pointsB))); + } + ,modifyCapacity: function(c) { + return Math.round(Math.max(0,this.modify(c,this.capacityA,this.capacityB))); + } + ,modifyOverweightCost: function(o) { + return Math.max(0,this.modify(o,this.overweightA,this.overweightB)); + } + ,__class__: com_davidmaletz_mining_DifficultyMode +}; +var com_davidmaletz_mining_LootHandler = function(iterator) { + this.iterator = iterator; +}; +$hxClasses["com.davidmaletz.mining.LootHandler"] = com_davidmaletz_mining_LootHandler; +com_davidmaletz_mining_LootHandler.__name__ = ["com","davidmaletz","mining","LootHandler"]; +com_davidmaletz_mining_LootHandler.prototype = { + iterator: null + ,loot: null + ,loot_cdf: null + ,load: function() { + this.loot = []; + this.loot_cdf = []; + var total = 0.0; + var e = this.iterator; + while(e.hasNext()) { + var e1 = e.next(); + var ct = e1.exists("count") ? com_davidmaletz_mining_Main.parseInt(e1.get("count")) : 1; + var i = com_davidmaletz_mining_item_ItemInfo.get(e1.get("id")); + this.loot.push(i == null ? null : new com_davidmaletz_mining_item_ItemXmlCt(e1,i,ct)); + total += e1.exists("p") ? com_davidmaletz_mining_Main.parseFloat(e1.get("p")) : 1; + this.loot_cdf.push(total); + if(e1.get("stop") == "true") { + break; + } + } + this.iterator = null; + } + ,getLoot: function(pow) { + if(pow == null) { + pow = 1; + } + if(this.iterator != null) { + this.load(); + } + if(this.loot.length == 0) { + return null; + } else if(this.loot.length == 1) { + return this.loot[0]; + } else { + var r = Math.random(); + return this.loot[com_fancyfish_faeng_common_Utils.drawCDF(this.loot_cdf,pow == 1 ? r : Math.pow(r,pow))]; + } + } + ,getLootAttack: function(e) { + var l = this.getLoot(); + if(l == null) { + return null; + } + var i = com_davidmaletz_mining_world_Element.adjustLoot(e,l.item); + if(l.xml != null && l.xml.get("achievement") != null) { + com_davidmaletz_faengfl_achievement_Achievements.instance.gainAchievement(l.xml.get("achievement")); + } + if(i != null && i != l.item) { + return new com_davidmaletz_mining_item_ItemXmlCt(l.xml,i,l.count); + } else { + return l; + } + } + ,__class__: com_davidmaletz_mining_LootHandler +}; +var com_davidmaletz_mining_TimeKeyframe = function(t) { + this.time = t; +}; +$hxClasses["com.davidmaletz.mining.TimeKeyframe"] = com_davidmaletz_mining_TimeKeyframe; +com_davidmaletz_mining_TimeKeyframe.__name__ = ["com","davidmaletz","mining","TimeKeyframe"]; +com_davidmaletz_mining_TimeKeyframe.__interfaces__ = [com_davidmaletz_lerp_Keyframe]; +com_davidmaletz_mining_TimeKeyframe.prototype = { + frame: null + ,time: null + ,set: function(from) { + var k = js_Boot.__cast(from , com_davidmaletz_mining_TimeKeyframe); + this.time = k.time; + } + ,setFromObject: function(a) { + this.time = (js_Boot.__cast(a , com_davidmaletz_mining_Main)).getGameTime(); + } + ,getFrame: function() { + return this.frame; + } + ,setFrame: function(f) { + this.frame = f; + } + ,interp: function(track,other,f) { + var k = js_Boot.__cast(other , com_davidmaletz_mining_TimeKeyframe); + return new com_davidmaletz_mining_TimeKeyframe(track.interp(this.time,k.time,f)); + } + ,apply: function(a) { + (js_Boot.__cast(a , com_davidmaletz_mining_Main)).setGameTime(this.time); + } + ,__class__: com_davidmaletz_mining_TimeKeyframe +}; +var com_davidmaletz_mining_TimeEvent = function(type,time,frames,forwards) { + openfl_events_Event.call(this,type); + this.time = time; + this.frames = frames; + this.forwards = forwards; +}; +$hxClasses["com.davidmaletz.mining.TimeEvent"] = com_davidmaletz_mining_TimeEvent; +com_davidmaletz_mining_TimeEvent.__name__ = ["com","davidmaletz","mining","TimeEvent"]; +com_davidmaletz_mining_TimeEvent.__super__ = openfl_events_Event; +com_davidmaletz_mining_TimeEvent.prototype = $extend(openfl_events_Event.prototype,{ + time: null + ,frames: null + ,forwards: null + ,__class__: com_davidmaletz_mining_TimeEvent +}); +var com_davidmaletz_mining_MyAchievements = function(settings) { + com_davidmaletz_faengfl_achievement_Achievements.call(this,settings); + this.achievement_list = []; + this.achievement_map = new haxe_ds_StringMap(); +}; +$hxClasses["com.davidmaletz.mining.MyAchievements"] = com_davidmaletz_mining_MyAchievements; +com_davidmaletz_mining_MyAchievements.__name__ = ["com","davidmaletz","mining","MyAchievements"]; +com_davidmaletz_mining_MyAchievements.reset = function() { + var a = js_Boot.__cast(com_davidmaletz_faengfl_achievement_Achievements.instance , com_davidmaletz_mining_MyAchievements); + com_fancyfish_faeng_common_Utils.clear(a.achievement_list); + a.achievement_map = new haxe_ds_StringMap(); +}; +com_davidmaletz_mining_MyAchievements.getAchievements = function() { + return HxOverrides.iter((js_Boot.__cast(com_davidmaletz_faengfl_achievement_Achievements.instance , com_davidmaletz_mining_MyAchievements)).achievement_list); +}; +com_davidmaletz_mining_MyAchievements.__super__ = com_davidmaletz_faengfl_achievement_Achievements; +com_davidmaletz_mining_MyAchievements.prototype = $extend(com_davidmaletz_faengfl_achievement_Achievements.prototype,{ + achievement_list: null + ,achievement_map: null + ,init: function() { + var c = 0; + var l = 0; + var _g = 0; + while(_g < 10) { + var slot = _g++; + var h = com_davidmaletz_mining_Main.getSlotHeader(com_davidmaletz_mining_Main.slotToId(slot)); + if(typeof(h) == "boolean") { + continue; + } + var _c = h.player.getCoins(); + if(_c > c) { + c = _c; + } + var _l = h.player.getLevel() + 1; + if(_l > l) { + l = _l; + } + } + this.submitScore("coins",c); + this.submitScore("level",l); + } + ,add: function(xml,path) { + var a = new com_davidmaletz_mining_AchievementInfo(xml,path); + this.achievement_list.push(a); + this.achievement_map.set(a.id,a); + } + ,isAchievement: function(a) { + return this.achievement_map.exists(a); + } + ,gainAchievement: function(a,silent) { + if(silent == null) { + silent = false; + } + var ret = com_davidmaletz_faengfl_achievement_Achievements.prototype.gainAchievement.call(this,a,silent); + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(!silent && p != null && !p.state.getAchievement(a)) { + var info = this.achievement_map.get(a); + if(info == null) { + return ret; + } + p.state.setAchievement(a,true); + new com_davidmaletz_mining_ui_Achievement(info); + } + return ret; + } + ,postAchievement: function(a,silent) { + var info = this.achievement_map.get(a); + if(info == null) { + return; + } + com_davidmaletz_faengfl_achievement_Achievements.prototype.postAchievement.call(this,a,silent); + } + ,__class__: com_davidmaletz_mining_MyAchievements +}); +var com_davidmaletz_mining_MyController = function(settings) { + com_davidmaletz_controls_Controller.call(this,settings,["up","down","left","right","select","attack","defend","hotkey1","hotkey2","hotkey3","hotkey4","hotkey5","hotkey6","hotkey7","hotkey8","chat"]); +}; +$hxClasses["com.davidmaletz.mining.MyController"] = com_davidmaletz_mining_MyController; +com_davidmaletz_mining_MyController.__name__ = ["com","davidmaletz","mining","MyController"]; +com_davidmaletz_mining_MyController.__super__ = com_davidmaletz_controls_Controller; +com_davidmaletz_mining_MyController.prototype = $extend(com_davidmaletz_controls_Controller.prototype,{ + defaultKeyboard: function(controls) { + com_davidmaletz_controls_Controller.prototype.defaultKeyboard.call(this,controls); + controls.setKey("inventory",new com_davidmaletz_faengfl_controls_KeyboardKey(86)); + controls.setKey("quest",new com_davidmaletz_faengfl_controls_KeyboardKey(com_davidmaletz_controls_Controller.getLayout() == 2 ? 65 : 81)); + controls.setKey("attack",new com_davidmaletz_faengfl_controls_MouseKey(0,false)); + controls.setKey("defend",new com_davidmaletz_faengfl_controls_MouseKey(2,false)); + controls.setKey("attack_alt",new com_davidmaletz_faengfl_controls_KeyboardKey(67)); + controls.setKey("defend_alt",new com_davidmaletz_faengfl_controls_KeyboardKey(32)); + controls.setKey("equipment",new com_davidmaletz_faengfl_controls_KeyboardKey(69)); + controls.setKey("hotkey1",new com_davidmaletz_faengfl_controls_KeyboardKey(49)); + controls.setKey("hotkey2",new com_davidmaletz_faengfl_controls_KeyboardKey(50)); + controls.setKey("hotkey3",new com_davidmaletz_faengfl_controls_KeyboardKey(51)); + controls.setKey("hotkey4",new com_davidmaletz_faengfl_controls_KeyboardKey(52)); + controls.setKey("hotkey5",new com_davidmaletz_faengfl_controls_KeyboardKey(53)); + controls.setKey("hotkey6",new com_davidmaletz_faengfl_controls_KeyboardKey(54)); + controls.setKey("hotkey7",new com_davidmaletz_faengfl_controls_KeyboardKey(55)); + controls.setKey("hotkey8",new com_davidmaletz_faengfl_controls_KeyboardKey(56)); + controls.setKey("mute",new com_davidmaletz_faengfl_controls_KeyboardKey(77)); + controls.setKey("chat",new com_davidmaletz_faengfl_controls_KeyboardKey(9)); + controls.setKey("walk",new com_davidmaletz_faengfl_controls_KeyboardKey(16)); + } + ,fixAltKeyboard: function(controls) { + com_davidmaletz_controls_Controller.prototype.fixAltKeyboard.call(this,controls); + var attack = new com_davidmaletz_faengfl_controls_KeyboardKey(67); + if(controls.getValue(attack) == null) { + controls.setKey("attack_alt",attack); + } + var defend = new com_davidmaletz_faengfl_controls_KeyboardKey(32); + if(controls.getValue(defend) == null) { + controls.setKey("defend_alt",defend); + } + } + ,fixAltGamepad: function(controls) { + com_davidmaletz_controls_Controller.prototype.fixAltGamepad.call(this,controls); + var select = new com_davidmaletz_faengfl_controls_ControllerKey(6); + if(controls.getValue(select) == null) { + controls.setKey("select_alt",select); + } + var cancel = new com_davidmaletz_faengfl_controls_ControllerKey(4); + if(controls.getValue(cancel) == null) { + controls.setKey("cancel_alt",cancel); + } + } + ,defaultGamepad: function(controls) { + com_davidmaletz_controls_Controller.prototype.defaultGamepad.call(this,controls); + controls.setKey("attack",new com_davidmaletz_faengfl_controls_ControllerKey(2)); + controls.setKey("defend",new com_davidmaletz_faengfl_controls_ControllerKey(3)); + controls.setKey("inventory",new com_davidmaletz_faengfl_controls_ControllerKey(12)); + controls.setKey("quest",new com_davidmaletz_faengfl_controls_ControllerKey(11)); + controls.setKey("equipment",new com_davidmaletz_faengfl_controls_ControllerKey(14)); + controls.setKey("walk",new com_davidmaletz_faengfl_controls_ControllerKey(13)); + controls.setKey("hotkey1",new com_davidmaletz_faengfl_controls_ControllerKey(9)); + controls.setKey("hotkey2",new com_davidmaletz_faengfl_controls_ControllerKey(10)); + controls.setKey("hotkey3",new com_davidmaletz_faengfl_controls_AxisKey(4,true)); + controls.setKey("hotkey4",new com_davidmaletz_faengfl_controls_AxisKey(5,true)); + controls.setKey("hotkey5",new com_davidmaletz_faengfl_controls_AxisKey(3,false)); + controls.setKey("hotkey6",new com_davidmaletz_faengfl_controls_AxisKey(3,true)); + controls.setKey("hotkey7",new com_davidmaletz_faengfl_controls_AxisKey(2,false)); + controls.setKey("hotkey8",new com_davidmaletz_faengfl_controls_AxisKey(2,true)); + } + ,validateControls: function(device,controls) { + com_davidmaletz_controls_Controller.prototype.validateControls.call(this,device,controls); + if(controls.getKey("chat") == null && device == 0) { + controls.setKey("chat",new com_davidmaletz_faengfl_controls_KeyboardKey(9)); + } + if(controls.getKey("walk") == null) { + if(device == 0) { + controls.setKey("walk",new com_davidmaletz_faengfl_controls_KeyboardKey(16)); + } else { + controls.setKey("walk",new com_davidmaletz_faengfl_controls_ControllerKey(13)); + } + } + if(controls.getKey("equipment") == null) { + if(device == 0) { + this.defaultKeyboard(controls); + } else { + this.defaultGamepad(controls); + } + } + if(controls.getKey("hotkey5") == null) { + if(device == 0) { + controls.setKey("hotkey5",new com_davidmaletz_faengfl_controls_KeyboardKey(53)); + controls.setKey("hotkey6",new com_davidmaletz_faengfl_controls_KeyboardKey(54)); + controls.setKey("hotkey7",new com_davidmaletz_faengfl_controls_KeyboardKey(55)); + controls.setKey("hotkey8",new com_davidmaletz_faengfl_controls_KeyboardKey(56)); + } else { + controls.setKey("hotkey5",new com_davidmaletz_faengfl_controls_AxisKey(3,false)); + controls.setKey("hotkey6",new com_davidmaletz_faengfl_controls_AxisKey(3,true)); + controls.setKey("hotkey7",new com_davidmaletz_faengfl_controls_AxisKey(2,false)); + controls.setKey("hotkey8",new com_davidmaletz_faengfl_controls_AxisKey(2,true)); + } + } + } + ,__class__: com_davidmaletz_mining_MyController +}); +var com_davidmaletz_mining_OffsetInfo = function(i,id,t,off,e) { + this.i = i; + this.id = id; + this.type = t; + this.offset = off; + this.xml = e; +}; +$hxClasses["com.davidmaletz.mining.OffsetInfo"] = com_davidmaletz_mining_OffsetInfo; +com_davidmaletz_mining_OffsetInfo.__name__ = ["com","davidmaletz","mining","OffsetInfo"]; +com_davidmaletz_mining_OffsetInfo.offsets = null; +com_davidmaletz_mining_OffsetInfo.load = function(xml) { + if(com_davidmaletz_mining_OffsetInfo.offsets == null) { + com_davidmaletz_mining_OffsetInfo.offsets = new haxe_ds_StringMap(); + } + var type = xml.get("type"); + if(xml.exists("equals")) { + com_davidmaletz_mining_OffsetInfo.offsets.set(type,com_davidmaletz_mining_OffsetInfo.get(xml.get("equals"))); + } else { + var addHidden = xml.get("addHidden") == "true"; + var ar = com_davidmaletz_mining_OffsetInfo.get(type); + if(ar.length > 0 && ar[ar.length - 1].offset == com_davidmaletz_faengfl_TileOffset.HIDDEN) { + ar.pop(); + addHidden = true; + } + var e = xml.elementsNamed("offset"); + while(e.hasNext()) { + var e1 = e.next(); + if(e1.exists("count")) { + var st = com_davidmaletz_mining_Main.parseInt(e1.get("start")); + var ct = com_davidmaletz_mining_Main.parseInt(e1.get("count")); + var tile = e1.get("tile"); + var id = e1.get("id"); + var stride = e1.exists("stride") ? Std.parseInt(e1.get("stride")) : 1; + var _g1 = 0; + var _g = ct; + while(_g1 < _g) { + var i = _g1++; + ar.push(new com_davidmaletz_mining_OffsetInfo(ar.length,id,type,new com_davidmaletz_faengfl_TileOffset(tile,st,false),e1)); + st += stride; + } + } else { + ar.push(new com_davidmaletz_mining_OffsetInfo(ar.length,e1.get("id"),type,com_davidmaletz_faengfl_TileOffset.fromXML(e1),e1)); + } + } + if(addHidden) { + if(ar.length == 0 || ar[ar.length - 1].offset != com_davidmaletz_faengfl_TileOffset.HIDDEN) { + ar.push(new com_davidmaletz_mining_OffsetInfo(ar.length,null,type,com_davidmaletz_faengfl_TileOffset.HIDDEN,xml)); + } + } + } +}; +com_davidmaletz_mining_OffsetInfo.getFromOffset = function(type,off) { + var ar = com_davidmaletz_mining_OffsetInfo.get(type); + var _g = 0; + while(_g < ar.length) { + var o = ar[_g]; + ++_g; + if(o.offset.equals(off)) { + return o; + } + } + return null; +}; +com_davidmaletz_mining_OffsetInfo.get = function(type) { + if(type == null || com_davidmaletz_mining_OffsetInfo.offsets == null) { + return []; + } else { + var r = com_davidmaletz_mining_OffsetInfo.offsets.get(type); + if(r == null) { + r = []; + com_davidmaletz_mining_OffsetInfo.offsets.set(type,r); + } + return r; + } +}; +com_davidmaletz_mining_OffsetInfo.reset = function() { + com_davidmaletz_mining_OffsetInfo.offsets = null; +}; +com_davidmaletz_mining_OffsetInfo.prototype = { + i: null + ,id: null + ,type: null + ,offset: null + ,xml: null + ,getName: function() { + if(this.id == null || this.id.length == 0) { + if(this.offset.hidden) { + return com_fancyfish_faeng_common_Lang.getText("common","none"); + } else { + return new com_fancyfish_faeng_common_mutable_Static(Std.string(this.i + 1)); + } + } else { + return com_fancyfish_faeng_common_Lang.getText("offsets",this.id); + } + } + ,__class__: com_davidmaletz_mining_OffsetInfo +}; +var com_davidmaletz_mining_world_BaseObject = function(x,y) { + this.darkness = 1; + this.aabb_id = -1; + openfl_events_EventDispatcher.call(this); + this.area = null; + this.xPos = x; + this.yTile = y; + this._width = com_davidmaletz_tiles_Tile.SIZE; + this._height = com_davidmaletz_tiles_Tile.SIZE; +}; +$hxClasses["com.davidmaletz.mining.world.BaseObject"] = com_davidmaletz_mining_world_BaseObject; +com_davidmaletz_mining_world_BaseObject.__name__ = ["com","davidmaletz","mining","world","BaseObject"]; +com_davidmaletz_mining_world_BaseObject.__interfaces__ = [AbstractClass]; +com_davidmaletz_mining_world_BaseObject.__super__ = openfl_events_EventDispatcher; +com_davidmaletz_mining_world_BaseObject.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + area: null + ,xPos: null + ,yTile: null + ,aabb_id: null + ,_width: null + ,_height: null + ,darkness: null + ,createRenderer: function() { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,renderer: null + ,getRenderer: function() { + if(this.renderer == null) { + this.renderer = this.createRenderer(); + this.set_darkness(1); + if(this.renderer != null) { + this.renderer.__dispatcher = this; + this.updateRendererPos(this.xPos,this.yTile,true); + } + } + return this.renderer; + } + ,updateRenderer: function() { + if(this.area.renderer != null && this.renderer != null && this.renderer.parent != null) { + var p = this.renderer.parent; + var i = p.getChildIndex(this.renderer); + p.removeChild(this.renderer); + this.renderer = null; + p.addChildAt(this.getRenderer(),i); + } else { + this.renderer = null; + } + } + ,getDX: function() { + if(this.renderer == null) { + return 1; + } else { + return -com_fancyfish_faeng_common_Utils.sign(this.renderer.get_scaleX()); + } + } + ,get_alpha: function() { + if(this.renderer == null) { + return 1; + } else { + return this.renderer.get_alpha(); + } + } + ,set_alpha: function(f) { + if(this.renderer == null) { + return 0; + } else { + return this.renderer.set_alpha(f); + } + } + ,getOverlap: function(func,onTile,overlap,pad) { + if(pad == null) { + pad = 0; + } + if(overlap == null) { + overlap = 0.5; + } + var b = this.getBounds(); + if(pad > 0) { + b.inflate(pad,pad); + } + if(this.area != null) { + this.area.getObjects(b,func,onTile,overlap); + } + } + ,getOverlappingObjects: function(filter,onTile,overlap,pad,checkHitbox) { + if(checkHitbox == null) { + checkHitbox = true; + } + if(pad == null) { + pad = 0; + } + if(overlap == null) { + overlap = 0.5; + } + var ret = []; + var addObject = function(o,rect) { + if((filter == null || filter(o)) && ret.indexOf(o) == -1 && (!checkHitbox || o.getHitbox().intersects(rect))) { + ret.push(o); + } + return false; + }; + this.getOverlap(addObject,onTile,overlap,pad); + return ret; + } + ,getOverlappingStructure: function(filter,onTile,overlap) { + if(overlap == null) { + overlap = 0.5; + } + var ret = []; + var addStructure = function(o,r) { + if((filter == null || filter(o)) && ret.indexOf(o) == -1) { + ret.push(o); + } + return false; + }; + this.area.structures.getObjects(this.getBounds(),addStructure,onTile,overlap); + return ret; + } + ,hasOverlap: function(layer) { + if(layer == null) { + layer = -1; + } + var _gthis = this; + var ret = false; + this.getOverlap(function(o,rect) { + var tmp; + if(o != _gthis) { + if(layer != -1) { + var tmp1 = o.getLayer(); + tmp = layer == tmp1; + } else { + tmp = true; + } + } else { + tmp = false; + } + if(tmp) { + ret = true; + return true; + } else { + return false; + } + }); + return ret; + } + ,addedToArea: function() { + } + ,addToArea: function(area) { + if(this.area != area) { + if(this.area != null) { + this.removedFromArea(this.area); + } + this.area = area; + this.addedToArea(); + this.dispatchEvent(new openfl_events_Event("add_to_area")); + } + } + ,removedFromArea: function(area) { + } + ,removeFromArea: function(area) { + if(area == this.area) { + this.area = null; + this.removedFromArea(area); + this.dispatchEvent(new openfl_events_Event("removed_from_area")); + } else { + com_fancyfish_faeng_common_Utils.printStackTrace("No area to remove from"); + } + } + ,changePosition: function(toX,toY) { + } + ,onPositionChanged: function() { + } + ,getOffsetY: function(y) { + if(this.area == null) { + return 0; + } else { + if(y == null) { + y = this.get_tile_y(); + } + var s = this.area.getStructureInTile(this.get_tile_x(),y); + if(s == null) { + return 0; + } else { + return s.info.playerY; + } + } + } + ,isPlayer: function(local) { + if(local == null) { + local = false; + } + return false; + } + ,canSave: function() { + return !this.isPlayer(); + } + ,updateRendererPos: function(old_x,old_y,init) { + if(init == null) { + init = false; + } + this.moveRenderer(old_x,old_y,init); + this.updateRendererLoop(); + this.updateTint(); + } + ,updateRendererLoop: function() { + if(!this.isPlayer(true)) { + com_davidmaletz_mining_renderer_AreaRenderer.updateLoop(this.renderer,this.area); + } + } + ,resetTint: function() { + com_davidmaletz_faengfl_TextSprite.setColor(this.renderer,16777215,255,1,this.darkness); + } + ,updateTint: function() { + var d; + var tmp; + if(this.area != null) { + d = this.area.getWaterDepth(this.getTileCenterX(),this.get_tile_y()); + tmp = d > 0; + } else { + tmp = false; + } + if(tmp) { + com_davidmaletz_faengfl_TextSprite.setColor(this.renderer,2662382,255,d / 64,this.darkness); + } else { + this.resetTint(); + } + } + ,set_darkness: function(d) { + if(d != this.darkness) { + this.darkness = d; + if(this.renderer != null) { + this.updateTint(); + } + } + return this.darkness; + } + ,moveRenderer: function(old_x,old_y,init) { + if(init == null) { + init = false; + } + this.renderer.set_x(Math.floor(this.getCenterX())); + this.renderer.set_y(Math.floor(this.getCenterY() + this.getOffsetY())); + } + ,setPosition: function(x,y,teleport) { + if(teleport == null) { + teleport = false; + } + var loop; + var tmp; + if(this.area != null) { + loop = this.area.getLoop(); + tmp = loop > 0; + } else { + tmp = false; + } + if(tmp) { + loop *= com_davidmaletz_tiles_Tile.SIZE; + x %= loop; + if(x < 0) { + x += loop; + } + } + if(this.xPos != x || this.yTile != y) { + if(this.area != null) { + this.changePosition(x,y + com_davidmaletz_tiles_Tile.SIZE - this._height); + } + var old_x = this.xPos; + var old_y = this.yTile; + this.xPos = x; + this.yTile = y; + this.updatePosition(); + this.onPositionChanged(); + if(this.renderer != null) { + this.renderer.finishTrack(com_davidmaletz_lerp_PositionKeyframe); + if(teleport) { + this.renderer.clearTrack(com_davidmaletz_mining_world_MoveKeyframe); + } + this.updateRendererPos(old_x,old_y); + } + return true; + } else { + return false; + } + } + ,updatePosition: function() { + this.dispatchEvent(new openfl_events_Event("position_changed")); + } + ,yTop: function() { + return this.yTile + com_davidmaletz_tiles_Tile.SIZE - this._height; + } + ,getBounds: function() { + return this._getBounds(com_davidmaletz_mining_world_BaseObject.rectangle); + } + ,intersects: function(r,issect) { + return com_fancyfish_faeng_pack_AABBObjectList.intersects(r,this.getBounds(),issect); + } + ,_getBounds: function(r) { + r.setTo(this.xPos,this.yTop(),this._width,this._height); + return r; + } + ,getCenterX: function() { + var b = this.getBounds(); + return b.x + b.width * 0.5; + } + ,getCenterY: function() { + var b = this.getBounds(); + return b.y + b.height * 0.5; + } + ,getIndex: function() { + if(this.renderer == null || this.renderer.parent == null) { + return -1; + } else { + return this.renderer.parent.getChildIndex(this.renderer); + } + } + ,tile_x: null + ,tile_right: null + ,tile_y: null + ,get_tile_x: function() { + return Math.round(this.xPos / com_davidmaletz_tiles_Tile.SIZE); + } + ,getTileCenterX: function() { + return Math.floor((this.xPos + this._width * 0.5) / com_davidmaletz_tiles_Tile.SIZE); + } + ,getTileCenterY: function() { + return Math.floor((this.yTile + com_davidmaletz_tiles_Tile.SIZE - this._height * 0.5) / com_davidmaletz_tiles_Tile.SIZE); + } + ,get_tile_right: function() { + return Math.floor((this.xPos + this._width) / com_davidmaletz_tiles_Tile.SIZE); + } + ,get_tile_y: function() { + return Math.round(this.yTile / com_davidmaletz_tiles_Tile.SIZE); + } + ,setTile: function(x,y,framesPerPixel,onComplete) { + this.moveTo(x * com_davidmaletz_tiles_Tile.SIZE,y * com_davidmaletz_tiles_Tile.SIZE,framesPerPixel,onComplete); + } + ,getFacing: function() { + if(this.renderer == null) { + return 1; + } else { + return com_fancyfish_faeng_common_Utils.sign(this.renderer.get_scaleX()); + } + } + ,onFlip: function() { + } + ,moveTo: function(x,y,framesPerPixel,onComplete) { + if(this.renderer == null) { + this.setPosition(x,y); + if(onComplete != null) { + onComplete(); + } + } else { + var t = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + var doComplete = onComplete == null ? null : function() { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = t; + onComplete(); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + }; + var dx = x - this.xPos; + var dy = this.yTile - y; + if(this.area != null) { + dx = this.area.adjustDx(dx); + } + this.renderer.lerp(new com_davidmaletz_mining_world_MoveKeyframe(this,this.xPos + dx,y),com_fancyfish_faeng_common_Utils.max(1,Math.round(Math.sqrt(dx * dx + dy * dy) * framesPerPixel)),doComplete); + } + } + ,__class__: com_davidmaletz_mining_world_BaseObject + ,__properties__: {get_tile_y:"get_tile_y",get_tile_right:"get_tile_right",get_tile_x:"get_tile_x",set_alpha:"set_alpha",get_alpha:"get_alpha",set_darkness:"set_darkness"} +}); +var com_davidmaletz_mining_world_RunAnimation = function() { }; +$hxClasses["com.davidmaletz.mining.world.RunAnimation"] = com_davidmaletz_mining_world_RunAnimation; +com_davidmaletz_mining_world_RunAnimation.__name__ = ["com","davidmaletz","mining","world","RunAnimation"]; +com_davidmaletz_mining_world_RunAnimation.prototype = { + runAnimation: null + ,getSprite: null + ,__class__: com_davidmaletz_mining_world_RunAnimation +}; +var com_davidmaletz_mining_world_Object = function(info,x,y) { + this.__last_projectile_time = 0; + this.__last_projectile_id = 0; + this.__last_projectile = null; + this.__id = -1; + this.hitFx = null; + com_davidmaletz_mining_world_BaseObject.call(this,x,y); + this.info = info; + this.health = this.getMaxHealth(); + this.setOffset(); +}; +$hxClasses["com.davidmaletz.mining.world.Object"] = com_davidmaletz_mining_world_Object; +com_davidmaletz_mining_world_Object.__name__ = ["com","davidmaletz","mining","world","Object"]; +com_davidmaletz_mining_world_Object.__interfaces__ = [com_davidmaletz_mining_world_RunAnimation]; +com_davidmaletz_mining_world_Object.point = null; +com_davidmaletz_mining_world_Object.resolveObject = function(o,id) { + return com_davidmaletz_faengfl_adv_sound_Sound.resolve(o.info.sounds,o.info.xml,id); +}; +com_davidmaletz_mining_world_Object.playObject = function(o,id,resolve,stopOnRemove) { + if(stopOnRemove == null) { + stopOnRemove = true; + } + if(resolve == null) { + resolve = true; + } + if(resolve) { + id = com_davidmaletz_mining_world_Object.resolveObject(o,id); + } + return com_davidmaletz_faengfl_adv_sound_Sound.playLoc(id,o.renderer,null,false,o.getSoundScale(),stopOnRemove); +}; +com_davidmaletz_mining_world_Object.isFlagCritical = function(flags) { + return (flags & 1) != 0; +}; +com_davidmaletz_mining_world_Object.isFlagIgnoreArmor = function(flags) { + return (flags & 2) == 2; +}; +com_davidmaletz_mining_world_Object.isFlagHideAttacker = function(flags) { + return (flags & 4) != 0; +}; +com_davidmaletz_mining_world_Object.isFlagNoKill = function(flags) { + return (flags & 8) != 0; +}; +com_davidmaletz_mining_world_Object.getDamage = function(attack,defense,attackElement,defenseElement,critical) { + attack -= defense; + var dmg_ct = 1; + if(critical) { + ++dmg_ct; + } + if(defenseElement != null && defenseElement.isResist(attackElement)) { + --dmg_ct; + } else if(attackElement != null && attackElement.isCritical(defenseElement)) { + ++dmg_ct; + } + if(!(dmg_ct > 1 && attack == 0) && attack <= 0) { + return 0; + } + if(dmg_ct > 1 && attack == 0) { + attack = dmg_ct - 1; + } else if(dmg_ct > 1) { + attack *= dmg_ct; + } else if(dmg_ct < 1) { + attack = Math.floor(attack / 2); + } + return attack; +}; +com_davidmaletz_mining_world_Object.returnFalse = function(o) { + return false; +}; +com_davidmaletz_mining_world_Object.fixOldX = function(area,oldx,_x) { + var loop = area == null ? 0 : area.getLoop() * com_davidmaletz_tiles_Tile.SIZE; + if(loop > 0 && Math.abs(_x - oldx) >= loop * 0.5) { + if(oldx < _x) { + oldx += loop; + } else { + oldx -= loop; + } + } + return oldx; +}; +com_davidmaletz_mining_world_Object.getFrame = function(anim,t) { + if(t == null) { + t = 0; + } + var a = com_davidmaletz_tiles_TileAnimation._get(anim); + if(a != null) { + return a.getFrame(a.getFrameAtTime(t)); + } else { + return null; + } +}; +com_davidmaletz_mining_world_Object.load = function(b,version,addObject) { + var id = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(id == null) { + return false; + } + var x; + var y; + if(version < 21) { + x = b.readInt16() * com_davidmaletz_tiles_Tile.SIZE; + y = b.readInt16() * com_davidmaletz_tiles_Tile.SIZE; + } else { + x = b.readInt32(); + y = b.readInt32(); + } + if(version < 56) { + var o = com_davidmaletz_mining_world_ObjectInfo.get(id).create(x,y); + o.read(b,version); + addObject(o); + } else { + var info = com_davidmaletz_mining_world_ObjectInfo.get(id); + var len = b.readUInt16(); + var bytes = haxe_io_Bytes.alloc(len); + b.readFullBytes(bytes,0,len); + if(info != null) { + try { + var o1 = info.create(x,y); + var bi = new haxe_io_BytesInput(bytes,0,len); + o1.read(bi,version); + if(version >= 75) { + try { + o1.readId(bi); + } catch( e ) { + haxe_CallStack.lastException = e; + } + } + addObject(o1); + } catch( e1 ) { + haxe_CallStack.lastException = e1; + if (e1 instanceof js__$Boot_HaxeError) e1 = e1.val; + com_davidmaletz_mining_Main.error = true; + com_fancyfish_faeng_common_Utils.printExceptionTrace("Failed to load object: " + id + ", " + Std.string(e1)); + } + } + } + return true; +}; +com_davidmaletz_mining_world_Object.save = function(o,b,force) { + if(force == null) { + force = false; + } + if(com_davidmaletz_mining_world_Area.__WRITE_IDS && o.__id >= 0 && o.parent == null) { + force = true; + } + if(!force && (o.parent != null || o.info.xml.get("save") == "false")) { + return; + } + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,o.info.id); + if(!com_davidmaletz_mining_world_Area.__WRITE_IDS) { + o.resetShape(); + } + o.writePosition(b); + var bo = new haxe_io_BytesOutput(); + o.write(bo); + if(com_davidmaletz_mining_world_Area.__WRITE_IDS && o.__id >= 0) { + o.writeId(bo); + } + var bytes = bo.getBytes(); + var len = bytes.length; + b.writeUInt16(len); + b.writeFullBytes(bytes,0,len); +}; +com_davidmaletz_mining_world_Object.writeNull = function(b) { + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); +}; +com_davidmaletz_mining_world_Object.blocker_obj = null; +com_davidmaletz_mining_world_Object.blocker_struc = null; +com_davidmaletz_mining_world_Object.checkStructure = function(addBounds,s) { + addBounds(s,s.getInnerBounds()); + return false; +}; +com_davidmaletz_mining_world_Object._getClosest = function(blocker,b,list,range,scaleX,checkObject,checkTile,filter,dy,issect) { + if(issect == null) { + issect = 0.5; + } + if(dy == null) { + dy = 0; + } + if(scaleX == null) { + scaleX = 1; + } + var center = b.x + b.width * 0.5; + if(range > 0) { + b.x = center; + b.width = 0; + if(scaleX < 0) { + var _g = b; + _g.set_right(_g.get_right() + range); + } else { + var _g1 = b; + _g1.set_left(_g1.get_left() - range); + } + } + var _g2 = b; + _g2.set_top(_g2.get_top() - dy); + var _g3 = b; + _g3.set_bottom(_g3.get_bottom() + dy); + var dist = Infinity; + var oldCen = b.x + b.width * 0.5; + var addBounds = function(n,o,r) { + var cen = n == null ? center : n.x + n.width * 0.5 + center - oldCen; + var a = (cen - r.x) * scaleX; + var _b = (cen - r.get_right()) * scaleX; + if(a < 0 && _b < 0) { + return; + } + var d = Math.max(0,Math.min(a,_b)); + if(d < dist && (o == null || filter == null || filter(o))) { + dist = d; + blocker.object = o; + blocker.bounds.copyFrom(r); + blocker.bounds.x += center - cen; + } + }; + var tmp = checkObject == null ? null : function(o1,r1) { + var f = addBounds; + var n1 = r1; + var tmp1 = function(o2,r2) { + f(n1,o2,r2); + }; + return checkObject(tmp1,o1); + }; + var tmp2; + if(checkTile == null) { + tmp2 = null; + } else { + var f1 = checkTile; + var f2 = addBounds; + var a1 = function(o3,r3) { + f2(null,o3,r3); + }; + tmp2 = function(a2,a3) { + return f1(a1,a2,a3); + }; + } + list.getObjects(b,tmp,tmp2,issect); + if(dist == Infinity) { + return null; + } else { + return blocker; + } +}; +com_davidmaletz_mining_world_Object.getById = function(id,def) { + var a = com_davidmaletz_mining_world_Object.__objects.get(id); + if(a == null) { + return def; + } else { + return a; + } +}; +com_davidmaletz_mining_world_Object.resetIds = function() { + com_davidmaletz_mining_world_Object.__objects = new haxe_ds_IntMap(); + com_davidmaletz_mining_world_Object.__current_id = 0; +}; +com_davidmaletz_mining_world_Object.__super__ = com_davidmaletz_mining_world_BaseObject; +com_davidmaletz_mining_world_Object.prototype = $extend(com_davidmaletz_mining_world_BaseObject.prototype,{ + info: null + ,health: null + ,movement: null + ,__owner: null + ,offsetX: null + ,offsetY: null + ,parent: null + ,setOffset: function() { + this.offsetX = this.info != null && this.info.xml.exists("offsetX") ? com_davidmaletz_mining_Main.parseInt(this.info.xml.get("offsetX")) : 0; + this.offsetY = this.info != null && this.info.xml.exists("offsetY") ? com_davidmaletz_mining_Main.parseInt(this.info.xml.get("offsetY")) : 0; + } + ,addedToArea: function() { + var d = this.info.xml.get("doorway"); + if(d == "horizontal") { + var s = this.area.getStructureInTile(this.get_tile_x() - 1,this.get_tile_y()); + if(s != null) { + s.addExit(this.get_tile_x(),this.get_tile_y()); + } + s = this.area.getStructureInTile(this.get_tile_x(),this.get_tile_y()); + if(s != null) { + s.addExit(this.get_tile_x() - 1,this.get_tile_y()); + } + } else if(d == "vertical") { + var s1 = this.area.getStructureInTile(this.get_tile_x(),this.get_tile_y() - 1); + if(s1 != null) { + s1.addExit(this.get_tile_x(),this.get_tile_y()); + } + s1 = this.area.getStructureInTile(this.get_tile_x(),this.get_tile_y()); + if(s1 != null) { + s1.addExit(this.get_tile_x(),this.get_tile_y() - 1); + } + } + } + ,getId: function() { + return this.info.id; + } + ,getBase: function() { + var ret = Type.getClassName(Type.getClass(this.info)); + var i = ret.lastIndexOf("."); + if(i != -1) { + ret = HxOverrides.substr(ret,i + 1,null); + } + return ret.charAt(0).toLowerCase() + HxOverrides.substr(ret,1,ret.length - 5); + } + ,getLoot: function(e,projectile) { + return null; + } + ,projectileKillCollect: function() { + return this.info.xml.get("projectileKillCollect") == "true"; + } + ,isBack: function() { + return this.info.xml.get("behind") == "true"; + } + ,canDodge: function() { + return this.info.xml.get("canDodge") == "true"; + } + ,hasPriority: function(p,structure) { + return this.getAction(p) != null; + } + ,moveToBack: function() { + if(this.area != null && this.renderer != null && this.renderer.parent != null) { + var i; + if(this.isBack()) { + i = 0; + } else { + var l = this.getLayer(); + i = 0; + var o = this.area.objects.iterator(); + while(o.hasNext()) { + var o1 = o.next(); + if(o1.getLayer() == l && o1.isBack()) { + var t = o1.getIndex() + 1; + if(t > i) { + i = t; + } + } + } + } + this.renderer.parent.setChildIndex(this.renderer,i); + } + } + ,moveToFront: function() { + if(this.area != null && this.renderer != null && this.renderer.parent != null) { + var i; + if(this.isBack()) { + var l = this.getLayer(); + var best = null; + i = 0; + var o = this.area.objects.iterator(); + while(o.hasNext()) { + var o1 = o.next(); + if(o1.getLayer() == l && o1.isBack()) { + var t = o1.getIndex(); + if(t > i) { + i = t; + best = o1; + } + } + } + if(best == this) { + return; + } + } else { + i = this.renderer.parent.get_numChildren(); + } + this.renderer.parent.setChildIndex(this.renderer,i); + } + } + ,getWatchInventory: function() { + return null; + } + ,getHealthPercent: function() { + return this.health / this.getMaxHealth(); + } + ,getHealth: function() { + return this.health; + } + ,getMaxHealth: function() { + if(this.info == null) { + return 0; + } else { + return this.info.health; + } + } + ,restoreHealth: function(p) { + if(p == null) { + p = 1; + } + var h = Math.round(this.getMaxHealth() * p) - this.health; + if(h > 0) { + this.addHealth(h); + } + } + ,onDeath: function(killer,element) { + if(this.health > 0) { + var d = -this.health; + this.health = 0; + this.dispatchEvent(new com_davidmaletz_mining_world_HealthEvent("change_health",null,d)); + } + } + ,defeatedBy: function(p) { + } + ,addHealth: function(h) { + var d = h; + h += this.health; + var max = this.getMaxHealth(); + if(h > max) { + h = max; + } + if(h != this.health) { + this.health = h; + this.dispatchEvent(new com_davidmaletz_mining_world_HealthEvent("change_health",null,d)); + } + } + ,setHealth: function(h,fireDeath,attacker) { + if(fireDeath == null) { + fireDeath = true; + } + if(h < 0) { + h = 0; + } + if(h != this.health) { + var d = h - this.health; + this.health = h; + this.dispatchEvent(new com_davidmaletz_mining_world_HealthEvent("change_health",attacker,d)); + if(this.health == 0 && fireDeath) { + this.onDeath(null,null); + } + } + } + ,getDefaultBlood: function() { + return "blood"; + } + ,getBlood: function() { + if(this.info.xml.exists("blood")) { + var b = this.info.xml.get("blood"); + if(b == "false") { + return null; + } else { + return b; + } + } else { + return this.getDefaultBlood(); + } + } + ,getEvasion: function() { + return 0; + } + ,getPos: function(x,y) { + if(this.renderer == null) { + return null; + } + if(com_davidmaletz_mining_world_Object.point == null) { + com_davidmaletz_mining_world_Object.point = new openfl_geom_Point(x,y); + } else { + com_davidmaletz_mining_world_Object.point.setTo(x,y); + } + return com_davidmaletz_mining_Main.getContainer().globalToLocal(this.renderer.localToGlobal(com_davidmaletz_mining_world_Object.point)); + } + ,showDamageMessage: function(x,y,dy,text,formatted) { + if(formatted == null) { + formatted = false; + } + if((com_davidmaletz_mining_ui_NotificationQueue.OPTIONS & 4) != 0) { + return; + } + var d = 20; + com_davidmaletz_mining_Main.getContainer().addDisplay(new com_davidmaletz_faengfl_ui_Popup(x,y,dy,text,16777215,-16777216,d,d,d,null,formatted),2,true); + } + ,damageNotification: function(h,critical,attacker,offsetY) { + if(offsetY == null) { + offsetY = 0; + } + var p = this.getPos(0,0); + if(p == null) { + return; + } + if(critical) { + this.showDamageMessage(p.x,p.y - com_davidmaletz_tiles_Tile.SIZE * 0.5 + offsetY,-com_davidmaletz_tiles_Tile.SIZE,com_fancyfish_faeng_common_Lang.getText("common","critical_hit")); + } + if(this.info.xml.get("showDamage") == "false") { + return; + } + if(h > 0 && attacker != null) { + com_davidmaletz_mining_Main.getContainer().addDisplay(new com_davidmaletz_faengfl_ui_Popup(p.x,p.y,-com_davidmaletz_tiles_Tile.SIZE * 0.5,new com_fancyfish_faeng_common_mutable_Static(h == null ? "null" : "" + h),16777215,0,10,10,10,com_davidmaletz_mining_Main.damageFont),2,true); + if(this.health - h > 0) { + com_davidmaletz_mining_world_Object.playObject(this,"hit"); + } + } + } + ,numberNotification: function(h,fnt) { + var p = this.getPos(0,0); + if(p == null) { + return; + } + if(h > 0) { + com_davidmaletz_mining_Main.getContainer().addDisplay(new com_davidmaletz_faengfl_ui_Popup(p.x,p.y,-com_davidmaletz_tiles_Tile.SIZE * 0.5,new com_fancyfish_faeng_common_mutable_Static(h == null ? "null" : "" + h),16777215,0,10,10,10,fnt),2,true); + } + } + ,showPopup: function(damageMsg,msg,dx,dy,formatted) { + if(formatted == null) { + formatted = false; + } + if(dy == null) { + dy = 0; + } + if(dx == null) { + dx = 0; + } + var p = this.getPos(dx,dy); + if(p == null) { + return; + } + var d = 20; + if(damageMsg) { + this.showDamageMessage(p.x,p.y - com_davidmaletz_tiles_Tile.SIZE,-com_davidmaletz_tiles_Tile.SIZE,msg,formatted); + } else { + com_davidmaletz_mining_Main.getContainer().addDisplay(new com_davidmaletz_faengfl_ui_Popup(p.x,p.y - com_davidmaletz_tiles_Tile.SIZE,-com_davidmaletz_tiles_Tile.SIZE,msg,16777215,-16777216,d,d,d,null,formatted),2,true); + } + } + ,canHit: function() { + return true; + } + ,autoHeal: function(health) { + return 0; + } + ,getDefense: function(element,behind,critical,useDurability) { + return 0; + } + ,onBlocked: function(attacker,playSFX,behind,showTooltip) { + if(showTooltip == null) { + showTooltip = true; + } + if(this.renderer != null && playSFX) { + com_davidmaletz_mining_world_Object.playObject(this,"blocked"); + } + if(showTooltip) { + this.showPopup(true,com_fancyfish_faeng_common_Lang.getText("common","blocked")); + } + } + ,playSound: function(id,resolve,stopOnRemove) { + if(stopOnRemove == null) { + stopOnRemove = true; + } + if(resolve == null) { + resolve = true; + } + com_davidmaletz_mining_world_Object.playObject(this,id,resolve,stopOnRemove); + } + ,getSoundScale: function() { + if(this.info.xml.exists("soundScale")) { + return com_davidmaletz_mining_Main.parseFloat(this.info.xml.get("soundScale")); + } else { + return 1.0; + } + } + ,getDefenseElement: function() { + return null; + } + ,showElementPopup: function(m,element) { + if((com_davidmaletz_mining_ui_NotificationQueue.OPTIONS & 2) != 0) { + return; + } + var map = new haxe_ds_StringMap(); + map.set("{element}","[tile=" + element.icon + "]"); + this.showPopup(false,new com_fancyfish_faeng_common_mutable_MutableTemplateStatic(m,map),0,0,true); + } + ,isSpirit: function() { + return this.info.xml.get("spirit") == "true"; + } + ,modifyAttack: function(h,attacker) { + return h; + } + ,loseHealth: function(h,flags,attacker,attackElement,scaleX,playSFX) { + if(playSFX == null) { + playSFX = true; + } + if(scaleX == null) { + scaleX = 0; + } + if(flags == null) { + flags = 0; + } + var tt = true; + var critical = com_davidmaletz_mining_world_Object.isFlagCritical(flags); + var dmg_ct = 1; + if(critical) { + ++dmg_ct; + } + if(attacker != null) { + var d = com_davidmaletz_mining_world_Object.isFlagIgnoreArmor(flags) ? 0 : this.getDefense(attackElement,this.renderer != null && com_fancyfish_faeng_common_Utils.sign(this.renderer.get_scaleX()) == com_fancyfish_faeng_common_Utils.sign(scaleX),critical,true); + h -= d; + var e = this.getDefenseElement(); + var effective = false; + if(e != null && e.isResist(attackElement)) { + tt = false; + this.showElementPopup(com_fancyfish_faeng_common_Lang.getText("common","resist"),attackElement); + --dmg_ct; + } else if(attackElement != null && attackElement.isCritical(e)) { + effective = true; + ++dmg_ct; + } + if(!(dmg_ct > 1 && h == 0) && h <= 0) { + if(this.info.xml.get("showDamage") != "false") { + this.onBlocked(attacker,playSFX,this.renderer != null && com_fancyfish_faeng_common_Utils.sign(this.renderer.get_scaleX()) == com_fancyfish_faeng_common_Utils.sign(scaleX),tt); + } + return 0; + } + if(effective) { + tt = false; + this.showElementPopup(com_fancyfish_faeng_common_Lang.getText("common","effective"),attackElement); + } + h = this.modifyAttack(h,attacker); + } + if(dmg_ct > 1 && h == 0) { + h = dmg_ct - 1; + } else if(dmg_ct > 1) { + h *= dmg_ct; + } else if(dmg_ct < 1) { + h = Math.floor(h / 2); + } + var d1 = h; + h = this.health - h; + if(h <= 0 && com_davidmaletz_mining_world_Object.isFlagNoKill(flags)) { + d1 = this.health - 1; + h = 1; + if(d1 == 0) { + this.showPopup(true,com_fancyfish_faeng_common_Lang.getText("common","no_effect")); + } + } + if(h <= 0) { + h = this.autoHeal(h); + var max = this.getMaxHealth(); + if(h > max) { + h = max; + } + if(h <= 0) { + d1 = this.health; + h = 0; + } + } + if(d1 != 0) { + this.damageNotification(d1,critical,attacker,tt ? 0 : -17); + if(this.canFlip() && this.renderer != null && scaleX != 0) { + var f = -com_fancyfish_faeng_common_Utils.sign(scaleX) * this.renderer.get_scaleY(); + if(f != this.renderer.get_scaleX()) { + this.renderer.set_scaleX(f); + this.dispatchEvent(new openfl_events_Event("update_facing")); + } + } + } + if(h != this.health) { + this.health = h; + this.dispatchEvent(new com_davidmaletz_mining_world_HealthEvent("change_health",com_davidmaletz_mining_world_Object.isFlagHideAttacker(flags) ? null : attacker,-d1)); + if(this.health == 0) { + this.onDeath(attacker,attackElement); + } + } + return d1; + } + ,damage: function(h,flags,attacker,attackElement,scaleX,playSFX) { + if(playSFX == null) { + playSFX = true; + } + if(scaleX == null) { + scaleX = 0; + } + if(flags == null) { + flags = 0; + } + var a = this.area; + if(this.area == null || this.getHealth() == 0) { + return 0; + } + var o = this.projectileKillCollect() && attacker != null ? attacker : this; + var ret = this.loseHealth(h,flags,o,attackElement,scaleX,playSFX); + if(attacker != o && this.getHealth() <= 0) { + com_davidmaletz_mining_world_Projectile.spawnLoot(a,this,attacker,attackElement); + } + return ret; + } + ,knockback: function(dx,passObjects) { + if(passObjects == null) { + passObjects = false; + } + if(this.area != null && dx != 0 && this.renderer != null && this.info.xml.get("knockback") != "false" && !this.renderer.hasTrack(com_davidmaletz_lerp_PositionKeyframe)) { + var d = com_fancyfish_faeng_common_Utils.sign(this.renderer.get_scaleX() * dx); + var b = this.getClosest(com_fancyfish_faeng_common_Utils.abs(dx) + this._width,-d,true,passObjects ? com_davidmaletz_mining_world_Object.returnFalse : null); + if(b != null) { + var dist = Math.floor(this.getXDistance(b.bounds,-d)); + if(dist < com_fancyfish_faeng_common_Utils.abs(dx)) { + dx = com_fancyfish_faeng_common_Utils.sign(dx) * dist; + } + } + var oldx = this.renderer.get_x(); + var oldy = this.renderer.get_y(); + this.setPosition(this.xPos + dx,this.yTile); + if(this.renderer == null) { + return; + } + var _x = this.renderer.get_x(); + var _y = this.renderer.get_y(); + if(this.isPlayer(true)) { + oldx = com_davidmaletz_mining_world_Object.fixOldX(this.area,oldx,_x); + } + this.renderer.set_x(oldx); + this.renderer.set_y(oldy); + this.renderer.lerp(new com_davidmaletz_lerp_PositionKeyframe(_x,_y),24); + } + } + ,isBlocking: function(asker) { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,canFlip: function() { + return true; + } + ,canCritical: function() { + return true; + } + ,getLayer: function() { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,getAction: function(p) { + return null; + } + ,onOver: function(p) { + } + ,overlapSecond: function(p) { + } + ,onOut: function(p) { + } + ,onEnter: function(p) { + } + ,onExit: function(p) { + } + ,onOperate: function(p) { + } + ,onPlayerMove: function(p,dx,dy,frames) { + } + ,consumePlayerMove: function(p,dx,dy,frames) { + return false; + } + ,moveRemotePlayer: function(p,dx,dy) { + return false; + } + ,attackPower: function(attack,cut,spirit,element,player) { + return 0; + } + ,changePosition: function(toX,toY) { + this.area.moveObject(this,toX,toY); + } + ,getTileIcon: function() { + if(this.info == null) { + return null; + } else { + return this.info.createIcon(); + } + } + ,createIcon: function(cenX,cenY) { + if(cenY == null) { + cenY = 0.5; + } + if(cenX == null) { + cenX = 0.5; + } + var t = this.getTileIcon(); + if(t == null) { + return null; + } + var f = this.getIconFrame(); + var x = 0; + var y = 0; + var offX = 0.0; + var offY = 0.0; + if(f != null) { + x = f.x; + y = f.y; + offX = f.offsetX; + offY = f.offsetY; + } + var r = com_davidmaletz_tiles_Tile.makeIcon(t,-t.getTileWidth(x,y) * cenX / com_davidmaletz_tiles_Tile.SIZE,-t.getTileHeight(x,y) * cenY / com_davidmaletz_tiles_Tile.SIZE,x,y); + r.set_x(Math.round(this.getCenterX() + offX)); + r.set_y(Math.round(this.getCenterY() + this.getOffsetY() + offY)); + return r; + } + ,getIconFrame: function() { + return null; + } + ,getSprite: function() { + return this.renderer; + } + ,runAnimation: function(anim_id,func) { + this.playAnimation(anim_id,func,func == null); + } + ,playAnimation: function(animation,onComplete,loop) { + if(loop == null) { + loop = false; + } + if(onComplete != null) { + onComplete(); + } + } + ,updateTint: function() { + if(this.hitFx == null) { + if(this.info.xml.get("waterTint") != "false") { + com_davidmaletz_mining_world_BaseObject.prototype.updateTint.call(this); + } else { + this.resetTint(); + } + } + } + ,write: function(b) { + b.writeUInt16(this.health); + } + ,read: function(b,version) { + this.health = b.readUInt16(); + } + ,writePosition: function(b) { + b.writeInt32(this.xPos); + b.writeInt32(this.yTile); + } + ,writeId: function(b) { + b.writeUInt24(this.__id & 16777215); + } + ,readId: function(b) { + var id = b.readUInt24(); + if(id >= 0) { + this.__loadId(id); + } + } + ,getBlocking: function(x,y,match) { + if(match == null) { + match = -1; + } + if(this.area == null) { + return null; + } + com_davidmaletz_mining_world_Object.rectangle.setTo(x * com_davidmaletz_tiles_Tile.SIZE,y * com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE); + if(match == -1) { + match = this.getLayer(); + } + var layer = -1; + var ret = null; + var index = -2; + var o = this.area.getObjectsInTile(x,y); + while(o.hasNext()) { + var o1 = o.next(); + var l = o1.getLayer(); + if(o1 != this && o1.isBlocking(this.info) && (l == match || com_fancyfish_faeng_pack_AABBObjectList.intersects(o1.getBounds(),com_davidmaletz_mining_world_Object.rectangle,0.4))) { + if(l >= layer) { + var i = o1.getIndex(); + if(l > layer || i > index) { + layer = l; + index = i; + ret = o1; + } + } + } + } + return ret; + } + ,getWeight: function() { + return 0; + } + ,canStandOn: function(t,x,y) { + return t != null; + } + ,hasBackTile: function(x,y) { + return this.area.getTile(x,y,3) != null; + } + ,canGoUnderwater: function() { + return this.info.xml.get("underwater") == "true"; + } + ,canEnterTile: function(x,y) { + if(this.area == null) { + return false; + } + if(this.area.isWater(x,y)) { + return this.canGoUnderwater(); + } else if(this.info.xml.get("flying") == "true") { + return true; + } + ++y; + return this.isGroundTile(x,y); + } + ,isGroundTile: function(x,y) { + if(!this.canStandOn(this.area.getTile(x,y,0),x,y)) { + return this.hasBackTile(x,y); + } else { + return true; + } + } + ,isTileBlocking: function(t) { + return t != -1; + } + ,canEnter: function(x,y) { + if(this.area != null && !this.isTileBlocking(this.area.getTileId(x,y,0))) { + return this.canEnterTile(x,y); + } else { + return false; + } + } + ,checkObject: function(addBounds,o) { + if(o != this && o.isBlocking(this.info)) { + addBounds(o,o.getBounds()); + } + return false; + } + ,_checkTile: function(addBounds,bot,x,y) { + if(this.isTileBlocking(this.area.getTileId(x,y,0)) || (y == bot || y == this.get_tile_y()) && !this.canEnterTile(x,y)) { + com_davidmaletz_mining_world_Object.rectangle.setTo(x * com_davidmaletz_tiles_Tile.SIZE,y * com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE); + addBounds(null,com_davidmaletz_mining_world_Object.rectangle); + } + return false; + } + ,checkTile: function(addBounds,x,y) { + return this._checkTile(addBounds,this.get_tile_y(),x,y); + } + ,getClosest: function(range,dx,checkTiles,filter,dy) { + if(dy == null) { + dy = 0; + } + if(checkTiles == null) { + checkTiles = true; + } + if(dx == null) { + dx = 1; + } + if(this.area == null) { + return null; + } + var scaleX = dx; + if(this.renderer != null) { + scaleX *= this.renderer.get_scaleX(); + } + if(com_davidmaletz_mining_world_Object.blocker_obj == null) { + com_davidmaletz_mining_world_Object.blocker_obj = new com_davidmaletz_mining_world_Blocker(); + } + return com_davidmaletz_mining_world_Object._getClosest(com_davidmaletz_mining_world_Object.blocker_obj,this.getBounds(),this.area.objects,range,scaleX,$bind(this,this.checkObject),checkTiles ? $bind(this,this.checkTile) : null,filter,dy); + } + ,getClosestStructure: function(range,dx,checkTile,filter,dy) { + if(dy == null) { + dy = 0; + } + if(this.area == null) { + return null; + } + var scaleX = dx; + if(this.renderer != null) { + scaleX *= this.renderer.get_scaleX(); + } + if(com_davidmaletz_mining_world_Object.blocker_struc == null) { + com_davidmaletz_mining_world_Object.blocker_struc = new com_davidmaletz_mining_world_Blocker(); + } + return com_davidmaletz_mining_world_Object._getClosest(com_davidmaletz_mining_world_Object.blocker_struc,this.getBounds(),this.area.structures,range,scaleX,com_davidmaletz_mining_world_Object.checkStructure,checkTile,filter,dy); + } + ,distanceToStructure: function(cx,s) { + var dx = cx - s.getInnerCenterX(); + var dy = this.yTile - s.yPos; + return Math.sqrt(dx * dx + dy * dy); + } + ,findClosestStructure: function(accept) { + if(this.area == null) { + return null; + } + var cx = this.getCenterX(); + var best = null; + var dist = Infinity; + var s = this.area.getStructures(); + while(s.hasNext()) { + var s1 = s.next(); + if(accept(s1)) { + var d = this.distanceToStructure(cx,s1); + if(d < dist) { + dist = d; + best = s1; + } + } + } + return best; + } + ,distanceToObject: function(cx,s) { + var dx = cx - s.getCenterX(); + var dy = this.yTile - s.yTile; + return Math.sqrt(dx * dx + dy * dy); + } + ,findClosestObject: function(accept) { + if(this.area == null) { + return null; + } + var cx = this.getCenterX(); + var best = null; + var dist = Infinity; + var s = this.area.getAllObjects(); + while(s.hasNext()) { + var s1 = s.next(); + if(accept(s1)) { + var d = this.distanceToObject(cx,s1); + if(d < dist) { + dist = d; + best = s1; + } + } + } + return best; + } + ,getXDistance: function(b,dx) { + if(dx == null) { + dx = 1; + } + var scaleX = dx; + if(this.renderer != null) { + scaleX *= this.renderer.get_scaleX(); + } + var left = b.get_left(); + var right = b.get_right(); + var e = this._getBounds(com_davidmaletz_mining_world_Object.rectangle); + var loop = this.area.getLoop(); + if(loop > 0) { + loop *= com_davidmaletz_tiles_Tile.SIZE; + if(left > e.get_left() + loop * 0.5) { + left -= loop; + right -= loop; + } else if(left < e.get_left() - loop * 0.5) { + left += loop; + right += loop; + } + } + return Math.max(0,scaleX < 0 ? left - e.get_right() : e.get_left() - right); + } + ,reshape: function(w,h) { + if(this._width == w && this._height == h) { + return; + } + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + var y = this.yTile + h - this._height; + var b = this._getBounds(com_davidmaletz_mining_world_Object.rectangle); + this._width = w; + this._height = h; + if(this.area != null) { + this.area.objects.reshapeObject(this,b); + } + this.setPosition(this.xPos,y); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + ,resetShape: function() { + } + ,canAttack: function() { + return true; + } + ,projectileCanHurt: function(o) { + return true; + } + ,hitFx: null + ,endHitEffect: function(is_action_key,p) { + if(this.hitFx == null) { + com_davidmaletz_faengfl_FaengFL.remove(p); + return; + } + var xml = this.hitFx.xml; + if(xml.exists("damage") && this.area != null && this.getHealth() > 0 && is_action_key) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = is_action_key; + this.damage(com_davidmaletz_mining_Main.parseInt(xml.get("damage")),6,this.hitFx.attacker,this.hitFx.element,0,false); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + if(this.hitFx.count > 0) { + this.hitFx.count--; + p.setFrame(0); + var f = $bind(this,this.endHitEffect); + var a1 = is_action_key; + var tmp = function(p1) { + f(a1,p1); + }; + p.playAnimation(xml.get("animation"),false,tmp); + return; + } + if(this.renderer != null) { + this.setFrameSpeed(this.renderer,1); + } + this.hitFx = null; + if(!xml.exists("completeAnimation")) { + com_davidmaletz_faengfl_FaengFL.remove(p); + } else { + p.playAnimation(xml.get("completeAnimation"),false,com_davidmaletz_faengfl_FaengFL.remove,-0.5,-0.5); + } + if(this.renderer != null) { + this.updateTint(); + } + } + ,clearHitEffect: function(fx,e) { + if(this.hitFx == fx) { + this.hitFx = null; + if(this.renderer != null) { + this.setFrameSpeed(this.renderer,1); + this.updateTint(); + } + } + } + ,setFrameSpeed: function(r,f) { + r.frameSpeed = f; + } + ,stealHealth: function(dmg,percent) { + this.onStealHealth(dmg,this.parseStealHealth(percent)); + } + ,parseStealHealth: function(percent) { + if(percent == null) { + return 1; + } else { + return com_davidmaletz_mining_Main.parseFloat(percent); + } + } + ,onStealHealth: function(dmg,s) { + var h = Math.round(dmg * s); + if(h > 0) { + this.heal(h); + } else if(h < 0) { + this.loseHealth(-h,0,null,null,0); + this.numberNotification(-h,com_davidmaletz_mining_Main.damageFont); + } + } + ,heal: function(h) { + var old = this.getHealth(); + this.addHealth(h); + h = this.getHealth() - old; + if(h > 0) { + this.numberNotification(h,com_davidmaletz_mining_Main.healFont); + } + } + ,hitEffect: function(e,x,y,runPaused,flip,scale) { + if(scale == null) { + scale = 1; + } + if(flip == null) { + flip = false; + } + if(runPaused == null) { + runPaused = false; + } + if(e == null) { + return; + } + var xml = e.xml; + var r = this.renderer; + if(r == null || r.parent == null || r.stage == null || this.hitFx != null) { + return; + } + this.hitFx = e; + this.dispatchEvent(new com_davidmaletz_mining_world_HitEffectEvent("hit_effect",e,x,y,flip,scale)); + if(xml.exists("freeze")) { + this.setFrameSpeed(r,1 - com_davidmaletz_mining_Main.parseFloat(xml.get("freeze"))); + } + if(xml.exists("color")) { + var colorScale; + if(xml.exists("colorScale")) { + colorScale = com_davidmaletz_mining_Main.parseFloat(xml.get("colorScale")); + } else { + colorScale = 1.5; + } + com_davidmaletz_faengfl_TextSprite.setColor(r,com_davidmaletz_mining_Main.parseInt("0x" + xml.get("color")),255 / colorScale); + } + var fps = xml.exists("fps") ? com_davidmaletz_mining_Main.parseFloat(xml.get("fps")) : 15; + var t = com_davidmaletz_tiles_Tile.get(xml.get("tile")); + if(t == null) { + t = com_davidmaletz_tiles_EmptyTile.get(); + } + var p = xml.get("animation"); + var f = $bind(this,this.endHitEffect); + var a1 = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + var p1 = new com_davidmaletz_tiles_render_LinkedPlayAnimation(r,t,p,fps,false,function(p2) { + f(a1,p2); + },-0.5,-0.5,runPaused || com_davidmaletz_faengfl_Window.window_ct > 0); + var f1 = $bind(this,this.clearHitEffect); + var fx = e; + p1.addEventListener("removedFromStage",function(e1) { + f1(fx,e1); + }); + p1.set_scaleY(scale); + if(xml.get("canFlip") == "true") { + p1.set_scaleX(com_fancyfish_faeng_common_Utils.sign(r.get_scaleX()) * scale); + } else if(flip) { + p1.set_scaleX(-scale); + } else { + p1.set_scaleX(scale); + } + this.setEffectPos(p1,x,y); + com_davidmaletz_faengfl_adv_sound_Sound.playLoc(com_davidmaletz_faengfl_adv_sound_Sound.resolveDefault(xml,"fx"),p1,null,false,2,false); + r.parent.addChild(p1); + if(e.attacker != null || this.area != null) { + var a = this.area == null ? e.attacker.area : this.area; + if(e.light != null && a != null && a.renderer != null && a.renderer.light != null) { + a.renderer.light.addChild(new com_davidmaletz_mining_effects_Torchlight(p1,e.light)); + } + } + } + ,setEffectPos: function(effect,x,y) { + if(x != null) { + effect.set_x((x - this.renderer.get_x()) * 0.5); + } + if(y != null) { + effect.set_y((y - this.renderer.get_y()) * 0.5); + } + } + ,getHitbox: function(notOperate) { + if(notOperate == null) { + notOperate = true; + } + var ret = this.getBounds(); + this.info.modifyHitbox(ret); + return ret; + } + ,intersects: function(r,issect) { + return com_davidmaletz_mining_world_BaseObject.prototype.intersects.call(this,r,this.info.xml.exists("doorway") ? issect / 0.9 : issect); + } + ,__id: null + ,__assignId: function() { + if(this.__id < 0) { + this.__loadId(com_davidmaletz_mining_world_Object.__current_id++); + } + } + ,__loadId: function(id) { + if(id >= 0) { + this.__id = id; + var old = com_davidmaletz_mining_world_Object.__objects.get(id); + if(old != null) { + old.__recycleId(); + } + com_davidmaletz_mining_world_Object.__objects.set(id,this); + com_davidmaletz_mining_world_Object.__object_ids.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("add_object",this)); + } + } + ,__recycleId: function() { + if(this.__id >= 0) { + com_davidmaletz_mining_world_Object.__objects.remove(this.__id); + com_davidmaletz_mining_world_Object.__object_ids.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("rem_object",this)); + this.__id = -1; + } + } + ,__last_projectile: null + ,__last_projectile_id: null + ,__last_projectile_time: null + ,__class__: com_davidmaletz_mining_world_Object +}); +var com_davidmaletz_mining_world_TooltipObject = function(info,x,y) { + com_davidmaletz_mining_world_Object.call(this,info,x,y); +}; +$hxClasses["com.davidmaletz.mining.world.TooltipObject"] = com_davidmaletz_mining_world_TooltipObject; +com_davidmaletz_mining_world_TooltipObject.__name__ = ["com","davidmaletz","mining","world","TooltipObject"]; +com_davidmaletz_mining_world_TooltipObject.__super__ = com_davidmaletz_mining_world_Object; +com_davidmaletz_mining_world_TooltipObject.prototype = $extend(com_davidmaletz_mining_world_Object.prototype,{ + tooltip: null + ,removedFromArea: function(area) { + com_davidmaletz_mining_world_Object.prototype.removedFromArea.call(this,area); + this.hideTooltip(); + } + ,onEnter: function(p) { + var t = this.getAction(p); + if(t != null) { + this.showTooltip("select",t); + } + if(this.renderer != null && com_davidmaletz_mining_Main.ALLOW_FLASH) { + this.renderer.lerp(new com_davidmaletz_mining_world_ObjectDarkenKeyframe(this,1.5),10); + } + } + ,showTooltip: function(key,msg) { + this.hideTooltip(); + this.tooltip = new com_davidmaletz_mining_ui_KeyTooltip(true,key,128.,16,msg); + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + this.tooltip.show(p == null || !p.getFlag("allow_hotkeys")); + } + ,hideTooltip: function() { + if(this.tooltip != null) { + var d = this.tooltip; + var tmp = function() { + com_davidmaletz_faengfl_FaengFL.remove(d); + }; + this.tooltip.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),10,tmp); + this.tooltip = null; + } + } + ,onExit: function(p) { + this.hideTooltip(); + if(this.renderer != null) { + this.renderer.lerp(new com_davidmaletz_mining_world_ObjectDarkenKeyframe(this,1),10); + } + } + ,onMoveTalk: function(p) { + } + ,moveTalk: function(p,dist) { + if(this.renderer != null && p.renderer != null) { + this.renderer.set_scaleX(-p.renderer.get_scaleX()); + this.onMoveTalk(p); + var _x = Math.round(p.xPos - p.renderer.get_scaleX() * (com_davidmaletz_tiles_Tile.SIZE + (p.renderer.get_scaleX() == -p.renderer.get_scaleY() ? 0 : this._width - p._width)) * dist); + this.playAnimation("idle"); + if(this.canEnter(Math.round(_x / com_davidmaletz_tiles_Tile.SIZE),this.get_tile_y())) { + var oldx = this.renderer.get_x(); + var oldy = this.renderer.get_y(); + this.setPosition(_x,this.yTile,true); + var x = this.renderer.get_x(); + var y = this.renderer.get_y(); + this.renderer.set_x(oldx); + this.renderer.set_y(oldy); + this.renderer.lerp(new com_davidmaletz_lerp_PositionKeyframe(x,y),5); + } + } + } + ,__class__: com_davidmaletz_mining_world_TooltipObject +}); +var com_davidmaletz_mining_world_IOxygen = function() { }; +$hxClasses["com.davidmaletz.mining.world.IOxygen"] = com_davidmaletz_mining_world_IOxygen; +com_davidmaletz_mining_world_IOxygen.__name__ = ["com","davidmaletz","mining","world","IOxygen"]; +com_davidmaletz_mining_world_IOxygen.__interfaces__ = [openfl_events_IEventDispatcher]; +com_davidmaletz_mining_world_IOxygen.prototype = { + getOxygen: null + ,getMaxOxygen: null + ,getOxygenPercent: null + ,__class__: com_davidmaletz_mining_world_IOxygen +}; +var com_davidmaletz_mining_world_IEquippable = function() { }; +$hxClasses["com.davidmaletz.mining.world.IEquippable"] = com_davidmaletz_mining_world_IEquippable; +com_davidmaletz_mining_world_IEquippable.__name__ = ["com","davidmaletz","mining","world","IEquippable"]; +com_davidmaletz_mining_world_IEquippable.prototype = { + getInventory: null + ,getEquipment: null + ,getId: null + ,getOwner: null + ,getXml: null + ,setAbility: null + ,removeAbility: null + ,__class__: com_davidmaletz_mining_world_IEquippable +}; +var com_davidmaletz_mining_npc_Speakable = function() { }; +$hxClasses["com.davidmaletz.mining.npc.Speakable"] = com_davidmaletz_mining_npc_Speakable; +com_davidmaletz_mining_npc_Speakable.__name__ = ["com","davidmaletz","mining","npc","Speakable"]; +com_davidmaletz_mining_npc_Speakable.prototype = { + beginSpeak: null + ,endSpeak: null + ,__class__: com_davidmaletz_mining_npc_Speakable +}; +var com_davidmaletz_mining__$Player_FishingSpot = function() { + com_davidmaletz_mining_world_TooltipObject.call(this,null,0,0); +}; +$hxClasses["com.davidmaletz.mining._Player.FishingSpot"] = com_davidmaletz_mining__$Player_FishingSpot; +com_davidmaletz_mining__$Player_FishingSpot.__name__ = ["com","davidmaletz","mining","_Player","FishingSpot"]; +com_davidmaletz_mining__$Player_FishingSpot.__super__ = com_davidmaletz_mining_world_TooltipObject; +com_davidmaletz_mining__$Player_FishingSpot.prototype = $extend(com_davidmaletz_mining_world_TooltipObject.prototype,{ + getAction: function(p) { + var eq = p.getFishingRod(); + if(eq == null) { + return null; + } else { + return com_davidmaletz_mining_world_ItemObject.itemText(com_fancyfish_faeng_common_Lang.getText("object.tooltip","use"),eq.info); + } + } + ,onOperate: function(p) { + var eq = p.getFishingRod(); + if(eq != null) { + p.useWeapon(eq,null); + } + } + ,isBlocking: function(asker) { + return false; + } + ,getLayer: function() { + return 1; + } + ,createRenderer: function() { + return null; + } + ,hasPriority: function(p,structure) { + return false; + } + ,__class__: com_davidmaletz_mining__$Player_FishingSpot +}); +var com_davidmaletz_tiles_Tile = function(id,path,xml) { + this.id = id; + this.layers = null; + if(xml.exists("stride")) { + this.stride = Std.parseInt(xml.get("stride")); + } else { + this.stride = 1; + } + if(xml.exists("strideWidth")) { + this.strideWidth = Std.parseInt(xml.get("strideWidth")); + } else { + this.strideWidth = 0; + } + if(xml.exists("sheet")) { + this.base = com_davidmaletz_tiles_TileData.fromXML(path,xml); + } else { + this.base = null; + } + this.animateSub = xml.get("animateSub") == "true"; + var list = xml.elementsNamed("tile"); + this.p_total = 0.0; + if(list.hasNext()) { + this.layers = []; + var e = list; + while(e.hasNext()) { + var e1 = e.next(); + var t = com_davidmaletz_tiles_TileData.fromXML(path,e1,true); + this.layers.push(t); + this.p_total += t.p; + } + } +}; +$hxClasses["com.davidmaletz.tiles.Tile"] = com_davidmaletz_tiles_Tile; +com_davidmaletz_tiles_Tile.__name__ = ["com","davidmaletz","tiles","Tile"]; +com_davidmaletz_tiles_Tile.tiles = null; +com_davidmaletz_tiles_Tile.reset = function() { + com_davidmaletz_tiles_Tile.tiles = null; +}; +com_davidmaletz_tiles_Tile.loadTilesheet = function(path,e) { + var w = e.exists("width") ? Std.parseInt(e.get("width")) : com_davidmaletz_tiles_Tile.SIZE; + var h = e.exists("height") ? Std.parseInt(e.get("height")) : com_davidmaletz_tiles_Tile.SIZE; + com_davidmaletz_faengfl_AutoTileBitmap.get(path,w,h,null,e); +}; +com_davidmaletz_tiles_Tile.setTile = function(id,path,e) { + if(com_davidmaletz_tiles_Tile.tiles == null) { + com_davidmaletz_tiles_Tile.tiles = new haxe_ds_StringMap(); + } + if(com_davidmaletz_tiles_Tile.tiles.exists(id)) { + haxe_Log.trace("Overwrite Tile: " + id,{ fileName : "Tile.hx", lineNumber : 66, className : "com.davidmaletz.tiles.Tile", methodName : "setTile"}); + } + com_davidmaletz_tiles_Tile.tiles.set(id,e.exists("equals") ? com_davidmaletz_tiles_Tile.tiles.get(e.get("equals")) : new com_davidmaletz_tiles_Tile(id,path,e)); +}; +com_davidmaletz_tiles_Tile.get = function(id) { + var ret = com_davidmaletz_tiles_Tile._get(id); + if(id != null && ret == null) { + haxe_Log.trace("No Tile found: " + id,{ fileName : "Tile.hx", lineNumber : 70, className : "com.davidmaletz.tiles.Tile", methodName : "get"}); + } + return ret; +}; +com_davidmaletz_tiles_Tile._get = function(id) { + if(id == null || com_davidmaletz_tiles_Tile.tiles == null) { + return null; + } else { + return com_davidmaletz_tiles_Tile.tiles.get(id); + } +}; +com_davidmaletz_tiles_Tile.exists = function(id) { + if(id != null && com_davidmaletz_tiles_Tile.tiles != null) { + return com_davidmaletz_tiles_Tile.tiles.exists(id); + } else { + return false; + } +}; +com_davidmaletz_tiles_Tile.makeIcon = function(tile,x,y,offX,offY,smooth,flags) { + if(flags == null) { + flags = 0; + } + if(smooth == null) { + smooth = false; + } + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + if(tile == null) { + return new openfl_display_Sprite(); + } + var l = new com_davidmaletz_faengfl_TileLayer(); + l.start(flags,smooth); + tile.render(null,l,x,y,offX,offY); + l.finish(); + return l; +}; +com_davidmaletz_tiles_Tile.prototype = { + id: null + ,base: null + ,stride: null + ,strideWidth: null + ,animateSub: null + ,layers: null + ,p_total: null + ,getId: function() { + return this.id; + } + ,getBase: function() { + return "tile"; + } + ,render: function(getNeighbors,layer,x,y,offX,offY) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + this._render(getNeighbors,layer,x,y,offX,offY,null,null); + } + ,_render: function(getNeighbors,layer,x,y,offX,offY,xCoord,yCoord) { + var tx = Math.round(x * com_davidmaletz_tiles_Tile.SIZE); + var ty = Math.round(y * com_davidmaletz_tiles_Tile.SIZE); + if(xCoord == null) { + xCoord = Math.round(x); + } + if(yCoord == null) { + yCoord = Math.round(y); + } + if(this.base != null) { + this.base.render(getNeighbors,layer,tx,ty,offX,offY); + } + if(this.layers != null) { + var x1 = Math.floor(xCoord / this.stride); + var y1 = Math.floor(yCoord / this.stride); + var r = com_fancyfish_faeng_common_Utils.frand2(x1,y1) * this.p_total; + var cur = 0.0; + var ox = xCoord - x1 * this.stride; + var oy = yCoord - y1 * this.stride; + if(this.animateSub) { + ox += offX; + oy += offY; + } + if(this.strideWidth != 0) { + ox += oy * this.strideWidth; + oy = 0; + } + var _g = 0; + var _g1 = this.layers; + while(_g < _g1.length) { + var l = _g1[_g]; + ++_g; + cur += l.p; + if(l.p == 0.0 || cur > r) { + if(cur > r) { + cur = -Infinity; + } + l.render(getNeighbors,layer,tx,ty,ox,oy); + } + } + } + } + ,getWidth: function() { + if(this.base == null) { + return 0; + } else { + return this.base.sheet.tileWidth; + } + } + ,getHeight: function() { + if(this.base == null) { + return 0; + } else { + return this.base.sheet.tileHeight; + } + } + ,getInnerBounds: function() { + if(this.base == null) { + return null; + } else { + return this.base.sheet.getTileRect2(this.base.x,this.base.y); + } + } + ,getTileBase: function() { + return this.base; + } + ,getTileWidth: function(offX,offY) { + return this.getWidth(); + } + ,getTileHeight: function(offX,offY) { + return this.getHeight(); + } + ,isNeighbor: function(data,t) { + if(t != this) { + if(data.neighbors != null && t != null) { + return data.neighbors.exists(t.id); + } else { + return false; + } + } else { + return true; + } + } + ,__class__: com_davidmaletz_tiles_Tile +}; +var com_davidmaletz_mining__$Player_WaterExit = function() { + com_davidmaletz_mining_world_TooltipObject.call(this,null,0,0); +}; +$hxClasses["com.davidmaletz.mining._Player.WaterExit"] = com_davidmaletz_mining__$Player_WaterExit; +com_davidmaletz_mining__$Player_WaterExit.__name__ = ["com","davidmaletz","mining","_Player","WaterExit"]; +com_davidmaletz_mining__$Player_WaterExit.__super__ = com_davidmaletz_mining_world_TooltipObject; +com_davidmaletz_mining__$Player_WaterExit.prototype = $extend(com_davidmaletz_mining_world_TooltipObject.prototype,{ + getAction: function(p) { + return com_fancyfish_faeng_common_Lang.getText("common","exit_water"); + } + ,onOperate: function(p) { + var r = p.renderer; + var dx = -com_fancyfish_faeng_common_Utils.sign(r.get_scaleX()); + var x = r.get_x(); + var y = r.get_y(); + p.setPosition((p.get_tile_x() + dx) * com_davidmaletz_tiles_Tile.SIZE,(p.get_tile_y() - 1) * com_davidmaletz_tiles_Tile.SIZE); + var toX = r.get_x(); + var toY = r.get_y(); + if(r.hasTrack(com_davidmaletz_lerp_PositionKeyframe)) { + var f = js_Boot.__cast(r.getLerp(com_davidmaletz_lerp_PositionKeyframe) , com_davidmaletz_lerp_PositionKeyframe); + toX = f.x; + toY = f.y; + } + r.set_x(x); + r.set_y(y); + var f1 = $bind(this,this.checkConnections); + var p1 = p; + var tmp = function() { + f1(p1); + }; + r.lerp(new com_davidmaletz_lerp_PositionKeyframe(toX,toY),15,tmp); + (js_Boot.__cast(r , com_davidmaletz_mining_renderer_PlayerObjectRenderer)).updateScroll(true); + } + ,checkConnections: function(p) { + p.checkConnections(p.xPos,p.yTile,0,-1); + } + ,isBlocking: function(asker) { + return false; + } + ,getLayer: function() { + return 1; + } + ,createRenderer: function() { + return null; + } + ,__class__: com_davidmaletz_mining__$Player_WaterExit +}); +var com_davidmaletz_mining_Player = function(state,info,x,y) { + this.__location_id = -1; + this.overStructure = null; + this.overObjects = []; + this.warning = null; + this.hotkeys = []; + this.currentStorehouse = null; + this.oxygenWarning = true; + this.staminaWarning = true; + this.firingQuestComplete = new haxe_ds_StringMap(); + this.__adjust_max = false; + this.currencyValue = "coins"; + this.currencyIcon = "coins"; + this.__ban_data = null; + this.showHair = 0; + this.experience = 0; + this._offsetY = 0; + this.slideY = 0; + this.slideX = 0; + this.prevY = 0; + this.prevX = 0; + this.vehicle = null; + this.difficulty = com_davidmaletz_mining_DifficultyMode.__current; + this.stats = new com_davidmaletz_mining_Stats(); + com_davidmaletz_mining_world_TooltipObject.call(this,info,x,y); + if(state == null) { + state = new com_davidmaletz_mining_State(); + } + this.state = state; + this.stamina = this.getMaxStamina(); + this.paused = new com_fancyfish_faeng_common_mutable_Mutable(); + this.paused.set(true); + this.familiar = new com_davidmaletz_mining_familiar_FamiliarHandler(this); + this.viewHidden = new com_fancyfish_faeng_common_mutable_Mutable(); + this.viewHiddenEq = new com_fancyfish_faeng_common_mutable_Mutable(); + this.viewHidden.set(false); + this.viewHiddenEq.set(false); + this.inventory = new com_davidmaletz_mining_item_Inventory(); + this.stickyItems = new haxe_ds_StringMap(); + this.storehouseInventory = new com_davidmaletz_mining_item_CompoundInventory([this.inventory]); + var i = com_davidmaletz_mining_item_ItemInfo.getAll(); + while(i.hasNext()) { + var i1 = i.next(); + if(i1.type.canStore && (i1.weight == 0 || i1.xml.exists("storage"))) { + this.stickyItems.set(i1.id,true); + } + } + this.storage = new haxe_ds_StringMap(); + this.inventory.addEventListener("item_added",$bind(this,this.item_added)); + this.getStorage("coins").addEventListener("updated",$bind(this,this.checkQuestComplete)); + state.addEventListener("state_changed",$bind(this,this.checkQuestComplete)); + state.addEventListener("add_quest",$bind(this,this.checkQuestComplete)); + this.capacity = new com_fancyfish_faeng_common_mutable_Mutable(); + this.capacity.set(this.getCarryWeight()); + this.hidden = new com_fancyfish_faeng_common_mutable_Mutable(); + this.hidden.set(null); + this.max_depth = new com_fancyfish_faeng_common_mutable_Mutable(); + this.max_depth.set(info.max_depth); + this.eq_oxygen = new com_fancyfish_faeng_common_mutable_Mutable(); + this.eq_oxygen.set(0); + this.seen_items = new haxe_ds_StringMap(); + var vslots = []; + this.equipment = com_davidmaletz_mining_item_EquipmentSlots.fromXML(info.xml,vslots); + this.equipment.addEventListener($bind(this,this.changeEquipment)); + this.equipment.addStateEventListener($bind(this,this.changeEqState)); + this.vanity = new com_davidmaletz_mining_item_EquipmentSlots(vslots); + this.vanity.fireEquipHandlers = false; + this.vanity.checkUnequip = false; + this.vanity.addEventListener($bind(this,this.change_equipment_vanity)); + this.shield = new com_fancyfish_faeng_common_mutable_Mutable(); + this.shield.set(null); + this.flight = []; + this.skills = new com_davidmaletz_mining_Skills(this); + this.oxygen = this.getMaxOxygen(); + this.stats.get("health").addEventListener("updated",$bind(this,this.updateMaxHealth)); + this.stats.get("stamina").addEventListener("updated",$bind(this,this.updateMaxStamina)); + this.stats.get("weight").addEventListener("updated",$bind(this,this.update_weight)); + this.stats.get("oxygen").addEventListener("updated",$bind(this,this.updateMaxOxygen)); + this.stats.get("light").addEventListener("updated",$bind(this,this.updateLight)); + var d = com_davidmaletz_mining_Player.getDefaults(info,com_fancyfish_faeng_common_Random.create()); + this.colors = d.colors; + this.offsets = d.offsets; + this.addMultipleItems = Reflect.makeVarArgs($bind(this,this._addMultipleItems)); +}; +$hxClasses["com.davidmaletz.mining.Player"] = com_davidmaletz_mining_Player; +com_davidmaletz_mining_Player.__name__ = ["com","davidmaletz","mining","Player"]; +com_davidmaletz_mining_Player.__interfaces__ = [com_davidmaletz_mining_world_IOxygen,com_davidmaletz_mining_world_IEquippable,com_davidmaletz_mining_npc_Speakable]; +com_davidmaletz_mining_Player.filterLum = function(lum,col) { + return Math.abs(lum - com_fancyfish_faeng_common_Utils.luminancei(col.color)) > 0.1; +}; +com_davidmaletz_mining_Player.getDefaults = function(info,r) { + var cols = new haxe_ds_StringMap(); + var skin = -1.0; + var offs = new haxe_ds_StringMap(); + var ct = 0; + var e = info.xml.elementsNamed("color"); + while(e.hasNext()) { + var e1 = e.next(); + var c = e1.get("id"); + var ar = com_davidmaletz_mining_ColorInfo.get(e1.exists("type") ? e1.get("type") : c); + if(ar != null && (c == "eyes" || c == "hair") && skin != -1) { + ar = ar.filter((function(a1) { + return function(a2) { + return com_davidmaletz_mining_Player.filterLum(a1[0],a2); + }; + })([skin])); + } + var col = ar == null || ar.length == 0 ? 16777215 : ar[Math.floor(r.nextFloat() * ar.length)].color; + cols.set(c,col); + if(c == "skin") { + skin = com_fancyfish_faeng_common_Utils.luminancei(col); + } + } + var vars = com_davidmaletz_faengfl_EventHandler.createVariables(); + vars.set("colors",cols); + vars.set("offsets",offs); + var e2 = info.xml.elementsNamed("offset"); + while(e2.hasNext()) { + var e3 = e2.next(); + if(e3.exists("show") && !com_davidmaletz_faengfl_EventHandler._conditionMet(e3.get("show"),vars)) { + offs.set(e3.get("id"),com_davidmaletz_faengfl_TileOffset.HIDDEN); + } else if(e3.exists("count")) { + var max = com_davidmaletz_mining_Main.parseInt(e3.get("count")); + var len = max; + if(e3.get("hide") == "true") { + ++len; + } + var id = Math.floor(r.nextFloat() * len); + var off = null; + if(id >= max) { + off = com_davidmaletz_faengfl_TileOffset.HIDDEN; + } else if(e3.exists("stride")) { + id *= com_davidmaletz_mining_Main.parseInt(e3.get("stride")); + } + if(off == null) { + off = new com_davidmaletz_faengfl_TileOffset(e3.get("tile"),id,false); + } + offs.set(e3.get("id"),off); + } else if(e3.exists("value")) { + offs.set(e3.get("id"),com_davidmaletz_faengfl_TileOffset.fromXML(e3)); + } else { + var c1 = e3.get("id"); + var ar1 = com_davidmaletz_mining_OffsetInfo.get(e3.exists("type") ? e3.get("type") : c1); + offs.set(c1,ar1 == null || ar1.length == 0 ? null : ar1[Math.floor(r.nextFloat() * ar1.length)].offset); + } + } + offs.set("beard",com_davidmaletz_faengfl_TileOffset.HIDDEN); + if(com_davidmaletz_mining_Main.beforeDate(4,1,2018)) { + var c2 = cols.keys(); + while(c2.hasNext()) { + var c3 = c2.next(); + cols.set(c3,Math.floor(r.nextFloat() * 16777216)); + } + } + return { colors : cols, offsets : offs}; +}; +com_davidmaletz_mining_Player.parseShowHair = function(hair,min) { + if(hair == "false") { + return 100; + } else if(hair == null) { + return min; + } else { + var id = Std.parseInt(hair); + if(id != null) { + return com_fancyfish_faeng_common_Utils.max(id,min); + } else { + return min; + } + } +}; +com_davidmaletz_mining_Player.isEquip = function(i) { + return Std["is"](i,com_davidmaletz_mining_item_Equipment); +}; +com_davidmaletz_mining_Player._increaseValue = function(p,item,d) { + var equipment = p.getEquipment(); + if(equipment.isEquipped(item.info,item.value,item.getNameStr())) { + equipment.increaseValue(p,item.info.xml.get("slot"),d); + } else { + item.increaseValue(p.getInventory(),d); + } +}; +com_davidmaletz_mining_Player.attackObject = function(me,owner,eq,o) { + var stats = me == owner ? owner.stats : null; + var tool = js_Boot.__cast(eq.info , com_davidmaletz_mining_item_Equipment); + var r = o.renderer; + var critical = r != null && me.renderer != null && r.get_scaleX() == me.renderer.get_scaleX(); + if(!tool.xml.exists("attack") && !tool.xml.exists("cut") && !tool.xml.exists("spirit")) { + return false; + } + var n = eq.getNameStr(); + var attack = tool.getAttack(n); + var cut = tool.getCut(n); + var spirit = tool.getSpirit(n); + var element = eq.getElement(); + var atk = o.attackPower(attack,cut,spirit,element,true); + if(o.attackPower(attack,0,0,element,true) > 0) { + if(stats != null) { + atk += stats.getInt("attack"); + } + var r1 = Math.pow(Math.random(),5 / ((stats == null ? 0 : stats.getInt("critical")) + 4)); + if(r1 > 0.9) { + critical = true; + } + } else if(o.attackPower(0,cut,0,element,true) > 0 && stats != null) { + atk += stats.getInt("cut"); + } else if(o.attackPower(0,0,spirit,element,true) > 0 && stats != null) { + atk += stats.getInt("spirit"); + } + if(!o.canCritical()) { + critical = false; + } + if(tool.xml.get("critical") == "true") { + critical = true; + } + var def = Std["is"](o,com_davidmaletz_mining_enemy_Enemy) ? (js_Boot.__cast(o , com_davidmaletz_mining_enemy_Enemy)).getMinDefense() : 0; + var flags = 0; + if(critical) { + flags |= 1; + } + if(tool.xml.get("noKill") == "true") { + flags |= 8; + } + if(tool.xml.get("ignoreDefense") == "true") { + flags |= 2; + } + var dmg = o.loseHealth(atk,flags,owner,element,me.renderer.get_scaleX()); + if(tool.xml.exists("knockback")) { + o.knockback(-com_davidmaletz_mining_Main.parseInt(tool.xml.get("knockback")) * me.getFacing()); + } + if(dmg > 0) { + var steal = tool.xml.get("hpSteal"); + if(steal != null) { + owner.stealHealth(dmg,steal); + } + o.hitEffect(com_davidmaletz_mining_world_ObjectInfo.getHitEffectI(owner,element,tool.xml)); + var b = new StringBuf(); + b.add("hit_"); + b.add(Std["is"](o,com_davidmaletz_mining_world_Tree) ? "tree_" : "enemy_"); + var e = o.getDefenseElement(); + if(e != null) { + b.add(e.id); + b.add("_"); + } + b.add(o.info.id); + var snd = com_davidmaletz_faengfl_adv_sound_Sound.resolveExtend(tool.xml,b.toString()); + if(me == owner && com_davidmaletz_faengfl_adv_sound_Sound.play(snd) != null) { + owner.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("play_sound",snd)); + } + } + owner.addAttackExp(o,dmg,def); + return true; +}; +com_davidmaletz_mining_Player.getSortAttackPower = function(o,attack,cut,spirit,element,player,n) { + if(com_davidmaletz_mining_item_ItemInfo.getParameter(n,"u") != null) { + return 0; + } + var dmg = o.attackPower(attack,cut,spirit,element,player); + var def = o.getDefenseElement(); + if(dmg == 0) { + return 0; + } + if(element == null || def == null || dmg <= 0) { + return dmg; + } else if(element.isCritical(def)) { + return dmg + 1; + } else if(def.isResist(element)) { + return com_fancyfish_faeng_common_Utils.max(0,dmg - 1); + } else { + return dmg; + } +}; +com_davidmaletz_mining_Player.asEquipment = function(i) { + if(i == null || !Std["is"](i.info,com_davidmaletz_mining_item_Equipment)) { + return null; + } else { + return i.info; + } +}; +com_davidmaletz_mining_Player.experienceToNextLevel = function(l) { + return Math.floor(Math.pow(1.5,l + 1) * 40) - 40; +}; +com_davidmaletz_mining_Player._getTileBlockId = function(area,fromX,fromY,toX,toY) { + if(fromX != toX || fromY != toY) { + var s = area.getStructureInTile(fromX,fromY); + if(s != null && !s.canEnterTile(toX,toY)) { + return 999999; + } + var s1 = area.getStructureInTile(toX,toY); + if(s1 != null && !s1.canEnterTile(fromX,fromY)) { + return 999999; + } + } + if(area.isBlockPlayer(toX,toY)) { + return 999999; + } else { + return area.getTileId(toX,toY,0); + } +}; +com_davidmaletz_mining_Player.writeColors = function(b,colors,offsets) { + var c = colors.keys(); + while(c.hasNext()) { + var c1 = c.next(); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,c1); + b.writeInt32(colors.get(c1)); + } + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + var o = offsets.keys(); + while(o.hasNext()) { + var o1 = o.next(); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,o1); + offsets.get(o1).write(b); + } + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); +}; +com_davidmaletz_mining_Player.readColors = function(b,version,colors,offsets) { + var f; + while(true) { + f = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(!(f != null)) { + break; + } + colors.set(f,b.readInt32()); + } + if(version >= 53) { + while(true) { + f = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(!(f != null)) { + break; + } + if(version >= 71) { + offsets.set(f,com_davidmaletz_faengfl_TileOffset.read(b)); + } else { + var i = b.readInt32(); + offsets.set(f,new com_davidmaletz_faengfl_TileOffset(null,i + 477,i == 16777215)); + } + } + } +}; +com_davidmaletz_mining_Player.setMoveAll = function(val) { + if(com_davidmaletz_mining_Player.MOVE_ALL != val) { + com_davidmaletz_mining_Player.MOVE_ALL = val; + Reflect.setField(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"move_all",val); + } +}; +com_davidmaletz_mining_Player.setWarnToss = function(val) { + if(com_davidmaletz_mining_Player.WARN_TOSS != val) { + com_davidmaletz_mining_Player.WARN_TOSS = val; + Reflect.setField(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"warn_toss",val); + } +}; +com_davidmaletz_mining_Player.setItemDiscover = function(val) { + if(com_davidmaletz_mining_Player.ITEM_DISCOVER != val) { + com_davidmaletz_mining_Player.ITEM_DISCOVER = val; + Reflect.setField(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"item_discover",val); + } +}; +com_davidmaletz_mining_Player.setBlueprintPlace = function(val) { + if(com_davidmaletz_mining_Player.BLUEPRINT_PLACE != val) { + com_davidmaletz_mining_Player.BLUEPRINT_PLACE = val; + Reflect.setField(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"blueprint_place",val); + } +}; +com_davidmaletz_mining_Player.setTalkQuest = function(val) { + if(com_davidmaletz_mining_Player.TALK_QUEST != val) { + com_davidmaletz_mining_Player.TALK_QUEST = val; + Reflect.setField(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"talk_quest",val); + } +}; +com_davidmaletz_mining_Player.setAutoCollect = function(val) { + if(com_davidmaletz_mining_Player.AUTO_COLLECT != val) { + com_davidmaletz_mining_Player.AUTO_COLLECT = val; + Reflect.setField(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"auto_collect",val); + } +}; +com_davidmaletz_mining_Player.isAutoCollect = function(wt) { + if(wt == null) { + wt = 0; + } + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p == null || p.vehicle != null || com_davidmaletz_mining_Player.AUTO_COLLECT < 0) { + return com_davidmaletz_mining_Player.AUTO_COLLECT >= 0; + } else if(com_davidmaletz_mining_Player.AUTO_COLLECT > 0) { + return true; + } else { + p.weightCheck(wt); + return p.getOverweight(wt) <= 0; + } +}; +com_davidmaletz_mining_Player.setHotkeySwitch = function(val) { + if(com_davidmaletz_mining_Player.HOTKEY_SWITCH != val) { + com_davidmaletz_mining_Player.HOTKEY_SWITCH = val; + Reflect.setField(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"hotkey_switch",val); + } +}; +com_davidmaletz_mining_Player.setStorehousePriority = function(val) { + if(com_davidmaletz_mining_Player.STOREHOUSE_PRIORITY != val) { + com_davidmaletz_mining_Player.STOREHOUSE_PRIORITY = val; + Reflect.setField(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"storehouse_priority",val); + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p != null) { + p.currentStorehouse = null; + p.updateStorehouse(null); + } + } +}; +com_davidmaletz_mining_Player._getCrushDepth = function(area,tile_x,tile_y,max_depth) { + return com_fancyfish_faeng_common_Utils.max(0,tile_y - max_depth); +}; +com_davidmaletz_mining_Player.__super__ = com_davidmaletz_mining_world_TooltipObject; +com_davidmaletz_mining_Player.prototype = $extend(com_davidmaletz_mining_world_TooltipObject.prototype,{ + areas: null + ,location: null + ,vehicle: null + ,prevLocation: null + ,prevX: null + ,prevY: null + ,familiar: null + ,slideX: null + ,slideY: null + ,_offsetY: null + ,entry: null + ,stamina: null + ,stats: null + ,capacity: null + ,eq_oxygen: null + ,experience: null + ,skills: null + ,oxygen: null + ,inventory: null + ,equipment: null + ,shield: null + ,stickyItems: null + ,storehouseInventory: null + ,storage: null + ,flight: null + ,identify: null + ,vanity: null + ,hidden: null + ,viewHidden: null + ,viewHiddenEq: null + ,seen_items: null + ,max_depth: null + ,colors: null + ,offsets: null + ,showHair: null + ,difficulty: null + ,state: null + ,locateNPC: null + ,__ban_data: null + ,currencyIcon: null + ,currencyValue: null + ,getInventory: function() { + return this.inventory; + } + ,getInv: function(incStorehouse) { + if(this.vehicle != null) { + return this.vehicle.fullInventory; + } + var inv = incStorehouse ? this.storehouseInventory : this.inventory; + if(this.area == null) { + return inv; + } else { + var b = this.getBounds(); + b.inflate(com_davidmaletz_tiles_Tile.SIZE * 3,com_davidmaletz_tiles_Tile.SIZE * 3); + return this.area.getInventory(b,inv); + } + } + ,getEquipment: function() { + return this.equipment; + } + ,getOwner: function() { + return this; + } + ,getXml: function() { + return this.info.xml; + } + ,getCurrentArea: function() { + if(this.vehicle == null) { + return this.area; + } else { + return this.vehicle.area; + } + } + ,getCurrentInventory: function() { + if(this.vehicle == null) { + return this.inventory; + } else { + return this.vehicle.fullInventory; + } + } + ,getVCenterX: function() { + var o = this.vehicle == null ? this : this.vehicle; + return o.getCenterX(); + } + ,getVCenterY: function() { + var o = this.vehicle == null ? this : this.vehicle; + return o.getCenterY(); + } + ,getTileCenX: function() { + return this.getVCenterX() / com_davidmaletz_tiles_Tile.SIZE; + } + ,getTileCenY: function() { + return this.getVCenterY() / com_davidmaletz_tiles_Tile.SIZE; + } + ,_getTileX: function() { + var o = this.vehicle == null ? this : this.vehicle; + return o.xPos / com_davidmaletz_tiles_Tile.SIZE; + } + ,_getTileY: function() { + var o = this.vehicle == null ? this : this.vehicle; + return o.yTile / com_davidmaletz_tiles_Tile.SIZE; + } + ,_getFacing: function() { + var o = this.vehicle == null ? this : this.vehicle; + if(o.renderer == null) { + return 0; + } else { + return o.getFacing(); + } + } + ,_getWidth: function() { + var o = this.vehicle == null ? this : this.vehicle; + return o._width; + } + ,getVTileX: function() { + return Math.round(this._getTileX()); + } + ,getVTileY: function() { + return Math.round(this._getTileY()); + } + ,getArmColor: function() { + var c = "skin"; + if(this.info.xml.exists("armColor")) { + c = this.info.xml.get("armColor"); + } + return com_davidmaletz_faengfl_LayerManager.getColor(this.colors,c); + } + ,updateSprite: function(cols,offs,c) { + this.colors = cols; + this.offsets = offs; + this.updateColors(); + } + ,isBack: function() { + return this != com_davidmaletz_mining_Main.getLocalPlayer(); + } + ,getCarryWeight: function() { + var w = 50; + if(com_davidmaletz_mining_effects_Storm.hasStorm()) { + w -= 35; + return w; + } else { + return this.difficulty.modifyCapacity(w) + this.stats.getInt("weight"); + } + } + ,getMine: function() { + var p = this.equipment.getItemUsed("pickaxe"); + if(p == null) { + return 0; + } else { + return (js_Boot.__cast(p.info , com_davidmaletz_mining_item_Equipment)).getMine(p.getNameStr()); + } + } + ,getItemCount: function(item) { + var item1 = com_davidmaletz_mining_item_ItemInfo.get(item); + if(item1 == null) { + return 0; + } else { + return this.getCurrentInventory().getItemCount(item1); + } + } + ,setItemCount: function(item,ct) { + var item1 = com_davidmaletz_mining_item_ItemInfo.get(item); + if(item1 != null) { + this.getCurrentInventory().setItemCount(item1,ct); + } + } + ,getItemCountStorehouse: function(item) { + var item1 = com_davidmaletz_mining_item_ItemInfo.get(item); + if(item1 == null) { + return 0; + } else { + return this.storehouseInventory.getItemCount(item1); + } + } + ,getItemCountIncEquipment: function(item) { + var item1 = com_davidmaletz_mining_item_ItemInfo.get(item); + if(item1 == null) { + return 0; + } else { + return this.getCurrentInventory().getItemCount(item1) + (this.equipment.isEquipped(item1) ? 1 : 0); + } + } + ,isEquipped: function(i) { + var item = com_davidmaletz_mining_item_ItemInfo.get(i); + if(item != null) { + return this.equipment.isEquipped(item); + } else { + return false; + } + } + ,hasItem: function(i) { + var item = com_davidmaletz_mining_item_ItemInfo.get(i); + var inv = this.vehicle == null ? this.inventory : this.vehicle.fullInventory; + if(item != null) { + if(!(inv.getItemCount(item) > 0 || this.equipment.isEquipped(item))) { + return this.vanity.isEquipped(item); + } else { + return true; + } + } else { + return false; + } + } + ,hasItemStorehouse: function(i) { + var item = com_davidmaletz_mining_item_ItemInfo.get(i); + if(item != null) { + if(!(this.storehouseInventory.getItemCount(item) > 0 || this.vehicle != null && this.vehicle.inventory.getItemCount(item) > 0 || this.equipment.isEquipped(item))) { + return this.vanity.isEquipped(item); + } else { + return true; + } + } else { + return false; + } + } + ,selectItem: function(i) { + var item = com_davidmaletz_mining_item_ItemInfo.get(i); + if(item == null) { + return null; + } + if(this.equipment.isEquipped(item)) { + return new com_davidmaletz_mining_item_EquipmentSlot(this,item.xml.get("slot")); + } + var i1 = this.inventory.selectItem(item,0,null); + if(i1 != null) { + return new com_davidmaletz_mining_item_InventoryValue(i1); + } else { + return null; + } + } + ,isItemSticky: function(item) { + return this.stickyItems.exists(item); + } + ,setItemSticky: function(item,sticky) { + if(sticky != this.isItemSticky(item)) { + if(sticky) { + this.stickyItems.set(item,true); + } else { + this.stickyItems.remove(item); + } + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("sticky_changed",item)); + } + } + ,hasItemType: function(type) { + var tmp = this.inventory; + var a1 = com_davidmaletz_mining_item_ItemCategory.parse(type); + return tmp.getItems(function(a2) { + return com_davidmaletz_mining_item_Inventory.filterType(a1,a2); + }).hasNext(); + } + ,addItem: function(id,count) { + if(count == null) { + count = 1; + } + var i = com_davidmaletz_mining_item_ItemInfo.get(id); + if(i != null) { + this.addItems(i,count); + } + } + ,getInfo: function() { + return this.info; + } + ,createRenderer: function() { + var renderer = new com_davidmaletz_mining_renderer_PlayerRenderer(this); + renderer.addEventListener("removedFromStage",$bind(this,this.stopSFX)); + this.equipment.init(this); + this.familiar.init(); + this.getInfo().runEvent(this,"createRenderer",this); + return renderer; + } + ,getSalePercent: function() { + return Math.pow(0.7,2 / (2 + this.stats.getInt("bargaining"))); + } + ,includeCost: function() { + return this.getMaxCoins() > 0; + } + ,getStaminaPercent: function() { + return this.stamina / this.getMaxStamina(); + } + ,getStamina: function() { + return this.stamina; + } + ,getLevel: function() { + return this.levelFromExperience(this.experience); + } + ,getMaxStamina: function() { + var info = this.getInfo(); + return info.stamina + this.stats.getInt("stamina"); + } + ,getMaxHealth: function() { + return this.info.health + this.stats.getInt("health"); + } + ,getOxygen: function() { + return this.oxygen; + } + ,getMaxOxygen: function() { + return this.getInfo().oxygen + this.stats.getInt("oxygen") + this.eq_oxygen.get(); + } + ,getOxygenPercent: function() { + return this.getOxygen() / this.getMaxOxygen(); + } + ,getSpeed: function() { + var f = this.isFlying(); + var ret = this.getInfo().speed * (com_davidmaletz_faengfl_adv_AdvApp.shiftDown ? 1 : Math.pow(0.8,f ? this._flight.flight.speed : this.stats.getInt("speed"))); + if(!f && this.getOverweight() > 0) { + ret *= 1.5; + } + return ret; + } + ,getAnim: function(id) { + var base = this.info.xml.exists("animation") ? this.info.xml.get("animation") + "." : "player."; + if(this.info.xml.exists(id + "_anim")) { + return this.info.xml.get(id + "_anim"); + } else { + return base + id; + } + } + ,getIconFrame: function() { + return com_davidmaletz_mining_world_Object.getFrame("player.idle"); + } + ,playAnimation: function(animation,onComplete,loop) { + if(loop == null) { + loop = false; + } + if(this.renderer != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_renderer_PlayerObjectRenderer)).playAnimation(animation,onComplete); + } else { + com_davidmaletz_mining_world_TooltipObject.prototype.playAnimation.call(this,animation,onComplete,loop); + } + } + ,useWeapon: function(i,projectile) { + if(this.renderer != null && i != null && this == com_davidmaletz_mining_Main.getLocalPlayer()) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_renderer_PlayerRenderer)).useEquipment(i,projectile); + } + } + ,cameraCentered: function() { + return this.equipment.isSlotVisible(this,"pickaxe"); + } + ,modal: null + ,gameOver: function() { + var _gthis = this; + if(this.modal != null) { + this.modal.kill(null); + this.modal = null; + } + var func = function() { + new com_davidmaletz_faengfl_transition_EllipseFade(com_davidmaletz_mining_Main.gameOver,60,0,_gthis.cameraCentered() ? 0 : 72. - com_davidmaletz_tiles_Tile.SIZE * 1.5); + }; + if(com_davidmaletz_faengfl_Window.window_ct == 0) { + func(); + } else { + new com_davidmaletz_faengfl_InvokeLater(func,0); + } + } + ,setHealth: function(h,fireDeath,attacker) { + if(fireDeath == null) { + fireDeath = true; + } + if(this.health == 0 && h > 0) { + var show = this.getShowHair(true); + if(show != this.showHair) { + this.showHair = show; + this.updateColors(false); + } + } + com_davidmaletz_mining_world_TooltipObject.prototype.setHealth.call(this,h,fireDeath,attacker); + } + ,getDefaultArea: function() { + var e = this.getEntry(); + var a = null; + if(e != null) { + a = this.areas.get(e.get("area")); + } + if(a == null) { + return this.areas.get("start"); + } else { + return a; + } + } + ,getEntry: function() { + var i = this.info.xml.elementsNamed("respawn"); + if(i.hasNext()) { + var e = i.next(); + if(!e.exists("if") || com_davidmaletz_faengfl_EventHandler._conditionMet(e.get("if"),com_davidmaletz_mining_npc_NPCEventHandler.createVariables(this))) { + return e; + } + } + return com_davidmaletz_faengfl_adv_ModHandler.getEntryById(this.entry); + } + ,_onDeath: function(killer,element) { + if(this.vehicle != null) { + this.vehicle.dismount(); + } + this.familiar.destroy(); + if(this.showHair != 0) { + this.showHair = this.getShowHair(false); + this.updateColors(false); + } + this.stamina = this.getMaxStamina(); + var e = this.getEntry(); + if(e != null) { + this.location = e.get("area"); + this.__location_id = -1; + this.prevLocation = null; + this.xPos = Math.round(com_davidmaletz_mining_Main.parseFloat(e.get("x")) * com_davidmaletz_tiles_Tile.SIZE); + this.yTile = Math.round(com_davidmaletz_mining_Main.parseFloat(e.get("y")) * com_davidmaletz_tiles_Tile.SIZE); + } + if(this.area == null) { + return; + } + var r = this.renderer; + this.renderer = null; + this.area.removeObject(this); + this.area = null; + if(this != com_davidmaletz_mining_Main.getLocalPlayer()) { + return; + } + if(r != null) { + com_davidmaletz_mining_Main.closeWindows(); + var pr = js_Boot.__cast(r , com_davidmaletz_mining_renderer_PlayerObjectRenderer); + pr.kill(); + this.modal = new com_davidmaletz_faengfl_transition_Modal(pr,null); + } else { + this.gameOver(); + } + } + ,getWeight: function() { + return this.inventory.getWeight(); + } + ,onDeath: function(killer,element) { + if(this == com_davidmaletz_mining_Main.getLocalPlayer()) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + com_davidmaletz_mining_world_TooltipObject.prototype.onDeath.call(this,killer,element); + var f = $bind(this,this._onDeath); + var a1 = killer; + var a2 = element; + var tmp = function() { + f(a1,a2); + }; + this.info.runEvent(this,"onDeath",this,tmp); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + } + ,onRespawn: function() { + this.setHealth(1); + this.stats.get("invulnerable").tempBuff(1,20); + } + ,getDefense: function(element,behind,critical,useDurability) { + var d = 0; + var underwater = this.isUnderwater(); + var slot = this.equipment.getSlots(); + while(slot.hasNext()) { + var slot1 = slot.next(); + if(slot1 != "shield") { + var i = this.equipment.getItem(slot1); + if(i != null && this.checkUnderwater(i.info,underwater) && Std["is"](i.info,com_davidmaletz_mining_item_Equipment) && (i.value == 0 || i.info.xml.get("hide") == "true" || i.value < i.info.getDurability())) { + var eq = js_Boot.__cast(i.info , com_davidmaletz_mining_item_Equipment); + var def = eq.getDefense(element,i.getNameStr()); + if(def > 0) { + d += def; + if(useDurability && eq.defense > 0 && eq.xml.get("hide") != "true" && eq.xml.get("durabilityBlock") != "false") { + this.equipment.increaseValue(this,slot1,1); + } + } + } + } + } + if(d > 0) { + d += this.stats.getInt("defense"); + } + return d; + } + ,getDefenseElement: function() { + var i = this.equipment.getItem("armor"); + if(i == null) { + i = this.equipment.getItem("head"); + } + if(i != null) { + return i.getElement(); + } else { + return com_davidmaletz_mining_world_Element.get(this.getInfo().xml.get("element")); + } + } + ,handleHit: function(i,attacker) { + var hit; + var e = i.getElement(); + if(Std["is"](attacker,com_davidmaletz_mining_enemy_Enemy) && !(js_Boot.__cast(attacker , com_davidmaletz_mining_enemy_Enemy)).canBeAttacked(this,false)) { + return; + } + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + if(i.info.xml.elementsNamed("onBlock").hasNext()) { + var vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(this); + vars.set("attacker",attacker); + i.info.runEvent("onBlock",this,i,null,vars); + } + var tmp; + var tmp1; + if(this.area != null) { + hit = com_davidmaletz_mining_world_ObjectInfo.getHitEffectI(this,e,i.info.xml); + tmp1 = hit != null; + } else { + tmp1 = false; + } + if(!tmp1) { + tmp = i.info.xml.exists("reflect"); + } else { + tmp = true; + } + if(tmp) { + var b = attacker.getBounds(); + com_davidmaletz_mining_world_Object.rectangle.copyFrom(b); + com_davidmaletz_mining_world_Object.rectangle.inflate(2,2); + if(this.area.intersectsLoop(com_davidmaletz_mining_world_Object.rectangle,this.getBounds())) { + if(attacker.area != null && i.info.xml.exists("reflect")) { + attacker.loseHealth(com_davidmaletz_mining_Main.parseInt(i.info.xml.get("reflect")),6,this,e,0,false); + } + if(hit != null) { + attacker.hitEffect(hit); + } + } + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + ,canHit: function() { + if(this != com_davidmaletz_mining_Main.getLocalPlayer()) { + return true; + } else if(this.renderer != null && (js_Boot.__cast(this.renderer , com_davidmaletz_mining_renderer_PlayerRenderer)).move_frames > 15) { + this.showPopup(true,com_fancyfish_faeng_common_Lang.getText("common","dodged")); + return false; + } else { + return true; + } + } + ,addHealth: function(h) { + if(this == com_davidmaletz_mining_Main.getLocalPlayer()) { + com_davidmaletz_mining_world_TooltipObject.prototype.addHealth.call(this,h); + } + } + ,loseHealth: function(h,flags,attacker,attackElement,scaleX,playSFX) { + if(playSFX == null) { + playSFX = true; + } + if(scaleX == null) { + scaleX = 0; + } + if(flags == null) { + flags = 0; + } + if(this != com_davidmaletz_mining_Main.getLocalPlayer()) { + this.dispatchEvent(new com_davidmaletz_mining_LoseHealthEvent("lose_health",attacker,h,flags,attackElement,scaleX,playSFX)); + return 0; + } + if(this.paused.get()) { + return 0; + } + if(this.stats.getInt("invulnerable") > 0) { + if(h > 0 && attacker != null) { + this.showPopup(true,com_fancyfish_faeng_common_Lang.getText("common","dodged")); + } + return 0; + } + if(attacker != null) { + var s = this.shield.get(); + if(s != null && (!com_davidmaletz_mining_world_Object.isFlagCritical(flags) || s.info.xml.get("omnidirectional") == "true") && (!com_davidmaletz_mining_world_Object.isFlagIgnoreArmor(flags) || s.info.xml.get("blockIgnoreArmor") == "true")) { + if(attacker != this) { + this.handleHit(s,attacker); + } + h = com_davidmaletz_mining_world_Object.getDamage(h,(js_Boot.__cast(s.info , com_davidmaletz_mining_item_Equipment)).getDefense(attackElement,s.getNameStr()),attackElement,s.getElement(),false); + if(h > 0) { + var b = s.info.xml.get("block"); + if(b != null) { + var cost = s.info.xml.exists("blockCost") ? com_davidmaletz_mining_Main.parseInt(s.info.xml.get("blockCost")) : 1; + if(b == "stamina") { + var ret = h * cost; + var stat = s.info.xml.get("staminaStat"); + if(stat != null) { + ret -= com_fancyfish_faeng_common_Utils.min(ret - 1,Math.ceil(ret * this.stats.getInt(stat) / 10)); + } + this.loseStamina(ret); + h = 0; + } else if(this.hasStorage(b)) { + var store = this.getStorage(b); + var c = com_fancyfish_faeng_common_Utils.min(Math.floor(store.getValue() / cost),h); + store.loseValue(c * cost); + h -= c; + } + } else { + this.equipment.increaseValue(this,"shield",h); + h -= this.difficulty.maxShieldBlock; + } + } + if(h <= 0) { + this.onBlocked(attacker,playSFX,false); + return 0; + } + } + if(attacker != this) { + var i = this.equipment.getItem("armor"); + if(i != null) { + this.handleHit(i,attacker); + } + } + } + return com_davidmaletz_mining_world_TooltipObject.prototype.loseHealth.call(this,h,flags,attacker,attackElement,scaleX,playSFX); + } + ,modifyAttack: function(h,attacker) { + return this.difficulty.modifyDamage(h); + } + ,healthRestoringItem: function(item) { + if(item.hasActionId("eat") && item.getHealth(this) > 0) { + return item.xml.get("autoEat") != "false"; + } else { + return false; + } + } + ,staminaRestoringItem: function(incHP,item) { + if(item.hasActionId("eat") && item.getStamina(this) > 0 && (incHP || item.getHealth(this) == 0)) { + return !item.xml.exists("autoEat"); + } else { + return false; + } + } + ,oxygenRestoringItem: function(item) { + if(item.hasActionId("eat")) { + return item.getOxygen(this) > 0; + } else { + return false; + } + } + ,currentInventory: function() { + if(this.vehicle == null) { + return this.inventory; + } else { + return this.vehicle.fullInventory; + } + } + ,healPriority: function(a,b) { + var p1 = com_davidmaletz_mining_Main.parseInt(a.item.xml.get("autoEat")) * 1000 + a.item.getHealth(this); + var p2 = com_davidmaletz_mining_Main.parseInt(b.item.xml.get("autoEat")) * 1000 + b.item.getHealth(this); + return p1 - p2; + } + ,autoHeal: function(health) { + if(this.stats.getInt("full") > 0 || !com_davidmaletz_mining_Player.AUTO_HEAL || this.health == this.getMaxHealth()) { + return 0; + } + var inv = this.currentInventory(); + var i = inv.getItems($bind(this,this.healthRestoringItem),$bind(this,this.healPriority)); + while(i.hasNext()) { + var i1 = i.next(); + var f = i1.item; + var hp = f.getHealth(this); + if(health + hp > 0) { + inv.addItems(f,-1); + this.addStamina(f.getStamina(this)); + this.staminaWarning = false; + if(this == com_davidmaletz_mining_Main.getLocalPlayer()) { + var msg = com_fancyfish_faeng_common_Lang.getText("common","auto_eat").get(); + msg = StringTools.replace(msg,"{count}","1"); + msg = StringTools.replace(msg,"{item}",f.getDisplay(null)); + com_davidmaletz_mining_ui_NotificationQueue.showNotification(new com_davidmaletz_faengfl_ui_FormattedTooltip(0,0,msg,false,16777215,-1442840576)); + } + this.onEat(); + return com_fancyfish_faeng_common_Utils.min(this.health + hp,this.getMaxHealth()) + health - this.health; + } + } + return 0; + } + ,autoStamina: function(stamina,incHP) { + if(this.stats.getInt("full") > 0 || !com_davidmaletz_mining_Player.AUTO_STAMINA && (!incHP || !com_davidmaletz_mining_Player.AUTO_HEAL) || this.stamina == this.getMaxStamina()) { + return stamina; + } + var inv = this.currentInventory(); + var f = $bind(this,this.staminaRestoringItem); + var a1 = incHP; + var i = inv.getItems(function(a2) { + return f(a1,a2); + }); + while(i.hasNext()) { + var i1 = i.next(); + var f1 = i1.item; + var s = f1.getStamina(this); + if(stamina + s >= 0) { + inv.addItems(f1,-1); + this.addHealth(f1.getHealth(this)); + if(this == com_davidmaletz_mining_Main.getLocalPlayer()) { + var msg = com_fancyfish_faeng_common_Lang.getText("common","auto_eat_stamina").get(); + msg = StringTools.replace(msg,"{count}","1"); + msg = StringTools.replace(msg,"{item}",f1.getDisplay(null)); + com_davidmaletz_mining_ui_NotificationQueue.showNotification(new com_davidmaletz_faengfl_ui_FormattedTooltip(0,0,msg,false,16777215,-1442840576)); + } + this.onEat(); + return com_fancyfish_faeng_common_Utils.min(this.stamina + s,this.getMaxStamina()) + stamina - this.stamina; + } + } + return stamina; + } + ,autoOxygen: function(oxygen) { + if(this.stats.getInt("full") > 0 || !com_davidmaletz_mining_Player.AUTO_STAMINA || this.oxygen == this.getMaxOxygen()) { + return oxygen; + } + var inv = this.currentInventory(); + var i = inv.getItems($bind(this,this.oxygenRestoringItem)); + while(i.hasNext()) { + var i1 = i.next(); + var f = i1.item; + var o = f.getOxygen(this); + if(oxygen + o >= 0) { + inv.addItems(f,-1); + this.oxygenWarning = true; + if(this == com_davidmaletz_mining_Main.getLocalPlayer()) { + var msg = com_fancyfish_faeng_common_Lang.getText("common","auto_eat_oxygen").get(); + msg = StringTools.replace(msg,"{count}","1"); + msg = StringTools.replace(msg,"{item}",f.getDisplay(null)); + com_davidmaletz_mining_ui_NotificationQueue.showNotification(new com_davidmaletz_faengfl_ui_FormattedTooltip(0,0,msg,false,16777215,-1442840576)); + } + this.onEat(); + return com_fancyfish_faeng_common_Utils.min(this.oxygen + o,this.getMaxOxygen()) + oxygen - this.oxygen; + } + } + return oxygen; + } + ,fullRestore: function() { + this.restoreHealth(); + this.restoreStamina(); + } + ,restoreStamina: function(p) { + if(p == null) { + p = 1; + } + var s = Math.round(this.getMaxStamina() * p) - this.stamina; + if(s > 0) { + this.addStamina(s); + } + } + ,showCoins: function() { + var g = this.gui; + if(g == null && this.vehicle != null) { + g = this.vehicle.gui; + } + if(g != null) { + com_davidmaletz_mining_Main.getContainer().addDisplay(g.coins,3); + } + } + ,createSimpleSprite: function(anim) { + var s = new com_davidmaletz_tiles_render_StaticPlayAnimation(this.getInfo().makeTile(this.colors,this.offsets),this.getAnim(anim),15,true,null,-0.5,-0.5); + var t = this.getBeardTile(); + if(t != null) { + var beard = new com_davidmaletz_tiles_render_StaticPlayAnimation(t,this.getBeardAnim(anim),15,true,null,-0.5,-0.5); + com_davidmaletz_faengfl_TextSprite.setColor(beard,com_davidmaletz_faengfl_LayerManager.getColor(this.colors,"hair"),163); + s.addChild(beard); + } + return s; + } + ,makeTile: function() { + var old = this.offsets.get("hair"); + var info = this.getInfo(); + if(this.showHair != 0 && old != null) { + old.clipY = this.showHair; + this.offsets.set("hair",this.showHair == 100 ? com_davidmaletz_faengfl_TileOffset.HIDDEN : old); + } + var ret = info.makeTile(this.colors,this.offsets); + if(this.showHair != 0 && old != null) { + old.clipY = 0; + this.offsets.set("hair",old); + } + return ret; + } + ,getBeardTile: function() { + var off = this.offsets.get("beard"); + if(!this.getInfo().hasBeard || off == null || off.hidden || off.tile == null) { + return null; + } + var t = com_davidmaletz_tiles_Tile.get(off.tile); + if(t == null) { + return null; + } else if(off.offset == 0) { + return t; + } else { + return new com_davidmaletz_tiles_render_TileOffsetRenderer(t,off.offset,0); + } + } + ,getBeardAnim: function(anim_id) { + var base = (this.info.xml.exists("animation") ? this.info.xml.get("animation") + "." : "player.") + "beard."; + if(com_davidmaletz_tiles_TileAnimation.exists(base + anim_id)) { + return base + anim_id; + } else if(com_davidmaletz_tiles_TileAnimation.exists(base + "idle")) { + return base + "idle"; + } else { + return "single"; + } + } + ,update_weight: function(e) { + var w = this.getCarryWeight(); + var iter = this.equipment.getEquipment(com_davidmaletz_mining_Player.isEquip); + var i = iter; + while(i.hasNext()) { + var i1 = i.next(); + w += (js_Boot.__cast(i1.info , com_davidmaletz_mining_item_Equipment)).getCapacity(i1.getNameStr()); + } + this.capacity.set(w); + } + ,__adjust_max: null + ,updateMaxHealth: function(e) { + var max = this.getMaxHealth(); + if(this.health > max) { + this.health = max; + } + this.__adjust_max = true; + this.dispatchEvent(new com_davidmaletz_mining_world_HealthEvent("change_health",null,0)); + this.__adjust_max = false; + } + ,updateMaxStamina: function(e) { + var max = this.getMaxStamina(); + if(this.stamina > max) { + this.stamina = max; + } + this.__adjust_max = true; + this.dispatchEvent(new openfl_events_Event("change_stamina")); + this.__adjust_max = false; + } + ,updateMaxOxygen: function(e) { + var max = this.getMaxOxygen(); + if(this.oxygen > max) { + this.oxygen = max; + } + this.__adjust_max = true; + this.dispatchEvent(new openfl_events_Event("change_oxygen")); + this.__adjust_max = false; + } + ,updateLight: function(e) { + if(this.renderer != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_renderer_PlayerObjectRenderer)).equipmentChanged(); + } + } + ,firingQuestComplete: null + ,checkQuestComplete: function(e) { + var _gthis = this; + if(this.area == null || com_davidmaletz_mining_Main.getLocalPlayer() != this) { + return; + } + var ar = null; + var q = this.getQuests(); + while(q.hasNext()) { + var q1 = q.next(); + if(q1.hasCanCompleteEvent() && this.canCompleteQuest(q1.id) && !this.firingQuestComplete.exists(q1.id)) { + if(ar == null) { + ar = [q1]; + } else { + ar.push(q1); + } + this.firingQuestComplete.set(q1.id,true); + } + } + if(ar != null) { + var _g = 0; + while(_g < ar.length) { + var q2 = [ar[_g]]; + ++_g; + var tmp = (function(q3) { + return function() { + _gthis.firingQuestComplete.remove(q3[0].id); + }; + })(q2); + q2[0].runCanCompleteEvent(this,tmp); + } + } + } + ,getBreakPower: function(tool,useCost) { + var p = tool.breakPower + this.stats.getInt("mine_speed"); + if(useCost) { + var f = this.familiar.familiar; + if(f != null) { + f.useBreakPower(); + } + } + return p; + } + ,change_equipment_vanity: function(slot,e) { + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.change_vanity)); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("change_vanity",slot)); + } + ,getShowHair: function(includeHead) { + var show = 0; + var e = this.equipment.iterator(); + while(e.hasNext()) { + var e1 = e.next(); + var i = e1.get(); + if(i != null && !this.hasVanity(i.info,i.info.xml.get("slot")) && (includeHead || i.info.xml.get("slot") != "head" || i.info.xml.get("includeDeath") == "true")) { + show = com_davidmaletz_mining_Player.parseShowHair(i.info.xml.get("hair"),show); + } + } + var e2 = this.vanity.iterator(); + while(e2.hasNext()) { + var e3 = e2.next(); + var i1 = e3.get(); + if(i1 != null && (includeHead || i1.info.xml.get("slot") != "head" || i1.info.xml.get("includeDeath") == "true")) { + show = com_davidmaletz_mining_Player.parseShowHair(i1.info.xml.get("hair"),show); + } + } + return show; + } + ,change_vanity: function(e) { + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.change_vanity)); + var show = this.getShowHair(true); + if(show != this.showHair) { + this.showHair = show; + this.updateColors(false); + } + } + ,updateHidden: function() { + var view_hidden = false; + var e = this.equipment.iterator(); + while(e.hasNext()) { + var e1 = e.next(); + var i = e1.get(); + if(i != null && i.info.getValue(i.getNameStr(),"viewHidden") == "true") { + view_hidden = true; + } + } + if(view_hidden != this.viewHiddenEq.get()) { + this.viewHiddenEq.set(view_hidden); + } + if(this.area != null && this.area.viewHidden()) { + view_hidden = true; + } + if(view_hidden != this.viewHidden.get()) { + this.viewHidden.set(view_hidden); + } + } + ,changeEquipment: function(slot,e) { + var show = 0; + var oxy = 0; + var view_hidden = false; + var depth = this.getInfo().max_depth; + var e1 = this.equipment.iterator(); + while(e1.hasNext()) { + var e2 = e1.next(); + var i = e2.get(); + if(i != null && !this.hasVanity(i.info,i.info.xml.get("slot"))) { + show = com_davidmaletz_mining_Player.parseShowHair(i.info.xml.get("hair"),show); + } + if(i != null && Std["is"](i.info,com_davidmaletz_mining_item_Equipment)) { + oxy += (js_Boot.__cast(i.info , com_davidmaletz_mining_item_Equipment))._getOxygen(i.getNameStr()); + } + if(i != null && i.info.getValue(i.getNameStr(),"viewHidden") == "true") { + view_hidden = true; + } + if(i != null && i.info.xml.exists("max_depth")) { + var d = com_davidmaletz_mining_Main.parseInt(i.info.xml.get("max_depth")); + if(d > depth) { + depth = d; + } + } + } + var e3 = this.vanity.iterator(); + while(e3.hasNext()) { + var e4 = e3.next(); + var i1 = e4.get(); + if(i1 != null) { + show = com_davidmaletz_mining_Player.parseShowHair(i1.info.xml.get("hair"),show); + } + } + this.max_depth.set(depth); + if(show != this.showHair) { + this.showHair = show; + this.updateColors(false); + } + if(view_hidden != this.viewHiddenEq.get()) { + this.viewHiddenEq.set(view_hidden); + } + if(this.area != null && this.area.viewHidden()) { + view_hidden = true; + } + if(view_hidden != this.viewHidden.get()) { + this.viewHidden.set(view_hidden); + this.overlapChanged(); + } + var e5 = this.equipment.getItem(slot); + if(slot == this.hidden.get()) { + this.hidden.set(null); + } + if(slot == "shield") { + var s = this.shield.get(); + if(s != null && e5 != s) { + this.shield.set(null); + } + } + this.updateFlight(); + if(this.renderer != null && this.area != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_renderer_PlayerObjectRenderer)).equipmentChanged(); + } + this.update_weight(); + this.info.runEvent(this,"changeEquip",slot); + if(oxy != this.eq_oxygen.get()) { + this.eq_oxygen.set(oxy); + this.updateMaxOxygen(); + } + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("change_equip",slot)); + } + ,changeEqState: function(slot,e) { + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("change_eq_state",slot)); + } + ,getModLight: function() { + return this.getInfo().mod_lights.get(this.stats.getInt("light")); + } + ,getJumpCost: function(p) { + var xml = null; + if(this.vehicle != null) { + xml = this.vehicle.info.xml; + } + var e = this.equipment.getEquipment(); + while(e.hasNext()) { + var e1 = e.next(); + if(e1.info.xml.get("canJump") == "true") { + xml = e1.info.xml; + break; + } + } + if(xml == null) { + return "false"; + } + if(xml.exists("jumpCost")) { + return com_davidmaletz_mining_npc_NPCEventHandler.evalString(xml.get("jumpCost"),com_davidmaletz_mining_npc_NPCEventHandler.createVariables(this),"",true); + } else { + return "default_jump_cost"; + } + } + ,canJump: function() { + if(this.vehicle != null) { + return this.vehicle.canJump(); + } + var e = this.equipment.getEquipment(); + while(e.hasNext()) { + var e1 = e.next(); + if(e1.info.xml.get("canJump") == "true") { + return true; + } + } + return false; + } + ,_flight: null + ,_pump: null + ,updateFlight: function() { + var old = this.hasFlightEquip(); + com_fancyfish_faeng_common_Utils.clear(this.flight); + this._pump = null; + var e = this.equipment.getEquipment(com_davidmaletz_mining_Player.isEquip); + while(e.hasNext()) { + var e1 = e.next(); + var eq = js_Boot.__cast(e1.info , com_davidmaletz_mining_item_Equipment); + if(eq.flight != null) { + this.flight.push(eq); + } + if(eq.pump != null) { + this._pump = eq; + } + } + this.getFlight(); + if(this.area != null && this.hasFlightEquip() != old) { + this.overlapChanged(); + } + } + ,getFlight: function() { + if(this.area != null && !this.area.canFly()) { + return null; + } + var eq = null; + var _g = 0; + var _g1 = this.flight; + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + if(f.canFly(this) && (eq == null || eq.flight.height < f.flight.height)) { + eq = f; + } + } + this._flight = eq; + return this._flight; + } + ,hasFlightEquip: function() { + return this.flight.length > 0; + } + ,canFly: function(_y) { + if(_y == null) { + _y = this.yTile; + } + var y = Math.ceil((_y + 1) / com_davidmaletz_tiles_Tile.SIZE); + var flight = this.getFlight(); + if(flight != null) { + return y > -flight.flight.height; + } else { + return false; + } + } + ,showFlightWarning: function(y) { + var eq = null; + var _g = 0; + var _g1 = this.flight; + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + if(y > -f.flight.height) { + if(f.canFly(this)) { + return; + } else if(eq == null || eq.flight.height < f.flight.height) { + eq = f; + } + } + } + if(eq != null) { + if(this.inventory.getWeight() > eq.flight.getMaxWeight()) { + var map = new haxe_ds_StringMap(); + map.set("{item}",eq.getDisplay(null)); + this.showWarning(new com_fancyfish_faeng_common_mutable_MutableTemplateStatic(com_fancyfish_faeng_common_Lang.getText("warning","flight_weight"),map)); + } else if(eq.flight.equipCost != null) { + var e = eq.flight.equipCost; + if(e.storage != null && e.storageCost > 0) { + var s = this.getStorage(e.storage); + if(s == null || s.getValue() < e.storageCost) { + this.showWarning(com_fancyfish_faeng_common_Lang.getText("warning",e.storage)); + } + } + } + } + } + ,isFlying: function(_y) { + if(_y == null) { + _y = this.yTile; + } + var y = Math.ceil((_y + 1) / com_davidmaletz_tiles_Tile.SIZE); + var flight = this.getFlight(); + var x = this.get_tile_x(); + if(this.area == null || this.area.isWater(x,y) && !this.area.emptyTile(x,y - 1)) { + return false; + } + if(!this.area.isWater(x,Math.round(_y / com_davidmaletz_tiles_Tile.SIZE)) && flight != null && y > -flight.flight.height && !this.enterTileWalk(x,y - 1)) { + return !this.willConsumePlayerMove(); + } else { + return false; + } + } + ,willConsumePlayerMove: function() { + var _g = 0; + var _g1 = this.overObjects; + while(_g < _g1.length) { + var o = _g1[_g]; + ++_g; + if(o.consumePlayerMove(this,0,0,0)) { + return true; + } + } + if(this.area != null) { + var ar = this.area.getStructuresInBounds(this.getBounds()); + var _g2 = 0; + while(_g2 < ar.length) { + var s = ar[_g2]; + ++_g2; + if(s.consumePlayerMove(this,0,0,0)) { + return true; + } + } + } + return false; + } + ,canGoUnderwater: function() { + return true; + } + ,canEnterTile: function(x,y) { + if(!com_davidmaletz_mining_world_TooltipObject.prototype.canEnterTile.call(this,x,y)) { + return this.enterTileWalk(x,y - 1); + } else { + return true; + } + } + ,_canEnterTile: function(x,y,dy) { + if(dy < 0) { + return com_davidmaletz_mining_world_TooltipObject.prototype.canEnterTile.call(this,x,y); + } else { + return this.canEnterTile(x,y); + } + } + ,enterTileWalk: function(x,y) { + if(this.area == null) { + return false; + } + if(this.area.isWater(x,y)) { + return true; + } + ++y; + if(!com_davidmaletz_mining_world_TooltipObject.prototype.canStandOn.call(this,this.area.getTile(x,y,0),x,y)) { + return this.area.getTile(x,y,3) != null; + } else { + return true; + } + } + ,canStandOn: function(t,x,y) { + var flight = this.getFlight(); + if(!(t != null || flight != null && y > -flight.flight.height)) { + if(this.area.isWater(x,y)) { + return !this.area.emptyTile(x,y - 1); + } else { + return false; + } + } else { + return true; + } + } + ,getStorage: function(id) { + var s = this.storage.get(id); + if(s == null) { + s = new com_davidmaletz_mining_item_Storage(id,this.inventory); + this.storage.set(id,s); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("add_storage",s)); + } + return s; + } + ,hasStorage: function(id) { + if(id != null) { + return this.storage.exists(id); + } else { + return false; + } + } + ,checkSeenItem: function(item) { + if(item.type != com_davidmaletz_mining_item_ItemCategory.none && this.seen_items != null && !this.seen_items.exists(item.id)) { + if(this.info.xml.get("foundItemPopup") == "true" && com_davidmaletz_mining_Player.ITEM_DISCOVER && this == com_davidmaletz_mining_Main.getLocalPlayer()) { + new com_davidmaletz_mining_ui_ItemFound(item); + } + this.seen_items.set(item.id,true); + } + } + ,hasSeenItem: function(id) { + if(this.seen_items != null) { + return this.seen_items.exists(id); + } else { + return false; + } + } + ,setSeenItem: function(id) { + if(this.seen_items != null) { + this.seen_items.set(id,true); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("seen_item",id)); + } + } + ,item_added: function(e) { + if(this.equipment == null) { + return; + } + this.checkQuestComplete(null); + var s = e.item.xml.get("storage"); + if(s != null) { + this.getStorage(s).update(); + } + if(e.delta != 0 || e.count != 0) { + if(e.delta == e.count) { + e.item.runEvent("onGet",this,e.item); + this.checkSeenItem(e.item); + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p != this && e.item.syncPlayers() && p.inventory.getItemCount(e.item) == 0) { + p.inventory.addItems(e.item,1); + } + } else if(e.count == 0) { + e.item.runEvent("onLose",this,e.item); + } + } + this.info.runEvent(this,"addItem",e); + } + ,init: function() { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = this == com_davidmaletz_mining_Main.getLocalPlayer(); + this.getInfo().runEvent(this,"init",this); + var storage = new haxe_ds_StringMap(); + this.checkQuestComplete(null); + var i = this.inventory.getItems(); + while(i.hasNext()) { + var i1 = i.next(); + var s = i1.item.xml.get("storage"); + if(s != null) { + storage.set(s,true); + } + i1.item.runEvent("onGet",this,i1.item); + this.checkSeenItem(i1.item); + } + var s1 = storage.keys(); + while(s1.hasNext()) { + var s2 = s1.next(); + this.getStorage(s2).update(); + } + this.info.runEvent(this,"addItem",null); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + ,getWatchInventory: function() { + return this.inventory; + } + ,getAction: function(p) { + if(p == com_davidmaletz_mining_Main.getLocalPlayer() && p != this) { + return com_fancyfish_faeng_common_Lang.getText("multiplayer","give_items"); + } else { + return null; + } + } + ,onOperate: function(p) { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_GiveInventory(p,p.inventory,this.inventory,com_fancyfish_faeng_common_Lang.getText("common","inventory"),this.getUsername(),c,p.capacity,this.capacity),2); + } + ,getUsername: function() { + if(this == com_davidmaletz_mining_Main.getLocalPlayer()) { + return new com_fancyfish_faeng_common_mutable_Static(com_davidmaletz_mining_Main.getLocalName()); + } + var p = com_davidmaletz_mining_Main.getRemotePlayerNames(); + while(p.hasNext()) { + var p1 = p.next(); + if(com_davidmaletz_mining_Main.getRemotePlayer(p1) == this) { + return new com_fancyfish_faeng_common_mutable_Static(p1); + } + } + return com_fancyfish_faeng_common_Lang.getText("quests","unknown_reqs"); + } + ,staminaWarning: null + ,addStamina: function(s) { + s += this.stamina; + var max = this.getMaxStamina(); + if(s > max) { + s = max; + } + if(s != this.stamina) { + this.stamina = s; + this.staminaWarning = true; + this.dispatchEvent(new openfl_events_Event("change_stamina")); + } + } + ,loseStamina: function(s) { + s = this.stamina - s; + if(s < 0) { + s = this.autoStamina(s,-s >= this.health); + var max = this.getMaxStamina(); + if(s > max) { + s = max; + } + } + if(s < 0) { + this.stamina = 0; + this.dispatchEvent(new openfl_events_Event("change_stamina")); + this.loseHealth(-s,0,null,null,0); + if(this.staminaWarning) { + if(this == com_davidmaletz_mining_Main.getLocalPlayer()) { + new com_davidmaletz_faengfl_ui_Popup(128.,52.,0,com_fancyfish_faeng_common_Lang.getText("warning","stamina"),16720418,-16777216,20,60,20); + } + this.staminaWarning = false; + } + } else if(s != this.stamina) { + this.stamina = s; + this.dispatchEvent(new openfl_events_Event("change_stamina")); + } + } + ,setStamina: function(s) { + if(s < this.stamina) { + this.loseStamina(this.stamina - s); + } else { + this.addStamina(s - this.stamina); + } + } + ,oxygenWarning: null + ,addOxygen: function(o) { + o += this.oxygen; + var max = this.getMaxOxygen(); + if(o > max) { + o = max; + } + if(o != this.oxygen) { + this.oxygen = o; + this.oxygenWarning = true; + this.dispatchEvent(new openfl_events_Event("change_oxygen")); + } + } + ,loseOxygen: function(o) { + o = this.oxygen - o; + if(o < this.getMaxOxygen()) { + this.state.setFlag("show_oxygen",true); + } + if(o < 0) { + o = this.autoOxygen(o); + var max = this.getMaxOxygen(); + if(o > max) { + o = max; + } + } + if(o < 0) { + this.oxygen = 0; + this.dispatchEvent(new openfl_events_Event("change_oxygen")); + this.loseHealth(-o * 20,0,null,null,0); + if(this.oxygenWarning) { + if(this == com_davidmaletz_mining_Main.getLocalPlayer()) { + new com_davidmaletz_faengfl_ui_Popup(128.,52.,0,com_fancyfish_faeng_common_Lang.getText("warning","oxygen"),16720418,-16777216,20,60,20); + } + this.oxygenWarning = false; + } + } else if(o != this.oxygen) { + this.oxygen = o; + this.dispatchEvent(new openfl_events_Event("change_oxygen")); + } + } + ,setOxygen: function(o) { + if(o < this.oxygen) { + this.loseOxygen(this.oxygen - o); + } else { + this.addOxygen(o - this.oxygen); + } + } + ,restoreOxygen: function() { + this.addOxygen(this.getMaxOxygen() - this.getOxygen()); + } + ,updateWeight: function() { + if(this.renderer != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_renderer_PlayerObjectRenderer)).updateWeight(); + } + } + ,updateColors: function(updateAll) { + if(updateAll == null) { + updateAll = true; + } + this.dispatchEvent(new com_davidmaletz_faengfl_events_IntEvent("update_colors",updateAll ? 1 : 0)); + } + ,getCoins: function() { + return this.getStorage("coins").getValue(); + } + ,getMaxCoins: function() { + return this.getStorage("coins").getMaxValue(); + } + ,addCoins: function(c) { + if(this.getStorage("coins").addValue(c)) { + com_davidmaletz_faengfl_achievement_Achievements.instance.submitScore("coins",this.getCoins()); + } + } + ,getPower: function() { + return this.getStorageValue("power"); + } + ,getStorageValue: function(s) { + if(this.hasStorage(s)) { + return this.getStorage(s).getValue(); + } else { + return 0; + } + } + ,getMaxPower: function() { + if(this.hasStorage("power")) { + return this.getStorage("power").getMaxValue(); + } else { + return 0; + } + } + ,getPowerPercent: function() { + if(this.hasStorage("power")) { + return this.getStorage("power").getPercent(); + } else { + return 0; + } + } + ,restorePower: function(message) { + if(message == null) { + message = true; + } + if(this.hasStorage("power")) { + this.getStorage("power").restoreValue(message ? com_fancyfish_faeng_common_Lang.getText("common","restore_power") : null); + } + } + ,restorePowerFrom: function(p,fuelPerPower) { + if(!this.hasStorage("power")) { + return; + } + var s = this.getStorage("power"); + var amt = s.getMaxValue() - s.getValue(); + if(amt <= 0) { + return; + } + var max = p.getUsableFuel() * fuelPerPower; + if(amt > max) { + amt = max; + if(this == com_davidmaletz_mining_Main.getLocalPlayer()) { + new com_davidmaletz_faengfl_ui_Popup(128.,52.,0,com_fancyfish_faeng_common_Lang.getText("common","restore_power_partial")); + } + } else if(this == com_davidmaletz_mining_Main.getLocalPlayer()) { + new com_davidmaletz_faengfl_ui_Popup(128.,52.,0,com_fancyfish_faeng_common_Lang.getText("common","restore_power")); + } + s.addValue(amt); + p.useFuel(Math.ceil(amt / fuelPerPower)); + } + ,losePower: function(p) { + this.loseStorage("power",p); + } + ,loseStorage: function(s,p) { + if(this.hasStorage(s)) { + this.getStorage(s).loseValue(p); + } + } + ,addStorage: function(s,p) { + if(this.hasStorage(s)) { + this.getStorage(s).addValue(p); + } + } + ,getPointsForLevel: function(lvl) { + if(lvl <= 0) { + return 0; + } + var a = 8; + var b = lvl * 4 + 8; + return this.difficulty.modifyPoints(lvl * (a + b >> 1)); + } + ,levelUp: function(to) { + if(this == com_davidmaletz_mining_Main.getLocalPlayer()) { + var i = this.getInfo(); + var l = this.getLevel(); + new com_davidmaletz_mining_ui_LevelUpPopup(this,l,to,this.getPointsForLevel(to) - this.getPointsForLevel(l)); + com_davidmaletz_faengfl_achievement_Achievements.instance.submitScore("level",to + 1); + } + } + ,onLevelUp: function() { + this.fullRestore(); + } + ,getExpPercent: function() { + var l = this.getLevel(); + var min = com_davidmaletz_mining_Player.experienceToNextLevel(l - 1); + return (this.experience - min) / (com_davidmaletz_mining_Player.experienceToNextLevel(l) - min); + } + ,addExp: function(e) { + e += this.experience; + var max = com_davidmaletz_mining_Player.experienceToNextLevel(this.getInfo().maxLevel) - 1; + if(e > max) { + e = max; + } + if(e < 0) { + e = 0; + } + if(this.experience != e) { + var lu = e >= com_davidmaletz_mining_Player.experienceToNextLevel(this.getLevel()); + if(lu) { + this.levelUp(this.levelFromExperience(e)); + } + this.experience = e; + if(lu) { + this.onLevelUp(); + } + this.dispatchEvent(new openfl_events_Event("add_exp")); + } + } + ,canDodge: function() { + return true; + } + ,currentStorehouse: null + ,gui: null + ,load: function(area) { + if(area == null) { + this.__location_id = -1; + return; + } else { + this.__location_id = area.__id; + } + if(area.clearReturn()) { + this.prevLocation = null; + } + if(this.vehicle != null) { + if(this.vehicle.area != null) { + this.vehicle.area.removeObject(this.vehicle); + } + this.vehicle.setPosition(this.xPos,this.yTile); + if(area == this.vehicle.interior) { + throw new js__$Boot_HaxeError("Vehicle cannot be inside itself!"); + } + this.vehicle.setPlayer(this); + area.addObject(this.vehicle); + } else { + area.addObject(this); + } + } + ,addedToArea: function() { + com_davidmaletz_mining_world_TooltipObject.prototype.addedToArea.call(this); + this.updateHidden(); + this.onPositionChanged(); + if(this.area == null) { + return; + } + this.area.addEventListener("add_structure",$bind(this,this.updateStorehouse)); + this.area.addEventListener("rem_structure",$bind(this,this.updateStorehouse)); + this.updateStorehouse(null); + if(this == com_davidmaletz_mining_Main.getLocalPlayer()) { + this.getGUI().init(); + } + } + ,getGUI: function() { + if(this.gui == null) { + var s = this.storage.keys(); + while(s.hasNext()) { + var s1 = s.next(); + this.getStorage(s1).update(); + } + this.gui = new com_davidmaletz_mining_ui_PlayerGUI(this); + } + return this.gui; + } + ,updateStorehouse: function(e) { + if(this.area == null) { + return; + } + var b = this.area.getMainStorehouse(true); + var inv = b == null ? null : b.accessInventory(); + if(inv == null && this.area.vehicle != null && Std["is"](this.area.vehicle,com_davidmaletz_mining_world_vehicle_Vehicle)) { + inv = (js_Boot.__cast(this.area.vehicle , com_davidmaletz_mining_world_vehicle_Vehicle)).inventory; + } + if(inv != this.currentStorehouse) { + this.currentStorehouse = inv; + this.storehouseInventory.destroy(); + var ar = this.storehouseInventory.inventories; + com_fancyfish_faeng_common_Utils.clear(ar); + if(inv == null) { + ar.push(this.inventory); + } else if(com_davidmaletz_mining_Player.STOREHOUSE_PRIORITY) { + ar.push(inv); + ar.push(this.inventory); + } else { + ar.push(this.inventory); + ar.push(inv); + } + this.storehouseInventory.init(); + } + } + ,removedFromArea: function(area) { + area.removeEventListener("add_structure",$bind(this,this.updateStorehouse)); + area.removeEventListener("rem_structure",$bind(this,this.updateStorehouse)); + com_davidmaletz_mining_world_TooltipObject.prototype.removedFromArea.call(this,area); + this.onOverlap(null,null); + if(this.overStructure != null) { + this.overStructure.onOut(this); + this.overStructure = null; + } + var _g = 0; + var _g1 = this.overObjects; + while(_g < _g1.length) { + var o = _g1[_g]; + ++_g; + o.onOut(this); + } + com_fancyfish_faeng_common_Utils.clear(this.overObjects); + this.storehouseInventory.destroy(); + var ar = this.storehouseInventory.inventories; + com_fancyfish_faeng_common_Utils.clear(ar); + ar.push(this.inventory); + this.storehouseInventory.init(); + this.currentStorehouse = null; + this.destroyGUI(); + } + ,destroyGUI: function() { + if(this.gui != null) { + this.gui.destroy(); + } + } + ,refreshGUI: function() { + if(this.gui != null && com_davidmaletz_mining_ui_GUI.instance == null) { + this.gui.init(); + } + } + ,moveRenderer: function(old_x,old_y,init) { + if(init == null) { + init = false; + } + var _y = this.renderer.get_y() + this.yTile - old_y; + this.renderer.set_x(Math.round(this.getCenterX())); + this.renderer.set_y(Math.round(this.getCenterY() + this._offsetY)); + if(old_x == this.xPos && old_y == this.yTile) { + _y = this.renderer.get_y(); + } + if(com_davidmaletz_faengfl_Window.window_ct == 0) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_renderer_PlayerObjectRenderer)).updateScroll(false); + } + if(_y != this.renderer.get_y()) { + var y = this.renderer.get_y(); + this.renderer.set_y(_y); + this.renderer.lerp(new com_davidmaletz_lerp_PositionKeyframe(this.renderer.get_x(),y),5); + } + if(this == com_davidmaletz_mining_Main.getLocalPlayer() && this.renderer != null && this.canPump()) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_renderer_PlayerRenderer)).doPump(); + } + if(com_davidmaletz_faengfl_Window.window_ct == 0) { + this.updateMusic(); + } + } + ,updateMusic: function() { + if(!com_davidmaletz_mining_effects_Storm.hasStorm() && this.area != null && this == com_davidmaletz_mining_Main.getLocalPlayer()) { + com_davidmaletz_faengfl_adv_sound_Music.update(); + } + } + ,canFall: function(x,y) { + if(com_davidmaletz_mining_world_TooltipObject.prototype.canEnterTile.call(this,x,y)) { + return false; + } + var _g = 0; + var _g1 = this.overObjects; + while(_g < _g1.length) { + var o = _g1[_g]; + ++_g; + if(o.consumePlayerMove(this,0,0,0)) { + return false; + } + } + if(this.area != null) { + var ar = this.area.getStructuresInBounds(this.getBounds()); + var _g2 = 0; + while(_g2 < ar.length) { + var s = ar[_g2]; + ++_g2; + if(s.consumePlayerMove(this,0,0,0)) { + return false; + } + } + } + return true; + } + ,canMove: function(dx,dy,frames) { + if(this.area == null) { + return false; + } + var _g = 0; + var _g1 = this.overObjects; + while(_g < _g1.length) { + var o = _g1[_g]; + ++_g; + if(o.consumePlayerMove(this,dx,dy,frames)) { + return false; + } + } + var ar = this.area.getStructuresInBounds(this.getBounds()); + var _g2 = 0; + while(_g2 < ar.length) { + var s = ar[_g2]; + ++_g2; + if(s.consumePlayerMove(this,dx,dy,frames)) { + return false; + } + } + return true; + } + ,getStepCost: function() { + var r = Math.pow(0.75,this.stats.getInt("endurance")) * 0.5 + this.difficulty.modifyOverweightCost(this.getOverweight()); + if(this.isFlying()) { + r *= this._flight.flight.cost; + } + return r; + } + ,changePosition: function(toX,toY) { + if(this.area == null) { + return; + } + com_davidmaletz_mining_world_TooltipObject.prototype.changePosition.call(this,toX,toY); + if(this != com_davidmaletz_mining_Main.getLocalPlayer()) { + var p = this; + var dx = toX - this.xPos; + var dy = toY - this.yTop(); + var end = false; + if(dx == 0 && dy == 0) { + return; + } + this.area.structures.getObjects(this.getBounds(),function(s,rect) { + if(s.moveRemotePlayer(p,dx,dy)) { + end = true; + return true; + } else { + return false; + } + }); + if(!end) { + this.area.getObjects(this.getBounds(),function(o,rect1) { + if(o.moveRemotePlayer(p,dx,dy)) { + return true; + } else { + return false; + } + }); + } + } + } + ,enterStructure: function() { + var s = this.getCurrentStructure(); + if(s != null && !s.useSelect(this)) { + s.prepareOperate(this); + } + } + ,onSelect: function() { + if(this.structure != null && this.structure.area == null || this.object != null && this.object.area == null) { + this.overlapChanged(); + } + if(this.structure != null && this.structure.useSelect(this)) { + if(this.structure.area != null) { + this.structure.prepareOperate(this); + } + } else if(this.object != null) { + if(this.object == com_davidmaletz_mining_Player.FISHING_SPOT || this.object == com_davidmaletz_mining_Player.WATER_EXIT || this.object.area != null) { + if(com_davidmaletz_faengfl_adv_AdvApp.shiftDown) { + this.object.moveToBack(); + } else { + this.object.onOperate(this); + } + } + } + } + ,showOptions: function() { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_Options(c,true),2); + } + ,onCancel: function() { + if(this.vehicle != null) { + this.vehicle.runEvent(this,"onCancel",$bind(this,this.showOptions)); + } else { + this.info.runEvent(this,"onCancel",this,$bind(this,this.showOptions)); + } + } + ,handleSecond: function() { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + this.stats.handleSecond(); + var _g = 0; + var _g1 = this.overObjects; + while(_g < _g1.length) { + var o = _g1[_g]; + ++_g; + o.overlapSecond(this); + } + var underwater = this.isUnderwater(); + var slot = this.equipment.getSlots(); + while(slot.hasNext()) { + var slot1 = slot.next(); + var e = this.equipment.getItem(slot1); + if(e != null && this.checkUnderwater(e.info,underwater)) { + e.info.runEvent("handleSecond",this,e); + if(this.hidden.get() != slot1 && e.info.equipCost != null && e.info.equipCost.canRun(this,slot1)) { + e.info.equipCost.run(this,slot1); + } + if(this.hidden.get() != slot1 && e.info.xml.get("hide") == "true") { + if(this.hidden.get() == null && e.value == 0) { + if(this == com_davidmaletz_mining_Main.getLocalPlayer()) { + com_davidmaletz_faengfl_adv_sound_Sound.play("hide"); + } + this.hidden.set(slot1); + e.setValue(e.info.getDurability()); + } + } + } + } + if(this.isFlying() && this._flight.flight.equipCost != null) { + this._flight.flight.equipCost.run(this,this._flight.xml.get("slot")); + } + this.updateMusic(); + this.info.runEvent(this,"handleSecond",this); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + ,applyMod: function(item,ct) { + if(ct == null) { + ct = 1; + } + if(ct <= 0) { + return false; + } + var ret = false; + var e = item.xml.elementsNamed("stat"); + while(e.hasNext()) { + var e1 = e.next(); + var value = com_davidmaletz_mining_Main.parseInt(e1.get("value")); + var s = this.stats.get(e1.get("id")); + if(e1.exists("time")) { + if(s.tempBuff(value,com_davidmaletz_mining_Main.parseInt(e1.get("time")))) { + ret = true; + } + } else if(e1.exists("max")) { + var max = com_davidmaletz_mining_Main.parseInt(e1.get("max")); + if(s.perma_buff < max) { + s.permaBuff(com_fancyfish_faeng_common_Utils.min(value * ct,max - s.perma_buff)); + ret = true; + } + } else { + s.permaBuff(value * ct); + ret = true; + } + } + return ret; + } + ,drop: function(item,ct) { + this.inventory.addItems(item.item,-ct,item.value,item.name); + if(this == com_davidmaletz_mining_Main.getLocalPlayer()) { + com_davidmaletz_faengfl_adv_sound_Sound.play("drop"); + } + } + ,getMaxEat: function(item) { + var max = 0; + var f = item.item; + var fh = f.getHealth(this); + var fs = f.getStamina(this); + var fo = f.getOxygen(this); + var fp = f.getStorage(this); + if(fh > 0) { + var m = Math.ceil((this.getMaxHealth() - this.getHealth()) / fh); + if(m > max) { + max = m; + } + } + if(fs > 0) { + var m1 = Math.ceil((this.getMaxStamina() - this.getStamina()) / fs); + if(m1 > max) { + max = m1; + } + } + if(fo > 0) { + var m2 = Math.ceil((this.getMaxOxygen() - this.getOxygen()) / fo); + if(m2 > max) { + max = m2; + } + } + if(fp > 0) { + var s = this.getStorage(f.xml.get("eatStorage")); + var m3 = Math.ceil((s.getMaxValue() - s.getValue()) / fp); + if(m3 > max) { + max = m3; + } + } + var e = f.xml.elementsNamed("stat"); + while(e.hasNext()) { + var e1 = e.next(); + var s1 = this.stats.get(e1.get("id")); + if(e1.exists("time")) { + if(max == 0 && com_davidmaletz_mining_Main.parseInt(e1.get("time")) > s1.getTime()) { + max = 1; + } + } else if(e1.exists("max")) { + var value = com_davidmaletz_mining_Main.parseInt(e1.get("value")); + var m4 = Math.ceil((com_davidmaletz_mining_Main.parseInt(e1.get("max")) - s1.perma_buff) / value); + if(m4 > max) { + max = m4; + } + } else { + max = item.count; + } + } + if(max > item.count) { + return item.count; + } else { + return max; + } + } + ,onEat: function() { + if(this.difficulty.eatCooldown > 0) { + this.stats.get("full").tempBuff(1,this.difficulty.eatCooldown); + } + } + ,eat: function(item,ct) { + var health = this.getHealth(); + var stamina = this.getStamina(); + var oxygen = this.getOxygen(); + var storageType = item.item.xml.get("eatStorage"); + var storage = this.getStorageValue(storageType); + if(this.__eat(item,ct)) { + var b = new StringBuf(); + health = this.getHealth() - health; + stamina = this.getStamina() - stamina; + oxygen = this.getOxygen() - oxygen; + storage = this.getStorageValue(storageType) - storage; + if(health != 0) { + b.add(" [tile=health] "); + if(health > 0) { + b.add("+"); + } + b.add(com_fancyfish_faeng_common_Utils.largeNumberFormat(health)); + } + if(stamina != 0) { + b.add(" [tile=stamina] "); + if(stamina > 0) { + b.add("+"); + } + b.add(com_fancyfish_faeng_common_Utils.largeNumberFormat(stamina)); + } + if(oxygen != 0) { + b.add(" [tile=oxygen] "); + if(oxygen > 0) { + b.add("+"); + } + b.add(com_fancyfish_faeng_common_Utils.largeNumberFormat(oxygen)); + } + if(storage != 0) { + b.add(" [tile="); + var tile = com_davidmaletz_mining_ui_StatusBars.getTile(storageType); + b.add(tile); + if(com_davidmaletz_tiles_TileAnimation.exists(tile)) { + b.add(" anim="); + b.add(tile); + } + b.add("] "); + if(storage > 0) { + b.add("+"); + } + b.add(com_fancyfish_faeng_common_Utils.largeNumberFormat(storage)); + } + if(ct > 0) { + var e = item.item.xml.elementsNamed("stat"); + while(e.hasNext()) { + var e1 = e.next(); + b.add(" [tile=stat."); + b.add(e1.get("id")); + b.add("] "); + var v = com_davidmaletz_mining_Main.parseInt(e1.get("value")); + if(v > 0) { + b.add("+"); + } + b.add(com_fancyfish_faeng_common_Utils.largeNumberFormat(ct * v)); + } + } + var str = StringTools.trim(b.toString()); + if(str.length == 0) { + return true; + } + new com_davidmaletz_faengfl_ui_Popup(128.,52.,-com_davidmaletz_tiles_Tile.SIZE,new com_fancyfish_faeng_common_mutable_Static(str),16777215,-16777216,20,45,20,null,true,true); + return true; + } else { + return false; + } + } + ,__eat: function(item,ct) { + if(this.stats.getInt("full") <= 0 && ct > 0 && item.count >= ct) { + var f = item.item; + var old_h = this.health; + var old_s = this.stamina; + var old_o = this.oxygen; + var fh = f.getHealth(this); + var fs = f.getStamina(this); + var fo = f.getOxygen(this); + var fp = f.getStorage(this); + if(fh > 0) { + this.addHealth(fh * ct); + } + if(fs > 0) { + this.addStamina(fs * ct); + } + if(fo > 0) { + this.addOxygen(fo * ct); + } + var change_storage = false; + if(fp > 0) { + var s = this.getStorage(f.xml.get("eatStorage")); + var old = s.getValue(); + s.addValue(fp * ct); + change_storage = s.getValue() != old; + } + if(this.applyMod(item.item,ct) || this.health != old_h || this.stamina != old_s || this.oxygen != old_o || change_storage) { + if(fh < 0) { + this.loseHealth(-fh * ct,0,null,null,0); + } + if(fs < 0) { + this.loseStamina(-fs * ct); + } + if(fo < 0) { + this.loseOxygen(-fo * ct); + } + if(fp < 0) { + this.getStorage(f.xml.get("eatStorage")).loseValue(-fp * ct); + } + if(this == com_davidmaletz_mining_Main.getLocalPlayer()) { + com_davidmaletz_faengfl_adv_sound_Sound.play(com_davidmaletz_faengfl_adv_sound_Sound.resolve(null,item.item.xml,"eat")); + } + this.inventory.addItems(item.item,-ct,item.value,item.name); + this.onEat(); + return true; + } else { + var c = com_davidmaletz_mining_Main.getContainer(); + var f1 = $bind(this,this.drop); + var a1 = item; + var ct1 = ct; + var tmp = function() { + f1(a1,ct1); + }; + c.addDisplay(new com_davidmaletz_mining_ui_Prompt(c,new com_fancyfish_faeng_common_mutable_Concat2(com_fancyfish_faeng_common_Lang.getText("warning","no_effect"),com_fancyfish_faeng_common_Lang.getText("warning","drop_instead"),"\n"),tmp),3); + return false; + } + } else { + return false; + } + } + ,hotkeys: null + ,itemToHotkey: function(item) { + if(item == null) { + return null; + } else { + var id = item.info.id; + var n = item.getNameStr(); + var i; + var tmp; + if(n != null) { + i = n.indexOf("&"); + tmp = i > 0; + } else { + tmp = false; + } + if(tmp) { + id += "|" + HxOverrides.substr(n,0,i); + } + return id; + } + } + ,projectileCanHurt: function(o) { + if(!com_davidmaletz_mining_Player.PVP) { + return !o.isPlayer(); + } else { + return true; + } + } + ,hotkeyToItem: function(item) { + var i = item.indexOf("|"); + var info; + var name; + if(i == -1) { + info = com_davidmaletz_mining_item_ItemInfo._get(item); + name = null; + } else { + info = com_davidmaletz_mining_item_ItemInfo._get(HxOverrides.substr(item,0,i)); + name = HxOverrides.substr(item,i + 1,null) + "&"; + } + if(info == null) { + return null; + } else { + return info.asItem(0,name); + } + } + ,setHotkey: function(i,item) { + var str = this.itemToHotkey(item); + var len = this.hotkeys.length; + this._setHotkey(i,str); + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var j = _g1++; + if(i != j && this.hotkeys[j] == str) { + this._setHotkey(j,null); + } + } + } + ,_setHotkey: function(i,id) { + if(id != this.hotkeys[i]) { + this.hotkeys[i] = id; + this.dispatchEvent(new com_davidmaletz_faengfl_events_IntEvent("hotkey_changed",i)); + } + } + ,getReplacedSlots: function(item,e) { + if(!this.equipment.canEquip(this,item.xml.get("slot"),item)) { + return e; + } + var _s = this.itemToHotkey(this.equipment.getItemUsed(item.xml.get("slot"))); + if(_s != null && (e == null || e.indexOf(_s) == -1)) { + e = _s + (e == null ? "" : "&" + e); + } + var _g = 0; + var _g1 = item.slots; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + var _s1 = this.itemToHotkey(this.equipment.getItemUsed(s)); + if(_s1 != null && (e == null || e.indexOf(_s1) == -1)) { + e = _s1 + (e == null ? "" : "&" + e); + } + } + return e; + } + ,useHotkey: function(i) { + var str = this.hotkeys[i]; + var _item; + var action; + if(str == null) { + return; + } + if(str.indexOf("&") != -1) { + var ar = str.split("&"); + var e = null; + var _g = 0; + while(_g < ar.length) { + var s = ar[_g]; + ++_g; + var item = this.hotkeyToItem(s); + if(item != null) { + e = this.getReplacedSlots(item.info,e); + _item = this.inventory.selectMaxValue(item.info,item.getNameStr()); + if(_item != null) { + this.equipment.equip(_item,this); + } + } + } + if(e != null && com_davidmaletz_mining_Player.HOTKEY_SWITCH) { + this._setHotkey(i,e); + } + return; + } + var item1 = this.hotkeyToItem(str); + var tmp; + if(item1 != null) { + _item = this.inventory.selectMaxValue(item1.info,item1.getNameStr()); + tmp = _item != null; + } else { + tmp = false; + } + if(tmp) { + if(this.vehicle != null) { + var amt = this.vehicle.getInfo().getRepairAmount(_item.info.id); + var cancel = amt > 0; + if(this.vehicle.getHealthPercent() < 1 && amt > 0 && this.inventory.addItems(_item.info,-1,_item.value,_item.getNameStr())) { + this.vehicle.playSound(this.vehicle.info.xml.exists("repair_sfx") ? this.vehicle.info.xml.get("repair_sfx") : "workshop",false); + this.vehicle.addHealth(amt); + return; + } + var amt1 = this.vehicle.getInfo().getFuelAmount(_item.info.id); + if(!cancel) { + cancel = amt1 > 0; + } else { + cancel = true; + } + if(!this.vehicle.isPowered() && this.vehicle.getFuelPercent() < 1 && amt1 > 0 && this.inventory.addItems(_item.info,-1,_item.value,_item.getNameStr())) { + this.vehicle.playFuelSFX(); + this.vehicle.addFuel(amt1); + return; + } + if(cancel) { + return; + } + } + action = _item.info.getFirstAction(this,_item.value,_item.getNameStr()); + if(action != null) { + var s1 = null; + var e1 = null; + if(action.getId() == "equip") { + s1 = _item.info.xml.get("slot"); + var _s = this.equipment.get(s1); + var eq = null; + if(_s != null) { + eq = _s.get(); + } + e1 = this.getReplacedSlots(_item.info,e1); + } + action["use"](); + if(e1 != null && com_davidmaletz_mining_Player.HOTKEY_SWITCH) { + this._setHotkey(i,e1); + } + return; + } + } + } + ,getHotkey: function(i) { + var str = this.hotkeys[i]; + if(str == null) { + return null; + } + var ar = str.split("&"); + var ret = []; + var _g = 0; + while(_g < ar.length) { + var s = ar[_g]; + ++_g; + var i1 = this.hotkeyToItem(s); + if(i1 != null) { + ret.push(i1); + } + } + return ret; + } + ,abilities: null + ,setAbility: function(a) { + if(this.abilities == null) { + this.abilities = new haxe_ds_IntMap(); + } + this.abilities.set(a.hotkey,a); + if(this.gui != null) { + this.gui.updateHotkeys(); + } + } + ,removeAbility: function(a) { + if(this.abilities != null && this.abilities.get(a.hotkey) == a) { + this.abilities.remove(a.hotkey); + } + if(this.gui != null) { + this.gui.updateHotkeys(); + } + } + ,getAbility: function(i) { + if(this.abilities == null) { + return null; + } else { + return this.abilities.get(i); + } + } + ,_getEquipment: function() { + return new com_fancyfish_faeng_common_DoubleIterator(this.equipment.getEquipment(com_davidmaletz_mining_Player.isEquip),new com_davidmaletz_mining_item_SelectItemIterator(this.inventory.getItems(com_davidmaletz_mining_Player.isEquip),this.inventory)); + } + ,hasVanity: function(info,slot) { + if(this.vanity.getItemUsed(slot) != null) { + return true; + } else { + var _g = 0; + var _g1 = info.slots; + while(_g < _g1.length) { + var id = _g1[_g]; + ++_g; + if(this.vanity.getItemUsed(id) != null) { + return true; + } + } + } + return false; + } + ,getLightRange: function() { + return this.getInfo().sight + this.stats.getInt("sight"); + } + ,increaseValue: function(item,d) { + com_davidmaletz_mining_Player._increaseValue(this,item,d); + } + ,canMineTile: function(eq,tile,x,y,mine_cost) { + if(this.getStorageValue(eq.storageType) >= eq.storageCost) { + return true; + } else { + this.showWarning(com_fancyfish_faeng_common_Lang.getText("warning",eq.storageType)); + return false; + } + } + ,mineTile: function(tool,tile,x,y,item,mine_cost) { + if(item != null) { + if(this.area == null || this.area.renderer == null) { + this.addItems(item.item,item.count); + } else { + com_davidmaletz_mining_renderer_CollectLoot.collect(new com_fancyfish_faeng_common_SingleIterator(item),this.area.renderer,com_davidmaletz_tiles_Tile.SIZE * x,(y + 0.5) * com_davidmaletz_tiles_Tile.SIZE); + } + } + ++mine_cost; + this.increaseValue(tool,com_davidmaletz_mining_item_Equipment.modifyEfficiency(mine_cost,tool.getNameStr())); + var eq = js_Boot.__cast(tool.info , com_davidmaletz_mining_item_Equipment); + if(eq.storageCost > 0) { + this.loseStorage(eq.storageType,com_davidmaletz_mining_item_Equipment.modifyEfficiency(eq.storageCost * mine_cost,tool.getNameStr())); + } + var s = eq.getStamina(this); + if(eq.xml.get("scaleCost") != "false") { + s *= mine_cost; + } + this.loseStamina(com_davidmaletz_mining_item_Equipment.modifyEfficiency(s,tool.getNameStr())); + this.addExp(mine_cost); + } + ,checkUnderwater: function(tool,underwater) { + if(underwater) { + var slot = tool.xml.get("slot"); + if(slot == "weapon" || slot == "shield") { + return tool.xml.get("underwater") == "true"; + } else { + return tool.xml.get("underwater") != "false"; + } + } else { + return true; + } + } + ,getUseItem: function(item,warn) { + if(item == null) { + return null; + } + var $use = com_davidmaletz_mining_item_ItemInfo.get(com_davidmaletz_mining_item_ItemInfo.getParameter(item.getNameStr(),"u")); + if($use != null) { + var ret; + if(this.equipment.isEquipped($use)) { + ret = this.equipment.getItem($use.xml.get("slot")); + } else { + ret = this.inventory.selectItem($use,0,null); + } + if(warn && ret == null) { + var map = new haxe_ds_StringMap(); + map.set("{weapon}",item.info.getDisplay(item.getNameStr())); + map.set("{item}",$use.getDisplay(null)); + this.showWarning(new com_fancyfish_faeng_common_mutable_MutableTemplateStatic(com_fancyfish_faeng_common_Lang.getText("warning","use_missing"),map)); + } + return ret; + } else { + return item; + } + } + ,showArms: function() { + var u = this.isUnderwater(); + if(this.info.xml.get("alwaysShowArms") == "true") { + var ret = 1; + var e = this.equipment.getItemUsed("weapon"); + if(e != null && (!u || e.info.xml.get("underwater") == "true" || e.info.xml.get("unequip") == "false")) { + if(e.info.xml.get("hideArms") == "true") { + return 0; + } + if(u) { + ret = 2; + } + } + var e1 = this.equipment.getItemUsed("shield"); + if(e1 != null && (!u || e1.info.xml.get("underwater") == "true" || e1.info.xml.get("unequip") == "false")) { + if(e1.info.xml.get("hideArms") == "true") { + return 0; + } + if(u) { + ret = 2; + } + } + return ret; + } + if(!u) { + if(this.equipment.isEmpty("weapon") && this.equipment.isEmpty("shield")) { + return 1; + } else { + return 0; + } + } else { + var e2 = this.equipment.getItemUsed("weapon"); + if(e2 != null && (e2.info.xml.get("underwater") == "true" || e2.info.xml.get("unequip") == "false")) { + return 0; + } + var e3 = this.equipment.getItemUsed("shield"); + if(e3 != null && (e3.info.xml.get("underwater") == "true" || e3.info.xml.get("unequip") == "false")) { + return 0; + } + return 1; + } + } + ,isVisible: function(tool,underwater) { + if(tool.xml.get("unequip") != "false") { + return this.checkUnderwater(tool,underwater); + } else { + return true; + } + } + ,canUseEquipment: function(i,checkProjectile) { + if(checkProjectile == null) { + checkProjectile = true; + } + if(i.getDurability() > 0 && i.getFeed() <= 0 || !Std["is"](i.info,com_davidmaletz_mining_item_Equipment) || !this.checkUnderwater(i.info,this.isUnderwater())) { + return false; + } + var tool = js_Boot.__cast(i.info , com_davidmaletz_mining_item_Equipment); + if(checkProjectile) { + var projectile = com_davidmaletz_mining_item_ItemInfo.get(tool.xml.get("projectile")); + if(projectile != null && this.inventory.getItemCount(projectile) == 0) { + return false; + } + } + return this.getStorageValue(tool.storageType) >= tool.storageCost; + } + ,warning: null + ,showWarning: function(m) { + if(this.warning != null && this.warning.stage != null || this != com_davidmaletz_mining_Main.getLocalPlayer()) { + return null; + } + this.warning = new com_davidmaletz_faengfl_ui_Popup(128.,52.,0,m,16720418,-16777216,20,60,20,null,true,true); + return this.warning; + } + ,noEquip: function(tool) { + var map = new haxe_ds_StringMap(); + map.set("{item}",tool.info.getDisplay(tool.getNameStr())); + this.showWarning(new com_fancyfish_faeng_common_mutable_MutableTemplateStatic(com_fancyfish_faeng_common_Lang.getText("warning","no_equip"),map)); + } + ,useEquipment: function(tool,projectile,trueItem) { + var _gthis = this; + if(trueItem == null) { + trueItem = tool; + } + if(!this.equipment.isEquipped(trueItem.info) && !this.equipment.canEquip(this,trueItem.info.xml.get("slot"),trueItem.info)) { + this.noEquip(trueItem); + return false; + } + var d = tool.info.getDurability(); + if(d > 0 && tool.value > 0 && tool.value >= d) { + var m = com_fancyfish_faeng_common_Lang.getTextFromTitle(tool.info.xml.get("durabilityWarning")); + if(m != null) { + this.showWarning(m); + } + return false; + } + if(projectile == null) { + projectile = tool.getDefaultProjectile(); + } + if(projectile != null && !this.inventory.addItems(projectile,-1)) { + var map = new haxe_ds_StringMap(); + map.set("{weapon}",tool.info.getDisplay(tool.getNameStr())); + map.set("{projectile}",projectile.getDisplay(null)); + this.showWarning(new com_fancyfish_faeng_common_mutable_MutableTemplateStatic(com_fancyfish_faeng_common_Lang.getText("warning","no_projectiles"),map)); + return false; + } + var vars = null; + var _getVars = function() { + if(vars == null) { + vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(_gthis); + } + return vars; + }; + var e = tool.info.xml.elementsNamed("canAttack"); + while(e.hasNext()) { + var e1 = e.next(); + if(e1.exists("enabled") && com_davidmaletz_faengfl_EventHandler.execute(e1.get("enabled"),_getVars()) != true) { + var m1 = com_fancyfish_faeng_common_Lang.getTextFromTitle(e1.get("fail")); + if(m1 != null) { + this.showWarning(m1); + } + return false; + } + } + var eq = js_Boot.__cast(tool.info , com_davidmaletz_mining_item_Equipment); + var storage = com_davidmaletz_mining_item_Equipment.modifyEfficiency(eq.storageCost,tool.getNameStr()); + if(this.getStorageValue(eq.storageType) < storage) { + this.showWarning(com_fancyfish_faeng_common_Lang.getText("warning",eq.storageType)); + return false; + } + if(storage > 0) { + this.loseStorage(eq.storageType,storage); + } + var stamina = com_davidmaletz_mining_item_Equipment.modifyEfficiency(eq.getStamina(this),tool.getNameStr()); + if(trueItem.info.xml.exists("staminaToStorage")) { + stamina = Math.round(stamina * com_davidmaletz_mining_Main.parseFloat(trueItem.info.xml.get("staminaToStorage"))); + var trueEq = js_Boot.__cast(trueItem.info , com_davidmaletz_mining_item_Equipment); + if(this.getStorageValue(trueEq.storageType) < stamina) { + this.showWarning(com_fancyfish_faeng_common_Lang.getText("warning",trueEq.storageType)); + return false; + } + if(stamina > 0) { + this.loseStorage(trueEq.storageType,stamina); + } + } else { + this.loseStamina(stamina); + } + com_davidmaletz_faengfl_adv_sound_Sound.play(com_davidmaletz_faengfl_adv_sound_Sound.resolveDefault(tool.info.xml,"swing")); + tool.info.runEvent("use",this,tool); + return true; + } + ,addAttackExp: function(o,dmg,def) { + var e = dmg * (def + 1); + if(e < 0) { + e = 1; + } + if(e > 0) { + this.addExp(e); + } + } + ,miss: function(tool) { + this.showPopup(true,com_fancyfish_faeng_common_Lang.getText("common","miss"),-com_davidmaletz_tiles_Tile.SIZE); + } + ,getEvasion: function() { + return this.stats.getInt("evasion"); + } + ,canPump: function() { + if(this._pump != null) { + return this._pump.pump.canRun(this,this._pump.xml.get("slot")); + } else { + return false; + } + } + ,doPump: function() { + var slot = this._pump.xml.get("slot"); + this._pump.pump.run(this,slot); + return slot; + } + ,isPlayer: function(local) { + if(local == null) { + local = false; + } + if(!(!local)) { + return com_davidmaletz_mining_Main.getLocalPlayer() == this; + } else { + return true; + } + } + ,projectileKillCollect: function() { + return true; + } + ,structure: null + ,object: null + ,notPerson: function(o,layer) { + if(o.get_alpha() > 0 && layer != 3) { + return o.attackPower(1,1,1,null,true) <= 0; + } else { + return false; + } + } + ,inRange: function(o) { + var b = this._getBounds(com_davidmaletz_mining_world_Object.rectangle); + var range = 0.75; + var s = this.getFacing(); + b.width -= 8; + b.x -= s * com_davidmaletz_tiles_Tile.SIZE * range - 4; + return this.area.intersectsLoop(o.getHitbox(),b,0.5); + } + ,isPerson: function(o,layer) { + if(o.get_alpha() > 0) { + if(!(layer == 3 || Std["is"](o,com_davidmaletz_mining_Player) || o.attackPower(1,1,1,null,true) > 0 && this.inRange(o) || o.info.xml.nodeName() == "vehicle")) { + return o.info.xml.nodeName() == "npc"; + } else { + return true; + } + } else { + return false; + } + } + ,getMeleeWeapon: function(o) { + if(!this.equipment.canChangeSlot("weapon")) { + var i = this.equipment.getItem("weapon"); + var e = com_davidmaletz_mining_Player.asEquipment(i); + var n = i == null ? null : i.getNameStr(); + if(e != null && e.getRange(n) == 0 && this.canUseEquipment(i) && com_davidmaletz_mining_Player.getSortAttackPower(o,e.getAttack(n),e.getCut(n),e.getSpirit(n),i.getElement(),true,n) > 0) { + return i; + } else { + return null; + } + } + var best = null; + var bestPower = 0; + var e1 = this._getEquipment(); + while(e1.hasNext()) { + var e2 = e1.next(); + var w = js_Boot.__cast(e2.info , com_davidmaletz_mining_item_Equipment); + if(w.getRange(e2.getNameStr()) == 0 && w.xml.get("slot") == "weapon" && w.canEquip() && this.canUseEquipment(e2)) { + var n1 = e2.getNameStr(); + var p = com_davidmaletz_mining_Player.getSortAttackPower(o,w.getAttack(n1),w.getCut(n1),w.getSpirit(n1),e2.getElement(),true,n1); + if(w.hasDecay()) { + p /= 32; + } + if(p > bestPower) { + best = e2; + bestPower = p; + } + } + } + return best; + } + ,getFishingRod: function() { + if(!this.equipment.canChangeSlot("weapon")) { + var e = this.equipment.getItem("weapon"); + if(e != null && Std["is"](e.info,com_davidmaletz_mining_item_Equipment) && (js_Boot.__cast(e.info , com_davidmaletz_mining_item_Equipment)).getFishing(e.getNameStr()) > 0) { + return e; + } else { + return null; + } + } + var ret = null; + var best = null; + var besti = 0; + var e1 = this._getEquipment(); + while(e1.hasNext()) { + var e2 = e1.next(); + var w = js_Boot.__cast(e2.info , com_davidmaletz_mining_item_Equipment); + var f = w.getFishing(e2.getNameStr()); + if(f > 0 && w.xml.get("slot") == "weapon" && (best == null || f > besti) && this.canUseEquipment(e2)) { + best = w; + besti = f; + ret = e2; + } + } + return ret; + } + ,getPickaxe: function() { + if(!this.equipment.canChangeSlot("pickaxe")) { + var e = this.equipment.getItemUsed("pickaxe"); + if(e != null && Std["is"](e.info,com_davidmaletz_mining_item_Equipment) && (js_Boot.__cast(e.info , com_davidmaletz_mining_item_Equipment)).getMine(e.getNameStr()) > 0) { + return e; + } else { + return null; + } + } + var ret = null; + var best = null; + var besti = 0; + var e1 = this._getEquipment(); + while(e1.hasNext()) { + var e2 = e1.next(); + var w = js_Boot.__cast(e2.info , com_davidmaletz_mining_item_Equipment); + var f = w.getMine(e2.getNameStr()); + if(f > 0 && w.xml.get("slot") == "pickaxe" && (best == null || f > besti)) { + best = w; + besti = f; + ret = e2; + } + } + return ret; + } + ,__updatePos: function() { + } + ,set_vehicle: function(v) { + if(v != this.vehicle) { + this.vehicle = v; + this.__updatePos(); + this.dispatchEvent(new openfl_events_Event("mount")); + } + return v; + } + ,attackPower: function(attack,cut,spirit,element,player) { + if(!com_davidmaletz_mining_Player.PVP && player) { + return 0; + } else { + return attack; + } + } + ,getActionObject: function(hideEquip) { + if(hideEquip == null) { + hideEquip = true; + } + if(this.area == null || hideEquip && this.renderer != null && (js_Boot.__cast(this.renderer , com_davidmaletz_mining_renderer_PlayerRendererBase)).equipComplete != null) { + return null; + } + var underwater = this.isUnderwater(); + var dx = this.renderer == null ? 1 : -com_fancyfish_faeng_common_Utils.sign(this.renderer.get_scaleX()); + if(this.renderer != null && underwater && !this.area.isWater(this.get_tile_x(),this.get_tile_y() - 1) && !this.area.isWater(this.get_tile_x() + dx,this.get_tile_y() - 1) && this.area.getTileId(this.get_tile_x(),this.get_tile_y() - 1,0) == -1 && this.area.getTileId(this.get_tile_x() + dx,this.get_tile_y() - 1,0) == -1 && this.area.getTileId(this.get_tile_x() + dx,this.get_tile_y(),0) != -1 && this.canEnterTile(this.get_tile_x() + dx,this.get_tile_y() - 1)) { + return com_davidmaletz_mining_Player.WATER_EXIT; + } + var fishing = this.getFishingRod() != null && this.renderer != null && this.area.isFishable(this.get_tile_x() - com_fancyfish_faeng_common_Utils.sign(this.renderer.get_scaleX()),this.get_tile_y()) == 1; + var b = this.getBounds(); + if(this.renderer != null) { + var range = 0.75; + var facing = com_fancyfish_faeng_common_Utils.sign(this.renderer.get_scaleX()) * com_davidmaletz_tiles_Tile.SIZE * range; + b.x -= facing; + var _g = b; + _g.set_top(_g.get_top() - 1); + if(facing < 0) { + var _g1 = b; + _g1.set_left(_g1.get_left() + facing * 0.5); + } else { + var _g2 = b; + _g2.set_right(_g2.get_right() + facing * 0.5); + } + var o = this.area.getActionObject(b,this,$bind(this,this.isPerson)); + b = this.getBounds(); + if(o != null) { + if(!com_davidmaletz_mining_Player.TALK_QUEST && !o.hasPriority(this,false)) { + var t = this.area.getActionObject(b,this,$bind(this,this.notPerson)); + if(t != null && t.hasPriority(this,false)) { + o = t; + } + } + if(Std["is"](o,com_davidmaletz_mining_npc_NPC) && this.area.getTileId(o.get_tile_x(),o.get_tile_y(),3) == -1 && fishing && !underwater) { + return com_davidmaletz_mining_Player.FISHING_SPOT; + } else { + return o; + } + } + } + var o1 = this.area.getActionObject(b,this,$bind(this,this.notPerson)); + if(o1 == null && fishing && !underwater) { + return com_davidmaletz_mining_Player.FISHING_SPOT; + } else { + return o1; + } + } + ,inAreaBoundsDismount: function(area,b) { + b = b.clone(); + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + var v = this.vehicle; + if(this.vehicle != null && this.vehicle.isDrone() && this.vehicle.droneArea == area && b.contains(this.vehicle.droneX + 8,this.vehicle.droneY + 8)) { + this.vehicle.doDismount(true); + if(v.area == area && v.intersects(b,0)) { + area.removeObject(v); + } + } + var o = this.vehicle == null ? this : this.vehicle; + if(o.area == area && o.intersects(b,0)) { + if(this.vehicle != null) { + this.vehicle.doDismount(true); + area.removeObject(v); + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + return true; + } else { + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + return false; + } + } + ,canSummonFamiliar: function() { + var a = this.getCurrentArea(); + if(a != null) { + return a.renderer != null; + } else { + return false; + } + } + ,summonFamiliar: function() { + this.familiar.summon(); + } + ,overObjects: null + ,overStructure: null + ,getCurrentStructure: function(incVehicle) { + if(incVehicle == null) { + incVehicle = false; + } + var o = this.vehicle != null && incVehicle ? this.vehicle : this; + if(o.area == null) { + return null; + } else { + return o.area.getStructure(o.getBounds()); + } + } + ,onPositionChanged: function() { + var _gthis = this; + if(this.area == null) { + if(this.vehicle == null) { + this.clearOverlap(); + } + return; + } + var s = this.getCurrentStructure(); + if(this == com_davidmaletz_mining_Main.getLocalPlayer()) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + var o = this.getActionObject(); + this.onOverlap(this.getCurrentStructure(),o); + if(this.overStructure != s) { + if(this.overStructure != null) { + this.overStructure.onOut(this); + } + this.overStructure = s; + if(s != null) { + s.onOver(this); + } + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + this._objectOverlapCheck(); + } else { + var ar = []; + var b = this.getBounds(); + this.area.getObjects(b,function(o1,rect) { + if(o1.info.xml.get("overlapNPC") == "true") { + ar.push(o1); + if(_gthis.overObjects.indexOf(o1) == -1) { + o1.onOver(com_davidmaletz_mining_Main.getLocalPlayer()); + if(_gthis.area == null) { + return true; + } + } + } + return false; + }); + var _g = 0; + var _g1 = this.overObjects; + while(_g < _g1.length) { + var o2 = _g1[_g]; + ++_g; + if(ar.indexOf(o2) == -1) { + o2.onOut(com_davidmaletz_mining_Main.getLocalPlayer()); + } + } + this.overObjects = ar; + } + if(s != null && s.info.playerY != 0 && s.yPos == this.yTile) { + this._offsetY = s.info.playerY; + } else { + this._offsetY = 0; + } + } + ,_objectOverlapCheck: function() { + var _gthis = this; + if(this != com_davidmaletz_mining_Main.getLocalPlayer()) { + return; + } + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + var ar = []; + var b = this.getBounds(); + this.area.getObjects(b,function(o,rect) { + if(o.getHitbox(false).intersects(rect)) { + ar.push(o); + if(_gthis.overObjects.indexOf(o) == -1) { + o.onOver(_gthis); + } + } + return false; + }); + var _g = 0; + var _g1 = this.overObjects; + while(_g < _g1.length) { + var o1 = _g1[_g]; + ++_g; + if(ar.indexOf(o1) == -1) { + o1.onOut(this); + } + } + this.overObjects = ar; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + ,objectOverlapCheck: function() { + if(this.area != null && this == com_davidmaletz_mining_Main.getLocalPlayer()) { + var o = this.getActionObject(); + if(o != this.object) { + this.onOverlap(this.getCurrentStructure(),o); + } + this._objectOverlapCheck(); + } + } + ,canJumpIntoWater: function() { + if(this.info.xml.get("canJumpIntoWater") != "false") { + return this.getFlag("jump_water"); + } else { + return false; + } + } + ,checkAreaForNPC: function(area,id) { + var o = area.getAllObjects(); + while(o.hasNext()) { + var o1 = o.next(); + if(o1.getId() == id) { + return o1; + } else if(Std["is"](o1,com_davidmaletz_mining_world_RideableObject)) { + var a = (js_Boot.__cast(o1 , com_davidmaletz_mining_world_RideableObject)).interior; + if(a != null && a != this.area) { + var ret = this.checkAreaForNPC(a,id); + if(ret != null) { + return ret; + } + } + } + } + return null; + } + ,getNPC: function(id) { + if(this.area != null) { + var o = this.checkAreaForNPC(this.area,id); + if(o != null) { + return o; + } + } + var a = this.areas.iterator(); + while(a.hasNext()) { + var a1 = a.next(); + if(a1 != this.area) { + var o1 = this.checkAreaForNPC(a1,id); + if(o1 != null) { + return o1; + } + } + } + return null; + } + ,checkAreaForObjects: function(area,func,acceptArea) { + if(acceptArea != null) { + if(!acceptArea(area)) { + return; + } + } + var o = area.getAllObjects(); + while(o.hasNext()) { + var o1 = o.next(); + func(o1); + if(Std["is"](o1,com_davidmaletz_mining_world_RideableObject)) { + var a = (js_Boot.__cast(o1 , com_davidmaletz_mining_world_RideableObject)).interior; + if(a != null && a != this.area) { + this.checkAreaForObjects(a,func,acceptArea); + } + } + } + } + ,getAllObjects: function(func,acceptArea) { + if(this.area != null) { + this.checkAreaForObjects(this.area,func,acceptArea); + } + var a = this.areas.iterator(); + while(a.hasNext()) { + var a1 = a.next(); + if(a1 != this.area) { + this.checkAreaForObjects(a1,func,acceptArea); + } + } + } + ,overlapChanged: function() { + this.onPositionChanged(); + } + ,clearOverlap: function() { + this.onOverlap(null,null); + if(this.vehicle != null) { + this.vehicle.hideTooltip(); + } + } + ,onOverlap: function(s,o) { + if(this != com_davidmaletz_mining_Main.getLocalPlayer()) { + return; + } + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + if(o != null && s != null && !o.hasPriority(this,true) && s.getTooltip(this) != null) { + o = null; + } + if(o != null) { + s = null; + } + if(o != this.object) { + if(this.object != null) { + this.object.onExit(this); + this.object = null; + } + if(o != null) { + if(this.structure != null) { + this.structure.onExit(this); + this.structure = null; + } + this.object = o; + this.object.onEnter(this); + } + } + if(s != this.structure) { + if(this.structure != null) { + this.structure.onExit(this); + this.structure = null; + } + if(s != null) { + if(this.object != null) { + this.object.onExit(this); + this.object = null; + } + this.structure = s; + s.onEnter(this); + } + } else if(this.structure != null) { + this.structure.updateTooltip(this); + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + ,addItems: function(item,count,value,name,sfx,storehouse) { + if(storehouse == null) { + storehouse = false; + } + if(sfx == null) { + sfx = true; + } + if(value == null) { + value = 0; + } + if(count == null) { + count = 1; + } + if(item.id == null) { + return null; + } + if(count > 0) { + this.checkSeenItem(item); + } + (storehouse ? this.storehouseInventory : this.getCurrentInventory()).addItems(item,count,value,name); + if(this == com_davidmaletz_mining_Main.getLocalPlayer()) { + var p = this.itemPopup(item,count,name,sfx); + if(this.vehicle == null || this.vehicle.isDrone()) { + this.weightCheck(); + } + return p; + } else { + return null; + } + } + ,itemPopup: function(item,count,name,sfx) { + if(sfx == null) { + sfx = true; + } + if(count == null) { + count = 1; + } + if(this == com_davidmaletz_mining_Main.getLocalPlayer()) { + var p = new com_davidmaletz_mining_ui_ItemPopup(name == null ? item : new com_davidmaletz_mining_item_Item(item,0,name),count); + if(sfx) { + com_davidmaletz_faengfl_adv_sound_Sound.play("item"); + } + return p; + } else { + return null; + } + } + ,addLoot: function(loot) { + if(loot == null) { + return; + } + var ar = []; + var i = loot; + while(i.hasNext()) { + var i1 = i.next(); + ar.push(i1); + } + this.addMultiItems(ar); + } + ,_addMultipleItems: function(items) { + var ar = []; + var len = items.length >> 1; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + var item = com_davidmaletz_mining_item_ItemInfo.get(items[2 * i]); + if(item != null) { + ar.push(new com_davidmaletz_mining_item_ItemCt(item,items[2 * i + 1])); + } + } + if(ar.length == 0) { + return null; + } else { + return this.addMultiItems(ar); + } + } + ,addMultiItems: function(item,sfx) { + if(sfx == null) { + sfx = true; + } + var inv = this.getCurrentInventory(); + var _g = 0; + while(_g < item.length) { + var i = item[_g]; + ++_g; + inv.addItems(i.item,i.count); + } + if(this == com_davidmaletz_mining_Main.getLocalPlayer()) { + var p = this.multiItemPopup(item,sfx); + if(this.vehicle == null || this.vehicle.isDrone()) { + this.weightCheck(); + } + return p; + } else { + return null; + } + } + ,multiItemPopup: function(item,sfx) { + if(sfx == null) { + sfx = true; + } + if(this == com_davidmaletz_mining_Main.getLocalPlayer()) { + var p = com_davidmaletz_mining_ui_MultiItemPopup.show(HxOverrides.iter(item),item.length); + if(sfx) { + com_davidmaletz_faengfl_adv_sound_Sound.play("item"); + } + return p; + } else { + return null; + } + } + ,addMultipleItems: null + ,weightCheck: function(wt) { + if(wt == null) { + wt = 0; + } + if(this == com_davidmaletz_mining_Main.getLocalPlayer() && this.inventory.getWeight() + wt > this.capacity.get()) { + new com_davidmaletz_faengfl_ui_Popup(128.,52.,0,com_fancyfish_faeng_common_Lang.getText("warning","weight"),16720418); + if(this.renderer != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_renderer_PlayerObjectRenderer)).flash(16750899,30); + } + } + } + ,getOverweight: function(wt) { + if(wt == null) { + wt = 0; + } + return com_fancyfish_faeng_common_Utils.max(0,this.inventory.getWeight() + wt - this.capacity.get()); + } + ,getQuestCount: function(incComplete) { + return this.state.getQuestCount(incComplete); + } + ,getQuests: function() { + return this.state.getQuests(); + } + ,getCompleteQuests: function() { + return this.state.getCompleteQuests(); + } + ,hasQuest: function(id) { + return this.state.hasQuest(id); + } + ,questComplete: function(id) { + return this.state.questComplete(id); + } + ,canCompleteQuest: function(id,inv) { + return this.state.canCompleteQuest(this,id,inv); + } + ,questRequirementsMet: function(id,inv) { + var q = com_davidmaletz_mining_npc_Quest.get(id); + if(q == null || this.getCoins() < q.coins) { + return false; + } + var r = q.getRequirements(); + while(r.hasNext()) { + var r1 = r.next(); + if(!r1.isMet(this,inv)) { + return false; + } + } + return true; + } + ,addQuest: function(q) { + this.state.addQuest(q); + return; + } + ,removeQuest: function(id) { + this.state.removeQuest(id); + } + ,removeQuestsByGiver: function(giver) { + this.state.removeQuestsByGiver(giver); + } + ,completeQuest: function(q,useResources,inv,reserve) { + if(reserve == null) { + reserve = 0; + } + if(useResources == null) { + useResources = true; + } + return this.state.completeQuest(this,q,useResources,inv,reserve); + } + ,levelFromExperience: function(e) { + return Math.floor(Math.min(this.getInfo().maxLevel,Math.max(0,Math.log((e + 0.99999 + 40) / 40) / Math.log(1.5)))); + } + ,doMove: function(doJump,o) { + var f = this._flight; + if(this.vehicle == null && f != null && com_davidmaletz_tiles_TileAnimation.exists(f.getEquipAnim(null,"ftl") + ".disengage")) { + this.playAnimVehicle("ftl.disengage"); + } else if(doJump == null) { + this.playAnimVehicle("fly"); + } + com_davidmaletz_mining_renderer_Parallax.setOrbitalAlpha(1); + if(doJump != null) { + doJump(); + } + var modal = new com_davidmaletz_faengfl_transition_LerpModal(o.renderer,null,true,null,false,true); + o.moveTo(o.xPos,0,0.0078125,function() { + modal.kill(null); + }); + } + ,doMoveFade: function(doJump,o) { + var f = $bind(this,this.doMove); + var a1 = doJump; + var o1 = o; + new com_davidmaletz_faengfl_transition_FadeOut(function() { + f(a1,o1); + },15); + } + ,playAnimVehicle: function(anim) { + if(this.vehicle == null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_renderer_PlayerRendererBase)).setAnimation(anim); + } else { + (js_Boot.__cast(this.vehicle.renderer , com_davidmaletz_mining_world_vehicle_VehicleRenderer)).playAnimation(this.vehicle.getAnim(anim),true); + } + } + ,ftlAnimEnd: function(doJump,o) { + doJump(); + com_davidmaletz_mining_renderer_Parallax.setOrbitalAlpha(0); + var f = $bind(this,this.doMove); + var o1 = o; + var tmp = function() { + f(null,o1); + }; + new com_davidmaletz_faengfl_transition_ModalAnimation(com_davidmaletz_tiles_Tile.get("ftl"),"ftl.disengage",10,tmp,(this.vehicle == null ? this : this.vehicle).renderer); + } + ,ftlAnim: function(doJump,o) { + com_davidmaletz_mining_renderer_Parallax.setOrbitalAlpha(0); + if(this == com_davidmaletz_mining_Main.getLocalPlayer()) { + com_davidmaletz_faengfl_adv_sound_Sound.play("ftl_jump"); + } + this.playAnimVehicle("ftl"); + var f = $bind(this,this.ftlAnimEnd); + var a1 = doJump; + var o1 = o; + var tmp = function() { + f(a1,o1); + }; + new com_davidmaletz_faengfl_transition_ModalAnimation(com_davidmaletz_tiles_Tile.get("ftl"),"ftl.engage",10,tmp,(this.vehicle == null ? this : this.vehicle).renderer); + } + ,onJump: function(p,doJump) { + var a = this.getCurrentArea(); + var o = this.vehicle == null ? this : this.vehicle; + var f = this.getFlight(); + if(p.system != a.planet.system && this.vehicle != null && com_davidmaletz_tiles_TileAnimation.exists(this.vehicle.getAnim("ftl.engage"))) { + this.playAnimVehicle("ftl.engage"); + } else if(this.vehicle == null && f != null && com_davidmaletz_tiles_TileAnimation.exists(f.getEquipAnim(null,"ftl") + ".engage")) { + this.playAnimVehicle("ftl.engage"); + } else { + this.playAnimVehicle("fly"); + } + var modal = new com_davidmaletz_faengfl_transition_LerpModal(o.renderer,null,true,null,false,true); + var func; + if(p.system == a.planet.system || !com_davidmaletz_mining_Main.ALLOW_FLASH) { + var f1 = $bind(this,this.doMoveFade); + var a1 = doJump; + var o1 = o; + func = function() { + f1(a1,o1); + }; + } else { + var f2 = $bind(this,this.ftlAnim); + var a11 = doJump; + var o2 = o; + func = function() { + f2(a11,o2); + }; + } + o.moveTo(o.xPos,-8192,0.0078125,function() { + modal.kill(null); + func(); + }); + } + ,teleport: function(loc,x,y,allowReturn) { + if(allowReturn == null) { + allowReturn = false; + } + if(y == null) { + y = -1; + } + this.doTeleport(loc,x * com_davidmaletz_tiles_Tile.SIZE,y * com_davidmaletz_tiles_Tile.SIZE,allowReturn); + } + ,teleportTo: function(area,x,y) { + this.doTeleport(area.id,x,y,false,area); + } + ,doTeleport: function(loc,x,y,allowReturn,_area,fireEvent) { + if(fireEvent == null) { + fireEvent = true; + } + if(this.health <= 0) { + return; + } + if(_area == null && com_davidmaletz_mining_world_Area.getXML(loc) == null) { + haxe_Log.trace("Cannot teleport! Area not defined!",{ fileName : "Player.hx", lineNumber : 1389, className : "com.davidmaletz.mining.Player", methodName : "doTeleport"}); + return; + } + var scale = com_davidmaletz_mining_Main.getGameScale(); + if(allowReturn) { + if(this.prevLocation != null) { + haxe_Log.trace("Nested teleports not yet allowed!",{ fileName : "Player.hx", lineNumber : 1392, className : "com.davidmaletz.mining.Player", methodName : "doTeleport"}); + return; + } + this.prevLocation = this.location; + this.prevX = this.xPos; + this.prevY = this.yTile; + } + var ca = this.getCurrentArea(); + if(ca != null && (_area == ca || _area == null && loc == ca.id)) { + if(this.vehicle != null) { + this.vehicle.setPosition(x,y,true); + var r = this.vehicle.renderer; + if(r != null) { + (js_Boot.__cast(r , com_davidmaletz_mining_world_vehicle_VehicleRenderer)).updateScroll(true); + } + } else { + this.setPosition(x,y,true); + this.overlapChanged(); + if(this.renderer != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_renderer_PlayerObjectRenderer)).teleport(); + } + } + return; + } + if(ca != null) { + this.equipment.destroy(this,false); + if(this.vehicle != null) { + this.vehicle.equipment.destroy(this.vehicle,false); + } + } + if(this.area != null) { + if(this.area.vehicle != null) { + this.area.vehicle.runEvent(this,"playerLeaveInterior"); + } + com_davidmaletz_mining_world_Generate.runAction("onLeave",this.area.renderer,this,81,this.area); + this.area.removeObject(this); + } + var old = this.renderer; + this.renderer = null; + var oldv = null; + if(this.vehicle != null) { + oldv = this.vehicle.renderer; + this.vehicle.renderer = null; + } + if(loc == null) { + loc = _area.id; + } + this.location = loc; + this.setPosition(x,y,true); + if(_area == null) { + _area = this.areas.get(this.location); + } + if(_area == null) { + return; + } + this.__location_id = _area.__id; + com_davidmaletz_mining_Main.setArea(scale,_area,81,oldv); + if(this.area != null && this.area.clearReturn()) { + this.prevLocation = null; + } + if(old != null && this.renderer != null) { + this.renderer.set_scaleX(old.get_scaleX()); + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_renderer_PlayerRendererBase)).setAnimation((js_Boot.__cast(old , com_davidmaletz_mining_renderer_PlayerRendererBase)).anim_id); + } + if(oldv != null && this.vehicle != null && this.vehicle.renderer != null) { + this.vehicle.renderer.set_scaleX(oldv.get_scaleX()); + var r1 = js_Boot.__cast(this.vehicle.renderer , com_davidmaletz_mining_world_vehicle_VehicleRenderer); + r1.playIdle(r1); + this.vehicle.onFlip(); + this.vehicle.moveToFront(); + r1.updateScroll(true); + this.equipment.init(this); + this.vehicle.equipment.init(this.vehicle); + } + if(fireEvent) { + this.dispatchEvent(new openfl_events_Event("teleport")); + } + } + ,isUnderwater: function() { + var o = this.vehicle == null ? this : this.vehicle; + var a = this.getCurrentArea(); + if(a != null) { + return a.isWater(o.get_tile_x(),o.get_tile_y()); + } else { + return false; + } + } + ,inTempArea: function() { + var a = this.getCurrentArea(); + if(!(a == null || a.isTemporary())) { + if(a.vehicle == null) { + return !this.areas.exists(a.id); + } else { + return false; + } + } else { + return true; + } + } + ,inDungeon: function() { + return this.prevLocation != null; + } + ,returnTeleport: function() { + if(this.prevLocation != null) { + var loc = this.prevLocation; + this.prevLocation = null; + this.doTeleport(loc,this.prevX,this.prevY,false); + } else { + haxe_Log.trace("No place to return to!",{ fileName : "Player.hx", lineNumber : 1419, className : "com.davidmaletz.mining.Player", methodName : "returnTeleport"}); + } + } + ,getTileBlock: function(tx,ty) { + var id = this.getTileBlockId(tx,ty); + if(id == 999999) { + return com_davidmaletz_tiles_Tile.get("empty"); + } else if(id == -1) { + return null; + } else { + return this.area.getTileIndex(id); + } + } + ,getTileBlockId: function(tx,ty) { + return com_davidmaletz_mining_Player._getTileBlockId(this.area,this.get_tile_x(),this.get_tile_y(),tx,ty); + } + ,getContact: function(npc) { + return this.state.getContact(npc); + } + ,hasContact: function(npc) { + return this.state.hasContact(npc); + } + ,removeContact: function(npc) { + this.state.removeContact(npc); + } + ,setContact: function(npc,proc,quiet) { + if(quiet == null) { + quiet = false; + } + this.state.setContact(npc,proc,quiet); + } + ,writePosition: function(b) { + if(this.vehicle != null) { + this.vehicle.writePosition(b); + } else { + com_davidmaletz_mining_world_TooltipObject.prototype.writePosition.call(this,b); + } + } + ,write: function(b) { + com_davidmaletz_mining_world_TooltipObject.prototype.write.call(this,b); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.difficulty.id); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.location); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.prevLocation); + if(this.prevLocation != null) { + b.writeInt32(this.prevX); + b.writeInt32(this.prevY); + } + b.writeUInt16(this.stamina); + b.writeUInt16(this.oxygen); + this.inventory.write(b); + var i = this.stickyItems.keys(); + while(i.hasNext()) { + var i1 = i.next(); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,i1); + } + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + this.equipment.write(b); + this.vanity.write(b); + this.stats.write(b); + b.writeInt32(this.experience); + b.writeByte(this.hotkeys.length); + var _g = 0; + var _g1 = this.hotkeys; + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,k); + } + b.writeInt8(this.slideX); + b.writeInt8(this.slideY); + this.skills.write(b); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.entry); + if(this.vehicle == null || com_davidmaletz_mining_world_Area.__WRITE_IDS && this.vehicle.__id < 0) { + b.writeUInt16(0); + } else { + var o = new haxe_io_BytesOutput(); + com_fancyfish_faeng_common_UTFUtils.writeUTF(o,this.vehicle.info.id); + this.vehicle.writeInner(o,true); + if(com_davidmaletz_mining_world_Area.__WRITE_IDS && this.vehicle.__id >= 0) { + o.writeUInt24(this.vehicle.__id & 16777215); + } + var bytes = o.getBytes(); + var len = bytes.length; + b.writeUInt16(len); + b.writeFullBytes(bytes,0,len); + } + com_davidmaletz_mining_Player.writeColors(b,this.colors,this.offsets); + var i2 = this.seen_items.keys(); + while(i2.hasNext()) { + var i3 = i2.next(); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,i3); + } + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + } + ,getMaxSkillPoints: function() { + return this.getPointsForLevel(this.getLevel()); + } + ,getUsedSkillPoints: function() { + var ret = 0; + var s = this.getInfo().getSkills(); + while(s.hasNext()) { + var s1 = s.next(); + if(com_davidmaletz_mining_Skill.exists(s1)) { + ret += com_davidmaletz_mining_Skill.get(s1).getCost(this.skills.get(s1)); + } + } + return ret; + } + ,adjustSkills: function() { + this.info.runEvent(this,"adjustSkills",this); + } + ,equipItem: function(id,empty) { + if(empty == null) { + empty = true; + } + if(this.getItemCount(id) == 0) { + return; + } + var eq = com_davidmaletz_mining_item_ItemInfo.get(id); + if(!eq.xml.exists("slot")) { + return; + } + var slot = this.equipment.get(eq.xml.get("slot")); + if(slot != null && (!empty || slot.get() == null)) { + var i = this.inventory.selectItem(eq,0,null); + if(i != null) { + this.equipment.equip(i,this); + } + } + } + ,hitEffect: function(e,x,y,runPaused,flip,scale) { + if(scale == null) { + scale = 1; + } + if(flip == null) { + flip = false; + } + if(runPaused == null) { + runPaused = false; + } + if(this.renderer != null) { + var r = js_Boot.__cast(this.renderer , com_davidmaletz_mining_renderer_PlayerObjectRenderer); + if(r.hitEffectCooldown > 0) { + return; + } + r.hitEffectCooldown = 30; + } + com_davidmaletz_mining_world_TooltipObject.prototype.hitEffect.call(this,e,x,y,runPaused,flip,scale); + } + ,read: function(b,version) { + com_davidmaletz_mining_world_TooltipObject.prototype.read.call(this,b,version); + if(version >= 81) { + this.difficulty = com_davidmaletz_mining_DifficultyMode.get(com_fancyfish_faeng_common_UTFUtils.readUTF(b)); + } else { + this.difficulty = com_davidmaletz_mining_DifficultyMode.__current; + } + if(version >= 31) { + this.location = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + this.prevLocation = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(this.prevLocation != null) { + this.prevX = b.readInt32(); + this.prevY = b.readInt32(); + } + } + this.stamina = b.readUInt16(); + if(version < 37) { + this.stamina = Math.ceil(this.stamina / 10); + this.health = Math.ceil(this.health / 10); + } + var tmpe = this.equipment; + this.equipment = null; + if(version >= 58) { + this.oxygen = b.readUInt16(); + } else { + this.oxygen = this.getMaxOxygen(); + } + var _s = this.seen_items; + this.seen_items = null; + this.inventory.read(b,version); + this.equipment = tmpe; + if(version < 45) { + this.addCoins(b.readUInt24() - this.getMaxCoins()); + } + if(version >= 19) { + this.stickyItems = new haxe_ds_StringMap(); + var i; + while(true) { + i = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(!(i != null)) { + break; + } + var item = com_davidmaletz_mining_item_ItemInfo._get(i); + if(version >= 69 || item == null || item.type.canStore) { + this.stickyItems.set(i,true); + } + } + } + if(version >= 13) { + if(version < 29) { + var i1 = com_davidmaletz_mining_item_ItemInfo.get(com_fancyfish_faeng_common_UTFUtils.readUTF(b)); + if(i1 != null && this.inventory.addItems(i1,-1)) { + this.equipment.get("weapon").set(new com_davidmaletz_mining_item_Item(i1,0)); + } + var i2 = this.inventory.getItems(com_davidmaletz_mining_Player.isEquip); + while(i2.hasNext()) { + var i3 = i2.next(); + if(this.equipment.canEquip(this,i3.item.xml.get("slot"),i3.item)) { + this.equipItem(i3.item.id); + } + } + } else { + this.equipment.read(b,version); + if(version >= 71) { + this.vanity.read(b,version); + } + } + } + if(version < 66) { + this.state.readQuests(b,version); + } + if(version >= 49) { + this.stats.read(b,version); + this.update_weight(); + this.updateMaxOxygen(); + this.experience = b.readInt32(); + } else { + b.readUInt16(); + if(version >= 22) { + var v = b.readByte() & 255; + var t = b.readByte() & 255; + this.stats.get("attack").tempBuff(v,t); + var v1 = b.readByte() & 255; + var t1 = b.readByte() & 255; + this.stats.get("defense").tempBuff(v1,t1); + } else { + var a = b.readUInt16(); + if(a > 0) { + this.stats.get("attack").tempBuff(1,30); + } + var d = b.readUInt16(); + if(d > 0) { + this.stats.get("defense").tempBuff(1,30); + } + } + this.stats.get("speed").permaBuff(b.readByte() & 255); + if(version >= 12) { + this.stats.get("endurance").permaBuff(b.readByte() & 255); + this.stats.get("health").permaBuff(b.readByte() & 255); + this.stats.get("stamina").permaBuff(b.readByte() & 255); + } + this.experience = b.readUInt24(); + } + var len = b.readByte() & 255; + com_fancyfish_faeng_common_Utils.clear(this.hotkeys); + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i4 = _g1++; + this.hotkeys[i4] = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + } + if(version >= 49) { + this.slideX = b.readInt8(); + this.slideY = b.readInt8(); + this.skills.read(b); + if(version >= 75) { + this.entry = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + } else { + this.entry = com_davidmaletz_faengfl_adv_ModHandler.entries[0].get("id"); + } + if(version >= 54) { + var info; + var vi = b; + if(version >= 62) { + var len1 = b.readUInt16(); + if(len1 == 0) { + vi = null; + } else { + var bytes = haxe_io_Bytes.alloc(len1); + b.readFullBytes(bytes,0,len1); + vi = new haxe_io_BytesInput(bytes,0,len1); + } + } + var tmp; + if(vi != null) { + info = com_davidmaletz_mining_world_ObjectInfo.get(com_fancyfish_faeng_common_UTFUtils.readUTF(vi)); + tmp = info != null; + } else { + tmp = false; + } + if(tmp) { + try { + this.set_vehicle(js_Boot.__cast(info.create(this.xPos,this.yTile) , com_davidmaletz_mining_world_vehicle_Vehicle)); + this.vehicle.player = this; + if(this.vehicle != null) { + this.vehicle.readInner(vi,version,true); + if(version >= 75) { + try { + var id = vi.readUInt24(); + if(id >= 0) { + this.vehicle.__loadId(id); + } + } catch( e ) { + haxe_CallStack.lastException = e; + } + } + this.vehicle.player = null; + this.vehicle.runEvent(this,"init"); + } + } catch( e1 ) { + haxe_CallStack.lastException = e1; + if (e1 instanceof js__$Boot_HaxeError) e1 = e1.val; + com_fancyfish_faeng_common_Utils.printExceptionTrace("Failed to mount vehicle: " + Std.string(e1)); + this.set_vehicle(null); + com_davidmaletz_mining_Main.error = true; + } + } + } + } + this.updateMaxHealth(); + this.updateMaxStamina(); + if(version < 66) { + this.state.readVars(b,version); + if(this.getFlag("pickaxe")) { + this.setFlag("allow_hotkeys",true); + } + } + this.seen_items = _s; + var i5 = this.inventory.getItems(); + while(i5.hasNext()) { + var i6 = i5.next(); + this.seen_items.set(i6.item.id,true); + } + var i7 = this.equipment.getEquipment(); + while(i7.hasNext()) { + var i8 = i7.next(); + this.seen_items.set(i8.info.id,true); + } + var d1 = com_davidmaletz_mining_Player.getDefaults(this.getInfo(),com_fancyfish_faeng_common_Random.createFromInt(this.xPos + this.yTile + this.health + this.stamina + version + this.experience + this.inventory.getWeight())); + this.colors = d1.colors; + this.offsets = d1.offsets; + if(version >= 46) { + com_davidmaletz_mining_Player.readColors(b,version,this.colors,this.offsets); + var f; + if(version >= 70) { + while(true) { + f = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(!(f != null)) { + break; + } + this.seen_items.set(f,true); + } + } + } + if(version < 66) { + this.state.readContacts(b,version); + } + if(version < 46 && this.equipment.isEmpty("back")) { + var best = null; + var i9 = this.inventory.getItems(com_davidmaletz_mining_Player.isEquip); + while(i9.hasNext()) { + var i10 = i9.next(); + var e2 = js_Boot.__cast(i10.item , com_davidmaletz_mining_item_Equipment); + var wt = e2.capacity; + if(wt > 0 && e2.xml.get("slot") == "back" && e2.hasActionId("equip") && (best == null || wt > best.capacity)) { + best = e2; + } + } + if(best != null) { + new com_davidmaletz_mining_item_Action("equip")["use"](this,best,0,null); + } + } + } + ,getFlag: function(flag) { + return this.state.getFlag(flag); + } + ,setFlag: function(flag,value) { + this.state.setFlag(flag,value); + } + ,hasVar: function(name) { + return this.state.hasVar(name); + } + ,getVar: function(name) { + return this.state.getVar(name); + } + ,setVar: function(name,value) { + this.state.setVar(name,value); + } + ,addVar: function(name,value) { + this.state.addVar(name,value); + } + ,hasTmpVar: function(name) { + return this.state.hasTmpVar(name); + } + ,getTmpVar: function(name) { + return this.state.getTmpVar(name); + } + ,setTmpVar: function(name,value) { + this.state.setTmpVar(name,value); + } + ,addTmpVar: function(name,value) { + this.state.addTmpVar(name,value); + } + ,hasString: function(name) { + return this.state.hasVar(name); + } + ,getString: function(name) { + return this.state.getString(name); + } + ,setString: function(name,value) { + this.state.setString(name,value); + } + ,getDigCount: function(name) { + return this.state.getDigCount(name); + } + ,setDigCount: function(name,value) { + this.state.setDigCount(name,value); + } + ,addDigCount: function(name,value) { + this.state.addDigCount(name,value); + } + ,getKillCount: function(name) { + return this.state.getKillCount(name); + } + ,setKillCount: function(name,value) { + this.state.setKillCount(name,value); + } + ,addKillCount: function(name,value) { + var f = ($_=this.state,$bind($_,$_.addKillCount)); + var a1 = name; + var a2 = value; + var tmp = function() { + f(a1,a2); + }; + this.getInfo().runEvent(this,"onKill",{ id : name, count : value},tmp); + } + ,paused: null + ,isBlocking: function(asker) { + if(this.paused.get()) { + return false; + } else if(asker == null) { + return this.hidden.get() == null; + } else if(asker.xml.get("spirit") == "true") { + return this.viewHidden.get(); + } else if(this.hidden.get() != null) { + return asker.xml.get("seeHidden") == "true"; + } else { + return true; + } + } + ,canAttack: function() { + return !this.paused.get(); + } + ,checkObject: function(addBounds,o) { + if(o != this) { + addBounds(o,o.getBounds()); + } + return false; + } + ,getLayer: function() { + return 6; + } + ,knockback: function(dx,passObjects) { + if(passObjects == null) { + passObjects = false; + } + if(com_davidmaletz_mining_Main.getLocalPlayer() != this) { + return; + } + var r = null; + if(this.renderer != null) { + r = js_Boot.__cast(this.renderer , com_davidmaletz_mining_renderer_PlayerObjectRenderer); + if(r.canStun()) { + r.updateStun(); + } else { + return; + } + } + com_davidmaletz_mining_world_TooltipObject.prototype.knockback.call(this,dx,true); + if(r != null) { + r.updateScroll(true); + } + } + ,checkConnections: function(_x,_y,dx,dy) { + if(this.area == null) { + return true; + } + if(dx > 0 && this.area.right != null && _x >= this.area.right.fromX * com_davidmaletz_tiles_Tile.SIZE) { + this.area.right.enter(this,_x,_y); + } else if(dx < 0 && this.area.left != null && _x <= this.area.left.fromX * com_davidmaletz_tiles_Tile.SIZE) { + this.area.left.enter(this,_x,_y); + } else if(dy > 0 && this.area.down != null && _y >= this.area.down.fromX * com_davidmaletz_tiles_Tile.SIZE) { + this.area.down.enter(this,_x,_y); + } else if(dy < 0 && this.area.up != null && _y <= this.area.up.fromX * com_davidmaletz_tiles_Tile.SIZE) { + this.area.up.enter(this,_x,_y); + } else { + return true; + } + return false; + } + ,channel: null + ,beginSpeak: function() { + var sfx = this.getInfo().talkSfx; + if(sfx != null && com_davidmaletz_faengfl_RevealText.TEXT_SPEED > 0) { + this.playSFX(sfx); + } + } + ,endSpeak: function(closed) { + this.stopSFX(); + } + ,playSFX: function(id) { + if(this == com_davidmaletz_mining_Main.getLocalPlayer()) { + this.stopSFX(); + var o = this.vehicle == null ? this : this.vehicle; + if(o.renderer != null && o.renderer.stage != null) { + this.channel = com_davidmaletz_faengfl_adv_sound_Sound.play(id,true); + } + } + } + ,stopSFX: function(e) { + if(this.channel != null) { + this.channel.stop(); + this.channel = null; + } + } + ,hasPriority: function(p,structure) { + return false; + } + ,setDifficulty: function(d) { + if(d != this.difficulty) { + this.difficulty = d; + this.update_weight(); + } + } + ,getDifficulty: function() { + return this.difficulty; + } + ,__location_id: null + ,__class__: com_davidmaletz_mining_Player + ,__properties__: $extend(com_davidmaletz_mining_world_TooltipObject.prototype.__properties__,{set_vehicle:"set_vehicle"}) +}); +var com_davidmaletz_mining_ToolEvent = function(type,item,p,name,slot) { + openfl_events_Event.call(this,type); + this.item = item; + this.projectile = p; + this.name = name; + this.slot = slot; +}; +$hxClasses["com.davidmaletz.mining.ToolEvent"] = com_davidmaletz_mining_ToolEvent; +com_davidmaletz_mining_ToolEvent.__name__ = ["com","davidmaletz","mining","ToolEvent"]; +com_davidmaletz_mining_ToolEvent.__super__ = openfl_events_Event; +com_davidmaletz_mining_ToolEvent.prototype = $extend(openfl_events_Event.prototype,{ + item: null + ,projectile: null + ,name: null + ,slot: null + ,__class__: com_davidmaletz_mining_ToolEvent +}); +var com_davidmaletz_mining_DigEvent = function(type,item,p,name,slot,tx,ty) { + com_davidmaletz_mining_ToolEvent.call(this,type,item,p,name,slot); + this.tx = tx; + this.ty = ty; +}; +$hxClasses["com.davidmaletz.mining.DigEvent"] = com_davidmaletz_mining_DigEvent; +com_davidmaletz_mining_DigEvent.__name__ = ["com","davidmaletz","mining","DigEvent"]; +com_davidmaletz_mining_DigEvent.__super__ = com_davidmaletz_mining_ToolEvent; +com_davidmaletz_mining_DigEvent.prototype = $extend(com_davidmaletz_mining_ToolEvent.prototype,{ + tx: null + ,ty: null + ,__class__: com_davidmaletz_mining_DigEvent +}); +var com_davidmaletz_mining_world_HealthEvent = function(type,attacker,delta) { + openfl_events_Event.call(this,type); + this.attacker = attacker; + this.delta = delta; +}; +$hxClasses["com.davidmaletz.mining.world.HealthEvent"] = com_davidmaletz_mining_world_HealthEvent; +com_davidmaletz_mining_world_HealthEvent.__name__ = ["com","davidmaletz","mining","world","HealthEvent"]; +com_davidmaletz_mining_world_HealthEvent.__super__ = openfl_events_Event; +com_davidmaletz_mining_world_HealthEvent.prototype = $extend(openfl_events_Event.prototype,{ + attacker: null + ,delta: null + ,__class__: com_davidmaletz_mining_world_HealthEvent +}); +var com_davidmaletz_mining_LoseHealthEvent = function(type,attacker,delta,flags,attackElement,scaleX,playSFX) { + com_davidmaletz_mining_world_HealthEvent.call(this,type,attacker,delta); + this.flags = flags; + this.element = attackElement; + this.scaleX = scaleX; + this.playSFX = playSFX; +}; +$hxClasses["com.davidmaletz.mining.LoseHealthEvent"] = com_davidmaletz_mining_LoseHealthEvent; +com_davidmaletz_mining_LoseHealthEvent.__name__ = ["com","davidmaletz","mining","LoseHealthEvent"]; +com_davidmaletz_mining_LoseHealthEvent.__super__ = com_davidmaletz_mining_world_HealthEvent; +com_davidmaletz_mining_LoseHealthEvent.prototype = $extend(com_davidmaletz_mining_world_HealthEvent.prototype,{ + flags: null + ,element: null + ,scaleX: null + ,playSFX: null + ,__class__: com_davidmaletz_mining_LoseHealthEvent +}); +var com_davidmaletz_mining_world_ObjectInfo = function(id,health,e) { + if(id == null) { + id = ""; + } + this.id = id; + this.health = health; + this.xml = e; + if(this.xml != null && this.xml.exists("color")) { + this.color = com_davidmaletz_mining_Main.parseInt("0x" + this.xml.get("color")); + } else { + this.color = 16777215; + } + if(this.xml != null && this.xml.exists("colorScale")) { + this.colorScale = com_davidmaletz_mining_Main.parseFloat(this.xml.get("colorScale")); + } else { + this.colorScale = 1; + } + if(this.xml != null) { + this.sounds = com_davidmaletz_faengfl_adv_sound_Sound.parseSoundSet(this.xml); + var i = e.elementsNamed("hitbox"); + if(i.hasNext()) { + this.hitbox = com_davidmaletz_mining_renderer_Parallax.makeRect(i.next(),1); + } + } + if(this.xml == null) { + this.xml = new com_davidmaletz_faengfl_EmptyXml(); + } +}; +$hxClasses["com.davidmaletz.mining.world.ObjectInfo"] = com_davidmaletz_mining_world_ObjectInfo; +com_davidmaletz_mining_world_ObjectInfo.__name__ = ["com","davidmaletz","mining","world","ObjectInfo"]; +com_davidmaletz_mining_world_ObjectInfo.__interfaces__ = [AbstractClass]; +com_davidmaletz_mining_world_ObjectInfo.make = function(id,x,y) { + return com_davidmaletz_mining_world_ObjectInfo.get(id).create(x,y); +}; +com_davidmaletz_mining_world_ObjectInfo.info = null; +com_davidmaletz_mining_world_ObjectInfo.loadInfo = function(o) { + if(com_davidmaletz_mining_world_ObjectInfo.info == null) { + com_davidmaletz_mining_world_ObjectInfo.info = new haxe_ds_StringMap(); + } + if(com_davidmaletz_mining_world_ObjectInfo.info.exists(o.id) && !Std["is"](com_davidmaletz_mining_world_ObjectInfo.info.get(o.id),com_davidmaletz_mining_world_ItemObjectInfo)) { + haxe_Log.trace("Overwrite Object: " + o.id,{ fileName : "ObjectInfo.hx", lineNumber : 76, className : "com.davidmaletz.mining.world.ObjectInfo", methodName : "loadInfo"}); + } + com_davidmaletz_mining_world_ObjectInfo.info.set(o.id,o); +}; +com_davidmaletz_mining_world_ObjectInfo.get = function(id) { + var ret = com_davidmaletz_mining_world_ObjectInfo._get(id); + if(id != null && id.length > 0 && ret == null) { + haxe_Log.trace("No Object found: " + id,{ fileName : "ObjectInfo.hx", lineNumber : 79, className : "com.davidmaletz.mining.world.ObjectInfo", methodName : "get"}); + com_davidmaletz_mining_Main.error = true; + } + return ret; +}; +com_davidmaletz_mining_world_ObjectInfo._get = function(id) { + if(id == null || com_davidmaletz_mining_world_ObjectInfo.info == null) { + return null; + } else { + return com_davidmaletz_mining_world_ObjectInfo.info.get(id); + } +}; +com_davidmaletz_mining_world_ObjectInfo.exists = function(id) { + if(id != null && com_davidmaletz_mining_world_ObjectInfo.info != null) { + return com_davidmaletz_mining_world_ObjectInfo.info.exists(id); + } else { + return false; + } +}; +com_davidmaletz_mining_world_ObjectInfo.reset = function() { + com_davidmaletz_mining_world_ObjectInfo.info = null; + com_davidmaletz_mining_world_ObjectInfo.hitEffects = null; +}; +com_davidmaletz_mining_world_ObjectInfo.hitEffects = null; +com_davidmaletz_mining_world_ObjectInfo.loadHitEffect = function(e) { + if(com_davidmaletz_mining_world_ObjectInfo.hitEffects == null) { + com_davidmaletz_mining_world_ObjectInfo.hitEffects = new haxe_ds_StringMap(); + } + var id = e.get("id"); + if(com_davidmaletz_mining_world_ObjectInfo.hitEffects.exists(id)) { + haxe_Log.trace("Overwrite HitEffect: " + id,{ fileName : "ObjectInfo.hx", lineNumber : 90, className : "com.davidmaletz.mining.world.ObjectInfo", methodName : "loadHitEffect"}); + } + com_davidmaletz_mining_world_ObjectInfo.hitEffects.set(id,e); +}; +com_davidmaletz_mining_world_ObjectInfo.getHitEffectI = function(attacker,element,xml) { + return com_davidmaletz_mining_world_ObjectInfo._getHitEffect(attacker,element,$bind(xml,xml.get),$bind(xml,xml.elementsNamed)); +}; +com_davidmaletz_mining_world_ObjectInfo.getHitEffect = function(attacker,element,xml) { + return com_davidmaletz_mining_world_ObjectInfo._getHitEffect(attacker,element,$bind(xml,xml.get),$bind(xml,xml.elementsNamed)); +}; +com_davidmaletz_mining_world_ObjectInfo.getHitEffectById = function(id) { + if(com_davidmaletz_mining_world_ObjectInfo.hitEffects == null) { + return null; + } else { + return com_davidmaletz_mining_world_ObjectInfo.hitEffects.get(id); + } +}; +com_davidmaletz_mining_world_ObjectInfo.parseHitEffectString = function(attacker,element,string) { + if(string == null) { + return null; + } else if(com_davidmaletz_mining_world_ObjectInfo.hitEffects != null && com_davidmaletz_mining_world_ObjectInfo.hitEffects.exists(string)) { + return new com_davidmaletz_mining_world_HitEffect(com_davidmaletz_mining_world_ObjectInfo.hitEffects.get(string),attacker,element); + } + try { + return com_davidmaletz_mining_world_ObjectInfo.parseHitEffect(Xml.parse(string).firstElement(),attacker,element); + } catch( e ) { + haxe_CallStack.lastException = e; + } + return null; +}; +com_davidmaletz_mining_world_ObjectInfo.toHitEffectString = function(xml) { + var id = xml.get("hitEffect"); + if(id != null && com_davidmaletz_mining_world_ObjectInfo.hitEffects != null && com_davidmaletz_mining_world_ObjectInfo.hitEffects.exists(id)) { + return id; + } + var i = xml.elementsNamed("hitEffect"); + if(i != null && i.hasNext()) { + return i.next().toString(); + } else { + return null; + } +}; +com_davidmaletz_mining_world_ObjectInfo.createHitEffect = function(id,attacker,element) { + var e = com_davidmaletz_mining_world_ObjectInfo.getHitEffectById(id); + if(e == null) { + return null; + } else { + return new com_davidmaletz_mining_world_HitEffect(e,attacker,element); + } +}; +com_davidmaletz_mining_world_ObjectInfo._getHitEffect = function(attacker,element,get,elementsNamed) { + var id = get("hitEffect"); + if(id != null && com_davidmaletz_mining_world_ObjectInfo.hitEffects != null && com_davidmaletz_mining_world_ObjectInfo.hitEffects.exists(id)) { + return new com_davidmaletz_mining_world_HitEffect(com_davidmaletz_mining_world_ObjectInfo.hitEffects.get(id),attacker,element); + } + var i = elementsNamed("hitEffect"); + if(i != null && i.hasNext()) { + return com_davidmaletz_mining_world_ObjectInfo.parseHitEffect(i.next(),attacker,element); + } else { + return null; + } +}; +com_davidmaletz_mining_world_ObjectInfo.parseHitEffect = function(e,attacker,element) { + var id = e.get("id"); + if(id != null && com_davidmaletz_mining_world_ObjectInfo.hitEffects != null && com_davidmaletz_mining_world_ObjectInfo.hitEffects.exists(id)) { + return new com_davidmaletz_mining_world_HitEffect(com_davidmaletz_mining_world_ObjectInfo.hitEffects.get(id),attacker,element); + } else { + return new com_davidmaletz_mining_world_HitEffect(e,attacker,element); + } +}; +com_davidmaletz_mining_world_ObjectInfo.prototype = { + id: null + ,health: null + ,xml: null + ,color: null + ,colorScale: null + ,sounds: null + ,hitbox: null + ,tint: function(s) { + com_davidmaletz_faengfl_TextSprite.setColor(s,this.color,255 / this.colorScale); + return s; + } + ,create: function(x,y) { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,getIconFrame: function() { + return null; + } + ,createIcon: function() { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,runEvent: function(p,event,o,onComplete,vars) { + com_davidmaletz_mining_Main.runEvent(event,p,this.xml,o == null ? this : o,onComplete,vars); + } + ,getDisplayTile: function() { + var icon = this.xml.get("icon"); + if(icon == null) { + icon = this.id + ".ico"; + } + return icon; + } + ,getDisplayId: function() { + return this.xml.get("title"); + } + ,getDisplayName: function(vars) { + var r = com_fancyfish_faeng_common_Lang.getTextFromTitle(this.getDisplayId()); + if(r == null) { + if(vars == null) { + vars = com_davidmaletz_faengfl_EventHandler.createVariables(); + vars.set("this",this); + } + var s = com_davidmaletz_mining_npc_NPCEventHandler.evalString(this.getDisplayId(),vars); + if(s == null) { + s = ""; + } + r = new com_fancyfish_faeng_common_mutable_Static(s); + } + return r; + } + ,getTitle: function(vars) { + var i = null; + if(this.xml.exists("title")) { + try { + i = new com_fancyfish_faeng_common_mutable_Static(com_davidmaletz_faengfl_EventHandler._execute(this.xml.get("title"),vars)); + } catch( e ) { + haxe_CallStack.lastException = e; + i = com_fancyfish_faeng_common_Lang.getTextFromTitle(this.xml.get("title")); + } + } + if(i != null) { + return i; + } else if(com_fancyfish_faeng_common_Lang.hasText("vehicle",this.id)) { + return com_fancyfish_faeng_common_Lang.getText("vehicle",this.id); + } else { + return com_fancyfish_faeng_common_Lang.getText("vehicle","vehicle"); + } + } + ,getDisplay: function(darkBG,tile,anim,name) { + if(darkBG == null) { + darkBG = false; + } + var ret = new StringBuf(); + ret.add("[color="); + ret.add(darkBG ? "ff2222" : "770000"); + ret.add("]"); + var icon = tile == null ? this.getDisplayTile() : tile; + if(icon != null) { + ret.add("[tile="); + ret.add(icon); + if(anim != null) { + ret.add(" anim=" + anim); + } + ret.add("] "); + } + if(name == null) { + var title = this.getDisplayName(null); + if(title != null) { + ret.add(title.get()); + } + } else { + ret.add(name); + } + ret.add("[/color]"); + return ret.toString(); + } + ,modifyHitbox: function(r) { + if(this.hitbox != null) { + r.x += this.hitbox.x; + r.y += this.hitbox.y; + r.width = this.hitbox.width; + r.height = this.hitbox.height; + } + } + ,__class__: com_davidmaletz_mining_world_ObjectInfo +}; +var com_davidmaletz_mining_PlayerInfo = function(xml) { + this.mod_lights = new haxe_ds_IntMap(); + com_davidmaletz_mining_world_ObjectInfo.call(this,xml.get("id"),com_davidmaletz_mining_Main.parseInt(xml.get("health")),xml); + this.layers = xml.get("layers"); + this.stamina = com_davidmaletz_mining_Main.parseInt(xml.get("stamina")); + this.speed = com_davidmaletz_mining_Main.parseInt(xml.get("speed")); + this.sight = xml.exists("sight") ? com_davidmaletz_mining_Main.parseInt(xml.get("sight")) : 3; + this.maxLevel = com_davidmaletz_mining_Main.parseInt(xml.get("maxLevel")); + this.talkSfx = xml.get("talk_sfx"); + var i = xml.elementsNamed("light"); + if(i.hasNext()) { + this.light = new com_davidmaletz_mining_world_LightInfo(i.next()); + } + this.skills = new haxe_ds_StringMap(); + this.skills_ordered = []; + this.oxygen = xml.exists("oxygen") ? com_davidmaletz_mining_Main.parseInt(xml.get("oxygen")) : 20; + var s = xml.elementsNamed("skill"); + while(s.hasNext()) { + var s1 = s.next(); + var id = s1.get("id"); + this.skills.set(id,com_davidmaletz_mining_Main.parseInt(s1.get("maxLevel"))); + this.skills_ordered.push(id); + } + this.stats = [new com_fancyfish_faeng_common_Pair("full","never_set")]; + var s2 = xml.elementsNamed("stat"); + while(s2.hasNext()) { + var s3 = s2.next(); + this.stats.push(new com_fancyfish_faeng_common_Pair(s3.get("id"),s3.get("flag"))); + } + var s4 = xml.elementsNamed("modLight"); + while(s4.hasNext()) { + var s5 = s4.next(); + this.mod_lights.set(com_davidmaletz_mining_Main.parseInt(s5.get("id")),new com_davidmaletz_mining_world_LightInfo(s5)); + } + this.hasBeard = false; + var e = xml.elementsNamed("offset"); + while(e.hasNext()) { + var e1 = e.next(); + if(e1.get("id") == "beard") { + this.hasBeard = true; + } + } + this.max_depth = xml.exists("max_depth") ? com_davidmaletz_mining_Main.parseInt(xml.get("max_depth")) : 80; +}; +$hxClasses["com.davidmaletz.mining.PlayerInfo"] = com_davidmaletz_mining_PlayerInfo; +com_davidmaletz_mining_PlayerInfo.__name__ = ["com","davidmaletz","mining","PlayerInfo"]; +com_davidmaletz_mining_PlayerInfo.__super__ = com_davidmaletz_mining_world_ObjectInfo; +com_davidmaletz_mining_PlayerInfo.prototype = $extend(com_davidmaletz_mining_world_ObjectInfo.prototype,{ + layers: null + ,stamina: null + ,speed: null + ,oxygen: null + ,maxLevel: null + ,talkSfx: null + ,light: null + ,hasBeard: null + ,sight: null + ,skills: null + ,skills_ordered: null + ,stats: null + ,mod_lights: null + ,max_depth: null + ,parseModLight: function(str) { + var s = Xml.parse(str).firstElement(); + this.mod_lights.set(com_davidmaletz_mining_Main.parseInt(s.get("id")),new com_davidmaletz_mining_world_LightInfo(s)); + } + ,getMaxLevel: function(skill) { + var ret = this.skills.get(skill); + if(ret == null) { + return 0; + } else { + return ret; + } + } + ,getSkills: function() { + return HxOverrides.iter(this.skills_ordered); + } + ,getStats: function(p) { + return new com_davidmaletz_mining__$PlayerInfo_StatIterator(HxOverrides.iter(this.stats),p); + } + ,create: function(x,y) { + return new com_davidmaletz_mining_Player(com_davidmaletz_mining_Main.getLocalState(),this,x,y); + } + ,createIcon: function() { + return this.makeTile(new haxe_ds_StringMap(),new haxe_ds_StringMap()); + } + ,makeTile: function(colors,offsets) { + var b = com_davidmaletz_faengfl_LayerManager.create(this.layers,colors,offsets).toBitmap(); + if(this.xml.exists("tileWidth")) { + b.tileWidth = com_davidmaletz_mining_Main.parseInt(this.xml.get("tileWidth")); + } + if(this.xml.exists("tileHeight")) { + b.tileHeight = com_davidmaletz_mining_Main.parseInt(this.xml.get("tileHeight")); + } + return b; + } + ,getElementType: function(element,id) { + var e = this.xml.elementsNamed(element); + while(e.hasNext()) { + var e1 = e.next(); + if(e1.get("id") == id) { + if(e1.exists("type")) { + return e1.get("type"); + } else { + return id; + } + } + } + return id; + } + ,__class__: com_davidmaletz_mining_PlayerInfo +}); +var com_davidmaletz_mining__$PlayerInfo_StatIterator = function(i,p) { + this.stats = i; + this.player = p; + this.current = this.getNext(); +}; +$hxClasses["com.davidmaletz.mining._PlayerInfo.StatIterator"] = com_davidmaletz_mining__$PlayerInfo_StatIterator; +com_davidmaletz_mining__$PlayerInfo_StatIterator.__name__ = ["com","davidmaletz","mining","_PlayerInfo","StatIterator"]; +com_davidmaletz_mining__$PlayerInfo_StatIterator.prototype = { + stats: null + ,player: null + ,current: null + ,hasNext: function() { + return this.current != null; + } + ,next: function() { + var ret = this.current; + this.current = this.getNext(); + return ret; + } + ,getNext: function() { + while(this.stats.hasNext()) { + var i = this.stats.next(); + if(this.player == null || i.second == null || this.player.getFlag(i.second)) { + return i.first; + } + } + return null; + } + ,__class__: com_davidmaletz_mining__$PlayerInfo_StatIterator +}; +var com_davidmaletz_mining_Skill = function(xml) { + this.id = xml.get("id"); + this.name = xml.get("name"); + this.xml = xml; + this.tile = xml.get("tile"); + var i = xml.elementsNamed("stat"); + if(this.tile == null && i.hasNext()) { + this.tile = "stat." + i.next().get("id"); + } + this.startCost = com_davidmaletz_mining_Main.parseInt(xml.get("start_cost")); + this.costPerLevel = com_davidmaletz_mining_Main.parseInt(xml.get("cost_per_level")); +}; +$hxClasses["com.davidmaletz.mining.Skill"] = com_davidmaletz_mining_Skill; +com_davidmaletz_mining_Skill.__name__ = ["com","davidmaletz","mining","Skill"]; +com_davidmaletz_mining_Skill.skills = null; +com_davidmaletz_mining_Skill.load = function(xml,path) { + if(com_davidmaletz_mining_Skill.skills == null) { + com_davidmaletz_mining_Skill.skills = new haxe_ds_StringMap(); + } + var s = new com_davidmaletz_mining_Skill(new com_davidmaletz_faengfl_XmlPath(xml,path)); + if(com_davidmaletz_mining_Skill.skills.exists(s.id)) { + haxe_Log.trace("Overwrite Skill: " + s.id,{ fileName : "Skill.hx", lineNumber : 47, className : "com.davidmaletz.mining.Skill", methodName : "load"}); + } + com_davidmaletz_mining_Skill.skills.set(s.id,s); +}; +com_davidmaletz_mining_Skill.get = function(id) { + var ret = com_davidmaletz_mining_Skill._get(id); + if(id != null && id.length > 0 && ret == null) { + haxe_Log.trace("No Skill found: " + id,{ fileName : "Skill.hx", lineNumber : 50, className : "com.davidmaletz.mining.Skill", methodName : "get"}); + } + return ret; +}; +com_davidmaletz_mining_Skill._get = function(id) { + if(id == null || com_davidmaletz_mining_Skill.skills == null) { + return null; + } else { + return com_davidmaletz_mining_Skill.skills.get(id); + } +}; +com_davidmaletz_mining_Skill.exists = function(id) { + if(id != null && com_davidmaletz_mining_Skill.skills != null) { + return com_davidmaletz_mining_Skill.skills.exists(id); + } else { + return false; + } +}; +com_davidmaletz_mining_Skill.reset = function() { + com_davidmaletz_mining_Skill.skills = null; +}; +com_davidmaletz_mining_Skill.prototype = { + id: null + ,name: null + ,tile: null + ,startCost: null + ,costPerLevel: null + ,xml: null + ,apply: function(player,delta) { + var e = this.xml.elementsNamed("stat"); + while(e.hasNext()) { + var e1 = e.next(); + player.stats.get(e1.get("id")).add(com_davidmaletz_mining_Main.parseInt(e1.get("value")) * delta); + } + var i = this.xml.elementPathsNamed("apply"); + if(i.hasNext()) { + var vars = com_davidmaletz_faengfl_EventHandler.createVariables(); + vars.set("delta",delta); + new com_davidmaletz_mining_npc_NPCEventHandler(i.next().elements(),player,this,null,vars).runAll(); + } + } + ,getCost: function(lvl) { + return Math.round(lvl * (this.startCost * 2 + (lvl - 1) * this.costPerLevel) * 0.5); + } + ,getTile: function(power) { + var t = com_davidmaletz_tiles_Tile._get(this.tile); + if(t == null) { + return null; + } else { + var s = com_davidmaletz_tiles_Tile.makeIcon(t); + com_davidmaletz_mining_Stat.tint(s,power); + return s; + } + } + ,getName: function() { + var t = com_fancyfish_faeng_common_Lang.getTextFromTitle(this.name); + if(t == null) { + return com_fancyfish_faeng_common_Lang.getText("skill",this.id); + } else { + return t; + } + } + ,__class__: com_davidmaletz_mining_Skill +}; +var com_davidmaletz_mining_ui_Iconable = function() { }; +$hxClasses["com.davidmaletz.mining.ui.Iconable"] = com_davidmaletz_mining_ui_Iconable; +com_davidmaletz_mining_ui_Iconable.__name__ = ["com","davidmaletz","mining","ui","Iconable"]; +com_davidmaletz_mining_ui_Iconable.prototype = { + getName: null + ,createIcon: null + ,getElement: null + ,__class__: com_davidmaletz_mining_ui_Iconable +}; +var com_davidmaletz_mining_ui_InfoItem = function() { }; +$hxClasses["com.davidmaletz.mining.ui.InfoItem"] = com_davidmaletz_mining_ui_InfoItem; +com_davidmaletz_mining_ui_InfoItem.__name__ = ["com","davidmaletz","mining","ui","InfoItem"]; +com_davidmaletz_mining_ui_InfoItem.__interfaces__ = [com_davidmaletz_mining_ui_Iconable]; +com_davidmaletz_mining_ui_InfoItem.prototype = { + addInfo: null + ,__class__: com_davidmaletz_mining_ui_InfoItem +}; +var com_davidmaletz_mining_Info = function(s,lvl,max) { + this.skill = s; + this.level = lvl; + this.max = max; +}; +$hxClasses["com.davidmaletz.mining.Info"] = com_davidmaletz_mining_Info; +com_davidmaletz_mining_Info.__name__ = ["com","davidmaletz","mining","Info"]; +com_davidmaletz_mining_Info.__interfaces__ = [com_davidmaletz_mining_ui_InfoItem]; +com_davidmaletz_mining_Info.prototype = { + skill: null + ,level: null + ,max: null + ,getName: function() { + return this.skill.getName(); + } + ,createIcon: function() { + return this.skill.getTile(this.level / this.max); + } + ,getElement: function() { + return null; + } + ,addInfo: function(s,w,x,y) { + if(this.level >= this.max) { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("skill","max").get()); + } else { + y = com_davidmaletz_mining_item_ItemInfo.addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("skill","points"),this.skill.getCost(this.level + 1) - this.skill.getCost(this.level),false); + } + var e = this.skill.xml.elementsNamed("stat"); + while(e.hasNext()) { + var e1 = e.next(); + var stat = e1.get("id"); + y = com_davidmaletz_mining_item_ItemInfo.addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("stats",stat),com_davidmaletz_mining_Main.parseInt(e1.get("value")),true,true,26112); + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("stat.descriptions",stat).get(),0.5); + } + return y; + } + ,__class__: com_davidmaletz_mining_Info +}; +var com_davidmaletz_mining_Skills = function(p) { + openfl_events_EventDispatcher.call(this); + this.player = p; + this.skills = new haxe_ds_StringMap(); + this.points = 0; +}; +$hxClasses["com.davidmaletz.mining.Skills"] = com_davidmaletz_mining_Skills; +com_davidmaletz_mining_Skills.__name__ = ["com","davidmaletz","mining","Skills"]; +com_davidmaletz_mining_Skills.__super__ = openfl_events_EventDispatcher; +com_davidmaletz_mining_Skills.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + player: null + ,skills: null + ,points: null + ,set: function(skill,val) { + var s = com_davidmaletz_mining_Skill.get(skill); + if(s == null) { + return; + } + val = com_fancyfish_faeng_common_Utils.clampi(val,0,this.player.getInfo().getMaxLevel(skill)); + var v = this.get(skill); + if(v == val) { + return; + } + this.points -= s.getCost(v); + this.skills.set(skill,val); + s.apply(this.player,val - v); + this.points += s.getCost(val); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("skill_change",s)); + } + ,get: function(skill) { + var old = this.skills.get(skill); + if(old == null) { + return 0; + } else { + return old; + } + } + ,reset: function() { + var s = this.skills.keys(); + while(s.hasNext()) { + var s1 = s.next(); + this.set(s1,0); + } + this.player.adjustSkills(); + } + ,write: function(b) { + var s = this.skills.keys(); + while(s.hasNext()) { + var s1 = s.next(); + var val = this.skills.get(s1); + if(val != 0) { + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,s1); + b.writeByte(val & 255); + } + } + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + } + ,read: function(b) { + var s; + while(true) { + s = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(!(s != null)) { + break; + } + this.set(s,b.readByte() & 255); + } + } + ,__class__: com_davidmaletz_mining_Skills +}); +var com_davidmaletz_mining_Stat = function(id) { + openfl_events_EventDispatcher.call(this); + this.id = id; + this.base = 0; + this.perma_buff = 0; + this.temp_buff = 0; + this.temp_buff_time = 0; +}; +$hxClasses["com.davidmaletz.mining.Stat"] = com_davidmaletz_mining_Stat; +com_davidmaletz_mining_Stat.__name__ = ["com","davidmaletz","mining","Stat"]; +com_davidmaletz_mining_Stat.tint = function(d,power) { + com_davidmaletz_faengfl_TextSprite.setColor(d,14858784,121,power * 0.5); + return d; +}; +com_davidmaletz_mining_Stat.__super__ = openfl_events_EventDispatcher; +com_davidmaletz_mining_Stat.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + id: null + ,base: null + ,perma_buff: null + ,temp_buff: null + ,temp_buff_time: null + ,__copy: function(s) { + this.perma_buff = s.perma_buff; + this.temp_buff = s.temp_buff; + this.temp_buff_time = s.temp_buff_time; + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("updated",this.id)); + } + ,get: function() { + return this.base + this.perma_buff + (this.temp_buff_time > 0 ? this.temp_buff : 0); + } + ,getTime: function() { + return this.temp_buff_time; + } + ,add: function(v) { + if(v != 0) { + this.base += v; + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("updated",this.id)); + } + } + ,equipBuff: function(v) { + this.add(v); + } + ,permaBuff: function(v) { + if(v != 0) { + this.perma_buff += v; + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("update_time",this.id)); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("updated",this.id)); + } + } + ,tempBuff: function(v,time) { + if(v != 0 && time > this.temp_buff_time) { + this.temp_buff = v; + this.temp_buff_time = time; + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("update_time",this.id)); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("updated",this.id)); + return true; + } else { + return false; + } + } + ,clearTempBuff: function() { + if(this.temp_buff_time > 0) { + this.temp_buff_time = 0; + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("update_time",this.id)); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("updated",this.id)); + } + } + ,handleSecond: function() { + if(this.temp_buff_time > 0) { + this.temp_buff_time--; + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("update_time",this.id)); + if(this.temp_buff_time == 0) { + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("updated",this.id)); + } + } + } + ,write: function(b,force) { + if(force == null) { + force = false; + } + if(force || this.perma_buff != 0 || this.temp_buff != 0 && this.temp_buff_time > 0) { + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.id); + b.writeByte(this.perma_buff & 255); + b.writeInt8(this.temp_buff); + b.writeUInt16(this.temp_buff_time); + } + } + ,read: function(b,version) { + this.perma_buff = b.readByte() & 255; + this.temp_buff = b.readInt8(); + this.temp_buff_time = version < 72 ? b.readByte() & 255 : b.readUInt16(); + } + ,__class__: com_davidmaletz_mining_Stat +}); +var com_davidmaletz_mining_State = function() { + openfl_events_EventDispatcher.call(this); + this.quests = []; + this.completeQuests = new com_fancyfish_faeng_common_Dequeue(); + this.questMap = new haxe_ds_StringMap(); + this.flags = new haxe_ds_StringMap(); + this.achievements = new haxe_ds_StringMap(); + this.vars = new haxe_ds_StringMap(); + this.tmpVars = new haxe_ds_StringMap(); + this.strings = new haxe_ds_StringMap(); + this.tiles = new haxe_ds_StringMap(); + this.enemies = new haxe_ds_StringMap(); + this.contacts = []; + this.recipes = new haxe_ds_StringMap(); +}; +$hxClasses["com.davidmaletz.mining.State"] = com_davidmaletz_mining_State; +com_davidmaletz_mining_State.__name__ = ["com","davidmaletz","mining","State"]; +com_davidmaletz_mining_State._getVar = function(vars,name) { + if(vars.exists(name)) { + return vars.get(name); + } else { + return 0; + } +}; +com_davidmaletz_mining_State.__super__ = openfl_events_EventDispatcher; +com_davidmaletz_mining_State.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + quests: null + ,completeQuests: null + ,questMap: null + ,flags: null + ,achievements: null + ,vars: null + ,tmpVars: null + ,tiles: null + ,enemies: null + ,contacts: null + ,strings: null + ,recipes: null + ,setQuest: function(q,complete) { + if(q == null) { + return null; + } + if(this.questMap.exists(q.id)) { + var c = this.questMap.get(q.id); + if(c == complete) { + return null; + } + if(c) { + this.completeQuests.remove(q); + } else { + HxOverrides.remove(this.quests,q); + } + } + this.questMap.set(q.id,complete); + return q; + } + ,getQuestCount: function(incComplete) { + return this.quests.length + (incComplete ? this.completeQuests.size() : 0); + } + ,getQuests: function() { + return HxOverrides.iter(this.quests); + } + ,getCompleteQuests: function() { + return this.completeQuests.iterator(); + } + ,hasQuest: function(id) { + return this.questMap.exists(id); + } + ,questComplete: function(id) { + return this.questMap.get(id) == true; + } + ,canCompleteQuest: function(p,id,inv) { + if(this.questMap.get(id) != false) { + return false; + } + var q = com_davidmaletz_mining_npc_Quest.get(id); + if(p.getCoins() < q.coins) { + return false; + } + var r = q.getRequirements(); + while(r.hasNext()) { + var r1 = r.next(); + if(!r1.isMet(p,inv)) { + return false; + } + } + return true; + } + ,addQuest: function(q) { + q = this.setQuest(q,false); + if(q != null) { + this.quests.push(q); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("add_quest",q)); + } + } + ,removeQuest: function(id) { + if(this.questMap.exists(id)) { + var q = com_davidmaletz_mining_npc_Quest.get(id); + if(this.questMap.get(id) == true) { + this.completeQuests.remove(q); + } else { + HxOverrides.remove(this.quests,q); + } + this.questMap.remove(id); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("add_quest",null)); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("rem_quest",q)); + } + } + ,removeQuestsByGiver: function(giver) { + var rem = null; + var q = this.getQuests(); + while(q.hasNext()) { + var q1 = q.next(); + if(q1.giver == giver) { + if(rem == null) { + rem = [q1]; + } else { + rem.push(q1); + } + } + } + if(rem != null) { + var _g = 0; + while(_g < rem.length) { + var q2 = rem[_g]; + ++_g; + this.removeQuest(q2.id); + } + } + } + ,completeQuest: function(p,q,useResources,inv,reserve,addExp) { + if(addExp == null) { + addExp = true; + } + if(reserve == null) { + reserve = 0; + } + if(useResources == null) { + useResources = true; + } + if(reserve == 3) { + if(this.questMap.get(q.id) != true) { + return false; + } + q = this.setQuest(q,false); + if(q == null) { + return false; + } + this.quests.push(q); + if(useResources) { + p.addCoins(q.coins); + var r = q.getRequirements(); + while(r.hasNext()) { + var r1 = r.next(); + r1.addResources(inv == null ? p.storehouseInventory : inv); + } + } + return true; + } + if(reserve != 2) { + if(useResources && !this.canCompleteQuest(p,q.id,inv) || this.questMap.get(q.id) != false) { + return false; + } + q = this.setQuest(q,true); + if(q == null) { + return false; + } + this.completeQuests.addFirst(q); + if(useResources) { + p.addCoins(-q.coins); + var r2 = q.getRequirements(); + while(r2.hasNext()) { + var r3 = r2.next(); + r3.useResources(inv == null ? p.storehouseInventory : inv); + } + } + } + if(reserve != 1) { + if(addExp) { + p.addExp(q.exp); + } + if(q.achievement != null) { + com_davidmaletz_faengfl_achievement_Achievements.instance.gainAchievement(q.achievement); + } + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("complete_quest",q)); + } + return true; + } + ,getRecipes: function(structure) { + if(this.recipes.exists(structure)) { + return HxOverrides.iter(this.recipes.get(structure)); + } else { + return new com_fancyfish_faeng_common_NullIterator(); + } + } + ,hasRecipe: function(structure,recipe) { + if(this.recipes.exists(structure)) { + var _g = 0; + var _g1 = this.recipes.get(structure); + while(_g < _g1.length) { + var r = _g1[_g]; + ++_g; + if(r == recipe) { + return true; + } + } + } + return false; + } + ,addRecipe: function(structure,recipe) { + if(this.recipes.exists(structure)) { + var ar = this.recipes.get(structure); + if(ar.indexOf(recipe) == -1) { + ar.push(recipe); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("add_recipe",new com_fancyfish_faeng_common_Pair(structure,recipe))); + return true; + } else { + return false; + } + } else { + this.recipes.set(structure,[recipe]); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("add_recipe",new com_fancyfish_faeng_common_Pair(structure,recipe))); + return true; + } + } + ,setFirstRecipe: function(structure,recipe) { + if(this.recipes.exists(structure)) { + var ar = this.recipes.get(structure); + if(HxOverrides.remove(ar,recipe)) { + ar.unshift(recipe); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("first_recipe",new com_fancyfish_faeng_common_Pair(structure,recipe))); + return true; + } else { + return false; + } + } else { + return false; + } + } + ,getContact: function(npc) { + var _g = 0; + var _g1 = this.contacts; + while(_g < _g1.length) { + var c = _g1[_g]; + ++_g; + if(c.first == npc) { + return c; + } + } + return null; + } + ,hasContact: function(npc) { + return this.getContact(npc) != null; + } + ,removeContact: function(npc) { + var c = this.getContact(npc); + if(c != null) { + HxOverrides.remove(this.contacts,c); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("update_contact",new com_fancyfish_faeng_common_Pair(c.first,null))); + } + } + ,setContact: function(npc,proc,quiet) { + if(quiet == null) { + quiet = false; + } + var c = this.getContact(npc); + if(c != null) { + c.second = proc; + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("update_contact",c)); + return; + } + var c1 = new com_fancyfish_faeng_common_Pair(npc,proc); + this.contacts.push(c1); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("update_contact",c1)); + var npc1 = com_davidmaletz_mining_world_ObjectInfo.get(npc); + if(npc1 == null || quiet) { + return; + } + var map = new haxe_ds_StringMap(); + map.set("{npc}",npc1.getDisplay(true)); + com_davidmaletz_faengfl_adv_sound_Sound.play("item"); + new com_davidmaletz_faengfl_ui_Popup(128.,52.,0,new com_fancyfish_faeng_common_mutable_MutableTemplateStatic(com_fancyfish_faeng_common_Lang.getText("common","add_contact"),map),16777215,-16777216,20,60,20,null,true); + } + ,getFlag: function(flag) { + return this.flags.exists(flag); + } + ,setFlag: function(flag,value) { + if(value != this.getFlag(flag)) { + if(value) { + this.flags.set(flag,true); + } else { + this.flags.remove(flag); + } + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("update_flag",flag)); + this.fireStateUpdated(); + } + } + ,getAchievement: function(a) { + return this.achievements.exists(a); + } + ,setAchievement: function(a,value) { + if(value != this.getAchievement(a)) { + if(value) { + this.achievements.set(a,true); + } else { + this.achievements.remove(a); + } + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("update_achievement",a)); + this.fireStateUpdated(); + } + } + ,_setVar: function(vars,name,value,event) { + if(value != com_davidmaletz_mining_State._getVar(vars,name)) { + vars.set(name,value); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent(event,name)); + this.fireStateUpdated(); + } + } + ,_addVar: function(vars,name,value,event) { + this._setVar(vars,name,com_davidmaletz_mining_State._getVar(vars,name) + value,event); + } + ,hasVar: function(name) { + return this.vars.exists(name); + } + ,getVar: function(name) { + return com_davidmaletz_mining_State._getVar(this.vars,name); + } + ,setVar: function(name,value) { + this._setVar(this.vars,name,value,"update_var"); + } + ,addVar: function(name,value) { + this._addVar(this.vars,name,value,"update_var"); + } + ,hasTmpVar: function(name) { + return this.tmpVars.exists(name); + } + ,getTmpVar: function(name) { + return com_davidmaletz_mining_State._getVar(this.tmpVars,name); + } + ,setTmpVar: function(name,value) { + this._setVar(this.tmpVars,name,value,"update_tmp_var"); + } + ,addTmpVar: function(name,value) { + this._addVar(this.tmpVars,name,value,"update_tmp_var"); + } + ,hasString: function(name) { + return this.strings.exists(name); + } + ,getString: function(name) { + if(this.strings.exists(name)) { + return this.strings.get(name); + } else { + return null; + } + } + ,setString: function(name,value) { + if(value != this.getString(name)) { + this.strings.set(name,value); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("update_string",name)); + this.fireStateUpdated(); + } + } + ,fireStateUpdated: function() { + this.dispatchEvent(new openfl_events_Event("state_changed")); + } + ,getDigCount: function(name) { + return com_davidmaletz_mining_State._getVar(this.tiles,name); + } + ,updateTilesMined: function() { + var ct = 0; + var v = this.tiles.iterator(); + while(v.hasNext()) { + var v1 = v.next(); + ct += v1; + } + com_davidmaletz_faengfl_achievement_Achievements.instance.submitScore("tiles_mined",ct); + } + ,setDigCount: function(name,value) { + this._setVar(this.tiles,name,value,"update_tile"); + this.updateTilesMined(); + } + ,addDigCount: function(name,value) { + this._addVar(this.tiles,name,value,"update_tile"); + this.updateTilesMined(); + } + ,getKillCount: function(name) { + return com_davidmaletz_mining_State._getVar(this.enemies,name); + } + ,updateEnemiesKilled: function() { + var ct = 0; + var v = this.enemies.iterator(); + while(v.hasNext()) { + var v1 = v.next(); + ct += v1; + } + com_davidmaletz_faengfl_achievement_Achievements.instance.submitScore("enemies_killed",ct); + } + ,setKillCount: function(name,value) { + this._setVar(this.enemies,name,value,"update_enemy"); + this.updateEnemiesKilled(); + } + ,addKillCount: function(name,value) { + this._addVar(this.enemies,name,value,"update_enemy"); + this.updateEnemiesKilled(); + } + ,write: function(b) { + b.writeByte(this.quests.length); + var _g = 0; + var _g1 = this.quests; + while(_g < _g1.length) { + var q = _g1[_g]; + ++_g; + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,q.id); + } + b.writeByte(this.completeQuests.size()); + var q1 = this.completeQuests.iterator(); + while(q1.hasNext()) { + var q2 = q1.next(); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,q2.id); + } + var f = this.flags.keys(); + while(f.hasNext()) { + var f1 = f.next(); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,f1); + } + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + var f2 = this.achievements.keys(); + while(f2.hasNext()) { + var f3 = f2.next(); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,f3); + } + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + var v = this.vars.keys(); + while(v.hasNext()) { + var v1 = v.next(); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,v1); + b.writeInt32(this.vars.get(v1)); + } + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + var v2 = this.strings.keys(); + while(v2.hasNext()) { + var v3 = v2.next(); + var s = this.strings.get(v3); + if(s != null) { + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,v3); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,s); + } + } + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + var v4 = this.tiles.keys(); + while(v4.hasNext()) { + var v5 = v4.next(); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,v5); + b.writeInt32(this.tiles.get(v5)); + } + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + var v6 = this.enemies.keys(); + while(v6.hasNext()) { + var v7 = v6.next(); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,v7); + b.writeInt32(this.enemies.get(v7)); + } + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + var _g2 = 0; + var _g11 = this.contacts; + while(_g2 < _g11.length) { + var c = _g11[_g2]; + ++_g2; + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,c.first); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,c.second); + } + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + var id = this.recipes.keys(); + while(id.hasNext()) { + var id1 = id.next(); + var ar = this.recipes.get(id1); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,id1); + var _g3 = 0; + while(_g3 < ar.length) { + var r = ar[_g3]; + ++_g3; + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,r.id); + } + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + } + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + } + ,readQuests: function(b,version) { + com_fancyfish_faeng_common_Utils.clear(this.quests); + this.completeQuests.clear(); + this.questMap = new haxe_ds_StringMap(); + var len = b.readByte() & 255; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + this.addQuest(com_davidmaletz_mining_npc_Quest.get(com_fancyfish_faeng_common_UTFUtils.readUTF(b))); + } + var len1 = b.readByte() & 255; + var _g11 = 0; + var _g2 = len1; + while(_g11 < _g2) { + var i1 = _g11++; + var q = this.setQuest(com_davidmaletz_mining_npc_Quest.get(com_fancyfish_faeng_common_UTFUtils.readUTF(b)),true); + if(q != null) { + this.completeQuests.addLast(q); + if(q.achievement != null) { + this.achievements.set(q.achievement,true); + com_davidmaletz_faengfl_achievement_Achievements.instance.gainAchievement(q.achievement,true); + } + } + } + } + ,readVars: function(b,version) { + if(version >= 15) { + var f; + while(true) { + f = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(!(f != null)) { + break; + } + this.flags.set(f,true); + } + } + if(version >= 73) { + var f1; + while(true) { + f1 = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(!(f1 != null)) { + break; + } + this.achievements.set(f1,true); + com_davidmaletz_faengfl_achievement_Achievements.instance.gainAchievement(f1,true); + } + } else { + var a = com_davidmaletz_faengfl_achievement_Achievements.instance.iterator(); + while(a.hasNext()) { + var a1 = a.next(); + this.achievements.set(a1,true); + } + } + if(version >= 16) { + var f2; + while(true) { + f2 = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(!(f2 != null)) { + break; + } + this.vars.set(f2,b.readInt32()); + } + } + if(version >= 68) { + var f3; + while(true) { + f3 = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(!(f3 != null)) { + break; + } + this.strings.set(f3,com_fancyfish_faeng_common_UTFUtils.readUTF(b)); + } + } + if(version >= 38) { + var f4; + while(true) { + f4 = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(!(f4 != null)) { + break; + } + this.tiles.set(f4,b.readInt32()); + } + while(true) { + f4 = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(!(f4 != null)) { + break; + } + var i = b.readInt32(); + var info = com_davidmaletz_mining_world_ObjectInfo._get(f4); + this.enemies.set(f4,i); + if(i > 0 && info != null && info.xml.exists("kill_achievement")) { + var a2 = info.xml.get("kill_achievement"); + this.achievements.set(a2,true); + com_davidmaletz_faengfl_achievement_Achievements.instance.gainAchievement(a2,true); + } + } + } + } + ,readContacts: function(b,version) { + if(version >= 60) { + var c; + while(true) { + c = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(!(c != null)) { + break; + } + this.contacts.push(new com_fancyfish_faeng_common_Pair(c,com_fancyfish_faeng_common_UTFUtils.readUTF(b))); + } + } + } + ,readRecipes: function(b,version) { + this.recipes = new haxe_ds_StringMap(); + var id; + while(true) { + id = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(!(id != null)) { + break; + } + var ar = []; + var r; + this.recipes.set(id,ar); + while(true) { + r = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(!(r != null)) { + break; + } + var _r = com_davidmaletz_mining_item_Recipe.get(r); + if(_r != null) { + ar.push(_r); + } + } + } + } + ,read: function(b,version) { + this.readQuests(b,version); + this.readVars(b,version); + this.readContacts(b,version); + this.readRecipes(b,version); + } + ,__class__: com_davidmaletz_mining_State +}); +var com_davidmaletz_mining_Stats = function() { + openfl_events_EventDispatcher.call(this); + this.stats = new haxe_ds_StringMap(); +}; +$hxClasses["com.davidmaletz.mining.Stats"] = com_davidmaletz_mining_Stats; +com_davidmaletz_mining_Stats.__name__ = ["com","davidmaletz","mining","Stats"]; +com_davidmaletz_mining_Stats.__super__ = openfl_events_EventDispatcher; +com_davidmaletz_mining_Stats.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + stats: null + ,get: function(id) { + var s = this.stats.get(id); + if(s == null) { + s = new com_davidmaletz_mining_Stat(id); + s.addEventListener("update_time",$bind(this,this.dispatchEvent)); + s.addEventListener("updated",$bind(this,this.dispatchEvent)); + this.stats.set(id,s); + } + return s; + } + ,getInt: function(id) { + var s = this.stats.get(id); + if(s == null) { + return 0; + } else { + return s.get(); + } + } + ,getPermaInt: function(id) { + var s = this.stats.get(id); + if(s == null) { + return 0; + } else { + return s.perma_buff; + } + } + ,handleSecond: function() { + var s = this.stats.iterator(); + while(s.hasNext()) { + var s1 = s.next(); + s1.handleSecond(); + } + } + ,iterator: function() { + return this.stats.iterator(); + } + ,write: function(b) { + var s = this.stats.iterator(); + while(s.hasNext()) { + var s1 = s.next(); + s1.write(b); + } + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + } + ,read: function(b,version) { + var id; + while(true) { + id = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(!(id != null)) { + break; + } + this.get(id).read(b,version); + } + } + ,__class__: com_davidmaletz_mining_Stats +}); +var com_davidmaletz_mining_effects_Fishing = function(e,r,a,water) { + this.hit = false; + this.key = null; + this.string = null; + this.rod = e; + this.renderer = r; + this.area = a; + if(water) { + com_davidmaletz_faengfl_adv_sound_Sound.play(com_davidmaletz_faengfl_adv_sound_Sound.resolve(null,this.rod.info.xml,"cast")); + } +}; +$hxClasses["com.davidmaletz.mining.effects.Fishing"] = com_davidmaletz_mining_effects_Fishing; +com_davidmaletz_mining_effects_Fishing.__name__ = ["com","davidmaletz","mining","effects","Fishing"]; +com_davidmaletz_mining_effects_Fishing.fish_loot = null; +com_davidmaletz_mining_effects_Fishing.fish_xml = null; +com_davidmaletz_mining_effects_Fishing.nothing = function() { +}; +com_davidmaletz_mining_effects_Fishing.default_xml = null; +com_davidmaletz_mining_effects_Fishing.setDefault = function(e,path) { + com_davidmaletz_mining_effects_Fishing.default_xml = e; +}; +com_davidmaletz_mining_effects_Fishing.hasDefault = function() { + return com_davidmaletz_mining_effects_Fishing.default_xml != null; +}; +com_davidmaletz_mining_effects_Fishing.prototype = { + rod: null + ,renderer: null + ,string: null + ,area: null + ,icon: null + ,key: null + ,count: null + ,rounds: null + ,hit: null + ,loot: null + ,popup: null + ,exp: null + ,difficulty: null + ,start: function(fishable,cancel) { + if(!cancel && this.area != null) { + var f = fishable; + if(f == -1) { + return; + } + var water = f == 1; + if(water) { + var xml = com_davidmaletz_mining_world_Generate.get(this.area.id); + var iter; + var tmp; + if(xml != null) { + iter = xml.elementsNamed("fishing"); + tmp = !iter.hasNext(); + } else { + tmp = true; + } + if(tmp) { + if(com_davidmaletz_mining_effects_Fishing.default_xml == null) { + return; + } + iter = new com_fancyfish_faeng_common_SingleIterator(com_davidmaletz_mining_effects_Fishing.default_xml); + } + var x = iter.next(); + if(x != com_davidmaletz_mining_effects_Fishing.fish_xml) { + com_davidmaletz_mining_effects_Fishing.fish_xml = x; + com_davidmaletz_mining_effects_Fishing.fish_loot = new com_davidmaletz_mining_LootHandler(x.elementsNamed("loot")); + com_davidmaletz_mining_effects_Fishing.success = 0; + } + var i = com_davidmaletz_mining_effects_Fishing.fish_loot.getLoot(1.0 / (com_davidmaletz_mining_effects_Fishing.success * 0.25 + 1)); + if(i == null) { + water = false; + } else { + this.loot = i; + this.difficulty = (i.xml.exists("difficulty") ? com_davidmaletz_mining_Main.parseInt(i.xml.get("difficulty")) : 0) + 1 - ((js_Boot.__cast(this.rod.info , com_davidmaletz_mining_item_Equipment)).getFishing(this.rod.getNameStr()) + this.renderer.player.stats.getInt("fishing")); + if(this.difficulty < 0) { + this.difficulty = 0; + } + this.rounds = this.difficulty; + if(this.rounds > 0 && Math.random() < 0.5) { + this.rounds++; + } + if(this.difficulty > com_davidmaletz_mining_effects_Fishing.KEYS.length) { + this.difficulty = com_davidmaletz_mining_effects_Fishing.KEYS.length; + this.rounds = this.difficulty; + this.loot = null; + this.exp = 0; + } else { + this.exp = this.rounds + 1; + } + } + } + if(water) { + this.string = new com_davidmaletz_tiles_render_PlayAnimation(com_davidmaletz_tiles_Tile.get("fishing_line"),"fishing_line.cast",this.renderer.getFramesPerSecond(),false); + this.renderer.addChild(this.string); + } + this.renderer.addEventListener("removedFromStage",$bind(this,this._clear)); + var m = this.renderer.player.equipment.get("weapon"); + if(m != null) { + m.addEventListener("updated",$bind(this,this._clear)); + } + this.renderer.player.addEventListener("change_health",$bind(this,this.changeHealth)); + this.count = Math.floor(Math.random() * 6 + 2); + this.playAnim("cast",water ? $bind(this,this.handleFirst) : $bind(this,this.clear),false); + this.renderer.player.clearOverlap(); + } + } + ,handleFirst: function(cancel) { + if(cancel) { + this.clear(); + } else { + com_davidmaletz_controls_Controller.instance.addEventListener("tap",$bind(this,this.onKey),false,1); + com_davidmaletz_controls_Controller.instance.addEventListener("release",$bind(this,this.resetKey)); + this.handle(cancel); + } + } + ,waitKey: null + ,resetKey: function(e) { + if(this.waitKey == e.key) { + this.waitKey = null; + } + } + ,onKey: function(e) { + if(this.waitKey != null || e.key == "cancel" || e.key == "inventory" || e.key == "quest" || e.key == "equipment" || e.key == "mute") { + return; + } + if(this.rounds < 0) { + return; + } + e.stopImmediatePropagation(); + this.waitKey = e.key; + if(e.key == this.key) { + if(this.area != null && this.count <= 0) { + if(this.rounds > 0) { + if(this.popup != null) { + com_davidmaletz_faengfl_FaengFL.remove(this.popup); + } + new com_davidmaletz_faengfl_ui_Popup(128.,43.199999999999996,0,com_fancyfish_faeng_common_Lang.getText("common","fishing_hooked")); + this.rounds--; + this.count = Math.floor(Math.random() * 3 + 2); + this.handle(false); + return; + } + if(this.loot == null || this.loot.item == null) { + this.fail(); + } else { + if(this.popup != null) { + com_davidmaletz_faengfl_FaengFL.remove(this.popup); + } + if(this.string != null) { + com_davidmaletz_faengfl_FaengFL.remove(this.string); + this.string = null; + } + this.rounds = -1; + this.icon = this.loot.item.createIcon(); + this.icon.set_x(-com_davidmaletz_tiles_Tile.SIZE * 0.5); + this.icon.set_y(-com_davidmaletz_tiles_Tile.SIZE * 0.5); + this.icon.set_rotation(90); + this.renderer.addChild(this.icon); + this.renderer.playEquipAnim("caught",$bind(this,this.get)); + } + } else if(this.hit) { + this.fail(); + } else { + this.clear(); + } + } else if(this.hit) { + this.fail(); + } else { + this.clear(); + } + } + ,get: function(cancel) { + if(this.loot.xml != null && this.loot.xml.exists("achievement")) { + com_davidmaletz_faengfl_achievement_Achievements.instance.gainAchievement(this.loot.xml.get("achievement")); + } + this.renderer.player.addExp(this.exp); + this.renderer.player.addItems(this.loot.item,this.loot.count); + var s = com_davidmaletz_mining_effects_Fishing.success + 1; + this.clear(); + com_davidmaletz_mining_effects_Fishing.success = s; + } + ,playAnim: function(id,onComplete,updateString) { + if(updateString == null) { + updateString = true; + } + this.renderer.playEquipAnim(id,onComplete); + if(updateString && this.string != null) { + this.string.playAnimation("fishing_line." + id,false); + this.string.setFrame(0); + } + } + ,handle: function(cancel) { + if(cancel) { + this.clear(); + return; + } + this.count--; + if(this.count <= 0) { + this.key = com_davidmaletz_mining_effects_Fishing.KEYS[Math.floor(Math.random() * this.difficulty)]; + this.popup = new com_davidmaletz_mining_ui_KeyTooltip(true,this.key,128.,43.199999999999996,com_fancyfish_faeng_common_Lang.getText("common",this.hit ? "fishing_pull" : "fishing_line"),16777215,-16777216,false,com_davidmaletz_mining_effects_Fishing.nothing); + com_davidmaletz_faengfl_adv_sound_Sound.play("fishing"); + this.playAnim("catch",$bind(this,this.fail)); + this.hit = true; + } else { + this.playAnim("fishing",$bind(this,this.handle)); + } + } + ,fail: function(cancel) { + if(cancel == null) { + cancel = false; + } + new com_davidmaletz_faengfl_ui_Popup(128.,43.199999999999996,0,com_fancyfish_faeng_common_Lang.getText("common","fishing_fail")); + this.clear(); + } + ,_clear: function(e) { + this.clear(); + } + ,changeHealth: function(e) { + if(e.delta < 0 && e.attacker != null) { + this.clear(); + } + } + ,clear: function(cancel) { + if(cancel == null) { + cancel = false; + } + this.renderer.clearEquipAnim(); + com_davidmaletz_mining_effects_Fishing.success >>= 1; + var m = this.renderer.player.equipment.get("weapon"); + if(m != null) { + m.removeEventListener("updated",$bind(this,this._clear)); + } + this.renderer.player.removeEventListener("change_health",$bind(this,this.changeHealth)); + this.renderer.removeEventListener("removedFromStage",$bind(this,this._clear)); + com_davidmaletz_controls_Controller.instance.removeEventListener("tap",$bind(this,this.onKey)); + com_davidmaletz_controls_Controller.instance.removeEventListener("release",$bind(this,this.resetKey)); + if(this.renderer.player.area != null) { + this.renderer.player.overlapChanged(); + } + if(this.renderer.player.vehicle != null) { + this.renderer.player.vehicle.checkTooltip(); + } + if(this.popup != null) { + com_davidmaletz_faengfl_FaengFL.remove(this.popup); + } + if(this.string != null) { + com_davidmaletz_faengfl_FaengFL.remove(this.string); + this.string = null; + } + if(this.icon != null) { + com_davidmaletz_faengfl_FaengFL.remove(this.icon); + this.icon = null; + } + } + ,__class__: com_davidmaletz_mining_effects_Fishing +}; +var com_davidmaletz_mining_effects_Fog = function(area,data,a,dx,dy,r) { + openfl_display_Sprite.call(this); + this.area = area; + var noise = openfl_Assets.getBitmapData(data); + this.set_alpha(this._alpha = a); + if(r != null && !r.contains(this.get_x(),this.get_y())) { + this.set_alpha(0); + } + this.inner = new openfl_display_Sprite(); + var g = this.inner.get_graphics(); + g.beginBitmapFill(noise,null,true,false); + g.drawRect(0,0,512,512); + g.endFill(); + this.addChild(this.inner); + this.bounds = r; + this.dx = dx; + this.dy = dy; + this._x = -Math.floor(Math.random() * 256); + this._y = -Math.floor(Math.random() * 256); + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); +}; +$hxClasses["com.davidmaletz.mining.effects.Fog"] = com_davidmaletz_mining_effects_Fog; +com_davidmaletz_mining_effects_Fog.__name__ = ["com","davidmaletz","mining","effects","Fog"]; +com_davidmaletz_mining_effects_Fog.__super__ = openfl_display_Sprite; +com_davidmaletz_mining_effects_Fog.prototype = $extend(openfl_display_Sprite.prototype,{ + area: null + ,inner: null + ,_x: null + ,_y: null + ,dx: null + ,dy: null + ,_alpha: null + ,bounds: null + ,init: function(e) { + this.destroy(e); + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.enter_frame)); + this.enter_frame(e); + } + ,destroy: function(e) { + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.enter_frame)); + } + ,enter_frame: function(e) { + var frames = com_davidmaletz_faengfl_FaengFL.frameTime; + this._x += this.dx * frames; + this._y += this.dy * frames; + var s = com_davidmaletz_mining_Main._getScale(); + var x = this.area.get_x() * s + this._x; + var y = this.area.get_y() * s + this._y; + this.set_scaleX(this.set_scaleY(1.0 / s)); + this.inner.set_x(Math.round(-com_fancyfish_faeng_common_Utils.mod(-x,256))); + this.inner.set_y(Math.round(-com_fancyfish_faeng_common_Utils.mod(-y,256))); + if(this.bounds != null) { + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p == null || p.getHealth() <= 0) { + return; + } + var x1 = p.getTileCenX() * com_davidmaletz_tiles_Tile.SIZE; + var y1 = p.getTileCenY() * com_davidmaletz_tiles_Tile.SIZE; + if(this.bounds.contains(x1,y1)) { + this.set_alpha(this._alpha); + } else { + var dx = x1 < this.bounds.x ? this.bounds.x - x1 : x1 - this.bounds.get_right(); + var dy = y1 < this.bounds.y ? this.bounds.y - y1 : y1 - this.bounds.get_bottom(); + var d = Math.min(1 - dx / 256,1 - dy / 144); + this.set_alpha(d < 0 ? 0 : d * this._alpha); + } + } + } + ,__class__: com_davidmaletz_mining_effects_Fog +}); +var com_davidmaletz_mining_effects_Scene = function(xml) { + var _gthis = this; + this.id = xml.get("id"); + var sec = "scene." + this.id + "."; + var action_map = new haxe_ds_StringMap(); + action_map.set("tilesheet",function(e,path) { + com_davidmaletz_tiles_Tile.loadTilesheet(path + e.get("id"),new com_davidmaletz_faengfl_XmlPath(e,path)); + }); + action_map.set("tile",function(e1,path1) { + var tmp = e1.get("id"); + com_davidmaletz_tiles_Tile.setTile(sec + tmp,path1,e1); + }); + action_map.set("animation",function(e2,path2) { + var tmp1 = e2.get("id"); + com_davidmaletz_tiles_TileAnimation.setAnimation(sec + tmp1,e2); + }); + this.layers = new haxe_ds_StringMap(); + this.map = new haxe_ds_StringMap(); + action_map.set("layer",function(e3,path3) { + var l = _gthis.makeLayer(e3,path3); + if(l != null) { + _gthis.layers.set(e3.get("id"),l); + } + }); + action_map.set("show",function(e4,path4) { + if(!_gthis.map.exists(e4.get("id"))) { + _gthis.map.set(e4.get("id"),new com_davidmaletz_faengfl_XmlPath(e4,path4)); + } + }); + com_davidmaletz_faengfl_EventHandler._parse(xml,action_map).start(); +}; +$hxClasses["com.davidmaletz.mining.effects.Scene"] = com_davidmaletz_mining_effects_Scene; +com_davidmaletz_mining_effects_Scene.__name__ = ["com","davidmaletz","mining","effects","Scene"]; +com_davidmaletz_mining_effects_Scene.scenes = null; +com_davidmaletz_mining_effects_Scene.loadScene = function(xml) { + if(com_davidmaletz_mining_effects_Scene.scenes == null) { + com_davidmaletz_mining_effects_Scene.scenes = new haxe_ds_StringMap(); + } + var id = xml.get("id"); + if(com_davidmaletz_mining_effects_Scene.scenes.exists(id)) { + haxe_Log.trace("Overwrite Scene: " + id,{ fileName : "Scene.hx", lineNumber : 113, className : "com.davidmaletz.mining.effects.Scene", methodName : "loadScene"}); + } + com_davidmaletz_mining_effects_Scene.scenes.set(id,new com_davidmaletz_mining_effects__$Scene_SceneData(xml)); +}; +com_davidmaletz_mining_effects_Scene.get = function(id) { + var ret = com_davidmaletz_mining_effects_Scene._get(id); + if(id != null && id.length > 0 && ret == null) { + haxe_Log.trace("No Scene found: " + id,{ fileName : "Scene.hx", lineNumber : 116, className : "com.davidmaletz.mining.effects.Scene", methodName : "get"}); + } + return ret; +}; +com_davidmaletz_mining_effects_Scene._get = function(id) { + if(com_davidmaletz_mining_effects_Scene.scenes == null || id == null) { + return null; + } + var s = com_davidmaletz_mining_effects_Scene.scenes.get(id); + if(s == null) { + return null; + } else { + return s.getScene(); + } +}; +com_davidmaletz_mining_effects_Scene.getXML = function(id) { + if(com_davidmaletz_mining_effects_Scene.scenes == null || id == null) { + return null; + } + var s = com_davidmaletz_mining_effects_Scene.scenes.get(id); + if(s == null) { + return null; + } else { + return s.xml; + } +}; +com_davidmaletz_mining_effects_Scene.reset = function() { + com_davidmaletz_mining_effects_Scene.scenes = null; +}; +com_davidmaletz_mining_effects_Scene.parseAlign = function(a) { + switch(a) { + case "center": + return 1; + case "right": + return 2; + default: + return 0; + } +}; +com_davidmaletz_mining_effects_Scene.makeText = function(n,path) { + var m = com_fancyfish_faeng_common_Lang.getTextFromTitle(n.get("text")); + var align = com_davidmaletz_mining_effects_Scene.parseAlign(n.get("align")); + var s = 1.0; + var w = com_davidmaletz_mining_Main.parseFloat(n.get("width")); + if(n.exists("scale")) { + s = com_davidmaletz_mining_Main.parseFloat(n.get("scale")); + } + w /= s; + var t = n.get("reveal") == "true" ? new com_davidmaletz_mining_ui_MyRevealText(com_davidmaletz_mining_Main.getContainer(),w,true,null,align) : new com_davidmaletz_faengfl_FormattedText(w,true,null,align); + if(n.exists("color")) { + t.default_color = com_davidmaletz_mining_Main.parseInt("0x" + n.get("color")); + } + if(n.exists("font")) { + var f = com_fancyfish_faeng_text_FontManager.get(n.get("font")); + if(f != null && f.get() != null) { + t.default_font = f; + } else { + t.default_font = new com_fancyfish_faeng_common_mutable_Static(com_fancyfish_faeng_common_Lang.getFontCached(com_davidmaletz_mining_Main.getResource(path,n.get("font")),false)); + } + } + t.set_scaleX(t.set_scaleY(s)); + var txt = m == null ? n.get("text") : m.get(); + if(txt != null) { + t.setText(txt); + } + t.set_x(n.exists("x") ? com_davidmaletz_mining_Main.parseInt(n.get("x")) : 0); + t.set_y(n.exists("y") ? com_davidmaletz_mining_Main.parseInt(n.get("y")) : 0); + if(n.exists("height")) { + var _g = t; + _g.set_y(_g.get_y() + Math.floor(com_davidmaletz_mining_Main.parseFloat(n.get("height")) - t.default_font.get().lineHeight * s) * 0.5); + } + return t; +}; +com_davidmaletz_mining_effects_Scene.prototype = { + id: null + ,map: null + ,layers: null + ,images: null + ,makeLayer: function(n,path,vars) { + var sec = "scene." + this.id + "."; + var s = null; + var solid = false; + if(n.exists("image")) { + if(n.exists("animation")) { + var data = com_davidmaletz_mining_structure_StructureInfo.createTile(n,path); + var anim = n.get("animation"); + if(com_davidmaletz_tiles_TileAnimation.exists(sec + anim)) { + anim = sec + anim; + } + s = new com_davidmaletz_tiles_render_StaticPlayAnimation(data.tile,anim,n.exists("fps") ? com_davidmaletz_mining_Main.parseFloat(n.get("fps")) : 10,true); + } else { + if(this.images == null) { + this.images = new haxe_ds_StringMap(); + } + var id = n.get("image"); + var b = this.images.get(id); + if(b == null) { + b = openfl_Assets.getBitmapData(com_davidmaletz_mining_Main.getResource(path,id)); + this.images.set(id,b); + } + var inner = new openfl_display_Bitmap(b); + var lerp = new com_davidmaletz_lerp_LerpSprite(); + lerp.addChild(inner); + s = lerp; + } + } else if(n.exists("tile")) { + var t = com_davidmaletz_tiles_Tile.exists(sec + n.get("tile")) ? com_davidmaletz_tiles_Tile.get(sec + n.get("tile")) : com_davidmaletz_tiles_Tile.get(n.get("tile")); + if(t == null) { + return null; + } + if(n.exists("animation")) { + var anim1 = n.get("animation"); + var fps = n.exists("fps") ? com_davidmaletz_mining_Main.parseFloat(n.get("fps")) : 10; + if(com_davidmaletz_tiles_TileAnimation.exists(sec + anim1)) { + anim1 = sec + anim1; + } + var offsetX = n.exists("offsetX") ? com_davidmaletz_mining_Main.parseFloat(n.get("offsetX")) : 0; + var offsetY = n.exists("offsetY") ? com_davidmaletz_mining_Main.parseFloat(n.get("offsetY")) : 0; + if(n.get("removeOnComplete") == "true") { + s = new com_davidmaletz_tiles_render_StaticPlayAnimation(t,anim1,fps,false,com_davidmaletz_faengfl_FaengFL.remove,offsetX,offsetY); + } else { + var talk = n.get("talk"); + if(talk == null) { + talk = anim1; + } else if(com_davidmaletz_tiles_TileAnimation.exists(sec + talk)) { + talk = sec + talk; + } + s = new com_davidmaletz_mining_effects__$Scene_TalkLayer(sec,n.get("id"),t,anim1,talk,fps,n.get("sfx"),offsetX,offsetY); + } + } else { + var inner1 = com_davidmaletz_mining_item_ItemInfo._createIcon(t,com_davidmaletz_mining_npc_NPCEventHandler.evalInt(n.get("offX"),vars),com_davidmaletz_mining_npc_NPCEventHandler.evalInt(n.get("offY"),vars)); + var lerp1 = new com_davidmaletz_lerp_LerpSprite(); + lerp1.addChild(inner1); + s = lerp1; + } + } else if(n.exists("color")) { + var _s = new com_davidmaletz_lerp_LerpSprite(); + var g = _s.get_graphics(); + g.beginFill(com_davidmaletz_mining_Main.parseInt("0x" + n.get("color")),n.exists("alpha") ? com_davidmaletz_mining_Main.parseFloat(n.get("alpha")) : 1); + g.drawRect(0,0,com_davidmaletz_mining_Main.parseInt(n.get("width")),com_davidmaletz_mining_Main.parseInt(n.get("height"))); + g.endFill(); + s = _s; + solid = true; + } + if(s == null) { + return null; + } + if(!solid) { + var c = 16777215; + if(n.exists("color")) { + c = com_davidmaletz_mining_Main.parseInt("0x" + n.get("color")); + } + var cs = 1.0; + if(n.exists("colorScale")) { + cs = com_davidmaletz_mining_Main.parseFloat(n.get("colorScale")); + } + com_davidmaletz_faengfl_TextSprite.setColor(s,c,255 / cs); + } + if(n.exists("x")) { + s.set_x(com_davidmaletz_mining_Main.parseFloat(n.get("x"))); + } + if(n.exists("y")) { + s.set_y(com_davidmaletz_mining_Main.parseFloat(n.get("y"))); + } + if(n.get("flip") == "true") { + s.set_scaleX(-1); + var _g = s; + _g.set_x(_g.get_x() + 256); + } + return s; + } + ,getLayer: function(n,path,vars) { + var id = n.get("id"); + if(id == null && n.exists("eval")) { + id = com_davidmaletz_mining_npc_NPCEventHandler.evalString(n.get("eval"),vars); + } + if(id != null) { + var l = this.layers.get(id); + if(l != null) { + return l; + } + l = this.makeLayer(n,path,vars); + if(l != null) { + this.layers.set(id,l); + } + return l; + } else { + return this.makeLayer(n,path,vars); + } + } + ,show: function(id,p,onComplete,fadeInFrames,showToAll) { + if(showToAll == null) { + showToAll = false; + } + if(fadeInFrames == null) { + fadeInFrames = 0; + } + var xml = this.map.get(id); + if(xml != null) { + new com_davidmaletz_mining_effects_Show(id,p,this,xml,onComplete,fadeInFrames,showToAll); + } else if(onComplete != null) { + onComplete(null); + } + } + ,__class__: com_davidmaletz_mining_effects_Scene +}; +var com_davidmaletz_mining_effects__$Scene_SceneData = function(e) { + this.xml = e; + this.scene = null; +}; +$hxClasses["com.davidmaletz.mining.effects._Scene.SceneData"] = com_davidmaletz_mining_effects__$Scene_SceneData; +com_davidmaletz_mining_effects__$Scene_SceneData.__name__ = ["com","davidmaletz","mining","effects","_Scene","SceneData"]; +com_davidmaletz_mining_effects__$Scene_SceneData.prototype = { + xml: null + ,scene: null + ,getScene: function() { + if(this.scene == null) { + this.scene = new com_davidmaletz_mining_effects_Scene(this.xml); + } + return this.scene; + } + ,__class__: com_davidmaletz_mining_effects__$Scene_SceneData +}; +var com_davidmaletz_mining_effects_Show = function(id,p,scene,xml,onComplete,fadeInFrames,showToAll) { + var _gthis = this; + com_davidmaletz_lerp_LerpSprite.call(this); + this.id = id; + this.scene = scene; + if(xml.exists("sound")) { + this.channel = com_davidmaletz_faengfl_adv_sound_Sound.play(xml.get("sound"),true); + } else { + this.channel = null; + } + var func; + if(fadeInFrames > 0) { + func = function() { + _gthis.showBelow(); + var f = onComplete; + var a1 = _gthis; + var func1 = function() { + f(a1); + }; + _gthis._lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),fadeInFrames,func1); + }; + } else { + var f1 = onComplete; + var a11 = this; + func = function() { + f1(a11); + }; + } + if(fadeInFrames > 0) { + this.set_alpha(0); + this._lerp(new com_davidmaletz_lerp_AlphaKeyframe(),fadeInFrames,$bind(this,this.hideBelow)); + } else { + this.hideBelow(); + } + com_davidmaletz_mining_Main.getContainer().addDisplay(this,3); + new com_davidmaletz_mining_effects_SceneEventHandler(xml,p,this,showToAll,func).runAll(); +}; +$hxClasses["com.davidmaletz.mining.effects.Show"] = com_davidmaletz_mining_effects_Show; +com_davidmaletz_mining_effects_Show.__name__ = ["com","davidmaletz","mining","effects","Show"]; +com_davidmaletz_mining_effects_Show.__super__ = com_davidmaletz_lerp_LerpSprite; +com_davidmaletz_mining_effects_Show.prototype = $extend(com_davidmaletz_lerp_LerpSprite.prototype,{ + id: null + ,scene: null + ,channel: null + ,_lerp: function(k,frames,onComplete) { + var modal = new com_davidmaletz_faengfl_transition_LerpModal(this,null); + var func = function() { + modal.kill(null); + onComplete(); + }; + this.lerp(k,frames,func); + } + ,hideBelow: function() { + com_davidmaletz_mining_Main.setAmbient(null,com_fancyfish_faeng_renderer_Color.WHITE); + com_davidmaletz_mining_Main.layersBelowVisible(3,false); + } + ,showBelow: function() { + com_davidmaletz_mining_Main.layersBelowVisible(3,true); + com_davidmaletz_mining_Main.__setGameTime(com_davidmaletz_mining_Main._getGameTime() + 0.00066666666666666664,0); + } + ,destroy: function(e) { + com_davidmaletz_lerp_LerpSprite.prototype.destroy.call(this,e); + if(e != null) { + this.showBelow(); + if(this.channel != null) { + this.channel.stop(); + this.channel = null; + } + } + } + ,__class__: com_davidmaletz_mining_effects_Show +}); +var com_davidmaletz_mining_npc_NPCEventHandler = function(xml,p,o,func,v,ev) { + this.clearNPCs = true; + this.npcs = null; + com_davidmaletz_faengfl_EventHandler.call(this,xml,func,v); + com_davidmaletz_mining_npc_NPCEventHandler.setPlayerVariables(this.vars,p); + this.area = this.vars.get("area"); + if(p == null) { + p = com_davidmaletz_mining_Main.getLocalPlayer(); + } + this.area_id = this.area == null ? null : this.area.id; + this.area_x = p.get_tile_x(); + this.area_y = p.get_tile_y(); + if(o != null) { + this.vars.set("this",o); + } + this.player = p; + this.events = ev; + this.__is_action_key = true; + this.setLocal("changePlayer",$bind(this,this.changePlayer)); + this.setLocal("setPlayer",$bind(this,this.setPlayer)); + this.setLocal("updateArea",$bind(this,this.updateArea)); + this.setLocal("lockNPC",$bind(this,this.checkNPC)); + this.setLocal("unlockNPC",$bind(this,this.unlockNPC)); + this.setLocal("setControl",$bind(this,this.setControl)); +}; +$hxClasses["com.davidmaletz.mining.npc.NPCEventHandler"] = com_davidmaletz_mining_npc_NPCEventHandler; +com_davidmaletz_mining_npc_NPCEventHandler.__name__ = ["com","davidmaletz","mining","npc","NPCEventHandler"]; +com_davidmaletz_mining_npc_NPCEventHandler.createVariables = function(p) { + var vars = com_davidmaletz_faengfl_EventHandler.createVariables(); + if(p != null) { + com_davidmaletz_mining_npc_NPCEventHandler.setPlayerVariables(vars,p); + } + return vars; +}; +com_davidmaletz_mining_npc_NPCEventHandler.getArea = function(p,id) { + return p.areas.get(id); +}; +com_davidmaletz_mining_npc_NPCEventHandler.setPlayerVariables = function(vars,p) { + var area = p == null ? null : p.getCurrentArea(); + if(p == null) { + p = com_davidmaletz_mining_Main.getLocalPlayer(); + } + if(p == null) { + return; + } + vars.set("player",p); + if(area == null) { + area = vars.get("area"); + } else { + vars.set("area",area); + } + if(area == null && com_davidmaletz_mining_Main.currentAreaRenderer != null) { + area = com_davidmaletz_mining_Main.currentAreaRenderer.area; + vars.set("area",area); + } + vars.set("getFlag",$bind(p,p.getFlag)); + vars.set("setFlag",$bind(p,p.setFlag)); + vars.set("getVar",$bind(p,p.getVar)); + vars.set("setVar",$bind(p,p.setVar)); + vars.set("getString",$bind(p,p.getString)); + vars.set("setString",$bind(p,p.setString)); + var p1 = p; + vars.set("getArea",function(id) { + return com_davidmaletz_mining_npc_NPCEventHandler.getArea(p1,id); + }); + var a1 = area; + vars.set("mine",function(x,y,a2,a3) { + return com_davidmaletz_mining_npc_NPCEventHandler.mine(a1,x,y,a2,a3); + }); + var p2 = p; + var a11 = area; + vars.set("buildStructure",function(id1,x1,y1) { + return com_davidmaletz_mining_npc_NPCEventHandler._buildStructure(p2,a11,id1,x1,y1); + }); + var a12 = area; + vars.set("setTile",function(x2,y2,a4) { + com_davidmaletz_mining_npc_NPCEventHandler.setTile(a12,0,true,x2,y2,a4); + }); + var a13 = area; + vars.set("setBack",function(x3,y3,a41) { + com_davidmaletz_mining_npc_NPCEventHandler.setTile(a13,3,true,x3,y3,a41); + }); + var a14 = area; + vars.set("setTileUnsynced",function(x4,y4,a42) { + com_davidmaletz_mining_npc_NPCEventHandler.setTile(a14,0,false,x4,y4,a42); + }); + var a15 = area; + vars.set("setBackUnsynced",function(x5,y5,a43) { + com_davidmaletz_mining_npc_NPCEventHandler.setTile(a15,3,false,x5,y5,a43); + }); + var a16 = area; + vars.set("setOreUnsynced",function(x6,y6,a44) { + com_davidmaletz_mining_npc_NPCEventHandler.setTile(a16,1,false,x6,y6,a44); + }); + var a17 = area; + vars.set("setOre",function(x7,y7,a45) { + com_davidmaletz_mining_npc_NPCEventHandler.setTile(a17,1,true,x7,y7,a45); + }); + var p3 = p; + vars.set("inLocation",function(id2,x8,y8,w,h) { + return com_davidmaletz_mining_npc_Requirement._inLocation(p3,id2,x8,y8,w,h); + }); + var a18 = vars; + vars.set("hasXmlElement",function(i) { + return com_davidmaletz_mining_npc_NPCEventHandler.hasXmlElement(a18,i); + }); +}; +com_davidmaletz_mining_npc_NPCEventHandler.clearPlayerVariables = function(vars) { + vars.set("player",null); + vars.set("area",null); + vars.set("getFlag",null); + vars.set("setFlag",null); + vars.set("getVar",null); + vars.set("setVar",null); + vars.set("getString",null); + vars.set("setString",null); + vars.set("getArea",null); + vars.set("mine",null); + vars.set("setTile",null); + vars.set("setOre",null); + vars.set("updateArea",null); + vars.set("hasXmlElement",null); +}; +com_davidmaletz_mining_npc_NPCEventHandler.hasXmlElement = function(vars,i) { + if(!i.hasNext()) { + return false; + } + var e = i.next(); + if(!(!e.exists("if"))) { + return com_davidmaletz_faengfl_EventHandler._conditionMet(e.get("if"),vars); + } else { + return true; + } +}; +com_davidmaletz_mining_npc_NPCEventHandler.mine = function(area,x,y,light,tile) { + if(light == null) { + light = 0; + } + var t = tile != null ? area.addTileIndex(tile) : area.getTileId(x,y,0); + return area.mine(x,y,t,light,null); +}; +com_davidmaletz_mining_npc_NPCEventHandler.setTile = function(area,layer,sendEvent,x,y,tile) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + if(!sendEvent) { + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + } + com_davidmaletz_mining_world_GenerateEventHandler._setTile(area,x,y,layer,tile); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; +}; +com_davidmaletz_mining_npc_NPCEventHandler.alphaPulse1 = function(p) { + var p1 = p; + var tmp = function() { + com_davidmaletz_mining_npc_NPCEventHandler.alphaPulse2(p1); + }; + p.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0.75),40,tmp); +}; +com_davidmaletz_mining_npc_NPCEventHandler.alphaPulse2 = function(p) { + var p1 = p; + var tmp = function() { + com_davidmaletz_mining_npc_NPCEventHandler.alphaPulse1(p1); + }; + p.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0.5),40,tmp); +}; +com_davidmaletz_mining_npc_NPCEventHandler.bob1 = function(p) { + var p1 = p; + var tmp = function() { + com_davidmaletz_mining_npc_NPCEventHandler.bob2(p1); + }; + p.lerp(new com_davidmaletz_lerp_YKeyframe(p.get_y() - com_davidmaletz_tiles_Tile.SIZE),120,tmp); +}; +com_davidmaletz_mining_npc_NPCEventHandler.bob2 = function(p) { + var p1 = p; + var tmp = function() { + com_davidmaletz_mining_npc_NPCEventHandler.bob1(p1); + }; + p.lerp(new com_davidmaletz_lerp_YKeyframe(p.get_y() + com_davidmaletz_tiles_Tile.SIZE),120,tmp); +}; +com_davidmaletz_mining_npc_NPCEventHandler.advanceTrack = function(r,track,len) { + r.tracks.advanceTrack(track,r,Math.random() * (len - 1)); +}; +com_davidmaletz_mining_npc_NPCEventHandler.handleAnimations = function(r,xml) { + if(xml.get("alphaPulse") == "true") { + r.set_alpha(0.5); + com_davidmaletz_mining_npc_NPCEventHandler.alphaPulse1(r); + com_davidmaletz_mining_npc_NPCEventHandler.advanceTrack(r,com_davidmaletz_lerp_AlphaKeyframe,40); + } + if(xml.get("bob") == "true") { + com_davidmaletz_mining_npc_NPCEventHandler.bob1(r); + com_davidmaletz_mining_npc_NPCEventHandler.advanceTrack(r,com_davidmaletz_lerp_YKeyframe,120); + } + return r; +}; +com_davidmaletz_mining_npc_NPCEventHandler.makeTile = function(t,n,vars) { + var s; + var offsetX = n.exists("offsetX") ? com_davidmaletz_faengfl_EventHandler.execute(n.get("offsetX"),vars) : 0.0; + var offsetY = n.exists("offsetY") ? com_davidmaletz_faengfl_EventHandler.execute(n.get("offsetY"),vars) : 0.0; + if(n.exists("animation") || n.exists("animationEval")) { + var p = com_davidmaletz_mining_structure_Structure.makeRenderer(null,n,t,n.exists("animationEval") ? com_davidmaletz_mining_npc_NPCEventHandler.evalString(n.get("animationEval"),vars) : n.get("animation"),n.exists("fps") ? com_davidmaletz_mining_npc_NPCEventHandler.evalFloat(n.get("fps"),vars) : 5,true,vars,null,offsetX,offsetY); + if(n.exists("startFrame")) { + p.setFrame(com_davidmaletz_faengfl_EventHandler.execute(n.get("startFrame"),vars) * p.getMaxFrame(),true); + } + s = p; + } else { + var tx = n.exists("tile_x") ? com_davidmaletz_faengfl_EventHandler.execute(n.get("tile_x"),vars) : 0; + var ty = n.exists("tile_y") ? com_davidmaletz_faengfl_EventHandler.execute(n.get("tile_y"),vars) : 0; + s = com_davidmaletz_mining_item_ItemInfo._createIcon(t,tx,ty,offsetX,offsetY); + } + return s; +}; +com_davidmaletz_mining_npc_NPCEventHandler.addTile = function(area,n,vars,defY) { + if(defY == null) { + defY = -1; + } + var x = n.exists("x") ? com_davidmaletz_faengfl_EventHandler.execute(n.get("x"),vars) : 0; + var y = n.exists("y") ? com_davidmaletz_faengfl_EventHandler.execute(n.get("y"),vars) : defY; + var t = null; + var s = null; + if(n.get("group") == "true") { + var l = new com_davidmaletz_faengfl_TileLayer(); + l.start(); + var e = n.elementsNamed("tile"); + while(e.hasNext()) { + var e1 = e.next(); + if(!e1.exists("if") || com_davidmaletz_faengfl_EventHandler._conditionMet(e1.get("if"),vars)) { + var t1 = com_davidmaletz_tiles_Tile.get(e1.exists("eval") ? com_davidmaletz_mining_npc_NPCEventHandler.evalString(e1.get("eval"),vars) : e1.get("id")); + if(t1 != null) { + var tx = e1.exists("tile_x") ? com_davidmaletz_faengfl_EventHandler.execute(e1.get("tile_x"),vars) : 0; + var ty = e1.exists("tile_y") ? com_davidmaletz_faengfl_EventHandler.execute(e1.get("tile_y"),vars) : 0; + var offsetX = e1.exists("offsetX") ? com_davidmaletz_faengfl_EventHandler.execute(e1.get("offsetX"),vars) : 0.0; + var offsetY = e1.exists("offsetY") ? com_davidmaletz_faengfl_EventHandler.execute(e1.get("offsetY"),vars) : 0.0; + t1.render(null,l,offsetX,offsetY,tx,ty); + } + } + } + l.finish(); + s = l; + } else { + t = com_davidmaletz_tiles_Tile.get(n.exists("eval") ? com_davidmaletz_mining_npc_NPCEventHandler.evalString(n.get("eval"),vars) : n.get("id")); + if(t == null) { + return null; + } + } + if(s == null && n.exists("type") && area != null) { + var cls = n.get("type").toLowerCase(); + cls = cls.charAt(0).toUpperCase() + HxOverrides.substr(cls,1,null); + var c = Type.resolveClass("com.davidmaletz.mining.world.types." + cls); + if(c != null) { + s = Type.createInstance(c,[area,t,n]); + x += 0.5; + y += 0.5; + } + } + if(s == null) { + s = com_davidmaletz_mining_npc_NPCEventHandler.makeTile(t,n,vars); + } + s.set_x(Math.round(x * com_davidmaletz_tiles_Tile.SIZE)); + s.set_y(Math.round(y * com_davidmaletz_tiles_Tile.SIZE)); + if(n.get("lerp") == "true") { + var l1 = new com_davidmaletz_lerp_LerpSpriteFL(); + l1.addChild(s); + s = l1; + } + if(Std["is"](s,com_davidmaletz_lerp_LerpSpriteBase)) { + com_davidmaletz_mining_npc_NPCEventHandler.handleAnimations(s,n); + } else if(n.get("glow") == "true") { + var g = new com_davidmaletz_faengfl_GlowSprite(); + g.addChild(s); + s = g; + } + if(n.exists("alpha")) { + s.set_alpha(com_davidmaletz_mining_npc_NPCEventHandler.evalFloat(n.get("alpha"),vars)); + } + if(n.exists("scale")) { + s.set_scaleX(s.set_scaleY(com_davidmaletz_mining_Main.parseFloat(n.get("scale")))); + } + if(n.get("flip") == "true") { + s.set_scaleX(-s.get_scaleX()); + } + if((!n.exists("tint") || com_davidmaletz_faengfl_EventHandler.execute(n.get("tint"),vars) == true) && (n.exists("color") || n.exists("colorScale"))) { + var colorScale; + if(n.exists("colorScale")) { + colorScale = com_davidmaletz_mining_Main.parseFloat(n.get("colorScale")); + } else { + colorScale = 1.5; + } + com_davidmaletz_faengfl_TextSprite.setColor(s,com_davidmaletz_mining_Main.parseInt("0x" + n.get("color")),255 / colorScale); + } + return s; +}; +com_davidmaletz_mining_npc_NPCEventHandler.parseFrames = function(n) { + if(n.exists("minutes")) { + return com_davidmaletz_mining_Main.parseFloat(n.get("minutes")) * 60 * 60; + } else if(n.exists("seconds")) { + return com_davidmaletz_mining_Main.parseFloat(n.get("seconds")) * 60; + } else if(n.exists("frames")) { + return com_davidmaletz_mining_Main.parseFloat(n.get("frames")); + } else { + return 0; + } +}; +com_davidmaletz_mining_npc_NPCEventHandler.addObject = function(n,area,vars,offX,offY) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + var x = com_davidmaletz_mining_npc_NPCEventHandler.evalFloat(n.get("x"),vars) + offX; + var y = (n.exists("y") ? com_davidmaletz_mining_npc_NPCEventHandler.evalFloat(n.get("y"),vars) : -1.0) + offY; + var o = com_davidmaletz_mining_world_ObjectInfo.make(n.exists("eval") ? com_davidmaletz_mining_npc_NPCEventHandler.evalString(n.get("eval"),vars) : n.get("id"),Math.round(x * com_davidmaletz_tiles_Tile.SIZE),Math.round(y * com_davidmaletz_tiles_Tile.SIZE)); + vars.set(n.exists("name") ? n.get("name") : n.get("id"),o); + return com_davidmaletz_mining_npc_NPCEventHandler._addObject(o,n,area,vars); +}; +com_davidmaletz_mining_npc_NPCEventHandler._addObject = function(o,n,area,vars) { + var pre = n.get("pre") == "true"; + if(!pre) { + area.addObject(o); + } + if(n.get("mine") == "true") { + area.mine(o.get_tile_x(),o.get_tile_y(),area.getTileId(o.get_tile_x(),o.get_tile_y(),0),0,o); + } + var r = o.renderer; + if(r != null && n.exists("facing")) { + var f = n.get("facing"); + if(f == "left" || f == "right") { + r.set_scaleX(f == "right" ? -r.get_scaleY() : r.get_scaleY()); + } else { + r.set_scaleX((js_Boot.__cast(com_davidmaletz_faengfl_EventHandler.execute(f,vars) , com_davidmaletz_mining_world_Object)).renderer.get_scaleX()); + } + } + var c = n.firstChild(); + var t = vars.get("this"); + if(c != null && c.nodeType != 0 && c.get_nodeValue() != null) { + vars.set("this",o); + com_davidmaletz_faengfl_EventHandler.execute(com_fancyfish_faeng_common_Lang.escape(c.get_nodeValue()),vars); + } + if(pre) { + area.addObject(o); + } + o.info.runEvent(null,"onPlaced",o,null,vars); + if(t == null) { + vars.remove("this"); + } else { + vars.set("this",t); + } + return o; +}; +com_davidmaletz_mining_npc_NPCEventHandler.getRect = function(n,vars,scale) { + if(scale == null) { + scale = -1; + } + if(scale < 0) { + scale = com_davidmaletz_tiles_Tile.SIZE; + } + var x = n.exists("x") ? Math.round(com_davidmaletz_faengfl_EventHandler.execute(n.get("x"),vars) * scale) : 0; + var y = n.exists("y") ? Math.round(com_davidmaletz_faengfl_EventHandler.execute(n.get("y"),vars) * scale) : 0; + var w = n.exists("width") ? Math.round(com_davidmaletz_faengfl_EventHandler.execute(n.get("width"),vars) * scale) : 1; + var h = n.exists("height") ? Math.round(com_davidmaletz_faengfl_EventHandler.execute(n.get("height"),vars) * scale) : 1; + return new openfl_geom_Rectangle(x,y,w,h); +}; +com_davidmaletz_mining_npc_NPCEventHandler._buildStructure = function(p,area,id,x,y,a) { + if(a == null) { + a = area; + } + var s = com_davidmaletz_mining_structure_StructureInfo.get(id).build(p,a,x * com_davidmaletz_tiles_Tile.SIZE,y * com_davidmaletz_tiles_Tile.SIZE); + if(p != null && area == a) { + p.overlapChanged(); + } + return s; +}; +com_davidmaletz_mining_npc_NPCEventHandler.buildStructure = function(p,area,n,path,vars,offX,offY) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + var id = n.exists("eval") ? Std.string(com_davidmaletz_faengfl_EventHandler.execute(n.get("eval"),vars)) : n.get("id"); + if(!com_davidmaletz_mining_structure_StructureInfo.exists(id)) { + throw new js__$Boot_HaxeError("No structure found: " + id); + } + var s = com_davidmaletz_mining_structure_StructureInfo.get(id).build(p,area,Math.round((com_davidmaletz_faengfl_EventHandler.execute(n.get("x"),vars) + offX) * com_davidmaletz_tiles_Tile.SIZE),Math.round(((n.exists("y") ? com_davidmaletz_faengfl_EventHandler.execute(n.get("y"),vars) : -1.0) + offY) * com_davidmaletz_tiles_Tile.SIZE),new com_davidmaletz_faengfl_XmlPath(n,path),vars); + if(n.exists("var")) { + vars.set(n.get("var"),s); + } + var c = n.firstChild(); + if(c != null && c.nodeType != 0 && c.get_nodeValue() != null) { + var t = vars.get("this"); + vars.set("this",s); + com_davidmaletz_faengfl_EventHandler.execute(com_fancyfish_faeng_common_Lang.escape(c.get_nodeValue()),vars); + if(t == null) { + vars.remove("this"); + } else { + vars.set("this",t); + } + } +}; +com_davidmaletz_mining_npc_NPCEventHandler.getReqs = function(id) { + var ar = []; + var r = com_davidmaletz_mining_item_Recipe.get(id); + if(r != null) { + var req = r.getRequirements(); + while(req.hasNext()) { + var req1 = req.next(); + ar.push(req1); + } + } + return ar; +}; +com_davidmaletz_mining_npc_NPCEventHandler.empty = function() { +}; +com_davidmaletz_mining_npc_NPCEventHandler.evalString = function(str,vars,prepend,allowNull) { + if(allowNull == null) { + allowNull = false; + } + if(prepend == null) { + prepend = ""; + } + if(vars == null) { + return str; + } + if(str == null) { + return null; + } + try { + var d = com_davidmaletz_faengfl_EventHandler._execute(str,vars); + if(d == null && allowNull) { + return null; + } else if(d != null && typeof(d) == "string") { + return d; + } + } catch( e ) { + haxe_CallStack.lastException = e; + } + return prepend + str; +}; +com_davidmaletz_mining_npc_NPCEventHandler.evalString2 = function(expr,vars,def) { + try { + return Std.string(com_davidmaletz_faengfl_EventHandler.interpret(expr,vars)); + } catch( e ) { + haxe_CallStack.lastException = e; + return def; + } +}; +com_davidmaletz_mining_npc_NPCEventHandler.evalInt = function(str,vars) { + if(vars == null) { + return com_davidmaletz_mining_Main.parseInt(str); + } + var d = com_davidmaletz_faengfl_EventHandler.execute(str,vars); + if(d == null || !(typeof(d) == "number" && ((d | 0) === d))) { + return 0; + } + return js_Boot.__cast(d , Int); +}; +com_davidmaletz_mining_npc_NPCEventHandler.evalFloat = function(str,vars) { + var d = com_davidmaletz_faengfl_EventHandler.execute(str,vars); + if(d == null || typeof(d) != "number") { + return 0.0; + } + return js_Boot.__cast(d , Float); +}; +com_davidmaletz_mining_npc_NPCEventHandler.parseBounds = function(n,vars) { + var fromX = -100000; + var fromY = -100000; + var toX = 100000; + var toY = 100000; + if(n.exists("height")) { + toY = -Math.round(com_davidmaletz_mining_npc_NPCEventHandler.evalFloat(n.get("height"),vars) * com_davidmaletz_tiles_Tile.SIZE); + } + if(n.exists("fromX")) { + fromX = Math.round(com_davidmaletz_mining_npc_NPCEventHandler.evalFloat(n.get("fromX"),vars) * com_davidmaletz_tiles_Tile.SIZE); + } + if(n.exists("toX")) { + toX = Math.round(com_davidmaletz_mining_npc_NPCEventHandler.evalFloat(n.get("toX"),vars) * com_davidmaletz_tiles_Tile.SIZE); + } + if(n.exists("fromY")) { + fromY = Math.round(com_davidmaletz_mining_npc_NPCEventHandler.evalFloat(n.get("fromY"),vars) * com_davidmaletz_tiles_Tile.SIZE); + } + if(n.exists("toY")) { + toY = Math.round(com_davidmaletz_mining_npc_NPCEventHandler.evalFloat(n.get("toY"),vars) * com_davidmaletz_tiles_Tile.SIZE); + } + return new com_fancyfish_faeng_common_Bounds2D_$Int(fromX,fromY,toX - fromX,toY - fromY); +}; +com_davidmaletz_mining_npc_NPCEventHandler.parseReserve = function(r) { + switch(r) { + case "cancel": + return 3; + case "finish": + return 2; + case "prepare": + return 1; + default: + return 0; + } +}; +com_davidmaletz_mining_npc_NPCEventHandler.__super__ = com_davidmaletz_faengfl_EventHandler; +com_davidmaletz_mining_npc_NPCEventHandler.prototype = $extend(com_davidmaletz_faengfl_EventHandler.prototype,{ + player: null + ,area: null + ,events: null + ,__is_action_key: null + ,updateArea: function() { + this.area = this.player.getCurrentArea(); + this.vars.set("area",this.area); + } + ,_setPlayer: function(p) { + com_davidmaletz_mining_npc_NPCEventHandler.setPlayerVariables(this.vars,p); + this.area = this.vars.get("area"); + this.area_id = this.area.id; + this.area_x = p.get_tile_x(); + this.area_y = p.get_tile_y(); + this.player = p; + } + ,setControl: function(control) { + this.__is_action_key = control; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = control; + } + ,changePlayer: function(id,forward) { + if(forward == null) { + forward = true; + } + var ret = com_davidmaletz_mining_Main.getInstance().changePlayer(id,forward); + this._setPlayer(ret); + return ret; + } + ,setPlayer: function(p,copyColors,forward) { + if(forward == null) { + forward = true; + } + if(copyColors == null) { + copyColors = false; + } + var ret = com_davidmaletz_mining_Main.getInstance().setPlayer(p,copyColors,forward); + this._setPlayer(ret); + return ret; + } + ,start: function() { + var e = this.choose(this.cur); + if(e != null) { + this.cur = null; + this.node = e; + if(!this.runNode(e.xml)) { + com_davidmaletz_faengfl_EventHandler.prototype.start.call(this); + } + } else { + this.fireComplete(); + } + } + ,runAll: function() { + com_davidmaletz_faengfl_EventHandler.prototype.start.call(this); + } + ,showDialogue: function(xml,darken) { + if(darken == null) { + darken = true; + } + var txt; + var fnt = null; + if(xml.exists("eval")) { + var m = com_fancyfish_faeng_common_Lang.getTextFromTitle(com_davidmaletz_faengfl_EventHandler.execute(xml.get("eval"),this.vars)); + if(m != null) { + txt = m.get(); + } else { + txt = null; + } + } else if(xml.exists("text")) { + txt = xml.get("text"); + } else if(xml.exists("id")) { + txt = com_fancyfish_faeng_common_Lang.getText(xml.get("section"),xml.get("id")).get(); + } else { + txt = null; + } + if(xml.exists("title")) { + var t = com_fancyfish_faeng_common_Lang.getTextFromTitle(xml.get("title")); + if(t != null) { + txt = t.get(); + } + } + if(txt == null) { + return null; + } + if(xml.exists("font")) { + var f = com_fancyfish_faeng_text_FontManager.get(xml.get("font")); + if(f != null && f.get() != null) { + fnt = f.get(); + } else { + fnt = com_fancyfish_faeng_common_Lang.getFontCached(com_davidmaletz_mining_Main.getResource(this.getCurrentPath(),xml.get("font")),false); + } + } + var c = com_davidmaletz_mining_Main.getContainer(); + var wnd = new com_davidmaletz_mining_ui_DialogueBox(c,txt,$bind(this,this.handleNext),xml.exists("speaker") ? com_davidmaletz_faengfl_EventHandler.execute(xml.get("speaker"),this.vars) : null,darken,fnt); + c.addDisplay(wnd,3); + return wnd; + } + ,selectChoice: function(wnd,xml,val) { + var _gthis = this; + this.enterChild(xml,null,function() { + _gthis.vars.set("value",val); + }); + if(wnd != null) { + wnd.close(); + } else { + this.handleNext(); + } + } + ,createChoice: function(c,section,options,functions,w,darken,closeButton,halign,valign,cols,autoSelect) { + if(autoSelect == null) { + autoSelect = true; + } + if(cols == null) { + cols = 1; + } + if(valign == null) { + valign = 0.5; + } + if(halign == null) { + halign = 0.5; + } + if(closeButton == null) { + closeButton = true; + } + if(darken == null) { + darken = true; + } + if(w == null) { + w = 80; + } + return new com_davidmaletz_mining_ui_Choice(c,section,options,functions,w,darken,closeButton,halign,valign,cols,autoSelect); + } + ,handleChoice: function(xml) { + var _gthis = this; + var c = com_davidmaletz_mining_Main.getContainer(); + var options = []; + var functions = []; + var wnd = null; + var i = xml.elementsNamed("dialogue"); + if(i.hasNext()) { + var d = i.next(); + if(!d.exists("if") || this.conditionMet(d.get("if"))) { + wnd = this.showDialogue(d); + } + } + var xpos = xml.exists("xalign") ? com_davidmaletz_mining_Main.parseFloat(xml.get("xalign")) : 0.5; + var ypos = xml.exists("yalign") ? com_davidmaletz_mining_Main.parseFloat(xml.get("yalign")) : 0.5; + var addChoice = function(n) { + var addChoice1; + if(!(!n.exists("if"))) { + var addChoice2 = n.get("if"); + addChoice1 = _gthis.conditionMet(addChoice2); + } else { + addChoice1 = true; + } + if(addChoice1) { + var addChoice3 = com_davidmaletz_mining_npc_NPCEventHandler.evalString(n.get("id"),_gthis.vars); + options.push(addChoice3); + var f = $bind(_gthis,_gthis.selectChoice); + var a1 = wnd; + var a2 = n; + var a3 = _gthis.vars.get("value"); + var addChoice4 = function() { + f(a1,a2,a3); + }; + functions.push(addChoice4); + } + }; + var n1 = xml.elementsNamed("choice"); + while(n1.hasNext()) { + var n2 = n1.next(); + if(n2.exists("values")) { + var values = com_davidmaletz_faengfl_EventHandler.execute(n2.get("values"),this.vars); + var v = values; + while(v.hasNext()) { + var v1 = v.next(); + this.vars.set("value",v1); + addChoice(n2); + } + this.vars.set("value",null); + } else { + addChoice(n2); + } + } + if(xml.get("allowSingle") != "true" && functions.length == 1) { + functions[0](); + wnd.doClose(); + } else if(functions.length > 0) { + var w = xml.exists("width") ? com_davidmaletz_mining_Main.parseInt(xml.get("width")) : 80; + var close = xml.get("closeable") == "true"; + var choice; + if(xml.exists("scrollRows")) { + var choice1 = xml.get("section"); + var choice2 = com_davidmaletz_mining_npc_NPCEventHandler.evalInt(xml.get("scrollRows"),this.vars); + var choice3 = close && wnd == null; + var choice4 = xml.exists("cols") ? com_davidmaletz_mining_Main.parseInt(xml.get("cols")) : 1; + var choice5 = xml.get("autoselect") == "true"; + choice = new com_davidmaletz_mining_ui_ScrollChoice(c,choice1,choice2,options,functions,w,choice3,close,xpos,ypos,choice4,choice5); + } else { + var choice6 = xml.get("section"); + var choice7 = close && wnd == null && xml.get("darken") != "false"; + var choice8 = xml.exists("cols") ? com_davidmaletz_mining_Main.parseInt(xml.get("cols")) : 1; + var choice9 = xml.get("autoselect") == "true"; + choice = this.createChoice(c,choice6,options,functions,w,choice7,close,xpos,ypos,choice8,choice9); + } + if(wnd != null) { + choice.onClose = $bind(wnd,wnd.close); + } else { + choice.onClose = $bind(this,this.handleNext); + } + c.addDisplay(choice,3); + } + if(xml.get("showCoins") == "true") { + this.player.showCoins(); + } + } + ,addEvent: function(e) { + if(this.events == null) { + this.events = [e]; + } else { + this.events.push(e); + } + e.eventList = this.events; + } + ,killEvents: function() { + if(this.events == null) { + return; + } + while(this.events.length > 0) { + var e = this.events[0]; + e.kill(); + } + } + ,handleTransition: function(n,trans,func) { + switch(trans) { + case "ellipse": + new com_davidmaletz_faengfl_transition_EllipseFade(func,60,0,this.player.cameraCentered() ? 0 : 72. - com_davidmaletz_tiles_Tile.SIZE * 1.5); + return true; + case "ellipse_fast": + new com_davidmaletz_faengfl_transition_EllipseFade(func,30,0,this.player.cameraCentered() ? 0 : 72. - com_davidmaletz_tiles_Tile.SIZE * 1.5); + return true; + case "fade": + new com_davidmaletz_faengfl_transition_FadeOut(func,60); + return true; + case "fade_fast": + new com_davidmaletz_faengfl_transition_FadeOut(func,10); + return true; + } + return com_davidmaletz_faengfl_EventHandler.prototype.handleTransition.call(this,n,trans,func); + } + ,doPan: function(n) { + var _gthis = this; + var area = this.area.renderer; + if(area == null) { + return false; + } + var x; + var y; + if(n.exists("toObject")) { + var obj = com_davidmaletz_faengfl_EventHandler.execute(n.get("toObject"),this.vars); + var s = 1.0 / com_davidmaletz_mining_Main._getScale(); + x = 256 * s * 0.5 - obj.getCenterX(); + if(obj == this.player && !this.player.cameraCentered()) { + y = 144 * s - obj.getCenterY() - com_davidmaletz_tiles_Tile.SIZE * 1.5; + } else { + y = 144 * s * 0.5 - obj.getCenterY(); + } + var r = obj.renderer; + if(r != null && Std["is"](r,com_davidmaletz_mining_world_vehicle_VehicleRenderer)) { + var vr = js_Boot.__cast(r , com_davidmaletz_mining_world_vehicle_VehicleRenderer); + x -= vr.getCamOffX(); + y -= vr.getCamOffY(); + } + } else if(n.exists("toStructure")) { + var obj1 = com_davidmaletz_faengfl_EventHandler.execute(n.get("toStructure"),this.vars); + var s1 = 1.0 / com_davidmaletz_mining_Main._getScale(); + x = 256 * s1 * 0.5 - obj1.getCenterX(); + y = 144 * s1 * 0.5 - obj1.getCenterY(); + } else if(n.exists("x") || n.exists("y")) { + if(n.exists("x")) { + x = com_davidmaletz_faengfl_EventHandler.execute(n.get("x"),this.vars); + } else { + x = area.get_x(); + } + if(n.exists("y")) { + y = com_davidmaletz_faengfl_EventHandler.execute(n.get("y"),this.vars); + } else { + y = area.get_y(); + } + } else if(n.exists("tileX") || n.exists("tileY")) { + var s2 = 1.0 / com_davidmaletz_mining_Main._getScale(); + if(n.exists("tileX")) { + x = 256 * s2 * 0.5 - com_davidmaletz_faengfl_EventHandler.execute(n.get("tileX"),this.vars) * com_davidmaletz_tiles_Tile.SIZE; + } else { + x = area.get_x(); + } + if(n.exists("tileY")) { + y = 144 * s2 * 0.5 - com_davidmaletz_faengfl_EventHandler.execute(n.get("tileY"),this.vars) * com_davidmaletz_tiles_Tile.SIZE; + } else { + y = area.get_y(); + } + } else if(n.exists("deltaX") || n.exists("deltaY")) { + x = area.get_x(); + if(n.exists("deltaX")) { + x += com_davidmaletz_faengfl_EventHandler.execute(n.get("deltaX"),this.vars); + } + y = area.get_y(); + if(n.exists("deltaY")) { + y += com_davidmaletz_faengfl_EventHandler.execute(n.get("deltaY"),this.vars); + } + } else { + return false; + } + var f = Math.round(com_davidmaletz_mining_npc_NPCEventHandler.parseFrames(n)); + if(f <= 0) { + area.set_x(Math.round(x)); + area.set_y(Math.round(y)); + return false; + } + var other = null; + if(n.exists("animate")) { + other = this.getObject(n.get("animate")); + } + var modal = new com_davidmaletz_faengfl_transition_LerpModal(area,null,true,other,other != null && Std["is"](other,com_davidmaletz_mining_renderer_PlayerRenderer)); + area.lerp(new com_davidmaletz_mining_npc_FakePositionKeyframe(x,y),f,function() { + modal.kill(null); + _gthis.handleNext(); + }); + return true; + } + ,npcs: null + ,checkNPC: function(o) { + if(com_davidmaletz_mining_Main.isMultiplayer() && o != null && Std["is"](o,com_davidmaletz_mining_npc_NPC)) { + var n = js_Boot.__cast(o , com_davidmaletz_mining_npc_NPC); + if(this.npcs != null && this.npcs.indexOf(n) != -1) { + return; + } + com_davidmaletz_mining_npc_NPCEventHandler.__npc_talking_idle = true; + n.talking.set(this.player); + com_davidmaletz_mining_npc_NPCEventHandler.__npc_talking_idle = false; + if(this.npcs == null) { + this.npcs = [n]; + } else { + this.npcs.push(n); + } + var r = n.renderer; + if(r != null) { + r.clearTrack(com_davidmaletz_mining_world_MoveKeyframe); + } + } + } + ,unlockNPC: function(o) { + if(this.npcs != null && o != null && Std["is"](o,com_davidmaletz_mining_npc_NPC)) { + var n = js_Boot.__cast(o , com_davidmaletz_mining_npc_NPC); + if(HxOverrides.remove(this.npcs,n)) { + n.endTalk(); + } + } + } + ,clearNPCs: null + ,fireNPCs: function() { + if(this.clearNPCs && this.npcs != null) { + var _g = 0; + var _g1 = this.npcs; + while(_g < _g1.length) { + var n = _g1[_g]; + ++_g; + n.endTalk(); + } + this.npcs = null; + } + } + ,fireComplete: function() { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = this.__is_action_key; + this.fireNPCs(); + com_davidmaletz_faengfl_EventHandler.prototype.fireComplete.call(this); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + ,fireStop: function() { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = this.__is_action_key; + this.fireNPCs(); + com_davidmaletz_faengfl_EventHandler.prototype.fireStop.call(this); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + ,getOperate: function(n) { + var ar = null; + var e = n.elementsNamed("operate"); + while(e.hasNext()) { + var e1 = e.next(); + var o = com_davidmaletz_faengfl_EventHandler.execute(e1.get("object"),this.vars); + if(o == null) { + continue; + } + var r = o.renderer; + if(r != null) { + if(ar == null) { + ar = [r]; + } else { + ar.push(r); + } + } + } + return ar; + } + ,run: function(n) { + var n1 = new com_davidmaletz_mining_npc_NPCEventHandler(new com_davidmaletz_faengfl_XmlPath(n,this.getCurrentPath()).elements(),this.player,null,null,this.vars); + n1.__is_action_key = this.__is_action_key; + n1.clearNPCs = false; + n1.runAll(); + if(n1.npcs != null) { + var _g = 0; + var _g1 = n1.npcs; + while(_g < _g1.length) { + var o = _g1[_g]; + ++_g; + if(this.npcs == null) { + this.npcs = [o]; + } else { + this.npcs.push(o); + } + } + } + n1.npcs = null; + } + ,acceptInput: function(n,s) { + if(s != null && s.length > 0) { + this.vars.set("result",s); + this.run(n); + } + } + ,selectItem: function(n,i) { + this.vars.set("item",i == null ? null : i.item); + if(i != null) { + this.vars.set("value",i.value); + this.vars.set("name",i.name); + this.vars.set("inventory",i.inventory); + } + this.run(n); + } + ,selectRecipeCt: function(n,r,ct) { + this.vars.set("recipe",r); + this.vars.set("count",ct); + this.run(n); + } + ,selectRecipe: function(n,r) { + this.vars.set("recipe",r); + this.run(n); + } + ,selectCount: function(n,i) { + this.vars.set("value",i); + this.run(n); + } + ,portal: function(n,area,x,y) { + this.vars.set("portal_area",area); + this.vars.set("portal_x",x); + this.vars.set("portal_y",y); + this.enterChild(n); + } + ,selectPlanet: function(n,p,e) { + this.vars.set("planet",p); + this.vars.set("planetXml",e); + this.vars.set("planetName",com_davidmaletz_mining_world_SolarSystem.getPlanetName(p,e).get()); + this.enterChild(n); + this.handleNext(); + } + ,getRecipeFilter: function(str) { + var _gthis = this; + var $eval = com_davidmaletz_faengfl_EventHandler.parseString(str); + if($eval == null) { + return null; + } else { + return function(r) { + _gthis.vars.set("recipe",r); + return com_davidmaletz_faengfl_EventHandler.interpret($eval,_gthis.vars) == true; + }; + } + } + ,getAreaFilter: function(str) { + var _gthis = this; + var $eval = com_davidmaletz_faengfl_EventHandler.parseString(str); + if($eval == null) { + return null; + } else { + return function(r) { + _gthis.vars.set("area",r); + return com_davidmaletz_faengfl_EventHandler.interpret($eval,_gthis.vars) == true; + }; + } + } + ,getWindowLayer: function() { + return 2; + } + ,showWindow: function(n) { + var c = com_davidmaletz_mining_Main.getContainer(); + var wnd = null; + var title = n.exists("titleMutable") ? com_davidmaletz_faengfl_EventHandler.execute(n.get("titleMutable"),this.vars) : com_fancyfish_faeng_common_Lang.getTextFromTitle(n.get("title")); + var incs = com_davidmaletz_faengfl_EventHandler.execute(n.get("includeStorehouse"),this.vars) == true; + var layer = this.getWindowLayer(); + if(n.get("layer") == "top") { + layer = 3; + } + var f = com_davidmaletz_faengfl_EventHandler.execute(n.get("fuelable"),this.vars); + var _g = n.get("type"); + switch(_g) { + case "build": + var s = com_davidmaletz_mining_structure_StructureInfo.get(n.get("structure")); + var wnd1 = title == null ? com_fancyfish_faeng_common_Lang.getText("structure","build").get() : title.get(); + var wnd2 = this.player; + var wnd3 = s == null ? null : (js_Boot.__cast(s , com_davidmaletz_mining_structure_StructureInfo)).getName().get(); + var wnd4 = this.player.getInv(incs); + var wnd5 = n.exists("recipe") ? com_davidmaletz_mining_npc_NPCEventHandler.getReqs(n.get("recipe")) : com_davidmaletz_mining_world_BlueprintObject.getReqs(com_davidmaletz_faengfl_EventHandler.execute(n.get("requirementsXml"),this.vars),this.vars); + var f1 = $bind(this,this.enterChild); + var n1 = n; + wnd = new com_davidmaletz_mining_ui_BuildPrompt(wnd1,c,wnd2,wnd3,wnd4,wnd5,function() { + f1(n1); + },null,com_fancyfish_faeng_common_Lang.getTextFromTitle(n.get("build")),com_fancyfish_faeng_common_Lang.getTextFromTitle(n.get("cancel"))); + break; + case "changeEquip": + var recipes = []; + var i = com_davidmaletz_mining_ui_CraftingWindow.getRecipes(this.player,n,"equipment"); + var r = i; + while(r.hasNext()) { + var r1 = r.next(); + recipes.push(r1); + } + var wnd6 = this.player; + var wnd7 = com_fancyfish_faeng_common_Lang.getTextFromTitle(n.get("craftTitle")); + var wnd8 = this.getCurrentPath(); + wnd = new com_davidmaletz_mining_ui_ChangeEquipment(wnd6,c,title,wnd7,recipes,new com_davidmaletz_faengfl_XmlPath(n,wnd8),this.vars.get("this")); + break; + case "character": + wnd = new com_davidmaletz_mining_ui_CharacterColorWindow(this.player.getInfo(),($_=this.player,$bind($_,$_.updateSprite)),this.player.colors,this.player.offsets,title == null ? com_fancyfish_faeng_common_Lang.getText("create.character","title") : title); + break; + case "contacts": + wnd = new com_davidmaletz_mining_ui_ContactList(c,this,HxOverrides.iter(this.player.state.contacts),title == null ? com_fancyfish_faeng_common_Lang.getText("common","contact_list") : title); + break; + case "count": + var f2 = $bind(this,this.selectCount); + var n2 = n; + wnd = new com_davidmaletz_mining_ui_CountPrompt(c,title,function(i1) { + f2(n2,i1); + },com_davidmaletz_faengfl_EventHandler.execute(n.get("min"),this.vars),com_davidmaletz_faengfl_EventHandler.execute(n.get("max"),this.vars),com_davidmaletz_faengfl_EventHandler.execute(n.get("value"),this.vars)); + break; + case "craft": + var wnd9 = title == null ? com_fancyfish_faeng_common_Lang.getText("actions","craft") : title; + var wnd10 = this.player.getInv(incs); + var wnd11 = this.player; + var wnd12 = this.getCurrentPath(); + wnd = com_davidmaletz_mining_ui_CraftingWindow.make(wnd9,wnd10,c,wnd11,new com_davidmaletz_faengfl_XmlPath(n,wnd12),this.vars.get("this")); + break; + case "dismantle": + var s1 = com_davidmaletz_mining_structure_StructureInfo.get(n.get("structure")); + var wnd13 = title == null ? com_fancyfish_faeng_common_Lang.getText("structure","dismantle").get() : title.get(); + var wnd14 = this.player; + var wnd15 = s1 == null ? null : (js_Boot.__cast(s1 , com_davidmaletz_mining_structure_StructureInfo)).getName().get(); + var wnd16 = this.player.getInv(incs); + var wnd17 = n.exists("recipe") ? com_davidmaletz_mining_npc_NPCEventHandler.getReqs(n.get("recipe")) : com_davidmaletz_mining_world_BlueprintObject.getReqs(com_davidmaletz_faengfl_EventHandler.execute(n.get("requirementsXml"),this.vars),this.vars); + var f3 = $bind(this,this.enterChild); + var n3 = n; + wnd = new com_davidmaletz_mining_ui_DismantlePrompt(wnd13,c,wnd14,wnd15,wnd16,wnd17,function() { + f3(n3); + },n.exists("percent") ? com_davidmaletz_mining_Main.parseFloat(n.get("percent")) : 0.7); + break; + case "equipment": + wnd = new com_davidmaletz_mining_ui_PlayerEquipment(this.player,c); + break; + case "input": + var txt = com_davidmaletz_mining_npc_NPCEventHandler.evalString(n.get("initial"),this.vars,"",true); + if(txt == null) { + txt = ""; + } + var len = n.exists("maxLength") ? com_davidmaletz_faengfl_EventHandler.execute(n.get("maxLength"),this.vars) : -1; + var m = com_fancyfish_faeng_common_Lang.getTextFromTitle(n.get("message")); + var f4 = $bind(this,this.acceptInput); + var n4 = n; + wnd = new com_davidmaletz_mining_ui_TextInput(c,m,function(s2) { + f4(n4,s2); + },txt,len); + break; + case "inventory": + wnd = new com_davidmaletz_mining_ui_WeightInventoryWindow(this.player,c); + break; + case "items": + var incNone = n.get("incNone") == "true"; + var filter = n.exists("filter") ? com_davidmaletz_faengfl_EventHandler.execute(n.get("filter"),this.vars) : null; + var enabled = n.exists("enabled") ? com_davidmaletz_faengfl_EventHandler.execute(n.get("enabled"),this.vars) : null; + var additional = n.exists("additionalInfo") ? com_davidmaletz_faengfl_EventHandler.execute(n.get("additionalInfo"),this.vars) : null; + if(title == null) { + title = com_fancyfish_faeng_common_Lang.getText("common","inventory"); + } + if(n.get("tabbed") == "true") { + var f5 = $bind(this,this.selectItem); + var n5 = n; + var t = function(i2) { + f5(n5,i2); + }; + var t1 = new com_davidmaletz_mining_ui_SelectItemList(this.player,c,t,incNone,title,filter,this.player.getInv(incs)); + wnd = t1; + } else { + var wnd18 = this.player.getInv(incs); + var wnd19 = this.player.includeCost(); + var f6 = $bind(this,this.selectItem); + var n6 = n; + wnd = new com_davidmaletz_mining_ui_ItemList(c,wnd18,title,wnd19,filter,function(i3) { + f6(n6,i3); + },n.get("showEmpty") == "true",incNone ? com_fancyfish_faeng_common_Lang.getText("common","none") : null,additional,n.get("equipment") == "true" ? this.player.getEquipment() : null,n.get("damagedOnly") == "true",null,enabled); + } + break; + case "map": + var a = n.exists("area") ? com_davidmaletz_faengfl_EventHandler.execute(n.get("area"),this.vars) : this.area; + if(a != null) { + wnd = new com_davidmaletz_mining_ui_MapWindow(c,this.player.getTileCenX() * com_davidmaletz_tiles_Tile.SIZE,(this.player.getTileCenY() - 0.5) * com_davidmaletz_tiles_Tile.SIZE,a,title == null ? com_fancyfish_faeng_common_Lang.getText("item.names","map") : title); + } + break; + case "nav": + if(com_davidmaletz_faengfl_adv_ModHandler.getModInfo("full_version") != null) { + var wnd20 = com_davidmaletz_faengfl_EventHandler.execute(n.get("system"),this.vars); + var f7 = $bind(this,this.selectPlanet); + var n7 = n; + wnd = new com_davidmaletz_mining_ui_SolarSystemNav(c,wnd20,function(p,e) { + f7(n7,p,e); + }); + } + layer = 3; + break; + case "options": + wnd = new com_davidmaletz_mining_ui_Options(c,true); + break; + case "portal": + var fc = com_davidmaletz_faengfl_EventHandler.execute(n.get("fuelCost"),this.vars); + var wnd21 = title == null ? com_fancyfish_faeng_common_Lang.getText("structure","teleport") : title; + var wnd22 = this.player; + var wnd23 = n.get("structure"); + var wnd24 = n.get("object"); + var wnd25 = this.getCurrentPath(); + var wnd26 = new com_davidmaletz_faengfl_XmlPath(n,wnd25); + var f8 = $bind(this,this.portal); + var n8 = n; + var wnd27 = function(a1,x,y) { + f8(n8,a1,x,y); + }; + wnd = new com_davidmaletz_mining_ui_PortalWindow(wnd21,c,wnd22,wnd23,wnd24,wnd26,this.vars,wnd27,this.getAreaFilter(n.get("acceptArea")),fc == null ? null : f,fc == null ? 0 : fc); + break; + case "prompt": + var xpos = n.exists("xalign") ? com_davidmaletz_mining_Main.parseFloat(n.get("xalign")) : 0.5; + var ypos = n.exists("yalign") ? com_davidmaletz_mining_Main.parseFloat(n.get("yalign")) : 0.5; + var m1 = com_fancyfish_faeng_common_Lang.getTextFromTitle(n.exists("eval") ? com_davidmaletz_mining_npc_NPCEventHandler.evalString(n.get("eval"),this.vars) : n.get("message")); + if(n.exists("item")) { + m1 = new com_fancyfish_faeng_common_mutable_Static(com_davidmaletz_mining_item_ItemInfo.get(com_davidmaletz_faengfl_EventHandler.execute(n.get("item"),this.vars)).getNotification(m1,null,false)); + } + var no = n.get("on") == "no"; + var f9; + if(no) { + var f10 = $bind(this,this.enterChild); + var n9 = n; + f9 = function() { + f10(n9); + }; + } else { + f9 = null; + } + var wnd28; + if(no) { + wnd28 = com_davidmaletz_mining_npc_NPCEventHandler.empty; + } else { + var f11 = $bind(this,this.enterChild); + var n10 = n; + wnd28 = function() { + f11(n10); + }; + } + wnd = new com_davidmaletz_mining_ui_Prompt(c,m1,wnd28,f9,false,f9,xpos,ypos); + break; + case "quests": + wnd = new com_davidmaletz_mining_ui_QuestLog(this.player,c); + break; + case "recipes": + var wnd29 = com_davidmaletz_mining_item_Recipe.getByType(com_davidmaletz_mining_npc_NPCEventHandler.evalString(n.get("recipes"),this.vars),this.vars); + var wnd30; + if(n.firstElement() == null) { + wnd30 = null; + } else { + var f12 = $bind(this,this.selectRecipe); + var n11 = n; + wnd30 = function(r2) { + f12(n11,r2); + }; + } + wnd = new com_davidmaletz_mining_ui_RecipeList(wnd29,wnd30,title,this.player.getInv(incs),c,this.player,n.get("none"),null,this.getRecipeFilter(n.get("enabled"))); + break; + case "repair": + var wnd31 = title == null ? com_fancyfish_faeng_common_Lang.getText("actions","repair") : title; + var wnd32 = this.player.getInv(incs); + var wnd33 = this.player.equipment; + var wnd34 = this.player; + var wnd35 = this.getCurrentPath(); + wnd = new com_davidmaletz_mining_ui_RepairWindow(wnd31,wnd32,wnd33,c,wnd34,new com_davidmaletz_faengfl_XmlPath(n,wnd35),this.vars.get("this")); + break; + case "shop": + if(title != null) { + var items = []; + var action_map = new haxe_ds_StringMap(); + action_map.set("item",function(e1,path) { + var i4 = com_davidmaletz_mining_item_ItemInfo.get(e1.get("id")); + if(i4 != null) { + var tmp = e1.exists("cost") ? com_davidmaletz_mining_Main.parseInt(e1.get("cost")) : 0; + var tmp1 = e1.exists("value") ? i4.getDurability() - com_davidmaletz_mining_Main.parseInt(e1.get("value")) : 0; + var tmp2 = com_davidmaletz_mining_item_Recipe.getNameFromXML(e1); + items.push(new com_davidmaletz_mining_item_ItemValueCt(i4,tmp,tmp1,tmp2)); + } + }); + var tmp3 = this.getCurrentPath(); + com_davidmaletz_faengfl_EventHandler._parse(new com_davidmaletz_faengfl_XmlPath(n,tmp3),action_map,this.vars).start(); + var wnd36 = this.player; + var wnd37 = n.get("currencyIcon"); + var wnd38 = n.get("currency"); + wnd = new com_davidmaletz_mining_ui_ShopWindow(wnd36,c,items,wnd37,wnd38,title,n); + } + break; + case "skill": + wnd = new com_davidmaletz_mining_ui_SkillWindow(c,this.player,title == null ? com_fancyfish_faeng_common_Lang.getText("skill","allocate") : title); + break; + case "smelter": + var xml = this.getCurrentPath(); + var xml1 = new com_davidmaletz_faengfl_XmlPath(n,xml); + wnd = new com_davidmaletz_mining_ui_SmeltWindow(this.player.getInv(incs),title == null ? com_fancyfish_faeng_common_Lang.getText("common","smelter") : title,com_davidmaletz_faengfl_EventHandler.execute(n.get("queue"),this.vars),c,this.player.includeCost(),xml1,this.vars.get("this"),xml1.elementPathsNamed("listItem")); + break; + case "stats": + wnd = new com_davidmaletz_mining_ui_StatsWindow(c,this.player,title == null ? com_fancyfish_faeng_common_Lang.getText("stats","view") : title); + break; + case "store": + wnd = new com_davidmaletz_mining_ui_StoreWindow(this.player,incs ? this.player.storehouseInventory : this.player.inventory,com_davidmaletz_faengfl_EventHandler.execute(n.get("inventory"),this.vars),c,com_davidmaletz_mining_structure_Market.getTypes(n),n.exists("price") ? com_davidmaletz_mining_Main.parseFloat(n.get("price")) : 1.0); + break; + case "storehouse": + var i5 = com_davidmaletz_faengfl_EventHandler.execute(n.get("inventory"),this.vars); + var from = com_davidmaletz_faengfl_EventHandler.execute(n.get("from"),this.vars); + if(from == null) { + from = this.player.inventory; + } + if(i5 != null) { + var to_weight = n.exists("to_weight") ? new com_fancyfish_faeng_common_mutable_Static(com_davidmaletz_mining_npc_NPCEventHandler.evalInt(n.get("to_weight"),this.vars)) : null; + if(title == null) { + com_fancyfish_faeng_common_Lang.getText("common","storehouse"); + } + if(n.exists("max_weight") && Std["is"](i5,com_davidmaletz_mining_item_Inventory)) { + wnd = new com_davidmaletz_mining_ui_LimitTransferInventory(this.player,from,i5,com_fancyfish_faeng_common_Lang.getText("common","inventory"),title,c,this.player.capacity,com_davidmaletz_mining_npc_NPCEventHandler.evalInt(n.get("max_weight"),this.vars),n); + } else if(incs) { + wnd = new com_davidmaletz_mining_ui_ToggleTransferInventory(this.player,i5,title,c,to_weight,this.player.getCurrentArea(),0,n); + } else { + wnd = new com_davidmaletz_mining_ui_TransferInventory(this.player,from,i5,com_fancyfish_faeng_common_Lang.getText("common","inventory"),title,c,this.player.capacity,to_weight,24,true,0,n); + } + } + break; + case "uncraft": + var func; + if(n.exists("exclude")) { + func = function(r3) { + return !r3.hasType(n.get("exclude")); + }; + } else { + func = this.getRecipeFilter(n.get("include")); + } + var wnd39 = this.player; + var wnd40 = this.player.getInv(incs); + var wnd41; + if(n.firstElement() == null) { + wnd41 = null; + } else { + var f13 = $bind(this,this.selectRecipeCt); + var n12 = n; + wnd41 = function(r4,ct) { + f13(n12,r4,ct); + }; + } + wnd = new com_davidmaletz_mining_ui_UncraftWindow(wnd39,c,wnd40,title,wnd41,func); + break; + } + if(wnd == null) { + return false; + } + var i6 = n.elementsNamed("functionButton"); + if(i6.hasNext()) { + var e2 = i6.next(); + var f14 = $bind(this,this.enterChild); + var n13 = e2; + var wnd42 = function() { + f14(n13); + }; + wnd = com_davidmaletz_mining_world_ItemObject.collectWindow(wnd,wnd.__width,wnd.__height,wnd42,com_fancyfish_faeng_common_Lang.getTextFromTitle(e2.get("title"))); + } + if(f != null) { + var _g1 = wnd; + _g1.set_x(_g1.get_x() - 50.); + com_davidmaletz_mining_ui_FuelWindow.addFuelDisplay(wnd,f,f.getFuelName()); + } + wnd.onClose = $bind(this,this.handleNext); + c.addDisplay(wnd,layer); + return true; + } + ,createShow: function(n) { + var x = com_davidmaletz_mining_Main.parseFloat(n.get("x")); + var y = com_davidmaletz_mining_Main.parseFloat(n.get("y")); + if(n.get("type") == "tile") { + var t = com_davidmaletz_tiles_Tile.get(n.exists("eval") ? com_davidmaletz_mining_npc_NPCEventHandler.evalString(n.get("eval"),this.vars) : n.get("tile")); + if(t == null) { + return null; + } + x *= 256 - t.getWidth(); + y *= 144 - t.getHeight(); + var s = com_davidmaletz_mining_npc_NPCEventHandler.makeTile(t,n,this.vars); + var l = new com_davidmaletz_lerp_LerpSprite(); + l.addChild(s); + l.set_x(x); + l.set_y(y); + return l; + } + x *= 256; + y *= 144; + var color = n.exists("color") ? com_davidmaletz_mining_Main.parseInt("0x" + n.get("color")) : 16777215; + var bg = n.exists("bg") ? com_davidmaletz_mining_Main.parseInt("0x" + n.get("bg")) : -16777216; + if(n.exists("tooltip")) { + var _g = n.get("tooltip"); + switch(_g) { + case "key": + return new com_davidmaletz_mining_ui_KeyTooltip(false,n.get("key"),x,y,com_fancyfish_faeng_common_Lang.getTextFromTitle(n.get("text")),color,bg,true); + case "popup": + var fadein = n.exists("fadeIn") ? com_davidmaletz_mining_Main.parseInt(n.get("fadeIn")) : 20; + var fadeout = n.exists("fadeOut") ? com_davidmaletz_mining_Main.parseInt(n.get("fadeOut")) : fadein; + var hold = n.exists("hold") ? com_davidmaletz_mining_Main.parseInt(n.get("hold")) : 20; + return new com_davidmaletz_faengfl_ui_Popup(x,y,n.exists("dy") ? com_davidmaletz_mining_Main.parseFloat(n.get("dy")) : 0,com_fancyfish_faeng_common_Lang.getTextFromTitle(n.get("text")),color,bg,fadein,hold,fadeout,null,true,true); + default: + return new com_davidmaletz_faengfl_ui_Tooltip(x,y,com_fancyfish_faeng_common_Lang.getTextFromTitle(n.get("text")),color,bg,null,true); + } + } + return null; + } + ,sleep: function() { + var g = com_davidmaletz_mining_Main._getGameTime(); + var s = 6; + if(g <= 19 && g >= 6) { + return; + } + com_davidmaletz_mining_Main._setGameTime(s,40); + } + ,toNight: function() { + var g = com_davidmaletz_mining_Main._getGameTime(); + if(g <= 19 && g >= 6) { + com_davidmaletz_mining_Main._setGameTime(20,40); + } + } + ,getLayer: function(layer) { + if(com_davidmaletz_mining_Main.getSprite(2).get_visible()) { + var s = com_davidmaletz_mining_Main.getSprite(0); + if(Std["is"](s,com_davidmaletz_lerp_LerpSpriteBase)) { + return s; + } else { + return null; + } + } else { + var s1 = com_davidmaletz_mining_Main.getSprite(3); + var len = s1.get_numChildren(); + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + var c = s1.getChildAt(i); + if(Std["is"](c,com_davidmaletz_mining_effects_Show)) { + return c; + } + } + return null; + } + } + ,getRun: function(n) { + if(n.exists("eval")) { + var p = com_davidmaletz_mining_npc_NPCEventHandler.evalString(n.get("eval"),this.vars); + if(this.vars.exists(p)) { + return this.vars.get(p); + } else { + return null; + } + } else if(n.exists("structure")) { + var s = com_davidmaletz_mining_structure_StructureInfo.get(com_davidmaletz_mining_npc_NPCEventHandler.evalString(n.get("structure"),this.vars)); + if(s != null && Std["is"](s,com_davidmaletz_mining_structure_StructureInfo)) { + var i = (js_Boot.__cast(s , com_davidmaletz_mining_structure_StructureInfo)).xml.elementPathsNamed(n.get("event")); + if(i.hasNext()) { + return i.next(); + } + } + } else if(n.exists("object")) { + var o = com_davidmaletz_mining_world_ObjectInfo.get(com_davidmaletz_mining_npc_NPCEventHandler.evalString(n.get("object"),this.vars)); + if(o != null) { + var ev = n.get("event"); + if(ev == null) { + ev = "operate"; + } + var i1 = o.xml.elementPathsNamed(ev); + if(i1.hasNext()) { + var x = i1.next(); + if(ev == "operate") { + return this.choose(x.elements()); + } else { + return x; + } + } + } + } else { + return com_davidmaletz_faengfl_EventHandler.prototype.getRun.call(this,n); + } + return null; + } + ,getObject: function(str) { + var obj = com_davidmaletz_faengfl_EventHandler.execute(str,this.vars); + if(obj == null) { + return null; + } + if(Std["is"](obj,com_davidmaletz_lerp_LerpSpriteBase)) { + return obj; + } else if(Std["is"](obj,com_davidmaletz_mining_world_BaseObject)) { + return (js_Boot.__cast(obj , com_davidmaletz_mining_world_BaseObject)).renderer; + } else if(Std["is"](obj,com_davidmaletz_mining_structure_Structure)) { + var r = (js_Boot.__cast(obj , com_davidmaletz_mining_structure_Structure)).renderer; + if(Std["is"](r,com_davidmaletz_lerp_LerpSpriteBase)) { + return r; + } else { + return null; + } + } else { + return null; + } + } + ,handleLerp: function(o,frames,n,onComplete) { + var first = true; + if(n.exists("alpha")) { + o.lerp(new com_davidmaletz_lerp_AlphaKeyframe(com_davidmaletz_mining_Main.parseFloat(n.get("alpha"))),frames,first ? onComplete : null); + first = false; + } + if(n.exists("darkness")) { + o.lerp(new com_davidmaletz_lerp_DarkenKeyframe(com_davidmaletz_mining_Main.parseFloat(n.get("darkness"))),frames,first ? onComplete : null); + first = false; + } + if(n.exists("rotation")) { + o.lerp(new com_davidmaletz_lerp_RotationKeyframe(com_davidmaletz_mining_Main.parseFloat(n.get("rotation"))),frames,first ? onComplete : null); + first = false; + } + if(n.exists("deltaX") || n.exists("deltaY") || n.exists("x") || n.exists("y")) { + var x = o.get_x(); + if(n.exists("deltaX")) { + x += com_davidmaletz_faengfl_EventHandler.execute(n.get("deltaX"),this.vars) * com_davidmaletz_tiles_Tile.SIZE; + } + var y = o.get_y(); + if(n.exists("deltaY")) { + y += com_davidmaletz_faengfl_EventHandler.execute(n.get("deltaY"),this.vars) * com_davidmaletz_tiles_Tile.SIZE; + } + if(n.exists("x")) { + x = com_davidmaletz_faengfl_EventHandler.execute(n.get("x"),this.vars) * com_davidmaletz_tiles_Tile.SIZE; + } + if(n.exists("y")) { + y = com_davidmaletz_faengfl_EventHandler.execute(n.get("y"),this.vars) * com_davidmaletz_tiles_Tile.SIZE; + } + o.lerp(new com_davidmaletz_mining_npc_FakePositionKeyframe(x,y),frames,first ? onComplete : null); + first = false; + } + if(n.exists("xPos")) { + o.lerp(new com_davidmaletz_lerp_XKeyframe(com_davidmaletz_mining_npc_NPCEventHandler.evalFloat(n.get("xPos"),this.vars)),frames,first ? onComplete : null); + first = false; + } + if(n.exists("yPos")) { + o.lerp(new com_davidmaletz_lerp_YKeyframe(com_davidmaletz_mining_npc_NPCEventHandler.evalFloat(n.get("yPos"),this.vars)),frames,first ? onComplete : null); + first = false; + } + return first; + } + ,applyLerp: function(o,n) { + if(n.exists("alpha")) { + o.set_alpha(com_davidmaletz_mining_Main.parseFloat(n.get("alpha"))); + } + if(n.exists("darkness")) { + com_davidmaletz_lerp_DarkenKeyframe.setDarkness(o,com_davidmaletz_mining_Main.parseFloat(n.get("darkness"))); + } + if(n.exists("rotation")) { + o.set_rotation(com_davidmaletz_mining_Main.parseFloat(n.get("rotation"))); + } + if(n.exists("x")) { + o.set_x(com_davidmaletz_faengfl_EventHandler.execute(n.get("x"),this.vars) * com_davidmaletz_tiles_Tile.SIZE); + } + if(n.exists("y")) { + o.set_y(com_davidmaletz_faengfl_EventHandler.execute(n.get("y"),this.vars) * com_davidmaletz_tiles_Tile.SIZE); + } + if(n.exists("xPos")) { + o.set_x(com_davidmaletz_faengfl_EventHandler.execute(n.get("xPos"),this.vars)); + } + if(n.exists("yPos")) { + o.set_y(com_davidmaletz_faengfl_EventHandler.execute(n.get("yPos"),this.vars)); + } + } + ,lerpFromTo: function(o,frames,from,to) { + var f = $bind(this,this.lerpFromTo); + var o1 = o; + var a1 = frames; + var a2 = to; + var to1 = from; + this.handleLerp(o,frames,to,function() { + f(o1,a1,a2,to1); + }); + } + ,invoke: function(xml,player,vars) { + if(player != null && player == com_davidmaletz_mining_Main.getLocalPlayer() && player.getCurrentArea() != null) { + var n = new com_davidmaletz_mining_npc_NPCEventHandler(xml.elements(),player,vars.get("this"),null,vars); + n.__is_action_key = this.__is_action_key; + n.runAll(); + player = null; + } + } + ,checkContinue: function(player) { + if(player != null && player == com_davidmaletz_mining_Main.getLocalPlayer() && player.getCurrentArea() != null) { + this.handleNext(); + player = null; + } + } + ,runEvent: function(i,o) { + this.vars.set("object",o); + if(i.hasNext()) { + this.enterChild(i.next()); + } + } + ,handleNode: function(n) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = this.__is_action_key; + var ret = this._handleNode(n); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + return ret; + } + ,canAct: function() { + return this.__is_action_key; + } + ,_handleNode: function(n) { + var _gthis = this; + try { + var _g = n.get_nodeName(); + switch(_g) { + case "achievement": + com_davidmaletz_faengfl_achievement_Achievements.instance.gainAchievement(n.exists("eval") ? com_davidmaletz_faengfl_EventHandler.execute(n.get("eval"),this.vars) : n.get("id")); + break; + case "addAnimation": + var to = com_davidmaletz_faengfl_EventHandler.execute(n.get("to"),this.vars); + var s = null; + if(Std["is"](to,openfl_display_Sprite)) { + s = js_Boot.__cast(to , openfl_display_Sprite); + } else if(Std["is"](to,com_davidmaletz_mining_structure_Structure)) { + s = (js_Boot.__cast(to , com_davidmaletz_mining_structure_Structure)).renderer; + } else if(Std["is"](to,com_davidmaletz_mining_world_BaseObject)) { + s = (js_Boot.__cast(to , com_davidmaletz_mining_world_BaseObject)).renderer; + } + if(s != null) { + var modal = n.get("modal") == "true"; + var a = new com_davidmaletz_mining_renderer_Animation(this.getCurrentPath(),n,to,modal,this.vars); + s.addChild(a.sprite); + if(modal) { + new com_davidmaletz_faengfl_transition_Modal(a.sprite,function() { + a.remove(); + _gthis.handleNext(); + },true); + return true; + } + } + break; + case "appendArea": + if(!this.canAct()) { + return false; + } + if(com_davidmaletz_mining_world_GenerateEventHandler.appendArea(n.exists("to") ? com_davidmaletz_faengfl_EventHandler.execute(n.get("to"),this.vars) : this.area,this.player.areas,n,this.vars,true,$bind(this,this.handleNext)) != null) { + return true; + } + break; + case "attack": + if(!this.canAct()) { + return false; + } + var t = n.exists("object") ? com_davidmaletz_faengfl_EventHandler.execute(n.get("object"),this.vars) : this.vars.get("this"); + if(t != null && Std["is"](t,com_davidmaletz_mining_world_Object) && Std["is"]((js_Boot.__cast(t , com_davidmaletz_mining_world_Object)).getSprite(),com_davidmaletz_mining_enemy_AttackRenderer)) { + var r = js_Boot.__cast((js_Boot.__cast(t , com_davidmaletz_mining_world_Object)).getSprite() , com_davidmaletz_mining_enemy_AttackRenderer); + r.attackWith(n.exists("target") ? com_davidmaletz_faengfl_EventHandler.execute(n.get("target"),this.vars) : null,com_davidmaletz_mining_enemy_Attack.fromXML(new com_davidmaletz_faengfl_XmlPath(n,this.getCurrentPath()))); + } + break; + case "call": + var id = n.get("id"); + if(n.get("end") == "true") { + var c = this.vars.get(id); + if(c != null && Std["is"](c,com_davidmaletz_mining_ui_CallerBox)) { + (js_Boot.__cast(c , com_davidmaletz_mining_ui_CallerBox)).end($bind(this,this.handleNext)); + return true; + } else { + return false; + } + } else { + com_davidmaletz_faengfl_adv_sound_Sound.play(n.get("incoming") == "true" ? "com_device_in" : "com_device"); + var ar = []; + var e = n.elementsNamed("caller"); + while(e.hasNext()) { + var e1 = e.next(); + var i = e1.get("id"); + var caller = new com_davidmaletz_mining_ui_Caller(e1.exists("npc") ? e1.get("npc") : i); + ar.push(caller); + this.vars.set(i,caller); + } + var c1 = new com_davidmaletz_mining_ui_CallerBox(n.exists("npc") ? n.get("npc") : id,ar,n.get("incoming") == "true",$bind(this,this.handleNext)); + this.vars.set(id,c1); + return true; + } + break; + case "clock": + this.player.getGUI().setClock(n.get("remove") == "true" ? null : new com_davidmaletz_mining_renderer_ClockRenderer(n.get("back"),n.get("hand"),n.get("top"),n.exists("rotations") ? 360 / com_davidmaletz_mining_Main.parseInt(n.get("rotations")) : 1)); + break; + case "closeWindows": + var modal1 = n.get("modal") == "true"; + com_davidmaletz_mining_Main.closeWindows(modal1 ? $bind(this,this.handleNext) : null); + return modal1; + case "complete": + if(n.exists("quest")) { + var i1 = com_davidmaletz_faengfl_EventHandler.execute(n.get("inventory"),this.vars); + var inv = Std["is"](i1,com_davidmaletz_mining_item_BaseInventory) ? js_Boot.__cast(i1 , com_davidmaletz_mining_item_BaseInventory) : null; + this.player.completeQuest(com_davidmaletz_mining_npc_Quest.get(n.get("quest")),n.get("useResources") != "false",inv,com_davidmaletz_mining_npc_NPCEventHandler.parseReserve(n.get("reserve"))); + } + break; + case "credits": + var a1 = this.player; + var a2 = $bind(this,this.handleNext); + com_davidmaletz_mining_Main.closeWindows(function() { + com_davidmaletz_mining_Main.showCredits(a1,a2); + }); + return true; + case "damage": + if(!this.canAct()) { + return false; + } + var o = com_davidmaletz_faengfl_EventHandler.execute(n.get("object"),this.vars); + var attacker = n.exists("attacker") ? com_davidmaletz_faengfl_EventHandler.execute(n.get("attacker"),this.vars) : null; + if(o == this.player && this.player.vehicle != null) { + o = this.player.vehicle; + } + if(o == null || o.area == null) { + return false; + } + var dmg = com_davidmaletz_faengfl_EventHandler.execute(n.get("damage"),this.vars); + if(attacker == null) { + var e2 = com_davidmaletz_mining_world_Element.get(n.get("element")); + if(o.loseHealth(dmg,0,null,e2,0,false) > 0) { + o.hitEffect(com_davidmaletz_mining_world_ObjectInfo.getHitEffect(null,e2,n)); + } + } else { + com_davidmaletz_mining_enemy_AttackRenderer.handleAttack(attacker.area,attacker.getDefenseElement(),attacker,n.get("directional") == "false" ? 0 : attacker.getFacing(),o,null,n); + } + break; + case "dialogue": + return this.showDialogue(n) != null; + case "dig": + if(!this.canAct()) { + return false; + } + var x = com_davidmaletz_faengfl_EventHandler.execute(n.get("x"),this.vars); + var y = com_davidmaletz_faengfl_EventHandler.execute(n.get("y"),this.vars); + var light = n.exists("light") ? com_davidmaletz_mining_Main.parseInt(n.get("light")) : 2; + if(this.area.getTileId(x,y,0) >= 0) { + new com_davidmaletz_mining_npc__$NPCEventHandler_Dig(this.area,x,y,n.exists("speed") ? com_davidmaletz_mining_Main.parseFloat(n.get("speed")) : 1,light,$bind(this,this.handleNext)); + return true; + } else if(light > 0) { + this.area.lightTiles(x,y,light); + } + break; + case "displayAction": + com_davidmaletz_faengfl_EventHandler.execute(com_fancyfish_faeng_common_Lang.escape(n.firstChild().get_nodeValue()),this.vars,this.locals); + break; + case "equip": + var o1 = n.exists("to") ? com_davidmaletz_faengfl_EventHandler.execute(n.get("to"),this.vars) : this.player; + if(o1 == null || !Std["is"](o1,com_davidmaletz_mining_world_IEquippable)) { + return false; + } + var e3 = js_Boot.__cast(o1 , com_davidmaletz_mining_world_IEquippable); + var equipment = e3.getEquipment(); + var eq = com_davidmaletz_mining_item_ItemInfo.get(n.exists("eval") ? Std.string(com_davidmaletz_faengfl_EventHandler.execute(n.get("eval"),this.vars)) : n.get("id")); + var s1 = n.exists("slot") ? n.get("slot") : eq.xml.get("slot"); + if(eq == null || s1 == null) { + return false; + } + var slot = equipment.get(s1); + if(slot == null || n.get("ifEmpty") == "true" && slot.get() != null) { + return false; + } + var i2 = null; + if(n.get("fromInventory") == "false") { + var value = n.exists("value") ? i2.getDurability() - Std["int"](com_davidmaletz_faengfl_EventHandler.execute(n.get("value"),this.vars)) : 0; + var name = n.exists("name") ? com_davidmaletz_mining_npc_NPCEventHandler.evalString(n.get("name"),this.vars,n.get("forceName") == "false" ? "" : "&") : null; + if(name == "" || name == "&") { + name = null; + } + i2 = new com_davidmaletz_mining_item_Item(eq,value,name); + this.player.checkSeenItem(eq); + } else { + var inventory = e3.getInventory(); + if(inventory.getItemCount(eq) == 0) { + return false; + } + i2 = inventory.selectItem(eq,0,null); + } + if(i2 != null) { + equipment.equip(i2,o1,n.get("fromInventory") == "false",s1); + } + break; + case "event": + if(n.exists("overweight")) { + this.addEvent(new com_davidmaletz_mining_npc_event_OverweightEvent(new com_davidmaletz_faengfl_XmlPath(n,this.getCurrentPath()),this.player,this.vars)); + } else if(n.exists("canComplete")) { + this.addEvent(new com_davidmaletz_mining_npc_event_CanCompleteEvent(new com_davidmaletz_faengfl_XmlPath(n,this.getCurrentPath()),this.player,this.vars)); + } else if(n.exists("onComplete")) { + this.addEvent(new com_davidmaletz_mining_npc_event_OnCompleteEvent(new com_davidmaletz_faengfl_XmlPath(n,this.getCurrentPath()),this.player,this.vars,com_davidmaletz_mining_npc_Quest.get(n.get("onComplete")))); + } else if(n.exists("onItem") && com_davidmaletz_mining_item_ItemInfo.exists(n.get("onItem"))) { + this.addEvent(new com_davidmaletz_mining_npc_event_OnItemEvent(new com_davidmaletz_faengfl_XmlPath(n,this.getCurrentPath()),this.player,this.vars,com_davidmaletz_mining_item_ItemInfo.get(n.get("onItem")))); + } else if(n.exists("onMount")) { + this.addEvent(new com_davidmaletz_mining_npc_event_MountEvent(new com_davidmaletz_faengfl_XmlPath(n,this.getCurrentPath()),this.player,n.get("onMount"),this.vars)); + } + break; + case "facing": + var o2 = com_davidmaletz_faengfl_EventHandler.execute(n.get("object"),this.vars); + var r1 = o2.renderer; + if(r1 != null) { + r1.set_scaleX(com_davidmaletz_mining_npc_NPCEventHandler.evalString(n.get("dir"),this.vars) == "right" ? -r1.get_scaleY() : r1.get_scaleY()); + } + break; + case "hide": + var s2 = this.vars.get(n.get("id")); + if(s2 != null && Std["is"](s2,com_davidmaletz_lerp_LerpSpriteBase)) { + var l = s2; + var frames = com_davidmaletz_mining_npc_NPCEventHandler.parseFrames(n); + if(frames > 0) { + var d = l; + var tmp = function() { + com_davidmaletz_faengfl_FaengFL.remove(d); + }; + l.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),Math.round(frames),tmp); + } else { + com_davidmaletz_faengfl_FaengFL.remove(l); + } + } + break; + case "hitEffect": + if(!this.canAct()) { + return false; + } + var o3 = com_davidmaletz_faengfl_EventHandler.execute(n.get("object"),this.vars); + if(o3 != null) { + o3.hitEffect(com_davidmaletz_mining_world_ObjectInfo.parseHitEffect(n,null,com_davidmaletz_mining_world_Element.get(n.get("element"))),null,null,n.get("runPaused") == "true"); + } + break; + case "invokeLater": + var v = new haxe_ds_StringMap(); + com_davidmaletz_faengfl_adv_ModHandler.copyVars(this.vars,v); + var f = $bind(this,this.invoke); + var a11 = new com_davidmaletz_faengfl_XmlPath(n,this.getCurrentPath()); + var a21 = com_davidmaletz_mining_Main.getLocalPlayer(); + var a3 = v; + com_davidmaletz_mining_Main.addInvokeLater(new com_davidmaletz_faengfl_InvokeLater(function() { + f(a11,a21,a3); + },com_davidmaletz_mining_npc_NPCEventHandler.parseFrames(n),n.get("paused") == "true")); + break; + case "item": + var i3 = com_davidmaletz_mining_item_ItemInfo.get(n.exists("eval") ? Std.string(com_davidmaletz_faengfl_EventHandler.execute(n.get("eval"),this.vars)) : n.get("id")); + if(i3 != null) { + var ct = n.exists("count") ? com_davidmaletz_faengfl_EventHandler.execute(n.get("count"),this.vars) : 1; + var value1 = n.exists("value") ? i3.getDurability() - Std["int"](com_davidmaletz_faengfl_EventHandler.execute(n.get("value"),this.vars)) : 0; + var name1 = com_davidmaletz_mining_item_Recipe.getNameFromXML(n,this.vars); + if(n.get("storehouse") == "true") { + this.player.storehouseInventory.addItems(i3,ct,value1,name1); + } else if(n.get("hidden") == "true") { + this.player.seen_items.set(i3.id,true); + this.player.inventory.addItems(i3,ct,value1,name1); + } else { + var modal2 = n.get("modal") == "true"; + if(modal2) { + this.player.seen_items.set(i3.id,true); + } + var p = this.player.addItems(i3,ct,value1,name1,true,n.get("storehousePopup") == "true"); + if(p != null) { + com_davidmaletz_mining_Main.getContainer().addDisplay(p,3); + } + if(modal2 && p != null) { + new com_davidmaletz_faengfl_transition_Modal(p,$bind(this,this.handleNext)); + return true; + } + } + } + break; + case "killEvents": + this.killEvents(); + break; + case "lerp": + var o4 = this.getObject(n.get("object")); + if(o4 != null) { + var frames1 = com_davidmaletz_mining_npc_NPCEventHandler.parseFrames(n); + var other = null; + var from = n.elementsNamed("from"); + var to1 = n.elementsNamed("to"); + if(from.hasNext() && to1.hasNext()) { + var f1 = from.next(); + this.applyLerp(o4,f1); + this.lerpFromTo(o4,Math.round(frames1),f1,to1.next()); + return false; + } + if(n.exists("animate")) { + other = this.getObject(n.get("animate")); + } + var modal3 = null; + var func = null; + if(n.get("modal") != "false") { + if(n.get("modal") == "unpaused") { + func = $bind(this,this.handleNext); + } else { + modal3 = new com_davidmaletz_faengfl_transition_LerpModal(o4,null,true,other,other != null && Std["is"](other,com_davidmaletz_mining_renderer_PlayerRenderer)); + func = function() { + modal3.kill(null); + _gthis.handleNext(); + }; + } + } + var first = this.handleLerp(o4,Math.round(frames1),n,func); + if(func != null) { + if(!first) { + return true; + } else if(modal3 != null) { + modal3.kill(null); + } + } + } + break; + case "light": + if(!this.canAct()) { + return false; + } + this.area.lightTiles(com_davidmaletz_faengfl_EventHandler.execute(n.get("x"),this.vars),com_davidmaletz_faengfl_EventHandler.execute(n.get("y"),this.vars),com_davidmaletz_faengfl_EventHandler.execute(n.get("size"),this.vars)); + break; + case "locate": + var id1 = n.exists("eval") ? com_davidmaletz_mining_npc_NPCEventHandler.evalString(n.get("eval"),this.vars) : n.get("id"); + if(n.get("hide") == "true") { + com_davidmaletz_mining_ui_NPCLocator.unlocate(this.player,id1); + } else { + com_davidmaletz_mining_ui_NPCLocator.locate(this.player,id1,n.get("toggle") == "true"); + } + break; + case "menu": + this.handleChoice(n); + return true; + case "mine": + if(!this.canAct()) { + return false; + } + com_davidmaletz_mining_world_GenerateEventHandler.doMine(this.area,n,this.vars); + break; + case "move": + if(!this.canAct()) { + return false; + } + var o5 = com_davidmaletz_faengfl_EventHandler.execute(n.get("object"),this.vars); + if(o5 == null) { + return false; + } + this.checkNPC(o5); + if(n.exists("to")) { + var to2 = com_davidmaletz_faengfl_EventHandler.execute(n.get("to"),this.vars); + if(o5.canEnterTile(to2.get_tile_x(),to2.get_tile_y())) { + var x1 = to2.xPos; + if(to2.renderer != null) { + if(o5.renderer != null) { + o5.renderer.set_scaleX(-to2.renderer.get_scaleX()); + } + x1 -= Math.round(to2.renderer.get_scaleX() * 0.75 * com_davidmaletz_tiles_Tile.SIZE); + } + o5.setPosition(x1,to2.get_tile_y() * com_davidmaletz_tiles_Tile.SIZE,true); + } + } else if(n.exists("structure")) { + var s3 = com_davidmaletz_faengfl_EventHandler.execute(n.get("structure"),this.vars); + o5.setPosition(s3.xPos,s3.yPos,true); + } else if(!o5.setPosition(Math.round(com_davidmaletz_faengfl_EventHandler.execute(n.get("x"),this.vars) * com_davidmaletz_tiles_Tile.SIZE),Math.round((n.exists("y") ? com_davidmaletz_faengfl_EventHandler.execute(n.get("y"),this.vars) : -1.0) * com_davidmaletz_tiles_Tile.SIZE),true) && o5 == this.player) { + this.player.overlapChanged(); + } + if(o5 == this.player && o5.renderer != null) { + (js_Boot.__cast(o5.renderer , com_davidmaletz_mining_renderer_PlayerRenderer)).teleport(); + } + break; + case "music": + if(n.exists("id")) { + com_davidmaletz_faengfl_adv_sound_FadeMusic.set(com_davidmaletz_mining_npc_NPCEventHandler.evalString(n.get("id"),this.vars),com_davidmaletz_mining_npc_NPCEventHandler.parseFrames(n),n.get("loop") != "false"); + } else { + com_davidmaletz_faengfl_adv_sound_FadeMusic.clear(com_davidmaletz_mining_npc_NPCEventHandler.parseFrames(n)); + } + break; + case "object": + if(!this.canAct()) { + return false; + } + var a4 = n.exists("area") ? this.player.areas.get(com_davidmaletz_mining_npc_NPCEventHandler.evalString(n.get("area"),this.vars)) : this.area; + if(n.exists("areaObject")) { + a4 = com_davidmaletz_faengfl_EventHandler.execute(n.get("areaObject"),this.vars); + } + if(a4 != null) { + var o6 = com_davidmaletz_mining_npc_NPCEventHandler.addObject(n,a4,this.vars); + this.checkNPC(o6); + } + break; + case "objects": + if(!this.canAct()) { + return false; + } + com_davidmaletz_mining_world_Generate.placeObjects(this,n.exists("area") ? this.player.areas.get(com_davidmaletz_mining_npc_NPCEventHandler.evalString(n.get("area"),this.vars)) : this.area,n,null,null,this.vars.exists("offsetX") ? this.vars.get("offsetX") : 0,this.vars.exists("offsetY") ? this.vars.get("offsetY") : 0,this.vars); + break; + case "pan": + return this.doPan(n); + case "place": + if(!this.canAct()) { + return false; + } + com_davidmaletz_mining_world_GenerateEventHandler.place(n.exists("area") ? this.player.areas.get(n.get("area")) : this.area,n,this.vars); + break; + case "play": + var o7 = com_davidmaletz_faengfl_EventHandler.execute(n.get("object"),this.vars); + var isRun = Std["is"](o7,com_davidmaletz_mining_world_RunAnimation); + if(isRun || Std["is"](o7,com_davidmaletz_tiles_render_PlayAnimation)) { + var run = null; + var play = null; + var loop = n.get("loop") == "true"; + var func1 = $bind(this,this.handleNext); + if(isRun) { + run = js_Boot.__cast(o7 , com_davidmaletz_mining_world_RunAnimation); + } else { + play = js_Boot.__cast(o7 , com_davidmaletz_tiles_render_PlayAnimation); + } + var modal4 = null; + if(!loop && n.get("modal") == "true") { + modal4 = new com_davidmaletz_faengfl_transition_PlayModal(isRun ? run.getSprite() : play,$bind(this,this.handleNext),n.get("skippable") != "false",this.getObject(n.get("animate")),n.get("animateLerpOnly") == "true"); + var f2 = $bind(modal4,modal4.kill); + func1 = function() { + f2(null); + }; + } + if(isRun) { + run.runAnimation(com_davidmaletz_mining_npc_NPCEventHandler.evalString(n.get("animation"),this.vars),loop ? null : func1); + } else { + var offsetX = n.exists("offsetX") ? com_davidmaletz_mining_Main.parseFloat(n.get("offsetX")) : 0; + var offsetY = n.exists("offsetY") ? com_davidmaletz_mining_Main.parseFloat(n.get("offsetY")) : 0; + play.playAnimation(com_davidmaletz_mining_npc_NPCEventHandler.evalString(n.get("animation"),this.vars),loop,loop ? null : function(p1) { + func1(); + },offsetX,offsetY); + } + if(modal4 != null) { + modal4.initAnim(); + } + return !loop; + } + break; + case "projectile": + if(!this.canAct()) { + return false; + } + var s4 = n.exists("spawner") ? com_davidmaletz_faengfl_EventHandler.execute(n.get("spawner"),this.vars) : null; + var sprite = s4 == null ? null : s4.getSprite(); + var df = 0.25; + var v1 = null; + if(sprite != null && Std["is"](sprite,com_davidmaletz_tiles_render_TileAnimationRenderer)) { + df = (js_Boot.__cast(sprite , com_davidmaletz_tiles_render_TileAnimationRenderer)).deltaFrame; + if(Std["is"](sprite,com_davidmaletz_mining_enemy_AttackRenderer)) { + var a5 = js_Boot.__cast(sprite , com_davidmaletz_mining_enemy_AttackRenderer); + v1 = a5.getVars(); + } + } + var p2 = new com_davidmaletz_mining_world_Projectile(s4,n,com_davidmaletz_mining_npc_NPCEventHandler.evalInt(n.get("damage"),this.vars),n.exists("cut") ? com_davidmaletz_mining_npc_NPCEventHandler.evalInt(n.get("cut"),this.vars) : 0,n.exists("spirit") ? com_davidmaletz_mining_npc_NPCEventHandler.evalInt(n.get("spirit"),this.vars) : 0,com_davidmaletz_mining_npc_NPCEventHandler.evalFloat(n.get("range"),this.vars) * com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_mining_world_Element.get(n.get("element")),com_davidmaletz_mining_npc_NPCEventHandler.evalFloat(n.get("dx"),this.vars),com_davidmaletz_mining_npc_NPCEventHandler.evalFloat(n.get("dy"),this.vars),df,n.get("relative") == "false" ? null : sprite,null,null,null,v1); + if(n.exists("spawnX")) { + p2.xPos += Math.round(com_davidmaletz_faengfl_EventHandler.execute(n.get("spawnX"),this.vars) * com_davidmaletz_tiles_Tile.SIZE); + } + if(n.exists("spawnY")) { + p2.yPos += Math.round(com_davidmaletz_faengfl_EventHandler.execute(n.get("spawnY"),this.vars) * com_davidmaletz_tiles_Tile.SIZE); + } + if(n.exists("id")) { + this.vars.set(n.get("id"),p2); + } + this.area.addProjectile(p2); + return false; + case "quest": + if(n.exists("id") && !this.player.hasQuest(n.get("id"))) { + if(n.get("ask") == "false") { + this.player.addQuest(com_davidmaletz_mining_npc_Quest.get(n.get("id"))); + this.enterChild(n); + } else { + var c2 = com_davidmaletz_mining_Main.getContainer(); + var f3 = $bind(this,this.enterChild); + var n1 = n; + var tmp1 = function() { + f3(n1); + }; + c2.addDisplay(new com_davidmaletz_mining_ui_AcceptQuest(c2,this.player,com_davidmaletz_mining_npc_Quest.get(n.get("id")),tmp1,$bind(this,this.handleNext)),3); + return true; + } + } else { + this.enterChild(n); + } + break; + case "radar": + if(this.area != null && this.area.renderer != null) { + if(n.get("hide") == "true") { + com_davidmaletz_mining_ui_Radar.hide(n.get("id")); + } else if(n.get("overwrite") != "false" || com_davidmaletz_mining_ui_Radar.instance == null) { + com_davidmaletz_mining_ui_GUI.addStaticDisplay(com_davidmaletz_mining_ui_Radar.create(n,this.vars),2,true); + } + } + break; + case "remove": + if(!this.canAct()) { + return false; + } + if(n.exists("object")) { + var d1 = com_davidmaletz_faengfl_EventHandler.execute(n.get("object"),this.vars); + if(d1 != null) { + var o8 = js_Boot.__cast(d1 , com_davidmaletz_mining_world_Object); + var modal5 = n.get("modal") == "true"; + var killer = com_davidmaletz_faengfl_EventHandler.execute(n.get("killer"),this.vars); + if(o8.area != null) { + o8.area.removeObject(o8,killer); + } + if(killer != null) { + o8.defeatedBy(killer); + } + var s5 = o8.renderer; + if(s5 != null && modal5) { + new com_davidmaletz_faengfl_transition_LerpModal(s5,$bind(this,this.handleNext),true); + return true; + } + } + } else if(n.exists("objectsById")) { + var killer1 = com_davidmaletz_faengfl_EventHandler.execute(n.get("killer"),this.vars); + var id2 = com_davidmaletz_mining_npc_NPCEventHandler.evalString(n.get("objectsById"),this.vars); + var a6 = n.exists("area") ? this.player.areas.get(n.get("area")) : this.area; + if(a6 != null) { + var o9; + while(true) { + o9 = a6.getObject(id2); + if(!(o9 != null)) { + break; + } + a6.removeObject(o9,killer1); + if(killer1 != null) { + o9.defeatedBy(killer1); + } + } + } + } else if(n.exists("structure")) { + var d2 = com_davidmaletz_faengfl_EventHandler.execute(n.get("structure"),this.vars); + if(d2 != null) { + var s6 = js_Boot.__cast(d2 , com_davidmaletz_mining_structure_Structure); + if(s6 != null && s6.area != null) { + s6.area.removeStructure(s6,this.player); + } + } + } else if(n.exists("quest")) { + this.player.removeQuest(n.get("quest")); + } + break; + case "removeObjects": + if(!this.canAct()) { + return false; + } + this.area.removeObjects(com_davidmaletz_mining_npc_NPCEventHandler.getRect(n,this.vars),n.exists("layer") ? com_davidmaletz_mining_world_BasicObjectInfo.parseLayer(n.get("layer")) : -1); + break; + case "removeStructures": + if(!this.canAct()) { + return false; + } + this.area.removeStructures(com_davidmaletz_mining_npc_NPCEventHandler.getRect(n,this.vars),this.player); + break; + case "return": + if(!this.canAct()) { + return false; + } + this.player.returnTeleport(); + this.updateArea(); + break; + case "runAreaLoad": + if(this.area.renderer != null) { + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + com_davidmaletz_mining_world_Generate.runAction("onLoad",this.area.renderer,com_davidmaletz_mining_Main.getLocalPlayer(),81); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = this.__is_action_key; + this.area.dispatchEvent(new openfl_events_Event("run_load")); + } + break; + case "save": + if(!this.canAct()) { + return false; + } + if(n.get("toNight") == "true") { + this.toNight(); + } else if(n.get("sleep") == "true") { + this.sleep(); + } + if(n.get("fakeDismount") == "true" && this.player.vehicle != null) { + this.player.vehicle.fakeDismount(); + } + com_davidmaletz_mining_Main.save(this.player); + break; + case "scene": + var s7 = com_davidmaletz_mining_effects_Scene.get(n.get("id")); + if(s7 != null) { + this.run(n); + var showToAll = n.get("showToAll") == "true"; + var f4 = $bind(this,this.completeScene); + var n2 = n; + var tmp2 = function(d3) { + f4(n2,d3); + }; + s7.show(n.get("show"),this.player,tmp2,Math.round(n.get("dissolve") == "true" ? com_davidmaletz_mining_npc_NPCEventHandler.parseFrames(n) : 0),showToAll); + if(showToAll) { + this.player.state.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent(com_davidmaletz_mining_effects_Scene.SHOW,new com_fancyfish_faeng_common_Pair(s7,n.get("show")))); + } + return true; + } + break; + case "score": + com_davidmaletz_faengfl_achievement_Achievements.instance.submitScore(n.exists("eval") ? com_davidmaletz_faengfl_EventHandler.execute(n.get("eval"),this.vars) : n.get("id"),com_davidmaletz_mining_npc_NPCEventHandler.evalInt(n.get("value"),this.vars)); + break; + case "setTile": + if(!this.canAct()) { + return false; + } + com_davidmaletz_mining_world_GenerateEventHandler.setTile(this.area,n,this.vars.exists("offsetX") ? this.vars.get("offsetX") : 0,this.vars.exists("offsetY") ? this.vars.get("offsetY") : 0,this.vars); + break; + case "setTime": + if(!this.canAct()) { + return false; + } + if(n.get("toNight") == "true") { + this.toNight(); + } else if(n.get("sleep") == "true") { + this.sleep(); + } else { + var val = com_davidmaletz_faengfl_EventHandler.execute(n.get("value"),this.vars); + if(val != null && typeof(val) == "number") { + var tmp3 = com_davidmaletz_mining_npc_NPCEventHandler.parseFrames(n); + var tmp4 = n.get("forwards") != "false"; + var tmp5; + if(n.firstChild() != null) { + var f5 = $bind(this,this.run); + var n3 = n; + tmp5 = function() { + f5(n3); + }; + } else { + tmp5 = null; + } + com_davidmaletz_mining_Main._setGameTime(val,tmp3,tmp4,tmp5); + } + } + break; + case "shake": + var dx = 1; + var dy = 0; + if(n.exists("dx")) { + dx = com_davidmaletz_mining_Main.parseInt(n.get("dx")); + } + if(n.exists("dy")) { + dy = com_davidmaletz_mining_Main.parseInt(n.get("dy")); + } + var modal6 = n.get("modal") != "false"; + var func2 = null; + var r2 = this.getObject(n.get("object")); + if(r2 == null) { + r2 = this.getLayer(n.get("layer")); + } + if(r2 == null) { + return false; + } + var sx = r2.get_x(); + var sy = r2.get_y(); + if(modal6) { + var modal7 = new com_davidmaletz_faengfl_transition_Modal(r2,$bind(this,this.handleNext),true); + func2 = function() { + r2.set_x(sx); + r2.set_y(sy); + modal7.kill(null); + }; + } else { + func2 = function() { + r2.set_x(sx); + r2.set_y(sy); + }; + } + var tmp6 = new com_davidmaletz_lerp_ShakeKeyframe(com_davidmaletz_mining_Main.parseInt(n.get("count")),dx,dy,sx,sy); + var tmp7 = Math.round(com_davidmaletz_mining_npc_NPCEventHandler.parseFrames(n)); + r2.lerp(tmp6,tmp7,func2); + return modal6; + case "show": + var s8 = this.createShow(n); + if(s8 == null) { + return false; + } + if(n.exists("id")) { + this.vars.set(n.get("id"),s8); + } + com_davidmaletz_mining_Main.getContainer().addDisplay(s8,3); + if(n.exists("scale")) { + var tmp8 = com_davidmaletz_mining_Main.parseFloat(n.get("scale")); + var tmp9 = s8.set_scaleY(tmp8); + s8.set_scaleX(tmp9); + } + var frames2 = com_davidmaletz_mining_npc_NPCEventHandler.parseFrames(n); + if(frames2 > 0) { + s8.set_alpha(0); + var tmp10 = new com_davidmaletz_lerp_AlphaKeyframe(); + s8.lerp(tmp10,Math.round(frames2)); + } + if(n.get("modal") == "true") { + new com_davidmaletz_faengfl_transition_Modal(s8,function() { + com_davidmaletz_faengfl_FaengFL.remove(s8); + _gthis.handleNext(); + },true); + return true; + } + break; + case "sound": + var id3 = n.get("id"); + if(id3 == null && n.exists("eval")) { + id3 = Std.string(com_davidmaletz_faengfl_EventHandler.execute(n.get("eval"),this.vars)); + } + if(id3 != null) { + var o10 = com_davidmaletz_faengfl_EventHandler.execute(n.get("object"),this.vars); + if(o10 == null) { + var s9 = com_davidmaletz_faengfl_EventHandler.execute(n.get("structure"),this.vars); + if(s9 == null) { + com_davidmaletz_faengfl_adv_sound_Sound.play(id3); + } else { + s9.playOnce(id3,n.get("stopOnRemove") == "true"); + } + } else { + com_davidmaletz_mining_world_Object.playObject(o10,id3,n.get("resolve") == "true",n.get("stopOnRemove") == "true"); + } + } + break; + case "spreadTiles": + if(!this.canAct()) { + return false; + } + com_davidmaletz_mining_world_GenerateEventHandler.spreadTiles(this.area,n,this.vars.exists("offsetX") ? this.vars.get("offsetX") : 0,this.vars.exists("offsetY") ? this.vars.get("offsetY") : 0,this.vars); + break; + case "structure": + if(n.get("forceSpawn") != "true" && !this.canAct()) { + return false; + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + com_davidmaletz_mining_Main.closeWindows(); + if(n.get("place") == "true") { + var id4 = n.exists("eval") ? Std.string(com_davidmaletz_faengfl_EventHandler.execute(n.get("eval"),this.vars)) : n.get("id"); + var s10 = com_davidmaletz_mining_structure_StructureInfo.get(id4); + if(s10 == null) { + throw new js__$Boot_HaxeError("No structure found: " + id4); + } + var struc; + var b; + if(Std["is"](s10,com_davidmaletz_mining_structure_StructureInfo)) { + struc = s10; + b = struc; + } else if(Std["is"](s10,com_davidmaletz_mining_item_CropInfo)) { + var c3 = js_Boot.__cast(s10 , com_davidmaletz_mining_item_CropInfo); + b = c3; + struc = c3.structure; + } else { + throw new js__$Boot_HaxeError("Not a structure or crop: " + id4); + } + var place = n.elementsNamed("onPlace"); + var cancel = n.elementsNamed("onCancel"); + var tmp11 = this.player; + var tmp12 = this.vars; + var f6 = $bind(this,this.runEvent); + var i4 = place; + var tmp13 = function(o11) { + f6(i4,o11); + }; + var tmp14; + if(n.get("canCancel") == "false") { + tmp14 = null; + } else { + var f7 = $bind(this,this.runEvent); + var i5 = cancel; + tmp14 = function() { + f7(i5,null); + }; + } + com_davidmaletz_mining_item_Action.placeStructure(tmp11,b,struc,n,tmp12,tmp13,tmp14,function() { + _gthis.player.overlapChanged(); + _gthis.handleNext(); + },Math.round(com_davidmaletz_mining_npc_NPCEventHandler.parseFrames(n))); + return true; + } else { + com_davidmaletz_mining_npc_NPCEventHandler.buildStructure(this.player,n.exists("area") ? this.player.areas.get(com_davidmaletz_mining_npc_NPCEventHandler.evalString(n.get("area"),this.vars)) : this.area,n,this.getCurrentPath(),this.vars); + this.player.overlapChanged(); + } + break; + case "teleport": + if(n.get("fireRemote") != "true" && !this.canAct()) { + return false; + } + var aid = com_davidmaletz_mining_npc_NPCEventHandler.evalString(n.get("area"),this.vars); + if(!com_davidmaletz_mining_world_Generate.exists(aid)) { + return false; + } + this.player.doTeleport(aid,Math.round(com_davidmaletz_mining_npc_NPCEventHandler.evalFloat(n.get("x"),this.vars) * com_davidmaletz_tiles_Tile.SIZE),Math.round((n.exists("y") ? com_davidmaletz_mining_npc_NPCEventHandler.evalFloat(n.get("y"),this.vars) : -1.0) * com_davidmaletz_tiles_Tile.SIZE),n.get("allowReturn") == "true",n.get("temporary") == "true" ? com_davidmaletz_mining_world_Generate.create(aid,this.player.areas) : null); + if(n.get("clearReturn") == "true") { + this.player.prevLocation = null; + } + this.updateArea(); + break; + case "tile": + if(!this.canAct()) { + return false; + } + if(this.area.renderer != null) { + var s11 = com_davidmaletz_mining_npc_NPCEventHandler.addTile(this.area,n,this.vars); + if(s11 != null) { + var name2 = n.get("name"); + if(name2 != null) { + this.vars.set(name2,s11); + } + var p3 = n.get("onTop") == "true" || n.get("top") == "true" ? this.area.renderer.over_objects : this.area.renderer.tiles; + if(n.get("back") == "true") { + p3 = this.area.renderer.back; + } + if(n.get("behind") == "true") { + p3.addChildAt(s11,0); + } + p3.addChild(s11); + } + } + break; + case "tiles": + if(!this.canAct()) { + return false; + } + if(n.exists("from")) { + com_davidmaletz_mining_world_Generate.addTileMap(this.area,openfl_Assets.getBitmapData(com_davidmaletz_faengfl_EventHandler.getResource(this.getCurrentPath(),n.get("from"))),n,com_davidmaletz_mining_npc_NPCEventHandler.evalInt(n.get("x"),this.vars),com_davidmaletz_mining_npc_NPCEventHandler.evalInt(n.get("y"),this.vars),com_davidmaletz_mining_world_GenerateEventHandler.parseEmpty(n.get("empty")),this.vars); + } + break; + case "title": + com_davidmaletz_mining_Main.titleScreen(); + return true; + case "unequip": + this.player.equipment.unequip(n.get("slot"),this.player,n.get("destroyItem") != "true"); + break; + case "wait": + var f8 = Math.round(com_davidmaletz_mining_npc_NPCEventHandler.parseFrames(n)); + if(f8 >= 0) { + if(n.get("modal") == "false") { + var f9 = $bind(this,this.checkContinue); + var a12 = com_davidmaletz_mining_Main.getLocalPlayer(); + com_davidmaletz_mining_Main.addInvokeLater(new com_davidmaletz_faengfl_InvokeLater(function() { + f9(a12); + },f8)); + } else { + var f10 = $bind(this,this.enterChild); + var n4 = n; + var tmp15 = function() { + f10(n4); + }; + new com_davidmaletz_faengfl_transition_Wait(f8,$bind(this,this.handleNext),this.getOperate(n),tmp15); + } + var i6 = n.elementsNamed("onBegin"); + if(i6.hasNext()) { + this.run(i6.next()); + } + return true; + } + break; + case "weather": + if(this.area.renderer == null) { + return false; + } + var type = n.get("type"); + if(type == "snow") { + var power = n.exists("power") ? com_davidmaletz_mining_Main.parseFloat(n.get("power")) : 0.125; + var s12 = new com_davidmaletz_faengfl_effects_Snow(this.area.renderer,com_davidmaletz_mining_npc_NPCEventHandler.parseBounds(n,this.vars),power); + com_davidmaletz_mining_Main.getContainer().addDisplay(s12,0); + } else if(type == "rain") { + var ht = com_davidmaletz_mining_npc_NPCEventHandler.evalFloat(n.get("height"),this.vars); + var power1 = n.exists("power") ? com_davidmaletz_mining_Main.parseFloat(n.get("power")) : 2; + var theta = n.exists("theta") ? com_davidmaletz_mining_Main.parseFloat(n.get("theta")) : 0.4; + var velocity = n.exists("velocity") ? com_davidmaletz_mining_Main.parseFloat(n.get("velocity")) : 30; + var r3 = new com_davidmaletz_faengfl_effects_Rain(this.area.renderer,com_davidmaletz_mining_npc_NPCEventHandler.parseBounds(n,this.vars),power1,theta,velocity); + com_davidmaletz_mining_Main.getContainer().addDisplay(r3,0); + } else if(type == "fog" && this.area.renderer != null) { + var a7 = n.exists("alpha") ? com_davidmaletz_faengfl_EventHandler.execute(n.get("alpha"),this.vars) : 0.35; + var img = n.exists("image") ? com_davidmaletz_mining_Main.getResource(this.getCurrentPath(),n.get("image")) : "data/ui/noise.png"; + var dx1 = n.exists("dx") ? com_davidmaletz_mining_Main.parseFloat(n.get("dx")) : -0.16666666666666666; + var dy1 = n.exists("dy") ? com_davidmaletz_mining_Main.parseFloat(n.get("dy")) : -0.16666666666666666; + var fog = new com_davidmaletz_mining_effects_Fog(this.area.renderer,img,a7,dx1,dy1,n.exists("x") ? com_davidmaletz_mining_npc_NPCEventHandler.getRect(n,this.vars) : null); + if(n.exists("color")) { + com_davidmaletz_faengfl_TextSprite.setColor(fog,com_davidmaletz_mining_Main.parseInt("0x" + n.get("color"))); + } + if(n.exists("id")) { + this.area.renderer.weather.set(n.get("id"),fog); + } + com_davidmaletz_mining_Main.getContainer().addDisplay(fog,0); + } else if(type == "storm") { + if(n.exists("start")) { + var power2 = n.exists("power") ? com_davidmaletz_mining_Main.parseFloat(n.get("power")) : 2; + var theta1 = n.exists("theta") ? com_davidmaletz_mining_Main.parseFloat(n.get("theta")) : 0.4; + var velocity1 = n.exists("velocity") ? com_davidmaletz_mining_Main.parseFloat(n.get("velocity")) : 30; + var s13 = com_davidmaletz_mining_Main.parseInt(n.get("start")); + this.area.dispatchEvent(new com_davidmaletz_mining_npc_StormEvent("start_storm",power2,theta1,velocity1,s13)); + new com_davidmaletz_mining_effects_Storm(this.area.renderer,power2,theta1,velocity1).start(s13,$bind(this,this.handleNext)); + return true; + } else if(com_davidmaletz_mining_effects_Storm.instance != null && n.exists("stop")) { + var s14 = com_davidmaletz_mining_Main.parseInt(n.get("stop")); + com_davidmaletz_mining_effects_Storm.instance.stop(s14,$bind(this,this.handleNext)); + this.area.dispatchEvent(new com_davidmaletz_faengfl_events_IntEvent("stop_storm",s14)); + return true; + } + } else if(n.exists("clear")) { + var s15 = this.area.renderer.weather.get(n.get("clear")); + if(s15 != null) { + com_davidmaletz_faengfl_FaengFL.remove(s15); + this.area.renderer.weather.remove(n.get("clear")); + } + } + break; + case "window": + return this.showWindow(n); + default: + return com_davidmaletz_faengfl_EventHandler.prototype.handleNode.call(this,n); + } + } catch( e4 ) { + haxe_CallStack.lastException = e4; + if (e4 instanceof js__$Boot_HaxeError) e4 = e4.val; + com_fancyfish_faeng_common_Utils.printExceptionTrace(e4); + } + return false; + } + ,area_id: null + ,area_x: null + ,area_y: null + ,peekNode: function(n,values) { + var area = null; + var x = this.area_x; + var y = this.area_y; + if(n.get_nodeName() == "runAreaLoad") { + area = this.area_id; + } else if(n.get_nodeName() == "teleport") { + area = n.get("area"); + var _x = Std.parseInt(n.get("x")); + var _y = Std.parseInt(n.get("y")); + if(_x != null) { + this.area_x = _x; + this.area_y = _y == null ? -1 : _y; + } + } else if(n.get_nodeName() == "return") { + area = this.player.prevLocation; + x = Math.round(this.player.prevX / com_davidmaletz_tiles_Tile.SIZE); + y = Math.round(this.player.prevY / com_davidmaletz_tiles_Tile.SIZE); + } else if(n.get_nodeName() == "move" && n.get("object") == "player") { + var x1 = Std.parseInt(n.get("x")); + var y1 = Std.parseInt(n.get("y")); + if(x1 != null) { + this.area_x = x1; + this.area_y = y1 == null ? -1 : y1; + } + } + if(area == null) { + return com_davidmaletz_faengfl_EventHandler.prototype.peekNode.call(this,n,values); + } else { + var xml = com_davidmaletz_mining_world_Generate.getAction(n.get_nodeName() == "runAreaLoad" || this.player.areas.exists(area) ? "onLoad" : "init",area); + if(xml != null) { + this.area_id = area; + this.area_x = x; + this.area_y = y; + this.enterChild(xml.xml,xml.path); + } + return null; + } + } + ,completeScene: function(n,d) { + var t = n.get("endWith"); + if(t == null) { + t = n.get("with"); + } + var tmp; + if(t != null) { + var f = $bind(this,this._completeScene); + var d1 = d; + tmp = !this.handleTransition(n,t,function() { + f(d1); + }); + } else { + tmp = true; + } + if(tmp) { + this._completeScene(d); + } + } + ,_completeScene: function(d) { + if(d != null) { + com_davidmaletz_faengfl_FaengFL.remove(d); + } + this.handleNext(); + } + ,getFirst: function(values) { + var n = this.choose(this.cur); + if(n == null) { + return null; + } + this.cur = null; + this.node = n; + var e = this.peekNode(n.xml,values); + if(e != null) { + return e; + } else { + return com_davidmaletz_faengfl_EventHandler.prototype.getFirst.call(this,values); + } + } + ,__class__: com_davidmaletz_mining_npc_NPCEventHandler +}); +var com_davidmaletz_mining_effects_SceneEventHandler = function(xml,p,show,showToAll,func,vars) { + com_davidmaletz_mining_npc_NPCEventHandler.call(this,xml.elements(),p,show,func,vars); + this.show = show; + this.showToAll = showToAll; + this.player = com_davidmaletz_mining_Main.getLocalPlayer(); +}; +$hxClasses["com.davidmaletz.mining.effects.SceneEventHandler"] = com_davidmaletz_mining_effects_SceneEventHandler; +com_davidmaletz_mining_effects_SceneEventHandler.__name__ = ["com","davidmaletz","mining","effects","SceneEventHandler"]; +com_davidmaletz_mining_effects_SceneEventHandler.__super__ = com_davidmaletz_mining_npc_NPCEventHandler; +com_davidmaletz_mining_effects_SceneEventHandler.prototype = $extend(com_davidmaletz_mining_npc_NPCEventHandler.prototype,{ + show: null + ,showToAll: null + ,_handleNode: function(n) { + if(this.show.stage == null) { + return true; + } + var _g = n.get_nodeName(); + switch(_g) { + case "animate": + var l = this.vars.get(n.get("id")); + if(l != null && Std["is"](l,com_davidmaletz_mining_effects__$Scene_TalkLayer)) { + var layer = js_Boot.__cast(l , com_davidmaletz_mining_effects__$Scene_TalkLayer); + var idle = n.get("idle"); + layer._idle = idle; + layer._talk = n.get("talk"); + layer.playAnimation(idle,true); + } + break; + case "container": + var l1 = new com_davidmaletz_lerp_LerpSprite(); + if(n.exists("name")) { + this.vars.set(n.get("name"),l1); + } + this.show.addChild(l1); + break; + case "hide": + var l2 = n.exists("id") && com_davidmaletz_mining_npc_NPCEventHandler.parseFrames(n) == 0 ? this.vars.get(n.get("id")) : null; + if(l2 != null && Std["is"](l2,openfl_display_DisplayObject)) { + (js_Boot.__cast(l2 , openfl_display_DisplayObject)).set_alpha(0); + } else { + return com_davidmaletz_mining_npc_NPCEventHandler.prototype._handleNode.call(this,n); + } + break; + case "layer": + var l3 = this.show.scene.getLayer(n,this.getCurrentPath(),this.vars); + if(l3 != null) { + if(n.exists("name")) { + this.vars.set(n.get("name"),l3); + } else if(n.exists("id")) { + this.vars.set(n.get("id"),l3); + } + l3.set_alpha(1); + if(n.exists("index")) { + this.show.addChildAt(l3,com_davidmaletz_mining_npc_NPCEventHandler.evalInt(n.get("index"),this.vars)); + } else { + this.show.addChild(l3); + } + } + break; + case "play": + n.set("modal","true"); + return com_davidmaletz_mining_npc_NPCEventHandler.prototype._handleNode.call(this,n); + case "removeAll": + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this.show); + break; + case "removeLayer": + var l4 = this.vars.get(n.get("id")); + if(l4 != null && Std["is"](l4,openfl_display_DisplayObject)) { + com_davidmaletz_faengfl_FaengFL.remove(l4); + } + break; + case "show": + var l5 = n.exists("id") && com_davidmaletz_mining_npc_NPCEventHandler.parseFrames(n) == 0 ? this.vars.get(n.get("id")) : null; + if(l5 != null && Std["is"](l5,openfl_display_DisplayObject)) { + (js_Boot.__cast(l5 , openfl_display_DisplayObject)).set_alpha(1); + } else { + return com_davidmaletz_mining_npc_NPCEventHandler.prototype._handleNode.call(this,n); + } + break; + case "stop": + this.fireComplete(); + this.fireStop(); + return true; + case "teleport": + var ret = com_davidmaletz_mining_npc_NPCEventHandler.prototype._handleNode.call(this,n); + com_davidmaletz_mining_Main.getContainer().addDisplay(this.show,3); + this.show.hideBelow(); + return ret; + case "text": + var l6 = com_davidmaletz_mining_effects_Scene.makeText(n,this.getCurrentPath()); + if(n.exists("id")) { + this.vars.set(n.get("id"),l6); + } + l6.set_alpha(1); + this.show.addChild(l6); + break; + default: + return com_davidmaletz_mining_npc_NPCEventHandler.prototype._handleNode.call(this,n); + } + return false; + } + ,createChoice: function(c,section,options,functions,w,darken,closeButton,halign,valign,cols,autoSelect) { + if(autoSelect == null) { + autoSelect = true; + } + if(cols == null) { + cols = 1; + } + if(valign == null) { + valign = 0.5; + } + if(halign == null) { + halign = 0.5; + } + if(closeButton == null) { + closeButton = true; + } + if(darken == null) { + darken = true; + } + if(w == null) { + w = 80; + } + return com_davidmaletz_mining_npc_NPCEventHandler.prototype.createChoice.call(this,c,section,options,functions,w,darken,closeButton,halign,valign,cols,autoSelect); + } + ,invoke: function(xml,player,vars) { + if(xml.get("paused") != "true") { + com_davidmaletz_mining_npc_NPCEventHandler.prototype.invoke.call(this,xml,player,vars); + } else if(player != null && player == com_davidmaletz_mining_Main.getLocalPlayer() && this.show.stage != null) { + new com_davidmaletz_mining_effects_SceneEventHandler(xml,player,this.show,this.showToAll,null,vars).runAll(); + player = null; + } + } + ,showDialogue: function(xml,darken) { + if(darken == null) { + darken = true; + } + return com_davidmaletz_mining_npc_NPCEventHandler.prototype.showDialogue.call(this,xml,false); + } + ,getWindowLayer: function() { + return 3; + } + ,__class__: com_davidmaletz_mining_effects_SceneEventHandler +}); +var com_davidmaletz_tiles_render_TileAnimationRenderer = function(tile,fps,allowAppend) { + if(allowAppend == null) { + allowAppend = true; + } + this.append = null; + this.anim = null; + this.sprite_offset = 0; + this.startAnimIndex = 0; + this.frame = 0; + com_davidmaletz_lerp_LerpSpriteFL.call(this); + this.tile = tile; + this.deltaFrame = fps / 60; + this.allowAppend = allowAppend; +}; +$hxClasses["com.davidmaletz.tiles.render.TileAnimationRenderer"] = com_davidmaletz_tiles_render_TileAnimationRenderer; +com_davidmaletz_tiles_render_TileAnimationRenderer.__name__ = ["com","davidmaletz","tiles","render","TileAnimationRenderer"]; +com_davidmaletz_tiles_render_TileAnimationRenderer.__super__ = com_davidmaletz_lerp_LerpSpriteFL; +com_davidmaletz_tiles_render_TileAnimationRenderer.prototype = $extend(com_davidmaletz_lerp_LerpSpriteFL.prototype,{ + current: null + ,frame: null + ,deltaFrame: null + ,tile: null + ,allowAppend: null + ,startAnimIndex: null + ,colors: null + ,offsets: null + ,anim_cache: null + ,animation: null + ,sprite_offset: null + ,anim_sprite: null + ,anim: null + ,append: null + ,setAnimation: function(anim_id,offX,offY) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + if(this.animation == anim_id || this.tile == null) { + return; + } + this.animation = anim_id; + this.anim = com_davidmaletz_tiles_TileAnimation._get(anim_id); + if(this.anim == null) { + this.anim = com_davidmaletz_tiles_TileAnimation.get("single"); + } + if(this.anim_cache == null) { + this.anim_cache = new haxe_ds_StringMap(); + } + var s = this.anim_cache.get(anim_id); + if(s == null) { + s = new com_davidmaletz_lerp_LerpSpriteFL(); + if(this.anim.rotate != 0) { + s.set_rotation(this.anim.rotate); + var r = this.anim.rotate * Math.PI / 180; + var w = this.tile.getTileWidth(0,0); + var h = this.tile.getTileHeight(0,0); + var sin = Math.sin(r); + var cos = Math.cos(r); + s.set_x(w * 0.5 * (1 - cos) + h * 0.5 * sin); + s.set_y(h * 0.5 * (1 - cos) - w * 0.5 * sin); + } + if(this.anim.scale != 1) { + s.set_scaleX(s.set_scaleY(this.anim.scale)); + } + var c = this.getColor(this.anim.color); + if(c != 16777215 || this.anim.colorScale != 1) { + com_davidmaletz_faengfl_TextSprite.setColor(s,c,255 / this.anim.colorScale); + } + var len = this.anim.getFrameCount(); + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var f = _g1++; + var l = this.anim.createLayerForFrame(this.tile,f,offX,offY,this.offsets); + s.addChild(l); + } + if(this.anim.append != null && this.allowAppend) { + var _g2 = 0; + var _g11 = this.anim.append; + while(_g2 < _g11.length) { + var a = _g11[_g2]; + ++_g2; + var r1 = new com_davidmaletz_tiles_render_TileAnimationRenderer(com_davidmaletz_tiles_Tile.get(a.tile),this.deltaFrame * 60); + r1.colors = this.colors; + r1.offsets = this.offsets; + var c1 = this.getColor(a.color); + if(c1 != 16777215 || a.colorScale != 1) { + com_davidmaletz_faengfl_TextSprite.setColor(r1,c1,255 / a.colorScale); + } + var w1 = this.tile.getTileWidth(0,0); + var h1 = this.tile.getTileHeight(0,0); + r1.set_x(Math.round(offX * w1 + a.x)); + r1.set_y(Math.round(offY * h1 + a.y)); + var anim = a.animation; + if(!com_davidmaletz_tiles_TileAnimation.exists(anim)) { + anim = "single"; + } + r1.setAnimation(anim,a.offsetX,a.offsetY); + if(a.flip) { + r1.set_scaleX(-1); + } + if(a.behind) { + s.addChildAt(r1,0); + } else { + s.addChild(r1); + } + } + } + this.addChildAt(s,this.startAnimIndex); + this.anim_cache.set(anim_id,s); + } + this.frame = 0; + this.current = 0; + if(this.anim_sprite != null) { + this.anim_sprite.set_visible(false); + } + this.anim_sprite = s; + this.anim_sprite.set_visible(true); + if(this.anim.append != null && this.anim.append.length > 0 && this.allowAppend) { + this.append = []; + var st = 0; + var end = this.anim_sprite.get_numChildren(); + var _g3 = 0; + var _g12 = this.anim.append; + while(_g3 < _g12.length) { + var a1 = _g12[_g3]; + ++_g3; + var i; + if(a1.behind) { + i = st; + ++st; + } else { + i = --end; + } + var r2 = js_Boot.__cast(this.anim_sprite.getChildAt(i) , com_davidmaletz_tiles_render_TileAnimationRenderer); + r2.setFrame(0); + this.append.push(r2); + } + this.sprite_offset = st; + } else { + this.sprite_offset = 0; + } + var len1 = this.anim.getFrameCount(); + var _g13 = 0; + var _g4 = len1; + while(_g13 < _g4) { + var f1 = _g13++; + this.anim_sprite.getChildAt(f1 + this.sprite_offset).set_visible(f1 == this.current); + } + } + ,getColor: function(c) { + if(c == null) { + return 16777215; + } else if(this.colors != null && this.colors.exists(c)) { + return this.colors.get(c); + } else { + var ret = Std.parseInt("0x" + c); + if(ret == null) { + return 16777215; + } else { + return ret; + } + } + } + ,clearAll: function() { + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this); + this.frame = 0; + this.tile = null; + this.anim_cache = null; + this.animation = null; + this.anim_sprite = null; + this.anim = null; + this.append = null; + } + ,clear: function(anim_id) { + if(this.animation == anim_id) { + this.animation = null; + } + if(this.anim_cache != null) { + var s = this.anim_cache.get(anim_id); + if(s != null) { + if(s.parent == this) { + this.removeChild(s); + } + this.anim_cache.remove(anim_id); + } + } + } + ,getMaxFrame: function() { + if(this.anim == null) { + return 1; + } else { + return this.anim.getMaxTime() / this.deltaFrame; + } + } + ,getAnimFrame: function() { + return this.frame; + } + ,getFramesPerSecond: function() { + return Math.round(this.deltaFrame * 60); + } + ,getFrameId: function() { + return this.anim.getFrameAtTime(this.frame * this.deltaFrame); + } + ,getCurrentFrame: function() { + return this.anim.getFrame(this.getFrameId()); + } + ,setFrame: function(f,loop) { + if(loop == null) { + loop = false; + } + if(this.anim_sprite == null) { + return false; + } + if(this.append != null) { + var _g = 0; + var _g1 = this.append; + while(_g < _g1.length) { + var a = _g1[_g]; + ++_g; + a.setFrame(f,loop); + } + } + var max = this.getMaxFrame(); + if(loop) { + f = com_fancyfish_faeng_common_Utils.mod(f,max); + } else if(f > max) { + f = max; + } else if(f < 0) { + f = 0; + } + if(f != this.frame) { + this.frame = f; + var c = com_fancyfish_faeng_common_Utils.min(this.anim.getFrameAtTime(this.frame * this.deltaFrame),this.anim_sprite.get_numChildren() - 1 - this.sprite_offset); + if(c != this.current) { + this.anim_sprite.getChildAt(this.current + this.sprite_offset).set_visible(false); + this.current = c; + this.anim_sprite.getChildAt(this.current + this.sprite_offset).set_visible(true); + } + return true; + } else { + return false; + } + } + ,incFrame: function(df,loop) { + if(loop == null) { + loop = false; + } + return this.setFrame(this.frame + df,loop); + } + ,__class__: com_davidmaletz_tiles_render_TileAnimationRenderer +}); +var com_davidmaletz_tiles_render_PlayAnimation = function(tile,anim,fps,loop,complete,offX,offY) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + com_davidmaletz_tiles_render_TileAnimationRenderer.call(this,tile,fps); + if(anim == null) { + anim = "single"; + } + if(tile != null) { + this.playAnimation(anim,loop,complete,offX,offY); + } +}; +$hxClasses["com.davidmaletz.tiles.render.PlayAnimation"] = com_davidmaletz_tiles_render_PlayAnimation; +com_davidmaletz_tiles_render_PlayAnimation.__name__ = ["com","davidmaletz","tiles","render","PlayAnimation"]; +com_davidmaletz_tiles_render_PlayAnimation.removeOnComplete = function(d) { + com_davidmaletz_faengfl_FaengFL.remove(d); +}; +com_davidmaletz_tiles_render_PlayAnimation.__super__ = com_davidmaletz_tiles_render_TileAnimationRenderer; +com_davidmaletz_tiles_render_PlayAnimation.prototype = $extend(com_davidmaletz_tiles_render_TileAnimationRenderer.prototype,{ + loop: null + ,onComplete: null + ,isLoop: function() { + return this.loop; + } + ,playAnimation: function(anim,loop,complete,offX,offY) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + this.setAnimation(anim,offX,offY); + this.loop = loop; + this.onComplete = complete; + } + ,advanceFrame: function(frames) { + com_davidmaletz_tiles_render_TileAnimationRenderer.prototype.advanceFrame.call(this,frames); + if(frames != 0 && !this.incFrame(frames,this.loop) && this.onComplete != null) { + var f = this.onComplete; + this.onComplete = null; + f(this); + } + } + ,__class__: com_davidmaletz_tiles_render_PlayAnimation +}); +var com_davidmaletz_tiles_render_StaticPlayAnimation = function(tile,anim,fps,loop,complete,offX,offY) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + com_davidmaletz_tiles_render_PlayAnimation.call(this,tile,anim,fps,loop,complete,offX,offY); +}; +$hxClasses["com.davidmaletz.tiles.render.StaticPlayAnimation"] = com_davidmaletz_tiles_render_StaticPlayAnimation; +com_davidmaletz_tiles_render_StaticPlayAnimation.__name__ = ["com","davidmaletz","tiles","render","StaticPlayAnimation"]; +com_davidmaletz_tiles_render_StaticPlayAnimation.__super__ = com_davidmaletz_tiles_render_PlayAnimation; +com_davidmaletz_tiles_render_StaticPlayAnimation.prototype = $extend(com_davidmaletz_tiles_render_PlayAnimation.prototype,{ + init: function(e) { + this.destroy(null); + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.handle_frame),false,PriorityManager.getPriority()); + } + ,destroy: function(e) { + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.handle_frame)); + } + ,handle_frame: function(e) { + this.enter_frame(com_davidmaletz_faengfl_FaengFL.frameTime); + } + ,canAdvanceModal: function() { + return false; + } + ,__class__: com_davidmaletz_tiles_render_StaticPlayAnimation +}); +var com_davidmaletz_mining_effects__$Scene_TalkLayer = function(sec,id,tile,idle,talk,fps,sfx,offX,offY) { + com_davidmaletz_tiles_render_StaticPlayAnimation.call(this,tile,idle,fps,true,null,offX,offY); + this.offX = offX; + this.offY = offY; + this.sec = sec; + this.id = id; + this._idle = idle; + this._talk = talk; + if(sfx == null) { + var o = com_davidmaletz_mining_world_ObjectInfo._get(id); + if(o != null && Std["is"](o,com_davidmaletz_mining_npc_NPCInfo)) { + this.talkSfx = (js_Boot.__cast(o , com_davidmaletz_mining_npc_NPCInfo)).talkSfx; + } + } else { + this.talkSfx = sfx; + } +}; +$hxClasses["com.davidmaletz.mining.effects._Scene.TalkLayer"] = com_davidmaletz_mining_effects__$Scene_TalkLayer; +com_davidmaletz_mining_effects__$Scene_TalkLayer.__name__ = ["com","davidmaletz","mining","effects","_Scene","TalkLayer"]; +com_davidmaletz_mining_effects__$Scene_TalkLayer.__interfaces__ = [com_davidmaletz_mining_world_RunAnimation,com_davidmaletz_mining_npc_Speakable]; +com_davidmaletz_mining_effects__$Scene_TalkLayer.__super__ = com_davidmaletz_tiles_render_StaticPlayAnimation; +com_davidmaletz_mining_effects__$Scene_TalkLayer.prototype = $extend(com_davidmaletz_tiles_render_StaticPlayAnimation.prototype,{ + sec: null + ,id: null + ,_idle: null + ,_talk: null + ,_x: null + ,_y: null + ,talkSfx: null + ,offX: null + ,offY: null + ,init: function(e) { + com_davidmaletz_tiles_render_StaticPlayAnimation.prototype.init.call(this,e); + if(this._x == null) { + this._x = this.get_x(); + this._y = this.get_y(); + } else { + this.set_x(this._x); + this.set_y(this._y); + } + } + ,destroy: function(e) { + com_davidmaletz_tiles_render_StaticPlayAnimation.prototype.destroy.call(this,e); + this.stopSFX(); + if(e != null) { + this.playAnimation(this._idle,true); + } + } + ,channel: null + ,beginSpeak: function() { + this.playAnimation(this._talk,true); + if(this.talkSfx != null && com_davidmaletz_faengfl_RevealText.TEXT_SPEED > 0) { + this.playSFX(this.talkSfx); + } + } + ,endSpeak: function(closed) { + if(closed && this.animation == this._talk) { + this.playAnimation(this._idle,true); + } + this.stopSFX(); + } + ,playSFX: function(id) { + this.stopSFX(); + if(this.stage != null) { + this.channel = com_davidmaletz_faengfl_adv_sound_Sound.play(id,true); + } + } + ,stopSFX: function() { + if(this.channel != null) { + this.channel.stop(); + this.channel = null; + } + } + ,getSprite: function() { + return this; + } + ,runAnimation: function(anim_id,onComplete) { + var _gthis = this; + if(com_davidmaletz_tiles_TileAnimation.exists(this.sec + anim_id)) { + anim_id = this.sec + anim_id; + } + if(onComplete == null) { + this.playAnimation(anim_id,true); + return; + } + this.playAnimation(anim_id,false,function(p) { + _gthis.playAnimation(_gthis._idle,true); + onComplete(); + },this.offX,this.offY); + } + ,__class__: com_davidmaletz_mining_effects__$Scene_TalkLayer +}); +var com_davidmaletz_mining_effects_Storm = function(world,power,theta,velocity) { + if(velocity == null) { + velocity = 30; + } + if(theta == null) { + theta = 0.4; + } + this.lightning = false; + this.stormPower = 0; + this.rain = new com_davidmaletz_faengfl_effects_Rain(world,new com_fancyfish_faeng_common_Bounds2D_$Int(-100000,-100000,200000,100000),power,theta,velocity); + this.colorMatrix = lime_math__$Matrix4_Matrix4_$Impl_$._new(); + this.rain.addEventListener("addedToStage",$bind(this,this.init)); + this.rain.addEventListener("removedFromStage",$bind(this,this.destroy)); +}; +$hxClasses["com.davidmaletz.mining.effects.Storm"] = com_davidmaletz_mining_effects_Storm; +com_davidmaletz_mining_effects_Storm.__name__ = ["com","davidmaletz","mining","effects","Storm"]; +com_davidmaletz_mining_effects_Storm.hasStorm = function() { + return com_davidmaletz_mining_effects_Storm.instance != null; +}; +com_davidmaletz_mining_effects_Storm.prototype = { + rain: null + ,colorMatrix: null + ,stormPower: null + ,lightning: null + ,lightning_ct: null + ,init: function(e) { + this.destroy(null); + if(com_davidmaletz_mining_effects_Storm.instance != null) { + com_davidmaletz_mining_effects_Storm.instance.stop(); + } + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.handle_frame)); + com_davidmaletz_mining_Main.setColorMatrix(this.colorMatrix); + com_davidmaletz_mining_effects_Storm.instance = this; + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p != null) { + p.update_weight(); + } + } + ,destroy: function(e) { + if(com_davidmaletz_mining_effects_Storm.instance == this) { + com_davidmaletz_mining_effects_Storm.instance = null; + } + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p != null) { + p.update_weight(); + } + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.handle_frame)); + if(e != null) { + com_davidmaletz_mining_Main.setColorMatrix(null); + com_davidmaletz_mining_renderer_Parallax.setStorm(1); + } + } + ,setLightning: function() { + this.lightning_ct = (Math.random() * 0.5 + 0.5) * 500; + } + ,start: function(frames,onComplete) { + if(frames == null) { + frames = 0; + } + this.setLightning(); + if(frames == 0) { + this.rain.set_alpha(1); + com_davidmaletz_mining_renderer_Parallax.setStorm(0); + this.rain.clearLerp(); + this.setStormColor(1); + if(onComplete != null) { + onComplete(); + } + } else { + this.rain.set_alpha(0); + com_davidmaletz_mining_renderer_Parallax.setStorm(1); + this.rain.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),frames,onComplete); + this.setStormColor(0); + } + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(this.rain,0); + com_davidmaletz_faengfl_adv_sound_FadeMusic.set("rain",frames); + } + ,remove: function(onComplete) { + if(onComplete != null) { + onComplete(); + } + if(this.rain.parent != null) { + this.rain.parent.removeChild(this.rain); + } + } + ,stop: function(frames,onComplete) { + if(frames == null) { + frames = 0; + } + if(frames == 0) { + this.remove(onComplete); + } else { + var f = $bind(this,this.remove); + var a1 = onComplete; + var tmp = function() { + f(a1); + }; + this.rain.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),frames,tmp); + } + } + ,setStormColor: function(f) { + var light = this.lightning_ct < 0 && Math.random() < 0.8; + if(this.stormPower == f && this.lightning == light) { + return; + } + this.stormPower = f; + this.lightning = light; + var sat = 1 - f * 0.5; + var darken = this.lightning ? 1.5 : 1 - f * 0.35; + var lumR = 0.3086; + var lumG = 0.6094; + var lumB = 0.0820; + var r = lumR * (1 - sat) * darken; + var g = lumG * (1 - sat) * darken; + var b = lumB * (1 - sat) * darken; + lime_math__$Matrix4_Matrix4_$Impl_$.set(this.colorMatrix,0,r + sat * darken); + lime_math__$Matrix4_Matrix4_$Impl_$.set(this.colorMatrix,1,g); + lime_math__$Matrix4_Matrix4_$Impl_$.set(this.colorMatrix,2,b); + lime_math__$Matrix4_Matrix4_$Impl_$.set(this.colorMatrix,4,r); + lime_math__$Matrix4_Matrix4_$Impl_$.set(this.colorMatrix,5,g + sat * darken); + lime_math__$Matrix4_Matrix4_$Impl_$.set(this.colorMatrix,6,b); + lime_math__$Matrix4_Matrix4_$Impl_$.set(this.colorMatrix,8,r); + lime_math__$Matrix4_Matrix4_$Impl_$.set(this.colorMatrix,9,g); + lime_math__$Matrix4_Matrix4_$Impl_$.set(this.colorMatrix,10,b + sat * darken); + } + ,handle_frame: function(e) { + if(this.rain.parent == null) { + return; + } + if(this.lightning_ct >= 0) { + if(com_davidmaletz_mining_Main.ALLOW_FLASH) { + this.lightning_ct -= com_davidmaletz_faengfl_FaengFL.frameTime; + if(this.lightning_ct < 0) { + com_davidmaletz_faengfl_adv_sound_Sound.play("thunder"); + this.lightning_ct = -20; + } + } + } else { + this.lightning_ct += com_davidmaletz_faengfl_FaengFL.frameTime; + if(this.lightning_ct >= 0) { + this.setLightning(); + } + } + this.setStormColor(this.rain.get_alpha()); + com_davidmaletz_mining_renderer_Parallax.setStorm(1 - this.rain.get_alpha()); + } + ,__class__: com_davidmaletz_mining_effects_Storm +}; +var com_davidmaletz_mining_effects_Torchlight = function(l,info,offX,offY) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + this.ct = 0; + com_davidmaletz_lerp_LerpSprite.call(this); + this.link = l; + this.flicker = []; + if(info != null) { + this.update(info); + } + this.offX = offX; + this.offY = offY; +}; +$hxClasses["com.davidmaletz.mining.effects.Torchlight"] = com_davidmaletz_mining_effects_Torchlight; +com_davidmaletz_mining_effects_Torchlight.__name__ = ["com","davidmaletz","mining","effects","Torchlight"]; +com_davidmaletz_mining_effects_Torchlight.create = function(t,offX,offY,anim,fps,scale) { + if(scale == null) { + scale = 1; + } + var l = anim == null ? com_davidmaletz_tiles_Tile.makeIcon(t) : new com_davidmaletz_tiles_render_PlayAnimation(t,anim,fps,true); + l.set_scaleX(l.set_scaleY(scale)); + l.set_x(offX - t.getTileWidth(0,0) * 0.5 * scale); + l.set_y(offY - t.getTileHeight(0,0) * 0.5 * scale); + return l; +}; +com_davidmaletz_mining_effects_Torchlight.__super__ = com_davidmaletz_lerp_LerpSprite; +com_davidmaletz_mining_effects_Torchlight.prototype = $extend(com_davidmaletz_lerp_LerpSprite.prototype,{ + link: null + ,ct: null + ,flicker: null + ,offX: null + ,offY: null + ,update: function(info) { + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this); + com_fancyfish_faeng_common_Utils.clear(this.flicker); + this.add(info); + } + ,add: function(info) { + var t = info == null ? null : info.getTile(); + if(t == null) { + this.set_visible(this.get_numChildren() > 0); + return; + } else { + this.set_visible(true); + } + var scale; + if(info.xml != null && info.xml.exists("scale")) { + scale = com_davidmaletz_mining_Main.parseFloat(info.xml.get("scale")); + } else { + scale = 1; + } + var c = com_davidmaletz_mining_effects_Torchlight.create(t,info.offsetX,info.offsetY,info.animation,info.fps,scale); + if(info.xml != null && info.xml.exists("rotateSpeed")) { + var l = new com_davidmaletz_mining_renderer_RotateSprite(com_davidmaletz_mining_Main.parseFloat(info.xml.get("rotateSpeed"))); + l.addChild(c); + c = l; + } + com_davidmaletz_faengfl_TextSprite.setColor(c,info.color); + this.addChild(c); + if(info.flicker) { + this.flicker.push(c); + } + } + ,init: function(e) { + com_davidmaletz_lerp_LerpSprite.prototype.init.call(this,e); + if(this.link != null) { + this.set_x(this.link.get_x() + this.offX); + this.set_y(this.link.get_y() + this.offY); + this.set_scaleX(this.link.get_scaleX()); + } + } + ,advanceFrame: function(df) { + if(this.link != null) { + this.set_x(this.link.get_x() + this.offX * this.link.get_scaleX()); + this.set_y(this.link.get_y() + this.offY); + this.set_scaleX(this.link.get_scaleX()); + if(this.link.stage == null) { + com_davidmaletz_faengfl_FaengFL.remove(this); + } + } + com_davidmaletz_lerp_LerpSprite.prototype.advanceFrame.call(this,df); + this.ct += df; + if(this.ct > 6) { + this.ct -= 6; + var a = 0.75 + Math.random() * 0.25; + if(com_davidmaletz_mining_Main.ALLOW_FLASH) { + var _g = 0; + var _g1 = this.flicker; + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + f.set_alpha(a); + } + } + } + } + ,__class__: com_davidmaletz_mining_effects_Torchlight +}); +var com_davidmaletz_mining_enemy_Arm = function(e,info,x,y,angle,deltaAng,diameter,regrow,speed) { + this.root = info.create(0,0); + this.root.offsetX += x; + this.root.offsetY += y; + this.regrow = regrow; + this.speed = speed; + this.enemy = e; + this.angle = angle; + this.deltaAng = deltaAng; + this.diameter = diameter; + this.angleP = speed; + this.regrowCt = 0; + this.root.addEventListener("removed_from_area",$bind(this,this.removed)); +}; +$hxClasses["com.davidmaletz.mining.enemy.Arm"] = com_davidmaletz_mining_enemy_Arm; +com_davidmaletz_mining_enemy_Arm.__name__ = ["com","davidmaletz","mining","enemy","Arm"]; +com_davidmaletz_mining_enemy_Arm.__interfaces__ = [com_davidmaletz_faengfl_EnterFrameHandler]; +com_davidmaletz_mining_enemy_Arm.regrowArm = function(root) { + var parent = root.parent; + if(parent != null && Std["is"](parent,com_davidmaletz_mining_enemy_Enemy) && parent.area != null) { + root.dispatchEvent(new openfl_events_Event("regrow")); + root.renderer = null; + root.restoreHealth(); + var e = Std["is"](root,com_davidmaletz_mining_enemy_Enemy) ? js_Boot.__cast(root , com_davidmaletz_mining_enemy_Enemy) : null; + var sub = null; + if(e != null) { + sub = e.subobjects; + e.subobjects = null; + } + (js_Boot.__cast(parent , com_davidmaletz_mining_enemy_Enemy)).updatePos(root); + parent.area.addObject(root); + if(e != null) { + e.subobjects = sub; + } + } +}; +com_davidmaletz_mining_enemy_Arm.create = function(e,info,x,y,len,angle,deltaAng,diameter,end,regrow,speed) { + if(len == 0) { + return null; + } + var arm = new com_davidmaletz_mining_enemy_Arm(e,info,x,y,angle,deltaAng,diameter,regrow,speed); + arm.child = com_davidmaletz_mining_enemy__$Arm_ArmSegment.makeChild(arm,arm.root,len,angle,info,end); + return arm; +}; +com_davidmaletz_mining_enemy_Arm.prototype = { + root: null + ,child: null + ,enemy: null + ,angleP: null + ,angle: null + ,deltaAng: null + ,diameter: null + ,speed: null + ,regrow: null + ,regrowCt: null + ,removed: function(e) { + this.regrowCt = 0; + } + ,addListeners: function(s) { + s.addEventListener("addedToStage",$bind(this,this.init)); + s.addEventListener("removedFromStage",$bind(this,this.destroy)); + if(s.stage != null) { + this.init(null); + } + } + ,removeListeners: function(s) { + s.removeEventListener("addedToStage",$bind(this,this.init)); + s.removeEventListener("removedFromStage",$bind(this,this.destroy)); + } + ,init: function(e) { + this.destroy(null); + com_davidmaletz_faengfl_FaengFL.addEnterFrame(this); + } + ,destroy: function(e) { + com_davidmaletz_faengfl_FaengFL.removeEnterFrame(this); + } + ,isOwner: function() { + if(this.enemy.area != null) { + return this.enemy.area.isActivePlayer(); + } else { + return false; + } + } + ,enter_frame: function(frames) { + this.regrowCt += frames; + if(this.regrow > 0 && this.regrowCt > this.regrow) { + this.regrowCt = 0; + if(this.isOwner()) { + this._regrow(); + } + } + if(this.root.area == null) { + return; + } + var r = this.root.renderer; + var facing = this.enemy.getFacing(); + if(r != null && this.root.info.xml.get("linkFacing") == "true") { + r.set_scaleX(facing); + } + if(this.angleP >= this.speed) { + if(this.isOwner()) { + this.angleP -= this.speed; + if(this.child != null) { + var angles = []; + this.child.setNewAngle(this.root,this.angle,facing,angles); + if(angles.length > 0) { + this.enemy.dispatchEvent(new com_davidmaletz_mining_enemy_ArmEvent("arm_move",this,angles)); + } + } + } + } else { + this.angleP += frames; + if(this.child != null) { + this.child.adjustAngle(this.root,this.angleP,facing); + } + } + } + ,_regrow: function() { + if(this.root.area == null) { + com_davidmaletz_mining_enemy_Arm.regrowArm(this.root); + } else if(this.child != null) { + this.child.regrow(this.root); + } + } + ,__class__: com_davidmaletz_mining_enemy_Arm +}; +var com_davidmaletz_mining_enemy_ArmEvent = function(type,arm,angles) { + openfl_events_Event.call(this,type); + this.arm = arm; + this.angles = angles; +}; +$hxClasses["com.davidmaletz.mining.enemy.ArmEvent"] = com_davidmaletz_mining_enemy_ArmEvent; +com_davidmaletz_mining_enemy_ArmEvent.__name__ = ["com","davidmaletz","mining","enemy","ArmEvent"]; +com_davidmaletz_mining_enemy_ArmEvent.__super__ = openfl_events_Event; +com_davidmaletz_mining_enemy_ArmEvent.prototype = $extend(openfl_events_Event.prototype,{ + arm: null + ,angles: null + ,__class__: com_davidmaletz_mining_enemy_ArmEvent +}); +var com_davidmaletz_mining_enemy__$Arm_ArmSegment = function(arm,info,x,y,angle) { + this.arm = arm; + this.root = info.create(0,0); + this.root.offsetX += x; + this.root.offsetY += y; + this.fromAngle = this.toAngle = angle; + this.root.addEventListener("removed_from_area",$bind(this,this.removed)); +}; +$hxClasses["com.davidmaletz.mining.enemy._Arm.ArmSegment"] = com_davidmaletz_mining_enemy__$Arm_ArmSegment; +com_davidmaletz_mining_enemy__$Arm_ArmSegment.__name__ = ["com","davidmaletz","mining","enemy","_Arm","ArmSegment"]; +com_davidmaletz_mining_enemy__$Arm_ArmSegment.create = function(arm,x,y,len,angle,info,end) { + if(len == 0) { + if(end == null) { + return null; + } else { + return new com_davidmaletz_mining_enemy__$Arm_ArmSegment(arm,end,x,y,angle); + } + } + var a = new com_davidmaletz_mining_enemy__$Arm_ArmSegment(arm,info,x,y,angle); + a.child = com_davidmaletz_mining_enemy__$Arm_ArmSegment.makeChild(arm,a.root,len,angle,info,end); + return a; +}; +com_davidmaletz_mining_enemy__$Arm_ArmSegment.makeChild = function(arm,parent,len,angle,info,end) { + var x = Math.round(arm.diameter * Math.cos(angle)); + var y = Math.round(arm.diameter * Math.sin(angle)); + angle += arm.deltaAng * (Math.random() * 2 - 1); + var a = com_davidmaletz_mining_enemy__$Arm_ArmSegment.create(arm,x,y,len - 1,angle,info,end); + if(a != null) { + a.root.parent = parent; + if(parent.subobjects == null) { + parent.subobjects = [a.root]; + } else { + parent.subobjects.push(a.root); + } + } + return a; +}; +com_davidmaletz_mining_enemy__$Arm_ArmSegment.prototype = { + arm: null + ,root: null + ,child: null + ,fromAngle: null + ,toAngle: null + ,removed: function(e) { + this.arm.regrowCt = 0; + } + ,setNewAngle: function(parent,parentAngle,facing,angles) { + if(this.root.area == null) { + return; + } + this.fromAngle = this.toAngle; + this.toAngle = parentAngle + this.arm.deltaAng * (Math.random() * 2 - 1); + angles.push(this.toAngle); + this.setAngle(parent,this.fromAngle,facing); + if(this.child != null) { + this.child.setNewAngle(this.root,this.toAngle,facing,angles); + } + } + ,adjustAngle: function(parent,angleP,facing) { + if(this.root.area == null) { + return; + } + this.setAngle(parent,com_fancyfish_faeng_common_Utils.interp(this.fromAngle,this.toAngle,angleP / this.arm.speed),facing); + if(this.child != null) { + this.child.adjustAngle(this.root,angleP,facing); + } + } + ,setAngle: function(parent,angle,facing) { + var x = Math.round(this.arm.diameter * Math.cos(angle)) * facing; + var y = Math.round(this.arm.diameter * Math.sin(angle)); + var r = this.root.renderer; + if(r != null && this.root.info.xml.get("linkFacing") == "true") { + r.set_scaleX(facing); + } + this.root.setOffset(); + this.root.offsetX = this.root.offsetX * facing + x; + this.root.offsetY += y; + parent.updatePos(this.root); + } + ,regrow: function(parent) { + if(this.root.area == null) { + com_davidmaletz_mining_enemy_Arm.regrowArm(this.root); + } else if(this.child != null) { + this.child.regrow(this.root); + } + } + ,__class__: com_davidmaletz_mining_enemy__$Arm_ArmSegment +}; +var com_davidmaletz_mining_enemy_Attack = function(dmg,type,anim,range,c) { + if(c == null) { + c = 0; + } + if(range == null) { + range = 0; + } + this.damage = dmg; + if(type == null) { + type = "melee"; + this.knockback = 5; + } else { + this.knockback = 0; + } + this.type = type; + this.animation = anim; + this.range = Math.round(range * com_davidmaletz_tiles_Tile.SIZE); + this.cost = c; + this.xml = null; + this.cooldown = 0; +}; +$hxClasses["com.davidmaletz.mining.enemy.Attack"] = com_davidmaletz_mining_enemy_Attack; +com_davidmaletz_mining_enemy_Attack.__name__ = ["com","davidmaletz","mining","enemy","Attack"]; +com_davidmaletz_mining_enemy_Attack.fromXML = function(xml) { + var a = new com_davidmaletz_mining_enemy_Attack(com_davidmaletz_mining_Main.parseInt(xml.get("damage")),xml.get("type"),xml.exists("animation") ? xml.get("animation") : "attack",xml.exists("range") ? com_davidmaletz_mining_Main.parseFloat(xml.get("range")) : 0,xml.exists("cost") ? com_davidmaletz_mining_Main.parseFloat(xml.get("cost")) : 0); + if(xml.exists("cooldown")) { + a.cooldown = com_davidmaletz_mining_Main.parseFloat(xml.get("cooldown")); + } + a.xml = xml; + return a; +}; +com_davidmaletz_mining_enemy_Attack.prototype = { + damage: null + ,type: null + ,xml: null + ,knockback: null + ,range: null + ,animation: null + ,cooldown: null + ,cost: null + ,copy: function() { + var a = new com_davidmaletz_mining_enemy_Attack(this.damage,this.type,this.animation,0,this.cost); + a.knockback = this.knockback; + a.range = this.range; + a.xml = this.xml; + a.cooldown = this.cooldown; + return a; + } + ,__class__: com_davidmaletz_mining_enemy_Attack +}; +var com_davidmaletz_mining_enemy_AttackRenderer = function(tile,attack_ids,attacks,fps,walk_sfx,cca) { + if(cca == null) { + cca = false; + } + this.__own_attack = null; + this.lootHandler = null; + this.lastDY = -1.0; + this.lastDX = -1.0; + this.hit_count = 0; + this.currentAttack = null; + com_davidmaletz_tiles_render_PlayAnimation.call(this,tile,this.getAnim("idle"),fps,true); + this.attacks = attacks; + this.cooldownCancelAttack = cca; + this.walk_sound = walk_sfx; + var i = 0; + var _g = 0; + while(_g < attacks.length) { + var a = attacks[_g]; + ++_g; + if(a.cooldown != 0) { + this.addCooldown(i); + } + ++i; + } + this.attack_ids = attack_ids; + var s = this.getSelf(); + if(s != null && Std["is"](s,com_davidmaletz_mining_world_AttackableObject)) { + this.onFrame = (js_Boot.__cast(s , com_davidmaletz_mining_world_AttackableObject)).getAttackInfo().onFrame; + } +}; +$hxClasses["com.davidmaletz.mining.enemy.AttackRenderer"] = com_davidmaletz_mining_enemy_AttackRenderer; +com_davidmaletz_mining_enemy_AttackRenderer.__name__ = ["com","davidmaletz","mining","enemy","AttackRenderer"]; +com_davidmaletz_mining_enemy_AttackRenderer.__interfaces__ = [com_davidmaletz_mining_world_RunAnimation,AbstractClass]; +com_davidmaletz_mining_enemy_AttackRenderer.getFPS = function(xml,default_fps) { + if(xml.exists("fps")) { + return com_davidmaletz_mining_Main.parseFloat(xml.get("fps")); + } else { + return default_fps; + } +}; +com_davidmaletz_mining_enemy_AttackRenderer.get = function(a,xml,param) { + var ret = xml == null ? null : xml.get(param); + if(ret == null) { + if(a == null || a.xml == null) { + return null; + } else { + return a.xml.get(param); + } + } else { + return ret; + } +}; +com_davidmaletz_mining_enemy_AttackRenderer.getInt = function(a,xml,param,def) { + var ret = com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,param); + if(ret == null) { + return def; + } else { + return com_davidmaletz_mining_Main.parseInt(ret); + } +}; +com_davidmaletz_mining_enemy_AttackRenderer.getFloat = function(a,xml,param,def) { + var ret = com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,param); + if(ret == null) { + return def; + } else { + return com_davidmaletz_mining_Main.parseFloat(ret); + } +}; +com_davidmaletz_mining_enemy_AttackRenderer.getAnimation = function(a,xml) { + if(xml != null && xml.exists("animation")) { + return xml.get("animation"); + } else { + return a.animation; + } +}; +com_davidmaletz_mining_enemy_AttackRenderer.getElements = function(a,xml,elem) { + var ret = xml == null ? null : xml.elementsNamed(elem); + if(ret == null || !ret.hasNext()) { + if(a == null || a.xml == null) { + ret = null; + } else { + ret = a.xml.xml.elementsNamed(elem); + } + if(ret != null && ret.hasNext()) { + return ret; + } else { + return null; + } + } else { + return ret; + } +}; +com_davidmaletz_mining_enemy_AttackRenderer.handleAttack = function(area,element,attacker,scaleX,o,a,xml,onMiss) { + var flags = (attacker.isSpirit() ? com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,"ignoreArmor") != "false" : com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,"ignoreArmor") == "true") ? 2 : 0; + if(com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,"hideAttacker") == "true") { + flags |= 4; + } + if(a != null && a.type == "melee" && a.range == 0) { + flags |= 16; + } + var crit = com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,"critical"); + var critical = crit == "true"; + if(!critical && crit != "false") { + if(o.renderer != null) { + if(o.canCritical()) { + critical = o.renderer.get_scaleX() == scaleX; + } else { + critical = false; + } + } else { + critical = false; + } + } + var r = Math.pow(Math.random(),(o.getEvasion() + 8) / 10); + if(o.canDodge() && !critical && r < 0.1 && onMiss != null && com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,"dodge") != "false") { + onMiss(o); + return 0; + } else { + var e = com_davidmaletz_mining_world_Element.get(com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,"element")); + if(e == null) { + e = element; + } + var atk = 0; + if(o.attackPower(1,0,0,e,false) > 0) { + atk = com_davidmaletz_mining_enemy_AttackRenderer.getInt(null,xml,"damage",a == null ? 0 : a.damage); + } + if(o.attackPower(0,1,0,e,false) > 0) { + atk = com_davidmaletz_mining_enemy_AttackRenderer.getInt(a,xml,"cut",0); + } else if(o.attackPower(0,0,1,e,false) > 0) { + atk = com_davidmaletz_mining_enemy_AttackRenderer.getInt(a,xml,"spirit",0); + } + var k = a == null ? 0 : a.knockback; + var knockback = com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,"knockback"); + if(knockback != null) { + k = com_davidmaletz_mining_Main.parseInt(knockback); + } + var hitEffects = new com_davidmaletz_mining_world_HitEffects(); + if(k > 0) { + hitEffects.knockback = k * com_fancyfish_faeng_common_Utils.sign(-scaleX); + } + var steal = com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,"hpSteal"); + if(steal != null) { + hitEffects.steal = attacker.parseStealHealth(steal); + } + var a1 = a; + var a11 = xml; + var a2 = a; + var a12 = xml; + hitEffects.hitEffect = new com_davidmaletz_mining_world_HitEffectEvent(null,com_davidmaletz_mining_world_ObjectInfo._getHitEffect(attacker,e,function(a21) { + return com_davidmaletz_mining_enemy_AttackRenderer.get(a1,a11,a21); + },function(a22) { + return com_davidmaletz_mining_enemy_AttackRenderer.getElements(a2,a12,a22); + }),null,null,false,1); + if(com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,"allowDefaultSfx") != "false" && area != null && area.renderer != null && o.renderer != null) { + var id = com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,"hit_sfx"); + if(id == null) { + id = com_davidmaletz_mining_world_Object.resolveObject(attacker,"attack"); + } + hitEffects.sfx = id; + } + if((flags & 16) != 0 && !o.canHit()) { + return 0; + } + com_davidmaletz_mining_world_HitEffects.current = hitEffects; + var dmg = o.loseHealth(atk,flags | (critical ? 1 : 0),attacker,e,scaleX,true); + com_davidmaletz_mining_world_HitEffects.current = null; + hitEffects.execute(o,attacker,area.renderer,dmg); + if(dmg > 0 && !attacker.isPlayer() && com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,"spawnLoot") != "false" && area != null && o.getHealth() <= 0) { + com_davidmaletz_mining_world_Projectile.spawnLoot(area,o,attacker,element); + } + return dmg; + } +}; +com_davidmaletz_mining_enemy_AttackRenderer.getTargets = function(iter) { + var attack_ids = null; + var e = iter; + while(e.hasNext()) { + var e1 = e.next(); + if(attack_ids == null) { + attack_ids = new haxe_ds_StringMap(); + } + attack_ids.set(e1.get("id"),true); + } + return attack_ids; +}; +com_davidmaletz_mining_enemy_AttackRenderer.__super__ = com_davidmaletz_tiles_render_PlayAnimation; +com_davidmaletz_mining_enemy_AttackRenderer.prototype = $extend(com_davidmaletz_tiles_render_PlayAnimation.prototype,{ + attack_ids: null + ,attacks: null + ,walk_sound: null + ,cooldowns: null + ,cooldownCancelAttack: null + ,onFrame: null + ,currentAttack: null + ,attackRepeat: null + ,attackMaxRepeat: null + ,hit_count: null + ,addCooldown: function(i) { + if(this.cooldowns == null) { + this.cooldowns = new haxe_ds_IntMap(); + } + this.cooldowns.set(i,0); + } + ,getVars: function() { + return null; + } + ,attackComplete: function(a,p) { + if(a != null && a.xml != null && a.xml.exists("afterAnimation")) { + this.playAnimation(this.getAnim(a.xml.get("afterAnimation")),false,$bind(this,this.playIdle)); + } else if(p != null) { + this.playIdle(p); + } + this.__own_attack = null; + } + ,afterAttack: function(a,p) { + this.setFrame(0); + this.currentAttack = null; + if(a.xml != null && (a.xml.get("continuous") == "true" || a.xml.exists("hits") && this.hit_count + 1 < com_davidmaletz_mining_Main.parseInt(a.xml.get("hits")))) { + var o = this.getAttackTarget(a); + if(o != null || a.type == "projectile" || a.xml != null && (a.xml.get("requireTarget") == "false" || a.xml.get("continuousTarget") == "false")) { + this.attackWith(o,a,"cont",true,this.hit_count); + this.hit_count++; + return false; + } + } + this.hit_count = 0; + if(a.xml != null) { + var i = a.xml.elementPathsNamed("post"); + if(i.hasNext()) { + var e = i.next(); + if(e.firstElement() != null) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = this.isOwnerAttack(a); + var f = $bind(this,this.attackComplete); + var a1 = a; + var p1 = p; + var tmp = function() { + f(a1,p1); + }; + new com_davidmaletz_mining_npc_NPCEventHandler(e.elements(),com_davidmaletz_mining_Main.getLocalPlayer(),this.getSelf(),tmp,this.getVars()).runAll(); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + return true; + } + } + } + this.attackComplete(a,p); + return true; + } + ,shouldAttack: function(o) { + if(this.attack_ids != null && this.attack_ids.exists(o.getId())) { + return o.canAttack(); + } else { + return false; + } + } + ,hasAttack: function() { + return this.attacks.length > 0; + } + ,hasAttackType: function(type) { + var _g = 0; + var _g1 = this.attacks; + while(_g < _g1.length) { + var a = _g1[_g]; + ++_g; + if(a.type == type) { + return true; + } + } + return false; + } + ,hasNonProjectile: function() { + var _g = 0; + var _g1 = this.attacks; + while(_g < _g1.length) { + var a = _g1[_g]; + ++_g; + if(a.type != "projectile") { + return true; + } + } + return false; + } + ,canAttack: function(o) { + if(this.hasAttack()) { + return this.shouldAttack(o); + } else { + return false; + } + } + ,canUseAttack: function(a) { + if(a.xml != null && a.xml.exists("available") && !com_davidmaletz_faengfl_EventHandler._conditionMet(a.xml.get("available"),this.getVars())) { + return false; + } + if(a.cooldown != 0 && this.cooldowns != null) { + var i = this.attacks.indexOf(a); + var c = i == -1 ? null : this.cooldowns.get(i); + if(c != null) { + return c <= 0; + } else { + return true; + } + } else { + return true; + } + } + ,getAttackRange: function(type) { + var attack_range = -1; + var _g = 0; + var _g1 = this.attacks; + while(_g < _g1.length) { + var a = _g1[_g]; + ++_g; + if((type == null && a.type != "bomb" || type == a.type) && a.range >= attack_range && this.canUseAttack(a)) { + attack_range = a.range; + } + } + return attack_range; + } + ,incType: function(type) { + return type != "bomb"; + } + ,attackInRange: function(o,a,dist) { + if(o == null || a.type == "breath" || a.type == "vertical") { + return dist <= a.range; + } + var b = this.getRectangle(); + if(a.xml != null && a.xml.exists("height")) { + b.set_top(b.get_bottom() - com_davidmaletz_mining_Main.parseInt(a.xml.get("height"))); + } + if(a.xml != null && a.xml.exists("boundsY")) { + b.y += com_davidmaletz_mining_Main.parseFloat(a.xml.get("boundsY")); + } + var top = b.y; + var bot = b.get_bottom(); + var ht = b.height; + b = o.getBounds(); + if((bot > b.get_bottom() ? b.get_bottom() : bot) - (top < b.y ? b.y : top) >= Math.min(ht,b.height) * 0.25) { + return dist <= a.range; + } else { + return false; + } + } + ,allowAttack: function() { + return true; + } + ,doAttack: function(o,dist,type) { + if(!this.allowAttack()) { + return false; + } + var _g = 0; + var _g1 = this.attacks; + while(_g < _g1.length) { + var a = _g1[_g]; + ++_g; + if((type == null && this.incType(a.type) || type == a.type || type == "notarget" && a.xml != null && a.xml.get("requireTarget") == "false") && this.attackInRange(o,a,dist) && this.canUseAttack(a)) { + this.hit_count = 0; + this.attackWith(o,a); + return true; + } + } + return false; + } + ,lastDX: null + ,lastDY: null + ,makeBreath: function(o,a) { + var dx = o == null ? this.lastDX : com_davidmaletz_mining_enemy_Enemy.adjustBounds(o.area,this.get_x(),o.getCenterX()) - this.get_x(); + var dy = o == null ? this.lastDY : o.getCenterY() - this.get_y(); + this.lastDX = dx; + this.lastDY = dy; + var i = a.xml.elementsNamed("projectile"); + var xml = i.next(); + if(xml.exists("offsetX")) { + dx -= this.get_scaleX() * com_davidmaletz_faengfl_EventHandler.execute(xml.get("offsetX"),this.getVars()); + } + if(xml.exists("offsetY")) { + dy -= com_davidmaletz_faengfl_EventHandler.execute(xml.get("offsetY"),this.getVars()); + } + var s = 1.0 / Math.sqrt(dx * dx + dy * dy); + var f = $bind(this,this.fireProjectile); + var dx1 = dx * s; + var dy1 = dy * s; + var a1 = a; + return function(a11) { + f(dx1,dy1,a1,a11); + }; + } + ,handleCooldown: function(i) { + } + ,incCooldown: function(i,val) { + var c = this.cooldowns.get(i); + if(c != null) { + this.cooldowns.set(i,c + val); + } + } + ,getCooldown: function(i) { + var c = this.cooldowns.get(i); + if(c != null) { + return c; + } else { + return 0; + } + } + ,swingMiss: function(a,xml) { + var anim = com_davidmaletz_mining_enemy_AttackRenderer.getAnimation(a,xml); + var f = $bind(this,this.afterAttack); + var a1 = a; + var tmp = function(p) { + return f(a1,p); + }; + this.playAnimation(this.getAnim(anim),false,tmp); + return 0; + } + ,_fireProjectile: function(a,xml) { + var dx = -com_fancyfish_faeng_common_Utils.sign(this.get_scaleX()); + var dy = 0; + var angle = com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,"angle"); + var min = com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,"minAngle"); + var max = com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,"maxAngle"); + if(angle != null || min != null && max != null) { + var ang = (angle == null ? com_fancyfish_faeng_common_Utils.interp(com_davidmaletz_mining_Main.parseFloat(min),com_davidmaletz_mining_Main.parseFloat(max),Math.random()) : com_davidmaletz_mining_Main.parseFloat(angle)) * Math.PI / 180; + dy = -Math.sin(ang); + dx *= Math.cos(ang); + } + this.fireProjectile(dx,dy,a,xml); + if(com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,"leftRight") == "true") { + this.fireProjectile(-dx,dy,a,xml); + } + } + ,attackWith: function(o,a,elem,show,hit_ct) { + if(hit_ct == null) { + hit_ct = 0; + } + if(show == null) { + show = true; + } + if(elem == null) { + elem = "pre"; + } + this.__own_attack = a; + if(a.cooldown != 0 && this.cooldowns != null) { + var i = this.attacks.indexOf(a); + if(i != -1) { + this.incCooldown(i,a.cooldown); + } + } + var func; + var _g = a.type; + switch(_g) { + case "beam": + var f = $bind(this,this.checkBeam); + var a1 = a; + func = function(a11) { + f(a1,a11); + }; + break; + case "breath": + func = this.makeBreath(o,a); + break; + case "omni": + var f1 = $bind(this,this.checkOmni); + var a2 = a; + func = function(a12) { + f1(a2,a12); + }; + break; + case "projectile": + var f2 = $bind(this,this._fireProjectile); + var a3 = a; + func = function(a13) { + f2(a3,a13); + }; + break; + case "vertical": + var f3 = $bind(this,this.checkVertical); + var a4 = a; + func = function(a14) { + f3(a4,a14); + }; + break; + default: + if(o == null) { + var f4 = $bind(this,this.swingMiss); + var a5 = a; + func = function(a15) { + return f4(a5,a15); + }; + } else { + var f5 = $bind(this,this.attackObject); + var o1 = o; + var a6 = a; + func = function(a16) { + return f5(o1,a6,a16); + }; + } + } + if(show) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = this.isOwnerAttack(a); + this.showAttack(a,func,elem,hit_ct); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } else { + func(null); + } + } + ,lootHandler: null + ,onHit: function(a,o,dmg,def) { + } + ,canFire: function(anim) { + if(anim != null) { + return this.animation == this.getAnim(anim); + } else { + return true; + } + } + ,allowUnderwater: function() { + return false; + } + ,updateProjectile: function(p) { + } + ,fireProjectile: function(dx,dy,a,xml) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = this.isOwnerAttack(a); + var r = com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,"repeat"); + if(r != null) { + this.currentAttack = a; + this.attackMaxRepeat = com_davidmaletz_mining_Main.parseInt(r); + this.attackRepeat = this.attackMaxRepeat; + } + var i = com_davidmaletz_mining_enemy_AttackRenderer.getElements(a,xml,"projectile"); + var anim = com_davidmaletz_mining_enemy_AttackRenderer.getAnimation(a,xml); + if(i != null) { + var attacker = this.getAttacker(); + var area = this.getArea(); + if(attacker != null && area != null) { + var e = com_davidmaletz_mining_world_Element.get(com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,"element")); + if(e == null) { + e = this.getElement(); + } + var fireAll = com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,"fireAll") == "true"; + while(i.hasNext()) { + var pxml = i.next(); + var p = new com_davidmaletz_mining_world_Projectile(attacker,pxml,com_davidmaletz_mining_enemy_AttackRenderer.getInt(null,xml,"damage",a.damage),com_davidmaletz_mining_enemy_AttackRenderer.getInt(a,xml,"cut",0),com_davidmaletz_mining_enemy_AttackRenderer.getInt(a,xml,"spirit",0),a.range + com_davidmaletz_tiles_Tile.SIZE,e,dx,dy,this.deltaFrame,this,(function(a1,f) { + return function() { + return f[0](a1[0]); + }; + })([anim],[$bind(this,this.canFire)]),this.lootHandler,(function(a2,f1) { + return function(o,a11,a21) { + f1[0](a2[0],o,a11,a21); + }; + })([a],[$bind(this,this.onHit)]),this.getVars()); + this.updateProjectile(p); + if(!pxml.exists("underwater") && (com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,"underwater") == "true" || this.allowUnderwater())) { + p.setFlag(2,true); + } + area.addProjectile(p); + if(!fireAll) { + break; + } + } + } + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + if(anim != null) { + var f2 = $bind(this,this.afterAttack); + var a3 = a; + var tmp = function(p1) { + return f2(a3,p1); + }; + this.playAnimation(this.getAnim(anim),false,tmp); + } + } + ,showEffect: function(xml,onComplete,_xml) { + var p = new com_davidmaletz_tiles_render_LinkedPlayAnimation(this,com_davidmaletz_tiles_Tile.get(xml.get("id")),xml.get("id"),15,false,com_davidmaletz_faengfl_FaengFL.remove); + if(xml.exists("offsetX")) { + p.set_x(com_davidmaletz_mining_Main.parseInt(xml.get("offsetX")) * this.get_scaleX()); + } + p.set_scaleX(this.get_scaleX()); + if(xml.exists("offsetY")) { + p.set_y(com_davidmaletz_mining_Main.parseInt(xml.get("offsetY"))); + } + if(this.parent != null && this.parent.parent != null) { + this.parent.parent.addChild(p); + } + onComplete(_xml); + } + ,fireEvent: function(e) { + } + ,showAttack: function(a,onComplete,elem,hit_ct,canFire) { + if(canFire == null) { + canFire = true; + } + if(hit_ct == null) { + hit_ct = 0; + } + if(elem == null) { + elem = "pre"; + } + var _gthis = this; + var event = new com_davidmaletz_mining_enemy_AttackEvent("attack",a,elem,hit_ct); + var beginAttack = function(onComplete1,e) { + if(onComplete1 != null) { + onComplete1(e); + } + if(canFire) { + _gthis.fireEvent(event); + } + }; + if(a.xml == null) { + this.playSFX(a,null); + beginAttack(onComplete,null); + } else { + var i = a.xml.xml.elementsNamed("effect"); + if(i.hasNext()) { + var e1 = i.next(); + var f = $bind(this,this.showEffect); + var a1 = e1; + var a2 = onComplete; + onComplete = function(a3) { + f(a1,a2,a3); + }; + } + var i1 = a.xml.elementPathsNamed(elem); + if(i1.hasNext()) { + var e2 = i1.next(); + while(i1.hasNext() && hit_ct > 0) { + e2 = i1.next(); + --hit_ct; + } + this.playSFX(a,e2.xml); + if(e2.firstElement() != null && this.isOwnerAttack(a)) { + var tmp = e2.elements(); + var tmp1 = com_davidmaletz_mining_Main.getLocalPlayer(); + var tmp2 = this.getSelf(); + var f1 = beginAttack; + var a11 = onComplete; + var e3 = e2.xml; + new com_davidmaletz_mining_enemy__$AttackRenderer_AttackEventHandler(tmp,tmp1,tmp2,function() { + f1(a11,e3); + },this.getVars()).runAll(); + } else { + beginAttack(onComplete,e2.xml); + } + } else { + this.playSFX(a,null); + beginAttack(onComplete,null); + } + } + } + ,getAttackTarget: function(a) { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,repeatAttack: function(o) { + if(o != null || this.getAnimFrame() / this.getMaxFrame() < 0.5 || this.currentAttack.xml.get("requireTarget") == "false") { + this.attackWith(o,this.currentAttack,"pre",false); + return true; + } else { + return false; + } + } + ,walk_sfx: null + ,isWalk: function() { + return this.animation == this.getAnim("walk"); + } + ,beginWalk: function() { + } + ,advanceFrame: function(frames) { + var isWalk = this.isWalk(); + if(this.walk_sound != null) { + if(isWalk) { + if(this.walk_sfx == null || this.walk_sfx.isStopped()) { + this.beginWalk(); + this.walk_sfx = com_davidmaletz_faengfl_adv_sound_Sound.playLoc(this.walk_sound,this,null,true); + } + } else if(this.walk_sfx != null) { + this.walk_sfx.stop(); + this.walk_sfx = null; + } + } + if(this.cooldowns != null) { + var i = this.cooldowns.keys(); + while(i.hasNext()) { + var i1 = i.next(); + if(i1 >= 0 || this.cooldownCancelAttack || this.animation == this.getAnim("idle") || this.animation == this.getAnim("hit") || isWalk) { + var c = this.cooldowns.get(i1); + if(c > 0) { + var v = c - frames; + this.cooldowns.set(i1,v); + if(v <= 0 && i1 < 0) { + this.handleCooldown(i1); + } + } + } + } + } + if(!this.hasLerp() && this.currentAttack != null) { + this.attackRepeat -= frames; + if(this.attackRepeat < 0) { + this.attackRepeat += this.attackMaxRepeat; + var o = this.getAttackTarget(this.currentAttack); + if(!this.repeatAttack(o)) { + this.afterAttack(this.currentAttack,this); + } + } + } + com_davidmaletz_tiles_render_PlayAnimation.prototype.advanceFrame.call(this,frames); + if(this.getArea() != null && this.onFrame != null && this.isOwner()) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + var vars = this.getVars(); + try { + vars.set("frames",frames); + com_davidmaletz_faengfl_EventHandler.interpret(this.onFrame,vars); + } catch( e ) { + haxe_CallStack.lastException = e; + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + } + ,__advanceFrame: function(frames) { + com_davidmaletz_tiles_render_PlayAnimation.prototype.advanceFrame.call(this,frames); + } + ,getSprite: function() { + return this; + } + ,runAnimation: function(anim_id,func) { + var tmp = this.getAnim(anim_id); + var tmp1 = func == null ? null : function(p) { + func(); + }; + this.playAnimation(tmp,func == null,tmp1); + } + ,_setAnimation: function(anim_id,offX,offY) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + com_davidmaletz_tiles_render_PlayAnimation.prototype.setAnimation.call(this,anim_id,offX,offY); + } + ,setAnimation: function(anim_id,offX,offY) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + this._setAnimation(anim_id,-0.5,-0.5); + } + ,playSFX: function(a,xml) { + var sfx = com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,"sfx"); + if(sfx != null) { + com_davidmaletz_faengfl_adv_sound_Sound.playLoc(sfx,this,null,false,2); + } + } + ,getCenterX: function() { + var b = this.getRectangle(); + return b.x + b.width * 0.5; + } + ,checkOmni: function(a,xml) { + var _gthis = this; + var b = this.getRectangle(); + b.inflate(a.range,a.range); + var range = a.range * a.range; + this.checkMulti(b,a,xml,function(o) { + var dx = _gthis.get_x() - o.getCenterX(); + var dy = _gthis.get_y() - o.getCenterY(); + return dx * dx + dy * dy < range; + }); + } + ,checkBeam: function(a,xml) { + var b = this.getRectangle(); + if(this.get_scaleX() > 0) { + var _g = b; + _g.set_left(_g.get_left() - a.range); + } else { + var _g1 = b; + _g1.set_right(_g1.get_right() + a.range); + } + var _g2 = b; + _g2.set_top(_g2.get_top() - com_davidmaletz_mining_enemy_AttackRenderer.getFloat(a,xml,"top",0)); + var _g3 = b; + _g3.set_bottom(_g3.get_bottom() + com_davidmaletz_mining_enemy_AttackRenderer.getFloat(a,xml,"bottom",0)); + if(this.get_scaleX() > 0) { + var _g4 = b; + _g4.set_left(_g4.get_left() - com_davidmaletz_mining_enemy_AttackRenderer.getFloat(a,xml,"left",0)); + var _g5 = b; + _g5.set_right(_g5.get_right() + com_davidmaletz_mining_enemy_AttackRenderer.getFloat(a,xml,"right",0)); + } else { + var _g6 = b; + _g6.set_right(_g6.get_right() + com_davidmaletz_mining_enemy_AttackRenderer.getFloat(a,xml,"left",0)); + var _g7 = b; + _g7.set_left(_g7.get_left() - com_davidmaletz_mining_enemy_AttackRenderer.getFloat(a,xml,"right",0)); + } + this.checkMulti(b,a,xml,null); + } + ,checkVertical: function(a,xml) { + var b = this.getRectangle(); + if(a.range < 0) { + var _g = b; + _g.set_top(_g.get_top() + a.range); + } else { + var _g1 = b; + _g1.set_bottom(_g1.get_bottom() + a.range); + } + this.checkMulti(b,a,xml,null); + } + ,checkMulti: function(b,a,xml,accept) { + var anim = com_davidmaletz_mining_enemy_AttackRenderer.getAnimation(a,xml); + var tmp = this.getAnim(anim); + var f = $bind(this,this.afterAttack); + var a1 = a; + this.playAnimation(tmp,false,function(p) { + return f(a1,p); + }); + var attacker = this.getAttacker(); + var element = this.getElement(); + var area = this.getArea(); + if(area == null || attacker == null) { + return; + } + var e = com_davidmaletz_mining_world_Element.get(com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,"element")); + if(e == null) { + e = element; + } + var overlap = com_davidmaletz_mining_enemy_AttackRenderer.getFloat(a,xml,"overlap",0.5); + var objects = []; + area.getObjects(b,function(o,rect) { + var r = o.renderer; + var tmp1; + var tmp2; + var tmp3; + if(r != null) { + var tmp4 = com_davidmaletz_mining_enemy_AttackRenderer.getInt(null,xml,"damage",a == null ? 0 : a.damage); + var tmp5 = com_davidmaletz_mining_enemy_AttackRenderer.getInt(a,xml,"cut",0); + var tmp6 = com_davidmaletz_mining_enemy_AttackRenderer.getInt(a,xml,"spirit",0); + tmp3 = com_davidmaletz_mining_world_Projectile.canHurt(attacker,o,tmp4,tmp5,tmp6,e); + } else { + tmp3 = false; + } + if(tmp3) { + tmp2 = attacker.projectileCanHurt(o); + } else { + tmp2 = false; + } + if(tmp2) { + if(accept != null) { + tmp1 = accept(o); + } else { + tmp1 = true; + } + } else { + tmp1 = false; + } + if(tmp1) { + objects.push(o); + } + return false; + },null,overlap); + var _g = 0; + while(_g < objects.length) { + var o1 = objects[_g]; + ++_g; + var tmp7 = com_fancyfish_faeng_common_Utils.sign(this.get_x() - o1.getCenterX()); + this._handleAttack(area,element,attacker,tmp7,o1,a,xml); + } + } + ,onFlip: function() { + } + ,attackObject: function(o,a,xml) { + var anim = com_davidmaletz_mining_enemy_AttackRenderer.getAnimation(a,xml); + var area = this.getArea(); + if(area == null) { + return 0; + } + var dx = o.getCenterX() - this.getCenterX(); + if(dx != 0 && (a.xml == null || a.xml.get("canFlip") != "false")) { + var loop = area.getLoop(); + if(loop > 0 && Math.abs(dx) > loop * com_davidmaletz_tiles_Tile.SIZE * 0.5) { + dx = -dx; + } + this.set_scaleX(dx > 0 ? -this.get_scaleY() : this.get_scaleY()); + this.onFlip(); + } + var f = $bind(this,this.afterAttack); + var a1 = a; + var tmp = function(p) { + return f(a1,p); + }; + this.playAnimation(this.getAnim(anim),false,tmp); + if(o.area == null) { + this.onMiss(null); + return 0; + } + var b = this.getRectangle(); + if(a.xml != null && a.xml.exists("height")) { + b.set_top(b.get_bottom() - com_davidmaletz_mining_Main.parseInt(a.xml.get("height"))); + } + if(a.xml != null && a.xml.exists("boundsY")) { + b.y += com_davidmaletz_mining_Main.parseFloat(a.xml.get("boundsY")); + } + var top = b.y; + var bot = b.get_bottom(); + var ht = b.height; + b = o.getBounds(); + if((bot > b.get_bottom() ? b.get_bottom() : bot) - (top < b.y ? b.y : top) < Math.min(ht,b.height) * 0.25 || this.getXDistance(b) > a.range) { + this.onMiss(null); + return 0; + } + var slide = com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,"slide"); + if(slide != null && slide != "false") { + var f1 = slide == "true" ? this.getMaxFrame() : com_davidmaletz_mining_Main.parseInt(slide) / this.deltaFrame; + var half = Math.round(f1 * 0.5); + var tmp1 = new com_davidmaletz_lerp_PositionKeyframe(o.getCenterX() + com_fancyfish_faeng_common_Utils.sign(this.get_scaleX()) * com_davidmaletz_tiles_Tile.SIZE * 0.5,this.get_y()); + var f2 = $bind(this,this.lerp); + var k = new com_davidmaletz_lerp_PositionKeyframe(this.get_x(),this.get_y()); + var a11 = half; + this.lerp(tmp1,half,function() { + f2(k,a11); + }); + } + var attacker = this.getAttacker(); + if(attacker == null) { + return 0; + } + return this._handleAttack(area,this.getElement(),attacker,this.get_scaleX(),o,a,xml,$bind(this,this.onMiss)); + } + ,_handleAttack: function(area,element,attacker,scaleX,o,a,xml,onMiss) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = this.isOwnerAttack(a); + var ret = com_davidmaletz_mining_enemy_AttackRenderer.handleAttack(area,element,attacker,scaleX,o,a,xml,onMiss); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + return ret; + } + ,getElement: function() { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,getAttacker: function() { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,getSelf: function() { + return this.getAttacker(); + } + ,getArea: function() { + var a = this.getAttacker(); + if(a == null) { + return null; + } else { + return a.area; + } + } + ,onMiss: function(o) { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,getRectangle: function() { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,getAnim: function(id) { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,isOwner: function() { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,__own_attack: null + ,isOwnerAttack: function(a) { + if(!(a != null && this.__own_attack == a)) { + return this.isOwner(); + } else { + return true; + } + } + ,playIdle: function(p) { + this.setFrame(0); + this.playAnimation(this.getAnim("idle"),false,$bind(this,this.playIdle)); + } + ,getXDistance: function(b,dx) { + if(dx == null) { + dx = 1; + } + var scaleX = dx * this.get_scaleX(); + var left = b.get_left(); + var right = b.get_right(); + var e = this.getRectangle(); + var loop = this.getArea().getLoop(); + if(loop > 0) { + loop *= com_davidmaletz_tiles_Tile.SIZE; + if(left > e.get_left() + loop * 0.5) { + left -= loop; + right -= loop; + } else if(left < e.get_left() - loop * 0.5) { + left += loop; + right += loop; + } + } + return Math.max(0,scaleX < 0 ? left - e.get_right() : e.get_left() - right); + } + ,canEnterFrame: function() { + var a = this.getArea(); + if(!(com_davidmaletz_faengfl_Window.window_ct == 0 || a == null)) { + return a.__id >= 0; + } else { + return true; + } + } + ,enter_frame: function(frames) { + if(this.canEnterFrame()) { + com_davidmaletz_tiles_render_PlayAnimation.prototype.enter_frame.call(this,frames); + } + } + ,canAdvanceModal: function() { + if(this.canEnterFrame()) { + return com_davidmaletz_tiles_render_PlayAnimation.prototype.canAdvanceModal.call(this); + } else { + return true; + } + } + ,__class__: com_davidmaletz_mining_enemy_AttackRenderer +}); +var com_davidmaletz_mining_enemy__$AttackRenderer_AttackEventHandler = function(xml,p,o,func,v) { + com_davidmaletz_mining_npc_NPCEventHandler.call(this,xml,p,o,func,v); +}; +$hxClasses["com.davidmaletz.mining.enemy._AttackRenderer.AttackEventHandler"] = com_davidmaletz_mining_enemy__$AttackRenderer_AttackEventHandler; +com_davidmaletz_mining_enemy__$AttackRenderer_AttackEventHandler.__name__ = ["com","davidmaletz","mining","enemy","_AttackRenderer","AttackEventHandler"]; +com_davidmaletz_mining_enemy__$AttackRenderer_AttackEventHandler.__super__ = com_davidmaletz_mining_npc_NPCEventHandler; +com_davidmaletz_mining_enemy__$AttackRenderer_AttackEventHandler.prototype = $extend(com_davidmaletz_mining_npc_NPCEventHandler.prototype,{ + _handleNode: function(n) { + if(n.get_nodeName() == "projectile" || n.get_nodeName() == "hitEffect") { + return false; + } else { + return com_davidmaletz_mining_npc_NPCEventHandler.prototype._handleNode.call(this,n); + } + } + ,__class__: com_davidmaletz_mining_enemy__$AttackRenderer_AttackEventHandler +}); +var com_davidmaletz_mining_enemy_AttackEvent = function(type,a,elem,hit_ct) { + openfl_events_Event.call(this,type); + this.attack = a; + this.elem = elem; + this.hit_ct = hit_ct; +}; +$hxClasses["com.davidmaletz.mining.enemy.AttackEvent"] = com_davidmaletz_mining_enemy_AttackEvent; +com_davidmaletz_mining_enemy_AttackEvent.__name__ = ["com","davidmaletz","mining","enemy","AttackEvent"]; +com_davidmaletz_mining_enemy_AttackEvent.__super__ = openfl_events_Event; +com_davidmaletz_mining_enemy_AttackEvent.prototype = $extend(openfl_events_Event.prototype,{ + attack: null + ,elem: null + ,hit_ct: null + ,__class__: com_davidmaletz_mining_enemy_AttackEvent +}); +var com_davidmaletz_mining_world_AttackableObject = function(info,x,y) { + this.back_defense = -1; + this.front_defense = -1; + this.animPrefix = null; + com_davidmaletz_mining_world_TooltipObject.call(this,info,x,y); + var t = com_davidmaletz_tiles_Tile.get(info.tile); + this._width = t.getWidth(); + this._height = t.getHeight(); + this._hidden = info.xml.exists("hidden") ? info.xml.get("hidden") == "true" : this.isSpirit(); + if(info.xml.exists("width")) { + this._width = com_davidmaletz_mining_Main.parseInt(info.xml.get("width")); + } + if(info.xml.exists("height")) { + this._height = com_davidmaletz_mining_Main.parseInt(info.xml.get("height")); + } + if(info.light != null) { + this.light = new com_davidmaletz_mining_world_Light(info.light,Math.round(this.getCenterX()),Math.round(this.getCenterY())); + } + this.vars = com_davidmaletz_faengfl_EventHandler.createVariables(); + this.vars.set("this",this); + this.element = com_davidmaletz_mining_world_Element.get(info.xml.get("element")); + var i = info.xml.elementsNamed("addEvents"); + while(i.hasNext()) com_davidmaletz_faengfl_EventHandler.execute(com_fancyfish_faeng_common_Lang.escape(i.next().firstChild().get_nodeValue()),this.vars); +}; +$hxClasses["com.davidmaletz.mining.world.AttackableObject"] = com_davidmaletz_mining_world_AttackableObject; +com_davidmaletz_mining_world_AttackableObject.__name__ = ["com","davidmaletz","mining","world","AttackableObject"]; +com_davidmaletz_mining_world_AttackableObject.__super__ = com_davidmaletz_mining_world_TooltipObject; +com_davidmaletz_mining_world_AttackableObject.prototype = $extend(com_davidmaletz_mining_world_TooltipObject.prototype,{ + light: null + ,_hidden: null + ,animPrefix: null + ,front_defense: null + ,back_defense: null + ,vars: null + ,element: null + ,resetShape: function() { + var t = com_davidmaletz_tiles_Tile.get(this.getAttackInfo().tile); + this.reshape(t.getWidth(),t.getHeight()); + } + ,onFlip: function() { + if(this.renderer != null && this.light != null) { + var r = this.light.getRenderer(); + if(r != null) { + r.set_scaleX(this.renderer.get_scaleX()); + } + } + this.runEvent(com_davidmaletz_mining_Main.getLocalPlayer(),"positionChanged"); + com_davidmaletz_mining_world_TooltipObject.prototype.onFlip.call(this); + } + ,getAttackInfo: function() { + return this.info; + } + ,attackPower: function(attack,cut,spirit,element,player) { + var e = com_davidmaletz_mining_world_Element.get(this.info.xml.get("damageElement")); + if(e != null && e != element) { + return 0; + } + if(this.isSpirit()) { + return spirit; + } else { + return attack; + } + } + ,isHidden: function() { + return this._hidden; + } + ,setHidden: function(b) { + if(b != this._hidden) { + this._hidden = b; + this.dispatchEvent(new openfl_events_Event("hidden")); + } + } + ,moveRenderer: function(old_x,old_y,init) { + if(init == null) { + init = false; + } + com_davidmaletz_mining_world_TooltipObject.prototype.moveRenderer.call(this,old_x,old_y,init); + if(this.light != null) { + this.light.setPosition(Math.round(this.renderer.get_x()),Math.round(this.renderer.get_y())); + } + } + ,addLights: function() { + if(this.light != null) { + this.light.addToArea(this.area); + } + } + ,removeLights: function(area) { + if(this.light != null) { + this.light.removeFromArea(area); + } + } + ,addedToArea: function() { + this.addLights(); + } + ,removedFromArea: function(area) { + this.removeLights(area); + } + ,runEvent: function(p,event,onComplete,v,val) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + if(p == com_davidmaletz_mining_Main.getLocalPlayer()) { + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + } + if(p != null) { + com_davidmaletz_mining_npc_NPCEventHandler.setPlayerVariables(this.vars,p); + } + if(v != null) { + this.vars.set(v,val); + } + this.getAttackInfo().runEvent(p,event,this,onComplete,this.vars); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + ,onOver: function(p) { + com_davidmaletz_mining_world_TooltipObject.prototype.onOver.call(this,p); + this.runEvent(p,"over"); + } + ,onOut: function(p) { + com_davidmaletz_mining_world_TooltipObject.prototype.onOut.call(this,p); + this.runEvent(p,"out"); + } + ,onEnter: function(p) { + com_davidmaletz_mining_world_TooltipObject.prototype.onEnter.call(this,p); + this.runEvent(p,"enter"); + } + ,onExit: function(p) { + com_davidmaletz_mining_world_TooltipObject.prototype.onExit.call(this,p); + this.runEvent(p,"exit"); + } + ,doOperate: function(p) { + } + ,onOperate: function(p) { + var f = $bind(this,this.doOperate); + var p1 = p; + this.runEvent(p,"operate",function() { + f(p1); + }); + } + ,setVulnerable: function(front,back) { + if(this.front_defense != front || this.back_defense != back) { + this.front_defense = front; + this.back_defense = back; + this.dispatchEvent(new openfl_events_Event("update_defense")); + } + } + ,endVulnerable: function() { + if(this.front_defense != -1) { + this.front_defense = -1; + this.back_defense = -1; + this.dispatchEvent(new openfl_events_Event("update_defense")); + } + } + ,onHit: function() { + if(this.front_defense != -1 && this.front_defense < this.getAttackInfo().front_defense) { + this.endVulnerable(); + } + } + ,getDefense: function(element,behind,critical,useDurability) { + var d = this.getAttackInfo().getDefense(element,behind); + if(behind && this.back_defense >= 0) { + d = this.back_defense; + } else if(!behind && this.front_defense >= 0) { + d = this.front_defense; + } + if(critical && !behind) { + d = com_fancyfish_faeng_common_Utils.min(this.getDefense(element,true,false,useDurability),d); + } + return d; + } + ,getDefenseElement: function() { + return this.element; + } + ,overlapSecond: function(p) { + com_davidmaletz_mining_world_TooltipObject.prototype.overlapSecond.call(this,p); + this.runEvent(p,"overSecond"); + } + ,_playAnimation: function(animation,onComplete,loop) { + if(loop == null) { + loop = false; + } + if(this.renderer != null) { + var r = js_Boot.__cast(this.renderer , com_davidmaletz_mining_enemy_AttackRenderer); + r.setFrame(0); + r.playAnimation(this.getAttackInfo().getAnim(animation,this.animPrefix),loop,onComplete == null ? $bind(r,r.playIdle) : function(p) { + onComplete(); + }); + } else { + com_davidmaletz_mining_world_TooltipObject.prototype.playAnimation.call(this,animation,onComplete,loop); + } + } + ,getRendererBounds: function() { + var r = com_davidmaletz_mining_world_BaseObject.rectangle; + r.setTo(-this._width * 0.5,-this._height * 0.5,this._width,this._height); + return r; + } + ,getIconFrame: function() { + return com_davidmaletz_mining_world_Object.getFrame(this.getAttackInfo().getAnim("idle",this.animPrefix)); + } + ,createIcon: function(cenX,cenY) { + if(cenY == null) { + cenY = 0.5; + } + if(cenX == null) { + cenX = 0.5; + } + var r = new com_davidmaletz_tiles_render_TileAnimationRenderer(this.getTileIcon(),10); + r.setAnimation(this.getAttackInfo().getAnim("idle",this.animPrefix),-cenX,-cenY); + r.set_x(Math.round(this.getCenterX())); + r.set_y(Math.round(this.getCenterY() + this.getOffsetY())); + return r; + } + ,getAnim: function(id) { + return this.getAttackInfo().getAnim(id,this.animPrefix); + } + ,playAnimation: function(animation,onComplete,loop) { + if(loop == null) { + loop = false; + } + this._playAnimation(animation,onComplete,loop); + if(!loop) { + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("play",animation)); + } + } + ,readId: function(b) { + com_davidmaletz_mining_world_TooltipObject.prototype.readId.call(this,b); + var x = this.xPos; + var y = this.yTile; + this.setVulnerable(b.readInt16(),b.readInt16()); + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + this.setPosition(x,y); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + ,writeId: function(b) { + com_davidmaletz_mining_world_TooltipObject.prototype.writeId.call(this,b); + b.writeInt16(this.front_defense); + b.writeInt16(this.back_defense); + } + ,__class__: com_davidmaletz_mining_world_AttackableObject +}); +var com_davidmaletz_mining_world_RideableObject = function(info,x,y) { + com_davidmaletz_mining_world_AttackableObject.call(this,info,x,y); + this.hasO2 = info.xml.get("hasO2") == "true"; +}; +$hxClasses["com.davidmaletz.mining.world.RideableObject"] = com_davidmaletz_mining_world_RideableObject; +com_davidmaletz_mining_world_RideableObject.__name__ = ["com","davidmaletz","mining","world","RideableObject"]; +com_davidmaletz_mining_world_RideableObject.__super__ = com_davidmaletz_mining_world_AttackableObject; +com_davidmaletz_mining_world_RideableObject.prototype = $extend(com_davidmaletz_mining_world_AttackableObject.prototype,{ + interior: null + ,hasO2: null + ,destroyedArea: null + ,getRideableInfo: function() { + return this.info; + } + ,getBaseInventory: function() { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,getInterior: function(areas,i) { + if(this.interior == null) { + this.interior = com_davidmaletz_mining_world_Generate.create(i.interior.area,areas,this); + this.interior.__assignId(); + if(this.area != null && this.interior != null) { + this.interiorInit(); + } + } + return this.interior; + } + ,interiorInit: function() { + this.area.addEventListener("init",$bind(this,this._init)); + this.area.addEventListener("destroy",$bind(this,this._destroy)); + if(this.area.isInit) { + this.interior.init(); + } + this.dispatchEvent(new openfl_events_Event("interior_init")); + } + ,addedToArea: function() { + this.destroyedArea = null; + if(this.interior != null) { + this.interiorInit(); + } + } + ,removedFromArea: function(area) { + area.removeEventListener("init",$bind(this,this._init)); + area.removeEventListener("destroy",$bind(this,this._destroy)); + if(this.area == null && this.interior != null) { + this.interior.destroy(); + } + this.destroyedArea = area; + } + ,_init: function(e) { + if(this.interior != null) { + this.interior.init(); + } + } + ,_destroy: function(e) { + if(this.interior != null) { + this.interior.destroy(); + } + } + ,enter: function(p,operate) { + if(operate == null) { + operate = false; + } + var _gthis = this; + if(p.vehicle != null) { + p.vehicle.doDismount(true); + } + this.runEvent(p,"enterInterior",function() { + var i = _gthis.getRideableInfo(); + _gthis.getInterior(p.areas,i); + p.doTeleport(_gthis.interior.id,operate ? i.interior.operateX : i.interior.enterX,operate ? i.interior.operateY : i.interior.enterY,false,_gthis.interior); + }); + } + ,getExitArea: function() { + if(this.area == null) { + return this.destroyedArea; + } else { + return this.area; + } + } + ,doExit: function(p,offX) { + if(offX == null) { + offX = 0; + } + var i = this.getRideableInfo(); + var a = this.getExitArea(); + if(a != null) { + p.doTeleport(a.id,this.xPos + i.interior.exitX + offX,this.yTile + i.interior.exitY,false,a); + } + } + ,_exit: function(p,offX) { + if(offX == null) { + offX = 0; + } + var s; + var a = this.getExitArea(); + var tmp; + if(a != null) { + s = a.getStructure(this.getBounds(),false); + tmp = s != null; + } else { + tmp = false; + } + if(tmp) { + var f = $bind(this,this.doExit); + var p1 = p; + var a1 = offX; + s.runEvent("rideableExit",p,function() { + f(p1,a1); + },a,"rideable",this); + } else { + this.doExit(p,offX); + } + } + ,exit: function(p,offX) { + if(offX == null) { + offX = 0; + } + var _gthis = this; + if(this.getExitArea() != null && this.getRideableInfo().interior != null) { + this.runEvent(p,"exitInterior",function() { + var f = $bind(_gthis,_gthis._exit); + var p1 = p; + var a1 = offX; + new com_davidmaletz_faengfl_transition_EllipseFade(function() { + f(p1,a1); + },30,0,p.cameraCentered() ? 0 : 72. - com_davidmaletz_tiles_Tile.SIZE * 1.5); + }); + } + } + ,exitFlying: function() { + var i = this.getRideableInfo().interior; + var ix = Math.round(this._width * 0.5 - com_davidmaletz_tiles_Tile.SIZE * 0.5); + var iy = 0; + if(i != null) { + ix = i.exitX; + iy = i.exitY; + } + var x = Math.round((this.xPos + ix) / com_davidmaletz_tiles_Tile.SIZE); + var y = Math.ceil((this.yTile + iy + 1) / com_davidmaletz_tiles_Tile.SIZE); + if(this.area.isWater(x,y)) { + return !this.area.isWater(x,this.get_tile_y()); + } else { + return this.area.emptyTile(x,y); + } + } + ,getName: function() { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,getBGAnim: function() { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,getOwner: function() { + return null; + } + ,writeInterior: function(b) { + if(this.interior != null) { + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.interior.id); + this.interior.write(b); + } else { + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + } + } + ,readInterior: function(b,version) { + var id = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(id != null) { + var i = this.getRideableInfo(); + this.interior = com_davidmaletz_mining_world_Area.readArea(id,b,version,this); + if(i.interior == null || i.interior.area != id) { + this.interior = null; + } + if(this.interior != null) { + this.interior.__assignId(); + } + } + } + ,__recycleId: function() { + com_davidmaletz_mining_world_AttackableObject.prototype.__recycleId.call(this); + if(this.interior != null) { + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p.getCurrentArea() == this.interior) { + if(p.vehicle != null) { + p.vehicle.doDismount(true); + } + if(p.area == this.interior) { + this.exit(p); + } + } + this.interior.__recycleId(); + } + } + ,__class__: com_davidmaletz_mining_world_RideableObject +}); +var com_fancyfish_faeng_display_IPoint2D = function(x,y) { + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + this.set(x,y); +}; +$hxClasses["com.fancyfish.faeng.display.IPoint2D"] = com_fancyfish_faeng_display_IPoint2D; +com_fancyfish_faeng_display_IPoint2D.__name__ = ["com","fancyfish","faeng","display","IPoint2D"]; +com_fancyfish_faeng_display_IPoint2D.prototype = { + x: null + ,y: null + ,set: function(x,y) { + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + this.x = x; + this.y = y; + } + ,toString: function() { + return "[" + this.x + "," + this.y + "]"; + } + ,__class__: com_fancyfish_faeng_display_IPoint2D +}; +var com_davidmaletz_mining_enemy_Enemy = function(info,x,y) { + this.enabled = true; + this.allowAttack = true; + com_davidmaletz_mining_world_RideableObject.call(this,info,x,y); + this.hostileFlag = info.xml.get("hostileFlag"); + if(this.hostileFlag == "") { + this.hostileFlag = null; + } + if(info.xml.get("friendly") == "true") { + this._hostile = false; + this.passPlayer = true; + } else { + this._hostile = info.xml.get("hostile") != "false"; + this.passPlayer = info.xml.get("passPlayer") == "true"; + } + if(info.subobjects != null) { + this.subobjects = []; + var _g = 0; + var _g1 = info.subobjects; + while(_g < _g1.length) { + var o = _g1[_g]; + ++_g; + var s = o.create(x,y); + s.parent = this; + this.subobjects.push(s); + } + } + var i = info.xml.elementsNamed("arm"); + if(i.hasNext()) { + if(this.subobjects == null) { + this.subobjects = []; + } + this.arms = []; + var arm = i; + while(arm.hasNext()) { + var arm1 = arm.next(); + var o1 = com_davidmaletz_mining_world_ObjectInfo.get(arm1.get("id")); + if(o1 == null || !Std["is"](o1,com_davidmaletz_mining_enemy_EnemyInfo)) { + continue; + } + var x1 = arm1.exists("x") ? com_davidmaletz_mining_Main.parseInt(arm1.get("x")) : 0; + var y1 = arm1.exists("y") ? com_davidmaletz_mining_Main.parseInt(arm1.get("y")) : 0; + var ang = arm1.exists("angle") ? com_davidmaletz_mining_Main.parseFloat(arm1.get("angle")) * Math.PI / 180 : 0; + var da = arm1.exists("angleDelta") ? com_davidmaletz_mining_Main.parseFloat(arm1.get("angleDelta")) * Math.PI / 180 : 0; + var regrow = arm1.exists("regrow") ? com_davidmaletz_mining_Main.parseFloat(arm1.get("regrow")) * 60 : 0; + var a = com_davidmaletz_mining_enemy_Arm.create(this,o1,x1,y1,com_davidmaletz_mining_Main.parseInt(arm1.get("length")),ang,da,com_davidmaletz_mining_Main.parseFloat(arm1.get("diameter")),com_davidmaletz_mining_world_ObjectInfo.get(arm1.get("end")),regrow,arm1.exists("speed") ? 60 / com_davidmaletz_mining_Main.parseFloat(arm1.get("speed")) : 60); + if(a != null) { + a.root.parent = this; + this.subobjects.push(a.root); + this.arms.push(a); + } + } + } + this.color = info.color; + this.colorScale = info.colorScale; + this.max_damage = info.xml.exists("max_damage") ? com_davidmaletz_mining_Main.parseInt(info.xml.get("max_damage")) : 1000000; +}; +$hxClasses["com.davidmaletz.mining.enemy.Enemy"] = com_davidmaletz_mining_enemy_Enemy; +com_davidmaletz_mining_enemy_Enemy.__name__ = ["com","davidmaletz","mining","enemy","Enemy"]; +com_davidmaletz_mining_enemy_Enemy.__interfaces__ = [com_davidmaletz_mining_npc_Speakable]; +com_davidmaletz_mining_enemy_Enemy.intersectX = function(x1,w1,x2,w2) { + var r1 = x1 + w1; + var r2 = x2 + w2; + return (r1 > r2 ? r2 : r1) > (x1 < x2 ? x2 : x1); +}; +com_davidmaletz_mining_enemy_Enemy.adjustBounds = function(area,selfX,adjustX) { + if(area == null) { + return adjustX; + } + var loop = area.getLoop(); + if(loop > 0) { + loop *= com_davidmaletz_tiles_Tile.SIZE; + if(adjustX > selfX + loop * 0.5) { + adjustX -= loop; + } else if(adjustX < selfX - loop * 0.5) { + adjustX += loop; + } + } + return adjustX; +}; +com_davidmaletz_mining_enemy_Enemy.__super__ = com_davidmaletz_mining_world_RideableObject; +com_davidmaletz_mining_enemy_Enemy.prototype = $extend(com_davidmaletz_mining_world_RideableObject.prototype,{ + allowAttack: null + ,enabled: null + ,hostileFlag: null + ,_hostile: null + ,subobjects: null + ,arms: null + ,passPlayer: null + ,max_damage: null + ,color: null + ,colorScale: null + ,tint: function(s) { + com_davidmaletz_faengfl_TextSprite.setColor(s,this.color,255 / this.colorScale); + return s; + } + ,changeTint: function(color,colorScale,frames) { + if(frames == null) { + frames = 0; + } + if(colorScale == null) { + colorScale = 1; + } + if(this.color != color || this.colorScale != colorScale) { + this.color = color; + this.colorScale = colorScale; + if(this.renderer != null) { + var r = (js_Boot.__cast(this.renderer , com_davidmaletz_mining_enemy_AttackRenderer)).anim_sprite; + if(frames == 0) { + this.tint(r); + } else { + r.lerp(com_davidmaletz_lerp_ColorKeyframe.fromInt(color,255 / colorScale),frames); + } + } + } + } + ,projectileCanHurt: function(o) { + if(this.info.xml.get("friendlyFire") != "false") { + return true; + } else if(this.renderer != null) { + return (js_Boot.__cast(this.renderer , com_davidmaletz_mining_enemy_AttackRenderer)).shouldAttack(o); + } else { + return false; + } + } + ,shouldPass: function(o) { + if(!this.passPlayer) { + if(com_davidmaletz_mining_enemy_Enemy.intersectX(this.xPos,this._width,o.xPos,o._width) && this.renderer != null) { + return !(js_Boot.__cast(this.renderer , com_davidmaletz_mining_enemy_AttackRenderer)).hasNonProjectile(); + } else { + return false; + } + } else { + return true; + } + } + ,getBaseInventory: function() { + return null; + } + ,canFlip: function() { + return this.info.xml.get("canFlip") != "false"; + } + ,canCritical: function() { + return this.info.xml.get("canCritical") != "false"; + } + ,updatePos: function(o) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + var offX = o.offsetX; + if(this.renderer != null && this.canFlip()) { + var s = this.renderer.get_scaleX(); + if(o.info.xml.get("flip") == "true") { + s = -s; + } + if(this.area != null && this.area.renderer != null && o.info.xml.get("linkFlip") != "false") { + var r = o.getRenderer(); + if(r != null) { + r.set_scaleX(s); + } + } + if(s < 0) { + offX = this._width - o._width - offX; + } + } + o.setPosition(this.xPos + offX,this.yTile + o.offsetY); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + ,getObjectByName: function(name) { + if(this.subobjects != null) { + var _g = 0; + var _g1 = this.subobjects; + while(_g < _g1.length) { + var o = _g1[_g]; + ++_g; + if(o.info.xml.get("name") == name) { + return o; + } + } + } + return null; + } + ,onFlip: function() { + if(this.subobjects != null) { + var _g = 0; + var _g1 = this.subobjects; + while(_g < _g1.length) { + var o = _g1[_g]; + ++_g; + this.updatePos(o); + } + } + com_davidmaletz_mining_world_RideableObject.prototype.onFlip.call(this); + } + ,moveRenderer: function(old_x,old_y,init) { + if(init == null) { + init = false; + } + com_davidmaletz_mining_world_RideableObject.prototype.moveRenderer.call(this,old_x,old_y,init); + this.onFlip(); + if(init) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + this.runEvent(null,"initRenderer"); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + } + ,addedToArea: function() { + this.addLights(); + com_davidmaletz_mining_world_RideableObject.prototype.addedToArea.call(this); + if(this.subobjects != null) { + var _g = 0; + var _g1 = this.subobjects; + while(_g < _g1.length) { + var o = _g1[_g]; + ++_g; + this.updatePos(o); + this.area.addObject(o); + } + } + this.vars.set("area",this.area); + this.runEvent(null,"addedToArea"); + } + ,removedFromArea: function(area) { + this.removeLights(area); + com_davidmaletz_mining_world_RideableObject.prototype.removedFromArea.call(this,area); + if(this.subobjects != null) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + var _g = 0; + var _g1 = this.subobjects; + while(_g < _g1.length) { + var o = _g1[_g]; + ++_g; + area.removeObject(o); + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + this.vars.set("area",area); + this.runEvent(null,"removedFromArea"); + } + ,isHostile: function() { + var p; + if(this._hostile) { + var tmp; + if(!(this.hostileFlag == null || this.getHealthPercent() < 1)) { + p = com_davidmaletz_mining_Main.getLocalState(); + tmp = p == null; + } else { + tmp = true; + } + if(!tmp) { + return p.getFlag(this.hostileFlag); + } else { + return true; + } + } else { + return false; + } + } + ,canEnterTile: function(x,y) { + if(this.info.xml.get("speed") == "0") { + return true; + } else { + return com_davidmaletz_mining_world_RideableObject.prototype.canEnterTile.call(this,x,y); + } + } + ,knockback: function(dx,passObjects) { + if(passObjects == null) { + passObjects = false; + } + if(this.info.xml.get("speed") != "0") { + com_davidmaletz_mining_world_RideableObject.prototype.knockback.call(this,dx,passObjects); + } + } + ,tileMap: null + ,getTileById: function(id) { + if(this.tileMap == null) { + return null; + } else { + return this.tileMap.get(id); + } + } + ,getTileBlockId: function(tx,ty) { + return this.area.getTileId(tx,ty,0); + } + ,isVisible: function() { + var p; + if(this.get_alpha() > 0) { + var tmp; + if(!(!this._hidden)) { + p = com_davidmaletz_mining_Main.getLocalPlayer(); + tmp = p == null; + } else { + tmp = true; + } + if(!tmp) { + return p.viewHidden.get(); + } else { + return true; + } + } else { + return false; + } + } + ,canBeAttacked: function(o,spirit) { + if((spirit || !this.isSpirit()) && this.isVisible()) { + return this.isHostile(); + } else { + return false; + } + } + ,createRenderer: function() { + return new com_davidmaletz_mining_enemy_EnemyRenderer(this); + } + ,getInfo: function() { + return this.info; + } + ,isBack: function() { + return this.info.xml.get("inFront") != "true"; + } + ,getLoot: function(e,projectile) { + return this.getInfo().getLoot(e); + } + ,onDeath: function(killer,element) { + com_davidmaletz_mining_world_RideableObject.prototype.onDeath.call(this,killer,element); + if(this.area != null) { + this.area.removeObject(this,killer,element); + if(killer != null && Std["is"](killer,com_davidmaletz_mining_Player)) { + this.defeatedBy(js_Boot.__cast(killer , com_davidmaletz_mining_Player)); + } + this.runEvent(com_davidmaletz_mining_Main.getLocalPlayer(),"onDeath",null,"killer",killer); + } + } + ,defeatedBy: function(p) { + p.addKillCount(this.info.id,1); + this.runEvent(p,"defeatedBy",null,"killer",p); + var xml = this.getInfo().xml; + if(p == com_davidmaletz_mining_Main.getLocalPlayer() && xml.exists("kill_achievement")) { + com_davidmaletz_faengfl_achievement_Achievements.instance.gainAchievement(xml.get("kill_achievement")); + } + } + ,modifyAttack: function(h,attacker) { + return com_fancyfish_faeng_common_Utils.min(this.max_damage,h); + } + ,remove: function() { + if(this.area != null) { + this.area.removeObject(this); + } + } + ,attemptCatch: function(capture,captureMod,e) { + var i = this.getInfo(); + var xml = i.xml; + if(i.getCapture(capture,e) == null || capture == 0) { + return 0; + } + capture = Math.abs(capture); + capture += captureMod; + var c = xml.exists("capture") ? com_davidmaletz_mining_Main.parseFloat(xml.get("capture")) : 1; + if(c == 0) { + return 7; + } + if(e != null && e == this.getDefenseElement()) { + capture *= 4; + } + var m = this.getHealth() / this.getMaxHealth(); + var p = Math.floor(7 * (Math.random() + Math.pow((3 - 2 * m * m) / 3,c / (2 * capture)))); + if(this.getHealth() == 1 && p > 0) { + p += 2; + } + return com_fancyfish_faeng_common_Utils.min(7,p); + } + ,changePosition: function(toX,toY) { + var _gthis = this; + var b = this.getBounds(); + var first = true; + b.x = toX; + b.y = toY; + var ar = []; + this.area.getObjects(b,function(o,rect) { + if(o.getLayer() == 5) { + var to = js_Boot.__cast(o , com_davidmaletz_mining_world_TrapObject); + if(_gthis.canTouchTrap(to)) { + ar.push(to); + } + } + return false; + }); + var _g = 0; + while(_g < ar.length) { + var to1 = ar[_g]; + ++_g; + to1.activate(first ? this : null); + if(this.area == null) { + return; + } + } + com_davidmaletz_mining_world_RideableObject.prototype.changePosition.call(this,toX,toY); + } + ,onPositionChanged: function() { + this.runEvent(com_davidmaletz_mining_Main.getLocalPlayer(),"positionChanged"); + } + ,checkTrap: function(t) { + if(this.canTouchTrap(t)) { + t.activate(this); + return true; + } else { + return false; + } + } + ,canTouchTrap: function(t) { + var c = t.getInfo().capture; + if(this.get_alpha() > 0) { + if(this.isSpirit()) { + return c < 0; + } else { + return c >= 0; + } + } else { + return false; + } + } + ,getAction: function(p) { + var i = this.info.xml.elementsNamed("tooltip"); + var hadNext = i.hasNext(); + if(hadNext) { + com_davidmaletz_mining_npc_NPCEventHandler.setPlayerVariables(this.vars,p); + } + while(i.hasNext()) { + var n = i.next(); + if(n.exists("if") && !com_davidmaletz_faengfl_EventHandler._conditionMet(n.get("if"),this.vars)) { + continue; + } + var section = n.get("section"); + var id = n.get("id"); + if(section == null) { + section = "object.tooltip"; + } + if(id == null && n.firstChild() != null) { + id = Std.string(com_davidmaletz_faengfl_EventHandler.execute(com_fancyfish_faeng_common_Lang.escape(n.firstChild().get_nodeValue()),this.vars)); + } + if(id != null && com_fancyfish_faeng_common_Lang.hasText(section,id)) { + return com_fancyfish_faeng_common_Lang.getText(section,id); + } else { + return null; + } + } + if(hadNext) { + return null; + } + if(p.getMeleeWeapon(this) == null) { + return null; + } else { + return com_fancyfish_faeng_common_Lang.getText("object.tooltip","enemy"); + } + } + ,doOperate: function(p) { + var w = p.getMeleeWeapon(this); + if(w != null) { + p.useWeapon(w,null); + } + } + ,isBlocking: function(asker) { + if(!this.isSpirit() && this.isVisible()) { + if(asker != null) { + if(!(!Std["is"](asker,com_davidmaletz_mining_enemy_EnemyInfo))) { + if((js_Boot.__cast(asker , com_davidmaletz_mining_enemy_EnemyInfo)).blockObject(this.info)) { + return this.getInfo().blockObject(asker); + } else { + return false; + } + } else { + return true; + } + } else { + return true; + } + } else { + return false; + } + } + ,getLayer: function() { + if(this.enabled) { + return 4; + } else { + return 2; + } + } + ,attackPower: function(attack,cut,spirit,element,player) { + if(this.get_alpha() != 0 && this.isVisible()) { + return com_davidmaletz_mining_world_RideableObject.prototype.attackPower.call(this,attack,cut,spirit,element,player); + } else { + return 0; + } + } + ,getMinDefense: function() { + var i = this.getInfo(); + var f = i.front_defense; + var b = i.back_defense; + if(this.front_defense >= 0) { + f = this.front_defense; + } + if(this.back_defense >= 0) { + b = this.back_defense; + } + return com_fancyfish_faeng_common_Utils.min(f,b); + } + ,onBlocked: function(attacker,playSFX,behind,showTooltip) { + if(showTooltip == null) { + showTooltip = true; + } + com_davidmaletz_mining_world_RideableObject.prototype.onBlocked.call(this,attacker,playSFX,behind,showTooltip); + if(this.renderer != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_enemy_EnemyRenderer)).onBlocked(attacker,behind); + } + } + ,moveIntoRange: function(o) { + var r = com_davidmaletz_mining_world_Object.rectangle; + r.copyFrom(this.getBounds()); + var b = o.getBounds(); + if(this.area.intersectsLoop(r,b)) { + return null; + } else { + r.x = com_davidmaletz_mining_enemy_Enemy.adjustBounds(this.area,b.x,r.x); + var x = this.xPos; + var y = this.yTile; + if(b.get_right() <= r.get_left()) { + x += Math.round(b.get_right() - r.get_left() - 1); + } else if(b.get_left() >= r.get_right()) { + x += Math.round(b.get_left() - r.get_right() + 1); + } + if(b.get_bottom() <= r.get_top()) { + y += Math.round(b.get_bottom() - r.get_top() - 1); + } else if(b.get_top() >= r.get_bottom()) { + y += Math.round(b.get_top() - r.get_bottom() + 1); + } + if(x == this.xPos && y == this.yTile) { + return null; + } + com_davidmaletz_mining_enemy_Enemy.point.set(x,y); + return com_davidmaletz_mining_enemy_Enemy.point; + } + } + ,setTile: function(x,y,framesPerPixel,onComplete) { + x *= com_davidmaletz_tiles_Tile.SIZE; + y *= com_davidmaletz_tiles_Tile.SIZE; + com_davidmaletz_mining_world_RideableObject.prototype.moveTo.call(this,x,y,framesPerPixel,onComplete); + this.setPosition(this.xPos + com_fancyfish_faeng_common_Utils.sign(x - this.xPos),this.yTile + com_fancyfish_faeng_common_Utils.sign(y - this.yTile)); + } + ,beginSpeak: function() { + this._playAnimation("talk",null,true); + } + ,endSpeak: function(closed) { + if(closed && this.renderer != null) { + var r = js_Boot.__cast(this.renderer , com_davidmaletz_mining_enemy_EnemyRenderer); + r.playIdle(r); + } + } + ,playIdle: function() { + this.endSpeak(true); + } + ,getName: function() { + return null; + } + ,getBGAnim: function() { + return this.getAnim("idle"); + } + ,__assignId: function() { + if(this.subobjects != null && this.__id < 0) { + var _g = 0; + var _g1 = this.subobjects; + while(_g < _g1.length) { + var o = _g1[_g]; + ++_g; + o.__assignId(); + } + } + com_davidmaletz_mining_world_RideableObject.prototype.__assignId.call(this); + } + ,__recycleId: function() { + if(this.subobjects != null && this.__id >= 0) { + var _g = 0; + var _g1 = this.subobjects; + while(_g < _g1.length) { + var o = _g1[_g]; + ++_g; + o.__recycleId(); + } + } + com_davidmaletz_mining_world_RideableObject.prototype.__recycleId.call(this); + } + ,writeData: function(b) { + } + ,readData: function(b,version) { + } + ,write: function(b) { + com_davidmaletz_mining_world_RideableObject.prototype.write.call(this,b); + this.writeInterior(b); + this.writeData(b); + if(com_davidmaletz_mining_world_Area.__WRITE_IDS && this.subobjects != null) { + var _g = 0; + var _g1 = this.subobjects; + while(_g < _g1.length) { + var o = _g1[_g]; + ++_g; + o.write(b); + b.writeUInt24(o.__id & 16777215); + } + } + } + ,read: function(b,version) { + com_davidmaletz_mining_world_RideableObject.prototype.read.call(this,b,version); + this.health = com_fancyfish_faeng_common_Utils.min(this.getMaxHealth(),this.health); + if(version >= 67) { + this.readInterior(b,version); + } + this.readData(b,version); + if(version >= 75 && this.subobjects != null) { + try { + var _g = 0; + var _g1 = this.subobjects; + while(_g < _g1.length) { + var o = _g1[_g]; + ++_g; + o.read(b,version); + var id = b.readUInt24(); + if(id >= 0 && id != 16777215) { + o.__loadId(id); + } + } + } catch( e ) { + haxe_CallStack.lastException = e; + } + } + } + ,onScreen: function() { + if(this.renderer != null) { + return com_davidmaletz_faengfl_FaengFL.onScreen(this.renderer,this.getRendererBounds()); + } else { + return false; + } + } + ,playAnimation: function(animation,onComplete,loop) { + if(loop == null) { + loop = false; + } + com_davidmaletz_mining_world_RideableObject.prototype.playAnimation.call(this,animation,onComplete,loop); + if(this.renderer != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_enemy_EnemyRenderer)).resetAlpha(); + } + } + ,__class__: com_davidmaletz_mining_enemy_Enemy +}); +var com_davidmaletz_mining_enemy_Dragon = function(info,x,y) { + com_davidmaletz_mining_enemy_Enemy.call(this,info,x,y); + this.spawnX = this.xPos; + this.spawnY = this.yTile; + this.attacks = -1; +}; +$hxClasses["com.davidmaletz.mining.enemy.Dragon"] = com_davidmaletz_mining_enemy_Dragon; +com_davidmaletz_mining_enemy_Dragon.__name__ = ["com","davidmaletz","mining","enemy","Dragon"]; +com_davidmaletz_mining_enemy_Dragon.__super__ = com_davidmaletz_mining_enemy_Enemy; +com_davidmaletz_mining_enemy_Dragon.prototype = $extend(com_davidmaletz_mining_enemy_Enemy.prototype,{ + attacks: null + ,spawnX: null + ,spawnY: null + ,createRenderer: function() { + return new com_davidmaletz_mining_enemy__$Dragon_DragonRenderer(this); + } + ,isHostile: function() { + return this.attacks >= 0; + } + ,canFlip: function() { + return false; + } + ,awaken: function() { + if(this.renderer != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_enemy__$Dragon_DragonRenderer)).awaken(); + } + } + ,writeData: function(b) { + com_davidmaletz_mining_enemy_Enemy.prototype.writeData.call(this,b); + b.writeInt32(this.spawnX); + b.writeInt32(this.spawnY); + b.writeInt8(this.attacks); + } + ,readData: function(b,version) { + com_davidmaletz_mining_enemy_Enemy.prototype.readData.call(this,b,version); + this.spawnX = b.readInt32(); + this.spawnY = b.readInt32(); + this.attacks = b.readInt8(); + } + ,projectileKillCollect: function() { + return true; + } + ,endSpeak: function(closed) { + if(closed && this.renderer != null) { + var r = js_Boot.__cast(this.renderer , com_davidmaletz_mining_enemy_EnemyRenderer); + r.playAnimation(this.getAnim("listen"),false,$bind(r,r.playIdle)); + } + } + ,__updateAttacks: function() { + this.dispatchEvent(new com_davidmaletz_faengfl_events_IntEvent("update_attacks",this.attacks)); + } + ,__setAttacks: function(a) { + if(this.attacks != a) { + if(this.attacks < 0 && this.renderer != null) { + var d = js_Boot.__cast(this.renderer , com_davidmaletz_mining_enemy__$Dragon_DragonRenderer); + d.awakened = true; + d.playAnimation(this.getAnim("roar"),false,$bind(d,d.playIdle)); + } + this.attacks = a; + } + } + ,__class__: com_davidmaletz_mining_enemy_Dragon +}); +var com_davidmaletz_mining_enemy_EnemyRenderer = function(e) { + this.__was_owner = true; + this.resetCt = 0; + var i = e.getInfo(); + this.enemy = e; + com_davidmaletz_mining_enemy_AttackRenderer.call(this,com_davidmaletz_tiles_Tile.get(i.tile),i.attack_ids,i.attacks,com_davidmaletz_mining_enemy_AttackRenderer.getFPS(i.xml,15),com_davidmaletz_mining_world_Object.resolveObject(e,"walk"),i.xml.get("cooldownCancelAttack") == "true"); + this.bgm = i.xml.get("bgm"); + if(this.enemy.getMaxHealth() > 0 && i.xml.get("showDamage") != "false") { + this.addChild(new com_davidmaletz_mining_renderer_ObjectHealthBar(this.enemy)); + } + this.hitColor = i.xml.exists("hitColor") ? com_davidmaletz_mining_Main.parseInt("0x" + i.xml.get("hitColor")) : 0; + this.glow = i.xml.get("glow") == "true"; + this.sleep = i.xml.get("sleep"); + this.floating = i.xml.get("renderer") == "floating"; + var e1 = i.xml.elementPathsNamed("cooldown"); + while(e1.hasNext()) { + var e2 = e1.next(); + if(this.cooldownXml == null) { + this.cooldownXml = [e2]; + } else { + this.cooldownXml.push(e2); + } + var i1 = -this.cooldownXml.length; + this.addCooldown(i1); + var f = com_davidmaletz_mining_npc_NPCEventHandler.parseFrames(e2.xml); + if(e2.get("randomOffset") == "true") { + f *= Math.random(); + } + this.incCooldown(i1,f); + } + e.tileMap = com_davidmaletz_mining_structure_Structure._addOverlay(e.info.xml,e,e.area,e.tileMap,this,null,e.vars); +}; +$hxClasses["com.davidmaletz.mining.enemy.EnemyRenderer"] = com_davidmaletz_mining_enemy_EnemyRenderer; +com_davidmaletz_mining_enemy_EnemyRenderer.__name__ = ["com","davidmaletz","mining","enemy","EnemyRenderer"]; +com_davidmaletz_mining_enemy_EnemyRenderer.square = function(f) { + return f * f; +}; +com_davidmaletz_mining_enemy_EnemyRenderer.dualFunc = function(a,b,o) { + if(a(o)) { + return b(o); + } else { + return false; + } +}; +com_davidmaletz_mining_enemy_EnemyRenderer.__super__ = com_davidmaletz_mining_enemy_AttackRenderer; +com_davidmaletz_mining_enemy_EnemyRenderer.prototype = $extend(com_davidmaletz_mining_enemy_AttackRenderer.prototype,{ + enemy: null + ,bgm: null + ,hitColor: null + ,glow: null + ,sleep: null + ,identify: null + ,cooldownXml: null + ,floating: null + ,fireEvent: function(e) { + this.enemy.dispatchEvent(e); + } + ,repeatAttack: function(o) { + var ret = com_davidmaletz_mining_enemy_AttackRenderer.prototype.repeatAttack.call(this,o); + if(!ret) { + this.enemy.dispatchEvent(new openfl_events_Event("end_attack")); + } + return ret; + } + ,superRenderGL: function(renderSession) { + com_davidmaletz_mining_enemy_AttackRenderer.prototype.__renderGL.call(this,renderSession); + } + ,__renderGL: function(renderSession) { + if(this.glow) { + com_davidmaletz_faengfl_GlowSprite.makeGlow($bind(this,this.superRenderGL),renderSession); + } else { + com_davidmaletz_mining_enemy_AttackRenderer.prototype.__renderGL.call(this,renderSession); + } + } + ,onFlip: function() { + this.enemy.onFlip(); + } + ,start_music: null + ,init: function(e) { + this.updateHidden(null); + com_davidmaletz_mining_enemy_AttackRenderer.prototype.init.call(this,e); + this.enemy.addEventListener("change_health",$bind(this,this.damage)); + if(this.sleep != null && this.enemy.getHealthPercent() == 1) { + this.playAnimation(this.getAnim(this.sleep),true); + } else { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + this.playIdle(this); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + if(this.floating || com_davidmaletz_tiles_TileAnimation.exists(this.getAnim("talk"))) { + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.handle_frame),false,PriorityManager.getPriority()); + } + com_davidmaletz_mining_Main.getLocalPlayer().viewHidden.addEventListener("updated",$bind(this,this.updateHidden)); + this.enemy.addEventListener("hidden",$bind(this,this.updateHidden)); + if(this.enemy.info.xml.exists("facing")) { + this.set_scaleX(this.enemy.info.xml.get("facing") == "right" ? -this.get_scaleY() : this.get_scaleY()); + } + this.enemy.onFlip(); + this.enemy.runEvent(com_davidmaletz_mining_Main.getLocalPlayer(),"init"); + if(this.floating) { + this.handle_frame(null); + } + var arms = this.enemy.arms; + if(arms != null) { + var _g = 0; + while(_g < arms.length) { + var a = arms[_g]; + ++_g; + a.addListeners(this); + } + } + } + ,allowAttack: function() { + return this.enemy.allowAttack; + } + ,resetAlpha: function() { + this.set_alpha(1); + } + ,destroy: function(e) { + this.resetAlpha(); + com_davidmaletz_mining_enemy_AttackRenderer.prototype.destroy.call(this,e); + this.enemy.removeEventListener("change_health",$bind(this,this.damage)); + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.handle_frame)); + if(this.bgm != null && com_davidmaletz_faengfl_adv_sound_FadeMusic.get() == this.bgm) { + this.resetBGM(com_davidmaletz_mining_Main.getLocalPlayer()); + } + com_davidmaletz_mining_Main.getLocalPlayer().viewHidden.removeEventListener("updated",$bind(this,this.updateHidden)); + this.enemy.removeEventListener("hidden",$bind(this,this.updateHidden)); + if(this.identify != null) { + com_davidmaletz_faengfl_FaengFL.remove(this.identify); + this.identify = null; + } + var arms = this.enemy.arms; + if(arms != null) { + var _g = 0; + while(_g < arms.length) { + var a = arms[_g]; + ++_g; + a.removeListeners(this); + } + } + } + ,updateHidden: function(e) { + this.set_visible(true); + } + ,set_visible: function(value) { + return com_davidmaletz_mining_enemy_AttackRenderer.prototype.set_visible.call(this,value && this.enemy.isVisible()); + } + ,resetBGM: function(p) { + if(this.start_music != null) { + com_davidmaletz_faengfl_adv_sound_FadeMusic.set(this.start_music,60); + } + } + ,getVars: function() { + return this.enemy.vars; + } + ,isHostile: function(o) { + if(Std["is"](o,com_davidmaletz_mining_enemy_Enemy)) { + return (js_Boot.__cast(o , com_davidmaletz_mining_enemy_Enemy)).isHostile(); + } else { + return false; + } + } + ,shouldAttack: function(o) { + if(!o.canAttack()) { + return false; + } + if(!(com_davidmaletz_mining_enemy_AttackRenderer.prototype.shouldAttack.call(this,o) || this.enemy.isHostile() && (o.isPlayer() || o.info.xml.get("friendly") == "true"))) { + if(this.enemy.info.xml.get("friendly") == "true" && !o.isPlayer()) { + return this.isHostile(o); + } else { + return false; + } + } else { + return true; + } + } + ,canAttack: function(o) { + if(this.enemy.info.xml.get("needsAttack") == "false") { + return this.shouldAttack(o); + } else { + return com_davidmaletz_mining_enemy_AttackRenderer.prototype.canAttack.call(this,o); + } + } + ,_setAnimation: function(anim_id,offX,offY) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + var p; + var tmp; + if(this.sleep != null && this.animation == this.getAnim(this.sleep)) { + p = com_davidmaletz_mining_Main.getLocalPlayer(); + tmp = p != null; + } else { + tmp = false; + } + if(tmp) { + this.enemy.runEvent(p,"awaken"); + } + com_davidmaletz_mining_enemy_AttackRenderer.prototype._setAnimation.call(this,anim_id,offX,offY); + this.enemy.tint(this.anim_sprite); + } + ,getAttackTarget: function(a) { + var r = a.range + this.enemy._width; + var b = this.enemy.getClosest(r,1,false,$bind(this,this.canAttack),a.type == "breath" ? r >> 1 : 0); + var ret = b == null || this.getXDistance(b.bounds) > a.range ? null : b.object; + if(ret != null || a.xml == null || a.xml.get("omnidirectional") != "true") { + return ret; + } + b = this.enemy.getClosest(r,-1,false,$bind(this,this.canAttack),a.type == "breath" ? r >> 1 : 0); + if(b == null || this.getXDistance(b.bounds,-1) > a.range) { + return null; + } else { + return b.object; + } + } + ,getElement: function() { + return this.enemy.getDefenseElement(); + } + ,__playWalk: function() { + var anim_id = this.getAnim("walk"); + if(this.animation != anim_id) { + this.setFrame(0); + this.playAnimation(anim_id,true); + } + } + ,setTile: function(x,y,speed) { + if(speed == null) { + speed = 1; + } + this.__playWalk(); + this.__setTile(x,y,this.getMaxFrame() / (com_davidmaletz_tiles_Tile.SIZE * speed)); + } + ,__setTile: function(x,y,speed) { + var dx = x * com_davidmaletz_tiles_Tile.SIZE - this.enemy.xPos; + if(dx == 0 && y * com_davidmaletz_tiles_Tile.SIZE == this.enemy.yTile) { + return; + } + this.__playWalk(); + if(dx != 0) { + this.set_scaleX(dx > 0 ? -this.get_scaleY() : this.get_scaleY()); + this.enemy.onFlip(); + } + var f = $bind(this,this.playIdle); + var p = this; + var tmp = function() { + f(p); + }; + this.enemy.setTile(x,y,speed,tmp); + if(this.isOwner()) { + this.enemy.dispatchEvent(new com_davidmaletz_mining_enemy_SetTileEvent("eset_tile",x,y,speed)); + } + } + ,_tryAttack: function(o,attack) { + com_davidmaletz_mining_world_Object.rectangle.copyFrom(this.enemy.getBounds()); + if(this.enemy.area != null && this.enemy.area.intersectsLoop(com_davidmaletz_mining_world_Object.rectangle,o.getBounds())) { + attack(); + } else { + this.playIdle(this); + } + } + ,moveIntoRange: function(o,attack,speed) { + if(speed == null) { + speed = 1; + } + var p = this.enemy.moveIntoRange(o); + if(p != null) { + this.__playWalk(); + var f = $bind(this,this._tryAttack); + var o1 = o; + var a1 = attack; + var tmp = function() { + f(o1,a1); + }; + this.moveTo(p.x,p.y,this.getMaxFrame() / (com_davidmaletz_tiles_Tile.SIZE * speed),tmp); + } else { + attack(); + } + } + ,moveTo: function(x,y,speed,onComplete) { + this.__playWalk(); + var dx = x - this.enemy.xPos; + if(dx != 0) { + this.set_scaleX(dx > 0 ? -this.get_scaleY() : this.get_scaleY()); + this.enemy.onFlip(); + } + this.enemy.moveTo(x,y,speed,onComplete); + if(this.isOwner()) { + this.enemy.dispatchEvent(new com_davidmaletz_mining_enemy_SetTileEvent("emove_to",x,y,speed)); + } + } + ,onBlocked: function(attacker,behind) { + this.enemy.vars.set("behind",behind); + this.enemy.runEvent(com_davidmaletz_mining_Main.getLocalPlayer(),"blocked",null,"attacker",attacker); + } + ,afterDamage: function(old_hp,attacker,p) { + if(p != null) { + this.playIdle(p); + } + if(this.enemy.getHealth() > 0) { + this.enemy.vars.set("old_health",old_hp); + this.enemy.runEvent(com_davidmaletz_mining_Main.getLocalPlayer(),"onHit",null,"attacker",attacker); + } + } + ,resetCt: null + ,getHitAnim: function() { + if(this.enemy.area != null && !this.enemy.isGroundTile(this.enemy.get_tile_x(),this.enemy.get_tile_y() + 1)) { + var a = this.getAnim("hover_hit"); + if(com_davidmaletz_tiles_TileAnimation.exists(a)) { + return a; + } + } + return this.getAnim("hit"); + } + ,damage: function(e) { + if(e.delta >= 0) { + return; + } + this.enemy.onHit(); + this.enemy.onFlip(); + this.enemy.runEvent(com_davidmaletz_mining_Main.getLocalPlayer(),"loseHealth",null,"e",e); + if(e.attacker != null) { + if(this.currentAttack == null && this.enemy.info.xml.get("ignoreHit") != "true" && this.get_alpha() > 0) { + this.clearTrack(com_davidmaletz_mining_world_MoveKeyframe); + var tmp = this.getHitAnim(); + var f = $bind(this,this.afterDamage); + var a1 = this.enemy.getHealth() - e.delta; + var a2 = e.attacker; + this.playAnimation(tmp,false,function(p) { + f(a1,a2,p); + }); + } else { + this.afterDamage(this.enemy.getHealth() - e.delta,e.attacker,null); + } + } + if(this.enemy.hitFx == null && this.hitColor != 0) { + com_davidmaletz_faengfl_TextSprite.setColor(this,this.hitColor); + this.resetCt = 10; + } + } + ,getMeleeAttack: function() { + var _g = 0; + var _g1 = this.attacks; + while(_g < _g1.length) { + var a = _g1[_g]; + ++_g; + if(a.type == "melee") { + return a; + } + } + return null; + } + ,getAttacker: function() { + return this.enemy; + } + ,onMiss: function(o) { + if(o == null) { + this.enemy.showPopup(true,com_fancyfish_faeng_common_Lang.getText("common","miss"),-com_davidmaletz_tiles_Tile.SIZE); + } else { + o.showPopup(true,com_fancyfish_faeng_common_Lang.getText("common","dodged")); + } + com_davidmaletz_mining_world_Object.playObject(this.enemy,"miss"); + } + ,isOwner: function() { + if(this.enemy.area != null) { + return this.enemy.area.isActivePlayer(); + } else { + return false; + } + } + ,getRectangle: function() { + return this.enemy.getBounds(); + } + ,getAnim: function(id) { + return this.enemy.getAnim(id); + } + ,handle_frame: function(e) { + if(com_davidmaletz_mining_Main.isPaused() && this.animation == this.getAnim("talk")) { + this.enter_frame(com_davidmaletz_faengfl_FaengFL.frameTime); + } + if(this.floating && this.anim_sprite != null && this.enemy.area != null && this.enemy.area.renderer != null) { + this.anim_sprite.set_y(-Math.round(com_davidmaletz_mining_renderer_Parallax.getWaveHeight(this.get_x() + this.enemy.area.renderer.get_x(),true))); + } + } + ,shouldSleep: function() { + var e = this.enemy.info.xml; + var n = com_davidmaletz_mining_Main.isNight(); + if(!(e.get("night") == "true" && !n)) { + if(e.get("night") == "false") { + return n; + } else { + return false; + } + } else { + return true; + } + } + ,handleCooldown: function(i) { + var xml = this.cooldownXml[-i - 1]; + if(this.isOwner()) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + new com_davidmaletz_mining_npc_NPCEventHandler(xml.elements(),com_davidmaletz_mining_Main.getLocalPlayer(),this.enemy,null,this.enemy.vars).runAll(); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + this.incCooldown(i,com_davidmaletz_mining_npc_NPCEventHandler.parseFrames(xml.xml)); + } + ,canEnterFrame: function() { + if(this.animation == this.getAnim("talk")) { + return true; + } else { + return com_davidmaletz_mining_enemy_AttackRenderer.prototype.canEnterFrame.call(this); + } + } + ,__was_owner: null + ,enter_frame: function(frames) { + var o = this.isOwner(); + if(o && !this.__was_owner) { + this.playIdle(this); + } + this.__was_owner = o; + com_davidmaletz_mining_enemy_AttackRenderer.prototype.enter_frame.call(this,frames); + } + ,advanceFrame: function(frames) { + if(this.enemy.enabled) { + com_davidmaletz_mining_enemy_AttackRenderer.prototype.advanceFrame.call(this,frames); + } else { + this.__advanceFrame(frames); + } + if(this.resetCt > 0) { + this.resetCt -= frames; + if(this.resetCt <= 0) { + this.enemy.updateTint(); + } + } + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(this.bgm != null && this.enemy.isHostile() && p != null && this.enemy.area != null) { + var o = p.vehicle == null ? p : p.vehicle; + var dx = o.getCenterX() - this.get_x(); + var dy = o.getCenterY() - this.get_y(); + var d = dx * dx + dy * dy; + if(com_davidmaletz_faengfl_adv_sound_FadeMusic.get() == this.bgm) { + if(d > com_davidmaletz_mining_enemy_EnemyRenderer.square(22 * com_davidmaletz_tiles_Tile.SIZE)) { + this.resetBGM(p); + } + } else if(com_davidmaletz_faengfl_Window.window_ct == 0 && d < com_davidmaletz_mining_enemy_EnemyRenderer.square(18 * com_davidmaletz_tiles_Tile.SIZE)) { + if(this.start_music == null) { + this.start_music = com_davidmaletz_faengfl_adv_sound_FadeMusic.get(); + } + com_davidmaletz_faengfl_adv_sound_FadeMusic.set(this.bgm,60); + } + } + if(this.isOwner() && this.stage != null && this.shouldSleep() && !com_davidmaletz_faengfl_FaengFL.onScreen(this,this.enemy.getRendererBounds())) { + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + this.enemy.onDeath(null,null); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + } + var _identify = p == null ? null : p.identify; + if(_identify != null && !this.enemy.isHidden() && this.enemy.parent == null && this.enemy.info.xml.get("hideInfo") != "true" && com_davidmaletz_faengfl_FaengFL.onScreenPt(this,0,0,com_davidmaletz_mining_Main.getContainer(),com_davidmaletz_tiles_Tile.SIZE * 2,0)) { + if(this.identify == null || this.identify.stage == null) { + if(this.identify != null) { + com_davidmaletz_faengfl_FaengFL.remove(this.identify); + } + this.identify = _identify.createSprite(this.enemy,p); + if(this.identify != null) { + com_davidmaletz_mining_Main.getContainer().addDisplay(this.identify,0); + } + } + } else if(this.identify != null) { + com_davidmaletz_faengfl_FaengFL.remove(this.identify); + this.identify = null; + } + } + ,canHurt: function(o) { + if(this.hasAttack()) { + return com_davidmaletz_mining_world_Projectile.canHurt(this.enemy,o,1,0,0,null); + } else { + return false; + } + } + ,getClosestForAttack: function(filter,vert) { + if(vert == null) { + vert = 0; + } + var r = this.getAttackRange() + vert * 3; + if(r < 0) { + return null; + } + var func = this.enemy.getInfo().xml.get("friendlyFire") != "false" ? $bind(this,this.canHurt) : $bind(this,this.canAttack); + var tmp; + if(filter == null) { + tmp = func; + } else { + var a = filter; + var b = func; + tmp = function(o) { + return com_davidmaletz_mining_enemy_EnemyRenderer.dualFunc(a,b,o); + }; + } + return this.enemy.getClosest(r + com_davidmaletz_tiles_Tile.SIZE,1,false,tmp,vert); + } + ,hasTarget: function(range) { + var _gthis = this; + var ret = false; + this.enemy.getOverlap(function(o,rect) { + if(o != _gthis.enemy && o.isBlocking(_gthis.enemy.info) && _gthis.canAttack(o)) { + ret = true; + return true; + } else { + return false; + } + },null,0.5,range * com_davidmaletz_tiles_Tile.SIZE); + return ret; + } + ,checkDisplayOver: function(o,a,xml) { + if(com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,"overEnemy") == "true") { + var r = o.renderer; + if(r != null) { + var ox = com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,"offsetX"); + var oy = com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,"offsetY"); + var offX = ox == null ? 0 : com_davidmaletz_mining_Main.parseFloat(ox) / this.enemy._width; + var offY = oy == null ? 0 : com_davidmaletz_mining_Main.parseFloat(oy) / this.enemy._height; + var p = new com_davidmaletz_tiles_render_LinkedPlayAnimation(r,com_davidmaletz_tiles_Tile.get(this.enemy.getInfo().tile),this.getAnim(com_davidmaletz_mining_enemy_AttackRenderer.getAnimation(a,xml)),this.getFramesPerSecond(),false,com_davidmaletz_faengfl_FaengFL.remove,offX - 0.5,offY - 0.5); + var f = com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,"overFlip"); + if(f != null) { + p.set_scaleX(com_davidmaletz_mining_Main.parseFloat(f) * r.get_scaleX()); + } + if(this.glow) { + var s = new com_davidmaletz_faengfl_GlowSprite(); + s.addChild(p); + p = s; + } + this.set_alpha(0); + r.parent.addChild(p); + } + } + } + ,attackObject: function(o,a,xml) { + var ret = com_davidmaletz_mining_enemy_AttackRenderer.prototype.attackObject.call(this,o,a,xml); + if(ret > 0 || Std["is"](o,com_davidmaletz_mining_Player) && o != com_davidmaletz_mining_Main.getLocalPlayer()) { + this.checkDisplayOver(o,a,xml); + } + return ret; + } + ,checkAttack: function(onComplete,a,xml) { + if(!this.isOwner()) { + var o = this.getAttackTarget(a); + if(o != null) { + this.checkDisplayOver(o,a,xml); + } + } + if(onComplete != null) { + onComplete(xml); + } + } + ,showAttack: function(a,onComplete,elem,hit_ct,canFire) { + if(canFire == null) { + canFire = true; + } + if(hit_ct == null) { + hit_ct = 0; + } + if(elem == null) { + elem = "pre"; + } + var f = $bind(this,this.checkAttack); + var a1 = onComplete; + var a2 = a; + com_davidmaletz_mining_enemy_AttackRenderer.prototype.showAttack.call(this,a,function(a21) { + f(a1,a2,a21); + },elem,hit_ct,canFire); + } + ,afterAttack: function(a,p) { + this.resetAlpha(); + return com_davidmaletz_mining_enemy_AttackRenderer.prototype.afterAttack.call(this,a,p); + } + ,attackComplete: function(a,p) { + this.resetAlpha(); + com_davidmaletz_mining_enemy_AttackRenderer.prototype.attackComplete.call(this,a,p); + } + ,__class__: com_davidmaletz_mining_enemy_EnemyRenderer +}); +var com_davidmaletz_mining_enemy__$Dragon_DragonRenderer = function(e) { + this.awakened = false; + this.sleep_ct = 30; + com_davidmaletz_mining_enemy_EnemyRenderer.call(this,e); + var i = e.getInfo(); + var xml = i.xml; + this.speed = xml.exists("speed") ? com_davidmaletz_mining_Main.parseFloat(xml.get("speed")) : 1; + this.MIN_HEIGHT = (js_Boot.__cast(this.enemy , com_davidmaletz_mining_enemy_Dragon)).spawnY; +}; +$hxClasses["com.davidmaletz.mining.enemy._Dragon.DragonRenderer"] = com_davidmaletz_mining_enemy__$Dragon_DragonRenderer; +com_davidmaletz_mining_enemy__$Dragon_DragonRenderer.__name__ = ["com","davidmaletz","mining","enemy","_Dragon","DragonRenderer"]; +com_davidmaletz_mining_enemy__$Dragon_DragonRenderer.__interfaces__ = [com_davidmaletz_faengfl_Soundable]; +com_davidmaletz_mining_enemy__$Dragon_DragonRenderer.__super__ = com_davidmaletz_mining_enemy_EnemyRenderer; +com_davidmaletz_mining_enemy__$Dragon_DragonRenderer.prototype = $extend(com_davidmaletz_mining_enemy_EnemyRenderer.prototype,{ + MIN_HEIGHT: null + ,sleep_ct: null + ,speed: null + ,awakened: null + ,destroy: function(e) { + com_davidmaletz_mining_enemy_EnemyRenderer.prototype.destroy.call(this,e); + if(e != null) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + var d = js_Boot.__cast(this.enemy , com_davidmaletz_mining_enemy_Dragon); + this.clearTrack(com_davidmaletz_mining_world_MoveKeyframe); + this.enemy.setPosition(d.spawnX,d.spawnY); + this.sleep_ct = 30; + this.enemy.restoreHealth(); + d.attacks = -1; + this.currentAttack = null; + this.setFrame(0); + this.playAnimation(this.enemy.getAnim("sleep"),false,$bind(this,this.playIdle)); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + } + ,getAttacks: function() { + return (js_Boot.__cast(this.enemy , com_davidmaletz_mining_enemy_Dragon)).attacks; + } + ,playIdle: function(p) { + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + if(!this.isOwner()) { + if(this.enemy.xPos != (js_Boot.__cast(this.enemy , com_davidmaletz_mining_enemy_Dragon)).spawnX) { + this.playAnimation(this.enemy.getAnim("hover"),true); + } else { + this.innerIdle(); + } + return; + } + if(this.awakened) { + this.awakened = false; + if(this.tryAttack()) { + return; + } + var d = js_Boot.__cast(this.enemy , com_davidmaletz_mining_enemy_Dragon); + d.attacks = 4; + d.__updateAttacks(); + } + var attacks = this.getAttacks(); + if(attacks > 0) { + this.nextAttack(); + return; + } + this.innerIdle(); + if(attacks == 0) { + this.sleep_ct--; + if(this.sleep_ct <= 0) { + this.sleep_ct = 30; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + this.enemy.restoreHealth(); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + var d1 = js_Boot.__cast(this.enemy , com_davidmaletz_mining_enemy_Dragon); + d1.attacks = -1; + d1.__updateAttacks(); + } + } + } + ,innerIdle: function() { + var attacks = this.getAttacks(); + var id = attacks < 0 ? "sleep" : attacks == 0 ? "idle" : "hover"; + this.setFrame(0); + this.playAnimation(this.enemy.getAnim(id),false,$bind(this,this.playIdle)); + } + ,getAttack: function() { + var state = this.getAttacks() <= 0 ? "standing" : "flying"; + var _g = 0; + var _g1 = this.enemy.getInfo().attacks; + while(_g < _g1.length) { + var a = _g1[_g]; + ++_g; + if(a.xml != null && a.type == "breath" && (!a.xml.exists("state") || a.xml.get("state") == state)) { + return a; + } + } + return null; + } + ,getClosest: function(a,dx) { + if(dx == null) { + dx = 1; + } + var r = a == null ? this.getAttackRange() : a.range; + if(r < 0) { + return null; + } + r += this.enemy._width; + return this.enemy.getClosest(r,dx,false,$bind(this,this.canAttack),r >> 1); + } + ,tryAttack: function() { + var b = this.getClosest(null); + if(b != null && b.object != null) { + this.attackWith(b.object,this.getAttack()); + return true; + } else { + b = this.getClosest(null,-1); + if(b != null && b.object != null) { + this.afterAttack(null,this); + } + return false; + } + } + ,advanceFrame: function(frames) { + if(this.isOwner() && !this.hasLerp()) { + if(this.enemy.area != null && (this.animation == this.enemy.getAnim("idle") || this.animation == this.enemy.getAnim("hover"))) { + this.tryAttack(); + } + } + com_davidmaletz_mining_enemy_EnemyRenderer.prototype.advanceFrame.call(this,frames); + } + ,onBlocked: function(attacker,behind) { + com_davidmaletz_mining_enemy_EnemyRenderer.prototype.onBlocked.call(this,attacker,behind); + this.damage(null); + } + ,awaken: function() { + this.awakened = true; + var d = js_Boot.__cast(this.enemy , com_davidmaletz_mining_enemy_Dragon); + d.attacks = 0; + d.__updateAttacks(); + this.playAnimation(this.enemy.getAnim("roar"),false,$bind(this,this.playIdle)); + } + ,damage: function(e) { + if(this.currentAttack != null) { + return; + } + var attacks = this.getAttacks(); + if(attacks <= 0 && this.isOwner()) { + if(attacks < 0 && this.enemy.area != null) { + this.enemy.area.lightTiles(this.enemy.get_tile_x(),this.enemy.get_tile_y() - 2,6); + } + this.awakened = true; + if(attacks < 0) { + var d = js_Boot.__cast(this.enemy , com_davidmaletz_mining_enemy_Dragon); + d.attacks = 0; + d.__updateAttacks(); + if(e == null) { + this.playAnimation(this.enemy.getAnim("roar"),false,$bind(this,this.playIdle)); + return; + } + } + } + if(e != null && e.attacker != null) { + var flying = this.enemy.xPos != (js_Boot.__cast(this.enemy , com_davidmaletz_mining_enemy_Dragon)).spawnX; + this.playAnimation(this.enemy.getAnim(flying ? "hover_hit" : "hit"),false,flying ? $bind(this,this.playHover) : $bind(this,this.playIdle)); + } + } + ,playHover: function(p) { + this.playAnimation(this.enemy.getAnim("hover"),true); + } + ,nextAttack: function() { + if(!this.isOwner()) { + return; + } + var d = js_Boot.__cast(this.enemy , com_davidmaletz_mining_enemy_Dragon); + var x; + var y; + d.attacks -= 1; + if(d.attacks <= 0) { + d.attacks = 0; + this.sleep_ct = 30; + x = d.spawnX; + y = d.spawnY; + } else { + x = d.spawnX + 144; + var b = this.getClosest(null); + if(b != null && b.object != null) { + y = Math.round(b.object.getCenterY() + this.enemy._height * 0.5 + com_davidmaletz_tiles_Tile.SIZE * 2 * (Math.random() - 1)); + } else { + y = d.spawnY + Math.round(com_davidmaletz_tiles_Tile.SIZE * (5 * Math.random() - 2)); + } + } + d.__updateAttacks(); + if(y < com_davidmaletz_mining_enemy__$Dragon_DragonRenderer.MAX_HEIGHT) { + y = com_davidmaletz_mining_enemy__$Dragon_DragonRenderer.MAX_HEIGHT; + } else if(y > this.MIN_HEIGHT) { + y = this.MIN_HEIGHT; + } + this.playAnimation(this.enemy.getAnim("hover"),true); + this.moveTo(x,y,this.getMaxFrame() / (com_davidmaletz_tiles_Tile.SIZE * 3),$bind(this,this.innerIdle)); + } + ,moveTo: function(x,y,speed,onComplete) { + this.playAnimation(this.enemy.getAnim("hover"),true); + this.enemy.moveTo(x,y,speed,onComplete); + if(this.isOwner()) { + this.enemy.dispatchEvent(new com_davidmaletz_mining_enemy_SetTileEvent("emove_to",x,y,speed)); + } + } + ,afterAttack: function(a,p) { + this.currentAttack = null; + this.attackComplete(a,p); + this.nextAttack(); + return false; + } + ,attackComplete: function(a,p) { + if(this.getAttacks() <= 0) { + (js_Boot.__cast(this.enemy , com_davidmaletz_mining_enemy_Dragon)).attacks = 4; + } + } + ,getSoundRange: function(vert) { + return 2; + } + ,__class__: com_davidmaletz_mining_enemy__$Dragon_DragonRenderer +}); +var com_davidmaletz_mining_enemy_SetTileEvent = function(type,x,y,speed) { + openfl_events_Event.call(this,type); + this.x = x; + this.y = y; + this.speed = speed; +}; +$hxClasses["com.davidmaletz.mining.enemy.SetTileEvent"] = com_davidmaletz_mining_enemy_SetTileEvent; +com_davidmaletz_mining_enemy_SetTileEvent.__name__ = ["com","davidmaletz","mining","enemy","SetTileEvent"]; +com_davidmaletz_mining_enemy_SetTileEvent.__super__ = openfl_events_Event; +com_davidmaletz_mining_enemy_SetTileEvent.prototype = $extend(openfl_events_Event.prototype,{ + x: null + ,y: null + ,speed: null + ,__class__: com_davidmaletz_mining_enemy_SetTileEvent +}); +var com_davidmaletz_mining_world_AttackableInfo = function(xml) { + com_davidmaletz_mining_world_ObjectInfo.call(this,xml.get("id"),xml.exists("health") ? com_davidmaletz_mining_Main.parseInt(xml.get("health")) : 0,xml); + this.tile = xml.get("tile"); + this.back_defense = xml.exists("defense") ? com_davidmaletz_mining_Main.parseInt(xml.get("defense")) : 0; + this.front_defense = xml.exists("front_defense") ? com_davidmaletz_mining_Main.parseInt(xml.get("front_defense")) : this.back_defense; + this.elementDefense = xml.exists("elementDefense") ? com_davidmaletz_mining_Main.parseInt(xml.get("elementDefense")) : 0; + this.attacks = []; + var e = xml.elementPathsNamed("attack"); + while(e.hasNext()) { + var e1 = e.next(); + this.attacks.push(com_davidmaletz_mining_enemy_Attack.fromXML(e1)); + } + if(xml.exists("damage")) { + this.attacks.push(new com_davidmaletz_mining_enemy_Attack(com_davidmaletz_mining_Main.parseInt(xml.get("damage")),null,"attack")); + } + var i = xml.elementsNamed("light"); + if(i.hasNext()) { + this.light = new com_davidmaletz_mining_world_LightInfo(i.next()); + } + var i1 = xml.elementsNamed("onFrame"); + if(i1.hasNext()) { + try { + this.onFrame = com_davidmaletz_faengfl_EventHandler.parseString(com_fancyfish_faeng_common_Lang.escape(i1.next().firstChild().get_nodeValue())); + } catch( e2 ) { + haxe_CallStack.lastException = e2; + } + } +}; +$hxClasses["com.davidmaletz.mining.world.AttackableInfo"] = com_davidmaletz_mining_world_AttackableInfo; +com_davidmaletz_mining_world_AttackableInfo.__name__ = ["com","davidmaletz","mining","world","AttackableInfo"]; +com_davidmaletz_mining_world_AttackableInfo.__super__ = com_davidmaletz_mining_world_ObjectInfo; +com_davidmaletz_mining_world_AttackableInfo.prototype = $extend(com_davidmaletz_mining_world_ObjectInfo.prototype,{ + tile: null + ,light: null + ,elementDefense: null + ,back_defense: null + ,front_defense: null + ,attacks: null + ,onFrame: null + ,minDefense: function() { + return com_fancyfish_faeng_common_Utils.min(this.back_defense,this.front_defense); + } + ,getDefense: function(element,critical) { + return (critical ? this.back_defense : this.front_defense) + (element == null ? 0 : this.elementDefense); + } + ,getIconFrame: function() { + return com_davidmaletz_mining_world_Object.getFrame(this.getAnim("idle",null)); + } + ,createIcon: function() { + return com_davidmaletz_tiles_Tile.get(this.tile); + } + ,getType: function() { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,getAnim: function(id,prefix) { + if(this.xml.exists(id + "_anim")) { + return this.xml.get(id + "_anim"); + } else { + var p = prefix == null ? this.xml.exists("animation") ? this.xml.get("animation") : this.tile : prefix; + var s = p + "." + id; + if(com_davidmaletz_tiles_TileAnimation.exists(s)) { + return s; + } else { + return this.getType() + "." + id; + } + } + } + ,__class__: com_davidmaletz_mining_world_AttackableInfo +}); +var com_davidmaletz_mining_world_RideableInfo = function(xml) { + com_davidmaletz_mining_world_AttackableInfo.call(this,xml); + var i = xml.elementsNamed("interior"); + if(i.hasNext()) { + this.interior = new com_davidmaletz_mining_world_Interior(i.next()); + } +}; +$hxClasses["com.davidmaletz.mining.world.RideableInfo"] = com_davidmaletz_mining_world_RideableInfo; +com_davidmaletz_mining_world_RideableInfo.__name__ = ["com","davidmaletz","mining","world","RideableInfo"]; +com_davidmaletz_mining_world_RideableInfo.__super__ = com_davidmaletz_mining_world_AttackableInfo; +com_davidmaletz_mining_world_RideableInfo.prototype = $extend(com_davidmaletz_mining_world_AttackableInfo.prototype,{ + interior: null + ,__class__: com_davidmaletz_mining_world_RideableInfo +}); +var com_davidmaletz_mining_enemy_EnemyInfo = function(xml) { + com_davidmaletz_mining_world_RideableInfo.call(this,xml); + this.capture = null; + if(xml.exists("trapped")) { + this.addCapture(xml.get("trapped"),1); + } + var e = xml.elementsNamed("capture"); + while(e.hasNext()) { + var e1 = e.next(); + this.addCapture(e1.get("trapped"),e1.exists("minCapture") ? com_davidmaletz_mining_Main.parseInt(e1.get("minCapture")) : 1); + } + if(this.capture != null) { + this.capture.sort(com_davidmaletz_mining_enemy_EnemyInfo.sortValue); + } + if(xml.exists("type")) { + var cls = xml.get("type"); + cls = cls.charAt(0).toUpperCase() + HxOverrides.substr(cls,1,null); + var c = Type.resolveClass("com.davidmaletz.mining.enemy." + cls); + if(c != null) { + this.type = c; + } else { + haxe_Log.trace("No enemy type found: " + xml.get("type"),{ fileName : "EnemyInfo.hx", lineNumber : 36, className : "com.davidmaletz.mining.enemy.EnemyInfo", methodName : "new"}); + } + } + this.loot = []; + var i = xml.elementsNamed("loot"); + if(i.hasNext()) { + this.loot.push(new com_davidmaletz_mining_LootHandler(i)); + } + var e2 = xml.elementsNamed("lootSet"); + while(e2.hasNext()) { + var e3 = e2.next(); + this.loot.push(new com_davidmaletz_mining_LootHandler(e3.elementsNamed("loot"))); + } + var e4 = xml.elementPathsNamed("object"); + while(e4.hasNext()) { + var e5 = e4.next(); + if(this.subobjects == null) { + this.subobjects = []; + } + if(e5.exists("id")) { + var o = com_davidmaletz_mining_world_ObjectInfo.get(e5.get("id")); + if(o != null) { + this.subobjects.push(o); + } + } else { + this.subobjects.push(new com_davidmaletz_mining_world_BasicObjectInfo(e5)); + } + } + this.attack_ids = com_davidmaletz_mining_enemy_AttackRenderer.getTargets(xml.elementsNamed("target")); +}; +$hxClasses["com.davidmaletz.mining.enemy.EnemyInfo"] = com_davidmaletz_mining_enemy_EnemyInfo; +com_davidmaletz_mining_enemy_EnemyInfo.__name__ = ["com","davidmaletz","mining","enemy","EnemyInfo"]; +com_davidmaletz_mining_enemy_EnemyInfo.sortValue = function(a,b) { + return b.second - a.second; +}; +com_davidmaletz_mining_enemy_EnemyInfo.__super__ = com_davidmaletz_mining_world_RideableInfo; +com_davidmaletz_mining_enemy_EnemyInfo.prototype = $extend(com_davidmaletz_mining_world_RideableInfo.prototype,{ + capture: null + ,type: null + ,attack_ids: null + ,loot: null + ,subobjects: null + ,addCapture: function(name,value) { + if(this.capture == null) { + this.capture = []; + } + this.capture.push(new com_fancyfish_faeng_common_Pair(name,value)); + } + ,getLoot: function(e) { + return new com_davidmaletz_mining_enemy__$EnemyInfo_LootIterator(this.loot,e); + } + ,create: function(x,y) { + if(this.type == null) { + return new com_davidmaletz_mining_enemy_Enemy(this,x,y); + } else { + return Type.createInstance(this.type,[this,x,y]); + } + } + ,getCapture: function(capture,e) { + if(this.capture == null) { + return null; + } + capture = Math.abs(capture); + if(e != null && e == com_davidmaletz_mining_world_Element.get(this.xml.get("element"))) { + capture *= 4; + } + var _g = 0; + var _g1 = this.capture; + while(_g < _g1.length) { + var c = _g1[_g]; + ++_g; + if(capture >= c.second && com_davidmaletz_mining_item_ItemInfo.exists(c.first)) { + return com_davidmaletz_mining_item_ItemInfo.get(c.first); + } + } + return null; + } + ,getType: function() { + return "enemy"; + } + ,onCapture: function(capture,e) { + var c = this.id; + if(this.xml.exists("captureId")) { + c = this.xml.get("captureId"); + } + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + p.setFlag("capture." + c,true); + this.runEvent(p,"onCapture",null); + if(this.xml.exists("trap_achievement")) { + com_davidmaletz_faengfl_achievement_Achievements.instance.gainAchievement(this.xml.get("trap_achievement")); + } + return this.getCapture(capture,e); + } + ,blockObject: function(e) { + if(!(this.xml.get("passEnemies") != "true" || this.attack_ids != null && this.attack_ids.exists(e.id))) { + return this.xml.get("friendly") == "true" != (e.xml.get("friendly") == "true"); + } else { + return true; + } + } + ,__class__: com_davidmaletz_mining_enemy_EnemyInfo +}); +var com_davidmaletz_mining_enemy__$EnemyInfo_LootIterator = function(loot,element) { + this.iterator = HxOverrides.iter(loot); + this.e = element; + this.current = this.getNext(); +}; +$hxClasses["com.davidmaletz.mining.enemy._EnemyInfo.LootIterator"] = com_davidmaletz_mining_enemy__$EnemyInfo_LootIterator; +com_davidmaletz_mining_enemy__$EnemyInfo_LootIterator.__name__ = ["com","davidmaletz","mining","enemy","_EnemyInfo","LootIterator"]; +com_davidmaletz_mining_enemy__$EnemyInfo_LootIterator.prototype = { + iterator: null + ,e: null + ,current: null + ,hasNext: function() { + return this.current != null; + } + ,next: function() { + var ret = this.current; + this.current = this.getNext(); + return ret; + } + ,getNext: function() { + while(this.iterator.hasNext()) { + var i = this.iterator.next().getLootAttack(this.e); + if(i != null && i.item != null && i.count > 0) { + return i; + } + } + return null; + } + ,__class__: com_davidmaletz_mining_enemy__$EnemyInfo_LootIterator +}; +var com_davidmaletz_mining_enemy_EnemySpawner = function(xml,offsetX,offsetY) { + this.info = com_davidmaletz_mining_world_ObjectInfo.get(xml.get("id")); + this.time = com_davidmaletz_mining_Main.parseFloat(xml.get("time")); + this.count = com_davidmaletz_mining_Main.parseInt(xml.get("count")); + this.fromX = com_davidmaletz_mining_Main.parseInt(xml.get("fromX")) + offsetX; + this.toX = com_davidmaletz_mining_Main.parseInt(xml.get("toX")) + 1 + offsetX; + this.fromY = com_davidmaletz_mining_Main.parseInt(xml.get("fromY")) + offsetY; + this.toY = com_davidmaletz_mining_Main.parseInt(xml.get("toY")) + 1 + offsetY; + this.underwater = xml.get("underwater") == "true"; + this.flying = xml.get("ground") == "false" || this.underwater; + this.bottom = com_davidmaletz_mining_enemy_EnemySpawner.parseBottom(xml); + if(this.info != null && Std["is"](this.info,com_davidmaletz_mining_enemy_EnemyInfo)) { + var e = js_Boot.__cast(this.info , com_davidmaletz_mining_enemy_EnemyInfo); + var t = com_davidmaletz_tiles_Tile.get(e.tile); + this.width = t.getWidth(); + this.height = t.getHeight(); + } else { + this.width = com_davidmaletz_tiles_Tile.SIZE; + this.height = com_davidmaletz_tiles_Tile.SIZE; + } + this.tile = xml.get("tile"); + if(xml.exists("spawnWidth")) { + this.width = com_davidmaletz_mining_Main.parseInt(xml.get("spawnWidth")); + } + if(xml.exists("spawnHeight")) { + this.height = com_davidmaletz_mining_Main.parseInt(xml.get("spawnHeight")); + } + if(xml.exists("enabled")) { + try { + this.expr = com_davidmaletz_faengfl_EventHandler.parseString(xml.get("enabled")); + } catch( e1 ) { + haxe_CallStack.lastException = e1; + if (e1 instanceof js__$Boot_HaxeError) e1 = e1.val; + com_fancyfish_faeng_common_Utils.printExceptionTrace(e1); + } + } +}; +$hxClasses["com.davidmaletz.mining.enemy.EnemySpawner"] = com_davidmaletz_mining_enemy_EnemySpawner; +com_davidmaletz_mining_enemy_EnemySpawner.__name__ = ["com","davidmaletz","mining","enemy","EnemySpawner"]; +com_davidmaletz_mining_enemy_EnemySpawner.point = null; +com_davidmaletz_mining_enemy_EnemySpawner._canPlace = function(area,sx,sy,w,h,flying,underwater,bottom,tile) { + var ex = sx + w; + var ey = sy + 1; + sy -= h - 1; + var _g1 = sy; + var _g = ey; + while(_g1 < _g) { + var y = _g1++; + var _g3 = sx; + var _g2 = ex; + while(_g3 < _g2) { + var x = _g3++; + var t = area.getTile(x,y,0); + if(t != null && area.getTileId(x,y,1) != -1 || bottom < 0 && ey - 1 == y && area.getTileId(x,y + 1,0) == -1 || bottom > 0 && sy == y && area.getTileId(x,y - 1,0) == -1 || underwater != area.isWater(x,y) || !flying && ey - 1 == y && area.emptyTile(x,y + 1)) { + return false; + } + if(tile != null) { + if(t == null) { + var back = area.getTile(x,y,3); + if(back == null || back.id != tile) { + return false; + } + } else if(t.id != tile) { + return false; + } + } else if(t != null || !underwater && com_fancyfish_faeng_common_Utils.abs(bottom) == 1 && area.getTile(x,y,3) != null) { + return false; + } + } + } + return true; +}; +com_davidmaletz_mining_enemy_EnemySpawner.parseBottom = function(xml) { + if(xml.get("bottom") == "true") { + return -1; + } else if(xml.get("top") == "true") { + return 1; + } else if(xml.get("bottom") == "back") { + return -2; + } else if(xml.get("top") == "back") { + return 2; + } else { + return 0; + } +}; +com_davidmaletz_mining_enemy_EnemySpawner.adjustBottom = function(area,x,y,fromY,toY,bottom) { + if(bottom < 0) { + --toY; + if(area.getTileId(x,y,0) == -1) { + while(y < toY && area.getTileId(x,y + 1,0) == -1) ++y; + } else { + while(y > fromY && area.getTileId(x,y,0) != -1) --y; + } + return y; + } else if(bottom > 0) { + ++fromY; + if(area.getTileId(x,y,0) == -1) { + while(y > fromY && area.getTileId(x,y - 1,0) == -1) --y; + } else { + while(y < toY && area.getTileId(x,y,0) != -1) ++y; + } + return y; + } else { + return y; + } +}; +com_davidmaletz_mining_enemy_EnemySpawner.prototype = { + info: null + ,time: null + ,count: null + ,underwater: null + ,fromX: null + ,toX: null + ,fromY: null + ,toY: null + ,flying: null + ,bottom: null + ,width: null + ,height: null + ,tile: null + ,expr: null + ,vars: null + ,inBounds: function(b) { + var r = com_davidmaletz_mining_world_Object.rectangle; + r.setTo(this.fromX * com_davidmaletz_tiles_Tile.SIZE,this.fromY * com_davidmaletz_tiles_Tile.SIZE,(this.toX - this.fromX) * com_davidmaletz_tiles_Tile.SIZE,(this.toY - this.fromY) * com_davidmaletz_tiles_Tile.SIZE); + return com_fancyfish_faeng_pack_AABBObjectList.intersects(b,r,0.5); + } + ,getSpawnTime: function() { + if(this.time == 0) { + return Infinity; + } else { + return this.time; + } + } + ,runExpr: function(p) { + if(this.vars == null) { + this.vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(p); + } else { + com_davidmaletz_mining_npc_NPCEventHandler.setPlayerVariables(this.vars,p); + } + try { + return com_davidmaletz_faengfl_EventHandler.interpret(this.expr,this.vars) == true; + } catch( e ) { + haxe_CallStack.lastException = e; + return false; + } + } + ,isEnabled: function(area) { + if(area != null && area.getLiveCount(this.info.id) >= this.count || this.info.xml.exists("night") && this.info.xml.get("night") == "true" != com_davidmaletz_mining_Main.isNight()) { + return false; + } + if(this.expr == null) { + return true; + } + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p == null) { + return false; + } else { + return this.runExpr(p); + } + } + ,canPlace: function(area,sx,sy) { + if(com_davidmaletz_mining_enemy_EnemySpawner._canPlace(area,sx,sy,Math.ceil(this.width / com_davidmaletz_tiles_Tile.SIZE),Math.ceil(this.height / com_davidmaletz_tiles_Tile.SIZE),this.flying,this.underwater,this.bottom,this.tile)) { + if(area.hasBlocker(sx * com_davidmaletz_tiles_Tile.SIZE,sy * com_davidmaletz_tiles_Tile.SIZE,this.width,this.height,this.info)) { + return false; + } + com_davidmaletz_mining_world_BaseObject.rectangle.setTo((sx - 1) * com_davidmaletz_tiles_Tile.SIZE,sy * com_davidmaletz_tiles_Tile.SIZE,this.width + 2 * com_davidmaletz_tiles_Tile.SIZE,this.height); + var s = area.getStructure(com_davidmaletz_mining_world_BaseObject.rectangle); + if(!(s == null || s.info.xml.get("allowSpawn") == "true")) { + return Std["is"](s,com_davidmaletz_mining_item_Crop); + } else { + return true; + } + } else { + return false; + } + } + ,spawn: function(area,allowInView,ct,onSpawn) { + if(ct == null) { + ct = 1; + } + if(allowInView == null) { + allowInView = false; + } + var topLeft = null; + var botRight = null; + if(area.renderer != null) { + var w = openfl_Lib.current.stage.stageWidth; + var h = openfl_Lib.current.stage.stageHeight; + if(com_davidmaletz_mining_enemy_EnemySpawner.point == null) { + com_davidmaletz_mining_enemy_EnemySpawner.point = new openfl_geom_Point(0,0); + } else { + com_davidmaletz_mining_enemy_EnemySpawner.point.setTo(0,0); + } + topLeft = area.renderer.globalToLocal(com_davidmaletz_mining_enemy_EnemySpawner.point); + topLeft.x -= com_davidmaletz_tiles_Tile.SIZE; + topLeft.y -= com_davidmaletz_tiles_Tile.SIZE; + com_davidmaletz_mining_enemy_EnemySpawner.point.setTo(w,h); + botRight = area.renderer.globalToLocal(com_davidmaletz_mining_enemy_EnemySpawner.point); + botRight.x += com_davidmaletz_tiles_Tile.SIZE; + botRight.y += com_davidmaletz_tiles_Tile.SIZE; + } + var fail = 50; + while(ct > 0 && fail > 0) { + var x = com_davidmaletz_mining_Main.randInt(this.fromX,this.toX); + var y = com_davidmaletz_mining_Main.randInt(this.fromY,this.toY); + if(this.bottom != 0) { + y = com_davidmaletz_mining_enemy_EnemySpawner.adjustBottom(area,x,y,this.fromY,this.toY,this.bottom); + } + var tx = com_davidmaletz_tiles_Tile.SIZE * x; + var ty = com_davidmaletz_tiles_Tile.SIZE * y; + if((allowInView || area.renderer == null || tx + this.width < topLeft.x || tx > botRight.x || ty < topLeft.y || ty - this.height > botRight.y) && this.canPlace(area,x,y)) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + var o = this.info.create(x * com_davidmaletz_tiles_Tile.SIZE,y * com_davidmaletz_tiles_Tile.SIZE); + area.addObject(o); + if(onSpawn != null) { + onSpawn(o); + } + --ct; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } else { + --fail; + } + } + if(ct == 0) { + return; + } + var ar = []; + var _g1 = this.fromY; + var _g = this.toY; + while(_g1 < _g) { + var y1 = _g1++; + var _g3 = this.fromX; + var _g2 = this.toX; + while(_g3 < _g2) { + var x1 = _g3++; + var tx1 = com_davidmaletz_tiles_Tile.SIZE * x1; + var ty1 = com_davidmaletz_tiles_Tile.SIZE * y1; + if((allowInView || area.renderer == null || tx1 + this.width < topLeft.x || tx1 > botRight.x || ty1 < topLeft.y || ty1 - this.height > botRight.y) && this.canPlace(area,x1,y1)) { + ar.push(x1); + ar.push(y1); + } + } + } + var n = ar.length >> 1; + var _g11 = 0; + var _g4 = ct; + while(_g11 < _g4) { + var loop = _g11++; + if(n == 0) { + break; + } + var i = Math.floor(Math.random() * n) * 2; + var x2 = ar[i]; + var y2 = ar[i + 1]; + if(i == 2 * (n - 1)) { + ar.pop(); + ar.pop(); + } else { + ar[i + 1] = ar.pop(); + ar[i] = ar.pop(); + } + --n; + if(loop > 0 && !this.canPlace(area,x2,y2)) { + continue; + } + var old1 = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + var o1 = this.info.create(x2 * com_davidmaletz_tiles_Tile.SIZE,y2 * com_davidmaletz_tiles_Tile.SIZE); + area.addObject(o1); + if(onSpawn != null) { + onSpawn(o1); + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old1; + } + } + ,__class__: com_davidmaletz_mining_enemy_EnemySpawner +}; +var com_davidmaletz_mining_enemy_EnemySpawnerHandler = function(area) { + this.area = area; + area.addEventListener("tick",$bind(this,this.handleTick)); + this.counts = []; + this.spawners = com_davidmaletz_mining_enemy_EnemySpawnerHandler.get(area.id); + var _g = 0; + var _g1 = this.spawners; + while(_g < _g1.length) { + var e = _g1[_g]; + ++_g; + this.counts.push(e.getSpawnTime()); + } +}; +$hxClasses["com.davidmaletz.mining.enemy.EnemySpawnerHandler"] = com_davidmaletz_mining_enemy_EnemySpawnerHandler; +com_davidmaletz_mining_enemy_EnemySpawnerHandler.__name__ = ["com","davidmaletz","mining","enemy","EnemySpawnerHandler"]; +com_davidmaletz_mining_enemy_EnemySpawnerHandler.MAP = null; +com_davidmaletz_mining_enemy_EnemySpawnerHandler.map = null; +com_davidmaletz_mining_enemy_EnemySpawnerHandler.loadXml = function(xml,ar,offsetX,offsetY) { + if(offsetY == null) { + offsetY = 0; + } + if(offsetX == null) { + offsetX = 0; + } + var e = xml.elementsNamed("spawner"); + while(e.hasNext()) { + var e1 = e.next(); + var s = com_davidmaletz_mining_enemy_EnemySpawnerHandler.makeSpawner(e1,offsetX,offsetY); + if(s.info != null) { + ar.push(s); + } + } + var e2 = xml.elementsNamed("appendArea"); + while(e2.hasNext()) { + var e3 = e2.next(); + var area = com_davidmaletz_mining_world_Generate.get(e3.get("id")); + if(area != null) { + var ox = Std.parseInt(e3.get("offsetX")); + var oy = Std.parseInt(e3.get("offsetY")); + com_davidmaletz_mining_enemy_EnemySpawnerHandler.loadXml(area,ar,offsetX + (ox == null ? 0 : ox),offsetY + (oy == null ? 0 : oy)); + } + } +}; +com_davidmaletz_mining_enemy_EnemySpawnerHandler.makeSpawner = function(xml,offsetX,offsetY) { + if(xml.exists("type")) { + var cls = xml.get("type") + "Spawner"; + cls = cls.charAt(0).toUpperCase() + HxOverrides.substr(cls,1,null); + var c = Type.resolveClass("com.davidmaletz.mining.enemy." + cls); + if(c != null) { + return Type.createInstance(c,[xml,offsetX,offsetY]); + } + } + return new com_davidmaletz_mining_enemy_EnemySpawner(xml,offsetX,offsetY); +}; +com_davidmaletz_mining_enemy_EnemySpawnerHandler.reset = function() { + com_davidmaletz_mining_enemy_EnemySpawnerHandler.map = null; +}; +com_davidmaletz_mining_enemy_EnemySpawnerHandler.get = function(id) { + if(id == null) { + return null; + } else { + if(com_davidmaletz_mining_enemy_EnemySpawnerHandler.map == null) { + com_davidmaletz_mining_enemy_EnemySpawnerHandler.map = new haxe_ds_StringMap(); + } + var ar = com_davidmaletz_mining_enemy_EnemySpawnerHandler.map.get(id); + if(ar == null) { + ar = []; + com_davidmaletz_mining_enemy_EnemySpawnerHandler.loadXml(com_davidmaletz_mining_world_Generate.get(id),ar); + com_davidmaletz_mining_enemy_EnemySpawnerHandler.map.set(id,ar); + } + return ar; + } +}; +com_davidmaletz_mining_enemy_EnemySpawnerHandler.prototype = { + area: null + ,spawners: null + ,counts: null + ,handleTick: function(e) { + var frames = e.value; + var len = this.counts.length; + var t = Math.round(com_davidmaletz_mining_Main._getGameTime()); + if(t == 0 || t == 24 || t == 12) { + frames *= 4; + } + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + var e1 = this.spawners[i]; + if(e1.isEnabled(this.area)) { + var c = this.counts[i]; + c -= frames; + if(c < 0) { + c += e1.getSpawnTime(); + e1.spawn(this.area); + } + this.counts[i] = c; + } + } + } + ,getInBounds: function(b) { + var ar = []; + var _g = 0; + var _g1 = this.spawners; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + if(s.inBounds(b)) { + ar.push(s); + } + } + return ar; + } + ,write: function(b) { + var len = this.counts.length; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.spawners[i].info.id); + b.writeFloat(this.counts[i]); + } + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + } + ,isEnabled: function(id) { + var i = this.getSpawner(id); + if(i != -1) { + return this.spawners[i].isEnabled(this.area); + } else { + return false; + } + } + ,getSpawner: function(id) { + var len = this.spawners.length; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + if(this.spawners[i].info.id == id) { + return i; + } + } + return -1; + } + ,spawnAll: function(id,allowInView) { + if(allowInView == null) { + allowInView = false; + } + this.spawn(id,16777215,allowInView); + } + ,spawn: function(id,ct,allowInView) { + if(allowInView == null) { + allowInView = false; + } + var i = this.getSpawner(id); + if(i != -1) { + var s = this.spawners[i]; + var form = Std["is"](s.info,com_davidmaletz_mining_enemy_EnemyInfo) ? (js_Boot.__cast(s.info , com_davidmaletz_mining_enemy_EnemyInfo)).getAnim("form",null) : null; + if(!allowInView) { + allowInView = com_davidmaletz_tiles_TileAnimation.exists(form); + } else { + allowInView = true; + } + var max = s.count - this.area.getLiveCount(s.info.id); + if(ct > max) { + ct = max; + } + if(ct == 0) { + return; + } + if(s.isEnabled(this.area)) { + s.spawn(this.area,allowInView,ct,function(o) { + var r = o.renderer; + if(r != null && allowInView) { + var e = js_Boot.__cast(r , com_davidmaletz_mining_enemy_EnemyRenderer); + e.playAnimation(form,false,$bind(e,e.playIdle)); + } + }); + } + } + } + ,spawnAt: function(id,x,y) { + var i = this.getSpawner(id); + if(i != -1) { + var s = this.spawners[i]; + if(s.canPlace(this.area,x,y)) { + this.area.addObject(s.info.create(x * com_davidmaletz_tiles_Tile.SIZE,y * com_davidmaletz_tiles_Tile.SIZE)); + } + } + } + ,readSpawner: function(b,i) { + var max = this.spawners[i].getSpawnTime(); + try { + this.counts[i] = b.readFloat(); + if(this.counts[i] > max) { + this.counts[i] = max; + } + } catch( ex ) { + haxe_CallStack.lastException = ex; + if (ex instanceof js__$Boot_HaxeError) ex = ex.val; + haxe_Log.trace(Std.string(ex),{ fileName : "EnemySpawnerHandler.hx", lineNumber : 68, className : "com.davidmaletz.mining.enemy.EnemySpawnerHandler", methodName : "readSpawner"}); + this.counts[i] = max; + } + } + ,read: function(b,version) { + if(version < 38) { + if(com_davidmaletz_mining_enemy_EnemySpawnerHandler.MAP == null) { + com_davidmaletz_mining_enemy_EnemySpawnerHandler.MAP = new haxe_ds_StringMap(); + com_davidmaletz_mining_enemy_EnemySpawnerHandler.MAP.set("start",["rat","boar","wyrm","yeti","fire_bird"]); + com_davidmaletz_mining_enemy_EnemySpawnerHandler.MAP.set("pumpkin_cave",["fire_boar"]); + com_davidmaletz_mining_enemy_EnemySpawnerHandler.MAP.set("ice_cave",["yeti"]); + com_davidmaletz_mining_enemy_EnemySpawnerHandler.MAP.set("fire_cave",["fire_bird","fire_boar"]); + } + var ar = com_davidmaletz_mining_enemy_EnemySpawnerHandler.MAP.get(this.area.id); + if(ar == null) { + return; + } + var _g = 0; + while(_g < ar.length) { + var id = ar[_g]; + ++_g; + var i = this.getSpawner(id); + if(i != -1) { + this.readSpawner(b,i); + } else { + b.readFloat(); + } + } + } else { + var id1; + while(true) { + id1 = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(!(id1 != null)) { + break; + } + var i1 = this.getSpawner(id1); + if(i1 != -1) { + this.readSpawner(b,i1); + } else { + b.readFloat(); + } + } + } + } + ,__class__: com_davidmaletz_mining_enemy_EnemySpawnerHandler +}; +var com_davidmaletz_mining_enemy_FloatUpDown = function(info,x,y) { + com_davidmaletz_mining_enemy_Enemy.call(this,info,x,y); + if(info.xml.exists("minX")) { + this.minX = com_davidmaletz_mining_Main.parseInt(info.xml.get("minX")); + } + if(info.xml.exists("maxX")) { + this.maxX = com_davidmaletz_mining_Main.parseInt(info.xml.get("maxX")); + } + if(info.xml.exists("minY")) { + this.minY = com_davidmaletz_mining_Main.parseInt(info.xml.get("minY")); + } + if(info.xml.exists("maxY")) { + this.maxY = com_davidmaletz_mining_Main.parseInt(info.xml.get("maxY")); + } + if(this.minY == null && this.maxY == null) { + this.maxY = 90; + } +}; +$hxClasses["com.davidmaletz.mining.enemy.FloatUpDown"] = com_davidmaletz_mining_enemy_FloatUpDown; +com_davidmaletz_mining_enemy_FloatUpDown.__name__ = ["com","davidmaletz","mining","enemy","FloatUpDown"]; +com_davidmaletz_mining_enemy_FloatUpDown.__super__ = com_davidmaletz_mining_enemy_Enemy; +com_davidmaletz_mining_enemy_FloatUpDown.prototype = $extend(com_davidmaletz_mining_enemy_Enemy.prototype,{ + minX: null + ,maxX: null + ,minY: null + ,maxY: null + ,canEnterTile: function(x,y) { + if(this.minX != null && x < this.minX || this.maxX != null && x > this.maxX || this.minY != null && y < this.minY || this.maxY != null && y > this.maxY) { + return false; + } + if(this.area.getTileId(x,y,0) == -1) { + return this.area.isWater(x,y); + } else { + return true; + } + } + ,createRenderer: function() { + return new com_davidmaletz_mining_enemy_FloatUpDownRenderer(this); + } + ,__class__: com_davidmaletz_mining_enemy_FloatUpDown +}); +var com_davidmaletz_mining_enemy_FloatUpDownRenderer = function(e) { + this.partial = 0; + com_davidmaletz_mining_enemy_EnemyRenderer.call(this,e); + this.dy = e.info.xml.exists("speed") ? com_davidmaletz_mining_Main.parseFloat(e.info.xml.get("speed")) : 1; + if(Math.random() < 0.5) { + this.dy *= -1; + } + this.bottom = e.info.xml.exists("bottomPad") ? com_davidmaletz_mining_Main.parseInt(e.info.xml.get("bottomPad")) : 0; +}; +$hxClasses["com.davidmaletz.mining.enemy.FloatUpDownRenderer"] = com_davidmaletz_mining_enemy_FloatUpDownRenderer; +com_davidmaletz_mining_enemy_FloatUpDownRenderer.__name__ = ["com","davidmaletz","mining","enemy","FloatUpDownRenderer"]; +com_davidmaletz_mining_enemy_FloatUpDownRenderer.__super__ = com_davidmaletz_mining_enemy_EnemyRenderer; +com_davidmaletz_mining_enemy_FloatUpDownRenderer.prototype = $extend(com_davidmaletz_mining_enemy_EnemyRenderer.prototype,{ + dy: null + ,bottom: null + ,partial: null + ,advanceFrame: function(frames) { + var owner = this.isOwner(); + if(!owner && this.hasTrack(com_davidmaletz_lerp_PositionKeyframe)) { + com_davidmaletz_mining_enemy_EnemyRenderer.prototype.advanceFrame.call(this,frames); + return; + } + if(this.dy == 0 && owner) { + this.dy = this.enemy.info.xml.exists("speed") ? com_davidmaletz_mining_Main.parseFloat(this.enemy.info.xml.get("speed")) : 1; + } + var delta = this.dy * frames; + var d = Math.floor(delta); + this.partial += delta - d; + if(this.partial >= 1) { + ++d; + this.partial -= 1; + } + var area = this.enemy.area; + if(d != 0 && area != null && this.dy != 0) { + var b = this.enemy.getBounds(); + if(d < 0) { + var _g = b; + _g.set_top(_g.get_top() + d); + } else { + var _g1 = b; + _g1.set_bottom(_g1.get_bottom() + d); + } + var _g2 = b; + _g2.set_bottom(_g2.get_bottom() + this.bottom); + if(com_davidmaletz_mining_world_Object.blocker_obj == null) { + com_davidmaletz_mining_world_Object.blocker_obj = new com_davidmaletz_mining_world_Blocker(); + } + if(com_davidmaletz_mining_world_Object._getClosest(com_davidmaletz_mining_world_Object.blocker_obj,b,area.objects,0,1,null,$bind(this,this.checkTile)) == null) { + this.enemy.setPosition(this.enemy.xPos,this.enemy.yTile + d); + } else { + this.dy = -this.dy; + } + } + com_davidmaletz_mining_enemy_EnemyRenderer.prototype.advanceFrame.call(this,frames); + } + ,checkTile: function(addBounds,x,y) { + if(this.enemy.getTileBlockId(x,y) != -1 || !this.enemy.canEnterTile(x,y)) { + com_davidmaletz_mining_world_Object.rectangle.setTo(x * com_davidmaletz_tiles_Tile.SIZE,y * com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE); + addBounds(null,com_davidmaletz_mining_world_Object.rectangle); + } + return false; + } + ,__class__: com_davidmaletz_mining_enemy_FloatUpDownRenderer +}); +var com_davidmaletz_mining_enemy_Surface = function(info,x,y) { + com_davidmaletz_mining_enemy_Enemy.call(this,info,x,y); + if(info.xml.exists("minX")) { + this.minX = com_davidmaletz_mining_Main.parseInt(info.xml.get("minX")); + } + if(info.xml.exists("maxX")) { + this.maxX = com_davidmaletz_mining_Main.parseInt(info.xml.get("maxX")); + } + if(info.xml.exists("minY")) { + this.minY = com_davidmaletz_mining_Main.parseInt(info.xml.get("minY")); + } + if(info.xml.exists("maxY")) { + this.maxY = com_davidmaletz_mining_Main.parseInt(info.xml.get("maxY")); + } +}; +$hxClasses["com.davidmaletz.mining.enemy.Surface"] = com_davidmaletz_mining_enemy_Surface; +com_davidmaletz_mining_enemy_Surface.__name__ = ["com","davidmaletz","mining","enemy","Surface"]; +com_davidmaletz_mining_enemy_Surface.__super__ = com_davidmaletz_mining_enemy_Enemy; +com_davidmaletz_mining_enemy_Surface.prototype = $extend(com_davidmaletz_mining_enemy_Enemy.prototype,{ + minX: null + ,maxX: null + ,minY: null + ,maxY: null + ,createRenderer: function() { + return new com_davidmaletz_mining_enemy_SurfaceRenderer(this); + } + ,run: function() { + if(this.renderer != null) { + var r = js_Boot.__cast(this.renderer , com_davidmaletz_mining_enemy_SurfaceRenderer); + r.run(r.range); + } + } + ,flip: function() { + if(this.renderer != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_enemy_SurfaceRenderer)).flip(); + } + } + ,playIdle: function() { + if(this.renderer != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_enemy_SurfaceRenderer)).clearRun(); + } + com_davidmaletz_mining_enemy_Enemy.prototype.playIdle.call(this); + } + ,checkMinMaxBounds: function(x,y) { + if(!(this.minX != null && x < this.minX || this.maxX != null && x > this.maxX || this.minY != null && y < this.minY)) { + if(this.maxY != null) { + return y > this.maxY; + } else { + return false; + } + } else { + return true; + } + } + ,canEnterTile: function(x,y) { + if(this.checkMinMaxBounds(x,y)) { + return false; + } else { + return com_davidmaletz_mining_enemy_Enemy.prototype.canEnterTile.call(this,x,y); + } + } + ,__class__: com_davidmaletz_mining_enemy_Surface +}); +var com_davidmaletz_mining_enemy_Floating = function(info,x,y) { + com_davidmaletz_mining_enemy_Surface.call(this,info,x,y); +}; +$hxClasses["com.davidmaletz.mining.enemy.Floating"] = com_davidmaletz_mining_enemy_Floating; +com_davidmaletz_mining_enemy_Floating.__name__ = ["com","davidmaletz","mining","enemy","Floating"]; +com_davidmaletz_mining_enemy_Floating.__super__ = com_davidmaletz_mining_enemy_Surface; +com_davidmaletz_mining_enemy_Floating.prototype = $extend(com_davidmaletz_mining_enemy_Surface.prototype,{ + createRenderer: function() { + var r = com_davidmaletz_mining_enemy_Surface.prototype.createRenderer.call(this); + r.floating = true; + return r; + } + ,canEnterTile: function(x,y) { + return this.area.isWater(x,y + 1); + } + ,getLayer: function() { + return 0; + } + ,__class__: com_davidmaletz_mining_enemy_Floating +}); +var com_davidmaletz_mining_enemy_Golem = function(info,x,y) { + com_davidmaletz_mining_enemy_Enemy.call(this,info,x,y); +}; +$hxClasses["com.davidmaletz.mining.enemy.Golem"] = com_davidmaletz_mining_enemy_Golem; +com_davidmaletz_mining_enemy_Golem.__name__ = ["com","davidmaletz","mining","enemy","Golem"]; +com_davidmaletz_mining_enemy_Golem.__super__ = com_davidmaletz_mining_enemy_Enemy; +com_davidmaletz_mining_enemy_Golem.prototype = $extend(com_davidmaletz_mining_enemy_Enemy.prototype,{ + createRenderer: function() { + return new com_davidmaletz_mining_enemy__$Golem_GolemRenderer(this); + } + ,isBlocking: function(asker) { + if(this.area == null || this.area.getTileId(this.get_tile_x(),this.get_tile_y(),0) != -1) { + return false; + } else { + return com_davidmaletz_mining_enemy_Enemy.prototype.isBlocking.call(this,asker); + } + } + ,attackPower: function(attack,cut,spirit,element,player) { + if(this.area == null || this.area.getTileId(this.get_tile_x(),this.get_tile_y(),0) != -1) { + return 0; + } else { + return com_davidmaletz_mining_enemy_Enemy.prototype.attackPower.call(this,attack,cut,spirit,element,player); + } + } + ,isHostile: function() { + if(com_davidmaletz_mining_enemy_Enemy.prototype.isHostile.call(this) && this.area != null) { + return this.area.getTileId(this.get_tile_x(),this.get_tile_y(),0) == -1; + } else { + return false; + } + } + ,__class__: com_davidmaletz_mining_enemy_Golem +}); +var com_davidmaletz_mining_enemy__$Golem_GolemRenderer = function(e) { + this.hasAttacked = false; + this.recharge = false; + com_davidmaletz_mining_enemy_EnemyRenderer.call(this,e); + var xml = e.getInfo().xml; + this.speed = xml.exists("speed") ? com_davidmaletz_mining_Main.parseFloat(xml.get("speed")) : 1; +}; +$hxClasses["com.davidmaletz.mining.enemy._Golem.GolemRenderer"] = com_davidmaletz_mining_enemy__$Golem_GolemRenderer; +com_davidmaletz_mining_enemy__$Golem_GolemRenderer.__name__ = ["com","davidmaletz","mining","enemy","_Golem","GolemRenderer"]; +com_davidmaletz_mining_enemy__$Golem_GolemRenderer.__super__ = com_davidmaletz_mining_enemy_EnemyRenderer; +com_davidmaletz_mining_enemy__$Golem_GolemRenderer.prototype = $extend(com_davidmaletz_mining_enemy_EnemyRenderer.prototype,{ + recharge: null + ,speed: null + ,insertNode: function(queue,x,y,parent,visited) { + var i = com_fancyfish_faeng_common_Utils.getIdx(x,y); + if(this.enemy.area.getTileId(x,y,3) == -1 || this.enemy.getBlocking(x,y) != null || visited.exists(i)) { + return; + } + visited.set(i,true); + if(this.enemy.getTileBlockId(x,y) == -1) { + queue.addLast(new com_fancyfish_faeng_common_Node(x,y,parent)); + } + } + ,tryAttack: function(n,o,start) { + var _gthis = this; + if(o != null && this.canAttack(o)) { + if(n.depth == 0) { + var dx = o.getCenterX() - this.enemy.getCenterX(); + if((dx > 0 ? -1 : 1) != this.get_scaleX()) { + this.playAnimation(this.enemy.getAnim("idle"),false,$bind(this,this.flip)); + } else { + var a = this.getMeleeAttack(); + if(a != null) { + this.moveIntoRange(o,function() { + _gthis.attackWith(o,a); + _gthis.recharge = true; + },this.speed); + } + } + return true; + } else { + while(n.parent != start) n = n.parent; + this.setTile(n.x,n.y,this.speed); + return true; + } + } + return false; + } + ,flip: function(p) { + this.set_scaleX(-this.get_scaleX()); + this.enemy.onFlip(); + this.playIdle(p); + } + ,hasAttacked: null + ,playIdle: function(p) { + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + if(this.get_alpha() != 1) { + return; + } + if(!this.isOwner()) { + com_davidmaletz_mining_enemy_EnemyRenderer.prototype.playIdle.call(this,p); + return; + } + if(this.enemy.area == null) { + this.setFrame(0); + this.playAnimation(this.enemy.getAnim("idle"),false,$bind(this,this.playIdle)); + return; + } + var attack_range = this.getAttackRange(); + if(!this.hasAttacked && attack_range > 0) { + var b = this.getClosestForAttack(); + if(b != null && b.object != null) { + var maxDist = this.enemy.getXDistance(b.bounds); + if(maxDist > com_davidmaletz_tiles_Tile.SIZE && this.canAttack(b.object) && maxDist <= attack_range) { + this.hasAttacked = true; + this.doAttack(b.object,maxDist); + return; + } + } + } else { + this.hasAttacked = false; + } + if(this.recharge) { + this.recharge = false; + this.enemy.playAnimation("roar"); + return; + } + if(this.hasTarget(10)) { + var area = this.enemy.area; + var x = this.enemy.get_tile_x(); + var y = this.enemy.get_tile_y(); + var queue = new com_fancyfish_faeng_common_Dequeue(); + var visited = new haxe_ds_IntMap(); + var start = new com_fancyfish_faeng_common_Node(x,y); + visited.set(com_fancyfish_faeng_common_Utils.getIdx(x,y),true); + queue.addLast(start); + while(!queue.isEmpty()) { + var n = queue.removeFirst(); + if(n.depth > 10) { + break; + } + if(this.tryAttack(n,this.enemy.getBlocking(n.x + 1,n.y),start) || this.tryAttack(n,this.enemy.getBlocking(n.x - 1,n.y),start)) { + return; + } + this.insertNode(queue,n.x + 1,n.y,n,visited); + this.insertNode(queue,n.x - 1,n.y,n,visited); + this.insertNode(queue,n.x,n.y + 1,n,visited); + this.insertNode(queue,n.x,n.y - 1,n,visited); + } + } + this.setFrame(0); + this.playAnimation(this.enemy.getAnim("idle"),false,$bind(this,this.playIdle)); + } + ,resetAlpha: function() { + var a = this.enemy.area != null && this.enemy.area.getTileId(this.enemy.get_tile_x(),this.enemy.get_tile_y(),0) == -1 ? 1 : 0; + if(this.get_alpha() != a) { + this.set_alpha(a); + if(a == 0) { + this.playAnimation(this.enemy.getAnim("idle"),false,$bind(this,this.playIdle)); + } + } + } + ,advanceFrame: function(frames) { + if(this.animation == this.enemy.getAnim("idle") && this.get_alpha() == 0 && this.enemy.area != null && this.enemy.area.getTileId(this.enemy.get_tile_x(),this.enemy.get_tile_y(),0) == -1) { + this.set_alpha(1); + this.playAnimation(this.enemy.getAnim("form"),false,$bind(this,this.playIdle)); + com_davidmaletz_mining_enemy_EnemyRenderer.prototype.advanceTracks.call(this,frames); + } else { + com_davidmaletz_mining_enemy_EnemyRenderer.prototype.advanceFrame.call(this,frames); + } + } + ,__class__: com_davidmaletz_mining_enemy__$Golem_GolemRenderer +}); +var com_davidmaletz_mining_enemy_SurfaceRenderer = function(e) { + this.onRunComplete = null; + this.noAttack = 0; + this.__paused = false; + this.fired_in_range = false; + this.canFlip = true; + this.deltaY = 0; + com_davidmaletz_mining_enemy_EnemyRenderer.call(this,e); + this.runDist = 0; + this.partial = 0; + var i = e.getInfo(); + var xml = i.xml; + this.speed = xml.exists("speed") ? com_davidmaletz_mining_Main.parseFloat(xml.get("speed")) : 1; + this.hoverWalk = xml.get("hoverWalk") == "true"; + this.range = xml.exists("range") ? Math.round(com_davidmaletz_mining_Main.parseFloat(xml.get("range")) * com_davidmaletz_tiles_Tile.SIZE) : 0; + this.vertical = e.info.xml.get("vertical") == "true"; + if(xml.exists("alignCenter")) { + this.alignCenter = xml.get("alignCenter") == "true"; + } else { + this.alignCenter = this.enemy.info.xml.get("flying") == "true" || this.enemy.info.xml.get("type") == "underwater"; + } + this.alignBelow = xml.get("alignBelow") == "true"; + this.hasBomb = false; + this.center_y = this.enemy._height * 0.5; + var _g = 0; + var _g1 = i.attacks; + while(_g < _g1.length) { + var a = _g1[_g]; + ++_g; + if(a.type == "bomb" || a.type == "breath" || a.type == "vertical") { + this.hasBomb = true; + } else if(a.xml != null && a.xml.exists("height")) { + this.center_y = com_davidmaletz_mining_Main.parseFloat(a.xml.get("height")) * 0.5 - com_davidmaletz_mining_Main.parseFloat(a.xml.get("boundsY")); + } + } + this.run_ids = new haxe_ds_StringMap(); + var e1 = i.xml.elementsNamed("flee"); + while(e1.hasNext()) { + var e2 = e1.next(); + this.run_ids.set(e2.get("id"),true); + } + if(this.enemy.info.xml.exists("vrange")) { + this.vrange = Math.round(com_davidmaletz_mining_Main.parseFloat(this.enemy.info.xml.get("vrange")) * com_davidmaletz_tiles_Tile.SIZE); + } else { + this.vrange = this.enemy._height * 2; + } +}; +$hxClasses["com.davidmaletz.mining.enemy.SurfaceRenderer"] = com_davidmaletz_mining_enemy_SurfaceRenderer; +com_davidmaletz_mining_enemy_SurfaceRenderer.__name__ = ["com","davidmaletz","mining","enemy","SurfaceRenderer"]; +com_davidmaletz_mining_enemy_SurfaceRenderer.__super__ = com_davidmaletz_mining_enemy_EnemyRenderer; +com_davidmaletz_mining_enemy_SurfaceRenderer.prototype = $extend(com_davidmaletz_mining_enemy_EnemyRenderer.prototype,{ + runDist: null + ,partial: null + ,speed: null + ,range: null + ,deltaY: null + ,alignCenter: null + ,alignBelow: null + ,run_ids: null + ,hasBomb: null + ,vertical: null + ,center_y: null + ,vrange: null + ,hoverWalk: null + ,init: function(e) { + this.__dispatcher = null; + com_davidmaletz_mining_enemy_EnemyRenderer.prototype.init.call(this,e); + } + ,getIdleAnim: function() { + return this.enemy.getAnim(this.enemy.area != null && this.enemy.info.xml.get("flyAnim") == "true" && this.enemy.area.emptyTile(this.enemy.get_tile_x(),Math.ceil((this.enemy.yTile + 1) / com_davidmaletz_tiles_Tile.SIZE)) ? "hover" : "idle"); + } + ,isIdleAnim: function() { + if(this.animation != this.enemy.getAnim("idle")) { + return this.animation == this.enemy.getAnim("hover"); + } else { + return true; + } + } + ,getWalkAnim: function() { + return this.enemy.getAnim(this.enemy.area != null && this.enemy.info.xml.get("flyAnim") == "true" && this.enemy.area.emptyTile(this.enemy.get_tile_x(),Math.ceil((this.enemy.yTile + 1) / com_davidmaletz_tiles_Tile.SIZE)) ? "fly" : "walk"); + } + ,isWalk: function() { + if(!this.isWalkAnim()) { + if(this.hoverWalk) { + return this.animation == this.enemy.getAnim("hover"); + } else { + return false; + } + } else { + return true; + } + } + ,isWalkAnim: function() { + if(this.animation != this.enemy.getAnim("walk")) { + return this.animation == this.enemy.getAnim("fly"); + } else { + return true; + } + } + ,doRun: function(dist,complete) { + if(this.speed == 0) { + this._idle(); + return; + } + this.runDist = dist; + this.onRunComplete = complete; + this.playAnimation(this.getWalkAnim(),true); + } + ,run: function(dist,complete,dy) { + if(dy == null) { + dy = 0; + } + if(this.speed == 0) { + this._idle(); + return; + } + if(!this.isOwner()) { + this.playAnimation(this.getWalkAnim(),true); + return; + } + this.deltaY = dy; + if(this.isWalkAnim()) { + this.doRun(dist,complete); + return; + } + var f = $bind(this,this.doRun); + var a1 = dist; + var a2 = complete; + var tmp = function() { + f(a1,a2); + }; + this.enemy.runEvent(com_davidmaletz_mining_Main.getLocalPlayer(),"run",tmp); + } + ,getBombTarget: function(a) { + var _gthis = this; + var b = this.enemy.getBounds(); + var st = b.get_bottom() + com_davidmaletz_tiles_Tile.SIZE * 0.5; + var _g = b; + _g.set_left(_g.get_left() - this.range); + var _g1 = b; + _g1.set_right(_g1.get_right() + this.range); + var _g2 = b; + _g2.set_bottom(_g2.get_bottom() + a.range); + b.set_top(st); + var best = null; + var dist = Infinity; + this.enemy.area.getObjects(b,function(o,rect) { + if(o != _gthis.enemy && o.isBlocking(_gthis.enemy.info) && _gthis.canAttack(o) && o.renderer != null) { + var d = (_gthis.get_x() - o.renderer.get_x()) * _gthis.get_scaleX(); + if(Math.abs(d) < Math.abs(dist)) { + dist = d; + best = o; + } + } + return false; + }); + return dist; + } + ,fireProjectile: function(dx,dy,a,xml) { + this.clearRun(); + this.onRunComplete = null; + com_davidmaletz_mining_enemy_EnemyRenderer.prototype.fireProjectile.call(this,dx,dy,a,xml); + } + ,canUseAttack: function(a) { + if(a.xml != null && a.xml.exists("state")) { + var state = ""; + if(this.enemy.area != null && this.enemy.info.xml.get("flyAnim") == "true") { + if(this.enemy.area.emptyTile(this.enemy.get_tile_x(),Math.ceil((this.enemy.yTile + 1) / com_davidmaletz_tiles_Tile.SIZE))) { + state = "flying"; + } else { + state = "standing"; + } + } + if(a.xml.get("state") != state) { + return false; + } + } + return com_davidmaletz_mining_enemy_EnemyRenderer.prototype.canUseAttack.call(this,a); + } + ,checkBombs: function() { + var _gthis = this; + if(!this.allowAttack()) { + return false; + } + var _g = 0; + var _g1 = this.enemy.getInfo().attacks; + while(_g < _g1.length) { + var a = _g1[_g]; + ++_g; + if(this.canUseAttack(a)) { + if(a.type == "bomb") { + var b = this.getBombTarget(a); + if(b != Infinity) { + if(Math.abs(b) < 8) { + this.showAttack(a,(function(a1,f) { + return function(a11) { + f[0](0,1,a1[0],a11); + }; + })([a],[$bind(this,this.fireProjectile)])); + } else { + if(b < 0) { + this.set_scaleX(-this.get_scaleX()); + this.enemy.onFlip(); + b = -b; + } + this.run(Math.round(b)); + } + return true; + } + } else if(a.type == "breath") { + var o = this.getAttackTarget(a); + if(o != null) { + this.attackWith(o,a); + return true; + } + } else if(a.type == "vertical") { + var b1 = this.getRectangle(); + if(a.range < 0) { + var _g2 = b1; + _g2.set_top(_g2.get_top() + a.range); + } else { + var _g21 = b1; + _g21.set_bottom(_g21.get_bottom() + a.range); + } + var target = [false]; + this.enemy.area.getObjects(b1,(function(target1) { + return function(o1,rect) { + if(_gthis.canAttack(o1)) { + target1[0] = true; + return true; + } else { + return false; + } + }; + })(target)); + if(target[0]) { + this.attackWith(null,a); + return true; + } + } + } + } + return false; + } + ,flipIdle: function(p) { + this.canFlip = true; + this.playIdle(p); + } + ,_idle: function() { + var idle = this.getIdleAnim(); + if(this.animation != idle) { + this.setFrame(0); + this.playAnimation(idle,false,$bind(this,this.flipIdle)); + } + } + ,doPlayIdle: function() { + if(this.enemy.enabled) { + if(this.enemy.area == null || this.runDist > 0) { + this.playAnimation(this.getWalkAnim(),true); + return; + } + if(this.runDist < 0) { + this.clearRun(); + } else { + if(this.hasBomb && this.checkBombs()) { + return; + } + var r = Math.random(); + if(this.enemy.info.xml.get("idleFlip") != "false" && r < 0.5 && this.enemy.canFlip() && this.getClosestForAttack($bind(this,this.shouldAttack),this.vertical ? this.enemy._height : 0) == null) { + this.set_scaleX(-this.get_scaleX()); + this.enemy.onFlip(); + } else if(this.speed > 0 && r < 0.8) { + this.run(this.range,null,Math.random() < 0.5 ? 0 : Math.floor(Math.random() * 2 - 0.5)); + return; + } + this.setFrame(0); + } + } else { + this.setFrame(0); + } + this.playAnimation(this.getIdleAnim(),false,$bind(this,this.flipIdle)); + } + ,playIdle: function(p) { + if(this.speed == 0 && this.runDist != 0) { + this.clearRun(); + } + if(this.enemy.area == null || this.runDist > 0) { + this.playAnimation(this.getWalkAnim(),true); + return; + } + if(!this.isOwner()) { + this.setFrame(0); + this.playAnimation(this.getIdleAnim(),false,$bind(this,this.flipIdle)); + return; + } + if(this.runDist < 0) { + this.clearRun(); + } else { + this.enemy.runEvent(com_davidmaletz_mining_Main.getLocalPlayer(),"idle",$bind(this,this.doPlayIdle)); + } + } + ,canFlip: null + ,fired_in_range: null + ,inRange: function(p,dist) { + var i = this.enemy.getInfo().xml.elementPathsNamed("inRange"); + if(i.hasNext()) { + var e = i.next(); + var ret = true; + if(e.exists("range") && dist > com_davidmaletz_mining_Main.parseFloat(e.get("range")) * com_davidmaletz_tiles_Tile.SIZE) { + return false; + } + this.fired_in_range = true; + var func = function() { + ret = false; + }; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + new com_davidmaletz_mining_npc_NPCEventHandler(e.elements(),p,this.enemy,func).runAll(); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + return ret; + } else { + return false; + } + } + ,incType: function(type) { + if(type != "bomb" && type != "breath") { + return type != "vertical"; + } else { + return false; + } + } + ,objectBlocking: function(addBounds,bot,o,rect) { + if(o.isPlayer()) { + return false; + } + return this.enemy.checkObject(addBounds,o); + } + ,__paused: null + ,advanceFrame: function(frames) { + var _gthis = this; + var owner = this.isOwner(); + if(!owner && this.hasTrack(com_davidmaletz_lerp_PositionKeyframe)) { + com_davidmaletz_mining_enemy_EnemyRenderer.prototype.advanceFrame.call(this,frames); + return; + } + if(owner && this.enemy.area != null && !this.enemy.canEnterTile(this.enemy.get_tile_x(),this.enemy.get_tile_y())) { + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + this.enemy.loseHealth(1); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + } + var info = this.enemy.getInfo(); + var walk = this.isWalkAnim(); + if(walk && !this.enemy.enabled) { + this.runComplete(); + } + if(owner) { + this.__paused = false; + } + if(this.enemy.enabled && this.enemy.area != null && (this.isIdleAnim() || walk) && !this.__paused) { + if(owner && this.doAttack(null,0,"notarget")) { + return; + } + var tx = this.enemy.get_tile_x() - com_fancyfish_faeng_common_Utils.sign(this.get_scaleX()) * 10; + if(this.enemy.canFlip() && !this.enemy.area.isLooping() && (this.enemy.area.left != null && tx < this.enemy.area.left.fromX || this.enemy.area.right != null && tx > this.enemy.area.right.fromX)) { + this.set_scaleX(-this.get_scaleX()); + this.enemy.onFlip(); + this.playIdle(null); + com_davidmaletz_mining_enemy_EnemyRenderer.prototype.advanceFrame.call(this,frames); + return; + } + if(owner && walk && this.runDist <= 0) { + this.runDist = this.range; + } + if(owner && this.hasBomb && this.runDist > 0) { + this.checkBombs(); + } + if(this.noAttack > 0) { + this.noAttack -= frames; + } + var d = this.speed * frames; + var dist = Math.floor(d); + this.partial += d - dist; + if(this.partial >= 1) { + dist += 1; + this.partial -= 1; + } + var maxDist = 999999; + var hasPlayer = false; + var kill = false; + var checkPlayer = function(o) { + if(Std["is"](o,com_davidmaletz_mining_Player)) { + hasPlayer = true; + var checkPlayer1; + if(owner && !_gthis.fired_in_range) { + var checkPlayer2 = Math.round(_gthis.enemy.getXDistance(o._getBounds(com_davidmaletz_mining_enemy_SurfaceRenderer.rect))); + checkPlayer1 = _gthis.inRange(o,checkPlayer2); + } else { + checkPlayer1 = false; + } + if(checkPlayer1) { + kill = true; + } + return !_gthis.enemy.shouldPass(o); + } else if(!(!o.isPlayer())) { + return !_gthis.enemy.shouldPass(o); + } else { + return true; + } + }; + var handleBlocker = function(melee,b) { + if(kill) { + return true; + } + var o1 = b.object; + var old = maxDist; + var edist = Math.round(_gthis.enemy.getXDistance(b.bounds)); + maxDist = com_fancyfish_faeng_common_Utils.min(maxDist,edist); + if(owner && o1 != null) { + if(_gthis.run_ids.exists(o1.isPlayer() ? "player" : o1.getId()) && edist <= _gthis.range && _gthis.canFlip) { + _gthis.set_scaleX(-_gthis.get_scaleX()); + _gthis.enemy.onFlip(); + _gthis.run(_gthis.range,$bind(_gthis,_gthis.flip)); + _gthis.canFlip = false; + return true; + } else if(_gthis.noAttack <= 0 && _gthis.canAttack(o1)) { + if(_gthis.alignBelow) { + edist = _gthis.enemy.area.adjustDx(Math.round(Math.abs(b.bounds.x + b.bounds.width * 0.5 - _gthis.enemy.getCenterX()))); + maxDist = old; + } + var t = melee ? "melee" : null; + var r = _gthis.enemy.info.xml.get("needsAttack") == "false" ? _gthis.range : _gthis.getAttackRange(t); + if(r >= 0) { + r = com_fancyfish_faeng_common_Utils.max(0,r - (o1._width >> 1) - 1); + _gthis.canFlip = true; + if(edist <= dist + r) { + if(edist <= r) { + if(_gthis.doAttack(o1,edist,t)) { + _gthis.runDist = 1; + _gthis.onRunComplete = null; + return true; + } + } else if(edist <= old) { + _gthis.runDist = 1; + _gthis.onRunComplete = null; + maxDist = old; + return false; + } + } + if(edist > 0 && edist <= old) { + if(_gthis.runDist <= 0) { + _gthis.run(_gthis.range); + } else { + _gthis.runDist = _gthis.range; + _gthis.onRunComplete = null; + } + } + return false; + } + } + } + return false; + }; + var b1 = this.enemy.getClosest(this.range,1,true,checkPlayer); + var cont = true; + if(b1 != null && handleBlocker(this.hasAttackType("melee"),b1)) { + return; + } + if(cont) { + var vert = this.vertical; + var b2 = this.getClosestForAttack(checkPlayer,vert ? this.vrange : 0); + if(b2 != null || this.runDist > 0 && vert && this.deltaY != 0) { + var t1; + var hadBlocker = b2 != null; + if(b2 == null) { + t1 = this.enemy.yTile + this.deltaY * dist; + } else if(this.alignBelow) { + t1 = Math.round(b2.bounds.get_bottom() + this.enemy._height - com_davidmaletz_tiles_Tile.SIZE); + } else if(this.alignCenter) { + t1 = Math.round(b2.bounds.y + b2.bounds.height * 0.5 + this.center_y - com_davidmaletz_tiles_Tile.SIZE); + } else { + t1 = Math.round(b2.bounds.get_bottom() - com_davidmaletz_tiles_Tile.SIZE); + } + if(t1 < this.enemy.yTile && this.enemy.area.up != null && t1 < this.enemy.area.up.fromX * com_davidmaletz_tiles_Tile.SIZE) { + t1 = this.enemy.area.up.fromX * com_davidmaletz_tiles_Tile.SIZE; + } + if(t1 > this.enemy.yTile && this.enemy.area.down != null && t1 > this.enemy.area.down.fromX * com_davidmaletz_tiles_Tile.SIZE) { + t1 = this.enemy.area.down.fromX * com_davidmaletz_tiles_Tile.SIZE; + } + if(vert && t1 != this.enemy.yTile) { + var y = com_fancyfish_faeng_common_Utils.abs(t1 - this.enemy.yTile) <= dist ? t1 : this.enemy.yTile + com_fancyfish_faeng_common_Utils.sign(t1 - this.enemy.yTile) * dist; + var dy = y - this.enemy.yTile; + var b3 = com_davidmaletz_mining_world_vehicle_VehicleRenderer._getClosest(this.enemy,($_=this.enemy,$bind($_,$_._checkTile)),0,dy,$bind(this,this.objectBlocking)); + if(b3 != null) { + if(dy > 0) { + y = com_fancyfish_faeng_common_Utils.clampi(Math.round(b3.bounds.y) - com_davidmaletz_tiles_Tile.SIZE,this.enemy.yTile,y); + } else if(dy < 0) { + var bot = b3.bounds.get_bottom(); + if(b3.object == null && !this.enemy.isTileBlocking(this.enemy.area.getTileId(Math.round(b3.bounds.x / com_davidmaletz_tiles_Tile.SIZE),Math.round(b3.bounds.y / com_davidmaletz_tiles_Tile.SIZE),0))) { + bot -= this.enemy._height - com_davidmaletz_tiles_Tile.SIZE; + } + y = com_fancyfish_faeng_common_Utils.clampi(Math.round(bot) + this.enemy._height - com_davidmaletz_tiles_Tile.SIZE,y,this.enemy.yTile); + } + } + if(y != this.enemy.yTile) { + dist = com_fancyfish_faeng_common_Utils.abs(y - this.enemy.yTile); + if(hadBlocker) { + this.deltaY = 0; + } + this.enemy.setPosition(this.enemy.xPos,y); + if(walk) { + this.playAnimation(this.getWalkAnim(),true); + } + if(hadBlocker && owner) { + if(this.runDist <= 0) { + this.run(this.range); + } else { + this.runDist = this.range; + this.onRunComplete = null; + } + } else { + this.runDist -= dist; + if(this.runDist <= 0) { + this.runComplete(); + } + } + com_davidmaletz_mining_enemy_EnemyRenderer.prototype.advanceFrame.call(this,frames); + return; + } + } else if(b2 != null && handleBlocker(false,b2)) { + return; + } + if(hadBlocker && maxDist > 0 && owner) { + if(this.runDist <= 0) { + this.run(this.range); + } else { + this.runDist = this.range; + this.onRunComplete = null; + } + } + } + } + if(!hasPlayer) { + this.fired_in_range = false; + } + dist = com_fancyfish_faeng_common_Utils.min(dist,maxDist); + if(maxDist > 0 && this.runDist > 0) { + if(dist > 0) { + this.canFlip = true; + this.runDist -= dist; + var dx = -com_fancyfish_faeng_common_Utils.sign(this.get_scaleX()); + this.enemy.setPosition(this.enemy.xPos + dx * dist,this.enemy.yTile); + if(this.runDist <= 0) { + this.runComplete(); + } + } + } else if(this.runDist > 0) { + if(owner) { + this.enemy.runEvent(com_davidmaletz_mining_Main.getLocalPlayer(),"hitWall",$bind(this,this.runComplete)); + } else { + this.runComplete(); + } + } + } + com_davidmaletz_mining_enemy_EnemyRenderer.prototype.advanceFrame.call(this,frames); + } + ,noAttack: null + ,afterAttack: function(a,p) { + if(com_davidmaletz_mining_enemy_EnemyRenderer.prototype.afterAttack.call(this,a,null)) { + var h = a.xml == null ? null : a.xml.get("hitAndRun"); + if(this.isOwner() && h != null && h != "false") { + this.noAttack = 20; + this.set_scaleX(-this.get_scaleX()); + this.enemy.onFlip(); + this.run(h == "true" ? this.range : Math.round(com_davidmaletz_mining_Main.parseFloat(h) * com_davidmaletz_tiles_Tile.SIZE),$bind(this,this.flip)); + this.canFlip = false; + } else if(a.xml == null || !a.xml.exists("afterAnimation")) { + this.run(this.range); + } + return true; + } else { + return false; + } + } + ,flip: function() { + this.set_scaleX(-this.get_scaleX()); + this.enemy.onFlip(); + this.canFlip = false; + } + ,onRunComplete: null + ,clearRun: function() { + if(this.runDist != 0) { + this.runDist = 0; + } + } + ,runComplete: function() { + this.clearRun(); + if(this.isOwner() && this.onRunComplete != null) { + var f = this.onRunComplete; + this.onRunComplete = null; + f(); + } + this.playAnimation(this.getIdleAnim(),false,$bind(this,this.playIdle)); + } + ,attackObject: function(o,attack,xml) { + this.clearRun(); + this.onRunComplete = null; + return com_davidmaletz_mining_enemy_EnemyRenderer.prototype.attackObject.call(this,o,attack,xml); + } + ,afterDamage: function(old_hp,atk,p) { + if((this.enemy.info.xml.get("ignoreHit") != "true" || this.isIdleAnim() || this.isWalkAnim()) && this.isOwner()) { + this.doRun(this.range); + } else if(p != null) { + this.playIdle(p); + } + com_davidmaletz_mining_enemy_EnemyRenderer.prototype.afterDamage.call(this,old_hp,atk,null); + } + ,damage: function(e) { + if(this.enemy.info.xml.get("ignoreHit") != "true") { + this.runDist = -1; + } + this.onRunComplete = null; + this.canFlip = true; + com_davidmaletz_mining_enemy_EnemyRenderer.prototype.damage.call(this,e); + } + ,__class__: com_davidmaletz_mining_enemy_SurfaceRenderer +}); +var com_davidmaletz_mining_enemy_Trap = function(info,x,y) { + com_davidmaletz_mining_enemy_Enemy.call(this,info,x,y); +}; +$hxClasses["com.davidmaletz.mining.enemy.Trap"] = com_davidmaletz_mining_enemy_Trap; +com_davidmaletz_mining_enemy_Trap.__name__ = ["com","davidmaletz","mining","enemy","Trap"]; +com_davidmaletz_mining_enemy_Trap.__super__ = com_davidmaletz_mining_enemy_Enemy; +com_davidmaletz_mining_enemy_Trap.prototype = $extend(com_davidmaletz_mining_enemy_Enemy.prototype,{ + createRenderer: function() { + return new com_davidmaletz_mining_enemy_TrapRenderer(this); + } + ,isBlocking: function(asker) { + return false; + } + ,attackPower: function(attack,cut,spirit,element,player) { + return 0; + } + ,canBeAttacked: function(o,spirit) { + return false; + } + ,__class__: com_davidmaletz_mining_enemy_Trap +}); +var com_davidmaletz_mining_enemy_TrapRenderer = function(e) { + com_davidmaletz_mining_enemy_EnemyRenderer.call(this,e); + var i = e.getInfo(); + var xml = i.xml; + this.range = Math.round(com_davidmaletz_mining_Main.parseFloat(xml.get("range")) * com_davidmaletz_tiles_Tile.SIZE); +}; +$hxClasses["com.davidmaletz.mining.enemy.TrapRenderer"] = com_davidmaletz_mining_enemy_TrapRenderer; +com_davidmaletz_mining_enemy_TrapRenderer.__name__ = ["com","davidmaletz","mining","enemy","TrapRenderer"]; +com_davidmaletz_mining_enemy_TrapRenderer.__super__ = com_davidmaletz_mining_enemy_EnemyRenderer; +com_davidmaletz_mining_enemy_TrapRenderer.prototype = $extend(com_davidmaletz_mining_enemy_EnemyRenderer.prototype,{ + range: null + ,init: function(e) { + if(this.enemy.area != null && this.enemy.info.xml.get("onWall") == "true") { + this.set_scaleX(this.enemy.area.getTileId(this.enemy.get_tile_x() - 1,this.enemy.get_tile_y(),0) < 0 ? this.get_scaleY() : -this.get_scaleY()); + } + com_davidmaletz_mining_enemy_EnemyRenderer.prototype.init.call(this,e); + } + ,advanceFrame: function(frames) { + if(!this.isOwner()) { + com_davidmaletz_mining_enemy_EnemyRenderer.prototype.advanceFrame.call(this,frames); + return; + } + if(this.enemy.info.xml.get("onWall") == "true" && this.enemy.area != null && this.enemy.area.getTileId(this.enemy.get_tile_x(),this.enemy.get_tile_y(),0) == -1) { + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + this.enemy.area.removeObject(this.enemy); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + return; + } else if(this.enemy.area != null && this.animation == this.enemy.getAnim("idle")) { + var b = this.getClosestForAttack(); + if(b != null && b.object != null) { + var o = b.object; + var edist = Math.round(this.enemy.getXDistance(b.bounds)); + if(this.canAttack(o)) { + var r = this.getAttackRange(); + if(r >= 0 && edist <= r) { + this.doAttack(o,edist); + } + return; + } + } + } + com_davidmaletz_mining_enemy_EnemyRenderer.prototype.advanceFrame.call(this,frames); + } + ,__class__: com_davidmaletz_mining_enemy_TrapRenderer +}); +var com_davidmaletz_mining_enemy_Underwater = function(info,x,y) { + com_davidmaletz_mining_enemy_Surface.call(this,info,x,y); + if(this.minY == null && this.maxY == null) { + this.maxY = 80; + } +}; +$hxClasses["com.davidmaletz.mining.enemy.Underwater"] = com_davidmaletz_mining_enemy_Underwater; +com_davidmaletz_mining_enemy_Underwater.__name__ = ["com","davidmaletz","mining","enemy","Underwater"]; +com_davidmaletz_mining_enemy_Underwater.__super__ = com_davidmaletz_mining_enemy_Surface; +com_davidmaletz_mining_enemy_Underwater.prototype = $extend(com_davidmaletz_mining_enemy_Surface.prototype,{ + shouldPass: function(o) { + if(!(com_davidmaletz_mining_enemy_Surface.prototype.shouldPass.call(this,o) || o.area == null)) { + return !o.area.isWater(o.get_tile_x(),o.get_tile_y()); + } else { + return true; + } + } + ,createRenderer: function() { + var r = com_davidmaletz_mining_enemy_Surface.prototype.createRenderer.call(this); + return r; + } + ,canEnterTile: function(x,y) { + if(this.checkMinMaxBounds(x,y)) { + return false; + } + if(this.area.getTileId(x,y,0) == -1) { + if(this.area.isWater(x,y)) { + if(this.info.xml.get("bottom") == "true") { + return this.canStandOn(this.area.getTile(x,y + 1,0),x,y + 1); + } else { + return true; + } + } else { + return false; + } + } else { + return true; + } + } + ,__class__: com_davidmaletz_mining_enemy_Underwater +}); +var com_davidmaletz_mining_enemy_Wyrm = function(info,x,y) { + com_davidmaletz_mining_enemy_Enemy.call(this,info,x,y); +}; +$hxClasses["com.davidmaletz.mining.enemy.Wyrm"] = com_davidmaletz_mining_enemy_Wyrm; +com_davidmaletz_mining_enemy_Wyrm.__name__ = ["com","davidmaletz","mining","enemy","Wyrm"]; +com_davidmaletz_mining_enemy_Wyrm.__super__ = com_davidmaletz_mining_enemy_Enemy; +com_davidmaletz_mining_enemy_Wyrm.prototype = $extend(com_davidmaletz_mining_enemy_Enemy.prototype,{ + addedToArea: function() { + var t = this.area.getTileId(this.get_tile_x(),this.get_tile_y(),0); + if(t >= 0) { + this.area.mine(this.get_tile_x(),this.get_tile_y(),t,0,this); + } + } + ,createRenderer: function() { + return new com_davidmaletz_mining_enemy__$Wyrm_WyrmRenderer(this); + } + ,__class__: com_davidmaletz_mining_enemy_Wyrm +}); +var com_davidmaletz_mining_enemy__$Wyrm_WyrmRenderer = function(e) { + this.hasAttacked = false; + this.dig_x = -2147483648; + this.attack_ct = 6; + com_davidmaletz_mining_enemy_EnemyRenderer.call(this,e); + var xml = this.enemy.getInfo().xml; + this.eatTile = xml.get("eatTile"); + this.speed = xml.exists("speed") ? com_davidmaletz_mining_Main.parseFloat(xml.get("speed")) : 1; +}; +$hxClasses["com.davidmaletz.mining.enemy._Wyrm.WyrmRenderer"] = com_davidmaletz_mining_enemy__$Wyrm_WyrmRenderer; +com_davidmaletz_mining_enemy__$Wyrm_WyrmRenderer.__name__ = ["com","davidmaletz","mining","enemy","_Wyrm","WyrmRenderer"]; +com_davidmaletz_mining_enemy__$Wyrm_WyrmRenderer.__super__ = com_davidmaletz_mining_enemy_EnemyRenderer; +com_davidmaletz_mining_enemy__$Wyrm_WyrmRenderer.prototype = $extend(com_davidmaletz_mining_enemy_EnemyRenderer.prototype,{ + speed: null + ,attack_ct: null + ,eatTile: null + ,canDig: function(area,x,y,t) { + var tile = area.getTileIndex(t); + if(tile != null && tile.id == this.eatTile) { + return area.getTileId(x,y,1) == -1; + } else { + return false; + } + } + ,dig_x: null + ,dig_y: null + ,tryMove: function(area,x,y) { + if(this.enemy.getBlocking(x,y) != null) { + return false; + } + var t = this.enemy.getTileBlockId(x,y); + if(t == -1) { + this.setTile(x,y,this.speed); + return true; + } else if(this.canDig(area,x,y,t)) { + this.playAnimation(this.enemy.getAnim("dig"),true); + this.dig_x = x; + this.dig_y = y; + this.enemy.dispatchEvent(new com_davidmaletz_mining_enemy_SetTileEvent("dig_tile",x,y,this.speed)); + return true; + } else { + return false; + } + } + ,insertNode: function(queue,x,y,parent) { + if(this.enemy.area == null || this.enemy.area.emptyTile(x,y) || this.enemy.getBlocking(x,y) != null) { + return; + } + var t = this.enemy.getTileBlockId(x,y); + if(t == -1) { + queue.insert(new com_fancyfish_faeng_common_Node(x,y,parent)); + } else if(this.canDig(this.enemy.area,x,y,t)) { + var n = new com_fancyfish_faeng_common_Node(x,y,parent); + n.depth += 5; + queue.insert(n); + } + } + ,hasAttacked: null + ,playIdle: function(p) { + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + if(!this.isOwner()) { + com_davidmaletz_mining_enemy_EnemyRenderer.prototype.playIdle.call(this,p); + return; + } + var tx = this.enemy.get_tile_x() - com_fancyfish_faeng_common_Utils.sign(this.get_scaleX()) * 10; + if(!this.enemy.area.isLooping() && (this.enemy.area.left != null && tx < this.enemy.area.left.fromX || this.enemy.area.right != null && tx > this.enemy.area.right.fromX)) { + this.set_scaleX(-this.get_scaleX()); + this.enemy.onFlip(); + com_davidmaletz_mining_enemy_EnemyRenderer.prototype.playIdle.call(this,null); + return; + } + var attack_range = this.getAttackRange(); + if(!this.hasAttacked && attack_range > 0) { + var b = this.getClosestForAttack(); + if(b != null && b.object != null) { + var maxDist = this.enemy.getXDistance(b.bounds); + if(maxDist > com_davidmaletz_tiles_Tile.SIZE && this.canAttack(b.object) && maxDist <= attack_range) { + this.hasAttacked = true; + this.doAttack(b.object,maxDist); + return; + } + } + } else { + this.hasAttacked = false; + } + var area = this.enemy.area; + var dx = -com_fancyfish_faeng_common_Utils.sign(this.get_scaleX()); + var x = this.enemy.get_tile_x(); + var y = this.enemy.get_tile_y(); + var queue = new com_fancyfish_faeng_common_Heap(com_fancyfish_faeng_common_Node.lessThan); + var visited = new haxe_ds_IntMap(); + var start = new com_fancyfish_faeng_common_Node(x,y); + queue.insert(start); + var best = null; + var hasPlayer = this.hasTarget(5); + while(!queue.isEmpty()) { + var n = queue.remove(); + var i = com_fancyfish_faeng_common_Utils.getIdx(n.x,n.y); + if(visited.exists(i)) { + continue; + } + visited.set(i,true); + if(n.depth > 30) { + break; + } + if(best == null && n.x != x) { + best = n; + if(!hasPlayer) { + break; + } + } + var o = this.enemy.getBlocking(n.x + dx,n.y); + if(o != null && this.canAttack(o)) { + if(n.depth == 0) { + this.attack_ct--; + if(this.attack_ct <= 0) { + this.attack_ct = 6; + this.set_scaleX(-this.get_scaleX()); + this.enemy.onFlip(); + this.playIdle(null); + return; + } else { + var a = this.getMeleeAttack(); + if(a != null) { + this.moveIntoRange(o,(function(a1,o1,f) { + return function() { + f[0](o1[0],a1[0]); + }; + })([a],[o],[$bind(this,this.attackWith)]),this.speed); + } + return; + } + } else { + while(n.parent != start) n = n.parent; + this.tryMove(area,n.x,n.y); + return; + } + } + this.insertNode(queue,n.x + dx,n.y,n); + var dy = Math.random() < 0.5 ? 1 : -1; + this.insertNode(queue,n.x,n.y + dy,n); + this.insertNode(queue,n.x,n.y - dy,n); + } + if(best != null) { + while(best.parent != start) best = best.parent; + this.tryMove(area,best.x,best.y); + return; + } + if(p == null) { + com_davidmaletz_mining_enemy_EnemyRenderer.prototype.playIdle.call(this,p); + } else { + this.set_scaleX(-this.get_scaleX()); + this.enemy.onFlip(); + this.playIdle(null); + } + } + ,init: function(e) { + this.set_scaleX(Math.random() < 0.5 ? this.get_scaleY() : -this.get_scaleY()); + com_davidmaletz_mining_enemy_EnemyRenderer.prototype.init.call(this,e); + } + ,advanceFrame: function(frames) { + com_davidmaletz_mining_enemy_EnemyRenderer.prototype.advanceFrame.call(this,frames); + if(this.dig_x != -2147483648 && this.enemy.area != null) { + var t = this.enemy.area.getTileId(this.dig_x,this.dig_y,0); + if(t < 0) { + this.dig_x = -2147483648; + this.playIdle(this); + } else if(this.enemy.area.renderer != null && !this.enemy.area.renderer.incBrickBreak(this.dig_x,this.dig_y,frames * this.speed)) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + this.enemy.area.mine(this.dig_x,this.dig_y,t,0,this.enemy); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + this.dig_x = -2147483648; + this.playIdle(this); + } + } + } + ,__class__: com_davidmaletz_mining_enemy__$Wyrm_WyrmRenderer +}); +var com_davidmaletz_mining_familiar_Familiar = function(i,p,xml,type) { + this.attacking = false; + this.nextScale = 0; + this.talk_sfx_frames = 240 * (1 + Math.random()); + this.mine_speed_boost = false; + this.flash_ct = 0; + this.shownHungry = false; + var t = com_davidmaletz_tiles_Tile.get(xml.get("tile")); + if(t == null) { + t = com_davidmaletz_tiles_Tile.get("empty"); + } + var ti = com_davidmaletz_tiles_Tile.get(com_davidmaletz_mining_item_ItemInfo.getParameter(i.getNameStr(),"i")); + if(ti != null) { + t = ti; + } + this.type = type; + this.familiar = xml; + com_davidmaletz_mining_enemy_AttackRenderer.call(this,t,com_davidmaletz_mining_enemy_AttackRenderer.getTargets(xml.elementsNamed("target")),type.attacks,com_davidmaletz_mining_enemy_AttackRenderer.getFPS(xml,15),xml.get("walk_sfx")); + this.item = i; + this.player = p; + this._width = t.getWidth(); + this._height = t.getHeight(); + this.partialCost = 0; + this.set_x(p.getVCenterX()); + this.set_y(this.getSpawnY()); + this.set_alpha(0); + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),10); + var len = type.spawn.length; + if(len > 0) { + this.spawn = []; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i1 = _g1++; + this.spawn.push(0); + } + } + if(type.light != null) { + this.light = new com_davidmaletz_mining_world_Light(type.light,Math.round(this.get_x()),Math.round(this.get_y())); + } + this.max_attack = 0; + this.attackSpirit = false; + var _g2 = 0; + var _g11 = this.attacks; + while(_g2 < _g11.length) { + var a = _g11[_g2]; + ++_g2; + this.max_attack = com_fancyfish_faeng_common_Utils.max(this.max_attack,a.damage); + if(a.xml != null && a.xml.exists("spirit")) { + this.attackSpirit = true; + } + } + i.info.tint(this,i.getNameStr()); + if(type.xml.exists("collect") && type.xml.get("collect") != "false") { + this.collect_range = com_davidmaletz_mining_Main.parseInt(type.xml.get("collect")); + } else { + this.collect_range = -1; + } + if(type.xml.exists("max_depth")) { + this.max_depth = com_davidmaletz_mining_Main.parseInt(type.xml.get("max_depth")); + } else { + this.max_depth = 80; + } +}; +$hxClasses["com.davidmaletz.mining.familiar.Familiar"] = com_davidmaletz_mining_familiar_Familiar; +com_davidmaletz_mining_familiar_Familiar.__name__ = ["com","davidmaletz","mining","familiar","Familiar"]; +com_davidmaletz_mining_familiar_Familiar._getAnim = function(familiar,id) { + var base = familiar.exists("animation") ? familiar.get("animation") : familiar.get("tile"); + if(familiar.exists(id + "_anim")) { + return familiar.get(id + "_anim"); + } else { + var s = base + "." + id; + if(com_davidmaletz_tiles_TileAnimation.exists(s)) { + return s; + } else { + return "familiar." + id; + } + } +}; +com_davidmaletz_mining_familiar_Familiar.__super__ = com_davidmaletz_mining_enemy_AttackRenderer; +com_davidmaletz_mining_familiar_Familiar.prototype = $extend(com_davidmaletz_mining_enemy_AttackRenderer.prototype,{ + collect_range: null + ,max_depth: null + ,item: null + ,player: null + ,type: null + ,_width: null + ,_height: null + ,partialCost: null + ,shownHungry: null + ,flash_ct: null + ,familiar: null + ,attackSpirit: null + ,spawn: null + ,light: null + ,mine_speed_boost: null + ,max_attack: null + ,allowUnderwater: function() { + if(this.type.xml.get("underwater") != "true") { + return this.familiar.get("underwater") == "true"; + } else { + return true; + } + } + ,set_scaleX: function(s) { + if(this.light != null) { + var r = this.light.getRenderer(); + if(r != null) { + r.set_scaleX(s); + } + } + return com_davidmaletz_mining_enemy_AttackRenderer.prototype.set_scaleX.call(this,s); + } + ,init: function(e) { + com_davidmaletz_mining_enemy_AttackRenderer.prototype.init.call(this,e); + this.item.addEventListener("update_value",$bind(this,this.update)); + this.update(null); + } + ,destroy: function(e) { + com_davidmaletz_mining_enemy_AttackRenderer.prototype.destroy.call(this,e); + this.item.removeEventListener("update_value",$bind(this,this.update)); + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.handle_frame)); + if(this.light != null && this.light.area != null) { + this.light.removeFromArea(this.light.area); + } + if(this.mine_speed_boost) { + this.player.stats.get("mine_speed").add(-this.type.breakPowerMod); + this.mine_speed_boost = false; + } + } + ,fireEvent: function(e) { + this.player.dispatchEvent(e); + } + ,repeatAttack: function(o) { + var ret = com_davidmaletz_mining_enemy_AttackRenderer.prototype.repeatAttack.call(this,o); + if(!ret) { + this.player.dispatchEvent(new openfl_events_Event("end_attack")); + } + return ret; + } + ,getAttackRange: function(type) { + return com_fancyfish_faeng_common_Utils.max(com_davidmaletz_mining_enemy_AttackRenderer.prototype.getAttackRange.call(this,type),this.collect_range + com_davidmaletz_tiles_Tile.SIZE * 8); + } + ,doAttack: function(o,dist,type) { + if(this.collect_range >= 0 && Std["is"](o,com_davidmaletz_mining_world_TrapObject)) { + if(dist > this.collect_range) { + return false; + } + var o1 = js_Boot.__cast(o , com_davidmaletz_mining_world_TrapObject); + if(o1.hasHeld()) { + o1.onOperate(this.player); + return true; + } else { + return false; + } + } else if(this.collect_range >= 0 && Std["is"](o,com_davidmaletz_mining_world_ItemObject)) { + if(dist > this.collect_range) { + return false; + } + var o2 = js_Boot.__cast(o , com_davidmaletz_mining_world_ItemObject); + if(!o2.getInfo().item.info.hasActionId("place")) { + o2.doCollect(this.player,false); + com_davidmaletz_faengfl_adv_sound_Sound.play("familiar_collect"); + return true; + } else { + return false; + } + } else { + return com_davidmaletz_mining_enemy_AttackRenderer.prototype.doAttack.call(this,o,dist,type); + } + } + ,hasControl: function() { + return this.player == com_davidmaletz_mining_Main.getLocalPlayer(); + } + ,update: function(e) { + var a = this.player.getCurrentArea(); + var durability = this.item.getDurability(); + if(durability == 0) { + if(this.light != null && this.light.area == null && a != null) { + this.light.addToArea(a); + } + if(this.type.breakPowerMod > 0) { + this.updateMineSpeed(); + } + return; + } + var hungry = this.item.value / durability > 0.9; + if(this.hasControl() && hungry != this.shownHungry) { + if(!this.shownHungry) { + if(this.item.info.xml.get("breakable") != "true") { + this.item.info.showNotification(com_fancyfish_faeng_common_Lang.getText("common","hungry"),this.item.getNameStr()); + } + this.flash_ct = 15; + } + this.shownHungry = hungry; + this.set_alpha(1); + } + if(this.light != null) { + if(this.item.value < this.item.getDurability() && a != null) { + this.light.addToArea(a); + } else { + this.light.removeFromArea(this.light.area); + } + } + if(this.type.breakPowerMod > 0) { + this.updateMineSpeed(); + } + } + ,playerDistance: function() { + var dx = this.player.getCurrentArea().adjustDx(Math.floor(this.get_x() - this.player.getVCenterX())); + var dy = this.get_y() - this.player.getVCenterY(); + return Math.sqrt(dx * dx + dy * dy); + } + ,getTargetY: function() { + return Math.round(this.player.getVCenterY() + (this.player._height - this._height) * 0.5); + } + ,getSpawnY: function() { + return this.getTargetY(); + } + ,hasAttack: function() { + if(this.collect_range >= 0) { + return true; + } + if((this.player.equipment.getStateI(this.item.info.xml.get("slot")) & 1) != 0) { + return false; + } + var durability = this.item.getDurability(); + var _g = 0; + var _g1 = this.attacks; + while(_g < _g1.length) { + var a = _g1[_g]; + ++_g; + if(this.item.value + a.cost <= durability) { + return true; + } + } + return false; + } + ,onHit: function(a,o,dmg,def) { + if(a.cost == 0 || a.xml != null && a.xml.get("scaleCost") == "false") { + return; + } + var e = def + 1; + if(e < 0) { + e = 1; + } + if(e > 0) { + this.increaseValue(Math.round(a.cost * e)); + } + } + ,canUseAttack: function(a) { + if(com_davidmaletz_mining_enemy_AttackRenderer.prototype.canUseAttack.call(this,a)) { + return this.item.value + a.cost <= this.item.getDurability(); + } else { + return false; + } + } + ,attackObject: function(o,a,xml) { + if(com_davidmaletz_mining_enemy_AttackRenderer.get(a,xml,"overEnemy") == "true") { + var dx = Math.round(o.getCenterX() - this.get_x()); + if(dx != 0) { + var dir = com_fancyfish_faeng_common_Utils.sign(dx); + dx = com_fancyfish_faeng_common_Utils.abs(dx); + var b = this.getClosest(dx,dir,false); + if(b == null) { + var _g = this; + _g.set_x(_g.get_x() + dx * dir); + } else { + var _g1 = this; + _g1.set_x(_g1.get_x() + com_fancyfish_faeng_common_Utils.min(Math.round(this.getXDistance(b.bounds,dir)),dx) * dir); + } + } + } + var def = Std["is"](o,com_davidmaletz_mining_enemy_Enemy) ? (js_Boot.__cast(o , com_davidmaletz_mining_enemy_Enemy)).getMinDefense() : 0; + var dmg = com_davidmaletz_mining_enemy_AttackRenderer.prototype.attackObject.call(this,o,a,xml); + this.player.addAttackExp(o,dmg,def); + this.onHit(a,o,dmg,def); + return dmg; + } + ,increaseValue: function(amt) { + if(!this.hasControl() || amt == 0) { + return; + } + var durability = this.item.getDurability(); + if(this.player.equipment.getItem("familiar") == this.item && this.item.value < durability) { + if(this.item.value + amt >= durability) { + amt = durability - this.item.value; + } + this.player.equipment.increaseValue(this.player,"familiar",amt); + } + } + ,updateMineSpeed: function() { + var dur = this.item.getDurability(); + var val = dur == 0 || this.item.value + this.type.breakPowerModCost < dur; + if(val != this.mine_speed_boost) { + this.mine_speed_boost = val; + this.player.stats.get("mine_speed").add(this.type.breakPowerMod * (val ? 1 : -1)); + } + } + ,useBreakPower: function() { + if(this.type.breakPowerMod > 0) { + this.increaseValue(this.type.breakPowerModCost); + } + } + ,getElement: function() { + var e = this.item.getElement(); + if(e != null) { + return e; + } else { + return com_davidmaletz_mining_world_Element.get(this.type.xml.get("element")); + } + } + ,attackWith: function(o,a,elem,show,hit_ct) { + if(hit_ct == null) { + hit_ct = 0; + } + if(show == null) { + show = true; + } + if(elem == null) { + elem = "pre"; + } + this.increaseValue(Math.round(a.cost)); + com_davidmaletz_mining_enemy_AttackRenderer.prototype.attackWith.call(this,o,a,elem,show,hit_ct); + } + ,talk_sfx_frames: null + ,advanceFrame: function(frames) { + var area = this.player.getCurrentArea(); + if(area == null) { + this.advanceTracks(frames); + return; + } + var idle = this.animation == this.getAnim("idle") || this.animation == this.getAnim("swim.idle"); + if(idle) { + this.talk_sfx_frames -= frames; + if(this.talk_sfx_frames < 0) { + this.talk_sfx_frames += 2400 * (1 + Math.random()); + if(this.type.talk_sfx != null && this.stage != null) { + com_davidmaletz_faengfl_adv_sound_Sound.playLoc(this.type.talk_sfx,this,null,false,2); + } + var a = this.getAnim("talk"); + if(com_davidmaletz_tiles_TileAnimation.exists(a)) { + this.playAnimation(a,false,$bind(this,this.playIdle)); + } + } + } else if(this.talk_sfx_frames < 240) { + this.talk_sfx_frames = 240 * (1 + Math.random()); + } + if(this.hasControl()) { + if(this.shownHungry) { + this.flash_ct -= frames; + if(this.flash_ct < 0) { + this.flash_ct += 15; + this.set_alpha(this.get_alpha() == 1 ? 0.5 : 1); + } + } + if(this.spawn != null && (idle || this.animation == this.getAnim("walk") || this.animation == this.getAnim("swim"))) { + var len = this.spawn.length; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + var cur = this.spawn[i] + frames; + var s = this.type.spawn[i]; + if(cur > s.cooldown) { + cur -= s.cooldown; + if(this.item.value + s.cost <= this.item.getDurability()) { + this.increaseValue(s.cost); + if(s.animation != null) { + this.runAnimation(s.animation,(function(p,f) { + return function() { + f[0](p[0]); + }; + })([this],[$bind(this,this.playIdle)])); + } + var i1 = com_davidmaletz_mining_item_ItemInfo.get(s.item); + if(i1 != null) { + var b = this.getRectangle(); + area.addObject(com_davidmaletz_mining_world_ObjectInfo.make(i1.id,Math.round(b.x),Math.floor((b.get_bottom() - 1) / com_davidmaletz_tiles_Tile.SIZE) * com_davidmaletz_tiles_Tile.SIZE)); + } + } + } + this.spawn[i] = cur; + } + } + if(this.animation != this.getAnim("idle") && this.animation != this.getAnim("swim.idle")) { + this.partialCost += this.type.costPerFrame * frames; + if(this.partialCost > 1) { + var i2 = Math.floor(this.partialCost); + this.increaseValue(i2); + this.partialCost -= i2; + } + } + } + com_davidmaletz_mining_enemy_AttackRenderer.prototype.advanceFrame.call(this,frames); + com_davidmaletz_mining_renderer_AreaRenderer.updateLoop(this,area); + if(this.light != null) { + this.light.setPosition(Math.round(this.get_x()),Math.round(this.get_y())); + } + } + ,endAnimation: function(func) { + this.attacking = false; + func(); + } + ,runAnimation: function(anim_id,func) { + if(func != null) { + this.attacking = true; + this.fireEvent(new com_davidmaletz_faengfl_events_ObjectEvent("familiar_play",anim_id)); + var f = $bind(this,this.endAnimation); + var a1 = func; + func = function() { + f(a1); + }; + } + com_davidmaletz_mining_enemy_AttackRenderer.prototype.runAnimation.call(this,anim_id,func); + } + ,shouldAttack: function(o) { + if(this.collect_range >= 0 && Std["is"](o,com_davidmaletz_mining_world_TrapObject)) { + return (js_Boot.__cast(o , com_davidmaletz_mining_world_TrapObject)).hasHeld(); + } else if(this.collect_range >= 0 && Std["is"](o,com_davidmaletz_mining_world_ItemObject)) { + var o1 = js_Boot.__cast(o , com_davidmaletz_mining_world_ItemObject); + return !o1.getInfo().item.info.hasActionId("place"); + } else if(Std["is"](o,com_davidmaletz_mining_enemy_Enemy)) { + var e = js_Boot.__cast(o , com_davidmaletz_mining_enemy_Enemy); + if(this.max_attack > e.getMinDefense()) { + return e.canBeAttacked(this,this.attackSpirit); + } else { + return false; + } + } else { + return false; + } + } + ,getAttacker: function() { + return this.player; + } + ,getArea: function() { + return this.player.getCurrentArea(); + } + ,getSelf: function() { + return this; + } + ,isOwner: function() { + return this.hasControl(); + } + ,showPopup: function(msg,x,y) { + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + if((com_davidmaletz_mining_ui_NotificationQueue.OPTIONS & 4) != 0) { + return; + } + var p = com_davidmaletz_mining_Main.getContainer().globalToLocal(this.localToGlobal(new openfl_geom_Point(x,y))); + new com_davidmaletz_faengfl_ui_Popup(p.x,p.y - com_davidmaletz_tiles_Tile.SIZE,-com_davidmaletz_tiles_Tile.SIZE,msg); + } + ,onMiss: function(o) { + if(o == null) { + this.showPopup(com_fancyfish_faeng_common_Lang.getText("common","miss"),-com_davidmaletz_tiles_Tile.SIZE); + } else { + o.showPopup(true,com_fancyfish_faeng_common_Lang.getText("common","dodged")); + } + } + ,getRectangle: function() { + com_davidmaletz_mining_world_BaseObject.rectangle.setTo(this.get_x() - this._width * 0.5,this.get_y() - this._height * 0.5,this._width,this._height); + return com_davidmaletz_mining_world_BaseObject.rectangle; + } + ,getAnim: function(id) { + return com_davidmaletz_mining_familiar_Familiar._getAnim(this.familiar,id); + } + ,remove: function() { + var d = this; + var tmp = function() { + com_davidmaletz_faengfl_FaengFL.remove(d); + }; + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),10,tmp); + com_davidmaletz_faengfl_FaengFL.removeEnterFrame(this); + if(this.stage != null) { + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.handle_frame)); + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.handle_frame),false,PriorityManager.getPriority()); + } + } + ,handle_frame: function(e) { + this.advanceTracks(com_davidmaletz_faengfl_FaengFL.frameTime); + } + ,canStandOn: function(t) { + return t != null; + } + ,canEnterTile: function(x,y) { + var area = this.player.getCurrentArea(); + if(area.isWater(x,y)) { + if(this.type.xml.get("underwater") == "true" || this.familiar.get("underwater") == "true") { + return y <= this.max_depth; + } else { + return false; + } + } + ++y; + if(!this.canStandOn(area.getTile(x,y,0))) { + return area.getTile(x,y,3) != null; + } else { + return true; + } + } + ,checkObject: function(addBounds,o) { + if(this.shouldAttack(o)) { + addBounds(o,o.getBounds()); + } + return false; + } + ,getTileBlockId: function(tx,ty) { + var b = this.getRectangle(); + return this.player.getCurrentArea().getTileId(tx,ty,0); + } + ,tileBlocking: function(x,y,yBottom) { + if(this.getTileBlockId(x,y) == -1) { + if(y == yBottom) { + return !this.canEnterTile(x,y); + } else { + return false; + } + } else { + return true; + } + } + ,checkTile: function(yBottom,addBounds,x,y) { + if(this.tileBlocking(x,y,yBottom)) { + com_davidmaletz_mining_world_Object.rectangle.setTo(x * com_davidmaletz_tiles_Tile.SIZE,y * com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE); + addBounds(null,com_davidmaletz_mining_world_Object.rectangle); + } + return false; + } + ,getClosest: function(range,dx,checkObjects,checkTiles,filter,dy) { + if(dy == null) { + dy = 0; + } + if(checkTiles == null) { + checkTiles = true; + } + if(checkObjects == null) { + checkObjects = true; + } + if(dx == null) { + dx = 1; + } + return this._getClosest(this.getRectangle(),range,dx,checkObjects,checkTiles,filter,dy); + } + ,_getClosest: function(b,range,dx,checkObjects,checkTiles,filter,dy) { + if(dy == null) { + dy = 0; + } + if(checkTiles == null) { + checkTiles = true; + } + if(checkObjects == null) { + checkObjects = true; + } + if(dx == null) { + dx = 1; + } + var area = this.player.getCurrentArea(); + if(area == null) { + return null; + } + var tile_y = Math.floor((b.get_bottom() - 1) / com_davidmaletz_tiles_Tile.SIZE); + if(com_davidmaletz_mining_world_Object.blocker_obj == null) { + com_davidmaletz_mining_world_Object.blocker_obj = new com_davidmaletz_mining_world_Blocker(); + } + var tmp = com_davidmaletz_mining_world_Object.blocker_obj; + var area1 = area.objects; + var tmp1 = this.get_scaleX() * dx; + var tmp2; + if(checkTiles) { + var f = $bind(this,this.checkTile); + var a1 = tile_y; + tmp2 = function(a2,x,y) { + return f(a1,a2,x,y); + }; + } else { + tmp2 = null; + } + return com_davidmaletz_mining_world_Object._getClosest(tmp,b,area1,range,tmp1,checkObjects ? $bind(this,this.checkObject) : null,tmp2,filter,dy,0); + } + ,getAttackTarget: function(a) { + var r = a.range + this._width; + var b = this.getClosest(r,1,true,false,$bind(this,this.canAttack),a.type == "breath" ? r >> 1 : 0); + if(b == null || this.getXDistance(b.bounds) > a.range) { + return null; + } else { + return b.object; + } + } + ,canPlace: function() { + var _gthis = this; + if(!this.hasControl()) { + return true; + } + var area = this.player.getCurrentArea(); + if(area == null) { + return false; + } + var ret = true; + var b = this.getRectangle(); + var tile_y = Math.floor((b.get_bottom() - 1) / com_davidmaletz_tiles_Tile.SIZE); + area.getObjects(b,null,function(x,y) { + if(_gthis.getTileBlockId(x,y) != -1 || y == tile_y && !_gthis.canEnterTile(x,y)) { + ret = false; + return true; + } else { + return false; + } + }); + return ret; + } + ,enter_frame: function(frames) { + if(!this.hasControl() || com_davidmaletz_faengfl_Window.window_ct == 0) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = this.hasControl(); + com_davidmaletz_mining_enemy_AttackRenderer.prototype.enter_frame.call(this,frames); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + } + ,nextScale: null + ,attacking: null + ,setPos: function(x,y,s,flags,frames) { + if(this.hasTrack(com_davidmaletz_lerp_PositionKeyframe)) { + var f = $bind(this,this.setPos); + var x1 = x; + var y1 = y; + var s1 = s; + var a1 = flags; + var a2 = frames; + var tmp = function() { + f(x1,y1,s1,a1,a2); + }; + this.getTrack(com_davidmaletz_lerp_PositionKeyframe).onComplete = tmp; + return; + } + var area = this.player.getCurrentArea(); + if(area == null) { + return; + } + var xPos = Math.round(this.get_x()); + var dx = x - xPos; + var dy = this.get_y() - Math.round(y); + var t = com_davidmaletz_tiles_Tile.SIZE * 6; + dx = area.adjustDx(dx); + if(dx == 0 && dy == 0 || dx * dx + dy * dy > t * t || this.stage == null) { + this.clearTrack(com_davidmaletz_lerp_PositionKeyframe); + this.set_x(x); + this.set_y(y); + this.nextScale = s; + this.setFacing(); + if(!this.attacking) { + this.playIdle(null); + } + } else { + this.setFacing(); + this.nextScale = s; + var f1 = Math.ceil(frames); + if(f1 > 0) { + this.lerp(new com_davidmaletz_lerp_PositionKeyframe(xPos + dx,y),f1,$bind(this,this.finishWalk)); + if(!this.attacking) { + this.playWalk(null); + } + } else { + this.set_x(x); + this.set_y(y); + this.setFacing(); + if(!this.attacking) { + this.playIdle(null); + } + } + } + } + ,finishWalk: function() { + this.setFacing(); + if(!this.attacking) { + this.playIdle(this); + } + } + ,setFacing: function() { + if(this.nextScale != 0) { + this.set_scaleX(this.nextScale * this.get_scaleY()); + this.nextScale = 0; + } + } + ,playWalk: function(p) { + if(p != null) { + this.setFrame(0); + } + this.playAnimation(this.getAnim("walk"),false,$bind(this,this.playWalk)); + } + ,showAttack: function(a,onComplete,elem,hit_ct,canFire) { + if(canFire == null) { + canFire = true; + } + if(hit_ct == null) { + hit_ct = 0; + } + if(elem == null) { + elem = "pre"; + } + this.attacking = true; + com_davidmaletz_mining_enemy_AttackRenderer.prototype.showAttack.call(this,a,onComplete,elem,hit_ct,canFire); + } + ,attackComplete: function(a,p) { + this.attacking = false; + com_davidmaletz_mining_enemy_AttackRenderer.prototype.attackComplete.call(this,a,p); + } + ,__class__: com_davidmaletz_mining_familiar_Familiar +}); +var com_davidmaletz_mining_familiar_FamiliarHandler = function(p) { + this.familiar_check = -1; + this.player = p; +}; +$hxClasses["com.davidmaletz.mining.familiar.FamiliarHandler"] = com_davidmaletz_mining_familiar_FamiliarHandler; +com_davidmaletz_mining_familiar_FamiliarHandler.__name__ = ["com","davidmaletz","mining","familiar","FamiliarHandler"]; +com_davidmaletz_mining_familiar_FamiliarHandler.__interfaces__ = [com_davidmaletz_faengfl_EnterFrameHandler]; +com_davidmaletz_mining_familiar_FamiliarHandler.prototype = { + player: null + ,familiar: null + ,familiar_check: null + ,change_familiar: function(e) { + this.hide(); + if(this.player.getCurrentArea() == null) { + return; + } + var i = this.player.equipment.getItem("familiar"); + this.familiar_check = -1; + if(i != null) { + this.familiar = com_davidmaletz_mining_familiar_FamiliarType.make(i,this.player); + var a = this.player.getCurrentArea(); + if(!a.hasOxygen() && i.info.xml.get("needsO2") != "false" && i.info.getValue(i.getNameStr(),"needsO2") != "false" && (this.familiar == null || !Std["is"](this.familiar,com_davidmaletz_mining_familiar_Swimming))) { + return; + } + if(a.isOrbit() && i.info.xml.get("flyOrbit") != "true" && i.info.getValue(i.getNameStr(),"flyOrbit") != "true") { + return; + } + if(this.familiar != null && a.renderer != null) { + a.renderer.over_objects.addChildAt(this.familiar,0); + } else { + this.familiar_check = 1000; + } + } + } + ,summon: function() { + if(this.player == com_davidmaletz_mining_Main.getLocalPlayer()) { + this.change_familiar(null); + } + } + ,init: function() { + if(this.familiar != null) { + return; + } + this.destroy(); + var m = this.player.equipment.get("familiar"); + if(m != null) { + m.addEventListener("updated",$bind(this,this.change_familiar)); + } + this.change_familiar(null); + com_davidmaletz_faengfl_FaengFL.addEnterFrame(this); + } + ,destroy: function() { + var m = this.player.equipment.get("familiar"); + if(m != null) { + m.removeEventListener("updated",$bind(this,this.change_familiar)); + } + this.hide(); + com_davidmaletz_faengfl_FaengFL.removeEnterFrame(this); + } + ,hide: function() { + if(this.familiar != null) { + this.familiar.remove(); + this.familiar = null; + } + } + ,enter_frame: function(frames) { + var a = this.player.getCurrentArea(); + if(a == null || a.renderer == null) { + this.destroy(); + return; + } + if(this.player != com_davidmaletz_mining_Main.getLocalPlayer()) { + if(this.familiar != null && this.familiar.parent != a.renderer.over_objects) { + this.destroy(); + } + } else if(this.familiar != null && (this.familiar.parent != a.renderer.over_objects || this.familiar.playerDistance() > 1024)) { + this.change_familiar(null); + } else if(this.familiar_check > 0) { + this.familiar_check -= frames; + if(this.familiar_check <= 0) { + this.change_familiar(null); + } + } + } + ,__getFamiliar: function() { + if(this.familiar == null) { + this.change_familiar(null); + } + return this.familiar; + } + ,__class__: com_davidmaletz_mining_familiar_FamiliarHandler +}; +var com_davidmaletz_mining_familiar_FamiliarType = function(xml,mod) { + this.spawnCt = 0; + this.id = xml.get("id"); + this.xml = xml; + this.talk_sfx = xml.get("talk_sfx"); + this.costPerFrame = xml.exists("costPerSecond") ? com_davidmaletz_mining_Main.parseFloat(xml.get("costPerSecond")) / 60 : 0; + var atk = com_davidmaletz_mining_item_Equipment.getAttr(mod,"attack"); + var rng = com_davidmaletz_mining_item_Equipment.getAttr(mod,"range") * com_davidmaletz_tiles_Tile.SIZE; + this.efficiency = mod == null || !mod.exists("efficiency") ? 1 : com_davidmaletz_mining_Main.parseFloat(mod.get("efficiency")); + var eff = 1.0 / this.efficiency; + this.attacks = []; + var e = xml.elementPathsNamed("attack"); + while(e.hasNext()) { + var e1 = e.next(); + var a = com_davidmaletz_mining_enemy_Attack.fromXML(e1); + com_davidmaletz_mining_familiar_FamiliarType.modifyAttack(a,atk,rng,eff); + this.attacks.push(a); + } + this.spawn = []; + var e2 = xml.elementsNamed("spawn"); + while(e2.hasNext()) { + var e3 = e2.next(); + var s = new com_davidmaletz_mining_familiar_Spawn(e3,eff); + if(s.item != null) { + this.spawn.push(s); + } + } + this.spawnCt = this.spawn.length; + if(mod != null) { + var e4 = mod.elementsNamed("spawn"); + while(e4.hasNext()) { + var e5 = e4.next(); + var s1 = new com_davidmaletz_mining_familiar_Spawn(e5,eff); + if(s1.item != null) { + this.spawn.push(s1); + } + } + } + this.sight = (xml.exists("sight") ? com_davidmaletz_mining_Main.parseInt(xml.get("sight")) : 2) + com_davidmaletz_mining_item_Equipment.getAttr(mod,"sight"); + var i = xml.elementsNamed("breakPower"); + if(i.hasNext()) { + var e6 = i.next(); + this.breakPowerMod = com_davidmaletz_mining_Main.parseInt(e6.get("amount")); + this.breakPowerModCost = com_davidmaletz_mining_Main.parseInt(e6.get("cost")); + if(eff != 1) { + this.breakPowerModCost = Math.round(this.breakPowerModCost * eff); + } + } else { + this.breakPowerMod = 0; + } + if(xml.exists("type")) { + var cls = xml.get("type").toLowerCase(); + cls = cls.charAt(0).toUpperCase() + HxOverrides.substr(cls,1,null); + var c = Type.resolveClass("com.davidmaletz.mining.familiar." + cls); + if(c != null) { + this.type = c; + } + } + var i1 = xml.elementsNamed("light"); + if(i1.hasNext()) { + this.light = new com_davidmaletz_mining_world_LightInfo(i1.next()); + } else if(mod != null) { + var i2 = mod.elementsNamed("light"); + if(i2.hasNext()) { + this.light = new com_davidmaletz_mining_world_LightInfo(i2.next()); + } + } + var e7 = xml.elementsNamed("ride"); + while(e7.hasNext()) { + var e8 = e7.next(); + if(this.ride == null) { + this.ride = new haxe_ds_StringMap(); + } + this.ride.set(e8.get("item"),new openfl_geom_Point(com_davidmaletz_mining_Main.parseInt(e8.get("x")),com_davidmaletz_mining_Main.parseInt(e8.get("y")))); + } +}; +$hxClasses["com.davidmaletz.mining.familiar.FamiliarType"] = com_davidmaletz_mining_familiar_FamiliarType; +com_davidmaletz_mining_familiar_FamiliarType.__name__ = ["com","davidmaletz","mining","familiar","FamiliarType"]; +com_davidmaletz_mining_familiar_FamiliarType.modifyAttack = function(a,atk,rng,eff) { + a.damage += atk; + if(eff != 1) { + a.cost *= eff; + } + if(a.range > com_davidmaletz_tiles_Tile.SIZE) { + a.range += rng; + } +}; +com_davidmaletz_mining_familiar_FamiliarType.modifyAttacks = function(attacks,mod) { + var ret = []; + var atk = com_davidmaletz_mining_item_Equipment.getAttr(mod,"attack"); + var rng = com_davidmaletz_mining_item_Equipment.getAttr(mod,"range") * com_davidmaletz_tiles_Tile.SIZE; + var eff = mod == null || !mod.exists("efficiency") ? 1 : 1.0 / com_davidmaletz_mining_Main.parseFloat(mod.get("efficiency")); + var _g = 0; + while(_g < attacks.length) { + var _a = attacks[_g]; + ++_g; + var a = _a.copy(); + com_davidmaletz_mining_familiar_FamiliarType.modifyAttack(a,atk,rng,eff); + ret.push(a); + } + return ret; +}; +com_davidmaletz_mining_familiar_FamiliarType.familiars = null; +com_davidmaletz_mining_familiar_FamiliarType.types = null; +com_davidmaletz_mining_familiar_FamiliarType.loadFamiliar = function(xml) { + if(com_davidmaletz_mining_familiar_FamiliarType.familiars == null) { + com_davidmaletz_mining_familiar_FamiliarType.familiars = new haxe_ds_StringMap(); + } + var id = xml.get("id"); + if(com_davidmaletz_mining_familiar_FamiliarType.familiars.exists(id)) { + haxe_Log.trace("Overwrite Familiar: " + id,{ fileName : "FamiliarType.hx", lineNumber : 84, className : "com.davidmaletz.mining.familiar.FamiliarType", methodName : "loadFamiliar"}); + } + com_davidmaletz_mining_familiar_FamiliarType.familiars.set(id,xml); +}; +com_davidmaletz_mining_familiar_FamiliarType.get = function(id) { + var ret = com_davidmaletz_mining_familiar_FamiliarType._get(id); + if(id != null && id.length > 0 && ret == null) { + haxe_Log.trace("No Familiar found: " + id,{ fileName : "FamiliarType.hx", lineNumber : 87, className : "com.davidmaletz.mining.familiar.FamiliarType", methodName : "get"}); + } + return ret; +}; +com_davidmaletz_mining_familiar_FamiliarType._get = function(id) { + if(id == null || com_davidmaletz_mining_familiar_FamiliarType.familiars == null) { + return null; + } else { + return com_davidmaletz_mining_familiar_FamiliarType.familiars.get(id); + } +}; +com_davidmaletz_mining_familiar_FamiliarType.reset = function() { + com_davidmaletz_mining_familiar_FamiliarType.familiars = null; + com_davidmaletz_mining_familiar_FamiliarType.types = null; +}; +com_davidmaletz_mining_familiar_FamiliarType.getXml = function(item) { + var i = item.xml.elementsNamed("familiar"); + if(i.hasNext()) { + return i.next(); + } else { + return null; + } +}; +com_davidmaletz_mining_familiar_FamiliarType.getType = function(_id,name) { + var mod = com_davidmaletz_mining_item_ItemInfo.getMod(name); + var id = _id; + if(mod != null) { + id += "#" + com_davidmaletz_mining_item_ItemInfo.getParameter(name,"m"); + } + if(com_davidmaletz_mining_familiar_FamiliarType.types == null) { + com_davidmaletz_mining_familiar_FamiliarType.types = new haxe_ds_StringMap(); + } + var ret = com_davidmaletz_mining_familiar_FamiliarType.types.get(id); + if(ret != null) { + return ret; + } + var xml = com_davidmaletz_mining_familiar_FamiliarType.get(_id); + if(xml == null) { + return null; + } + ret = new com_davidmaletz_mining_familiar_FamiliarType(xml,mod); + com_davidmaletz_mining_familiar_FamiliarType.types.set(id,ret); + return ret; +}; +com_davidmaletz_mining_familiar_FamiliarType.getFromItem = function(item,name) { + var xml = com_davidmaletz_mining_familiar_FamiliarType.getXml(item); + if(xml == null) { + return null; + } else { + return com_davidmaletz_mining_familiar_FamiliarType.getType(xml.get("id"),name); + } +}; +com_davidmaletz_mining_familiar_FamiliarType.make = function(item,p) { + var xml = com_davidmaletz_mining_familiar_FamiliarType.getXml(item.info); + var type = xml == null ? null : com_davidmaletz_mining_familiar_FamiliarType.getType(xml.get("id"),item.getNameStr()); + if(type == null) { + return null; + } else { + return type.create(item,p,xml); + } +}; +com_davidmaletz_mining_familiar_FamiliarType.prototype = { + id: null + ,type: null + ,spawn: null + ,xml: null + ,attacks: null + ,costPerFrame: null + ,sight: null + ,breakPowerMod: null + ,breakPowerModCost: null + ,light: null + ,efficiency: null + ,spawnCt: null + ,ride: null + ,talk_sfx: null + ,getRide: function(id) { + if(this.ride == null) { + return null; + } else { + return this.ride.get(id); + } + } + ,create: function(item,p,xml) { + var f = this.type != null ? Type.createInstance(this.type,[item,p,xml,this]) : new com_davidmaletz_mining_familiar_Familiar(item,p,xml,this); + if(p != com_davidmaletz_mining_Main.getLocalPlayer() || f.canPlace()) { + return f; + } else { + return null; + } + } + ,addInfo: function(s,w,x,y,value,name) { + if(this.type == com_davidmaletz_mining_familiar_Flying) { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions","flying").get()); + } + if(this.type == com_davidmaletz_mining_familiar_Swimming) { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions","swimming").get()); + } + if(this.xml.get("underwater") == "true") { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions","underwater").get()); + } + var mod = com_davidmaletz_mining_item_ItemInfo.getMod(name); + var dmg = 0; + var range = 0; + var _g = 0; + var _g1 = this.attacks; + while(_g < _g1.length) { + var a = _g1[_g]; + ++_g; + if(a.damage > dmg) { + dmg = a.damage; + } + if(a.range > range) { + range = a.range; + } + } + if(dmg > 0) { + var a1 = com_davidmaletz_mining_item_Equipment.getAttr(mod,"attack"); + y = com_davidmaletz_mining_item_Equipment.addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("common","damage"),dmg - a1,a1); + } + if(this.efficiency != 1) { + y = com_davidmaletz_mining_item_ItemInfo.addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("common","efficiency"),this.efficiency,false,true,this.efficiency > 1 ? 19456 : 4980736); + } + if(this.xml.exists("collect") && this.xml.get("collect") != "false") { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions","collect").get()); + } + if(range > com_davidmaletz_tiles_Tile.SIZE) { + var r = com_davidmaletz_mining_item_Equipment.getAttr(mod,"range"); + y = com_davidmaletz_mining_item_Equipment.addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("stats","range"),Math.round(range / com_davidmaletz_tiles_Tile.SIZE) - r,r); + } + if(this.breakPowerMod > 0) { + y = com_davidmaletz_mining_item_ItemInfo.addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("stats","mine_speed"),Math.round(this.breakPowerMod),true); + } + var ct = this.spawnCt; + var _g2 = 0; + var _g11 = this.spawn; + while(_g2 < _g11.length) { + var e = _g11[_g2]; + ++_g2; + var i = com_davidmaletz_mining_item_ItemInfo.get(e.item); + if(i != null) { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,i.getNotification(com_fancyfish_faeng_common_Lang.getText("item.descriptions","spawn"),null,false),1,ct <= 0 ? 19456 : 0); + } + --ct; + } + return y; + } + ,__class__: com_davidmaletz_mining_familiar_FamiliarType +}; +var com_davidmaletz_mining_familiar_Ground = function(i,p,xml,type) { + this.riding = false; + this.startPath = false; + this.partial = 0; + com_davidmaletz_mining_familiar_Familiar.call(this,i,p,xml,type); + this.playAnimation(this.getIdle(),false,$bind(this,this.playIdle)); +}; +$hxClasses["com.davidmaletz.mining.familiar.Ground"] = com_davidmaletz_mining_familiar_Ground; +com_davidmaletz_mining_familiar_Ground.__name__ = ["com","davidmaletz","mining","familiar","Ground"]; +com_davidmaletz_mining_familiar_Ground.toPos = function(x,y,loop,a,b) { + return a.depth + com_davidmaletz_mining_npc_DefaultNPCIdle.adjustLoop(com_fancyfish_faeng_common_Utils.abs(a.x - x),loop) + com_fancyfish_faeng_common_Utils.abs(a.y - y) < b.depth + com_davidmaletz_mining_npc_DefaultNPCIdle.adjustLoop(com_fancyfish_faeng_common_Utils.abs(b.x - x),loop) + com_fancyfish_faeng_common_Utils.abs(b.y - y); +}; +com_davidmaletz_mining_familiar_Ground.__super__ = com_davidmaletz_mining_familiar_Familiar; +com_davidmaletz_mining_familiar_Ground.prototype = $extend(com_davidmaletz_mining_familiar_Familiar.prototype,{ + partial: null + ,adjustX: function(x) { + var loop = this.player.getCurrentArea().getLoop(); + if(loop > 0) { + if(x < 0) { + x += loop; + } else if(x >= loop) { + x -= loop; + } + } + return x; + } + ,insertNode: function(queue,x,y,parent,visited) { + x = this.adjustX(x); + var i = com_fancyfish_faeng_common_Utils.getIdx(x,y); + if(visited.exists(i)) { + return; + } + visited.set(i,true); + if(!this._tileBlocking(x,y)) { + queue.insert(new com_fancyfish_faeng_common_Node(x,y,parent)); + } + } + ,_tileBlocking: function(_x,_y) { + var ex = _x + Math.ceil(this._width / com_davidmaletz_tiles_Tile.SIZE); + var ey = _y + 1; + var sy = _y - Math.ceil(this._height / com_davidmaletz_tiles_Tile.SIZE) + 1; + var _g1 = sy; + var _g = ey; + while(_g1 < _g) { + var y = _g1++; + var _g3 = _x; + var _g2 = ex; + while(_g3 < _g2) { + var x = _g3++; + if(this.tileBlocking(x,y,_y)) { + return true; + } + } + } + return false; + } + ,path: null + ,startPath: null + ,loopWalk: function(p) { + this.playWalk(p); + this.onComplete = $bind(this,this.loopWalk); + } + ,playWalk: function(p) { + var area = this.player.getCurrentArea(); + var b = this.getRectangle(); + var tile_x = Math.round(b.get_left() / com_davidmaletz_tiles_Tile.SIZE); + var tile_y = Math.floor((b.get_bottom() - 8) / com_davidmaletz_tiles_Tile.SIZE); + var anim = this.getAnim(area != null && area.isWater(tile_x,tile_y) ? "swim" : "walk"); + if(this.riding || !com_davidmaletz_tiles_TileAnimation.exists(anim)) { + anim = this.getAnim("idle"); + } + if(p != null) { + this.setFrame(0); + } + this.playAnimation(anim,false,$bind(this,this.playWalk)); + } + ,getIdle: function() { + var area = this.player.getCurrentArea(); + var b = this.getRectangle(); + var tile_x = Math.round(b.get_left() / com_davidmaletz_tiles_Tile.SIZE); + var tile_y = Math.floor((b.get_bottom() - 8) / com_davidmaletz_tiles_Tile.SIZE); + var ret = this.getAnim(area != null && area.isWater(tile_x,tile_y) ? "swim.idle" : "idle"); + if(com_davidmaletz_tiles_TileAnimation.exists(ret)) { + return ret; + } else { + return this.getAnim("idle"); + } + } + ,pathfind: function() { + var b = this.getRectangle(); + var tile_x = this.adjustX(Math.round(b.get_left() / com_davidmaletz_tiles_Tile.SIZE)); + var tile_y = Math.floor((b.get_bottom() - 1) / com_davidmaletz_tiles_Tile.SIZE); + var tx = this.player.getVTileX(); + var ty = this.player.getVTileY(); + if(tile_x == tx && tile_y == ty) { + return false; + } + var x = tile_x; + var y = tile_y; + var a1 = this.player.getCurrentArea().getLoop(); + var queue = new com_fancyfish_faeng_common_Heap(function(a,b1) { + return com_davidmaletz_mining_familiar_Ground.toPos(x,y,a1,a,b1); + }); + var visited = new haxe_ds_IntMap(); + var start = new com_fancyfish_faeng_common_Node(tx,ty); + visited.set(com_fancyfish_faeng_common_Utils.getIdx(tx,ty),true); + this.insertNode(queue,start.x + 1,start.y,null,visited); + this.insertNode(queue,start.x - 1,start.y,null,visited); + this.insertNode(queue,start.x,start.y + 1,null,visited); + this.insertNode(queue,start.x,start.y - 1,null,visited); + while(!queue.isEmpty()) { + var n = queue.remove(); + if(n.depth > 50) { + break; + } + if(tile_x == n.x && tile_y == n.y) { + this.path = n.parent; + if(this.path == null) { + return false; + } + this.lightTile(this.path.x,this.path.y); + this.startPath = false; + this.loopWalk(null); + return true; + } + this.insertNode(queue,n.x + 1,n.y,n,visited); + this.insertNode(queue,n.x - 1,n.y,n,visited); + this.insertNode(queue,n.x,n.y + 1,n,visited); + this.insertNode(queue,n.x,n.y - 1,n,visited); + } + return false; + } + ,playIdle: function(p) { + if(!this.hasControl()) { + if(p != null) { + this.setFrame(0); + } + this.playAnimation(this.getIdle(),false,$bind(this,this.playIdle)); + return; + } + this.path = null; + if(this.playerDistance() < com_davidmaletz_tiles_Tile.SIZE || !this.pathfind()) { + if((this.animation == this.getAnim("idle") || this.animation == this.getAnim("swim.idle")) && Math.random() < 0.3) { + this.set_scaleX(-this.get_scaleX()); + } + this.setFrame(0); + this.playAnimation(this.getIdle(),false,$bind(this,this.playIdle)); + } + } + ,getSpawnY: function() { + var s = this.player.getCurrentArea().getStructureInTile(this.player.getVTileX(),this.player.getVTileY()); + var oy = s != null ? s.info.playerY : 0; + return Math.floor((this.player.getVTileY() + 1) * com_davidmaletz_tiles_Tile.SIZE - this._height * 0.5 + oy); + } + ,lightTile: function(x,y) { + if(this.type.sight > 0 && this.item.value < this.item.getDurability() - 1) { + this.player.getCurrentArea().lightTiles(x,y,this.type.sight); + } + } + ,lightCurrentTile: function() { + var b = this.getRectangle(); + this.lightTile(Math.round(b.get_left() / com_davidmaletz_tiles_Tile.SIZE),Math.floor((b.get_bottom() - 1) / com_davidmaletz_tiles_Tile.SIZE)); + } + ,followPath: function(dist,oneTile) { + if(dist > 0) { + this.startPath = true; + } + while(dist > 0) { + var tx = this.path.x * com_davidmaletz_tiles_Tile.SIZE + (this._width >> 1); + var ty = Math.floor((this.path.y + 1) * com_davidmaletz_tiles_Tile.SIZE - this._height * 0.5); + var rx = Math.round(this.get_x()); + var ry = Math.round(this.get_y()); + var area = this.player.getCurrentArea(); + var s = area.getStructureInTile(this.path.x,this.path.y); + if(s != null) { + ty += s.info.playerY; + } + var dx = tx - rx; + var eq = 0; + if(area != null) { + dx = area.adjustDx(dx); + } + var adx = com_fancyfish_faeng_common_Utils.abs(dx); + if(adx > 0) { + this.set_scaleX(dx > 0 ? -1 : 1); + if(adx > dist) { + adx = dist; + } else { + ++eq; + } + dist -= adx; + var _g = this; + _g.set_x(_g.get_x() - adx * this.get_scaleX()); + } else { + ++eq; + } + var dy = com_fancyfish_faeng_common_Utils.abs(ty - ry); + if(dy > 0) { + if(dy > dist) { + dy = dist; + } else { + ++eq; + } + dist -= dy; + var _g1 = this; + _g1.set_y(_g1.get_y() + dy * (ty > ry ? 1 : -1)); + } else { + ++eq; + } + if(eq == 2) { + this.path = this.path.parent; + if(this.path != null) { + this.lightTile(this.path.x,this.path.y); + } + if(oneTile || this.path == null) { + break; + } + } + } + if(this.path == null) { + this.playAnimation(this.getIdle(),false,$bind(this,this.playIdle)); + } + return dist; + } + ,getDist: function(dist,frames) { + if(dist > 0) { + return dist; + } else { + var d = (this.path == null ? 1.5 : Math.max(this.path.depth / 4,1)) * frames; + var dist1 = Math.floor(d); + this.partial += d - dist1; + if(this.partial >= 1) { + ++dist1; + this.partial -= 1; + } + return dist1; + } + } + ,_advanceFrame: function(frames) { + com_davidmaletz_mining_familiar_Familiar.prototype.advanceFrame.call(this,frames); + } + ,riding: null + ,advanceFrame: function(frames) { + var area = this.player.getCurrentArea(); + if(area == null) { + this.advanceTracks(frames); + return; + } + var e; + var r = this.player.renderer; + var p; + var tmp; + var tmp1; + if(r != null && this.player.isFlying()) { + e = this.player.getFlight(); + tmp1 = e != null; + } else { + tmp1 = false; + } + if(tmp1) { + p = this.type.getRide(e.id); + tmp = p != null; + } else { + tmp = false; + } + if(tmp) { + var s = (js_Boot.__cast(r , com_davidmaletz_mining_renderer_PlayerRendererBase)).sprite; + this.set_x(r.get_x() + (p.x + s.get_x()) * r.get_scaleX()); + this.set_y(r.get_y() + p.y + s.get_y()); + this.set_scaleX(r.get_scaleX()); + this.playAnimation(this.getIdle(),true); + com_davidmaletz_mining_familiar_Familiar.prototype.advanceFrame.call(this,frames); + this.riding = true; + return; + } + if(this.riding) { + this.riding = false; + this.set_x(this.player.getVCenterX()); + this.set_y(this.getSpawnY()); + this.playIdle(this); + } + if(!this.hasControl()) { + com_davidmaletz_mining_familiar_Familiar.prototype.advanceFrame.call(this,frames); + return; + } + var dist = -1; + if(this.animation == this.getAnim("idle") || this.animation == this.getAnim("swim.idle") || this.animation == this.getAnim("walk") || this.animation == this.getAnim("swim")) { + var b = this.hasAttack() && this.playerDistance() < 144 ? this.getClosest(128) : null; + var r1; + var tmp2; + if(b != null && b.object != null && this.canAttack(b.object)) { + r1 = this.getAttackRange(); + tmp2 = r1 >= 0; + } else { + tmp2 = false; + } + if(tmp2) { + var maxDist = Math.round(this.getXDistance(b.bounds)); + var o = b.object; + dist = this.getDist(dist,frames); + if(this.path != null && this.startPath) { + var n = this.path; + dist = this.followPath(dist,true); + if(this.path == n) { + com_davidmaletz_mining_familiar_Familiar.prototype.advanceFrame.call(this,frames); + return; + } + this.path = null; + } + if(maxDist <= dist + r1 && this.doAttack(o,maxDist)) { + if(maxDist == 0) { + return; + } + } else if(this.animation == this.getAnim("idle") || this.animation == this.getAnim("swim.idle")) { + this.loopWalk(null); + } + dist = com_fancyfish_faeng_common_Utils.min(dist,maxDist); + var _g = this; + _g.set_x(_g.get_x() - dist * com_fancyfish_faeng_common_Utils.sign(this.get_scaleX())); + this.lightCurrentTile(); + com_davidmaletz_mining_familiar_Familiar.prototype.advanceFrame.call(this,frames); + return; + } else if((this.animation == this.getAnim("walk") || this.animation == this.getAnim("swim")) && this.path == null) { + this.playAnimation(this.getIdle(),false,$bind(this,this.playIdle)); + } + if((this.animation == this.getAnim("idle") || this.animation == this.getAnim("swim.idle")) && this.playerDistance() > com_davidmaletz_tiles_Tile.SIZE * 4) { + this.path = null; + if(!this.pathfind()) { + this.player.summonFamiliar(); + } + } else if(this.path != null) { + var n1 = this.path; + dist = this.followPath(this.getDist(dist,frames),true); + if(this.path != n1) { + while(n1.parent != null) n1 = n1.parent; + if(com_davidmaletz_mining_npc_DefaultNPCIdle.adjustLoop(com_fancyfish_faeng_common_Utils.abs(n1.x - this.player.getVTileX()),area.getLoop()) + com_fancyfish_faeng_common_Utils.abs(n1.y - this.player.getVTileY()) > 1) { + this.path = null; + if(!this.pathfind()) { + this.playAnimation(this.getIdle(),false,$bind(this,this.playIdle)); + } + } + } + } + if(this.path != null) { + this.followPath(this.getDist(dist,frames),false); + } + } + com_davidmaletz_mining_familiar_Familiar.prototype.advanceFrame.call(this,frames); + } + ,canPlace: function() { + var e; + var r = this.player.renderer; + var tmp; + var tmp1; + if(r != null && this.player.isFlying()) { + e = this.player.getFlight(); + tmp1 = e != null; + } else { + tmp1 = false; + } + if(tmp1) { + tmp = this.type.getRide(e.id) != null; + } else { + tmp = false; + } + if(tmp) { + return true; + } else { + return com_davidmaletz_mining_familiar_Familiar.prototype.canPlace.call(this); + } + } + ,setPos: function(x,y,s,flags,frames) { + if(!this.riding) { + com_davidmaletz_mining_familiar_Familiar.prototype.setPos.call(this,x,y,s,flags,frames); + } + } + ,__class__: com_davidmaletz_mining_familiar_Ground +}); +var com_davidmaletz_mining_familiar_Flying = function(i,p,xml,type) { + this.flight_ct = 2; + this.hasBreath = false; + this.isWalking = false; + this.bounceHeight = 1; + this.alignCenter = type.xml.get("alignCenter") == "true"; + com_davidmaletz_mining_familiar_Ground.call(this,i,p,xml,type); + this.yPos = Math.round(this.get_y()); + this.flight_distance = 4 * com_davidmaletz_tiles_Tile.SIZE; + if(type.xml.exists("bounceHeight")) { + this.bounceHeight = com_davidmaletz_mining_Main.parseFloat(type.xml.get("bounceHeight")); + } + this.remaining = 0; + this.nextFlight(true,true); + var _g = 0; + var _g1 = this.attacks; + while(_g < _g1.length) { + var a = _g1[_g]; + ++_g; + if(a.type == "breath") { + this.hasBreath = true; + break; + } + } +}; +$hxClasses["com.davidmaletz.mining.familiar.Flying"] = com_davidmaletz_mining_familiar_Flying; +com_davidmaletz_mining_familiar_Flying.__name__ = ["com","davidmaletz","mining","familiar","Flying"]; +com_davidmaletz_mining_familiar_Flying.__super__ = com_davidmaletz_mining_familiar_Ground; +com_davidmaletz_mining_familiar_Flying.prototype = $extend(com_davidmaletz_mining_familiar_Ground.prototype,{ + yPos: null + ,remaining: null + ,flight_distance: null + ,bounceHeight: null + ,isWalking: null + ,hasBreath: null + ,flight_ct: null + ,alignCenter: null + ,getTileBlockId: function(tx,ty) { + var tile = com_davidmaletz_mining_familiar_Ground.prototype.getTileBlockId.call(this,tx,ty); + if(tile != -1) { + return tile; + } + var area = this.player.getCurrentArea(); + if(area != null && area.emptyTile(tx,ty + 1) && !area.canFly() && this.type.xml.get("canFlyAnywhere") != "true") { + return 999999; + } else { + return -1; + } + } + ,getTargetY: function() { + if(this.isWalking || this.alignCenter) { + return com_davidmaletz_mining_familiar_Ground.prototype.getTargetY.call(this); + } else { + return com_davidmaletz_mining_familiar_Ground.prototype.getTargetY.call(this) - this._height; + } + } + ,getSpawnY: function() { + return this.getTargetY(); + } + ,canStandOn: function(t) { + if(this.isWalking) { + return com_davidmaletz_mining_familiar_Ground.prototype.canStandOn.call(this,t); + } else { + return true; + } + } + ,playIdle: function(p) { + if(!this.hasControl()) { + if(!this.isWalking) { + this.playAnimation(this.getFlightAnim(),true); + } else { + com_davidmaletz_mining_familiar_Ground.prototype.playIdle.call(this,p); + } + return; + } + if(this.isWalking) { + if(this.playerDistance() < 144 && this.canFly()) { + this.isWalking = false; + this.yPos = Math.round(this.get_y()); + this.nextFlight(); + this.flight_ct = 2; + } else { + com_davidmaletz_mining_familiar_Ground.prototype.playIdle.call(this,p); + } + } else { + this.nextFlight(false); + this.flight_ct = 2; + } + } + ,loopWalk: function(p) { + if(p != null && this.playerDistance() < 144 && this.canFly()) { + this.isWalking = false; + this.yPos = Math.round(this.get_y()); + this.nextFlight(); + this.flight_ct = 2; + } else { + com_davidmaletz_mining_familiar_Ground.prototype.playWalk.call(this,p); + this.onComplete = $bind(this,this.loopWalk); + } + } + ,playWalk: function(p) { + if(!this.isWalking) { + this.playAnimation(this.getFlightAnim(),true); + } else { + com_davidmaletz_mining_familiar_Ground.prototype.playWalk.call(this,p); + } + } + ,getRectangle: function() { + if(this.isWalking) { + return com_davidmaletz_mining_familiar_Ground.prototype.getRectangle.call(this); + } + if(this.yPos == null) { + this.yPos = Math.round(this.get_y()); + } + com_davidmaletz_mining_world_BaseObject.rectangle.setTo(this.get_x() - this._width * 0.5,this.yPos - this._height * 0.5,this._width,this._height * 0.5); + return com_davidmaletz_mining_world_BaseObject.rectangle; + } + ,canFly: function() { + var w = this.isWalking; + this.isWalking = false; + var _y = this.yPos; + this.yPos = Math.round(this.get_y()); + var sx = this.get_scaleX(); + if(Math.abs(this.get_x() - this.player.getVCenterX()) < this._width) { + this.set_scaleX(-this.get_scaleX()); + } else { + this.set_scaleX(this.get_x() > this.player.getVCenterX() ? 1 : -1); + } + if(this.getClosest(this._width + com_davidmaletz_tiles_Tile.SIZE,1,false,true,null,this._height >> 1) != null) { + this.set_scaleX(sx); + this.yPos = _y; + this.isWalking = w; + return false; + } + var dy = com_fancyfish_faeng_common_Utils.sign(com_davidmaletz_mining_familiar_Ground.prototype.getTargetY.call(this) - this._height - this.yPos); + this.yPos += dy; + var ret = this.getClosest(this._width + com_davidmaletz_tiles_Tile.SIZE,1,false,true,null,this._height >> 1) == null; + this.set_scaleX(sx); + this.yPos -= dy; + this.yPos = _y; + this.isWalking = w; + return ret; + } + ,nextFlight: function(flip,adjustY) { + if(adjustY == null) { + adjustY = false; + } + if(flip == null) { + flip = true; + } + if(!this.hasControl()) { + return; + } + var sx = this.get_scaleX(); + this.remaining += this.flight_distance; + this.flight_ct--; + if(flip && Math.abs(this.get_x() - this.player.getVCenterX()) < this._width) { + this.set_scaleX(-this.get_scaleX()); + } else { + this.set_scaleX(this.get_x() > this.player.getVCenterX() ? 1 : -1); + } + this.playAnimation(this.getFlightAnim(),true); + if(this.getClosest(this._width + com_davidmaletz_tiles_Tile.SIZE,1,false,true,null,this._height >> 1) != null && !this.walk(adjustY)) { + this.set_scaleX(-sx); + if(this.getClosest(this._width + com_davidmaletz_tiles_Tile.SIZE,1,false,true,null,this._height >> 1) != null) { + this.set_scaleX(sx); + } + } + } + ,canWalk: function() { + var w = this.isWalking; + this.isWalking = true; + var ret = com_davidmaletz_mining_familiar_Ground.prototype.canPlace.call(this); + this.isWalking = w; + return ret; + } + ,walk: function(adjustY) { + if(adjustY == null) { + adjustY = false; + } + if(adjustY) { + this.set_y(this.yPos = com_davidmaletz_mining_familiar_Ground.prototype.getTargetY.call(this)); + } + if(this.type.xml.get("canWalk") == "true" && this.canWalk()) { + this.set_y(this.yPos); + this.isWalking = true; + com_davidmaletz_mining_familiar_Ground.prototype.playIdle.call(this,this); + return true; + } else { + return false; + } + } + ,canPlace: function() { + if(this.isWalking) { + return com_davidmaletz_mining_familiar_Ground.prototype.canPlace.call(this); + } else { + return this.getClosest(this._width,1,false,true,null,this._height >> 1) == null; + } + } + ,adjustY: function(dist,ty) { + if(ty != this.yPos) { + var dy = ty - this.yPos; + if(com_fancyfish_faeng_common_Utils.abs(dy) > 4) { + dy >>= 2; + } else { + dy = com_fancyfish_faeng_common_Utils.sign(dy); + } + var b = this.getRectangle(); + if(dy < 0) { + var _g = b; + _g.set_top(_g.get_top() + dy); + } else { + var _g1 = b; + _g1.set_bottom(_g1.get_bottom() + dy); + } + if(this._getClosest(b,dist + this._width,1,false,true,null,this._height >> 1) == null) { + this.yPos += dy; + return ty == this.yPos; + } else { + return !this.walk(); + } + } else { + return true; + } + } + ,getBlocker: function(attack_range) { + if(attack_range >= 0 && this.hasAttack() && (this.type.xml.get("standAttack") != "true" || this.canWalk()) && this.playerDistance() < 144) { + return this.getClosest(com_fancyfish_faeng_common_Utils.max(attack_range - com_davidmaletz_tiles_Tile.SIZE,this.flight_distance),1,true,false,null,com_fancyfish_faeng_common_Utils.max(attack_range - com_davidmaletz_tiles_Tile.SIZE >> 1,this.flight_distance)); + } else { + return null; + } + } + ,hasEnemy: function() { + var b = this.getBlocker(this.getAttackRange()); + if(b != null && b.object != null) { + return this.canAttack(b.object); + } else { + return false; + } + } + ,getFlightAnim: function() { + return this.getAnim("fly"); + } + ,canLand: function() { + return true; + } + ,advanceFrame: function(frames) { + if(!this.hasControl()) { + this._advanceFrame(frames); + return; + } + if(this.player.getCurrentArea() == null) { + this.advanceTracks(frames); + return; + } + if(this.isWalking) { + com_davidmaletz_mining_familiar_Ground.prototype.advanceFrame.call(this,frames); + return; + } + if(this.animation == this.getFlightAnim()) { + var d = Math.max((this.get_x() - this.player.getVCenterX()) * this.get_scaleX() / (0.5 * this.flight_distance),1) * frames; + var dist = Math.floor(d); + this.partial += d - dist; + if(this.partial >= 1) { + ++dist; + this.partial -= 1; + } + var b = this.getClosest(dist + this._width,1,false,true,null,this._height >> 1); + if(b != null) { + var maxDist = Math.round(Math.max(0,this.getXDistance(b.bounds) - this._width)); + if(maxDist < dist) { + dist = maxDist; + this.remaining = 0; + } + this.adjustY(dist,this.getTargetY()); + } else { + var attack_range = this.getAttackRange(); + b = this.getBlocker(attack_range); + if(b != null && b.object != null) { + var maxDist1 = Math.round(this.getXDistance(b.bounds)); + var o = b.object; + this.flight_ct = 2; + if(attack_range >= 0 && this.canAttack(o)) { + var h = this._height; + if(this.type.xml.get("standAttack") != "true") { + h *= 0.5; + } + var ty = Math.round(this.alignCenter ? o.getCenterY() : o.yTile + com_davidmaletz_tiles_Tile.SIZE - 0.5 * h); + if(maxDist1 <= dist + attack_range && (this.hasBreath || this.adjustY(dist,ty))) { + if(this.doAttack(o,maxDist1)) { + this.set_y(this.yPos); + if(maxDist1 == 0) { + return; + } + } else { + maxDist1 = dist; + this.remaining = this.flight_distance; + } + } else { + this.remaining = this.flight_distance; + } + dist = com_fancyfish_faeng_common_Utils.min(dist,maxDist1); + } + } else if(this.canLand() && b == null && this.currentAttack == null && this.flight_ct < 0 && this.get_scaleX() == (this.player.xPos + this.player._width * 0.5 < this.get_x() ? 1 : -1) && this.player.enterTileWalk(this.player.getVTileX(),this.player.getVTileY())) { + var b1 = this.player.getBounds(); + var dist1 = Math.round(this.getXDistance(b1)); + var ty1 = Math.round(this.player.getVCenterY() + com_davidmaletz_tiles_Tile.SIZE * 0.5 - 0.5 * this._height); + var rect = this.getRectangle(); + var tile_x = Math.floor((rect.x + rect.width * 0.5) / com_davidmaletz_tiles_Tile.SIZE); + var tile_y = Math.floor((rect.get_bottom() - 1) / com_davidmaletz_tiles_Tile.SIZE); + var t = this.player.getCurrentArea().getTile(tile_x,tile_y + 1,0); + if(t == null) { + t = this.player.getCurrentArea().getTile(tile_x,tile_y + 1,3); + } + if(this.adjustY(dist1,ty1) && dist1 < com_davidmaletz_tiles_Tile.SIZE && com_davidmaletz_mining_familiar_Ground.prototype.canStandOn.call(this,t)) { + this.playAnimation(this.getAnim("idle"),true); + } + this.remaining = this.flight_distance; + } else { + this.adjustY(dist,this.getTargetY()); + } + } + this.set_y(this.yPos + Math.round(this.bounceHeight * Math.sin(this.getAnimFrame() * Math.PI * 2 / this.getMaxFrame()) * this._height * 0.25)); + this.remaining -= frames; + var _g = this; + _g.set_x(_g.get_x() - dist * this.get_scaleX()); + if(this.remaining < 0) { + this.nextFlight(); + } + } else if(this.animation == this.getAnim("idle")) { + if(this.playerDistance() > com_davidmaletz_tiles_Tile.SIZE * 4 || this.hasEnemy()) { + this.nextFlight(); + this.flight_ct = 2; + } + } + this._advanceFrame(frames); + } + ,__class__: com_davidmaletz_mining_familiar_Flying +}); +var com_davidmaletz_mining_familiar_Spawn = function(xml,efficiency) { + if(efficiency == null) { + efficiency = 1; + } + this.item = xml.get("item"); + this.cooldown = com_davidmaletz_mining_Main.parseFloat(xml.get("cooldown")); + this.cost = Math.round((xml.exists("cost") ? com_davidmaletz_mining_Main.parseInt(xml.get("cost")) : 0) * efficiency); + this.animation = xml.get("animation"); +}; +$hxClasses["com.davidmaletz.mining.familiar.Spawn"] = com_davidmaletz_mining_familiar_Spawn; +com_davidmaletz_mining_familiar_Spawn.__name__ = ["com","davidmaletz","mining","familiar","Spawn"]; +com_davidmaletz_mining_familiar_Spawn.prototype = { + item: null + ,cooldown: null + ,cost: null + ,animation: null + ,__class__: com_davidmaletz_mining_familiar_Spawn +}; +var com_davidmaletz_mining_familiar_Swimming = function(i,p,xml,type) { + com_davidmaletz_mining_familiar_Flying.call(this,i,p,xml,type); +}; +$hxClasses["com.davidmaletz.mining.familiar.Swimming"] = com_davidmaletz_mining_familiar_Swimming; +com_davidmaletz_mining_familiar_Swimming.__name__ = ["com","davidmaletz","mining","familiar","Swimming"]; +com_davidmaletz_mining_familiar_Swimming.__super__ = com_davidmaletz_mining_familiar_Flying; +com_davidmaletz_mining_familiar_Swimming.prototype = $extend(com_davidmaletz_mining_familiar_Flying.prototype,{ + canEnterTile: function(x,y) { + if(y <= this.max_depth) { + return this.player.getCurrentArea().isWater(x,y); + } else { + return false; + } + } + ,canLand: function() { + return false; + } + ,getFlightAnim: function() { + return this.getAnim("swim"); + } + ,playerDistance: function() { + if(this.player.isUnderwater()) { + return com_davidmaletz_mining_familiar_Flying.prototype.playerDistance.call(this); + } else { + return Infinity; + } + } + ,__class__: com_davidmaletz_mining_familiar_Swimming +}); +var com_davidmaletz_mining_item_Action = function(id,name,e) { + this.id = id; + this.name = name == null ? id : name; + this.xml = e; +}; +$hxClasses["com.davidmaletz.mining.item.Action"] = com_davidmaletz_mining_item_Action; +com_davidmaletz_mining_item_Action.__name__ = ["com","davidmaletz","mining","item","Action"]; +com_davidmaletz_mining_item_Action.showWarning = function(m) { + if(com_davidmaletz_mining_item_Action.warning != null && com_davidmaletz_mining_item_Action.warning.stage != null) { + return; + } + var d = com_fancyfish_faeng_common_Utils.max(20,m.get().length); + com_davidmaletz_faengfl_adv_sound_Sound.play("warning"); + com_davidmaletz_mining_item_Action.warning = new com_davidmaletz_faengfl_ui_Popup(128.,36.,0,m,16720418,-16777216,20,d,20,null,true,true); +}; +com_davidmaletz_mining_item_Action.showMessage = function(m) { + new com_davidmaletz_faengfl_ui_Popup(128.,36.,0,m); +}; +com_davidmaletz_mining_item_Action.placeTrap = function(p,item,trap,e) { + var area = p.getCurrentArea(); + if(area.hasObjectInTile(p.get_tile_x(),p.get_tile_y(),5)) { + com_davidmaletz_mining_item_Action.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","place_overlap")); + return false; + } else { + var map = new haxe_ds_StringMap(); + map.set("{item}",item.getName()); + new com_davidmaletz_faengfl_ui_Popup(128.,36.,0,new com_fancyfish_faeng_common_mutable_MutableTemplate(com_fancyfish_faeng_common_Lang.getText("common","placed"),map)); + com_davidmaletz_faengfl_adv_sound_Sound.play(com_davidmaletz_mining_item_Action.resolve(item,e,"place")); + var t = trap.create(p.get_tile_x() * com_davidmaletz_tiles_Tile.SIZE,p.get_tile_y() * com_davidmaletz_tiles_Tile.SIZE); + (js_Boot.__cast(t , com_davidmaletz_mining_world_TrapObject)).trapping = p.stats.getInt("trap"); + area.addObject(t); + return true; + } +}; +com_davidmaletz_mining_item_Action.hasObjectInTile = function(area,x,y) { + var o = area.getObjectsInTile(x,y); + while(o.hasNext()) { + var o1 = o.next(); + if(Std["is"](o1,com_davidmaletz_mining_world_ItemObject)) { + return true; + } + } + return false; +}; +com_davidmaletz_mining_item_Action.placeObject = function(p,item,value,name,window,object,itemvalue,e) { + var t = com_davidmaletz_tiles_Tile.get(object.tile); + var sx = p.get_tile_x(); + var ex = p.get_tile_x() + 1; + var sy = p.get_tile_y(); + var ey = p.get_tile_y() + 1; + if(t != null) { + var w = Math.ceil((t.getWidth() / com_davidmaletz_tiles_Tile.SIZE - 1) * 0.5); + sx -= w; + ex += w; + sy -= Math.ceil(t.getHeight() / com_davidmaletz_tiles_Tile.SIZE - 1); + } + var _g1 = sy; + var _g = ey; + while(_g1 < _g) { + var y = _g1++; + var _g3 = sx; + var _g2 = ex; + while(_g3 < _g2) { + var x = _g3++; + if(item.xml.get("underground") != "true" && !p.area.emptyTile(x,y)) { + com_davidmaletz_mining_item_Action.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","place_surface")); + return false; + } + if(com_davidmaletz_mining_item_Action.hasObjectInTile(p.area,x,y)) { + com_davidmaletz_mining_item_Action.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","place_overlap")); + return false; + } + if(p.area.getTileId(x,y,0) != -1) { + com_davidmaletz_mining_item_Action.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","place_no_room")); + return false; + } + } + } + var doPlace = function(o) { + var map = new haxe_ds_StringMap(); + map.set("{item}",item.getName()); + new com_davidmaletz_faengfl_ui_Popup(128.,36.,0,new com_fancyfish_faeng_common_mutable_MutableTemplate(com_fancyfish_faeng_common_Lang.getText("common","placed"),map)); + com_davidmaletz_faengfl_adv_sound_Sound.play(com_davidmaletz_mining_item_Action.resolve(item,e,"place")); + p.area.addObject(o); + com_davidmaletz_mining_item_Action.updatePlayer(p,window); + if(itemvalue != null) { + itemvalue.remove(p); + } else { + p.inventory.addItems(item,-1,value,name); + } + }; + var cost = com_davidmaletz_mining_item_Action.getPlantCost(e,"placeCost"); + if(cost != null && cost.length > 0) { + var c = com_davidmaletz_mining_Main.getContainer(); + var b = com_fancyfish_faeng_common_Lang.getText("structure","place_cost").get(); + var b1 = item.getDisplay(name,false); + var b2 = p.getInv(true); + var f = $bind(object,object.place); + var x1 = p.get_tile_x() * com_davidmaletz_tiles_Tile.SIZE; + var y1 = p.get_tile_y() * com_davidmaletz_tiles_Tile.SIZE; + var a1 = value; + var a2 = doPlace; + var b3 = function() { + f(x1,y1,a1,a2); + }; + var b4 = com_fancyfish_faeng_common_Lang.getText("common","yes"); + var b5 = new com_davidmaletz_mining_ui_BuildPrompt(b,c,p,b1,b2,cost,b3,null,b4); + c.addDisplay(b5,2); + return false; + } else { + object.place(p.get_tile_x() * com_davidmaletz_tiles_Tile.SIZE,p.get_tile_y() * com_davidmaletz_tiles_Tile.SIZE,value,doPlace); + } + return false; +}; +com_davidmaletz_mining_item_Action.doPlace = function(p,item,value,name,window,itemvalue,e) { + var place = item.getPlace(name); + if(place == null) { + return false; + } + var a = p.getCurrentArea(); + if(e.get("on_air") != "true" && a.emptyTile(p.get_tile_x(),p.get_tile_y() + 1) && (!a.isWater(p.get_tile_x(),p.get_tile_y()) || e.get("place_floating") == "false") || a.getTileString(p.get_tile_x(),p.get_tile_y(),3) == "no_place" || a.isBlockVehicle(p.get_tile_x(),p.get_tile_y())) { + com_davidmaletz_mining_item_Action.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","no_place")); + return false; + } else if(Std["is"](place,com_davidmaletz_mining_world_ItemObjectInfo)) { + var o = js_Boot.__cast(place , com_davidmaletz_mining_world_ItemObjectInfo); + if(o.type == "trap") { + return com_davidmaletz_mining_item_Action.placeTrap(p,item,place,e); + } else { + return com_davidmaletz_mining_item_Action.placeObject(p,item,value,name,window,o,itemvalue,e); + } + } else { + com_davidmaletz_mining_item_Action.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","no_place")); + return false; + } +}; +com_davidmaletz_mining_item_Action.updatePlayer = function(p,window) { + p.overlapChanged(); + if(window != null && window.parent != null) { + window.parent.setChildIndex(window,window.parent.get_numChildren() - 1); + } +}; +com_davidmaletz_mining_item_Action.onTransform = function(p,item,old,itemvalue,onComplete,ct) { + if(ct <= 0) { + return; + } + if(itemvalue != null) { + itemvalue.remove(p); + } else if(!p.inventory.addItems(old.info,-ct,old.value,old.getNameStr())) { + return; + } + p.addItems(item.item,ct,item.value,item.name); + if(onComplete != null) { + onComplete(ct); + } +}; +com_davidmaletz_mining_item_Action.transform = function(p,from,value,name,to,itemvalue,onComplete) { + var map = new haxe_ds_StringMap(); + map.set("{item}","[item=" + from.id + "]"); + map.set("{into}","[item=" + to.item.id + "]"); + var m = new com_fancyfish_faeng_common_mutable_MutableTemplateStatic(com_fancyfish_faeng_common_Lang.getText("common","transform"),map); + var c = com_davidmaletz_mining_Main.getContainer(); + var i; + var ct = 1; + if(itemvalue == null) { + i = p.inventory.selectItem(from,value,name); + ct = p.inventory.getItemValueCount(from,value,name); + } else { + i = itemvalue.getItem(p); + } + if(i != null) { + var p1 = p; + var a1 = to; + var a2 = i; + var a3 = itemvalue; + var a4 = onComplete; + c.addDisplay(new com_davidmaletz_mining_ui_ItemCountPrompt(c,i,ct,m,1,function(ct1) { + com_davidmaletz_mining_item_Action.onTransform(p1,a1,a2,a3,a4,ct1); + }),2); + } +}; +com_davidmaletz_mining_item_Action.renameItem = function(p,item,value,name,itemvalue,new_name) { + if(new_name == null || new_name.length == 0) { + return; + } + var n = (name == null ? "&" : HxOverrides.substr(name,0,name.indexOf("&") + 1)) + new_name; + if(itemvalue != null) { + itemvalue.setName(p,n); + } else { + p.inventory.changeName(item,value,name,n); + } +}; +com_davidmaletz_mining_item_Action.isGroup = function(group,item) { + if(item.id != group) { + return item.xml.get("group") == group; + } else { + return true; + } +}; +com_davidmaletz_mining_item_Action.isProjectile = function(item,i) { + var w = i.xml.get("with"); + if(w != null) { + return com_davidmaletz_mining_item_Action.isGroup(w,item); + } else { + return false; + } +}; +com_davidmaletz_mining_item_Action.getItemGroup = function(p,group) { + var w = p.equipment.getItem("weapon"); + if(w != null && com_davidmaletz_mining_item_Action.isGroup(group,w.info)) { + return w; + } + var w1 = p.equipment.getItem("shield"); + if(w1 != null && com_davidmaletz_mining_item_Action.isGroup(group,w1.info)) { + return w1; + } + var a1 = group; + var i = function(a2) { + return com_davidmaletz_mining_item_Action.isGroup(a1,a2); + }; + var i1 = p.inventory.getItems(i); + if(i1.hasNext()) { + return p.inventory.selectItem(i1.next().item,0,null); + } else { + return null; + } +}; +com_davidmaletz_mining_item_Action.setProjectile = function(itemvalue,p,i) { + if(i != null) { + var item = itemvalue.getItem(p); + itemvalue.setName(p,com_davidmaletz_mining_item_ItemInfo.setParameter(item.getNameStr(),"p",i.item == com_davidmaletz_mining_item_ItemInfo.get(item.info.xml.get("projectile")) ? null : i.item.id)); + } +}; +com_davidmaletz_mining_item_Action.hold = function(s) { + var s1 = s; + var tmp = function() { + com_davidmaletz_mining_item_Action.fade(s1); + }; + s.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0.5),30,tmp); +}; +com_davidmaletz_mining_item_Action.fade = function(s) { + var d = s; + var tmp = function() { + com_davidmaletz_faengfl_FaengFL.remove(d); + }; + s.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),10,tmp); +}; +com_davidmaletz_mining_item_Action.getStructAnim = function(s) { + var a = s.getAnim("blueprint"); + if(StringTools.endsWith(a,".blueprint")) { + return a; + } + return s.getAnim(s.xml.get("powered") == "true" || s.xml.get("type") == "powerplant" ? "off" : "idle"); +}; +com_davidmaletz_mining_item_Action._dismantle = function(p,wnd,s,xml) { + if(s.area == null) { + return; + } + s.area.removeObjects(s.getBounds(),1,0.5); + s.onDismantle(p); + com_davidmaletz_faengfl_adv_sound_Sound.play("build"); + s.area.removeStructure(s,p); + com_davidmaletz_mining_Main.runEvent("dismantle",p,xml,s); + com_davidmaletz_mining_item_Action.updatePlayer(p,wnd); + if(wnd != null) { + wnd.close(); + } +}; +com_davidmaletz_mining_item_Action.dismantle = function(p,wnd) { + var s = p.getCurrentStructure(true); + if(s == null) { + com_davidmaletz_mining_item_Action.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","no_structure")); + return; + } + var i = p.inventory.getItems(); + while(i.hasNext()) { + var i1 = i.next(); + var xml = i1.item.getActionXml("build"); + var map = null; + if(xml == null) { + xml = i1.item.getActionXml("upgrade"); + } + if(xml != null) { + map = new haxe_ds_StringMap(); + if(xml.exists("structure")) { + map.set(xml.get("structure"),true); + } + if(xml.exists("alternate")) { + map.set(xml.get("alternate"),true); + } + var e = xml.elementsNamed("alternate"); + while(e.hasNext()) { + var e1 = e.next(); + map.set(e1.get("id"),true); + } + } + if(xml != null && map.exists(s.info.id) && xml.get("dismantle") != "false") { + var reqs = []; + var e2 = xml.elements(); + while(e2.hasNext()) { + var e3 = e2.next(); + var r = com_davidmaletz_mining_npc_Requirement.fromXML(e3.xml); + if(r != null) { + reqs.push(r); + } + } + var c = com_davidmaletz_mining_Main.getContainer(); + var d = new com_davidmaletz_mining_ui_DismantlePrompt(com_fancyfish_faeng_common_Lang.getText("structure","dismantle").get(),c,p,s.info.getName().get(),p.storehouseInventory,reqs,(function(a2,s1,a1,p1) { + return function() { + com_davidmaletz_mining_item_Action._dismantle(p1[0],a1[0],s1[0],a2[0]); + }; + })([i1.item.xml],[s],[wnd],[p])); + d.confirm = com_fancyfish_faeng_common_Lang.getTextFromTitle(s.info.xml.get("confirmDismantle")); + c.addDisplay(d,2); + return; + } + } + if(Std["is"](s,com_davidmaletz_mining_item_Crop) || com_fancyfish_faeng_common_Lang.getTextFromTitle(s.info.xml.get("removeButton")) != null) { + s.removeStructure(p); + return; + } + var m = com_fancyfish_faeng_common_Lang.getTextFromTitle(s.info.xml.get("dismantleWarning")); + com_davidmaletz_mining_item_Action.showWarning(m == null ? com_fancyfish_faeng_common_Lang.getText("warning","no_blueprint") : m); +}; +com_davidmaletz_mining_item_Action.showPlaceWarning = function(p,t,anim,x,y,m) { + com_davidmaletz_mining_item_Action.showWarning(m); + if(p.getCurrentArea().renderer != null) { + var s = new com_davidmaletz_tiles_render_PlayAnimation(t,anim,10,true); + s.set_x(x); + var th = t.getTileHeight(0,0); + if(th == 0) { + th = com_davidmaletz_tiles_Tile.SIZE; + } + s.set_y(y + com_davidmaletz_tiles_Tile.SIZE - th); + com_davidmaletz_faengfl_TextSprite.setColor(s,16737894); + s.set_alpha(0); + var s1 = s; + var tmp = function() { + com_davidmaletz_mining_item_Action.hold(s1); + }; + s.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0.5),10,tmp); + p.getCurrentArea().renderer.addChild(s); + } +}; +com_davidmaletz_mining_item_Action.getStrucOffX = function(s) { + return (s.xml.get("centerX") == "false" ? 0 : Math.round((s.width - s.tile.getTileWidth(0,0)) * 0.5)) + s.offsetX; +}; +com_davidmaletz_mining_item_Action.tryBuild = function(p,structure,e,onBuild) { + if(!com_davidmaletz_mining_Player.BLUEPRINT_PLACE) { + onBuild(); + } else { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_BuildPrompt(com_fancyfish_faeng_common_Lang.getText("structure","build").get(),c,p,structure.getName().get(),p.getInv(true),com_davidmaletz_mining_world_BlueprintObject.getReqs(e),onBuild),2); + } +}; +com_davidmaletz_mining_item_Action.cancelBuild = function(p,structure,e) { + if(com_davidmaletz_mining_Player.BLUEPRINT_PLACE) { + var _g = 0; + var _g1 = com_davidmaletz_mining_world_BlueprintObject.getReqs(e); + while(_g < _g1.length) { + var r = _g1[_g]; + ++_g; + r.addResources(p.storehouseInventory); + } + } +}; +com_davidmaletz_mining_item_Action.cancelPlant = function(p,i,value,name,cost) { + p.inventory.addItems(i,1,value,name); + if(cost != null) { + var _g = 0; + while(_g < cost.length) { + var r = cost[_g]; + ++_g; + r.addResources(p.storehouseInventory); + } + } +}; +com_davidmaletz_mining_item_Action.plant = function(p,tile,anim,i,value,name,doPlant,e,width,height,window,dx,dy,cost,killBush) { + if(killBush == null) { + killBush = true; + } + var b = new com_davidmaletz_mining_item__$Action_Plant(p,doPlant,e,width,height,i); + var x = Math.round(p.getVCenterX() - width * 0.5); + var y = p.getVTileY() * com_davidmaletz_tiles_Tile.SIZE; + var pt = b.canPlace(true,x,y,false); + if(pt != null) { + x = pt.x; + y = pt.y; + } + if(window != null) { + window.close(); + } + p.clearOverlap(); + var align = e.get("alignTile") == "true"; + if(align) { + x = Math.round(x / com_davidmaletz_tiles_Tile.SIZE) * com_davidmaletz_tiles_Tile.SIZE; + } + var f = $bind(b,b.canPlace); + var tmp = function(x1,y1,a2) { + return f(false,x1,y1,a2); + }; + var p1 = p; + var i1 = i; + var a1 = value; + var a21 = name; + var a3 = cost; + var tmp1 = function() { + com_davidmaletz_mining_item_Action.cancelPlant(p1,i1,a1,a21,a3); + }; + new com_davidmaletz_mining_item_BlueprintPos(p.getCurrentArea().renderer,tile,anim,align,x,y,width,height,dx,dy,tmp,$bind(b,b.onPlace),tmp1,$bind(p,p.overlapChanged),killBush); +}; +com_davidmaletz_mining_item_Action.parseFlags = function(e,plant) { + var flags = 0; + if(e.get("underground") == "true") { + flags |= 1; + } + if(e.get("onWater") == "true") { + flags |= 2; + } + if(e.get("underwater") == "true") { + flags |= 4; + } + if(plant) { + if(e.get("onGrass") != "false") { + flags |= 8; + } + } else if(e.get("onGrass") == "true") { + flags |= 8; + } + if(e.get("on_air") == "true") { + flags |= 16; + } + if(e.get("underwater") == "only") { + flags |= 32; + } + if(e.get("allowInterior") == "true") { + flags |= 64; + } + return flags; +}; +com_davidmaletz_mining_item_Action.doBuild = function(p,struc,item,e,window) { + var flags = com_davidmaletz_mining_item_Action.parseFlags(e,false); + var area = p.getCurrentArea(); + if(struc.xml.get("type") == "storehouse" && area.vehicle != null) { + com_davidmaletz_mining_item_Action.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","no_place")); + return; + } + if(struc.xml.get("type") == "storehouse" && struc.xml.get("main") == "true" && area.getMainStorehouse(false) != null || e.get("unique") == "true" && area.getStructureById(struc.id) != null) { + com_davidmaletz_mining_item_Action.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","one_structure")); + return; + } + var b = new com_davidmaletz_mining_item__$Action_Build(p,item,struc,flags,e); + var align = e.get("alignTile") == "true"; + var x = Math.round(p.getVCenterX() - struc.width * 0.5); + if(align) { + x = Math.round(x / com_davidmaletz_tiles_Tile.SIZE) * com_davidmaletz_tiles_Tile.SIZE; + } + var y = p.getVTileY() * com_davidmaletz_tiles_Tile.SIZE; + var pt = b.canPlace(true,x,y,false); + if(pt != null) { + x = pt.x; + y = pt.y; + } + com_davidmaletz_mining_item_Action.tryBuild(p,struc,e,function() { + if(window != null) { + window.close(); + } + p.clearOverlap(); + var area1 = area.renderer; + var struc1 = struc.tile; + var tmp = com_davidmaletz_mining_item_Action.getStructAnim(struc); + var struc2 = struc.width; + var struc3 = struc.height; + var tmp1 = com_davidmaletz_mining_item_Action.getStrucOffX(struc); + var f = $bind(b,b.canPlace); + var tmp2 = function(x1,y1,a2) { + return f(false,x1,y1,a2); + }; + var p1 = p; + var a1 = struc; + var e1 = e; + var tmp3 = function() { + com_davidmaletz_mining_item_Action.cancelBuild(p1,a1,e1); + }; + new com_davidmaletz_mining_item_BlueprintPos(area1,struc1,tmp,align,x,y,struc2,struc3,tmp1,struc.offsetY,tmp2,$bind(b,b.onPlace),tmp3,$bind(p,p.overlapChanged)); + }); +}; +com_davidmaletz_mining_item_Action._placeStructure = function(b,onPlace,p,x,y) { + onPlace(com_davidmaletz_mining_item_Action.doPlant(b,null,p,x,y)); +}; +com_davidmaletz_mining_item_Action.placeStructure = function(p,build,struc,e,vars,onPlace,onCancel,onClose,frames) { + if(frames == null) { + frames = 0; + } + if(!com_davidmaletz_mining_item_Action.checkAreaPlace(p,e) || !com_davidmaletz_mining_item__$Action_AbstractBuild.checkAreaConstraints(p,e)) { + return; + } + var area = p.getCurrentArea(); + if(area != null && struc != null && area.renderer != null) { + var plant = Std["is"](build,com_davidmaletz_mining_item_CropInfo); + var b = build; + var a1 = onPlace; + var func = function(p1,x,y) { + com_davidmaletz_mining_item_Action._placeStructure(b,a1,p1,x,y); + }; + p.clearOverlap(); + var b1 = plant ? new com_davidmaletz_mining_item__$Action_Plant(p,func,e,struc.width,struc.height,null) : new com_davidmaletz_mining_item__$Action_SimpleBuild(p,func,null,struc,com_davidmaletz_mining_item_Action.parseFlags(e,false),e); + var align = e.get("alignTile") == "true"; + var x1 = Math.round(p.getVCenterX() - struc.width * 0.5); + var y1 = p.getVTileY() * com_davidmaletz_tiles_Tile.SIZE; + if(e.exists("x")) { + x1 = Math.round(com_davidmaletz_faengfl_EventHandler.execute(e.get("x"),vars) * com_davidmaletz_tiles_Tile.SIZE); + y1 = -com_davidmaletz_tiles_Tile.SIZE; + } + if(align) { + x1 = Math.round(x1 / com_davidmaletz_tiles_Tile.SIZE) * com_davidmaletz_tiles_Tile.SIZE; + } + if(e.exists("y")) { + y1 = Math.round(com_davidmaletz_faengfl_EventHandler.execute(e.get("y"),vars) * com_davidmaletz_tiles_Tile.SIZE); + } + var rx = null; + var ry = null; + if(e.exists("rangeX")) { + rx = Math.round(com_davidmaletz_faengfl_EventHandler.execute(e.get("rangeX"),vars) * com_davidmaletz_tiles_Tile.SIZE); + } + if(rx > 0) { + var pt = b1.canPlace(true,x1,y1,false); + if(pt != null) { + x1 = pt.x; + y1 = pt.y; + } + } + if(e.exists("rangeY")) { + ry = Math.round(com_davidmaletz_faengfl_EventHandler.execute(e.get("rangeY"),vars) * com_davidmaletz_tiles_Tile.SIZE); + } + var f = $bind(b1,b1.canPlace); + var tmp = function(x2,y2,a2) { + return f(false,x2,y2,a2); + }; + new com_davidmaletz_mining_item_BlueprintPos(area.renderer,struc.tile,com_davidmaletz_mining_item_Action.getStructAnim(struc),align,x1,y1,struc.width,struc.height,com_davidmaletz_mining_item_Action.getStrucOffX(struc),struc.offsetY,tmp,$bind(b1,b1.onPlace),onCancel,onClose,e.get("removeBushes") != "false",rx,ry,frames); + } +}; +com_davidmaletz_mining_item_Action.canPlaceStructure = function(p,struc,e,x,y,showError,plant) { + if(plant == null) { + plant = false; + } + if(showError == null) { + showError = true; + } + var area = p.getCurrentArea(); + if(area != null && struc != null && area.renderer != null) { + var b = plant ? new com_davidmaletz_mining_item__$Action_Plant(p,null,e,struc.width,struc.height,null) : new com_davidmaletz_mining_item__$Action_SimpleBuild(p,null,null,struc,com_davidmaletz_mining_item_Action.parseFlags(e,false),e); + var pt = b.canPlace(true,x,y,showError); + if(pt != null && pt.x == x) { + return pt.y == y; + } else { + return false; + } + } else { + return false; + } +}; +com_davidmaletz_mining_item_Action.upgrade = function(p,info,i,e,window) { + var s = p.getCurrentStructure(true); + var upgrade = e.get("upgrade"); + if(s == null || s.info.id != upgrade) { + com_davidmaletz_mining_item_Action.showPlaceWarning(p,info.tile,com_davidmaletz_mining_item_Action.getStructAnim(info),Math.round(p.getVCenterX() - info.width * 0.5),p.getVTileY() * com_davidmaletz_tiles_Tile.SIZE,com_fancyfish_faeng_common_Lang.getText("warning","no_upgrade")); + } else { + var x = Math.round(s.getCenterX() - info.width * 0.5); + if(e.get("alignTile") == "true") { + x = Math.round(x / com_davidmaletz_tiles_Tile.SIZE) * com_davidmaletz_tiles_Tile.SIZE; + } + var b = new com_davidmaletz_mining_item__$Action_Build(p,i,info,5,e,s); + var pt = s.get_tile_y() * com_davidmaletz_tiles_Tile.SIZE; + var pt1 = b.canPlace(true,x,pt,true); + var tmp; + if(pt1 != null) { + pt1 = b.canPlace(false,pt1.x,pt1.y,false); + tmp = pt1 != null; + } else { + tmp = false; + } + if(tmp) { + com_davidmaletz_mining_item_Action.tryBuild(p,info,e,function() { + if(window != null) { + window.close(); + } + b.onPlace(pt1.x,pt1.y); + }); + return; + } + } + if(window != null) { + window.close(); + } +}; +com_davidmaletz_mining_item_Action.addObject = function(i,e,remBushes,o,p,x,y) { + var area = p.getCurrentArea(); + var dx = Std["is"](o,com_davidmaletz_mining_world_BushInfo) ? Math.round((o.createIcon().getTileWidth(0,0) - com_davidmaletz_tiles_Tile.SIZE) * 0.5) : 0; + var obj = o.create(x + dx,y); + if(Std["is"](obj,com_davidmaletz_mining_world_Bush)) { + (js_Boot.__cast(obj , com_davidmaletz_mining_world_Bush)).setGrowth(0); + } + if(remBushes) { + var b = obj.getBounds(); + b.inflate(dx,0); + area.removeObjects(b,1); + } + area.addObject(obj); + var r = obj.renderer; + if(r != null) { + r.set_alpha(0); + r.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),15); + } + var vars = com_davidmaletz_faengfl_EventHandler.createVariables(); + vars.set("object",obj); + new com_davidmaletz_mining_npc_NPCEventHandler(e.elements(),p,i,null,vars).runAll(); +}; +com_davidmaletz_mining_item_Action.getExtra = function(p,i,ct) { + var t = p.addItems(i,ct,0,null,false); + if(t != null) { + var _g = t; + _g.set_y(_g.get_y() + com_davidmaletz_tiles_Tile.SIZE); + var k = t.getLerp(com_davidmaletz_lerp_PositionKeyframe); + if(k != null) { + (js_Boot.__cast(k , com_davidmaletz_lerp_PositionKeyframe)).y += com_davidmaletz_tiles_Tile.SIZE; + t.lerp(k,60); + } + } +}; +com_davidmaletz_mining_item_Action.tryFill = function(p,e,key) { + var x; + var y; + switch(key) { + case "down": + x = p.get_tile_x(); + y = p.get_tile_y() + 1; + break; + case "left": + y = p.get_tile_y(); + x = p.get_tile_x() - 1; + break; + case "right": + y = p.get_tile_y(); + x = p.get_tile_x() + 1; + break; + case "up": + x = p.get_tile_x(); + y = p.get_tile_y() - 1; + break; + default: + return; + } + var t = p.area.getTileId(x,y,3); + var max = e.exists("maxFill") ? com_davidmaletz_mining_Main.parseInt(e.get("maxFill")) : 99; + if(!p.area.canShovel(t)) { + com_davidmaletz_mining_item_Action.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","no_fill")); + } else if(p.area.getTileId(x,y,0) == -1 && p.area.getTileId(x,y,1) == -1 && com_davidmaletz_mining_world_Area.getMineCost(p.area.getTileIndex(t)) <= max && !p.area.hasObjectInTile(x,y,-1,p)) { + p.area.setTile(x,y,0,t); + if(p.area.renderer != null) { + p.area.renderer.fullBrickBreak(x,y); + } + if(y == p.get_tile_y()) { + p.setPosition(p.get_tile_x() * com_davidmaletz_tiles_Tile.SIZE,p.yTile); + } else { + p.setPosition(p.xPos,p.get_tile_y() * com_davidmaletz_tiles_Tile.SIZE); + } + } else { + com_davidmaletz_mining_item_Action.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","no_fill")); + } +}; +com_davidmaletz_mining_item_Action.accessArea = function(p,underwater,inVehicle) { + if(inVehicle == null) { + inVehicle = false; + } + if(!inVehicle && p.vehicle != null) { + com_davidmaletz_mining_item_Action.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","no_use_vehicle")); + return false; + } else if(p.getCurrentArea() == null) { + com_davidmaletz_mining_item_Action.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","no_use")); + return false; + } else if(p.getCurrentArea().isWater(p.get_tile_x(),p.get_tile_y()) && !underwater) { + com_davidmaletz_mining_item_Action.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","no_use_underwater")); + return false; + } else { + return true; + } +}; +com_davidmaletz_mining_item_Action.checkAreaPlace = function(p,e) { + var a = p.getCurrentArea(); + var xml = com_davidmaletz_mining_world_Area.getXML(a.id); + if(xml != null && xml.get("canPlace") == "false") { + com_davidmaletz_mining_item_Action.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","no_place")); + return false; + } else { + return true; + } +}; +com_davidmaletz_mining_item_Action.doPlant = function(b,item,p,x,y) { + if(item == null) { + var s = b.build(p,p.getCurrentArea(),x,y); + var r = s.renderer; + if(r != null && Std["is"](r,com_davidmaletz_lerp_LerpSpriteBase)) { + r.set_alpha(0); + (js_Boot.__cast(r , com_davidmaletz_lerp_LerpSpriteBase)).lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),15); + } + return s; + } else { + var o = js_Boot.__cast(com_davidmaletz_mining_world_ObjectInfo.get("blueprint").create(x,y) , com_davidmaletz_mining_world_BlueprintObject); + o.setBlueprint(item); + p.getCurrentArea().addObject(o); + o.startBuild(p); + return o; + } +}; +com_davidmaletz_mining_item_Action.plantObject = function(item,value,name,p,o,e,onComplete,window,cost,killBush) { + if(killBush == null) { + killBush = true; + } + if(o != null && p.getCurrentArea() != null) { + var r; + var anim; + if(Std["is"](o,com_davidmaletz_mining_world_AttackableInfo)) { + var a = js_Boot.__cast(o , com_davidmaletz_mining_world_AttackableInfo); + r = com_davidmaletz_tiles_Tile.get(a.tile); + anim = a.getAnim("idle",null); + } else if(Std["is"](o,com_davidmaletz_mining_npc_NPCInfo)) { + var n = js_Boot.__cast(o , com_davidmaletz_mining_npc_NPCInfo); + r = com_davidmaletz_tiles_Tile.get(n.tile); + anim = n.getAnim("idle"); + } else { + r = o.createIcon(); + anim = "single"; + if(r != null) { + var f = o.getIconFrame(); + if(f != null) { + r = new com_davidmaletz_tiles_render_TileOffsetRenderer(r,f.x,f.y); + } + } + } + if(r != null) { + return function() { + var w = r.getTileWidth(0,0); + var h = r.getTileHeight(0,0); + var offX = e.exists("offsetX") ? com_davidmaletz_mining_Main.parseInt(e.get("offsetX")) : 0; + var offY = e.exists("offsetY") ? com_davidmaletz_mining_Main.parseInt(e.get("offsetY")) : 0; + var f1 = onComplete; + var a1 = o; + var tmp = function(a2,a3,a4) { + f1(a1,a2,a3,a4); + }; + com_davidmaletz_mining_item_Action.plant(p,r,anim,item,value,name,tmp,e,w,h,window,offX,offY,cost,killBush); + }; + } + } + return null; +}; +com_davidmaletz_mining_item_Action.getPlantCost = function(e,str) { + if(str == null) { + str = "plantCost"; + } + var pc = e.elementPathsNamed(str); + if(pc.hasNext()) { + return com_davidmaletz_mining_world_BlueprintObject.getReqs(pc.next()); + } else { + return null; + } +}; +com_davidmaletz_mining_item_Action.resolve = function(item,e,id) { + if(item != null && e == item.xml) { + return com_davidmaletz_faengfl_adv_sound_Sound.resolve(null,e,id); + } else { + return com_davidmaletz_faengfl_adv_sound_Sound.resolveDefault(e,id); + } +}; +com_davidmaletz_mining_item_Action._use = function(p,item,value,name,action,window,itemvalue,incStorehouse) { + if(incStorehouse == null) { + incStorehouse = false; + } + var e = action.xml == null ? item.xml : action.xml; + var u = e.get("underwater") == "true"; + var _g = action.id; + switch(_g) { + case "applyMod": + if(p.applyMod(item)) { + return true; + } else { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_DialogueBox(c,com_fancyfish_faeng_common_Lang.getText("warning","no_effect").get()),3); + return false; + } + break; + case "build": + var tmp; + var tmp1; + var tmp2 = e.get("inVehicle") != "false"; + if(!(!com_davidmaletz_mining_item_Action.accessArea(p,true,tmp2))) { + tmp1 = !com_davidmaletz_mining_item_Action.checkAreaPlace(p,e); + } else { + tmp1 = true; + } + if(!tmp1) { + tmp = !com_davidmaletz_mining_item__$Action_AbstractBuild.checkAreaConstraints(p,e); + } else { + tmp = true; + } + if(tmp) { + return false; + } + var s = com_davidmaletz_mining_structure_StructureInfo.get(e.get("structure")); + if(s != null && p.getCurrentArea().renderer != null && Std["is"](s,com_davidmaletz_mining_structure_StructureInfo)) { + var struc = js_Boot.__cast(s , com_davidmaletz_mining_structure_StructureInfo); + com_davidmaletz_mining_item_Action.doBuild(p,struc,item,e,window); + } + return false; + case "collect_rail": + if(!com_davidmaletz_mining_item_Action.accessArea(p,u)) { + return false; + } + var t = p.area.getTile(p.get_tile_x(),p.get_tile_y(),1); + if(t != null) { + p.area.setTile(p.get_tile_x(),p.get_tile_y(),1,-1); + var i = com_davidmaletz_mining_item_ItemInfo._get(t.id); + if(i != null) { + var iter = i.xml.elementsNamed("collectRail"); + if(iter.hasNext()) { + var items = []; + var e1 = iter; + while(e1.hasNext()) { + var e2 = e1.next(); + var info = com_davidmaletz_mining_item_ItemInfo.get(e2.get("item")); + if(info != null) { + items.push(new com_davidmaletz_mining_item_ItemCt(info,e2.exists("count") ? com_davidmaletz_mining_Main.parseInt(e2.get("count")) : 1)); + } + } + p.addMultiItems(items); + } else { + p.addItems(i); + } + return false; + } + } + var xml = com_davidmaletz_mining_world_Area.getDig(p.area.getTile(p.get_tile_x(),p.get_tile_y(),3)); + var i1; + var tmp3; + if(xml != null) { + i1 = com_davidmaletz_mining_item_ItemInfo.get(xml.get("collect_rail")); + tmp3 = i1 != null; + } else { + tmp3 = false; + } + if(tmp3) { + p.area.setTile(p.get_tile_x(),p.get_tile_y(),3,-1); + p.addItems(i1); + } + break; + case "craft": + var func = function() { + var c1 = com_davidmaletz_mining_Main.getContainer(); + c1.addDisplay(com_davidmaletz_mining_ui_CraftingWindow.make(com_davidmaletz_mining_item_Item._getName(item.getName(),name),p.getInv(false),c1,p,e,item),2); + }; + if(window != null) { + window.onClose = func; + window.close(); + } else { + func(); + } + break; + case "dismantle": + var tmp4 = e.get("inVehicle") != "false"; + if(!com_davidmaletz_mining_item_Action.accessArea(p,true,tmp4)) { + return false; + } + com_davidmaletz_mining_item_Action.dismantle(p,window); + break; + case "eat": + if(p.stats.getInt("full") > 0) { + var tmp5 = com_fancyfish_faeng_common_Lang.getText("common","full"); + p.showWarning(tmp5); + return false; + } + if(window == null) { + var p1 = p.inventory; + var tmp6 = p.inventory.getItemValueCount(item,value,name); + p.eat(new com_davidmaletz_mining_item_ItemParent(p1,item,tmp6,value,name),1); + } else { + var c2 = com_davidmaletz_mining_Main.getContainer(); + var p2 = p.inventory; + var ip = p.inventory.getItemValueCount(item,value,name); + var ip1 = new com_davidmaletz_mining_item_ItemParent(p2,item,ip,value,name); + var max = p.getMaxEat(ip1); + if(max > 0) { + var f = $bind(p,p.eat); + var a1 = ip1; + var tmp7 = function(ct) { + return f(a1,ct); + }; + c2.addDisplay(new com_davidmaletz_mining_ui_EatPrompt(c2,p,ip1,max,tmp7),2); + } else { + var a11 = ip1; + var tmp8 = function() { + com_davidmaletz_mining_ui_InventoryWindow._drop(a11); + }; + c2.addDisplay(new com_davidmaletz_mining_ui_Prompt(c2,new com_fancyfish_faeng_common_mutable_Concat2(com_fancyfish_faeng_common_Lang.getText("warning","no_effect"),com_fancyfish_faeng_common_Lang.getText("warning","drop_instead"),"\n"),tmp8),3); + } + } + break; + case "equip": + var i2 = p.inventory.selectItem(item,value,name); + if(i2 != null) { + p.equipment.equip(i2,p); + } + return false; + case "feed": + new com_davidmaletz_mining_item_FeedItem(action,p,item,value,name,itemvalue,incStorehouse,window == null ? com_davidmaletz_mining_item_FeedItem.fastFeedDefault : null); + return false; + case "feed_all": + new com_davidmaletz_mining_item_FeedItem(action,p,item,value,name,itemvalue,incStorehouse,com_davidmaletz_mining_item_FeedItem.fastFeedDefault); + return false; + case "fill": + if(!com_davidmaletz_mining_item_Action.accessArea(p,u)) { + return false; + } + var tmp9 = com_fancyfish_faeng_common_Lang.getText("common","select_dir").get(); + var p3 = p; + var e3 = e; + new com_davidmaletz_mining_ui_GetDir(tmp9,function(a12) { + com_davidmaletz_mining_item_Action.tryFill(p3,e3,a12); + }); + break; + case "fire": + if(!com_davidmaletz_mining_item_Action.accessArea(p,u)) { + return false; + } + var $with = e.get("with"); + var with1 = com_davidmaletz_mining_item_Action.getItemGroup(p,$with); + if(with1 != null && p.canUseEquipment(with1,false)) { + p.useWeapon(with1,item); + } else { + var s1 = com_fancyfish_faeng_common_Lang.getText("warning","cannot_fire").get(); + s1 = StringTools.replace(s1,"{projectile}",item.getDisplay(name,false)); + s1 = StringTools.replace(s1,"{weapon}",com_davidmaletz_mining_item_ItemInfo.get(e.get("with")).getDisplay(null,false)); + var c3 = com_davidmaletz_mining_Main.getContainer(); + c3.addDisplay(new com_davidmaletz_mining_ui_DialogueBox(c3,s1),3); + } + return false; + case "magic_box": + var func1 = function() { + var c4 = com_davidmaletz_mining_Main.getContainer(); + var inv = new com_davidmaletz_mining_item_Inventory(); + if(!com_davidmaletz_mining_Main.PIRATE) { + var i3 = com_davidmaletz_mining_item_ItemInfo.getAll(); + while(i3.hasNext()) { + var i4 = i3.next(); + if(i4.type != com_davidmaletz_mining_item_ItemCategory.none) { + inv.addItems(i4,9999); + } + } + } + var p4 = p.inventory; + var t1 = com_fancyfish_faeng_common_Lang.getText("common","inventory"); + var t2 = com_fancyfish_faeng_common_Lang.getText("common","storehouse"); + var t3 = new com_davidmaletz_mining_ui_TransferInventory(p,p4,inv,t1,t2,c4,p.capacity); + c4.addDisplay(t3,2); + }; + if(window != null) { + window.onClose = func1; + window.close(); + } else { + func1(); + } + return false; + case "place": + if(!com_davidmaletz_mining_item_Action.accessArea(p,u)) { + return false; + } + if(com_davidmaletz_mining_item_Action.doPlace(p,item,value,name,window,itemvalue,e)) { + com_davidmaletz_mining_item_Action.updatePlayer(p,window); + return true; + } else { + return false; + } + break; + case "place_rail": + if(!com_davidmaletz_mining_item_Action.accessArea(p,u)) { + return false; + } + if(p.area.isEmptyTile(p.get_tile_x(),p.get_tile_y() + 1) || p.area.getTileString(p.get_tile_x(),p.get_tile_y(),3) == "no_place" || p.area.isBlockVehicle(p.get_tile_x(),p.get_tile_y())) { + com_davidmaletz_mining_item_Action.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","no_place")); + return false; + } + var s2; + var rail = null; + s2 = p.area.getTileString(p.get_tile_x(),p.get_tile_y(),1); + if(s2 != null) { + var xml1 = e.elementsNamed("tile"); + while(xml1.hasNext()) { + var xml2 = xml1.next(); + if(xml2.get("id") == s2) { + rail = xml2.get("rail"); + break; + } + } + } else { + rail = e.get("rail"); + } + if(rail != null) { + p.area.setTile(p.get_tile_x(),p.get_tile_y(),1,p.area.addTileIndex(rail)); + com_davidmaletz_faengfl_adv_sound_Sound.play(com_davidmaletz_mining_item_Action.resolve(item,e,"place")); + return true; + } else { + com_davidmaletz_mining_item_Action.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","place_overlap")); + return false; + } + break; + case "plant": + var tmp10; + var tmp11; + var tmp12 = e.get("inVehicle") != "false"; + if(!(!com_davidmaletz_mining_item_Action.accessArea(p,true,tmp12))) { + tmp11 = !com_davidmaletz_mining_item_Action.checkAreaPlace(p,e); + } else { + tmp11 = true; + } + if(!tmp11) { + tmp10 = !com_davidmaletz_mining_item__$Action_AbstractBuild.checkAreaConstraints(p,e); + } else { + tmp10 = true; + } + if(tmp10) { + return false; + } + var cost = com_davidmaletz_mining_item_Action.getPlantCost(e); + var area = p.getCurrentArea(); + var vars = null; + if(e.get("eval") == "true") { + vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(p); + vars.set("item",item); + vars.set("value",value); + vars.set("name",name); + } + var _plant = null; + if(e.exists("crop")) { + var s3 = com_davidmaletz_mining_structure_StructureInfo.get(com_davidmaletz_mining_npc_NPCEventHandler.evalString(e.get("crop"),vars)); + if(s3 != null && area != null && Std["is"](s3,com_davidmaletz_mining_item_CropInfo)) { + _plant = function() { + var c5 = js_Boot.__cast(s3 , com_davidmaletz_mining_item_CropInfo); + var c6 = c5.structure.tile; + var _plant1 = c5.structure.getAnim("idle"); + var b = c5; + var _plant2 = function(p5,x,y) { + return com_davidmaletz_mining_item_Action.doPlant(b,null,p5,x,y); + }; + var c7 = c5.structure.width; + var c8 = c5.structure.height; + var _plant3 = com_davidmaletz_mining_item_Action.getStrucOffX(c5.structure); + var c9 = c5.structure.offsetY; + var _plant4 = e.get("removeBushes") != "false"; + com_davidmaletz_mining_item_Action.plant(p,c6,_plant1,item,value,name,_plant2,e,c7,c8,window,_plant3,c9,cost,_plant4); + }; + } + } else if(e.exists("object")) { + var o = com_davidmaletz_mining_world_ObjectInfo.get(com_davidmaletz_mining_npc_NPCEventHandler.evalString(e.get("object"),vars)); + var rem = e.get("removeBushes") != "false"; + var i5 = new com_davidmaletz_mining_item_Item(item,value,name); + var e4 = e; + var a13 = rem; + var _plant5 = function(o1,p6,x1,y1) { + com_davidmaletz_mining_item_Action.addObject(i5,e4,a13,o1,p6,x1,y1); + }; + _plant = com_davidmaletz_mining_item_Action.plantObject(item,value,name,p,o,e,_plant5,window,cost,rem); + } else if(e.exists("structure")) { + var s4 = com_davidmaletz_mining_structure_StructureInfo.get(com_davidmaletz_mining_npc_NPCEventHandler.evalString(e.get("structure"),vars)); + if(s4 != null && area != null && Std["is"](s4,com_davidmaletz_mining_structure_StructureInfo)) { + var struc1 = js_Boot.__cast(s4 , com_davidmaletz_mining_structure_StructureInfo); + if(struc1.xml.get("type") == "storehouse" && area.vehicle != null) { + com_davidmaletz_mining_item_Action.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","no_place")); + return false; + } + if(struc1.xml.get("type") == "storehouse" && struc1.xml.get("main") == "true" && area.getMainStorehouse(false) != null || e.get("unique") == "true" && area.getStructureById(struc1.id) != null) { + com_davidmaletz_mining_item_Action.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","one_structure")); + return false; + } + _plant = function() { + var struc2 = struc1.tile; + var _plant6 = struc1.getAnim("idle"); + var b1 = struc1; + var a14 = item; + var _plant7 = function(p7,x2,y2) { + return com_davidmaletz_mining_item_Action.doPlant(b1,a14,p7,x2,y2); + }; + var struc3 = struc1.width; + var struc4 = struc1.height; + var _plant8 = com_davidmaletz_mining_item_Action.getStrucOffX(struc1); + var struc5 = struc1.offsetY; + var _plant9 = e.get("removeBushes") != "false"; + com_davidmaletz_mining_item_Action.plant(p,struc2,_plant6,item,value,name,_plant7,e,struc3,struc4,window,_plant8,struc5,cost,_plant9); + }; + } + } + if(_plant != null) { + if(cost == null || cost.length == 0) { + _plant(); + } else { + var c10 = com_davidmaletz_mining_Main.getContainer(); + var b2 = com_fancyfish_faeng_common_Lang.getText("structure","plant_cost").get(); + var b3 = item.getDisplay(name,false); + var b4 = p.getInv(true); + var b5 = com_fancyfish_faeng_common_Lang.getText("common","yes"); + var b6 = new com_davidmaletz_mining_ui_BuildPrompt(b2,c10,p,b3,b4,cost,_plant,null,b5); + b6.acceptCancelClose = true; + var p8 = p; + var i6 = item; + var a15 = value; + var a2 = name; + b6.onClose = function() { + com_davidmaletz_mining_item_Action.cancelPlant(p8,i6,a15,a2,null); + }; + c10.addDisplay(b6,2); + } + return true; + } + break; + case "rename": + var c11 = com_davidmaletz_mining_Main.getContainer(); + var map = new haxe_ds_StringMap(); + map.set("{item}","[item=" + item.id + "]"); + var m = new com_fancyfish_faeng_common_mutable_MutableTemplateStatic(com_fancyfish_faeng_common_Lang.getText("common","rename"),map); + var p9 = p; + var a16 = item; + var a21 = value; + var a3 = name; + var a4 = itemvalue; + c11.addDisplay(new com_davidmaletz_mining_ui_TextInput(c11,m,function(a5) { + com_davidmaletz_mining_item_Action.renameItem(p9,a16,a21,a3,a4,a5); + },com_davidmaletz_mining_item_Item._getName(item.getName(),name).get(),20,120),2); + return false; + case "repair": + var func2 = function() { + var c12 = com_davidmaletz_mining_Main.getContainer(); + c12.addDisplay(new com_davidmaletz_mining_ui_RepairWindow(com_davidmaletz_mining_item_Item._getName(item.getName(),name),p.getInv(false),p.equipment,c12,p,e,item),2); + }; + if(window != null) { + window.onClose = func2; + window.close(); + } else { + func2(); + } + break; + case "setProjectile": + var inv1 = p.getCurrentInventory(); + if(itemvalue == null) { + var i7 = inv1.selectItem(item,value,name); + if(i7 != null) { + itemvalue = new com_davidmaletz_mining_item_InventoryValue(i7); + } + } + if(itemvalue != null) { + var c13 = com_davidmaletz_mining_Main.getContainer(); + var tmp13 = action.getName(); + var tmp14 = p.includeCost(); + var a17 = item; + var tmp15 = function(i8) { + return com_davidmaletz_mining_item_Action.isProjectile(a17,i8); + }; + var a18 = itemvalue; + var p10 = p; + c13.addDisplay(new com_davidmaletz_mining_ui_ItemList(c13,inv1,tmp13,tmp14,tmp15,function(i9) { + com_davidmaletz_mining_item_Action.setProjectile(a18,p10,i9); + },false,null),2); + } + break; + case "transform": + var into = com_davidmaletz_mining_item_ItemInfo.get(e.get("into")); + if(into != null) { + var d = item.getDurability(); + var v; + if(e.exists("value")) { + v = com_davidmaletz_mining_Main.parseInt(e.get("value")); + } else if(d == 0) { + v = 0; + } else { + var v1 = into.getDurability(); + v = Math.floor(value * v1 / d); + } + var e5 = com_davidmaletz_mining_item_ItemInfo.get(e.get("extra")); + var tmp16; + if(e5 == null) { + tmp16 = null; + } else { + var p11 = p; + var i10 = e5; + tmp16 = function(ct1) { + com_davidmaletz_mining_item_Action.getExtra(p11,i10,ct1); + }; + } + com_davidmaletz_mining_item_Action.transform(p,item,value,name,new com_davidmaletz_mining_item_ItemValueCt(into,1,v,name),itemvalue,tmp16); + } + return false; + case "transform_other": + if(itemvalue == null) { + var i11 = p.inventory.selectItem(item,value,name); + if(i11 != null) { + itemvalue = new com_davidmaletz_mining_item_InventoryValue(i11); + } + } + if(itemvalue != null) { + new com_davidmaletz_mining_item__$Action_TransformOther(p,action,e,itemvalue,window); + } + return false; + case "upgrade": + var tmp17; + var tmp18 = e.get("inVehicle") != "false"; + if(!(!com_davidmaletz_mining_item_Action.accessArea(p,true,tmp18))) { + tmp17 = !com_davidmaletz_mining_item__$Action_AbstractBuild.checkAreaConstraints(p,e); + } else { + tmp17 = true; + } + if(tmp17) { + return false; + } + var s5 = com_davidmaletz_mining_structure_StructureInfo.get(e.get("structure")); + if(s5 != null && Std["is"](s5,com_davidmaletz_mining_structure_StructureInfo)) { + var struc6 = js_Boot.__cast(s5 , com_davidmaletz_mining_structure_StructureInfo); + com_davidmaletz_mining_item_Action.upgrade(p,struc6,item,e,window); + } + return false; + case "use": + if(action.xml != null) { + var vars1 = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(p); + var value1 = item.getDurability(); + vars1.set("maxDurability",value1); + var value2 = item.getDurability() - value; + vars1.set("durability",value2); + vars1.set("name",name); + vars1.set("consume",function() { + p.inventory.addItems(item,-1,value,name); + }); + var incValue = function(dv) { + if(itemvalue == null) { + var i12 = p.inventory.selectItem(item,value,name); + if(i12 != null) { + i12.increaseValue(p.inventory,dv); + } + } else { + itemvalue.increaseValue(p,dv); + } + value += dv; + }; + vars1.set("setDurability",function(d1) { + vars1.set("durability",d1); + var tmp19 = item.getDurability() - value - d1; + incValue(tmp19); + }); + vars1.set("setName",function(n) { + vars1.set("name",n); + if(itemvalue == null) { + p.inventory.changeName(item,value,name,n); + } else { + itemvalue.setName(p,n); + } + name = n; + }); + var ret = com_davidmaletz_faengfl_EventHandler.execute(action.xml.get("consume"),vars1) == true; + if(action.xml.exists("cost")) { + var cost1 = com_davidmaletz_faengfl_EventHandler.execute(action.xml.get("cost"),vars1); + incValue(cost1); + } + var func3 = function() { + new com_davidmaletz_mining_npc_NPCEventHandler(action.xml.elements(),p,item,null,vars1).runAll(); + }; + if(window != null && action.xml.get("closeWindow") != "false") { + window.onClose = func3; + window.close(); + } else { + func3(); + } + return ret; + } + break; + } + return false; +}; +com_davidmaletz_mining_item_Action.__conditionMet = function(xml,vars) { + if(xml == null || !xml.exists("enabled")) { + return true; + } else { + try { + return com_davidmaletz_faengfl_EventHandler._execute(xml.get("enabled"),vars) == true; + } catch( e ) { + haxe_CallStack.lastException = e; + return false; + } + } +}; +com_davidmaletz_mining_item_Action.fromXML = function(xml) { + return new com_davidmaletz_mining_item_Action(xml.get("id"),xml.get("name"),xml); +}; +com_davidmaletz_mining_item_Action.getObjectsOrbit = function(area,b,func,onTile,overlap) { + if(overlap == null) { + overlap = 0.5; + } + var orbit = null; + if(area.isOrbit()) { + var id = StringTools.endsWith(area.id,".station") ? area.id.substring(0,area.id.length - 8) : area.id + ".station"; + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p != null && p.areas.exists(id)) { + orbit = p.areas.get(id); + } + } + var o = b; + if(orbit != null) { + o = o.clone(); + } + area.getObjects(b,func,onTile,overlap); + if(orbit != null) { + orbit.getObjects(o,func,onTile,overlap); + } +}; +com_davidmaletz_mining_item_Action.hasBlueprintInTile = function(area,x,y) { + com_davidmaletz_mining_world_Object.rectangle.setTo(x * com_davidmaletz_tiles_Tile.SIZE,y * com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE); + var ret = false; + com_davidmaletz_mining_item_Action.getObjectsOrbit(area,com_davidmaletz_mining_world_Object.rectangle,function(o,rect) { + if(o.getLayer() == 1 && o.getHealth() > 0 && Std["is"](o,com_davidmaletz_mining_world_BlueprintObject)) { + ret = true; + return true; + } + return false; + },null,0); + return ret; +}; +com_davidmaletz_mining_item_Action.prototype = { + id: null + ,name: null + ,xml: null + ,getName: function() { + var m = com_fancyfish_faeng_common_Lang.getTextFromTitle(this.name); + if(m == null) { + return com_fancyfish_faeng_common_Lang.getText("actions",this.name); + } else { + return m; + } + } + ,getDescription: function() { + var m = this.xml == null ? null : com_fancyfish_faeng_common_Lang.getTextFromTitle(this.xml.get("description")); + if(m == null) { + if(com_fancyfish_faeng_common_Lang.hasText("item.descriptions",this.id)) { + return com_fancyfish_faeng_common_Lang.getText("item.descriptions",this.id); + } else { + return null; + } + } else { + return m; + } + } + ,'use': function(p,item,value,name,window,itemvalue,incStorehouse) { + if(incStorehouse == null) { + incStorehouse = false; + } + if(com_davidmaletz_mining_item_Action._use(p,item,value,name,this,window,itemvalue,incStorehouse)) { + if(itemvalue != null) { + itemvalue.remove(p); + } else { + p.inventory.addItems(item,-1,value,name); + } + } + } + ,conditionMet: function(vars) { + return com_davidmaletz_mining_item_Action.__conditionMet(this.xml,vars); + } + ,__class__: com_davidmaletz_mining_item_Action +}; +var com_davidmaletz_mining_item_Use = function(a,p,item,value,name,window,itemvalue,incStorehouse) { + if(incStorehouse == null) { + incStorehouse = false; + } + this.action = a; + this.player = p; + this.item = item; + this.value = value; + this.name = name; + this.window = window; + this.itemvalue = itemvalue; + this.incStorehouse = incStorehouse; +}; +$hxClasses["com.davidmaletz.mining.item.Use"] = com_davidmaletz_mining_item_Use; +com_davidmaletz_mining_item_Use.__name__ = ["com","davidmaletz","mining","item","Use"]; +com_davidmaletz_mining_item_Use.prototype = { + action: null + ,player: null + ,item: null + ,value: null + ,name: null + ,window: null + ,itemvalue: null + ,incStorehouse: null + ,getId: function() { + return this.action.id; + } + ,getName: function() { + return this.action.name; + } + ,'use': function() { + this.action["use"](this.player,this.item,this.value,this.name,this.window,this.itemvalue,this.incStorehouse); + } + ,__class__: com_davidmaletz_mining_item_Use +}; +var com_davidmaletz_mining_item_FeedItem = function(a,p,i,v,name,itemvalue,incStorehouse,fastFeed,onComplete,onClose) { + this.action = a; + var c = com_davidmaletz_mining_Main.getContainer(); + var inv = p.getInv(incStorehouse); + if(v == 0) { + if(fastFeed != null) { + var d = 20; + new com_davidmaletz_faengfl_ui_Popup(128.,36.,0,new com_fancyfish_faeng_common_mutable_Static(i.getNotification(this.getText("full",com_fancyfish_faeng_common_Lang.getText("common","not_hungry")),name,true)),16777215,-16777216,d,d,d,null,true); + } else { + c.addDisplay(new com_davidmaletz_mining_ui_DialogueBox(c,i.getNotification(this.getText("full",com_fancyfish_faeng_common_Lang.getText("common","not_hungry")),name,false)),3); + } + } else { + this.player = p; + this.item = i; + this.value = v; + this.name = name; + this.food = new haxe_ds_StringMap(); + this.itemvalue = itemvalue; + var e = i.xml.elementsNamed("food"); + while(e.hasNext()) { + var e1 = e.next(); + this.food.set(e1.get("id"),com_davidmaletz_mining_Main.parseInt(e1.get("value"))); + } + if(fastFeed != null) { + var ar = []; + var b = new StringBuf(); + var d1 = v; + var map = new haxe_ds_StringMap(); + var m = this.getText("auto",fastFeed(map,ar)); + var _g = 0; + while(_g < ar.length) { + var i1 = ar[_g]; + ++_g; + b.add("\n"); + b.add(i1.item.getDisplay(null,false)); + if(i1.count > 1) { + b.add(" x"); + b.add(i1.count); + } + } + var st = ar.length; + var i2 = inv.getItems($bind(this,this.canFeed)); + while(i2.hasNext()) { + var i3 = i2.next(); + if(i3.count > 0) { + var val = this.getFeed(i3.item); + var ct = Math.ceil(d1 / val); + if(ct > i3.count) { + ct = i3.count; + } + ar.push(new com_davidmaletz_mining_item_ItemCt(i3.item,ct)); + d1 -= val * ct; + b.add("\n"); + b.add(i3.item.getDisplay(null,false)); + if(ct > 1) { + b.add(" x"); + b.add(ct); + } + if(d1 <= 0) { + break; + } + } + } + if(ar.length == st) { + if(onComplete != null) { + onComplete(this.value); + } + if(onClose != null) { + onClose(); + } + return; + } + if(!map.exists("{item}")) { + map.set("{item}",this.item.getDisplay(name,false)); + } + map.set("{list}",b.toString()); + var c1 = com_davidmaletz_mining_Main.getContainer(); + var f = $bind(this,this.autoFeed); + var a1 = inv; + var d2 = d1; + var ar1 = ar; + var a2 = onComplete; + var p1 = function() { + f(a1,d2,ar1,a2); + }; + var p2; + if(onComplete == null) { + p2 = null; + } else { + var f1 = onComplete; + var a11 = this.value; + p2 = function() { + f1(a11); + }; + } + var p3 = new com_davidmaletz_mining_ui_Prompt(c1,new com_fancyfish_faeng_common_mutable_MutableTemplateStatic(m,map),p1,p2,true); + p3.onClose = onClose; + c1.addDisplay(p3,2); + return; + } else { + c.addDisplay(new com_davidmaletz_mining_ui_ItemList(c,inv,this.getText("select",com_fancyfish_faeng_common_Lang.getText("common","select_feed")),p.includeCost(),$bind(this,this.canFeed),$bind(this,this.feedCount),true,null,$bind(this,this.feedValue)),2); + } + } +}; +$hxClasses["com.davidmaletz.mining.item.FeedItem"] = com_davidmaletz_mining_item_FeedItem; +com_davidmaletz_mining_item_FeedItem.__name__ = ["com","davidmaletz","mining","item","FeedItem"]; +com_davidmaletz_mining_item_FeedItem.fastFeedDefault = function(map,ar) { + return com_fancyfish_faeng_common_Lang.getText("common","auto_feed"); +}; +com_davidmaletz_mining_item_FeedItem.prototype = { + player: null + ,item: null + ,name: null + ,action: null + ,value: null + ,food: null + ,itemvalue: null + ,getText: function(id,def) { + var m = null; + if(this.action != null && this.action.xml != null && this.action.xml.exists(id)) { + m = com_fancyfish_faeng_common_Lang.getTextFromTitle(this.action.xml.get(id)); + } + if(m == null) { + return def; + } else { + return m; + } + } + ,autoFeed: function(inv,d,ar,func) { + var _g = 0; + while(_g < ar.length) { + var item = ar[_g]; + ++_g; + inv.addItems(item.item,-item.count); + } + if(d < 0) { + d = 0; + } + if(func == null) { + if(this.itemvalue != null) { + this.itemvalue.increaseValue(this.player,d - this.value); + } else { + this.player.inventory.changeValue(this.item,this.name,this.value,d); + } + } + if(this.action != null && this.action.xml != null) { + com_davidmaletz_faengfl_adv_sound_Sound.play(com_davidmaletz_faengfl_adv_sound_Sound.resolveDefault(this.action.xml,"feed")); + } + if(func != null) { + func(d); + } + } + ,feedValue: function(i,s,width,x,y) { + var t = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Concat(this.action == null ? com_fancyfish_faeng_common_Lang.getText("common","feed") : this.action.getName(),": " + this.getFeed(i)),new com_fancyfish_faeng_text_CharacterPlacer(0),0,0.5); + t.set_x(x); + t.set_y(y); + s.addChild(t); + return y + (t.lineHeight() >> 1); + } + ,canFeed: function(i) { + if(i != null) { + return this.food.exists(i.id); + } else { + return true; + } + } + ,getFeed: function(i) { + if(this.canFeed(i)) { + return this.food.get(i.id); + } else { + return 0; + } + } + ,onFeed: function(i,ct) { + if(ct != 0) { + i.inventory.addItems(i.item,-ct,i.value,i.name); + var dv = this.food.get(i.item.id) * ct; + if(dv > this.value) { + dv = this.value; + } + if(this.itemvalue != null) { + this.itemvalue.increaseValue(this.player,-dv); + } else { + this.player.inventory.changeValue(this.item,this.name,this.value,this.value - dv); + } + if(this.action != null && this.action.xml != null) { + com_davidmaletz_faengfl_adv_sound_Sound.play(com_davidmaletz_faengfl_adv_sound_Sound.resolveDefault(this.action.xml,"feed")); + } + } + } + ,getMaxFeed: function(item,floor) { + if(floor == null) { + floor = false; + } + if(!this.food.exists(item.item.id)) { + return 0; + } + var v = this.value / this.food.get(item.item.id); + var max = floor ? Math.floor(v) : Math.ceil(v); + if(max > item.count) { + return item.count; + } else { + return max; + } + } + ,feedCount: function(food) { + var max = this.getMaxFeed(food); + if(max == 0) { + return; + } else if(max == 1) { + this.onFeed(food,1); + } else { + var c = com_davidmaletz_mining_Main.getContainer(); + var f = $bind(this,this.onFeed); + var i = food; + var tmp = function(ct) { + f(i,ct); + }; + c.addDisplay(new com_davidmaletz_mining_ui_ItemCountPrompt(c,food,max,com_fancyfish_faeng_common_Lang.getText("common","use_count"),this.getMaxFeed(food,true),tmp),2); + } + } + ,__class__: com_davidmaletz_mining_item_FeedItem +}; +var com_davidmaletz_mining_item__$Action_TransformOther = function(p,action,xml,itemvalue,wnd) { + this.player = p; + this.itemvalue = itemvalue; + var c = com_davidmaletz_mining_Main.getContainer(); + this.transform = new haxe_ds_StringMap(); + this.window = wnd; + this.mutable = action.getName(); + this._consume = xml.get("consume") == "true" && itemvalue != null; + this.toObject = xml.get("toObject") == "true"; + var vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(p); + var e = xml.elementPathsNamed("transform"); + while(e.hasNext()) { + var e1 = e.next(); + if(com_davidmaletz_mining_item_Action.__conditionMet(e1,vars)) { + var i = e1.get("to"); + if(i != null && (this.toObject && com_davidmaletz_mining_world_ObjectInfo.exists(i) || !this.toObject && com_davidmaletz_mining_item_ItemInfo.exists(i))) { + this.transform.set(e1.get("from"),e1); + } + } + } + c.addDisplay(new com_davidmaletz_mining_ui_ItemList(c,p.inventory,this.mutable,false,$bind(this,this.canTransform),$bind(this,this.doTransform),false,null,$bind(this,this.transformTo)),2); +}; +$hxClasses["com.davidmaletz.mining.item._Action.TransformOther"] = com_davidmaletz_mining_item__$Action_TransformOther; +com_davidmaletz_mining_item__$Action_TransformOther.__name__ = ["com","davidmaletz","mining","item","_Action","TransformOther"]; +com_davidmaletz_mining_item__$Action_TransformOther.prototype = { + transform: null + ,player: null + ,itemvalue: null + ,mutable: null + ,_consume: null + ,toObject: null + ,window: null + ,canTransform: function(i) { + if(i != null) { + return this.transform.exists(i.id); + } else { + return false; + } + } + ,placeObject: function(item,o,p,x,y) { + var obj = o.create(x,y); + if(obj == null) { + return; + } + if(Std["is"](obj,com_davidmaletz_mining_world_vehicle_Vehicle)) { + (js_Boot.__cast(obj , com_davidmaletz_mining_world_vehicle_Vehicle)).set_name(item.getNameStr()); + } + if(Std["is"](obj,com_davidmaletz_mining_structure_IFuelable)) { + var f = js_Boot.__cast(obj , com_davidmaletz_mining_structure_IFuelable); + var max = f.getMaxFuel(); + var d = item.info.getDurability(); + if(d != 0) { + f.addFuel(max - Math.floor(item.value * max / d)); + } + } + if(Std["is"](obj,com_davidmaletz_mining_world_Bush)) { + (js_Boot.__cast(obj , com_davidmaletz_mining_world_Bush)).setGrowth(0); + } + if(this._consume) { + this.consume(1); + } + p.area.addObject(obj); + var r = obj.renderer; + if(r != null) { + r.set_alpha(0); + r.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),15); + } + } + ,_transform: function(i,value) { + var e = this.transform.get(i.item.id); + var id = e.get("to"); + if(this.toObject) { + var o = com_davidmaletz_mining_world_ObjectInfo.get(id); + var i1 = i.item; + var i2 = i.name; + var f = this.player; + var f1 = $bind(this,this.placeObject); + var a1 = new com_davidmaletz_mining_item_Item(i.item,value,i.name); + var f2 = com_davidmaletz_mining_item_Action.plantObject(i1,value,i2,f,o,e,function(o1,p,x,y) { + f1(a1,o1,p,x,y); + },this.window,null,false); + if(f2 != null && this.player.inventory.addItems(i.item,-1,i.value,i.name)) { + f2(); + } + } else { + var item = com_davidmaletz_mining_item_ItemInfo.get(id); + var d = i.item.getDurability(); + var v = d == 0 ? 0 : Math.floor(value * item.getDurability() / d); + var tmp = this.player; + var tmp1 = new com_davidmaletz_mining_item_ItemValueCt(item,1,v,i.name); + var tmp2 = this._consume ? $bind(this,this.consume) : null; + com_davidmaletz_mining_item_Action.onTransform(tmp,tmp1,new com_davidmaletz_mining_item_Item(i.item,i.value,i.name),null,tmp2,1); + } + } + ,doTransform: function(i) { + if(this.canTransform(i.item)) { + var f = $bind(this,this._transform); + var i1 = i; + var func = function(a1) { + f(i1,a1); + }; + if(i.value != 0) { + new com_davidmaletz_mining_item_FeedItem(null,this.player,i.item,i.value,i.name,null,false,com_davidmaletz_mining_item_FeedItem.fastFeedDefault,func); + } else { + func(i.value); + } + } + } + ,consume: function(ct) { + this.itemvalue.remove(this.player); + } + ,transformTo: function(i,s,width,x,y) { + if(!this.canTransform(i)) { + return y; + } + var to = this.transform.get(i.id).get("to"); + var t = new com_davidmaletz_faengfl_TextSprite(this.mutable,new com_fancyfish_faeng_text_CharacterPlacer(width,1),153,0.5); + t.set_x(x); + t.set_y(y); + s.addChild(t); + y += t.lineHeight() >> 1; + if(this.toObject) { + var vars = com_davidmaletz_faengfl_EventHandler.createVariables(); + vars.set("this",i); + com_davidmaletz_mining_ui_ItemRenderer.addItemCentered(s,new com_davidmaletz_mining_world_ObjectIcon(com_davidmaletz_mining_world_ObjectInfo.get(to),vars),x + (width >> 1),y); + return y + 12; + } else { + return com_davidmaletz_mining_item_ItemInfo.get(to).addTitleInfo(s,width,x,y); + } + } + ,__class__: com_davidmaletz_mining_item__$Action_TransformOther +}; +var com_davidmaletz_mining_item__$Action_AbstractBuild = function(p,e) { + this.player = p; + this.xml = e; +}; +$hxClasses["com.davidmaletz.mining.item._Action.AbstractBuild"] = com_davidmaletz_mining_item__$Action_AbstractBuild; +com_davidmaletz_mining_item__$Action_AbstractBuild.__name__ = ["com","davidmaletz","mining","item","_Action","AbstractBuild"]; +com_davidmaletz_mining_item__$Action_AbstractBuild.__interfaces__ = [AbstractClass]; +com_davidmaletz_mining_item__$Action_AbstractBuild.checkAreaConstraints = function(player,xml) { + var iter = xml.elementsNamed("areaConstraint"); + if(iter.hasNext()) { + var vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(player); + var e = iter; + while(e.hasNext()) { + var e1 = e.next(); + var c = e1.firstChild(); + if(c != null && c.get_nodeValue() != null) { + com_davidmaletz_faengfl_EventHandler.execute(com_fancyfish_faeng_common_Lang.escape(c.get_nodeValue()),vars); + } + if(e1.exists("enabled") && com_davidmaletz_faengfl_EventHandler.execute(e1.get("enabled"),vars) != true) { + if(e1.exists("fail")) { + com_davidmaletz_mining_item_Action.showWarning(com_fancyfish_faeng_common_Lang.getTextFromTitle(e1.get("fail"))); + } + return false; + } + } + } + return true; +}; +com_davidmaletz_mining_item__$Action_AbstractBuild.prototype = { + player: null + ,xml: null + ,checkPlaceConstraints: function(init,x,y,showError) { + var iter = this.xml.elementsNamed("constraint"); + var or = this.xml.get("constraints") == "or"; + if(iter.hasNext()) { + var vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(this.player); + var updatePos = function() { + vars.set("x",x); + vars.set("y",y); + vars.set("tile_x",Math.round(x / com_davidmaletz_tiles_Tile.SIZE)); + vars.set("tile_y",Math.round(y / com_davidmaletz_tiles_Tile.SIZE)); + }; + updatePos(); + var value = this.getWidth(); + vars.set("width",value); + var value1 = this.getHeight(); + vars.set("height",value1); + var e = iter; + while(e.hasNext()) { + var e1 = e.next(); + var c = e1.firstChild(); + if(c != null && c.get_nodeValue() != null) { + com_davidmaletz_faengfl_EventHandler.execute(com_fancyfish_faeng_common_Lang.escape(c.get_nodeValue()),vars); + } + if(e1.exists("enabled") && com_davidmaletz_faengfl_EventHandler.execute(e1.get("enabled"),vars) != true) { + if(e1.exists("fail") && showError) { + this.showWarning(init,com_fancyfish_faeng_common_Lang.getTextFromTitle(e1.get("fail")),x,y); + } + if(or) { + continue; + } else { + return null; + } + } + var a = false; + if(e1.exists("x")) { + x = com_davidmaletz_faengfl_EventHandler.execute(e1.get("x"),vars); + a = true; + } + if(e1.exists("y")) { + y = com_davidmaletz_faengfl_EventHandler.execute(e1.get("y"),vars); + a = true; + } + if(a) { + updatePos(); + } + if(or) { + return new com_fancyfish_faeng_display_IPoint2D(x,y); + } + } + } + if(or) { + if(this.xml.exists("fail") && showError) { + this.showWarning(init,com_fancyfish_faeng_common_Lang.getTextFromTitle(this.xml.get("fail")),x,y); + } + return null; + } else { + return new com_fancyfish_faeng_display_IPoint2D(x,y); + } + } + ,getWidth: function() { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,getHeight: function() { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,showWarning: function(init,m,x,y) { + com_davidmaletz_mining_item_Action.showWarning(m); + } + ,__objects: null + ,__structures: null + ,reset: function() { + this.__objects = []; + this.__structures = []; + } + ,showErrorObject: function(o) { + if(Std["is"](o,com_davidmaletz_mining_world_BlueprintObject) && this.__objects.indexOf(o) == -1) { + this.__objects.push(o); + this._showErrorStructure((js_Boot.__cast(o , com_davidmaletz_mining_world_BlueprintObject)).structure,o.xPos,o.yTile); + } + } + ,showErrorStructure: function(s) { + if(this.__structures.indexOf(s) == -1) { + this.__structures.push(s); + this._showErrorStructure(s.info,s.xPos,s.yPos); + } + } + ,_showErrorStructure: function(info,x,y) { + var a = this.player.getCurrentArea(); + if(a.renderer != null) { + var t = info.tile; + var s; + var empty = t == com_davidmaletz_tiles_EmptyTile.get(); + if(empty) { + s = new com_davidmaletz_lerp_LerpSprite(); + var g = s.get_graphics(); + g.beginFill(16711680,0.75); + g.drawRect(0,0,info.width,info.height); + g.endFill(); + } else { + s = new com_davidmaletz_tiles_render_StaticPlayAnimation(t,com_davidmaletz_mining_item_Action.getStructAnim(info),10,true); + } + com_davidmaletz_mining_structure_Structure._addOverlay(info.xml,info,this.player.area,null,s,false); + s.set_x(x + (empty ? info.offsetX : com_davidmaletz_mining_item_Action.getStrucOffX(info))); + com_davidmaletz_mining_renderer_AreaRenderer.updateLoop(s,a); + s.set_y(y + com_davidmaletz_tiles_Tile.SIZE - info.height + info.offsetY); + if(info.xml.get("flip") == "true") { + s.set_scaleX(-1); + var _g = s; + _g.set_x(_g.get_x() + t.getTileWidth(0,0)); + } + com_davidmaletz_faengfl_TextSprite.setColor(s,16737894); + s.set_alpha(0); + var s1 = s; + var tmp = function() { + com_davidmaletz_mining_item_Action.hold(s1); + }; + s.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0.5),10,tmp); + a.renderer.addChild(s); + } + } + ,showErrorTile: function(x,y) { + var a = this.player.getCurrentArea(); + if(a.renderer != null) { + var s = new com_davidmaletz_lerp_LerpSprite(); + var g = s.get_graphics(); + g.beginFill(16777215,0.75); + g.drawRect(0,0,com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE); + g.endFill(); + s.set_x(x * com_davidmaletz_tiles_Tile.SIZE); + s.set_y(y * com_davidmaletz_tiles_Tile.SIZE); + com_davidmaletz_faengfl_TextSprite.setColor(s,16711680); + s.set_alpha(0); + var s1 = s; + var tmp = function() { + com_davidmaletz_mining_item_Action.hold(s1); + }; + s.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0.5),10,tmp); + a.renderer.addChild(s); + } + } + ,canPlace: function(init,x,y,showError) { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,onPlace: function(x,y) { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,__class__: com_davidmaletz_mining_item__$Action_AbstractBuild +}; +var com_davidmaletz_mining_item__$Action_SimpleBuild = function(p,doBuild,i,s,flags,e,ignore) { + com_davidmaletz_mining_item__$Action_AbstractBuild.call(this,p,e); + this.sfx = com_davidmaletz_mining_item_Action.resolve(i,e,"place"); + this.doBuild = doBuild; + this.struc = s; + this.flags = flags; + this.ignore = ignore; +}; +$hxClasses["com.davidmaletz.mining.item._Action.SimpleBuild"] = com_davidmaletz_mining_item__$Action_SimpleBuild; +com_davidmaletz_mining_item__$Action_SimpleBuild.__name__ = ["com","davidmaletz","mining","item","_Action","SimpleBuild"]; +com_davidmaletz_mining_item__$Action_SimpleBuild.__super__ = com_davidmaletz_mining_item__$Action_AbstractBuild; +com_davidmaletz_mining_item__$Action_SimpleBuild.prototype = $extend(com_davidmaletz_mining_item__$Action_AbstractBuild.prototype,{ + doBuild: null + ,struc: null + ,flags: null + ,ignore: null + ,sfx: null + ,getWidth: function() { + return this.struc.width; + } + ,getHeight: function() { + return this.struc.height; + } + ,canPlace: function(init,x,y,showError) { + var _gthis = this; + if(showError) { + this.reset(); + } + var ret = this.checkPlaceConstraints(init,x,y,showError); + if(ret == null) { + return null; + } + x = ret.x; + y = ret.y; + var underground = (this.flags & 1) != 0; + var on_grass = (this.flags & 8) != 0; + var on_water = (this.flags & 2) != 0; + var area = this.player.getCurrentArea(); + var underwater = (this.flags & 4) != 0; + var on_air = (this.flags & 16) != 0; + var underwater_only = (this.flags & 32) != 0; + if(underwater_only) { + underground = true; + underwater = true; + } + var tx = Math.floor(ret.x / com_davidmaletz_tiles_Tile.SIZE); + var ty = Math.round(y / com_davidmaletz_tiles_Tile.SIZE); + com_davidmaletz_mining_world_Object.rectangle.setTo(x,y - this.struc.height + com_davidmaletz_tiles_Tile.SIZE,this.struc.width,this.struc.height); + var cancel = null; + var overlap = com_fancyfish_faeng_common_Lang.getTextFromTitle(this.xml.get("structure_overlap")); + if(overlap == null) { + overlap = com_fancyfish_faeng_common_Lang.getText("warning","structure_overlap"); + } + var left = x + this.struc.width; + var right = x; + var adjustBounds = function(b) { + left = com_fancyfish_faeng_common_Utils.min(left,Math.floor(b.x - _gthis.struc.width * 0.5)); + var right1 = b.get_right(); + right = com_fancyfish_faeng_common_Utils.max(right,Math.ceil(right1 + _gthis.struc.width * 0.5)); + }; + if(this.xml.get("overlapBlueprints") != "true") { + com_davidmaletz_mining_item_Action.getObjectsOrbit(area,com_davidmaletz_mining_world_Object.rectangle,function(o,rect) { + if(o.getLayer() == 1 && o.getHealth() > 0 && Std["is"](o,com_davidmaletz_mining_world_BlueprintObject)) { + if(showError) { + _gthis.showErrorObject(o); + } + cancel = overlap; + var tmp = o.getBounds(); + adjustBounds(tmp); + } + return false; + },null,0); + } + var or = com_davidmaletz_mining_world_Object.rectangle.clone(); + com_davidmaletz_mining_world_Object.rectangle.height += com_davidmaletz_tiles_Tile.SIZE; + var ae = com_davidmaletz_mining_world_Area.getXML(area.id); + var interior = ae != null && ae.get("interior") == "true" || area.vehicle != null; + area.structures.getObjects(com_davidmaletz_mining_world_Object.rectangle,function(s,rect1) { + var tmp1; + if(s != _gthis.ignore && s.info.xml.get("back") != "true" && s.info.xml.get("remove") != "false") { + var tmp2 = s.getInnerBounds(); + tmp1 = area.intersectsLoop(tmp2,or); + } else { + tmp1 = false; + } + if(tmp1) { + if(showError) { + _gthis.showErrorStructure(s); + } + cancel = overlap; + var tmp3 = s.getBounds(); + adjustBounds(tmp3); + } + return false; + },function(x1,y1) { + var b1 = com_davidmaletz_mining_world_Object.rectangle; + b1.setTo(x1 * com_davidmaletz_tiles_Tile.SIZE,y1 * com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE); + if(underwater_only && y1 >= ty) { + if(y1 == ty && !area.isWater(x1,y1)) { + if(showError) { + _gthis.showErrorTile(x1,y1); + } + if(cancel != overlap) { + cancel = com_fancyfish_faeng_common_Lang.getText("warning","structure_water"); + } + adjustBounds(b1); + } + } else if(y1 > ty) { + if(on_grass) { + if(y1 == ty + 1 && !area.isGrass(x1,y1)) { + if(showError) { + _gthis.showErrorTile(x1,y1); + } + cancel = com_fancyfish_faeng_common_Lang.getText("warning","plant_grass"); + adjustBounds(b1); + } + } else if(on_water) { + if(y1 == ty + 1 && !area.isWater(x1,y1)) { + if(showError) { + _gthis.showErrorTile(x1,y1); + } + cancel = com_fancyfish_faeng_common_Lang.getText("warning","structure_water"); + adjustBounds(b1); + } + } else if(!on_air && y1 == ty + 1 && area.emptyTile(x1,y1)) { + if(showError) { + _gthis.showErrorTile(x1,y1); + } + cancel = com_fancyfish_faeng_common_Lang.getText("warning","no_place"); + adjustBounds(b1); + } + } else if(!underwater && area.isWater(x1,y1)) { + if(showError) { + _gthis.showErrorTile(x1,y1); + } + if(cancel != overlap) { + cancel = com_fancyfish_faeng_common_Lang.getText("warning","structure_underwater"); + } + adjustBounds(b1); + } else if(!underground && !area.emptyTile(x1,y1)) { + if(showError) { + _gthis.showErrorTile(x1,y1); + } + if(cancel != overlap) { + cancel = com_fancyfish_faeng_common_Lang.getText("warning","structure_surface"); + } + adjustBounds(b1); + } else if(area.getTileId(x1,y1,0) != -1) { + if(showError) { + _gthis.showErrorTile(x1,y1); + } + if(cancel == null) { + cancel = com_fancyfish_faeng_common_Lang.getText("warning","structure_tile"); + } + adjustBounds(b1); + } else if(interior && (_gthis.flags & 64) == 0 && area.getTileId(x1,y1,3) == -1 || area.isBlockVehicle(x1,y1) || _gthis.ignore == null && area.getTileString(x1,y1,3) == "no_place" || area.isOrbit() && (y1 < 0 || y1 >= area.planet.orbit.height)) { + if(showError) { + _gthis.showErrorTile(x1,y1); + } + cancel = com_fancyfish_faeng_common_Lang.getText("warning","no_place"); + adjustBounds(b1); + } + return false; + },-1); + if(cancel != null) { + if(showError) { + this.showWarning(init,cancel,x,y); + } + if(init) { + if(right > x && right < x + this.struc.width) { + return new com_fancyfish_faeng_display_IPoint2D(right - Math.round(this.struc.width * 0.5),y); + } else if(left > x && left < x + this.struc.width) { + return new com_fancyfish_faeng_display_IPoint2D(left - Math.round(this.struc.width * 0.5),y); + } + } + return null; + } else { + return new com_fancyfish_faeng_display_IPoint2D(x,y); + } + } + ,showWarning: function(init,m,x,y) { + if(init) { + com_davidmaletz_mining_item_Action.showPlaceWarning(this.player,this.struc.tile,com_davidmaletz_mining_item_Action.getStructAnim(this.struc),x,y,m); + } else { + com_davidmaletz_mining_item_Action.showWarning(m); + } + } + ,onPlace: function(x,y) { + com_davidmaletz_faengfl_adv_sound_Sound.play(this.sfx); + if(this.doBuild != null) { + this.doBuild(this.player,x,y); + } + } + ,__class__: com_davidmaletz_mining_item__$Action_SimpleBuild +}); +var com_davidmaletz_mining_item__$Action_Build = function(p,i,s,flags,e,ignore) { + com_davidmaletz_mining_item__$Action_SimpleBuild.call(this,p,null,i,s,flags,e,ignore); + this.item = i; +}; +$hxClasses["com.davidmaletz.mining.item._Action.Build"] = com_davidmaletz_mining_item__$Action_Build; +com_davidmaletz_mining_item__$Action_Build.__name__ = ["com","davidmaletz","mining","item","_Action","Build"]; +com_davidmaletz_mining_item__$Action_Build.__super__ = com_davidmaletz_mining_item__$Action_SimpleBuild; +com_davidmaletz_mining_item__$Action_Build.prototype = $extend(com_davidmaletz_mining_item__$Action_SimpleBuild.prototype,{ + item: null + ,onPlace: function(x,y) { + com_davidmaletz_mining_item__$Action_SimpleBuild.prototype.onPlace.call(this,x,y); + var o = js_Boot.__cast(com_davidmaletz_mining_world_ObjectInfo.get("blueprint").create(x,y) , com_davidmaletz_mining_world_BlueprintObject); + o.setBlueprint(this.item); + this.player.getCurrentArea().addObject(o); + if(com_davidmaletz_mining_Player.BLUEPRINT_PLACE) { + o.startBuild(this.player); + } + } + ,__class__: com_davidmaletz_mining_item__$Action_Build +}); +var com_davidmaletz_mining_item__$Action_Plant = function(p,doPlant,e,width,height,item) { + com_davidmaletz_mining_item__$Action_AbstractBuild.call(this,p,e); + this.sfx = com_davidmaletz_mining_item_Action.resolve(item,e,"place"); + this.doPlant = doPlant; + this.width = width; + this.height = height; + this.flags = com_davidmaletz_mining_item_Action.parseFlags(this.xml,true); +}; +$hxClasses["com.davidmaletz.mining.item._Action.Plant"] = com_davidmaletz_mining_item__$Action_Plant; +com_davidmaletz_mining_item__$Action_Plant.__name__ = ["com","davidmaletz","mining","item","_Action","Plant"]; +com_davidmaletz_mining_item__$Action_Plant.__super__ = com_davidmaletz_mining_item__$Action_AbstractBuild; +com_davidmaletz_mining_item__$Action_Plant.prototype = $extend(com_davidmaletz_mining_item__$Action_AbstractBuild.prototype,{ + doPlant: null + ,width: null + ,height: null + ,flags: null + ,sfx: null + ,getWidth: function() { + return this.width; + } + ,getHeight: function() { + return this.height; + } + ,isWater: function(area,x,y) { + if(area.isWater(x,y)) { + return true; + } + var s = area.getStructureInTile(x,y); + if(s != null && s.info.xml.get("type") == "dock") { + return area.getTileString(x,y,0) == "empty"; + } else { + return false; + } + } + ,canPlace: function(init,x,y,showError) { + var _gthis = this; + if(showError) { + this.reset(); + } + var underground = (this.flags & 1) != 0; + var on_grass = (this.flags & 8) != 0; + var on_water = (this.flags & 2) != 0; + var area = this.player.getCurrentArea(); + var underwater = (this.flags & 4) != 0; + var on_air = (this.flags & 16) != 0; + var underwater_only = (this.flags & 32) != 0; + if(underwater_only) { + underground = true; + underwater = true; + } + var ret = this.checkPlaceConstraints(init,x,y,showError); + if(ret == null) { + return null; + } + x = ret.x; + y = ret.y; + var ty = Math.round(y / com_davidmaletz_tiles_Tile.SIZE); + com_davidmaletz_mining_world_Object.rectangle.setTo(x,y - this.height + com_davidmaletz_tiles_Tile.SIZE,this.width,this.height); + var cancel = null; + var overlap = com_fancyfish_faeng_common_Lang.getText("warning","plant_structure"); + var left = x + this.width; + var right = x; + var adjustBounds = function(b) { + left = com_fancyfish_faeng_common_Utils.min(left,Math.floor(b.x - _gthis.width * 0.5)); + var right1 = b.get_right(); + right = com_fancyfish_faeng_common_Utils.max(right,Math.ceil(right1 + _gthis.width * 0.5)); + }; + if(this.xml.get("overlapBlueprints") != "true") { + com_davidmaletz_mining_item_Action.getObjectsOrbit(area,com_davidmaletz_mining_world_Object.rectangle,function(o,rect) { + if(o.getLayer() == 1 && (o.getHealth() > 0 && Std["is"](o,com_davidmaletz_mining_world_BlueprintObject))) { + if(showError) { + _gthis.showErrorObject(o); + } + cancel = overlap; + var tmp = o.getBounds(); + adjustBounds(tmp); + } + return false; + },null,0); + } + var or = com_davidmaletz_mining_world_Object.rectangle.clone(); + com_davidmaletz_mining_world_Object.rectangle.height += com_davidmaletz_tiles_Tile.SIZE; + var ae = com_davidmaletz_mining_world_Area.getXML(area.id); + var interior = ae != null && ae.get("interior") == "true" || area.vehicle != null; + var room = null; + area.structures.getObjects(com_davidmaletz_mining_world_Object.rectangle,function(s,rect1) { + var tmp1; + if(s.info.xml.get("back") != "true" && s.info.xml.get("remove") != "false") { + var tmp2 = s.getInnerBounds(); + tmp1 = area.intersectsLoop(tmp2,or); + } else { + tmp1 = false; + } + if(tmp1) { + if(s.info.room && room == null) { + room = s; + } + if(_gthis.xml.get("overlapStructures") != "true") { + if(showError) { + _gthis.showErrorStructure(s); + } + cancel = overlap; + var tmp3 = s.getBounds(); + adjustBounds(tmp3); + } + } + return false; + },function(x1,y1) { + var b1 = com_davidmaletz_mining_world_Object.rectangle; + b1.setTo(x1 * com_davidmaletz_tiles_Tile.SIZE,y1 * com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE); + if(underwater_only && y1 >= ty) { + if(y1 == ty && !area.isWater(x1,y1)) { + if(showError) { + _gthis.showErrorTile(x1,y1); + } + if(cancel != overlap) { + cancel = com_fancyfish_faeng_common_Lang.getText("warning","structure_water"); + } + adjustBounds(b1); + } + } else if(y1 > ty) { + if(on_grass) { + if(y1 == ty + 1 && !area.isGrass(x1,y1)) { + if(showError) { + _gthis.showErrorTile(x1,y1); + } + cancel = com_fancyfish_faeng_common_Lang.getText("warning","plant_grass"); + adjustBounds(b1); + } + } else if(on_water) { + if(y1 == ty + 1 && !_gthis.isWater(area,x1,y1)) { + if(showError) { + _gthis.showErrorTile(x1,y1); + } + cancel = com_fancyfish_faeng_common_Lang.getText("warning","structure_water"); + adjustBounds(b1); + } + } else if(!on_air && y1 == ty + 1 && area.emptyTile(x1,y1)) { + if(showError) { + _gthis.showErrorTile(x1,y1); + } + cancel = com_fancyfish_faeng_common_Lang.getText("warning","no_place"); + adjustBounds(b1); + } + } else if(!underwater && area.isWater(x1,y1)) { + if(showError) { + _gthis.showErrorTile(x1,y1); + } + if(cancel != overlap) { + cancel = com_fancyfish_faeng_common_Lang.getText("warning","structure_underwater"); + } + adjustBounds(b1); + } else if(!underground && (interior || !area.isEmptyTile(x1,y1))) { + if(showError) { + _gthis.showErrorTile(x1,y1); + } + if(cancel != overlap) { + cancel = com_fancyfish_faeng_common_Lang.getText("warning","structure_surface"); + } + adjustBounds(b1); + } else if(area.getTileId(x1,y1,0) != -1) { + if(showError) { + _gthis.showErrorTile(x1,y1); + } + if(cancel == null) { + cancel = com_fancyfish_faeng_common_Lang.getText("warning","structure_tile"); + } + adjustBounds(b1); + } else if(interior && (_gthis.flags & 64) == 0 && area.getTileId(x1,y1,3) == -1 || area.isBlockVehicle(x1,y1) || area.getTileString(x1,y1,3) == "no_place" || area.isOrbit() && (y1 < 0 || y1 >= area.planet.orbit.height)) { + if(showError) { + _gthis.showErrorTile(x1,y1); + } + cancel = com_fancyfish_faeng_common_Lang.getText("warning","no_place"); + adjustBounds(b1); + } + return false; + },-1); + if(room != null && !room.getInnerBounds().containsRect(or)) { + if(showError) { + this.showErrorStructure(room); + } + if(cancel == null) { + cancel = com_fancyfish_faeng_common_Lang.getText("warning","place_rooms"); + } + var tmp4 = room.getBounds(); + adjustBounds(tmp4); + } + if(cancel != null) { + if(showError) { + this.showWarning(init,cancel,x,y); + } + if(init) { + if(right > x && right < x + this.width) { + return new com_fancyfish_faeng_display_IPoint2D(right - Math.round(this.width * 0.5),y); + } else if(left > x && left < x + this.width) { + return new com_fancyfish_faeng_display_IPoint2D(left - Math.round(this.width * 0.5),y); + } + } + return null; + } else { + return new com_fancyfish_faeng_display_IPoint2D(x,y); + } + } + ,onPlace: function(x,y) { + com_davidmaletz_faengfl_adv_sound_Sound.play(this.sfx); + this.doPlant(this.player,x,y); + } + ,__class__: com_davidmaletz_mining_item__$Action_Plant +}); +var com_davidmaletz_mining_item_CropSlot = function(s) { + openfl_events_EventDispatcher.call(this); + this.info = null; + this.items = []; + this.percent = 0; + this.structure = s; +}; +$hxClasses["com.davidmaletz.mining.item.CropSlot"] = com_davidmaletz_mining_item_CropSlot; +com_davidmaletz_mining_item_CropSlot.__name__ = ["com","davidmaletz","mining","item","CropSlot"]; +com_davidmaletz_mining_item_CropSlot.__interfaces__ = [com_davidmaletz_mining_ui_InfoItem]; +com_davidmaletz_mining_item_CropSlot.oldMap = null; +com_davidmaletz_mining_item_CropSlot.makeOldMap = function() { + var ret = new haxe_ds_StringMap(); + ret.set("wheat",["wheat"]); + ret.set("orchard",["wood","fruit"]); + ret.set("sugar",["sugar"]); + ret.set("cotton",["cotton"]); + ret.set("pumpkin",["pumpkin"]); + ret.set("pig",["meat","milk","eggs"]); + ret.set("cow",["meat","milk"]); + ret.set("chicken",["meat","eggs"]); + ret.set("wyrm",["dragonblood"]); + ret.set("cocoon",[]); + ret.set("dragon",["dragonblood"]); + return ret; +}; +com_davidmaletz_mining_item_CropSlot.__super__ = openfl_events_EventDispatcher; +com_davidmaletz_mining_item_CropSlot.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + info: null + ,items: null + ,percent: null + ,structure: null + ,onCropChanged: function(name) { + com_fancyfish_faeng_common_Utils.clear(this.items); + if(this.info != null) { + var i = this.info.iterator(); + while(i.hasNext()) { + var i1 = i.next(); + this.items.push(new com_davidmaletz_mining_item_FarmItem(this,i1,name)); + } + if(this.info.xml != null && this.info.xml.exists("achievement")) { + com_davidmaletz_faengfl_achievement_Achievements.instance.gainAchievement(this.info.xml.get("achievement")); + } + } + } + ,setCrop: function(i) { + if(i != this.info) { + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("prepare_change_crop",this)); + this.info = i; + this.onCropChanged(); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("update_crop",this)); + } + } + ,canHarvest: function() { + var _g = 0; + var _g1 = this.items; + while(_g < _g1.length) { + var i = _g1[_g]; + ++_g; + if(i.isComplete()) { + return true; + } + } + return false; + } + ,canProgress: function() { + var _g = 0; + var _g1 = this.items; + while(_g < _g1.length) { + var i = _g1[_g]; + ++_g; + if(i.canProgress()) { + return true; + } + } + return false; + } + ,harvest: function(addItem) { + var _g = 0; + var _g1 = this.items; + while(_g < _g1.length) { + var i = _g1[_g]; + ++_g; + var ct = i.harvest(); + if(ct > 0) { + var item = com_davidmaletz_mining_item_ItemInfo.get(i.info.item); + if(item != null) { + addItem(item,ct); + } + } + } + } + ,getPercent: function() { + return this.percent / this.getMaxPercent(); + } + ,complete: function() { + } + ,getMaxPercent: function() { + return 10000; + } + ,setPercent: function(p) { + var max = this.getMaxPercent(); + if(p >= max) { + p = max; + } + if(p < 0) { + p = 0; + } + if(p != this.percent) { + var d = p - this.percent; + this.percent = p; + if(p == max) { + this.complete(); + } + this.dispatchEvent(new com_davidmaletz_faengfl_events_IntEvent("update_percent",d)); + } + } + ,isEmpty: function() { + return this.info == null; + } + ,hasFarmItem: function() { + return this.items.length > 0; + } + ,getFarmItem: function(i) { + return this.items[i]; + } + ,iterator: function() { + return HxOverrides.iter(this.items); + } + ,getTickSpeed: function() { + if(this.canProgress() && this.percent >= 1) { + this.setPercent(this.percent - 1); + return 4; + } else { + return 1; + } + } + ,tick: function(frames) { + var speed = this.getTickSpeed(); + var _g = 0; + var _g1 = this.items; + while(_g < _g1.length) { + var i = _g1[_g]; + ++_g; + i.tick(speed * frames); + } + } + ,write: function(b) { + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.info == null ? null : this.info.id); + b.writeUInt16(this.percent); + var _g = 0; + var _g1 = this.items; + while(_g < _g1.length) { + var i = _g1[_g]; + ++_g; + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,i.info.item); + b.writeUInt16(i.growth); + } + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + } + ,loadItem: function(id,growth) { + var _g = 0; + var _g1 = this.items; + while(_g < _g1.length) { + var i = _g1[_g]; + ++_g; + if(i.info.item == id) { + i.growth = growth; + break; + } + } + } + ,read: function(b,version) { + this.setCrop(com_davidmaletz_mining_item_CropInfo.get(com_fancyfish_faeng_common_UTFUtils.readUTF(b))); + if(version >= 20) { + this.percent = b.readUInt16(); + var id; + while(true) { + id = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(!(id != null)) { + break; + } + this.loadItem(id,b.readUInt16()); + } + } else if(version >= 18 && this.info != null) { + if(com_davidmaletz_mining_item_CropSlot.oldMap == null) { + com_davidmaletz_mining_item_CropSlot.oldMap = com_davidmaletz_mining_item_CropSlot.makeOldMap(); + } + var _g = 0; + var _g1 = com_davidmaletz_mining_item_CropSlot.oldMap.get(this.info.id); + while(_g < _g1.length) { + var id1 = _g1[_g]; + ++_g; + this.loadItem(id1,b.readUInt16()); + } + } + } + ,getMaxFertilizer: function(item,floor) { + if(floor == null) { + floor = false; + } + var v = (this.getMaxPercent() - this.percent) / com_davidmaletz_mining_Main.parseInt(item.item.xml.get("fertilizer")); + var max = floor ? Math.floor(v) : Math.ceil(v); + if(max > item.count) { + return item.count; + } else { + return max; + } + } + ,addFertilizer: function(item,ct) { + this.setPercent(this.percent + com_davidmaletz_mining_Main.parseInt(item.xml.get("fertilizer")) * ct); + } + ,getName: function() { + return this.info.getName(); + } + ,createIcon: function() { + return this.info.createIcon(); + } + ,getElement: function() { + return this.info.getElement(); + } + ,addInfo: function(s,w,x,y) { + return com_davidmaletz_mining_item_CropInfo.addProduction(s,w,x,y,this.iterator(),"produces"); + } + ,__class__: com_davidmaletz_mining_item_CropSlot +}); +var com_davidmaletz_mining_item_ItemValue = function() { }; +$hxClasses["com.davidmaletz.mining.item.ItemValue"] = com_davidmaletz_mining_item_ItemValue; +com_davidmaletz_mining_item_ItemValue.__name__ = ["com","davidmaletz","mining","item","ItemValue"]; +com_davidmaletz_mining_item_ItemValue.prototype = { + setName: null + ,increaseValue: null + ,remove: null + ,getItem: null + ,__class__: com_davidmaletz_mining_item_ItemValue +}; +var com_davidmaletz_mining_item_Animal = function(s,accept,pre) { + if(pre == null) { + pre = ""; + } + this.name = null; + this.time = 0; + com_davidmaletz_mining_item_CropSlot.call(this,s); + this.acceptAnimal = accept; + this.prefix = pre; +}; +$hxClasses["com.davidmaletz.mining.item.Animal"] = com_davidmaletz_mining_item_Animal; +com_davidmaletz_mining_item_Animal.__name__ = ["com","davidmaletz","mining","item","Animal"]; +com_davidmaletz_mining_item_Animal.__interfaces__ = [com_davidmaletz_mining_item_ItemValue]; +com_davidmaletz_mining_item_Animal.__super__ = com_davidmaletz_mining_item_CropSlot; +com_davidmaletz_mining_item_Animal.prototype = $extend(com_davidmaletz_mining_item_CropSlot.prototype,{ + prefix: null + ,acceptAnimal: null + ,time: null + ,name: null + ,tick: function(frames) { + com_davidmaletz_mining_item_CropSlot.prototype.tick.call(this,frames); + if(this.time != 0) { + this.setPercent(this.percent + this.time * frames); + } + } + ,getTickSpeed: function() { + return 1; + } + ,_name: null + ,setPercent: function(p) { + com_davidmaletz_mining_item_CropSlot.prototype.setPercent.call(this,p); + if(this.itemCache != null) { + this.itemCache.setValue(this.getMaxPercent() - this.percent); + } + } + ,onCropChanged: function(ignored) { + this.itemCache = null; + this.percent = 0; + this.dispatchEvent(new com_davidmaletz_faengfl_events_IntEvent("update_percent",-30000)); + com_davidmaletz_mining_item_CropSlot.prototype.onCropChanged.call(this,this._name); + this.time = 0; + this.setName(null,this._name); + this._name = null; + if(this.info != null) { + var i = this.info.xml.elementsNamed("grow"); + if(i.hasNext()) { + var xml = i.next(); + if(xml.exists("time")) { + this.time = Math.round(this.getMaxPercent() / (com_davidmaletz_mining_Main.parseFloat(xml.get("time")) * 200)); + } + } + } + } + ,getMaxPercent: function() { + if(this.info != null) { + return com_fancyfish_faeng_common_Utils.max(com_davidmaletz_mining_item_ItemInfo.get(HxOverrides.substr(this.info.id,this.prefix.length,null)).getDurability(),1); + } else { + return 1; + } + } + ,setItem: function(i) { + if(i != null) { + this._name = i.getNameStr(); + } else { + this._name = null; + } + this.setCrop(i == null ? null : com_davidmaletz_mining_item_CropInfo.get(this.prefix + i.info.id)); + if(i != null) { + this.setPercent(this.getMaxPercent() - i.value); + } + } + ,itemCache: null + ,setName: function(p,n) { + if(this.name != n) { + this.name = n; + if(this.itemCache != null) { + this.itemCache.setName(n); + } + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("update_name",this.name)); + } + } + ,increaseValue: function(p,dv) { + this.setPercent(this.percent - dv); + } + ,remove: function(p) { + this.setItem(null); + } + ,getItem: function(p) { + if(this.itemCache == null) { + this.itemCache = this.info == null ? null : new com_davidmaletz_mining_item_Item(com_davidmaletz_mining_item_ItemInfo.get(HxOverrides.substr(this.info.id,this.prefix.length,null)),this.getMaxPercent() - this.percent,this.name); + } + return this.itemCache; + } + ,complete: function() { + if(this.info != null) { + var i = this.info.xml.elementsNamed("grow"); + if(i.hasNext()) { + var xml = i.next(); + this.setItem(new com_davidmaletz_mining_item_Item(com_davidmaletz_mining_item_ItemInfo.get(xml.get("to")),xml.exists("value") ? com_davidmaletz_mining_Main.parseInt(xml.get("value")) : 0,this.name)); + if(xml.exists("achievement")) { + com_davidmaletz_faengfl_achievement_Achievements.instance.gainAchievement(xml.get("achievement")); + } + } + } + } + ,write: function(b) { + com_davidmaletz_mining_item_CropSlot.prototype.write.call(this,b); + if(this.info != null) { + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.name); + } + } + ,read: function(b,version) { + com_davidmaletz_mining_item_CropSlot.prototype.read.call(this,b,version); + if(version < 20) { + this.percent = b.readUInt16(); + } + if(version < 41) { + if(this.percent == 0 && this.info != null && this.info.id != "wyrm" && this.info.id != "cocoon") { + this.percent = this.getMaxPercent(); + } else { + this.percent = Math.floor(this.percent / com_davidmaletz_mining_item_CropSlot.prototype.getMaxPercent.call(this) * this.getMaxPercent()); + } + } + if(version >= 33 && this.info != null) { + this.name = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + } + } + ,renderer: null + ,getRenderer: function(first) { + if(this.renderer == null) { + this.renderer = new com_davidmaletz_mining_renderer_AnimalRenderer(this,first); + } + return this.renderer; + } + ,getName: function() { + return this.getItem(null).getName(); + } + ,createIcon: function() { + return this.getItem(null).createIcon(); + } + ,getElement: function() { + return this.getItem(null).getElement(); + } + ,addInfo: function(s,w,x,y) { + return com_davidmaletz_mining_item_CropSlot.prototype.addInfo.call(this,s,w,x,this.getItem(null).addInfo(s,w,x,y)); + } + ,__class__: com_davidmaletz_mining_item_Animal +}); +var com_davidmaletz_mining_item_BaseInventory = function() { + openfl_events_EventDispatcher.call(this); +}; +$hxClasses["com.davidmaletz.mining.item.BaseInventory"] = com_davidmaletz_mining_item_BaseInventory; +com_davidmaletz_mining_item_BaseInventory.__name__ = ["com","davidmaletz","mining","item","BaseInventory"]; +com_davidmaletz_mining_item_BaseInventory.__interfaces__ = [AbstractClass]; +com_davidmaletz_mining_item_BaseInventory.startsWith = function(name,params) { + if(name == null) { + return params == null; + } else if(params == null) { + return name.indexOf("&") <= 0; + } else { + return StringTools.startsWith(name,params); + } +}; +com_davidmaletz_mining_item_BaseInventory.__super__ = openfl_events_EventDispatcher; +com_davidmaletz_mining_item_BaseInventory.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + addItems: function(item,count,value,name) { + if(value == null) { + value = 0; + } + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,addItemCount: function(item,count) { + this.addItems(item,count); + } + ,getItem: function(item) { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,selectItem: function(item,value,name) { + if(item == null) { + return null; + } else if(this.getItemValueCount(item,value,name) > 0) { + return new com_davidmaletz_mining_item_Item(item,value,name); + } else { + var i = this.getItem(item); + if(i == null) { + return null; + } + var v = i.getItemValues(); + if(v.hasNext()) { + var val = v.next(); + return new com_davidmaletz_mining_item_Item(val.item,val.value,val.name); + } else { + return null; + } + } + } + ,selectMaxValue: function(item,name) { + var i = this.getItem(item); + if(i == null) { + return null; + } + var v = i.getItemValues(); + var max = null; + while(v.hasNext()) { + var val = v.next(); + if(com_davidmaletz_mining_item_BaseInventory.startsWith(val.name,name) && (max == null || max.value < val.value)) { + max = val; + } + } + if(max == null) { + return null; + } else { + return new com_davidmaletz_mining_item_Item(max.item,max.value,max.name); + } + } + ,getItemCount: function(item) { + var i = this.getItem(item); + if(i == null) { + return 0; + } else { + return i.count; + } + } + ,getItemValueCount: function(item,value,name) { + var i = this.getItem(item); + if(i == null) { + return 0; + } else { + return i.getValueCount(value,name); + } + } + ,setItemCount: function(item,count) { + return this.addItems(item,count - this.getItemCount(item)); + } + ,getItemNameCount: function(item,name) { + var i = this.getItem(item); + if(i == null) { + return 0; + } + var v = i.getItemValues(); + var ret = 0; + while(v.hasNext()) { + var val = v.next(); + if(com_davidmaletz_mining_item_BaseInventory.startsWith(val.name,name)) { + ret += val.count; + } + } + return ret; + } + ,getItems: function(itemFilter,sort) { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,canCraft: function(p,r,ct) { + if(ct == null) { + ct = 1; + } + var req = r.getRequirements(); + while(req.hasNext()) { + var req1 = req.next(); + if(!req1.hasItems(p,this,ct)) { + return false; + } + } + return true; + } + ,maxCraft: function(p,r) { + var max = 9999; + var req = r.getRequirements(); + while(req.hasNext()) { + var req1 = req.next(); + var m = req1.getMaxCount(p,this); + if(m < max) { + max = m; + } + } + return max; + } + ,craft: function(r,ct) { + if(ct == null) { + ct = 1; + } + if(this.useIngredients(r,ct)) { + r.gainAchievement(); + this.addItems(r.creates.item,ct * r.creates.count,r.creates.value,r.creates.name); + return true; + } else { + return false; + } + } + ,useIngredients: function(r,ct) { + if(ct == null) { + ct = 1; + } + if(!this.canCraft(null,r,ct)) { + return false; + } + var req = r.getRequirements(); + while(req.hasNext()) { + var req1 = req.next(); + req1.useResources(this,ct); + } + return true; + } + ,addIngredients: function(r,ct) { + if(ct == null) { + ct = 1; + } + var req = r.getRequirements(); + while(req.hasNext()) { + var req1 = req.next(); + var i = req1.getItem(); + if(i != null) { + this.addItems(i,req1.count * ct); + } + } + } + ,changeValue: function(item,name,from,to) { + if(item.xml.exists("durability")) { + if(to < 0) { + to = 0; + } + var d = com_davidmaletz_mining_Main.parseInt(item.xml.get("durability")); + if(to >= d && item.xml.get("breakable") != "false") { + this.addItems(item,-1,from,name); + var b = item.getBroken(name); + if(b != null) { + this.addItems(b.info,1,b.value,b.getNameStr()); + } + } else { + this.addItems(item,-1,from,name); + this.addItems(item,1,to,name); + } + } + } + ,addAll: function(inv) { + var i = inv.items.iterator(); + while(i.hasNext()) { + var i1 = i.next(); + var v = i1.getItemValues(); + while(v.hasNext()) { + var v1 = v.next(); + this.addItems(v1.item,v1.count,v1.value,v1.name); + } + } + } + ,__class__: com_davidmaletz_mining_item_BaseInventory +}); +var com_davidmaletz_mining_item_BlueprintPos = function(area,tile,anim,align,x,y,w,h,dx,dy,canPlace,onPlace,onCancel,onClose,killBush,rx,ry,frames) { + if(frames == null) { + frames = 0; + } + if(killBush == null) { + killBush = true; + } + this.barrier = 0; + this.partial = 0; + var _gthis = this; + com_davidmaletz_tiles_render_StaticPlayAnimation.call(this,tile,anim,10,true); + this.canPlace = canPlace; + this.onPlace = onPlace; + this.onCancel = onCancel; + this.area = area; + if(rx == null) { + rx = 256; + } + if(ry == null) { + ry = 144; + } + this.rangeX = rx; + this.rangeY = ry; + if(killBush) { + this.red = []; + } + this.offsetX = dx; + this.offsetY = dy; + this.alignTile = align; + this.oldScale = com_davidmaletz_mining_Main.getGameScale(); + if(w > 192. || h > 108.) { + com_davidmaletz_mining_Main.setGameScale(2); + } + var fromX = area.get_x(); + var fromY = area.get_y(); + this._width = w; + this._height = h; + this.sx = x; + this.sy = y; + this.updatePos(x,y); + this.set_alpha(0.7); + if(frames > 0 && (area.get_x() != fromX || area.get_y() != fromY)) { + var toX = area.get_x(); + var toY = area.get_y(); + area.set_x(fromX); + area.set_y(fromY); + var modal = new com_davidmaletz_faengfl_transition_LerpModal(area,null); + area.lerp(new com_davidmaletz_mining_npc_FakePositionKeyframe(toX,toY),frames,function() { + modal.kill(null); + _gthis.begin(onClose); + }); + } else { + this.begin(onClose); + } +}; +$hxClasses["com.davidmaletz.mining.item.BlueprintPos"] = com_davidmaletz_mining_item_BlueprintPos; +com_davidmaletz_mining_item_BlueprintPos.__name__ = ["com","davidmaletz","mining","item","BlueprintPos"]; +com_davidmaletz_mining_item_BlueprintPos.clamp = function(start,val,range) { + return com_fancyfish_faeng_common_Utils.clampi(val,start - range,start + range); +}; +com_davidmaletz_mining_item_BlueprintPos.adjust = function(st,d) { + if(d > 0) { + var n = Math.ceil((st + 1) / com_davidmaletz_tiles_Tile.SIZE) * com_davidmaletz_tiles_Tile.SIZE; + return com_fancyfish_faeng_common_Utils.min(st + d,n); + } else { + var n1 = Math.floor((st - 1) / com_davidmaletz_tiles_Tile.SIZE) * com_davidmaletz_tiles_Tile.SIZE; + return com_fancyfish_faeng_common_Utils.max(st + d,n1); + } +}; +com_davidmaletz_mining_item_BlueprintPos.__super__ = com_davidmaletz_tiles_render_StaticPlayAnimation; +com_davidmaletz_mining_item_BlueprintPos.prototype = $extend(com_davidmaletz_tiles_render_StaticPlayAnimation.prototype,{ + red: null + ,oldScale: null + ,canPlace: null + ,onPlace: null + ,onCancel: null + ,area: null + ,_x: null + ,_y: null + ,modal: null + ,offsetX: null + ,_width: null + ,_height: null + ,offsetY: null + ,alignTile: null + ,sx: null + ,sy: null + ,rangeX: null + ,rangeY: null + ,begin: function(onClose) { + this.modal = new com_davidmaletz_mining_item__$BlueprintPos_Modal(this); + this.modal.onClose = onClose; + this.area.addChild(this); + } + ,destroy: function(e) { + com_davidmaletz_tiles_render_StaticPlayAnimation.prototype.destroy.call(this,e); + if(this.red != null && e != null) { + var _g = 0; + var _g1 = this.red; + while(_g < _g1.length) { + var r = _g1[_g]; + ++_g; + r.updateTint(); + } + } + if(e != null) { + com_davidmaletz_mining_Main.setGameScale(this.oldScale); + } + } + ,updateRed: function(o,r) { + if(o.getLayer() == 1 && o.info.xml.get("removable") != "false" && this.red.indexOf(o) == -1) { + this.red.push(o); + var r1 = o.renderer; + if(r1 != null) { + com_davidmaletz_faengfl_TextSprite.setColor(r1,16724787,255,1,2.5); + } + } + return false; + } + ,updatePos: function(nx,ny) { + var p = this.canPlace(nx,ny,false); + this._x = p == null ? nx : p.x; + this._y = p == null ? ny : p.y; + this.set_x(Math.round(this._x + this.offsetX)); + var ht = this.tile.getTileHeight(0,0); + this.set_y(this._y + com_davidmaletz_tiles_Tile.SIZE - ht + this.offsetY); + if(p != null) { + com_davidmaletz_faengfl_TextSprite.setColor(this,3407667,255,1,2); + } else { + com_davidmaletz_faengfl_TextSprite.setColor(this,16724787,255,1,2.5); + } + this.area.centerOn(this.get_x() + this.tile.getTileWidth(0,0) * 0.5,this._y - (ht > 288 ? 144 : ht * 0.5) + com_davidmaletz_tiles_Tile.SIZE * 1.5,true,true); + if(this.red != null) { + var _g = 0; + var _g1 = this.red; + while(_g < _g1.length) { + var r = _g1[_g]; + ++_g; + r.updateTint(); + } + com_fancyfish_faeng_common_Utils.clear(this.red); + this.area.area.getObjects(new openfl_geom_Rectangle(this._x,this._y - this._height + com_davidmaletz_tiles_Tile.SIZE,this._width,this._height),$bind(this,this.updateRed),null,0); + } + } + ,cancel: function() { + this.onCancel(); + com_davidmaletz_faengfl_FaengFL.remove(this); + } + ,place: function() { + var p = this.canPlace(this._x,this._y,true); + if(p != null) { + this.onPlace(p.x,p.y); + com_davidmaletz_faengfl_FaengFL.remove(this); + return true; + } else { + return false; + } + } + ,partial: null + ,barrier: null + ,move: function(dx,dy,frames) { + if(this.rangeX == 0) { + dx = 0; + } + if(this.rangeY == 0) { + dy = 0; + } + if(dx == 0 && dy == 0) { + return; + } + var s = 3 * frames; + var a = this.alignTile || dy != 0; + if(com_davidmaletz_faengfl_adv_AdvApp.shiftDown) { + if(a) { + s = 2; + } else { + s = 0.25; + } + } + if(a) { + s /= com_davidmaletz_tiles_Tile.SIZE; + } + var speed = Math.floor(s); + this.partial += s - speed; + if(this.partial >= 1) { + ++speed; + this.partial -= 1; + } + if(speed == 0) { + return; + } + if(!a && !com_davidmaletz_faengfl_adv_AdvApp.shiftDown) { + if(this.barrier > 0) { + this.barrier -= speed; + if(this.barrier >= 0) { + return; + } + speed = -this.barrier; + this.barrier = 0; + } + if(speed == 0) { + return; + } + } + var ht = com_fancyfish_faeng_common_Utils.max(this.rangeY,Math.ceil(this._height / com_davidmaletz_tiles_Tile.SIZE + 1) * com_davidmaletz_tiles_Tile.SIZE); + if(a) { + this.updatePos(com_davidmaletz_mining_item_BlueprintPos.clamp(this.sx,this._x + dx * speed * com_davidmaletz_tiles_Tile.SIZE,this.rangeX),com_davidmaletz_mining_item_BlueprintPos.clamp(this.sy,this._y + dy * speed * com_davidmaletz_tiles_Tile.SIZE,ht)); + } else if(dx != 0) { + this.updatePos(com_davidmaletz_mining_item_BlueprintPos.clamp(this.sx,com_davidmaletz_mining_item_BlueprintPos.adjust(this._x,dx * speed),this.rangeX),com_davidmaletz_mining_item_BlueprintPos.clamp(this.sy,this._y,ht)); + if(this._x % com_davidmaletz_tiles_Tile.SIZE == 0) { + this.barrier = 20; + } + } else { + this.updatePos(com_davidmaletz_mining_item_BlueprintPos.clamp(this.sx,this._x,this.rangeX),com_davidmaletz_mining_item_BlueprintPos.clamp(this.sy,com_davidmaletz_mining_item_BlueprintPos.adjust(this._y,dy * speed),ht)); + if(this._y % com_davidmaletz_tiles_Tile.SIZE == 0) { + this.barrier = 20; + } + } + } + ,canCancel: function() { + return this.onCancel != null; + } + ,__class__: com_davidmaletz_mining_item_BlueprintPos +}); +var com_davidmaletz_mining_item__$BlueprintPos_Modal = function(p) { + com_davidmaletz_faengfl_transition_Transition.call(this); + this.pos = p; + var build = new com_davidmaletz_mining_ui_KeyTooltip(false,"select",128.,16,com_fancyfish_faeng_common_Lang.getText("actions","place"),16777215,-16777216,false,$bind(this,this.onEmptySelect)); + this.addChild(build); + if(p.rangeX > 0 || p.rangeY > 0) { + var keys = " [key=left][key=up][key=down][key=right]"; + if(p.rangeY <= 0) { + keys = "[key=left][key=right]"; + } else if(p.rangeX <= 0) { + keys = "[key=up][key=down]"; + } + var move = new com_davidmaletz_faengfl_ui_Tooltip(128.,128,new com_fancyfish_faeng_common_mutable_Concat(com_fancyfish_faeng_common_Lang.getText("common","move"),keys),16777215,-16777216,null,true); + this.addChild(move); + } + if(this.pos.canCancel()) { + var cancel = new com_davidmaletz_mining_ui_KeyTooltip(false,"cancel",128.,112,com_fancyfish_faeng_common_Lang.getText("common","cancel"),16777215,-16777216,false,$bind(this,this.onCancel)); + this.addChild(cancel); + cancel.show(true); + } + this.add(); +}; +$hxClasses["com.davidmaletz.mining.item._BlueprintPos.Modal"] = com_davidmaletz_mining_item__$BlueprintPos_Modal; +com_davidmaletz_mining_item__$BlueprintPos_Modal.__name__ = ["com","davidmaletz","mining","item","_BlueprintPos","Modal"]; +com_davidmaletz_mining_item__$BlueprintPos_Modal.__super__ = com_davidmaletz_faengfl_transition_Transition; +com_davidmaletz_mining_item__$BlueprintPos_Modal.prototype = $extend(com_davidmaletz_faengfl_transition_Transition.prototype,{ + pos: null + ,onCancel: function() { + if(this.pos.canCancel()) { + this.pos.cancel(); + this.remove(); + } + } + ,onEmptySelect: function() { + if(this.pos.place()) { + this.remove(); + } + } + ,handle_frame: function(e) { + var left = com_davidmaletz_controls_Controller.instance.isPressed(4); + var right = com_davidmaletz_controls_Controller.instance.isPressed(6); + var up = com_davidmaletz_controls_Controller.instance.isPressed(0); + var down = com_davidmaletz_controls_Controller.instance.isPressed(2); + if((left || right) && left != right) { + this.pos.move(left ? -1 : 1,0,com_davidmaletz_faengfl_FaengFL.frameTime); + } else if((up || down) && up != down) { + this.pos.move(0,up ? -1 : 1,com_davidmaletz_faengfl_FaengFL.frameTime); + } else { + this.pos.barrier = 0; + } + } + ,__class__: com_davidmaletz_mining_item__$BlueprintPos_Modal +}); +var com_davidmaletz_mining_item_CompositeFarmItem = function(item) { + openfl_events_EventDispatcher.call(this); + this.item = item; + this.items = []; + this.crops = []; +}; +$hxClasses["com.davidmaletz.mining.item.CompositeFarmItem"] = com_davidmaletz_mining_item_CompositeFarmItem; +com_davidmaletz_mining_item_CompositeFarmItem.__name__ = ["com","davidmaletz","mining","item","CompositeFarmItem"]; +com_davidmaletz_mining_item_CompositeFarmItem.__interfaces__ = [com_davidmaletz_mining_ui_InfoItem]; +com_davidmaletz_mining_item_CompositeFarmItem.__super__ = openfl_events_EventDispatcher; +com_davidmaletz_mining_item_CompositeFarmItem.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + item: null + ,items: null + ,crops: null + ,getPercent: function() { + var count = 0.0; + var total = 0.0; + var _g = 0; + var _g1 = this.items; + while(_g < _g1.length) { + var i = _g1[_g]; + ++_g; + var wt = (i.info.min + i.info.max) * 0.5; + count += i.getPercent() * wt; + total += wt; + } + if(total == 0) { + return 0; + } else { + return count / total; + } + } + ,canHarvest: function() { + var _g = 0; + var _g1 = this.items; + while(_g < _g1.length) { + var i = _g1[_g]; + ++_g; + if(i.isComplete()) { + return true; + } + } + return false; + } + ,collect: function(p,notify) { + if(notify == null) { + notify = true; + } + var ct = 0; + var _g = 0; + var _g1 = this.items; + while(_g < _g1.length) { + var i = _g1[_g]; + ++_g; + ct += i.harvest(); + } + if(ct > 0) { + if(notify) { + p.addItems(this.item,ct,0,null,true,true); + } else { + var item = this.item; + p.checkSeenItem(item); + p.storehouseInventory.addItems(item,ct); + var msg = com_fancyfish_faeng_common_Lang.getText("object.tooltip","harvest").get(); + msg = StringTools.replace(msg,"{item}",item.getDisplay(null) + (ct == 1 ? "" : " x" + ct)); + com_davidmaletz_mining_ui_NotificationQueue.showNotification(new com_davidmaletz_faengfl_ui_FormattedTooltip(0,0,msg,false,16777215,-1442840576)); + } + p.addExp(ct); + } else if(notify) { + com_davidmaletz_faengfl_adv_sound_Sound.play("warning"); + new com_davidmaletz_faengfl_ui_Popup(128.,52.,0,com_fancyfish_faeng_common_Lang.getText("warning","growing"),16720418); + } + return ct; + } + ,getMin: function() { + var ret = 0; + var _g = 0; + var _g1 = this.items; + while(_g < _g1.length) { + var i = _g1[_g]; + ++_g; + ret += i.info.min; + } + return ret; + } + ,getMax: function() { + var ret = 0; + var _g = 0; + var _g1 = this.items; + while(_g < _g1.length) { + var i = _g1[_g]; + ++_g; + ret += i.info.max; + } + return ret; + } + ,addItem: function(i,c) { + this.items.push(i); + this.crops.push(c); + i.addEventListener("update_percent",$bind(this,this.updatePercent)); + this.dispatchEvent(new openfl_events_Event("update_crop")); + this.updatePercent(null); + } + ,removeItem: function(i) { + var id = this.items.indexOf(i); + if(id != -1) { + i.removeEventListener("update_percent",$bind(this,this.updatePercent)); + this.items.splice(id,1); + this.crops.splice(id,1); + this.dispatchEvent(new openfl_events_Event("update_crop")); + this.updatePercent(null); + } + } + ,clear: function() { + var _g = 0; + var _g1 = this.items; + while(_g < _g1.length) { + var i = _g1[_g]; + ++_g; + i.removeEventListener("update_percent",$bind(this,this.updatePercent)); + } + com_fancyfish_faeng_common_Utils.clear(this.items); + com_fancyfish_faeng_common_Utils.clear(this.crops); + this.dispatchEvent(new openfl_events_Event("update_crop")); + this.updatePercent(null); + } + ,updatePercent: function(e) { + this.dispatchEvent(new openfl_events_Event("update_percent")); + } + ,getCrop: function(i) { + return this.crops[i]; + } + ,iterator: function() { + return HxOverrides.iter(this.items); + } + ,getName: function() { + return this.item.getName(); + } + ,createIcon: function() { + return this.item.createIcon(); + } + ,getElement: function() { + return this.item.getElement(); + } + ,renderItem: function(i,s,w,x,y) { + com_davidmaletz_mining_ui_ItemRenderer.addItem(s,this.getCrop(i),x,y); + } + ,addInfo: function(s,w,x,y) { + return com_davidmaletz_mining_item_CropInfo.addProduction(s,w,x,this.item.addInfo(s,w,x,y),this.iterator(),"slots",$bind(this,this.renderItem)); + } + ,__class__: com_davidmaletz_mining_item_CompositeFarmItem +}); +var com_davidmaletz_mining_item_CompositeFarmItems = function(farm) { + openfl_events_EventDispatcher.call(this); + this.farm = farm; + this.items = new haxe_ds_StringMap(); + this.order = []; +}; +$hxClasses["com.davidmaletz.mining.item.CompositeFarmItems"] = com_davidmaletz_mining_item_CompositeFarmItems; +com_davidmaletz_mining_item_CompositeFarmItems.__name__ = ["com","davidmaletz","mining","item","CompositeFarmItems"]; +com_davidmaletz_mining_item_CompositeFarmItems.__super__ = openfl_events_EventDispatcher; +com_davidmaletz_mining_item_CompositeFarmItems.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + farm: null + ,items: null + ,order: null + ,init: function() { + var c = this.farm.getSlots(); + while(c.hasNext()) { + var c1 = c.next(); + this.addCrop(c1); + } + this.farm.addEventListener("crop_added",$bind(this,this.cropAdded)); + this.farm.addEventListener("crop_removed",$bind(this,this.cropRemoved)); + } + ,destroy: function() { + var i = this.items.iterator(); + while(i.hasNext()) { + var i1 = i.next(); + i1.clear(); + } + this.farm.removeEventListener("crop_added",$bind(this,this.cropAdded)); + this.farm.removeEventListener("crop_removed",$bind(this,this.cropRemoved)); + } + ,cropAdded: function(e) { + if(e.value != null) { + this.addCrop(e.value); + } + } + ,cropRemoved: function(e) { + if(e.value != null) { + this.removeCrop(e.value); + } + } + ,addCrop: function(c) { + c.addEventListener("update_crop",$bind(this,this.addFarmItems)); + c.addEventListener("prepare_change_crop",$bind(this,this.removeFarmItems)); + this._addFarmItems(c); + } + ,removeCrop: function(c) { + c.removeEventListener("update_crop",$bind(this,this.addFarmItems)); + c.removeEventListener("prepare_change_crop",$bind(this,this.removeFarmItems)); + this._removeFarmItems(c); + } + ,addFarmItems: function(e) { + this._addFarmItems(e.value); + } + ,removeFarmItems: function(e) { + this._removeFarmItems(e.value); + } + ,_addFarmItems: function(c) { + var item = c.iterator(); + while(item.hasNext()) { + var item1 = item.next(); + this.addFarmItem(item1,c); + } + } + ,_removeFarmItems: function(c) { + var item = c.iterator(); + while(item.hasNext()) { + var item1 = item.next(); + this.removeFarmItem(item1); + } + } + ,addFarmItem: function(item,crop) { + var c = this.items.get(item.info.item); + if(c == null) { + var i = com_davidmaletz_mining_item_ItemInfo.get(item.info.item); + if(i == null) { + return; + } + c = new com_davidmaletz_mining_item_CompositeFarmItem(i); + c.addItem(item,crop); + this.items.set(item.info.item,c); + this.order.push(c); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("crop_added",c)); + } else { + c.addItem(item,crop); + } + } + ,removeFarmItem: function(item) { + var c = this.items.get(item.info.item); + if(c != null) { + c.removeItem(item); + } + } + ,iterator: function() { + return HxOverrides.iter(this.order); + } + ,__class__: com_davidmaletz_mining_item_CompositeFarmItems +}); +var com_davidmaletz_mining_item_CompoundInventory = function(ar) { + com_davidmaletz_mining_item_BaseInventory.call(this); + this.inventories = ar; + this.init(); +}; +$hxClasses["com.davidmaletz.mining.item.CompoundInventory"] = com_davidmaletz_mining_item_CompoundInventory; +com_davidmaletz_mining_item_CompoundInventory.__name__ = ["com","davidmaletz","mining","item","CompoundInventory"]; +com_davidmaletz_mining_item_CompoundInventory.__super__ = com_davidmaletz_mining_item_BaseInventory; +com_davidmaletz_mining_item_CompoundInventory.prototype = $extend(com_davidmaletz_mining_item_BaseInventory.prototype,{ + inventories: null + ,init: function() { + var _g = 0; + var _g1 = this.inventories; + while(_g < _g1.length) { + var i = _g1[_g]; + ++_g; + i.addEventListener("item_added",$bind(this,this.add_item)); + } + } + ,destroy: function() { + var _g = 0; + var _g1 = this.inventories; + while(_g < _g1.length) { + var i = _g1[_g]; + ++_g; + i.removeEventListener("item_added",$bind(this,this.add_item)); + } + } + ,length: function() { + return this.inventories.length; + } + ,getItems: function(itemFilter,sort) { + var map = new haxe_ds_StringMap(); + var ar = []; + var _g = 0; + var _g1 = this.inventories; + while(_g < _g1.length) { + var inv = _g1[_g]; + ++_g; + var i = inv.getItems(itemFilter); + while(i.hasNext()) { + var i1 = i.next(); + var ic; + if(map.exists(i1.item.id)) { + ic = ar[map.get(i1.item.id)]; + } else { + map.set(i1.item.id,ar.length); + ic = new com_davidmaletz_mining_item_ItemData(i1.item,0,0,null); + ar.push(ic); + } + var v = i1.getItemValues(); + while(v.hasNext()) { + var v1 = v.next(); + ic.add(v1.count,v1.value,v1.name); + } + } + } + if(sort != null) { + ar.sort(sort); + } + return HxOverrides.iter(ar); + } + ,add_item: function(i) { + this.dispatchEvent(new com_davidmaletz_mining_item_ItemEvent("item_added",this,i.item,this.getItemCount(i.item),i.delta,i.value,i.name,i.rename)); + } + ,addItems: function(item,count,value,name) { + if(value == null) { + value = 0; + } + if(count > 0) { + return this.inventories[0].addItems(item,count,value,name); + } else { + count = -count; + } + if(this.getItemCount(item) < count) { + return false; + } + var _g = 0; + var _g1 = this.inventories; + while(_g < _g1.length) { + var i = _g1[_g]; + ++_g; + var ic = i.getItem(item); + var max = ic == null ? 0 : ic.getValueCount(value,name); + var ct = count; + if(ct > max) { + ct = max; + } + i.addItems(item,-ct,value,name); + count -= ct; + if(count <= 0) { + return true; + } + } + var _g2 = 0; + var _g11 = this.inventories; + while(_g2 < _g11.length) { + var i1 = _g11[_g2]; + ++_g2; + var max1 = i1.getItemCount(item); + var ct1 = count; + if(ct1 > max1) { + ct1 = max1; + } + i1.addItems(item,-ct1,value,name); + count -= ct1; + if(count <= 0) { + break; + } + } + return true; + } + ,getItem: function(item) { + var ic = new com_davidmaletz_mining_item_ItemData(item,0,0,null); + var _g = 0; + var _g1 = this.inventories; + while(_g < _g1.length) { + var i = _g1[_g]; + ++_g; + var item1 = i.getItem(item); + if(item1 != null) { + var v = item1.getItemValues(); + while(v.hasNext()) { + var v1 = v.next(); + ic.add(v1.count,v1.value,v1.name); + } + } + } + if(ic.count == 0) { + return null; + } else { + return ic; + } + } + ,__class__: com_davidmaletz_mining_item_CompoundInventory +}); +var com_davidmaletz_mining_structure_IPowered = function() { }; +$hxClasses["com.davidmaletz.mining.structure.IPowered"] = com_davidmaletz_mining_structure_IPowered; +com_davidmaletz_mining_structure_IPowered.__name__ = ["com","davidmaletz","mining","structure","IPowered"]; +com_davidmaletz_mining_structure_IPowered.prototype = { + isPowered: null + ,getArea: null + ,__class__: com_davidmaletz_mining_structure_IPowered +}; +var com_davidmaletz_mining_structure_Structure = function(info,x,y) { + this.__id = -1; + this.powerAnimComplete = null; + this.powerAnim = null; + this.exits = null; + this.animation = null; + this.toHarvest = null; + this.__reshapeArea = null; + this.aabb_id = -1; + openfl_events_EventDispatcher.call(this); + this.info = info; + this.xPos = x; + this.yPos = y; + if(this.canReadInventory(81)) { + this.inventory = new com_davidmaletz_mining_item_Inventory(); + } + this.set_name(null); + this._updateInfo(); +}; +$hxClasses["com.davidmaletz.mining.structure.Structure"] = com_davidmaletz_mining_structure_Structure; +com_davidmaletz_mining_structure_Structure.__name__ = ["com","davidmaletz","mining","structure","Structure"]; +com_davidmaletz_mining_structure_Structure.__interfaces__ = [com_davidmaletz_mining_structure_IPowered,com_davidmaletz_mining_world_RunAnimation]; +com_davidmaletz_mining_structure_Structure.nothing = function(p) { +}; +com_davidmaletz_mining_structure_Structure._addOverlay = function(xml,o,area,tileMap,p,core,vars) { + if(core == null) { + core = true; + } + var tileRenderer = null; + if(Std["is"](p,com_davidmaletz_tiles_render_TileAnimationRenderer)) { + tileRenderer = p; + } + var set = vars != null && !vars.exists("player"); + if(set) { + com_davidmaletz_mining_npc_NPCEventHandler.setPlayerVariables(vars,com_davidmaletz_mining_Main.getLocalPlayer()); + } + var e = xml.elementsNamed("tile"); + while(e.hasNext()) { + var e1 = e.next(); + if(o != null && vars == null) { + vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(com_davidmaletz_mining_Main.getLocalPlayer()); + vars.set("this",o); + } + if(o == null || !e1.exists("if") || com_davidmaletz_faengfl_EventHandler._conditionMet(e1.get("if"),vars)) { + var s = com_davidmaletz_mining_npc_NPCEventHandler.addTile(null,e1,vars); + if(s != null) { + if(core) { + if(tileMap == null) { + tileMap = new haxe_ds_StringMap(); + } + if(e1.exists("id") || e1.exists("name")) { + tileMap.set(e1.exists("name") ? e1.get("name") : e1.get("id"),s); + } + } + if(core && e1.get("top") == "true" && area != null) { + s.set_x(s.get_x() * p.get_scaleX() + p.get_x()); + var _g = s; + _g.set_y(_g.get_y() + p.get_y()); + s.set_scaleX(p.get_scaleX()); + p.addEventListener("addedToStage",(function(a2,s1,a1) { + return function(e2) { + com_davidmaletz_mining_structure_Structure.add_top(a1[0],s1[0],a2[0],e2); + }; + })([e1.get("behind") == "true"],[s],[area])); + p.addEventListener("removedFromStage",(function(s2) { + return function(e3) { + com_davidmaletz_mining_structure_Structure.remove_top(s2[0],e3); + }; + })([s])); + } else if(e1.get("behind") == "true") { + p.addChildAt(s,0); + if(tileRenderer != null) { + tileRenderer.startAnimIndex++; + } + } else { + p.addChild(s); + } + } + } + } + if(Std["is"](p,com_davidmaletz_lerp_LerpSpriteBase)) { + com_davidmaletz_mining_npc_NPCEventHandler.handleAnimations(p,xml); + } + if(set) { + com_davidmaletz_mining_npc_NPCEventHandler.clearPlayerVariables(vars); + } + return tileMap; +}; +com_davidmaletz_mining_structure_Structure.add_top = function(area,s,behind,e) { + if(behind) { + area.renderer.over_objects.addChildAt(s,0); + } else { + area.renderer.over_objects.addChild(s); + } +}; +com_davidmaletz_mining_structure_Structure.remove_top = function(s,e) { + com_davidmaletz_faengfl_FaengFL.remove(s); +}; +com_davidmaletz_mining_structure_Structure.makeRenderer = function(o,xml,tile,animation,fps,loop,vars,complete,offX,offY) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + var r; + var _g = xml.get("renderer"); + switch(_g) { + case "floating": + r = new com_davidmaletz_mining_renderer_FloatingRenderer(com_davidmaletz_mining_Main.parseInt(xml.get("waterLine")),tile,animation,fps,loop,complete,offX,offY); + break; + case "spirit": + r = new com_davidmaletz_mining_renderer_SpiritRenderer(tile,animation,fps,loop,complete,offX,offY); + break; + case "static": + r = new com_davidmaletz_tiles_render_StaticPlayAnimation(tile,animation,fps,loop,complete,offX,offY); + break; + default: + if(fps == 0) { + r = new com_davidmaletz_tiles_render_TileAnimationRenderer(tile,1); + r.setAnimation(animation,offX,offY); + } else { + r = new com_davidmaletz_tiles_render_PlayAnimation(tile,animation,fps,loop,complete,offX,offY); + } + } + if(xml.get("rotate") == "true") { + r.set_rotation(90); + } + if(xml.exists("alpha") && vars != null) { + com_davidmaletz_mining_structure_Structure._updateAlpha(o,r,xml,vars); + } + return r; +}; +com_davidmaletz_mining_structure_Structure._updateAlpha = function(o,r,xml,vars) { + r.set_alpha(com_davidmaletz_faengfl_EventHandler.execute(xml.get("alpha"),vars)); +}; +com_davidmaletz_mining_structure_Structure.npcAddNotification = function(display,npc,item,count,value,name) { + if(npc.area != null && npc.area.renderer != null || com_davidmaletz_mining_npc_NPC.NOTIFY_AWAY) { + var msg = com_fancyfish_faeng_common_Lang.getText("common","storehouse_add").get(); + msg = StringTools.replace(msg,"{item}",item.getDisplay(name)); + msg = StringTools.replace(msg,"{count}",count == null ? "null" : "" + count); + msg = StringTools.replace(msg,"{npc}",npc.getDisplay(true)); + msg = StringTools.replace(msg,"{storehouse}",display); + com_davidmaletz_mining_ui_NotificationQueue.showNotification(new com_davidmaletz_faengfl_ui_FormattedTooltip(0,0,msg,false,16777215,-1442840576)); + } +}; +com_davidmaletz_mining_structure_Structure.load = function(b,version,addStructure) { + var id = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(id == null) { + return false; + } + var x; + var y; + if(version < 23) { + x = b.readInt16() * com_davidmaletz_tiles_Tile.SIZE; + y = (version >= 12 ? b.readInt16() : -1) * com_davidmaletz_tiles_Tile.SIZE; + } else { + x = b.readInt32(); + y = b.readInt32(); + } + var s = com_davidmaletz_mining_structure_StructureInfo.get(id); + if(version < 32 && Std["is"](s,com_davidmaletz_mining_structure_StructureInfo) && (js_Boot.__cast(s , com_davidmaletz_mining_structure_StructureInfo)).xml.get("flip") == "true") { + x -= (js_Boot.__cast(s , com_davidmaletz_mining_structure_StructureInfo)).tile.getTileWidth(0,0); + } + if(version < 56) { + s.load(b,version,x,y,addStructure,null); + return true; + } else { + var len = b.readUInt16(); + var bytes = haxe_io_Bytes.alloc(len); + b.readFullBytes(bytes,0,len); + if(s != null) { + try { + s.load(new haxe_io_BytesInput(bytes,0,len),version,x,y,addStructure,null); + } catch( e ) { + haxe_CallStack.lastException = e; + haxe_Log.trace("Failed to load structure: " + id,{ fileName : "Structure.hx", lineNumber : 466, className : "com.davidmaletz.mining.structure.Structure", methodName : "load"}); + com_davidmaletz_mining_Main.error = true; + } + } + return true; + } +}; +com_davidmaletz_mining_structure_Structure.save = function(s,b) { + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,s.info.id); + b.writeInt32(s.xPos); + b.writeInt32(s.yPos); + var bo = new haxe_io_BytesOutput(); + s.write(bo); + if(com_davidmaletz_mining_world_Area.__WRITE_IDS && s.__id >= 0) { + bo.writeUInt24(s.__id & 16777215); + } + var bytes = bo.getBytes(); + var len = bytes.length; + b.writeUInt16(len); + b.writeFullBytes(bytes,0,len); +}; +com_davidmaletz_mining_structure_Structure.writeNull = function(b) { + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); +}; +com_davidmaletz_mining_structure_Structure.getById = function(id,def) { + var a = com_davidmaletz_mining_structure_Structure.__structures.get(id); + if(a == null) { + return def; + } else { + return a; + } +}; +com_davidmaletz_mining_structure_Structure.resetIds = function() { + com_davidmaletz_mining_structure_Structure.__structures = new haxe_ds_IntMap(); + com_davidmaletz_mining_structure_Structure.__current_id = 0; +}; +com_davidmaletz_mining_structure_Structure.__super__ = openfl_events_EventDispatcher; +com_davidmaletz_mining_structure_Structure.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + info: null + ,xPos: null + ,yPos: null + ,aabb_id: null + ,sound: null + ,inventory: null + ,name: null + ,onTick: null + ,lights: null + ,check_lights: null + ,link_lights: null + ,generatePower: null + ,usePower: null + ,powerHandler: null + ,__reshapeArea: null + ,toHarvest: null + ,set_name: function(n) { + if(n != this.name) { + this.name = n; + this.dispatchEvent(new openfl_events_Event("update_name")); + } + return n; + } + ,setInfo: function(i) { + if(i != null && i != this.info) { + var a = this.area; + var b = this.getBounds().clone(); + if(a != null) { + this.removedFromArea(a); + } + this.info = i; + this._updateInfo(); + if(a != null) { + a.structures.reshapeObject(this,b); + this.addedToArea(a,false); + } else if(this.__reshapeArea != null) { + this.__reshapeArea.structures.reshapeObject(this,b); + } + this.updateRenderer(); + if(this.area != null) { + this.area.removeEventListener("tick",$bind(this,this.tickHandler)); + } + if(this.onTick != null && this.area != null) { + this.area.addEventListener("tick",$bind(this,this.tickHandler)); + } + } + } + ,updateRenderer: function() { + if(this.renderer != null && this.renderer.parent != null) { + var p = this.renderer.parent; + var i = p.getChildIndex(this.renderer); + p.removeChild(this.renderer); + this.renderer = null; + p.addChildAt(this.getRenderer(),i); + } else { + this.renderer = null; + } + } + ,canConnectPower: function() { + return this.usePower; + } + ,_updateInfo: function() { + this.usePower = this.info.xml.get("powered") == "true"; + if(!this.usePower) { + this.connected = null; + } + if(this.info.lights != null) { + var x = this.getRendererX(); + var y = this.getRendererY(); + this.lights = []; + var _g = 0; + var _g1 = this.info.lights; + while(_g < _g1.length) { + var l = _g1[_g]; + ++_g; + var a = l.xml.get("ifAnim"); + var light = new com_davidmaletz_mining_world_Light(l,x,y); + if(a != null) { + if(this.check_lights == null) { + this.check_lights = []; + } + this.check_lights.push(light); + } else { + this.lights.push(light); + } + if(l.xml.get("linkAnim") == "true") { + if(this.link_lights == null) { + this.link_lights = []; + } + this.link_lights.push(light); + } + } + } else { + this.lights = null; + this.check_lights = null; + this.link_lights = null; + } + if(this.canConnectPower()) { + if(this.powerHandler == null) { + this.powerHandler = new com_davidmaletz_mining_world_PowerHandler(this); + if(this.area != null) { + this.powerHandler.init(this.area,this.getInnerBounds()); + } + } + } else if(this.powerHandler != null) { + if(this.area != null) { + this.powerHandler.destroy(this.area); + } + this.powerHandler = null; + } + var i = this.info.xml.elementsNamed("onTick"); + this.onTick = null; + if(i.hasNext()) { + try { + this.onTick = com_davidmaletz_faengfl_EventHandler.parseString(com_fancyfish_faeng_common_Lang.escape(i.next().firstChild().get_nodeValue())); + } catch( e ) { + haxe_CallStack.lastException = e; + } + } + var gen = this.info.xml.get("generatePower"); + this.generatePower = null; + if(gen != null) { + try { + this.generatePower = com_davidmaletz_faengfl_EventHandler.parseString(gen); + } catch( e1 ) { + haxe_CallStack.lastException = e1; + } + } + } + ,area: null + ,connected: null + ,addedToArea: function(area,built) { + var _gthis = this; + this.area = area; + if(this.lights != null && !this.usePower) { + var _g = 0; + var _g1 = this.lights; + while(_g < _g1.length) { + var l = _g1[_g]; + ++_g; + l.addToArea(area); + } + } + var i = this.info.xml.get("connectTo"); + if(i != null) { + var b = this.getInnerBounds(); + b.inflate(com_davidmaletz_tiles_Tile.SIZE,0); + area.structures.getObjects(b,function(s,b1) { + if(s.info.id == i) { + s.addConnection(_gthis); + _gthis.addConnection(s); + } + return false; + }); + } + this.runEvent("addedToArea",null,null,area,"built",built); + if(this.powerHandler != null) { + this.powerHandler.init(area,this.getInnerBounds()); + } + if(this.onTick != null) { + area.addEventListener("tick",$bind(this,this.tickHandler)); + } + } + ,clearInvisibleBlocks: function() { + var b = this.getInnerBounds(); + var sx = Math.floor(b.x / com_davidmaletz_tiles_Tile.SIZE); + var ex = Math.ceil(b.get_right() / com_davidmaletz_tiles_Tile.SIZE); + var sy = Math.floor(b.y / com_davidmaletz_tiles_Tile.SIZE); + var ey = Math.ceil(b.get_bottom() / com_davidmaletz_tiles_Tile.SIZE); + var _g1 = sy; + var _g = ey; + while(_g1 < _g) { + var y = _g1++; + var _g3 = sx; + var _g2 = ex; + while(_g3 < _g2) { + var x = _g3++; + this.area.setFlags(x,y,this.area.getFlags(x,y) & -3); + } + } + } + ,removedFromArea: function(area) { + this.area = null; + if(this.lights != null) { + var _g = 0; + var _g1 = this.lights; + while(_g < _g1.length) { + var l = _g1[_g]; + ++_g; + l.removeFromArea(area); + } + } + this.runEvent("removedFromArea",null,null,area); + if(this.powerHandler != null) { + this.powerHandler.destroy(area); + } + area.removeEventListener("tick",$bind(this,this.tickHandler)); + } + ,tickHandler: function(e) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + if(this.area != null && this.onTick != null) { + try { + this.getVars(com_davidmaletz_mining_Main.getLocalPlayer()); + this.vars.set("frames",e.value); + com_davidmaletz_faengfl_EventHandler.interpret(this.onTick,this.vars); + } catch( e1 ) { + haxe_CallStack.lastException = e1; + } + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + ,canSelect: function() { + if(com_davidmaletz_tiles_TileAnimation._get(this.getAnim("idle")) != com_davidmaletz_tiles_TileAnimation.get("hidden")) { + if(this.info.xml.get("renderer") == "spirit") { + return com_davidmaletz_mining_Main.getLocalPlayer().viewHidden.get(); + } else { + return true; + } + } else { + return false; + } + } + ,tooltip: null + ,tooltip_key: null + ,tooltip_msg: null + ,onOver: function(p) { + if(com_davidmaletz_tiles_TileAnimation.exists(this.getAnim("opening","opening"))) { + this.playAnimation("opening"); + } + this.runEvent("over",p); + } + ,onOut: function(p) { + if(com_davidmaletz_tiles_TileAnimation.exists(this.getAnim("closing","closing"))) { + this.playAnimation("closing",$bind(this,this.checkIdle)); + } + this.runEvent("out",p); + } + ,getArea: function() { + return this.area; + } + ,isPowered: function(ar) { + if(this.generatePower != null && com_davidmaletz_faengfl_EventHandler.interpret(this.generatePower,this.getVars(com_davidmaletz_mining_Main.getLocalPlayer())) == true || this.area != null && this.area.isPowered()) { + if(this.connected != null) { + this.filterConnected(); + } + return true; + } + if(this.usePower && this.connected != null) { + if(ar == null) { + ar = com_davidmaletz_mining_structure_Structure.powerList; + com_fancyfish_faeng_common_Utils.clear(ar); + } + var _g = 0; + var _g1 = this.connected; + while(_g < _g1.length) { + var c = _g1[_g]; + ++_g; + if(c.getArea() == null) { + this.filterConnected(); + return this.isPowered(ar); + } + if(ar.indexOf(c) == -1) { + ar.push(c); + if(c.isPowered(ar)) { + return true; + } + } + } + } + return false; + } + ,exists: function(p) { + return p.getArea() != null; + } + ,filterConnected: function() { + this.connected = this.connected.filter($bind(this,this.exists)); + } + ,addConnection: function(p) { + if(this.usePower && p != this) { + if(this.connected == null) { + this.connected = [p]; + } else if(this.connected.indexOf(p) == -1) { + this.connected.push(p); + } + } + } + ,removeConnection: function(p) { + if(this.usePower && this.connected != null) { + HxOverrides.remove(this.connected,p); + } + } + ,useSelect: function(p) { + if(!(p.area == null || p.canFly() || p.willConsumePlayerMove() || this.info.xml.get("only_select") == "true" || !p.area.emptyTile(p.get_tile_x(),p.get_tile_y()))) { + return p.area.isWater(p.get_tile_x(),p.get_tile_y()); + } else { + return true; + } + } + ,_showTooltip: function(key,msg) { + this._hideTooltip(); + this.tooltip_key = key; + this.tooltip_msg = msg; + this.tooltip = new com_davidmaletz_mining_ui_KeyTooltip(true,this.tooltip_key,128.,16,this.tooltip_msg); + this.tooltip.show(); + } + ,onEnter: function(p) { + var t = this.getTooltip(p); + if(t != null) { + this._showTooltip(this.useSelect(p) ? "select" : "up",t); + } + this.runEvent("enter",p); + } + ,updateTooltip: function(p) { + var t = this.getTooltip(p); + if(t != null) { + var key = this.useSelect(p) ? "select" : "up"; + if(this.tooltip_key != key || this.tooltip_msg != t) { + this._showTooltip(key,t); + } + } + } + ,_hideTooltip: function() { + if(this.tooltip != null) { + var d = this.tooltip; + var tmp = function() { + com_davidmaletz_faengfl_FaengFL.remove(d); + }; + this.tooltip.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),10,tmp); + this.tooltip = null; + } + } + ,onExit: function(p) { + this._hideTooltip(); + this.runEvent("exit",p); + } + ,playOnce: function(id,stopOnRemove) { + if(stopOnRemove == null) { + stopOnRemove = true; + } + if(this.renderer != null) { + com_davidmaletz_faengfl_adv_sound_Sound.playLoc(id,this.renderer,new openfl_geom_Point(this.info.width * 0.5,this.info.height * 0.5),false,1,stopOnRemove); + } + } + ,playSFX: function(id,loops) { + if(loops == null) { + loops = true; + } + this.stopSFX(null); + if(this.renderer != null) { + this.sound = com_davidmaletz_faengfl_adv_sound_Sound.playLoc(id,this.renderer,new openfl_geom_Point(this.info.width * 0.5,this.info.height * 0.5),loops); + } + } + ,stopSFX: function(e) { + if(this.sound != null) { + this.sound.stop(); + this.sound = null; + } + } + ,animationUpdated: function(p) { + if(this.usePower && this.area != null && this.lights != null) { + if(this.isPowered()) { + var _g = 0; + var _g1 = this.lights; + while(_g < _g1.length) { + var l = _g1[_g]; + ++_g; + l.addToArea(this.area); + } + } else { + var _g2 = 0; + var _g11 = this.lights; + while(_g2 < _g11.length) { + var l1 = _g11[_g2]; + ++_g2; + l1.removeFromArea(this.area); + } + } + } + if(this.check_lights != null) { + var _g3 = 0; + var _g12 = this.check_lights; + while(_g3 < _g12.length) { + var l2 = _g12[_g3]; + ++_g3; + var anim = l2.info.xml.get("ifAnim"); + var exists = this.lights.indexOf(l2) != -1; + var add; + var not = StringTools.startsWith(anim,"!"); + if(not) { + anim = HxOverrides.substr(anim,1,null); + } + if(StringTools.startsWith(anim,"*.")) { + add = StringTools.endsWith(p.animation,HxOverrides.substr(anim,1,null)); + } else { + var a = this.getAnim(anim); + if(com_davidmaletz_tiles_TileAnimation.exists(a) && com_davidmaletz_tiles_TileAnimation.exists(p.animation)) { + add = com_davidmaletz_tiles_TileAnimation.get(p.animation) == com_davidmaletz_tiles_TileAnimation.get(a); + } else { + add = false; + } + } + if(not) { + add = !add; + } + if(exists != add) { + if(add) { + this.lights.push(l2); + if(this.area != null) { + l2.addToArea(this.area); + } + } else { + HxOverrides.remove(this.lights,l2); + if(this.area != null) { + l2.removeFromArea(this.area); + } + } + } + } + } + if(this.link_lights != null) { + var _g4 = 0; + var _g13 = this.link_lights; + while(_g4 < _g13.length) { + var l3 = _g13[_g4]; + ++_g4; + var r = l3.renderer; + if(r != null) { + var _r = js_Boot.__cast(r.getChildAt(0) , com_davidmaletz_tiles_render_PlayAnimation); + var a1 = p.animation; + if(com_davidmaletz_tiles_TileAnimation.exists(a1 + ".light")) { + a1 += ".light"; + } + _r.playAnimation(a1,p.isLoop()); + _r.setFrame(p.getAnimFrame(),false); + } + } + } + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("animationUpdated",p.animation)); + } + ,_playAnimation: function(p,anim,onComplete) { + if(this.usePower && !this.isPowered()) { + this.powerAnim = anim; + this.powerAnimComplete = onComplete; + this.playIdle(p); + } else { + this.doPlay(p,anim,onComplete); + } + } + ,loopAnimation: function(anim) { + var r = this.getRenderer(); + if(Std["is"](r,com_davidmaletz_tiles_render_PlayAnimation)) { + var p = js_Boot.__cast(r , com_davidmaletz_tiles_render_PlayAnimation); + if(anim == "idle") { + this.playIdle(p); + this.powerAnim = null; + this.powerAnimComplete = null; + } else { + this._playAnimation(p,this.getAnim(anim),null); + } + } + } + ,openClose: function() { + var _gthis = this; + if(!com_davidmaletz_tiles_TileAnimation.exists(this.getAnim("opening","opening"))) { + return; + } + var r = this.getRenderer(); + if(Std["is"](r,com_davidmaletz_tiles_render_PlayAnimation)) { + var p = js_Boot.__cast(r , com_davidmaletz_tiles_render_PlayAnimation); + var anim = this.getAnim("opening"); + if(p.animation != anim) { + p.playAnimation(anim,false,function(p1) { + _gthis.playAnimation("closing"); + }); + this.animationUpdated(p); + } + } + } + ,getSprite: function() { + return this.renderer; + } + ,runAnimation: function(anim_id,func) { + if(func == null) { + this.loopAnimation(anim_id); + } else { + this.playAnimation(anim_id,function(p) { + func(); + }); + } + } + ,playAnimation: function(anim,onComplete) { + var r = this.getRenderer(); + if(r != null && Std["is"](r,com_davidmaletz_tiles_render_PlayAnimation)) { + var p = js_Boot.__cast(r , com_davidmaletz_tiles_render_PlayAnimation); + this._playAnimation(p,this.getAnim(anim),onComplete == null ? com_davidmaletz_mining_structure_Structure.nothing : onComplete); + } + } + ,animation: null + ,getAnim: function(id,def) { + if(def == null) { + def = "idle"; + } + return this.info.getAnim(id,def,this.animation); + } + ,_onOperate: function(p) { + var f = $bind(this,this.onOperate); + var p1 = p; + this.runEvent("operate",p,function() { + f(p1); + }); + } + ,prepareOperate: function(p) { + if(this.getTooltip(p) == null) { + return; + } + if(com_davidmaletz_mining_Main.PIRATE && this.inventory != null && this.area.id != "start" && this.inventory.getWeight() > 0) { + this.inventory.clear(); + var c = com_davidmaletz_mining_Main.getContainer(); + var f = $bind(this,this._onOperate); + var p1 = p; + var tmp = function() { + f(p1); + }; + c.addDisplay(new com_davidmaletz_mining_ui_DialogueBox(c,com_fancyfish_faeng_common_Lang.getText("trader","pirate").get(),tmp),2); + } else { + this._onOperate(p); + } + } + ,removeStructure: function(p) { + if(this.area != null) { + this.area.removeStructure(this,p); + p.overlapChanged(); + } + } + ,makeWindow: function(wnd,p) { + var msg = com_fancyfish_faeng_common_Lang.getTextFromTitle(this.info.xml.get("removeButton")); + if(msg != null) { + var f = $bind(this,this.removeStructure); + var p1 = p; + var tmp = function() { + f(p1); + }; + com_davidmaletz_mining_world_ItemObject.collectWindow(wnd,wnd.bg.getWidth(),wnd.bg.getHeight(),tmp,msg); + } + return wnd; + } + ,onOperate: function(p) { + } + ,consumePlayerMove: function(p,dx,dy,frames) { + return false; + } + ,moveRemotePlayer: function(p,dx,dy) { + return false; + } + ,exits: null + ,hasExit: function(x,y) { + if(this.exits == null) { + return false; + } + var len = this.exits.length >> 1; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + if(this.exits[i * 2] == x && this.exits[i * 2 + 1] == y) { + return true; + } + } + return false; + } + ,addExit: function(x,y) { + if(this.info.room && !this.hasExit(x,y)) { + if(this.exits == null) { + this.exits = [x,y]; + } else { + this.exits.push(x); + this.exits.push(y); + } + } + } + ,canEnterTile: function(x,y) { + if(this.info.room) { + if(!this.getBounds().contains((x + 0.5) * com_davidmaletz_tiles_Tile.SIZE,(y + 0.5) * com_davidmaletz_tiles_Tile.SIZE)) { + return this.hasExit(x,y); + } else { + return true; + } + } else { + return true; + } + } + ,getTooltip: function(p) { + var i = this.info.xml.elementsNamed("tooltip"); + var hadNext = i.hasNext(); + while(i.hasNext()) { + var n = i.next(); + var vars = this.getVars(p); + if(n.exists("if") && !com_davidmaletz_faengfl_EventHandler._conditionMet(n.get("if"),vars)) { + continue; + } + var section = n.get("section"); + var id = n.get("id"); + if(section == null) { + section = "structure.tooltip"; + } + if(id == null) { + var f = n.firstChild(); + if(f == null) { + return null; + } + id = Std.string(com_davidmaletz_faengfl_EventHandler.execute(com_fancyfish_faeng_common_Lang.escape(n.firstChild().get_nodeValue()),vars)); + } + if(com_fancyfish_faeng_common_Lang.hasText(section,id)) { + return com_fancyfish_faeng_common_Lang.getText(section,id); + } else { + return null; + } + } + if(hadNext) { + return null; + } + var i1 = this.info.xml.get("name"); + if(i1 == null) { + i1 = this.info.id; + } + if(com_fancyfish_faeng_common_Lang.hasText("structure.tooltip",i1)) { + return com_fancyfish_faeng_common_Lang.getText("structure.tooltip",i1); + } else { + return null; + } + } + ,renderer: null + ,tileMap: null + ,getTileById: function(id) { + if(this.tileMap == null && this.renderer == null) { + this.getRenderer(); + } + if(this.tileMap == null) { + return null; + } else { + return this.tileMap.get(id); + } + } + ,addBefore: function(s,id) { + var t = this.getTileById(id); + if(t != null) { + t.parent.addChildAt(s,t.parent.getChildIndex(t) - 1); + } + } + ,addOverlay: function(p,core) { + if(core == null) { + core = true; + } + this.tileMap = com_davidmaletz_mining_structure_Structure._addOverlay(this.info.xml,this,this.area,this.tileMap,p,core,this.getVars(com_davidmaletz_mining_Main.getLocalPlayer())); + } + ,vars: null + ,getVars: function(p) { + if(this.vars == null) { + this.vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(p); + this.vars.set("this",this); + return this.vars; + } else { + com_davidmaletz_mining_npc_NPCEventHandler.setPlayerVariables(this.vars,p); + return this.vars; + } + } + ,getIdle: function() { + if(this.usePower) { + return this.getAnim(this.isPowered() ? "on" : "off"); + } else { + return this.getAnim("idle"); + } + } + ,isIdle: function() { + if(this.renderer != null) { + return (js_Boot.__cast(this.renderer , com_davidmaletz_tiles_render_PlayAnimation)).animation == this.getIdle(); + } else { + return true; + } + } + ,powerAnim: null + ,powerAnimComplete: null + ,canFunction: function() { + if(!(!this.usePower)) { + return this.isPowered(); + } else { + return true; + } + } + ,checkIdle: function(p) { + if(this.powerAnim != null && this.usePower && this.isPowered()) { + this.doPlay(p,this.powerAnim,this.powerAnimComplete); + this.powerAnim = null; + this.powerAnimComplete = null; + } else { + this.playIdle(p); + } + } + ,loopPlay: function(anim,p) { + p.setFrame(0); + if(this.isPowered()) { + this.doPlay(p,anim,null); + } else { + this.powerAnim = anim; + this.powerAnimComplete = null; + this.playIdle(p); + } + } + ,doPlay: function(p,anim,onComplete) { + if(this.usePower && onComplete == null) { + var f = $bind(this,this.loopPlay); + var a1 = anim; + onComplete = function(p1) { + f(a1,p1); + }; + } + p.playAnimation(anim,onComplete == null,onComplete); + this.animationUpdated(p); + } + ,playIdle: function(p) { + p.setFrame(0); + p.playAnimation(this.getIdle(),false,$bind(this,this.checkIdle)); + this.animationUpdated(p); + } + ,updateAlpha: function() { + if(this.renderer != null) { + com_davidmaletz_mining_structure_Structure._updateAlpha(this,this.renderer,this.info.xml,this.getVars(com_davidmaletz_mining_Main.getLocalPlayer())); + } + } + ,createRenderer: function() { + return com_davidmaletz_mining_structure_Structure.makeRenderer(this,this.info.xml,this.info.tile,this.getIdle(),com_davidmaletz_mining_enemy_AttackRenderer.getFPS(this.info.xml,10),false,this.getVars(com_davidmaletz_mining_Main.getLocalPlayer()),$bind(this,this.checkIdle)); + } + ,getRenderer: function() { + if(this.renderer == null) { + this.renderer = this.createRenderer(); + this.updateRendererPos(); + this.addOverlay(this.renderer); + if(Std["is"](this.renderer,com_davidmaletz_tiles_render_PlayAnimation)) { + this.animationUpdated(this.renderer); + } + this.renderer.addEventListener("removedFromStage",$bind(this,this.stopSFX)); + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + this.runEvent("initRenderer",null); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + return this.renderer; + } + ,getRendererX: function() { + return this.xPos + (this.info.xml.get("centerX") == "false" ? 0 : Math.round((this.info.width - this.info.tile.getTileWidth(0,0)) * 0.5)) + this.info.offsetX; + } + ,getRendererY: function() { + return this.yPos + com_davidmaletz_tiles_Tile.SIZE + this.info.offsetY - this.info.height; + } + ,updateRendererLoop: function() { + var old = this.renderer.get_x(); + com_davidmaletz_mining_renderer_AreaRenderer.updateLoop(this.renderer,this.area); + if(old != this.renderer.get_x() && this.tileMap != null) { + var s = this.tileMap.iterator(); + while(s.hasNext()) { + var s1 = s.next(); + if(s1.parent != this.renderer) { + var _g = s1; + _g.set_x(_g.get_x() + (this.renderer.get_x() - old)); + } + } + } + } + ,updateRendererPos: function() { + this.renderer.set_x(this.getRendererX()); + this.renderer.set_y(this.getRendererY()); + if(this.info.xml.get("flip") == "true") { + this.renderer.set_scaleX(-this.renderer.get_scaleY()); + var _g = this.renderer; + _g.set_x(_g.get_x() + this.info.tile.getTileWidth(0,0)); + } + this.updateRendererLoop(); + } + ,isBack: function() { + return this.info.xml.get("back") == "true"; + } + ,getInnerBounds: function(fullHeight) { + if(fullHeight == null) { + fullHeight = true; + } + var ht = fullHeight || this.info.room ? this.info.height : com_fancyfish_faeng_common_Utils.max(com_davidmaletz_tiles_Tile.SIZE,this.info.height - com_davidmaletz_tiles_Tile.SIZE * 3); + com_davidmaletz_mining_world_BaseObject.rectangle.setTo(this.xPos,this.yPos - ht + com_davidmaletz_tiles_Tile.SIZE,this.info.width,ht); + return com_davidmaletz_mining_world_BaseObject.rectangle; + } + ,getObjectInBounds: function(id) { + if(this.area == null) { + return null; + } + var ret = null; + this.area.getObjects(this.getInnerBounds(),function(o,r) { + if(o.info.id == id) { + ret = o; + return true; + } else { + return false; + } + }); + return ret; + } + ,getBounds: function() { + return this.getInnerBounds(); + } + ,getHitBounds: function(allowHitbox) { + var b = this.getInnerBounds(this.info.xml.get("fullHeight") == "true"); + if(allowHitbox) { + this.info.modifyHitbox(b); + } + return b; + } + ,intersects: function(r,issect) { + return com_fancyfish_faeng_pack_AABBObjectList.intersects(r,this.getBounds(),issect); + } + ,upgradeFrom: function(s) { + if(this.inventory != null && s.inventory != null) { + this.inventory.copyFrom(s.inventory); + } + this.set_name(s.name); + if(this.info.room && s.exits != null) { + this.exits = s.exits.slice(); + } + } + ,getTitle: function(p) { + var vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(p); + vars.set("this",this); + var i = null; + if(this.info.xml.exists("title")) { + try { + i = new com_fancyfish_faeng_common_mutable_Static(com_davidmaletz_faengfl_EventHandler._execute(this.info.xml.get("title"),vars)); + } catch( e ) { + haxe_CallStack.lastException = e; + i = com_fancyfish_faeng_common_Lang.getTextFromTitle(this.info.xml.get("title")); + } + } + if(i != null) { + return i; + } else { + return com_fancyfish_faeng_common_Lang.getText("common",this.info.xml.exists("name") ? this.info.xml.get("name") : this.info.id); + } + } + ,sendToBack: function() { + if(this.area != null) { + var ar = this.area.structures.objectList; + if(HxOverrides.remove(ar,this)) { + ar.unshift(this); + this.dispatchEvent(new openfl_events_Event("send_to_back")); + return true; + } + } + return false; + } + ,canAddItem: function(item) { + return this.hasInventory(); + } + ,doAddItem: function(item,count,value,name) { + if(value == null) { + value = 0; + } + var i = this.accessInventory(); + if(i != null) { + i.addItems(item,count,value,name); + } + } + ,addItem: function(npc,item,count,value,name) { + if(value == null) { + value = 0; + } + if(!this.canAddItem(item)) { + return; + } + this.dispatchEvent(new com_davidmaletz_mining_structure_NotifyEvent("notify_npc",npc,item,count,name)); + com_davidmaletz_mining_structure_Structure.npcAddNotification("[color=ff2222]" + this.getTitle(com_davidmaletz_mining_Main.getLocalPlayer()).get() + "[/color]",npc,item,count,value,name); + this.doAddItem(item,count,value,name); + } + ,addAll: function(npc,inv) { + var i = inv.items.iterator(); + while(i.hasNext()) { + var i1 = i.next(); + var v = i1.getItemValues(); + while(v.hasNext()) { + var v1 = v.next(); + this.addItem(npc,v1.item,v1.count,v1.value,v1.name); + } + } + } + ,accessInventory: function() { + return this.inventory; + } + ,hasInventory: function() { + var i = this.info.xml.get("includeInventory"); + if(i != null) { + return i != "false"; + } else { + return false; + } + } + ,hasName: function() { + return this.info.xml.get("includeName") == "true"; + } + ,canReadInventory: function(version) { + var ver = 34; + if(this.hasInventory()) { + var i = this.info.xml.get("includeInventory"); + if(i != "true") { + ver = com_davidmaletz_mining_Main.parseInt(i); + } + return version >= ver; + } else { + return false; + } + } + ,write: function(b) { + if(this.canReadInventory(81)) { + this.inventory.write(b); + } + if(this.hasName()) { + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.name); + } + } + ,read: function(b,version,parent) { + try { + if(this.canReadInventory(version)) { + this.inventory.read(b,version); + } + if(this.hasName()) { + this.set_name(com_fancyfish_faeng_common_UTFUtils.readUTF(b)); + } + } catch( e ) { + haxe_CallStack.lastException = e; + } + } + ,onDismantle: function(p) { + if(this.inventory != null) { + p.inventory.addAll(this.inventory); + } + } + ,_removeBy: function(p) { + } + ,removeBy: function(p) { + var f = $bind(this,this._removeBy); + var p1 = p; + this.runEvent("removeBy",p,function() { + f(p1); + }); + if(p.structure == this) { + com_davidmaletz_mining_Main.closeWindows(); + p.overlapChanged(); + } + } + ,onLoad: function(b,version) { + if(version >= 75) { + try { + var id = b.readUInt24(); + if(id >= 0) { + this.__loadId(id); + } + } catch( e ) { + haxe_CallStack.lastException = e; + } + } + } + ,loadXML: function(xml,vars) { + } + ,runEvent: function(event,p,onComplete,area,id,value) { + if(p == null && area != null && area.vehicle != null) { + p = area.vehicle.getOwner(); + } + var map = this.getVars(p); + if(area != null) { + map.set("area",area); + } + if(id != null) { + map.set(id,value); + } + com_davidmaletz_mining_Main.runEvent(event,p,this.info.xml,this,onComplete,map); + } + ,getCenterX: function() { + return this.xPos + this.info.width * 0.5; + } + ,getCenterY: function() { + return this.yPos + com_davidmaletz_tiles_Tile.SIZE - this.info.height * 0.5; + } + ,getInnerCenterX: function() { + var b = this.getInnerBounds(); + return b.x + b.width * 0.5; + } + ,tile_x: null + ,tile_y: null + ,get_tile_x: function() { + return Math.round(this.xPos / com_davidmaletz_tiles_Tile.SIZE); + } + ,get_tile_y: function() { + return Math.round(this.yPos / com_davidmaletz_tiles_Tile.SIZE); + } + ,getTileWidth: function() { + return Math.ceil(this.info.width / com_davidmaletz_tiles_Tile.SIZE); + } + ,__id: null + ,__assignId: function() { + if(this.__id < 0) { + this.__loadId(com_davidmaletz_mining_structure_Structure.__current_id++); + } + } + ,__loadId: function(id) { + this.__id = id; + com_davidmaletz_mining_structure_Structure.__structures.set(id,this); + com_davidmaletz_mining_structure_Structure.__structure_ids.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("add_structure",this)); + } + ,__recycleId: function() { + if(this.__id >= 0) { + com_davidmaletz_mining_structure_Structure.__structures.remove(this.__id); + com_davidmaletz_mining_structure_Structure.__structure_ids.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("rem_structure",this)); + this.__id = -1; + } + } + ,__backRenderer: null + ,__class__: com_davidmaletz_mining_structure_Structure + ,__properties__: {get_tile_y:"get_tile_y",get_tile_x:"get_tile_x",set_name:"set_name"} +}); +var com_davidmaletz_mining_structure_FarmBaseInterface = function() { }; +$hxClasses["com.davidmaletz.mining.structure.FarmBaseInterface"] = com_davidmaletz_mining_structure_FarmBaseInterface; +com_davidmaletz_mining_structure_FarmBaseInterface.__name__ = ["com","davidmaletz","mining","structure","FarmBaseInterface"]; +com_davidmaletz_mining_structure_FarmBaseInterface.__interfaces__ = [openfl_events_IEventDispatcher]; +com_davidmaletz_mining_structure_FarmBaseInterface.prototype = { + getSlots: null + ,getSelectAnimalTitle: null + ,handleTick: null + ,__class__: com_davidmaletz_mining_structure_FarmBaseInterface +}; +var com_davidmaletz_mining_structure_IFarmUpgrade = function() { }; +$hxClasses["com.davidmaletz.mining.structure.IFarmUpgrade"] = com_davidmaletz_mining_structure_IFarmUpgrade; +com_davidmaletz_mining_structure_IFarmUpgrade.__name__ = ["com","davidmaletz","mining","structure","IFarmUpgrade"]; +com_davidmaletz_mining_structure_IFarmUpgrade.prototype = { + addFarm: null + ,__class__: com_davidmaletz_mining_structure_IFarmUpgrade +}; +var com_davidmaletz_mining_item_Crop = function(info,x,y) { + this.partial = 0; + com_davidmaletz_mining_structure_Structure.call(this,info.structure,x,y); + this.slot = new com_davidmaletz_mining_item_CropSlot(this); + this.slot.setCrop(info); + this.attachFarm = new haxe_ds_StringMap(); + if(info.xml.exists("attachFarm")) { + this.attachFarm.set(info.xml.get("attachFarm"),true); + } + var e = info.xml.elementsNamed("attachFarm"); + while(e.hasNext()) { + var e1 = e.next(); + this.attachFarm.set(e1.get("id"),true); + } +}; +$hxClasses["com.davidmaletz.mining.item.Crop"] = com_davidmaletz_mining_item_Crop; +com_davidmaletz_mining_item_Crop.__name__ = ["com","davidmaletz","mining","item","Crop"]; +com_davidmaletz_mining_item_Crop.__interfaces__ = [com_davidmaletz_mining_structure_FarmBaseInterface,com_davidmaletz_mining_structure_IFarmUpgrade]; +com_davidmaletz_mining_item_Crop.__super__ = com_davidmaletz_mining_structure_Structure; +com_davidmaletz_mining_item_Crop.prototype = $extend(com_davidmaletz_mining_structure_Structure.prototype,{ + slot: null + ,attachFarm: null + ,onOperate: function(p) { + var c = com_davidmaletz_mining_Main.getContainer(); + var wnd = new com_davidmaletz_mining_ui_FarmWindow(p,this,c); + var f = $bind(this,this.removeStructure); + var p1 = p; + var tmp = function() { + f(p1); + }; + c.addDisplay(com_davidmaletz_mining_world_ItemObject.collectWindow(wnd,wnd.bg.getWidth(),wnd.bg.getHeight(),tmp,com_fancyfish_faeng_common_Lang.getText("common","remove")),2); + } + ,addedToArea: function(area,built) { + com_davidmaletz_mining_structure_Structure.prototype.addedToArea.call(this,area,built); + var id = this.attachFarm.keys(); + while(id.hasNext()) { + var id1 = id.next(); + var ar = area.getStructuresById(id1); + var _g = 0; + while(_g < ar.length) { + var farm = ar[_g]; + ++_g; + if(Std["is"](farm,com_davidmaletz_mining_structure_Farm)) { + (js_Boot.__cast(farm , com_davidmaletz_mining_structure_Farm)).__dirty = true; + } + } + } + this.slot.addEventListener("update_crop",$bind(this,this.update_crop)); + area.addEventListener("tick",$bind(this,this._handleTick)); + } + ,removedFromArea: function(area) { + com_davidmaletz_mining_structure_Structure.prototype.removedFromArea.call(this,area); + var id = this.attachFarm.keys(); + while(id.hasNext()) { + var id1 = id.next(); + var ar = area.getStructuresById(id1); + var _g = 0; + while(_g < ar.length) { + var farm = ar[_g]; + ++_g; + if(Std["is"](farm,com_davidmaletz_mining_structure_Farm)) { + (js_Boot.__cast(farm , com_davidmaletz_mining_structure_Farm)).__dirty = true; + } + } + } + this.slot.removeEventListener("update_crop",$bind(this,this.update_crop)); + area.removeEventListener("tick",$bind(this,this._handleTick)); + } + ,sendToBack: function() { + if(com_davidmaletz_mining_structure_Structure.prototype.sendToBack.call(this)) { + var id = this.attachFarm.keys(); + while(id.hasNext()) { + var id1 = id.next(); + var ar = this.area.getStructuresById(id1); + var _g = 0; + while(_g < ar.length) { + var farm = ar[_g]; + ++_g; + if(Std["is"](farm,com_davidmaletz_mining_structure_Farm)) { + (js_Boot.__cast(farm , com_davidmaletz_mining_structure_Farm)).shiftUpgrade(this); + } + } + } + return true; + } else { + return false; + } + } + ,partial: null + ,_handleTick: function(e) { + var frames = e.value; + if(frames > 0) { + var f = Math.floor(frames); + this.partial += frames - f; + if(this.partial >= 1) { + ++f; + this.partial -= 1; + } + this.handleTick(f); + } + } + ,addFarm: function(f) { + if(this.attachFarm.exists(f.info.id)) { + f.addUpgrade(this); + } + } + ,_removeBy: function(p) { + p.addItem(this.info.id + "_seed"); + } + ,update_crop: function(e) { + this.info = this.slot.info.structure; + if(this.renderer != null) { + this.updateRendererPos(); + } + } + ,createRenderer: function() { + return new com_davidmaletz_mining_item_FarmUpgradeRenderer(this); + } + ,handleTick: function(frames) { + if(frames > 0) { + this.slot.tick(frames); + } + } + ,getSelectAnimalTitle: function() { + return com_fancyfish_faeng_common_Lang.getText("common","add_animal"); + } + ,getSlots: function() { + return new com_fancyfish_faeng_common_SingleIterator(this.slot); + } + ,getSlot: function(i) { + if(i == 0) { + return this.slot; + } else { + return null; + } + } + ,getFarmItems: function() { + return new com_davidmaletz_mining_structure_FarmItemIterator(this.getSlots()); + } + ,getTooltip: function(p) { + var m = com_davidmaletz_mining_structure_Structure.prototype.getTooltip.call(this,p); + if(m == null) { + return com_fancyfish_faeng_common_Lang.getText("structure.tooltip","crop"); + } else { + return m; + } + } + ,write: function(b) { + com_davidmaletz_mining_structure_Structure.prototype.write.call(this,b); + this.slot.write(b); + } + ,read: function(b,version,parent) { + com_davidmaletz_mining_structure_Structure.prototype.read.call(this,b,version,parent); + if(version < 18) { + b.readByte(); + } else { + this.slot.read(b,version); + } + } + ,getNextItem: function() { + var ar = []; + var i = this.slot.iterator(); + while(i.hasNext()) { + var i1 = i.next(); + if(i1.isComplete()) { + var item = com_davidmaletz_mining_item_ItemInfo.get(i1.info.item); + if(item != null) { + ar.push(item); + } + } + } + if(ar.length > 0) { + return ar[Math.floor(Math.random() * ar.length)]; + } else { + return null; + } + } + ,__class__: com_davidmaletz_mining_item_Crop +}); +var com_davidmaletz_mining_item_FarmUpgradeRenderer = function(crop) { + this.farmItem = null; + com_davidmaletz_tiles_render_PlayAnimation.call(this,crop.info.tile,null,10,true); + this.crop = crop; + this.addBubble(); +}; +$hxClasses["com.davidmaletz.mining.item.FarmUpgradeRenderer"] = com_davidmaletz_mining_item_FarmUpgradeRenderer; +com_davidmaletz_mining_item_FarmUpgradeRenderer.__name__ = ["com","davidmaletz","mining","item","FarmUpgradeRenderer"]; +com_davidmaletz_mining_item_FarmUpgradeRenderer.__super__ = com_davidmaletz_tiles_render_PlayAnimation; +com_davidmaletz_mining_item_FarmUpgradeRenderer.prototype = $extend(com_davidmaletz_tiles_render_PlayAnimation.prototype,{ + crop: null + ,farmItem: null + ,addBubble: function() { + var xml = this.crop.info.xml; + this.addChild(new com_davidmaletz_mining_renderer_ItemBubble((this.crop.info.width >> 1) + (xml.exists("speechX") ? com_davidmaletz_mining_Main.parseInt(xml.get("speechX")) : 0),this.crop.info.height - 35 + (xml.exists("speechY") ? com_davidmaletz_mining_Main.parseInt(xml.get("speechY")) : 0),this.crop)); + } + ,init: function(e) { + com_davidmaletz_tiles_render_PlayAnimation.prototype.init.call(this,e); + this.crop.slot.addEventListener("update_crop",$bind(this,this.update_crop)); + this.update_crop(null); + } + ,destroy: function(e) { + com_davidmaletz_tiles_render_PlayAnimation.prototype.destroy.call(this,e); + this.crop.slot.removeEventListener("update_crop",$bind(this,this.update_crop)); + if(this.farmItem != null) { + this.farmItem.removeEventListener("update_percent",$bind(this,this.update_grow)); + this.farmItem = null; + } + } + ,updateFrame: function(p) { + this.playAnimation(this.crop.slot.info.structure.getAnim("grow"),false); + if(this.crop.slot.hasFarmItem()) { + this.setFrame(this.crop.slot.getFarmItem(0).getPercent() * this.getMaxFrame()); + } + } + ,update_crop: function(e) { + this.clearAll(); + this.tile = this.crop.slot.info.structure.tile; + if(this.farmItem != null) { + this.farmItem.removeEventListener("update_percent",$bind(this,this.update_grow)); + this.farmItem = null; + } + if(this.crop.slot.hasFarmItem()) { + this.farmItem = this.crop.slot.getFarmItem(0); + this.farmItem.addEventListener("update_percent",$bind(this,this.update_grow)); + } + this.update_grow(null); + this.addBubble(); + } + ,update_grow: function(e) { + var info = this.crop.info; + var p = this.crop.slot.hasFarmItem() ? this.crop.slot.getFarmItem(0).getPercent() : 1; + var idle = info.getAnim("idle"); + if(p == 1) { + this.playAnimation(idle,true); + } else if(p == 0 && this.animation == idle) { + var harvest = info.getAnim("harvest"); + if(com_davidmaletz_tiles_TileAnimation.exists(harvest)) { + this.playAnimation(harvest,false,$bind(this,this.updateFrame)); + } else { + this.updateFrame(null); + } + } else if(this.onComplete == null) { + this.updateFrame(null); + } + } + ,advanceFrame: function(frames) { + if(this.animation != this.crop.slot.info.structure.getAnim("grow")) { + com_davidmaletz_tiles_render_PlayAnimation.prototype.advanceFrame.call(this,frames); + } else { + com_davidmaletz_tiles_render_PlayAnimation.prototype.advanceTracks.call(this,frames); + } + } + ,__class__: com_davidmaletz_mining_item_FarmUpgradeRenderer +}); +var com_davidmaletz_mining_structure_Buildable = function() { }; +$hxClasses["com.davidmaletz.mining.structure.Buildable"] = com_davidmaletz_mining_structure_Buildable; +com_davidmaletz_mining_structure_Buildable.__name__ = ["com","davidmaletz","mining","structure","Buildable"]; +com_davidmaletz_mining_structure_Buildable.prototype = { + build: null + ,load: null + ,__class__: com_davidmaletz_mining_structure_Buildable +}; +var com_davidmaletz_mining_item_CropInfo = function(xml,animal) { + this.id = xml.get("id"); + this.xml = xml; + this.farmables = []; + if(xml.nodeName() == "crop") { + if(!xml.xml.exists("destroyRemove")) { + xml.xml.set("destroyRemove","true"); + } + this.structure = new com_davidmaletz_mining_structure_StructureInfo(xml); + this.structure.width = 7 * com_davidmaletz_tiles_Tile.SIZE; + } else { + this.structure = null; + } + var e = xml.xml.elementsNamed("farmable"); + while(e.hasNext()) { + var e1 = e.next(); + var f = new com_davidmaletz_mining_item_FarmInfo(e1,animal); + if(f.item != null) { + this.farmables.push(f); + } + } +}; +$hxClasses["com.davidmaletz.mining.item.CropInfo"] = com_davidmaletz_mining_item_CropInfo; +com_davidmaletz_mining_item_CropInfo.__name__ = ["com","davidmaletz","mining","item","CropInfo"]; +com_davidmaletz_mining_item_CropInfo.__interfaces__ = [com_davidmaletz_mining_ui_InfoItem,com_davidmaletz_mining_structure_Buildable]; +com_davidmaletz_mining_item_CropInfo.info = null; +com_davidmaletz_mining_item_CropInfo.loadCrop = function(e,animal) { + if(com_davidmaletz_mining_item_CropInfo.info == null) { + com_davidmaletz_mining_item_CropInfo.info = new haxe_ds_StringMap(); + } + var i = new com_davidmaletz_mining_item_CropInfo(e,animal); + if(com_davidmaletz_mining_item_CropInfo.info.exists(i.id)) { + haxe_Log.trace("Overwrite Crop: " + i.id,{ fileName : "CropInfo.hx", lineNumber : 54, className : "com.davidmaletz.mining.item.CropInfo", methodName : "loadCrop"}); + } + com_davidmaletz_mining_item_CropInfo.info.set(i.id,i); + if(!animal && !com_davidmaletz_mining_item_ItemInfo.exists(i.id + "_seed")) { + com_davidmaletz_mining_structure_StructureInfo.set(i.id,i); + com_davidmaletz_mining_item_ItemInfo.loadItem(new com_davidmaletz_faengfl_XmlPath(Xml.parse(i.makeSeed()).firstElement(),e.path)); + } +}; +com_davidmaletz_mining_item_CropInfo.get = function(id) { + var ret = com_davidmaletz_mining_item_CropInfo._get(id); + if(id != null && id.length > 0 && ret == null) { + haxe_Log.trace("No Crop found: " + id,{ fileName : "CropInfo.hx", lineNumber : 60, className : "com.davidmaletz.mining.item.CropInfo", methodName : "get"}); + } + return ret; +}; +com_davidmaletz_mining_item_CropInfo._get = function(id) { + if(id == null || com_davidmaletz_mining_item_CropInfo.info == null) { + return null; + } else { + return com_davidmaletz_mining_item_CropInfo.info.get(id); + } +}; +com_davidmaletz_mining_item_CropInfo.exists = function(id) { + if(id != null && com_davidmaletz_mining_item_CropInfo.info != null) { + return com_davidmaletz_mining_item_CropInfo.info.exists(id); + } else { + return false; + } +}; +com_davidmaletz_mining_item_CropInfo.reset = function() { + com_davidmaletz_mining_item_CropInfo.info = null; +}; +com_davidmaletz_mining_item_CropInfo.addProduction = function(s,w,x,y,farmables,label,renderItem) { + var t = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("structure",label),new com_fancyfish_faeng_text_CharacterPlacer(w,1),153,1); + t.set_x(x); + t.set_y(y); + s.addChild(t); + var oldy = y += t.lineHeight(); + var ct = 0; + var count = 0; + var skip = 0; + var item = farmables; + while(item.hasNext()) { + var item1 = item.next(); + ++count; + if(count > 6) { + ++skip; + continue; + } + var farm = Std["is"](item1,com_davidmaletz_mining_item_FarmItem) ? js_Boot.__cast(item1 , com_davidmaletz_mining_item_FarmItem) : null; + var info = farm == null ? js_Boot.__cast(item1 , com_davidmaletz_mining_item_FarmInfo) : farm.info; + if(renderItem == null) { + var item2 = com_davidmaletz_mining_item_ItemInfo.get(info.item); + if(item2 != null) { + com_davidmaletz_mining_ui_ItemRenderer.addItem(s,item2,x,y); + } + } else { + renderItem(ct++,s,w,x,y); + } + var t1 = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Static((info.min == null ? "null" : "" + info.min) + (info.min == info.max ? "" : "-" + (info.max == null ? "null" : "" + info.max))),new com_fancyfish_faeng_text_CharacterPlacer(w,2),0,1); + t1.set_x(x); + t1.set_y(y); + s.addChild(t1); + if(farm == null) { + y += t1.lineHeight(); + } else { + var p = new com_davidmaletz_mining_item__$CropInfo_FarmProgressBar(farm,w); + p.set_x(x); + p.set_y(y + t1.lineHeight()); + s.addChild(p); + y += 12; + } + } + if(y == oldy || skip > 0) { + var m = com_fancyfish_faeng_common_Lang.getText("common","none"); + if(skip > 0) { + var map = new haxe_ds_StringMap(); + map.set("{count}",com_fancyfish_faeng_common_Utils.largeNumberFormat(skip)); + m = new com_fancyfish_faeng_common_mutable_MutableTemplateStatic(com_fancyfish_faeng_common_Lang.getText("common","more"),map); + } + var t2 = new com_davidmaletz_faengfl_TextSprite(m,new com_fancyfish_faeng_text_CharacterPlacer(w,1),0,1); + t2.set_x(x); + t2.set_y(y); + s.addChild(t2); + y += t2.lineHeight(); + } + return y; +}; +com_davidmaletz_mining_item_CropInfo.prototype = { + id: null + ,farmables: null + ,structure: null + ,xml: null + ,build: function(p,area,x,y,xml,vars) { + var crop = new com_davidmaletz_mining_item_Crop(this,x,y); + if(xml != null) { + crop.loadXML(xml,vars); + } + return area.addStructure(crop,p); + } + ,load: function(b,version,x,y,addStructure,parent) { + var crop = new com_davidmaletz_mining_item_Crop(this,x,y); + if(b != null) { + crop.read(b,version,parent); + } + crop.onLoad(b,version); + addStructure(crop); + } + ,iterator: function() { + return HxOverrides.iter(this.farmables); + } + ,makeSeed: function() { + return ""; + } + ,getName: function() { + return com_fancyfish_faeng_common_Lang.getText("structure",this.structure.id); + } + ,createIcon: function() { + return null; + } + ,getElement: function() { + return null; + } + ,addInfo: function(s,w,x,y) { + return com_davidmaletz_mining_item_CropInfo.addProduction(s,w,x,y,this.iterator(),"produces"); + } + ,__class__: com_davidmaletz_mining_item_CropInfo +}; +var com_davidmaletz_mining_item__$CropInfo_FarmProgressBar = function(farm,w) { + com_davidmaletz_controls_ProgressBar.call(this,w,2,com_davidmaletz_mining_Main.PROGRESS_COL,farm.getPercent(),false); + this.farm = farm; + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); +}; +$hxClasses["com.davidmaletz.mining.item._CropInfo.FarmProgressBar"] = com_davidmaletz_mining_item__$CropInfo_FarmProgressBar; +com_davidmaletz_mining_item__$CropInfo_FarmProgressBar.__name__ = ["com","davidmaletz","mining","item","_CropInfo","FarmProgressBar"]; +com_davidmaletz_mining_item__$CropInfo_FarmProgressBar.__super__ = com_davidmaletz_controls_ProgressBar; +com_davidmaletz_mining_item__$CropInfo_FarmProgressBar.prototype = $extend(com_davidmaletz_controls_ProgressBar.prototype,{ + farm: null + ,init: function(e) { + this.destroy(e); + this.farm.addEventListener("update_percent",$bind(this,this.update)); + } + ,destroy: function(e) { + this.farm.removeEventListener("update_percent",$bind(this,this.update)); + } + ,update: function(e) { + this.setProgress(this.farm.getPercent()); + } + ,__class__: com_davidmaletz_mining_item__$CropInfo_FarmProgressBar +}); +var com_davidmaletz_mining_item_EquipCost = function(xml) { + this.health = xml.exists("health") ? com_davidmaletz_mining_Main.parseInt(xml.get("health")) : 0; + this.stamina = xml.exists("stamina") ? com_davidmaletz_mining_Main.parseInt(xml.get("stamina")) : 0; + this.durability = xml.exists("durability") ? com_davidmaletz_mining_Main.parseInt(xml.get("durability")) : 0; + this.storage = xml.get("storage"); + this.storageCost = xml.exists("cost") ? com_davidmaletz_mining_Main.parseInt(xml.get("cost")) : 0; + if(xml.exists("daylight")) { + this.daylight = xml.get("daylight") == "true" ? 1 : -1; + } else { + this.daylight = 0; + } + if(xml.exists("day")) { + this.day = xml.get("day") == "true" ? 1 : -1; + } else { + this.day = 0; + } + if(xml.exists("injured")) { + this.injured = xml.get("injured") == "true" ? 1 : -1; + } else { + this.injured = 0; + } + if(xml.exists("full")) { + this.full = xml.get("full") == "true" ? 1 : -1; + } else { + this.full = 0; + } + this.desc = xml.get("desc"); +}; +$hxClasses["com.davidmaletz.mining.item.EquipCost"] = com_davidmaletz_mining_item_EquipCost; +com_davidmaletz_mining_item_EquipCost.__name__ = ["com","davidmaletz","mining","item","EquipCost"]; +com_davidmaletz_mining_item_EquipCost.prototype = { + health: null + ,stamina: null + ,durability: null + ,storage: null + ,storageCost: null + ,daylight: null + ,day: null + ,injured: null + ,full: null + ,desc: null + ,cancelRun: function(p,slot) { + if(this.full != 0 && this.full == 1 != p.equipment.getItem(slot).value < com_fancyfish_faeng_common_Utils.max(0,-this.durability)) { + return true; + } + if(this.injured != 0 && this.injured == 1 != p.getHealthPercent() < 1) { + return true; + } else if(p.area == null) { + return false; + } else { + return this.isRestricted(p.area,p.yTile); + } + } + ,isRestricted: function(area,y) { + if(this.daylight != 0 && this.daylight == 1 != com_davidmaletz_mining_Main.getSunlight(area,y) > 0.8) { + return true; + } else if(this.day != 0) { + return this.day == 1 == com_davidmaletz_mining_Main.isNight(); + } else { + return false; + } + } + ,run: function(p,slot) { + if(this.cancelRun(p,slot)) { + return; + } + if(this.health < 0) { + p.addHealth(-this.health); + } else if(this.health > 0) { + p.loseHealth(this.health,0,null,null,0); + } + if(this.stamina < 0) { + p.addStamina(-this.stamina); + } else if(this.stamina > 0) { + p.loseStamina(this.stamina); + } + if(this.durability != 0) { + p.equipment.increaseValue(p,slot,this.durability); + } + if(this.storage != null && this.storageCost != 0) { + var s = p.getStorage(this.storage); + if(s != null) { + s.addValue(-this.storageCost); + } + } + } + ,canRun: function(p,slot) { + if(this.cancelRun(p,slot)) { + return true; + } + if(this.durability > 0) { + var s = p.equipment.get(slot); + if(s == null) { + return false; + } + var i = s.get(); + if(i == null || i.info.xml.get("breakable") == "false" && i.value + this.durability > i.info.getDurability()) { + return false; + } + } + if(this.storage != null && this.storageCost > 0) { + var s1 = p.getStorage(this.storage); + if(s1 == null || s1.getValue() < this.storageCost) { + return false; + } + } + return true; + } + ,getDesc: function(s) { + if(s == null) { + s = "cost_per_s"; + } + var m = com_fancyfish_faeng_common_Lang.getTextFromTitle(this.desc); + if(m != null) { + return m; + } + if(this.injured == 1) { + s += "_injured"; + } else if(this.daylight == 1) { + s += "_daylight"; + } else if(this.daylight == -1) { + s += "_darkness"; + } else if(this.day == 1) { + s += "_day"; + } else if(this.day == -1) { + s += "_night"; + } else if(this.full == 1) { + s += "_undamaged"; + } else if(this.full == -1) { + s += "_damaged"; + } + return com_fancyfish_faeng_common_Lang.getText("item.descriptions",s); + } + ,addLine: function(s,w,x,y,name,val,colon,cost_str) { + if(cost_str == null) { + cost_str = "cost_per_s"; + } + if(colon == null) { + colon = false; + } + var tile = com_davidmaletz_tiles_Tile.get(name); + if(tile != null) { + var t = com_davidmaletz_mining_item_ItemInfo._createIcon(tile); + t.set_x(x); + t.set_y(y); + s.addChild(t); + x += 10; + w -= 10; + } + var m = com_davidmaletz_mining_item_ItemInfo.twoDigits(-val,true); + var t1 = this.getDesc(cost_str).get(); + return com_davidmaletz_mining_item_ItemInfo._addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("common",name),StringTools.replace(t1,"{value}",m),colon); + } + ,addInfo: function(s,w,x,y,cost_str) { + if(cost_str == null) { + cost_str = "cost_per_s"; + } + if(this.health != 0) { + y = this.addLine(s,w,x,y,"health",this.health,false,cost_str); + } + if(this.stamina != 0) { + y = this.addLine(s,w,x,y,"stamina",this.stamina,false,cost_str); + } + if(this.storage != null && this.storageCost != 0) { + y = this.addLine(s,w,x,y,this.storage,this.storageCost,true,cost_str); + } + return y; + } + ,__class__: com_davidmaletz_mining_item_EquipCost +}; +var com_davidmaletz_mining_item_EquipOn = function(x,y,append,px,py,d) { + this.x = x; + this.y = y; + this.append = append; + this.projX = px; + this.projY = py; + this.delay = d; +}; +$hxClasses["com.davidmaletz.mining.item.EquipOn"] = com_davidmaletz_mining_item_EquipOn; +com_davidmaletz_mining_item_EquipOn.__name__ = ["com","davidmaletz","mining","item","EquipOn"]; +com_davidmaletz_mining_item_EquipOn.prototype = { + x: null + ,y: null + ,delay: null + ,projX: null + ,projY: null + ,append: null + ,__class__: com_davidmaletz_mining_item_EquipOn +}; +var com_davidmaletz_mining_ui_ItemType = function() { }; +$hxClasses["com.davidmaletz.mining.ui.ItemType"] = com_davidmaletz_mining_ui_ItemType; +com_davidmaletz_mining_ui_ItemType.__name__ = ["com","davidmaletz","mining","ui","ItemType"]; +com_davidmaletz_mining_ui_ItemType.__interfaces__ = [com_davidmaletz_mining_ui_InfoItem]; +com_davidmaletz_mining_ui_ItemType.prototype = { + getInfo: null + ,__class__: com_davidmaletz_mining_ui_ItemType +}; +var com_davidmaletz_mining_item_ItemInfo = function(xml) { + this.projectiles = null; + this.storage_p = false; + this.oxygen_p = false; + this.stamina_p = false; + this.health_p = false; + this.id = xml.get("id"); + this.type = com_davidmaletz_mining_item_ItemCategory.parse(xml.get("type")); + this.cost = xml.exists("cost") ? com_davidmaletz_mining_Main.parseInt(xml.get("cost")) : 0; + this.actions = []; + if(this.type.action != null) { + this.actions.push(new com_davidmaletz_mining_item_Action(this.type.action)); + } + if(xml.exists("action")) { + this.actions.push(new com_davidmaletz_mining_item_Action(xml.get("action"),xml.get("actionName"))); + } + var e = xml.elementPathsNamed("action"); + while(e.hasNext()) { + var e1 = e.next(); + var i = -1; + var tmp; + if(e1.exists("extends")) { + i = this.getActionIndex(e1.get("extends")); + tmp = i >= 0; + } else { + tmp = false; + } + if(tmp) { + var a = com_davidmaletz_mining_item_Action.fromXML(new com_davidmaletz_faengfl_XmlDual(e1,this.actions[i].xml)); + if(a.id != null) { + this.actions[i] = a; + } + } else { + var a1 = com_davidmaletz_mining_item_Action.fromXML(e1); + if(a1.id != null) { + this.actions.push(a1); + if(e1.exists("alt")) { + this.actions.push(new com_davidmaletz_mining_item_Action(e1.get("alt"),e1.get("alt_name"),e1)); + } + } + } + } + this.xml = xml; + this.weight = xml.exists("weight") ? com_davidmaletz_mining_Main.parseFloat(xml.get("weight")) : 0; + this.animation = xml.get("animation"); + this.health = xml.exists("health") ? com_davidmaletz_mining_Main.parseInt(xml.get("health")) : 0; + if(this.health != 0) { + this.health_p = StringTools.endsWith(xml.get("health"),"%"); + } + this.stamina = xml.exists("stamina") ? com_davidmaletz_mining_Main.parseInt(xml.get("stamina")) : 0; + if(this.stamina != 0) { + this.stamina_p = StringTools.endsWith(xml.get("stamina"),"%"); + } + this.oxygen = xml.exists("oxygen") ? com_davidmaletz_mining_Main.parseInt(xml.get("oxygen")) : 0; + if(this.oxygen != 0) { + this.oxygen_p = StringTools.endsWith(xml.get("oxygen"),"%"); + } + if(xml.exists("eatStorage")) { + this.storage = xml.exists("value") ? com_davidmaletz_mining_Main.parseInt(xml.get("value")) : 0; + if(this.storage != 0) { + this.storage_p = StringTools.endsWith(xml.get("value"),"%"); + } + } else { + this.storage = 0; + } + if(xml.exists("color")) { + this.color = com_davidmaletz_mining_Main.parseInt("0x" + xml.get("color")); + } else { + this.color = 16777215; + } + if(xml.exists("colorScale")) { + this.colorScale = com_davidmaletz_mining_Main.parseFloat(xml.get("colorScale")); + } else { + this.colorScale = 1; + } + var i1 = xml.elementsNamed("light"); + if(i1.hasNext()) { + this.light = new com_davidmaletz_mining_world_LightInfo(i1.next()); + } + var i2 = xml.elementsNamed("equipCost"); + if(i2.hasNext()) { + this.equipCost = new com_davidmaletz_mining_item_EquipCost(i2.next()); + } + var i3 = xml.elementsNamed("identify"); + if(i3.hasNext()) { + this.identify = new com_davidmaletz_mining_item_Identify(i3.next()); + } + this.slots = []; + var e2 = xml.elementsNamed("use"); + while(e2.hasNext()) { + var e3 = e2.next(); + if(e3.exists("slot")) { + this.slots.push(e3.get("slot")); + } + } + if(this.getDurability() > 65535) { + throw new js__$Boot_HaxeError("Max item durability is 65535"); + } +}; +$hxClasses["com.davidmaletz.mining.item.ItemInfo"] = com_davidmaletz_mining_item_ItemInfo; +com_davidmaletz_mining_item_ItemInfo.__name__ = ["com","davidmaletz","mining","item","ItemInfo"]; +com_davidmaletz_mining_item_ItemInfo.__interfaces__ = [com_davidmaletz_mining_ui_ItemType]; +com_davidmaletz_mining_item_ItemInfo.hasModifiers = function(i) { + if(!i.xml.elementsNamed("modifiers").hasNext()) { + return i.xml.elementsNamed("modifyTransform").hasNext(); + } else { + return true; + } +}; +com_davidmaletz_mining_item_ItemInfo._createIcon = function(tile,offX,offY,x,y) { + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + if(tile == null) { + return new openfl_display_Sprite(); + } else { + var l = new com_davidmaletz_faengfl_TileLayer(); + l.start(); + tile.render(null,l,x,y,offX,offY); + l.finish(); + return l; + } +}; +com_davidmaletz_mining_item_ItemInfo.getModItem = function(name) { + return com_davidmaletz_mining_item_ItemInfo.get(com_davidmaletz_mining_item_ItemInfo.getParameter(name,"m")); +}; +com_davidmaletz_mining_item_ItemInfo.getMod = function(name) { + var p = com_davidmaletz_mining_item_ItemInfo.getModItem(name); + if(p != null) { + var i = p.xml.elementsNamed("modifiers"); + if(i.hasNext()) { + return i.next(); + } + } + return null; +}; +com_davidmaletz_mining_item_ItemInfo.addCoins = function(label,coins,s,w,x,y) { + var icon = com_davidmaletz_mining_item_ItemInfo._createIcon(com_davidmaletz_tiles_Tile.get("coins")); + icon.set_scaleX(icon.set_scaleY(0.5)); + icon.set_x(x); + icon.set_y(y); + s.addChild(icon); + var t = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Concat(label,": " + com_fancyfish_faeng_common_Utils.largeNumberFormat(coins)),new com_fancyfish_faeng_text_CharacterPlacer(0),0,0.5); + t.set_x(icon.get_x() + com_davidmaletz_tiles_Tile.SIZE * 0.5 + 1); + t.set_y(y); + s.addChild(t); + y += t.lineHeight() >> 1; + return y; +}; +com_davidmaletz_mining_item_ItemInfo.halfScale = function(func,item,s,w,x,y) { + var inner = new openfl_display_Sprite(); + inner.set_x(x); + inner.set_y(y); + inner.set_scaleX(inner.set_scaleY(0.5)); + s.addChild(inner); + return y + (func(item,inner,w * 2,0,0) >> 1); +}; +com_davidmaletz_mining_item_ItemInfo.addModifierInfo = function(item,s,w,x,y) { + var iter = item.xml.elementsNamed("modifiers"); + if(iter.hasNext()) { + var xml = iter.next(); + if(xml.exists("attack")) { + y = com_davidmaletz_mining_item_ItemInfo._addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("stats","attack"),com_davidmaletz_mining_item_ItemInfo.twoDigits(com_davidmaletz_mining_Main.parseInt(xml.get("attack")),true)); + } + if(xml.exists("range")) { + y = com_davidmaletz_mining_item_ItemInfo._addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("stats","range"),com_davidmaletz_mining_item_ItemInfo.twoDigits(com_davidmaletz_mining_Main.parseInt(xml.get("range")),true)); + } + if(xml.exists("defense")) { + y = com_davidmaletz_mining_item_ItemInfo._addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("stats","defense"),com_davidmaletz_mining_item_ItemInfo.twoDigits(com_davidmaletz_mining_Main.parseInt(xml.get("defense")),true)); + } + if(xml.exists("elementDefense")) { + y = com_davidmaletz_mining_item_ItemInfo._addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("stats","elementDefense"),com_davidmaletz_mining_item_ItemInfo.twoDigits(com_davidmaletz_mining_Main.parseInt(xml.get("elementDefense")),true)); + } + if(xml.exists("cut")) { + y = com_davidmaletz_mining_item_ItemInfo._addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("stats","cut"),com_davidmaletz_mining_item_ItemInfo.twoDigits(com_davidmaletz_mining_Main.parseInt(xml.get("cut")),true)); + } + if(xml.exists("mine")) { + y = com_davidmaletz_mining_item_ItemInfo._addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("stats","mine"),com_davidmaletz_mining_item_ItemInfo.twoDigits(com_davidmaletz_mining_Main.parseInt(xml.get("mine")),true)); + } + if(xml.exists("capacity")) { + y = com_davidmaletz_mining_item_ItemInfo._addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("common","capacity"),com_davidmaletz_mining_item_ItemInfo.twoDigits(com_davidmaletz_mining_Main.parseInt(xml.get("capacity")),true)); + } + if(xml.exists("fishing")) { + y = com_davidmaletz_mining_item_ItemInfo._addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("stats","fishing"),com_davidmaletz_mining_item_ItemInfo.twoDigits(com_davidmaletz_mining_Main.parseInt(xml.get("fishing")),true)); + } + if(xml.exists("oxygen")) { + y = com_davidmaletz_mining_item_ItemInfo._addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("common","oxygen"),com_davidmaletz_mining_item_ItemInfo.twoDigits(com_davidmaletz_mining_Main.parseInt(xml.get("oxygen")),true)); + } + if(xml.exists("efficiency")) { + y = com_davidmaletz_mining_item_ItemInfo._addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("common","efficiency"),com_davidmaletz_mining_item_ItemInfo.twoDigits(com_davidmaletz_mining_Main.parseFloat(xml.get("efficiency")),true)); + } + var el = com_davidmaletz_mining_world_Element.get(xml.get("element")); + if(el != null) { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("elements","change").get() + ": " + com_fancyfish_faeng_common_Lang.getText("elements",el.id).get()); + } + if(xml.get("viewHidden") == "true") { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions","view_hidden").get()); + } + if(xml.elementsNamed("light").hasNext()) { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions","light").get()); + } + var e = xml.elementsNamed("spawn"); + while(e.hasNext()) { + var e1 = e.next(); + var i = com_davidmaletz_mining_item_ItemInfo.get(e1.get("item")); + if(i != null) { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,i.getNotification(com_fancyfish_faeng_common_Lang.getText("item.descriptions","spawn"),null,false)); + } + } + } + return y; +}; +com_davidmaletz_mining_item_ItemInfo._addLine = function(s,w,x,y,m,val,colon,col,sz) { + if(sz == null) { + sz = 1; + } + if(col == null) { + col = 0; + } + if(colon == null) { + colon = true; + } + var t = new com_davidmaletz_faengfl_TextSprite(val == null ? m : new com_fancyfish_faeng_common_mutable_Concat(m,(colon ? ":" : "") + " " + val),new com_fancyfish_faeng_text_CharacterPlacer(0),col,sz); + t.set_x(x); + t.set_y(y); + s.addChild(t); + y += Math.round(t.lineHeight() * sz); + return y; +}; +com_davidmaletz_mining_item_ItemInfo.addLine = function(s,w,x,y,m,val,showPlus,colon,col,sz) { + if(sz == null) { + sz = 1; + } + if(col == null) { + col = 0; + } + if(colon == null) { + colon = true; + } + if(showPlus == null) { + showPlus = false; + } + if(val > 0) { + return com_davidmaletz_mining_item_ItemInfo._addLine(s,w,x,y,m,com_davidmaletz_mining_item_ItemInfo.twoDigits(val,showPlus),colon,col,sz); + } + return y; +}; +com_davidmaletz_mining_item_ItemInfo.twoDigits = function(val,showPlus) { + if(showPlus == null) { + showPlus = false; + } + var s = Std.string(Math.round(val * 100) / 100); + if(showPlus && val > 0) { + return "+" + s; + } else { + return s; + } +}; +com_davidmaletz_mining_item_ItemInfo.addMod = function(sprite,w,x,y,label,m,mod,time,max,current) { + var s = m.get(); + s = StringTools.replace(s,"{time}",time == null ? "null" : "" + time); + s = StringTools.replace(s,"{max}",max == null ? "null" : "" + max); + s = StringTools.replace(s,"{current}",current == null ? "null" : "" + current); + s = StringTools.replace(s,"{mod}",com_davidmaletz_mining_item_ItemInfo.twoDigits(mod,true)); + return com_davidmaletz_mining_item_ItemInfo._addLine(sprite,w,x,y,label,s,true); +}; +com_davidmaletz_mining_item_ItemInfo.addFormattedText = function(s,w,x,y,m,sz,col) { + if(col == null) { + col = 0; + } + if(sz == null) { + sz = 1; + } + var t = new com_davidmaletz_mining_ui_MyFormattedText(Math.round(w / sz),true,null); + t.default_color = col; + t.setText(m); + t.set_scaleX(t.set_scaleY(sz)); + t.set_x(x); + t.set_y(y); + s.addChild(t); + return y + Math.round(t.bounds.height * sz + 1); +}; +com_davidmaletz_mining_item_ItemInfo.items = null; +com_davidmaletz_mining_item_ItemInfo.aliases = null; +com_davidmaletz_mining_item_ItemInfo.create = function(xml) { + if(com_davidmaletz_mining_item_Equipment.isEquipment(xml)) { + return new com_davidmaletz_mining_item_Equipment(xml); + } else { + return new com_davidmaletz_mining_item_ItemInfo(xml); + } +}; +com_davidmaletz_mining_item_ItemInfo.loadItem = function(e) { + if(e.exists("alias")) { + var i = com_davidmaletz_mining_item_ItemInfo.get(e.get("id")); + if(i == null) { + return; + } + if(com_davidmaletz_mining_item_ItemInfo.aliases == null) { + com_davidmaletz_mining_item_ItemInfo.aliases = new haxe_ds_StringMap(); + } + var v = e.exists("value") ? i.getDurability() - com_davidmaletz_mining_Main.parseInt(e.get("value")) : 0; + var n = e.get("name"); + var id = e.get("alias"); + n = com_davidmaletz_mining_item_ItemInfo.setParameter(n,"a",id); + var p = e.elementsNamed("parameter"); + while(p.hasNext()) { + var p1 = p.next(); + n = com_davidmaletz_mining_item_ItemInfo.setParameter(n,p1.get("id").charAt(0),p1.get("value")); + } + var item = new com_davidmaletz_mining_item_Item(i,v,n); + com_davidmaletz_mining_item_ItemInfo.aliases.set(id,item); + if(!com_davidmaletz_mining_world_ObjectInfo.exists(id) || Std["is"](com_davidmaletz_mining_world_ObjectInfo.get(id),com_davidmaletz_mining_world_ItemObjectInfo)) { + com_davidmaletz_mining_world_ObjectInfo.loadInfo(new com_davidmaletz_mining_world_ItemObjectInfo(i,id,item.getNameStr())); + } + } else { + if(com_davidmaletz_mining_item_ItemInfo.items == null) { + com_davidmaletz_mining_item_ItemInfo.items = new haxe_ds_StringMap(); + } + var i1 = com_davidmaletz_mining_item_ItemInfo.create(e); + if(com_davidmaletz_mining_item_ItemInfo.items.exists(i1.id)) { + haxe_Log.trace("Overwrite Item: " + i1.id,{ fileName : "ItemInfo.hx", lineNumber : 506, className : "com.davidmaletz.mining.item.ItemInfo", methodName : "loadItem"}); + } + com_davidmaletz_mining_item_ItemInfo.items.set(i1.id,i1); + if(!com_davidmaletz_mining_world_ObjectInfo.exists(i1.id) || Std["is"](com_davidmaletz_mining_world_ObjectInfo.get(i1.id),com_davidmaletz_mining_world_ItemObjectInfo)) { + com_davidmaletz_mining_world_ObjectInfo.loadInfo(new com_davidmaletz_mining_world_ItemObjectInfo(i1)); + } + } +}; +com_davidmaletz_mining_item_ItemInfo.getAlias = function(id) { + if(id == null || com_davidmaletz_mining_item_ItemInfo.aliases == null) { + return null; + } else { + return com_davidmaletz_mining_item_ItemInfo.aliases.get(id); + } +}; +com_davidmaletz_mining_item_ItemInfo.get = function(id) { + var ret = com_davidmaletz_mining_item_ItemInfo._get(id); + if(id != null && id.length > 0 && ret == null) { + haxe_Log.trace("No Item found: " + id,{ fileName : "ItemInfo.hx", lineNumber : 514, className : "com.davidmaletz.mining.item.ItemInfo", methodName : "get"}); + com_davidmaletz_mining_Main.error = true; + } + return ret; +}; +com_davidmaletz_mining_item_ItemInfo._get = function(id) { + if(id == null || com_davidmaletz_mining_item_ItemInfo.items == null) { + return null; + } else { + return com_davidmaletz_mining_item_ItemInfo.items.get(id); + } +}; +com_davidmaletz_mining_item_ItemInfo.exists = function(id) { + if(id != null && com_davidmaletz_mining_item_ItemInfo.items != null) { + return com_davidmaletz_mining_item_ItemInfo.items.exists(id); + } else { + return false; + } +}; +com_davidmaletz_mining_item_ItemInfo.getAll = function() { + if(com_davidmaletz_mining_item_ItemInfo.items == null) { + return new com_fancyfish_faeng_common_NullIterator(); + } else { + return com_davidmaletz_mining_item_ItemInfo.items.iterator(); + } +}; +com_davidmaletz_mining_item_ItemInfo.getBlueprintForStructure = function(id) { + var i = com_davidmaletz_mining_item_ItemInfo.getAll(); + while(i.hasNext()) { + var i1 = i.next(); + var e = i1.getActionXml("build"); + if(e == null) { + e = i1.getActionXml("upgrade"); + if(e == null) { + continue; + } + } + if(id == e.get("structure")) { + return { item : i1, xml : e}; + } + } + return null; +}; +com_davidmaletz_mining_item_ItemInfo.reset = function() { + com_davidmaletz_mining_item_ItemInfo.items = null; + com_davidmaletz_mining_item_ItemInfo.aliases = null; +}; +com_davidmaletz_mining_item_ItemInfo.getParameter = function(n,c) { + if(n != null) { + var i = n.indexOf("&"); + if(i != -1) { + var t = new com_fancyfish_faeng_common_StringTokenizer(n,",",i); + while(t.next()) if(n.charAt(t.token_start) == c) { + return n.substring(t.token_start + 1,t.token_end); + } + } + } + return null; +}; +com_davidmaletz_mining_item_ItemInfo.getParameterMap = function(n) { + if(n == null) { + return null; + } + var i = n.indexOf("&"); + if(i == -1) { + return null; + } + var ret = new haxe_ds_StringMap(); + var t = new com_fancyfish_faeng_common_StringTokenizer(n,",",i); + while(t.next()) ret.set(n.charAt(t.token_start),n.substring(t.token_start + 1,t.token_end)); + return ret; +}; +com_davidmaletz_mining_item_ItemInfo.lessThan = function(a,b) { + return a < b; +}; +com_davidmaletz_mining_item_ItemInfo.writeParameterMap = function(map,b) { + if(map == null) { + return; + } + var heap = new com_fancyfish_faeng_common_Heap(com_davidmaletz_mining_item_ItemInfo.lessThan); + var k = map.keys(); + while(k.hasNext()) { + var k1 = k.next(); + heap.insert(k1); + } + var first = true; + while(!heap.isEmpty()) { + if(first) { + first = false; + } else { + b.add(","); + } + var k2 = heap.remove(); + b.add(k2.charAt(0)); + b.add(map.get(k2)); + } +}; +com_davidmaletz_mining_item_ItemInfo.sortParameters = function(n) { + var map = com_davidmaletz_mining_item_ItemInfo.getParameterMap(n); + if(map == null) { + return n; + } + var b = new StringBuf(); + com_davidmaletz_mining_item_ItemInfo.writeParameterMap(map,b); + b.add("&"); + if(n != null) { + var i = n.indexOf("&"); + if(i != -1) { + b.add(HxOverrides.substr(n,i + 1,null)); + } else { + b.add(n); + } + } + var ret = b.toString(); + if(ret == "&") { + return null; + } else { + return ret; + } +}; +com_davidmaletz_mining_item_ItemInfo.setParameter = function(n,c,val) { + var map = com_davidmaletz_mining_item_ItemInfo.getParameterMap(n); + var b = new StringBuf(); + if(map == null) { + if(val != null) { + b.add(c.charAt(0)); + b.add(val); + } else { + return n; + } + } else { + if(val == null) { + map.remove(c); + } else { + map.set(c,val); + } + com_davidmaletz_mining_item_ItemInfo.writeParameterMap(map,b); + } + b.add("&"); + if(n != null) { + var i = n.indexOf("&"); + if(i != -1) { + b.add(HxOverrides.substr(n,i + 1,null)); + } else { + b.add(n); + } + } + var ret = b.toString(); + if(ret == "&") { + return null; + } else { + return ret; + } +}; +com_davidmaletz_mining_item_ItemInfo.prototype = { + id: null + ,type: null + ,cost: null + ,weight: null + ,actions: null + ,animation: null + ,xml: null + ,health: null + ,stamina: null + ,oxygen: null + ,storage: null + ,health_p: null + ,stamina_p: null + ,oxygen_p: null + ,storage_p: null + ,identify: null + ,color: null + ,colorScale: null + ,light: null + ,equipCost: null + ,slots: null + ,projectiles: null + ,getProjectile: function() { + if(this.xml.get("multiProjectile") == "true" || this.xml.get("fireAll") == "true") { + if(this.projectiles == null || !this.projectiles.hasNext()) { + this.projectiles = this.xml.elementsNamed("projectile"); + } + if(this.projectiles.hasNext()) { + return this.projectiles.next(); + } else { + return null; + } + } else { + var p = this.xml.elementsNamed("projectile"); + if(p.hasNext()) { + return p.next(); + } else { + return null; + } + } + } + ,resetProjectile: function() { + this.projectiles = null; + } + ,getHealth: function(p) { + if(this.health_p) { + return Math.floor(this.health * p.getMaxHealth() / 100); + } else { + return this.health; + } + } + ,getStamina: function(p) { + var ret = this.stamina; + if(this.stamina_p) { + ret = Math.floor(this.stamina * p.getMaxStamina() / 100); + } + var stat = this.xml.get("staminaStat"); + if(stat != null) { + ret -= com_fancyfish_faeng_common_Utils.min(ret - 1,Math.ceil(ret * p.stats.getInt(stat) / 10)); + } + return ret; + } + ,getOxygen: function(p) { + if(this.oxygen_p) { + return Math.floor(this.oxygen * p.getMaxOxygen() / 100); + } else { + return this.oxygen; + } + } + ,getStorage: function(p) { + if(this.storage_p) { + return Math.floor(this.storage * p.getStorage(this.xml.get("eatStorage")).getMaxValue() / 100); + } else { + return this.storage; + } + } + ,canStore: function() { + if(this.xml.exists("canStore")) { + return this.xml.get("canStore") != "false"; + } else if(this.type != null) { + return this.type.canStore; + } else { + return true; + } + } + ,syncPlayers: function() { + if(this.xml.exists("syncPlayers")) { + return this.xml.get("syncPlayers") == "true"; + } else if(this.type != null) { + return this.type.syncPlayers; + } else { + return true; + } + } + ,showCount: function() { + if(this.xml.exists("showCount")) { + return this.xml.get("showCount") != "false"; + } else if(this.type != null) { + return this.type.showCount; + } else { + return true; + } + } + ,canModify: function(i) { + if(this.xml.elementsNamed("modifiers").hasNext()) { + return !i.xml.exists("range"); + } else { + return false; + } + } + ,getName: function() { + var m = com_fancyfish_faeng_common_Lang.getTextFromTitle(this.xml.get("name")); + if(m == null) { + return com_fancyfish_faeng_common_Lang.getText("item.names",this.xml.exists("name") ? this.xml.get("name") : this.id); + } else { + return m; + } + } + ,hasDescription: function() { + var t = this.id; + if(this.xml.exists("desc")) { + t = this.xml.get("desc"); + if(com_fancyfish_faeng_common_Lang.getTextFromTitle(t) != null) { + return true; + } + } + return com_fancyfish_faeng_common_Lang.hasText("item.descriptions",t); + } + ,getDescription: function() { + var t = this.id; + if(this.xml.exists("desc")) { + t = this.xml.get("desc"); + var m = com_fancyfish_faeng_common_Lang.getTextFromTitle(t); + if(m != null) { + return m; + } + } + return com_fancyfish_faeng_common_Lang.getText("item.descriptions",t); + } + ,tint: function(s,name) { + var m = com_davidmaletz_mining_item_ItemInfo.getMod(name); + var c = this.color; + var cs = this.colorScale; + var tmp = com_davidmaletz_mining_item_ItemInfo.getParameter(name,"c"); + if(tmp != null) { + c = com_davidmaletz_mining_Main.parseInt("0x" + tmp); + } + if(m != null) { + if(m.exists("color")) { + c = com_davidmaletz_mining_Main.parseInt("0x" + m.get("color")); + } + if(m.exists("colorScale")) { + cs = com_davidmaletz_mining_Main.parseFloat(m.get("colorScale")); + } + } + com_davidmaletz_faengfl_TextSprite.setColor(s,c,255 / cs); + return s; + } + ,tintProjectile: function(p,name) { + var m = com_davidmaletz_mining_item_ItemInfo.getMod(name); + var c = this.color; + var cs = this.colorScale; + var tmp = com_davidmaletz_mining_item_ItemInfo.getParameter(name,"c"); + if(tmp != null) { + c = com_davidmaletz_mining_Main.parseInt("0x" + tmp); + } + if(m != null) { + if(m.exists("color")) { + c = com_davidmaletz_mining_Main.parseInt("0x" + m.get("color")); + } + if(m.exists("colorScale")) { + cs = com_davidmaletz_mining_Main.parseFloat(m.get("colorScale")); + } + } + p.color = com_fancyfish_faeng_renderer_Color.fromInt(c,false).mult(com_fancyfish_faeng_renderer_Color.fromInt(p.color,false)).toInt() & 16777215; + p.colorScale *= cs; + } + ,asItem: function(value,name) { + if(value == null) { + value = 0; + } + return new com_davidmaletz_mining_item_Item(this,value,name); + } + ,createIcon: function() { + return com_davidmaletz_mining_item_Item._createIcon(this,0,null); + } + ,getAnimation: function(name) { + var m = com_davidmaletz_mining_item_ItemInfo.getMod(name); + return com_davidmaletz_tiles_TileAnimation._get(m == null || !m.exists("animation") ? this.animation : m.get("animation")); + } + ,getFPS: function() { + if(this.xml.exists("fps")) { + return com_davidmaletz_mining_Main.parseFloat(this.xml.get("fps")); + } else { + return 10; + } + } + ,makeIcon: function(name) { + var ico = this.getIcon(name); + var a = this.getAnimation(name); + var s = a == null || ico == null ? com_davidmaletz_mining_item_ItemInfo._createIcon(ico) : new com_davidmaletz_tiles_render_StaticPlayAnimation(ico,a.id,this.getFPS(),true); + if(this.xml.exists("iconOffsetY")) { + var _g = s; + _g.set_y(_g.get_y() + com_davidmaletz_mining_Main.parseInt(this.xml.get("iconOffsetY"))); + } + if(this.xml.get("tintIcon") == "false") { + return s; + } else { + return this.tint(s,name); + } + } + ,getIcon: function(name) { + var t = com_davidmaletz_tiles_Tile.get(com_davidmaletz_mining_item_ItemInfo.getParameter(name,"t")); + if(t == null) { + var m = com_davidmaletz_mining_item_ItemInfo.getMod(name); + if(m == null) { + t = null; + } else { + t = com_davidmaletz_tiles_Tile.get(m.get("icon")); + } + if(t == null) { + return com_davidmaletz_tiles_Tile.get(this.xml.get("icon")); + } else { + return t; + } + } else { + return t; + } + } + ,canUse: function(p) { + if(this.equipCost != null) { + return this.equipCost.canRun(p,this.xml.get("slot")); + } else { + return true; + } + } + ,getFamiliar: function() { + var e = this.xml.elementPathsNamed("familiar"); + if(e.hasNext()) { + return e.next(); + } else { + return null; + } + } + ,getTile: function() { + if(com_davidmaletz_tiles_Tile.exists(this.id)) { + return com_davidmaletz_tiles_Tile.get(this.id); + } else if(this.id != this.xml.get("extends") && com_davidmaletz_mining_item_ItemInfo.exists(this.xml.get("extends"))) { + return com_davidmaletz_mining_item_ItemInfo.get(this.xml.get("extends")).getTile(); + } else { + return com_davidmaletz_tiles_EmptyTile.get(); + } + } + ,getAnim: function(id) { + var t = id == null ? "" : "." + id; + if(com_davidmaletz_tiles_TileAnimation.exists(this.id + t)) { + return this.id + t; + } else { + var f = this.xml.get("extends"); + if(this.id != f && com_davidmaletz_mining_item_ItemInfo.exists(f)) { + return com_davidmaletz_mining_item_ItemInfo.get(f).getAnim(id); + } else { + return "single"; + } + } + } + ,getEquipAnim: function(name,id,append) { + if(append == null) { + append = ""; + } + var t = id == null ? "" : "." + id; + var e = com_davidmaletz_mining_item_ItemInfo.getMod(name); + var pre = "equipment." + this.id; + if(e != null && e.exists("equip_anim")) { + pre = e.get("equip_anim"); + } + if(this.xml.exists("equip_anim")) { + pre = this.xml.get("equip_anim"); + } + if(com_davidmaletz_tiles_TileAnimation.exists(pre + append + t)) { + return pre + append + t; + } else if(id != "death" && com_davidmaletz_tiles_TileAnimation.exists(pre + append + ".idle")) { + return pre + append + ".idle"; + } else { + var f = this.xml.get("extends"); + if(this.id != f && com_davidmaletz_mining_item_ItemInfo.exists(f) && !com_davidmaletz_tiles_TileAnimation.exists(pre) && !com_davidmaletz_tiles_TileAnimation.exists(pre + ".idle")) { + return com_davidmaletz_mining_item_ItemInfo.get(f).getEquipAnim(name,id,append); + } else { + var s = this.xml.get("slot"); + if(s != null && com_davidmaletz_tiles_TileAnimation.exists("equipment." + s + append + t)) { + return "equipment." + s + append + t; + } else if(s != null && com_davidmaletz_tiles_TileAnimation.exists("equipment." + s + t)) { + return "equipment." + s + t; + } else if(id == "death") { + return "hidden"; + } else if(id == "idle") { + return "single"; + } else { + return this.getEquipAnim(name,"idle",append); + } + } + } + } + ,canRepair: function() { + if(!com_davidmaletz_mining_item_ItemInfo.exists(this.xml.get("repair"))) { + return this.xml.elementsNamed("repair").hasNext(); + } else { + return true; + } + } + ,getRepair: function(value,name,equip) { + if(this.canRepair()) { + return com_davidmaletz_mining_item_Recipe.createRepair(this,value,name,equip); + } else { + return null; + } + } + ,getPlace: function(name) { + var a = com_davidmaletz_mining_item_ItemInfo.getParameter(name,"a"); + if(com_davidmaletz_mining_world_ObjectInfo.exists(a)) { + return com_davidmaletz_mining_world_ObjectInfo.get(a); + } else { + return com_davidmaletz_mining_world_ObjectInfo.get(this.id); + } + } + ,hasActionId: function(id) { + var _g = 0; + var _g1 = this.actions; + while(_g < _g1.length) { + var a = _g1[_g]; + ++_g; + if(a.id == id) { + return true; + } + } + return false; + } + ,actionAvailable: function(id,p,value,name) { + var vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(p); + vars.set("name",name); + vars.set("value",value); + var _g = 0; + var _g1 = this.actions; + while(_g < _g1.length) { + var a = _g1[_g]; + ++_g; + if(a.id == id && a.conditionMet(vars)) { + return true; + } + } + return false; + } + ,getActionXml: function(id) { + var _g = 0; + var _g1 = this.actions; + while(_g < _g1.length) { + var a = _g1[_g]; + ++_g; + if(a.id == id) { + return a.xml; + } + } + return null; + } + ,getActionChoices: function(ids,funcs,p,value,name,window,item,incEquip,incStorehouse) { + if(incStorehouse == null) { + incStorehouse = false; + } + if(incEquip == null) { + incEquip = true; + } + var vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(p); + vars.set("name",name); + vars.set("value",value); + vars.set("itemValue",item); + var _g = 0; + var _g1 = this.actions; + while(_g < _g1.length) { + var a = _g1[_g]; + ++_g; + if((incEquip || a.id != "equip") && a.conditionMet(vars)) { + var $use = new com_davidmaletz_mining_item_Use(a,p,this,value,name,window,item,incStorehouse); + ids.push($use.getName()); + funcs.push($bind($use,$use["use"])); + } + } + } + ,getAction: function() { + if(this.actions.length == 0) { + return null; + } else { + return this.actions[0]; + } + } + ,getActionIndex: function(id) { + var len = this.actions.length; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + if(this.actions[i].id == id) { + return i; + } + } + return -1; + } + ,getFirstAction: function(p,value,name,window,item,incEquip) { + if(incEquip == null) { + incEquip = true; + } + var vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(p); + vars.set("name",name); + vars.set("value",value); + var _g = 0; + var _g1 = this.actions; + while(_g < _g1.length) { + var a = _g1[_g]; + ++_g; + if((incEquip || a.id != "equip") && (a.xml == null || a.xml.get("autoSelect") != "false") && a.conditionMet(vars)) { + return new com_davidmaletz_mining_item_Use(a,p,this,value,name,window,item); + } + } + return null; + } + ,runEvent: function(event,p,o,onComplete,vars) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = p == com_davidmaletz_mining_Main.getLocalPlayer(); + com_davidmaletz_mining_Main.runEvent(event,p,this.xml,o == null ? this : o,onComplete,vars); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + ,getElement: function() { + var e = com_davidmaletz_mining_world_Element.get(this.xml.get("element")); + if(e != null) { + return e; + } + var i = this.xml.elementsNamed("familiar"); + if(i.hasNext()) { + var xml = i.next(); + var e1 = com_davidmaletz_mining_world_Element.get(xml.get("element")); + if(e1 != null) { + return e1; + } + var type = com_davidmaletz_mining_familiar_FamiliarType.get(xml.get("id")); + if(type == null) { + return null; + } else { + return com_davidmaletz_mining_world_Element.get(type.get("element")); + } + } else { + return null; + } + } + ,_getElement: function(name) { + var m = com_davidmaletz_mining_item_ItemInfo.getMod(name); + if(m != null) { + var e = com_davidmaletz_mining_world_Element.get(m.get("element")); + if(e != null) { + return e; + } + } + return this.getElement(); + } + ,hasAction: function(p,value) { + return this.getFirstAction(p,value,null) != null; + } + ,getDisplay: function(name,darkBG,defaultName) { + if(darkBG == null) { + darkBG = true; + } + return "[color=" + (darkBG ? "ff2222" : "770000") + "]" + com_davidmaletz_mining_item_Item.getIconDisplay(this,name) + " " + com_davidmaletz_mining_item_Item._getName(this.getName(),name,defaultName).get() + "[/color]"; + } + ,getNotification: function(msg,name,darkBG) { + if(darkBG == null) { + darkBG = true; + } + var msg1 = msg.get(); + msg1 = StringTools.replace(msg1,"{item}",this.getDisplay(name,darkBG)); + return msg1; + } + ,showNotification: function(msg,name) { + com_davidmaletz_mining_ui_NotificationQueue.showNotification(new com_davidmaletz_faengfl_ui_FormattedTooltip(0,0,this.getNotification(msg,name),false,16777215,-1442840576)); + } + ,getBroken: function(name) { + this.showNotification(com_fancyfish_faeng_common_Lang.getText("common","broken"),name); + var i = com_davidmaletz_mining_item_ItemInfo.get(this.xml.get("broken")); + if(i == null) { + return null; + } else { + return new com_davidmaletz_mining_item_Item(i,this.xml.exists("brokenValue") ? com_davidmaletz_mining_Main.parseInt(this.xml.get("brokenValue")) : i.getDurability(),name); + } + } + ,addTitleInfo: function(s,w,x,y) { + com_davidmaletz_mining_ui_ItemRenderer.addItemCentered(s,this,x + (w >> 1),y); + return this.addInfo(s,w,x,y + 12); + } + ,getInfo: function() { + return this; + } + ,addCost: function(s,w,x,y) { + if(this.cost > 0) { + var sp = 1; + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p != null) { + sp = p.getSalePercent(); + } + return com_davidmaletz_mining_item_ItemInfo.addCoins(com_fancyfish_faeng_common_Lang.getText("common","sell"),Math.round(this.cost * sp),s,w,x,y); + } else { + return y; + } + } + ,cachedLights: null + ,getLight: function(name) { + var m = com_davidmaletz_mining_item_ItemInfo.getMod(name); + if(m == null) { + return this.light; + } + if(this.cachedLights == null) { + this.cachedLights = new haxe_ds_StringMap(); + } + if(this.cachedLights.exists(name)) { + return this.cachedLights.get(name); + } + var l = this.light; + var i = m.elementsNamed("light"); + if(i.hasNext()) { + l = new com_davidmaletz_mining_world_LightInfo(i.next()); + } + this.cachedLights.set(name,l); + return l; + } + ,addInfo: function(s,w,x,y) { + return this._addInfo(s,w,x,y,0,null); + } + ,_addInfo: function(s,w,x,y,value,name,compact) { + if(compact == null) { + compact = false; + } + var inner = new openfl_display_Sprite(); + inner.set_x(x); + inner.set_y(y); + inner.set_scaleX(inner.set_scaleY(0.5)); + s.addChild(inner); + return y + (this.innerAddInfo(inner,w * 2,0,0,value,name,compact) >> 1); + } + ,hasDecay: function() { + var hpSteal = this.xml.get("hpSteal"); + var i = this.xml.elementPathsNamed("projectile"); + if(i.hasNext()) { + hpSteal = i.next().get("hpSteal"); + } + if(hpSteal != null) { + return com_davidmaletz_mining_Main.parseFloat(hpSteal) < 0; + } else { + return false; + } + } + ,addHitEffects: function(s,w,x,y) { + var hitFx = com_davidmaletz_mining_world_ObjectInfo.getHitEffectI(null,null,this.xml); + var hpSteal = this.xml.get("hpSteal"); + var kb = this.xml.get("knockback"); + var i = this.xml.elementPathsNamed("projectile"); + if(i.hasNext()) { + var e = i.next(); + hitFx = com_davidmaletz_mining_world_ObjectInfo.getHitEffectI(null,null,e); + hpSteal = e.get("hpSteal"); + kb = e.get("knockback"); + if(e.get("passTile") == "true") { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions","passTile").get()); + } + if(e.get("leftRight") == "true") { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions","leftRight").get()); + } + if(e.get("pierce") == "true") { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions","pierce").get()); + } + if(e.get("critical") == "true") { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions","critical").get()); + } + } + if(hpSteal != null) { + var p = Math.round(com_davidmaletz_mining_Main.parseFloat(hpSteal) * 100); + y = com_davidmaletz_mining_item_ItemInfo._addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions",p < 0 ? "undrain" : "drain"),com_fancyfish_faeng_common_Utils.abs(p) + "%"); + } + if(kb != null) { + y = com_davidmaletz_mining_item_ItemInfo.addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("common","knockback"),com_davidmaletz_mining_Main.parseInt(kb),false,false); + } + if(hitFx != null) { + if(hitFx.isFreeze()) { + y = com_davidmaletz_mining_item_ItemInfo._addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions","freeze"),null); + } + var d = hitFx.getDamageRange(); + if(d != null) { + var m = com_fancyfish_faeng_common_Lang.getTextFromTitle(hitFx.xml.get("damageName")); + y = com_davidmaletz_mining_item_ItemInfo._addLine(s,w,x,y,m == null ? com_fancyfish_faeng_common_Lang.getText("item.descriptions","burn") : m,d); + } + } + return y; + } + ,getValue: function(name,attr) { + return this._getValue(com_davidmaletz_mining_item_ItemInfo.getMod(name),attr); + } + ,_getValue: function(m,attr) { + if(m != null && m.exists(attr)) { + return m.get(attr); + } else { + return this.xml.get(attr); + } + } + ,innerAddInfo: function(s,w,x,y,value,name,compact,trueItem) { + if(compact == null) { + compact = false; + } + if(this.hasActionId("eat") || this.hasActionId("applyMod")) { + if(this.health != 0) { + var t = com_davidmaletz_mining_item_ItemInfo._createIcon(com_davidmaletz_tiles_Tile.get("health")); + t.set_x(x); + t.set_y(y); + s.addChild(t); + var sym = this.health > 0 ? "+" : ""; + var m = new com_fancyfish_faeng_common_mutable_Concat(com_fancyfish_faeng_common_Lang.getText("common","health")," " + sym + Std.string(this.health) + (this.health_p ? "%" : "")); + var t1 = new com_davidmaletz_faengfl_TextSprite(m,new com_fancyfish_faeng_text_CharacterPlacer(0),7798784,1); + t1.set_x(x + 10); + t1.set_y(y); + s.addChild(t1); + y += t1.lineHeight(); + } + if(this.stamina != 0) { + var t2 = com_davidmaletz_mining_item_ItemInfo._createIcon(com_davidmaletz_tiles_Tile.get("stamina")); + t2.set_x(x); + t2.set_y(y); + s.addChild(t2); + var sym1 = this.stamina > 0 ? "+" : ""; + var m1 = new com_fancyfish_faeng_common_mutable_Concat(com_fancyfish_faeng_common_Lang.getText("common","stamina")," " + sym1 + Std.string(this.stamina) + (this.stamina_p ? "%" : "")); + var t3 = new com_davidmaletz_faengfl_TextSprite(m1,new com_fancyfish_faeng_text_CharacterPlacer(0),26112,1); + t3.set_x(x + 10); + t3.set_y(y); + s.addChild(t3); + y += t3.lineHeight(); + } + if(this.oxygen != 0) { + var t4 = com_davidmaletz_mining_item_ItemInfo._createIcon(com_davidmaletz_tiles_Tile.get("oxygen")); + t4.set_x(x); + t4.set_y(y); + s.addChild(t4); + var sym2 = this.oxygen > 0 ? "+" : ""; + var m2 = new com_fancyfish_faeng_common_mutable_Concat(com_fancyfish_faeng_common_Lang.getText("common","oxygen")," " + sym2 + Std.string(this.oxygen) + (this.oxygen_p ? "%" : "")); + var t5 = new com_davidmaletz_faengfl_TextSprite(m2,new com_fancyfish_faeng_text_CharacterPlacer(0),4473924,1); + t5.set_x(x + 10); + t5.set_y(y); + s.addChild(t5); + y += t5.lineHeight(); + } + if(this.storage != 0) { + var storageType = this.xml.get("eatStorage"); + var t6 = com_davidmaletz_mining_ui_Coins.makeIcon(com_davidmaletz_mining_ui_StatusBars.getTile(storageType)); + t6.set_x(x); + t6.set_y(y); + s.addChild(t6); + var sym3 = this.storage > 0 ? "+" : ""; + var m3 = new com_fancyfish_faeng_common_mutable_Concat(com_fancyfish_faeng_common_Lang.getText("common",storageType)," " + sym3 + Std.string(this.storage) + (this.storage_p ? "%" : "")); + var t7 = new com_davidmaletz_faengfl_TextSprite(m3,new com_fancyfish_faeng_text_CharacterPlacer(0),4473924,1); + t7.set_x(x + 10); + t7.set_y(y); + s.addChild(t7); + y += t7.lineHeight(); + } + } else if(this.stamina > 0 && this.xml.get("use_stamina") == "true") { + var t8 = com_davidmaletz_mining_item_ItemInfo._createIcon(com_davidmaletz_tiles_Tile.get("stamina")); + t8.set_x(x); + t8.set_y(y); + s.addChild(t8); + var t9 = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Concat(com_fancyfish_faeng_common_Lang.getText("common","stamina_per_use")," " + Std.string(this.getStamina(com_davidmaletz_mining_Main.getLocalPlayer()))),new com_fancyfish_faeng_text_CharacterPlacer(0),0,1); + t9.set_x(x + 10); + t9.set_y(y); + s.addChild(t9); + y += t9.lineHeight(); + } + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + var e = this.xml.elementsNamed("stat"); + while(e.hasNext()) { + var e1 = e.next(); + var id = e1.get("id"); + var mod = null; + var cur = 0; + if(e1.exists("time")) { + mod = "time"; + } else if(e1.exists("max")) { + mod = "max"; + if(p != null) { + cur = p.stats.getPermaInt(e1.get("id")); + } + } + var t10 = com_davidmaletz_mining_item_ItemInfo._createIcon(com_davidmaletz_tiles_Tile.get("stat." + id)); + com_davidmaletz_mining_Stat.tint(t10,1); + t10.set_x(x); + t10.set_y(y); + s.addChild(t10); + if(mod == null) { + y = com_davidmaletz_mining_item_ItemInfo.addLine(s,w - com_davidmaletz_tiles_Tile.SIZE,x + com_davidmaletz_tiles_Tile.SIZE,y,com_fancyfish_faeng_common_Lang.getText("stats",id),com_davidmaletz_mining_Main.parseInt(e1.get("value")),true,true); + } else { + y = com_davidmaletz_mining_item_ItemInfo.addMod(s,w - com_davidmaletz_tiles_Tile.SIZE,x + com_davidmaletz_tiles_Tile.SIZE,y,com_fancyfish_faeng_common_Lang.getText("stats",id),com_fancyfish_faeng_common_Lang.getText("stats",mod),com_davidmaletz_mining_Main.parseInt(e1.get("value")),com_davidmaletz_mining_Main.parseInt(e1.get("time")),com_davidmaletz_mining_Main.parseInt(e1.get("max")),cur); + } + } + var desc = null; + if(this.hasDescription()) { + desc = this.getDescription(); + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,desc.get()); + } + var vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(p); + vars.set("this",this); + vars.set("name",name); + vars.set("value",value); + var e2 = this.xml.elementsNamed("description"); + while(e2.hasNext()) { + var e3 = e2.next(); + var m4 = com_fancyfish_faeng_common_Lang.getTextFromTitle(e3.exists("eval") ? com_davidmaletz_mining_npc_NPCEventHandler.evalString(e3.get("eval"),vars) : e3.get("text")); + if(m4 != null) { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,m4.get()); + } + } + var _g = 0; + var _g1 = this.actions; + while(_g < _g1.length) { + var a = _g1[_g]; + ++_g; + if(a.conditionMet(vars)) { + if(a.id == "build" || a.id == "upgrade") { + var e4 = a.xml == null ? this.xml : a.xml; + var si = com_davidmaletz_mining_structure_StructureInfo.get(e4.get(a.id == "build" ? "structure" : "upgrade")); + if(si != null && Std["is"](si,com_davidmaletz_mining_structure_StructureInfo)) { + var info = js_Boot.__cast(si , com_davidmaletz_mining_structure_StructureInfo); + y = com_davidmaletz_mining_item_ItemInfo._addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions",a.id + "s"),info.getName().get()); + var reqs = []; + var i = e4.elements(); + while(i.hasNext()) { + var i1 = i.next(); + var r = com_davidmaletz_mining_npc_Requirement.fromXML(i1.xml); + if(r != null) { + reqs.push(r); + } + } + y = com_davidmaletz_mining_ui_QuestInfo.addRequirements(s,null,null,HxOverrides.iter(reqs),x + 16,y,w - 16); + } + } else if(a.id == "plant") { + var m5 = a.name == null || a.name == "plant" ? com_fancyfish_faeng_common_Lang.getText("item.descriptions","plants") : a.getName(); + var e5 = a.xml == null ? this.xml : a.xml; + if(e5.exists("structure")) { + var si1 = com_davidmaletz_mining_structure_StructureInfo.get(e5.get("structure")); + if(si1 != null && Std["is"](si1,com_davidmaletz_mining_structure_StructureInfo)) { + y = com_davidmaletz_mining_item_ItemInfo._addLine(s,w,x,y,m5,(js_Boot.__cast(si1 , com_davidmaletz_mining_structure_StructureInfo)).getName().get()); + } + } else if(e5.exists("object")) { + var info1 = com_davidmaletz_mining_world_ObjectInfo._get(e5.get("object")); + if(info1 != null && info1.getDisplayId() != null) { + y = com_davidmaletz_mining_item_ItemInfo._addLine(s,w,x,y,m5,info1.getDisplayName(null).get()); + } + } else if(e5.exists("crop")) { + var info2 = com_davidmaletz_mining_item_CropInfo.get(e5.get("crop")); + if(info2 != null) { + y = com_davidmaletz_mining_item_ItemInfo._addLine(s,w,x,y,m5,info2.getName().get()); + } + } + var cost = com_davidmaletz_mining_item_Action.getPlantCost(e5); + if(cost != null) { + var _g2 = 0; + while(_g2 < cost.length) { + var r1 = cost[_g2]; + ++_g2; + var i2 = r1.getItem(); + var ct = r1.count; + if(i2 != null && ct > 0) { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions","plant_cost").get() + ": " + i2.getDisplay(null,false) + (ct == 1 ? "" : " x" + ct)); + } + } + } + } else if(a.id == "place") { + var cost1 = com_davidmaletz_mining_item_Action.getPlantCost(a.xml == null ? this.xml : a.xml,"placeCost"); + if(cost1 != null) { + var _g21 = 0; + while(_g21 < cost1.length) { + var r2 = cost1[_g21]; + ++_g21; + var i3 = r2.getItem(); + var ct1 = r2.count; + if(i3 != null && ct1 > 0) { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions","place_cost").get() + ": " + i3.getDisplay(null,false) + (ct1 == 1 ? "" : " x" + ct1)); + } + } + } + } else { + var m6 = a.getDescription(); + if(m6 != null && m6 != desc) { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,m6.get()); + } + } + } + } + var o = this.xml.get("object"); + if(o != null && com_fancyfish_faeng_common_Lang.hasText("item.descriptions",o)) { + var m7 = com_fancyfish_faeng_common_Lang.getText("item.descriptions",o); + if(m7 != desc) { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,m7.get()); + } + } + var type = com_davidmaletz_mining_familiar_FamiliarType.getFromItem(this,name); + if(type != null) { + y = type.addInfo(s,w,x,y,value,name); + } + if(this.getValue(name,"viewHidden") == "true") { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions","view_hidden").get()); + } + if(this.xml.exists("flight_height")) { + y = com_davidmaletz_mining_item_ItemInfo.addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("common","flight"),com_davidmaletz_mining_Main.parseInt(this.xml.get("flight_height")),false,false); + } + if(this.xml.get("hide") == "true") { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions","hide").get()); + } + if(this.xml.get("critical") == "true") { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions","critical").get()); + } + if(this.xml.exists("damage")) { + y = com_davidmaletz_mining_item_ItemInfo.addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("common","damage"),com_davidmaletz_mining_Main.parseInt(this.xml.get("damage"))); + } + if(this.xml.get("noKill") == "true") { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions","no_kill").get()); + } + if(com_davidmaletz_mining_item_ItemInfo.exists(this.xml.get("projectile"))) { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,StringTools.replace(com_fancyfish_faeng_common_Lang.getText("item.descriptions","fires").get(),"{projectile}",com_davidmaletz_mining_item_ItemInfo.get(this.xml.get("projectile")).getDisplay(null,false))); + } + if(this.xml.exists("reflect")) { + y = com_davidmaletz_mining_item_ItemInfo.addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions","reflect"),com_davidmaletz_mining_Main.parseInt(this.xml.get("reflect"))); + } + if(this.xml.exists("capture")) { + if(this.xml.get("captureType") == "spirit") { + y = com_davidmaletz_mining_item_ItemInfo._addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("common","capture_type"),com_fancyfish_faeng_common_Lang.getText("common","spirits").get()); + } + y = com_davidmaletz_mining_item_ItemInfo.addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("common","capture"),com_davidmaletz_mining_Main.parseFloat(this.xml.get("capture"))); + var e6 = this._getElement(name); + if(e6 != null) { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,StringTools.replace(com_fancyfish_faeng_common_Lang.getText("item.descriptions","element_trap").get(),"{element}","[tile=" + e6.icon + "]")); + } + } + if(!Std["is"](this,com_davidmaletz_mining_item_Equipment)) { + y = this.addHitEffects(s,w,x,y); + } + var e7 = this._getElement(name); + if(e7 != null && com_fancyfish_faeng_common_Lang.hasText("item.descriptions","element." + e7.id)) { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions","element." + e7.id).get()); + } + if(this.getLight(name) != null) { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions","light").get()); + } + if(this.xml.get("canJump") == "true") { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions","jump").get()); + } + if(this.equipCost != null) { + y = this.equipCost.addInfo(s,w,x,y); + } + if(this.xml.get("underwater") == "true" && com_davidmaletz_mining_item_ItemInfo.get(com_davidmaletz_mining_item_ItemInfo.getParameter(name,"u")) == null) { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions","underwater").get()); + } + if(this.xml.exists("coins")) { + y = com_davidmaletz_mining_item_ItemInfo.addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("common","coins"),com_davidmaletz_mining_Main.parseInt(this.xml.get("coins"))); + } + if(this.xml.exists("fertilizer")) { + y = com_davidmaletz_mining_item_ItemInfo.addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("structure","fertilizer"),com_davidmaletz_mining_Main.parseInt(this.xml.get("fertilizer")) / 100); + } + var m8 = this.getDurabilityName(); + var d = this.getDurability(); + if(m8 != null && d > 0) { + var t11 = new com_davidmaletz_faengfl_TextSprite(StringTools.endsWith(m8.get(),":") ? m8 : new com_fancyfish_faeng_common_mutable_Concat(m8,":"),new com_fancyfish_faeng_text_CharacterPlacer(0),0,1); + t11.set_x(x); + t11.set_y(y); + s.addChild(t11); + var icon = com_davidmaletz_tiles_Tile.get(this.xml.get("durabilityIcon")); + if(icon == null && m8 == com_fancyfish_faeng_common_Lang.getText("common","power")) { + icon = com_davidmaletz_tiles_Tile.get("power"); + } + if(icon != null) { + var _g3 = t11; + _g3.set_x(_g3.get_x() + 10); + var i4 = com_davidmaletz_mining_item_ItemInfo._createIcon(icon); + i4.set_x(x); + i4.set_y(y); + s.addChild(i4); + } + var t12 = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Static(com_fancyfish_faeng_common_Utils.largeNumberFormat(d - value) + "/" + com_fancyfish_faeng_common_Utils.largeNumberFormat(d)),new com_fancyfish_faeng_text_CharacterPlacer(w,2),0,1); + t12.set_x(x); + t12.set_y(y); + s.addChild(t12); + y += t12.lineHeight(); + } + var i5 = com_davidmaletz_mining_item_ItemInfo.get(this.xml.get("addInfo")); + if(i5 != null) { + y = i5.innerAddInfo(s,w,x,y,value,name,compact); + } + if(this.weight > 0) { + var t13 = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Concat(com_fancyfish_faeng_common_Lang.getText("stats","weight"),": " + Std.string(Math.round(this.weight * 100) / 100)),new com_fancyfish_faeng_text_CharacterPlacer(0),0,1); + t13.set_x(x); + t13.set_y(y); + s.addChild(t13); + y += t13.lineHeight(); + } + return y; + } + ,getDurabilityName: function() { + var d = this.xml.get("durabilityName"); + if(d == "none") { + return null; + } + var m = com_fancyfish_faeng_common_Lang.getTextFromTitle(d); + if(m != null) { + return m; + } else if(this.xml.exists("storage")) { + return com_fancyfish_faeng_common_Lang.getText("common",this.xml.get("storage")); + } else if(this.type.id == "animal") { + return com_fancyfish_faeng_common_Lang.getText("common","feed"); + } else { + return com_fancyfish_faeng_common_Lang.getText("common","durability"); + } + } + ,getDurability: function() { + if(this.xml.exists("durability")) { + return com_davidmaletz_mining_Main.parseInt(this.xml.get("durability")); + } else { + return 0; + } + } + ,repair: function(name,value,inventory) { + if(inventory == null) { + var slot = this.xml.get("slot"); + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + p.equipment.increaseValue(p,slot,-value); + } else { + new com_davidmaletz_mining_item_Item(this,value,name).increaseValue(inventory,-value); + } + } + ,__class__: com_davidmaletz_mining_item_ItemInfo +}; +var com_davidmaletz_mining_item_Equipment = function(e) { + com_davidmaletz_mining_item_ItemInfo.call(this,e); + this.attack = this.xml.exists("attack") ? com_davidmaletz_mining_Main.parseInt(this.xml.get("attack")) : 0; + this.cut = this.xml.exists("cut") ? com_davidmaletz_mining_Main.parseInt(this.xml.get("cut")) : 0; + this.spirit = this.xml.exists("spirit") ? com_davidmaletz_mining_Main.parseInt(this.xml.get("spirit")) : 0; + this.defense = this.xml.exists("defense") ? com_davidmaletz_mining_Main.parseInt(this.xml.get("defense")) : 0; + this.elementDefense = this.xml.exists("elementDefense") ? com_davidmaletz_mining_Main.parseInt(this.xml.get("elementDefense")) : 0; + this.range = this.xml.exists("range") ? com_davidmaletz_mining_Main.parseInt(this.xml.get("range")) : 0; + this.mine = this.xml.exists("mine") ? com_davidmaletz_mining_Main.parseInt(this.xml.get("mine")) : 0; + this.capacity = this.xml.exists("capacity") ? com_davidmaletz_mining_Main.parseInt(this.xml.get("capacity")) : 0; + this.fishing = this.xml.exists("fishing") ? com_davidmaletz_mining_Main.parseInt(this.xml.get("fishing")) : 0; + if(this.xml.exists("storageType")) { + this.storageType = this.xml.get("storageType"); + this.storageCost = this.xml.exists("storageCost") ? com_davidmaletz_mining_Main.parseInt(this.xml.get("storageCost")) : 0; + } else { + this.storageType = "power"; + this.storageCost = this.xml.exists("power") ? com_davidmaletz_mining_Main.parseInt(this.xml.get("power")) : 0; + } + this.breakPower = this.xml.exists("breakPower") ? com_davidmaletz_mining_Main.parseFloat(this.xml.get("breakPower")) : 1; + var i = this.xml.elementsNamed("flight"); + if(i.hasNext()) { + this.flight = new com_davidmaletz_mining_item_Flight(i.next()); + } + var i1 = this.xml.elementsNamed("pump"); + if(i1.hasNext()) { + this.pump = new com_davidmaletz_mining_item_EquipCost(i1.next()); + } + this.equipOn = new haxe_ds_StringMap(); + if(this.xml.exists("equipOn")) { + this.equipOn.set(this.xml.get("equipOn"),new com_davidmaletz_mining_item_EquipOn(0,0,null,0,0,-1)); + } + var e1 = this.xml.elementsNamed("equipOn"); + while(e1.hasNext()) { + var e2 = e1.next(); + this.equipOn.set(e2.get("id"),new com_davidmaletz_mining_item_EquipOn(e2.exists("x") ? com_davidmaletz_mining_Main.parseFloat(e2.get("x")) : 0,e2.exists("y") ? com_davidmaletz_mining_Main.parseFloat(e2.get("y")) : 0,e2.get("append"),e2.exists("projX") ? com_davidmaletz_mining_Main.parseFloat(e2.get("projX")) : 0,e2.exists("projY") ? com_davidmaletz_mining_Main.parseFloat(e2.get("projY")) : 0,e2.exists("delay") ? com_davidmaletz_mining_Main.parseFloat(e2.get("delay")) : -1)); + } + var e3 = this.xml.elementPathsNamed("ability"); + while(e3.hasNext()) { + var e4 = e3.next(); + var a = new com_davidmaletz_mining_world_vehicle_Ability(e4,this); + if(a.hotkey >= 0) { + if(this.abilities == null) { + this.abilities = [a]; + } else { + this.abilities.push(a); + } + } + } + if(this.abilities != null) { + this.abilities.reverse(); + } +}; +$hxClasses["com.davidmaletz.mining.item.Equipment"] = com_davidmaletz_mining_item_Equipment; +com_davidmaletz_mining_item_Equipment.__name__ = ["com","davidmaletz","mining","item","Equipment"]; +com_davidmaletz_mining_item_Equipment.isEquipment = function(xml) { + if(!(xml.exists("slot") || xml.exists("attack") || xml.exists("cut") || xml.exists("spirit") || xml.exists("defense") || xml.exists("range") || xml.exists("mine") || xml.exists("capacity"))) { + return xml.exists("fishing"); + } else { + return true; + } +}; +com_davidmaletz_mining_item_Equipment.getAttr = function(mod,attr) { + if(mod == null || !mod.exists(attr)) { + return 0; + } else { + return com_davidmaletz_mining_Main.parseInt(mod.get(attr)); + } +}; +com_davidmaletz_mining_item_Equipment.toStr = function(val,a,plus) { + if(plus == null) { + plus = false; + } + return (val != 0 ? com_davidmaletz_mining_item_ItemInfo.twoDigits(val,plus) : "") + (a != 0 ? com_davidmaletz_mining_item_ItemInfo.twoDigits(a,true) : ""); +}; +com_davidmaletz_mining_item_Equipment.addLine = function(s,w,x,y,m,val,a,colon,plus) { + if(plus == null) { + plus = false; + } + if(colon == null) { + colon = true; + } + if(a == null) { + a = 0; + } + if(val + a != 0) { + return com_davidmaletz_mining_item_ItemInfo._addLine(s,w,x,y,m,com_davidmaletz_mining_item_Equipment.toStr(val,a,plus),colon,a == 0 ? 0 : a > 0 ? 19456 : 4980736); + } + return y; +}; +com_davidmaletz_mining_item_Equipment.get = function(base,name,attr) { + return base + (name == null ? 0 : com_davidmaletz_mining_item_Equipment.getAttr(com_davidmaletz_mining_item_ItemInfo.getMod(name),attr)); +}; +com_davidmaletz_mining_item_Equipment.hasProjectile = function(id) { + var i = com_davidmaletz_mining_item_ItemInfo.get(id); + if(i != null) { + return i.xml.elementsNamed("projectile").hasNext(); + } else { + return false; + } +}; +com_davidmaletz_mining_item_Equipment.modifyEfficiency = function(val,name) { + var mod = com_davidmaletz_mining_item_ItemInfo.getMod(name); + if(mod == null || !mod.exists("efficiency")) { + return val; + } else { + return Math.ceil(val / com_davidmaletz_mining_Main.parseFloat(mod.get("efficiency"))); + } +}; +com_davidmaletz_mining_item_Equipment.__super__ = com_davidmaletz_mining_item_ItemInfo; +com_davidmaletz_mining_item_Equipment.prototype = $extend(com_davidmaletz_mining_item_ItemInfo.prototype,{ + attack: null + ,cut: null + ,defense: null + ,range: null + ,mine: null + ,capacity: null + ,flight: null + ,fishing: null + ,breakPower: null + ,elementDefense: null + ,storageCost: null + ,storageType: null + ,pump: null + ,spirit: null + ,equipOn: null + ,abilities: null + ,canEquip: function() { + return this.hasActionId("equip"); + } + ,getAttack: function(name) { + return com_davidmaletz_mining_item_Equipment.get(this.attack,name,"attack"); + } + ,getRange: function(name) { + return com_davidmaletz_mining_item_Equipment.get(this.range,name,"range"); + } + ,getDefense: function(element,name) { + return com_davidmaletz_mining_item_Equipment.get(this.defense,name,"defense") + (element == null ? 0 : com_davidmaletz_mining_item_Equipment.get(this.elementDefense,name,"elementDefense")); + } + ,getCut: function(name) { + return com_davidmaletz_mining_item_Equipment.get(this.cut,name,"cut"); + } + ,getSpirit: function(name) { + return com_davidmaletz_mining_item_Equipment.get(this.spirit,name,"spirit"); + } + ,getMine: function(name) { + return com_davidmaletz_mining_item_Equipment.get(this.mine,name,"mine"); + } + ,getCapacity: function(name) { + return com_davidmaletz_mining_item_Equipment.get(com_davidmaletz_mining_DifficultyMode.getCurrent().modifyCapacity(this.capacity),name,"capacity"); + } + ,getFishing: function(name) { + return com_davidmaletz_mining_item_Equipment.get(this.fishing,name,"fishing"); + } + ,_getOxygen: function(name) { + return com_davidmaletz_mining_item_Equipment.get(this.oxygen,name,"oxygen"); + } + ,addStorage: function(s,w,x,y,storageType,cost) { + var t = com_davidmaletz_mining_item_ItemInfo._createIcon(com_davidmaletz_tiles_Tile.get(storageType)); + t.set_x(x); + t.set_y(y); + s.addChild(t); + var sn = storageType; + var o = com_davidmaletz_mining_world_ObjectInfo._get(this.xml.get("equipOn")); + if(o != null) { + var f = o.xml.get("fuelName"); + if(com_fancyfish_faeng_common_Lang.hasText("common",f + "_per_hit")) { + sn = f; + } + } + var t1 = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Concat(com_fancyfish_faeng_common_Lang.getText("common",sn + "_per_hit")," " + (cost == null ? "null" : "" + cost)),new com_fancyfish_faeng_text_CharacterPlacer(0),0,1); + t1.set_x(x + 10); + t1.set_y(y); + s.addChild(t1); + y += t1.lineHeight(); + return y; + } + ,innerAddInfo: function(s,w,x,y,value,name,compact,trueItem) { + if(compact == null) { + compact = false; + } + var $use = com_davidmaletz_mining_item_ItemInfo.get(com_davidmaletz_mining_item_ItemInfo.getParameter(name,"u")); + if($use != null) { + y = com_davidmaletz_mining_item_ItemInfo.prototype.innerAddInfo.call(this,s,w,x,y,value,name,compact,trueItem); + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,StringTools.replace(com_fancyfish_faeng_common_Lang.getText("item.descriptions","use_item").get(),"{item}",$use.getDisplay(null,false))); + return $use.innerAddInfo(s,w,x,y,value,null,compact,this); + } + var mod = com_davidmaletz_mining_item_ItemInfo.getMod(name); + var st_y = y; + if(this.xml.get("slot") != "familiar") { + y = com_davidmaletz_mining_item_Equipment.addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("stats","attack"),this.attack,com_davidmaletz_mining_item_Equipment.getAttr(mod,"attack"),true,this.range != 0 && com_davidmaletz_mining_item_Equipment.hasProjectile(this.xml.get("projectile"))); + if(this.range != 0) { + y = com_davidmaletz_mining_item_Equipment.addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("stats","range"),this.range,com_davidmaletz_mining_item_Equipment.getAttr(mod,"range")); + } + y = com_davidmaletz_mining_item_Equipment.addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("stats","cut"),this.cut,com_davidmaletz_mining_item_Equipment.getAttr(mod,"cut")); + y = com_davidmaletz_mining_item_Equipment.addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("stats","spirit"),this.spirit,com_davidmaletz_mining_item_Equipment.getAttr(mod,"spirit")); + } + y = com_davidmaletz_mining_item_Equipment.addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("stats","defense"),this.defense,com_davidmaletz_mining_item_Equipment.getAttr(mod,"defense")); + y = com_davidmaletz_mining_item_Equipment.addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("stats","elementDefense"),this.elementDefense,com_davidmaletz_mining_item_Equipment.getAttr(mod,"elementDefense")); + y = com_davidmaletz_mining_item_Equipment.addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("stats","mine"),this.mine,com_davidmaletz_mining_item_Equipment.getAttr(mod,"mine")); + y = com_davidmaletz_mining_item_Equipment.addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("common","capacity"),com_davidmaletz_mining_DifficultyMode.getCurrent().modifyCapacity(this.capacity),com_davidmaletz_mining_item_Equipment.getAttr(mod,"capacity"),false); + y = com_davidmaletz_mining_item_Equipment.addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("stats","fishing"),this.fishing,com_davidmaletz_mining_item_Equipment.getAttr(mod,"fishing")); + y = com_davidmaletz_mining_item_Equipment.addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("common","depth"),com_davidmaletz_mining_Main.parseInt(this.xml.get("max_depth")),com_davidmaletz_mining_item_Equipment.getAttr(mod,"max_depth"),false); + var o2 = com_davidmaletz_mining_item_Equipment.getAttr(mod,"oxygen"); + if(this.oxygen + o2 > 0) { + var t = com_davidmaletz_mining_item_ItemInfo._createIcon(com_davidmaletz_tiles_Tile.get("oxygen")); + t.set_x(x); + t.set_y(y); + s.addChild(t); + var t1 = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Concat(com_fancyfish_faeng_common_Lang.getText("common","oxygen"),": " + com_davidmaletz_mining_item_Equipment.toStr(this.oxygen,o2)),new com_fancyfish_faeng_text_CharacterPlacer(0),o2 == 0 ? 0 : o2 > 0 ? 19456 : 4980736,1); + t1.set_x(x + 10); + t1.set_y(y); + s.addChild(t1); + y += t1.lineHeight(); + } + var t2 = "block_" + this.xml.get("block"); + if(com_fancyfish_faeng_common_Lang.hasText("item.descriptions",t2)) { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions",t2).get()); + } + if(this.xml.get("omnidirectional") == "true" && com_fancyfish_faeng_common_Lang.hasText("item.descriptions","omnidirectional")) { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions","omnidirectional").get()); + } + if(this.xml.get("blockIgnoreArmor") == "true" && com_fancyfish_faeng_common_Lang.hasText("item.descriptions","blockIgnoreArmor")) { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions","blockIgnoreArmor").get()); + } + if(this.flight != null) { + y = com_davidmaletz_mining_item_ItemInfo.addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("common","flight"),this.flight.height,false,false); + if(!compact || y < st_y + 40) { + var _w = w - 16; + var _x = x + 16; + y = com_davidmaletz_mining_item_ItemInfo.addLine(s,_w,_x,y,com_fancyfish_faeng_common_Lang.getText("stats","speed"),this.flight.speed,false,true); + y = com_davidmaletz_mining_item_ItemInfo.addLine(s,_w,_x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions","max_weight"),this.flight.getMaxWeight(),false,true); + if(this.flight.equipCost != null) { + y = this.flight.equipCost.addInfo(s,_w,_x,y); + } + } + } + if(this.pump != null) { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions","pump").get()); + var _w1 = w - 16; + var _x1 = x + 16; + y = this.pump.addInfo(s,_w1,_x1,y,"cost_per_tile"); + } + y = this.addHitEffects(s,w,x,y); + if(this.storageCost > 0) { + y = this.addStorage(s,w,x,y,this.storageType,com_davidmaletz_mining_item_Equipment.modifyEfficiency(this.storageCost,name)); + } + if(this.stamina > 0 && !this.hasActionId("eat")) { + var stamina = com_davidmaletz_mining_item_Equipment.modifyEfficiency(this.getStamina(com_davidmaletz_mining_Main.getLocalPlayer()),name); + if(trueItem == null) { + trueItem = this; + } + if(trueItem.xml.exists("staminaToStorage")) { + y = this.addStorage(s,w,x,y,(js_Boot.__cast(trueItem , com_davidmaletz_mining_item_Equipment)).storageType,Math.round(stamina * com_davidmaletz_mining_Main.parseFloat(trueItem.xml.get("staminaToStorage")))); + } else { + var t3 = com_davidmaletz_mining_item_ItemInfo._createIcon(com_davidmaletz_tiles_Tile.get("stamina")); + t3.set_x(x); + t3.set_y(y); + s.addChild(t3); + var t4 = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Concat(com_fancyfish_faeng_common_Lang.getText("common","stamina_per_hit")," " + (stamina == null ? "null" : "" + stamina)),new com_fancyfish_faeng_text_CharacterPlacer(0),0,1); + t4.set_x(x + 10); + t4.set_y(y); + s.addChild(t4); + y += t4.lineHeight(); + } + } + var k = this.equipOn.keys(); + while(k.hasNext()) { + var k1 = k.next(); + var o = com_davidmaletz_mining_world_ObjectInfo._get(k1); + if(o != null) { + var vars = com_davidmaletz_faengfl_EventHandler.createVariables(); + vars.set("this",o); + var m = o.getTitle(vars); + if(m != null) { + y = com_davidmaletz_mining_item_ItemInfo._addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("item.descriptions","equipOn"),m.get()); + } + } + } + return com_davidmaletz_mining_item_ItemInfo.prototype.innerAddInfo.call(this,s,w,x,y,value,name,compact,trueItem); + } + ,canFly: function(p) { + var slot = this.xml.get("slot"); + if((p.equipment.getStateI(slot) & 2) != 0) { + return false; + } else if(this.flight != null) { + return this.flight.canFly(p,slot); + } else { + return false; + } + } + ,__class__: com_davidmaletz_mining_item_Equipment +}); +var com_davidmaletz_mining_item_EquipmentSlots = function(slot_ids,slot_xml) { + this.checkUnequip = true; + this.isInit = false; + this.fireEquipHandlers = true; + this.slot_ids = slot_ids; + this.slot_xml = slot_xml; + this.slot_map = new haxe_ds_StringMap(); + var i = 0; + var _g = 0; + while(_g < slot_ids.length) { + var s = slot_ids[_g]; + ++_g; + this.slot_map.set(s,i++); + } + this.slots = []; + this.used = []; + this.state = []; + var _g1 = 0; + while(_g1 < slot_ids.length) { + var s1 = slot_ids[_g1]; + ++_g1; + var m = new com_fancyfish_faeng_common_mutable_Mutable(); + m.set(null); + this.slots.push(m); + var m1 = new com_fancyfish_faeng_common_mutable_Mutable(); + m1.set(0); + this.state.push(m1); + var m2 = new com_fancyfish_faeng_common_mutable_Mutable(); + m2.set(null); + this.used.push(m2); + } +}; +$hxClasses["com.davidmaletz.mining.item.EquipmentSlots"] = com_davidmaletz_mining_item_EquipmentSlots; +com_davidmaletz_mining_item_EquipmentSlots.__name__ = ["com","davidmaletz","mining","item","EquipmentSlots"]; +com_davidmaletz_mining_item_EquipmentSlots.isBreakable = function(i,s) { + var b = i.info.xml.get("breakable"); + if(b != "false") { + if(s == "familiar") { + return b == "true"; + } else { + return true; + } + } else { + return false; + } +}; +com_davidmaletz_mining_item_EquipmentSlots.sortFirst = function(a,b) { + return a.first > b.first; +}; +com_davidmaletz_mining_item_EquipmentSlots.fromXML = function(xml,vslots) { + var map = new haxe_ds_IntMap(); + var heap = new com_fancyfish_faeng_common_Heap(com_davidmaletz_mining_item_EquipmentSlots.sortFirst); + var slot_xml = new haxe_ds_StringMap(); + var e = xml.elementPathsNamed("slot"); + while(e.hasNext()) { + var e1 = e.next(); + var id = e1.get("id"); + if(!slot_xml.exists(id)) { + var i = com_davidmaletz_mining_Main.parseInt(e1.get("priority")); + var ar = map.get(i); + if(ar == null) { + ar = []; + map.set(i,ar); + heap.insert(new com_fancyfish_faeng_common_Pair(i,ar)); + } + ar.push(id); + slot_xml.set(id,e1); + if(vslots != null && e1.get("vanity") == "true") { + vslots.push(id); + } + } + } + var slots = []; + while(!heap.isEmpty()) { + var ar1 = heap.remove().second; + var len = ar1.length; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i1 = _g1++; + slots.push(ar1[i1]); + } + } + return new com_davidmaletz_mining_item_EquipmentSlots(slots,slot_xml); +}; +com_davidmaletz_mining_item_EquipmentSlots.prototype = { + slot_ids: null + ,slot_map: null + ,slots: null + ,used: null + ,state: null + ,slot_xml: null + ,fireEquipHandlers: null + ,getSlotXml: function(slot) { + if(this.slot_xml == null) { + return null; + } else { + return this.slot_xml.get(slot); + } + } + ,getSlotFlag: function(slot) { + var e = this.getSlotXml(slot); + if(e == null) { + return null; + } else { + return e.get("flag"); + } + } + ,isInit: null + ,init: function(p) { + if(this.isInit) { + return; + } + this.isInit = true; + var ct = 0; + var _g = 0; + var _g1 = this.slots; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + var i = s.get(); + if(i != null) { + this.runEquip(i,p,this.slot_ids[ct]); + } + ++ct; + } + } + ,destroy: function(p,updateUsed) { + if(updateUsed == null) { + updateUsed = true; + } + if(!this.isInit) { + return; + } + this.isInit = false; + var ct = 0; + var _g = 0; + var _g1 = this.slots; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + var i = s.get(); + if(i != null) { + this.runUnequip(i,p,this.slot_ids[ct],updateUsed); + } + ++ct; + } + } + ,addEventListener: function(onChange) { + var i = 0; + var _g = 0; + var _g1 = this.slot_ids; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + this.slots[i++].addEventListener("updated",(function(a1,f) { + return function(a2) { + f[0](a1[0],a2); + }; + })([s],[onChange])); + } + } + ,addStateEventListener: function(onChange) { + var i = 0; + var _g = 0; + var _g1 = this.slot_ids; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + this.state[i++].addEventListener("updated",(function(a1,f) { + return function(a2) { + f[0](a1[0],a2); + }; + })([s],[onChange])); + } + } + ,isEquipped: function(info,value,name,nameParams) { + if(nameParams == null) { + nameParams = false; + } + if(value == null) { + value = -1; + } + var s = info.xml.get("slot"); + if(s == null) { + return false; + } else { + var slot = this.get(s); + if(slot == null) { + return false; + } else { + var i = slot.get(); + if(i != null && i.info == info && (value < 0 || i.value == value)) { + if(nameParams) { + return com_davidmaletz_mining_item_BaseInventory.startsWith(i.getNameStr(),name); + } else if(name != null) { + return i.getNameStr() == name; + } else { + return true; + } + } else { + return false; + } + } + } + } + ,increaseValue: function(p,s,dv) { + var slot = this.get(s); + if(slot == null) { + return false; + } + var i = slot.get(); + if(i == null || dv >= 0 && i.value >= i.getDurability()) { + return false; + } + if(i.info.xml.exists("durability")) { + var to = i.value + dv; + if(to < 0) { + to = 0; + } + var d = com_davidmaletz_mining_Main.parseInt(i.info.xml.get("durability")); + var low = Math.round(d * 0.8); + if(i.value < low && to >= low && com_davidmaletz_mining_item_EquipmentSlots.isBreakable(i,s) && d > 1) { + i.info.showNotification(com_fancyfish_faeng_common_Lang.getText("common","damaged"),i.getNameStr()); + } + if(to >= d) { + i.setValue(d); + if(com_davidmaletz_mining_item_EquipmentSlots.isBreakable(i,s)) { + this.onBreak(p,s); + } + } else { + i.setValue(to); + } + return true; + } else { + return false; + } + } + ,completeBreak: function(p,s,b) { + var inv = p.getInventory(); + var slot = this.get(s); + var orig = slot.get(); + if(b == null) { + this._unequip(p,s); + } else { + var bslot = b.info.xml.get("slot"); + if(bslot == s) { + this._equip(p,s,b); + } else { + var _slot = this.get(bslot); + if(_slot != null && _slot.get() == null) { + this._equip(p,bslot,b); + } else { + inv.addItems(b.info,1,b.value,b.getNameStr()); + } + this._unequip(p,s); + } + } + var i; + var tmp; + if(slot.get() == null && orig != null) { + i = inv.selectItem(orig.info,0,null); + tmp = i != null; + } else { + tmp = false; + } + if(tmp) { + this.equip(i,p); + } else if(s == "pickaxe" && slot.get() == null) { + var e = p.getOwner().getPickaxe(); + if(e != null && e.info.hasActionId("equip")) { + this.equip(e,p); + } + } + } + ,retransform: function(info,name,map,ar) { + map.set("{item}",info.getDisplay(name,false)); + ar.push(new com_davidmaletz_mining_item_ItemCt(com_davidmaletz_mining_item_ItemInfo.get(info.xml.get("retransform")),1)); + return com_fancyfish_faeng_common_Lang.getText("common","retransform"); + } + ,onBreak: function(e,s) { + var item = this.getItem(s); + var xml = item.info.xml; + var r = com_davidmaletz_mining_item_ItemInfo.get(xml.get("retransform")); + var p = e.getOwner(); + if(r != null && p.inventory.getItemCount(r) > 0) { + var i = com_davidmaletz_mining_item_ItemInfo.get(xml.get("broken")); + var name = item.getNameStr(); + var tmp = i.getDurability(); + var f = $bind(this,this.retransform); + var a1 = item.info; + var a2 = name; + var f1 = $bind(this,this.fixItem); + var i1 = i; + var s1 = s; + var f2 = $bind(this,this.killItem); + var p1 = p; + var s2 = s; + new com_davidmaletz_mining_item_FeedItem(null,p,i,tmp,name,null,false,function(a3,ar) { + return f(a1,a2,a3,ar); + },function(d) { + f1(i1,s1,d); + },function() { + f2(p1,s2); + }); + } else { + this.completeBreak(p,s,item.info.getBroken(item.getNameStr())); + } + } + ,fixItem: function(i,s,d) { + var item = this.getItem(s); + item.setValue(Math.floor(d * item.info.getDurability() / i.getDurability())); + } + ,killItem: function(p,s) { + var item = this.getItem(s); + if(item.value >= item.info.getDurability()) { + this.completeBreak(p,s,item.info.getBroken(item.getNameStr())); + } + } + ,checkUnequip: null + ,canChangeSlot: function(s) { + var i = this.getItemUsed(s); + if(!(i == null || !this.checkUnequip)) { + return i.info.xml.get("unequip") != "false"; + } else { + return true; + } + } + ,isSlotVisible: function(p,slot) { + var f = this.getSlotFlag(slot); + if(f != null) { + return p.getOwner().getFlag(f); + } else { + return true; + } + } + ,canEquip: function(p,slot,i) { + if(this.get(slot) == null || !this.canChangeSlot(slot)) { + return false; + } + if(!this.isSlotVisible(p,slot)) { + return false; + } + var _g = 0; + var _g1 = i.slots; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + if(!this.canChangeSlot(s)) { + return false; + } + } + var idx = this.slot_map.get(slot); + if(!(idx == null || this.used[idx].get() == null)) { + return this.canChangeSlot(this.used[idx].get()); + } else { + return true; + } + } + ,equip: function(item,p,newItem,s) { + if(newItem == null) { + newItem = false; + } + var inv = p.getInventory(); + if(s == null) { + s = item.info.xml.get("slot"); + } + if(s == null || !this.canEquip(p,s,item.info)) { + p.getOwner().noEquip(item); + return; + } + var slot = this.get(s); + if(slot != null && (newItem || inv.addItems(item.info,-1,item.value,item.getNameStr()))) { + var i = slot.get(); + if(i != null && i.info.xml.get("unequip") != "false") { + inv.addItems(i.info,1,i.value,i.getNameStr()); + } + this._equip(p,s,item); + } + } + ,forceEquip: function(s,p,item) { + if(s == null) { + return null; + } + var slot = this.get(s); + if(slot != null) { + var i = slot.get(); + if(item == null) { + this._unequip(p,s); + } else { + this._equip(p,s,item); + } + return i; + } else { + return null; + } + } + ,unequip: function(s,p,add) { + if(add == null) { + add = true; + } + var slot = this.get(s); + if(slot != null) { + var i = slot.get(); + if(i != null && i.info.xml.get("unequip") == "false") { + add = false; + if(this.checkUnequip) { + return; + } + } + if(i != null && add) { + p.getInventory().addItems(i.info,1,i.value,i.getNameStr()); + } + this._unequip(p,s); + } + } + ,get: function(slot) { + if(slot != null && this.slot_map.exists(slot)) { + return this.slots[this.slot_map.get(slot)]; + } else { + return null; + } + } + ,getItemUsed: function(slot) { + var m = this.get(slot); + if(m == null) { + return null; + } + var i = m.get(); + if(i == null) { + var s = this.getUsed(slot).get(); + if(s == null) { + return null; + } else { + return this.getItem(s); + } + } else { + return i; + } + } + ,getItem: function(slot) { + var m = this.get(slot); + if(m == null) { + return null; + } else { + return m.get(); + } + } + ,getItemId: function(slot) { + var i = this.getItem(slot); + if(i == null) { + return null; + } else { + return i.info.id; + } + } + ,getState: function(slot) { + if(slot != null && this.slot_map.exists(slot)) { + return this.state[this.slot_map.get(slot)]; + } else { + return null; + } + } + ,getStateI: function(slot) { + var m = this.getState(slot); + if(m == null) { + return 0; + } else { + return m.get(); + } + } + ,getUsed: function(slot) { + if(slot != null && this.slot_map.exists(slot)) { + return this.used[this.slot_map.get(slot)]; + } else { + return null; + } + } + ,isEmpty: function(slot) { + var e = this.get(slot); + if(e == null || e.get() == null) { + var m = this.getUsed(slot); + if(m != null) { + return m.get() == null; + } else { + return true; + } + } else { + return false; + } + } + ,runUnequip: function(i,p,slot,updateUsed) { + if(updateUsed == null) { + updateUsed = true; + } + if(this.fireEquipHandlers) { + var owner = p.getOwner(); + if(owner != null && i.info.identify == owner.identify) { + owner.identify = null; + } + if(Std["is"](i.info,com_davidmaletz_mining_item_Equipment)) { + var ar = (js_Boot.__cast(i.info , com_davidmaletz_mining_item_Equipment)).abilities; + if(ar != null) { + var _g = 0; + while(_g < ar.length) { + var a = ar[_g]; + ++_g; + p.removeAbility(a); + } + } + } + var vars = com_davidmaletz_faengfl_EventHandler.createVariables(); + vars.set("object",p); + i.info.runEvent("onUnequip",owner,i,null,vars); + } + if(updateUsed) { + var _g1 = 0; + var _g11 = i.info.slots; + while(_g1 < _g11.length) { + var s = _g11[_g1]; + ++_g1; + var idx = this.slot_map.get(s); + if(idx != null) { + if(this.used[idx].get() == slot) { + this.used[idx].set(null); + } + } + } + } + } + ,_unequip: function(p,s) { + var slot = this.get(s); + var i = slot.get(); + if(i != null) { + this.runUnequip(i,p,s); + this.state[this.slot_map.get(s)].set(0); + } + slot.set(null); + } + ,runEquip: function(i,p,slot) { + if(this.fireEquipHandlers) { + var owner = p.getOwner(); + if(owner != null && i.info.identify != null) { + owner.identify = i.info.identify; + } + if(Std["is"](i.info,com_davidmaletz_mining_item_Equipment)) { + var ar = (js_Boot.__cast(i.info , com_davidmaletz_mining_item_Equipment)).abilities; + if(ar != null) { + var _g = 0; + while(_g < ar.length) { + var a = ar[_g]; + ++_g; + p.setAbility(a); + } + } + } + var vars = com_davidmaletz_faengfl_EventHandler.createVariables(); + vars.set("object",p); + i.info.runEvent("onEquip",owner,i,null,vars); + } + this.updateSlots(i,slot); + } + ,updateSlots: function(i,slot) { + var _g = 0; + var _g1 = i.info.slots; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + var idx = this.slot_map.get(s); + if(idx != null) { + if(this.used[idx].get() == null) { + this.used[idx].set(slot); + } + } + } + } + ,_equip: function(p,slot,i) { + if(i != null) { + var _g = 0; + var _g1 = i.info.slots; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + this.unequip(s,p); + } + } + var idx = this.slot_map.get(slot); + if(idx != null && this.used[idx].get() != null) { + this.unequip(this.used[idx].get(),p); + } + this._unequip(p,slot); + if(i != null) { + this.get(slot).set(i); + this.runEquip(i,p,slot); + } + } + ,write: function(b,incFlags) { + if(incFlags == null) { + incFlags = true; + } + var i = 0; + var _g = 0; + var _g1 = this.slot_ids; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,s); + com_davidmaletz_mining_item_Item.write(b,this.slots[i].get()); + if(incFlags) { + b.writeByte(this.state[i].get()); + } + ++i; + } + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + } + ,read: function(b,version,incFlags) { + if(incFlags == null) { + incFlags = true; + } + while(true) { + var s = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(s == null) { + break; + } + var i = this.slot_ids.indexOf(s); + var item = com_davidmaletz_mining_item_Item.read(b,version); + var state = version >= 48 && incFlags ? b.readByte() & 255 : 0; + if(i != -1) { + this.slots[i].set(item); + this.state[i].set(state); + if(item != null) { + this.updateSlots(item,s); + } + } + } + } + ,getEquipment: function(itemFilter) { + return new com_davidmaletz_mining_item_ItemIterator(itemFilter,HxOverrides.iter(this.slots)); + } + ,iterator: function() { + return HxOverrides.iter(this.slots); + } + ,getSlots: function() { + return HxOverrides.iter(this.slot_ids); + } + ,__class__: com_davidmaletz_mining_item_EquipmentSlots +}; +var com_davidmaletz_mining_item_ItemIterator = function(itemFilter,i) { + this.filter = null; + this.iterator = i; + this.filter = itemFilter; + this.current = this.getNext(); +}; +$hxClasses["com.davidmaletz.mining.item.ItemIterator"] = com_davidmaletz_mining_item_ItemIterator; +com_davidmaletz_mining_item_ItemIterator.__name__ = ["com","davidmaletz","mining","item","ItemIterator"]; +com_davidmaletz_mining_item_ItemIterator.prototype = { + iterator: null + ,current: null + ,filter: null + ,hasNext: function() { + return this.current != null; + } + ,next: function() { + var ret = this.current; + this.current = this.getNext(); + return ret; + } + ,getNext: function() { + while(this.iterator.hasNext()) { + var i = this.iterator.next().get(); + if(i != null && (this.filter == null || this.filter(i.info))) { + return i; + } + } + return null; + } + ,__class__: com_davidmaletz_mining_item_ItemIterator +}; +var com_davidmaletz_mining_item_FarmInfo = function(xml,animal) { + this.item = xml.get("item"); + this.night = xml.exists("night") ? xml.get("night") == "true" : animal; + this.min = xml.exists("min") ? com_davidmaletz_mining_Main.parseInt(xml.get("min")) : 1; + this.max = xml.exists("max") ? com_davidmaletz_mining_Main.parseInt(xml.get("max")) : 1; + this.time = xml.exists("time") ? com_davidmaletz_mining_Main.parseInt(xml.get("time")) : 1; + if(this.time > 327) { + throw new js__$Boot_HaxeError("Max farm time is 327"); + } +}; +$hxClasses["com.davidmaletz.mining.item.FarmInfo"] = com_davidmaletz_mining_item_FarmInfo; +com_davidmaletz_mining_item_FarmInfo.__name__ = ["com","davidmaletz","mining","item","FarmInfo"]; +com_davidmaletz_mining_item_FarmInfo.prototype = { + item: null + ,time: null + ,min: null + ,max: null + ,night: null + ,getTime: function(name) { + var mod = com_davidmaletz_mining_item_ItemInfo.getMod(name); + if(mod == null || !mod.exists("efficiency")) { + return this.time; + } else { + return Math.ceil(this.time / com_davidmaletz_mining_Main.parseFloat(mod.get("efficiency"))); + } + } + ,getCount: function() { + return Math.floor((this.max + 1 - this.min) * Math.random()) + this.min; + } + ,__class__: com_davidmaletz_mining_item_FarmInfo +}; +var com_davidmaletz_mining_item_FarmItem = function(c,f,name) { + openfl_events_EventDispatcher.call(this); + this.info = f; + this.time = this.info.getTime(name); + this.growth = this.time * 200; + this.slot = c; +}; +$hxClasses["com.davidmaletz.mining.item.FarmItem"] = com_davidmaletz_mining_item_FarmItem; +com_davidmaletz_mining_item_FarmItem.__name__ = ["com","davidmaletz","mining","item","FarmItem"]; +com_davidmaletz_mining_item_FarmItem.__super__ = openfl_events_EventDispatcher; +com_davidmaletz_mining_item_FarmItem.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + info: null + ,growth: null + ,time: null + ,slot: null + ,getPercent: function() { + return 1 - this.growth / (this.time * 200); + } + ,isComplete: function() { + return this.growth == 0; + } + ,canProgress: function() { + if(!this.isComplete()) { + if(!(!com_davidmaletz_mining_Main.isNight())) { + return this.info.night; + } else { + return true; + } + } else { + return false; + } + } + ,tick: function(speed) { + if(this.canProgress()) { + this.growth -= speed; + if(this.growth < 0) { + this.growth = 0; + } + this.dispatchEvent(new openfl_events_Event("update_percent")); + } + } + ,reset: function() { + this.growth = this.time * 200; + this.dispatchEvent(new openfl_events_Event("update_percent")); + } + ,harvest: function() { + if(this.isComplete()) { + var ct = this.info.getCount(); + this.reset(); + if(this.slot != null) { + this.slot.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("harvest",this)); + } + return ct; + } else { + return 0; + } + } + ,__class__: com_davidmaletz_mining_item_FarmItem +}); +var com_davidmaletz_mining_item_Flight = function(xml) { + this.height = com_davidmaletz_mining_Main.parseInt(xml.get("height")); + this.cost = xml.exists("cost") ? com_davidmaletz_mining_Main.parseFloat(xml.get("cost")) : 0; + this.speed = xml.exists("speed") ? com_davidmaletz_mining_Main.parseInt(xml.get("speed")) : 0; + this.maxWeight = xml.exists("maxWeight") ? com_davidmaletz_mining_Main.parseInt(xml.get("maxWeight")) : 100000; + var i = xml.elementsNamed("equipCost"); + if(i.hasNext()) { + this.equipCost = new com_davidmaletz_mining_item_EquipCost(i.next()); + } +}; +$hxClasses["com.davidmaletz.mining.item.Flight"] = com_davidmaletz_mining_item_Flight; +com_davidmaletz_mining_item_Flight.__name__ = ["com","davidmaletz","mining","item","Flight"]; +com_davidmaletz_mining_item_Flight.prototype = { + height: null + ,cost: null + ,speed: null + ,equipCost: null + ,maxWeight: null + ,canFly: function(p,slot) { + if(p.inventory.getWeight() <= this.getMaxWeight()) { + if(this.equipCost != null) { + return this.equipCost.canRun(p,slot); + } else { + return true; + } + } else { + return false; + } + } + ,getMaxWeight: function() { + return com_davidmaletz_mining_DifficultyMode.getCurrent().modifyCapacity(this.maxWeight); + } + ,__class__: com_davidmaletz_mining_item_Flight +}; +var com_davidmaletz_mining_item_Identify = function(xml) { + this.tile = xml.get("tile"); + this.acquire = xml.get("acquire"); + this.animation = xml.get("animation"); + if(this.animation == null) { + this.animation = "single"; + } + this.color = xml.exists("color") ? com_davidmaletz_mining_Main.parseInt("0x" + xml.get("color")) : 16777215; + this.fps = com_davidmaletz_mining_enemy_AttackRenderer.getFPS(xml,10); +}; +$hxClasses["com.davidmaletz.mining.item.Identify"] = com_davidmaletz_mining_item_Identify; +com_davidmaletz_mining_item_Identify.__name__ = ["com","davidmaletz","mining","item","Identify"]; +com_davidmaletz_mining_item_Identify.prototype = { + tile: null + ,acquire: null + ,animation: null + ,color: null + ,fps: null + ,createSprite: function(e,p) { + if(p.vehicle != null && !(js_Boot.__cast(p.vehicle.gui , com_davidmaletz_mining_ui_VehicleGUI)).includeIdentify()) { + return null; + } + var t = com_davidmaletz_tiles_Tile.get(this.tile); + if(t == null) { + return null; + } + return new com_davidmaletz_mining_item__$Identify_IdentifySprite(t,e,p,this); + } + ,__class__: com_davidmaletz_mining_item_Identify +}; +var com_davidmaletz_mining_item__$Identify_IdentifySprite = function(t,e,p,i) { + com_davidmaletz_tiles_render_StaticPlayAnimation.call(this,t,i.acquire == null ? i.animation : i.acquire,i.fps,i.acquire == null,$bind(this,this.playAnim),-0.5,-0.5); + this.enemy = e; + this.player = p; + this.identify = i; + if(i.acquire == null) { + this.showInfo(); + } + this.updatePos(); + this.hp = new com_fancyfish_faeng_common_mutable_Mutable(); + this.def = new com_fancyfish_faeng_common_mutable_Mutable(); +}; +$hxClasses["com.davidmaletz.mining.item._Identify.IdentifySprite"] = com_davidmaletz_mining_item__$Identify_IdentifySprite; +com_davidmaletz_mining_item__$Identify_IdentifySprite.__name__ = ["com","davidmaletz","mining","item","_Identify","IdentifySprite"]; +com_davidmaletz_mining_item__$Identify_IdentifySprite.__super__ = com_davidmaletz_tiles_render_StaticPlayAnimation; +com_davidmaletz_mining_item__$Identify_IdentifySprite.prototype = $extend(com_davidmaletz_tiles_render_StaticPlayAnimation.prototype,{ + enemy: null + ,player: null + ,identify: null + ,info: null + ,hp: null + ,def: null + ,init: function(e) { + com_davidmaletz_tiles_render_StaticPlayAnimation.prototype.init.call(this,e); + this.enemy.addEventListener("update_defense",$bind(this,this.updateDef)); + this.updateDef(null); + this.enemy.addEventListener("change_health",$bind(this,this.updateHp)); + this.updateHp(null); + } + ,destroy: function(e) { + com_davidmaletz_tiles_render_StaticPlayAnimation.prototype.destroy.call(this,e); + this.enemy.removeEventListener("update_defense",$bind(this,this.updateDef)); + this.enemy.removeEventListener("change_health",$bind(this,this.updateHp)); + } + ,playAnim: function(p) { + this.playAnimation(this.identify.animation,true,null,-0.5,-0.5); + this.showInfo(); + } + ,showInfo: function() { + if(this.info != null) { + return; + } + this.info = new openfl_display_Sprite(); + this.addChild(this.info); + var t = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Concat2(com_fancyfish_faeng_common_Lang.getText("common","defense_short"),this.def,": "),new com_fancyfish_faeng_text_CharacterPlacer(0,1),this.identify.color,0.5); + t.set_y(-com_davidmaletz_tiles_Tile.SIZE * 0.5 - 5); + this.info.addChild(t); + var t1 = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Concat2(com_fancyfish_faeng_common_Lang.getText("common","health_short"),this.hp,": "),new com_fancyfish_faeng_text_CharacterPlacer(0,1),this.identify.color,0.5); + t1.set_y(com_davidmaletz_tiles_Tile.SIZE * 0.5); + this.info.addChild(t1); + } + ,updateHp: function(e) { + this.hp.set(Std.string(this.enemy.getHealth())); + } + ,updateDef: function(e) { + this.def.set(Std.string(this.enemy.getMinDefense())); + } + ,updatePos: function() { + if(this.player.vehicle != null && !(js_Boot.__cast(this.player.vehicle.gui , com_davidmaletz_mining_ui_VehicleGUI)).includeIdentify()) { + com_davidmaletz_faengfl_FaengFL.remove(this); + return; + } + this.set_scaleX(this.set_scaleY(com_davidmaletz_mining_Main.getGameScale())); + var r = this.enemy.renderer; + if(r != null && this.enemy.area != null && this.enemy.area.renderer != null) { + this.set_x(r.get_x() + this.enemy.area.renderer.get_x()); + this.set_y(r.get_y() + this.enemy.area.renderer.get_y()); + if(this.enemy.info.hitbox != null) { + var _g = this; + _g.set_x(_g.get_x() + Math.round(this.enemy.info.hitbox.x + this.enemy.info.hitbox.width * 0.5 - this.enemy._width * 0.5)); + var _g1 = this; + _g1.set_y(_g1.get_y() + Math.round(this.enemy.info.hitbox.y + this.enemy.info.hitbox.height * 0.5 - this.enemy._height * 0.5)); + } + } else { + com_davidmaletz_faengfl_FaengFL.remove(this); + } + } + ,handle_frame: function(e) { + com_davidmaletz_tiles_render_StaticPlayAnimation.prototype.handle_frame.call(this,e); + this.updatePos(); + } + ,__class__: com_davidmaletz_mining_item__$Identify_IdentifySprite +}); +var com_davidmaletz_mining_item_Inventory = function() { + com_davidmaletz_mining_item_BaseInventory.call(this); + this.items = new haxe_ds_StringMap(); + this.weight = 0; +}; +$hxClasses["com.davidmaletz.mining.item.Inventory"] = com_davidmaletz_mining_item_Inventory; +com_davidmaletz_mining_item_Inventory.__name__ = ["com","davidmaletz","mining","item","Inventory"]; +com_davidmaletz_mining_item_Inventory.filterType = function(type,item) { + return item.type == type; +}; +com_davidmaletz_mining_item_Inventory.cmpId = function(a,b) { + var an = a.item.getName().get(); + var bn = b.item.getName().get(); + if(an < bn) { + return -1; + } else if(bn < an) { + return 1; + } else { + return 0; + } +}; +com_davidmaletz_mining_item_Inventory.ascCost = function(a,b) { + var av = (a.item.type.index << 16) + a.item.cost; + var bv = (b.item.type.index << 16) + b.item.cost; + if(av == bv) { + return com_davidmaletz_mining_item_Inventory.cmpId(a,b); + } else { + return av - bv; + } +}; +com_davidmaletz_mining_item_Inventory.descCost = function(a,b) { + var av = (a.item.type.index << 16) - a.item.cost; + var bv = (b.item.type.index << 16) - b.item.cost; + if(av == bv) { + return com_davidmaletz_mining_item_Inventory.cmpId(b,a); + } else { + return av - bv; + } +}; +com_davidmaletz_mining_item_Inventory.load = function(id,b,version) { + if(version < 28 || version < 30 && !com_davidmaletz_mining_item_ItemData.hasOldDurability(id)) { + return b.readUInt16(); + } else { + return com_davidmaletz_mining_item_ItemData.load(b,version); + } +}; +com_davidmaletz_mining_item_Inventory.__super__ = com_davidmaletz_mining_item_BaseInventory; +com_davidmaletz_mining_item_Inventory.prototype = $extend(com_davidmaletz_mining_item_BaseInventory.prototype,{ + items: null + ,weight: null + ,addItems: function(item,count,value,name) { + if(value == null) { + value = 0; + } + if(item == null) { + return false; + } + var old = this.getItemCount(item); + if(count + old < 0) { + count = -old; + } + if(count != 0) { + this.weight -= Math.ceil(item.weight * old); + var c = count + old; + this.weight += Math.ceil(item.weight * c); + if(c <= 0) { + this.items.remove(item.id); + } else if(this.items.exists(item.id)) { + this.items.get(item.id).add(count,value,name); + } else { + this.items.set(item.id,new com_davidmaletz_mining_item_ItemData(item,c,value,name)); + } + this.dispatchEvent(new com_davidmaletz_mining_item_ItemEvent("item_added",this,item,c,c - old,value,name,name)); + return true; + } else { + return false; + } + } + ,changeName: function(item,value,from,to) { + if(this.items.exists(item.id)) { + this.items.get(item.id).changeName(value,from,to); + this.dispatchEvent(new com_davidmaletz_mining_item_ItemEvent("item_added",this,item,this.getItemCount(item),0,value,from,to)); + } + } + ,hasItem: function() { + var i = this.items.iterator(); + while(i.hasNext()) { + var i1 = i.next(); + if(i1.count > 0) { + return true; + } + } + return false; + } + ,getItem: function(item) { + return this.items.get(item.id); + } + ,getItems: function(itemFilter,sort) { + var i = new com_davidmaletz_mining_item__$Inventory_ItemIterator(this.items,itemFilter); + if(sort == null) { + return i; + } + var ar = []; + var item = i; + while(item.hasNext()) { + var item1 = item.next(); + ar.push(item1); + } + ar.sort(sort); + return HxOverrides.iter(ar); + } + ,getWeight: function() { + return this.weight; + } + ,write: function(b) { + var i = this.items.iterator(); + while(i.hasNext()) { + var i1 = i.next(); + if(i1.count > 0) { + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,i1.item.id); + i1.write(b); + } + } + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + } + ,clear: function() { + var i = this.items.iterator(); + while(i.hasNext()) { + var i1 = i.next(); + this.setItemCount(i1.item,0); + } + } + ,copyFrom: function(inv) { + this.clear(); + this.addAll(inv); + } + ,read: function(b,version) { + this.clear(); + var copies = null; + while(true) { + var item = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(item == null) { + break; + } + var i = com_davidmaletz_mining_item_ItemInfo._get(item); + var name = null; + if(i == null) { + var a = com_davidmaletz_mining_item_ItemInfo.getAlias(item); + if(a != null) { + i = a.info; + name = a.getNameStr(); + } else { + haxe_Log.trace("No Item found: " + item,{ fileName : "Inventory.hx", lineNumber : 66, className : "com.davidmaletz.mining.item.Inventory", methodName : "read"}); + com_davidmaletz_mining_Main.error = true; + } + } + if(i != null) { + var ct = new com_davidmaletz_mining_item_ItemData(i,0,0,null); + ct.read(b,version); + if(name != null) { + ct.changeName(0,null,name,ct.getValueCount(0,null)); + } + if(this.items.exists(i.id)) { + if(copies == null) { + copies = [ct]; + } else { + copies.push(ct); + } + } else { + this.items.set(i.id,ct); + this.weight += Math.ceil(i.weight * ct.count); + this.dispatchEvent(new com_davidmaletz_mining_item_ItemEvent("item_added",this,i,ct.count,ct.count,0,null,null)); + } + } else { + com_davidmaletz_mining_item_Inventory.load(item,b,version); + } + } + if(copies != null) { + var _g = 0; + while(_g < copies.length) { + var c = copies[_g]; + ++_g; + var v = c.getItemValues(); + while(v.hasNext()) { + var v1 = v.next(); + this.addItems(v1.item,v1.count,v1.value,v1.name); + } + } + } + } + ,__class__: com_davidmaletz_mining_item_Inventory +}); +var com_davidmaletz_mining_item_SelectItemIterator = function(i,inv) { + this.iterator = i; + this.inventory = inv; + this.getNext(); +}; +$hxClasses["com.davidmaletz.mining.item.SelectItemIterator"] = com_davidmaletz_mining_item_SelectItemIterator; +com_davidmaletz_mining_item_SelectItemIterator.__name__ = ["com","davidmaletz","mining","item","SelectItemIterator"]; +com_davidmaletz_mining_item_SelectItemIterator.prototype = { + iterator: null + ,values: null + ,inventory: null + ,item: null + ,hasNext: function() { + return this.item != null; + } + ,next: function() { + var i = this.item; + this.getNext(); + return i; + } + ,getNext: function() { + while(this.values == null || !this.values.hasNext()) if(this.iterator.hasNext()) { + this.values = this.iterator.next().getItemValues(); + } else { + this.item = null; + return; + } + var v = this.values.next(); + this.item = new com_davidmaletz_mining_item_Item(v.item,v.value,v.name); + } + ,__class__: com_davidmaletz_mining_item_SelectItemIterator +}; +var com_davidmaletz_mining_item__$Inventory_ItemIterator = function(items,filter) { + this.filter = filter; + this.iterator = items.iterator(); + this.current = this.getNext(); +}; +$hxClasses["com.davidmaletz.mining.item._Inventory.ItemIterator"] = com_davidmaletz_mining_item__$Inventory_ItemIterator; +com_davidmaletz_mining_item__$Inventory_ItemIterator.__name__ = ["com","davidmaletz","mining","item","_Inventory","ItemIterator"]; +com_davidmaletz_mining_item__$Inventory_ItemIterator.prototype = { + iterator: null + ,current: null + ,filter: null + ,hasNext: function() { + return this.current != null; + } + ,next: function() { + var ret = this.current; + this.current = this.getNext(); + return ret; + } + ,getNext: function() { + while(this.iterator.hasNext()) { + var i = this.iterator.next(); + if(i.count > 0 && (this.filter == null || this.filter(i.item))) { + return i; + } + } + return null; + } + ,__class__: com_davidmaletz_mining_item__$Inventory_ItemIterator +}; +var com_davidmaletz_mining_item_ItemEvent = function(type,p,i,ct,d,val,n,r) { + openfl_events_Event.call(this,type); + this.item = i; + this.inventory = p; + this.count = ct; + this.delta = d; + this.value = val; + this.name = n; + this.rename = r; +}; +$hxClasses["com.davidmaletz.mining.item.ItemEvent"] = com_davidmaletz_mining_item_ItemEvent; +com_davidmaletz_mining_item_ItemEvent.__name__ = ["com","davidmaletz","mining","item","ItemEvent"]; +com_davidmaletz_mining_item_ItemEvent.__super__ = openfl_events_Event; +com_davidmaletz_mining_item_ItemEvent.prototype = $extend(openfl_events_Event.prototype,{ + inventory: null + ,item: null + ,value: null + ,name: null + ,rename: null + ,count: null + ,delta: null + ,__class__: com_davidmaletz_mining_item_ItemEvent +}); +var com_davidmaletz_mining_item_Item = function(info,value,n) { + openfl_events_EventDispatcher.call(this); + this.info = info; + this.value = value; + this.name = new com_davidmaletz_mining_item_ItemMutable(info.getName(),n); +}; +$hxClasses["com.davidmaletz.mining.item.Item"] = com_davidmaletz_mining_item_Item; +com_davidmaletz_mining_item_Item.__name__ = ["com","davidmaletz","mining","item","Item"]; +com_davidmaletz_mining_item_Item.__interfaces__ = [com_davidmaletz_mining_ui_ItemType]; +com_davidmaletz_mining_item_Item.write = function(b,item) { + if(item == null) { + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + } else { + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,item.info.id); + b.writeUInt16(item.value); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,item.getNameStr()); + } +}; +com_davidmaletz_mining_item_Item.readName = function(b) { + var n = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(n == null) { + return null; + } else if(n.indexOf("&") == -1) { + return "&" + n; + } else { + return n; + } +}; +com_davidmaletz_mining_item_Item.read = function(b,version) { + var id = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(id == null) { + return null; + } + var i = com_davidmaletz_mining_item_ItemInfo.get(id); + var d = b.readUInt16(); + var n = version >= 32 ? com_davidmaletz_mining_item_Item.readName(b) : null; + if(i == null) { + return null; + } else { + return new com_davidmaletz_mining_item_Item(i,d,n); + } +}; +com_davidmaletz_mining_item_Item._getName = function(infoName,name,defaultName) { + return new com_davidmaletz_mining_item_ItemMutable(defaultName == null ? infoName : new com_fancyfish_faeng_common_mutable_Static(defaultName),name); +}; +com_davidmaletz_mining_item_Item._createIcon = function(info,value,name,item) { + var s = new openfl_display_Sprite(); + var ico = new openfl_display_Sprite(); + s.addChild(ico); + if((value > 0 || item != null) && info.xml.exists("durability")) { + var d = com_davidmaletz_mining_Main.parseInt(info.xml.get("durability")); + var p = new com_davidmaletz_mining_item__$Item_ValueBar(item,d,value); + p.set_y(9); + s.addChild(p); + } + if(item != null) { + new com_davidmaletz_mining_item__$Item_IconUpdater(ico,item); + } else { + com_davidmaletz_mining_item_Item.addIcon(ico,info,value,name); + } + return s; +}; +com_davidmaletz_mining_item_Item.addIcon = function(s,info,value,name) { + s.addChild(info.makeIcon(name)); + var i = com_davidmaletz_mining_item_ItemInfo.get(com_davidmaletz_mining_item_ItemInfo.getParameter(name,"p")); + if(i == null) { + i = com_davidmaletz_mining_item_ItemInfo.get(com_davidmaletz_mining_item_ItemInfo.getParameter(name,"m")); + } + if(i == null) { + i = com_davidmaletz_mining_item_ItemInfo.get(info.xml.get("rightIcon")); + } + if(i != null) { + var p = i.createIcon(); + p.set_scaleX(p.set_scaleY(0.5)); + p.set_x(com_davidmaletz_tiles_Tile.SIZE * 0.5); + p.set_y(5); + s.addChild(p); + } + var i1 = com_davidmaletz_mining_item_ItemInfo.get(com_davidmaletz_mining_item_ItemInfo.getParameter(name,"l")); + if(i1 == null) { + i1 = com_davidmaletz_mining_item_ItemInfo.get(info.xml.get("leftIcon")); + } + if(i1 != null) { + var p1 = i1.createIcon(); + p1.set_scaleX(p1.set_scaleY(0.5)); + p1.set_x(0); + p1.set_y(5); + s.addChild(p1); + } +}; +com_davidmaletz_mining_item_Item.getIconDisplay = function(info,name) { + return "[icon=" + info.id + (name == null ? "" : " name=" + StringTools.urlEncode(name)) + "]"; +}; +com_davidmaletz_mining_item_Item.__super__ = openfl_events_EventDispatcher; +com_davidmaletz_mining_item_Item.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + info: null + ,value: null + ,name: null + ,exists: function(inv) { + return inv.getItemValueCount(this.info,this.value,this.getNameStr()) > 0; + } + ,increaseValue: function(inv,dv) { + if(this.info.xml.exists("durability")) { + inv.changeValue(this.info,this.getNameStr(),this.value,this.value + dv); + this.setValue(this.value + dv); + } + } + ,getDurability: function() { + return this.info.getDurability(); + } + ,getFeed: function() { + return this.getDurability() - this.value; + } + ,setValue: function(value) { + if(value != this.value) { + this.value = value; + this.dispatchEvent(new openfl_events_Event("update_value")); + } + } + ,getName: function() { + return this.name; + } + ,setName: function(n) { + this.name.setName(n); + } + ,getNameStr: function() { + return this.name.getName(); + } + ,getElement: function() { + return this.info._getElement(this.getNameStr()); + } + ,createIcon: function() { + return com_davidmaletz_mining_item_Item._createIcon(this.info,this.value,this.getNameStr(),this); + } + ,getTile: function() { + return this.info.getIcon(this.getNameStr()); + } + ,addInfo: function(s,w,x,y) { + return this.info._addInfo(s,w,x,y,this.value,this.getNameStr()); + } + ,getInfo: function() { + return this.info; + } + ,getDefaultProjectile: function() { + var p = com_davidmaletz_mining_item_ItemInfo.getParameter(this.getNameStr(),"p"); + if(p != null && com_davidmaletz_mining_item_ItemInfo.exists(p)) { + return com_davidmaletz_mining_item_ItemInfo.get(p); + } else { + return com_davidmaletz_mining_item_ItemInfo.get(this.info.xml.get("projectile")); + } + } + ,'use': function(p) { + var a = this.info.getFirstAction(p,this.value,this.getNameStr()); + if(a != null) { + a["use"](); + } + } + ,__class__: com_davidmaletz_mining_item_Item +}); +var com_davidmaletz_mining_item_ItemMutable = function(p,n) { + com_fancyfish_faeng_common_mutable_Mutable.call(this); + this.parent = p; + this.name = n; +}; +$hxClasses["com.davidmaletz.mining.item.ItemMutable"] = com_davidmaletz_mining_item_ItemMutable; +com_davidmaletz_mining_item_ItemMutable.__name__ = ["com","davidmaletz","mining","item","ItemMutable"]; +com_davidmaletz_mining_item_ItemMutable._getName = function(n,name) { + if(name == null) { + return n.get(); + } else { + var i = name.indexOf("&") + 1; + if(i == name.length) { + return n.get(); + } else { + return HxOverrides.substr(name,i,null); + } + } +}; +com_davidmaletz_mining_item_ItemMutable.__super__ = com_fancyfish_faeng_common_mutable_Mutable; +com_davidmaletz_mining_item_ItemMutable.prototype = $extend(com_fancyfish_faeng_common_mutable_Mutable.prototype,{ + parent: null + ,name: null + ,getValue: function() { + return com_davidmaletz_mining_item_ItemMutable._getName(this.parent,this.name); + } + ,setName: function(n) { + if(n != this.name) { + this.name = n; + this.update(); + } + } + ,getName: function() { + return this.name; + } + ,handleEvent: function(e) { + if(this.name == null) { + this.update(); + } + } + ,addEventListener: function(type,listener,useCapture,priority,useWeakReference) { + if(useWeakReference == null) { + useWeakReference = false; + } + if(priority == null) { + priority = 0; + } + if(useCapture == null) { + useCapture = false; + } + var old = this.hasEventListener("updated"); + com_fancyfish_faeng_common_mutable_Mutable.prototype.addEventListener.call(this,type,listener); + if(!old && this.hasEventListener("updated")) { + this.parent.addEventListener("updated",$bind(this,this.handleEvent)); + } + } + ,removeEventListener: function(type,listener,useCapture) { + if(useCapture == null) { + useCapture = false; + } + var old = this.hasEventListener("updated"); + com_fancyfish_faeng_common_mutable_Mutable.prototype.removeEventListener.call(this,type,listener); + if(old && !this.hasEventListener("updated")) { + this.parent.removeEventListener("updated",$bind(this,this.handleEvent)); + } + } + ,__class__: com_davidmaletz_mining_item_ItemMutable +}); +var com_davidmaletz_mining_item__$Item_ValueBar = function(item,durability,value) { + com_davidmaletz_controls_ProgressBar.call(this,com_davidmaletz_tiles_Tile.SIZE,1,com_davidmaletz_mining_Main.PROGRESS_COL,0,false); + this.durability = durability; + this.item = item; + this.set_visible(value > 0); + if(item != null) { + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); + } else { + if(value > durability) { + value = durability; + } + this.setProgress((durability - value) / durability); + } +}; +$hxClasses["com.davidmaletz.mining.item._Item.ValueBar"] = com_davidmaletz_mining_item__$Item_ValueBar; +com_davidmaletz_mining_item__$Item_ValueBar.__name__ = ["com","davidmaletz","mining","item","_Item","ValueBar"]; +com_davidmaletz_mining_item__$Item_ValueBar.__super__ = com_davidmaletz_controls_ProgressBar; +com_davidmaletz_mining_item__$Item_ValueBar.prototype = $extend(com_davidmaletz_controls_ProgressBar.prototype,{ + item: null + ,durability: null + ,init: function(e) { + this.destroy(null); + this.item.addEventListener("update_value",$bind(this,this.update)); + this.update(null); + } + ,destroy: function(e) { + this.item.removeEventListener("update_value",$bind(this,this.update)); + } + ,update: function(e) { + var v = this.item.value; + if(v > this.durability) { + v = this.durability; + } + this.setProgress((this.durability - v) / this.durability); + this.set_visible(v > 0); + } + ,__class__: com_davidmaletz_mining_item__$Item_ValueBar +}); +var com_davidmaletz_mining_item__$Item_IconUpdater = function(s,i) { + this.sprite = s; + this.item = i; + s.addEventListener("addedToStage",$bind(this,this.init)); + s.addEventListener("removedFromStage",$bind(this,this.destroy)); +}; +$hxClasses["com.davidmaletz.mining.item._Item.IconUpdater"] = com_davidmaletz_mining_item__$Item_IconUpdater; +com_davidmaletz_mining_item__$Item_IconUpdater.__name__ = ["com","davidmaletz","mining","item","_Item","IconUpdater"]; +com_davidmaletz_mining_item__$Item_IconUpdater.prototype = { + sprite: null + ,item: null + ,init: function(e) { + this.destroy(null); + this.item.getName().addEventListener("updated",$bind(this,this.update)); + this.update(null); + } + ,destroy: function(e) { + this.item.getName().removeEventListener("updated",$bind(this,this.update)); + } + ,update: function(e) { + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this.sprite); + com_davidmaletz_mining_item_Item.addIcon(this.sprite,this.item.info,this.item.value,this.item.getNameStr()); + } + ,__class__: com_davidmaletz_mining_item__$Item_IconUpdater +}; +var com_davidmaletz_mining_item_ItemCategory = function(i,id,icon,action,canStore,showCount,syncPlayers) { + if(syncPlayers == null) { + syncPlayers = false; + } + if(showCount == null) { + showCount = true; + } + if(canStore == null) { + canStore = true; + } + this.index = i; + this.id = id; + this.icon = icon; + this.action = action; + this.canStore = canStore; + this.showCount = showCount; + this.syncPlayers = syncPlayers; +}; +$hxClasses["com.davidmaletz.mining.item.ItemCategory"] = com_davidmaletz_mining_item_ItemCategory; +com_davidmaletz_mining_item_ItemCategory.__name__ = ["com","davidmaletz","mining","item","ItemCategory"]; +com_davidmaletz_mining_item_ItemCategory.type_array = null; +com_davidmaletz_mining_item_ItemCategory.default_type = null; +com_davidmaletz_mining_item_ItemCategory.count = function() { + if(com_davidmaletz_mining_item_ItemCategory.type_array == null) { + return 0; + } else { + return com_davidmaletz_mining_item_ItemCategory.type_array.length; + } +}; +com_davidmaletz_mining_item_ItemCategory.get = function(i) { + return com_davidmaletz_mining_item_ItemCategory.type_array[i]; +}; +com_davidmaletz_mining_item_ItemCategory.types = null; +com_davidmaletz_mining_item_ItemCategory.load = function(e) { + if(com_davidmaletz_mining_item_ItemCategory.type_array == null) { + com_davidmaletz_mining_item_ItemCategory.type_array = []; + } + if(com_davidmaletz_mining_item_ItemCategory.types == null) { + com_davidmaletz_mining_item_ItemCategory.types = new haxe_ds_StringMap(); + } + var t = com_davidmaletz_mining_item_ItemCategory.types.get(e.get("id")); + if(t == null) { + t = new com_davidmaletz_mining_item_ItemCategory(com_davidmaletz_mining_item_ItemCategory.type_array.length,e.get("id"),e.get("icon"),e.get("action"),e.get("canStore") != "false",e.get("showCount") != "false",e.get("syncPlayers") == "true"); + var b = e.exists("before") ? com_davidmaletz_mining_item_ItemCategory.types.get(e.get("before")) : null; + var i = b == null ? -1 : com_davidmaletz_mining_item_ItemCategory.type_array.indexOf(b); + if(i == -1) { + com_davidmaletz_mining_item_ItemCategory.type_array.push(t); + } else { + com_davidmaletz_mining_item_ItemCategory.type_array.splice(i,0,t); + var _g1 = i; + var _g = com_davidmaletz_mining_item_ItemCategory.type_array.length; + while(_g1 < _g) { + var j = _g1++; + com_davidmaletz_mining_item_ItemCategory.type_array[j].index = j; + } + } + com_davidmaletz_mining_item_ItemCategory.types.set(t.id,t); + } else { + haxe_Log.trace("Overwrite Item Type: " + e.get("id"),{ fileName : "ItemCategory.hx", lineNumber : 27, className : "com.davidmaletz.mining.item.ItemCategory", methodName : "load"}); + t.icon = e.get("icon"); + t.action = e.get("action"); + t.canStore = e.get("canStore") != "false"; + t.showCount = e.get("showCount") != "false"; + t.syncPlayers = e.get("syncPlayers") == "true"; + } + if(e.get("default") == "true") { + com_davidmaletz_mining_item_ItemCategory.default_type = t; + } +}; +com_davidmaletz_mining_item_ItemCategory.parse = function(id) { + if(id == "none") { + return com_davidmaletz_mining_item_ItemCategory.none; + } else if(id == null || com_davidmaletz_mining_item_ItemCategory.types == null) { + return com_davidmaletz_mining_item_ItemCategory.default_type; + } else { + var t = com_davidmaletz_mining_item_ItemCategory.types.get(id); + if(t == null) { + return com_davidmaletz_mining_item_ItemCategory.default_type; + } else { + return t; + } + } +}; +com_davidmaletz_mining_item_ItemCategory.reset = function() { + com_davidmaletz_mining_item_ItemCategory.types = null; + com_davidmaletz_mining_item_ItemCategory.type_array = null; + com_davidmaletz_mining_item_ItemCategory.default_type = null; +}; +com_davidmaletz_mining_item_ItemCategory.prototype = { + index: null + ,id: null + ,syncPlayers: null + ,icon: null + ,action: null + ,canStore: null + ,showCount: null + ,__class__: com_davidmaletz_mining_item_ItemCategory +}; +var com_davidmaletz_mining_item_ItemCt = function(i,ct) { + this.item = i; + this.count = ct; +}; +$hxClasses["com.davidmaletz.mining.item.ItemCt"] = com_davidmaletz_mining_item_ItemCt; +com_davidmaletz_mining_item_ItemCt.__name__ = ["com","davidmaletz","mining","item","ItemCt"]; +com_davidmaletz_mining_item_ItemCt.__interfaces__ = [com_davidmaletz_mining_ui_ItemType]; +com_davidmaletz_mining_item_ItemCt.prototype = { + item: null + ,count: null + ,getName: function() { + return this.item.getName(); + } + ,createIcon: function() { + return this.item.createIcon(); + } + ,getElement: function() { + return this.item.getElement(); + } + ,addInfo: function(s,w,x,y) { + return this.item.addInfo(s,w,x,y); + } + ,getInfo: function() { + return this.item; + } + ,__class__: com_davidmaletz_mining_item_ItemCt +}; +var com_davidmaletz_mining_item_ItemValueCt = function(i,ct,v,n,incCount) { + if(incCount == null) { + incCount = false; + } + com_davidmaletz_mining_item_ItemCt.call(this,i,ct); + this.value = v; + this.name = n; + this.incCount = incCount; +}; +$hxClasses["com.davidmaletz.mining.item.ItemValueCt"] = com_davidmaletz_mining_item_ItemValueCt; +com_davidmaletz_mining_item_ItemValueCt.__name__ = ["com","davidmaletz","mining","item","ItemValueCt"]; +com_davidmaletz_mining_item_ItemValueCt.__super__ = com_davidmaletz_mining_item_ItemCt; +com_davidmaletz_mining_item_ItemValueCt.prototype = $extend(com_davidmaletz_mining_item_ItemCt.prototype,{ + value: null + ,name: null + ,incCount: null + ,getName: function() { + var n = com_davidmaletz_mining_item_Item._getName(this.item.getName(),this.name); + if(this.incCount) { + if(this.count == 1) { + return n; + } else { + return new com_fancyfish_faeng_common_mutable_Concat(n," x" + com_fancyfish_faeng_common_Utils.largeNumberFormat(this.count)); + } + } else { + return n; + } + } + ,getElement: function() { + return this.item._getElement(this.name); + } + ,createIcon: function() { + return com_davidmaletz_mining_item_Item._createIcon(this.item,this.value,this.name); + } + ,addInfo: function(s,w,x,y) { + return this.item._addInfo(s,w,x,y,this.value,this.name); + } + ,asItem: function() { + return new com_davidmaletz_mining_item_Item(this.item,this.value,this.name); + } + ,__class__: com_davidmaletz_mining_item_ItemValueCt +}); +var com_davidmaletz_mining_item_ItemParent = function(p,i,ct,v,name) { + com_davidmaletz_mining_item_ItemValueCt.call(this,i,ct,v,name); + this.inventory = p; +}; +$hxClasses["com.davidmaletz.mining.item.ItemParent"] = com_davidmaletz_mining_item_ItemParent; +com_davidmaletz_mining_item_ItemParent.__name__ = ["com","davidmaletz","mining","item","ItemParent"]; +com_davidmaletz_mining_item_ItemParent.__super__ = com_davidmaletz_mining_item_ItemValueCt; +com_davidmaletz_mining_item_ItemParent.prototype = $extend(com_davidmaletz_mining_item_ItemValueCt.prototype,{ + inventory: null + ,__class__: com_davidmaletz_mining_item_ItemParent +}); +var com_davidmaletz_mining_item_ItemXmlCt = function(e,i,ct) { + com_davidmaletz_mining_item_ItemCt.call(this,i,ct); + this.xml = e; +}; +$hxClasses["com.davidmaletz.mining.item.ItemXmlCt"] = com_davidmaletz_mining_item_ItemXmlCt; +com_davidmaletz_mining_item_ItemXmlCt.__name__ = ["com","davidmaletz","mining","item","ItemXmlCt"]; +com_davidmaletz_mining_item_ItemXmlCt.__super__ = com_davidmaletz_mining_item_ItemCt; +com_davidmaletz_mining_item_ItemXmlCt.prototype = $extend(com_davidmaletz_mining_item_ItemCt.prototype,{ + xml: null + ,__class__: com_davidmaletz_mining_item_ItemXmlCt +}); +var com_davidmaletz_mining_item_ItemData = function(i,ct,val,name) { + com_davidmaletz_mining_item_ItemCt.call(this,i,0); + if(ct > 0) { + this.add(ct,val,name); + } +}; +$hxClasses["com.davidmaletz.mining.item.ItemData"] = com_davidmaletz_mining_item_ItemData; +com_davidmaletz_mining_item_ItemData.__name__ = ["com","davidmaletz","mining","item","ItemData"]; +com_davidmaletz_mining_item_ItemData.oldDurabilityMap = null; +com_davidmaletz_mining_item_ItemData.hasOldDurability = function(id) { + if(com_davidmaletz_mining_item_ItemData.oldDurabilityMap == null) { + com_davidmaletz_mining_item_ItemData.oldDurabilityMap = new haxe_ds_StringMap(); + var _g = 0; + var _g1 = com_davidmaletz_mining_item_ItemData.oldDurability; + while(_g < _g1.length) { + var d = _g1[_g]; + ++_g; + com_davidmaletz_mining_item_ItemData.oldDurabilityMap.set(d,true); + } + } + return com_davidmaletz_mining_item_ItemData.oldDurabilityMap.exists(id); +}; +com_davidmaletz_mining_item_ItemData.clampCount = function(ct) { + if(ct > 65533) { + return 65533; + } else { + return ct; + } +}; +com_davidmaletz_mining_item_ItemData.load = function(b,version,valueFunc) { + var count = 0; + var name = null; + var value = b.readUInt16(); + if(value == 65535) { + if(version < 30) { + count = 0; + } else { + count = b.readUInt16(); + } + if(count > 0 && valueFunc != null) { + valueFunc(name).set(0,count); + } + return count; + } + while(true) { + if(value == 65534) { + name = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(name != null) { + name = com_davidmaletz_mining_item_ItemInfo.sortParameters(name); + } + value = b.readUInt16(); + } + var ct = b.readUInt16(); + count += ct; + if(ct > 0 && valueFunc != null) { + var map = valueFunc(name); + map.set(value,(map.exists(value) ? map.get(value) : 0) + ct); + } + value = b.readUInt16(); + if(!(value != 65535)) { + break; + } + } + return count; +}; +com_davidmaletz_mining_item_ItemData.__super__ = com_davidmaletz_mining_item_ItemCt; +com_davidmaletz_mining_item_ItemData.prototype = $extend(com_davidmaletz_mining_item_ItemCt.prototype,{ + nameMap: null + ,values: null + ,add: function(count,value,name) { + this.count += count; + count = this.getValues(name,false).add(count,value); + if(count > 0 && this.values != null) { + count = this.values.add(-count,value); + } + if(count > 0 && this.nameMap != null) { + var v = this.nameMap.iterator(); + while(v.hasNext()) { + var v1 = v.next(); + count = v1.add(-count,value); + if(count <= 0) { + break; + } + } + } + } + ,hasName: function() { + if(this.nameMap == null) { + return false; + } + var v = this.nameMap.iterator(); + while(v.hasNext()) { + var v1 = v.next(); + if(v1.hasValue()) { + return true; + } + } + return false; + } + ,write: function(b) { + if(!this.hasName()) { + if(this.values == null || !this.values.hasDurability()) { + b.writeUInt16(65535); + b.writeUInt16(com_davidmaletz_mining_item_ItemData.clampCount(this.count)); + } else { + this.values.write(b); + b.writeUInt16(65535); + } + return; + } + if(this.values != null && this.values.hasValue()) { + this.values.write(b); + } + var n = this.nameMap.keys(); + while(n.hasNext()) { + var n1 = n.next(); + var v = this.nameMap.get(n1); + if(!v.hasValue()) { + continue; + } + b.writeUInt16(65534); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,n1); + v.write(b); + } + b.writeUInt16(65535); + } + ,read: function(b,version) { + if(version < 28 || version < 30 && !com_davidmaletz_mining_item_ItemData.hasOldDurability(this.item.id)) { + this.count = b.readUInt16(); + this.getValues(null,false).valueMap.set(0,this.count); + return; + } + this.count = com_davidmaletz_mining_item_ItemData.load(b,version,$bind(this,this._valueFunc)); + } + ,_valueFunc: function(name) { + return this.getValues(name,false).valueMap; + } + ,changeValue: function(name,from,to) { + var v = this.getValues(name,true); + if(v != null) { + v.changeValue(from,to); + } + } + ,changeName: function(value,from,to,ct) { + if(ct == null) { + ct = 1; + } + var v = this.getValues(from,true); + if(v != null && v.getValueCount(value) >= ct) { + v.add(-ct,value); + this.getValues(to,false).add(ct,value); + } + } + ,getValues: function(name,allowNull) { + if(name == null) { + if(this.values == null) { + if(allowNull) { + return null; + } + this.values = new com_davidmaletz_mining_item__$ItemData_Values(); + } + return this.values; + } else { + if(this.nameMap == null) { + if(allowNull) { + return null; + } + this.nameMap = new haxe_ds_StringMap(); + } + var v = this.nameMap.get(name); + if(v == null) { + if(allowNull) { + return null; + } + v = new com_davidmaletz_mining_item__$ItemData_Values(); + this.nameMap.set(name,v); + } + return v; + } + } + ,getValueCount: function(value,name) { + var v = this.getValues(name,true); + if(v == null) { + return 0; + } else { + return v.getValueCount(value); + } + } + ,getItemValues: function() { + return new com_davidmaletz_mining_item__$ItemData_ItemDataIterator(this); + } + ,__class__: com_davidmaletz_mining_item_ItemData +}); +var com_davidmaletz_mining_item__$ItemData_Values = function() { + this.valueMap = new haxe_ds_IntMap(); +}; +$hxClasses["com.davidmaletz.mining.item._ItemData.Values"] = com_davidmaletz_mining_item__$ItemData_Values; +com_davidmaletz_mining_item__$ItemData_Values.__name__ = ["com","davidmaletz","mining","item","_ItemData","Values"]; +com_davidmaletz_mining_item__$ItemData_Values.prototype = { + valueMap: null + ,add: function(count,value) { + var cur = this.valueMap.exists(value) ? this.valueMap.get(value) : 0; + if(count >= 0 || -count < cur) { + this.valueMap.set(value,cur + count); + } else if(-count == cur) { + this.valueMap.remove(value); + } else { + this.valueMap.remove(value); + count = -count - cur; + var k = this.valueMap.keys(); + while(k.hasNext()) { + var k1 = k.next(); + cur = this.valueMap.get(k1); + if(cur > count) { + this.valueMap.set(k1,cur - count); + } else { + this.valueMap.remove(k1); + } + count -= cur; + if(count <= 0) { + break; + } + } + return count; + } + return 0; + } + ,changeValue: function(from,to) { + var ct = this.getValueCount(from); + if(ct > 0) { + if(ct == 1) { + this.valueMap.remove(from); + } else { + this.valueMap.set(from,ct - 1); + } + this.valueMap.set(to,this.getValueCount(to) + 1); + } + } + ,getValueCount: function(value) { + if(this.valueMap.exists(value)) { + return this.valueMap.get(value); + } else { + return 0; + } + } + ,hasDurability: function() { + var k = this.valueMap.keys(); + while(k.hasNext()) { + var k1 = k.next(); + if(k1 != 0 && this.valueMap.get(k1) > 0) { + return true; + } + } + return false; + } + ,hasValue: function() { + var v = this.valueMap.iterator(); + while(v.hasNext()) { + var v1 = v.next(); + if(v1 > 0) { + return true; + } + } + return false; + } + ,write: function(b) { + var k = this.valueMap.keys(); + while(k.hasNext()) { + var k1 = k.next(); + if(k1 >= 0) { + b.writeUInt16(k1); + b.writeUInt16(com_davidmaletz_mining_item_ItemData.clampCount(this.valueMap.get(k1))); + } + } + } + ,__class__: com_davidmaletz_mining_item__$ItemData_Values +}; +var com_davidmaletz_mining_item__$ItemData_ItemDataIterator = function(d) { + this.item = d; + if(this.item.values != null) { + this.valueMap = this.item.values.valueMap; + this.iterator = this.valueMap.keys(); + } + this.current = this.getNext(); +}; +$hxClasses["com.davidmaletz.mining.item._ItemData.ItemDataIterator"] = com_davidmaletz_mining_item__$ItemData_ItemDataIterator; +com_davidmaletz_mining_item__$ItemData_ItemDataIterator.__name__ = ["com","davidmaletz","mining","item","_ItemData","ItemDataIterator"]; +com_davidmaletz_mining_item__$ItemData_ItemDataIterator.prototype = { + item: null + ,current: null + ,name: null + ,values: null + ,valueMap: null + ,iterator: null + ,hasNext: function() { + return this.current != null; + } + ,next: function() { + var c = this.current; + this.current = this.getNext(); + return c; + } + ,getNext: function() { + while(true) { + if(this.iterator != null && this.iterator.hasNext()) { + var k = this.iterator.next(); + return new com_davidmaletz_mining_item_ItemValueCt(this.item.item,this.valueMap.get(k),k,this.name); + } + if(this.values == null) { + if(this.item.nameMap == null) { + return null; + } + this.values = this.item.nameMap.keys(); + } + if(this.values.hasNext()) { + this.name = this.values.next(); + this.valueMap = this.item.nameMap.get(this.name).valueMap; + this.iterator = this.valueMap.keys(); + } else { + return null; + } + } + } + ,__class__: com_davidmaletz_mining_item__$ItemData_ItemDataIterator +}; +var com_davidmaletz_mining_item_EquipmentSlot = function(e,s) { + this.eq = e; + this.slot = s; +}; +$hxClasses["com.davidmaletz.mining.item.EquipmentSlot"] = com_davidmaletz_mining_item_EquipmentSlot; +com_davidmaletz_mining_item_EquipmentSlot.__name__ = ["com","davidmaletz","mining","item","EquipmentSlot"]; +com_davidmaletz_mining_item_EquipmentSlot.__interfaces__ = [com_davidmaletz_mining_item_ItemValue]; +com_davidmaletz_mining_item_EquipmentSlot.prototype = { + eq: null + ,slot: null + ,setName: function(p,n) { + var e = this.eq.getEquipment().getItem(this.slot); + if(e != null) { + e.setName(n); + } + } + ,increaseValue: function(p,dv) { + this.eq.getEquipment().increaseValue(this.eq,this.slot,dv); + } + ,remove: function(p) { + this.eq.getEquipment().unequip(this.slot,this.eq,false); + } + ,getItem: function(p) { + return this.eq.getEquipment().getItem(this.slot); + } + ,__class__: com_davidmaletz_mining_item_EquipmentSlot +}; +var com_davidmaletz_mining_item_InventoryValue = function(i) { + this.item = i; + this.origName = this.item.getNameStr(); +}; +$hxClasses["com.davidmaletz.mining.item.InventoryValue"] = com_davidmaletz_mining_item_InventoryValue; +com_davidmaletz_mining_item_InventoryValue.__name__ = ["com","davidmaletz","mining","item","InventoryValue"]; +com_davidmaletz_mining_item_InventoryValue.__interfaces__ = [com_davidmaletz_mining_item_ItemValue]; +com_davidmaletz_mining_item_InventoryValue.prototype = { + item: null + ,origName: null + ,setName: function(p,n) { + p.inventory.changeName(this.item.info,this.item.value,this.origName,n); + this.item.setName(n); + this.origName = n; + } + ,increaseValue: function(p,dv) { + this.item.increaseValue(p.inventory,dv); + } + ,remove: function(p) { + p.inventory.addItems(this.item.info,-1,this.item.value,this.item.getNameStr()); + } + ,getItem: function(p) { + return this.item; + } + ,__class__: com_davidmaletz_mining_item_InventoryValue +}; +var com_davidmaletz_mining_item_Recipe = function(xml) { + this.id = xml.get("id"); + var c = com_davidmaletz_mining_item_ItemInfo.get(xml.get("creates")); + if(c != null) { + this.creates = new com_davidmaletz_mining_item_ItemValueCt(c,xml.exists("count") ? com_davidmaletz_mining_Main.parseInt(xml.get("count")) : 1,xml.exists("value") ? c.getDurability() - com_davidmaletz_mining_Main.parseInt(xml.get("value")) : 0,com_davidmaletz_mining_item_Recipe.getNameFromXML(xml),true); + } + this.types = []; + if(xml.exists("type")) { + this.types.push(xml.get("type")); + if(xml.exists("available")) { + if(this.available == null) { + this.available = []; + } + this.available.push(xml.get("available")); + } + } + var t = xml.elementsNamed("type"); + while(t.hasNext()) { + var t1 = t.next(); + if(t1.exists("available")) { + if(this.available == null) { + this.available = []; + } + var _g1 = this.available.length; + var _g = this.types.length; + while(_g1 < _g) { + var i = _g1++; + this.available.push(null); + } + this.available.push(t1.get("available")); + } + this.types.push(t1.get("id")); + } + this.requires = []; + this.xml = xml; + this.title = xml.get("title"); + this.icon = xml.get("icon"); + if(xml.exists("fuel")) { + this.fuel = com_davidmaletz_mining_Main.parseInt(xml.get("fuel")); + this.creates = null; + } else { + this.fuel = 0; + } + this.achievement = xml.get("achievement"); + this.object = com_davidmaletz_mining_world_ObjectInfo.get(xml.get("object")); + if(this.object != null) { + if(this.icon == null) { + this.icon = this.object.getDisplayTile(); + } + if(this.title == null) { + this.title = this.object.xml.get("title"); + if(this.title == null) { + this.title = this.object.getDisplayId(); + } + if(this.title != null) { + this.title = com_davidmaletz_mining_npc_NPCEventHandler.evalString(this.title,com_davidmaletz_faengfl_EventHandler.createVariables()); + } + } + } + this.loadRequirements(); + this.description = xml.get("description"); +}; +$hxClasses["com.davidmaletz.mining.item.Recipe"] = com_davidmaletz_mining_item_Recipe; +com_davidmaletz_mining_item_Recipe.__name__ = ["com","davidmaletz","mining","item","Recipe"]; +com_davidmaletz_mining_item_Recipe.__interfaces__ = [com_davidmaletz_mining_ui_InfoItem]; +com_davidmaletz_mining_item_Recipe.getNameFromXML = function(xml,vars) { + var n = xml.get("name"); + if(vars != null && n != null) { + n = com_davidmaletz_mining_npc_NPCEventHandler.evalString(n,vars,"&",StringTools.startsWith(n,"this.")); + } + var p = xml.elementsNamed("parameter"); + while(p.hasNext()) { + var p1 = p.next(); + var v = p1.get("value"); + if(vars != null) { + v = com_davidmaletz_mining_npc_NPCEventHandler.evalString(v,vars,"",true); + } + if(v != null) { + n = com_davidmaletz_mining_item_ItemInfo.setParameter(n,p1.get("id").charAt(0),v); + } + } + return n; +}; +com_davidmaletz_mining_item_Recipe.createFuel = function(i,fuel) { + var r = Type.createEmptyInstance(com_davidmaletz_mining_item_Recipe); + r.id = "fuel_" + i.id; + r.creates = null; + r.achievement = null; + r.fuel = fuel; + r.types = []; + r.requires = []; + r.requires.push(com_davidmaletz_mining_npc_Requirement.createItem(i)); + return r; +}; +com_davidmaletz_mining_item_Recipe.createRepair = function(i,value,name,equip) { + var r = Type.createEmptyInstance(com_davidmaletz_mining_item_Recipe); + r.id = "repair_" + i.id + "_" + value + "_" + name + "_" + (equip == null ? "null" : "" + equip); + r.creates = new com_davidmaletz_mining_item_ItemValueCt(i,1,value,name,true); + r.achievement = null; + r.fuel = equip ? -1 : 1; + r.types = []; + var iter = i.xml.elementPathsNamed("repair"); + r.requires = []; + if(iter.hasNext()) { + r.xml = iter.next(); + r.loadRequirements(); + } else { + r.xml = null; + var i1 = com_davidmaletz_mining_item_ItemInfo.get(i.xml.get("repair")); + if(i1 != null) { + r.requires.push(com_davidmaletz_mining_npc_Requirement.createItem(i1)); + } + } + return r; +}; +com_davidmaletz_mining_item_Recipe.recipes = null; +com_davidmaletz_mining_item_Recipe.recipe_order = null; +com_davidmaletz_mining_item_Recipe.isItem = function(r) { + return r.type == "item"; +}; +com_davidmaletz_mining_item_Recipe.addRecipe = function(r) { + if(com_davidmaletz_mining_item_Recipe.recipes == null) { + com_davidmaletz_mining_item_Recipe.recipes = new haxe_ds_StringMap(); + com_davidmaletz_mining_item_Recipe.recipe_order = []; + } + if(com_davidmaletz_mining_item_Recipe.recipes.exists(r.id)) { + haxe_Log.trace("Overwrite Recipe: " + r.id,{ fileName : "Recipe.hx", lineNumber : 114, className : "com.davidmaletz.mining.item.Recipe", methodName : "addRecipe"}); + HxOverrides.remove(com_davidmaletz_mining_item_Recipe.recipe_order,com_davidmaletz_mining_item_Recipe.recipes.get(r.id)); + } + com_davidmaletz_mining_item_Recipe.recipes.set(r.id,r); + if(r.xml != null && r.xml.get("first") == "true") { + com_davidmaletz_mining_item_Recipe.recipe_order.unshift(r); + } else { + com_davidmaletz_mining_item_Recipe.recipe_order.push(r); + } + if(r.object != null) { + var i = com_davidmaletz_mining_item_ItemInfo.get(r.object.xml.get("item")); + if(i != null) { + var ret = Type.createEmptyInstance(com_davidmaletz_mining_item_Recipe); + ret.id = "!!uncraft_" + r.id; + ret.creates = new com_davidmaletz_mining_item_ItemValueCt(i,1,0,null,true); + ret.achievement = null; + ret.fuel = 0; + ret.types = []; + ret.requires = r.requires.filter(com_davidmaletz_mining_item_Recipe.isItem); + com_davidmaletz_mining_item_Recipe.recipes.set(ret.id,ret); + com_davidmaletz_mining_item_Recipe.recipe_order.push(ret); + } + } +}; +com_davidmaletz_mining_item_Recipe.loadRecipe = function(e) { + com_davidmaletz_mining_item_Recipe.addRecipe(new com_davidmaletz_mining_item_Recipe(e)); +}; +com_davidmaletz_mining_item_Recipe.get = function(id) { + var ret = com_davidmaletz_mining_item_Recipe._get(id); + if(id != null && id.length > 0 && ret == null) { + haxe_Log.trace("No Recipe found: " + id,{ fileName : "Recipe.hx", lineNumber : 126, className : "com.davidmaletz.mining.item.Recipe", methodName : "get"}); + } + return ret; +}; +com_davidmaletz_mining_item_Recipe._get = function(id) { + if(id == null || com_davidmaletz_mining_item_Recipe.recipes == null) { + return null; + } else { + return com_davidmaletz_mining_item_Recipe.recipes.get(id); + } +}; +com_davidmaletz_mining_item_Recipe.exists = function(id) { + if(id != null && com_davidmaletz_mining_item_Recipe.recipes != null) { + return com_davidmaletz_mining_item_Recipe.recipes.exists(id); + } else { + return false; + } +}; +com_davidmaletz_mining_item_Recipe.getByType = function(type,vars,includeObjects) { + if(includeObjects == null) { + includeObjects = true; + } + if(type == null || com_davidmaletz_mining_item_Recipe.recipes == null) { + return null; + } else { + return new com_davidmaletz_mining_item__$Recipe_RecipeTypeIterator(HxOverrides.iter(com_davidmaletz_mining_item_Recipe.recipe_order),type,vars,includeObjects); + } +}; +com_davidmaletz_mining_item_Recipe.getAll = function() { + return HxOverrides.iter(com_davidmaletz_mining_item_Recipe.recipe_order); +}; +com_davidmaletz_mining_item_Recipe.reset = function() { + com_davidmaletz_mining_item_Recipe.recipes = null; + com_davidmaletz_mining_item_Recipe.recipe_order = null; +}; +com_davidmaletz_mining_item_Recipe.fixCreates = function() { + if(com_davidmaletz_mining_item_Recipe.recipes != null) { + var r = com_davidmaletz_mining_item_Recipe.recipes.iterator(); + while(r.hasNext()) { + var r1 = r.next(); + if(r1.creates != null) { + r1.creates.item = com_davidmaletz_mining_item_ItemInfo.get(r1.creates.item.id); + } + } + } +}; +com_davidmaletz_mining_item_Recipe.prototype = { + id: null + ,creates: null + ,fuel: null + ,achievement: null + ,types: null + ,available: null + ,requires: null + ,title: null + ,description: null + ,icon: null + ,xml: null + ,object: null + ,hasType: function(type) { + if(type != null) { + return this.types.indexOf(type) != -1; + } else { + return false; + } + } + ,loadRequirements: function() { + var e = this.xml.xml.elements(); + while(e.hasNext()) { + var e1 = e.next(); + var r = com_davidmaletz_mining_npc_Requirement.fromXML(e1); + if(r != null) { + this.requires.push(r); + } + } + } + ,getRequirementById: function(id) { + var _g = 0; + var _g1 = this.requires; + while(_g < _g1.length) { + var r = _g1[_g]; + ++_g; + if(r.id == id) { + return r; + } + } + return null; + } + ,gainAchievement: function() { + if(this.achievement != null) { + com_davidmaletz_faengfl_achievement_Achievements.instance.gainAchievement(this.achievement); + } + } + ,getFirstRequirement: function() { + if(this.requires.length > 0) { + return this.requires[0].getItem(); + } else { + return null; + } + } + ,getRequirements: function() { + return HxOverrides.iter(this.requires); + } + ,getItemRequirements: function() { + return new com_davidmaletz_mining_item__$Recipe_ItemRequirements(HxOverrides.iter(this.requires)); + } + ,numRequirements: function() { + return this.requires.length; + } + ,isAvailable: function(vars) { + if(!(this.xml == null || !this.xml.exists("available"))) { + return com_davidmaletz_faengfl_EventHandler.execute(this.xml.get("available"),vars) == true; + } else { + return true; + } + } + ,getName: function() { + if(this.title != null) { + return com_fancyfish_faeng_common_Lang.getTextFromTitle(this.title); + } else if(this.creates == null) { + var l; + if(com_davidmaletz_mining_item_Recipe.fuelName == null) { + l = com_fancyfish_faeng_common_Lang.getText("common","fuel"); + } else { + l = com_fancyfish_faeng_common_Lang.getTextFromTitle(com_davidmaletz_mining_item_Recipe.fuelName); + if(l == null) { + l = com_fancyfish_faeng_common_Lang.getText("common",com_davidmaletz_mining_item_Recipe.fuelName); + } + } + return new com_fancyfish_faeng_common_mutable_Concat(l,": " + Std.string(this.fuel)); + } else { + return com_davidmaletz_mining_item_Item._getName(this.creates.item.getName(),this.creates.name); + } + } + ,createIcon: function() { + if(this.icon != null) { + var data = com_davidmaletz_tiles_TileFormattedText.createTileSprite(this.icon); + if(data == null || data.sprite == null) { + return null; + } + var s = data.sprite; + if(data.tile.getHeight() != 10) { + s.set_y(10 - data.tile.getHeight()); + var r = new openfl_display_Sprite(); + r.addChild(s); + s = r; + } + return s; + } else if(this.creates == null) { + return null; + } else { + return this.creates.createIcon(); + } + } + ,getElement: function() { + return null; + } + ,addInfo: function(s,width,x,y) { + if(this.creates != null) { + y = this.creates.item._addInfo(s,width,x,y,this.creates.value,this.creates.name,true); + } + var t = com_fancyfish_faeng_common_Lang.getTextFromTitle(this.description); + if(t != null) { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,width,x,y,t.get(),0.5); + } + return y; + } + ,__class__: com_davidmaletz_mining_item_Recipe +}; +var com_davidmaletz_mining_item__$Recipe_RecipeTypeIterator = function(i,t,vars,incObj) { + this.iterator = i; + this.type = t; + this.vars = vars; + this.includeObjects = incObj; + this.current = this.getNext(); +}; +$hxClasses["com.davidmaletz.mining.item._Recipe.RecipeTypeIterator"] = com_davidmaletz_mining_item__$Recipe_RecipeTypeIterator; +com_davidmaletz_mining_item__$Recipe_RecipeTypeIterator.__name__ = ["com","davidmaletz","mining","item","_Recipe","RecipeTypeIterator"]; +com_davidmaletz_mining_item__$Recipe_RecipeTypeIterator.prototype = { + iterator: null + ,type: null + ,current: null + ,vars: null + ,includeObjects: null + ,hasNext: function() { + return this.current != null; + } + ,next: function() { + var ret = this.current; + this.current = this.getNext(); + return ret; + } + ,getNext: function() { + while(this.iterator.hasNext()) { + var ret = this.iterator.next(); + var i = ret.types.indexOf(this.type); + if(!this.includeObjects && ret.object != null) { + continue; + } + if(i != -1 && (ret.available == null || ret.available.length <= i || ret.available[i] == null || com_davidmaletz_faengfl_EventHandler.execute(ret.available[i],this.vars) == true)) { + return ret; + } + } + return null; + } + ,__class__: com_davidmaletz_mining_item__$Recipe_RecipeTypeIterator +}; +var com_davidmaletz_mining_item__$Recipe_ItemRequirements = function(i) { + this.iterator = i; + this.current = this.getNext(); +}; +$hxClasses["com.davidmaletz.mining.item._Recipe.ItemRequirements"] = com_davidmaletz_mining_item__$Recipe_ItemRequirements; +com_davidmaletz_mining_item__$Recipe_ItemRequirements.__name__ = ["com","davidmaletz","mining","item","_Recipe","ItemRequirements"]; +com_davidmaletz_mining_item__$Recipe_ItemRequirements.prototype = { + iterator: null + ,current: null + ,hasNext: function() { + return this.current != null; + } + ,next: function() { + var ret = this.current; + this.current = this.getNext(); + return ret; + } + ,getNext: function() { + while(this.iterator.hasNext()) { + var r = this.iterator.next(); + var i = r.getItem(); + if(i != null) { + return new com_davidmaletz_mining_item_ItemCt(i,r.count); + } + } + return null; + } + ,__class__: com_davidmaletz_mining_item__$Recipe_ItemRequirements +}; +var com_davidmaletz_mining_item_SmeltItem = function(r) { + this.partial = 0; + openfl_events_EventDispatcher.call(this); + this.recipe = r; + this.fuel_cost = com_davidmaletz_mining_item_SmeltItem.getFuelCost(r); + this.fuel_speed = 25; + if(r.xml != null && r.xml.exists("fuel_speed")) { + this.fuel_speed = com_davidmaletz_mining_Main.parseInt(r.xml.get("fuel_speed")); + } + this.fuel = this.fuel_cost * this.fuel_speed; +}; +$hxClasses["com.davidmaletz.mining.item.SmeltItem"] = com_davidmaletz_mining_item_SmeltItem; +com_davidmaletz_mining_item_SmeltItem.__name__ = ["com","davidmaletz","mining","item","SmeltItem"]; +com_davidmaletz_mining_item_SmeltItem.read = function(b,version) { + var id = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(id == null) { + return null; + } + var r = com_davidmaletz_mining_item_Recipe.get(id); + if(r == null) { + b.readUInt16(); + return null; + } + var ret = new com_davidmaletz_mining_item_SmeltItem(r); + ret.fuel = b.readUInt16(); + return ret; +}; +com_davidmaletz_mining_item_SmeltItem.getFuelCost = function(r) { + if(r.xml != null && r.xml.exists("fuel_cost")) { + return com_davidmaletz_mining_Main.parseInt(r.xml.get("fuel_cost")); + } else { + return 5; + } +}; +com_davidmaletz_mining_item_SmeltItem.__super__ = openfl_events_EventDispatcher; +com_davidmaletz_mining_item_SmeltItem.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + recipe: null + ,fuel: null + ,fuel_cost: null + ,fuel_speed: null + ,getPercent: function() { + return 1 - this.fuel / (this.fuel_cost * this.fuel_speed); + } + ,isComplete: function() { + return this.fuel == 0; + } + ,partial: null + ,tick: function(queue,frames) { + if(this.isComplete()) { + throw new js__$Boot_HaxeError("Cannot smelt a complete action!"); + } + var f = Math.floor(frames); + this.partial += frames - f; + if(this.partial >= 1) { + ++f; + this.partial -= 1; + } + var old = Math.ceil(this.fuel / this.fuel_speed); + this.fuel -= f; + if(this.fuel < 0) { + this.fuel = 0; + } + this.dispatchEvent(new openfl_events_Event("update_percent")); + var n = Math.ceil(this.fuel / this.fuel_speed); + if(n != old && queue.fuelable.getMaxFuel() > 0) { + queue.fuelable.useFuel(old - n); + } + if(this.fuel == 0) { + queue.onComplete(this); + } + } + ,copy: function() { + var ret = new com_davidmaletz_mining_item_SmeltItem(this.recipe); + ret.fuel = this.fuel; + return ret; + } + ,write: function(b) { + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.recipe.id); + b.writeUInt16(this.fuel); + } + ,__class__: com_davidmaletz_mining_item_SmeltItem +}); +var com_davidmaletz_mining_item_SmeltQueue = function(f,craft) { + openfl_events_EventDispatcher.call(this); + this.fuelable = f; + this.craft = craft; + this.queue = new com_davidmaletz_mining_item__$SmeltQueue_RecipeList(); + this.complete = new com_davidmaletz_mining_item__$SmeltQueue_RecipeList(); + this.clear(); +}; +$hxClasses["com.davidmaletz.mining.item.SmeltQueue"] = com_davidmaletz_mining_item_SmeltQueue; +com_davidmaletz_mining_item_SmeltQueue.__name__ = ["com","davidmaletz","mining","item","SmeltQueue"]; +com_davidmaletz_mining_item_SmeltQueue.__super__ = openfl_events_EventDispatcher; +com_davidmaletz_mining_item_SmeltQueue.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + fuelable: null + ,craft: null + ,queue: null + ,current: null + ,complete: null + ,clear: function() { + this.queue.clear(); + this.current = null; + this.complete.clear(); + } + ,isSmelting: function(m) { + if(m == null) { + m = this.fuelable.getMultiplier(); + } + if(m > 0 && (this.fuelable.getMaxFuel() == 0 || this.fuelable.getFuel() > 0) && this.current != null) { + return !this.current.isComplete(); + } else { + return false; + } + } + ,getCount: function(recipe,done) { + return (done == this.craft ? this.complete : this.queue).get(recipe); + } + ,getNext: function() { + var r = this.queue.getLast(); + if(r != null) { + this.current = new com_davidmaletz_mining_item_SmeltItem(r); + this.queue.add(r,-1); + } else { + this.current = null; + } + } + ,onComplete: function(s) { + s.recipe.gainAchievement(); + if(s.recipe.object != null) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + this.fuelable.spawnVehicle(s.recipe); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } else if(s.recipe.xml == null) { + this.complete.add(s.recipe,1); + } else { + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + var map = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(p); + map.set("queue",this); + var e = com_davidmaletz_mining_Main.getEvent("onComplete",p,s.recipe.xml,s.recipe,null,map); + if(e == null) { + this.complete.add(s.recipe,1); + } else { + e.runAll(); + } + } + this.getNext(); + this.dispatchEvent(new com_davidmaletz_faengfl_events_IntEvent("update",1)); + } + ,clearCurrent: function() { + if(this.current != null) { + var r = this.current.recipe; + this.dispatchEvent(new com_davidmaletz_faengfl_events_FloatEvent("progress",1)); + this.getNext(); + this.dispatchEvent(new com_davidmaletz_faengfl_events_IntEvent("update",0)); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("clear_current",r)); + } + } + ,handleTick: function(frames) { + var m = this.fuelable.getMultiplier(); + if(this.isSmelting(m)) { + var c = this.current; + this.current.tick(this,frames * m); + this.dispatchEvent(new com_davidmaletz_faengfl_events_FloatEvent("progress",c.getPercent())); + return true; + } else { + return false; + } + } + ,fireProgress: function() { + var m = this.fuelable.getMultiplier(); + if(this.isSmelting(m)) { + this.dispatchEvent(new com_davidmaletz_faengfl_events_FloatEvent("progress",this.current.getPercent())); + } else { + this.dispatchEvent(new com_davidmaletz_faengfl_events_FloatEvent("progress",1)); + } + } + ,addSmeltItem: function(r,ct) { + if(ct > 0) { + this.queue.add(r,ct); + if(this.current == null) { + this.getNext(); + } + this.dispatchEvent(new com_davidmaletz_faengfl_events_IntEvent("update",0)); + this.dispatchEvent(new com_davidmaletz_mining_item_SmeltEvent("add_items",r,ct,!this.craft)); + } + } + ,clearComplete: function() { + var old = this.complete.map; + this.complete.clear(); + this.dispatchEvent(new com_davidmaletz_faengfl_events_IntEvent("update",0)); + var s = old.keys(); + while(s.hasNext()) { + var s1 = s.next(); + this.dispatchEvent(new com_davidmaletz_mining_item_SmeltEvent("remove_items",com_davidmaletz_mining_item_Recipe.get(s1),old.get(s1),this.craft)); + } + } + ,removeItems: function(r,ct,done) { + var q = done == this.craft ? this.complete : this.queue; + var old = q.get(r); + q.add(r,-ct); + var ct1 = old - q.get(r); + if(ct1 > 0) { + this.dispatchEvent(new com_davidmaletz_faengfl_events_IntEvent("update",0)); + this.dispatchEvent(new com_davidmaletz_mining_item_SmeltEvent("remove_items",r,ct1,done)); + } + return ct1; + } + ,getComplete: function() { + return this.complete.iterator(this.craft); + } + ,getIncomplete: function() { + return this.queue.iterator(!this.craft); + } + ,getCurrent: function() { + return this.current; + } + ,copyFrom: function(q) { + this.current = q.current == null ? null : q.current.copy(); + this.queue.copyFrom(q.queue); + this.complete.copyFrom(q.complete); + } + ,write: function(b) { + this.queue.write(b); + this.complete.write(b); + if(this.current == null) { + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + } else { + this.current.write(b); + } + } + ,read: function(b,version) { + if(version < 39) { + var len = b.readByte() & 255; + var ar = []; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + ar.push(com_davidmaletz_mining_item_SmeltItem.read(b,version)); + } + var c = b.readByte() & 255; + this.queue.clear(); + this.complete.clear(); + if(c >= len) { + c = len; + this.current = null; + } else { + this.current = ar[c]; + } + var _g11 = 0; + var _g2 = c; + while(_g11 < _g2) { + var i1 = _g11++; + this.complete.add(ar[i1].recipe,1); + } + var _g12 = c + 1; + var _g3 = len; + while(_g12 < _g3) { + var i2 = _g12++; + this.queue.add(ar[i2].recipe,1); + } + if(version < 35) { + return b.readUInt16(); + } + } else { + this.queue.read(b); + this.complete.read(b); + this.current = com_davidmaletz_mining_item_SmeltItem.read(b,version); + } + return -1; + } + ,getNextItem: function() { + var ar = []; + var r = this.getComplete(); + while(r.hasNext()) { + var r1 = r.next(); + if(r1.recipe.creates != null) { + ar.push(r1.recipe.creates.item); + } + } + if(ar.length > 0) { + return ar[Math.floor(Math.random() * ar.length)]; + } else { + return null; + } + } + ,__class__: com_davidmaletz_mining_item_SmeltQueue +}); +var com_davidmaletz_mining_item__$SmeltQueue_MapIterator = function(l,c) { + this.list = l; + this.iterator = HxOverrides.iter(this.list.array); + this.complete = c; +}; +$hxClasses["com.davidmaletz.mining.item._SmeltQueue.MapIterator"] = com_davidmaletz_mining_item__$SmeltQueue_MapIterator; +com_davidmaletz_mining_item__$SmeltQueue_MapIterator.__name__ = ["com","davidmaletz","mining","item","_SmeltQueue","MapIterator"]; +com_davidmaletz_mining_item__$SmeltQueue_MapIterator.prototype = { + iterator: null + ,list: null + ,complete: null + ,hasNext: function() { + return this.iterator.hasNext(); + } + ,next: function() { + var r = this.iterator.next(); + return new com_davidmaletz_mining_item_RecipeCount(r,this.list.get(r),this.complete); + } + ,__class__: com_davidmaletz_mining_item__$SmeltQueue_MapIterator +}; +var com_davidmaletz_mining_item_RecipeCount = function(r,ct,c) { + this.recipe = r; + this.count = ct; + this.complete = c; +}; +$hxClasses["com.davidmaletz.mining.item.RecipeCount"] = com_davidmaletz_mining_item_RecipeCount; +com_davidmaletz_mining_item_RecipeCount.__name__ = ["com","davidmaletz","mining","item","RecipeCount"]; +com_davidmaletz_mining_item_RecipeCount.__interfaces__ = [com_davidmaletz_mining_ui_ItemType]; +com_davidmaletz_mining_item_RecipeCount.prototype = { + recipe: null + ,count: null + ,complete: null + ,getName: function() { + return this.recipe.creates.getName(); + } + ,createIcon: function() { + if(this.complete) { + return this.recipe.creates.createIcon(); + } else { + var incomplete = com_davidmaletz_mining_ui_SmeltItemRenderer.incompleteIcon(this.recipe); + var _g = incomplete; + _g.set_x(_g.get_x() + 4); + return incomplete; + } + } + ,getElement: function() { + return this.recipe.creates.getElement(); + } + ,addInfo: function(s,w,x,y) { + return this.recipe.creates.addInfo(s,w,x,y); + } + ,getInfo: function() { + return this.recipe.creates.item; + } + ,__class__: com_davidmaletz_mining_item_RecipeCount +}; +var com_davidmaletz_mining_item__$SmeltQueue_RecipeList = function() { + this.map = new haxe_ds_StringMap(); + this.array = []; +}; +$hxClasses["com.davidmaletz.mining.item._SmeltQueue.RecipeList"] = com_davidmaletz_mining_item__$SmeltQueue_RecipeList; +com_davidmaletz_mining_item__$SmeltQueue_RecipeList.__name__ = ["com","davidmaletz","mining","item","_SmeltQueue","RecipeList"]; +com_davidmaletz_mining_item__$SmeltQueue_RecipeList.prototype = { + map: null + ,array: null + ,clear: function() { + this.map = new haxe_ds_StringMap(); + com_fancyfish_faeng_common_Utils.clear(this.array); + } + ,set: function(recipe,count) { + if(count < 0) { + count = 0; + } + var cur = this.get(recipe); + if(cur != count) { + if(count == 0) { + this.map.remove(recipe.id); + HxOverrides.remove(this.array,recipe); + } else { + this.map.set(recipe.id,count); + if(cur == 0) { + this.array.unshift(recipe); + } + } + return true; + } else { + return false; + } + } + ,add: function(recipe,ct) { + return this.set(recipe,this.get(recipe) + ct); + } + ,get: function(recipe) { + var cur = this.map.get(recipe.id); + if(cur == null) { + return 0; + } else { + return cur; + } + } + ,iterator: function(c) { + return new com_davidmaletz_mining_item__$SmeltQueue_MapIterator(this,c); + } + ,isEmpty: function() { + return this.array.length == 0; + } + ,getLast: function() { + if(this.isEmpty()) { + return null; + } else { + return this.array[this.array.length - 1]; + } + } + ,copyFrom: function(r) { + this.map = com_davidmaletz_tiles_TileMap.copyMap(r.map); + this.array = r.array.slice(); + } + ,write: function(b) { + var _g = 0; + var _g1 = this.array; + while(_g < _g1.length) { + var r = _g1[_g]; + ++_g; + var ct = this.get(r); + if(ct > 65535) { + ct = 65535; + } + b.writeUInt16(ct); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,r.id); + } + b.writeUInt16(0); + } + ,read: function(b) { + this.clear(); + while(true) { + var i = b.readUInt16(); + if(i == 0) { + return; + } + var r = com_davidmaletz_mining_item_Recipe.get(com_fancyfish_faeng_common_UTFUtils.readUTF(b)); + if(r != null) { + this.map.set(r.id,i); + this.array.push(r); + } + } + } + ,__class__: com_davidmaletz_mining_item__$SmeltQueue_RecipeList +}; +var com_davidmaletz_mining_item_SmeltEvent = function(type,r,ct,done) { + openfl_events_Event.call(this,type); + this.recipe = r; + this.count = ct; + this.done = done; +}; +$hxClasses["com.davidmaletz.mining.item.SmeltEvent"] = com_davidmaletz_mining_item_SmeltEvent; +com_davidmaletz_mining_item_SmeltEvent.__name__ = ["com","davidmaletz","mining","item","SmeltEvent"]; +com_davidmaletz_mining_item_SmeltEvent.__super__ = openfl_events_Event; +com_davidmaletz_mining_item_SmeltEvent.prototype = $extend(openfl_events_Event.prototype,{ + recipe: null + ,count: null + ,done: null + ,__class__: com_davidmaletz_mining_item_SmeltEvent +}); +var com_davidmaletz_mining_item_Storage = function(id,inv) { + this.updatingStorage = false; + this.cached_max_value = 0; + this.cached_value = 0; + openfl_events_EventDispatcher.call(this); + this.id = id; + this.inventory = inv; +}; +$hxClasses["com.davidmaletz.mining.item.Storage"] = com_davidmaletz_mining_item_Storage; +com_davidmaletz_mining_item_Storage.__name__ = ["com","davidmaletz","mining","item","Storage"]; +com_davidmaletz_mining_item_Storage.highestDur = function(a,b) { + return b.value - a.value; +}; +com_davidmaletz_mining_item_Storage.lowestDur = function(a,b) { + return a.value - b.value; +}; +com_davidmaletz_mining_item_Storage.__super__ = openfl_events_EventDispatcher; +com_davidmaletz_mining_item_Storage.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + id: null + ,inventory: null + ,cached_value: null + ,cached_max_value: null + ,updatingStorage: null + ,isStorage: function(i) { + return i.xml.get("storage") == this.id; + } + ,update: function() { + if(this.updatingStorage) { + return; + } + this.updatingStorage = true; + var value = 0; + var max = 0; + var i = this.inventory.getItems($bind(this,this.isStorage)); + while(i.hasNext()) { + var i1 = i.next(); + var d = i1.item.getDurability(); + max += d * i1.count; + var v = i1.getItemValues(); + while(v.hasNext()) { + var v1 = v.next(); + value += (d - v1.value) * v1.count; + } + } + if(value != this.cached_value || max != this.cached_max_value) { + this.cached_value = value; + this.cached_max_value = max; + this.dispatchEvent(new openfl_events_Event("updated")); + } + this.updatingStorage = false; + } + ,getPercent: function() { + var max = this.getMaxValue(); + if(max == 0) { + return 0; + } else { + return this.getValue() / max; + } + } + ,getValue: function() { + return this.cached_value; + } + ,getMaxValue: function() { + return this.cached_max_value; + } + ,restoreValue: function(m) { + var max = this.getMaxValue(); + if(max <= 0 || this.getValue() >= max) { + return; + } + this.updatingStorage = true; + var ar = []; + var i = this.inventory.getItems($bind(this,this.isStorage)); + while(i.hasNext()) { + var i1 = i.next(); + var v = i1.getItemValues(); + while(v.hasNext()) { + var v1 = v.next(); + ar.push(v1); + } + } + var _g = 0; + while(_g < ar.length) { + var v2 = ar[_g]; + ++_g; + this.inventory.addItems(v2.item,-v2.count,v2.value,v2.name); + this.inventory.addItems(v2.item,v2.count,0,v2.name); + } + if(m != null) { + new com_davidmaletz_faengfl_ui_Popup(128.,52.,0,m); + } + this.cached_value = max; + this.dispatchEvent(new openfl_events_Event("updated")); + this.updatingStorage = false; + } + ,getLossItems: function() { + var ar = []; + var i = this.inventory.getItems($bind(this,this.isStorage)); + while(i.hasNext()) { + var i1 = i.next(); + var d = i1.item.getDurability(); + var v = i1.getItemValues(); + while(v.hasNext()) { + var v1 = v.next(); + if(v1.value < d) { + ar.push(v1); + } + } + } + ar.sort(com_davidmaletz_mining_item_Storage.highestDur); + return ar; + } + ,loseValue: function(p) { + var max = this.getValue(); + if(p > max) { + p = max; + } + if(p <= 0) { + return false; + } + this.updatingStorage = true; + this.cached_value -= p; + var ar = this.getLossItems(); + var _g = 0; + while(_g < ar.length) { + var v = ar[_g]; + ++_g; + var d = v.item.getDurability(); + var value = d - v.value; + var ct = Math.floor(p / value); + if(ct > v.count) { + ct = v.count; + } + if(ct > 0) { + this.inventory.addItems(v.item,-ct,v.value,v.name); + this.inventory.addItems(v.item,ct,d,v.name); + p -= value * ct; + } + if(p > 0 && ct < v.count) { + this.inventory.addItems(v.item,-1,v.value,v.name); + this.inventory.addItems(v.item,1,v.value + p,v.name); + p = 0; + } + if(p == 0) { + this.dispatchEvent(new openfl_events_Event("updated")); + this.updatingStorage = false; + return true; + } + } + this.updatingStorage = false; + return false; + } + ,getAddItems: function() { + var ar = []; + var i = this.inventory.getItems($bind(this,this.isStorage)); + while(i.hasNext()) { + var i1 = i.next(); + var v = i1.getItemValues(); + while(v.hasNext()) { + var v1 = v.next(); + if(v1.value > 0) { + ar.push(v1); + } + } + } + ar.sort(com_davidmaletz_mining_item_Storage.lowestDur); + return ar; + } + ,addValue: function(p) { + if(p < 0) { + return this.loseValue(-p); + } + var max = this.getMaxValue() - this.getValue(); + if(p > max) { + p = max; + } + if(p <= 0) { + return false; + } + this.updatingStorage = true; + this.cached_value += p; + var ar = this.getAddItems(); + var _g = 0; + while(_g < ar.length) { + var v = ar[_g]; + ++_g; + var value = v.value; + var ct = Math.floor(p / value); + if(ct > v.count) { + ct = v.count; + } + if(ct > 0) { + this.inventory.addItems(v.item,-ct,v.value,v.name); + this.inventory.addItems(v.item,ct,0,v.name); + p -= value * ct; + } + if(p > 0 && ct < v.count) { + this.inventory.addItems(v.item,-1,v.value,v.name); + this.inventory.addItems(v.item,1,v.value - p,v.name); + p = 0; + } + if(p == 0) { + this.dispatchEvent(new openfl_events_Event("updated")); + this.updatingStorage = false; + return true; + } + } + this.updatingStorage = false; + return false; + } + ,__class__: com_davidmaletz_mining_item_Storage +}); +var com_davidmaletz_mining_mods_ModList = function(c) { + var r = new com_davidmaletz_mining_mods__$ModList_ModRenderer(this); + var rows = Math.floor(100 / r.getHeight(null)); + com_davidmaletz_controls_scroll_ScrollWindow.call(this,c,com_davidmaletz_mining_Main.window_factory,r,rows,1,0.1); + var m = com_davidmaletz_faengfl_adv_ModHandler.getMods(); + while(m.hasNext()) { + var m1 = m.next(); + this.addItem(m1); + } + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,com_fancyfish_faeng_common_Lang.getText("common","mods"),this.getWidth(),0,100); + var w = Math.round(r.getWidth()); + this.details = new com_davidmaletz_mining_ui_details_Details(w); + this.details.set_x(243.2 - w); + this.addChild(this.details); +}; +$hxClasses["com.davidmaletz.mining.mods.ModList"] = com_davidmaletz_mining_mods_ModList; +com_davidmaletz_mining_mods_ModList.__name__ = ["com","davidmaletz","mining","mods","ModList"]; +com_davidmaletz_mining_mods_ModList.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_mods_ModList.__super__ = com_davidmaletz_controls_scroll_ScrollWindow; +com_davidmaletz_mining_mods_ModList.prototype = $extend(com_davidmaletz_controls_scroll_ScrollWindow.prototype,{ + details: null + ,init: function(e) { + com_davidmaletz_controls_scroll_ScrollWindow.prototype.init.call(this,e); + com_davidmaletz_faengfl_adv_ModHandler.dispatcher.addEventListener("reload",$bind(this,this.update)); + } + ,destroy: function(e) { + com_davidmaletz_controls_scroll_ScrollWindow.prototype.destroy.call(this,e); + com_davidmaletz_faengfl_adv_ModHandler.dispatcher.removeEventListener("reload",$bind(this,this.update)); + } + ,onSelect: function(slot) { + var e = slot.shouldEnable(); + var ids = [e ? "disable" : "enable"]; + var f = $bind(this,this.enable); + var a1 = slot; + var funcs = [function() { + f(a1); + }]; + if(e && slot.website != null) { + ids.push("visit_website"); + var f1 = $bind(this,this.visitWebsite); + var a11 = slot; + funcs.push(function() { + f1(a11); + }); + } + var tmp = StringTools.startsWith(slot.path,"data/mods/") && slot.name != "Full Version" && e && !slot.error; + if(ids.length == 1) { + funcs[0](); + } else { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_Choice(c,"modio",ids,funcs),2); + } + } + ,setEnabled: function(mod,enabled) { + mod.setEnabled(enabled); + com_davidmaletz_faengfl_adv_ModHandler.reloadData(); + } + ,enable: function(mod) { + var enabled = mod.shouldEnable(); + if(enabled && mod.disableWarning != null) { + var str = StringTools.replace(com_fancyfish_faeng_common_Lang.getText("modio","disable_warning").get(),"{mod}",mod.name) + "\n\n" + mod.disableWarning; + var c = com_davidmaletz_mining_Main.getContainer(); + var f = $bind(this,this.setEnabled); + var a1 = mod; + var tmp = function() { + f(a1,false); + }; + c.addDisplay(new com_davidmaletz_mining_ui_Prompt(c,new com_fancyfish_faeng_common_mutable_Static(str),tmp),2); + } else { + this.setEnabled(mod,!enabled); + } + } + ,visitWebsite: function(mod) { + if(mod.website != null) { + openfl_Lib.getURL(new openfl_net_URLRequest(mod.website),"_blank"); + } + } + ,update: function(e) { + var p = com_davidmaletz_controls_scroll_ScrollList.preSwitch(this.clickables); + var y = this.list.getScrollY(); + this.list.clear(); + var m = com_davidmaletz_faengfl_adv_ModHandler.getMods(); + while(m.hasNext()) { + var m1 = m.next(); + this.addItem(m1); + } + var ht = this.list.getViewportHeight(); + var sht = this.list.getScrollHeight(); + ht = sht - ht; + if(y > ht) { + y = ht; + } + if(y < 0) { + y = 0; + } + if(this.list.getScrollY() == y) { + this.list.scrollbar.update(); + } else { + this.list.updateScroll(y); + } + com_davidmaletz_controls_scroll_ScrollList.postSwitch(this.clickables,p); + } + ,onHover: function(item) { + this.details.setInfo(item == null ? null : new com_davidmaletz_mining_mods__$ModList_ModInfoItem(item)); + this.details.set_y(Math.round((this.getHeight() - this.details.getHeight()) * 0.5)); + } + ,isEnabled: function(item) { + return item.shouldEnable(); + } + ,__class__: com_davidmaletz_mining_mods_ModList +}); +var com_davidmaletz_mining_mods__$ModList_ModRenderer = function(handler) { + this.handler = handler; +}; +$hxClasses["com.davidmaletz.mining.mods._ModList.ModRenderer"] = com_davidmaletz_mining_mods__$ModList_ModRenderer; +com_davidmaletz_mining_mods__$ModList_ModRenderer.__name__ = ["com","davidmaletz","mining","mods","_ModList","ModRenderer"]; +com_davidmaletz_mining_mods__$ModList_ModRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_mods__$ModList_ModRenderer.prototype = { + handler: null + ,create: function(item,x,y) { + return new com_davidmaletz_mining_mods__$ModList_ModButton(this.handler,item,x,y,140,com_davidmaletz_mining_ui_StringRenderer._getHeight()); + } + ,update: function(s,item) { + } + ,getWidth: function() { + return 140; + } + ,getHeight: function(item) { + return com_davidmaletz_mining_ui_StringRenderer._getHeight(); + } + ,__class__: com_davidmaletz_mining_mods__$ModList_ModRenderer +}; +var com_davidmaletz_mining_mods__$ModList_ModButton = function(handler,i,x,y,w,h) { + com_davidmaletz_controls_Button.call(this,x,y,com_davidmaletz_mining_Main.label_factory.createBG(w,h),com_davidmaletz_mining_Main.label_factory.createHover(w,h),null); + this.handler = handler; + this.info = i; + var t = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Static(i.name),new com_fancyfish_faeng_text_CharacterPlacer(0,0),0,1); + t.set_x(2); + t.set_y(Math.round((h - t.lineHeight()) * 0.5)); + t.set_alpha(handler.isEnabled(this.info) ? 1 : 0.5); + com_davidmaletz_faengfl_TextSprite.setColor(t,this.info.error ? 16711680 : 0); + this.addChild(t); +}; +$hxClasses["com.davidmaletz.mining.mods._ModList.ModButton"] = com_davidmaletz_mining_mods__$ModList_ModButton; +com_davidmaletz_mining_mods__$ModList_ModButton.__name__ = ["com","davidmaletz","mining","mods","_ModList","ModButton"]; +com_davidmaletz_mining_mods__$ModList_ModButton.__super__ = com_davidmaletz_controls_Button; +com_davidmaletz_mining_mods__$ModList_ModButton.prototype = $extend(com_davidmaletz_controls_Button.prototype,{ + handler: null + ,info: null + ,onClick: function() { + if(this.handler != null) { + this.handler.onSelect(this.info); + } + return true; + } + ,onHover: function(hover) { + com_davidmaletz_controls_Button.prototype.onHover.call(this,hover); + if(this.handler != null) { + this.handler.onHover(hover ? this.info : null); + } + } + ,__class__: com_davidmaletz_mining_mods__$ModList_ModButton +}); +var com_davidmaletz_mining_mods__$ModList_ModInfoItem = function(m) { + this.mod = m; +}; +$hxClasses["com.davidmaletz.mining.mods._ModList.ModInfoItem"] = com_davidmaletz_mining_mods__$ModList_ModInfoItem; +com_davidmaletz_mining_mods__$ModList_ModInfoItem.__name__ = ["com","davidmaletz","mining","mods","_ModList","ModInfoItem"]; +com_davidmaletz_mining_mods__$ModList_ModInfoItem.__interfaces__ = [com_davidmaletz_mining_ui_InfoItem]; +com_davidmaletz_mining_mods__$ModList_ModInfoItem.prototype = { + mod: null + ,getName: function() { + return new com_fancyfish_faeng_common_mutable_Static(this.mod.name); + } + ,createIcon: function() { + return null; + } + ,getElement: function() { + return null; + } + ,addInfo: function(s,w,x,y) { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,this.mod.author,1,3355443); + y = com_davidmaletz_mining_item_ItemInfo._addLine(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("modio","version"),this.mod.version,true,3355443); + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,this.mod.description); + if(this.mod.requires.length > 0) { + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,com_fancyfish_faeng_common_Lang.getText("quests","requires").get(),1,153); + var _g = 0; + var _g1 = this.mod.requires; + while(_g < _g1.length) { + var r = _g1[_g]; + ++_g; + y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,x,y,r,1,3355443); + } + } + return y; + } + ,__class__: com_davidmaletz_mining_mods__$ModList_ModInfoItem +}; +var com_davidmaletz_mining_ui_AbstractSaveButton = function(x,y) { + var ht = com_davidmaletz_mining_ui_SaveRenderer._getHeight(); + com_davidmaletz_controls_Button.call(this,x,y,com_davidmaletz_mining_Main.label_factory.createBG(130,ht),com_davidmaletz_mining_Main.label_factory.createHover(130,ht),null); +}; +$hxClasses["com.davidmaletz.mining.ui.AbstractSaveButton"] = com_davidmaletz_mining_ui_AbstractSaveButton; +com_davidmaletz_mining_ui_AbstractSaveButton.__name__ = ["com","davidmaletz","mining","ui","AbstractSaveButton"]; +com_davidmaletz_mining_ui_AbstractSaveButton.makeTime = function(s) { + var day = Math.floor(s / 86400); + s -= day * 86400; + var hour = Math.floor(s / 3600); + s -= hour * 3600; + var minute = Math.floor(s / 60); + s -= minute * 60; + return (day > 0 ? day + "d " : "") + com_fancyfish_faeng_common_Utils.twoDigits(hour) + ":" + com_fancyfish_faeng_common_Utils.twoDigits(minute) + ":" + com_fancyfish_faeng_common_Utils.twoDigits(s); +}; +com_davidmaletz_mining_ui_AbstractSaveButton.__super__ = com_davidmaletz_controls_Button; +com_davidmaletz_mining_ui_AbstractSaveButton.prototype = $extend(com_davidmaletz_controls_Button.prototype,{ + setHeader: function(s,header) { + if(typeof(header) == "boolean") { + var t = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("common",header ? "empty_slot" : "corrupt_slot"),new com_fancyfish_faeng_text_CharacterPlacer(130 - com_davidmaletz_tiles_Tile.SIZE * 1.5,1),0,1); + t.set_x(com_davidmaletz_tiles_Tile.SIZE * 1.5); + s.addChild(t); + return; + } + var t1 = new com_davidmaletz_faengfl_TextSprite(com_davidmaletz_mining_world_Area.getName(header.area_name,header.area),new com_fancyfish_faeng_text_CharacterPlacer(130 - com_davidmaletz_tiles_Tile.SIZE * 1.5,1),0,1); + t1.set_x(com_davidmaletz_tiles_Tile.SIZE * 1.5); + s.addChild(t1); + var t2 = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Static(com_davidmaletz_mining_ui_AbstractSaveButton.makeTime(header.time)),new com_fancyfish_faeng_text_CharacterPlacer(130 - com_davidmaletz_tiles_Tile.SIZE * 1.5,1),0,1); + t2.set_x(com_davidmaletz_tiles_Tile.SIZE * 1.5); + t2.set_y(t2.lineHeight()); + s.addChild(t2); + var p = header.player; + if(p != null && p.info != null && com_davidmaletz_faengfl_LayerManager.get(p.getInfo().layers) != null) { + p.change_vanity(null); + var i = new com_davidmaletz_mining_renderer_StaticPlayerRenderer(p,15); + var ei = p.equipment.getItem("weapon"); + var e = ei == null ? p.equipment.getItem("pickaxe") : ei; + if(e != null) { + i.setActive(e.info,e.getName(),e.info.xml.get("slot")); + } + i.set_x(com_davidmaletz_tiles_Tile.SIZE); + i.set_y(com_davidmaletz_mining_ui_SaveRenderer._getHeight() * 0.5); + s.addChild(i); + } + } + ,__class__: com_davidmaletz_mining_ui_AbstractSaveButton +}); +var com_davidmaletz_mining_ui_BaseSaveButton = function(h,i,x,y) { + com_davidmaletz_mining_ui_AbstractSaveButton.call(this,x,y); + this.handler = h; + this.slot = i; + this.inner = new openfl_display_Sprite(); + if(!h.isEnabled(i)) { + this.inner.set_alpha(0.5); + } + this.addChild(this.inner); + this.update(); +}; +$hxClasses["com.davidmaletz.mining.ui.BaseSaveButton"] = com_davidmaletz_mining_ui_BaseSaveButton; +com_davidmaletz_mining_ui_BaseSaveButton.__name__ = ["com","davidmaletz","mining","ui","BaseSaveButton"]; +com_davidmaletz_mining_ui_BaseSaveButton.__super__ = com_davidmaletz_mining_ui_AbstractSaveButton; +com_davidmaletz_mining_ui_BaseSaveButton.prototype = $extend(com_davidmaletz_mining_ui_AbstractSaveButton.prototype,{ + handler: null + ,slot: null + ,inner: null + ,update: function() { + this.setHeader(this.inner,com_davidmaletz_mining_Main.getSlotHeader("slot" + this.slot)); + } + ,onClick: function() { + this.handler.onSelect(this.slot); + return true; + } + ,onHover: function(hover) { + com_davidmaletz_mining_ui_AbstractSaveButton.prototype.onHover.call(this,hover); + this.handler.onHover(hover ? this.slot : null); + } + ,__class__: com_davidmaletz_mining_ui_BaseSaveButton +}); +var com_davidmaletz_mining_network_CloudSaveButton = function(h,i,x,y) { + com_davidmaletz_mining_ui_BaseSaveButton.call(this,h,i,x,y); + this.sync = new openfl_display_Sprite(); + var b = new openfl_display_Bitmap(openfl_Assets.getBitmapData("data/ui/sync.png")); + b.set_x(-b.bitmapData.width * 0.5); + b.set_y(-b.bitmapData.height * 0.5); + this.sync.addChild(b); + this.sync.set_x(2 - b.get_x()); + this.sync.set_y((com_davidmaletz_mining_ui_SaveRenderer._getHeight() - com_davidmaletz_tiles_Tile.SIZE) * 0.5 - b.get_y() + 2); + this.sync.set_alpha(0.75); + this.addChild(this.sync); + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); +}; +$hxClasses["com.davidmaletz.mining.network.CloudSaveButton"] = com_davidmaletz_mining_network_CloudSaveButton; +com_davidmaletz_mining_network_CloudSaveButton.__name__ = ["com","davidmaletz","mining","network","CloudSaveButton"]; +com_davidmaletz_mining_network_CloudSaveButton.__super__ = com_davidmaletz_mining_ui_BaseSaveButton; +com_davidmaletz_mining_network_CloudSaveButton.prototype = $extend(com_davidmaletz_mining_ui_BaseSaveButton.prototype,{ + sync: null + ,init: function(e) { + this.destroy(e); + var s = com_davidmaletz_mining_network_CloudSaves.slots[this.slot]; + s.addEventListener("start_sync",$bind(this,this.startSync)); + s.addEventListener("end_sync",$bind(this,this.endSync)); + this.sync.set_visible(com_davidmaletz_mining_network_CloudSaves.isSlotSyncing(this.slot)); + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.rotate)); + this.updateEnabled(); + } + ,destroy: function(e) { + var s = com_davidmaletz_mining_network_CloudSaves.slots[this.slot]; + s.removeEventListener("start_sync",$bind(this,this.startSync)); + s.removeEventListener("end_sync",$bind(this,this.endSync)); + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.rotate)); + } + ,startSync: function(e) { + this.sync.set_visible(true); + this.updateEnabled(); + } + ,endSync: function(e) { + this.sync.set_visible(false); + if(Std["is"](e,com_davidmaletz_faengfl_events_ObjectEvent)) { + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this.inner); + var o = (js_Boot.__cast(e , com_davidmaletz_faengfl_events_ObjectEvent)).value; + if(o == null || o == "0") { + var t = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("cloud","sync_fail"),new com_fancyfish_faeng_text_CharacterPlacer(130 - com_davidmaletz_tiles_Tile.SIZE,1),16711680,1); + this.inner.set_alpha(1); + t.set_x(com_davidmaletz_tiles_Tile.SIZE); + this.inner.addChild(t); + return; + } + this.update(); + } + this.updateEnabled(); + } + ,rotate: function(e) { + var _g = this.sync; + _g.set_rotation(_g.get_rotation() + 1); + } + ,updateEnabled: function() { + this.inner.set_alpha(this.handler.isEnabled(this.slot) ? 1 : 0.5); + } + ,__class__: com_davidmaletz_mining_network_CloudSaveButton +}); +var com_davidmaletz_mining_ui_BaseSaveList = function(c,label,actions,halign,valign) { + if(valign == null) { + valign = 0.5; + } + if(halign == null) { + halign = 0.5; + } + var r = new com_davidmaletz_mining_ui_SaveRenderer(this,actions ? 56.666666666666664 : 130); + var rows = Math.floor(100 / r.getHeight(null)); + com_davidmaletz_controls_scroll_ScrollWindow.call(this,c,com_davidmaletz_mining_Main.window_factory,r,rows,actions ? 3 : 1,halign,valign); + if(actions) { + this.exportRenderer = new com_davidmaletz_mining_ui__$SaveList_ExportRenderer(); + this.deleteRenderer = new com_davidmaletz_mining_ui__$SaveList_DeleteRenderer(this); + } + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,label,this.getWidth(),0,100); + if(this.addAll() == 0) { + this.addEmpty(); + } +}; +$hxClasses["com.davidmaletz.mining.ui.BaseSaveList"] = com_davidmaletz_mining_ui_BaseSaveList; +com_davidmaletz_mining_ui_BaseSaveList.__name__ = ["com","davidmaletz","mining","ui","BaseSaveList"]; +com_davidmaletz_mining_ui_BaseSaveList.__interfaces__ = [AbstractClass,com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_BaseSaveList.createIconButton = function(x,y,icon,func,enabled) { + var ht = com_davidmaletz_mining_ui_SaveRenderer._getHeight(); + var b = new com_davidmaletz_controls_Button(x,y,com_davidmaletz_mining_Main.label_factory.createBG(20,ht),com_davidmaletz_mining_Main.label_factory.createHover(20,ht),null); + var tile = com_davidmaletz_tiles_Tile.get(icon); + if(tile != null && enabled) { + var s = com_davidmaletz_tiles_Tile.makeIcon(tile); + b.bg = s; + b.addChildAt(s,0); + (js_Boot.__cast(b.hover , openfl_display_Sprite)).addChild(new com_davidmaletz_mining_ui__$SaveList_MyStaticPlayAnimation(tile,icon,10,true)); + } + b.onClickFunc = func; + return b; +}; +com_davidmaletz_mining_ui_BaseSaveList.__super__ = com_davidmaletz_controls_scroll_ScrollWindow; +com_davidmaletz_mining_ui_BaseSaveList.prototype = $extend(com_davidmaletz_controls_scroll_ScrollWindow.prototype,{ + exportRenderer: null + ,deleteRenderer: null + ,onSelect: function(slot) { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,onHover: function(item) { + } + ,isEnabled: function(item) { + return true; + } + ,includeSlot: function(slot) { + return true; + } + ,addEmpty: function() { + } + ,addAll: function() { + var ct = 0; + var _g = 0; + while(_g < 10) { + var i = _g++; + if(this.includeSlot(i)) { + ++ct; + this.addItem(i); + if(this.exportRenderer != null) { + this.list.addMixedItem(i,this.exportRenderer); + } + if(this.deleteRenderer != null) { + this.list.addMixedItem(i,this.deleteRenderer); + } + } + } + return ct; + } + ,update: function() { + var p = com_davidmaletz_controls_scroll_ScrollList.preSwitch(this.clickables); + var y = this.list.getScrollY(); + this.list.clear(); + if(this.addAll() == 0) { + this.addEmpty(); + } + var ht = this.list.getViewportHeight(); + var sht = this.list.getScrollHeight(); + ht = sht - ht; + if(y > ht) { + y = ht; + } + if(y < 0) { + y = 0; + } + if(this.list.getScrollY() == y) { + this.list.scrollbar.update(); + } else { + this.list.updateScroll(y); + } + com_davidmaletz_controls_scroll_ScrollList.postSwitch(this.clickables,p); + } + ,__class__: com_davidmaletz_mining_ui_BaseSaveList +}); +var com_davidmaletz_mining_network_CloudSaveList = function(c,label,actions,halign,valign) { + if(valign == null) { + valign = 0.5; + } + if(halign == null) { + halign = 0.5; + } + com_davidmaletz_mining_ui_BaseSaveList.call(this,c,label,actions,halign,valign); + this.logged_in = new com_fancyfish_faeng_common_mutable_Mutable(); + this.logged_in.set(""); + var w = this.getWidth(); + var c1 = new com_davidmaletz_mining_ui_TextButton(w,this.getHeight() + com_davidmaletz_mining_ui_StringRenderer._getHeight() * 0.5,this.logged_in,$bind(this,this.login),w); + this.clickables.addClickable(c1,this); + c1.set_x(c1.getPos().x = 0); + this.addChild(c1); + this.login_as = new com_fancyfish_faeng_common_mutable_Mutable(); + this.login_as.set(""); + this.tooltip = new com_davidmaletz_faengfl_ui_Tooltip(w * 0.5,this.getHeight(),this.login_as,16777215,0); + var g = this.tooltip.get_graphics(); + g.beginFill(0,1); + g.drawRect(-w,0,w * 2,com_davidmaletz_mining_ui_StringRenderer._getHeight()); + g.endFill(); + this.tooltip.set_scaleX(this.tooltip.set_scaleY(0.5)); + this.addChild(this.tooltip); +}; +$hxClasses["com.davidmaletz.mining.network.CloudSaveList"] = com_davidmaletz_mining_network_CloudSaveList; +com_davidmaletz_mining_network_CloudSaveList.__name__ = ["com","davidmaletz","mining","network","CloudSaveList"]; +com_davidmaletz_mining_network_CloudSaveList.__super__ = com_davidmaletz_mining_ui_BaseSaveList; +com_davidmaletz_mining_network_CloudSaveList.prototype = $extend(com_davidmaletz_mining_ui_BaseSaveList.prototype,{ + logged_in: null + ,tooltip: null + ,login_as: null + ,init: function(e) { + com_davidmaletz_mining_ui_BaseSaveList.prototype.init.call(this,e); + com_davidmaletz_mining_network_CloudSaves.username.addEventListener("updated",$bind(this,this.updateLoggedIn)); + this.updateLoggedIn(null); + } + ,destroy: function(e) { + com_davidmaletz_mining_ui_BaseSaveList.prototype.destroy.call(this,e); + com_davidmaletz_mining_network_CloudSaves.username.removeEventListener("updated",$bind(this,this.updateLoggedIn)); + } + ,isEnabled: function(item) { + return !com_davidmaletz_mining_network_CloudSaves.isSlotSyncing(item); + } + ,login: function() { + if(com_davidmaletz_mining_network_CloudSaves.isLoggedIn()) { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_Prompt(c,com_fancyfish_faeng_common_Lang.getText("cloud","confirm_logout"),com_davidmaletz_mining_network_CloudSaves.logout),2); + } else { + com_davidmaletz_mining_network_CloudSaves.login(); + } + } + ,updateLoggedIn: function(e) { + if(com_davidmaletz_mining_network_CloudSaves.username.get() == null) { + this.logged_in.set(com_fancyfish_faeng_common_Lang.getText("cloud","button_login").get()); + this.login_as.set(com_fancyfish_faeng_common_Lang.getText("cloud","not_logged_in").get()); + com_davidmaletz_faengfl_TextSprite.setColor(this.tooltip,16711680); + } else { + var msg = com_fancyfish_faeng_common_Lang.getText("cloud","logged_in").get(); + this.login_as.set(StringTools.replace(msg,"{username}",com_davidmaletz_mining_network_CloudSaves.username.get())); + com_davidmaletz_faengfl_TextSprite.setColor(this.tooltip,16777215); + this.logged_in.set(com_fancyfish_faeng_common_Lang.getText("cloud","button_logout").get()); + } + } + ,__class__: com_davidmaletz_mining_network_CloudSaveList +}); +var com_davidmaletz_mining_network_CloudSaves = function() { +}; +$hxClasses["com.davidmaletz.mining.network.CloudSaves"] = com_davidmaletz_mining_network_CloudSaves; +com_davidmaletz_mining_network_CloudSaves.__name__ = ["com","davidmaletz","mining","network","CloudSaves"]; +com_davidmaletz_mining_network_CloudSaves.settings = null; +com_davidmaletz_mining_network_CloudSaves.slots = null; +com_davidmaletz_mining_network_CloudSaves.startSettings = null; +com_davidmaletz_mining_network_CloudSaves.md5 = null; +com_davidmaletz_mining_network_CloudSaves.username = null; +com_davidmaletz_mining_network_CloudSaves.password = null; +com_davidmaletz_mining_network_CloudSaves.init = function() { + com_davidmaletz_mining_network_CloudSaves.settings = openfl_net_SharedObject.getLocal("cloudsaves","aground"); + com_davidmaletz_mining_network_CloudSaves.username = new com_fancyfish_faeng_common_mutable_Mutable(); + com_davidmaletz_mining_network_CloudSaves.slots = []; + com_davidmaletz_mining_network_CloudSaves.md5 = []; + var _g = 0; + while(_g < 10) { + var i = _g++; + com_davidmaletz_mining_network_CloudSaves.slots.push(new openfl_events_EventDispatcher()); + com_davidmaletz_mining_network_CloudSaves.md5.push(null); + } + com_davidmaletz_mining_network_CloudSaves.md5.push(null); + var name = Reflect.field(com_davidmaletz_mining_network_CloudSaves.settings.data,"name"); + var pass = Reflect.field(com_davidmaletz_mining_network_CloudSaves.settings.data,"pass"); + com_davidmaletz_mining_network_CloudSaves.startSettings = com_davidmaletz_mining_network_CloudSaves.getSettings(); + if(name != null && pass != null) { + com_davidmaletz_mining_network_CloudSaves.doLogin(name,pass); + } + var func = com_davidmaletz_mining_network_CloudSaves.checkExit; + window.addEventListener('beforeunload', func); +}; +com_davidmaletz_mining_network_CloudSaves.checkExit = function(evt) { + com_davidmaletz_mining_network_CloudSaves.syncAll(true); + if(!com_davidmaletz_mining_network_CloudSaves.isSyncing()) { + return; + } + com_davidmaletz_mining_Main.closeWindows(function() { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_network_SyncList(c),2); + }); + var msg = com_fancyfish_faeng_common_Lang.getText("cloud","close_syncing").get(); + if(typeof evt == 'undefined') evt = window.event; if(evt) evt.returnValue = msg; + return msg; +}; +com_davidmaletz_mining_network_CloudSaves.syncAll = function(async) { + if(!com_davidmaletz_mining_network_CloudSaves.isLoggedIn()) { + return; + } + var data; + var s = com_davidmaletz_mining_network_CloudSaves.getSettings(); + if(s != com_davidmaletz_mining_network_CloudSaves.startSettings) { + Reflect.setField(com_davidmaletz_mining_network_CloudSaves.settings.data,"settings",com_davidmaletz_mining_network_CloudSaves.getNow()); + com_davidmaletz_mining_network_CloudSaves.settings.flush(); + com_davidmaletz_mining_network_CloudSaves.sync.set(-1,true); + com_davidmaletz_mining_network_CloudSaves.startSettings = s; + } + var i = com_davidmaletz_mining_network_CloudSaves.sync.keys(); + while(i.hasNext()) { + var i1 = i.next(); + var data1 = com_davidmaletz_mining_network_CloudSaves.exportSlot(i1); + if(data1 == null) { + if(async) { + com_davidmaletz_mining_network_CloudSaves.deleteSave(i1); + } else { + haxe_Log.trace("delete_save.php?slot=" + i1,{ fileName : "CloudSaves.hx", lineNumber : 67, className : "com.davidmaletz.mining.network.CloudSaves", methodName : "syncAll"}); + com_davidmaletz_mining_network_CloudSaves.sendC("delete_save.php?slot=" + i1,null,null,false); + } + continue; + } + var md5 = haxe_crypto_Md5.encode(data1); + var extra = ""; + if(com_davidmaletz_mining_network_CloudSaves.md5[i1 + 1] != md5) { + if(async) { + com_davidmaletz_mining_network_CloudSaves.uploadSave(i1,data1,md5,extra); + } else { + haxe_Log.trace("upload_save.php?slot=" + i1,{ fileName : "CloudSaves.hx", lineNumber : 74, className : "com.davidmaletz.mining.network.CloudSaves", methodName : "syncAll"}); + com_davidmaletz_mining_network_CloudSaves.sendC("upload_save.php?slot=" + i1 + "&md5=" + md5 + extra,null,data1,false); + } + } + } + com_davidmaletz_mining_network_CloudSaves.sync = new haxe_ds_IntMap(); + com_davidmaletz_mining_network_CloudSaves.dispatcher.dispatchEvent(new openfl_events_Event("needs_sync")); +}; +com_davidmaletz_mining_network_CloudSaves.login = function() { + if(!com_davidmaletz_mining_network_CloudSaves.is_logging_in) { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_network_LoginWindow(c,com_fancyfish_faeng_common_Lang.getText("cloud","login").get(),com_davidmaletz_mining_network_CloudSaves.modalLogin),2); + } else { + new com_davidmaletz_faengfl_ui_Popup(128.,72.,0,com_fancyfish_faeng_common_Lang.getText("cloud","logging_in")); + } +}; +com_davidmaletz_mining_network_CloudSaves.modalLogin = function(name,pass,remember) { + if(remember) { + Reflect.setField(com_davidmaletz_mining_network_CloudSaves.settings.data,"name",name); + Reflect.setField(com_davidmaletz_mining_network_CloudSaves.settings.data,"pass",pass); + com_davidmaletz_mining_network_CloudSaves.settings.flush(); + } + var modal = new com_davidmaletz_faengfl_transition_Block(); + var t = new com_davidmaletz_faengfl_ui_Tooltip(128.,72.,com_fancyfish_faeng_common_Lang.getText("cloud","logging_in")); + t.show(); + var a1 = modal; + var t1 = t; + com_davidmaletz_mining_network_CloudSaves.doLogin(name,pass,function(a2,a3,a4) { + com_davidmaletz_mining_network_CloudSaves._modalLogin(a1,t1,a2,a3,a4); + }); +}; +com_davidmaletz_mining_network_CloudSaves._modalLogin = function(modal,t,name,pass,response) { + modal.remove(); + var d = t; + var tmp = function() { + com_davidmaletz_faengfl_FaengFL.remove(d); + }; + t.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),10,tmp); + com_davidmaletz_mining_network_CloudSaves._login(name,pass,response); +}; +com_davidmaletz_mining_network_CloudSaves.doLogin = function(name,pass,func) { + com_davidmaletz_mining_network_CloudSaves.is_logging_in = true; + if(func == null) { + func = com_davidmaletz_mining_network_CloudSaves._login; + } + var f = func; + var a1 = name; + var a2 = pass; + var tmp = function(a3) { + f(a1,a2,a3); + }; + com_davidmaletz_mining_network_CloudSaves.send("https://fancyfishgames.com/Aground/cloud/1/" + "login.php?user=" + StringTools.urlEncode(name) + "&pass=" + haxe_crypto_Md5.encode(pass),tmp,null); +}; +com_davidmaletz_mining_network_CloudSaves._login = function(name,pass,response) { + com_davidmaletz_mining_network_CloudSaves.is_logging_in = false; + if(response == null || !StringTools.startsWith(response,"1")) { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_DialogueBox(c,(response == "0" ? com_fancyfish_faeng_common_Lang.getText("cloud","login_fail") : com_fancyfish_faeng_common_Lang.getText("cloud","connect_fail")).get()),2); + if(response == "0") { + com_davidmaletz_mining_network_CloudSaves._logout(); + } + return; + } + com_davidmaletz_mining_network_CloudSaves.username.set(name); + com_davidmaletz_mining_network_CloudSaves.password = haxe_crypto_Md5.encode(pass); + com_davidmaletz_mining_network_CloudSaves.doSync(response == "1" ? "" : HxOverrides.substr(response,2,null)); +}; +com_davidmaletz_mining_network_CloudSaves.isLoggedIn = function() { + return com_davidmaletz_mining_network_CloudSaves.username.get() != null; +}; +com_davidmaletz_mining_network_CloudSaves.logout = function() { + if(com_davidmaletz_mining_network_CloudSaves.isLoggedIn()) { + com_davidmaletz_mining_network_CloudSaves._logout(); + var _g = 0; + var _g1 = com_davidmaletz_mining_network_CloudSaves.slots; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + s.dispatchEvent(new openfl_events_Event("end_sync")); + } + } +}; +com_davidmaletz_mining_network_CloudSaves._logout = function() { + com_davidmaletz_mining_network_CloudSaves.username.set(null); + com_davidmaletz_mining_network_CloudSaves.password = null; + Reflect.setField(com_davidmaletz_mining_network_CloudSaves.settings.data,"name",null); + Reflect.setField(com_davidmaletz_mining_network_CloudSaves.settings.data,"pass",null); + com_davidmaletz_mining_network_CloudSaves.settings.flush(); +}; +com_davidmaletz_mining_network_CloudSaves.getNow = function() { + return Math.round(new Date().getTime() / 1000); +}; +com_davidmaletz_mining_network_CloudSaves.updateSlot = function(slot,data) { + Reflect.setField(com_davidmaletz_mining_network_CloudSaves.settings.data,slot,com_davidmaletz_mining_network_CloudSaves.getNow()); + com_davidmaletz_mining_network_CloudSaves.settings.flush(); + com_davidmaletz_mining_network_CloudSaves.setSync(com_davidmaletz_mining_Main.idToSlot(slot)); +}; +com_davidmaletz_mining_network_CloudSaves.compare = function(id,md5,time,data) { + if(data == null) { + return -1; + } + if(haxe_crypto_Md5.encode(data) == md5) { + return 0; + } + var t = Reflect.field(com_davidmaletz_mining_network_CloudSaves.settings.data,id == -1 ? "settings" : com_davidmaletz_mining_Main.slotToId(id)); + if(t == null || t < time) { + return -1; + } else { + return 1; + } +}; +com_davidmaletz_mining_network_CloudSaves.instance = null; +com_davidmaletz_mining_network_CloudSaves.getInstance = function() { + if(com_davidmaletz_mining_network_CloudSaves.instance == null) { + com_davidmaletz_mining_network_CloudSaves.instance = new com_davidmaletz_mining_network_CloudSaves(); + } + return com_davidmaletz_mining_network_CloudSaves.instance; +}; +com_davidmaletz_mining_network_CloudSaves.isSyncing = function() { + if(com_davidmaletz_mining_network_CloudSaves.instance != null && com_davidmaletz_mining_network_CloudSaves.instance.queue != null) { + return com_davidmaletz_mining_network_CloudSaves.instance.queue.size() > 0; + } else { + return false; + } +}; +com_davidmaletz_mining_network_CloudSaves.isSlotSyncing = function(slot) { + if(com_davidmaletz_mining_network_CloudSaves.instance == null || com_davidmaletz_mining_network_CloudSaves.instance.queue == null) { + return false; + } + var s = "slot=" + slot; + var r = com_davidmaletz_mining_network_CloudSaves.instance.queue.iterator(); + while(r.hasNext()) { + var r1 = r.next(); + if(r1.url.indexOf(s) != -1) { + return true; + } + } + return false; +}; +com_davidmaletz_mining_network_CloudSaves.doSync = function(str) { + var s = com_davidmaletz_mining_network_CloudSaves.getSettings(); + if(s != com_davidmaletz_mining_network_CloudSaves.startSettings) { + Reflect.setField(com_davidmaletz_mining_network_CloudSaves.settings.data,"settings",com_davidmaletz_mining_network_CloudSaves.getNow()); + com_davidmaletz_mining_network_CloudSaves.settings.flush(); + com_davidmaletz_mining_network_CloudSaves.startSettings = s; + } + var len = com_davidmaletz_mining_network_CloudSaves.md5.length; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + com_davidmaletz_mining_network_CloudSaves.md5[i] = null; + } + var ar = str.split("\n"); + var bools = com_fancyfish_faeng_common_Bitmask.create(false); + var _g2 = 0; + while(_g2 < ar.length) { + var s1 = ar[_g2]; + ++_g2; + if(s1.length == 0) { + continue; + } + var values = s1.split(":"); + var id = com_davidmaletz_mining_Main.parseInt(values[0]); + bools = com_fancyfish_faeng_common_Bitmask.setTrue(bools,id + 1); + var md5 = values[1]; + var time = com_davidmaletz_mining_Main.parseInt(values[2]); + com_davidmaletz_mining_network_CloudSaves.md5[id + 1] = md5; + var res = com_davidmaletz_mining_network_CloudSaves.compare(id,md5,time,com_davidmaletz_mining_network_CloudSaves.exportSlot(id)); + if(res == -1) { + com_davidmaletz_mining_network_CloudSaves.downloadSave(id,md5); + } else if(res == 1) { + com_davidmaletz_mining_network_CloudSaves.setSync(id); + } + } + var _g3 = -1; + while(_g3 < 10) { + var i1 = _g3++; + if(!com_fancyfish_faeng_common_Bitmask.get(bools,i1 + 1) && com_davidmaletz_mining_network_CloudSaves.exportSlot(i1) != null) { + com_davidmaletz_mining_network_CloudSaves.setSync(i1); + } + } +}; +com_davidmaletz_mining_network_CloudSaves.setSync = function(id) { + com_davidmaletz_mining_network_CloudSaves.sync.set(id,true); + com_davidmaletz_mining_network_CloudSaves.dispatcher.dispatchEvent(new openfl_events_Event("needs_sync")); +}; +com_davidmaletz_mining_network_CloudSaves.needsSync = function() { + return com_davidmaletz_mining_network_CloudSaves.sync.keys().hasNext(); +}; +com_davidmaletz_mining_network_CloudSaves.downloadSave = function(id,md5) { + var a1 = id; + var a2 = md5; + var tmp = function(a3) { + com_davidmaletz_mining_network_CloudSaves.getSave(a1,a2,a3); + }; + com_davidmaletz_mining_network_CloudSaves.getInstance().enqueue("download_save.php?slot=" + id,tmp); + if(id >= 0) { + com_davidmaletz_mining_network_CloudSaves.slots[id].dispatchEvent(new openfl_events_Event("start_sync")); + } + com_davidmaletz_mining_network_CloudSaves.instance.processQueue(); +}; +com_davidmaletz_mining_network_CloudSaves.getSave = function(slot,md5,value) { + if(md5 != haxe_crypto_Md5.encode(value)) { + value = null; + } + if(value != null && value != "0") { + com_davidmaletz_mining_network_CloudSaves.setSlot(slot,value); + } + if(slot >= 0) { + com_davidmaletz_mining_network_CloudSaves.slots[slot].dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("end_sync",value)); + } +}; +com_davidmaletz_mining_network_CloudSaves.uploadSave = function(id,data,md5,extra) { + if(data != null) { + var a1 = id; + var tmp = function(a2) { + com_davidmaletz_mining_network_CloudSaves.uploadComplete(a1,a2); + }; + com_davidmaletz_mining_network_CloudSaves.getInstance().enqueue("upload_save.php?slot=" + id + "&md5=" + md5 + extra,tmp,data); + if(id >= 0) { + com_davidmaletz_mining_network_CloudSaves.slots[id].dispatchEvent(new openfl_events_Event("start_sync")); + } + com_davidmaletz_mining_network_CloudSaves.instance.processQueue(); + } +}; +com_davidmaletz_mining_network_CloudSaves.deleteSave = function(id) { + var a1 = id; + var tmp = function(a2) { + com_davidmaletz_mining_network_CloudSaves.uploadComplete(a1,a2); + }; + com_davidmaletz_mining_network_CloudSaves.getInstance().enqueue("delete_save.php?slot=" + id,tmp); + if(id >= 0) { + com_davidmaletz_mining_network_CloudSaves.slots[id].dispatchEvent(new openfl_events_Event("start_sync")); + } + com_davidmaletz_mining_network_CloudSaves.instance.processQueue(); +}; +com_davidmaletz_mining_network_CloudSaves.uploadComplete = function(slot,value) { + if(slot >= 0) { + com_davidmaletz_mining_network_CloudSaves.slots[slot].dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("end_sync",value)); + } +}; +com_davidmaletz_mining_network_CloudSaves.setSlot = function(slot,value) { + if(slot < 0) { + try { + com_davidmaletz_mining_Main.updateSettings(new haxe_Unserializer(value).unserialize()); + com_davidmaletz_mining_network_CloudSaves.startSettings = value; + } catch( e ) { + haxe_CallStack.lastException = e; + } + } else { + var save = com_davidmaletz_mining_Main.importSlot(value); + if(save != null) { + var id = com_davidmaletz_mining_Main.slotToId(slot); + var old = com_davidmaletz_mining_Main.getSlotHeader(id); + if(typeof(old) != "boolean" && old.time > save.header.time) { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_network_OverwriteSlot(c,id,old,save.header,save.data),2); + } else { + com_davidmaletz_mining_Main.setSlot(id,save.data,false); + } + } + } +}; +com_davidmaletz_mining_network_CloudSaves.getSettings = function() { + return haxe_Serializer.run(com_davidmaletz_faengfl_adv_AdvApp.settings.data); +}; +com_davidmaletz_mining_network_CloudSaves.exportSlot = function(id) { + if(id < 0) { + return com_davidmaletz_mining_network_CloudSaves.getSettings(); + } else { + return com_davidmaletz_mining_Main.exportSlot(com_davidmaletz_mining_Main.slotToId(id)); + } +}; +com_davidmaletz_mining_network_CloudSaves.isCurrentSlot = function(r) { + var s = com_davidmaletz_mining_Main.slot; + if(s != null && com_davidmaletz_mining_Main.getLocalPlayer() != null) { + return r.url == "download_save.php?slot=" + com_davidmaletz_mining_Main.idToSlot(s); + } else { + return false; + } +}; +com_davidmaletz_mining_network_CloudSaves.empty = function(s) { +}; +com_davidmaletz_mining_network_CloudSaves.sendC = function(url,func,data,async) { + if(async == null) { + async = true; + } + var name = com_davidmaletz_mining_network_CloudSaves.username.get(); + if(name != null) { + com_davidmaletz_mining_network_CloudSaves.send("https://fancyfishgames.com/Aground/cloud/1/" + url + "&user=" + StringTools.urlEncode(name) + "&pass=" + com_davidmaletz_mining_network_CloudSaves.password,func,data,async); + } +}; +com_davidmaletz_mining_network_CloudSaves.send = function(url,func,data,async) { + if(async == null) { + async = true; + } + var req = new haxe_Http(url); + req.onData = function(data1) { + if(data1 == "0") { + haxe_Log.trace("Request failed: '" + url + "'",{ fileName : "CloudSaves.hx", lineNumber : 216, className : "com.davidmaletz.mining.network.CloudSaves", methodName : "send"}); + } + req.onData = com_davidmaletz_mining_network_CloudSaves.empty; + req.onError = com_davidmaletz_mining_network_CloudSaves.empty; + if(func != null) { + func(data1); + } + }; + req.onError = function(msg) { + req.onData = com_davidmaletz_mining_network_CloudSaves.empty; + req.onError = com_davidmaletz_mining_network_CloudSaves.empty; + if(func != null) { + func(null); + } + haxe_Log.trace("Unable to send request '" + url + "': " + msg,{ fileName : "CloudSaves.hx", lineNumber : 219, className : "com.davidmaletz.mining.network.CloudSaves", methodName : "send"}); + }; + if(data != null) { + req.setPostData(data); + } + if(async) { + com_fancyfish_faeng_common_HttpAsync.send(req,data != null); + } else { + req.async = false; + req.request(data != null); + } +}; +com_davidmaletz_mining_network_CloudSaves.prototype = { + queue: null + ,enqueue: function(url,func,data) { + if(this.queue == null) { + this.queue = new com_fancyfish_faeng_common_Dequeue(); + } else { + var r = this.queue.iterator(); + while(r.hasNext()) { + var r1 = r.next(); + if(r1.url == url) { + r1.data = data; + return; + } + } + } + this.queue.addLast(new com_davidmaletz_mining_network__$CloudSaves_Request(url,func,data)); + } + ,processQueue: function() { + if(this.queue.size() == 1) { + this.handleNext(); + } + } + ,handleNext: function() { + if(!com_davidmaletz_mining_network_CloudSaves.isLoggedIn()) { + this.queue.clear(); + return; + } + if(!this.queue.isEmpty()) { + var r = this.queue.getFirst(); + if(com_davidmaletz_mining_network_CloudSaves.isCurrentSlot(r)) { + this._handleNext(null); + } else { + haxe_Log.trace(r.url,{ fileName : "CloudSaves.hx", lineNumber : 192, className : "com.davidmaletz.mining.network.CloudSaves", methodName : "handleNext"}); + com_davidmaletz_mining_network_CloudSaves.sendC(r.url,$bind(this,this._handleNext),r.data); + } + } + } + ,_handleNext: function(str) { + if(this.queue.isEmpty()) { + return; + } + var r = this.queue.removeFirst(); + var sz = this.queue.size(); + if(r.onComplete != null) { + if(com_davidmaletz_mining_network_CloudSaves.isCurrentSlot(r)) { + str = null; + } + r.onComplete(str); + } + if(sz != 0) { + this.handleNext(); + } + } + ,__class__: com_davidmaletz_mining_network_CloudSaves +}; +var com_davidmaletz_mining_network__$CloudSaves_Request = function(url,func,data) { + this.url = url; + this.data = data; + this.onComplete = func; +}; +$hxClasses["com.davidmaletz.mining.network._CloudSaves.Request"] = com_davidmaletz_mining_network__$CloudSaves_Request; +com_davidmaletz_mining_network__$CloudSaves_Request.__name__ = ["com","davidmaletz","mining","network","_CloudSaves","Request"]; +com_davidmaletz_mining_network__$CloudSaves_Request.prototype = { + url: null + ,data: null + ,onComplete: null + ,__class__: com_davidmaletz_mining_network__$CloudSaves_Request +}; +var com_davidmaletz_mining_network_LoginWindow = function(c,str,onLogin) { + var t = new com_davidmaletz_mining_ui_MyFormattedText(172,true,str,1); + var y = t.bounds.height * t.get_scaleY() + 8; + com_davidmaletz_controls_ClickableWindow.call(this,c,com_davidmaletz_mining_Main.window_factory.create(180,y + com_davidmaletz_mining_ui_TextButton.getHeight() + 20 + 24 + com_davidmaletz_mining_ui_Checkbox.getHeight())); + t.set_x(4); + t.set_y(4); + this.addChild(t); + var text_w = 120; + var _x = 176 - text_w - 1; + var t1 = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("cloud","username"),new com_fancyfish_faeng_text_CharacterPlacer(0,2),0,1); + t1.set_x(_x - 4); + t1.set_y(y); + this.addChild(t1); + this.addChild(new com_davidmaletz_faengfl_SolidDrawable(16777215,text_w + 2,12,1).create(_x - 1,y)); + this.text = new com_davidmaletz_faengfl_ui_TextField(c,text_w,"",0,1,0,16777215,null,24); + this.text.set_x(_x); + this.text.set_y(y + 1); + this.addChild(this.text); + y += 16; + this.text.addEventListener("action",$bind(this,this.toName)); + var t2 = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("cloud","password"),new com_fancyfish_faeng_text_CharacterPlacer(0,2),0,1); + t2.set_x(_x - 4); + t2.set_y(y); + this.addChild(t2); + this.addChild(new com_davidmaletz_faengfl_SolidDrawable(16777215,text_w + 2,12,1).create(_x - 1,y)); + this.pass = new com_davidmaletz_faengfl_ui_PasswordField(c,text_w,"",0,1,0,16777215,null,40); + this.pass.set_x(_x); + this.pass.set_y(y + 1); + this.addChild(this.pass); + y += 16; + this.pass.addEventListener("action",$bind(this,this._confirm)); + this.remember = new com_davidmaletz_mining_ui_Checkbox(4,y,com_fancyfish_faeng_common_Lang.getText("cloud","remember"),172,true); + this.addClickable(this.remember); + y += com_davidmaletz_mining_ui_Checkbox.getHeight() + 4; + this.onLogin = onLogin; + this.clickables.allowLoop = false; + var b = new com_davidmaletz_mining_ui_TextButton(4,y,com_fancyfish_faeng_common_Lang.getText("common","ok"),$bind(this,this.confirm)); + this.addClickable(b); + this.addClickable(new com_davidmaletz_mining_ui_TextButton(4 + b.getPos().get_right(),y,com_fancyfish_faeng_common_Lang.getText("cloud","create"),$bind(this,this.create),80)); + this.addClickable(new com_davidmaletz_mining_ui_TextButton(this.get_width() - 4 - 40,y,com_fancyfish_faeng_common_Lang.getText("common","cancel"),$bind(this,this.close))); +}; +$hxClasses["com.davidmaletz.mining.network.LoginWindow"] = com_davidmaletz_mining_network_LoginWindow; +com_davidmaletz_mining_network_LoginWindow.__name__ = ["com","davidmaletz","mining","network","LoginWindow"]; +com_davidmaletz_mining_network_LoginWindow.__super__ = com_davidmaletz_controls_ClickableWindow; +com_davidmaletz_mining_network_LoginWindow.prototype = $extend(com_davidmaletz_controls_ClickableWindow.prototype,{ + onLogin: null + ,text: null + ,pass: null + ,remember: null + ,onOpened: function() { + com_davidmaletz_faengfl_Application.setFocus(this.text); + this.text.selectAll(); + } + ,check: function(name,pass) { + if(name.length == 0) { + this.close(); + return false; + } + if(name.length < 3 || name.length > 24) { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_DialogueBox(c,com_fancyfish_faeng_common_Lang.getText("cloud","user_error").get()),2); + return false; + } + if(pass.length < 3 || pass.length > 40) { + var c1 = com_davidmaletz_mining_Main.getContainer(); + c1.addDisplay(new com_davidmaletz_mining_ui_DialogueBox(c1,com_fancyfish_faeng_common_Lang.getText("cloud","pass_error").get()),2); + return false; + } + return true; + } + ,confirm: function() { + var name = this.text.getText(); + var pass = this.pass.getText(); + if(!this.check(name,pass)) { + return; + } + if(this.onLogin != null) { + this.onLogin(name,pass,this.remember.isChecked()); + this.onLogin = null; + } + this.close(); + } + ,_confirm: function(e) { + this.confirm(); + } + ,create: function() { + openfl_Lib.getURL(new openfl_net_URLRequest("https://fancyfishgames.com/Aground/CreateAccount.php"),"_blank"); + } + ,toName: function(e) { + com_davidmaletz_faengfl_Application.setFocus(this.pass); + this.pass.selectAll(); + } + ,__class__: com_davidmaletz_mining_network_LoginWindow +}); +var com_davidmaletz_mining_network_OverwriteSlot = function(c,slot,old_h,new_h,data) { + com_davidmaletz_controls_ListWindow.call(this,c,com_davidmaletz_mining_Main.window_factory,new com_davidmaletz_mining_network_StaticSaveRenderer(this),2,1); + this.slot = slot; + this.header = new_h; + this.data = data; + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,com_fancyfish_faeng_common_Lang.getText("cloud","overwrite"),this.getWidth(),0,180,26); + this.addItem(new_h); + this.addItem(old_h); +}; +$hxClasses["com.davidmaletz.mining.network.OverwriteSlot"] = com_davidmaletz_mining_network_OverwriteSlot; +com_davidmaletz_mining_network_OverwriteSlot.__name__ = ["com","davidmaletz","mining","network","OverwriteSlot"]; +com_davidmaletz_mining_network_OverwriteSlot.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_network_OverwriteSlot.__super__ = com_davidmaletz_controls_ListWindow; +com_davidmaletz_mining_network_OverwriteSlot.prototype = $extend(com_davidmaletz_controls_ListWindow.prototype,{ + slot: null + ,header: null + ,data: null + ,onSelect: function(item) { + if(this.header == item) { + com_davidmaletz_mining_Main.setSlot(this.slot,this.data,false); + } else { + com_davidmaletz_mining_network_CloudSaves.updateSlot(this.slot,this.data); + } + this.close(); + } + ,onHover: function(item) { + } + ,isEnabled: function(item) { + return true; + } + ,__class__: com_davidmaletz_mining_network_OverwriteSlot +}); +var com_davidmaletz_mining_network_StaticSaveRenderer = function(handler) { + this.handler = handler; +}; +$hxClasses["com.davidmaletz.mining.network.StaticSaveRenderer"] = com_davidmaletz_mining_network_StaticSaveRenderer; +com_davidmaletz_mining_network_StaticSaveRenderer.__name__ = ["com","davidmaletz","mining","network","StaticSaveRenderer"]; +com_davidmaletz_mining_network_StaticSaveRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_network_StaticSaveRenderer.prototype = { + handler: null + ,create: function(item,x,y) { + return new com_davidmaletz_mining_network__$StaticSaveRenderer_SaveButton(this.handler,item,x,y); + } + ,update: function(s,item) { + } + ,getWidth: function() { + return 130; + } + ,getHeight: function(item) { + return com_davidmaletz_mining_ui_SaveRenderer._getHeight(); + } + ,__class__: com_davidmaletz_mining_network_StaticSaveRenderer +}; +var com_davidmaletz_mining_network__$StaticSaveRenderer_SaveButton = function(h,header,x,y) { + com_davidmaletz_mining_ui_AbstractSaveButton.call(this,x,y); + this.handler = h; + this.header = header; + this.inner = new openfl_display_Sprite(); + if(!h.isEnabled(header)) { + this.inner.set_alpha(0.5); + } + this.addChild(this.inner); + this.setHeader(this.inner,header); +}; +$hxClasses["com.davidmaletz.mining.network._StaticSaveRenderer.SaveButton"] = com_davidmaletz_mining_network__$StaticSaveRenderer_SaveButton; +com_davidmaletz_mining_network__$StaticSaveRenderer_SaveButton.__name__ = ["com","davidmaletz","mining","network","_StaticSaveRenderer","SaveButton"]; +com_davidmaletz_mining_network__$StaticSaveRenderer_SaveButton.__super__ = com_davidmaletz_mining_ui_AbstractSaveButton; +com_davidmaletz_mining_network__$StaticSaveRenderer_SaveButton.prototype = $extend(com_davidmaletz_mining_ui_AbstractSaveButton.prototype,{ + handler: null + ,header: null + ,inner: null + ,onClick: function() { + this.handler.onSelect(this.header); + return true; + } + ,onHover: function(hover) { + com_davidmaletz_mining_ui_AbstractSaveButton.prototype.onHover.call(this,hover); + this.handler.onHover(hover ? this.header : null); + } + ,__class__: com_davidmaletz_mining_network__$StaticSaveRenderer_SaveButton +}); +var com_davidmaletz_mining_network_SyncList = function(c,halign,valign) { + if(valign == null) { + valign = 0.5; + } + if(halign == null) { + halign = 0.5; + } + this.updating = true; + com_davidmaletz_mining_network_CloudSaveList.call(this,c,com_fancyfish_faeng_common_Lang.getText("cloud","sync_slots"),false,halign,valign); + this.updating = false; +}; +$hxClasses["com.davidmaletz.mining.network.SyncList"] = com_davidmaletz_mining_network_SyncList; +com_davidmaletz_mining_network_SyncList.__name__ = ["com","davidmaletz","mining","network","SyncList"]; +com_davidmaletz_mining_network_SyncList.__super__ = com_davidmaletz_mining_network_CloudSaveList; +com_davidmaletz_mining_network_SyncList.prototype = $extend(com_davidmaletz_mining_network_CloudSaveList.prototype,{ + updating: null + ,onSelect: function(slot) { + } + ,includeSlot: function(slot) { + return com_davidmaletz_mining_network_CloudSaves.isSlotSyncing(slot); + } + ,isEnabled: function(item) { + if(!this.updating) { + this.update(); + } + return false; + } + ,addEmpty: function() { + this.list.addMixedItem(com_fancyfish_faeng_common_Lang.getText("cloud","all_synced").get(),new com_davidmaletz_mining_ui_StringRenderer(null,null,130)); + } + ,update: function() { + this.updating = true; + var p = com_davidmaletz_controls_scroll_ScrollList.preSwitch(this.clickables); + var y = this.list.getScrollY(); + this.list.clear(); + if(this.addAll() == 0) { + this.list.addMixedItem(com_fancyfish_faeng_common_Lang.getText("cloud","all_synced").get(),new com_davidmaletz_mining_ui_StringRenderer(null,null,130)); + } + var ht = this.list.getViewportHeight(); + var sht = this.list.getScrollHeight(); + ht = sht - ht; + if(y > ht) { + y = ht; + } + if(y < 0) { + y = 0; + } + if(this.list.getScrollY() == y) { + this.list.scrollbar.update(); + } else { + this.list.updateScroll(y); + } + com_davidmaletz_controls_scroll_ScrollList.postSwitch(this.clickables,p); + this.updating = false; + } + ,__class__: com_davidmaletz_mining_network_SyncList +}); +var com_davidmaletz_mining_npc_NPCIdle = function() { }; +$hxClasses["com.davidmaletz.mining.npc.NPCIdle"] = com_davidmaletz_mining_npc_NPCIdle; +com_davidmaletz_mining_npc_NPCIdle.__name__ = ["com","davidmaletz","mining","npc","NPCIdle"]; +com_davidmaletz_mining_npc_NPCIdle.prototype = { + init: null + ,destroy: null + ,handleIdle: null + ,advanceFrame: null + ,getAttacks: null + ,onCancel: null + ,handleAway: null + ,__class__: com_davidmaletz_mining_npc_NPCIdle +}; +var com_davidmaletz_mining_npc_DefaultNPCIdle = function(npc,xml) { + this.ct = 0; + this.waiting = false; + this.lastPathfind = null; + this.path = null; + this.npc = npc; + if(xml != null) { + this.store = xml.get("storeIf"); + } + this.minePower = npc.info.xml.exists("mine") ? com_davidmaletz_mining_Main.parseInt(npc.info.xml.get("mine")) : 0; +}; +$hxClasses["com.davidmaletz.mining.npc.DefaultNPCIdle"] = com_davidmaletz_mining_npc_DefaultNPCIdle; +com_davidmaletz_mining_npc_DefaultNPCIdle.__name__ = ["com","davidmaletz","mining","npc","DefaultNPCIdle"]; +com_davidmaletz_mining_npc_DefaultNPCIdle.__interfaces__ = [com_davidmaletz_faengfl_EnterFrameHandler,com_davidmaletz_mining_npc_NPCIdle]; +com_davidmaletz_mining_npc_DefaultNPCIdle.adjustLoop = function(dx,loop) { + if(loop > 0 && dx > loop >> 1) { + return com_fancyfish_faeng_common_Utils.abs(dx - loop); + } else { + return dx; + } +}; +com_davidmaletz_mining_npc_DefaultNPCIdle.prototype = { + path: null + ,npc: null + ,store: null + ,vars: null + ,minePower: null + ,init: function(npc) { + if(!this.isAwake()) { + npc.set_alpha(0); + } + } + ,destroy: function() { + } + ,_playIdle: function(npc) { + return true; + } + ,insertNode: function(queue,x,y,parent) { + var loop = this.npc.area.getLoop(); + if(loop > 0) { + if(x < 0) { + x += loop; + } else if(x >= loop) { + x -= loop; + } + } + if(!this.canEnter(x,y)) { + return; + } + var t = this.npc.getTileBlock(x,y); + if(t != null && (!this.canMine(t) || this.npc.area.isWater(x - 1,y) || this.npc.area.isWater(x + 1,y) || this.npc.area.isWater(x,y - 1))) { + return; + } + var n = new com_fancyfish_faeng_common_Node(x,y,parent); + if(t != null) { + n.depth += 5; + } + queue.insert(n); + } + ,canMine: function(t) { + if(this.minePower > 0) { + return com_davidmaletz_mining_world_Area.getMineCost(t,true) < this.minePower; + } else { + return false; + } + } + ,toSelf: function(a,b) { + var loop = this.npc.area.getLoop(); + return a.depth + com_davidmaletz_mining_npc_DefaultNPCIdle.adjustLoop(com_fancyfish_faeng_common_Utils.abs(a.x - this.npc.get_tile_x()),loop) + com_fancyfish_faeng_common_Utils.abs(a.y - this.npc.get_tile_y()) < b.depth + com_davidmaletz_mining_npc_DefaultNPCIdle.adjustLoop(com_fancyfish_faeng_common_Utils.abs(b.x - this.npc.get_tile_x()),loop) + com_fancyfish_faeng_common_Utils.abs(b.y - this.npc.get_tile_y()); + } + ,isOwner: function() { + if(this.npc.area == null) { + return false; + } else { + return this.npc.area.isActivePlayer(); + } + } + ,reverse: function(n) { + var ret = new com_fancyfish_faeng_common_Node(n.x,n.y); + while(n.parent != null) { + n = n.parent; + ret = new com_fancyfish_faeng_common_Node(n.x,n.y,ret); + } + return ret; + } + ,lastPathfind: null + ,pathfind: function(x,y) { + if(this.lastPathfind == null || this.lastPathfind.x != x || this.lastPathfind.y != y) { + var queue = new com_fancyfish_faeng_common_Heap($bind(this,this.toSelf)); + var visited = new haxe_ds_IntMap(); + queue.insert(new com_fancyfish_faeng_common_Node(x,y)); + while(!queue.isEmpty()) { + var n = queue.remove(); + var i = com_fancyfish_faeng_common_Utils.getIdx(n.x,n.y); + if(visited.exists(i)) { + continue; + } + if(n.depth > 500) { + break; + } + visited.set(i,true); + if(n.x == this.npc.get_tile_x() && n.y == this.npc.get_tile_y()) { + this.lastPathfind = null; + this.setPath(n); + return true; + } + this.insertNode(queue,n.x + 1,n.y,n); + this.insertNode(queue,n.x - 1,n.y,n); + this.insertNode(queue,n.x,n.y + 1,n); + this.insertNode(queue,n.x,n.y - 1,n); + } + this.lastPathfind = new com_fancyfish_faeng_display_IPoint2D(x,y); + } + this.setPath(null); + return false; + } + ,setPath: function(n) { + this.path = n; + } + ,faceWater: function(npc) { + var x = npc.npc.get_tile_x(); + var y = npc.npc.get_tile_y(); + if(!npc.npc.canEnterTile(x + 1,y) && npc.npc.area.isWater(x + 1,y + 1)) { + npc.set_scaleX(-npc.get_scaleY()); + npc.npc.onFlip(); + return true; + } else if(!npc.npc.canEnterTile(x - 1,y) && npc.npc.area.isWater(x - 1,y + 1)) { + npc.set_scaleX(npc.get_scaleY()); + npc.npc.onFlip(); + return true; + } else { + return false; + } + } + ,findWater: function() { + if(this.npc.area.waterLevel == 2147483647) { + return null; + } + var queue = new com_fancyfish_faeng_common_Heap(com_fancyfish_faeng_common_Node.lessThan); + var visited = new haxe_ds_IntMap(); + queue.insert(new com_fancyfish_faeng_common_Node(this.npc.get_tile_x(),this.npc.get_tile_y())); + while(!queue.isEmpty()) { + var n = queue.remove(); + var i = com_fancyfish_faeng_common_Utils.getIdx(n.x,n.y); + if(visited.exists(i)) { + continue; + } + if(n.depth > 150) { + break; + } + visited.set(i,true); + if(!this.npc.canEnterTile(n.x + 1,n.y) && this.npc.area.isWater(n.x + 1,n.y + 1) || !this.npc.canEnterTile(n.x - 1,n.y) && this.npc.area.isWater(n.x - 1,n.y + 1)) { + return this.reverse(n); + } + this.insertNode(queue,n.x + 1,n.y,n); + this.insertNode(queue,n.x - 1,n.y,n); + if(n.y < 0) { + this.insertNode(queue,n.x,n.y + 1,n); + } + this.insertNode(queue,n.x,n.y - 1,n); + } + return null; + } + ,pathfindToStructure: function(s) { + if(s == null) { + return false; + } else { + return this.pathfind(Math.floor(s.getInnerCenterX() / com_davidmaletz_tiles_Tile.SIZE),s.get_tile_y()); + } + } + ,isId: function(id,s) { + return s.info.id == id; + } + ,getClosestStructureById: function(id) { + var f = $bind(this,this.isId); + var id1 = id; + var tmp = function(s) { + return f(id1,s); + }; + return this.npc.findClosestStructure(tmp); + } + ,isClass: function(cls,s) { + return Std["is"](s,cls); + } + ,getClosestStructureByClass: function(cls) { + var f = $bind(this,this.isClass); + var a1 = cls; + var tmp = function(s) { + return f(a1,s); + }; + return this.npc.findClosestStructure(tmp); + } + ,getSleepPos: function(npc) { + var e = npc.npc.info.xml; + if(e.exists("sleepPos")) { + this.getVars(); + var ar = com_davidmaletz_faengfl_EventHandler.execute(e.get("sleepPos"),this.vars); + if(ar != null) { + var x = ar[0]; + var y = ar[1]; + if(npc.npc.canEnterTile(x,y)) { + return new com_fancyfish_faeng_common_Node(x,y); + } + } + } + var s; + if(e.exists("sleepStructure")) { + s = this.getClosestStructureById(e.get("sleepStructure")); + } else { + s = npc.npc.findClosestStructure(com_davidmaletz_mining_world_Area.isSleep); + } + if(s == null) { + return null; + } else { + return new com_fancyfish_faeng_common_Node(Math.floor(s.getInnerCenterX() / com_davidmaletz_tiles_Tile.SIZE),s.get_tile_y()); + } + } + ,goToSleep: function(npc) { + this.onCancel(); + var sleep = this.getSleepPos(npc); + if(sleep == null || sleep.x == npc.npc.get_tile_x() && sleep.y == npc.npc.get_tile_y()) { + npc.npc.dispatchEvent(new com_davidmaletz_faengfl_events_IntEvent("show",0)); + npc.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),30); + return true; + } + if(this.pathfind(sleep.x,sleep.y)) { + return this.playIdle(npc); + } else { + return true; + } + } + ,getRespawnTime: function() { + return 300; + } + ,_respawn: function(npc) { + npc.npc.dispatchEvent(new com_davidmaletz_faengfl_events_IntEvent("show",1)); + npc.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),30); + } + ,_death: function(npc) { + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + var pos = this.getSleepPos(npc); + npc.npc.inventory.clear(); + if(pos != null) { + npc.npc.setPosition(pos.x * com_davidmaletz_tiles_Tile.SIZE,pos.y * com_davidmaletz_tiles_Tile.SIZE,true); + } + var f = $bind(this,this._respawn); + var a1 = npc; + var tmp = function() { + f(a1); + }; + npc.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),this.getRespawnTime(),tmp); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + } + ,onDeath: function(npc) { + npc.npc.dispatchEvent(new com_davidmaletz_faengfl_events_IntEvent("show",0)); + var f = $bind(this,this._death); + var a1 = npc; + var tmp = function() { + f(a1); + }; + npc.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),30,tmp); + } + ,cancelPlayIdle: function(npc) { + if(npc.npc.area == null || npc.hasTrack(com_davidmaletz_lerp_AlphaKeyframe)) { + return true; + } else if(!npc.npc.canEnterTile(npc.npc.get_tile_x(),npc.npc.get_tile_y())) { + this.onDeath(npc); + return true; + } else { + return false; + } + } + ,waiting: null + ,shouldWait: function(npc) { + if(this.waiting) { + this.waiting = false; + return false; + } + var ret = false; + var index = npc.npc.getIndex(); + npc.npc.area.getObjects(npc.npc.getBounds(),function(o,rect) { + if(Std["is"](o,com_davidmaletz_mining_npc_NPC) && o.getIndex() > index) { + ret = true; + return true; + } else { + return false; + } + }); + if(ret) { + this.waiting = true; + } + return ret; + } + ,getVars: function() { + if(this.vars == null) { + this.vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(com_davidmaletz_mining_Main.getLocalPlayer()); + this.vars.set("this",this.npc); + } + } + ,canStore: function() { + if(this.store == null) { + return true; + } + this.getVars(); + return com_davidmaletz_faengfl_EventHandler.execute(this.store,this.vars) == true; + } + ,canDropOff: function(s) { + if(this.canStore()) { + return Std["is"](s,com_davidmaletz_mining_structure_Storehouse); + } else { + return false; + } + } + ,finishPath: function(npc) { + if(npc.npc.inventory.hasItem()) { + var s = npc.npc.area.getStructure(npc.npc.getBounds()); + if(s != null && s.hasInventory()) { + if(this.canDropOff(s)) { + s.addAll(npc.npc,npc.npc.inventory); + s.openClose(); + npc.npc.inventory.clear(); + npc.update(); + return true; + } else if(!this.canStore()) { + npc.npc.inventory.clear(); + npc.update(); + return true; + } + } + } + npc.update(); + return this.playIdle(npc); + } + ,fakeFinishPath: function(npc) { + var s = npc.npc.area.getStructure(npc.npc.getBounds()); + if(s != null && s.hasInventory() && this.canDropOff(s)) { + s.openClose(); + } + npc.update(); + return true; + } + ,fakePlayIdle: function(npc) { + return true; + } + ,mine: null + ,handleFrame: function(frames) { + if(this.mine != null) { + var px = this.mine.x; + var py = this.mine.y; + var t = this.npc.area.getTileId(px,py,0); + var hadItem = this.npc.inventory.hasItem(); + if(t == -1 || !this.npc.area.renderer.incBrickBreak(px,py,frames)) { + if(t != -1 && this.isOwner()) { + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + var i = com_davidmaletz_mining_item_ItemInfo._get(this.npc.area.mine(px,py,t,0,this.npc)); + if(i != null && this.npc.info.xml.get("collectOre") != "false") { + this.npc.inventory.addItems(i,1); + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + } + if(!hadItem && this.npc.inventory.hasItem()) { + this.path = null; + } + return false; + } + } + return true; + } + ,enter_frame: function(frames) { + if(this.npc.area == null || this.npc.area.renderer == null) { + com_davidmaletz_faengfl_FaengFL.removeEnterFrame(this); + return; + } + if(!this.handleFrame(frames)) { + com_davidmaletz_faengfl_FaengFL.removeEnterFrame(this); + var r = this.npc.getSprite(); + if(r != null) { + var n = js_Boot.__cast(r , com_davidmaletz_mining_npc_NPCRenderer); + n.playIdle(n); + } + } + } + ,beginHandleFrame: function() { + com_davidmaletz_faengfl_FaengFL.removeEnterFrame(this); + com_davidmaletz_faengfl_FaengFL.addEnterFrame(this); + } + ,canEnter: function(x,y) { + if(this.npc.speed == 0) { + if(x == this.npc.get_tile_x()) { + return y == this.npc.get_tile_y(); + } else { + return false; + } + } else { + return this.npc.canEnterTile(x,y); + } + } + ,moveTo: function(npc,p,send) { + if(send) { + npc.npc.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("move_to",p)); + } + var x = p.x; + var y = p.y; + var t = npc.npc.getTileBlock(x,y); + if(!this.canEnter(x,y)) { + this.path = null; + return true; + } + if(t == null) { + npc.setTile(x,y); + this.path = p; + return false; + } + if(!this.canMine(t)) { + this.path = null; + return true; + } + this.mine = p; + var dx = npc.npc.area.adjustDx(x - npc.npc.get_tile_x()); + if(dx != 0) { + npc.set_scaleX(dx > 0 ? -npc.get_scaleY() : npc.get_scaleY()); + npc.npc.onFlip(); + } + npc.npc.playLoop("mine"); + this.beginHandleFrame(); + return false; + } + ,followPath: function(path) { + return true; + } + ,ct: null + ,handleIdle: function(npc) { + this.ct = 3; + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + var ret = this.playIdle(npc); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + return ret; + } + ,setTile: function(npc,x,y) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + npc.npc.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("force_move_to",new com_fancyfish_faeng_common_Node(x,y))); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + npc.setTile(x,y); + } + ,__playIdle: function(npc) { + if(npc.npc.area != null && npc.npc.area.forceNPCWander()) { + var dx = -com_fancyfish_faeng_common_Utils.sign(npc.get_scaleX()); + var x = npc.npc.get_tile_x() + dx; + if(npc.npc.canEnter(x,npc.npc.get_tile_y())) { + this.setTile(npc,x,npc.npc.get_tile_y()); + return false; + } else { + npc.set_scaleX(-npc.get_scaleX()); + } + return true; + } else { + return this._playIdle(npc); + } + } + ,hasPath: function() { + return this.path != null; + } + ,playIdle: function(npc) { + if(!this.isOwner()) { + if(this.path != null && npc.npc.xPos == this.path.x * com_davidmaletz_tiles_Tile.SIZE && npc.npc.yTile == this.path.y * com_davidmaletz_tiles_Tile.SIZE) { + var p = this.path; + this.path = null; + if(p.parent == null || !this.followPath(p.parent)) { + return this.fakeFinishPath(npc); + } + } + if(this.path == null) { + return this.fakePlayIdle(npc); + } else { + return true; + } + } else if(this.path != null && this.path.parent == this.path) { + this.path = null; + } + this.ct--; + if(this.ct <= 0 || this.cancelPlayIdle(npc)) { + return true; + } + if(this.path != null && com_davidmaletz_mining_npc_DefaultNPCIdle.adjustLoop(com_fancyfish_faeng_common_Utils.abs(this.path.x - npc.npc.get_tile_x()),npc.npc.area.getLoop()) + com_fancyfish_faeng_common_Utils.abs(this.path.y - npc.npc.get_tile_y()) > 2) { + this.path = null; + } + if(this.path != null) { + if(npc.npc.xPos != this.path.x * com_davidmaletz_tiles_Tile.SIZE || npc.npc.yTile != this.path.y * com_davidmaletz_tiles_Tile.SIZE) { + return this.moveTo(npc,this.path,true); + } + var p1 = this.path.parent; + if(p1 == null || !this.followPath(this.path)) { + this.path = null; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + var ret = this.finishPath(npc); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + return ret; + } else { + return this.moveTo(npc,p1,true); + } + } + if(this.isAwake()) { + if(npc.get_alpha() == 0) { + npc.npc.runEvent("awaken",com_davidmaletz_mining_Main.getLocalPlayer()); + npc.npc.dispatchEvent(new com_davidmaletz_faengfl_events_IntEvent("show",1)); + npc.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),30); + return true; + } else if(!this.shouldWait(npc)) { + return this.__playIdle(npc); + } else { + return true; + } + } + if(npc.get_alpha() == 0) { + return true; + } else { + return this.goToSleep(npc); + } + } + ,advanceFrame: function(npc,frames) { + } + ,getAttacks: function() { + return []; + } + ,onCancel: function() { + } + ,_handleAway: function(npc,frames) { + } + ,isAwake: function() { + if(com_davidmaletz_mining_Main.isNight()) { + return this.npc.info.xml.get("night") == "true"; + } else { + return this.npc.info.xml.get("sleepDay") != "true"; + } + } + ,handleAway: function(npc,frames) { + if(this.isAwake() && npc.info.xml.get("collectAway") != "false" && npc.area != null && !npc.area.forceNPCWander()) { + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + this._handleAway(npc,frames); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + } + } + ,addToStorehouse: function(item,ct) { + var s = this.npc.area.getMainStorehouse(); + if(s != null && s.hasInventory() && this.canDropOff(s)) { + s.addItem(this.npc,item,ct); + } else if(this.npc.area.vehicle != null && Std["is"](this.npc.area.vehicle,com_davidmaletz_mining_world_vehicle_Vehicle)) { + var inv = this.npc.area.vehicle.getBaseInventory(); + if(inv != null) { + this.npc.area.vehicle.dispatchEvent(new com_davidmaletz_mining_structure_NotifyEvent("notify_npc",this.npc,item,ct,null)); + com_davidmaletz_mining_structure_Structure.npcAddNotification("[color=ff2222]" + (js_Boot.__cast(this.npc.area.vehicle , com_davidmaletz_mining_world_vehicle_Vehicle)).getTitle(com_davidmaletz_mining_Main.getLocalPlayer()).get() + "[/color]",this.npc,item,ct,0,null); + inv.addItems(item,ct,0,null); + } + } + } + ,wander: function(npc,left,right,facing) { + var dx = -com_fancyfish_faeng_common_Utils.sign(npc.get_scaleX()); + var x = npc.npc.get_tile_x() + dx; + if((dx == -1 && x >= left || dx == 1 && x < right) && npc.npc.canEnter(x,npc.npc.get_tile_y())) { + this.setTile(npc,x,npc.npc.get_tile_y()); + return false; + } else if(com_fancyfish_faeng_common_Utils.abs(left - right) > 1 || npc.npc.get_tile_x() != left) { + npc.set_scaleX(-npc.get_scaleX()); + } else { + npc.set_scaleX(facing); + } + return true; + } + ,__class__: com_davidmaletz_mining_npc_DefaultNPCIdle +}; +var com_davidmaletz_mining_npc_Collect = function(npc,xml) { + this.frames = 0; + this.dir = 0; + this.steps = 0; + com_davidmaletz_mining_npc_DefaultNPCIdle.call(this,npc,xml); + this.max_steps = 10; + this._collect = []; + if(xml != null) { + if(xml.exists("steps")) { + this.max_steps = com_davidmaletz_mining_Main.parseInt(xml.get("steps")); + } + var e = xml.elementsNamed("collect"); + while(e.hasNext()) { + var e1 = e.next(); + this._collect.push(new com_davidmaletz_mining_LootHandler(e1.elementsNamed("loot"))); + } + } + var xml1 = npc.getInfo().xml; + this.collectFrames = this.max_steps * 8 * npc.speed * com_davidmaletz_tiles_Tile.SIZE; +}; +$hxClasses["com.davidmaletz.mining.npc.Collect"] = com_davidmaletz_mining_npc_Collect; +com_davidmaletz_mining_npc_Collect.__name__ = ["com","davidmaletz","mining","npc","Collect"]; +com_davidmaletz_mining_npc_Collect.__super__ = com_davidmaletz_mining_npc_DefaultNPCIdle; +com_davidmaletz_mining_npc_Collect.prototype = $extend(com_davidmaletz_mining_npc_DefaultNPCIdle.prototype,{ + steps: null + ,dir: null + ,max_steps: null + ,_collect: null + ,collectFrames: null + ,collect: function(addItems) { + var _g = 0; + var _g1 = this._collect; + while(_g < _g1.length) { + var c = _g1[_g]; + ++_g; + var i = c.getLoot(); + if(i != null) { + addItems(i.item,i.count); + } + } + } + ,_playIdle: function(npc) { + if(npc.npc.inventory.hasItem()) { + if(this.pathfindToStructure(npc.npc.area.getMainStorehouse())) { + return this.playIdle(npc); + } else { + return true; + } + } else { + if(this.steps <= 0) { + this.steps = this.max_steps; + this.dir = Math.random() < 0.5 ? -1 : 1; + } + this.steps--; + var s = com_davidmaletz_tiles_Tile.SIZE; + if(this.steps == 0 && com_davidmaletz_faengfl_FaengFL.onScreen(npc,new openfl_geom_Rectangle(-s * 0.5,-s * 0.5,s,s))) { + this.steps = 1; + } + if(this.steps == 0 || !npc.npc.canEnter(npc.npc.get_tile_x() + this.dir,npc.npc.get_tile_y())) { + var inv = npc.npc.inventory; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + this.collect($bind(inv,inv.addItemCount)); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + if(!inv.hasItem()) { + this.steps = this.max_steps; + } + if(this.steps > 0) { + return true; + } else { + return this.playIdle(npc); + } + } + this.setTile(npc,npc.npc.get_tile_x() + this.dir,npc.npc.get_tile_y()); + return false; + } + } + ,frames: null + ,_handleAway: function(npc,df) { + this.frames += df; + if(this.frames > this.collectFrames) { + this.frames = 0; + this.collect($bind(this,this.addToStorehouse)); + } + } + ,__class__: com_davidmaletz_mining_npc_Collect +}); +var com_davidmaletz_mining_npc_Build = function(npc,xml) { + com_davidmaletz_mining_npc_Collect.call(this,npc,xml); +}; +$hxClasses["com.davidmaletz.mining.npc.Build"] = com_davidmaletz_mining_npc_Build; +com_davidmaletz_mining_npc_Build.__name__ = ["com","davidmaletz","mining","npc","Build"]; +com_davidmaletz_mining_npc_Build.__super__ = com_davidmaletz_mining_npc_Collect; +com_davidmaletz_mining_npc_Build.prototype = $extend(com_davidmaletz_mining_npc_Collect.prototype,{ + build: null + ,handleFrame: function(frames) { + if(this.build != null) { + if(this.isOwner()) { + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + this.build.addHealth(Math.ceil(frames * 5)); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + } + if(this.build.getHealthPercent() == 1) { + this.build = null; + return false; + } else { + return true; + } + } else { + return com_davidmaletz_mining_npc_Collect.prototype.handleFrame.call(this,frames); + } + } + ,followPath: function(path) { + var o = this.npc.area.getObjectsInTile(path.x,path.y); + while(o.hasNext()) { + var o1 = o.next(); + if(o1.getLayer() == 1 && o1.getHealth() > 0 && Std["is"](o1,com_davidmaletz_mining_world_BlueprintObject)) { + this.build = o1; + this.npc.playLoop("build"); + this.beginHandleFrame(); + return false; + } + } + return true; + } + ,finishPath: function(npc) { + if(this.build != null) { + return false; + } + var doCollect = false; + var doBuild = null; + var own = this.isOwner(); + npc.npc.getOverlap(function(o,rect) { + if(o.getLayer() == 1 && (o.getMaxHealth() == 0 || o.getHealth() > 0)) { + if(Std["is"](o,com_davidmaletz_mining_world_BlueprintObject)) { + doBuild = o; + } else if(!doCollect && (o.info.xml.get("canCollect") == "true" || Std["is"](o,com_davidmaletz_mining_world_Bush))) { + doCollect = true; + } + } + return false; + },null,0); + if(doBuild != null) { + this.build = doBuild; + npc.npc.playLoop("build"); + this.beginHandleFrame(); + return false; + } else if(doCollect || this.faceWater(npc)) { + if(own) { + this.collect(($_=npc.npc.inventory,$bind($_,$_.addItemCount))); + } + var f = ($_=npc.npc,$bind($_,$_.playAnimation)); + var tmp = function() { + f("build"); + }; + npc.npc.playAnimation("build",tmp); + return false; + } else if(own) { + return com_davidmaletz_mining_npc_Collect.prototype.finishPath.call(this,npc); + } else { + return com_davidmaletz_mining_npc_Collect.prototype.fakeFinishPath.call(this,npc); + } + } + ,fakeFinishPath: function(npc) { + return this.finishPath(npc); + } + ,getClosestObject: function() { + var _gthis = this; + var best = null; + var dist = Infinity; + var b = this.npc.getBounds(); + b.inflate(64 * com_davidmaletz_tiles_Tile.SIZE,16 * com_davidmaletz_tiles_Tile.SIZE); + this.npc.area.getObjects(b,function(o,rect) { + if(o.getLayer() == 1 && (o.getMaxHealth() == 0 || o.getHealth() > 0) && (o.info.xml.get("canCollect") == "true" || Std["is"](o,com_davidmaletz_mining_world_BlueprintObject) || Std["is"](o,com_davidmaletz_mining_world_Bush))) { + var dx = _gthis.npc.getCenterX() - o.getCenterX(); + var dy = (_gthis.npc.yTile - o.yTile) * 2; + var d = Math.sqrt(dx * dx + dy * dy); + if(d < dist) { + dist = d; + best = o; + } + } + return false; + },null,0); + return best; + } + ,_playIdle: function(npc) { + if(npc.npc.inventory.hasItem()) { + if(this.pathfindToStructure(npc.npc.area.getMainStorehouse())) { + return this.playIdle(npc); + } else { + return true; + } + } else { + var o = this.getClosestObject(); + if(o != null && this.pathfind(Math.floor(o.getCenterX() / com_davidmaletz_tiles_Tile.SIZE),o.get_tile_y())) { + return this.playIdle(npc); + } else { + this.setPath(this.findWater()); + return true; + } + } + } + ,__class__: com_davidmaletz_mining_npc_Build +}); +var com_davidmaletz_mining_npc_FakePositionKeyframe = function(_x,_y) { + if(_y == null) { + _y = 0; + } + if(_x == null) { + _x = 0; + } + this.x = _x; + this.y = _y; +}; +$hxClasses["com.davidmaletz.mining.npc.FakePositionKeyframe"] = com_davidmaletz_mining_npc_FakePositionKeyframe; +com_davidmaletz_mining_npc_FakePositionKeyframe.__name__ = ["com","davidmaletz","mining","npc","FakePositionKeyframe"]; +com_davidmaletz_mining_npc_FakePositionKeyframe.__interfaces__ = [com_davidmaletz_lerp_Keyframe]; +com_davidmaletz_mining_npc_FakePositionKeyframe.prototype = { + frame: null + ,x: null + ,y: null + ,set: function(from) { + var k = js_Boot.__cast(from , com_davidmaletz_mining_npc_FakePositionKeyframe); + this.x = k.x; + this.y = k.y; + } + ,setFromObject: function(a) { + this.x = a.get_x(); + this.y = a.get_y(); + } + ,getFrame: function() { + return this.frame; + } + ,setFrame: function(f) { + this.frame = f; + } + ,interp: function(track,other,f) { + var k = js_Boot.__cast(other , com_davidmaletz_mining_npc_FakePositionKeyframe); + return new com_davidmaletz_mining_npc_FakePositionKeyframe(track.interp(this.x,k.x,f),track.interp(this.y,k.y,f)); + } + ,apply: function(a) { + if(com_davidmaletz_lerp_PositionKeyframe.ROUND) { + a.set_x(Math.round(this.x)); + a.set_y(Math.round(this.y)); + } else { + a.set_x(this.x); + a.set_y(this.y); + } + } + ,toString: function() { + return "POS " + this.frame + " [" + this.x + "," + this.y + "]"; + } + ,__class__: com_davidmaletz_mining_npc_FakePositionKeyframe +}; +var com_davidmaletz_mining_npc_Fishing = function(npc,xml) { + this.frames = 0; + this.string = null; + this.rounds = 0; + com_davidmaletz_mining_npc_DefaultNPCIdle.call(this,npc,xml); + this.max_difficulty = 4; + if(xml != null) { + if(xml.exists("max_difficulty")) { + this.max_difficulty = com_davidmaletz_mining_Main.parseInt(xml.get("max_difficulty")); + } + } + var xml1 = npc.getInfo().xml; + this.fishFrames = 60 * npc.speed * com_davidmaletz_tiles_Tile.SIZE; +}; +$hxClasses["com.davidmaletz.mining.npc.Fishing"] = com_davidmaletz_mining_npc_Fishing; +com_davidmaletz_mining_npc_Fishing.__name__ = ["com","davidmaletz","mining","npc","Fishing"]; +com_davidmaletz_mining_npc_Fishing.__super__ = com_davidmaletz_mining_npc_DefaultNPCIdle; +com_davidmaletz_mining_npc_Fishing.prototype = $extend(com_davidmaletz_mining_npc_DefaultNPCIdle.prototype,{ + rounds: null + ,max_difficulty: null + ,string: null + ,fishFrames: null + ,onCancel: function() { + if(this.string != null) { + this.removeString(); + this.rounds = 0; + } + } + ,fishAnim: function(npc,id) { + this.faceWater(npc); + npc.setFrame(0); + npc.npc.playAnimation(id); + if(this.string == null) { + this.string = new com_davidmaletz_tiles_render_PlayAnimation(com_davidmaletz_tiles_Tile.get("fishing_line"),"fishing_line." + id,npc.getFramesPerSecond(),false); + var _g = this.string; + _g.set_x(_g.get_x() - 3); + npc.addChild(this.string); + } else { + this.string.playAnimation("fishing_line." + id,false); + this.string.setFrame(0); + } + } + ,getFish: function(area) { + var xml = com_davidmaletz_mining_world_Generate.get(area.id); + var iter; + var tmp; + if(xml != null) { + iter = xml.elementsNamed("fishing"); + tmp = !iter.hasNext(); + } else { + tmp = true; + } + if(tmp) { + return null; + } + var h = new com_davidmaletz_mining_LootHandler(iter.next().elementsNamed("loot")); + var i = h.getLoot(); + var difficulty = i.xml.exists("difficulty") ? com_davidmaletz_mining_Main.parseInt(i.xml.get("difficulty")) : 0; + if(difficulty > this.max_difficulty || Math.random() < 0.5) { + return null; + } else { + return i.item; + } + } + ,fish: function(inv,npc) { + if(this.rounds <= 0) { + this.fishAnim(npc,"cast"); + this.rounds = Math.floor(Math.random() * 16) + 8; + return false; + } + this.rounds--; + if(this.rounds == 0) { + var fish = this.getFish(npc.npc.area); + if(fish == null) { + this.removeString(); + return true; + } + this.fishAnim(npc,"catch"); + inv.addItems(fish,1); + return false; + } else { + this.fishAnim(npc,"fishing"); + return false; + } + } + ,removeString: function() { + if(this.string != null) { + com_davidmaletz_faengfl_FaengFL.remove(this.string); + this.string = null; + } + } + ,finishPath: function(npc) { + if(this.faceWater(npc)) { + return this.fish(npc.npc.inventory,npc); + } else { + return com_davidmaletz_mining_npc_DefaultNPCIdle.prototype.finishPath.call(this,npc); + } + } + ,fakeFinishPath: function(npc) { + if(this.faceWater(npc)) { + return this.fakeFish(npc); + } else { + return com_davidmaletz_mining_npc_DefaultNPCIdle.prototype.fakeFinishPath.call(this,npc); + } + } + ,fakeFish: function(npc) { + if(this.rounds <= 0) { + this.fishAnim(npc,"cast"); + this.rounds = Math.floor(Math.random() * 16) + 8; + return false; + } + this.rounds--; + if(this.rounds == 0) { + if(Math.random() < 0.5) { + this.fishAnim(npc,"catch"); + return false; + } else { + this.removeString(); + return true; + } + } else { + this.fishAnim(npc,"fishing"); + return false; + } + } + ,fakePlayIdle: function(npc) { + if(!npc.npc.inventory.hasItem() && this.faceWater(npc)) { + return this.fakeFish(npc); + } else { + this.removeString(); + } + return true; + } + ,_playIdle: function(npc) { + if(npc.npc.inventory.hasItem()) { + this.removeString(); + if(this.pathfindToStructure(npc.npc.area.getMainStorehouse())) { + return this.playIdle(npc); + } else { + return true; + } + } else if(this.faceWater(npc)) { + return this.fish(npc.npc.inventory,npc); + } else { + this.removeString(); + this.setPath(this.findWater()); + } + return true; + } + ,frames: null + ,_handleAway: function(npc,df) { + this.frames += df; + if(this.frames > this.fishFrames) { + this.frames = 0; + var fish = this.getFish(npc.area); + if(fish != null) { + this.addToStorehouse(fish,1); + } + } + } + ,__class__: com_davidmaletz_mining_npc_Fishing +}); +var com_davidmaletz_mining_npc_Hunt = function(npc,xml) { + this.frames = 0; + com_davidmaletz_mining_npc_DefaultNPCIdle.call(this,npc,xml); + this.attacks = []; + var e = xml.elementPathsNamed("attack"); + while(e.hasNext()) { + var e1 = e.next(); + this.attacks.push(com_davidmaletz_mining_enemy_Attack.fromXML(e1)); + } + this.maxWeight = xml.exists("maxWeight") ? com_davidmaletz_mining_Main.parseInt(xml.get("maxWeight")) : 50; +}; +$hxClasses["com.davidmaletz.mining.npc.Hunt"] = com_davidmaletz_mining_npc_Hunt; +com_davidmaletz_mining_npc_Hunt.__name__ = ["com","davidmaletz","mining","npc","Hunt"]; +com_davidmaletz_mining_npc_Hunt.maxAttack = function(attack,e) { + if(Std["is"](e.info,com_davidmaletz_mining_enemy_EnemyInfo) && e.isEnabled(null)) { + if(e.info.xml.get("spirit") != "true") { + return (js_Boot.__cast(e.info , com_davidmaletz_mining_enemy_EnemyInfo)).minDefense() < attack; + } else { + return false; + } + } else { + return false; + } +}; +com_davidmaletz_mining_npc_Hunt.__super__ = com_davidmaletz_mining_npc_DefaultNPCIdle; +com_davidmaletz_mining_npc_Hunt.prototype = $extend(com_davidmaletz_mining_npc_DefaultNPCIdle.prototype,{ + attacks: null + ,maxWeight: null + ,init: function(npc) { + com_davidmaletz_mining_npc_DefaultNPCIdle.prototype.init.call(this,npc); + var f = $bind(this,this.lootHandler); + var a1 = npc; + npc.lootHandler = function(a2) { + f(a1,a2); + }; + } + ,lootHandler: function(npc,loot) { + if(this.isOwner()) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + var l = loot; + while(l.hasNext()) { + var l1 = l.next(); + npc.npc.inventory.addItems(l1.item,l1.count); + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + } + ,advanceFrame: function(npc,frames) { + if(this.isOwner() && (!com_davidmaletz_mining_Main.isNight() || npc.npc.info.xml.get("night") == "true") && !npc.hasTrack(com_davidmaletz_lerp_PositionKeyframe) && npc.npc.inventory.getWeight() < this.maxWeight && (npc.animation == npc.getAnim("idle") || npc.animation == npc.getAnim("walk"))) { + var attack_range = npc.getAttackRange(); + if(attack_range >= 0) { + var b = npc.npc.getClosest(attack_range + com_davidmaletz_tiles_Tile.SIZE * 3,1,true,$bind(npc,npc.canAttack)); + if(b != null && b.object != null && npc.canAttack(b.object)) { + var maxDist = Math.round(npc.getXDistance(b.bounds)); + var o = b.object; + if(maxDist <= attack_range && maxDist > com_davidmaletz_tiles_Tile.SIZE) { + npc.doAttack(o,maxDist); + npc.clearTrack(com_davidmaletz_mining_world_MoveKeyframe); + } + } + } + } + } + ,fakePlayIdle: function(npc) { + var x = npc.npc.get_tile_x() - com_fancyfish_faeng_common_Utils.sign(npc.get_scaleX()); + var y = npc.npc.get_tile_y(); + if(!npc.npc.canEnter(x,y)) { + npc.set_scaleX(-npc.get_scaleX()); + } + return true; + } + ,_playIdle: function(npc) { + this.enemies = null; + if(npc.npc.inventory.hasItem() && this.pathfindToStructure(npc.npc.area.getMainStorehouse())) { + return this.playIdle(npc); + } else { + var x = npc.npc.get_tile_x() - com_fancyfish_faeng_common_Utils.sign(npc.get_scaleX()); + var y = npc.npc.get_tile_y(); + if(npc.npc.canEnter(x,y)) { + this.setTile(npc,x,y); + return false; + } else { + npc.set_scaleX(-npc.get_scaleX()); + return true; + } + } + } + ,getAttacks: function() { + return this.attacks; + } + ,enemies: null + ,enemyFrames: null + ,frames: null + ,_handleAway: function(npc,df) { + if(this.enemies == null) { + var attack = 0; + var _g = 0; + var _g1 = this.attacks; + while(_g < _g1.length) { + var a = _g1[_g]; + ++_g; + if(a.damage > attack) { + attack = a.damage; + } + } + var a1 = attack; + var tmp = function(e) { + return com_davidmaletz_mining_npc_Hunt.maxAttack(a1,e); + }; + this.enemies = npc.area.spawner.getInBounds(npc.getBounds()).filter(tmp); + this.enemyFrames = 0; + var _g2 = 0; + var _g11 = this.enemies; + while(_g2 < _g11.length) { + var e1 = _g11[_g2]; + ++_g2; + if(e1.getSpawnTime() > this.enemyFrames) { + this.enemyFrames = e1.getSpawnTime(); + } + } + var xml = npc.getInfo().xml; + this.enemyFrames += 80 * npc.speed * com_davidmaletz_tiles_Tile.SIZE; + } + if(this.enemies.length == 0) { + return; + } + this.frames += df; + if(this.frames > this.enemyFrames) { + this.frames = 0; + var i = Math.floor(Math.random() * this.enemies.length); + var e2 = this.enemies[i].info; + var i1 = (js_Boot.__cast(e2 , com_davidmaletz_mining_enemy_EnemyInfo)).getLoot(null); + while(i1.hasNext()) { + var i2 = i1.next(); + this.addToStorehouse(i2.item,i2.count); + } + this.enemies = null; + } + } + ,__class__: com_davidmaletz_mining_npc_Hunt +}); +var com_davidmaletz_mining_npc_Locate = function(npc,xml) { + com_davidmaletz_mining_npc_DefaultNPCIdle.call(this,npc,xml); + var e = xml == null ? npc.getInfo().xml : xml; + this.allowWander = e.get("allowWander") == "true"; + this.getLocation = com_davidmaletz_mining_npc_Locate.parse(e,"getLocation"); + this.handleLocation = com_davidmaletz_mining_npc_Locate.parse(e,"handleLocation"); + this.canSleep = com_davidmaletz_mining_npc_Locate.parse(e,"canSleep"); + this.remoteHandleLocation = com_davidmaletz_mining_npc_Locate.parse(e,"remoteHandleLocation"); +}; +$hxClasses["com.davidmaletz.mining.npc.Locate"] = com_davidmaletz_mining_npc_Locate; +com_davidmaletz_mining_npc_Locate.__name__ = ["com","davidmaletz","mining","npc","Locate"]; +com_davidmaletz_mining_npc_Locate.parse = function(e,tag) { + var i = e.elementsNamed(tag); + if(i.hasNext()) { + try { + return com_davidmaletz_faengfl_EventHandler.parseString(com_fancyfish_faeng_common_Lang.escape(i.next().firstChild().get_nodeValue())); + } catch( e1 ) { + haxe_CallStack.lastException = e1; + if (e1 instanceof js__$Boot_HaxeError) e1 = e1.val; + com_fancyfish_faeng_common_Utils.printExceptionTrace(e1); + } + } + return null; +}; +com_davidmaletz_mining_npc_Locate.__super__ = com_davidmaletz_mining_npc_DefaultNPCIdle; +com_davidmaletz_mining_npc_Locate.prototype = $extend(com_davidmaletz_mining_npc_DefaultNPCIdle.prototype,{ + loc: null + ,getLocation: null + ,handleLocation: null + ,canSleep: null + ,remoteHandleLocation: null + ,allowWander: null + ,finishPath: function(npc) { + if(this.loc != null && npc.npc.get_tile_x() == this.loc[0] && npc.npc.get_tile_y() == this.loc[1]) { + this.loc = null; + if(this.handleLocation != null) { + try { + var a = npc.animation; + com_davidmaletz_faengfl_EventHandler.interpret(this.handleLocation,npc.npc.vars); + if(a != npc.animation) { + return false; + } + } catch( e ) { + haxe_CallStack.lastException = e; + if (e instanceof js__$Boot_HaxeError) e = e.val; + com_fancyfish_faeng_common_Utils.printExceptionTrace(e); + } + } + return this.playIdle(npc); + } + return com_davidmaletz_mining_npc_DefaultNPCIdle.prototype.finishPath.call(this,npc); + } + ,fakeFinishPath: function(npc) { + if(this.remoteHandleLocation != null) { + try { + var a = npc.animation; + com_davidmaletz_faengfl_EventHandler.interpret(this.remoteHandleLocation,npc.npc.vars); + if(a != npc.animation) { + return false; + } + } catch( e ) { + haxe_CallStack.lastException = e; + if (e instanceof js__$Boot_HaxeError) e = e.val; + com_fancyfish_faeng_common_Utils.printExceptionTrace(e); + } + } + return true; + } + ,_playIdle: function(npc) { + if(npc.npc.area == null || this.getLocation == null) { + return true; + } + this.loc = null; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + try { + var ar = com_davidmaletz_faengfl_EventHandler.interpret(this.getLocation,npc.npc.vars); + if(ar != null && ar.length >= 2) { + this.loc = ar; + } + } catch( e ) { + haxe_CallStack.lastException = e; + if (e instanceof js__$Boot_HaxeError) e = e.val; + com_fancyfish_faeng_common_Utils.printExceptionTrace(e); + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + if(this.loc != null && (npc.npc.get_tile_x() != this.loc[0] || npc.npc.get_tile_y() != this.loc[1]) && this.pathfind(this.loc[0],this.loc[1])) { + return this.playIdle(npc); + } else if(this.loc == null && this.allowWander) { + return this.wander(npc,-1000000,1000000,1); + } else { + this.loc = null; + return true; + } + } + ,isAwake: function() { + if(com_davidmaletz_mining_npc_DefaultNPCIdle.prototype.isAwake.call(this)) { + return true; + } + if(this.canSleep != null) { + try { + return com_davidmaletz_faengfl_EventHandler.interpret(this.canSleep,this.npc.vars) == false; + } catch( e ) { + haxe_CallStack.lastException = e; + if (e instanceof js__$Boot_HaxeError) e = e.val; + com_fancyfish_faeng_common_Utils.printExceptionTrace(e); + } + } + return false; + } + ,handleAway: function(npc,frames) { + } + ,__class__: com_davidmaletz_mining_npc_Locate +}); +var com_davidmaletz_mining_npc_MineOre = function(npc,xml) { + this.frames = 0; + this.item = null; + com_davidmaletz_mining_npc_DefaultNPCIdle.call(this,npc,xml); + if(xml != null) { + this.loot = new com_davidmaletz_mining_LootHandler(xml.elementsNamed("loot")); + } + this.collectFrames = 120 * npc.speed * com_davidmaletz_tiles_Tile.SIZE; + if(this.minePower == 0) { + this.minePower = 1; + } +}; +$hxClasses["com.davidmaletz.mining.npc.MineOre"] = com_davidmaletz_mining_npc_MineOre; +com_davidmaletz_mining_npc_MineOre.__name__ = ["com","davidmaletz","mining","npc","MineOre"]; +com_davidmaletz_mining_npc_MineOre.__interfaces__ = [com_davidmaletz_faengfl_EnterFrameHandler]; +com_davidmaletz_mining_npc_MineOre.__super__ = com_davidmaletz_mining_npc_DefaultNPCIdle; +com_davidmaletz_mining_npc_MineOre.prototype = $extend(com_davidmaletz_mining_npc_DefaultNPCIdle.prototype,{ + loot: null + ,collectFrames: null + ,findOre: function() { + var queue = new com_fancyfish_faeng_common_Heap(com_fancyfish_faeng_common_Node.lessThan); + var visited = new haxe_ds_IntMap(); + queue.insert(new com_fancyfish_faeng_common_Node(this.npc.get_tile_x(),this.npc.get_tile_y())); + var possible = null; + while(!queue.isEmpty()) { + var n = queue.remove(); + var i = com_fancyfish_faeng_common_Utils.getIdx(n.x,n.y); + if(visited.exists(i)) { + continue; + } + if(n.depth > 100) { + if(this.npc.area.getTileId(n.x,n.y,3) != -1 && (possible == null || Math.random() < 0.5)) { + possible = n; + } + continue; + } + visited.set(i,true); + if(this.npc.area.getTileId(n.x,n.y,0) != -1) { + var t = this.npc.area.getTile(n.x,n.y,1); + if(t != null && com_davidmaletz_mining_item_ItemInfo.exists(t.id)) { + return this.reverse(n); + } + } + this.insertNode(queue,n.x + 1,n.y,n); + this.insertNode(queue,n.x - 1,n.y,n); + this.insertNode(queue,n.x,n.y + 1,n); + this.insertNode(queue,n.x,n.y - 1,n); + } + if(possible == null) { + return null; + } else { + this.item = this.getOre(); + return this.reverse(possible); + } + } + ,item: null + ,getOre: function() { + if(this.loot == null) { + return null; + } else { + var i = this.loot.getLoot(); + if(i == null) { + return null; + } else { + return i.item; + } + } + } + ,finishPath: function(npc) { + if(!npc.npc.inventory.hasItem() && this.item != null) { + npc.npc.inventory.addItems(this.item,1); + this.item = null; + } + return com_davidmaletz_mining_npc_DefaultNPCIdle.prototype.finishPath.call(this,npc); + } + ,_playIdle: function(npc) { + if(npc.hasQuest()) { + if(this.pathfind(npc.npc.get_tile_x(),-1)) { + return this.playIdle(npc); + } else { + return true; + } + } else if(npc.npc.inventory.hasItem()) { + if(this.pathfindToStructure(npc.npc.area.getMainStorehouse())) { + return this.playIdle(npc); + } else { + return true; + } + } else { + this.item = null; + this.setPath(this.findOre()); + if(this.path == null) { + return true; + } + return this.playIdle(npc); + } + } + ,frames: null + ,_handleAway: function(npc,df) { + this.frames += df; + if(this.frames > this.collectFrames) { + this.frames = 0; + var i = this.getOre(); + if(i != null) { + this.addToStorehouse(i,1); + } + } + } + ,__class__: com_davidmaletz_mining_npc_MineOre +}); +var com_davidmaletz_mining_npc_NPC = function(info,x,y) { + this.overObjects = []; + this.moveTalkFrames = 0; + this.speed = info.xml.exists("speed") ? com_davidmaletz_mining_Main.parseFloat(info.xml.get("speed")) : 4; + com_davidmaletz_mining_world_TooltipObject.call(this,info,x,y); + this.inventory = new com_davidmaletz_mining_item_Inventory(); + this.health = Math.floor(Math.random() * (this.getMaxHealth() + 1)); + if(info.idle != null) { + this.idle = Type.createInstance(info.idle,[this,info.idle_xml]); + } + this.tile = info.tile; + if(info.light != null) { + this.light = new com_davidmaletz_mining_world_Light(info.light,Math.round(this.getCenterX()),Math.round(this.getCenterY())); + } + var t = com_davidmaletz_tiles_Tile.get(this.tile); + if(t != null && t.getWidth() != 0) { + this._width = t.getWidth(); + this._height = t.getHeight(); + } + this.vars = com_davidmaletz_faengfl_EventHandler.createVariables(); + this.vars.set("this",this); + this.talking = new com_fancyfish_faeng_common_mutable_Mutable(); + this.talking.set(null); +}; +$hxClasses["com.davidmaletz.mining.npc.NPC"] = com_davidmaletz_mining_npc_NPC; +com_davidmaletz_mining_npc_NPC.__name__ = ["com","davidmaletz","mining","npc","NPC"]; +com_davidmaletz_mining_npc_NPC.__interfaces__ = [com_davidmaletz_mining_npc_Speakable]; +com_davidmaletz_mining_npc_NPC.__super__ = com_davidmaletz_mining_world_TooltipObject; +com_davidmaletz_mining_npc_NPC.prototype = $extend(com_davidmaletz_mining_world_TooltipObject.prototype,{ + tile: null + ,vars: null + ,speed: null + ,idle: null + ,inventory: null + ,light: null + ,getWatchInventory: function() { + return this.inventory; + } + ,resetShape: function() { + var t = com_davidmaletz_tiles_Tile.get(this.tile); + if(t == null) { + com_davidmaletz_mining_world_TooltipObject.prototype.resetShape.call(this); + } else { + this.reshape(t.getWidth(),t.getHeight()); + } + } + ,setTileId: function(tile) { + if(tile != this.tile) { + this.tile = tile; + this.updateRenderer(); + } + } + ,getDisplay: function(darkBG) { + if(darkBG == null) { + darkBG = false; + } + return this.info.getDisplay(darkBG,this.info.xml.exists("icon") || this.tile == null ? null : this.tile + " anim=" + this.getAnim("idle")); + } + ,getTileIcon: function() { + if(com_davidmaletz_tiles_Tile.exists(this.tile)) { + return com_davidmaletz_tiles_Tile.get(this.tile); + } else { + return this.getInfo().createTile(this.getHealth()); + } + } + ,getMaxHealth: function() { + return 65535; + } + ,createRenderer: function() { + this.renderer = new com_davidmaletz_mining_npc_NPCRenderer(this); + this.renderer.addEventListener("removedFromStage",$bind(this,this.stopSFX)); + return this.renderer; + } + ,onFlip: function() { + if(this.renderer != null && this.light != null) { + var r = this.light.getRenderer(); + if(r != null) { + r.set_scaleX(this.renderer.get_scaleX()); + } + } + } + ,room: null + ,moveRenderer: function(old_x,old_y,init) { + if(init == null) { + init = false; + } + this.room = null; + if(this.area != null) { + var s = this.area.getStructureInTile(this.get_tile_x(),this.get_tile_y()); + if(s != null && s.info.room) { + this.room = s; + } + } + com_davidmaletz_mining_world_TooltipObject.prototype.moveRenderer.call(this,old_x,old_y,init); + if(this.light != null) { + this.light.setPosition(Math.round(this.renderer.get_x()),Math.round(this.renderer.get_y())); + } + this.onFlip(); + } + ,addedToArea: function() { + com_davidmaletz_mining_world_TooltipObject.prototype.addedToArea.call(this); + if(this.area != null) { + this.area.addEventListener("tick",$bind(this,this.handleTick)); + } + this.runEvent("addedToArea",null); + if(this.light != null) { + this.light.addToArea(this.area); + } + } + ,removedFromArea: function(area) { + com_davidmaletz_mining_world_TooltipObject.prototype.removedFromArea.call(this,area); + if(area != null) { + area.removeEventListener("tick",$bind(this,this.handleTick)); + } + if(this.light != null) { + this.light.removeFromArea(area); + } + } + ,handleTick: function(e) { + if(this.moveTalkFrames > 0) { + this.moveTalkFrames -= e.value; + } + if(this.idle != null && this.info.xml.get("collectAway") != "false" && this.area != null && this.area.renderer == null && !this.area.hasActivePlayer()) { + this.idle.handleAway(this,e.value); + } + } + ,getInfo: function() { + return this.info; + } + ,getLayer: function() { + return com_davidmaletz_mining_world_BasicObjectInfo.parseLayer(this.info.xml.get("layer")); + } + ,getAction: function(p) { + if(this.talking.get() != null) { + return null; + } + if(p.renderer != null && this.renderer != null) { + var dx = (p.renderer.get_x() - this.renderer.get_x()) * p.renderer.get_scaleX(); + if(dx < 0) { + return null; + } + } + var info = this.getInfo(); + var n = info.tooltip; + if(n != null) { + com_davidmaletz_mining_npc_NPCEventHandler.setPlayerVariables(this.vars,p); + if(!n.exists("if") || com_davidmaletz_faengfl_EventHandler._conditionMet(n.get("if"),this.vars)) { + var section = n.get("section"); + var id = n.get("id"); + if(section == null) { + section = "npc"; + } + if(id == null) { + var f = n.firstChild(); + if(f == null) { + return null; + } + id = Std.string(com_davidmaletz_faengfl_EventHandler.execute(com_fancyfish_faeng_common_Lang.escape(f.get_nodeValue()),this.vars)); + } + if(com_fancyfish_faeng_common_Lang.hasText(section,id)) { + return com_fancyfish_faeng_common_Lang.getText(section,id); + } + } + } + var action = info.action; + var t = com_fancyfish_faeng_common_Lang.getTextFromTitle(action); + if(t != null) { + return t; + } else if(action == null) { + return null; + } else if(com_fancyfish_faeng_common_Lang.hasText("npc",action)) { + return com_fancyfish_faeng_common_Lang.getText("npc",action); + } else { + return null; + } + } + ,projectileCanHurt: function(o) { + if(this.renderer != null) { + return (js_Boot.__cast(this.renderer , com_davidmaletz_mining_npc_NPCRenderer)).canAttack(o); + } else { + return false; + } + } + ,stopForPlayer: function(p) { + var xml = this.getInfo().xml; + if(xml.exists("stopForPlayer")) { + com_davidmaletz_mining_npc_NPCEventHandler.setPlayerVariables(this.vars,p); + return com_davidmaletz_faengfl_EventHandler.execute(xml.get("stopForPlayer"),this.vars) == true; + } else { + return true; + } + } + ,isBlocking: function(asker) { + return false; + } + ,sound: null + ,getAnim: function(id) { + var s; + var tmp; + if(this.tile != null && this.tile != this.getInfo().tile) { + s = this.tile + "." + id; + tmp = com_davidmaletz_tiles_TileAnimation.exists(s); + } else { + tmp = false; + } + if(tmp) { + return s; + } else { + return this.getInfo().getAnim(id); + } + } + ,getIconFrame: function() { + return com_davidmaletz_mining_world_Object.getFrame(this.getAnim("idle")); + } + ,playAnimation: function(id,onComplete,loop) { + if(loop == null) { + loop = false; + } + var _gthis = this; + if(this.renderer != null) { + var r = js_Boot.__cast(this.renderer , com_davidmaletz_mining_npc_NPCRenderer); + if(this.info.xml.get("clearAlpha") != "false") { + this.renderer.clearTrack(com_davidmaletz_lerp_AlphaKeyframe); + } + r.set_alpha(1); + var tmp = this.getAnim(id); + var tmp1 = onComplete == null ? $bind(r,r.playIdle) : function(p) { + var tmp2 = _gthis.getAnim("idle"); + r.playAnimation(tmp2,false,$bind(r,r.playIdle)); + onComplete(); + }; + r.playAnimation(tmp,loop,tmp1); + } else { + com_davidmaletz_mining_world_TooltipObject.prototype.playAnimation.call(this,id,onComplete,loop); + } + } + ,runAnimation: function(anim_id,func) { + com_davidmaletz_mining_world_TooltipObject.prototype.runAnimation.call(this,anim_id,func); + if(func != null) { + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("play",anim_id)); + } + } + ,getTileBlock: function(tx,ty) { + return this.area.getTile(tx,ty,0); + } + ,playLoop: function(id) { + if(this.renderer == null) { + return; + } + var r = js_Boot.__cast(this.renderer , com_davidmaletz_mining_npc_NPCRenderer); + r.playAnimation(this.getAnim(id),true); + } + ,beginPath: function() { + if(this.area != null && this.area.isActivePlayer()) { + if(this.renderer != null && this.idle != null) { + this.idle.handleIdle(this.renderer); + } + } else { + this.dispatchEvent(new openfl_events_Event("begin_path")); + } + } + ,moveTalkFrames: null + ,onOver: function(p) { + if(this.talking.get() != null) { + return; + } + com_davidmaletz_mining_world_TooltipObject.prototype.onOver.call(this,p); + this.runEvent("over",p); + if(this.tooltip != null && this.renderer != null && p.renderer != null && !this.renderer.hasTrack(com_davidmaletz_lerp_PositionKeyframe) && this.stopForPlayer(p) && this.moveTalkFrames <= 0) { + this.moveTalk(p,0.75); + this.moveTalkFrames = 30; + } + } + ,onOut: function(p) { + if(this.talking.get() != null) { + return; + } + com_davidmaletz_mining_world_TooltipObject.prototype.onOut.call(this,p); + this.runEvent("out",p); + } + ,onCancel: function(setAnim) { + if(setAnim == null) { + setAnim = true; + } + if(this.idle != null) { + this.idle.onCancel(); + } + if(this.renderer != null) { + if(setAnim) { + this.playAnimation("idle"); + } + this.renderer.clearTrack(com_davidmaletz_mining_world_MoveKeyframe); + this.renderer.finishTrack(com_davidmaletz_lerp_PositionKeyframe); + } + this.dispatchEvent(new openfl_events_Event("idle_cancel")); + } + ,onEnter: function(p) { + if(this.talking.get() != null) { + return; + } + com_davidmaletz_mining_world_TooltipObject.prototype.onEnter.call(this,p); + if(this.renderer != null && p.renderer != null && this.stopForPlayer(p)) { + this.renderer.set_scaleX(-p.renderer.get_scaleX()); + this.onFlip(); + this.onCancel(); + } + this.runEvent("enter",p); + } + ,onExit: function(p) { + com_davidmaletz_mining_world_TooltipObject.prototype.onExit.call(this,p); + if(this.talking.get() != null) { + return; + } + this.runEvent("exit",p); + } + ,canEnter: function(x,y) { + if(this.room != null && !this.room.getInnerBounds().contains(x * com_davidmaletz_tiles_Tile.SIZE,y * com_davidmaletz_tiles_Tile.SIZE)) { + return false; + } + if(this.speed == 0) { + if(x == this.get_tile_x()) { + return y == this.get_tile_y(); + } else { + return false; + } + } else { + return com_davidmaletz_mining_world_TooltipObject.prototype.canEnter.call(this,x,y); + } + } + ,canEnterTile: function(x,y) { + if(this.info.xml.get("underwaterOnly") == "true") { + return this.area.isWater(x,y); + } else if(com_davidmaletz_mining_world_TooltipObject.prototype.canEnterTile.call(this,x,y)) { + return !this.area.isBlockNPC(x,y); + } else { + return false; + } + } + ,runEvent: function(event,p,onComplete,name,value) { + if(name != null) { + this.vars.set(name,value); + } + var a = this.getInfo().getEvent(event,p,this,this.vars,onComplete); + if(a != null) { + a.runAll(); + } else if(onComplete != null) { + onComplete(); + } + } + ,onMoveTalk: function(p) { + this.onCancel(); + } + ,updateIndicator: function() { + if(this.renderer != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_npc_NPCRenderer)).update(); + } + } + ,talking: null + ,endTalk: function() { + this.talking.set(null); + this.updateIndicator(); + if(this.renderer != null) { + var r = js_Boot.__cast(this.renderer , com_davidmaletz_mining_npc_NPCRenderer); + if(r.loop) { + r.playIdle(r); + } + } + } + ,onOperate: function(p) { + if(this.talking.get() != null) { + return; + } + p.hidden.set(null); + if(this.stopForPlayer(p)) { + this.moveTalk(p,0.75); + } + var a = this.getInfo().getEvent("operate",p,this,this.vars); + if(a != null) { + if(com_davidmaletz_mining_Main.isMultiplayer()) { + this.talking.set(p); + } + a.onComplete = a.onStop = $bind(this,this.endTalk); + a.start(); + } + } + ,beginSpeak: function() { + this.playLoop("talk"); + var sfx = this.getInfo().talkSfx; + if(sfx != null && com_davidmaletz_faengfl_RevealText.TEXT_SPEED > 0) { + this.playSFX(sfx); + } + } + ,endSpeak: function(closed) { + if(closed) { + this.playAnimation(com_davidmaletz_tiles_TileAnimation.exists(this.getAnim("listen")) ? "listen" : "idle"); + } + this.stopSFX(); + } + ,playSFX: function(id) { + this.stopSFX(); + if(this.renderer != null) { + this.sound = com_davidmaletz_faengfl_adv_sound_Sound.playLoc(id,this.renderer,null,true); + } + } + ,stopSFX: function(e) { + if(this.sound != null) { + this.sound.stop(); + this.sound = null; + } + } + ,write: function(b) { + com_davidmaletz_mining_world_TooltipObject.prototype.write.call(this,b); + this.inventory.write(b); + } + ,read: function(b,version) { + com_davidmaletz_mining_world_TooltipObject.prototype.read.call(this,b,version); + if(version >= 32) { + this.inventory.read(b,version); + } + } + ,hasPriority: function(p,structure) { + if(this.info.xml.get("structurePriority") == "true") { + return com_davidmaletz_mining_world_TooltipObject.prototype.hasPriority.call(this,p,structure); + } else if(!structure || !com_davidmaletz_mining_Player.TALK_QUEST) { + if(com_davidmaletz_mining_world_TooltipObject.prototype.hasPriority.call(this,p,structure) && this.renderer != null) { + return (js_Boot.__cast(this.renderer , com_davidmaletz_mining_npc_NPCRenderer)).hasQuest(); + } else { + return false; + } + } else { + return com_davidmaletz_mining_world_TooltipObject.prototype.hasPriority.call(this,p,structure); + } + } + ,overObjects: null + ,onPositionChanged: function() { + var _gthis = this; + if(this.area == null) { + return; + } + var ar = []; + var b = this.getBounds(); + this.area.getObjects(b,function(o,rect) { + if(o.info.xml.get("overlapNPC") == "true") { + ar.push(o); + if(_gthis.overObjects.indexOf(o) == -1) { + o.onOver(com_davidmaletz_mining_Main.getLocalPlayer()); + if(_gthis.area == null) { + return true; + } + } + } + return false; + }); + var _g = 0; + var _g1 = this.overObjects; + while(_g < _g1.length) { + var o1 = _g1[_g]; + ++_g; + if(ar.indexOf(o1) == -1) { + o1.onOut(com_davidmaletz_mining_Main.getLocalPlayer()); + } + } + this.overObjects = ar; + } + ,__class__: com_davidmaletz_mining_npc_NPC +}); +var com_davidmaletz_mining_npc__$NPCEventHandler_Dig = function(area,x,y,speed,light,onComplete) { + com_davidmaletz_faengfl_transition_Transition.call(this); + this.area = area; + this.dig_x = x; + this.dig_y = y; + this.light = light; + this.speed = speed; + this.onClose = onComplete; + this.set_visible(false); + this.add(); +}; +$hxClasses["com.davidmaletz.mining.npc._NPCEventHandler.Dig"] = com_davidmaletz_mining_npc__$NPCEventHandler_Dig; +com_davidmaletz_mining_npc__$NPCEventHandler_Dig.__name__ = ["com","davidmaletz","mining","npc","_NPCEventHandler","Dig"]; +com_davidmaletz_mining_npc__$NPCEventHandler_Dig.__super__ = com_davidmaletz_faengfl_transition_Transition; +com_davidmaletz_mining_npc__$NPCEventHandler_Dig.prototype = $extend(com_davidmaletz_faengfl_transition_Transition.prototype,{ + area: null + ,dig_x: null + ,dig_y: null + ,speed: null + ,light: null + ,advanceFrame: function(df) { + com_davidmaletz_faengfl_transition_Transition.prototype.advanceFrame.call(this,df); + if(!this.area.renderer.incBrickBreak(this.dig_x,this.dig_y,df * this.speed,true)) { + this.onEmptySelect(); + } + } + ,onEmptySelect: function() { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + this.area.renderer.endBrickBreak(this.dig_x,this.dig_y,true); + var i = this.area.mine(this.dig_x,this.dig_y,this.area.getTileId(this.dig_x,this.dig_y,0),this.light,null); + if(com_davidmaletz_mining_item_ItemInfo.exists(i)) { + this.area.addObject(com_davidmaletz_mining_world_ObjectInfo.make(i,this.dig_x * com_davidmaletz_tiles_Tile.SIZE,this.dig_y * com_davidmaletz_tiles_Tile.SIZE)); + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + com_davidmaletz_faengfl_transition_Transition.prototype.onEmptySelect.call(this); + } + ,__class__: com_davidmaletz_mining_npc__$NPCEventHandler_Dig +}); +var com_davidmaletz_mining_npc_StormEvent = function(type,power,theta,velocity,frames) { + openfl_events_Event.call(this,type); + this.power = power; + this.theta = theta; + this.velocity = velocity; + this.frames = frames; +}; +$hxClasses["com.davidmaletz.mining.npc.StormEvent"] = com_davidmaletz_mining_npc_StormEvent; +com_davidmaletz_mining_npc_StormEvent.__name__ = ["com","davidmaletz","mining","npc","StormEvent"]; +com_davidmaletz_mining_npc_StormEvent.__super__ = openfl_events_Event; +com_davidmaletz_mining_npc_StormEvent.prototype = $extend(openfl_events_Event.prototype,{ + power: null + ,theta: null + ,velocity: null + ,frames: null + ,__class__: com_davidmaletz_mining_npc_StormEvent +}); +var com_davidmaletz_mining_npc_NPCInfo = function(xml) { + com_davidmaletz_mining_world_ObjectInfo.call(this,xml.get("id"),xml.exists("health") ? com_davidmaletz_mining_Main.parseInt(xml.get("health")) : 0,xml); + this.tile = xml.get("tile"); + this.action = xml.get("action"); + this.talkSfx = xml.get("talk_sfx"); + if(xml.exists("type")) { + var cls = xml.get("type"); + cls = cls.charAt(0).toUpperCase() + HxOverrides.substr(cls,1,null); + var c = Type.resolveClass("com.davidmaletz.mining.npc." + cls); + if(c != null) { + this.type = c; + } + } + var idle_cls = null; + if(xml.exists("idle")) { + idle_cls = xml.get("idle"); + } else { + var i = xml.elementPathsNamed("idle"); + if(i.hasNext()) { + this.idle_xml = i.next(); + idle_cls = this.idle_xml.get("class"); + } + } + if(idle_cls != null) { + var cls1 = idle_cls.charAt(0).toUpperCase() + HxOverrides.substr(idle_cls,1,null); + var c1 = Type.resolveClass("com.davidmaletz.mining.npc." + cls1); + if(c1 != null) { + this.idle = c1; + } + } + var i1 = xml.elementsNamed("tooltip"); + if(i1.hasNext()) { + this.tooltip = i1.next(); + } + var i2 = xml.elementsNamed("light"); + if(i2.hasNext()) { + this.light = new com_davidmaletz_mining_world_LightInfo(i2.next()); + } +}; +$hxClasses["com.davidmaletz.mining.npc.NPCInfo"] = com_davidmaletz_mining_npc_NPCInfo; +com_davidmaletz_mining_npc_NPCInfo.__name__ = ["com","davidmaletz","mining","npc","NPCInfo"]; +com_davidmaletz_mining_npc_NPCInfo.__super__ = com_davidmaletz_mining_world_ObjectInfo; +com_davidmaletz_mining_npc_NPCInfo.prototype = $extend(com_davidmaletz_mining_world_ObjectInfo.prototype,{ + tile: null + ,type: null + ,idle: null + ,action: null + ,talkSfx: null + ,idle_xml: null + ,tooltip: null + ,light: null + ,createTile: function(seed) { + if(com_davidmaletz_tiles_Tile.exists(this.tile)) { + return com_davidmaletz_tiles_Tile.get(this.tile); + } + if(!this.xml.exists("layers")) { + return com_davidmaletz_tiles_EmptyTile.get(); + } + var defaults = com_davidmaletz_mining_Player.getDefaults(this,com_fancyfish_faeng_common_Random.createFromInt(seed)); + return com_davidmaletz_faengfl_LayerManager.create(this.xml.get("layers"),defaults.colors,defaults.offsets).toBitmap(); + } + ,create: function(x,y) { + if(this.type == null) { + return new com_davidmaletz_mining_npc_NPC(this,x,y); + } else { + return Type.createInstance(this.type,[this,x,y]); + } + } + ,createIcon: function() { + return com_davidmaletz_tiles_Tile.get(this.tile); + } + ,getDisplayTile: function() { + if(this.xml.exists("icon")) { + return this.xml.get("icon"); + } else { + return this.tile + " anim=" + this.getAnim("idle"); + } + } + ,getDisplayId: function() { + if(this.xml.exists("title")) { + return this.xml.get("title"); + } else { + return "npc>" + this.id; + } + } + ,getEvent: function(event,p,n,vars,onComplete) { + com_davidmaletz_mining_npc_NPCEventHandler.setPlayerVariables(vars,p); + return com_davidmaletz_mining_Main.getEvent(event,p,this.xml,n,onComplete,vars); + } + ,getAnim: function(id) { + var base = this.xml.exists("animation") ? this.xml.get("animation") + "." : "npc."; + if(this.xml.exists(id + "_anim")) { + return this.xml.get(id + "_anim"); + } else { + var s = this.id + "." + id; + if(com_davidmaletz_tiles_TileAnimation.exists(s)) { + return s; + } else { + return base + id; + } + } + } + ,__class__: com_davidmaletz_mining_npc_NPCInfo +}); +var com_davidmaletz_mining_npc_NPCRenderer = function(n) { + this.__was_owner = true; + this.npc = n; + var i = n.getInfo(); + com_davidmaletz_mining_enemy_AttackRenderer.call(this,n.getTileIcon(),com_davidmaletz_mining_enemy_AttackRenderer.getTargets(i.xml.elementsNamed("target")),this.npc.idle == null ? [] : this.npc.idle.getAttacks(),com_davidmaletz_mining_enemy_AttackRenderer.getFPS(i.xml,10),com_davidmaletz_mining_world_Object.resolveObject(n,"walk")); + this.quest_indicator = new com_davidmaletz_lerp_LerpSpriteFL(); + this.quest_indicator.addChild(new openfl_display_Bitmap(openfl_Assets.getBitmapData("data/ui/quest.png"))); + this.quest_indicator.set_scaleX(-1); + this.quest_indicator.set_x(com_davidmaletz_tiles_Tile.SIZE * 0.25); + this.quest_indicator.set_y(-com_davidmaletz_tiles_Tile.SIZE); + if(i.xml.exists("indicatorX")) { + var _g = this.quest_indicator; + _g.set_x(_g.get_x() + com_davidmaletz_mining_Main.parseInt(i.xml.get("indicatorX"))); + } + if(i.xml.exists("indicatorY")) { + var _g1 = this.quest_indicator; + _g1.set_y(_g1.get_y() + com_davidmaletz_mining_Main.parseInt(i.xml.get("indicatorY"))); + } + this.quest_indicator.set_visible(false); + this.addChild(this.quest_indicator); + this.darken(); +}; +$hxClasses["com.davidmaletz.mining.npc.NPCRenderer"] = com_davidmaletz_mining_npc_NPCRenderer; +com_davidmaletz_mining_npc_NPCRenderer.__name__ = ["com","davidmaletz","mining","npc","NPCRenderer"]; +com_davidmaletz_mining_npc_NPCRenderer.__super__ = com_davidmaletz_mining_enemy_AttackRenderer; +com_davidmaletz_mining_npc_NPCRenderer.prototype = $extend(com_davidmaletz_mining_enemy_AttackRenderer.prototype,{ + npc: null + ,quest_indicator: null + ,fireEvent: function(e) { + this.npc.dispatchEvent(e); + } + ,repeatAttack: function(o) { + var ret = com_davidmaletz_mining_enemy_AttackRenderer.prototype.repeatAttack.call(this,o); + if(!ret) { + this.npc.dispatchEvent(new openfl_events_Event("end_attack")); + } + return ret; + } + ,darken: function() { + this.quest_indicator.lerp(new com_davidmaletz_lerp_DarkenKeyframe(0.75),20,$bind(this,this.brighten)); + } + ,brighten: function() { + this.quest_indicator.lerp(new com_davidmaletz_lerp_DarkenKeyframe(1),20,$bind(this,this.darken)); + } + ,init: function(e) { + com_davidmaletz_mining_enemy_AttackRenderer.prototype.init.call(this,e); + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + p.storehouseInventory.addEventListener("item_added",$bind(this,this.update)); + this.update(); + p.state.addEventListener("add_quest",$bind(this,this.update)); + p.state.addEventListener("complete_quest",$bind(this,this.update)); + p.state.addEventListener("state_changed",$bind(this,this.update)); + p.getStorage("coins").addEventListener("updated",$bind(this,this.update)); + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.handle_frame),false,PriorityManager.getPriority()); + this.npc.runEvent("init",p); + if(this.npc.idle != null) { + this.npc.idle.init(this); + if(this.npc.talking.get() != null) { + this.npc.playLoop("talk"); + } else if(!this.isIdle(true,true) || this.npc.idle.handleIdle(this)) { + this._playIdle(); + } + } + this.npc.onFlip(); + } + ,destroy: function(e) { + com_davidmaletz_mining_enemy_AttackRenderer.prototype.destroy.call(this,e); + if(this.npc.idle != null) { + this.npc.idle.destroy(); + } + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + p.storehouseInventory.removeEventListener("item_added",$bind(this,this.update)); + p.state.removeEventListener("add_quest",$bind(this,this.update)); + p.state.removeEventListener("complete_quest",$bind(this,this.update)); + p.state.removeEventListener("state_changed",$bind(this,this.update)); + p.getStorage("coins").removeEventListener("updated",$bind(this,this.update)); + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.handle_frame)); + } + ,__was_owner: null + ,advanceFrame: function(frames) { + var o = this.isOwner(); + if(o && !this.__was_owner) { + this.playIdle(this); + } + this.__was_owner = o; + if(this.npc.idle != null) { + this.npc.idle.advanceFrame(this,frames); + } + com_davidmaletz_mining_enemy_AttackRenderer.prototype.advanceFrame.call(this,frames); + } + ,_setAnimation: function(anim_id,offX,offY) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + com_davidmaletz_mining_enemy_AttackRenderer.prototype._setAnimation.call(this,anim_id,offX,offY); + this.npc.info.tint(this.anim_sprite); + } + ,hide: function() { + this.quest_indicator.set_visible(false); + } + ,hasQuest: function() { + return this.quest_indicator.get_visible(); + } + ,isIdle: function(inc_y,paused) { + if(paused == null) { + paused = false; + } + if(inc_y == null) { + inc_y = true; + } + var flag = this.npc.info.xml.get("pauseIdle"); + if(flag != null) { + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p != null && p.getFlag(flag)) { + return false; + } + } + if(paused || !com_davidmaletz_mining_Main.isPaused()) { + if(!(com_davidmaletz_mining_Main.isNight() && this.npc.info.xml.get("night") != "true" || this.get_alpha() == 0 || inc_y && !this.npc.area.emptyTile(this.npc.get_tile_x(),this.npc.get_tile_y()))) { + return !this.quest_indicator.get_visible(); + } else { + return true; + } + } else { + return false; + } + } + ,update: function(e) { + var a = this.npc.getInfo().getEvent("operate",com_davidmaletz_mining_Main.getLocalPlayer(),this.npc,this.npc.vars); + var vis = a != null && a.getFirst(["quest","complete"]) != null; + if(this.quest_indicator.hasTrack(com_davidmaletz_lerp_AlphaKeyframe)) { + if((js_Boot.__cast(this.quest_indicator.getLerp(com_davidmaletz_lerp_AlphaKeyframe) , com_davidmaletz_lerp_AlphaKeyframe)).alpha == 1 != vis) { + this.quest_indicator.clearLerp(); + this.quest_indicator.set_alpha(1); + this.quest_indicator.set_visible(vis); + } + } else if(vis != this.quest_indicator.get_visible()) { + if(this.quest_indicator.get_visible()) { + this.quest_indicator.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),10,$bind(this,this.hide)); + } else { + this.quest_indicator.set_visible(true); + this.quest_indicator.set_alpha(0); + this.quest_indicator.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),10); + } + } + } + ,getElement: function() { + return com_davidmaletz_mining_world_Element.get(this.npc.info.xml.get("element")); + } + ,setTile: function(x,y) { + var tmp = x * com_davidmaletz_tiles_Tile.SIZE; + var tmp1 = y * com_davidmaletz_tiles_Tile.SIZE; + var tmp2; + if(com_davidmaletz_mining_Main.isPaused()) { + var f = $bind(this,this.playIdle); + var p = this; + tmp2 = function() { + f(p); + }; + } else { + tmp2 = $bind(this,this.playIdlePaused); + } + this.moveTo(tmp,tmp1,tmp2); + } + ,moveTo: function(x,y,onComplete) { + var dx = x - this.npc.xPos; + if(this.npc.area != null) { + dx = this.npc.area.adjustDx(dx); + } + if(dx == 0 && y == this.npc.yTile) { + return; + } + var anim_id = this.npc.getAnim("walk"); + if(this.animation != anim_id) { + this.setFrame(0); + this.playAnimation(anim_id,true); + } + if(dx != 0) { + this.set_scaleX(dx > 0 ? -this.get_scaleY() : this.get_scaleY()); + this.npc.onFlip(); + } + this.npc.moveTo(x,y,this.npc.speed,onComplete); + } + ,playIdlePaused: function() { + if(this.npc.area == null) { + return; + } + if(this.npc.talking.get() != null || this.npc.idle == null || !this.isIdle(true,true) || this.npc.idle.handleIdle(this)) { + this._playIdle(); + } + } + ,_playIdle: function() { + this.npc.runEvent("onIdle",com_davidmaletz_mining_Main.getLocalPlayer(),$bind(this,this.doPlayIdle)); + } + ,doPlayIdle: function() { + this.setFrame(0); + this.playAnimation(this.npc.getAnim("idle"),false,$bind(this,this.playIdle)); + } + ,playIdle: function(p) { + if(this.npc.area == null) { + return; + } + if(this.npc.talking.get() != null || this.npc.idle == null || !this.isIdle() || this.npc.idle.handleIdle(this)) { + this._playIdle(); + } + } + ,shouldAttack: function(o) { + if(Std["is"](o,com_davidmaletz_mining_enemy_Enemy)) { + return (js_Boot.__cast(o , com_davidmaletz_mining_enemy_Enemy)).canBeAttacked(o,false); + } else { + return false; + } + } + ,getAttackTarget: function(a) { + var r = a.range + this.npc._width; + var b = this.npc.getClosest(r,1,false,$bind(this,this.canAttack),a.type == "breath" ? r >> 1 : 0); + if(b == null || this.getXDistance(b.bounds) > a.range) { + return null; + } else { + return b.object; + } + } + ,getAttacker: function() { + return this.npc; + } + ,onMiss: function(o) { + if(o == null) { + this.npc.showPopup(true,com_fancyfish_faeng_common_Lang.getText("common","miss"),-com_davidmaletz_tiles_Tile.SIZE); + } else { + o.showPopup(true,com_fancyfish_faeng_common_Lang.getText("common","dodged")); + } + com_davidmaletz_mining_world_Object.playObject(this.npc,"miss"); + } + ,isOwner: function() { + if(this.npc.area != null) { + return this.npc.area.isActivePlayer(); + } else { + return false; + } + } + ,getRectangle: function() { + return this.npc.getBounds(); + } + ,getAnim: function(id) { + return this.npc.getAnim(id); + } + ,handle_frame: function(e) { + if(!com_davidmaletz_mining_Main.isPaused()) { + return; + } + if(this.animation == this.npc.getAnim("talk") && this.loop) { + this.incFrame(com_davidmaletz_faengfl_FaengFL.frameTime,true); + } + if(this.hasTrack(com_davidmaletz_lerp_PositionKeyframe)) { + this.tracks.getTrack(com_davidmaletz_lerp_PositionKeyframe).advanceFrame(this,com_davidmaletz_faengfl_FaengFL.frameTime,null); + } + } + ,canEnterFrame: function() { + if(this.animation == this.npc.getAnim("talk") && this.loop) { + return true; + } else { + return com_davidmaletz_mining_enemy_AttackRenderer.prototype.canEnterFrame.call(this); + } + } + ,__class__: com_davidmaletz_mining_npc_NPCRenderer +}); +var com_davidmaletz_mining_npc_Quest = function(xml) { + this.xml = xml; + this.id = xml.get("id"); + this.giver = xml.get("giver"); + this.requires = []; + this.coins = xml.exists("coins") ? com_davidmaletz_mining_Main.parseInt(xml.get("coins")) : 0; + this.exp = xml.exists("exp") ? com_davidmaletz_mining_Main.parseInt(xml.get("exp")) : 0; + this.achievement = xml.get("achievement"); + var e = xml.elements(); + while(e.hasNext()) { + var e1 = e.next(); + var r = com_davidmaletz_mining_npc_Requirement.fromXML(e1.xml); + if(r != null) { + this.requires.push(r); + } + } + if(xml.exists("recipe")) { + var r1 = com_davidmaletz_mining_item_Recipe.get(xml.get("recipe")); + if(r1 != null) { + var req = r1.getRequirements(); + while(req.hasNext()) { + var req1 = req.next(); + this.requires.push(req1); + } + } + } + var i = xml.elementPathsNamed("canComplete"); + if(i.hasNext()) { + this.canComplete = i.next(); + } else { + this.canComplete = null; + } +}; +$hxClasses["com.davidmaletz.mining.npc.Quest"] = com_davidmaletz_mining_npc_Quest; +com_davidmaletz_mining_npc_Quest.__name__ = ["com","davidmaletz","mining","npc","Quest"]; +com_davidmaletz_mining_npc_Quest.quests = null; +com_davidmaletz_mining_npc_Quest.loadQuest = function(e) { + if(com_davidmaletz_mining_npc_Quest.quests == null) { + com_davidmaletz_mining_npc_Quest.quests = new haxe_ds_StringMap(); + } + var q = new com_davidmaletz_mining_npc_Quest(e); + if(com_davidmaletz_mining_npc_Quest.quests.exists(q.id)) { + haxe_Log.trace("Overwrite Quest: " + q.id,{ fileName : "Quest.hx", lineNumber : 35, className : "com.davidmaletz.mining.npc.Quest", methodName : "loadQuest"}); + } + com_davidmaletz_mining_npc_Quest.quests.set(q.id,q); +}; +com_davidmaletz_mining_npc_Quest.get = function(id) { + var ret = com_davidmaletz_mining_npc_Quest._get(id); + if(id != null && id.length > 0 && ret == null) { + haxe_Log.trace("No Quest found: " + id,{ fileName : "Quest.hx", lineNumber : 38, className : "com.davidmaletz.mining.npc.Quest", methodName : "get"}); + } + return ret; +}; +com_davidmaletz_mining_npc_Quest._get = function(id) { + if(id == null || com_davidmaletz_mining_npc_Quest.quests == null) { + return null; + } else { + return com_davidmaletz_mining_npc_Quest.quests.get(id); + } +}; +com_davidmaletz_mining_npc_Quest.exists = function(id) { + if(id != null && com_davidmaletz_mining_npc_Quest.quests != null) { + return com_davidmaletz_mining_npc_Quest.quests.exists(id); + } else { + return false; + } +}; +com_davidmaletz_mining_npc_Quest.reset = function() { + com_davidmaletz_mining_npc_Quest.quests = null; +}; +com_davidmaletz_mining_npc_Quest.prototype = { + id: null + ,giver: null + ,achievement: null + ,requires: null + ,coins: null + ,exp: null + ,canComplete: null + ,xml: null + ,getRequirementById: function(id) { + var _g = 0; + var _g1 = this.requires; + while(_g < _g1.length) { + var r = _g1[_g]; + ++_g; + if(r.id == id) { + return r; + } + } + return null; + } + ,getRequirements: function() { + return HxOverrides.iter(this.requires); + } + ,numRequirements: function() { + return this.requires.length; + } + ,hasCanCompleteEvent: function() { + return this.canComplete != null; + } + ,runCanCompleteEvent: function(p,onComplete) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + new com_davidmaletz_mining_npc_NPCEventHandler(this.canComplete.elements(),p,this,onComplete).runAll(); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + ,getText: function(type,section) { + var m = com_fancyfish_faeng_common_Lang.getTextFromTitle(this.xml.get(type)); + if(m != null) { + return m; + } else if(com_fancyfish_faeng_common_Lang.hasText(section,this.id)) { + return com_fancyfish_faeng_common_Lang.getText(section,this.id); + } else { + var q = com_davidmaletz_mining_npc_Quest._get(this.xml.get("extends")); + if(q == null || q == this) { + return com_fancyfish_faeng_common_Lang.getText(section,this.id); + } else { + return q.getText(type,section); + } + } + } + ,getName: function() { + return this.getText("name","quests"); + } + ,getDesc: function() { + return this.getText("desc","quest.description"); + } + ,__class__: com_davidmaletz_mining_npc_Quest +}; +var com_davidmaletz_mining_npc_Repair = function(npc,xml) { + com_davidmaletz_mining_npc_DefaultNPCIdle.call(this,npc,xml); + if(xml != null) { + var i = xml.elementsNamed("repair"); + if(i.hasNext()) { + this.structures = new haxe_ds_StringMap(); + this.types = new haxe_ds_StringMap(); + var e = i; + while(e.hasNext()) { + var e1 = e.next(); + if(e1.exists("structure")) { + this.structures.set(e1.get("structure"),e1); + } + if(e1.exists("type")) { + this.types.set(e1.get("type"),true); + } + } + } + } + this.visited = []; +}; +$hxClasses["com.davidmaletz.mining.npc.Repair"] = com_davidmaletz_mining_npc_Repair; +com_davidmaletz_mining_npc_Repair.__name__ = ["com","davidmaletz","mining","npc","Repair"]; +com_davidmaletz_mining_npc_Repair.__super__ = com_davidmaletz_mining_npc_DefaultNPCIdle; +com_davidmaletz_mining_npc_Repair.prototype = $extend(com_davidmaletz_mining_npc_DefaultNPCIdle.prototype,{ + visited: null + ,structures: null + ,types: null + ,current: null + ,finishPath: function(npc) { + if(this.current != null && npc.npc._getBounds(com_davidmaletz_mining_world_Object.rectangle).intersects(this.current.getInnerBounds())) { + npc.npc.playAnimation("repair"); + var xml = this.structures.get(this.current.info.id); + var vars = null; + if(xml != null) { + var e = xml.elementsNamed("addItem"); + while(e.hasNext()) { + var e1 = e.next(); + if(e1.exists("if")) { + if(vars == null) { + vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(com_davidmaletz_mining_Main.getLocalPlayer()); + vars.set("this",npc.npc); + } + if(!com_davidmaletz_faengfl_EventHandler._conditionMet(e1.get("if"),vars)) { + continue; + } + } + var i = com_davidmaletz_mining_item_ItemInfo.get(e1.get("id")); + if(i != null) { + this.current.addItem(npc.npc,i,e1.exists("count") ? com_davidmaletz_mining_Main.parseInt(e1.get("count")) : 1); + } + } + } + this.visited.push(this.current); + this.current = null; + return false; + } else { + if(this.current != null) { + this.visited.push(this.current); + this.current = null; + } + return com_davidmaletz_mining_npc_DefaultNPCIdle.prototype.finishPath.call(this,npc); + } + } + ,hasRepairStructure: function() { + var _g = 0; + var _g1 = this.npc.area.getStructuresInBounds(this.npc._getBounds(com_davidmaletz_mining_world_Object.rectangle)); + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + if(this.canVisit(s)) { + return true; + } + } + return false; + } + ,fakeFinishPath: function(npc) { + if(this.hasRepairStructure()) { + npc.npc.playAnimation("repair"); + return false; + } else { + return com_davidmaletz_mining_npc_DefaultNPCIdle.prototype.fakeFinishPath.call(this,npc); + } + } + ,canVisit: function(s) { + if(this.visited.indexOf(s) == -1) { + if(!(this.structures != null && this.structures.exists(s.info.id))) { + if(s.info.xml.exists("repairType") && this.types != null) { + return this.types.exists(s.info.xml.get("repairType")); + } else { + return false; + } + } else { + return true; + } + } else { + return false; + } + } + ,_playIdle: function(npc) { + if(npc.npc.area == null) { + return true; + } + var s = npc.npc.findClosestStructure($bind(this,this.canVisit)); + if(s == null) { + var last = this.current == null ? this.visited.pop() : this.current; + com_fancyfish_faeng_common_Utils.clear(this.visited); + this.visited.push(last); + return true; + } + this.current = s; + if(this.pathfindToStructure(s)) { + return this.playIdle(npc); + } else { + if(this.current != null) { + this.visited.push(this.current); + this.current = null; + } + return true; + } + } + ,__class__: com_davidmaletz_mining_npc_Repair +}); +var com_davidmaletz_mining_npc_Requirement = function(t,n,id,ct,hidden) { + this.type = t; + this.name = n; + this.id = id; + this.count = ct; + this.hidden = hidden; +}; +$hxClasses["com.davidmaletz.mining.npc.Requirement"] = com_davidmaletz_mining_npc_Requirement; +com_davidmaletz_mining_npc_Requirement.__name__ = ["com","davidmaletz","mining","npc","Requirement"]; +com_davidmaletz_mining_npc_Requirement.__interfaces__ = [com_davidmaletz_mining_ui_Iconable]; +com_davidmaletz_mining_npc_Requirement._inLocation = function(p,id,x,y,w,h) { + return com_davidmaletz_mining_npc_Requirement.inLocation(p,id,new openfl_geom_Rectangle(x,y,w,h)); +}; +com_davidmaletz_mining_npc_Requirement.inLocation = function(p,id,r) { + var o = p.vehicle == null ? p : p.vehicle; + if(o.area != null && o.area.id == id) { + return r.contains(o.get_tile_x(),o.get_tile_y()); + } else { + return false; + } +}; +com_davidmaletz_mining_npc_Requirement.makeIcon = function(t,f,xml) { + if(t == null) { + return null; + } + var x = 0; + var y = 0; + if(f != null) { + x = f.x; + y = f.y; + } + var w = t.getTileWidth(x,y); + var h = t.getTileHeight(x,y); + var s = Math.min(1,Math.min(com_davidmaletz_tiles_Tile.SIZE / w,12 / h)); + var ret = null; + var ox = 0.0; + var oy = 0.0; + if(xml != null) { + if(xml.exists("offsetX")) { + ox = com_davidmaletz_mining_Main.parseFloat(xml.get("offsetX")); + } + if(xml.exists("offsetY")) { + oy = com_davidmaletz_mining_Main.parseFloat(xml.get("offsetY")); + } + if(xml.exists("tileScale")) { + s = com_davidmaletz_mining_Main.parseFloat(xml.get("tileScale")); + } + if(xml.exists("animation")) { + ret = new com_davidmaletz_tiles_render_StaticPlayAnimation(t,xml.get("animation"),xml.exists("fps") ? com_davidmaletz_mining_Main.parseFloat(xml.get("fps")) : 10,true,null,(com_davidmaletz_tiles_Tile.SIZE - w) * s * 0.5 / com_davidmaletz_tiles_Tile.SIZE + ox,(10 - h) * s / com_davidmaletz_tiles_Tile.SIZE + oy); + } + } + if(ret == null) { + ret = com_davidmaletz_tiles_Tile.makeIcon(t,(com_davidmaletz_tiles_Tile.SIZE - w) * s * 0.5 / com_davidmaletz_tiles_Tile.SIZE + ox,(10 - h) * s / com_davidmaletz_tiles_Tile.SIZE + oy,x,y); + } + ret.set_scaleX(ret.set_scaleY(s)); + return ret; +}; +com_davidmaletz_mining_npc_Requirement.createItem = function(i,ct,hidden) { + if(hidden == null) { + hidden = false; + } + if(ct == null) { + ct = 1; + } + return new com_davidmaletz_mining_npc_Requirement("item",null,i.id,ct,hidden); +}; +com_davidmaletz_mining_npc_Requirement.fromXML = function(xml,vars) { + var type = xml.get_nodeName(); + var id = xml.get("id"); + var alt = xml.get("alternate"); + if(vars != null) { + id = com_davidmaletz_mining_npc_NPCEventHandler.evalString(id,vars); + } + if(xml.get("defineLater") != "true") { + switch(type) { + case "area": + break; + case "dig": + if(!com_davidmaletz_tiles_Tile.exists(id)) { + return null; + } + if(!com_davidmaletz_tiles_Tile.exists(alt)) { + alt = null; + } + break; + case "flag": + break; + case "item": + if(!com_davidmaletz_mining_item_ItemInfo.exists(id)) { + haxe_Log.trace("No item: " + id,{ fileName : "Requirement.hx", lineNumber : 121, className : "com.davidmaletz.mining.npc.Requirement", methodName : "fromXML"}); + return null; + } + if(!com_davidmaletz_mining_item_ItemInfo.exists(alt)) { + alt = null; + } + break; + case "kill": + if(!com_davidmaletz_mining_world_ObjectInfo.exists(id)) { + return null; + } + if(!com_davidmaletz_mining_world_ObjectInfo.exists(alt)) { + alt = null; + } + break; + case "location": + break; + case "object": + break; + case "script": + break; + case "var": + break; + default: + return null; + } + } + var r = new com_davidmaletz_mining_npc_Requirement(type,xml.get("name"),id,xml.exists("count") ? vars == null ? com_davidmaletz_mining_Main.parseInt(xml.get("count")) : com_davidmaletz_mining_npc_NPCEventHandler.evalInt(xml.get("count"),vars) : 1,xml.get("hidden") == "true"); + r.alternate = alt; + r.xml = xml; + return r; +}; +com_davidmaletz_mining_npc_Requirement.prototype = { + type: null + ,name: null + ,id: null + ,alternate: null + ,count: null + ,hidden: null + ,xml: null + ,isMet: function(p,inv) { + return this.getCount(p,inv == null ? p.storehouseInventory : inv) >= this.count; + } + ,getCount: function(p,inv) { + var ct = this._getCount(p,this.id,inv) + (this.alternate == null ? 0 : this._getCount(p,this.alternate,inv)); + if(p != null && this.type == "item" && this.xml != null && this.xml.get("allowEquipped") == "true") { + if(p.equipment.isEquipped(this.getItem())) { + ++ct; + } + if(this.alternate != null && p.equipment.isEquipped(com_davidmaletz_mining_item_ItemInfo.get(this.alternate))) { + ++ct; + } + } + return ct; + } + ,_getCount: function(p,id,inv) { + if(this.type == "item") { + if(inv == null) { + return 0; + } else { + return inv.getItemCount(com_davidmaletz_mining_item_ItemInfo.get(id)); + } + } else if(p == null) { + return this.count; + } + var _g = this.type; + switch(_g) { + case "area": + if(p.areas.exists(id)) { + return 1; + } else { + return 0; + } + break; + case "dig": + return p.getDigCount(id); + case "flag": + if(p.getFlag(id)) { + return 1; + } else { + return 0; + } + break; + case "kill": + return p.getKillCount(id); + case "location": + if(com_davidmaletz_mining_npc_Requirement.inLocation(p,id,com_davidmaletz_mining_renderer_Parallax.makeRect(this.xml,1))) { + return 1; + } else { + return 0; + } + break; + case "object": + if(p.area != null && p.area.getObject(id) != null) { + return 1; + } else { + return 0; + } + break; + case "script": + return com_davidmaletz_faengfl_EventHandler.execute(id,com_davidmaletz_mining_npc_NPCEventHandler.createVariables(p)); + case "var": + return p.getVar(id); + default: + return 0; + } + } + ,getName: function() { + var ret = com_fancyfish_faeng_common_Lang.getTextFromTitle(this.name); + if(ret != null) { + return ret; + } + var _g = this.type; + if(_g == "item") { + return this.getItem().getName(); + } else { + return com_fancyfish_faeng_common_Lang.getText("quests","unknown_reqs"); + } + } + ,getElement: function() { + var info = this.getItem(); + if(info == null) { + return null; + } else { + return info.getElement(); + } + } + ,createIcon: function() { + if(this.xml != null && com_davidmaletz_tiles_Tile.exists(this.xml.get("tile"))) { + return com_davidmaletz_mining_npc_Requirement.makeIcon(com_davidmaletz_tiles_Tile.get(this.xml.get("tile")),null,this.xml); + } + var o; + var tmp; + if(this.xml != null) { + o = com_davidmaletz_mining_world_ObjectInfo.get(this.xml.get("objectTile")); + tmp = o != null; + } else { + tmp = false; + } + if(tmp) { + return com_davidmaletz_mining_npc_Requirement.makeIcon(o.createIcon(),o.getIconFrame(),this.xml); + } + var _g = this.type; + switch(_g) { + case "dig": + return com_davidmaletz_mining_npc_Requirement.makeIcon(this.getTile(),null,this.xml); + case "item": + return this.getItem().createIcon(); + case "kill": + var o1 = this.getObject(); + return com_davidmaletz_mining_npc_Requirement.makeIcon(o1.createIcon(),o1.getIconFrame(),this.xml); + default: + return null; + } + } + ,hasItems: function(p,inv,ct) { + if(ct == null) { + ct = 1; + } + return this.getCount(p,inv) >= this.count * ct; + } + ,getMaxCount: function(p,inv) { + return Math.floor(this.getCount(p,inv) / this.count); + } + ,useResources: function(inv,ct) { + if(ct == null) { + ct = 1; + } + if(this.type == "item" && inv != null && (this.xml == null || this.xml.get("consume") != "false")) { + var i = this.getItem(); + var rem = this.count * ct; + var ct1 = inv.getItemCount(i); + if(ct1 < rem) { + inv.addItems(i,-ct1); + if(this.alternate != null) { + inv.addItems(com_davidmaletz_mining_item_ItemInfo.get(this.alternate),ct1 - rem); + } + } else { + inv.addItems(i,-rem); + } + } + } + ,addResources: function(inv,ct) { + if(ct == null) { + ct = 1; + } + if(this.type == "item" && inv != null && (this.xml == null || this.xml.get("consume") != "false")) { + inv.addItems(this.getItem(),this.count * ct); + } + } + ,getItem: function() { + if(this.type == "item") { + return com_davidmaletz_mining_item_ItemInfo.get(this.id); + } else { + return null; + } + } + ,hasSeen: function(p) { + if(this.type == "item") { + return p.hasSeenItem(this.id); + } else { + return false; + } + } + ,getObject: function() { + if(this.type == "kill") { + return com_davidmaletz_mining_world_ObjectInfo.get(this.id); + } else { + return null; + } + } + ,getTile: function() { + if(this.type == "dig") { + return com_davidmaletz_tiles_Tile.get(this.id); + } else { + return null; + } + } + ,__class__: com_davidmaletz_mining_npc_Requirement +}; +var com_davidmaletz_mining_npc_TendFarm = function(npc,xml) { + this.frames = 0; + this.farmFrames = 0; + this.harvestCt = 0; + this.loc = null; + this.hoe = 5; + com_davidmaletz_mining_npc_DefaultNPCIdle.call(this,npc,xml); + var e = xml == null ? npc.getInfo().xml : xml; + this.farmIds = new haxe_ds_StringMap(); + if(e.exists("farm")) { + this.farmIds.set(e.get("farm"),true); + } + var f = e.elementsNamed("farm"); + while(f.hasNext()) { + var f1 = f.next(); + this.farmIds.set(f1.get("id"),true); + } +}; +$hxClasses["com.davidmaletz.mining.npc.TendFarm"] = com_davidmaletz_mining_npc_TendFarm; +com_davidmaletz_mining_npc_TendFarm.__name__ = ["com","davidmaletz","mining","npc","TendFarm"]; +com_davidmaletz_mining_npc_TendFarm.__super__ = com_davidmaletz_mining_npc_DefaultNPCIdle; +com_davidmaletz_mining_npc_TendFarm.prototype = $extend(com_davidmaletz_mining_npc_DefaultNPCIdle.prototype,{ + hoe: null + ,loc: null + ,harvestCt: null + ,farmIds: null + ,finishPath: function(npc) { + var s = npc.npc.area.getStructure(npc.npc.getBounds()); + if(this.hoe <= 0 && s != null && this.acceptFarm(s)) { + s.toHarvest = null; + var farm = js_Boot.__cast(s , com_davidmaletz_mining_structure_FarmBase); + this.hoe = 5; + if(this.doHarvest(farm)) { + farm.openClose(); + } + return true; + } else if(this.loc != null && npc.npc.get_tile_x() == this.loc) { + if(this.hoe > 0) { + this.hoe--; + } + this.loc = null; + npc.npc.playAnimation("hoe"); + return false; + } + return com_davidmaletz_mining_npc_DefaultNPCIdle.prototype.finishPath.call(this,npc); + } + ,fakeFinishPath: function(npc) { + var s = npc.npc.area.getStructure(npc.npc.getBounds()); + if(s != null && this.isFarm(s)) { + s.toHarvest = null; + var farm = js_Boot.__cast(s , com_davidmaletz_mining_structure_FarmBase); + this.hoe = 5; + farm.openClose(); + return true; + } else if(s != null && (s.info.id == npc.npc.getInfo().xml.get("operate") || this.isFarm(s) || Std["is"](s,com_davidmaletz_mining_item_Crop))) { + npc.npc.playAnimation("hoe"); + return false; + } else { + return com_davidmaletz_mining_npc_DefaultNPCIdle.prototype.fakeFinishPath.call(this,npc); + } + } + ,doHarvest: function(farm) { + if(this.harvestCt >= farm.getFarmItemCount()) { + this.harvestCt = 0; + } + var i = farm.iterator(); + var _g1 = 0; + var _g = this.harvestCt; + while(_g1 < _g) { + var ct = _g1++; + if(i.hasNext()) { + i.next(); + } + } + var item = i; + while(item.hasNext()) { + var item1 = item.next(); + this.harvestCt++; + if(item1.canHarvest()) { + item1.harvest($bind(this,this.addToStorehouse)); + return true; + } + } + return false; + } + ,acceptFarm: function(s) { + if(this.farmIds.exists(s.info.id)) { + return (js_Boot.__cast(s , com_davidmaletz_mining_structure_FarmBase)).canHarvest(); + } else { + return false; + } + } + ,acceptFarmNoAssign: function(s) { + if(s.toHarvest == null) { + return this.acceptFarm(s); + } else { + return false; + } + } + ,isFarm: function(s) { + return this.farmIds.exists(s.info.id); + } + ,structure1: null + ,structure2: null + ,_playIdle: function(npc) { + if(npc.npc.area == null) { + return true; + } + if(this.hoe <= 0) { + var farm = npc.npc.findClosestStructure($bind(this,this.acceptFarmNoAssign)); + if(farm != null && this.pathfindToStructure(farm)) { + farm.toHarvest = npc.npc; + return this.playIdle(npc); + } else { + this.hoe = 1; + return true; + } + } else { + var o = npc.npc.getInfo().xml.get("operate"); + var operate = o == null ? this.getClosestStructureByClass(com_davidmaletz_mining_item_Crop) : this.getClosestStructureById(o); + var first = true; + if(operate == null || npc.npc.distanceToStructure(npc.npc.getCenterX(),operate) > com_davidmaletz_tiles_Tile.SIZE * 20) { + operate = npc.npc.findClosestStructure($bind(this,this.isFarm)); + first = false; + } + if(operate == null) { + this.hoe = 0; + return true; + } + var didPathfind = false; + if(this.structure1 != operate) { + var _g = 0; + while(_g < 20) { + var i = _g++; + this.loc = operate.get_tile_x() + Math.floor(operate.info.width * Math.random() / com_davidmaletz_tiles_Tile.SIZE); + if(this.loc != npc.npc.get_tile_x()) { + break; + } + } + didPathfind = this.pathfind(this.loc,operate.get_tile_y()); + } + if(didPathfind) { + this.structure1 = null; + return this.playIdle(npc); + } else { + this.structure1 = operate; + if(first) { + operate = npc.npc.findClosestStructure($bind(this,this.isFarm)); + if(operate == null) { + this.hoe = 0; + return true; + } + if(this.structure2 != operate) { + var _g1 = 0; + while(_g1 < 20) { + var i1 = _g1++; + this.loc = operate.get_tile_x() + Math.floor(operate.info.width * Math.random() / com_davidmaletz_tiles_Tile.SIZE); + if(this.loc != npc.npc.get_tile_x()) { + break; + } + } + if(this.pathfind(this.loc,operate.get_tile_y())) { + this.structure2 = null; + return this.playIdle(npc); + } else { + this.structure2 = operate; + } + } + } + return true; + } + } + } + ,farmFrames: null + ,frames: null + ,_handleAway: function(npc,df) { + var xml = npc.getInfo().xml; + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p != null && p.area != null && xml.get("disableAway") == p.area.id) { + return; + } + if(this.farmFrames <= 0) { + this.farmFrames = 50 * npc.speed * com_davidmaletz_tiles_Tile.SIZE; + } + this.frames += df; + if(this.frames > this.farmFrames) { + this.frames = 0; + var farm = npc.findClosestStructure($bind(this,this.acceptFarm)); + if(farm != null) { + this.doHarvest(farm); + } + } + } + ,__class__: com_davidmaletz_mining_npc_TendFarm +}); +var com_davidmaletz_mining_npc_Wander = function(npc,xml) { + com_davidmaletz_mining_npc_DefaultNPCIdle.call(this,npc,xml); + this.right = 1000000; + this.left = -this.right; + this.facing = 1; + if(xml != null) { + if(xml.exists("fromX")) { + this.left = com_davidmaletz_mining_Main.parseInt(xml.get("fromX")); + } + if(xml.exists("toX")) { + this.right = com_davidmaletz_mining_Main.parseInt(xml.get("toX")); + } + if(this.left == this.right) { + this.right = this.left + 1; + } + if(xml.get("facing") == "right") { + this.facing = -1; + } + this.flee = xml.get("flee") == "true"; + this.range = xml.exists("range") ? Math.round(com_davidmaletz_mining_Main.parseFloat(xml.get("range")) * com_davidmaletz_tiles_Tile.SIZE) : 7 * com_davidmaletz_tiles_Tile.SIZE; + } else { + this.flee = false; + } +}; +$hxClasses["com.davidmaletz.mining.npc.Wander"] = com_davidmaletz_mining_npc_Wander; +com_davidmaletz_mining_npc_Wander.__name__ = ["com","davidmaletz","mining","npc","Wander"]; +com_davidmaletz_mining_npc_Wander.isEnemy = function(o) { + return Std["is"](o,com_davidmaletz_mining_enemy_Enemy); +}; +com_davidmaletz_mining_npc_Wander.__super__ = com_davidmaletz_mining_npc_DefaultNPCIdle; +com_davidmaletz_mining_npc_Wander.prototype = $extend(com_davidmaletz_mining_npc_DefaultNPCIdle.prototype,{ + renderer: null + ,left: null + ,right: null + ,flee: null + ,range: null + ,facing: null + ,init: function(npc) { + com_davidmaletz_mining_npc_DefaultNPCIdle.prototype.init.call(this,npc); + this.renderer = npc; + } + ,destroy: function() { + com_davidmaletz_mining_npc_DefaultNPCIdle.prototype.destroy.call(this); + this.renderer = null; + } + ,run_indicator: null + ,runFrom: function(o) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + this.npc.talking.set(null); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + if(!this.isOwner()) { + this.npc.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("run_from",o)); + } else { + this.__runFrom(o); + } + } + ,__runFrom: function(o) { + if(this.renderer != null) { + var dx = com_fancyfish_faeng_common_Utils.sign(o.getCenterX() - this.renderer.npc.getCenterX()); + if(dx != 0) { + this.renderer.set_scaleX(dx); + } + if(this.playIdle(this.renderer)) { + this.renderer.set_scaleX(-dx); + this.playIdle(this.renderer); + } + if(this.run_indicator == null) { + this.run_indicator = new com_davidmaletz_tiles_render_PlayAnimation(com_davidmaletz_tiles_Tile.get("expressions.scared"),"expressions.scared",5,true); + this.run_indicator.set_scaleX(-1); + this.run_indicator.set_x(com_davidmaletz_tiles_Tile.SIZE * 0.25); + this.run_indicator.set_y(-com_davidmaletz_tiles_Tile.SIZE); + } + if(this.run_indicator.parent != this.renderer) { + this.run_indicator.set_alpha(0); + this.renderer.addChild(this.run_indicator); + this.run_indicator.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),10,$bind(this,this.holdIndicator)); + } + } + } + ,holdIndicator: function() { + this.run_indicator.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),30,$bind(this,this.hideIndicator)); + } + ,hideIndicator: function() { + var d = this.run_indicator; + var tmp = function() { + com_davidmaletz_faengfl_FaengFL.remove(d); + }; + this.run_indicator.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),10,tmp); + } + ,advanceFrame: function(npc,frames) { + if(this.flee && (!com_davidmaletz_mining_Main.isNight() || npc.npc.info.xml.get("night") == "true") && !npc.hasTrack(com_davidmaletz_lerp_PositionKeyframe) && (npc.animation == npc.getAnim("idle") || npc.animation == npc.getAnim("walk"))) { + var b = npc.npc.getClosest(this.range,1,true,com_davidmaletz_mining_npc_Wander.isEnemy); + if(b != null && b.object != null && npc.getXDistance(b.bounds) > com_davidmaletz_tiles_Tile.SIZE) { + this.__runFrom(b.object); + } + } + } + ,_playIdle: function(npc) { + return this.wander(npc,this.left,this.right,this.facing); + } + ,__class__: com_davidmaletz_mining_npc_Wander +}); +var com_davidmaletz_mining_npc_event_XmlEvent = function(xml,player,vars) { + this.eventList = null; + this.xml = xml; + this.player = player; + this.vars = vars; + this.area = player.getCurrentArea(); + this.area.addEventListener("unload",$bind(this,this.unload)); +}; +$hxClasses["com.davidmaletz.mining.npc.event.XmlEvent"] = com_davidmaletz_mining_npc_event_XmlEvent; +com_davidmaletz_mining_npc_event_XmlEvent.__name__ = ["com","davidmaletz","mining","npc","event","XmlEvent"]; +com_davidmaletz_mining_npc_event_XmlEvent.prototype = { + xml: null + ,player: null + ,area: null + ,vars: null + ,eventList: null + ,execute: function() { + if(this.xml.get("once") == "true") { + this.kill(); + } + new com_davidmaletz_mining_npc_NPCEventHandler(this.xml.elements(),this.player,null,null,this.vars,this.eventList).runAll(); + } + ,unload: function(e) { + this.kill(); + this.area.removeEventListener("unload",$bind(this,this.unload)); + } + ,kill: function() { + if(this.eventList != null) { + HxOverrides.remove(this.eventList,this); + } + } + ,__class__: com_davidmaletz_mining_npc_event_XmlEvent +}; +var com_davidmaletz_mining_npc_event_CanCompleteEvent = function(xml,player,vars) { + com_davidmaletz_mining_npc_event_XmlEvent.call(this,xml,player,vars); + player.storehouseInventory.addEventListener("item_added",$bind(this,this.update)); + player.state.addEventListener("add_quest",$bind(this,this.update)); + player.state.addEventListener("state_changed",$bind(this,this.update)); + player.getStorage("coins").addEventListener("updated",$bind(this,this.update)); + this.update(null); +}; +$hxClasses["com.davidmaletz.mining.npc.event.CanCompleteEvent"] = com_davidmaletz_mining_npc_event_CanCompleteEvent; +com_davidmaletz_mining_npc_event_CanCompleteEvent.__name__ = ["com","davidmaletz","mining","npc","event","CanCompleteEvent"]; +com_davidmaletz_mining_npc_event_CanCompleteEvent.__super__ = com_davidmaletz_mining_npc_event_XmlEvent; +com_davidmaletz_mining_npc_event_CanCompleteEvent.prototype = $extend(com_davidmaletz_mining_npc_event_XmlEvent.prototype,{ + update: function(e) { + if(this.player.canCompleteQuest(this.xml.get("canComplete"))) { + this.execute(); + } + } + ,kill: function() { + this.player.storehouseInventory.removeEventListener("item_added",$bind(this,this.update)); + this.player.state.removeEventListener("add_quest",$bind(this,this.update)); + this.player.state.removeEventListener("state_changed",$bind(this,this.update)); + this.player.getStorage("coins").removeEventListener("updated",$bind(this,this.update)); + com_davidmaletz_mining_npc_event_XmlEvent.prototype.kill.call(this); + } + ,__class__: com_davidmaletz_mining_npc_event_CanCompleteEvent +}); +var com_davidmaletz_mining_npc_event_MountEvent = function(xml,player,vehicle,vars) { + com_davidmaletz_mining_npc_event_XmlEvent.call(this,xml,player,vars); + if(vehicle == "null") { + vehicle = null; + } + this.vehicle = vehicle; + player.addEventListener("mount",$bind(this,this.mount)); + if(xml.get("autorun") != "false") { + this.mount(null); + } +}; +$hxClasses["com.davidmaletz.mining.npc.event.MountEvent"] = com_davidmaletz_mining_npc_event_MountEvent; +com_davidmaletz_mining_npc_event_MountEvent.__name__ = ["com","davidmaletz","mining","npc","event","MountEvent"]; +com_davidmaletz_mining_npc_event_MountEvent.__super__ = com_davidmaletz_mining_npc_event_XmlEvent; +com_davidmaletz_mining_npc_event_MountEvent.prototype = $extend(com_davidmaletz_mining_npc_event_XmlEvent.prototype,{ + vehicle: null + ,mount: function(e) { + var id = this.player.vehicle == null ? null : this.player.vehicle.info.id; + if(id == this.vehicle) { + this.execute(); + } + } + ,kill: function() { + this.player.removeEventListener("mount",$bind(this,this.mount)); + com_davidmaletz_mining_npc_event_XmlEvent.prototype.kill.call(this); + } + ,__class__: com_davidmaletz_mining_npc_event_MountEvent +}); +var com_davidmaletz_mining_npc_event_OnCompleteEvent = function(xml,player,vars,quest) { + com_davidmaletz_mining_npc_event_XmlEvent.call(this,xml,player,vars); + player.state.addEventListener("complete_quest",$bind(this,this.update)); + this.quest = quest; +}; +$hxClasses["com.davidmaletz.mining.npc.event.OnCompleteEvent"] = com_davidmaletz_mining_npc_event_OnCompleteEvent; +com_davidmaletz_mining_npc_event_OnCompleteEvent.__name__ = ["com","davidmaletz","mining","npc","event","OnCompleteEvent"]; +com_davidmaletz_mining_npc_event_OnCompleteEvent.__super__ = com_davidmaletz_mining_npc_event_XmlEvent; +com_davidmaletz_mining_npc_event_OnCompleteEvent.prototype = $extend(com_davidmaletz_mining_npc_event_XmlEvent.prototype,{ + quest: null + ,update: function(e) { + if(e.value == this.quest) { + this.execute(); + } + } + ,kill: function() { + this.player.state.removeEventListener("complete_quest",$bind(this,this.update)); + com_davidmaletz_mining_npc_event_XmlEvent.prototype.kill.call(this); + } + ,__class__: com_davidmaletz_mining_npc_event_OnCompleteEvent +}); +var com_davidmaletz_mining_npc_event_OnItemEvent = function(xml,player,vars,item) { + com_davidmaletz_mining_npc_event_XmlEvent.call(this,xml,player,vars); + player.inventory.addEventListener("item_added",$bind(this,this.update)); + this.item = item; +}; +$hxClasses["com.davidmaletz.mining.npc.event.OnItemEvent"] = com_davidmaletz_mining_npc_event_OnItemEvent; +com_davidmaletz_mining_npc_event_OnItemEvent.__name__ = ["com","davidmaletz","mining","npc","event","OnItemEvent"]; +com_davidmaletz_mining_npc_event_OnItemEvent.__super__ = com_davidmaletz_mining_npc_event_XmlEvent; +com_davidmaletz_mining_npc_event_OnItemEvent.prototype = $extend(com_davidmaletz_mining_npc_event_XmlEvent.prototype,{ + item: null + ,update: function(e) { + if(e.item == this.item && e.delta > 0) { + this.execute(); + } + } + ,kill: function() { + this.player.inventory.removeEventListener("item_added",$bind(this,this.update)); + com_davidmaletz_mining_npc_event_XmlEvent.prototype.kill.call(this); + } + ,__class__: com_davidmaletz_mining_npc_event_OnItemEvent +}); +var com_davidmaletz_mining_npc_event_OverweightEvent = function(xml,player,vars) { + com_davidmaletz_mining_npc_event_XmlEvent.call(this,xml,player,vars); + player.inventory.addEventListener("item_added",$bind(this,this.item_added)); + this.item_added(null); +}; +$hxClasses["com.davidmaletz.mining.npc.event.OverweightEvent"] = com_davidmaletz_mining_npc_event_OverweightEvent; +com_davidmaletz_mining_npc_event_OverweightEvent.__name__ = ["com","davidmaletz","mining","npc","event","OverweightEvent"]; +com_davidmaletz_mining_npc_event_OverweightEvent.__super__ = com_davidmaletz_mining_npc_event_XmlEvent; +com_davidmaletz_mining_npc_event_OverweightEvent.prototype = $extend(com_davidmaletz_mining_npc_event_XmlEvent.prototype,{ + item_added: function(e) { + if(this.player.inventory.getWeight() > this.player.capacity.get()) { + this.execute(); + } + } + ,kill: function() { + this.player.inventory.removeEventListener("item_added",$bind(this,this.item_added)); + com_davidmaletz_mining_npc_event_XmlEvent.prototype.kill.call(this); + } + ,__class__: com_davidmaletz_mining_npc_event_OverweightEvent +}); +var com_davidmaletz_mining_renderer_AnimalRenderer = function(a,first) { + this.farmItem = null; + this.idleAnim = "single"; + this.growthAnim = null; + com_davidmaletz_tiles_render_PlayAnimation.call(this,null,null,10,true); + this.animal = a; + this.flip = 200 * Math.random(); + this.first = first; +}; +$hxClasses["com.davidmaletz.mining.renderer.AnimalRenderer"] = com_davidmaletz_mining_renderer_AnimalRenderer; +com_davidmaletz_mining_renderer_AnimalRenderer.__name__ = ["com","davidmaletz","mining","renderer","AnimalRenderer"]; +com_davidmaletz_mining_renderer_AnimalRenderer.__super__ = com_davidmaletz_tiles_render_PlayAnimation; +com_davidmaletz_mining_renderer_AnimalRenderer.prototype = $extend(com_davidmaletz_tiles_render_PlayAnimation.prototype,{ + animal: null + ,flip: null + ,first: null + ,growthAnim: null + ,idleAnim: null + ,farmItem: null + ,init: function(e) { + com_davidmaletz_tiles_render_PlayAnimation.prototype.init.call(this,e); + this.animal.addEventListener("update_crop",$bind(this,this.update)); + this.update(null); + } + ,destroy: function(e) { + com_davidmaletz_tiles_render_PlayAnimation.prototype.destroy.call(this,e); + this.animal.removeEventListener("update_crop",$bind(this,this.update)); + if(this.farmItem != null) { + this.farmItem.removeEventListener("update_percent",$bind(this,this.update_grow)); + this.farmItem = null; + } + } + ,update: function(e) { + if(this.farmItem != null) { + this.farmItem.removeEventListener("update_percent",$bind(this,this.update_grow)); + this.farmItem = null; + } + var item = this.animal.getItem(null); + this.clearAll(); + if(item != null) { + this.growthAnim = this.animal.info.xml.get("growthAnim"); + if(this.animal.info.xml.exists("flip")) { + this.set_scaleX(this.animal.info.xml.get("flip") == "pos" ? this.first ? 1 : -1 : 1); + } + var i = this.animal.info.xml.elementsNamed("tile"); + if(i.hasNext()) { + var e1 = i.next(); + this.tile = com_davidmaletz_tiles_Tile.get(e1.get("id")); + if(this.tile == null) { + this.tile = com_davidmaletz_tiles_EmptyTile.get(); + } + var a = e1.get("animation"); + var tmp = e1.exists("x") ? com_davidmaletz_mining_Main.parseFloat(e1.get("x")) : -0.5; + var tmp1 = e1.exists("y") ? com_davidmaletz_mining_Main.parseFloat(e1.get("y")) : -0.8; + this.playAnimation(a == null ? "single" : a,true,null,tmp,tmp1); + } else { + this.tile = item.getTile(); + if(this.tile == null) { + this.tile = com_davidmaletz_tiles_EmptyTile.get(); + } + item.info.tint(this,item.getNameStr()); + var a1 = item.info.getAnimation(item.getNameStr()); + this.playAnimation(a1 == null ? "single" : a1.id,true,null,-0.5,-0.8); + } + if(this.growthAnim != null && this.animal.hasFarmItem()) { + this.idleAnim = this.animation; + this.farmItem = this.animal.getFarmItem(0); + this.farmItem.addEventListener("update_percent",$bind(this,this.update_grow)); + this.update_grow(null); + } + } + } + ,update_grow: function(e) { + if(this.growthAnim != null) { + var p = this.animal.hasFarmItem() ? this.animal.getFarmItem(0).getPercent() : 1; + if(p == 1) { + this.playAnimation(this.idleAnim,true); + } else { + this.playAnimation(this.growthAnim,false); + this.setFrame(p * this.getMaxFrame()); + } + } + } + ,advanceFrame: function(frames) { + if(this.animation == this.growthAnim) { + com_davidmaletz_tiles_render_PlayAnimation.prototype.advanceTracks.call(this,frames); + } else { + com_davidmaletz_tiles_render_PlayAnimation.prototype.advanceFrame.call(this,frames); + } + if(this.animal.info != null && !this.animal.info.xml.exists("flip")) { + this.flip -= frames; + if(this.flip < 0) { + this.flip += 200; + this.set_scaleX(-this.get_scaleX()); + } + } + } + ,__class__: com_davidmaletz_mining_renderer_AnimalRenderer +}); +var com_davidmaletz_tiles_render_ChunkRenderer = function(map,cx,cy,l,neighbors,s) { + this.dirty = false; + com_davidmaletz_faengfl_TileLayer.call(this); + this.map = map; + this.chunk = map.getFloor().getChunk(cx,cy); + this.layer = l; + this.getNeighbors = neighbors; + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); + this.set_scaleX(this.set_scaleY(s)); +}; +$hxClasses["com.davidmaletz.tiles.render.ChunkRenderer"] = com_davidmaletz_tiles_render_ChunkRenderer; +com_davidmaletz_tiles_render_ChunkRenderer.__name__ = ["com","davidmaletz","tiles","render","ChunkRenderer"]; +com_davidmaletz_tiles_render_ChunkRenderer.__super__ = com_davidmaletz_faengfl_TileLayer; +com_davidmaletz_tiles_render_ChunkRenderer.prototype = $extend(com_davidmaletz_faengfl_TileLayer.prototype,{ + chunk: null + ,map: null + ,layer: null + ,dirty: null + ,getNeighbors: null + ,init: function(e) { + this.destroy(null); + this.map.addEventListener("chunk_update",$bind(this,this.chunk_update)); + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.checkDirty)); + this.dirty = true; + this.checkDirty(null); + } + ,destroy: function(e) { + this.map.removeEventListener("chunk_update",$bind(this,this.chunk_update)); + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.checkDirty)); + } + ,isLayer: function(l) { + if(!(this.layer == l || this.layer == -1)) { + return l == -1; + } else { + return true; + } + } + ,chunk_update: function(e) { + if(!this.dirty && (e.chunk == null || e.chunk == this.chunk) && this.isLayer(e.layer)) { + this.dirty = true; + } + } + ,checkDirty: function(e) { + if(this.parent != null && this.parent.get_visible() && this.dirty) { + this.update(); + } + } + ,getTile: function(x,y,l) { + return this.map.getTile(x,y,l); + } + ,render: function(x,y,tx,ty,l,offsetX,offsetY) { + if(offsetY == null) { + offsetY = 0; + } + if(offsetX == null) { + offsetX = 0; + } + var t = this.getTile(x,y,l); + if(t != null) { + var tmp; + if(this.getNeighbors == null) { + tmp = null; + } else { + var f = this.getNeighbors; + var a1 = t; + var a2 = x; + var a3 = y; + var a4 = l; + var a5 = this.map; + tmp = function(a6) { + return f(a1,a2,a3,a4,a5,a6); + }; + } + t._render(tmp,this,tx / this.get_scaleX(),ty / this.get_scaleY(),offsetX,offsetY,x,y); + } + } + ,drawLayers: function(offsetX,offsetY) { + if(offsetY == null) { + offsetY = 0; + } + if(offsetX == null) { + offsetX = 0; + } + var sx = this.chunk.x * 16; + var sy = this.chunk.y * 16; + if(this.layer < 0) { + var _g = 0; + while(_g < 16) { + var ty = _g++; + var _g1 = 0; + while(_g1 < 16) { + var tx = _g1++; + var _g2 = 0; + while(_g2 < 4) { + var l = _g2++; + this.render(sx + tx,sy + ty,tx,ty,l,offsetX,offsetY); + } + } + } + } else { + var _g3 = 0; + while(_g3 < 16) { + var ty1 = _g3++; + var _g11 = 0; + while(_g11 < 16) { + var tx1 = _g11++; + this.render(sx + tx1,sy + ty1,tx1,ty1,this.layer,offsetX,offsetY); + } + } + } + } + ,update: function() { + this.start(); + this.drawLayers(); + this.finish(); + this.dirty = false; + } + ,__class__: com_davidmaletz_tiles_render_ChunkRenderer +}); +var com_davidmaletz_mining_renderer_AnimatedChunk = function(map,cx,cy,l,neighbors,a,s) { + com_davidmaletz_tiles_render_ChunkRenderer.call(this,map,cx,cy,l,neighbors,s); + this.animation = a; + var frames = this.animation.getFrameCount(); + var ret = a.color == null ? null : Std.parseInt("0x" + a.color); + var c = ret == null ? 16777215 : ret; + if(c != 16777215 || a.colorScale != 1) { + com_davidmaletz_faengfl_TextSprite.setColor(this,c,255 / a.colorScale); + } + this.current = 0; + var _g1 = 0; + var _g = frames; + while(_g1 < _g) { + var f = _g1++; + var frame = this.animation.getFrame(f); + var s1 = frame.glow ? new com_davidmaletz_faengfl_GlowSprite() : new openfl_display_Sprite(); + s1.set_visible(f == this.current); + this.addChild(s1); + } +}; +$hxClasses["com.davidmaletz.mining.renderer.AnimatedChunk"] = com_davidmaletz_mining_renderer_AnimatedChunk; +com_davidmaletz_mining_renderer_AnimatedChunk.__name__ = ["com","davidmaletz","mining","renderer","AnimatedChunk"]; +com_davidmaletz_mining_renderer_AnimatedChunk.__super__ = com_davidmaletz_tiles_render_ChunkRenderer; +com_davidmaletz_mining_renderer_AnimatedChunk.prototype = $extend(com_davidmaletz_tiles_render_ChunkRenderer.prototype,{ + current: null + ,animation: null + ,update: function() { + var frames = this.animation.getFrameCount(); + var _g1 = 0; + var _g = frames; + while(_g1 < _g) { + var f = _g1++; + var s = js_Boot.__cast(this.getChildAt(f) , openfl_display_Sprite); + var frame = this.animation.getFrame(f); + s.get_graphics().clear(); + if(frame.visible) { + this.handler.start(s.get_graphics()); + this.drawLayers(frame.x,frame.y); + this.handler.finish(); + } + } + this.dirty = false; + } + ,updateFrame: function(frame) { + var c = this.animation.getFrameAtTime(frame * 0.16666666666666666); + if(c != this.current) { + this.getChildAt(this.current).set_visible(false); + this.current = c; + this.getChildAt(this.current).set_visible(true); + } + } + ,__class__: com_davidmaletz_mining_renderer_AnimatedChunk +}); +var com_davidmaletz_tiles_render_FloorRenderer = function(m,l,neighbors,autosetView,s) { + if(s == null) { + s = 1; + } + if(autosetView == null) { + autosetView = true; + } + com_davidmaletz_faengfl_InitSprite.call(this); + this.map = m; + this.layer = l; + this.chunks = new haxe_ds_IntMap(); + this.autosetView = autosetView; + this.scale = s; + this.getNeighbors = neighbors == null ? com_davidmaletz_tiles_Neighbors.get : neighbors; +}; +$hxClasses["com.davidmaletz.tiles.render.FloorRenderer"] = com_davidmaletz_tiles_render_FloorRenderer; +com_davidmaletz_tiles_render_FloorRenderer.__name__ = ["com","davidmaletz","tiles","render","FloorRenderer"]; +com_davidmaletz_tiles_render_FloorRenderer.point = null; +com_davidmaletz_tiles_render_FloorRenderer.__super__ = com_davidmaletz_faengfl_InitSprite; +com_davidmaletz_tiles_render_FloorRenderer.prototype = $extend(com_davidmaletz_faengfl_InitSprite.prototype,{ + map: null + ,chunks: null + ,layer: null + ,bounds: null + ,getNeighbors: null + ,autosetView: null + ,scale: null + ,init: function(e) { + this.destroy(e); + this.map.addEventListener("chunk_update",$bind(this,this.chunk_update)); + if(this.autosetView) { + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.handle_frame)); + this.handle_frame(null); + } + } + ,destroy: function(e) { + this.map.removeEventListener("chunk_update",$bind(this,this.chunk_update)); + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.handle_frame)); + if(this.autosetView) { + var c = this.chunks.iterator(); + while(c.hasNext()) { + var c1 = c.next(); + this.removeChild(c1); + } + this.chunks = new haxe_ds_IntMap(); + this.bounds = null; + } + } + ,chunk_update: function(e) { + if(e.chunk == null) { + return; + } + var cx = e.chunk.x; + var cy = e.chunk.y; + var s = 16 * com_davidmaletz_tiles_Tile.SIZE; + var stX = Math.floor(this.bounds.x / s); + var endX = Math.floor((this.bounds.x + this.bounds.width) / s) + 1; + var stY = Math.floor(this.bounds.y / s); + var endY = Math.floor((this.bounds.y + this.bounds.height) / s) + 1; + if(cx >= stX && cy >= stY && cx < endX && cy < endY) { + this.showChunk(cx,cy); + } + } + ,createChunk: function(cx,cy) { + return new com_davidmaletz_tiles_render_ChunkRenderer(this.map,cx,cy,this.layer,this.getNeighbors,this.scale); + } + ,getIndex: function(y) { + var len = this.get_numChildren(); + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + if(this.getChildAt(i).get_y() >= y) { + return i; + } + } + return len; + } + ,showChunk: function(cx,cy) { + var i = com_fancyfish_faeng_common_Utils.getIdx(cx,cy); + if(!this.chunks.exists(i) && this.map.getFloor().hasChunk(cx,cy)) { + var c = this.createChunk(cx,cy); + var s = 16 * com_davidmaletz_tiles_Tile.SIZE; + c.set_x(cx * s); + c.set_y(cy * s); + var idx = this.getIndex(c.get_y()); + this.chunks.set(i,c); + this.addChildAt(c,idx); + } + } + ,setView: function(x,y,w,h) { + if(this.bounds == null) { + this.bounds = new openfl_geom_Rectangle(x,y,w,h); + } else { + if(this.bounds.x == x && this.bounds.y == y && this.bounds.width == w && this.bounds.height == h) { + return; + } + this.bounds.setTo(x,y,w,h); + } + var s = 16 * com_davidmaletz_tiles_Tile.SIZE; + var stX = Math.floor(x / s); + var endX = Math.floor((x + w) / s) + 1; + var stY = Math.floor(y / s); + var endY = Math.floor((y + h) / s) + 1; + var k = this.chunks.keys(); + while(k.hasNext()) { + var k1 = k.next(); + var c = this.chunks.get(k1); + var chunk = Reflect.field(c,"chunk"); + var x1 = chunk.x; + var y1 = chunk.y; + if(x1 < stX || y1 < stY || x1 >= endX || y1 >= endY) { + this.chunks.remove(k1); + this.removeChild(c); + } + } + var _g1 = stY; + var _g = endY; + while(_g1 < _g) { + var ty = _g1++; + var _g3 = stX; + var _g2 = endX; + while(_g3 < _g2) { + var tx = _g3++; + this.showChunk(tx,ty); + } + } + } + ,handle_frame: function(e) { + if(this.parent == null) { + return; + } + if(com_davidmaletz_tiles_render_FloorRenderer.point == null) { + com_davidmaletz_tiles_render_FloorRenderer.point = new openfl_geom_Point(); + } + var w = openfl_Lib.current.stage.stageWidth; + var h = openfl_Lib.current.stage.stageHeight; + com_davidmaletz_tiles_render_FloorRenderer.point.setTo(0,0); + var p = this.globalToLocal(com_davidmaletz_tiles_render_FloorRenderer.point); + var x = p.x; + var y = p.y; + com_davidmaletz_tiles_render_FloorRenderer.point.setTo(w,h); + var p1 = this.globalToLocal(com_davidmaletz_tiles_render_FloorRenderer.point); + this.setView(x,y,p1.x - x,p1.y - y); + } + ,__class__: com_davidmaletz_tiles_render_FloorRenderer +}); +var com_davidmaletz_mining_renderer_AnimatedFloorRenderer = function(m,l,anim,neighbors,scale) { + if(scale == null) { + scale = 1; + } + this.frame = 0; + com_davidmaletz_tiles_render_FloorRenderer.call(this,m,l,neighbors,true,scale); + this.animation = anim; +}; +$hxClasses["com.davidmaletz.mining.renderer.AnimatedFloorRenderer"] = com_davidmaletz_mining_renderer_AnimatedFloorRenderer; +com_davidmaletz_mining_renderer_AnimatedFloorRenderer.__name__ = ["com","davidmaletz","mining","renderer","AnimatedFloorRenderer"]; +com_davidmaletz_mining_renderer_AnimatedFloorRenderer.__interfaces__ = [com_davidmaletz_faengfl_EnterFrameHandler]; +com_davidmaletz_mining_renderer_AnimatedFloorRenderer.__super__ = com_davidmaletz_tiles_render_FloorRenderer; +com_davidmaletz_mining_renderer_AnimatedFloorRenderer.prototype = $extend(com_davidmaletz_tiles_render_FloorRenderer.prototype,{ + animation: null + ,frame: null + ,init: function(e) { + com_davidmaletz_tiles_render_FloorRenderer.prototype.init.call(this,e); + com_davidmaletz_faengfl_FaengFL.addEnterFrame(this); + } + ,destroy: function(e) { + com_davidmaletz_tiles_render_FloorRenderer.prototype.destroy.call(this,e); + com_davidmaletz_faengfl_FaengFL.removeEnterFrame(this); + } + ,createChunk: function(cx,cy) { + return new com_davidmaletz_mining_renderer_AnimatedChunk(this.map,cx,cy,this.layer,this.getNeighbors,this.animation,this.scale); + } + ,enter_frame: function(frames) { + this.setFrame(this.frame + frames); + } + ,getMaxFrame: function() { + return this.animation.getMaxTime() / 0.16666666666666666; + } + ,setFrame: function(f) { + f = com_fancyfish_faeng_common_Utils.mod(f,this.getMaxFrame()); + if(f != this.frame) { + this.frame = f; + var c = this.chunks.iterator(); + while(c.hasNext()) { + var c1 = c.next(); + (js_Boot.__cast(c1 , com_davidmaletz_mining_renderer_AnimatedChunk)).updateFrame(this.frame); + } + } + } + ,__class__: com_davidmaletz_mining_renderer_AnimatedFloorRenderer +}); +var com_davidmaletz_mining_renderer_Animation = function(path,xml,o,runPaused,v) { + com_davidmaletz_faengfl_EventHandler.call(this,new com_davidmaletz_faengfl_ENode(xml.elements(),path),$bind(this,this.remove),v); + this.runPaused = runPaused; + if(runPaused) { + this.sprite = new com_davidmaletz_lerp_LerpSprite(); + } else { + this.sprite = new com_davidmaletz_lerp_LerpSpriteFL(); + } + if(o != null) { + this.vars.set("this",o); + } + this.sprite.addEventListener("addedToStage",$bind(this,this.init)); +}; +$hxClasses["com.davidmaletz.mining.renderer.Animation"] = com_davidmaletz_mining_renderer_Animation; +com_davidmaletz_mining_renderer_Animation.__name__ = ["com","davidmaletz","mining","renderer","Animation"]; +com_davidmaletz_mining_renderer_Animation.__super__ = com_davidmaletz_faengfl_EventHandler; +com_davidmaletz_mining_renderer_Animation.prototype = $extend(com_davidmaletz_faengfl_EventHandler.prototype,{ + sprite: null + ,runPaused: null + ,init: function(e) { + this.start(); + } + ,remove: function() { + com_davidmaletz_faengfl_FaengFL.remove(this.sprite); + } + ,setSpriteParams: function(s,n) { + if(n.exists("alpha")) { + s.set_alpha(com_davidmaletz_mining_Main.parseFloat(n.get("alpha"))); + } + } + ,makeAnim: function(n) { + var t = com_davidmaletz_tiles_Tile.get(n.exists("tile") ? com_davidmaletz_mining_npc_NPCEventHandler.evalString(n.get("tile"),this.vars) : n.get("id")); + var offsetX = n.exists("offsetX") ? com_davidmaletz_mining_Main.parseFloat(n.get("offsetX")) : 0; + var offsetY = n.exists("offsetY") ? com_davidmaletz_mining_Main.parseFloat(n.get("offsetY")) : 0; + var s = new com_davidmaletz_mining_renderer__$Animation_MyPlayAnimation(t,n.exists("animation") ? com_davidmaletz_mining_npc_NPCEventHandler.evalString(n.get("animation"),this.vars) : "single",n.exists("fps") ? com_davidmaletz_mining_Main.parseFloat(n.get("fps")) : 15,this.runPaused,offsetX,offsetY); + if(n.exists("x")) { + s.set_x(com_davidmaletz_mining_Main.parseInt(n.get("x"))); + } + if(n.exists("y")) { + s.set_y(com_davidmaletz_mining_Main.parseInt(n.get("y"))); + } + this.setSpriteParams(s,n); + return s; + } + ,handleNode: function(n) { + if(this.sprite.stage == null) { + return true; + } + var modal = n.get("modal") == "true"; + var id = n.get("id"); + var _g = n.get_nodeName(); + switch(_g) { + case "add": + var s = this.makeAnim(n); + if(id != null) { + this.vars.set(id,s); + } + this.sprite.addChild(s); + break; + case "lerp": + var f = Math.round(com_davidmaletz_mining_npc_NPCEventHandler.parseFrames(n)); + if(f > 0) { + var first = true; + var s1 = id != null && this.vars.get(id) != null ? js_Boot.__cast(this.vars.get(id) , com_davidmaletz_lerp_LerpSpriteFL) : this.sprite; + if(n.exists("alpha")) { + s1.lerp(new com_davidmaletz_lerp_AlphaKeyframe(com_davidmaletz_mining_Main.parseFloat(n.get("alpha"))),f,first && modal ? $bind(this,this.handleNext) : null); + first = false; + } + if(modal) { + return !first; + } else { + return false; + } + } + break; + case "play": + (js_Boot.__cast(this.vars.get(id) , com_davidmaletz_mining_renderer__$Animation_MyPlayAnimation)).play(com_davidmaletz_mining_npc_NPCEventHandler.evalString(n.get("animation"),this.vars),!modal && n.get("loop") == "true",modal ? $bind(this,this.handleNext) : null); + return modal; + case "sprite": + var s2 = id != null && this.vars.get(id) != null ? js_Boot.__cast(this.vars.get(id) , com_davidmaletz_lerp_LerpSpriteFL) : this.sprite; + this.setSpriteParams(s2,n); + break; + case "wait": + var f1 = Math.round(com_davidmaletz_mining_npc_NPCEventHandler.parseFrames(n)); + if(f1 > 0) { + this.sprite.lerp(new com_davidmaletz_lerp_AlphaKeyframe(this.sprite.get_alpha()),f1,$bind(this,this.handleNext)); + return true; + } + break; + default: + return com_davidmaletz_faengfl_EventHandler.prototype.handleNode.call(this,n); + } + return false; + } + ,__class__: com_davidmaletz_mining_renderer_Animation +}); +var com_davidmaletz_mining_renderer__$Animation_MyPlayAnimation = function(tile,anim,fps,runPaused,offX,offY) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + com_davidmaletz_tiles_render_PlayAnimation.call(this,tile,anim,fps,true,null,offX,offY); + this.offsetX = offX; + this.offsetY = offY; + this.runPaused = runPaused; +}; +$hxClasses["com.davidmaletz.mining.renderer._Animation.MyPlayAnimation"] = com_davidmaletz_mining_renderer__$Animation_MyPlayAnimation; +com_davidmaletz_mining_renderer__$Animation_MyPlayAnimation.__name__ = ["com","davidmaletz","mining","renderer","_Animation","MyPlayAnimation"]; +com_davidmaletz_mining_renderer__$Animation_MyPlayAnimation._complete = function(complete,p) { + complete(); +}; +com_davidmaletz_mining_renderer__$Animation_MyPlayAnimation.__super__ = com_davidmaletz_tiles_render_PlayAnimation; +com_davidmaletz_mining_renderer__$Animation_MyPlayAnimation.prototype = $extend(com_davidmaletz_tiles_render_PlayAnimation.prototype,{ + offsetX: null + ,offsetY: null + ,runPaused: null + ,play: function(anim,loop,complete) { + this.setFrame(0); + var tmp; + if(complete == null) { + tmp = null; + } else { + var a1 = complete; + tmp = function(p) { + com_davidmaletz_mining_renderer__$Animation_MyPlayAnimation._complete(a1,p); + }; + } + com_davidmaletz_tiles_render_PlayAnimation.prototype.playAnimation.call(this,anim,loop,tmp,this.offsetX,this.offsetY); + } + ,init: function(e) { + if(this.runPaused) { + this.destroy(null); + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.handle_frame),false,PriorityManager.getPriority()); + } else { + com_davidmaletz_tiles_render_PlayAnimation.prototype.init.call(this,e); + } + } + ,destroy: function(e) { + if(this.runPaused) { + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.handle_frame)); + } else { + com_davidmaletz_tiles_render_PlayAnimation.prototype.destroy.call(this,e); + } + } + ,handle_frame: function(e) { + this.enter_frame(com_davidmaletz_faengfl_FaengFL.frameTime); + } + ,__class__: com_davidmaletz_mining_renderer__$Animation_MyPlayAnimation +}); +var com_davidmaletz_mining_renderer_AreaRenderer = function(area) { + this.break_map = new haxe_ds_IntMap(); + this.weather = new haxe_ds_StringMap(); + com_davidmaletz_lerp_LerpSpriteFL.call(this); + this.area = area; + this.back = new openfl_display_Sprite(); + this.parallax_back = this.back; + if(area.vehicle != null) { + var i = area.vehicle.getRideableInfo(); + var p = area.vehicle.info.xml.get("showInterior") == "false" ? null : com_davidmaletz_mining_world_vehicle_BGVehicleRenderer.create(area.vehicle,i); + var s = new com_davidmaletz_mining_renderer_VehicleAreaRenderer(this,area.vehicle); + this.parallax_back = new openfl_display_Sprite(); + this.parallax_back.addChild(s.back); + this.addChild(s); + if(p != null) { + p.set_x(i.interior.offsetX); + p.set_y(i.interior.offsetY); + com_davidmaletz_lerp_DarkenKeyframe.setDarkness(p,0.3); + this.addChild(p); + } + } + var scale = area.getTileScale(); + var f = com_davidmaletz_mining_renderer_AreaRenderer.floorRenderer(area,3,area.getTileAnim(),scale); + com_davidmaletz_lerp_DarkenKeyframe.setDarkness(f,area.getBackDarkness()); + this.addChild(f); + var t = area.getWaterAnim(); + if(t != null) { + this.addChild(new com_davidmaletz_mining_renderer_WaterFloorRenderer(area,t)); + } + if(this.parallax_back != this.back) { + if(area.vehicle.info.xml.get("backAboveTiles") == "true") { + this.addChild(this.back); + } else { + this.addChildAt(this.back,2); + } + } + this.structures = new openfl_display_Sprite(); + this.addChild(this.structures); + this.addChild(com_davidmaletz_mining_renderer_AreaRenderer.floorRenderer(area,0,area.getTileAnim(),scale)); + this.addChild(com_davidmaletz_mining_renderer_AreaRenderer.floorRenderer(area,1,area.getOreAnim(),scale)); + this.tiles = new openfl_display_Sprite(); + this.addChild(this.tiles); + this.addChild(new com_davidmaletz_mining_renderer_ObjectLayerRenderer(this,area.objects)); + this.over_objects = new openfl_display_Sprite(); + this.addChild(this.over_objects); + this.addChild(new com_davidmaletz_mining_renderer_ProjectilesRenderer(area)); + var t1 = area.getWaterBlockAnim(); + if(t1 != null) { + this.addChild(new com_davidmaletz_mining_renderer_WaterBlockRenderer(area,t1)); + } + if(area.showLightTiles()) { + this.addChild(new com_davidmaletz_mining_renderer_LightFloorRenderer(area)); + } + var t2 = area.getInvisibleBlockAnim(); + if(t2 != null) { + this.addChild(new com_davidmaletz_mining_renderer_InvisibleFloorRenderer(area,t2)); + } + var p1 = com_davidmaletz_mining_Main.getLocalPlayer(); + if(StringTools.endsWith(area.id,".station") && p1 != null && p1.areas.exists(area.id.substring(0,area.id.length - 8))) { + var a = p1.areas.get(area.id.substring(0,area.id.length - 8)); + this.loopSprites = []; + var o = a.objects.iterator(); + while(o.hasNext()) { + var o1 = o.next(); + if(Std["is"](o1,com_davidmaletz_mining_world_vehicle_Vehicle)) { + var s1 = (js_Boot.__cast(o1 , com_davidmaletz_mining_world_vehicle_Vehicle)).getStation(); + this.parallax_back.addChild(s1); + this.loopSprites.push(s1); + } + } + } +}; +$hxClasses["com.davidmaletz.mining.renderer.AreaRenderer"] = com_davidmaletz_mining_renderer_AreaRenderer; +com_davidmaletz_mining_renderer_AreaRenderer.__name__ = ["com","davidmaletz","mining","renderer","AreaRenderer"]; +com_davidmaletz_mining_renderer_AreaRenderer.floorRenderer = function(area,layer,anim,scale) { + if(!com_davidmaletz_mining_Main.ALLOW_FLASH || anim == null || anim == "single" || !com_davidmaletz_tiles_TileAnimation.exists(anim)) { + return new com_davidmaletz_tiles_render_FloorRenderer(area,layer,null,null,scale); + } else { + return new com_davidmaletz_mining_renderer_AnimatedFloorRenderer(area,layer,com_davidmaletz_tiles_TileAnimation.get(anim),null,scale); + } +}; +com_davidmaletz_mining_renderer_AreaRenderer.updateLoop = function(renderer,area) { + var loop; + var tmp; + if(area != null && area.renderer != null) { + loop = area.getLoop(); + tmp = loop > 0; + } else { + tmp = false; + } + if(tmp) { + var b = renderer.__unused; + if(b == null) { + b = renderer.getBounds(null); + renderer.__unused = b; + b.inflate(128.,128.); + } + var left = renderer.get_x() + b.get_left(); + var right = renderer.get_x() + b.get_right(); + loop *= com_davidmaletz_tiles_Tile.SIZE; + if(right < -area.renderer.get_x()) { + var _g = renderer; + _g.set_x(_g.get_x() + loop); + } else if(left > 256 * com_davidmaletz_mining_Main.getGameScale() - area.renderer.get_x()) { + var _g1 = renderer; + _g1.set_x(_g1.get_x() - loop); + } + } +}; +com_davidmaletz_mining_renderer_AreaRenderer.__super__ = com_davidmaletz_lerp_LerpSpriteFL; +com_davidmaletz_mining_renderer_AreaRenderer.prototype = $extend(com_davidmaletz_lerp_LerpSpriteFL.prototype,{ + area: null + ,structures: null + ,over_objects: null + ,back: null + ,tiles: null + ,light: null + ,weather: null + ,loopSprites: null + ,parallax_back: null + ,_player: null + ,init: function(e) { + com_davidmaletz_lerp_LerpSpriteFL.prototype.init.call(this,e); + this.area.addEventListener("add_structure",$bind(this,this.add_structure)); + this.area.addEventListener("rem_structure",$bind(this,this.rem_structure)); + this.area.load(this); + this.updateStructures(); + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.enterFrame)); + this.enterFrame(null); + this.updateHidden(null); + this._player = com_davidmaletz_mining_Main.getLocalPlayer(); + this._player.viewHiddenEq.addEventListener("updated",$bind(this,this.updateHidden)); + } + ,destroy: function(e) { + com_davidmaletz_lerp_LerpSpriteFL.prototype.destroy.call(this,e); + this.area.removeEventListener("add_structure",$bind(this,this.add_structure)); + this.area.removeEventListener("rem_structure",$bind(this,this.rem_structure)); + this.area.unload(); + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.enterFrame)); + if(this._player != null) { + this._player.viewHiddenEq.removeEventListener("updated",$bind(this,this.updateHidden)); + } + } + ,updateHidden: function(e) { + com_davidmaletz_mining_world_Generate.runAction("updateHidden",this,com_davidmaletz_mining_Main.getLocalPlayer(),81,this.area); + } + ,enterFrame: function(e) { + this.parallax_back.set_x(this.get_x()); + this.parallax_back.set_y(this.get_y()); + if(this.stage == null) { + return; + } + var PAD = com_davidmaletz_tiles_Tile.SIZE * 3; + com_davidmaletz_mining_renderer_AreaRenderer.point.setTo(0,0); + var st = this.globalToLocal(com_davidmaletz_mining_renderer_AreaRenderer.point); + var sx = st.x - PAD; + var sy = st.y - PAD; + com_davidmaletz_mining_renderer_AreaRenderer.point.setTo(this.stage.stageWidth,this.stage.stageHeight); + var end = this.globalToLocal(com_davidmaletz_mining_renderer_AreaRenderer.point); + var ex = end.x + PAD; + var ey = end.y + PAD; + com_davidmaletz_mining_world_Object.rectangle.setTo(sx,sy,ex - sx,ey - sy); + if(this.loopSprites != null) { + var _g = 0; + var _g1 = this.loopSprites; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + com_davidmaletz_mining_renderer_AreaRenderer.updateLoop(s,this.area); + } + } + var o = this.area.getStructures(); + while(o.hasNext()) { + var o1 = o.next(); + var r = o1.renderer; + if(r != null) { + r.set_visible(false); + } + } + this.area.structures.getObjects(com_davidmaletz_mining_world_Object.rectangle,function(o2,rect) { + var r1 = o2.renderer; + if(r1 != null) { + r1.set_visible(true); + o2.updateRendererLoop(); + } + return false; + }); + var o3 = this.area.objects.iterator(); + while(o3.hasNext()) { + var o4 = o3.next(); + var r2 = o4.renderer; + if(r2 != null) { + r2.set_visible(false); + } + } + this.area.objects.getObjects(com_davidmaletz_mining_world_Object.rectangle,function(o5,rect1) { + var r3 = o5.renderer; + if(r3 != null) { + r3.set_visible(true); + o5.updateRendererLoop(); + } + return false; + }); + var l = this.area.lights.iterator(); + while(l.hasNext()) { + var l1 = l.next(); + var r4 = l1.renderer; + if(r4 != null) { + r4.set_visible(false); + } + } + this.area.lights.getObjects(com_davidmaletz_mining_world_Object.rectangle,function(l2,rect2) { + var r5 = l2.renderer; + if(r5 != null) { + r5.set_visible(true); + l2.updateRendererLoop(); + } + return false; + }); + } + ,updateStructures: function() { + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this.structures); + var s = this.area.getStructures(); + while(s.hasNext()) { + var s1 = s.next(); + this.addStructure(s1); + } + } + ,add_structure: function(e) { + this.addStructure(e.value); + } + ,rem_structure: function(e) { + var r = (js_Boot.__cast(e.value , com_davidmaletz_mining_structure_Structure)).getRenderer(); + if(r != null && (r.parent == this.structures || r.parent == this.back || r.parent == this.over_objects || r.parent == this.tiles)) { + r.parent.removeChild(r); + } + } + ,addStructure: function(structure) { + var s = structure.isBack() ? this.back : this.structures; + if(structure.info.xml.get("onTop") == "true") { + s = this.over_objects; + } else if(structure.info.xml.get("tileLayer") == "true") { + s = this.tiles; + } + if(structure.info.xml.get("reloadRenderer") == "true") { + structure.renderer = null; + } + if(structure.info.xml.get("behind") == "true") { + s.addChildAt(structure.getRenderer(),0); + } else { + s.addChild(structure.getRenderer()); + } + } + ,break_map: null + ,getIdx: function(x,y) { + return com_fancyfish_faeng_common_Utils.getIdx(x,y); + } + ,getBrickBreak: function(x,y) { + var idx = this.getIdx(x,y); + var b = this.break_map.get(idx); + if(b == null || b.parent == null) { + b = new com_davidmaletz_mining_renderer_BreakBrick(x,y,this); + this.addChild(b); + this.break_map.set(idx,b); + } + return b; + } + ,fullBrickBreak: function(x,y) { + var b = this.getBrickBreak(x,y); + b.setFrame(b.getMaxFrame()); + } + ,endBrickBreak: function(x,y,playPaused) { + if(playPaused == null) { + playPaused = false; + } + var idx = this.getIdx(x,y); + var b = this.break_map.get(idx); + if(b == null) { + return; + } + this.break_map.remove(idx); + if(b.parent == this) { + this.removeChild(b); + } + var tile_break = this.area.getTileBreak(); + var t = com_davidmaletz_tiles_Tile.get(tile_break); + if(t == null) { + return; + } + var p = playPaused ? new com_davidmaletz_tiles_render_StaticPlayAnimation(t,tile_break,10,false,com_davidmaletz_tiles_render_PlayAnimation.removeOnComplete) : new com_davidmaletz_tiles_render_PlayAnimation(t,tile_break,10,false,com_davidmaletz_tiles_render_PlayAnimation.removeOnComplete); + p.set_x(x * com_davidmaletz_tiles_Tile.SIZE + (com_davidmaletz_tiles_Tile.SIZE - t.getWidth()) * 0.5); + p.set_y(y * com_davidmaletz_tiles_Tile.SIZE + (com_davidmaletz_tiles_Tile.SIZE - t.getHeight()) * 0.5); + p.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),90); + p.lerp(new com_davidmaletz_lerp_PositionKeyframe(p.get_x(),p.get_y() - 10),90); + this.addChild(p); + } + ,incBrickBreak: function(x,y,frames,playPaused) { + if(playPaused == null) { + playPaused = false; + } + var b = this.getBrickBreak(x,y); + if(!b.inc(frames)) { + this.endBrickBreak(x,y,playPaused); + return false; + } else { + return true; + } + } + ,removeBreak: function(b) { + this.break_map.remove(this.getIdx(b.tile_x,b.tile_y)); + if(b.parent == this) { + this.removeChild(b); + } + } + ,getTile: function(x,y,layer) { + return this.area.getTile(x,y,layer); + } + ,getTileId: function(x,y,layer) { + return this.area.getTileId(x,y,layer); + } + ,centerOn: function(posX,posY,midY,instant,onComplete) { + if(this.hasTrack(com_davidmaletz_lerp_ShakeKeyframe) || this.hasTrack(com_davidmaletz_mining_npc_FakePositionKeyframe) || this.area.fixedCamera()) { + return; + } + var s = 1.0 / com_davidmaletz_mining_Main._getScale(); + var tx = Math.round(128. * s - posX); + var ty = Math.round(midY ? 72. * s - posY : 144 * s - posY - com_davidmaletz_tiles_Tile.SIZE * 1.5); + if(this.hasTrack(com_davidmaletz_lerp_PositionKeyframe)) { + (js_Boot.__cast(this.getLerp(com_davidmaletz_lerp_PositionKeyframe) , com_davidmaletz_lerp_PositionKeyframe)).setPos(tx,ty); + this.tracks.getTrack(com_davidmaletz_lerp_PositionKeyframe).onComplete = onComplete; + return; + } else { + this.set_x(tx); + } + if(instant) { + this.clearTrack(com_davidmaletz_lerp_YKeyframe); + this.set_y(ty); + com_davidmaletz_mining_renderer_Parallax.update(); + } else { + var track = this.hasTrack(com_davidmaletz_lerp_YKeyframe); + if(!track && Math.abs(ty - this.get_y()) < com_davidmaletz_tiles_Tile.SIZE * 2) { + this.set_y(ty); + } else if(track) { + if((js_Boot.__cast(this.getLerp(com_davidmaletz_lerp_YKeyframe) , com_davidmaletz_lerp_YKeyframe)).setY(ty)) { + this.tracks.getTrack(com_davidmaletz_lerp_YKeyframe).onComplete = onComplete; + } + } else { + this.lerp(new com_davidmaletz_lerp_YKeyframe(ty),40,onComplete); + } + } + } + ,__class__: com_davidmaletz_mining_renderer_AreaRenderer +}); +var com_davidmaletz_mining_renderer_BasicAttackRenderer = function(tile,o,attacks) { + this.object = o; + this._tile = tile; + com_davidmaletz_mining_enemy_AttackRenderer.call(this,com_davidmaletz_tiles_Tile.get(tile),com_davidmaletz_mining_enemy_AttackRenderer.getTargets(o.info.xml.elementsNamed("target")),attacks,com_davidmaletz_mining_enemy_AttackRenderer.getFPS(o.info.xml,10),com_davidmaletz_mining_world_Object.resolveObject(o,"walk")); +}; +$hxClasses["com.davidmaletz.mining.renderer.BasicAttackRenderer"] = com_davidmaletz_mining_renderer_BasicAttackRenderer; +com_davidmaletz_mining_renderer_BasicAttackRenderer.__name__ = ["com","davidmaletz","mining","renderer","BasicAttackRenderer"]; +com_davidmaletz_mining_renderer_BasicAttackRenderer.__super__ = com_davidmaletz_mining_enemy_AttackRenderer; +com_davidmaletz_mining_renderer_BasicAttackRenderer.prototype = $extend(com_davidmaletz_mining_enemy_AttackRenderer.prototype,{ + object: null + ,_tile: null + ,fireEvent: function(e) { + this.object.dispatchEvent(e); + } + ,repeatAttack: function(o) { + var ret = com_davidmaletz_mining_enemy_AttackRenderer.prototype.repeatAttack.call(this,o); + if(!ret) { + this.object.dispatchEvent(new openfl_events_Event("end_attack")); + } + return ret; + } + ,getAttacker: function() { + return this.object; + } + ,onMiss: function(o) { + if(o == null) { + this.object.showPopup(true,com_fancyfish_faeng_common_Lang.getText("common","miss"),-com_davidmaletz_tiles_Tile.SIZE); + } else { + o.showPopup(true,com_fancyfish_faeng_common_Lang.getText("common","dodged")); + } + com_davidmaletz_mining_world_Object.playObject(this.object,"miss"); + } + ,getElement: function() { + return this.object.getDefenseElement(); + } + ,getAttackTarget: function(a) { + var r = a.range + this.object._width; + var b = this.object.getClosest(r,1,false,$bind(this,this.canAttack),a.type == "breath" ? r >> 1 : 0); + if(b == null || b.object == null) { + b = this.object.getClosest(r,-1,false,$bind(this,this.canAttack),a.type == "breath" ? r >> 1 : 0); + } + if(b == null || this.getXDistance(b.bounds) > a.range) { + return null; + } else { + return b.object; + } + } + ,getRectangle: function() { + return this.object.getBounds(); + } + ,isOwner: function() { + if(this.object.area != null) { + return this.object.area.isActivePlayer(); + } else { + return false; + } + } + ,getAnim: function(id) { + var xml = this.object.info.xml; + if(xml.exists(id + "_anim")) { + return xml.get(id + "_anim"); + } else { + var p = xml.exists("animation") ? xml.get("animation") : this._tile; + var s = p + "." + id; + if(com_davidmaletz_tiles_TileAnimation.exists(s)) { + return s; + } else { + return "object." + id; + } + } + } + ,__class__: com_davidmaletz_mining_renderer_BasicAttackRenderer +}); +var com_davidmaletz_mining_renderer_BreakBrick = function(x,y,area) { + var crack = area.area.getCrack(); + com_davidmaletz_tiles_render_TileAnimationRenderer.call(this,com_davidmaletz_tiles_Tile.get(crack),20); + this.setAnimation(crack); + this.area = area; + this.tile_x = x; + this.tile_y = y; + this.set_x(x * com_davidmaletz_tiles_Tile.SIZE); + this.set_y(y * com_davidmaletz_tiles_Tile.SIZE); +}; +$hxClasses["com.davidmaletz.mining.renderer.BreakBrick"] = com_davidmaletz_mining_renderer_BreakBrick; +com_davidmaletz_mining_renderer_BreakBrick.__name__ = ["com","davidmaletz","mining","renderer","BreakBrick"]; +com_davidmaletz_mining_renderer_BreakBrick.__super__ = com_davidmaletz_tiles_render_TileAnimationRenderer; +com_davidmaletz_mining_renderer_BreakBrick.prototype = $extend(com_davidmaletz_tiles_render_TileAnimationRenderer.prototype,{ + tile_x: null + ,tile_y: null + ,previous: null + ,area: null + ,init: function(e) { + com_davidmaletz_tiles_render_TileAnimationRenderer.prototype.init.call(this,e); + this.previous = this.frame; + } + ,advanceFrame: function(frames) { + com_davidmaletz_tiles_render_TileAnimationRenderer.prototype.advanceFrame.call(this,frames); + com_davidmaletz_mining_renderer_AreaRenderer.updateLoop(this,this.area.area); + if(this.frame == this.previous && !this.incFrame(-frames) && this.frame <= 0) { + this.area.removeBreak(this); + } + this.previous = this.frame; + } + ,inc: function(df) { + this.incFrame(df); + return this.frame < this.getMaxFrame() - 0.001; + } + ,__class__: com_davidmaletz_mining_renderer_BreakBrick +}); +var com_davidmaletz_mining_renderer_ClockRenderer = function(back,hand,top,deg) { + if(deg == null) { + deg = 1; + } + this.rot = 0; + com_davidmaletz_lerp_LerpSprite.call(this); + var t = com_davidmaletz_tiles_Tile.get(hand); + var x = 0.0; + var y = 0.0; + if(t != null) { + x = -t.getWidth() * 0.5 / com_davidmaletz_tiles_Tile.SIZE; + y = -t.getHeight() * 0.5 / com_davidmaletz_tiles_Tile.SIZE; + this.hands = com_davidmaletz_tiles_Tile.makeIcon(t,x,y); + } + var t1 = com_davidmaletz_tiles_Tile.get(back); + if(t1 != null) { + this.addChild(com_davidmaletz_tiles_Tile.makeIcon(t1,x,y,0,0,true)); + } + if(this.hands != null) { + this.addChild(this.hands); + } + var t2 = com_davidmaletz_tiles_Tile.get(top); + if(t2 != null) { + this.addChild(com_davidmaletz_tiles_Tile.makeIcon(t2,x,y)); + } + this.set_x(2 - x * com_davidmaletz_tiles_Tile.SIZE); + this.set_y(com_davidmaletz_tiles_Tile.SIZE - y * com_davidmaletz_tiles_Tile.SIZE); + this.degrees = deg; + this.update(); +}; +$hxClasses["com.davidmaletz.mining.renderer.ClockRenderer"] = com_davidmaletz_mining_renderer_ClockRenderer; +com_davidmaletz_mining_renderer_ClockRenderer.__name__ = ["com","davidmaletz","mining","renderer","ClockRenderer"]; +com_davidmaletz_mining_renderer_ClockRenderer.__super__ = com_davidmaletz_lerp_LerpSprite; +com_davidmaletz_mining_renderer_ClockRenderer.prototype = $extend(com_davidmaletz_lerp_LerpSprite.prototype,{ + hands: null + ,rot: null + ,degrees: null + ,update: function() { + var r = -Math.round((com_davidmaletz_mining_Main._getGameTime() - 12) * 180 / (12 * this.degrees)) * this.degrees; + if(this.rot != r) { + this.rot = r; + this.hands.set_rotation(r); + } + } + ,advanceFrame: function(df) { + com_davidmaletz_lerp_LerpSprite.prototype.advanceFrame.call(this,df); + this.update(); + } + ,__class__: com_davidmaletz_mining_renderer_ClockRenderer +}); +var com_davidmaletz_mining_renderer_CollectLoot = function(loot,c,forceCollect,onComplete) { + this.container = c; + this.loot = []; + this.forceCollect = forceCollect; + if(loot != null) { + var l = loot; + while(l.hasNext()) { + var l1 = l.next(); + this.loot.push(l1); + } + } + this.onComplete = onComplete; + this.__is_action_key = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; +}; +$hxClasses["com.davidmaletz.mining.renderer.CollectLoot"] = com_davidmaletz_mining_renderer_CollectLoot; +com_davidmaletz_mining_renderer_CollectLoot.__name__ = ["com","davidmaletz","mining","renderer","CollectLoot"]; +com_davidmaletz_mining_renderer_CollectLoot.kill = function(e,area,p,o,r,onComplete,offY) { + if(offY == null) { + offY = 0; + } + var loot = null; + if(Std["is"](p,com_davidmaletz_mining_Player)) { + loot = o.getLoot(e,false); + (js_Boot.__cast(p , com_davidmaletz_mining_Player)).overlapChanged(); + } + var l = new com_davidmaletz_mining_renderer_CollectLoot(loot,area,o.projectileKillCollect(),onComplete); + var d = r; + var tmp = function() { + com_davidmaletz_faengfl_FaengFL.remove(d); + }; + r.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),10,tmp); + com_davidmaletz_faengfl_adv_sound_Sound.playLoc(com_davidmaletz_mining_world_Object.resolveObject(o,"death"),area,new openfl_geom_Point(r.get_x(),r.get_y() + offY),false,o.getSoundScale()); + var blood = o.getBlood(); + if(o.getHealth() <= 0 && blood != null) { + var x = r.get_x() - com_davidmaletz_tiles_Tile.SIZE * 0.5; + var ht = o.getBounds().height; + var f = $bind(l,l.collectItem); + var x1 = x; + var y = r.get_y() + offY + (ht - com_davidmaletz_tiles_Tile.SIZE) * 0.5; + var func = function(p1) { + f(x1,y,p1); + }; + var t = com_davidmaletz_tiles_Tile.get(blood); + var p2 = com_davidmaletz_faengfl_Window.window_ct > 0 ? new com_davidmaletz_tiles_render_StaticPlayAnimation(t,blood,10,false,func,-0.5,-0.5) : new com_davidmaletz_tiles_render_PlayAnimation(t,blood,10,false,func,-0.5,-0.5); + p2.set_x(r.get_x()); + p2.set_y(r.get_y() + offY); + p2.set_scaleX(p2.set_scaleY(r.get_scaleY())); + if(t.getHeight() < 4 * com_davidmaletz_tiles_Tile.SIZE) { + var _g = p2; + _g.set_y(_g.get_y() + (5 + (ht > com_davidmaletz_tiles_Tile.SIZE ? ht * 0.25 : 0))); + } + area.addChild(p2); + } else if(loot != null && Std["is"](p,com_davidmaletz_mining_Player)) { + l.collectLoot(r.get_x() - com_davidmaletz_tiles_Tile.SIZE * 0.5,r.get_y() + offY); + } +}; +com_davidmaletz_mining_renderer_CollectLoot.collect = function(loot,c,x,y,height) { + if(height == null) { + height = 0; + } + new com_davidmaletz_mining_renderer_CollectLoot(loot,c,false).collectLoot(x,y,height); +}; +com_davidmaletz_mining_renderer_CollectLoot.prototype = { + container: null + ,loot: null + ,forceCollect: null + ,onComplete: null + ,__is_action_key: null + ,collectItem: function(x,y,p) { + com_davidmaletz_faengfl_FaengFL.remove(p); + if(this.loot != null) { + this.collectLoot(x,y); + } + } + ,collectLoot: function(x,y,height) { + if(height == null) { + height = 0; + } + var first = true; + x -= com_davidmaletz_tiles_Tile.SIZE * 0.25 * (this.loot.length - 1); + var s = new openfl_display_Sprite(); + var _g = 0; + var _g1 = this.loot; + while(_g < _g1.length) { + var l = _g1[_g]; + ++_g; + var len = l.count; + var _g3 = 0; + var _g2 = len; + while(_g3 < _g2) { + var ct = _g3++; + var i; + var anim = com_davidmaletz_tiles_TileAnimation._get(l.item.id); + if(anim == null) { + i = new com_davidmaletz_lerp_LerpSpriteFL(); + i.addChild(l.item.createIcon()); + } else { + i = new com_davidmaletz_tiles_render_PlayAnimation(l.item.getIcon(),l.item.id,10,false); + l.item.tint(i); + } + i.set_alpha(0); + i.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),5); + i.set_x(x); + i.set_y(y); + var v = Math.sqrt(ct + 1); + i.lerp(new com_davidmaletz_lerp_BounceKeyframe(i.get_y(),-com_davidmaletz_tiles_Tile.SIZE * 0.25 - (ct + height) * com_davidmaletz_tiles_Tile.SIZE,Math.PI * 1.5),Math.round(30 * v),first && ct == len - 1 ? (function(p,y1,x1,f) { + return function() { + f[0](x1[0],y1[0],p[0]); + }; + })([i],[y],[x],[$bind(this,this.hideAndCollect)]) : (function(p1,f1) { + return function() { + f1[0](p1[0]); + }; + })([i],[$bind(this,this.hide)])); + s.addChildAt(i,0); + new com_davidmaletz_mining_renderer_FinishOnKill(i); + } + first = false; + x += com_davidmaletz_tiles_Tile.SIZE * 0.5; + } + this.container.addChild(s); + } + ,hideAndCollect: function(x,y,p) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = this.__is_action_key; + var wt = 0.0; + var _g = 0; + var _g1 = this.loot; + while(_g < _g1.length) { + var i = _g1[_g]; + ++_g; + wt += i.item.weight * i.count; + } + this.hide(p,false); + var player = com_davidmaletz_mining_Main.getLocalPlayer(); + if(!this.forceCollect && !com_davidmaletz_mining_Player.isAutoCollect(Math.ceil(wt)) && com_davidmaletz_mining_world_Projectile.placeLoot(this.container.area,HxOverrides.iter(this.loot),Math.round(x),Math.round(y - com_davidmaletz_tiles_Tile.SIZE * 0.5),this.loot.length == 1)) { + if(this.onComplete != null) { + this.onComplete(); + } + } else if(player != null) { + var p1 = player.addMultiItems(this.loot); + if(p1 != null) { + p1.onComplete = this.onComplete; + } + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + ,hide: function(p,runComplete) { + if(runComplete == null) { + runComplete = true; + } + var _gthis = this; + p.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),5,function() { + if(runComplete && _gthis.onComplete != null) { + _gthis.onComplete(); + } + com_davidmaletz_faengfl_FaengFL.remove(p); + }); + } + ,__class__: com_davidmaletz_mining_renderer_CollectLoot +}; +var com_davidmaletz_mining_renderer_FinishOnKill = function(i) { + this.sprite = i; + this.sprite.addEventListener("removedFromStage",$bind(this,this.destroy)); +}; +$hxClasses["com.davidmaletz.mining.renderer.FinishOnKill"] = com_davidmaletz_mining_renderer_FinishOnKill; +com_davidmaletz_mining_renderer_FinishOnKill.__name__ = ["com","davidmaletz","mining","renderer","FinishOnKill"]; +com_davidmaletz_mining_renderer_FinishOnKill.prototype = { + sprite: null + ,destroy: function(e) { + if(!com_davidmaletz_mining_Main.temporary_remove) { + this.sprite.removeEventListener("removedFromStage",$bind(this,this.destroy)); + while(this.sprite.hasLerp()) this.sprite.advanceFrame(99999); + } + } + ,__class__: com_davidmaletz_mining_renderer_FinishOnKill +}; +var com_davidmaletz_mining_renderer_DarkLight = function(parent) { + com_davidmaletz_faengfl_FramebufferSprite.call(this,Math.round(parent.getWidth()),Math.round(parent.getHeight()),parent.pScale); + this._parent = parent; +}; +$hxClasses["com.davidmaletz.mining.renderer.DarkLight"] = com_davidmaletz_mining_renderer_DarkLight; +com_davidmaletz_mining_renderer_DarkLight.__name__ = ["com","davidmaletz","mining","renderer","DarkLight"]; +com_davidmaletz_mining_renderer_DarkLight.instance = null; +com_davidmaletz_mining_renderer_DarkLight.create = function(area,parent) { + if(com_davidmaletz_mining_renderer_DarkLight.instance == null) { + com_davidmaletz_mining_renderer_DarkLight.instance = new com_davidmaletz_mining_renderer_DarkLight(parent); + } else { + com_davidmaletz_faengfl_FaengFL.removeAllChildren(com_davidmaletz_mining_renderer_DarkLight.instance); + } + com_davidmaletz_mining_renderer_DarkLight.instance.area = area; + com_davidmaletz_mining_renderer_DarkLight.instance.addChild(new com_davidmaletz_mining_renderer_LightRenderer(area.area.lights)); + com_davidmaletz_mining_renderer_DarkLight.instance.addChild(new com_davidmaletz_mining_renderer_OreLightFloorRenderer(area)); + return com_davidmaletz_mining_renderer_DarkLight.instance; +}; +com_davidmaletz_mining_renderer_DarkLight.clear = function() { + if(com_davidmaletz_mining_renderer_DarkLight.instance != null) { + com_davidmaletz_faengfl_FaengFL.removeAllChildren(com_davidmaletz_mining_renderer_DarkLight.instance); + com_davidmaletz_mining_renderer_DarkLight.instance.area = null; + } +}; +com_davidmaletz_mining_renderer_DarkLight.getCopyVertexShader = function() { + return "#ifdef GL_ES\nprecision mediump float;\n#endif\nattribute vec4 vertex; varying vec2 texCoord; void main(){texCoord = vertex.xy*0.5+0.5; gl_Position = vec4(vertex.xy, 0.0, 1.0);}"; +}; +com_davidmaletz_mining_renderer_DarkLight.getCopyFragmentShader = function() { + return "#ifdef GL_ES\nprecision mediump float;\n#endif\nvarying vec2 texCoord; uniform sampler2D texture; uniform vec2 depth; uniform vec3 ambientColor; void main(){vec4 c = texture2D(texture, texCoord); gl_FragColor = vec4(c.aaa+clamp(texCoord.y*depth.x+depth.y, 0.0, 1.0)*ambientColor, 1.0);}"; +}; +com_davidmaletz_mining_renderer_DarkLight.__super__ = com_davidmaletz_faengfl_FramebufferSprite; +com_davidmaletz_mining_renderer_DarkLight.prototype = $extend(com_davidmaletz_faengfl_FramebufferSprite.prototype,{ + _parent: null + ,area: null + ,copy_program: null + ,depth: null + ,ambientColor: null + ,copyVertexSlot: null + ,getOldFramebuffer: function() { + return this._parent; + } + ,createCopyProgram: function(GL) { + this.copy_program = com_davidmaletz_faengfl_FramebufferSprite.compileProgram(GL,com_davidmaletz_mining_renderer_DarkLight.getCopyVertexShader(),com_davidmaletz_mining_renderer_DarkLight.getCopyFragmentShader()); + GL.useProgram(this.copy_program); + this.copyVertexSlot = GL.getAttribLocation(this.copy_program,"vertex"); + GL.uniform1i(GL.getUniformLocation(this.copy_program,"texture"),0); + this.depth = GL.getUniformLocation(this.copy_program,"depth"); + this.ambientColor = GL.getUniformLocation(this.copy_program,"ambientColor"); + } + ,renderAll: function(renderSession) { + var old_program = renderSession.shaderManager.currentShader.program; + var GL = renderSession.gl; + GL.disable(GL.BLEND); + if(this.copy_program == null) { + this.createCopyProgram(GL); + } + GL.useProgram(this.copy_program); + var d = this.area.area.getDropoff(); + GL.bindTexture(GL.TEXTURE_2D,this._parent.texture); + GL.uniform2f(this.depth,this._height * d,1.0 - (this._height - this.area.get_y()) * d); + var a = com_davidmaletz_mining_renderer_Parallax.getAmbientColor(); + GL.uniform3f(this.ambientColor,a.r,a.g,a.b); + com_davidmaletz_faengfl_FramebufferSprite.drawQuad(GL,this.copyVertexSlot); + GL.enable(GL.BLEND); + GL.useProgram(old_program); + com_davidmaletz_faengfl_FramebufferSprite.prototype.renderAll.call(this,renderSession); + } + ,renderFramebuffer: function(renderSession,clear) { + if(clear == null) { + clear = true; + } + openfl__$internal_renderer_opengl_utils_BlendModeManager.FORCE_MODE = 0; + var ret = com_davidmaletz_faengfl_FramebufferSprite.prototype.renderFramebuffer.call(this,renderSession,false); + openfl__$internal_renderer_opengl_utils_BlendModeManager.FORCE_MODE = null; + return ret; + } + ,toScreen: function(renderSession,old) { + var GL = renderSession.gl; + GL.blendFunc(GL.DST_COLOR,GL.ONE_MINUS_SRC_ALPHA); + com_davidmaletz_faengfl_FramebufferSprite.prototype.toScreen.call(this,renderSession,old); + GL.blendFunc(GL.ONE,GL.ONE_MINUS_SRC_ALPHA); + } + ,makeTransform: function(old) { + return openfl_geom_Matrix.__identity; + } + ,getTransform: function() { + var ret = this.__getWorldTransform().clone().invert(); + var s = com_davidmaletz_mining_Main._getScale(); + ret.a *= s; + ret.d *= s; + ret.tx = (ret.tx + this.area.get_x()) * s; + ret.ty = (ret.ty + this.area.get_y()) * s; + return ret; + } + ,__class__: com_davidmaletz_mining_renderer_DarkLight +}); +var com_davidmaletz_mining_renderer_FloatingRenderer = function(waterLine,tile,anim,fps,loop,complete,offX,offY) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + this.offsetX = tile.getTileWidth(0,0) * 0.5; + this.waterLine = waterLine + offY * tile.getTileHeight(0,0); + com_davidmaletz_tiles_render_PlayAnimation.call(this,tile,anim,fps,loop,complete,offX,offY); +}; +$hxClasses["com.davidmaletz.mining.renderer.FloatingRenderer"] = com_davidmaletz_mining_renderer_FloatingRenderer; +com_davidmaletz_mining_renderer_FloatingRenderer.__name__ = ["com","davidmaletz","mining","renderer","FloatingRenderer"]; +com_davidmaletz_mining_renderer_FloatingRenderer.__super__ = com_davidmaletz_tiles_render_PlayAnimation; +com_davidmaletz_mining_renderer_FloatingRenderer.prototype = $extend(com_davidmaletz_tiles_render_PlayAnimation.prototype,{ + offsetX: null + ,waterLine: null + ,init: function(e) { + com_davidmaletz_tiles_render_PlayAnimation.prototype.init.call(this,e); + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.handle_frame),false,-1); + this.handle_frame(null); + } + ,destroy: function(e) { + com_davidmaletz_tiles_render_PlayAnimation.prototype.destroy.call(this,e); + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.handle_frame)); + } + ,handle_frame: function(e) { + if(this.parent != null) { + this.set_y(-Math.round(com_davidmaletz_mining_renderer_Parallax.getWaveHeight(this.get_x() + this.parent.get_x() + this.offsetX) + this.waterLine)); + } + } + ,__class__: com_davidmaletz_mining_renderer_FloatingRenderer +}); +var com_davidmaletz_mining_renderer_GlowTileRenderer = function(tile,fps) { + com_davidmaletz_tiles_render_TileAnimationRenderer.call(this,tile,fps); +}; +$hxClasses["com.davidmaletz.mining.renderer.GlowTileRenderer"] = com_davidmaletz_mining_renderer_GlowTileRenderer; +com_davidmaletz_mining_renderer_GlowTileRenderer.__name__ = ["com","davidmaletz","mining","renderer","GlowTileRenderer"]; +com_davidmaletz_mining_renderer_GlowTileRenderer.__super__ = com_davidmaletz_tiles_render_TileAnimationRenderer; +com_davidmaletz_mining_renderer_GlowTileRenderer.prototype = $extend(com_davidmaletz_tiles_render_TileAnimationRenderer.prototype,{ + superRenderGL: function(renderSession) { + com_davidmaletz_tiles_render_TileAnimationRenderer.prototype.__renderGL.call(this,renderSession); + } + ,__renderGL: function(renderSession) { + com_davidmaletz_faengfl_GlowSprite.makeGlow($bind(this,this.superRenderGL),renderSession); + } + ,__class__: com_davidmaletz_mining_renderer_GlowTileRenderer +}); +var com_davidmaletz_mining_renderer_InvisibleFloorRenderer = function(m,anim) { + com_davidmaletz_mining_renderer_AnimatedFloorRenderer.call(this,m,2,anim,null); +}; +$hxClasses["com.davidmaletz.mining.renderer.InvisibleFloorRenderer"] = com_davidmaletz_mining_renderer_InvisibleFloorRenderer; +com_davidmaletz_mining_renderer_InvisibleFloorRenderer.__name__ = ["com","davidmaletz","mining","renderer","InvisibleFloorRenderer"]; +com_davidmaletz_mining_renderer_InvisibleFloorRenderer.__super__ = com_davidmaletz_mining_renderer_AnimatedFloorRenderer; +com_davidmaletz_mining_renderer_InvisibleFloorRenderer.prototype = $extend(com_davidmaletz_mining_renderer_AnimatedFloorRenderer.prototype,{ + init: function(e) { + this.updateHidden(null); + com_davidmaletz_mining_renderer_AnimatedFloorRenderer.prototype.init.call(this,e); + com_davidmaletz_mining_Main.getLocalPlayer().viewHidden.addEventListener("updated",$bind(this,this.updateHidden)); + } + ,destroy: function(e) { + com_davidmaletz_mining_renderer_AnimatedFloorRenderer.prototype.destroy.call(this,e); + com_davidmaletz_mining_Main.getLocalPlayer().viewHidden.removeEventListener("updated",$bind(this,this.updateHidden)); + } + ,updateHidden: function(e) { + this.set_visible(true); + } + ,set_visible: function(value) { + return com_davidmaletz_mining_renderer_AnimatedFloorRenderer.prototype.set_visible.call(this,value && com_davidmaletz_mining_Main.getLocalPlayer().viewHidden.get()); + } + ,createChunk: function(cx,cy) { + return new com_davidmaletz_mining_renderer__$InvisibleFloorRenderer_InvisibleChunk(this.map,cx,cy,this.layer,this.getNeighbors,this.animation,this.scale); + } + ,__class__: com_davidmaletz_mining_renderer_InvisibleFloorRenderer +}); +var com_davidmaletz_mining_renderer__$InvisibleFloorRenderer_InvisibleChunk = function(map,cx,cy,l,neighbors,anim,s) { + this.area = js_Boot.__cast(map , com_davidmaletz_mining_world_Area); + this.t = this.area.getInvisibleBlock(); + com_davidmaletz_mining_renderer_AnimatedChunk.call(this,map,cx,cy,l,neighbors,anim,s); +}; +$hxClasses["com.davidmaletz.mining.renderer._InvisibleFloorRenderer.InvisibleChunk"] = com_davidmaletz_mining_renderer__$InvisibleFloorRenderer_InvisibleChunk; +com_davidmaletz_mining_renderer__$InvisibleFloorRenderer_InvisibleChunk.__name__ = ["com","davidmaletz","mining","renderer","_InvisibleFloorRenderer","InvisibleChunk"]; +com_davidmaletz_mining_renderer__$InvisibleFloorRenderer_InvisibleChunk.__super__ = com_davidmaletz_mining_renderer_AnimatedChunk; +com_davidmaletz_mining_renderer__$InvisibleFloorRenderer_InvisibleChunk.prototype = $extend(com_davidmaletz_mining_renderer_AnimatedChunk.prototype,{ + area: null + ,t: null + ,getTile: function(x,y,l) { + if(this.area.hasFlags(x,y,2)) { + return this.t; + } else { + return null; + } + } + ,__class__: com_davidmaletz_mining_renderer__$InvisibleFloorRenderer_InvisibleChunk +}); +var com_davidmaletz_mining_renderer_ItemBubble = function(dx,dy,item) { + com_davidmaletz_lerp_LerpSpriteFL.call(this); + this.addChild(new openfl_display_Bitmap(openfl_Assets.getBitmapData("data/ui/speech.png"))); + this.itemSelector = item; + this.set_x(dx); + this.set_y(dy); + this.speech_frames = 200 * (Math.random() + 1); + this.set_visible(false); +}; +$hxClasses["com.davidmaletz.mining.renderer.ItemBubble"] = com_davidmaletz_mining_renderer_ItemBubble; +com_davidmaletz_mining_renderer_ItemBubble.__name__ = ["com","davidmaletz","mining","renderer","ItemBubble"]; +com_davidmaletz_mining_renderer_ItemBubble.__super__ = com_davidmaletz_lerp_LerpSpriteFL; +com_davidmaletz_mining_renderer_ItemBubble.prototype = $extend(com_davidmaletz_lerp_LerpSpriteFL.prototype,{ + speech_frames: null + ,itemSelector: null + ,advanceFrame: function(frames) { + com_davidmaletz_lerp_LerpSpriteFL.prototype.advanceFrame.call(this,frames); + this.speech_frames -= frames; + if(this.speech_frames < 0) { + this.speech_frames += 200; + var item = this.itemSelector.getNextItem(); + if(item != null) { + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this,1); + var i = item.createIcon(); + i.set_x(3); + i.set_y(3); + this.addChild(i); + this.set_visible(true); + this.set_alpha(0); + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),30,$bind(this,this.next)); + } + } + } + ,next: function() { + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),30,$bind(this,this.hide)); + } + ,hide: function() { + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),30,$bind(this,this.remove)); + } + ,remove: function() { + this.set_visible(false); + } + ,__class__: com_davidmaletz_mining_renderer_ItemBubble +}); +var com_davidmaletz_mining_renderer_LightChunk = function(map,cx,cy,l,s) { + com_davidmaletz_tiles_render_ChunkRenderer.call(this,map,cx,cy,l,null,s); + this.cur = new com_davidmaletz_lerp_LerpSprite(); + this.prev = null; + this.tile = com_davidmaletz_tiles_Tile.get("black"); + this.set_scaleX(this.set_scaleY(1)); +}; +$hxClasses["com.davidmaletz.mining.renderer.LightChunk"] = com_davidmaletz_mining_renderer_LightChunk; +com_davidmaletz_mining_renderer_LightChunk.__name__ = ["com","davidmaletz","mining","renderer","LightChunk"]; +com_davidmaletz_mining_renderer_LightChunk.__super__ = com_davidmaletz_tiles_render_ChunkRenderer; +com_davidmaletz_mining_renderer_LightChunk.prototype = $extend(com_davidmaletz_tiles_render_ChunkRenderer.prototype,{ + prev: null + ,cur: null + ,tile: null + ,draw: function(c) { + var area = js_Boot.__cast(this.map , com_davidmaletz_mining_world_Area); + c.get_graphics().clear(); + this.handler.start(c.get_graphics(),0); + var sx = this.chunk.x * 16; + var sy = this.chunk.y * 16; + var b = this.tile.getTileBase(); + var bitmap = b.sheet; + var _g = 0; + while(_g < 16) { + var ty = _g++; + var _g1 = 0; + while(_g1 < 16) { + var tx = _g1++; + var x = sx + tx; + var y = sy + ty; + if(!area.hasFlags(x,y,1) && !area.isEmptyTile(x,y)) { + bitmap.addTile(this.handler,b.x,b.y,tx * com_davidmaletz_tiles_Tile.SIZE,ty * com_davidmaletz_tiles_Tile.SIZE); + } + } + } + this.handler.finish(); + } + ,update: function() { + if(this.tile == null) { + return; + } + if(this.prev == null) { + this.prev = new com_davidmaletz_lerp_LerpSprite(); + this.addChild(this.cur); + } else { + var f = this.prev; + this.prev = this.cur; + this.cur = f; + this.cur.set_alpha(1); + this.prev.set_alpha(1); + this.addChild(this.cur); + this.addChild(this.prev); + this.cur.clearLerp(); + var d = this.prev; + var tmp = function() { + com_davidmaletz_faengfl_FaengFL.remove(d); + }; + this.prev.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),15,tmp); + } + this.draw(this.cur); + this.dirty = false; + } + ,__class__: com_davidmaletz_mining_renderer_LightChunk +}); +var com_davidmaletz_mining_renderer_LightFloorRenderer = function(m,autosetView) { + if(autosetView == null) { + autosetView = true; + } + com_davidmaletz_tiles_render_FloorRenderer.call(this,m,2,null,autosetView); +}; +$hxClasses["com.davidmaletz.mining.renderer.LightFloorRenderer"] = com_davidmaletz_mining_renderer_LightFloorRenderer; +com_davidmaletz_mining_renderer_LightFloorRenderer.__name__ = ["com","davidmaletz","mining","renderer","LightFloorRenderer"]; +com_davidmaletz_mining_renderer_LightFloorRenderer.__super__ = com_davidmaletz_tiles_render_FloorRenderer; +com_davidmaletz_mining_renderer_LightFloorRenderer.prototype = $extend(com_davidmaletz_tiles_render_FloorRenderer.prototype,{ + createChunk: function(cx,cy) { + return new com_davidmaletz_mining_renderer_LightChunk(this.map,cx,cy,this.layer,this.scale); + } + ,__class__: com_davidmaletz_mining_renderer_LightFloorRenderer +}); +var com_davidmaletz_mining_renderer_LightRenderer = function(lights) { + com_davidmaletz_faengfl_InitSprite.call(this); + this.lights = lights; +}; +$hxClasses["com.davidmaletz.mining.renderer.LightRenderer"] = com_davidmaletz_mining_renderer_LightRenderer; +com_davidmaletz_mining_renderer_LightRenderer.__name__ = ["com","davidmaletz","mining","renderer","LightRenderer"]; +com_davidmaletz_mining_renderer_LightRenderer.__super__ = com_davidmaletz_faengfl_InitSprite; +com_davidmaletz_mining_renderer_LightRenderer.prototype = $extend(com_davidmaletz_faengfl_InitSprite.prototype,{ + lights: null + ,init: function(e) { + this.destroy(e); + this.lights.addEventListener("added",$bind(this,this.add_light)); + this.lights.addEventListener("removed",$bind(this,this.rem_light)); + this.updateLights(); + } + ,destroy: function(e) { + this.lights.removeEventListener("added",$bind(this,this.add_light)); + this.lights.removeEventListener("removed",$bind(this,this.rem_light)); + } + ,updateLights: function() { + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this); + var l = this.lights.iterator(); + while(l.hasNext()) { + var l1 = l.next(); + this.addLight(l1); + } + } + ,add_light: function(e) { + this.addLight(e.value); + } + ,rem_light: function(e) { + var r = (js_Boot.__cast(e.value , com_davidmaletz_mining_world_Light)).renderer; + if(r != null) { + com_davidmaletz_faengfl_FaengFL.remove(r); + } + } + ,addLight: function(light) { + var r = light.getRenderer(); + if(r != null) { + this.addChild(r); + } + } + ,__class__: com_davidmaletz_mining_renderer_LightRenderer +}); +var com_davidmaletz_mining_renderer_NameTag = function(o,p) { + this.first = true; + var b = o.getHitbox(); + openfl_display_Sprite.call(this); + this.object = o; + this.set_y(Math.round(-o._height * 0.5)); + if(o.info.hitbox != null) { + var _g = this; + _g.set_x(_g.get_x() + o.info.hitbox.x); + var _g1 = this; + _g1.set_y(_g1.get_y() + o.info.hitbox.y); + } + this.offX = this.get_x(); + this.offY = this.get_y(); + this.setPlayer(p); + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); +}; +$hxClasses["com.davidmaletz.mining.renderer.NameTag"] = com_davidmaletz_mining_renderer_NameTag; +com_davidmaletz_mining_renderer_NameTag.__name__ = ["com","davidmaletz","mining","renderer","NameTag"]; +com_davidmaletz_mining_renderer_NameTag.__super__ = openfl_display_Sprite; +com_davidmaletz_mining_renderer_NameTag.prototype = $extend(openfl_display_Sprite.prototype,{ + object: null + ,offX: null + ,offY: null + ,first: null + ,init: function(e) { + this.destroy(e); + if(this.first) { + this.offX = this.get_x() - this.offX; + this.offY = this.get_y() - this.offY; + this.first = false; + } + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.handle_frame)); + } + ,destroy: function(e) { + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.handle_frame)); + } + ,setPlayer: function(p) { + if(p == null || p == com_davidmaletz_mining_Main.getLocalPlayer()) { + this.set_visible(false); + } else { + var username = p.getUsername().get(); + if(username == null) { + this.set_visible(false); + } else { + this.set_visible(true); + this.get_graphics().clear(); + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this); + com_davidmaletz_faengfl_ui_FormattedTooltip.draw(this,username,false,16777215,-1728053248); + } + } + } + ,handle_frame: function(e) { + var r = this.object.renderer; + if(r != null) { + var s = com_davidmaletz_mining_Main.getGameScale() < 2 ? 0.5 : 1; + this.set_scaleX(s / r.get_scaleX()); + this.set_scaleY(s / r.get_scaleY()); + this.set_x(this.offX); + this.set_y(Math.round(-this.object._height * 0.5 * this.get_scaleY()) - 6 / s + this.offY); + if(this.object.info.hitbox != null) { + if(this.get_scaleX() < 0) { + var _g = this; + _g.set_x(_g.get_x() - (this.object._width - this.object.info.hitbox.get_right())); + } else { + var _g1 = this; + _g1.set_x(_g1.get_x() + this.object.info.hitbox.x); + } + var _g2 = this; + _g2.set_y(_g2.get_y() + this.object.info.hitbox.y); + } + } + } + ,__class__: com_davidmaletz_mining_renderer_NameTag +}); +var com_davidmaletz_mining_renderer_ObjectHealthBar = function(o,col,flip) { + if(flip == null) { + flip = true; + } + if(col == null) { + col = 10027008; + } + this.first = true; + var b = o.getHitbox(); + var p = o.getHealthPercent(); + this.set_visible(p < 1); + this.flip = flip; + com_davidmaletz_controls_ProgressBar.call(this,Math.round(b.width),2,col,p,false); + this.object = o; + this.set_x(-Math.round(o._width * 0.5)); + this.set_y(Math.round(-o._height * 0.5 - 3)); + if(o.info.hitbox != null) { + var _g = this; + _g.set_x(_g.get_x() + o.info.hitbox.x); + var _g1 = this; + _g1.set_y(_g1.get_y() + o.info.hitbox.y); + } + this.offX = this.get_x(); + this.offY = this.get_y(); + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); +}; +$hxClasses["com.davidmaletz.mining.renderer.ObjectHealthBar"] = com_davidmaletz_mining_renderer_ObjectHealthBar; +com_davidmaletz_mining_renderer_ObjectHealthBar.__name__ = ["com","davidmaletz","mining","renderer","ObjectHealthBar"]; +com_davidmaletz_mining_renderer_ObjectHealthBar.__super__ = com_davidmaletz_controls_ProgressBar; +com_davidmaletz_mining_renderer_ObjectHealthBar.prototype = $extend(com_davidmaletz_controls_ProgressBar.prototype,{ + object: null + ,offX: null + ,offY: null + ,first: null + ,flip: null + ,init: function(e) { + this.destroy(e); + this.object.addEventListener("change_health",$bind(this,this.update)); + if(this.first) { + this.offX = this.get_x() - this.offX; + this.offY = this.get_y() - this.offY; + this.first = false; + } + this.update(null); + if(this.flip) { + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.handle_frame)); + } + } + ,destroy: function(e) { + this.object.removeEventListener("change_health",$bind(this,this.update)); + if(this.flip) { + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.handle_frame)); + } + } + ,update: function(e) { + var p = this.object.getHealthPercent(); + this.set_visible(p < 1); + this.setProgress(p,5); + } + ,handle_frame: function(e) { + var r = this.object.renderer; + if(r != null) { + this.set_scaleX(1.0 / r.get_scaleX()); + this.set_scaleY(1.0 / r.get_scaleY()); + this.set_x(-Math.round(this.object._width * 0.5 * this.get_scaleX()) + this.offX); + this.set_y(Math.round((-this.object._height * 0.5 - 3) * this.get_scaleY()) + this.offY); + if(this.object.info.hitbox != null) { + if(this.get_scaleX() < 0) { + var _g = this; + _g.set_x(_g.get_x() - (this.object._width - this.object.info.hitbox.get_right())); + } else { + var _g1 = this; + _g1.set_x(_g1.get_x() + this.object.info.hitbox.x); + } + var _g2 = this; + _g2.set_y(_g2.get_y() + this.object.info.hitbox.y); + } + } + } + ,__class__: com_davidmaletz_mining_renderer_ObjectHealthBar +}); +var com_davidmaletz_mining_renderer_ObjectLayerRenderer = function(area,layer) { + com_davidmaletz_faengfl_InitSprite.call(this); + this.area = area; + this.layer = layer; +}; +$hxClasses["com.davidmaletz.mining.renderer.ObjectLayerRenderer"] = com_davidmaletz_mining_renderer_ObjectLayerRenderer; +com_davidmaletz_mining_renderer_ObjectLayerRenderer.__name__ = ["com","davidmaletz","mining","renderer","ObjectLayerRenderer"]; +com_davidmaletz_mining_renderer_ObjectLayerRenderer.__super__ = com_davidmaletz_faengfl_InitSprite; +com_davidmaletz_mining_renderer_ObjectLayerRenderer.prototype = $extend(com_davidmaletz_faengfl_InitSprite.prototype,{ + area: null + ,layer: null + ,init: function(e) { + this.destroy(e); + this.layer.addEventListener("add_object",$bind(this,this.add_object)); + this.layer.addEventListener("rem_object",$bind(this,this.rem_object)); + this.updateObjects(); + } + ,destroy: function(e) { + this.layer.removeEventListener("add_object",$bind(this,this.add_object)); + this.layer.removeEventListener("rem_object",$bind(this,this.rem_object)); + } + ,updateObjects: function() { + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this); + var _g = 0; + var _g1 = this.layer.objectList.slice(); + while(_g < _g1.length) { + var o = _g1[_g]; + ++_g; + this.addObject(o); + } + } + ,add_object: function(e) { + this.addObject(e.value); + } + ,kill: function(e,o,r,action) { + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = action; + com_davidmaletz_mining_renderer_CollectLoot.kill(e.element,this.area,e.killer,o,r); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + } + ,getLayer: function(i) { + if(i == 0) { + return this.area.back; + } else { + --i; + } + while(i >= this.get_numChildren()) this.addChild(new openfl_display_Sprite()); + return this.getChildAt(i); + } + ,_destroy: function(r) { + if(Std["is"](r,com_davidmaletz_lerp_LerpSpriteFL) && !Std["is"](r,com_davidmaletz_tiles_render_StaticPlayAnimation)) { + r.clearLerp(); + r.destroy(null); + com_davidmaletz_faengfl_FaengFL.addEnterFrame(js_Boot.__cast(r , com_davidmaletz_lerp_LerpSpriteFL)); + } + } + ,rem_object: function(e) { + var o = js_Boot.__cast(e.value , com_davidmaletz_mining_world_Object); + var r = o.renderer; + if(r != null && r.parent != null) { + if(r.parent.parent == this || r.parent == this.area.back) { + if(e.killer == null) { + this._destroy(r); + var f = ($_=r.parent,$bind($_,$_.removeChild)); + var a1 = r; + var tmp = function() { + return f(a1); + }; + r.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),10,tmp); + } else { + this._destroy(r); + var f1 = $bind(this,this.kill); + var e1 = e; + var o1 = o; + var r1 = r; + var a11 = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + var tmp1 = function() { + f1(e1,o1,r1,a11); + }; + r.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),10,tmp1); + return; + } + } + } + } + ,addObject: function(object) { + if(object.area != this.area.area) { + return; + } + var r = object.getRenderer(); + if(r == null) { + return; + } + if(r.stage != null) { + this._destroy(r); + if(!r.hasTrack(com_davidmaletz_lerp_AlphaKeyframe)) { + var f = ($_=r.parent,$bind($_,$_.removeChild)); + var a1 = r; + var tmp = function() { + return f(a1); + }; + r.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),10,tmp); + } + object.renderer = null; + r = object.getRenderer(); + } + var s = this.getLayer(object.getLayer()); + if(object.isBack()) { + s.addChildAt(r,0); + } else { + s.addChild(r); + } + } + ,__class__: com_davidmaletz_mining_renderer_ObjectLayerRenderer +}); +var com_davidmaletz_mining_renderer_OreLightChunk = function(map,cx,cy,l,s) { + com_davidmaletz_tiles_render_ChunkRenderer.call(this,map,cx,cy,l,null,s); +}; +$hxClasses["com.davidmaletz.mining.renderer.OreLightChunk"] = com_davidmaletz_mining_renderer_OreLightChunk; +com_davidmaletz_mining_renderer_OreLightChunk.__name__ = ["com","davidmaletz","mining","renderer","OreLightChunk"]; +com_davidmaletz_mining_renderer_OreLightChunk.__super__ = com_davidmaletz_tiles_render_ChunkRenderer; +com_davidmaletz_mining_renderer_OreLightChunk.prototype = $extend(com_davidmaletz_tiles_render_ChunkRenderer.prototype,{ + isLayer: function(l) { + if(!com_davidmaletz_tiles_render_ChunkRenderer.prototype.isLayer.call(this,l)) { + return l == 2; + } else { + return true; + } + } + ,getTile: function(x,y,l) { + var t = this.map.getTile(x,y,l); + if(t == null || !(js_Boot.__cast(this.map , com_davidmaletz_mining_world_Area)).hasFlags(x,y,1)) { + return null; + } + var ore = com_davidmaletz_mining_world_Area.getOre(t.id); + if(ore == null) { + return null; + } else { + return com_davidmaletz_tiles_Tile.get(ore.get("light")); + } + } + ,__class__: com_davidmaletz_mining_renderer_OreLightChunk +}); +var com_davidmaletz_mining_renderer_OreLightFloorRenderer = function(r) { + this.area = r; + com_davidmaletz_tiles_render_FloorRenderer.call(this,r.area,1,null,true); +}; +$hxClasses["com.davidmaletz.mining.renderer.OreLightFloorRenderer"] = com_davidmaletz_mining_renderer_OreLightFloorRenderer; +com_davidmaletz_mining_renderer_OreLightFloorRenderer.__name__ = ["com","davidmaletz","mining","renderer","OreLightFloorRenderer"]; +com_davidmaletz_mining_renderer_OreLightFloorRenderer.__super__ = com_davidmaletz_tiles_render_FloorRenderer; +com_davidmaletz_mining_renderer_OreLightFloorRenderer.prototype = $extend(com_davidmaletz_tiles_render_FloorRenderer.prototype,{ + area: null + ,createChunk: function(cx,cy) { + return new com_davidmaletz_mining_renderer_OreLightChunk(this.map,cx,cy,this.layer,this.scale); + } + ,setView: function(x,y,w,h) { + com_davidmaletz_tiles_render_FloorRenderer.prototype.setView.call(this,x - this.area.get_x(),y - this.area.get_y(),w,h); + } + ,__class__: com_davidmaletz_mining_renderer_OreLightFloorRenderer +}); +var com_davidmaletz_mining_renderer_Parallax = function(player,area,xml) { + this.forceTime = null; + this.water = null; + var _gthis = this; + openfl_display_Sprite.call(this); + com_davidmaletz_mining_renderer_Parallax.instance = this; + this.bg = new com_davidmaletz_faengfl_GlowSprite(); + this.addChild(this.bg); + this.area = area; + this.named = new haxe_ds_StringMap(); + this.day = []; + this.night = []; + this.moon = []; + this.normal = []; + this.layers = []; + var action_map = new haxe_ds_StringMap(); + var later = []; + action_map.set("layer",function(e,path) { + if(e.get("onTop") == "true") { + later.unshift(new com_davidmaletz_faengfl_XmlPath(e,path)); + } else { + _gthis.handleLayer(area,e,path); + } + }); + this.usePlanet = !area.area.isOrbit(); + var vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(player); + vars.set("area",area.area); + if(area.area.planet != null && !area.area.isOrbit()) { + var pxml = com_davidmaletz_mining_renderer_Parallax.get(area.area.planet.getBackground()); + if(pxml != null) { + this.usePlanet = false; + com_davidmaletz_faengfl_EventHandler._parse(pxml,action_map,vars).start(); + var _g = 0; + while(_g < later.length) { + var p = later[_g]; + ++_g; + this.handleLayer(area,p.xml,p.path); + } + com_fancyfish_faeng_common_Utils.clear(later); + this.usePlanet = true; + } + var l = com_davidmaletz_mining_renderer_Parallax.getPHeight(area.area.planet.height,5); + var l1 = new com_davidmaletz_mining_renderer_ParallaxLayer(area,0,0,0,new openfl_geom_Rectangle(-Infinity,l,Infinity,Infinity),10000); + l1.addChild(new com_davidmaletz_faengfl_SolidDrawable(0,256,144,0,0).create(0,0)); + this.bg.addChild(l1); + } + com_davidmaletz_faengfl_EventHandler._parse(xml,action_map,vars).start(); + var _g1 = 0; + while(_g1 < later.length) { + var p1 = later[_g1]; + ++_g1; + this.handleLayer(area,p1.xml,p1.path); + } + this.ambient = new com_fancyfish_faeng_renderer_Color(0,0,0); +}; +$hxClasses["com.davidmaletz.mining.renderer.Parallax"] = com_davidmaletz_mining_renderer_Parallax; +com_davidmaletz_mining_renderer_Parallax.__name__ = ["com","davidmaletz","mining","renderer","Parallax"]; +com_davidmaletz_mining_renderer_Parallax.instance = null; +com_davidmaletz_mining_renderer_Parallax.getPHeight = function(ht,pad) { + return 504. - (ht - pad) * com_davidmaletz_tiles_Tile.SIZE; +}; +com_davidmaletz_mining_renderer_Parallax.setOrbitalAlpha = function(f) { + if(com_davidmaletz_mining_renderer_Parallax.instance != null) { + var _g = 0; + var _g1 = com_davidmaletz_mining_renderer_Parallax.instance.posSprite; + while(_g < _g1.length) { + var p = _g1[_g]; + ++_g; + p.sprite.set_alpha(f); + } + } +}; +com_davidmaletz_mining_renderer_Parallax.makeRect = function(e,scale) { + return new openfl_geom_Rectangle(e.exists("x") ? com_davidmaletz_mining_Main.parseFloat(e.get("x")) * scale : -Infinity,e.exists("y") ? com_davidmaletz_mining_Main.parseFloat(e.get("y")) * scale : -Infinity,e.exists("width") ? com_davidmaletz_mining_Main.parseFloat(e.get("width")) * scale : Infinity,e.exists("height") ? com_davidmaletz_mining_Main.parseFloat(e.get("height")) * scale : Infinity); +}; +com_davidmaletz_mining_renderer_Parallax.getLayer = function(name) { + if(com_davidmaletz_mining_renderer_Parallax.instance == null) { + return null; + } else { + return com_davidmaletz_mining_renderer_Parallax.instance.named.get(name); + } +}; +com_davidmaletz_mining_renderer_Parallax.update = function() { + if(com_davidmaletz_mining_renderer_Parallax.instance != null) { + var _g = 0; + var _g1 = com_davidmaletz_mining_renderer_Parallax.instance.layers; + while(_g < _g1.length) { + var l = _g1[_g]; + ++_g; + l.update(); + } + } +}; +com_davidmaletz_mining_renderer_Parallax.enclose = function(s,orig,r) { + if(r != null && s == orig) { + s = new openfl_display_Sprite(); + s.addChild(orig); + } + return s; +}; +com_davidmaletz_mining_renderer_Parallax.suns = null; +com_davidmaletz_mining_renderer_Parallax.getSunlight = function(id,time) { + if(id == null) { + return 0; + } + if(com_davidmaletz_mining_renderer_Parallax.instance != null && com_davidmaletz_mining_renderer_Parallax.instance.forceTime != null) { + time = com_davidmaletz_mining_renderer_Parallax.instance.forceTime; + } + if(com_davidmaletz_mining_renderer_Parallax.suns == null) { + com_davidmaletz_mining_renderer_Parallax.suns = new haxe_ds_StringMap(); + } + var s = null; + if(!com_davidmaletz_mining_renderer_Parallax.suns.exists(id)) { + var xml = com_davidmaletz_mining_renderer_Parallax.get(id); + if(xml != null) { + var action_map = new haxe_ds_StringMap(); + action_map.set("layer",function(e,path) { + var element = e.elementsNamed("tile"); + while(element.hasNext()) { + var element1 = element.next(); + if(element1.exists("rise") && element1.get("sun") == "true") { + var t = com_davidmaletz_tiles_Tile.get(element1.get("id")); + if(t != null) { + s = new com_davidmaletz_mining_renderer__$Parallax_PosSprite(null,element1,t.getWidth(),t.getHeight()); + } + } + } + }); + com_davidmaletz_faengfl_EventHandler._parse(xml,action_map).start(); + } + com_davidmaletz_mining_renderer_Parallax.suns.set(id,s); + } else { + s = com_davidmaletz_mining_renderer_Parallax.suns.get(id); + } + if(s == null) { + return 0; + } + var percent = s.setTime(time); + if(percent < 0.5) { + return 1; + } else if(percent > 1) { + return com_fancyfish_faeng_common_Utils.interp(0.5,0.2,com_fancyfish_faeng_common_Utils.clamp((percent - 1) * 4,0,1)); + } else { + return com_fancyfish_faeng_common_Utils.clamp(2 - percent * 1.5,0,1); + } +}; +com_davidmaletz_mining_renderer_Parallax.setColor = function(d,r,g,b) { + var c = d.get_transform().get_colorTransform(); + c.redMultiplier = r; + c.greenMultiplier = g; + c.blueMultiplier = b; + d.get_transform().set_colorTransform(c); +}; +com_davidmaletz_mining_renderer_Parallax.setTime = function(t) { + if(com_davidmaletz_mining_renderer_Parallax.instance != null) { + com_davidmaletz_mining_renderer_Parallax.instance._setTime(t); + } +}; +com_davidmaletz_mining_renderer_Parallax.getAmbientColor = function() { + if(com_davidmaletz_mining_renderer_Parallax.instance == null) { + return com_fancyfish_faeng_renderer_Color.BLACK; + } else { + return com_davidmaletz_mining_renderer_Parallax.instance.getAmbient(); + } +}; +com_davidmaletz_mining_renderer_Parallax.clear = function() { + com_davidmaletz_mining_renderer_Parallax.instance = null; +}; +com_davidmaletz_mining_renderer_Parallax.setStorm = function(p) { + if(com_davidmaletz_mining_renderer_Parallax.instance != null && com_davidmaletz_mining_renderer_Parallax.instance.no_storm != null) { + var _g = 0; + var _g1 = com_davidmaletz_mining_renderer_Parallax.instance.no_storm; + while(_g < _g1.length) { + var l = _g1[_g]; + ++_g; + l.set_alpha(p); + } + } +}; +com_davidmaletz_mining_renderer_Parallax.getWaveHeight = function(x,mid) { + if(mid == null) { + mid = false; + } + if(com_davidmaletz_mining_renderer_Parallax.instance == null || com_davidmaletz_mining_renderer_Parallax.instance.waves == null) { + return 0; + } else { + return com_davidmaletz_mining_renderer_Parallax.instance.waves.getWaveHeight(x,mid); + } +}; +com_davidmaletz_mining_renderer_Parallax.parallax = null; +com_davidmaletz_mining_renderer_Parallax.loadParallax = function(e) { + if(com_davidmaletz_mining_renderer_Parallax.parallax == null) { + com_davidmaletz_mining_renderer_Parallax.parallax = new haxe_ds_StringMap(); + } + var id = e.get("id"); + if(com_davidmaletz_mining_renderer_Parallax.parallax.exists(id)) { + haxe_Log.trace("Overwrite Parallax: " + id,{ fileName : "Parallax.hx", lineNumber : 168, className : "com.davidmaletz.mining.renderer.Parallax", methodName : "loadParallax"}); + } + com_davidmaletz_mining_renderer_Parallax.parallax.set(id,e); +}; +com_davidmaletz_mining_renderer_Parallax.get = function(id) { + if(id == null || com_davidmaletz_mining_renderer_Parallax.parallax == null) { + return null; + } else { + return com_davidmaletz_mining_renderer_Parallax.parallax.get(id); + } +}; +com_davidmaletz_mining_renderer_Parallax.create = function(player,area,id) { + var ret = com_davidmaletz_mining_renderer_Parallax._create(player,area,id); + if(id != null && id.length > 0 && ret == null) { + haxe_Log.trace("No Parallax found: " + id,{ fileName : "Parallax.hx", lineNumber : 172, className : "com.davidmaletz.mining.renderer.Parallax", methodName : "create"}); + } + return ret; +}; +com_davidmaletz_mining_renderer_Parallax._create = function(player,area,id) { + if(id == null || com_davidmaletz_mining_renderer_Parallax.parallax == null) { + return null; + } else { + var e = com_davidmaletz_mining_renderer_Parallax.parallax.get(id); + if(e == null) { + return null; + } else { + return new com_davidmaletz_mining_renderer_Parallax(player,area,e); + } + } +}; +com_davidmaletz_mining_renderer_Parallax.reset = function() { + com_davidmaletz_mining_renderer_Parallax.parallax = null; + com_davidmaletz_mining_renderer_Parallax.suns = null; + com_davidmaletz_mining_renderer_Waves.reset(); +}; +com_davidmaletz_mining_renderer_Parallax.__super__ = openfl_display_Sprite; +com_davidmaletz_mining_renderer_Parallax.prototype = $extend(openfl_display_Sprite.prototype,{ + no_storm: null + ,waves: null + ,area: null + ,bg: null + ,ambient: null + ,posSprite: null + ,water: null + ,day: null + ,night: null + ,moon: null + ,normal: null + ,layers: null + ,top: null + ,forceTime: null + ,usePlanet: null + ,named: null + ,addLayer: function(l,e) { + this.layers.push(l); + if(e.exists("name")) { + this.named.set(e.get("name"),l); + } + } + ,handleLayer: function(area,e,path) { + if(e.exists("type")) { + var _g = e.get("type"); + switch(_g) { + case "back": + this.addChild(area.parallax_back); + break; + case "water": + this.water = new com_davidmaletz_mining_renderer_WaterRenderer(area,e.exists("image") ? com_davidmaletz_mining_Main.getResource(path,e.get("image")) : null,e.exists("max_depth") ? com_davidmaletz_mining_Main.parseInt(e.get("max_depth")) : 1,com_davidmaletz_mining_Main.parseInt("0x" + e.get("background")),e.exists("offsetY") ? com_davidmaletz_mining_Main.parseInt(e.get("offsetY")) : 0); + this.addChild(this.water); + this.addLayer(this.water,e); + break; + case "waves": + this.waves = new com_davidmaletz_mining_renderer_Waves(area,com_davidmaletz_mining_Main.getResource(path,e.get("image")),com_davidmaletz_mining_Main.parseInt(e.get("wave_height")),e.exists("speed") ? com_davidmaletz_mining_Main.parseFloat(e.get("speed")) : 0.25,this.water); + this.addChild(this.waves); + this.addLayer(this.waves,e); + break; + } + } else { + var p = e.exists("p") ? com_davidmaletz_mining_Main.parseFloat(e.get("p")) : 0; + var scroll = e.exists("scroll") ? com_davidmaletz_mining_Main.parseFloat(e.get("scroll")) : 0; + var r = null; + if(e.exists("x") || e.exists("y")) { + r = com_davidmaletz_mining_renderer_Parallax.makeRect(e,com_davidmaletz_tiles_Tile.SIZE); + } + if(this.usePlanet && area.area.planet != null) { + var ty = com_davidmaletz_mining_renderer_Parallax.getPHeight(area.area.planet.height,p == 0 ? 5 : -15); + if(r != null) { + if(r.y == -Infinity) { + r.y = ty; + } else { + r.set_top(Math.max(r.get_top(),ty)); + } + } else { + r = new openfl_geom_Rectangle(-Infinity,ty,Infinity,Infinity); + } + } + var overWater = e.get("overWater") == "true"; + var def_max = overWater && this.water != null ? this.water.max_depth : 1; + var l = new com_davidmaletz_mining_renderer_ParallaxLayer(area,p,scroll,e.exists("py") ? com_davidmaletz_mining_Main.parseFloat(e.get("py")) : p,r,e.exists("max_depth") ? com_davidmaletz_mining_Main.parseInt(e.get("max_depth")) : def_max,e); + if(!area.area.isOrbit() && !this.usePlanet && area.area.planet != null && area.area.planet.orbit != null) { + var oy = -area.area.planet.orbit.planet.height - area.area.planet.orbit.height + 1; + l.offsetY = oy * com_davidmaletz_tiles_Tile.SIZE; + l.max_depth = 30 - area.area.planet.height - oy; + } + if(e.exists("minLoop")) { + l.minLoop = com_davidmaletz_mining_Main.parseInt(e.get("minLoop")); + l.maxLoop = com_davidmaletz_mining_Main.parseInt(e.get("maxLoop")); + } + var color; + var colorScale; + if(e.exists("color")) { + color = com_davidmaletz_mining_Main.parseInt("0x" + e.get("color")); + } else { + color = 16777215; + } + if(e.exists("colorScale")) { + colorScale = com_davidmaletz_mining_Main.parseFloat(e.get("colorScale")); + } else { + colorScale = 1; + } + com_davidmaletz_faengfl_TextSprite.setColor(l,color,255 / colorScale); + this.addLayer(l,e); + var element = e.elements(); + while(element.hasNext()) { + var element1 = element.next(); + var s = l.addElement(element1,path); + if(s != null) { + if(this.posSprite == null) { + this.posSprite = [s]; + } else { + this.posSprite.push(s); + } + } + } + if(l.finish()) { + var s1 = l; + if(e.exists("day")) { + s1 = com_davidmaletz_mining_renderer_Parallax.enclose(s1,l,r); + if(e.get("day") == "true") { + this.day.push(s1); + } else { + this.night.push(s1); + } + } + var g = e.get("glow"); + if(g == "moon") { + s1 = com_davidmaletz_mining_renderer_Parallax.enclose(s1,l,r); + this.moon.push(s1); + } else if(g != "true") { + s1 = com_davidmaletz_mining_renderer_Parallax.enclose(s1,l,r); + this.normal.push(s1); + } + if(e.exists("alpha")) { + var old = s1; + s1 = new openfl_display_Sprite(); + s1.set_alpha(com_davidmaletz_mining_Main.parseFloat(e.get("alpha"))); + s1.addChild(old); + } + if(e.get("storm") == "false") { + if(e.exists("day")) { + var old1 = s1; + s1 = new openfl_display_Sprite(); + s1.addChild(old1); + } + if(this.no_storm == null) { + this.no_storm = [s1]; + } else { + this.no_storm.push(s1); + } + } + if(e.get("top") == "true") { + if(this.top == null) { + this.top = new openfl_display_Sprite(); + } + this.top.addChild(s1); + } else if(overWater) { + this.addChild(s1); + } else { + this.bg.addChild(s1); + } + } + } + } + ,setAr: function(ar,d) { + var _g = 0; + while(_g < ar.length) { + var l = ar[_g]; + ++_g; + l.set_alpha(d); + l.set_visible(d > 0); + } + } + ,setDay: function(d) { + this.setAr(this.day,d); + this.setAr(this.night,1 - d); + var r = this.ambient.r; + var g = this.ambient.g; + var b = this.ambient.b; + var _g = 0; + var _g1 = this.moon; + while(_g < _g1.length) { + var l = _g1[_g]; + ++_g; + var c = l.get_transform().get_colorTransform(); + c.redMultiplier = com_fancyfish_faeng_common_Utils.interp(1,r,d); + c.greenMultiplier = com_fancyfish_faeng_common_Utils.interp(1,g,d); + c.blueMultiplier = com_fancyfish_faeng_common_Utils.interp(1,b,d); + l.get_transform().set_colorTransform(c); + } + } + ,_setTime: function(time) { + if(this.forceTime != null) { + time = this.forceTime; + } + if(this.posSprite != null) { + var _g = 0; + var _g1 = this.posSprite; + while(_g < _g1.length) { + var p = _g1[_g]; + ++_g; + var percent = p.setTime(time); + if(p.sun) { + if(percent < 0.5) { + this.setAmbient(1,1,1); + this.setDay(1); + } else if(percent > 1) { + var f = com_fancyfish_faeng_common_Utils.clamp((percent - 1) * 4,0,1); + this.setAmbient(com_fancyfish_faeng_common_Utils.interp(1.25,0.2,f),com_fancyfish_faeng_common_Utils.interp(0.5,0.2,f),com_fancyfish_faeng_common_Utils.interp(0.5,0.2,f)); + this.setDay(1 - f); + } else { + this.setAmbient(1 + (percent - 0.5) * 0.5,com_fancyfish_faeng_common_Utils.clamp(2 - percent * 1.5,0,1),com_fancyfish_faeng_common_Utils.clamp(2 - percent * 1.5,0,1)); + this.setDay(1); + } + } + } + } + } + ,setAmbient: function(r,g,b) { + if(this.ambient.r != r || this.ambient.g != g || this.ambient.b != b) { + this.ambient.set(r,g,b); + var _g = 0; + var _g1 = this.normal; + while(_g < _g1.length) { + var l = _g1[_g]; + ++_g; + com_davidmaletz_mining_renderer_Parallax.setColor(l,r,g,b); + } + } + com_davidmaletz_mining_Main.setAmbient(this.area,this.ambient); + } + ,getAmbient: function() { + return this.ambient; + } + ,__class__: com_davidmaletz_mining_renderer_Parallax +}); +var com_davidmaletz_mining_renderer_ParallaxLayer = function(area,p,scroll,py,r,max_depth,e) { + this.partial = 0; + this.dx = 0; + this.offsetY = 0.0; + this.minLoop = null; + openfl_display_Sprite.call(this); + this.area = area; + this.percent = p; + this._width = e != null && e.exists("layerWidth") ? com_davidmaletz_mining_Main.parseInt(e.get("layerWidth")) : 1; + this._height = e != null && e.exists("layerHeight") ? com_davidmaletz_mining_Main.parseInt(e.get("layerHeight")) : 1; + this.scroll = scroll; + this.percentY = py; + this.bounds = r; + this.max_depth = max_depth; + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); + this.lockY = e != null && e.get("scale_py") == "true"; + if(e != null) { + this.id = e.get("id"); + } + if(scroll != 0 && this.id != null && com_davidmaletz_mining_renderer_ParallaxLayer.dxMap.exists(this.id)) { + this.dx = com_davidmaletz_mining_renderer_ParallaxLayer.dxMap.get(this.id); + } + this.forceLoop = e != null && e.get("forceLoop") == "true"; + this.scale = e != null && e.exists("scale") ? com_davidmaletz_mining_Main.parseFloat(e.get("scale")) : 1; +}; +$hxClasses["com.davidmaletz.mining.renderer.ParallaxLayer"] = com_davidmaletz_mining_renderer_ParallaxLayer; +com_davidmaletz_mining_renderer_ParallaxLayer.__name__ = ["com","davidmaletz","mining","renderer","ParallaxLayer"]; +com_davidmaletz_mining_renderer_ParallaxLayer.makeAnim = function(t,xml) { + var anim = xml.get("animation"); + var s; + if(anim == null) { + s = com_davidmaletz_tiles_Tile.makeIcon(t); + } else { + s = new com_davidmaletz_tiles_render_StaticPlayAnimation(t,anim,xml.exists("fps") ? com_davidmaletz_mining_Main.parseFloat(xml.get("fps")) : 15,xml.get("loop") != "false"); + } + if(xml.exists("offsetX")) { + s.set_x(com_davidmaletz_mining_Main.parseInt(xml.get("offsetX"))); + } + if(xml.exists("offsetY")) { + s.set_y(com_davidmaletz_mining_Main.parseInt(xml.get("offsetY"))); + } + return s; +}; +com_davidmaletz_mining_renderer_ParallaxLayer.point = null; +com_davidmaletz_mining_renderer_ParallaxLayer.__super__ = openfl_display_Sprite; +com_davidmaletz_mining_renderer_ParallaxLayer.prototype = $extend(openfl_display_Sprite.prototype,{ + _width: null + ,_height: null + ,area: null + ,minLoop: null + ,maxLoop: null + ,lockY: null + ,percent: null + ,layer: null + ,scroll: null + ,percentY: null + ,id: null + ,forceLoop: null + ,bounds: null + ,max_depth: null + ,offsetY: null + ,scale: null + ,getAreaX: function() { + var x = this.area.get_x(); + var v = this.area.area.vehicle; + if(v == null) { + return x; + } else { + return x - v.xPos + v.getRideableInfo().interior.offsetX; + } + } + ,getAreaY: function() { + var y = this.area.get_y() + this.offsetY; + var v = this.area.area.vehicle; + if(v == null) { + return y; + } else { + return y - v.yTop() + v.getRideableInfo().interior.offsetY; + } + } + ,_addChild: function(s,forceLoop) { + if(this.scroll != 0 || forceLoop) { + if(this.layer == null) { + this.layer = new openfl_display_Sprite(); + this.layer.set_scaleX(this.layer.set_scaleY(this.scale)); + this.addChild(this.layer); + } + this.layer.addChild(s); + } else { + this.addChild(s); + } + } + ,addElement: function(xml,path) { + var _g = xml.get_nodeName(); + switch(_g) { + case "clouds": + this.addChild(new com_davidmaletz_mining_renderer__$Parallax_Clouds(xml)); + break; + case "rect": + var d = new com_davidmaletz_faengfl_SolidDrawable(com_davidmaletz_mining_Main.parseInt("0x" + xml.get("color")),com_davidmaletz_mining_Main.parseInt(xml.get("width")),com_davidmaletz_mining_Main.parseInt(xml.get("height")),0,0,xml.exists("alpha") ? com_davidmaletz_mining_Main.parseFloat(xml.get("alpha")) : 1); + var s = d.create(xml.exists("x") ? com_davidmaletz_mining_Main.parseInt(xml.get("x")) : 0,xml.exists("y") ? com_davidmaletz_mining_Main.parseInt(xml.get("y")) : 0); + this._addChild(s,xml.get("loop") == "true" || this.forceLoop); + break; + case "tile": + if(xml.exists("id")) { + var t = com_davidmaletz_tiles_Tile.get(xml.get("id")); + if(t != null) { + if(xml.exists("rise")) { + var s1 = xml.exists("animation") ? com_davidmaletz_mining_renderer_ParallaxLayer.makeAnim(t,xml) : com_davidmaletz_tiles_Tile.makeIcon(t); + this._addChild(s1,xml.get("loop") == "true" || this.forceLoop); + return new com_davidmaletz_mining_renderer__$Parallax_PosSprite(s1,xml,t.getWidth(),t.getHeight()); + } else if(xml.exists("animation")) { + this._addChild(com_davidmaletz_mining_renderer_ParallaxLayer.makeAnim(t,xml),xml.get("loop") == "true" || this.forceLoop); + } else { + var b = t.getTileBase(); + if(b != null) { + this.addTile(b.sheet,b.x,b.y,xml); + } + } + } + } else { + this.addTile(com_davidmaletz_faengfl_AutoTileBitmap.get(com_davidmaletz_mining_Main.getResource(path,xml.get("sheet")),256,144),xml.exists("x") ? com_davidmaletz_mining_Main.parseInt(xml.get("x")) : 0,xml.exists("y") ? com_davidmaletz_mining_Main.parseInt(xml.get("y")) : 0,xml); + } + break; + } + return null; + } + ,_tiles: null + ,addTile: function(b,x,y,xml) { + var offX = xml.exists("offsetX") ? com_davidmaletz_mining_Main.parseInt(xml.get("offsetX")) : 0; + var ex = offX + b.tileWidth; + var offY = xml.exists("offsetY") ? com_davidmaletz_mining_Main.parseInt(xml.get("offsetY")) : 0; + var ey = offY + b.tileHeight; + if(!xml.exists("cap")) { + if(ex > this._width) { + this._width = ex; + } + if(ey > this._height) { + this._height = ey; + } + } + if(xml.exists("dy")) { + offY += com_davidmaletz_mining_Main.parseInt(xml.get("dy")); + } + if(this._tiles == null) { + this._tiles = []; + } + this._tiles.push(new com_davidmaletz_mining_renderer__$Parallax_Data(b,x,y,offX,offY,xml.get("cap"),xml.get("loop") != "false")); + } + ,update: function() { + var f = this.percent == 0 && this.percentY == 0 ? $bind(this,this.check_frame) : $bind(this,this.enter_frame); + f(null); + } + ,init: function(e) { + this.destroy(null); + var f = this.percent == 0 && this.percentY == 0 ? $bind(this,this.check_frame) : $bind(this,this.enter_frame); + openfl_Lib.current.stage.addEventListener("enterFrame",f,false,-1); + f(null); + } + ,destroy: function(e) { + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.check_frame)); + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.enter_frame)); + if(e != null && this.scroll != 0 && this.id != null) { + com_davidmaletz_mining_renderer_ParallaxLayer.dxMap.set(this.id,this.dx); + } + } + ,finish: function() { + if(this._tiles != null) { + var layer = null; + var offX = 256 / this.scale - this._width; + var nonLoop = null; + var _g = 0; + var _g1 = this._tiles; + while(_g < _g1.length) { + var t = _g1[_g]; + ++_g; + if(t.loop) { + if(layer == null) { + layer = new com_davidmaletz_faengfl_TileLayer(); + layer.start(); + } + var _g2 = t.cap; + switch(_g2) { + case "left": + t.b.addTile(layer.handler,t.x,t.y,offX - this._width - t.b.tileWidth,t.offY); + break; + case "right": + t.b.addTile(layer.handler,t.x,t.y,256,t.offY); + break; + default: + var x = offX + t.offX; + t.b.addTile(layer.handler,t.x,t.y,x,t.offY); + if(x + t.b.tileWidth > 0) { + t.b.addTile(layer.handler,t.x,t.y,x - this._width,t.offY); + } + } + } else { + if(nonLoop == null) { + nonLoop = new com_davidmaletz_faengfl_TileLayer(); + nonLoop.start(); + } + t.b.addTile(nonLoop.handler,t.x,t.y,t.offX,t.offY); + } + } + this._tiles = null; + if(nonLoop != null) { + nonLoop.finish(); + this.addChildAt(nonLoop,0); + } + if(layer != null) { + layer.finish(); + this.addChildAt(layer,0); + this._addChild(layer,true); + } + } + return this.get_numChildren() > 0; + } + ,dx: null + ,partial: null + ,updateVisible: function() { + this.set_visible(this.get_alpha() > 0 && this.getAreaY() >= -com_davidmaletz_tiles_Tile.SIZE * this.max_depth); + } + ,check_frame: function(e) { + if(this.bounds != null) { + var ax = this.getAreaX(); + var ay = this.getAreaY(); + var mw = 896.; + var mh = 504.; + var x = mw * 0.5 - ax; + var y = mh * 0.5 - ay; + if(this.bounds.contains(x,y)) { + this.set_alpha(1); + } else { + var dx = this.bounds.x == -Infinity ? 0 : x < this.bounds.x ? this.bounds.x - x : x - this.bounds.get_right(); + var dy = this.bounds.y == -Infinity ? 0 : y < this.bounds.y ? this.bounds.y - y : y - this.bounds.get_bottom(); + var d = Math.min(1 - dx / mw,1 - dy / mh); + this.set_alpha(d < 0 ? 0 : d); + } + } + this.set_scaleX(this.set_scaleY(1.0 / com_davidmaletz_mining_Main._getScale())); + this.updateVisible(); + } + ,enter_frame: function(e) { + var ax = this.getAreaX(); + var ay = this.getAreaY(); + if(this.bounds != null) { + var x = 128. - ax; + var y = 72. - ay; + if(this.bounds.contains(x,y)) { + this.set_alpha(1); + } else { + var dx = this.bounds.x == -Infinity ? 0 : x < this.bounds.x ? this.bounds.x - x : x - this.bounds.get_right(); + var dy = this.bounds.y == -Infinity ? 0 : y < this.bounds.y ? this.bounds.y - y : y - this.bounds.get_bottom(); + var d = Math.min(1 - dx / 256,1 - dy / 144); + this.set_alpha(d < 0 ? 0 : d); + } + } + var py = this.percentY; + if(this.scroll != 0 || this.percent <= 0.5 || this.percentY != 1 || this.lockY) { + var s = com_davidmaletz_mining_Main.getGameScale(); + this.set_scaleX(this.set_scaleY(s)); + ax -= 256 * (s - 1); + ax *= s; + ay -= 144 * (s - 1); + if(this.lockY) { + py *= s; + } + } + this.updateVisible(); + if(!this.get_visible()) { + return; + } + if(com_davidmaletz_mining_renderer_ParallaxLayer.point == null) { + com_davidmaletz_mining_renderer_ParallaxLayer.point = new openfl_geom_Point(); + } + if(this.scroll != 0) { + this.partial += com_davidmaletz_faengfl_FaengFL.frameTime * Math.abs(this.scroll); + var i = Math.floor(this.partial); + if(i > 0) { + this.partial -= i; + this.dx += com_fancyfish_faeng_common_Utils.sign(this.scroll) * i; + } + } + this.set_x(Math.round(ax * this.percent) + this.dx); + this.set_y(Math.round((ay - this._height) * py)); + if(this.layer != null) { + var w = openfl_Lib.current.stage.stageWidth; + com_davidmaletz_mining_renderer_ParallaxLayer.point.setTo((js_Boot.__cast(com_davidmaletz_mining_Main.getContainer() , openfl_display_DisplayObject)).get_x(),0); + var p = this.globalToLocal(com_davidmaletz_mining_renderer_ParallaxLayer.point); + var w1 = this._width * this.scale; + var l = Math.ceil(p.x / w1); + if(this.minLoop != null) { + l = com_fancyfish_faeng_common_Utils.clampi(l,this.minLoop,this.maxLoop); + } + this.layer.set_x(l * w1); + } + } + ,__class__: com_davidmaletz_mining_renderer_ParallaxLayer +}); +var com_davidmaletz_mining_renderer__$Parallax_Data = function(b,x,y,offX,offY,cap,loop) { + this.b = b; + this.x = x; + this.y = y; + this.offX = offX; + this.offY = offY; + this.cap = cap; + this.loop = loop; +}; +$hxClasses["com.davidmaletz.mining.renderer._Parallax.Data"] = com_davidmaletz_mining_renderer__$Parallax_Data; +com_davidmaletz_mining_renderer__$Parallax_Data.__name__ = ["com","davidmaletz","mining","renderer","_Parallax","Data"]; +com_davidmaletz_mining_renderer__$Parallax_Data.prototype = { + b: null + ,x: null + ,y: null + ,offX: null + ,offY: null + ,cap: null + ,loop: null + ,__class__: com_davidmaletz_mining_renderer__$Parallax_Data +}; +var com_davidmaletz_mining_renderer__$Parallax_Clouds = function(xml) { + this.frames = 10; + openfl_display_Sprite.call(this); + this.set_alpha(0.95); + this.tiles = []; + var e = xml.elementsNamed("tile"); + while(e.hasNext()) { + var e1 = e.next(); + var t = com_davidmaletz_tiles_Tile.get(e1.get("id")); + if(t != null) { + this.tiles.push(t); + } + } + this.count = xml.exists("count") ? com_davidmaletz_mining_Main.parseInt(xml.get("count")) : 3; + this.kind = com_davidmaletz_mining_renderer__$Parallax_Clouds.last == null ? 0 : com_davidmaletz_mining_renderer__$Parallax_Clouds.last.kind - this.count; + if(this.kind < 0) { + this.kind -= this.tiles.length * Math.floor(this.kind / this.tiles.length); + } + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); +}; +$hxClasses["com.davidmaletz.mining.renderer._Parallax.Clouds"] = com_davidmaletz_mining_renderer__$Parallax_Clouds; +com_davidmaletz_mining_renderer__$Parallax_Clouds.__name__ = ["com","davidmaletz","mining","renderer","_Parallax","Clouds"]; +com_davidmaletz_mining_renderer__$Parallax_Clouds.last = null; +com_davidmaletz_mining_renderer__$Parallax_Clouds.__super__ = openfl_display_Sprite; +com_davidmaletz_mining_renderer__$Parallax_Clouds.prototype = $extend(openfl_display_Sprite.prototype,{ + count: null + ,frames: null + ,kind: null + ,tiles: null + ,init: function(e) { + this.destroy(e); + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.enter_frame),false,-1); + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this); + var _g1 = 0; + var _g = this.count; + while(_g1 < _g) { + var i = _g1++; + var c = this.addCloud(); + if(com_davidmaletz_mining_renderer__$Parallax_Clouds.last == null || i >= com_davidmaletz_mining_renderer__$Parallax_Clouds.last.get_numChildren()) { + c.set_x(Math.floor(i * 256 / (this.count - 0.5))); + } else { + var o = com_davidmaletz_mining_renderer__$Parallax_Clouds.last.getChildAt(i); + c.set_x(o.get_x()); + c.set_y(o.get_y()); + } + } + com_davidmaletz_mining_renderer__$Parallax_Clouds.last = this; + } + ,destroy: function(e) { + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.enter_frame)); + } + ,addCloud: function() { + var cloud = com_davidmaletz_mining_item_ItemInfo._createIcon(this.tiles[this.kind]); + this.kind++; + if(this.kind >= this.tiles.length) { + this.kind = 0; + } + cloud.set_x(256); + cloud.set_y(Math.round(Math.random() * 40)); + this.addChild(cloud); + return cloud; + } + ,handleCloud: function(cloud) { + var _g = cloud; + var _g1 = _g.get_x(); + _g.set_x(_g1 - 1); + return cloud.get_x() + 53 > 0; + } + ,enter_frame: function(e) { + var st = this.get_numChildren(); + var _g1 = st; + var _g = this.count; + while(_g1 < _g) { + var i = _g1++; + this.addCloud(); + } + this.frames -= com_davidmaletz_faengfl_FaengFL.frameTime; + if(this.frames <= 0) { + this.frames = 10; + var _g11 = 0; + var _g2 = this.count; + while(_g11 < _g2) { + var i1 = _g11++; + if(!this.handleCloud(this.getChildAt(this.count - 1 - i1))) { + this.removeChildAt(this.count - 1 - i1); + } + } + } + } + ,__class__: com_davidmaletz_mining_renderer__$Parallax_Clouds +}); +var com_davidmaletz_mining_renderer__$Parallax_PosSprite = function(s,xml,w,h) { + this.sprite = s; + this.rise = com_davidmaletz_mining_Main.parseFloat(xml.get("rise")); + this.set = com_davidmaletz_mining_Main.parseFloat(xml.get("set")); + this.width = w; + this.height = h; + this.left = xml.get("dir") == "left"; + this.top = xml.exists("pathTop") ? com_davidmaletz_mining_Main.parseFloat(xml.get("pathTop")) : 0; + this.pathHeight = xml.exists("pathHeight") ? com_davidmaletz_mining_Main.parseFloat(xml.get("pathHeight")) : 64; + this.sun = xml.get("sun") == "true"; +}; +$hxClasses["com.davidmaletz.mining.renderer._Parallax.PosSprite"] = com_davidmaletz_mining_renderer__$Parallax_PosSprite; +com_davidmaletz_mining_renderer__$Parallax_PosSprite.__name__ = ["com","davidmaletz","mining","renderer","_Parallax","PosSprite"]; +com_davidmaletz_mining_renderer__$Parallax_PosSprite.prototype = { + sprite: null + ,rise: null + ,set: null + ,width: null + ,height: null + ,left: null + ,pathHeight: null + ,top: null + ,sun: null + ,setTime: function(time) { + var r = this.set - this.rise; + if(r < 0) { + r += 24; + } + var d = (24 - r) * 0.5; + var x = (com_fancyfish_faeng_common_Utils.mod(time - this.rise + d,24) - d) / r; + if(this.left) { + x = 1 - x; + } + var t = 256 * x; + var ret = (0.00390625 * t * t - t + 64) / 64; + x = (256 + this.width) * x - this.width * 0.5; + if(this.sprite != null) { + this.sprite.set_x(Math.round((x - this.width * 0.5) * 2) * 0.5); + this.sprite.set_y(Math.round((ret * this.pathHeight - this.height * 0.5 + this.top) * 2) * 0.5); + } + return ret; + } + ,__class__: com_davidmaletz_mining_renderer__$Parallax_PosSprite +}; +var com_davidmaletz_mining_renderer_PlayerRendererBase = function(p,fps) { + this.anim_id = "idle"; + this.equipComplete = null; + com_davidmaletz_lerp_LerpSpriteFL.call(this); + this.sprite = new com_davidmaletz_mining_renderer__$PlayerRendererBase_PlayerSprite(p,fps); + this.player = p; + this.addChild(this.sprite); +}; +$hxClasses["com.davidmaletz.mining.renderer.PlayerRendererBase"] = com_davidmaletz_mining_renderer_PlayerRendererBase; +com_davidmaletz_mining_renderer_PlayerRendererBase.__name__ = ["com","davidmaletz","mining","renderer","PlayerRendererBase"]; +com_davidmaletz_mining_renderer_PlayerRendererBase.__super__ = com_davidmaletz_lerp_LerpSpriteFL; +com_davidmaletz_mining_renderer_PlayerRendererBase.prototype = $extend(com_davidmaletz_lerp_LerpSpriteFL.prototype,{ + player: null + ,sprite: null + ,equipComplete: null + ,arms: null + ,top: null + ,init: function(e) { + com_davidmaletz_lerp_LerpSpriteFL.prototype.init.call(this,e); + var s = this.player.equipment.iterator(); + while(s.hasNext()) { + var s1 = s.next(); + s1.addEventListener("updated",$bind(this,this.change_equipment)); + } + var s2 = this.player.vanity.iterator(); + while(s2.hasNext()) { + var s3 = s2.next(); + s3.addEventListener("updated",$bind(this,this.change_equipment_vanity)); + } + this.player.shield.addEventListener("updated",$bind(this,this.change_equipment)); + this.change_equipment(null); + var anim = this.anim_id; + this.anim_id = null; + this.setAnimation(anim); + this.player.addEventListener("update_colors",$bind(this,this.updateColors)); + this.updateColors(null); + } + ,destroy: function(e) { + com_davidmaletz_lerp_LerpSpriteFL.prototype.destroy.call(this,e); + var s = this.player.equipment.iterator(); + while(s.hasNext()) { + var s1 = s.next(); + s1.removeEventListener("updated",$bind(this,this.change_equipment)); + } + var s2 = this.player.vanity.iterator(); + while(s2.hasNext()) { + var s3 = s2.next(); + s3.removeEventListener("updated",$bind(this,this.change_equipment_vanity)); + } + this.player.shield.removeEventListener("updated",$bind(this,this.change_equipment)); + this.player.removeEventListener("update_colors",$bind(this,this.updateColors)); + } + ,getFramesPerSecond: function() { + return this.sprite.getFramesPerSecond(); + } + ,anim_id: null + ,isAnim: function(anim_id) { + return this.anim_id == anim_id; + } + ,updateArmColor: function() { + com_davidmaletz_faengfl_TextSprite.setColor(this.arms,this.player.getArmColor(),163); + } + ,setAnimation: function(anim_id) { + if(this.player.getHealth() <= 0 && anim_id != "death") { + return; + } + this.anim_id = anim_id; + this.sprite.setAnimation(anim_id); + var a = this.sprite.sprite.animation; + this.updateArms(a); + if(com_davidmaletz_tiles_TileAnimation.exists(a + ".top")) { + if(this.top == null) { + this.top = new com_davidmaletz_tiles_render_PlayAnimation(this.sprite.sprite.tile,a + ".top",this.getFramesPerSecond(),true,null,-0.5,-0.5); + } else { + this.top.playAnimation(a + ".top",true,null,-0.5,-0.5); + } + this.addChild(this.top); + } else if(this.top != null) { + com_davidmaletz_faengfl_FaengFL.remove(this.top); + this.top = null; + } + } + ,updateArms: function(a) { + var show = this.player.showArms(); + if(show == 2) { + a = StringTools.replace(a,".swim",".idle"); + } + if(show != 0 && com_davidmaletz_tiles_TileAnimation.exists(a + ".arms")) { + if(this.arms == null) { + this.arms = new com_davidmaletz_tiles_render_PlayAnimation(this.sprite.sprite.tile,a + ".arms",this.getFramesPerSecond(),true,null,-0.5,-0.5); + this.updateArmColor(); + this.addChild(this.arms); + } else { + this.arms.playAnimation(a + ".arms",true,null,-0.5,-0.5); + } + } else if(this.arms != null) { + com_davidmaletz_faengfl_FaengFL.remove(this.arms); + this.arms = null; + } + } + ,incFrame: function(df,loop) { + this.incEquipFrame(df,false); + return this.sprite.incFrame(df,loop); + } + ,advance: function(df,loop) { + this._advanceFrame(df); + if(this.arms != null) { + var old = this.arms.loop; + this.arms.loop = loop; + this.arms.advanceFrame(df); + this.arms.loop = old; + } + return this.sprite.incFrame(df,loop); + } + ,change_equipment: function(e) { + this.dispatchEvent(new openfl_events_Event("update_equipment")); + this.updateEquipment(); + this.updateArms(this.sprite.sprite.animation); + } + ,change_equipment_vanity: function(e) { + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.change_vanity)); + } + ,change_vanity: function(e) { + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.change_vanity)); + if(this.stage != null) { + this.sprite.updateEquipment(); + } + } + ,updateEquipment: function() { + this.sprite.updateEquipment(); + } + ,setActive: function(i,name,slot) { + this.sprite.setActive(i,name,slot); + } + ,getActive: function() { + return this.sprite.active; + } + ,_advanceFrame: function(frames) { + com_davidmaletz_lerp_LerpSpriteFL.prototype.advanceFrame.call(this,frames); + } + ,advanceFrame: function(frames) { + com_davidmaletz_lerp_LerpSpriteFL.prototype.advanceFrame.call(this,frames); + this.incFrame(frames,true); + } + ,updateColors: function(e) { + this.sprite.updateColors(); + if(this.arms != null) { + this.updateArmColor(); + } + } + ,setItemAnimation: function(slot,anim,loop,dispatch) { + if(dispatch == null) { + dispatch = true; + } + if(loop == null) { + loop = true; + } + var i = this.sprite.items.get(slot); + if(i != null) { + i.playAnim(anim,loop); + } + if(dispatch) { + this.player.dispatchEvent(new com_davidmaletz_mining_renderer_ItemAnimEvent("item_anim",slot,anim,loop)); + } + return i; + } + ,playEquipAnim: function(id,complete) { + var a = this.getActive(); + a.setAnimation(id,-0.5,-0.5); + a.setFrame(0); + this.equipComplete = complete; + } + ,clearEquipAnim: function() { + this.equipComplete = null; + this.setAnimation("idle"); + this.clearEquipment(); + } + ,clearEquipment: function() { + if(this.equipComplete != null) { + var px = this.player.getCenterX(); + var py = this.player.getCenterY() + this.player._offsetY; + var f = this.equipComplete; + this.equipComplete = null; + f(true); + this.set_x(px); + this.set_y(py); + } + this.endToolAction(); + } + ,attacking: null + ,fireEquipComplete: function(px,py) { + if(this.equipComplete != null) { + var f = this.equipComplete; + this.equipComplete = null; + f(false); + if(!this.hasTrack(com_davidmaletz_lerp_PositionKeyframe)) { + this.set_x(px); + this.set_y(py); + } + } + } + ,incEquipFrame: function(f,loop) { + if(this.attacking != null) { + var px = this.player.area == null ? 0 : this.player.getCenterX(); + var py = this.player.area == null ? 0 : this.player.getCenterY() + this.player._offsetY; + var equipment = this.attacking; + var l = loop; + if(com_davidmaletz_tiles_TileAnimation.exists(equipment.animation + ".loop")) { + l = false; + } + if(!equipment.incFrame(f,l)) { + if(loop) { + equipment._setAnimation(equipment.animation + ".loop"); + } else { + equipment.setFrame(0); + this.fireEquipComplete(px,py); + } + } else if(this.equipComplete != null) { + var f1 = equipment.getCurrentFrame(); + if(!this.hasTrack(com_davidmaletz_lerp_PositionKeyframe)) { + this.set_x(px + f1.parentX * this.get_scaleX()); + this.set_y(py + f1.parentY); + } + } + } + } + ,endToolAction: function() { + this.sprite.showSlots(); + this.sprite.locked = null; + if(this.attacking != null) { + this.sprite.resetItemAnim(this.attacking); + this.attacking = null; + } + this.player.dispatchEvent(new openfl_events_Event("end_tool")); + } + ,useTool: function(tool,p,name,slot) { + if(!this.isAnim("action")) { + this.setAnimation("action"); + } + if(tool.xml.get("slot") != "shield") { + this.attacking = this.getActive(); + this.setActive(tool,name,slot); + this.getActive().setAnimation(null); + if(p != null && tool.xml.exists("drawAnim")) { + var tile = p.getTile(); + if(tile != null) { + var t = p.isGlow() ? new com_davidmaletz_mining_renderer_GlowTileRenderer(tile,this.getFramesPerSecond()) : new com_davidmaletz_tiles_render_TileAnimationRenderer(tile,this.getFramesPerSecond()); + com_davidmaletz_faengfl_TextSprite.setColor(t,p.getColor(),p.getWhite()); + t.setAnimation(tool.xml.get("drawAnim")); + this.getActive().setProjectile(t); + } + } + } else { + this.attacking = this.setItemAnimation("shield",null,true,false); + } + this.sprite.locked = this.attacking; + this.player.dispatchEvent(new com_davidmaletz_mining_ToolEvent("use_tool",tool,p,name == null ? null : name.getName(),slot)); + } + ,__class__: com_davidmaletz_mining_renderer_PlayerRendererBase +}); +var com_davidmaletz_mining_renderer_PlayerObjectRenderer = function(p) { + this.hitEffectCooldown = 0; + this.stunCt = 0; + this.resetCt = 0; + this.loop_sfx_name = null; + this.loop_sfx = null; + this.onComplete = null; + com_davidmaletz_mining_renderer_PlayerRendererBase.call(this,p,15); + if(p.area != null && p.area.renderer != null && p.area.renderer.light != null) { + this.light = new com_davidmaletz_mining_effects_Torchlight(this,p.getInfo().light); + } +}; +$hxClasses["com.davidmaletz.mining.renderer.PlayerObjectRenderer"] = com_davidmaletz_mining_renderer_PlayerObjectRenderer; +com_davidmaletz_mining_renderer_PlayerObjectRenderer.__name__ = ["com","davidmaletz","mining","renderer","PlayerObjectRenderer"]; +com_davidmaletz_mining_renderer_PlayerObjectRenderer.nothing = function() { +}; +com_davidmaletz_mining_renderer_PlayerObjectRenderer.__super__ = com_davidmaletz_mining_renderer_PlayerRendererBase; +com_davidmaletz_mining_renderer_PlayerObjectRenderer.prototype = $extend(com_davidmaletz_mining_renderer_PlayerRendererBase.prototype,{ + light: null + ,onComplete: null + ,init: function(e) { + com_davidmaletz_mining_renderer_PlayerRendererBase.prototype.init.call(this,e); + this.player.hidden.addEventListener("updated",$bind(this,this.updateHidden)); + this.player.addEventListener("change_health",$bind(this,this.damage)); + this.equipmentChanged(); + this.player.area.lightTiles(this.player.get_tile_x(),this.player.get_tile_y(),this.player.getLightRange()); + if(this.light != null && this.player.area.renderer != null && this.player.area.renderer.light != null) { + this.player.area.renderer.light.addChild(this.light); + } + } + ,destroy: function(e) { + com_davidmaletz_mining_renderer_PlayerRendererBase.prototype.destroy.call(this,e); + this.player.removeEventListener("change_health",$bind(this,this.damage)); + this.player.hidden.removeEventListener("updated",$bind(this,this.updateHidden)); + if(this.light != null) { + com_davidmaletz_faengfl_FaengFL.remove(this.light); + } + this.setLoopSfx(null); + if(this.loop_sfx != null) { + this.loop_sfx.stop(); + this.loop_sfx = null; + } + } + ,loop_sfx: null + ,loop_sfx_name: null + ,setLoopSfx: function(sfx,localize) { + if(localize == null) { + localize = false; + } + if(this.stage == null) { + sfx = null; + } + if(sfx == this.loop_sfx_name) { + return; + } + if(this.loop_sfx != null) { + this.loop_sfx.stop(); + this.loop_sfx = null; + } + this.loop_sfx_name = sfx; + if(this.loop_sfx_name != null) { + this.loop_sfx = localize ? com_davidmaletz_faengfl_adv_sound_Sound.playLoc(this.loop_sfx_name,this,null,true) : com_davidmaletz_faengfl_adv_sound_Sound.play(this.loop_sfx_name,true); + } + } + ,kill: function() { + } + ,teleport: function() { + this.set_y(this.player.getCenterY() + this.player._offsetY); + this.updateScroll(true); + this.clearTrack(com_davidmaletz_lerp_PositionKeyframe); + } + ,updateScroll: function(instant) { + if(com_davidmaletz_mining_Main.getLocalPlayer() == this.player && com_davidmaletz_mining_Main.currentAreaRenderer != null && this.player.renderer == this && this.player.area != null) { + com_davidmaletz_mining_Main.currentAreaRenderer.centerOn(this.get_x(),this.get_y(),this.player.cameraCentered(),instant); + } + } + ,clearNextLoop: function() { + } + ,playIdle: function() { + var a = this.player.isFlying() ? "hover" : this.player.isUnderwater() ? "swim" : "idle"; + if(!this.isAnim(a)) { + this.setAnimation(a); + } + this.clearNextLoop(); + } + ,canStun: function() { + if(!(this.stunCt <= 0)) { + return this.stunCt == (this.player.stats.getInt("stun_resist") + 4) * 10; + } else { + return true; + } + } + ,updateStun: function() { + this.stunCt = (this.player.stats.getInt("stun_resist") + 4) * 10; + } + ,resetCt: null + ,stunCt: null + ,hitEffectCooldown: null + ,damage: function(e) { + if(e.delta >= 0 || this.player.area == null) { + return; + } + if(e.attacker != null && e.attacker != this.player && !this.isAnim("hit") && this.stunCt <= 0) { + this.set_scaleX(e.attacker.getCenterX() > this.player.getCenterX() ? -this.get_scaleY() : this.get_scaleY()); + this.player.hidden.set(null); + if(this.equipComplete != null) { + var f = this.equipComplete; + this.equipComplete = null; + f(false); + } + this.sprite.setFrame(0); + this.setAnimation("hit"); + this.clearTrack(com_davidmaletz_lerp_AlphaKeyframe); + this.onComplete = $bind(this,this.playIdle); + this.updateStun(); + } else { + com_davidmaletz_faengfl_TextSprite.setColor(this.sprite,16737894); + this.resetCt = 10; + } + } + ,flash: function(color,frames) { + if(frames == null) { + frames = 10; + } + com_davidmaletz_faengfl_TextSprite.setColor(this.sprite,color); + this.resetCt = frames; + } + ,updateHidden: function(e) { + this.set_alpha(this.get_alpha() == 0 ? 0 : 1); + } + ,set_alpha: function(f) { + if(this.player.hidden.get() != null) { + f *= 0.5; + } + return com_davidmaletz_mining_renderer_PlayerRendererBase.prototype.set_alpha.call(this,f); + } + ,playAnimation: function(id,complete) { + this.player.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("play",id)); + this.showAnim(id,complete); + } + ,showAnim: function(id,complete) { + this.setAnimation(id); + this.onComplete = complete == null ? com_davidmaletz_mining_renderer_PlayerObjectRenderer.nothing : complete; + } + ,updateEquipment: function() { + com_davidmaletz_mining_renderer_PlayerRendererBase.prototype.updateEquipment.call(this); + var s = this.player.shield.get(); + if(s != null) { + this.setActive(s.info,s.getName(),"shield"); + } else if(this.equipComplete == null) { + var eq = this.player.equipment.getItem("weapon"); + if(eq != null) { + this.setActive(eq.info,eq.getName(),"weapon"); + } else { + eq = this.player.equipment.getItem("pickaxe"); + if(eq != null && !this.player.isUnderwater() && (eq.info.xml.get("hideOffhand") != "true" || this.player.equipment.getItem("shield") == null)) { + this.setActive(eq.info,eq.getName(),"pickaxe"); + } else { + this.getActive().set_visible(this.attacking == this.getActive()); + return; + } + } + } + this.clearNextLoop(); + } + ,equipmentChanged: function() { + if(this.light == null) { + return; + } + var underwater = this.player.area.isWater(this.player.get_tile_x(),this.player.get_tile_y()); + var first = true; + var m = this.player.equipment.iterator(); + while(m.hasNext()) { + var m1 = m.next(); + var e = m1.get(); + var l = e == null ? null : e.info.getLight(e.getNameStr()); + if(l != null && e.info.canUse(this.player) && this.player.checkUnderwater(e.info,underwater)) { + if(first) { + first = false; + this.light.update(l); + } else { + this.light.add(l); + } + } + } + var l1 = this.player.getModLight(); + if(l1 != null) { + if(first) { + first = false; + this.light.update(l1); + } else { + this.light.add(l1); + } + } + if(first) { + this.light.update(this.player.getInfo().light); + } + } + ,playWalk: function(force) { + if(this.player.getHealth() > 0) { + var u = this.player.isUnderwater(); + var a = this.player.isFlying() ? "fly" : u ? "swim" : "walk"; + if(force || !this.isAnim(a)) { + this.setAnimation(a); + if(u) { + this.clearNextLoop(); + } + } + } + } + ,updateWeight: function() { + if(this.isAnim("walk")) { + var f = this.sprite.getAnimFrame(); + this.playWalk(true); + this.sprite.setFrame(f); + } + } + ,__class__: com_davidmaletz_mining_renderer_PlayerObjectRenderer +}); +var com_davidmaletz_mining_renderer_PlayerRenderer = function(p) { + this.crushWarning = null; + this.old_x = NaN; + this.move_frames = 0; + this.wasUnderwater = false; + this.o2partial = 0; + this.next_loop = null; + this.allowFlight = false; + this.second = 60; + this.clamp_ct = 0; + this.turn_ct = 0; + this.attackRepeatSlot = null; + this.attackRepeat = 0; + this.last_dig_y = -1000; + this.last_dig_x = -1000; + this.digging = false; + this.last_pump_y = 0; + this.last_pump_x = 0; + this.partial = 0; + this.fallCost = 0; + this.moveCost = 0; + this.isMining = false; + this.attack_ct = 0; + this.canEnterStructure = true; + this.nextLoop = null; + com_davidmaletz_mining_renderer_PlayerObjectRenderer.call(this,p); +}; +$hxClasses["com.davidmaletz.mining.renderer.PlayerRenderer"] = com_davidmaletz_mining_renderer_PlayerRenderer; +com_davidmaletz_mining_renderer_PlayerRenderer.__name__ = ["com","davidmaletz","mining","renderer","PlayerRenderer"]; +com_davidmaletz_mining_renderer_PlayerRenderer.__interfaces__ = [com_davidmaletz_faengfl_IScrollable]; +com_davidmaletz_mining_renderer_PlayerRenderer.nothing = function() { +}; +com_davidmaletz_mining_renderer_PlayerRenderer.fireProjectile = function(player,area,projectile,item,s,df,canFire,dx,dy,delay) { + if(delay == null) { + delay = -1; + } + if(dy == null) { + dy = 0; + } + if(dx == null) { + dx = 0; + } + var xml = projectile.getProjectile(); + if(xml == null) { + return null; + } + var first_xml = xml; + var fireAll = projectile.xml.get("fireAll") == "true"; + var weap = js_Boot.__cast(item.info , com_davidmaletz_mining_item_Equipment); + var atk = weap.getAttack(item.getNameStr()) + (projectile == item.info ? 0 : (js_Boot.__cast(projectile , com_davidmaletz_mining_item_Equipment)).attack); + var cut = weap.getCut(item.getNameStr()) + (projectile == item.info ? 0 : (js_Boot.__cast(projectile , com_davidmaletz_mining_item_Equipment)).cut); + var spirit = weap.getSpirit(item.getNameStr()) + (projectile == item.info ? 0 : (js_Boot.__cast(projectile , com_davidmaletz_mining_item_Equipment)).spirit); + var first = null; + var scaleX = com_fancyfish_faeng_common_Utils.sign(s.get_scaleX()); + var speed = weap.xml.exists("speed") ? com_davidmaletz_mining_Main.parseInt(weap.xml.get("speed")) : 0; + while(true) { + var aimX = -scaleX; + var aimY = 0; + if(xml.exists("aimX")) { + aimX *= com_davidmaletz_mining_Main.parseFloat(xml.get("aimX")); + } + if(xml.exists("aimY")) { + aimY = com_davidmaletz_mining_Main.parseFloat(xml.get("aimY")); + } + var spd = Math.sqrt(aimX * aimX + aimY * aimY); + aimX /= spd; + aimY /= spd; + var p = new com_davidmaletz_mining_world_Projectile(player,xml,atk,cut,spirit,(weap.range + player.stats.getInt("range")) * com_davidmaletz_tiles_Tile.SIZE,projectile._getElement(item.getNameStr()),aimX,aimY,df,s,canFire,null,$bind(player,player.addAttackExp),null,speed); + if(projectile.xml.get("tintProjectile") == "true" && projectile != weap) { + p.color = projectile.color; + p.colorScale = projectile.colorScale; + } + if(weap.xml.get("underwater") == "true") { + p.setFlag(2,true); + } + if(delay >= 0) { + p.delay += Math.round(delay / df); + } else if(weap.xml.exists("delay")) { + p.delay += Math.round(com_davidmaletz_mining_Main.parseFloat(weap.xml.get("delay")) / df); + } + p.xPos += dx; + p.yPos += dy; + if(weap.xml.exists("offsetX")) { + p.xPos += com_davidmaletz_mining_Main.parseInt(weap.xml.get("offsetX")) * scaleX; + } + if(weap.xml.exists("offsetY")) { + p.yPos += com_davidmaletz_mining_Main.parseInt(weap.xml.get("offsetY")); + } + if(weap.xml.exists("speedMul")) { + var s1 = com_davidmaletz_mining_Main.parseFloat(weap.xml.get("speedMul")); + p.dx *= s1; + p.dy *= s1; + } + if(first != null) { + p.fire_sfx = null; + } + if(weap.xml.get("tintProjectile") == "true") { + weap.tintProjectile(p,item.getNameStr()); + } + area.addProjectile(p); + if(first == null) { + first = p; + if(xml.get("leftRight") == "true") { + scaleX = -scaleX; + } else { + var tmp; + if(!(!fireAll)) { + xml = projectile.getProjectile(); + tmp = xml == first_xml; + } else { + tmp = true; + } + if(tmp) { + break; + } + } + } else { + var tmp1; + if(!(!fireAll)) { + xml = projectile.getProjectile(); + tmp1 = xml == first_xml; + } else { + tmp1 = true; + } + if(tmp1) { + break; + } + } + } + if(first.fire_sfx == null) { + first.fire_sfx = weap.xml.get("fire_sfx"); + } + return first; +}; +com_davidmaletz_mining_renderer_PlayerRenderer.isType = function(t,mask) { + switch(t) { + case "enemy": + return (mask & 1) != 0; + case "tree": + return (mask & 2) != 0; + default: + return false; + } +}; +com_davidmaletz_mining_renderer_PlayerRenderer.checkSwing = function(object,p,item,weap,fps) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + com_davidmaletz_mining_renderer_PlayerRenderer.__checkSwing(object,p,item,weap,fps); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; +}; +com_davidmaletz_mining_renderer_PlayerRenderer.__checkSwing = function(object,p,item,weap,fps) { + var r = object.getSprite(); + if(r != null && object.area != null) { + var b = object.getBounds(); + var range = 0.75; + var xml = item.info.xml; + var s = com_fancyfish_faeng_common_Utils.sign(r.get_scaleX()); + if(xml.exists("melee_range")) { + var r1 = com_davidmaletz_mining_Main.parseFloat(xml.get("melee_range")) * com_davidmaletz_tiles_Tile.SIZE; + if(s < 0) { + var _g = b; + _g.set_right(_g.get_right() + r1); + } else { + var _g1 = b; + _g1.set_left(_g1.get_left() - r1); + } + } + if(xml.exists("expandTop")) { + var _g2 = b; + _g2.set_top(_g2.get_top() - com_davidmaletz_mining_Main.parseFloat(xml.get("expandTop")) * com_davidmaletz_tiles_Tile.SIZE); + } + if(xml.exists("expandBottom")) { + var _g3 = b; + _g3.set_bottom(_g3.get_bottom() + com_davidmaletz_mining_Main.parseFloat(xml.get("expandTop")) * com_davidmaletz_tiles_Tile.SIZE); + } + b.width -= 8; + b.x -= s * com_davidmaletz_tiles_Tile.SIZE * range - 4; + var type = 0; + var build = com_davidmaletz_mining_Main.parseInt(weap.xml.get("build")); + var hit = []; + var bp = null; + if(build > 0) { + bp = []; + } + var checkHit = function(o,rect) { + if(!o.getHitbox().intersects(rect)) { + return false; + } + if(o != object) { + var n = item.getNameStr(); + if(o.attackPower(weap.getAttack(n),weap.getCut(n),weap.getSpirit(n),item.getElement(),true) > 0) { + if(Std["is"](o,com_davidmaletz_mining_enemy_Enemy)) { + type |= 1; + } else { + type |= 2; + } + hit.push(o); + } + if(bp != null && o.getHealth() > 0 && Std["is"](o,com_davidmaletz_mining_world_BlueprintObject)) { + bp.push(o); + } + } + return false; + }; + object.area.getObjects(b,checkHit); + var ct = hit.length; + if(bp != null) { + ct += bp.length; + } + if(ct == 0) { + var tmp = com_fancyfish_faeng_common_Lang.getText("common","miss"); + object.showPopup(true,tmp,-com_davidmaletz_tiles_Tile.SIZE); + } else { + var _g4 = 0; + while(_g4 < hit.length) { + var o1 = hit[_g4]; + ++_g4; + var tmp1 = p.getOwner(); + com_davidmaletz_mining_Player.attackObject(object,tmp1,item,o1); + } + if(bp != null) { + var _g5 = 0; + while(_g5 < bp.length) { + var o2 = bp[_g5]; + ++_g5; + o2.heal(build); + } + } + com_davidmaletz_mining_Player._increaseValue(p,item,1); + var e = xml.elementsNamed("onHit"); + while(e.hasNext()) { + var e1 = e.next(); + if(!e1.exists("type") || com_davidmaletz_mining_renderer_PlayerRenderer.isType(e1.get("type"),type)) { + r.addChild(new com_davidmaletz_tiles_render_PlayAnimation(com_davidmaletz_tiles_Tile.get(e1.get("tile")),e1.get("animation"),fps,false,com_davidmaletz_faengfl_FaengFL.remove,-0.5,-0.5)); + } + } + } + } +}; +com_davidmaletz_mining_renderer_PlayerRenderer.__super__ = com_davidmaletz_mining_renderer_PlayerObjectRenderer; +com_davidmaletz_mining_renderer_PlayerRenderer.prototype = $extend(com_davidmaletz_mining_renderer_PlayerObjectRenderer.prototype,{ + nextLoop: null + ,init: function(e) { + com_davidmaletz_mining_renderer_PlayerObjectRenderer.prototype.init.call(this,e); + com_davidmaletz_controls_Controller.instance.addEventListener("tap",$bind(this,this.onKey)); + this.checkUnderwater(this.player.area.isWater(this.player.get_tile_x(),this.player.get_tile_y()),false); + if(this.player.renderer == this) { + this.player.refreshGUI(); + } + } + ,destroy: function(e) { + com_davidmaletz_mining_renderer_PlayerObjectRenderer.prototype.destroy.call(this,e); + com_davidmaletz_controls_Controller.instance.removeEventListener("tap",$bind(this,this.onKey)); + if(e != null) { + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.advanceDeath)); + } + if(e != null && this.player.renderer == this) { + this.player.destroyGUI(); + } + } + ,canEnterStructure: null + ,onKey: function(e) { + if(this.stage == null || this.player.renderer != this) { + this.destroy(null); + return; + } + if(this.player.area == null) { + return; + } + var _g = e.key; + switch(_g) { + case "select": + if(this.equipComplete == null) { + this.player.onSelect(); + } + break; + case "up": + if(!this.hasLerp() && this.canEnterStructure) { + this.player.enterStructure(); + } + break; + } + } + ,mine: function(tool,p,sfx,name,slot) { + this.useTool(tool,p,name,slot); + this.next_loop = sfx; + } + ,attack_ct: null + ,canFire: function(i) { + if(this.attack_ct == i) { + return this.isAnim("action"); + } else { + return false; + } + } + ,change_equipment: function(e) { + com_davidmaletz_mining_renderer_PlayerObjectRenderer.prototype.change_equipment.call(this,e); + this.setLoopSfx(null); + } + ,endRangedAttack: function(b) { + this.endToolAction(); + this.setAnimation("idle"); + } + ,endMeleeAttack: function(b) { + this.endToolAction(); + this.setAnimation("idle"); + } + ,isMining: null + ,moveCost: null + ,fallCost: null + ,partial: null + ,isSlide: function() { + var t = this.player.area.renderer.getTile(this.player.get_tile_x(),this.player.get_tile_y(),3); + if(t == null) { + t = this.player.area.getTileIndex(this.player.area.getBaseTile(this.player.get_tile_x(),this.player.get_tile_y() + 1)); + } + var dig = com_davidmaletz_mining_world_Area.getDig(t); + if(dig != null) { + return dig.get("slide") == "true"; + } else { + return false; + } + } + ,doMove: function(dx,dy,frames,pspeed,flags) { + var s = com_davidmaletz_tiles_Tile.SIZE / pspeed * frames; + var speed = Math.floor(s); + this.partial += s - speed; + if(this.partial >= 1) { + ++speed; + this.partial -= 1; + } + if((flags & 2) != 0) { + this.fallCost += 2 * frames; + if(this.fallCost >= 1) { + var m = Math.floor(this.fallCost); + this.player.loseHealth(m,0,null,null,0); + this.fallCost -= m; + } + } else if((flags & 1) == 0) { + this.moveCost += s * this.player.getStepCost() / com_davidmaletz_tiles_Tile.SIZE; + if(this.moveCost >= 1) { + var m1 = Math.floor(this.moveCost); + this.player.loseStamina(m1); + if(this.player.area == null) { + return; + } + this.moveCost -= m1; + } + if(speed != 0) { + var _g = 0; + var _g1 = this.player.overObjects; + while(_g < _g1.length) { + var o = _g1[_g]; + ++_g; + o.onPlayerMove(this.player,dx * speed,dy * speed,frames); + } + } + this.playWalk(false); + } else if(!this.isSlide()) { + this.player.slideX = 0; + this.player.slideY = 0; + } + if(this.player.area == null) { + return; + } + var _y = this.player.yTile + dy * speed; + if(this.player._offsetY != 0 && !this.player.isFlying() && this.player.isFlying(_y)) { + var _g2 = this; + _g2.set_y(_g2.get_y() - this.player._offsetY); + _y += this.player._offsetY; + } + var _x = this.player.xPos + dx * speed; + if(this.player.checkConnections(_x,_y,dx,dy)) { + this.player.setPosition(_x,_y); + } + if(this.player.area != null) { + this.player.area.lightTiles(this.player.get_tile_x(),this.player.get_tile_y(),this.player.getLightRange()); + if((flags & 1) == 0 && this.isSlide()) { + this.player.slideX = dx; + this.player.slideY = dy; + } + } + } + ,last_pump_x: null + ,last_pump_y: null + ,doPump: function() { + if(this.player.area != null && this.player.area.getTileId(this.player.get_tile_x(),this.player.get_tile_y(),3) != -1 && this.player.area.hasFlags(this.player.get_tile_x(),this.player.get_tile_y(),4)) { + if(this.player.get_tile_x() != this.last_pump_x || this.player.get_tile_y() != this.last_pump_y) { + this.player.addExp(2); + this.last_pump_x = this.player.get_tile_x(); + this.last_pump_y = this.player.get_tile_y(); + } + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + this.player.area.removeWater(this.player.get_tile_x(),this.player.get_tile_y()); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + this.setItemAnimation(this.player.doPump(),null,false); + } + } + ,isBlockedX: function(x,y,dy) { + var py = this.player.yTile; + var ty = y * com_davidmaletz_tiles_Tile.SIZE; + if(py < ty) { + if(this.player.getTileBlockId(x,y - 1) < 0) { + return !this.player._canEnterTile(x,y - 1,dy); + } else { + return true; + } + } else if(py > ty) { + if(this.player.getTileBlockId(x,y + 1) < 0) { + return !this.player._canEnterTile(x,y + 1,dy); + } else { + return true; + } + } else { + return false; + } + } + ,isBlockedY: function(x,y,dy) { + var px = this.player.xPos; + var tx = x * com_davidmaletz_tiles_Tile.SIZE; + if(px < tx) { + if(this.player.getTileBlockId(x - 1,y) < 0) { + return !this.player._canEnterTile(x - 1,y,dy); + } else { + return true; + } + } else if(px > tx) { + if(this.player.getTileBlockId(x + 1,y) < 0) { + return !this.player._canEnterTile(x + 1,y,dy); + } else { + return true; + } + } else { + return false; + } + } + ,setAnimation: function(anim_id) { + if(this.player.area == null && anim_id != "death") { + return; + } + com_davidmaletz_mining_renderer_PlayerObjectRenderer.prototype.setAnimation.call(this,anim_id); + this.nextLoop = null; + if(this.isMining || this.equipComplete != null) { + this.nextLoop = $bind(this,this.clearEquipment); + this.isMining = false; + } else { + this.clearEquipment(); + } + } + ,digging: null + ,last_dig_x: null + ,last_dig_y: null + ,_mine: function(item,tool,tx,ty,frames,f,main) { + if(this.player.equipment.getItemUsed("pickaxe") != item || this.player.area == null) { + return; + } + var t = this.player.area.getTileId(tx,ty,0); + var tile = this.player.area.getTileIndex(t); + if(tile == null) { + return; + } + var mine_cost = com_davidmaletz_mining_world_Area.getMineCost(tile,true); + var mining_speed = tool.getMine(item.getNameStr()) + this.player.stats.getInt("mine") - mine_cost; + if(mining_speed < -1 || !this.player.canMineTile(tool,tile,tx,ty,mine_cost)) { + this.playIdle(); + return; + } + if(!this.isAnim("action")) { + var loop = tool.xml.exists("mineLoop") ? tool.xml.get("mineLoop") : tool.xml.get("loop"); + com_davidmaletz_faengfl_adv_sound_Sound.play(com_davidmaletz_faengfl_adv_sound_Sound.resolveDefault(tool.xml,"swing")); + this.mine(tool,null,loop,item.getName(),"pickaxe"); + if(tool.xml.get("hideOffhand") == "true") { + this.sprite.hideSlot("shield"); + } + } + if(main && !this.digging && (this.last_dig_x != tx || this.last_dig_y != ty)) { + var name = item.getName(); + this.player.dispatchEvent(new com_davidmaletz_mining_DigEvent("dig",tool,null,name == null ? null : name.getName(),"pickaxe",tx,ty)); + } + if(main) { + this.digging = true; + this.last_dig_x = tx; + this.last_dig_y = ty; + } + if(mining_speed < 1 || this.player.area.renderer.incBrickBreak(tx,ty,(frames - f) * (mining_speed + this.player.getBreakPower(tool,false) - 1))) { + return; + } + this.player.getBreakPower(tool,true); + this.isMining = true; + var ore = this.player.area.mine(tx,ty,t,this.player.getLightRange(),this.player); + com_davidmaletz_mining_world_Area.onDig(this.player,tile); + if(ore != null) { + var xml = com_davidmaletz_mining_world_Area.getOre(ore); + if(xml != null) { + if(xml.exists("achievement")) { + com_davidmaletz_faengfl_achievement_Achievements.instance.gainAchievement(xml.get("achievement")); + } + var element = com_davidmaletz_mining_world_Element.get(xml.get("element")); + if(xml.exists("damage") && this.player.loseHealth(com_davidmaletz_mining_Main.parseInt(xml.get("damage")),0,this.player,element,0) > 0) { + var id = xml.get("hit_sfx"); + if(id == null) { + id = "attack"; + } + com_davidmaletz_faengfl_adv_sound_Sound.play(id); + } + this.player.hitEffect(com_davidmaletz_mining_world_ObjectInfo.getHitEffectI(this.player,element,xml)); + var iter = xml.elements(); + if(iter.hasNext()) { + new com_davidmaletz_mining_npc_NPCEventHandler(iter,this.player,ore).runAll(); + } + } + } + this.player.mineTile(item,tile,tx,ty,com_davidmaletz_mining_item_ItemInfo.exists(ore) ? new com_davidmaletz_mining_item_ItemCt(com_davidmaletz_mining_item_ItemInfo.get(ore),1) : null,mine_cost); + } + ,doMine: function(item,tx,ty,frames,f,dx,dy) { + var tool = js_Boot.__cast(item.info , com_davidmaletz_mining_item_Equipment); + var s = com_fancyfish_faeng_common_Utils.sign(this.get_scaleX()); + var y = dy == 0 ? 1 : com_fancyfish_faeng_common_Utils.sign(dy); + this._mine(item,tool,tx,ty,frames,f,true); + var e = tool.xml.elementsNamed("dig"); + while(e.hasNext()) { + var e1 = e.next(); + this._mine(item,tool,tx + com_davidmaletz_mining_Main.parseInt(e1.get("x")) * s,ty + com_davidmaletz_mining_Main.parseInt(e1.get("y")) * y,frames,f,false); + } + var i = tool.xml.elementsNamed(dx != 0 ? "horiz" : "vert"); + if(i.hasNext()) { + var n = i.next(); + var e2 = n.elementsNamed("dig"); + while(e2.hasNext()) { + var e3 = e2.next(); + this._mine(item,tool,tx + com_davidmaletz_mining_Main.parseInt(e3.get("x")) * s,ty + com_davidmaletz_mining_Main.parseInt(e3.get("y")) * y,frames,f,false); + } + } + } + ,set_scaleX: function(value) { + return com_davidmaletz_mining_renderer_PlayerObjectRenderer.prototype.set_scaleX.call(this,value); + } + ,move: function(dx,dy,frames,flags) { + if(flags == null) { + flags = 0; + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + var ret = this._move(dx,dy,frames,flags); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + return ret; + } + ,_move: function(dx,dy,frames,flags) { + if(flags == null) { + flags = 0; + } + var flagMine = (flags & 1) == 0; + var flagFall = (flags & 2) != 0; + if(flagMine) { + if(!this.player.canMove(dx,dy,frames)) { + this.playIdle(); + return true; + } + if(com_davidmaletz_mining_renderer_PlayerRenderer.max_overweight > 0 && this.player.getOverweight() > com_davidmaletz_mining_renderer_PlayerRenderer.max_overweight) { + this.player.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","overweight")); + return false; + } + } + if(dx < 0) { + this.set_scaleX(this.get_scaleY()); + } else if(dx > 0) { + this.set_scaleX(-this.get_scaleY()); + } + var f = frames; + var tx; + var ty; + var t = -1; + var pspeed = this.player.getSpeed(); + var blocked = false; + if(this.player.shield.get() != null) { + pspeed *= 2; + } + if(flagFall) { + pspeed = 2; + } + if(dx != 0) { + if(dx < 0) { + tx = Math.floor(this.player.xPos / com_davidmaletz_tiles_Tile.SIZE - 1); + } else { + tx = Math.ceil(this.player.xPos / com_davidmaletz_tiles_Tile.SIZE + 1); + } + ty = this.player.get_tile_y(); + var tmp; + var tmp1; + if(!(!this.player._canEnterTile(tx,ty,dy))) { + t = this.player.getTileBlockId(tx,ty); + tmp1 = t >= 0; + } else { + tmp1 = true; + } + if(!tmp1) { + blocked = this.isBlockedX(tx,ty,dy); + tmp = blocked; + } else { + tmp = true; + } + if(tmp) { + if(!this.player.area.isWater(tx,ty + 1) || !this.player.area.emptyTile(tx,ty) || !this.player.area.emptyTile(tx,ty - 1) || !this.player.canJumpIntoWater()) { + f = Math.min(f,((tx - dx) * com_davidmaletz_tiles_Tile.SIZE - this.player.xPos) * pspeed / (dx * com_davidmaletz_tiles_Tile.SIZE)); + } + } + } else { + tx = this.player.get_tile_x(); + if(dy < 0) { + ty = Math.floor(this.player.yTile / com_davidmaletz_tiles_Tile.SIZE - 1); + } else { + ty = Math.ceil(this.player.yTile / com_davidmaletz_tiles_Tile.SIZE + 1); + } + var flyClamp = dy > 0 && this.player.isFlying() && this.player.area.renderer.getTileId(tx,ty,3) >= 0; + if(dy < 0 && !this.player.isFlying() && this.player.area.renderer.getTileId(tx,ty,0) == -1 && !this.player.enterTileWalk(tx,ty)) { + flyClamp = true; + this.player.showFlightWarning(ty + 1); + } + if(dy < 0 && flyClamp && this.allowFlight) { + this.allowFlight = false; + flyClamp = false; + } + var tmp2; + var tmp3; + if(!((dy <= 0 || flagMine && this.player.isFlying()) && !this.player._canEnterTile(tx,ty,dy) || flyClamp)) { + t = this.player.getTileBlockId(tx,ty); + tmp3 = t >= 0; + } else { + tmp3 = true; + } + if(!tmp3) { + blocked = this.isBlockedY(tx,ty,dy); + tmp2 = blocked; + } else { + tmp2 = true; + } + if(tmp2) { + f = Math.min(f,((ty - dy) * com_davidmaletz_tiles_Tile.SIZE - this.player.yTile) * pspeed / (dy * com_davidmaletz_tiles_Tile.SIZE)); + if(flyClamp && f < frames) { + this.clamp_ct = 10; + if(dy < 0) { + this.allowFlight = true; + } + } + } + } + if(f > 0) { + this.doMove(dx,dy,f,pspeed,flags); + } + if(f >= frames || this.player.area == null) { + return true; + } + if(blocked) { + var oldx = this.get_x(); + var oldy = this.get_y(); + this.player.setPosition(dx == 0 ? tx * com_davidmaletz_tiles_Tile.SIZE : this.player.xPos,dy == 0 ? ty * com_davidmaletz_tiles_Tile.SIZE : this.player.yTile); + oldx = com_davidmaletz_mining_world_Object.fixOldX(this.player.area,oldx,this.get_x()); + var _f = Math.round(Math.abs(oldx - this.get_x() + (oldy - this.get_y())) * pspeed / com_davidmaletz_tiles_Tile.SIZE); + if(_f > 0) { + var _x = this.get_x(); + var _y = this.get_y(); + this.set_x(oldx); + this.set_y(oldy); + this.lerp(new com_davidmaletz_lerp_PositionKeyframe(_x,_y),_f); + } + } else if(t >= 0 && t != 999999 && this.player.shield.get() == null && flagMine && this.equipComplete == null) { + var item = this.player.equipment.getItemUsed("pickaxe"); + if(item == null) { + this.playIdle(); + return f > 0; + } + var d = item.info.getDurability(); + if(d > 0 && item.value > 0 && item.value >= d) { + var m = com_fancyfish_faeng_common_Lang.getTextFromTitle(item.info.xml.get("durabilityWarning")); + this.player.showWarning(m == null ? com_fancyfish_faeng_common_Lang.getText("warning","durability") : m); + this.playIdle(); + return f > 0; + } + this.doMine(item,tx,ty,frames,f,dx,dy); + } else if(f == 0) { + this.playIdle(); + } + return f > 0; + } + ,attackRepeat: null + ,attackRepeatSlot: null + ,doAttack: function(trueItem,underwater,repeat) { + if(repeat == null) { + repeat = false; + } + var eq = this.player.getUseItem(trueItem,true); + if(eq == null) { + return false; + } + if(underwater && eq.info.xml.get("underwater") != "true") { + this.player.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","no_use_underwater")); + return false; + } + if(eq.info.xml.exists("repeat")) { + this.attackRepeat = com_davidmaletz_mining_Main.parseFloat(eq.info.xml.get("repeat")); + this.attackRepeatSlot = trueItem.info.xml.get("slot"); + } else { + this.attackRepeat = 0; + } + return this._useEquipment(eq,trueItem,null,repeat); + } + ,_attack: function(underwater) { + var eq = this.player.equipment.getItemUsed("weapon"); + if(eq != null) { + this.attack_ct++; + return this.doAttack(eq,underwater); + } else { + return false; + } + } + ,fireEquipComplete: function(px,py) { + if(this.nextLoop != null) { + var f = this.nextLoop; + this.nextLoop = null; + f(); + } + com_davidmaletz_mining_renderer_PlayerObjectRenderer.prototype.fireEquipComplete.call(this,px,py); + } + ,useEquipment: function(weap,projectile) { + if(this.hasLerp() || this.onComplete != null || this.equipComplete != null || this.attacking != null || this.player.shield.get() != null) { + return; + } + this._useEquipment(this.player.getUseItem(weap,true),weap,projectile); + } + ,runDoAttack: function(weap,i) { + if(this.canFire(i)) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + com_davidmaletz_mining_Main.runEvent("doAttack",this.player,weap.xml,weap); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + } + ,_useEquipment: function(item,trueItem,projectile,repeat) { + if(repeat == null) { + repeat = false; + } + if(item == null) { + return false; + } + var trueWeap = js_Boot.__cast(trueItem.info , com_davidmaletz_mining_item_Equipment); + var weap = js_Boot.__cast(item.info , com_davidmaletz_mining_item_Equipment); + if(this.player.useEquipment(item,projectile,trueItem) && this.player.area != null) { + this.player.hidden.set(null); + if(projectile == null) { + var p = item.getDefaultProjectile(); + if(p != null && p.xml.elementsNamed("projectile").hasNext()) { + projectile = p; + } else if(weap.xml.elementsNamed("projectile").hasNext()) { + projectile = weap; + } + } + var i = weap.xml.elementPathsNamed("doAttack"); + if(i.hasNext()) { + this.mine(trueWeap,null,weap.xml.get("loop"),trueItem.getName(),"weapon"); + this.onComplete = null; + this.equipComplete = $bind(this,this.endRangedAttack); + this.player.increaseValue(item,1); + var delay = weap.xml.exists("delay") ? com_davidmaletz_mining_Main.parseInt(weap.xml.get("delay")) : 0; + if(delay > 0) { + var tmp = new com_davidmaletz_lerp_AlphaKeyframe(1); + var tmp1 = Math.round(delay / (this.getFramesPerSecond() / 60)); + var f = $bind(this,this.runDoAttack); + var a1 = weap; + var i1 = this.attack_ct; + this.lerp(tmp,tmp1,function() { + f(a1,i1); + }); + } else { + this.runDoAttack(weap,this.attack_ct); + } + } else if(projectile != null) { + var p1 = this.player; + var p2 = this.player.area; + var p3 = this.getFramesPerSecond() / 60; + var f1 = $bind(this,this.canFire); + var i2 = this.attack_ct; + var p4 = com_davidmaletz_mining_renderer_PlayerRenderer.fireProjectile(p1,p2,projectile,item,this,p3,function() { + return f1(i2); + }); + if(!repeat) { + this.mine(trueWeap,p4,weap.xml.get("loop"),trueItem.getName(),"weapon"); + } + this.onComplete = null; + this.equipComplete = $bind(this,this.endRangedAttack); + this.player.increaseValue(item,1); + } else if(weap.xml.exists("fishing")) { + if(!repeat) { + this.mine(trueWeap,null,weap.xml.get("loop"),trueItem.getName(),"weapon"); + } + this.onComplete = null; + var x = this.player.get_tile_x() - com_fancyfish_faeng_common_Utils.sign(this.get_scaleX()); + var y = this.player.get_tile_y(); + var f2 = this.player.area.isFishable(x,y); + var f3 = ($_=new com_davidmaletz_mining_effects_Fishing(item,this,this.player.area,f2 == 1),$bind($_,$_.start)); + var a11 = f2; + this.equipComplete = function(a2) { + f3(a11,a2); + }; + this.player.increaseValue(item,1); + } else { + this.swing(item,weap,trueItem,trueWeap); + } + var _g = 0; + var _g1 = trueWeap.slots; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + if(this.player.vanity.getItemUsed(s) == null) { + this.sprite.hideSlot(s); + } + } + return true; + } else { + return false; + } + } + ,_checkSwing: function(item,weap,hits) { + com_davidmaletz_mining_renderer_PlayerRenderer.checkSwing(this.player,this.player,item,weap,this.getFramesPerSecond()); + if(hits != null && hits.hasNext()) { + var delay = com_davidmaletz_mining_Main.parseInt(hits.next().get("delay")); + if(delay > 0 && this.player.useEquipment(item) && this.player.area != null) { + var f = $bind(this,this._checkSwing); + var a1 = item; + var a2 = weap; + var a3 = hits; + var tmp = function() { + f(a1,a2,a3); + }; + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),Math.round(delay / (this.getFramesPerSecond() / 60)),tmp); + } + } + } + ,swing: function(item,weap,trueItem,trueWeap) { + var delay = weap.xml.exists("delay") ? com_davidmaletz_mining_Main.parseInt(weap.xml.get("delay")) : 2; + this.mine(trueWeap,null,weap.xml.get("loop"),trueItem.getName(),"weapon"); + this.onComplete = null; + this.equipComplete = $bind(this,this.endMeleeAttack); + if(delay > 0) { + var tmp = new com_davidmaletz_lerp_AlphaKeyframe(1); + var tmp1 = Math.round(delay / (this.getFramesPerSecond() / 60)); + var f = $bind(this,this._checkSwing); + var a1 = item; + var a2 = weap; + var a3 = weap.xml.elementsNamed("hit"); + this.lerp(tmp,tmp1,function() { + f(a1,a2,a3); + }); + } + } + ,useItem: function(item) { + this.useTool(item,null,null,null); + var _g = 0; + var _g1 = item.slots; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + if(this.player.vanity.getItemUsed(s) == null) { + this.sprite.hideSlot(s); + } + } + this.next_loop = item.xml.get("loop"); + this.onComplete = null; + this.equipComplete = $bind(this,this.endRangedAttack); + } + ,turn_ct: null + ,clamp_ct: null + ,second: null + ,allowFlight: null + ,canAct: function() { + var a = this.getActive(); + if(this.equipComplete != null) { + if(Reflect.compareMethods(this.equipComplete,$bind(this,this.endMeleeAttack))) { + return a.getAnimFrame() / a.getMaxFrame() > 0.6; + } else { + return false; + } + } else { + return true; + } + } + ,next_loop: null + ,endAttackRepeat: function() { + var slot = this.player.equipment.get(this.attackRepeatSlot); + var i; + var tmp; + if(slot != null) { + i = slot.get(); + tmp = i != null; + } else { + tmp = false; + } + if(tmp) { + var p = i.getDefaultProjectile(); + if(p != null) { + p.resetProjectile(); + } + i.info.resetProjectile(); + } + this.attackRepeat = 0; + this.set_x(this.player.getCenterX()); + this.set_y(this.player.getCenterY() + this.player._offsetY); + } + ,useOffhand: function(e,underwater) { + var _g = e.info.xml.get("use"); + switch(_g) { + case "attack": + if(this.attacking != null || this.equipComplete != null) { + return false; + } + this.attack_ct++; + if(this.doAttack(e,underwater)) { + if(this.equipComplete != null && Reflect.compareMethods(this.equipComplete,$bind(this,this.endMeleeAttack))) { + this.equipComplete = $bind(this,this.endRangedAttack); + } + return true; + } + break; + case "block": + if(underwater && e.info.xml.get("underwater") != "true") { + this.player.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","no_use_underwater")); + return false; + } + this.player.shield.set(e); + if(this.equipComplete != null) { + var f = this.equipComplete; + this.equipComplete = null; + f(false); + } + break; + } + return false; + } + ,finishFrame: function(f) { + if(!this.sprite.incFrame(f,this.onComplete == null)) { + this.sprite.setFrame(0); + if(this.onComplete != null) { + var f1 = this.onComplete; + this.onComplete = null; + f1(); + } + } + this.incEquipFrame(f,this.attackRepeat > 0); + this.setLoopSfx(this.next_loop); + if(com_davidmaletz_faengfl_Window.window_ct == 0) { + this.updateScroll(false); + } + if(!this.digging) { + this.last_dig_x = -1000; + } + } + ,o2partial: null + ,wasUnderwater: null + ,checkUnderwater: function(underwater,playSFX) { + if(underwater != this.wasUnderwater) { + this.wasUnderwater = underwater; + if(playSFX) { + com_davidmaletz_faengfl_adv_sound_Sound.play(underwater ? "ocean_enter" : "ocean_exit"); + } + this.equipmentChanged(); + } + } + ,move_frames: null + ,old_x: null + ,old_y: null + ,crushWarning: null + ,enter_frame: function(frames) { + if(com_davidmaletz_faengfl_Window.window_ct == 0) { + com_davidmaletz_mining_renderer_PlayerObjectRenderer.prototype.enter_frame.call(this,frames); + } + } + ,canAdvanceModal: function() { + return true; + } + ,advanceFrame: function(frames) { + if(this.player.getHealth() <= 0) { + return; + } + this.digging = false; + if(frames > 999 || this.player.renderer != this) { + this._advanceFrame(frames); + return; + } + if(this.old_x != NaN && (this.old_x != this.get_x() || this.old_y != this.get_y())) { + this.move_frames += frames; + } else { + this.move_frames = 0; + } + this.old_x = this.get_x(); + this.old_y = this.get_y(); + if(this.player.area != null) { + this.player.objectOverlapCheck(); + } + if(this.player.area == null) { + this._advanceFrame(frames); + return; + } + var s = this.player.shield.get(); + if(s == null) { + this.next_loop = this.loop_sfx_name; + } else { + this.next_loop = s.info.xml.exists("blockLoop") ? s.info.xml.get("blockLoop") : s.info.xml.get("loop"); + } + this.set_alpha(1); + if(this.turn_ct > 0) { + this.turn_ct -= frames; + } + if(this.clamp_ct > 0) { + this.clamp_ct -= frames; + } + if(this.resetCt > 0) { + this.resetCt -= frames; + if(this.resetCt <= 0) { + com_davidmaletz_faengfl_TextSprite.setColor(this.sprite,16777215); + } + } + if(!this.isAnim("hit") && this.stunCt > 0) { + this.stunCt -= frames; + } + if(this.player.hitFx == null && this.hitEffectCooldown > 0) { + this.hitEffectCooldown -= frames; + } + var f = frames; + if(this.hasTrack(com_davidmaletz_lerp_PositionKeyframe)) { + var rem = 0.0; + var k = this.getLerp(com_davidmaletz_lerp_PositionKeyframe); + if(k != null) { + rem = k.getFrame() - this.getFrame(com_davidmaletz_lerp_PositionKeyframe); + } + this._advanceFrame(frames); + frames -= rem; + } else { + this._advanceFrame(f); + } + if(this.player.canPump()) { + this.doPump(); + } + if(this.player.area == null) { + this._advanceFrame(frames); + return; + } + var underwater = this.player.area.isWater(this.player.get_tile_x(),this.player.get_tile_y()); + var canBreathe = !underwater && this.player.area.hasOxygen(); + this.second -= f; + if(this.player.area != null && underwater) { + var d = com_davidmaletz_mining_Player._getCrushDepth(this.player.area,this.player.get_tile_x(),this.player.get_tile_y(),this.player.max_depth.get()); + if(d > 0) { + if(this.crushWarning == null) { + this.crushWarning = new com_davidmaletz_faengfl_ui_Popup(128.,52.,0,com_fancyfish_faeng_common_Lang.getText("warning","crush"),16720418,-16777216,20,60,20); + } else if(this.crushWarning.stage == null && this.second < 0) { + this.player.loseHealth(d * 5); + } + } else { + this.crushWarning = null; + } + } else { + this.crushWarning = null; + } + if(this.second < 0) { + this.second += 60; + if(this.second < 0) { + this.second = 0; + } + if(!canBreathe) { + this.player.loseOxygen(1); + } + if(this.player.area != null) { + this.player.handleSecond(); + } + if(this.player.area == null) { + this._advanceFrame(f); + return; + } + this.equipmentChanged(); + this.sprite.updateEquipment(); + } + if(canBreathe) { + var of = Math.floor(f); + this.o2partial += f - of; + if(this.o2partial >= 1) { + ++of; + this.o2partial -= 1; + } + this.player.addOxygen(of); + } + this.checkUnderwater(underwater,true); + if(this.player.canFall(this.player.get_tile_x(),Math.ceil((this.player.yTile + 1) / com_davidmaletz_tiles_Tile.SIZE) - 1)) { + if(frames > 0) { + this.move(0,1,frames,3); + } + this.playIdle(); + this.finishFrame(f); + return; + } + if(this.get_alpha() == 0) { + frames = 0; + } + if(this.onComplete == null && this.canAct() && frames > 0 && com_davidmaletz_faengfl_Window.window_ct == 0) { + if(this.player.slideX != 0 || this.player.slideY != 0) { + if(!this.move(this.player.slideX,this.player.slideY,frames,1)) { + this.player.slideX = 0; + this.player.slideY = 0; + } + this.playIdle(); + } else if(com_davidmaletz_controls_Controller.instance.isPressed(12)) { + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + if(this.player.shield.get() == null) { + var e = this.player.equipment.getItemUsed("shield"); + if(e != null && e.info.xml.exists("use") && this.useOffhand(e,underwater)) { + this.finishFrame(f); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + return; + } + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + } else if(this.player.shield.get() != null) { + this.player.shield.set(null); + this.clearNextLoop(); + } + if(this.player.area != null && this.player.slideX == 0 && this.player.slideY == 0) { + if(this.player.shield.get() == null && com_davidmaletz_controls_Controller.instance.isPressed(10) && this.equipComplete == null) { + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + if(this.attacking != null || !this._attack(underwater)) { + this.playIdle(); + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + } else { + var left = com_davidmaletz_controls_Controller.instance.isPressed(4); + var right = com_davidmaletz_controls_Controller.instance.isPressed(6); + var up = com_davidmaletz_controls_Controller.instance.isPressed(0); + var down = com_davidmaletz_controls_Controller.instance.isPressed(2); + if(!up) { + this.canEnterStructure = true; + } + if((left || right) && left != right) { + if(this.get_scaleX() == this.get_scaleY() != left) { + this.set_scaleX(-this.get_scaleX()); + this.turn_ct = 5; + this.player.overlapChanged(); + this.playIdle(); + } + if(this.turn_ct <= 0) { + this.move(left ? -1 : 1,0,frames); + } + } else if((up || down) && up != down && this.clamp_ct <= 0) { + if(this.move(0,up ? -1 : 1,frames) && up) { + this.canEnterStructure = false; + } + } else if(this.equipComplete == null) { + this.playIdle(); + } + } + } + } else if(this.attacking != null && this.attackRepeat > 0 && frames > 0) { + if(com_davidmaletz_controls_Controller.instance.isPressed(this.attacking == this.getActive() ? 10 : 12)) { + this.attackRepeat -= frames; + if(this.attackRepeat <= 0) { + var f1 = this.attacking.getAnimFrame(); + var slot = this.player.equipment.get(this.attackRepeatSlot); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + if(slot != null && slot.get() != null && this.doAttack(slot.get(),underwater,true)) { + this.attacking.setFrame(f1,true); + } else { + this.endAttackRepeat(); + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + } + } else { + this.endAttackRepeat(); + } + } + this.finishFrame(f); + } + ,clearEquipment: function() { + com_davidmaletz_mining_renderer_PlayerObjectRenderer.prototype.clearEquipment.call(this); + this.clearNextLoop(); + if(this.player.equipment.getItem("weapon") == null && this.player.equipment.getItem("pickaxe") == null && this.player.shield.get() == null && !Reflect.compareMethods(this.nextLoop,$bind(this,this.clearEquipment))) { + this.setActive(null,null,null); + } else { + this.updateEquipment(); + } + } + ,clearNextLoop: function() { + var s = this.player.shield.get(); + if(s == null) { + this.next_loop = null; + } else { + this.next_loop = s.info.xml.exists("blockLoop") ? s.info.xml.get("blockLoop") : s.info.xml.get("loop"); + } + } + ,death_ct: null + ,advanceDeath: function(e) { + if(!this.advance(com_davidmaletz_faengfl_FaengFL.frameTime,false)) { + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.advanceDeath)); + this.player.gameOver(); + } else if(this.death_ct > 0) { + this.death_ct -= com_davidmaletz_faengfl_FaengFL.frameTime; + if(this.death_ct <= 0) { + var l = new com_davidmaletz_tiles_render_StaticPlayAnimation(com_davidmaletz_tiles_Tile.get("death"),"death",15,false); + l.set_x(-com_davidmaletz_tiles_Tile.SIZE * 0.5); + l.set_y(-com_davidmaletz_tiles_Tile.SIZE * 1.5); + this.addChild(l); + } + } + } + ,kill: function() { + com_davidmaletz_faengfl_adv_sound_Sound.play("player_death"); + if(com_davidmaletz_mining_Main.currentAreaRenderer != null) { + com_davidmaletz_mining_Main.currentAreaRenderer.centerOn(this.get_x(),this.get_y(),this.player.cameraCentered(),true); + } + this.setAnimation("death"); + var l = this.light; + this.light = null; + this.destroy(null); + this.light = l; + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.advanceDeath)); + this.death_ct = 68; + } + ,__class__: com_davidmaletz_mining_renderer_PlayerRenderer +}); +var com_davidmaletz_mining_renderer__$PlayerRendererBase_PlayerSprite = function(p,fps) { + this.locked = null; + this.showBeard = true; + openfl_display_Sprite.call(this); + this.player = p; + this.fps = fps; + this.sprite = new com_davidmaletz_tiles_render_TileAnimationRenderer(p.makeTile(),fps); + this.sprite.colors = this.player.colors; + this.sprite.offsets = this.player.offsets; + this.addChild(this.sprite); + this.items = new haxe_ds_StringMap(); + var slots = []; + var s = p.equipment.getSlots(); + while(s.hasNext()) { + var s1 = s.next(); + var e = p.equipment.getSlotXml(s1); + if(e != null && e.exists("renderPriority")) { + slots.push(e); + } + } + slots.sort(com_davidmaletz_mining_renderer__$PlayerRendererBase_PlayerSprite.renderPriority); + var _g = 0; + while(_g < slots.length) { + var e1 = slots[_g]; + ++_g; + this.addItem(e1.get("id")); + } + var t = p.getBeardTile(); + if(t != null) { + this.beard = new com_davidmaletz_tiles_render_TileAnimationRenderer(t,fps); + this.beard.set_visible(this.showBeard); + this.setBeardPos(); + this.updateBeardColor(); + } + this.active = new com_davidmaletz_mining_renderer_EquipmentRenderer(this.player,fps); + this.active.set_visible(false); + this.active.setAnimation("idle"); + this.addChild(this.active); + this.addChild(this.active.arms); +}; +$hxClasses["com.davidmaletz.mining.renderer._PlayerRendererBase.PlayerSprite"] = com_davidmaletz_mining_renderer__$PlayerRendererBase_PlayerSprite; +com_davidmaletz_mining_renderer__$PlayerRendererBase_PlayerSprite.__name__ = ["com","davidmaletz","mining","renderer","_PlayerRendererBase","PlayerSprite"]; +com_davidmaletz_mining_renderer__$PlayerRendererBase_PlayerSprite.renderPriority = function(a,b) { + return com_fancyfish_faeng_common_Utils.sign(com_davidmaletz_mining_Main.parseFloat(a.get("renderPriority")) - com_davidmaletz_mining_Main.parseFloat(b.get("renderPriority"))); +}; +com_davidmaletz_mining_renderer__$PlayerRendererBase_PlayerSprite.__super__ = openfl_display_Sprite; +com_davidmaletz_mining_renderer__$PlayerRendererBase_PlayerSprite.prototype = $extend(openfl_display_Sprite.prototype,{ + player: null + ,fps: null + ,active: null + ,_anim_id: null + ,sprite: null + ,beard: null + ,showBeard: null + ,items: null + ,locked: null + ,setBeardPos: function() { + var o = com_davidmaletz_mining_OffsetInfo.getFromOffset(this.player.getInfo().getElementType("offset","beard"),this.player.offsets.get("beard")); + var layer = this.player.info.xml.get("beardLayer"); + if(o != null && o.xml != null && o.xml.get("overBack") == "true") { + layer = "back"; + } + com_davidmaletz_faengfl_FaengFL.remove(this.beard); + this.addChildAt(this.beard,this.getChildIndex(this.items.get(layer)) + 1); + } + ,updateColors: function() { + var a = this.sprite.animation; + var f = this.sprite.getAnimFrame(); + this.sprite.colors = this.player.colors; + this.sprite.offsets = this.player.offsets; + this.sprite.clearAll(); + this.sprite.tile = this.player.makeTile(); + this.sprite.setAnimation(a,-0.5,-0.5); + this.sprite.setFrame(f); + this.active.updateColors(); + var i = this.items.iterator(); + while(i.hasNext()) { + var i1 = i.next(); + i1.updateColors(); + } + var t = this.player.getBeardTile(); + if(t != null) { + if(this.beard == null) { + this.beard = new com_davidmaletz_tiles_render_TileAnimationRenderer(t,this.fps); + this.beard.set_visible(this.showBeard); + } else { + this.beard.clearAll(); + this.beard.tile = t; + } + this.setBeardPos(); + this.beard.setAnimation(this.player.getBeardAnim(this._anim_id),-0.5,-0.5); + this.beard.setFrame(f); + this.updateBeardColor(); + } else if(this.beard != null) { + com_davidmaletz_faengfl_FaengFL.remove(this.beard); + this.beard = null; + } + } + ,updateBeardColor: function() { + com_davidmaletz_faengfl_TextSprite.setColor(this.beard,com_davidmaletz_faengfl_LayerManager.getColor(this.player.colors,"hair"),163); + } + ,getFramesPerSecond: function() { + return this.fps; + } + ,setAnimation: function(anim_id) { + var id = anim_id; + if(id == "action") { + if(this.player.isFlying()) { + anim_id = "hover"; + } else { + anim_id = "idle"; + } + var v = Math.floor((1 - this.player.getStaminaPercent()) * 3); + if(v > 2) { + v = 2; + } + id = "mine" + (v > 0 ? Std.string(v + 1) : ""); + } else if(id == "walk" && this.player.inventory.getWeight() > this.player.capacity.get()) { + id += ".heavy"; + } + var anim = this.player.getAnim(id); + if(!com_davidmaletz_tiles_TileAnimation.exists(anim)) { + anim = this.player.getAnim("idle"); + } + this.sprite.setAnimation(anim,-0.5,-0.5); + if(this.beard != null) { + this.beard.setAnimation(this.player.getBeardAnim(anim_id),-0.5,-0.5); + } + var s = this.items.iterator(); + while(s.hasNext()) { + var s1 = s.next(); + if(this.locked != s1) { + s1.setAnimation(anim_id); + } + } + if(this.locked != this.active) { + this.active.setAnimation(anim_id); + } + this._anim_id = anim_id; + } + ,resetItemAnim: function(atk) { + atk.setAnimation(this._anim_id); + } + ,getAnimFrame: function() { + return this.sprite.getAnimFrame(); + } + ,setFrame: function(f,loop) { + if(loop == null) { + loop = false; + } + var df = f - this.sprite.getAnimFrame(); + var ret = this.sprite.setFrame(f,loop); + var mf = this.sprite.getAnimFrame() * this.sprite.deltaFrame; + if(this.beard != null) { + this.beard.setFrame(f,loop); + } + var s = this.items.iterator(); + while(s.hasNext()) { + var s1 = s.next(); + if(s1.get_visible() && this.locked != s1) { + s1.setMovementFrame(mf); + s1.setFrame(s1.getMaxFrame() == this.sprite.getMaxFrame() ? f : s1.getAnimFrame() + df,loop); + } + } + if(this.active.get_visible() && this.locked != this.active) { + this.active.setMovementFrame(mf); + this.active.setFrame(this.active.getMaxFrame() == this.sprite.getMaxFrame() ? f : this.active.getAnimFrame() + df,loop); + } + return ret; + } + ,incFrame: function(df,loop) { + if(loop == null) { + loop = false; + } + return this.setFrame(this.sprite.getAnimFrame() + df,loop); + } + ,addItem: function(slot) { + if(this.player.equipment.get(slot) != null) { + var item = new com_davidmaletz_mining_renderer_ItemAnimationRenderer(this.player,this.fps); + item.set_visible(false); + this.addChild(item); + this.items.set(slot,item); + } + } + ,hideSlot: function(slot) { + var i = this.items.get(slot); + if(i != null) { + i.set_alpha(0); + } + } + ,showSlots: function() { + var i = this.items.iterator(); + while(i.hasNext()) { + var i1 = i.next(); + i1.set_alpha(1); + } + } + ,updateEquipment: function() { + this.showBeard = true; + var slot = this.items.keys(); + while(slot.hasNext()) { + var slot1 = slot.next(); + var s = this.player.equipment.getItem(slot1); + var vs = this.player.vanity.getItem(slot1); + if(vs != null) { + s = vs; + } else if(s != null && this.player.hasVanity(s.info,slot1)) { + s = null; + } + var i = s != null ? s.info : null; + if(i != null && i.xml.get("beard") == "false") { + this.showBeard = false; + } + this.items.get(slot1).setItem(i,s == null ? null : s.getName()); + } + if(this.beard != null) { + this.beard.set_visible(this.showBeard); + } + } + ,equipmentOrder: function(info) { + if(info == null || info.xml.get("slot") == "shield" || info.xml.get("behindPlayer") == "false") { + this.setChildIndex(this.active,this.get_numChildren() - 1); + this.setChildIndex(this.active.arms,this.get_numChildren() - 1); + } else { + this.setChildIndex(this.active.arms,0); + this.setChildIndex(this.active,0); + } + } + ,setActive: function(info,name,slot) { + this.active.slot = slot; + this.active.setItem(info,name); + this.equipmentOrder(info); + } + ,__class__: com_davidmaletz_mining_renderer__$PlayerRendererBase_PlayerSprite +}); +var com_davidmaletz_mining_renderer_ItemAnimationRenderer = function(p,fps) { + this.isVanity = false; + this.completeAnim = ""; + this.allowParentMovement = false; + this.player = p; + com_davidmaletz_tiles_render_TileAnimationRenderer.call(this,null,fps); + this.colors = p.colors; + this.offsets = p.offsets; + this.item = null; + this.default_fps = fps; +}; +$hxClasses["com.davidmaletz.mining.renderer.ItemAnimationRenderer"] = com_davidmaletz_mining_renderer_ItemAnimationRenderer; +com_davidmaletz_mining_renderer_ItemAnimationRenderer.__name__ = ["com","davidmaletz","mining","renderer","ItemAnimationRenderer"]; +com_davidmaletz_mining_renderer_ItemAnimationRenderer.__super__ = com_davidmaletz_tiles_render_TileAnimationRenderer; +com_davidmaletz_mining_renderer_ItemAnimationRenderer.prototype = $extend(com_davidmaletz_tiles_render_TileAnimationRenderer.prototype,{ + movement: null + ,player: null + ,default_fps: null + ,allowParentMovement: null + ,item: null + ,_anim_id: null + ,completeAnim: null + ,isVanity: null + ,playAnim: function(anim_id,loop) { + var old = this._anim_id; + this._anim_id = anim_id; + var append = ""; + if(this.item != null) { + if(this.item.xml.get("slot") == "shield" && this.item.xml.get("use") == "block") { + var s = this.player.shield.get(); + if(s == null || s.info != this.item) { + append = ".carry"; + } + } + if(this.completeAnim != "") { + if(anim_id != null && anim_id != old) { + this.completeAnim = anim_id; + } + return; + } + if(this.animation != null && !loop) { + this.completeAnim = old; + } else { + this.completeAnim = ""; + } + if((anim_id == "fly" || anim_id == "hover") && (this.isVanity || this.player.getFlight() == this.item)) { + anim_id += ".self"; + this._anim_id = anim_id; + } + var a = this.getEquipAnim(anim_id,append); + if(anim_id == "walk" && this.player.inventory.getWeight() > this.player.capacity.get()) { + var t = this.getEquipAnim(anim_id + ".heavy",append); + if(t.indexOf("walk.heavy") != -1 && com_davidmaletz_tiles_TileAnimation.exists(t)) { + a = t; + } + } + var move = null; + if(a == "single" || StringTools.endsWith(a,"idle")) { + if(this._anim_id == "walk") { + move = this.getMovement("walk"); + } else if(this._anim_id == "hit") { + move = this.getMovement("hit"); + } + var i = this.player.equipment.getItem(this.item.xml.get("slot")); + if(i != null && this.item == i.info && !this.item.canUse(this.player)) { + a = this.getEquipAnim("off",append); + } + } + com_davidmaletz_tiles_render_TileAnimationRenderer.prototype.setAnimation.call(this,a,-0.5,-0.5); + this.setMovement(move); + var a1 = this.item == this.player.getFlight(); + if(a1 != this.allowParentMovement) { + this.allowParentMovement = a1; + if(!a1) { + this.parent.set_x(0); + this.parent.set_y(0); + } + } + } + } + ,setAnimation: function(anim_id,offX,offY) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + this.playAnim(anim_id,true); + } + ,_setAnimation: function(a) { + com_davidmaletz_tiles_render_TileAnimationRenderer.prototype.setAnimation.call(this,a,-0.5,-0.5); + } + ,getEquipAnim: function(str,append) { + return this.item.getEquipAnim(this.last == null ? null : this.last.getName(),str,append); + } + ,init: function(e) { + com_davidmaletz_tiles_render_TileAnimationRenderer.prototype.init.call(this,e); + if(this.last != null) { + this.last.addEventListener("updated",$bind(this,this.updateTint)); + } + } + ,destroy: function(e) { + com_davidmaletz_tiles_render_TileAnimationRenderer.prototype.destroy.call(this,e); + if(this.last != null) { + this.last.removeEventListener("updated",$bind(this,this.updateTint)); + } + } + ,_setFrame: function(f,loop) { + if(this.completeAnim != "") { + var ret = com_davidmaletz_tiles_render_TileAnimationRenderer.prototype.setFrame.call(this,f,false); + if(this.frame > this.getMaxFrame() - 0.001) { + var c = this.completeAnim; + this.completeAnim = ""; + com_davidmaletz_tiles_render_TileAnimationRenderer.prototype.setFrame.call(this,0); + this.setAnimation(c); + } + return ret; + } else { + return com_davidmaletz_tiles_render_TileAnimationRenderer.prototype.setFrame.call(this,f,loop); + } + } + ,setFrame: function(f,loop) { + if(loop == null) { + loop = false; + } + var ret = this._setFrame(f,loop); + if(this.allowParentMovement) { + var f1 = this.getCurrentFrame(); + this.parent.set_x(f1.parentX * this.player.getFacing()); + this.parent.set_y(f1.parentY); + } + return ret; + } + ,getMovement: function(id) { + if(this.item.xml.exists("movement_" + id)) { + var a = this.item.xml.get("movement_" + id); + if(com_davidmaletz_tiles_TileAnimation.exists(a)) { + return a; + } else { + return "equipment." + a; + } + } else { + return "equipment." + id; + } + } + ,last: null + ,oldIcon: null + ,updateTint: function(e) { + if(this.item != null && this.last != null) { + this.item.tint(this,this.last.getName()); + if(e != null) { + this.setAnimation(this._anim_id); + } + if(this.oldIcon != null) { + var t = this.item.getIcon(this.last.getName()); + if(t != this.oldIcon) { + this.oldIcon = t; + this.clearAll(); + this.tile = t; + this.setAnimation(this._anim_id); + } + } + } + } + ,setItem: function(i,name) { + if(this.item != i || this.last != name) { + this.completeAnim = ""; + if(this.last != null) { + this.last.removeEventListener("updated",$bind(this,this.updateTint)); + this.last = null; + } + this.oldIcon = null; + this.item = i; + this.set_visible(this.item != null && this.player.isVisible(this.item,this.player.isUnderwater())); + if(this.item != null) { + this.isVanity = this.player.vanity.isEquipped(i); + var t = i.getTile(); + if(i.xml.get("slot") == "shield" && t == com_davidmaletz_tiles_EmptyTile.get()) { + t = i.getIcon(name == null ? null : name.getName()); + this.oldIcon = t; + } + this.last = name; + if(this.last != null) { + this.last.addEventListener("updated",$bind(this,this.updateTint)); + this.updateTint(null); + } else { + this.item.tint(this); + } + this.clearAll(); + if(this.item.xml.exists("equip_fps")) { + this.deltaFrame = com_davidmaletz_mining_Main.parseFloat(this.item.xml.get("equip_fps")) / 60; + } else { + this.deltaFrame = this.default_fps / 60; + } + this.tile = t; + this.setAnimation(this._anim_id); + } + } else { + this.set_visible(this.item != null && this.player.isVisible(this.item,this.player.isUnderwater())); + this.setAnimation(this._anim_id); + } + } + ,setMovement: function(anim) { + if(com_davidmaletz_tiles_TileAnimation.exists(anim)) { + this.movement = com_davidmaletz_tiles_TileAnimation.get(anim); + } else { + this.movement = null; + this.set_x(0); + this.set_y(0); + } + } + ,setMovementFrame: function(f) { + if(this.movement != null) { + var c = this.movement.getFrame(this.movement.getFrameAtTime(f)); + this.set_x(c.offsetX); + this.set_y(c.offsetY); + } + } + ,updateColors: function() { + this.colors = this.player.colors; + this.offsets = this.player.offsets; + var t = this.tile; + this.clearAll(); + this.tile = t; + this.setAnimation(this._anim_id); + } + ,__class__: com_davidmaletz_mining_renderer_ItemAnimationRenderer +}); +var com_davidmaletz_mining_renderer_EquipmentRenderer = function(p,fps) { + this.slot = null; + this.arms_visible = false; + com_davidmaletz_mining_renderer_ItemAnimationRenderer.call(this,p,fps); + this.arms = new com_davidmaletz_tiles_render_TileAnimationRenderer(null,fps,false); + this.arms.set_visible(false); + this.base = 163; + if(this.player.info.xml.exists("eqArmBase")) { + this.base = com_davidmaletz_mining_Main.parseInt(this.player.info.xml.get("eqArmBase")); + } + this.updateColors(); +}; +$hxClasses["com.davidmaletz.mining.renderer.EquipmentRenderer"] = com_davidmaletz_mining_renderer_EquipmentRenderer; +com_davidmaletz_mining_renderer_EquipmentRenderer.__name__ = ["com","davidmaletz","mining","renderer","EquipmentRenderer"]; +com_davidmaletz_mining_renderer_EquipmentRenderer.__super__ = com_davidmaletz_mining_renderer_ItemAnimationRenderer; +com_davidmaletz_mining_renderer_EquipmentRenderer.prototype = $extend(com_davidmaletz_mining_renderer_ItemAnimationRenderer.prototype,{ + projectile: null + ,arms: null + ,arms_visible: null + ,arm_tile: null + ,slot: null + ,base: null + ,removeProjectile: function() { + if(this.projectile != null) { + if(this.projectile.parent == this) { + this.removeChild(this.projectile); + } + this.projectile = null; + } + } + ,setAnimation: function(anim_id,offX,offY) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + var old = this._anim_id; + this.removeProjectile(); + com_davidmaletz_mining_renderer_ItemAnimationRenderer.prototype.setAnimation.call(this,anim_id,offX,offY); + if(anim_id == null) { + this._anim_id = old; + } + if(this.arms.get_visible()) { + this.arms.setAnimation(this.animation,-0.5,-0.5); + } + } + ,setItem: function(i,name) { + com_davidmaletz_mining_renderer_ItemAnimationRenderer.prototype.setItem.call(this,i,name); + if(i == null) { + this.arms.set_visible(this.arms_visible = false); + return; + } + var a = i.xml.get("arms"); + if(com_davidmaletz_tiles_Tile.exists(a) && this.player.info.xml.get("allowEqArms") != "false") { + this.arms_visible = true; + this.arms.set_visible(this.get_visible()); + if(a != this.arm_tile) { + this.arm_tile = a; + this.arms.clearAll(); + this.arms.tile = new com_davidmaletz_mining_renderer__$PlayerRendererBase_ArmTile(a); + } + this.arms.setAnimation(this.animation,-0.5,-0.5); + } else { + this.arms.set_visible(this.arms_visible = false); + } + } + ,getEquipAnim: function(str,append) { + if(this.slot != null && com_davidmaletz_tiles_TileAnimation.exists("equipment." + this.item.id + "." + this.slot)) { + return this.item.getEquipAnim(this.last == null ? null : this.last.getName(),str,"." + this.slot + append); + } else { + return com_davidmaletz_mining_renderer_ItemAnimationRenderer.prototype.getEquipAnim.call(this,str,append); + } + } + ,updateColors: function() { + com_davidmaletz_mining_renderer_ItemAnimationRenderer.prototype.updateColors.call(this); + com_davidmaletz_faengfl_TextSprite.setColor(this.arms,this.player.getArmColor(),this.base); + } + ,clear: function(anim_id) { + this.removeProjectile(); + com_davidmaletz_mining_renderer_ItemAnimationRenderer.prototype.clear.call(this,anim_id); + } + ,setFrame: function(f,loop) { + if(loop == null) { + loop = false; + } + if(this.projectile != null) { + this.projectile.setFrame(f,true); + if(this.projectile.frame < f) { + this.removeProjectile(); + } + } + if(this.arms.get_visible()) { + this.arms.setFrame(f,loop); + this.arms.set_x(this.get_x()); + this.arms.set_y(this.get_y()); + } + return com_davidmaletz_mining_renderer_ItemAnimationRenderer.prototype.setFrame.call(this,f,loop); + } + ,setProjectile: function(p) { + this.removeProjectile(); + this.projectile = p; + this.addChildAt(this.projectile,0); + } + ,set_visible: function(v) { + this.arms.set_visible(this.arms_visible && v); + return com_davidmaletz_mining_renderer_ItemAnimationRenderer.prototype.set_visible.call(this,v); + } + ,__class__: com_davidmaletz_mining_renderer_EquipmentRenderer +}); +var com_davidmaletz_mining_renderer_SimplePlayerRenderer = function(p,fps,playPaused) { + com_davidmaletz_mining_renderer_PlayerRendererBase.call(this,p,fps); + this.playPaused = playPaused; +}; +$hxClasses["com.davidmaletz.mining.renderer.SimplePlayerRenderer"] = com_davidmaletz_mining_renderer_SimplePlayerRenderer; +com_davidmaletz_mining_renderer_SimplePlayerRenderer.__name__ = ["com","davidmaletz","mining","renderer","SimplePlayerRenderer"]; +com_davidmaletz_mining_renderer_SimplePlayerRenderer.__super__ = com_davidmaletz_mining_renderer_PlayerRendererBase; +com_davidmaletz_mining_renderer_SimplePlayerRenderer.prototype = $extend(com_davidmaletz_mining_renderer_PlayerRendererBase.prototype,{ + movement: null + ,movementAppend: null + ,movement_frame: null + ,movement_df: null + ,playPaused: null + ,init: function(e) { + com_davidmaletz_mining_renderer_PlayerRendererBase.prototype.init.call(this,e); + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this._handle_frame),false,PriorityManager.getPriority()); + } + ,destroy: function(e) { + com_davidmaletz_mining_renderer_PlayerRendererBase.prototype.destroy.call(this,e); + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this._handle_frame)); + } + ,setMovement: function(anim,fps) { + if(this.movementAppend != null) { + com_davidmaletz_faengfl_FaengFL.remove(this.movementAppend); + this.movementAppend = null; + } + if(com_davidmaletz_tiles_TileAnimation.exists(anim)) { + this.movement = com_davidmaletz_tiles_TileAnimation.get(anim); + this.movement_frame = 0; + this.movement_df = fps / 60; + var c = this.movement.getFrame(this.movement.getFrameAtTime(0)); + this.set_x(c.offsetX); + this.set_y(c.offsetY); + if(this.movement.append != null) { + this.movementAppend = new com_davidmaletz_tiles_render_TileAnimationRenderer(com_davidmaletz_tiles_EmptyTile.get(),fps); + this.movementAppend.setAnimation(anim); + this.movementAppend.set_x(-this.get_x()); + this.movementAppend.set_y(-this.get_y()); + this.addChild(this.movementAppend); + } + } else { + this.movement = null; + } + } + ,advanceFrame: function(df) { + if(!this.playPaused && com_davidmaletz_faengfl_Window.window_ct > 0) { + this.advanceTracks(df); + return; + } + com_davidmaletz_mining_renderer_PlayerRendererBase.prototype.advanceFrame.call(this,df); + if(this.movement != null) { + var max = this.movement.getMaxTime() / this.movement_df; + var f = com_fancyfish_faeng_common_Utils.mod(this.movement_frame + df,max); + if(f != this.movement_frame) { + this.movement_frame = f; + var c = this.movement.getFrame(this.movement.getFrameAtTime(f * this.movement_df)); + this.set_x(c.offsetX); + this.set_y(c.offsetY); + if(this.movementAppend != null) { + this.movementAppend.setFrame(f); + this.movementAppend.set_x(-this.get_x()); + this.movementAppend.set_y(-this.get_y()); + } + } + } + } + ,_handle_frame: function(e) { + if(com_davidmaletz_mining_Main.isPaused()) { + this.advanceTracks(com_davidmaletz_faengfl_FaengFL.frameTime); + } + } + ,__class__: com_davidmaletz_mining_renderer_SimplePlayerRenderer +}); +var com_davidmaletz_mining_renderer_StaticPlayerRenderer = function(p,fps) { + com_davidmaletz_mining_renderer_SimplePlayerRenderer.call(this,p,fps,true); +}; +$hxClasses["com.davidmaletz.mining.renderer.StaticPlayerRenderer"] = com_davidmaletz_mining_renderer_StaticPlayerRenderer; +com_davidmaletz_mining_renderer_StaticPlayerRenderer.__name__ = ["com","davidmaletz","mining","renderer","StaticPlayerRenderer"]; +com_davidmaletz_mining_renderer_StaticPlayerRenderer.__super__ = com_davidmaletz_mining_renderer_SimplePlayerRenderer; +com_davidmaletz_mining_renderer_StaticPlayerRenderer.prototype = $extend(com_davidmaletz_mining_renderer_SimplePlayerRenderer.prototype,{ + init: function(e) { + this.destroy(null); + this.change_equipment(null); + var anim = this.anim_id; + this.anim_id = null; + this.setAnimation(anim); + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.handle_frame),false,PriorityManager.getPriority()); + } + ,destroy: function(e) { + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.handle_frame)); + } + ,handle_frame: function(e) { + this.enter_frame(com_davidmaletz_faengfl_FaengFL.frameTime); + } + ,__class__: com_davidmaletz_mining_renderer_StaticPlayerRenderer +}); +var com_davidmaletz_mining_renderer__$PlayerRendererBase_ArmTile = function(id) { + this.tile = com_davidmaletz_tiles_Tile.get(id); + this.anim = com_davidmaletz_tiles_TileAnimation.get(id); + if(this.anim == null) { + this.anim = com_davidmaletz_tiles_TileAnimation.get("single"); + } +}; +$hxClasses["com.davidmaletz.mining.renderer._PlayerRendererBase.ArmTile"] = com_davidmaletz_mining_renderer__$PlayerRendererBase_ArmTile; +com_davidmaletz_mining_renderer__$PlayerRendererBase_ArmTile.__name__ = ["com","davidmaletz","mining","renderer","_PlayerRendererBase","ArmTile"]; +com_davidmaletz_mining_renderer__$PlayerRendererBase_ArmTile.prototype = { + tile: null + ,anim: null + ,render: function(getNeighbors,layer,x,y,offX,offY) { + var f = this.getFrame(offX); + if(f.visible) { + this.tile.render(getNeighbors,layer,x + f.offsetX,y + f.offsetY,f.x,f.y); + } + } + ,getFrame: function(x) { + return this.anim.getFrame(this.anim.getFrameAtTime(x + 1)); + } + ,getTileWidth: function(offX,offY) { + var f = this.getFrame(offX); + return this.tile.getTileWidth(f.x,f.y); + } + ,getTileHeight: function(offX,offY) { + var f = this.getFrame(offY); + return this.tile.getTileHeight(f.x,f.y); + } + ,__class__: com_davidmaletz_mining_renderer__$PlayerRendererBase_ArmTile +}; +var com_davidmaletz_mining_renderer_IProjectile = function() { }; +$hxClasses["com.davidmaletz.mining.renderer.IProjectile"] = com_davidmaletz_mining_renderer_IProjectile; +com_davidmaletz_mining_renderer_IProjectile.__name__ = ["com","davidmaletz","mining","renderer","IProjectile"]; +com_davidmaletz_mining_renderer_IProjectile.prototype = { + getTile: null + ,isGlow: null + ,getColor: null + ,getWhite: null + ,__class__: com_davidmaletz_mining_renderer_IProjectile +}; +var com_davidmaletz_mining_renderer_ItemAnimEvent = function(type,s,a,l) { + openfl_events_Event.call(this,type); + this.slot = s; + this.anim = a; + this.loop = l; +}; +$hxClasses["com.davidmaletz.mining.renderer.ItemAnimEvent"] = com_davidmaletz_mining_renderer_ItemAnimEvent; +com_davidmaletz_mining_renderer_ItemAnimEvent.__name__ = ["com","davidmaletz","mining","renderer","ItemAnimEvent"]; +com_davidmaletz_mining_renderer_ItemAnimEvent.__super__ = openfl_events_Event; +com_davidmaletz_mining_renderer_ItemAnimEvent.prototype = $extend(openfl_events_Event.prototype,{ + slot: null + ,anim: null + ,loop: null + ,__class__: com_davidmaletz_mining_renderer_ItemAnimEvent +}); +var com_davidmaletz_mining_renderer_ProjectilesRenderer = function(area) { + com_davidmaletz_faengfl_InitSprite.call(this); + this.area = area; +}; +$hxClasses["com.davidmaletz.mining.renderer.ProjectilesRenderer"] = com_davidmaletz_mining_renderer_ProjectilesRenderer; +com_davidmaletz_mining_renderer_ProjectilesRenderer.__name__ = ["com","davidmaletz","mining","renderer","ProjectilesRenderer"]; +com_davidmaletz_mining_renderer_ProjectilesRenderer.__super__ = com_davidmaletz_faengfl_InitSprite; +com_davidmaletz_mining_renderer_ProjectilesRenderer.prototype = $extend(com_davidmaletz_faengfl_InitSprite.prototype,{ + area: null + ,init: function(e) { + this.destroy(e); + this.area.addEventListener("add_projectile",$bind(this,this.add_projectile)); + this.area.addEventListener("rem_projectile",$bind(this,this.rem_projectile)); + this.updateProjectiles(); + } + ,destroy: function(e) { + this.area.removeEventListener("add_projectile",$bind(this,this.add_projectile)); + this.area.removeEventListener("rem_projectile",$bind(this,this.rem_projectile)); + } + ,updateProjectiles: function() { + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this); + var p = this.area.getProjectiles(); + while(p.hasNext()) { + var p1 = p.next(); + this.addProjectile(p1); + } + } + ,add_projectile: function(e) { + this.addProjectile(e.value); + } + ,rem_projectile: function(e) { + var p = js_Boot.__cast(e.value , com_davidmaletz_mining_world_Projectile); + var r = p.getRenderer(); + var d = r; + var tmp = function() { + com_davidmaletz_faengfl_FaengFL.remove(d); + }; + r.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),5,tmp); + } + ,addProjectile: function(p) { + this.addChild(p.getRenderer()); + } + ,__class__: com_davidmaletz_mining_renderer_ProjectilesRenderer +}); +var com_davidmaletz_mining_renderer_RotateSprite = function(s) { + com_davidmaletz_faengfl_InitSprite.call(this); + this.speed = s; + this.set_rotation(this.rot = com_davidmaletz_mining_renderer_RotateSprite.lastRot); +}; +$hxClasses["com.davidmaletz.mining.renderer.RotateSprite"] = com_davidmaletz_mining_renderer_RotateSprite; +com_davidmaletz_mining_renderer_RotateSprite.__name__ = ["com","davidmaletz","mining","renderer","RotateSprite"]; +com_davidmaletz_mining_renderer_RotateSprite.__interfaces__ = [com_davidmaletz_faengfl_EnterFrameHandler]; +com_davidmaletz_mining_renderer_RotateSprite.__super__ = com_davidmaletz_faengfl_InitSprite; +com_davidmaletz_mining_renderer_RotateSprite.prototype = $extend(com_davidmaletz_faengfl_InitSprite.prototype,{ + speed: null + ,rot: null + ,init: function(e) { + this.destroy(null); + com_davidmaletz_faengfl_FaengFL.addEnterFrame(this); + } + ,destroy: function(e) { + com_davidmaletz_faengfl_FaengFL.removeEnterFrame(this); + } + ,enter_frame: function(frames) { + this.rot += this.speed * frames; + this.set_rotation(this.rot); + com_davidmaletz_mining_renderer_RotateSprite.lastRot = this.rot; + } + ,__class__: com_davidmaletz_mining_renderer_RotateSprite +}); +var com_davidmaletz_mining_renderer_SpiritLerpFL = function() { + com_davidmaletz_lerp_LerpSpriteFL.call(this); +}; +$hxClasses["com.davidmaletz.mining.renderer.SpiritLerpFL"] = com_davidmaletz_mining_renderer_SpiritLerpFL; +com_davidmaletz_mining_renderer_SpiritLerpFL.__name__ = ["com","davidmaletz","mining","renderer","SpiritLerpFL"]; +com_davidmaletz_mining_renderer_SpiritLerpFL.__super__ = com_davidmaletz_lerp_LerpSpriteFL; +com_davidmaletz_mining_renderer_SpiritLerpFL.prototype = $extend(com_davidmaletz_lerp_LerpSpriteFL.prototype,{ + init: function(e) { + this.updateHidden(null); + com_davidmaletz_lerp_LerpSpriteFL.prototype.init.call(this,e); + com_davidmaletz_mining_Main.getLocalPlayer().viewHidden.addEventListener("updated",$bind(this,this.updateHidden)); + } + ,destroy: function(e) { + com_davidmaletz_lerp_LerpSpriteFL.prototype.destroy.call(this,e); + com_davidmaletz_mining_Main.getLocalPlayer().viewHidden.removeEventListener("updated",$bind(this,this.updateHidden)); + } + ,updateHidden: function(e) { + this.set_visible(true); + } + ,advanceFrame: function(frames) { + if(this.get_visible()) { + com_davidmaletz_lerp_LerpSpriteFL.prototype.advanceFrame.call(this,frames); + } else { + com_davidmaletz_lerp_LerpSpriteFL.prototype.advanceTracks.call(this,frames); + } + } + ,set_visible: function(value) { + return com_davidmaletz_lerp_LerpSpriteFL.prototype.set_visible.call(this,value && com_davidmaletz_mining_Main.getLocalPlayer().viewHidden.get()); + } + ,__class__: com_davidmaletz_mining_renderer_SpiritLerpFL +}); +var com_davidmaletz_mining_renderer_SpiritRenderer = function(tile,anim,fps,loop,complete,offX,offY) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + com_davidmaletz_tiles_render_PlayAnimation.call(this,tile,anim,fps,loop,complete,offX,offY); +}; +$hxClasses["com.davidmaletz.mining.renderer.SpiritRenderer"] = com_davidmaletz_mining_renderer_SpiritRenderer; +com_davidmaletz_mining_renderer_SpiritRenderer.__name__ = ["com","davidmaletz","mining","renderer","SpiritRenderer"]; +com_davidmaletz_mining_renderer_SpiritRenderer.__super__ = com_davidmaletz_tiles_render_PlayAnimation; +com_davidmaletz_mining_renderer_SpiritRenderer.prototype = $extend(com_davidmaletz_tiles_render_PlayAnimation.prototype,{ + init: function(e) { + this.updateHidden(null); + com_davidmaletz_tiles_render_PlayAnimation.prototype.init.call(this,e); + com_davidmaletz_mining_Main.getLocalPlayer().viewHidden.addEventListener("updated",$bind(this,this.updateHidden)); + } + ,destroy: function(e) { + com_davidmaletz_tiles_render_PlayAnimation.prototype.destroy.call(this,e); + com_davidmaletz_mining_Main.getLocalPlayer().viewHidden.removeEventListener("updated",$bind(this,this.updateHidden)); + } + ,updateHidden: function(e) { + this.set_visible(true); + } + ,advanceFrame: function(frames) { + if(this.get_visible()) { + com_davidmaletz_tiles_render_PlayAnimation.prototype.advanceFrame.call(this,frames); + } else { + com_davidmaletz_tiles_render_PlayAnimation.prototype.advanceTracks.call(this,frames); + } + } + ,set_visible: function(value) { + return com_davidmaletz_tiles_render_PlayAnimation.prototype.set_visible.call(this,value && com_davidmaletz_mining_Main.getLocalPlayer().viewHidden.get()); + } + ,__class__: com_davidmaletz_mining_renderer_SpiritRenderer +}); +var com_davidmaletz_mining_renderer_StaticWaterBlockRenderer = function(m,autosetView) { + if(autosetView == null) { + autosetView = true; + } + com_davidmaletz_tiles_render_FloorRenderer.call(this,m,2,null,autosetView); +}; +$hxClasses["com.davidmaletz.mining.renderer.StaticWaterBlockRenderer"] = com_davidmaletz_mining_renderer_StaticWaterBlockRenderer; +com_davidmaletz_mining_renderer_StaticWaterBlockRenderer.__name__ = ["com","davidmaletz","mining","renderer","StaticWaterBlockRenderer"]; +com_davidmaletz_mining_renderer_StaticWaterBlockRenderer.__super__ = com_davidmaletz_tiles_render_FloorRenderer; +com_davidmaletz_mining_renderer_StaticWaterBlockRenderer.prototype = $extend(com_davidmaletz_tiles_render_FloorRenderer.prototype,{ + createChunk: function(cx,cy) { + return new com_davidmaletz_mining_renderer__$StaticWaterBlockRenderer_WaterChunk(this.map,cx,cy,this.layer,this.getNeighbors,this.scale); + } + ,__class__: com_davidmaletz_mining_renderer_StaticWaterBlockRenderer +}); +var com_davidmaletz_mining_renderer__$StaticWaterBlockRenderer_WaterChunk = function(map,cx,cy,l,neighbors,s) { + this.area = js_Boot.__cast(map , com_davidmaletz_mining_world_Area); + this.t = this.area.getWaterBlock(); + com_davidmaletz_tiles_render_ChunkRenderer.call(this,map,cx,cy,l,neighbors,s); +}; +$hxClasses["com.davidmaletz.mining.renderer._StaticWaterBlockRenderer.WaterChunk"] = com_davidmaletz_mining_renderer__$StaticWaterBlockRenderer_WaterChunk; +com_davidmaletz_mining_renderer__$StaticWaterBlockRenderer_WaterChunk.__name__ = ["com","davidmaletz","mining","renderer","_StaticWaterBlockRenderer","WaterChunk"]; +com_davidmaletz_mining_renderer__$StaticWaterBlockRenderer_WaterChunk.__super__ = com_davidmaletz_tiles_render_ChunkRenderer; +com_davidmaletz_mining_renderer__$StaticWaterBlockRenderer_WaterChunk.prototype = $extend(com_davidmaletz_tiles_render_ChunkRenderer.prototype,{ + area: null + ,t: null + ,getTile: function(x,y,l) { + if(this.area.hasFlags(x,y,8)) { + return this.t; + } else { + return null; + } + } + ,__class__: com_davidmaletz_mining_renderer__$StaticWaterBlockRenderer_WaterChunk +}); +var com_davidmaletz_mining_renderer_StaticWaterFloorRenderer = function(m,autosetView) { + if(autosetView == null) { + autosetView = true; + } + com_davidmaletz_tiles_render_FloorRenderer.call(this,m,2,com_davidmaletz_mining_renderer_WaterFloorRenderer.isWater,autosetView); +}; +$hxClasses["com.davidmaletz.mining.renderer.StaticWaterFloorRenderer"] = com_davidmaletz_mining_renderer_StaticWaterFloorRenderer; +com_davidmaletz_mining_renderer_StaticWaterFloorRenderer.__name__ = ["com","davidmaletz","mining","renderer","StaticWaterFloorRenderer"]; +com_davidmaletz_mining_renderer_StaticWaterFloorRenderer.__super__ = com_davidmaletz_tiles_render_FloorRenderer; +com_davidmaletz_mining_renderer_StaticWaterFloorRenderer.prototype = $extend(com_davidmaletz_tiles_render_FloorRenderer.prototype,{ + createChunk: function(cx,cy) { + return new com_davidmaletz_mining_renderer__$StaticWaterFloorRenderer_WaterChunk(this.map,cx,cy,this.layer,this.getNeighbors,this.scale); + } + ,__class__: com_davidmaletz_mining_renderer_StaticWaterFloorRenderer +}); +var com_davidmaletz_mining_renderer__$StaticWaterFloorRenderer_WaterChunk = function(map,cx,cy,l,neighbors,s) { + this.area = js_Boot.__cast(map , com_davidmaletz_mining_world_Area); + this.t = this.area.getWaterTile(); + com_davidmaletz_tiles_render_ChunkRenderer.call(this,map,cx,cy,l,neighbors,s); +}; +$hxClasses["com.davidmaletz.mining.renderer._StaticWaterFloorRenderer.WaterChunk"] = com_davidmaletz_mining_renderer__$StaticWaterFloorRenderer_WaterChunk; +com_davidmaletz_mining_renderer__$StaticWaterFloorRenderer_WaterChunk.__name__ = ["com","davidmaletz","mining","renderer","_StaticWaterFloorRenderer","WaterChunk"]; +com_davidmaletz_mining_renderer__$StaticWaterFloorRenderer_WaterChunk.__super__ = com_davidmaletz_tiles_render_ChunkRenderer; +com_davidmaletz_mining_renderer__$StaticWaterFloorRenderer_WaterChunk.prototype = $extend(com_davidmaletz_tiles_render_ChunkRenderer.prototype,{ + area: null + ,t: null + ,getTile: function(x,y,l) { + if(this.area.hasFlags(x,y,4)) { + return this.t; + } else { + return null; + } + } + ,__class__: com_davidmaletz_mining_renderer__$StaticWaterFloorRenderer_WaterChunk +}); +var com_davidmaletz_mining_renderer_TreeRenderer = function(t) { + this.animate = false; + this.info = t.getInfo(); + com_davidmaletz_tiles_render_TileAnimationRenderer.call(this,this.info.tile,15); + this.tree = t; + this.setAnimation(this.getAnim("hit")); + var idle = this.getAnim("idle"); + if(com_davidmaletz_tiles_TileAnimation.exists(idle)) { + this.setAnimation(idle); + } + this.setAnimation(this.getAnim("grow")); + this.updateAnim(); + this.glow = t.info.xml.get("glow") == "true"; + if(com_davidmaletz_mining_renderer_TreeRenderer.bounds == null) { + com_davidmaletz_mining_renderer_TreeRenderer.bounds = new openfl_geom_Rectangle(-100,-100,200,100 + com_davidmaletz_tiles_Tile.SIZE); + } + this.addChild(new com_davidmaletz_mining_renderer__$TreeRenderer_TreeHealthBar(this.tree)); + var i = this.info.xml.elementPathsNamed("attacks"); + if(i.hasNext()) { + var e = i.next(); + this.attack = new com_davidmaletz_mining_renderer__$TreeRenderer_TreeAttack(this.tree,e); + if(e.get("behind") == "true") { + this.addChildAt(this.attack,0); + } else { + this.addChild(this.attack); + } + } +}; +$hxClasses["com.davidmaletz.mining.renderer.TreeRenderer"] = com_davidmaletz_mining_renderer_TreeRenderer; +com_davidmaletz_mining_renderer_TreeRenderer.__name__ = ["com","davidmaletz","mining","renderer","TreeRenderer"]; +com_davidmaletz_mining_renderer_TreeRenderer.bounds = null; +com_davidmaletz_mining_renderer_TreeRenderer.__super__ = com_davidmaletz_tiles_render_TileAnimationRenderer; +com_davidmaletz_mining_renderer_TreeRenderer.prototype = $extend(com_davidmaletz_tiles_render_TileAnimationRenderer.prototype,{ + glow: null + ,tree: null + ,info: null + ,attack: null + ,superRenderGL: function(renderSession) { + com_davidmaletz_tiles_render_TileAnimationRenderer.prototype.__renderGL.call(this,renderSession); + } + ,__renderGL: function(renderSession) { + if(this.glow) { + com_davidmaletz_faengfl_GlowSprite.makeGlow($bind(this,this.superRenderGL),renderSession); + } else { + com_davidmaletz_tiles_render_TileAnimationRenderer.prototype.__renderGL.call(this,renderSession); + } + } + ,setAnimation: function(anim_id,offX,offY) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + com_davidmaletz_tiles_render_TileAnimationRenderer.prototype.setAnimation.call(this,anim_id,-0.5,-1); + } + ,init: function(e) { + com_davidmaletz_tiles_render_TileAnimationRenderer.prototype.init.call(this,e); + this.tree.addEventListener("change_health",$bind(this,this.onHit)); + } + ,destroy: function(e) { + com_davidmaletz_tiles_render_TileAnimationRenderer.prototype.destroy.call(this,e); + this.tree.removeEventListener("change_health",$bind(this,this.onHit)); + } + ,animate: null + ,onKill: function(attacker,element) { + if(attacker != null && Std["is"](attacker,com_davidmaletz_mining_Player)) { + var info = this.tree.getTreeInfo(); + var p = js_Boot.__cast(attacker , com_davidmaletz_mining_Player); + var o = p.vehicle == null ? p : p.vehicle; + var loot = info.getLoot(element); + if(this.tree.isGrown() && loot != null) { + var dx = 0; + if(o.renderer != null) { + if(o.renderer.get_scaleX() > 0) { + dx = -1; + } else { + dx = 1; + } + } + if(o.area != null && o.area.renderer != null) { + com_davidmaletz_mining_renderer_CollectLoot.collect(new com_fancyfish_faeng_common_SingleIterator(loot),o.area.renderer,this.get_x() - com_davidmaletz_tiles_Tile.SIZE * (dx + 0.5),this.get_y() - com_davidmaletz_tiles_Tile.SIZE * 0.5,3); + } + } + if(o.area != null && o.area.renderer != null) { + var t = new com_davidmaletz_tiles_render_TileAnimationRenderer(this.info.tile,15); + t.setAnimation(this.animation,-0.5,-1); + t.setFrame(this.frame); + t.set_x(this.get_x()); + t.set_y(this.get_y()); + com_davidmaletz_mining_renderer_CollectLoot.kill(element,o.area.renderer,p,this.tree,t,null,-com_davidmaletz_tiles_Tile.SIZE * 0.5); + } + } + if(this.attack != null) { + this.attack.playIdle(this.attack); + } + this.setHit(false); + this.setAnimation(this.getAnim("grow")); + this.tree.setGrowth(0); + this.animate = false; + this.setFrame(this.tree.growth); + } + ,onHit: function(e) { + if(this.tree.getHealth() > 0 && this.tree.isGrown() && e.delta < 0 && e.attacker != null) { + this.animate = true; + this.setAnimation(this.getAnim("hit")); + this.setFrame(0); + } + } + ,setHit: function(hit) { + var h = this.tree.getInfo().xml.get("hitType"); + if(h == null) { + return false; + } + var i = hit ? js_Boot.__cast(com_davidmaletz_mining_world_ObjectInfo.get(h) , com_davidmaletz_mining_world_BushInfo) : this.tree.getInfo(); + if(this.info != i) { + this.clear(this.getAnim("hit")); + this.clear(this.getAnim("grow")); + this.clear(this.getAnim("idle")); + this.info = i; + this.tile = i.tile; + this.clear(this.getAnim("hit")); + this.clear(this.getAnim("grow")); + this.clear(this.getAnim("idle")); + return true; + } else { + return false; + } + } + ,getAnim: function(id) { + return this.info.getAnim(id); + } + ,updateAnim: function() { + var idle = this.getAnim("idle"); + if(com_davidmaletz_tiles_TileAnimation.exists(idle) && this.tree.isGrown()) { + this.setAnimation(idle); + } else { + this.setAnimation(this.getAnim("grow")); + this.setFrame(this.tree.growth); + } + } + ,advanceFrame: function(frames) { + com_davidmaletz_tiles_render_TileAnimationRenderer.prototype.advanceFrame.call(this,frames); + if(this.animate) { + if(!this.incFrame(frames)) { + this.animate = false; + this.setHit(true); + this.updateAnim(); + } + } else if(this.animation == this.getAnim("grow")) { + var idle = this.getAnim("idle"); + if(com_davidmaletz_tiles_TileAnimation.exists(idle) && this.tree.isGrown() && this.tree.area != null && this.tree.area.isActivePlayer()) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + this.setAnimation(idle); + this.tree.runEvent("idle",null); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + } else if(this.animation == this.getAnim("idle")) { + this.incFrame(frames,true); + } + } + ,__class__: com_davidmaletz_mining_renderer_TreeRenderer +}); +var com_davidmaletz_mining_renderer__$TreeRenderer_TreeHealthBar = function(tree) { + com_davidmaletz_mining_renderer_ObjectHealthBar.call(this,tree,3381504); +}; +$hxClasses["com.davidmaletz.mining.renderer._TreeRenderer.TreeHealthBar"] = com_davidmaletz_mining_renderer__$TreeRenderer_TreeHealthBar; +com_davidmaletz_mining_renderer__$TreeRenderer_TreeHealthBar.__name__ = ["com","davidmaletz","mining","renderer","_TreeRenderer","TreeHealthBar"]; +com_davidmaletz_mining_renderer__$TreeRenderer_TreeHealthBar.__super__ = com_davidmaletz_mining_renderer_ObjectHealthBar; +com_davidmaletz_mining_renderer__$TreeRenderer_TreeHealthBar.prototype = $extend(com_davidmaletz_mining_renderer_ObjectHealthBar.prototype,{ + hide: function() { + this.set_visible(false); + } + ,init: function(e) { + com_davidmaletz_mining_renderer_ObjectHealthBar.prototype.init.call(this,e); + if(this.object.getHealthPercent() == 0) { + this.set_visible(false); + } + } + ,update: function(e) { + var p = this.object.getHealthPercent(); + if(p != 0) { + this.set_visible(p < 1); + } + this.setProgress(p,5,p == 0 ? $bind(this,this.hide) : null); + } + ,__class__: com_davidmaletz_mining_renderer__$TreeRenderer_TreeHealthBar +}); +var com_davidmaletz_mining_renderer__$TreeRenderer_TreeAttack = function(tree,xml) { + var attacks = []; + var e = xml.elementPathsNamed("attack"); + while(e.hasNext()) { + var e1 = e.next(); + attacks.push(com_davidmaletz_mining_enemy_Attack.fromXML(e1)); + } + this.xml = xml; + if(xml.exists("damage")) { + attacks.push(new com_davidmaletz_mining_enemy_Attack(com_davidmaletz_mining_Main.parseInt(xml.get("damage")),null,"attack")); + } + this.tree = tree; + var t = com_davidmaletz_tiles_Tile.get(xml.get("tile")); + com_davidmaletz_mining_enemy_AttackRenderer.call(this,t,com_davidmaletz_mining_enemy_AttackRenderer.getTargets(xml.elementsNamed("target")),attacks,com_davidmaletz_mining_enemy_AttackRenderer.getFPS(xml,15),null); +}; +$hxClasses["com.davidmaletz.mining.renderer._TreeRenderer.TreeAttack"] = com_davidmaletz_mining_renderer__$TreeRenderer_TreeAttack; +com_davidmaletz_mining_renderer__$TreeRenderer_TreeAttack.__name__ = ["com","davidmaletz","mining","renderer","_TreeRenderer","TreeAttack"]; +com_davidmaletz_mining_renderer__$TreeRenderer_TreeAttack.__super__ = com_davidmaletz_mining_enemy_AttackRenderer; +com_davidmaletz_mining_renderer__$TreeRenderer_TreeAttack.prototype = $extend(com_davidmaletz_mining_enemy_AttackRenderer.prototype,{ + tree: null + ,xml: null + ,fireEvent: function(e) { + this.tree.dispatchEvent(e); + } + ,repeatAttack: function(o) { + var ret = com_davidmaletz_mining_enemy_AttackRenderer.prototype.repeatAttack.call(this,o); + if(!ret) { + this.tree.dispatchEvent(new openfl_events_Event("end_attack")); + } + return ret; + } + ,_setAnimation: function(anim_id,offX,offY) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + com_davidmaletz_mining_enemy_AttackRenderer.prototype._setAnimation.call(this,anim_id,-0.5,-1); + } + ,shouldAttack: function(o) { + if(!(o.isPlayer() && o.canAttack())) { + return com_davidmaletz_mining_enemy_AttackRenderer.prototype.shouldAttack.call(this,o); + } else { + return true; + } + } + ,getAttacker: function() { + return this.tree; + } + ,onMiss: function(o) { + if(o == null) { + this.tree.showPopup(true,com_fancyfish_faeng_common_Lang.getText("common","miss"),-com_davidmaletz_tiles_Tile.SIZE); + } else { + o.showPopup(true,com_fancyfish_faeng_common_Lang.getText("common","dodged")); + } + com_davidmaletz_mining_world_Object.playObject(this.tree,"miss"); + } + ,getElement: function() { + return this.tree.getDefenseElement(); + } + ,getAttackTarget: function(a) { + var r = a.range + this.tree._width; + var b = this.tree.getClosest(r,1,false,$bind(this,this.canAttack),a.type == "breath" ? r >> 1 : 0); + if(b == null || b.object == null) { + b = this.tree.getClosest(r,-1,false,$bind(this,this.canAttack),a.type == "breath" ? r >> 1 : 0); + } + if(b == null || this.getXDistance(b.bounds) > a.range) { + return null; + } else { + return b.object; + } + } + ,isOwner: function() { + if(this.tree.area != null) { + return this.tree.area.isActivePlayer(); + } else { + return false; + } + } + ,getRectangle: function() { + return this.tree.getBounds(); + } + ,getAnim: function(id) { + var base = this.xml.exists("animation") ? this.xml.get("animation") + "." : this.xml.get("tile") + "."; + if(this.xml.exists(id + "_anim")) { + return this.xml.get(id + "_anim"); + } else { + var s = this.tree.info.id + "." + id; + if(com_davidmaletz_tiles_TileAnimation.exists(s)) { + return s; + } else { + return base + id; + } + } + } + ,advanceFrame: function(frames) { + var _gthis = this; + if(this.tree.area != null && this.tree.isGrown() && this.animation == this.getAnim("idle") && this.isOwner()) { + var handleBlocker = function(b) { + var o; + var handleBlocker1; + var handleBlocker2; + if(b != null) { + o = b.object; + handleBlocker2 = o != null; + } else { + handleBlocker2 = false; + } + if(handleBlocker2) { + handleBlocker1 = _gthis.canAttack(o); + } else { + handleBlocker1 = false; + } + if(handleBlocker1) { + _gthis.doAttack(o,0); + return true; + } else { + return false; + } + }; + var b1 = this.getClosestForAttack(); + if(!handleBlocker(b1)) { + handleBlocker(this.getClosestForAttack(-1)); + } + } + com_davidmaletz_mining_enemy_AttackRenderer.prototype.advanceFrame.call(this,frames); + } + ,canHurt: function(o) { + if(this.hasAttack()) { + return com_davidmaletz_mining_world_Projectile.canHurt(this.tree,o,1,0,0,null); + } else { + return false; + } + } + ,getClosestForAttack: function(dx) { + if(dx == null) { + dx = 1; + } + var r = this.getAttackRange(); + if(r < 0) { + return null; + } else { + return this.tree.getClosest(r + com_davidmaletz_tiles_Tile.SIZE,dx,true,this.xml.get("friendlyFire") != "false" ? $bind(this,this.canHurt) : $bind(this,this.canAttack)); + } + } + ,__class__: com_davidmaletz_mining_renderer__$TreeRenderer_TreeAttack +}); +var com_davidmaletz_mining_renderer_VehicleAreaRenderer = function(r,v) { + com_davidmaletz_lerp_LerpSpriteFL.call(this); + this.vehicle = v; + com_davidmaletz_lerp_DarkenKeyframe.setDarkness(this,0.35); + this.back = new openfl_display_Sprite(); + this.renderer = r; +}; +$hxClasses["com.davidmaletz.mining.renderer.VehicleAreaRenderer"] = com_davidmaletz_mining_renderer_VehicleAreaRenderer; +com_davidmaletz_mining_renderer_VehicleAreaRenderer.__name__ = ["com","davidmaletz","mining","renderer","VehicleAreaRenderer"]; +com_davidmaletz_mining_renderer_VehicleAreaRenderer.__super__ = com_davidmaletz_lerp_LerpSpriteFL; +com_davidmaletz_mining_renderer_VehicleAreaRenderer.prototype = $extend(com_davidmaletz_lerp_LerpSpriteFL.prototype,{ + vehicle: null + ,back: null + ,structures: null + ,oldArea: null + ,renderer: null + ,clearArea: function() { + if(this.oldArea != null) { + this.oldArea.removeEventListener("add_structure",$bind(this,this.add_structure)); + this.oldArea.removeEventListener("rem_structure",$bind(this,this.rem_structure)); + this.oldArea = null; + } + } + ,updateArea: function(e) { + this.clearArea(); + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this); + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this.back); + var varea = this.vehicle.area; + if(varea == null) { + return; + } + var scale = varea.getTileScale(); + var f = com_davidmaletz_mining_renderer_AreaRenderer.floorRenderer(varea,3,varea.getTileAnim(),scale); + com_davidmaletz_lerp_DarkenKeyframe.setDarkness(f,varea.getBackDarkness()); + this.addChild(f); + var t = varea.getWaterAnim(); + if(t != null) { + this.addChild(new com_davidmaletz_mining_renderer_WaterFloorRenderer(varea,t)); + } + this.structures = new openfl_display_Sprite(); + this.addChild(this.structures); + this.addChild(com_davidmaletz_mining_renderer_AreaRenderer.floorRenderer(varea,0,varea.getTileAnim(),scale)); + this.addChild(com_davidmaletz_mining_renderer_AreaRenderer.floorRenderer(varea,1,varea.getOreAnim(),scale)); + if(varea.showLightTiles()) { + this.addChild(new com_davidmaletz_mining_renderer_LightFloorRenderer(varea)); + } + this.updateStructures(); + this.oldArea = varea; + this.oldArea.addEventListener("add_structure",$bind(this,this.add_structure)); + this.oldArea.addEventListener("rem_structure",$bind(this,this.rem_structure)); + if(e != null) { + com_davidmaletz_mining_Main.switchBg(com_davidmaletz_mining_Main.getLocalPlayer(),this.renderer); + } + } + ,init: function(e) { + com_davidmaletz_lerp_LerpSpriteFL.prototype.init.call(this,e); + this.vehicle.addEventListener("add_to_area",$bind(this,this.updateArea)); + this.updateArea(null); + this.vehicle.addEventListener("position_changed",$bind(this,this.update)); + this.update(null); + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.enterFrame)); + this.enterFrame(null); + } + ,destroy: function(e) { + com_davidmaletz_lerp_LerpSpriteFL.prototype.destroy.call(this,e); + this.vehicle.removeEventListener("add_to_area",$bind(this,this.updateArea)); + this.vehicle.removeEventListener("position_changed",$bind(this,this.update)); + this.clearArea(); + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.enterFrame)); + } + ,update: function(e) { + var i = this.vehicle.getRideableInfo(); + this.set_x(this.back.set_x(i.interior.offsetX - this.vehicle.xPos)); + this.set_y(this.back.set_y(i.interior.offsetY - this.vehicle.yTop())); + } + ,updateStructures: function() { + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this.back); + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this.structures); + var area = this.vehicle.area; + if(area != null) { + var s = area.getStructures(); + while(s.hasNext()) { + var s1 = s.next(); + this.addStructure(s1); + } + } + } + ,add_structure: function(e) { + this.addStructure(e.value); + } + ,rem_structure: function(e) { + var s = js_Boot.__cast(e.value , com_davidmaletz_mining_structure_Structure); + var r = s.__backRenderer; + if(r != null && (r.parent == this.structures || r.parent == this.back)) { + r.parent.removeChild(r); + s.__backRenderer = null; + } + } + ,addStructure: function(structure) { + if(structure.__backRenderer != null) { + com_davidmaletz_faengfl_FaengFL.remove(structure.__backRenderer); + } + structure.__backRenderer = com_davidmaletz_mining_ui_MapWindow.addStructure(this.structures,this.back,structure,false); + } + ,enterFrame: function(e) { + var area = this.oldArea; + var point = com_davidmaletz_mining_renderer_AreaRenderer.point; + if(this.stage == null || area == null) { + return; + } + var PAD = com_davidmaletz_tiles_Tile.SIZE * 3; + point.setTo(0,0); + var st = this.globalToLocal(point); + var sx = st.x - PAD; + var sy = st.y - PAD; + point.setTo(this.stage.stageWidth,this.stage.stageHeight); + var end = this.globalToLocal(point); + var ex = end.x + PAD; + var ey = end.y + PAD; + com_davidmaletz_mining_world_Object.rectangle.setTo(sx,sy,ex - sx,ey - sy); + var ct = 0; + var o = area.getStructures(); + while(o.hasNext()) { + var o1 = o.next(); + var r = o1.__backRenderer; + if(r != null) { + r.set_visible(false); + } + } + area.structures.getObjects(com_davidmaletz_mining_world_Object.rectangle,function(o2,rect) { + var r1 = o2.__backRenderer; + if(r1 != null) { + r1.set_visible(true); + com_davidmaletz_mining_renderer_AreaRenderer.updateLoop(r1,area); + ct += 1; + } + return false; + }); + } + ,__class__: com_davidmaletz_mining_renderer_VehicleAreaRenderer +}); +var com_davidmaletz_mining_renderer_WaterBlockRenderer = function(m,t) { + com_davidmaletz_mining_renderer_AnimatedFloorRenderer.call(this,m,2,t,null); +}; +$hxClasses["com.davidmaletz.mining.renderer.WaterBlockRenderer"] = com_davidmaletz_mining_renderer_WaterBlockRenderer; +com_davidmaletz_mining_renderer_WaterBlockRenderer.__name__ = ["com","davidmaletz","mining","renderer","WaterBlockRenderer"]; +com_davidmaletz_mining_renderer_WaterBlockRenderer.__super__ = com_davidmaletz_mining_renderer_AnimatedFloorRenderer; +com_davidmaletz_mining_renderer_WaterBlockRenderer.prototype = $extend(com_davidmaletz_mining_renderer_AnimatedFloorRenderer.prototype,{ + createChunk: function(cx,cy) { + return new com_davidmaletz_mining_renderer__$WaterBlockRenderer_WaterBlockChunk(this.map,cx,cy,this.layer,this.getNeighbors,this.animation,this.scale); + } + ,__class__: com_davidmaletz_mining_renderer_WaterBlockRenderer +}); +var com_davidmaletz_mining_renderer__$WaterBlockRenderer_WaterBlockChunk = function(map,cx,cy,l,neighbors,anim,s) { + this.area = js_Boot.__cast(map , com_davidmaletz_mining_world_Area); + this.t = this.area.getWaterBlock(); + com_davidmaletz_mining_renderer_AnimatedChunk.call(this,map,cx,cy,l,neighbors,anim,s); +}; +$hxClasses["com.davidmaletz.mining.renderer._WaterBlockRenderer.WaterBlockChunk"] = com_davidmaletz_mining_renderer__$WaterBlockRenderer_WaterBlockChunk; +com_davidmaletz_mining_renderer__$WaterBlockRenderer_WaterBlockChunk.__name__ = ["com","davidmaletz","mining","renderer","_WaterBlockRenderer","WaterBlockChunk"]; +com_davidmaletz_mining_renderer__$WaterBlockRenderer_WaterBlockChunk.__super__ = com_davidmaletz_mining_renderer_AnimatedChunk; +com_davidmaletz_mining_renderer__$WaterBlockRenderer_WaterBlockChunk.prototype = $extend(com_davidmaletz_mining_renderer_AnimatedChunk.prototype,{ + area: null + ,t: null + ,getTile: function(x,y,l) { + if(this.area.hasFlags(x,y,8)) { + return this.t; + } else { + return null; + } + } + ,__class__: com_davidmaletz_mining_renderer__$WaterBlockRenderer_WaterBlockChunk +}); +var com_davidmaletz_mining_renderer_WaterFloorRenderer = function(m,t) { + com_davidmaletz_mining_renderer_AnimatedFloorRenderer.call(this,m,2,t,com_davidmaletz_mining_renderer_WaterFloorRenderer.isWater); +}; +$hxClasses["com.davidmaletz.mining.renderer.WaterFloorRenderer"] = com_davidmaletz_mining_renderer_WaterFloorRenderer; +com_davidmaletz_mining_renderer_WaterFloorRenderer.__name__ = ["com","davidmaletz","mining","renderer","WaterFloorRenderer"]; +com_davidmaletz_mining_renderer_WaterFloorRenderer.isWater = function(self,x,y,layer,map,data) { + var a = js_Boot.__cast(map , com_davidmaletz_mining_world_Area); + var a1 = a; + var w = a.hasFlags(x,y,4); + return com_davidmaletz_tiles_Neighbors.getFunc(self,data,x,y,layer,function(a2,a3,x1,y1,a4) { + return com_davidmaletz_mining_renderer_WaterFloorRenderer.checkWater(a1,w,a2,a3,x1,y1,a4); + }); +}; +com_davidmaletz_mining_renderer_WaterFloorRenderer.checkWater = function(area,w,self,data,x,y,layer) { + return area.isWater(x,y) == w; +}; +com_davidmaletz_mining_renderer_WaterFloorRenderer.__super__ = com_davidmaletz_mining_renderer_AnimatedFloorRenderer; +com_davidmaletz_mining_renderer_WaterFloorRenderer.prototype = $extend(com_davidmaletz_mining_renderer_AnimatedFloorRenderer.prototype,{ + createChunk: function(cx,cy) { + return new com_davidmaletz_mining_renderer__$WaterFloorRenderer_WaterChunk(this.map,cx,cy,this.layer,this.getNeighbors,this.animation,this.scale); + } + ,__class__: com_davidmaletz_mining_renderer_WaterFloorRenderer +}); +var com_davidmaletz_mining_renderer__$WaterFloorRenderer_WaterChunk = function(map,cx,cy,l,neighbors,anim,s) { + this.area = js_Boot.__cast(map , com_davidmaletz_mining_world_Area); + this.t = this.area.getWaterTile(); + this.alt = this.area.getWaterAltTile(); + com_davidmaletz_mining_renderer_AnimatedChunk.call(this,map,cx,cy,l,neighbors,anim,s); +}; +$hxClasses["com.davidmaletz.mining.renderer._WaterFloorRenderer.WaterChunk"] = com_davidmaletz_mining_renderer__$WaterFloorRenderer_WaterChunk; +com_davidmaletz_mining_renderer__$WaterFloorRenderer_WaterChunk.__name__ = ["com","davidmaletz","mining","renderer","_WaterFloorRenderer","WaterChunk"]; +com_davidmaletz_mining_renderer__$WaterFloorRenderer_WaterChunk.__super__ = com_davidmaletz_mining_renderer_AnimatedChunk; +com_davidmaletz_mining_renderer__$WaterFloorRenderer_WaterChunk.prototype = $extend(com_davidmaletz_mining_renderer_AnimatedChunk.prototype,{ + area: null + ,t: null + ,alt: null + ,getTile: function(x,y,l) { + if(this.area.hasFlags(x,y,4)) { + if(this.area.hasFlags(x,y,128)) { + return this.t; + } else { + return this.alt; + } + } else { + return null; + } + } + ,__class__: com_davidmaletz_mining_renderer__$WaterFloorRenderer_WaterChunk +}); +var com_davidmaletz_mining_renderer_WaterRenderer = function(area,imgstr,max_depth,color,y) { + com_davidmaletz_mining_renderer_ParallaxLayer.call(this,area,1,0,1,null,max_depth); + var water = new openfl_display_Sprite(); + var ps = com_davidmaletz_mining_Main.PSCALE; + var b = imgstr == null ? null : openfl_Assets.getBitmapData(imgstr); + var g = water.get_graphics(); + var ht = b == null ? 0 : b.height; + g.beginFill(color); + g.drawRect(-256 * ps,ht,256 * ps * 2,144 * ps); + g.endFill(); + if(b != null) { + var s = new openfl_display_Sprite(); + g = s.get_graphics(); + g.beginBitmapFill(b,null,true); + g.drawRect(-256 * ps,0,256 * ps * 2,b.height); + g.endFill(); + water.addChild(s); + } + water.set_y(y); + this.layer = water; + this.addChild(water); + this._width = 256 * ps; + this._height = ht; +}; +$hxClasses["com.davidmaletz.mining.renderer.WaterRenderer"] = com_davidmaletz_mining_renderer_WaterRenderer; +com_davidmaletz_mining_renderer_WaterRenderer.__name__ = ["com","davidmaletz","mining","renderer","WaterRenderer"]; +com_davidmaletz_mining_renderer_WaterRenderer.__super__ = com_davidmaletz_mining_renderer_ParallaxLayer; +com_davidmaletz_mining_renderer_WaterRenderer.prototype = $extend(com_davidmaletz_mining_renderer_ParallaxLayer.prototype,{ + enter_frame: function(e) { + com_davidmaletz_mining_renderer_ParallaxLayer.prototype.enter_frame.call(this,e); + this.set_y(Math.max(this.getAreaY(),-this._height)); + } + ,__class__: com_davidmaletz_mining_renderer_WaterRenderer +}); +var com_davidmaletz_mining_renderer_Waves = function(area,imgstr,ht,speed,water) { + com_davidmaletz_mining_renderer_ParallaxLayer.call(this,area,1,0,1,null,1); + this.speed = speed; + if(com_davidmaletz_mining_renderer_Waves.cache == null) { + com_davidmaletz_mining_renderer_Waves.cache = new haxe_ds_StringMap(); + } + this.wave_height = ht; + var d = com_davidmaletz_mining_renderer_Waves.cache.get(imgstr); + var ps = com_davidmaletz_mining_Main.PSCALE; + if(d == null) { + var b = openfl_Assets.getBitmapData(imgstr); + var img = new openfl_display_BitmapData(256 * ps + Math.ceil(256 * ps / b.width) * b.width + b.width,b.height,true,0); + var r = new openfl_geom_Rectangle(0,0,b.width,b.height); + var x = 0; + while(x < img.width) { + img.copyPixels(b,r,new openfl_geom_Point(x)); + x += b.width; + } + d = new com_davidmaletz_mining_renderer__$WaterRenderer_Data(img,b.width); + com_davidmaletz_mining_renderer_Waves.cache.set(imgstr,d); + } + this.waves = new openfl_display_Bitmap(d.bitmap); + this.move = d.move; + this.waves.set_y((water == null ? 0 : water.layer.get_y()) - d.bitmap.height); + var s = new openfl_display_Sprite(); + s.addChild(this.waves); + this.layer = s; + this.addChild(s); + this._width = d.bitmap.width - 256 * ps - this.move; + this._height = 0; + this._x = 0; +}; +$hxClasses["com.davidmaletz.mining.renderer.Waves"] = com_davidmaletz_mining_renderer_Waves; +com_davidmaletz_mining_renderer_Waves.__name__ = ["com","davidmaletz","mining","renderer","Waves"]; +com_davidmaletz_mining_renderer_Waves.cache = null; +com_davidmaletz_mining_renderer_Waves.reset = function() { + com_davidmaletz_mining_renderer_Waves.cache = null; +}; +com_davidmaletz_mining_renderer_Waves.__super__ = com_davidmaletz_mining_renderer_ParallaxLayer; +com_davidmaletz_mining_renderer_Waves.prototype = $extend(com_davidmaletz_mining_renderer_ParallaxLayer.prototype,{ + waves: null + ,speed: null + ,move: null + ,_x: null + ,wave_height: null + ,init: function(e) { + com_davidmaletz_mining_renderer_ParallaxLayer.prototype.init.call(this,null); + } + ,enter_frame: function(e) { + if(this.getAreaY() < -this.waves.get_y() - com_davidmaletz_tiles_Tile.SIZE) { + this.set_visible(false); + return; + } else { + this.set_visible(true); + } + com_davidmaletz_mining_renderer_ParallaxLayer.prototype.enter_frame.call(this,e); + this.set_y(this.getAreaY()); + this._x += this.speed * com_davidmaletz_faengfl_FaengFL.frameTime; + if(this._x > this.move) { + this._x -= this.move; + } + this.waves.set_x(Math.round(this._x) - this._width - this.move); + } + ,getWaveHeight: function(x,mid) { + var ret = -Math.abs(com_fancyfish_faeng_common_Utils.mod(this.get_x() + this.waves.get_x() - x,this.move) - this.move * 0.5) * 2 * this.wave_height / this.move; + if(mid) { + ret += this.wave_height * 0.5; + } + return ret; + } + ,__class__: com_davidmaletz_mining_renderer_Waves +}); +var com_davidmaletz_mining_renderer__$WaterRenderer_Data = function(b,m) { + this.bitmap = b; + this.move = m; +}; +$hxClasses["com.davidmaletz.mining.renderer._WaterRenderer.Data"] = com_davidmaletz_mining_renderer__$WaterRenderer_Data; +com_davidmaletz_mining_renderer__$WaterRenderer_Data.__name__ = ["com","davidmaletz","mining","renderer","_WaterRenderer","Data"]; +com_davidmaletz_mining_renderer__$WaterRenderer_Data.prototype = { + bitmap: null + ,move: null + ,__class__: com_davidmaletz_mining_renderer__$WaterRenderer_Data +}; +var com_davidmaletz_mining_structure_CompoundStructure = function(xml) { + this.ids = []; + this.offsets = []; + var e = xml.elementsNamed("structure"); + while(e.hasNext()) { + var e1 = e.next(); + this.ids.push(e1.get("id")); + this.offsets.push(Math.round(com_davidmaletz_mining_Main.parseFloat(e1.get("x")) * com_davidmaletz_tiles_Tile.SIZE)); + } +}; +$hxClasses["com.davidmaletz.mining.structure.CompoundStructure"] = com_davidmaletz_mining_structure_CompoundStructure; +com_davidmaletz_mining_structure_CompoundStructure.__name__ = ["com","davidmaletz","mining","structure","CompoundStructure"]; +com_davidmaletz_mining_structure_CompoundStructure.__interfaces__ = [com_davidmaletz_mining_structure_Buildable]; +com_davidmaletz_mining_structure_CompoundStructure.prototype = { + ids: null + ,offsets: null + ,build: function(p,area,x,y,xml,vars) { + var len = this.ids.length; + var ret = null; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + ret = com_davidmaletz_mining_structure_StructureInfo.get(this.ids[i]).build(p,area,x + this.offsets[i],y,xml,vars); + } + return ret; + } + ,load: function(b,version,x,y,addStructure,parent) { + var len = this.ids.length; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + com_davidmaletz_mining_structure_StructureInfo.get(this.ids[i]).load(i == 0 ? b : null,version,x + this.offsets[i],y,addStructure,this); + } + } + ,__class__: com_davidmaletz_mining_structure_CompoundStructure +}; +var com_davidmaletz_mining_structure_Crafting = function(info,x,y) { + com_davidmaletz_mining_structure_Structure.call(this,info,x,y); +}; +$hxClasses["com.davidmaletz.mining.structure.Crafting"] = com_davidmaletz_mining_structure_Crafting; +com_davidmaletz_mining_structure_Crafting.__name__ = ["com","davidmaletz","mining","structure","Crafting"]; +com_davidmaletz_mining_structure_Crafting.__super__ = com_davidmaletz_mining_structure_Structure; +com_davidmaletz_mining_structure_Crafting.prototype = $extend(com_davidmaletz_mining_structure_Structure.prototype,{ + onOperate: function(p) { + com_davidmaletz_mining_structure_Structure.prototype.onOperate.call(this,p); + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(this.makeWindow(com_davidmaletz_mining_ui_CraftingWindow.make(this.getTitle(p),p.getInv(true),c,p,this.info.xml,this),p),2); + } + ,__class__: com_davidmaletz_mining_structure_Crafting +}); +var com_davidmaletz_mining_structure_Dialogue = function(info,x,y) { + com_davidmaletz_mining_structure_Structure.call(this,info,x,y); +}; +$hxClasses["com.davidmaletz.mining.structure.Dialogue"] = com_davidmaletz_mining_structure_Dialogue; +com_davidmaletz_mining_structure_Dialogue.__name__ = ["com","davidmaletz","mining","structure","Dialogue"]; +com_davidmaletz_mining_structure_Dialogue.__super__ = com_davidmaletz_mining_structure_Structure; +com_davidmaletz_mining_structure_Dialogue.prototype = $extend(com_davidmaletz_mining_structure_Structure.prototype,{ + title: null + ,loadXML: function(xml,vars) { + this.set_title(com_davidmaletz_mining_npc_NPCEventHandler.evalString(xml.get("dialogue"),vars)); + } + ,isRead: function(p) { + return p.getFlag(this.title + ".read"); + } + ,onOperate: function(p) { + var _gthis = this; + var c = com_davidmaletz_mining_Main.getContainer(); + var m = com_fancyfish_faeng_common_Lang.getTextFromTitle(this.title); + if(this.info.xml.exists("achievement")) { + com_davidmaletz_faengfl_achievement_Achievements.instance.gainAchievement(this.info.xml.get("achievement")); + } + if(this.title != null || m != null) { + p.setFlag(this.title + ".read",true); + c.addDisplay(new com_davidmaletz_mining_ui_DialogueBox(c,m == null ? this.title : m.get(),function() { + _gthis.runEvent("afterRead",p); + }),2); + } + } + ,upgradeFrom: function(s) { + com_davidmaletz_mining_structure_Structure.prototype.upgradeFrom.call(this,s); + if(Std["is"](s,com_davidmaletz_mining_structure_Dialogue)) { + var d = js_Boot.__cast(s , com_davidmaletz_mining_structure_Dialogue); + this.set_title(d.title); + } + } + ,write: function(b) { + com_davidmaletz_mining_structure_Structure.prototype.write.call(this,b); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.title); + } + ,read: function(b,version,parent) { + com_davidmaletz_mining_structure_Structure.prototype.read.call(this,b,version,parent); + this.set_title(com_fancyfish_faeng_common_UTFUtils.readUTF(b)); + } + ,set_title: function(n) { + if(n != this.title) { + this.title = n; + this.dispatchEvent(new openfl_events_Event("update_title")); + } + return n; + } + ,__class__: com_davidmaletz_mining_structure_Dialogue + ,__properties__: $extend(com_davidmaletz_mining_structure_Structure.prototype.__properties__,{set_title:"set_title"}) +}); +var com_davidmaletz_mining_structure_Dock = function(info,x,y) { + com_davidmaletz_mining_structure_Structure.call(this,info,x,y); +}; +$hxClasses["com.davidmaletz.mining.structure.Dock"] = com_davidmaletz_mining_structure_Dock; +com_davidmaletz_mining_structure_Dock.__name__ = ["com","davidmaletz","mining","structure","Dock"]; +com_davidmaletz_mining_structure_Dock.__super__ = com_davidmaletz_mining_structure_Structure; +com_davidmaletz_mining_structure_Dock.prototype = $extend(com_davidmaletz_mining_structure_Structure.prototype,{ + addedToArea: function(area,built) { + var _gthis = this; + com_davidmaletz_mining_structure_Structure.prototype.addedToArea.call(this,area,built); + var flip = this.info.xml.get("flip") == "true"; + var dw = com_davidmaletz_mining_Main.parseInt(this.info.xml.get("dockWidth")); + var dtw = this.info.xml.exists("dockTopWidth") ? com_davidmaletz_mining_Main.parseInt(this.info.xml.get("dockTopWidth")) : dw; + var dh = com_davidmaletz_mining_Main.parseInt(this.info.xml.get("dockHeight")); + if(built) { + var ar = []; + area.getObjects(this.getBounds(),function(o,b) { + if(o.yTile > _gthis.yPos && Std["is"](o,com_davidmaletz_mining_world_vehicle_Vehicle)) { + ar.push(o); + } + return false; + }); + var _g = 0; + while(_g < ar.length) { + var o1 = ar[_g]; + ++_g; + o1.setPosition(flip ? (this.get_tile_x() + com_fancyfish_faeng_common_Utils.max(dtw,dw)) * com_davidmaletz_tiles_Tile.SIZE : this.xPos - o1._width,o1.yTile); + } + } + var empty = area.addTileIndex("empty"); + var tx = this.get_tile_x(); + var ty = this.get_tile_y() + 1; + var sx = flip ? 0 : dw - dtw; + var _g1 = 0; + var _g2 = dtw; + while(_g1 < _g2) { + var x = _g1++; + area.setTile(tx + x + sx,ty,0,empty); + } + var _g11 = 1; + var _g3 = dh; + while(_g11 < _g3) { + var y = _g11++; + var _g31 = 0; + var _g21 = dw; + while(_g31 < _g21) { + var x1 = _g31++; + area.setTile(tx + x1,ty + y,0,empty); + } + } + } + ,removedFromArea: function(area) { + com_davidmaletz_mining_structure_Structure.prototype.removedFromArea.call(this,area); + var flip = this.info.xml.get("flip") == "true"; + var dw = com_davidmaletz_mining_Main.parseInt(this.info.xml.get("dockWidth")); + var dtw = this.info.xml.exists("dockTopWidth") ? com_davidmaletz_mining_Main.parseInt(this.info.xml.get("dockTopWidth")) : dw; + var dh = com_davidmaletz_mining_Main.parseInt(this.info.xml.get("dockHeight")); + var tx = this.get_tile_x(); + var ty = this.get_tile_y() + 1; + var sx = flip ? 0 : dw - dtw; + var _g1 = 0; + var _g = dtw; + while(_g1 < _g) { + var x = _g1++; + area.setTile(tx + x + sx,ty,0,-1); + } + var _g11 = 1; + var _g2 = dh; + while(_g11 < _g2) { + var y = _g11++; + var _g3 = 0; + var _g21 = dw; + while(_g3 < _g21) { + var x1 = _g3++; + area.setTile(tx + x1,ty + y,0,-1); + } + } + } + ,getInnerBounds: function(fullHeight) { + if(fullHeight == null) { + fullHeight = true; + } + com_davidmaletz_mining_world_BaseObject.rectangle.setTo(this.xPos,this.yPos - this.info.height + this.info.offsetY,this.info.width,this.info.height + com_davidmaletz_tiles_Tile.SIZE); + return com_davidmaletz_mining_world_BaseObject.rectangle; + } + ,__class__: com_davidmaletz_mining_structure_Dock +}); +var com_davidmaletz_mining_structure_Door = function(info,x,y) { + this.allowReturn = false; + com_davidmaletz_mining_structure_Structure.call(this,info,x,y); +}; +$hxClasses["com.davidmaletz.mining.structure.Door"] = com_davidmaletz_mining_structure_Door; +com_davidmaletz_mining_structure_Door.__name__ = ["com","davidmaletz","mining","structure","Door"]; +com_davidmaletz_mining_structure_Door.__super__ = com_davidmaletz_mining_structure_Structure; +com_davidmaletz_mining_structure_Door.prototype = $extend(com_davidmaletz_mining_structure_Structure.prototype,{ + area_id: null + ,x: null + ,y: null + ,allowReturn: null + ,loadXML: function(xml,vars) { + var i = xml.elementsNamed("teleport"); + if(i.hasNext()) { + this.parseTeleport(i.next()); + } + this.checkReturn(); + } + ,set_area_id: function(s) { + if(s != this.area_id) { + this.area_id = s; + this.dispatchEvent(new openfl_events_Event("update_location")); + } + return s; + } + ,set_x: function(s) { + if(s != this.x) { + this.x = s; + this.dispatchEvent(new openfl_events_Event("update_location")); + } + return s; + } + ,set_y: function(s) { + if(s != this.y) { + this.y = s; + this.dispatchEvent(new openfl_events_Event("update_location")); + } + return s; + } + ,set_allowReturn: function(s) { + if(s != this.allowReturn) { + this.allowReturn = s; + this.dispatchEvent(new openfl_events_Event("update_location")); + } + return s; + } + ,checkReturn: function() { + if(this.info.xml.get("allowReturn") == "false") { + this.set_allowReturn(false); + if(this.area_id == null) { + var i = this.info.xml.elementsNamed("return"); + if(i.hasNext()) { + this.parseTeleport(i.next()); + } + } + } + } + ,parseTeleport: function(e) { + this.set_area_id(e.get("area")); + this.set_x(Math.round(com_davidmaletz_mining_Main.parseFloat(e.get("x")) * com_davidmaletz_tiles_Tile.SIZE)); + this.set_y(Math.round((e.exists("y") ? com_davidmaletz_mining_Main.parseFloat(e.get("y")) : -1) * com_davidmaletz_tiles_Tile.SIZE)); + this.set_allowReturn(e.get("allowReturn") == "true" && this.info.xml.get("allowReturn") != "false"); + } + ,teleport: function(p) { + if(this.area_id == null) { + p.returnTeleport(); + } else { + p.doTeleport(this.area_id,this.x,this.y,this.allowReturn); + } + this.runEvent("afterTeleport",p); + } + ,onOperate: function(p) { + var f = $bind(this,this.teleport); + var p1 = p; + new com_davidmaletz_faengfl_transition_EllipseFade(function() { + f(p1); + },60,0,p.cameraCentered() ? 0 : 72. - com_davidmaletz_tiles_Tile.SIZE * 1.5); + } + ,upgradeFrom: function(s) { + com_davidmaletz_mining_structure_Structure.prototype.upgradeFrom.call(this,s); + if(Std["is"](s,com_davidmaletz_mining_structure_Door)) { + var d = js_Boot.__cast(s , com_davidmaletz_mining_structure_Door); + this.set_area_id(d.area_id); + this.set_x(d.x); + this.set_y(d.y); + this.set_allowReturn(d.allowReturn); + } + } + ,write: function(b) { + com_davidmaletz_mining_structure_Structure.prototype.write.call(this,b); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.area_id); + if(this.area_id != null) { + b.writeInt32(this.x); + b.writeInt32(this.y); + var flags = 0; + if(!this.allowReturn) { + flags |= 2; + } + b.writeByte(flags); + } + } + ,read: function(b,version,parent) { + com_davidmaletz_mining_structure_Structure.prototype.read.call(this,b,version,parent); + this.set_area_id(com_fancyfish_faeng_common_UTFUtils.readUTF(b)); + if(this.area_id != null) { + this.set_x(b.readInt32()); + this.set_y(b.readInt32()); + var flags = b.readByte(); + this.set_allowReturn((flags & 2) == 0); + } + this.checkReturn(); + } + ,__class__: com_davidmaletz_mining_structure_Door + ,__properties__: $extend(com_davidmaletz_mining_structure_Structure.prototype.__properties__,{set_allowReturn:"set_allowReturn",set_y:"set_y",set_x:"set_x",set_area_id:"set_area_id"}) +}); +var com_davidmaletz_mining_structure_Elevator = function(info,x,y) { + com_davidmaletz_mining_structure_Structure.call(this,info,x,y); + this.elevator_dy = 0; + this.speed = info.xml.exists("speed") ? com_davidmaletz_mining_Main.parseFloat(info.xml.get("speed")) : 1; + var l = info.xml.elementsNamed("lift"); + if(l.hasNext()) { + var xml = l.next(); + this.floor = xml.exists("floor") ? com_davidmaletz_mining_Main.parseInt(xml.get("floor")) : 0; + } else { + this.floor = 0; + } + var c = info.xml.elementsNamed("chain"); + if(c.hasNext()) { + this.floor += com_davidmaletz_mining_Main.parseInt(c.next().get("offsetY")); + } +}; +$hxClasses["com.davidmaletz.mining.structure.Elevator"] = com_davidmaletz_mining_structure_Elevator; +com_davidmaletz_mining_structure_Elevator.__name__ = ["com","davidmaletz","mining","structure","Elevator"]; +com_davidmaletz_mining_structure_Elevator.__super__ = com_davidmaletz_mining_structure_Structure; +com_davidmaletz_mining_structure_Elevator.prototype = $extend(com_davidmaletz_mining_structure_Structure.prototype,{ + elevator_dy: null + ,floor: null + ,speed: null + ,canOperate: function() { + if(this.info.xml.get("powered") == "true") { + return this.isPowered(); + } else { + return true; + } + } + ,getBounds: function() { + var b = com_davidmaletz_mining_structure_Structure.prototype.getBounds.call(this); + var _g = b; + _g.set_bottom(_g.get_bottom() + 1024 * com_davidmaletz_tiles_Tile.SIZE); + return b; + } + ,getHitBounds: function(allowHitbox) { + return this.getBounds(); + } + ,accessInventory: function() { + if(this.canOperate()) { + return com_davidmaletz_mining_structure_Structure.prototype.accessInventory.call(this); + } else { + return null; + } + } + ,cen_x: function() { + return Math.floor(this.getCenterX() / com_davidmaletz_tiles_Tile.SIZE); + } + ,onElevator: function(p) { + com_davidmaletz_mining_world_Object.rectangle.setTo(this.xPos,this.getRendererY() + this.elevator_dy + this.floor - com_davidmaletz_tiles_Tile.SIZE,this.info.width,com_davidmaletz_tiles_Tile.SIZE); + return com_fancyfish_faeng_pack_AABBObjectList.intersects(p.getBounds(),com_davidmaletz_mining_world_Object.rectangle,0.5); + } + ,intersects: function(r,issect) { + var b = this.getBounds(); + if(issect >= 0) { + b.x = this.cen_x() * com_davidmaletz_tiles_Tile.SIZE; + b.width = com_davidmaletz_tiles_Tile.SIZE; + } + return com_fancyfish_faeng_pack_AABBObjectList.intersects(r,b,issect); + } + ,__playSfx: function() { + var sfx = this.info.xml.get("sfx"); + if(this.sound == null && sfx != null) { + this.playSFX(sfx); + } + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_structure__$Elevator_ElevatorRenderer)).sfx_frames = 10; + } + ,consumePlayerMove: function(p,dx,dy,frames) { + if(!this.canOperate() || this.renderer == null) { + return false; + } + if(dy != 0) { + if(!this.onElevator(p) || dy < 0 && this.elevator_dy == 0) { + return false; + } + var y = this.elevator_dy + Math.round(dy * this.speed * frames); + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_structure__$Elevator_ElevatorRenderer)).clearLerp(); + if(dy > 0) { + if(p.area.getTileId(this.cen_x(),Math.floor((this.renderer.get_y() + y + this.floor - 1) / com_davidmaletz_tiles_Tile.SIZE),0) >= 0) { + return false; + } + } else if(p.area.getTileId(this.cen_x(),Math.floor((this.renderer.get_y() + y + this.floor - 1) / com_davidmaletz_tiles_Tile.SIZE) - 1,0) >= 0) { + return false; + } + this.__playSfx(); + this.setElevatorY(y,frames); + p.setPosition(this.cen_x() * com_davidmaletz_tiles_Tile.SIZE,Math.round(this.elevator_dy - com_davidmaletz_tiles_Tile.SIZE + this.renderer.get_y() + this.floor)); + return true; + } else if(dx == 0) { + return this.onElevator(p); + } else { + return false; + } + } + ,moveRemotePlayer: function(p,dx,dy) { + if(!this.canOperate() || dy == 0 || !this.onElevator(p) || dy < 0 && this.elevator_dy == 0) { + return false; + } + var ry = this.getRendererY(); + var y = Math.round(p.yTile + dy - this.floor - ry + com_davidmaletz_tiles_Tile.SIZE); + if(this.renderer != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_structure__$Elevator_ElevatorRenderer)).clearLerp(); + } + if(dy > 0) { + if(p.area.getTileId(this.cen_x(),Math.floor((ry + y + this.floor - 1) / com_davidmaletz_tiles_Tile.SIZE),0) >= 0) { + return false; + } + } else if(p.area.getTileId(this.cen_x(),Math.floor((ry + y + this.floor - 1) / com_davidmaletz_tiles_Tile.SIZE) - 1,0) >= 0) { + return false; + } + this.setElevatorY(y,com_davidmaletz_faengfl_FaengFL.frameTime); + if(this.renderer != null) { + this.__playSfx(); + } + return true; + } + ,setElevatorY: function(y,frames) { + if(y < 0) { + y = 0; + } + if(this.elevator_dy != y) { + frames *= com_fancyfish_faeng_common_Utils.sign(y - this.elevator_dy); + this.elevator_dy = y; + if(this.renderer != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_structure__$Elevator_ElevatorRenderer)).updateDy(frames); + } + } + } + ,getTooltip: function(p) { + if(this.onElevator(p)) { + return com_fancyfish_faeng_common_Lang.getText("structure","manage_storage"); + } else if(this.canCall(p)) { + return com_davidmaletz_mining_structure_Structure.prototype.getTooltip.call(this,p); + } else { + return null; + } + } + ,canCall: function(p) { + var x = this.cen_x(); + var py = p.get_tile_y(); + var _g1 = this.get_tile_y(); + var _g = py; + while(_g1 < _g) { + var y = _g1++; + if(p.area.getTileId(x,y,0) >= 0) { + return false; + } + } + return true; + } + ,callElevator: function(y) { + if(y < 0) { + y = 0; + } + var dy = com_fancyfish_faeng_common_Utils.abs(y - this.elevator_dy); + if(dy == 0) { + return; + } + var sfx = this.info.xml.get("sfx"); + if(this.sound == null && sfx != null) { + this.playSFX(sfx); + } + if(this.renderer == null) { + this.setElevatorY(y,com_davidmaletz_faengfl_FaengFL.frameTime); + } else { + var f = $bind(this,this.stopSFX); + var tmp = function() { + f(null); + }; + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_structure__$Elevator_ElevatorRenderer)).lerp(new com_davidmaletz_mining_structure_MoveKeyframe(this,y),com_fancyfish_faeng_common_Utils.min(200,Math.round(dy / this.speed)),tmp); + } + this.dispatchEvent(new com_davidmaletz_faengfl_events_IntEvent("call_elevator",y)); + } + ,_onOperate: function(p) { + this.onOperate(p); + } + ,onOperate: function(p) { + if(this.onElevator(p)) { + this.runEvent("operate",p); + } else if(this.canCall(p) && this.renderer != null) { + if(!this.canOperate()) { + com_davidmaletz_faengfl_adv_sound_Sound.play("warning"); + new com_davidmaletz_faengfl_ui_Popup(128.,52.,0,com_fancyfish_faeng_common_Lang.getText("warning","not_powered"),16720418); + return; + } + this.callElevator(Math.round(p.getBounds().get_bottom() - this.renderer.get_y() - this.floor)); + } + } + ,createRenderer: function() { + return new com_davidmaletz_mining_structure__$Elevator_ElevatorRenderer(this); + } + ,upgradeFrom: function(s) { + com_davidmaletz_mining_structure_Structure.prototype.upgradeFrom.call(this,s); + if(Std["is"](s,com_davidmaletz_mining_structure_Elevator)) { + var p = js_Boot.__cast(s , com_davidmaletz_mining_structure_Elevator); + this.elevator_dy = p.elevator_dy; + } + } + ,write: function(b) { + com_davidmaletz_mining_structure_Structure.prototype.write.call(this,b); + b.writeUInt24(this.elevator_dy); + } + ,read: function(b,version,parent) { + com_davidmaletz_mining_structure_Structure.prototype.read.call(this,b,version,parent); + this.elevator_dy = b.readUInt24(); + if(version < 63) { + this.xPos -= com_davidmaletz_tiles_Tile.SIZE; + } + } + ,__class__: com_davidmaletz_mining_structure_Elevator +}); +var com_davidmaletz_mining_structure__$Elevator_ElevatorRenderer = function(e) { + this.sfx_frames = 0; + com_davidmaletz_lerp_LerpSpriteFL.call(this); + this.elevator = e; + this.winch = new com_davidmaletz_tiles_render_TileAnimationRenderer(e.info.tile,10); + this.winch.setAnimation(e.getAnim("idle")); + this.addChild(this.winch); + var c = e.info.xml.elementPathsNamed("chain"); + if(c.hasNext()) { + var xml = c.next(); + var b = openfl_Assets.getBitmapData(com_davidmaletz_mining_Main.getResource(xml.path,xml.get("image"))); + var x = com_davidmaletz_mining_Main.parseInt(xml.get("offsetX")); + var y = com_davidmaletz_mining_Main.parseInt(xml.get("offsetY")); + this.offsetY = y; + this.chain = new com_davidmaletz_faengfl_ScissorSprite(b.width,1024 * com_davidmaletz_tiles_Tile.SIZE,this,com_davidmaletz_mining_Main.getContainer(),x,y); + this.chain.set_x(x); + this.chain.set_y(y); + this.chain.minChildren = 0; + var g = this.chain.get_graphics(); + g.beginBitmapFill(b); + var h = 1024 * com_davidmaletz_tiles_Tile.SIZE; + g.drawRect(0,-h,b.width,h); + g.endFill(); + this.addChild(this.chain); + } else { + this.offsetY = 0; + } + var l = e.info.xml.elementPathsNamed("lift"); + if(l.hasNext()) { + var xml1 = l.next(); + var t = com_davidmaletz_mining_structure_StructureInfo.createTile(xml1,xml1.getPathForAttr("image")); + if(xml1.exists("animation")) { + this.lift = new com_davidmaletz_tiles_render_PlayAnimation(t.tile,xml1.get("animation"),10,true,null,0,0); + } else { + this.lift = com_davidmaletz_mining_item_ItemInfo._createIcon(t.tile,0,0); + } + this.lift.set_x(xml1.exists("offsetX") ? com_davidmaletz_mining_Main.parseInt(xml1.get("offsetX")) : 0); + this.addChild(this.lift); + } + this.updateDy(0); +}; +$hxClasses["com.davidmaletz.mining.structure._Elevator.ElevatorRenderer"] = com_davidmaletz_mining_structure__$Elevator_ElevatorRenderer; +com_davidmaletz_mining_structure__$Elevator_ElevatorRenderer.__name__ = ["com","davidmaletz","mining","structure","_Elevator","ElevatorRenderer"]; +com_davidmaletz_mining_structure__$Elevator_ElevatorRenderer.__interfaces__ = [com_davidmaletz_faengfl_Soundable]; +com_davidmaletz_mining_structure__$Elevator_ElevatorRenderer.__super__ = com_davidmaletz_lerp_LerpSpriteFL; +com_davidmaletz_mining_structure__$Elevator_ElevatorRenderer.prototype = $extend(com_davidmaletz_lerp_LerpSpriteFL.prototype,{ + elevator: null + ,winch: null + ,chain: null + ,lift: null + ,offsetY: null + ,sfx_frames: null + ,advanceFrame: function(frames) { + com_davidmaletz_lerp_LerpSpriteFL.prototype.advanceFrame.call(this,frames); + if(this.sfx_frames <= 0 && !this.hasLerp()) { + this.elevator.stopSFX(); + } else { + this.sfx_frames -= frames; + } + } + ,updateDy: function(frames) { + if(frames != 0) { + this.winch.incFrame(frames,true); + } + if(this.chain != null) { + this.chain.set_y(this.offsetY + this.elevator.elevator_dy); + this.chain._height = this.elevator.elevator_dy; + } + if(this.lift != null) { + this.lift.set_y(this.elevator.elevator_dy + this.offsetY); + } + } + ,getSoundRange: function(vert) { + if(vert) { + return 0; + } else { + return 1; + } + } + ,__class__: com_davidmaletz_mining_structure__$Elevator_ElevatorRenderer +}); +var com_davidmaletz_mining_structure_MoveKeyframe = function(o,_y) { + if(_y == null) { + _y = 0; + } + this.obj = o; + this.y = _y; +}; +$hxClasses["com.davidmaletz.mining.structure.MoveKeyframe"] = com_davidmaletz_mining_structure_MoveKeyframe; +com_davidmaletz_mining_structure_MoveKeyframe.__name__ = ["com","davidmaletz","mining","structure","MoveKeyframe"]; +com_davidmaletz_mining_structure_MoveKeyframe.__interfaces__ = [com_davidmaletz_lerp_Keyframe]; +com_davidmaletz_mining_structure_MoveKeyframe.prototype = { + obj: null + ,frame: null + ,y: null + ,set: function(from) { + var k = js_Boot.__cast(from , com_davidmaletz_mining_structure_MoveKeyframe); + this.obj = k.obj; + this.y = k.y; + } + ,setFromObject: function(a) { + this.y = this.obj.elevator_dy; + } + ,getFrame: function() { + return this.frame; + } + ,setFrame: function(f) { + this.frame = f; + } + ,interp: function(track,other,f) { + var k = js_Boot.__cast(other , com_davidmaletz_mining_structure_MoveKeyframe); + return new com_davidmaletz_mining_structure_MoveKeyframe(this.obj,Math.round(track.interp(this.y,k.y,f))); + } + ,apply: function(a) { + if(this.obj.canOperate()) { + this.obj.setElevatorY(this.y,com_davidmaletz_faengfl_FaengFL.frameTime); + com_davidmaletz_mining_Main.getLocalPlayer().overlapChanged(); + } + } + ,__class__: com_davidmaletz_mining_structure_MoveKeyframe +}; +var com_davidmaletz_mining_structure_SlotList = function() { }; +$hxClasses["com.davidmaletz.mining.structure.SlotList"] = com_davidmaletz_mining_structure_SlotList; +com_davidmaletz_mining_structure_SlotList.__name__ = ["com","davidmaletz","mining","structure","SlotList"]; +var com_davidmaletz_mining_structure_Enchant = function(info,x,y) { + com_davidmaletz_mining_structure_Structure.call(this,info,x,y); + this.slots = []; + var len = com_davidmaletz_mining_Main.parseInt(info.xml.get("slots")) + 1; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + this.slots.push(new com_davidmaletz_mining_structure_Slot()); + } + this.slot_items = new haxe_ds_StringMap(); + var e = info.xml.elementsNamed("item"); + while(e.hasNext()) { + var e1 = e.next(); + this.slot_items.set(e1.get("id"),true); + } +}; +$hxClasses["com.davidmaletz.mining.structure.Enchant"] = com_davidmaletz_mining_structure_Enchant; +com_davidmaletz_mining_structure_Enchant.__name__ = ["com","davidmaletz","mining","structure","Enchant"]; +com_davidmaletz_mining_structure_Enchant.__interfaces__ = [com_davidmaletz_mining_structure_SlotList]; +com_davidmaletz_mining_structure_Enchant.__super__ = com_davidmaletz_mining_structure_Structure; +com_davidmaletz_mining_structure_Enchant.prototype = $extend(com_davidmaletz_mining_structure_Structure.prototype,{ + slots: null + ,slot_items: null + ,getSlot: function(i) { + if(i < this.slots.length) { + return this.slots[i]; + } else { + return null; + } + } + ,onOperate: function(p) { + com_davidmaletz_mining_structure_Structure.prototype.onOperate.call(this,p); + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(this.makeWindow(new com_davidmaletz_mining_ui_EnchantWindow(p.getInv(true),c,p,this),p),2); + } + ,slotCreates: function(p) { + var map = new haxe_ds_StringMap(); + var ct = 0; + var _g = 0; + var _g1 = this.slots; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + var i = s.getItem(p); + if(i != null) { + var old = map.get(i.info.id); + map.set(i.info.id,old == null ? 1 : old + 1); + if(old == null) { + ++ct; + } + } + } + var r = com_davidmaletz_mining_ui_CraftingWindow.getRecipes(p,this.info.xml,"enchant"); + while(r.hasNext()) { + var r1 = r.next(); + var rct = 0; + var req = r1.getItemRequirements(); + while(req.hasNext()) { + var req1 = req.next(); + if(map.get(req1.item.id) == req1.count) { + ++rct; + } else { + rct = -1; + break; + } + } + if(rct == ct) { + return r1; + } + } + return null; + } + ,craft: function(p,r) { + var i = this.slots[0].getItem(p); + if(r.achievement != null) { + com_davidmaletz_faengfl_achievement_Achievements.instance.gainAchievement(r.achievement); + } + var _g = 0; + var _g1 = this.slots; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + s._setItem(null); + } + p.addItems(r.creates.item,r.creates.count,r.creates.value,r.creates.name); + p.addExp(2); + } + ,addRecipe: function(r) { + return com_davidmaletz_mining_Main.getLocalState().addRecipe(this.getRecipeId(),r); + } + ,setFirstRecipe: function(r) { + var i = this.iterator(); + if(i.hasNext() && i.next() == r) { + return false; + } + com_davidmaletz_mining_Main.getLocalState().addRecipe(this.getRecipeId(),r); + com_davidmaletz_mining_Main.getLocalState().setFirstRecipe(this.getRecipeId(),r); + return true; + } + ,upgradeFrom: function(s) { + com_davidmaletz_mining_structure_Structure.prototype.upgradeFrom.call(this,s); + if(Std["is"](s,com_davidmaletz_mining_structure_Enchant)) { + var p = js_Boot.__cast(s , com_davidmaletz_mining_structure_Enchant); + var len = com_fancyfish_faeng_common_Utils.min(this.slots.length,p.slots.length); + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + this.slots[i]._setItem(p.slots[i].getItem(null)); + } + } + } + ,onDismantle: function(p) { + com_davidmaletz_mining_structure_Structure.prototype.onDismantle.call(this,p); + var _g = 0; + var _g1 = this.slots; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + s.setItem(p,null); + } + } + ,filterSlot: function(i) { + if(i != null) { + return this.slot_items.exists(i.id); + } else { + return true; + } + } + ,write: function(b) { + com_davidmaletz_mining_structure_Structure.prototype.write.call(this,b); + b.writeByte(this.slots.length); + var _g = 0; + var _g1 = this.slots; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + com_davidmaletz_mining_item_Item.write(b,s.getItem(null)); + } + } + ,read: function(b,version,parent) { + com_davidmaletz_mining_structure_Structure.prototype.read.call(this,b,version,parent); + var len = b.readByte() & 255; + var r; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + var s = com_davidmaletz_mining_item_Item.read(b,version); + if(i < this.slots.length) { + this.slots[i]._setItem(s); + } + } + if(version < 66) { + while(true) { + r = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(!(r != null)) { + break; + } + var _r = com_davidmaletz_mining_item_Recipe.get(r); + if(_r != null) { + this.addRecipe(_r); + } + } + } + } + ,getRecipeId: function() { + if(this.info.xml.exists("recipeList")) { + return this.info.xml.get("recipeList"); + } else { + return this.info.id; + } + } + ,iterator: function() { + return com_davidmaletz_mining_Main.getLocalState().getRecipes(this.getRecipeId()); + } + ,__class__: com_davidmaletz_mining_structure_Enchant +}); +var com_davidmaletz_mining_structure_Slot = function() { + openfl_events_EventDispatcher.call(this); + this.item = null; +}; +$hxClasses["com.davidmaletz.mining.structure.Slot"] = com_davidmaletz_mining_structure_Slot; +com_davidmaletz_mining_structure_Slot.__name__ = ["com","davidmaletz","mining","structure","Slot"]; +com_davidmaletz_mining_structure_Slot.__interfaces__ = [com_davidmaletz_mining_item_ItemValue]; +com_davidmaletz_mining_structure_Slot.__super__ = openfl_events_EventDispatcher; +com_davidmaletz_mining_structure_Slot.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + item: null + ,setName: function(p,n) { + if(this.item != null) { + this.item.setName(n); + } + } + ,increaseValue: function(p,dv) { + if(this.item != null) { + var v = this.item.value + dv; + var d = this.item.getDurability(); + if(v < 0) { + v = 0; + } else if(v > d) { + v = d; + } + this.item.setValue(v); + } + } + ,remove: function(p) { + this.setItem(p,null); + } + ,getItem: function(p) { + return this.item; + } + ,setItem: function(p,i) { + if(this.item != null) { + p.inventory.addItems(this.item.info,1,this.item.value,this.item.getNameStr()); + this.item = null; + } + if(i != null && i.count > 0) { + i.inventory.addItems(i.item,-1,i.value,i.name); + this.item = new com_davidmaletz_mining_item_Item(i.item,i.value,i.name); + } + this.dispatchEvent(new openfl_events_Event("updated")); + } + ,_setItem: function(i) { + if(this.item != i) { + this.item = i; + this.dispatchEvent(new openfl_events_Event("updated")); + } + } + ,__class__: com_davidmaletz_mining_structure_Slot +}); +var com_davidmaletz_mining_structure_EnchantRecipe = function(info,x,y) { + com_davidmaletz_mining_structure_Structure.call(this,info,x,y); +}; +$hxClasses["com.davidmaletz.mining.structure.EnchantRecipe"] = com_davidmaletz_mining_structure_EnchantRecipe; +com_davidmaletz_mining_structure_EnchantRecipe.__name__ = ["com","davidmaletz","mining","structure","EnchantRecipe"]; +com_davidmaletz_mining_structure_EnchantRecipe._addRecipe = function(p,recipe,addRecipe,message) { + if(p.area == null || recipe == null) { + return 0; + } + var txt = com_fancyfish_faeng_common_Lang.getTextFromTitle(message); + if(txt == null) { + addRecipe(p); + } else { + var t = txt.get(); + t = StringTools.replace(t,"{enchant}",recipe.getFirstRequirement().getDisplay(null,false)); + t = StringTools.replace(t,"{creates}",recipe.creates.item.getDisplay(null,false)); + var b = new StringBuf(); + var first = true; + var r = recipe.getItemRequirements(); + while(r.hasNext()) { + var r1 = r.next(); + var ct = r1.count; + if(first) { + --ct; + first = false; + } + var _g1 = 0; + var _g = ct; + while(_g1 < _g) { + var i = _g1++; + b.add(com_davidmaletz_mining_item_Item.getIconDisplay(r1.item,null)); + } + } + t = StringTools.replace(t,"{items}",b.toString()); + var c = com_davidmaletz_mining_Main.getContainer(); + var f = addRecipe; + var a1 = p; + var wnd = new com_davidmaletz_mining_ui_DialogueBox(c,t,function() { + f(a1); + }); + c.addDisplay(wnd,3); + } + return 3; +}; +com_davidmaletz_mining_structure_EnchantRecipe.__super__ = com_davidmaletz_mining_structure_Structure; +com_davidmaletz_mining_structure_EnchantRecipe.prototype = $extend(com_davidmaletz_mining_structure_Structure.prototype,{ + recipe: null + ,loadXML: function(xml,vars) { + var r = vars == null ? null : com_davidmaletz_mining_npc_NPCEventHandler.evalString(xml.get("recipe"),vars); + if(!com_davidmaletz_mining_item_Recipe.exists(r)) { + r = xml.get("recipe"); + } + this.set_recipe(com_davidmaletz_mining_item_Recipe.get(r)); + } + ,addRecipe: function(p) { + if(this.info.xml.exists("addTo")) { + var vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(p); + vars.set("this",this); + var s = com_davidmaletz_mining_npc_NPCEventHandler.evalString(this.info.xml.get("addTo"),vars); + if(s != null) { + if(p.state.addRecipe(s,this.recipe)) { + this.runEvent("addRecipe",p); + } + } + } + } + ,onOperate: function(p) { + com_davidmaletz_mining_structure_EnchantRecipe._addRecipe(p,this.recipe,$bind(this,this.addRecipe),this.info.xml.get("message")); + } + ,upgradeFrom: function(s) { + com_davidmaletz_mining_structure_Structure.prototype.upgradeFrom.call(this,s); + if(Std["is"](s,com_davidmaletz_mining_structure_EnchantRecipe)) { + this.set_recipe((js_Boot.__cast(s , com_davidmaletz_mining_structure_EnchantRecipe)).recipe); + } + } + ,write: function(b) { + com_davidmaletz_mining_structure_Structure.prototype.write.call(this,b); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.recipe == null ? null : this.recipe.id); + } + ,read: function(b,version,parent) { + com_davidmaletz_mining_structure_Structure.prototype.read.call(this,b,version,parent); + this.set_recipe(com_davidmaletz_mining_item_Recipe.get(com_fancyfish_faeng_common_UTFUtils.readUTF(b))); + } + ,set_recipe: function(n) { + if(n != this.recipe) { + this.recipe = n; + this.dispatchEvent(new openfl_events_Event("update_recipe")); + } + return n; + } + ,__class__: com_davidmaletz_mining_structure_EnchantRecipe + ,__properties__: $extend(com_davidmaletz_mining_structure_Structure.prototype.__properties__,{set_recipe:"set_recipe"}) +}); +var com_davidmaletz_mining_structure_Equipment = function(info,x,y) { + com_davidmaletz_mining_structure_Structure.call(this,info,x,y); +}; +$hxClasses["com.davidmaletz.mining.structure.Equipment"] = com_davidmaletz_mining_structure_Equipment; +com_davidmaletz_mining_structure_Equipment.__name__ = ["com","davidmaletz","mining","structure","Equipment"]; +com_davidmaletz_mining_structure_Equipment.__super__ = com_davidmaletz_mining_structure_Structure; +com_davidmaletz_mining_structure_Equipment.prototype = $extend(com_davidmaletz_mining_structure_Structure.prototype,{ + onOperate: function(p) { + var recipes = []; + var i = com_davidmaletz_mining_ui_CraftingWindow.getRecipes(p,this.info.xml,"equipment"); + var r = i; + while(r.hasNext()) { + var r1 = r.next(); + recipes.push(r1); + } + com_davidmaletz_mining_structure_Structure.prototype.onOperate.call(this,p); + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(this.makeWindow(new com_davidmaletz_mining_ui_ChangeEquipment(p,c,this.getTitle(p),com_fancyfish_faeng_common_Lang.getTextFromTitle(this.info.xml.get("craftTitle")),recipes,this.info.xml,this),p),2); + } + ,__class__: com_davidmaletz_mining_structure_Equipment +}); +var com_davidmaletz_mining_structure_FarmBase = function(info,x,y) { + com_davidmaletz_mining_structure_Structure.call(this,info,x,y); + this.crops = []; +}; +$hxClasses["com.davidmaletz.mining.structure.FarmBase"] = com_davidmaletz_mining_structure_FarmBase; +com_davidmaletz_mining_structure_FarmBase.__name__ = ["com","davidmaletz","mining","structure","FarmBase"]; +com_davidmaletz_mining_structure_FarmBase.__interfaces__ = [com_davidmaletz_mining_structure_FarmBaseInterface]; +com_davidmaletz_mining_structure_FarmBase.__super__ = com_davidmaletz_mining_structure_Structure; +com_davidmaletz_mining_structure_FarmBase.prototype = $extend(com_davidmaletz_mining_structure_Structure.prototype,{ + crops: null + ,addSlot: function(c) { + if(this.crops.indexOf(c) == -1) { + c.addEventListener("update_crop",$bind(this,this.changeFarmItems)); + this.crops.push(c); + this.changeFarmItems(null); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("crop_added",c)); + } + return c; + } + ,removeSlot: function(c) { + if(HxOverrides.remove(this.crops,c)) { + c.removeEventListener("update_crop",$bind(this,this.changeFarmItems)); + this.changeFarmItems(null); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("crop_removed",c)); + } + } + ,hasAnimal: function(id) { + return this.hasCrop(id); + } + ,hasCrop: function(id) { + var s = this.getSlots(); + while(s.hasNext()) { + var s1 = s.next(); + if(s1.info != null && s1.info.id == id) { + return true; + } + } + return false; + } + ,getSelectAnimalTitle: function() { + var m = com_fancyfish_faeng_common_Lang.getTextFromTitle(this.info.xml.get("selectAnimal")); + if(m == null) { + return com_fancyfish_faeng_common_Lang.getText("common","add_animal"); + } else { + return m; + } + } + ,changeFarmItems: function(e) { + this.dispatchEvent(new openfl_events_Event("item_change")); + } + ,handleTick: function(frames) { + if(this.canFunction() && frames > 0) { + var _g = 0; + var _g1 = this.crops; + while(_g < _g1.length) { + var c = _g1[_g]; + ++_g; + c.tick(frames); + } + } + } + ,getCrop: function(i) { + return this.crops[i]; + } + ,iterator: function() { + return HxOverrides.iter(this.crops); + } + ,getSlots: function() { + return this.iterator(); + } + ,getSlot: function(index) { + if(index < this.crops.length) { + return this.crops[index]; + } else { + return null; + } + } + ,getFarmItemCount: function() { + return this.crops.length; + } + ,getFarmItems: function() { + return new com_davidmaletz_mining_structure_FarmItemIterator(this.iterator()); + } + ,getNextItem: function() { + var ar = []; + var _g = 0; + var _g1 = this.crops; + while(_g < _g1.length) { + var c = _g1[_g]; + ++_g; + var i = c.iterator(); + while(i.hasNext()) { + var i1 = i.next(); + if(i1.isComplete()) { + var item = com_davidmaletz_mining_item_ItemInfo.get(i1.info.item); + if(item != null) { + ar.push(item); + } + } + } + } + if(ar.length > 0) { + return ar[Math.floor(Math.random() * ar.length)]; + } else { + return null; + } + } + ,canHarvest: function() { + var s = this.iterator(); + while(s.hasNext()) { + var s1 = s.next(); + if(s1.canHarvest()) { + return true; + } + } + return false; + } + ,__class__: com_davidmaletz_mining_structure_FarmBase +}); +var com_davidmaletz_mining_structure_Farm = function(info,x,y) { + this.upgrades = []; + this.__dirty = false; + com_davidmaletz_mining_structure_FarmBase.call(this,info,x,y); +}; +$hxClasses["com.davidmaletz.mining.structure.Farm"] = com_davidmaletz_mining_structure_Farm; +com_davidmaletz_mining_structure_Farm.__name__ = ["com","davidmaletz","mining","structure","Farm"]; +com_davidmaletz_mining_structure_Farm.__super__ = com_davidmaletz_mining_structure_FarmBase; +com_davidmaletz_mining_structure_Farm.prototype = $extend(com_davidmaletz_mining_structure_FarmBase.prototype,{ + addedToArea: function(area,built) { + this.clearSlots(); + com_davidmaletz_mining_structure_FarmBase.prototype.addedToArea.call(this,area,built); + } + ,__dirty: null + ,clearSlots: function() { + while(this.crops.length > 0) this.removeSlot(this.crops[0]); + com_fancyfish_faeng_common_Utils.clear(this.upgrades); + this.__dirty = true; + } + ,removedFromArea: function(area) { + com_davidmaletz_mining_structure_FarmBase.prototype.removedFromArea.call(this,area); + this.clearSlots(); + } + ,getCropCount: function() { + var ret = 0; + var _g = 0; + var _g1 = this.crops; + while(_g < _g1.length) { + var c = _g1[_g]; + ++_g; + if(!Std["is"](c,com_davidmaletz_mining_item_Animal)) { + ++ret; + } + } + return ret; + } + ,upgrades: null + ,updateCrops: function() { + this.clearSlots(); + var s = this.area.getStructures(); + while(s.hasNext()) { + var s1 = s.next(); + if(Std["is"](s1,com_davidmaletz_mining_structure_IFarmUpgrade)) { + (js_Boot.__cast(s1 , com_davidmaletz_mining_structure_IFarmUpgrade)).addFarm(this); + } + } + this.__dirty = false; + } + ,canHarvest: function() { + if(this.__dirty) { + this.updateCrops(); + } + return com_davidmaletz_mining_structure_FarmBase.prototype.canHarvest.call(this); + } + ,handleTick: function(frames) { + if(this.area == null) { + return; + } + if(this.__dirty) { + this.updateCrops(); + } + if(frames > 0) { + var _g = 0; + var _g1 = this.upgrades; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + s.handleTick(frames); + } + } + } + ,addUpgrade: function(s) { + if(this.upgrades.indexOf(s) == -1) { + this.upgrades.push(s); + } + var slot = s.getSlots(); + while(slot.hasNext()) { + var slot1 = slot.next(); + this.addSlot(slot1); + } + } + ,shiftUpgrade: function(s) { + if(HxOverrides.remove(this.upgrades,s)) { + this.upgrades.unshift(s); + var update = false; + var ar = []; + var slot = s.getSlots(); + while(slot.hasNext()) { + var slot1 = slot.next(); + ar.push(slot1); + } + ar.reverse(); + var _g = 0; + while(_g < ar.length) { + var slot2 = ar[_g]; + ++_g; + if(HxOverrides.remove(this.crops,slot2)) { + this.crops.unshift(slot2); + update = true; + } + } + if(update) { + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("crop_removed",null)); + } + } + } + ,onOperate: function(p) { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(this.makeWindow(new com_davidmaletz_mining_ui_FarmWindow(p,this,c),p),2); + } + ,addItemBubbles: function(r) { + var xml = this.info.xml; + r.addChild(new com_davidmaletz_mining_renderer_ItemBubble((this.info.width >> 1) + (xml.exists("speechX") ? com_davidmaletz_mining_Main.parseInt(xml.get("speechX")) : 0),this.info.height - 35 + (xml.exists("speechY") ? com_davidmaletz_mining_Main.parseInt(xml.get("speechY")) : 0),this)); + return r; + } + ,createRenderer: function() { + return this.addItemBubbles(new com_davidmaletz_tiles_render_PlayAnimation(this.info.tile,this.getIdle(),10,false,$bind(this,this.checkIdle))); + } + ,read: function(b,version,parent) { + com_davidmaletz_mining_structure_FarmBase.prototype.read.call(this,b,version,parent); + if(version < 18) { + var len = b.readByte() & 255; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + com_fancyfish_faeng_common_UTFUtils.readUTF(b); + b.readUInt16(); + } + } else if(version <= 51) { + while(true) { + var id = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(id == null) { + break; + } + } + } + } + ,__class__: com_davidmaletz_mining_structure_Farm +}); +var com_davidmaletz_mining_structure_FarmItemIterator = function(i) { + this.crops = i; + this.current = this.getNext(); +}; +$hxClasses["com.davidmaletz.mining.structure.FarmItemIterator"] = com_davidmaletz_mining_structure_FarmItemIterator; +com_davidmaletz_mining_structure_FarmItemIterator.__name__ = ["com","davidmaletz","mining","structure","FarmItemIterator"]; +com_davidmaletz_mining_structure_FarmItemIterator.prototype = { + crops: null + ,iterator: null + ,current: null + ,hasNext: function() { + return this.current != null; + } + ,next: function() { + var ret = this.current; + this.current = this.getNext(); + return ret; + } + ,getNext: function() { + while(this.iterator == null || !this.iterator.hasNext()) { + if(!this.crops.hasNext()) { + return null; + } + this.iterator = this.crops.next().iterator(); + } + return this.iterator.next(); + } + ,__class__: com_davidmaletz_mining_structure_FarmItemIterator +}; +var com_davidmaletz_mining_structure_IFuelable = function() { }; +$hxClasses["com.davidmaletz.mining.structure.IFuelable"] = com_davidmaletz_mining_structure_IFuelable; +com_davidmaletz_mining_structure_IFuelable.__name__ = ["com","davidmaletz","mining","structure","IFuelable"]; +com_davidmaletz_mining_structure_IFuelable.__interfaces__ = [openfl_events_IEventDispatcher]; +com_davidmaletz_mining_structure_IFuelable.prototype = { + getFuel: null + ,getUsableFuel: null + ,getMaxFuel: null + ,getFuelPercent: null + ,addFuel: null + ,useFuel: null + ,spawnVehicle: null + ,getFuelName: null + ,getMultiplier: null + ,playFuelSFX: null + ,__class__: com_davidmaletz_mining_structure_IFuelable +}; +var com_davidmaletz_mining_structure_Fuelable = function(info,x,y,defaultMax) { + if(defaultMax == null) { + defaultMax = 100; + } + com_davidmaletz_mining_structure_Structure.call(this,info,x,y); + this.fuel = 0; + if(info.xml.exists("maxFuel")) { + this.max_fuel = com_davidmaletz_mining_Main.parseInt(info.xml.get("maxFuel")); + } else { + this.max_fuel = defaultMax; + } +}; +$hxClasses["com.davidmaletz.mining.structure.Fuelable"] = com_davidmaletz_mining_structure_Fuelable; +com_davidmaletz_mining_structure_Fuelable.__name__ = ["com","davidmaletz","mining","structure","Fuelable"]; +com_davidmaletz_mining_structure_Fuelable.__interfaces__ = [com_davidmaletz_mining_structure_IFuelable]; +com_davidmaletz_mining_structure_Fuelable.__super__ = com_davidmaletz_mining_structure_Structure; +com_davidmaletz_mining_structure_Fuelable.prototype = $extend(com_davidmaletz_mining_structure_Structure.prototype,{ + fuel: null + ,max_fuel: null + ,playFuelSFX: function() { + this.playOnce(com_davidmaletz_faengfl_adv_sound_Sound.resolve(null,this.info.xml,"fuel")); + } + ,hasFuel: function() { + return this.fuel > 0; + } + ,getAnimation: function() { + return this.getAnim(this.hasFuel() ? "on" : "off"); + } + ,getIdle: function() { + return this.getAnim(this.hasFuel() && (!this.usePower || this.isPowered()) ? "on" : "off"); + } + ,useFuel: function(ct) { + if(ct == null) { + ct = 1; + } + if(this.fuel >= ct) { + this.fuel -= ct; + this.dispatchEvent(new com_davidmaletz_faengfl_events_IntEvent("update_fuel",-ct)); + if(this.fuel == 0 && this.renderer != null) { + this.updateAnim(); + } + } + } + ,getFuel: function() { + return this.fuel; + } + ,getUsableFuel: function() { + return this.fuel; + } + ,getMaxFuel: function() { + return this.max_fuel; + } + ,addFuel: function(f) { + f += this.fuel; + var max = this.getMaxFuel(); + if(f > max) { + f = max; + } + if(f != this.fuel) { + var d = f - this.fuel; + this.fuel = f; + this.dispatchEvent(new com_davidmaletz_faengfl_events_IntEvent("update_fuel",d)); + if(this.renderer != null) { + this.updateAnim(); + } + } + } + ,spawnVehicle: function(r) { + com_davidmaletz_mining_ui_CraftingWindow._spawnVehicle(com_davidmaletz_mining_Main.getLocalPlayer(),this.info.xml,this,r); + } + ,getFuelPercent: function() { + return this.fuel / this.getMaxFuel(); + } + ,canAddFuel: function() { + return this.fuel < this.getMaxFuel(); + } + ,getMultiplier: function() { + return 1; + } + ,getFuelForItem: function(item) { + var recipes = com_davidmaletz_mining_ui_CraftingWindow.getRecipes(com_davidmaletz_mining_Main.getLocalPlayer(),this.info.xml); + var r = recipes; + while(r.hasNext()) { + var r1 = r.next(); + if(r1.fuel > 0 && r1.getFirstRequirement() == item) { + return r1.fuel; + } + } + return 0; + } + ,canAddItem: function(item) { + if(this.canAddFuel()) { + return this.getFuelForItem(item) > 0; + } else { + return false; + } + } + ,doAddItem: function(item,count,value,name) { + if(value == null) { + value = 0; + } + this.addFuel(this.getFuelForItem(item) * count); + } + ,updateAnim: function() { + if(this.renderer != null) { + var p = js_Boot.__cast(this.renderer , com_davidmaletz_tiles_render_PlayAnimation); + if(p.onComplete == null) { + var a = this.getAnimation(); + if(com_davidmaletz_tiles_TileAnimation.exists(a) && p.animation != a) { + p.playAnimation(a,true); + this.animationUpdated(p); + } else { + p.loop = true; + } + } + } + } + ,getRenderer: function() { + var ret = com_davidmaletz_mining_structure_Structure.prototype.getRenderer.call(this); + this.updateAnim(); + return ret; + } + ,onOperate: function(p) { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(this.makeWindow(new com_davidmaletz_mining_ui_FuelWindow(p.getInv(true),this.getTitle(p),this,c,p,this.info.xml.get("fuelName"),this.info.xml),p),2); + } + ,getFuelName: function() { + return this.info.xml.get("fuelName"); + } + ,upgradeFrom: function(s) { + com_davidmaletz_mining_structure_Structure.prototype.upgradeFrom.call(this,s); + if(Std["is"](s,com_davidmaletz_mining_structure_Fuelable)) { + var p = js_Boot.__cast(s , com_davidmaletz_mining_structure_Fuelable); + this.fuel = p.fuel; + } + } + ,write: function(b) { + com_davidmaletz_mining_structure_Structure.prototype.write.call(this,b); + b.writeUInt24(this.fuel); + } + ,read: function(b,version,parent) { + com_davidmaletz_mining_structure_Structure.prototype.read.call(this,b,version,parent); + if(version >= 35) { + this.fuel = b.readUInt24(); + } + } + ,__class__: com_davidmaletz_mining_structure_Fuelable +}); +var com_davidmaletz_mining_structure_Smelter = function(info,x,y) { + this.functioning = false; + com_davidmaletz_mining_structure_Fuelable.call(this,info,x,y,info.xml.exists("max_fuel") ? com_davidmaletz_mining_Main.parseInt(info.xml.get("max_fuel")) : 180); + this.queue = new com_davidmaletz_mining_item_SmeltQueue(this,info.xml.get("uncraft") != "true"); + this.queue.addEventListener("update",$bind(this,this._updateAnim)); + this.multiplier = com_davidmaletz_faengfl_EventHandler.parseString(info.xml.get("multiplier")); +}; +$hxClasses["com.davidmaletz.mining.structure.Smelter"] = com_davidmaletz_mining_structure_Smelter; +com_davidmaletz_mining_structure_Smelter.__name__ = ["com","davidmaletz","mining","structure","Smelter"]; +com_davidmaletz_mining_structure_Smelter.addRecipe = function(p,r) { + if(r.complete) { + p.inventory.addItems(r.recipe.creates.item,r.recipe.creates.count * r.count,r.recipe.creates.value,r.recipe.creates.name); + } else { + p.inventory.addIngredients(r.recipe,r.count); + } +}; +com_davidmaletz_mining_structure_Smelter.__super__ = com_davidmaletz_mining_structure_Fuelable; +com_davidmaletz_mining_structure_Smelter.prototype = $extend(com_davidmaletz_mining_structure_Fuelable.prototype,{ + queue: null + ,multiplier: null + ,_updateAnim: function(e) { + if(e.value == 1) { + this.completeAnim(); + } else if(this.renderer != null) { + this.updateAnim(); + } + } + ,getAnimation: function() { + if(this.queue.isSmelting()) { + return this.getAnim("on"); + } else { + return this.getAnim("off"); + } + } + ,completeAnim: function() { + if(this.info.xml.get("smeltAnim") != "false") { + this.playAnimation("smelt",$bind(this,this.next)); + this.playOnce(com_davidmaletz_faengfl_adv_sound_Sound.resolveDefault(this.info.xml,"smelter")); + } + } + ,updateAnim: function() { + var loop = this.info.xml.get("loop"); + if(this.queue.isSmelting()) { + if(loop != null && (this.sound == null || this.sound.isStopped())) { + this.playSFX(loop); + } + } else if(this.sound != null && this.sound.getId() == com_davidmaletz_faengfl_adv_sound_Sound.get(loop)) { + this.stopSFX(); + } + com_davidmaletz_mining_structure_Fuelable.prototype.updateAnim.call(this); + } + ,addedToArea: function(area,built) { + com_davidmaletz_mining_structure_Fuelable.prototype.addedToArea.call(this,area,built); + area.addEventListener("tick",$bind(this,this.handleTick)); + } + ,removedFromArea: function(area) { + com_davidmaletz_mining_structure_Fuelable.prototype.removedFromArea.call(this,area); + area.removeEventListener("tick",$bind(this,this.handleTick)); + } + ,getMultiplier: function() { + if(!this.canFunction()) { + return 0; + } else if(this.multiplier == null) { + return 1; + } + try { + return com_davidmaletz_faengfl_EventHandler.interpret(this.multiplier,this.getVars(com_davidmaletz_mining_Main.getLocalPlayer())); + } catch( e ) { + haxe_CallStack.lastException = e; + return 0; + } + } + ,functioning: null + ,handleTick: function(e) { + var f = this.canFunction(); + if(this.queue.handleTick(e.value) && this.renderer != null && !this.queue.isSmelting() || f != this.functioning) { + this.updateAnim(); + } + this.functioning = f; + } + ,next: function(p) { + this.updateAnim(); + } + ,onOperate: function(p) { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(this.makeWindow(new com_davidmaletz_mining_ui_SmeltWindow(p.getInv(true),this.getTitle(p),this.queue,c,p.includeCost(),this.info.xml,this,this.info.xml.elementPathsNamed("listItem"),0.5,0.5,this.info.xml.get("fuelName")),p),2); + } + ,makeWindow: function(wnd,p) { + wnd = com_davidmaletz_mining_structure_Fuelable.prototype.makeWindow.call(this,wnd,p); + var m = com_fancyfish_faeng_common_Lang.getTextFromTitle(this.info.xml.get("multiplierTitle")); + if(m != null) { + var sw = js_Boot.__cast(wnd , com_davidmaletz_mining_ui_SmeltWindow); + var s = new openfl_display_Sprite(); + var w = sw.smeltList.getWidth(); + var h = sw.getHeight(); + s.addChild(com_davidmaletz_mining_Main.window_factory.create(w + 9,14).create(-4,-2)); + var t = new com_davidmaletz_faengfl_TextSprite(m,new com_fancyfish_faeng_text_CharacterPlacer(w,0),0,1); + s.addChild(t); + var t1 = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Static(Std.string(this.getMultiplier())),new com_fancyfish_faeng_text_CharacterPlacer(w,2),0,1); + s.addChild(t1); + s.set_x(sw.smeltList.get_x() - 1); + s.set_y(h - 14); + sw.addChild(s); + } + return wnd; + } + ,addItemBubbles: function(r) { + var xml = this.info.xml; + r.addChild(new com_davidmaletz_mining_renderer_ItemBubble((this.info.width >> 1) + (xml.exists("speechX") ? com_davidmaletz_mining_Main.parseInt(xml.get("speechX")) : 0),this.info.height - 35 + (xml.exists("speechY") ? com_davidmaletz_mining_Main.parseInt(xml.get("speechY")) : 0),this.queue)); + return r; + } + ,createRenderer: function() { + return this.addItemBubbles(new com_davidmaletz_tiles_render_PlayAnimation(this.info.tile,this.getAnimation(),10,true)); + } + ,upgradeFrom: function(s) { + com_davidmaletz_mining_structure_Fuelable.prototype.upgradeFrom.call(this,s); + if(Std["is"](s,com_davidmaletz_mining_structure_Smelter)) { + var smelter = js_Boot.__cast(s , com_davidmaletz_mining_structure_Smelter); + this.fuel = smelter.fuel; + this.queue.copyFrom(smelter.queue); + } + } + ,onDismantle: function(p) { + com_davidmaletz_mining_structure_Fuelable.prototype.onDismantle.call(this,p); + var r = this.queue.getIncomplete(); + while(r.hasNext()) { + var r1 = r.next(); + com_davidmaletz_mining_structure_Smelter.addRecipe(p,r1); + } + var r2 = this.queue.getComplete(); + while(r2.hasNext()) { + var r3 = r2.next(); + com_davidmaletz_mining_structure_Smelter.addRecipe(p,r3); + } + var c = this.queue.getCurrent(); + if(c != null) { + com_davidmaletz_mining_structure_Smelter.addRecipe(p,new com_davidmaletz_mining_item_RecipeCount(c.recipe,1,!this.queue.craft)); + } + } + ,write: function(b) { + com_davidmaletz_mining_structure_Fuelable.prototype.write.call(this,b); + this.queue.write(b); + } + ,read: function(b,version,parent) { + com_davidmaletz_mining_structure_Fuelable.prototype.read.call(this,b,version,parent); + var f = this.queue.read(b,version); + if(f >= 0) { + this.fuel = f; + } + } + ,__class__: com_davidmaletz_mining_structure_Smelter +}); +var com_davidmaletz_mining_structure_Kitchen = function(info,x,y) { + com_davidmaletz_mining_structure_Smelter.call(this,info,x,y); + this.playerEntered = false; +}; +$hxClasses["com.davidmaletz.mining.structure.Kitchen"] = com_davidmaletz_mining_structure_Kitchen; +com_davidmaletz_mining_structure_Kitchen.__name__ = ["com","davidmaletz","mining","structure","Kitchen"]; +com_davidmaletz_mining_structure_Kitchen.__super__ = com_davidmaletz_mining_structure_Smelter; +com_davidmaletz_mining_structure_Kitchen.prototype = $extend(com_davidmaletz_mining_structure_Smelter.prototype,{ + playerEntered: null + ,completeAnim: function() { + this.playOnce(com_davidmaletz_faengfl_adv_sound_Sound.resolveDefault(this.info.xml,"kitchen")); + } + ,onOver: function(p) { + com_davidmaletz_mining_structure_Smelter.prototype.onOver.call(this,p); + this.playerEntered = true; + this.updateAnim(); + } + ,onOut: function(p) { + com_davidmaletz_mining_structure_Smelter.prototype.onOut.call(this,p); + this.playerEntered = false; + this.updateAnim(); + } + ,getAnimation: function() { + var st = this.info.xml.get("animation"); + var open = this.info.xml.get("openable") == "true" ? this.playerEntered ? ".open" : ".close" : ""; + if(this.queue.isSmelting()) { + return st + open + ".on"; + } else { + return st + open + ".off"; + } + } + ,__class__: com_davidmaletz_mining_structure_Kitchen +}); +var com_davidmaletz_mining_structure_Lair = function(info,x,y) { + com_davidmaletz_mining_structure_Structure.call(this,info,x,y); + this.house = new haxe_ds_StringMap(); + this.__animal = new com_davidmaletz_mining_structure_Slot(); + this.__animal.addEventListener("updated",$bind(this,this.dispatchEvent)); + var e = info.xml.elementsNamed("animal"); + while(e.hasNext()) { + var e1 = e.next(); + this.house.set(e1.get("id"),true); + } +}; +$hxClasses["com.davidmaletz.mining.structure.Lair"] = com_davidmaletz_mining_structure_Lair; +com_davidmaletz_mining_structure_Lair.__name__ = ["com","davidmaletz","mining","structure","Lair"]; +com_davidmaletz_mining_structure_Lair.__interfaces__ = [com_davidmaletz_mining_structure_SlotList,com_davidmaletz_mining_item_ItemValue]; +com_davidmaletz_mining_structure_Lair.__super__ = com_davidmaletz_mining_structure_Structure; +com_davidmaletz_mining_structure_Lair.prototype = $extend(com_davidmaletz_mining_structure_Structure.prototype,{ + __animal: null + ,house: null + ,getSlot: function(i) { + if(i == 0) { + return this.__animal; + } else { + return null; + } + } + ,get_animal: function() { + return this.__animal.getItem(null); + } + ,set_animal: function(i) { + this.__animal._setItem(i); + return i; + } + ,acceptAnimal: function(animal) { + return this.house.exists(animal.id); + } + ,run: function(e,p) { + new com_davidmaletz_mining_npc_NPCEventHandler(e.elements(),p,this).runAll(); + } + ,selectAnimal: function(window,player) { + var vars = null; + var s = this; + var getVars = function() { + if(vars == null) { + vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(player); + vars.set("this",s); + } + return vars; + }; + if(this.get_animal() == null) { + this._onSelect(player); + } else if(com_davidmaletz_faengfl_adv_AdvApp.shiftDown) { + this.setItem(player,null); + } else { + var c = com_davidmaletz_mining_Main.getContainer(); + var ids = []; + var funcs = []; + var tmp = this.get_animal().info; + var tmp1 = this.get_animal().value; + var tmp2 = this.get_animal().getNameStr(); + tmp.getActionChoices(ids,funcs,player,tmp1,tmp2,window,this,false,true); + var e = this.info.xml.elementPathsNamed("familiar"); + while(e.hasNext()) { + var e1 = e.next(); + if(!e1.exists("if") || com_davidmaletz_faengfl_EventHandler._conditionMet(e1.get("if"),getVars())) { + ids.push(e1.get("option")); + funcs.push((function(p,e2,f) { + return function() { + f[0](e2[0],p[0]); + }; + })([player],[e1],[$bind(this,this.run)])); + } + } + ids.push("switch"); + var f1 = $bind(this,this._onSelect); + var a1 = player; + funcs.push(function() { + f1(a1); + }); + if(funcs.length == 1) { + funcs[0](); + } else { + ids.push("common.remove"); + var f2 = $bind(this,this.setItem); + var p1 = player; + funcs.push(function() { + f2(p1,null); + }); + c.addDisplay(new com_davidmaletz_mining_ui_Choice(c,"actions",ids,funcs),2); + } + } + } + ,animalVisible: function(vis) { + if(this.renderer != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_structure__$Lair_LairRenderer)).animal.set_visible(vis); + } + } + ,setName: function(p,n) { + if(this.get_animal() != null) { + this.get_animal().setName(n); + } + } + ,increaseValue: function(p,dv) { + if(this.get_animal() != null) { + var v = this.get_animal().value + dv; + var d = this.get_animal().getDurability(); + if(v < 0) { + v = 0; + } else if(v > d) { + v = d; + } + this.get_animal().setValue(v); + } + } + ,remove: function(p) { + this.setItem(p,null); + } + ,getItem: function(p) { + return this.get_animal(); + } + ,collectAnimal: function(p) { + if(this.get_animal() != null) { + p.inventory.addItems(this.get_animal().info,1,this.get_animal().value,this.get_animal().getNameStr()); + this.set_animal(null); + com_davidmaletz_mining_structure_Structure.prototype.onDismantle.call(this,p); + if(this.inventory != null) { + this.inventory.clear(); + } + } + } + ,setItem: function(p,i) { + this.collectAnimal(p); + if(i != null && i.count > 0) { + i.inventory.addItems(i.item,-1,i.value,i.name); + this.set_animal(new com_davidmaletz_mining_item_Item(i.item,i.value,i.name)); + } + } + ,setAnimal: function(animal,value,name) { + if(value == null) { + value = 0; + } + var i = com_davidmaletz_mining_item_ItemInfo.get(animal); + this.set_animal(i == null ? null : new com_davidmaletz_mining_item_Item(i,i.getDurability() - value,name)); + } + ,_onSelect: function(player) { + var c = com_davidmaletz_mining_Main.getContainer(); + var f = $bind(this,this.setItem); + var p = player; + var tmp = function(i) { + f(p,i); + }; + c.addDisplay(new com_davidmaletz_mining_ui_ItemList(c,player.getInv(true),com_fancyfish_faeng_common_Lang.getText("common","add_animal"),player.includeCost(),$bind(this,this.acceptAnimal),tmp,true,com_fancyfish_faeng_common_Lang.getText("common","none")),2); + } + ,onDismantle: function(p) { + this.setItem(p,null); + com_davidmaletz_mining_structure_Structure.prototype.onDismantle.call(this,p); + } + ,onOperate: function(p) { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(this.makeWindow(new com_davidmaletz_mining_structure__$Lair_LairWindow(p.getInv(true),this.getTitle(p),this,c,p),p),2); + } + ,createRenderer: function() { + return new com_davidmaletz_mining_structure__$Lair_LairRenderer(this); + } + ,write: function(b) { + com_davidmaletz_mining_structure_Structure.prototype.write.call(this,b); + com_davidmaletz_mining_item_Item.write(b,this.get_animal()); + } + ,read: function(b,version,parent) { + com_davidmaletz_mining_structure_Structure.prototype.read.call(this,b,version,parent); + if(version >= 44) { + this.set_animal(com_davidmaletz_mining_item_Item.read(b,version)); + } + } + ,fadeAnimalIn: function() { + if(this.renderer == null) { + return; + } + var a = (js_Boot.__cast(this.renderer , com_davidmaletz_mining_structure__$Lair_LairRenderer)).animal; + if(a.get_numChildren() == 0) { + return; + } + var l = a.getChildAt(0); + if(Std["is"](l,com_davidmaletz_tiles_render_PlayAnimation)) { + var r = js_Boot.__cast(l , com_davidmaletz_tiles_render_PlayAnimation); + r.set_alpha(0); + r.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),10); + } + } + ,__class__: com_davidmaletz_mining_structure_Lair + ,__properties__: $extend(com_davidmaletz_mining_structure_Structure.prototype.__properties__,{set_animal:"set_animal",get_animal:"get_animal"}) +}); +var com_davidmaletz_mining_structure__$Lair_LairRenderer = function(lair) { + com_davidmaletz_tiles_render_PlayAnimation.call(this,lair.info.tile,lair.getIdle(),10,false,$bind(lair,lair.checkIdle)); + this.lair = lair; + this.animal = new openfl_display_Sprite(); + this.addChild(this.animal); + this.animal_x = com_davidmaletz_mining_Main.parseInt(lair.info.xml.get("animalX")); + this.animal_y = com_davidmaletz_mining_Main.parseInt(lair.info.xml.get("animalY")); +}; +$hxClasses["com.davidmaletz.mining.structure._Lair.LairRenderer"] = com_davidmaletz_mining_structure__$Lair_LairRenderer; +com_davidmaletz_mining_structure__$Lair_LairRenderer.__name__ = ["com","davidmaletz","mining","structure","_Lair","LairRenderer"]; +com_davidmaletz_mining_structure__$Lair_LairRenderer.__super__ = com_davidmaletz_tiles_render_PlayAnimation; +com_davidmaletz_mining_structure__$Lair_LairRenderer.prototype = $extend(com_davidmaletz_tiles_render_PlayAnimation.prototype,{ + lair: null + ,animal: null + ,animal_x: null + ,animal_y: null + ,init: function(e) { + com_davidmaletz_tiles_render_PlayAnimation.prototype.init.call(this,e); + this.lair.addEventListener("updated",$bind(this,this.update)); + this.update(null); + } + ,destroy: function(e) { + com_davidmaletz_tiles_render_PlayAnimation.prototype.destroy.call(this,e); + this.lair.removeEventListener("updated",$bind(this,this.update)); + } + ,update: function(e) { + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this.animal); + if(this.lair.get_animal() != null) { + var familiar = this.lair.get_animal().info.getFamiliar(); + var r = new com_davidmaletz_tiles_render_PlayAnimation(com_davidmaletz_tiles_Tile.get(familiar.get("tile")),familiar.get("animation") + ".idle",10,true,null,-0.5,-1); + r.set_x(this.animal_x); + r.set_y(this.animal_y); + this.animal.addChild(r); + } + } + ,__class__: com_davidmaletz_mining_structure__$Lair_LairRenderer +}); +var com_davidmaletz_mining_ui_CraftingWindow = function(incTabs,recipes,label,i,c,incCost,additional,obj,onCraft,spawnVehicle,fuelName,halign,valign,none,filter) { + if(valign == null) { + valign = 0.5; + } + if(halign == null) { + halign = 0.2; + } + this.details = new com_davidmaletz_mining_ui_details_RecipeDetails(incCost); + this.list = new com_davidmaletz_mining_ui_CraftingList(this,i,c,fuelName,none); + this.items = []; + this.list.items = this.items; + this.addItems(); + if(none != null) { + this.list.addItem(null); + } + this.list.addItems(recipes,this.details,additional,obj,filter); + this.list.items = null; + this.onCraft = onCraft; + this.spawnVehicleFunc = spawnVehicle; + com_davidmaletz_controls_ClickableWindow.call(this,c,this.getDrawable(),true,true,true,halign,valign); + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,label,this.getWidth()); + this.list.set_x(4); + this.list.set_y(4); + this.addChild(this.list); + if(this.list.types != null && incTabs) { + this.tabs = new com_davidmaletz_mining_ui_InventoryTabs(this.clickables,$bind(this,this.hasItem),$bind(this,this.setTab)); + this.addChild(this.tabs); + var _g = this; + _g.set_x(_g.get_x() - 4); + this.details.set_x(this.getWidth() - 4 - 1); + } else { + var _g1 = this; + _g1.set_x(_g1.get_x() - 16); + this.details.set_x(this.getWidth() + 4); + } + var close = new com_davidmaletz_controls_CloseButton(this,this.getWidth(),0); + this.addChild(close); + this.clickables.addClickable(close,this); + this.addChild(this.details); +}; +$hxClasses["com.davidmaletz.mining.ui.CraftingWindow"] = com_davidmaletz_mining_ui_CraftingWindow; +com_davidmaletz_mining_ui_CraftingWindow.__name__ = ["com","davidmaletz","mining","ui","CraftingWindow"]; +com_davidmaletz_mining_ui_CraftingWindow.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_CraftingWindow.addCurrent = function(ar,type,l) { + var _g = 0; + while(_g < ar.length) { + var i = ar[_g]; + ++_g; + if(Std["is"](i.first,com_davidmaletz_mining_item_Recipe)) { + var r = js_Boot.__cast(i.first , com_davidmaletz_mining_item_Recipe); + if(type != null && (r.object != null && type != com_davidmaletz_mining_item_ItemCategory.VEHICLE || r.creates != null && r.creates.item.type != type)) { + continue; + } + } else if(type != null) { + continue; + } + l.addMixedItem(i.first,i.second); + } +}; +com_davidmaletz_mining_ui_CraftingWindow.getRecipes = function(p,xml,element) { + if(element == null) { + element = "recipe"; + } + var ar = []; + var vars = p == null ? com_davidmaletz_faengfl_EventHandler.createVariables() : com_davidmaletz_mining_npc_NPCEventHandler.createVariables(p); + var e = xml.elementsNamed(element); + while(e.hasNext()) { + var e1 = e.next(); + if(e1.exists("type")) { + ar.push(com_davidmaletz_mining_item_Recipe.getByType(e1.get("type"),vars,e1.get("includeObjects") != "false")); + } else { + var r = com_davidmaletz_mining_item_Recipe.get(e1.get("id")); + if(r != null && r.isAvailable(vars)) { + ar.push(new com_fancyfish_faeng_common_SingleIterator(r)); + } + } + } + return new com_fancyfish_faeng_common_CompoundIterator(HxOverrides.iter(ar)); +}; +com_davidmaletz_mining_ui_CraftingWindow.runEvent = function(event,p,xml,o,onComplete,name,value) { + var map = null; + if(name != null) { + map = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(p); + map.set(name,value); + } + com_davidmaletz_mining_Main.runEvent(event,p,xml,o,onComplete,map); +}; +com_davidmaletz_mining_ui_CraftingWindow._onCraft = function(p,xml,o,r) { + if(r == null) { + var e = xml.elementsNamed("craft"); + if(e.hasNext()) { + return e.next().get("immediate") == "true"; + } else { + return false; + } + } else { + com_davidmaletz_mining_ui_CraftingWindow.runEvent("craft",p,xml,o,null,"recipe",r); + return false; + } +}; +com_davidmaletz_mining_ui_CraftingWindow._spawnVehicle = function(p,xml,o,recipe) { + var vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(p); + var v = recipe.object; + vars.set("this",o); + vars.set("info",v); + var r = v.createIcon(); + vars.set("width",r.getTileWidth(0,0)); + vars.set("height",r.getTileHeight(0,0)); + vars.set("recipe",recipe); + var y = Math.round(com_davidmaletz_faengfl_EventHandler.execute(xml.exists("spawnY") ? xml.get("spawnY") : "this.tile_y",vars) * com_davidmaletz_tiles_Tile.SIZE); + var a = xml.exists("spawnArea") ? p.areas.get(com_davidmaletz_mining_npc_NPCEventHandler.evalString(xml.get("spawnArea"),vars)) : p.getCurrentArea(); + var obj = v.create(Math.round(com_davidmaletz_faengfl_EventHandler.execute(xml.exists("spawnX") ? xml.get("spawnX") : "this.tile_x+1",vars) * com_davidmaletz_tiles_Tile.SIZE),y); + vars.set("object",obj); + var f = $bind(a,a.addObject); + var a1 = obj; + com_davidmaletz_mining_Main.runEvent("craftObject",p,xml,o,function() { + f(a1); + },vars); +}; +com_davidmaletz_mining_ui_CraftingWindow.make = function(label,i,c,p,xml,o,halign,valign) { + if(valign == null) { + valign = 0.5; + } + if(halign == null) { + halign = 0.2; + } + var p1 = p; + var a1 = xml; + var o1 = o; + var tmp = function(r) { + return com_davidmaletz_mining_ui_CraftingWindow._onCraft(p1,a1,o1,r); + }; + var p2 = p; + var a11 = xml; + var o2 = o; + var tmp1 = function(a2) { + com_davidmaletz_mining_ui_CraftingWindow._spawnVehicle(p2,a11,o2,a2); + }; + return new com_davidmaletz_mining_ui_CraftingWindow(true,com_davidmaletz_mining_ui_CraftingWindow.getRecipes(p,xml),label,i,c,p.includeCost(),xml.elementPathsNamed("listItem"),o,tmp,tmp1,null,halign,valign); +}; +com_davidmaletz_mining_ui_CraftingWindow.craft = function(onCraft,inv,recipe,spawnVehicle) { + var max = inv.maxCraft(com_davidmaletz_mining_Main.getLocalPlayer(),recipe); + if(max == 0) { + com_davidmaletz_faengfl_adv_sound_Sound.play("warning"); + new com_davidmaletz_faengfl_ui_Popup(128.,52.,0,com_fancyfish_faeng_common_Lang.getText("warning","ingredients"),16720418); + } else { + if(recipe != null && recipe.xml != null) { + var i = recipe.xml.elementPathsNamed("craft"); + if(i.hasNext()) { + var v = com_davidmaletz_faengfl_EventHandler.createVariables(); + v.set("inventory",inv); + var a1 = onCraft; + var a2 = inv; + var a3 = recipe; + var a4 = spawnVehicle; + var tmp = function() { + com_davidmaletz_mining_ui_CraftingWindow.doCraft(a1,a2,a3,a4,1); + }; + new com_davidmaletz_mining_npc_NPCEventHandler(i.next().elements(),com_davidmaletz_mining_Main.getLocalPlayer(),recipe,tmp,v).runAll(); + return; + } + } + if(com_davidmaletz_mining_Main.NO_COUNT || com_davidmaletz_faengfl_adv_AdvApp.shiftDown || recipe.object != null) { + com_davidmaletz_mining_ui_CraftingWindow.doCraft(onCraft,inv,recipe,spawnVehicle,1); + } else { + var c = com_davidmaletz_mining_Main.getContainer(); + var a11 = onCraft; + var a21 = inv; + var a31 = recipe; + var a41 = spawnVehicle; + var tmp1 = function(ct) { + com_davidmaletz_mining_ui_CraftingWindow.doCraft(a11,a21,a31,a41,ct); + }; + c.addDisplay(new com_davidmaletz_mining_ui_ItemCountPrompt(c,recipe.creates,max,com_fancyfish_faeng_common_Lang.getText("common","craft"),1,tmp1),2); + } + } +}; +com_davidmaletz_mining_ui_CraftingWindow.closeFunc = function(func,old) { + func(); + if(old != null) { + old(); + } +}; +com_davidmaletz_mining_ui_CraftingWindow.doCraft = function(onCraft,inv,recipe,spawnVehicle,ct) { + if(ct <= 0) { + return; + } + if(recipe.object != null && spawnVehicle != null) { + if(inv.useIngredients(recipe)) { + recipe.gainAchievement(); + com_davidmaletz_mining_Main.closeWindows(); + spawnVehicle(recipe); + } + } else if(recipe.creates != null && inv.craft(recipe,ct)) { + com_davidmaletz_mining_Main.getLocalPlayer().checkSeenItem(recipe.creates.item); + if(onCraft != null) { + onCraft(inv,recipe,ct); + } + new com_davidmaletz_mining_ui_ItemPopup(recipe.creates.asItem(),ct * recipe.creates.count); + com_davidmaletz_mining_Main.getLocalPlayer().addExp(2 * ct); + } +}; +com_davidmaletz_mining_ui_CraftingWindow.__super__ = com_davidmaletz_controls_ClickableWindow; +com_davidmaletz_mining_ui_CraftingWindow.prototype = $extend(com_davidmaletz_controls_ClickableWindow.prototype,{ + list: null + ,tabs: null + ,details: null + ,onCraft: null + ,spawnVehicleFunc: null + ,items: null + ,hasItem: function(c) { + return this.list.types.exists(c.index); + } + ,setTab: function(tab) { + var ar = this.items; + var a1 = tab; + var tmp = function(l) { + com_davidmaletz_mining_ui_CraftingWindow.addCurrent(ar,a1,l); + }; + this.list.setItems(tmp,this.clickables); + } + ,getDrawable: function() { + return com_davidmaletz_mining_Main.window_factory.create(this.getWidth(),this.getHeight()); + } + ,addItems: function() { + } + ,createClickables: function() { + return new com_davidmaletz_controls_CompoundClickableColumns([this.list.getList().clickables],[4]); + } + ,onSelect: function(recipe) { + com_davidmaletz_mining_ui_CraftingWindow.craft($bind(this,this.handleCraft),this.list.inventory,recipe,this.spawnVehicleFunc); + } + ,handleCraft: function(inv,recipe,ct) { + if(this.onCraft != null) { + var f = this.onCraft; + var a1 = recipe; + var a11 = function() { + return f(a1); + }; + var a2 = this.onClose; + this.onClose = function() { + com_davidmaletz_mining_ui_CraftingWindow.closeFunc(a11,a2); + }; + if(this.onCraft(null)) { + this.close(); + } + this.onCraft = null; + } + this.details.setInfo(null); + this.details.setRecipe(recipe,inv); + } + ,onHover: function(recipe) { + this.details.setRecipe(recipe,this.list.inventory); + this.details.set_y(Math.round((this.getHeight() - this.details.getHeight()) * 0.5)); + } + ,isEnabled: function(recipe) { + return true; + } + ,getWidth: function() { + return this.list.getWidth() + 8; + } + ,getHeight: function() { + return this.list.getHeight() + 8; + } + ,__class__: com_davidmaletz_mining_ui_CraftingWindow +}); +var com_davidmaletz_mining_structure__$Lair_LairWindow = function(inventory,label,s,c,p) { + var xml = s.info.xml; + this.lair = s; + var p1 = p; + var a1 = xml; + var o = s; + var tmp = function(r) { + return com_davidmaletz_mining_ui_CraftingWindow._onCraft(p1,a1,o,r); + }; + com_davidmaletz_mining_ui_CraftingWindow.call(this,false,com_davidmaletz_mining_ui_CraftingWindow.getRecipes(p,xml),label,inventory,c,p.includeCost(),xml.elementPathsNamed("listItem"),s,tmp,null,"feed"); + var PAD = 4; + this.feed = new com_davidmaletz_mining_ui_Fuel(this,92,"feed"); + this.feed.set_x(this.details.get_x() + PAD); + var ht = com_davidmaletz_mining_ui_StringRenderer._getHeight(); + this.feedLabel = new openfl_display_Sprite(); + this.feedLabel.set_y(-ht); + ht += 2; + this.feed.addChild(this.feedLabel); + this.feed.addChildAt(com_davidmaletz_mining_Main.window_factory.create(92 + PAD * 2,this.feed._height + PAD * 2 + ht).create(-PAD,-PAD - ht),0); + this.feed.set_y(this.getHeight() - this.feed._height - PAD); + this.addChildAt(this.feed,0); +}; +$hxClasses["com.davidmaletz.mining.structure._Lair.LairWindow"] = com_davidmaletz_mining_structure__$Lair_LairWindow; +com_davidmaletz_mining_structure__$Lair_LairWindow.__name__ = ["com","davidmaletz","mining","structure","_Lair","LairWindow"]; +com_davidmaletz_mining_structure__$Lair_LairWindow.__interfaces__ = [com_davidmaletz_mining_structure_IFuelable]; +com_davidmaletz_mining_structure__$Lair_LairWindow.__super__ = com_davidmaletz_mining_ui_CraftingWindow; +com_davidmaletz_mining_structure__$Lair_LairWindow.prototype = $extend(com_davidmaletz_mining_ui_CraftingWindow.prototype,{ + feed: null + ,item: null + ,feedLabel: null + ,lair: null + ,init: function(e) { + com_davidmaletz_mining_ui_CraftingWindow.prototype.init.call(this,e); + this.lair.addEventListener("updated",$bind(this,this.update)); + this.update(null); + } + ,destroy: function(e) { + com_davidmaletz_mining_ui_CraftingWindow.prototype.destroy.call(this,e); + this.lair.removeEventListener("updated",$bind(this,this.update)); + if(this.item != null) { + this.item.removeEventListener("update_value",$bind(this,this.dispatch)); + this.item = null; + } + } + ,addItems: function() { + var i = this.lair; + var t = com_fancyfish_faeng_common_Lang.getTextFromTitle(this.lair.info.xml.get("slot")); + if(t == null) { + t = com_fancyfish_faeng_common_Lang.getText("equipment","familiar"); + } + if(this.lair.house.iterator().hasNext()) { + this.list.addMixedItem(i,new com_davidmaletz_mining_ui_ItemValueRenderer(new com_davidmaletz_mining_structure__$Lair_Handler(this),t,this.list.getRenderer().getWidth())); + } + } + ,getFuelName: function() { + return "feed"; + } + ,getFuel: function() { + var a = this.lair.get_animal(); + if(a != null) { + return a.getDurability() - a.value; + } else { + return 0; + } + } + ,getUsableFuel: function() { + return this.getFuel(); + } + ,getMaxFuel: function() { + var a = this.lair.get_animal(); + if(a != null) { + return a.getDurability(); + } else { + return 0; + } + } + ,addFuel: function(f) { + this.lair.increaseValue(null,-f); + } + ,useFuel: function(ct) { + if(ct == null) { + ct = 1; + } + this.lair.increaseValue(null,ct); + } + ,playFuelSFX: function() { + com_davidmaletz_faengfl_adv_sound_Sound.play("eat"); + } + ,getFuelPercent: function() { + var a = this.lair.get_animal(); + if(a != null) { + return 1 - a.value / a.getDurability(); + } else { + return 0; + } + } + ,getMultiplier: function() { + return 1; + } + ,spawnVehicle: function(o) { + com_davidmaletz_mining_ui_CraftingWindow._spawnVehicle(com_davidmaletz_mining_Main.getLocalPlayer(),this.lair.info.xml,this.lair,o); + } + ,update: function(e) { + if(this.item != null) { + this.item.removeEventListener("update_value",$bind(this,this.dispatch)); + this.item = null; + } + var a = this.lair.get_animal(); + if(a != null) { + this.feed.set_visible(true); + this.item = a; + this.item.addEventListener("update_value",$bind(this,this.dispatch)); + this.dispatch(null); + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this.feedLabel); + com_davidmaletz_mining_ui_ItemRenderer.addItemCentered(this.feedLabel,this.item,46,-2); + } else { + this.feed.set_visible(false); + } + this.onHover(null); + if(e != null) { + this.list.update(null); + } + } + ,dispatch: function(e) { + this.dispatchEvent(new openfl_events_Event("update_fuel")); + } + ,fuelAdded: function(recipe,ct) { + this.list.update(null); + this.details.setInfo(null); + this.onHover(recipe); + } + ,onSelect: function(recipe) { + if(recipe.creates != null) { + com_davidmaletz_mining_ui_CraftingWindow.prototype.onSelect.call(this,recipe); + } else if(this.isEnabled(recipe)) { + com_davidmaletz_mining_ui_FuelWindow.addFuel(this,this.list.inventory,recipe,"feed",$bind(this,this.fuelAdded)); + } + } + ,onHover: function(recipe) { + this.details.setRecipe(recipe,this.list.inventory,"feed"); + } + ,isEnabled: function(recipe) { + if(recipe.creates == null) { + return this.lair.getItem(null) != null; + } else { + return true; + } + } + ,__class__: com_davidmaletz_mining_structure__$Lair_LairWindow +}); +var com_davidmaletz_mining_structure__$Lair_Handler = function(wnd) { + this.wnd = wnd; +}; +$hxClasses["com.davidmaletz.mining.structure._Lair.Handler"] = com_davidmaletz_mining_structure__$Lair_Handler; +com_davidmaletz_mining_structure__$Lair_Handler.__name__ = ["com","davidmaletz","mining","structure","_Lair","Handler"]; +com_davidmaletz_mining_structure__$Lair_Handler.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_structure__$Lair_Handler.prototype = { + wnd: null + ,onSelect: function(item) { + (js_Boot.__cast(item , com_davidmaletz_mining_structure_Lair)).selectAnimal(this.wnd,com_davidmaletz_mining_Main.getLocalPlayer()); + } + ,onHover: function(item) { + var details = this.wnd.details; + if(item == null) { + details.setInfo(null); + } else { + details.setInfo(item.getItem(null)); + } + } + ,isEnabled: function(item) { + return true; + } + ,__class__: com_davidmaletz_mining_structure__$Lair_Handler +}; +var com_davidmaletz_mining_structure_Market = function(info,x,y) { + this.partial = 0; + this.restock_ct = 0; + com_davidmaletz_mining_structure_Structure.call(this,info,x,y); + this.buy_types = com_davidmaletz_mining_structure_Market.getTypes(info.xml); + this.price = info.xml.exists("price") ? com_davidmaletz_mining_Main.parseFloat(info.xml.get("price")) : 1; + this.restock(); +}; +$hxClasses["com.davidmaletz.mining.structure.Market"] = com_davidmaletz_mining_structure_Market; +com_davidmaletz_mining_structure_Market.__name__ = ["com","davidmaletz","mining","structure","Market"]; +com_davidmaletz_mining_structure_Market.getTypes = function(xml) { + var buy_types = new haxe_ds_IntMap(); + var e = xml.elementsNamed("buy"); + while(e.hasNext()) { + var e1 = e.next(); + var c = com_davidmaletz_mining_item_ItemCategory.parse(e1.get("type")); + if(c != null && c != com_davidmaletz_mining_item_ItemCategory.none) { + buy_types.set(c.index,true); + } + } + return buy_types; +}; +com_davidmaletz_mining_structure_Market.__super__ = com_davidmaletz_mining_structure_Structure; +com_davidmaletz_mining_structure_Market.prototype = $extend(com_davidmaletz_mining_structure_Structure.prototype,{ + restock_ct: null + ,restock_message: null + ,price: null + ,buy_types: null + ,hasInventory: function() { + return true; + } + ,accessInventory: function() { + return null; + } + ,onDismantle: function(p) { + } + ,canReadInventory: function(version) { + return true; + } + ,_addItem: function(e,mul) { + var min = Math.round(com_davidmaletz_mining_Main.parseInt(e.get("min")) * mul); + var max = Math.round(com_davidmaletz_mining_Main.parseInt(e.get("max")) * mul); + var ct = max - min >= 5 ? Math.round(Math.random() * (max - min) / 5) * 5 + min : Math.round(Math.random() * (max - min)) + min; + var i = com_davidmaletz_mining_item_ItemInfo._get(e.get("id")); + if(ct > 0 && i != null) { + this.inventory.addItems(i,ct); + } + } + ,restock: function() { + var vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(com_davidmaletz_mining_Main.getLocalPlayer()); + this.restock_message = false; + this.restock_ct = com_davidmaletz_faengfl_EventHandler.execute(this.info.xml.get("restock"),vars); + this.inventory.clear(); + var mul = this.info.xml.exists("multiplyStock") ? com_davidmaletz_faengfl_EventHandler.execute(this.info.xml.get("multiplyStock"),vars) : 1; + var e = this.info.xml.elementsNamed("item"); + while(e.hasNext()) { + var e1 = e.next(); + if(!e1.exists("if")) { + this._addItem(e1,mul); + } + } + var select = this.info.xml.elementsNamed("select"); + while(select.hasNext()) { + var select1 = select.next(); + var count = com_davidmaletz_mining_Main.parseInt(select1.get("count")); + var ar = []; + var e2 = select1.elementsNamed("item"); + while(e2.hasNext()) { + var e3 = e2.next(); + ar.push(e3); + } + com_fancyfish_faeng_common_Utils.shuffle(ar,Math.random); + if(count > ar.length) { + count = ar.length; + } + var _g1 = 0; + var _g = count; + while(_g1 < _g) { + var i = _g1++; + this._addItem(ar[i],mul); + } + } + this.dispatchEvent(new openfl_events_Event("restock")); + } + ,addedToArea: function(area,built) { + com_davidmaletz_mining_structure_Structure.prototype.addedToArea.call(this,area,built); + area.addEventListener("tick",$bind(this,this.handleTick)); + } + ,removedFromArea: function(area) { + com_davidmaletz_mining_structure_Structure.prototype.removedFromArea.call(this,area); + area.removeEventListener("tick",$bind(this,this.handleTick)); + } + ,partial: null + ,handleTick: function(e) { + var frames = e.value; + if(frames > 0) { + var f = Math.floor(frames); + this.partial += frames - f; + if(this.partial >= 1) { + ++f; + this.partial -= 1; + } + this.restockTick(f); + } + } + ,restockTick: function(f) { + this.restock_ct -= f; + if(this.restock_ct <= 0) { + this.restock(); + } + } + ,createRenderer: function() { + return new com_davidmaletz_mining_structure__$Market_MarketRenderer(this); + } + ,onOperate: function(p) { + com_davidmaletz_mining_structure_Structure.prototype.onOperate.call(this,p); + var vars = null; + var map = new haxe_ds_StringMap(); + var e = this.info.xml.elementsNamed("item"); + while(e.hasNext()) { + var e1 = e.next(); + if(e1.exists("if")) { + if(vars == null) { + vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(p); + vars.set("this",this); + } + var i = com_davidmaletz_mining_item_ItemInfo._get(e1.get("id")); + if(i != null) { + this.inventory.setItemCount(i,com_davidmaletz_faengfl_EventHandler._conditionMet(e1.get("if"),vars) ? com_davidmaletz_mining_Main.parseInt(e1.get("max")) : 0); + } + } + if(e1.exists("achievement")) { + map.set(e1.get("id"),e1.get("achievement")); + } + } + var select = this.info.xml.elementsNamed("select"); + while(select.hasNext()) { + var select1 = select.next(); + var e2 = select1.elementsNamed("item"); + while(e2.hasNext()) { + var e3 = e2.next(); + if(e3.exists("achievement")) { + map.set(e3.get("id"),e3.get("achievement")); + } + } + } + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_StoreWindow(p,p.storehouseInventory,this.inventory,c,this.buy_types,this.price,map),2); + var r = this.info.xml.get("restockMessage"); + var m = com_fancyfish_faeng_common_Lang.getTextFromTitle(r); + if((r == null || m != null) && !this.restock_message && this.restock_ct < 1000) { + this.restock_message = true; + c.addDisplay(new com_davidmaletz_mining_ui_DialogueBox(c,m == null ? com_fancyfish_faeng_common_Lang.getText("market","restock").get() : m.get()),3); + } + } + ,upgradeFrom: function(s) { + } + ,write: function(b) { + com_davidmaletz_mining_structure_Structure.prototype.write.call(this,b); + b.writeUInt16(this.restock_ct); + } + ,read: function(b,version,parent) { + com_davidmaletz_mining_structure_Structure.prototype.read.call(this,b,version,parent); + this.restock_ct = b.readUInt16(); + } + ,__class__: com_davidmaletz_mining_structure_Market +}); +var com_davidmaletz_mining_structure__$Market_MarketRenderer = function(market) { + com_davidmaletz_tiles_render_PlayAnimation.call(this,market.info.tile,market.getIdle(),10,false,$bind(market,market.checkIdle)); + this.market = market; + var xml = market.info.xml; + var g = xml.get("show_offers"); + if(g != null) { + try { + this.show_offers = com_davidmaletz_faengfl_EventHandler.parseString(g); + } catch( e ) { + haxe_CallStack.lastException = e; + } + } + this.addChild(new com_davidmaletz_mining_renderer_ItemBubble((market.info.width >> 1) + (xml.exists("speechX") ? com_davidmaletz_mining_Main.parseInt(xml.get("speechX")) : 0),market.info.height - 35 + (xml.exists("speechY") ? com_davidmaletz_mining_Main.parseInt(xml.get("speechY")) : 0),this)); +}; +$hxClasses["com.davidmaletz.mining.structure._Market.MarketRenderer"] = com_davidmaletz_mining_structure__$Market_MarketRenderer; +com_davidmaletz_mining_structure__$Market_MarketRenderer.__name__ = ["com","davidmaletz","mining","structure","_Market","MarketRenderer"]; +com_davidmaletz_mining_structure__$Market_MarketRenderer.__super__ = com_davidmaletz_tiles_render_PlayAnimation; +com_davidmaletz_mining_structure__$Market_MarketRenderer.prototype = $extend(com_davidmaletz_tiles_render_PlayAnimation.prototype,{ + market: null + ,show_offers: null + ,vars: null + ,getNextItem: function() { + var ar = []; + var i = this.market.inventory.getItems(); + while(i.hasNext()) { + var i1 = i.next(); + ar.push(i1); + } + if(ar.length > 0) { + if(this.show_offers == null || com_davidmaletz_faengfl_EventHandler.interpret(this.show_offers,this.makeVars()) == true) { + return ar[Math.floor(Math.random() * ar.length)].item; + } + } + return null; + } + ,makeVars: function() { + if(this.vars == null) { + this.vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(com_davidmaletz_mining_Main.getLocalPlayer()); + this.vars.set("this",this.market); + } + return this.vars; + } + ,__class__: com_davidmaletz_mining_structure__$Market_MarketRenderer +}); +var com_davidmaletz_mining_structure_Modify = function(info,x,y) { + com_davidmaletz_mining_structure_Structure.call(this,info,x,y); + this.slots = []; + var _g = 0; + while(_g < 2) { + var i = _g++; + this.slots.push(new com_davidmaletz_mining_structure_Slot()); + } + this.modifySlot = info.xml.get("modifySlot"); + if(this.modifySlot == null) { + this.modifySlot = "familiar"; + } +}; +$hxClasses["com.davidmaletz.mining.structure.Modify"] = com_davidmaletz_mining_structure_Modify; +com_davidmaletz_mining_structure_Modify.__name__ = ["com","davidmaletz","mining","structure","Modify"]; +com_davidmaletz_mining_structure_Modify.__interfaces__ = [com_davidmaletz_mining_structure_SlotList]; +com_davidmaletz_mining_structure_Modify.__super__ = com_davidmaletz_mining_structure_Structure; +com_davidmaletz_mining_structure_Modify.prototype = $extend(com_davidmaletz_mining_structure_Structure.prototype,{ + slots: null + ,modifySlot: null + ,getSlot: function(i) { + if(i < this.slots.length) { + return this.slots[i]; + } else { + return null; + } + } + ,canModify: function(i) { + if(i.xml.exists("range")) { + return false; + } + if(!((this.modifySlot == "all" && i.hasActionId("equip") || i.xml.get("slot") == this.modifySlot) && i.xml.get("canModify") != "false")) { + return i.xml.get("canModify") == "true"; + } else { + return true; + } + } + ,onOperate: function(p) { + com_davidmaletz_mining_structure_Structure.prototype.onOperate.call(this,p); + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(this.makeWindow(new com_davidmaletz_mining_ui_ModifyWindow(p.getInv(true),c,p,this),p),2); + } + ,slotCreates: function(p) { + var i = this.slots[0].getItem(p); + var m = this.slots[1].getItem(p); + if(i == null || m == null) { + return null; + } + var e = m.info.xml.elementsNamed("modifyTransform"); + while(e.hasNext()) { + var e1 = e.next(); + if(e1.get("from") == i.info.id) { + var to = com_davidmaletz_mining_item_ItemInfo.get(e1.get("to")); + if(to != null) { + return new com_davidmaletz_mining_item_Item(to,0,i.getNameStr()); + } + } + } + if(!m.info.canModify(i.info) || com_davidmaletz_mining_item_ItemInfo.getParameter(i.getNameStr(),"m") == m.info.id) { + return null; + } else { + return new com_davidmaletz_mining_item_Item(i.info,i.value,com_davidmaletz_mining_item_ItemInfo.setParameter(i.getNameStr(),"m",m.info.id)); + } + } + ,craft: function(p) { + var i = this.slotCreates(p); + var _g = 0; + var _g1 = this.slots; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + s._setItem(null); + } + p.addItems(i.info,1,i.value,i.getNameStr()); + p.addExp(2); + } + ,upgradeFrom: function(s) { + com_davidmaletz_mining_structure_Structure.prototype.upgradeFrom.call(this,s); + if(Std["is"](s,com_davidmaletz_mining_structure_Modify)) { + var p = js_Boot.__cast(s , com_davidmaletz_mining_structure_Modify); + var len = com_fancyfish_faeng_common_Utils.min(this.slots.length,p.slots.length); + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + this.slots[i]._setItem(p.slots[i].getItem(null)); + } + } + } + ,onDismantle: function(p) { + com_davidmaletz_mining_structure_Structure.prototype.onDismantle.call(this,p); + var _g = 0; + var _g1 = this.slots; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + s.setItem(p,null); + } + } + ,write: function(b) { + com_davidmaletz_mining_structure_Structure.prototype.write.call(this,b); + b.writeByte(this.slots.length); + var _g = 0; + var _g1 = this.slots; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + com_davidmaletz_mining_item_Item.write(b,s.getItem(null)); + } + } + ,read: function(b,version,parent) { + com_davidmaletz_mining_structure_Structure.prototype.read.call(this,b,version,parent); + var i = 0; + var len = b.readByte() & 255; + var r; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i1 = _g1++; + var s = com_davidmaletz_mining_item_Item.read(b,version); + if(i1 < this.slots.length) { + this.slots[i1]._setItem(s); + } + } + } + ,__class__: com_davidmaletz_mining_structure_Modify +}); +var com_davidmaletz_mining_structure_Pen = function(info,x,y) { + this.partial = 0; + com_davidmaletz_mining_structure_FarmBase.call(this,info,x,y); + var ct = com_davidmaletz_mining_Main.parseInt(info.xml.get("animals")); + var _g1 = 0; + var _g = ct; + while(_g1 < _g) { + var i = _g1++; + this.addSlot(new com_davidmaletz_mining_item_Animal(this,$bind(this,this.acceptAnimal),info.xml.get("prefix"))); + } + this.house = new haxe_ds_StringMap(); + var e = info.xml.elementsNamed("animal"); + while(e.hasNext()) { + var e1 = e.next(); + this.house.set(e1.get("id"),true); + } + this.attachFarm = new haxe_ds_StringMap(); + if(info.xml.exists("attachFarm")) { + this.attachFarm.set(info.xml.get("attachFarm"),true); + } + var e2 = info.xml.elementsNamed("attachFarm"); + while(e2.hasNext()) { + var e3 = e2.next(); + this.attachFarm.set(e3.get("id"),true); + } +}; +$hxClasses["com.davidmaletz.mining.structure.Pen"] = com_davidmaletz_mining_structure_Pen; +com_davidmaletz_mining_structure_Pen.__name__ = ["com","davidmaletz","mining","structure","Pen"]; +com_davidmaletz_mining_structure_Pen.__interfaces__ = [com_davidmaletz_mining_structure_IFarmUpgrade]; +com_davidmaletz_mining_structure_Pen.__super__ = com_davidmaletz_mining_structure_FarmBase; +com_davidmaletz_mining_structure_Pen.prototype = $extend(com_davidmaletz_mining_structure_FarmBase.prototype,{ + house: null + ,attachFarm: null + ,addedToArea: function(area,built) { + com_davidmaletz_mining_structure_FarmBase.prototype.addedToArea.call(this,area,built); + var id = this.attachFarm.keys(); + while(id.hasNext()) { + var id1 = id.next(); + var ar = area.getStructuresById(id1); + var _g = 0; + while(_g < ar.length) { + var farm = ar[_g]; + ++_g; + if(Std["is"](farm,com_davidmaletz_mining_structure_Farm)) { + (js_Boot.__cast(farm , com_davidmaletz_mining_structure_Farm)).__dirty = true; + } + } + } + area.addEventListener("tick",$bind(this,this._handleTick)); + } + ,removedFromArea: function(area) { + com_davidmaletz_mining_structure_FarmBase.prototype.removedFromArea.call(this,area); + var id = this.attachFarm.keys(); + while(id.hasNext()) { + var id1 = id.next(); + var ar = area.getStructuresById(id1); + var _g = 0; + while(_g < ar.length) { + var farm = ar[_g]; + ++_g; + if(Std["is"](farm,com_davidmaletz_mining_structure_Farm)) { + (js_Boot.__cast(farm , com_davidmaletz_mining_structure_Farm)).__dirty = true; + } + } + } + area.removeEventListener("tick",$bind(this,this._handleTick)); + } + ,sendToBack: function() { + if(com_davidmaletz_mining_structure_FarmBase.prototype.sendToBack.call(this)) { + var id = this.attachFarm.keys(); + while(id.hasNext()) { + var id1 = id.next(); + var ar = this.area.getStructuresById(id1); + var _g = 0; + while(_g < ar.length) { + var farm = ar[_g]; + ++_g; + if(Std["is"](farm,com_davidmaletz_mining_structure_Farm)) { + (js_Boot.__cast(farm , com_davidmaletz_mining_structure_Farm)).shiftUpgrade(this); + } + } + } + return true; + } else { + return false; + } + } + ,partial: null + ,_handleTick: function(e) { + var frames = e.value; + if(frames > 0) { + var f = Math.floor(frames); + this.partial += frames - f; + if(this.partial >= 1) { + ++f; + this.partial -= 1; + } + this.handleTick(f); + } + } + ,upgradeFrom: function(s) { + if(Std["is"](s,com_davidmaletz_mining_structure_Pen)) { + var p = js_Boot.__cast(s , com_davidmaletz_mining_structure_Pen); + var len = com_fancyfish_faeng_common_Utils.min(this.crops.length,p.crops.length); + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + this.getAnimal(i).setItem(p.getAnimal(i).getItem(null)); + } + } + com_davidmaletz_mining_structure_FarmBase.prototype.upgradeFrom.call(this,s); + } + ,addFarm: function(f) { + if(this.attachFarm.exists(f.info.id)) { + f.addUpgrade(this); + } + } + ,loadXML: function(xml,vars) { + com_davidmaletz_mining_structure_FarmBase.prototype.loadXML.call(this,xml,vars); + var i = 0; + var len = this.crops.length; + var e = xml.xml.elementsNamed("addAnimal"); + while(e.hasNext()) { + var e1 = e.next(); + var count = e1.exists("count") ? com_davidmaletz_mining_Main.parseInt(e1.get("count")) : 1; + var info = com_davidmaletz_mining_item_ItemInfo.get(e1.get("id")); + var value = e1.exists("value") ? info.getDurability() - com_davidmaletz_mining_Main.parseInt(e1.get("value")) : info.getDurability(); + if(info != null) { + var _g1 = 0; + var _g = count; + while(_g1 < _g) { + var j = _g1++; + if(i < len) { + this.getAnimal(i++).setItem(new com_davidmaletz_mining_item_Item(info,value)); + } + } + } + } + } + ,createRenderer: function() { + return new com_davidmaletz_mining_structure_PenRenderer(this); + } + ,acceptAnimal: function(animal) { + return this.house.exists(animal.id); + } + ,onOperate: function(p) { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(this.makeWindow(new com_davidmaletz_mining_ui_FarmWindow(p,this,c),p),2); + } + ,onDismantle: function(p) { + com_davidmaletz_mining_structure_FarmBase.prototype.onDismantle.call(this,p); + var _g = 0; + var _g1 = this.crops; + while(_g < _g1.length) { + var c = _g1[_g]; + ++_g; + if(Std["is"](c,com_davidmaletz_mining_item_Animal)) { + var i = (js_Boot.__cast(c , com_davidmaletz_mining_item_Animal)).getItem(p); + if(i != null) { + p.inventory.addItems(i.info,1,i.value,i.getNameStr()); + } + } + } + } + ,write: function(b) { + com_davidmaletz_mining_structure_FarmBase.prototype.write.call(this,b); + var _g = 0; + var _g1 = this.crops; + while(_g < _g1.length) { + var c = _g1[_g]; + ++_g; + c.write(b); + } + } + ,read: function(b,version,parent) { + com_davidmaletz_mining_structure_FarmBase.prototype.read.call(this,b,version,parent); + if(version < 18) { + if(this.info.id == "wyrm_pen") { + var len = b.readByte() & 255; + var items = []; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + com_fancyfish_faeng_common_UTFUtils.readUTF(b); + items.push(b.readUInt16()); + } + var i1 = 0; + var _g2 = 0; + var _g11 = this.crops; + while(_g2 < _g11.length) { + var a = _g11[_g2]; + ++_g2; + if(version >= 17) { + a.read(b,version); + } else { + a.setCrop(com_davidmaletz_mining_item_CropInfo.get("wyrm")); + } + if(a.hasFarmItem() && i1 < items.length) { + a.items[0].growth = items[i1++]; + } + } + } else { + b.readByte(); + } + } else { + var _g3 = 0; + var _g12 = this.crops; + while(_g3 < _g12.length) { + var c = _g12[_g3]; + ++_g3; + c.read(b,version); + } + } + } + ,onLoad: function(b,version) { + com_davidmaletz_mining_structure_FarmBase.prototype.onLoad.call(this,b,version); + if(version < 18 && this.info.id != "wyrm_pen") { + this.crops[0].setCrop(com_davidmaletz_mining_item_CropInfo.get("pig")); + } + } + ,getAnimal: function(i) { + return this.crops[i]; + } + ,getIdle: function() { + if(this.usePower) { + var p = this.isPowered(); + if(this.renderer != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_structure_PenRenderer)).updatePowered(p); + } + return this.getAnim(p ? "on" : "off"); + } else { + return this.getAnim("idle"); + } + } + ,__class__: com_davidmaletz_mining_structure_Pen +}); +var com_davidmaletz_mining_structure_PenRenderer = function(pen) { + com_davidmaletz_lerp_LerpSpriteFL.call(this); + this.pen = pen; + this.unpowered = []; + this.wasPowered = pen.canFunction(); + var s = pen.info.xml.elementsNamed("sprite"); + while(s.hasNext()) { + var s1 = s.next(); + this.addSprite(s1); + } + var xml = pen.info.xml; + this.addChild(new com_davidmaletz_mining_renderer_ItemBubble((pen.info.width >> 1) + (xml.exists("speechX") ? com_davidmaletz_mining_Main.parseInt(xml.get("speechX")) : 0),pen.info.height - 35 + (xml.exists("speechY") ? com_davidmaletz_mining_Main.parseInt(xml.get("speechY")) : 0),pen)); +}; +$hxClasses["com.davidmaletz.mining.structure.PenRenderer"] = com_davidmaletz_mining_structure_PenRenderer; +com_davidmaletz_mining_structure_PenRenderer.__name__ = ["com","davidmaletz","mining","structure","PenRenderer"]; +com_davidmaletz_mining_structure_PenRenderer.__super__ = com_davidmaletz_lerp_LerpSpriteFL; +com_davidmaletz_mining_structure_PenRenderer.prototype = $extend(com_davidmaletz_lerp_LerpSpriteFL.prototype,{ + pen: null + ,unpowered: null + ,wasPowered: null + ,addSprite: function(xml) { + var e = xml.elements(); + while(e.hasNext()) { + var e1 = e.next(); + var s = null; + var _g = e1.get_nodeName(); + switch(_g) { + case "animal": + var i = com_davidmaletz_mining_Main.parseInt(e1.get("i")); + s = this.pen.getAnimal(i).getRenderer(i == 0); + break; + case "self": + s = com_davidmaletz_mining_structure_Structure.makeRenderer(this.pen,this.pen.info.xml,this.pen.info.tile,this.pen.getIdle(),com_davidmaletz_mining_enemy_AttackRenderer.getFPS(this.pen.info.xml,10),false,this.pen.getVars(com_davidmaletz_mining_Main.getLocalPlayer()),($_=this.pen,$bind($_,$_.checkIdle))); + break; + case "tile": + var t = this.pen.info.tile; + var x = e1.exists("x") ? com_davidmaletz_mining_Main.parseInt(e1.get("x")) : 0; + var y = e1.exists("y") ? com_davidmaletz_mining_Main.parseInt(e1.get("y")) : 0; + if(x != 0 || y != 0) { + t = new com_davidmaletz_tiles_render_TileOffsetRenderer(t,x,y); + } + s = new com_davidmaletz_tiles_render_PlayAnimation(t,e1.exists("animation") ? e1.get("animation") : "single",10,true); + break; + } + if(s != null) { + if(e1.get("showUnpowered") == "false") { + s.set_visible(this.wasPowered); + this.unpowered.push(s); + } + if(e1.exists("offsetX")) { + s.set_x(com_davidmaletz_mining_Main.parseInt(e1.get("offsetX"))); + } + if(e1.exists("offsetY")) { + s.set_y(com_davidmaletz_mining_Main.parseInt(e1.get("offsetY"))); + } + this.addChild(s); + } + } + } + ,updatePowered: function(p) { + if(this.unpowered.length > 0 && this.wasPowered != p) { + this.wasPowered = !this.wasPowered; + var _g = 0; + var _g1 = this.unpowered; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + s.set_visible(this.wasPowered); + } + } + } + ,__class__: com_davidmaletz_mining_structure_PenRenderer +}); +var com_davidmaletz_mining_structure_Powerline = function(info,x,y) { + this._connected = []; + com_davidmaletz_mining_structure_Structure.call(this,info,x,y); + this.lines = new haxe_ds_StringMap(); + var e = info.xml.elementsNamed("line"); + while(e.hasNext()) { + var e1 = e.next(); + this.lines.set(e1.get("to"),new com_fancyfish_faeng_display_IPoint2D(com_davidmaletz_mining_Main.parseInt(e1.get("x")),com_davidmaletz_mining_Main.parseInt(e1.get("y")))); + } +}; +$hxClasses["com.davidmaletz.mining.structure.Powerline"] = com_davidmaletz_mining_structure_Powerline; +com_davidmaletz_mining_structure_Powerline.__name__ = ["com","davidmaletz","mining","structure","Powerline"]; +com_davidmaletz_mining_structure_Powerline.__super__ = com_davidmaletz_mining_structure_Structure; +com_davidmaletz_mining_structure_Powerline.prototype = $extend(com_davidmaletz_mining_structure_Structure.prototype,{ + lines: null + ,powerplant: null + ,_connected: null + ,getFromPoint: function(s) { + var t = s.info.xml.get("type"); + if(t == null) { + return this.lines.get("structure"); + } + var p = this.lines.get(t); + if(p == null) { + return this.lines.get("structure"); + } else { + return p; + } + } + ,getBounds: function() { + var b = com_davidmaletz_mining_structure_Structure.prototype.getBounds.call(this); + var _g = b; + _g.set_left(_g.get_left() - com_davidmaletz_mining_structure__$Powerline_PowerlineRenderer.MAX_DIST); + return b; + } + ,createRenderer: function() { + return new com_davidmaletz_mining_structure__$Powerline_PowerlineRenderer(this); + } + ,addedToArea: function(area,built) { + com_davidmaletz_mining_structure_Structure.prototype.addedToArea.call(this,area,built); + area.addEventListener("add_structure",$bind(this,this.update)); + area.addEventListener("rem_structure",$bind(this,this.remove)); + this.update(null); + } + ,removedFromArea: function(area) { + com_davidmaletz_mining_structure_Structure.prototype.removedFromArea.call(this,area); + area.removeEventListener("add_structure",$bind(this,this.update)); + area.removeEventListener("rem_structure",$bind(this,this.remove)); + } + ,checkStructure: function(s,r) { + if(s == this) { + return false; + } + var b = s.getInnerBounds(); + if(b.get_right() > r.get_right()) { + return false; + } + if(s.info.xml.get("powered") != "true") { + return false; + } + var from = this.getFromPoint(s); + if(from != this.getFromPoint(this)) { + var p = s.info.xml.elementsNamed("powerline"); + var y; + if(p.hasNext()) { + var e = p.next(); + y = s.getRendererY() + com_davidmaletz_mining_Main.parseInt(e.get("y")); + } else { + y = b.y + b.height * 0.5; + } + if(y > r.get_bottom() || y < from.y + this.getRendererY()) { + return false; + } + } + s.addConnection(this); + this.addConnection(s); + this._connected.push(s); + return false; + } + ,remove: function(e) { + this.removeConnection(e.value); + this.update(null); + } + ,update: function(e) { + if(this.area == null) { + return; + } + if(this.connected != null) { + this.filterConnected(); + } + com_fancyfish_faeng_common_Utils.clear(this._connected); + var b = this.getBounds(); + b.x = b.get_right(); + b.width = com_davidmaletz_tiles_Tile.SIZE * 3; + var s = this.area.getStructure(b); + if(s != null && s.info.xml.get("type") == "powerplant") { + this.powerplant = s; + this.addConnection(s); + } else { + this.powerplant = null; + } + this.area.structures.getObjects(this.getBounds(),$bind(this,this.checkStructure)); + if(this.renderer != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_structure__$Powerline_PowerlineRenderer)).update(); + } + } + ,__class__: com_davidmaletz_mining_structure_Powerline +}); +var com_davidmaletz_mining_structure__$Powerline_PowerlineRenderer = function(p) { + com_davidmaletz_tiles_render_PlayAnimation.call(this,p.info.tile,p.getIdle(),10,false,$bind(p,p.checkIdle)); + this.powerline = p; + this.color = com_davidmaletz_mining_Main.parseInt("0x" + p.info.xml.get("color")); +}; +$hxClasses["com.davidmaletz.mining.structure._Powerline.PowerlineRenderer"] = com_davidmaletz_mining_structure__$Powerline_PowerlineRenderer; +com_davidmaletz_mining_structure__$Powerline_PowerlineRenderer.__name__ = ["com","davidmaletz","mining","structure","_Powerline","PowerlineRenderer"]; +com_davidmaletz_mining_structure__$Powerline_PowerlineRenderer.__super__ = com_davidmaletz_tiles_render_PlayAnimation; +com_davidmaletz_mining_structure__$Powerline_PowerlineRenderer.prototype = $extend(com_davidmaletz_tiles_render_PlayAnimation.prototype,{ + powerline: null + ,color: null + ,lines: null + ,init: function(e) { + com_davidmaletz_tiles_render_PlayAnimation.prototype.init.call(this,e); + this.update(); + } + ,addLines: function(s) { + var b = s.getInnerBounds(); + if(this.lines == null) { + this.lines = new openfl_display_Sprite(); + this.addChild(this.lines); + this.lines.get_graphics().lineStyle(1,this.color); + } + if(s.getRendererX() > this.get_x()) { + return; + } + var from = this.powerline.getFromPoint(s); + var g = this.lines.get_graphics(); + g.moveTo(from.x,from.y); + if(from == this.powerline.getFromPoint(this.powerline)) { + g.lineTo(b.get_right() - 1 - this.get_x(),from.y); + } else { + var p = s.info.xml.elementsNamed("powerline"); + var x; + var y; + if(p.hasNext()) { + var e = p.next(); + x = s.getRendererX() + com_davidmaletz_mining_Main.parseInt(e.get("x")); + y = s.getRendererY() + com_davidmaletz_mining_Main.parseInt(e.get("y")); + } else { + x = b.x + b.width * 0.5; + y = b.y + b.height * 0.5; + } + g.lineTo(x - this.get_x(),y - this.get_y()); + } + } + ,update: function() { + if(this.powerline.powerplant != null) { + this.playAnimation(this.powerline.getIdle(),false,($_=this.powerline,$bind($_,$_.checkIdle))); + } else { + this.playAnimation(this.powerline.getAnim("disconnected"),true); + } + if(this.lines != null) { + this.lines.get_graphics().clear(); + this.lines.get_graphics().lineStyle(1,this.color); + } + var ar = this.powerline._connected; + if(ar != null) { + var _g = 0; + while(_g < ar.length) { + var c = ar[_g]; + ++_g; + this.addLines(c); + } + } + } + ,__class__: com_davidmaletz_mining_structure__$Powerline_PowerlineRenderer +}); +var com_davidmaletz_mining_structure_Powerplant = function(info,x,y) { + this.frames = 0; + com_davidmaletz_mining_structure_Fuelable.call(this,info,x,y,2000); + this.house = new haxe_ds_StringMap(); + this.__animal = new com_davidmaletz_mining_structure_Slot(); + this.__animal.addEventListener("updated",$bind(this,this.dispatchEvent)); + var e = info.xml.elementsNamed("animal"); + while(e.hasNext()) { + var e1 = e.next(); + this.house.set(e1.get("id"),true); + } +}; +$hxClasses["com.davidmaletz.mining.structure.Powerplant"] = com_davidmaletz_mining_structure_Powerplant; +com_davidmaletz_mining_structure_Powerplant.__name__ = ["com","davidmaletz","mining","structure","Powerplant"]; +com_davidmaletz_mining_structure_Powerplant.__interfaces__ = [com_davidmaletz_mining_structure_SlotList,com_davidmaletz_mining_item_ItemValue]; +com_davidmaletz_mining_structure_Powerplant.__super__ = com_davidmaletz_mining_structure_Fuelable; +com_davidmaletz_mining_structure_Powerplant.prototype = $extend(com_davidmaletz_mining_structure_Fuelable.prototype,{ + __animal: null + ,house: null + ,getSlot: function(i) { + if(i == 0) { + return this.__animal; + } else { + return null; + } + } + ,get_animal: function() { + return this.__animal.getItem(null); + } + ,set_animal: function(i) { + this.__animal._setItem(i); + return i; + } + ,addedToArea: function(area,built) { + com_davidmaletz_mining_structure_Fuelable.prototype.addedToArea.call(this,area,built); + area.addEventListener("tick",$bind(this,this.handleTick)); + } + ,removedFromArea: function(area) { + com_davidmaletz_mining_structure_Fuelable.prototype.removedFromArea.call(this,area); + area.removeEventListener("tick",$bind(this,this.handleTick)); + } + ,frames: null + ,handleTick: function(e) { + this.frames += e.value; + if(this.frames >= 200) { + this.frames -= 200; + this.useFuel(); + } + } + ,getUsableFuel: function() { + var f = this.getFuel(); + if(this.get_animal() != null) { + f += Math.floor((this.get_animal().getDurability() - this.get_animal().value) / 10); + } + return f; + } + ,getAnimation: function() { + return this.getAnim(this.isPowered() ? "on" : "off"); + } + ,getIdle: function() { + return this.getAnimation(); + } + ,isPowered: function(ar) { + if(!this.hasFuel()) { + if(this.get_animal() != null) { + return this.get_animal().value < this.get_animal().getDurability(); + } else { + return false; + } + } else { + return true; + } + } + ,canConnectPower: function() { + return true; + } + ,useFuel: function(ct) { + if(ct == null) { + ct = 1; + } + if(this.get_animal() != null) { + var max = this.get_animal().getDurability() - this.get_animal().value; + var v = ct * 10; + if(v > max) { + v = max; + } + ct -= Math.floor(v / 10); + this.increaseValue(null,v); + this.updateAnim(); + } + if(ct > 0) { + com_davidmaletz_mining_structure_Fuelable.prototype.useFuel.call(this,ct); + } + } + ,acceptAnimal: function(animal) { + return this.house.exists(animal.id); + } + ,selectAnimal: function(window,player) { + if(this.get_animal() == null) { + this._onSelect(player); + } else if(com_davidmaletz_faengfl_adv_AdvApp.shiftDown) { + this.setAnimal(player,null); + } else { + var c = com_davidmaletz_mining_Main.getContainer(); + var ids = []; + var funcs = []; + this.get_animal().info.getActionChoices(ids,funcs,player,this.get_animal().value,this.get_animal().getNameStr(),window,this,false,true); + ids.push("switch"); + var f = $bind(this,this._onSelect); + var a1 = player; + funcs.push(function() { + f(a1); + }); + if(funcs.length == 1) { + funcs[0](); + } else { + ids.push("common.remove"); + var f1 = $bind(this,this.setAnimal); + var p = player; + funcs.push(function() { + f1(p,null); + }); + c.addDisplay(new com_davidmaletz_mining_ui_Choice(c,"actions",ids,funcs),2); + } + } + } + ,setName: function(p,n) { + if(this.get_animal() != null) { + this.get_animal().setName(n); + } + } + ,increaseValue: function(p,dv) { + if(this.get_animal() != null) { + var v = this.get_animal().value + dv; + var d = this.get_animal().getDurability(); + if(v < 0) { + v = 0; + } else if(v > d) { + v = d; + } + this.get_animal().setValue(v); + } + } + ,remove: function(p) { + this.setAnimal(p,null); + } + ,getItem: function(p) { + return this.get_animal(); + } + ,setAnimal: function(p,i) { + if(this.get_animal() != null) { + p.inventory.addItems(this.get_animal().info,1,this.get_animal().value,this.get_animal().getNameStr()); + this.set_animal(null); + } + if(i != null && i.count > 0) { + i.inventory.addItems(i.item,-1,i.value,i.name); + this.set_animal(new com_davidmaletz_mining_item_Item(i.item,i.value,i.name)); + } + } + ,_onSelect: function(player) { + var c = com_davidmaletz_mining_Main.getContainer(); + var f = $bind(this,this.setAnimal); + var p = player; + var tmp = function(i) { + f(p,i); + }; + c.addDisplay(new com_davidmaletz_mining_ui_ItemList(c,player.getInv(true),com_fancyfish_faeng_common_Lang.getText("common","add_animal"),player.includeCost(),$bind(this,this.acceptAnimal),tmp,true,com_fancyfish_faeng_common_Lang.getText("common","none")),2); + } + ,onOperate: function(p) { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(this.makeWindow(new com_davidmaletz_mining_structure__$Powerplant_PowerplantWindow(p.getInv(true),this.getTitle(p),this,c,p,this.info.xml.get("fuelName")),p),2); + } + ,_removeBy: function(p) { + this.setAnimal(p,null); + } + ,createRenderer: function() { + return new com_davidmaletz_mining_structure__$Powerplant_PowerplantRenderer(this); + } + ,write: function(b) { + com_davidmaletz_mining_structure_Fuelable.prototype.write.call(this,b); + com_davidmaletz_mining_item_Item.write(b,this.get_animal()); + } + ,read: function(b,version,parent) { + com_davidmaletz_mining_structure_Fuelable.prototype.read.call(this,b,version,parent); + if(version >= 40) { + this.set_animal(com_davidmaletz_mining_item_Item.read(b,version)); + } + } + ,__class__: com_davidmaletz_mining_structure_Powerplant + ,__properties__: $extend(com_davidmaletz_mining_structure_Fuelable.prototype.__properties__,{set_animal:"set_animal",get_animal:"get_animal"}) +}); +var com_davidmaletz_mining_structure__$Powerplant_PowerplantRenderer = function(powerplant) { + this.repeat = 2; + com_davidmaletz_tiles_render_PlayAnimation.call(this,powerplant.info.tile,powerplant.getAnimation(),10,true); + this.powerplant = powerplant; + this.animal = new openfl_display_Sprite(); + this.addChildAt(this.animal,0); +}; +$hxClasses["com.davidmaletz.mining.structure._Powerplant.PowerplantRenderer"] = com_davidmaletz_mining_structure__$Powerplant_PowerplantRenderer; +com_davidmaletz_mining_structure__$Powerplant_PowerplantRenderer.__name__ = ["com","davidmaletz","mining","structure","_Powerplant","PowerplantRenderer"]; +com_davidmaletz_mining_structure__$Powerplant_PowerplantRenderer.__super__ = com_davidmaletz_tiles_render_PlayAnimation; +com_davidmaletz_mining_structure__$Powerplant_PowerplantRenderer.prototype = $extend(com_davidmaletz_tiles_render_PlayAnimation.prototype,{ + powerplant: null + ,animal: null + ,item: null + ,repeat: null + ,advanceFrame: function(df) { + com_davidmaletz_tiles_render_PlayAnimation.prototype.advanceFrame.call(this,df); + this.repeat -= df; + if(this.repeat > 0) { + return; + } else { + this.repeat += 2; + } + if(this.item != null && this.animal.get_numChildren() > 0 && (js_Boot.__cast(this.animal.getChildAt(0) , com_davidmaletz_tiles_render_PlayAnimation)).animation == "adult_dragon.hover_fire") { + var d = com_davidmaletz_tiles_Tile.get("adult_dragon"); + var t = com_davidmaletz_tiles_Tile.get("fire"); + var s = com_davidmaletz_tiles_Tile.makeIcon(t,-t.getWidth() * 0.5 / com_davidmaletz_tiles_Tile.SIZE,-t.getHeight() * 0.5 / com_davidmaletz_tiles_Tile.SIZE,Math.floor(8 * Math.random()),0); + com_davidmaletz_faengfl_TextSprite.setColor(s,16367115,255,1,2); + var l = new com_davidmaletz_lerp_LerpSpriteFL(); + l.set_x(33 + d.getWidth() * 0.5); + l.set_y(-5 + d.getHeight() * 0.5); + l.addChild(s); + var d1 = l; + var tmp = function() { + com_davidmaletz_faengfl_FaengFL.remove(d1); + }; + l.lerp(new com_davidmaletz_lerp_PositionKeyframe(l.get_x() + 15,l.get_y() + 37),12,tmp); + l.lerp(new com_davidmaletz_lerp_ScaleKeyframe(1.5,1.5),12); + this.animal.addChild(l); + } + } + ,init: function(e) { + com_davidmaletz_tiles_render_PlayAnimation.prototype.init.call(this,e); + this.powerplant.addEventListener("updated",$bind(this,this.update)); + this.update(null); + } + ,destroy: function(e) { + com_davidmaletz_tiles_render_PlayAnimation.prototype.destroy.call(this,e); + this.powerplant.removeEventListener("updated",$bind(this,this.update)); + if(this.item != null) { + this.item.removeEventListener("update_value",$bind(this,this.checkFood)); + this.item = null; + } + } + ,update: function(e) { + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this.animal); + if(this.item != null) { + this.item.removeEventListener("update_value",$bind(this,this.checkFood)); + this.item = null; + } + if(this.powerplant.get_animal() != null) { + this.item = this.powerplant.get_animal(); + this.item.addEventListener("update_value",$bind(this,this.checkFood)); + var r = new com_davidmaletz_tiles_render_PlayAnimation(com_davidmaletz_tiles_Tile.get("adult_dragon"),"single",10,true,null,-1); + r.set_scaleX(-1); + this.animal.addChild(r); + this.checkFood(null); + } + this.powerplant.updateAnim(); + } + ,checkFood: function(e) { + if(this.item == null || this.animal.get_numChildren() == 0) { + return; + } + var p = js_Boot.__cast(this.animal.getChildAt(0) , com_davidmaletz_tiles_render_PlayAnimation); + var anim = this.item.getDurability() <= this.item.value + 1 ? "adult_dragon.sleep" : "adult_dragon.hover_fire"; + if(p.animation != anim) { + p.playAnimation(anim,true,null,-1); + this.animal.set_y(anim == "adult_dragon.sleep" ? 3 : -20); + } + } + ,__class__: com_davidmaletz_mining_structure__$Powerplant_PowerplantRenderer +}); +var com_davidmaletz_mining_ui_FuelWindow = function(inventory,label,s,c,p,fuelName,xml,r) { + this.fuelName = fuelName == null ? "fuel" : fuelName; + this.structure = s; + if(r == null) { + r = com_davidmaletz_mining_ui_CraftingWindow.getRecipes(p,xml); + } else { + r = new com_fancyfish_faeng_common_DoubleIterator(r,com_davidmaletz_mining_ui_CraftingWindow.getRecipes(p,xml)); + } + var p1 = p; + var a1 = xml; + var o = s; + var tmp = function(r1) { + return com_davidmaletz_mining_ui_CraftingWindow._onCraft(p1,a1,o,r1); + }; + com_davidmaletz_mining_ui_CraftingWindow.call(this,false,r,label,inventory,c,p.includeCost(),xml.elementPathsNamed("listItem"),s,tmp,null,fuelName); + com_davidmaletz_mining_ui_FuelWindow.addFuelDisplay(this,s,fuelName); +}; +$hxClasses["com.davidmaletz.mining.ui.FuelWindow"] = com_davidmaletz_mining_ui_FuelWindow; +com_davidmaletz_mining_ui_FuelWindow.__name__ = ["com","davidmaletz","mining","ui","FuelWindow"]; +com_davidmaletz_mining_ui_FuelWindow.addFuelDisplay = function(wnd,s,fuelName) { + if(fuelName == null) { + fuelName = "fuel"; + } + var fuel = new com_davidmaletz_mining_ui_Fuel(s,92,fuelName); + fuel.set_x(wnd.__width + 4 + 2); + fuel.addChildAt(com_davidmaletz_mining_Main.window_factory.create(100,fuel._height + 8).create(-4,-4),0); + fuel.set_y(wnd.__height - fuel._height - 4); + wnd.addChildAt(fuel,0); +}; +com_davidmaletz_mining_ui_FuelWindow.addFuel = function(fuelable,inv,recipe,fuelName,onComplete) { + if(fuelable.getFuelPercent() >= 1) { + com_davidmaletz_faengfl_adv_sound_Sound.play("warning"); + new com_davidmaletz_faengfl_ui_Popup(128.,52.,0,com_davidmaletz_mining_ui_FuelWindow.getMaxFuel(fuelName),16720418); + return; + } + var max = inv.maxCraft(com_davidmaletz_mining_Main.getLocalPlayer(),recipe); + if(max == 0) { + com_davidmaletz_faengfl_adv_sound_Sound.play("warning"); + new com_davidmaletz_faengfl_ui_Popup(128.,52.,0,com_fancyfish_faeng_common_Lang.getText("warning","ingredients"),16720418); + return; + } + var v = (fuelable.getMaxFuel() - fuelable.getFuel()) / recipe.fuel; + var m = Math.ceil(v); + var mf = Math.floor(v); + if(m < max) { + max = m; + } + if(com_davidmaletz_mining_Main.NO_COUNT || com_davidmaletz_faengfl_adv_AdvApp.shiftDown) { + com_davidmaletz_mining_ui_FuelWindow.doFuel(fuelable,inv,recipe,onComplete,1); + } else { + var c = com_davidmaletz_mining_Main.getContainer(); + var a1 = fuelable; + var a2 = inv; + var a3 = recipe; + var a4 = onComplete; + var tmp = function(ct) { + com_davidmaletz_mining_ui_FuelWindow.doFuel(a1,a2,a3,a4,ct); + }; + c.addDisplay(new com_davidmaletz_mining_ui_ItemCountPrompt(c,recipe.getFirstRequirement(),max,com_fancyfish_faeng_common_Lang.getText("common","use_count"),com_fancyfish_faeng_common_Utils.min(mf,max),tmp),2); + } +}; +com_davidmaletz_mining_ui_FuelWindow.doFuel = function(fuelable,inv,recipe,onComplete,ct) { + if(ct > 0 && inv.useIngredients(recipe,ct)) { + recipe.gainAchievement(); + fuelable.playFuelSFX(); + fuelable.addFuel(recipe.fuel * ct); + onComplete(recipe,ct); + } +}; +com_davidmaletz_mining_ui_FuelWindow.getMaxFuel = function(fuelName) { + return com_fancyfish_faeng_common_Lang.getText("warning","max_" + fuelName); +}; +com_davidmaletz_mining_ui_FuelWindow.__super__ = com_davidmaletz_mining_ui_CraftingWindow; +com_davidmaletz_mining_ui_FuelWindow.prototype = $extend(com_davidmaletz_mining_ui_CraftingWindow.prototype,{ + structure: null + ,fuelName: null + ,fuelAdded: function(recipe,ct) { + this.list.update(null); + this.details.setInfo(null); + this.onHover(recipe); + } + ,onSelect: function(recipe) { + if(recipe.creates != null) { + com_davidmaletz_mining_ui_CraftingWindow.prototype.onSelect.call(this,recipe); + } else { + com_davidmaletz_mining_ui_FuelWindow.addFuel(this.structure,this.list.inventory,recipe,this.fuelName,$bind(this,this.fuelAdded)); + } + } + ,onHover: function(recipe) { + this.details.setRecipe(recipe,this.list.inventory,this.fuelName); + } + ,__class__: com_davidmaletz_mining_ui_FuelWindow +}); +var com_davidmaletz_mining_structure__$Powerplant_PowerplantWindow = function(inventory,label,s,c,p,fuelName) { + com_davidmaletz_mining_ui_FuelWindow.call(this,inventory,label,s,c,p,fuelName,s.info.xml); + var PAD = 4; + this.feed = new com_davidmaletz_mining_ui_Fuel(this,92,"feed"); + this.feed.set_x(this.details.get_x() + PAD); + var ht = com_davidmaletz_mining_ui_StringRenderer._getHeight(); + this.feedLabel = new openfl_display_Sprite(); + this.feedLabel.set_y(-ht); + ht += 2; + this.feed.addChild(this.feedLabel); + this.feed.addChildAt(com_davidmaletz_mining_Main.window_factory.create(92 + PAD * 2,this.feed._height + PAD * 2 + ht).create(-PAD,-PAD - ht),0); + this.feed.set_y(this.getHeight() - (this.feed._height + PAD * 2) * 2); + this.addChildAt(this.feed,0); +}; +$hxClasses["com.davidmaletz.mining.structure._Powerplant.PowerplantWindow"] = com_davidmaletz_mining_structure__$Powerplant_PowerplantWindow; +com_davidmaletz_mining_structure__$Powerplant_PowerplantWindow.__name__ = ["com","davidmaletz","mining","structure","_Powerplant","PowerplantWindow"]; +com_davidmaletz_mining_structure__$Powerplant_PowerplantWindow.__interfaces__ = [com_davidmaletz_mining_structure_IFuelable]; +com_davidmaletz_mining_structure__$Powerplant_PowerplantWindow.__super__ = com_davidmaletz_mining_ui_FuelWindow; +com_davidmaletz_mining_structure__$Powerplant_PowerplantWindow.prototype = $extend(com_davidmaletz_mining_ui_FuelWindow.prototype,{ + feed: null + ,item: null + ,feedLabel: null + ,init: function(e) { + com_davidmaletz_mining_ui_FuelWindow.prototype.init.call(this,e); + this.structure.addEventListener("updated",$bind(this,this.update)); + this.update(null); + } + ,destroy: function(e) { + com_davidmaletz_mining_ui_FuelWindow.prototype.destroy.call(this,e); + this.structure.removeEventListener("updated",$bind(this,this.update)); + if(this.item != null) { + this.item.removeEventListener("update_value",$bind(this,this.dispatch)); + this.item = null; + } + } + ,addItems: function() { + var p = js_Boot.__cast(this.structure , com_davidmaletz_mining_structure_Powerplant); + var i = p; + if(p.house.iterator().hasNext()) { + this.list.addMixedItem(i,new com_davidmaletz_mining_ui_ItemValueRenderer(new com_davidmaletz_mining_structure__$Powerplant_Handler(this),com_fancyfish_faeng_common_Lang.getText("equipment","familiar"),this.list.getRenderer().getWidth())); + } + } + ,getFuel: function() { + var a = (js_Boot.__cast(this.structure , com_davidmaletz_mining_structure_Powerplant)).get_animal(); + if(a != null) { + return a.getDurability() - a.value; + } else { + return 0; + } + } + ,getUsableFuel: function() { + return this.getFuel(); + } + ,getFuelName: function() { + return "feed"; + } + ,playFuelSFX: function() { + com_davidmaletz_faengfl_adv_sound_Sound.play("eat"); + } + ,getMaxFuel: function() { + var a = (js_Boot.__cast(this.structure , com_davidmaletz_mining_structure_Powerplant)).get_animal(); + if(a != null) { + return a.getDurability(); + } else { + return 0; + } + } + ,addFuel: function(f) { + (js_Boot.__cast(this.structure , com_davidmaletz_mining_structure_Powerplant)).increaseValue(null,-f); + } + ,useFuel: function(ct) { + if(ct == null) { + ct = 1; + } + (js_Boot.__cast(this.structure , com_davidmaletz_mining_structure_Powerplant)).increaseValue(null,ct); + } + ,getFuelPercent: function() { + var a = (js_Boot.__cast(this.structure , com_davidmaletz_mining_structure_Powerplant)).get_animal(); + if(a != null) { + return 1 - a.value / a.getDurability(); + } else { + return 0; + } + } + ,getMultiplier: function() { + return 1; + } + ,spawnVehicle: function(r) { + com_davidmaletz_mining_ui_CraftingWindow._spawnVehicle(com_davidmaletz_mining_Main.getLocalPlayer(),(js_Boot.__cast(this.structure , com_davidmaletz_mining_structure_Powerplant)).info.xml,this.structure,r); + } + ,update: function(e) { + if(this.item != null) { + this.item.removeEventListener("update_value",$bind(this,this.dispatch)); + this.item = null; + } + var a = (js_Boot.__cast(this.structure , com_davidmaletz_mining_structure_Powerplant)).get_animal(); + if(a != null) { + this.feed.set_visible(true); + this.item = a; + this.item.addEventListener("update_value",$bind(this,this.dispatch)); + this.dispatch(null); + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this.feedLabel); + com_davidmaletz_mining_ui_ItemRenderer.addItemCentered(this.feedLabel,this.item,46,-2); + } else { + this.feed.set_visible(false); + } + this.onHover(null); + if(e != null) { + this.list.update(null); + } + } + ,dispatch: function(e) { + this.dispatchEvent(new openfl_events_Event("update_fuel")); + } + ,__class__: com_davidmaletz_mining_structure__$Powerplant_PowerplantWindow +}); +var com_davidmaletz_mining_structure__$Powerplant_Handler = function(wnd) { + this.wnd = wnd; +}; +$hxClasses["com.davidmaletz.mining.structure._Powerplant.Handler"] = com_davidmaletz_mining_structure__$Powerplant_Handler; +com_davidmaletz_mining_structure__$Powerplant_Handler.__name__ = ["com","davidmaletz","mining","structure","_Powerplant","Handler"]; +com_davidmaletz_mining_structure__$Powerplant_Handler.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_structure__$Powerplant_Handler.prototype = { + wnd: null + ,onSelect: function(item) { + (js_Boot.__cast(item , com_davidmaletz_mining_structure_Powerplant)).selectAnimal(this.wnd,com_davidmaletz_mining_Main.getLocalPlayer()); + } + ,onHover: function(item) { + var details = this.wnd.details; + if(item == null) { + details.setInfo(null); + } else { + details.setInfo(item.getItem(null)); + } + } + ,isEnabled: function(item) { + return true; + } + ,__class__: com_davidmaletz_mining_structure__$Powerplant_Handler +}; +var com_davidmaletz_mining_structure_Storehouse = function(info,x,y) { + this._inventory = com_davidmaletz_faengfl_EventHandler.parseString(info.xml.get("inventory")); + com_davidmaletz_mining_structure_Structure.call(this,info,x,y); +}; +$hxClasses["com.davidmaletz.mining.structure.Storehouse"] = com_davidmaletz_mining_structure_Storehouse; +com_davidmaletz_mining_structure_Storehouse.__name__ = ["com","davidmaletz","mining","structure","Storehouse"]; +com_davidmaletz_mining_structure_Storehouse.__super__ = com_davidmaletz_mining_structure_Structure; +com_davidmaletz_mining_structure_Storehouse.prototype = $extend(com_davidmaletz_mining_structure_Structure.prototype,{ + _inventory: null + ,onOperate: function(p) { + com_davidmaletz_mining_structure_Structure.prototype.onOperate.call(this,p); + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(this.makeWindow(new com_davidmaletz_mining_ui_TransferInventory(p,this.info.xml.get("includeMain") == "true" ? p.storehouseInventory : p.inventory,this.accessInventory(),com_fancyfish_faeng_common_Lang.getText("common","inventory"),this.getTitle(p),c,p.capacity,null,24,true),p),2); + } + ,costFilter: function(maxCost,item) { + if(this.inventory.getItemCount(item) > 1 && item.cost > 0) { + return item.cost <= maxCost; + } else { + return false; + } + } + ,stealItem: function(xml,onComplete) { + var maxCost = xml.exists("maxCost") ? com_davidmaletz_mining_Main.parseInt(xml.get("maxCost")) : 99999; + var f = $bind(this,this.costFilter); + var a1 = maxCost; + var iter = function(a2) { + return f(a1,a2); + }; + var iter1 = this.inventory.getItems(iter); + if(!iter1.hasNext()) { + return 0; + } + var item = iter1.next().item; + this.inventory.addItems(item,-1); + var c = com_davidmaletz_mining_Main.getContainer(); + var wnd = new com_davidmaletz_mining_ui_DialogueBox(c,StringTools.replace(com_fancyfish_faeng_common_Lang.getText("trader","steal").get(),"{item}",item.id),onComplete); + c.addDisplay(wnd,3); + return 3; + } + ,hasInventory: function() { + return true; + } + ,canReadInventory: function(version) { + return this._inventory == null; + } + ,accessInventory: function() { + if(this._inventory != null) { + try { + var ret = com_davidmaletz_faengfl_EventHandler.interpret(this._inventory,this.vars); + if(ret == null) { + return this.inventory; + } else { + return ret; + } + } catch( e ) { + haxe_CallStack.lastException = e; + if (e instanceof js__$Boot_HaxeError) e = e.val; + com_fancyfish_faeng_common_Utils.printExceptionTrace(e); + } + } + return this.inventory; + } + ,__class__: com_davidmaletz_mining_structure_Storehouse +}); +var com_davidmaletz_mining_structure_NotifyEvent = function(type,npc,item,ct,name) { + openfl_events_Event.call(this,type); + this.npc = npc; + this.item = item; + this.ct = ct; + this.name = name; +}; +$hxClasses["com.davidmaletz.mining.structure.NotifyEvent"] = com_davidmaletz_mining_structure_NotifyEvent; +com_davidmaletz_mining_structure_NotifyEvent.__name__ = ["com","davidmaletz","mining","structure","NotifyEvent"]; +com_davidmaletz_mining_structure_NotifyEvent.__super__ = openfl_events_Event; +com_davidmaletz_mining_structure_NotifyEvent.prototype = $extend(openfl_events_Event.prototype,{ + npc: null + ,item: null + ,ct: null + ,name: null + ,__class__: com_davidmaletz_mining_structure_NotifyEvent +}); +var com_davidmaletz_mining_structure_StructureInfo = function(xml) { + this.id = xml.exists("alias") ? xml.get("alias") : xml.get("id"); + var t = com_davidmaletz_mining_structure_StructureInfo.createTile(xml,xml.getPathForAttr("image")); + if(t == null) { + throw new js__$Boot_HaxeError("No tile defined for structure: " + this.id + "!"); + } + this.tile = t.tile; + this.width = t.width; + this.height = t.height; + this.priority = xml.exists("priority") ? com_davidmaletz_mining_Main.parseInt(xml.get("priority")) : 0; + this.playerY = xml.exists("playerY") ? com_davidmaletz_mining_Main.parseInt(xml.get("playerY")) : 0; + this.offsetX = xml.exists("offsetX") ? com_davidmaletz_mining_Main.parseInt(xml.get("offsetX")) : 0; + this.offsetY = xml.exists("offsetY") ? com_davidmaletz_mining_Main.parseInt(xml.get("offsetY")) : 0; + this.room = xml.get("room") == "true"; + var i = xml.elementsNamed("hitbox"); + if(xml.exists("type")) { + var cls = xml.get("type"); + cls = cls.charAt(0).toUpperCase() + HxOverrides.substr(cls,1,null); + var c = Type.resolveClass("com.davidmaletz.mining.structure." + cls); + if(c != null) { + this.type = c; + } + } + this.xml = xml; + var e = xml.elementsNamed("light"); + while(e.hasNext()) { + var e1 = e.next(); + if(this.lights == null) { + this.lights = []; + } + this.lights.push(new com_davidmaletz_mining_world_LightInfo(e1)); + } + var vars = com_davidmaletz_faengfl_EventHandler.createVariables(); + vars.set("this",this); + this.animation = com_davidmaletz_mining_npc_NPCEventHandler.evalString(xml.get("animation"),vars); + if(this.animation == null) { + this.animation = this.id; + } + this.nightAnimation = com_davidmaletz_mining_npc_NPCEventHandler.evalString(xml.get("nightAnimation"),vars); + if(this.nightAnimation == null) { + this.nightAnimation = this.animation; + } + if(i.hasNext()) { + try { + this.hitbox = com_davidmaletz_mining_npc_NPCEventHandler.getRect(i.next(),vars,1); + } catch( e2 ) { + haxe_CallStack.lastException = e2; + if (e2 instanceof js__$Boot_HaxeError) e2 = e2.val; + com_fancyfish_faeng_common_Utils.printExceptionTrace(e2); + } + } +}; +$hxClasses["com.davidmaletz.mining.structure.StructureInfo"] = com_davidmaletz_mining_structure_StructureInfo; +com_davidmaletz_mining_structure_StructureInfo.__name__ = ["com","davidmaletz","mining","structure","StructureInfo"]; +com_davidmaletz_mining_structure_StructureInfo.__interfaces__ = [com_davidmaletz_mining_structure_Buildable]; +com_davidmaletz_mining_structure_StructureInfo.createTile = function(xml,pathForImage) { + if(xml.exists("image") && xml.get("image").length > 0) { + var image = com_davidmaletz_mining_npc_NPCEventHandler.evalString(xml.get("image"),com_davidmaletz_faengfl_EventHandler.createVariables()); + if(image == null) { + image = xml.get("image"); + } + var bitmap = com_davidmaletz_faengfl_AutoTileBitmap.get(com_davidmaletz_mining_Main.getResource(pathForImage,image),xml.exists("width") ? com_davidmaletz_mining_Main.parseInt(xml.get("width")) : -1,xml.exists("height") ? com_davidmaletz_mining_Main.parseInt(xml.get("height")) : -1); + var w = bitmap.tileWidth; + var h = bitmap.tileHeight; + if(xml.exists("tileWidth")) { + w = Math.round(com_davidmaletz_mining_Main.parseFloat(xml.get("tileWidth")) * com_davidmaletz_tiles_Tile.SIZE); + } else if(xml.exists("pixelWidth")) { + w = com_davidmaletz_mining_Main.parseInt(xml.get("pixelWidth")); + } + if(xml.exists("tileHeight")) { + h = Math.round(com_davidmaletz_mining_Main.parseFloat(xml.get("tileHeight")) * com_davidmaletz_tiles_Tile.SIZE); + } else if(xml.exists("pixelHeight")) { + h = com_davidmaletz_mining_Main.parseInt(xml.get("pixelHeight")); + } + var _t = bitmap; + return { tile : _t, width : w, height : h}; + } else if(xml.exists("tile")) { + var vars = com_davidmaletz_faengfl_EventHandler.createVariables(); + var t = com_davidmaletz_mining_npc_NPCEventHandler.evalString(xml.get("tile"),vars); + var tile = com_davidmaletz_tiles_Tile.get(t); + vars.set("tile",tile); + var w1 = xml.exists("width") && xml.get("width").length > 0 ? com_davidmaletz_mining_npc_NPCEventHandler.evalInt(xml.get("width"),vars) : tile.getWidth(); + var h1 = xml.exists("height") && xml.get("height").length > 0 ? com_davidmaletz_mining_npc_NPCEventHandler.evalInt(xml.get("height"),vars) : tile.getHeight(); + if(xml.exists("tileWidth")) { + w1 = Math.round(com_davidmaletz_mining_npc_NPCEventHandler.evalFloat(xml.get("tileWidth"),vars) * com_davidmaletz_tiles_Tile.SIZE); + } + var _t1 = tile; + return { tile : _t1, width : w1, height : h1}; + } else { + var w2 = xml.exists("width") && xml.get("width").length > 0 ? com_davidmaletz_mining_Main.parseInt(xml.get("width")) : 0; + var h2 = xml.exists("height") && xml.get("height").length > 0 ? com_davidmaletz_mining_Main.parseInt(xml.get("height")) : 0; + return { tile : com_davidmaletz_tiles_EmptyTile.get(), width : w2, height : h2}; + } +}; +com_davidmaletz_mining_structure_StructureInfo.structures = null; +com_davidmaletz_mining_structure_StructureInfo.getStructure = function(id) { + var s = com_davidmaletz_mining_structure_StructureInfo.get(id); + if(s != null && Std["is"](s,com_davidmaletz_mining_structure_StructureInfo)) { + return js_Boot.__cast(s , com_davidmaletz_mining_structure_StructureInfo); + } else { + return null; + } +}; +com_davidmaletz_mining_structure_StructureInfo.get = function(id) { + var ret = com_davidmaletz_mining_structure_StructureInfo._get(id); + if(id != null && id.length > 0 && ret == null) { + haxe_Log.trace("No Structure found: " + id,{ fileName : "StructureInfo.hx", lineNumber : 109, className : "com.davidmaletz.mining.structure.StructureInfo", methodName : "get"}); + com_davidmaletz_mining_Main.error = true; + } + return ret; +}; +com_davidmaletz_mining_structure_StructureInfo._get = function(id) { + if(id == null || com_davidmaletz_mining_structure_StructureInfo.structures == null) { + return null; + } else { + return com_davidmaletz_mining_structure_StructureInfo.structures.get(id); + } +}; +com_davidmaletz_mining_structure_StructureInfo.exists = function(id) { + if(id != null && com_davidmaletz_mining_structure_StructureInfo.structures != null) { + return com_davidmaletz_mining_structure_StructureInfo.structures.exists(id); + } else { + return false; + } +}; +com_davidmaletz_mining_structure_StructureInfo.set = function(id,b) { + if(com_davidmaletz_mining_structure_StructureInfo.structures == null) { + com_davidmaletz_mining_structure_StructureInfo.structures = new haxe_ds_StringMap(); + } + if(com_davidmaletz_mining_structure_StructureInfo.structures.exists(id)) { + haxe_Log.trace("Overwrite Structure: " + id,{ fileName : "StructureInfo.hx", lineNumber : 117, className : "com.davidmaletz.mining.structure.StructureInfo", methodName : "set"}); + } + com_davidmaletz_mining_structure_StructureInfo.structures.set(id,b); +}; +com_davidmaletz_mining_structure_StructureInfo.reset = function() { + com_davidmaletz_mining_structure_StructureInfo.structures = null; +}; +com_davidmaletz_mining_structure_StructureInfo.prototype = { + id: null + ,width: null + ,height: null + ,room: null + ,tile: null + ,offsetY: null + ,offsetX: null + ,playerY: null + ,xml: null + ,type: null + ,priority: null + ,lights: null + ,animation: null + ,nightAnimation: null + ,hitbox: null + ,getName: function() { + var t = this.xml.get("display"); + if(t != null) { + var n = com_fancyfish_faeng_common_Lang.getTextFromTitle(t); + if(n == null) { + return com_fancyfish_faeng_common_Lang.getText("common",t); + } else { + return n; + } + } else { + var s = this.xml.exists("name") && com_fancyfish_faeng_common_Lang.hasText("structure",this.xml.get("name")) ? this.xml.get("name") : this.id; + if(com_fancyfish_faeng_common_Lang.hasText("structure",s)) { + return com_fancyfish_faeng_common_Lang.getText("structure",s); + } else { + return com_fancyfish_faeng_common_Lang.getText("common",this.xml.exists("name") && com_fancyfish_faeng_common_Lang.hasText("common",this.xml.get("name")) ? this.xml.get("name") : this.id); + } + } + } + ,create: function(x,y) { + var s; + if(this.type == null) { + s = new com_davidmaletz_mining_structure_Structure(this,x,y); + } else { + s = Type.createInstance(this.type,[this,x,y]); + } + s.runEvent("init",null); + return s; + } + ,build: function(p,area,x,y,xml,vars) { + var s = this.create(x,y); + if(s == null) { + return null; + } + if(xml != null && vars != null && xml.exists("name")) { + s.set_name(com_davidmaletz_mining_npc_NPCEventHandler.evalString(xml.get("name"),vars)); + } + area.addStructure(s,p); + if(xml != null) { + s.loadXML(xml,vars); + } + return s; + } + ,load: function(b,version,x,y,addStructure,parent) { + var s = this.create(x,y); + if(b != null) { + s.read(b,version,parent); + } + s.onLoad(b,version); + addStructure(s); + } + ,getAnim: function(id,def,base) { + if(def == null) { + def = "idle"; + } + if(com_davidmaletz_tiles_TileAnimation.exists(id)) { + return id; + } else if(this.xml.exists(id + "_anim")) { + return this.xml.get(id + "_anim"); + } else { + if(base == null) { + if(com_davidmaletz_mining_Main.isNight()) { + base = this.nightAnimation; + } else { + base = this.animation; + } + } + var ret = base + "." + id; + if(com_davidmaletz_tiles_TileAnimation.exists(ret) || id == def) { + return ret; + } else { + return this.getAnim(def,"idle",base); + } + } + } + ,modifyHitbox: function(r) { + if(this.hitbox != null) { + r.x += this.hitbox.x; + r.y += this.hitbox.y; + r.width = this.hitbox.width; + r.height = this.hitbox.height; + } + } + ,__class__: com_davidmaletz_mining_structure_StructureInfo +}; +var com_davidmaletz_mining_ui_AcceptQuest = function(c,p,q,onAccept,onClose,title) { + if(title == null) { + title = "new"; + } + com_davidmaletz_controls_ClickableWindow.call(this,c,com_davidmaletz_mining_Main.window_factory.create(114,112 + com_davidmaletz_mining_ui_TextButton.getHeight())); + this.player = p; + this.quest = q; + this.onClose = onClose; + this.onAccept = onAccept; + var q1 = new com_davidmaletz_mining_ui_QuestInfo(this.player); + q1.set_x(4); + q1.set_y(4); + q1.setQuest(this.quest,106,com_fancyfish_faeng_common_Lang.getText("quests",title),5570560); + this.addChild(q1); + var y = 108; + if(onAccept == null) { + this.addClickable(new com_davidmaletz_mining_ui_TextButton(70,y,com_fancyfish_faeng_common_Lang.getText("common","ok"),$bind(this,this.close))); + } else { + this.addClickable(new com_davidmaletz_mining_ui_TextButton(4,y,com_fancyfish_faeng_common_Lang.getText("common","accept"),$bind(this,this.accept),50)); + this.addClickable(new com_davidmaletz_mining_ui_TextButton(60,y,com_fancyfish_faeng_common_Lang.getText("common","reject"),$bind(this,this.close),50)); + } +}; +$hxClasses["com.davidmaletz.mining.ui.AcceptQuest"] = com_davidmaletz_mining_ui_AcceptQuest; +com_davidmaletz_mining_ui_AcceptQuest.__name__ = ["com","davidmaletz","mining","ui","AcceptQuest"]; +com_davidmaletz_mining_ui_AcceptQuest.__super__ = com_davidmaletz_controls_ClickableWindow; +com_davidmaletz_mining_ui_AcceptQuest.prototype = $extend(com_davidmaletz_controls_ClickableWindow.prototype,{ + player: null + ,quest: null + ,onAccept: null + ,accept: function() { + this.player.addQuest(this.quest); + if(this.onAccept != null) { + this.onAccept(); + } + this.close(); + } + ,__class__: com_davidmaletz_mining_ui_AcceptQuest +}); +var com_davidmaletz_mining_ui_NextSprite = function() { + com_davidmaletz_lerp_LerpSprite.call(this); + this.set_scaleX(0.5); + this.set_scaleY(0.5); + this.set_alpha(0); + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),20,$bind(this,this.hold)); +}; +$hxClasses["com.davidmaletz.mining.ui.NextSprite"] = com_davidmaletz_mining_ui_NextSprite; +com_davidmaletz_mining_ui_NextSprite.__name__ = ["com","davidmaletz","mining","ui","NextSprite"]; +com_davidmaletz_mining_ui_NextSprite.__super__ = com_davidmaletz_lerp_LerpSprite; +com_davidmaletz_mining_ui_NextSprite.prototype = $extend(com_davidmaletz_lerp_LerpSprite.prototype,{ + next: null + ,destroy: function(e) { + if(com_davidmaletz_mining_ui_Achievement.current == this) { + com_davidmaletz_mining_ui_Achievement.current = null; + } + com_davidmaletz_lerp_LerpSprite.prototype.destroy.call(this,e); + } + ,hold: function() { + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),120,$bind(this,this.fade_out)); + } + ,fade_out: function() { + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),20,$bind(this,this.remove)); + } + ,remove: function() { + com_davidmaletz_faengfl_FaengFL.remove(this); + if(this.next != null) { + this.next.show(); + } + } + ,show: function() { + com_davidmaletz_mining_Main.getContainer().addDisplay(this,5); + com_davidmaletz_mining_ui_Achievement.current = this; + } + ,__class__: com_davidmaletz_mining_ui_NextSprite +}); +var com_davidmaletz_mining_ui_Achievement = function(achievement) { + com_davidmaletz_mining_ui_NextSprite.call(this); + var b = openfl_Assets.getBitmapData("data/ui/achievement_bg.png"); + this.get_graphics().beginBitmapFill(b); + this.get_graphics().drawRect(0,0,210,b.height); + this.get_graphics().endFill(); + com_davidmaletz_mining_ui_Achievement.addDetails(achievement,this,4,4,16777215,new com_davidmaletz_mining_ui__$Achievement_AchievementIcon(achievement)); + if(com_davidmaletz_mining_ui_Achievement.current == null) { + this.show(); + } else { + this.next = com_davidmaletz_mining_ui_Achievement.current.next; + com_davidmaletz_mining_ui_Achievement.current.next = this; + } +}; +$hxClasses["com.davidmaletz.mining.ui.Achievement"] = com_davidmaletz_mining_ui_Achievement; +com_davidmaletz_mining_ui_Achievement.__name__ = ["com","davidmaletz","mining","ui","Achievement"]; +com_davidmaletz_mining_ui_Achievement.current = null; +com_davidmaletz_mining_ui_Achievement.addDetails = function(achievement,s,x,y,col,icon) { + icon.set_x(x); + icon.set_y(y); + s.addChild(icon); + var t = new com_davidmaletz_faengfl_TextSprite(achievement.getName(),new com_fancyfish_faeng_text_CharacterPlacer(0),col,2); + t.set_x(x + 4 + 34); + t.set_y(y); + s.addChild(t); + var t1 = new com_davidmaletz_mining_ui_MyFormattedText(164,true); + t1.default_color = col; + t1.setText(achievement.getDesc().get()); + t1.set_x(x + 4 + 34); + t1.set_y(y + 20); + s.addChild(t1); +}; +com_davidmaletz_mining_ui_Achievement.__super__ = com_davidmaletz_mining_ui_NextSprite; +com_davidmaletz_mining_ui_Achievement.prototype = $extend(com_davidmaletz_mining_ui_NextSprite.prototype,{ + show: function() { + com_davidmaletz_faengfl_adv_sound_Sound.play("achievement"); + com_davidmaletz_mining_ui_NextSprite.prototype.show.call(this); + } + ,__class__: com_davidmaletz_mining_ui_Achievement +}); +var com_davidmaletz_mining_ui__$Achievement_AchievementIcon = function(achievement) { + openfl_display_Sprite.call(this); + this.normal = com_davidmaletz_tiles_Tile.makeIcon(achievement.getLocked(false)); + this.addChild(this.normal); + this.gold = com_davidmaletz_tiles_Tile.makeIcon(achievement.unlocked); + this.gold.set_visible(false); + this.addChild(this.gold); + this.flash = new com_davidmaletz_tiles_render_StaticPlayAnimation(com_davidmaletz_tiles_Tile.get("achievement_flash"),"single",10,false); + this.flash.set_alpha(0); + this.flash.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),30,$bind(this,this.fade_out)); + this.addChild(this.flash); +}; +$hxClasses["com.davidmaletz.mining.ui._Achievement.AchievementIcon"] = com_davidmaletz_mining_ui__$Achievement_AchievementIcon; +com_davidmaletz_mining_ui__$Achievement_AchievementIcon.__name__ = ["com","davidmaletz","mining","ui","_Achievement","AchievementIcon"]; +com_davidmaletz_mining_ui__$Achievement_AchievementIcon.__super__ = openfl_display_Sprite; +com_davidmaletz_mining_ui__$Achievement_AchievementIcon.prototype = $extend(openfl_display_Sprite.prototype,{ + normal: null + ,gold: null + ,flash: null + ,fade_out: function() { + this.normal.set_visible(false); + this.gold.set_visible(true); + this.flash.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),30,$bind(this,this.anim)); + } + ,anim: function() { + this.flash.set_alpha(1); + this.flash.playAnimation("achievement_flash",false); + } + ,__class__: com_davidmaletz_mining_ui__$Achievement_AchievementIcon +}); +var com_davidmaletz_mining_ui_AchievementDetails = function(hasAchievement) { + openfl_display_Sprite.call(this); + this.set_visible(false); + this.achievement = null; + this.hasAchievement = hasAchievement; +}; +$hxClasses["com.davidmaletz.mining.ui.AchievementDetails"] = com_davidmaletz_mining_ui_AchievementDetails; +com_davidmaletz_mining_ui_AchievementDetails.__name__ = ["com","davidmaletz","mining","ui","AchievementDetails"]; +com_davidmaletz_mining_ui_AchievementDetails.__super__ = openfl_display_Sprite; +com_davidmaletz_mining_ui_AchievementDetails.prototype = $extend(openfl_display_Sprite.prototype,{ + achievement: null + ,hasAchievement: null + ,setAchievement: function(a) { + if(this.achievement == a) { + return; + } + this.achievement = a; + if(this.achievement == null) { + this.set_visible(false); + } else { + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this); + this.set_visible(true); + var r = this.hasAchievement(this.achievement.id) ? this.achievement.unlocked : this.achievement.getLocked(true); + var s = new openfl_display_Sprite(); + com_davidmaletz_mining_ui_Achievement.addDetails(this.achievement,s,4,4,0,com_davidmaletz_mining_item_ItemInfo._createIcon(r)); + s.set_scaleX(s.set_scaleY(0.5)); + this.addChild(s); + this.addChildAt(com_davidmaletz_mining_Main.window_factory.create(this.getWidth(),this.getHeight()).create(0,0),0); + } + } + ,getWidth: function() { + return 105; + } + ,getHeight: function() { + return 26; + } + ,__class__: com_davidmaletz_mining_ui_AchievementDetails +}); +var com_davidmaletz_mining_ui_AchievementRenderer = function(handler,hasAchievement) { + this.handler = handler; + this.hasAchievement = hasAchievement; +}; +$hxClasses["com.davidmaletz.mining.ui.AchievementRenderer"] = com_davidmaletz_mining_ui_AchievementRenderer; +com_davidmaletz_mining_ui_AchievementRenderer.__name__ = ["com","davidmaletz","mining","ui","AchievementRenderer"]; +com_davidmaletz_mining_ui_AchievementRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui_AchievementRenderer.prototype = { + handler: null + ,hasAchievement: null + ,create: function(item,x,y) { + return new com_davidmaletz_mining_ui__$AchievementRenderer_AchievementButton(this.handler,item,x,y,this.hasAchievement); + } + ,update: function(s,item) { + } + ,getWidth: function() { + return 20; + } + ,getHeight: function(item) { + return 20; + } + ,__class__: com_davidmaletz_mining_ui_AchievementRenderer +}; +var com_davidmaletz_mining_ui__$AchievementRenderer_AchievementButton = function(handler,i,x,y,hasAchievement) { + var w = 20; + var h = 20; + this.hasAchievement = hasAchievement; + com_davidmaletz_controls_Button.call(this,x,y,com_davidmaletz_mining_Main.label_factory.createBG(w,h),com_davidmaletz_mining_Main.label_factory.createHover(w,h),null); + this.handler = handler; + this.achievement = i; + var t = com_davidmaletz_mining_item_ItemInfo._createIcon(i.getLocked(true)); + t.set_x(2); + t.set_y(2); + t.set_scaleX(t.set_scaleY(0.5)); + this.addChild(t); + this.disabled = t; + var t1 = com_davidmaletz_mining_item_ItemInfo._createIcon(i.unlocked); + t1.set_x(2); + t1.set_y(2); + t1.set_scaleX(t1.set_scaleY(0.5)); + this.addChild(t1); + this.enabled = t1; + this.enabled.set_visible(hasAchievement(this.achievement.id)); + this.disabled.set_visible(!this.enabled.get_visible()); + com_davidmaletz_faengfl_achievement_Achievements.instance.addEventListener("gain_achievement",$bind(this,this.updateEnabled)); +}; +$hxClasses["com.davidmaletz.mining.ui._AchievementRenderer.AchievementButton"] = com_davidmaletz_mining_ui__$AchievementRenderer_AchievementButton; +com_davidmaletz_mining_ui__$AchievementRenderer_AchievementButton.__name__ = ["com","davidmaletz","mining","ui","_AchievementRenderer","AchievementButton"]; +com_davidmaletz_mining_ui__$AchievementRenderer_AchievementButton.__super__ = com_davidmaletz_controls_Button; +com_davidmaletz_mining_ui__$AchievementRenderer_AchievementButton.prototype = $extend(com_davidmaletz_controls_Button.prototype,{ + handler: null + ,achievement: null + ,enabled: null + ,disabled: null + ,hasAchievement: null + ,onClick: function() { + this.handler.onSelect(this.achievement); + return true; + } + ,onHover: function(hover) { + com_davidmaletz_controls_Button.prototype.onHover.call(this,hover); + this.handler.onHover(hover ? this.achievement : null); + } + ,updateEnabled: function(e) { + if(e.value == this.achievement) { + this.enabled.set_visible(this.hasAchievement(this.achievement.id)); + this.disabled.set_visible(!this.enabled.get_visible()); + } + } + ,__class__: com_davidmaletz_mining_ui__$AchievementRenderer_AchievementButton +}); +var com_davidmaletz_mining_ui_AchievementWindow = function(c,hasAchievement) { + com_davidmaletz_controls_scroll_ScrollWindow.call(this,c,com_davidmaletz_mining_Main.window_factory,new com_davidmaletz_mining_ui_AchievementRenderer(this,hasAchievement),5,7,0.05); + this.hasAchievement = hasAchievement; + var ct = 0; + var total = 0; + var a = com_davidmaletz_mining_MyAchievements.getAchievements(); + while(a.hasNext()) { + var a1 = a.next(); + ++total; + if(hasAchievement(a1.id)) { + ++ct; + } + } + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,new com_fancyfish_faeng_common_mutable_Concat(com_fancyfish_faeng_common_Lang.getText("options","achievements")," " + ct + "/" + total),this.getWidth(),0,120); + var a2 = com_davidmaletz_mining_MyAchievements.getAchievements(); + while(a2.hasNext()) { + var a3 = a2.next(); + this.addItem(a3); + } + this.details = new com_davidmaletz_mining_ui_AchievementDetails(hasAchievement); + this.details.set_x(this.getWidth() - 6); + this.addChild(this.details); +}; +$hxClasses["com.davidmaletz.mining.ui.AchievementWindow"] = com_davidmaletz_mining_ui_AchievementWindow; +com_davidmaletz_mining_ui_AchievementWindow.__name__ = ["com","davidmaletz","mining","ui","AchievementWindow"]; +com_davidmaletz_mining_ui_AchievementWindow.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_AchievementWindow.__super__ = com_davidmaletz_controls_scroll_ScrollWindow; +com_davidmaletz_mining_ui_AchievementWindow.prototype = $extend(com_davidmaletz_controls_scroll_ScrollWindow.prototype,{ + details: null + ,hasAchievement: null + ,onSelect: function(item) { + } + ,onHover: function(item) { + if(item != null && item.hidden && !this.hasAchievement(item.id)) { + item = null; + } + this.details.setAchievement(item); + this.details.set_y(Math.floor((this.getHeight() - this.details.getHeight()) * 0.5)); + } + ,isEnabled: function(item) { + return this.hasAchievement(item.id); + } + ,__class__: com_davidmaletz_mining_ui_AchievementWindow +}); +var com_davidmaletz_mining_ui_Bars = function(c) { + openfl_display_Sprite.call(this); + this.bars = []; + this._y = c.getHeight() - 8; +}; +$hxClasses["com.davidmaletz.mining.ui.Bars"] = com_davidmaletz_mining_ui_Bars; +com_davidmaletz_mining_ui_Bars.__name__ = ["com","davidmaletz","mining","ui","Bars"]; +com_davidmaletz_mining_ui_Bars.__super__ = openfl_display_Sprite; +com_davidmaletz_mining_ui_Bars.prototype = $extend(openfl_display_Sprite.prototype,{ + bars: null + ,_y: null + ,addBar: function(b) { + if(b.get_visible()) { + var _g = 0; + var _g1 = this.bars; + while(_g < _g1.length) { + var bar = _g1[_g]; + ++_g; + var _g2 = bar; + _g2.set_y(_g2.get_y() - 9); + } + } + b.set_y(this._y); + this.addChild(b); + this.bars.push(b); + } + ,updateVisible: function(b) { + var i = this.bars.indexOf(b); + if(i != -1) { + var d = b.get_visible() ? -9 : 9; + var _g1 = 0; + var _g = i; + while(_g1 < _g) { + var j = _g1++; + var _g2 = this.bars[j]; + _g2.set_y(_g2.get_y() + d); + } + } + } + ,__class__: com_davidmaletz_mining_ui_Bars +}); +var com_davidmaletz_mining_ui_BuildPrompt = function(str,c,player,structure,inv,reqs,onAccept,onRemove,yesLabel,noLabel) { + this.acceptCancelClose = false; + var t = new com_davidmaletz_mining_ui_MyFormattedText(106,true,structure == null ? str : StringTools.replace(str,"{structure}",structure),1); + var y = Math.round(t.bounds.height * t.get_scaleY() + 8); + var inner = new openfl_display_Sprite(); + this.inventory = inv; + this.requires = reqs; + this.onAccept = onAccept; + this.onRemove = onRemove; + y = this.addReqs(inner,player,4,y,106) + 4; + var ht = y + com_davidmaletz_mining_ui_TextButton.getHeight() + 4; + com_davidmaletz_controls_ClickableWindow.call(this,c,com_davidmaletz_mining_Main.window_factory.create(114,ht)); + t.set_x(4); + t.set_y(4); + this.addChild(t); + this.addChild(inner); + if(yesLabel == null) { + yesLabel = com_fancyfish_faeng_common_Lang.getText("actions","build"); + } + this.addClickable(new com_davidmaletz_mining_ui_TextButton(4,y,yesLabel,$bind(this,this.accept))); + if(noLabel == null) { + noLabel = this.getNo(); + } + this.addClickable(new com_davidmaletz_mining_ui_TextButton(70,y,noLabel,$bind(this,this.remove))); + if(onRemove != null) { + var close = new com_davidmaletz_controls_CloseButton(this,114,0); + this.addChild(close); + this.clickables.addClickable(close,this); + } +}; +$hxClasses["com.davidmaletz.mining.ui.BuildPrompt"] = com_davidmaletz_mining_ui_BuildPrompt; +com_davidmaletz_mining_ui_BuildPrompt.__name__ = ["com","davidmaletz","mining","ui","BuildPrompt"]; +com_davidmaletz_mining_ui_BuildPrompt.__super__ = com_davidmaletz_controls_ClickableWindow; +com_davidmaletz_mining_ui_BuildPrompt.prototype = $extend(com_davidmaletz_controls_ClickableWindow.prototype,{ + inventory: null + ,requires: null + ,onAccept: null + ,onRemove: null + ,acceptCancelClose: null + ,addReqs: function(inner,player,x,y,w) { + return com_davidmaletz_mining_ui_QuestInfo.addRequirements(inner,player,this.inventory,HxOverrides.iter(this.requires),x,y,w); + } + ,getNo: function() { + return com_fancyfish_faeng_common_Lang.getText("common",this.onRemove == null ? "cancel" : "remove"); + } + ,canBuild: function() { + var _g = 0; + var _g1 = this.requires; + while(_g < _g1.length) { + var r = _g1[_g]; + ++_g; + if(r.getMaxCount(com_davidmaletz_mining_Main.getLocalPlayer(),this.inventory) <= 0) { + return false; + } + } + return true; + } + ,accept: function() { + if(this.canBuild()) { + var _g = 0; + var _g1 = this.requires; + while(_g < _g1.length) { + var r = _g1[_g]; + ++_g; + r.useResources(this.inventory,1); + } + if(this.onAccept != null) { + this.onAccept(); + if(this.acceptCancelClose) { + this.onClose = null; + } + } + } else { + var p = new com_davidmaletz_faengfl_ui_Popup(128.,52.,0,com_fancyfish_faeng_common_Lang.getText("warning","ingredients"),16720418); + com_davidmaletz_faengfl_adv_sound_Sound.play("warning"); + if(p.parent != this.parent) { + this.parent.addChild(p); + } + } + this.close(); + } + ,remove: function() { + if(this.onRemove != null) { + this.onRemove(); + } + this.close(); + } + ,__class__: com_davidmaletz_mining_ui_BuildPrompt +}); +var com_davidmaletz_mining_ui_CountPrompt = function(c,msg,func,min,max,value,top,mid) { + if(mid == null) { + mid = 0; + } + if(top == null) { + top = 0; + } + var y = top + 4; + var text = new com_davidmaletz_mining_ui_MyFormattedText(92,true,msg.get(),1); + text.set_x(4); + text.set_y(y); + y += Math.round(text.bounds.height * text.get_scaleY()) + 4; + var s = new com_davidmaletz_controls_Spinner(c,min,max,value); + s.set_x((100 - s.getWidth()) / 2); + s.set_y(y); + s.addEventListener("action",$bind(this,this.action)); + y += s.getHeight() + 4; + com_davidmaletz_controls_ClickableWindow.call(this,c,com_davidmaletz_mining_Main.window_factory.create(100,y + mid + com_davidmaletz_mining_ui_TextButton.getHeight() + 4)); + this.addChild(text); + this.addChild(s); + this.spinner = s; + this.afterSpinner(y); + y += mid; + this.clickables.allowLoop = false; + this.addClickable(new com_davidmaletz_mining_ui_TextButton(4,y,com_fancyfish_faeng_common_Lang.getText("common","ok"),$bind(this,this.confirm))); + this.addClickable(new com_davidmaletz_mining_ui_TextButton(56,y,com_fancyfish_faeng_common_Lang.getText("common","cancel"),$bind(this,this.close))); + this.onComplete = func; +}; +$hxClasses["com.davidmaletz.mining.ui.CountPrompt"] = com_davidmaletz_mining_ui_CountPrompt; +com_davidmaletz_mining_ui_CountPrompt.__name__ = ["com","davidmaletz","mining","ui","CountPrompt"]; +com_davidmaletz_mining_ui_CountPrompt.__super__ = com_davidmaletz_controls_ClickableWindow; +com_davidmaletz_mining_ui_CountPrompt.prototype = $extend(com_davidmaletz_controls_ClickableWindow.prototype,{ + spinner: null + ,onComplete: null + ,init: function(e) { + com_davidmaletz_controls_ClickableWindow.prototype.init.call(this,e); + openfl_Lib.current.stage.addEventListener("keyDown",$bind(this,this.key_down)); + } + ,destroy: function(e) { + com_davidmaletz_controls_ClickableWindow.prototype.destroy.call(this,e); + openfl_Lib.current.stage.removeEventListener("keyDown",$bind(this,this.key_down)); + } + ,key_down: function(e) { + if(!this.spinner.hasFocus() && e.keyCode >= 48 && e.keyCode < 58) { + this.spinner.setFocused(e); + } + } + ,afterSpinner: function(y) { + } + ,confirm: function() { + if(!this.hasLerp()) { + this.onComplete(this.spinner.getValue()); + this.close(); + } + } + ,action: function(e) { + this.confirm(); + } + ,__class__: com_davidmaletz_mining_ui_CountPrompt +}); +var com_davidmaletz_mining_ui_BuyPrompt = function(c,coins,item,max,func,cpi,icon,title) { + if(icon == null) { + icon = "coins"; + } + this.icon = icon; + this.costPerItem = cpi; + if(title == null) { + title = com_fancyfish_faeng_common_Lang.getText("common","buy_item"); + } + com_davidmaletz_mining_ui_CountPrompt.call(this,c,title,func,0,com_fancyfish_faeng_common_Utils.min(max,Math.floor(coins / this.costPerItem)),1,12,com_fancyfish_faeng_text_FontManager.lineHeight() + 4); + com_davidmaletz_mining_ui_ItemRenderer.addItemCentered(this,item,50,4); + this.spinner.addEventListener("change_value",$bind(this,this.updateCost)); +}; +$hxClasses["com.davidmaletz.mining.ui.BuyPrompt"] = com_davidmaletz_mining_ui_BuyPrompt; +com_davidmaletz_mining_ui_BuyPrompt.__name__ = ["com","davidmaletz","mining","ui","BuyPrompt"]; +com_davidmaletz_mining_ui_BuyPrompt.__super__ = com_davidmaletz_mining_ui_CountPrompt; +com_davidmaletz_mining_ui_BuyPrompt.prototype = $extend(com_davidmaletz_mining_ui_CountPrompt.prototype,{ + cost: null + ,costPerItem: null + ,icon: null + ,updateCost: function(e) { + this.cost.set(com_fancyfish_faeng_common_Utils.largeNumberFormat(this.spinner.getValue() * this.costPerItem)); + } + ,afterSpinner: function(y) { + this.cost = new com_fancyfish_faeng_common_mutable_Mutable(); + this.cost.set(com_fancyfish_faeng_common_Utils.largeNumberFormat(this.costPerItem)); + var x = (100 - com_davidmaletz_tiles_Tile.SIZE * 2) * 0.5; + var icon = com_davidmaletz_mining_ui_Coins.makeIcon(this.icon); + icon.set_x(x); + icon.set_y(y); + this.addChild(icon); + var t = new com_davidmaletz_faengfl_TextSprite(this.cost,new com_fancyfish_faeng_text_CharacterPlacer(com_davidmaletz_tiles_Tile.SIZE * 2,1),0,1); + t.set_x(com_davidmaletz_tiles_Tile.SIZE + x + 2); + t.set_y(y); + this.addChild(t); + } + ,__class__: com_davidmaletz_mining_ui_BuyPrompt +}); +var com_davidmaletz_mining_ui_CallerBox = function(id,ar,incoming,complete) { + com_davidmaletz_lerp_LerpSprite.call(this); + var back = new openfl_display_Bitmap(openfl_Assets.getBitmapData("data/ui/speech.png")); + var _g = back; + _g.set_y(_g.get_y() + 2); + this.addChild(back); + if(ar.length == 0) { + ar = [new com_davidmaletz_mining_ui_Caller(id)]; + } + var _g1 = 0; + while(_g1 < ar.length) { + var c = ar[_g1]; + ++_g1; + c.box = this; + c.set_visible(false); + this.addChild(c); + } + this.current = ar[0]; + this.current.set_visible(true); + this.set_x(com_davidmaletz_tiles_Tile.SIZE + 4); + this.set_y(4); + this.set_scaleX(-1); + this.set_alpha(0); + new com_davidmaletz_faengfl_transition_LerpModal(this,complete); + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),15); + this.ring(id,incoming); +}; +$hxClasses["com.davidmaletz.mining.ui.CallerBox"] = com_davidmaletz_mining_ui_CallerBox; +com_davidmaletz_mining_ui_CallerBox.__name__ = ["com","davidmaletz","mining","ui","CallerBox"]; +com_davidmaletz_mining_ui_CallerBox.__interfaces__ = [com_davidmaletz_mining_npc_Speakable]; +com_davidmaletz_mining_ui_CallerBox.__super__ = com_davidmaletz_lerp_LerpSprite; +com_davidmaletz_mining_ui_CallerBox.prototype = $extend(com_davidmaletz_lerp_LerpSprite.prototype,{ + current: null + ,end: function(complete) { + var _gthis = this; + if(this.stage == null) { + if(complete != null) { + complete(); + } + return; + } + new com_davidmaletz_faengfl_transition_Modal(this,function() { + com_davidmaletz_faengfl_FaengFL.remove(_gthis); + if(complete != null) { + complete(); + } + }); + var d = this; + var tmp = function() { + com_davidmaletz_faengfl_FaengFL.remove(d); + }; + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),15,tmp); + } + ,ring: function(object,incoming) { + var _gthis = this; + var o = com_davidmaletz_mining_world_ObjectInfo.get(object); + if(o == null) { + com_davidmaletz_mining_Main.getContainer().addDisplay(this,4); + return; + } + var map = new haxe_ds_StringMap(); + map.set("{npc}",o.getDisplay(true,null,this.current.caller.getAnim("idle"))); + var p = new com_davidmaletz_faengfl_ui_Tooltip(128.,4 + com_davidmaletz_tiles_Tile.SIZE * 0.5,new com_fancyfish_faeng_common_mutable_MutableTemplateStatic(com_fancyfish_faeng_common_Lang.getText("common",incoming ? "incoming_call" : "calling"),map),16777215,-16777216,null,true); + p.set_alpha(0); + this.fadeIn(p,3); + new com_davidmaletz_faengfl_transition_Modal(p,function() { + com_davidmaletz_faengfl_FaengFL.remove(p); + com_davidmaletz_mining_Main.getContainer().addDisplay(_gthis,4); + }); + } + ,fadeIn: function(p,ct) { + if(ct <= 0) { + com_davidmaletz_faengfl_FaengFL.remove(p); + return; + } + var f = $bind(this,this.hold); + var p1 = p; + var ct1 = ct; + var tmp = function() { + f(p1,ct1); + }; + p.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),20,tmp); + } + ,hold: function(p,ct) { + var f = $bind(this,this.fadeOut); + var p1 = p; + var ct1 = ct; + var tmp = function() { + f(p1,ct1); + }; + p.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),20,tmp); + } + ,fadeOut: function(p,ct) { + var f = $bind(this,this.fadeIn); + var p1 = p; + var ct1 = ct - 1; + var tmp = function() { + f(p1,ct1); + }; + p.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),20,tmp); + } + ,sound: null + ,playSFX: function(id) { + this.stopSFX(); + this.sound = com_davidmaletz_faengfl_adv_sound_Sound.play(id,true); + } + ,stopSFX: function(e) { + if(this.sound != null) { + this.sound.stop(); + this.sound = null; + } + } + ,show: function(c) { + this.current.set_visible(false); + this.current = c; + this.current.set_visible(true); + } + ,beginSpeak: function() { + this.current.beginSpeak(); + } + ,endSpeak: function(closed) { + this.current.endSpeak(closed); + } + ,__class__: com_davidmaletz_mining_ui_CallerBox +}); +var com_davidmaletz_mining_ui_Caller = function(id) { + if(id != null) { + var o = com_davidmaletz_mining_world_ObjectInfo.get(id); + if(o != null && Std["is"](o,com_davidmaletz_mining_npc_NPCInfo)) { + this.caller = o; + } + } + if(this.caller == null) { + com_davidmaletz_tiles_render_StaticPlayAnimation.call(this,com_davidmaletz_tiles_EmptyTile.get(),"single",10,true); + } else { + com_davidmaletz_tiles_render_StaticPlayAnimation.call(this,this.caller.createTile(0),this.caller.getAnim("idle"),com_davidmaletz_mining_enemy_AttackRenderer.getFPS(this.caller.xml,10),true); + } +}; +$hxClasses["com.davidmaletz.mining.ui.Caller"] = com_davidmaletz_mining_ui_Caller; +com_davidmaletz_mining_ui_Caller.__name__ = ["com","davidmaletz","mining","ui","Caller"]; +com_davidmaletz_mining_ui_Caller.__interfaces__ = [com_davidmaletz_mining_npc_Speakable]; +com_davidmaletz_mining_ui_Caller.__super__ = com_davidmaletz_tiles_render_StaticPlayAnimation; +com_davidmaletz_mining_ui_Caller.prototype = $extend(com_davidmaletz_tiles_render_StaticPlayAnimation.prototype,{ + caller: null + ,box: null + ,playLoop: function(anim) { + if(this.caller != null) { + this.playAnimation(this.caller.getAnim(anim),true); + } + } + ,beginSpeak: function() { + this.box.show(this); + this.playLoop("talk"); + if(this.caller != null) { + var sfx = this.caller.talkSfx; + if(sfx != null && com_davidmaletz_faengfl_RevealText.TEXT_SPEED > 0) { + this.box.playSFX(sfx); + } + } + } + ,endSpeak: function(closed) { + if(closed) { + this.playLoop("idle"); + } + this.box.stopSFX(); + } + ,__class__: com_davidmaletz_mining_ui_Caller +}); +var com_davidmaletz_mining_ui_ChangeEquipment = function(player,c,title1,title2,recipes,xml,obj) { + this.vanity = new com_davidmaletz_mining_ui__$ChangeEquipment_VanitySlots(this,player); + var r = new com_davidmaletz_mining_ui_EquipmentSlotRenderer(this,player.equipment); + var rows = Math.round(100 / r.getHeight(null)); + this.slots = new com_davidmaletz_controls_scroll_ScrollList(c,r,rows,2); + var w = this.getSlotsWidth() + 6; + var h = this.getHeight(); + this.slots.set_x(this.slots.set_y(3)); + var draw = new com_davidmaletz_faengfl_CompoundDrawable(); + draw.add(com_davidmaletz_mining_Main.window_factory.create(w,h),0,0); + if(title2 != null) { + var iter = com_davidmaletz_mining_ui_CraftingWindow.getRecipes(player,xml); + if(iter.hasNext()) { + this.recipeList = new com_davidmaletz_mining_ui_CraftingList(new com_davidmaletz_mining_ui__$ChangeEquipment_RecipeHandler(this),player.getInv(true),c,null); + this.recipeList.addItems(iter,this.details,xml.elementPathsNamed("otherItem"),obj); + this.recipeList.set_x(w - 1 + 3); + this.recipeList.set_y(3); + draw.add(com_davidmaletz_mining_Main.window_factory.create(this.recipeList.getWidth() + 6,h),w - 1,0); + } + } + com_davidmaletz_controls_ClickableWindow.call(this,c,draw,true,true,true,this.recipeList == null ? 0.25 : 0,0.6); + this.recipes = recipes; + this.addChild(this.slots); + if(this.recipeList != null) { + this.addChild(this.recipeList); + } + this.player = player; + var slot = player.equipment.getSlots(); + while(slot.hasNext()) { + var slot1 = slot.next(); + if(this.hasSlot(slot1)) { + this.slots.addItem(slot1); + this.slots.addMixedItem(slot1,this.vanity.renderer); + } + } + com_davidmaletz_mining_ui_CraftingList.addAdditional(this.slots,this.details,this.slots.getRenderer().getWidth() + com_davidmaletz_tiles_Tile.SIZE + 4,xml.elementPathsNamed("selfItem"),obj); + var width = this.getWidth(); + if(title2 != null) { + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,title2,this.recipeList.getWidth(),this.recipeList.get_x(),100); + } + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,title1,this.getSlotsWidth(),this.slots.get_x(),100); + this.details = new com_davidmaletz_mining_ui_details_RecipeDetails(player.includeCost()); + this.details.set_x(width + 3); + this.addChild(this.details); + var close = new com_davidmaletz_controls_CloseButton(this,this.getWidth(),0); + this.addChild(close); + this.clickables.addClickable(close,this); +}; +$hxClasses["com.davidmaletz.mining.ui.ChangeEquipment"] = com_davidmaletz_mining_ui_ChangeEquipment; +com_davidmaletz_mining_ui_ChangeEquipment.__name__ = ["com","davidmaletz","mining","ui","ChangeEquipment"]; +com_davidmaletz_mining_ui_ChangeEquipment.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_ChangeEquipment.__super__ = com_davidmaletz_controls_ClickableWindow; +com_davidmaletz_mining_ui_ChangeEquipment.prototype = $extend(com_davidmaletz_controls_ClickableWindow.prototype,{ + details: null + ,player: null + ,recipes: null + ,slots: null + ,recipeList: null + ,vanity: null + ,createClickables: function() { + var c = [this.slots.getList().clickables]; + var x = [this.slots.get_x()]; + if(this.recipeList != null) { + c.push(this.recipeList.getList().clickables); + x.push(this.recipeList.get_x()); + } + return new com_davidmaletz_controls_CompoundClickableColumns(c,x); + } + ,hasSlot: function(slot) { + var _g = 0; + var _g1 = this.recipes; + while(_g < _g1.length) { + var r = _g1[_g]; + ++_g; + if(r.creates.item.xml.get("slot") == slot) { + return true; + } + } + return false; + } + ,changeEquip: function(slot,r) { + this.details.setInfo(null); + var item = this.player.equipment.forceEquip(slot,this.player,r == null ? null : r.creates.asItem()); + this.onHover(slot); + if(item != null && item.info.hasActionId("equip")) { + this.player.inventory.addItems(item.info,1,item.value,item.getNameStr()); + } + } + ,filter: function(slot,r) { + return r.creates.item.xml.get("slot") == slot; + } + ,isEquipped: function(slot,r) { + var e = this.player.equipment.getItem(slot); + if(!(r == null || e == null)) { + return e.info != r.creates.item; + } else { + return true; + } + } + ,onSelect: function(slot) { + var c = com_davidmaletz_mining_Main.getContainer(); + var f = $bind(this,this.changeEquip); + var a1 = slot; + var tmp = function(r) { + f(a1,r); + }; + var f1 = $bind(this,this.filter); + var a11 = slot; + var tmp1 = function(r1) { + return f1(a11,r1); + }; + var f2 = $bind(this,this.isEquipped); + var a12 = slot; + var tmp2 = function(r2) { + return f2(a12,r2); + }; + c.addDisplay(new com_davidmaletz_mining_ui_RecipeList(HxOverrides.iter(this.recipes),tmp,com_fancyfish_faeng_common_Lang.getText("equipment",slot),this.player.getInv(true),c,this.player,"common.remove",tmp1,tmp2),2); + } + ,onHover: function(slot) { + this.details.setInfo(slot == null ? null : this.player.equipment.getItem(slot)); + this.updateDetails(); + } + ,updateDetails: function() { + if(this.recipeList != null) { + this.details.set_x(this.getSlotsWidth() + 3); + } + this.details.set_y(Math.floor((this.getHeight() + 18 - this.details.getHeight()) * 0.5)); + } + ,isEnabled: function(slot) { + return true; + } + ,getWidth: function() { + if(this.recipeList == null) { + return this.getSlotsWidth() + 6; + } else { + return this.getSlotsWidth() + this.recipeList.getWidth() + 12; + } + } + ,getHeight: function() { + return this.slots.getHeight() + 6; + } + ,getSlotsWidth: function() { + return this.slots.getWidth() - this.slots.getItemWidth() + com_davidmaletz_tiles_Tile.SIZE + 4; + } + ,__class__: com_davidmaletz_mining_ui_ChangeEquipment +}); +var com_davidmaletz_mining_ui__$ChangeEquipment_RecipeHandler = function(e) { + this.eq = e; +}; +$hxClasses["com.davidmaletz.mining.ui._ChangeEquipment.RecipeHandler"] = com_davidmaletz_mining_ui__$ChangeEquipment_RecipeHandler; +com_davidmaletz_mining_ui__$ChangeEquipment_RecipeHandler.__name__ = ["com","davidmaletz","mining","ui","_ChangeEquipment","RecipeHandler"]; +com_davidmaletz_mining_ui__$ChangeEquipment_RecipeHandler.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui__$ChangeEquipment_RecipeHandler.prototype = { + eq: null + ,onSelect: function(recipe) { + com_davidmaletz_mining_ui_CraftingWindow.craft($bind(this,this.handleCraft),this.eq.recipeList.inventory,recipe); + } + ,handleCraft: function(inv,recipe,ct) { + this.eq.details.setInfo(null); + this.eq.details.setRecipe(recipe,inv); + } + ,onHover: function(recipe) { + this.eq.details.setRecipe(recipe,this.eq.recipeList.inventory); + this.eq.details.set_x(this.eq.recipeList.get_x() - this.eq.details.getWidth()); + this.eq.details.set_y(Math.round((this.eq.getHeight() - this.eq.details.getHeight()) * 0.5)); + } + ,isEnabled: function(item) { + return true; + } + ,__class__: com_davidmaletz_mining_ui__$ChangeEquipment_RecipeHandler +}; +var com_davidmaletz_mining_ui__$ChangeEquipment_VanitySlots = function(e,p) { + this.equipment = e; + this.object = new com_davidmaletz_mining_ui_VanityEquip(p); + this.renderer = new com_davidmaletz_mining_ui_EquipmentSlotRenderer(this,p.vanity,null,true); +}; +$hxClasses["com.davidmaletz.mining.ui._ChangeEquipment.VanitySlots"] = com_davidmaletz_mining_ui__$ChangeEquipment_VanitySlots; +com_davidmaletz_mining_ui__$ChangeEquipment_VanitySlots.__name__ = ["com","davidmaletz","mining","ui","_ChangeEquipment","VanitySlots"]; +com_davidmaletz_mining_ui__$ChangeEquipment_VanitySlots.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui__$ChangeEquipment_VanitySlots.prototype = { + renderer: null + ,equipment: null + ,object: null + ,select: function(slot,i) { + this.equipment.details.setInfo(null); + var item = this.object.getEquipment().forceEquip(slot,this.object,i == null ? null : i.asItem()); + this.equipment.onHover(slot); + if(item != null && item.info.hasActionId("equip")) { + this.equipment.player.inventory.addItems(item.info,1,item.value,item.getNameStr()); + } + } + ,onSelect: function(item) { + if(this.object.getEquipment().get(item) != null) { + var items = []; + var _g = 0; + var _g1 = this.equipment.recipes; + while(_g < _g1.length) { + var r = _g1[_g]; + ++_g; + if(r.creates.item.xml.get("slot") == item) { + items.push(r.creates.item); + } + } + var c = com_davidmaletz_mining_Main.getContainer(); + var f = $bind(this,this.select); + var a1 = item; + var tmp = function(i) { + f(a1,i); + }; + c.addDisplay(new com_davidmaletz_mining_ui_ItemInfoList(c,items,com_fancyfish_faeng_common_Lang.getText("equipment",item),false,null,tmp,true),2); + } else { + this.object.getOwner().showWarning(com_fancyfish_faeng_common_Lang.getText("equipment","vanity_fail")); + } + } + ,onHover: function(item) { + var eq = this.object.getEquipment(); + if(item == null || eq.get(item) == null) { + this.equipment.onHover(null); + } else if(eq.getItem(item) == null) { + this.equipment.details.setText(com_fancyfish_faeng_common_Lang.getText("equipment","vanity")); + this.equipment.updateDetails(); + } else { + this.equipment.details.setInfo(eq.getItem(item)); + this.equipment.updateDetails(); + } + } + ,isEnabled: function(item) { + return true; + } + ,__class__: com_davidmaletz_mining_ui__$ChangeEquipment_VanitySlots +}; +var com_davidmaletz_mining_ui_CharacterBars = function(p,width,PAD) { + com_davidmaletz_faengfl_InitSprite.call(this); + var t = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("common","health"),new com_fancyfish_faeng_text_CharacterPlacer(0),0,1); + this.player = p; + t.set_y(0); + t.set_x(10); + this.addChild(t); + var HT = t.lineHeight(); + var t1 = com_davidmaletz_mining_item_ItemInfo._createIcon(com_davidmaletz_tiles_Tile.get("health")); + t1.set_x(0); + t1.set_y(0); + this.addChild(t1); + this.health = new com_fancyfish_faeng_common_mutable_Mutable(); + this.stamina = new com_fancyfish_faeng_common_mutable_Mutable(); + var t2 = new com_davidmaletz_faengfl_TextSprite(this.health,new com_fancyfish_faeng_text_CharacterPlacer(width - PAD * 2,2),0,1); + t2.set_y(0); + this.addChild(t2); + var ct = 1; + var t3 = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("common","stamina"),new com_fancyfish_faeng_text_CharacterPlacer(0),0,1); + t3.set_y(ct * HT); + t3.set_x(10); + this.addChild(t3); + var t4 = com_davidmaletz_mining_item_ItemInfo._createIcon(com_davidmaletz_tiles_Tile.get("stamina")); + t4.set_x(0); + t4.set_y(ct * HT); + this.addChild(t4); + var t5 = new com_davidmaletz_faengfl_TextSprite(this.stamina,new com_fancyfish_faeng_text_CharacterPlacer(width - PAD * 2,2),0,1); + t5.set_y(ct * HT); + this.addChild(t5); + ++ct; + if(p.state.getFlag("show_oxygen")) { + this.oxygen = new com_fancyfish_faeng_common_mutable_Mutable(); + var t6 = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Concat(com_fancyfish_faeng_common_Lang.getText("common","oxygen"),":"),new com_fancyfish_faeng_text_CharacterPlacer(0),0,1); + t6.set_y(ct * HT); + t6.set_x(10); + this.addChild(t6); + var t7 = com_davidmaletz_mining_item_ItemInfo._createIcon(com_davidmaletz_tiles_Tile.get("oxygen")); + t7.set_x(0); + t7.set_y(ct * HT); + this.addChild(t7); + var t8 = new com_davidmaletz_faengfl_TextSprite(this.oxygen,new com_fancyfish_faeng_text_CharacterPlacer(width - PAD * 2,2),0,1); + t8.set_y(ct * HT); + this.addChild(t8); + ++ct; + } + this.storage = new haxe_ds_StringMap(); + var s = this.player.storage; + var k = s.keys(); + while(k.hasNext()) { + var k1 = k.next(); + if(k1 != "coins" && s.get(k1).getMaxValue() > 0 && com_davidmaletz_mining_ui_StatusBars.hasDef(k1) && com_fancyfish_faeng_common_Lang.hasText("common",k1)) { + var str = new com_fancyfish_faeng_common_mutable_Mutable(); + this.storage.set(k1,str); + var x = Math.floor(ct / 6) * (width - PAD); + var y = ct % 6 * HT; + var t9 = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Concat(com_fancyfish_faeng_common_Lang.getText("common",k1),":"),new com_fancyfish_faeng_text_CharacterPlacer(0),0,1); + t9.set_y(y); + t9.set_x(x + 10); + this.addChild(t9); + var t10 = com_davidmaletz_mining_ui_Coins.makeIcon(com_davidmaletz_mining_ui_StatusBars.getTile(k1)); + t10.set_x(x); + t10.set_y(y); + this.addChild(t10); + var t11 = new com_davidmaletz_faengfl_TextSprite(str,new com_fancyfish_faeng_text_CharacterPlacer(width - PAD * 2,2),0,1); + t11.set_x(x); + t11.set_y(y); + this.addChild(t11); + ++ct; + } + } + if(ct > 3) { + this.set_scaleX(this.set_scaleY(0.5)); + } + this.set_x(this.set_y(PAD)); + this._height = Math.round(com_fancyfish_faeng_common_Utils.min(ct,6) * this.get_scaleY() * HT + PAD); +}; +$hxClasses["com.davidmaletz.mining.ui.CharacterBars"] = com_davidmaletz_mining_ui_CharacterBars; +com_davidmaletz_mining_ui_CharacterBars.__name__ = ["com","davidmaletz","mining","ui","CharacterBars"]; +com_davidmaletz_mining_ui_CharacterBars.__super__ = com_davidmaletz_faengfl_InitSprite; +com_davidmaletz_mining_ui_CharacterBars.prototype = $extend(com_davidmaletz_faengfl_InitSprite.prototype,{ + health: null + ,stamina: null + ,oxygen: null + ,storage: null + ,player: null + ,_height: null + ,init: function(e) { + this.player.addEventListener("change_health",$bind(this,this.updateHealth)); + this.updateHealth(null); + this.player.addEventListener("change_stamina",$bind(this,this.updateStamina)); + this.updateStamina(null); + if(this.oxygen != null) { + this.player.addEventListener("change_oxygen",$bind(this,this.updateOxygen)); + this.updateOxygen(null); + } + var k = this.storage.keys(); + while(k.hasNext()) { + var k1 = k.next(); + this.player.getStorage(k1).addEventListener("updated",$bind(this,this.updateStorage)); + } + this.updateStorage(null); + } + ,destroy: function(e) { + this.player.removeEventListener("change_health",$bind(this,this.updateHealth)); + this.player.removeEventListener("change_stamina",$bind(this,this.updateStamina)); + if(this.oxygen != null) { + this.player.removeEventListener("change_oxygen",$bind(this,this.updateOxygen)); + } + var k = this.storage.keys(); + while(k.hasNext()) { + var k1 = k.next(); + this.player.getStorage(k1).removeEventListener("updated",$bind(this,this.updateStorage)); + } + } + ,updateHealth: function(e) { + this.health.set(com_fancyfish_faeng_common_Utils.largeNumberFormat(this.player.getHealth()) + "/" + com_fancyfish_faeng_common_Utils.largeNumberFormat(this.player.getMaxHealth())); + } + ,updateStamina: function(e) { + this.stamina.set(com_fancyfish_faeng_common_Utils.largeNumberFormat(this.player.getStamina()) + "/" + com_fancyfish_faeng_common_Utils.largeNumberFormat(this.player.getMaxStamina())); + } + ,updateOxygen: function(e) { + this.oxygen.set(com_fancyfish_faeng_common_Utils.largeNumberFormat(this.player.getOxygen()) + "/" + com_fancyfish_faeng_common_Utils.largeNumberFormat(this.player.getMaxOxygen())); + } + ,updateStorage: function(e) { + var k = this.storage.keys(); + while(k.hasNext()) { + var k1 = k.next(); + var s = this.player.getStorage(k1); + this.storage.get(k1).set(com_fancyfish_faeng_common_Utils.largeNumberFormat(s.getValue()) + "/" + com_fancyfish_faeng_common_Utils.largeNumberFormat(s.getMaxValue())); + } + } + ,__class__: com_davidmaletz_mining_ui_CharacterBars +}); +var com_davidmaletz_mining_ui_CharacterColorWindow = function(p,onSelect,cols,offs,title) { + this.info = p; + var len = 0; + this.colors = new haxe_ds_StringMap(); + var c = cols.keys(); + while(c.hasNext()) { + var c1 = c.next(); + this.colors.set(c1,cols.get(c1)); + } + this.offsets = new haxe_ds_StringMap(); + var o = offs.keys(); + while(o.hasNext()) { + var o1 = o.next(); + this.offsets.set(o1,offs.get(o1)); + } + var e = this.info.xml.elements(); + while(e.hasNext()) { + var e1 = e.next(); + var id = e1.get("id"); + var c2 = e1.exists("type") ? e1.get("type") : id; + var _g = e1.nodeName(); + switch(_g) { + case "color": + var ar = com_davidmaletz_mining_ColorInfo.get(c2); + if(ar != null && ar.length > 1) { + ++len; + } + break; + case "offset": + var ar1 = com_davidmaletz_mining_OffsetInfo.get(c2); + if(ar1 != null && ar1.length > 1) { + ++len; + } + break; + } + } + this.sprite = new com_davidmaletz_controls_ListSprite(new com_davidmaletz_mining_ui_OptionRenderer(this),len,1); + var w = this.sprite.getWidth() + 12 + com_davidmaletz_tiles_Tile.SIZE * 1.5; + var h = this.sprite.getHeight() + 12 + com_davidmaletz_mining_ui_TextButton.getHeight(); + var c3 = com_davidmaletz_mining_Main.getContainer(); + com_davidmaletz_controls_ClickableWindow.call(this,c3,com_davidmaletz_mining_Main.window_factory.create(w,h),true,true,true,0.5,0.5,com_davidmaletz_tiles_Tile.SIZE >> 1); + this.accept = onSelect; + c3.addDisplay(this,2); + this.sprite.set_x(8 + com_davidmaletz_tiles_Tile.SIZE * 1.5); + this.sprite.set_y(4); + this.addChild(this.sprite); + this.options = []; + var e2 = this.info.xml.elements(); + while(e2.hasNext()) { + var e3 = e2.next(); + var id1 = e3.get("id"); + var c4 = e3.exists("type") ? e3.get("type") : id1; + var _g1 = e3.nodeName(); + switch(_g1) { + case "color": + var ar2 = com_davidmaletz_mining_ColorInfo.get(c4); + if(ar2 != null && ar2.length > 1) { + var co = new com_davidmaletz_mining_ui__$CharacterColorWindow_ColorOption(e3.get("name"),id1,c4,ar2,this.colors.get(id1),$bind(this,this.setColor)); + this.options.push(co); + this.sprite.addItem(this.clickables,co); + } + break; + case "offset": + var ar3 = com_davidmaletz_mining_OffsetInfo.get(c4); + if(ar3 != null && ar3.length > 1) { + var oo = new com_davidmaletz_mining_ui__$CharacterColorWindow_OffsetOption(e3.get("name"),id1,c4,ar3,this.offsets.get(id1),$bind(this,this.setOffset)); + this.options.push(oo); + this.sprite.addItem(this.clickables,oo); + } + break; + } + } + this.preview = new com_davidmaletz_faengfl_Preview(this.info.layers,this.colors,this.offsets); + var a = com_davidmaletz_tiles_TileAnimation._get((p.xml.exists("animation") ? p.xml.get("animation") + "." : "player.") + "beard.idle"); + if(a != null && p.hasBeard) { + this.preview.addOffsetLayer("hair","beard",this.colors,this.offsets,a); + } + this.preview.set_y(4 + Math.round((this.sprite.getHeight() - com_davidmaletz_tiles_Tile.SIZE * 2) * 0.5)); + this.preview.set_x(4 + com_davidmaletz_tiles_Tile.SIZE * 2.5); + this.preview.set_scaleX(-2); + this.preview.set_scaleY(2); + this.addChild(this.preview); + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,title,w,0,120); + this.clickables.allowLoop = false; + var y = 4 + this.sprite.getHeight(); + var okay_button = new com_davidmaletz_mining_ui_TextButton(0,y,com_fancyfish_faeng_common_Lang.getText("common","ok"),$bind(this,this.ok)); + this.sprite.addChild(okay_button); + this.clickables.addClickable(okay_button,this.sprite); + var b = new com_davidmaletz_mining_ui_TextButton(4 + okay_button.getPos().get_right(),y,com_fancyfish_faeng_common_Lang.getText("common","random"),$bind(this,this.random),w - 12 - 80 - this.sprite.get_x()); + this.sprite.addChild(b); + this.clickables.addClickable(b,this.sprite); + var cancel = new com_davidmaletz_mining_ui_TextButton(w - 4 - 40 - this.sprite.get_x(),y,com_fancyfish_faeng_common_Lang.getText("common","cancel"),$bind(this,this.close)); + this.sprite.addChild(cancel); + this.clickables.addClickable(cancel,this.sprite); +}; +$hxClasses["com.davidmaletz.mining.ui.CharacterColorWindow"] = com_davidmaletz_mining_ui_CharacterColorWindow; +com_davidmaletz_mining_ui_CharacterColorWindow.__name__ = ["com","davidmaletz","mining","ui","CharacterColorWindow"]; +com_davidmaletz_mining_ui_CharacterColorWindow.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_CharacterColorWindow.rnd = null; +com_davidmaletz_mining_ui_CharacterColorWindow.getRnd = function() { + if(com_davidmaletz_mining_ui_CharacterColorWindow.rnd == null) { + com_davidmaletz_mining_ui_CharacterColorWindow.rnd = com_fancyfish_faeng_common_Random.create(); + } + return com_davidmaletz_mining_ui_CharacterColorWindow.rnd; +}; +com_davidmaletz_mining_ui_CharacterColorWindow.getDefault = function(info) { + var d = Reflect.field(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"colors"); + if(d == null) { + return com_davidmaletz_mining_Player.getDefaults(info,com_davidmaletz_mining_ui_CharacterColorWindow.getRnd()); + } else { + var cols = new haxe_ds_StringMap(); + var offs = new haxe_ds_StringMap(); + com_davidmaletz_mining_Player.readColors(new haxe_io_BytesInput(d),81,cols,offs); + return { colors : cols, offsets : offs}; + } +}; +com_davidmaletz_mining_ui_CharacterColorWindow.create = function(entry,onSelect) { + var p = com_davidmaletz_mining_world_Generate.getStartPlayer(entry); + if(p == null) { + return; + } + var d = com_davidmaletz_mining_ui_CharacterColorWindow.getDefault(p); + if(com_davidmaletz_mining_Main.beforeDate(4,1,2018)) { + onSelect(d.colors,d.offsets,null); + } else { + new com_davidmaletz_mining_ui_CharacterColorWindow(p,onSelect,d.colors,d.offsets,com_fancyfish_faeng_common_Lang.getText("create.character","title")); + } +}; +com_davidmaletz_mining_ui_CharacterColorWindow.check = function(entry,onSelect,header) { + if(header == null || !Reflect.hasField(header,"version")) { + com_davidmaletz_mining_ui_CharacterColorWindow.create(entry,onSelect); + } else if(!com_davidmaletz_mining_Main.beforeDate(4,1,2018) && header.version < 53) { + var c = new com_davidmaletz_mining_ui_CharacterColorWindow(header.player.getInfo(),onSelect,header.player.colors,header.player.offsets,com_fancyfish_faeng_common_Lang.getText("create.character","title")); + var f = onSelect; + c.onClose = function() { + f(null,null,null); + }; + } else { + onSelect(null,null,null); + } +}; +com_davidmaletz_mining_ui_CharacterColorWindow.__super__ = com_davidmaletz_controls_ClickableWindow; +com_davidmaletz_mining_ui_CharacterColorWindow.prototype = $extend(com_davidmaletz_controls_ClickableWindow.prototype,{ + accept: null + ,colors: null + ,options: null + ,offsets: null + ,sprite: null + ,info: null + ,preview: null + ,random: function() { + var d = com_davidmaletz_mining_Player.getDefaults(this.info,com_davidmaletz_mining_ui_CharacterColorWindow.getRnd()); + var cols = d.colors; + var c = cols.keys(); + while(c.hasNext()) { + var c1 = c.next(); + this.setColor(c1,cols.get(c1)); + } + var offs = d.offsets; + var o = offs.keys(); + while(o.hasNext()) { + var o1 = o.next(); + this.setOffset(o1,offs.get(o1)); + } + var _g = 0; + var _g1 = this.options; + while(_g < _g1.length) { + var o2 = _g1[_g]; + ++_g; + o2.update(this.colors,this.offsets); + } + var len = this.sprite.get_numChildren(); + var _g11 = 0; + var _g2 = len; + while(_g11 < _g2) { + var i = _g11++; + var s = this.sprite.getChildAt(i); + if(Std["is"](s,com_davidmaletz_mining_ui_ChoiceOption)) { + (js_Boot.__cast(s , com_davidmaletz_mining_ui_ChoiceOption)).update(); + } + } + } + ,setColor: function(key,col) { + this.preview.setColor(key,col); + this.colors.set(key,col); + } + ,setOffset: function(key,off) { + this.preview.setOffset(key,off); + this.offsets.set(key,off); + } + ,init: function(e) { + com_davidmaletz_controls_ClickableWindow.prototype.init.call(this,e); + com_davidmaletz_controls_Controller.instance.addEventListener("tap",$bind(this,this.tap),false,com_davidmaletz_faengfl_Window.window_ct + 1); + } + ,destroy: function(e) { + com_davidmaletz_controls_ClickableWindow.prototype.destroy.call(this,e); + com_davidmaletz_controls_Controller.instance.removeEventListener("tap",$bind(this,this.tap)); + } + ,tap: function(e) { + var left = e.key == "left"; + var right = e.key == "right"; + var sel = this.clickables.getSelected(); + if(left || right) { + if(Std["is"](sel,com_davidmaletz_mining_ui_AdjustOption)) { + var a = js_Boot.__cast(sel , com_davidmaletz_mining_ui_AdjustOption); + if(left) { + if(a.prevValue()) { + com_davidmaletz_faengfl_adv_sound_Sound.play("move"); + } + } else if(a.nextValue()) { + com_davidmaletz_faengfl_adv_sound_Sound.play("move"); + } + } else if(Std["is"](sel,com_davidmaletz_mining_ui_TextButton)) { + this.clickables.moveSelection(left ? -1 : 1,999,true); + } + e.stopImmediatePropagation(); + } + } + ,ok: function() { + var b = new haxe_io_BytesOutput(); + com_davidmaletz_mining_Player.writeColors(b,this.colors,this.offsets); + Reflect.setField(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"colors",b.getBytes()); + com_davidmaletz_faengfl_adv_AdvApp.settings.flush(); + this.accept(this.colors,this.offsets,this); + this.close(); + } + ,onSelect: function(item) { + } + ,onHover: function(item) { + } + ,isEnabled: function(item) { + return true; + } + ,__class__: com_davidmaletz_mining_ui_CharacterColorWindow +}); +var com_davidmaletz_mining_ui__$CharacterColorWindow_UpdateOption = function() { }; +$hxClasses["com.davidmaletz.mining.ui._CharacterColorWindow.UpdateOption"] = com_davidmaletz_mining_ui__$CharacterColorWindow_UpdateOption; +com_davidmaletz_mining_ui__$CharacterColorWindow_UpdateOption.__name__ = ["com","davidmaletz","mining","ui","_CharacterColorWindow","UpdateOption"]; +com_davidmaletz_mining_ui__$CharacterColorWindow_UpdateOption.prototype = { + update: null + ,__class__: com_davidmaletz_mining_ui__$CharacterColorWindow_UpdateOption +}; +var com_davidmaletz_mining_ui_OptionValue = function(id) { + this.id = id; +}; +$hxClasses["com.davidmaletz.mining.ui.OptionValue"] = com_davidmaletz_mining_ui_OptionValue; +com_davidmaletz_mining_ui_OptionValue.__name__ = ["com","davidmaletz","mining","ui","OptionValue"]; +com_davidmaletz_mining_ui_OptionValue.__interfaces__ = [AbstractClass]; +com_davidmaletz_mining_ui_OptionValue.prototype = { + id: null + ,getOption: function() { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,setOption: function(o) { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,optionToString: function(o) { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,getIcon: function() { + return null; + } + ,getLabel: function() { + return com_fancyfish_faeng_common_Lang.getText("options",this.id); + } + ,updateSettings: function() { + } + ,getSize: function() { + return 1; + } + ,getColor: function(o) { + return 0; + } + ,__class__: com_davidmaletz_mining_ui_OptionValue +}; +var com_davidmaletz_mining_ui__$CharacterColorWindow_ColorOption = function(name,key,t,colors,col,set) { + this.name = com_fancyfish_faeng_common_Lang.getTextFromTitle(name); + if(this.name == null) { + this.name = com_fancyfish_faeng_common_Lang.getText("create.character",t); + } + com_davidmaletz_mining_ui_OptionValue.call(this,key); + this.type = t; + this.idx = -1; + this.colors = colors; + this.setColor = set; + this.idx = this.getIdx(col); +}; +$hxClasses["com.davidmaletz.mining.ui._CharacterColorWindow.ColorOption"] = com_davidmaletz_mining_ui__$CharacterColorWindow_ColorOption; +com_davidmaletz_mining_ui__$CharacterColorWindow_ColorOption.__name__ = ["com","davidmaletz","mining","ui","_CharacterColorWindow","ColorOption"]; +com_davidmaletz_mining_ui__$CharacterColorWindow_ColorOption.__interfaces__ = [com_davidmaletz_mining_ui__$CharacterColorWindow_UpdateOption]; +com_davidmaletz_mining_ui__$CharacterColorWindow_ColorOption.__super__ = com_davidmaletz_mining_ui_OptionValue; +com_davidmaletz_mining_ui__$CharacterColorWindow_ColorOption.prototype = $extend(com_davidmaletz_mining_ui_OptionValue.prototype,{ + idx: null + ,colors: null + ,setColor: null + ,type: null + ,name: null + ,getIdx: function(col) { + var len = this.colors.length; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + if(this.colors[i].color == col) { + return i; + } + } + return -1; + } + ,getOption: function() { + return this.idx; + } + ,setOption: function(o) { + var len = this.colors.length; + if(len == 0) { + return; + } else if(o < -1) { + o = len - 1; + } else if(o < 0) { + o += len; + } else if(o >= len) { + o -= len; + } + if(o != this.getOption()) { + this.idx = o; + this.setColor(this.id,this.colors[o].color); + } + } + ,optionToString: function(o) { + if(o < 0 || o >= this.colors.length) { + return com_fancyfish_faeng_common_Lang.getText("colors","custom"); + } else { + return this.colors[o].getName(); + } + } + ,getLabel: function() { + return this.name; + } + ,update: function(colors,offsets) { + this.idx = this.getIdx(colors.get(this.id)); + } + ,__class__: com_davidmaletz_mining_ui__$CharacterColorWindow_ColorOption +}); +var com_davidmaletz_mining_ui__$CharacterColorWindow_OffsetOption = function(name,key,t,offsets,off,set) { + this.name = com_fancyfish_faeng_common_Lang.getTextFromTitle(name); + if(this.name == null) { + this.name = com_fancyfish_faeng_common_Lang.getText("create.character",t == key ? key + "_style" : t); + } + com_davidmaletz_mining_ui_OptionValue.call(this,key); + this.type = t; + this.idx = -1; + this.offsets = offsets; + this.setOffset = set; + this.idx = this.getIdx(off); +}; +$hxClasses["com.davidmaletz.mining.ui._CharacterColorWindow.OffsetOption"] = com_davidmaletz_mining_ui__$CharacterColorWindow_OffsetOption; +com_davidmaletz_mining_ui__$CharacterColorWindow_OffsetOption.__name__ = ["com","davidmaletz","mining","ui","_CharacterColorWindow","OffsetOption"]; +com_davidmaletz_mining_ui__$CharacterColorWindow_OffsetOption.__interfaces__ = [com_davidmaletz_mining_ui__$CharacterColorWindow_UpdateOption]; +com_davidmaletz_mining_ui__$CharacterColorWindow_OffsetOption.__super__ = com_davidmaletz_mining_ui_OptionValue; +com_davidmaletz_mining_ui__$CharacterColorWindow_OffsetOption.prototype = $extend(com_davidmaletz_mining_ui_OptionValue.prototype,{ + idx: null + ,offsets: null + ,setOffset: null + ,type: null + ,name: null + ,getIdx: function(off) { + var len = this.offsets.length; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + if(this.offsets[i].offset.equals(off)) { + return i; + } + } + return -1; + } + ,getOption: function() { + return this.idx; + } + ,setOption: function(o) { + var len = this.offsets.length; + if(len == 0) { + return; + } else if(o < -1) { + o = len - 1; + } else if(o < 0) { + o += len; + } else if(o >= len) { + o -= len; + } + if(o != this.getOption()) { + this.idx = o; + this.setOffset(this.id,this.offsets[o].offset); + } + } + ,optionToString: function(o) { + if(o < 0 || o >= this.offsets.length) { + return com_fancyfish_faeng_common_Lang.getText("colors","custom"); + } else { + return this.offsets[o].getName(); + } + } + ,getLabel: function() { + return this.name; + } + ,update: function(colors,offsets) { + this.idx = this.getIdx(offsets.get(this.id)); + } + ,__class__: com_davidmaletz_mining_ui__$CharacterColorWindow_OffsetOption +}); +var com_davidmaletz_mining_ui_CharacterPanel = function(p,width,height) { + com_davidmaletz_faengfl_InitSprite.call(this); + this.player = p; + var stats = new com_davidmaletz_mining_ui_CharacterBars(p,width,3); + var w = width - 6 - com_davidmaletz_tiles_Tile.SIZE; + this.addChild(stats); + var t = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Concat(com_fancyfish_faeng_common_Lang.getText("stats","attack"),":"),new com_fancyfish_faeng_text_CharacterPlacer(0),0,1); + var HT = t.lineHeight(); + var y = 3 * HT + 3; + t.set_y(y); + t.set_x(3); + this.weap = t; + this.attack = new com_fancyfish_faeng_common_mutable_Mutable(); + this.attack_icon = new com_davidmaletz_faengfl_TileLayer(); + this.attack_icon.set_x(w + 3); + this.attack_icon.set_y(y); + var t1 = new com_davidmaletz_faengfl_TextSprite(this.attack,new com_fancyfish_faeng_text_CharacterPlacer(w,2),0,1); + t1.set_y(y); + if(this.player.equipment.isSlotVisible(this.player,"weapon")) { + y += HT; + this.addChild(this.weap); + this.addChild(this.attack_icon); + this.addChild(t1); + } + this.attack_text = t1; + var t2 = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Concat(com_fancyfish_faeng_common_Lang.getText("stats","defense"),":"),new com_fancyfish_faeng_text_CharacterPlacer(0),0,1); + t2.set_y(y); + t2.set_x(3); + this.addChild(t2); + this.defense = new com_fancyfish_faeng_common_mutable_Mutable(); + this.defense_icon = new com_davidmaletz_faengfl_TileLayer(); + this.defense_icon.set_x(w + 3); + this.defense_icon.set_y(y); + this.addChild(this.defense_icon); + var t3 = new com_davidmaletz_faengfl_TextSprite(this.defense,new com_fancyfish_faeng_text_CharacterPlacer(w,2),0,1); + t3.set_y(y); + y += HT; + this.addChild(t3); + this.defense_text = t3; + if(this.player.equipment.isSlotVisible(this.player,"pickaxe")) { + var t4 = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Concat(com_fancyfish_faeng_common_Lang.getText("stats","mine"),":"),new com_fancyfish_faeng_text_CharacterPlacer(0),0,1); + t4.set_y(y); + t4.set_x(3); + this.addChild(t4); + this.mine = new com_fancyfish_faeng_common_mutable_Mutable(); + this.mine_icon = new com_davidmaletz_faengfl_TileLayer(); + this.mine_icon.set_x(w + 3); + this.mine_icon.set_y(y); + this.addChild(this.mine_icon); + var t5 = new com_davidmaletz_faengfl_TextSprite(this.mine,new com_fancyfish_faeng_text_CharacterPlacer(w,2),0,1); + t5.set_y(y); + y += HT; + this.addChild(t5); + this.mine_text = t5; + } + this.stat_button_y = y; + var y1 = height - HT; + var t6 = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("skill","points"),new com_fancyfish_faeng_text_CharacterPlacer(0),0,1); + t6.set_x(3); + t6.set_y(y1); + this.addChild(t6); + this.points = new com_fancyfish_faeng_common_mutable_Mutable(); + var t7 = new com_davidmaletz_faengfl_TextSprite(this.points,new com_fancyfish_faeng_text_CharacterPlacer(width - 6,2),0,1); + t7.set_x(3); + t7.set_y(y1); + this.addChild(t7); + y1 -= HT; + var t8 = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("common","level"),new com_fancyfish_faeng_text_CharacterPlacer(0),0,1); + t8.set_x(3); + t8.set_y(y1); + this.addChild(t8); + this.level = new com_fancyfish_faeng_common_mutable_Mutable(); + t8.draw(); + this.progress = com_davidmaletz_mining_ui_Fuel.createFuelBar(0); + this.progress.set_x(t8.get_x() + Math.min((t8.bounds.x + t8.bounds.width) * t8.get_scaleX(),30) + 6); + this.progress.set_y(y1 + (HT - 2) * 0.5); + this.addChild(this.progress); + var t9 = new com_davidmaletz_faengfl_TextSprite(this.level,new com_fancyfish_faeng_text_CharacterPlacer(width - 6,2),0,1); + t9.set_x(3); + t9.set_y(y1); + this.addChild(t9); + y1 -= HT; + var t10 = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("common","experience"),new com_fancyfish_faeng_text_CharacterPlacer(0),0,1); + t10.set_x(3); + t10.set_y(y1); + this.addChild(t10); + this.exp = new com_fancyfish_faeng_common_mutable_Mutable(); + var t11 = new com_davidmaletz_faengfl_TextSprite(this.exp,new com_fancyfish_faeng_text_CharacterPlacer(width - 6,2),0,1); + t11.set_x(3); + t11.set_y(y1); + this.addChild(t11); +}; +$hxClasses["com.davidmaletz.mining.ui.CharacterPanel"] = com_davidmaletz_mining_ui_CharacterPanel; +com_davidmaletz_mining_ui_CharacterPanel.__name__ = ["com","davidmaletz","mining","ui","CharacterPanel"]; +com_davidmaletz_mining_ui_CharacterPanel.setIcon = function(eq,name,l) { + if(l.userData != null) { + (js_Boot.__cast(l.userData , com_davidmaletz_mining_ui__$CharacterPanel_IconHandler)).kill(); + l.userData = null; + } + var t; + var tmp; + if(eq != null) { + t = eq.getIcon(name == null ? null : name.getName()); + tmp = t != null; + } else { + tmp = false; + } + if(tmp) { + l.start(); + t.render(null,l,0,0); + l.finish(); + if(name == null) { + eq.tint(l); + } else { + l.userData = new com_davidmaletz_mining_ui__$CharacterPanel_IconHandler(l,eq,name,t); + } + } else { + l.clear(); + } +}; +com_davidmaletz_mining_ui_CharacterPanel.__super__ = com_davidmaletz_faengfl_InitSprite; +com_davidmaletz_mining_ui_CharacterPanel.prototype = $extend(com_davidmaletz_faengfl_InitSprite.prototype,{ + player: null + ,progress: null + ,level: null + ,exp: null + ,attack: null + ,defense: null + ,mine: null + ,weap: null + ,attack_icon: null + ,defense_icon: null + ,mine_icon: null + ,attack_text: null + ,defense_text: null + ,mine_text: null + ,points: null + ,stat_button_y: null + ,init: function(e) { + this.destroy(e); + this.player.addEventListener("add_exp",$bind(this,this.updateExperience)); + this.updateExperience(null); + var m = this.player.equipment.get("weapon"); + if(m != null) { + this.player.equipment.getUsed("weapon").addEventListener("updated",$bind(this,this.updateEquipment)); + m.addEventListener("updated",$bind(this,this.updateEquipment)); + } + this.player.stats.addEventListener("updated",$bind(this,this.updateEquipment)); + this.updateEquipment(null); + var e1 = this.player.equipment.getSlots(); + while(e1.hasNext()) { + var e2 = e1.next(); + this.player.equipment.get(e2).addEventListener("updated",$bind(this,this.updateDefense)); + } + this.player.stats.get("defense").addEventListener("updated",$bind(this,this.updateDefense)); + this.updateDefense(null); + if(this.mine != null) { + var m1 = this.player.equipment.get("pickaxe"); + if(m1 != null) { + this.player.equipment.getUsed("pickaxe").addEventListener("updated",$bind(this,this.updateMine)); + m1.addEventListener("updated",$bind(this,this.updateMine)); + } + this.updateMine(null); + } + this.player.skills.addEventListener("skill_change",$bind(this,this.updatePoints)); + this.updatePoints(null); + } + ,destroy: function(e) { + this.player.removeEventListener("add_exp",$bind(this,this.updateExperience)); + var m = this.player.equipment.get("weapon"); + if(m != null) { + this.player.equipment.getUsed("weapon").removeEventListener("updated",$bind(this,this.updateEquipment)); + m.removeEventListener("updated",$bind(this,this.updateEquipment)); + } + this.player.stats.removeEventListener("updated",$bind(this,this.updateEquipment)); + var e1 = this.player.equipment.getSlots(); + while(e1.hasNext()) { + var e2 = e1.next(); + this.player.equipment.get(e2).removeEventListener("updated",$bind(this,this.updateDefense)); + } + this.player.stats.get("defense").removeEventListener("updated",$bind(this,this.updateDefense)); + var m1 = this.player.equipment.get("pickaxe"); + if(this.mine != null && m1 != null) { + this.player.equipment.getUsed("pickaxe").removeEventListener("updated",$bind(this,this.updateMine)); + m1.removeEventListener("updated",$bind(this,this.updateMine)); + } + this.player.skills.removeEventListener("skill_change",$bind(this,this.updatePoints)); + } + ,updateExperience: function(e) { + this.progress.setProgress(this.player.getExpPercent(),e == null ? 0 : 5); + var l = this.player.getLevel(); + this.level.set(Std.string(l + 1)); + this.exp.set(com_fancyfish_faeng_common_Utils.largeNumberFormat2(this.player.experience) + "/" + com_fancyfish_faeng_common_Utils.largeNumberFormat2(com_davidmaletz_mining_Player.experienceToNextLevel(l))); + } + ,setColor: function(text,r,g) { + var c = text.get_transform().get_colorTransform(); + c.redMultiplier = r; + c.greenMultiplier = g; + text.get_transform().set_colorTransform(c); + } + ,setEquip: function(val,m) { + var t = val == null ? "null" : "" + val; + if(m > 0) { + t += "+" + m; + this.setColor(this.attack_text,0,0.3); + } else if(m < 0) { + t += m; + this.setColor(this.attack_text,0.3,0); + } else { + this.setColor(this.attack_text,0,0); + } + this.attack.set(t); + } + ,updatePoints: function(e) { + var max = this.player.getPointsForLevel(this.player.getLevel()); + this.points.set(com_fancyfish_faeng_common_Utils.max(0,max - this.player.skills.points) + "/" + max); + } + ,setWeap: function(m) { + this.weap.setText(new com_fancyfish_faeng_common_mutable_Concat(m,":")); + } + ,updateEquipment: function(e) { + var e1 = this.player.equipment.getItemUsed("weapon"); + com_davidmaletz_mining_ui_CharacterPanel.setIcon(e1 != null && Std["is"](e1.info,com_davidmaletz_mining_item_Equipment) ? js_Boot.__cast(e1.info , com_davidmaletz_mining_item_Equipment) : null,e1 == null ? null : e1.getName(),this.attack_icon); + e1 = this.player.getUseItem(e1,false); + var a = e1 != null && Std["is"](e1.info,com_davidmaletz_mining_item_Equipment) ? js_Boot.__cast(e1.info , com_davidmaletz_mining_item_Equipment) : null; + if(a != null && (a.xml.elementsNamed("projectile").hasNext() || a.getRange(e1.getNameStr()) > 0)) { + this.setWeap(com_fancyfish_faeng_common_Lang.getText("stats","range")); + this.setEquip(a.getRange(e1.getNameStr()),this.player.stats.getInt("range")); + } else if(a != null && a.getAttack(e1.getNameStr()) > 0) { + this.setWeap(com_fancyfish_faeng_common_Lang.getText("stats","attack")); + this.setEquip(a.getAttack(e1.getNameStr()),this.player.stats.getInt("attack")); + } else if(a != null && a.getCut(e1.getNameStr()) > 0) { + this.setWeap(com_fancyfish_faeng_common_Lang.getText("stats","cut")); + this.setEquip(a.getCut(e1.getNameStr()),this.player.stats.getInt("cut")); + } else if(a != null && a.getFishing(e1.getNameStr()) > 0) { + this.setWeap(com_fancyfish_faeng_common_Lang.getText("stats","fishing")); + this.setEquip(a.getFishing(e1.getNameStr()),this.player.stats.getInt("fishing")); + } else { + this.setColor(this.attack_text,0,0); + this.attack.set("-"); + } + } + ,updateDefense: function(e) { + var d = this.player.getDefense(null,false,false,false); + var m = this.player.stats.getInt("defense"); + var t = d == 0 ? "-" : Std.string(d - m); + if(d != 0 && m != 0) { + if(m > 0) { + t += "+" + m; + this.setColor(this.defense_text,0,0.3); + } else { + t += m; + this.setColor(this.defense_text,0.3,0); + } + } else { + this.setColor(this.defense_text,0,0); + } + this.defense.set(t); + var a = this.player.equipment.getItemUsed("armor"); + com_davidmaletz_mining_ui_CharacterPanel.setIcon(a == null ? null : a.info,a == null ? null : a.getName(),this.defense_icon); + } + ,updateMine: function(e) { + var a = this.player.equipment.getItemUsed("pickaxe"); + var m = this.player.stats.getInt("mine"); + com_davidmaletz_mining_ui_CharacterPanel.setIcon(a == null ? null : a.info,a == null ? null : a.getName(),this.mine_icon); + a = this.player.getUseItem(a,false); + var t = a == null ? "-" : Std.string((js_Boot.__cast(a.info , com_davidmaletz_mining_item_Equipment)).getMine(a.getNameStr())); + if(a != null && m != 0) { + if(m > 0) { + t += "+" + m; + this.setColor(this.mine_text,0,0.3); + } else { + t += m; + this.setColor(this.mine_text,0.3,0); + } + } else { + this.setColor(this.mine_text,0,0); + } + this.mine.set(t); + } + ,__class__: com_davidmaletz_mining_ui_CharacterPanel +}); +var com_davidmaletz_mining_ui__$CharacterPanel_IconHandler = function(l,e,n,t) { + this.eq = e; + this.name = n; + this.l = l; + this.tile = t; + l.addEventListener("addedToStage",$bind(this,this.init)); + l.addEventListener("removedFromStage",$bind(this,this.destroy)); + if(l.stage != null) { + this.init(null); + } +}; +$hxClasses["com.davidmaletz.mining.ui._CharacterPanel.IconHandler"] = com_davidmaletz_mining_ui__$CharacterPanel_IconHandler; +com_davidmaletz_mining_ui__$CharacterPanel_IconHandler.__name__ = ["com","davidmaletz","mining","ui","_CharacterPanel","IconHandler"]; +com_davidmaletz_mining_ui__$CharacterPanel_IconHandler.prototype = { + l: null + ,eq: null + ,name: null + ,tile: null + ,init: function(e) { + this.destroy(e); + this.name.addEventListener("updated",$bind(this,this.updateTint)); + this.updateTint(null); + } + ,destroy: function(e) { + this.name.removeEventListener("updated",$bind(this,this.updateTint)); + } + ,kill: function() { + this.destroy(null); + this.l.removeEventListener("addedToStage",$bind(this,this.init)); + this.l.removeEventListener("removedFromStage",$bind(this,this.destroy)); + } + ,updateTint: function(e) { + this.eq.tint(this.l,this.name.getName()); + var t = this.eq.getIcon(this.name.getName()); + if(t != this.tile) { + this.tile = t; + this.l.start(); + if(t != null) { + t.render(null,this.l,0,0); + } + this.l.finish(); + } + } + ,__class__: com_davidmaletz_mining_ui__$CharacterPanel_IconHandler +}; +var com_davidmaletz_mining_ui_Checkbox = function(x,y,txt,w,checked) { + if(checked == null) { + checked = false; + } + if(w == null) { + w = -1; + } + if(w == -1) { + w = 40; + } + var f = com_davidmaletz_mining_Main.label_factory; + var ht = com_davidmaletz_mining_ui_Checkbox.getHeight(); + com_davidmaletz_controls_Button.call(this,x,y,f.createBG(w,ht),f.createHover(w,ht),txt); + var _g = this.getChildAt(this.get_numChildren() - 1); + _g.set_x(_g.get_x() + (ht + 4)); + this.addChild(new com_davidmaletz_faengfl_SolidDrawable(16777215,ht,ht,1).create(0,0)); + this.check = new com_davidmaletz_faengfl_SolidDrawable(0,ht - 4,ht - 4).create(2,2); + this.check.set_visible(checked); + this.addChild(this.check); +}; +$hxClasses["com.davidmaletz.mining.ui.Checkbox"] = com_davidmaletz_mining_ui_Checkbox; +com_davidmaletz_mining_ui_Checkbox.__name__ = ["com","davidmaletz","mining","ui","Checkbox"]; +com_davidmaletz_mining_ui_Checkbox.getHeight = function() { + return com_davidmaletz_mining_ui_StringRenderer._getHeight(); +}; +com_davidmaletz_mining_ui_Checkbox.__super__ = com_davidmaletz_controls_Button; +com_davidmaletz_mining_ui_Checkbox.prototype = $extend(com_davidmaletz_controls_Button.prototype,{ + check: null + ,getTextAlign: function() { + return 0; + } + ,isChecked: function() { + return this.check.get_visible() == true; + } + ,onClick: function() { + this.check.set_visible(!this.check.get_visible()); + return true; + } + ,__class__: com_davidmaletz_mining_ui_Checkbox +}); +var com_davidmaletz_mining_ui_Choice = function(c,section,options,functions,w,darken,closeButton,halign,valign,cols,autoSelect) { + if(autoSelect == null) { + autoSelect = true; + } + if(cols == null) { + cols = 1; + } + if(valign == null) { + valign = 0.5; + } + if(halign == null) { + halign = 0.5; + } + if(closeButton == null) { + closeButton = true; + } + if(darken == null) { + darken = true; + } + if(w == null) { + w = 80; + } + var r = new EReg("\\[[^\\]]*\\]","g"); + var fnt = com_fancyfish_faeng_text_FontManager.defaultFont.get(); + if(fnt != null) { + var _g = 0; + while(_g < options.length) { + var o = options[_g]; + ++_g; + var ow = Math.ceil(fnt.stringWidth(r.replace(com_davidmaletz_mining_ui_StringRenderer.mutableFromId(section,o).get(),""))); + if(ow > w) { + w = ow; + } + } + } + var len = options.length; + com_davidmaletz_controls_ListWindow.call(this,c,com_davidmaletz_mining_Main.window_factory,new com_davidmaletz_mining_ui_StringRenderer(section,this,w),Math.ceil(len / cols),cols,darken,true,closeButton,halign,valign); + this.functionMap = new haxe_ds_StringMap(); + this.autoSelect = autoSelect; + var _g1 = 0; + var _g2 = len; + while(_g1 < _g2) { + var i = _g1++; + var o1 = options[i]; + this.addItem(o1); + this.functionMap.set(o1,functions[i]); + } +}; +$hxClasses["com.davidmaletz.mining.ui.Choice"] = com_davidmaletz_mining_ui_Choice; +com_davidmaletz_mining_ui_Choice.__name__ = ["com","davidmaletz","mining","ui","Choice"]; +com_davidmaletz_mining_ui_Choice.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_Choice.__super__ = com_davidmaletz_controls_ListWindow; +com_davidmaletz_mining_ui_Choice.prototype = $extend(com_davidmaletz_controls_ListWindow.prototype,{ + functionMap: null + ,autoSelect: null + ,init: function(e) { + com_davidmaletz_controls_ListWindow.prototype.init.call(this,e); + if(!this.autoSelect) { + this.clickables.setSelected(null,0,0); + } + } + ,onCancel: function() { + if(this.darken != null || Std["is"](this.getChildAt(this.get_numChildren() - 1),com_davidmaletz_controls_CloseButton)) { + this.close(); + } + } + ,onSelect: function(item) { + var m = this.functionMap.get(item); + if(m != null) { + this.onClose = m; + this.close(); + } + } + ,onHover: function(item) { + } + ,isEnabled: function(item) { + return true; + } + ,__class__: com_davidmaletz_mining_ui_Choice +}); +var com_davidmaletz_mining_ui_Coins = function(p,c) { + com_davidmaletz_lerp_LerpSprite.call(this); + this.player = p; + this.coins = new com_fancyfish_faeng_common_mutable_Mutable(); + this.coins.set(""); + this.tile = p.currencyIcon; + this.storage = p.currencyValue; + this.icon = com_davidmaletz_mining_ui_Coins.makeIcon(this.tile); + this.addChild(this.icon); + var t = new com_davidmaletz_faengfl_TextSprite(this.coins,new com_fancyfish_faeng_text_CharacterPlacer(25,2),16777215,1); + this.set_visible(false); + t.set_x(com_davidmaletz_tiles_Tile.SIZE + 2); + this.addChild(t); + this.set_x(2); + this.set_y(2); +}; +$hxClasses["com.davidmaletz.mining.ui.Coins"] = com_davidmaletz_mining_ui_Coins; +com_davidmaletz_mining_ui_Coins.__name__ = ["com","davidmaletz","mining","ui","Coins"]; +com_davidmaletz_mining_ui_Coins.makeIcon = function(tile) { + var t = com_davidmaletz_tiles_Tile.get(tile); + var s; + if(com_davidmaletz_tiles_TileAnimation.exists(tile)) { + s = new com_davidmaletz_tiles_render_StaticPlayAnimation(t,tile,10,true); + } else { + s = com_davidmaletz_mining_item_ItemInfo._createIcon(t); + } + if(t.getHeight() >= 16) { + s.set_scaleX(s.set_scaleY(0.5)); + } + return s; +}; +com_davidmaletz_mining_ui_Coins.__super__ = com_davidmaletz_lerp_LerpSprite; +com_davidmaletz_mining_ui_Coins.prototype = $extend(com_davidmaletz_lerp_LerpSprite.prototype,{ + icon: null + ,tile: null + ,storage: null + ,player: null + ,coins: null + ,addListeners: function() { + if(StringTools.startsWith(this.storage,"var:") || StringTools.startsWith(this.storage,"tvar:")) { + this.player.state.addEventListener("state_changed",$bind(this,this.change_coins)); + } else if(StringTools.startsWith(this.storage,"item:")) { + this.player.inventory.addEventListener("item_added",$bind(this,this.change_coins)); + } else { + this.player.getStorage(this.storage).addEventListener("updated",$bind(this,this.change_coins)); + } + this.change_coins(null); + } + ,init: function(e) { + com_davidmaletz_lerp_LerpSprite.prototype.init.call(this,e); + this.player.inventory.addEventListener("item_added",$bind(this,this.change_visible)); + this.addListeners(); + this.change_visible(null); + } + ,removeListeners: function() { + if(StringTools.startsWith(this.storage,"var:") || StringTools.startsWith(this.storage,"tvar:")) { + this.player.state.removeEventListener("state_changed",$bind(this,this.change_coins)); + } else if(StringTools.startsWith(this.storage,"item:")) { + this.player.inventory.removeEventListener("item_added",$bind(this,this.change_coins)); + } else { + this.player.getStorage(this.storage).removeEventListener("updated",$bind(this,this.change_coins)); + } + } + ,destroy: function(e) { + com_davidmaletz_lerp_LerpSprite.prototype.destroy.call(this,e); + this.removeListeners(); + this.player.inventory.removeEventListener("item_added",$bind(this,this.change_visible)); + } + ,changeCurrency: function(icon,value) { + if(icon == null && StringTools.startsWith(value,"item:")) { + var i = com_davidmaletz_mining_item_ItemInfo.get(HxOverrides.substr(value,5,null)); + if(i != null) { + icon = i.xml.get("icon"); + } + } + if(icon != this.tile) { + com_davidmaletz_faengfl_FaengFL.remove(this.icon); + this.tile = icon; + this.player.currencyIcon = icon; + this.icon = com_davidmaletz_mining_ui_Coins.makeIcon(this.tile); + this.addChild(this.icon); + } + if(this.storage != value) { + this.removeListeners(); + this.storage = value; + this.player.currencyValue = value; + if(this.stage != null) { + this.addListeners(); + this.change_visible(null); + } + } + } + ,change_coins: function(e) { + if(StringTools.startsWith(this.storage,"var:")) { + this.coins.set(com_fancyfish_faeng_common_Utils.largeNumberFormat(this.player.getVar(HxOverrides.substr(this.storage,4,null)))); + } else if(StringTools.startsWith(this.storage,"tvar:")) { + this.coins.set(com_fancyfish_faeng_common_Utils.largeNumberFormat(this.player.getTmpVar(HxOverrides.substr(this.storage,5,null)))); + } else if(StringTools.startsWith(this.storage,"item:")) { + this.coins.set(com_fancyfish_faeng_common_Utils.largeNumberFormat(this.player.getItemCount(HxOverrides.substr(this.storage,5,null)))); + } else { + this.coins.set(com_fancyfish_faeng_common_Utils.largeNumberFormat(this.player.getStorage(this.storage).getValue())); + } + } + ,change_visible: function(e) { + var v = StringTools.startsWith(this.storage,"var:") || StringTools.startsWith(this.storage,"tvar:") || StringTools.startsWith(this.storage,"item:") || this.player.getStorage(this.storage).getMaxValue() > 0; + if(v != this.get_visible()) { + this.set_visible(v); + if(v) { + this.set_alpha(0); + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),10); + } + } + } + ,__class__: com_davidmaletz_mining_ui_Coins +}); +var com_davidmaletz_mining_ui_CompositeFarmItemRenderer = function(handler) { + this.handler = handler; +}; +$hxClasses["com.davidmaletz.mining.ui.CompositeFarmItemRenderer"] = com_davidmaletz_mining_ui_CompositeFarmItemRenderer; +com_davidmaletz_mining_ui_CompositeFarmItemRenderer.__name__ = ["com","davidmaletz","mining","ui","CompositeFarmItemRenderer"]; +com_davidmaletz_mining_ui_CompositeFarmItemRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui_CompositeFarmItemRenderer.prototype = { + handler: null + ,create: function(item,x,y) { + return new com_davidmaletz_mining_ui__$CompositeFarmItemRenderer_ListButton(this.handler,item,x,y); + } + ,update: function(s,item) { + } + ,getWidth: function() { + return 90; + } + ,getHeight: function(item) { + return 13; + } + ,__class__: com_davidmaletz_mining_ui_CompositeFarmItemRenderer +}; +var com_davidmaletz_mining_ui__$CompositeFarmItemRenderer_ListButton = function(handler,i,x,y) { + com_davidmaletz_controls_Button.call(this,x,y,com_davidmaletz_mining_Main.label_factory.createBG(90,13),com_davidmaletz_mining_Main.label_factory.createHover(90,13),null); + this.handler = handler; + this.text = new openfl_display_Sprite(); + this.item = i; + this.addChild(this.text); + if(i != null) { + com_davidmaletz_mining_ui_ItemRenderer.addItem(this.text,i.item,2); + this.count = new com_fancyfish_faeng_common_mutable_Mutable(); + var t = new com_davidmaletz_faengfl_TextSprite(this.count,new com_fancyfish_faeng_text_CharacterPlacer(86,2),0,1); + t.set_x(2); + this.text.addChild(t); + var p = i.getPercent(); + this.progress = new com_davidmaletz_controls_ProgressBar(90,2,com_davidmaletz_mining_Main.PROGRESS_COL,p,false); + if(p == 1) { + this.progress.set_visible(false); + } + if(!i.canHarvest()) { + this.text.set_alpha(0.5); + } + this.progress.set_y(11); + this.addChild(this.progress); + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); + } else { + var t1 = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("common","harvest_all"),new com_fancyfish_faeng_text_CharacterPlacer(90,1),0,1); + this.addChild(t1); + } +}; +$hxClasses["com.davidmaletz.mining.ui._CompositeFarmItemRenderer.ListButton"] = com_davidmaletz_mining_ui__$CompositeFarmItemRenderer_ListButton; +com_davidmaletz_mining_ui__$CompositeFarmItemRenderer_ListButton.__name__ = ["com","davidmaletz","mining","ui","_CompositeFarmItemRenderer","ListButton"]; +com_davidmaletz_mining_ui__$CompositeFarmItemRenderer_ListButton.__super__ = com_davidmaletz_controls_Button; +com_davidmaletz_mining_ui__$CompositeFarmItemRenderer_ListButton.prototype = $extend(com_davidmaletz_controls_Button.prototype,{ + item: null + ,count: null + ,handler: null + ,progress: null + ,text: null + ,init: function(e) { + this.destroy(e); + this.item.addEventListener("update_percent",$bind(this,this.updatePercent)); + this.item.addEventListener("update_crop",$bind(this,this.update)); + this.update(null); + } + ,destroy: function(e) { + this.item.removeEventListener("update_percent",$bind(this,this.updatePercent)); + this.item.removeEventListener("update_crop",$bind(this,this.update)); + } + ,onClick: function() { + this.handler.onSelect(this.item); + return true; + } + ,onHover: function(hover) { + com_davidmaletz_controls_Button.prototype.onHover.call(this,hover); + this.handler.onHover(hover ? this.item : null); + } + ,update: function(e) { + var min = this.item.getMin(); + var max = this.item.getMax(); + this.count.set(min == max ? min == null ? "null" : "" + min : (min == null ? "null" : "" + min) + "-" + (max == null ? "null" : "" + max)); + } + ,updatePercent: function(e) { + var p = this.item.getPercent(); + if(p == 1) { + this.progress.set_visible(false); + } else { + this.progress.set_visible(true); + this.progress.setProgress(p); + } + this.text.set_alpha(this.item.canHarvest() ? 1 : 0.5); + } + ,__class__: com_davidmaletz_mining_ui__$CompositeFarmItemRenderer_ListButton +}); +var com_davidmaletz_mining_ui_ContactList = function(c,handler,contacts,title) { + var r = new com_davidmaletz_mining_ui__$ContactList_ContactRenderer(this); + var rows = Math.floor(90 / r.getHeight(null)); + com_davidmaletz_controls_scroll_ScrollWindow.call(this,c,com_davidmaletz_mining_Main.window_factory,r,rows,1); + this.handler = handler; + var w = this.getWidth(); + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,title,w,0,120); + var c1 = contacts; + while(c1.hasNext()) { + var c2 = c1.next(); + this.addItem(c2); + } +}; +$hxClasses["com.davidmaletz.mining.ui.ContactList"] = com_davidmaletz_mining_ui_ContactList; +com_davidmaletz_mining_ui_ContactList.__name__ = ["com","davidmaletz","mining","ui","ContactList"]; +com_davidmaletz_mining_ui_ContactList.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_ContactList.__super__ = com_davidmaletz_controls_scroll_ScrollWindow; +com_davidmaletz_mining_ui_ContactList.prototype = $extend(com_davidmaletz_controls_scroll_ScrollWindow.prototype,{ + handler: null + ,onSelect: function(item) { + this.handler.queueProcedure(item.second); + this.close(); + } + ,onHover: function(item) { + } + ,isEnabled: function(item) { + return true; + } + ,__class__: com_davidmaletz_mining_ui_ContactList +}); +var com_davidmaletz_mining_ui__$ContactList_ContactRenderer = function(handler) { + this.handler = handler; +}; +$hxClasses["com.davidmaletz.mining.ui._ContactList.ContactRenderer"] = com_davidmaletz_mining_ui__$ContactList_ContactRenderer; +com_davidmaletz_mining_ui__$ContactList_ContactRenderer.__name__ = ["com","davidmaletz","mining","ui","_ContactList","ContactRenderer"]; +com_davidmaletz_mining_ui__$ContactList_ContactRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui__$ContactList_ContactRenderer.prototype = { + handler: null + ,create: function(item,x,y) { + return new com_davidmaletz_mining_ui_ContactButton(this.handler,item,x,y,160,com_davidmaletz_tiles_Tile.SIZE); + } + ,update: function(s,item) { + } + ,getWidth: function() { + return 160; + } + ,getHeight: function(item) { + return com_davidmaletz_tiles_Tile.SIZE; + } + ,__class__: com_davidmaletz_mining_ui__$ContactList_ContactRenderer +}; +var com_davidmaletz_mining_ui_ContactButton = function(handler,i,x,y,w,h) { + com_davidmaletz_controls_Button.call(this,x,y,com_davidmaletz_mining_Main.label_factory.createBG(w,h),com_davidmaletz_mining_Main.label_factory.createHover(w,h),null); + this.handler = handler; + this.item = i; + var o = com_davidmaletz_mining_world_ObjectInfo.get(i.first); + if(o != null) { + var t = new com_davidmaletz_mining_ui_MyFormattedText(w,false,o.getDisplay(),1); + t.set_y(Math.round((h - t.bounds.height) * 0.5) - t.bounds.y * 0.5); + this.addChild(t); + } +}; +$hxClasses["com.davidmaletz.mining.ui.ContactButton"] = com_davidmaletz_mining_ui_ContactButton; +com_davidmaletz_mining_ui_ContactButton.__name__ = ["com","davidmaletz","mining","ui","ContactButton"]; +com_davidmaletz_mining_ui_ContactButton.__super__ = com_davidmaletz_controls_Button; +com_davidmaletz_mining_ui_ContactButton.prototype = $extend(com_davidmaletz_controls_Button.prototype,{ + handler: null + ,item: null + ,onClick: function() { + if(this.handler != null) { + this.handler.onSelect(this.item); + } + return true; + } + ,onHover: function(hover) { + com_davidmaletz_controls_Button.prototype.onHover.call(this,hover); + if(this.handler != null) { + this.handler.onHover(hover ? this.item : null); + } + } + ,__class__: com_davidmaletz_mining_ui_ContactButton +}); +var com_davidmaletz_mining_ui_ContinueList = function(c,title,onLoad) { + if(title == null) { + title = com_fancyfish_faeng_common_Lang.getText("common","continue"); + } + com_davidmaletz_mining_network_CloudSaveList.call(this,c,title,true,0.5,0.5); + this.onLoad = onLoad; +}; +$hxClasses["com.davidmaletz.mining.ui.ContinueList"] = com_davidmaletz_mining_ui_ContinueList; +com_davidmaletz_mining_ui_ContinueList.__name__ = ["com","davidmaletz","mining","ui","ContinueList"]; +com_davidmaletz_mining_ui_ContinueList.__super__ = com_davidmaletz_mining_network_CloudSaveList; +com_davidmaletz_mining_ui_ContinueList.prototype = $extend(com_davidmaletz_mining_network_CloudSaveList.prototype,{ + onLoad: null + ,loadSave: function(id,colors,offsets,c) { + var _gthis = this; + new com_davidmaletz_faengfl_transition_FadeOut(function() { + var p = com_davidmaletz_mining_Main.loadSave(id,colors,offsets); + if(_gthis.onLoad != null) { + _gthis.onLoad(p); + } + },60); + } + ,onSelect: function(slot) { + var id = com_davidmaletz_mining_Main.slotToId(slot); + if(!com_davidmaletz_mining_Main.hasSave(id)) { + com_davidmaletz_mining_ui_NewGameList.load(id,this.onLoad); + } else { + var f = $bind(this,this.loadSave); + var id1 = id; + com_davidmaletz_mining_ui_CharacterColorWindow.check(null,function(a1,a2,c) { + f(id1,a1,a2,c); + },com_davidmaletz_mining_Main.getSlotHeader(id)); + } + } + ,__class__: com_davidmaletz_mining_ui_ContinueList +}); +var com_davidmaletz_mining_ui_ControlRenderer = function(handler) { + this.handler = handler; +}; +$hxClasses["com.davidmaletz.mining.ui.ControlRenderer"] = com_davidmaletz_mining_ui_ControlRenderer; +com_davidmaletz_mining_ui_ControlRenderer.__name__ = ["com","davidmaletz","mining","ui","ControlRenderer"]; +com_davidmaletz_mining_ui_ControlRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui_ControlRenderer.prototype = { + handler: null + ,create: function(item,x,y) { + if(item == null) { + return null; + } else if(Std["is"](item,com_fancyfish_faeng_common_Pair)) { + var p = js_Boot.__cast(item , com_fancyfish_faeng_common_Pair); + var b = new com_davidmaletz_mining_ui_StringButton(this.handler,com_fancyfish_faeng_common_Lang.getText(p.first,p.second),p.second,x,y,46,16); + b.str += ".action"; + return b; + } else { + var key = Std.string(item); + if(key == "device") { + return new com_davidmaletz_mining_ui__$ControlRenderer_DeviceButton(this.handler,x,y); + } else { + return new com_davidmaletz_mining_ui__$ControlRenderer_KeyButton(this.handler,key,x,y); + } + } + } + ,update: function(s,item) { + } + ,getWidth: function() { + return 46; + } + ,getHeight: function(item) { + return 16; + } + ,__class__: com_davidmaletz_mining_ui_ControlRenderer +}; +var com_davidmaletz_mining_ui_StringButton = function(handler,label,i,x,y,w,h,align,tw) { + if(tw == null) { + tw = -1; + } + if(align == null) { + align = 1; + } + com_davidmaletz_controls_Button.call(this,x,y,com_davidmaletz_mining_Main.label_factory.createBG(w,h),com_davidmaletz_mining_Main.label_factory.createHover(w,h),null); + this.handler = handler; + this.str = i; + if(tw < 0) { + tw = w; + } + this.__label = label; + this.__text = new com_davidmaletz_mining_ui_MyFormattedText(tw,false,label.get(),align); + this.__text.set_y(Math.round((h - com_davidmaletz_mining_ui_StringRenderer._getHeight()) * 0.5)); + this.addChild(this.__text); + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); +}; +$hxClasses["com.davidmaletz.mining.ui.StringButton"] = com_davidmaletz_mining_ui_StringButton; +com_davidmaletz_mining_ui_StringButton.__name__ = ["com","davidmaletz","mining","ui","StringButton"]; +com_davidmaletz_mining_ui_StringButton.__super__ = com_davidmaletz_controls_Button; +com_davidmaletz_mining_ui_StringButton.prototype = $extend(com_davidmaletz_controls_Button.prototype,{ + handler: null + ,str: null + ,__text: null + ,__label: null + ,init: function(e) { + this.destroy(null); + this.__label.addEventListener("updated",$bind(this,this.updateLabel)); + } + ,destroy: function(e) { + this.__label.removeEventListener("updated",$bind(this,this.updateLabel)); + } + ,updateLabel: function(e) { + this.__text.setText(this.__label.get()); + } + ,onClick: function() { + if(this.handler != null) { + this.handler.onSelect(this.str); + } + return true; + } + ,onHover: function(hover) { + com_davidmaletz_controls_Button.prototype.onHover.call(this,hover); + if(this.handler != null) { + this.handler.onHover(hover ? this.str : null); + } + } + ,__class__: com_davidmaletz_mining_ui_StringButton +}); +var com_davidmaletz_mining_ui__$ControlRenderer_KeyButton = function(handler,key,x,y) { + com_davidmaletz_mining_ui_StringButton.call(this,handler,com_fancyfish_faeng_common_Lang.getText("controls",key),key,x,y,92,32,2,64); + this.key = new com_davidmaletz_controls_KeyRenderer(key,78,16,handler.controls); + this.last = handler.controls.getKey(key); + this.addChild(this.key); + this.set_scaleX(this.set_scaleY(0.5)); + this._bounds.width *= 0.5; + this._bounds.height *= 0.5; + this.controls = handler; +}; +$hxClasses["com.davidmaletz.mining.ui._ControlRenderer.KeyButton"] = com_davidmaletz_mining_ui__$ControlRenderer_KeyButton; +com_davidmaletz_mining_ui__$ControlRenderer_KeyButton.__name__ = ["com","davidmaletz","mining","ui","_ControlRenderer","KeyButton"]; +com_davidmaletz_mining_ui__$ControlRenderer_KeyButton.__super__ = com_davidmaletz_mining_ui_StringButton; +com_davidmaletz_mining_ui__$ControlRenderer_KeyButton.prototype = $extend(com_davidmaletz_mining_ui_StringButton.prototype,{ + controls: null + ,key: null + ,last: null + ,init: function(e) { + com_davidmaletz_mining_ui_StringButton.prototype.init.call(this,e); + this.controls.addEventListener("key_changed",$bind(this,this.keyChanged)); + } + ,destroy: function(e) { + com_davidmaletz_mining_ui_StringButton.prototype.destroy.call(this,e); + this.controls.removeEventListener("key_changed",$bind(this,this.keyChanged)); + } + ,keyChanged: function(e) { + if(e.key != this.str) { + var k = this.controls.controls.getKey(this.str); + if(k != this.last) { + this.last = k; + this.key.drawKey(this.last); + } + return; + } + this.last = e.value; + if(e.value == null) { + this.key.set_visible(false); + } else { + this.key.drawKey(e.value); + this.key.set_visible(true); + } + } + ,__class__: com_davidmaletz_mining_ui__$ControlRenderer_KeyButton +}); +var com_davidmaletz_mining_ui__$ControlRenderer_DeviceButton = function(handler,x,y) { + com_davidmaletz_mining_ui_StringButton.call(this,handler,com_fancyfish_faeng_common_Lang.getText("controls","device"),"device",x,y,92,32); + var tw = 92; + this.getChildAt(this.get_numChildren() - 1).set_y(4); + var t = new com_davidmaletz_faengfl_TextSprite(com_davidmaletz_faengfl_controls_ControlHandler.getDeviceNames()[handler.device],new com_fancyfish_faeng_text_CharacterPlacer(tw,1),0,1); + t.set_y(18); + this.addChild(t); + this.text = t; + this.set_scaleX(this.set_scaleY(0.5)); + this._bounds.width *= 0.5; + this._bounds.height *= 0.5; + this.controls = handler; +}; +$hxClasses["com.davidmaletz.mining.ui._ControlRenderer.DeviceButton"] = com_davidmaletz_mining_ui__$ControlRenderer_DeviceButton; +com_davidmaletz_mining_ui__$ControlRenderer_DeviceButton.__name__ = ["com","davidmaletz","mining","ui","_ControlRenderer","DeviceButton"]; +com_davidmaletz_mining_ui__$ControlRenderer_DeviceButton.__super__ = com_davidmaletz_mining_ui_StringButton; +com_davidmaletz_mining_ui__$ControlRenderer_DeviceButton.prototype = $extend(com_davidmaletz_mining_ui_StringButton.prototype,{ + controls: null + ,text: null + ,init: function(e) { + com_davidmaletz_mining_ui_StringButton.prototype.init.call(this,e); + this.controls.addEventListener("key_changed",$bind(this,this.keyChanged)); + } + ,destroy: function(e) { + com_davidmaletz_mining_ui_StringButton.prototype.destroy.call(this,e); + this.controls.removeEventListener("key_changed",$bind(this,this.keyChanged)); + } + ,keyChanged: function(e) { + if(e.key == null) { + this.text.setText(com_davidmaletz_faengfl_controls_ControlHandler.getDeviceNames()[this.controls.device]); + } + } + ,__class__: com_davidmaletz_mining_ui__$ControlRenderer_DeviceButton +}); +var com_davidmaletz_mining_ui_Controls = function(c) { + this.device = com_davidmaletz_controls_Controller.instance.getCurrentDevice(); + this.controls = com_davidmaletz_controls_Controller.instance.getControls(this.device); + com_davidmaletz_controls_ListWindow.call(this,c,com_davidmaletz_mining_Main.window_factory,new com_davidmaletz_mining_ui_ControlRenderer(this),7,4,true,true,false,0.5,0.8); + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,com_fancyfish_faeng_common_Lang.getText("options","controls"),this.getWidth()); + var _g = 0; + var _g1 = com_davidmaletz_mining_ui_Controls.keys; + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + this.addItem(key); + } + this.addItem(new com_fancyfish_faeng_common_Pair("common","reset")); + this.addItem("device"); + this.addItem(new com_fancyfish_faeng_common_Pair("common","ok")); + this.addItem(null); + this.addItem(null); + this.addItem(new com_fancyfish_faeng_common_Pair("common","cancel")); +}; +$hxClasses["com.davidmaletz.mining.ui.Controls"] = com_davidmaletz_mining_ui_Controls; +com_davidmaletz_mining_ui_Controls.__name__ = ["com","davidmaletz","mining","ui","Controls"]; +com_davidmaletz_mining_ui_Controls.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_Controls.__super__ = com_davidmaletz_controls_ListWindow; +com_davidmaletz_mining_ui_Controls.prototype = $extend(com_davidmaletz_controls_ListWindow.prototype,{ + device: null + ,controls: null + ,accept: function() { + com_davidmaletz_controls_Controller.instance.setControls(this.device,this.controls); + } + ,nextDevice: function() { + this.device = (this.device + 1) % 2; + this.controls = com_davidmaletz_controls_Controller.instance.getControls(this.device); + this.dispatchEvent(new com_davidmaletz_mining_ui_KeyEvent("key_changed",null,null)); + } + ,onSelect: function(item) { + switch(item) { + case "cancel.action": + this.close(); + break; + case "device": + this.nextDevice(); + break; + case "ok.action": + this.accept(); + this.close(); + break; + case "reset.action": + if(this.device == 0) { + com_davidmaletz_controls_Controller.instance.defaultKeyboard(this.controls); + } else { + com_davidmaletz_controls_Controller.instance.defaultGamepad(this.controls); + } + this.dispatchEvent(new com_davidmaletz_mining_ui_KeyEvent("key_changed",null,null)); + break; + default: + new com_davidmaletz_mining_ui__$Controls_SetKey(this,item); + } + } + ,onHover: function(item) { + } + ,isEnabled: function(item) { + return true; + } + ,__class__: com_davidmaletz_mining_ui_Controls +}); +var com_davidmaletz_mining_ui__$Controls_SetKey = function(controls,key) { + this.isInit = false; + com_davidmaletz_faengfl_transition_Transition.call(this); + this.controls = controls; + this.key = key; + controls.dispatchEvent(new com_davidmaletz_mining_ui_KeyEvent("key_changed",key,null)); + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),1000,$bind(this,this.cancel)); + this.add(); +}; +$hxClasses["com.davidmaletz.mining.ui._Controls.SetKey"] = com_davidmaletz_mining_ui__$Controls_SetKey; +com_davidmaletz_mining_ui__$Controls_SetKey.__name__ = ["com","davidmaletz","mining","ui","_Controls","SetKey"]; +com_davidmaletz_mining_ui__$Controls_SetKey.__super__ = com_davidmaletz_faengfl_transition_Transition; +com_davidmaletz_mining_ui__$Controls_SetKey.prototype = $extend(com_davidmaletz_faengfl_transition_Transition.prototype,{ + controls: null + ,key: null + ,isInit: null + ,cancel: function() { + this.remove(); + this.controls.dispatchEvent(new com_davidmaletz_mining_ui_KeyEvent("key_changed",this.key,this.controls.controls.getKey(this.key))); + } + ,onEmptySelect: function() { + } + ,handle_frame: function(e) { + com_davidmaletz_faengfl_transition_Transition.prototype.handle_frame.call(this,e); + if(!com_davidmaletz_controls_Controller.instance.isPressed(8) && !this.isInit) { + this.isInit = true; + openfl_Lib.current.stage.addEventListener("keyUp",$bind(this,this.keyUp)); + com_davidmaletz_controls_Controller.instance.addEventListener("button_up",$bind(this,this.onButtonUp)); + com_davidmaletz_controls_Controller.instance.addEventListener("axis_move",$bind(this,this.onAxisMove)); + openfl_Lib.current.stage.addEventListener("mouseUp",$bind(this,this.mouse_up),false,1000); + openfl_Lib.current.stage.addEventListener("rightMouseUp",$bind(this,this.mouse_upR)); + } + } + ,destroy: function(e) { + com_davidmaletz_faengfl_transition_Transition.prototype.destroy.call(this,e); + openfl_Lib.current.stage.removeEventListener("keyUp",$bind(this,this.keyUp)); + com_davidmaletz_controls_Controller.instance.removeEventListener("button_up",$bind(this,this.onButtonUp)); + com_davidmaletz_controls_Controller.instance.removeEventListener("axis_move",$bind(this,this.onAxisMove)); + openfl_Lib.current.stage.removeEventListener("mouseUp",$bind(this,this.mouse_up)); + openfl_Lib.current.stage.removeEventListener("rightMouseUp",$bind(this,this.mouse_upR)); + this.isInit = false; + } + ,setKey: function(k) { + this.remove(); + this.controls.controls.setKey(this.key,k); + this.controls.dispatchEvent(new com_davidmaletz_mining_ui_KeyEvent("key_changed",this.key,k)); + } + ,_cancel: function() { + this.remove(); + this.controls.dispatchEvent(new com_davidmaletz_mining_ui_KeyEvent("key_changed",this.key,this.controls.controls.getKey(this.key))); + } + ,keyUp: function(e) { + if(this.controls.device == 0) { + this.setKey(new com_davidmaletz_faengfl_controls_KeyboardKey(e.keyCode)); + } else { + this._cancel(); + } + } + ,onButtonUp: function(e) { + if(this.controls.device != 0) { + this.setKey(new com_davidmaletz_faengfl_controls_ControllerKey(e.button)); + } else { + this._cancel(); + } + } + ,onAxisMove: function(e) { + if(this.controls.device != 0) { + var v = Math.floor(e.x + 0.5); + if(v != 0) { + this.setKey(new com_davidmaletz_faengfl_controls_AxisKey(e.axis,v > 0)); + } + } else { + this._cancel(); + } + } + ,mouse_up: function(e) { + if(this.controls.device == 0) { + this.setKey(new com_davidmaletz_faengfl_controls_MouseKey(0,false)); + } else { + this._cancel(); + } + } + ,mouse_upR: function(e) { + if(this.controls.device == 0) { + this.setKey(new com_davidmaletz_faengfl_controls_MouseKey(2,false)); + } else { + this._cancel(); + } + } + ,__class__: com_davidmaletz_mining_ui__$Controls_SetKey +}); +var com_davidmaletz_mining_ui_CraftingList = function(handler,i,c,fuelName,none) { + var r = new com_davidmaletz_mining_ui_RecipeRenderer(handler,i,fuelName,none); + var rows = Math.round(100 / r.getHeight(null)); + com_davidmaletz_controls_scroll_ScrollList.call(this,c,r,rows,1); + this.inventory = i; +}; +$hxClasses["com.davidmaletz.mining.ui.CraftingList"] = com_davidmaletz_mining_ui_CraftingList; +com_davidmaletz_mining_ui_CraftingList.__name__ = ["com","davidmaletz","mining","ui","CraftingList"]; +com_davidmaletz_mining_ui_CraftingList.addAdditional = function(s,details,w,additional,obj,onComplete,vars) { + var getVars = function() { + if(vars == null) { + vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(com_davidmaletz_mining_Main.getLocalPlayer()); + } + return vars; + }; + var r = null; + var e = additional; + while(e.hasNext()) { + var e1 = e.next(); + if(!e1.exists("if") || com_davidmaletz_faengfl_EventHandler._conditionMet(e1.get("if"),getVars())) { + if(r == null) { + r = new com_davidmaletz_mining_ui_XmlItemRenderer(w,obj,details,onComplete,getVars()); + } + s.addMixedItem(e1,r,s.getCols()); + } + } + return r; +}; +com_davidmaletz_mining_ui_CraftingList._addItems = function(recipes,l) { + var r = recipes; + while(r.hasNext()) { + var r1 = r.next(); + l.addItem(r1); + } +}; +com_davidmaletz_mining_ui_CraftingList.__super__ = com_davidmaletz_controls_scroll_ScrollList; +com_davidmaletz_mining_ui_CraftingList.prototype = $extend(com_davidmaletz_controls_scroll_ScrollList.prototype,{ + inventory: null + ,additionalRenderer: null + ,types: null + ,addItems: function(recipes,details,additional,obj,filter) { + if(additional != null) { + this.additionalRenderer = com_davidmaletz_mining_ui_CraftingList.addAdditional(this,details,this.renderer.getWidth(),additional,obj,$bind(this,this.onXmlComplete)); + } + var seen = new haxe_ds_StringMap(); + var r = recipes; + while(r.hasNext()) { + var r1 = r.next(); + if(!seen.exists(r1.id) && (filter == null || filter(r1))) { + seen.set(r1.id,true); + if(r1.creates != null) { + if(this.types == null) { + this.types = new haxe_ds_IntMap(); + } + this.types.set(r1.creates.item.type.index,true); + } else if(r1.object != null) { + if(this.types == null) { + this.types = new haxe_ds_IntMap(); + } + this.types.set(com_davidmaletz_mining_item_ItemCategory.VEHICLE.index,true); + } + this.addItem(r1); + } + } + } + ,onXmlComplete: function() { + this.update(null); + } + ,init: function(e) { + com_davidmaletz_controls_scroll_ScrollList.prototype.init.call(this,e); + this.inventory.addEventListener("item_added",$bind(this,this.update)); + this.update(null); + } + ,destroy: function(e) { + com_davidmaletz_controls_scroll_ScrollList.prototype.destroy.call(this,e); + this.inventory.removeEventListener("item_added",$bind(this,this.update)); + } + ,updateRecipes: function(recipes,clickables) { + var a1 = recipes; + this.setItems(function(l) { + com_davidmaletz_mining_ui_CraftingList._addItems(a1,l); + },clickables); + } + ,update: function(e) { + var l = this.getList(); + var len = l.get_numChildren(); + var r = this.getRenderer(); + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + var s = js_Boot.__cast(l.getChildAt(i) , openfl_display_Sprite); + if(Std["is"](s,com_davidmaletz_mining_ui_XmlButton)) { + this.additionalRenderer.update(s,null); + } else { + r.update(s,null); + } + } + } + ,setItems: function(addItems,clickables) { + var p = com_davidmaletz_controls_scroll_ScrollList.preSwitch(clickables); + var y = this.getScrollY(); + this.clear(); + addItems(this); + var ht = this.getViewportHeight(); + var sht = this.getScrollHeight(); + ht = sht - ht; + if(y > ht) { + y = ht; + } + if(y < 0) { + y = 0; + } + if(this.getScrollY() == y) { + this.scrollbar.update(); + } else { + this.updateScroll(y); + } + com_davidmaletz_controls_scroll_ScrollList.postSwitch(clickables,p); + } + ,items: null + ,addMixedItem: function(i,renderer,w) { + if(w == null) { + w = 1; + } + if(this.items != null) { + this.items.push(new com_fancyfish_faeng_common_Pair(i,renderer)); + } + return com_davidmaletz_controls_scroll_ScrollList.prototype.addMixedItem.call(this,i,renderer,w); + } + ,__class__: com_davidmaletz_mining_ui_CraftingList +}); +var com_davidmaletz_mining_ui_Credits = function(c,onComplete) { + com_davidmaletz_faengfl_transition_Transition.call(this); + var b = openfl_Assets.getBitmapData("data/ui/gradient.png"); + var ss = new com_davidmaletz_faengfl_ScissorSprite(c.getWidth(),b.height - com_davidmaletz_tiles_Tile.SIZE,this,c); + var d = new openfl_display_Bitmap(b); + d.set_scaleX(c.getWidth()); + this.addChild(d); + this.bgm = com_davidmaletz_faengfl_adv_sound_FadeMusic.get(); + var s = new com_davidmaletz_mining_ui__$Credits_CreditsLerpSprite(); + s.set_y(b.height - com_davidmaletz_tiles_Tile.SIZE); + var credits = new StringBuf(); + credits.add(com_davidmaletz_mining_ui_Credits.prefix); + if(com_davidmaletz_mining_ui_Credits.segments != null) { + var _g = 0; + var _g1 = com_davidmaletz_mining_ui_Credits.segments; + while(_g < _g1.length) { + var s1 = _g1[_g]; + ++_g; + credits.add("\n\n\n"); + credits.add(s1); + } + } + credits.add(com_davidmaletz_mining_ui_Credits.postfix); + var t = new com_davidmaletz_mining_ui_MyFormattedText(c.getWidth() - 64,true,credits.toString(),1); + t.set_x(32); + this.onClose = onComplete; + s.lerp(new com_davidmaletz_lerp_PositionKeyframe(0,-t.bounds.height - 13),com_davidmaletz_mining_ui_Credits.time,$bind(this,this.onEnd)); + s.addChild(t); + ss.addChild(s); + this.addChild(ss); + if(com_davidmaletz_faengfl_adv_sound_Music.exists("credits")) { + com_davidmaletz_faengfl_adv_sound_FadeMusic.set("credits",60); + } +}; +$hxClasses["com.davidmaletz.mining.ui.Credits"] = com_davidmaletz_mining_ui_Credits; +com_davidmaletz_mining_ui_Credits.__name__ = ["com","davidmaletz","mining","ui","Credits"]; +com_davidmaletz_mining_ui_Credits.segments = null; +com_davidmaletz_mining_ui_Credits.early_access = function() { + openfl_Lib.getURL(new openfl_net_URLRequest("http://fancyfishgames.com/Aground/"),"_blank"); +}; +com_davidmaletz_mining_ui_Credits.reset = function() { + com_davidmaletz_mining_ui_Credits.segments = null; + com_davidmaletz_mining_ui_Credits.time = 1000; +}; +com_davidmaletz_mining_ui_Credits.addSegment = function(s,t,title) { + if(title != null) { + s = "[color=" + "000066" + "]" + title + "[/color]\n\n" + s; + } + if(com_davidmaletz_mining_ui_Credits.segments == null) { + com_davidmaletz_mining_ui_Credits.segments = [s]; + } else { + com_davidmaletz_mining_ui_Credits.segments.push(s); + } + com_davidmaletz_mining_ui_Credits.time += t * 60; +}; +com_davidmaletz_mining_ui_Credits.__super__ = com_davidmaletz_faengfl_transition_Transition; +com_davidmaletz_mining_ui_Credits.prototype = $extend(com_davidmaletz_faengfl_transition_Transition.prototype,{ + bgm: null + ,onEmptySelect: function() { + if(com_davidmaletz_mining_Main.isTitleScreen() || Reflect.field(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"complete_credits") == true) { + this._onEnd(); + } + } + ,onEnd: function() { + Reflect.setField(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"complete_credits",true); + com_davidmaletz_faengfl_adv_AdvApp.settings.flush(); + this._onEnd(); + } + ,_onEnd: function() { + com_davidmaletz_faengfl_adv_sound_FadeMusic.set(this.bgm,60); + var func = this.onClose; + if(com_davidmaletz_faengfl_adv_ModHandler.getModInfo("full_version") == null) { + this.onClose = null; + } + this.doClose(); + if(com_davidmaletz_faengfl_adv_ModHandler.getModInfo("full_version") == null) { + var c = com_davidmaletz_faengfl_adv_AdvApp.getContainer(); + var p = new com_davidmaletz_mining_ui_Prompt(c,new com_fancyfish_faeng_common_mutable_Static("The full version of Aground is now in Early Access! Would you like to take a look? Your save can be transferred by exporting it from the options menu on the title screen."),com_davidmaletz_mining_ui_Credits.early_access); + p.onClose = func; + c.addDisplay(p,3); + return; + } + } + ,__class__: com_davidmaletz_mining_ui_Credits +}); +var com_davidmaletz_mining_ui__$Credits_CreditsLerpSprite = function() { + com_davidmaletz_lerp_LerpSprite.call(this); +}; +$hxClasses["com.davidmaletz.mining.ui._Credits.CreditsLerpSprite"] = com_davidmaletz_mining_ui__$Credits_CreditsLerpSprite; +com_davidmaletz_mining_ui__$Credits_CreditsLerpSprite.__name__ = ["com","davidmaletz","mining","ui","_Credits","CreditsLerpSprite"]; +com_davidmaletz_mining_ui__$Credits_CreditsLerpSprite.__super__ = com_davidmaletz_lerp_LerpSprite; +com_davidmaletz_mining_ui__$Credits_CreditsLerpSprite.prototype = $extend(com_davidmaletz_lerp_LerpSprite.prototype,{ + advanceFrame: function(df) { + if(com_davidmaletz_controls_Controller.instance.isPressed(2)) { + df *= 5; + } + if(com_davidmaletz_controls_Controller.instance.isPressed(0)) { + df = -df; + } + com_davidmaletz_lerp_LerpSprite.prototype.advanceFrame.call(this,df); + } + ,__class__: com_davidmaletz_mining_ui__$Credits_CreditsLerpSprite +}); +var com_davidmaletz_mining_ui_CropSlotList = function(player,farm,showCropDetails,c,select) { + var r = new com_davidmaletz_mining_ui_CropSlotRenderer(this); + var rows = Math.round(100 / r.getHeight(null)); + this._onSelect = select; + com_davidmaletz_controls_scroll_ScrollList.call(this,c,r,rows,1); + this.farm = farm; + this.showCropDetails = showCropDetails; + this.player = player; +}; +$hxClasses["com.davidmaletz.mining.ui.CropSlotList"] = com_davidmaletz_mining_ui_CropSlotList; +com_davidmaletz_mining_ui_CropSlotList.__name__ = ["com","davidmaletz","mining","ui","CropSlotList"]; +com_davidmaletz_mining_ui_CropSlotList.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_CropSlotList.isFertilizer = function(i) { + return i.xml.exists("fertilizer"); +}; +com_davidmaletz_mining_ui_CropSlotList.__super__ = com_davidmaletz_controls_scroll_ScrollList; +com_davidmaletz_mining_ui_CropSlotList.prototype = $extend(com_davidmaletz_controls_scroll_ScrollList.prototype,{ + player: null + ,showCropDetails: null + ,farm: null + ,_onSelect: null + ,init: function(e) { + com_davidmaletz_controls_scroll_ScrollList.prototype.init.call(this,e); + this.farm.addEventListener("crop_added",$bind(this,this.add)); + this.farm.addEventListener("crop_removed",$bind(this,this.rem)); + this.rem(null); + } + ,destroy: function(e) { + com_davidmaletz_controls_scroll_ScrollList.prototype.destroy.call(this,e); + this.farm.removeEventListener("crop_added",$bind(this,this.add)); + this.farm.removeEventListener("crop_removed",$bind(this,this.rem)); + } + ,add: function(e) { + this.addItem(e.value); + } + ,addItems: function() { + var slot = this.farm.getSlots(); + while(slot.hasNext()) { + var slot1 = slot.next(); + this.addItem(slot1); + } + } + ,rem: function(e) { + var clickables = (js_Boot.__cast(this.parent , com_davidmaletz_controls_ClickableWindow)).clickables; + var p = com_davidmaletz_controls_scroll_ScrollList.preSwitch(clickables); + var y = this.getScrollY(); + this.clear(); + this.addItems(); + var ht = this.getViewportHeight(); + var sht = this.getScrollHeight(); + ht = sht - ht; + if(y > ht) { + y = ht; + } + if(y < 0) { + y = 0; + } + if(this.getScrollY() == y) { + this.scrollbar.update(); + } else { + this.updateScroll(y); + } + com_davidmaletz_controls_scroll_ScrollList.postSwitch(clickables,p); + } + ,onSelect: function(item) { + if(this._onSelect != null && this._onSelect(item)) { + return; + } + if(Std["is"](item,com_davidmaletz_mining_item_Animal)) { + this.selectAnimal(item); + } else { + var c = com_davidmaletz_mining_Main.getContainer(); + var f = $bind(this,this.plant); + var a1 = item; + var f1 = $bind(this,this.fertilizer); + var a11 = item; + var f2 = $bind(this,this.remove); + var a12 = item; + c.addDisplay(new com_davidmaletz_mining_ui_Choice(c,"structure",["plant","fertilizer","common.remove"],[function() { + f(a1); + },function() { + f1(a11); + },function() { + f2(a12); + }]),2); + } + } + ,fertilizerCount: function(crop,item) { + var max = crop.getMaxFertilizer(item); + if(max == 0) { + return; + } + var c = com_davidmaletz_mining_Main.getContainer(); + var f = $bind(this,this.onFertilize); + var a1 = crop; + var a2 = item; + var tmp = function(ct) { + f(a1,a2,ct); + }; + c.addDisplay(new com_davidmaletz_mining_ui_ItemCountPrompt(c,item,max,com_fancyfish_faeng_common_Lang.getText("common","use_count"),crop.getMaxFertilizer(item,true),tmp),2); + } + ,onFertilize: function(crop,item,ct) { + if(ct != 0) { + item.inventory.addItems(item.item,-ct,item.value,item.name); + crop.addFertilizer(item.item,ct); + com_davidmaletz_faengfl_adv_sound_Sound.resolve(null,item.item.xml,"fertilize"); + } + } + ,fertilizer: function(item) { + var c = com_davidmaletz_mining_Main.getContainer(); + var f = $bind(this,this.fertilizerCount); + var a1 = item; + var tmp = function(a2) { + f(a1,a2); + }; + c.addDisplay(new com_davidmaletz_mining_ui_ItemList(c,this.player.getInv(true),com_fancyfish_faeng_common_Lang.getText("common","select_fertilizer"),this.player.includeCost(),com_davidmaletz_mining_ui_CropSlotList.isFertilizer,tmp,true,null),2); + } + ,plant: function(item) { + var c = com_davidmaletz_mining_Main.getContainer(); + var f = $bind(this,this.selectCrop); + var a1 = item; + var tmp = function(a2) { + f(a1,a2); + }; + c.addDisplay(new com_davidmaletz_mining_ui_ItemList(c,this.player.getInv(true),com_fancyfish_faeng_common_Lang.getText("structure","plant"),this.player.includeCost(),$bind(this,this.isCrop),tmp,false,null),2); + } + ,remove: function(item) { + if(item.structure.area != null) { + item.structure.area.removeStructure(item.structure,this.player); + } + } + ,isCrop: function(i) { + if(i.hasActionId("plant")) { + return com_davidmaletz_mining_item_CropInfo.exists(i.getActionXml("plant").get("crop")); + } else { + return false; + } + } + ,selectCrop: function(crop,item) { + var c = com_davidmaletz_mining_item_CropInfo.get(item.item.getActionXml("plant").get("crop")); + if(c != null && crop.info != c && item.inventory.addItems(item.item,-1,item.value,item.name)) { + this.player.addItem(crop.info.id + "_seed"); + crop.setCrop(c); + this.showCropDetails(crop); + } + } + ,selectAnimal: function(item) { + if(item.isEmpty()) { + this.chooseAnimal(item); + } else if(com_davidmaletz_faengfl_adv_AdvApp.shiftDown) { + this.setAnimal(item,null); + } else { + var c = com_davidmaletz_mining_Main.getContainer(); + var animal = item.getItem(null); + var ids = []; + var funcs = []; + if(item.info.xml.get("includeActions") != "false") { + animal.info.getActionChoices(ids,funcs,this.player,animal.value,animal.getNameStr(),js_Boot.__cast(this.parent , com_davidmaletz_controls_ClickableWindow),item,false,true); + } + ids.push("switch"); + var f = $bind(this,this.chooseAnimal); + var a1 = item; + funcs.push(function() { + f(a1); + }); + if(funcs.length == 1) { + funcs[0](); + } else { + ids.push("common.remove"); + var f1 = $bind(this,this.setAnimal); + var a11 = item; + funcs.push(function() { + f1(a11,null); + }); + c.addDisplay(new com_davidmaletz_mining_ui_Choice(c,"actions",ids,funcs),2); + } + } + } + ,chooseAnimal: function(item) { + var c = com_davidmaletz_mining_Main.getContainer(); + var f = $bind(this,this.setAnimal); + var a1 = item; + var tmp = function(a2) { + f(a1,a2); + }; + c.addDisplay(new com_davidmaletz_mining_ui_ItemList(c,this.player.getInv(true),this.farm.getSelectAnimalTitle(),this.player.includeCost(),item.acceptAnimal,tmp,false,com_fancyfish_faeng_common_Lang.getText("common","none")),2); + } + ,setAnimal: function(crop,item) { + var i = crop.getItem(null); + if(i != null) { + this.player.addItems(i.info,1,i.value,i.getNameStr()); + } + if(item != null && item.inventory.addItems(item.item,-1,item.value,item.name)) { + this.setItem(crop,new com_davidmaletz_mining_item_Item(item.item,item.value,item.name)); + } else if(i != null) { + this.setItem(crop,null); + } + } + ,setItem: function(crop,item) { + crop.setItem(item); + this.showCropDetails(crop); + } + ,onHover: function(item) { + this.showCropDetails(item); + } + ,isEnabled: function(item) { + return true; + } + ,__class__: com_davidmaletz_mining_ui_CropSlotList +}); +var com_davidmaletz_mining_ui_CropSlotRenderer = function(handler) { + this.handler = handler; +}; +$hxClasses["com.davidmaletz.mining.ui.CropSlotRenderer"] = com_davidmaletz_mining_ui_CropSlotRenderer; +com_davidmaletz_mining_ui_CropSlotRenderer.__name__ = ["com","davidmaletz","mining","ui","CropSlotRenderer"]; +com_davidmaletz_mining_ui_CropSlotRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui_CropSlotRenderer._getHeight = function() { + return com_fancyfish_faeng_text_FontManager.lineHeight() * 2; +}; +com_davidmaletz_mining_ui_CropSlotRenderer.prototype = { + handler: null + ,create: function(item,x,y) { + if(Std["is"](item,com_davidmaletz_mining_item_Animal)) { + return new com_davidmaletz_mining_ui__$CropSlotRenderer_AnimalButton(this.handler,item,x,y); + } else { + return new com_davidmaletz_mining_ui__$CropSlotRenderer_ListButton(this.handler,item,x,y); + } + } + ,update: function(s,item) { + } + ,getWidth: function() { + return 104; + } + ,getHeight: function(item) { + return com_davidmaletz_mining_ui_CropSlotRenderer._getHeight(); + } + ,__class__: com_davidmaletz_mining_ui_CropSlotRenderer +}; +var com_davidmaletz_mining_ui__$CropSlotRenderer_ListButton = function(handler,c,x,y) { + var w = 104; + var h = com_davidmaletz_mining_ui_CropSlotRenderer._getHeight(); + com_davidmaletz_controls_Button.call(this,x,y,com_davidmaletz_mining_Main.label_factory.createBG(w,h),com_davidmaletz_mining_Main.label_factory.createHover(w,h),null); + this.handler = handler; + this.text = new openfl_display_Sprite(); + this.crop = c; + this.addChild(this.text); + this._text = new com_davidmaletz_faengfl_TextSprite(this.getText(),new com_fancyfish_faeng_text_CharacterPlacer(0),0,0.5); + this._text.set_y(Math.round(com_davidmaletz_mining_ui_StringRenderer._getHeight() * 0.25)); + var p = this.crop.getPercent(); + this.progress = new com_davidmaletz_controls_ProgressBar(104,2,6965513,p,false); + if(p == 0) { + this.progress.set_visible(false); + } + this.progress.set_y(h - 2); + this.addChild(this.progress); + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); +}; +$hxClasses["com.davidmaletz.mining.ui._CropSlotRenderer.ListButton"] = com_davidmaletz_mining_ui__$CropSlotRenderer_ListButton; +com_davidmaletz_mining_ui__$CropSlotRenderer_ListButton.__name__ = ["com","davidmaletz","mining","ui","_CropSlotRenderer","ListButton"]; +com_davidmaletz_mining_ui__$CropSlotRenderer_ListButton.drawInfo = function(s,info) { + var x = 6; + if(info != null) { + var f = info.iterator(); + while(f.hasNext()) { + var f1 = f.next(); + var i = com_davidmaletz_mining_item_ItemInfo.get(f1.item); + if(i == null) { + continue; + } + var icon = i.createIcon(); + icon.set_x(x); + s.addChild(icon); + var t = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Static((f1.min == null ? "null" : "" + f1.min) + (f1.min == f1.max ? "" : "-" + f1.max)),new com_fancyfish_faeng_text_CharacterPlacer(16,1),0,1); + t.set_x(x + com_davidmaletz_tiles_Tile.SIZE); + icon.set_y(t.set_y(t.lineHeight())); + s.addChild(t); + x += com_davidmaletz_tiles_Tile.SIZE + 16; + } + } +}; +com_davidmaletz_mining_ui__$CropSlotRenderer_ListButton.__super__ = com_davidmaletz_controls_Button; +com_davidmaletz_mining_ui__$CropSlotRenderer_ListButton.prototype = $extend(com_davidmaletz_controls_Button.prototype,{ + crop: null + ,handler: null + ,text: null + ,_text: null + ,icon: null + ,progress: null + ,getIcon: function() { + return null; + } + ,getText: function() { + if(this.crop.info == null) { + return com_fancyfish_faeng_common_Lang.getText("common","empty"); + } else { + return com_fancyfish_faeng_common_Lang.getText("structure",this.crop.info.id); + } + } + ,init: function(e) { + this.destroy(e); + this.crop.addEventListener("update_crop",$bind(this,this.updateCrop)); + this.crop.addEventListener("update_percent",$bind(this,this.update)); + this.updateCrop(null); + } + ,destroy: function(e) { + this.crop.removeEventListener("update_crop",$bind(this,this.updateCrop)); + this.crop.removeEventListener("update_percent",$bind(this,this.update)); + } + ,onClick: function() { + this.handler.onSelect(this.crop); + return true; + } + ,onHover: function(hover) { + com_davidmaletz_controls_Button.prototype.onHover.call(this,hover); + this.handler.onHover(hover ? this.crop : null); + } + ,setEnabled: function(e) { + this.text.set_alpha(e ? 1 : 0.5); + } + ,updateCrop: function(e) { + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this.text); + this.icon = this.getIcon(); + if(this.icon != null) { + this.icon.set_x(2); + this.icon.set_y(0); + this.text.addChild(this.icon); + } + this._text.setText(this.getText()); + this._text.set_x(2 + (this.icon != null ? 1 + com_davidmaletz_tiles_Tile.SIZE : 0)); + this.text.addChild(this._text); + com_davidmaletz_mining_ui__$CropSlotRenderer_ListButton.drawInfo(this.text,this.crop.info); + this.setEnabled(this.handler.isEnabled(this.crop)); + } + ,update: function(e) { + var p = this.crop.getPercent(); + if(p == 0) { + this.progress.set_visible(false); + } else { + this.progress.set_visible(true); + this.progress.setProgress(p); + } + this.setEnabled(this.handler.isEnabled(this.crop)); + } + ,__class__: com_davidmaletz_mining_ui__$CropSlotRenderer_ListButton +}); +var com_davidmaletz_mining_ui__$CropSlotRenderer_AnimalButton = function(handler,c,x,y) { + com_davidmaletz_mining_ui__$CropSlotRenderer_ListButton.call(this,handler,c,x,y); + if(this.crop.getPercent() == 1) { + this.progress.set_visible(false); + } +}; +$hxClasses["com.davidmaletz.mining.ui._CropSlotRenderer.AnimalButton"] = com_davidmaletz_mining_ui__$CropSlotRenderer_AnimalButton; +com_davidmaletz_mining_ui__$CropSlotRenderer_AnimalButton.__name__ = ["com","davidmaletz","mining","ui","_CropSlotRenderer","AnimalButton"]; +com_davidmaletz_mining_ui__$CropSlotRenderer_AnimalButton.__super__ = com_davidmaletz_mining_ui__$CropSlotRenderer_ListButton; +com_davidmaletz_mining_ui__$CropSlotRenderer_AnimalButton.prototype = $extend(com_davidmaletz_mining_ui__$CropSlotRenderer_ListButton.prototype,{ + getIcon: function() { + var item = (js_Boot.__cast(this.crop , com_davidmaletz_mining_item_Animal)).getItem(null); + if(item == null) { + return null; + } else { + return com_davidmaletz_mining_item_Item._createIcon(item.info,0,item.getNameStr()); + } + } + ,getText: function() { + var item = (js_Boot.__cast(this.crop , com_davidmaletz_mining_item_Animal)).getItem(null); + if(item == null) { + return com_fancyfish_faeng_common_Lang.getText("common","empty"); + } else { + return item.getName(); + } + } + ,update: function(e) { + if(this.crop.getPercent() == 1) { + this.progress.set_visible(false); + } else { + com_davidmaletz_mining_ui__$CropSlotRenderer_ListButton.prototype.update.call(this,e); + } + } + ,__class__: com_davidmaletz_mining_ui__$CropSlotRenderer_AnimalButton +}); +var com_davidmaletz_mining_ui_DialogueBox = function(container,txt,complete,speaker,darken,fnt) { + if(darken == null) { + darken = true; + } + this.text = new com_davidmaletz_mining_ui_MyRevealText(container,192,true,null); + if(fnt != null) { + this.text.default_font = new com_fancyfish_faeng_common_mutable_Static(fnt); + } + this.text.setText(txt); + this.text.set_x(4); + this.text.set_y(4); + this.speaker = speaker; + if(speaker != null) { + var f = $bind(speaker,speaker.endSpeak); + var tmp = function() { + f(false); + }; + this.text.onComplete = tmp; + } + com_davidmaletz_controls_ClickableWindow.call(this,container,com_davidmaletz_mining_Main.window_factory.create(200,Math.ceil(this.text.getHeight()) + 8 - 2),true,darken,true,0.5,Std["is"](speaker,com_davidmaletz_mining_Player) ? 0.95 : 0.05); + this.addChild(this.text); + this.onClose = complete; +}; +$hxClasses["com.davidmaletz.mining.ui.DialogueBox"] = com_davidmaletz_mining_ui_DialogueBox; +com_davidmaletz_mining_ui_DialogueBox.__name__ = ["com","davidmaletz","mining","ui","DialogueBox"]; +com_davidmaletz_mining_ui_DialogueBox.__super__ = com_davidmaletz_controls_ClickableWindow; +com_davidmaletz_mining_ui_DialogueBox.prototype = $extend(com_davidmaletz_controls_ClickableWindow.prototype,{ + text: null + ,speaker: null + ,init: function(e) { + com_davidmaletz_controls_ClickableWindow.prototype.init.call(this,e); + if(this.speaker != null) { + this.speaker.beginSpeak(); + } + } + ,destroy: function(e) { + if(e != null && this.speaker != null) { + this.speaker.endSpeak(true); + } + com_davidmaletz_controls_ClickableWindow.prototype.destroy.call(this,e); + } + ,onEmptySelect: function() { + var frames = 10000; + if(this.text.advanceReveal(frames) == frames) { + this.close(); + } + } + ,onCancel: function() { + this.close(); + } + ,__class__: com_davidmaletz_mining_ui_DialogueBox +}); +var com_davidmaletz_mining_ui_DismantlePrompt = function(str,c,player,structure,inv,reqs,onAccept,p) { + if(p == null) { + p = 0.7; + } + this.percent = p; + com_davidmaletz_mining_ui_BuildPrompt.call(this,str,c,player,structure,inv,reqs,onAccept,null,com_fancyfish_faeng_common_Lang.getText("common","yes")); + this.clickables.moveSelection(1,0); + this.clickables.moveSelection(1,0); +}; +$hxClasses["com.davidmaletz.mining.ui.DismantlePrompt"] = com_davidmaletz_mining_ui_DismantlePrompt; +com_davidmaletz_mining_ui_DismantlePrompt.__name__ = ["com","davidmaletz","mining","ui","DismantlePrompt"]; +com_davidmaletz_mining_ui_DismantlePrompt.__super__ = com_davidmaletz_mining_ui_BuildPrompt; +com_davidmaletz_mining_ui_DismantlePrompt.prototype = $extend(com_davidmaletz_mining_ui_BuildPrompt.prototype,{ + percent: null + ,confirm: null + ,addReqs: function(inner,player,x,y,w) { + return com_davidmaletz_mining_ui_QuestInfo.addRequirements(inner,player,null,HxOverrides.iter(this.requires),x,y,w,this.percent); + } + ,getNo: function() { + return com_fancyfish_faeng_common_Lang.getText("common","no"); + } + ,accept: function() { + if(this.confirm != null) { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_Prompt(c,this.confirm,$bind(this,this.doAccept)),3); + } else { + this.doAccept(); + } + } + ,doAccept: function() { + var ar = []; + var _g = 0; + var _g1 = this.requires; + while(_g < _g1.length) { + var r = _g1[_g]; + ++_g; + var i = r.getItem(); + var ct = Math.round(r.count * this.percent); + if(i != null && ct > 0) { + this.inventory.addItems(i,ct); + ar.push(new com_davidmaletz_mining_item_ItemCt(i,ct)); + } + } + com_davidmaletz_mining_ui_MultiItemPopup.show(HxOverrides.iter(ar),ar.length,1); + com_davidmaletz_faengfl_adv_sound_Sound.play("item"); + if(this.onAccept != null) { + this.onAccept(); + } + this.close(); + } + ,__class__: com_davidmaletz_mining_ui_DismantlePrompt +}); +var com_davidmaletz_mining_ui_EatPrompt = function(c,p,item,max,func) { + var food = item.getInfo(); + this.healthPerItem = food.getHealth(p); + this.staminaPerItem = food.getStamina(p); + this.oxygenPerItem = food.getOxygen(p); + this.storagePerItem = food.getStorage(p); + this.storageType = food.xml.get("eatStorage"); + this.stats = []; + this.statsMutable = []; + var e = food.xml.elementsNamed("stat"); + while(e.hasNext()) { + var e1 = e.next(); + this.stats.push(e1); + } + var m = com_fancyfish_faeng_common_Lang.getTextFromTitle(food.xml.get("eat")); + if(m == null) { + m = com_fancyfish_faeng_common_Lang.getText("common","eat_item"); + } + com_davidmaletz_mining_ui_CountPrompt.call(this,c,m,func,0,max,1,12,com_fancyfish_faeng_text_FontManager.lineHeight() + 4); + com_davidmaletz_mining_ui_ItemRenderer.addItemCentered(this,item,50,4); + this.spinner.addEventListener("change_value",$bind(this,this.updateCount)); + this.updateCount(null); +}; +$hxClasses["com.davidmaletz.mining.ui.EatPrompt"] = com_davidmaletz_mining_ui_EatPrompt; +com_davidmaletz_mining_ui_EatPrompt.__name__ = ["com","davidmaletz","mining","ui","EatPrompt"]; +com_davidmaletz_mining_ui_EatPrompt.__super__ = com_davidmaletz_mining_ui_CountPrompt; +com_davidmaletz_mining_ui_EatPrompt.prototype = $extend(com_davidmaletz_mining_ui_CountPrompt.prototype,{ + health: null + ,stamina: null + ,oxygen: null + ,storage: null + ,statsMutable: null + ,healthPerItem: null + ,staminaPerItem: null + ,oxygenPerItem: null + ,storagePerItem: null + ,storageType: null + ,stats: null + ,updateCount: function(e) { + var value = this.spinner.getValue(); + if(this.healthPerItem != 0) { + this.health.set(com_fancyfish_faeng_common_Utils.largeNumberFormat(value * this.healthPerItem)); + } + if(this.staminaPerItem != 0) { + this.stamina.set(com_fancyfish_faeng_common_Utils.largeNumberFormat(value * this.staminaPerItem)); + } + if(this.oxygenPerItem != 0) { + this.oxygen.set(com_fancyfish_faeng_common_Utils.largeNumberFormat(value * this.oxygenPerItem)); + } + if(this.storagePerItem != 0) { + this.storage.set(com_fancyfish_faeng_common_Utils.largeNumberFormat(value * this.storagePerItem)); + } + var i = 0; + var _g = 0; + var _g1 = this.stats; + while(_g < _g1.length) { + var e1 = _g1[_g]; + ++_g; + this.statsMutable[i++].set(com_fancyfish_faeng_common_Utils.largeNumberFormat(value * com_davidmaletz_mining_Main.parseInt(e1.get("value")))); + } + } + ,afterSpinner: function(y) { + var w = 18 + com_davidmaletz_tiles_Tile.SIZE; + var p = (w + 4) * this.stats.length - 4; + if(this.healthPerItem != 0) { + p += w + 4; + } + if(this.staminaPerItem != 0) { + p += w + 4; + } + if(this.oxygenPerItem != 0) { + p += w + 4; + } + if(this.storagePerItem != 0) { + p += w + 4; + } + var x = Math.round((100 - p) * 0.5); + if(this.healthPerItem != 0) { + var t = com_davidmaletz_mining_item_ItemInfo._createIcon(com_davidmaletz_tiles_Tile.get("health")); + t.set_x(x); + t.set_y(y); + this.addChild(t); + this.health = new com_fancyfish_faeng_common_mutable_Mutable(); + var t1 = new com_davidmaletz_faengfl_TextSprite(this.health,new com_fancyfish_faeng_text_CharacterPlacer(0),7798784,1); + t1.set_x(x + 8 + 2); + t1.set_y(y); + this.addChild(t1); + x += w + 4; + } + if(this.staminaPerItem != 0) { + var t2 = com_davidmaletz_mining_item_ItemInfo._createIcon(com_davidmaletz_tiles_Tile.get("stamina")); + t2.set_x(x); + t2.set_y(y); + this.addChild(t2); + this.stamina = new com_fancyfish_faeng_common_mutable_Mutable(); + var t3 = new com_davidmaletz_faengfl_TextSprite(this.stamina,new com_fancyfish_faeng_text_CharacterPlacer(0),26112,1); + t3.set_x(x + 8 + 2); + t3.set_y(y); + this.addChild(t3); + x += w + 4; + } + if(this.oxygenPerItem != 0) { + var t4 = com_davidmaletz_mining_item_ItemInfo._createIcon(com_davidmaletz_tiles_Tile.get("oxygen")); + t4.set_x(x); + t4.set_y(y); + this.addChild(t4); + this.oxygen = new com_fancyfish_faeng_common_mutable_Mutable(); + var t5 = new com_davidmaletz_faengfl_TextSprite(this.oxygen,new com_fancyfish_faeng_text_CharacterPlacer(0),4473924,1); + t5.set_x(x + 8 + 2); + t5.set_y(y); + this.addChild(t5); + x += w + 4; + } + if(this.storagePerItem != 0) { + var t6 = com_davidmaletz_mining_ui_Coins.makeIcon(com_davidmaletz_mining_ui_StatusBars.getTile(this.storageType)); + t6.set_x(x); + t6.set_y(y); + this.addChild(t6); + this.storage = new com_fancyfish_faeng_common_mutable_Mutable(); + var t7 = new com_davidmaletz_faengfl_TextSprite(this.storage,new com_fancyfish_faeng_text_CharacterPlacer(0),0,1); + t7.set_x(x + 8 + 2); + t7.set_y(y); + this.addChild(t7); + x += w + 4; + } + var _g = 0; + var _g1 = this.stats; + while(_g < _g1.length) { + var e = _g1[_g]; + ++_g; + var t8 = com_davidmaletz_mining_item_ItemInfo._createIcon(com_davidmaletz_tiles_Tile.get("stat." + e.get("id"))); + com_davidmaletz_mining_Stat.tint(t8,1); + t8.set_x(x); + t8.set_y(y); + this.addChild(t8); + var m = new com_fancyfish_faeng_common_mutable_Mutable(); + this.statsMutable.push(m); + var t9 = new com_davidmaletz_faengfl_TextSprite(m,new com_fancyfish_faeng_text_CharacterPlacer(0),0,1); + t9.set_x(x + 8 + 10); + t9.set_y(y); + this.addChild(t9); + x += w + 4; + } + } + ,__class__: com_davidmaletz_mining_ui_EatPrompt +}); +var com_davidmaletz_mining_ui_SlotWindow = function() { }; +$hxClasses["com.davidmaletz.mining.ui.SlotWindow"] = com_davidmaletz_mining_ui_SlotWindow; +com_davidmaletz_mining_ui_SlotWindow.__name__ = ["com","davidmaletz","mining","ui","SlotWindow"]; +com_davidmaletz_mining_ui_SlotWindow.prototype = { + getPlayer: null + ,getDetails: null + ,getAdditional: null + ,checkCreates: null + ,filterSlot: null + ,isTabbed: null + ,getInventory: null + ,getHeight: null + ,getOffsetX: null + ,__class__: com_davidmaletz_mining_ui_SlotWindow +}; +var com_davidmaletz_mining_ui_EnchantWindow = function(inventory,c,p,e) { + var xml = e.info.xml; + var i = new com_fancyfish_faeng_common_DoubleIterator(e.iterator(),com_davidmaletz_mining_ui_CraftingWindow.getRecipes(p,xml)); + this.structure = e; + var handler = new com_davidmaletz_mining_ui_SlotHandler(this); + this.grid = new com_davidmaletz_controls_ListSprite(new com_davidmaletz_mining_ui_Icon(handler),Math.ceil((e.slots.length - 1) / 5),5); + this.player = p; + var p1 = p; + var a1 = xml; + var o = e; + var tmp = function(r) { + return com_davidmaletz_mining_ui_CraftingWindow._onCraft(p1,a1,o,r); + }; + com_davidmaletz_mining_ui_CraftingWindow.call(this,false,i,e.getTitle(p),inventory,c,p.includeCost(),xml.elementPathsNamed("listItem"),e,tmp,null,null,1); + var tmp1 = com_davidmaletz_mining_ui_CraftingWindow.prototype.getWidth.call(this); + this.grid.offsetX = tmp1 + 4; + this.grid.offsetY = 20; + var len = e.slots.length; + var _g1 = 1; + var _g = len; + while(_g1 < _g) { + var i1 = _g1++; + this.grid.addItem(this.clickables,e.slots[i1]); + } + this.addChild(this.grid); + this.addClickable(new com_davidmaletz_mining_ui_ItemValueRenderer(handler,com_fancyfish_faeng_common_Lang.getText("actions","enchant"),this.grid.getWidth()).create(e.slots[0],this.grid.offsetX,4),5); + var t = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("common","creates"),new com_fancyfish_faeng_text_CharacterPlacer(this.grid.getWidth(),1),153,1); + t.set_x(this.grid.offsetX); + t.set_y(this.grid.offsetY + this.grid.getHeight() + 4); + this.addChild(t); + this.creates = new com_davidmaletz_mining_structure_Slot(); + this.addClickable(new com_davidmaletz_mining_ui_ItemValueRenderer(handler,null,this.grid.getWidth()).create(this.creates,this.grid.offsetX,t.get_y() + com_davidmaletz_mining_ui_StringRenderer._getHeight() + 4),5); + var k = new com_davidmaletz_mining_ui_KeyTooltip(false,"quest",com_davidmaletz_mining_ui_CraftingWindow.prototype.getWidth.call(this) * 0.5,this.getHeight() + 4,com_fancyfish_faeng_common_Lang.getText("common","set_first"),16777215,-16777216,true,$bind(this,this.selectFirst)); + k.set_scaleX(k.set_scaleY(0.5)); + this.addChild(k); + this.addChild(this.details); +}; +$hxClasses["com.davidmaletz.mining.ui.EnchantWindow"] = com_davidmaletz_mining_ui_EnchantWindow; +com_davidmaletz_mining_ui_EnchantWindow.__name__ = ["com","davidmaletz","mining","ui","EnchantWindow"]; +com_davidmaletz_mining_ui_EnchantWindow.__interfaces__ = [com_davidmaletz_mining_ui_SlotWindow]; +com_davidmaletz_mining_ui_EnchantWindow.__super__ = com_davidmaletz_mining_ui_CraftingWindow; +com_davidmaletz_mining_ui_EnchantWindow.prototype = $extend(com_davidmaletz_mining_ui_CraftingWindow.prototype,{ + structure: null + ,grid: null + ,player: null + ,creates: null + ,getPlayer: function() { + return this.player; + } + ,getDetails: function() { + return this.details; + } + ,getAdditional: function(item,s,w,x,y) { + return y; + } + ,checkCreates: function(item) { + if(item == this.creates) { + this.doEnchant(); + return true; + } else { + return false; + } + } + ,filterSlot: function(item) { + if(this.isTabbed(item)) { + return null; + } else { + return ($_=this.structure,$bind($_,$_.filterSlot)); + } + } + ,isTabbed: function(item) { + return item == this.structure.slots[0]; + } + ,getInventory: function() { + return this.list.inventory; + } + ,getOffsetX: function() { + return com_davidmaletz_mining_ui_CraftingWindow.prototype.getWidth.call(this) + 4; + } + ,init: function(e) { + com_davidmaletz_mining_ui_CraftingWindow.prototype.init.call(this,e); + var _g = 0; + var _g1 = this.structure.slots; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + s.addEventListener("updated",$bind(this,this.updateCreates)); + } + this.updateCreates(null); + com_davidmaletz_controls_Controller.instance.addEventListener("tap",$bind(this,this.release),false,com_davidmaletz_faengfl_Window.window_ct + 1); + } + ,destroy: function(e) { + com_davidmaletz_mining_ui_CraftingWindow.prototype.destroy.call(this,e); + var _g = 0; + var _g1 = this.structure.slots; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + s.removeEventListener("updated",$bind(this,this.updateCreates)); + } + com_davidmaletz_controls_Controller.instance.removeEventListener("tap",$bind(this,this.release)); + } + ,select: null + ,selectFirst: function() { + if(this.select == null) { + this.select = new openfl_display_Sprite(); + com_davidmaletz_faengfl_ui_Tooltip.draw(this.select,com_fancyfish_faeng_common_Lang.getText("common","hotkey")); + this.select.set_x(Math.round(this.getWidth() * 0.5)); + this.select.set_y(-12); + this.addChild(this.select); + } else { + this.select.set_visible(!this.select.get_visible()); + } + } + ,release: function(e) { + var i = this.details.getInfo(); + if(e.key == "quest" && i != null && Std["is"](i,com_davidmaletz_mining_item_Recipe)) { + if(this.structure.setFirstRecipe(js_Boot.__cast(i , com_davidmaletz_mining_item_Recipe))) { + this.refresh(false); + } + } + } + ,onSelect: function(recipe) { + if(this.select != null && this.select.get_visible()) { + if(this.structure.setFirstRecipe(recipe)) { + this.refresh(false); + } + this.select.set_visible(false); + } else { + com_davidmaletz_mining_ui_CraftingWindow.prototype.onSelect.call(this,recipe); + } + } + ,onHover: function(recipe) { + com_davidmaletz_mining_ui_CraftingWindow.prototype.onHover.call(this,recipe); + this.details.set_x(com_davidmaletz_mining_ui_CraftingWindow.prototype.getWidth.call(this) - 4); + } + ,getDrawable: function() { + var draw = new com_davidmaletz_faengfl_CompoundDrawable(); + var _w = com_davidmaletz_mining_ui_CraftingWindow.prototype.getWidth.call(this); + draw.add(com_davidmaletz_mining_Main.window_factory.create(_w,this.getHeight()),0,0); + draw.add(com_davidmaletz_mining_Main.window_factory.create(this.getWidth() - (_w - 1),this.getHeight()),_w - 1,0); + return draw; + } + ,getWidth: function() { + return com_davidmaletz_mining_ui_CraftingWindow.prototype.getWidth.call(this) + this.grid.getWidth() + 8; + } + ,updateCreates: function(e) { + var r = this.structure.slotCreates(this.player); + if(r != null && r.creates != null) { + this.creates._setItem(r.creates.asItem()); + if(r.xml.get("enchantOnly") != "true") { + this.addRecipe(r); + } + } else { + this.creates._setItem(null); + } + } + ,doEnchant: function() { + var r = this.structure.slotCreates(this.player); + if(r != null) { + this.structure.craft(this.player,r); + } + } + ,addRecipe: function(r) { + if(this.structure.addRecipe(r)) { + this.refresh(true); + } + } + ,refresh: function(restorePos) { + var p = restorePos ? com_davidmaletz_controls_scroll_ScrollList.preSwitch(this.clickables) : null; + var y = this.list.getScrollY(); + this.list.clear(); + this.addItems(); + var xml = this.structure.info.xml; + this.list.addItems(new com_fancyfish_faeng_common_DoubleIterator(this.structure.iterator(),com_davidmaletz_mining_ui_CraftingWindow.getRecipes(this.player,xml)),this.details,xml.elementPathsNamed("listItem"),this.structure); + var ht = this.list.getViewportHeight(); + var sht = this.list.getScrollHeight(); + ht = sht - ht; + if(y > ht) { + y = ht; + } + if(y < 0) { + y = 0; + } + if(this.list.getScrollY() == y) { + this.list.scrollbar.update(); + } else { + this.list.updateScroll(y); + } + if(restorePos) { + com_davidmaletz_controls_scroll_ScrollList.postSwitch(this.clickables,p); + } else { + this.clickables.setSelection(0,0); + } + } + ,__class__: com_davidmaletz_mining_ui_EnchantWindow +}); +var com_davidmaletz_mining_ui_SlotHandler = function(e) { + this.wnd = e; +}; +$hxClasses["com.davidmaletz.mining.ui.SlotHandler"] = com_davidmaletz_mining_ui_SlotHandler; +com_davidmaletz_mining_ui_SlotHandler.__name__ = ["com","davidmaletz","mining","ui","SlotHandler"]; +com_davidmaletz_mining_ui_SlotHandler.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_SlotHandler.prototype = { + wnd: null + ,onSelect: function(item) { + if(this.wnd.checkCreates(item)) { + return; + } + var p = this.wnd.getPlayer(); + var c = com_davidmaletz_mining_Main.getContainer(); + var slot = js_Boot.__cast(item , com_davidmaletz_mining_structure_Slot); + if(com_davidmaletz_faengfl_adv_AdvApp.shiftDown && slot.getItem(p) != null) { + this.setItem(slot,null); + } else if(this.wnd.isTabbed(item)) { + var f = $bind(this,this.setItem); + var a1 = slot; + c.addDisplay(new com_davidmaletz_mining_ui_SelectItemList(p,c,function(a2) { + f(a1,a2); + },true,null,this.wnd.filterSlot(item),this.wnd.getInventory()),2); + } else { + var f1 = $bind(this,this.setItem); + var a11 = slot; + var tmp = function(a21) { + f1(a11,a21); + }; + c.addDisplay(new com_davidmaletz_mining_ui_ItemList(c,this.wnd.getInventory(),com_fancyfish_faeng_common_Lang.getText("common","inventory"),p.includeCost(),this.wnd.filterSlot(item),tmp,false,com_fancyfish_faeng_common_Lang.getText("common","none"),($_=this.wnd,$bind($_,$_.getAdditional))),2); + } + } + ,setItem: function(slot,item) { + if(item == null || item.count > 0) { + slot.setItem(this.wnd.getPlayer(),item); + this.onHover(null); + this.onHover(slot); + } + } + ,onHover: function(item) { + var d = this.wnd.getDetails(); + d.setInfo(item == null ? null : item.getItem(this.wnd.getPlayer())); + d.set_x(this.wnd.getOffsetX() - d.getWidth()); + d.set_y(Math.round((this.wnd.getHeight() - d.getHeight()) * 0.5)); + } + ,isEnabled: function(item) { + return true; + } + ,__class__: com_davidmaletz_mining_ui_SlotHandler +}; +var com_davidmaletz_mining_ui_EntryList = function(c,label,func) { + var r = new com_davidmaletz_mining_ui__$EntryList_EntryRenderer(this); + var rows = Math.floor(100 / r.getHeight(null)); + com_davidmaletz_controls_scroll_ScrollWindow.call(this,c,com_davidmaletz_mining_Main.window_factory,r,rows,1,0.1); + var _g = 0; + var _g1 = com_davidmaletz_faengfl_adv_ModHandler.entries; + while(_g < _g1.length) { + var e = _g1[_g]; + ++_g; + this.addItem(e); + } + this.onComplete = func; + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,label,this.getWidth(),0,100); + this.details = new com_davidmaletz_mining_ui_details_StringDetails(90); + this.details.set_x(153.2); + this.addChild(this.details); +}; +$hxClasses["com.davidmaletz.mining.ui.EntryList"] = com_davidmaletz_mining_ui_EntryList; +com_davidmaletz_mining_ui_EntryList.__name__ = ["com","davidmaletz","mining","ui","EntryList"]; +com_davidmaletz_mining_ui_EntryList.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_EntryList.__super__ = com_davidmaletz_controls_scroll_ScrollWindow; +com_davidmaletz_mining_ui_EntryList.prototype = $extend(com_davidmaletz_controls_scroll_ScrollWindow.prototype,{ + details: null + ,onComplete: null + ,onSelect: function(item) { + if(this.onComplete != null) { + this.onComplete(item); + } + this.close(); + } + ,onHover: function(item) { + var i = null; + if(item != null) { + i = com_fancyfish_faeng_common_Lang.getTextFromTitle(item.get("description")); + } + this.details.setInfo(i == null ? null : i.get(),0.5); + this.details.set_y(Math.round((this.getHeight() - this.details.getHeight()) * 0.5)); + } + ,isEnabled: function(item) { + return true; + } + ,__class__: com_davidmaletz_mining_ui_EntryList +}); +var com_davidmaletz_mining_ui__$EntryList_EntryRenderer = function(handler) { + this.handler = handler; +}; +$hxClasses["com.davidmaletz.mining.ui._EntryList.EntryRenderer"] = com_davidmaletz_mining_ui__$EntryList_EntryRenderer; +com_davidmaletz_mining_ui__$EntryList_EntryRenderer.__name__ = ["com","davidmaletz","mining","ui","_EntryList","EntryRenderer"]; +com_davidmaletz_mining_ui__$EntryList_EntryRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui__$EntryList_EntryRenderer.prototype = { + handler: null + ,create: function(item,x,y) { + return new com_davidmaletz_mining_ui__$EntryList_EntryButton(this.handler,item,x,y,140,com_davidmaletz_mining_ui_StringRenderer._getHeight()); + } + ,update: function(s,item) { + } + ,getWidth: function() { + return 140; + } + ,getHeight: function(item) { + return com_davidmaletz_mining_ui_StringRenderer._getHeight(); + } + ,__class__: com_davidmaletz_mining_ui__$EntryList_EntryRenderer +}; +var com_davidmaletz_mining_ui__$EntryList_EntryButton = function(handler,i,x,y,w,h) { + com_davidmaletz_controls_Button.call(this,x,y,com_davidmaletz_mining_Main.label_factory.createBG(w,h),com_davidmaletz_mining_Main.label_factory.createHover(w,h),null); + this.handler = handler; + this.info = i; + var l = com_fancyfish_faeng_common_Lang.getTextFromTitle(i.get("name")); + if(l == null) { + l = new com_fancyfish_faeng_common_mutable_Static(i.exists("name") ? i.get("name") : "???"); + } + var t = new com_davidmaletz_faengfl_TextSprite(l,new com_fancyfish_faeng_text_CharacterPlacer(0,0),0,1); + t.set_x(2); + t.set_y(Math.round((h - t.lineHeight()) * 0.5)); + t.set_alpha(handler.isEnabled(this.info) ? 1 : 0.5); + this.addChild(t); +}; +$hxClasses["com.davidmaletz.mining.ui._EntryList.EntryButton"] = com_davidmaletz_mining_ui__$EntryList_EntryButton; +com_davidmaletz_mining_ui__$EntryList_EntryButton.__name__ = ["com","davidmaletz","mining","ui","_EntryList","EntryButton"]; +com_davidmaletz_mining_ui__$EntryList_EntryButton.__super__ = com_davidmaletz_controls_Button; +com_davidmaletz_mining_ui__$EntryList_EntryButton.prototype = $extend(com_davidmaletz_controls_Button.prototype,{ + handler: null + ,info: null + ,onClick: function() { + if(this.handler != null) { + this.handler.onSelect(this.info); + } + return true; + } + ,onHover: function(hover) { + com_davidmaletz_controls_Button.prototype.onHover.call(this,hover); + if(this.handler != null) { + this.handler.onHover(hover ? this.info : null); + } + } + ,__class__: com_davidmaletz_mining_ui__$EntryList_EntryButton +}); +var com_davidmaletz_mining_ui_EquipmentSlotRenderer = function(handler,e,none,compact) { + if(compact == null) { + compact = false; + } + this.handler = handler; + this.equipment = e; + if(none == null) { + none = com_fancyfish_faeng_common_Lang.getText("common","none"); + } + this.none = none; + this.compact = compact; +}; +$hxClasses["com.davidmaletz.mining.ui.EquipmentSlotRenderer"] = com_davidmaletz_mining_ui_EquipmentSlotRenderer; +com_davidmaletz_mining_ui_EquipmentSlotRenderer.__name__ = ["com","davidmaletz","mining","ui","EquipmentSlotRenderer"]; +com_davidmaletz_mining_ui_EquipmentSlotRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui_EquipmentSlotRenderer.prototype = { + handler: null + ,equipment: null + ,none: null + ,compact: null + ,create: function(item,x,y) { + return new com_davidmaletz_mining_ui__$EquipmentSlotRenderer_ListButton(this,this.equipment,this.none,item,x,y); + } + ,update: function(s,item) { + } + ,getWidth: function() { + if(this.compact) { + return com_davidmaletz_tiles_Tile.SIZE; + } else { + return 80; + } + } + ,getHeight: function(item) { + return 15; + } + ,__class__: com_davidmaletz_mining_ui_EquipmentSlotRenderer +}; +var com_davidmaletz_mining_ui__$EquipmentSlotRenderer_ListButton = function(r,equip,none,i,x,y) { + var w = Math.round(r.getWidth()); + var h = Math.round(r.getHeight(null)); + this.none = none; + this.handler = r.handler; + this.compact = r.compact; + var bg = com_davidmaletz_mining_Main.label_factory.createBG(w,h); + var hover = com_davidmaletz_mining_Main.label_factory.createHover(w,h); + com_davidmaletz_controls_Button.call(this,x,y,bg,hover,null); + this.item = i; + this.equipment = equip; + if(!this.compact) { + var t = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("equipment",this.item),new com_fancyfish_faeng_text_CharacterPlacer(0),0,0.5); + t.set_x(2); + this.addChild(t); + } + this.info = new openfl_display_Sprite(); + this.addChild(this.info); + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); +}; +$hxClasses["com.davidmaletz.mining.ui._EquipmentSlotRenderer.ListButton"] = com_davidmaletz_mining_ui__$EquipmentSlotRenderer_ListButton; +com_davidmaletz_mining_ui__$EquipmentSlotRenderer_ListButton.__name__ = ["com","davidmaletz","mining","ui","_EquipmentSlotRenderer","ListButton"]; +com_davidmaletz_mining_ui__$EquipmentSlotRenderer_ListButton.__super__ = com_davidmaletz_controls_Button; +com_davidmaletz_mining_ui__$EquipmentSlotRenderer_ListButton.prototype = $extend(com_davidmaletz_controls_Button.prototype,{ + last: null + ,none: null + ,item: null + ,equipment: null + ,handler: null + ,info: null + ,compact: null + ,init: function(e) { + this.destroy(e); + var s = this.equipment.get(this.item); + if(s != null) { + s.addEventListener("updated",$bind(this,this.updateSlot)); + this.equipment.getUsed(this.item).addEventListener("updated",$bind(this,this.updateSlot)); + this.updateSlot(null); + } else { + if(this.last != null) { + this.last.removeEventListener("updated",$bind(this,this.updateSlot)); + this.last = null; + } + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this.info); + } + } + ,destroy: function(e) { + var s = this.equipment.get(this.item); + if(s != null) { + s.removeEventListener("updated",$bind(this,this.updateSlot)); + this.equipment.getUsed(this.item).removeEventListener("updated",$bind(this,this.updateSlot)); + } + if(this.last != null) { + this.last.removeEventListener("updated",$bind(this,this.updateSlot)); + this.last = null; + } + } + ,onClick: function() { + this.handler.onSelect(this.item); + return true; + } + ,onHover: function(hover) { + com_davidmaletz_controls_Button.prototype.onHover.call(this,hover); + this.handler.onHover(hover ? this.item : null); + } + ,updateSlot: function(e) { + if(this.last != null) { + this.last.removeEventListener("updated",$bind(this,this.updateSlot)); + this.last = null; + } + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this.info); + var i = this.equipment.getItem(this.item); + if(i == null) { + var s = this.equipment.getUsed(this.item).get(); + if(s != null) { + i = this.equipment.getItem(s); + if(i != null) { + this.info.set_alpha(0.5); + } + } + } else { + this.info.set_alpha(this.handler.isEnabled(this.item) ? 1 : 0.5); + } + if(i != null) { + this.last = i.getName(); + this.last.addEventListener("updated",$bind(this,this.updateSlot)); + if(this.compact) { + var t = i.createIcon(); + if(t != null) { + t.set_y(5); + this.info.addChild(t); + } + } else { + com_davidmaletz_mining_ui_ItemRenderer.addItem(this.info,i,2,5); + } + } else if(!this.compact) { + var m = this.none; + this.info.set_alpha(1); + if(m == com_fancyfish_faeng_common_Lang.getText("common","none")) { + var xml = this.equipment.getSlotXml(this.item); + if(xml != null) { + var i1 = com_davidmaletz_mining_item_ItemInfo.get(xml.get("noneItem")); + if(i1 != null) { + com_davidmaletz_mining_ui_ItemRenderer.addItem(this.info,i1,2,5); + return; + } + m = com_fancyfish_faeng_common_Lang.getTextFromTitle(xml.get("none")); + if(m == null) { + m = this.none; + } + } + } + var t1 = new com_davidmaletz_faengfl_TextSprite(m,new com_fancyfish_faeng_text_CharacterPlacer(80,1),0,1); + t1.set_y(5); + this.info.addChild(t1); + } else { + var t2 = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Static("-"),new com_fancyfish_faeng_text_CharacterPlacer(com_davidmaletz_tiles_Tile.SIZE,1),0,1); + t2.set_y(5); + this.info.addChild(t2); + this.info.set_alpha(0.5); + } + } + ,__class__: com_davidmaletz_mining_ui__$EquipmentSlotRenderer_ListButton +}); +var com_davidmaletz_mining_ui_EquipmentWindow = function(object,c,title,cols) { + if(cols == null) { + cols = 1; + } + this.last = null; + var eq = object.getEquipment(); + var r = new com_davidmaletz_mining_ui_EquipmentSlotRenderer(this,eq,com_fancyfish_faeng_common_Lang.getTextFromTitle(object.getXml().get("equipNone"))); + var rows = Math.round(100 / r.getHeight(null)); + com_davidmaletz_controls_scroll_ScrollWindow.call(this,c,com_davidmaletz_mining_Main.window_factory,r,rows,cols,0.5,0.55); + var owner = object.getOwner(); + this.object = object; + this.addItems(owner,eq); + var width = this.getSlotsWidth(); + this.title = com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,title == null ? com_fancyfish_faeng_common_Lang.getText("common","equipment") : title,this.getWidth()); + this.addInfo(width); + this.details = new com_davidmaletz_mining_ui_details_RecipeDetails(owner.includeCost()); + this.details.set_x(width + 3); + this.addChild(this.details); +}; +$hxClasses["com.davidmaletz.mining.ui.EquipmentWindow"] = com_davidmaletz_mining_ui_EquipmentWindow; +com_davidmaletz_mining_ui_EquipmentWindow.__name__ = ["com","davidmaletz","mining","ui","EquipmentWindow"]; +com_davidmaletz_mining_ui_EquipmentWindow.__interfaces__ = [AbstractClass,com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_EquipmentWindow.isSlot = function(id,slot,i) { + var s = i.xml.get("slot"); + if(s == "any" || s == slot) { + if(!(Std["is"](i,com_davidmaletz_mining_item_Equipment) && (js_Boot.__cast(i , com_davidmaletz_mining_item_Equipment)).equipOn.exists(id))) { + return i.hasActionId("equip"); + } else { + return true; + } + } else { + return false; + } +}; +com_davidmaletz_mining_ui_EquipmentWindow.isAvailable = function(p,i,v,n) { + return i.actionAvailable("equip",p,v,n); +}; +com_davidmaletz_mining_ui_EquipmentWindow.changeEquip = function(wnd,object,slot,i) { + if(wnd != null) { + wnd.onHover(null); + } + com_davidmaletz_faengfl_adv_sound_Sound.play("equip"); + if(i != null) { + object.getEquipment().equip(new com_davidmaletz_mining_item_Item(i.item,i.value,i.name),object,false,slot); + if(wnd != null) { + wnd.onHover(i.item.xml.get("slot")); + } + } else { + object.getEquipment().unequip(slot,object); + } +}; +com_davidmaletz_mining_ui_EquipmentWindow.enableFlag = function(flag,object,slot,enable) { + var s = object.getEquipment().getState(slot); + if(s == null) { + return; + } + if(enable) { + s.set(s.get() & ~flag); + } else { + s.set(s.get() | flag); + } +}; +com_davidmaletz_mining_ui_EquipmentWindow.enableFlight = function(object,slot,enable) { + com_davidmaletz_mining_ui_EquipmentWindow.enableFlag(2,object,slot,enable); + object.getOwner().overlapChanged(); +}; +com_davidmaletz_mining_ui_EquipmentWindow.selectSlot = function(object,slot,wnd) { + var eq = object.getEquipment(); + var e = eq.getSlotXml(slot); + if(e == null) { + com_davidmaletz_mining_ui_EquipmentWindow._selectSlot(object,slot,wnd); + } else { + var a1 = object; + var a2 = slot; + var a3 = wnd; + var tmp = function() { + com_davidmaletz_mining_ui_EquipmentWindow._selectSlot(a1,a2,a3); + }; + new com_davidmaletz_mining_npc_NPCEventHandler(e.elements(),object.getOwner(),object,tmp).runAll(); + } +}; +com_davidmaletz_mining_ui_EquipmentWindow._selectSlot = function(object,slot,wnd) { + var eq = object.getEquipment(); + var i = eq.getItem(slot); + if(i == null || com_davidmaletz_mining_ui_EquipmentWindow.fastUnequip(object,slot)) { + com_davidmaletz_mining_ui_EquipmentWindow._onSelect(object.getId(),object,slot,wnd); + } else { + var c = com_davidmaletz_mining_Main.getContainer(); + var ids = []; + var funcs = []; + i.info.getActionChoices(ids,funcs,object.getOwner(),i.value,i.getNameStr(),wnd,new com_davidmaletz_mining_item_EquipmentSlot(object,slot),false); + var t; + var tmp; + var tmp1; + t = com_davidmaletz_mining_familiar_FamiliarType.getFromItem(i.info,i.getNameStr()); + if(t != null) { + tmp1 = t.attacks.length > 0; + } else { + tmp1 = false; + } + if(!tmp1) { + tmp = i.info.xml.get("enableAttack") == "true"; + } else { + tmp = true; + } + if(tmp) { + var enable = (eq.getStateI(slot) & 1) != 0; + ids.push(enable ? "enable_attack" : "disable_attack"); + var a2 = object; + var a3 = slot; + var a4 = enable; + funcs.push(function() { + com_davidmaletz_mining_ui_EquipmentWindow.enableFlag(1,a2,a3,a4); + }); + } + if(slot == "familiar" && t != null && object.getOwner().canSummonFamiliar()) { + ids.push("summon"); + funcs.push(($_=object.getOwner(),$bind($_,$_.summonFamiliar))); + } + if(Std["is"](i.info,com_davidmaletz_mining_item_Equipment) && (js_Boot.__cast(i.info , com_davidmaletz_mining_item_Equipment)).flight != null) { + var enable1 = (eq.getStateI(slot) & 2) != 0; + ids.push(enable1 ? "enable_flight" : "disable_flight"); + var a1 = object; + var a21 = slot; + var a31 = enable1; + funcs.push(function() { + com_davidmaletz_mining_ui_EquipmentWindow.enableFlight(a1,a21,a31); + }); + } + if(i.info.xml.get("unequip") != "false") { + ids.push("switch"); + var id = object.getId(); + var a11 = object; + var a22 = slot; + var a32 = wnd; + funcs.push(function() { + com_davidmaletz_mining_ui_EquipmentWindow._onSelect(id,a11,a22,a32); + }); + } + if(funcs.length == 1) { + funcs[0](); + } else if(funcs.length > 0) { + if(i.info.xml.get("unequip") != "false") { + ids.push("common.remove"); + var a12 = wnd; + var a23 = object; + var a33 = slot; + funcs.push(function() { + com_davidmaletz_mining_ui_EquipmentWindow.changeEquip(a12,a23,a33,null); + }); + } + c.addDisplay(new com_davidmaletz_mining_ui_Choice(c,"actions",ids,funcs),2); + } + } +}; +com_davidmaletz_mining_ui_EquipmentWindow.firstAction = function(object,slot) { + var i = object.getEquipment().getItem(slot); + if(i == null) { + return; + } + var action = i.info.getFirstAction(object.getOwner(),i.value,i.getNameStr(),null,new com_davidmaletz_mining_item_EquipmentSlot(object,slot),false); + if(action == null || action.getId() == "rename" || com_davidmaletz_mining_ui_EquipmentWindow.fastUnequip(object,slot)) { + com_davidmaletz_mining_ui_EquipmentWindow._onSelect(object.getId(),object,slot,null); + } else { + action["use"](); + } +}; +com_davidmaletz_mining_ui_EquipmentWindow.fastUnequip = function(object,slot) { + if(com_davidmaletz_faengfl_adv_AdvApp.shiftDown) { + return object.getEquipment().getItem(slot) != null; + } else { + return false; + } +}; +com_davidmaletz_mining_ui_EquipmentWindow._onSelect = function(id,object,slot,wnd) { + var eq = object.getEquipment(); + if(!eq.canChangeSlot(slot)) { + return; + } + var c = com_davidmaletz_mining_Main.getContainer(); + if(com_davidmaletz_mining_ui_EquipmentWindow.fastUnequip(object,slot)) { + com_davidmaletz_mining_ui_EquipmentWindow.changeEquip(wnd,object,slot,null); + } else { + var none = com_fancyfish_faeng_common_Lang.getText("common","none"); + var m = none; + var xml = eq.getSlotXml(slot); + var noneItem = null; + if(xml != null) { + noneItem = com_davidmaletz_mining_item_ItemInfo.get(xml.get("noneItem")); + m = com_fancyfish_faeng_common_Lang.getTextFromTitle(xml.get("none")); + if(m == null) { + m = none; + } + } + var f; + if(Std["is"](object,com_davidmaletz_mining_Player)) { + var p = js_Boot.__cast(object , com_davidmaletz_mining_Player); + f = function(i,v,n) { + return com_davidmaletz_mining_ui_EquipmentWindow.isAvailable(p,i,v,n); + }; + } else { + f = null; + } + var id1 = id; + var a1 = slot; + var tmp = function(i1) { + return com_davidmaletz_mining_ui_EquipmentWindow.isSlot(id1,a1,i1); + }; + var a11 = wnd; + var a2 = object; + var a3 = slot; + var tmp1 = function(i2) { + com_davidmaletz_mining_ui_EquipmentWindow.changeEquip(a11,a2,a3,i2); + }; + c.addDisplay(new com_davidmaletz_mining_ui_ItemList(c,object.getInventory(),com_fancyfish_faeng_common_Lang.getText("equipment",slot),object.getOwner().includeCost(),tmp,tmp1,false,m,null,null,false,f,null,noneItem),2); + } +}; +com_davidmaletz_mining_ui_EquipmentWindow.__super__ = com_davidmaletz_controls_scroll_ScrollWindow; +com_davidmaletz_mining_ui_EquipmentWindow.prototype = $extend(com_davidmaletz_controls_scroll_ScrollWindow.prototype,{ + details: null + ,object: null + ,title: null + ,addItems: function(owner,eq) { + var slot = eq.getSlots(); + while(slot.hasNext()) { + var slot1 = slot.next(); + var f = eq.getSlotFlag(slot1); + if(f == null || owner.getFlag(f)) { + this.addSlot(slot1); + } + } + } + ,addSlot: function(slot) { + this.addItem(slot); + } + ,addInfo: function(width) { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,showInventory: function() { + this.onClose = $bind(this,this._showInventory); + this.close(); + } + ,_showInventory: function() { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,makeDrawable: function(factory) { + var draw = new com_davidmaletz_faengfl_CompoundDrawable(); + var d = factory.create(this.getSlotsWidth(),this.getHeight()); + draw.add(d,0,0); + draw.add(factory.create(this.getInfoWidth() + 8,this.getHeight()),d.getWidth() - 1,0); + return draw; + } + ,getInfoWidth: function() { + return 106; + } + ,getSlotsWidth: function() { + return com_davidmaletz_controls_scroll_ScrollWindow.prototype.getWidth.call(this); + } + ,getWidth: function() { + return this.getSlotsWidth() - 1 + this.getInfoWidth() + 8; + } + ,onSelect: function(slot) { + com_davidmaletz_mining_ui_EquipmentWindow.selectSlot(this.object,slot,this); + } + ,last: null + ,updateSlot: function(e) { + this.details.setItem(null); + this._setItem(this.last); + } + ,_setItem: function(item) { + this.details.setItem(item); + this.details.set_y(Math.floor((this.getHeight() + 18 - this.details.getHeight()) * 0.5)); + } + ,onHover: function(slot) { + var item = slot == null ? null : this.object.getEquipment().getItem(slot); + if(this.last != null) { + this.last.getName().removeEventListener("updated",$bind(this,this.updateSlot)); + this.last = null; + } + this.last = item; + if(this.last != null) { + this.last.getName().addEventListener("updated",$bind(this,this.updateSlot)); + } + this._setItem(item); + } + ,isEnabled: function(slot) { + var e = this.object.getEquipment(); + var i = e.getItem(slot); + if(i != null) { + return i.info.xml.get("unequip") != "false"; + } else { + return true; + } + } + ,init: function(e) { + com_davidmaletz_controls_scroll_ScrollWindow.prototype.init.call(this,e); + com_davidmaletz_controls_Controller.instance.addEventListener("tap",$bind(this,this.release),false,com_davidmaletz_faengfl_Window.window_ct + 1); + } + ,destroy: function(e) { + com_davidmaletz_controls_scroll_ScrollWindow.prototype.destroy.call(this,e); + com_davidmaletz_controls_Controller.instance.removeEventListener("tap",$bind(this,this.release)); + if(this.last != null) { + this.last.getName().removeEventListener("updated",$bind(this,this.updateSlot)); + this.last = null; + } + } + ,release: function(e) { + if(e.key == "equipment") { + this.close(); + } else if(e.key == "inventory") { + this.showInventory(); + } + } + ,__class__: com_davidmaletz_mining_ui_EquipmentWindow +}); +var com_davidmaletz_mining_ui_ExportList = function(c,halign,valign) { + if(valign == null) { + valign = 0.5; + } + if(halign == null) { + halign = 0.5; + } + com_davidmaletz_mining_network_CloudSaveList.call(this,c,com_fancyfish_faeng_common_Lang.getText("options","export"),false,halign,valign); +}; +$hxClasses["com.davidmaletz.mining.ui.ExportList"] = com_davidmaletz_mining_ui_ExportList; +com_davidmaletz_mining_ui_ExportList.__name__ = ["com","davidmaletz","mining","ui","ExportList"]; +com_davidmaletz_mining_ui_ExportList.__super__ = com_davidmaletz_mining_network_CloudSaveList; +com_davidmaletz_mining_ui_ExportList.prototype = $extend(com_davidmaletz_mining_network_CloudSaveList.prototype,{ + onSelect: function(slot) { + if(this.isEnabled(slot)) { + com_davidmaletz_mining_ui_Options.saveFile(slot); + } + this.close(); + } + ,isEnabled: function(item) { + if(com_davidmaletz_mining_network_CloudSaveList.prototype.isEnabled.call(this,item)) { + return typeof(com_davidmaletz_mining_Main.getSlotHeader(com_davidmaletz_mining_Main.slotToId(item))) != "boolean"; + } else { + return false; + } + } + ,__class__: com_davidmaletz_mining_ui_ExportList +}); +var com_davidmaletz_mining_ui_FarmWindow = function(player,farm,c,halign,valign) { + if(valign == null) { + valign = 0.5; + } + if(halign == null) { + halign = 0.5; + } + this.partial = 0; + var r = new com_davidmaletz_mining_ui_CompositeFarmItemRenderer(this); + var rows = Math.round(100 / r.getHeight(null)); + this.farm = farm; + this.farmList = new com_davidmaletz_controls_scroll_ScrollList(c,r,rows,1); + this.farmList.set_x(4); + this.farmList.set_y(4); + this.slotList = this.makeSlotList(player,farm,c); + this.items = new com_davidmaletz_mining_item_CompositeFarmItems(farm); + var w = this.getWidth(); + this.slotList.set_x(w - 4 - this.slotList.getWidth()); + this.slotList.set_y(4); + var draw = new com_davidmaletz_faengfl_CompoundDrawable(); + draw.add(com_davidmaletz_mining_Main.window_factory.create(this.farmList.getWidth() + 8,this.getHeight()),0,0); + var _x = this.farmList.getWidth() + 8 - 1; + var _w = this.slotList.getWidth() + 8 + 1; + draw.add(com_davidmaletz_mining_Main.window_factory.create(_w,this.getHeight()),_x,0); + com_davidmaletz_controls_ClickableWindow.call(this,c,draw,true,true,true,halign,valign); + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,com_fancyfish_faeng_common_Lang.getText("common","harvest"),this.farmList.getWidth() + 8); + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,com_fancyfish_faeng_common_Lang.getText("common","manage"),this.slotList.getWidth() + 8,this.slotList.get_x() - 4); + this.addChild(this.farmList); + this.addChild(this.slotList); + this.player = player; + var close = new com_davidmaletz_controls_CloseButton(this,this.getWidth(),0); + this.addChild(close); + this.clickables.addClickable(close,this); + var ic = player.includeCost(); + var k = new com_davidmaletz_mining_ui_KeyTooltip(false,"quest",this.getWidth() * 0.5,this.getHeight() + 4,com_fancyfish_faeng_common_Lang.getText("common","set_first"),16777215,-16777216,true,$bind(this,this.selectFirst)); + k.set_scaleX(k.set_scaleY(0.5)); + this.addChild(k); + this.details = new com_davidmaletz_mining_ui_details_RecipeDetails(ic); + this.addChild(this.details); +}; +$hxClasses["com.davidmaletz.mining.ui.FarmWindow"] = com_davidmaletz_mining_ui_FarmWindow; +com_davidmaletz_mining_ui_FarmWindow.__name__ = ["com","davidmaletz","mining","ui","FarmWindow"]; +com_davidmaletz_mining_ui_FarmWindow.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_FarmWindow.__super__ = com_davidmaletz_controls_ClickableWindow; +com_davidmaletz_mining_ui_FarmWindow.prototype = $extend(com_davidmaletz_controls_ClickableWindow.prototype,{ + player: null + ,details: null + ,items: null + ,farmList: null + ,slotList: null + ,farm: null + ,partial: null + ,advanceFrame: function(frames) { + com_davidmaletz_controls_ClickableWindow.prototype.advanceFrame.call(this,frames); + if(this.stage != null && frames > 0) { + var f = Math.floor(frames); + this.partial += frames - f; + if(this.partial >= 1) { + ++f; + this.partial -= 1; + } + this.farm.handleTick(com_davidmaletz_mining_Main.isPaused() ? f : 0); + } + } + ,makeSlotList: function(player,farm,c) { + return new com_davidmaletz_mining_ui_CropSlotList(player,farm,$bind(this,this.showCropDetails),c,$bind(this,this.selectCrop)); + } + ,onSelect: function(item) { + if(this.select != null && this.select.get_visible()) { + this.select.set_visible(false); + } else if(item == null) { + var ct = 0; + var i = this.items.iterator(); + while(i.hasNext()) { + var i1 = i.next(); + ct += i1.collect(this.player,false); + } + if(ct == 0) { + com_davidmaletz_faengfl_adv_sound_Sound.play("warning"); + new com_davidmaletz_faengfl_ui_Popup(128.,52.,0,com_fancyfish_faeng_common_Lang.getText("warning","growing"),16720418); + } else { + this.player.weightCheck(); + } + } else { + item.collect(this.player); + } + } + ,onHover: function(item) { + this.selectedCrop = null; + this.details.setInfo(item); + this.details.set_x(this.farmList.getWidth() + 3); + this.details.set_y(Math.round((this.getHeight() - this.details.getHeight()) * 0.5)); + } + ,selectedCrop: null + ,showCropDetails: function(item) { + this.selectedCrop = item; + this.details.setInfo(item == null || item.info == null ? null : item); + this.details.set_x(this.slotList.get_x() - this.details.getWidth() + 3); + this.details.set_y(Math.round((this.getHeight() - this.details.getHeight()) * 0.5)); + } + ,isEnabled: function(item) { + return true; + } + ,init: function(e) { + this.items.init(); + this.farmList.addItem(null); + var i = this.items.iterator(); + while(i.hasNext()) { + var i1 = i.next(); + this.farmList.addItem(i1); + } + com_davidmaletz_controls_ClickableWindow.prototype.init.call(this,e); + this.items.addEventListener("crop_added",$bind(this,this._addItem)); + com_davidmaletz_controls_Controller.instance.addEventListener("tap",$bind(this,this.release),false,com_davidmaletz_faengfl_Window.window_ct + 1); + } + ,destroy: function(e) { + if(e != null) { + this.items.destroy(); + } + com_davidmaletz_controls_ClickableWindow.prototype.destroy.call(this,e); + this.items.removeEventListener("crop_added",$bind(this,this._addItem)); + com_davidmaletz_controls_Controller.instance.removeEventListener("tap",$bind(this,this.release)); + } + ,select: null + ,selectFirst: function() { + if(this.select == null) { + this.select = new openfl_display_Sprite(); + com_davidmaletz_faengfl_ui_Tooltip.draw(this.select,com_fancyfish_faeng_common_Lang.getText("common","hotkey")); + this.select.set_x(Math.round(this.getWidth() * 0.5)); + this.select.set_y(-12); + this.addChild(this.select); + } else { + this.select.set_visible(!this.select.get_visible()); + } + } + ,selectCrop: function(item) { + if(this.select != null && this.select.get_visible()) { + item.structure.sendToBack(); + this.select.set_visible(false); + return true; + } else { + return false; + } + } + ,release: function(e) { + if(e.key == "quest" && this.selectedCrop != null) { + this.selectedCrop.structure.sendToBack(); + } + } + ,createClickables: function() { + return new com_davidmaletz_controls_CompoundClickableColumns([this.farmList.getList().clickables,this.slotList.getList().clickables],[this.farmList.get_x(),this.slotList.get_x()]); + } + ,_addItem: function(e) { + this.farmList.addItem(e.value); + } + ,getWidth: function() { + return this.farmList.getWidth() + this.slotList.getWidth() + 16; + } + ,getHeight: function() { + return this.farmList.getHeight() + 8; + } + ,__class__: com_davidmaletz_mining_ui_FarmWindow +}); +var com_davidmaletz_mining_ui_Fuel = function(fuelable,w,fuel) { + this.flashing = 0; + com_davidmaletz_faengfl_InitSprite.call(this); + this.fuelable = fuelable; + this.fuel_num = new com_fancyfish_faeng_common_mutable_Mutable(); + this.text = new openfl_display_Sprite(); + this.addChild(this.text); + com_davidmaletz_faengfl_TextSprite.setColor(this.text,0); + var t = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("common",fuel),new com_fancyfish_faeng_text_CharacterPlacer(w,0),16777215,1); + this.text.addChild(t); + var t1 = new com_davidmaletz_faengfl_TextSprite(this.fuel_num,new com_fancyfish_faeng_text_CharacterPlacer(w,2),16777215,1); + this.text.addChild(t1); + this.progress = com_davidmaletz_mining_ui_Fuel.createFuelBar(fuelable.getFuelPercent()); + this._height = t1.lineHeight() + 2; + this.progress.set_x(Math.round((w - 60) * 0.5)); + this.progress.set_y(this._height); + this.addChild(this.progress); + this._height += 5; +}; +$hxClasses["com.davidmaletz.mining.ui.Fuel"] = com_davidmaletz_mining_ui_Fuel; +com_davidmaletz_mining_ui_Fuel.__name__ = ["com","davidmaletz","mining","ui","Fuel"]; +com_davidmaletz_mining_ui_Fuel.createFuelBar = function(percent) { + var progress = new com_davidmaletz_controls_ProgressBar(60,3,com_davidmaletz_mining_Main.PROGRESS_COL,percent,false,false); + progress.getChildAt(0).set_alpha(0.75); + var b = new openfl_display_Bitmap(openfl_Assets.getBitmapData("data/ui/bar_fuel.png")); + b.set_x(-1); + b.set_y(-1); + progress.addChildAt(b,0); + return progress; +}; +com_davidmaletz_mining_ui_Fuel.__super__ = com_davidmaletz_faengfl_InitSprite; +com_davidmaletz_mining_ui_Fuel.prototype = $extend(com_davidmaletz_faengfl_InitSprite.prototype,{ + fuelable: null + ,progress: null + ,text: null + ,fuel_num: null + ,_height: null + ,flashing: null + ,init: function(e) { + this.destroy(e); + this.fuelable.addEventListener("update_fuel",$bind(this,this.update)); + this.update(null); + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.handle_frame),false,PriorityManager.getPriority()); + } + ,destroy: function(e) { + this.fuelable.removeEventListener("update_fuel",$bind(this,this.update)); + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.handle_frame)); + } + ,update: function(e) { + var p = this.fuelable.getFuelPercent(); + this.progress.setProgress(p,5); + this.fuel_num.set(com_fancyfish_faeng_common_Utils.largeNumberFormat(this.fuelable.getFuel()) + "/" + com_fancyfish_faeng_common_Utils.largeNumberFormat(this.fuelable.getMaxFuel())); + if(p <= 0 && this.flashing <= 0) { + this.flashing = 30; + } else if(p > 0 && this.flashing > 0) { + this.flashing = 0; + } + } + ,handle_frame: function(e) { + if(this.flashing > 0) { + this.flashing -= com_davidmaletz_faengfl_FaengFL.frameTime; + if(this.flashing <= 0) { + this.flashing = 30; + var c = this.text.get_transform().get_colorTransform(); + c.redMultiplier = c.redMultiplier == 0 ? 0.8 : 0; + this.text.get_transform().set_colorTransform(c); + } + } else { + var c1 = this.text.get_transform().get_colorTransform(); + c1.redMultiplier = 0; + this.text.get_transform().set_colorTransform(c1); + } + } + ,__class__: com_davidmaletz_mining_ui_Fuel +}); +var com_davidmaletz_mining_ui_MyBar = function(tile,w,h,color,percent) { + if(percent == null) { + percent = 1; + } + this.flashing = 0; + com_davidmaletz_controls_ProgressBar.call(this,w,h,color,percent,false,false); + this.getChildAt(0).set_alpha(0.75); + var b = new openfl_display_Bitmap(openfl_Assets.getBitmapData("data/ui/bar.png")); + b.set_x(-1); + b.set_y(-1); + this.addChildAt(b,0); + this.icon = com_davidmaletz_mining_ui_Coins.makeIcon(tile); + this.icon.set_x(-10); + this.icon.set_y(-3); + this.addChild(this.icon); + if(com_davidmaletz_mining_Main.TOUCHSCREEN) { + this.icon.set_rotation(-90); + var _g = this.icon; + _g.set_y(_g.get_y() + 8); + var _g1 = this.icon; + _g1.set_x(_g1.get_x() + 8); + this.icon.set_scaleY(-1); + this.set_scaleX(-1); + } + this._width = w; + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); +}; +$hxClasses["com.davidmaletz.mining.ui.MyBar"] = com_davidmaletz_mining_ui_MyBar; +com_davidmaletz_mining_ui_MyBar.__name__ = ["com","davidmaletz","mining","ui","MyBar"]; +com_davidmaletz_mining_ui_MyBar.__super__ = com_davidmaletz_controls_ProgressBar; +com_davidmaletz_mining_ui_MyBar.prototype = $extend(com_davidmaletz_controls_ProgressBar.prototype,{ + icon: null + ,_width: null + ,init: function(e) { + this.destroy(e); + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.enter_frame)); + } + ,destroy: function(e) { + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.enter_frame)); + } + ,flashing: null + ,enter_frame: function(e) { + if(this.flashing > 0) { + this.flashing -= com_davidmaletz_faengfl_FaengFL.frameTime; + if(this.flashing <= 0) { + this.flashing = 30; + this.icon.set_alpha(this.icon.get_alpha() == 0.25 ? 1 : 0.25); + } + } else { + this.icon.set_alpha(1); + } + } + ,setProgress: function(percent,frames,complete) { + if(frames == null) { + frames = 0; + } + if(percent > 0 && percent * this._width < 1) { + percent = 1 / this._width; + } + com_davidmaletz_controls_ProgressBar.prototype.setProgress.call(this,percent,frames,complete); + if(percent > 0.25) { + this.flashing = 0; + } else if(this.flashing == 0) { + this.flashing = 30; + } + } + ,__class__: com_davidmaletz_mining_ui_MyBar +}); +var com_davidmaletz_mining_ui_FuelBar = function(o) { + com_davidmaletz_mining_ui_MyBar.call(this,"power",50,3,com_davidmaletz_mining_Main.PROGRESS_COL,o.getFuelPercent()); + this.object = o; + this.set_x(12); +}; +$hxClasses["com.davidmaletz.mining.ui.FuelBar"] = com_davidmaletz_mining_ui_FuelBar; +com_davidmaletz_mining_ui_FuelBar.__name__ = ["com","davidmaletz","mining","ui","FuelBar"]; +com_davidmaletz_mining_ui_FuelBar.__super__ = com_davidmaletz_mining_ui_MyBar; +com_davidmaletz_mining_ui_FuelBar.prototype = $extend(com_davidmaletz_mining_ui_MyBar.prototype,{ + object: null + ,init: function(e) { + com_davidmaletz_mining_ui_MyBar.prototype.init.call(this,e); + this.object.addEventListener("update_fuel",$bind(this,this.update)); + this.update(null); + } + ,destroy: function(e) { + com_davidmaletz_mining_ui_MyBar.prototype.destroy.call(this,e); + this.object.removeEventListener("update_fuel",$bind(this,this.update)); + } + ,update: function(e) { + var p = this.object.getFuelPercent(); + this.setProgress(p,5); + } + ,__class__: com_davidmaletz_mining_ui_FuelBar +}); +var com_davidmaletz_mining_ui_GUI = function(p) { + this.elements = []; + this.hotkey = []; + this.player = p; +}; +$hxClasses["com.davidmaletz.mining.ui.GUI"] = com_davidmaletz_mining_ui_GUI; +com_davidmaletz_mining_ui_GUI.__name__ = ["com","davidmaletz","mining","ui","GUI"]; +com_davidmaletz_mining_ui_GUI.instance = null; +com_davidmaletz_mining_ui_GUI.showInventory = function(player) { + if(player.vehicle == null) { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_WeightInventoryWindow(player,c),2); + } else { + player.vehicle.manageInventory(); + } +}; +com_davidmaletz_mining_ui_GUI.showEquipment = function(player) { + if(player.vehicle == null) { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_PlayerEquipment(player,c),2); + } else { + player.vehicle.manageEquipment(); + } +}; +com_davidmaletz_mining_ui_GUI.updateFade = function(f,s) { + if(s.get_numChildren() == 0 || s.stage == null) { + com_davidmaletz_faengfl_FaengFL.remove(s); + return false; + } else { + s.set_alpha(f); + return true; + } +}; +com_davidmaletz_mining_ui_GUI.setFade = function(f) { + if(com_davidmaletz_mining_ui_GUI.FADE != f) { + com_davidmaletz_mining_ui_GUI.FADE = f; + Reflect.setField(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"fade_ui",f); + if(com_davidmaletz_mining_ui_GUI.instance != null) { + var _g = 0; + var _g1 = com_davidmaletz_mining_ui_GUI.instance.elements; + while(_g < _g1.length) { + var e = _g1[_g]; + ++_g; + e.set_alpha(f); + } + } + var f1 = f; + var tmp = function(s) { + return com_davidmaletz_mining_ui_GUI.updateFade(f1,s); + }; + com_davidmaletz_mining_ui_GUI.static_elements = com_davidmaletz_mining_ui_GUI.static_elements.filter(tmp); + } +}; +com_davidmaletz_mining_ui_GUI.removed = function(e,ev) { + com_davidmaletz_faengfl_FaengFL.remove(e); + HxOverrides.remove(com_davidmaletz_mining_ui_GUI.static_elements,e); +}; +com_davidmaletz_mining_ui_GUI.clearStaticDisplays = function() { + var _g = 0; + var _g1 = com_davidmaletz_mining_ui_GUI.static_elements.slice(); + while(_g < _g1.length) { + var e = _g1[_g]; + ++_g; + com_davidmaletz_faengfl_FaengFL.remove(e); + } + com_fancyfish_faeng_common_Utils.clear(com_davidmaletz_mining_ui_GUI.static_elements); +}; +com_davidmaletz_mining_ui_GUI.addStaticDisplay = function(s,layer,behind) { + if(behind == null) { + behind = false; + } + var e = new openfl_display_Sprite(); + var e1 = e; + s.addEventListener("removedFromStage",function(ev) { + com_davidmaletz_mining_ui_GUI.removed(e1,ev); + }); + e.addChild(s); + com_davidmaletz_mining_ui_GUI.static_elements.push(e); + e.set_alpha(com_davidmaletz_mining_ui_GUI.FADE); + com_davidmaletz_mining_Main.getContainer().addDisplay(e,layer,behind); +}; +com_davidmaletz_mining_ui_GUI.prototype = { + player: null + ,coins: null + ,inventory: null + ,options: null + ,questlog: null + ,equip: null + ,hotkey: null + ,mods: null + ,init: function() { + if(com_davidmaletz_mining_ui_GUI.instance != null) { + com_davidmaletz_mining_ui_GUI.instance.destroy(); + } + var old = com_davidmaletz_faengfl_Window.window_ct; + com_davidmaletz_faengfl_Window.window_ct = 0; + com_davidmaletz_mining_ui_GUI.instance = this; + this._init(); + com_davidmaletz_faengfl_Window.window_ct = old; + } + ,_init: function(eqicon) { + com_davidmaletz_controls_Controller.instance.addEventListener("tap",$bind(this,this.onKey)); + var c = com_davidmaletz_mining_Main.getContainer(); + if(this.includeCoins()) { + if(this.coins == null) { + this.coins = new com_davidmaletz_mining_ui_Coins(this.player,c); + } + this.addDisplay(this.coins,3); + } + if(this.includeEquip()) { + if(this.equip == null) { + var a1 = this.player; + this.equip = new com_davidmaletz_mining_ui_PlayerButton(eqicon == null ? "equip.png" : null,function() { + com_davidmaletz_mining_ui_GUI.showEquipment(a1); + },"equipment",1,0.5); + var _g = this.equip; + _g.set_y(_g.get_y() - 18); + if(eqicon != null) { + var tile = com_davidmaletz_tiles_Tile.makeIcon(eqicon); + tile.set_x(15); + tile.set_y(20); + this.equip.addChild(tile); + } + } + this.addDisplay(this.equip,2); + } + if(this.includeQuests()) { + if(this.questlog == null) { + this.questlog = new com_davidmaletz_mining_ui__$GUI_QuestButton(this.player,"questlog.png",$bind(this,this.showQuestlog),"quest",0); + if(com_davidmaletz_mining_Main.TOUCHSCREEN) { + var _g1 = this.questlog; + _g1.set_x(_g1.get_x() - 18); + } + } + this.addDisplay(this.questlog,2); + } + if(com_davidmaletz_mining_Main.TOUCHSCREEN && this.includeOptions()) { + if(this.options == null) { + this.options = new com_davidmaletz_mining_ui_PlayerButton("options.png",($_=this.player,$bind($_,$_.onCancel)),"cancel",0,0.5); + } + this.addDisplay(this.options,2); + } + if(this.includeInventory()) { + if(this.inventory == null) { + var a11 = this.player; + var tmp = function() { + com_davidmaletz_mining_ui_GUI.showInventory(a11); + }; + this.inventory = new com_davidmaletz_mining_ui__$GUI_InventoryButton(this.player,tmp,"inventory",1); + } + this.addDisplay(this.inventory,2); + } + if(this.includeHotkeys()) { + var _g2 = 0; + while(_g2 < 8) { + var i = _g2++; + var h = this.hotkey[i]; + if(h == null) { + h = this.hotkey[i] = this.makeHotkey(i); + } + this.addDisplay(h,2); + } + if(this.player.locateNPC != null) { + com_davidmaletz_mining_ui_NPCLocator.locate(this.player,this.player.locateNPC,false); + } + } + if(com_davidmaletz_mining_Main.TOUCHSCREEN) { + var dpad = new openfl_display_Sprite(); + var left = new com_davidmaletz_mining_ui_ItemButton(this.player,"left",null,false,false); + left.set_x(0); + dpad.addChild(left); + var down = new com_davidmaletz_mining_ui_ItemButton(this.player,"down",null,false,false); + down.set_x(com_davidmaletz_tiles_Tile.SIZE); + dpad.addChild(down); + var up = new com_davidmaletz_mining_ui_ItemButton(this.player,"up",null,false,false); + up.set_x(com_davidmaletz_tiles_Tile.SIZE); + var _g3 = up; + _g3.set_y(_g3.get_y() - com_davidmaletz_tiles_Tile.SIZE); + dpad.addChild(up); + var right = new com_davidmaletz_mining_ui_ItemButton(this.player,"right",null,false,false); + right.set_x(com_davidmaletz_tiles_Tile.SIZE * 2); + dpad.addChild(right); + dpad.set_alpha(0.8); + this.addDisplay(dpad,2); + var select = new com_davidmaletz_mining_ui_ItemButton(this.player,"select",null,false,false); + var _g4 = select; + _g4.set_x(_g4.get_x() - com_davidmaletz_tiles_Tile.SIZE); + this.addDisplay(select,2); + } + if(this.includeMods()) { + if(this.mods == null) { + this.mods = new com_davidmaletz_mining_ui_Mods(this.player,c); + } + this.addDisplay(this.mods,2); + } + } + ,updateHotkeys: function() { + if(!this.includeHotkeys()) { + return; + } + var _g = 0; + var _g1 = this.hotkey; + while(_g < _g1.length) { + var h = _g1[_g]; + ++_g; + if(h != null) { + this.removeDisplay(h); + } + } + com_fancyfish_faeng_common_Utils.clear(this.hotkey); + var _g2 = 0; + while(_g2 < 8) { + var i = _g2++; + var h1 = this.hotkey[i] = this.makeHotkey(i); + this.addDisplay(h1,2); + } + } + ,makeHotkey: function(i) { + var f = $bind(this,this.useHotkey); + var i1 = i; + var tmp = function() { + f(i1); + }; + return new com_davidmaletz_mining_ui_Hotkey(this.player,i,tmp); + } + ,elements: null + ,addDisplay: function(s,layer,behind) { + if(behind == null) { + behind = false; + } + if(s != null) { + var e = new openfl_display_Sprite(); + e.addChild(s); + return this._addDisplay(e,layer,behind); + } else { + return null; + } + } + ,_addDisplay: function(e,layer,behind) { + if(behind == null) { + behind = false; + } + if(e != null) { + if(this.elements.indexOf(e) == -1) { + this.elements.push(e); + } + e.set_alpha(com_davidmaletz_mining_ui_GUI.FADE); + if(com_davidmaletz_mining_ui_GUI.instance == this) { + com_davidmaletz_mining_Main.getContainer().addDisplay(e,layer,behind); + } + return e; + } else { + return null; + } + } + ,removeDisplay: function(s) { + var e = s.parent; + HxOverrides.remove(this.elements,e); + com_davidmaletz_faengfl_FaengFL.remove(e); + } + ,destroy: function() { + com_davidmaletz_controls_Controller.instance.removeEventListener("tap",$bind(this,this.onKey)); + var _g = 0; + var _g1 = this.elements; + while(_g < _g1.length) { + var e = _g1[_g]; + ++_g; + if(e.parent != null) { + e.parent.removeChild(e); + } + } + com_fancyfish_faeng_common_Utils.clear(this.elements); + if(com_davidmaletz_mining_ui_GUI.instance == this) { + com_davidmaletz_mining_ui_GUI.instance = null; + } + } + ,showQuestlog: function() { + if(this.questlog != null) { + this.questlog.setQuests(0); + } + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_QuestLog(this.player,c),2); + } + ,useHotkey: function(i) { + this.player.useHotkey(i); + } + ,onKey: function(e) { + if(StringTools.startsWith(e.key,"hotkey") && this.includeHotkeys()) { + this.useHotkey(com_davidmaletz_mining_Main.parseInt(e.key.substring(6)) - 1); + } else { + var _g = e.key; + switch(_g) { + case "cancel": + if(this.includeOptions()) { + this.player.onCancel(); + com_davidmaletz_faengfl_adv_sound_Sound.play("cancel"); + } + break; + case "equipment": + if(this.includeEquip()) { + com_davidmaletz_mining_ui_GUI.showEquipment(this.player); + com_davidmaletz_faengfl_adv_sound_Sound.play("select"); + } + break; + case "inventory": + if(this.includeInventory()) { + com_davidmaletz_mining_ui_GUI.showInventory(this.player); + com_davidmaletz_faengfl_adv_sound_Sound.play("select"); + } + break; + case "quest": + if(this.includeQuests()) { + this.showQuestlog(); + com_davidmaletz_faengfl_adv_sound_Sound.play("select"); + } + break; + } + } + } + ,rotateBars: function(bars) { + bars.set_rotation(90); + bars.set_x(128. + com_davidmaletz_tiles_Tile.SIZE); + bars.set_y(90); + } + ,include: function(id) { + return true; + } + ,includeCoins: function() { + return this.include("coins"); + } + ,includeEquip: function() { + return this.include("equip"); + } + ,includeQuests: function() { + return this.include("quests"); + } + ,includeOptions: function() { + return this.include("options"); + } + ,includeInventory: function() { + return this.include("inventory"); + } + ,includeHotkeys: function() { + return this.include("hotkeys"); + } + ,includeMods: function() { + return this.include("mods"); + } + ,__class__: com_davidmaletz_mining_ui_GUI +}; +var com_davidmaletz_mining_ui_PlayerButton = function(icon,release,key,yalign,scale,press) { + if(scale == null) { + scale = 1; + } + com_davidmaletz_faengfl_Button.call(this,press,release,icon == null ? null : new com_davidmaletz_faengfl_BitmapDrawable(openfl_Assets.getBitmapData("data/ui/" + icon))); + var sz = 32 * scale; + var c = com_davidmaletz_mining_Main.getContainer(); + this.set_x(c.getWidth() - sz); + this.set_y(Math.round((c.getHeight() - sz) * yalign)); + this.set_scaleX(this.set_scaleY(scale)); + if(this.get_numChildren() > 0) { + var s = this.getChildAt(0); + s.set_x(15); + s.set_y(yalign == 0 ? 1 : 15); + } + this._width = 32; + this._height = 32; + if(key != null) { + this.keyButton = new com_davidmaletz_controls_KeyRenderer(key,16,16); + this.addChildAt(this.keyButton,0); + } + this.set_alpha(0.75); +}; +$hxClasses["com.davidmaletz.mining.ui.PlayerButton"] = com_davidmaletz_mining_ui_PlayerButton; +com_davidmaletz_mining_ui_PlayerButton.__name__ = ["com","davidmaletz","mining","ui","PlayerButton"]; +com_davidmaletz_mining_ui_PlayerButton.__super__ = com_davidmaletz_faengfl_Button; +com_davidmaletz_mining_ui_PlayerButton.prototype = $extend(com_davidmaletz_faengfl_Button.prototype,{ + keyButton: null + ,init: function(e) { + com_davidmaletz_faengfl_Button.prototype.init.call(this,e); + com_davidmaletz_faengfl_TouchAdapter.instance.addEventListener("touch_move",$bind(this,this.mouse_move),false,com_davidmaletz_faengfl_Window.window_ct + 1); + } + ,destroy: function(e) { + com_davidmaletz_faengfl_Button.prototype.destroy.call(this,e); + com_davidmaletz_faengfl_TouchAdapter.instance.removeEventListener("touch_move",$bind(this,this.mouse_move)); + } + ,mouse_up: function(e) { + if(e.id == this.touch) { + this.set_alpha(0.75); + com_davidmaletz_faengfl_Button.prototype.mouse_up.call(this,e); + } + } + ,mouse_move: function(e) { + if(this.inBounds(e)) { + this.set_alpha(1); + } else { + this.set_alpha(0.75); + } + } + ,__class__: com_davidmaletz_mining_ui_PlayerButton +}); +var com_davidmaletz_mining_ui__$GUI_InventoryButton = function(p,onClick,key,yalign) { + this.flashing = 0; + com_davidmaletz_mining_ui_PlayerButton.call(this,null,onClick,key,yalign,0.5); + this.player = p; + this.tile = new com_davidmaletz_tiles_render_TileAnimationRenderer(com_davidmaletz_tiles_Tile.get("inventory.bag"),1); + this.tile.set_x(15); + this.tile.set_y(yalign == 1 ? 15 : 1); + this.tile.setAnimation("inventory.bag"); + this.addChild(this.tile); + this.progress = new com_davidmaletz_controls_ProgressBar(50,4,com_davidmaletz_mining_Main.PROGRESS_COL,this.getPercent(),false); + this.progress.set_x(28); + this.progress.set_y(32); + this.progress.set_rotation(-90); + this.addChild(this.progress); + var _g = this.getChildAt(1); + _g.set_x(_g.get_x() - 1); + this.vehicle = this.player.vehicle; +}; +$hxClasses["com.davidmaletz.mining.ui._GUI.InventoryButton"] = com_davidmaletz_mining_ui__$GUI_InventoryButton; +com_davidmaletz_mining_ui__$GUI_InventoryButton.__name__ = ["com","davidmaletz","mining","ui","_GUI","InventoryButton"]; +com_davidmaletz_mining_ui__$GUI_InventoryButton.__super__ = com_davidmaletz_mining_ui_PlayerButton; +com_davidmaletz_mining_ui__$GUI_InventoryButton.prototype = $extend(com_davidmaletz_mining_ui_PlayerButton.prototype,{ + player: null + ,progress: null + ,flashing: null + ,tile: null + ,vehicle: null + ,init: function(e) { + com_davidmaletz_mining_ui_PlayerButton.prototype.init.call(this,e); + this.player.inventory.addEventListener("item_added",$bind(this,this.update_percent)); + this.player.capacity.addEventListener("updated",$bind(this,this.update_percent)); + this.update_percent(null); + if(this.vehicle != null) { + this.vehicle.inventory.addEventListener("item_added",$bind(this,this.update_percent)); + } + } + ,destroy: function(e) { + com_davidmaletz_mining_ui_PlayerButton.prototype.destroy.call(this,e); + this.player.inventory.removeEventListener("item_added",$bind(this,this.update_percent)); + this.player.capacity.removeEventListener("updated",$bind(this,this.update_percent)); + if(this.vehicle != null) { + this.vehicle.inventory.removeEventListener("item_added",$bind(this,this.update_percent)); + } + } + ,getPercent: function() { + var p; + if(this.player.vehicle == null || this.player.vehicle.isDrone()) { + p = this.player.inventory.getWeight() / this.player.capacity.get(); + } else { + var max = this.player.vehicle.getInfo().max_weight.get(); + if(max == 0) { + p = 0; + } else { + p = this.player.vehicle.getWeight() / max; + } + } + if(p > 1) { + p = 1; + if(this.flashing <= 0) { + this.flashing = 30; + this.player.updateWeight(); + } + } else if(this.flashing > 0) { + this.flashing = 0; + this.player.updateWeight(); + } + return p; + } + ,update_percent: function(e) { + this.progress.setProgress(this.getPercent(),5); + this.tile.setFrame(this.getPercent() * this.tile.getMaxFrame()); + } + ,handle_frame: function(e) { + com_davidmaletz_mining_ui_PlayerButton.prototype.handle_frame.call(this,e); + if(this.flashing > 0) { + this.flashing -= com_davidmaletz_faengfl_FaengFL.frameTime; + if(this.flashing <= 0) { + this.flashing = 30; + var c = this.progress.get_transform().get_colorTransform(); + c.greenMultiplier = c.blueMultiplier = c.greenMultiplier == 1 ? 0.3 : 1; + this.progress.get_transform().set_colorTransform(c); + } + } else { + var c1 = this.progress.get_transform().get_colorTransform(); + c1.greenMultiplier = c1.blueMultiplier = 1; + this.progress.get_transform().set_colorTransform(c1); + } + } + ,__class__: com_davidmaletz_mining_ui__$GUI_InventoryButton +}); +var com_davidmaletz_mining_ui__$GUI_QuestButton = function(p,icon,onClick,key,yalign) { + com_davidmaletz_mining_ui_PlayerButton.call(this,icon,onClick,key,yalign,0.5); + this.player = p; + this.unread_quests = 0; + this.indicator = new com_davidmaletz_lerp_LerpSprite(); + var g = this.indicator.get_graphics(); + g.beginFill(7798784); + g.drawRect(0,0,10,10); + g.endFill(); + this.mutable = new com_fancyfish_faeng_common_mutable_Mutable(); + this.mutable.set(""); + this.indicator.addChild(new com_davidmaletz_faengfl_TextSprite(this.mutable,new com_fancyfish_faeng_text_CharacterPlacer(10,1),16777215,1)); + this.indicator.set_x(22); + this.indicator.set_y(22); + this.indicator.set_visible(false); + this.indicator.set_alpha(0); + this.addChild(this.indicator); +}; +$hxClasses["com.davidmaletz.mining.ui._GUI.QuestButton"] = com_davidmaletz_mining_ui__$GUI_QuestButton; +com_davidmaletz_mining_ui__$GUI_QuestButton.__name__ = ["com","davidmaletz","mining","ui","_GUI","QuestButton"]; +com_davidmaletz_mining_ui__$GUI_QuestButton.__super__ = com_davidmaletz_mining_ui_PlayerButton; +com_davidmaletz_mining_ui__$GUI_QuestButton.prototype = $extend(com_davidmaletz_mining_ui_PlayerButton.prototype,{ + player: null + ,unread_quests: null + ,indicator: null + ,mutable: null + ,init: function(e) { + com_davidmaletz_mining_ui_PlayerButton.prototype.init.call(this,e); + this.player.state.addEventListener("add_quest",$bind(this,this.add_quest)); + } + ,destroy: function(e) { + com_davidmaletz_mining_ui_PlayerButton.prototype.destroy.call(this,e); + this.player.state.removeEventListener("add_quest",$bind(this,this.add_quest)); + } + ,add_quest: function(e) { + if(e.value != null) { + this.setQuests(this.unread_quests + 1); + } + } + ,setQuests: function(q) { + if(this.unread_quests == q) { + return; + } + this.unread_quests = q; + if(this.indicator.get_visible()) { + this.indicator.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),20,$bind(this,this.update)); + } else if(this.unread_quests > 0) { + this.indicator.set_visible(true); + this.indicator.set_alpha(0); + this.update(); + } + } + ,update: function() { + if(this.unread_quests > 0) { + this.mutable.set(Std.string(this.unread_quests)); + this.indicator.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),20); + } else { + this.indicator.set_visible(false); + } + } + ,__class__: com_davidmaletz_mining_ui__$GUI_QuestButton +}); +var com_davidmaletz_mining_ui_ItemButton = function(p,key,onClick,showCount,snd) { + if(snd == null) { + snd = true; + } + if(showCount == null) { + showCount = true; + } + var onRelease = null; + this.sfx = snd; + if(key != null) { + var code = com_davidmaletz_controls_Controller.instance.getKeyCode(key); + if(code != -1) { + ++code; + } + if(onClick == null) { + var f = $bind(this,this.doClick); + var a1 = key; + var a2 = code; + onClick = function() { + f(a1,a2); + }; + if(code != -1) { + var f1 = ($_=com_davidmaletz_controls_Controller.instance,$bind($_,$_.press)); + var a11 = key; + var a21 = code; + this.onPress = function() { + f1(a11,a21); + }; + } + } + } + com_davidmaletz_mining_ui_PlayerButton.call(this,null,onClick,key,1,0.5,this.onPress); + this.player = p; + this.icon = new openfl_display_Sprite(); + this.icon.set_x(16); + this.icon.set_y(22); + this.addChild(this.icon); + if(showCount) { + this.count = new com_fancyfish_faeng_common_mutable_Mutable(); + this.count.set(""); + var t = new com_davidmaletz_faengfl_TextSprite(this.count,new com_fancyfish_faeng_text_CharacterPlacer(0),16777215,1); + t.set_x(34); + t.set_y(22); + this.addChild(t); + this.darken = new openfl_display_Sprite(); + var g = this.darken.get_graphics(); + g.beginFill(0,0.7); + g.drawRect(16,0,15,10); + g.endFill(); + this.darken.set_x(this.icon.get_x()); + this.darken.set_y(this.icon.get_y()); + this.addChildAt(this.darken,0); + this.set_visible(false); + } +}; +$hxClasses["com.davidmaletz.mining.ui.ItemButton"] = com_davidmaletz_mining_ui_ItemButton; +com_davidmaletz_mining_ui_ItemButton.__name__ = ["com","davidmaletz","mining","ui","ItemButton"]; +com_davidmaletz_mining_ui_ItemButton.__super__ = com_davidmaletz_mining_ui_PlayerButton; +com_davidmaletz_mining_ui_ItemButton.prototype = $extend(com_davidmaletz_mining_ui_PlayerButton.prototype,{ + player: null + ,icon: null + ,item: null + ,count: null + ,sfx: null + ,darken: null + ,doClick: function(key,code) { + com_davidmaletz_controls_Controller.instance.release(key,code); + } + ,init: function(e) { + com_davidmaletz_mining_ui_PlayerButton.prototype.init.call(this,e); + if(this.count != null) { + this.player.inventory.addEventListener("item_added",$bind(this,this.add_item)); + if(this.item != null) { + this.count.set(com_fancyfish_faeng_common_Utils.largeNumberFormat(this.player.inventory.getItemNameCount(this.item.info,this.item.getNameStr()))); + } + } + com_davidmaletz_faengfl_Window.dispatcher.addEventListener("add_window",$bind(this,this._release)); + } + ,_release: function(e) { + if(this.onPress != null && this.keyButton != null) { + this.onRelease(); + } + } + ,destroy: function(e) { + com_davidmaletz_mining_ui_PlayerButton.prototype.destroy.call(this,e); + if(this.count != null) { + this.player.inventory.removeEventListener("item_added",$bind(this,this.add_item)); + } + com_davidmaletz_faengfl_Window.dispatcher.removeEventListener("add_window",$bind(this,this._release)); + if(e != null) { + this._release(e); + } + } + ,setItem: function(i,force) { + if(force == null) { + force = false; + } + if(i == this.item && !force) { + return; + } + this.item = i; + if(this.count != null) { + if(this.item == null) { + this.set_visible(false); + return; + } else { + this.set_visible(true); + } + this.count.set(com_fancyfish_faeng_common_Utils.largeNumberFormat(this.player.inventory.getItemNameCount(this.item.info,this.item.getNameStr()))); + } + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this.icon); + if(this.item != null) { + this.icon.addChild(this.item.createIcon()); + } + } + ,setIcon: function(t,anim) { + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this.icon); + if(t != null) { + if(anim == null) { + this.icon.addChild(com_davidmaletz_tiles_Tile.makeIcon(t)); + } else { + this.icon.addChild(new com_davidmaletz_tiles_render_StaticPlayAnimation(t,anim,10,true)); + } + } + } + ,add_item: function(e) { + if(this.item != null && e.item == this.item.info) { + this.count.set(com_fancyfish_faeng_common_Utils.largeNumberFormat(this.player.inventory.getItemNameCount(this.item.info,this.item.getNameStr()))); + } + } + ,action: function() { + if(this.get_visible()) { + if(this.sfx && com_davidmaletz_faengfl_Button.globalOnRelease != null) { + com_davidmaletz_faengfl_Button.globalOnRelease(); + } + if(this.onRelease != null) { + this.onRelease(); + } + } + } + ,__class__: com_davidmaletz_mining_ui_ItemButton +}); +var com_davidmaletz_mining_ui_IconButton = function(p,key,icon,anim,onClick,snd) { + if(snd == null) { + snd = true; + } + var onRelease = null; + this.sfx = snd; + if(key != null) { + var code = com_davidmaletz_controls_Controller.instance.getKeyCode(key); + if(code != -1) { + ++code; + } + if(onClick == null) { + var f = $bind(this,this.doClick); + var a1 = key; + var a2 = code; + onClick = function() { + f(a1,a2); + }; + if(code != -1) { + var f1 = ($_=com_davidmaletz_controls_Controller.instance,$bind($_,$_.press)); + var a11 = key; + var a21 = code; + this.onPress = function() { + f1(a11,a21); + }; + } + } + } + com_davidmaletz_mining_ui_PlayerButton.call(this,null,onClick,key,1,0.5,this.onPress); + var t = com_davidmaletz_tiles_Tile.get(icon); + if(t != null) { + var s = new openfl_display_Sprite(); + s.set_x(16); + s.set_y(22); + if(anim == null) { + s.addChild(com_davidmaletz_tiles_Tile.makeIcon(t)); + } else { + s.addChild(new com_davidmaletz_tiles_render_StaticPlayAnimation(t,anim,10,true)); + } + this.addChild(s); + } +}; +$hxClasses["com.davidmaletz.mining.ui.IconButton"] = com_davidmaletz_mining_ui_IconButton; +com_davidmaletz_mining_ui_IconButton.__name__ = ["com","davidmaletz","mining","ui","IconButton"]; +com_davidmaletz_mining_ui_IconButton.__super__ = com_davidmaletz_mining_ui_PlayerButton; +com_davidmaletz_mining_ui_IconButton.prototype = $extend(com_davidmaletz_mining_ui_PlayerButton.prototype,{ + sfx: null + ,doClick: function(key,code) { + com_davidmaletz_controls_Controller.instance.release(key,code); + } + ,__class__: com_davidmaletz_mining_ui_IconButton +}); +var com_davidmaletz_mining_ui_EquipmentButton = function(p,slot,key,x,eq) { + com_davidmaletz_mining_ui_ItemButton.call(this,p,key,key == null ? $bind(this,this.selectEquip) : null,false); + this._key = key; + this.slot = slot; + this.equippable = eq == null ? p : eq; + if(x >= 4) { + this.set_x(240); + this.set_y(84 - 16 * (x - 4)); + } else { + var v = com_davidmaletz_mining_Main.TOUCHSCREEN ? x : 4 + x; + this.set_x(240 - v * 22); + if(com_davidmaletz_mining_Main.TOUCHSCREEN) { + var _g = this; + _g.set_x(_g.get_x() - com_davidmaletz_tiles_Tile.SIZE); + } + } +}; +$hxClasses["com.davidmaletz.mining.ui.EquipmentButton"] = com_davidmaletz_mining_ui_EquipmentButton; +com_davidmaletz_mining_ui_EquipmentButton.__name__ = ["com","davidmaletz","mining","ui","EquipmentButton"]; +com_davidmaletz_mining_ui_EquipmentButton.__super__ = com_davidmaletz_mining_ui_ItemButton; +com_davidmaletz_mining_ui_EquipmentButton.prototype = $extend(com_davidmaletz_mining_ui_ItemButton.prototype,{ + slot: null + ,_key: null + ,equippable: null + ,selectEquip: function() { + if(this.slot != null) { + var i = this.equippable.getEquipment().getItem(this.slot); + if(i == null) { + return; + } + if(Std["is"](i.info,com_davidmaletz_mining_item_Equipment)) { + var e = js_Boot.__cast(i.info , com_davidmaletz_mining_item_Equipment); + if(e.abilities != null && e.abilities.length > 0) { + e.abilities[0].run(this.player,this.player.vehicle); + return; + } + } + com_davidmaletz_mining_ui_EquipmentWindow.firstAction(this.equippable,this.slot); + } + } + ,_release: function(e) { + if(this.onPress != null && this.keyButton != null) { + var code = com_davidmaletz_controls_Controller.instance.getKeyCode(this._key); + if(code != -1) { + ++code; + } + com_davidmaletz_mining_ui_ItemButton.prototype.doClick.call(this,this._key,code); + } + } + ,doClick: function(key,code) { + if(!this.keyButton.get_visible()) { + this.selectEquip(); + } else { + com_davidmaletz_mining_ui_ItemButton.prototype.doClick.call(this,key,code); + } + } + ,init: function(e) { + com_davidmaletz_mining_ui_ItemButton.prototype.init.call(this,e); + var eq = this.equippable.getEquipment(); + var s = eq.get(this.slot); + if(s != null) { + eq.getUsed(this.slot).addEventListener("updated",$bind(this,this.equip_changed)); + s.addEventListener("updated",$bind(this,this.equip_changed)); + this.equip_changed(null); + } + } + ,destroy: function(e) { + com_davidmaletz_mining_ui_ItemButton.prototype.destroy.call(this,e); + var eq = this.equippable.getEquipment(); + var s = eq.get(this.slot); + if(s != null) { + eq.getUsed(this.slot).removeEventListener("updated",$bind(this,this.equip_changed)); + s.removeEventListener("updated",$bind(this,this.equip_changed)); + } + } + ,equip_changed: function(e) { + var eq = this.equippable.getEquipment(); + var i; + if(this.keyButton != null) { + i = eq.getItemUsed(this.slot); + var v = this.slot != "shield" && this.slot != "defend" || i == null || i.info.xml.exists("use"); + this.keyButton.set_visible(v); + if(!v) { + i = eq.getItem(this.slot); + } + } else { + i = eq.getItem(this.slot); + } + this.setItem(i); + this.set_visible(this.item != null); + } + ,__class__: com_davidmaletz_mining_ui_EquipmentButton +}); +var com_davidmaletz_mining_ui_Hotkey = function(p,key,onClick,showCount) { + if(showCount == null) { + showCount = true; + } + if(onClick == null) { + var f = $bind(p,p.useHotkey); + var i = key; + onClick = function() { + f(i); + }; + } + com_davidmaletz_mining_ui_ItemButton.call(this,p,"hotkey" + (key + 1),onClick,showCount); + this.hotkey = key; + this.set_x(240 + (key % 4 - 4) * 22); + if(key >= 4) { + var _g = this; + _g.set_y(_g.get_y() - 16); + } + if(com_davidmaletz_mining_Main.TOUCHSCREEN) { + var _g1 = this; + _g1.set_x(_g1.get_x() - (com_davidmaletz_tiles_Tile.SIZE + 66)); + } +}; +$hxClasses["com.davidmaletz.mining.ui.Hotkey"] = com_davidmaletz_mining_ui_Hotkey; +com_davidmaletz_mining_ui_Hotkey.__name__ = ["com","davidmaletz","mining","ui","Hotkey"]; +com_davidmaletz_mining_ui_Hotkey.__super__ = com_davidmaletz_mining_ui_ItemButton; +com_davidmaletz_mining_ui_Hotkey.prototype = $extend(com_davidmaletz_mining_ui_ItemButton.prototype,{ + hotkey: null + ,init: function(e) { + com_davidmaletz_mining_ui_ItemButton.prototype.init.call(this,e); + this.player.addEventListener("hotkey_changed",$bind(this,this.hotkey_changed)); + this.hotkey_changed(null); + } + ,destroy: function(e) { + com_davidmaletz_mining_ui_ItemButton.prototype.destroy.call(this,e); + this.player.removeEventListener("hotkey_changed",$bind(this,this.hotkey_changed)); + } + ,hotkey_changed: function(e) { + if(e == null || e.value == this.hotkey) { + var ar = this.player.getHotkey(this.hotkey); + if(ar == null || ar.length == 0) { + this.setItem(null,true); + } else if(ar.length == 1) { + if(this.darken != null) { + this.darken.set_visible(true); + } + this.setItem(ar[0]); + } else { + this.item = null; + this.set_visible(true); + if(this.count != null) { + this.count.set(""); + } + if(this.darken != null) { + this.darken.set_visible(false); + } + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this.icon); + var x = 12.0; + var y = 0; + var _g = 0; + while(_g < ar.length) { + var i = ar[_g]; + ++_g; + var s = i.createIcon(); + s.set_x(x); + s.set_y(x == 12 ? y : 0); + if(x == 12) { + this.icon.addChildAt(s,0); + } else { + this.icon.addChild(s); + } + if(y > -18) { + y -= 6; + } else { + x -= com_davidmaletz_tiles_Tile.SIZE * 0.75; + } + } + } + } + } + ,__class__: com_davidmaletz_mining_ui_Hotkey +}); +var com_davidmaletz_mining_ui_GameOver = function(p) { + com_davidmaletz_controls_ClickableSprite.call(this); + var w = 83; + this.set_x(Math.round((256 - (com_davidmaletz_mining_ui_GameOver.ITEMS.length * w - 3)) * 0.5)); + this.set_y(144 - com_davidmaletz_mining_ui_TextButton.getHeight() - 2); + this.player = p; + var b = new openfl_display_Bitmap(openfl_Assets.getBitmapData("data/ui/game_over.png")); + b.set_x(-this.get_x()); + b.set_y(-this.get_y()); + this.addChild(b); + var ct = 0; + var _g = 0; + var _g1 = com_davidmaletz_mining_ui_GameOver.ITEMS; + while(_g < _g1.length) { + var i = _g1[_g]; + ++_g; + this.addClickable(new com_davidmaletz_mining_ui_TextButton(ct * w,0,com_fancyfish_faeng_common_Lang.getText("common",i),(function(a1,f) { + return function() { + f[0](a1[0]); + }; + })([i],[$bind(this,this.onSelect)]),80)); + ++ct; + } +}; +$hxClasses["com.davidmaletz.mining.ui.GameOver"] = com_davidmaletz_mining_ui_GameOver; +com_davidmaletz_mining_ui_GameOver.__name__ = ["com","davidmaletz","mining","ui","GameOver"]; +com_davidmaletz_mining_ui_GameOver.__super__ = com_davidmaletz_controls_ClickableSprite; +com_davidmaletz_mining_ui_GameOver.prototype = $extend(com_davidmaletz_controls_ClickableSprite.prototype,{ + player: null + ,loadAndHeal: function() { + var p = com_davidmaletz_mining_Main.loadLastSave(this.player); + if(p != null) { + p.fullRestore(); + } + } + ,onSelect: function(str) { + switch(str) { + case "retry": + new com_davidmaletz_faengfl_transition_FadeOut($bind(this,this.loadAndHeal),60); + break; + case "title": + new com_davidmaletz_faengfl_transition_FadeOut(com_davidmaletz_mining_Main.titleScreen,60); + break; + } + } + ,init: function(e) { + com_davidmaletz_controls_ClickableSprite.prototype.init.call(this,e); + com_davidmaletz_faengfl_Window.window_ct += 4; + } + ,destroy: function(e) { + com_davidmaletz_controls_ClickableSprite.prototype.destroy.call(this,e); + com_davidmaletz_faengfl_Window.window_ct -= 2; + } + ,__class__: com_davidmaletz_mining_ui_GameOver +}); +var com_davidmaletz_mining_ui_FloatValue = function(id) { + this.id = id; +}; +$hxClasses["com.davidmaletz.mining.ui.FloatValue"] = com_davidmaletz_mining_ui_FloatValue; +com_davidmaletz_mining_ui_FloatValue.__name__ = ["com","davidmaletz","mining","ui","FloatValue"]; +com_davidmaletz_mining_ui_FloatValue.__interfaces__ = [AbstractClass]; +com_davidmaletz_mining_ui_FloatValue.prototype = { + id: null + ,getValue: function() { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,setValue: function(val) { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,getIcon: function() { + return null; + } + ,getLabel: function() { + return com_fancyfish_faeng_common_Lang.getText("options",this.id); + } + ,updateSettings: function() { + } + ,__class__: com_davidmaletz_mining_ui_FloatValue +}; +var com_davidmaletz_mining_ui__$GameplayOptions_Overweight = function() { + com_davidmaletz_mining_ui_FloatValue.call(this,"max_overweight"); +}; +$hxClasses["com.davidmaletz.mining.ui._GameplayOptions.Overweight"] = com_davidmaletz_mining_ui__$GameplayOptions_Overweight; +com_davidmaletz_mining_ui__$GameplayOptions_Overweight.__name__ = ["com","davidmaletz","mining","ui","_GameplayOptions","Overweight"]; +com_davidmaletz_mining_ui__$GameplayOptions_Overweight.__super__ = com_davidmaletz_mining_ui_FloatValue; +com_davidmaletz_mining_ui__$GameplayOptions_Overweight.prototype = $extend(com_davidmaletz_mining_ui_FloatValue.prototype,{ + getValue: function() { + return com_davidmaletz_mining_renderer_PlayerRenderer.max_overweight / 2000; + } + ,setValue: function(val) { + com_davidmaletz_mining_renderer_PlayerRenderer.max_overweight = Math.floor(val * 2000); + Reflect.setField(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"max_overweight",com_davidmaletz_mining_renderer_PlayerRenderer.max_overweight); + } + ,__class__: com_davidmaletz_mining_ui__$GameplayOptions_Overweight +}); +var com_davidmaletz_mining_ui_BoolValue = function(id) { + this.id = id; +}; +$hxClasses["com.davidmaletz.mining.ui.BoolValue"] = com_davidmaletz_mining_ui_BoolValue; +com_davidmaletz_mining_ui_BoolValue.__name__ = ["com","davidmaletz","mining","ui","BoolValue"]; +com_davidmaletz_mining_ui_BoolValue.__interfaces__ = [AbstractClass]; +com_davidmaletz_mining_ui_BoolValue.prototype = { + id: null + ,getValue: function() { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,setValue: function(val) { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,getLabel: function() { + return com_fancyfish_faeng_common_Lang.getText("options",this.id); + } + ,updateSettings: function() { + } + ,__class__: com_davidmaletz_mining_ui_BoolValue +}; +var com_davidmaletz_mining_ui__$GameplayOptions_AutoHeal = function() { + com_davidmaletz_mining_ui_BoolValue.call(this,"auto_heal"); +}; +$hxClasses["com.davidmaletz.mining.ui._GameplayOptions.AutoHeal"] = com_davidmaletz_mining_ui__$GameplayOptions_AutoHeal; +com_davidmaletz_mining_ui__$GameplayOptions_AutoHeal.__name__ = ["com","davidmaletz","mining","ui","_GameplayOptions","AutoHeal"]; +com_davidmaletz_mining_ui__$GameplayOptions_AutoHeal.__super__ = com_davidmaletz_mining_ui_BoolValue; +com_davidmaletz_mining_ui__$GameplayOptions_AutoHeal.prototype = $extend(com_davidmaletz_mining_ui_BoolValue.prototype,{ + getValue: function() { + return com_davidmaletz_mining_Player.AUTO_HEAL; + } + ,setValue: function(val) { + com_davidmaletz_mining_Player.AUTO_HEAL = val; + Reflect.setField(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"auto_heal",val); + } + ,__class__: com_davidmaletz_mining_ui__$GameplayOptions_AutoHeal +}); +var com_davidmaletz_mining_ui__$GameplayOptions_AutoStamina = function() { + com_davidmaletz_mining_ui_BoolValue.call(this,"auto_stamina"); +}; +$hxClasses["com.davidmaletz.mining.ui._GameplayOptions.AutoStamina"] = com_davidmaletz_mining_ui__$GameplayOptions_AutoStamina; +com_davidmaletz_mining_ui__$GameplayOptions_AutoStamina.__name__ = ["com","davidmaletz","mining","ui","_GameplayOptions","AutoStamina"]; +com_davidmaletz_mining_ui__$GameplayOptions_AutoStamina.__super__ = com_davidmaletz_mining_ui_BoolValue; +com_davidmaletz_mining_ui__$GameplayOptions_AutoStamina.prototype = $extend(com_davidmaletz_mining_ui_BoolValue.prototype,{ + getValue: function() { + return com_davidmaletz_mining_Player.AUTO_STAMINA; + } + ,setValue: function(val) { + com_davidmaletz_mining_Player.AUTO_STAMINA = val; + Reflect.setField(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"auto_stamina",val); + } + ,__class__: com_davidmaletz_mining_ui__$GameplayOptions_AutoStamina +}); +var com_davidmaletz_mining_ui_AutoCollect = function() { + com_davidmaletz_mining_ui_OptionValue.call(this,"auto_collect"); +}; +$hxClasses["com.davidmaletz.mining.ui.AutoCollect"] = com_davidmaletz_mining_ui_AutoCollect; +com_davidmaletz_mining_ui_AutoCollect.__name__ = ["com","davidmaletz","mining","ui","AutoCollect"]; +com_davidmaletz_mining_ui_AutoCollect.__super__ = com_davidmaletz_mining_ui_OptionValue; +com_davidmaletz_mining_ui_AutoCollect.prototype = $extend(com_davidmaletz_mining_ui_OptionValue.prototype,{ + getOption: function() { + return com_davidmaletz_mining_Player.AUTO_COLLECT; + } + ,setOption: function(val) { + if(val < -1) { + val = 1; + } else if(val > 1) { + val = -1; + } + com_davidmaletz_mining_Player.setAutoCollect(val); + } + ,optionToString: function(o) { + switch(o) { + case -1: + return com_fancyfish_faeng_common_Lang.getText("common","no"); + case 0: + return com_fancyfish_faeng_common_Lang.getText("entry","default"); + case 1: + return com_fancyfish_faeng_common_Lang.getText("common","yes"); + default: + return null; + } + } + ,__class__: com_davidmaletz_mining_ui_AutoCollect +}); +var com_davidmaletz_mining_ui_BlueprintPlace = function() { + com_davidmaletz_mining_ui_BoolValue.call(this,"blueprint_place"); +}; +$hxClasses["com.davidmaletz.mining.ui.BlueprintPlace"] = com_davidmaletz_mining_ui_BlueprintPlace; +com_davidmaletz_mining_ui_BlueprintPlace.__name__ = ["com","davidmaletz","mining","ui","BlueprintPlace"]; +com_davidmaletz_mining_ui_BlueprintPlace.__super__ = com_davidmaletz_mining_ui_BoolValue; +com_davidmaletz_mining_ui_BlueprintPlace.prototype = $extend(com_davidmaletz_mining_ui_BoolValue.prototype,{ + getValue: function() { + return com_davidmaletz_mining_Player.BLUEPRINT_PLACE; + } + ,setValue: function(val) { + com_davidmaletz_mining_Player.setBlueprintPlace(val); + } + ,__class__: com_davidmaletz_mining_ui_BlueprintPlace +}); +var com_davidmaletz_mining_ui_TalkQuest = function() { + com_davidmaletz_mining_ui_BoolValue.call(this,"talk_quest"); +}; +$hxClasses["com.davidmaletz.mining.ui.TalkQuest"] = com_davidmaletz_mining_ui_TalkQuest; +com_davidmaletz_mining_ui_TalkQuest.__name__ = ["com","davidmaletz","mining","ui","TalkQuest"]; +com_davidmaletz_mining_ui_TalkQuest.__super__ = com_davidmaletz_mining_ui_BoolValue; +com_davidmaletz_mining_ui_TalkQuest.prototype = $extend(com_davidmaletz_mining_ui_BoolValue.prototype,{ + getValue: function() { + return com_davidmaletz_mining_Player.TALK_QUEST; + } + ,setValue: function(val) { + com_davidmaletz_mining_Player.setTalkQuest(val); + } + ,__class__: com_davidmaletz_mining_ui_TalkQuest +}); +var com_davidmaletz_mining_ui__$GameplayOptions_MineWalkways = function() { + com_davidmaletz_mining_ui_BoolValue.call(this,"mine_walkways"); +}; +$hxClasses["com.davidmaletz.mining.ui._GameplayOptions.MineWalkways"] = com_davidmaletz_mining_ui__$GameplayOptions_MineWalkways; +com_davidmaletz_mining_ui__$GameplayOptions_MineWalkways.__name__ = ["com","davidmaletz","mining","ui","_GameplayOptions","MineWalkways"]; +com_davidmaletz_mining_ui__$GameplayOptions_MineWalkways.__super__ = com_davidmaletz_mining_ui_BoolValue; +com_davidmaletz_mining_ui__$GameplayOptions_MineWalkways.prototype = $extend(com_davidmaletz_mining_ui_BoolValue.prototype,{ + getValue: function() { + return com_davidmaletz_mining_world_Area.MINE_WALKWAYS; + } + ,setValue: function(val) { + com_davidmaletz_mining_world_Area.MINE_WALKWAYS = val; + Reflect.setField(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"mine_walkways",val); + } + ,__class__: com_davidmaletz_mining_ui__$GameplayOptions_MineWalkways +}); +var com_davidmaletz_mining_ui_HotkeySwitch = function() { + com_davidmaletz_mining_ui_BoolValue.call(this,"hotkey_switch"); +}; +$hxClasses["com.davidmaletz.mining.ui.HotkeySwitch"] = com_davidmaletz_mining_ui_HotkeySwitch; +com_davidmaletz_mining_ui_HotkeySwitch.__name__ = ["com","davidmaletz","mining","ui","HotkeySwitch"]; +com_davidmaletz_mining_ui_HotkeySwitch.__super__ = com_davidmaletz_mining_ui_BoolValue; +com_davidmaletz_mining_ui_HotkeySwitch.prototype = $extend(com_davidmaletz_mining_ui_BoolValue.prototype,{ + getValue: function() { + return com_davidmaletz_mining_Player.HOTKEY_SWITCH; + } + ,setValue: function(val) { + com_davidmaletz_mining_Player.setHotkeySwitch(val); + } + ,__class__: com_davidmaletz_mining_ui_HotkeySwitch +}); +var com_davidmaletz_mining_ui_StorehousePriority = function() { + com_davidmaletz_mining_ui_BoolValue.call(this,"storehouse_priority"); +}; +$hxClasses["com.davidmaletz.mining.ui.StorehousePriority"] = com_davidmaletz_mining_ui_StorehousePriority; +com_davidmaletz_mining_ui_StorehousePriority.__name__ = ["com","davidmaletz","mining","ui","StorehousePriority"]; +com_davidmaletz_mining_ui_StorehousePriority.__super__ = com_davidmaletz_mining_ui_BoolValue; +com_davidmaletz_mining_ui_StorehousePriority.prototype = $extend(com_davidmaletz_mining_ui_BoolValue.prototype,{ + getValue: function() { + return com_davidmaletz_mining_Player.STOREHOUSE_PRIORITY; + } + ,setValue: function(val) { + com_davidmaletz_mining_Player.setStorehousePriority(val); + } + ,__class__: com_davidmaletz_mining_ui_StorehousePriority +}); +var com_davidmaletz_mining_ui__$GameplayOptions_AllowFlash = function() { + com_davidmaletz_mining_ui_BoolValue.call(this,"allow_flash"); +}; +$hxClasses["com.davidmaletz.mining.ui._GameplayOptions.AllowFlash"] = com_davidmaletz_mining_ui__$GameplayOptions_AllowFlash; +com_davidmaletz_mining_ui__$GameplayOptions_AllowFlash.__name__ = ["com","davidmaletz","mining","ui","_GameplayOptions","AllowFlash"]; +com_davidmaletz_mining_ui__$GameplayOptions_AllowFlash.__super__ = com_davidmaletz_mining_ui_BoolValue; +com_davidmaletz_mining_ui__$GameplayOptions_AllowFlash.prototype = $extend(com_davidmaletz_mining_ui_BoolValue.prototype,{ + getValue: function() { + return com_davidmaletz_mining_Main.ALLOW_FLASH; + } + ,setValue: function(val) { + com_davidmaletz_mining_Main.ALLOW_FLASH = val; + Reflect.setField(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"allow_flash",val); + } + ,__class__: com_davidmaletz_mining_ui__$GameplayOptions_AllowFlash +}); +var com_davidmaletz_mining_ui_GameplayOptions = function(c) { + var len = com_davidmaletz_mining_ui_GameplayOptions.ITEMS.length; + com_davidmaletz_controls_ListWindow.call(this,c,com_davidmaletz_mining_Main.window_factory,new com_davidmaletz_mining_ui_OptionRenderer(this),len,1,true,true,false,0,0.5,8); + this.set_x(3); + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,com_fancyfish_faeng_common_Lang.getText("options","gameplay"),this.getWidth(),0,120); + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + this.addItem(com_davidmaletz_mining_ui_GameplayOptions.ITEMS[i]); + } + this.details = new com_davidmaletz_mining_ui_details_StringDetails(70); + this.details.set_x(250 - this.details.getWidth()); + this.addChild(this.details); +}; +$hxClasses["com.davidmaletz.mining.ui.GameplayOptions"] = com_davidmaletz_mining_ui_GameplayOptions; +com_davidmaletz_mining_ui_GameplayOptions.__name__ = ["com","davidmaletz","mining","ui","GameplayOptions"]; +com_davidmaletz_mining_ui_GameplayOptions.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_GameplayOptions.__super__ = com_davidmaletz_controls_ListWindow; +com_davidmaletz_mining_ui_GameplayOptions.prototype = $extend(com_davidmaletz_controls_ListWindow.prototype,{ + details: null + ,init: function(e) { + com_davidmaletz_controls_ListWindow.prototype.init.call(this,e); + com_davidmaletz_controls_Controller.instance.addEventListener("tap",$bind(this,this.tap),false,com_davidmaletz_faengfl_Window.window_ct + 1); + } + ,destroy: function(e) { + com_davidmaletz_controls_ListWindow.prototype.destroy.call(this,e); + com_davidmaletz_controls_Controller.instance.removeEventListener("tap",$bind(this,this.tap)); + if(e != null) { + com_davidmaletz_faengfl_adv_AdvApp.settings.flush(); + } + } + ,tap: function(e) { + var left = e.key == "left"; + var right = e.key == "right"; + var sel = this.clickables.getSelected(); + if((left || right) && Std["is"](sel,com_davidmaletz_mining_ui_AdjustOption)) { + var a = js_Boot.__cast(sel , com_davidmaletz_mining_ui_AdjustOption); + if(left) { + if(a.prevValue()) { + com_davidmaletz_faengfl_adv_sound_Sound.play("move"); + } + } else if(a.nextValue()) { + com_davidmaletz_faengfl_adv_sound_Sound.play("move"); + } + e.stopImmediatePropagation(); + } + } + ,onSelect: function(str) { + if(str == "back") { + this.close(); + } + } + ,onHover: function(item) { + var i = null; + if(item != null && com_fancyfish_faeng_common_Lang.hasText("option.descriptions",item)) { + i = com_fancyfish_faeng_common_Lang.getText("option.descriptions",item).get(); + } + this.details.setInfo(i,0.5); + this.details.set_y(Math.round((this.getHeight() - this.details.getHeight()) * 0.5)); + } + ,isEnabled: function(item) { + return true; + } + ,__class__: com_davidmaletz_mining_ui_GameplayOptions +}); +var com_davidmaletz_mining_ui_GetDir = function(msg,onKey) { + com_davidmaletz_faengfl_transition_Transition.call(this); + this.set_x(128.); + this.set_y(72.); + if(msg != null) { + com_davidmaletz_faengfl_ui_FormattedTooltip.draw(this,msg,true); + } + this.onKey = onKey; + this.add(); +}; +$hxClasses["com.davidmaletz.mining.ui.GetDir"] = com_davidmaletz_mining_ui_GetDir; +com_davidmaletz_mining_ui_GetDir.__name__ = ["com","davidmaletz","mining","ui","GetDir"]; +com_davidmaletz_mining_ui_GetDir.__super__ = com_davidmaletz_faengfl_transition_Transition; +com_davidmaletz_mining_ui_GetDir.prototype = $extend(com_davidmaletz_faengfl_transition_Transition.prototype,{ + onKey: null + ,init: function(e) { + com_davidmaletz_faengfl_transition_Transition.prototype.init.call(this,e); + com_davidmaletz_controls_Controller.instance.addEventListener("tap",$bind(this,this.release),false,com_davidmaletz_faengfl_Window.window_ct + 1); + } + ,destroy: function(e) { + com_davidmaletz_faengfl_transition_Transition.prototype.destroy.call(this,e); + com_davidmaletz_controls_Controller.instance.removeEventListener("tap",$bind(this,this.release)); + } + ,release: function(e) { + if(this.parent == null) { + return; + } + if(!this.hasTrack(com_davidmaletz_lerp_AlphaKeyframe)) { + if(this.onKey != null) { + this.onKey(e.key); + } + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),10,$bind(this,this.doClose)); + } + } + ,__class__: com_davidmaletz_mining_ui_GetDir +}); +var com_davidmaletz_mining_ui_TransferInventory = function(p,from,to,from_l,to_l,c,from_weight,to_weight,centerCol,canIncCost,addWeight,e) { + if(addWeight == null) { + addWeight = 0; + } + if(canIncCost == null) { + canIncCost = true; + } + if(centerCol == null) { + centerCol = 24; + } + this.centerCol = centerCol; + this.player = p; + var r = this.getRenderer(p,true); + var rows = Math.round(100 / r.getHeight(null)); + this.from = p != null ? new com_davidmaletz_mining_ui_StickyInventoryList(p,this,from,new com_davidmaletz_controls_scroll_ScrollList(c,r,rows,1),c,false,$bind(this,this.filterFrom)) : new com_davidmaletz_mining_ui_InventoryList(this,from,new com_davidmaletz_controls_scroll_ScrollList(c,r,rows,1),c); + this.to = new com_davidmaletz_mining_ui_InventoryList(this,to,new com_davidmaletz_controls_scroll_ScrollList(c,this.getRenderer(p,false),rows,1),c,false,$bind(this,this.filterTo)); + this.from.list.set_x(4); + this.from.list.set_y(4); + var w = this.getWidth(); + var lw = this.to.list.getWidth(); + this.to.list.set_x(w - 4 - lw); + this.to.list.set_y(4); + var draw = new com_davidmaletz_faengfl_CompoundDrawable(); + var d = com_davidmaletz_mining_Main.window_factory.create(lw + 8,this.getHeight()); + draw.add(d,0,0); + draw.add(d,this.to.list.get_x() - 4,0); + com_davidmaletz_controls_ClickableWindow.call(this,c,draw,true,true,true,0.6); + this.category = null; + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,from_l,lw + 8,0,70); + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,to_l,lw + 8,this.to.list.get_x() - 4,70); + this.addChild(this.from.list); + this.addChild(this.to.list); + this.addCenterColumn(); + var canToggle = from == p.storehouseInventory && p.storehouseInventory.length() > 1; + var frome = null; + var toe = null; + if(e != null) { + var w1 = e.elementsNamed("weight"); + while(w1.hasNext()) { + var w2 = w1.next(); + if(frome == null && w2.get("id") == "from") { + frome = w2; + } else if(toe == null && w2.get("id") == "to") { + toe = w2; + } + } + } + if(from_weight != null) { + var s = new com_davidmaletz_mining_ui_Weight(Std["is"](from,com_davidmaletz_mining_item_Inventory) ? js_Boot.__cast(from , com_davidmaletz_mining_item_Inventory) : p.inventory,null,from_weight,0,frome); + s.set_x(this.from.list.getWidth() + 8 - s.getWidth()); + s.set_y(this.getHeight() + 2); + this.addChild(s); + } + if(to_weight != null) { + var s1 = new com_davidmaletz_mining_ui_Weight(js_Boot.__cast(to , com_davidmaletz_mining_item_Inventory),this.getSecondInventory(),to_weight,addWeight,toe); + s1.set_x(this.getWidth() - s1.getWidth()); + s1.set_y(this.getHeight() + 2); + this.addChild(s1); + } + this.tabs = new com_davidmaletz_mining_ui_InventoryTabs(this.clickables,$bind(this,this.hasItem),$bind(this,this.setTab)); + this.addChild(this.tabs); + var close = new com_davidmaletz_controls_CloseButton(this,this.getWidth(),0); + this.addChild(close); + this.clickables.addClickable(close,this); + this.details = new com_davidmaletz_mining_ui_details_ItemDetails(canIncCost && (p == null ? false : p.includeCost())); + this.details.set_y(0); + this.addChild(this.details); + if(canToggle && to_weight == null) { + this.toggle = new com_davidmaletz_mining_ui_TextButton(this.getWidth(),this.getHeight() + 2,com_fancyfish_faeng_common_Lang.getText("common","rem_storehouse_items"),$bind(this,this.toggleInv),90); + this.addChild(this.toggle); + this.clickables.addClickable(this.toggle,this); + var _g = this.toggle; + _g.set_x(_g.get_x() - 90); + this.toggle.getPos().x -= 90; + } +}; +$hxClasses["com.davidmaletz.mining.ui.TransferInventory"] = com_davidmaletz_mining_ui_TransferInventory; +com_davidmaletz_mining_ui_TransferInventory.__name__ = ["com","davidmaletz","mining","ui","TransferInventory"]; +com_davidmaletz_mining_ui_TransferInventory.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_TransferInventory.moveAllCheck = function(f) { + if(com_davidmaletz_mining_Player.MOVE_ALL) { + f(); + } else { + var c = com_davidmaletz_mining_Main.getContainer(); + var p = new com_davidmaletz_mining_ui_Prompt(c,com_fancyfish_faeng_common_Lang.getText("options","move_all_confirm"),f); + var func = function() { + com_davidmaletz_mining_Player.setMoveAll(true); + f(); + p.close(); + }; + var w = 54; + var tmp = p.get_numChildren() - 1; + var tmp1 = p.getChildAt(tmp).get_y(); + var tmp2 = com_fancyfish_faeng_common_Lang.getText("common","no_ask"); + p.addClickable(new com_davidmaletz_mining_ui_TextButton(48,tmp1,tmp2,func,w,0.5)); + c.addDisplay(p,5); + } +}; +com_davidmaletz_mining_ui_TransferInventory.__super__ = com_davidmaletz_controls_ClickableWindow; +com_davidmaletz_mining_ui_TransferInventory.prototype = $extend(com_davidmaletz_controls_ClickableWindow.prototype,{ + from: null + ,to: null + ,details: null + ,centerCol: null + ,player: null + ,toggle: null + ,tabs: null + ,filterFrom: function(i) { + return true; + } + ,filterTo: function(i) { + return true; + } + ,hasItem: function(c) { + var a1 = c; + var tmp = function(a2) { + return com_davidmaletz_mining_item_Inventory.filterType(a1,a2); + }; + if(!this.from.inventory.getItems(tmp).hasNext()) { + var a11 = c; + var tmp1 = function(a21) { + return com_davidmaletz_mining_item_Inventory.filterType(a11,a21); + }; + return this.to.inventory.getItems(tmp1).hasNext(); + } else { + return true; + } + } + ,getSecondInventory: function() { + return this.player.inventory; + } + ,toggleInv: function() { + if(this.from.inventory == this.player.inventory) { + this.from.setInventory(this.player.storehouseInventory); + this.toggle.setText(com_fancyfish_faeng_common_Lang.getText("common","rem_storehouse_items")); + } else { + this.from.setInventory(this.player.inventory); + this.toggle.setText(com_fancyfish_faeng_common_Lang.getText("common","add_storehouse_items")); + } + this.tabs.refresh($bind(this,this.hasItem)); + } + ,getRenderer: function(p,from) { + if(p == null || !from) { + return new com_davidmaletz_mining_ui_ItemRenderer(this); + } else { + return new com_davidmaletz_mining_ui_StickyItemRenderer(p,this); + } + } + ,addCenterColumn: function() { + var f = com_davidmaletz_faengfl_Application.button_factory; + var bg = f.createBG(-1,-1); + var hover = f.createHover(-1,-1); + var x = this.from.list.getWidth() + 8 + 2 + Math.round((this.centerCol - 16) * 0.5); + var t = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("common","move_all"),new com_fancyfish_faeng_text_WrapCharacterPlacer(this.centerCol,1,true),0,0.5); + t.set_x(this.from.list.get_x() + this.from.list.getWidth() + 4); + t.set_y(4); + t.draw(); + this.addChildAt(com_davidmaletz_mining_Main.window_factory.create(this.centerCol + 4,t.bounds.height + 4 + 32).create(Math.round(t.get_x() - 2.),Math.round(t.get_y() - 2.)),0); + this.addChild(t); + var ty = t.bounds.height + 8; + var b = new com_davidmaletz_controls_Button(x,ty + 15,bg,hover,new com_fancyfish_faeng_common_mutable_Static("<")); + var f1 = $bind(this,this.moveAllLeft); + b.onClickFunc = function() { + com_davidmaletz_mining_ui_TransferInventory.moveAllCheck(f1); + }; + this.addClickable(b); + var b1 = new com_davidmaletz_controls_Button(x,ty,bg,hover,new com_fancyfish_faeng_common_mutable_Static(">")); + var f2 = $bind(this,this.moveAllRight); + b1.onClickFunc = function() { + com_davidmaletz_mining_ui_TransferInventory.moveAllCheck(f2); + }; + this.addClickable(b1); + } + ,canMoveAll: function(item) { + if(this.player != null) { + return !this.player.isItemSticky(item.item.id); + } else { + return true; + } + } + ,_moveItems: function(from,to,item,ct,value,name) { + if(from.addItems(item,-ct,value,name)) { + this.moveItem(item,ct,to,value,name); + } + } + ,moveAllLeft: function() { + var items = []; + var item; + if(this.category == null) { + item = null; + } else { + var a1 = this.category; + item = function(a2) { + return com_davidmaletz_mining_item_Inventory.filterType(a1,a2); + }; + } + var item1 = this.to.inventory.getItems(item); + while(item1.hasNext()) { + var item2 = item1.next(); + items.push(item2); + } + var _g = 0; + while(_g < items.length) { + var item3 = items[_g]; + ++_g; + var v = item3.getItemValues(); + while(v.hasNext()) { + var v1 = v.next(); + this._moveItems(this.to.inventory,this.from.inventory,v1.item,v1.count,v1.value,v1.name); + } + } + } + ,moveAllRight: function() { + var items = []; + var item; + if(this.category == null) { + item = null; + } else { + var a1 = this.category; + item = function(a2) { + return com_davidmaletz_mining_item_Inventory.filterType(a1,a2); + }; + } + var item1 = this.from.inventory.getItems(item); + while(item1.hasNext()) { + var item2 = item1.next(); + if(this.canMoveAll(item2)) { + items.push(item2); + } + } + var _g = 0; + while(_g < items.length) { + var item3 = items[_g]; + ++_g; + var v = item3.getItemValues(); + while(v.hasNext()) { + var v1 = v.next(); + if(v1.item.canStore()) { + this._moveItems(this.from.inventory,this.to.inventory,v1.item,v1.count,v1.value,v1.name); + } + } + } + } + ,moveItem: function(item,ct,i,value,name) { + i.addItems(item,ct,value,name); + } + ,createPrompt: function(c,item,func) { + return new com_davidmaletz_mining_ui_ItemCountPrompt(c,item,item.count,com_fancyfish_faeng_common_Lang.getText("common",item.inventory == this.from.inventory ? "store_item" : "retrieve_item"),item.count,func); + } + ,onMove: function(item,ct) { + this._moveItems(item.inventory,(item.inventory == this.from.inventory ? this.to : this.from).inventory,item.item,ct,item.value,item.name); + } + ,moveOne: function(item) { + this.onMove(item,1); + return true; + } + ,moveAll: function(item) { + this.onMove(item,item.count); + return true; + } + ,onSelect: function(item) { + if(!this.isEnabled(item) || item.count <= 0) { + return; + } + if((com_davidmaletz_faengfl_adv_AdvApp.shiftDown || item.count == 1) && this.moveOne(item)) { + return; + } + if(com_davidmaletz_faengfl_adv_AdvApp.ctrlDown && this.moveAll(item)) { + return; + } + var c = com_davidmaletz_mining_Main.getContainer(); + var f = $bind(this,this.onMove); + var a1 = item; + var p = this.createPrompt(c,item,function(ct) { + f(a1,ct); + }); + if(p != null) { + c.addDisplay(p,5); + } + } + ,onHover: function(item) { + if(item == null) { + this.details.setItem(null,null); + return; + } + if(item.inventory == this.from.inventory) { + this.details.set_x(this.from.list.get_x() + this.from.list.getWidth()); + } else { + this.details.set_x(this.to.list.get_x() - this.details.getWidth()); + } + var f = $bind(this,this.additionalInfo); + var a1 = item; + var tmp = function(s,w,x,y) { + return f(a1,s,w,x,y); + }; + this.details.setItemParent(item,tmp); + this.details.set_y(Math.round((this.getHeight() - this.details.getHeight()) * 0.5)); + } + ,additionalInfo: function(item,s,w,x,y) { + return y; + } + ,isEnabled: function(item) { + if(item.count > 0) { + if(item.inventory == this.from.inventory) { + return item.item.canStore(); + } else { + return true; + } + } else { + return false; + } + } + ,category: null + ,setTab: function(tab) { + var f = this.from.getList(tab); + var t = this.to.getList(tab); + this.category = tab; + var p = com_davidmaletz_controls_scroll_ScrollList.preSwitch(this.clickables); + this.from.list.switchList(f); + this.to.list.switchList(t); + var c = js_Boot.__cast(this.clickables.clickables , com_davidmaletz_controls_CompoundClickableColumns); + c.setColumn(0,f.clickables); + c.setColumn(1,t.clickables); + com_davidmaletz_controls_scroll_ScrollList.postSwitch(this.clickables,p); + } + ,createClickables: function() { + return new com_davidmaletz_controls_CompoundClickableColumns([this.from.list.getList().clickables,this.to.list.getList().clickables],[this.from.list.get_x(),this.to.list.get_x()]); + } + ,init: function(e) { + com_davidmaletz_controls_ClickableWindow.prototype.init.call(this,e); + this.from.init(); + this.to.init(); + com_davidmaletz_controls_Controller.instance.addEventListener("tap",$bind(this,this.release),false,com_davidmaletz_faengfl_Window.window_ct + 1); + } + ,destroy: function(e) { + com_davidmaletz_controls_ClickableWindow.prototype.destroy.call(this,e); + this.from.destroy(); + this.to.destroy(); + com_davidmaletz_controls_Controller.instance.removeEventListener("tap",$bind(this,this.release)); + } + ,getWidth: function() { + return this.from.list.getWidth() + this.to.list.getWidth() + this.centerCol + 16; + } + ,getHeight: function() { + return this.from.list.getHeight() + 8; + } + ,release: function(e) { + if(this.player == null) { + return; + } + if(e.key == "inventory") { + this.close(); + } else if(e.key == "quest") { + var i = this.details.getItemInfo(); + if(i != null) { + this.player.setItemSticky(i.id,!this.player.isItemSticky(i.id)); + } + } else if(this.player.getFlag("allow_hotkeys") && StringTools.startsWith(e.key,"hotkey")) { + var i1 = this.details.asItem(); + if(i1 != null) { + this.player.setHotkey(com_davidmaletz_mining_Main.parseInt(e.key.substring(6)) - 1,i1); + } + } + } + ,__class__: com_davidmaletz_mining_ui_TransferInventory +}); +var com_davidmaletz_mining_ui_GiveInventory = function(p,from,to,from_l,to_l,c,from_weight,to_weight) { + com_davidmaletz_mining_ui_TransferInventory.call(this,p,from,to,from_l,to_l,c,from_weight,to_weight,4,p.includeCost()); +}; +$hxClasses["com.davidmaletz.mining.ui.GiveInventory"] = com_davidmaletz_mining_ui_GiveInventory; +com_davidmaletz_mining_ui_GiveInventory.__name__ = ["com","davidmaletz","mining","ui","GiveInventory"]; +com_davidmaletz_mining_ui_GiveInventory.__super__ = com_davidmaletz_mining_ui_TransferInventory; +com_davidmaletz_mining_ui_GiveInventory.prototype = $extend(com_davidmaletz_mining_ui_TransferInventory.prototype,{ + getSecondInventory: function() { + return null; + } + ,addCenterColumn: function() { + } + ,isEnabled: function(item) { + if(item.inventory == this.from.inventory) { + return com_davidmaletz_mining_ui_TransferInventory.prototype.isEnabled.call(this,item); + } else { + return false; + } + } + ,__class__: com_davidmaletz_mining_ui_GiveInventory +}); +var com_davidmaletz_mining_ui_HealthBar = function(o) { + com_davidmaletz_mining_ui_MyBar.call(this,"health",50,3,10027008,o.getHealthPercent()); + this.object = o; + this.set_x(12); +}; +$hxClasses["com.davidmaletz.mining.ui.HealthBar"] = com_davidmaletz_mining_ui_HealthBar; +com_davidmaletz_mining_ui_HealthBar.__name__ = ["com","davidmaletz","mining","ui","HealthBar"]; +com_davidmaletz_mining_ui_HealthBar.__super__ = com_davidmaletz_mining_ui_MyBar; +com_davidmaletz_mining_ui_HealthBar.prototype = $extend(com_davidmaletz_mining_ui_MyBar.prototype,{ + object: null + ,channel: null + ,init: function(e) { + com_davidmaletz_mining_ui_MyBar.prototype.init.call(this,e); + this.object.addEventListener("change_health",$bind(this,this.update)); + this.update(null); + } + ,destroy: function(e) { + com_davidmaletz_mining_ui_MyBar.prototype.destroy.call(this,e); + this.object.removeEventListener("change_health",$bind(this,this.update)); + if(this.channel != null) { + this.channel.stop(); + this.channel = null; + com_davidmaletz_faengfl_SoundManager.setBGMPeak(1); + } + } + ,update: function(e) { + var p = this.object.getHealthPercent(); + this.setProgress(p,5); + if(p < 0.1 && p != 0) { + if(this.channel == null) { + this.channel = com_davidmaletz_faengfl_adv_sound_Sound.play("low_hp",true); + com_davidmaletz_faengfl_SoundManager.setBGMPeak(0.5); + } + } else if(this.channel != null) { + this.channel.stop(); + this.channel = null; + com_davidmaletz_faengfl_SoundManager.setBGMPeak(1); + } + } + ,__class__: com_davidmaletz_mining_ui_HealthBar +}); +var com_davidmaletz_mining_ui_ImportList = function(c,data,header,halign,valign) { + if(valign == null) { + valign = 0.5; + } + if(halign == null) { + halign = 0.5; + } + com_davidmaletz_mining_network_CloudSaveList.call(this,c,com_fancyfish_faeng_common_Lang.getText("options","import"),false,halign,valign); + this.data = data; + this.header = header; +}; +$hxClasses["com.davidmaletz.mining.ui.ImportList"] = com_davidmaletz_mining_ui_ImportList; +com_davidmaletz_mining_ui_ImportList.__name__ = ["com","davidmaletz","mining","ui","ImportList"]; +com_davidmaletz_mining_ui_ImportList.__super__ = com_davidmaletz_mining_network_CloudSaveList; +com_davidmaletz_mining_ui_ImportList.prototype = $extend(com_davidmaletz_mining_network_CloudSaveList.prototype,{ + data: null + ,header: null + ,loadSave: function(id,colors,offsets,c) { + com_davidmaletz_mining_Main.setSlot(id,this.data); + var a1 = id; + var a2 = colors; + var a3 = offsets; + new com_davidmaletz_faengfl_transition_FadeOut(function() { + return com_davidmaletz_mining_Main.loadSave(a1,a2,a3); + },60); + } + ,load: function(id) { + var f = $bind(this,this.loadSave); + var id1 = id; + com_davidmaletz_mining_ui_CharacterColorWindow.check(null,function(a1,a2,c) { + f(id1,a1,a2,c); + },this.header); + } + ,onSelect: function(slot) { + var id = com_davidmaletz_mining_Main.slotToId(slot); + if(com_davidmaletz_mining_Main.hasSave(id)) { + var c = com_davidmaletz_mining_Main.getContainer(); + var f = $bind(this,this.load); + var id1 = id; + var tmp = function() { + f(id1); + }; + c.addDisplay(new com_davidmaletz_mining_ui_Prompt(c,com_fancyfish_faeng_common_Lang.getText("common","overwrite"),tmp),2); + } else { + this.load(id); + } + } + ,__class__: com_davidmaletz_mining_ui_ImportList +}); +var com_davidmaletz_mining_ui_InventoryList = function(p,i,list,c,incNone,filter,incBlueprint) { + if(incBlueprint == null) { + incBlueprint = true; + } + if(incNone == null) { + incNone = false; + } + this.refreshList = false; + this.inventory = i; + this.map = new haxe_ds_StringMap(); + this.categories = []; + var len = com_davidmaletz_mining_item_ItemCategory.count(); + this.incNone = incNone; + this.filter = filter; + this.parent = p; + var w = list.getViewportWidth(); + var h = list.getViewportHeight(); + this.categories.push(list.getList()); + this.list = list; + this.incBlueprint = incBlueprint; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i1 = _g1++; + this.categories.push(new com_davidmaletz_controls_scroll_ListGrid(w,h,list,c,list)); + } +}; +$hxClasses["com.davidmaletz.mining.ui.InventoryList"] = com_davidmaletz_mining_ui_InventoryList; +com_davidmaletz_mining_ui_InventoryList.__name__ = ["com","davidmaletz","mining","ui","InventoryList"]; +com_davidmaletz_mining_ui_InventoryList.prototype = { + list: null + ,inventory: null + ,map: null + ,categories: null + ,parent: null + ,incNone: null + ,filter: null + ,incBlueprint: null + ,init: function() { + this.inventory.addEventListener("item_added",$bind(this,this.update)); + this._addAll(); + } + ,getSort: function() { + return com_davidmaletz_mining_item_Inventory.ascCost; + } + ,_addAll: function() { + if(this.incNone) { + var c = this.categories[0]; + if(c == this.list.getList()) { + this.list.addItem(null); + } else { + c.addItem(this.list.getRenderer(),null,this.list.getCols()); + } + } + var i = this.inventory.getItems(null,this.getSort()); + while(i.hasNext()) { + var i1 = i.next(); + var v = i1.getItemValues(); + while(v.hasNext()) { + var v1 = v.next(); + this.updateItem(v1.item,v1.count,v1.value,v1.name); + } + } + } + ,getList: function(tab) { + return this.categories[tab == null ? 0 : tab.index + 1]; + } + ,refreshList: null + ,update: function(e) { + if(!this.refreshList) { + this.refreshList = true; + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.refresh)); + } + } + ,setInventory: function(inv) { + if(this.inventory == inv) { + return; + } + this.inventory.removeEventListener("item_added",$bind(this,this.update)); + this.updateInventory(inv); + if(this.parent.stage != null) { + inv.addEventListener("item_added",$bind(this,this.update)); + } + } + ,refresh: function(e) { + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.refresh)); + if(!this.refreshList) { + return; + } + this.refreshList = false; + this.updateInventory(); + } + ,updateInventory: function(inv) { + var clickables = this.parent.clickables; + var p = com_davidmaletz_controls_scroll_ScrollList.preSwitch(clickables); + var y = this.list.getScrollY(); + var _g = 0; + var _g1 = this.categories; + while(_g < _g1.length) { + var c = _g1[_g]; + ++_g; + c.clear(); + } + this.map = new haxe_ds_StringMap(); + if(inv != null) { + this.inventory = inv; + } + this._addAll(); + var ht = this.list.getViewportHeight(); + var sht = this.list.getScrollHeight(); + ht = sht - ht; + if(y > ht) { + y = ht; + } + if(y < 0) { + y = 0; + } + if(this.list.getScrollY() == y) { + this.list.scrollbar.update(); + } else { + this.list.updateScroll(y); + } + com_davidmaletz_controls_scroll_ScrollList.postSwitch(clickables,p); + } + ,_addItem: function(item,count,category,value,name) { + var i = new com_davidmaletz_mining_item_ItemParent(this.inventory,item,count,value,name); + var c = this.getList(category); + if(c == this.list.getList()) { + return this.list.addItem(i); + } else { + return c.addItem(this.list.getRenderer(),i,this.list.getCols()); + } + } + ,acceptItem: function(item) { + if(item.type != com_davidmaletz_mining_item_ItemCategory.none) { + if(this.filter != null) { + return this.filter(item); + } else { + return true; + } + } else { + return false; + } + } + ,updateItem: function(item,count,value,name) { + if(!this.acceptItem(item)) { + return; + } + var id = item.id + "#" + value; + if(name != null) { + id += "#" + name; + } + var ar = this.map.get(id); + if(ar == null) { + ar = []; + if(this.incBlueprint || com_davidmaletz_mining_ui_InventoryList.BLUEPRINT_ALL || item.type.id != "blueprint") { + ar.push(this._addItem(item,count,null,value,name)); + } + if(item.type != com_davidmaletz_mining_item_ItemCategory.none) { + ar.push(this._addItem(item,count,item.type,value,name)); + } + this.map.set(id,ar); + } else { + var _g = 0; + while(_g < ar.length) { + var s = ar[_g]; + ++_g; + this.list.getRenderer().update(s,new com_davidmaletz_mining_item_ItemParent(this.inventory,item,count,value,name)); + } + } + } + ,destroy: function() { + this.inventory.removeEventListener("item_added",$bind(this,this.update)); + } + ,updateAll: function() { + var id = this.map.keys(); + while(id.hasNext()) { + var id1 = id.next(); + var idx = id1.indexOf("#"); + var i = com_davidmaletz_mining_item_ItemInfo.get(id1.substring(0,idx)); + var ar = this.map.get(id1); + var next = id1.indexOf("#",idx + 1); + var value = next == -1 ? com_davidmaletz_mining_Main.parseInt(id1.substring(idx + 1)) : com_davidmaletz_mining_Main.parseInt(id1.substring(idx + 1,next)); + var name = next == -1 ? null : id1.substring(next + 1); + var _g = 0; + while(_g < ar.length) { + var s = ar[_g]; + ++_g; + this.list.getRenderer().update(s,new com_davidmaletz_mining_item_ItemParent(this.inventory,i,this.inventory.getItemValueCount(i,value,name),value,name)); + } + } + } + ,__class__: com_davidmaletz_mining_ui_InventoryList +}; +var com_davidmaletz_mining_ui_InventoryTab = function(t,y,tab) { + var f = com_davidmaletz_faengfl_Application.button_factory; + com_davidmaletz_controls_Button.call(this,-19,y,f.createBG(20,-1),f.createHover(20,-1),null); + this.tabs = t; + this.tab = tab; + var t1; + if(tab == null) { + t1 = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("common","all"),new com_fancyfish_faeng_text_CharacterPlacer(com_davidmaletz_tiles_Tile.SIZE,1),0,0.5); + t1.set_y(Math.round((10 - com_davidmaletz_mining_ui_StringRenderer._getHeight() * 0.5) * 0.5)); + } else { + var icon = com_davidmaletz_mining_item_ItemInfo._get(tab.icon); + if(icon != null) { + t1 = icon.createIcon(); + } else { + var icon1 = com_davidmaletz_tiles_Tile.get(tab.icon); + if(icon1 != null) { + t1 = com_davidmaletz_tiles_Tile.makeIcon(icon1); + } else { + t1 = new openfl_display_Sprite(); + } + } + } + t1.set_x(2); + var _g = t1; + _g.set_y(_g.get_y() + 1); + this.addChild(t1); +}; +$hxClasses["com.davidmaletz.mining.ui.InventoryTab"] = com_davidmaletz_mining_ui_InventoryTab; +com_davidmaletz_mining_ui_InventoryTab.__name__ = ["com","davidmaletz","mining","ui","InventoryTab"]; +com_davidmaletz_mining_ui_InventoryTab.__super__ = com_davidmaletz_controls_Button; +com_davidmaletz_mining_ui_InventoryTab.prototype = $extend(com_davidmaletz_controls_Button.prototype,{ + tabs: null + ,tab: null + ,onClick: function() { + this.tabs.setTab(this); + return true; + } + ,onHover: function(hover) { + if(hover) { + this.tabs.highlightTab(this); + } + com_davidmaletz_controls_Button.prototype.onHover.call(this,hover); + } + ,__class__: com_davidmaletz_mining_ui_InventoryTab +}); +var com_davidmaletz_mining_ui_InventoryTabs = function(clickables,hasItem,setTab,watch) { + com_davidmaletz_faengfl_InitSprite.call(this); + this.onSetTab = setTab; + var len = com_davidmaletz_mining_item_ItemCategory.count(); + this._height = 0.0; + this.clickables = clickables; + this.watch = watch; + this.hasCategory = new haxe_ds_StringMap(); + this.addTab(null); + if(hasItem(com_davidmaletz_mining_item_ItemCategory.VEHICLE)) { + this.addTab(com_davidmaletz_mining_item_ItemCategory.VEHICLE); + } + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + var c = com_davidmaletz_mining_item_ItemCategory.get(i); + if(hasItem(c)) { + this.addTab(c); + } + } +}; +$hxClasses["com.davidmaletz.mining.ui.InventoryTabs"] = com_davidmaletz_mining_ui_InventoryTabs; +com_davidmaletz_mining_ui_InventoryTabs.__name__ = ["com","davidmaletz","mining","ui","InventoryTabs"]; +com_davidmaletz_mining_ui_InventoryTabs.__super__ = com_davidmaletz_faengfl_InitSprite; +com_davidmaletz_mining_ui_InventoryTabs.prototype = $extend(com_davidmaletz_faengfl_InitSprite.prototype,{ + selected_tab: null + ,onSetTab: null + ,watch: null + ,_height: null + ,hasCategory: null + ,clickables: null + ,refresh: function(hasItem) { + var len = com_davidmaletz_mining_item_ItemCategory.count(); + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + var c = com_davidmaletz_mining_item_ItemCategory.get(i); + if(hasItem(c)) { + this.addTab(c); + } + } + } + ,addTab: function(c) { + if(c != null) { + if(this.hasCategory.exists(c.id)) { + return; + } + this.hasCategory.set(c.id,true); + } + var tab = new com_davidmaletz_mining_ui_InventoryTab(this,this._height,c); + this._height += com_davidmaletz_mining_ui_TextButton.getHeight(); + this.addChild(tab); + this.clickables.addClickable(tab,this); + if(c == null) { + this.selected_tab = tab; + } else { + com_davidmaletz_lerp_DarkenKeyframe.setDarkness(tab,0.6); + } + } + ,_addTab: function(i) { + if(i.item != null && i.item.type != null && i.item.type.id != null) { + this.addTab(i.item.type); + } + } + ,init: function(e) { + this.destroy(null); + if(this.watch != null) { + this.watch.addEventListener("item_added",$bind(this,this._addTab)); + } + } + ,destroy: function(e) { + if(this.watch != null) { + this.watch.removeEventListener("item_added",$bind(this,this._addTab)); + } + } + ,highlightTab: function(tab) { + var ty = this.get_y() + tab.get_y(); + var ht = 8 * com_davidmaletz_mining_ui_TextButton.getHeight(); + if(ty > ht) { + this.set_y(Math.min(ht - tab.get_y(),0)); + } else if(ty < 0) { + this.set_y(-tab.get_y()); + } + } + ,setTab: function(tab) { + com_davidmaletz_lerp_DarkenKeyframe.setDarkness(this.selected_tab,0.6); + this.selected_tab = tab; + com_davidmaletz_lerp_DarkenKeyframe.setDarkness(this.selected_tab,1); + this.onSetTab(tab.tab); + this.highlightTab(tab); + } + ,__class__: com_davidmaletz_mining_ui_InventoryTabs +}); +var com_davidmaletz_mining_ui_TabbedItemList = function(player,c,incNone,halign,valign,title,filter,inv) { + if(valign == null) { + valign = 0.5; + } + if(halign == null) { + halign = 0.2; + } + this.additional = null; + var r = new com_davidmaletz_mining_ui_StickyItemRenderer(player,this); + var rows = Math.round(100 / r.getHeight(null)); + com_davidmaletz_controls_scroll_ScrollWindow.call(this,c,com_davidmaletz_mining_Main.window_factory,r,rows,1,halign,valign); + if(inv == null) { + inv = player.inventory; + } + var width = this.getWidth(); + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,title == null ? com_fancyfish_faeng_common_Lang.getText("common","inventory") : title,width); + this.player = player; + this.inventory = new com_davidmaletz_mining_ui_StickyInventoryList(player,this,inv,this.list,c,incNone,filter); + this.addChild(new com_davidmaletz_mining_ui_InventoryTabs(this.clickables,$bind(this,this.hasItem),$bind(this,this.setTab),inv)); + this.details = new com_davidmaletz_mining_ui_details_ItemDetails(this.includeCost()); + this.details.set_x(width + 3); + this.addChild(this.details); +}; +$hxClasses["com.davidmaletz.mining.ui.TabbedItemList"] = com_davidmaletz_mining_ui_TabbedItemList; +com_davidmaletz_mining_ui_TabbedItemList.__name__ = ["com","davidmaletz","mining","ui","TabbedItemList"]; +com_davidmaletz_mining_ui_TabbedItemList.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_TabbedItemList.__super__ = com_davidmaletz_controls_scroll_ScrollWindow; +com_davidmaletz_mining_ui_TabbedItemList.prototype = $extend(com_davidmaletz_controls_scroll_ScrollWindow.prototype,{ + inventory: null + ,player: null + ,details: null + ,additional: null + ,includeCost: function() { + return this.player.includeCost(); + } + ,myFilter: function(c,i) { + if(com_davidmaletz_mining_item_Inventory.filterType(c,i)) { + return this.inventory.acceptItem(i); + } else { + return false; + } + } + ,hasItem: function(c) { + var f = $bind(this,this.myFilter); + var c1 = c; + var tmp = function(i) { + return f(c1,i); + }; + return this.inventory.inventory.getItems(tmp).hasNext(); + } + ,setTab: function(tab) { + this.switchList(this.inventory.getList(tab)); + } + ,onSelect: function(item) { + } + ,onHover: function(item) { + var tmp; + if(this.additional == null) { + tmp = null; + } else { + var f = this.additional; + var a1 = item == null ? null : item.item; + tmp = function(a2,a3,a4,a5) { + return f(a1,a2,a3,a4,a5); + }; + } + this.details.setItemParent(item,tmp); + this.details.set_y(Math.floor((this.getHeight() - this.details.getHeight()) * 0.5)); + } + ,isEnabled: function(item) { + if(item != null) { + return item.count > 0; + } else { + return true; + } + } + ,init: function(e) { + com_davidmaletz_controls_scroll_ScrollWindow.prototype.init.call(this,e); + com_davidmaletz_controls_Controller.instance.addEventListener("tap",$bind(this,this.release),false,com_davidmaletz_faengfl_Window.window_ct + 1); + this.inventory.init(); + } + ,destroy: function(e) { + com_davidmaletz_controls_scroll_ScrollWindow.prototype.destroy.call(this,e); + com_davidmaletz_controls_Controller.instance.removeEventListener("tap",$bind(this,this.release)); + this.inventory.destroy(); + } + ,release: function(e) { + if(e.key == "inventory") { + this.close(); + } else if(e.key == "quest") { + var i = this.details.getItemInfo(); + if(i != null) { + this.player.setItemSticky(i.id,!this.player.isItemSticky(i.id)); + } + } else if(this.player.getFlag("allow_hotkeys") && StringTools.startsWith(e.key,"hotkey")) { + this.player.setHotkey(com_davidmaletz_mining_Main.parseInt(e.key.substring(6)) - 1,this.details.asItem()); + } + } + ,__class__: com_davidmaletz_mining_ui_TabbedItemList +}); +var com_davidmaletz_mining_ui_InventoryWindow = function(player,c,action,actionLabel) { + this._hotkey = 0; + com_davidmaletz_mining_ui_TabbedItemList.call(this,player,c,false); + var stats = new com_davidmaletz_mining_ui_CharacterBars(player,114,3); + var _x = this.getWidth() + 3; + var _y = 44 - stats._height; + var _g = stats; + _g.set_x(_g.get_x() + _x); + var _g1 = stats; + _g1.set_y(_g1.get_y() + _y); + this.addChildAt(stats,0); + this.addChildAt(com_davidmaletz_mining_Main.window_factory.create(114,stats._height + 3).create(_x,_y),0); + if(player.getFlag("allow_hotkeys")) { + var _x1 = this.getWidth() + 3; + var _y1 = 48; + var w = 88; + var lw = Math.round(w * 1.5); + var s = com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,com_fancyfish_faeng_common_Lang.getText("common","set_hotkey"),0,0,lw); + s.set_x(_x1 + (w * 2 - lw >> 2)); + var _g2 = s; + _g2.set_y(_g2.get_y() + (_y1 + 16)); + s.set_scaleX(s.set_scaleY(0.5)); + var _g3 = 0; + while(_g3 < 8) { + var i = _g3++; + var h = new com_davidmaletz_mining_ui_Hotkey(player,i,(function(i1,f) { + return function() { + f[0](i1[0]); + }; + })([i],[$bind(this,this.setHotkey)]),false); + h.set_x(_x1 + i % 4 * 22); + h.set_y(_y1 + 12 + Math.floor(i / 4) * 16); + this.addChild(h); + } + var k = new com_davidmaletz_mining_ui_KeyTooltip(false,"quest",_x1 + w * 0.5,34 + _y1 + 16,com_fancyfish_faeng_common_Lang.getText("common","set_sticky"),16777215,-16777216,true,$bind(this,this.selectSticky)); + k.set_scaleX(k.set_scaleY(0.5)); + this.addChild(k); + } + if(action == null) { + action = $bind(this,this.showEquip); + } + if(actionLabel == null) { + actionLabel = com_fancyfish_faeng_common_Lang.getText("common","equipment"); + } + var WIDTH = 60; + var f1 = $bind(this,this.doAction); + var a1 = action; + var equip = function() { + f1(a1); + }; + var equip1 = new com_davidmaletz_mining_ui_TextButton(this.getWidth(),this.getHeight() + 2,actionLabel,equip,WIDTH); + this.addChild(equip1); + this.clickables.addClickable(equip1,this); + var _g4 = equip1; + _g4.set_x(_g4.get_x() + 3); + equip1.getPos().x += 3; + this.addChild(this.details); +}; +$hxClasses["com.davidmaletz.mining.ui.InventoryWindow"] = com_davidmaletz_mining_ui_InventoryWindow; +com_davidmaletz_mining_ui_InventoryWindow.__name__ = ["com","davidmaletz","mining","ui","InventoryWindow"]; +com_davidmaletz_mining_ui_InventoryWindow.addLabel = function(s,msg,w,offX,lw,ht) { + if(ht == null) { + ht = 16; + } + if(lw == null) { + lw = 80; + } + if(offX == null) { + offX = 0; + } + var l = new openfl_display_Sprite(); + var draw = com_davidmaletz_mining_Main.window_factory.create(lw,ht); + l.addChild(draw.create(0,0)); + var t = new com_davidmaletz_faengfl_TextSprite(msg,new com_fancyfish_faeng_text_WrapCharacterPlacer(draw.getWidth(),1),0,1); + t.set_y(4); + l.addChild(t); + l.set_x(Math.round(offX + (w - draw.getWidth()) * 0.5)); + if(msg.get() != null) { + t.draw(); + t.set_y(Math.floor((ht - t.bounds.height - t.bounds.y) * 0.5)); + } + l.set_y(-draw.getHeight() + 1); + s.addChild(l); + return l; +}; +com_davidmaletz_mining_ui_InventoryWindow.isDroppable = function(item) { + if(item.xml.exists("droppable")) { + return item.xml.get("droppable") == "true"; + } else { + return item.weight > 0; + } +}; +com_davidmaletz_mining_ui_InventoryWindow._drop = function(item) { + var c = com_davidmaletz_mining_Main.getContainer(); + var a1 = item; + var tmp = function(ct) { + com_davidmaletz_mining_ui_InventoryWindow.onDrop(a1,ct); + }; + c.addDisplay(new com_davidmaletz_mining_ui_ItemCountPrompt(c,item,item.count,com_fancyfish_faeng_common_Lang.getText("common","drop_item"),0,tmp),2); +}; +com_davidmaletz_mining_ui_InventoryWindow.onDrop = function(item,ct) { + if(ct != 0) { + if(ct == item.count && com_davidmaletz_mining_Player.WARN_TOSS) { + var m = new haxe_ds_StringMap(); + m.set("{item}",item.item.getDisplay(item.name,false)); + var t = new com_fancyfish_faeng_common_mutable_MutableTemplateStatic(com_fancyfish_faeng_common_Lang.getText("common","drop_all"),m); + var c = com_davidmaletz_mining_Main.getContainer(); + var a1 = item; + var ct1 = ct; + var f = function() { + com_davidmaletz_mining_ui_InventoryWindow.doDrop(a1,ct1); + }; + var p = new com_davidmaletz_mining_ui_Prompt(c,t,f); + var func = function() { + com_davidmaletz_mining_Player.setWarnToss(false); + f(); + p.close(); + }; + var w = 54; + var tmp = p.get_numChildren() - 1; + var tmp1 = p.getChildAt(tmp).get_y(); + var tmp2 = com_fancyfish_faeng_common_Lang.getText("common","no_ask"); + p.addClickable(new com_davidmaletz_mining_ui_TextButton(48,tmp1,tmp2,func,w,0.5)); + c.addDisplay(p,2); + } else { + com_davidmaletz_mining_ui_InventoryWindow.doDrop(item,ct); + } + } +}; +com_davidmaletz_mining_ui_InventoryWindow.doDrop = function(item,ct) { + item.inventory.addItems(item.item,-ct,item.value,item.name); + com_davidmaletz_faengfl_adv_sound_Sound.play("drop"); +}; +com_davidmaletz_mining_ui_InventoryWindow.__super__ = com_davidmaletz_mining_ui_TabbedItemList; +com_davidmaletz_mining_ui_InventoryWindow.prototype = $extend(com_davidmaletz_mining_ui_TabbedItemList.prototype,{ + select: null + ,_hotkey: null + ,doAction: function(action) { + this.onClose = action; + this.close(); + } + ,showEquip: function() { + com_davidmaletz_mining_ui_GUI.showEquipment(this.player); + } + ,selectSticky: function() { + if(this.select == null) { + this.select = new openfl_display_Sprite(); + com_davidmaletz_faengfl_ui_Tooltip.draw(this.select,com_fancyfish_faeng_common_Lang.getText("common","hotkey")); + this.select.set_x(Math.round(this.getWidth() * 0.5)); + this.select.set_y(-12); + this.addChild(this.select); + } else { + this.select.set_visible(!this.select.get_visible()); + } + this._hotkey = -1; + } + ,setHotkey: function(i) { + if(this.select == null) { + this.select = new openfl_display_Sprite(); + com_davidmaletz_faengfl_ui_Tooltip.draw(this.select,com_fancyfish_faeng_common_Lang.getText("common","hotkey")); + this.select.set_x(Math.round(this.getWidth() * 0.5)); + this.select.set_y(-12); + this.addChild(this.select); + } else { + this.select.set_visible(!this.select.get_visible()); + } + this._hotkey = i; + } + ,onSelect: function(item) { + if(this.select != null && this.select.get_visible()) { + if(this._hotkey == -1) { + var id = item.item.id; + this.player.setItemSticky(id,!this.player.isItemSticky(id)); + } else { + this.player.setHotkey(this._hotkey,item.asItem()); + } + this.select.set_visible(false); + return; + } + if(item.count <= 0) { + return; + } + var c = com_davidmaletz_mining_Main.getContainer(); + var drop = com_davidmaletz_mining_ui_InventoryWindow.isDroppable(item.item); + if(item.item.hasActionId("eat")) { + var food = item.item; + if(drop) { + if(!(food.getStamina(this.player) < 0 || food.getHealth(this.player) < 0 || food.getOxygen(this.player) < 0)) { + drop = food.getStorage(this.player) < 0; + } else { + drop = true; + } + } else { + drop = false; + } + } + var c1 = com_davidmaletz_mining_Main.getContainer(); + var ids = []; + var funcs = []; + item.item.getActionChoices(ids,funcs,this.player,item.value,item.name,this); + if(drop) { + ids.push("drop"); + var a1 = item; + funcs.push(function() { + com_davidmaletz_mining_ui_InventoryWindow._drop(a1); + }); + } + if(funcs.length > 1) { + c1.addDisplay(new com_davidmaletz_mining_ui_Choice(c1,"actions",ids,funcs),2); + } else if(funcs.length == 1) { + funcs[0](); + } + } + ,onHover: function(item) { + this.details.setItemParent(item); + } + ,isEnabled: function(item) { + if(com_davidmaletz_mining_ui_InventoryWindow.isDroppable(item.item) || item.item.hasAction(this.player,item.value)) { + return item.count > 0; + } else { + return false; + } + } + ,release: function(e) { + if(e.key == "equipment") { + this.doAction($bind(this,this.showEquip)); + } else { + com_davidmaletz_mining_ui_TabbedItemList.prototype.release.call(this,e); + } + } + ,__class__: com_davidmaletz_mining_ui_InventoryWindow +}); +var com_davidmaletz_mining_ui_ItemCountPrompt = function(c,item,max,msg,value,func) { + com_davidmaletz_mining_ui_CountPrompt.call(this,c,msg,func,0,max,value,com_davidmaletz_mining_ui_StringRenderer._getHeight() + 2); + com_davidmaletz_mining_ui_ItemRenderer.addItemCentered(this,item,50,4); +}; +$hxClasses["com.davidmaletz.mining.ui.ItemCountPrompt"] = com_davidmaletz_mining_ui_ItemCountPrompt; +com_davidmaletz_mining_ui_ItemCountPrompt.__name__ = ["com","davidmaletz","mining","ui","ItemCountPrompt"]; +com_davidmaletz_mining_ui_ItemCountPrompt.__super__ = com_davidmaletz_mining_ui_CountPrompt; +com_davidmaletz_mining_ui_ItemCountPrompt.prototype = $extend(com_davidmaletz_mining_ui_CountPrompt.prototype,{ + __class__: com_davidmaletz_mining_ui_ItemCountPrompt +}); +var com_davidmaletz_mining_ui_ItemFound = function(item) { + com_davidmaletz_mining_ui_NextSprite.call(this); + var b = openfl_Assets.getBitmapData("data/ui/achievement_bg.png"); + this.get_graphics().beginBitmapFill(b); + this.get_graphics().drawRect(0,0,210,b.height); + this.get_graphics().endFill(); + com_davidmaletz_mining_ui_ItemFound.addDetails(item,this,4,14); + var _g = this; + _g.set_y(_g.get_y() - 5); + if(com_davidmaletz_mining_ui_Achievement.current == null) { + this.show(); + } else { + this.next = com_davidmaletz_mining_ui_Achievement.current.next; + com_davidmaletz_mining_ui_Achievement.current.next = this; + } +}; +$hxClasses["com.davidmaletz.mining.ui.ItemFound"] = com_davidmaletz_mining_ui_ItemFound; +com_davidmaletz_mining_ui_ItemFound.__name__ = ["com","davidmaletz","mining","ui","ItemFound"]; +com_davidmaletz_mining_ui_ItemFound.addDetails = function(item,s,x,y) { + var icon = com_davidmaletz_mining_item_Item._createIcon(item,0,null); + icon.set_scaleX(icon.set_scaleY(2)); + icon.set_x(x); + icon.set_y(y + 6); + s.addChild(icon); + var t = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("common","item_found"),new com_fancyfish_faeng_text_CharacterPlacer(0),16777215,1); + t.set_x(x + 4 + 34); + t.set_y(y); + s.addChild(t); + var t1 = new com_davidmaletz_faengfl_TextSprite(item.getName(),new com_fancyfish_faeng_text_CharacterPlacer(0),16720418,item.getName().get().length > 12 ? 1 : 2); + t1.set_x(x + 4 + 34); + t1.set_y(y + 10); + s.addChild(t1); +}; +com_davidmaletz_mining_ui_ItemFound.__super__ = com_davidmaletz_mining_ui_NextSprite; +com_davidmaletz_mining_ui_ItemFound.prototype = $extend(com_davidmaletz_mining_ui_NextSprite.prototype,{ + show: function() { + com_davidmaletz_faengfl_adv_sound_Sound.play("item_found"); + com_davidmaletz_mining_ui_NextSprite.prototype.show.call(this); + } + ,__class__: com_davidmaletz_mining_ui_ItemFound +}); +var com_davidmaletz_mining_ui_ItemInfoList = function(c,items,title,incCost,filter,onSelect,includeNone,additional) { + var r = new com_davidmaletz_mining_ui_ItemInfoRenderer(this); + var rows = Math.round(100 / r.getHeight(null)); + com_davidmaletz_controls_scroll_ScrollWindow.call(this,c,com_davidmaletz_mining_Main.window_factory,r,rows,1,0.3); + this._onSelect = onSelect; + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,title,this.getWidth()); + this.additional = additional; + this.details = new com_davidmaletz_mining_ui_details_ItemDetails(incCost); + this.details.set_x(this.getWidth() + 3); + this.addChild(this.details); + var ar; + if(filter == null) { + ar = items; + } else { + ar = []; + var _g = 0; + while(_g < items.length) { + var i = items[_g]; + ++_g; + if(filter(i)) { + ar.push(i); + } + } + } + if(includeNone) { + this.addItem(null); + } + var _g1 = 0; + while(_g1 < ar.length) { + var i1 = ar[_g1]; + ++_g1; + this.addItem(i1); + } +}; +$hxClasses["com.davidmaletz.mining.ui.ItemInfoList"] = com_davidmaletz_mining_ui_ItemInfoList; +com_davidmaletz_mining_ui_ItemInfoList.__name__ = ["com","davidmaletz","mining","ui","ItemInfoList"]; +com_davidmaletz_mining_ui_ItemInfoList.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_ItemInfoList.__super__ = com_davidmaletz_controls_scroll_ScrollWindow; +com_davidmaletz_mining_ui_ItemInfoList.prototype = $extend(com_davidmaletz_controls_scroll_ScrollWindow.prototype,{ + details: null + ,_onSelect: null + ,additional: null + ,onSelect: function(item) { + this._onSelect(item); + this.close(); + } + ,isEnabled: function(item) { + return true; + } + ,onHover: function(item) { + var tmp; + if(this.additional == null || item == null) { + tmp = null; + } else { + var f = this.additional; + var a1 = item; + tmp = function(a2,a3,a4,a5) { + return f(a1,a2,a3,a4,a5); + }; + } + this.details.setItem(item,tmp); + this.details.set_y(Math.floor((this.getHeight() - this.details.getHeight()) * 0.5)); + } + ,__class__: com_davidmaletz_mining_ui_ItemInfoList +}); +var com_davidmaletz_mining_ui_ItemInfoRenderer = function(handler) { + this.handler = handler; +}; +$hxClasses["com.davidmaletz.mining.ui.ItemInfoRenderer"] = com_davidmaletz_mining_ui_ItemInfoRenderer; +com_davidmaletz_mining_ui_ItemInfoRenderer.__name__ = ["com","davidmaletz","mining","ui","ItemInfoRenderer"]; +com_davidmaletz_mining_ui_ItemInfoRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui_ItemInfoRenderer.prototype = { + handler: null + ,create: function(item,x,y) { + return new com_davidmaletz_mining_ui__$ItemInfoRenderer_ListButton(this,item,x,y); + } + ,update: function(s,item) { + } + ,getWidth: function() { + return 84; + } + ,getHeight: function(item) { + return com_davidmaletz_mining_ui_StringRenderer._getHeight(); + } + ,__class__: com_davidmaletz_mining_ui_ItemInfoRenderer +}; +var com_davidmaletz_mining_ui__$ItemInfoRenderer_ListButton = function(r,i,x,y) { + var w = r.getWidth(); + var h = r.getHeight(i); + com_davidmaletz_controls_Button.call(this,x,y,com_davidmaletz_mining_Main.label_factory.createBG(w,h),com_davidmaletz_mining_Main.label_factory.createHover(w,h),null); + this.handler = r.handler; + this.text = new openfl_display_Sprite(); + this.item = i; + if(i != null) { + com_davidmaletz_mining_ui_ItemRenderer.addItem(this.text,i,1,0); + } else { + var t = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("common","none"),new com_fancyfish_faeng_text_CharacterPlacer(w,1),0,1); + this.text.addChild(t); + } + this.addChild(this.text); + this.updateEnabled(); +}; +$hxClasses["com.davidmaletz.mining.ui._ItemInfoRenderer.ListButton"] = com_davidmaletz_mining_ui__$ItemInfoRenderer_ListButton; +com_davidmaletz_mining_ui__$ItemInfoRenderer_ListButton.__name__ = ["com","davidmaletz","mining","ui","_ItemInfoRenderer","ListButton"]; +com_davidmaletz_mining_ui__$ItemInfoRenderer_ListButton.__super__ = com_davidmaletz_controls_Button; +com_davidmaletz_mining_ui__$ItemInfoRenderer_ListButton.prototype = $extend(com_davidmaletz_controls_Button.prototype,{ + handler: null + ,text: null + ,item: null + ,onClick: function() { + this.handler.onSelect(this.item); + return true; + } + ,onHover: function(hover) { + com_davidmaletz_controls_Button.prototype.onHover.call(this,hover); + this.handler.onHover(hover ? this.item : null); + } + ,updateEnabled: function() { + this.text.set_alpha(this.handler.isEnabled(this.item) ? 1 : 0.5); + } + ,__class__: com_davidmaletz_mining_ui__$ItemInfoRenderer_ListButton +}); +var com_davidmaletz_mining_ui_ItemList = function(c,inv,title,incCost,filter,onSelect,showEmpty,none,additional,equipment,damagedOnly,valFilter,enabled,noneItem) { + if(damagedOnly == null) { + damagedOnly = false; + } + var r = new com_davidmaletz_mining_ui_ItemRenderer(this,none,noneItem); + var rows = Math.round(100 / r.getHeight(null)); + com_davidmaletz_controls_scroll_ScrollWindow.call(this,c,com_davidmaletz_mining_Main.window_factory,r,rows,1,0.3); + this._onSelect = onSelect; + this.enabled = enabled; + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,title,this.getWidth()); + this.additional = additional; + this.details = new com_davidmaletz_mining_ui_details_ItemDetails(incCost); + this.details.set_x(this.getWidth() + 3); + this.addChild(this.details); + var ar = []; + var i = com_davidmaletz_mining_item_ItemInfo.getAll(); + while(i.hasNext()) { + var i1 = i.next(); + if((showEmpty || inv.getItemCount(i1) > 0) && (filter == null || filter(i1))) { + var item = inv.getItem(i1); + if(item == null) { + ar.push(new com_davidmaletz_mining_item_ItemParent(inv,i1,0,0,null)); + } else { + var v = item.getItemValues(); + while(v.hasNext()) { + var v1 = v.next(); + if(valFilter == null || valFilter(v1.item,v1.value,v1.name)) { + ar.push(new com_davidmaletz_mining_item_ItemParent(inv,v1.item,v1.count,v1.value,v1.name)); + } + } + } + } + } + if(equipment != null) { + var e = equipment.getEquipment(filter); + while(e.hasNext()) { + var e1 = e.next(); + ar.push(new com_davidmaletz_mining_item_ItemParent(null,e1.info,1,e1.value,e1.getNameStr())); + } + } + if(damagedOnly) { + ar = ar.filter(com_davidmaletz_mining_ui_ItemList.isDamaged); + } + ar.sort(com_davidmaletz_mining_item_Inventory.ascCost); + if(none != null) { + this.addItem(null); + } + var _g = 0; + while(_g < ar.length) { + var i2 = ar[_g]; + ++_g; + this.addItem(i2); + } +}; +$hxClasses["com.davidmaletz.mining.ui.ItemList"] = com_davidmaletz_mining_ui_ItemList; +com_davidmaletz_mining_ui_ItemList.__name__ = ["com","davidmaletz","mining","ui","ItemList"]; +com_davidmaletz_mining_ui_ItemList.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_ItemList.isDamaged = function(item) { + return item.value > 0; +}; +com_davidmaletz_mining_ui_ItemList.__super__ = com_davidmaletz_controls_scroll_ScrollWindow; +com_davidmaletz_mining_ui_ItemList.prototype = $extend(com_davidmaletz_controls_scroll_ScrollWindow.prototype,{ + details: null + ,_onSelect: null + ,additional: null + ,enabled: null + ,onSelect: function(item) { + this._onSelect(item); + this.close(); + } + ,isEnabled: function(item) { + if(item == null || item.count > 0) { + if(!(item == null || this.enabled == null)) { + return this.enabled(item.item); + } else { + return true; + } + } else { + return false; + } + } + ,onHover: function(item) { + var tmp; + if(this.additional == null || item == null) { + tmp = null; + } else { + var f = this.additional; + var a1 = item.item; + tmp = function(a2,a3,a4,a5) { + return f(a1,a2,a3,a4,a5); + }; + } + this.details.setItemParent(item,tmp); + this.details.set_y(Math.floor((this.getHeight() - this.details.getHeight()) * 0.5)); + } + ,__class__: com_davidmaletz_mining_ui_ItemList +}); +var com_davidmaletz_mining_ui_ItemPopup = function(item,count,dy) { + if(dy == null) { + dy = 0; + } + var m = item.getName(); + if(count != 1) { + m = new com_fancyfish_faeng_common_mutable_Concat(m,(count < 0 ? " " : " x") + com_fancyfish_faeng_common_Utils.largeNumberFormat(count)); + } + com_davidmaletz_faengfl_ui_Popup.call(this,128. + (com_davidmaletz_tiles_Tile.SIZE + 2) * 0.5,(144 - com_davidmaletz_tiles_Tile.SIZE) * 0.5 + dy,-com_davidmaletz_tiles_Tile.SIZE,m); + var t = js_Boot.__cast(this.getChildAt(0) , com_davidmaletz_faengfl_TextSprite); + var s = item.createIcon(); + s.set_x(t.get_x() + t.bounds.x * t.get_scaleX() - (com_davidmaletz_tiles_Tile.SIZE + 4)); + s.set_y(-1); + this.addChild(s); +}; +$hxClasses["com.davidmaletz.mining.ui.ItemPopup"] = com_davidmaletz_mining_ui_ItemPopup; +com_davidmaletz_mining_ui_ItemPopup.__name__ = ["com","davidmaletz","mining","ui","ItemPopup"]; +com_davidmaletz_mining_ui_ItemPopup.__super__ = com_davidmaletz_faengfl_ui_Popup; +com_davidmaletz_mining_ui_ItemPopup.prototype = $extend(com_davidmaletz_faengfl_ui_Popup.prototype,{ + __class__: com_davidmaletz_mining_ui_ItemPopup +}); +var com_davidmaletz_mining_ui_ItemRenderer = function(handler,none,noneItem) { + this.handler = handler; + if(none == null) { + none = com_fancyfish_faeng_common_Lang.getText("common","none"); + } + this.none = none; + this.noneItem = noneItem; +}; +$hxClasses["com.davidmaletz.mining.ui.ItemRenderer"] = com_davidmaletz_mining_ui_ItemRenderer; +com_davidmaletz_mining_ui_ItemRenderer.__name__ = ["com","davidmaletz","mining","ui","ItemRenderer"]; +com_davidmaletz_mining_ui_ItemRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui_ItemRenderer.addElement = function(s,t,e,sz) { + if(e == null || !com_davidmaletz_tiles_Tile.exists(e.icon)) { + return; + } + t.draw(); + var tile = com_davidmaletz_tiles_Tile.get(e.icon); + var icon = com_davidmaletz_mining_item_ItemInfo._createIcon(tile); + icon.set_scaleX(icon.set_scaleY(sz)); + icon.set_x(Math.round(t.get_x() + 1 + (t.bounds.x + t.bounds.width) * sz)); + icon.set_y(Math.round(t.get_y() + (com_davidmaletz_mining_ui_StringRenderer._getHeight() - tile.getHeight()) * sz)); + s.addChild(icon); +}; +com_davidmaletz_mining_ui_ItemRenderer.fixName = function(n) { + if(Std["is"](n,com_fancyfish_faeng_common_mutable_MutableTemplateStatic)) { + var map = (js_Boot.__cast(n , com_fancyfish_faeng_common_mutable_MutableTemplateStatic)).templates; + var k = map.keys(); + while(k.hasNext()) { + var k1 = k.next(); + var s = map.get(k1); + if(StringTools.startsWith(s,"[item=")) { + var i = com_davidmaletz_mining_item_ItemInfo.get(s.substring(6,s.length - 1)); + if(i == null) { + s = ""; + } else { + s = i.getName().get(); + } + } else if(StringTools.startsWith(s,"[object=")) { + var o = com_davidmaletz_mining_world_ObjectInfo.get(s.substring(8,s.length - 1)); + if(o == null) { + s = ""; + } else { + s = o.getDisplayName(null).get(); + } + } + map.set(k1,s); + } + } + return n; +}; +com_davidmaletz_mining_ui_ItemRenderer.addItem = function(s,item,x,y,col,small) { + if(small == null) { + small = 0; + } + if(col == null) { + col = 0; + } + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + if(s == null || item == null) { + return; + } + var icon = item.createIcon(); + var sz = small == 0 && (icon == null || s.get_scaleX() != 1) ? 1 : 0.5; + if(icon != null) { + icon.set_x(x); + icon.set_y(y); + s.addChild(icon); + } + var t = new com_davidmaletz_faengfl_TextSprite(com_davidmaletz_mining_ui_ItemRenderer.fixName(item.getName()),new com_fancyfish_faeng_text_CharacterPlacer(0),col,sz); + t.set_x(x + (icon == null ? 1 : com_davidmaletz_tiles_Tile.SIZE + 1)); + t.set_y(y + (small == 1 ? 0 : Math.round(com_davidmaletz_mining_ui_StringRenderer._getHeight() * (1 - sz) * 0.5))); + s.addChild(t); + com_davidmaletz_mining_ui_ItemRenderer.addElement(s,t,item.getElement(),sz); +}; +com_davidmaletz_mining_ui_ItemRenderer.addItemCentered = function(s,item,x,y,col) { + if(col == null) { + col = 0; + } + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + if(s == null || item == null) { + return; + } + var icon = item.createIcon(); + var sz = icon == null || s.get_scaleX() != 1 ? 1 : 0.5; + var t = new com_davidmaletz_faengfl_TextSprite(com_davidmaletz_mining_ui_ItemRenderer.fixName(item.getName()),new com_fancyfish_faeng_text_CharacterPlacer(col,1),0,sz); + t.draw(); + t.set_x(x); + t.set_y(y + Math.round(com_davidmaletz_mining_ui_StringRenderer._getHeight() * (1 - sz) * 0.5)); + s.addChild(t); + if(icon != null) { + var _g = t; + _g.set_x(_g.get_x() + com_davidmaletz_tiles_Tile.SIZE * 0.5); + com_davidmaletz_mining_ui_ItemRenderer.addElement(s,t,item.getElement(),sz); + var _g1 = icon; + _g1.set_x(_g1.get_x() + (t.bounds.x * t.get_scaleX() + t.get_x() - com_davidmaletz_tiles_Tile.SIZE - 1)); + var _g2 = icon; + _g2.set_y(_g2.get_y() + y); + s.addChild(icon); + } else { + com_davidmaletz_mining_ui_ItemRenderer.addElement(s,t,item.getElement(),sz); + } +}; +com_davidmaletz_mining_ui_ItemRenderer.prototype = { + handler: null + ,none: null + ,noneItem: null + ,create: function(item,x,y) { + return new com_davidmaletz_mining_ui_ListButton(this,item,x,y); + } + ,update: function(s,item) { + (js_Boot.__cast(s , com_davidmaletz_mining_ui_ListButton)).updateCount(item); + } + ,getWidth: function() { + return 84; + } + ,getHeight: function(item) { + return com_davidmaletz_mining_ui_StringRenderer._getHeight(); + } + ,__class__: com_davidmaletz_mining_ui_ItemRenderer +}; +var com_davidmaletz_mining_ui_ListButton = function(r,i,x,y) { + var w = r.getWidth(); + var h = r.getHeight(i); + this.none = r.none; + this.noneItem = r.noneItem; + com_davidmaletz_controls_Button.call(this,x,y,com_davidmaletz_mining_Main.label_factory.createBG(w,h),com_davidmaletz_mining_Main.label_factory.createHover(w,h),null); + this.handler = r.handler; + this.text = new openfl_display_Sprite(); + this.item = i; + if(i != null) { + com_davidmaletz_mining_ui_ItemRenderer.addItem(this.text,new com_davidmaletz_mining_item_Item(i.item,i.value,i.name),1,0); + if(i.item.showCount()) { + this.count = new com_fancyfish_faeng_common_mutable_Mutable(); + this.count.set(com_fancyfish_faeng_common_Utils.largeNumberFormat(i.count)); + var t = new com_davidmaletz_faengfl_TextSprite(this.count,new com_fancyfish_faeng_text_CharacterPlacer(82,2),0,1); + t.set_x(1); + this.text.addChild(t); + } + } else if(this.noneItem != null) { + com_davidmaletz_mining_ui_ItemRenderer.addItem(this.text,this.noneItem,1,0); + } else { + var t1 = new com_davidmaletz_faengfl_TextSprite(this.none,new com_fancyfish_faeng_text_CharacterPlacer(w,1),0,1); + this.text.addChild(t1); + } + this.addChild(this.text); + this.updateEnabled(); +}; +$hxClasses["com.davidmaletz.mining.ui.ListButton"] = com_davidmaletz_mining_ui_ListButton; +com_davidmaletz_mining_ui_ListButton.__name__ = ["com","davidmaletz","mining","ui","ListButton"]; +com_davidmaletz_mining_ui_ListButton.__super__ = com_davidmaletz_controls_Button; +com_davidmaletz_mining_ui_ListButton.prototype = $extend(com_davidmaletz_controls_Button.prototype,{ + count: null + ,handler: null + ,text: null + ,item: null + ,none: null + ,noneItem: null + ,onClick: function() { + this.handler.onSelect(this.item); + return true; + } + ,onHover: function(hover) { + com_davidmaletz_controls_Button.prototype.onHover.call(this,hover); + this.handler.onHover(hover ? this.item : null); + } + ,updateCount: function(item) { + this.item = item; + if(this.count != null) { + this.count.set(com_fancyfish_faeng_common_Utils.largeNumberFormat(item.count)); + } + this.updateEnabled(); + } + ,updateEnabled: function() { + this.text.set_alpha(this.handler.isEnabled(this.item) ? 1 : 0.5); + } + ,__class__: com_davidmaletz_mining_ui_ListButton +}); +var com_davidmaletz_mining_ui_ItemValueRenderer = function(handler,label,w) { + this.handler = handler; + this.width = w; + this.label = label; +}; +$hxClasses["com.davidmaletz.mining.ui.ItemValueRenderer"] = com_davidmaletz_mining_ui_ItemValueRenderer; +com_davidmaletz_mining_ui_ItemValueRenderer.__name__ = ["com","davidmaletz","mining","ui","ItemValueRenderer"]; +com_davidmaletz_mining_ui_ItemValueRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui_ItemValueRenderer.prototype = { + handler: null + ,width: null + ,label: null + ,create: function(item,x,y) { + return new com_davidmaletz_mining_ui__$ItemValueRenderer_ListButton(this,item,x,y); + } + ,update: function(s,item) { + } + ,getWidth: function() { + return this.width; + } + ,getHeight: function(item) { + if(this.label == null) { + return com_davidmaletz_mining_ui_StringRenderer._getHeight(); + } else { + return 15; + } + } + ,__class__: com_davidmaletz_mining_ui_ItemValueRenderer +}; +var com_davidmaletz_mining_ui_Icon = function(handler) { + this.handler = handler; +}; +$hxClasses["com.davidmaletz.mining.ui.Icon"] = com_davidmaletz_mining_ui_Icon; +com_davidmaletz_mining_ui_Icon.__name__ = ["com","davidmaletz","mining","ui","Icon"]; +com_davidmaletz_mining_ui_Icon.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui_Icon.prototype = { + handler: null + ,create: function(item,x,y) { + return new com_davidmaletz_mining_ui__$ItemValueRenderer_IconButton(this.handler,item,x,y); + } + ,update: function(s,item) { + } + ,getWidth: function() { + return 18; + } + ,getHeight: function(item) { + return 12; + } + ,__class__: com_davidmaletz_mining_ui_Icon +}; +var com_davidmaletz_mining_ui__$ItemValueRenderer_IconButton = function(_h,i,x,y) { + var w = 18; + var h = 12; + this.handler = _h; + com_davidmaletz_controls_Button.call(this,x,y,com_davidmaletz_mining_Main.icon_factory.createBG(w,h),com_davidmaletz_mining_Main.icon_factory.createHover(w,h),null); + this.text = new openfl_display_Sprite(); + this.item = i; + this.text.set_x(1); + this.text.set_y(1); + this.addChild(this.text); + this.updateEnabled(); + if(Std["is"](this.item,openfl_events_EventDispatcher)) { + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); + } else { + this.update(null); + } +}; +$hxClasses["com.davidmaletz.mining.ui._ItemValueRenderer.IconButton"] = com_davidmaletz_mining_ui__$ItemValueRenderer_IconButton; +com_davidmaletz_mining_ui__$ItemValueRenderer_IconButton.__name__ = ["com","davidmaletz","mining","ui","_ItemValueRenderer","IconButton"]; +com_davidmaletz_mining_ui__$ItemValueRenderer_IconButton.__super__ = com_davidmaletz_controls_Button; +com_davidmaletz_mining_ui__$ItemValueRenderer_IconButton.prototype = $extend(com_davidmaletz_controls_Button.prototype,{ + handler: null + ,text: null + ,item: null + ,init: function(e) { + this.destroy(e); + (js_Boot.__cast(this.item , openfl_events_EventDispatcher)).addEventListener("updated",$bind(this,this.update)); + this.update(null); + } + ,destroy: function(e) { + (js_Boot.__cast(this.item , openfl_events_EventDispatcher)).removeEventListener("updated",$bind(this,this.update)); + } + ,onClick: function() { + this.handler.onSelect(this.item); + return true; + } + ,onHover: function(hover) { + com_davidmaletz_controls_Button.prototype.onHover.call(this,hover); + this.handler.onHover(hover ? this.item : null); + } + ,updateEnabled: function() { + this.text.set_alpha(this.handler.isEnabled(this.item) ? 1 : 0.5); + } + ,update: function(e) { + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this.text); + var i = this.item.getItem(null); + if(i != null) { + this.text.addChild(i.createIcon()); + } + } + ,__class__: com_davidmaletz_mining_ui__$ItemValueRenderer_IconButton +}); +var com_davidmaletz_mining_ui__$ItemValueRenderer_ListButton = function(r,i,x,y) { + var w = r.getWidth(); + var h = r.getHeight(i); + this.renderer = r; + com_davidmaletz_controls_Button.call(this,x,y,com_davidmaletz_mining_Main.label_factory.createBG(w,h),com_davidmaletz_mining_Main.label_factory.createHover(w,h),null); + this.text = new openfl_display_Sprite(); + this.item = i; + this.addChild(this.text); + this.updateEnabled(); + if(r.label != null) { + var t = new com_davidmaletz_faengfl_TextSprite(r.label,new com_fancyfish_faeng_text_CharacterPlacer(0),0,0.5); + t.set_x(1); + this.addChild(t); + } + if(Std["is"](this.item,openfl_events_EventDispatcher)) { + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); + } else { + this.update(null); + } +}; +$hxClasses["com.davidmaletz.mining.ui._ItemValueRenderer.ListButton"] = com_davidmaletz_mining_ui__$ItemValueRenderer_ListButton; +com_davidmaletz_mining_ui__$ItemValueRenderer_ListButton.__name__ = ["com","davidmaletz","mining","ui","_ItemValueRenderer","ListButton"]; +com_davidmaletz_mining_ui__$ItemValueRenderer_ListButton.__super__ = com_davidmaletz_controls_Button; +com_davidmaletz_mining_ui__$ItemValueRenderer_ListButton.prototype = $extend(com_davidmaletz_controls_Button.prototype,{ + renderer: null + ,text: null + ,item: null + ,init: function(e) { + this.destroy(e); + (js_Boot.__cast(this.item , openfl_events_EventDispatcher)).addEventListener("updated",$bind(this,this.update)); + this.update(null); + } + ,destroy: function(e) { + (js_Boot.__cast(this.item , openfl_events_EventDispatcher)).removeEventListener("updated",$bind(this,this.update)); + } + ,onClick: function() { + this.renderer.handler.onSelect(this.item); + return true; + } + ,onHover: function(hover) { + com_davidmaletz_controls_Button.prototype.onHover.call(this,hover); + this.renderer.handler.onHover(hover ? this.item : null); + } + ,updateEnabled: function() { + this.text.set_alpha(this.renderer.handler.isEnabled(this.item) ? 1 : 0.5); + } + ,update: function(e) { + var offY = this.renderer.label == null ? 0 : 5; + var i = this.item.getItem(com_davidmaletz_mining_Main.getLocalPlayer()); + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this.text); + if(i != null) { + com_davidmaletz_mining_ui_ItemRenderer.addItem(this.text,i,1,offY); + } else { + var t = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("common","none"),new com_fancyfish_faeng_text_CharacterPlacer(this.renderer.getWidth(),1),0,1); + t.set_y(offY); + this.text.addChild(t); + } + } + ,__class__: com_davidmaletz_mining_ui__$ItemValueRenderer_ListButton +}); +var com_davidmaletz_mining_ui_KeyEvent = function(type,key,value) { + openfl_events_Event.call(this,type); + this.key = key; + this.value = value; +}; +$hxClasses["com.davidmaletz.mining.ui.KeyEvent"] = com_davidmaletz_mining_ui_KeyEvent; +com_davidmaletz_mining_ui_KeyEvent.__name__ = ["com","davidmaletz","mining","ui","KeyEvent"]; +com_davidmaletz_mining_ui_KeyEvent.__super__ = openfl_events_Event; +com_davidmaletz_mining_ui_KeyEvent.prototype = $extend(openfl_events_Event.prototype,{ + key: null + ,value: null + ,__class__: com_davidmaletz_mining_ui_KeyEvent +}); +var com_davidmaletz_mining_ui_KeyTooltip = function(behind,key,x,y,text,col,bg,formatted,onPress) { + if(formatted == null) { + formatted = false; + } + if(bg == null) { + bg = -16777216; + } + if(col == null) { + col = 16777215; + } + x += Math.round(com_davidmaletz_faengfl_controls_AbstractKey.key_bitmap.tileWidth * 0.25); + com_davidmaletz_faengfl_ui_Tooltip.call(this,x,y,text,col,bg,null,formatted); + this.message = text; + var t = this.getChildAt(0); + var b = (js_Boot.__cast(t , com_davidmaletz_faengfl_Bounded)).getRectangle(); + var x1 = Math.round(t.get_x() + b.x * t.get_scaleX() - com_davidmaletz_faengfl_adv_AdvApp.keyCenter.x); + var y1 = Math.round(b.height * t.get_scaleY() * 0.5); + this.addChild(new com_davidmaletz_mining_ui__$KeyTooltip_KeyButton(behind,key,x1,y1,b.width,onPress)); + if(behind) { + this.parent.setChildIndex(this,0); + } +}; +$hxClasses["com.davidmaletz.mining.ui.KeyTooltip"] = com_davidmaletz_mining_ui_KeyTooltip; +com_davidmaletz_mining_ui_KeyTooltip.__name__ = ["com","davidmaletz","mining","ui","KeyTooltip"]; +com_davidmaletz_mining_ui_KeyTooltip.__super__ = com_davidmaletz_faengfl_ui_Tooltip; +com_davidmaletz_mining_ui_KeyTooltip.prototype = $extend(com_davidmaletz_faengfl_ui_Tooltip.prototype,{ + message: null + ,__class__: com_davidmaletz_mining_ui_KeyTooltip +}); +var com_davidmaletz_mining_ui__$KeyTooltip_KeyButton = function(behind,key,x,y,w,onPress) { + this.pressed = false; + this.behind = behind; + var code = com_davidmaletz_controls_Controller.instance.getKeyCode(key); + if(code != -1) { + ++code; + } + var tmp; + if(onPress == null) { + if(code != -1) { + var f = $bind(this,this._press); + var a1 = key; + var a2 = code; + tmp = function() { + f(a1,a2); + }; + } else { + tmp = null; + } + } else { + tmp = onPress; + } + var tmp1; + if(code != -1 && onPress == null) { + var f1 = $bind(this,this._release); + var a11 = key; + var a21 = code; + tmp1 = function() { + f1(a11,a21); + }; + } else { + tmp1 = null; + } + com_davidmaletz_faengfl_Button.call(this,tmp,tmp1,null); + this.addChild(new com_davidmaletz_controls_KeyRenderer(key,16,16)); + this._width = w + 34; + this._height = 32; + this.set_x(x - 16); + this.set_y(y - 16); + this.set_alpha(0.75); +}; +$hxClasses["com.davidmaletz.mining.ui._KeyTooltip.KeyButton"] = com_davidmaletz_mining_ui__$KeyTooltip_KeyButton; +com_davidmaletz_mining_ui__$KeyTooltip_KeyButton.__name__ = ["com","davidmaletz","mining","ui","_KeyTooltip","KeyButton"]; +com_davidmaletz_mining_ui__$KeyTooltip_KeyButton.__super__ = com_davidmaletz_faengfl_Button; +com_davidmaletz_mining_ui__$KeyTooltip_KeyButton.prototype = $extend(com_davidmaletz_faengfl_Button.prototype,{ + behind: null + ,pressed: null + ,_press: function(key,code) { + if(!this.pressed) { + this.pressed = true; + com_davidmaletz_controls_Controller.instance.press(key,code); + } + } + ,_release: function(key,code) { + if(this.pressed) { + this.pressed = false; + com_davidmaletz_controls_Controller.instance.release(key,code); + } + } + ,getWindowCt: function() { + if(this.behind) { + return 0; + } else { + return com_davidmaletz_faengfl_Button.prototype.getWindowCt.call(this); + } + } + ,init: function(e) { + com_davidmaletz_faengfl_Button.prototype.init.call(this,e); + com_davidmaletz_faengfl_TouchAdapter.instance.addEventListener("touch_move",$bind(this,this.mouse_move),false,this.getWindowCt() + 1); + com_davidmaletz_faengfl_Window.dispatcher.addEventListener("add_window",$bind(this,this.addWindow)); + } + ,action: function() { + if(this.pressed) { + com_davidmaletz_faengfl_Button.prototype.action.call(this); + } + } + ,addWindow: function(e) { + if(this.pressed && this.onRelease != null) { + this.onRelease(); + } + } + ,destroy: function(e) { + com_davidmaletz_faengfl_Button.prototype.destroy.call(this,e); + com_davidmaletz_faengfl_TouchAdapter.instance.removeEventListener("touch_move",$bind(this,this.mouse_move)); + com_davidmaletz_faengfl_Window.dispatcher.removeEventListener("add_window",$bind(this,this.addWindow)); + if(e != null && this.onPress != null && this.onRelease != null) { + this.onRelease(); + } + } + ,mouse_up: function(e) { + if(e.id == this.touch) { + this.set_alpha(0.75); + com_davidmaletz_faengfl_Button.prototype.mouse_up.call(this,e); + } + } + ,mouse_move: function(e) { + if(this.inBounds(e)) { + this.set_alpha(1); + } else { + this.set_alpha(0.75); + } + } + ,__class__: com_davidmaletz_mining_ui__$KeyTooltip_KeyButton +}); +var com_davidmaletz_mining_ui_LabelFactory = function(stroke) { + com_davidmaletz_faengfl_DefaultButtonFactory.call(this,new com_davidmaletz_mining_ui__$LabelFactory_BGFactory(stroke),new com_davidmaletz_mining_ui__$LabelFactory_HoverFactory(stroke)); +}; +$hxClasses["com.davidmaletz.mining.ui.LabelFactory"] = com_davidmaletz_mining_ui_LabelFactory; +com_davidmaletz_mining_ui_LabelFactory.__name__ = ["com","davidmaletz","mining","ui","LabelFactory"]; +com_davidmaletz_mining_ui_LabelFactory.__super__ = com_davidmaletz_faengfl_DefaultButtonFactory; +com_davidmaletz_mining_ui_LabelFactory.prototype = $extend(com_davidmaletz_faengfl_DefaultButtonFactory.prototype,{ + __class__: com_davidmaletz_mining_ui_LabelFactory +}); +var com_davidmaletz_mining_ui__$LabelFactory_BGFactory = function(s) { + com_davidmaletz_faengfl_AbstractDrawableFactory.call(this); + this.stroke = s; +}; +$hxClasses["com.davidmaletz.mining.ui._LabelFactory.BGFactory"] = com_davidmaletz_mining_ui__$LabelFactory_BGFactory; +com_davidmaletz_mining_ui__$LabelFactory_BGFactory.__name__ = ["com","davidmaletz","mining","ui","_LabelFactory","BGFactory"]; +com_davidmaletz_mining_ui__$LabelFactory_BGFactory.__super__ = com_davidmaletz_faengfl_AbstractDrawableFactory; +com_davidmaletz_mining_ui__$LabelFactory_BGFactory.prototype = $extend(com_davidmaletz_faengfl_AbstractDrawableFactory.prototype,{ + stroke: null + ,makeDrawable: function(w,h) { + if(this.stroke) { + return new com_davidmaletz_faengfl_SolidDrawable(0,w,h,1,0,0); + } else { + return new com_davidmaletz_faengfl_EmptyDrawable(w,h); + } + } + ,__class__: com_davidmaletz_mining_ui__$LabelFactory_BGFactory +}); +var com_davidmaletz_mining_ui__$LabelFactory_HoverFactory = function(s) { + com_davidmaletz_faengfl_AbstractDrawableFactory.call(this); + this.stroke = s; +}; +$hxClasses["com.davidmaletz.mining.ui._LabelFactory.HoverFactory"] = com_davidmaletz_mining_ui__$LabelFactory_HoverFactory; +com_davidmaletz_mining_ui__$LabelFactory_HoverFactory.__name__ = ["com","davidmaletz","mining","ui","_LabelFactory","HoverFactory"]; +com_davidmaletz_mining_ui__$LabelFactory_HoverFactory.__super__ = com_davidmaletz_faengfl_AbstractDrawableFactory; +com_davidmaletz_mining_ui__$LabelFactory_HoverFactory.prototype = $extend(com_davidmaletz_faengfl_AbstractDrawableFactory.prototype,{ + stroke: null + ,makeDrawable: function(w,h) { + return new com_davidmaletz_faengfl_SolidDrawable(10066431,w,h,this.stroke ? 1 : 0,0,0.5); + } + ,__class__: com_davidmaletz_mining_ui__$LabelFactory_HoverFactory +}); +var com_davidmaletz_mining_ui_LevelUpPopup = function(p,fromLevel,toLevel,addPoints) { + com_davidmaletz_controls_ClickableWindow.call(this,com_davidmaletz_mining_Main.getContainer(),null,true,true,false); + com_davidmaletz_faengfl_ui_Tooltip.draw(this,com_fancyfish_faeng_common_Lang.getText("common","level_up"),16777215,0); + this.set_x(Math.round(128.)); + this.set_y(Math.round(52.)); + ++fromLevel; + ++toLevel; + var t = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Static(fromLevel + " -> " + toLevel),new com_fancyfish_faeng_text_CharacterPlacer(0,1),16776960,1); + var y = 12; + t.set_y(y); + this.addChild(t); + y += t.lineHeight(); + var t1 = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Concat(com_fancyfish_faeng_common_Lang.getText("skill","points"),": +" + addPoints),new com_fancyfish_faeng_text_CharacterPlacer(0,1),43775,1); + t1.set_y(y); + this.addChild(t1); + y += t1.lineHeight(); + if(p.getInfo().getSkills().hasNext()) { + var a1 = p; + this.onClose = function() { + com_davidmaletz_mining_ui_PlayerEquipment.allocateSkill(a1); + }; + } + this.get_graphics().beginFill(9); + this.get_graphics().drawRect(-50.,-1,100,y + 2); + this.get_graphics().endFill(); + this.set_alpha(0); + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),20); + com_davidmaletz_faengfl_FaengFL.addEnterFrame(this); +}; +$hxClasses["com.davidmaletz.mining.ui.LevelUpPopup"] = com_davidmaletz_mining_ui_LevelUpPopup; +com_davidmaletz_mining_ui_LevelUpPopup.__name__ = ["com","davidmaletz","mining","ui","LevelUpPopup"]; +com_davidmaletz_mining_ui_LevelUpPopup.__interfaces__ = [com_davidmaletz_faengfl_EnterFrameHandler]; +com_davidmaletz_mining_ui_LevelUpPopup.__super__ = com_davidmaletz_controls_ClickableWindow; +com_davidmaletz_mining_ui_LevelUpPopup.prototype = $extend(com_davidmaletz_controls_ClickableWindow.prototype,{ + onEmptySelect: function() { + this.close(); + } + ,close: function() { + if(!this.hasTrack(com_davidmaletz_lerp_AlphaKeyframe)) { + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),20,$bind(this,this.doClose)); + } + } + ,init: function(e) { + com_davidmaletz_lerp_LerpSprite.priority += 2; + com_davidmaletz_controls_ClickableWindow.prototype.init.call(this,e); + } + ,destroy: function(e) { + com_davidmaletz_lerp_LerpSprite.priority--; + com_davidmaletz_controls_ClickableWindow.prototype.destroy.call(this,e); + } + ,enter_frame: function(frames) { + if(com_davidmaletz_faengfl_Window.window_ct == 0) { + com_davidmaletz_faengfl_FaengFL.removeEnterFrame(this); + com_davidmaletz_faengfl_adv_sound_Sound.play("levelup"); + com_davidmaletz_mining_Main.getContainer().addDisplay(this,2); + } + } + ,__class__: com_davidmaletz_mining_ui_LevelUpPopup +}); +var com_davidmaletz_mining_ui_LimitTransferInventory = function(p,from,to,from_l,to_l,c,from_weight,to_weight,e) { + com_davidmaletz_mining_ui_TransferInventory.call(this,p,from,to,from_l,to_l,c,from_weight,new com_fancyfish_faeng_common_mutable_Static(to_weight),24,true,0,e); + this.inv = to; + this.limit = to_weight; +}; +$hxClasses["com.davidmaletz.mining.ui.LimitTransferInventory"] = com_davidmaletz_mining_ui_LimitTransferInventory; +com_davidmaletz_mining_ui_LimitTransferInventory.__name__ = ["com","davidmaletz","mining","ui","LimitTransferInventory"]; +com_davidmaletz_mining_ui_LimitTransferInventory.__super__ = com_davidmaletz_mining_ui_TransferInventory; +com_davidmaletz_mining_ui_LimitTransferInventory.prototype = $extend(com_davidmaletz_mining_ui_TransferInventory.prototype,{ + inv: null + ,limit: null + ,getSecondInventory: function() { + return null; + } + ,_moveItems: function(from,to,item,ct,value,name) { + if(to == this.inv && item.weight > 0) { + var max = Math.floor((this.limit - this.inv.getWeight()) / item.weight); + if(max <= 0) { + if(this.player != null) { + this.player.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","inventory_full")); + } + return; + } + if(ct > max) { + ct = max; + } + } + com_davidmaletz_mining_ui_TransferInventory.prototype._moveItems.call(this,from,to,item,ct,value,name); + } + ,__class__: com_davidmaletz_mining_ui_LimitTransferInventory +}); +var com_davidmaletz_mining_ui_MapWindow = function(c,x,y,area,label) { + var w = this.getWidth(); + var h = this.getHeight(); + com_davidmaletz_controls_ClickableWindow.call(this,c,com_davidmaletz_mining_Main.window_factory.create(w,h),true,true,true,0.5,0.5,com_davidmaletz_tiles_Tile.SIZE >> 1); + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,label,w); + var map = new com_davidmaletz_faengfl_ScissorSprite(w - 8,h - 8,this,c,4,4); + var _w = Math.floor((248 - com_davidmaletz_tiles_Tile.SIZE * 2) / 4) * com_davidmaletz_tiles_Tile.SIZE; + var _h = Math.floor((128 - com_davidmaletz_tiles_Tile.SIZE) / 4) * com_davidmaletz_tiles_Tile.SIZE; + var b = new openfl_geom_Rectangle(Math.round((x - _w * 0.5) / 4) * 4,Math.round((y - _h * 0.5) / 4) * 4,_w,_h); + var bg = com_davidmaletz_mining_world_Generate.getBackground(area.id); + if(bg == "black" || bg == null) { + this.addChild(new com_davidmaletz_faengfl_SolidDrawable(0,w - 8,h - 8).create(4,4)); + } else { + var p = com_davidmaletz_mining_renderer_Parallax.get(bg); + if(p == null || !p.exists("mapBG")) { + this.addChild(new com_davidmaletz_faengfl_SolidDrawable(0,w - 8,h - 8).create(4,4)); + } else { + var col = com_davidmaletz_mining_Main.parseInt("0x" + p.get("mapBG")); + var sky = p.exists("skyColor") ? com_davidmaletz_mining_Main.parseInt("0x" + p.get("skyColor")) : 6203066; + var sht = Math.round(-b.y * 4 / com_davidmaletz_tiles_Tile.SIZE); + var max = h - 8; + var ht = p.exists("mapBGHeight") ? Math.round((com_davidmaletz_mining_Main.parseInt(p.get("mapBGHeight")) * com_davidmaletz_tiles_Tile.SIZE - b.y) * 4 / com_davidmaletz_tiles_Tile.SIZE) : max; + this.addBG(sky,0,sht,w,max); + this.addBG(col,sht,ht,w,max); + this.addBG(0,ht,max,w,max); + } + } + if(area.vehicle != null) { + var i = area.vehicle.getRideableInfo(); + var p1 = new com_davidmaletz_tiles_render_PlayAnimation(com_davidmaletz_tiles_Tile.get(i.tile),area.vehicle.getAnim("idle"),com_davidmaletz_mining_enemy_AttackRenderer.getFPS(i.xml,15),true); + var s = Math.round(com_davidmaletz_tiles_Tile.SIZE / 4); + p1.set_x(Math.round((i.interior.offsetX - b.x) / s) * s); + p1.set_y(Math.round((i.interior.offsetY - b.y) / s) * s); + com_davidmaletz_lerp_DarkenKeyframe.setDarkness(p1,0.3); + map.addChild(p1); + } + var back = new openfl_display_Sprite(); + var scale = area.getTileScale(); + map.addChild(back); + var f = new com_davidmaletz_tiles_render_FloorRenderer(area,3,null,false,scale); + com_davidmaletz_lerp_DarkenKeyframe.setDarkness(f,area.getBackDarkness()); + this.setBounds(f,b); + map.addChild(f); + if(area.getWaterAnim() != null) { + var f1 = new com_davidmaletz_mining_renderer_StaticWaterFloorRenderer(area,false); + this.setBounds(f1,b); + map.addChild(f1); + } + var structures = com_davidmaletz_mining_ui_MapWindow.makeStructures(area,b,back,true); + back.set_x(f.get_x()); + structures.set_x(f.get_x()); + back.set_y(f.get_y()); + structures.set_y(f.get_y()); + map.addChild(structures); + var f2 = new com_davidmaletz_tiles_render_FloorRenderer(area,0,null,false,scale); + this.setBounds(f2,b); + map.addChild(f2); + var f3 = new com_davidmaletz_tiles_render_FloorRenderer(area,1,null,false,scale); + this.setBounds(f3,b); + map.addChild(f3); + var ar = []; + area.getObjects(b,function(o,rect) { + var l = o.getLayer(); + if(o.parent == null && l != 4 && l != 6 && o.info.xml.get("showMap") != "false") { + ar.push(o); + } + return false; + },null,0); + ar.sort($bind(this,this.sortObject)); + var objects = new openfl_display_Sprite(); + objects.set_x(f3.get_x()); + objects.set_y(f3.get_y()); + map.addChild(objects); + var _g = 0; + while(_g < ar.length) { + var o1 = ar[_g]; + ++_g; + this.addObject(objects,back,o1); + } + if(area.getWaterBlockAnim() != null) { + var f4 = new com_davidmaletz_mining_renderer_StaticWaterBlockRenderer(area,false); + this.setBounds(f4,b); + map.addChild(f4); + } + var f5 = new com_davidmaletz_mining_renderer_LightFloorRenderer(area,false); + this.setBounds(f5,b); + map.addChild(f5); + map.set_x(4); + map.set_y(4); + map.set_scaleX(map.set_scaleY(4 / com_davidmaletz_tiles_Tile.SIZE)); + this.addChild(map); + this.addChild(new com_davidmaletz_faengfl_SolidDrawable(65280,2,2).create(w * 0.5 - 1,h * 0.5)); + var close = new com_davidmaletz_controls_CloseButton(this,w,0); + this.addChild(close); + this.clickables.addClickable(close,this); +}; +$hxClasses["com.davidmaletz.mining.ui.MapWindow"] = com_davidmaletz_mining_ui_MapWindow; +com_davidmaletz_mining_ui_MapWindow.__name__ = ["com","davidmaletz","mining","ui","MapWindow"]; +com_davidmaletz_mining_ui_MapWindow.makeStructures = function(area,b,back,allowFloating) { + var structures = new openfl_display_Sprite(); + var ar = []; + area.structures.getObjects(b,function(s,rect) { + ar.push(s); + return false; + }); + var _g = 0; + while(_g < ar.length) { + var s1 = ar[_g]; + ++_g; + com_davidmaletz_mining_ui_MapWindow.addStructure(structures,back,s1,allowFloating); + } + return structures; +}; +com_davidmaletz_mining_ui_MapWindow.addStructure = function(structures,back,structure,allowFloating) { + if(structure.info.xml.get("renderer") == "spirit" || !allowFloating && structure.info.xml.get("renderer") == "floating") { + return null; + } + var f = com_davidmaletz_mining_world_Object.getFrame(structure.getIdle()); + var x = 0; + var y = 0; + var offX = 0.0; + var offY = 0.0; + if(f != null) { + x = f.x; + y = f.y; + offX = f.offsetX; + offY = f.offsetY; + } + var r = com_davidmaletz_tiles_Tile.makeIcon(structure.info.tile,offX / com_davidmaletz_tiles_Tile.SIZE,offY / com_davidmaletz_tiles_Tile.SIZE,x,y); + r.set_x(structure.getRendererX()); + r.set_y(structure.getRendererY()); + if(structure.info.xml.get("flip") == "true") { + r.set_scaleX(-r.get_scaleY()); + var _g = r; + _g.set_x(_g.get_x() + structure.info.tile.getTileWidth(0,0)); + } + structure.addOverlay(r,false); + com_davidmaletz_mining_renderer_AreaRenderer.updateLoop(r,structure.area); + var s = structure.isBack() ? back : structures; + if(structure.info.xml.get("behind") == "true") { + s.addChildAt(r,0); + } else { + s.addChild(r); + } + return r; +}; +com_davidmaletz_mining_ui_MapWindow.__super__ = com_davidmaletz_controls_ClickableWindow; +com_davidmaletz_mining_ui_MapWindow.prototype = $extend(com_davidmaletz_controls_ClickableWindow.prototype,{ + addBG: function(col,stY,endY,w,max) { + if(stY < 0) { + stY = 0; + } + if(endY > max) { + endY = max; + } + if(stY >= endY) { + return; + } + this.addChild(new com_davidmaletz_faengfl_SolidDrawable(col,w - 8,endY - stY).create(4,4 + stY)); + } + ,sortObject: function(a,b) { + return a.getLayer() * 100000 + a.getIndex() - (b.getLayer() * 100000 + b.getIndex()); + } + ,addObject: function(objects,back,object) { + var r = object.renderer; + if(r != null && r.get_alpha() == 0) { + return; + } + var s = Math.round(com_davidmaletz_tiles_Tile.SIZE / 4); + if(object.getLayer() == 3 && Std["is"](object,com_davidmaletz_mining_npc_NPC)) { + var r1 = new com_davidmaletz_faengfl_SolidDrawable(16776960,2 * s,2 * s).create(object.getCenterX() - s,object.getCenterY()); + com_davidmaletz_mining_renderer_AreaRenderer.updateLoop(r1,object.area); + objects.addChild(r1); + } else { + var r2 = object.createIcon(); + if(r2 != null) { + r2.set_x(Math.round(r2.get_x() / s) * s); + r2.set_y(Math.round(r2.get_y() / s) * s); + var s1 = objects; + if(object.info.xml != null && object.info.xml.get("renderer") == "floating") { + s1 = back; + r2.set_y(-object.info.createIcon().getTileHeight(0,0) * 0.5); + } + if(Std["is"](object,com_davidmaletz_mining_world_BasicObject)) { + com_davidmaletz_mining_structure_Structure._addOverlay(object.info.xml,object,object.area,null,r2,false,(js_Boot.__cast(object , com_davidmaletz_mining_world_BasicObject)).vars); + } + r2.set_scaleX(object.getFacing()); + com_davidmaletz_mining_renderer_AreaRenderer.updateLoop(r2,object.area); + s1.addChild(r2); + } + } + } + ,setBounds: function(f,b) { + f.setView(b.x,b.y,b.width,b.height); + f.set_x(-b.x); + f.set_y(-b.y); + } + ,getWidth: function() { + return Math.floor((248 - com_davidmaletz_tiles_Tile.SIZE * 2) / 4) * 4 + 8; + } + ,getHeight: function() { + return Math.floor((128 - com_davidmaletz_tiles_Tile.SIZE) / 4) * 4 + 12; + } + ,init: function(e) { + com_davidmaletz_controls_ClickableWindow.prototype.init.call(this,e); + com_davidmaletz_controls_Controller.instance.addEventListener("tap",$bind(this,this.release),false,com_davidmaletz_faengfl_Window.window_ct + 1); + } + ,destroy: function(e) { + com_davidmaletz_controls_ClickableWindow.prototype.destroy.call(this,e); + com_davidmaletz_controls_Controller.instance.removeEventListener("tap",$bind(this,this.release)); + } + ,release: function(e) { + if(StringTools.startsWith(e.key,"hotkey")) { + this.close(); + } + } + ,__class__: com_davidmaletz_mining_ui_MapWindow +}); +var com_davidmaletz_mining_ui_Mod = function(icon,m,c,mods) { + this.red = false; + com_davidmaletz_lerp_LerpSprite.call(this); + this.icon = icon; + this.mod = m; + this.value = new com_fancyfish_faeng_common_mutable_Mutable(); + this.value.set(""); + this.mods = mods; + this.addChild(icon); + var t = new com_davidmaletz_faengfl_TextSprite(this.value,new com_fancyfish_faeng_text_CharacterPlacer(10,2),16777215,1); + this.set_visible(false); + this.set_alpha(0); + t.set_x(com_davidmaletz_tiles_Tile.SIZE + 2); + this.addChild(t); + this.set_y(2); +}; +$hxClasses["com.davidmaletz.mining.ui.Mod"] = com_davidmaletz_mining_ui_Mod; +com_davidmaletz_mining_ui_Mod.__name__ = ["com","davidmaletz","mining","ui","Mod"]; +com_davidmaletz_mining_ui_Mod.__super__ = com_davidmaletz_lerp_LerpSprite; +com_davidmaletz_mining_ui_Mod.prototype = $extend(com_davidmaletz_lerp_LerpSprite.prototype,{ + mod: null + ,value: null + ,mods: null + ,icon: null + ,red: null + ,init: function(e) { + com_davidmaletz_lerp_LerpSprite.prototype.init.call(this,e); + this.mod.addEventListener("update_time",$bind(this,this.change)); + this.change(null); + } + ,destroy: function(e) { + com_davidmaletz_lerp_LerpSprite.prototype.destroy.call(this,e); + this.mod.removeEventListener("update_time",$bind(this,this.change)); + } + ,hide: function() { + this.set_visible(false); + this.mods.update(); + } + ,change: function(e) { + var val = this.mod.getTime(); + var v = val > 0; + if(v) { + this.value.set(com_fancyfish_faeng_common_Utils.largeNumberFormat(val)); + var red = this.mod.temp_buff < 0; + if(red != this.red) { + this.red = red; + if(red) { + com_davidmaletz_faengfl_TextSprite.setColor(this.icon,16724787); + } else { + com_davidmaletz_mining_Stat.tint(this.icon,1); + } + } + } + if(v != this.get_visible()) { + if(v) { + this.set_visible(true); + this.mods.update(); + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),10); + } else { + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),10,$bind(this,this.hide)); + } + } + } + ,__class__: com_davidmaletz_mining_ui_Mod +}); +var com_davidmaletz_mining_ui_ModifyWindow = function(inventory,c,p,e) { + var xml = e.info.xml; + var i = com_davidmaletz_mining_ui_CraftingWindow.getRecipes(p,xml); + this.structure = e; + var handler = new com_davidmaletz_mining_ui_SlotHandler(this); + this.player = p; + var p1 = p; + var a1 = xml; + var o = e; + var tmp = function(r) { + return com_davidmaletz_mining_ui_CraftingWindow._onCraft(p1,a1,o,r); + }; + var p2 = p; + var a11 = xml; + var o1 = e; + var tmp1 = function(a2) { + com_davidmaletz_mining_ui_CraftingWindow._spawnVehicle(p2,a11,o1,a2); + }; + com_davidmaletz_mining_ui_CraftingWindow.call(this,false,i,e.getTitle(p),inventory,c,p.includeCost(),xml.elementPathsNamed("listItem"),e,tmp,tmp1,null,1); + var offX = this.getOffsetX(); + var y = 4; + var m; + if(e.modifySlot == "all") { + m = com_fancyfish_faeng_common_Lang.getText("controls","equipment"); + } else { + m = com_fancyfish_faeng_common_Lang.getText("equipment",e.modifySlot); + } + this.addClickable(new com_davidmaletz_mining_ui_ItemValueRenderer(handler,m,com_davidmaletz_mining_ui_ModifyWindow.WIDTH).create(e.slots[0],offX,y)); + y += 16; + var _g1 = 1; + var _g = e.slots.length; + while(_g1 < _g) { + var i1 = _g1++; + this.addClickable(new com_davidmaletz_mining_ui_ItemValueRenderer(handler,com_fancyfish_faeng_common_Lang.getText("common","modifier"),com_davidmaletz_mining_ui_ModifyWindow.WIDTH).create(e.slots[i1],offX,y)); + y += 16; + } + var t = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("common","creates"),new com_fancyfish_faeng_text_CharacterPlacer(com_davidmaletz_mining_ui_ModifyWindow.WIDTH,1),153,1); + t.set_x(offX); + t.set_y(y); + this.addChild(t); + this.creates = new com_davidmaletz_mining_structure_Slot(); + y += com_davidmaletz_mining_ui_StringRenderer._getHeight(); + this.addClickable(new com_davidmaletz_mining_ui_ItemValueRenderer(handler,null,com_davidmaletz_mining_ui_ModifyWindow.WIDTH).create(this.creates,offX,y)); + this.addChild(this.details); +}; +$hxClasses["com.davidmaletz.mining.ui.ModifyWindow"] = com_davidmaletz_mining_ui_ModifyWindow; +com_davidmaletz_mining_ui_ModifyWindow.__name__ = ["com","davidmaletz","mining","ui","ModifyWindow"]; +com_davidmaletz_mining_ui_ModifyWindow.__interfaces__ = [com_davidmaletz_mining_ui_SlotWindow]; +com_davidmaletz_mining_ui_ModifyWindow.__super__ = com_davidmaletz_mining_ui_CraftingWindow; +com_davidmaletz_mining_ui_ModifyWindow.prototype = $extend(com_davidmaletz_mining_ui_CraftingWindow.prototype,{ + structure: null + ,player: null + ,creates: null + ,getPlayer: function() { + return this.player; + } + ,getDetails: function() { + return this.details; + } + ,getAdditional: function(item,s,w,x,y) { + return com_davidmaletz_mining_item_ItemInfo.halfScale(com_davidmaletz_mining_item_ItemInfo.addModifierInfo,item,s,w,x,y); + } + ,checkCreates: function(item) { + if(item == this.creates) { + this.doEnchant(); + return true; + } else { + return false; + } + } + ,filterSlot: function(item) { + if(item == this.structure.slots[0]) { + return ($_=this.structure,$bind($_,$_.canModify)); + } else { + return com_davidmaletz_mining_item_ItemInfo.hasModifiers; + } + } + ,isTabbed: function(item) { + return item == this.structure.slots[0]; + } + ,getInventory: function() { + return this.list.inventory; + } + ,getOffsetX: function() { + return com_davidmaletz_mining_ui_CraftingWindow.prototype.getWidth.call(this) + 4; + } + ,init: function(e) { + com_davidmaletz_mining_ui_CraftingWindow.prototype.init.call(this,e); + var _g = 0; + var _g1 = this.structure.slots; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + s.addEventListener("updated",$bind(this,this.updateCreates)); + } + this.updateCreates(null); + } + ,destroy: function(e) { + com_davidmaletz_mining_ui_CraftingWindow.prototype.destroy.call(this,e); + var _g = 0; + var _g1 = this.structure.slots; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + s.removeEventListener("updated",$bind(this,this.updateCreates)); + } + } + ,onHover: function(recipe) { + com_davidmaletz_mining_ui_CraftingWindow.prototype.onHover.call(this,recipe); + this.details.set_x(com_davidmaletz_mining_ui_CraftingWindow.prototype.getWidth.call(this) - 4); + } + ,getDrawable: function() { + var draw = new com_davidmaletz_faengfl_CompoundDrawable(); + var _w = com_davidmaletz_mining_ui_CraftingWindow.prototype.getWidth.call(this); + draw.add(com_davidmaletz_mining_Main.window_factory.create(_w,this.getHeight()),0,0); + draw.add(com_davidmaletz_mining_Main.window_factory.create(this.getWidth() - (_w - 1),this.getHeight()),_w - 1,0); + return draw; + } + ,getWidth: function() { + return com_davidmaletz_mining_ui_CraftingWindow.prototype.getWidth.call(this) + com_davidmaletz_mining_ui_ModifyWindow.WIDTH + 8; + } + ,updateCreates: function(e) { + var r = this.structure.slotCreates(this.player); + if(r != null) { + this.creates._setItem(r); + } else { + this.creates._setItem(null); + } + } + ,doEnchant: function() { + var r = this.structure.slotCreates(this.player); + if(r != null) { + this.structure.craft(this.player); + } + } + ,__class__: com_davidmaletz_mining_ui_ModifyWindow +}); +var com_davidmaletz_mining_ui_Mods = function(p,c) { + openfl_display_Sprite.call(this); + this.mods = []; + var m = p.getInfo().getStats(null); + while(m.hasNext()) { + var m1 = m.next(); + var t = com_davidmaletz_mining_item_ItemInfo._createIcon(com_davidmaletz_tiles_Tile.get("stat." + m1)); + if(m1 != "full") { + com_davidmaletz_mining_Stat.tint(t,1); + } + var mod = new com_davidmaletz_mining_ui_Mod(t,p.stats.get(m1),c,this); + this.mods.push(mod); + this.addChild(mod); + } +}; +$hxClasses["com.davidmaletz.mining.ui.Mods"] = com_davidmaletz_mining_ui_Mods; +com_davidmaletz_mining_ui_Mods.__name__ = ["com","davidmaletz","mining","ui","Mods"]; +com_davidmaletz_mining_ui_Mods.__super__ = openfl_display_Sprite; +com_davidmaletz_mining_ui_Mods.prototype = $extend(openfl_display_Sprite.prototype,{ + mods: null + ,update: function() { + var i = 0; + var _g = 0; + var _g1 = this.mods; + while(_g < _g1.length) { + var m = _g1[_g]; + ++_g; + if(m.get_visible()) { + m.set_x(32 + com_davidmaletz_tiles_Tile.SIZE + (com_davidmaletz_tiles_Tile.SIZE + 4 + 10) * i); + ++i; + } + } + } + ,__class__: com_davidmaletz_mining_ui_Mods +}); +var com_davidmaletz_mining_ui_MoveTooltip = function() { + com_davidmaletz_faengfl_ui_Tooltip.call(this,128.,72.,com_fancyfish_faeng_common_Lang.getText("common","move")); + this.set_visible(false); + this.ct = 250; + var t = js_Boot.__cast(this.getChildAt(0) , com_davidmaletz_faengfl_TextSprite); + var x = Math.round(t.get_x() + t.bounds.x * t.get_scaleX() - com_davidmaletz_faengfl_adv_AdvApp.keyCenter.x); + var y = Math.round(t.bounds.height * t.get_scaleY() * 0.5); + this.addChild(new com_davidmaletz_controls_KeyRenderer("left",x,y)); + x += Math.round(t.bounds.width * t.get_scaleX() + com_davidmaletz_faengfl_adv_AdvApp.keyCenter.x * 2); + this.addChild(new com_davidmaletz_controls_KeyRenderer("right",x,y)); +}; +$hxClasses["com.davidmaletz.mining.ui.MoveTooltip"] = com_davidmaletz_mining_ui_MoveTooltip; +com_davidmaletz_mining_ui_MoveTooltip.__name__ = ["com","davidmaletz","mining","ui","MoveTooltip"]; +com_davidmaletz_mining_ui_MoveTooltip.__interfaces__ = [com_davidmaletz_faengfl_EnterFrameHandler]; +com_davidmaletz_mining_ui_MoveTooltip.__super__ = com_davidmaletz_faengfl_ui_Tooltip; +com_davidmaletz_mining_ui_MoveTooltip.prototype = $extend(com_davidmaletz_faengfl_ui_Tooltip.prototype,{ + ct: null + ,init: function(e) { + com_davidmaletz_faengfl_ui_Tooltip.prototype.init.call(this,e); + com_davidmaletz_controls_Controller.instance.addEventListener("press",$bind(this,this.onKey)); + } + ,destroy: function(e) { + com_davidmaletz_faengfl_ui_Tooltip.prototype.destroy.call(this,e); + com_davidmaletz_controls_Controller.instance.removeEventListener("press",$bind(this,this.onKey)); + com_davidmaletz_faengfl_FaengFL.removeEnterFrame(this); + } + ,onKey: function(e) { + if(e.key == "left" || e.key == "right") { + if(this.get_visible()) { + var d = this; + var tmp = function() { + com_davidmaletz_faengfl_FaengFL.remove(d); + }; + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),10,tmp); + } else { + com_davidmaletz_faengfl_FaengFL.remove(this); + } + } + } + ,enter_frame: function(frames) { + com_davidmaletz_faengfl_FaengFL.removeEnterFrame(this); + this.set_visible(true); + this.set_alpha(0); + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),10); + } + ,handle_frame: function(e) { + if(this.ct > 0 && com_davidmaletz_faengfl_Window.window_ct <= 0) { + this.ct -= com_davidmaletz_faengfl_FaengFL.frameTime; + if(this.ct <= 0) { + com_davidmaletz_faengfl_FaengFL.addEnterFrame(this); + } + } + com_davidmaletz_faengfl_ui_Tooltip.prototype.handle_frame.call(this,e); + } + ,__class__: com_davidmaletz_mining_ui_MoveTooltip +}); +var com_davidmaletz_mining_ui_MultiItemPopup = function() { }; +$hxClasses["com.davidmaletz.mining.ui.MultiItemPopup"] = com_davidmaletz_mining_ui_MultiItemPopup; +com_davidmaletz_mining_ui_MultiItemPopup.__name__ = ["com","davidmaletz","mining","ui","MultiItemPopup"]; +com_davidmaletz_mining_ui_MultiItemPopup.show = function(items,count,mul) { + if(mul == null) { + mul = 1; + } + var dy = (count - 1) * com_davidmaletz_tiles_Tile.SIZE >> 1; + var p = null; + var i = items; + while(i.hasNext()) { + var i1 = i.next(); + p = new com_davidmaletz_mining_ui_ItemPopup(i1.item,i1.count * mul,dy); + dy -= com_davidmaletz_tiles_Tile.SIZE; + } + return p; +}; +var com_davidmaletz_mining_ui_MyButtonFactory = function() { + com_davidmaletz_faengfl_DefaultButtonFactory.call(this,new com_davidmaletz_mining_ui__$MyButtonFactory_BGFactory(),new com_davidmaletz_mining_ui__$MyButtonFactory_HoverFactory()); +}; +$hxClasses["com.davidmaletz.mining.ui.MyButtonFactory"] = com_davidmaletz_mining_ui_MyButtonFactory; +com_davidmaletz_mining_ui_MyButtonFactory.__name__ = ["com","davidmaletz","mining","ui","MyButtonFactory"]; +com_davidmaletz_mining_ui_MyButtonFactory.makeBitmap = function(b,width,y) { + var w = Math.round(width); + var id = w + y * 1024; + var ret = com_davidmaletz_mining_ui_MyButtonFactory.cache.get(id); + if(ret == null) { + var out = new openfl_display_BitmapData(w,12,true,0); + out.copyPixels(b,new openfl_geom_Rectangle(0,y * 12,4,12),new openfl_geom_Point(0,0)); + out.copyPixels(b,new openfl_geom_Rectangle(16,y * 12,4,12),new openfl_geom_Point(w - 4,0)); + var e = Math.floor((w - 8) / 12); + var dx = w - 8 - e * 12; + var _g1 = 0; + var _g = e; + while(_g1 < _g) { + var i = _g1++; + out.copyPixels(b,new openfl_geom_Rectangle(4,y * 12,12,12),new openfl_geom_Point(4 + i * 12,0)); + } + if(dx > 0) { + out.copyPixels(b,new openfl_geom_Rectangle(4,y * 12,dx,12),new openfl_geom_Point(4 + e * 12,0)); + } + ret = new com_davidmaletz_faengfl_BitmapDrawable(out); + com_davidmaletz_mining_ui_MyButtonFactory.cache.set(id,ret); + } + return ret; +}; +com_davidmaletz_mining_ui_MyButtonFactory.shrink = function(b,height,y) { + var h = Math.round(height); + var id = h + y * 1024; + var ret = com_davidmaletz_mining_ui_MyButtonFactory.shrink_cache.get(id); + if(ret == null) { + var out = new openfl_display_BitmapData(12,h,true,0); + var dy = h >> 1; + out.copyPixels(b,new openfl_geom_Rectangle(20,y * 12,12,dy),new openfl_geom_Point(0,0)); + out.copyPixels(b,new openfl_geom_Rectangle(20,(y + 1) * 12 - (h - dy),12,h - dy),new openfl_geom_Point(0,dy)); + ret = new com_davidmaletz_faengfl_BitmapDrawable(out); + ret._height -= 1; + com_davidmaletz_mining_ui_MyButtonFactory.shrink_cache.set(id,ret); + } + return ret; +}; +com_davidmaletz_mining_ui_MyButtonFactory.__super__ = com_davidmaletz_faengfl_DefaultButtonFactory; +com_davidmaletz_mining_ui_MyButtonFactory.prototype = $extend(com_davidmaletz_faengfl_DefaultButtonFactory.prototype,{ + defaultHeight: function() { + return 12; + } + ,__class__: com_davidmaletz_mining_ui_MyButtonFactory +}); +var com_davidmaletz_mining_ui__$MyButtonFactory_BGFactory = function() { + com_davidmaletz_faengfl_AbstractDrawableFactory.call(this); +}; +$hxClasses["com.davidmaletz.mining.ui._MyButtonFactory.BGFactory"] = com_davidmaletz_mining_ui__$MyButtonFactory_BGFactory; +com_davidmaletz_mining_ui__$MyButtonFactory_BGFactory.__name__ = ["com","davidmaletz","mining","ui","_MyButtonFactory","BGFactory"]; +com_davidmaletz_mining_ui__$MyButtonFactory_BGFactory.__super__ = com_davidmaletz_faengfl_AbstractDrawableFactory; +com_davidmaletz_mining_ui__$MyButtonFactory_BGFactory.prototype = $extend(com_davidmaletz_faengfl_AbstractDrawableFactory.prototype,{ + makeDrawable: function(w,h) { + if(w == -1) { + w = 12; + } + if(h == -1) { + h = 12; + } + var t = com_davidmaletz_faengfl_AutoTileBitmap.get("data/ui/buttons.png",20,12); + if(w == 12 && h == 12) { + return new com_davidmaletz_mining_ui__$MyButtonFactory_SingleTile(t,1,0); + } else if(w == 20 && h == 12) { + return new com_davidmaletz_mining_ui__$MyButtonFactory_SingleTile(t,0,0); + } else if(w > 20 && h == 12) { + return com_davidmaletz_mining_ui_MyButtonFactory.makeBitmap(t.getInnerBitmap(),w,0); + } else if(w == 12 && h < 12) { + return com_davidmaletz_mining_ui_MyButtonFactory.shrink(t.getInnerBitmap(),h,0); + } else { + return new com_davidmaletz_faengfl_SolidDrawable(11184810,w,h,1); + } + } + ,__class__: com_davidmaletz_mining_ui__$MyButtonFactory_BGFactory +}); +var com_davidmaletz_mining_ui__$MyButtonFactory_HoverFactory = function() { + com_davidmaletz_faengfl_AbstractDrawableFactory.call(this); +}; +$hxClasses["com.davidmaletz.mining.ui._MyButtonFactory.HoverFactory"] = com_davidmaletz_mining_ui__$MyButtonFactory_HoverFactory; +com_davidmaletz_mining_ui__$MyButtonFactory_HoverFactory.__name__ = ["com","davidmaletz","mining","ui","_MyButtonFactory","HoverFactory"]; +com_davidmaletz_mining_ui__$MyButtonFactory_HoverFactory.__super__ = com_davidmaletz_faengfl_AbstractDrawableFactory; +com_davidmaletz_mining_ui__$MyButtonFactory_HoverFactory.prototype = $extend(com_davidmaletz_faengfl_AbstractDrawableFactory.prototype,{ + makeDrawable: function(w,h) { + if(w == -1) { + w = 12; + } + if(h == -1) { + h = 12; + } + var t = com_davidmaletz_faengfl_AutoTileBitmap.get("data/ui/buttons.png",20,12); + if(w == 12 && h == 12) { + return new com_davidmaletz_mining_ui__$MyButtonFactory_SingleTile(t,1,1); + } else if(w == 20 && h == 12) { + return new com_davidmaletz_mining_ui__$MyButtonFactory_SingleTile(t,0,1); + } else if(w > 20 && h == 12) { + return com_davidmaletz_mining_ui_MyButtonFactory.makeBitmap(t.getInnerBitmap(),w,1); + } else if(w == 12 && h < 12) { + return com_davidmaletz_mining_ui_MyButtonFactory.shrink(t.getInnerBitmap(),h,1); + } else { + return new com_davidmaletz_faengfl_SolidDrawable(10066431,w,h,1); + } + } + ,__class__: com_davidmaletz_mining_ui__$MyButtonFactory_HoverFactory +}); +var com_davidmaletz_mining_ui__$MyButtonFactory_SingleTile = function(t,x,y) { + this.sheet = t; + this.tile_x = x; + this.tile_y = y; +}; +$hxClasses["com.davidmaletz.mining.ui._MyButtonFactory.SingleTile"] = com_davidmaletz_mining_ui__$MyButtonFactory_SingleTile; +com_davidmaletz_mining_ui__$MyButtonFactory_SingleTile.__name__ = ["com","davidmaletz","mining","ui","_MyButtonFactory","SingleTile"]; +com_davidmaletz_mining_ui__$MyButtonFactory_SingleTile.__interfaces__ = [com_davidmaletz_faengfl_Drawable]; +com_davidmaletz_mining_ui__$MyButtonFactory_SingleTile.prototype = { + sheet: null + ,tile_x: null + ,tile_y: null + ,getWidth: function() { + return this.sheet.getTileRect2(this.tile_x,this.tile_y).width; + } + ,getHeight: function() { + return this.sheet.getTileRect2(this.tile_x,this.tile_y).height; + } + ,create: function(tx,ty) { + var l = new com_davidmaletz_faengfl_TileLayer(); + l.start(); + this.sheet.addTile(l.handler,this.tile_x,this.tile_y,0,0); + l.finish(); + l.set_x(tx); + l.set_y(ty); + return l; + } + ,__class__: com_davidmaletz_mining_ui__$MyButtonFactory_SingleTile +}; +var com_davidmaletz_tiles_TileFormattedText = function(width,multiline,txt,align,word) { + if(word == null) { + word = true; + } + if(align == null) { + align = 0; + } + com_davidmaletz_faengfl_FormattedText.call(this,width,multiline,txt,align,word); +}; +$hxClasses["com.davidmaletz.tiles.TileFormattedText"] = com_davidmaletz_tiles_TileFormattedText; +com_davidmaletz_tiles_TileFormattedText.__name__ = ["com","davidmaletz","tiles","TileFormattedText"]; +com_davidmaletz_tiles_TileFormattedText.tileMap = null; +com_davidmaletz_tiles_TileFormattedText.keyMap = null; +com_davidmaletz_tiles_TileFormattedText.reset = function() { + com_davidmaletz_tiles_TileFormattedText.tileMap = null; + com_davidmaletz_tiles_TileFormattedText.keyMap = null; +}; +com_davidmaletz_tiles_TileFormattedText.tileCustomTag = function(text,code,data,map,insertText) { + if(data == null) { + return false; + } + switch(code) { + case "global": + var o = com_davidmaletz_faengfl_EventHandler.execute(data,com_davidmaletz_faengfl_EventHandler.getGlobals()); + if(o != null) { + insertText(Std.string(o)); + } + break; + case "key": + if(com_davidmaletz_tiles_TileFormattedText.keyMap == null) { + com_davidmaletz_tiles_TileFormattedText.keyMap = new haxe_ds_StringMap(); + } + var c = com_davidmaletz_tiles_TileFormattedText.keyMap.get(data); + var fnt = text.default_font.get(); + if(c == null) { + c = new com_davidmaletz_tiles__$TileFormattedText_KeyCharacter(data,fnt); + com_davidmaletz_tiles_TileFormattedText.keyMap.set(data,c); + } else { + c.updateFont(fnt); + } + var cp = text.placer.place(c,-1,0.5,-1); + if(cp != null) { + text.getArray(map,fnt,text.default_color).push(cp); + } + return true; + case "text": + var o1 = com_fancyfish_faeng_common_Lang.getTextFromTitle(data); + if(o1 != null) { + insertText(o1.get()); + } + break; + case "tile": + if(com_davidmaletz_tiles_TileFormattedText.tileMap == null) { + com_davidmaletz_tiles_TileFormattedText.tileMap = new haxe_ds_StringMap(); + } + var c1 = com_davidmaletz_tiles_TileFormattedText.tileMap.get(data); + var fnt1 = text.default_font.get(); + if(c1 == null) { + c1 = new com_davidmaletz_tiles__$TileFormattedText_TileCharacter(data,fnt1); + com_davidmaletz_tiles_TileFormattedText.tileMap.set(data,c1); + } else { + c1.updateFont(fnt1); + } + var cp1 = text.placer.place(c1,-1,1,-1); + if(cp1 != null) { + text.getArray(map,fnt1,text.default_color).push(cp1); + } + return true; + } + return false; +}; +com_davidmaletz_tiles_TileFormattedText.getTile = function(id) { + var ar = id.split(" "); + var _anim = null; + var _fps = 10; + var _flip = false; + var len = ar.length; + if(len > 1) { + var _g1 = 1; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + var str = ar[i]; + if(str == "flip") { + _flip = true; + continue; + } + var i1 = str.indexOf("="); + if(i1 == -1) { + continue; + } + var _g2 = str.substring(0,i1); + switch(_g2) { + case "anim": + _anim = str.substring(i1 + 1); + break; + case "fps": + _fps = Std.parseInt(str.substring(i1 + 1)); + break; + } + } + } + var t = com_davidmaletz_tiles_Tile.get(ar[0]); + return { tile : t, anim : _anim, fps : _fps, flip : _flip}; +}; +com_davidmaletz_tiles_TileFormattedText.createTileSprite = function(id) { + var data = com_davidmaletz_tiles_TileFormattedText.getTile(id); + if(data.tile == null) { + return null; + } else if(data.anim == null) { + return { tile : data.tile, sprite : com_davidmaletz_tiles_Tile.makeIcon(data.tile)}; + } else { + var s = new com_davidmaletz_tiles_render_StaticPlayAnimation(data.tile,data.anim,data.fps,true,null,data.flip ? -1 : 0); + if(data.flip) { + s.set_scaleX(-1); + } + return { tile : data.tile, sprite : s}; + } +}; +com_davidmaletz_tiles_TileFormattedText.__super__ = com_davidmaletz_faengfl_FormattedText; +com_davidmaletz_tiles_TileFormattedText.prototype = $extend(com_davidmaletz_faengfl_FormattedText.prototype,{ + startCustomTag: function(code,data,map,insertText) { + if(!com_davidmaletz_faengfl_FormattedText.prototype.startCustomTag.call(this,code,data,map,insertText)) { + return com_davidmaletz_tiles_TileFormattedText.tileCustomTag(this,code,data,map,insertText); + } else { + return true; + } + } + ,__class__: com_davidmaletz_tiles_TileFormattedText +}); +var com_davidmaletz_mining_ui_MyFormattedText = function(width,multiline,txt,align,word) { + if(word == null) { + word = true; + } + if(align == null) { + align = 0; + } + com_davidmaletz_tiles_TileFormattedText.call(this,width,multiline,txt,align,word); +}; +$hxClasses["com.davidmaletz.mining.ui.MyFormattedText"] = com_davidmaletz_mining_ui_MyFormattedText; +com_davidmaletz_mining_ui_MyFormattedText.__name__ = ["com","davidmaletz","mining","ui","MyFormattedText"]; +com_davidmaletz_mining_ui_MyFormattedText.iconMap = null; +com_davidmaletz_mining_ui_MyFormattedText.myCustomTag = function(text,code,data,map,insertText) { + if(data == null) { + return false; + } + switch(code) { + case "icon": + if(com_davidmaletz_mining_ui_MyFormattedText.iconMap == null) { + com_davidmaletz_mining_ui_MyFormattedText.iconMap = new haxe_ds_StringMap(); + } + var c = com_davidmaletz_mining_ui_MyFormattedText.iconMap.get(data); + var fnt = text.default_font.get(); + if(c == null) { + c = new com_davidmaletz_mining_ui__$MyFormattedText_IconCharacter(data,fnt); + com_davidmaletz_mining_ui_MyFormattedText.iconMap.set(data,c); + } else { + c.updateFont(fnt); + } + var cp = text.placer.place(c,-1,1,-1); + if(cp != null) { + text.getArray(map,fnt,text.default_color).push(cp); + } + return true; + case "item": + var ar = data.split(" default="); + var item = com_davidmaletz_mining_item_ItemInfo.get(ar[0]); + if(item != null) { + insertText(item.getDisplay(null,false,ar.length < 2 ? null : ar[1])); + } + return true; + case "object": + var ar1 = data.split(" default="); + var object = com_davidmaletz_mining_world_ObjectInfo.get(ar1[0]); + if(object != null) { + insertText(object.getDisplay(false,null,null,ar1.length < 2 ? null : ar1[1])); + } + return true; + case "player": + try { + var i = Std.parseInt(data); + var name = i < 0 ? com_davidmaletz_mining_Main.getLocalName() : com_davidmaletz_mining_Main.getPlayerNames()[i]; + var p = name == com_davidmaletz_mining_Main.getLocalName() ? com_davidmaletz_mining_Main.getLocalPlayer() : com_davidmaletz_mining_Main.getRemotePlayer(name); + if(p != null) { + var fnt1 = text.default_font.get(); + var c1 = new com_davidmaletz_mining_ui__$MyFormattedText_PlayerCharacter(p,fnt1); + var cp1 = text.placer.place(c1,-1,1,-1); + if(cp1 != null) { + text.getArray(map,fnt1,text.default_color).push(cp1); + } + } + } catch( e ) { + haxe_CallStack.lastException = e; + } + return true; + case "structure": + var struc = com_davidmaletz_mining_structure_StructureInfo.get(data); + if(struc != null && Std["is"](struc,com_davidmaletz_mining_structure_StructureInfo)) { + insertText((js_Boot.__cast(struc , com_davidmaletz_mining_structure_StructureInfo)).getName().get()); + } + return true; + case "var": + var s = data.split("."); + var _g = s[0]; + switch(_g) { + case "item": + var i1 = com_davidmaletz_mining_item_ItemInfo.get(s[1]); + if(i1 != null) { + insertText(com_davidmaletz_mining_ui_MyFormattedText.getVar(i1,s[2])); + } + break; + case "object": + var o = com_davidmaletz_mining_world_ObjectInfo.get(s[1]); + if(o != null) { + insertText(com_davidmaletz_mining_ui_MyFormattedText.getVar(o,s[2])); + } + break; + case "quest": + var q = com_davidmaletz_mining_npc_Quest.get(s[1]); + if(q != null) { + insertText(Std.string(com_davidmaletz_mining_ui_MyFormattedText.getQuestVar(q,s[2]))); + } + break; + case "recipe": + var r = com_davidmaletz_mining_item_Recipe.get(s[1]); + if(r != null) { + insertText(Std.string(com_davidmaletz_mining_ui_MyFormattedText.getRecipeVar(r,s[2]))); + } + break; + } + break; + } + return false; +}; +com_davidmaletz_mining_ui_MyFormattedText.getQuestVar = function(q,v) { + var r = q.getRequirementById(v); + if(r != null) { + if(r.count == null) { + return "null"; + } else { + return "" + r.count; + } + } else { + return com_davidmaletz_mining_ui_MyFormattedText.getVar(q,v); + } +}; +com_davidmaletz_mining_ui_MyFormattedText.getRecipeVar = function(q,v) { + var r = q.getRequirementById(v); + if(r != null) { + if(r.count == null) { + return "null"; + } else { + return "" + r.count; + } + } else { + return com_davidmaletz_mining_ui_MyFormattedText.getVar(q,v); + } +}; +com_davidmaletz_mining_ui_MyFormattedText.getVar = function(d,v) { + return Std.string(Reflect.field(d,v)); +}; +com_davidmaletz_mining_ui_MyFormattedText.reset = function() { + com_davidmaletz_mining_ui_MyFormattedText.iconMap = null; +}; +com_davidmaletz_mining_ui_MyFormattedText.__super__ = com_davidmaletz_tiles_TileFormattedText; +com_davidmaletz_mining_ui_MyFormattedText.prototype = $extend(com_davidmaletz_tiles_TileFormattedText.prototype,{ + startCustomTag: function(code,data,map,insertText) { + if(!com_davidmaletz_tiles_TileFormattedText.prototype.startCustomTag.call(this,code,data,map,insertText)) { + return com_davidmaletz_mining_ui_MyFormattedText.myCustomTag(this,code,data,map,insertText); + } else { + return true; + } + } + ,__class__: com_davidmaletz_mining_ui_MyFormattedText +}); +var com_fancyfish_faeng_text_Character = function(xml,fnt) { + if(xml != null) { + this.id = Std.parseInt(xml.get("id")); + this.xoffset = Std.parseFloat(xml.get("xoffset")) * fnt.internalScale; + this.yoffset = Std.parseFloat(xml.get("yoffset")) * fnt.internalScale; + this.xadvance = Std.parseFloat(xml.get("xadvance")) * fnt.internalScale; + this.x = Std.parseInt(xml.get("x")); + this.y = Std.parseInt(xml.get("y")); + this.width = Std.parseInt(xml.get("width")); + this.height = Std.parseInt(xml.get("height")); + this.kernings = new haxe_ds_IntMap(); + } + this.font = fnt; +}; +$hxClasses["com.fancyfish.faeng.text.Character"] = com_fancyfish_faeng_text_Character; +com_fancyfish_faeng_text_Character.__name__ = ["com","fancyfish","faeng","text","Character"]; +com_fancyfish_faeng_text_Character.prototype = { + id: null + ,xoffset: null + ,yoffset: null + ,xadvance: null + ,x: null + ,y: null + ,width: null + ,height: null + ,font: null + ,kernings: null + ,userData: null + ,addKerning: function(id,value) { + if(this.kernings != null) { + this.kernings.set(id,value * this.font.internalScale); + } + } + ,getKerning: function(prevId) { + if(this.kernings == null) { + return 0; + } else { + var k = this.kernings.get(prevId); + if(k == null) { + return 0; + } else { + return k; + } + } + } + ,getXOffset: function(prevId) { + if(prevId == null) { + prevId = -1; + } + return this.xoffset + this.getKerning(prevId); + } + ,getYOffset: function() { + return this.yoffset; + } + ,getXAdvance: function(prevId) { + if(prevId == null) { + prevId = -1; + } + return this.xadvance + this.getKerning(prevId); + } + ,isDisplayable: function() { + if(this.width > 0) { + return this.height > 0; + } else { + return false; + } + } + ,getWidth: function() { + var r = this.width * this.font.internalScale; + if(com_fancyfish_faeng_text_CharacterPos.ROUND) { + return Math.round(r); + } else { + return r; + } + } + ,getHeight: function() { + var r = this.height * this.font.internalScale; + if(com_fancyfish_faeng_text_CharacterPos.ROUND) { + return Math.round(r); + } else { + return r; + } + } + ,__class__: com_fancyfish_faeng_text_Character +}; +var com_davidmaletz_mining_ui__$MyFormattedText_IconCharacter = function(id,fnt) { + com_fancyfish_faeng_text_Character.call(this,null,fnt); + var ar = id.split(" "); + var name = null; + var len = ar.length; + if(len > 1) { + var _g1 = 1; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + var str = ar[i]; + var i1 = str.indexOf("="); + if(i1 == -1) { + continue; + } + var _g2 = str.substring(0,i1); + if(_g2 == "name") { + name = StringTools.urlDecode(str.substring(i1 + 1)); + } + } + } + var item = com_davidmaletz_mining_item_ItemInfo.get(ar[0]); + this.xadvance = com_davidmaletz_tiles_Tile.SIZE; + this.xoffset = 0; + this.yoffset = 0; + this.id = -1; + this.x = 0; + this.y = 0; + var tmp; + if(item == null) { + tmp = com_davidmaletz_mining_ui__$MyFormattedText_IconCharacter.createEmpty; + } else { + var a1 = item; + var a3 = name; + tmp = function() { + return com_davidmaletz_mining_item_Item._createIcon(a1,0,a3); + }; + } + this.userData = tmp; + this.updateFont(fnt); +}; +$hxClasses["com.davidmaletz.mining.ui._MyFormattedText.IconCharacter"] = com_davidmaletz_mining_ui__$MyFormattedText_IconCharacter; +com_davidmaletz_mining_ui__$MyFormattedText_IconCharacter.__name__ = ["com","davidmaletz","mining","ui","_MyFormattedText","IconCharacter"]; +com_davidmaletz_mining_ui__$MyFormattedText_IconCharacter.createEmpty = function() { + return new openfl_display_Sprite(); +}; +com_davidmaletz_mining_ui__$MyFormattedText_IconCharacter.__super__ = com_fancyfish_faeng_text_Character; +com_davidmaletz_mining_ui__$MyFormattedText_IconCharacter.prototype = $extend(com_fancyfish_faeng_text_Character.prototype,{ + updateFont: function(fnt) { + this.font = fnt; + var ht = 10; + this.yoffset = Math.round(fnt.lineHeight - ht); + this.width = Math.round(this.xadvance / fnt.internalScale); + this.height = Math.round(ht / fnt.internalScale); + } + ,__class__: com_davidmaletz_mining_ui__$MyFormattedText_IconCharacter +}); +var com_davidmaletz_mining_ui__$MyFormattedText_PlayerCharacter = function(p,fnt) { + com_fancyfish_faeng_text_Character.call(this,null,fnt); + this.xoffset = 0; + this.xadvance = com_davidmaletz_tiles_Tile.SIZE; + this.id = -1; + this.x = 0; + this.y = 0; + var p1 = p; + this.userData = function() { + return com_davidmaletz_mining_ui__$MyFormattedText_PlayerCharacter.makeSprite(p1); + }; + this.yoffset = Math.round(fnt.lineHeight - com_davidmaletz_tiles_Tile.SIZE); + this.width = Math.round(this.xadvance / fnt.internalScale); + this.height = Math.round(com_davidmaletz_tiles_Tile.SIZE / fnt.internalScale); +}; +$hxClasses["com.davidmaletz.mining.ui._MyFormattedText.PlayerCharacter"] = com_davidmaletz_mining_ui__$MyFormattedText_PlayerCharacter; +com_davidmaletz_mining_ui__$MyFormattedText_PlayerCharacter.__name__ = ["com","davidmaletz","mining","ui","_MyFormattedText","PlayerCharacter"]; +com_davidmaletz_mining_ui__$MyFormattedText_PlayerCharacter.makeSprite = function(p) { + var s = new openfl_display_Sprite(); + var ret = new com_davidmaletz_mining_renderer_PlayerRendererBase(p,15); + ret.set_scaleX(-1); + var _g = ret; + _g.set_x(_g.get_x() + com_davidmaletz_tiles_Tile.SIZE * 0.5); + var _g1 = ret; + _g1.set_y(_g1.get_y() + com_davidmaletz_tiles_Tile.SIZE * 0.5); + s.addChild(ret); + return s; +}; +com_davidmaletz_mining_ui__$MyFormattedText_PlayerCharacter.__super__ = com_fancyfish_faeng_text_Character; +com_davidmaletz_mining_ui__$MyFormattedText_PlayerCharacter.prototype = $extend(com_fancyfish_faeng_text_Character.prototype,{ + __class__: com_davidmaletz_mining_ui__$MyFormattedText_PlayerCharacter +}); +var com_davidmaletz_tiles_TileRevealText = function(c,width,multiline,txt,align,word,linePadding) { + if(linePadding == null) { + linePadding = 0; + } + if(word == null) { + word = true; + } + if(align == null) { + align = 0; + } + com_davidmaletz_faengfl_RevealText.call(this,c,width,multiline,txt,align,word,linePadding); +}; +$hxClasses["com.davidmaletz.tiles.TileRevealText"] = com_davidmaletz_tiles_TileRevealText; +com_davidmaletz_tiles_TileRevealText.__name__ = ["com","davidmaletz","tiles","TileRevealText"]; +com_davidmaletz_tiles_TileRevealText.__super__ = com_davidmaletz_faengfl_RevealText; +com_davidmaletz_tiles_TileRevealText.prototype = $extend(com_davidmaletz_faengfl_RevealText.prototype,{ + startCustomTag: function(code,data,map,insertText) { + if(!com_davidmaletz_faengfl_RevealText.prototype.startCustomTag.call(this,code,data,map,insertText)) { + return com_davidmaletz_tiles_TileFormattedText.tileCustomTag(this,code,data,map,insertText); + } else { + return true; + } + } + ,__class__: com_davidmaletz_tiles_TileRevealText +}); +var com_davidmaletz_mining_ui_MyRevealText = function(c,width,multiline,txt,align,word,linePadding) { + if(linePadding == null) { + linePadding = 2; + } + if(word == null) { + word = true; + } + if(align == null) { + align = 0; + } + com_davidmaletz_tiles_TileRevealText.call(this,c,width,multiline,txt,align,word,linePadding); +}; +$hxClasses["com.davidmaletz.mining.ui.MyRevealText"] = com_davidmaletz_mining_ui_MyRevealText; +com_davidmaletz_mining_ui_MyRevealText.__name__ = ["com","davidmaletz","mining","ui","MyRevealText"]; +com_davidmaletz_mining_ui_MyRevealText.__super__ = com_davidmaletz_tiles_TileRevealText; +com_davidmaletz_mining_ui_MyRevealText.prototype = $extend(com_davidmaletz_tiles_TileRevealText.prototype,{ + init: function(e) { + this.destroy(e); + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.handle_frame)); + } + ,destroy: function(e) { + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.handle_frame)); + } + ,handle_frame: function(e) { + this.advanceReveal(com_davidmaletz_faengfl_FaengFL.frameTime * com_davidmaletz_faengfl_RevealText.getTextSpeed()); + } + ,startCustomTag: function(code,data,map,insertText) { + if(!com_davidmaletz_tiles_TileRevealText.prototype.startCustomTag.call(this,code,data,map,insertText)) { + return com_davidmaletz_mining_ui_MyFormattedText.myCustomTag(this,code,data,map,insertText); + } else { + return true; + } + } + ,__class__: com_davidmaletz_mining_ui_MyRevealText +}); +var com_davidmaletz_mining_ui_MySliderUI = function(s) { + this.ui = s; +}; +$hxClasses["com.davidmaletz.mining.ui.MySliderUI"] = com_davidmaletz_mining_ui_MySliderUI; +com_davidmaletz_mining_ui_MySliderUI.__name__ = ["com","davidmaletz","mining","ui","MySliderUI"]; +com_davidmaletz_mining_ui_MySliderUI.__interfaces__ = [com_davidmaletz_controls_SliderUI]; +com_davidmaletz_mining_ui_MySliderUI.prototype = { + ui: null + ,getHeight: function() { + return 7; + } + ,getKnobWidth: function() { + return 14; + } + ,createBar: function(w) { + var bar = this.ui.createScrollbar(w); + bar.set_rotation(90); + bar.set_x(w); + return bar; + } + ,createKnob: function() { + var knob = this.ui.createKnob(); + var w = this.getKnobWidth(); + this.ui.setKnobHeight(knob,w); + knob.set_rotation(90); + knob.set_x(w); + return knob; + } + ,__class__: com_davidmaletz_mining_ui_MySliderUI +}; +var com_davidmaletz_mining_ui_ObjectLocator = function(from,to) { + var w = com_davidmaletz_tiles_Tile.SIZE; + var h = com_davidmaletz_tiles_Tile.SIZE; + var col = 16711680; + com_davidmaletz_lerp_LerpSprite.call(this); + this.set_x(256 - com_davidmaletz_tiles_Tile.SIZE); + this.set_y(com_davidmaletz_tiles_Tile.SIZE + 2); + this.addChild(com_davidmaletz_tiles_Tile.makeIcon(com_davidmaletz_tiles_Tile.get("locator"))); + this.from = from; + this.to = to; + this.line = new openfl_display_Sprite(); + var g = this.line.get_graphics(); + g.lineStyle(1,col); + g.moveTo(0,0); + g.lineTo(w * 0.5,0); + this.line.set_x(w * 0.5); + this.line.set_y(h * 0.5); + this.addChild(this.line); + if(from.getCurrentArea() != to.area) { + this.line.set_visible(false); + } +}; +$hxClasses["com.davidmaletz.mining.ui.ObjectLocator"] = com_davidmaletz_mining_ui_ObjectLocator; +com_davidmaletz_mining_ui_ObjectLocator.__name__ = ["com","davidmaletz","mining","ui","ObjectLocator"]; +com_davidmaletz_mining_ui_ObjectLocator.__super__ = com_davidmaletz_lerp_LerpSprite; +com_davidmaletz_mining_ui_ObjectLocator.prototype = $extend(com_davidmaletz_lerp_LerpSprite.prototype,{ + from: null + ,to: null + ,line: null + ,lineTo: function(to) { + this.line.set_visible(true); + this.line.set_rotation(Math.atan2(to.getCenterY() - this.from.getTileCenY() * com_davidmaletz_tiles_Tile.SIZE,to.getCenterX() - this.from.getTileCenX() * com_davidmaletz_tiles_Tile.SIZE) * 180 / Math.PI); + } + ,handle_frame: function(e) { + com_davidmaletz_lerp_LerpSprite.prototype.handle_frame.call(this,e); + var a = this.from.getCurrentArea(); + if(a == this.to.area) { + this.lineTo(this.to); + } else if(this.to.area != null && this.to.area.vehicle != null && a == this.to.area.vehicle.area) { + this.lineTo(this.to.area.vehicle); + } else if(Std["is"](this.to,com_davidmaletz_mining_Player)) { + var v = (js_Boot.__cast(this.to , com_davidmaletz_mining_Player)).vehicle; + if(v != null && v.area != null && a == v.area) { + this.lineTo(v); + } else { + this.line.set_visible(false); + } + } else { + this.line.set_visible(false); + } + } + ,__class__: com_davidmaletz_mining_ui_ObjectLocator +}); +var com_davidmaletz_mining_ui_NPCLocator = function(p,n,fadeIn) { + com_davidmaletz_mining_ui_ObjectLocator.call(this,p,n); + this.player = p; + this.npc = n; + var t = com_davidmaletz_tiles_Tile.get(n.info.xml.get("icon")); + var i = t != null ? com_davidmaletz_tiles_Tile.makeIcon(t,-t.getWidth() * 0.5 / com_davidmaletz_tiles_Tile.SIZE,-t.getHeight() * 0.5 / com_davidmaletz_tiles_Tile.SIZE) : this.npc.createIcon(); + if(t != null && n.info.xml.exists("iconColor")) { + var cs = n.info.xml.exists("colorScale") ? com_davidmaletz_mining_Main.parseFloat(n.info.xml.get("iconColorScale")) : 1; + com_davidmaletz_faengfl_TextSprite.setColor(i,com_davidmaletz_mining_Main.parseInt("0x" + n.info.xml.get("iconColor")),255.0 / cs); + } + i.set_x(-com_davidmaletz_tiles_Tile.SIZE * 0.5); + i.set_y(com_davidmaletz_tiles_Tile.SIZE * 0.5); + i.set_scaleX(-1); + i.set_alpha(0.75); + this.addChild(i); + if(fadeIn) { + this.set_alpha(0); + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),10); + } +}; +$hxClasses["com.davidmaletz.mining.ui.NPCLocator"] = com_davidmaletz_mining_ui_NPCLocator; +com_davidmaletz_mining_ui_NPCLocator.__name__ = ["com","davidmaletz","mining","ui","NPCLocator"]; +com_davidmaletz_mining_ui_NPCLocator.instance = null; +com_davidmaletz_mining_ui_NPCLocator.unlocate = function(p,npc) { + var o = npc == null ? null : p.getNPC(npc); + if(com_davidmaletz_mining_ui_NPCLocator.instance != null && com_davidmaletz_mining_ui_NPCLocator.instance.npc == o) { + com_davidmaletz_mining_ui_NPCLocator.instance.hide(); + } +}; +com_davidmaletz_mining_ui_NPCLocator.locate = function(p,npc,toggle) { + var o = npc == null ? null : p.getNPC(npc); + if(com_davidmaletz_mining_ui_NPCLocator.instance != null) { + var i = com_davidmaletz_mining_ui_NPCLocator.instance; + if(!toggle && i.npc == o) { + i.show(); + return; + } + i.hide(); + if(i.npc == o) { + return; + } + } + if(o != null) { + com_davidmaletz_mining_ui_GUI.addStaticDisplay(new com_davidmaletz_mining_ui_NPCLocator(p,o,toggle),2); + } +}; +com_davidmaletz_mining_ui_NPCLocator.__super__ = com_davidmaletz_mining_ui_ObjectLocator; +com_davidmaletz_mining_ui_NPCLocator.prototype = $extend(com_davidmaletz_mining_ui_ObjectLocator.prototype,{ + player: null + ,npc: null + ,hide: function() { + if(com_davidmaletz_mining_ui_NPCLocator.instance == this) { + com_davidmaletz_mining_ui_NPCLocator.instance = null; + this.player.locateNPC = null; + } + var d = this; + var tmp = function() { + com_davidmaletz_faengfl_FaengFL.remove(d); + }; + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),10,tmp); + } + ,init: function(e) { + com_davidmaletz_mining_ui_ObjectLocator.prototype.init.call(this,e); + if(com_davidmaletz_mining_ui_NPCLocator.instance != null) { + com_davidmaletz_mining_ui_NPCLocator.instance.hide(); + } + com_davidmaletz_mining_ui_NPCLocator.instance = this; + this.player.locateNPC = this.npc.getId(); + } + ,destroy: function(e) { + com_davidmaletz_mining_ui_ObjectLocator.prototype.destroy.call(this,e); + if(com_davidmaletz_mining_ui_NPCLocator.instance == this) { + com_davidmaletz_mining_ui_NPCLocator.instance = null; + } + } + ,handle_frame: function(e) { + com_davidmaletz_mining_ui_ObjectLocator.prototype.handle_frame.call(this,e); + var r = this.npc.getSprite(); + if(r != null && r.stage != null && com_davidmaletz_faengfl_Window.window_ct == 0 && this.get_alpha() == 1 && com_davidmaletz_faengfl_FaengFL.onScreenPt(r,0,0,com_davidmaletz_mining_Main.getContainer(),com_davidmaletz_tiles_Tile.SIZE * 2,0)) { + this.hide(); + } + } + ,show: function() { + com_davidmaletz_mining_ui_GUI.addStaticDisplay(this,2); + this.set_alpha(1); + this.clearTrack(com_davidmaletz_lerp_AlphaKeyframe); + } + ,__class__: com_davidmaletz_mining_ui_NPCLocator +}); +var com_davidmaletz_mining_ui_NewGameList = function(c,halign,valign) { + if(valign == null) { + valign = 0.5; + } + if(halign == null) { + halign = 0.5; + } + com_davidmaletz_mining_network_CloudSaveList.call(this,c,com_fancyfish_faeng_common_Lang.getText("common","newgame"),true,halign,valign); +}; +$hxClasses["com.davidmaletz.mining.ui.NewGameList"] = com_davidmaletz_mining_ui_NewGameList; +com_davidmaletz_mining_ui_NewGameList.__name__ = ["com","davidmaletz","mining","ui","NewGameList"]; +com_davidmaletz_mining_ui_NewGameList.loadSave = function(entry,id,onLoad,colors,offsets,c) { + if(com_davidmaletz_mining_Main.hasSave(id)) { + com_davidmaletz_mining_Main.deleteSave(id,false); + } + com_davidmaletz_faengfl_adv_sound_FadeMusic.set(null,60); + new com_davidmaletz_faengfl_transition_FadeOut(function() { + var p = com_davidmaletz_mining_Main.loadSave(id,colors,offsets,entry); + if(onLoad != null) { + onLoad(p); + } + },60); +}; +com_davidmaletz_mining_ui_NewGameList.newGame = function(id,onLoad,entry) { + var a1 = entry; + var id1 = id; + var a2 = onLoad; + com_davidmaletz_mining_ui_CharacterColorWindow.create(entry,function(a3,a4,c) { + com_davidmaletz_mining_ui_NewGameList.loadSave(a1,id1,a2,a3,a4,c); + }); +}; +com_davidmaletz_mining_ui_NewGameList.load = function(id,onLoad) { + var len = com_davidmaletz_faengfl_adv_ModHandler.entries.length; + if(len == 1) { + com_davidmaletz_mining_ui_NewGameList.newGame(id,onLoad,com_davidmaletz_faengfl_adv_ModHandler.entries[0]); + } else { + var c = com_davidmaletz_mining_Main.getContainer(); + var id1 = id; + var a1 = onLoad; + var tmp = function(a2) { + com_davidmaletz_mining_ui_NewGameList.newGame(id1,a1,a2); + }; + c.addDisplay(new com_davidmaletz_mining_ui_EntryList(c,com_fancyfish_faeng_common_Lang.getText("entry","title"),tmp),2); + } +}; +com_davidmaletz_mining_ui_NewGameList.__super__ = com_davidmaletz_mining_network_CloudSaveList; +com_davidmaletz_mining_ui_NewGameList.prototype = $extend(com_davidmaletz_mining_network_CloudSaveList.prototype,{ + onSelect: function(slot) { + var id = com_davidmaletz_mining_Main.slotToId(slot); + if(com_davidmaletz_mining_Main.hasSave(id)) { + var c = com_davidmaletz_mining_Main.getContainer(); + var id1 = id; + var tmp = function() { + com_davidmaletz_mining_ui_NewGameList.load(id1); + }; + c.addDisplay(new com_davidmaletz_mining_ui_Prompt(c,com_fancyfish_faeng_common_Lang.getText("common","overwrite"),tmp),2); + } else { + com_davidmaletz_mining_ui_NewGameList.load(id); + } + } + ,__class__: com_davidmaletz_mining_ui_NewGameList +}); +var com_davidmaletz_mining_ui_NotificationQueue = function() { }; +$hxClasses["com.davidmaletz.mining.ui.NotificationQueue"] = com_davidmaletz_mining_ui_NotificationQueue; +com_davidmaletz_mining_ui_NotificationQueue.__name__ = ["com","davidmaletz","mining","ui","NotificationQueue"]; +com_davidmaletz_mining_ui_NotificationQueue.showNotification = function(t) { + if((com_davidmaletz_mining_ui_NotificationQueue.OPTIONS & 1) != 0) { + com_davidmaletz_faengfl_FaengFL.remove(t); + return; + } + t.clearLerp(); + t.set_alpha(0); + var t1 = t; + var tmp = function() { + com_davidmaletz_mining_ui_NotificationQueue.next(t1); + }; + t.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),20,tmp); + t.set_x(128.); + if(com_davidmaletz_mining_ui_NotificationQueue.notifications.length > 0) { + var n = com_davidmaletz_mining_ui_NotificationQueue.notifications[com_davidmaletz_mining_ui_NotificationQueue.notifications.length - 1]; + var tmp1 = n.get_y(); + t.set_y(tmp1 - n._height * 0.5); + if(n.hasTrack(com_davidmaletz_lerp_PositionKeyframe)) { + var _k = n.getLerp(com_davidmaletz_lerp_PositionKeyframe); + if(_k != null) { + var k = js_Boot.__cast(_k , com_davidmaletz_lerp_PositionKeyframe); + var tmp2 = new com_davidmaletz_lerp_PositionKeyframe(t.get_x(),k.y - n._height * 0.5); + var tmp3 = Math.round(k.getFrame() - n.getFrame(com_davidmaletz_lerp_PositionKeyframe)); + t.lerp(tmp2,tmp3); + } + } + } else { + t.set_y(142 - t._height * 0.5); + } + t.set_scaleX(0.5); + t.set_scaleY(0.5); + var _remove = null; + _remove = function(e) { + t.removeEventListener("removedFromStage",_remove); + com_davidmaletz_mining_ui_NotificationQueue.remove(t); + }; + var _remove1 = _remove; + t.addEventListener("removedFromStage",_remove1); + com_davidmaletz_mining_ui_NotificationQueue.notifications.push(t); +}; +com_davidmaletz_mining_ui_NotificationQueue.next = function(t) { + var t1 = t; + var tmp = function() { + com_davidmaletz_mining_ui_NotificationQueue.hide(t1); + }; + t.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),80,tmp); +}; +com_davidmaletz_mining_ui_NotificationQueue.hide = function(t) { + var d = t; + var tmp = function() { + com_davidmaletz_faengfl_FaengFL.remove(d); + }; + t.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),20,tmp); +}; +com_davidmaletz_mining_ui_NotificationQueue.remove = function(t) { + var i = com_davidmaletz_mining_ui_NotificationQueue.notifications.indexOf(t); + if(i >= 0 && HxOverrides.remove(com_davidmaletz_mining_ui_NotificationQueue.notifications,t)) { + var _g1 = i; + var _g = com_davidmaletz_mining_ui_NotificationQueue.notifications.length; + while(_g1 < _g) { + var j = _g1++; + var n = com_davidmaletz_mining_ui_NotificationQueue.notifications[j]; + n.lerp(new com_davidmaletz_lerp_PositionKeyframe(n.get_x(),n.get_y() + t._height * 0.5),5); + } + } +}; +var com_davidmaletz_mining_ui_OptionRenderer = function(handler) { + this.handler = handler; +}; +$hxClasses["com.davidmaletz.mining.ui.OptionRenderer"] = com_davidmaletz_mining_ui_OptionRenderer; +com_davidmaletz_mining_ui_OptionRenderer.__name__ = ["com","davidmaletz","mining","ui","OptionRenderer"]; +com_davidmaletz_mining_ui_OptionRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui_OptionRenderer.addIcon = function(s,icon) { + if(icon == null) { + return; + } + var i = s.get_numChildren() - 1; + icon.set_x(0); + icon.set_y(s.getChildAt(i).get_y()); + s.addChildAt(icon,i); +}; +com_davidmaletz_mining_ui_OptionRenderer.prototype = { + handler: null + ,create: function(item,x,y) { + if(Std["is"](item,com_davidmaletz_mining_ui_IntValue)) { + return new com_davidmaletz_mining_ui__$OptionRenderer_PointOption(this.handler,item,x,y); + } else if(Std["is"](item,com_davidmaletz_mining_ui_FloatValue)) { + return new com_davidmaletz_mining_ui__$OptionRenderer_SliderOption(this.handler,item,x,y); + } else if(Std["is"](item,com_davidmaletz_mining_ui_OptionValue)) { + return new com_davidmaletz_mining_ui_ChoiceOption(this.handler,item,x,y); + } else if(Std["is"](item,com_davidmaletz_mining_ui_BoolValue)) { + return new com_davidmaletz_mining_ui__$OptionRenderer_CheckboxOption(this.handler,item,x,y); + } + var id = Std.string(item); + return new com_davidmaletz_mining_ui_StringButton(this.handler,com_davidmaletz_mining_ui_StringRenderer.mutableFromId("options",id),id,x,y,170,com_davidmaletz_mining_ui_StringRenderer._getHeight()); + } + ,update: function(s,item) { + } + ,getWidth: function() { + return 170; + } + ,getHeight: function(item) { + return com_davidmaletz_mining_ui_StringRenderer._getHeight(); + } + ,__class__: com_davidmaletz_mining_ui_OptionRenderer +}; +var com_davidmaletz_mining_ui_AdjustOption = function() { }; +$hxClasses["com.davidmaletz.mining.ui.AdjustOption"] = com_davidmaletz_mining_ui_AdjustOption; +com_davidmaletz_mining_ui_AdjustOption.__name__ = ["com","davidmaletz","mining","ui","AdjustOption"]; +com_davidmaletz_mining_ui_AdjustOption.prototype = { + prevValue: null + ,nextValue: null + ,__class__: com_davidmaletz_mining_ui_AdjustOption +}; +var com_davidmaletz_mining_ui__$OptionRenderer_CheckboxOption = function(h,i,x,y) { + var ht = com_davidmaletz_mining_ui_StringRenderer._getHeight(); + var c = ht - 3; + com_davidmaletz_mining_ui_StringButton.call(this,h,i.getLabel(),i.id,x,y,170,ht,0,170 - c - 4); + this.value = i; + var _g = this.getChildAt(this.get_numChildren() - 1); + _g.set_x(_g.get_x() + (c + 4)); + var box = new com_davidmaletz_faengfl_SolidDrawable(16777215,c,c,1).create(1,1); + this.addChild(box); + this.check = new com_davidmaletz_faengfl_SolidDrawable(0,c - 4,c - 4).create(3,3); + this.check.set_visible(i.getValue()); + this.addChild(this.check); +}; +$hxClasses["com.davidmaletz.mining.ui._OptionRenderer.CheckboxOption"] = com_davidmaletz_mining_ui__$OptionRenderer_CheckboxOption; +com_davidmaletz_mining_ui__$OptionRenderer_CheckboxOption.__name__ = ["com","davidmaletz","mining","ui","_OptionRenderer","CheckboxOption"]; +com_davidmaletz_mining_ui__$OptionRenderer_CheckboxOption.__super__ = com_davidmaletz_mining_ui_StringButton; +com_davidmaletz_mining_ui__$OptionRenderer_CheckboxOption.prototype = $extend(com_davidmaletz_mining_ui_StringButton.prototype,{ + value: null + ,check: null + ,onClick: function() { + this.value.setValue(!this.value.getValue()); + this.check.set_visible(this.value.getValue()); + return true; + } + ,__class__: com_davidmaletz_mining_ui__$OptionRenderer_CheckboxOption +}); +var com_davidmaletz_mining_ui__$OptionRenderer_PointOption = function(h,i,x,y) { + com_davidmaletz_mining_ui_StringButton.call(this,h,i.getLabel(),i.id,x,y,80,com_davidmaletz_mining_ui_StringRenderer._getHeight(),2); + com_davidmaletz_mining_ui_OptionRenderer.addIcon(this,i.getIcon()); + this.value = i; + this.points = new com_davidmaletz_mining_ui_Points(this.value.start,this.value.max,this.value.getValue(),$bind(this,this._setValue)); + this.points.set_x(84); + this.points.set_y(Math.floor((com_davidmaletz_mining_ui_StringRenderer._getHeight() - this.points.getHeight()) * 0.5)); + this.addChild(this.points); +}; +$hxClasses["com.davidmaletz.mining.ui._OptionRenderer.PointOption"] = com_davidmaletz_mining_ui__$OptionRenderer_PointOption; +com_davidmaletz_mining_ui__$OptionRenderer_PointOption.__name__ = ["com","davidmaletz","mining","ui","_OptionRenderer","PointOption"]; +com_davidmaletz_mining_ui__$OptionRenderer_PointOption.__interfaces__ = [com_davidmaletz_mining_ui_AdjustOption]; +com_davidmaletz_mining_ui__$OptionRenderer_PointOption.__super__ = com_davidmaletz_mining_ui_StringButton; +com_davidmaletz_mining_ui__$OptionRenderer_PointOption.prototype = $extend(com_davidmaletz_mining_ui_StringButton.prototype,{ + points: null + ,value: null + ,_setValue: function(v) { + this.setValue(v); + } + ,setValue: function(v) { + var v1 = com_fancyfish_faeng_common_Utils.clampi(v,this.value.start,this.value.max); + var old = this.value.getValue(); + this.value.setValue(v1); + v1 = this.value.getValue(); + if(v1 != old) { + this.points.setValue(v1); + return true; + } else { + return false; + } + } + ,prevValue: function() { + return this.setValue(this.value.getValue() - 1); + } + ,nextValue: function() { + return this.setValue(this.value.getValue() + 1); + } + ,__class__: com_davidmaletz_mining_ui__$OptionRenderer_PointOption +}); +var com_davidmaletz_mining_ui__$OptionRenderer_SliderOption = function(h,i,x,y) { + com_davidmaletz_mining_ui_StringButton.call(this,h,i.getLabel(),i.id,x,y,80,com_davidmaletz_mining_ui_StringRenderer._getHeight(),2); + com_davidmaletz_mining_ui_OptionRenderer.addIcon(this,i.getIcon()); + this.slider = new com_davidmaletz_controls_Slider(86,i.getValue()); + this.slider.addEventListener("value_changed",$bind(this,this.updateValue)); + this.slider.set_x(84); + this.slider.set_y(Math.floor((com_davidmaletz_mining_ui_StringRenderer._getHeight() - this.slider.getHeight()) * 0.5)); + this.value = i; + this.addChild(this.slider); +}; +$hxClasses["com.davidmaletz.mining.ui._OptionRenderer.SliderOption"] = com_davidmaletz_mining_ui__$OptionRenderer_SliderOption; +com_davidmaletz_mining_ui__$OptionRenderer_SliderOption.__name__ = ["com","davidmaletz","mining","ui","_OptionRenderer","SliderOption"]; +com_davidmaletz_mining_ui__$OptionRenderer_SliderOption.__interfaces__ = [com_davidmaletz_mining_ui_AdjustOption]; +com_davidmaletz_mining_ui__$OptionRenderer_SliderOption.__super__ = com_davidmaletz_mining_ui_StringButton; +com_davidmaletz_mining_ui__$OptionRenderer_SliderOption.prototype = $extend(com_davidmaletz_mining_ui_StringButton.prototype,{ + slider: null + ,value: null + ,setValue: function(v) { + var v1 = com_fancyfish_faeng_common_Utils.clamp(v,0,1); + var ret = this.slider.getValue() != v1; + if(ret) { + this.slider.setValue(v1); + } + return ret; + } + ,prevValue: function() { + return this.setValue(this.slider.getValue() - 0.0625); + } + ,nextValue: function() { + return this.setValue(this.slider.getValue() + 0.0625); + } + ,updateValue: function(e) { + this.value.setValue(this.slider.getValue()); + } + ,__class__: com_davidmaletz_mining_ui__$OptionRenderer_SliderOption +}); +var com_davidmaletz_mining_ui_ChoiceOption = function(h,i,x,y) { + var ht = com_davidmaletz_mining_ui_StringRenderer._getHeight(); + com_davidmaletz_mining_ui_StringButton.call(this,h,i.getLabel(),i.id,x,y,80,ht,2); + com_davidmaletz_mining_ui_OptionRenderer.addIcon(this,i.getIcon()); + var sz = i.getSize(); + var o = i.getOption(); + this.option = new com_davidmaletz_faengfl_TextSprite(i.optionToString(o),new com_fancyfish_faeng_text_CharacterPlacer(86,1),i.getColor(o),sz); + this.option.set_x(84); + this.option.set_y(Math.round(com_davidmaletz_mining_ui_StringRenderer._getHeight() * (1 - sz) * 0.5)); + this.value = i; + this.addChild(this.option); + var w = 20; + var bg = com_davidmaletz_mining_Main.label_factory.createBG(w,ht); + var hover = com_davidmaletz_mining_Main.label_factory.createHover(w,ht); + var b = new com_davidmaletz_controls_StaticButton(this.option.get_x(),0,bg,hover,new com_fancyfish_faeng_common_mutable_Static("<")); + b.onClickFunc = $bind(this,this.prevValue); + this.addChild(b); + var b1 = new com_davidmaletz_controls_StaticButton(170 - w,0,bg,hover,new com_fancyfish_faeng_common_mutable_Static(">")); + b1.onClickFunc = $bind(this,this.nextValue); + this.addChild(b1); +}; +$hxClasses["com.davidmaletz.mining.ui.ChoiceOption"] = com_davidmaletz_mining_ui_ChoiceOption; +com_davidmaletz_mining_ui_ChoiceOption.__name__ = ["com","davidmaletz","mining","ui","ChoiceOption"]; +com_davidmaletz_mining_ui_ChoiceOption.__interfaces__ = [com_davidmaletz_mining_ui_AdjustOption]; +com_davidmaletz_mining_ui_ChoiceOption.__super__ = com_davidmaletz_mining_ui_StringButton; +com_davidmaletz_mining_ui_ChoiceOption.prototype = $extend(com_davidmaletz_mining_ui_StringButton.prototype,{ + option: null + ,value: null + ,init: function(e) { + com_davidmaletz_mining_ui_StringButton.prototype.init.call(this,e); + if(this.value.id == "fullscreen") { + openfl_Lib.current.stage.addEventListener("fullScreen",$bind(this,this.fullscreen)); + } else if(this.value.id == "mute") { + com_davidmaletz_mining_Main._addEventListener("mute",$bind(this,this.mute)); + } + } + ,destroy: function(e) { + com_davidmaletz_mining_ui_StringButton.prototype.destroy.call(this,e); + if(this.value.id == "fullscreen") { + openfl_Lib.current.stage.removeEventListener("fullScreen",$bind(this,this.fullscreen)); + } else if(this.value.id == "mute") { + com_davidmaletz_mining_Main._removeEventListener("mute",$bind(this,this.mute)); + } + } + ,mute: function(e) { + this.option.setText(this.value.optionToString(com_davidmaletz_faengfl_SoundManager.isMuted() ? 1 : 0)); + } + ,fullscreen: function(e) { + this.option.setText(this.value.optionToString(e.fullScreen ? 1 : 0)); + } + ,setValue: function(o) { + var old = this.value.getOption(); + this.value.setOption(o); + var o1 = this.value.getOption(); + this.option.setText(this.value.optionToString(o1)); + com_davidmaletz_faengfl_TextSprite.setColor(this.option,this.value.getColor(o1)); + return o1 != old; + } + ,update: function() { + var o = this.value.getOption(); + this.option.setText(this.value.optionToString(o)); + com_davidmaletz_faengfl_TextSprite.setColor(this.option,this.value.getColor(o)); + } + ,prevValue: function() { + return this.setValue(this.value.getOption() - 1); + } + ,nextValue: function() { + return this.setValue(this.value.getOption() + 1); + } + ,__class__: com_davidmaletz_mining_ui_ChoiceOption +}); +var com_davidmaletz_mining_ui__$Options_MusicVol = function(id) { + com_davidmaletz_mining_ui_FloatValue.call(this,id); +}; +$hxClasses["com.davidmaletz.mining.ui._Options.MusicVol"] = com_davidmaletz_mining_ui__$Options_MusicVol; +com_davidmaletz_mining_ui__$Options_MusicVol.__name__ = ["com","davidmaletz","mining","ui","_Options","MusicVol"]; +com_davidmaletz_mining_ui__$Options_MusicVol.__super__ = com_davidmaletz_mining_ui_FloatValue; +com_davidmaletz_mining_ui__$Options_MusicVol.prototype = $extend(com_davidmaletz_mining_ui_FloatValue.prototype,{ + getValue: function() { + return com_davidmaletz_faengfl_SoundManager.getBGMVol(); + } + ,setValue: function(val) { + com_davidmaletz_faengfl_SoundManager.setBGMVol(val); + } + ,__class__: com_davidmaletz_mining_ui__$Options_MusicVol +}); +var com_davidmaletz_mining_ui__$Options_SFXVol = function(id) { + com_davidmaletz_mining_ui_FloatValue.call(this,id); +}; +$hxClasses["com.davidmaletz.mining.ui._Options.SFXVol"] = com_davidmaletz_mining_ui__$Options_SFXVol; +com_davidmaletz_mining_ui__$Options_SFXVol.__name__ = ["com","davidmaletz","mining","ui","_Options","SFXVol"]; +com_davidmaletz_mining_ui__$Options_SFXVol.__super__ = com_davidmaletz_mining_ui_FloatValue; +com_davidmaletz_mining_ui__$Options_SFXVol.prototype = $extend(com_davidmaletz_mining_ui_FloatValue.prototype,{ + getValue: function() { + return com_davidmaletz_faengfl_SoundManager.getSFXVol(); + } + ,setValue: function(val) { + com_davidmaletz_faengfl_SoundManager.setSFXVol(val); + } + ,__class__: com_davidmaletz_mining_ui__$Options_SFXVol +}); +var com_davidmaletz_mining_ui__$Options_Mute = function(id) { + com_davidmaletz_mining_ui_OptionValue.call(this,id); +}; +$hxClasses["com.davidmaletz.mining.ui._Options.Mute"] = com_davidmaletz_mining_ui__$Options_Mute; +com_davidmaletz_mining_ui__$Options_Mute.__name__ = ["com","davidmaletz","mining","ui","_Options","Mute"]; +com_davidmaletz_mining_ui__$Options_Mute.__super__ = com_davidmaletz_mining_ui_OptionValue; +com_davidmaletz_mining_ui__$Options_Mute.prototype = $extend(com_davidmaletz_mining_ui_OptionValue.prototype,{ + getOption: function() { + if(com_davidmaletz_faengfl_SoundManager.isMuted()) { + return 1; + } else { + return 0; + } + } + ,setOption: function(o) { + if(this.getOption() != o) { + com_davidmaletz_faengfl_SoundManager.setMuted(!com_davidmaletz_faengfl_SoundManager.isMuted()); + } + } + ,optionToString: function(o) { + switch(o) { + case 0: + return com_fancyfish_faeng_common_Lang.getText("common","no"); + case 1: + return com_fancyfish_faeng_common_Lang.getText("common","yes"); + default: + return null; + } + } + ,getLabel: function() { + return com_fancyfish_faeng_common_Lang.getText("controls",this.id); + } + ,__class__: com_davidmaletz_mining_ui__$Options_Mute +}); +var com_davidmaletz_mining_ui__$Options_Difficulty = function(id) { + com_davidmaletz_mining_ui_OptionValue.call(this,id); +}; +$hxClasses["com.davidmaletz.mining.ui._Options.Difficulty"] = com_davidmaletz_mining_ui__$Options_Difficulty; +com_davidmaletz_mining_ui__$Options_Difficulty.__name__ = ["com","davidmaletz","mining","ui","_Options","Difficulty"]; +com_davidmaletz_mining_ui__$Options_Difficulty.__super__ = com_davidmaletz_mining_ui_OptionValue; +com_davidmaletz_mining_ui__$Options_Difficulty.prototype = $extend(com_davidmaletz_mining_ui_OptionValue.prototype,{ + getOption: function() { + return com_davidmaletz_mining_DifficultyMode.getIndex(com_davidmaletz_mining_DifficultyMode.getCurrent()); + } + ,setOption: function(o) { + var len = com_davidmaletz_mining_DifficultyMode.getCount(); + if(o < 0) { + o += len; + } else if(o >= len) { + o -= len; + } + if(o != this.getOption()) { + com_davidmaletz_mining_DifficultyMode.setCurrent(com_davidmaletz_mining_DifficultyMode.getByIndex(o)); + } + } + ,optionToString: function(o) { + var m = com_davidmaletz_mining_DifficultyMode.getByIndex(o); + if(m == null) { + return com_fancyfish_faeng_common_Lang.getText("colors","custom"); + } else { + return com_fancyfish_faeng_common_Lang.getText("difficulty",m.id); + } + } + ,__class__: com_davidmaletz_mining_ui__$Options_Difficulty +}); +var com_davidmaletz_mining_ui__$Options_Language = function(id) { + com_davidmaletz_mining_ui_OptionValue.call(this,id); +}; +$hxClasses["com.davidmaletz.mining.ui._Options.Language"] = com_davidmaletz_mining_ui__$Options_Language; +com_davidmaletz_mining_ui__$Options_Language.__name__ = ["com","davidmaletz","mining","ui","_Options","Language"]; +com_davidmaletz_mining_ui__$Options_Language.__super__ = com_davidmaletz_mining_ui_OptionValue; +com_davidmaletz_mining_ui__$Options_Language.prototype = $extend(com_davidmaletz_mining_ui_OptionValue.prototype,{ + getOption: function() { + return com_fancyfish_faeng_common_Lang.getLanguageIdx(); + } + ,setOption: function(o) { + var len = com_fancyfish_faeng_common_Lang.languageCount(); + if(o < 0) { + o += len; + } else if(o >= len) { + o -= len; + } + if(o != this.getOption()) { + var code = com_fancyfish_faeng_common_Lang.getLanguage(o); + com_fancyfish_faeng_common_Lang.setLang(code); + Reflect.setField(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"language",code); + } + } + ,optionToString: function(o) { + return new com_fancyfish_faeng_common_mutable_Static(com_fancyfish_faeng_common_Lang.getLanguageName(com_fancyfish_faeng_common_Lang.getLanguage(o))); + } + ,updateSettings: function() { + var lang = Reflect.field(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"language"); + if(lang == null || !com_fancyfish_faeng_common_Lang.exists(lang)) { + lang = com_fancyfish_faeng_common_Lang.getDefaultLanguage(); + } + com_fancyfish_faeng_common_Lang.setLang(lang); + } + ,getColor: function(o) { + var i = com_davidmaletz_faengfl_adv_ModHandler.getModInfo("core"); + var version = i == null ? "0.0.0" : i.version; + var l = com_fancyfish_faeng_common_Lang.getLang(com_fancyfish_faeng_common_Lang.getLanguage(o)); + var v = new EReg("[a-zA-Z]","g").replace(version,""); + if(l.version == v) { + return 0; + } else { + return 10027008; + } + } + ,__class__: com_davidmaletz_mining_ui__$Options_Language +}); +var com_davidmaletz_mining_ui_Options = function(c,inGame) { + var len = com_davidmaletz_mining_ui_Options.ITEMS.length + 1; + if(!inGame) { + ++len; + } + com_davidmaletz_controls_ListWindow.call(this,c,com_davidmaletz_mining_Main.window_factory,new com_davidmaletz_mining_ui_OptionRenderer(this),len,1,true,true,false,0.5,0.3,8); + var mp = false; + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,com_fancyfish_faeng_common_Lang.getText("options",inGame && !mp ? "paused" : "options"),this.getWidth()); + len = com_davidmaletz_mining_ui_Options.ITEMS.length - 1; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + this.addItem(com_davidmaletz_mining_ui_Options.ITEMS[i]); + } + if(inGame) { + this.addItem("title"); + } else { + this.addItem("import"); + this.addItem("export"); + } + this.addItem(com_davidmaletz_mining_ui_Options.ITEMS[com_davidmaletz_mining_ui_Options.ITEMS.length - 1]); +}; +$hxClasses["com.davidmaletz.mining.ui.Options"] = com_davidmaletz_mining_ui_Options; +com_davidmaletz_mining_ui_Options.__name__ = ["com","davidmaletz","mining","ui","Options"]; +com_davidmaletz_mining_ui_Options.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_Options.updateSettings = function() { + var _g = 0; + var _g1 = com_davidmaletz_mining_ui_Options.ITEMS; + while(_g < _g1.length) { + var i = _g1[_g]; + ++_g; + if(Std["is"](i,com_davidmaletz_mining_ui_OptionValue)) { + (js_Boot.__cast(i , com_davidmaletz_mining_ui_OptionValue)).updateSettings(); + } else if(Std["is"](i,com_davidmaletz_mining_ui_FloatValue)) { + (js_Boot.__cast(i , com_davidmaletz_mining_ui_FloatValue)).updateSettings(); + } else if(Std["is"](i,com_davidmaletz_mining_ui_BoolValue)) { + (js_Boot.__cast(i , com_davidmaletz_mining_ui_BoolValue)).updateSettings(); + } else if(Std["is"](i,com_davidmaletz_mining_ui_IntValue)) { + (js_Boot.__cast(i , com_davidmaletz_mining_ui_IntValue)).updateSettings(); + } + } +}; +com_davidmaletz_mining_ui_Options.addFullscreenOption = function() { + var _this = com_davidmaletz_mining_ui_Options.ITEMS; + var x = new com_davidmaletz_mining_ui__$Options_Fullscreen("fullscreen"); + _this.splice(4,0,x); +}; +com_davidmaletz_mining_ui_Options.titleScreen = function() { + new com_davidmaletz_faengfl_transition_FadeOut(com_davidmaletz_mining_Main.titleScreen,60); +}; +com_davidmaletz_mining_ui_Options.importFile = function(file) { + var save = com_davidmaletz_mining_Main.importSlot(file); + if(save == null) { + var c = com_davidmaletz_faengfl_adv_AdvApp.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_DialogueBox(c,com_fancyfish_faeng_common_Lang.getText("options","import_fail").get()),2); + return; + } + var c1 = com_davidmaletz_faengfl_adv_AdvApp.getContainer(); + c1.addDisplay(new com_davidmaletz_mining_ui_ImportList(c1,save.data,save.header),2); +}; +com_davidmaletz_mining_ui_Options.saveFile = function(slot) { + var slotName = com_davidmaletz_mining_Main.slotToId(slot); + var data = com_davidmaletz_mining_Main.exportSlot(slotName); + if(data == null) { + var c = com_davidmaletz_faengfl_adv_AdvApp.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_DialogueBox(c,com_fancyfish_faeng_common_Lang.getText("options","export_fail").get()),2); + return; + } + var link = window.document.createElement('a'); + var h = com_davidmaletz_mining_Main.getSlotHeader(slotName); + var t = ""; + if(typeof(h) != "boolean" && h.area_name != null) { + t = h.area_name.replace(/\W/g, '') + "_"; + } + link.download = t + slotName + ".asav"; + link.href = window.URL.createObjectURL(new Blob([data], {type: 'text/plain'})); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); window.URL.revokeObjectURL(link.href); +}; +com_davidmaletz_mining_ui_Options.__super__ = com_davidmaletz_controls_ListWindow; +com_davidmaletz_mining_ui_Options.prototype = $extend(com_davidmaletz_controls_ListWindow.prototype,{ + init: function(e) { + com_davidmaletz_controls_ListWindow.prototype.init.call(this,e); + com_davidmaletz_controls_Controller.instance.addEventListener("tap",$bind(this,this.tap),false,com_davidmaletz_faengfl_Window.window_ct + 1); + } + ,destroy: function(e) { + com_davidmaletz_controls_ListWindow.prototype.destroy.call(this,e); + com_davidmaletz_controls_Controller.instance.removeEventListener("tap",$bind(this,this.tap)); + if(e != null) { + com_davidmaletz_faengfl_adv_AdvApp.settings.flush(); + } + } + ,tap: function(e) { + var left = e.key == "left"; + var right = e.key == "right"; + var sel = this.clickables.getSelected(); + if((left || right) && Std["is"](sel,com_davidmaletz_mining_ui_AdjustOption)) { + var a = js_Boot.__cast(sel , com_davidmaletz_mining_ui_AdjustOption); + if(left) { + if(a.prevValue()) { + com_davidmaletz_faengfl_adv_sound_Sound.play("move"); + } + } else if(a.nextValue()) { + com_davidmaletz_faengfl_adv_sound_Sound.play("move"); + } + e.stopImmediatePropagation(); + } + } + ,onSelect: function(str) { + switch(str) { + case "back": + this.close(); + break; + case "controls": + var c = com_davidmaletz_faengfl_adv_AdvApp.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_Controls(c),2); + break; + case "export": + var c1 = com_davidmaletz_faengfl_adv_AdvApp.getContainer(); + c1.addDisplay(new com_davidmaletz_mining_ui_ExportList(c1),2); + break; + case "gameplay": + var c2 = com_davidmaletz_faengfl_adv_AdvApp.getContainer(); + c2.addDisplay(new com_davidmaletz_mining_ui_GameplayOptions(c2),2); + break; + case "import": + var c3 = com_davidmaletz_faengfl_adv_AdvApp.getContainer(); + c3.addDisplay(new com_davidmaletz_mining_ui_DialogueBox(c3,com_fancyfish_faeng_common_Lang.getText("options","import_html5").get()),2); + break; + case "title": + if(com_davidmaletz_mining_Main.sinceLastSave() < 10) { + com_davidmaletz_mining_ui_Options.titleScreen(); + } else { + var c4 = com_davidmaletz_faengfl_adv_AdvApp.getContainer(); + c4.addDisplay(new com_davidmaletz_mining_ui_Prompt(c4,com_fancyfish_faeng_common_Lang.getText("options","quitgame"),com_davidmaletz_mining_ui_Options.titleScreen),2); + } + break; + case "ui": + var c5 = com_davidmaletz_faengfl_adv_AdvApp.getContainer(); + c5.addDisplay(new com_davidmaletz_mining_ui_UIOptions(c5),2); + break; + } + } + ,onHover: function(item) { + } + ,isEnabled: function(item) { + return true; + } + ,__class__: com_davidmaletz_mining_ui_Options +}); +var com_davidmaletz_mining_ui_IntValue = function(id,s,m) { + this.id = id; + this.start = s; + this.max = m; +}; +$hxClasses["com.davidmaletz.mining.ui.IntValue"] = com_davidmaletz_mining_ui_IntValue; +com_davidmaletz_mining_ui_IntValue.__name__ = ["com","davidmaletz","mining","ui","IntValue"]; +com_davidmaletz_mining_ui_IntValue.__interfaces__ = [AbstractClass]; +com_davidmaletz_mining_ui_IntValue.prototype = { + id: null + ,start: null + ,max: null + ,getValue: function() { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,setValue: function(val) { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,getIcon: function() { + return null; + } + ,getLabel: function() { + return com_fancyfish_faeng_common_Lang.getText("options",this.id); + } + ,updateSettings: function() { + } + ,__class__: com_davidmaletz_mining_ui_IntValue +}; +var com_davidmaletz_mining_ui__$Options_Fullscreen = function(id) { + com_davidmaletz_mining_ui_OptionValue.call(this,id); +}; +$hxClasses["com.davidmaletz.mining.ui._Options.Fullscreen"] = com_davidmaletz_mining_ui__$Options_Fullscreen; +com_davidmaletz_mining_ui__$Options_Fullscreen.__name__ = ["com","davidmaletz","mining","ui","_Options","Fullscreen"]; +com_davidmaletz_mining_ui__$Options_Fullscreen.__super__ = com_davidmaletz_mining_ui_OptionValue; +com_davidmaletz_mining_ui__$Options_Fullscreen.prototype = $extend(com_davidmaletz_mining_ui_OptionValue.prototype,{ + getOption: function() { + if(com_davidmaletz_faengfl_adv_AdvApp.isFullscreen()) { + return 1; + } else { + return 0; + } + } + ,setOption: function(o) { + if(this.getOption() != o) { + com_davidmaletz_faengfl_adv_AdvApp.toggleFullscreen(); + } + } + ,optionToString: function(o) { + switch(o) { + case 0: + return com_fancyfish_faeng_common_Lang.getText("common","no"); + case 1: + return com_fancyfish_faeng_common_Lang.getText("common","yes"); + default: + return null; + } + } + ,updateSettings: function() { + } + ,__class__: com_davidmaletz_mining_ui__$Options_Fullscreen +}); +var com_davidmaletz_mining_ui_OxygenBar = function(o,s) { + var p = o.getOxygenPercent(); + com_davidmaletz_mining_ui_MyBar.call(this,"oxygen",50,3,16777215,p); + this.object = o; + this.set_x(12); + if(s != null) { + this.status = s; + this.set_visible(p < 1); + } +}; +$hxClasses["com.davidmaletz.mining.ui.OxygenBar"] = com_davidmaletz_mining_ui_OxygenBar; +com_davidmaletz_mining_ui_OxygenBar.__name__ = ["com","davidmaletz","mining","ui","OxygenBar"]; +com_davidmaletz_mining_ui_OxygenBar.__super__ = com_davidmaletz_mining_ui_MyBar; +com_davidmaletz_mining_ui_OxygenBar.prototype = $extend(com_davidmaletz_mining_ui_MyBar.prototype,{ + object: null + ,status: null + ,init: function(e) { + com_davidmaletz_mining_ui_MyBar.prototype.init.call(this,e); + this.object.addEventListener("change_oxygen",$bind(this,this.update)); + this.update(null); + } + ,destroy: function(e) { + com_davidmaletz_mining_ui_MyBar.prototype.destroy.call(this,e); + this.object.removeEventListener("change_oxygen",$bind(this,this.update)); + } + ,update: function(e) { + var p = this.object.getOxygenPercent(); + this.setProgress(p,5); + if(this.status != null && this.get_visible() != p < 1) { + this.set_visible(p < 1); + this.status.updateVisible(this); + } + } + ,__class__: com_davidmaletz_mining_ui_OxygenBar +}); +var com_davidmaletz_mining_ui_PlanetRenderer = function(p,h) { + openfl_display_Sprite.call(this); + this.planet = p; + this.handler = h; + var t = com_davidmaletz_tiles_Tile.get(p.xml.get("tile")); + if(t != null) { + var anim = p.xml.get("animation"); + if(anim != null) { + this.addChild(new com_davidmaletz_tiles_render_StaticPlayAnimation(t,anim,com_davidmaletz_mining_enemy_AttackRenderer.getFPS(p.xml,10),true)); + } else { + this.addChild(com_davidmaletz_tiles_Tile.makeIcon(t)); + } + } + var d = com_davidmaletz_faengfl_adv_ModHandler.getData("renderOverlay","planet"); + if(d != null) { + com_davidmaletz_mining_structure_Structure._addOverlay(d.xml,p,null,null,this,false); + } + this.selector = new com_davidmaletz_tiles_render_StaticPlayAnimation(com_davidmaletz_tiles_Tile.get("nav.select"),"nav.select",10,true); + this.selector.set_visible(false); + this.addChild(this.selector); + if(p.xml.exists("offsetX")) { + this.set_x(com_davidmaletz_mining_Main.parseInt(p.xml.get("offsetX"))); + } + if(p.xml.exists("offsetY")) { + this.set_y(com_davidmaletz_mining_Main.parseInt(p.xml.get("offsetY"))); + } + if(p.xml.exists("orbitOffX")) { + var _g = this; + _g.set_x(_g.get_x() + com_davidmaletz_mining_Main.parseInt(p.xml.get("orbitOffX"))); + } + if(p.xml.exists("orbitOffY")) { + var _g1 = this; + _g1.set_y(_g1.get_y() + com_davidmaletz_mining_Main.parseInt(p.xml.get("orbitOffY"))); + } + if(t == null) { + this.bounds = new openfl_geom_Rectangle(); + } else { + var tb = t.getTileBase(); + var s = tb.sheet; + var f = s.getFrame(tb.x,tb.y); + var r = s.getTileRect2(tb.x,tb.y); + this.bounds = new openfl_geom_Rectangle(this.get_x() + tb.offsetX,this.get_y() + tb.offsetY,r.width,r.height); + if(f != null) { + this.bounds.x += f.offsetX; + this.bounds.y += f.offsetY; + } + } + this.selector.set_x(Math.round(this.bounds.x - this.get_x() + this.bounds.width * 0.5)); + this.selector.set_y(Math.round(this.bounds.y - this.get_y() + this.bounds.height * 0.5)); +}; +$hxClasses["com.davidmaletz.mining.ui.PlanetRenderer"] = com_davidmaletz_mining_ui_PlanetRenderer; +com_davidmaletz_mining_ui_PlanetRenderer.__name__ = ["com","davidmaletz","mining","ui","PlanetRenderer"]; +com_davidmaletz_mining_ui_PlanetRenderer.__interfaces__ = [com_davidmaletz_controls_Clickable]; +com_davidmaletz_mining_ui_PlanetRenderer.__super__ = openfl_display_Sprite; +com_davidmaletz_mining_ui_PlanetRenderer.prototype = $extend(openfl_display_Sprite.prototype,{ + planet: null + ,handler: null + ,bounds: null + ,selector: null + ,getPos: function() { + return this.bounds; + } + ,onHover: function(hover) { + this.selector.set_visible(hover); + if(this.handler != null) { + this.handler.onHover(hover ? this.planet : null); + } + } + ,onClick: function() { + if(this.handler != null) { + this.handler.onSelect(this.planet); + } + return true; + } + ,canSelect: function() { + return this.get_visible(); + } + ,__class__: com_davidmaletz_mining_ui_PlanetRenderer +}); +var com_davidmaletz_mining_ui_PlayerEquipment = function(object,c) { + this.vanity = new com_davidmaletz_mining_ui__$PlayerEquipment_VanitySlots(this,object); + com_davidmaletz_mining_ui_EquipmentWindow.call(this,object,c,null,2); + var d = this.list.getItemWidth() - com_davidmaletz_tiles_Tile.SIZE - 4; + var l = this.list.list; + l._width -= d; + var s = this.list.scrollbar; + var _g = s; + _g.set_x(_g.get_x() - d); +}; +$hxClasses["com.davidmaletz.mining.ui.PlayerEquipment"] = com_davidmaletz_mining_ui_PlayerEquipment; +com_davidmaletz_mining_ui_PlayerEquipment.__name__ = ["com","davidmaletz","mining","ui","PlayerEquipment"]; +com_davidmaletz_mining_ui_PlayerEquipment.allocateSkill = function(player) { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_SkillWindow(c,player,com_fancyfish_faeng_common_Lang.getText("skill","allocate")),2); +}; +com_davidmaletz_mining_ui_PlayerEquipment.__super__ = com_davidmaletz_mining_ui_EquipmentWindow; +com_davidmaletz_mining_ui_PlayerEquipment.prototype = $extend(com_davidmaletz_mining_ui_EquipmentWindow.prototype,{ + vanity: null + ,addSlot: function(slot) { + this.addItem(slot); + this.list.addMixedItem(slot,this.vanity.renderer); + } + ,getHeight: function() { + return 118; + } + ,getSlotsWidth: function() { + return com_davidmaletz_mining_ui_EquipmentWindow.prototype.getSlotsWidth.call(this) - this.list.getItemWidth() + com_davidmaletz_tiles_Tile.SIZE + 4; + } + ,addInfo: function(width) { + var player = js_Boot.__cast(this.object , com_davidmaletz_mining_Player); + var e = new com_davidmaletz_mining_ui_CharacterPanel(player,this.getInfoWidth() + 8,Math.round(this.getHeight() - 3)); + e.set_x(width - 1); + this.addChild(e); + var WIDTH = 106; + if(player.getInfo().getStats(player).hasNext()) { + var stats = new com_davidmaletz_mining_ui_TextButton(this.getWidth(),e.stat_button_y,com_fancyfish_faeng_common_Lang.getText("stats","view"),$bind(this,this.viewStats),WIDTH); + this.addChild(stats); + this.clickables.addClickable(stats,this); + var dx = 3 + WIDTH; + var _g = stats; + _g.set_x(_g.get_x() - dx); + stats.getPos().x -= dx; + } + if(player.getLevel() != 0 && player.getInfo().getSkills().hasNext()) { + var WIDTH1 = 106; + var a1 = player; + var skill = function() { + com_davidmaletz_mining_ui_PlayerEquipment.allocateSkill(a1); + }; + var skill1 = new com_davidmaletz_mining_ui_TextButton(this.getWidth(),this.getHeight(),com_fancyfish_faeng_common_Lang.getText("skill","allocate"),skill,WIDTH1); + this.addChild(skill1); + this.clickables.addClickable(skill1,this); + var dx1 = 3 + WIDTH1; + var _g1 = skill1; + _g1.set_x(_g1.get_x() - dx1); + skill1.getPos().x -= dx1; + } + } + ,_showInventory: function() { + com_davidmaletz_mining_ui_GUI.showInventory(this.object); + } + ,viewStats: function() { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_StatsWindow(c,this.object,com_fancyfish_faeng_common_Lang.getText("stats","view")),2); + } + ,__class__: com_davidmaletz_mining_ui_PlayerEquipment +}); +var com_davidmaletz_mining_ui__$PlayerEquipment_VanitySlots = function(e,p) { + this.equipment = e; + this.object = new com_davidmaletz_mining_ui_VanityEquip(p); + this.renderer = new com_davidmaletz_mining_ui_EquipmentSlotRenderer(this,p.vanity,null,true); +}; +$hxClasses["com.davidmaletz.mining.ui._PlayerEquipment.VanitySlots"] = com_davidmaletz_mining_ui__$PlayerEquipment_VanitySlots; +com_davidmaletz_mining_ui__$PlayerEquipment_VanitySlots.__name__ = ["com","davidmaletz","mining","ui","_PlayerEquipment","VanitySlots"]; +com_davidmaletz_mining_ui__$PlayerEquipment_VanitySlots.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui__$PlayerEquipment_VanitySlots.prototype = { + renderer: null + ,equipment: null + ,object: null + ,onSelect: function(item) { + if(this.object.getEquipment().get(item) != null) { + com_davidmaletz_mining_ui_EquipmentWindow._onSelect("vanity",this.object,item,this); + } else { + this.object.getOwner().showWarning(com_fancyfish_faeng_common_Lang.getText("equipment","vanity_fail")); + } + } + ,onHover: function(item) { + var eq = this.object.getEquipment(); + if(item == null || eq.get(item) == null) { + this.equipment.onHover(null); + } else if(eq.getItem(item) == null) { + this.equipment.details.setText(com_fancyfish_faeng_common_Lang.getText("equipment","vanity")); + } else { + var old = this.equipment.object; + this.equipment.object = this.object; + this.equipment.onHover(item); + this.equipment.object = old; + } + } + ,isEnabled: function(item) { + return true; + } + ,__class__: com_davidmaletz_mining_ui__$PlayerEquipment_VanitySlots +}; +var com_davidmaletz_mining_ui_VanityEquip = function(p) { + this.player = p; +}; +$hxClasses["com.davidmaletz.mining.ui.VanityEquip"] = com_davidmaletz_mining_ui_VanityEquip; +com_davidmaletz_mining_ui_VanityEquip.__name__ = ["com","davidmaletz","mining","ui","VanityEquip"]; +com_davidmaletz_mining_ui_VanityEquip.__interfaces__ = [com_davidmaletz_mining_world_IEquippable]; +com_davidmaletz_mining_ui_VanityEquip.prototype = { + player: null + ,getInventory: function() { + return this.player.getInventory(); + } + ,getEquipment: function() { + return this.player.vanity; + } + ,getId: function() { + return this.player.getId(); + } + ,getOwner: function() { + return this.player; + } + ,getXml: function() { + return this.player.getXml(); + } + ,setAbility: function(a) { + } + ,removeAbility: function(a) { + } + ,__class__: com_davidmaletz_mining_ui_VanityEquip +}; +var com_davidmaletz_mining_ui_PlayerGUI = function(p) { + com_davidmaletz_mining_ui_GUI.call(this,p); +}; +$hxClasses["com.davidmaletz.mining.ui.PlayerGUI"] = com_davidmaletz_mining_ui_PlayerGUI; +com_davidmaletz_mining_ui_PlayerGUI.__name__ = ["com","davidmaletz","mining","ui","PlayerGUI"]; +com_davidmaletz_mining_ui_PlayerGUI.__super__ = com_davidmaletz_mining_ui_GUI; +com_davidmaletz_mining_ui_PlayerGUI.prototype = $extend(com_davidmaletz_mining_ui_GUI.prototype,{ + bars: null + ,projectiles: null + ,projectiles_offhand: null + ,equipb: null + ,clock: null + ,_init: function(eqicon) { + var c = com_davidmaletz_mining_Main.getContainer(); + com_davidmaletz_mining_ui_GUI.prototype._init.call(this); + if(this.includeBars()) { + if(this.bars == null) { + this.bars = new com_davidmaletz_mining_ui_StatusBars(this.player,c); + } + this.bars.set_alpha(0.8); + this.addDisplay(this.bars,2); + if(com_davidmaletz_mining_Main.TOUCHSCREEN) { + this.rotateBars(this.bars); + } + } + if(this.includeProjectiles()) { + if(this.projectiles == null) { + this.projectiles = new com_davidmaletz_mining_ui_Projectiles(this.player,c,3,"weapon"); + } + this.addDisplay(this.projectiles,2); + if(this.projectiles_offhand == null) { + this.projectiles_offhand = new com_davidmaletz_mining_ui_Projectiles(this.player,c,4,"shield"); + this.projectiles.link(this.projectiles_offhand); + } + this.addDisplay(this.projectiles_offhand,2); + } + if(this.includeEquipB()) { + if(this.equipb == null) { + var slots = this.player.equipment.slot_ids; + var keys = new haxe_ds_StringMap(); + var len = slots.length; + keys.set("weapon","attack"); + keys.set("shield","defend"); + this.equipb = []; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + this.equipb[i] = new com_davidmaletz_mining_ui_EquipmentButton(this.player,slots[i],keys.get(slots[i]),i + 1); + } + } + var _g2 = 0; + var _g11 = this.equipb; + while(_g2 < _g11.length) { + var e = _g11[_g2]; + ++_g2; + this.addDisplay(e,2); + } + } + if(this.clock != null && this.include("clock")) { + this._addDisplay(this.clock,2); + } + } + ,setClock: function(c) { + if(this.clock != null && this.clock.parent != null) { + HxOverrides.remove(this.elements,this.clock); + this.clock.parent.removeChild(this.clock); + } + this.clock = null; + if(c != null) { + this.clock = this.addDisplay(c,2,true); + } + } + ,hasClock: function() { + return this.clock != null; + } + ,include: function(id) { + var e = this.player.info.xml.elementsNamed("gui"); + while(e.hasNext()) { + var e1 = e.next(); + var s = e1.get(id); + if(s == "false" || s != "true" && e1.get("hideAll") == "true") { + return false; + } + } + return true; + } + ,includeBars: function() { + return this.include("bars"); + } + ,includeProjectiles: function() { + return this.include("projectiles"); + } + ,includeEquipB: function() { + return this.include("equipButtons"); + } + ,useHotkey: function(hotkey) { + var a = this.player.getAbility(hotkey); + if(a == null) { + com_davidmaletz_mining_ui_GUI.prototype.useHotkey.call(this,hotkey); + } else { + a.run(this.player,null); + } + } + ,makeHotkey: function(key) { + var a = this.player.getAbility(key); + if(a == null) { + return com_davidmaletz_mining_ui_GUI.prototype.makeHotkey.call(this,key); + } else { + var ret = new com_davidmaletz_mining_ui_IconButton(this.player,"hotkey" + (key + 1),a.icon,a.animation); + ret.set_x(240 + (key % 4 - 4) * 22); + if(key >= 4) { + var _g = ret; + _g.set_y(_g.get_y() - 16); + } + if(com_davidmaletz_mining_Main.TOUCHSCREEN) { + var _g1 = ret; + _g1.set_x(_g1.get_x() - (com_davidmaletz_tiles_Tile.SIZE + 66)); + } + return ret; + } + } + ,__class__: com_davidmaletz_mining_ui_PlayerGUI +}); +var com_davidmaletz_mining_ui_Points = function(start,max,value,update) { + this.pressed = false; + this.current = -1; + com_davidmaletz_lerp_LerpSprite.call(this); + this.start = start; + this.max = max; + this.bitmap = openfl_Assets.getBitmapData("data/ui/points.png"); + this.updateValue = update; + var _g = 0; + while(_g < 3) { + var i = _g++; + this.addChild(new openfl_display_Sprite()); + } + this.setValue(value); +}; +$hxClasses["com.davidmaletz.mining.ui.Points"] = com_davidmaletz_mining_ui_Points; +com_davidmaletz_mining_ui_Points.__name__ = ["com","davidmaletz","mining","ui","Points"]; +com_davidmaletz_mining_ui_Points.point = null; +com_davidmaletz_mining_ui_Points.__super__ = com_davidmaletz_lerp_LerpSprite; +com_davidmaletz_mining_ui_Points.prototype = $extend(com_davidmaletz_lerp_LerpSprite.prototype,{ + current: null + ,start: null + ,max: null + ,bitmap: null + ,updateValue: null + ,init: function(e) { + com_davidmaletz_lerp_LerpSprite.prototype.init.call(this,e); + com_davidmaletz_faengfl_TouchAdapter.instance.addEventListener("touch_down",$bind(this,this.down),false,com_davidmaletz_faengfl_Window.window_ct + 1); + com_davidmaletz_faengfl_TouchAdapter.instance.addEventListener("touch_up",$bind(this,this.up),false,com_davidmaletz_faengfl_Window.window_ct + 1); + com_davidmaletz_faengfl_TouchAdapter.instance.addEventListener("touch_move",$bind(this,this.move),false,com_davidmaletz_faengfl_Window.window_ct + 1); + } + ,destroy: function(e) { + com_davidmaletz_lerp_LerpSprite.prototype.destroy.call(this,e); + com_davidmaletz_faengfl_TouchAdapter.instance.removeEventListener("touch_down",$bind(this,this.down)); + com_davidmaletz_faengfl_TouchAdapter.instance.removeEventListener("touch_up",$bind(this,this.up)); + com_davidmaletz_faengfl_TouchAdapter.instance.removeEventListener("touch_move",$bind(this,this.move)); + com_davidmaletz_controls_Controller.instance.removeEventListener("tap",$bind(this,this.modal)); + com_davidmaletz_controls_Controller.instance.removeEventListener("press",$bind(this,this.modal)); + com_davidmaletz_controls_Controller.instance.removeEventListener("release",$bind(this,this.modal)); + } + ,modal: function(e) { + e.stopImmediatePropagation(); + } + ,pressed: null + ,move: function(e) { + if(!this.get_visible() || !this.pressed) { + return; + } + if(com_davidmaletz_mining_ui_Points.point == null) { + com_davidmaletz_mining_ui_Points.point = new openfl_geom_Point(e.stageX,e.stageY); + } else { + com_davidmaletz_mining_ui_Points.point.setTo(e.stageX,e.stageY); + } + var p = this.globalToLocal(com_davidmaletz_mining_ui_Points.point); + this.updateValue(Math.ceil(p.x / 4)); + e.stopImmediatePropagation(); + } + ,down: function(e) { + if(!this.get_visible()) { + return; + } + if(com_davidmaletz_mining_ui_Points.point == null) { + com_davidmaletz_mining_ui_Points.point = new openfl_geom_Point(e.stageX,e.stageY); + } else { + com_davidmaletz_mining_ui_Points.point.setTo(e.stageX,e.stageY); + } + var p = this.globalToLocal(com_davidmaletz_mining_ui_Points.point); + if(p.x >= 0 && p.x < this.getWidth() && p.y >= 0 && p.y < this.getHeight()) { + this.pressed = true; + var v = Math.ceil(p.x / 4); + if(v > 0 && v == this.current) { + this.updateValue(v - 1); + } else { + this.updateValue(v); + } + e.stopImmediatePropagation(); + com_davidmaletz_controls_Controller.instance.addEventListener("tap",$bind(this,this.modal),false,com_davidmaletz_faengfl_Window.window_ct + 1); + com_davidmaletz_controls_Controller.instance.addEventListener("press",$bind(this,this.modal),false,com_davidmaletz_faengfl_Window.window_ct + 1); + com_davidmaletz_controls_Controller.instance.addEventListener("release",$bind(this,this.modal),false,com_davidmaletz_faengfl_Window.window_ct + 1); + } + } + ,up: function(e) { + if(!this.get_visible() || !this.pressed) { + return; + } + this.pressed = false; + e.stopImmediatePropagation(); + com_davidmaletz_controls_Controller.instance.removeEventListener("tap",$bind(this,this.modal)); + com_davidmaletz_controls_Controller.instance.removeEventListener("press",$bind(this,this.modal)); + com_davidmaletz_controls_Controller.instance.removeEventListener("release",$bind(this,this.modal)); + } + ,getWidth: function() { + return 4 * this.max; + } + ,getHeight: function() { + return 8; + } + ,draw: function(y,from,to) { + var g = (js_Boot.__cast(this.getChildAt(y) , openfl_display_Sprite)).get_graphics(); + g.clear(); + if(from >= to) { + return; + } + var w = (to - from) * 4; + if(to == this.max) { + ++w; + } + g.beginBitmapFill(this.bitmap,new openfl_geom_Matrix(1,0,0,1,0,-y * 8)); + g.drawRect(from * 4,0,w,8); + g.endFill(); + } + ,setValue: function(v) { + if(this.current != v) { + this.current = v; + this.draw(1,0,this.start); + this.draw(2,this.start,v); + this.draw(0,v,this.max); + } + } + ,__class__: com_davidmaletz_mining_ui_Points +}); +var com_davidmaletz_mining_ui_PortalWindow = function(m,c,player,structure,object,xml,vars,onComplete,acceptArea,f,fc) { + if(fc == null) { + fc = 1; + } + var r = new com_davidmaletz_mining_ui__$PortalWindow_LocationRenderer(this); + var rows = Math.floor(100 / r.getHeight(null)); + var b = player._getBounds(com_davidmaletz_mining_world_Object.rectangle); + this.fuelable = f; + this.fuelCost = fc; + com_davidmaletz_controls_scroll_ScrollWindow.call(this,c,com_davidmaletz_mining_Main.window_factory,r,rows,1); + var loc = []; + var checkObject = function(o) { + if(object != null && o.info.id == object) { + var o1 = o.area; + var checkObject1 = Math.round(o.getCenterX() - player._width * 0.5); + var checkObject2 = o.get_tile_y(); + var checkObject3; + if(player.area == o.area) { + var checkObject4 = o.getBounds(); + checkObject3 = b.intersects(checkObject4); + } else { + checkObject3 = false; + } + loc.push(new com_davidmaletz_mining_ui__$PortalWindow_Location(o1,checkObject1,checkObject2,true,checkObject3,null)); + } + }; + var checkArea = function(area) { + if(acceptArea == null || acceptArea(area)) { + if(structure != null) { + var ar = area.getStructuresById(structure); + var _g = 0; + while(_g < ar.length) { + var s = ar[_g]; + ++_g; + var checkArea1 = Math.round(s.getCenterX() - player._width * 0.5); + var checkArea2 = s.get_tile_y(); + var checkArea3 = s.canFunction(); + var checkArea4; + if(player.area == s.area) { + var checkArea5 = s.getInnerBounds(); + checkArea4 = b.intersects(checkArea5); + } else { + checkArea4 = false; + } + loc.push(new com_davidmaletz_mining_ui__$PortalWindow_Location(area,checkArea1,checkArea2,checkArea3,checkArea4,s.name)); + } + } + return true; + } else { + return false; + } + }; + player.getAllObjects(checkObject,checkArea); + if(this.fuelable != null && Std["is"](this.fuelable,com_davidmaletz_mining_structure_Structure)) { + var inv = player.getInv(true); + this.recipeRenderer = new com_davidmaletz_mining_ui_RecipeRenderer(new com_davidmaletz_mining_ui__$PortalWindow_RecipeHandler(this,inv),inv,this.fuelable.getFuelName(),null,140); + var r1 = com_davidmaletz_mining_ui_CraftingWindow.getRecipes(player,(js_Boot.__cast(this.fuelable , com_davidmaletz_mining_structure_Structure)).info.xml); + while(r1.hasNext()) { + var r2 = r1.next(); + this.list.addMixedItem(r2,this.recipeRenderer); + } + } + this.details = new com_davidmaletz_mining_ui_details_RecipeDetails(player.includeCost()); + this.details.set_x(this.getWidth() - 4); + this.addChild(this.details); + com_davidmaletz_mining_ui_CraftingList.addAdditional(this.list,this.details,r.getWidth(),xml.elementPathsNamed("listItem"),vars.get("this"),null,vars); + loc.sort(com_davidmaletz_mining_ui_PortalWindow.compareLoc); + var _g1 = 0; + while(_g1 < loc.length) { + var l = loc[_g1]; + ++_g1; + this.addItem(l); + } + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,m,this.getWidth(),0,100); + this.player = player; + this.onComplete = onComplete; +}; +$hxClasses["com.davidmaletz.mining.ui.PortalWindow"] = com_davidmaletz_mining_ui_PortalWindow; +com_davidmaletz_mining_ui_PortalWindow.__name__ = ["com","davidmaletz","mining","ui","PortalWindow"]; +com_davidmaletz_mining_ui_PortalWindow.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_PortalWindow.compareLoc = function(a,b) { + var $as = a.getName().get(); + var bs = b.getName().get(); + if($as > bs) { + return 1; + } else if($as == bs) { + return 0; + } else { + return -1; + } +}; +com_davidmaletz_mining_ui_PortalWindow.__super__ = com_davidmaletz_controls_scroll_ScrollWindow; +com_davidmaletz_mining_ui_PortalWindow.prototype = $extend(com_davidmaletz_controls_scroll_ScrollWindow.prototype,{ + player: null + ,onComplete: null + ,fuelable: null + ,fuelCost: null + ,recipeRenderer: null + ,details: null + ,onSelect: function(item) { + if(item.at) { + return; + } + if(this.fuelable != null && this.fuelable.getFuel() < this.fuelCost) { + var n = this.fuelable.getFuelName(); + this.player.showWarning(com_fancyfish_faeng_common_Lang.getText("warning",n == null ? "fuel" : n)); + } else if(item.enabled) { + if(this.fuelable != null) { + this.fuelable.useFuel(this.fuelCost); + } + if(this.onComplete != null) { + this.onComplete(item.area,item.xPos,item.tile_y * com_davidmaletz_tiles_Tile.SIZE); + } + this.close(); + } else { + this.player.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","not_powered")); + } + } + ,onHover: function(item) { + } + ,isEnabled: function(item) { + return item.enabled; + } + ,update: function() { + var l = this.list.list; + var len = l.get_numChildren(); + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + this.recipeRenderer.update(js_Boot.__cast(l.getChildAt(i) , openfl_display_Sprite),null); + } + } + ,__class__: com_davidmaletz_mining_ui_PortalWindow +}); +var com_davidmaletz_mining_ui__$PortalWindow_Location = function(a,x,y,e,at,n) { + this.area = a; + this.xPos = x; + this.tile_y = y; + this.enabled = e; + this.at = at; + this.name = n; +}; +$hxClasses["com.davidmaletz.mining.ui._PortalWindow.Location"] = com_davidmaletz_mining_ui__$PortalWindow_Location; +com_davidmaletz_mining_ui__$PortalWindow_Location.__name__ = ["com","davidmaletz","mining","ui","_PortalWindow","Location"]; +com_davidmaletz_mining_ui__$PortalWindow_Location.prototype = { + area: null + ,xPos: null + ,tile_y: null + ,enabled: null + ,at: null + ,name: null + ,getName: function() { + if(this.name == null) { + return new com_fancyfish_faeng_common_mutable_Concat(this.area.getDisplay()," (" + Math.round(this.xPos / com_davidmaletz_tiles_Tile.SIZE) + ", " + this.tile_y + ")"); + } else { + return new com_fancyfish_faeng_common_mutable_Static(this.name); + } + } + ,__class__: com_davidmaletz_mining_ui__$PortalWindow_Location +}; +var com_davidmaletz_mining_ui__$PortalWindow_LocationRenderer = function(handler) { + this.handler = handler; +}; +$hxClasses["com.davidmaletz.mining.ui._PortalWindow.LocationRenderer"] = com_davidmaletz_mining_ui__$PortalWindow_LocationRenderer; +com_davidmaletz_mining_ui__$PortalWindow_LocationRenderer.__name__ = ["com","davidmaletz","mining","ui","_PortalWindow","LocationRenderer"]; +com_davidmaletz_mining_ui__$PortalWindow_LocationRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui__$PortalWindow_LocationRenderer.prototype = { + handler: null + ,create: function(item,x,y) { + return new com_davidmaletz_mining_ui__$PortalWindow_LocationButton(this.handler,item,x,y,140,com_davidmaletz_mining_ui_StringRenderer._getHeight()); + } + ,update: function(s,item) { + } + ,getWidth: function() { + return 140; + } + ,getHeight: function(item) { + return com_davidmaletz_mining_ui_StringRenderer._getHeight(); + } + ,__class__: com_davidmaletz_mining_ui__$PortalWindow_LocationRenderer +}; +var com_davidmaletz_mining_ui__$PortalWindow_LocationButton = function(handler,i,x,y,w,h) { + com_davidmaletz_controls_Button.call(this,x,y,com_davidmaletz_mining_Main.label_factory.createBG(w,h),com_davidmaletz_mining_Main.label_factory.createHover(w,h),null); + this.handler = handler; + this.info = i; + var t = new com_davidmaletz_faengfl_TextSprite(i.getName(),new com_fancyfish_faeng_text_CharacterPlacer(0,0),0,1); + t.set_x(2); + t.set_y(Math.round((h - t.lineHeight()) * 0.5)); + t.set_alpha(handler.isEnabled(this.info) ? 1 : 0.5); + if(i.at) { + com_davidmaletz_faengfl_TextSprite.setColor(t,26265); + } + this.addChild(t); +}; +$hxClasses["com.davidmaletz.mining.ui._PortalWindow.LocationButton"] = com_davidmaletz_mining_ui__$PortalWindow_LocationButton; +com_davidmaletz_mining_ui__$PortalWindow_LocationButton.__name__ = ["com","davidmaletz","mining","ui","_PortalWindow","LocationButton"]; +com_davidmaletz_mining_ui__$PortalWindow_LocationButton.__super__ = com_davidmaletz_controls_Button; +com_davidmaletz_mining_ui__$PortalWindow_LocationButton.prototype = $extend(com_davidmaletz_controls_Button.prototype,{ + handler: null + ,info: null + ,onClick: function() { + if(this.handler != null) { + this.handler.onSelect(this.info); + } + return true; + } + ,onHover: function(hover) { + com_davidmaletz_controls_Button.prototype.onHover.call(this,hover); + if(this.handler != null) { + this.handler.onHover(hover ? this.info : null); + } + } + ,__class__: com_davidmaletz_mining_ui__$PortalWindow_LocationButton +}); +var com_davidmaletz_mining_ui__$PortalWindow_RecipeHandler = function(w,i) { + this.wnd = w; + this.inv = i; + this.fuelName = this.wnd.fuelable.getFuelName(); +}; +$hxClasses["com.davidmaletz.mining.ui._PortalWindow.RecipeHandler"] = com_davidmaletz_mining_ui__$PortalWindow_RecipeHandler; +com_davidmaletz_mining_ui__$PortalWindow_RecipeHandler.__name__ = ["com","davidmaletz","mining","ui","_PortalWindow","RecipeHandler"]; +com_davidmaletz_mining_ui__$PortalWindow_RecipeHandler.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui__$PortalWindow_RecipeHandler.prototype = { + wnd: null + ,inv: null + ,fuelName: null + ,onSelect: function(recipe) { + if(recipe.creates == null) { + com_davidmaletz_mining_ui_FuelWindow.addFuel(this.wnd.fuelable,this.inv,recipe,this.fuelName,$bind(this,this.fuelAdded)); + } + } + ,onHover: function(recipe) { + this.wnd.details.setRecipe(recipe,this.inv,this.fuelName); + } + ,isEnabled: function(recipe) { + return true; + } + ,fuelAdded: function(recipe,ct) { + this.wnd.update(); + this.wnd.details.setInfo(null); + this.onHover(recipe); + } + ,__class__: com_davidmaletz_mining_ui__$PortalWindow_RecipeHandler +}; +var com_davidmaletz_mining_ui_Preloader = function() { + this.loaded = false; + NMEPreloader.call(this); + openfl_display_Preloader.soundFail = com_davidmaletz_mining_ui_Preloader.soundFail; + openfl_Assets.loadBitmapData("data/ui/title_full.jpg",true,$bind(this,this.addBG)); + this.progressBar = new com_davidmaletz_controls_ProgressBar(200,3,10027008,0,false,false); + var bg = new openfl_display_Sprite(); + var g = bg.get_graphics(); + g.lineStyle(1); + g.beginFill(16777215); + g.drawRect(-1,-1,202,5); + g.endFill(); + this.progressBar.addChildAt(bg,0); + this.progressBar.set_x(Math.round(28.)); + this.progressBar.set_y(Math.round(69.5) - 12); + this.addChild(this.progressBar); + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); +}; +$hxClasses["com.davidmaletz.mining.ui.Preloader"] = com_davidmaletz_mining_ui_Preloader; +com_davidmaletz_mining_ui_Preloader.__name__ = ["com","davidmaletz","mining","ui","Preloader"]; +com_davidmaletz_mining_ui_Preloader.soundFail = function() { + com_davidmaletz_mining_ui_Preloader.sound_fail = true; +}; +com_davidmaletz_mining_ui_Preloader.onStart = function() { + if(com_davidmaletz_mining_ui_Preloader.sound_fail) { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_DialogueBox(c,"Your browser does not support ogg audio files. No music or sfx will play. Both Chrome and Firefox work great for playing sound."),2); + } +}; +com_davidmaletz_mining_ui_Preloader.__super__ = NMEPreloader; +com_davidmaletz_mining_ui_Preloader.prototype = $extend(NMEPreloader.prototype,{ + progressBar: null + ,addBG: function(bmp) { + var b = new openfl_display_Bitmap(bmp,1,true); + b.set_scaleX(b.set_scaleY(256 / bmp.width)); + this.addChildAt(b,0); + } + ,init: function(e) { + this.destroy(e); + openfl_Lib.current.stage.addEventListener("resize",$bind(this,this.resize)); + this.resize(null); + } + ,destroy: function(e) { + openfl_Lib.current.stage.removeEventListener("resize",$bind(this,this.resize)); + } + ,resize: function(e) { + var w = this.stage.stageWidth; + var h = this.stage.stageHeight; + var iw = 256; + var ih = 144; + var s = Math.min(w / iw,h / ih); + this.set_scaleX(this.set_scaleY(s)); + this.set_x((w - iw * s) * 0.5); + this.set_y((h - ih * s) * 0.5); + } + ,onInit: function() { + } + ,onLoaded: function(p) { + if(this.loaded) { + this.start(); + } else { + var s = new com_davidmaletz_lerp_LerpSprite(); + s.set_x(128.); + s.set_y(124); + this.preloader = p; + this.msg = new com_fancyfish_faeng_common_mutable_Mutable(); + this.msg.set("Click Anywhere to Start"); + com_davidmaletz_faengfl_ui_Tooltip.draw(s,this.msg,16777215,-16777216,new com_fancyfish_faeng_common_mutable_Static(com_fancyfish_faeng_common_Lang.getFontCached("data/fonts/font.fnt",false))); + s.set_alpha(0); + s.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),30); + this.addChild(s); + openfl_Lib.current.stage.addEventListener("click",$bind(this,this._start)); + } + } + ,loaded: null + ,preloader: null + ,msg: null + ,_start: function(e) { + if(this.loaded) { + return; + } + this.loaded = true; + lime_audio_AudioManager.init(); + this.preloader.loadSounds(); + this.msg.set("Loading Music..."); + openfl_Lib.current.stage.removeEventListener("click",$bind(this,this._start)); + } + ,start: function() { + this.progressBar.setProgress(1); + this.dispatchEvent(new openfl_events_Event("complete")); + } + ,onUpdate: function(bytesLoaded,bytesTotal) { + var percentLoaded = bytesLoaded / bytesTotal; + if(percentLoaded > 1) { + percentLoaded = 1; + } + this.progressBar.setProgress(percentLoaded); + } + ,__class__: com_davidmaletz_mining_ui_Preloader +}); +var com_davidmaletz_mining_ui_Projectiles = function(o,c,i,slot) { + this.flashing = 0; + com_davidmaletz_lerp_LerpSprite.call(this); + this.object = o; + this.value = new com_fancyfish_faeng_common_mutable_Mutable(); + this.value.set(""); + this.icon = new openfl_display_Sprite(); + this.slot = slot; + this.addChild(this.icon); + var t = new com_davidmaletz_faengfl_TextSprite(this.value,new com_fancyfish_faeng_text_CharacterPlacer(10,2),16777215,1); + this.set_visible(false); + this.set_alpha(0); + t.set_x(com_davidmaletz_tiles_Tile.SIZE + 2); + this.addChild(t); + this.set_x(32 + com_davidmaletz_tiles_Tile.SIZE + (com_davidmaletz_tiles_Tile.SIZE + 4 + 10) * i); + this.set_y(2); +}; +$hxClasses["com.davidmaletz.mining.ui.Projectiles"] = com_davidmaletz_mining_ui_Projectiles; +com_davidmaletz_mining_ui_Projectiles.__name__ = ["com","davidmaletz","mining","ui","Projectiles"]; +com_davidmaletz_mining_ui_Projectiles.__super__ = com_davidmaletz_lerp_LerpSprite; +com_davidmaletz_mining_ui_Projectiles.prototype = $extend(com_davidmaletz_lerp_LerpSprite.prototype,{ + object: null + ,value: null + ,icon: null + ,projectile: null + ,_name: null + ,slot: null + ,next: null + ,prev: null + ,link: function(p) { + if(p.next != null || p.prev != null) { + haxe_Log.trace("Warning: Projectiles already linked!",{ fileName : "Projectiles.hx", lineNumber : 29, className : "com.davidmaletz.mining.ui.Projectiles", methodName : "link"}); + } else { + var n = this.next; + this.next = p; + p.prev = this; + p.next = n; + } + } + ,init: function(e) { + com_davidmaletz_lerp_LerpSprite.prototype.init.call(this,e); + var m = this.object.getEquipment().get(this.slot); + if(m != null) { + m.addEventListener("updated",$bind(this,this.change)); + } + this.object.getInventory().addEventListener("item_added",$bind(this,this.item_added)); + this.change(null); + } + ,destroy: function(e) { + com_davidmaletz_lerp_LerpSprite.prototype.destroy.call(this,e); + var m = this.object.getEquipment().get(this.slot); + if(m != null) { + m.removeEventListener("updated",$bind(this,this.change)); + } + this.object.getInventory().removeEventListener("item_added",$bind(this,this.item_added)); + if(this._name != null) { + this._name.removeEventListener("updated",$bind(this,this.change)); + this._name = null; + } + } + ,flashing: null + ,handle_frame: function(e) { + com_davidmaletz_lerp_LerpSprite.prototype.handle_frame.call(this,e); + if(this.hasLerp()) { + return; + } + if(this.flashing > 0) { + this.flashing -= com_davidmaletz_faengfl_FaengFL.frameTime; + if(this.flashing <= 0) { + this.flashing = 30; + this.set_alpha(this.get_alpha() == 0.5 ? 1 : 0.5); + } + } else { + this.set_alpha(1); + } + } + ,hide: function() { + this.set_visible(false); + } + ,hasItem: function(p) { + if(this.projectile != p) { + if(this.prev != null) { + return this.prev.hasItem(p); + } else { + return false; + } + } else { + return true; + } + } + ,updateHidden: function(p) { + if(p != null && this.projectile == p) { + this.projectile = null; + this.update(false); + } else { + this.change(null); + } + if(this.next != null) { + this.next.updateHidden(p); + } + } + ,change: function(e) { + var eq = this.object.getEquipment().getItem(this.slot); + var p; + if(this._name != null) { + this._name.removeEventListener("updated",$bind(this,this.change)); + this._name = null; + } + var tmp; + if(eq != null) { + p = eq.getDefaultProjectile(); + tmp = p == null; + } else { + tmp = false; + } + if(tmp) { + eq = null; + } + var v = eq != null; + if(v) { + this._name = eq.getName(); + this._name.addEventListener("updated",$bind(this,this.change)); + if(p != this.projectile) { + this.projectile = p; + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this.icon); + this.icon.addChild(p.createIcon()); + if(this.prev != null && this.prev.hasItem(p)) { + v = false; + this.projectile = null; + } + if(this.next != null) { + this.next.updateHidden(p); + } + } + if(this.projectile != null) { + var ct = this.object.getInventory().getItemCount(this.projectile); + this.value.set(com_fancyfish_faeng_common_Utils.largeNumberFormat(ct)); + if(ct == 0) { + this.flashing = 30; + } else { + this.flashing = 0; + } + } + } else if(this.projectile != null) { + this.projectile = null; + if(this.next != null) { + this.next.updateHidden(null); + } + } + this.update(v); + } + ,update: function(v) { + if(v != this.get_visible()) { + if(v) { + this.set_visible(true); + this.set_alpha(0); + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),10); + } else { + this.set_alpha(1); + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),10,$bind(this,this.hide)); + } + } else { + this.clearLerp(); + this.set_alpha(v ? 1 : 0); + } + } + ,item_added: function(e) { + if(e.item == this.projectile) { + this.change(null); + } + } + ,__class__: com_davidmaletz_mining_ui_Projectiles +}); +var com_davidmaletz_mining_ui_Prompt = function(c,str,onAccept,onDecline,addClose,onCancel,halign,valign,defaultNo) { + if(defaultNo == null) { + defaultNo = true; + } + if(valign == null) { + valign = 0.5; + } + if(halign == null) { + halign = 0.5; + } + if(addClose == null) { + addClose = false; + } + var t = new com_davidmaletz_mining_ui_MyFormattedText(142,true,str.get(),1); + var y = t.bounds.height * t.get_scaleY() + 8; + var ht = y + com_davidmaletz_mining_ui_TextButton.getHeight() + 4; + com_davidmaletz_controls_ClickableWindow.call(this,c,com_davidmaletz_mining_Main.window_factory.create(150,ht),true,true,true,halign,valign); + t.set_x(4); + t.set_y(4); + this.addChild(t); + this.clickables.allowLoop = false; + this.onAccept = onAccept; + if(onAccept == null) { + this.addClickable(new com_davidmaletz_mining_ui_TextButton(106,y,com_fancyfish_faeng_common_Lang.getText("common","ok"),$bind(this,this.close))); + } else { + this.addClickable(new com_davidmaletz_mining_ui_TextButton(4,y,com_fancyfish_faeng_common_Lang.getText("common","yes"),$bind(this,this.confirm))); + var tmp = com_fancyfish_faeng_common_Lang.getText("common","no"); + var tmp1; + if(onDecline == null) { + tmp1 = $bind(this,this.close); + } else { + var f = $bind(this,this.cancel); + var a1 = onDecline; + tmp1 = function() { + f(a1); + }; + } + this.addClickable(new com_davidmaletz_mining_ui_TextButton(106,y,tmp,tmp1)); + this.clickables.moveSelection(1,0); + if(defaultNo) { + this.clickables.moveSelection(1,0); + } + } + if(addClose) { + var close = new com_davidmaletz_controls_CloseButton(this,150,0); + this.addChild(close); + this.clickables.addClickable(close,this); + } + this._onCancel = onCancel; +}; +$hxClasses["com.davidmaletz.mining.ui.Prompt"] = com_davidmaletz_mining_ui_Prompt; +com_davidmaletz_mining_ui_Prompt.__name__ = ["com","davidmaletz","mining","ui","Prompt"]; +com_davidmaletz_mining_ui_Prompt.__super__ = com_davidmaletz_controls_ClickableWindow; +com_davidmaletz_mining_ui_Prompt.prototype = $extend(com_davidmaletz_controls_ClickableWindow.prototype,{ + onAccept: null + ,_onCancel: null + ,onCancel: function() { + if(this._onCancel != null) { + this._onCancel(); + } + com_davidmaletz_controls_ClickableWindow.prototype.onCancel.call(this); + } + ,confirm: function() { + this.onAccept(); + this.close(); + } + ,cancel: function(func) { + func(); + this.close(); + } + ,__class__: com_davidmaletz_mining_ui_Prompt +}); +var com_davidmaletz_mining_ui_QuestInfo = function(p) { + openfl_display_Sprite.call(this); + this.player = p; +}; +$hxClasses["com.davidmaletz.mining.ui.QuestInfo"] = com_davidmaletz_mining_ui_QuestInfo; +com_davidmaletz_mining_ui_QuestInfo.__name__ = ["com","davidmaletz","mining","ui","QuestInfo"]; +com_davidmaletz_mining_ui_QuestInfo.addRequirements = function(s,player,inv,reqs,x,y,w,p) { + if(p == null) { + p = 1; + } + var i = reqs; + while(i.hasNext()) { + var i1 = i.next(); + var c = Math.round(i1.count * p); + if(c <= 0) { + continue; + } + var ct = -1; + if(inv == null) { + com_davidmaletz_mining_ui_ItemRenderer.addItem(s,i1,x,y); + } else { + ct = i1.getCount(player,inv); + if(i1.hidden && ct == 0 && !i1.hasSeen(player)) { + var t = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("quests","unknown_reqs"),new com_fancyfish_faeng_text_CharacterPlacer(0,0),0,1); + t.set_x(x); + t.set_y(y); + s.addChild(t); + } else { + com_davidmaletz_mining_ui_ItemRenderer.addItem(s,i1,x,y,0,2); + } + } + if(i1.count > 0) { + var txt = new com_fancyfish_faeng_common_mutable_Static(ct < 0 ? c == null ? "null" : "" + c : com_fancyfish_faeng_common_Utils.largeNumberFormat(ct) + "/" + c); + var t1 = ct >= 0 && ct < i1.count ? 16711680 : 0; + var t2 = new com_davidmaletz_faengfl_TextSprite(txt,new com_fancyfish_faeng_text_CharacterPlacer(w,2),t1,1); + t2.set_x(x); + t2.set_y(y); + s.addChild(t2); + } + y += com_davidmaletz_mining_ui_StringRenderer._getHeight(); + } + return y; +}; +com_davidmaletz_mining_ui_QuestInfo.__super__ = openfl_display_Sprite; +com_davidmaletz_mining_ui_QuestInfo.prototype = $extend(openfl_display_Sprite.prototype,{ + player: null + ,setQuest: function(q,w,title,col) { + if(col == null) { + col = 0; + } + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this); + var y = 0; + var t = new com_davidmaletz_faengfl_TextSprite(title == null ? q.getName() : title,new com_fancyfish_faeng_text_CharacterPlacer(w,1),col,1); + t.set_y(y); + this.addChild(t); + y += 12; + var add = ""; + var info = null; + if(q.giver != null) { + info = js_Boot.__cast(com_davidmaletz_mining_world_ObjectInfo.get(q.giver) , com_davidmaletz_mining_npc_NPCInfo); + if(info != null) { + add = info.getDisplay() + " "; + } + } + var t1 = new com_davidmaletz_mining_ui_MyFormattedText(w,true); + t1.default_color = 6710886; + t1.setText(add + q.getDesc().get()); + t1.set_y(y); + if(info != null) { + var tile = info.getDisplayTile(); + var e = tile.indexOf(" "); + var _g = t1; + _g.set_y(_g.get_y() - (com_davidmaletz_tiles_Tile.get(e == -1 ? tile : tile.substring(0,e)).getHeight() - 11)); + } + this.addChild(t1); + y += Math.ceil(4 * t1.default_font.get().lineHeight) - 2; + var complete = this.player.questComplete(q.id); + var t2 = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("quests",complete ? "complete" : "requires"),new com_fancyfish_faeng_text_CharacterPlacer(w,1),153,1); + t2.set_y(y + 2); + this.addChild(t2); + y += 10; + if(complete) { + return; + } + if(q.coins > 0) { + var icon = com_davidmaletz_mining_item_ItemInfo._createIcon(com_davidmaletz_tiles_Tile.get("coins")); + icon.set_y(y); + this.addChild(icon); + var t3 = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("common","coins"),new com_fancyfish_faeng_text_CharacterPlacer(0),0,0.5); + t3.set_x(com_davidmaletz_tiles_Tile.SIZE + 1); + t3.set_y(y); + this.addChild(t3); + var coins = this.player.getCoins(); + var t4 = new com_fancyfish_faeng_common_mutable_Static(com_fancyfish_faeng_common_Utils.largeNumberFormat(coins) + "/" + com_fancyfish_faeng_common_Utils.largeNumberFormat(q.coins)); + var t5 = coins < q.coins ? 16711680 : 0; + var t6 = new com_davidmaletz_faengfl_TextSprite(t4,new com_fancyfish_faeng_text_CharacterPlacer(w,2),t5,1); + t6.set_y(y); + this.addChild(t6); + y += t6.lineHeight(); + } + y = com_davidmaletz_mining_ui_QuestInfo.addRequirements(this,this.player,this.player.storehouseInventory,q.getRequirements(),0,y,w); + } + ,__class__: com_davidmaletz_mining_ui_QuestInfo +}); +var com_davidmaletz_mining_ui_QuestItemRenderer = function(handler) { + this.handler = handler; +}; +$hxClasses["com.davidmaletz.mining.ui.QuestItemRenderer"] = com_davidmaletz_mining_ui_QuestItemRenderer; +com_davidmaletz_mining_ui_QuestItemRenderer.__name__ = ["com","davidmaletz","mining","ui","QuestItemRenderer"]; +com_davidmaletz_mining_ui_QuestItemRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui_QuestItemRenderer.prototype = { + handler: null + ,create: function(item,x,y) { + return new com_davidmaletz_mining_ui_QuestButton(this.handler,item,x,y); + } + ,update: function(s,item) { + } + ,getWidth: function() { + return 90; + } + ,getHeight: function(item) { + return com_davidmaletz_mining_ui_StringRenderer._getHeight(); + } + ,__class__: com_davidmaletz_mining_ui_QuestItemRenderer +}; +var com_davidmaletz_mining_ui_QuestButton = function(h,i,x,y) { + var ht = com_davidmaletz_mining_ui_StringRenderer._getHeight(); + com_davidmaletz_controls_Button.call(this,x,y,com_davidmaletz_mining_Main.label_factory.createBG(90,ht),com_davidmaletz_mining_Main.label_factory.createHover(90,ht),null); + this.handler = h; + this.item = i; + var t = new com_davidmaletz_faengfl_TextSprite(i.getName(),new com_fancyfish_faeng_text_CharacterPlacer(0),0,1); + t.set_x(1); + if(!h.isEnabled(i)) { + t.set_alpha(0.5); + } + this.addChild(t); +}; +$hxClasses["com.davidmaletz.mining.ui.QuestButton"] = com_davidmaletz_mining_ui_QuestButton; +com_davidmaletz_mining_ui_QuestButton.__name__ = ["com","davidmaletz","mining","ui","QuestButton"]; +com_davidmaletz_mining_ui_QuestButton.__super__ = com_davidmaletz_controls_Button; +com_davidmaletz_mining_ui_QuestButton.prototype = $extend(com_davidmaletz_controls_Button.prototype,{ + handler: null + ,item: null + ,onClick: function() { + this.handler.onSelect(this.item); + return true; + } + ,onHover: function(hover) { + com_davidmaletz_controls_Button.prototype.onHover.call(this,hover); + this.handler.onHover(hover ? this.item : null); + } + ,__class__: com_davidmaletz_mining_ui_QuestButton +}); +var com_davidmaletz_mining_ui_QuestLog = function(p,c) { + var r = new com_davidmaletz_mining_ui_QuestItemRenderer(this); + var rows = Math.round(100 / r.getHeight(null)); + com_davidmaletz_controls_scroll_ScrollWindow.call(this,c,com_davidmaletz_mining_Main.window_factory,r,rows,1); + this.player = p; + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,com_fancyfish_faeng_common_Lang.getText("common","quests"),this.getWidth()); + this.details = new com_davidmaletz_mining_ui_QuestInfo(p); + this.details.set_x(com_davidmaletz_controls_scroll_ScrollWindow.prototype.getWidth.call(this) + 4); + this.details.set_y(4); + this.addChild(this.details); + var t = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("quests","none"),new com_fancyfish_faeng_text_WrapCharacterPlacer(this.list.getWidth(),1),0,1); + t.set_x(this.list.get_x()); + t.set_y(this.list.get_y()); + this.none = t; + this.addChild(t); + this.addQuests(); + var achievements = new com_davidmaletz_mining_ui_TextButton(this.getWidth(),this.getHeight() + 2,com_fancyfish_faeng_common_Lang.getText("options","achievements"),$bind(this,this.showAchievements),80); + this.addChild(achievements); + this.clickables.addClickable(achievements,this); + achievements.getPos().x -= 80; + var _g = achievements; + _g.set_x(_g.get_x() - 80); +}; +$hxClasses["com.davidmaletz.mining.ui.QuestLog"] = com_davidmaletz_mining_ui_QuestLog; +com_davidmaletz_mining_ui_QuestLog.__name__ = ["com","davidmaletz","mining","ui","QuestLog"]; +com_davidmaletz_mining_ui_QuestLog.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_QuestLog.__super__ = com_davidmaletz_controls_scroll_ScrollWindow; +com_davidmaletz_mining_ui_QuestLog.prototype = $extend(com_davidmaletz_controls_scroll_ScrollWindow.prototype,{ + details: null + ,player: null + ,none: null + ,addQuests: function() { + if(this.player.getQuestCount(true) == 0) { + this.none.set_visible(true); + } else { + this.none.set_visible(false); + var q = this.player.getQuests(); + while(q.hasNext()) { + var q1 = q.next(); + this.addItem(q1); + } + var q2 = this.player.getCompleteQuests(); + while(q2.hasNext()) { + var q3 = q2.next(); + this.addItem(q3); + } + } + } + ,update_quests: function(e) { + var p = com_davidmaletz_controls_scroll_ScrollList.preSwitch(this.clickables); + var y = this.list.getScrollY(); + this.list.clear(); + this.addQuests(); + var ht = this.list.getViewportHeight(); + var sht = this.list.getScrollHeight(); + ht = sht - ht; + if(y > ht) { + y = ht; + } + if(y < 0) { + y = 0; + } + if(this.list.getScrollY() == y) { + this.list.scrollbar.update(); + } else { + this.list.updateScroll(y); + } + com_davidmaletz_controls_scroll_ScrollList.postSwitch(this.clickables,p); + } + ,showAchievements: function() { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_AchievementWindow(c,($_=this.player.state,$bind($_,$_.getAchievement))),2); + } + ,makeDrawable: function(factory) { + var draw = new com_davidmaletz_faengfl_CompoundDrawable(); + var d = factory.create(com_davidmaletz_controls_scroll_ScrollWindow.prototype.getWidth.call(this),this.getHeight()); + draw.add(d,0,0); + draw.add(factory.create(this.getQuestWidth() + 8,this.getHeight()),d.getWidth() - 1,0); + return draw; + } + ,getQuestWidth: function() { + return 106; + } + ,getWidth: function() { + return com_davidmaletz_controls_scroll_ScrollWindow.prototype.getWidth.call(this) - 1 + this.getQuestWidth() + 8; + } + ,onSelect: function(item) { + com_davidmaletz_mining_ui_NPCLocator.locate(this.details.player,item.giver,true); + } + ,onHover: function(item) { + if(item == null) { + return; + } + this.details.setQuest(item,this.getQuestWidth()); + } + ,isEnabled: function(item) { + return !this.details.player.questComplete(item.id); + } + ,init: function(e) { + com_davidmaletz_controls_scroll_ScrollWindow.prototype.init.call(this,e); + com_davidmaletz_controls_Controller.instance.addEventListener("tap",$bind(this,this.release),false,com_davidmaletz_faengfl_Window.window_ct + 1); + this.player.state.addEventListener("add_quest",$bind(this,this.update_quests)); + this.player.state.addEventListener("complete_quest",$bind(this,this.update_quests)); + } + ,destroy: function(e) { + com_davidmaletz_controls_scroll_ScrollWindow.prototype.destroy.call(this,e); + com_davidmaletz_controls_Controller.instance.removeEventListener("tap",$bind(this,this.release)); + this.player.state.removeEventListener("add_quest",$bind(this,this.update_quests)); + this.player.state.removeEventListener("complete_quest",$bind(this,this.update_quests)); + } + ,release: function(e) { + if(e.key == "quest") { + this.close(); + } + } + ,__class__: com_davidmaletz_mining_ui_QuestLog +}); +var com_davidmaletz_mining_ui_Radar = function(n,vars,id,c,tile,anim,padding) { + this.id = id; + var t = com_davidmaletz_tiles_Tile.get(tile); + com_davidmaletz_tiles_render_PlayAnimation.call(this,t,anim,10,true); + this._width = t.getWidth(); + this._height = t.getHeight(); + this.set_scaleX(this.set_scaleY(0.5)); + this.sprite = new openfl_display_Sprite(); + this.sprite.set_x(this.sprite.set_y(padding)); + this.addChild(this.sprite); + this.set_x((c.getWidth() - this._width * 0.5) * 0.5 - com_davidmaletz_tiles_Tile.SIZE); + this.set_y(c.getHeight() - this._height * 0.5 - com_davidmaletz_tiles_Tile.SIZE); + this._width -= padding * 2; + this._height -= padding * 2; + this.xml = n; + if(com_davidmaletz_mining_ui_Radar.dot == null) { + var b = new openfl_display_BitmapData(4,2,false); + b.setPixel(0,0,0); + b.setPixel(1,0,16711680); + b.setPixel(2,0,65280); + b.setPixel(3,0,16776960); + b.setPixel(0,1,255); + b.setPixel(1,1,16711935); + b.setPixel(2,1,65535); + b.setPixel(3,1,16777215); + com_davidmaletz_mining_ui_Radar.dot = new openfl_display_Tilesheet(b); + com_davidmaletz_mining_ui_Radar.dot.addTileRect(new openfl_geom_Rectangle(0,0,1,1)); + com_davidmaletz_mining_ui_Radar.dot.addTileRect(new openfl_geom_Rectangle(1,0,1,1)); + com_davidmaletz_mining_ui_Radar.dot.addTileRect(new openfl_geom_Rectangle(2,0,1,1)); + com_davidmaletz_mining_ui_Radar.dot.addTileRect(new openfl_geom_Rectangle(3,0,1,1)); + com_davidmaletz_mining_ui_Radar.dot.addTileRect(new openfl_geom_Rectangle(0,1,1,1)); + com_davidmaletz_mining_ui_Radar.dot.addTileRect(new openfl_geom_Rectangle(1,1,1,1)); + com_davidmaletz_mining_ui_Radar.dot.addTileRect(new openfl_geom_Rectangle(2,1,1,1)); + com_davidmaletz_mining_ui_Radar.dot.addTileRect(new openfl_geom_Rectangle(3,1,1,1)); + } + this.padding = padding; + this.includeTiles = n.get("includeTiles") != "false"; + if(n.exists("structureId")) { + this.structure = com_davidmaletz_faengfl_EventHandler.execute(n.get("structureId"),vars); + } + if(n.exists("objectId")) { + this.object = com_davidmaletz_faengfl_EventHandler.execute(n.get("objectId"),vars); + } + if(n.exists("tileId")) { + this.tileid = com_davidmaletz_faengfl_EventHandler.execute(n.get("tileId"),vars); + } +}; +$hxClasses["com.davidmaletz.mining.ui.Radar"] = com_davidmaletz_mining_ui_Radar; +com_davidmaletz_mining_ui_Radar.__name__ = ["com","davidmaletz","mining","ui","Radar"]; +com_davidmaletz_mining_ui_Radar.__interfaces__ = [AbstractClass]; +com_davidmaletz_mining_ui_Radar.dot = null; +com_davidmaletz_mining_ui_Radar.instance = null; +com_davidmaletz_mining_ui_Radar.hide = function(id) { + if(com_davidmaletz_mining_ui_Radar.instance != null && com_davidmaletz_mining_ui_Radar.instance.id == id) { + com_davidmaletz_faengfl_FaengFL.remove(com_davidmaletz_mining_ui_Radar.instance); + } +}; +com_davidmaletz_mining_ui_Radar.create = function(n,vars) { + var id = n.get("id"); + var c = com_davidmaletz_mining_Main.getContainer(); + var t = n.get("tile"); + var anim = n.exists("animation") ? n.get("animation") : "single"; + var pad = n.exists("padding") ? com_davidmaletz_mining_Main.parseInt(n.get("padding")) : 0; + if(n.exists("centerOn")) { + return new com_davidmaletz_mining_ui__$Radar_CenterRadar(n,vars,id,c,t,anim,pad,com_davidmaletz_mining_Main.parseFloat(n.get("scale")),com_davidmaletz_faengfl_EventHandler.execute(n.get("centerOn"),vars)); + } else { + return new com_davidmaletz_mining_ui__$Radar_OrbitRadar(n,vars,id,c,t,anim,pad); + } +}; +com_davidmaletz_mining_ui_Radar.__super__ = com_davidmaletz_tiles_render_PlayAnimation; +com_davidmaletz_mining_ui_Radar.prototype = $extend(com_davidmaletz_tiles_render_PlayAnimation.prototype,{ + id: null + ,sprite: null + ,area: null + ,_width: null + ,_height: null + ,xml: null + ,tiles: null + ,padding: null + ,structure: null + ,object: null + ,tileid: null + ,includeTiles: null + ,init: function(e) { + com_davidmaletz_tiles_render_PlayAnimation.prototype.init.call(this,e); + if(com_davidmaletz_mining_ui_Radar.instance != null) { + com_davidmaletz_faengfl_FaengFL.remove(com_davidmaletz_mining_ui_Radar.instance); + } + com_davidmaletz_mining_ui_Radar.instance = this; + this.area = com_davidmaletz_mining_Main.getLocalPlayer().getCurrentArea(); + if(this.area != null) { + if(this.includeTiles) { + this.tiles = new com_davidmaletz_mining_ui_RadarFloorRenderer(this); + this.tiles.set_scaleX(this.getScaleX()); + this.tiles.set_scaleY(this.getScaleY()); + var s = new com_davidmaletz_faengfl_ScissorSprite(this._width,this._height,this,com_davidmaletz_mining_Main.getContainer(),this.padding,this.padding); + s.addChild(this.tiles); + this.addChildAt(s,this.get_numChildren() - 1); + } + this.update(); + } + } + ,destroy: function(e) { + com_davidmaletz_tiles_render_PlayAnimation.prototype.destroy.call(this,e); + if(com_davidmaletz_mining_ui_Radar.instance == this) { + com_davidmaletz_mining_ui_Radar.instance = null; + } + this.sprite.get_graphics().clear(); + com_fancyfish_faeng_common_Utils.clear(com_davidmaletz_mining_ui_Radar.data); + this.area = null; + if(this.tiles != null) { + this.removeChild(this.tiles.parent); + this.tiles = null; + } + } + ,advanceFrame: function(df) { + com_davidmaletz_tiles_render_PlayAnimation.prototype.advanceFrame.call(this,df); + this.update(); + } + ,drawObjects: function(draw) { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,getScaleX: function() { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,getScaleY: function() { + throw new js__$Boot_HaxeError("abstract method, must override"); + } + ,update: function() { + var g = this.sprite.get_graphics(); + g.clear(); + com_fancyfish_faeng_common_Utils.clear(com_davidmaletz_mining_ui_Radar.data); + if(this.area == null || this.area.renderer == null) { + return; + } + var len = 0; + var sx = this.getScaleX(); + var sy = this.getScaleY(); + var draw = function(b,id) { + if(id < 0 || id >= 8) { + return; + } + com_davidmaletz_mining_ui_Radar.data.push(Math.floor(b.x * sx)); + com_davidmaletz_mining_ui_Radar.data.push(Math.floor(b.y * sy)); + com_davidmaletz_mining_ui_Radar.data.push(id); + com_davidmaletz_mining_ui_Radar.data.push(Math.ceil(b.width * sx)); + com_davidmaletz_mining_ui_Radar.data.push(0); + com_davidmaletz_mining_ui_Radar.data.push(0); + com_davidmaletz_mining_ui_Radar.data.push(Math.ceil(b.height * sy)); + len += 1; + }; + this.drawObjects(draw); + g.drawTiles(com_davidmaletz_mining_ui_Radar.dot,com_davidmaletz_mining_ui_Radar.data,false,16,null,len * 7); + } + ,getStructureId: function(s) { + if(this.structure == null) { + return 3; + } else { + return this.structure(s); + } + } + ,getObjectId: function(o) { + if(this.object == null) { + if(Std["is"](o,com_davidmaletz_mining_enemy_Enemy)) { + if((js_Boot.__cast(o , com_davidmaletz_mining_enemy_Enemy))._hostile) { + return 1; + } else { + return 3; + } + } else if(o.isPlayer()) { + return 2; + } else { + return 6; + } + } else { + return this.object(o); + } + } + ,getTileId: function(x,y) { + if(this.tileid == null) { + if(this.area.getTileId(x,y,0) == -1) { + return -1; + } else { + return 4; + } + } else { + return this.tileid(this.area,x,y); + } + } + ,__class__: com_davidmaletz_mining_ui_Radar +}); +var com_davidmaletz_mining_ui__$Radar_CenterRadar = function(n,vars,id,c,tile,anim,padding,scale,cen) { + this.scale = 1.0 / scale; + this.center = cen; + this.player = this.center == com_davidmaletz_mining_Main.getLocalPlayer(); + com_davidmaletz_mining_ui_Radar.call(this,n,vars,id,c,tile,anim,padding); +}; +$hxClasses["com.davidmaletz.mining.ui._Radar.CenterRadar"] = com_davidmaletz_mining_ui__$Radar_CenterRadar; +com_davidmaletz_mining_ui__$Radar_CenterRadar.__name__ = ["com","davidmaletz","mining","ui","_Radar","CenterRadar"]; +com_davidmaletz_mining_ui__$Radar_CenterRadar.__super__ = com_davidmaletz_mining_ui_Radar; +com_davidmaletz_mining_ui__$Radar_CenterRadar.prototype = $extend(com_davidmaletz_mining_ui_Radar.prototype,{ + scale: null + ,center: null + ,player: null + ,drawObjects: function(draw) { + var _gthis = this; + if(this.player) { + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + this.center = p.vehicle == null ? p : p.vehicle; + } + var offsetX = this._width / this.scale * 0.5 - this.center.getCenterX(); + var offsetY = this._height / this.scale * 0.5 - this.center.getCenterY(); + var drawBounds = function(b,id) { + if(id < 0 || id >= 8) { + return; + } + b.x += offsetX; + b.y += offsetY; + if(b.get_top() < 0) { + b.set_top(0); + } + if(b.get_bottom() > _gthis._height / _gthis.scale) { + b.set_bottom(_gthis._height / _gthis.scale); + } + if(b.get_left() < 0) { + b.set_left(0); + } + if(b.get_right() > _gthis._width / _gthis.scale) { + b.set_right(_gthis._width / _gthis.scale); + } + if(b.width > 0 && b.height > 0) { + draw(b,id); + } + }; + var bounds = com_davidmaletz_mining_ui_Radar.bounds; + bounds.setTo(-offsetX,-offsetY,this._width / this.scale,this._height / this.scale); + if(this.tiles != null) { + this.tiles.set_x(Math.floor(-bounds.x * this.scale) + this.padding); + this.tiles.set_y(Math.floor(-bounds.y * this.scale) + this.padding); + this.tiles.setView(bounds.x,bounds.y,bounds.width,bounds.height); + } + if(this.xml.get("includeStructures") != "false") { + var _g = 0; + var _g1 = this.area.getStructuresInBounds(bounds); + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + drawBounds(s.getInnerBounds(),this.getStructureId(s)); + } + } + if(this.xml.get("includeObjects") != "false") { + var _g2 = 0; + var _g11 = this.area.getObjectsInBounds(bounds); + while(_g2 < _g11.length) { + var o = _g11[_g2]; + ++_g2; + if(o.parent == null && o.info.xml.get("save") != "false") { + drawBounds(o.getBounds(),this.getObjectId(o)); + } + } + } + } + ,getScaleX: function() { + return this.scale; + } + ,getScaleY: function() { + return this.scale; + } + ,__class__: com_davidmaletz_mining_ui__$Radar_CenterRadar +}); +var com_davidmaletz_mining_ui__$Radar_OrbitRadar = function(n,vars,id,c,tile,anim,padding) { + com_davidmaletz_mining_ui_Radar.call(this,n,vars,id,c,tile,anim,padding); +}; +$hxClasses["com.davidmaletz.mining.ui._Radar.OrbitRadar"] = com_davidmaletz_mining_ui__$Radar_OrbitRadar; +com_davidmaletz_mining_ui__$Radar_OrbitRadar.__name__ = ["com","davidmaletz","mining","ui","_Radar","OrbitRadar"]; +com_davidmaletz_mining_ui__$Radar_OrbitRadar.__super__ = com_davidmaletz_mining_ui_Radar; +com_davidmaletz_mining_ui__$Radar_OrbitRadar.prototype = $extend(com_davidmaletz_mining_ui_Radar.prototype,{ + drawObjects: function(draw) { + var orbit = this.area.planet.orbit; + var bounds = com_davidmaletz_mining_ui_Radar.bounds; + var drawBounds = function(b,id) { + if(id < 0 || id >= 8) { + return; + } + if(b.get_top() < 0) { + if(b.get_bottom() < 0) { + return; + } + b.set_top(0); + } + if(b.get_left() < 0) { + bounds.copyFrom(b); + bounds.set_right(0); + bounds.x += orbit.width * com_davidmaletz_tiles_Tile.SIZE; + draw(bounds,id); + b.set_left(0); + } else if(b.get_right() > orbit.width * com_davidmaletz_tiles_Tile.SIZE) { + bounds.copyFrom(b); + bounds.set_left(orbit.width * com_davidmaletz_tiles_Tile.SIZE); + bounds.x -= orbit.width * com_davidmaletz_tiles_Tile.SIZE; + draw(bounds,id); + b.set_right(orbit.width * com_davidmaletz_tiles_Tile.SIZE); + } + draw(b,id); + }; + if(this.tiles != null) { + this.tiles.set_x(this.padding); + this.tiles.set_y(this.padding); + this.tiles.setView(0,0,orbit.width * com_davidmaletz_tiles_Tile.SIZE,orbit.height * com_davidmaletz_tiles_Tile.SIZE); + } + if(this.xml.get("includeStructures") != "false") { + var s = this.area.getStructures(); + while(s.hasNext()) { + var s1 = s.next(); + drawBounds(s1.getInnerBounds(),this.getStructureId(s1)); + } + } + if(this.xml.get("includeObjects") != "false") { + var o = this.area.getAllObjects(); + while(o.hasNext()) { + var o1 = o.next(); + if(o1.parent == null && o1.info.xml.get("save") != "false") { + drawBounds(o1.getBounds(),this.getObjectId(o1)); + } + } + } + } + ,getScaleX: function() { + return this._width / (this.area.planet.orbit.width * com_davidmaletz_tiles_Tile.SIZE); + } + ,getScaleY: function() { + return this._height / (this.area.planet.orbit.height * com_davidmaletz_tiles_Tile.SIZE); + } + ,__class__: com_davidmaletz_mining_ui__$Radar_OrbitRadar +}); +var com_davidmaletz_mining_ui_RadarFloorRenderer = function(r) { + this.radar = r; + com_davidmaletz_tiles_render_FloorRenderer.call(this,this.radar.area,-1,null,false); +}; +$hxClasses["com.davidmaletz.mining.ui.RadarFloorRenderer"] = com_davidmaletz_mining_ui_RadarFloorRenderer; +com_davidmaletz_mining_ui_RadarFloorRenderer.__name__ = ["com","davidmaletz","mining","ui","RadarFloorRenderer"]; +com_davidmaletz_mining_ui_RadarFloorRenderer.__super__ = com_davidmaletz_tiles_render_FloorRenderer; +com_davidmaletz_mining_ui_RadarFloorRenderer.prototype = $extend(com_davidmaletz_tiles_render_FloorRenderer.prototype,{ + radar: null + ,createChunk: function(cx,cy) { + return new com_davidmaletz_mining_ui__$Radar_RadarChunk(this.radar,this.map,cx,cy,this.layer,this.getNeighbors,this.scale); + } + ,__class__: com_davidmaletz_mining_ui_RadarFloorRenderer +}); +var com_davidmaletz_mining_ui__$Radar_RadarChunk = function(r,map,cx,cy,l,neighbors,s) { + this.radar = r; + com_davidmaletz_tiles_render_ChunkRenderer.call(this,map,cx,cy,l,neighbors,s); + this.set_scaleX(this.set_scaleY(com_davidmaletz_tiles_Tile.SIZE)); +}; +$hxClasses["com.davidmaletz.mining.ui._Radar.RadarChunk"] = com_davidmaletz_mining_ui__$Radar_RadarChunk; +com_davidmaletz_mining_ui__$Radar_RadarChunk.__name__ = ["com","davidmaletz","mining","ui","_Radar","RadarChunk"]; +com_davidmaletz_mining_ui__$Radar_RadarChunk.__super__ = com_davidmaletz_tiles_render_ChunkRenderer; +com_davidmaletz_mining_ui__$Radar_RadarChunk.prototype = $extend(com_davidmaletz_tiles_render_ChunkRenderer.prototype,{ + radar: null + ,drawLayers: function(offsetX,offsetY) { + if(offsetY == null) { + offsetY = 0; + } + if(offsetX == null) { + offsetX = 0; + } + var area = this.radar.area; + if(area == null || area.renderer == null) { + return; + } + var sx = this.chunk.x * 16; + var sy = this.chunk.y * 16; + var _g = 0; + while(_g < 16) { + var ty = _g++; + var _g1 = 0; + while(_g1 < 16) { + var tx = _g1++; + var id = this.radar.getTileId(sx + tx,sy + ty); + if(id >= 0 && id < 8) { + this.handler.addTile(com_davidmaletz_mining_ui_Radar.dot,tx,ty,id); + } + } + } + } + ,__class__: com_davidmaletz_mining_ui__$Radar_RadarChunk +}); +var com_davidmaletz_mining_ui_RecipeList = function(recipes,func,label,i,c,p,none,filter,enabled) { + com_davidmaletz_mining_ui_CraftingWindow.call(this,false,recipes,label,i,c,p.includeCost(),null,null,null,null,null,0.2,0.5,none,filter); + this.onCraftFunc = func; + this.enabled = enabled; +}; +$hxClasses["com.davidmaletz.mining.ui.RecipeList"] = com_davidmaletz_mining_ui_RecipeList; +com_davidmaletz_mining_ui_RecipeList.__name__ = ["com","davidmaletz","mining","ui","RecipeList"]; +com_davidmaletz_mining_ui_RecipeList.__super__ = com_davidmaletz_mining_ui_CraftingWindow; +com_davidmaletz_mining_ui_RecipeList.prototype = $extend(com_davidmaletz_mining_ui_CraftingWindow.prototype,{ + onCraftFunc: null + ,enabled: null + ,onSelect: function(recipe) { + if(!this.isEnabled(recipe)) { + this.close(); + return; + } + if(recipe == null) { + this.onCraftFunc(recipe); + this.close(); + return; + } + var max = this.list.inventory.maxCraft(com_davidmaletz_mining_Main.getLocalPlayer(),recipe); + if(max == 0) { + com_davidmaletz_faengfl_adv_sound_Sound.play("warning"); + new com_davidmaletz_faengfl_ui_Popup(128.,52.,0,com_fancyfish_faeng_common_Lang.getText("warning","ingredients"),16720418); + } else { + this._doCraft(recipe,1); + } + } + ,isEnabled: function(recipe) { + if(this.enabled != null) { + return this.enabled(recipe); + } else { + return true; + } + } + ,_doCraft: function(recipe,ct) { + if(ct > 0 && this.list.inventory.useIngredients(recipe,1)) { + recipe.gainAchievement(); + this.onCraftFunc(recipe); + this.close(); + com_davidmaletz_mining_Main.getLocalPlayer().addExp(2); + } + } + ,__class__: com_davidmaletz_mining_ui_RecipeList +}); +var com_davidmaletz_mining_ui_RecipeRenderer = function(handler,i,fuel,none,w) { + if(w == null) { + w = 124; + } + this.handler = handler; + this.inventory = i; + this.fuelName = fuel; + this.none = none; + this.width = w; +}; +$hxClasses["com.davidmaletz.mining.ui.RecipeRenderer"] = com_davidmaletz_mining_ui_RecipeRenderer; +com_davidmaletz_mining_ui_RecipeRenderer.__name__ = ["com","davidmaletz","mining","ui","RecipeRenderer"]; +com_davidmaletz_mining_ui_RecipeRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui_RecipeRenderer.prototype = { + width: null + ,handler: null + ,inventory: null + ,fuelName: null + ,none: null + ,create: function(item,x,y) { + if(item == null) { + return new com_davidmaletz_mining_ui__$RecipeRenderer_NullRecipe(this.handler,this.inventory,this.width,x,y,this.none); + } else if(item.creates != null || item.fuel <= 0) { + return new com_davidmaletz_mining_ui_RecipeButton(this.handler,this.inventory,item,this.width,x,y); + } else { + return new com_davidmaletz_mining_ui__$RecipeRenderer_FuelButton(this.handler,this.inventory,item,this.fuelName,this.width,x,y); + } + } + ,update: function(s,item) { + if(Std["is"](s,com_davidmaletz_mining_ui__$RecipeRenderer_ListButton)) { + (js_Boot.__cast(s , com_davidmaletz_mining_ui__$RecipeRenderer_ListButton)).updateEnabled(); + } + } + ,getWidth: function() { + return this.width; + } + ,getHeight: function(item) { + if(item == null || item.creates == null && item.fuel != 0) { + return com_davidmaletz_mining_ui__$RecipeRenderer_FuelButton.getHeight(); + } else { + return com_davidmaletz_mining_ui_RecipeButton.getHeight(item); + } + } + ,__class__: com_davidmaletz_mining_ui_RecipeRenderer +}; +var com_davidmaletz_mining_ui__$RecipeRenderer_ListButton = function(handler,i,r,bg,hover,x,y) { + com_davidmaletz_controls_Button.call(this,x,y,bg,hover,null); + this.inventory = i; + this.handler = handler; + this.recipe = r; + this.text = new openfl_display_Sprite(); + if(this.isCentered()) { + com_davidmaletz_mining_ui_ItemRenderer.addItemCentered(this.text,this,Math.round(bg.getWidth() * 0.5)); + } else { + com_davidmaletz_mining_ui_ItemRenderer.addItem(this.text,this,2); + } + var ct = this.getCount(); + if(ct != null) { + var t = new com_davidmaletz_faengfl_TextSprite(ct,new com_fancyfish_faeng_text_CharacterPlacer(bg.getWidth() - 2,2),0,1); + this.text.addChild(t); + } + this.addChild(this.text); +}; +$hxClasses["com.davidmaletz.mining.ui._RecipeRenderer.ListButton"] = com_davidmaletz_mining_ui__$RecipeRenderer_ListButton; +com_davidmaletz_mining_ui__$RecipeRenderer_ListButton.__name__ = ["com","davidmaletz","mining","ui","_RecipeRenderer","ListButton"]; +com_davidmaletz_mining_ui__$RecipeRenderer_ListButton.__interfaces__ = [com_davidmaletz_mining_ui_Iconable]; +com_davidmaletz_mining_ui__$RecipeRenderer_ListButton.__super__ = com_davidmaletz_controls_Button; +com_davidmaletz_mining_ui__$RecipeRenderer_ListButton.prototype = $extend(com_davidmaletz_controls_Button.prototype,{ + recipe: null + ,inventory: null + ,handler: null + ,text: null + ,onClick: function() { + if(this.recipe == null || this.recipe.isAvailable(com_davidmaletz_mining_npc_NPCEventHandler.createVariables(com_davidmaletz_mining_Main.getLocalPlayer()))) { + this.handler.onSelect(this.recipe); + } + return true; + } + ,onHover: function(hover) { + com_davidmaletz_controls_Button.prototype.onHover.call(this,hover); + this.handler.onHover(hover ? this.recipe : null); + } + ,updateEnabled: function() { + } + ,createIcon: function() { + if(this.recipe == null) { + return null; + } else { + return this.recipe.createIcon(); + } + } + ,getName: function() { + if(this.recipe == null) { + return null; + } else { + return this.recipe.getName(); + } + } + ,getElement: function() { + return null; + } + ,getCount: function() { + return null; + } + ,isCentered: function() { + return false; + } + ,__class__: com_davidmaletz_mining_ui__$RecipeRenderer_ListButton +}); +var com_davidmaletz_mining_ui__$RecipeRenderer_FuelButton = function(handler,i,r,fuelName,w,x,y) { + var h = com_davidmaletz_mining_ui__$RecipeRenderer_FuelButton.getHeight(); + this.fuelName = fuelName; + com_davidmaletz_mining_ui__$RecipeRenderer_ListButton.call(this,handler,i,r,com_davidmaletz_mining_Main.label_factory.createBG(w,h),com_davidmaletz_mining_Main.label_factory.createHover(w,h),x,y); + this.updateEnabled(); +}; +$hxClasses["com.davidmaletz.mining.ui._RecipeRenderer.FuelButton"] = com_davidmaletz_mining_ui__$RecipeRenderer_FuelButton; +com_davidmaletz_mining_ui__$RecipeRenderer_FuelButton.__name__ = ["com","davidmaletz","mining","ui","_RecipeRenderer","FuelButton"]; +com_davidmaletz_mining_ui__$RecipeRenderer_FuelButton.getHeight = function() { + return com_fancyfish_faeng_text_FontManager.lineHeight(); +}; +com_davidmaletz_mining_ui__$RecipeRenderer_FuelButton.__super__ = com_davidmaletz_mining_ui__$RecipeRenderer_ListButton; +com_davidmaletz_mining_ui__$RecipeRenderer_FuelButton.prototype = $extend(com_davidmaletz_mining_ui__$RecipeRenderer_ListButton.prototype,{ + fuelName: null + ,updateEnabled: function() { + this.text.set_alpha(this.inventory.canCraft(com_davidmaletz_mining_Main.getLocalPlayer(),this.recipe) && this.handler.isEnabled(this.recipe) ? 1 : 0.5); + } + ,createIcon: function() { + var r = this.recipe.getRequirements(); + if(r != null && r.hasNext()) { + return r.next().createIcon(); + } else { + return new openfl_display_Sprite(); + } + } + ,getName: function() { + return com_fancyfish_faeng_common_Lang.getText("common","add_" + (this.fuelName == null ? "fuel" : this.fuelName)); + } + ,getCount: function() { + return new com_fancyfish_faeng_common_mutable_Static(Std.string(this.recipe.fuel)); + } + ,__class__: com_davidmaletz_mining_ui__$RecipeRenderer_FuelButton +}); +var com_davidmaletz_mining_ui__$RecipeRenderer_NullRecipe = function(handler,i,w,x,y,none) { + var h = com_davidmaletz_mining_ui__$RecipeRenderer_FuelButton.getHeight(); + this.none = none; + com_davidmaletz_mining_ui__$RecipeRenderer_ListButton.call(this,handler,i,null,com_davidmaletz_mining_Main.label_factory.createBG(w,h),com_davidmaletz_mining_Main.label_factory.createHover(w,h),x,y); + this.updateEnabled(); +}; +$hxClasses["com.davidmaletz.mining.ui._RecipeRenderer.NullRecipe"] = com_davidmaletz_mining_ui__$RecipeRenderer_NullRecipe; +com_davidmaletz_mining_ui__$RecipeRenderer_NullRecipe.__name__ = ["com","davidmaletz","mining","ui","_RecipeRenderer","NullRecipe"]; +com_davidmaletz_mining_ui__$RecipeRenderer_NullRecipe.__super__ = com_davidmaletz_mining_ui__$RecipeRenderer_ListButton; +com_davidmaletz_mining_ui__$RecipeRenderer_NullRecipe.prototype = $extend(com_davidmaletz_mining_ui__$RecipeRenderer_ListButton.prototype,{ + none: null + ,updateEnabled: function() { + this.text.set_alpha(this.handler.isEnabled(this.recipe) ? 1 : 0.5); + } + ,getName: function() { + var t = com_fancyfish_faeng_common_Lang.getTextFromTitle(this.none); + if(t == null) { + return com_fancyfish_faeng_common_Lang.getText("common","none"); + } else { + return t; + } + } + ,isCentered: function() { + return true; + } + ,__class__: com_davidmaletz_mining_ui__$RecipeRenderer_NullRecipe +}); +var com_davidmaletz_mining_ui_RecipeButton = function(handler,i,r,w,x,y) { + var h = com_davidmaletz_mining_ui_RecipeButton.getHeight(r); + var fh = com_davidmaletz_mining_ui__$RecipeRenderer_FuelButton.getHeight(); + com_davidmaletz_mining_ui__$RecipeRenderer_ListButton.call(this,handler,i,r,com_davidmaletz_mining_Main.label_factory.createBG(w,h),com_davidmaletz_mining_Main.label_factory.createHover(w,h),x,y); + var x1 = 6; + this.reqs = []; + var r1 = this.recipe.getRequirements(); + while(r1.hasNext()) { + var r2 = r1.next(); + var icon = r2.createIcon(); + icon.set_x(x1); + icon.set_y(fh); + this.text.addChild(icon); + if(r2.count > 0) { + var t = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Static(r2.count == null ? "null" : "" + r2.count),new com_fancyfish_faeng_text_CharacterPlacer(8,1),16711680,1); + t.set_x(x1 + com_davidmaletz_tiles_Tile.SIZE); + t.set_y(fh); + this.text.addChild(t); + this.reqs.push(t); + } else { + this.reqs.push(null); + } + x1 += com_davidmaletz_tiles_Tile.SIZE + (r2.count == 1 ? 7 : 13); + } + this.updateEnabled(); +}; +$hxClasses["com.davidmaletz.mining.ui.RecipeButton"] = com_davidmaletz_mining_ui_RecipeButton; +com_davidmaletz_mining_ui_RecipeButton.__name__ = ["com","davidmaletz","mining","ui","RecipeButton"]; +com_davidmaletz_mining_ui_RecipeButton.getHeight = function(r) { + var ret = com_fancyfish_faeng_text_FontManager.lineHeight(); + if(r == null || r.numRequirements() > 0) { + ret *= 2; + } + return ret; +}; +com_davidmaletz_mining_ui_RecipeButton.__super__ = com_davidmaletz_mining_ui__$RecipeRenderer_ListButton; +com_davidmaletz_mining_ui_RecipeButton.prototype = $extend(com_davidmaletz_mining_ui__$RecipeRenderer_ListButton.prototype,{ + reqs: null + ,isEnabled: function() { + return this.handler.isEnabled(this.recipe); + } + ,updateEnabled: function() { + var enabled = this.isEnabled(); + var i = 0; + var r = this.recipe.getRequirements(); + while(r.hasNext()) { + var r1 = r.next(); + var req = this.reqs[i++]; + if(req == null) { + continue; + } + var c = req.get_transform().get_colorTransform(); + var e = !r1.hasItems(com_davidmaletz_mining_Main.getLocalPlayer(),this.inventory); + if(e) { + enabled = false; + } + c.redMultiplier = e ? 1 : 0; + req.get_transform().set_colorTransform(c); + } + this.text.set_alpha(enabled ? 1 : 0.5); + } + ,getElement: function() { + if(this.recipe.creates == null) { + return null; + } else { + return this.recipe.creates.getElement(); + } + } + ,getCount: function() { + if(this.recipe.creates == null || this.recipe.creates.count == 1) { + return null; + } else { + return new com_fancyfish_faeng_common_mutable_Static("x" + this.recipe.creates.count); + } + } + ,__class__: com_davidmaletz_mining_ui_RecipeButton +}); +var com_davidmaletz_mining_ui_RepairRenderer = function(d,o,inv) { + this.details = d; + this.object = o; + this.inventory = inv; +}; +$hxClasses["com.davidmaletz.mining.ui.RepairRenderer"] = com_davidmaletz_mining_ui_RepairRenderer; +com_davidmaletz_mining_ui_RepairRenderer.__name__ = ["com","davidmaletz","mining","ui","RepairRenderer"]; +com_davidmaletz_mining_ui_RepairRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui_RepairRenderer.prototype = { + details: null + ,object: null + ,inventory: null + ,create: function(item,x,y) { + return new com_davidmaletz_mining_ui__$RepairRenderer_ListButton(item,this,x,y); + } + ,update: function(s,item) { + if(Std["is"](s,com_davidmaletz_mining_ui__$RepairRenderer_ListButton)) { + (js_Boot.__cast(s , com_davidmaletz_mining_ui__$RepairRenderer_ListButton)).updateEnabled(); + } + } + ,getWidth: function() { + return 80; + } + ,getHeight: function(item) { + return com_davidmaletz_mining_ui__$RepairRenderer_ListButton.getHeight(); + } + ,__class__: com_davidmaletz_mining_ui_RepairRenderer +}; +var com_davidmaletz_mining_ui__$RepairRenderer_ListButton = function(i,r,x,y) { + var w = 80; + var h = com_davidmaletz_mining_ui__$RepairRenderer_ListButton.getHeight(); + com_davidmaletz_controls_Button.call(this,x,y,com_davidmaletz_mining_Main.label_factory.createBG(w,h),com_davidmaletz_mining_Main.label_factory.createHover(w,h),null); + this.item = i; + this.renderer = r; + this.text = new openfl_display_Sprite(); + com_davidmaletz_mining_ui_ItemRenderer.addItem(this.text,this,2); + var t = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Static(i.count == null ? "null" : "" + i.count),new com_fancyfish_faeng_text_CharacterPlacer(w - 2,2),0,1); + this.text.addChild(t); + this.recipe = com_davidmaletz_mining_item_Recipe.createFuel(i.item,i.count); + this.text.addChild(t); + this.addChild(this.text); + this.updateEnabled(); +}; +$hxClasses["com.davidmaletz.mining.ui._RepairRenderer.ListButton"] = com_davidmaletz_mining_ui__$RepairRenderer_ListButton; +com_davidmaletz_mining_ui__$RepairRenderer_ListButton.__name__ = ["com","davidmaletz","mining","ui","_RepairRenderer","ListButton"]; +com_davidmaletz_mining_ui__$RepairRenderer_ListButton.__interfaces__ = [com_davidmaletz_mining_ui_Iconable]; +com_davidmaletz_mining_ui__$RepairRenderer_ListButton.getHeight = function() { + return com_fancyfish_faeng_text_FontManager.lineHeight(); +}; +com_davidmaletz_mining_ui__$RepairRenderer_ListButton.__super__ = com_davidmaletz_controls_Button; +com_davidmaletz_mining_ui__$RepairRenderer_ListButton.prototype = $extend(com_davidmaletz_controls_Button.prototype,{ + item: null + ,renderer: null + ,text: null + ,recipe: null + ,onClick: function() { + var max = this.renderer.inventory.getItemCount(this.item.item); + if(max == 0) { + com_davidmaletz_faengfl_adv_sound_Sound.play("warning"); + new com_davidmaletz_faengfl_ui_Popup(128.,52.,0,com_fancyfish_faeng_common_Lang.getText("warning","ingredients"),16720418); + } else if(this.renderer.object.getHealthPercent() < 1) { + max = com_fancyfish_faeng_common_Utils.min(max,Math.ceil((this.renderer.object.getMaxHealth() - this.renderer.object.getHealth()) / this.item.count)); + if(com_davidmaletz_faengfl_adv_AdvApp.shiftDown) { + this.doRepair(1); + } else { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_ItemCountPrompt(c,this.item.item,max,com_fancyfish_faeng_common_Lang.getText("common","use_count"),com_fancyfish_faeng_common_Utils.min(max,Math.floor((this.renderer.object.getMaxHealth() - this.renderer.object.getHealth()) / this.item.count)),$bind(this,this.doRepair)),2); + } + } + return true; + } + ,doRepair: function(ct) { + if(this.renderer.inventory.getItemCount(this.item.item) >= ct) { + this.renderer.object.playSound(this.renderer.object.info.xml.exists("repair_sfx") ? this.renderer.object.info.xml.get("repair_sfx") : "workshop",false); + this.renderer.inventory.addItemCount(this.item.item,-ct); + this.renderer.object.addHealth(this.item.count * ct); + this.updateEnabled(); + this.renderer.details.setInfo(null); + this.showInfo(); + } + } + ,showInfo: function() { + this.renderer.details.setRecipe(this.recipe,this.renderer.inventory,"actions.repair"); + } + ,onHover: function(hover) { + com_davidmaletz_controls_Button.prototype.onHover.call(this,hover); + if(hover) { + this.showInfo(); + } else { + this.renderer.details.setInfo(null); + } + } + ,updateEnabled: function() { + this.text.set_alpha(this.renderer.object.getHealthPercent() < 1 && this.renderer.inventory.getItemCount(this.item.item) > 0 ? 1 : 0.5); + } + ,createIcon: function() { + return this.item.createIcon(); + } + ,getName: function() { + return com_fancyfish_faeng_common_Lang.getText("actions","repair"); + } + ,getElement: function() { + return null; + } + ,__class__: com_davidmaletz_mining_ui__$RepairRenderer_ListButton +}); +var com_davidmaletz_mining_ui_RepairWindow = function(label,inv,eq,c,p,xml,obj,halign,valign) { + if(valign == null) { + valign = 0.5; + } + if(halign == null) { + halign = 0.2; + } + this.details = new com_davidmaletz_mining_ui_details_RecipeDetails(false,com_fancyfish_faeng_common_Lang.getText("common","repair_cost")); + var p1 = p; + var a1 = xml; + var o = obj; + this.onCraft = function(r) { + return com_davidmaletz_mining_ui_CraftingWindow._onCraft(p1,a1,o,r); + }; + this.inventory = inv; + this.equipment = eq; + this.list = new com_davidmaletz_mining_ui_CraftingList(this,this.inventory,c,null); + this.list.addItems(this.getRecipes(),this.details,xml.elementPathsNamed("listItem"),obj); + com_davidmaletz_controls_ClickableWindow.call(this,c,com_davidmaletz_mining_Main.window_factory.create(this.getWidth(),this.getHeight()),true,true,true,halign,valign); + var _g = this; + _g.set_x(_g.get_x() - 16); + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,label,this.getWidth()); + this.list.set_x(4); + this.list.set_y(4); + this.addChild(this.list); + var close = new com_davidmaletz_controls_CloseButton(this,this.getWidth(),0); + this.addChild(close); + this.clickables.addClickable(close,this); + this.details.set_x(this.getWidth() + 4); + this.addChild(this.details); +}; +$hxClasses["com.davidmaletz.mining.ui.RepairWindow"] = com_davidmaletz_mining_ui_RepairWindow; +com_davidmaletz_mining_ui_RepairWindow.__name__ = ["com","davidmaletz","mining","ui","RepairWindow"]; +com_davidmaletz_mining_ui_RepairWindow.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_RepairWindow.canRepair = function(i) { + if(i.canRepair()) { + return i.getDurability() > 0; + } else { + return false; + } +}; +com_davidmaletz_mining_ui_RepairWindow.__super__ = com_davidmaletz_controls_ClickableWindow; +com_davidmaletz_mining_ui_RepairWindow.prototype = $extend(com_davidmaletz_controls_ClickableWindow.prototype,{ + list: null + ,details: null + ,onCraft: null + ,equipment: null + ,inventory: null + ,getRecipes: function() { + var recipes = []; + if(this.equipment != null) { + var i = this.equipment.getEquipment(); + while(i.hasNext()) { + var i1 = i.next(); + if(com_davidmaletz_mining_ui_RepairWindow.canRepair(i1.info) && i1.value > 0) { + recipes.push(i1.info.getRepair(i1.value,i1.getNameStr(),true)); + } + } + } + var i2 = this.inventory.getItems(com_davidmaletz_mining_ui_RepairWindow.canRepair); + while(i2.hasNext()) { + var i3 = i2.next(); + var item = this.inventory.getItem(i3.item); + if(item != null) { + var v = item.getItemValues(); + while(v.hasNext()) { + var v1 = v.next(); + if(v1.value > 0 && v1.count > 0) { + recipes.push(v1.item.getRepair(v1.value,v1.name,false)); + } + } + } + } + return HxOverrides.iter(recipes); + } + ,createClickables: function() { + return new com_davidmaletz_controls_CompoundClickableColumns([this.list.getList().clickables],[4]); + } + ,onSelect: function(recipe) { + if(this.inventory.useIngredients(recipe)) { + recipe.gainAchievement(); + var name; + if(recipe.fuel < 0) { + var slot = recipe.creates.item.xml.get("slot"); + this.equipment.increaseValue(com_davidmaletz_mining_Main.getLocalPlayer(),slot,-recipe.creates.value); + var e = this.equipment.getItem(slot); + if(e == null) { + name = null; + } else { + name = e.getNameStr(); + } + } else { + recipe.creates.asItem().increaseValue(this.inventory,-recipe.creates.value); + name = recipe.creates.name; + } + this.list.updateRecipes(this.getRecipes(),this.clickables); + new com_davidmaletz_faengfl_ui_Popup(128. + (com_davidmaletz_tiles_Tile.SIZE + 4) * 0.5,(144 - com_davidmaletz_tiles_Tile.SIZE) * 0.5,-com_davidmaletz_tiles_Tile.SIZE,new com_fancyfish_faeng_common_mutable_Static(recipe.creates.item.getNotification(com_fancyfish_faeng_common_Lang.getText("common","repaired"),name)),16777215,-16777216,20,20,20,null,true); + if(this.onCraft != null) { + var f = this.onCraft; + var a1 = recipe; + var a11 = function() { + return f(a1); + }; + var a2 = this.onClose; + this.onClose = function() { + com_davidmaletz_mining_ui_CraftingWindow.closeFunc(a11,a2); + }; + if(this.onCraft(null)) { + this.close(); + } + this.onCraft = null; + } + com_davidmaletz_faengfl_adv_sound_Sound.play("workshop"); + } else { + com_davidmaletz_faengfl_adv_sound_Sound.play("warning"); + new com_davidmaletz_faengfl_ui_Popup(128.,52.,0,com_fancyfish_faeng_common_Lang.getText("warning","ingredients"),16720418); + } + } + ,onHover: function(recipe) { + this.details.setRecipe(recipe,this.list.inventory); + this.details.set_y(Math.round((this.getHeight() - this.details.getHeight()) * 0.5)); + } + ,isEnabled: function(recipe) { + return true; + } + ,getWidth: function() { + return this.list.getWidth() + 8; + } + ,getHeight: function() { + return this.list.getHeight() + 8; + } + ,__class__: com_davidmaletz_mining_ui_RepairWindow +}); +var com_davidmaletz_mining_ui__$SaveList_MyStaticPlayAnimation = function(tile,anim,fps,loop) { + com_davidmaletz_tiles_render_StaticPlayAnimation.call(this,tile,anim,fps,loop); +}; +$hxClasses["com.davidmaletz.mining.ui._SaveList.MyStaticPlayAnimation"] = com_davidmaletz_mining_ui__$SaveList_MyStaticPlayAnimation; +com_davidmaletz_mining_ui__$SaveList_MyStaticPlayAnimation.__name__ = ["com","davidmaletz","mining","ui","_SaveList","MyStaticPlayAnimation"]; +com_davidmaletz_mining_ui__$SaveList_MyStaticPlayAnimation.__super__ = com_davidmaletz_tiles_render_StaticPlayAnimation; +com_davidmaletz_mining_ui__$SaveList_MyStaticPlayAnimation.prototype = $extend(com_davidmaletz_tiles_render_StaticPlayAnimation.prototype,{ + enter_frame: function(frames) { + if(this.parent != null && this.parent.get_visible()) { + com_davidmaletz_tiles_render_StaticPlayAnimation.prototype.enter_frame.call(this,frames); + } else { + this.setFrame(0); + } + } + ,__class__: com_davidmaletz_mining_ui__$SaveList_MyStaticPlayAnimation +}); +var com_davidmaletz_mining_ui__$SaveList_ExportRenderer = function() { +}; +$hxClasses["com.davidmaletz.mining.ui._SaveList.ExportRenderer"] = com_davidmaletz_mining_ui__$SaveList_ExportRenderer; +com_davidmaletz_mining_ui__$SaveList_ExportRenderer.__name__ = ["com","davidmaletz","mining","ui","_SaveList","ExportRenderer"]; +com_davidmaletz_mining_ui__$SaveList_ExportRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui__$SaveList_ExportRenderer.isEnabled = function(item) { + return typeof(com_davidmaletz_mining_Main.getSlotHeader(com_davidmaletz_mining_Main.slotToId(item))) != "boolean"; +}; +com_davidmaletz_mining_ui__$SaveList_ExportRenderer.prototype = { + create: function(item,x,y) { + var f = $bind(this,this.onSelect); + var a1 = item; + return com_davidmaletz_mining_ui_BaseSaveList.createIconButton(130,y,"export_save",function() { + f(a1); + },com_davidmaletz_mining_ui__$SaveList_ExportRenderer.isEnabled(item)); + } + ,update: function(s,item) { + } + ,getWidth: function() { + return 20; + } + ,getHeight: function(item) { + return com_davidmaletz_mining_ui_SaveRenderer._getHeight(); + } + ,onSelect: function(slot) { + if(com_davidmaletz_mining_ui__$SaveList_ExportRenderer.isEnabled(slot)) { + com_davidmaletz_mining_ui_Options.saveFile(slot); + } + } + ,__class__: com_davidmaletz_mining_ui__$SaveList_ExportRenderer +}; +var com_davidmaletz_mining_ui__$SaveList_DeleteRenderer = function(l) { + this.list = l; +}; +$hxClasses["com.davidmaletz.mining.ui._SaveList.DeleteRenderer"] = com_davidmaletz_mining_ui__$SaveList_DeleteRenderer; +com_davidmaletz_mining_ui__$SaveList_DeleteRenderer.__name__ = ["com","davidmaletz","mining","ui","_SaveList","DeleteRenderer"]; +com_davidmaletz_mining_ui__$SaveList_DeleteRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui__$SaveList_DeleteRenderer.isEnabled = function(item) { + return com_davidmaletz_mining_Main.hasSave(com_davidmaletz_mining_Main.slotToId(item)); +}; +com_davidmaletz_mining_ui__$SaveList_DeleteRenderer.prototype = { + list: null + ,create: function(item,x,y) { + var f = $bind(this,this.onSelect); + var a1 = item; + return com_davidmaletz_mining_ui_BaseSaveList.createIconButton(150,y,"delete_save",function() { + f(a1); + },com_davidmaletz_mining_ui__$SaveList_DeleteRenderer.isEnabled(item)); + } + ,update: function(s,item) { + } + ,getWidth: function() { + return 20; + } + ,getHeight: function(item) { + return com_davidmaletz_mining_ui_SaveRenderer._getHeight(); + } + ,onSelect: function(slot) { + if(com_davidmaletz_mining_ui__$SaveList_DeleteRenderer.isEnabled(slot)) { + var c = com_davidmaletz_mining_Main.getContainer(); + var f = $bind(this,this["delete"]); + var a1 = slot; + var tmp = function() { + f(a1); + }; + c.addDisplay(new com_davidmaletz_mining_ui_Prompt(c,com_fancyfish_faeng_common_Lang.getText("common","delete_save"),tmp),2); + } + } + ,'delete': function(item) { + com_davidmaletz_mining_Main.deleteSave(com_davidmaletz_mining_Main.slotToId(item),true); + this.list.update(); + } + ,__class__: com_davidmaletz_mining_ui__$SaveList_DeleteRenderer +}; +var com_davidmaletz_mining_ui_SaveRenderer = function(handler,w) { + if(w == null) { + w = 130; + } + this.handler = handler; + this.width = w; +}; +$hxClasses["com.davidmaletz.mining.ui.SaveRenderer"] = com_davidmaletz_mining_ui_SaveRenderer; +com_davidmaletz_mining_ui_SaveRenderer.__name__ = ["com","davidmaletz","mining","ui","SaveRenderer"]; +com_davidmaletz_mining_ui_SaveRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui_SaveRenderer._getHeight = function() { + return com_fancyfish_faeng_text_FontManager.lineHeight() * 2; +}; +com_davidmaletz_mining_ui_SaveRenderer.prototype = { + handler: null + ,width: null + ,create: function(item,x,y) { + return new com_davidmaletz_mining_network_CloudSaveButton(this.handler,item,x,y); + } + ,update: function(s,item) { + } + ,getWidth: function() { + return this.width; + } + ,getHeight: function(item) { + return com_davidmaletz_mining_ui_SaveRenderer._getHeight(); + } + ,__class__: com_davidmaletz_mining_ui_SaveRenderer +}; +var com_davidmaletz_mining_ui_ScrollChoice = function(c,section,scrollRows,options,functions,w,darken,closeButton,halign,valign,cols,autoSelect) { + if(autoSelect == null) { + autoSelect = true; + } + if(cols == null) { + cols = 1; + } + if(valign == null) { + valign = 0.5; + } + if(halign == null) { + halign = 0.5; + } + if(closeButton == null) { + closeButton = true; + } + if(darken == null) { + darken = true; + } + if(w == null) { + w = 80; + } + this.autoSelect = true; + com_davidmaletz_controls_scroll_ScrollWindow.call(this,c,com_davidmaletz_mining_Main.window_factory,new com_davidmaletz_mining_ui_StringRenderer(section,this,w),scrollRows,cols,halign,valign,true,darken,true,closeButton); + this.functionMap = new haxe_ds_StringMap(); + this.autoSelect = autoSelect; + var len = options.length; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + var o = options[i]; + this.addItem(o); + this.functionMap.set(o,functions[i]); + } +}; +$hxClasses["com.davidmaletz.mining.ui.ScrollChoice"] = com_davidmaletz_mining_ui_ScrollChoice; +com_davidmaletz_mining_ui_ScrollChoice.__name__ = ["com","davidmaletz","mining","ui","ScrollChoice"]; +com_davidmaletz_mining_ui_ScrollChoice.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_ScrollChoice.__super__ = com_davidmaletz_controls_scroll_ScrollWindow; +com_davidmaletz_mining_ui_ScrollChoice.prototype = $extend(com_davidmaletz_controls_scroll_ScrollWindow.prototype,{ + functionMap: null + ,autoSelect: null + ,init: function(e) { + com_davidmaletz_controls_scroll_ScrollWindow.prototype.init.call(this,e); + if(!this.autoSelect) { + this.clickables.setSelected(null,0,0); + } + } + ,onCancel: function() { + if(this.darken != null || Std["is"](this.getChildAt(this.get_numChildren() - 1),com_davidmaletz_controls_CloseButton)) { + this.close(); + } + } + ,onSelect: function(item) { + var m = this.functionMap.get(item); + if(m != null) { + this.onClose = m; + this.close(); + } + } + ,onHover: function(item) { + } + ,isEnabled: function(item) { + return true; + } + ,__class__: com_davidmaletz_mining_ui_ScrollChoice +}); +var com_davidmaletz_mining_ui_ScrollbarUI = function() { +}; +$hxClasses["com.davidmaletz.mining.ui.ScrollbarUI"] = com_davidmaletz_mining_ui_ScrollbarUI; +com_davidmaletz_mining_ui_ScrollbarUI.__name__ = ["com","davidmaletz","mining","ui","ScrollbarUI"]; +com_davidmaletz_mining_ui_ScrollbarUI.__interfaces__ = [com_davidmaletz_controls_scroll_ScrollUI]; +com_davidmaletz_mining_ui_ScrollbarUI.prototype = { + isAlwaysVisible: function() { + return false; + } + ,getWidth: function() { + return 7; + } + ,getMinKnobHeight: function() { + return 14; + } + ,getBitmap: function() { + return com_davidmaletz_faengfl_AutoTileBitmap.get("data/ui/ancient_scroll.png",7,7); + } + ,createScrollbar: function(h) { + return new com_davidmaletz_mining_ui__$ScrollbarUI_Scrollbar(this.getBitmap(),0).setHeight(h); + } + ,createKnob: function() { + return new com_davidmaletz_mining_ui__$ScrollbarUI_Scrollbar(this.getBitmap(),1); + } + ,setKnobHeight: function(knob,h) { + (js_Boot.__cast(knob , com_davidmaletz_mining_ui__$ScrollbarUI_Scrollbar)).setHeight(h); + } + ,__class__: com_davidmaletz_mining_ui_ScrollbarUI +}; +var com_davidmaletz_mining_ui__$ScrollbarUI_Scrollbar = function(b,x) { + com_davidmaletz_faengfl_TileLayer.call(this); + this.bitmap = b; + this.tx = x; +}; +$hxClasses["com.davidmaletz.mining.ui._ScrollbarUI.Scrollbar"] = com_davidmaletz_mining_ui__$ScrollbarUI_Scrollbar; +com_davidmaletz_mining_ui__$ScrollbarUI_Scrollbar.__name__ = ["com","davidmaletz","mining","ui","_ScrollbarUI","Scrollbar"]; +com_davidmaletz_mining_ui__$ScrollbarUI_Scrollbar.__super__ = com_davidmaletz_faengfl_TileLayer; +com_davidmaletz_mining_ui__$ScrollbarUI_Scrollbar.prototype = $extend(com_davidmaletz_faengfl_TileLayer.prototype,{ + bitmap: null + ,tx: null + ,setHeight: function(height) { + var h = Math.ceil(height / 7) - 2; + this.start(); + var _g1 = 0; + var _g = h; + while(_g1 < _g) { + var y = _g1++; + this.bitmap.addTile(this.handler,this.tx,1,0,(y + 1) * 7); + } + this.bitmap.addTile(this.handler,this.tx,0,0,0); + this.bitmap.addTile(this.handler,this.tx,2,0,height - 7); + this.finish(); + return this; + } + ,__class__: com_davidmaletz_mining_ui__$ScrollbarUI_Scrollbar +}); +var com_davidmaletz_mining_ui_SellPrompt = function(p,c,coins,max_coins,item,max,func) { + this.costPerItem = Math.round(item.getInfo().cost * p.getSalePercent()); + var m = Math.ceil((max_coins - coins) / this.costPerItem); + if(m < max) { + max = m; + } + com_davidmaletz_mining_ui_CountPrompt.call(this,c,com_fancyfish_faeng_common_Lang.getText("common","sell_item"),func,0,max,1,12,com_fancyfish_faeng_text_FontManager.lineHeight() + 4); + com_davidmaletz_mining_ui_ItemRenderer.addItemCentered(this,item,50,4); + this.spinner.addEventListener("change_value",$bind(this,this.updateCost)); +}; +$hxClasses["com.davidmaletz.mining.ui.SellPrompt"] = com_davidmaletz_mining_ui_SellPrompt; +com_davidmaletz_mining_ui_SellPrompt.__name__ = ["com","davidmaletz","mining","ui","SellPrompt"]; +com_davidmaletz_mining_ui_SellPrompt.__super__ = com_davidmaletz_mining_ui_CountPrompt; +com_davidmaletz_mining_ui_SellPrompt.prototype = $extend(com_davidmaletz_mining_ui_CountPrompt.prototype,{ + cost: null + ,costPerItem: null + ,updateCost: function(e) { + this.cost.set(com_fancyfish_faeng_common_Utils.largeNumberFormat(this.spinner.getValue() * this.costPerItem)); + } + ,afterSpinner: function(y) { + this.cost = new com_fancyfish_faeng_common_mutable_Mutable(); + this.cost.set(com_fancyfish_faeng_common_Utils.largeNumberFormat(this.costPerItem)); + var x = (100 - com_davidmaletz_tiles_Tile.SIZE * 3) * 0.5; + var icon = com_davidmaletz_mining_item_ItemInfo._createIcon(com_davidmaletz_tiles_Tile.get("coins")); + icon.set_x(x); + icon.set_y(y); + this.addChild(icon); + var t = new com_davidmaletz_faengfl_TextSprite(this.cost,new com_fancyfish_faeng_text_CharacterPlacer(com_davidmaletz_tiles_Tile.SIZE * 2,1),0,1); + t.set_x(com_davidmaletz_tiles_Tile.SIZE + x + 2); + t.set_y(y); + this.addChild(t); + } + ,__class__: com_davidmaletz_mining_ui_SellPrompt +}); +var com_davidmaletz_mining_ui_ShopWindow = function(p,c,items,tile,storage,title,e) { + this.player = p; + this.xml = e; + if(storage == null) { + storage = "coins"; + } + if(tile == null && StringTools.startsWith(storage,"item:")) { + var i = com_davidmaletz_mining_item_ItemInfo.get(HxOverrides.substr(storage,5,null)); + if(i != null) { + tile = i.xml.get("icon"); + } + } + if(tile == null) { + tile = "coins"; + } + this.icon = tile; + this.currency = storage; + var inv = new com_davidmaletz_mining_item_Inventory(); + var _g = 0; + while(_g < items.length) { + var i1 = items[_g]; + ++_g; + inv.addItems(i1.item,i1.count,i1.value,i1.name); + } + var r = new com_davidmaletz_mining_ui__$ShopWindow_ShopItemRenderer(this); + var rows = Math.round(100 / r.getHeight(null)); + com_davidmaletz_controls_scroll_ScrollWindow.call(this,c,com_davidmaletz_mining_Main.window_factory,r,rows,1,0.2,0.5); + var width = this.getWidth(); + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,title,width,0,100); + this.inventory = new com_davidmaletz_mining_ui_InventoryList(this,inv,this.list,c); + this.addChild(new com_davidmaletz_mining_ui_InventoryTabs(this.clickables,$bind(this,this.hasItem),$bind(this,this.setTab),inv)); + this.details = new com_davidmaletz_mining_ui_details_ItemDetails(false); + this.details.set_x(width + 3); + this.addChild(this.details); +}; +$hxClasses["com.davidmaletz.mining.ui.ShopWindow"] = com_davidmaletz_mining_ui_ShopWindow; +com_davidmaletz_mining_ui_ShopWindow.__name__ = ["com","davidmaletz","mining","ui","ShopWindow"]; +com_davidmaletz_mining_ui_ShopWindow.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_ShopWindow.__super__ = com_davidmaletz_controls_scroll_ScrollWindow; +com_davidmaletz_mining_ui_ShopWindow.prototype = $extend(com_davidmaletz_controls_scroll_ScrollWindow.prototype,{ + inventory: null + ,player: null + ,icon: null + ,currency: null + ,oldTile: null + ,oldStorage: null + ,details: null + ,xml: null + ,getCurrency: function() { + if(StringTools.startsWith(this.currency,"var:")) { + return this.player.getVar(HxOverrides.substr(this.currency,4,null)); + } else if(StringTools.startsWith(this.currency,"item:")) { + return this.player.getItemCount(HxOverrides.substr(this.currency,5,null)); + } else { + return this.player.getStorage(this.currency).getValue(); + } + } + ,setCurrency: function(old,n) { + if(StringTools.startsWith(this.currency,"var:")) { + this.player.setVar(HxOverrides.substr(this.currency,4,null),n); + } else if(StringTools.startsWith(this.currency,"item:")) { + this.player.setItemCount(HxOverrides.substr(this.currency,5,null),n); + } else { + this.player.getStorage(this.currency).addValue(n - old); + } + } + ,hasItem: function(c) { + var a1 = c; + var tmp = function(a2) { + return com_davidmaletz_mining_item_Inventory.filterType(a1,a2); + }; + return this.inventory.inventory.getItems(tmp).hasNext(); + } + ,setTab: function(tab) { + this.switchList(this.inventory.getList(tab)); + } + ,onSelect: function(item) { + if(item.item.type.id == "blueprint" && this.player.getItemCount(item.item.id) > 0) { + this.player.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","have_blueprint")); + return; + } + var coins = this.getCurrency(); + if(item.count <= coins) { + if(this.xml != null && this.xml.get("buy_prompt") == "false") { + this.onBuy(item,coins,1); + } else { + var c = com_davidmaletz_mining_Main.getContainer(); + var f = $bind(this,this.onBuy); + var a1 = item; + var c1 = coins; + c.addDisplay(new com_davidmaletz_mining_ui_BuyPrompt(c,coins,item,9999,function(ct) { + f(a1,c1,ct); + },item.count,this.icon,this.xml == null ? null : com_fancyfish_faeng_common_Lang.getTextFromTitle(this.xml.get("buy_prompt"))),3); + } + } else if(this.xml != null) { + var name = com_fancyfish_faeng_common_Lang.getTextFromTitle(this.xml.get("name")); + var t = this.icon; + if(com_davidmaletz_tiles_TileAnimation.exists(this.icon)) { + t += " anim=" + this.icon; + } + if(name != null) { + var m = com_fancyfish_faeng_common_Lang.getTextFromTitle("warning.not_enough{item:[tile=" + t + "] " + name.get() + "}"); + if(m != null) { + this.player.showWarning(m); + } + } + } + } + ,onBuy: function(item,c,ct) { + if(ct > 0 && item.count * ct <= c) { + this.setCurrency(c,c - item.count * ct); + this.player.addItems(item.item,ct,item.value,item.name); + this.inventory.updateAll(); + } + } + ,addAdditional: function(item,s,w,x,y) { + if(item.count > 0) { + var icon = com_davidmaletz_mining_ui_Coins.makeIcon(this.icon); + icon.set_scaleX(icon.set_scaleY(0.5)); + icon.set_x(x); + icon.set_y(y); + s.addChild(icon); + var m = this.xml == null ? null : com_fancyfish_faeng_common_Lang.getTextFromTitle(this.xml.get("buy")); + if(m == null) { + m = com_fancyfish_faeng_common_Lang.getText("common","buy"); + } + var t = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Concat(m,": " + com_fancyfish_faeng_common_Utils.largeNumberFormat(item.count)),new com_fancyfish_faeng_text_CharacterPlacer(0),0,0.5); + t.set_x(icon.get_x() + com_davidmaletz_tiles_Tile.SIZE * 0.5 + 1); + t.set_y(y); + s.addChild(t); + y += t.lineHeight() >> 1; + return y; + } else { + return y; + } + } + ,onHover: function(item) { + var tmp; + if(item == null) { + tmp = null; + } else { + var f = $bind(this,this.addAdditional); + var a1 = item; + tmp = function(s,w,x,y) { + return f(a1,s,w,x,y); + }; + } + this.details.setItemParent(item,tmp); + this.details.set_y(Math.floor((this.getHeight() - this.details.getHeight()) * 0.5)); + } + ,isEnabled: function(item) { + if(item == null || item.count <= this.getCurrency()) { + if(!(item == null || item.item.type.id != "blueprint")) { + return this.player.getItemCount(item.item.id) == 0; + } else { + return true; + } + } else { + return false; + } + } + ,init: function(e) { + com_davidmaletz_controls_scroll_ScrollWindow.prototype.init.call(this,e); + this.inventory.init(); + this.oldTile = this.player.gui.coins.tile; + this.oldStorage = this.player.gui.coins.storage; + this.player.gui.coins.changeCurrency(this.icon,this.currency); + this.player.showCoins(); + } + ,destroy: function(e) { + com_davidmaletz_controls_scroll_ScrollWindow.prototype.destroy.call(this,e); + this.inventory.destroy(); + if(this.oldTile != null) { + this.player.gui.coins.changeCurrency(this.oldTile,this.oldStorage); + this.oldTile = null; + } + } + ,__class__: com_davidmaletz_mining_ui_ShopWindow +}); +var com_davidmaletz_mining_ui__$ShopWindow_ShopItemRenderer = function(handler) { + this.handler = handler; +}; +$hxClasses["com.davidmaletz.mining.ui._ShopWindow.ShopItemRenderer"] = com_davidmaletz_mining_ui__$ShopWindow_ShopItemRenderer; +com_davidmaletz_mining_ui__$ShopWindow_ShopItemRenderer.__name__ = ["com","davidmaletz","mining","ui","_ShopWindow","ShopItemRenderer"]; +com_davidmaletz_mining_ui__$ShopWindow_ShopItemRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui__$ShopWindow_ShopItemRenderer.prototype = { + handler: null + ,create: function(item,x,y) { + return new com_davidmaletz_mining_ui__$ShopWindow_ShopItemButton(this,item,x,y); + } + ,update: function(s,item) { + (js_Boot.__cast(s , com_davidmaletz_mining_ui__$ShopWindow_ShopItemButton)).updateEnabled(); + } + ,getWidth: function() { + return 120; + } + ,getHeight: function(item) { + return com_davidmaletz_mining_ui_StringRenderer._getHeight(); + } + ,__class__: com_davidmaletz_mining_ui__$ShopWindow_ShopItemRenderer +}; +var com_davidmaletz_mining_ui__$ShopWindow_ShopItemButton = function(r,i,x,y) { + var w = r.getWidth(); + var h = r.getHeight(i); + com_davidmaletz_controls_Button.call(this,x,y,com_davidmaletz_mining_Main.label_factory.createBG(w,h),com_davidmaletz_mining_Main.label_factory.createHover(w,h),null); + this.handler = r.handler; + this.text = new openfl_display_Sprite(); + this.item = i; + com_davidmaletz_mining_ui_ItemRenderer.addItem(this.text,new com_davidmaletz_mining_item_Item(this.item.item,this.item.value,this.item.name),1,0); + var icon = com_davidmaletz_mining_ui_Coins.makeIcon(this.handler.icon); + icon.set_x(119 - com_davidmaletz_tiles_Tile.SIZE - 24); + this.text.addChild(icon); + var t = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Static(com_fancyfish_faeng_common_Utils.largeNumberFormat(i.count)),new com_fancyfish_faeng_text_CharacterPlacer(118,2),0,1); + t.set_x(1); + this.text.addChild(t); + this.addChild(this.text); + this.updateEnabled(); +}; +$hxClasses["com.davidmaletz.mining.ui._ShopWindow.ShopItemButton"] = com_davidmaletz_mining_ui__$ShopWindow_ShopItemButton; +com_davidmaletz_mining_ui__$ShopWindow_ShopItemButton.__name__ = ["com","davidmaletz","mining","ui","_ShopWindow","ShopItemButton"]; +com_davidmaletz_mining_ui__$ShopWindow_ShopItemButton.__super__ = com_davidmaletz_controls_Button; +com_davidmaletz_mining_ui__$ShopWindow_ShopItemButton.prototype = $extend(com_davidmaletz_controls_Button.prototype,{ + handler: null + ,text: null + ,item: null + ,onClick: function() { + this.handler.onSelect(this.item); + return true; + } + ,onHover: function(hover) { + com_davidmaletz_controls_Button.prototype.onHover.call(this,hover); + this.handler.onHover(hover ? this.item : null); + } + ,updateEnabled: function() { + this.text.set_alpha(this.handler.isEnabled(this.item) ? 1 : 0.5); + } + ,__class__: com_davidmaletz_mining_ui__$ShopWindow_ShopItemButton +}); +var com_davidmaletz_mining_ui_SkillWindow = function(c,p,title) { + this.selected = null; + var r = new com_davidmaletz_mining_ui_OptionRenderer(this); + var rows = Math.floor(90 / r.getHeight(null)); + com_davidmaletz_controls_scroll_ScrollWindow.call(this,c,com_davidmaletz_mining_Main.window_factory,r,rows,1,0.1,0.9,true,true,true,false); + this.option_ct = 0; + var w = this.getWidth(); + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,title,w,0,120); + this.options = new haxe_ds_StringMap(); + this.player = p; + var s = p.getInfo().getSkills(); + while(s.hasNext()) { + var s1 = s.next(); + var skill = com_davidmaletz_mining_Skill.get(s1); + var flag; + var tmp; + if(skill != null) { + flag = skill.xml.get("flag"); + if(flag != null) { + tmp = p.getFlag(flag); + } else { + tmp = true; + } + } else { + tmp = false; + } + if(tmp) { + var o = new com_davidmaletz_mining_ui__$SkillWindow_SkillOption(p,s1,this); + this.options.set(s1,o); + this.option_ct++; + this.addItem(o); + } + } + var ty = 4 + this.list.getHeight() + 2; + this.points = new com_fancyfish_faeng_common_mutable_Mutable(); + var t = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Concat2(com_fancyfish_faeng_common_Lang.getText("skill","points"),this.points,": "),new com_fancyfish_faeng_text_CharacterPlacer(w,1),0,1); + t.set_y(ty); + this.addChild(t); + this.clickables.allowLoop = false; + ty += 2 + com_davidmaletz_mining_ui_StringRenderer._getHeight(); + this.okay_button = new com_davidmaletz_mining_ui_TextButton(4,ty,com_fancyfish_faeng_common_Lang.getText("common","ok"),$bind(this,this.close)); + this.addClickable(this.okay_button); + this.cancel = new com_davidmaletz_mining_ui_TextButton(w - 4 - 40,ty,com_fancyfish_faeng_common_Lang.getText("common","cancel"),$bind(this,this._cancel)); + this.addClickable(this.cancel); + this.details = new com_davidmaletz_mining_ui_details_Details(100); + this.details.set_x(this.getWidth() - 30 - 4); + this.addChild(this.details); + this.clickables.moveSelection(1,0); + this.clickables.moveSelection(1,0); +}; +$hxClasses["com.davidmaletz.mining.ui.SkillWindow"] = com_davidmaletz_mining_ui_SkillWindow; +com_davidmaletz_mining_ui_SkillWindow.__name__ = ["com","davidmaletz","mining","ui","SkillWindow"]; +com_davidmaletz_mining_ui_SkillWindow.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_SkillWindow.__super__ = com_davidmaletz_controls_scroll_ScrollWindow; +com_davidmaletz_mining_ui_SkillWindow.prototype = $extend(com_davidmaletz_controls_scroll_ScrollWindow.prototype,{ + player: null + ,remaining: null + ,points: null + ,okay_button: null + ,cancel: null + ,options: null + ,details: null + ,option_ct: null + ,selected: null + ,_cancel: function() { + com_davidmaletz_controls_scroll_ScrollWindow.prototype.close.call(this); + } + ,close: function() { + var o = this.options.iterator(); + while(o.hasNext()) { + var o1 = o.next(); + this.player.skills.set(o1.id,o1.value); + } + this.player.adjustSkills(); + com_davidmaletz_controls_scroll_ScrollWindow.prototype.close.call(this); + } + ,init: function(e) { + com_davidmaletz_controls_scroll_ScrollWindow.prototype.init.call(this,e); + com_davidmaletz_controls_Controller.instance.addEventListener("tap",$bind(this,this.tap),false,com_davidmaletz_faengfl_Window.window_ct + 1); + this.updatePoints(); + } + ,destroy: function(e) { + com_davidmaletz_controls_scroll_ScrollWindow.prototype.destroy.call(this,e); + com_davidmaletz_controls_Controller.instance.removeEventListener("tap",$bind(this,this.tap)); + } + ,getHeight: function() { + return com_davidmaletz_controls_scroll_ScrollWindow.prototype.getHeight.call(this) + 4 + com_davidmaletz_mining_ui_TextButton.getHeight() + com_davidmaletz_mining_ui_StringRenderer._getHeight(); + } + ,tap: function(e) { + var left = e.key == "left"; + var right = e.key == "right"; + var up = e.key == "up"; + var down = e.key == "down"; + var sel = this.clickables.getSelected(); + var x = this.clickables.sel_x; + var y = this.clickables.sel_y; + if(left || right) { + if(Std["is"](sel,com_davidmaletz_mining_ui_AdjustOption)) { + var a = js_Boot.__cast(sel , com_davidmaletz_mining_ui_AdjustOption); + if(left) { + if(a.prevValue()) { + com_davidmaletz_faengfl_adv_sound_Sound.play("move"); + } + } else if(a.nextValue()) { + com_davidmaletz_faengfl_adv_sound_Sound.play("move"); + } + } else if(sel == this.okay_button) { + this.clickables.setSelected(this.cancel,x,y); + } else if(sel == this.cancel) { + this.clickables.setSelected(this.okay_button,x,y); + } + e.stopImmediatePropagation(); + } else if(up || down) { + if(x != 1) { + if(up) { + this.clickables.setSelection(1,this.option_ct - 1); + } + e.stopImmediatePropagation(); + } else if(down && y == this.option_ct - 1 || up && y == 0) { + if(down) { + this.clickables.setSelection(0,0); + } + e.stopImmediatePropagation(); + } + } + } + ,updatePoints: function() { + var cur = 0; + var o = this.options.iterator(); + while(o.hasNext()) { + var o1 = o.next(); + if(com_davidmaletz_mining_Skill.exists(o1.id)) { + cur += com_davidmaletz_mining_Skill.get(o1.id).getCost(o1.value); + } + } + var max = this.player.getPointsForLevel(this.player.getLevel()); + this.remaining = com_fancyfish_faeng_common_Utils.max(0,max - cur); + this.points.set(this.remaining + "/" + max); + this.details.setInfo(null); + this.onHover(this.selected); + } + ,onSelect: function(item) { + var sel = this.clickables.getSelected(); + if(sel != null && Std["is"](sel,com_davidmaletz_mining_ui_AdjustOption)) { + var a = js_Boot.__cast(sel , com_davidmaletz_mining_ui_AdjustOption); + if(com_davidmaletz_faengfl_adv_AdvApp.shiftDown) { + a.prevValue(); + } else { + a.nextValue(); + } + } + } + ,onHover: function(item) { + var s = com_davidmaletz_mining_Skill.get(item); + this.details.setInfo(s == null ? null : new com_davidmaletz_mining_Info(s,this.options.get(item).value,this.player.getInfo().getMaxLevel(item))); + this.details.set_y(Math.floor(this.getHeight() - this.details.getHeight()) - 2); + this.selected = item; + } + ,isEnabled: function(item) { + return true; + } + ,__class__: com_davidmaletz_mining_ui_SkillWindow +}); +var com_davidmaletz_mining_ui__$SkillWindow_SkillOption = function(p,id,wnd) { + com_davidmaletz_mining_ui_IntValue.call(this,id,p.skills.get(id),p.getInfo().getMaxLevel(id)); + this.value = this.start; + this.wnd = wnd; +}; +$hxClasses["com.davidmaletz.mining.ui._SkillWindow.SkillOption"] = com_davidmaletz_mining_ui__$SkillWindow_SkillOption; +com_davidmaletz_mining_ui__$SkillWindow_SkillOption.__name__ = ["com","davidmaletz","mining","ui","_SkillWindow","SkillOption"]; +com_davidmaletz_mining_ui__$SkillWindow_SkillOption.__super__ = com_davidmaletz_mining_ui_IntValue; +com_davidmaletz_mining_ui__$SkillWindow_SkillOption.prototype = $extend(com_davidmaletz_mining_ui_IntValue.prototype,{ + value: null + ,wnd: null + ,icon: null + ,getIcon: function() { + var s = com_davidmaletz_mining_Skill.get(this.id); + if(s == null) { + return null; + } else { + this.icon = s.getTile(this.value / this.max); + return this.icon; + } + } + ,getValue: function() { + return this.value; + } + ,setValue: function(v) { + if(v == this.value) { + return; + } + var s = com_davidmaletz_mining_Skill.get(this.id); + if(s != null && v > this.value) { + var r = this.wnd.remaining + s.getCost(this.value); + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(s.getCost(v) > r && p != null) { + p.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","skill_points")); + } + while(r - s.getCost(v) < 0) { + --v; + if(v <= this.value) { + return; + } + } + } + this.value = v; + if(this.icon != null) { + com_davidmaletz_mining_Stat.tint(this.icon,this.value / this.max); + } + this.wnd.updatePoints(); + } + ,getLabel: function() { + var s = com_davidmaletz_mining_Skill.get(this.id); + if(s == null) { + return com_fancyfish_faeng_common_Lang.getText("quests","unknown_reqs"); + } else { + return s.getName(); + } + } + ,__class__: com_davidmaletz_mining_ui__$SkillWindow_SkillOption +}); +var com_davidmaletz_mining_ui_SmeltItemHandler = function() { }; +$hxClasses["com.davidmaletz.mining.ui.SmeltItemHandler"] = com_davidmaletz_mining_ui_SmeltItemHandler; +com_davidmaletz_mining_ui_SmeltItemHandler.__name__ = ["com","davidmaletz","mining","ui","SmeltItemHandler"]; +com_davidmaletz_mining_ui_SmeltItemHandler.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_SmeltItemHandler.prototype = { + onSelectProgress: null + ,__class__: com_davidmaletz_mining_ui_SmeltItemHandler +}; +var com_davidmaletz_mining_ui_SmeltItemRenderer = function(handler) { + this.handler = handler; +}; +$hxClasses["com.davidmaletz.mining.ui.SmeltItemRenderer"] = com_davidmaletz_mining_ui_SmeltItemRenderer; +com_davidmaletz_mining_ui_SmeltItemRenderer.__name__ = ["com","davidmaletz","mining","ui","SmeltItemRenderer"]; +com_davidmaletz_mining_ui_SmeltItemRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui_SmeltItemRenderer.incompleteIcon = function(r) { + var i = null; + if(r.xml != null && r.xml.exists("incomplete")) { + i = com_davidmaletz_mining_item_ItemInfo.get(r.xml.get("incomplete")); + } + if(r.numRequirements() == 0) { + if(i == null) { + i = r.creates.item; + } + var ret = i.createIcon(); + ret.set_x(-4); + return ret; + } + var _x = 0; + var incomplete = new openfl_display_Sprite(); + if(i != null) { + var icon = i.createIcon(); + icon.set_x(_x); + incomplete.addChildAt(icon,0); + _x += 4; + } + var req = r.getRequirements(); + while(req.hasNext()) { + var req1 = req.next(); + var icon1 = req1.createIcon(); + icon1.set_x(_x); + incomplete.addChildAt(icon1,0); + _x += 4; + } + incomplete.set_x(-_x); + return incomplete; +}; +com_davidmaletz_mining_ui_SmeltItemRenderer.prototype = { + handler: null + ,create: function(item,x,y) { + return new com_davidmaletz_mining_ui__$SmeltItemRenderer_ListButton(this.handler,item,x,y); + } + ,update: function(s,item) { + } + ,getWidth: function() { + return 92; + } + ,getHeight: function(item) { + return 10; + } + ,__class__: com_davidmaletz_mining_ui_SmeltItemRenderer +}; +var com_davidmaletz_mining_ui_Progress = function(handler,craft) { + this.handler = handler; + this.craft = craft; +}; +$hxClasses["com.davidmaletz.mining.ui.Progress"] = com_davidmaletz_mining_ui_Progress; +com_davidmaletz_mining_ui_Progress.__name__ = ["com","davidmaletz","mining","ui","Progress"]; +com_davidmaletz_mining_ui_Progress.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui_Progress.prototype = { + handler: null + ,craft: null + ,create: function(item,x,y) { + return new com_davidmaletz_mining_ui__$SmeltItemRenderer_SmeltItemButton(this.handler,item,x,y,this.craft); + } + ,update: function(s,item) { + } + ,getWidth: function() { + return 92; + } + ,getHeight: function(item) { + return 13; + } + ,__class__: com_davidmaletz_mining_ui_Progress +}; +var com_davidmaletz_mining_ui__$SmeltItemRenderer_ListButton = function(handler,i,x,y) { + com_davidmaletz_controls_Button.call(this,x,y,com_davidmaletz_mining_Main.label_factory.createBG(92,10),com_davidmaletz_mining_Main.label_factory.createHover(92,10),null); + this.handler = handler; + if(i == null) { + var t = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("common","collect_complete"),new com_fancyfish_faeng_text_CharacterPlacer(92,1),0,1); + this.addChild(t); + } else { + var r = i.recipe; + if(i.complete) { + var complete = r.creates.item.createIcon(); + complete.set_x(8); + complete.set_y(0); + this.addChild(complete); + } else { + var incomplete = com_davidmaletz_mining_ui_SmeltItemRenderer.incompleteIcon(r); + incomplete.set_x(2 + (12 + incomplete.get_x()) * 0.5); + incomplete.set_y(0); + this.addChild(incomplete); + } + this.item = i; + var t1 = new com_davidmaletz_faengfl_TextSprite(r.getName(),new com_fancyfish_faeng_text_CharacterPlacer(0),0,0.5); + t1.set_x(4 + com_davidmaletz_tiles_Tile.SIZE + 12); + t1.set_y(Math.round(com_davidmaletz_mining_ui_StringRenderer._getHeight() * 0.25)); + this.addChild(t1); + var ct = (r.creates == null ? 1 : r.creates.count) * i.count; + if(ct != 1) { + var t2 = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Static(com_fancyfish_faeng_common_Utils.largeNumberFormat(ct)),new com_fancyfish_faeng_text_CharacterPlacer(90,2),0,1); + this.addChild(t2); + } + } +}; +$hxClasses["com.davidmaletz.mining.ui._SmeltItemRenderer.ListButton"] = com_davidmaletz_mining_ui__$SmeltItemRenderer_ListButton; +com_davidmaletz_mining_ui__$SmeltItemRenderer_ListButton.__name__ = ["com","davidmaletz","mining","ui","_SmeltItemRenderer","ListButton"]; +com_davidmaletz_mining_ui__$SmeltItemRenderer_ListButton.__super__ = com_davidmaletz_controls_Button; +com_davidmaletz_mining_ui__$SmeltItemRenderer_ListButton.prototype = $extend(com_davidmaletz_controls_Button.prototype,{ + item: null + ,handler: null + ,onClick: function() { + this.handler.onSelect(this.item); + return true; + } + ,onHover: function(hover) { + com_davidmaletz_controls_Button.prototype.onHover.call(this,hover); + this.handler.onHover(hover ? this.item : null); + } + ,__class__: com_davidmaletz_mining_ui__$SmeltItemRenderer_ListButton +}); +var com_davidmaletz_mining_ui__$SmeltItemRenderer_SmeltItemButton = function(handler,i,x,y,craft) { + com_davidmaletz_mining_ui__$SmeltItemRenderer_ListButton.call(this,handler,new com_davidmaletz_mining_item_RecipeCount(i.recipe,1,!craft),x,y); + this.smelt_item = i; + var p = i.getPercent(); + this.progress = new com_davidmaletz_controls_ProgressBar(92,2,com_davidmaletz_mining_Main.PROGRESS_COL,p,false); + if(p == 1) { + this.progress.set_visible(false); + } + this.progress.set_y(11); + this.addChild(this.progress); + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); +}; +$hxClasses["com.davidmaletz.mining.ui._SmeltItemRenderer.SmeltItemButton"] = com_davidmaletz_mining_ui__$SmeltItemRenderer_SmeltItemButton; +com_davidmaletz_mining_ui__$SmeltItemRenderer_SmeltItemButton.__name__ = ["com","davidmaletz","mining","ui","_SmeltItemRenderer","SmeltItemButton"]; +com_davidmaletz_mining_ui__$SmeltItemRenderer_SmeltItemButton.__super__ = com_davidmaletz_mining_ui__$SmeltItemRenderer_ListButton; +com_davidmaletz_mining_ui__$SmeltItemRenderer_SmeltItemButton.prototype = $extend(com_davidmaletz_mining_ui__$SmeltItemRenderer_ListButton.prototype,{ + progress: null + ,smelt_item: null + ,init: function(e) { + this.destroy(e); + this.smelt_item.addEventListener("update_percent",$bind(this,this.update)); + } + ,destroy: function(e) { + this.smelt_item.removeEventListener("update_percent",$bind(this,this.update)); + } + ,onClick: function() { + this.handler.onSelectProgress(this.smelt_item); + return true; + } + ,update: function(e) { + var p = this.smelt_item.getPercent(); + if(p == 1) { + this.progress.set_visible(false); + } else { + this.progress.setProgress(p); + } + } + ,__class__: com_davidmaletz_mining_ui__$SmeltItemRenderer_SmeltItemButton +}); +var com_davidmaletz_mining_ui_SmeltWindow = function(inventory,label,queue,c,incCost,xml,obj,additional,halign,valign,fuel) { + if(valign == null) { + valign = 0.5; + } + if(halign == null) { + halign = 0.5; + } + this.fuelName = null; + this.details = new com_davidmaletz_mining_ui_details_SmeltRecipeDetails(incCost); + this.fuelName = fuel == null ? "fuel" : fuel; + this.recipeList = new com_davidmaletz_mining_ui_CraftingList(this,inventory,c,null); + this.recipeList.addItems(com_davidmaletz_mining_ui_CraftingWindow.getRecipes(com_davidmaletz_mining_Main.getLocalPlayer(),xml),this.details,additional,obj); + this.recipeList.set_x(4); + this.recipeList.set_y(4); + this.smeltList = new com_davidmaletz_mining_ui__$SmeltWindow_SmeltList(inventory,queue,c,xml.get("collectComplete") != "false"); + var w = this.getWidth(); + this.smeltList.set_x(w - 4 - this.smeltList.getWidth()); + this.smeltList.set_y(4); + var draw = new com_davidmaletz_faengfl_CompoundDrawable(); + draw.add(com_davidmaletz_mining_Main.window_factory.create(this.recipeList.getWidth() + 8,this.getHeight()),0,0); + var _x = this.recipeList.getWidth() + 8 - 1; + var _h = this.smeltList.getHeight() + 8; + var _w = this.smeltList.getWidth() + 8 + 1; + draw.add(com_davidmaletz_mining_Main.window_factory.create(_w,_h),_x,0); + if(queue.fuelable.getMaxFuel() > 0) { + draw.add(com_davidmaletz_mining_Main.window_factory.create(_w,this.getHeight() - _h + 1),_x,_h - 1); + } + com_davidmaletz_controls_ClickableWindow.call(this,c,draw,true,true,true,halign,valign,0); + var _g = this; + _g.set_x(_g.get_x() - 6); + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,label,this.getWidth(),0,120); + this.addChild(this.recipeList); + this.addChild(this.smeltList); + var close = new com_davidmaletz_controls_CloseButton(this,this.getWidth(),0); + this.addChild(close); + this.clickables.addClickable(close,this); + if(queue.fuelable.getMaxFuel() > 0) { + var fuel1 = new com_davidmaletz_mining_ui_Fuel(queue.fuelable,this.smeltList.getWidth(),this.fuelName); + fuel1.set_x(this.smeltList.get_x()); + fuel1.set_y(this.smeltList.get_y() + this.smeltList.getHeight() + 4 + 2); + this.addChild(fuel1); + } + this.details.set_x(this.recipeList.getWidth() + 3); + this.addChild(this.details); +}; +$hxClasses["com.davidmaletz.mining.ui.SmeltWindow"] = com_davidmaletz_mining_ui_SmeltWindow; +com_davidmaletz_mining_ui_SmeltWindow.__name__ = ["com","davidmaletz","mining","ui","SmeltWindow"]; +com_davidmaletz_mining_ui_SmeltWindow.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_SmeltWindow.__super__ = com_davidmaletz_controls_ClickableWindow; +com_davidmaletz_mining_ui_SmeltWindow.prototype = $extend(com_davidmaletz_controls_ClickableWindow.prototype,{ + smeltList: null + ,recipeList: null + ,details: null + ,fuelName: null + ,onSelect: function(recipe) { + if(recipe.creates != null || recipe.object != null) { + var max = this.smeltList.inventory.maxCraft(com_davidmaletz_mining_Main.getLocalPlayer(),recipe); + if(max == 0) { + com_davidmaletz_faengfl_adv_sound_Sound.play("warning"); + new com_davidmaletz_faengfl_ui_Popup(128.,52.,0,com_fancyfish_faeng_common_Lang.getText("warning","ingredients"),16720418); + } else if(com_davidmaletz_mining_Main.NO_COUNT || com_davidmaletz_faengfl_adv_AdvApp.shiftDown || recipe.creates == null) { + this.doCraft(recipe,1); + } else { + var c = com_davidmaletz_mining_Main.getContainer(); + var f = $bind(this,this.doCraft); + var a1 = recipe; + var tmp = function(ct) { + f(a1,ct); + }; + c.addDisplay(new com_davidmaletz_mining_ui_ItemCountPrompt(c,recipe.creates,max,com_fancyfish_faeng_common_Lang.getText("common","craft"),1,tmp),2); + } + } else { + com_davidmaletz_mining_ui_FuelWindow.addFuel(this.smeltList.queue.fuelable,this.smeltList.inventory,recipe,this.fuelName,$bind(this,this.fuelAdded)); + } + } + ,doCraft: function(recipe,ct) { + if(ct > 0 && this.smeltList.inventory.useIngredients(recipe,ct)) { + this.addRecipe(recipe,ct); + this.onHover(recipe); + } + } + ,addRecipe: function(recipe,ct) { + this.smeltList.queue.addSmeltItem(recipe,ct); + this.recipeList.update(null); + this.details.setInfo(null); + } + ,fuelAdded: function(recipe,ct) { + this.recipeList.update(null); + this.details.setInfo(null); + this.onHover(recipe); + } + ,onHover: function(recipe) { + this.details.setRecipe(recipe,this.smeltList.inventory,this.fuelName); + if(recipe != null) { + this.details.set_x(this.recipeList.getWidth() + 3); + this.details.set_y(Math.round((this.getHeight() - this.details.getHeight()) * 0.5)); + } + } + ,showSmeltItem: function(recipe) { + this.details.setRecipe(recipe,null,this.fuelName); + if(recipe != null) { + this.details.set_x(this.smeltList.get_x() - this.details.getWidth()); + this.details.set_y(Math.round((this.getHeight() - this.details.getHeight()) * 0.5)); + } + } + ,isEnabled: function(recipe) { + return true; + } + ,createClickables: function() { + return new com_davidmaletz_controls_CompoundClickableColumns([this.recipeList.getList().clickables,this.smeltList.getList().clickables],[this.recipeList.get_x(),this.smeltList.get_x()]); + } + ,advanceFrame: function(df) { + com_davidmaletz_controls_ClickableWindow.prototype.advanceFrame.call(this,df); + if(com_davidmaletz_mining_Main.isPaused()) { + this.smeltList.queue.handleTick(df); + } + } + ,getWidth: function() { + return this.recipeList.getWidth() + this.smeltList.getWidth() + 16; + } + ,getHeight: function() { + return this.recipeList.getHeight() + 8; + } + ,__class__: com_davidmaletz_mining_ui_SmeltWindow +}); +var com_davidmaletz_mining_ui__$SmeltWindow_SmeltList = function(inventory,queue,c,complete) { + var r = new com_davidmaletz_mining_ui_SmeltItemRenderer(this); + var rows = Math.round(65 / r.getHeight(null)); + this.progress = new com_davidmaletz_mining_ui_Progress(this,queue.craft); + com_davidmaletz_controls_scroll_ScrollList.call(this,c,r,rows,1); + this.inventory = inventory; + this.queue = queue; + this.collectComplete = complete; +}; +$hxClasses["com.davidmaletz.mining.ui._SmeltWindow.SmeltList"] = com_davidmaletz_mining_ui__$SmeltWindow_SmeltList; +com_davidmaletz_mining_ui__$SmeltWindow_SmeltList.__name__ = ["com","davidmaletz","mining","ui","_SmeltWindow","SmeltList"]; +com_davidmaletz_mining_ui__$SmeltWindow_SmeltList.__interfaces__ = [com_davidmaletz_mining_ui_SmeltItemHandler]; +com_davidmaletz_mining_ui__$SmeltWindow_SmeltList.__super__ = com_davidmaletz_controls_scroll_ScrollList; +com_davidmaletz_mining_ui__$SmeltWindow_SmeltList.prototype = $extend(com_davidmaletz_controls_scroll_ScrollList.prototype,{ + inventory: null + ,queue: null + ,progress: null + ,collectComplete: null + ,init: function(e) { + com_davidmaletz_controls_scroll_ScrollList.prototype.init.call(this,e); + this.queue.addEventListener("update",$bind(this,this.rem)); + this.rem(null); + } + ,destroy: function(e) { + com_davidmaletz_controls_scroll_ScrollList.prototype.destroy.call(this,e); + this.queue.removeEventListener("update",$bind(this,this.rem)); + } + ,rem: function(e) { + var clickables = (js_Boot.__cast(this.parent , com_davidmaletz_mining_ui_SmeltWindow)).clickables; + var p = com_davidmaletz_controls_scroll_ScrollList.preSwitch(clickables); + var y = this.getScrollY(); + this.clear(); + if(this.collectComplete) { + this.addItem(null); + } + var s = this.queue.getIncomplete(); + while(s.hasNext()) { + var s1 = s.next(); + this.addItem(s1); + } + var c = this.queue.getCurrent(); + if(c != null) { + this.addMixedItem(c,this.progress); + } + var s2 = this.queue.getComplete(); + while(s2.hasNext()) { + var s3 = s2.next(); + this.addItem(s3); + } + var ht = this.getViewportHeight(); + var sht = this.getScrollHeight(); + ht = sht - ht; + if(y > ht) { + y = ht; + } + if(y < 0) { + y = 0; + } + if(this.getScrollY() == y) { + this.scrollbar.update(); + } else { + this.updateScroll(y); + } + com_davidmaletz_controls_scroll_ScrollList.postSwitch(clickables,p); + } + ,onSelectProgress: function(item) { + if(!this.queue.craft || item != this.queue.getCurrent()) { + return; + } + var c = com_davidmaletz_mining_Main.getContainer(); + var f = $bind(this,this.collectCurrent); + var a1 = item; + var tmp = function() { + f(a1); + }; + c.addDisplay(new com_davidmaletz_mining_ui_Prompt(c,com_fancyfish_faeng_common_Lang.getText("warning","collect_progress"),tmp),2); + } + ,collectCurrent: function(item) { + if(item == this.queue.getCurrent()) { + this.inventory.addIngredients(item.recipe); + com_davidmaletz_mining_ui_MultiItemPopup.show(item.recipe.getItemRequirements(),item.recipe.numRequirements()); + this.queue.clearCurrent(); + } + } + ,onSelect: function(item) { + if(item == null) { + var count = 0; + var map = new haxe_ds_StringMap(); + var s = this.queue.getComplete(); + while(s.hasNext()) { + var s1 = s.next(); + if(s1.complete) { + var id = s1.recipe.creates.item.id; + map.set(id,s1.recipe.creates.count * s1.count + (map.exists(id) ? map.get(id) : 0)); + } else { + var i = s1.recipe.getItemRequirements(); + while(i.hasNext()) { + var i1 = i.next(); + var id1 = i1.item.id; + map.set(id1,i1.count * s1.count + (map.exists(id1) ? map.get(id1) : 0)); + } + } + count += s1.count; + } + this.queue.clearComplete(); + var key = map.keys(); + while(key.hasNext()) { + var key1 = key.next(); + var ct = map.get(key1); + var item1 = com_davidmaletz_mining_item_ItemInfo.get(key1); + this.inventory.addItems(item1,ct); + var m = com_fancyfish_faeng_common_Lang.getText("object.tooltip","collect").get(); + m = StringTools.replace(m,"{item}",item1.getDisplay(null) + (ct == 1 ? "" : " x" + com_fancyfish_faeng_common_Utils.largeNumberFormat(ct))); + com_davidmaletz_mining_ui_NotificationQueue.showNotification(new com_davidmaletz_faengfl_ui_FormattedTooltip(0,0,m,false,16777215,-1442840576)); + } + com_davidmaletz_mining_Main.getLocalPlayer().addExp(3 * count); + return; + } + if(item.complete && !this.queue.craft) { + return; + } + if(com_davidmaletz_mining_Main.NO_COUNT || item.count == 1 || com_davidmaletz_faengfl_adv_AdvApp.shiftDown || item.recipe.creates == null) { + this.collect(item,1); + return; + } + if(com_davidmaletz_faengfl_adv_AdvApp.ctrlDown) { + this.collect(item,item.count); + return; + } + var c = com_davidmaletz_mining_Main.getContainer(); + var f = $bind(this,this.collect); + var a1 = item; + var tmp = function(ct1) { + f(a1,ct1); + }; + c.addDisplay(new com_davidmaletz_mining_ui_ItemCountPrompt(c,item,item.count,com_fancyfish_faeng_common_Lang.getText("common",item.complete == this.queue.craft ? "retrieve_item" : "cancel_item"),item.count,tmp),2); + } + ,collect: function(item,ct) { + if(ct <= 0 || ct > this.queue.getCount(item.recipe,item.complete)) { + return; + } + if(item.complete) { + this.inventory.addItems(item.recipe.creates.item,item.recipe.creates.count * ct); + new com_davidmaletz_mining_ui_ItemPopup(item.recipe.creates.item,item.recipe.creates.count * ct); + } else { + this.inventory.addIngredients(item.recipe,ct); + com_davidmaletz_mining_ui_MultiItemPopup.show(item.recipe.getItemRequirements(),item.recipe.numRequirements(),ct); + } + if(item.complete == this.queue.craft) { + com_davidmaletz_mining_Main.getLocalPlayer().addExp(3 * ct); + } + this.queue.removeItems(item.recipe,ct,item.complete); + } + ,onHover: function(item) { + (js_Boot.__cast(this.parent , com_davidmaletz_mining_ui_SmeltWindow)).showSmeltItem(item == null ? null : item.recipe); + } + ,isEnabled: function(item) { + return true; + } + ,__class__: com_davidmaletz_mining_ui__$SmeltWindow_SmeltList +}); +var com_davidmaletz_mining_ui_SolarSystemNav = function(c,system,onSelect,accept) { + com_davidmaletz_controls_ClickableWindow.call(this,c,new com_davidmaletz_tiles_TileDrawable(com_davidmaletz_tiles_Tile.get("nav.bg.planet")),true,false,false); + this.set_alpha(0); + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),10,$bind(this,this.hideBelow)); + if(system.xml.exists("bgm")) { + this.old_bgm = com_davidmaletz_faengfl_adv_sound_FadeMusic.get(); + com_davidmaletz_faengfl_adv_sound_FadeMusic.set(system.xml.get("bgm"),60); + } + this.sprites = []; + var planets = system.getPlanets(com_davidmaletz_mining_npc_NPCEventHandler.createVariables(com_davidmaletz_mining_Main.getLocalPlayer())); + var _g = 0; + while(_g < planets.length) { + var p = planets[_g]; + ++_g; + var t = com_davidmaletz_tiles_Tile.get(p.xml.get("orbit")); + if(t != null) { + var s = com_davidmaletz_mining_ui_SolarSystemNav.makeOrbit(t,p.xml); + this.addChild(s); + this.sprites.push(s); + } + } + var _g1 = 0; + while(_g1 < planets.length) { + var p1 = planets[_g1]; + ++_g1; + var r = new com_davidmaletz_mining_ui_PlanetRenderer(p1,this); + this.addClickable(r); + this.sprites.push(r); + } + var t1 = com_davidmaletz_tiles_Tile.get("nav.bg.top"); + if(t1 != null) { + if(com_davidmaletz_tiles_TileAnimation.exists("nav.bg.top")) { + this.addChild(new com_davidmaletz_tiles_render_StaticPlayAnimation(t1,"nav.bg.top",10,true)); + } else { + this.addChild(com_davidmaletz_tiles_Tile.makeIcon(t1)); + } + } + this.text = new haxe_ds_StringMap(); + var xml = com_davidmaletz_faengfl_adv_ModHandler.getData("textGroup","planet.nav"); + if(xml != null) { + var e = xml.xml.elementPathsNamed("text"); + while(e.hasNext()) { + var e1 = e.next(); + var txt = com_davidmaletz_mining_effects_Scene.makeText(e1.xml,e1.path); + if(e1.exists("id")) { + var id = e1.get("id"); + this.text.set(id,txt); + txt.set_visible(StringTools.startsWith(id,"system")); + if(id == "system") { + txt.setText(system.getName().get()); + } else if(id == "system.desc") { + txt.setText(system.getDesc().get()); + } + } + this.addChild(txt); + } + } + this.nav = new com_davidmaletz_mining_ui__$SolarSystemNav_StarNavClickable(this); + this.addClickable(this.nav); + this.system = system; + this.selectPlanet = onSelect; + this.acceptPlanet = accept; +}; +$hxClasses["com.davidmaletz.mining.ui.SolarSystemNav"] = com_davidmaletz_mining_ui_SolarSystemNav; +com_davidmaletz_mining_ui_SolarSystemNav.__name__ = ["com","davidmaletz","mining","ui","SolarSystemNav"]; +com_davidmaletz_mining_ui_SolarSystemNav.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_SolarSystemNav.makeOrbit = function(t,xml) { + var ret = com_davidmaletz_tiles_Tile.makeIcon(t); + if(xml.exists("orbitOffX")) { + var _g = ret; + _g.set_x(_g.get_x() + com_davidmaletz_mining_Main.parseInt(xml.get("orbitOffX"))); + } + if(xml.exists("orbitOffY")) { + var _g1 = ret; + _g1.set_y(_g1.get_y() + com_davidmaletz_mining_Main.parseInt(xml.get("orbitOffY"))); + } + return ret; +}; +com_davidmaletz_mining_ui_SolarSystemNav.__super__ = com_davidmaletz_controls_ClickableWindow; +com_davidmaletz_mining_ui_SolarSystemNav.prototype = $extend(com_davidmaletz_controls_ClickableWindow.prototype,{ + system: null + ,old_bgm: null + ,sprites: null + ,acceptPlanet: null + ,text: null + ,selectPlanet: null + ,nav: null + ,init: function(e) { + com_davidmaletz_controls_ClickableWindow.prototype.init.call(this,e); + this.clickables.setSelected(null,0,0); + } + ,hideBelow: function() { + com_davidmaletz_mining_Main.setAmbient(null,com_fancyfish_faeng_renderer_Color.WHITE); + com_davidmaletz_mining_Main.layersBelowVisible(3,false); + } + ,showBelow: function() { + com_davidmaletz_mining_Main.layersBelowVisible(3,true); + com_davidmaletz_mining_Main.__setGameTime(com_davidmaletz_mining_Main._getGameTime() + 0.00066666666666666664,0); + } + ,close: function() { + if(this.parent != null && !this.hasTrack(com_davidmaletz_lerp_AlphaKeyframe)) { + this.showBelow(); + if(this.old_bgm != null) { + com_davidmaletz_faengfl_adv_sound_FadeMusic.set(this.old_bgm,60); + } + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),10,$bind(this,this.doClose)); + } + } + ,onCancel: function() { + this.close(); + } + ,doSelect: function(item) { + var f = this.selectPlanet; + var a1 = item.planet; + var a2 = item.xml; + this.onClose = function() { + f(a1,a2); + }; + this.close(); + } + ,onSelect: function(item) { + var tmp; + if(this.acceptPlanet != null) { + var f = $bind(this,this.doSelect); + var a1 = item; + var tmp1 = function() { + f(a1); + }; + tmp = this.acceptPlanet(item,tmp1); + } else { + tmp = true; + } + if(tmp) { + this.doSelect(item); + } + } + ,onHover: function(item) { + var name = this.text.get("planet"); + var desc = this.text.get("planet.desc"); + if(name != null) { + if(item == null) { + name.set_visible(false); + } else { + name.set_visible(true); + name.setText(item.getName().get()); + } + } + if(desc != null) { + if(item == null) { + desc.set_visible(false); + } else { + desc.set_visible(true); + desc.setText(item.getDesc().get()); + } + } + } + ,isEnabled: function(item) { + return true; + } + ,changeSystem: function(s) { + if(this.system == s) { + return; + } + this.system = s; + this.clickables.clickables.clear(); + var _g = 0; + var _g1 = this.sprites; + while(_g < _g1.length) { + var r = _g1[_g]; + ++_g; + this.removeChild(r); + } + com_fancyfish_faeng_common_Utils.clear(this.sprites); + if(this.system.xml.exists("bgm")) { + com_davidmaletz_faengfl_adv_sound_FadeMusic.set(this.system.xml.get("bgm"),60); + } + var planets = this.system.getPlanets(com_davidmaletz_mining_npc_NPCEventHandler.createVariables(com_davidmaletz_mining_Main.getLocalPlayer())); + var _g2 = 0; + while(_g2 < planets.length) { + var p = planets[_g2]; + ++_g2; + var r1 = new com_davidmaletz_mining_ui_PlanetRenderer(p,this); + this.clickables.addClickable(r1,this); + this.addChildAt(r1,1); + this.sprites.push(r1); + } + var _g3 = 0; + while(_g3 < planets.length) { + var p1 = planets[_g3]; + ++_g3; + var t = com_davidmaletz_tiles_Tile.get(p1.xml.get("orbit")); + if(t != null) { + var r2 = com_davidmaletz_mining_ui_SolarSystemNav.makeOrbit(t,p1.xml); + this.addChildAt(r2,1); + this.sprites.push(r2); + } + } + var name = this.text.get("system"); + if(name != null) { + name.setText(this.system.getName().get()); + } + var desc = this.text.get("system.desc"); + if(desc != null) { + desc.setText(this.system.getDesc().get()); + } + this.clickables.addClickable(this.nav,this); + this.clickables.setSelected(null,0,0); + } + ,__class__: com_davidmaletz_mining_ui_SolarSystemNav +}); +var com_davidmaletz_mining_ui__$SolarSystemNav_StarNavClickable = function(s) { + var t = com_davidmaletz_tiles_Tile.get("star.select"); + com_davidmaletz_tiles_render_StaticPlayAnimation.call(this,t,"star.select",10,true); + this.system = s; + this.set_visible(false); + if(t == null) { + this.bounds = new openfl_geom_Rectangle(); + } else { + var tb = t.getTileBase(); + var s1 = tb.sheet; + var f = s1.getFrame(tb.x,tb.y); + var r = s1.getTileRect2(tb.x,tb.y); + this.bounds = new openfl_geom_Rectangle(this.get_x() + tb.offsetX,this.get_y() + tb.offsetY,r.width,r.height); + if(f != null) { + this.bounds.x += f.offsetX; + this.bounds.y += f.offsetY; + } + } +}; +$hxClasses["com.davidmaletz.mining.ui._SolarSystemNav.StarNavClickable"] = com_davidmaletz_mining_ui__$SolarSystemNav_StarNavClickable; +com_davidmaletz_mining_ui__$SolarSystemNav_StarNavClickable.__name__ = ["com","davidmaletz","mining","ui","_SolarSystemNav","StarNavClickable"]; +com_davidmaletz_mining_ui__$SolarSystemNav_StarNavClickable.__interfaces__ = [com_davidmaletz_controls_Clickable]; +com_davidmaletz_mining_ui__$SolarSystemNav_StarNavClickable.__super__ = com_davidmaletz_tiles_render_StaticPlayAnimation; +com_davidmaletz_mining_ui__$SolarSystemNav_StarNavClickable.prototype = $extend(com_davidmaletz_tiles_render_StaticPlayAnimation.prototype,{ + system: null + ,bounds: null + ,getPos: function() { + return this.bounds; + } + ,onHover: function(hover) { + this.set_visible(hover); + } + ,onClick: function() { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_StarSystemNav(c,this.system.system,($_=this.system,$bind($_,$_.changeSystem))),3); + return true; + } + ,canSelect: function() { + return true; + } + ,__class__: com_davidmaletz_mining_ui__$SolarSystemNav_StarNavClickable +}); +var com_davidmaletz_mining_ui_StaminaBar = function(p) { + com_davidmaletz_mining_ui_MyBar.call(this,"stamina",50,3,39168,p.getStaminaPercent()); + this.player = p; + this.set_x(12); +}; +$hxClasses["com.davidmaletz.mining.ui.StaminaBar"] = com_davidmaletz_mining_ui_StaminaBar; +com_davidmaletz_mining_ui_StaminaBar.__name__ = ["com","davidmaletz","mining","ui","StaminaBar"]; +com_davidmaletz_mining_ui_StaminaBar.__super__ = com_davidmaletz_mining_ui_MyBar; +com_davidmaletz_mining_ui_StaminaBar.prototype = $extend(com_davidmaletz_mining_ui_MyBar.prototype,{ + player: null + ,init: function(e) { + com_davidmaletz_mining_ui_MyBar.prototype.init.call(this,e); + this.player.addEventListener("change_stamina",$bind(this,this.update)); + this.update(null); + } + ,destroy: function(e) { + com_davidmaletz_mining_ui_MyBar.prototype.destroy.call(this,e); + this.player.removeEventListener("change_stamina",$bind(this,this.update)); + } + ,update: function(e) { + this.setProgress(this.player.getStaminaPercent(),5); + } + ,__class__: com_davidmaletz_mining_ui_StaminaBar +}); +var com_davidmaletz_mining_ui_StarRenderer = function(s,h) { + openfl_display_Sprite.call(this); + this.star = s; + this.handler = h; + var t = com_davidmaletz_tiles_Tile.get(s.xml.exists("tile") ? s.xml.get("tile") : "star"); + if(t != null) { + var anim = s.xml.get("animation"); + if(anim != null) { + this.addChild(new com_davidmaletz_tiles_render_StaticPlayAnimation(t,anim,com_davidmaletz_mining_enemy_AttackRenderer.getFPS(s.xml,10),true)); + } else { + this.addChild(com_davidmaletz_tiles_Tile.makeIcon(t)); + } + } + var d = com_davidmaletz_faengfl_adv_ModHandler.getData("renderOverlay","star"); + if(d != null) { + com_davidmaletz_mining_structure_Structure._addOverlay(d.xml,s,null,null,this,false); + } + this.selector = new com_davidmaletz_tiles_render_StaticPlayAnimation(com_davidmaletz_tiles_Tile.get("nav.star"),"nav.star.select",10,true); + this.selector.set_visible(false); + this.addChild(this.selector); + if(s.xml.exists("x")) { + this.set_x(com_davidmaletz_mining_Main.parseInt(s.xml.get("x"))); + } + if(s.xml.exists("y")) { + this.set_y(com_davidmaletz_mining_Main.parseInt(s.xml.get("y"))); + } + if(t == null) { + this.bounds = new openfl_geom_Rectangle(); + } else { + var tb = t.getTileBase(); + var s1 = tb.sheet; + var f = s1.getFrame(tb.x,tb.y); + var r = s1.getTileRect2(tb.x,tb.y); + this.bounds = new openfl_geom_Rectangle(this.get_x() + tb.offsetX,this.get_y() + tb.offsetY,r.width,r.height); + if(f != null) { + this.bounds.x += f.offsetX; + this.bounds.y += f.offsetY; + } + } +}; +$hxClasses["com.davidmaletz.mining.ui.StarRenderer"] = com_davidmaletz_mining_ui_StarRenderer; +com_davidmaletz_mining_ui_StarRenderer.__name__ = ["com","davidmaletz","mining","ui","StarRenderer"]; +com_davidmaletz_mining_ui_StarRenderer.__interfaces__ = [com_davidmaletz_controls_Clickable]; +com_davidmaletz_mining_ui_StarRenderer.__super__ = openfl_display_Sprite; +com_davidmaletz_mining_ui_StarRenderer.prototype = $extend(openfl_display_Sprite.prototype,{ + star: null + ,handler: null + ,bounds: null + ,selector: null + ,getPos: function() { + return this.bounds; + } + ,onHover: function(hover) { + this.selector.set_visible(hover); + if(this.handler != null) { + this.handler.onHover(hover ? this.star : null); + } + } + ,onClick: function() { + if(this.handler != null) { + this.handler.onSelect(this.star); + } + return true; + } + ,canSelect: function() { + return this.get_visible(); + } + ,__class__: com_davidmaletz_mining_ui_StarRenderer +}); +var com_davidmaletz_mining_ui_StarSystemNav = function(c,star,onSelect) { + com_davidmaletz_controls_ClickableWindow.call(this,c,new com_davidmaletz_tiles_TileDrawable(com_davidmaletz_tiles_Tile.get("nav.bg.star")),true,false,false); + this.set_alpha(0); + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),10); + var vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(com_davidmaletz_mining_Main.getLocalPlayer()); + var s = com_davidmaletz_mining_world_SolarSystem.getAll(); + while(s.hasNext()) { + var s1 = s.next(); + if(s1 == star || !s1.xml.exists("available") || com_davidmaletz_faengfl_EventHandler._conditionMet(s1.xml.get("available"),vars)) { + var r = new com_davidmaletz_mining_ui_StarRenderer(s1,this); + if(s1 == star) { + this.currentStar = r; + r.addChild(new com_davidmaletz_tiles_render_StaticPlayAnimation(com_davidmaletz_tiles_Tile.get("nav.star"),"nav.star.current",10,true)); + } + this.addClickable(r); + } + } + this.text = new haxe_ds_StringMap(); + var xml = com_davidmaletz_faengfl_adv_ModHandler.getData("textGroup","star.nav"); + if(xml != null) { + var e = xml.xml.elementPathsNamed("text"); + while(e.hasNext()) { + var e1 = e.next(); + var txt = com_davidmaletz_mining_effects_Scene.makeText(e1.xml,e1.path); + if(e1.exists("id")) { + var id = e1.get("id"); + this.text.set(id,txt); + txt.set_visible(false); + } + this.addChild(txt); + } + } + this.selectStar = onSelect; +}; +$hxClasses["com.davidmaletz.mining.ui.StarSystemNav"] = com_davidmaletz_mining_ui_StarSystemNav; +com_davidmaletz_mining_ui_StarSystemNav.__name__ = ["com","davidmaletz","mining","ui","StarSystemNav"]; +com_davidmaletz_mining_ui_StarSystemNav.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_StarSystemNav.__super__ = com_davidmaletz_controls_ClickableWindow; +com_davidmaletz_mining_ui_StarSystemNav.prototype = $extend(com_davidmaletz_controls_ClickableWindow.prototype,{ + text: null + ,selectStar: null + ,currentStar: null + ,init: function(e) { + com_davidmaletz_controls_ClickableWindow.prototype.init.call(this,e); + this.clickables.setSelectedItem(this.currentStar); + } + ,close: function() { + if(this.parent != null && !this.hasTrack(com_davidmaletz_lerp_AlphaKeyframe)) { + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),10,$bind(this,this.doClose)); + } + } + ,onCancel: function() { + this.close(); + } + ,onSelect: function(item) { + if((this.currentStar == null || item != this.currentStar.star) && this.selectStar != null) { + this.selectStar(item); + } + this.close(); + } + ,onHover: function(item) { + var name = this.text.get("system"); + var desc = this.text.get("system.desc"); + if(name != null) { + if(item == null) { + name.set_visible(false); + } else { + name.set_visible(true); + name.setText(item.getName().get()); + } + } + if(desc != null) { + if(item == null) { + desc.set_visible(false); + } else { + desc.set_visible(true); + desc.setText(item.getDesc().get()); + } + } + } + ,isEnabled: function(item) { + return true; + } + ,__class__: com_davidmaletz_mining_ui_StarSystemNav +}); +var com_davidmaletz_mining_ui_StatsWindow = function(c,p,title) { + var r = new com_davidmaletz_mining_ui__$StatsWindow_StatRenderer(p,this); + var rows = Math.floor(90 / r.getHeight(null)); + com_davidmaletz_controls_scroll_ScrollWindow.call(this,c,com_davidmaletz_mining_Main.window_factory,r,rows,2,0.1); + this.player = p; + var w = this.getWidth(); + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,title,w,0,120); + var s = p.getInfo().getStats(p); + while(s.hasNext()) { + var s1 = s.next(); + this.addItem(s1); + } + this.details = new com_davidmaletz_mining_ui_details_Details(100); + this.details.set_x(this.getWidth() + 4); + this.addChild(this.details); +}; +$hxClasses["com.davidmaletz.mining.ui.StatsWindow"] = com_davidmaletz_mining_ui_StatsWindow; +com_davidmaletz_mining_ui_StatsWindow.__name__ = ["com","davidmaletz","mining","ui","StatsWindow"]; +com_davidmaletz_mining_ui_StatsWindow.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_StatsWindow.__super__ = com_davidmaletz_controls_scroll_ScrollWindow; +com_davidmaletz_mining_ui_StatsWindow.prototype = $extend(com_davidmaletz_controls_scroll_ScrollWindow.prototype,{ + player: null + ,details: null + ,onSelect: function(item) { + } + ,onHover: function(item) { + this.details.setInfo(item); + this.details.set_y(Math.round((this.getHeight() - this.details.getHeight()) * 0.5)); + } + ,isEnabled: function(item) { + return true; + } + ,__class__: com_davidmaletz_mining_ui_StatsWindow +}); +var com_davidmaletz_mining_ui__$StatsWindow_StatRenderer = function(player,handler) { + this.player = player; + this.handler = handler; +}; +$hxClasses["com.davidmaletz.mining.ui._StatsWindow.StatRenderer"] = com_davidmaletz_mining_ui__$StatsWindow_StatRenderer; +com_davidmaletz_mining_ui__$StatsWindow_StatRenderer.__name__ = ["com","davidmaletz","mining","ui","_StatsWindow","StatRenderer"]; +com_davidmaletz_mining_ui__$StatsWindow_StatRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui__$StatsWindow_StatRenderer.prototype = { + player: null + ,handler: null + ,create: function(item,x,y) { + return new com_davidmaletz_mining_ui__$StatsWindow_StatButton(this.player,this.handler,item,x,y,60,com_davidmaletz_mining_ui_StringRenderer._getHeight()); + } + ,update: function(s,item) { + } + ,getWidth: function() { + return 60; + } + ,getHeight: function(item) { + return com_davidmaletz_mining_ui_StringRenderer._getHeight(); + } + ,__class__: com_davidmaletz_mining_ui__$StatsWindow_StatRenderer +}; +var com_davidmaletz_mining_ui__$StatsWindow_StatButton = function(p,handler,s,x,y,w,h) { + com_davidmaletz_controls_Button.call(this,x,y,com_davidmaletz_mining_Main.label_factory.createBG(w,h),com_davidmaletz_mining_Main.label_factory.createHover(w,h),null); + this.handler = handler; + this.stat = s; + this.player = p; + this.value = new com_fancyfish_faeng_common_mutable_Mutable(); + com_davidmaletz_mining_ui_ItemRenderer.addItem(this,this); + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); +}; +$hxClasses["com.davidmaletz.mining.ui._StatsWindow.StatButton"] = com_davidmaletz_mining_ui__$StatsWindow_StatButton; +com_davidmaletz_mining_ui__$StatsWindow_StatButton.__name__ = ["com","davidmaletz","mining","ui","_StatsWindow","StatButton"]; +com_davidmaletz_mining_ui__$StatsWindow_StatButton.__interfaces__ = [com_davidmaletz_mining_ui_InfoItem]; +com_davidmaletz_mining_ui__$StatsWindow_StatButton.__super__ = com_davidmaletz_controls_Button; +com_davidmaletz_mining_ui__$StatsWindow_StatButton.prototype = $extend(com_davidmaletz_controls_Button.prototype,{ + player: null + ,handler: null + ,stat: null + ,value: null + ,update: function(e) { + this.value.set(Std.string(this.player.stats.getInt(this.stat))); + } + ,init: function(e) { + this.destroy(e); + this.player.stats.addEventListener("updated",$bind(this,this.update)); + this.update(null); + } + ,destroy: function(e) { + this.player.stats.removeEventListener("updated",$bind(this,this.update)); + } + ,onClick: function() { + if(this.handler != null) { + this.handler.onSelect(this); + } + return true; + } + ,onHover: function(hover) { + com_davidmaletz_controls_Button.prototype.onHover.call(this,hover); + if(this.handler != null) { + this.handler.onHover(hover ? this : null); + } + } + ,getName: function() { + return new com_fancyfish_faeng_common_mutable_Concat2(com_fancyfish_faeng_common_Lang.getText("stats",this.stat),this.value,": "); + } + ,createIcon: function() { + var t = com_davidmaletz_tiles_Tile.makeIcon(com_davidmaletz_tiles_Tile.get("stat." + this.stat)); + com_davidmaletz_mining_Stat.tint(t,1); + return t; + } + ,getElement: function() { + return null; + } + ,addInfo: function(s,width,x,y) { + return com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,width,x,y,com_fancyfish_faeng_common_Lang.getText("stat.descriptions",this.stat).get()); + } + ,__class__: com_davidmaletz_mining_ui__$StatsWindow_StatButton +}); +var com_davidmaletz_mining_ui_StatusBars = function(p,c) { + this.storage = new haxe_ds_StringMap(); + com_davidmaletz_mining_ui_Bars.call(this,c); + this.player = p; + this.addBar(new com_davidmaletz_mining_ui_HealthBar(p)); + this.addBar(new com_davidmaletz_mining_ui_StaminaBar(p)); + this.addBar(new com_davidmaletz_mining_ui_OxygenBar(p,this)); + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); +}; +$hxClasses["com.davidmaletz.mining.ui.StatusBars"] = com_davidmaletz_mining_ui_StatusBars; +com_davidmaletz_mining_ui_StatusBars.__name__ = ["com","davidmaletz","mining","ui","StatusBars"]; +com_davidmaletz_mining_ui_StatusBars.barDefs = null; +com_davidmaletz_mining_ui_StatusBars.loadBar = function(id,tile,color) { + if(com_davidmaletz_mining_ui_StatusBars.barDefs == null) { + com_davidmaletz_mining_ui_StatusBars.barDefs = new haxe_ds_StringMap(); + } + if(com_davidmaletz_mining_ui_StatusBars.barDefs.exists(id)) { + haxe_Log.trace("Overwrite Bar: " + id,{ fileName : "StatusBars.hx", lineNumber : 33, className : "com.davidmaletz.mining.ui.StatusBars", methodName : "loadBar"}); + } + com_davidmaletz_mining_ui_StatusBars.barDefs.set(id,new com_davidmaletz_mining_ui__$StatusBars_BarDef(tile,color)); +}; +com_davidmaletz_mining_ui_StatusBars.getTile = function(id) { + var def; + var tmp; + if(com_davidmaletz_mining_ui_StatusBars.barDefs != null) { + def = com_davidmaletz_mining_ui_StatusBars.barDefs.get(id); + tmp = def != null; + } else { + tmp = false; + } + if(tmp) { + return def.tile; + } else { + return id; + } +}; +com_davidmaletz_mining_ui_StatusBars.hasDef = function(id) { + if(com_davidmaletz_mining_ui_StatusBars.barDefs != null) { + return com_davidmaletz_mining_ui_StatusBars.barDefs.exists(id); + } else { + return false; + } +}; +com_davidmaletz_mining_ui_StatusBars.reset = function() { + com_davidmaletz_mining_ui_StatusBars.barDefs = null; +}; +com_davidmaletz_mining_ui_StatusBars.__super__ = com_davidmaletz_mining_ui_Bars; +com_davidmaletz_mining_ui_StatusBars.prototype = $extend(com_davidmaletz_mining_ui_Bars.prototype,{ + player: null + ,storage: null + ,init: function(e) { + this.destroy(e); + this.player.addEventListener("add_storage",$bind(this,this.add_bar)); + var s = this.player.storage.iterator(); + while(s.hasNext()) { + var s1 = s.next(); + this.addStorage(s1); + } + } + ,destroy: function(e) { + this.player.removeEventListener("add_storage",$bind(this,this.add_bar)); + } + ,add_bar: function(e) { + this.addStorage(js_Boot.__cast(e.value , com_davidmaletz_mining_item_Storage)); + } + ,addStorage: function(s) { + if(this.storage.exists(s.id)) { + return; + } + this.storage.set(s.id,true); + if(com_davidmaletz_mining_ui_StatusBars.barDefs != null) { + var def = com_davidmaletz_mining_ui_StatusBars.barDefs.get(s.id); + if(def != null) { + this.addBar(new com_davidmaletz_mining_ui_StorageBar(this,s,def.tile,def.color)); + } + } + } + ,__class__: com_davidmaletz_mining_ui_StatusBars +}); +var com_davidmaletz_mining_ui__$StatusBars_BarDef = function(t,c) { + this.tile = t; + this.color = c; +}; +$hxClasses["com.davidmaletz.mining.ui._StatusBars.BarDef"] = com_davidmaletz_mining_ui__$StatusBars_BarDef; +com_davidmaletz_mining_ui__$StatusBars_BarDef.__name__ = ["com","davidmaletz","mining","ui","_StatusBars","BarDef"]; +com_davidmaletz_mining_ui__$StatusBars_BarDef.prototype = { + tile: null + ,color: null + ,__class__: com_davidmaletz_mining_ui__$StatusBars_BarDef +}; +var com_davidmaletz_mining_ui_StickyInventoryList = function(p,w,i,list,c,incNone,filter) { + if(incNone == null) { + incNone = false; + } + this.player = p; + com_davidmaletz_mining_ui_InventoryList.call(this,w,i,list,c,incNone,filter,false); +}; +$hxClasses["com.davidmaletz.mining.ui.StickyInventoryList"] = com_davidmaletz_mining_ui_StickyInventoryList; +com_davidmaletz_mining_ui_StickyInventoryList.__name__ = ["com","davidmaletz","mining","ui","StickyInventoryList"]; +com_davidmaletz_mining_ui_StickyInventoryList.__super__ = com_davidmaletz_mining_ui_InventoryList; +com_davidmaletz_mining_ui_StickyInventoryList.prototype = $extend(com_davidmaletz_mining_ui_InventoryList.prototype,{ + player: null + ,sortSticky: function(a,b) { + var $as = this.player.isItemSticky(a.item.id); + var bs = this.player.isItemSticky(b.item.id); + if($as == bs) { + return com_davidmaletz_mining_item_Inventory.ascCost(a,b); + } else if($as) { + return -1; + } else { + return 1; + } + } + ,getSort: function() { + return $bind(this,this.sortSticky); + } + ,__class__: com_davidmaletz_mining_ui_StickyInventoryList +}); +var com_davidmaletz_mining_ui_StickyItemRenderer = function(p,handler) { + com_davidmaletz_mining_ui_ItemRenderer.call(this,handler); + this.player = p; +}; +$hxClasses["com.davidmaletz.mining.ui.StickyItemRenderer"] = com_davidmaletz_mining_ui_StickyItemRenderer; +com_davidmaletz_mining_ui_StickyItemRenderer.__name__ = ["com","davidmaletz","mining","ui","StickyItemRenderer"]; +com_davidmaletz_mining_ui_StickyItemRenderer.__super__ = com_davidmaletz_mining_ui_ItemRenderer; +com_davidmaletz_mining_ui_StickyItemRenderer.prototype = $extend(com_davidmaletz_mining_ui_ItemRenderer.prototype,{ + player: null + ,create: function(item,x,y) { + return new com_davidmaletz_mining_ui_StickyButton(this,item,x,y); + } + ,__class__: com_davidmaletz_mining_ui_StickyItemRenderer +}); +var com_davidmaletz_mining_ui_StickyButton = function(r,i,x,y) { + com_davidmaletz_mining_ui_ListButton.call(this,r,i,x,y); + this.player = r.player; + var b = openfl_Assets.getBitmapData("data/ui/sticky.png"); + this.star = new openfl_display_Bitmap(b); + if(b.width > 8) { + this.star.set_scaleX(this.star.set_scaleY(0.5)); + } + this.star.set_y(Math.round(r.getHeight(i) - b.height * this.star.get_scaleY())); + this.addChild(this.star); + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); +}; +$hxClasses["com.davidmaletz.mining.ui.StickyButton"] = com_davidmaletz_mining_ui_StickyButton; +com_davidmaletz_mining_ui_StickyButton.__name__ = ["com","davidmaletz","mining","ui","StickyButton"]; +com_davidmaletz_mining_ui_StickyButton.__super__ = com_davidmaletz_mining_ui_ListButton; +com_davidmaletz_mining_ui_StickyButton.prototype = $extend(com_davidmaletz_mining_ui_ListButton.prototype,{ + player: null + ,star: null + ,init: function(e) { + this.destroy(e); + this.player.addEventListener("sticky_changed",$bind(this,this.update_sticky)); + this.update_sticky(null); + } + ,destroy: function(e) { + this.player.removeEventListener("sticky_changed",$bind(this,this.update_sticky)); + } + ,update_sticky: function(e) { + this.star.set_visible(this.item != null && this.player.isItemSticky(this.item.item.id)); + } + ,__class__: com_davidmaletz_mining_ui_StickyButton +}); +var com_davidmaletz_mining_ui_StorageBar = function(parent,s,tile,color) { + com_davidmaletz_mining_ui_MyBar.call(this,tile,50,3,color,s.getPercent()); + this.status = parent; + this.storage = s; + this.set_x(12); + this.set_visible(s.getMaxValue() > 0); +}; +$hxClasses["com.davidmaletz.mining.ui.StorageBar"] = com_davidmaletz_mining_ui_StorageBar; +com_davidmaletz_mining_ui_StorageBar.__name__ = ["com","davidmaletz","mining","ui","StorageBar"]; +com_davidmaletz_mining_ui_StorageBar.__super__ = com_davidmaletz_mining_ui_MyBar; +com_davidmaletz_mining_ui_StorageBar.prototype = $extend(com_davidmaletz_mining_ui_MyBar.prototype,{ + status: null + ,storage: null + ,init: function(e) { + com_davidmaletz_mining_ui_MyBar.prototype.init.call(this,e); + this.storage.addEventListener("updated",$bind(this,this.update)); + this.update(null); + } + ,destroy: function(e) { + com_davidmaletz_mining_ui_MyBar.prototype.destroy.call(this,e); + this.storage.removeEventListener("updated",$bind(this,this.update)); + } + ,update: function(e) { + var v = this.storage.getMaxValue() > 0; + if(v != this.get_visible()) { + this.set_visible(v); + this.status.updateVisible(this); + } + if(v) { + this.setProgress(this.storage.getPercent(),5); + } + } + ,__class__: com_davidmaletz_mining_ui_StorageBar +}); +var com_davidmaletz_mining_ui_StoreWindow = function(p,sell,buy,c,types,price,achievements) { + this.buy_types = types; + com_davidmaletz_mining_ui_TransferInventory.call(this,p,sell,buy,com_fancyfish_faeng_common_Lang.getText("common","sell"),com_fancyfish_faeng_common_Lang.getText("common","buy"),c,null,null,4,false); + this.price = price; + this.achievement_map = achievements; +}; +$hxClasses["com.davidmaletz.mining.ui.StoreWindow"] = com_davidmaletz_mining_ui_StoreWindow; +com_davidmaletz_mining_ui_StoreWindow.__name__ = ["com","davidmaletz","mining","ui","StoreWindow"]; +com_davidmaletz_mining_ui_StoreWindow.__super__ = com_davidmaletz_mining_ui_TransferInventory; +com_davidmaletz_mining_ui_StoreWindow.prototype = $extend(com_davidmaletz_mining_ui_TransferInventory.prototype,{ + achievement_map: null + ,buy_types: null + ,price: null + ,init: function(e) { + com_davidmaletz_mining_ui_TransferInventory.prototype.init.call(this,e); + this.player.getStorage("coins").addEventListener("updated",$bind(this,this.change_coins)); + this.change_coins(null); + } + ,destroy: function(e) { + com_davidmaletz_mining_ui_TransferInventory.prototype.destroy.call(this,e); + this.player.getStorage("coins").removeEventListener("updated",$bind(this,this.change_coins)); + } + ,hasItem: function(c) { + var tmp; + if(this.buy_types.exists(c.index)) { + var a1 = c; + var tmp1 = function(a2) { + return com_davidmaletz_mining_item_Inventory.filterType(a1,a2); + }; + tmp = this.from.inventory.getItems(tmp1).hasNext(); + } else { + tmp = false; + } + if(!tmp) { + var a11 = c; + var tmp2 = function(a21) { + return com_davidmaletz_mining_item_Inventory.filterType(a11,a21); + }; + return this.to.inventory.getItems(tmp2).hasNext(); + } else { + return true; + } + } + ,moveOne: function(item) { + return false; + } + ,moveAll: function(item) { + return false; + } + ,change_coins: function(e) { + this.to.updateAll(); + } + ,addCenterColumn: function() { + } + ,moveItem: function(item,ct,i,value,name) { + i.addItems(item,ct,value,name); + com_davidmaletz_faengfl_adv_sound_Sound.play("buy"); + if(i == this.from.inventory) { + if(this.achievement_map != null && this.achievement_map.exists(item.id)) { + com_davidmaletz_faengfl_achievement_Achievements.instance.gainAchievement(this.achievement_map.get(item.id)); + } + this.player.addCoins(-Math.round(item.cost * this.price) * ct); + } else { + this.player.addCoins(Math.round(item.cost * this.player.getSalePercent()) * ct); + } + } + ,createPrompt: function(c,item,func) { + var coins = this.player.getCoins(); + if(item.inventory == this.to.inventory) { + return new com_davidmaletz_mining_ui_BuyPrompt(c,coins,item,item.count,func,Math.round(item.getInfo().cost * this.price)); + } else { + var max = this.player.getMaxCoins(); + if(coins < max) { + return new com_davidmaletz_mining_ui_SellPrompt(this.player,c,coins,max,item,item.count,func); + } else { + com_davidmaletz_faengfl_adv_sound_Sound.play("warning"); + new com_davidmaletz_faengfl_ui_Popup(128.,52.,0,com_fancyfish_faeng_common_Lang.getText("warning","max_coins"),16720418); + return null; + } + } + } + ,additionalInfo: function(item,s,w,x,y) { + var c = item.item.cost; + var m; + if(item.inventory == this.from.inventory) { + c = Math.round(c * this.player.getSalePercent()); + m = com_fancyfish_faeng_common_Lang.getText("common","sell"); + } else { + c = Math.round(c * this.price); + m = com_fancyfish_faeng_common_Lang.getText("common","buy"); + } + return com_davidmaletz_mining_item_ItemInfo.addCoins(m,c,s,w,x,y); + } + ,filterFrom: function(i) { + if(!this.buy_types.exists(i.type.index)) { + var a1 = i.type; + var tmp = function(a2) { + return com_davidmaletz_mining_item_Inventory.filterType(a1,a2); + }; + return this.to.inventory.getItems(tmp).hasNext(); + } else { + return true; + } + } + ,isEnabled: function(item) { + if(item.item.cost > 0 && item.count > 0) { + if(item.inventory == this.from.inventory) { + return this.buy_types.exists(item.item.type.index); + } else if(!item.item.showCount() && this.from.inventory.getItemCount(item.item) > 0) { + return false; + } else { + return Math.round(item.item.cost * this.price) <= this.player.getCoins(); + } + } else { + return false; + } + } + ,__class__: com_davidmaletz_mining_ui_StoreWindow +}); +var com_davidmaletz_mining_ui_StringRenderer = function(section,handler,w) { + if(w == null) { + w = 80; + } + this.section = section; + this.handler = handler; + this.width = w; +}; +$hxClasses["com.davidmaletz.mining.ui.StringRenderer"] = com_davidmaletz_mining_ui_StringRenderer; +com_davidmaletz_mining_ui_StringRenderer.__name__ = ["com","davidmaletz","mining","ui","StringRenderer"]; +com_davidmaletz_mining_ui_StringRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui_StringRenderer.mutableFromId = function(section,id) { + var m; + if(section == null) { + m = new com_fancyfish_faeng_common_mutable_Static(id); + } else { + m = com_fancyfish_faeng_common_Lang.getTextFromTitle(id); + if(m == null) { + m = com_fancyfish_faeng_common_Lang.getText(section,id); + } + } + return m; +}; +com_davidmaletz_mining_ui_StringRenderer._getHeight = function() { + return com_fancyfish_faeng_text_FontManager.lineHeight(); +}; +com_davidmaletz_mining_ui_StringRenderer.prototype = { + section: null + ,handler: null + ,width: null + ,create: function(item,x,y) { + return new com_davidmaletz_mining_ui_StringButton(this.handler,com_davidmaletz_mining_ui_StringRenderer.mutableFromId(this.section,item),item,x,y,this.width,com_davidmaletz_mining_ui_StringRenderer._getHeight()); + } + ,update: function(s,item) { + } + ,getWidth: function() { + return this.width; + } + ,getHeight: function(item) { + return com_davidmaletz_mining_ui_StringRenderer._getHeight(); + } + ,__class__: com_davidmaletz_mining_ui_StringRenderer +}; +var com_davidmaletz_mining_ui_SelectItemList = function(player,c,func,incNone,title,filter,inv) { + com_davidmaletz_mining_ui_TabbedItemList.call(this,player,c,incNone,0.2,0.5,title,filter,inv); + this._onSelect = func; +}; +$hxClasses["com.davidmaletz.mining.ui.SelectItemList"] = com_davidmaletz_mining_ui_SelectItemList; +com_davidmaletz_mining_ui_SelectItemList.__name__ = ["com","davidmaletz","mining","ui","SelectItemList"]; +com_davidmaletz_mining_ui_SelectItemList.__super__ = com_davidmaletz_mining_ui_TabbedItemList; +com_davidmaletz_mining_ui_SelectItemList.prototype = $extend(com_davidmaletz_mining_ui_TabbedItemList.prototype,{ + _onSelect: null + ,onSelect: function(item) { + this._onSelect(item); + this.close(); + } + ,__class__: com_davidmaletz_mining_ui_SelectItemList +}); +var com_davidmaletz_mining_ui_TextButton = function(x,y,txt,func,w,scale) { + if(scale == null) { + scale = 1; + } + if(w == null) { + w = -1; + } + if(w == -1) { + w = 40; + } + var f = com_davidmaletz_faengfl_Application.button_factory; + com_davidmaletz_controls_Button.call(this,x,y,f.createBG(w,-1),f.createHover(w,-1),txt,0,scale); + this.text = this.getChildAt(this.get_numChildren() - 1); + this.onClickFunc = func; +}; +$hxClasses["com.davidmaletz.mining.ui.TextButton"] = com_davidmaletz_mining_ui_TextButton; +com_davidmaletz_mining_ui_TextButton.__name__ = ["com","davidmaletz","mining","ui","TextButton"]; +com_davidmaletz_mining_ui_TextButton.getHeight = function() { + return com_davidmaletz_faengfl_Application.button_factory.defaultHeight(); +}; +com_davidmaletz_mining_ui_TextButton.__super__ = com_davidmaletz_controls_Button; +com_davidmaletz_mining_ui_TextButton.prototype = $extend(com_davidmaletz_controls_Button.prototype,{ + text: null + ,setText: function(txt) { + this.text.setText(txt); + } + ,__class__: com_davidmaletz_mining_ui_TextButton +}); +var com_davidmaletz_mining_ui_TextButtonRenderer = function(section,handler,w,px,py) { + if(py == null) { + py = -1; + } + this.section = section; + this.handler = handler; + this.width = w; + this.pad_x = px; + this.pad_y = py < 0 ? px : py; +}; +$hxClasses["com.davidmaletz.mining.ui.TextButtonRenderer"] = com_davidmaletz_mining_ui_TextButtonRenderer; +com_davidmaletz_mining_ui_TextButtonRenderer.__name__ = ["com","davidmaletz","mining","ui","TextButtonRenderer"]; +com_davidmaletz_mining_ui_TextButtonRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui_TextButtonRenderer._getHeight = function() { + return Math.round(com_davidmaletz_mining_ui_TextButton.getHeight()); +}; +com_davidmaletz_mining_ui_TextButtonRenderer.prototype = { + section: null + ,handler: null + ,width: null + ,pad_x: null + ,pad_y: null + ,create: function(item,x,y) { + if(item == null) { + return null; + } + var m; + if(this.section == null) { + m = new com_fancyfish_faeng_common_mutable_Static(item); + } else { + m = com_fancyfish_faeng_common_Lang.getTextFromTitle(item); + if(m == null) { + var i = item.lastIndexOf("."); + var sec = this.section; + if(i != -1) { + sec = item.substring(0,i); + item = item.substring(i + 1); + } + m = com_fancyfish_faeng_common_Lang.getText(sec,item); + } + } + var f = ($_=this.handler,$bind($_,$_.onSelect)); + var a1 = item; + return new com_davidmaletz_mining_ui_TextButton(x,y,m,function() { + f(a1); + },this.width); + } + ,update: function(s,item) { + } + ,getWidth: function() { + return this.width + this.pad_x; + } + ,getHeight: function(item) { + return com_davidmaletz_mining_ui_TextButtonRenderer._getHeight() + this.pad_y; + } + ,__class__: com_davidmaletz_mining_ui_TextButtonRenderer +}; +var com_davidmaletz_mining_ui_TextInput = function(c,str,onAccept,txt,max_length,width) { + if(width == null) { + width = 220; + } + if(max_length == null) { + max_length = -1; + } + if(txt == null) { + txt = ""; + } + var t = new com_davidmaletz_mining_ui_MyFormattedText(width - 8,true,str.get(),1); + var y = t.bounds.height * t.get_scaleY() + 8; + var ht = y + com_davidmaletz_mining_ui_TextButton.getHeight() + 4 + 10 + 2 + 4; + com_davidmaletz_controls_ClickableWindow.call(this,c,com_davidmaletz_mining_Main.window_factory.create(width,ht)); + t.set_x(4); + t.set_y(4); + this.addChild(t); + this.addChild(new com_davidmaletz_faengfl_SolidDrawable(16777215,width - 8,12,1).create(4,y)); + this.text = new com_davidmaletz_faengfl_ui_TextField(c,width - 8 - 2,txt,0,1,0,16777215,null,max_length); + this.text.set_x(5); + this.text.set_y(y + 1); + this.addChild(this.text); + y += 16; + this.text.addEventListener("action",$bind(this,this._confirm)); + this.clickables.allowLoop = false; + this.onAccept = onAccept; + this.addClickable(new com_davidmaletz_mining_ui_TextButton(4,y,com_fancyfish_faeng_common_Lang.getText("common","ok"),$bind(this,this.confirm))); + this.addClickable(new com_davidmaletz_mining_ui_TextButton(width - 4 - 40,y,com_fancyfish_faeng_common_Lang.getText("common","cancel"),$bind(this,this.close))); + this.clickables.moveSelection(1,0); + this.clickables.moveSelection(1,0); +}; +$hxClasses["com.davidmaletz.mining.ui.TextInput"] = com_davidmaletz_mining_ui_TextInput; +com_davidmaletz_mining_ui_TextInput.__name__ = ["com","davidmaletz","mining","ui","TextInput"]; +com_davidmaletz_mining_ui_TextInput.__super__ = com_davidmaletz_controls_ClickableWindow; +com_davidmaletz_mining_ui_TextInput.prototype = $extend(com_davidmaletz_controls_ClickableWindow.prototype,{ + onAccept: null + ,text: null + ,onOpened: function() { + com_davidmaletz_faengfl_Application.setFocus(this.text); + this.text.selectAll(); + } + ,confirm: function() { + if(this.onAccept != null) { + this.onAccept(this.text.getText()); + this.onAccept = null; + } + this.close(); + } + ,_confirm: function(e) { + this.confirm(); + } + ,__class__: com_davidmaletz_mining_ui_TextInput +}); +var com_davidmaletz_mining_ui_TitleScreen = function() { + var ITEMS = com_davidmaletz_faengfl_adv_ModHandler.getModInfo("full_version") == null ? com_davidmaletz_mining_ui_TitleScreen.ITEMS_DEMO : com_davidmaletz_mining_Main.allowMultiplayer ? com_davidmaletz_mining_ui_TitleScreen.ITEMS_FULL_MP : com_davidmaletz_mining_ui_TitleScreen.ITEMS_FULL; + com_davidmaletz_controls_ClickableSprite.call(this); + var list = new com_davidmaletz_controls_ListSprite(new com_davidmaletz_mining_ui_TextButtonRenderer("common",this,63,1),Math.ceil(ITEMS.length / 4),4); + this.set_x(Math.round((256 - (list.getWidth() - 1)) * 0.5)); + this.set_y(144 - list.getHeight()); + var b = new openfl_display_Bitmap(openfl_Assets.getBitmapData("data/ui/title.png")); + b.set_scaleX(b.set_scaleY(0.5)); + b.set_x(-this.get_x()); + b.set_y(-this.get_y()); + this.addChild(b); + var len = ITEMS.length; + var e = Math.floor(len / 4) * 4; + if(e != len) { + var end = len - e; + var ar = []; + var _g1 = 0; + var _g = end; + while(_g1 < _g) { + var i = _g1++; + ar.push(list.addItem(this.clickables,ITEMS[i])); + } + var _g2 = end; + while(_g2 < 4) { + var i1 = _g2++; + list.addItem(this.clickables,null); + } + var _g11 = end; + var _g3 = len; + while(_g11 < _g3) { + var i2 = _g11++; + list.addItem(this.clickables,ITEMS[i2]); + } + var offX = Math.round((list.getWidth() - (len - e) * 64) * 0.5); + var _g12 = 0; + var _g4 = end; + while(_g12 < _g4) { + var i3 = _g12++; + var c = ar[i3]; + var _g21 = c; + _g21.set_x(_g21.get_x() + offX); + (js_Boot.__cast(c , com_davidmaletz_controls_Clickable)).getPos().x += offX; + } + } else { + var _g5 = 0; + while(_g5 < ITEMS.length) { + var i4 = ITEMS[_g5]; + ++_g5; + list.addItem(this.clickables,i4); + } + } + var info = com_davidmaletz_faengfl_adv_ModHandler.getModInfo("core"); + var v = new com_fancyfish_faeng_common_mutable_Static((info == null ? "0.0.0" : info.version) + (ITEMS == com_davidmaletz_mining_ui_TitleScreen.ITEMS_DEMO ? " Demo" : "")); + var s = new openfl_display_Sprite(); + com_davidmaletz_faengfl_ui_Tooltip.draw(s,v,16777215,-1442840576,null,2); + s.set_x(256 - this.get_x() - 4); + s.set_y(-12); + this.addChild(list); + this.addChild(s); + this.unsynced = new openfl_display_Sprite(); + com_davidmaletz_faengfl_ui_Tooltip.draw(this.unsynced,com_fancyfish_faeng_common_Lang.getText("cloud","unsynced"),16720418); + this.unsynced.set_x(30); + this.unsynced.set_y(-12); + var t = new com_davidmaletz_mining_ui_TextButton(list.getWidth(),0,com_fancyfish_faeng_common_Lang.getText("cloud","sync_now"),$bind(this,this.sync_now),60); + this.addClickable(t); + var r = t.getPos(); + r.x = t.set_x(98.); + r.y = t.set_y(-20); + t.addChild(this.unsynced); + this.unsynced = t; +}; +$hxClasses["com.davidmaletz.mining.ui.TitleScreen"] = com_davidmaletz_mining_ui_TitleScreen; +com_davidmaletz_mining_ui_TitleScreen.__name__ = ["com","davidmaletz","mining","ui","TitleScreen"]; +com_davidmaletz_mining_ui_TitleScreen.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_TitleScreen.__super__ = com_davidmaletz_controls_ClickableSprite; +com_davidmaletz_mining_ui_TitleScreen.prototype = $extend(com_davidmaletz_controls_ClickableSprite.prototype,{ + unsynced: null + ,init: function(e) { + com_davidmaletz_controls_ClickableSprite.prototype.init.call(this,e); + com_davidmaletz_mining_network_CloudSaves.dispatcher.addEventListener("needs_sync",$bind(this,this.updateSync)); + com_davidmaletz_mining_network_CloudSaves.username.addEventListener("updated",$bind(this,this.updateSync)); + this.updateSync(null); + } + ,destroy: function(e) { + com_davidmaletz_controls_ClickableSprite.prototype.destroy.call(this,e); + com_davidmaletz_mining_network_CloudSaves.dispatcher.removeEventListener("needs_sync",$bind(this,this.updateSync)); + com_davidmaletz_mining_network_CloudSaves.username.removeEventListener("updated",$bind(this,this.updateSync)); + } + ,updateSync: function(e) { + this.unsynced.set_visible(com_davidmaletz_mining_network_CloudSaves.isLoggedIn() && com_davidmaletz_mining_network_CloudSaves.needsSync()); + } + ,sync_now: function() { + if(this.unsynced.get_visible()) { + com_davidmaletz_mining_Main.closeWindows(function() { + com_davidmaletz_mining_network_CloudSaves.syncAll(true); + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_network_SyncList(c),2); + }); + } + } + ,onSelect: function(str) { + var c = com_davidmaletz_mining_Main.getContainer(); + switch(str) { + case "continue": + c.addDisplay(new com_davidmaletz_mining_ui_ContinueList(c),2); + break; + case "credits": + com_davidmaletz_mining_Main.closeWindows(function() { + com_davidmaletz_mining_Main.showCredits(null,null); + }); + break; + case "forums": + openfl_Lib.getURL(new openfl_net_URLRequest("https://www.reddit.com/r/aground"),"_blank"); + break; + case "mods": + var c1 = com_davidmaletz_mining_Main.getContainer(); + c1.addDisplay(new com_davidmaletz_mining_mods_ModList(c1),2); + break; + case "newgame": + c.addDisplay(new com_davidmaletz_mining_ui_NewGameList(c),2); + break; + case "options": + c.addDisplay(new com_davidmaletz_mining_ui_Options(c,false),2); + break; + case "options.achievements": + var c2 = com_davidmaletz_mining_Main.getContainer(); + c2.addDisplay(new com_davidmaletz_mining_ui_AchievementWindow(c2,($_=com_davidmaletz_faengfl_achievement_Achievements.instance,$bind($_,$_.hasAchievement))),2); + break; + case "order": + openfl_Lib.getURL(new openfl_net_URLRequest("http://fancyfishgames.com/Aground/"),"_blank"); + break; + } + } + ,onCancel: function() { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_Options(c,false),2); + } + ,onHover: function(item) { + } + ,isEnabled: function(item) { + return true; + } + ,__class__: com_davidmaletz_mining_ui_TitleScreen +}); +var com_davidmaletz_mining_ui_ToggleTransferInventory = function(p,to,to_l,c,to_weight,area,addWeight,e) { + if(addWeight == null) { + addWeight = 0; + } + this.title = new com_fancyfish_faeng_common_mutable_Mutable(); + this.area = area; + com_davidmaletz_mining_ui_TransferInventory.call(this,p,p.inventory,to,this.title,to_l,c,null,to_weight,24,true,addWeight,e); + var s = area != null ? area.getMainStorehouse(true) : null; + if(s != null) { + var x = this.getWidth(); + this.toggle = new com_davidmaletz_mining_ui_TextButton(x,this.getHeight() + 2,s.getTitle(p),$bind(this,this.toggleInvAlt),90); + this.addChild(this.toggle); + this.clickables.addClickable(this.toggle,this); + x -= 4; + var _g = this.toggle; + _g.set_x(_g.get_x() - x); + this.toggle.getPos().x -= x; + this.title.set(com_fancyfish_faeng_common_Lang.getText("common","inventory").get()); + } else { + this.title.set(com_fancyfish_faeng_common_Lang.getText("common","inventory").get()); + } +}; +$hxClasses["com.davidmaletz.mining.ui.ToggleTransferInventory"] = com_davidmaletz_mining_ui_ToggleTransferInventory; +com_davidmaletz_mining_ui_ToggleTransferInventory.__name__ = ["com","davidmaletz","mining","ui","ToggleTransferInventory"]; +com_davidmaletz_mining_ui_ToggleTransferInventory.__super__ = com_davidmaletz_mining_ui_TransferInventory; +com_davidmaletz_mining_ui_ToggleTransferInventory.prototype = $extend(com_davidmaletz_mining_ui_TransferInventory.prototype,{ + title: null + ,area: null + ,toggleInvAlt: function() { + var s = this.area.getMainStorehouse(true); + if(this.from.inventory == this.player.inventory) { + this.from.setInventory(s.accessInventory()); + this.toggle.setText(com_fancyfish_faeng_common_Lang.getText("common","inventory")); + this.title.set(s.getTitle(this.player).get()); + } else { + this.from.setInventory(this.player.inventory); + this.toggle.setText(s.getTitle(this.player)); + this.title.set(com_fancyfish_faeng_common_Lang.getText("common","inventory").get()); + } + this.tabs.refresh($bind(this,this.hasItem)); + } + ,__class__: com_davidmaletz_mining_ui_ToggleTransferInventory +}); +var com_davidmaletz_mining_ui__$UIOptions_TextSpeed = function(id) { + com_davidmaletz_mining_ui_FloatValue.call(this,id); +}; +$hxClasses["com.davidmaletz.mining.ui._UIOptions.TextSpeed"] = com_davidmaletz_mining_ui__$UIOptions_TextSpeed; +com_davidmaletz_mining_ui__$UIOptions_TextSpeed.__name__ = ["com","davidmaletz","mining","ui","_UIOptions","TextSpeed"]; +com_davidmaletz_mining_ui__$UIOptions_TextSpeed.__super__ = com_davidmaletz_mining_ui_FloatValue; +com_davidmaletz_mining_ui__$UIOptions_TextSpeed.prototype = $extend(com_davidmaletz_mining_ui_FloatValue.prototype,{ + getValue: function() { + return com_davidmaletz_faengfl_RevealText.TEXT_SPEED / 20; + } + ,setValue: function(val) { + com_davidmaletz_faengfl_RevealText.TEXT_SPEED = val * 20; + Reflect.setField(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"text_speed",com_davidmaletz_faengfl_RevealText.TEXT_SPEED); + } + ,updateSettings: function() { + var d = Reflect.field(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"text_speed"); + if(d != null) { + com_davidmaletz_faengfl_RevealText.TEXT_SPEED = d; + } + } + ,__class__: com_davidmaletz_mining_ui__$UIOptions_TextSpeed +}); +var com_davidmaletz_mining_ui__$UIOptions_HideNotifications = function() { + com_davidmaletz_mining_ui_OptionValue.call(this,"notifications"); +}; +$hxClasses["com.davidmaletz.mining.ui._UIOptions.HideNotifications"] = com_davidmaletz_mining_ui__$UIOptions_HideNotifications; +com_davidmaletz_mining_ui__$UIOptions_HideNotifications.__name__ = ["com","davidmaletz","mining","ui","_UIOptions","HideNotifications"]; +com_davidmaletz_mining_ui__$UIOptions_HideNotifications.__super__ = com_davidmaletz_mining_ui_OptionValue; +com_davidmaletz_mining_ui__$UIOptions_HideNotifications.prototype = $extend(com_davidmaletz_mining_ui_OptionValue.prototype,{ + getOption: function() { + return com_davidmaletz_mining_ui_NotificationQueue.OPTIONS; + } + ,setOption: function(o) { + if(o < 0) { + o += 8; + } else if(o >= 8) { + o -= 8; + } + if(com_davidmaletz_mining_ui_NotificationQueue.OPTIONS != o) { + com_davidmaletz_mining_ui_NotificationQueue.OPTIONS = o; + Reflect.setField(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"notifications",o); + } + } + ,getSize: function() { + return 0.5; + } + ,optionToString: function(o) { + switch(o) { + case 0: + return com_fancyfish_faeng_common_Lang.getText("options","show_all"); + case 1: + return com_fancyfish_faeng_common_Lang.getText("options","hide_queue"); + case 2: + return com_fancyfish_faeng_common_Lang.getText("options","hide_element"); + case 3: + return com_fancyfish_faeng_common_Lang.getText("options","hide_queue_element"); + case 4: + return com_fancyfish_faeng_common_Lang.getText("options","hide_critical"); + case 5: + return com_fancyfish_faeng_common_Lang.getText("options","hide_queue_critical"); + case 6: + return com_fancyfish_faeng_common_Lang.getText("options","hide_element_critical"); + case 7: + return com_fancyfish_faeng_common_Lang.getText("options","hide_queue_element_critical"); + default: + return null; + } + } + ,__class__: com_davidmaletz_mining_ui__$UIOptions_HideNotifications +}); +var com_davidmaletz_mining_ui__$UIOptions_AwayNotifications = function() { + com_davidmaletz_mining_ui_BoolValue.call(this,"notify_away"); +}; +$hxClasses["com.davidmaletz.mining.ui._UIOptions.AwayNotifications"] = com_davidmaletz_mining_ui__$UIOptions_AwayNotifications; +com_davidmaletz_mining_ui__$UIOptions_AwayNotifications.__name__ = ["com","davidmaletz","mining","ui","_UIOptions","AwayNotifications"]; +com_davidmaletz_mining_ui__$UIOptions_AwayNotifications.__super__ = com_davidmaletz_mining_ui_BoolValue; +com_davidmaletz_mining_ui__$UIOptions_AwayNotifications.prototype = $extend(com_davidmaletz_mining_ui_BoolValue.prototype,{ + getValue: function() { + return com_davidmaletz_mining_npc_NPC.NOTIFY_AWAY; + } + ,setValue: function(val) { + com_davidmaletz_mining_npc_NPC.NOTIFY_AWAY = val; + Reflect.setField(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"notify_away",val); + } + ,__class__: com_davidmaletz_mining_ui__$UIOptions_AwayNotifications +}); +var com_davidmaletz_mining_ui__$UIOptions_BlueprintAll = function() { + com_davidmaletz_mining_ui_BoolValue.call(this,"blueprint_all"); +}; +$hxClasses["com.davidmaletz.mining.ui._UIOptions.BlueprintAll"] = com_davidmaletz_mining_ui__$UIOptions_BlueprintAll; +com_davidmaletz_mining_ui__$UIOptions_BlueprintAll.__name__ = ["com","davidmaletz","mining","ui","_UIOptions","BlueprintAll"]; +com_davidmaletz_mining_ui__$UIOptions_BlueprintAll.__super__ = com_davidmaletz_mining_ui_BoolValue; +com_davidmaletz_mining_ui__$UIOptions_BlueprintAll.prototype = $extend(com_davidmaletz_mining_ui_BoolValue.prototype,{ + getValue: function() { + return com_davidmaletz_mining_ui_InventoryList.BLUEPRINT_ALL; + } + ,setValue: function(val) { + com_davidmaletz_mining_ui_InventoryList.BLUEPRINT_ALL = val; + Reflect.setField(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"blueprint_all",val); + } + ,__class__: com_davidmaletz_mining_ui__$UIOptions_BlueprintAll +}); +var com_davidmaletz_mining_ui__$UIOptions_MoveAll = function() { + com_davidmaletz_mining_ui_BoolValue.call(this,"move_all"); +}; +$hxClasses["com.davidmaletz.mining.ui._UIOptions.MoveAll"] = com_davidmaletz_mining_ui__$UIOptions_MoveAll; +com_davidmaletz_mining_ui__$UIOptions_MoveAll.__name__ = ["com","davidmaletz","mining","ui","_UIOptions","MoveAll"]; +com_davidmaletz_mining_ui__$UIOptions_MoveAll.__super__ = com_davidmaletz_mining_ui_BoolValue; +com_davidmaletz_mining_ui__$UIOptions_MoveAll.prototype = $extend(com_davidmaletz_mining_ui_BoolValue.prototype,{ + getValue: function() { + return com_davidmaletz_mining_Player.MOVE_ALL; + } + ,setValue: function(val) { + com_davidmaletz_mining_Player.setMoveAll(val); + } + ,__class__: com_davidmaletz_mining_ui__$UIOptions_MoveAll +}); +var com_davidmaletz_mining_ui__$UIOptions_WarnToss = function() { + com_davidmaletz_mining_ui_BoolValue.call(this,"warn_toss"); +}; +$hxClasses["com.davidmaletz.mining.ui._UIOptions.WarnToss"] = com_davidmaletz_mining_ui__$UIOptions_WarnToss; +com_davidmaletz_mining_ui__$UIOptions_WarnToss.__name__ = ["com","davidmaletz","mining","ui","_UIOptions","WarnToss"]; +com_davidmaletz_mining_ui__$UIOptions_WarnToss.__super__ = com_davidmaletz_mining_ui_BoolValue; +com_davidmaletz_mining_ui__$UIOptions_WarnToss.prototype = $extend(com_davidmaletz_mining_ui_BoolValue.prototype,{ + getValue: function() { + return com_davidmaletz_mining_Player.WARN_TOSS; + } + ,setValue: function(val) { + com_davidmaletz_mining_Player.setWarnToss(val); + } + ,__class__: com_davidmaletz_mining_ui__$UIOptions_WarnToss +}); +var com_davidmaletz_mining_ui_ItemDiscover = function() { + com_davidmaletz_mining_ui_BoolValue.call(this,"item_discover"); +}; +$hxClasses["com.davidmaletz.mining.ui.ItemDiscover"] = com_davidmaletz_mining_ui_ItemDiscover; +com_davidmaletz_mining_ui_ItemDiscover.__name__ = ["com","davidmaletz","mining","ui","ItemDiscover"]; +com_davidmaletz_mining_ui_ItemDiscover.__super__ = com_davidmaletz_mining_ui_BoolValue; +com_davidmaletz_mining_ui_ItemDiscover.prototype = $extend(com_davidmaletz_mining_ui_BoolValue.prototype,{ + getValue: function() { + return com_davidmaletz_mining_Player.ITEM_DISCOVER; + } + ,setValue: function(val) { + com_davidmaletz_mining_Player.setItemDiscover(val); + } + ,__class__: com_davidmaletz_mining_ui_ItemDiscover +}); +var com_davidmaletz_mining_ui__$UIOptions_PromptCount = function() { + com_davidmaletz_mining_ui_BoolValue.call(this,"prompt_count"); +}; +$hxClasses["com.davidmaletz.mining.ui._UIOptions.PromptCount"] = com_davidmaletz_mining_ui__$UIOptions_PromptCount; +com_davidmaletz_mining_ui__$UIOptions_PromptCount.__name__ = ["com","davidmaletz","mining","ui","_UIOptions","PromptCount"]; +com_davidmaletz_mining_ui__$UIOptions_PromptCount.__super__ = com_davidmaletz_mining_ui_BoolValue; +com_davidmaletz_mining_ui__$UIOptions_PromptCount.prototype = $extend(com_davidmaletz_mining_ui_BoolValue.prototype,{ + getValue: function() { + return !com_davidmaletz_mining_Main.NO_COUNT; + } + ,setValue: function(val) { + com_davidmaletz_mining_Main.NO_COUNT = !val; + Reflect.setField(com_davidmaletz_faengfl_adv_AdvApp.settings.data,"no_count",com_davidmaletz_mining_Main.NO_COUNT); + } + ,__class__: com_davidmaletz_mining_ui__$UIOptions_PromptCount +}); +var com_davidmaletz_mining_ui__$UIOptions_FadeUI = function() { + com_davidmaletz_mining_ui_FloatValue.call(this,"fade_ui"); +}; +$hxClasses["com.davidmaletz.mining.ui._UIOptions.FadeUI"] = com_davidmaletz_mining_ui__$UIOptions_FadeUI; +com_davidmaletz_mining_ui__$UIOptions_FadeUI.__name__ = ["com","davidmaletz","mining","ui","_UIOptions","FadeUI"]; +com_davidmaletz_mining_ui__$UIOptions_FadeUI.__super__ = com_davidmaletz_mining_ui_FloatValue; +com_davidmaletz_mining_ui__$UIOptions_FadeUI.prototype = $extend(com_davidmaletz_mining_ui_FloatValue.prototype,{ + getValue: function() { + return com_davidmaletz_mining_ui_GUI.FADE; + } + ,setValue: function(val) { + com_davidmaletz_mining_ui_GUI.setFade(val); + } + ,__class__: com_davidmaletz_mining_ui__$UIOptions_FadeUI +}); +var com_davidmaletz_mining_ui_UIOptions = function(c) { + var len = com_davidmaletz_mining_ui_UIOptions.ITEMS.length; + com_davidmaletz_controls_ListWindow.call(this,c,com_davidmaletz_mining_Main.window_factory,new com_davidmaletz_mining_ui_OptionRenderer(this),len,1,true,true,false,0,0.5,8); + this.set_x(3); + com_davidmaletz_mining_ui_InventoryWindow.addLabel(this,com_fancyfish_faeng_common_Lang.getText("options","ui"),this.getWidth(),0,120); + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + this.addItem(com_davidmaletz_mining_ui_UIOptions.ITEMS[i]); + } + this.details = new com_davidmaletz_mining_ui_details_StringDetails(70); + this.details.set_x(250 - this.details.getWidth()); + this.addChild(this.details); +}; +$hxClasses["com.davidmaletz.mining.ui.UIOptions"] = com_davidmaletz_mining_ui_UIOptions; +com_davidmaletz_mining_ui_UIOptions.__name__ = ["com","davidmaletz","mining","ui","UIOptions"]; +com_davidmaletz_mining_ui_UIOptions.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui_UIOptions.__super__ = com_davidmaletz_controls_ListWindow; +com_davidmaletz_mining_ui_UIOptions.prototype = $extend(com_davidmaletz_controls_ListWindow.prototype,{ + details: null + ,init: function(e) { + com_davidmaletz_controls_ListWindow.prototype.init.call(this,e); + com_davidmaletz_controls_Controller.instance.addEventListener("tap",$bind(this,this.tap),false,com_davidmaletz_faengfl_Window.window_ct + 1); + } + ,destroy: function(e) { + com_davidmaletz_controls_ListWindow.prototype.destroy.call(this,e); + com_davidmaletz_controls_Controller.instance.removeEventListener("tap",$bind(this,this.tap)); + if(e != null) { + com_davidmaletz_faengfl_adv_AdvApp.settings.flush(); + } + } + ,tap: function(e) { + var left = e.key == "left"; + var right = e.key == "right"; + var sel = this.clickables.getSelected(); + if((left || right) && Std["is"](sel,com_davidmaletz_mining_ui_AdjustOption)) { + var a = js_Boot.__cast(sel , com_davidmaletz_mining_ui_AdjustOption); + if(left) { + if(a.prevValue()) { + com_davidmaletz_faengfl_adv_sound_Sound.play("move"); + } + } else if(a.nextValue()) { + com_davidmaletz_faengfl_adv_sound_Sound.play("move"); + } + e.stopImmediatePropagation(); + } + } + ,onSelect: function(str) { + if(str == "back") { + this.close(); + } + } + ,onHover: function(item) { + var i = null; + if(item != null && com_fancyfish_faeng_common_Lang.hasText("option.descriptions",item)) { + i = com_fancyfish_faeng_common_Lang.getText("option.descriptions",item).get(); + } + this.details.setInfo(i,0.5); + this.details.set_y(Math.round((this.getHeight() - this.details.getHeight()) * 0.5)); + } + ,isEnabled: function(item) { + return true; + } + ,__class__: com_davidmaletz_mining_ui_UIOptions +}); +var com_davidmaletz_mining_ui_UncraftWindow = function(p,c,inv,title,func,include) { + this.recipes = new haxe_ds_StringMap(); + var r = com_davidmaletz_mining_item_Recipe.getAll(); + while(r.hasNext()) { + var r1 = r.next(); + if(r1.creates != null && r1.numRequirements() > 0 && !this.recipes.exists(r1.creates.item.id) && r1.creates.count == 1 && include(r1)) { + this.recipes.set(r1.creates.item.id,r1); + } + } + com_davidmaletz_mining_ui_TabbedItemList.call(this,p,c,false,0.2,0.5,title,$bind(this,this.isRecipe),inv); + this.handleRecipe = func; + this.additional = $bind(this,this.showAdditional); +}; +$hxClasses["com.davidmaletz.mining.ui.UncraftWindow"] = com_davidmaletz_mining_ui_UncraftWindow; +com_davidmaletz_mining_ui_UncraftWindow.__name__ = ["com","davidmaletz","mining","ui","UncraftWindow"]; +com_davidmaletz_mining_ui_UncraftWindow.__super__ = com_davidmaletz_mining_ui_TabbedItemList; +com_davidmaletz_mining_ui_UncraftWindow.prototype = $extend(com_davidmaletz_mining_ui_TabbedItemList.prototype,{ + recipes: null + ,handleRecipe: null + ,includeCost: function() { + return false; + } + ,isRecipe: function(i) { + return this.recipes.exists(i.id); + } + ,onSelect: function(i) { + if(i != null && this.recipes.exists(i.item.id)) { + var r = this.recipes.get(i.item.id); + if(com_davidmaletz_mining_Main.NO_COUNT || com_davidmaletz_faengfl_adv_AdvApp.shiftDown) { + this.doUncraft(i,r,1); + } else { + var c = com_davidmaletz_mining_Main.getContainer(); + var f = $bind(this,this.doUncraft); + var i1 = i; + var r1 = r; + var tmp = function(ct) { + f(i1,r1,ct); + }; + c.addDisplay(new com_davidmaletz_mining_ui_ItemCountPrompt(c,i,i.count,com_fancyfish_faeng_common_Lang.getText("common","uncraft"),1,tmp),2); + } + } + } + ,doUncraft: function(i,r,ct) { + if(i.inventory.addItems(i.item,-ct,i.value,i.name)) { + if(this.handleRecipe == null) { + i.inventory.addIngredients(r,ct); + } else { + this.handleRecipe(r,ct); + } + } + } + ,showAdditional: function(i,s,w,x,y) { + var r = this.recipes.get(i.id); + if(r == null) { + return y; + } + var t = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("common","requires"),new com_fancyfish_faeng_text_CharacterPlacer(w,1),153,1); + t.set_y(y); + s.addChild(t); + y += t.lineHeight(); + var i1 = r.getRequirements(); + while(i1.hasNext()) { + var i2 = i1.next(); + com_davidmaletz_mining_ui_ItemRenderer.addItem(s,i2,x,y); + if(i2.count > 0) { + t = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Static(i2.count == null ? "null" : "" + i2.count),new com_fancyfish_faeng_text_CharacterPlacer(w,2),0,1); + t.set_x(x); + t.set_y(y); + s.addChild(t); + } + y += t.lineHeight(); + } + return y; + } + ,__class__: com_davidmaletz_mining_ui_UncraftWindow +}); +var com_davidmaletz_mining_ui_VehicleEquipment = function(v,object,c) { + this.vehicle = v; + com_davidmaletz_mining_ui_EquipmentWindow.call(this,object,c,v.getTitle(object.getOwner())); + var info = v.getInfo(); + this.inventory = object == v ? v.fullInventory : object.getOwner().storehouseInventory; + var ren = v.info.xml.get("allowRename"); + if(ren == "true" || v.hasName() && ren != "false") { + this.list.addMixedItem(null,new com_davidmaletz_mining_ui__$VehicleEquipment_RenameRenderer(this)); + } + var i = info.xml.elementPathsNamed("listItem"); + if(i.hasNext()) { + com_davidmaletz_mining_ui_CraftingList.addAdditional(this.list,this.details,80,i,v); + } + var iter = info.getRepairItems(); + if(iter.hasNext()) { + var r = new com_davidmaletz_mining_ui_RepairRenderer(this.details,v,this.inventory); + var i1 = iter; + while(i1.hasNext()) { + var i2 = i1.next(); + this.list.addMixedItem(i2,r); + } + } + if(v.isPowered()) { + this.list.addMixedItem(null,new com_davidmaletz_mining_ui_BatteryRenderer(this)); + } else { + var h = new com_davidmaletz_mining_ui__$VehicleEquipment_FuelHandler(this,v.fuelName); + var r1 = new com_davidmaletz_mining_ui_RecipeRenderer(h,this.inventory,v.fuelName,null,80); + h.renderer = r1; + var p = object.getOwner(); + if(p != null) { + var recipe = com_davidmaletz_mining_ui_CraftingWindow.getRecipes(p,v.info.xml); + while(recipe.hasNext()) { + var recipe1 = recipe.next(); + this.list.addMixedItem(recipe1,r1); + } + } + var e = info.getFuelItems(); + while(e.hasNext()) { + var e1 = e.next(); + this.list.addMixedItem(e1,r1); + } + } +}; +$hxClasses["com.davidmaletz.mining.ui.VehicleEquipment"] = com_davidmaletz_mining_ui_VehicleEquipment; +com_davidmaletz_mining_ui_VehicleEquipment.__name__ = ["com","davidmaletz","mining","ui","VehicleEquipment"]; +com_davidmaletz_mining_ui_VehicleEquipment.__super__ = com_davidmaletz_mining_ui_EquipmentWindow; +com_davidmaletz_mining_ui_VehicleEquipment.prototype = $extend(com_davidmaletz_mining_ui_EquipmentWindow.prototype,{ + vehicle: null + ,inventory: null + ,init: function(e) { + com_davidmaletz_mining_ui_EquipmentWindow.prototype.init.call(this,e); + this.vehicle.addEventListener("change_label",$bind(this,this.change_label)); + } + ,destroy: function(e) { + com_davidmaletz_mining_ui_EquipmentWindow.prototype.destroy.call(this,e); + this.vehicle.removeEventListener("change_label",$bind(this,this.change_label)); + } + ,change_label: function(e) { + (js_Boot.__cast(this.title.getChildAt(this.title.get_numChildren() - 1) , com_davidmaletz_faengfl_TextSprite)).setText(this.vehicle.getTitle(this.object.getOwner())); + } + ,rename: function() { + var c = com_davidmaletz_mining_Main.getContainer(); + var map = new haxe_ds_StringMap(); + map.set("{item}",this.vehicle.info.getDisplay()); + var m = new com_fancyfish_faeng_common_mutable_MutableTemplateStatic(com_fancyfish_faeng_common_Lang.getText("common","rename"),map); + c.addDisplay(new com_davidmaletz_mining_ui_TextInput(c,m,$bind(this,this.renameVehicle),this.vehicle.getName(),20,120),2); + } + ,renameVehicle: function(str) { + if(str == null || str.length == 0) { + return; + } + this.vehicle.set_name((this.vehicle.name == null ? "&" : HxOverrides.substr(this.vehicle.name,0,this.vehicle.name.indexOf("&") + 1)) + str); + } + ,addInfo: function(width) { + var e = new com_davidmaletz_mining_ui_VehiclePanel(this.vehicle,this.getInfoWidth() + 8,Math.round(this.getHeight() - 3)); + e.set_x(width - 1); + this.addChild(e); + var WIDTH = 106; + var equip = new com_davidmaletz_mining_ui_TextButton(this.getWidth(),this.getHeight() + 1,com_fancyfish_faeng_common_Lang.getText("vehicle","manage_player"),$bind(this,this.showEquipment),WIDTH); + this.addChild(equip); + this.clickables.addClickable(equip,this); + var dx = 3 + WIDTH; + var _g = equip; + _g.set_x(_g.get_x() - dx); + equip.getPos().x -= dx; + } + ,_showInventory: function() { + this.vehicle.manageInventory(this.object.getOwner()); + } + ,_showEquipment: function() { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_PlayerEquipment(this.object.getOwner(),c),2); + } + ,showEquipment: function() { + this.onClose = $bind(this,this._showEquipment); + this.close(); + } + ,getVehicle: function() { + return this.vehicle; + } + ,filterBattery: function(i) { + return i.xml.get("storage") == "power"; + } + ,addBatteries: function() { + var v = this.getVehicle(); + var max_fuel = v.getMaxFuel(); + var found = false; + var ar = [v.inventory]; + if(v.getOwner() != null) { + ar.push(v.getOwner().inventory); + } + var _g = 0; + while(_g < ar.length) { + var inventory = ar[_g]; + ++_g; + var i = inventory.getItems($bind(this,this.filterBattery)); + while(i.hasNext()) { + var i1 = i.next(); + var dur = i1.item.getDurability(); + var val = i1.getItemValues(); + while(val.hasNext()) { + var val1 = val.next(); + if(val1.count > 0 && val1.value < dur) { + var f = dur - val1.value; + var ct = com_fancyfish_faeng_common_Utils.min(val1.count,Math.ceil((max_fuel - v.getFuel()) / f)); + if(inventory.addItems(val1.item,-ct,val1.value,val1.name)) { + f *= ct; + if(v.getFuel() + f > max_fuel) { + if(ct > 1) { + inventory.addItems(val1.item,ct - 1,dur,val1.name); + } + inventory.addItems(val1.item,1,dur - (f + v.getFuel() - max_fuel),val1.name); + } else { + inventory.addItems(val1.item,ct,dur,val1.name); + } + v.addFuel(f); + found = true; + if(v.getFuel() >= max_fuel) { + return; + } + } + } + } + } + } + if(!found) { + v.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","power")); + } + } + ,__class__: com_davidmaletz_mining_ui_VehicleEquipment +}); +var com_davidmaletz_mining_ui__$VehicleEquipment_FuelHandler = function(eq,fuel) { + this.equipment = eq; + this.fuelName = fuel; +}; +$hxClasses["com.davidmaletz.mining.ui._VehicleEquipment.FuelHandler"] = com_davidmaletz_mining_ui__$VehicleEquipment_FuelHandler; +com_davidmaletz_mining_ui__$VehicleEquipment_FuelHandler.__name__ = ["com","davidmaletz","mining","ui","_VehicleEquipment","FuelHandler"]; +com_davidmaletz_mining_ui__$VehicleEquipment_FuelHandler.__interfaces__ = [com_davidmaletz_controls_ItemHandler]; +com_davidmaletz_mining_ui__$VehicleEquipment_FuelHandler.prototype = { + equipment: null + ,fuelName: null + ,renderer: null + ,onSelect: function(item) { + if(item.creates != null) { + com_davidmaletz_mining_ui_CraftingWindow.craft($bind(this,this.onCraft),this.equipment.inventory,item); + } else { + com_davidmaletz_mining_ui_FuelWindow.addFuel(this.equipment.getVehicle(),this.equipment.inventory,item,this.fuelName,$bind(this,this.fuelAdded)); + } + } + ,onCraft: function(inv,recipe,ct) { + this.fuelAdded(recipe,ct); + } + ,fuelAdded: function(recipe,ct) { + var l = this.equipment.list.getList(); + var len = l.get_numChildren(); + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + this.renderer.update(l.getChildAt(i),null); + } + this.equipment.details.setInfo(null); + this.onHover(recipe); + } + ,onHover: function(recipe) { + var details = this.equipment.details; + details.setRecipe(recipe,this.equipment.inventory,this.equipment.getVehicle().fuelName); + details.set_y(Math.round((this.equipment.getHeight() - details.getHeight()) * 0.5)); + } + ,isEnabled: function(recipe) { + return true; + } + ,__class__: com_davidmaletz_mining_ui__$VehicleEquipment_FuelHandler +}; +var com_davidmaletz_mining_ui_BatteryRenderer = function(handler) { + this.handler = handler; +}; +$hxClasses["com.davidmaletz.mining.ui.BatteryRenderer"] = com_davidmaletz_mining_ui_BatteryRenderer; +com_davidmaletz_mining_ui_BatteryRenderer.__name__ = ["com","davidmaletz","mining","ui","BatteryRenderer"]; +com_davidmaletz_mining_ui_BatteryRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui_BatteryRenderer.prototype = { + handler: null + ,create: function(item,x,y) { + return new com_davidmaletz_mining_ui__$VehicleEquipment_ListButton(this.handler,x,y,this.getHeight(item)); + } + ,update: function(s,item) { + } + ,getWidth: function() { + return 80; + } + ,getHeight: function(item) { + return com_fancyfish_faeng_text_FontManager.lineHeight(); + } + ,__class__: com_davidmaletz_mining_ui_BatteryRenderer +}; +var com_davidmaletz_mining_ui__$VehicleEquipment_ListButton = function(handler,x,y,h) { + com_davidmaletz_controls_Button.call(this,x,y,com_davidmaletz_mining_Main.label_factory.createBG(80,h),com_davidmaletz_mining_Main.label_factory.createHover(80,h),null); + this.handler = handler; + com_davidmaletz_mining_ui_ItemRenderer.addItem(this,this,2); +}; +$hxClasses["com.davidmaletz.mining.ui._VehicleEquipment.ListButton"] = com_davidmaletz_mining_ui__$VehicleEquipment_ListButton; +com_davidmaletz_mining_ui__$VehicleEquipment_ListButton.__name__ = ["com","davidmaletz","mining","ui","_VehicleEquipment","ListButton"]; +com_davidmaletz_mining_ui__$VehicleEquipment_ListButton.__interfaces__ = [com_davidmaletz_mining_ui_Iconable,AbstractClass]; +com_davidmaletz_mining_ui__$VehicleEquipment_ListButton.__super__ = com_davidmaletz_controls_Button; +com_davidmaletz_mining_ui__$VehicleEquipment_ListButton.prototype = $extend(com_davidmaletz_controls_Button.prototype,{ + handler: null + ,onClick: function() { + this.handler.addBatteries(); + return true; + } + ,onHover: function(hover) { + com_davidmaletz_controls_Button.prototype.onHover.call(this,hover); + this.handler.onHover(null); + } + ,createIcon: function() { + return com_davidmaletz_mining_item_ItemInfo.get("battery").createIcon(); + } + ,getName: function() { + return com_fancyfish_faeng_common_Lang.getText("vehicle","battery"); + } + ,getElement: function() { + return null; + } + ,__class__: com_davidmaletz_mining_ui__$VehicleEquipment_ListButton +}); +var com_davidmaletz_mining_ui__$VehicleEquipment_RenameRenderer = function(handler) { + this.handler = handler; +}; +$hxClasses["com.davidmaletz.mining.ui._VehicleEquipment.RenameRenderer"] = com_davidmaletz_mining_ui__$VehicleEquipment_RenameRenderer; +com_davidmaletz_mining_ui__$VehicleEquipment_RenameRenderer.__name__ = ["com","davidmaletz","mining","ui","_VehicleEquipment","RenameRenderer"]; +com_davidmaletz_mining_ui__$VehicleEquipment_RenameRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui__$VehicleEquipment_RenameRenderer.prototype = { + handler: null + ,create: function(item,x,y) { + var w = 80; + var h = this.getHeight(item); + var b = new com_davidmaletz_controls_Button(x,y,com_davidmaletz_mining_Main.label_factory.createBG(w,h),com_davidmaletz_mining_Main.label_factory.createHover(w,h),com_fancyfish_faeng_common_Lang.getText("actions","rename")); + b.onClickFunc = ($_=this.handler,$bind($_,$_.rename)); + return b; + } + ,update: function(s,item) { + } + ,getWidth: function() { + return 80; + } + ,getHeight: function(item) { + return com_fancyfish_faeng_text_FontManager.lineHeight(); + } + ,__class__: com_davidmaletz_mining_ui__$VehicleEquipment_RenameRenderer +}; +var com_davidmaletz_mining_ui_VehicleGUI = function(p,v) { + com_davidmaletz_mining_ui_GUI.call(this,p); + this.vehicle = v; +}; +$hxClasses["com.davidmaletz.mining.ui.VehicleGUI"] = com_davidmaletz_mining_ui_VehicleGUI; +com_davidmaletz_mining_ui_VehicleGUI.__name__ = ["com","davidmaletz","mining","ui","VehicleGUI"]; +com_davidmaletz_mining_ui_VehicleGUI.__super__ = com_davidmaletz_mining_ui_GUI; +com_davidmaletz_mining_ui_VehicleGUI.prototype = $extend(com_davidmaletz_mining_ui_GUI.prototype,{ + vehicle: null + ,bars: null + ,projectiles: null + ,equipb: null + ,_init: function(eqicon) { + var c = com_davidmaletz_mining_Main.getContainer(); + var y = c.getHeight() - 8; + com_davidmaletz_mining_ui_GUI.prototype._init.call(this,com_davidmaletz_tiles_Tile._get(this.vehicle.info.getDisplayTile())); + if(this.includeBars()) { + this.bars = new com_davidmaletz_mining_ui_Bars(c); + this.addDisplay(this.bars,2); + if(this.vehicle.getMaxHealth() > 0) { + this.bars.addBar(new com_davidmaletz_mining_ui_VehicleHealthBar(this.vehicle)); + } + var vo = Std["is"](this.vehicle,com_davidmaletz_mining_world_IOxygen) && (js_Boot.__cast(this.vehicle , com_davidmaletz_mining_world_IOxygen)).getMaxOxygen() > 0; + if(!this.vehicle.isDrone()) { + this.bars.addBar(vo ? new com_davidmaletz_mining_ui_DualO2Bar(this.vehicle,this.player) : new com_davidmaletz_mining_ui_OxygenBar(this.player,this.bars)); + } + if(this.vehicle.info.xml.get("stamina") == "true") { + this.bars.addBar(new com_davidmaletz_mining_ui_HealthBar(this.player)); + this.bars.addBar(new com_davidmaletz_mining_ui_StaminaBar(this.player)); + } else { + if(!this.vehicle.isDrone()) { + if(vo) { + this.bars.addBar(new com_davidmaletz_mining_ui_HealthBar(this.player)); + } else { + this.bars.addBar(new com_davidmaletz_mining_ui_O2HealthBar(this.player,this.bars)); + } + } + if(this.vehicle.getMaxFuel() > 0) { + this.bars.addBar(new com_davidmaletz_mining_ui_FuelBar(this.vehicle)); + } + } + this.bars.set_alpha(0.8); + if(com_davidmaletz_mining_Main.TOUCHSCREEN) { + this.rotateBars(this.bars); + } + } + if(this.vehicle.equipment.get("attack") != null && this.includeProjectiles()) { + if(this.projectiles == null) { + this.projectiles = new com_davidmaletz_mining_ui_Projectiles(this.vehicle,c,3,"attack"); + } + this.addDisplay(this.projectiles,2); + } + if(this.includeEquipB()) { + if(this.equipb == null) { + this.equipb = []; + if(this.vehicle.equipment.get("attack") != null) { + this.equipb.push(new com_davidmaletz_mining_ui_EquipmentButton(this.player,"attack","attack",this.equipb.length + 1,this.vehicle)); + } else if(this.vehicle.getInfo().attacks.length > 0) { + var t = com_davidmaletz_tiles_Tile._get(this.vehicle.info.xml.get("attack_icon")); + if(t != null) { + var b = new com_davidmaletz_mining_ui_EquipmentButton(this.player,null,"attack",this.equipb.length + 1); + this.getAttack(b,true); + b.setIcon(t,this.vehicle.info.xml.get("attack_icon_anim")); + this.equipb.push(b); + } else { + var t1 = com_davidmaletz_tiles_Tile._get(this.vehicle.info.getDisplayTile()); + if(t1 != null) { + var b1 = new com_davidmaletz_mining_ui_EquipmentButton(this.player,null,"attack",this.equipb.length + 1); + this.getAttack(b1,true); + b1.setIcon(t1); + this.equipb.push(b1); + } + } + } + if(this.vehicle.equipment.get("defend") != null) { + this.equipb.push(new com_davidmaletz_mining_ui_EquipmentButton(this.player,"defend","defend",this.equipb.length + 1,this.vehicle)); + } else { + var t2 = com_davidmaletz_tiles_Tile.get(this.vehicle.getInfo().block_icon); + if(t2 != null) { + var b2 = new com_davidmaletz_mining_ui_EquipmentButton(this.player,null,"defend",this.equipb.length + 1); + this.getAttack(b2,false); + b2.setIcon(t2); + this.equipb.push(b2); + } + } + } + var _g = 0; + var _g1 = this.equipb; + while(_g < _g1.length) { + var e = _g1[_g]; + ++_g; + this.addDisplay(e,2); + } + } + if(this.player.gui != null && this.player.gui.clock != null && this.include("clock")) { + this._addDisplay(this.player.gui.clock,2); + } + } + ,getAttack: function(b,attackKey) { + var r = this.vehicle.renderer; + if(r == null) { + return; + } + var ct = 0; + var _g = 0; + var _g1 = this.vehicle.getInfo().attacks; + while(_g < _g1.length) { + var a = _g1[_g]; + ++_g; + if(attackKey != (a.xml != null && a.xml.get("useDefend") == "true") && a.cooldown > 0) { + var hits = a.xml != null && a.xml.exists("hits") ? com_davidmaletz_mining_Main.parseInt(a.xml.get("hits")) : 1; + var bar = new com_davidmaletz_mining_ui__$VehicleGUI_ValueBar(r,ct,Math.ceil(a.cooldown * hits)); + bar.set_x(16); + bar.set_y(31); + b.addChild(bar); + return; + } else { + ++ct; + } + } + } + ,include: function(id) { + var e = this.vehicle.info.xml.elementsNamed("gui"); + while(e.hasNext()) { + var e1 = e.next(); + var s = e1.get(id); + if(s == "false" || s != "true" && e1.get("hideAll") == "true") { + return false; + } + } + return true; + } + ,useHotkey: function(hotkey) { + var a = this.vehicle.getAbility(hotkey); + var item; + if(a == null) { + var ar = this.player.getHotkey(hotkey); + if(ar != null && ar.length == 1) { + var i = ar[0]; + if(Std["is"](i.info,com_davidmaletz_mining_item_Equipment) && (js_Boot.__cast(i.info , com_davidmaletz_mining_item_Equipment)).equipOn.exists(this.vehicle.getId()) && this.vehicle.equipment.canEquip(this.vehicle,i.info.xml.get("slot"),i.info)) { + item = this.vehicle.fullInventory.selectMaxValue(i.info,i.getNameStr()); + if(item != null) { + var old = this.vehicle.equipment.getItem(item.info.xml.get("slot")); + this.vehicle.equipment.equip(item,this.vehicle,false); + if(old != null && com_davidmaletz_mining_Player.HOTKEY_SWITCH) { + this.player.setHotkey(hotkey,old); + } + return; + } + } + } + com_davidmaletz_mining_ui_GUI.prototype.useHotkey.call(this,hotkey); + } else { + a.run(this.player,this.vehicle); + } + } + ,makeHotkey: function(key) { + var a = this.vehicle.getAbility(key); + if(a == null) { + return com_davidmaletz_mining_ui_GUI.prototype.makeHotkey.call(this,key); + } else { + var ret = new com_davidmaletz_mining_ui_IconButton(this.player,"hotkey" + (key + 1),a.icon,a.animation); + ret.set_x(240 + (key % 4 - 4) * 22); + if(key >= 4) { + var _g = ret; + _g.set_y(_g.get_y() - 16); + } + if(com_davidmaletz_mining_Main.TOUCHSCREEN) { + var _g1 = ret; + _g1.set_x(_g1.get_x() - (com_davidmaletz_tiles_Tile.SIZE + 66)); + } + return ret; + } + } + ,includeBars: function() { + return this.include("bars"); + } + ,includeProjectiles: function() { + return this.include("projectiles"); + } + ,includeEquipB: function() { + return this.include("equipButtons"); + } + ,includeIdentify: function() { + return this.include("identify"); + } + ,__class__: com_davidmaletz_mining_ui_VehicleGUI +}); +var com_davidmaletz_mining_ui__$VehicleGUI_ValueBar = function(v,a,max) { + com_davidmaletz_controls_ProgressBar.call(this,com_davidmaletz_tiles_Tile.SIZE,1,com_davidmaletz_mining_Main.PROGRESS_COL,0,false); + this.vehicle = v; + this.attack = a; + this.max = max; + this.set_visible(v.getCooldown(this.attack) > 0); + this.addEventListener("addedToStage",$bind(this,this.init)); + this.addEventListener("removedFromStage",$bind(this,this.destroy)); +}; +$hxClasses["com.davidmaletz.mining.ui._VehicleGUI.ValueBar"] = com_davidmaletz_mining_ui__$VehicleGUI_ValueBar; +com_davidmaletz_mining_ui__$VehicleGUI_ValueBar.__name__ = ["com","davidmaletz","mining","ui","_VehicleGUI","ValueBar"]; +com_davidmaletz_mining_ui__$VehicleGUI_ValueBar.__interfaces__ = [com_davidmaletz_faengfl_EnterFrameHandler]; +com_davidmaletz_mining_ui__$VehicleGUI_ValueBar.__super__ = com_davidmaletz_controls_ProgressBar; +com_davidmaletz_mining_ui__$VehicleGUI_ValueBar.prototype = $extend(com_davidmaletz_controls_ProgressBar.prototype,{ + vehicle: null + ,attack: null + ,max: null + ,init: function(e) { + this.destroy(null); + com_davidmaletz_faengfl_FaengFL.addEnterFrame(this); + this.enter_frame(0); + } + ,destroy: function(e) { + com_davidmaletz_faengfl_FaengFL.removeEnterFrame(this); + } + ,enter_frame: function(frames) { + var v = this.vehicle.getCooldown(this.attack); + if(v > this.max) { + v = this.max; + } + this.setProgress((this.max - v) / this.max); + this.set_visible(v > 0); + } + ,__class__: com_davidmaletz_mining_ui__$VehicleGUI_ValueBar +}); +var com_davidmaletz_mining_ui_O2HealthBar = function(o,s) { + com_davidmaletz_mining_ui_HealthBar.call(this,o); + if(s != null) { + this.status = s; + this.set_visible(o.getOxygenPercent() < 1); + } +}; +$hxClasses["com.davidmaletz.mining.ui.O2HealthBar"] = com_davidmaletz_mining_ui_O2HealthBar; +com_davidmaletz_mining_ui_O2HealthBar.__name__ = ["com","davidmaletz","mining","ui","O2HealthBar"]; +com_davidmaletz_mining_ui_O2HealthBar.__super__ = com_davidmaletz_mining_ui_HealthBar; +com_davidmaletz_mining_ui_O2HealthBar.prototype = $extend(com_davidmaletz_mining_ui_HealthBar.prototype,{ + status: null + ,init: function(e) { + com_davidmaletz_mining_ui_HealthBar.prototype.init.call(this,e); + this.object.addEventListener("change_oxygen",$bind(this,this.update2)); + this.update2(null); + } + ,destroy: function(e) { + com_davidmaletz_mining_ui_HealthBar.prototype.destroy.call(this,e); + this.object.removeEventListener("change_oxygen",$bind(this,this.update)); + } + ,update2: function(e) { + var p = (js_Boot.__cast(this.object , com_davidmaletz_mining_Player)).getOxygenPercent(); + if(this.status != null && this.get_visible() != p < 1) { + this.set_visible(p < 1); + this.status.updateVisible(this); + } + } + ,__class__: com_davidmaletz_mining_ui_O2HealthBar +}); +var com_davidmaletz_mining_ui_DualO2Bar = function(o1,o2) { + com_davidmaletz_mining_ui_OxygenBar.call(this,o1); + this.object2 = o2; + this.set_visible(true); +}; +$hxClasses["com.davidmaletz.mining.ui.DualO2Bar"] = com_davidmaletz_mining_ui_DualO2Bar; +com_davidmaletz_mining_ui_DualO2Bar.__name__ = ["com","davidmaletz","mining","ui","DualO2Bar"]; +com_davidmaletz_mining_ui_DualO2Bar.__super__ = com_davidmaletz_mining_ui_OxygenBar; +com_davidmaletz_mining_ui_DualO2Bar.prototype = $extend(com_davidmaletz_mining_ui_OxygenBar.prototype,{ + object2: null + ,init: function(e) { + com_davidmaletz_mining_ui_OxygenBar.prototype.init.call(this,e); + this.object2.addEventListener("change_oxygen",$bind(this,this.update)); + } + ,destroy: function(e) { + com_davidmaletz_mining_ui_OxygenBar.prototype.destroy.call(this,e); + this.object2.removeEventListener("change_oxygen",$bind(this,this.update)); + } + ,update: function(e) { + var p = (this.object.getOxygen() + this.object2.getOxygen()) / (this.object.getMaxOxygen() + this.object2.getMaxOxygen()); + this.setProgress(p,5); + } + ,__class__: com_davidmaletz_mining_ui_DualO2Bar +}); +var com_davidmaletz_mining_ui_VehicleHealthBar = function(o) { + var e = o.info.xml; + var t = "vehicle_health"; + var c = 26367; + if(e.exists("health_icon")) { + t = e.get("health_icon"); + } + if(e.exists("health_color")) { + c = com_davidmaletz_mining_Main.parseInt("0x" + e.get("health_color")); + } + com_davidmaletz_mining_ui_MyBar.call(this,t,50,3,c,o.getHealthPercent()); + this.object = o; + this.set_x(12); +}; +$hxClasses["com.davidmaletz.mining.ui.VehicleHealthBar"] = com_davidmaletz_mining_ui_VehicleHealthBar; +com_davidmaletz_mining_ui_VehicleHealthBar.__name__ = ["com","davidmaletz","mining","ui","VehicleHealthBar"]; +com_davidmaletz_mining_ui_VehicleHealthBar.__super__ = com_davidmaletz_mining_ui_MyBar; +com_davidmaletz_mining_ui_VehicleHealthBar.prototype = $extend(com_davidmaletz_mining_ui_MyBar.prototype,{ + object: null + ,init: function(e) { + com_davidmaletz_mining_ui_MyBar.prototype.init.call(this,e); + this.object.addEventListener("change_health",$bind(this,this.update)); + this.update(null); + } + ,destroy: function(e) { + com_davidmaletz_mining_ui_MyBar.prototype.destroy.call(this,e); + this.object.removeEventListener("change_health",$bind(this,this.update)); + } + ,update: function(e) { + var p = this.object.getHealthPercent(); + this.setProgress(p,5); + } + ,__class__: com_davidmaletz_mining_ui_VehicleHealthBar +}); +var com_davidmaletz_mining_ui_VehicleInventory = function(p,v,c) { + var s = com_davidmaletz_mining_ui_VehicleInventory.getStorehouse(p,v); + com_davidmaletz_mining_ui_ToggleTransferInventory.call(this,p,v.inventory,v.getTitle(p),c,v.getInfo().max_weight,s == null ? null : s.area,v.getAddWeight(p)); + this.vehicle = v; + if(s == null) { + var x = this.getWidth(); + var inv = new com_davidmaletz_mining_ui_TextButton(x,this.getHeight() + 2,com_fancyfish_faeng_common_Lang.getText("vehicle","manage_items"),$bind(this,this.showInventory),90); + this.addChild(inv); + this.clickables.addClickable(inv,this); + x -= 4; + var _g = inv; + _g.set_x(_g.get_x() - x); + inv.getPos().x -= x; + } +}; +$hxClasses["com.davidmaletz.mining.ui.VehicleInventory"] = com_davidmaletz_mining_ui_VehicleInventory; +com_davidmaletz_mining_ui_VehicleInventory.__name__ = ["com","davidmaletz","mining","ui","VehicleInventory"]; +com_davidmaletz_mining_ui_VehicleInventory.getStorehouse = function(p,v) { + var s = v.area.getMainStorehouse(); + var va = v.area; + var accessStorehouse = s != null && v.canDismount() && !v.area.emptyTile(v.get_tile_x(),v.get_tile_y() + 1) && com_fancyfish_faeng_common_Utils.abs(s.get_tile_x() - v.get_tile_x()) < 100 && com_fancyfish_faeng_common_Utils.abs(s.get_tile_y() - v.get_tile_y()) < 24; + var ia; + var tmp; + if(!accessStorehouse) { + ia = v.area.getInterior(p); + tmp = ia != null; + } else { + tmp = false; + } + if(tmp) { + va = ia; + s = va.getMainStorehouse(); + accessStorehouse = s != null; + } + if(accessStorehouse) { + return { area : va, storehouse : s}; + } else { + return null; + } +}; +com_davidmaletz_mining_ui_VehicleInventory.__super__ = com_davidmaletz_mining_ui_ToggleTransferInventory; +com_davidmaletz_mining_ui_VehicleInventory.prototype = $extend(com_davidmaletz_mining_ui_ToggleTransferInventory.prototype,{ + vehicle: null + ,_showInventory: function() { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_InventoryWindow(this.player,c,$bind(this,this.showThis),com_fancyfish_faeng_common_Lang.getText("vehicle","vehicle")),2); + } + ,showThis: function() { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_VehicleInventory(this.player,this.vehicle,c),2); + } + ,showInventory: function() { + this.onClose = $bind(this,this._showInventory); + this.close(); + } + ,release: function(e) { + if(e.key == "equipment") { + var f = ($_=this.vehicle,$bind($_,$_.manageEquipment)); + var p = this.player; + this.onClose = function() { + f(p); + }; + this.close(); + } else { + com_davidmaletz_mining_ui_ToggleTransferInventory.prototype.release.call(this,e); + } + } + ,__class__: com_davidmaletz_mining_ui_VehicleInventory +}); +var com_davidmaletz_mining_ui_VehiclePanel = function(v,width,height) { + com_davidmaletz_faengfl_InitSprite.call(this); + this.vehicle = v; + var y = 3; + var info = this.vehicle.getInfo(); + var t = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("common","health"),new com_fancyfish_faeng_text_CharacterPlacer(0),0,1); + t.set_y(y); + t.set_x(13); + this.addChild(t); + var HT = t.lineHeight(); + var t1 = com_davidmaletz_mining_item_ItemInfo._createIcon(com_davidmaletz_tiles_Tile.get("vehicle_health")); + t1.set_x(3); + t1.set_y(y); + this.addChild(t1); + this.health = new com_fancyfish_faeng_common_mutable_Mutable(); + var w = width - 6 - com_davidmaletz_tiles_Tile.SIZE; + var t2 = new com_davidmaletz_faengfl_TextSprite(this.health,new com_fancyfish_faeng_text_CharacterPlacer(width - 3,2),0,1); + t2.set_y(y); + y += HT; + this.addChild(t2); + if(Std["is"](this.vehicle,com_davidmaletz_mining_world_IOxygen) && (js_Boot.__cast(this.vehicle , com_davidmaletz_mining_world_IOxygen)).getMaxOxygen() > 0) { + this.oxygen = new com_fancyfish_faeng_common_mutable_Mutable(); + var t3 = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Concat(com_fancyfish_faeng_common_Lang.getText("common","oxygen"),":"),new com_fancyfish_faeng_text_CharacterPlacer(0),0,1); + t3.set_y(y); + t3.set_x(13); + this.addChild(t3); + var t4 = com_davidmaletz_mining_item_ItemInfo._createIcon(com_davidmaletz_tiles_Tile.get("oxygen")); + t4.set_x(3); + t4.set_y(y); + this.addChild(t4); + var t5 = new com_davidmaletz_faengfl_TextSprite(this.oxygen,new com_fancyfish_faeng_text_CharacterPlacer(width - 6,2),0,1); + t5.set_y(y); + y += HT; + this.addChild(t5); + } + if(v.getMaxFuel() > 0) { + this.power = new com_fancyfish_faeng_common_mutable_Mutable(); + var t6 = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Concat(com_fancyfish_faeng_common_Lang.getText("common",v.fuelName),":"),new com_fancyfish_faeng_text_CharacterPlacer(0),0,1); + t6.set_y(y); + t6.set_x(13); + this.addChild(t6); + var t7 = com_davidmaletz_mining_item_ItemInfo._createIcon(com_davidmaletz_tiles_Tile.get("power")); + t7.set_x(3); + t7.set_y(y); + this.addChild(t7); + var t8 = new com_davidmaletz_faengfl_TextSprite(this.power,new com_fancyfish_faeng_text_CharacterPlacer(width - 3,2),0,1); + t8.set_y(y); + y += HT; + this.addChild(t8); + this.progress = com_davidmaletz_mining_ui_Fuel.createFuelBar(this.vehicle.getFuelPercent()); + this.progress.set_x((width - 60) * 0.5); + this.progress.set_y(y + 2); + this.addChild(this.progress); + y += 7; + } + var t9 = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Concat(com_fancyfish_faeng_common_Lang.getText("stats","attack"),":"),new com_fancyfish_faeng_text_CharacterPlacer(0),0,1); + t9.set_y(y); + t9.set_x(3); + this.addChild(t9); + this.weap = t9; + this.attack = new com_fancyfish_faeng_common_mutable_Mutable(); + this.attack_icon = new com_davidmaletz_faengfl_TileLayer(); + this.attack_icon.set_x(w + 3); + this.attack_icon.set_y(y); + this.addChild(this.attack_icon); + var t10 = new com_davidmaletz_faengfl_TextSprite(this.attack,new com_fancyfish_faeng_text_CharacterPlacer(w,2),0,1); + t10.set_y(y); + y += HT; + this.attack_text = t10; + this.addChild(t10); + var t11 = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Concat(com_fancyfish_faeng_common_Lang.getText("stats","defense"),":"),new com_fancyfish_faeng_text_CharacterPlacer(0),0,1); + t11.set_y(y); + t11.set_x(3); + this.addChild(t11); + this.defense = new com_fancyfish_faeng_common_mutable_Mutable(); + var defMod = com_davidmaletz_mining_item_Equipment.getAttr(com_davidmaletz_mining_item_ItemInfo.getMod(this.vehicle.name),"defense"); + this.defense.set(com_davidmaletz_mining_item_Equipment.toStr(info.minDefense(),defMod)); + var t12 = new com_davidmaletz_faengfl_TextSprite(this.defense,new com_fancyfish_faeng_text_CharacterPlacer(w,2),0,1); + t12.set_y(y); + y += HT; + this.addChild(t12); + com_davidmaletz_faengfl_TextSprite.setColor(t12,defMod == 0 ? 0 : defMod > 0 ? 19456 : 4980736); + if(this.vehicle.info.xml.get("type") == "mining" || this.vehicle.info.xml.get("showMine") == "true") { + var t13 = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Concat(com_fancyfish_faeng_common_Lang.getText("stats","mine"),":"),new com_fancyfish_faeng_text_CharacterPlacer(0),0,1); + t13.set_y(y); + t13.set_x(3); + this.addChild(t13); + var t14 = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Static(Std.string(this.vehicle.mine_power)),new com_fancyfish_faeng_text_CharacterPlacer(w,2),0,1); + t14.set_y(y); + y += HT; + this.addChild(t14); + } + var flight = info.flight_height; + if(flight != null) { + var t15 = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("common","flight"),new com_fancyfish_faeng_text_CharacterPlacer(0),0,1); + t15.set_y(y); + t15.set_x(3); + this.addChild(t15); + this.flight_height = new com_fancyfish_faeng_common_mutable_Mutable(); + this.flight_icon = new com_davidmaletz_faengfl_TileLayer(); + this.flight_icon.set_x(w + 3); + this.flight_icon.set_y(y); + this.addChild(this.flight_icon); + var t16 = new com_davidmaletz_faengfl_TextSprite(this.flight_height,new com_fancyfish_faeng_text_CharacterPlacer(w,2),0,1); + t16.set_y(y); + y += HT; + this.addChild(t16); + } + if(v.info.xml.get("underwater") == "true" || v.info.xml.get("type") == "submarine") { + var t17 = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("common","depth"),new com_fancyfish_faeng_text_CharacterPlacer(0),0,1); + t17.set_y(y); + t17.set_x(3); + this.addChild(t17); + this.max_depth = new com_fancyfish_faeng_common_mutable_Mutable(); + this.depth_icon = new com_davidmaletz_faengfl_TileLayer(); + this.depth_icon.set_x(w + 3); + this.depth_icon.set_y(y); + this.addChild(this.depth_icon); + var t18 = new com_davidmaletz_faengfl_TextSprite(this.max_depth,new com_fancyfish_faeng_text_CharacterPlacer(w,2),0,1); + t18.set_y(y); + y += HT; + this.addChild(t18); + } + var mod = com_davidmaletz_mining_item_ItemInfo.getModItem(v.name); + if(v.info.xml.get("allowModifier") == "true" && mod != null) { + var t19 = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("common","modifier"),new com_fancyfish_faeng_text_CharacterPlacer(0),0,0.5); + t19.set_y(y); + t19.set_x(3); + this.addChild(t19); + y += HT >> 1; + com_davidmaletz_mining_ui_ItemRenderer.addItem(this,mod,3,y); + y += HT; + } +}; +$hxClasses["com.davidmaletz.mining.ui.VehiclePanel"] = com_davidmaletz_mining_ui_VehiclePanel; +com_davidmaletz_mining_ui_VehiclePanel.__name__ = ["com","davidmaletz","mining","ui","VehiclePanel"]; +com_davidmaletz_mining_ui_VehiclePanel.setIcon = function(eq,name,l) { + com_davidmaletz_mining_ui_CharacterPanel.setIcon(eq,name,l); +}; +com_davidmaletz_mining_ui_VehiclePanel.__super__ = com_davidmaletz_faengfl_InitSprite; +com_davidmaletz_mining_ui_VehiclePanel.prototype = $extend(com_davidmaletz_faengfl_InitSprite.prototype,{ + vehicle: null + ,progress: null + ,attack_text: null + ,attack: null + ,defense: null + ,flight_height: null + ,max_depth: null + ,health: null + ,power: null + ,oxygen: null + ,weap: null + ,attack_icon: null + ,flight_icon: null + ,depth_icon: null + ,init: function(e) { + this.destroy(e); + var s = this.vehicle.equipment.get("attack"); + if(s != null) { + s.addEventListener("updated",$bind(this,this.updateEquipment)); + this.updateEquipment(null); + } else { + var atks = this.vehicle.getInfo().attacks; + if(atks == null || atks.length == 0) { + this.attack.set("-"); + } else { + var max = 0; + var _g = 0; + while(_g < atks.length) { + var a = atks[_g]; + ++_g; + if(a.damage > max) { + max = a.damage; + } + } + var mod = com_davidmaletz_mining_item_ItemInfo.getMod(this.vehicle.name); + var atk = com_davidmaletz_mining_item_Equipment.getAttr(mod,"attack"); + this.attack.set(com_davidmaletz_mining_item_Equipment.toStr(max,atk)); + com_davidmaletz_faengfl_TextSprite.setColor(this.attack_text,atk == 0 ? 0 : atk > 0 ? 19456 : 4980736); + var icon = com_davidmaletz_tiles_Tile._get(this.vehicle.info.xml.get("attack_icon")); + if(icon == null) { + icon = com_davidmaletz_tiles_Tile._get(this.vehicle.info.getDisplayTile()); + } + if(icon != null) { + this.attack_icon.start(); + icon.render(null,this.attack_icon,0,0); + this.attack_icon.finish(); + } + } + } + this.vehicle.addEventListener("change_health",$bind(this,this.updateHealth)); + this.updateHealth(null); + this.vehicle.addEventListener("update_fuel",$bind(this,this.updatePower)); + this.updatePower(null); + this.vehicle.addEventListener("change_oxygen",$bind(this,this.updateO2)); + this.updateO2(null); + if(this.flight_height != null) { + this.vehicle.flight_height.addEventListener("updated",$bind(this,this.updateFlightHeight)); + this.updateFlightHeight(null); + } + if(this.max_depth != null) { + this.vehicle.max_depth.addEventListener("updated",$bind(this,this.updateMaxDepth)); + this.updateMaxDepth(null); + } + } + ,destroy: function(e) { + var s = this.vehicle.equipment.get("attack"); + if(s != null) { + s.removeEventListener("updated",$bind(this,this.updateEquipment)); + } + this.vehicle.removeEventListener("change_health",$bind(this,this.updateHealth)); + this.vehicle.removeEventListener("update_fuel",$bind(this,this.updatePower)); + this.vehicle.removeEventListener("change_oxygen",$bind(this,this.updateO2)); + this.vehicle.flight_height.removeEventListener("updated",$bind(this,this.updateFlightHeight)); + this.vehicle.max_depth.removeEventListener("updated",$bind(this,this.updateMaxDepth)); + } + ,setEquip: function(val) { + this.attack.set(val == null ? "null" : "" + val); + } + ,setWeap: function(m) { + this.weap.setText(new com_fancyfish_faeng_common_mutable_Concat(m,":")); + } + ,updateEquipment: function(e) { + var e1 = this.vehicle.equipment.getItem("attack"); + var a = e1 != null && Std["is"](e1.info,com_davidmaletz_mining_item_Equipment) ? js_Boot.__cast(e1.info , com_davidmaletz_mining_item_Equipment) : null; + if(a != null && a.getAttack(e1.getNameStr()) > 0 && a.getAttack(e1.getNameStr()) >= a.getCut(e1.getNameStr())) { + this.setWeap(com_fancyfish_faeng_common_Lang.getText("stats","attack")); + this.setEquip(a.getAttack(e1.getNameStr())); + } else if(a != null && a.getCut(e1.getNameStr()) > 0) { + this.setWeap(com_fancyfish_faeng_common_Lang.getText("stats","cut")); + this.setEquip(a.getCut(e1.getNameStr())); + } else if(a != null && a.getFishing(e1.getNameStr()) > 0) { + this.setWeap(com_fancyfish_faeng_common_Lang.getText("stats","fishing")); + this.setEquip(a.getFishing(e1.getNameStr())); + } else if(a != null && a.getRange(e1.getNameStr()) > 0) { + this.setWeap(com_fancyfish_faeng_common_Lang.getText("stats","range")); + this.setEquip(a.getRange(e1.getNameStr())); + } else { + this.attack.set("-"); + } + com_davidmaletz_mining_ui_VehiclePanel.setIcon(a,e1 == null ? null : e1.getName(),this.attack_icon); + } + ,updateFlightHeight: function(e) { + var p = this.vehicle.flight_height.get(); + if(p == null) { + this.flight_height.set("-"); + com_davidmaletz_mining_ui_VehiclePanel.setIcon(null,null,this.flight_icon); + return; + } + this.flight_height.set(p.second == null ? "null" : "" + p.second); + com_davidmaletz_mining_ui_VehiclePanel.setIcon(com_davidmaletz_mining_item_ItemInfo.get(p.first),null,this.flight_icon); + } + ,updateMaxDepth: function(e) { + var p = this.vehicle.max_depth.get(); + if(p == null) { + this.max_depth.set("-"); + com_davidmaletz_mining_ui_VehiclePanel.setIcon(null,null,this.depth_icon); + return; + } + this.max_depth.set(p.second == null ? "null" : "" + p.second); + com_davidmaletz_mining_ui_VehiclePanel.setIcon(com_davidmaletz_mining_item_ItemInfo.get(p.first),null,this.depth_icon); + } + ,updateHealth: function(e) { + this.health.set(com_fancyfish_faeng_common_Utils.largeNumberFormat(this.vehicle.getHealth()) + "/" + com_fancyfish_faeng_common_Utils.largeNumberFormat(this.vehicle.getMaxHealth())); + } + ,updatePower: function(e) { + if(this.power != null) { + this.power.set(com_fancyfish_faeng_common_Utils.largeNumberFormat(this.vehicle.getFuel()) + "/" + com_fancyfish_faeng_common_Utils.largeNumberFormat(this.vehicle.getMaxFuel())); + } + if(this.progress != null) { + this.progress.setProgress(this.vehicle.getFuelPercent(),5); + } + } + ,updateO2: function(e) { + if(this.oxygen != null) { + var o = js_Boot.__cast(this.vehicle , com_davidmaletz_mining_world_IOxygen); + this.oxygen.set(com_fancyfish_faeng_common_Utils.largeNumberFormat(o.getOxygen()) + "/" + com_fancyfish_faeng_common_Utils.largeNumberFormat(o.getMaxOxygen())); + } + } + ,__class__: com_davidmaletz_mining_ui_VehiclePanel +}); +var com_davidmaletz_mining_ui_Weight = function(i,i2,max_weight,add_weight,e) { + if(add_weight == null) { + add_weight = 0; + } + com_davidmaletz_faengfl_InitSprite.call(this); + this.inventory = i; + this.inventory2 = i2; + this.capacity = max_weight; + this.weightStr = new com_fancyfish_faeng_common_mutable_Mutable(); + this.draw = com_davidmaletz_mining_Main.window_factory.create(90,16); + this.addWeight = add_weight; + this.addChild(this.draw.create(0,0)); + this.weight = new openfl_display_Sprite(); + com_davidmaletz_lerp_DarkenKeyframe.setDarkness(this.weight,0); + var label = com_fancyfish_faeng_common_Lang.getText("stats","weight"); + this.div = 1; + if(e != null) { + var m = com_fancyfish_faeng_common_Lang.getTextFromTitle(e.get("title")); + if(m != null) { + label = m; + } + if(e.exists("div")) { + this.div = com_davidmaletz_mining_Main.parseFloat(e.get("div")); + } + } + var t = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Concat(label,":"),new com_fancyfish_faeng_text_CharacterPlacer(0),16777215,1); + t.set_x(3); + t.set_y((this.draw.getHeight() - 8) * 0.5); + this.weight.addChild(t); + var t1 = new com_davidmaletz_faengfl_TextSprite(this.weightStr,new com_fancyfish_faeng_text_CharacterPlacer(this.draw.getWidth() - 3,2),16777215,1); + t1.set_y((this.draw.getHeight() - 8) * 0.5); + this.weight.addChild(t1); + this.addChild(this.weight); +}; +$hxClasses["com.davidmaletz.mining.ui.Weight"] = com_davidmaletz_mining_ui_Weight; +com_davidmaletz_mining_ui_Weight.__name__ = ["com","davidmaletz","mining","ui","Weight"]; +com_davidmaletz_mining_ui_Weight.__super__ = com_davidmaletz_faengfl_InitSprite; +com_davidmaletz_mining_ui_Weight.prototype = $extend(com_davidmaletz_faengfl_InitSprite.prototype,{ + draw: null + ,inventory: null + ,inventory2: null + ,weight: null + ,capacity: null + ,weightStr: null + ,addWeight: null + ,div: null + ,init: function(e) { + this.destroy(e); + this.capacity.addEventListener("updated",$bind(this,this.updateWeight)); + this.inventory.addEventListener("item_added",$bind(this,this.updateWeight)); + if(this.inventory2 != null) { + this.inventory2.addEventListener("item_added",$bind(this,this.updateWeight)); + } + this.updateWeight(); + } + ,destroy: function(e) { + this.capacity.removeEventListener("updated",$bind(this,this.updateWeight)); + this.inventory.removeEventListener("item_added",$bind(this,this.updateWeight)); + if(this.inventory2 != null) { + this.inventory2.removeEventListener("item_added",$bind(this,this.updateWeight)); + } + } + ,updateWeight: function(e) { + var wt = this.inventory.getWeight(); + if(this.inventory2 != null) { + wt += this.inventory2.getWeight(); + } + wt += this.addWeight; + wt = Math.round(wt / this.div); + var max = Math.round(this.capacity.get() / this.div); + this.weightStr.set(com_fancyfish_faeng_common_Utils.largeNumberFormat(wt) + (max > 0 ? "/" + com_fancyfish_faeng_common_Utils.largeNumberFormat(max) : "")); + var c = this.weight.get_transform().get_colorTransform(); + c.redMultiplier = wt > max && max > 0 ? 1 : 0; + this.weight.get_transform().set_colorTransform(c); + } + ,getWidth: function() { + return this.draw.getWidth(); + } + ,__class__: com_davidmaletz_mining_ui_Weight +}); +var com_davidmaletz_mining_ui_WeightInventoryWindow = function(p,c) { + com_davidmaletz_mining_ui_InventoryWindow.call(this,p,c); + var s = new com_davidmaletz_mining_ui_Weight(this.player.inventory,null,this.player.capacity); + s.set_x(this.getWidth() - s.getWidth()); + s.set_y(this.getHeight() + 2); + this.addChild(s); +}; +$hxClasses["com.davidmaletz.mining.ui.WeightInventoryWindow"] = com_davidmaletz_mining_ui_WeightInventoryWindow; +com_davidmaletz_mining_ui_WeightInventoryWindow.__name__ = ["com","davidmaletz","mining","ui","WeightInventoryWindow"]; +com_davidmaletz_mining_ui_WeightInventoryWindow.__super__ = com_davidmaletz_mining_ui_InventoryWindow; +com_davidmaletz_mining_ui_WeightInventoryWindow.prototype = $extend(com_davidmaletz_mining_ui_InventoryWindow.prototype,{ + __class__: com_davidmaletz_mining_ui_WeightInventoryWindow +}); +var com_davidmaletz_mining_ui_WindowFactory = function() { + com_davidmaletz_faengfl_AbstractDrawableFactory.call(this); +}; +$hxClasses["com.davidmaletz.mining.ui.WindowFactory"] = com_davidmaletz_mining_ui_WindowFactory; +com_davidmaletz_mining_ui_WindowFactory.__name__ = ["com","davidmaletz","mining","ui","WindowFactory"]; +com_davidmaletz_mining_ui_WindowFactory.__super__ = com_davidmaletz_faengfl_AbstractDrawableFactory; +com_davidmaletz_mining_ui_WindowFactory.prototype = $extend(com_davidmaletz_faengfl_AbstractDrawableFactory.prototype,{ + makeDrawable: function(w,h) { + return new com_davidmaletz_mining_ui__$WindowFactory_WindowDrawable(com_davidmaletz_faengfl_AutoTileBitmap.get("data/ui/ancient_window.png",16,16),w,h); + } + ,__class__: com_davidmaletz_mining_ui_WindowFactory +}); +var com_davidmaletz_mining_ui__$WindowFactory_WindowDrawable = function(t,w,h) { + this.sheet = t; + this.width = w; + this.height = h; + if(this.height < 16) { + this.height = 16; + } +}; +$hxClasses["com.davidmaletz.mining.ui._WindowFactory.WindowDrawable"] = com_davidmaletz_mining_ui__$WindowFactory_WindowDrawable; +com_davidmaletz_mining_ui__$WindowFactory_WindowDrawable.__name__ = ["com","davidmaletz","mining","ui","_WindowFactory","WindowDrawable"]; +com_davidmaletz_mining_ui__$WindowFactory_WindowDrawable.__interfaces__ = [com_davidmaletz_faengfl_Drawable]; +com_davidmaletz_mining_ui__$WindowFactory_WindowDrawable.prototype = { + sheet: null + ,width: null + ,height: null + ,getWidth: function() { + return this.width; + } + ,getHeight: function() { + return this.height; + } + ,create: function(tx,ty) { + var l = new com_davidmaletz_faengfl_TileLayer(); + var w = Math.ceil(this.width / 16) - 2; + l.start(); + if(this.height <= 16) { + var _g1 = 0; + var _g = w; + while(_g1 < _g) { + var x = _g1++; + this.sheet.addTile(l.handler,1,3,(x + 1) * 16,0); + } + this.sheet.addTile(l.handler,0,3,0,0); + this.sheet.addTile(l.handler,2,3,this.width - 16,0); + } else { + var h = Math.ceil(this.height / 16) - 2; + var _g11 = 0; + var _g2 = h; + while(_g11 < _g2) { + var y = _g11++; + var _g3 = 0; + var _g21 = w; + while(_g3 < _g21) { + var x1 = _g3++; + this.sheet.addTile(l.handler,1,1,(x1 + 1) * 16,(y + 1) * 16); + } + } + var _g12 = 0; + var _g4 = w; + while(_g12 < _g4) { + var x2 = _g12++; + this.sheet.addTile(l.handler,1,0,(x2 + 1) * 16,0); + this.sheet.addTile(l.handler,1,2,(x2 + 1) * 16,this.height - 16); + } + var _g13 = 0; + var _g5 = h; + while(_g13 < _g5) { + var y1 = _g13++; + this.sheet.addTile(l.handler,0,1,0,(y1 + 1) * 16); + this.sheet.addTile(l.handler,2,1,this.width - 16,(y1 + 1) * 16); + } + this.sheet.addTile(l.handler,0,0,0,0); + this.sheet.addTile(l.handler,2,0,this.width - 16,0); + this.sheet.addTile(l.handler,0,2,0,this.height - 16); + this.sheet.addTile(l.handler,2,2,this.width - 16,this.height - 16); + } + l.finish(); + l.set_x(tx); + l.set_y(ty); + return l; + } + ,__class__: com_davidmaletz_mining_ui__$WindowFactory_WindowDrawable +}; +var com_davidmaletz_mining_ui_XmlItemRenderer = function(w,obj,details,func,vars) { + this.width = w; + this.obj = obj; + this.details = details; + this.onComplete = func; + this.vars = vars; +}; +$hxClasses["com.davidmaletz.mining.ui.XmlItemRenderer"] = com_davidmaletz_mining_ui_XmlItemRenderer; +com_davidmaletz_mining_ui_XmlItemRenderer.__name__ = ["com","davidmaletz","mining","ui","XmlItemRenderer"]; +com_davidmaletz_mining_ui_XmlItemRenderer.__interfaces__ = [com_davidmaletz_controls_ListItemRenderer]; +com_davidmaletz_mining_ui_XmlItemRenderer.prototype = { + width: null + ,obj: null + ,details: null + ,onComplete: null + ,vars: null + ,create: function(item,x,y) { + return new com_davidmaletz_mining_ui_XmlButton(this,item,this.onComplete,x,y); + } + ,update: function(s,item) { + if(Std["is"](s,com_davidmaletz_mining_ui_XmlButton)) { + (js_Boot.__cast(s , com_davidmaletz_mining_ui_XmlButton)).updateEnabled(); + } + } + ,getWidth: function() { + return this.width; + } + ,getHeight: function(item) { + if(item == null || !item.exists("height")) { + return com_davidmaletz_mining_ui_StringRenderer._getHeight(); + } else { + return com_davidmaletz_mining_Main.parseFloat(item.get("height")); + } + } + ,__class__: com_davidmaletz_mining_ui_XmlItemRenderer +}; +var com_davidmaletz_mining_ui_XmlItemIcon = function(e) { + this.xml = e; +}; +$hxClasses["com.davidmaletz.mining.ui.XmlItemIcon"] = com_davidmaletz_mining_ui_XmlItemIcon; +com_davidmaletz_mining_ui_XmlItemIcon.__name__ = ["com","davidmaletz","mining","ui","XmlItemIcon"]; +com_davidmaletz_mining_ui_XmlItemIcon.__interfaces__ = [com_davidmaletz_mining_ui_Iconable]; +com_davidmaletz_mining_ui_XmlItemIcon.prototype = { + xml: null + ,getName: function() { + return com_fancyfish_faeng_common_Lang.getTextFromTitle(this.xml.get("title")); + } + ,createIcon: function() { + var tile = com_davidmaletz_tiles_Tile.get(this.xml.get("icon")); + if(tile == null) { + return null; + } else { + return com_davidmaletz_tiles_Tile.makeIcon(tile); + } + } + ,getElement: function() { + return null; + } + ,__class__: com_davidmaletz_mining_ui_XmlItemIcon +}; +var com_davidmaletz_mining_ui_XmlButton = function(r,e,func,x,y) { + var w = r.getWidth(); + var h = r.getHeight(e); + var bg = com_davidmaletz_mining_Main.label_factory.createBG(w,h); + var hover = com_davidmaletz_mining_Main.label_factory.createHover(w,h); + this.onComplete = func; + com_davidmaletz_controls_Button.call(this,x,y,bg,hover,null); + this.xml = e; + this.vars = r.vars; + this.vars.set("this",r.obj); + this.text = new openfl_display_Sprite(); + com_davidmaletz_mining_ui_ItemRenderer.addItem(this.text,this); + this.addChild(this.text); + this.details = r.details; + this.updateEnabled(); +}; +$hxClasses["com.davidmaletz.mining.ui.XmlButton"] = com_davidmaletz_mining_ui_XmlButton; +com_davidmaletz_mining_ui_XmlButton.__name__ = ["com","davidmaletz","mining","ui","XmlButton"]; +com_davidmaletz_mining_ui_XmlButton.__interfaces__ = [com_davidmaletz_mining_ui_InfoItem,AbstractClass]; +com_davidmaletz_mining_ui_XmlButton.compare = function(comp,ct,of) { + switch(comp) { + case "equal": + return ct == of; + case "greater": + return ct > of; + case "le": + return ct <= of; + case "less": + return ct < of; + case "not": + return ct != of; + default: + return ct >= of; + } +}; +com_davidmaletz_mining_ui_XmlButton.addReq = function(s,r,vars,w,x,y) { + com_davidmaletz_mining_ui_ItemRenderer.addItem(s,new com_davidmaletz_mining_ui_XmlItemIcon(r),x,y); + var ct = com_davidmaletz_mining_npc_NPCEventHandler.evalInt(r.get("count"),vars); + var of = com_davidmaletz_mining_npc_NPCEventHandler.evalInt(r.get("of"),vars); + var red = !com_davidmaletz_mining_ui_XmlButton.compare(r.get("compare"),ct,of); + var t = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Static(com_fancyfish_faeng_common_Utils.largeNumberFormat(ct) + "/" + com_fancyfish_faeng_common_Utils.largeNumberFormat(of)),new com_fancyfish_faeng_text_CharacterPlacer(w,2),red ? 16711680 : 0,1); + t.set_x(x); + t.set_y(y); + s.addChild(t); + return y + t.lineHeight(); +}; +com_davidmaletz_mining_ui_XmlButton.checkReq = function(r,vars) { + var ct = com_davidmaletz_mining_npc_NPCEventHandler.evalInt(r.get("count"),vars); + var of = com_davidmaletz_mining_npc_NPCEventHandler.evalInt(r.get("of"),vars); + return com_davidmaletz_mining_ui_XmlButton.compare(r.get("compare"),ct,of); +}; +com_davidmaletz_mining_ui_XmlButton.checkRequires = function(e,vars) { + if(!(!e.exists("count"))) { + return com_davidmaletz_mining_ui_XmlButton.checkReq(e,vars); + } else { + return true; + } +}; +com_davidmaletz_mining_ui_XmlButton.requires = function(s,e,vars,w,x,y) { + var txt = com_fancyfish_faeng_common_Lang.getTextFromTitle(e.get("requires")); + var t = new com_davidmaletz_faengfl_TextSprite(txt == null ? com_fancyfish_faeng_common_Lang.getText("common","requires") : txt,new com_fancyfish_faeng_text_CharacterPlacer(w,1),153,1); + t.set_x(x); + t.set_y(y); + s.addChild(t); + y += t.lineHeight(); + if(e.exists("count")) { + y = com_davidmaletz_mining_ui_XmlButton.addReq(s,e,vars,w,x,y); + } + return y; +}; +com_davidmaletz_mining_ui_XmlButton.value = function(s,r,vars,w,x,y) { + var sz = r.get("size") == "small" ? 0.5 : 1; + com_davidmaletz_mining_ui_ItemRenderer.addItem(s,new com_davidmaletz_mining_ui_XmlItemIcon(r),x,y,r.get("error") == "true" || r.get("red") == "true" ? 16711680 : 0,sz == 0.5 ? 1 : 0); + return y + Math.round(com_davidmaletz_mining_ui_StringRenderer._getHeight() * sz); +}; +com_davidmaletz_mining_ui_XmlButton.checkOption = function(e,vars) { + var xml = e.elementPathsNamed("value"); + while(xml.hasNext()) { + var xml1 = xml.next(); + if(!xml1.exists("if") || com_davidmaletz_faengfl_EventHandler._conditionMet(xml1.get("if"),vars)) { + return xml1.get("error") != "true"; + } + } + return true; +}; +com_davidmaletz_mining_ui_XmlButton.option = function(s,e,vars,w,x,y) { + if(e.exists("title")) { + y = com_davidmaletz_mining_ui_XmlButton.value(s,e,vars,w,x,y); + } + var xml = e.elementPathsNamed("value"); + while(xml.hasNext()) { + var xml1 = xml.next(); + if(!xml1.exists("if") || com_davidmaletz_faengfl_EventHandler._conditionMet(xml1.get("if"),vars)) { + return com_davidmaletz_mining_ui_XmlButton.value(s,xml1,vars,w,x,y); + } + } + return y; +}; +com_davidmaletz_mining_ui_XmlButton.__super__ = com_davidmaletz_controls_Button; +com_davidmaletz_mining_ui_XmlButton.prototype = $extend(com_davidmaletz_controls_Button.prototype,{ + xml: null + ,text: null + ,vars: null + ,details: null + ,onComplete: null + ,onHover: function(hover) { + com_davidmaletz_controls_Button.prototype.onHover.call(this,hover); + if(this.details != null) { + this.details.setInfo(hover && this.xml.elementsNamed("tooltip").hasNext() ? this : null); + } + } + ,complete: function() { + if(this.onComplete != null) { + this.onComplete(); + } + if(this.details != null && this.xml.elementsNamed("tooltip").hasNext()) { + this.details.setInfo(null); + this.details.setInfo(this); + } + } + ,onClick: function() { + if(this.text.get_alpha() == 1) { + new com_davidmaletz_mining_npc_NPCEventHandler(this.xml.elements(),com_davidmaletz_mining_Main.getLocalPlayer(),this.vars.get("this"),$bind(this,this.complete)).runAll(); + } else { + var fail = com_fancyfish_faeng_common_Lang.getTextFromTitle(this.xml.get("fail")); + if(fail == null) { + fail = com_fancyfish_faeng_common_Lang.getTextFromTitle(com_davidmaletz_faengfl_EventHandler.execute(this.xml.get("fail"),this.vars)); + } + if(fail != null) { + com_davidmaletz_faengfl_adv_sound_Sound.play("warning"); + new com_davidmaletz_faengfl_ui_Popup(128.,52.,0,fail,16720418,-16777216,20,20,20,null,true); + } + } + return true; + } + ,isEnabled: function() { + if(this.xml.exists("enabled") && com_davidmaletz_faengfl_EventHandler.execute(this.xml.get("enabled"),this.vars) != true) { + return false; + } + var iter = this.xml.elementPathsNamed("tooltip"); + if(!iter.hasNext()) { + return true; + } + var e = iter.next(); + var i = e.elements(); + while(i.hasNext()) { + var i1 = i.next(); + var _g = i1.nodeName(); + switch(_g) { + case "option": + if(!com_davidmaletz_mining_ui_XmlButton.checkOption(i1,this.vars)) { + return false; + } + break; + case "requirement": + if(!com_davidmaletz_mining_ui_XmlButton.checkReq(i1,this.vars)) { + return false; + } + break; + } + } + var _g1 = e.get("type"); + if(_g1 == "requires") { + if(!com_davidmaletz_mining_ui_XmlButton.checkRequires(e,this.vars)) { + return false; + } + } + return true; + } + ,updateEnabled: function() { + this.text.set_alpha(this.isEnabled() ? 1 : 0.5); + } + ,getName: function() { + return com_fancyfish_faeng_common_Lang.getTextFromTitle(this.xml.get("title")); + } + ,createIcon: function() { + var tile = com_davidmaletz_tiles_Tile.get(this.xml.get("icon")); + if(tile == null) { + return null; + } else if(this.xml.exists("animation")) { + return new com_davidmaletz_tiles_render_StaticPlayAnimation(tile,this.xml.get("animation"),10,true); + } else { + return com_davidmaletz_tiles_Tile.makeIcon(tile); + } + } + ,getElement: function() { + return null; + } + ,addInfo: function(s,w,x,y) { + var e = this.xml.elementPathsNamed("tooltip").next(); + var i = e.elements(); + while(i.hasNext()) { + var i1 = i.next(); + if(i1.get("info") == "true") { + var _g = i1.nodeName(); + switch(_g) { + case "option": + y = com_davidmaletz_mining_ui_XmlButton.option(s,i1,this.vars,w,x,y); + break; + case "requirement": + y = com_davidmaletz_mining_ui_XmlButton.addReq(s,i1,this.vars,w,x,y); + break; + } + } + } + var _g1 = e.get("type"); + if(_g1 == "requires") { + y = com_davidmaletz_mining_ui_XmlButton.requires(s,e,this.vars,w,x,y); + } + var i2 = e.elements(); + while(i2.hasNext()) { + var i3 = i2.next(); + if(i3.get("info") != "true") { + var _g11 = i3.nodeName(); + switch(_g11) { + case "option": + y = com_davidmaletz_mining_ui_XmlButton.option(s,i3,this.vars,w,x,y); + break; + case "requirement": + y = com_davidmaletz_mining_ui_XmlButton.addReq(s,i3,this.vars,w,x,y); + break; + } + } + } + return y; + } + ,__class__: com_davidmaletz_mining_ui_XmlButton +}); +var com_davidmaletz_mining_ui_details_Details = function(w) { + openfl_display_Sprite.call(this); + this.set_visible(false); + this._width = w; + this._height = 0; + this.info = null; +}; +$hxClasses["com.davidmaletz.mining.ui.details.Details"] = com_davidmaletz_mining_ui_details_Details; +com_davidmaletz_mining_ui_details_Details.__name__ = ["com","davidmaletz","mining","ui","details","Details"]; +com_davidmaletz_mining_ui_details_Details.__super__ = openfl_display_Sprite; +com_davidmaletz_mining_ui_details_Details.prototype = $extend(openfl_display_Sprite.prototype,{ + _width: null + ,_height: null + ,info: null + ,setInfo: function(info,additional) { + if(this.info == info) { + return; + } + this.info = info; + if(info == null) { + this.set_visible(false); + } else { + var s = this; + com_davidmaletz_faengfl_FaengFL.removeAllChildren(s); + this.set_visible(true); + var w = this._width - 8; + var y = this.addTitle(s,w,4,4); + y = info.addInfo(s,w,4,y); + if(additional != null) { + y = additional(s,w,4,y); + } + y = this.addAdditional(s,w,4,y); + this._height = y + 4; + this.addChildAt(com_davidmaletz_mining_Main.window_factory.create(this._width,this._height).create(0,0),0); + } + } + ,setText: function(m,sz,col) { + if(col == null) { + col = 0; + } + if(sz == null) { + sz = 1; + } + if(com_davidmaletz_mining_ui_details_Details.TEXT_ITEM == null) { + com_davidmaletz_mining_ui_details_Details.TEXT_ITEM = new com_davidmaletz_mining_ui_details__$Details_TextItem(); + } + this.info = com_davidmaletz_mining_ui_details_Details.TEXT_ITEM; + var s = this; + com_davidmaletz_faengfl_FaengFL.removeAllChildren(s); + this.set_visible(true); + var w = this._width - 8; + this._height = com_davidmaletz_mining_item_ItemInfo.addFormattedText(s,w,4,4,m.get(),sz,col) + 4; + this.addChildAt(com_davidmaletz_mining_Main.window_factory.create(this._width,this._height).create(0,0),0); + } + ,addTitle: function(s,w,x,y) { + com_davidmaletz_mining_ui_ItemRenderer.addItemCentered(s,this.info,x + (w >> 1),y); + return y + 12; + } + ,addAdditional: function(s,width,x,y) { + return y; + } + ,getInfo: function() { + return this.info; + } + ,getWidth: function() { + return this._width; + } + ,getHeight: function() { + return this._height; + } + ,__class__: com_davidmaletz_mining_ui_details_Details +}); +var com_davidmaletz_mining_ui_details__$Details_TextItem = function() { +}; +$hxClasses["com.davidmaletz.mining.ui.details._Details.TextItem"] = com_davidmaletz_mining_ui_details__$Details_TextItem; +com_davidmaletz_mining_ui_details__$Details_TextItem.__name__ = ["com","davidmaletz","mining","ui","details","_Details","TextItem"]; +com_davidmaletz_mining_ui_details__$Details_TextItem.__interfaces__ = [com_davidmaletz_mining_ui_InfoItem]; +com_davidmaletz_mining_ui_details__$Details_TextItem.prototype = { + getName: function() { + return null; + } + ,createIcon: function() { + return null; + } + ,getElement: function() { + return null; + } + ,addInfo: function(s,width,x,y) { + return y; + } + ,__class__: com_davidmaletz_mining_ui_details__$Details_TextItem +}; +var com_davidmaletz_mining_ui_details_ItemDetails = function(incCost) { + com_davidmaletz_mining_ui_details_Details.call(this,90); + this.includeCost = incCost; +}; +$hxClasses["com.davidmaletz.mining.ui.details.ItemDetails"] = com_davidmaletz_mining_ui_details_ItemDetails; +com_davidmaletz_mining_ui_details_ItemDetails.__name__ = ["com","davidmaletz","mining","ui","details","ItemDetails"]; +com_davidmaletz_mining_ui_details_ItemDetails.__super__ = com_davidmaletz_mining_ui_details_Details; +com_davidmaletz_mining_ui_details_ItemDetails.prototype = $extend(com_davidmaletz_mining_ui_details_Details.prototype,{ + includeCost: null + ,addAdditional: function(s,w,x,y) { + if(this.includeCost) { + return this.getItemInfo().addCost(s,w,x,y); + } else { + return y; + } + } + ,setItem: function(item,additional) { + this.setInfo(item,additional); + } + ,setItemParent: function(item,additional) { + if(item == null) { + this.setItem(null); + } else { + this.setItem(new com_davidmaletz_mining_item_Item(item.item,item.value,item.name),additional); + } + } + ,getItem: function() { + return js_Boot.__cast(this.info , com_davidmaletz_mining_ui_ItemType); + } + ,getItemInfo: function() { + if(this.info == null) { + return null; + } else { + return this.getItem().getInfo(); + } + } + ,asItem: function() { + if(this.info == null) { + return null; + } else if(Std["is"](this.info,com_davidmaletz_mining_item_Item)) { + return js_Boot.__cast(this.info , com_davidmaletz_mining_item_Item); + } else { + return (js_Boot.__cast(this.info , com_davidmaletz_mining_ui_ItemType)).getInfo().asItem(); + } + } + ,__class__: com_davidmaletz_mining_ui_details_ItemDetails +}); +var com_davidmaletz_mining_ui_details_RecipeDetails = function(incCost,divider) { + com_davidmaletz_mining_ui_details_Details.call(this,104); + this.includeCost = incCost; + this.divider = divider == null ? com_fancyfish_faeng_common_Lang.getText("common","requires") : divider; +}; +$hxClasses["com.davidmaletz.mining.ui.details.RecipeDetails"] = com_davidmaletz_mining_ui_details_RecipeDetails; +com_davidmaletz_mining_ui_details_RecipeDetails.__name__ = ["com","davidmaletz","mining","ui","details","RecipeDetails"]; +com_davidmaletz_mining_ui_details_RecipeDetails.__super__ = com_davidmaletz_mining_ui_details_Details; +com_davidmaletz_mining_ui_details_RecipeDetails.prototype = $extend(com_davidmaletz_mining_ui_details_Details.prototype,{ + includeCost: null + ,divider: null + ,setRecipe: function(r,inventory,fuelName) { + com_davidmaletz_mining_item_Recipe.fuelName = fuelName; + this.setInfo(r,this.showCost(r,inventory)); + com_davidmaletz_mining_item_Recipe.fuelName = null; + } + ,showCost: function(r,inventory) { + var _gthis = this; + return function(s,w,x,y) { + return _gthis._showCost(r,inventory,s,w,x,y); + }; + } + ,_showCost: function(r,inventory,s,w,x,y) { + if(this.includeCost && r.creates != null) { + y = r.creates.getInfo().addCost(s,w,x,y); + } + if(r.numRequirements() > 0) { + var t = new com_davidmaletz_faengfl_TextSprite(this.divider,new com_fancyfish_faeng_text_CharacterPlacer(w,1),153,1); + t.set_y(y); + this.addChild(t); + y += t.lineHeight(); + var i = r.getRequirements(); + while(i.hasNext()) { + var i1 = i.next(); + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + var ct = i1.getCount(p,inventory); + if(i1.hidden && ct == 0 && !i1.hasSeen(p)) { + var t1 = new com_davidmaletz_faengfl_TextSprite(com_fancyfish_faeng_common_Lang.getText("quests","unknown_reqs"),new com_fancyfish_faeng_text_CharacterPlacer(0,0),0,1); + t1.set_x(x); + t1.set_y(y); + this.addChild(t1); + } else { + com_davidmaletz_mining_ui_ItemRenderer.addItem(this,i1,x,y); + } + if(i1.count > 0) { + var t2; + if(inventory == null) { + t2 = new com_davidmaletz_faengfl_TextSprite(new com_fancyfish_faeng_common_mutable_Static(i1.count == null ? "null" : "" + i1.count),new com_fancyfish_faeng_text_CharacterPlacer(w,2),0,1); + } else { + var t3 = new com_fancyfish_faeng_common_mutable_Static(com_fancyfish_faeng_common_Utils.largeNumberFormat(ct) + "/" + i1.count); + var t4 = ct < i1.count ? 16711680 : 0; + t2 = new com_davidmaletz_faengfl_TextSprite(t3,new com_fancyfish_faeng_text_CharacterPlacer(w,2),t4,1); + } + t2.set_x(x); + t2.set_y(y); + this.addChild(t2); + } + y += t.lineHeight(); + } + } + return y; + } + ,itemAdditional: function(s,w,x,y) { + if(this.includeCost) { + return this.getItemInfo().addCost(s,w,x,y); + } else { + return y; + } + } + ,setItem: function(item) { + this.setInfo(item,$bind(this,this.itemAdditional)); + } + ,getItemInfo: function() { + if(this.info == null || !Std["is"](this.info,com_davidmaletz_mining_ui_ItemType)) { + return null; + } else { + return (js_Boot.__cast(this.info , com_davidmaletz_mining_ui_ItemType)).getInfo(); + } + } + ,__class__: com_davidmaletz_mining_ui_details_RecipeDetails +}); +var com_davidmaletz_mining_ui_details_SmeltRecipeDetails = function(incCost,divider) { + com_davidmaletz_mining_ui_details_RecipeDetails.call(this,incCost,divider); +}; +$hxClasses["com.davidmaletz.mining.ui.details.SmeltRecipeDetails"] = com_davidmaletz_mining_ui_details_SmeltRecipeDetails; +com_davidmaletz_mining_ui_details_SmeltRecipeDetails.__name__ = ["com","davidmaletz","mining","ui","details","SmeltRecipeDetails"]; +com_davidmaletz_mining_ui_details_SmeltRecipeDetails.__super__ = com_davidmaletz_mining_ui_details_RecipeDetails; +com_davidmaletz_mining_ui_details_SmeltRecipeDetails.prototype = $extend(com_davidmaletz_mining_ui_details_RecipeDetails.prototype,{ + _showCost: function(r,inventory,s,w,x,y) { + y = com_davidmaletz_mining_ui_details_RecipeDetails.prototype._showCost.call(this,r,inventory,s,w,x,y); + if(r.numRequirements() == 0) { + var t = new com_davidmaletz_faengfl_TextSprite(this.divider,new com_fancyfish_faeng_text_CharacterPlacer(w,1),153,1); + t.set_y(y); + this.addChild(t); + y += t.lineHeight(); + } + if(r.creates != null || r.object != null) { + var cost = com_davidmaletz_mining_item_SmeltItem.getFuelCost(r); + var l; + if(com_davidmaletz_mining_item_Recipe.fuelName == null) { + l = com_fancyfish_faeng_common_Lang.getText("common","fuel"); + } else { + l = com_fancyfish_faeng_common_Lang.getTextFromTitle(com_davidmaletz_mining_item_Recipe.fuelName); + if(l == null) { + l = com_fancyfish_faeng_common_Lang.getText("common",com_davidmaletz_mining_item_Recipe.fuelName); + } + } + y = com_davidmaletz_mining_item_ItemInfo.addLine(s,w,x,y,l,cost,false,true,0,0.5); + } + return y; + } + ,__class__: com_davidmaletz_mining_ui_details_SmeltRecipeDetails +}); +var com_davidmaletz_mining_ui_details_StringDetails = function(w) { + openfl_display_Sprite.call(this); + this.set_visible(false); + this._width = w; + this._height = 0; + this.info = null; +}; +$hxClasses["com.davidmaletz.mining.ui.details.StringDetails"] = com_davidmaletz_mining_ui_details_StringDetails; +com_davidmaletz_mining_ui_details_StringDetails.__name__ = ["com","davidmaletz","mining","ui","details","StringDetails"]; +com_davidmaletz_mining_ui_details_StringDetails.__super__ = openfl_display_Sprite; +com_davidmaletz_mining_ui_details_StringDetails.prototype = $extend(openfl_display_Sprite.prototype,{ + _width: null + ,_height: null + ,info: null + ,setInfo: function(info,sz,additional) { + if(sz == null) { + sz = 1; + } + if(this.info == info) { + return; + } + this.info = info; + if(info == null) { + this.set_visible(false); + } else { + var s = this; + com_davidmaletz_faengfl_FaengFL.removeAllChildren(s); + this.set_visible(true); + var w = this._width - 8; + var y = com_davidmaletz_mining_item_ItemInfo.addFormattedText(this,this._width - 8,4,4,info,sz); + if(additional != null) { + y = additional(s,w,4,y); + } + y = this.addAdditional(s,w,4,y); + this._height = y + 4; + this.addChildAt(com_davidmaletz_mining_Main.window_factory.create(this._width,this._height).create(0,0),0); + } + } + ,addAdditional: function(s,width,x,y) { + return y; + } + ,getWidth: function() { + return this._width; + } + ,getHeight: function() { + return this._height; + } + ,__class__: com_davidmaletz_mining_ui_details_StringDetails +}); +var com_davidmaletz_tiles_TileMap = function() { + this.tile_index_count = 0; + openfl_events_EventDispatcher.call(this); + this.tile_index = new com_davidmaletz_tiles_TileIndex(); + this.floor = new com_davidmaletz_tiles_Floor(); +}; +$hxClasses["com.davidmaletz.tiles.TileMap"] = com_davidmaletz_tiles_TileMap; +com_davidmaletz_tiles_TileMap.__name__ = ["com","davidmaletz","tiles","TileMap"]; +com_davidmaletz_tiles_TileMap.copyMap = function(map) { + var ret = new haxe_ds_StringMap(); + var k = map.keys(); + while(k.hasNext()) { + var k1 = k.next(); + ret.set(k1,map.get(k1)); + } + return ret; +}; +com_davidmaletz_tiles_TileMap.__super__ = openfl_events_EventDispatcher; +com_davidmaletz_tiles_TileMap.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + tile_index: null + ,floor: null + ,getTileIndex: function(idx) { + return this.tile_index.getTile(idx); + } + ,tile_index_map: null + ,tile_index_count: null + ,addTileIndex: function(tile) { + if(this.tile_index_map == null) { + this.tile_index_map = new haxe_ds_StringMap(); + this.tile_index_count = 0; + } + if(this.tile_index_map.exists(tile)) { + return this.tile_index_map.get(tile); + } else { + var i = this.tile_index_count; + this.tile_index_count++; + this.tile_index_map.set(tile,i); + if(this.tile_index.setTile(i,com_davidmaletz_tiles_Tile.get(tile))) { + this.dispatchEvent(new com_davidmaletz_tiles_ChunkEvent("chunk_update",this,null,-1)); + } + return i; + } + } + ,getTileId: function(x,y,layer) { + var cx = Math.floor(x / 16); + var cy = Math.floor(y / 16); + x -= cx * 16; + y -= cy * 16; + if(!this.floor.hasChunk(cx,cy)) { + return -1; + } else { + return this.floor.getChunk(cx,cy).getTile(x,y,layer); + } + } + ,isNeighbor: function(self,data,x,y,layer) { + return self.isNeighbor(data,this.getTile(x,y,layer)); + } + ,getTile: function(x,y,layer) { + var id = this.getTileId(x,y,layer); + if(id == -1) { + return null; + } else { + return this.getTileIndex(id); + } + } + ,update_autotile: function(x,y,layer,tile) { + return true; + } + ,setTile: function(x,y,layer,tile) { + var cx = Math.floor(x / 16); + var cy = Math.floor(y / 16); + x -= cx * 16; + y -= cy * 16; + var c = this.floor.getChunk(cx,cy); + if(c.setTile(x,y,tile,layer)) { + this.dispatchEvent(new com_davidmaletz_tiles_ChunkEvent("chunk_update",this,c,layer)); + if(this.update_autotile(x,y,layer,tile)) { + if(x == 0 && this.floor.hasChunk(cx - 1,cy)) { + this.dispatchEvent(new com_davidmaletz_tiles_ChunkEvent("chunk_update",this,this.floor.getChunk(cx - 1,cy),layer)); + } + if(x == 15 && this.floor.hasChunk(cx + 1,cy)) { + this.dispatchEvent(new com_davidmaletz_tiles_ChunkEvent("chunk_update",this,this.floor.getChunk(cx + 1,cy),layer)); + } + if(y == 0 && this.floor.hasChunk(cx,cy - 1)) { + this.dispatchEvent(new com_davidmaletz_tiles_ChunkEvent("chunk_update",this,this.floor.getChunk(cx,cy - 1),layer)); + } + if(y == 15 && this.floor.hasChunk(cx,cy + 1)) { + this.dispatchEvent(new com_davidmaletz_tiles_ChunkEvent("chunk_update",this,this.floor.getChunk(cx,cy + 1),layer)); + } + if(x == 0 && y == 0 && this.floor.hasChunk(cx - 1,cy - 1)) { + this.dispatchEvent(new com_davidmaletz_tiles_ChunkEvent("chunk_update",this,this.floor.getChunk(cx - 1,cy - 1),layer)); + } + if(x == 15 && y == 0 && this.floor.hasChunk(cx + 1,cy - 1)) { + this.dispatchEvent(new com_davidmaletz_tiles_ChunkEvent("chunk_update",this,this.floor.getChunk(cx + 1,cy - 1),layer)); + } + if(x == 0 && y == 15 && this.floor.hasChunk(cx - 1,cy + 1)) { + this.dispatchEvent(new com_davidmaletz_tiles_ChunkEvent("chunk_update",this,this.floor.getChunk(cx - 1,cy + 1),layer)); + } + if(x == 15 && y == 15 && this.floor.hasChunk(cx + 1,cy + 1)) { + this.dispatchEvent(new com_davidmaletz_tiles_ChunkEvent("chunk_update",this,this.floor.getChunk(cx + 1,cy + 1),layer)); + } + } + return true; + } else { + return false; + } + } + ,getFloor: function() { + return this.floor; + } + ,write: function(b) { + b.writeByte(0); + if(this.tile_index_map == null) { + b.writeByte(0); + } else { + b.writeByte(1); + var ar = []; + var tile = this.tile_index_map.keys(); + while(tile.hasNext()) { + var tile1 = tile.next(); + ar[this.tile_index_map.get(tile1)] = tile1; + } + b.writeUInt16(ar.length); + var _g = 0; + while(_g < ar.length) { + var tile2 = ar[_g]; + ++_g; + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,tile2); + } + } + this.floor.write(b); + } + ,read: function(b,version) { + var ver = b.readByte(); + if(ver != 0) { + return; + } + this.tile_index = new com_davidmaletz_tiles_TileIndex(); + this.tile_index_map = null; + this.tile_index_count = 0; + var layers = b.readByte(); + var _g1 = 0; + var _g = layers; + while(_g1 < _g) { + var layer = _g1++; + var len = b.readUInt16(); + var _g3 = 0; + var _g2 = len; + while(_g3 < _g2) { + var i = _g3++; + this.addTileIndex(com_fancyfish_faeng_common_UTFUtils.readUTF(b)); + } + } + this.floor = com_davidmaletz_tiles_Floor.read(b); + this.dispatchEvent(new com_davidmaletz_tiles_ChunkEvent("chunk_update",this,null,-1)); + } + ,__class__: com_davidmaletz_tiles_TileMap +}); +var com_davidmaletz_mining_world_Area = function(id,loop) { + if(loop == null) { + loop = -1; + } + this.__id = -1; + this.generateO2 = 0.0; + this.temporaryTime = 60; + this.dronePlayers = 0; + this.flood_time = 20; + this.isInit = false; + this.definedWidth = 0; + this.tidallyLocked = false; + this.hasO2 = true; + this.runInit = true; + com_davidmaletz_tiles_TileMap.call(this); + this.id = id; + this.structures = new com_fancyfish_faeng_pack_AABBObjectList(loop); + this.lights = new com_fancyfish_faeng_pack_AABBObjectList(loop); + this.objects = new com_davidmaletz_mining_world_ObjectLayer(this,loop); + this.projectiles = []; + if(id != null) { + this.spawner = new com_davidmaletz_mining_enemy_EnemySpawnerHandler(this); + } + if(id != null) { + this.readXml(); + } +}; +$hxClasses["com.davidmaletz.mining.world.Area"] = com_davidmaletz_mining_world_Area; +com_davidmaletz_mining_world_Area.__name__ = ["com","davidmaletz","mining","world","Area"]; +com_davidmaletz_mining_world_Area.__interfaces__ = [com_davidmaletz_faengfl_EnterFrameHandler]; +com_davidmaletz_mining_world_Area.getTileRect = function(x,y,w,h) { + if(h == null) { + h = 1; + } + if(w == null) { + w = 1; + } + com_davidmaletz_mining_world_BaseObject.rectangle.setTo(x * com_davidmaletz_tiles_Tile.SIZE,y * com_davidmaletz_tiles_Tile.SIZE,w * com_davidmaletz_tiles_Tile.SIZE,h * com_davidmaletz_tiles_Tile.SIZE); + return com_davidmaletz_mining_world_BaseObject.rectangle; +}; +com_davidmaletz_mining_world_Area.isSleep = function(s) { + return s.info.xml.get("sleep") == "true"; +}; +com_davidmaletz_mining_world_Area.isEmpty = function(t) { + if(t != null) { + return t.id == "empty"; + } else { + return true; + } +}; +com_davidmaletz_mining_world_Area.dig_map = null; +com_davidmaletz_mining_world_Area.ore_map = null; +com_davidmaletz_mining_world_Area.setDig = function(e) { + if(com_davidmaletz_mining_world_Area.dig_map == null) { + com_davidmaletz_mining_world_Area.dig_map = new haxe_ds_StringMap(); + } + var id = e.get("id"); + if(com_davidmaletz_mining_world_Area.dig_map.exists(id)) { + haxe_Log.trace("Overwrite Dig: " + id,{ fileName : "Area.hx", lineNumber : 518, className : "com.davidmaletz.mining.world.Area", methodName : "setDig"}); + } + com_davidmaletz_mining_world_Area.dig_map.set(id,e); +}; +com_davidmaletz_mining_world_Area.setOre = function(e) { + if(com_davidmaletz_mining_world_Area.ore_map == null) { + com_davidmaletz_mining_world_Area.ore_map = new haxe_ds_StringMap(); + } + var id = e.get("id"); + if(com_davidmaletz_mining_world_Area.ore_map.exists(id)) { + haxe_Log.trace("Overwrite Ore: " + id,{ fileName : "Area.hx", lineNumber : 522, className : "com.davidmaletz.mining.world.Area", methodName : "setOre"}); + } + com_davidmaletz_mining_world_Area.ore_map.set(id,e); +}; +com_davidmaletz_mining_world_Area.getDig = function(t) { + if(t != null && com_davidmaletz_mining_world_Area.dig_map != null) { + return com_davidmaletz_mining_world_Area.dig_map.get(t.id); + } else { + return null; + } +}; +com_davidmaletz_mining_world_Area._getDig = function(t) { + if(t != null && com_davidmaletz_mining_world_Area.dig_map != null) { + return com_davidmaletz_mining_world_Area.dig_map.get(t); + } else { + return null; + } +}; +com_davidmaletz_mining_world_Area.getMineCost = function(t,player) { + if(player == null) { + player = false; + } + var xml = com_davidmaletz_mining_world_Area.getDig(t); + if(xml == null || !xml.exists("cost")) { + return 100; + } else { + var r = com_davidmaletz_mining_Main.parseInt(xml.get("cost")); + if(r < 0) { + if(com_davidmaletz_mining_world_Area.MINE_WALKWAYS || !player) { + return -r; + } else { + return 100; + } + } else { + return r; + } + } +}; +com_davidmaletz_mining_world_Area.onDig = function(p,t) { + if(t != null) { + p.addDigCount(t.id,1); + var xml = com_davidmaletz_mining_world_Area.getDig(t); + if(xml != null) { + com_davidmaletz_mining_Main.runEvent("onDig",p,xml,t); + } + } +}; +com_davidmaletz_mining_world_Area.getOre = function(id) { + if(com_davidmaletz_mining_world_Area.ore_map == null) { + return null; + } else { + return com_davidmaletz_mining_world_Area.ore_map.get(id); + } +}; +com_davidmaletz_mining_world_Area.reset = function() { + com_davidmaletz_mining_world_Area.dig_map = null; + com_davidmaletz_mining_world_Area.ore_map = null; + com_davidmaletz_mining_enemy_EnemySpawnerHandler.reset(); +}; +com_davidmaletz_mining_world_Area.parseLoop = function(id) { + var xml = com_davidmaletz_mining_world_Generate.get(id); + if(xml != null && xml.get("looping") == "true") { + return com_davidmaletz_mining_Main.parseInt(xml.get("width")); + } else { + return -1; + } +}; +com_davidmaletz_mining_world_Area.readArea = function(id,b,version,v) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + var area = new com_davidmaletz_mining_world_Area(null,com_davidmaletz_mining_world_Area.parseLoop(id)); + area.id = id; + area.vehicle = v; + if(version < 64) { + area.read(b,version); + } else { + var len = b.readUInt24(); + var bytes = haxe_io_Bytes.alloc(len); + b.readFullBytes(bytes,0,len); + try { + area.read(new haxe_io_BytesInput(bytes,0,len),version); + } catch( e ) { + haxe_CallStack.lastException = e; + com_fancyfish_faeng_common_Utils.printExceptionTrace("Failed to load area: " + id); + com_davidmaletz_mining_Main.error = true; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + return null; + } + } + com_davidmaletz_mining_world_Generate.runAction("onRead",null,null,version,area); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + return area; +}; +com_davidmaletz_mining_world_Area.parseLayer = function(layer) { + switch(layer) { + case "back": + return 3; + case "ore": + return 1; + default: + return 0; + } +}; +com_davidmaletz_mining_world_Area.getXML = function(id) { + return com_davidmaletz_mining_world_Generate.get(id); +}; +com_davidmaletz_mining_world_Area.getNameFromId = function(id) { + var xml = com_davidmaletz_mining_world_Generate.get(id); + if(xml != null && xml.exists("name")) { + return xml.get("name"); + } else { + return id; + } +}; +com_davidmaletz_mining_world_Area.getName = function(name,id) { + if(name != null) { + return new com_fancyfish_faeng_common_mutable_Static(name); + } + id = com_davidmaletz_mining_world_Area.getNameFromId(id); + var n = com_fancyfish_faeng_common_Lang.getTextFromTitle(id); + if(n != null) { + return n; + } + if(com_fancyfish_faeng_common_Lang.hasText("world",id)) { + return com_fancyfish_faeng_common_Lang.getText("world",id); + } else { + return com_fancyfish_faeng_common_Lang.getText("quests","unknown_reqs"); + } +}; +com_davidmaletz_mining_world_Area.getById = function(id,def) { + var a = com_davidmaletz_mining_world_Area.__areas.get(id); + if(a == null) { + return def; + } else { + return a; + } +}; +com_davidmaletz_mining_world_Area.resetIds = function() { + com_davidmaletz_mining_world_Area.__areas = new haxe_ds_IntMap(); + com_davidmaletz_mining_world_Area.__current_id = 0; + com_davidmaletz_mining_world_Object.resetIds(); + com_davidmaletz_mining_structure_Structure.resetIds(); +}; +com_davidmaletz_mining_world_Area.__super__ = com_davidmaletz_tiles_TileMap; +com_davidmaletz_mining_world_Area.prototype = $extend(com_davidmaletz_tiles_TileMap.prototype,{ + id: null + ,structures: null + ,objects: null + ,spawner: null + ,projectiles: null + ,runInit: null + ,__name: null + ,external: null + ,lights: null + ,openTiles: null + ,waterLevel: null + ,left: null + ,right: null + ,vehicle: null + ,up: null + ,down: null + ,planet: null + ,hasO2: null + ,tidallyLocked: null + ,hasO2Func: null + ,definedWidth: null + ,readXml: function() { + var b = com_davidmaletz_mining_world_Generate.getBackground(this.id); + if(b == null) { + this.waterLevel = 2147483647; + } else { + var p = com_davidmaletz_mining_renderer_Parallax.get(b); + this.waterLevel = p != null && p.exists("waterLevel") ? com_davidmaletz_mining_Main.parseInt(p.get("waterLevel")) : 2147483647; + } + var xml = com_davidmaletz_mining_world_Generate.get(this.id); + if(xml == null) { + throw new js__$Boot_HaxeError("Area Does Not Exist"); + } + this.external = xml.get("external"); + var e = xml.elementsNamed("connection"); + while(e.hasNext()) { + var e1 = e.next(); + var c = com_davidmaletz_mining_world_Connection.fromXML(e1); + var dir = e1.get("dir"); + var l; + if(dir == "up") { + this.up = c; + } else if(dir == "down") { + this.down = c; + } else { + if(dir == "left") { + l = true; + } else if(dir == "right") { + l = false; + } else { + l = c.fromX < 0; + } + if(l && (this.left == null || c.fromX > this.left.fromX)) { + this.left = c; + } + if(!l && (this.right == null || c.fromX < this.right.fromX)) { + this.right = c; + } + } + } + this.planet = com_davidmaletz_mining_world_Planet.get(xml.get("planet")); + if(this.planet != null) { + if(this.isOrbit()) { + var o = this.planet.orbit; + if(o != null) { + o.addConnections(this); + } + } else { + var loop = this.getLoop(); + if(loop > 0) { + if(this.left == null) { + this.left = new com_davidmaletz_mining_world_Connection(0,loop,this.id,true); + } + if(this.right == null) { + this.right = new com_davidmaletz_mining_world_Connection(loop,0,this.id,true); + } + } + if(this.up == null) { + this.up = this.planet.getConnection(this.id); + } + } + } + this.definedWidth = com_davidmaletz_mining_Main.parseInt(xml.get("width")); + this.hasO2 = xml.get("hasO2") != "false"; + this.tidallyLocked = xml.get("tidallyLocked") == "true"; + } + ,getStartX: function() { + if(this.left == null) { + return 0; + } else { + return this.left.fromX; + } + } + ,getEndX: function() { + if(this.right == null) { + return this.getWidth(); + } else { + return this.right.fromX; + } + } + ,renderer: null + ,isInit: null + ,load: function(r) { + this.renderer = r; + this.dispatchEvent(new openfl_events_Event("load")); + } + ,unload: function() { + this.renderer = null; + var _g = 0; + var _g1 = this.projectiles; + while(_g < _g1.length) { + var p = _g1[_g]; + ++_g; + p.removeFromArea(this); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("rem_projectile",p)); + } + com_fancyfish_faeng_common_Utils.clear(this.projectiles); + this.dispatchEvent(new openfl_events_Event("unload")); + } + ,init: function() { + if(!this.isInit) { + com_davidmaletz_faengfl_FaengFL.addEnterFrame(this,true); + this.isInit = true; + this.dispatchEvent(new openfl_events_Event("init")); + } + } + ,destroy: function() { + if(this.isInit) { + com_davidmaletz_faengfl_FaengFL.removeEnterFrame(this); + this.isInit = false; + this.dispatchEvent(new openfl_events_Event("destroy")); + } + } + ,flood_time: null + ,__loopX: function(x) { + var loop = this.objects.loop; + if(loop > 0) { + if(x < 0) { + x += loop; + } else if(x >= loop) { + x -= loop; + } + } + return x; + } + ,__flood: function(x,y) { + if(!this.isTrueWater(x,y) && !this.isWaterBlock(x,y) && this.getTileId(x,y,0) == -1) { + return true; + } else { + return false; + } + } + ,isSurrounded: function(x1,x2,y) { + if(this.isWaterBlock(x1,y) || this.getTileId(x1,y,0) != -1) { + if(!this.isWaterBlock(x2,y)) { + return this.getTileId(x2,y,0) != -1; + } else { + return true; + } + } else { + return false; + } + } + ,flood: function() { + var ar = this.openTiles; + this.openTiles = null; + var _g = 0; + while(_g < ar.length) { + var n = ar[_g]; + ++_g; + if(this.isTrueWater(n.x,n.y)) { + if(this.__flood(n.x,n.y + 1)) { + this.removeWaterLater(n.x,n.y); + this.setWater(n.x,n.y + 1); + } else { + var above = this.isWater(n.x,n.y - 1); + var xplus = this.__loopX(n.x + 1); + var xminus = this.__loopX(n.x - 1); + if((above || this.isWater(xplus,n.y)) && this.__flood(xminus,n.y)) { + this.removeWaterLater(n.x,n.y); + this.setWater(xminus,n.y); + } + if((above || this.isWater(xminus,n.y)) && this.__flood(xplus,n.y)) { + this.removeWaterLater(n.x,n.y); + this.setWater(xplus,n.y); + } + if(!this.isWater(n.x,n.y - 1) && !this.isWater(xminus,n.y) && !this.isWater(xplus,n.y) && !this.isSurrounded(xminus,xplus,n.y)) { + this.removeWaterLater(n.x,n.y); + } + } + } else { + this.removeWater(n.x,n.y); + } + } + } + ,dronePlayers: null + ,temporaryTime: null + ,enter_frame: function(frames) { + if(this.tidallyLocked) { + var player = null; + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p != null && p.getCurrentArea() == this) { + player = p; + } + if(player != null) { + com_davidmaletz_mining_Main.__setGameTime(com_fancyfish_faeng_common_Utils.fract((128. / com_davidmaletz_mining_Main._getScale() - player.getVCenterX()) / (this.getWidth() * com_davidmaletz_tiles_Tile.SIZE)) * 24); + } + } + this.temporaryTime -= frames; + if(this.temporaryTime < 0) { + if(this.isTemporary()) { + var p1 = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p1 != null && p1.getCurrentArea() != this && !this.hasPlayer()) { + p1.areas.__removeArea(this); + return; + } + } + this.temporaryTime += 60; + } + this.dispatchEvent(new com_davidmaletz_faengfl_events_FloatEvent("tick",frames)); + if(this.openTiles != null) { + this.flood_time -= frames; + if(this.flood_time <= 0) { + this.flood(); + this.flood_time += 20; + } + } else { + this.flood_time = 20; + } + } + ,getCrack: function() { + var e = com_davidmaletz_mining_world_Area.getXML(this.id); + if(e != null && e.exists("crack")) { + return e.get("crack"); + } else { + return "crack"; + } + } + ,getTileBreak: function() { + var e = com_davidmaletz_mining_world_Area.getXML(this.id); + if(e != null && e.exists("tile_break")) { + return e.get("tile_break"); + } else { + return "tile_break"; + } + } + ,getTileAnim: function() { + var e = com_davidmaletz_mining_world_Area.getXML(this.id); + if(e == null) { + return null; + } else { + return e.get("tile_anim"); + } + } + ,getTileScale: function() { + var e = com_davidmaletz_mining_world_Area.getXML(this.id); + if(e == null || !e.exists("tile_scale")) { + return 1; + } else { + return com_davidmaletz_mining_Main.parseFloat(e.get("tile_scale")); + } + } + ,getOreAnim: function() { + var e = com_davidmaletz_mining_world_Area.getXML(this.id); + if(e != null && e.exists("ore_anim")) { + return e.get("ore_anim"); + } else { + return "ore"; + } + } + ,getWaterTile: function() { + var e = com_davidmaletz_mining_world_Area.getXML(this.id); + var t = e == null ? null : com_davidmaletz_tiles_Tile.get(e.get("water")); + if(t == null) { + return com_davidmaletz_tiles_Tile.get("water"); + } else { + return t; + } + } + ,getWaterAltTile: function() { + var e = com_davidmaletz_mining_world_Area.getXML(this.id); + if(e == null) { + return com_davidmaletz_tiles_Tile.get("water_alt"); + } + var t = com_davidmaletz_tiles_Tile.get(e.get("water_alt")); + if(t != null) { + return t; + } + if(e.exists("water")) { + return this.getWaterTile(); + } else { + return com_davidmaletz_tiles_Tile.get("water_alt"); + } + } + ,getWaterAnim: function() { + var e = com_davidmaletz_mining_world_Area.getXML(this.id); + var t = e == null ? null : com_davidmaletz_tiles_TileAnimation.get(e.get("water_anim")); + if(t == null) { + return com_davidmaletz_tiles_TileAnimation.get("water"); + } else { + return t; + } + } + ,getWaterBlock: function() { + var e = com_davidmaletz_mining_world_Area.getXML(this.id); + var t = e == null ? null : com_davidmaletz_tiles_Tile.get(e.get("water_block")); + if(t == null) { + return com_davidmaletz_tiles_Tile.get("water_block"); + } else { + return t; + } + } + ,getWaterBlockAnim: function() { + var e = com_davidmaletz_mining_world_Area.getXML(this.id); + var t = e == null ? null : com_davidmaletz_tiles_TileAnimation.get(e.get("water_block_anim")); + if(t == null) { + return com_davidmaletz_tiles_TileAnimation.get("water_block"); + } else { + return t; + } + } + ,getInvisibleBlock: function() { + var e = com_davidmaletz_mining_world_Area.getXML(this.id); + var t = e == null ? null : com_davidmaletz_tiles_Tile.get(e.get("invisible_block")); + if(t == null) { + return com_davidmaletz_tiles_Tile.get("invisible_block"); + } else { + return t; + } + } + ,getInvisibleBlockAnim: function() { + var e = com_davidmaletz_mining_world_Area.getXML(this.id); + var t = e == null ? null : com_davidmaletz_tiles_TileAnimation.get(e.get("invisible_block_anim")); + if(t == null) { + return com_davidmaletz_tiles_TileAnimation.get("invisible_block"); + } else { + return t; + } + } + ,hasTile: function(x,y) { + return this.getTileId(x,y,0) != -1; + } + ,getLiveCount: function(id) { + return this.objects.getLiveCount(id); + } + ,isNeighbor: function(self,data,x,y,layer) { + if(layer == 3 || layer == 0) { + var back = this.getTile(x,y,3); + var base = this.getTile(x,y,0); + var xml = com_davidmaletz_mining_world_Area.getDig(base); + if(xml != null && xml.get("back") == "null") { + base = null; + } + if(!(self.isNeighbor(data,back) || self.isNeighbor(data,base))) { + if(back == null) { + return base == null; + } else { + return false; + } + } else { + return true; + } + } else if(layer == 1) { + return self.isNeighbor(data,this.getTile(x,y,layer)); + } else { + return false; + } + } + ,addStructure: function(s,p) { + if(!s.isBack() && s.info.xml.get("remove") != "false") { + var ar = []; + this.structures.getObjects(s.getInnerBounds(),function(s1,rect) { + if(s1.getInnerBounds().intersects(rect)) { + ar.push(s1); + } + return false; + }); + var _g = 0; + while(_g < ar.length) { + var old = ar[_g]; + ++_g; + if(old != null && !old.isBack() && old.info.xml.get("remove") != "false") { + this.removeStructure(old,p); + s.upgradeFrom(old); + } + } + } + this.removeObjects(s.getInnerBounds(),1); + this.__addStructure(s,true); + return s; + } + ,__addStructure: function(s,built) { + this.structures.addObject(s); + s.addedToArea(this,built); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("add_structure",s)); + } + ,getExit: function() { + var xml = com_davidmaletz_mining_world_Area.getXML(this.id); + if(xml == null) { + return null; + } + var i = xml.elementsNamed("exit"); + if(!i.hasNext()) { + return null; + } + var e = i.next(); + return { area : e.get("area"), x : com_davidmaletz_mining_Main.parseFloat(e.get("x")), y : com_davidmaletz_mining_Main.parseFloat(e.get("y"))}; + } + ,getCustomFlag: function(flag) { + var xml = com_davidmaletz_mining_world_Area.getXML(this.id); + if(xml != null) { + return xml.get(flag) == "true"; + } else { + return false; + } + } + ,removeObjects: function(b,layer,overlap) { + if(overlap == null) { + overlap = 0; + } + if(layer == null) { + layer = -1; + } + var objects = []; + this.getObjects(b,function(o,rect) { + if((layer == -1 || o.getLayer() == layer) && o.info.xml.get("removable") != "false" && !o.isPlayer()) { + objects.push(o); + } + return false; + },null,overlap); + var _g = 0; + while(_g < objects.length) { + var o1 = objects[_g]; + ++_g; + this.removeObject(o1); + } + } + ,removeObjectsInLayer: function(layer) { + if(layer == null) { + layer = -1; + } + var objects = []; + var o = this.objects.iterator(); + while(o.hasNext()) { + var o1 = o.next(); + if((layer == -1 || o1.getLayer() == layer) && o1.info.xml.get("removable") != "false" && !o1.isPlayer()) { + objects.push(o1); + } + } + var _g = 0; + while(_g < objects.length) { + var o2 = objects[_g]; + ++_g; + this.removeObject(o2); + } + } + ,removeStructures: function(b,p) { + var objects = []; + this.structures.getObjects(b,function(o,rect) { + objects.push(o); + return false; + }); + var _g = 0; + while(_g < objects.length) { + var o1 = objects[_g]; + ++_g; + this.removeStructure(o1,p); + } + } + ,removeStructure: function(s,p) { + if(this.structures.removeObject(s)) { + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("rem_structure",s)); + s.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("rem_structure",s)); + if(p != null) { + s.removeBy(p); + } + s.removedFromArea(this); + } + } + ,_addStructure: function(s) { + this.structures.addObject(s); + s.__reshapeArea = this; + } + ,getStructures: function() { + return this.structures.iterator(); + } + ,getStructure: function(r,allowHitbox,filter,issect) { + if(issect == null) { + issect = 0; + } + if(allowHitbox == null) { + allowHitbox = true; + } + var best = 0; + var ret = null; + var priority = -2147483648; + this.structures.getObjects(r,function(s,r1) { + if(!s.canSelect() || filter != null && !filter(s)) { + return false; + } + var b = s.getHitBounds(allowHitbox); + if(allowHitbox && r1.get_bottom() > b.get_bottom() && s.info.xml.get("allowUnder") != "true") { + return false; + } + var p = s.info.priority; + var b1 = com_fancyfish_faeng_pack_AABBObjectList.getIntersection(r1,b); + if(b1 <= 0 || allowHitbox && s.info.xml.get("fullOverlap") == "true" && b1 < r1.width * r1.height) { + return false; + } + var pl = com_davidmaletz_mining_Main.getLocalPlayer(); + if(pl != null && s.info.playerY == 0 && (pl.area == null || s.getTooltip(pl) == null)) { + p -= 100000; + } + if(p > priority || p == priority && b1 > best) { + best = b1; + ret = s; + priority = p; + } + return false; + },null,issect); + return ret; + } + ,getStructureInTile: function(x,y) { + return this.getStructure(com_davidmaletz_mining_world_Area.getTileRect(x,y)); + } + ,overlapsStructure: function(x,y,w,h) { + if(h == null) { + h = 1; + } + if(w == null) { + w = 1; + } + var ret = false; + this.structures.getObjects(com_davidmaletz_mining_world_Area.getTileRect(x,y,w,h),function(o,rect) { + if(o.info.xml.get("back") != "true" && o.info.xml.get("remove") != "false" && rect.intersects(o.getInnerBounds())) { + ret = true; + return true; + } else { + return false; + } + }); + return ret; + } + ,getStructuresInBounds: function(r) { + var ar = []; + this.structures.getObjects(r,function(s,r1) { + ar.push(s); + return false; + }); + return ar; + } + ,getObjectsInBounds: function(r) { + var ar = []; + this.objects.getObjects(r,function(o,r1) { + ar.push(o); + return false; + }); + return ar; + } + ,getStructureById: function(id) { + var s = this.getStructures(); + while(s.hasNext()) { + var s1 = s.next(); + if(s1.info.id == id) { + return s1; + } + } + return null; + } + ,getStructuresById: function(id) { + var ar = []; + var s = this.getStructures(); + while(s.hasNext()) { + var s1 = s.next(); + if(s1.info.id == id) { + ar.push(s1); + } + } + return ar; + } + ,getStructureByClass: function(cls) { + var s = this.getStructures(); + while(s.hasNext()) { + var s1 = s.next(); + if(Std["is"](s1,cls)) { + return s1; + } + } + return null; + } + ,getMainStorehouse: function(incExternal,incRecursion) { + if(incRecursion == null) { + incRecursion = 2; + } + if(incExternal == null) { + incExternal = false; + } + var ret = null; + var s = this.getStructures(); + while(s.hasNext()) { + var s1 = s.next(); + if(Std["is"](s1,com_davidmaletz_mining_structure_Storehouse) && s1.info.xml.get("includeMain") != "true") { + if(ret == null) { + ret = s1; + } + if(s1.info.xml.get("main") == "true") { + return s1; + } + } + } + if(incExternal && this.external != null && incRecursion > 0) { + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p == null || !p.areas.exists(this.external)) { + return ret; + } + var a = p.areas.get(this.external); + var s2 = a.getMainStorehouse(true,incRecursion - 1); + if(s2 == null) { + return ret; + } else { + return s2; + } + } + return ret; + } + ,getObject: function(id) { + var o = this.objects.iterator(); + while(o.hasNext()) { + var o1 = o.next(); + if(o1.getId() == id) { + return o1; + } + } + return null; + } + ,getObjectsById: function(id) { + var ar = []; + var o = this.objects.iterator(); + while(o.hasNext()) { + var o1 = o.next(); + if(o1.getId() == id) { + ar.push(o1); + } + } + return ar; + } + ,getNPC: function(id) { + return this.getObject(id); + } + ,canGetNPC: function(id) { + var n = this.getNPC(id); + if(n != null && Std["is"](n,com_davidmaletz_mining_npc_NPC)) { + return (js_Boot.__cast(n , com_davidmaletz_mining_npc_NPC)).talking.get() == null; + } else { + return false; + } + } + ,addObject: function(object) { + this.objects.addObject(object); + } + ,objectHasPlayer: function(o) { + if(Std["is"](o,com_davidmaletz_mining_world_RideableObject)) { + var a = (js_Boot.__cast(o , com_davidmaletz_mining_world_RideableObject)).interior; + if(a != null && a != this) { + return a.hasPlayer(); + } + } + return false; + } + ,hasPlayer: function() { + if(this.dronePlayers > 0) { + return true; + } + var p = com_davidmaletz_mining_Main.getRemotePlayers(); + while(p.hasNext()) { + var p1 = p.next(); + if(p1.location == this.id) { + return true; + } + } + var o = this.objects.iterator(); + while(o.hasNext()) { + var o1 = o.next(); + if(o1.isPlayer() || this.objectHasPlayer(o1)) { + return true; + } + } + return false; + } + ,hasActivePlayer: function() { + if(this.dronePlayers > 0) { + return true; + } + var p = com_davidmaletz_mining_Main.getRemotePlayers(); + while(p.hasNext()) { + var p1 = p.next(); + if(p1.getCurrentArea() == this) { + return true; + } + } + var o = this.objects.iterator(); + while(o.hasNext()) { + var o1 = o.next(); + if(o1.isPlayer()) { + return true; + } + } + return false; + } + ,removeObject: function(object,killer,e) { + this.objects.destroyObject(object,killer,e); + } + ,moveObject: function(object,toX,toY) { + this.objects.moveObject(object,toX,toY); + } + ,getAllObjects: function() { + return this.objects.iterator(); + } + ,getObjects: function(b,func,onTile,overlap) { + if(overlap == null) { + overlap = 0.5; + } + this.objects.getObjects(b,func,onTile,overlap); + } + ,getActionObject: function(r,p,filterObject,overlap) { + if(overlap == null) { + overlap = 0.5; + } + var layer = -1000; + var ret = null; + var index = -2; + this.getObjects(r,function(o,rect) { + if(!o.getHitbox(p == null).intersects(rect)) { + return false; + } + var l = o.getLayer(); + if(!com_davidmaletz_mining_Player.TALK_QUEST && p != null && !o.hasPriority(p,false)) { + l -= 100; + } + if((filterObject == null || filterObject(o,l)) && l >= layer && (p == null || o != p && o != p.vehicle && o.getAction(p) != null)) { + var i = o.getIndex(); + if(com_davidmaletz_mining_Player.TALK_QUEST && p != null && !o.hasPriority(p,false)) { + i -= 100; + } + if(l > layer || i > index) { + layer = l; + index = i; + ret = o; + } + } + return false; + },null,overlap); + return ret; + } + ,getClosestPlayer: function(x,y) { + var closest = null; + var dist = Infinity; + var checkDist = function(p) { + if(!p.paused.get()) { + var dx = p.getVCenterX(); + var dx1 = x - dx; + var dy = p.getVCenterY(); + var dy1 = y - dy; + var d = dx1 * dx1 + dy1 * dy1; + if(d < dist) { + dist = d; + closest = p; + } + } + }; + var p1 = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p1 != null && p1.getCurrentArea() == this) { + checkDist(p1); + } + var p2 = com_davidmaletz_mining_Main.getRemotePlayers(); + while(p2.hasNext()) { + var p3 = p2.next(); + if(p3.getCurrentArea() == this) { + checkDist(p3); + } + } + return closest; + } + ,insertFill: function(queue,x,y,layer,tile,d) { + if(this.emptyTile(x,y)) { + this.setTile(x,y,layer,tile); + var n = new com_fancyfish_faeng_common_Node(x,y,null,d); + queue.push(n); + } + } + ,floodFill: function(x,y,layer,tile,maxDepth) { + if(maxDepth == null) { + maxDepth = 100; + } + var visited = new haxe_ds_IntMap(); + var queue = []; + this.insertFill(queue,x,y,layer,tile,0); + while(queue.length > 0) { + var n = queue.pop(); + var i = com_fancyfish_faeng_common_Utils.getIdx(n.x,n.y); + if(n.depth > maxDepth || visited.exists(i)) { + continue; + } + visited.set(i,true); + this.insertFill(queue,n.x - 1,n.y,layer,tile,n.depth + 1); + this.insertFill(queue,n.x,n.y - 1,layer,tile,n.depth + 1); + this.insertFill(queue,n.x + 1,n.y,layer,tile,n.depth + 1); + this.insertFill(queue,n.x,n.y + 1,layer,tile,n.depth + 1); + } + } + ,intersectsLoop: function(a,b,issect) { + if(issect == null) { + issect = 0; + } + if(a.intersects(b)) { + return true; + } + var loop = this.getLoop(); + if(loop > 0) { + var l = loop * com_davidmaletz_tiles_Tile.SIZE; + if(b.x < l * 0.5) { + b.x += l; + } else { + b.x -= l; + } + return com_fancyfish_faeng_pack_AABBObjectList.intersects(a,b,issect); + } else { + return false; + } + } + ,breakBrick: function(x,y,power,speed,speedOnly,o) { + if(speedOnly == null) { + speedOnly = false; + } + if(speed == null) { + speed = 1; + } + if(this.renderer == null) { + return false; + } + var t = this.getTileId(x,y,0); + if(t == -1) { + return false; + } + var mine_cost = com_davidmaletz_mining_world_Area.getMineCost(this.getTileIndex(t)); + var mining_speed = power - mine_cost; + if(mining_speed > 0 && !this.renderer.incBrickBreak(x,y,speedOnly ? speed : mining_speed * speed)) { + var i = this.mine(x,y,t,0,o); + if(com_davidmaletz_mining_item_ItemInfo.exists(i)) { + this.addObject(com_davidmaletz_mining_world_ObjectInfo.make(i,x * com_davidmaletz_tiles_Tile.SIZE,y * com_davidmaletz_tiles_Tile.SIZE)); + } + return true; + } + return false; + } + ,hasBlocker: function(x,y,w,h,info) { + var ret = false; + com_davidmaletz_mining_world_BaseObject.rectangle.setTo(x,y,w,h); + this.getObjects(com_davidmaletz_mining_world_BaseObject.rectangle,function(o,rect) { + if(o.isBlocking(info)) { + ret = true; + return true; + } else { + return false; + } + }); + return ret; + } + ,hasObjectInLayer: function(layer) { + var o = this.objects.iterator(); + while(o.hasNext()) { + var o1 = o.next(); + if(layer == o1.getLayer()) { + return true; + } + } + return false; + } + ,hasHostile: function() { + var o = this.objects.iterator(); + while(o.hasNext()) { + var o1 = o.next(); + if(o1.getLayer() == 4 && Std["is"](o1,com_davidmaletz_mining_enemy_Enemy) && (js_Boot.__cast(o1 , com_davidmaletz_mining_enemy_Enemy)).isHostile()) { + return true; + } + } + return false; + } + ,hasObject: function(x,y,w,h,layer) { + if(layer == null) { + layer = -1; + } + com_davidmaletz_mining_world_BaseObject.rectangle.setTo(x,y,w,h); + return this.hasObjectInBounds(com_davidmaletz_mining_world_BaseObject.rectangle,layer); + } + ,hasObjectInBounds: function(r,layer) { + if(layer == null) { + layer = -1; + } + var ret = false; + this.getObjects(r,function(o,rect) { + var tmp; + if(layer != -1) { + var tmp1 = o.getLayer(); + tmp = layer == tmp1; + } else { + tmp = true; + } + if(tmp) { + ret = true; + return true; + } else { + return false; + } + }); + return ret; + } + ,canShovel: function(id) { + var t = this.getTileIndex(id); + if(t == null) { + return true; + } else { + var xml = com_davidmaletz_mining_world_Area.getDig(t); + if(xml != null) { + return xml.get("shovel") != "false"; + } else { + return true; + } + } + } + ,getInterior: function(p) { + if(this.isOrbit() && p.areas.exists(this.id + ".station")) { + return p.areas.get(this.id + ".station"); + } else { + return null; + } + } + ,getInventory: function(b,inv) { + var ar = null; + b = b.clone(); + if(inv != null) { + if(Std["is"](inv,com_davidmaletz_mining_item_CompoundInventory)) { + ar = (js_Boot.__cast(inv , com_davidmaletz_mining_item_CompoundInventory)).inventories.slice(); + } else { + ar = [inv]; + } + } else { + ar = []; + } + if(this.vehicle != null) { + var i = this.vehicle.getBaseInventory(); + if(i != null && ar.indexOf(i) == -1) { + ar.push(i); + } + if(Std["is"](this.vehicle,com_davidmaletz_mining_world_vehicle_Vehicle)) { + var s = com_davidmaletz_mining_ui_VehicleInventory.getStorehouse(com_davidmaletz_mining_Main.getLocalPlayer(),this.vehicle); + if(s != null) { + var i1 = s.storehouse.accessInventory(); + if(i1 != null && ar.indexOf(i1) == -1) { + ar.push(i1); + } + } + } + } + this.getObjects(b,function(o,r) { + if(Std["is"](o,com_davidmaletz_mining_world_StorehouseObject)) { + var i2 = (js_Boot.__cast(o , com_davidmaletz_mining_world_StorehouseObject)).inventory; + if(ar.indexOf(i2) == -1) { + ar.push(i2); + } + } + return false; + },null,0); + this.structures.getObjects(b,function(s1,r1) { + var i3 = s1.accessInventory(); + if(i3 != null && ar.indexOf(i3) == -1) { + ar.push(i3); + } + return false; + }); + if(ar.length == 1) { + return ar[0]; + } else { + var ret = new com_davidmaletz_mining_item_CompoundInventory(ar); + new com_davidmaletz_faengfl_InvokeLater(function() { + ret.destroy(); + },0); + return ret; + } + } + ,hasObjectInTile: function(tile_x,tile_y,layer,ignore) { + if(layer == null) { + layer = -1; + } + var i = this.getObjectsInTile(tile_x,tile_y); + if(layer == -1 && ignore == null) { + return i.hasNext(); + } + while(i.hasNext()) { + var o = i.next(); + if(o != ignore && o.getLayer() == layer) { + return true; + } + } + return false; + } + ,hasObjectIdInTile: function(id,tile_x,tile_y) { + var i = this.getObjectsInTile(tile_x,tile_y); + while(i.hasNext()) if(i.next().info.id == id) { + return true; + } + return false; + } + ,getObjectsInTile: function(tile_x,tile_y) { + return this.objects.getObjectsInTile(tile_x,tile_y); + } + ,addProjectile: function(p) { + this.projectiles.push(p); + p.addToArea(this); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("add_projectile",p)); + } + ,removeProjectile: function(p) { + if(HxOverrides.remove(this.projectiles,p)) { + p.removeFromArea(this); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("rem_projectile",p)); + } + } + ,getProjectiles: function() { + return HxOverrides.iter(this.projectiles); + } + ,write: function(o) { + var b = new haxe_io_BytesOutput(); + com_davidmaletz_tiles_TileMap.prototype.write.call(this,b); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.__name); + var s = this.getStructures(); + while(s.hasNext()) { + var s1 = s.next(); + com_davidmaletz_mining_structure_Structure.save(s1,b); + } + com_davidmaletz_mining_structure_Structure.writeNull(b); + var o1 = this.objects.iterator(); + while(o1.hasNext()) { + var o2 = o1.next(); + if(o2.canSave() && o2.info.id != null) { + com_davidmaletz_mining_world_Object.save(o2,b); + } + } + com_davidmaletz_mining_world_Object.writeNull(b); + if(this.openTiles != null) { + var _g = 0; + var _g1 = this.openTiles; + while(_g < _g1.length) { + var n = _g1[_g]; + ++_g; + b.writeInt16(n.x); + b.writeInt16(n.y); + } + } + b.writeInt16(-32768); + this.spawner.write(b); + if(com_davidmaletz_mining_world_Area.__WRITE_IDS && this.__id >= 0) { + b.writeUInt16(this.__id & 65535); + } + var bytes = b.getBytes(); + var len = bytes.length; + o.writeUInt24(len); + o.writeFullBytes(bytes,0,len); + } + ,set_name: function(n) { + if(n != this.__name) { + this.__name = n; + this.dispatchEvent(new openfl_events_Event("update_name")); + } + return n; + } + ,get_name: function() { + if(this.vehicle == null || this.__name != null) { + return this.__name; + } else { + return this.vehicle.getName(); + } + } + ,getTileString: function(x,y,layer) { + var t = this.getTile(x,y,layer); + if(t == null) { + return null; + } else { + return t.id; + } + } + ,getFlags: function(x,y) { + return this.getTileId(x,y,2) + 1; + } + ,hasFlags: function(x,y,flags) { + return (this.getFlags(x,y) & flags) == flags; + } + ,setFlags: function(x,y,flags) { + this.setTile(x,y,2,flags - 1); + } + ,addFlags: function(x,y,flags) { + this.setFlags(x,y,this.getFlags(x,y) | flags); + } + ,isOpenWater: function(x,y) { + if(y >= this.waterLevel) { + return this.emptyTile(x,y); + } else { + return false; + } + } + ,isWater: function(x,y) { + if(!this.isOpenWater(x,y)) { + return this.hasFlags(x,y,4); + } else { + return true; + } + } + ,isTrueWater: function(x,y) { + if(!this.isOpenWater(x,y)) { + return this.hasFlags(x,y,128); + } else { + return true; + } + } + ,getWaterDepth: function(x,y) { + if(this.isWater(x,y)) { + return y - this.waterLevel; + } else { + return 0; + } + } + ,setWater: function(x,y) { + if(this.getTileId(x,y,3) != -1 && !this.hasFlags(x,y,132)) { + this.addFlags(x,y,132); + this.addAdjacentOpen(x,y); + this.addToOpen(x,y); + } + } + ,removeWaterLater: function(x,y) { + if(this.hasFlags(x,y,128)) { + this.setFlags(x,y,this.getFlags(x,y) & -129); + this.addToOpen(x,y); + this.addAdjacentOpen(x,y); + } + } + ,removeWater: function(x,y) { + if(this.hasFlags(x,y,4)) { + this.setFlags(x,y,this.getFlags(x,y) & -133); + if(this.openTiles != null) { + var _g = 0; + var _g1 = this.openTiles; + while(_g < _g1.length) { + var n = _g1[_g]; + ++_g; + if(n.x == x && n.y == y) { + HxOverrides.remove(this.openTiles,n); + break; + } + } + } + this.addAdjacentOpen(x,y); + } + } + ,addAdjacentOpen: function(x,y) { + var xplus = this.__loopX(x + 1); + var xminus = this.__loopX(x - 1); + if(this.isTrueWater(x,y - 1)) { + this.addToOpen(x,y - 1); + } + if(this.isTrueWater(xminus,y)) { + this.addToOpen(xminus,y); + } + if(this.isTrueWater(xplus,y)) { + this.addToOpen(xplus,y); + } + if(this.isTrueWater(x,y + 1)) { + this.addToOpen(x,y + 1); + } + } + ,isWaterBlock: function(x,y) { + return this.hasFlags(x,y,8); + } + ,setWaterBlock: function(x,y) { + this.addFlags(x,y,8); + this.removeWater(x,y); + } + ,removeWaterBlock: function(x,y) { + this.setFlags(x,y,this.getFlags(x,y) & -9); + this.removeWaterTile(x,y); + } + ,hasOpenTile: function(x,y) { + if(this.openTiles != null) { + var _g = 0; + var _g1 = this.openTiles; + while(_g < _g1.length) { + var n = _g1[_g]; + ++_g; + if(n.x == x && n.y == y) { + return true; + } + } + } + return false; + } + ,addToOpen: function(x,y,forceAdd) { + if(forceAdd == null) { + forceAdd = false; + } + var loop = this.objects.loop; + if(loop < 0 || x >= 0 && x < loop) { + if(this.openTiles == null) { + this.openTiles = [new com_fancyfish_faeng_common_Node(x,y)]; + } else if(forceAdd || !this.hasOpenTile(x,y)) { + this.openTiles.push(new com_fancyfish_faeng_common_Node(x,y)); + } + } + } + ,removeWaterTile: function(x,y) { + this.removeWater(x,y); + this.addAdjacentOpen(x,y); + } + ,isLit: function(x,y) { + return (this.getFlags(x,y) & 1) != 0; + } + ,setLit: function(x,y) { + this.addFlags(x,y,1); + } + ,setUnlit: function(x,y) { + this.setFlags(x,y,this.getFlags(x,y) & -2); + } + ,isBlockNPC: function(x,y) { + return (this.getFlags(x,y) & 16) != 0; + } + ,setBlockNPC: function(x,y) { + this.addFlags(x,y,16); + } + ,unsetBlockNPC: function(x,y) { + this.setFlags(x,y,this.getFlags(x,y) & -17); + } + ,isBlockPlayer: function(x,y) { + return (this.getFlags(x,y) & 64) != 0; + } + ,setBlockPlayer: function(x,y) { + this.addFlags(x,y,64); + } + ,unsetBlockPlayer: function(x,y) { + this.setFlags(x,y,this.getFlags(x,y) & -65); + } + ,isBlockVehicle: function(x,y) { + if((this.getFlags(x,y) & 32) == 0) { + return this.isBlockPlayer(x,y); + } else { + return true; + } + } + ,setBlockVehicle: function(x,y) { + this.addFlags(x,y,32); + } + ,unsetBlockVehicle: function(x,y) { + this.setFlags(x,y,this.getFlags(x,y) & -33); + } + ,setLightTile: function(x,y) { + if(this.getTileId(x,y,0) != -1 || this.getTileId(x,y,3) != -1) { + this.setLit(x,y); + } + } + ,insertNode: function(queue,x,y,parent,visited) { + var i = com_fancyfish_faeng_common_Utils.getIdx(x,y); + if(!visited.exists(i)) { + visited.set(i,true); + this.setLightTile(x,y); + queue.addLast(new com_fancyfish_faeng_common_Node(x,y,parent)); + } + } + ,emptyTile: function(x,y) { + if(this.getTileId(x,y,0) == -1) { + return this.getTileId(x,y,3) == -1; + } else { + return false; + } + } + ,isEmptyTile: function(x,y) { + if(com_davidmaletz_mining_world_Area.isEmpty(this.getTile(x,y,0))) { + return com_davidmaletz_mining_world_Area.isEmpty(this.getTile(x,y,3)); + } else { + return false; + } + } + ,isGrass: function(x,y) { + var t = this.getTile(x,y,0); + if(t == null) { + t = this.getTile(x,y,3); + } + if(t == null) { + return false; + } + var xml = com_davidmaletz_mining_world_Area.getDig(t); + if(xml != null) { + return xml.get("grass") == "true"; + } else { + return false; + } + } + ,lightTiles: function(x,y,light,w,h) { + if(h == null) { + h = 1; + } + if(w == null) { + w = 1; + } + if(light <= 0) { + return; + } + --light; + var queue = new com_fancyfish_faeng_common_Dequeue(); + var visited = new haxe_ds_IntMap(); + var _g1 = 0; + var _g = h; + while(_g1 < _g) { + var ty = _g1++; + var _g3 = 0; + var _g2 = w; + while(_g3 < _g2) { + var tx = _g3++; + this.insertNode(queue,x + tx,y + ty,null,visited); + } + } + while(!queue.isEmpty()) { + var n = queue.removeFirst(); + if(n.depth >= light) { + break; + } + this.insertNode(queue,n.x + 1,n.y,n,visited); + this.insertNode(queue,n.x - 1,n.y,n,visited); + this.insertNode(queue,n.x,n.y + 1,n,visited); + this.insertNode(queue,n.x,n.y - 1,n,visited); + } + } + ,getPlanet: function(incExternal) { + if(incExternal == null) { + incExternal = true; + } + if(this.vehicle != null) { + return this.vehicle.area.getPlanet(incExternal); + } + if(this.planet != null) { + return this.planet; + } + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p == null) { + return null; + } + if(incExternal && this.external != null && this.external != this.id && p.areas.exists(this.external)) { + return p.areas.get(this.external).getPlanet(false); + } + return null; + } + ,getSystem: function() { + var p = this.getPlanet(); + if(p == null) { + return null; + } else { + return p.system; + } + } + ,update_autotile: function(x,y,layer,tile) { + if(layer != 1) { + if(layer == 2) { + return (tile + 1 & 4) != 0; + } else { + return false; + } + } else { + return true; + } + } + ,getBaseTile: function(x,y) { + var ret = this.getTileId(x,y,0); + if(ret == -1) { + return this.getTileId(x,y,3); + } else { + return ret; + } + } + ,setTile: function(x,y,layer,tile) { + var power = false; + if(layer == 1) { + var old = com_davidmaletz_mining_item_ItemInfo._get(this.getTileString(x,y,layer)); + var t = this.getTileIndex(tile); + var oldp = old != null && old.xml.get("powered") == "true"; + var newp; + if(t != null) { + var i = com_davidmaletz_mining_item_ItemInfo._get(t.id); + if(i != null) { + newp = i.xml.get("powered") == "true"; + } else { + newp = false; + } + } else { + newp = false; + } + power = oldp != newp; + } + var ret = com_davidmaletz_tiles_TileMap.prototype.setTile.call(this,x,y,layer,tile); + var loop = this.getLoop(); + if(ret) { + this.dispatchEvent(new com_davidmaletz_mining_world_TileEvent("set_tile",this,x,y,layer,tile)); + } + if(loop > 0) { + if(x <= 24) { + com_davidmaletz_tiles_TileMap.prototype.setTile.call(this,x + loop,y,layer,tile); + } else if(x >= loop - 24) { + com_davidmaletz_tiles_TileMap.prototype.setTile.call(this,x - loop,y,layer,tile); + } + } + if(this.isInit) { + if(layer == 0) { + if(tile == -1 && !this.isWaterBlock(x,y)) { + this.addAdjacentOpen(x,y); + } else { + this.removeWater(x,y); + } + } else if(layer == 3) { + if(tile != -1 && !this.isWaterBlock(x,y)) { + this.addAdjacentOpen(x,y); + } else if(tile == -1 && this.getTile(x,y,0) == null) { + this.removeWater(x,y); + } + } + } + if(power) { + this.dispatchEvent(new openfl_events_Event("update_cables")); + } + return ret; + } + ,mine: function(x,y,back,light,object) { + var item = null; + if(this.getTileId(x,y,3) == -1) { + var xml = com_davidmaletz_mining_world_Area.getDig(this.getTileIndex(back)); + if(xml != null && xml.exists("back")) { + var tid = xml.get("back"); + if(!com_davidmaletz_tiles_Tile.exists(tid)) { + back = -1; + } else { + back = this.addTileIndex(tid); + } + } + this.setTile(x,y,3,back); + } + this.setTile(x,y,0,-1); + var ore = this.getTileId(x,y,1); + if(ore != -1) { + this.setTile(x,y,1,-1); + var t = this.getTileIndex(ore); + if(t != null) { + item = t.id; + } + } + this.lightTiles(x,y,light); + this.dispatchEvent(new com_davidmaletz_mining_world_MineEvent("mine",this,x,y,light,object)); + return item; + } + ,isFishable: function(x,y) { + if(this.getTileId(x,y,0) != -1) { + return -1; + } else { + if(!this.isWater(x,y + 1)) { + return 0; + } + var xml = com_davidmaletz_mining_world_Generate.get(this.id); + if(xml != null && xml.elementsNamed("fishing").hasNext()) { + return 1; + } else if(com_davidmaletz_mining_effects_Fishing.hasDefault()) { + return 1; + } else { + return 0; + } + } + } + ,updateChunk: function(c,version) { + var _g = 0; + while(_g < 16) { + var y = _g++; + var _g1 = 0; + while(_g1 < 16) { + var x = _g1++; + var i = c.getTile(x,y,2); + if(version < 42) { + c.setTile(x,y,i == 254 ? -1 : 0,2); + } else if((i + 1 & 4) != 0) { + var cx = c.x * 16 + x; + var cy = c.y * 16 + y; + this.addFlags(cx,cy,128); + if(!this.isWater(cx,cy + 1) || !this.isWater(cx - 1,cy) || !this.isWater(cx + 1,cy)) { + this.addToOpen(cx,cy,true); + } + } else if(c.getTile(x,y,3) != -1 && c.getTile(x,y,0) == -1) { + var cx1 = c.x * 16 + x; + var cy1 = c.y * 16 + y; + if(this.isOpenWater(cx1 - 1,cy1)) { + this.addToOpen(cx1 - 1,cy1); + } + if(this.isOpenWater(cx1 + 1,cy1)) { + this.addToOpen(cx1 + 1,cy1); + } + if(this.isOpenWater(cx1,cy1 - 1)) { + this.addToOpen(cx1,cy1 - 1); + } + } + } + } + } + ,updateChunks: function(version) { + var c = this.floor.iterator(); + while(c.hasNext()) { + var c1 = c.next(); + this.updateChunk(c1,version); + } + } + ,read: function(b,version) { + this.runInit = false; + com_davidmaletz_tiles_TileMap.prototype.read.call(this,b,version); + if(version >= 43) { + this.__name = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + } + if(version < 33) { + var _g = 1; + while(_g < 95) { + var y = _g++; + var _g1 = 1; + while(_g1 < 95) { + var x = _g1++; + if(this.getTileId(x,y,0) == -1 && this.getTileId(x,y,3) == -1) { + this.setTile(x,y,3,this.addTileIndex("dirt")); + } + } + } + } + while(com_davidmaletz_mining_structure_Structure.load(b,version,$bind(this,this._addStructure))) { + } + while(com_davidmaletz_mining_world_Object.load(b,version,$bind(this,this.addObject))) { + } + if(version >= 14 && version < 25) { + while(com_davidmaletz_mining_world_Projectile.load(b,version)) { + } + } + if(version < 31) { + this.id = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + } + this.readXml(); + if(version < 80) { + this.updateChunks(version); + } else { + this.openTiles = []; + var x1; + while(true) { + x1 = b.readInt16(); + if(!(x1 != -32768)) { + break; + } + this.addToOpen(x1,b.readInt16(),true); + } + } + if(this.spawner == null) { + this.spawner = new com_davidmaletz_mining_enemy_EnemySpawnerHandler(this); + } + this.spawner.read(b,version); + if(version >= 75) { + try { + var id = b.readUInt16(); + if(id >= 0) { + this.__loadId(id); + } + } catch( e ) { + haxe_CallStack.lastException = e; + } + } + var s = this.getStructures(); + while(s.hasNext()) { + var s1 = s.next(); + s1.__reshapeArea = null; + s1.addedToArea(this,false); + } + if(version <= 45 && this.id == "start") { + var t = this.getTile(1,95,0); + if(t == null || t.id != "bedrock") { + var tile = this.addTileIndex("bedrock"); + var _g2 = 0; + while(_g2 < 96) { + var i = _g2++; + this.setTile(i,95,0,tile); + } + } + } + } + ,onLoad: function(r,player,ver) { + com_davidmaletz_mining_world_Generate.runAction(this.runInit ? "init" : "onLoad",r,player,ver); + this.runInit = false; + } + ,setVehicle: function(v) { + if(this.vehicle != v && this.vehicle.area != null) { + var old = this.vehicle; + var a = this.vehicle.area; + this.vehicle.interior = null; + if(v.area != a) { + if(v.area != null) { + v.area.removeObject(v); + } + a.addObject(v); + } + this.vehicle = v; + v.interior = this; + v.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("change_vehicle",this)); + old.dispatchEvent(new openfl_events_Event("stop_watch")); + a.removeObject(old); + v.interiorInit(); + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p != null && p.getCurrentArea() == this) { + var v1 = p.vehicle; + var r = null; + if(v1 != null) { + r = v1.renderer; + } + com_davidmaletz_mining_Main.setArea(com_davidmaletz_mining_Main.getGameScale(),this,81,r); + } + } + } + ,shouldLight: function() { + var xml = com_davidmaletz_mining_world_Generate.get(this.id); + if(xml != null) { + return xml.get("shouldLight") != "false"; + } else { + return true; + } + } + ,canFly: function() { + var xml = com_davidmaletz_mining_world_Generate.get(this.id); + if(xml != null) { + return xml.get("canFly") != "false"; + } else { + return true; + } + } + ,isOrbitInterior: function() { + if(!this.isOrbit()) { + if(this.vehicle != null && this.vehicle.area != null) { + return this.vehicle.area.isOrbit(); + } else { + return false; + } + } else { + return true; + } + } + ,isOrbit: function() { + var xml = com_davidmaletz_mining_world_Generate.get(this.id); + if(xml != null) { + return xml.nodeName() == "orbit"; + } else { + return false; + } + } + ,isLooping: function() { + var xml = com_davidmaletz_mining_world_Generate.get(this.id); + if(xml != null) { + return xml.get("looping") == "true"; + } else { + return false; + } + } + ,viewHidden: function() { + var xml = com_davidmaletz_mining_world_Generate.get(this.id); + if(xml != null) { + return xml.get("viewHidden") == "true"; + } else { + return false; + } + } + ,fixedCamera: function() { + var xml = com_davidmaletz_mining_world_Generate.get(this.id); + if(xml != null) { + return xml.get("camera") == "fixed"; + } else { + return false; + } + } + ,shouldRunInit: function(p) { + var xml = com_davidmaletz_mining_world_Generate.get(this.id); + if(xml != null && xml.exists("runInit")) { + return com_davidmaletz_faengfl_EventHandler._conditionMet(xml.get("runInit"),com_davidmaletz_mining_npc_NPCEventHandler.createVariables(p)); + } else { + return false; + } + } + ,isVisitable: function(p) { + if(!(this.planet == null || this.isOrbit())) { + return this.planet.orbit.canEnterPlanet(p); + } else { + return true; + } + } + ,getDropoff: function() { + var xml = com_davidmaletz_mining_world_Generate.get(this.id); + if(xml != null) { + if(xml.exists("dropoff")) { + return com_davidmaletz_mining_Main.parseFloat(xml.get("dropoff")); + } else if(xml.nodeName() == "orbit") { + return 0; + } + } + return 0.002; + } + ,clearReturn: function() { + var xml = com_davidmaletz_mining_world_Generate.get(this.id); + if(xml == null || !xml.exists("clearReturn")) { + if(this.left != null) { + return this.right != null; + } else { + return false; + } + } else { + return xml.get("clearReturn") == "true"; + } + } + ,vars: null + ,getVars: function() { + if(this.vars == null) { + this.vars = com_davidmaletz_faengfl_EventHandler.createVariables(); + this.vars.set("this",this); + } + return this.vars; + } + ,getBackDarkness: function() { + var xml = com_davidmaletz_mining_world_Generate.get(this.id); + if(xml != null && xml.exists("backDarkness")) { + return Std.parseFloat(xml.get("backDarkness")); + } else { + return 0.5; + } + } + ,showLightTiles: function() { + var xml = com_davidmaletz_mining_world_Generate.get(this.id); + if(xml != null) { + return xml.get("lightTiles") != "false"; + } else { + return true; + } + } + ,isPowered: function() { + var xml = com_davidmaletz_mining_world_Generate.get(this.id); + if(xml != null) { + return com_davidmaletz_faengfl_EventHandler.execute(xml.get("powered"),this.getVars()) == true; + } else { + return false; + } + } + ,isTemporary: function() { + var xml = com_davidmaletz_mining_world_Generate.get(this.id); + if(xml != null) { + return xml.get("temporary") == "true"; + } else { + return false; + } + } + ,forceNPCWander: function() { + var xml = com_davidmaletz_mining_world_Generate.get(this.id); + if(xml != null) { + return xml.get("forceNPCWander") == "true"; + } else { + return false; + } + } + ,generateO2: null + ,hasOxygen: function() { + if(this.vehicle == null) { + if(!(this.hasO2 || this.generateO2 >= 1)) { + if(this.hasO2Func != null) { + return this.hasO2Func(); + } else { + return false; + } + } else { + return true; + } + } else if(!this.vehicle.hasO2) { + if(this.vehicle.area != null) { + return this.vehicle.area.hasOxygen(); + } else { + return false; + } + } else { + return true; + } + } + ,getLoop: function() { + return this.structures.loop; + } + ,getWidth: function() { + return this.definedWidth; + } + ,getDisplay: function() { + return com_davidmaletz_mining_world_Area.getName(this.get_name(),this.id); + } + ,isActivePlayer: function() { + return true; + } + ,adjustDx: function(dx) { + var loop = this.getLoop(); + if(loop > 0) { + loop *= com_davidmaletz_tiles_Tile.SIZE; + if(dx > loop * 0.5) { + dx -= loop; + } else if(dx < -loop * 0.5) { + dx += loop; + } + } + return dx; + } + ,__id: null + ,__assignId: function() { + if(this.__id < 0) { + this.__loadId(com_davidmaletz_mining_world_Area.__current_id++); + } + } + ,__loadId: function(id) { + this.__id = id; + com_davidmaletz_mining_world_Area.__areas.set(id,this); + com_davidmaletz_mining_world_Area.__area_ids.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("add_area",this)); + } + ,__recycleId: function() { + if(this.__id >= 0) { + com_davidmaletz_mining_world_Area.__areas.remove(this.__id); + com_davidmaletz_mining_world_Area.__area_ids.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("remove_area",this)); + this.__id = -1; + } + } + ,__class__: com_davidmaletz_mining_world_Area + ,__properties__: {set_name:"set_name",get_name:"get_name"} +}); +var com_davidmaletz_mining_world_MineEvent = function(type,v,x,y,l,o) { + openfl_events_Event.call(this,type); + this.area = v; + this.light = l; + this.x = x; + this.y = y; + this.object = o; +}; +$hxClasses["com.davidmaletz.mining.world.MineEvent"] = com_davidmaletz_mining_world_MineEvent; +com_davidmaletz_mining_world_MineEvent.__name__ = ["com","davidmaletz","mining","world","MineEvent"]; +com_davidmaletz_mining_world_MineEvent.__super__ = openfl_events_Event; +com_davidmaletz_mining_world_MineEvent.prototype = $extend(openfl_events_Event.prototype,{ + area: null + ,light: null + ,x: null + ,y: null + ,object: null + ,__class__: com_davidmaletz_mining_world_MineEvent +}); +var com_davidmaletz_mining_world_TileEvent = function(type,v,x,y,l,t) { + openfl_events_Event.call(this,type); + this.area = v; + this.x = x; + this.y = y; + this.layer = l; + this.tile = t; +}; +$hxClasses["com.davidmaletz.mining.world.TileEvent"] = com_davidmaletz_mining_world_TileEvent; +com_davidmaletz_mining_world_TileEvent.__name__ = ["com","davidmaletz","mining","world","TileEvent"]; +com_davidmaletz_mining_world_TileEvent.__super__ = openfl_events_Event; +com_davidmaletz_mining_world_TileEvent.prototype = $extend(openfl_events_Event.prototype,{ + area: null + ,x: null + ,y: null + ,layer: null + ,tile: null + ,__class__: com_davidmaletz_mining_world_TileEvent +}); +var com_davidmaletz_mining_world_Areas = function() { + openfl_events_EventDispatcher.call(this); + this.map = new haxe_ds_StringMap(); +}; +$hxClasses["com.davidmaletz.mining.world.Areas"] = com_davidmaletz_mining_world_Areas; +com_davidmaletz_mining_world_Areas.__name__ = ["com","davidmaletz","mining","world","Areas"]; +com_davidmaletz_mining_world_Areas.read = function(b,version) { + var areas = new com_davidmaletz_mining_world_Areas(); + if(version < 31) { + var area = com_davidmaletz_mining_world_Area.readArea(null,b,version); + if(area != null) { + areas.map.set(area.id,area); + } + } else { + while(true) { + var id = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(id == null) { + break; + } + try { + var area1 = com_davidmaletz_mining_world_Area.readArea(id,b,version); + if(area1 != null) { + areas.map.set(id,area1); + area1.__assignId(); + } + } catch( e ) { + haxe_CallStack.lastException = e; + haxe_Log.trace("Failed to read area: " + id,{ fileName : "Areas.hx", lineNumber : 88, className : "com.davidmaletz.mining.world.Areas", methodName : "read"}); + break; + } + } + } + return areas; +}; +com_davidmaletz_mining_world_Areas.__super__ = openfl_events_EventDispatcher; +com_davidmaletz_mining_world_Areas.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + map: null + ,get: function(id) { + var area = this.map.get(id); + if(area == null) { + area = com_davidmaletz_mining_world_Generate.create(id,this); + area.__assignId(); + this.receiveArea(id,area); + } + return area; + } + ,set: function(id,area) { + this.__remove(id); + this.map.set(id,area); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("add_area",area)); + } + ,__get: function(id) { + return this.map.get(id); + } + ,receiveArea: function(id,area) { + area.init(); + this.set(id,area); + } + ,remove: function(id) { + return this.__remove(id); + } + ,__removeArea: function(area) { + area.destroy(); + area.__recycleId(); + this.map.remove(area.id); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("remove_area",area)); + } + ,__remove: function(id) { + var area = this.map.get(id); + if(area != null) { + area.destroy(); + area.__recycleId(); + this.map.remove(id); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("remove_area",area)); + return true; + } else { + return false; + } + } + ,init: function(p) { + var a = p.getCurrentArea(); + if(a != null && this.map.get(a.id) != a) { + a.init(); + } + var a1 = this.map.iterator(); + while(a1.hasNext()) { + var a2 = a1.next(); + a2.init(); + } + } + ,destroy: function(p) { + var a = p.getCurrentArea(); + if(a != null && this.map.get(a.id) != a) { + a.destroy(); + } + var a1 = this.map.iterator(); + while(a1.hasNext()) { + var a2 = a1.next(); + a2.destroy(); + } + } + ,exists: function(id) { + return this.map.exists(id); + } + ,iterator: function() { + return this.map.iterator(); + } + ,write: function(b) { + var id = this.map.keys(); + while(id.hasNext()) { + var id1 = id.next(); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,id1); + this.map.get(id1).write(b); + } + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + } + ,__class__: com_davidmaletz_mining_world_Areas +}); +var com_davidmaletz_mining_world_MoveKeyframe = function(o,_x,_y) { + if(_y == null) { + _y = 0; + } + if(_x == null) { + _x = 0; + } + this.obj = o; + this.x = _x; + this.y = _y; +}; +$hxClasses["com.davidmaletz.mining.world.MoveKeyframe"] = com_davidmaletz_mining_world_MoveKeyframe; +com_davidmaletz_mining_world_MoveKeyframe.__name__ = ["com","davidmaletz","mining","world","MoveKeyframe"]; +com_davidmaletz_mining_world_MoveKeyframe.__interfaces__ = [com_davidmaletz_lerp_Keyframe]; +com_davidmaletz_mining_world_MoveKeyframe.prototype = { + obj: null + ,frame: null + ,x: null + ,y: null + ,set: function(from) { + var k = js_Boot.__cast(from , com_davidmaletz_mining_world_MoveKeyframe); + this.obj = k.obj; + this.x = k.x; + this.y = k.y; + } + ,setFromObject: function(a) { + this.x = this.obj.xPos; + this.y = this.obj.yTile; + } + ,getFrame: function() { + return this.frame; + } + ,setFrame: function(f) { + this.frame = f; + } + ,interp: function(track,other,f) { + f = com_fancyfish_faeng_common_Utils.clamp(f,0,1); + var k = js_Boot.__cast(other , com_davidmaletz_mining_world_MoveKeyframe); + return new com_davidmaletz_mining_world_MoveKeyframe(this.obj,Math.round(track.interp(this.x,k.x,f)),Math.round(track.interp(this.y,k.y,f))); + } + ,apply: function(a) { + this.obj.setPosition(this.x,this.y); + } + ,__class__: com_davidmaletz_mining_world_MoveKeyframe +}; +var com_davidmaletz_mining_world_BasicObject = function(info,x,y) { + this._offsetY = 0; + this._offsetX = 0; + com_davidmaletz_mining_world_TooltipObject.call(this,info,x,y); + if(info.xml.exists("width")) { + this._width = com_davidmaletz_mining_Main.parseInt(info.xml.get("width")); + } else if(info.tile != null) { + this._width = com_davidmaletz_tiles_Tile.get(info.tile).getWidth(); + } + if(info.xml.exists("height")) { + this._height = com_davidmaletz_mining_Main.parseInt(info.xml.get("height")); + } else if(info.tile != null) { + this._height = com_davidmaletz_tiles_Tile.get(info.tile).getHeight(); + } + var e = info.xml.elementPathsNamed("overlap"); + while(e.hasNext()) { + var e1 = e.next(); + if(e1.exists("object")) { + if(this.overlap == null) { + this.overlap = new haxe_ds_StringMap(); + } + this.overlap.set(e1.get("object"),e1); + } + } + this.vars = com_davidmaletz_faengfl_EventHandler.createVariables(); + this.vars.set("this",this); + var i = info.xml.elementsNamed("onFrame"); + if(i.hasNext()) { + try { + this.onFrame = com_davidmaletz_faengfl_EventHandler.parseString(com_fancyfish_faeng_common_Lang.escape(i.next().firstChild().get_nodeValue())); + } catch( e2 ) { + haxe_CallStack.lastException = e2; + } + } + var l = this.getLight(info); + if(l != null) { + this.light = this.makeLight(l); + } + if(info.xml.exists("tileOffsetX")) { + this._offsetX = com_davidmaletz_mining_Main.parseInt(info.xml.get("tileOffsetX")); + } + if(info.xml.exists("tileOffsetY")) { + this._offsetY = com_davidmaletz_mining_Main.parseInt(info.xml.get("tileOffsetY")); + } + this.runEvent("init",null); +}; +$hxClasses["com.davidmaletz.mining.world.BasicObject"] = com_davidmaletz_mining_world_BasicObject; +com_davidmaletz_mining_world_BasicObject.__name__ = ["com","davidmaletz","mining","world","BasicObject"]; +com_davidmaletz_mining_world_BasicObject.__interfaces__ = [com_davidmaletz_faengfl_EnterFrameHandler]; +com_davidmaletz_mining_world_BasicObject.__super__ = com_davidmaletz_mining_world_TooltipObject; +com_davidmaletz_mining_world_BasicObject.prototype = $extend(com_davidmaletz_mining_world_TooltipObject.prototype,{ + overlap: null + ,vars: null + ,onFrame: null + ,light: null + ,_offsetX: null + ,_offsetY: null + ,__is_owner: null + ,makeLight: function(l) { + var tw = com_davidmaletz_tiles_Tile.SIZE >> 1; + return new com_davidmaletz_mining_world_Light(l,this.xPos + tw,this.yTile + tw); + } + ,getLight: function(info) { + return info.light; + } + ,addedToArea: function() { + com_davidmaletz_mining_world_TooltipObject.prototype.addedToArea.call(this); + this.vars.set("area",this.area); + this.runEvent("addedToArea",null); + if(this.light != null) { + this.light.addToArea(this.area); + } + } + ,removedFromArea: function(area) { + if(this.light != null) { + this.light.removeFromArea(area); + } + } + ,moveRenderer: function(old_x,old_y,init) { + if(init == null) { + init = false; + } + var _gthis = this; + com_davidmaletz_mining_world_TooltipObject.prototype.moveRenderer.call(this,old_x,old_y,init); + var _g = this.renderer; + _g.set_x(_g.get_x() + this._offsetX); + var _g1 = this.renderer; + _g1.set_y(_g1.get_y() + this._offsetY); + if(!init && this.overlap != null && this.area != null && this.area.isActivePlayer()) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + var objects = []; + this.getOverlap(function(o,rect) { + if(_gthis.overlap.exists(o.info.id)) { + objects.push(o); + } + return false; + }); + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(objects.length > 0 && p != null) { + var vars = com_davidmaletz_faengfl_EventHandler.createVariables(); + var _g2 = 0; + while(_g2 < objects.length) { + var o1 = objects[_g2]; + ++_g2; + vars.set("object",o1); + new com_davidmaletz_mining_npc_NPCEventHandler(this.overlap.get(o1.info.id).elements(),p,this,null,vars).runAll(); + } + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + if(this.area != null && this.area.getTile(this.get_tile_x(),this.get_tile_y(),0) != null) { + this.runEvent("overTile",null); + } + if(init) { + var old1 = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + this.runEvent("initRenderer",null); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old1; + } + if(this.light != null) { + var tw = com_davidmaletz_tiles_Tile.SIZE >> 1; + this.light.setPosition(this.xPos + tw,this.yTile + tw); + } + } + ,tileMap: null + ,getTileById: function(id) { + if(this.tileMap == null) { + return null; + } else { + return this.tileMap.get(id); + } + } + ,addBefore: function(s,id) { + var t = this.getTileById(id); + if(t != null) { + t.parent.addChildAt(s,t.parent.getChildIndex(t) - 1); + } + } + ,removeObject: function(p) { + if(this.area != null) { + this.area.removeObject(this); + } + } + ,complete: function(p) { + if(this.__is_owner) { + var f = $bind(this,this.removeObject); + var p1 = p; + this.runEvent("onComplete",null,function() { + f(p1); + }); + } else if(this.info.xml.get("save") != "false" || this.parent != null) { + this.removeObject(p); + } + } + ,init: function(e) { + com_davidmaletz_faengfl_FaengFL.addEnterFrame(this); + com_davidmaletz_mining_world_Object.playObject(this,"spawn"); + } + ,destroy: function(e) { + com_davidmaletz_faengfl_FaengFL.removeEnterFrame(this); + } + ,enter_frame: function(frames) { + if(this.onFrame != null && this.__is_owner) { + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + try { + this.vars.set("frames",frames); + com_davidmaletz_faengfl_EventHandler.interpret(this.onFrame,this.vars); + } catch( e ) { + haxe_CallStack.lastException = e; + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + } + } + ,createRenderer: function() { + var info = this.getInfo(); + if(info.tile == null) { + return null; + } else { + var vars = com_davidmaletz_faengfl_EventHandler.createVariables(); + var remc = info.xml.get("removeOnComplete") == "true"; + vars.set("this",this); + if(info.xml.exists("sfx")) { + this.playSound(info.xml.get("sfx")); + } + var s; + if(info.xml.get("renderer") == "attack") { + s = new com_davidmaletz_mining_renderer_BasicAttackRenderer(info.tile,this,[]); + } else { + s = com_davidmaletz_mining_structure_Structure.makeRenderer(this,info.xml,com_davidmaletz_tiles_Tile.get(info.tile),com_davidmaletz_mining_npc_NPCEventHandler.evalString(info.animation,vars),com_davidmaletz_mining_enemy_AttackRenderer.getFPS(info.xml,10),!remc,vars,remc ? $bind(this,this.complete) : null,-0.5,-0.5); + } + s.set_x(Math.floor(this.getCenterX()) + this._offsetX); + s.set_y(Math.floor(this.getCenterY() + this.getOffsetY()) + this._offsetY); + this.tileMap = com_davidmaletz_mining_structure_Structure._addOverlay(info.xml,this,this.area,this.tileMap,s,null,vars); + info.tint(s); + if(this.onFrame != null) { + s.addEventListener("addedToStage",$bind(this,this.init)); + s.addEventListener("removedFromStage",$bind(this,this.destroy)); + } + return s; + } + } + ,updateTint: function() { + if(!this.info.xml.exists("color") && !this.info.xml.exists("colorScale")) { + com_davidmaletz_mining_world_TooltipObject.prototype.updateTint.call(this); + } + } + ,getLoot: function(e,projectile) { + var l = this.getInfo().getLoot(); + if(l == null) { + return null; + } else { + return new com_fancyfish_faeng_common_SingleIterator(l); + } + } + ,getInfo: function() { + return this.info; + } + ,getLayer: function() { + return this.getInfo().layer; + } + ,getAction: function(p) { + var i = this.info.xml.elementsNamed("tooltip"); + var hadNext = i.hasNext(); + if(hadNext) { + com_davidmaletz_mining_npc_NPCEventHandler.setPlayerVariables(this.vars,p); + } + while(i.hasNext()) { + var n = i.next(); + if(n.exists("if") && !com_davidmaletz_faengfl_EventHandler._conditionMet(n.get("if"),this.vars)) { + continue; + } + var section = n.get("section"); + var id = n.get("id"); + if(section == null) { + section = "actions"; + } + if(id == null) { + id = Std.string(com_davidmaletz_faengfl_EventHandler.execute(com_fancyfish_faeng_common_Lang.escape(n.firstChild().get_nodeValue()),this.vars)); + } + if(com_fancyfish_faeng_common_Lang.hasText(section,id)) { + return com_fancyfish_faeng_common_Lang.getText(section,id); + } else { + return null; + } + } + if(hadNext) { + return null; + } + var action = this.getInfo().action; + if(action == null) { + return null; + } + var a = com_fancyfish_faeng_common_Lang.getTextFromTitle(action); + if(a == null) { + return com_fancyfish_faeng_common_Lang.getTextFromTitle("actions." + action); + } else { + return a; + } + } + ,isBlocking: function(asker) { + if(this.getInfo().blocking) { + if(asker != null && asker.xml.get("spirit") != "true") { + return asker.xml.get("passFence") != "true"; + } else { + return false; + } + } else { + return false; + } + } + ,playAnimation: function(id,onComplete,loop) { + if(loop == null) { + loop = false; + } + if(this.renderer != null) { + var r = js_Boot.__cast(this.renderer , com_davidmaletz_tiles_render_PlayAnimation); + var tmp = onComplete == null ? null : function(p) { + onComplete(); + }; + r.playAnimation(id,onComplete == null,tmp,-0.5,-0.5); + r.setFrame(0); + } else { + com_davidmaletz_mining_world_TooltipObject.prototype.playAnimation.call(this,id,onComplete,loop); + } + } + ,getIconFrame: function() { + return com_davidmaletz_mining_world_Object.getFrame(this.getInfo().animation); + } + ,playIdle: function() { + this.playAnimation(this.getInfo().animation); + } + ,setTile: function(x,y,framesPerPixel,onComplete) { + var _gthis = this; + if(onComplete == null) { + onComplete = $bind(this,this.playIdle); + } else { + var func = onComplete; + onComplete = function() { + _gthis.playIdle(); + func(); + }; + } + com_davidmaletz_mining_world_TooltipObject.prototype.setTile.call(this,x,y,framesPerPixel,onComplete); + } + ,onOver: function(p) { + com_davidmaletz_mining_world_TooltipObject.prototype.onOver.call(this,p); + this.runEvent("over",p); + } + ,onOut: function(p) { + com_davidmaletz_mining_world_TooltipObject.prototype.onOut.call(this,p); + this.runEvent("out",p); + } + ,onEnter: function(p) { + com_davidmaletz_mining_world_TooltipObject.prototype.onEnter.call(this,p); + this.runEvent("enter",p); + } + ,onExit: function(p) { + com_davidmaletz_mining_world_TooltipObject.prototype.onExit.call(this,p); + this.runEvent("exit",p); + } + ,overlapSecond: function(p) { + com_davidmaletz_mining_world_TooltipObject.prototype.overlapSecond.call(this,p); + this.runEvent("overSecond",p); + } + ,onOperate: function(p) { + if(this.getAction(p) != null) { + this.runEvent("operate",p); + } + } + ,runEvent: function(event,p,onComplete) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = p == null && this.__is_owner || p == com_davidmaletz_mining_Main.getLocalPlayer(); + if(p != null) { + com_davidmaletz_mining_npc_NPCEventHandler.setPlayerVariables(this.vars,p); + } + this.info.runEvent(p,event,this,onComplete,this.vars); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + ,read: function(b,version) { + com_davidmaletz_mining_world_TooltipObject.prototype.read.call(this,b,version); + } + ,__class__: com_davidmaletz_mining_world_BasicObject +}); +var com_davidmaletz_mining_world_BasicObjectInfo = function(xml) { + com_davidmaletz_mining_world_ObjectInfo.call(this,xml.get("id"),xml.exists("health") ? com_davidmaletz_mining_Main.parseInt(xml.get("health")) : 0,xml); + this.tile = xml.get("tile"); + this.animation = xml.get("animation"); + this.action = xml.get("action"); + this.layer = com_davidmaletz_mining_world_BasicObjectInfo.parseLayer(xml.get("layer")); + this.blocking = xml.get("blocking") == "true"; + var i = xml.elementsNamed("light"); + if(i.hasNext()) { + this.light = new com_davidmaletz_mining_world_LightInfo(i.next()); + } +}; +$hxClasses["com.davidmaletz.mining.world.BasicObjectInfo"] = com_davidmaletz_mining_world_BasicObjectInfo; +com_davidmaletz_mining_world_BasicObjectInfo.__name__ = ["com","davidmaletz","mining","world","BasicObjectInfo"]; +com_davidmaletz_mining_world_BasicObjectInfo.parseLayer = function(layer,defaultNegative) { + if(defaultNegative == null) { + defaultNegative = false; + } + switch(layer) { + case "back": + return 0; + case "bush": + return 1; + case "enemy": + return 4; + case "item": + return 2; + case "player": + return 6; + case "top": + return 7; + case "trap": + return 5; + case "tree": + return 1; + default: + if(defaultNegative && layer != "npc") { + return -1; + } else { + return 3; + } + } +}; +com_davidmaletz_mining_world_BasicObjectInfo.__super__ = com_davidmaletz_mining_world_ObjectInfo; +com_davidmaletz_mining_world_BasicObjectInfo.prototype = $extend(com_davidmaletz_mining_world_ObjectInfo.prototype,{ + tile: null + ,action: null + ,animation: null + ,loot: null + ,layer: null + ,blocking: null + ,light: null + ,getLoot: function() { + if(this.loot == null) { + this.loot = new com_davidmaletz_mining_LootHandler(this.xml.elementsNamed("loot")); + } + return this.loot.getLoot(); + } + ,create: function(x,y) { + return new com_davidmaletz_mining_world_BasicObject(this,x,y); + } + ,createIcon: function() { + return com_davidmaletz_tiles_Tile.get(this.tile); + } + ,__class__: com_davidmaletz_mining_world_BasicObjectInfo +}); +var com_davidmaletz_mining_world_BlueprintInfo = function() { + com_davidmaletz_mining_world_ObjectInfo.call(this,"blueprint",0,null); +}; +$hxClasses["com.davidmaletz.mining.world.BlueprintInfo"] = com_davidmaletz_mining_world_BlueprintInfo; +com_davidmaletz_mining_world_BlueprintInfo.__name__ = ["com","davidmaletz","mining","world","BlueprintInfo"]; +com_davidmaletz_mining_world_BlueprintInfo.__super__ = com_davidmaletz_mining_world_ObjectInfo; +com_davidmaletz_mining_world_BlueprintInfo.prototype = $extend(com_davidmaletz_mining_world_ObjectInfo.prototype,{ + create: function(x,y) { + return new com_davidmaletz_mining_world_BlueprintObject(this,x,y); + } + ,createIcon: function() { + return com_davidmaletz_tiles_Tile.get("blueprint.ico"); + } + ,__class__: com_davidmaletz_mining_world_BlueprintInfo +}); +var com_davidmaletz_mining_world_BlueprintObject = function(info,x,y) { + this.partial = 0; + com_davidmaletz_mining_world_TooltipObject.call(this,info,x,y); + this.health = 0; +}; +$hxClasses["com.davidmaletz.mining.world.BlueprintObject"] = com_davidmaletz_mining_world_BlueprintObject; +com_davidmaletz_mining_world_BlueprintObject.__name__ = ["com","davidmaletz","mining","world","BlueprintObject"]; +com_davidmaletz_mining_world_BlueprintObject.getReqs = function(xml,vars) { + var reqs = []; + var e = xml.elements(); + while(e.hasNext()) { + var e1 = e.next(); + var r = com_davidmaletz_mining_npc_Requirement.fromXML(e1.xml,vars); + if(r != null) { + reqs.push(r); + } + } + return reqs; +}; +com_davidmaletz_mining_world_BlueprintObject.__super__ = com_davidmaletz_mining_world_TooltipObject; +com_davidmaletz_mining_world_BlueprintObject.prototype = $extend(com_davidmaletz_mining_world_TooltipObject.prototype,{ + blueprint: null + ,buildTime: null + ,structure: null + ,reqs: null + ,setBlueprint: function(b) { + this.blueprint = b; + var xml = b.getActionXml("build"); + if(xml == null) { + xml = b.getActionXml("upgrade"); + } + if(xml == null) { + xml = b.getActionXml("plant"); + } + if(xml == null) { + xml = b.xml; + } + this.buildTime = (xml.exists("buildTime") ? com_davidmaletz_mining_Main.parseInt(xml.get("buildTime")) : 20) * 60; + this.structure = com_davidmaletz_mining_structure_StructureInfo.get(xml.get("structure")); + this.reqs = com_davidmaletz_mining_world_BlueprintObject.getReqs(xml); + this._width = this.structure.width; + this._height = this.structure.height; + } + ,addedToArea: function() { + var _gthis = this; + var ar = []; + var l = this.getLayer(); + this.getOverlap(function(o,rect) { + if(o != _gthis && o.getLayer() == l && Std["is"](o,com_davidmaletz_mining_world_BlueprintObject)) { + ar.push(o); + } + return false; + },null,0); + var _g = 0; + while(_g < ar.length) { + var o1 = ar[_g]; + ++_g; + this.area.removeObject(o1); + } + this.area.addEventListener("tick",$bind(this,this.handleTick)); + } + ,removedFromArea: function(area) { + com_davidmaletz_mining_world_TooltipObject.prototype.removedFromArea.call(this,area); + area.removeEventListener("tick",$bind(this,this.handleTick)); + } + ,partial: null + ,handleTick: function(e) { + var f = e.value; + var p = this.getHealthPercent(); + if(f > 0 && p > 0 && p < 1) { + var h = Math.floor(f); + this.partial += f - h; + if(this.partial >= 1) { + ++h; + this.partial -= 1; + } + if(h > 0) { + this.addHealth(h); + } + } + } + ,isBack: function() { + return false; + } + ,knockback: function(dx,passObjects) { + if(passObjects == null) { + passObjects = false; + } + } + ,isBlocking: function(asker) { + return false; + } + ,getLayer: function() { + return 1; + } + ,createRenderer: function() { + return new com_davidmaletz_mining_world__$BlueprintObject_BlueprintRenderer(this); + } + ,getTileIcon: function() { + return this.structure.tile; + } + ,getIconFrame: function() { + return com_davidmaletz_mining_world_Object.getFrame(this.structure.getAnim(this.structure.xml.get("powered") == "true" || this.structure.xml.get("type") == "powerplant" ? "off" : "idle")); + } + ,createIcon: function(cenX,cenY) { + if(cenY == null) { + cenY = 0.5; + } + if(cenX == null) { + cenX = 0.5; + } + var ret = com_davidmaletz_mining_world_TooltipObject.prototype.createIcon.call(this,cenX,cenY); + var _g = ret; + _g.set_x(_g.get_x() + this.structure.offsetX); + var _g1 = ret; + _g1.set_y(_g1.get_y() + this.structure.offsetY); + if(ret != null) { + ret.set_alpha(0.7); + } + return ret; + } + ,getAction: function(p) { + if(this.getHealth() == 0) { + return com_fancyfish_faeng_common_Lang.getText("actions","build"); + } else if(this.reqs.length > 0) { + return com_fancyfish_faeng_common_Lang.getText("item.names","dismantle"); + } else { + return null; + } + } + ,canFlip: function() { + return false; + } + ,onOperate: function(p) { + var c = com_davidmaletz_mining_Main.getContainer(); + if(this.getHealth() == 0) { + var f = $bind(this,this.startBuild); + var p1 = p; + var tmp = function() { + f(p1); + }; + c.addDisplay(new com_davidmaletz_mining_ui_BuildPrompt(com_fancyfish_faeng_common_Lang.getText("structure","build").get(),c,p,this.structure.getName().get(),p.getInv(true),this.reqs,tmp,$bind(this,this.remove)),2); + } else if(this.reqs.length > 0) { + c.addDisplay(new com_davidmaletz_mining_ui_DismantlePrompt(com_fancyfish_faeng_common_Lang.getText("structure","dismantle").get(),c,p,this.structure.getName().get(),p.getInv(true),this.reqs,$bind(this,this.remove),1),2); + } + } + ,startBuild: function(p) { + if(this.getHealth() == 0) { + this.addHealth(1); + p.addExp(10); + } + } + ,remove: function() { + if(this.area != null) { + this.area.removeObject(this); + } + } + ,build: function() { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + this.blueprint.runEvent("build",com_davidmaletz_mining_Main.getLocalPlayer(),this,$bind(this,this.doBuild)); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + ,getVars: function(a) { + var vars = com_davidmaletz_faengfl_EventHandler.createVariables(); + vars.set("this",this); + vars.set("area",a); + com_davidmaletz_mining_npc_NPCEventHandler.setPlayerVariables(vars,null); + return vars; + } + ,doBuild: function() { + if(this.area == null) { + return; + } + var xml = this.blueprint.xml; + if(xml != null && xml.exists("achievement")) { + com_davidmaletz_faengfl_achievement_Achievements.instance.gainAchievement(xml.get("achievement")); + } + if(xml.get("dismantle") == "true") { + var s = this.area.getStructure(this.getBounds()); + if(s != null) { + s.onDismantle(com_davidmaletz_mining_Main.getLocalPlayer()); + } + } + if(this.blueprint.getActionXml("build") != null || this.blueprint.getActionXml("upgrade") != null) { + com_davidmaletz_faengfl_achievement_Achievements.instance.gainAchievement("blueprints"); + com_davidmaletz_faengfl_adv_sound_Sound.playLoc("build",this.area.renderer,new openfl_geom_Point(this.getCenterX(),this.getCenterY())); + } + var a = this.area; + a.removeObject(this); + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + this.structure.build(p,xml.exists("area") ? com_davidmaletz_faengfl_EventHandler.execute(xml.get("area"),this.getVars(a)) : a,this.xPos,this.yTile); + if(p != null) { + p.overlapChanged(); + } + } + ,getMaxHealth: function() { + return this.buildTime; + } + ,write: function(b) { + com_davidmaletz_mining_world_TooltipObject.prototype.write.call(this,b); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.blueprint.id); + } + ,read: function(b,version) { + com_davidmaletz_mining_world_TooltipObject.prototype.read.call(this,b,version); + this.setBlueprint(com_davidmaletz_mining_item_ItemInfo.get(com_fancyfish_faeng_common_UTFUtils.readUTF(b))); + } + ,addHealth: function(h) { + com_davidmaletz_mining_world_TooltipObject.prototype.addHealth.call(this,h); + if(this.getHealthPercent() >= 1) { + this.build(); + } + } + ,setHealth: function(h,fireDeath,attacker) { + if(fireDeath == null) { + fireDeath = true; + } + com_davidmaletz_mining_world_TooltipObject.prototype.setHealth.call(this,h,fireDeath,attacker); + if(this.getHealthPercent() >= 1) { + this.build(); + } + } + ,__class__: com_davidmaletz_mining_world_BlueprintObject +}); +var com_davidmaletz_mining_world__$BlueprintObject_BlueprintRenderer = function(b) { + com_davidmaletz_lerp_LerpSpriteFL.call(this); + this.blueprint = b; + var s = b.structure; + var i = new com_davidmaletz_tiles_render_PlayAnimation(s.tile,com_davidmaletz_mining_item_Action.getStructAnim(s),10,true,null,0,-0.5); + var ox = com_davidmaletz_mining_item_Action.getStrucOffX(s); + var _g = i; + _g.set_x(_g.get_x() + (ox - b._width * 0.5)); + var _g1 = i; + _g1.set_y(_g1.get_y() + s.offsetY); + i.set_alpha(0.7); + this.addChild(i); + var bar = new com_davidmaletz_mining_renderer_ObjectHealthBar(b,com_davidmaletz_mining_Main.PROGRESS_COL); + var _g2 = bar; + _g2.set_x(_g2.get_x() + b.offsetX); + if(b._height > com_davidmaletz_tiles_Tile.SIZE * 2.5) { + var _g3 = bar; + _g3.set_y(_g3.get_y() + (b._height - com_davidmaletz_tiles_Tile.SIZE * 2.5 + b.structure.offsetY)); + } + this.addChild(bar); +}; +$hxClasses["com.davidmaletz.mining.world._BlueprintObject.BlueprintRenderer"] = com_davidmaletz_mining_world__$BlueprintObject_BlueprintRenderer; +com_davidmaletz_mining_world__$BlueprintObject_BlueprintRenderer.__name__ = ["com","davidmaletz","mining","world","_BlueprintObject","BlueprintRenderer"]; +com_davidmaletz_mining_world__$BlueprintObject_BlueprintRenderer.__super__ = com_davidmaletz_lerp_LerpSpriteFL; +com_davidmaletz_mining_world__$BlueprintObject_BlueprintRenderer.prototype = $extend(com_davidmaletz_lerp_LerpSpriteFL.prototype,{ + blueprint: null + ,__class__: com_davidmaletz_mining_world__$BlueprintObject_BlueprintRenderer +}); +var com_davidmaletz_mining_world_Bush = function(info,x,y) { + this.growth = info.grown + 2.; + com_davidmaletz_mining_world_TooltipObject.call(this,info,x,y); + if(info.xml.exists("width")) { + this._width = com_davidmaletz_mining_Main.parseInt(info.xml.get("width")); + } + if(info.xml.exists("height")) { + this._height = com_davidmaletz_mining_Main.parseInt(info.xml.get("height")); + } +}; +$hxClasses["com.davidmaletz.mining.world.Bush"] = com_davidmaletz_mining_world_Bush; +com_davidmaletz_mining_world_Bush.__name__ = ["com","davidmaletz","mining","world","Bush"]; +com_davidmaletz_mining_world_Bush.__super__ = com_davidmaletz_mining_world_TooltipObject; +com_davidmaletz_mining_world_Bush.prototype = $extend(com_davidmaletz_mining_world_TooltipObject.prototype,{ + growth: null + ,addedToArea: function() { + com_davidmaletz_mining_world_TooltipObject.prototype.addedToArea.call(this); + this.area.addEventListener("tick",$bind(this,this.handleTick)); + } + ,removedFromArea: function(area) { + com_davidmaletz_mining_world_TooltipObject.prototype.removedFromArea.call(this,area); + area.removeEventListener("tick",$bind(this,this.handleTick)); + } + ,handleTick: function(e) { + var info = this.getInfo(); + var max = info.grown; + if(this.growth <= max && (this.renderer == null || (js_Boot.__cast(this.renderer , com_davidmaletz_tiles_render_TileAnimationRenderer)).animation == info.getAnim("grow"))) { + var g = this.growth + e.value * info.speed; + max += info.speed; + if(g > max) { + g = max; + } + this.setGrowth(g); + if(this.renderer != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_tiles_render_TileAnimationRenderer)).setFrame(g); + } + } + } + ,createRenderer: function() { + return new com_davidmaletz_mining_world__$Bush_BushRenderer(this); + } + ,createIcon: function(cenX,cenY) { + if(cenY == null) { + cenY = 0.5; + } + if(cenX == null) { + cenX = 0.5; + } + var r = com_davidmaletz_mining_world_TooltipObject.prototype.createIcon.call(this,0.5,1); + r.set_y(this.yTop() + this._height + this.getOffsetY()); + return r; + } + ,moveRenderer: function(old_x,old_y,init) { + if(init == null) { + init = false; + } + this.renderer.set_x(Math.round(this.getCenterX())); + this.renderer.set_y(Math.round(this.yTop() + this._height + this.getOffsetY())); + if(init) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + this.runEvent("initRenderer",null); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + } + ,getInfo: function() { + return this.info; + } + ,getLoot: function(e,projectile) { + var item = com_davidmaletz_mining_item_ItemInfo.get(this.getInfo().loot); + if(item == null) { + return null; + } else { + return new com_fancyfish_faeng_common_SingleIterator(new com_davidmaletz_mining_item_ItemCt(item,this.getInfo().getCount())); + } + } + ,isBack: function() { + return true; + } + ,getLayer: function() { + return 1; + } + ,getAction: function(p) { + if(this.info.xml.exists("tooltip")) { + return com_fancyfish_faeng_common_Lang.getTextFromTitle(this.info.xml.get("tooltip")); + } else { + return com_fancyfish_faeng_common_Lang.getText("object.tooltip","bush"); + } + } + ,isBlocking: function(asker) { + return false; + } + ,canCollect: function(p) { + return this.growth > this.getInfo().grown; + } + ,hasPriority: function(p,structure) { + if(com_davidmaletz_mining_world_TooltipObject.prototype.hasPriority.call(this,p,structure)) { + return this.canCollect(p); + } else { + return false; + } + } + ,player: null + ,onEnter: function(p) { + com_davidmaletz_mining_world_TooltipObject.prototype.onEnter.call(this,p); + this.player = p; + if(this.tooltip != null && !this.canCollect(p)) { + this.tooltip.clearLerp(); + if(this.renderer != null) { + this.renderer.clearTrack(com_davidmaletz_mining_world_ObjectDarkenKeyframe); + } + } + } + ,onExit: function(p) { + com_davidmaletz_mining_world_TooltipObject.prototype.onExit.call(this,p); + this.player = null; + } + ,doHarvest: function() { + if(this.area != null && this.area.renderer != null && this.renderer != null) { + var h = this.getInfo().getAnim("harvest"); + var r = js_Boot.__cast(this.renderer , com_davidmaletz_tiles_render_PlayAnimation); + if(com_davidmaletz_tiles_TileAnimation.exists(h)) { + r.playAnimation(h,false,$bind(this,this.regrow)); + } else { + this.regrow(r); + } + } + } + ,onOperate: function(p) { + if(!this.canCollect(p)) { + return; + } + this.setGrowth(0); + this.dispatchEvent(new openfl_events_Event("harvest")); + if(this.area != null && this.area.renderer != null) { + var loot = this.getLoot(null,false); + if(loot != null) { + com_davidmaletz_mining_renderer_CollectLoot.collect(loot,this.area.renderer,this.xPos,this.yTile + 0.5 * com_davidmaletz_tiles_Tile.SIZE); + } + this.doHarvest(); + p.addExp(1); + } + } + ,getIconFrame: function() { + return com_davidmaletz_mining_world_Object.getFrame(this.getInfo().getAnim("grow"),this.growth); + } + ,regrow: function(p) { + p.playAnimation(this.getInfo().getAnim("grow"),false); + p.setFrame(this.growth); + } + ,canFlip: function() { + return false; + } + ,canCritical: function() { + return false; + } + ,setGrowth: function(g) { + if(this.growth != g) { + this.growth = g; + if(this.tooltip != null) { + if(this.canCollect(this.player)) { + if(this.tooltip.get_alpha() != 1) { + this.tooltip.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),10); + } + } else if(this.tooltip.get_alpha() != 0) { + this.tooltip.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),10); + } + } + return true; + } else { + return false; + } + } + ,write: function(b) { + com_davidmaletz_mining_world_TooltipObject.prototype.write.call(this,b); + b.writeFloat(this.growth); + } + ,read: function(b,version) { + com_davidmaletz_mining_world_TooltipObject.prototype.read.call(this,b,version); + this.growth = b.readFloat(); + this.health = com_fancyfish_faeng_common_Utils.min(this.getMaxHealth(),this.health); + } + ,runEvent: function(event,p,onComplete) { + if(this.info.xml.elementsNamed(event).hasNext()) { + var map = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(p); + if(this.area != null) { + map.set("area",this.area); + } + com_davidmaletz_mining_Main.runEvent(event,p,this.info.xml,this,onComplete,map); + } + } + ,__class__: com_davidmaletz_mining_world_Bush +}); +var com_davidmaletz_mining_world__$Bush_BushRenderer = function(b) { + com_davidmaletz_tiles_render_PlayAnimation.call(this,b.getInfo().tile,b.getInfo().getAnim("grow"),15,false); + this.bush = b; + this.setFrame(this.bush.growth); +}; +$hxClasses["com.davidmaletz.mining.world._Bush.BushRenderer"] = com_davidmaletz_mining_world__$Bush_BushRenderer; +com_davidmaletz_mining_world__$Bush_BushRenderer.__name__ = ["com","davidmaletz","mining","world","_Bush","BushRenderer"]; +com_davidmaletz_mining_world__$Bush_BushRenderer.__super__ = com_davidmaletz_tiles_render_PlayAnimation; +com_davidmaletz_mining_world__$Bush_BushRenderer.prototype = $extend(com_davidmaletz_tiles_render_PlayAnimation.prototype,{ + bush: null + ,setAnimation: function(anim_id,offX,offY) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + com_davidmaletz_tiles_render_PlayAnimation.prototype.setAnimation.call(this,anim_id,-0.5,-1); + } + ,advanceFrame: function(frames) { + if(this.animation == this.bush.getInfo().getAnim("grow")) { + com_davidmaletz_tiles_render_PlayAnimation.prototype.advanceTracks.call(this,frames); + } else { + com_davidmaletz_tiles_render_PlayAnimation.prototype.advanceFrame.call(this,frames); + } + } + ,__class__: com_davidmaletz_mining_world__$Bush_BushRenderer +}); +var com_davidmaletz_mining_world_BushInfo = function(xml) { + com_davidmaletz_mining_world_ObjectInfo.call(this,xml.get("id"),xml.exists("health") ? com_davidmaletz_mining_Main.parseInt(xml.get("health")) : 0,xml); + this.loot = xml.get("loot"); + this.min = xml.exists("min") ? com_davidmaletz_mining_Main.parseInt(xml.get("min")) : 1; + this.max = xml.exists("max") ? com_davidmaletz_mining_Main.parseInt(xml.get("max")) : 1; + var t = com_davidmaletz_mining_npc_NPCEventHandler.evalString(xml.get("tile"),com_davidmaletz_faengfl_EventHandler.createVariables()); + this.tile = com_davidmaletz_tiles_Tile.get(t); + this.grown = com_davidmaletz_mining_Main.parseFloat(xml.get("grown")) * 60 / 15; + this.speed = com_davidmaletz_mining_Main.parseFloat(xml.get("speed")); +}; +$hxClasses["com.davidmaletz.mining.world.BushInfo"] = com_davidmaletz_mining_world_BushInfo; +com_davidmaletz_mining_world_BushInfo.__name__ = ["com","davidmaletz","mining","world","BushInfo"]; +com_davidmaletz_mining_world_BushInfo.__super__ = com_davidmaletz_mining_world_ObjectInfo; +com_davidmaletz_mining_world_BushInfo.prototype = $extend(com_davidmaletz_mining_world_ObjectInfo.prototype,{ + loot: null + ,min: null + ,max: null + ,grown: null + ,speed: null + ,tile: null + ,getCount: function() { + return Math.floor((this.max + 1 - this.min) * Math.random()) + this.min; + } + ,create: function(x,y) { + return new com_davidmaletz_mining_world_Bush(this,x,y); + } + ,getIconFrame: function() { + return com_davidmaletz_mining_world_Object.getFrame(this.getAnim("grow"),this.grown); + } + ,createIcon: function() { + return this.tile; + } + ,getBase: function() { + return "bush"; + } + ,getAnim: function(id) { + var base = this.xml.exists("animation") ? this.xml.get("animation") + "." : this.getBase() + "."; + if(this.xml.exists(id + "_anim")) { + return this.xml.get(id + "_anim"); + } else { + var s = this.id + "." + id; + if(com_davidmaletz_tiles_TileAnimation.exists(s)) { + return s; + } else { + return base + id; + } + } + } + ,__class__: com_davidmaletz_mining_world_BushInfo +}); +var com_davidmaletz_mining_world_Shape = function() { }; +$hxClasses["com.davidmaletz.mining.world.Shape"] = com_davidmaletz_mining_world_Shape; +com_davidmaletz_mining_world_Shape.__name__ = ["com","davidmaletz","mining","world","Shape"]; +com_davidmaletz_mining_world_Shape.prototype = { + hasNext: null + ,next: null + ,__class__: com_davidmaletz_mining_world_Shape +}; +var com_davidmaletz_mining_world_CompoundShape = function() { + this.tiles = new haxe_ds_IntMap(); + this.bounds = new com_fancyfish_faeng_common_Bounds2D_$Int(); + this.bounds.reset(); + this.shapes = []; + this.current = new com_fancyfish_faeng_display_IPoint2D(); + this.currentShape = null; +}; +$hxClasses["com.davidmaletz.mining.world.CompoundShape"] = com_davidmaletz_mining_world_CompoundShape; +com_davidmaletz_mining_world_CompoundShape.__name__ = ["com","davidmaletz","mining","world","CompoundShape"]; +com_davidmaletz_mining_world_CompoundShape.__interfaces__ = [com_davidmaletz_mining_world_Shape]; +com_davidmaletz_mining_world_CompoundShape.prototype = { + tiles: null + ,bounds: null + ,shapes: null + ,current: null + ,currentShape: null + ,iterator: null + ,addShape: function(s) { + this.shapes.push(s); + } + ,hasTile: function(x,y) { + return this.tiles.exists(com_fancyfish_faeng_common_Utils.getIdx(x,y)); + } + ,hasNext: function() { + if(this.iterator == null) { + this.iterator = HxOverrides.iter(this.shapes); + this.getNext(); + } + return this.current != null; + } + ,next: function(pt) { + pt.set(this.current.x,this.current.y); + this.getNext(); + } + ,getNext: function() { + while(true) if(this.currentShape == null || !this.currentShape.hasNext()) { + if(!this.iterator.hasNext()) { + this.current = null; + return; + } + this.currentShape = this.iterator.next(); + } else { + this.currentShape.next(this.current); + var i = com_fancyfish_faeng_common_Utils.getIdx(this.current.x,this.current.y); + if(!this.tiles.exists(i)) { + this.bounds.add(this.current.x,this.current.y,1,1); + this.tiles.set(i,true); + return; + } + } + } + ,__class__: com_davidmaletz_mining_world_CompoundShape +}; +var com_davidmaletz_mining_world_Connection = function(f,t,a,horiz) { + this.fromX = f; + this.toX = t; + this.area = a; + this.horiz = horiz; +}; +$hxClasses["com.davidmaletz.mining.world.Connection"] = com_davidmaletz_mining_world_Connection; +com_davidmaletz_mining_world_Connection.__name__ = ["com","davidmaletz","mining","world","Connection"]; +com_davidmaletz_mining_world_Connection.fromXML = function(xml) { + var d = "X"; + var dir = xml.get("dir"); + if(dir == "up" || dir == "down") { + d = "Y"; + } + var c = new com_davidmaletz_mining_world_Connection(com_davidmaletz_mining_Main.parseInt(xml.get("from" + d)),com_davidmaletz_mining_Main.parseInt(xml.get("to" + d)),xml.get("area"),d == "X"); + c.forceX = Std.parseInt(xml.get("forceX")); + c.forceY = Std.parseInt(xml.get("forceY")); + return c; +}; +com_davidmaletz_mining_world_Connection.prototype = { + fromX: null + ,toX: null + ,area: null + ,horiz: null + ,forceX: null + ,forceY: null + ,enter: function(p,x,y) { + if(this.area == "stop") { + return; + } + if(this.horiz) { + x = this.toX * com_davidmaletz_tiles_Tile.SIZE + x - this.fromX * com_davidmaletz_tiles_Tile.SIZE; + } else { + y = this.toX * com_davidmaletz_tiles_Tile.SIZE + y - this.fromX * com_davidmaletz_tiles_Tile.SIZE; + } + if(this.forceX != null) { + x = this.forceX; + } + if(this.forceY != null) { + y = this.forceY; + } + p.doTeleport(this.area,x,y,false); + } + ,__class__: com_davidmaletz_mining_world_Connection +}; +var com_davidmaletz_mining_world_Element = function(id) { + this.id = id; + this.resists = new haxe_ds_StringMap(); + this.critical = new haxe_ds_StringMap(); +}; +$hxClasses["com.davidmaletz.mining.world.Element"] = com_davidmaletz_mining_world_Element; +com_davidmaletz_mining_world_Element.__name__ = ["com","davidmaletz","mining","world","Element"]; +com_davidmaletz_mining_world_Element.fromXML = function(xml) { + var ret = new com_davidmaletz_mining_world_Element(xml.get("id")); + ret.xml = xml; + var e = xml.elementsNamed("critical"); + while(e.hasNext()) { + var e1 = e.next(); + com_davidmaletz_mining_world_Element.set(ret.critical,e1); + } + ret.icon = xml.get("icon"); + var e2 = xml.elementsNamed("resist"); + while(e2.hasNext()) { + var e3 = e2.next(); + com_davidmaletz_mining_world_Element.set(ret.resists,e3); + } + var e4 = xml.elementsNamed("loot"); + while(e4.hasNext()) { + var e5 = e4.next(); + if(ret.loot == null) { + ret.loot = new haxe_ds_StringMap(); + } + ret.loot.set(e5.get("id"),e5.get("becomes")); + } + return ret; +}; +com_davidmaletz_mining_world_Element.set = function(map,e) { + var id = e.get("id"); + if(e.get("value") == "false") { + map.remove(id); + } else { + map.set(id,true); + } +}; +com_davidmaletz_mining_world_Element.adjustLoot = function(e,loot) { + if(loot == null || e == null || e.loot == null) { + return loot; + } else { + var l = com_davidmaletz_mining_item_ItemInfo.get(e.loot.get(loot.id)); + if(l == null) { + return loot; + } else { + return l; + } + } +}; +com_davidmaletz_mining_world_Element.elements = null; +com_davidmaletz_mining_world_Element.loadElement = function(e) { + if(com_davidmaletz_mining_world_Element.elements == null) { + com_davidmaletz_mining_world_Element.elements = new haxe_ds_StringMap(); + } + var e1 = com_davidmaletz_mining_world_Element.fromXML(e); + if(com_davidmaletz_mining_world_Element.elements.exists(e1.id)) { + haxe_Log.trace("Overwrite Element: " + e1.id,{ fileName : "Element.hx", lineNumber : 33, className : "com.davidmaletz.mining.world.Element", methodName : "loadElement"}); + } + com_davidmaletz_mining_world_Element.elements.set(e1.id,e1); +}; +com_davidmaletz_mining_world_Element.get = function(id) { + var ret = com_davidmaletz_mining_world_Element._get(id); + if(id != null && id.length > 0 && ret == null) { + haxe_Log.trace("No Element found: " + id,{ fileName : "Element.hx", lineNumber : 36, className : "com.davidmaletz.mining.world.Element", methodName : "get"}); + } + return ret; +}; +com_davidmaletz_mining_world_Element._get = function(id) { + if(id == null || com_davidmaletz_mining_world_Element.elements == null) { + return null; + } else { + return com_davidmaletz_mining_world_Element.elements.get(id); + } +}; +com_davidmaletz_mining_world_Element.reset = function() { + com_davidmaletz_mining_world_Element.elements = null; +}; +com_davidmaletz_mining_world_Element.prototype = { + id: null + ,resists: null + ,critical: null + ,loot: null + ,icon: null + ,xml: null + ,isCritical: function(element) { + if(element != null) { + return this.critical.exists(element.id); + } else { + return false; + } + } + ,isResist: function(element) { + if(element != null) { + return this.resists.exists(element.id); + } else { + return false; + } + } + ,__class__: com_davidmaletz_mining_world_Element +}; +var com_davidmaletz_mining_world_ItemObject = function(info,x,y) { + com_davidmaletz_mining_world_TooltipObject.call(this,info,x,y); + this.health = 0; + var l = this.getLight(info); + if(l != null) { + this.light = this.makeLight(l); + } +}; +$hxClasses["com.davidmaletz.mining.world.ItemObject"] = com_davidmaletz_mining_world_ItemObject; +com_davidmaletz_mining_world_ItemObject.__name__ = ["com","davidmaletz","mining","world","ItemObject"]; +com_davidmaletz_mining_world_ItemObject.itemText = function(m,item) { + var map = new haxe_ds_StringMap(); + map.set("{item}",item.getName()); + return new com_fancyfish_faeng_common_mutable_MutableTemplate(m,map); +}; +com_davidmaletz_mining_world_ItemObject.func2 = function(f1,f2) { + f1(); + f2(); +}; +com_davidmaletz_mining_world_ItemObject.collectWindow = function(wnd,w,h,onCollect,msg) { + var WIDTH = 60; + var _collect = function() { + if(wnd.onClose == null) { + wnd.onClose = onCollect; + } else { + var f1 = onCollect; + var f2 = wnd.onClose; + var _collect1 = function() { + com_davidmaletz_mining_world_ItemObject.func2(f1,f2); + }; + wnd.onClose = _collect1; + } + wnd.close(); + }; + if(msg == null) { + msg = com_fancyfish_faeng_common_Lang.getText("actions","collect"); + } + var collect = new com_davidmaletz_mining_ui_TextButton(w,h + 2,msg,_collect,WIDTH); + wnd.addChildAt(collect,0); + wnd.clickables.addClickable(collect,wnd); + var _g = collect; + _g.set_x(_g.get_x() - WIDTH); + collect.getPos().x -= WIDTH; + return wnd; +}; +com_davidmaletz_mining_world_ItemObject.__super__ = com_davidmaletz_mining_world_TooltipObject; +com_davidmaletz_mining_world_ItemObject.prototype = $extend(com_davidmaletz_mining_world_TooltipObject.prototype,{ + light: null + ,makeLight: function(l) { + var tw = com_davidmaletz_tiles_Tile.SIZE >> 1; + return new com_davidmaletz_mining_world_Light(l,this.xPos + tw,this.yTile + tw); + } + ,getLight: function(info) { + return info.light; + } + ,makeLerpSprite: function() { + if(this.getInfo().item.info.xml.get("renderer") == "spirit") { + return new com_davidmaletz_mining_renderer_SpiritLerpFL(); + } else { + return new com_davidmaletz_lerp_LerpSpriteFL(); + } + } + ,makeAnimSprite: function() { + var info = this.getInfo(); + var item = info.item; + var name = item.getNameStr(); + var anim = item.info.getAnimation(name); + var a = anim == null ? "single" : anim.id; + var ret = item.info.xml.get("renderer") == "spirit" ? new com_davidmaletz_mining_renderer_SpiritRenderer(this.getTile(),a,10,true,null,-0.5,0) : new com_davidmaletz_tiles_render_PlayAnimation(this.getTile(),a,10,true,null,-0.5,0); + if(!com_davidmaletz_tiles_Tile.exists(info.tile)) { + item.info.tint(ret.getChildAt(0),name); + } + return ret; + } + ,createRenderer: function() { + var info = this.getInfo(); + var ret = this.makeLerpSprite(); + var t = com_davidmaletz_tiles_Tile.get(info.tile); + if(t == null) { + var icon = info.item.createIcon(); + icon.set_x(-com_davidmaletz_tiles_Tile.SIZE * 0.5); + ret.addChild(icon); + } else { + var icon1 = info.animation == null ? com_davidmaletz_tiles_Tile.makeIcon(t) : new com_davidmaletz_tiles_render_PlayAnimation(t,info.animation,10,true); + icon1.set_x(-t.getWidth() * 0.5); + info.tint(icon1); + ret.addChild(icon1); + } + return ret; + } + ,getWeight: function() { + return Math.floor(this.getInfo().item.info.weight); + } + ,getTile: function() { + var info = this.getInfo(); + var t = com_davidmaletz_tiles_Tile.get(info.tile); + if(t == null) { + t = info.item.getTile(); + } + if(t == null) { + return com_davidmaletz_tiles_EmptyTile.get(); + } else { + return t; + } + } + ,createIcon: function(cenX,cenY) { + if(cenY == null) { + cenY = 0.5; + } + if(cenX == null) { + cenX = 0.5; + } + var r = com_davidmaletz_mining_world_TooltipObject.prototype.createIcon.call(this,0.5,0); + r.set_y(this.yTile + com_davidmaletz_tiles_Tile.SIZE - 10 + this.getOffsetY()); + return r; + } + ,moveRenderer: function(old_x,old_y,init) { + if(init == null) { + init = false; + } + var tile = com_davidmaletz_tiles_Tile.get(this.getInfo().tile); + this.renderer.set_x(this.xPos + 0.5 * com_davidmaletz_tiles_Tile.SIZE); + this.renderer.set_y((tile == null ? this.yTile + com_davidmaletz_tiles_Tile.SIZE - 10 : this.yTile + com_davidmaletz_tiles_Tile.SIZE - tile.getHeight()) + this.getOffsetY()); + if(this.light != null) { + var tw = com_davidmaletz_tiles_Tile.SIZE >> 1; + this.light.setPosition(this.xPos + tw,this.yTile + tw); + } + } + ,addedToArea: function() { + var t = this.area.getTileId(this.get_tile_x(),this.get_tile_y(),0); + if(t >= 0) { + this.area.mine(this.get_tile_x(),this.get_tile_y(),t,0,this); + } + if(this.light != null) { + this.light.addToArea(this.area); + } + } + ,removedFromArea: function(area) { + if(this.light != null) { + this.light.removeFromArea(area); + } + } + ,isBack: function() { + var item = this.getInfo().item; + var a = item.info.getAction(); + var e = a == null || a.xml == null ? item.info.xml : a.xml; + if(a != null) { + if(a.id != "craft") { + return a.id == "repair"; + } else { + return true; + } + } else { + return false; + } + } + ,messageTooltip: null + ,showMessage: function(message) { + if(message != null && message.length > 0) { + this.hideMessage(); + this.messageTooltip = new com_davidmaletz_faengfl_ui_Tooltip(128.,52.,new com_fancyfish_faeng_common_mutable_Static(StringTools.replace(message,"\\n","\n")),16777215,-16777216,null,true,true); + this.messageTooltip.parent.setChildIndex(this.messageTooltip,0); + this.messageTooltip.show(true); + } + } + ,hideMessage: function() { + if(this.messageTooltip != null) { + var d = this.messageTooltip; + var tmp = function() { + com_davidmaletz_faengfl_FaengFL.remove(d); + }; + this.messageTooltip.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),10,tmp); + this.messageTooltip = null; + } + } + ,canFlip: function() { + return false; + } + ,canCritical: function() { + return false; + } + ,getInfo: function() { + return this.info; + } + ,getLayer: function() { + return this.getInfo().layer; + } + ,isVisible: function() { + var p; + var tmp; + if(this.getInfo().item.info.xml.get("renderer") == "spirit") { + p = com_davidmaletz_mining_Main.getLocalPlayer(); + tmp = p == null; + } else { + tmp = true; + } + if(!tmp) { + return p.viewHidden.get(); + } else { + return true; + } + } + ,getAction: function(p) { + if(!this.isVisible()) { + return null; + } + var i = this.getInfo().item.info; + var m = i.xml.exists("tooltip") ? com_fancyfish_faeng_common_Lang.getTextFromTitle(i.xml.get("tooltip")) : com_fancyfish_faeng_common_Lang.getText("object.tooltip","collect"); + return com_davidmaletz_mining_world_ItemObject.itemText(m,i); + } + ,isBlocking: function(asker) { + if(this.getInfo().blocking) { + if(asker != null && asker.xml.get("spirit") != "true") { + return asker.xml.get("passFence") != "true"; + } else { + return false; + } + } else { + return false; + } + } + ,getMaxHealth: function() { + return 99; + } + ,doCollect: function(p,sfx) { + if(sfx == null) { + sfx = true; + } + if(this.area != null) { + var i = this.getInfo().item; + p.addItems(i.info,this.health > 1 ? this.health : 1,0,i.getNameStr(),sfx); + this.area.removeObject(this); + p.overlapChanged(); + } + } + ,doOperate: function(p) { + var item = this.getInfo().item; + var a = item.info.getAction(); + var e = a == null || a.xml == null ? item.info.xml : a.xml; + if(a != null) { + var _g = a.id; + switch(_g) { + case "craft": + var c = com_davidmaletz_mining_Main.getContainer(); + var wnd = com_davidmaletz_mining_ui_CraftingWindow.make(item.getName(),p.getInv(false),c,p,e,item); + var f = $bind(this,this.doCollect); + var p1 = p; + var tmp = function() { + f(p1); + }; + c.addDisplay(com_davidmaletz_mining_world_ItemObject.collectWindow(wnd,wnd.getWidth(),wnd.getHeight(),tmp),2); + return; + case "repair": + var c1 = com_davidmaletz_mining_Main.getContainer(); + var wnd1 = new com_davidmaletz_mining_ui_RepairWindow(item.getName(),p.getInv(false),p.equipment,c1,p,e,item); + var f1 = $bind(this,this.doCollect); + var p2 = p; + var tmp1 = function() { + f1(p2); + }; + c1.addDisplay(com_davidmaletz_mining_world_ItemObject.collectWindow(wnd1,wnd1.getWidth(),wnd1.getHeight(),tmp1),2); + return; + } + } + this.doCollect(p); + } + ,onOperate: function(p) { + var f = $bind(this,this.doOperate); + var p1 = p; + var tmp = function() { + f(p1); + }; + this.getInfo().item.info.runEvent("operate",p,this,tmp); + } + ,onOver: function(p) { + var item = this.getInfo().item; + item.info.runEvent("over",p,this); + com_davidmaletz_mining_world_TooltipObject.prototype.onOver.call(this,p); + } + ,onOut: function(p) { + var item = this.getInfo().item; + item.info.runEvent("out",p,this); + com_davidmaletz_mining_world_TooltipObject.prototype.onOut.call(this,p); + } + ,__class__: com_davidmaletz_mining_world_ItemObject +}); +var com_davidmaletz_mining_world_FuelableObject = function(info,x,y) { + this.second = 60; + this.on = true; + com_davidmaletz_mining_world_ItemObject.call(this,info,x,y); +}; +$hxClasses["com.davidmaletz.mining.world.FuelableObject"] = com_davidmaletz_mining_world_FuelableObject; +com_davidmaletz_mining_world_FuelableObject.__name__ = ["com","davidmaletz","mining","world","FuelableObject"]; +com_davidmaletz_mining_world_FuelableObject.__interfaces__ = [com_davidmaletz_mining_structure_IFuelable]; +com_davidmaletz_mining_world_FuelableObject.__super__ = com_davidmaletz_mining_world_ItemObject; +com_davidmaletz_mining_world_FuelableObject.prototype = $extend(com_davidmaletz_mining_world_ItemObject.prototype,{ + on: null + ,getLight: function(info) { + return null; + } + ,isBack: function() { + return true; + } + ,getFuel: function() { + return this.health; + } + ,getUsableFuel: function() { + return this.health; + } + ,getMaxFuel: function() { + return this.getInfo().item.getDurability(); + } + ,getFuelPercent: function() { + return this.getFuel() / this.getMaxFuel(); + } + ,addFuel: function(f) { + f += this.health; + var max = this.getMaxFuel(); + if(f > max) { + f = max; + } + if(f != this.health) { + var d = f - this.health; + this.health = f; + this.dispatchEvent(new com_davidmaletz_faengfl_events_IntEvent("update_fuel",d)); + this.update(null); + } + } + ,addedToArea: function() { + this.area.addEventListener("tick",$bind(this,this.handleTick)); + } + ,removedFromArea: function(area) { + com_davidmaletz_mining_world_ItemObject.prototype.removedFromArea.call(this,area); + area.removeEventListener("tick",$bind(this,this.handleTick)); + } + ,handleTick: function(e) { + this.enter_frame(e.value); + } + ,second: null + ,enter_frame: function(frames) { + if(this.on) { + this.second -= frames; + if(this.second < 0) { + this.second += 60; + if(this.second < 0) { + this.second = 0; + } + var d = this.getFuelPerSecond(); + if(d > 0) { + this.useFuel(d); + } else if(d < 0) { + this.addFuel(-d); + } + } + } + } + ,getFuelPerSecond: function() { + var i = this.getInfo().item.info; + if(this.area != null && i.equipCost != null && !i.equipCost.isRestricted(this.area,this.yTile) && i.equipCost.durability != 0) { + return i.equipCost.durability; + } else { + return 0; + } + } + ,spawnVehicle: function(r) { + com_davidmaletz_mining_ui_CraftingWindow._spawnVehicle(com_davidmaletz_mining_Main.getLocalPlayer(),this.info.xml,this,r); + } + ,setValue: function(v) { + this.health = com_fancyfish_faeng_common_Utils.max(0,this.getMaxFuel() - v); + } + ,useFuel: function(ct) { + if(ct == null) { + ct = 1; + } + if(this.health >= ct) { + this.health -= ct; + this.dispatchEvent(new com_davidmaletz_faengfl_events_IntEvent("update_fuel",-ct)); + if(this.health == 0) { + this.update(null); + } + } + } + ,getMultiplier: function() { + return 1; + } + ,getAction: function(p) { + if(!this.isVisible()) { + return null; + } else { + return com_davidmaletz_mining_world_ItemObject.itemText(com_fancyfish_faeng_common_Lang.getText("object.tooltip","use"),this.getInfo().item); + } + } + ,isPowered: function(ar) { + if(this.on) { + return this.getFuel() > 0; + } else { + return false; + } + } + ,updateLight: function() { + var l = this.getInfo().light; + if(l == null) { + return; + } + var v = this.isPowered(); + if(this.light != null != v) { + if(v) { + this.light = this.makeLight(l); + if(this.area != null) { + this.light.addToArea(this.area); + } + } else { + if(this.area != null) { + this.light.removeFromArea(this.area); + } + this.light = null; + } + } + } + ,update: function(e) { + this.playAnimation(this.isPowered() ? "on" : "off",null,true); + this.updateLight(); + } + ,createRenderer: function() { + var ret = this.makeAnimSprite(); + ret.playAnimation(this.getAnim(this.isPowered() ? "on" : "off"),true,null,-0.5,0); + this.updateLight(); + return ret; + } + ,getAnim: function(id) { + return this.getInfo().item.info.getAnim(id); + } + ,playAnimation: function(id,onComplete,loop) { + if(loop == null) { + loop = false; + } + if(this.renderer != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_tiles_render_PlayAnimation)).playAnimation(this.getAnim(id),loop,onComplete == null ? null : function(p) { + onComplete(); + },-0.5,0); + } else { + com_davidmaletz_mining_world_ItemObject.prototype.playAnimation.call(this,id,onComplete,loop); + } + } + ,playFuelSFX: function() { + this.playSound(com_davidmaletz_faengfl_adv_sound_Sound.resolve(null,this.getInfo().item.info.xml,"fuel"),false); + } + ,doOperate: function(p) { + var r = []; + var e = this.info.xml.elementsNamed("food"); + while(e.hasNext()) { + var e1 = e.next(); + var i = com_davidmaletz_mining_item_ItemInfo.get(e1.get("id")); + if(i != null) { + r.push(com_davidmaletz_mining_item_Recipe.createFuel(i,com_davidmaletz_mining_Main.parseInt(e1.get("value")))); + } + } + var c = com_davidmaletz_mining_Main.getContainer(); + var wnd = new com_davidmaletz_mining_ui_FuelWindow(p.getInv(false),this.getInfo().item.getName(),this,c,p,this.info.xml.get("fuelName"),this.info.xml,HxOverrides.iter(r)); + if(this.info.xml.get("onSwitch") == "true") { + this.toggle = new com_davidmaletz_mining_ui_TextButton(0,wnd.getHeight() + 2,com_fancyfish_faeng_common_Lang.getText("actions",this.on ? "turn_off" : "turn_on"),$bind(this,this.toggleOn),60); + wnd.addChild(this.toggle); + wnd.clickables.addClickable(this.toggle,wnd); + wnd.clickables.moveSelection(1,0); + wnd.clickables.moveSelection(1,0); + } + var f = $bind(this,this.collect); + var p1 = p; + var tmp = function() { + f(p1); + }; + c.addDisplay(com_davidmaletz_mining_world_ItemObject.collectWindow(wnd,wnd.getWidth(),wnd.getHeight(),tmp),2); + } + ,getFuelName: function() { + return this.info.xml.get("fuelName"); + } + ,collect: function(p) { + if(this.area != null) { + var i = this.getInfo().item; + p.addItems(i.info,1,i.getDurability() - this.health,i.getNameStr()); + this.area.removeObject(this); + p.overlapChanged(); + } + } + ,setOn: function(o) { + if(this.on != o) { + this.on = o; + this.update(null); + this.dispatchEvent(new openfl_events_Event("update_on")); + } + } + ,toggle: null + ,toggleOn: function() { + this.setOn(!this.on); + if(this.toggle != null) { + this.toggle.setText(com_fancyfish_faeng_common_Lang.getText("actions",this.on ? "turn_off" : "turn_on")); + } + } + ,innerWrite: function(b) { + } + ,innerRead: function(b,version) { + } + ,write: function(b) { + com_davidmaletz_mining_world_ItemObject.prototype.write.call(this,b); + this.innerWrite(b); + b.writeByte(this.on ? 1 : 0); + } + ,read: function(b,version) { + com_davidmaletz_mining_world_ItemObject.prototype.read.call(this,b,version); + this.innerRead(b,version); + if(version >= 74) { + try { + this.on = b.readByte() == 1; + } catch( e ) { + haxe_CallStack.lastException = e; + this.on = true; + } + } + } + ,__class__: com_davidmaletz_mining_world_FuelableObject +}); +var com_davidmaletz_mining_world_Generate = function() { }; +$hxClasses["com.davidmaletz.mining.world.Generate"] = com_davidmaletz_mining_world_Generate; +com_davidmaletz_mining_world_Generate.__name__ = ["com","davidmaletz","mining","world","Generate"]; +com_davidmaletz_mining_world_Generate.runAction = function(action,r,player,version,area) { + new com_davidmaletz_mining_world__$Generate_RunAction(action,r,player,version,area).run(null); +}; +com_davidmaletz_mining_world_Generate.getAction = function(action,id) { + var xml = com_davidmaletz_mining_world_Generate.get(id); + if(xml == null) { + return null; + } + var i = xml.elementPathsNamed(action); + if(i.hasNext()) { + return i.next(); + } else { + return null; + } +}; +com_davidmaletz_mining_world_Generate.getBackground = function(id) { + var xml = com_davidmaletz_mining_world_Generate.get(id); + if(xml == null) { + return null; + } else { + return xml.get("background"); + } +}; +com_davidmaletz_mining_world_Generate.makeNode = function(x,y,z,yStrength,xStrength) { + if(xStrength == null) { + xStrength = 0; + } + if(yStrength == null) { + yStrength = 1; + } + var v = Math.round((Math.abs(com_fancyfish_faeng_common_Noise.noise(x * 0.1,y * 0.1,z) * 0.5 + 0.5) * 64 + y * yStrength * 2 + x * xStrength * 2) * 1024); + return new com_fancyfish_faeng_common_Node(x,y,null,v); +}; +com_davidmaletz_mining_world_Generate.generate = function(area,shape,yStrength,xStrength) { + if(xStrength == null) { + xStrength = 0; + } + if(yStrength == null) { + yStrength = 1; + } + var array = new com_fancyfish_faeng_common_SortedArray(com_fancyfish_faeng_common_Node.getDepth); + var z = Math.random() * 12345.6789; + var pt = new com_fancyfish_faeng_display_IPoint2D(); + while(shape.hasNext()) { + shape.next(pt); + array.insert(com_davidmaletz_mining_world_Generate.makeNode(pt.x,pt.y,z,yStrength,xStrength)); + } + return array; +}; +com_davidmaletz_mining_world_Generate.fixLights = function(area,c,loop) { + var _g = 0; + while(_g < 16) { + var cy = _g++; + var _g1 = 0; + while(_g1 < 16) { + var cx = _g1++; + var x = c.x * 16 + cx; + var y = c.y * 16 + cy; + if(!area.emptyTile(x,y)) { + if(area.emptyTile(x,y - 1) || !loop && (area.emptyTile(x - 1,y) || area.emptyTile(x + 1,y))) { + area.setLit(x,y); + } + } + } + } +}; +com_davidmaletz_mining_world_Generate.setTile = function(area,x,y,tile_id,expr,vars,empty,layer) { + if(layer == null) { + layer = 0; + } + if(empty == null) { + empty = 0; + } + if((empty & 1) != 0 && area.getTileId(x,y,0) != -1 || (empty & 2) != 0 && area.getTileId(x,y,3) != -1) { + return; + } + var tile = area.addTileIndex(vars == null ? tile_id : com_davidmaletz_mining_npc_NPCEventHandler.evalString2(expr,vars,tile_id)); + area.setTile(x,y,layer,tile); + if(layer == 0) { + area.setTile(x,y,1,-1); + } +}; +com_davidmaletz_mining_world_Generate.getExpr = function(tile,vars) { + if(vars != null) { + try { + return com_davidmaletz_faengfl_EventHandler.parseString(tile); + } catch( e ) { + haxe_CallStack.lastException = e; + } + } + return null; +}; +com_davidmaletz_mining_world_Generate.addTileLayer = function(area,tile,shape,y,offX,offY,vars,empty,inShape) { + var expr = com_davidmaletz_mining_world_Generate.getExpr(tile,vars); + var _g1 = shape.bounds.min_x; + var _g = shape.bounds.max_x; + while(_g1 < _g) { + var x = _g1++; + if(!inShape || shape.hasTile(x,y)) { + com_davidmaletz_mining_world_Generate.setTile(area,x + offX,y + offY,tile,expr,vars,empty); + } + } +}; +com_davidmaletz_mining_world_Generate.parseLayer = function(l) { + switch(l) { + case "back": + return 3; + case "ore": + return 1; + default: + return 0; + } +}; +com_davidmaletz_mining_world_Generate.addTileMap = function(area,map,xml,offX,offY,empty,vars) { + if(map == null) { + return; + } + var tiles = new haxe_ds_IntMap(); + var e = xml.elementsNamed("tile"); + while(e.hasNext()) { + var e1 = e.next(); + tiles.set(com_davidmaletz_mining_Main.parseInt("0x" + e1.get("color")),e1); + } + var _g1 = 0; + var _g = map.height; + while(_g1 < _g) { + var y = _g1++; + var _g3 = 0; + var _g2 = map.width; + while(_g3 < _g2) { + var x = _g3++; + var e2 = tiles.get(map.getPixel(x,y)); + var p = e2 == null ? null : e2.get("id"); + if(p == "clear") { + area.setTile(x + offX,y + offY,0,-1); + area.setTile(x + offX,y + offY,3,-1); + if(e2.get("incOre") != "false") { + area.setTile(x + offX,y + offY,1,-1); + } + } else if(p != null) { + com_davidmaletz_mining_world_Generate.setTile(area,x + offX,y + offY,p,null,null,empty,com_davidmaletz_mining_world_Generate.parseLayer(e2.get("layer"))); + } + if(e2 != null && e2.firstChild() != null) { + vars.set("x",x + offX); + vars.set("y",y + offY); + com_davidmaletz_faengfl_EventHandler.execute(com_fancyfish_faeng_common_Lang.escape(e2.firstChild().get_nodeValue()),vars); + } + } + } +}; +com_davidmaletz_mining_world_Generate.addTileColumn = function(area,tile,shape,x,offX,offY,vars,empty,inShape) { + var expr = com_davidmaletz_mining_world_Generate.getExpr(tile,vars); + var _g1 = shape.bounds.min_y; + var _g = shape.bounds.max_y; + while(_g1 < _g) { + var y = _g1++; + if(!inShape || shape.hasTile(x,y)) { + com_davidmaletz_mining_world_Generate.setTile(area,x + offX,y + offY,tile,expr,vars,empty); + } + } +}; +com_davidmaletz_mining_world_Generate.mineLayer = function(area,shape,y,offX,offY,light,xml) { + var from = xml.exists("fromX") ? com_davidmaletz_mining_Main.parseInt(xml.get("fromX")) : shape.bounds.min_x; + var tile = xml.get("tile"); + var o = tile == null ? -1 : area.addTileIndex(tile); + var _g1 = from; + var _g = shape.bounds.max_x; + while(_g1 < _g) { + var x = _g1++; + if(shape.hasTile(x,y)) { + com_davidmaletz_mining_world_Generate._mine(area,x + offX,y + offY,light,o,-1); + } + } +}; +com_davidmaletz_mining_world_Generate.mineColumn = function(area,shape,x,offX,offY,light,tile) { + var o = tile == null ? -1 : area.addTileIndex(tile); + var _g1 = shape.bounds.min_y; + var _g = shape.bounds.max_y; + while(_g1 < _g) { + var y = _g1++; + if(shape.hasTile(x,y)) { + com_davidmaletz_mining_world_Generate._mine(area,x + offX,y + offY,light,o,-1); + } + } +}; +com_davidmaletz_mining_world_Generate.addTileTop = function(area,tile,shape,top,offX,offY,vars,empty,incShape) { + var expr = com_davidmaletz_mining_world_Generate.getExpr(tile,vars); + var _g1 = shape.bounds.min_x; + var _g = shape.bounds.max_x; + while(_g1 < _g) { + var x = _g1++; + var t = top; + var _g3 = shape.bounds.min_y; + var _g2 = shape.bounds.max_y; + while(_g3 < _g2) { + var y = _g3++; + if(area.hasTile(x + offX,y + offY) || incShape && shape.hasTile(x,y)) { + if(t == 0) { + com_davidmaletz_mining_world_Generate.setTile(area,x + offX,y + offY,tile,expr,vars,empty); + break; + } else { + --t; + } + } + } + } +}; +com_davidmaletz_mining_world_Generate.addTiles = function(area,array,tile,min,max,offX,offY,vars,empty,count) { + var expr = com_davidmaletz_mining_world_Generate.getExpr(tile,vars); + var len = array.length(); + var st = Math.floor(len * min); + var end = Math.floor(len * max); + if(count == 0) { + var _g1 = st; + var _g = end; + while(_g1 < _g) { + var i = _g1++; + var n = array.get(i); + com_davidmaletz_mining_world_Generate.setTile(area,n.x + offX,n.y + offY,tile,expr,vars,empty); + } + } else { + var ar = []; + var _g11 = st; + var _g2 = end; + while(_g11 < _g2) { + var i1 = _g11++; + ar.push(i1); + } + if(count > ar.length) { + count = ar.length; + } + var _g12 = 0; + var _g3 = count; + while(_g12 < _g3) { + var i2 = _g12++; + var v = Math.floor(Math.random() * ar.length); + var n1 = array.get(ar[v]); + if(v != ar.length - 1) { + ar[v] = ar[ar.length - 1]; + } + ar.pop(); + com_davidmaletz_mining_world_Generate.setTile(area,n1.x + offX,n1.y + offY,tile,expr,vars,empty); + } + } +}; +com_davidmaletz_mining_world_Generate._mine = function(area,x,y,light,o,bt) { + var t = area.getTileId(x,y,0); + if(t != -1 && (t == o || o == -1)) { + area.mine(x,y,bt == -1 ? t : bt,light,null); + } +}; +com_davidmaletz_mining_world_Generate.mine = function(area,array,min,max,offX,offY,light,tile,backTile,flood) { + if(flood == null) { + flood = false; + } + var o = tile == null ? -1 : area.addTileIndex(tile); + var len = array.length(); + var st = Math.floor(len * min); + var end = Math.floor(len * max); + var bt = backTile == null ? -1 : area.addTileIndex(backTile); + var _g1 = st; + var _g = end; + while(_g1 < _g) { + var i = _g1++; + var n = array.get(i); + com_davidmaletz_mining_world_Generate._mine(area,n.x + offX,n.y + offY,light,o,bt); + if(flood) { + area.setWater(n.x + offX,n.y + offY); + } + } +}; +com_davidmaletz_mining_world_Generate.addOre = function(area,array,ore,min,max,count,offX,offY,o) { + var len = array.length(); + var st = Math.floor(len * min); + var end = Math.floor(len * max); + var fail = 50; + if(st >= end) { + return; + } + while(count > 0 && fail > 0) { + var n = array.get(com_davidmaletz_mining_Main.randInt(st,end)); + var x = n.x + offX; + var y = n.y + offY; + var t = area.getTileId(x,y,0); + if((o == -1 && t != -1 || t == o) && area.getTileId(x,y,1) == -1) { + area.setTile(x,y,1,ore); + --count; + } else { + --fail; + } + } + if(count == 0) { + return; + } + var ar = []; + var _g1 = st; + var _g = end; + while(_g1 < _g) { + var i = _g1++; + var n1 = array.get(i); + var x1 = n1.x + offX; + var y1 = n1.y + offY; + var t1 = area.getTileId(x1,y1,0); + if((o == -1 && t1 != -1 || t1 == o) && area.getTileId(x1,y1,1) == -1) { + ar.push(i); + } + } + if(count > ar.length) { + count = ar.length; + } + var _g11 = 0; + var _g2 = count; + while(_g11 < _g2) { + var i1 = _g11++; + var v = Math.floor(Math.random() * ar.length); + var n2 = array.get(ar[v]); + if(v != ar.length - 1) { + ar[v] = ar[ar.length - 1]; + } + ar.pop(); + area.setTile(n2.x + offX,n2.y + offY,1,ore); + } +}; +com_davidmaletz_mining_world_Generate.addOrePercent = function(area,array,ore,min,max,p,offX,offY,o) { + com_davidmaletz_mining_world_Generate.addOre(area,array,ore,min,max,Math.round(array.length() * p),offX,offY,o); +}; +com_davidmaletz_mining_world_Generate.addUnderground = function(handler,area,xml,array,enemy,min,max,count,offX,offY) { + var o = xml.exists("tile") ? area.addTileIndex(com_davidmaletz_mining_npc_NPCEventHandler.evalString(xml.get("tile"),handler.vars)) : -1; + var len = array.length(); + var st = Math.floor(len * min); + var end = Math.floor(len * max); + var fail = 50; + while(count > 0 && fail > 0) { + var n = array.get(com_davidmaletz_mining_Main.randInt(st,end)); + var x = n.x + offX; + var y = n.y + offY; + var t = area.getTileId(x,y,0); + if((t == o || t == -1 && area.getTileId(x,y,3) == o) && area.getTileId(x,y,1) == -1 && !area.hasObjectInTile(x,y)) { + com_davidmaletz_mining_npc_NPCEventHandler._addObject(enemy.create(x * com_davidmaletz_tiles_Tile.SIZE,y * com_davidmaletz_tiles_Tile.SIZE),xml,area,handler.vars); + --count; + } else { + --fail; + } + } + if(count == 0) { + return; + } + var ar = []; + var _g1 = st; + var _g = end; + while(_g1 < _g) { + var i = _g1++; + var n1 = array.get(i); + var x1 = n1.x + offX; + var y1 = n1.y + offY; + var t1 = area.getTileId(x1,y1,0); + if((t1 == o || t1 == -1 && area.getTileId(x1,y1,3) == o) && area.getTileId(x1,y1,1) == -1 && !area.hasObjectInTile(x1,y1)) { + ar.push(i); + } + } + if(count > ar.length) { + count = ar.length; + } + var _g11 = 0; + var _g2 = count; + while(_g11 < _g2) { + var i1 = _g11++; + var v = Math.floor(Math.random() * ar.length); + var n2 = array.get(ar[v]); + if(v != ar.length - 1) { + ar[v] = ar[ar.length - 1]; + } + ar.pop(); + com_davidmaletz_mining_npc_NPCEventHandler._addObject(enemy.create((n2.x + offX) * com_davidmaletz_tiles_Tile.SIZE,(n2.y + offY) * com_davidmaletz_tiles_Tile.SIZE),xml,area,handler.vars); + } +}; +com_davidmaletz_mining_world_Generate.addUndergroundPercent = function(handler,area,xml,array,enemy,min,max,p,offX,offY) { + com_davidmaletz_mining_world_Generate.addUnderground(handler,area,xml,array,enemy,min,max,Math.round(array.length() * p),offX,offY); +}; +com_davidmaletz_mining_world_Generate.getStartPlayer = function(entry) { + if(entry == null) { + return null; + } else { + var i = com_davidmaletz_mining_world_ObjectInfo.get(entry.get("player")); + if(i == null) { + return null; + } else { + return js_Boot.__cast(i , com_davidmaletz_mining_PlayerInfo); + } + } +}; +com_davidmaletz_mining_world_Generate.loadPlayer = function(xml) { + var player = js_Boot.__cast(com_davidmaletz_mining_world_ObjectInfo.make(xml.get("player"),Math.round(com_davidmaletz_mining_Main.parseFloat(xml.get("x")) * com_davidmaletz_tiles_Tile.SIZE),Math.round(com_davidmaletz_mining_Main.parseFloat(xml.get("y")) * com_davidmaletz_tiles_Tile.SIZE)) , com_davidmaletz_mining_Player); + player.entry = xml.get("id"); + player.location = xml.get("area"); + var e = xml.elementsNamed("addItem"); + while(e.hasNext()) { + var e1 = e.next(); + var i = com_davidmaletz_mining_item_ItemInfo.get(e1.get("id")); + if(i != null) { + var s = player.seen_items; + if(s != null) { + s.set(i.id,true); + } + player.inventory.addItems(i,e1.exists("count") ? com_davidmaletz_mining_Main.parseInt(e1.get("count")) : 1); + } + } + return player; +}; +com_davidmaletz_mining_world_Generate.makeShore = function(area,xml,height,offX,offY) { + var s = js_Boot.__cast(com_davidmaletz_mining_structure_StructureInfo.get(xml.get("dock")) , com_davidmaletz_mining_structure_StructureInfo); + var dw = com_davidmaletz_mining_Main.parseInt(s.xml.get("dockWidth")); + var dh = com_davidmaletz_mining_Main.parseInt(s.xml.get("dockHeight")); + var top = xml.get("top"); + var bottom = xml.get("bottom"); + var pos = com_davidmaletz_mining_Main.parseInt(xml.get("x")); + var flip = xml.get("flip") == "true"; + if(xml.exists("y")) { + var ty = com_davidmaletz_mining_Main.parseInt(xml.get("y")); + offY += ty; + height -= ty; + } + if(xml.exists("trans1")) { + var trans1 = xml.get("trans1"); + var trans2 = xml.get("trans2"); + var ct = Math.floor(Math.random() * 2) + 1; + var x = pos; + var _g1 = 0; + var _g = ct; + while(_g1 < _g) { + var i = _g1++; + if(flip) { + ++x; + } else { + --x; + } + com_davidmaletz_mining_world_Generate.setTile(area,x + offX,offY,trans2); + } + var ct1 = Math.floor(Math.random() * 2) + 1; + var _g11 = 0; + var _g2 = ct1; + while(_g11 < _g2) { + var i1 = _g11++; + if(flip) { + ++x; + } else { + --x; + } + com_davidmaletz_mining_world_Generate.setTile(area,x + offX,offY,trans1); + } + } + var _g12 = dh; + var _g3 = height; + while(_g12 < _g3) { + var y = _g12++; + var w = Math.ceil(com_fancyfish_faeng_common_Utils.interp(-dw,-16,com_fancyfish_faeng_common_Utils.clamp((y - dh) / 64,0,1))); + var _g21 = w; + while(_g21 < 0) { + var x1 = _g21++; + var tx = flip ? pos + x1 + 1 : pos - x1 - 1; + var t = y > dh && area.getTileId(tx + offX,y - 1 + offY,0) == -1; + com_davidmaletz_mining_world_Generate.setTile(area,tx + offX,y + offY,t ? top : bottom); + } + } + if(flip) { + s.build(null,area,(pos - dw + 1 + offX) * com_davidmaletz_tiles_Tile.SIZE,(offY - 1) * com_davidmaletz_tiles_Tile.SIZE); + } else { + s.build(null,area,(pos + offX) * com_davidmaletz_tiles_Tile.SIZE,(offY - 1) * com_davidmaletz_tiles_Tile.SIZE); + } +}; +com_davidmaletz_mining_world_Generate.isEmpty = function(area,fromX,toX,fromY,toY) { + var _g1 = fromY; + var _g = toY; + while(_g1 < _g) { + var y = _g1++; + var _g3 = fromX; + var _g2 = toX; + while(_g3 < _g2) { + var x = _g3++; + if(area.getTileId(x,y,0) >= 0) { + return false; + } + } + } + return true; +}; +com_davidmaletz_mining_world_Generate.hasObject = function(area,sx,sy,w,h,l,incStruct) { + var ex = sx + w; + var ey = sy + 1; + sy -= h - 1; + var _g1 = sy; + var _g = ey; + while(_g1 < _g) { + var y = _g1++; + var _g3 = sx; + var _g2 = ex; + while(_g3 < _g2) { + var x = _g3++; + if(incStruct && area.getStructureInTile(x,y) != null || area.hasObjectInTile(x,y,l)) { + return true; + } + } + } + return false; +}; +com_davidmaletz_mining_world_Generate.placeObjects = function(handler,area,xml,array,arrays,offX,offY,vars) { + var o = xml.exists("id") ? com_davidmaletz_mining_world_ObjectInfo.get(com_davidmaletz_mining_npc_NPCEventHandler.evalString(xml.get("id"),vars)) : null; + var s = xml.exists("structure") ? com_davidmaletz_mining_structure_StructureInfo.get(com_davidmaletz_mining_npc_NPCEventHandler.evalString(xml.get("structure"),vars)) : null; + var offsetX = xml.exists("offsetX") ? com_davidmaletz_faengfl_EventHandler.execute(xml.get("offsetX"),vars) : 0; + var offsetY = xml.exists("offsetY") ? com_davidmaletz_faengfl_EventHandler.execute(xml.get("offsetY"),vars) : 0; + var count = 1; + var spawn = function(x,y) { + if(o != null) { + com_davidmaletz_mining_npc_NPCEventHandler._addObject(o.create(x * com_davidmaletz_tiles_Tile.SIZE + offsetX,y * com_davidmaletz_tiles_Tile.SIZE + offsetY),xml,area,handler.vars); + } + if(s != null) { + var vars1 = handler.vars; + vars1.set("count",count); + count += 1; + var spawn1 = x * com_davidmaletz_tiles_Tile.SIZE; + var spawn2 = y * com_davidmaletz_tiles_Tile.SIZE; + var spawn3 = handler.getCurrentPath(); + s.build(null,area,spawn1,spawn2,new com_davidmaletz_faengfl_XmlPath(xml,spawn3),vars1); + } + }; + if(xml.exists("fromY")) { + var fromX = com_davidmaletz_mining_npc_NPCEventHandler.evalInt(xml.get("fromX"),vars) + offX; + var toX = com_davidmaletz_mining_npc_NPCEventHandler.evalInt(xml.get("toX"),vars) + offX; + var fromY = com_davidmaletz_mining_npc_NPCEventHandler.evalInt(xml.get("fromY"),vars) + offY; + var toY = com_davidmaletz_mining_npc_NPCEventHandler.evalInt(xml.get("toY"),vars) + offY; + var w = 1; + var h = 1; + var l = com_davidmaletz_mining_world_BasicObjectInfo.parseLayer(xml.get("layer"),true); + var canPlace; + var bottom = com_davidmaletz_mining_enemy_EnemySpawner.parseBottom(xml); + if(xml.get("place") == "wall") { + var length = com_davidmaletz_mining_Main.parseInt(xml.get("length")); + canPlace = function(x1,y1) { + if(!area.hasObjectInTile(x1,y1,l) && area.getTileId(x1,y1,0) >= 0) { + if(!com_davidmaletz_mining_world_Generate.isEmpty(area,x1 - length,x1,y1,y1 + 1)) { + return com_davidmaletz_mining_world_Generate.isEmpty(area,x1 + 1,x1 + length + 1,y1,y1 + 1); + } else { + return true; + } + } else { + return false; + } + }; + } else { + var underwater = xml.get("underwater") == "true"; + var flying = xml.get("ground") == "false" || underwater; + if(xml.exists("width")) { + w = com_davidmaletz_mining_Main.parseInt(xml.get("width")); + } + if(xml.exists("height")) { + h = com_davidmaletz_mining_Main.parseInt(xml.get("height")); + } + canPlace = function(x2,y2) { + if(!com_davidmaletz_mining_world_Generate.hasObject(area,x2,y2,w,h,l,s != null)) { + var canPlace1 = xml.get("tile"); + return com_davidmaletz_mining_enemy_EnemySpawner._canPlace(area,x2,y2,w,h,flying,underwater,bottom,canPlace1); + } else { + return false; + } + }; + } + var ct = com_davidmaletz_faengfl_EventHandler.execute(xml.get("count"),vars); + var fail = 50; + while(ct > 0 && fail > 0) { + var x3 = com_davidmaletz_mining_Main.randInt(fromX,toX); + var y3 = com_davidmaletz_mining_Main.randInt(fromY,toY); + if(bottom != 0) { + y3 = com_davidmaletz_mining_enemy_EnemySpawner.adjustBottom(area,x3,y3,fromY,toY,bottom); + } + if(canPlace(x3,y3)) { + spawn(x3,y3); + --ct; + } else { + --fail; + } + } + if(ct == 0) { + return; + } + var ar = []; + var _g1 = fromY; + var _g = toY; + while(_g1 < _g) { + var y4 = _g1++; + var _g3 = fromX; + var _g2 = toX; + while(_g3 < _g2) { + var x4 = _g3++; + if(canPlace(x4,y4)) { + ar.push(new com_fancyfish_faeng_common_Node(x4,y4)); + } + } + } + while(ct > 0 && ar.length > 0) { + var v = Math.floor(Math.random() * ar.length); + var n = ar[v]; + if(v != ar.length - 1) { + ar[v] = ar[ar.length - 1]; + } + ar.pop(); + if(!com_davidmaletz_mining_world_Generate.hasObject(area,n.x,n.y,w,h,l,s != null)) { + spawn(n.x,n.y); + --ct; + } + } + } else if(xml.exists("start")) { + if(Std["is"](handler,com_davidmaletz_mining_world_GenerateEventHandler) && array != null) { + var st = com_davidmaletz_mining_Main.parseFloat(xml.get("start")); + var end = com_davidmaletz_mining_Main.parseFloat(xml.get("end")); + if(xml.exists("percent")) { + var tmp = com_davidmaletz_mining_Main.parseFloat(xml.get("percent")); + com_davidmaletz_mining_world_Generate.addUndergroundPercent(handler,area,xml,array,o,st,end,tmp,offX,offY); + } else if(xml.exists("count")) { + var tmp1 = com_davidmaletz_faengfl_EventHandler.execute(xml.get("count"),vars); + com_davidmaletz_mining_world_Generate.addUnderground(handler,area,xml,array,o,st,end,tmp1,offX,offY); + } + } + } else { + var y5 = (xml.exists("y") ? com_davidmaletz_mining_Main.parseInt(xml.get("y")) : -1) + offY; + var pos = []; + var ct1; + if(xml.exists("between")) { + var ar1 = arrays.get(xml.get("between")); + var len = ar1.length; + var add = function(p) { + var _g11 = 1; + var _g4 = len; + while(_g11 < _g4) { + var i = _g11++; + var x5 = Math.round(com_fancyfish_faeng_common_Utils.interp(ar1[i - 1],ar1[i],p)); + if(!area.hasObjectInTile(x5,y5)) { + pos.push(x5); + } + } + }; + add(com_davidmaletz_mining_Main.parseFloat(xml.get("pos"))); + if(xml.exists("altPos")) { + add(com_davidmaletz_mining_Main.parseFloat(xml.get("altPos"))); + } + } else if(xml.exists("minDist")) { + var x6 = com_davidmaletz_mining_Main.parseInt(xml.get("startX")) + offX; + var end1 = com_davidmaletz_mining_Main.parseInt(xml.get("endX")) + offX; + var minDist = com_davidmaletz_mining_Main.parseInt(xml.get("minDist")); + var maxDist = com_davidmaletz_mining_Main.parseInt(xml.get("maxDist")); + if(minDist > 0) { + --end1; + } + while(true) { + x6 += minDist + Math.floor(Math.random() * (maxDist - minDist + 1)); + if(minDist < 0 == x6 < end1) { + break; + } + pos.push(x6); + spawn(x6,y5); + } + if(xml.exists("array")) { + arrays.set(xml.get("array"),pos); + } + return; + } else if(xml.exists("fromArray")) { + var l1 = arrays.get(xml.get("fromArray"))[0] + 1; + var r = arrays.get(xml.get("toArray"))[0]; + var ex = xml.exists("exclude") ? com_davidmaletz_mining_Main.parseInt(xml.get("exclude")) : -100000; + var _g12 = l1; + var _g5 = r; + while(_g12 < _g5) { + var i1 = _g12++; + if(i1 != ex && !area.hasObjectInTile(i1,y5)) { + pos.push(i1); + } + } + } else if(xml.exists("fromX")) { + var fromX1 = com_davidmaletz_mining_Main.parseInt(xml.get("fromX")) + offX; + var toX1 = com_davidmaletz_mining_Main.parseInt(xml.get("toX")) + offX; + var _g13 = fromX1; + var _g6 = toX1; + while(_g13 < _g6) { + var x7 = _g13++; + if(!area.hasObjectInTile(x7,y5)) { + pos.push(x7); + } + } + } else { + return; + } + if(xml.exists("percent")) { + ct1 = Math.round(pos.length * com_davidmaletz_mining_Main.parseFloat(xml.get("percent"))); + } else { + ct1 = com_davidmaletz_faengfl_EventHandler.execute(xml.get("count"),vars); + } + if(ct1 > pos.length) { + ct1 = pos.length; + } + var _g14 = 0; + var _g7 = ct1; + while(_g14 < _g7) { + var i2 = _g14++; + var v1 = Math.floor(Math.random() * pos.length); + var x8 = pos[v1]; + if(v1 != pos.length - 1) { + pos[v1] = pos[pos.length - 1]; + } + pos.pop(); + spawn(x8,y5); + } + } +}; +com_davidmaletz_mining_world_Generate.map = null; +com_davidmaletz_mining_world_Generate.set = function(e) { + if(com_davidmaletz_mining_world_Generate.map == null) { + com_davidmaletz_mining_world_Generate.map = new haxe_ds_StringMap(); + } + var id = e.get("id"); + if(com_davidmaletz_mining_world_Generate.map.exists(id)) { + haxe_Log.trace("Overwrite Area: " + id,{ fileName : "Generate.hx", lineNumber : 280, className : "com.davidmaletz.mining.world.Generate", methodName : "set"}); + } + com_davidmaletz_mining_world_Generate.map.set(id,e); +}; +com_davidmaletz_mining_world_Generate.get = function(id) { + var ret = com_davidmaletz_mining_world_Generate._get(id); + if(id != null && id.length > 0 && ret == null) { + haxe_Log.trace("No Area found: " + id,{ fileName : "Generate.hx", lineNumber : 283, className : "com.davidmaletz.mining.world.Generate", methodName : "get"}); + com_davidmaletz_mining_Main.error = true; + } + return ret; +}; +com_davidmaletz_mining_world_Generate._get = function(id) { + if(id == null || com_davidmaletz_mining_world_Generate.map == null) { + return null; + } else { + return com_davidmaletz_mining_world_Generate.map.get(id); + } +}; +com_davidmaletz_mining_world_Generate.exists = function(id) { + if(id != null && com_davidmaletz_mining_world_Generate.map != null) { + return com_davidmaletz_mining_world_Generate.map.exists(id); + } else { + return false; + } +}; +com_davidmaletz_mining_world_Generate.reset = function() { + com_davidmaletz_mining_world_Generate.map = null; +}; +com_davidmaletz_mining_world_Generate.create = function(id,areas,r) { + var xml = com_davidmaletz_mining_world_Generate.get(id); + if(xml == null) { + return null; + } else { + return com_davidmaletz_mining_world_Generate.load(id,areas,xml,r); + } +}; +com_davidmaletz_mining_world_Generate.makeShape = function(xml,vars) { + var ret = new com_davidmaletz_mining_world_CompoundShape(); + if(xml.exists("width")) { + var s = com_davidmaletz_mining_world_Shapes.parse(xml,vars); + if(s != null) { + ret.addShape(s); + } + } + var e = xml.elementsNamed("shape"); + while(e.hasNext()) { + var e1 = e.next(); + var s1 = com_davidmaletz_mining_world_Shapes.parse(e1,vars); + if(s1 != null) { + ret.addShape(s1); + } + } + return ret; +}; +com_davidmaletz_mining_world_Generate._load = function(area,areas,xml,vars,offX,offY,onComplete) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + var yStrength = xml.get("uniform") == "true" ? 0 : 1; + if(xml.exists("yStrength")) { + yStrength = com_davidmaletz_mining_Main.parseFloat(xml.get("yStrength")); + } + var xStrength = xml.exists("xStrength") ? com_davidmaletz_mining_Main.parseFloat(xml.get("xStrength")) : 0; + var s = com_davidmaletz_mining_world_Generate.makeShape(xml,vars); + var array = com_davidmaletz_mining_world_Generate.generate(area,s,yStrength,xStrength); + var e = new com_davidmaletz_mining_world_GenerateEventHandler(area,areas,s,array,xml,offX,offY,onComplete,vars); + e.start(); + return e; +}; +com_davidmaletz_mining_world_Generate.fixAreaLights = function(area) { + var loop = area.isLooping(); + var c = area.floor.iterator(); + while(c.hasNext()) { + var c1 = c.next(); + com_davidmaletz_mining_world_Generate.fixLights(area,c1,loop); + } +}; +com_davidmaletz_mining_world_Generate.load = function(id,areas,xml,r) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + var st = openfl_Lib.getTimer(); + var area = new com_davidmaletz_mining_world_Area(id,com_davidmaletz_mining_world_Area.parseLoop(id)); + area.vehicle = r; + com_davidmaletz_mining_world_Generate._load(area,areas,xml,com_davidmaletz_faengfl_EventHandler.createVariables()); + area.updateChunks(81); + com_davidmaletz_mining_world_Generate.fixAreaLights(area); + haxe_Log.trace("Generate " + id + ": " + (openfl_Lib.getTimer() - st) / 1000 + "s",{ fileName : "Generate.hx", lineNumber : 309, className : "com.davidmaletz.mining.world.Generate", methodName : "load"}); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + return area; +}; +var com_davidmaletz_mining_world__$Generate_RunAction = function(action,r,player,version,area) { + this.action = action; + this.renderer = r; + this.player = player; + this.version = version; + this.area = area == null ? this.renderer.area : area; +}; +$hxClasses["com.davidmaletz.mining.world._Generate.RunAction"] = com_davidmaletz_mining_world__$Generate_RunAction; +com_davidmaletz_mining_world__$Generate_RunAction.__name__ = ["com","davidmaletz","mining","world","_Generate","RunAction"]; +com_davidmaletz_mining_world__$Generate_RunAction.prototype = { + action: null + ,renderer: null + ,player: null + ,version: null + ,area: null + ,run: function(n,onComplete,offsetX,offsetY) { + if(offsetY == null) { + offsetY = 0; + } + if(offsetX == null) { + offsetX = 0; + } + var id = n == null ? null : n.get("id"); + var xml = com_davidmaletz_mining_world_Generate.get(id == null ? this.area.id : id); + if(xml != null) { + if(n != null && n.exists("offsetX")) { + var ox = Std.parseInt(n.get("offsetX")); + if(ox != null) { + offsetX += ox; + } + } + if(n != null && n.exists("offsetY")) { + var oy = Std.parseInt(n.get("offsetY")); + if(oy != null) { + offsetY += oy; + } + } + var iter = xml.elementsNamed("appendArea"); + if(iter.hasNext()) { + onComplete = ($_=new com_davidmaletz_mining_world__$Generate_RunNext(this,iter,onComplete,offsetX,offsetY),$bind($_,$_.runNext)); + } + var v = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(this.player); + v.set("version",this.version); + v.set("offsetX",offsetX); + v.set("offsetY",offsetY); + v.set("area",this.area); + com_davidmaletz_mining_Main.runEvent(this.action,this.player,xml,this.renderer == null ? this.area : this.renderer,onComplete,v); + } else if(onComplete != null) { + onComplete(); + } + } + ,__class__: com_davidmaletz_mining_world__$Generate_RunAction +}; +var com_davidmaletz_mining_world__$Generate_RunNext = function(action,i,func,offX,offY) { + this.action = action; + this.iter = i; + this.onComplete = func; + this.offsetX = offX; + this.offsetY = offY; +}; +$hxClasses["com.davidmaletz.mining.world._Generate.RunNext"] = com_davidmaletz_mining_world__$Generate_RunNext; +com_davidmaletz_mining_world__$Generate_RunNext.__name__ = ["com","davidmaletz","mining","world","_Generate","RunNext"]; +com_davidmaletz_mining_world__$Generate_RunNext.prototype = { + action: null + ,iter: null + ,onComplete: null + ,offsetX: null + ,offsetY: null + ,runNext: function() { + if(this.iter.hasNext()) { + this.action.run(this.iter.next(),$bind(this,this.runNext),this.offsetX,this.offsetY); + } else if(this.onComplete != null) { + this.onComplete(); + } + } + ,__class__: com_davidmaletz_mining_world__$Generate_RunNext +}; +var com_davidmaletz_mining_world_GenerateEventHandler = function(area,areas,s,array,xml,offX,offY,func,v) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + com_davidmaletz_faengfl_EventHandler.call(this,xml.elements(),func,v); + this.vars.set("area",area); + this.vars.set("mine",$bind(this,this.mine)); + var f = $bind(this,this.set); + var tmp = function(x,y,a2) { + f(0,x,y,a2); + }; + this.vars.set("setTile",tmp); + var f1 = $bind(this,this.set); + var tmp1 = function(x1,y1,a21) { + f1(3,x1,y1,a21); + }; + this.vars.set("setBack",tmp1); + var f2 = $bind(this,this.set); + var tmp2 = function(x2,y2,a22) { + f2(1,x2,y2,a22); + }; + this.vars.set("setOre",tmp2); + this.vars.set("areas",areas); + this.areas = areas; + this.vars.set("replaceTile",$bind(this,this.replaceTile)); + var a1 = area; + var tmp3 = function(id,x3,y3) { + return com_davidmaletz_mining_npc_NPCEventHandler._buildStructure(null,a1,id,x3,y3); + }; + this.vars.set("buildStructure",tmp3); + this.vars.set("offsetX",offX); + this.vars.set("offsetY",offY); + this.area = area; + this.array = array; + this.offX = offX; + this.offY = offY; + this.arrays = new haxe_ds_StringMap(); + this.shape = s; +}; +$hxClasses["com.davidmaletz.mining.world.GenerateEventHandler"] = com_davidmaletz_mining_world_GenerateEventHandler; +com_davidmaletz_mining_world_GenerateEventHandler.__name__ = ["com","davidmaletz","mining","world","GenerateEventHandler"]; +com_davidmaletz_mining_world_GenerateEventHandler.parseEmpty = function(str) { + if(str == "true") { + return 1; + } + var v = new haxe_ds_StringMap(); + v.set("front",1); + v.set("back",2); + return com_davidmaletz_faengfl_EventHandler.execute(str,v); +}; +com_davidmaletz_mining_world_GenerateEventHandler.removePad = function(ar,x,y,pad,w,h) { + var sx = -pad; + var ex = pad + 1; + var sy = sx; + var ey = ex; + if(sx + x < 0) { + sx = -x; + } + if(sy + y < 0) { + sy = -y; + } + if(ex + x > w) { + ex = w - x; + } + if(ey + y > h) { + ey = h - y; + } + var _g1 = sy; + var _g = ey; + while(_g1 < _g) { + var ty = _g1++; + var _g3 = sx; + var _g2 = ex; + while(_g3 < _g2) { + var tx = _g3++; + if(tx != 0 || ty != 0) { + HxOverrides.remove(ar,(y + ty) * w + (x + tx)); + } + } + } +}; +com_davidmaletz_mining_world_GenerateEventHandler.acceptPlace = function(area,x,y,expr,vars) { + vars.set("x",x); + vars.set("y",y); + try { + return com_davidmaletz_faengfl_EventHandler.interpret(expr,vars) == true; + } catch( e ) { + haxe_CallStack.lastException = e; + return false; + } +}; +com_davidmaletz_mining_world_GenerateEventHandler.place = function(area,e,vars) { + var b = com_davidmaletz_mining_npc_NPCEventHandler.getRect(e,vars,1); + var count = e.exists("count") ? com_davidmaletz_faengfl_EventHandler.execute(e.get("count"),vars) : 1; + var ar = []; + var pad = e.exists("pad") ? com_davidmaletz_mining_Main.parseInt(e.get("pad")) : 0; + var expr = com_davidmaletz_faengfl_EventHandler.parseString(com_fancyfish_faeng_common_Lang.escape(e.firstChild().get_nodeValue())); + var accept = null; + if(e.exists("accept")) { + try { + accept = com_davidmaletz_faengfl_EventHandler.parseString(e.get("accept")); + } catch( e1 ) { + haxe_CallStack.lastException = e1; + } + } + var sx = Math.round(b.x); + var sy = Math.round(b.y); + var w = Math.round(b.width); + var h = Math.round(b.height); + var _g1 = 0; + var _g = h; + while(_g1 < _g) { + var y = _g1++; + var _g3 = 0; + var _g2 = w; + while(_g3 < _g2) { + var x = _g3++; + if(accept == null || com_davidmaletz_mining_world_GenerateEventHandler.acceptPlace(area,sx + x,sy + y,accept,vars)) { + ar.push(y * w + x); + } + } + } + while(count > 0 && ar.length > 0) { + var i = Math.floor(Math.random() * ar.length); + var pos; + if(i == ar.length - 1) { + pos = ar.pop(); + } else { + pos = ar[i]; + ar[i] = ar.pop(); + } + var x1 = pos % w; + var y1 = Math.floor(pos / w); + if(pad > 0) { + com_davidmaletz_mining_world_GenerateEventHandler.removePad(ar,x1,y1,pad,w,h); + } + vars.set("x",sx + x1); + vars.set("y",sy + y1); + com_davidmaletz_faengfl_EventHandler.interpret(expr,vars); + --count; + } +}; +com_davidmaletz_mining_world_GenerateEventHandler.appendArea = function(area,areas,e,vars,fixLights,onComplete,offX,offY) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + var xml = com_davidmaletz_mining_world_Generate.get(e.get("id")); + if(xml != null) { + var v = new haxe_ds_StringMap(); + com_davidmaletz_faengfl_adv_ModHandler.copyVars(vars,v); + var i = e.elementsNamed("params"); + if(i.hasNext()) { + var params = i.next(); + var attr = params.attributes(); + while(attr.hasNext()) { + var attr1 = attr.next(); + v.set(attr1,com_davidmaletz_faengfl_EventHandler.execute(params.get(attr1),v)); + } + } + var x = e.exists("offsetX") ? com_davidmaletz_faengfl_EventHandler.execute(e.get("offsetX"),vars) : 0; + var y = e.exists("offsetY") ? com_davidmaletz_faengfl_EventHandler.execute(e.get("offsetY"),vars) : 0; + var ret = com_davidmaletz_mining_world_Generate._load(area,areas,xml,v,x + offX,y + offY,onComplete); + if(fixLights) { + com_davidmaletz_mining_world_Generate.fixAreaLights(area); + } + return ret; + } else { + return null; + } +}; +com_davidmaletz_mining_world_GenerateEventHandler.doMine = function(area,e,vars,offX,offY) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + var x = com_davidmaletz_faengfl_EventHandler.execute(e.get("x"),vars) + offX; + var y = com_davidmaletz_faengfl_EventHandler.execute(e.get("y"),vars) + offY; + var t = e.exists("tile") ? area.addTileIndex(e.get("tile")) : area.getTileId(x,y,0); + area.mine(x,y,t,e.exists("light") ? com_davidmaletz_mining_Main.parseInt(e.get("light")) : 0,null); +}; +com_davidmaletz_mining_world_GenerateEventHandler._setTile = function(area,x,y,layer,tile) { + if(tile == "invisible_block") { + area.setFlags(x,y,area.getFlags(x,y) | 2); + } else if(tile == null) { + area.setTile(x,y,layer,-1); + } else { + area.setTile(x,y,layer,area.addTileIndex(tile)); + } +}; +com_davidmaletz_mining_world_GenerateEventHandler.hasTile = function(area,x,y,layer,tile) { + if(tile == "invisible_block") { + return area.hasFlags(x,y,2); + } else { + return area.getTileId(x,y,layer) != -1; + } +}; +com_davidmaletz_mining_world_GenerateEventHandler.setTile = function(area,e,offX,offY,vars) { + com_davidmaletz_mining_world_GenerateEventHandler._setTile(area,com_davidmaletz_faengfl_EventHandler.execute(e.get("x"),vars) + offX,com_davidmaletz_faengfl_EventHandler.execute(e.get("y"),vars) + offY,com_davidmaletz_mining_world_Area.parseLayer(e.get("layer")),e.get("tile")); +}; +com_davidmaletz_mining_world_GenerateEventHandler.spreadTiles = function(area,e,offX,offY,vars) { + var expr = null; + if(e.exists("eval")) { + try { + expr = com_davidmaletz_faengfl_EventHandler.parseString(e.get("eval")); + } catch( e1 ) { + haxe_CallStack.lastException = e1; + } + } + var ar = []; + var visited = new haxe_ds_IntMap(); + var count = com_davidmaletz_mining_Main.parseInt(e.get("count")); + var t = e.get("tile"); + var layer = com_davidmaletz_mining_world_Area.parseLayer(e.get("layer")); + var n = 0; + var on = e.exists("on") ? area.addTileIndex(e.get("on")) : null; + var add = function(x,y) { + var i = com_fancyfish_faeng_common_Utils.getIdx(x,y); + if(!visited.exists(i)) { + ar.push(x); + ar.push(y); + n += 1; + visited.set(i,true); + } + }; + var x1 = com_davidmaletz_faengfl_EventHandler.execute(e.get("x"),vars) + offX; + var y1 = com_davidmaletz_faengfl_EventHandler.execute(e.get("y"),vars) + offY; + add(x1,y1); + var _g1 = 0; + var _g = count; + while(_g1 < _g) { + var ct = _g1++; + if(n == 0) { + break; + } + var i1 = Math.floor(Math.random() * n) * 2; + var x2 = ar[i1]; + var y2 = ar[i1 + 1]; + if(i1 == 2 * (n - 1)) { + ar.pop(); + ar.pop(); + } else { + var tmp = ar.pop(); + ar[i1 + 1] = tmp; + var tmp1 = ar.pop(); + ar[i1] = tmp1; + } + n -= 1; + if(!com_davidmaletz_mining_world_GenerateEventHandler.hasTile(area,x2,y2,layer,t)) { + var tile = expr != null ? com_davidmaletz_mining_npc_NPCEventHandler.evalString2(expr,vars,e.get("tile")) : e.get("tile"); + com_davidmaletz_mining_world_GenerateEventHandler._setTile(area,x2,y2,layer,tile); + } + var x3 = x2 - 1; + if(!com_davidmaletz_mining_world_GenerateEventHandler.hasTile(area,x3,y2,layer,t) && (on == null || area.getTileId(x3,y2,0) == on)) { + add(x3,y2); + } + var y3 = y2 - 1; + if(!com_davidmaletz_mining_world_GenerateEventHandler.hasTile(area,x2,y3,layer,t) && (on == null || area.getTileId(x2,y3,0) == on)) { + add(x2,y3); + } + var x4 = x2 + 1; + if(!com_davidmaletz_mining_world_GenerateEventHandler.hasTile(area,x4,y2,layer,t) && (on == null || area.getTileId(x4,y2,0) == on)) { + add(x4,y2); + } + var y4 = y2 + 1; + if(!com_davidmaletz_mining_world_GenerateEventHandler.hasTile(area,x2,y4,layer,t) && (on == null || area.getTileId(x2,y4,0) == on)) { + add(x2,y4); + } + } +}; +com_davidmaletz_mining_world_GenerateEventHandler.__super__ = com_davidmaletz_faengfl_EventHandler; +com_davidmaletz_mining_world_GenerateEventHandler.prototype = $extend(com_davidmaletz_faengfl_EventHandler.prototype,{ + area: null + ,arrays: null + ,array: null + ,offX: null + ,offY: null + ,shape: null + ,areas: null + ,mine: function(x,y,light,tile) { + if(light == null) { + light = 0; + } + x += this.offX; + y += this.offY; + var t = tile != null ? this.area.addTileIndex(tile) : this.area.getTileId(x,y,0); + return this.area.mine(x,y,t,light,null); + } + ,replaceTile: function(x,y,tile) { + com_davidmaletz_mining_world_GenerateEventHandler._setTile(this.area,x + this.offX,y + this.offY,0,tile); + this.area.setTile(x + this.offX,y + this.offY,3,-1); + } + ,set: function(layer,x,y,tile) { + com_davidmaletz_mining_world_GenerateEventHandler._setTile(this.area,x + this.offX,y + this.offY,layer,tile); + } + ,getArea: function(e) { + if(e.exists("area")) { + return com_davidmaletz_mining_Main.getLocalPlayer().areas.get(com_davidmaletz_mining_npc_NPCEventHandler.evalString(e.get("area"),this.vars)); + } else { + return this.area; + } + } + ,handleNode: function(e) { + var _g = e.get_nodeName(); + switch(_g) { + case "appendArea": + var ev = com_davidmaletz_mining_world_GenerateEventHandler.appendArea(this.area,this.areas,e,this.vars,false,$bind(this,this.handleNext),this.offX,this.offY); + if(ev != null) { + return true; + } + break; + case "light": + this.area.lightTiles(com_davidmaletz_faengfl_EventHandler.execute(e.get("x"),this.vars) + this.offX,com_davidmaletz_faengfl_EventHandler.execute(e.get("y"),this.vars) + this.offY,com_davidmaletz_faengfl_EventHandler.execute(e.get("size"),this.vars)); + break; + case "maze": + var r = com_davidmaletz_mining_npc_NPCEventHandler.getRect(e,this.vars,1); + r.x += this.offX; + r.y += this.offY; + com_davidmaletz_mining_world_Maze.generate(this.area,e.get("floor"),e.get("wall"),r,Math.random,e.exists("tilesPerCell") ? com_davidmaletz_mining_Main.parseInt(e.get("tilesPerCell")) : 1,this.vars,e.get("floorWall") == "true"); + break; + case "mine": + if(e.exists("start")) { + com_davidmaletz_mining_world_Generate.mine(this.area,this.array,com_davidmaletz_mining_Main.parseFloat(e.get("start")),com_davidmaletz_mining_Main.parseFloat(e.get("end")),this.offX,this.offY,e.exists("light") ? com_davidmaletz_mining_Main.parseInt(e.get("light")) : 0,e.get("tile"),e.get("backTile"),e.get("flood") == "true"); + } else if(e.exists("x") && e.exists("y")) { + com_davidmaletz_mining_world_GenerateEventHandler.doMine(this.area,e,this.vars,this.offX,this.offY); + } else if(e.exists("y")) { + com_davidmaletz_mining_world_Generate.mineLayer(this.area,this.shape,com_davidmaletz_mining_Main.parseInt(e.get("y")),this.offX,this.offY,e.exists("light") ? com_davidmaletz_mining_Main.parseInt(e.get("light")) : 0,e); + } else if(e.exists("x")) { + com_davidmaletz_mining_world_Generate.mineColumn(this.area,this.shape,com_davidmaletz_mining_Main.parseInt(e.get("x")),this.offX,this.offY,e.exists("light") ? com_davidmaletz_mining_Main.parseInt(e.get("light")) : 0,e.get("tile")); + } + break; + case "object": + com_davidmaletz_mining_npc_NPCEventHandler.addObject(e,this.getArea(e),this.vars,this.offX,this.offY); + break; + case "objects": + com_davidmaletz_mining_world_Generate.placeObjects(this,this.getArea(e),e,this.array,this.arrays,this.offX,this.offY,this.vars); + break; + case "ore": + var st = com_davidmaletz_mining_Main.parseFloat(e.get("start")); + var end = com_davidmaletz_mining_Main.parseFloat(e.get("end")); + var t = this.area.addTileIndex(e.get("id")); + var o = e.exists("tile") ? this.area.addTileIndex(e.get("tile")) : -1; + if(e.exists("percent")) { + com_davidmaletz_mining_world_Generate.addOrePercent(this.area,this.array,t,st,end,com_davidmaletz_mining_Main.parseFloat(e.get("percent")),this.offX,this.offY,o); + } else if(e.exists("count")) { + com_davidmaletz_mining_world_Generate.addOre(this.area,this.array,t,st,end,com_davidmaletz_mining_Main.parseInt(e.get("count")),this.offX,this.offY,o); + } + break; + case "place": + com_davidmaletz_mining_world_GenerateEventHandler.place(this.area,e,this.vars); + break; + case "setTile": + com_davidmaletz_mining_world_GenerateEventHandler.setTile(this.area,e,this.offX,this.offY,this.vars); + break; + case "shore": + com_davidmaletz_mining_world_Generate.makeShore(this.area,e,e.exists("height") ? com_davidmaletz_mining_Main.parseInt(e.get("height")) : this.shape.bounds.max_y,this.offX,this.offY); + break; + case "spreadTiles": + com_davidmaletz_mining_world_GenerateEventHandler.spreadTiles(this.area,e,this.offX,this.offY,this.vars); + break; + case "structure": + com_davidmaletz_mining_npc_NPCEventHandler.buildStructure(null,this.getArea(e),e,this.getCurrentPath(),this.vars,this.offX,this.offY); + break; + case "tiles": + var t1 = e.get("id"); + var v = null; + if(e.exists("eval")) { + t1 = e.get("eval"); + v = this.vars; + } + if(e.exists("from")) { + com_davidmaletz_mining_world_Generate.addTileMap(this.area,openfl_Assets.getBitmapData(com_davidmaletz_faengfl_EventHandler.getResource(this.getCurrentPath(),e.get("from"))),e,com_davidmaletz_mining_Main.parseInt(e.get("x")) + this.offX,com_davidmaletz_mining_Main.parseInt(e.get("y")) + this.offY,com_davidmaletz_mining_world_GenerateEventHandler.parseEmpty(e.get("empty")),this.vars); + } else if(e.exists("y")) { + com_davidmaletz_mining_world_Generate.addTileLayer(this.area,t1,this.shape,com_davidmaletz_mining_npc_NPCEventHandler.evalInt(e.get("y"),this.vars),this.offX,this.offY,v,com_davidmaletz_mining_world_GenerateEventHandler.parseEmpty(e.get("empty")),e.get("inShape") != "false"); + } else if(e.exists("x")) { + com_davidmaletz_mining_world_Generate.addTileColumn(this.area,t1,this.shape,com_davidmaletz_mining_npc_NPCEventHandler.evalInt(e.get("x"),this.vars),this.offX,this.offY,v,com_davidmaletz_mining_world_GenerateEventHandler.parseEmpty(e.get("empty")),e.get("inShape") != "false"); + } else if(e.exists("top")) { + com_davidmaletz_mining_world_Generate.addTileTop(this.area,t1,this.shape,com_davidmaletz_mining_npc_NPCEventHandler.evalInt(e.get("top"),this.vars),this.offX,this.offY,v,com_davidmaletz_mining_world_GenerateEventHandler.parseEmpty(e.get("empty")),e.get("includeShape") != "false"); + } else { + com_davidmaletz_mining_world_Generate.addTiles(this.area,this.array,t1,com_davidmaletz_mining_Main.parseFloat(e.get("start")),com_davidmaletz_mining_Main.parseFloat(e.get("end")),this.offX,this.offY,v,com_davidmaletz_mining_world_GenerateEventHandler.parseEmpty(e.get("empty")),e.exists("count") ? com_davidmaletz_mining_Main.parseInt(e.get("count")) : 0); + } + break; + default: + return com_davidmaletz_faengfl_EventHandler.prototype.handleNode.call(this,e); + } + return false; + } + ,__class__: com_davidmaletz_mining_world_GenerateEventHandler +}); +var com_davidmaletz_mining_world_HitEffect = function(xml,o,e) { + this.xml = xml; + this.attacker = o; + this.element = e; + this.count = 0; + var e1 = com_davidmaletz_mining_world_Element.get(xml.get("element")); + if(e1 != null) { + this.element = e1; + } + if(xml.exists("min") && xml.exists("max")) { + this.count = com_davidmaletz_mining_Main.randInt(com_davidmaletz_mining_Main.parseInt(xml.get("min")) - 1,com_davidmaletz_mining_Main.parseInt(xml.get("max"))); + } + var i = xml.elementsNamed("light"); + if(i.hasNext()) { + this.light = new com_davidmaletz_mining_world_LightInfo(i.next()); + } +}; +$hxClasses["com.davidmaletz.mining.world.HitEffect"] = com_davidmaletz_mining_world_HitEffect; +com_davidmaletz_mining_world_HitEffect.__name__ = ["com","davidmaletz","mining","world","HitEffect"]; +com_davidmaletz_mining_world_HitEffect.prototype = { + xml: null + ,attacker: null + ,element: null + ,count: null + ,light: null + ,isFreeze: function() { + if(this.xml.exists("freeze")) { + return com_davidmaletz_mining_Main.parseFloat(this.xml.get("freeze")) >= 1; + } else { + return false; + } + } + ,getDamageRange: function() { + if(this.xml.exists("damage")) { + var d = com_davidmaletz_mining_Main.parseInt(this.xml.get("damage")); + if(this.xml.exists("min") && this.xml.exists("max")) { + return d * com_davidmaletz_mining_Main.parseInt(this.xml.get("min")) + "-" + d * com_davidmaletz_mining_Main.parseInt(this.xml.get("max")); + } else if(d == null) { + return "null"; + } else { + return "" + d; + } + } else { + return null; + } + } + ,__class__: com_davidmaletz_mining_world_HitEffect +}; +var com_davidmaletz_mining_world_HitEffects = function() { + this.knockback = 0; + this.steal = 0; + this.hitEffect = null; + this.sfx = null; +}; +$hxClasses["com.davidmaletz.mining.world.HitEffects"] = com_davidmaletz_mining_world_HitEffects; +com_davidmaletz_mining_world_HitEffects.__name__ = ["com","davidmaletz","mining","world","HitEffects"]; +com_davidmaletz_mining_world_HitEffects.current = null; +com_davidmaletz_mining_world_HitEffects.prototype = { + knockback: null + ,steal: null + ,hitEffect: null + ,sfx: null + ,execute: function(o,attacker,r,dmg) { + if(this.knockback != 0) { + o.knockback(this.knockback); + } + if(dmg > 0) { + if(this.steal != 0 && attacker != null) { + attacker.onStealHealth(dmg,this.steal); + } + o.hitEffect(this.hitEffect.hitEffect,this.hitEffect.x,this.hitEffect.y,false,this.hitEffect.flip,this.hitEffect.scale); + if(r != null && this.sfx != null) { + com_davidmaletz_faengfl_adv_sound_Sound.playLoc(this.sfx,r,this.hitEffect.x == null ? new openfl_geom_Point(o.getCenterX(),o.getCenterY()) : new openfl_geom_Point(this.hitEffect.x,this.hitEffect.y),false,o.getSoundScale()); + } + } + } + ,__class__: com_davidmaletz_mining_world_HitEffects +}; +var com_davidmaletz_mining_world_ItemObjectInfo = function(i,id,n) { + this.capture = 0; + this.damage = 0; + this.blocking = false; + com_davidmaletz_mining_world_ObjectInfo.call(this,id == null ? i.id : id,0,i.xml); + this.item = new com_davidmaletz_mining_item_Item(i,0,n); + this.layer = 2; + this.loadXML(i.xml); + this.type = i.xml.get("object"); +}; +$hxClasses["com.davidmaletz.mining.world.ItemObjectInfo"] = com_davidmaletz_mining_world_ItemObjectInfo; +com_davidmaletz_mining_world_ItemObjectInfo.__name__ = ["com","davidmaletz","mining","world","ItemObjectInfo"]; +com_davidmaletz_mining_world_ItemObjectInfo.setMessage = function(o,onComplete,msg) { + (js_Boot.__cast(o , com_davidmaletz_mining_world_SignObject)).set_message(msg); + onComplete(o); +}; +com_davidmaletz_mining_world_ItemObjectInfo.__super__ = com_davidmaletz_mining_world_ObjectInfo; +com_davidmaletz_mining_world_ItemObjectInfo.prototype = $extend(com_davidmaletz_mining_world_ObjectInfo.prototype,{ + item: null + ,blocking: null + ,layer: null + ,type: null + ,tile: null + ,animation: null + ,damage: null + ,capture: null + ,light: null + ,create: function(x,y) { + var _g = this.type; + switch(_g) { + case "fuelable": + return new com_davidmaletz_mining_world_FuelableObject(this,x,y); + case "minecart": + return new com_davidmaletz_mining_world_Minecart(this,x,y); + case "powerplant": + return new com_davidmaletz_mining_world_PowerplantObject(this,x,y); + case "sign": + return new com_davidmaletz_mining_world_SignObject(this,x,y); + case "smelter": + return new com_davidmaletz_mining_world_SmelterObject(this,x,y); + case "storehouse": + return new com_davidmaletz_mining_world_StorehouseObject(this,x,y); + case "trap": + return new com_davidmaletz_mining_world_TrapObject(this,x,y); + default: + return new com_davidmaletz_mining_world_ItemObject(this,x,y); + } + } + ,createIcon: function() { + return this.item.getTile(); + } + ,place: function(x,y,value,onComplete) { + var o = this.create(x,y); + var _g = this.type; + switch(_g) { + case "fuelable": + (js_Boot.__cast(o , com_davidmaletz_mining_world_FuelableObject)).setValue(value); + onComplete(o); + break; + case "powerplant": + (js_Boot.__cast(o , com_davidmaletz_mining_world_PowerplantObject)).setValue(value); + onComplete(o); + break; + case "sign": + var c = com_davidmaletz_mining_Main.getContainer(); + var o1 = o; + var a1 = onComplete; + var tmp = function(a2) { + com_davidmaletz_mining_world_ItemObjectInfo.setMessage(o1,a1,a2); + }; + c.addDisplay(new com_davidmaletz_mining_ui_TextInput(c,com_fancyfish_faeng_common_Lang.getText("common","sign_message"),tmp),2); + break; + case "smelter": + (js_Boot.__cast(o , com_davidmaletz_mining_world_SmelterObject)).setValue(value); + onComplete(o); + break; + default: + onComplete(o); + } + } + ,loadAdditional: function(xml) { + this.loadXML(xml); + } + ,loadXML: function(xml) { + if(xml.exists("blocking")) { + this.blocking = xml.get("blocking") == "true"; + } + if(xml.exists("type")) { + this.type = xml.get("type"); + } + if(xml.exists("tile")) { + this.tile = xml.get("tile"); + } + if(xml.exists("layer")) { + this.layer = com_davidmaletz_mining_world_BasicObjectInfo.parseLayer(xml.get("layer")); + } + if(xml.exists("animation")) { + this.animation = xml.get("animation"); + } + if(xml.exists("damage")) { + this.damage = com_davidmaletz_mining_Main.parseInt(xml.get("damage")); + } + if(xml.exists("capture")) { + this.capture = com_davidmaletz_mining_Main.parseFloat(xml.get("capture")); + if(xml.get("captureType") == "spirit") { + this.capture = -this.capture; + } + } + var i = xml.elementsNamed("light"); + if(i.hasNext()) { + this.light = new com_davidmaletz_mining_world_LightInfo(i.next()); + } + } + ,__class__: com_davidmaletz_mining_world_ItemObjectInfo +}); +var com_davidmaletz_mining_world_LabelObject = function() { }; +$hxClasses["com.davidmaletz.mining.world.LabelObject"] = com_davidmaletz_mining_world_LabelObject; +com_davidmaletz_mining_world_LabelObject.__name__ = ["com","davidmaletz","mining","world","LabelObject"]; +com_davidmaletz_mining_world_LabelObject.__interfaces__ = [openfl_events_IEventDispatcher]; +var com_davidmaletz_mining_world_Light = function(info,x,y) { + this.aabb_id = -1; + this.info = info; + this.tile = info.getTile(); + this.x = x; + this.y = y; + if(this.tile != null) { + this.width = this.tile.getTileWidth(0,0); + this.height = this.tile.getTileHeight(0,0); + } else { + this.width = 1; + this.height = 1; + } +}; +$hxClasses["com.davidmaletz.mining.world.Light"] = com_davidmaletz_mining_world_Light; +com_davidmaletz_mining_world_Light.__name__ = ["com","davidmaletz","mining","world","Light"]; +com_davidmaletz_mining_world_Light.prototype = { + info: null + ,area: null + ,tile: null + ,renderer: null + ,aabb_id: null + ,x: null + ,y: null + ,width: null + ,height: null + ,addToArea: function(area) { + if(area != this.area) { + if(this.area != null) { + this.removeFromArea(this.area); + } + this.area = area; + area.lights.addObject(this); + } + } + ,removeFromArea: function(area) { + if(area != null && this.area == area) { + this.area.lights.removeObject(this); + this.area = null; + } + } + ,updateRendererLoop: function() { + com_davidmaletz_mining_renderer_AreaRenderer.updateLoop(this.renderer,this.area); + } + ,setPosition: function(x,y) { + if(x != this.x || y != this.y) { + if(this.area != null) { + this.area.lights.moveObject(this,x + this.info.offsetX - this.width * 0.5,y + this.info.offsetY - this.height * 0.5); + } + if(this.renderer != null) { + this.renderer.set_x(x); + this.renderer.set_y(y); + this.updateRendererLoop(); + } + this.x = x; + this.y = y; + } + } + ,getBounds: function() { + com_davidmaletz_mining_world_Object.rectangle.setTo(this.x + this.info.offsetX - this.width * 0.5,this.y + this.info.offsetY - this.height * 0.5,this.width,this.height); + return com_davidmaletz_mining_world_Object.rectangle; + } + ,intersects: function(r,issect) { + return com_fancyfish_faeng_pack_AABBObjectList.intersects(r,this.getBounds(),issect); + } + ,createRenderer: function() { + if(this.tile == null) { + return new openfl_display_Sprite(); + } + var light; + if(this.info.flicker) { + light = new com_davidmaletz_mining_effects_Torchlight(null,this.info); + } else { + light = new openfl_display_Sprite(); + light.addChild(com_davidmaletz_mining_effects_Torchlight.create(this.tile,this.info.offsetX,this.info.offsetY,this.info.animation,this.info.fps)); + com_davidmaletz_faengfl_TextSprite.setColor(light,this.info.color); + } + return light; + } + ,getRenderer: function() { + if(this.renderer == null) { + this.renderer = this.createRenderer(); + } + this.renderer.set_x(this.x); + this.renderer.set_y(this.y); + return this.renderer; + } + ,__class__: com_davidmaletz_mining_world_Light +}; +var com_davidmaletz_mining_world_LightInfo = function(xml) { + this.cached = null; + this.tile = xml.get("tile"); + if(xml.exists("color")) { + this.color = com_davidmaletz_mining_Main.parseInt("0x" + xml.get("color")); + } else { + this.color = 16777215; + } + this.flicker = xml.get("flicker") == "true"; + this.offsetX = xml.exists("offsetX") ? com_davidmaletz_mining_Main.parseInt(xml.get("offsetX")) : 0; + this.offsetY = xml.exists("offsetY") ? com_davidmaletz_mining_Main.parseInt(xml.get("offsetY")) : 0; + this.xml = xml; + this.fps = com_davidmaletz_mining_enemy_AttackRenderer.getFPS(xml,10); + this.animation = xml.get("animation"); + if(xml.get("linkAnim") == "true") { + this.animation = "single"; + } +}; +$hxClasses["com.davidmaletz.mining.world.LightInfo"] = com_davidmaletz_mining_world_LightInfo; +com_davidmaletz_mining_world_LightInfo.__name__ = ["com","davidmaletz","mining","world","LightInfo"]; +com_davidmaletz_mining_world_LightInfo.prototype = { + tile: null + ,color: null + ,flicker: null + ,fps: null + ,offsetX: null + ,offsetY: null + ,xml: null + ,animation: null + ,cached: null + ,makeTile: function() { + return com_davidmaletz_tiles_Tile.get(this.tile); + } + ,getTile: function() { + if(this.cached == null) { + this.cached = this.makeTile(); + } + return this.cached; + } + ,__class__: com_davidmaletz_mining_world_LightInfo +}; +var com_davidmaletz_mining_world_Maze = function() { }; +$hxClasses["com.davidmaletz.mining.world.Maze"] = com_davidmaletz_mining_world_Maze; +com_davidmaletz_mining_world_Maze.__name__ = ["com","davidmaletz","mining","world","Maze"]; +com_davidmaletz_mining_world_Maze.generate = function(area,floor,wall,rect,rnd,tilesPerCell,vars,floorWall) { + if(floorWall == null) { + floorWall = false; + } + if(tilesPerCell == null) { + tilesPerCell = 1; + } + var sx = Math.round(rect.x); + var sy = Math.round(rect.y); + var w = Math.round(rect.width); + var h = Math.round(rect.height); + var map = new com_fancyfish_faeng_common_Bitmask2D(w,h,false); + var first = false; + var wallList = []; + var tpc = tilesPerCell; + var nodes = []; + var visited = new haxe_ds_IntMap(); + var _g1 = 0; + var _g = h; + while(_g1 < _g) { + var y = _g1++; + var _g3 = 0; + var _g2 = w; + while(_g3 < _g2) { + var x = _g3++; + if(!com_davidmaletz_mining_world_Maze.isEmpty(area,sx + x * tpc,sy + y * tpc,tpc)) { + com_davidmaletz_mining_world_Maze.setFloor(map,x,y,wallList); + if(!visited.exists(y * w + x)) { + var n = new com_fancyfish_faeng_common_Node(x,y); + nodes.push(n); + com_davidmaletz_mining_world_Maze.floodFill(visited,area,n,sx,sy,w,h,tpc); + } + } + } + } + while(wallList.length > 0) { + var i = Math.floor(rnd() * wallList.length); + var n1; + if(i == wallList.length - 1) { + n1 = wallList.pop(); + } else { + n1 = wallList[i]; + wallList[i] = wallList.pop(); + } + if(com_davidmaletz_mining_world_Maze.canRemoveWall(map,n1.x,n1.y)) { + com_davidmaletz_mining_world_Maze.setFloor(map,n1.x,n1.y,wallList); + } + } + var len = nodes.length; + if(len > 0) { + com_fancyfish_faeng_common_Utils.shuffle(nodes,rnd); + var _g11 = 1; + var _g4 = len; + while(_g11 < _g4) { + var i1 = _g11++; + com_davidmaletz_mining_world_Maze.pathfind(map,nodes[i1],nodes[Math.floor(rnd() * i1)]); + } + } + var ft = null; + if(vars != null) { + try { + ft = com_davidmaletz_faengfl_EventHandler.parseString(floor); + } catch( e ) { + haxe_CallStack.lastException = e; + } + } + var wt = null; + if(vars != null) { + try { + wt = com_davidmaletz_faengfl_EventHandler.parseString(wall); + } catch( e1 ) { + haxe_CallStack.lastException = e1; + } + } + var _g12 = 0; + var _g5 = h; + while(_g12 < _g5) { + var y1 = _g12++; + var _g31 = 0; + var _g21 = w; + while(_g31 < _g21) { + var x1 = _g31++; + var isWall = map.get(x1,y1) == false; + var _x = sx + x1 * tpc; + var _y = sy + y1 * tpc; + var _g51 = 0; + var _g41 = tpc; + while(_g51 < _g41) { + var ty = _g51++; + var _g7 = 0; + var _g6 = tpc; + while(_g7 < _g6) { + var tx = _g7++; + if(area.isEmptyTile(_x + tx,_y + ty)) { + area.setTile(_x + tx,_y + ty,isWall || floorWall ? 0 : 3,isWall ? com_davidmaletz_mining_world_Maze.getTile(area,wall,wt,vars) : com_davidmaletz_mining_world_Maze.getTile(area,floor,ft,vars)); + } + } + } + } + } +}; +com_davidmaletz_mining_world_Maze.getTile = function(area,tile,expr,vars) { + var t = expr != null ? com_davidmaletz_mining_npc_NPCEventHandler.evalString2(expr,vars,tile) : tile; + return area.addTileIndex(t); +}; +com_davidmaletz_mining_world_Maze.isEmpty = function(area,x,y,tpc) { + var _g1 = 0; + var _g = tpc; + while(_g1 < _g) { + var ty = _g1++; + var _g3 = 0; + var _g2 = tpc; + while(_g3 < _g2) { + var tx = _g3++; + if(!area.isEmptyTile(x + tx,y + ty)) { + return false; + } + } + } + return true; +}; +com_davidmaletz_mining_world_Maze.toNodeDesc = function(to,a,b) { + return b.depth + com_fancyfish_faeng_common_Utils.abs(b.x - to.x) + com_fancyfish_faeng_common_Utils.abs(b.y - to.y) < a.depth + com_fancyfish_faeng_common_Utils.abs(a.x - to.x) + com_fancyfish_faeng_common_Utils.abs(a.y - to.y); +}; +com_davidmaletz_mining_world_Maze.insertNode = function(map,queue,x,y,parent) { + var n = new com_fancyfish_faeng_common_Node(x,y,parent); + if(map.get(x,y) == false) { + n.depth -= 1000; + } + queue.insert(n); +}; +com_davidmaletz_mining_world_Maze.pathfind = function(map,from,to) { + var visited = new haxe_ds_IntMap(); + var to1 = to; + var queue = new com_fancyfish_faeng_common_Heap(function(a,b) { + return com_davidmaletz_mining_world_Maze.toNodeDesc(to1,a,b); + }); + var w = map.width; + var h = map.height; + queue.insert(from); + while(!queue.isEmpty()) { + var n = queue.remove(); + if(visited.exists(n.y * w + n.x)) { + continue; + } + visited.set(n.y * w + n.x,true); + if(n.x == to.x && n.y == to.y) { + while(n != null) { + map.set(n.x,n.y,true); + n = n.parent; + } + return; + } + if(n.x > 1) { + com_davidmaletz_mining_world_Maze.insertNode(map,queue,n.x - 1,n.y,n); + } + if(n.y > 1) { + com_davidmaletz_mining_world_Maze.insertNode(map,queue,n.x,n.y - 1,n); + } + if(n.x < w - 2) { + com_davidmaletz_mining_world_Maze.insertNode(map,queue,n.x + 1,n.y,n); + } + if(n.y < h - 2) { + com_davidmaletz_mining_world_Maze.insertNode(map,queue,n.x,n.y + 1,n); + } + } +}; +com_davidmaletz_mining_world_Maze.insertFill = function(area,queue,x,y,sx,sy,tpc) { + if(!com_davidmaletz_mining_world_Maze.isEmpty(area,sx + x * tpc,sy + y * tpc,tpc)) { + var n = new com_fancyfish_faeng_common_Node(x,y); + queue.push(n); + } +}; +com_davidmaletz_mining_world_Maze.floodFill = function(visited,area,n,sx,sy,w,h,tpc) { + var queue = [n]; + while(queue.length > 0) { + var n1 = queue.pop(); + if(visited.exists(n1.y * w + n1.x)) { + continue; + } + visited.set(n1.y * w + n1.x,true); + if(n1.x > 0) { + com_davidmaletz_mining_world_Maze.insertFill(area,queue,n1.x - 1,n1.y,sx,sy,tpc); + } + if(n1.y > 0) { + com_davidmaletz_mining_world_Maze.insertFill(area,queue,n1.x,n1.y - 1,sx,sy,tpc); + } + if(n1.x < w - 1) { + com_davidmaletz_mining_world_Maze.insertFill(area,queue,n1.x + 1,n1.y,sx,sy,tpc); + } + if(n1.y < h - 1) { + com_davidmaletz_mining_world_Maze.insertFill(area,queue,n1.x,n1.y + 1,sx,sy,tpc); + } + } +}; +com_davidmaletz_mining_world_Maze.setFloor = function(map,x,y,wallList) { + if(map.get(x,y) == true) { + return; + } + map.set(x,y,true); + if(x > 1 && map.get(x - 1,y) == false && com_davidmaletz_mining_world_Maze.canRemoveWall(map,x - 1,y)) { + wallList.push(new com_fancyfish_faeng_common_Node(x - 1,y)); + } + if(y > 1 && map.get(x,y - 1) == false && com_davidmaletz_mining_world_Maze.canRemoveWall(map,x,y - 1)) { + wallList.push(new com_fancyfish_faeng_common_Node(x,y - 1)); + } + if(x < map.width - 2 && map.get(x + 1,y) == false && com_davidmaletz_mining_world_Maze.canRemoveWall(map,x + 1,y)) { + wallList.push(new com_fancyfish_faeng_common_Node(x + 1,y)); + } + if(y < map.height - 2 && map.get(x,y + 1) == false && com_davidmaletz_mining_world_Maze.canRemoveWall(map,x,y + 1)) { + wallList.push(new com_fancyfish_faeng_common_Node(x,y + 1)); + } +}; +com_davidmaletz_mining_world_Maze.canRemoveWall = function(map,x,y) { + var ct = 0; + var w = map.width - 1; + var h = map.height - 1; + var dir = -1; + if(x > 0 && map.get(x - 1,y) == true) { + ++ct; + dir = 0; + } + if(y > 0 && map.get(x,y - 1) == true) { + ++ct; + dir = 1; + } + if(x < w && map.get(x + 1,y) == true) { + ++ct; + dir = 2; + } + if(y < h && map.get(x,y + 1) == true) { + ++ct; + dir = 3; + } + if(ct != 1) { + return false; + } else if(dir >= 2 && x > 0 && y > 0 && map.get(x - 1,y - 1) == true) { + return false; + } else if((dir == 1 || dir == 2) && x > 0 && y < h && map.get(x - 1,y + 1) == true) { + return false; + } else if((dir == 0 || dir == 3) && x < w && y > 0 && map.get(x + 1,y - 1) == true) { + return false; + } else if(dir < 2 && x < w && y < h && map.get(x + 1,y + 1) == true) { + return false; + } else { + return true; + } +}; +var com_davidmaletz_mining_world_StorehouseObject = function(info,x,y) { + this.opened = true; + com_davidmaletz_mining_world_ItemObject.call(this,info,x,y); + this.inventory = new com_davidmaletz_mining_item_Inventory(); + if(this.getInfo().item.info.xml.get("openAnim") != "false") { + this.inventory.addEventListener("item_added",$bind(this,this.update)); + } +}; +$hxClasses["com.davidmaletz.mining.world.StorehouseObject"] = com_davidmaletz_mining_world_StorehouseObject; +com_davidmaletz_mining_world_StorehouseObject.__name__ = ["com","davidmaletz","mining","world","StorehouseObject"]; +com_davidmaletz_mining_world_StorehouseObject.__interfaces__ = [com_davidmaletz_mining_world_LabelObject]; +com_davidmaletz_mining_world_StorehouseObject.__super__ = com_davidmaletz_mining_world_ItemObject; +com_davidmaletz_mining_world_StorehouseObject.prototype = $extend(com_davidmaletz_mining_world_ItemObject.prototype,{ + label: null + ,inventory: null + ,opened: null + ,getWeight: function() { + return com_davidmaletz_mining_world_ItemObject.prototype.getWeight.call(this) + this.inventory.getWeight(); + } + ,isBack: function() { + return true; + } + ,getAction: function(p) { + if(!this.isVisible()) { + return null; + } else { + return com_davidmaletz_mining_world_ItemObject.itemText(com_fancyfish_faeng_common_Lang.getText("object.tooltip","open"),this.getInfo().item); + } + } + ,getWatchInventory: function() { + return this.inventory; + } + ,update: function(e) { + var o = !this.inventory.hasItem(); + if(this.opened != o) { + this.opened = o; + this.playAnimation(this.opened ? "open" : "close"); + } + } + ,onOver: function(p) { + com_davidmaletz_mining_world_ItemObject.prototype.onOver.call(this,p); + if(this.label != null) { + this.showMessage(this.label); + } + } + ,onOut: function(p) { + com_davidmaletz_mining_world_ItemObject.prototype.onOut.call(this,p); + this.hideMessage(); + } + ,getLabel: function() { + return this.label; + } + ,setLabel: function(s) { + this.set_label(s); + } + ,set_label: function(s) { + if(this.label != s) { + this.label = s; + this.dispatchEvent(new openfl_events_Event("change_label")); + } + return s; + } + ,onRename: function(s) { + if(s == "") { + s = null; + } + this.set_label(s); + if(this.label == null) { + this.hideMessage(); + } else { + this.showMessage(this.label); + } + } + ,_rename: function() { + var c = com_davidmaletz_mining_Main.getContainer(); + var map = new haxe_ds_StringMap(); + map.set("{item}",this.getInfo().item.getName()); + var m = new com_fancyfish_faeng_common_mutable_MutableTemplate(com_fancyfish_faeng_common_Lang.getText("common","rename"),map); + c.addDisplay(new com_davidmaletz_mining_ui_TextInput(c,m,$bind(this,this.onRename),this.label,20,120),2); + } + ,_onOperate: function(p) { + var c = com_davidmaletz_mining_Main.getContainer(); + var wnd = new com_davidmaletz_mining_ui_TransferInventory(p,p.inventory,this.inventory,com_fancyfish_faeng_common_Lang.getText("common","inventory"),this.getInfo().item.getName(),c,p.capacity); + var w = wnd.getWidth(); + var h = wnd.getHeight(); + var WIDTH = 60; + var dx = WIDTH * 2 - 11; + var rename = new com_davidmaletz_mining_ui_TextButton(w + 1,h + 1,com_fancyfish_faeng_common_Lang.getText("actions","rename"),$bind(this,this._rename),WIDTH); + wnd.addChildAt(rename,0); + wnd.clickables.addClickable(rename,wnd); + var _g = rename; + _g.set_y(_g.get_y() + 1); + rename.getPos().y += 1; + var _g1 = rename; + _g1.set_x(_g1.get_x() - dx); + rename.getPos().x -= dx; + var f = $bind(this,this.collect); + var p1 = p; + c.addDisplay(com_davidmaletz_mining_world_ItemObject.collectWindow(wnd,w + 12,h,function() { + f(p1); + }),2); + } + ,doOperate: function(p) { + if(com_davidmaletz_mining_Main.PIRATE && this.area.id != "start" && this.inventory.hasItem()) { + this.inventory.clear(); + var c = com_davidmaletz_mining_Main.getContainer(); + var f = $bind(this,this._onOperate); + var p1 = p; + var tmp = function() { + f(p1); + }; + c.addDisplay(new com_davidmaletz_mining_ui_DialogueBox(c,com_fancyfish_faeng_common_Lang.getText("trader","pirate").get(),tmp),2); + } else { + this._onOperate(p); + } + } + ,createRenderer: function() { + var ret = this.makeAnimSprite(); + if(this.getInfo().item.info.xml.get("openAnim") != "false") { + ret.playAnimation(this.getAnim(this.opened ? "open" : "close"),false,null,-0.5,0); + } + return ret; + } + ,getAnim: function(id) { + return this.getInfo().item.info.getAnim(id); + } + ,playAnimation: function(id,onComplete,loop) { + if(loop == null) { + loop = false; + } + if(this.renderer != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_tiles_render_PlayAnimation)).playAnimation(this.getAnim(id),loop,onComplete == null ? null : function(p) { + onComplete(); + },-0.5,0); + } else { + com_davidmaletz_mining_world_ItemObject.prototype.playAnimation.call(this,id,onComplete,loop); + } + } + ,collect: function(p) { + p.inventory.addAll(this.inventory); + this.inventory.clear(); + com_davidmaletz_mining_world_ItemObject.prototype.doOperate.call(this,p); + } + ,write: function(b) { + com_davidmaletz_mining_world_ItemObject.prototype.write.call(this,b); + this.inventory.write(b); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.label); + } + ,read: function(b,version) { + com_davidmaletz_mining_world_ItemObject.prototype.read.call(this,b,version); + this.inventory.read(b,version); + if(version >= 74) { + try { + this.set_label(com_fancyfish_faeng_common_UTFUtils.readUTF(b)); + } catch( e ) { + haxe_CallStack.lastException = e; + this.set_label(null); + } + } + } + ,__class__: com_davidmaletz_mining_world_StorehouseObject + ,__properties__: $extend(com_davidmaletz_mining_world_ItemObject.prototype.__properties__,{set_label:"set_label"}) +}); +var com_davidmaletz_mining_world_Minecart = function(info,x,y) { + com_davidmaletz_mining_world_StorehouseObject.call(this,info,x,y); +}; +$hxClasses["com.davidmaletz.mining.world.Minecart"] = com_davidmaletz_mining_world_Minecart; +com_davidmaletz_mining_world_Minecart.__name__ = ["com","davidmaletz","mining","world","Minecart"]; +com_davidmaletz_mining_world_Minecart.__super__ = com_davidmaletz_mining_world_StorehouseObject; +com_davidmaletz_mining_world_Minecart.prototype = $extend(com_davidmaletz_mining_world_StorehouseObject.prototype,{ + intersects: function(r,issect) { + var b = this.getBounds(); + b.inflate(0,com_davidmaletz_tiles_Tile.SIZE * 0.5); + return com_fancyfish_faeng_pack_AABBObjectList.intersects(r,b,issect); + } + ,getHitbox: function(notOperate) { + if(notOperate == null) { + notOperate = true; + } + var ret = this.getBounds(); + ret.inflate(0,com_davidmaletz_tiles_Tile.SIZE * 0.5); + this.info.modifyHitbox(ret); + return ret; + } + ,canEnterTile: function(x,y) { + if(this.area == null) { + return false; + } + var t = this.area.getTile(x,y,1); + var o; + var tmp; + if(t != null) { + o = com_davidmaletz_mining_world_Area.getOre(t.id); + tmp = o != null; + } else { + tmp = false; + } + if(tmp) { + return o.get("rail") == this.getInfo().item.info.xml.get("rail"); + } else { + return false; + } + } + ,onPlayerMove: function(p,dx,dy,frames) { + if(this.area == null) { + return; + } + var b = p.getBounds(); + var bleft = b.x + b.width * 0.5 + dx; + var bright = bleft; + var btop = b.y + b.height * 0.5 + dy; + var bbottom = btop; + var b1 = this.getBounds(); + var x = this.get_tile_x() * com_davidmaletz_tiles_Tile.SIZE; + var y = this.get_tile_y() * com_davidmaletz_tiles_Tile.SIZE; + if(dx > 0 && bright > b1.get_left()) { + x = this.xPos + Math.round(bright - b1.get_left()); + } else if(dx < 0 && bleft < b1.get_right()) { + x = this.xPos + Math.round(bleft - b1.get_right()); + } else if(dy > 0 && bbottom > b1.get_top()) { + y = this.yTile + Math.round(bbottom - b1.get_top()); + } else if(dy < 0 && btop < b1.get_bottom()) { + y = this.yTile + Math.round(btop - b1.get_bottom()); + } else { + return; + } + b1.x = x; + b1.y = y; + var ret = false; + var me = this; + this.area.getObjects(b1,function(o,rect) { + if(o != me && Std["is"](o,com_davidmaletz_mining_world_Minecart)) { + ret = true; + return true; + } else { + return false; + } + },null,0); + if(ret) { + return; + } + var tx = dx < 0 ? Math.floor(this.xPos / com_davidmaletz_tiles_Tile.SIZE - 1) : dx > 0 ? Math.ceil(this.xPos / com_davidmaletz_tiles_Tile.SIZE + 1) : this.get_tile_x(); + var ty = dy < 0 ? Math.floor(this.yTile / com_davidmaletz_tiles_Tile.SIZE - 1) : dy > 0 ? Math.ceil(this.yTile / com_davidmaletz_tiles_Tile.SIZE + 1) : this.get_tile_y(); + if(!this.canEnterTile(tx,ty) || p.getTileBlockId(tx,ty) >= 0) { + tx -= com_fancyfish_faeng_common_Utils.sign(dx); + ty -= com_fancyfish_faeng_common_Utils.sign(dy); + if(!this.canEnterTile(tx,ty) || p.getTileBlockId(tx,ty) >= 0) { + return; + } + if(dx != 0) { + x = tx * com_davidmaletz_tiles_Tile.SIZE; + } + if(dy != 0) { + y = ty * com_davidmaletz_tiles_Tile.SIZE; + } + } + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + this.setPosition(x,y); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + if(this.renderer != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_tiles_render_TileAnimationRenderer)).incFrame(frames,true); + } + } + ,moveRemotePlayer: function(p,dx,dy) { + this.onPlayerMove(p,dx,dy,com_davidmaletz_faengfl_FaengFL.frameTime); + return false; + } + ,createRenderer: function() { + var info = this.getInfo(); + var t = com_davidmaletz_tiles_Tile.get(info.tile); + var a = info.animation; + var ico = info.item.getTile(); + if(t == null) { + t = ico; + var anim = info.item.info.getAnimation(info.item.getNameStr()); + if(anim != null) { + a = anim.id; + } + } + if(a == null) { + a = "single"; + } + var r = new com_davidmaletz_tiles_render_TileAnimationRenderer(t,10); + r.setAnimation(a,-0.5,0); + if(t == ico) { + info.item.info.tint(r.anim_sprite,info.item.getNameStr()); + } + return r; + } + ,getLayer: function() { + return 3; + } + ,playAnimation: function(id,onComplete,loop) { + if(loop == null) { + loop = false; + } + if(onComplete != null) { + onComplete(); + } + } + ,__class__: com_davidmaletz_mining_world_Minecart +}); +var com_davidmaletz_mining_world_Movement = function(o,func,paused) { + if(paused == null) { + paused = false; + } + this.ct = 0; + if(o.movement != null) { + o.movement.kill(); + } + o.movement = this; + this.object = o; + this.setPos = func; + this.paused = paused; + o.addEventListener("add_to_area",$bind(this,this.init)); + o.addEventListener("removed_from_area",$bind(this,this.destroy)); + if(o.area != null) { + this.init(null); + } +}; +$hxClasses["com.davidmaletz.mining.world.Movement"] = com_davidmaletz_mining_world_Movement; +com_davidmaletz_mining_world_Movement.__name__ = ["com","davidmaletz","mining","world","Movement"]; +com_davidmaletz_mining_world_Movement.__interfaces__ = [com_davidmaletz_faengfl_EnterFrameHandler]; +com_davidmaletz_mining_world_Movement._circle = function(_target,offX,offY,radius,speed,o,ct,frames) { + var target = _target; + if(Std["is"](target,com_davidmaletz_mining_Player)) { + var p = js_Boot.__cast(target , com_davidmaletz_mining_Player); + if(p.vehicle != null) { + target = p.vehicle; + } + } + if(target.area == null) { + return ct; + } + var r = target.renderer; + var x = (r == null ? target.getCenterX() : r.get_x()) + offX * target.getFacing(); + var y = (r == null ? target.getCenterY() : r.get_y()) + offY; + x += radius * Math.cos(ct * speed); + y += radius * Math.sin(ct * speed); + o.setPosition(Math.round(x - o._width * 0.5),Math.round(y + o._height * 0.5 - com_davidmaletz_tiles_Tile.SIZE)); + return ct + frames; +}; +com_davidmaletz_mining_world_Movement.circle = function(o,target,radius,speed,paused,offX,offY,pos) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + if(paused == null) { + paused = false; + } + var s = speed / 60; + if(target == null) { + return; + } + var p = pos == null ? Math.atan2(o.getCenterY() - target.getCenterY(),o.getCenterX() - target.getCenterX()) : pos; + o.dispatchEvent(new com_davidmaletz_mining_world_MovementEvent("movement_circle",target,speed,offX,offY,p,radius)); + var a1 = target; + var a2 = offX; + var a3 = offY; + var a4 = radius * com_davidmaletz_tiles_Tile.SIZE; + var a5 = s; + var m = new com_davidmaletz_mining_world_Movement(o,function(o1,ct,a6) { + return com_davidmaletz_mining_world_Movement._circle(a1,a2,a3,a4,a5,o1,ct,a6); + },paused); + m.ct = p / s; + m.enter_frame(0); +}; +com_davidmaletz_mining_world_Movement._seek = function(_target,offX,offY,maxDist,speed,o,ct,frames) { + var target = _target; + if(Std["is"](target,com_davidmaletz_mining_Player)) { + var p = js_Boot.__cast(target , com_davidmaletz_mining_Player); + if(p.vehicle != null) { + target = p.vehicle; + } + } + if(target.area == null) { + return ct; + } + var dx = target.getCenterX() + offX * target.getFacing() - o.getCenterX(); + var dy = target.getCenterY() + offY - o.getCenterY(); + var loop = o.area == null ? -1 : o.area.getLoop(); + if(loop > 0) { + loop *= com_davidmaletz_tiles_Tile.SIZE; + var lh = loop * 0.5; + if(dx > lh) { + dx -= loop; + } else if(dx < -lh) { + dx += loop; + } + } + var len = Math.sqrt(dx * dx + dy * dy); + if(len <= 1) { + return 0; + } + if(maxDist >= 0 && len > maxDist) { + len = maxDist; + } + var f = speed * frames / len; + dx *= f; + dy *= f; + dx += Math.floor(ct) / 16384; + dy += com_fancyfish_faeng_common_Utils.fract(ct); + var x = Math.floor(dx); + var y = Math.floor(dy); + o.setPosition(o.xPos + x,o.yTile + y); + return Math.round((dx - x) * 16384) + dy - y; +}; +com_davidmaletz_mining_world_Movement.seek = function(o,target,speed,paused,offX,offY,maxDist) { + if(maxDist == null) { + maxDist = -1; + } + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + if(paused == null) { + paused = false; + } + var s = speed * com_davidmaletz_tiles_Tile.SIZE / 60; + if(target == null) { + return; + } + o.dispatchEvent(new com_davidmaletz_mining_world_MovementEvent("movement_seek",target,speed,offX,offY,maxDist)); + var a1 = target; + var a2 = offX; + var a3 = offY; + var a4 = maxDist; + var a5 = s; + new com_davidmaletz_mining_world_Movement(o,function(o1,ct,a6) { + return com_davidmaletz_mining_world_Movement._seek(a1,a2,a3,a4,a5,o1,ct,a6); + },paused); +}; +com_davidmaletz_mining_world_Movement.prototype = { + object: null + ,ct: null + ,setPos: null + ,paused: null + ,init: function(e) { + this.destroy(null); + if(this.object == null) { + return; + } + if(this.paused) { + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.handle_frame)); + } else { + com_davidmaletz_faengfl_FaengFL.addEnterFrame(this); + } + } + ,destroy: function(e) { + if(this.paused) { + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.handle_frame)); + } else { + com_davidmaletz_faengfl_FaengFL.removeEnterFrame(this); + } + } + ,handle_frame: function(e) { + this.enter_frame(com_davidmaletz_faengfl_FaengFL.frameTime); + } + ,enter_frame: function(frames) { + if(this.object == null || this.object.area == null || !this.object.area.isInit && this.object.area.renderer == null) { + this.kill(); + } else if(com_davidmaletz_mining_Main.getLocalPlayer() != null) { + this.ct = this.setPos(this.object,this.ct,frames); + } + } + ,kill: function() { + if(this.object != null) { + this.object.removeEventListener("add_to_area",$bind(this,this.init)); + this.object.removeEventListener("removed_from_area",$bind(this,this.destroy)); + this.destroy(null); + this.object = null; + } + } + ,__class__: com_davidmaletz_mining_world_Movement +}; +var com_davidmaletz_mining_world_MovementEvent = function(type,t,s,x,y,data,radius) { + if(radius == null) { + radius = 0; + } + openfl_events_Event.call(this,type); + this.otarget = t; + this.speed = s; + this.offX = x; + this.offY = y; + this.data = data; + this.radius = radius; +}; +$hxClasses["com.davidmaletz.mining.world.MovementEvent"] = com_davidmaletz_mining_world_MovementEvent; +com_davidmaletz_mining_world_MovementEvent.__name__ = ["com","davidmaletz","mining","world","MovementEvent"]; +com_davidmaletz_mining_world_MovementEvent.__super__ = openfl_events_Event; +com_davidmaletz_mining_world_MovementEvent.prototype = $extend(openfl_events_Event.prototype,{ + otarget: null + ,speed: null + ,offX: null + ,offY: null + ,data: null + ,radius: null + ,__class__: com_davidmaletz_mining_world_MovementEvent +}); +var com_davidmaletz_mining_world_Blocker = function() { + this.object = null; + this.bounds = new openfl_geom_Rectangle(); +}; +$hxClasses["com.davidmaletz.mining.world.Blocker"] = com_davidmaletz_mining_world_Blocker; +com_davidmaletz_mining_world_Blocker.__name__ = ["com","davidmaletz","mining","world","Blocker"]; +com_davidmaletz_mining_world_Blocker.prototype = { + object: null + ,bounds: null + ,__class__: com_davidmaletz_mining_world_Blocker +}; +var com_davidmaletz_mining_world_HitEffectEvent = function(type,e,x,y,flip,scale) { + openfl_events_Event.call(this,type); + this.hitEffect = e; + this.x = x; + this.y = y; + this.flip = flip; + this.scale = scale; +}; +$hxClasses["com.davidmaletz.mining.world.HitEffectEvent"] = com_davidmaletz_mining_world_HitEffectEvent; +com_davidmaletz_mining_world_HitEffectEvent.__name__ = ["com","davidmaletz","mining","world","HitEffectEvent"]; +com_davidmaletz_mining_world_HitEffectEvent.read = function(b) { + var ret = Type.createEmptyInstance(com_davidmaletz_mining_world_HitEffectEvent); + ret.__read(b); + return ret; +}; +com_davidmaletz_mining_world_HitEffectEvent.__super__ = openfl_events_Event; +com_davidmaletz_mining_world_HitEffectEvent.prototype = $extend(openfl_events_Event.prototype,{ + hitEffect: null + ,x: null + ,y: null + ,flip: null + ,scale: null + ,__read: function(b) { + var count = b.readByte() & 255; + if(count == 255) { + this.hitEffect = null; + this.x = null; + this.y = null; + this.flip = false; + this.scale = 1; + } else { + var attacker = com_davidmaletz_mining_world_Object.getById(b.readUInt24(),null); + var element = com_davidmaletz_mining_world_Element.get(com_fancyfish_faeng_common_UTFUtils.readUTF(b)); + try { + this.hitEffect = new com_davidmaletz_mining_world_HitEffect(com_davidmaletz_faengfl_adv_ModHandler.makeXML2(Xml.parse(com_fancyfish_faeng_common_UTFUtils.readUTF(b)).firstElement(),"data/",com_davidmaletz_mining_world_ObjectInfo.getHitEffectById),attacker,element); + this.hitEffect.count = count; + } catch( e ) { + haxe_CallStack.lastException = e; + this.hitEffect = null; + } + this.x = b.readFloat(); + if(isNaN(this.x)) { + this.x = null; + } + this.y = b.readFloat(); + if(isNaN(this.y)) { + this.y = null; + } + var s = b.readFloat(); + this.flip = s < 0; + this.scale = Math.abs(s); + } + } + ,__class__: com_davidmaletz_mining_world_HitEffectEvent +}); +var com_davidmaletz_mining_world_ObjectDarkenKeyframe = function(o,a) { + if(a == null) { + a = 1; + } + this.object = o; + this.darken = a; +}; +$hxClasses["com.davidmaletz.mining.world.ObjectDarkenKeyframe"] = com_davidmaletz_mining_world_ObjectDarkenKeyframe; +com_davidmaletz_mining_world_ObjectDarkenKeyframe.__name__ = ["com","davidmaletz","mining","world","ObjectDarkenKeyframe"]; +com_davidmaletz_mining_world_ObjectDarkenKeyframe.__interfaces__ = [com_davidmaletz_lerp_Keyframe]; +com_davidmaletz_mining_world_ObjectDarkenKeyframe.prototype = { + frame: null + ,darken: null + ,object: null + ,set: function(from) { + var k = js_Boot.__cast(from , com_davidmaletz_mining_world_ObjectDarkenKeyframe); + this.darken = k.darken; + this.object = k.object; + } + ,setFromObject: function(a) { + this.darken = this.object.darkness; + } + ,getFrame: function() { + return this.frame; + } + ,setFrame: function(f) { + this.frame = f; + } + ,interp: function(track,other,f) { + var k = js_Boot.__cast(other , com_davidmaletz_mining_world_ObjectDarkenKeyframe); + return new com_davidmaletz_mining_world_ObjectDarkenKeyframe(this.object,track.interp(this.darken,k.darken,f)); + } + ,apply: function(a) { + this.object.set_darkness(this.darken); + } + ,toString: function() { + return "DARKEN " + this.frame + " " + this.darken; + } + ,__class__: com_davidmaletz_mining_world_ObjectDarkenKeyframe +}; +var com_davidmaletz_mining_world_ObjectIcon = function(i,v) { + this.info = i; + this.vars = v; +}; +$hxClasses["com.davidmaletz.mining.world.ObjectIcon"] = com_davidmaletz_mining_world_ObjectIcon; +com_davidmaletz_mining_world_ObjectIcon.__name__ = ["com","davidmaletz","mining","world","ObjectIcon"]; +com_davidmaletz_mining_world_ObjectIcon.__interfaces__ = [com_davidmaletz_mining_ui_Iconable]; +com_davidmaletz_mining_world_ObjectIcon.prototype = { + info: null + ,vars: null + ,getName: function() { + return this.info.getDisplayName(this.vars); + } + ,createIcon: function() { + var t = com_davidmaletz_tiles_Tile.get(this.info.getDisplayTile()); + if(t == null) { + t = com_davidmaletz_tiles_EmptyTile.get(); + } + return com_davidmaletz_mining_item_ItemInfo._createIcon(t); + } + ,getElement: function() { + return com_davidmaletz_mining_world_Element.get(this.info.xml.get("element")); + } + ,__class__: com_davidmaletz_mining_world_ObjectIcon +}; +var com_fancyfish_faeng_pack_AABBObjectList = function(loop) { + if(loop == null) { + loop = -1; + } + this.empty = []; + openfl_events_EventDispatcher.call(this); + this.objects = new ds_AABBTree(); + this.objectList = []; + this.loop = loop; +}; +$hxClasses["com.fancyfish.faeng.pack.AABBObjectList"] = com_fancyfish_faeng_pack_AABBObjectList; +com_fancyfish_faeng_pack_AABBObjectList.__name__ = ["com","fancyfish","faeng","pack","AABBObjectList"]; +com_fancyfish_faeng_pack_AABBObjectList.rectangle = null; +com_fancyfish_faeng_pack_AABBObjectList.inBounds = function(o,id) { + if(o.getBounds().intersects(com_fancyfish_faeng_pack_AABBObjectList.rectangle)) { + return ds_HitBehaviour.INCLUDE; + } else { + return ds_HitBehaviour.SKIP; + } +}; +com_fancyfish_faeng_pack_AABBObjectList.area = function(r) { + return r.width * r.height; +}; +com_fancyfish_faeng_pack_AABBObjectList.intersects = function(r1,r2,issect) { + if(issect == null) { + issect = 0; + } + if(issect <= 0) { + return r1.intersects(r2); + } else { + return com_fancyfish_faeng_pack_AABBObjectList.getIntersection(r1,r2) >= issect * Math.min(r1.width,r2.width) * Math.min(r1.height,r2.height); + } +}; +com_fancyfish_faeng_pack_AABBObjectList.getIntersection = function(r1,r2) { + return com_fancyfish_faeng_pack_AABBObjectList.area(r1.intersection(r2)); +}; +com_fancyfish_faeng_pack_AABBObjectList.__super__ = openfl_events_EventDispatcher; +com_fancyfish_faeng_pack_AABBObjectList.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + objects: null + ,objectList: null + ,loop: null + ,objectAdded: function(o) { + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("added",o)); + } + ,addObject: function(o) { + var b = o.getBounds(); + o.aabb_id = this.objects.insertLeaf(o,b.x,b.y,b.width,b.height); + this.objectList.push(o); + this.objectAdded(o); + } + ,objectRemoved: function(o) { + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("removed",o)); + } + ,removeObject: function(o) { + if(HxOverrides.remove(this.objectList,o)) { + this.objects.removeLeaf(o.aabb_id); + this.objectRemoved(o); + return true; + } else { + return false; + } + } + ,getObjectsInTile: function(x,y) { + if(com_fancyfish_faeng_pack_AABBObjectList.rectangle == null) { + com_fancyfish_faeng_pack_AABBObjectList.rectangle = new openfl_geom_Rectangle(); + } + var r = com_fancyfish_faeng_pack_AABBObjectList.rectangle; + r.setTo(x * com_davidmaletz_tiles_Tile.SIZE,y * com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE); + var ar = this.objects.query(r.x,r.y,r.width,r.height,false,null,com_fancyfish_faeng_pack_AABBObjectList.inBounds); + if(this.loop > 0) { + if(x < this.loop * 0.5) { + r.x += this.loop * com_davidmaletz_tiles_Tile.SIZE; + } else { + r.x -= this.loop * com_davidmaletz_tiles_Tile.SIZE; + } + this.objects.query(r.x,r.y,r.width,r.height,false,ar,com_fancyfish_faeng_pack_AABBObjectList.inBounds); + } + return HxOverrides.iter(ar); + } + ,empty: null + ,handleGetObjects: function(r,func,issect) { + if(issect == null) { + issect = 0; + } + var ret = false; + var _getObjects = function(o,id) { + if(o == null || o.intersects(r,issect) && func(o,r)) { + ret = true; + return ds_HitBehaviour.STOP; + } else { + return ds_HitBehaviour.SKIP; + } + }; + this.objects.query(r.x,r.y,r.width,r.height,false,this.empty,_getObjects); + return ret; + } + ,getObjects: function(b,func,onTile,issect) { + if(issect == null) { + issect = 0; + } + var r = b.clone(); + if(r.width <= 0 || r.height <= 0) { + return; + } + if(onTile != null) { + var sx = Math.floor(r.x / com_davidmaletz_tiles_Tile.SIZE); + var sy = Math.floor(r.y / com_davidmaletz_tiles_Tile.SIZE); + var ex = Math.ceil((r.x + r.width) / com_davidmaletz_tiles_Tile.SIZE); + var ey = Math.ceil((r.y + r.height) / com_davidmaletz_tiles_Tile.SIZE); + var _g1 = sy; + var _g = ey; + while(_g1 < _g) { + var y = _g1++; + var _g3 = sx; + var _g2 = ex; + while(_g3 < _g2) { + var x = _g3++; + if(onTile(x,y)) { + return; + } + } + } + } + if(func == null) { + return; + } + if(this.handleGetObjects(r,func,issect)) { + return; + } + if(this.loop > 0) { + var l = this.loop * com_davidmaletz_tiles_Tile.SIZE; + if(r.x < l * 0.5) { + r.x += l; + } else { + r.x -= l; + } + this.handleGetObjects(r,func,issect); + } + } + ,moveObject: function(obj,toX,toY) { + var b = obj.getBounds(); + var dx = toX - b.x; + var dy = toY - b.y; + var delta = com_davidmaletz_tiles_Tile.SIZE * 4; + if(Math.abs(dx) > delta) { + dx = 0; + } + if(Math.abs(dy) > delta) { + dy = 0; + } + this.objects.updateLeaf(obj.aabb_id,toX,toY,b.width,b.height,dx,dy); + } + ,reshapeObject: function(obj,old) { + var b = obj.getBounds(); + this.objects.updateLeaf(obj.aabb_id,b.x,b.y,b.width,b.height); + } + ,iterator: function() { + return HxOverrides.iter(this.objectList); + } + ,__class__: com_fancyfish_faeng_pack_AABBObjectList +}); +var com_davidmaletz_mining_world_ObjectLayer = function(area,loop) { + com_fancyfish_faeng_pack_AABBObjectList.call(this,loop); + this.area = area; +}; +$hxClasses["com.davidmaletz.mining.world.ObjectLayer"] = com_davidmaletz_mining_world_ObjectLayer; +com_davidmaletz_mining_world_ObjectLayer.__name__ = ["com","davidmaletz","mining","world","ObjectLayer"]; +com_davidmaletz_mining_world_ObjectLayer.__super__ = com_fancyfish_faeng_pack_AABBObjectList; +com_davidmaletz_mining_world_ObjectLayer.prototype = $extend(com_fancyfish_faeng_pack_AABBObjectList.prototype,{ + area: null + ,counts: null + ,getLiveCount: function(id) { + if(this.counts == null || !this.counts.exists(id)) { + return 0; + } else { + return this.counts.get(id); + } + } + ,incCount: function(id) { + if(this.counts == null) { + this.counts = new haxe_ds_StringMap(); + } + if(!this.counts.exists(id)) { + this.counts.set(id,1); + } else { + this.counts.set(id,this.counts.get(id) + 1); + } + } + ,decCount: function(id) { + if(this.counts != null && this.counts.exists(id)) { + var c = this.counts.get(id) - 1; + if(c <= 0) { + this.counts.remove(id); + } else { + this.counts.set(id,c); + } + } + } + ,objectAdded: function(object) { + if(object.info.id != null) { + this.incCount(object.info.id); + } + object.addToArea(this.area); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("add_object",object)); + } + ,objectRemoved: function(object) { + if(object.info.id != null) { + this.decCount(object.info.id); + } + object.removeFromArea(this.area); + } + ,destroyObject: function(object,killer,element) { + if(object.area != this.area) { + return; + } + if(this.removeObject(object)) { + object.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("rem_object",object)); + this.dispatchEvent(new com_davidmaletz_mining_world_RemoveEvent("rem_object",object,killer,element,this.area)); + } else { + com_fancyfish_faeng_common_Utils.printStackTrace("Destroy Object Error"); + } + } + ,__class__: com_davidmaletz_mining_world_ObjectLayer +}); +var com_davidmaletz_mining_world_RemoveEvent = function(type,obj,k,e,a) { + com_davidmaletz_faengfl_events_ObjectEvent.call(this,type,obj); + this.killer = k; + this.element = e; + this.area = a; +}; +$hxClasses["com.davidmaletz.mining.world.RemoveEvent"] = com_davidmaletz_mining_world_RemoveEvent; +com_davidmaletz_mining_world_RemoveEvent.__name__ = ["com","davidmaletz","mining","world","RemoveEvent"]; +com_davidmaletz_mining_world_RemoveEvent.__super__ = com_davidmaletz_faengfl_events_ObjectEvent; +com_davidmaletz_mining_world_RemoveEvent.prototype = $extend(com_davidmaletz_faengfl_events_ObjectEvent.prototype,{ + killer: null + ,element: null + ,area: null + ,__class__: com_davidmaletz_mining_world_RemoveEvent +}); +var com_davidmaletz_mining_world_Orbit = function(p,xml) { + this.planet = p; + this.width = com_davidmaletz_mining_Main.parseInt(xml.get("width")); + this.height = com_davidmaletz_mining_Main.parseInt(xml.get("height")); + this.areas = new haxe_ds_StringMap(); + this.loadAreas(xml); + this.id = xml.get("id"); + this.xml = xml; + if(!xml.xml.exists("looping")) { + xml.xml.set("looping","true"); + } + if(!xml.xml.exists("hasO2")) { + xml.xml.set("hasO2","false"); + } + xml.xml.set("planet",p.id); + xml.xml.set("external",this.id + ".station"); +}; +$hxClasses["com.davidmaletz.mining.world.Orbit"] = com_davidmaletz_mining_world_Orbit; +com_davidmaletz_mining_world_Orbit.__name__ = ["com","davidmaletz","mining","world","Orbit"]; +com_davidmaletz_mining_world_Orbit.cmpN = function(a,b) { + return com_fancyfish_faeng_common_Utils.sign(a.pos - b.pos); +}; +com_davidmaletz_mining_world_Orbit.prototype = { + id: null + ,planet: null + ,width: null + ,height: null + ,areas: null + ,area: null + ,pos: null + ,xml: null + ,enterPlanet: null + ,loadAreas: function(xml) { + var a = xml.elementsNamed("area"); + while(a.hasNext()) { + var a1 = a.next(); + this.areas.set(a1.get("id"),com_davidmaletz_mining_Main.parseInt(a1.get("x"))); + } + if(this.xml != null) { + this.xml = new com_davidmaletz_faengfl_XmlDual(this.xml,xml); + } + } + ,finish: function() { + this.area = []; + this.pos = []; + var list = []; + var a = this.areas.keys(); + while(a.hasNext()) { + var a1 = a.next(); + list.push(new com_davidmaletz_mining_world__$Orbit_AreaPos(a1,this.areas.get(a1))); + } + list.sort(com_davidmaletz_mining_world_Orbit.cmpN); + if(list.length != 0) { + var _g = 0; + while(_g < list.length) { + var l = list[_g]; + ++_g; + this.area.push(l.area); + this.pos.push(l.pos); + } + this.area.push(list[0].area); + this.pos.push(this.width); + } + com_davidmaletz_mining_world_Generate.set(this.xml); + var e = Xml.createElement("orbit"); + e.set("looping","true"); + e.set("id",this.id + ".station"); + e.set("type","none"); + e.set("background",this.xml.get("background")); + e.set("planet",this.planet.id); + e.set("powered","true"); + e.set("shouldLight","false"); + e.set("width",this.xml.get("width")); + e.set("height",this.xml.get("height")); + var i = Xml.createElement("init"); + i.addChild(Xml.createElement("runAreaLoad")); + e.addChild(i); + e.set("interior","true"); + e.set("name",this.xml.get("name")); + var i1 = Xml.createElement("onLoad"); + var m = Xml.createElement("music"); + m.set("id",this.xml.exists("stationMusic") ? this.xml.get("stationMusic") : "orbit"); + m.set("seconds","1"); + i1.addChild(m); + e.addChild(i1); + com_davidmaletz_mining_world_Generate.set(new com_davidmaletz_faengfl_XmlPath(e,"data/")); + this.enterPlanet = com_davidmaletz_faengfl_EventHandler.parseString(this.xml.get("canEnterPlanet")); + } + ,canEnterPlanet: function(p) { + if(this.enterPlanet == null) { + return true; + } else { + try { + return com_davidmaletz_faengfl_EventHandler.interpret(this.enterPlanet,com_davidmaletz_mining_npc_NPCEventHandler.createVariables(p)) == true; + } catch( e ) { + haxe_CallStack.lastException = e; + return false; + } + } + } + ,toOrbit: function(id) { + var a = this.areas.get(id); + if(a == null || com_davidmaletz_faengfl_adv_ModHandler.getModInfo("full_version") == null) { + return null; + } else { + return new com_davidmaletz_mining_world__$Orbit_ToOrbit(this,a,Math.floor(this.pos[com_fancyfish_faeng_common_Utils.drawCDF(this.pos,a,false) + 1])); + } + } + ,addConnections: function(a) { + if(com_davidmaletz_faengfl_adv_ModHandler.getModInfo("full_version") == null) { + return; + } + if(a.up == null) { + a.up = com_davidmaletz_mining_world__$Orbit_ToNav.getInstance(); + } + if(a.down == null) { + a.down = new com_davidmaletz_mining_world__$Orbit_FromOrbit(this); + } + if(a.left == null) { + a.left = new com_davidmaletz_mining_world_Connection(0,this.width,a.id,true); + } + if(a.right == null) { + a.right = new com_davidmaletz_mining_world_Connection(this.width,0,a.id,true); + } + } + ,__class__: com_davidmaletz_mining_world_Orbit +}; +var com_davidmaletz_mining_world__$Orbit_ToOrbit = function(orbit,sx,ex) { + com_davidmaletz_mining_world_Connection.call(this,-orbit.planet.height,orbit.height - 1,orbit.id,false); + this.orbit = orbit; + this.startX = sx * com_davidmaletz_tiles_Tile.SIZE; + this.dX = (ex - sx) * com_davidmaletz_tiles_Tile.SIZE; +}; +$hxClasses["com.davidmaletz.mining.world._Orbit.ToOrbit"] = com_davidmaletz_mining_world__$Orbit_ToOrbit; +com_davidmaletz_mining_world__$Orbit_ToOrbit.__name__ = ["com","davidmaletz","mining","world","_Orbit","ToOrbit"]; +com_davidmaletz_mining_world__$Orbit_ToOrbit.__super__ = com_davidmaletz_mining_world_Connection; +com_davidmaletz_mining_world__$Orbit_ToOrbit.prototype = $extend(com_davidmaletz_mining_world_Connection.prototype,{ + orbit: null + ,startX: null + ,dX: null + ,enter: function(p,x,y) { + if(!this.orbit.canEnterPlanet(p)) { + p.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","planet_closed")); + return; + } + var a = p.getCurrentArea(); + var xml = com_davidmaletz_mining_world_Area.getXML(a.id); + if(xml.elementsNamed("toOrbit").hasNext()) { + var f = $bind(this,this._orbit); + var p1 = p; + var x1 = x; + var y1 = y; + com_davidmaletz_mining_Main.runEvent("toOrbit",p,xml,a,function() { + f(p1,x1,y1); + }); + } else { + this._orbit(p,x,y); + } + } + ,_orbit: function(p,x,y) { + var a = p.getCurrentArea(); + var sx = a.getStartX() * com_davidmaletz_tiles_Tile.SIZE; + com_davidmaletz_mining_world_Connection.prototype.enter.call(this,p,this.startX + Math.floor((x - sx) / (a.getEndX() * com_davidmaletz_tiles_Tile.SIZE - sx) * this.dX),y); + var a1 = p.getCurrentArea(); + if(a1 != null && a1.id == this.area) { + this.orbit.addConnections(a1); + } + } + ,__class__: com_davidmaletz_mining_world__$Orbit_ToOrbit +}); +var com_davidmaletz_mining_world__$Orbit_ToNav = function() { + com_davidmaletz_mining_world_Connection.call(this,0,0,null,false); +}; +$hxClasses["com.davidmaletz.mining.world._Orbit.ToNav"] = com_davidmaletz_mining_world__$Orbit_ToNav; +com_davidmaletz_mining_world__$Orbit_ToNav.__name__ = ["com","davidmaletz","mining","world","_Orbit","ToNav"]; +com_davidmaletz_mining_world__$Orbit_ToNav.instance = null; +com_davidmaletz_mining_world__$Orbit_ToNav.getInstance = function() { + if(com_davidmaletz_mining_world__$Orbit_ToNav.instance == null) { + com_davidmaletz_mining_world__$Orbit_ToNav.instance = new com_davidmaletz_mining_world__$Orbit_ToNav(); + } + return com_davidmaletz_mining_world__$Orbit_ToNav.instance; +}; +com_davidmaletz_mining_world__$Orbit_ToNav.__super__ = com_davidmaletz_mining_world_Connection; +com_davidmaletz_mining_world__$Orbit_ToNav.prototype = $extend(com_davidmaletz_mining_world_Connection.prototype,{ + enter: function(p,x,y) { + var a = p.getCurrentArea(); + var xml = com_davidmaletz_mining_world_Area.getXML(a.id); + if(xml.elementsNamed("toNav").hasNext()) { + var f = $bind(this,this._nav); + var p1 = p; + com_davidmaletz_mining_Main.runEvent("toNav",p,xml,a,function() { + f(p1); + }); + } else { + this._nav(p); + } + } + ,_nav: function(p) { + if(!p.canJump()) { + return; + } + var p1 = p.getCurrentArea().planet; + var c = com_davidmaletz_mining_Main.getContainer(); + if(p1 != null && p1.system != null) { + c.addDisplay(new com_davidmaletz_mining_ui_SolarSystemNav(c,p1.system,$bind(this,this.ftlJump),$bind(this,this.acceptPlanet)),3); + } + } + ,_acceptPlanet: function(item,doAccept) { + var p = item.planet; + var player = com_davidmaletz_mining_Main.getLocalPlayer(); + var from = player.getCurrentArea().planet; + if(p != null && p.system != from.system) { + var c = player.getJumpCost(item.planet); + if(c == "false") { + var w = player.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","no_jump")); + if(w != null) { + com_davidmaletz_mining_Main.getContainer().addDisplay(w,3); + } + return; + } + var reqs = com_davidmaletz_mining_npc_NPCEventHandler.getReqs(c); + if(reqs.length == 0) { + doAccept(); + return; + } + var msg = StringTools.replace(com_fancyfish_faeng_common_Lang.getText("vehicle","jump_cost").get(),"{planet}",item.getName().get()); + var c1 = com_davidmaletz_mining_Main.getContainer(); + var inv = player.vehicle == null ? player.inventory : player.vehicle.fullInventory; + c1.addDisplay(new com_davidmaletz_mining_ui_BuildPrompt(msg,c1,player,null,inv,reqs,doAccept,null,com_fancyfish_faeng_common_Lang.getText("vehicle","jump")),3); + return; + } else { + doAccept(); + } + } + ,acceptPlanet: function(item,doAccept) { + var f = $bind(this,this._acceptPlanet); + var a1 = item; + var a2 = doAccept; + var tmp = function() { + f(a1,a2); + }; + com_davidmaletz_mining_Main.runEvent("preJump",com_davidmaletz_mining_Main.getLocalPlayer(),item.xml,item,tmp); + return false; + } + ,ftlJump: function(p,xml) { + var _gthis = this; + var player = com_davidmaletz_mining_Main.getLocalPlayer(); + var o = player.vehicle == null ? player : player.vehicle; + if(p != player.getCurrentArea().planet) { + com_davidmaletz_mining_Main.runEvent("onJump",player,o.info.xml,o,function() { + var f = $bind(_gthis,_gthis.doJump); + var a1 = p; + var tmp = function() { + f(a1); + }; + com_davidmaletz_mining_Main.runEvent("onJump",player,xml,p,tmp); + }); + } + } + ,doJump: function(planet) { + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(planet != null && planet.orbit != null) { + var teleport = function() { + var planet1 = planet.orbit.id; + var teleport1 = Math.round(planet.orbit.width * 0.5 * com_davidmaletz_tiles_Tile.SIZE); + var teleport2 = Math.round(p._getTileY() * com_davidmaletz_tiles_Tile.SIZE); + p.doTeleport(planet1,teleport1,teleport2,false); + com_davidmaletz_mining_Main.runEvent("onEnter",p,planet.xml,planet); + }; + var from = p.getCurrentArea().planet; + com_davidmaletz_mining_Main.runEvent("onLeave",p,from.xml,from,function() { + p.onJump(planet,teleport); + }); + } + } + ,__class__: com_davidmaletz_mining_world__$Orbit_ToNav +}); +var com_davidmaletz_mining_world__$Orbit_FromOrbit = function(orbit) { + com_davidmaletz_mining_world_Connection.call(this,orbit.height - 1,-orbit.planet.height,null,false); + this.orbit = orbit; +}; +$hxClasses["com.davidmaletz.mining.world._Orbit.FromOrbit"] = com_davidmaletz_mining_world__$Orbit_FromOrbit; +com_davidmaletz_mining_world__$Orbit_FromOrbit.__name__ = ["com","davidmaletz","mining","world","_Orbit","FromOrbit"]; +com_davidmaletz_mining_world__$Orbit_FromOrbit.onHitPlanet = function(p,o) { + o.loseHealth(1); + p.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","planet_damage")); +}; +com_davidmaletz_mining_world__$Orbit_FromOrbit.__super__ = com_davidmaletz_mining_world_Connection; +com_davidmaletz_mining_world__$Orbit_FromOrbit.prototype = $extend(com_davidmaletz_mining_world_Connection.prototype,{ + orbit: null + ,canReachOrbit: function(p) { + var flight = p.getFlight(); + if(flight != null) { + return this.orbit.planet.height < flight.flight.height; + } else { + return true; + } + } + ,enter: function(p,x,y) { + if(this.orbit.pos.length == 0 || !this.orbit.canEnterPlanet(p)) { + if(p.vehicle != null) { + var p1 = p; + var o = p.vehicle; + var tmp = function() { + com_davidmaletz_mining_world__$Orbit_FromOrbit.onHitPlanet(p1,o); + }; + p.vehicle.runEvent(p,"hitPlanet",tmp); + } else { + com_davidmaletz_mining_world__$Orbit_FromOrbit.onHitPlanet(p,p); + } + return; + } else if(p.vehicle == null && !this.canReachOrbit(p)) { + return; + } + var i = com_fancyfish_faeng_common_Utils.drawCDF(this.orbit.pos,x / com_davidmaletz_tiles_Tile.SIZE,false); + if(i < 1) { + i = 1; + } + if(i >= this.orbit.pos.length) { + i = this.orbit.pos.length - 1; + } + this.area = this.orbit.area[i - 1]; + var a = p.areas.get(this.area); + var asx = a.getStartX() * com_davidmaletz_tiles_Tile.SIZE; + var sx = this.orbit.pos[i - 1] * com_davidmaletz_tiles_Tile.SIZE; + com_davidmaletz_mining_world_Connection.prototype.enter.call(this,p,asx + Math.floor((x - sx) / (this.orbit.pos[i] * com_davidmaletz_tiles_Tile.SIZE - sx) * (a.getEndX() * com_davidmaletz_tiles_Tile.SIZE - asx)),y); + } + ,__class__: com_davidmaletz_mining_world__$Orbit_FromOrbit +}); +var com_davidmaletz_mining_world__$Orbit_AreaPos = function(id,x) { + this.area = id; + this.pos = x; +}; +$hxClasses["com.davidmaletz.mining.world._Orbit.AreaPos"] = com_davidmaletz_mining_world__$Orbit_AreaPos; +com_davidmaletz_mining_world__$Orbit_AreaPos.__name__ = ["com","davidmaletz","mining","world","_Orbit","AreaPos"]; +com_davidmaletz_mining_world__$Orbit_AreaPos.prototype = { + area: null + ,pos: null + ,__class__: com_davidmaletz_mining_world__$Orbit_AreaPos +}; +var com_davidmaletz_mining_world_Planet = function(xml) { + this.id = xml.get("id"); + this.xml = xml; + this.height = com_davidmaletz_mining_Main.parseInt(xml.get("height")); + var i = xml.elementPathsNamed("orbit"); + if(i.hasNext()) { + this.orbit = new com_davidmaletz_mining_world_Orbit(this,i.next()); + while(i.hasNext()) this.orbit.loadAreas(i.next()); + this.orbit.finish(); + } +}; +$hxClasses["com.davidmaletz.mining.world.Planet"] = com_davidmaletz_mining_world_Planet; +com_davidmaletz_mining_world_Planet.__name__ = ["com","davidmaletz","mining","world","Planet"]; +com_davidmaletz_mining_world_Planet.planets = null; +com_davidmaletz_mining_world_Planet.get = function(id) { + var ret = com_davidmaletz_mining_world_Planet._get(id); + if(id != null && id.length > 0 && ret == null) { + haxe_Log.trace("No Planet found: " + id,{ fileName : "Planet.hx", lineNumber : 22, className : "com.davidmaletz.mining.world.Planet", methodName : "get"}); + } + return ret; +}; +com_davidmaletz_mining_world_Planet._get = function(id) { + if(id == null || com_davidmaletz_mining_world_Planet.planets == null) { + return null; + } else { + return com_davidmaletz_mining_world_Planet.planets.get(id); + } +}; +com_davidmaletz_mining_world_Planet.exists = function(id) { + if(id != null && com_davidmaletz_mining_world_Planet.planets != null) { + return com_davidmaletz_mining_world_Planet.planets.exists(id); + } else { + return false; + } +}; +com_davidmaletz_mining_world_Planet.set = function(p) { + if(com_davidmaletz_mining_world_Planet.planets == null) { + com_davidmaletz_mining_world_Planet.planets = new haxe_ds_StringMap(); + } + if(com_davidmaletz_mining_world_Planet.planets.exists(p.id)) { + haxe_Log.trace("Overwrite Planet: " + p.id,{ fileName : "Planet.hx", lineNumber : 30, className : "com.davidmaletz.mining.world.Planet", methodName : "set"}); + } + com_davidmaletz_mining_world_Planet.planets.set(p.id,p); +}; +com_davidmaletz_mining_world_Planet.reset = function() { + com_davidmaletz_mining_world_Planet.planets = null; +}; +com_davidmaletz_mining_world_Planet.prototype = { + id: null + ,xml: null + ,height: null + ,orbit: null + ,system: null + ,getConnection: function(id) { + if(this.orbit == null) { + return null; + } else { + return this.orbit.toOrbit(id); + } + } + ,getBackground: function() { + if(this.orbit == null) { + return null; + } else { + return com_davidmaletz_mining_world_Generate.getBackground(this.orbit.id); + } + } + ,getName: function() { + if(this.system == null) { + return null; + } + var data = this.system.getPlanetData(this); + if(data == null) { + return null; + } else { + return data.getName(); + } + } + ,__class__: com_davidmaletz_mining_world_Planet +}; +var com_davidmaletz_mining_world_PowerHandler = function(p) { + this.p = p; + this.rect = new openfl_geom_Rectangle(); + this.connected = []; +}; +$hxClasses["com.davidmaletz.mining.world.PowerHandler"] = com_davidmaletz_mining_world_PowerHandler; +com_davidmaletz_mining_world_PowerHandler.__name__ = ["com","davidmaletz","mining","world","PowerHandler"]; +com_davidmaletz_mining_world_PowerHandler.prototype = { + p: null + ,area: null + ,rect: null + ,connected: null + ,init: function(a,b) { + this.destroy(a); + this.area = a; + this.rect.copyFrom(b); + this.area.addEventListener("add_structure",$bind(this,this.update)); + this.area.addEventListener("update_cables",$bind(this,this.update)); + this.update(null); + } + ,destroy: function(a) { + a.removeEventListener("add_structure",$bind(this,this.update)); + a.removeEventListener("update_cables",$bind(this,this.update)); + } + ,update: function(e) { + var _g = 0; + var _g1 = this.connected; + while(_g < _g1.length) { + var c = _g1[_g]; + ++_g; + c.removeConnection(this.p); + } + com_fancyfish_faeng_common_Utils.clear(this.connected); + var stack = []; + var map = new haxe_ds_IntMap(); + var f = $bind(this,this.pushStack); + var a1 = stack; + var a2 = map; + var tmp = function(x,y) { + return f(a1,a2,x,y); + }; + this.area.structures.getObjects(this.rect,$bind(this,this.addStructure),tmp,-1); + this.followCable(stack,map); + } + ,addStructure: function(s,b) { + if(this.area.intersectsLoop(b,s.getInnerBounds()) && this.connected.indexOf(s) == -1) { + this.connected.push(s); + s.addConnection(this.p); + } + return false; + } + ,isCable: function(x,y) { + var t = this.area.getTile(x,y,1); + if(t == null) { + return false; + } else { + var o = com_davidmaletz_mining_world_Area.getOre(t.id); + var i = com_davidmaletz_mining_item_ItemInfo._get(t.id); + if(!(i != null && i.xml.get("powered") == "true")) { + if(o != null) { + return o.get("powered") == "true"; + } else { + return false; + } + } else { + return true; + } + } + } + ,_followCable: function(stack,map,x,y) { + var i = com_fancyfish_faeng_common_Utils.getIdx(x,y); + if(this.isCable(x,y) && !map.exists(i)) { + map.set(i,true); + com_davidmaletz_mining_world_BaseObject.rectangle.setTo(x * com_davidmaletz_tiles_Tile.SIZE,y * com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE); + this.area.structures.getObjects(com_davidmaletz_mining_world_BaseObject.rectangle,$bind(this,this.addStructure),null,-1); + stack.push(x); + stack.push(y); + } + } + ,followCable: function(stack,map) { + while(stack.length > 0) { + var y = stack.pop(); + var x = stack.pop(); + this._followCable(stack,map,x - 1,y); + this._followCable(stack,map,x + 1,y); + this._followCable(stack,map,x,y - 1); + this._followCable(stack,map,x,y + 1); + } + } + ,pushStack: function(stack,map,x,y) { + var i = com_fancyfish_faeng_common_Utils.getIdx(x,y); + if(this.isCable(x,y) && !map.exists(i)) { + map.set(i,true); + stack.push(x); + stack.push(y); + } + return false; + } + ,__class__: com_davidmaletz_mining_world_PowerHandler +}; +var com_davidmaletz_mining_world_PowerplantObject = function(info,x,y) { + this.frames = 0; + com_davidmaletz_mining_world_FuelableObject.call(this,info,x,y); + this.powerHandler = new com_davidmaletz_mining_world_PowerHandler(this); + this.cost = info.xml.exists("powerCost") ? com_davidmaletz_mining_Main.parseInt(info.xml.get("powerCost")) : 1; +}; +$hxClasses["com.davidmaletz.mining.world.PowerplantObject"] = com_davidmaletz_mining_world_PowerplantObject; +com_davidmaletz_mining_world_PowerplantObject.__name__ = ["com","davidmaletz","mining","world","PowerplantObject"]; +com_davidmaletz_mining_world_PowerplantObject.__interfaces__ = [com_davidmaletz_mining_structure_IPowered]; +com_davidmaletz_mining_world_PowerplantObject.__super__ = com_davidmaletz_mining_world_FuelableObject; +com_davidmaletz_mining_world_PowerplantObject.prototype = $extend(com_davidmaletz_mining_world_FuelableObject.prototype,{ + powerHandler: null + ,cost: null + ,addedToArea: function() { + com_davidmaletz_mining_world_FuelableObject.prototype.addedToArea.call(this); + var b = this.getBounds(); + b.inflate(com_davidmaletz_tiles_Tile.SIZE,0); + this.powerHandler.init(this.area,b); + } + ,removedFromArea: function(area) { + com_davidmaletz_mining_world_FuelableObject.prototype.removedFromArea.call(this,area); + this.powerHandler.destroy(area); + } + ,isPowered: function(ar) { + if(this.on) { + if(this.getMaxFuel() != 0) { + return this.getFuel() > 0; + } else { + return true; + } + } else { + return false; + } + } + ,frames: null + ,enter_frame: function(df) { + if(this.on) { + this.frames += df; + if(this.frames >= 200) { + this.frames -= 200; + if(this.getFuel() > 0) { + var c = this.cost; + if(c > this.getFuel()) { + c = this.getFuel(); + } + this.useFuel(c); + this.update(null); + } + } + } + com_davidmaletz_mining_world_FuelableObject.prototype.enter_frame.call(this,df); + } + ,getArea: function() { + return this.area; + } + ,doOperate: function(p) { + var c = com_davidmaletz_mining_Main.getContainer(); + var wnd = new com_davidmaletz_mining_ui_FuelWindow(p.getInv(false),this.getInfo().item.getName(),this,c,p,this.info.xml.get("fuelName"),this.info.xml); + var WIDTH = 60; + var w = wnd.getWidth(); + var h = wnd.getHeight(); + this.toggle = new com_davidmaletz_mining_ui_TextButton(0,h + 2,com_fancyfish_faeng_common_Lang.getText("actions",this.on ? "turn_off" : "turn_on"),$bind(this,this.toggleOn),WIDTH); + wnd.addChild(this.toggle); + wnd.clickables.addClickable(this.toggle,wnd); + wnd.clickables.moveSelection(1,0); + wnd.clickables.moveSelection(1,0); + var f = $bind(this,this.collect); + var p1 = p; + c.addDisplay(com_davidmaletz_mining_world_ItemObject.collectWindow(wnd,w,h,function() { + f(p1); + }),2); + } + ,__class__: com_davidmaletz_mining_world_PowerplantObject +}); +var com_davidmaletz_mining_world_Projectile = function(spawner,xml,attack,cut,spirit,range,e,dx,dy,deltaFrame,r,canFire,lootHandler,onHit,vars,_speed) { + if(_speed == null) { + _speed = 0; + } + this.flags = 0; + this.__is_action_key = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + this.tile = xml.get("tile"); + this.animation = xml.get("animation"); + this.fps = com_davidmaletz_mining_enemy_AttackRenderer.getFPS(xml,10); + this.width = xml.exists("width") ? com_davidmaletz_mining_Main.parseInt(xml.get("width")) : 0; + this.height = xml.exists("height") ? com_davidmaletz_mining_Main.parseInt(xml.get("height")) : 0; + this.spawner = spawner; + this.xml = xml; + this.xPos = r == null ? 0 : Math.round(r.get_x() - com_davidmaletz_tiles_Tile.SIZE * 0.5); + this.yPos = r == null ? 0 : Math.round(r.get_y() - com_davidmaletz_tiles_Tile.SIZE * 0.5); + if(vars == null) { + vars = com_davidmaletz_faengfl_EventHandler.createVariables(); + } + this.lootHandler = lootHandler; + if(xml.exists("offsetX")) { + this.xPos += (r == null ? 1 : com_fancyfish_faeng_common_Utils.sign(r.get_scaleX())) * Math.round(com_davidmaletz_faengfl_EventHandler.execute(xml.get("offsetX"),vars)); + } + this.onHit = onHit; + this.canFireFunc = canFire; + if(xml.exists("offsetY")) { + this.yPos += Math.round(com_davidmaletz_faengfl_EventHandler.execute(xml.get("offsetY"),vars)); + } + if(xml.exists("exec")) { + com_davidmaletz_faengfl_EventHandler.execute(xml.get("exec"),vars); + } + this.hit_sfx = xml.get("hit_sfx"); + this.damage = attack; + var speed = com_davidmaletz_mining_Main.parseFloat(xml.get("speed")) + _speed; + this.range = range + com_davidmaletz_mining_Main.parseFloat(xml.get("extendedRange")) * com_davidmaletz_tiles_Tile.SIZE; + this.fullRange = range; + this.dx = dx * speed; + this.dy = dy * speed; + this.setFlag(1,xml.get("passTile") != "true"); + this.delay = xml.exists("delay") ? Math.round(com_davidmaletz_mining_Main.parseFloat(xml.get("delay")) / deltaFrame) : 0; + this.breakPower = xml.exists("breakPower") ? com_davidmaletz_mining_Main.parseFloat(xml.get("breakPower")) : 1; + this.element = com_davidmaletz_mining_world_Element.get(xml.get("element")); + if(this.element == null) { + this.element = e; + } + this.setFlag(32,xml.get("homing") == "true"); + if(cut == 0 && xml.get("hitTrees") == "true") { + this.cut = this.damage; + } else { + this.cut = cut; + } + if(spirit == 0 && xml.get("hitSpirits") == "true") { + this.spirit = this.damage; + } else { + this.spirit = spirit; + } + var i = xml.elementsNamed("light"); + if(i.hasNext()) { + this.light = new com_davidmaletz_mining_world_LightInfo(i.next()); + } + this.fire_sfx = xml.get("fire_sfx"); + this.setFlag(2,xml.get("underwater") == "true"); + this.setFlag(4,xml.get("glow") == "true"); + this.setFlag(8,xml.get("pierce") == "true"); + this.setFlag(16,xml.get("ignoreArmor") == "true"); + this.setFlag(64,xml.get("critical") == "true"); + this.setFlag(128,xml.get("critical") == "false"); + if(xml.exists("color")) { + this.color = com_davidmaletz_mining_Main.parseInt("0x" + xml.get("color")); + } else { + this.color = 16777215; + } + if(xml.exists("colorScale")) { + this.colorScale = com_davidmaletz_mining_Main.parseFloat(xml.get("colorScale")); + } else { + this.colorScale = 1; + } + if(xml.exists("scaleTo")) { + this.scaleTo = com_davidmaletz_mining_Main.parseFloat(xml.get("scaleTo")); + } else { + this.scaleTo = NaN; + } + if(xml.exists("overlap")) { + this.overlap = com_davidmaletz_mining_Main.parseFloat(xml.get("overlap")); + } else { + this.overlap = 0.5; + } + this.frames = xml.exists("frames") ? com_davidmaletz_mining_Main.parseInt(xml.get("frames")) : 0; + this.scale = xml.exists("scale") ? com_davidmaletz_mining_Main.parseFloat(xml.get("scale")) : 0; + this.rotate = xml.exists("rotate") ? Std.parseFloat(xml.get("rotate")) : 0; + this.knockback = xml.exists("knockback") ? com_davidmaletz_mining_Main.parseInt(xml.get("knockback")) : 0; + var s = xml.get("hpSteal"); + if(s != null && spawner != null) { + this.steal = spawner.parseStealHealth(s); + } else { + this.steal = 0; + } + this.hitEffect = com_davidmaletz_mining_world_ObjectInfo.toHitEffectString(xml); +}; +$hxClasses["com.davidmaletz.mining.world.Projectile"] = com_davidmaletz_mining_world_Projectile; +com_davidmaletz_mining_world_Projectile.__name__ = ["com","davidmaletz","mining","world","Projectile"]; +com_davidmaletz_mining_world_Projectile.__interfaces__ = [com_davidmaletz_mining_renderer_IProjectile,com_davidmaletz_mining_world_RunAnimation]; +com_davidmaletz_mining_world_Projectile.load = function(b,version) { + var id = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(id == null) { + return false; + } + var range = b.readInt16(); + var x; + var y; + if(version < 21) { + x = b.readInt16() * com_davidmaletz_tiles_Tile.SIZE; + y = b.readInt16() * com_davidmaletz_tiles_Tile.SIZE; + } else { + x = b.readInt32(); + y = b.readInt32(); + } + return true; +}; +com_davidmaletz_mining_world_Projectile.canHurt = function(self,o,attack,cut,spirit,element) { + if(o != self) { + return o.attackPower(attack,cut,spirit,element,self != null && self.isPlayer()) > 0; + } else { + return false; + } +}; +com_davidmaletz_mining_world_Projectile.placeLoot = function(area,loot,x,y,center) { + if(center == null) { + center = false; + } + if(area.getTileId(Math.round(x / com_davidmaletz_tiles_Tile.SIZE),Math.round(y / com_davidmaletz_tiles_Tile.SIZE),0) >= 0) { + return false; + } + x = Math.round(x / com_davidmaletz_tiles_Tile.SIZE) * com_davidmaletz_tiles_Tile.SIZE; + if(!center) { + x -= com_davidmaletz_tiles_Tile.SIZE >> 1; + } else { + --x; + } + var l = loot; + while(l.hasNext()) { + var l1 = l.next(); + if(area.getTileId(Math.round((x + 1) / com_davidmaletz_tiles_Tile.SIZE),Math.round(y / com_davidmaletz_tiles_Tile.SIZE),0) < 0) { + ++x; + } + var o = com_davidmaletz_mining_world_ObjectInfo.make(l1.item.id,x,y); + o.addHealth(l1.count); + area.addObject(o); + } + return true; +}; +com_davidmaletz_mining_world_Projectile.spawnLoot = function(area,o,attacker,element,lootHandler) { + if(attacker != null && Std["is"](attacker,com_davidmaletz_mining_Player)) { + o.defeatedBy(js_Boot.__cast(attacker , com_davidmaletz_mining_Player)); + } + var loot = o.getLoot(element,true); + if(loot != null) { + if(lootHandler != null) { + lootHandler(loot); + } else { + com_davidmaletz_mining_world_Projectile.placeLoot(area,loot,Math.round(o.getCenterX()),o.yTile); + } + } +}; +com_davidmaletz_mining_world_Projectile.read = function(spawner,b,ver) { + var tile = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + var p = Type.createEmptyInstance(com_davidmaletz_mining_world_Projectile); + if(tile == null) { + if(spawner == null || spawner.__last_projectile == null) { + return null; + } + var copy = spawner.__last_projectile; + p.tile = copy.tile; + p.animation = copy.animation; + p.damage = copy.damage; + p.cut = copy.cut; + p.spirit = copy.spirit; + p.fullRange = copy.fullRange; + p.element = copy.element; + p.color = copy.color; + p.colorScale = copy.colorScale; + p.frames = copy.frames; + p.fps = copy.fps; + p.scale = copy.scale; + p.scaleTo = copy.scaleTo; + p.rotate = copy.rotate; + p.overlap = copy.overlap; + p.width = copy.width; + p.height = copy.height; + p.fire_sfx = copy.fire_sfx; + p.hit_sfx = copy.hit_sfx; + p.light = copy.light; + p.knockback = copy.knockback; + p.steal = copy.steal; + p.hitEffect = copy.hitEffect; + } else { + p.tile = tile; + p.animation = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + p.damage = b.readByte() & 255; + p.cut = b.readByte() & 255; + p.spirit = b.readByte() & 255; + p.fullRange = b.readFloat(); + p.element = com_davidmaletz_mining_world_Element.get(com_fancyfish_faeng_common_UTFUtils.readUTF(b)); + p.color = b.readInt32(); + p.colorScale = b.readFloat(); + p.frames = b.readByte() & 255; + p.fps = b.readByte() & 255; + p.scale = b.readFloat(); + p.scaleTo = b.readFloat(); + p.rotate = b.readFloat(); + p.overlap = b.readFloat(); + p.width = b.readUInt16(); + p.height = b.readUInt16(); + p.fire_sfx = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + p.hit_sfx = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + p.knockback = b.readInt8(); + p.steal = b.readFloat(); + p.hitEffect = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + var l = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(l == null) { + p.light = null; + } else { + p.light = new com_davidmaletz_mining_world_LightInfo(Xml.parse(l).firstElement()); + } + if(spawner != null) { + spawner.__last_projectile = p; + spawner.__last_projectile_time = com_davidmaletz_mining_Main.time(); + spawner.__last_projectile_id = com_davidmaletz_mining_world_Projectile.__last_projectile_id; + } + } + p.spawner = spawner; + p.__is_action_key = false; + p.delay = 0; + p.dx = b.readFloat(); + p.dy = b.readFloat(); + p.xPos = b.readInt32(); + p.yPos = b.readInt32(); + p.flags = b.readByte() & 255; + p.range = p.fullRange; + p.breakPower = 1; + return p; +}; +com_davidmaletz_mining_world_Projectile.prototype = { + tile: null + ,animation: null + ,fps: null + ,width: null + ,height: null + ,spawner: null + ,range: null + ,delay: null + ,dx: null + ,dy: null + ,__is_action_key: null + ,xml: null + ,damage: null + ,xPos: null + ,yPos: null + ,frames: null + ,scale: null + ,rotate: null + ,area: null + ,fullRange: null + ,spirit: null + ,flags: null + ,scaleTo: null + ,overlap: null + ,lootHandler: null + ,onHit: null + ,canFireFunc: null + ,breakPower: null + ,fire_sfx: null + ,hit_sfx: null + ,color: null + ,colorScale: null + ,element: null + ,cut: null + ,light: null + ,hit: null + ,knockback: null + ,steal: null + ,hitEffect: null + ,addedToArea: function() { + this.runEvent("init"); + } + ,addToArea: function(area) { + if(this.area != area) { + if(this.area != null) { + this.removedFromArea(this.area); + } + this.area = area; + this.addedToArea(); + } + } + ,removedFromArea: function(area) { + } + ,removeFromArea: function(area) { + if(area == this.area) { + this.runEvent("removed"); + this.area = null; + this.removedFromArea(area); + } + } + ,tint: function(s) { + com_davidmaletz_faengfl_TextSprite.setColor(s,this.color,255 / this.colorScale); + return s; + } + ,getColor: function() { + return this.color; + } + ,getWhite: function() { + return 255 / this.colorScale; + } + ,setFlag: function(f,b) { + if(b) { + this.flags |= f; + } else { + this.flags &= ~f; + } + } + ,hasFlag: function(f) { + return (this.flags & f) != 0; + } + ,isGlow: function() { + return this.hasFlag(4); + } + ,isUnderwater: function() { + return this.hasFlag(2); + } + ,shouldHitTiles: function() { + return this.hasFlag(1); + } + ,createRenderer: function() { + return new com_davidmaletz_mining_world_ProjectileRenderer(this,this.area); + } + ,renderer: null + ,getRenderer: function() { + if(this.renderer == null) { + this.renderer = this.createRenderer(); + } + return this.renderer; + } + ,runAnimation: function(anim_id,func) { + var p; + var tmp; + if(this.renderer != null) { + p = this.renderer.play; + tmp = p != null; + } else { + tmp = false; + } + if(tmp) { + if(func == null) { + p.playAnimation(anim_id,true); + } else { + p.playAnimation(anim_id,false,function(p1) { + func(); + }); + } + } + } + ,getSprite: function() { + return this.renderer; + } + ,tile_x: null + ,tile_y: null + ,get_tile_x: function() { + return Math.round(this.xPos / com_davidmaletz_tiles_Tile.SIZE); + } + ,get_tile_y: function() { + return Math.round(this.yPos / com_davidmaletz_tiles_Tile.SIZE); + } + ,getTile: function() { + return com_davidmaletz_tiles_Tile.get(this.tile); + } + ,canFire: function() { + if(this.xml == null) { + return false; + } else if(this.xml.get("fireNoSpawner") != "false" || this.spawner == null || this.spawner.area != null) { + if(this.canFireFunc != null) { + return this.canFireFunc(); + } else { + return true; + } + } else { + return false; + } + } + ,getAttack: function(o) { + return o.attackPower(this.damage,this.cut,this.spirit,this.element,this.spawner != null && this.spawner.isPlayer()); + } + ,vars: null + ,__runEvent: function(event,onComplete,name,value) { + if(this.xml == null) { + return; + } + if(this.vars == null) { + this.vars = com_davidmaletz_faengfl_EventHandler.createVariables(); + this.vars.set("area",this.area); + } + if(name != null) { + this.vars.set(name,value); + } + var a = com_davidmaletz_mining_Main.getEvent(event,null,new com_davidmaletz_faengfl_XmlPath(this.xml,"data/"),this,onComplete,this.vars); + if(a != null) { + a.runAll(); + } else if(onComplete != null) { + onComplete(); + } + } + ,runEvent: function(event,onComplete,name,value) { + var f = $bind(this,this.__runEvent); + var a1 = event; + var a2 = onComplete; + var a3 = name; + var a4 = value; + this.wrap(function() { + f(a1,a2,a3,a4); + }); + } + ,wrap: function(func) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = this.__is_action_key; + func(); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + ,write: function(b) { + if(this.spawner != null && this.canReuse(this.spawner.__last_projectile,this.spawner.__last_projectile_id,this.spawner.__last_projectile_time)) { + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + } else { + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.tile); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.animation); + b.writeByte(this.damage > 255 ? 255 : this.damage); + b.writeByte(this.cut > 255 ? 255 : this.cut); + b.writeByte(this.spirit > 255 ? 255 : this.spirit); + b.writeFloat(this.fullRange); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.element == null ? null : this.element.id); + b.writeInt32(this.color); + b.writeFloat(this.colorScale); + b.writeByte(this.frames); + b.writeByte(Math.round(this.fps)); + b.writeFloat(this.scale); + b.writeFloat(this.scaleTo); + b.writeFloat(this.rotate); + b.writeFloat(this.overlap); + b.writeUInt16(this.width); + b.writeUInt16(this.height); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.fire_sfx); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.hit_sfx); + b.writeInt8(this.knockback); + b.writeFloat(this.steal); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.hitEffect); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.light == null ? null : (js_Boot.__cast(this.light.xml , Xml)).toString()); + if(this.spawner != null) { + this.spawner.__last_projectile = this; + this.spawner.__last_projectile_time = com_davidmaletz_mining_Main.time(); + this.spawner.__last_projectile_id = com_davidmaletz_mining_world_Projectile.__last_projectile_id; + } + } + b.writeFloat(this.dx); + b.writeFloat(this.dy); + b.writeInt32(this.xPos); + b.writeInt32(this.yPos); + b.writeByte(this.flags); + } + ,canReuse: function(p,id,time) { + if(p == null || id != com_davidmaletz_mining_world_Projectile.__last_projectile_id || com_davidmaletz_mining_Main.time() > time + 10) { + return false; + } + if(p.tile == this.tile && p.animation == this.animation && p.damage == this.damage && p.cut == this.cut && p.spirit == this.spirit && p.fullRange == this.fullRange && p.element == this.element && p.color == this.color && p.colorScale == this.colorScale && p.frames == this.frames && p.scale == this.scale && p.scaleTo == this.scaleTo && p.rotate == this.rotate && p.overlap == this.overlap && p.width == this.width && p.height == this.height && p.fire_sfx == this.fire_sfx && p.hit_sfx == this.hit_sfx && p.knockback == this.knockback && p.steal == this.steal) { + return p.hitEffect == this.hitEffect; + } else { + return false; + } + } + ,__class__: com_davidmaletz_mining_world_Projectile + ,__properties__: {get_tile_y:"get_tile_y",get_tile_x:"get_tile_x"} +}; +var com_davidmaletz_mining_world_ProjectileRenderer = function(p,area) { + this.partialY = 0; + this.partialX = 0; + this.stopped = false; + com_davidmaletz_lerp_LerpSpriteFL.call(this); + this.projectile = p; + var t = p.getTile(); + this.glow = p.isGlow(); + if(t != null && p.frames > 0) { + t = new com_davidmaletz_tiles_render_TileOffsetRenderer(t,Math.floor(p.frames * Math.random()),0); + } + if(t == null) { + t = com_davidmaletz_tiles_EmptyTile.get(); + } + if(p.scale > 0) { + this.set_scaleX(this.set_scaleY(p.scale)); + } + if(p.animation != null) { + this.play = new com_davidmaletz_tiles_render_PlayAnimation(t,p.animation,p.fps,true); + } + var b = p.animation != null ? this.play : com_davidmaletz_mining_item_ItemInfo._createIcon(t); + b.set_x(-Math.round(t.getTileWidth(0,0) * 0.5)); + b.set_y(-Math.round(t.getTileHeight(0,0) * 0.5)); + this.projectile.tint(b); + this.addChild(b); + this.area = area; + this.set_x(p.xPos + 0.5 * com_davidmaletz_tiles_Tile.SIZE); + this.set_y(p.yPos + 0.5 * com_davidmaletz_tiles_Tile.SIZE); + var rot = 0.0; + if(p.rotate != 0) { + rot = p.rotate; + } else { + this.set_scaleX(Math.abs(p.dy) < 0.001 && p.dx > 0 ? -this.get_scaleY() : this.get_scaleY()); + } + this.scaleTo = p.scaleTo; + this.overlap = p.overlap; + this.homing = p.hasFlag(32); + if(p.light != null) { + this.light = new com_davidmaletz_mining_world_Light(p.light,Math.round(this.get_x()),Math.round(this.get_y())); + } + this.start_x = this.projectile.get_tile_x(); + this.start_y = this.projectile.get_tile_y(); + this._width = p.width > 0 ? p.width : com_fancyfish_faeng_common_Utils.max(com_davidmaletz_tiles_Tile.SIZE,t.getTileWidth(0,0)); + this._height = p.height > 0 ? p.height : com_fancyfish_faeng_common_Utils.max(com_davidmaletz_tiles_Tile.SIZE,t.getTileHeight(0,0)); + if(rot != 0) { + this.set_rotation(rot); + var a = rot * Math.PI / 180; + var cos = Math.cos(a); + var sin = Math.sin(a); + var w = this._width; + this._width = Math.round(Math.abs(w * cos - this._height * sin)); + this._height = Math.round(Math.abs(w * sin + this._height * cos)); + } + var o = this.getSpawner(); + if(o != null) { + this.spawner_x = o.xPos; + this.spawner_y = o.yTile; + this.spawner_facing = o.getFacing(); + } +}; +$hxClasses["com.davidmaletz.mining.world.ProjectileRenderer"] = com_davidmaletz_mining_world_ProjectileRenderer; +com_davidmaletz_mining_world_ProjectileRenderer.__name__ = ["com","davidmaletz","mining","world","ProjectileRenderer"]; +com_davidmaletz_mining_world_ProjectileRenderer.__super__ = com_davidmaletz_lerp_LerpSpriteFL; +com_davidmaletz_mining_world_ProjectileRenderer.prototype = $extend(com_davidmaletz_lerp_LerpSpriteFL.prototype,{ + projectile: null + ,area: null + ,stopped: null + ,light: null + ,homing: null + ,spawner_x: null + ,spawner_y: null + ,spawner_facing: null + ,partialX: null + ,partialY: null + ,scaleTo: null + ,glow: null + ,overlap: null + ,start_x: null + ,start_y: null + ,_width: null + ,_height: null + ,hitObjects: null + ,play: null + ,superRenderGL: function(renderSession) { + com_davidmaletz_lerp_LerpSpriteFL.prototype.__renderGL.call(this,renderSession); + } + ,__renderGL: function(renderSession) { + if(this.glow) { + com_davidmaletz_faengfl_GlowSprite.makeGlow($bind(this,this.superRenderGL),renderSession); + } else { + com_davidmaletz_lerp_LerpSpriteFL.prototype.__renderGL.call(this,renderSession); + } + } + ,init: function(e) { + com_davidmaletz_lerp_LerpSpriteFL.prototype.init.call(this,e); + if(this.projectile.delay > 5) { + this.set_visible(false); + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),this.projectile.delay - 5,$bind(this,this.show)); + this.projectile.delay = 5; + } else { + this.onFire(); + this.spawn(); + } + if(com_davidmaletz_mining_Main.isPaused() && this.projectile.spawner != null && !this.projectile.spawner.isPlayer()) { + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.handle_frame),false,PriorityManager.getPriority()); + } + if(this.light != null) { + this.light.addToArea(this.area); + } + this.updateTint(); + } + ,getSpawner: function() { + var o = this.projectile.spawner; + if(Std["is"](o,com_davidmaletz_mining_Player)) { + var p = js_Boot.__cast(o , com_davidmaletz_mining_Player); + if(p.vehicle == null) { + return p; + } else { + return p.vehicle; + } + } else { + return null; + } + } + ,onFire: function() { + if(this.projectile.fire_sfx != null) { + com_davidmaletz_faengfl_adv_sound_Sound.playLoc(this.projectile.fire_sfx,this); + } + } + ,preFire: function() { + var o = this.getSpawner(); + if(o != null) { + var o1 = this.getSpawner(); + var distX = o1.xPos - this.spawner_x; + var distY = o1.yTile - this.spawner_y; + this.projectile.xPos += distX; + var _g = this; + _g.set_x(_g.get_x() + distX); + this.projectile.yPos += distY; + var _g1 = this; + _g1.set_y(_g1.get_y() + distY); + if(this.spawner_facing != o1.getFacing()) { + this.set_scaleX(-this.get_scaleX()); + this.projectile.dx = -this.projectile.dx; + } + } + } + ,spawn: function() { + var tmp = this.projectile; + var f = ($_=this.area,$bind($_,$_.dispatchEvent)); + var a1 = new com_davidmaletz_faengfl_events_ObjectEvent("fire_projectile",this.projectile); + tmp.wrap(function() { + return f(a1); + }); + this.advanceFrame(4); + this.projectile.runEvent("spawn"); + } + ,destroy: function(e) { + com_davidmaletz_lerp_LerpSpriteFL.prototype.destroy.call(this,e); + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.handle_frame)); + if(this.light != null) { + this.light.removeFromArea(this.area); + } + } + ,handle_frame: function(e) { + this.enter_frame(com_davidmaletz_faengfl_FaengFL.frameTime); + } + ,show: function() { + if(this.projectile.canFire()) { + if(this.projectile.delay > 0) { + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),this.projectile.delay,$bind(this,this.show)); + this.onFire(); + this.projectile.delay = 0; + } else { + this.set_visible(true); + this.preFire(); + if(this.play != null) { + this.play.setFrame(0); + } + this.spawn(); + } + } else { + this.projectile.area.removeProjectile(this.projectile); + } + } + ,isEnemy: function(o,layer) { + if((this.hitObjects == null || this.hitObjects.indexOf(o) == -1) && (this.projectile.spawner == null || this.projectile.spawner.projectileCanHurt(o))) { + return com_davidmaletz_mining_world_Projectile.canHurt(this.projectile.spawner,o,this.projectile.damage,this.projectile.cut,this.projectile.spirit,this.projectile.element); + } else { + return false; + } + } + ,getTile: function() { + if(this.projectile.get_tile_x() == this.start_x && this.projectile.get_tile_y() == this.start_y) { + return -1; + } else if(!this.projectile.isUnderwater() && this.area.isWater(this.projectile.get_tile_x(),this.projectile.get_tile_y())) { + return 999999; + } else { + return this.area.getTileId(this.projectile.get_tile_x(),this.projectile.get_tile_y(),0); + } + } + ,advanceFrame: function(df) { + var f = $bind(this,this.__advanceFrame); + var df1 = df; + var tmp = function() { + f(df1); + }; + this.projectile.wrap(tmp); + } + ,__advanceFrame: function(df) { + var _gthis = this; + com_davidmaletz_lerp_LerpSpriteFL.prototype.advanceFrame.call(this,df); + if(!this.get_visible() || this.parent == null || this.stopped) { + return; + } + var o; + if(this.homing) { + var r = this.getRectangle(); + var fr = this.projectile.fullRange * 0.5; + var px = r.x + r.width * 0.5; + var py = r.y + r.height * 0.5; + var o1 = null; + var dist = 0; + r.inflate(fr,fr); + this.area.getObjects(r,function(obj,rect) { + var tmp; + if(obj.getHitbox(true).intersects(rect)) { + var tmp1 = obj.getLayer(); + tmp = _gthis.isEnemy(obj,tmp1); + } else { + tmp = false; + } + if(tmp) { + var dx = obj.getCenterX() - px; + var dy = obj.getCenterY() - py; + var d = Math.sqrt(dx * dx + dy * dy); + if(o1 == null || dist > d) { + o1 = obj; + dist = d; + } + } + return false; + },null,this.overlap); + if(o1 != null) { + var dx1 = this.projectile.dx; + var dy1 = this.projectile.dy; + var speed = Math.sqrt(dx1 * dx1 + dy1 * dy1); + dx1 = o1.getCenterX() - px; + dy1 = o1.getCenterY() - py; + var s = Math.sqrt(dx1 * dx1 + dy1 * dy1); + var tdx = dx1 / s; + var tdy = dy1 / s; + dx1 = com_fancyfish_faeng_common_Utils.interp(tdx,this.projectile.dx / speed,0.5); + dy1 = com_fancyfish_faeng_common_Utils.interp(tdy,this.projectile.dy / speed,0.5); + s = Math.sqrt(dx1 * dx1 + dy1 * dy1); + if(s == 0) { + this.projectile.dx = tdx * speed; + this.projectile.dy = tdy * speed; + } else { + this.projectile.dx = dx1 * speed / s; + this.projectile.dy = dy1 * speed / s; + } + } + } + if(this.projectile.area != null && this.projectile.range <= 0) { + this.projectile.area.removeProjectile(this.projectile); + } + var t = -1; + var tmp2; + if(this.projectile.area != null) { + var tmp3; + if(this.projectile.shouldHitTiles()) { + t = this.getTile(); + tmp3 = t != -1; + } else { + tmp3 = false; + } + if(!tmp3) { + o = this.area.getActionObject(this.getRectangle(),null,$bind(this,this.isEnemy),this.overlap); + tmp2 = o != null; + } else { + tmp2 = true; + } + } else { + tmp2 = false; + } + if(tmp2) { + if(t != -1 && this.projectile.xml != null && this.projectile.xml.exists("breakTile")) { + var b = com_davidmaletz_mining_Main.parseInt(this.projectile.xml.get("breakTile")); + var tile = this.projectile.area.getTileIndex(t); + var mine_cost = com_davidmaletz_mining_world_Area.getMineCost(tile); + var mining_speed = b - mine_cost; + if(mining_speed > 0 && !this.projectile.area.renderer.incBrickBreak(this.projectile.get_tile_x(),this.projectile.get_tile_y(),mining_speed * this.projectile.breakPower)) { + this.projectile.wrap(function() { + var i = _gthis.projectile.area.mine(_gthis.projectile.get_tile_x(),_gthis.projectile.get_tile_y(),t,0,_gthis.projectile.spawner); + if(com_davidmaletz_mining_item_ItemInfo.exists(i)) { + _gthis.area.addObject(com_davidmaletz_mining_world_ObjectInfo.make(i,_gthis.projectile.get_tile_x() * com_davidmaletz_tiles_Tile.SIZE,_gthis.projectile.get_tile_y() * com_davidmaletz_tiles_Tile.SIZE)); + } + }); + } + } + if(o == null) { + this.projectile.runEvent("onHit",null,"object",o); + this.projectile.area.removeProjectile(this.projectile); + this.stopped = true; + return; + } else if(this.hit(o)) { + this.stopped = true; + return; + } + } + var dx2 = df * this.projectile.dx; + var dy2 = df * this.projectile.dy; + var speed1 = Math.sqrt(dx2 * dx2 + dy2 * dy2); + if(speed1 > this.projectile.range) { + var s1 = this.projectile.range / speed1; + dx2 *= s1; + dy2 *= s1; + this.projectile.range = 0; + } else { + this.projectile.range -= speed1; + } + var distX = Math.floor(dx2); + this.partialX += dx2 - distX; + if(this.partialX >= 1) { + ++distX; + this.partialX -= 1; + } + var distY = Math.floor(dy2); + this.partialY += dy2 - distY; + if(this.partialY >= 1) { + ++distY; + this.partialY -= 1; + } + this.projectile.xPos += distX; + var _g = this; + _g.set_x(_g.get_x() + distX); + this.projectile.yPos += distY; + var _g1 = this; + _g1.set_y(_g1.get_y() + distY); + this.updateRendererLoop(); + if(this.light != null) { + this.light.setPosition(Math.round(this.get_x()),Math.round(this.get_y())); + } + if(!isNaN(this.scaleTo)) { + this.set_scaleX(this.set_scaleY(Math.pow(this.scaleTo,(this.projectile.fullRange - this.projectile.range) / this.projectile.fullRange))); + } + this.updateTint(); + } + ,updateRendererLoop: function() { + com_davidmaletz_mining_renderer_AreaRenderer.updateLoop(this,this.area); + } + ,updateTint: function() { + var d = this.area.getWaterDepth(this.projectile.get_tile_x(),this.projectile.get_tile_y()); + if(d > 0) { + com_davidmaletz_faengfl_TextSprite.setColor(this,2662382,255,d / 64); + } else { + com_davidmaletz_faengfl_TextSprite.setColor(this,16777215); + } + } + ,getRectangle: function() { + com_davidmaletz_mining_world_BaseObject.rectangle.setTo(this.projectile.xPos + 0.5 * (com_davidmaletz_tiles_Tile.SIZE - this._width),this.projectile.yPos + 0.5 * (com_davidmaletz_tiles_Tile.SIZE - this._height),this._width,this._height); + return com_davidmaletz_mining_world_BaseObject.rectangle; + } + ,hit: function(o) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + if(o.isPlayer(true)) { + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + } else if(o.isPlayer()) { + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + } + var ret = this.__hit(o); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + return ret; + } + ,__hit: function(o) { + var pierce = this.projectile.hasFlag(8); + if(pierce) { + if(this.hitObjects == null) { + this.hitObjects = [o]; + } else if(this.hitObjects.indexOf(o) == -1) { + this.hitObjects.push(o); + } else { + return false; + } + } + var h = o.getHealth(); + if(h <= 0) { + haxe_Log.trace(o.getId() + " is already dead? " + h,{ fileName : "Projectile.hx", lineNumber : 327, className : "com.davidmaletz.mining.world.ProjectileRenderer", methodName : "__hit"}); + return false; + } + if(this.projectile.hit == null && o != null) { + this.projectile.hit = o; + } + if(!com_davidmaletz_faengfl_TouchAdapter.__is_action_key) { + if(this.area.renderer != null && this.projectile.hit_sfx != null) { + com_davidmaletz_faengfl_adv_sound_Sound.playLoc(this.projectile.hit_sfx,this.area.renderer,new openfl_geom_Point(this.get_x(),this.get_y())); + } + if(!pierce) { + this.area.removeProjectile(this.projectile); + } + return !pierce; + } + var r = o.getRenderer(); + var px = com_fancyfish_faeng_common_Utils.sign(this.projectile.dx,this.projectile.dy); + var flags = this.projectile.hasFlag(16) ? 2 : 0; + var sx = -com_fancyfish_faeng_common_Utils.sign(r.get_scaleX()); + var crit = o.canCritical() && sx == px && !this.projectile.hasFlag(128) || this.projectile.hasFlag(64); + var attacker = o.projectileKillCollect() && this.projectile.spawner != null ? this.projectile.spawner : o; + var def = Std["is"](o,com_davidmaletz_mining_enemy_Enemy) ? (js_Boot.__cast(o , com_davidmaletz_mining_enemy_Enemy)).getMinDefense() : 0; + var hitEffects = new com_davidmaletz_mining_world_HitEffects(); + if(px != 0 && this.projectile.knockback != 0) { + hitEffects.knockback = this.projectile.knockback * px; + } + hitEffects.steal = this.projectile.steal; + hitEffects.sfx = this.projectile.hit_sfx; + hitEffects.hitEffect = new com_davidmaletz_mining_world_HitEffectEvent(null,com_davidmaletz_mining_world_ObjectInfo.parseHitEffectString(this.projectile.spawner,this.projectile.element,this.projectile.hitEffect),this.get_x(),this.get_y(),this.get_scaleX() < 0,isNaN(this.scaleTo) ? this.get_scaleY() : 1); + com_davidmaletz_mining_world_HitEffects.current = hitEffects; + var dmg = o.loseHealth(this.projectile.getAttack(o),flags | (crit ? 1 : 0),attacker,this.projectile.element,-px,false); + com_davidmaletz_mining_world_HitEffects.current = null; + hitEffects.execute(o,this.projectile.spawner,this.area.renderer,dmg); + if(attacker == o && o.getHealth() <= 0) { + com_davidmaletz_mining_world_Projectile.spawnLoot(this.area,o,this.projectile.spawner,this.projectile.element,this.projectile.lootHandler); + } + this.projectile.runEvent("onHit",null,"object",o); + if(!pierce) { + this.area.removeProjectile(this.projectile); + } + if(this.projectile.onHit != null) { + this.projectile.onHit(o,dmg,def); + } + return !pierce; + } + ,enter_frame: function(frames) { + if(com_davidmaletz_faengfl_Window.window_ct == 0 || this.projectile.area == null || this.projectile.area.__id >= 0) { + com_davidmaletz_lerp_LerpSpriteFL.prototype.enter_frame.call(this,frames); + } + } + ,canAdvanceModal: function() { + if(com_davidmaletz_faengfl_Window.window_ct == 0 || this.projectile.area == null || this.projectile.area.__id >= 0) { + return com_davidmaletz_lerp_LerpSpriteFL.prototype.canAdvanceModal.call(this); + } else { + return true; + } + } + ,__class__: com_davidmaletz_mining_world_ProjectileRenderer +}); +var com_davidmaletz_mining_world_Interior = function(e) { + this.area = e.get("area"); + this.enterX = Math.round(com_davidmaletz_mining_Main.parseFloat(e.get("enterX")) * com_davidmaletz_tiles_Tile.SIZE); + this.enterY = Math.round(com_davidmaletz_mining_Main.parseFloat(e.get("enterY")) * com_davidmaletz_tiles_Tile.SIZE); + this.operateX = e.exists("operateX") ? Math.round(com_davidmaletz_mining_Main.parseFloat(e.get("operateX")) * com_davidmaletz_tiles_Tile.SIZE) : this.enterX; + this.operateY = e.exists("operateY") ? Math.round(com_davidmaletz_mining_Main.parseFloat(e.get("operateY")) * com_davidmaletz_tiles_Tile.SIZE) : this.enterY; + this.exitX = e.exists("exitX") ? Math.round(com_davidmaletz_mining_Main.parseFloat(e.get("exitX")) * com_davidmaletz_tiles_Tile.SIZE) : 0; + this.exitY = e.exists("exitY") ? Math.round(com_davidmaletz_mining_Main.parseFloat(e.get("exitY")) * com_davidmaletz_tiles_Tile.SIZE) : 0; + this.offsetX = e.exists("offsetX") ? com_davidmaletz_mining_Main.parseInt(e.get("offsetX")) : 0; + this.offsetY = e.exists("offsetY") ? com_davidmaletz_mining_Main.parseInt(e.get("offsetY")) : 0; +}; +$hxClasses["com.davidmaletz.mining.world.Interior"] = com_davidmaletz_mining_world_Interior; +com_davidmaletz_mining_world_Interior.__name__ = ["com","davidmaletz","mining","world","Interior"]; +com_davidmaletz_mining_world_Interior.prototype = { + area: null + ,enterX: null + ,enterY: null + ,operateX: null + ,operateY: null + ,exitX: null + ,exitY: null + ,offsetX: null + ,offsetY: null + ,__class__: com_davidmaletz_mining_world_Interior +}; +var com_davidmaletz_mining_world_Shapes = function() { }; +$hxClasses["com.davidmaletz.mining.world.Shapes"] = com_davidmaletz_mining_world_Shapes; +com_davidmaletz_mining_world_Shapes.__name__ = ["com","davidmaletz","mining","world","Shapes"]; +com_davidmaletz_mining_world_Shapes.parse = function(xml,vars) { + var _g = xml.get("type"); + switch(_g) { + case "none": + return null; + case "trapezoid": + return new com_davidmaletz_mining_world__$Shapes_Trapezoid(xml,vars); + default: + return new com_davidmaletz_mining_world__$Shapes_Rectangle(xml,vars); + } +}; +var com_davidmaletz_mining_world__$Shapes_Rectangle = function(xml,vars) { + this.stX = xml.exists("x") ? com_davidmaletz_faengfl_EventHandler.execute(xml.get("x"),vars) : 0; + var stY = xml.exists("y") ? com_davidmaletz_faengfl_EventHandler.execute(xml.get("y"),vars) : 0; + this.endX = com_davidmaletz_faengfl_EventHandler.execute(xml.get("width"),vars) + this.stX; + this.endY = com_davidmaletz_faengfl_EventHandler.execute(xml.get("height"),vars) + stY; + this.curX = this.stX; + this.curY = stY; +}; +$hxClasses["com.davidmaletz.mining.world._Shapes.Rectangle"] = com_davidmaletz_mining_world__$Shapes_Rectangle; +com_davidmaletz_mining_world__$Shapes_Rectangle.__name__ = ["com","davidmaletz","mining","world","_Shapes","Rectangle"]; +com_davidmaletz_mining_world__$Shapes_Rectangle.__interfaces__ = [com_davidmaletz_mining_world_Shape]; +com_davidmaletz_mining_world__$Shapes_Rectangle.prototype = { + curX: null + ,curY: null + ,stX: null + ,endX: null + ,endY: null + ,hasNext: function() { + return this.curY < this.endY; + } + ,next: function(pt) { + pt.x = this.curX; + pt.y = this.curY; + this.curX++; + if(this.curX >= this.endX) { + this.curX = this.stX; + this.curY++; + } + } + ,__class__: com_davidmaletz_mining_world__$Shapes_Rectangle +}; +var com_davidmaletz_mining_world__$Shapes_Trapezoid = function(xml,vars) { + var t = xml.elementsNamed("top").next(); + var b = xml.elementsNamed("bottom").next(); + this.topY = com_davidmaletz_faengfl_EventHandler.execute(t.get("y"),vars); + this.topX1 = com_davidmaletz_faengfl_EventHandler.execute(t.get("fromX"),vars); + this.topX2 = com_davidmaletz_faengfl_EventHandler.execute(t.get("toX"),vars); + this.bottomY = com_davidmaletz_faengfl_EventHandler.execute(b.get("y"),vars); + this.bottomX1 = com_davidmaletz_faengfl_EventHandler.execute(b.get("fromX"),vars); + this.bottomX2 = com_davidmaletz_faengfl_EventHandler.execute(b.get("toX"),vars); + this.fromX = this.topX1; + this.toX = this.topX2; + this.curX = this.fromX; + this.curY = xml.exists("top") ? com_davidmaletz_faengfl_EventHandler.execute(xml.get("top"),vars) : this.topY; + this.bottom = xml.exists("bottom") ? com_davidmaletz_faengfl_EventHandler.execute(xml.get("bottom"),vars) : this.bottomY; +}; +$hxClasses["com.davidmaletz.mining.world._Shapes.Trapezoid"] = com_davidmaletz_mining_world__$Shapes_Trapezoid; +com_davidmaletz_mining_world__$Shapes_Trapezoid.__name__ = ["com","davidmaletz","mining","world","_Shapes","Trapezoid"]; +com_davidmaletz_mining_world__$Shapes_Trapezoid.__interfaces__ = [com_davidmaletz_mining_world_Shape]; +com_davidmaletz_mining_world__$Shapes_Trapezoid.prototype = { + curX: null + ,curY: null + ,fromX: null + ,toX: null + ,topY: null + ,topX1: null + ,topX2: null + ,bottom: null + ,bottomY: null + ,bottomX1: null + ,bottomX2: null + ,hasNext: function() { + return this.curY < this.bottom; + } + ,next: function(pt) { + pt.x = this.curX; + pt.y = this.curY; + this.curX++; + if(this.curX >= this.toX) { + this.curY++; + if(this.curY >= this.bottomY) { + this.fromX = this.bottomX1; + this.toX = this.bottomX2; + } else if(this.curY > this.topY) { + var f = (this.curY - this.topY) / (this.bottomY - this.topY); + this.fromX = Math.round(com_fancyfish_faeng_common_Utils.interp(this.topX1,this.bottomX1,f)); + this.toX = Math.round(com_fancyfish_faeng_common_Utils.interp(this.topX2,this.bottomX2,f)); + } + this.curX = this.fromX; + } + } + ,__class__: com_davidmaletz_mining_world__$Shapes_Trapezoid +}; +var com_davidmaletz_mining_world_SignObject = function(info,x,y) { + com_davidmaletz_mining_world_ItemObject.call(this,info,x,y); + this.set_message(""); +}; +$hxClasses["com.davidmaletz.mining.world.SignObject"] = com_davidmaletz_mining_world_SignObject; +com_davidmaletz_mining_world_SignObject.__name__ = ["com","davidmaletz","mining","world","SignObject"]; +com_davidmaletz_mining_world_SignObject.__interfaces__ = [com_davidmaletz_mining_world_LabelObject]; +com_davidmaletz_mining_world_SignObject.__super__ = com_davidmaletz_mining_world_ItemObject; +com_davidmaletz_mining_world_SignObject.prototype = $extend(com_davidmaletz_mining_world_ItemObject.prototype,{ + message: null + ,onOver: function(p) { + com_davidmaletz_mining_world_ItemObject.prototype.onOver.call(this,p); + this.showMessage(this.message); + } + ,onOut: function(p) { + com_davidmaletz_mining_world_ItemObject.prototype.onOut.call(this,p); + this.hideMessage(); + } + ,write: function(b) { + com_davidmaletz_mining_world_ItemObject.prototype.write.call(this,b); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.message); + } + ,read: function(b,version) { + com_davidmaletz_mining_world_ItemObject.prototype.read.call(this,b,version); + this.set_message(com_fancyfish_faeng_common_UTFUtils.readUTF(b)); + } + ,getLabel: function() { + return this.message; + } + ,setLabel: function(s) { + this.set_message(s); + } + ,set_message: function(s) { + if(this.message != s) { + this.message = s; + this.dispatchEvent(new openfl_events_Event("change_label")); + } + return s; + } + ,__class__: com_davidmaletz_mining_world_SignObject + ,__properties__: $extend(com_davidmaletz_mining_world_ItemObject.prototype.__properties__,{set_message:"set_message"}) +}); +var com_davidmaletz_mining_world_SmelterObject = function(info,x,y) { + com_davidmaletz_mining_world_FuelableObject.call(this,info,x,y); + this.queue = new com_davidmaletz_mining_item_SmeltQueue(this,info.item.info.xml.get("uncraft") != "true"); + this.queue.addEventListener("update",$bind(this,this.update_smelter)); +}; +$hxClasses["com.davidmaletz.mining.world.SmelterObject"] = com_davidmaletz_mining_world_SmelterObject; +com_davidmaletz_mining_world_SmelterObject.__name__ = ["com","davidmaletz","mining","world","SmelterObject"]; +com_davidmaletz_mining_world_SmelterObject.addRecipe = function(p,r) { + if(r.complete) { + p.inventory.addItems(r.recipe.creates.item,r.recipe.creates.count * r.count,r.recipe.creates.value,r.recipe.creates.name); + } else { + p.inventory.addIngredients(r.recipe,r.count); + } +}; +com_davidmaletz_mining_world_SmelterObject.__super__ = com_davidmaletz_mining_world_FuelableObject; +com_davidmaletz_mining_world_SmelterObject.prototype = $extend(com_davidmaletz_mining_world_FuelableObject.prototype,{ + queue: null + ,update_smelter: function(e) { + this.update(e); + if(e.value == 1) { + this.playSound(com_davidmaletz_faengfl_adv_sound_Sound.resolve(null,this.getInfo().item.info.xml,"smelt"),false); + } + } + ,enter_frame: function(df) { + if(this.queue.handleTick(df) && this.renderer != null && !this.queue.isSmelting()) { + this.update(null); + } + } + ,isPowered: function(ar) { + return this.queue.isSmelting(); + } + ,doOperate: function(p) { + var c = com_davidmaletz_mining_Main.getContainer(); + var wnd = new com_davidmaletz_mining_ui_SmeltWindow(p.getInv(false),this.getInfo().item.getName(),this.queue,c,p.includeCost(),this.info.xml,this,this.info.xml.elementPathsNamed("listItem")); + var f = $bind(this,this.collect); + var p1 = p; + var tmp = function() { + f(p1); + }; + c.addDisplay(com_davidmaletz_mining_world_ItemObject.collectWindow(wnd,wnd.getWidth(),wnd.getHeight(),tmp),2); + } + ,createRenderer: function() { + var r = com_davidmaletz_mining_world_FuelableObject.prototype.createRenderer.call(this); + var xml = this.getInfo().item.info.xml; + r.addChild(new com_davidmaletz_mining_renderer_ItemBubble((this._width >> 1) + (xml.exists("speechX") ? com_davidmaletz_mining_Main.parseInt(xml.get("speechX")) : 0),this._height - 35 + (xml.exists("speechY") ? com_davidmaletz_mining_Main.parseInt(xml.get("speechY")) : 0),this.queue)); + return r; + } + ,collect: function(p) { + var r = this.queue.getIncomplete(); + while(r.hasNext()) { + var r1 = r.next(); + com_davidmaletz_mining_world_SmelterObject.addRecipe(p,r1); + } + var r2 = this.queue.getComplete(); + while(r2.hasNext()) { + var r3 = r2.next(); + com_davidmaletz_mining_world_SmelterObject.addRecipe(p,r3); + } + var c = this.queue.getCurrent(); + if(c != null) { + com_davidmaletz_mining_world_SmelterObject.addRecipe(p,new com_davidmaletz_mining_item_RecipeCount(c.recipe,1,!this.queue.craft)); + } + this.queue.clear(); + com_davidmaletz_mining_world_FuelableObject.prototype.collect.call(this,p); + } + ,innerWrite: function(b) { + com_davidmaletz_mining_world_FuelableObject.prototype.innerWrite.call(this,b); + this.queue.write(b); + } + ,innerRead: function(b,version) { + com_davidmaletz_mining_world_FuelableObject.prototype.innerRead.call(this,b,version); + this.queue.read(b,version); + } + ,__class__: com_davidmaletz_mining_world_SmelterObject +}); +var com_davidmaletz_mining_world_SolarSystem = function(xml) { + this.id = xml.get("id"); + this.xml = xml; + this.planets = []; + var e = xml.elementPathsNamed("planet"); + while(e.hasNext()) { + var e1 = e.next(); + var p = com_davidmaletz_mining_world_Planet._get(e1.get("id")); + this.planets.push(new com_davidmaletz_mining_world_PlanetData(p,e1)); + if(p != null) { + p.system = this; + } + } +}; +$hxClasses["com.davidmaletz.mining.world.SolarSystem"] = com_davidmaletz_mining_world_SolarSystem; +com_davidmaletz_mining_world_SolarSystem.__name__ = ["com","davidmaletz","mining","world","SolarSystem"]; +com_davidmaletz_mining_world_SolarSystem.systems = null; +com_davidmaletz_mining_world_SolarSystem.get = function(id) { + var ret = com_davidmaletz_mining_world_SolarSystem._get(id); + if(id != null && id.length > 0 && ret == null) { + haxe_Log.trace("No System found: " + id,{ fileName : "SolarSystem.hx", lineNumber : 32, className : "com.davidmaletz.mining.world.SolarSystem", methodName : "get"}); + } + return ret; +}; +com_davidmaletz_mining_world_SolarSystem._get = function(id) { + if(id == null || com_davidmaletz_mining_world_SolarSystem.systems == null) { + return null; + } else { + return com_davidmaletz_mining_world_SolarSystem.systems.get(id); + } +}; +com_davidmaletz_mining_world_SolarSystem.exists = function(id) { + if(id != null && com_davidmaletz_mining_world_SolarSystem.systems != null) { + return com_davidmaletz_mining_world_SolarSystem.systems.exists(id); + } else { + return false; + } +}; +com_davidmaletz_mining_world_SolarSystem.set = function(p) { + if(com_davidmaletz_mining_world_SolarSystem.systems == null) { + com_davidmaletz_mining_world_SolarSystem.systems = new haxe_ds_StringMap(); + } + if(com_davidmaletz_mining_world_SolarSystem.systems.exists(p.id)) { + haxe_Log.trace("Overwrite System: " + p.id,{ fileName : "SolarSystem.hx", lineNumber : 40, className : "com.davidmaletz.mining.world.SolarSystem", methodName : "set"}); + } + com_davidmaletz_mining_world_SolarSystem.systems.set(p.id,p); +}; +com_davidmaletz_mining_world_SolarSystem.reset = function() { + com_davidmaletz_mining_world_SolarSystem.systems = null; +}; +com_davidmaletz_mining_world_SolarSystem.getAll = function() { + if(com_davidmaletz_mining_world_SolarSystem.systems == null) { + return new com_fancyfish_faeng_common_NullIterator(); + } else { + return com_davidmaletz_mining_world_SolarSystem.systems.iterator(); + } +}; +com_davidmaletz_mining_world_SolarSystem.getPlanetName = function(planet,xml) { + var m = com_fancyfish_faeng_common_Lang.getTextFromTitle(xml.get("name")); + if(m == null) { + return com_fancyfish_faeng_common_Lang.getText("system.planet",xml.get("id")); + } else { + return m; + } +}; +com_davidmaletz_mining_world_SolarSystem.prototype = { + id: null + ,xml: null + ,planets: null + ,getPlanets: function(vars) { + var ar = []; + var _g = 0; + var _g1 = this.planets; + while(_g < _g1.length) { + var p = _g1[_g]; + ++_g; + if(!p.xml.exists("available") || com_davidmaletz_faengfl_EventHandler._conditionMet(p.xml.get("available"),vars)) { + ar.push(p); + } + } + return ar; + } + ,getPlanetData: function(planet) { + var _g = 0; + var _g1 = this.planets; + while(_g < _g1.length) { + var p = _g1[_g]; + ++_g; + if(p.planet == planet) { + return p; + } + } + return null; + } + ,getName: function() { + var m = com_fancyfish_faeng_common_Lang.getTextFromTitle(this.xml.get("name")); + if(m == null) { + return com_fancyfish_faeng_common_Lang.getText("system",this.id); + } else { + return m; + } + } + ,getDesc: function() { + var m = com_fancyfish_faeng_common_Lang.getTextFromTitle(this.xml.get("desc")); + if(m == null) { + return com_fancyfish_faeng_common_Lang.getText("system.desc",this.id); + } else { + return m; + } + } + ,__class__: com_davidmaletz_mining_world_SolarSystem +}; +var com_davidmaletz_mining_world_PlanetData = function(p,e) { + this.planet = p; + this.xml = e; +}; +$hxClasses["com.davidmaletz.mining.world.PlanetData"] = com_davidmaletz_mining_world_PlanetData; +com_davidmaletz_mining_world_PlanetData.__name__ = ["com","davidmaletz","mining","world","PlanetData"]; +com_davidmaletz_mining_world_PlanetData.prototype = { + planet: null + ,xml: null + ,getName: function() { + return com_davidmaletz_mining_world_SolarSystem.getPlanetName(this.planet,this.xml); + } + ,getDesc: function() { + var m = com_fancyfish_faeng_common_Lang.getTextFromTitle(this.xml.get("desc")); + if(m == null) { + return com_fancyfish_faeng_common_Lang.getText("system.planet.desc",this.xml.get("id")); + } else { + return m; + } + } + ,__class__: com_davidmaletz_mining_world_PlanetData +}; +var com_davidmaletz_mining_world_TrapObject = function(info,x,y) { + com_davidmaletz_mining_world_ItemObject.call(this,info,x,y); + this.held = null; + this.sprung = false; + this.trapping = 0; +}; +$hxClasses["com.davidmaletz.mining.world.TrapObject"] = com_davidmaletz_mining_world_TrapObject; +com_davidmaletz_mining_world_TrapObject.__name__ = ["com","davidmaletz","mining","world","TrapObject"]; +com_davidmaletz_mining_world_TrapObject.__super__ = com_davidmaletz_mining_world_ItemObject; +com_davidmaletz_mining_world_TrapObject.prototype = $extend(com_davidmaletz_mining_world_ItemObject.prototype,{ + held: null + ,sprung: null + ,enemy: null + ,trapping: null + ,addedToArea: function() { + com_davidmaletz_mining_world_ItemObject.prototype.addedToArea.call(this); + new com_davidmaletz_faengfl_InvokeLater($bind(this,this.onSpawn),0); + } + ,onSpawn: function() { + var _gthis = this; + this.getOverlap(function(o,rect) { + if(Std["is"](o,com_davidmaletz_mining_enemy_Enemy)) { + return (js_Boot.__cast(o , com_davidmaletz_mining_enemy_Enemy)).checkTrap(_gthis); + } else { + return false; + } + }); + } + ,createRenderer: function() { + var ret = this.makeLerpSprite(); + if(this.enemy != null) { + ret.addChild(this.enemy); + } + if(this.held != null) { + var icon = this.getHeldIcon(this.held.item); + ret.addChild(icon); + } + var i = this.getInfo().item.info; + var anim = this.get_tile_y() == -1 ? "place" : "below_surface"; + var loop = false; + if(this.held != null) { + if(this.getInfo().capture != 0) { + anim = "caught"; + loop = true; + } else { + anim = "spring"; + } + } else if(this.enemy != null) { + anim = "capture"; + loop = true; + } + var a; + if(anim == "place" || anim == "below_surface" && i.getAnim(anim) == "single") { + a = i.getAnim("place"); + loop = i.xml.get("placeLoop") == "true"; + } else { + a = i.getAnim(anim); + } + var icon1 = new com_davidmaletz_tiles_render_PlayAnimation(this.getTile(),a,15,loop); + if(this.held != null) { + icon1.setFrame(icon1.getMaxFrame()); + } + icon1.set_x(-com_davidmaletz_tiles_Tile.SIZE * 0.5); + ret.addChild(icon1); + if(this.sprung && this.enemy == null && this.held == null) { + this.renderer = ret; + this.playAnim("spring",$bind(this,this.remove)); + } + return ret; + } + ,getHeldIcon: function(item) { + var familiar = item.getFamiliar(); + if(familiar == null) { + var icon = item.createIcon(); + icon.set_x(-com_davidmaletz_tiles_Tile.SIZE * 0.5); + return icon; + } else { + var tile = com_davidmaletz_tiles_Tile.get(familiar.get("tile")); + var icon1 = new com_davidmaletz_tiles_render_PlayAnimation(tile,com_davidmaletz_mining_familiar_Familiar._getAnim(familiar.xml,"idle"),com_davidmaletz_mining_enemy_AttackRenderer.getFPS(familiar,15),true,null,-0.5,0); + item.tint(icon1); + icon1.set_y(10 - tile.getHeight()); + return icon1; + } + } + ,fadeIn: function(l,frames) { + l.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),frames); + } + ,setHeld: function(h,frames) { + if(frames == null) { + frames = 0; + } + if(h == null || h.item == null) { + this.held = null; + return false; + } + this.held = h; + if(this.renderer != null) { + var icon = this.getHeldIcon(this.held.item); + if(frames == 0) { + this.renderer.addChildAt(icon,0); + } else { + var l = new com_davidmaletz_lerp_LerpSpriteFL(); + l.addChild(icon); + l.set_alpha(0); + var f = $bind(this,this.fadeIn); + var l1 = l; + var a1 = frames; + var tmp = function() { + f(l1,a1); + }; + l.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),frames,tmp); + this.renderer.addChildAt(l,0); + } + } + return true; + } + ,playAnim: function(anim,complete,loop) { + if(loop == null) { + loop = false; + } + if(this.renderer != null) { + (js_Boot.__cast(this.renderer.getChildAt(this.renderer.get_numChildren() - 1) , com_davidmaletz_tiles_render_PlayAnimation)).playAnimation(this.getInfo().item.info.getAnim(anim),loop,complete); + } else if(complete != null) { + complete(null); + } + } + ,playCapture: function(p) { + this.playAnim("capture",null,true); + } + ,playBreak: function(p) { + this.playAnim("break",$bind(this,this.remove)); + } + ,__springTrap: function() { + this.sprung = true; + this.playAnim("spring",$bind(this,this.remove)); + } + ,__attemptCatch: function(e,ct) { + var remove = null; + var info = this.getInfo(); + this.sprung = true; + if(ct != 0) { + this.enemy = com_davidmaletz_mining_world__$TrapObject_CaptureEnemy.fromEnemy(this,e,ct); + var r = e.renderer; + if(r != null && this.renderer != null) { + this.enemy.set_x(r.get_x() - this.renderer.get_x()); + this.enemy.set_y(Math.round(r.get_y() - this.renderer.get_y() + e._height * 0.5)); + this.enemy.set_scaleX(r.get_scaleX()); + this.enemy.lerp(new com_davidmaletz_lerp_PositionKeyframe(0,10),10); + com_davidmaletz_faengfl_FaengFL.remove(r); + } + if(this.renderer != null) { + this.renderer.addChildAt(this.enemy,0); + } + this.playAnim("spring",$bind(this,this.playCapture)); + com_davidmaletz_faengfl_adv_sound_Sound.playLoc(com_davidmaletz_faengfl_adv_sound_Sound.resolveDefault(info.item.info.xml,"swing"),this.renderer); + return true; + } else { + this.showPopup(false,com_fancyfish_faeng_common_Lang.getText("capture","fail")); + remove = $bind(this,this.playBreak); + } + this.playAnim("spring",remove); + com_davidmaletz_faengfl_adv_sound_Sound.playLoc(com_davidmaletz_faengfl_adv_sound_Sound.resolveDefault(info.item.info.xml,"swing"),this.renderer); + return false; + } + ,__damageTrap: function(loot) { + this.sprung = true; + var remove = null; + if(loot == null) { + remove = $bind(this,this.remove); + } else if(!this.setHeld(loot,10)) { + remove = $bind(this,this.remove); + } + this.playAnim("spring",remove); + com_davidmaletz_faengfl_adv_sound_Sound.playLoc(com_davidmaletz_faengfl_adv_sound_Sound.resolveDefault(this.getInfo().item.info.xml,"swing"),this.renderer); + } + ,activate: function(e) { + if(this.sprung || this.held != null || this.area == null) { + return; + } + if(e == null) { + this.dispatchEvent(new openfl_events_Event("spring_trap")); + this.__springTrap(); + } else { + var info = this.getInfo(); + var element = com_davidmaletz_mining_world_Element.get(info.item.info.xml.get("element")); + if(info.capture != 0) { + var ct = e.attemptCatch(info.capture,this.trapping,element); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("attempt_catch",new com_fancyfish_faeng_common_Pair(e,ct))); + if(this.__attemptCatch(e,ct)) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + this.area.removeObject(e,null); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + } else if(info.damage > 0) { + var element1 = com_davidmaletz_mining_world_Element.get(info.item.info.xml.get("element")); + var old1 = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + var flags = info.xml.get("ignoreArmor") == "true" ? 2 : 0; + var dmg = e.loseHealth(info.damage,flags | (info.xml.get("critical") == "true" ? 1 : 0),this,element1,0); + if(dmg > 0) { + e.hitEffect(com_davidmaletz_mining_world_ObjectInfo.getHitEffectI(com_davidmaletz_mining_Main.getLocalPlayer(),element1,info.xml)); + } + var loot = null; + if(e.area == null) { + loot = e.getLoot(element1,true); + e.defeatedBy(com_davidmaletz_mining_Main.getLocalPlayer()); + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old1; + var l = loot == null || !loot.hasNext() ? null : loot.next(); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("damage_trap",l)); + this.__damageTrap(l); + if(loot != null && loot.hasNext()) { + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + com_davidmaletz_mining_world_Projectile.placeLoot(this.area,loot,Math.round(this.getCenterX()),this.yTile); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old1; + } + } + } + } + ,remove: function(p) { + if(this.area != null) { + this.dispatchEvent(new openfl_events_Event("stop_watch")); + this.area.removeObject(this); + } + } + ,getLayer: function() { + return 5; + } + ,getAction: function(p) { + if(!this.isVisible()) { + return null; + } + var i = this.held == null ? this.sprung ? null : this.getInfo().item : this.held.item; + if(i == null) { + return null; + } else { + return com_davidmaletz_mining_world_ItemObject.itemText(com_fancyfish_faeng_common_Lang.getText("object.tooltip","collect"),i); + } + } + ,isBlocking: function(asker) { + return false; + } + ,spawnEnemy: function(area) { + var o = this.enemy.info.create(this.xPos,this.yTile); + o.health = this.enemy.health; + area.addObject(o); + this.removeEnemy(); + } + ,removeEnemy: function(frames) { + if(frames == null) { + frames = 0; + } + if(this.enemy == null) { + return; + } + this.enemy.showPopup(); + if(frames == 0) { + com_davidmaletz_faengfl_FaengFL.remove(this.enemy); + } else { + var d = this.enemy; + var tmp = function() { + com_davidmaletz_faengfl_FaengFL.remove(d); + }; + this.enemy.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),frames,tmp); + } + this.enemy = null; + this.dispatchEvent(new openfl_events_Event("remove_enemy")); + } + ,hasHeld: function() { + return this.held != null; + } + ,removedFromArea: function(area) { + if(this.enemy != null && area.isActivePlayer()) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + this.spawnEnemy(area); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + } + ,doOperate: function(p) { + if(this.area != null) { + if(this.held == null) { + this.doCollect(p); + } else { + if(this.getInfo().capture != 0) { + this.dispatchEvent(new openfl_events_Event("remove_enemy")); + } + var d = this.held.item.xml.exists("captureDurability") ? com_davidmaletz_mining_Main.parseInt(this.held.item.xml.get("captureDurability")) : 0; + p.addItems(this.held.item,this.held.count,com_fancyfish_faeng_common_Utils.max(0,this.held.item.getDurability() - d)); + this.area.removeObject(this); + p.overlapChanged(); + p.addExp(5); + } + } + } + ,write: function(b) { + com_davidmaletz_mining_world_ItemObject.prototype.write.call(this,b); + if(this.held == null) { + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + } else { + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.held.item.id); + b.writeUInt16(this.held.count); + } + b.writeByte(this.sprung ? 1 : 0); + if(this.getInfo().capture != 0) { + com_davidmaletz_mining_world__$TrapObject_CaptureEnemy.write(this.enemy,b); + } + b.writeByte(this.trapping); + } + ,read: function(b,version) { + com_davidmaletz_mining_world_ItemObject.prototype.read.call(this,b,version); + var id = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(id == null) { + this.held = null; + } else { + var i = com_davidmaletz_mining_item_ItemInfo.get(id); + if(version >= 27) { + this.held = new com_davidmaletz_mining_item_ItemCt(i,b.readUInt16()); + } else { + this.held = new com_davidmaletz_mining_item_ItemCt(i,1); + } + if(this.held.item == null) { + this.held = null; + } + } + if(version >= 26) { + this.sprung = b.readByte() == 1; + } + var c = this.getInfo().capture; + if(version >= 44 && c > 0 || version >= 74 && c != 0) { + this.enemy = com_davidmaletz_mining_world__$TrapObject_CaptureEnemy.read(this,b); + } + if(version >= 65) { + this.trapping = b.readByte() & 255; + } + } + ,__class__: com_davidmaletz_mining_world_TrapObject +}); +var com_davidmaletz_mining_world__$TrapObject_CaptureEnemy = function(parent,i,h,ct) { + this.shownPopup = false; + this.trap = parent; + this.info = i; + this.health = h; + this.rounds = this.cur = ct; + if(this.cur == 7) { + this.cur -= 2; + } else { + this.cur--; + } + var t = com_davidmaletz_tiles_Tile.get(this.info.tile); + com_davidmaletz_lerp_LerpSpriteFL.call(this); + this.set_y(10); + var s = new com_davidmaletz_tiles_render_PlayAnimation(t,this.info.getAnim("walk",null),com_davidmaletz_mining_enemy_AttackRenderer.getFPS(this.info.xml,15),false,$bind(this,this.next),-0.5,-1); + i.tint(s); + this.addChild(s); + this.inner = s; + var p = i.health == 0 ? 1 : h / i.health; + if(p < 1) { + var w = t.getWidth(); + this.bar = new com_davidmaletz_controls_ProgressBar(w,2,10027008,p,false); + this.bar.set_x(-Math.round(w * 0.5)); + this.bar.set_y(-t.getHeight() - 3); + this.addChild(this.bar); + } +}; +$hxClasses["com.davidmaletz.mining.world._TrapObject.CaptureEnemy"] = com_davidmaletz_mining_world__$TrapObject_CaptureEnemy; +com_davidmaletz_mining_world__$TrapObject_CaptureEnemy.__name__ = ["com","davidmaletz","mining","world","_TrapObject","CaptureEnemy"]; +com_davidmaletz_mining_world__$TrapObject_CaptureEnemy.fromEnemy = function(parent,e,ct) { + return new com_davidmaletz_mining_world__$TrapObject_CaptureEnemy(parent,e.getInfo(),e.getHealth(),ct); +}; +com_davidmaletz_mining_world__$TrapObject_CaptureEnemy.write = function(e,b) { + if(e == null) { + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,null); + } else { + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,e.info.id); + b.writeUInt16(e.health); + b.writeInt8(e.rounds); + } +}; +com_davidmaletz_mining_world__$TrapObject_CaptureEnemy.read = function(parent,b) { + var id = com_fancyfish_faeng_common_UTFUtils.readUTF(b); + if(id == null) { + return null; + } + var hp = b.readUInt16(); + var ct = b.readInt8(); + var i = com_davidmaletz_mining_world_ObjectInfo.get(id); + if(Std["is"](i,com_davidmaletz_mining_enemy_EnemyInfo)) { + return new com_davidmaletz_mining_world__$TrapObject_CaptureEnemy(parent,i,hp,ct); + } else { + return null; + } +}; +com_davidmaletz_mining_world__$TrapObject_CaptureEnemy.__super__ = com_davidmaletz_lerp_LerpSpriteFL; +com_davidmaletz_mining_world__$TrapObject_CaptureEnemy.prototype = $extend(com_davidmaletz_lerp_LerpSpriteFL.prototype,{ + info: null + ,health: null + ,cur: null + ,inner: null + ,rounds: null + ,bar: null + ,trap: null + ,shownPopup: null + ,set_scaleX: function(f) { + if(this.bar != null) { + this.bar.set_scaleX(f); + this.bar.set_x(-Math.abs(this.bar.get_x()) * f); + } + return com_davidmaletz_lerp_LerpSpriteFL.prototype.set_scaleX.call(this,f); + } + ,next: function(p) { + if(this.cur <= 0) { + if(this.rounds == 7) { + var i = this.trap.getInfo(); + if(this.trap.enemy == this) { + this.trap.removeEnemy(10); + } + this.showPopup(); + var sfx = com_davidmaletz_faengfl_adv_sound_Sound.resolve(this.info.sounds,this.info.xml,"capture"); + if(!com_davidmaletz_faengfl_adv_sound_Sound.exists(sfx)) { + sfx = com_davidmaletz_faengfl_adv_sound_Sound.resolve(this.info.sounds,this.info.xml,"death"); + } + if(com_davidmaletz_faengfl_adv_sound_Sound.exists(sfx)) { + com_davidmaletz_mining_world_Object.playObject(this.trap,sfx,false); + } + var element = com_davidmaletz_mining_world_Element.get(i.item.info.xml.get("element")); + if(!this.trap.setHeld(new com_davidmaletz_mining_item_ItemCt(this.info.onCapture(i.capture,element),1),10)) { + this.trap.playBreak(null); + } else { + this.trap.playAnim("caught",null,true); + } + } else { + var f = this.rounds <= 3; + this.showPopup(); + if(!f && this.health > 1) { + this.health--; + } + if(this.trap.enemy == this && this.trap.area != null && this.trap.area.isActivePlayer()) { + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + this.trap.spawnEnemy(this.trap.area); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + } + this.trap.playBreak(null); + } + return; + } + this.cur--; + this.set_scaleX(-this.get_scaleX()); + this.inner.setFrame(0); + this.inner.playAnimation(this.info.getAnim("walk",null),false,$bind(this,this.next)); + } + ,showPopup: function() { + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + var a = p == null ? null : p.getCurrentArea(); + if(!this.shownPopup && this.trap.area != null && this.trap.area == a) { + this.shownPopup = true; + if(this.rounds == 7) { + this.trap.showPopup(false,com_fancyfish_faeng_common_Lang.getText("capture","caught")); + } else { + var f = this.rounds <= 3; + this.trap.showPopup(false,com_fancyfish_faeng_common_Lang.getText("capture",f ? "fail" : "almost")); + } + } + } + ,__class__: com_davidmaletz_mining_world__$TrapObject_CaptureEnemy +}); +var com_davidmaletz_mining_world_Tree = function(info,x,y) { + com_davidmaletz_mining_world_Bush.call(this,info,x,y); + this.defense = info.xml.exists("defense") ? com_davidmaletz_mining_Main.parseInt(info.xml.get("defense")) : 0; + this.elementDefense = info.xml.exists("elementDefense") ? com_davidmaletz_mining_Main.parseInt(info.xml.get("elementDefense")) : 0; + this.generateO2 = info.xml.exists("generateO2") ? com_davidmaletz_mining_Main.parseFloat(info.xml.get("generateO2")) : 0; +}; +$hxClasses["com.davidmaletz.mining.world.Tree"] = com_davidmaletz_mining_world_Tree; +com_davidmaletz_mining_world_Tree.__name__ = ["com","davidmaletz","mining","world","Tree"]; +com_davidmaletz_mining_world_Tree.__super__ = com_davidmaletz_mining_world_Bush; +com_davidmaletz_mining_world_Tree.prototype = $extend(com_davidmaletz_mining_world_Bush.prototype,{ + defense: null + ,elementDefense: null + ,generateO2: null + ,addedToArea: function() { + com_davidmaletz_mining_world_Bush.prototype.addedToArea.call(this); + this.area.generateO2 += this.generateO2; + } + ,removedFromArea: function(area) { + com_davidmaletz_mining_world_Bush.prototype.removedFromArea.call(this,area); + area.generateO2 -= this.generateO2; + } + ,setFrameSpeed: function(r,f) { + if(Std["is"](r,com_davidmaletz_mining_renderer_TreeRenderer)) { + var a = (js_Boot.__cast(r , com_davidmaletz_mining_renderer_TreeRenderer)).attack; + if(a != null) { + a.frameSpeed = f; + } + } + } + ,knockback: function(dx,passObjects) { + if(passObjects == null) { + passObjects = false; + } + } + ,createRenderer: function() { + return new com_davidmaletz_mining_renderer_TreeRenderer(this); + } + ,getLoot: function(e,projectile) { + if(projectile) { + var l = this.getTreeInfo().getLoot(e); + if(l == null) { + return null; + } else { + return new com_fancyfish_faeng_common_SingleIterator(l); + } + } else if(this.isGrown()) { + return com_davidmaletz_mining_world_Bush.prototype.getLoot.call(this,e,projectile); + } else { + var e1 = this.getInfo().xml.elementsNamed("collect"); + if(e1.hasNext()) { + var xml = e1.next(); + var i = com_davidmaletz_mining_item_ItemInfo.get(xml.get("loot")); + if(i == null) { + return null; + } + var min = com_davidmaletz_mining_Main.parseInt(xml.get("min")); + var max = com_davidmaletz_mining_Main.parseInt(xml.get("max")); + return new com_fancyfish_faeng_common_SingleIterator(new com_davidmaletz_mining_item_ItemCt(i,Math.floor((max + 1 - min) * Math.random()) + min)); + } else { + var i1 = com_davidmaletz_mining_item_ItemInfo.get(this.getInfo().loot); + if(i1 == null) { + return null; + } else { + return new com_fancyfish_faeng_common_SingleIterator(new com_davidmaletz_mining_item_ItemCt(i1,1)); + } + } + } + } + ,getDefaultBlood: function() { + return null; + } + ,onDeath: function(killer,element) { + if(this.area != null) { + this.area.dispatchEvent(new com_davidmaletz_mining_world_RemoveEvent("tree_cut",this,killer,element,this.area)); + } + if(this.renderer != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_renderer_TreeRenderer)).onKill(killer,element); + } + if(killer != null && Std["is"](killer,com_davidmaletz_mining_Player)) { + this.defeatedBy(js_Boot.__cast(killer , com_davidmaletz_mining_Player)); + } + } + ,setHealth: function(h,fireDeath,attacker) { + if(fireDeath == null) { + fireDeath = true; + } + com_davidmaletz_mining_world_Bush.prototype.setHealth.call(this,h,fireDeath,attacker); + if(h == 0 && !fireDeath) { + if(this.renderer != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_renderer_TreeRenderer)).onKill(null,null); + } else { + this.setGrowth(0); + } + } + } + ,defeatedBy: function(p) { + p.addKillCount(this.info.id,1); + var xml = this.getInfo().xml; + if(p == com_davidmaletz_mining_Main.getLocalPlayer() && xml.exists("kill_achievement")) { + com_davidmaletz_faengfl_achievement_Achievements.instance.gainAchievement(xml.get("kill_achievement")); + } + } + ,getDefense: function(element,behind,critical,useDurability) { + return this.defense + (element == null ? 0 : this.elementDefense); + } + ,getDefenseElement: function() { + return com_davidmaletz_mining_world_Element.get(this.info.xml.exists("element") ? this.info.xml.get("element") : "plant"); + } + ,getTreeInfo: function() { + return js_Boot.__cast(this.info , com_davidmaletz_mining_world_TreeInfo); + } + ,isGrown: function() { + return this.growth > this.getInfo().grown; + } + ,isCollect: function() { + return this.growth > this.getTreeInfo().collect; + } + ,canCollect: function(p) { + if(p != null) { + return p.getMeleeWeapon(this) != null; + } else { + return false; + } + } + ,getAction: function(p) { + if(p.getMeleeWeapon(this) == null) { + return null; + } else { + return com_fancyfish_faeng_common_Lang.getText("object.tooltip","tree"); + } + } + ,canFlip: function() { + return false; + } + ,onOperate: function(p) { + var w = p.getMeleeWeapon(this); + if(w != null) { + p.useWeapon(w,null); + } + } + ,attackPower: function(attack,cut,spirit,element,player) { + if(this.growth > this.getTreeInfo().collect) { + return cut; + } else { + return 0; + } + } + ,setGrowth: function(g) { + var grown = this.isGrown(); + var collect = this.isCollect(); + if(com_davidmaletz_mining_world_Bush.prototype.setGrowth.call(this,g)) { + if(g != 0) { + if(!grown && this.isGrown()) { + this.restoreHealth(); + } else if(!collect && this.isCollect()) { + this.health = Math.ceil(com_davidmaletz_mining_world_Bush.prototype.getMaxHealth.call(this) * 0.25); + } + } + return true; + } else { + return false; + } + } + ,setEffectPos: function(effect,x,y) { + com_davidmaletz_mining_world_Bush.prototype.setEffectPos.call(this,effect,x,y); + var _g = effect; + _g.set_y(_g.get_y() - com_davidmaletz_tiles_Tile.SIZE * 0.5); + } + ,getMaxHealth: function() { + var h = com_davidmaletz_mining_world_Bush.prototype.getMaxHealth.call(this); + if(this.growth >= this.getTreeInfo().grown) { + return h; + } else { + return Math.ceil(h * 0.25); + } + } + ,__class__: com_davidmaletz_mining_world_Tree +}); +var com_davidmaletz_mining_world_TreeInfo = function(xml) { + com_davidmaletz_mining_world_BushInfo.call(this,xml); + this.blocking = xml.exists("blocking") ? com_davidmaletz_mining_Main.parseFloat(xml.get("blocking")) * 60 / 15 : Infinity; + this.collect = xml.exists("collect") ? com_davidmaletz_mining_Main.parseFloat(xml.get("collect")) * 60 / 15 : this.grown; + this.handler = new com_davidmaletz_mining_LootHandler(xml.elementsNamed("loot")); + if(this.sounds == null) { + this.sounds = new haxe_ds_StringMap(); + } + if(!this.sounds.exists("death")) { + this.sounds.set("death","tree_felled"); + } +}; +$hxClasses["com.davidmaletz.mining.world.TreeInfo"] = com_davidmaletz_mining_world_TreeInfo; +com_davidmaletz_mining_world_TreeInfo.__name__ = ["com","davidmaletz","mining","world","TreeInfo"]; +com_davidmaletz_mining_world_TreeInfo.__super__ = com_davidmaletz_mining_world_BushInfo; +com_davidmaletz_mining_world_TreeInfo.prototype = $extend(com_davidmaletz_mining_world_BushInfo.prototype,{ + blocking: null + ,collect: null + ,handler: null + ,getLoot: function(e) { + return this.handler.getLootAttack(e); + } + ,create: function(x,y) { + return new com_davidmaletz_mining_world_Tree(this,x,y); + } + ,getBase: function() { + return "tree"; + } + ,__class__: com_davidmaletz_mining_world_TreeInfo +}); +var com_davidmaletz_mining_world_types_Bird = function(area,t,xml) { + this.lastHop = false; + com_davidmaletz_tiles_render_PlayAnimation.call(this,t,"bird.idle",20,false,$bind(this,this.hop)); + this.area = area; + if(Math.random() < 0.5) { + this.set_scaleX(-this.get_scaleX()); + } + this.fromX = com_davidmaletz_mining_Main.parseInt(xml.get("fromX")); + this.toX = com_davidmaletz_mining_Main.parseInt(xml.get("toX")); +}; +$hxClasses["com.davidmaletz.mining.world.types.Bird"] = com_davidmaletz_mining_world_types_Bird; +com_davidmaletz_mining_world_types_Bird.__name__ = ["com","davidmaletz","mining","world","types","Bird"]; +com_davidmaletz_mining_world_types_Bird.__super__ = com_davidmaletz_tiles_render_PlayAnimation; +com_davidmaletz_mining_world_types_Bird.prototype = $extend(com_davidmaletz_tiles_render_PlayAnimation.prototype,{ + area: null + ,lastHop: null + ,fromX: null + ,toX: null + ,setAnimation: function(anim_id,offX,offY) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + com_davidmaletz_tiles_render_PlayAnimation.prototype.setAnimation.call(this,anim_id,-0.5,-0.5); + this.set_alpha(com_davidmaletz_mining_Main.isNight() ? 0 : 1); + } + ,playIdle: function(p) { + this.setFrame(0); + this.playAnimation("bird.idle",false,$bind(this,this.hop)); + } + ,hop: function(p) { + var nx = this.get_x() - 16 * com_fancyfish_faeng_common_Utils.sign(this.get_scaleX()); + if(nx < this.fromX * com_davidmaletz_tiles_Tile.SIZE + 4 || nx > this.toX * com_davidmaletz_tiles_Tile.SIZE - 4 || this.lastHop && Math.random() < 0.5) { + this.lastHop = false; + this.set_scaleX(-this.get_scaleX()); + this.playIdle(p); + } else { + this.lastHop = true; + this.setFrame(0); + this.playAnimation("bird.hop",false,$bind(this,this.playIdle)); + this.lerp(new com_davidmaletz_lerp_PositionKeyframe(nx,this.get_y()),Math.floor(this.getMaxFrame())); + } + } + ,fly: function(p) { + var ht = 144 + com_davidmaletz_tiles_Tile.SIZE * 2; + this.playAnimation("bird.fly",true); + this.lerp(new com_davidmaletz_lerp_PositionKeyframe(this.get_x() - this.get_scaleX() * ht,this.get_y() - ht),100,$bind(this,this.land)); + } + ,land: function() { + var ht = 144 + com_davidmaletz_tiles_Tile.SIZE * 2; + var nx = this.get_x() - this.get_scaleX() * ht; + if(nx < this.fromX * com_davidmaletz_tiles_Tile.SIZE + 4 || nx > this.toX * com_davidmaletz_tiles_Tile.SIZE - 4 || this.objectOverlap(nx,this.get_y() + ht)) { + nx = (Math.random() * (this.toX - this.fromX) + this.fromX) * com_davidmaletz_tiles_Tile.SIZE; + } + this.set_x(nx + this.get_scaleX() * ht); + this.lerp(new com_davidmaletz_lerp_PositionKeyframe(nx,this.get_y() + ht),100,$bind(this,this.land2)); + } + ,land2: function() { + this.playAnimation("bird.land",false,$bind(this,this.playIdle)); + } + ,objectOverlap: function(nx,ny) { + var x = Math.round(nx / com_davidmaletz_tiles_Tile.SIZE - 0.5); + var y = Math.round(ny / com_davidmaletz_tiles_Tile.SIZE - 0.5); + var _g = -1; + while(_g < 2) { + var i = _g++; + if(this.hasObject(x + i,y)) { + return true; + } + } + return false; + } + ,hasObject: function(x,y) { + var o = this.area.getObjectsInTile(x,y); + while(o.hasNext()) { + var o1 = o.next(); + if(o1.isBlocking(null)) { + return true; + } + } + return false; + } + ,advanceFrame: function(frames) { + if(!this.hasLerp() && this.objectOverlap(this.get_x(),this.get_y())) { + this.playAnimation("bird.leap",false,$bind(this,this.fly)); + } + com_davidmaletz_tiles_render_PlayAnimation.prototype.advanceFrame.call(this,frames); + } + ,__class__: com_davidmaletz_mining_world_types_Bird +}); +var com_davidmaletz_mining_world_types_Random = function(area,t,xml) { + com_davidmaletz_tiles_render_PlayAnimation.call(this,t,xml.exists("animation") ? xml.get("animation") : t.id + ".idle",10,true); + this.area = area; + if(Math.random() < 0.5) { + this.set_scaleX(-this.get_scaleX()); + } + this.fromX = com_davidmaletz_mining_Main.parseInt(xml.get("fromX")); + this.toX = com_davidmaletz_mining_Main.parseInt(xml.get("toX")); + this.tiles = 32; + if(xml.get("fade") == "true") { + this.set_alpha(0.5); + this.lerp1(); + } +}; +$hxClasses["com.davidmaletz.mining.world.types.Random"] = com_davidmaletz_mining_world_types_Random; +com_davidmaletz_mining_world_types_Random.__name__ = ["com","davidmaletz","mining","world","types","Random"]; +com_davidmaletz_mining_world_types_Random.__super__ = com_davidmaletz_tiles_render_PlayAnimation; +com_davidmaletz_mining_world_types_Random.prototype = $extend(com_davidmaletz_tiles_render_PlayAnimation.prototype,{ + area: null + ,fromX: null + ,toX: null + ,tiles: null + ,lerp1: function() { + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0.75),40,$bind(this,this.lerp2)); + } + ,lerp2: function() { + this.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0.5),40,$bind(this,this.lerp1)); + } + ,setAnimation: function(anim_id,offX,offY) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + com_davidmaletz_tiles_render_PlayAnimation.prototype.setAnimation.call(this,anim_id,-0.5,-0.5); + } + ,advanceFrame: function(frames) { + if(!this.hasTrack(com_davidmaletz_lerp_PositionKeyframe)) { + this.tiles--; + if(this.tiles == 0) { + this.tiles = 32; + if(Math.random() < 0.5) { + this.set_scaleX(-this.get_scaleX()); + } + } + var tx = this.get_x() - com_davidmaletz_tiles_Tile.SIZE * this.get_scaleX(); + var ix = Math.round(tx / com_davidmaletz_tiles_Tile.SIZE); + if(ix < this.fromX || ix > this.toX) { + this.tiles = 32; + this.set_scaleX(-this.get_scaleX()); + tx = this.get_x() - com_davidmaletz_tiles_Tile.SIZE * this.get_scaleX(); + } + this.lerp(new com_davidmaletz_lerp_PositionKeyframe(tx,this.get_y()),40); + } + com_davidmaletz_tiles_render_PlayAnimation.prototype.advanceFrame.call(this,frames); + } + ,__class__: com_davidmaletz_mining_world_types_Random +}); +var com_davidmaletz_mining_world_vehicle_Ability = function(e,o) { + this.xml = e; + this.object = o; + this.hotkey = com_davidmaletz_mining_Main.parseInt(e.get("hotkey")) - 1; + this.icon = e.get("icon"); + this.animation = e.get("animation"); + this.cost = com_davidmaletz_mining_Main.parseInt(e.get("cost")); +}; +$hxClasses["com.davidmaletz.mining.world.vehicle.Ability"] = com_davidmaletz_mining_world_vehicle_Ability; +com_davidmaletz_mining_world_vehicle_Ability.__name__ = ["com","davidmaletz","mining","world","vehicle","Ability"]; +com_davidmaletz_mining_world_vehicle_Ability.prototype = { + hotkey: null + ,object: null + ,icon: null + ,animation: null + ,cost: null + ,xml: null + ,canRun: function(vars) { + if(!(!this.xml.exists("available"))) { + return com_davidmaletz_faengfl_EventHandler._conditionMet(this.xml.get("available"),vars); + } else { + return true; + } + } + ,run: function(p,v,onComplete) { + if(v == null) { + var vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(p); + if(this.canRun(vars)) { + new com_davidmaletz_mining_npc_NPCEventHandler(this.xml.elements(),p,this.object,onComplete,vars).runAll(); + } + } else if(this.cost > 0 && v.getFuel() < this.cost) { + v.showWarning(com_fancyfish_faeng_common_Lang.getText("warning",v.fuelName)); + } else if(this.canRun(v.vars)) { + if(this.cost > 0) { + v.useFuel(this.cost); + } + new com_davidmaletz_mining_npc_NPCEventHandler(this.xml.elements(),p,v,onComplete,v.vars).runAll(); + } + } + ,__class__: com_davidmaletz_mining_world_vehicle_Ability +}; +var com_davidmaletz_mining_world_vehicle_BGVehicleRenderer = function(v,i) { + this.fps = com_davidmaletz_mining_enemy_AttackRenderer.getFPS(i.xml,15); + var t = com_davidmaletz_tiles_Tile.get(i.tile); + com_davidmaletz_tiles_render_PlayAnimation.call(this,t,v.getBGAnim(),this.fps,true); + this.vehicle = v; + this.equipmentSprite = new openfl_display_Sprite(); + this.equipmentSprite.set_x(t.getWidth() * 0.5); + this.equipmentSprite.set_y(t.getHeight() * 0.5); + this.addChild(this.equipmentSprite); +}; +$hxClasses["com.davidmaletz.mining.world.vehicle.BGVehicleRenderer"] = com_davidmaletz_mining_world_vehicle_BGVehicleRenderer; +com_davidmaletz_mining_world_vehicle_BGVehicleRenderer.__name__ = ["com","davidmaletz","mining","world","vehicle","BGVehicleRenderer"]; +com_davidmaletz_mining_world_vehicle_BGVehicleRenderer.create = function(v,i) { + if(Std["is"](v,com_davidmaletz_mining_world_vehicle_Vehicle)) { + return new com_davidmaletz_mining_world_vehicle_BGVehicleRenderer(v,i); + } else { + return new com_davidmaletz_tiles_render_PlayAnimation(com_davidmaletz_tiles_Tile.get(i.tile),v.getBGAnim(),com_davidmaletz_mining_enemy_AttackRenderer.getFPS(i.xml,15),true); + } +}; +com_davidmaletz_mining_world_vehicle_BGVehicleRenderer.__super__ = com_davidmaletz_tiles_render_PlayAnimation; +com_davidmaletz_mining_world_vehicle_BGVehicleRenderer.prototype = $extend(com_davidmaletz_tiles_render_PlayAnimation.prototype,{ + vehicle: null + ,equipmentSprite: null + ,fps: null + ,init: function(e) { + com_davidmaletz_tiles_render_PlayAnimation.prototype.init.call(this,e); + var slot = this.vehicle.equipment.getSlots(); + while(slot.hasNext()) { + var slot1 = slot.next(); + this.vehicle.equipment.get(slot1).addEventListener("updated",$bind(this,this.changeEquipment)); + } + this.changeEquipment(null); + this.vehicle.bg = this; + } + ,destroy: function(e) { + com_davidmaletz_tiles_render_PlayAnimation.prototype.destroy.call(this,e); + var slot = this.vehicle.equipment.getSlots(); + while(slot.hasNext()) { + var slot1 = slot.next(); + this.vehicle.equipment.get(slot1).removeEventListener("updated",$bind(this,this.changeEquipment)); + } + this.finishTrack(com_davidmaletz_mining_world_MoveKeyframe); + if(this.vehicle.bg == this) { + this.vehicle.bg = null; + } + } + ,changeEquipment: function(e) { + com_davidmaletz_faengfl_FaengFL.removeAllChildren(this.equipmentSprite); + var slot = this.vehicle.equipment.getSlots(); + while(slot.hasNext()) { + var slot1 = slot.next(); + var e1 = this.vehicle.equipment.getItem(slot1); + if(e1 != null && com_davidmaletz_tiles_Tile.exists(e1.info.id)) { + this.equipmentSprite.addChild(new com_davidmaletz_tiles_render_PlayAnimation(com_davidmaletz_tiles_Tile.get(e1.info.id),e1.info.getEquipAnim(e1.getNameStr(),"idle"),this.fps,true,null,-0.5,-0.5)); + } + } + } + ,__class__: com_davidmaletz_mining_world_vehicle_BGVehicleRenderer +}); +var com_davidmaletz_mining_world_vehicle_Vehicle = function(info,x,y) { + this.overEnemies = null; + this.overStructure = null; + this.overObjects = []; + this.dronePrevY = 0; + this.dronePrevX = 0; + this.__drone_area_id = -1; + this.droneY = 0; + this.droneX = 0; + this.blocking = false; + this._offsetY = 0; + com_davidmaletz_mining_world_RideableObject.call(this,info,x,y); + this.light = null; + if(this.fixSize()) { + if(this._width < com_davidmaletz_tiles_Tile.SIZE) { + this._width = com_davidmaletz_tiles_Tile.SIZE; + } + if(this._height < com_davidmaletz_tiles_Tile.SIZE) { + this._height = com_davidmaletz_tiles_Tile.SIZE; + } + } + this.vertical = info.xml.get("type") != "car"; + this.inventory = new com_davidmaletz_mining_item_Inventory(); + this.addExp = info.xml.get("addExp") != "false"; + this.offX = info.xml.exists("offsetX") ? com_davidmaletz_mining_Main.parseInt(info.xml.get("offsetX")) : 0; + this.offY = info.xml.exists("offsetY") ? com_davidmaletz_mining_Main.parseInt(info.xml.get("offsetY")) : 0; + this.horizontal = true; + this.aboveGround = info.xml.get("underground") == "false"; + this.fullInventory = new com_davidmaletz_mining_item_CompoundInventory(this.isDrone() ? [] : [this.inventory]); + this.equipment = com_davidmaletz_mining_item_EquipmentSlots.fromXML(info.xml); + this.equipment.addEventListener($bind(this,this.changeEquipment)); + this.equipment.addStateEventListener($bind(this,this.changeEqState)); + this._canDismount = info.xml.get("canDismount") != "false"; + this._allowFamiliar = info.xml.exists("allowFamiliar") ? info.xml.get("allowFamiliar") != "false" : this._canDismount; + if(this.isDrone()) { + this.hasO2 = true; + this._allowFamiliar = false; + } + this.flight_height = new com_fancyfish_faeng_common_mutable_Mutable(); + this.max_depth = new com_fancyfish_faeng_common_mutable_Mutable(); + this.efficiency = new com_fancyfish_faeng_common_mutable_Mutable(); + this.resetParams(); + this.fuelName = info.xml.exists("fuelName") ? info.xml.get("fuelName") : this.isPowered() ? "power" : "fuel"; + this.fuel = this.isPowered() ? this.getMaxFuel() : 0; + this.hitDamage = info.xml.exists("hitDamage") ? com_davidmaletz_mining_Main.parseInt(info.xml.get("hitDamage")) : 0; + this.runEvent(null,"init"); + this.inventory.addEventListener("item_added",$bind(this,this.item_added)); + this.mine_power = info.xml.exists("mine") ? com_davidmaletz_mining_Main.parseInt(info.xml.get("mine")) : 0; + this.mine_speed = info.xml.exists("mine_speed") ? com_davidmaletz_mining_Main.parseInt(info.xml.get("mine_speed")) : 1; + this.mine_fuel = info.xml.exists("mine_fuel") ? com_davidmaletz_mining_Main.parseInt(info.xml.get("mine_fuel")) : 1; +}; +$hxClasses["com.davidmaletz.mining.world.vehicle.Vehicle"] = com_davidmaletz_mining_world_vehicle_Vehicle; +com_davidmaletz_mining_world_vehicle_Vehicle.__name__ = ["com","davidmaletz","mining","world","vehicle","Vehicle"]; +com_davidmaletz_mining_world_vehicle_Vehicle.__interfaces__ = [com_davidmaletz_mining_world_LabelObject,com_davidmaletz_mining_world_IEquippable,com_davidmaletz_mining_structure_IFuelable]; +com_davidmaletz_mining_world_vehicle_Vehicle.isM = function(a,b,c) { + if(a == b || a == c) { + return true; + } else if(Std["is"](a,com_fancyfish_faeng_common_mutable_MutableTemplateStatic)) { + return (js_Boot.__cast(a , com_fancyfish_faeng_common_mutable_MutableTemplateStatic)).mutable == b; + } else if(Std["is"](a,com_fancyfish_faeng_common_mutable_MutableTemplate)) { + return (js_Boot.__cast(a , com_fancyfish_faeng_common_mutable_MutableTemplate)).mutable == b; + } else { + return false; + } +}; +com_davidmaletz_mining_world_vehicle_Vehicle.__super__ = com_davidmaletz_mining_world_RideableObject; +com_davidmaletz_mining_world_vehicle_Vehicle.prototype = $extend(com_davidmaletz_mining_world_RideableObject.prototype,{ + player: null + ,fullInventory: null + ,equipment: null + ,_offsetY: null + ,vertical: null + ,inventory: null + ,flight_height: null + ,max_depth: null + ,efficiency: null + ,horizontal: null + ,aboveGround: null + ,fuel: null + ,offX: null + ,offY: null + ,fuelName: null + ,name: null + ,hitDamage: null + ,_allowFamiliar: null + ,_canDismount: null + ,blocking: null + ,addExp: null + ,droneArea: null + ,droneX: null + ,droneY: null + ,__drone_area_id: null + ,dronePrevArea: null + ,dronePrevX: null + ,dronePrevY: null + ,playFuelSFX: function() { + this.playSound("fuel"); + } + ,getWatchInventory: function() { + return this.inventory; + } + ,getDefense: function(element,behind,critical,useDurability) { + return com_davidmaletz_mining_item_Equipment.get(com_davidmaletz_mining_world_RideableObject.prototype.getDefense.call(this,element,behind,critical,useDurability),this.name,"defense"); + } + ,getDefenseElement: function() { + var e = this.info.xml.get("element"); + var m = com_davidmaletz_mining_item_ItemInfo.getMod(this.name); + if(m != null && m.exists("element")) { + e = m.get("element"); + } + return com_davidmaletz_mining_world_Element.get(e); + } + ,updateModifier: function() { + if(this.renderer != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_world_vehicle_VehicleRenderer)).updateModifier(); + } + } + ,item_added: function(e) { + if(this.player != null && e.delta != 0 && e.delta == e.count) { + this.player.checkSeenItem(e.item); + } + } + ,showTooltip: function(key,msg) { + com_davidmaletz_mining_world_RideableObject.prototype.showTooltip.call(this,key,msg); + if(msg == com_fancyfish_faeng_common_Lang.getText("vehicle","dismount")) { + this.tooltip.set_scaleX(this.tooltip.set_scaleY(0.5)); + } + } + ,tileMap: null + ,getTileById: function(id) { + if(this.tileMap == null) { + return null; + } else { + return this.tileMap.get(id); + } + } + ,fixSize: function() { + if(this.info.id != "ag.warrior") { + return this.info.xml.get("allowUndersize") != "true"; + } else { + return false; + } + } + ,resetShape: function() { + var t = com_davidmaletz_tiles_Tile.get(this.getAttackInfo().tile); + var w = t.getWidth(); + var h = t.getHeight(); + if(this.fixSize()) { + if(w < com_davidmaletz_tiles_Tile.SIZE) { + w = com_davidmaletz_tiles_Tile.SIZE; + } + if(h < com_davidmaletz_tiles_Tile.SIZE) { + h = com_davidmaletz_tiles_Tile.SIZE; + } + } + this.reshape(w,h); + } + ,canJump: function() { + return this.info.xml.get("canJump") == "true"; + } + ,useEquipment: function(tool,projectile) { + if(!this.equipment.isEquipped(tool.info) && !this.equipment.canEquip(this,tool.info.xml.get("slot"),tool.info)) { + this.player.noEquip(tool); + return false; + } + if(projectile == null) { + projectile = tool.getDefaultProjectile(); + } + if(projectile != null && !this.fullInventory.addItems(projectile,-1)) { + var map = new haxe_ds_StringMap(); + map.set("{weapon}",tool.info.getDisplay(tool.getNameStr())); + map.set("{projectile}",projectile.getDisplay(null)); + this.showWarning(new com_fancyfish_faeng_common_mutable_MutableTemplateStatic(com_fancyfish_faeng_common_Lang.getText("warning","no_projectiles"),map)); + return false; + } + var eq = js_Boot.__cast(tool.info , com_davidmaletz_mining_item_Equipment); + if(this.getFuel() < eq.storageCost) { + this.showWarning(com_fancyfish_faeng_common_Lang.getText("warning",this.fuelName)); + return false; + } + if(eq.storageCost > 0) { + this.useFuel(eq.storageCost); + } + com_davidmaletz_faengfl_adv_sound_Sound.play(com_davidmaletz_faengfl_adv_sound_Sound.resolveDefault(tool.info.xml,"swing")); + return true; + } + ,getFuelName: function() { + return this.fuelName; + } + ,canCritical: function() { + return this.info.xml.get("canCritical") != "false"; + } + ,modifyAttack: function(h,attacker) { + if(this.player == null) { + return h; + } else { + return this.player.getDifficulty().modifyDamage(h); + } + } + ,loseHealth: function(h,flags,attacker,attackElement,scaleX,playSFX) { + if(playSFX == null) { + playSFX = true; + } + if(scaleX == null) { + scaleX = 0; + } + if(flags == null) { + flags = 0; + } + if(this.renderer != null && attacker != null && this.blocking && (this.info.xml.get("block_behind") == "true" || this.renderer.get_scaleX() != scaleX) && !com_davidmaletz_mining_world_Object.isFlagIgnoreArmor(flags)) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_world_vehicle_VehicleRenderer)).onBlocked(this.renderer.get_scaleX() == scaleX); + if(this.hasControl()) { + this.onBlocked(attacker,playSFX,false); + } + return 0; + } + if(!this.hasControl()) { + if(this.isMounted()) { + this.dispatchEvent(new com_davidmaletz_mining_LoseHealthEvent("lose_health",attacker,h,flags,attackElement,scaleX,playSFX)); + } + return 0; + } + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + var ret = com_davidmaletz_mining_world_RideableObject.prototype.loseHealth.call(this,h,flags,attacker,attackElement,scaleX,playSFX); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + return ret; + } + ,hasFuel: function() { + return this.fuel > 0; + } + ,getMultiplier: function() { + return 1; + } + ,healthRestoringItem: function(item) { + return this.getInfo().getRepairAmount(item.id) > 0; + } + ,autoHeal: function(health) { + if(this.player == null || !com_davidmaletz_mining_Player.AUTO_HEAL || this.health == this.getMaxHealth()) { + return 0; + } + var info = this.getInfo(); + var inv = this.getInventory(); + var i = inv.getItems($bind(this,this.healthRestoringItem)); + while(i.hasNext()) { + var i1 = i.next(); + var f = i1.item; + var hp = info.getRepairAmount(f.id); + if(health + hp > 0) { + inv.addItems(f,-1); + var msg = com_fancyfish_faeng_common_Lang.getText("common","auto_eat").get(); + msg = StringTools.replace(msg,"{count}","1"); + msg = StringTools.replace(msg,"{item}",f.getDisplay(null)); + com_davidmaletz_mining_ui_NotificationQueue.showNotification(new com_davidmaletz_faengfl_ui_FormattedTooltip(0,0,msg,false,16777215,-1442840576)); + return com_fancyfish_faeng_common_Utils.min(this.health + hp,this.getMaxHealth()) + health - this.health; + } + } + return 0; + } + ,updateFuel: function(d) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = com_davidmaletz_faengfl_TouchAdapter.__is_action_key || this.player != null && this.player == com_davidmaletz_mining_Main.getLocalPlayer(); + this.dispatchEvent(new com_davidmaletz_faengfl_events_IntEvent("update_fuel",d)); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + ,useFuel: function(ct) { + if(ct == null) { + ct = 1; + } + var f = this.fuel - ct; + if(f < 0) { + f = 0; + } + if(f != this.fuel) { + var d = f - this.fuel; + this.fuel = f; + this.updateFuel(d); + } + } + ,getName: function() { + if(this.name == null) { + return null; + } + var i = this.name.indexOf("&") + 1; + if(i == this.name.length) { + return null; + } else { + return HxOverrides.substr(this.name,i,null); + } + } + ,isPowered: function() { + if(this.getMaxFuel() > 0 && this.info.xml.get("useBatteries") != "false" && !this.info.xml.elementsNamed("fuel").hasNext()) { + return !this.info.xml.elementsNamed("recipe").hasNext(); + } else { + return false; + } + } + ,getFuel: function() { + return this.fuel; + } + ,spawnVehicle: function(r) { + com_davidmaletz_mining_ui_CraftingWindow._spawnVehicle(com_davidmaletz_mining_Main.getLocalPlayer(),this.info.xml,this,r); + } + ,getUsableFuel: function() { + return this.fuel; + } + ,getMaxFuel: function() { + return this.getInfo().fuel; + } + ,addFuel: function(f) { + f += this.fuel; + var max = this.getMaxFuel(); + if(f > max) { + f = max; + } + if(f != this.fuel) { + var d = f - this.fuel; + this.fuel = f; + this.updateFuel(d); + } + } + ,setFuel: function(f) { + if(this.fuel != f) { + var d = f - this.fuel; + this.fuel = f; + this.updateFuel(d); + } + } + ,refuel: function() { + this.addFuel(this.getMaxFuel() - this.getFuel()); + } + ,getFuelPercent: function() { + return this.fuel / this.getMaxFuel(); + } + ,canAddFuel: function() { + return this.fuel < this.getMaxFuel(); + } + ,isBack: function() { + return true; + } + ,getInfo: function() { + return this.info; + } + ,createRenderer: function() { + if(this.player != null) { + if(this._allowFamiliar) { + this.player.familiar.init(); + } else { + this.player.familiar.destroy(); + } + } + return new com_davidmaletz_mining_world_vehicle_VehicleRenderer(this); + } + ,attackPower: function(attack,cut,spirit,element,player) { + if(!com_davidmaletz_mining_Player.PVP && player || this.player == null) { + return 0; + } else { + return com_davidmaletz_mining_world_RideableObject.prototype.attackPower.call(this,attack,cut,spirit,element,player); + } + } + ,getWeight: function() { + var w = this.inventory.getWeight() + (this.player == null ? 0 : this.player.inventory.getWeight()); + if(this.interior != null) { + var o = this.interior.objects.iterator(); + while(o.hasNext()) { + var o1 = o.next(); + if(o1 == this) { + throw new js__$Boot_HaxeError("Vehicle cannot be inside itself!"); + } else { + w += o1.getWeight(); + } + } + } + return w; + } + ,getAddWeight: function(p) { + var w = 0; + if(this.interior != null) { + var o = this.interior.objects.iterator(); + while(o.hasNext()) { + var o1 = o.next(); + if(o1 != p) { + w += o1.getWeight(); + } + } + } + return w; + } + ,isOverweight: function() { + var w = this.getInfo().max_weight.get(); + if(w > 0) { + return this.getWeight() > w; + } else { + return false; + } + } + ,showWarning: function(m) { + if(this.player != null) { + this.player.showWarning(m); + } + } + ,onDeath: function(killer,element) { + com_davidmaletz_mining_world_RideableObject.prototype.onDeath.call(this,killer,element); + if(this.player != null) { + var f = $bind(this,this.destroy); + var a1 = killer; + var a2 = element; + var tmp = function() { + f(a1,a2); + }; + this.runEvent(this.player,"onDeath",tmp); + } else { + this.destroy(killer,element); + } + } + ,destroy: function(killer,element) { + var _gthis = this; + if(this.area != null) { + if(this.player != null) { + this.droneDismount(function() { + _gthis.doDismount(); + _gthis.area.removeObject(_gthis,killer,element); + }); + } else { + this.area.removeObject(this,killer,element); + } + } + } + ,getAction: function(p) { + if(this.info.xml.get("tooltipVehicle") != "true" && p.vehicle != null) { + return null; + } + var i = this.info.xml.elementsNamed("tooltip"); + var hadNext = i.hasNext(); + if(hadNext) { + com_davidmaletz_mining_npc_NPCEventHandler.setPlayerVariables(this.vars,p); + } + while(i.hasNext()) { + var n = i.next(); + if(n.exists("if") && !com_davidmaletz_faengfl_EventHandler._conditionMet(n.get("if"),this.vars)) { + continue; + } + var section = n.get("section"); + var id = n.get("id"); + if(section == null) { + section = "structure.tooltip"; + } + if(id == null) { + id = Std.string(com_davidmaletz_faengfl_EventHandler.execute(com_fancyfish_faeng_common_Lang.escape(n.firstChild().get_nodeValue()),this.vars)); + } + if(com_fancyfish_faeng_common_Lang.hasText(section,id)) { + return com_fancyfish_faeng_common_Lang.getText(section,id); + } else { + return null; + } + } + var t = com_fancyfish_faeng_common_Lang.getTextFromTitle(this.info.xml.get("tooltip")); + if(t == null) { + return this.getDefaultTooltip(); + } else { + return t; + } + } + ,getDefaultTooltip: function() { + return com_fancyfish_faeng_common_Lang.getText("structure.tooltip","operate"); + } + ,canDismount: function() { + return this._canDismount; + } + ,gui: null + ,destroyGUI: function() { + if(this.gui != null) { + this.gui.destroy(); + this.hideTooltip(); + } + } + ,isMounted: function() { + return this.player != null; + } + ,hasControl: function() { + if(this.isMounted()) { + return this.player == com_davidmaletz_mining_Main.getLocalPlayer(); + } else { + return false; + } + } + ,dismountPos: function(player) { + player.setPosition(Math.round(this.getCenterX() - com_davidmaletz_tiles_Tile.SIZE * 0.5),this.yTile); + } + ,playAnim: function(anim,onComplete) { + if(this.renderer != null) { + var r = js_Boot.__cast(this.renderer , com_davidmaletz_mining_world_vehicle_VehicleRenderer); + anim = this.getAnim(anim); + if(com_davidmaletz_tiles_TileAnimation.exists(anim)) { + var tmp = onComplete == null ? $bind(r,r.playIdle) : function(p) { + onComplete(); + r.playIdle(p); + }; + r.playAnimation(anim,false,tmp); + } else { + r.playIdle(r); + if(onComplete != null) { + onComplete(); + } + } + } else if(onComplete != null) { + onComplete(); + } + } + ,getBGAnim: function() { + if(this.info.xml.get("swimAnim") == "true" && this.isUnderwater()) { + return this.getAnim("swim"); + } else { + return this.getAnim(this._isFlying() ? "hover" : "idle"); + } + } + ,onDismount: function(p) { + if(p == com_davidmaletz_mining_Main.getLocalPlayer()) { + this.moveToFront(); + } + this.fullInventory.destroy(); + var ar = this.fullInventory.inventories; + com_fancyfish_faeng_common_Utils.clear(ar); + if(!this.isDrone()) { + ar.push(this.inventory); + } + this.fullInventory.init(); + this.playAnim("dismount"); + if(this.renderer != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_world_vehicle_VehicleRenderer)).onDismount(); + } + if(this.health > 0) { + this.runEvent(p,"dismount"); + } + this.dispatchEvent(new openfl_events_Event("update_mount")); + } + ,set_droneArea: function(a) { + if(this.droneArea != null) { + this.droneArea.dronePlayers--; + } + this.droneArea = a; + if(this.droneArea != null) { + this.droneArea.dronePlayers++; + } + return a; + } + ,checkDroneArea: function() { + if(this.droneArea != null && this.droneArea.vehicle != null && this.droneArea.vehicle.area == null) { + this.droneX = this.droneArea.vehicle.xPos; + this.droneY = this.droneArea.vehicle.yTile; + this.set_droneArea(this.droneArea.vehicle.destroyedArea); + } + } + ,fakeDismount: function() { + this.equipment.destroy(this,false); + this.player.equipment.destroy(this.player,false); + this.player.set_vehicle(null); + this.destroyGUI(); + this.clearOverlap(); + this.checkDroneArea(); + var i = this.getInfo(); + if(i.interior != null && this.health > 0) { + this.player.setPosition(i.interior.operateX,i.interior.operateY); + this.getInterior(this.player.areas,i).addObject(this.player); + } else if(this.droneArea == null) { + this.dismountPos(this.player); + if(this.area != null) { + this.area.addObject(this.player); + } + } else { + this.player.setPosition(this.droneX,this.droneY); + this.droneArea.addObject(this.player); + this.set_droneArea(null); + this.player.prevLocation = this.dronePrevArea; + this.player.prevX = this.dronePrevX; + this.player.prevY = this.dronePrevY; + } + var p = this.player; + this.player = null; + if(p.area != null) { + p.location = p.area.id; + } + this.onDismount(p); + p.getGUI().destroy(); + } + ,doDismount: function(instant) { + if(instant == null) { + instant = false; + } + if(this.area == null) { + return; + } + this.equipment.destroy(this,false); + var x = 0.0; + var y = 0.0; + if(this.area.renderer != null) { + if(com_davidmaletz_mining_Main._getScale() != 1) { + com_davidmaletz_mining_Main.setGameScale(1); + if(this.renderer != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_world_vehicle_VehicleRenderer)).updateScroll(true); + } + } + x = this.area.renderer.get_x(); + y = this.area.renderer.get_y(); + } + this.player.equipment.destroy(this.player,false); + this.player.set_vehicle(null); + this.destroyGUI(); + this.clearOverlap(); + this.checkDroneArea(); + if(this.droneArea == null) { + this.dismountPos(this.player); + this.area.addObject(this.player); + } else { + if(this.droneArea != this.area) { + instant = true; + this.player.doTeleport(null,this.droneX,this.droneY,false,this.droneArea,false); + } else { + this.player.setPosition(this.droneX,this.droneY); + this.droneArea.addObject(this.player); + } + this.set_droneArea(null); + this.player.prevLocation = this.dronePrevArea; + this.player.prevX = this.dronePrevX; + this.player.prevY = this.dronePrevY; + } + if(!instant) { + var r = this.player.renderer; + if(r != null) { + r.set_alpha(0); + r.lerp(new com_davidmaletz_lerp_AlphaKeyframe(),10); + } + } + var p = this.player; + this.player = null; + if(this.area.renderer != null) { + if(instant) { + var r1 = p.renderer; + if(r1 != null) { + (js_Boot.__cast(r1 , com_davidmaletz_mining_renderer_PlayerObjectRenderer)).updateScroll(true); + } + this.area.renderer.finishTrack(com_davidmaletz_lerp_YKeyframe); + } else { + this.smoothCamera(x,y); + } + } + if(instant && this.renderer != null) { + var r2 = js_Boot.__cast(this.renderer , com_davidmaletz_mining_world_vehicle_VehicleRenderer); + r2.playIdle(r2); + } + this.onDismount(p); + } + ,dismountInterior: function() { + var p = this.player; + this.doDismount(true); + if(this.getInfo().interior != null && this.health > 0) { + this.enter(p,true); + } + } + ,__dismount: function(instant) { + if(this.player == null) { + return; + } + if(this.getInfo().interior == null || this.health <= 0) { + this.doDismount(instant); + } else { + new com_davidmaletz_faengfl_transition_EllipseFade($bind(this,this.dismountInterior),30,0,0); + } + } + ,droneDismount: function(func) { + this.checkDroneArea(); + if(this.droneArea != null && this.droneArea != this.area) { + new com_davidmaletz_faengfl_transition_FadeOut(func,15); + } else { + func(); + } + } + ,dismount: function(instant) { + if(instant == null) { + instant = false; + } + var _gthis = this; + if(this.player == null) { + return; + } + var func = function() { + var f = $bind(_gthis,_gthis.__dismount); + var a1 = instant; + var func1 = function() { + f(a1); + }; + _gthis.runEvent(_gthis.player,"onDismount",func1); + }; + this.droneDismount(func); + } + ,getTitle: function(p) { + com_davidmaletz_mining_npc_NPCEventHandler.setPlayerVariables(this.vars,p); + return this.info.getTitle(this.vars); + } + ,manageInventory: function(p) { + if(p == null) { + p = this.player; + } + if(p != null) { + var c = com_davidmaletz_mining_Main.getContainer(); + if(this.isDrone()) { + c.addDisplay(new com_davidmaletz_mining_ui_WeightInventoryWindow(p,c),2); + } else { + c.addDisplay(new com_davidmaletz_mining_ui_VehicleInventory(p,this,c),2); + } + } + } + ,manageEquipment: function(p) { + if(p == null) { + p = this.player; + } + if(p != null) { + var c = com_davidmaletz_mining_Main.getContainer(); + c.addDisplay(new com_davidmaletz_mining_ui_VehicleEquipment(this,p == this.player ? this : new com_davidmaletz_mining_world_vehicle__$Vehicle_VEquip(this,p),c),2); + } + } + ,object: null + ,structure: null + ,overObject: function(o) { + if(this.object == o) { + return; + } + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = this.hasControl(); + if(this.object != null) { + this.object.onExit(this.player); + this.object.onOut(this.player); + this.object = null; + } + if(o != null) { + this.object = o; + this.object.onEnter(this.player); + this.object.onOver(this.player); + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + ,_overStructure: function(s) { + if(this.structure == s) { + return; + } + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = this.hasControl(); + if(this.structure != null) { + this.structure.onExit(this.player); + this.structure = null; + } + if(s != null) { + this.structure = s; + this.structure.onEnter(this.player); + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + ,isCollectable: function(o) { + if(this.player != null) { + if(!(this.info.xml.get("accessObject") == "true" && Std["is"](o,com_davidmaletz_mining_world_ItemObject))) { + return com_davidmaletz_mining_world_vehicle_Vehicle.isM(o.getAction(this.player),com_fancyfish_faeng_common_Lang.getText("object.tooltip","collect"),com_fancyfish_faeng_common_Lang.getText("actions","collect")); + } else { + return true; + } + } else { + return false; + } + } + ,canInteract: function(o,l) { + if(this.getInfo().collectBounds != null && o.get_alpha() > 0 && o != this) { + return this.isCollectable(o); + } else { + return false; + } + } + ,canInteractStructure: function(s) { + return false; + } + ,dismountPriority: function() { + return false; + } + ,getInteractBounds: function() { + var r = this.getBounds(); + var collectBounds = this.getInfo().collectBounds; + if(collectBounds != null) { + if(this.getFacing() < 0) { + r.x = r.x + this._width - collectBounds.x - collectBounds.width; + } else { + r.x += collectBounds.x; + } + r.y += collectBounds.y; + r.width = collectBounds.width; + r.height = collectBounds.height; + } + return r; + } + ,checkObjectStructure: function() { + if(this.area != null && this.player != null && this.renderer != null) { + if(this.dismountPriority() && this.canDismount()) { + this.overObject(null); + this._overStructure(null); + if(this.tooltip == null || this.tooltip.message != com_fancyfish_faeng_common_Lang.getText("vehicle","dismount")) { + this.showDismount(); + } + return true; + } + var o = this.area.getActionObject(this.getInteractBounds(),this.player,$bind(this,this.canInteract)); + if(o != null) { + this.overObject(o); + this._overStructure(null); + this.hideTooltip(); + return true; + } else { + this.overObject(null); + var s = this.getStructure(this.xPos,this.yTop()); + if(s != null && this.canInteractStructure(s)) { + this._overStructure(s); + this.hideTooltip(); + return true; + } else { + this._overStructure(null); + } + } + } else { + this.overObject(null); + this._overStructure(null); + } + return false; + } + ,checkTooltip: function() { + if(this.checkObjectStructure()) { + return; + } + if(this.canDismount()) { + if(this.tooltip == null || this.tooltip.message != com_fancyfish_faeng_common_Lang.getText("vehicle","dismount")) { + this.showDismount(); + } + } else { + this.hideTooltip(); + } + } + ,showDismount: function() { + if(this.area != null) { + this.showTooltip("select",com_fancyfish_faeng_common_Lang.getText("vehicle","dismount")); + } + } + ,showGUI: function() { + if(this.gui != null && this.gui.player != this.player) { + this.gui.destroy(); + this.gui = null; + } + if(this.gui == null) { + this.gui = new com_davidmaletz_mining_ui_VehicleGUI(this.player,this); + } + this.gui.init(); + this.checkTooltip(); + } + ,addedToArea: function() { + com_davidmaletz_mining_world_RideableObject.prototype.addedToArea.call(this); + this.onPositionChanged(); + if(this.hasControl()) { + this.showGUI(); + } + var p = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p != null && p.area != null && p.area.renderer != null && p.area.id == this.area.id + ".station") { + var s = this.getStation(); + p.area.renderer.parallax_back.addChildAt(s,0); + p.area.renderer.loopSprites.push(s); + } + } + ,clearOverlap: function() { + var _g = 0; + var _g1 = this.overObjects; + while(_g < _g1.length) { + var o = _g1[_g]; + ++_g; + o.onOut(this.player); + } + com_fancyfish_faeng_common_Utils.clear(this.overObjects); + if(this.overStructure != null) { + this.overStructure.onOut(this.player); + this.overStructure = null; + } + } + ,handleSecond: function() { + if(this.player != null) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = this.hasControl(); + if(this.hasControl()) { + this.player.stats.handleSecond(); + this.player.info.runEvent(this.player,"handleSecond",this.player); + } + this.runEvent(this.player,"second"); + var _g = 0; + var _g1 = this.overObjects; + while(_g < _g1.length) { + var o = _g1[_g]; + ++_g; + o.overlapSecond(this.player); + } + this.updateMusic(); + var slot = this.equipment.getSlots(); + while(slot.hasNext()) { + var slot1 = slot.next(); + var e = this.equipment.getItem(slot1); + if(e != null) { + e.info.runEvent("handleSecond",this.player,e); + } + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + } + ,removedFromArea: function(area) { + com_davidmaletz_mining_world_RideableObject.prototype.removedFromArea.call(this,area); + this.destroyGUI(); + if(this.player != null) { + this.clearOverlap(); + } + if(this.station != null) { + com_davidmaletz_faengfl_FaengFL.remove(this.station); + this.station = null; + } + } + ,changePosition: function(toX,toY) { + if(this.area != null) { + com_davidmaletz_mining_world_RideableObject.prototype.changePosition.call(this,toX,toY); + } + if(this.station != null) { + if(this.station.parent == null) { + this.station = null; + } else { + this.station.set_x(Math.round(this.getCenterX()) + this.offX + toX - this.xPos); + this.station.set_y(Math.round(this.getCenterY() + this._offsetY) + this.offY + toY - this.yTop()); + } + } + } + ,getStructure: function(x,y,issect) { + if(issect == null) { + issect = 0; + } + if(this.area == null) { + return null; + } else { + var b = this.getBounds(); + b.x = x; + b.y = y; + return this.area.getStructure(b,true,null,issect); + } + } + ,overObjects: null + ,overStructure: null + ,overEnemies: null + ,objectOverlapCheck: function() { + if(this.area != null) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = this.hasControl(); + var x = this.xPos; + var y = this.yTop(); + this._objectOverlapCheck(x,y); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + } + ,_objectOverlapCheck: function(x,y) { + var _gthis = this; + var ar = []; + var b = this.getBounds(); + var enemies = null; + b.x = x; + b.y = y; + this.area.getObjects(b,function(o,rect) { + if(o.info.xml.get("overlapVehicle") == "true") { + ar.push(o); + if(_gthis.overObjects.indexOf(o) == -1) { + o.onOver(_gthis.player); + if(_gthis.area == null) { + return true; + } + } + } + if(o.info.xml.get("overlapDamage") != "false" && _gthis.hitDamage > 0 && o.attackPower(_gthis.hitDamage,0,0,null,true) > 0) { + if(enemies == null) { + enemies = [o]; + } else { + enemies.push(o); + } + } + return false; + }); + var _g = 0; + var _g1 = this.overObjects; + while(_g < _g1.length) { + var o1 = _g1[_g]; + ++_g; + if(ar.indexOf(o1) == -1) { + o1.onOut(this.player); + } + } + this.overObjects = ar; + if(enemies != null && this.player != null && this.player == com_davidmaletz_mining_Main.getLocalPlayer()) { + var _g2 = 0; + while(_g2 < enemies.length) { + var e = enemies[_g2]; + ++_g2; + if(this.overEnemies == null || this.overEnemies.indexOf(e) == -1) { + var dmg = e.loseHealth(this.hitDamage,0,this.player,null,this.getFacing()); + if(this.addExp) { + this.player.addAttackExp(e,dmg,Std["is"](e,com_davidmaletz_mining_enemy_Enemy) ? (js_Boot.__cast(e , com_davidmaletz_mining_enemy_Enemy)).getMinDefense() : 0); + } + } + } + } + this.overEnemies = enemies; + } + ,updateOverlap: function(x,y) { + if(this.area == null) { + return; + } + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = this.hasControl(); + this._objectOverlapCheck(x,y); + var s = this.getStructure(x,y); + if(s != null && s.info.xml.get("overlapVehicle") != "true") { + s = null; + } + if(this.overStructure != s) { + if(this.overStructure != null) { + this.overStructure.onOut(this.player); + } + this.overStructure = s; + if(s != null) { + s.onOver(this.player); + } + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + ,onPositionChanged: function() { + if(this.hasControl()) { + this.player.__updatePos(); + } + var x = this.xPos; + var y = this.yTop(); + var s = this.getStructure(x,y,0.25); + if(s != null && s.info.playerY != 0 && s.yPos == y - com_davidmaletz_tiles_Tile.SIZE + this._height) { + this._offsetY = s.info.playerY; + } else { + this._offsetY = 0; + } + if(this.player != null) { + this.updateOverlap(x,y); + } + if(this.getInfo().collectBounds != null && this.hasControl()) { + this.checkTooltip(); + } + this.runPositionChanged(); + } + ,runPositionChanged: function() { + this.runEvent(com_davidmaletz_mining_Main.getLocalPlayer(),"positionChanged"); + if(this.bg != null) { + this.bg.playAnimation(this.getBGAnim(),true); + } + } + ,runEvent: function(p,event,onComplete,v,val) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = p == com_davidmaletz_mining_Main.getLocalPlayer(); + com_davidmaletz_mining_world_RideableObject.prototype.runEvent.call(this,p,event,onComplete,v,val); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + ,station: null + ,bg: null + ,getStation: function() { + if(this.station == null) { + var i = this.getInfo(); + this.station = new com_davidmaletz_tiles_render_PlayAnimation(com_davidmaletz_tiles_Tile.get(i.tile),this.getAnim("hover"),com_davidmaletz_mining_enemy_AttackRenderer.getFPS(i.xml,15),true,null,-0.5,-0.5); + } + this.station.set_x(Math.round(this.getCenterX()) + this.offX); + this.station.set_y(Math.round(this.getCenterY() + this._offsetY) + this.offY); + return this.station; + } + ,knockback: function(dx,passObjects) { + if(passObjects == null) { + passObjects = false; + } + } + ,moveRenderer: function(old_x,old_y,init) { + if(init == null) { + init = false; + } + var _y = this.renderer.get_y() + this.yTile - old_y; + this.renderer.set_x(Math.round(this.getCenterX()) + this.offX); + this.renderer.set_y(Math.round(this.getCenterY() + this._offsetY) + this.offY); + if(old_x == this.xPos && old_y == this.yTile) { + _y = this.renderer.get_y(); + } + if(_y != this.renderer.get_y()) { + var y = this.renderer.get_y(); + this.renderer.set_y(_y); + this.renderer.lerp(new com_davidmaletz_lerp_PositionKeyframe(this.renderer.get_x(),y),5); + } + this.updateMusic(); + if(this.light != null) { + this.light.setPosition(Math.round(this.renderer.get_x()),Math.round(this.renderer.get_y())); + } + if(init) { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + this.runEvent(null,"initRenderer"); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + } + ,updateMusic: function() { + if(this.player == com_davidmaletz_mining_Main.getLocalPlayer() && !com_davidmaletz_mining_effects_Storm.hasStorm() && this.area != null && this.hasControl()) { + com_davidmaletz_faengfl_adv_sound_Music.update(); + } + } + ,onMount: function() { + this.player.__last_projectile = null; + this.playAnim("mount"); + this.fullInventory.destroy(); + var ar = this.fullInventory.inventories; + com_fancyfish_faeng_common_Utils.clear(ar); + if(this.isDrone()) { + ar.push(this.player.inventory); + } else { + ar.push(this.inventory); + ar.push(this.player.inventory); + } + this.fullInventory.init(); + if(this.player == com_davidmaletz_mining_Main.getLocalPlayer()) { + this.moveToFront(); + } + this.runEvent(this.player,"mount"); + this.dispatchEvent(new openfl_events_Event("update_mount")); + this.updateMusic(); + this.equipment.init(this); + } + ,smoothCamera: function(x,y) { + var tx = this.area.renderer.get_x(); + var ty; + x = com_davidmaletz_mining_world_Object.fixOldX(this.area,x,tx); + if(this.area.renderer.hasTrack(com_davidmaletz_lerp_YKeyframe)) { + ty = (js_Boot.__cast(this.area.renderer.getLerp(com_davidmaletz_lerp_YKeyframe) , com_davidmaletz_lerp_YKeyframe)).y; + this.area.renderer.clearTrack(com_davidmaletz_lerp_YKeyframe); + } else { + ty = this.area.renderer.get_y(); + } + this.area.renderer.set_x(x); + this.area.renderer.set_y(y); + this.area.renderer.lerp(new com_davidmaletz_lerp_PositionKeyframe(tx,ty),10); + } + ,hasName: function() { + return this.info.xml.get("includeName") == "true"; + } + ,_onOperate: function(p) { + var i = this.getInfo(); + if(i.interior == null) { + this.mount(p); + } else { + var f = $bind(this,this.enter); + var p1 = p; + new com_davidmaletz_faengfl_transition_EllipseFade(function() { + f(p1); + },30,0,p.cameraCentered() ? 0 : 72. - com_davidmaletz_tiles_Tile.SIZE * 1.5); + } + } + ,doOperate: function(p) { + if(com_davidmaletz_mining_Main.PIRATE && this.area.id != "start" && this.inventory.hasItem()) { + this.inventory.clear(); + var c = com_davidmaletz_mining_Main.getContainer(); + var f = $bind(this,this._onOperate); + var p1 = p; + var tmp = function() { + f(p1); + }; + c.addDisplay(new com_davidmaletz_mining_ui_DialogueBox(c,com_fancyfish_faeng_common_Lang.getText("trader","pirate").get(),tmp),2); + } else { + this._onOperate(p); + } + } + ,fakeMount: function(p) { + this.preMount(p); + this.player = p; + p.area.removeObject(p); + this.player.set_vehicle(this); + this.player.renderer = null; + this.onMount(); + this.updateOverlap(this.xPos,this.yTop()); + if(this._allowFamiliar) { + this.player.familiar.init(); + } else { + this.player.familiar.destroy(); + } + } + ,doMount: function(p,instant) { + if(instant == null) { + instant = false; + } + var s = com_davidmaletz_mining_Main._getScale(); + this.player = p; + if(p.area != null) { + p.area.removeObject(p); + } + this.player.set_vehicle(this); + var pr = this.player.renderer; + if(instant && pr != null) { + com_davidmaletz_faengfl_FaengFL.remove(pr); + } + this.player.renderer = null; + this.onMount(); + if(p == com_davidmaletz_mining_Main.getLocalPlayer()) { + this.showGUI(); + } + this.updateOverlap(this.xPos,this.yTop()); + if(this.area == null) { + return; + } + var x = 0.0; + var y = 0.0; + if(this.area.renderer != null) { + if(pr != null && s != com_davidmaletz_mining_Main._getScale()) { + (js_Boot.__cast(pr , com_davidmaletz_mining_renderer_PlayerRenderer)).updateScroll(true); + } + x = this.area.renderer.get_x(); + y = this.area.renderer.get_y(); + } + if(this.renderer != null && this.hasControl()) { + this.renderer.set_x(Math.round(this.getCenterX()) + this.offX); + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_world_vehicle_VehicleRenderer)).updateScroll(true); + } + if(this.area.renderer != null && !instant) { + this.smoothCamera(x,y); + } + if(this._allowFamiliar) { + this.player.familiar.init(); + } else { + this.player.familiar.destroy(); + } + } + ,isDrone: function() { + return this.info.xml.get("drone") == "true"; + } + ,canMount: function(p,showWarning) { + if(showWarning == null) { + showWarning = true; + } + if(this.player != null) { + if(showWarning) { + p.showWarning(com_fancyfish_faeng_common_Lang.getText("vehicle","in_use")); + } + return false; + } + var i = p.equipment.getItemUsed("weapon"); + if(i != null && i.info.xml.exists("vehicleFail")) { + var v = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(p); + v.set("this",i); + var m = com_fancyfish_faeng_common_Lang.getTextFromTitle(com_davidmaletz_mining_npc_NPCEventHandler.evalString(i.info.xml.get("vehicleFail"),v)); + if(m == null) { + return true; + } + if(showWarning) { + p.showWarning(m); + } + return false; + } else { + return true; + } + } + ,preMount: function(p) { + if(this.isDrone()) { + this.set_droneArea(p.area); + this.droneX = p.xPos; + this.droneY = p.yTile; + this.dronePrevArea = p.prevLocation; + this.dronePrevX = p.prevX; + this.dronePrevY = p.prevY; + } else { + this.set_droneArea(null); + } + } + ,mount: function(p) { + var _gthis = this; + if(p.area != null && this.area != null && this.canMount(p)) { + this.preMount(p); + var instant = false; + if(p.area != this.area) { + new com_davidmaletz_faengfl_transition_FadeOut(function() { + if(_gthis.canMount(p)) { + p.doTeleport(_gthis.area.id,p.xPos,p.yTile,false,_gthis.area,false); + _gthis.doMount(p,true); + } + },15); + } else { + var tmp; + var tmp1 = com_davidmaletz_mining_Main.getLocalPlayer(); + if(p == tmp1) { + tmp = !p.getFlag("vehicle.explain"); + } else { + tmp = false; + } + if(tmp) { + p.setFlag("vehicle.explain",true); + var c = com_davidmaletz_mining_Main.getContainer(); + var tmp2 = com_fancyfish_faeng_common_Lang.getText("vehicle","explain").get(); + var f = $bind(this,this.doMount); + var p1 = p; + c.addDisplay(new com_davidmaletz_mining_ui_DialogueBox(c,tmp2,function() { + f(p1); + }),3); + } else { + this.doMount(p,instant); + } + } + } + } + ,flyWater: function() { + return false; + } + ,setPlayer: function(p) { + if(this.player != p) { + this.dismount(); + this.player = p; + p.set_vehicle(this); + this.onMount(); + if(this._allowFamiliar) { + this.player.familiar.init(); + } + } + if(p == com_davidmaletz_mining_Main.getLocalPlayer()) { + this.destroyGUI(); + this.showGUI(); + } + } + ,_isFlying: function() { + return this.isFlying(this.xPos,this.yTile); + } + ,isAboveFlightHeight: function(dy) { + if(dy == null) { + dy = 0; + } + var f = this.flight_height.get(); + var flight_height = f == null || !this.canFly() ? null : f.second; + if(flight_height != null) { + return this.get_tile_y() < dy - flight_height; + } else { + return true; + } + } + ,isFlying: function(_x,_y) { + if(this.area != null) { + var s = Math.floor(_x / com_davidmaletz_tiles_Tile.SIZE); + var e = Math.floor((_x + this._width - 1) / com_davidmaletz_tiles_Tile.SIZE) + 1; + var y = Math.ceil((_y + 1) / com_davidmaletz_tiles_Tile.SIZE); + var _g1 = s; + var _g = e; + while(_g1 < _g) { + var x = _g1++; + if((this.flyWater() || !this.area.isWater(x,y)) && this.area.getTileId(x,y,0) == -1 && !this.hasBackTile(x,y)) { + return true; + } + } + } + return false; + } + ,isUnderwater: function() { + if(this.area != null) { + var s = Math.floor(this.xPos / com_davidmaletz_tiles_Tile.SIZE); + var e = Math.floor((this.xPos + this._width - 1) / com_davidmaletz_tiles_Tile.SIZE) + 1; + var y = Math.ceil((this.yTile + 1) / com_davidmaletz_tiles_Tile.SIZE) - 1; + var _g1 = s; + var _g = e; + while(_g1 < _g) { + var x = _g1++; + if(this.area.isWater(x,y)) { + return true; + } + } + } + return false; + } + ,canEnterTile: function(x,y) { + if(!com_davidmaletz_mining_world_RideableObject.prototype.canEnterTile.call(this,x,y)) { + return this.enterTileWalk(x,y - 1); + } else { + return true; + } + } + ,hasBackTile: function(x,y) { + var back = com_davidmaletz_mining_world_RideableObject.prototype.hasBackTile.call(this,x,y); + if(!this.aboveGround) { + return back; + } + if(back && !com_davidmaletz_mining_world_Area.isEmpty(this.area.getTile(x,y,3))) { + com_davidmaletz_mining_world_BaseObject.rectangle.setTo(x * com_davidmaletz_tiles_Tile.SIZE,y * com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE * 2); + var s = this.area.getStructure(com_davidmaletz_mining_world_BaseObject.rectangle); + if(s != null) { + return s.info.xml.get("allowFlying") != "true"; + } else { + return true; + } + } else { + return false; + } + } + ,_checkTile: function(addBounds,bot,x,y) { + if(this.aboveGround && this.hasBackTile(x,y)) { + com_davidmaletz_mining_world_Object.rectangle.setTo(x * com_davidmaletz_tiles_Tile.SIZE,y * com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE); + addBounds(null,com_davidmaletz_mining_world_Object.rectangle); + return false; + } else { + return com_davidmaletz_mining_world_RideableObject.prototype._checkTile.call(this,addBounds,bot,x,y); + } + } + ,mine_power: null + ,mine_speed: null + ,mine_fuel: null + ,mineSlot: null + ,hitTile: function(frames,addBounds,bot,x,y) { + var t; + var tmp; + if(this.mine_power > 0 && this.player != null && this.area != null && this.area.renderer != null) { + t = this.area.getTileId(x,y,0); + tmp = t != -1; + } else { + tmp = false; + } + if(tmp) { + var tile = this.area.getTileIndex(t); + var mine_cost = com_davidmaletz_mining_world_Area.getMineCost(tile,true); + var power = this.mine_power - mine_cost; + if(power >= 1) { + if(this.fuel < this.mine_fuel * (mine_cost + 1)) { + this.showWarning(com_fancyfish_faeng_common_Lang.getText("warning",this.fuelName)); + } else if(!this.area.renderer.incBrickBreak(x,y,frames * power * this.mine_speed)) { + var ore = this.area.mine(x,y,t,this.player.getLightRange(),this.player); + com_davidmaletz_mining_world_Area.onDig(this.player,tile); + if(com_davidmaletz_mining_item_ItemInfo.exists(ore)) { + com_davidmaletz_mining_renderer_CollectLoot.collect(new com_fancyfish_faeng_common_SingleIterator(new com_davidmaletz_mining_item_ItemCt(com_davidmaletz_mining_item_ItemInfo.get(ore),1)),this.area.renderer,com_davidmaletz_tiles_Tile.SIZE * x,(y + 0.5) * com_davidmaletz_tiles_Tile.SIZE); + } + ++mine_cost; + this.player.addExp(mine_cost); + this.useFuel(this.mine_fuel * mine_cost); + if(ore != null) { + var xml = com_davidmaletz_mining_world_Area.getOre(ore); + if(xml != null) { + if(xml.exists("achievement")) { + com_davidmaletz_faengfl_achievement_Achievements.instance.gainAchievement(xml.get("achievement")); + } + var element = com_davidmaletz_mining_world_Element.get(xml.get("element")); + if(xml.exists("damage") && this.loseHealth(com_davidmaletz_mining_Main.parseInt(xml.get("damage")),0,this,element,0) > 0) { + var id = xml.get("hit_sfx"); + if(id == null) { + id = "attack"; + } + com_davidmaletz_faengfl_adv_sound_Sound.play(id); + } + this.hitEffect(com_davidmaletz_mining_world_ObjectInfo.getHitEffectI(this,element,xml)); + } + if(this.area == null || this.health <= 0) { + return true; + } + } + } else if(this.mineSlot != null && this.renderer != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_world_vehicle_VehicleRenderer)).showEquip(this.mineSlot); + } + } + } + if(com_davidmaletz_mining_Player._getTileBlockId(this.area,this.get_tile_x(),this.get_tile_y(),x,y) == 999999 || this.area.isBlockVehicle(x,y)) { + com_davidmaletz_mining_world_Object.rectangle.setTo(x * com_davidmaletz_tiles_Tile.SIZE,y * com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE); + addBounds(null,com_davidmaletz_mining_world_Object.rectangle); + return false; + } else { + return this._checkTile(addBounds,bot,x,y); + } + } + ,hitTileFall: function(frames,addBounds,bot,x,y) { + return this.hitTile(frames,addBounds,bot,x,y); + } + ,enterTileWalk: function(x,y) { + if(this.area.isWater(x,y)) { + return false; + } + ++y; + if(!com_davidmaletz_mining_world_RideableObject.prototype.canStandOn.call(this,this.area.getTile(x,y,0),x,y)) { + return this.hasBackTile(x,y); + } else { + return true; + } + } + ,canFly: function() { + if(this.area.canFly()) { + if(!(!this.area.isOrbit())) { + return this.info.xml.get("flyOrbit") == "true"; + } else { + return true; + } + } else { + return false; + } + } + ,canStandOn: function(t,x,y) { + var f = this.flight_height.get(); + var flight_height = f == null || !this.canFly() ? null : f.second; + if(t == null) { + if(flight_height != null && !this.area.isWater(x,y - 1)) { + return y > -flight_height; + } else { + return false; + } + } else { + return true; + } + } + ,getLayer: function() { + return 3; + } + ,isBlocking: function(asker) { + if(this.isMounted()) { + if(this.player.paused.get()) { + return false; + } else if(asker == null) { + return !this.isHidden(); + } else if(asker.xml.get("spirit") == "true") { + return this.player.viewHidden.get(); + } else if(!(!this.isHidden())) { + return asker.xml.get("seeHidden") == "true"; + } else { + return true; + } + } else { + return false; + } + } + ,canAttack: function() { + if(this.player == null) { + return false; + } else { + return this.player.canAttack(); + } + } + ,abilities: null + ,setAbility: function(a) { + if(this.abilities == null) { + this.abilities = new haxe_ds_IntMap(); + } + this.abilities.set(a.hotkey,a); + if(this.gui != null) { + this.gui.updateHotkeys(); + } + } + ,removeAbility: function(a) { + if(this.abilities != null && this.abilities.get(a.hotkey) == a) { + this.abilities.remove(a.hotkey); + } + if(this.gui != null) { + this.gui.updateHotkeys(); + } + } + ,getAbility: function(i) { + var ret = this.abilities == null ? null : this.abilities.get(i); + if(ret == null) { + return this.getInfo().getAbility(i); + } else { + return ret; + } + } + ,canFlip: function() { + return false; + } + ,isPlayer: function(local) { + if(local == null) { + local = false; + } + if(this.isMounted()) { + return this.player.isPlayer(local); + } else { + return false; + } + } + ,projectileKillCollect: function() { + return true; + } + ,canSave: function() { + return !this.isPlayer(!com_davidmaletz_mining_world_Area.__WRITE_IDS); + } + ,writeInner: function(b,mounted) { + if(mounted) { + b.writeUInt16(this.health); + } + b.writeUInt24(this.fuel); + this.inventory.write(b); + this.equipment.write(b); + com_fancyfish_faeng_common_UTFUtils.writeUTF(b,this.name); + this.writeInterior(b); + } + ,write: function(b) { + com_davidmaletz_mining_world_RideableObject.prototype.write.call(this,b); + this.writeInner(b,false); + } + ,readInner: function(b,version,mounted) { + if(mounted) { + this.health = b.readUInt16(); + } + if(version >= 55) { + this.fuel = b.readUInt24(); + this.inventory.read(b,version); + this.equipment.read(b,version); + if(version >= 76 || this.hasName()) { + this.set_name(com_fancyfish_faeng_common_UTFUtils.readUTF(b)); + } + if(version >= 61) { + this.readInterior(b,version); + } + } + } + ,read: function(b,version) { + com_davidmaletz_mining_world_RideableObject.prototype.read.call(this,b,version); + this.readInner(b,version,false); + } + ,resetParams: function() { + var info = this.getInfo(); + this.flight_height.set(info.flight_height == null ? null : new com_fancyfish_faeng_common_Pair(null,info.flight_height)); + this.max_depth.set(new com_fancyfish_faeng_common_Pair(null,info.max_depth)); + this.efficiency.set(new com_fancyfish_faeng_common_Pair(null,info.xml.exists("efficiency") ? com_davidmaletz_mining_Main.parseFloat(info.xml.get("efficiency")) : 1)); + } + ,updateEquipment: function() { + var i = this.getInfo(); + this.resetParams(); + var e = this.equipment.getEquipment(); + while(e.hasNext()) { + var e1 = e.next(); + if(e1.info.xml.exists("flight_height")) { + var f = com_davidmaletz_mining_Main.parseInt(e1.info.xml.get("flight_height")); + var fht = this.flight_height.get(); + if(fht == null || f > fht.second) { + this.flight_height.set(new com_fancyfish_faeng_common_Pair(e1.info.id,f)); + } + } + if(e1.info.xml.exists("max_depth")) { + var f1 = com_davidmaletz_mining_Main.parseInt(e1.info.xml.get("max_depth")); + if(f1 > this.max_depth.get().second) { + this.max_depth.set(new com_fancyfish_faeng_common_Pair(e1.info.id,f1)); + } + } + if(e1.info.xml.exists("efficiency")) { + var f2 = com_davidmaletz_mining_Main.parseFloat(e1.info.xml.get("efficiency")); + if(this.efficiency.get().second > f2) { + this.efficiency.set(new com_fancyfish_faeng_common_Pair(e1.info.id,f2)); + } + } + } + if(this.renderer != null && this.player != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_world_vehicle_VehicleRenderer)).updateLight(); + } + } + ,changeEquipment: function(slot,e) { + if(this.renderer != null) { + (js_Boot.__cast(this.renderer , com_davidmaletz_mining_world_vehicle_VehicleRenderer)).updateEquipment(slot); + } + this.updateEquipment(); + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("change_equip",slot)); + } + ,changeEqState: function(slot,e) { + this.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("change_eq_state",slot)); + } + ,getDefaultBlood: function() { + return "vehicle.death"; + } + ,getBaseInventory: function() { + return this.inventory; + } + ,getInventory: function() { + return this.fullInventory; + } + ,getEquipment: function() { + return this.equipment; + } + ,getOwner: function() { + return this.player; + } + ,getXml: function() { + return this.info.xml; + } + ,getLabel: function() { + return this.name; + } + ,setLabel: function(s) { + this.set_name(s); + } + ,set_name: function(s) { + if(this.name != s) { + this.name = s; + this.updateModifier(); + this.dispatchEvent(new openfl_events_Event("change_label")); + } + return s; + } + ,getHitbox: function(notOperate) { + if(notOperate == null) { + notOperate = true; + } + if(notOperate) { + return com_davidmaletz_mining_world_RideableObject.prototype.getHitbox.call(this,notOperate); + } else { + if(this.area != null && (this.area.getLoop() <= 0 && (this.area.left != null && this.xPos < this.area.left.fromX * com_davidmaletz_tiles_Tile.SIZE || this.area.right != null && this.xPos + this._width > this.area.right.fromX * com_davidmaletz_tiles_Tile.SIZE) || this.area.up != null && this.yTop() < this.area.up.fromX * com_davidmaletz_tiles_Tile.SIZE || this.area.down != null && this.yTile + com_davidmaletz_tiles_Tile.SIZE > this.area.down.fromX * com_davidmaletz_tiles_Tile.SIZE)) { + return com_davidmaletz_mining_world_RideableObject.prototype.getHitbox.call(this,notOperate); + } + var ret = this.getBounds(); + this.getInfo().modifyOperateHitbox(ret,this.getFacing()); + return ret; + } + } + ,__class__: com_davidmaletz_mining_world_vehicle_Vehicle + ,__properties__: $extend(com_davidmaletz_mining_world_RideableObject.prototype.__properties__,{set_droneArea:"set_droneArea",set_name:"set_name"}) +}); +var com_davidmaletz_mining_world_vehicle_Boat = function(info,x,y) { + com_davidmaletz_mining_world_vehicle_Vehicle.call(this,info,x,y); + this.vertical = false; +}; +$hxClasses["com.davidmaletz.mining.world.vehicle.Boat"] = com_davidmaletz_mining_world_vehicle_Boat; +com_davidmaletz_mining_world_vehicle_Boat.__name__ = ["com","davidmaletz","mining","world","vehicle","Boat"]; +com_davidmaletz_mining_world_vehicle_Boat.__super__ = com_davidmaletz_mining_world_vehicle_Vehicle; +com_davidmaletz_mining_world_vehicle_Boat.prototype = $extend(com_davidmaletz_mining_world_vehicle_Vehicle.prototype,{ + pos: null + ,isFlying: function(_x,_y) { + return false; + } + ,hitTile: function(frames,addBounds,bot,x,y) { + if(y > this.area.waterLevel || !this.area.isEmptyTile(x,y + 1)) { + com_davidmaletz_mining_world_Object.rectangle.setTo(x * com_davidmaletz_tiles_Tile.SIZE,y * com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE); + addBounds(null,com_davidmaletz_mining_world_Object.rectangle); + } + return false; + } + ,updateFuel: function(d) { + com_davidmaletz_mining_world_vehicle_Vehicle.prototype.updateFuel.call(this,d); + if(this.hasControl()) { + this.checkTooltip(); + } + } + ,intersects: function(r,issect) { + var b = this.getBounds(); + var _g = b; + _g.set_bottom(_g.get_bottom() + com_davidmaletz_tiles_Tile.SIZE * 0.5); + return com_fancyfish_faeng_pack_AABBObjectList.intersects(r,b,issect); + } + ,canInteract: function(o,l) { + if(o.get_alpha() > 0 && o != this) { + return l == 0; + } else { + return false; + } + } + ,checkTooltip: function() { + if(this.checkObjectStructure()) { + return; + } + if(this.canDismount()) { + if(this.tooltip == null || this.tooltip.message != com_fancyfish_faeng_common_Lang.getText("vehicle","dismount")) { + this.showDismount(); + } + return; + } + var p = this.renderer == null ? null : (js_Boot.__cast(this.renderer , com_davidmaletz_mining_world_vehicle_VehicleRenderer)).player; + var eq; + var tmp; + var tmp1; + var tmp2; + if(p != null && p.get_numChildren() > 0) { + eq = this.player.getFishingRod(); + tmp2 = eq != null; + } else { + tmp2 = false; + } + if(tmp2) { + tmp1 = this.area != null; + } else { + tmp1 = false; + } + if(tmp1) { + tmp = this.area.isFishable(this.get_tile_x(),this.get_tile_y()) == 1; + } else { + tmp = false; + } + if(tmp) { + if(this.tooltip == null || this.tooltip.message == com_fancyfish_faeng_common_Lang.getText("vehicle","dismount")) { + this.showTooltip("select",com_davidmaletz_mining_world_ItemObject.itemText(com_fancyfish_faeng_common_Lang.getText("object.tooltip","use"),eq.info)); + } + } else { + this.hideTooltip(); + } + } + ,canDismount: function() { + if(this._canDismount) { + if(!(this.getMaxFuel() > 0 && this.fuel == 0 || this.isOverweight())) { + return this.pos != null; + } else { + return true; + } + } else { + return false; + } + } + ,isBack: function() { + return false; + } + ,getLayer: function() { + return 0; + } + ,createRenderer: function() { + return new com_davidmaletz_mining_world_vehicle__$Boat_BoatRenderer(this); + } + ,onPositionChanged: function() { + if(this.hasControl()) { + this.player.__updatePos(); + } + if(this.hasControl()) { + this.checkDismount(); + } + if(this.player != null) { + this.updateOverlap(this.xPos,this.yTop()); + } + this.runPositionChanged(); + } + ,setOffsetY: function(oy) { + this._offsetY = oy; + this.renderer.set_y(this.getCenterY() + this._offsetY); + } + ,moveY: function(d,frames,onComplete) { + if(frames == 0) { + this.setOffsetY(this._offsetY + d); + } else if(this.renderer != null) { + this.renderer.lerp(new com_davidmaletz_mining_world_vehicle_OffsetKeyframe(this,this._offsetY + d),frames,onComplete); + } + } + ,resetY: function(frames,onComplete) { + if(frames == 0) { + this.setOffsetY(0); + } else if(this.renderer != null) { + this.renderer.lerp(new com_davidmaletz_mining_world_vehicle_OffsetKeyframe(this,0),frames,onComplete); + } + } + ,dismountPos: function(player) { + if(this.pos == null) { + com_davidmaletz_mining_world_vehicle_Vehicle.prototype.dismountPos.call(this,player); + } else { + player.setPosition(this.pos.x * com_davidmaletz_tiles_Tile.SIZE,this.pos.y * com_davidmaletz_tiles_Tile.SIZE); + } + } + ,checkDismount: function() { + var x = this.xPos; + if(this.renderer != null && this.area != null && this.hasControl()) { + var px; + var py = this.get_tile_y(); + if(this.renderer.get_scaleX() == -this.renderer.get_scaleY()) { + px = Math.floor((x + this._width) / com_davidmaletz_tiles_Tile.SIZE - 1); + } else { + px = Math.ceil(x / com_davidmaletz_tiles_Tile.SIZE); + } + if(this.area.getTileId(px,py,0) == -1 && this.canPlacePlayer(px,py)) { + if(this.pos == null) { + this.pos = new com_fancyfish_faeng_display_IPoint2D(px,py); + } else { + this.pos.set(px,py); + } + this.checkTooltip(); + return; + } + } + if(this.pos != null) { + this.pos = null; + } + if(this.hasControl()) { + this.checkTooltip(); + } else { + this.hideTooltip(); + } + } + ,canPlacePlayer: function(x,y) { + this.player.area = this.area; + var ret = this.player.canEnterTile(x,y); + this.player.area = null; + return ret; + } + ,onFlip: function() { + com_davidmaletz_mining_world_vehicle_Vehicle.prototype.onFlip.call(this); + if(this.hasControl()) { + this.checkDismount(); + } + } + ,onMount: function() { + com_davidmaletz_mining_world_vehicle_Vehicle.prototype.onMount.call(this); + if(this.hasControl()) { + this.checkDismount(); + } + } + ,__class__: com_davidmaletz_mining_world_vehicle_Boat +}); +var com_davidmaletz_mining_world_vehicle_VehicleRenderer = function(v) { + this.crushWarning = null; + this.o2partial = 0; + this.second = 60; + this.eqAttackRepeat = 0; + this.moveCost = 0; + this.partial = 0; + this.turn_ct = 0; + this.oldScaleX = 0; + this.aimY = null; + this.aimX = null; + this.camX = -com_davidmaletz_mining_Main.parseInt(v.info.xml.get("cameraX")); + this.camY = -com_davidmaletz_mining_Main.parseInt(v.info.xml.get("cameraY")); + this.autoAlign = v.info.xml.get("autoAlign") != "false"; + this.hoverWalk = v.info.xml.get("hoverWalk") == "true"; + var i = v.getInfo(); + var ar = i.attacks; + var mod = com_davidmaletz_mining_item_ItemInfo.getMod(v.name); + this.blockFuel = i.xml.get("blockFuel") == "true"; + if(i.xml.exists("reentry")) { + this.reentry = -com_davidmaletz_mining_Main.parseInt(i.xml.get("reentry")); + } else { + this.reentry = 0; + } + if(mod != null) { + ar = com_davidmaletz_mining_familiar_FamiliarType.modifyAttacks(ar,mod); + } + this.fps = com_davidmaletz_mining_enemy_AttackRenderer.getFPS(i.xml,15); + this.vehicle = v; + com_davidmaletz_mining_enemy_AttackRenderer.call(this,com_davidmaletz_tiles_Tile.get(i.tile),null,ar,this.fps,com_davidmaletz_mining_world_Object.resolveObject(v,"walk")); + if(v.getMaxHealth() > 0) { + this.bar = new com_davidmaletz_mining_renderer_ObjectHealthBar(v,26367); + this.addChild(this.bar); + } + this.glow = i.xml.get("glow") == "true"; + var vars = null; + var e = i.xml.elements(); + while(e.hasNext()) { + var e1 = e.next(); + if(vars == null) { + vars = com_davidmaletz_mining_npc_NPCEventHandler.createVariables(com_davidmaletz_mining_Main.getLocalPlayer()); + vars.set("this",this); + } + if(!e1.exists("if") || com_davidmaletz_faengfl_EventHandler._conditionMet(e1.get("if"),vars)) { + var _g = e1.nodeName(); + switch(_g) { + case "player": + if(this.player == null) { + this.player = new openfl_display_Sprite(); + } + this.playerXml = e1.xml; + if(e1.exists("x")) { + this.player.set_x(com_davidmaletz_mining_Main.parseInt(e1.get("x"))); + } + if(e1.exists("y")) { + this.player.set_y(com_davidmaletz_mining_Main.parseInt(e1.get("y"))); + } + if(this.inner == null) { + this.inner = new openfl_display_Sprite(); + } + this.inner.addChild(this.player); + break; + case "tile": + var s = com_davidmaletz_mining_npc_NPCEventHandler.addTile(null,e1.xml,vars,0); + if(s != null) { + if(this.inner == null) { + this.inner = new openfl_display_Sprite(); + } + this.inner.addChild(s); + if(e1.exists("id") || e1.exists("name")) { + if(v.tileMap == null) { + v.tileMap = new haxe_ds_StringMap(); + } + v.tileMap.set(e1.exists("name") ? e1.get("name") : e1.get("id"),s); + } + } + break; + } + } + } + if(v.isDrone()) { + if(this.player == null) { + this.player = new openfl_display_Sprite(); + } else { + com_davidmaletz_faengfl_FaengFL.remove(this.player); + this.player.set_x(0); + this.player.set_y(0); + } + this.playerXml = null; + this.player.set_alpha(0.5); + } + if(this.inner != null) { + this.inner.set_x(Math.round(-v._width * 0.5)); + this.inner.set_y(Math.round(-v._height * 0.5)); + if(i.xml.get("tilesBehind") == "true") { + this.addChildAt(this.inner,0); + } else { + this.addChild(this.inner); + } + } + this.max_attack = 0; + var _g1 = 0; + var _g11 = this.attacks; + while(_g1 < _g11.length) { + var a = _g11[_g1]; + ++_g1; + this.max_attack = com_fancyfish_faeng_common_Utils.max(this.max_attack,a.damage); + } + this.equipmentSprite = new openfl_display_Sprite(); + this.addChild(this.equipmentSprite); + if(i.shield != null) { + this.shieldSprite = new com_davidmaletz_tiles_render_PlayAnimation(com_davidmaletz_tiles_Tile.get(i.shield.tile),i.shield.animation,this.fps,true,null,-0.5,-0.5); + this.shieldSprite.set_visible(false); + this.addChild(this.shieldSprite); + } + this.nameTag = new com_davidmaletz_mining_renderer_NameTag(v,v.getOwner()); + this.addChild(this.nameTag); +}; +$hxClasses["com.davidmaletz.mining.world.vehicle.VehicleRenderer"] = com_davidmaletz_mining_world_vehicle_VehicleRenderer; +com_davidmaletz_mining_world_vehicle_VehicleRenderer.__name__ = ["com","davidmaletz","mining","world","vehicle","VehicleRenderer"]; +com_davidmaletz_mining_world_vehicle_VehicleRenderer.__interfaces__ = [com_davidmaletz_faengfl_IScrollable]; +com_davidmaletz_mining_world_vehicle_VehicleRenderer.removeSelf = function(p) { + com_davidmaletz_faengfl_FaengFL.remove(p); +}; +com_davidmaletz_mining_world_vehicle_VehicleRenderer._getClosest = function(o,checkTile,dx,dy,checkObject) { + if(o.area == null) { + return null; + } + var area = o.area; + if(com_davidmaletz_mining_world_Object.blocker_obj == null) { + com_davidmaletz_mining_world_Object.blocker_obj = new com_davidmaletz_mining_world_Blocker(); + } + var b = o.getBounds(); + var left = b.get_left(); + var right = b.get_right(); + var top = b.get_top(); + var bottom = b.get_bottom(); + if(dx > 0) { + var _g = b; + _g.set_right(_g.get_right() + dx); + } else { + var _g1 = b; + _g1.set_left(_g1.get_left() + dx); + } + if(dy > 0) { + var _g2 = b; + _g2.set_bottom(_g2.get_bottom() + dy); + } else { + var _g3 = b; + _g3.set_top(_g3.get_top() + dy); + } + var bot; + if(dy <= 0) { + bot = Math.floor((o.yTile + dy) / com_davidmaletz_tiles_Tile.SIZE); + } else { + bot = Math.ceil((o.yTile + dy) / com_davidmaletz_tiles_Tile.SIZE); + } + dx = com_fancyfish_faeng_common_Utils.sign(dx); + dy = com_fancyfish_faeng_common_Utils.sign(dy); + var dist = Infinity; + var addBounds = function(obj,r) { + var a = (right - r.x) * dx; + var b1 = (r.get_right() - left) * dx; + var c = (bottom - r.y) * dy; + var d = (r.get_bottom() - top) * dy; + if(a < 0 && b1 < 0 && c < 0 && d < 0) { + return; + } + var _d = Infinity; + if(dx != 0) { + if(a >= 0 && a < _d) { + _d = a; + } + if(b1 >= 0 && b1 < _d) { + _d = b1; + } + } + if(dy != 0) { + var x = Math.round(r.x / com_davidmaletz_tiles_Tile.SIZE); + var y = Math.round(r.y / com_davidmaletz_tiles_Tile.SIZE); + if(dy > 0 && area.emptyTile(x,y) && !area.isWater(x,y)) { + return; + } + if(c >= 0 && c < _d) { + _d = c; + } + if(d >= com_davidmaletz_tiles_Tile.SIZE - o._height && d < _d) { + _d = d; + } + } + if(_d < dist) { + dist = _d; + com_davidmaletz_mining_world_Object.blocker_obj.bounds.copyFrom(r); + } + }; + var tmp; + if(checkObject == null) { + tmp = null; + } else { + var f = checkObject; + var a1 = addBounds; + var a2 = bot; + tmp = function(a3,a4) { + return f(a1,a2,a3,a4); + }; + } + var f1 = checkTile; + var a11 = addBounds; + var a21 = bot; + var tmp1 = function(a31,a41) { + return f1(a11,a21,a31,a41); + }; + area.getObjects(b,tmp,tmp1,0); + if(dist == Infinity) { + return null; + } else { + return com_davidmaletz_mining_world_Object.blocker_obj; + } +}; +com_davidmaletz_mining_world_vehicle_VehicleRenderer.getAppend = function(p) { + if(p != null && p.append != null) { + return p.append; + } else { + return ""; + } +}; +com_davidmaletz_mining_world_vehicle_VehicleRenderer.__super__ = com_davidmaletz_mining_enemy_AttackRenderer; +com_davidmaletz_mining_world_vehicle_VehicleRenderer.prototype = $extend(com_davidmaletz_mining_enemy_AttackRenderer.prototype,{ + vehicle: null + ,glow: null + ,bar: null + ,fps: null + ,player: null + ,playerXml: null + ,inner: null + ,reentry: null + ,blockFuel: null + ,attacking: null + ,max_attack: null + ,equipmentSprite: null + ,shieldSprite: null + ,camX: null + ,camY: null + ,autoAlign: null + ,hoverWalk: null + ,nameTag: null + ,updateModifier: function() { + var mod = com_davidmaletz_mining_item_ItemInfo.getMod(this.vehicle.name); + if(mod == null) { + this.attacks = this.vehicle.getInfo().attacks; + } else { + this.attacks = com_davidmaletz_mining_familiar_FamiliarType.modifyAttacks(this.vehicle.getInfo().attacks,mod); + } + this.max_attack = 0; + var _g = 0; + var _g1 = this.attacks; + while(_g < _g1.length) { + var a = _g1[_g]; + ++_g; + this.max_attack = com_fancyfish_faeng_common_Utils.max(this.max_attack,a.damage); + } + } + ,aimX: null + ,aimY: null + ,normalizeAim: function() { + var s = 1000.0 / Math.sqrt(this.aimX * this.aimX + this.aimY * this.aimY); + this.aimX *= s; + this.aimY *= s; + } + ,repeatAttack: function(o) { + var a = this.currentAttack; + if(this.vehicle.hasControl() && com_davidmaletz_controls_Controller.instance.isPressed(a.xml != null && a.xml.get("useDefend") == "true" ? 12 : 10)) { + this.attackWith(o,a,"pre",false); + return true; + } else { + this.vehicle.dispatchEvent(new openfl_events_Event("end_attack")); + return false; + } + } + ,hasAttack: function() { + var f = this.vehicle.getFuel(); + var _g = 0; + var _g1 = this.attacks; + while(_g < _g1.length) { + var a = _g1[_g]; + ++_g; + if(a.cost <= f) { + return true; + } + } + return false; + } + ,allowUnderwater: function() { + return this.vehicle.info.xml.get("underwater") == "true"; + } + ,onHit: function(a,o,dmg,def) { + var p = this.vehicle.getOwner(); + if(this.vehicle.addExp && p != null) { + p.addAttackExp(o,dmg,def); + } + if(a.cost == 0 || a.xml != null && a.xml.get("scaleCost") == "false") { + return; + } + var e = dmg * (def + 1); + if(e < 0) { + e = 1; + } + if(e > 0) { + this.vehicle.useFuel(Math.round(a.cost * e)); + } + } + ,checkState: function(s) { + switch(s) { + case "flying": + return this.vehicle._isFlying(); + case "standing": + return !this.vehicle._isFlying(); + default: + return true; + } + } + ,canUseAttack: function(a) { + if(com_davidmaletz_mining_enemy_AttackRenderer.prototype.canUseAttack.call(this,a) && this.checkState(a.xml.get("state"))) { + return a.cost <= this.vehicle.getFuel(); + } else { + return false; + } + } + ,_handleAttack: function(area,element,attacker,scaleX,o,a,xml,onMiss) { + var def = Std["is"](o,com_davidmaletz_mining_enemy_Enemy) ? (js_Boot.__cast(o , com_davidmaletz_mining_enemy_Enemy)).getMinDefense() : 0; + var dmg = com_davidmaletz_mining_enemy_AttackRenderer.prototype._handleAttack.call(this,area,element,attacker,scaleX,o,a,xml,onMiss); + this.onHit(a,o,dmg,def); + return dmg; + } + ,attackWith: function(o,a,elem,show,hit_ct) { + if(hit_ct == null) { + hit_ct = 0; + } + if(show == null) { + show = true; + } + if(elem == null) { + elem = "pre"; + } + if(a.cost > 0 && (elem == "pre" || a.xml == null || a.xml.get("oneCost") != "true")) { + this.vehicle.useFuel(Math.round(a.cost)); + } + this.attacking = true; + com_davidmaletz_mining_enemy_AttackRenderer.prototype.attackWith.call(this,o,a,elem,show,hit_ct); + } + ,fireEvent: function(e) { + this.vehicle.dispatchEvent(e); + } + ,showAttack: function(a,onComplete,elem,hit_ct,canFire) { + if(canFire == null) { + canFire = true; + } + if(hit_ct == null) { + hit_ct = 0; + } + if(elem == null) { + elem = "pre"; + } + this.attacking = true; + com_davidmaletz_mining_enemy_AttackRenderer.prototype.showAttack.call(this,a,onComplete,elem,hit_ct,canFire); + } + ,init: function(e) { + com_davidmaletz_mining_enemy_AttackRenderer.prototype.init.call(this,e); + com_davidmaletz_controls_Controller.instance.addEventListener("tap",$bind(this,this.onKey),false,1); + this.vehicle.onFlip(); + this.playIdle(this); + var c = this.vehicle.hasControl(); + if(this.bar != null) { + this.bar.set_alpha(c ? 0 : 1); + } + this.vehicle.addEventListener("update_mount",$bind(this,this.updateMount)); + this.updateMount(null); + if(c) { + this.lightTiles(); + } + var slot = this.vehicle.equipment.getSlots(); + while(slot.hasNext()) { + var slot1 = slot.next(); + this.updateEquipment(slot1); + } + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.setOrder),false,-this.vehicle.area.objects.objectList.indexOf(this.vehicle)); + if(this.vehicle.info.xml.get("hitAnim") == "true") { + this.vehicle.addEventListener("change_health",$bind(this,this.damage)); + } + if(c) { + this.updateScroll(true); + } + } + ,setOrder: function(e) { + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.setOrder)); + if(this.vehicle.hasControl()) { + this.vehicle.moveToFront(); + } else if(this.vehicle.getInfo().interior != null) { + this.vehicle.moveToBack(); + } + } + ,destroy: function(e) { + com_davidmaletz_mining_enemy_AttackRenderer.prototype.destroy.call(this,e); + if(e != null) { + this.vehicle.destroyGUI(); + } + com_davidmaletz_controls_Controller.instance.removeEventListener("tap",$bind(this,this.onKey)); + this.vehicle.removeEventListener("update_mount",$bind(this,this.updateMount)); + if(this.plight != null) { + com_davidmaletz_faengfl_FaengFL.remove(this.plight); + } + if(this.vlight != null) { + com_davidmaletz_faengfl_FaengFL.remove(this.vlight); + } + if(e != null && this.vehicle.renderer == this) { + this.vehicle.renderer = null; + } + this.vehicle.removeEventListener("change_health",$bind(this,this.damage)); + } + ,_attackIdle: function(p) { + this.attacking = false; + this.playIdle(p); + } + ,damage: function(e) { + if(e.delta >= 0 || e.attacker == null) { + return; + } + var h = this.getAnim("hit"); + if(com_davidmaletz_tiles_TileAnimation.exists(h)) { + this.attacking = true; + this.playAnimation(h,false,$bind(this,this._attackIdle)); + } + } + ,returnShield: function(p) { + p.playAnimation(this.vehicle.getInfo().shield.animation,true,null,-0.5,-0.5); + } + ,onBlocked: function(behind) { + if(this.shieldSprite != null) { + var s = this.vehicle.getInfo().shield; + if(s.hit_sfx != null) { + this.vehicle.playSound(s.hit_sfx,false); + } + if(behind && s.hit_back != null) { + if(s.showBaseOnHit) { + this.shieldSprite.addChild(new com_davidmaletz_tiles_render_PlayAnimation(com_davidmaletz_tiles_Tile.get(s.tile),s.hit_back,this.fps,false,com_davidmaletz_mining_world_vehicle_VehicleRenderer.removeSelf,-0.5,-0.5)); + } else { + this.shieldSprite.playAnimation(s.hit_back,false,$bind(this,this.returnShield),-0.5,-0.5); + } + } else if(!behind && s.hit_front != null) { + if(s.showBaseOnHit) { + this.shieldSprite.addChild(new com_davidmaletz_tiles_render_PlayAnimation(com_davidmaletz_tiles_Tile.get(s.tile),s.hit_front,this.fps,false,com_davidmaletz_mining_world_vehicle_VehicleRenderer.removeSelf,-0.5,-0.5)); + } else { + this.shieldSprite.playAnimation(s.hit_front,false,$bind(this,this.returnShield),-0.5,-0.5); + } + } + } + } + ,isWalk: function() { + if(!(this.animation == this.getAnim("move") || this.animation == this.getAnim("fly") || this.animation == this.getAnim("swim"))) { + if(this.hoverWalk) { + return this.animation == this.getAnim("hover"); + } else { + return false; + } + } else { + return true; + } + } + ,beginWalk: function() { + this.vehicle.playSound("begin_walk"); + } + ,vlight: null + ,plight: null + ,playerMovement: null + ,updateMount: function(e) { + if(this.vlight != null) { + com_davidmaletz_faengfl_FaengFL.remove(this.vlight); + } + var p = this.vehicle.getOwner(); + this.nameTag.setPlayer(p); + if(p != null && this.vehicle.area != null && this.vehicle.area.renderer != null && this.vehicle.area.renderer.light != null) { + if(this.vlight == null) { + this.vlight = new com_davidmaletz_mining_effects_Torchlight(this,this.vehicle.getInfo().light); + } + this.updateLight(); + if(this.vehicle.area != null && this.vehicle.area.renderer != null && this.vehicle.area.renderer.light != null) { + this.vehicle.area.renderer.light.addChild(this.vlight); + } + } + if(this.player == null) { + return; + } + var drone = this.vehicle.isDrone(); + if(this.plight != null) { + com_davidmaletz_faengfl_FaengFL.remove(this.plight); + } + if(drone) { + if(this.vehicle.getOwner() == null || this.vehicle.droneArea != this.vehicle.area) { + com_davidmaletz_faengfl_FaengFL.remove(this.player); + return; + } + this.player.set_x(this.vehicle.droneX + com_davidmaletz_tiles_Tile.SIZE * 0.5); + this.player.set_y(this.vehicle.droneY + com_davidmaletz_tiles_Tile.SIZE * 0.5); + this.parent.addChild(this.player); + } + if(this.player.parent == null) { + return; + } + var len = this.player.get_numChildren(); + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + var r = js_Boot.__cast(this.player.getChildAt(i) , com_davidmaletz_mining_renderer_SimplePlayerRenderer); + r.removeEventListener("update_equipment",$bind(this,this.update_equipment)); + r.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),10,(function(d) { + return function() { + com_davidmaletz_faengfl_FaengFL.remove(d[0]); + }; + })([r])); + } + if(p != null) { + if(this.plight == null && this.vehicle.area != null && this.vehicle.area.renderer != null && this.vehicle.area.renderer.light != null) { + var tmp = p.getInfo().light; + var tmp1 = this.player.get_x(); + var tmp2 = this.player.parent == this.inner ? this.inner.get_x() : 0; + var tmp3 = this.player.get_y(); + var tmp4 = this.player.parent == this.inner ? this.inner.get_y() : 0; + this.plight = new com_davidmaletz_mining_effects_Torchlight(drone ? null : this,tmp,tmp1 + tmp2,tmp3 + tmp4); + } + this.equipmentChanged(p); + var r1 = new com_davidmaletz_mining_renderer_SimplePlayerRenderer(p,15,!p.isPlayer(true)); + if(this.playerXml != null && this.playerXml.exists("animation")) { + r1.setAnimation(this.playerXml.get("animation")); + } + if(this.playerXml != null && this.playerXml.exists("movement")) { + this.playerMovement = r1; + this.updateMovement(); + } + r1.addEventListener("update_equipment",$bind(this,this.update_equipment)); + if(e != null) { + r1.set_alpha(0); + r1.lerp(new com_davidmaletz_lerp_AlphaKeyframe(1),10,$bind(this,this.addLight)); + } else { + this.addLight(); + } + this.player.addChild(r1); + } + } + ,setAnimation: function(anim_id,offX,offY) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + var old = this.animation; + com_davidmaletz_mining_enemy_AttackRenderer.prototype.setAnimation.call(this,anim_id,offX,offY); + if(this.playerMovement != null && old != this.animation) { + this.updateMovement(); + } + if(this.inner != null && this.vehicle.info.xml.get("tilesBehind") == "true") { + this.addChildAt(this.inner,0); + } + if(this.equipment != null) { + var item = this.vehicle.equipment.getEquipment(); + while(item.hasNext()) { + var item1 = item.next(); + var slot = item1.info.xml.get("slot"); + var s = this.equipment.get(slot); + if(s != null && this._showEquip != item1) { + s.playAnimation(item1.info.getEquipAnim(item1.getNameStr(),HxOverrides.substr(this.animation,this.animation.lastIndexOf(".") + 1,null),com_davidmaletz_mining_world_vehicle_VehicleRenderer.getAppend((js_Boot.__cast(item1.info , com_davidmaletz_mining_item_Equipment)).equipOn.get(this.vehicle.info.id))),true,null,-0.5,-0.5); + } + } + } + } + ,updateMovement: function() { + this.playerMovement.setMovement(this.playerXml.get("movement") + this.animation.substring(this.animation.lastIndexOf(".")),this.getFramesPerSecond()); + } + ,setInnerY: function(y) { + if(this.plight != null) { + this.plight.offY += y - this.inner.get_y(); + } + this.inner.set_y(y); + } + ,addLight: function() { + if(this.plight != null && this.vehicle.area != null && this.vehicle.area.renderer != null && this.vehicle.area.renderer.light != null) { + this.vehicle.area.renderer.light.addChild(this.plight); + } + } + ,update_equipment: function(e) { + var p = this.vehicle.getOwner(); + if(p != null) { + this.equipmentChanged(p); + } + } + ,updateLight: function() { + if(this.vlight == null) { + return; + } + var first = true; + var m = this.vehicle.equipment.iterator(); + while(m.hasNext()) { + var m1 = m.next(); + var e = m1.get(); + var l = e == null ? null : e.info.getLight(e.getNameStr()); + if(l != null) { + if(first) { + first = false; + this.vlight.update(l); + } else { + this.vlight.add(l); + } + } + } + var l1 = this.vehicle.getInfo().light; + if(l1 != null) { + if(first) { + this.vlight.update(l1); + } else { + this.vlight.add(l1); + } + } + } + ,equipmentChanged: function(player) { + if(this.plight == null) { + return; + } + var first = true; + var m = player.equipment.iterator(); + while(m.hasNext()) { + var m1 = m.next(); + var e = m1.get(); + var l = e == null ? null : e.info.getLight(e.getNameStr()); + if(l != null && e.info.canUse(player)) { + if(first) { + first = false; + this.plight.update(l); + } else { + this.plight.add(l); + } + } + } + if(first) { + this.plight.update(player.getInfo().light); + } + } + ,operateObject: function(o) { + o.onOperate(this.vehicle.getOwner()); + } + ,operateStructure: function(s) { + s.prepareOperate(this.vehicle.getOwner()); + } + ,checkObjectStructure: function(e) { + var o = this.vehicle.object; + var s = this.vehicle.structure; + if(o != null && o.area != this.vehicle.area) { + o = null; + } + if(s != null && s.area != this.vehicle.area) { + s = null; + } + if(this.vehicle.hasControl() && e.key == "select" && (o != null || s != null)) { + if(o != null) { + this.operateObject(o); + } else { + this.operateStructure(s); + } + this.vehicle.checkTooltip(); + return true; + } else { + return false; + } + } + ,onDismount: function() { + if(this.attacking) { + var attacking = this.equipment == null ? null : this.equipment.get("attack"); + var item = this.vehicle.equipment.getItem("attack"); + if(item == null || attacking == null) { + this.eqAttackRepeat = 0; + this.attacking = false; + return; + } + this.eqAttackRepeat = 0; + this.endAttack(item,attacking); + } + } + ,checkDismount: function(e) { + if(this.vehicle.hasControl() && this.vehicle.canDismount() && e.key == "select") { + this.vehicle.dismount(); + } + } + ,onKey: function(e) { + if(!this.checkObjectStructure(e)) { + this.checkDismount(e); + } + } + ,getVars: function() { + return this.vehicle.vars; + } + ,superRenderGL: function(renderSession) { + com_davidmaletz_mining_enemy_AttackRenderer.prototype.__renderGL.call(this,renderSession); + } + ,__renderGL: function(renderSession) { + if(this.glow) { + com_davidmaletz_faengfl_GlowSprite.makeGlow($bind(this,this.superRenderGL),renderSession); + } else { + com_davidmaletz_mining_enemy_AttackRenderer.prototype.__renderGL.call(this,renderSession); + } + } + ,getElement: function() { + return this.vehicle.getDefenseElement(); + } + ,getAttacker: function() { + return this.vehicle.player; + } + ,getSelf: function() { + return this.vehicle; + } + ,getArea: function() { + return this.vehicle.area; + } + ,onMiss: function(o) { + if(o == null) { + this.vehicle.showPopup(true,com_fancyfish_faeng_common_Lang.getText("common","miss"),-com_davidmaletz_tiles_Tile.SIZE); + } else { + o.showPopup(true,com_fancyfish_faeng_common_Lang.getText("common","dodged")); + } + com_davidmaletz_mining_world_Object.playObject(this.vehicle,"miss"); + } + ,getRectangle: function() { + return this.vehicle.getBounds(); + } + ,getAnim: function(id) { + return this.vehicle.getAnim(id); + } + ,isOwner: function() { + var p = this.vehicle.player; + if(p != null) { + return p == com_davidmaletz_mining_Main.getLocalPlayer(); + } else { + return false; + } + } + ,shouldAttack: function(o) { + if(Std["is"](o,com_davidmaletz_mining_enemy_Enemy)) { + var e = js_Boot.__cast(o , com_davidmaletz_mining_enemy_Enemy); + if(this.max_attack > e.getMinDefense() && !e.isSpirit()) { + return e.isVisible(); + } else { + return false; + } + } else { + return false; + } + } + ,makeBreath: function(o,a) { + if(this.aimX != null) { + o = null; + this.lastDX = this.aimX; + this.lastDY = this.aimY; + } else if(o == null) { + this.lastDX = -1000 * com_fancyfish_faeng_common_Utils.sign(this.get_scaleX()); + this.lastDY = 0; + } + return com_davidmaletz_mining_enemy_AttackRenderer.prototype.makeBreath.call(this,o,a); + } + ,getAttackTarget: function(a) { + var r = a.range + this.vehicle._width; + var b = this.vehicle.getClosest(r,1,false,$bind(this,this.canAttack),a.type == "breath" ? r >> 1 : 0); + if(b == null || this.getXDistance(b.bounds) > a.range) { + return null; + } else { + return b.object; + } + } + ,oldScaleX: null + ,getCamOffX: function() { + var dx = 50.0; + var s = com_davidmaletz_mining_Main.getGameScale(); + if(s > 1) { + dx = Math.max(dx,this.vehicle._width - 256 * s * 0.5 - com_davidmaletz_tiles_Tile.SIZE * 3); + } + return -com_fancyfish_faeng_common_Utils.sign(this.get_scaleX()) * (dx + this.camX); + } + ,getCamOffY: function() { + return this.camY; + } + ,updateScroll: function(instant) { + if(com_davidmaletz_mining_Main.currentAreaRenderer != null && this.vehicle.renderer == this) { + var area = com_davidmaletz_mining_Main.currentAreaRenderer; + var s = com_fancyfish_faeng_common_Utils.sign(this.get_scaleX()); + var tx = area.get_x(); + var ty = area.get_y(); + area.centerOn(this.get_x() + this.getCamOffX(),this.get_y() + this.getCamOffY(),true,instant); + if(!instant && s != this.oldScaleX) { + this.vehicle.smoothCamera(tx,ty); + } + this.oldScaleX = s; + } + } + ,getClosest: function(dx,dy,frames) { + var f = dy > 0 ? ($_=this.vehicle,$bind($_,$_.hitTileFall)) : ($_=this.vehicle,$bind($_,$_.hitTile)); + var a1 = frames; + var tmp = function(a2,a3,x,y) { + return f(a1,a2,a3,x,y); + }; + return com_davidmaletz_mining_world_vehicle_VehicleRenderer._getClosest(this.vehicle,tmp,dx,dy); + } + ,getSpeed: function(dx,dy) { + if(this.vehicle.efficiency.get().second > 0 && this.vehicle.getMaxFuel() > 0 && this.vehicle.getFuel() <= 0) { + return this.vehicle.getInfo().minSpeed(); + } else { + return this.vehicle.getInfo().getSpeed(dx,dy); + } + } + ,noMove: function(dx,dy,frames) { + if(this.vehicle.info.xml.get("type") == "mining" || this.vehicle.info.xml.get("showMine") == "true") { + var a = this.vehicle.getAnim("mine"); + if(!com_davidmaletz_tiles_TileAnimation.exists(a)) { + this.playMove(dx,dy); + } else if(this.animation != a) { + this.setFrame(0); + this.playAnimation(a,false); + } + } else { + this.playIdle(this); + } + } + ,onMove: function(dx,dy,frames,fuel) { + var _gthis = this; + var speed = this.getSpeed(dx,dy); + var s = Math.ceil(speed * frames); + if(s > com_davidmaletz_tiles_Tile.SIZE) { + frames = com_davidmaletz_tiles_Tile.SIZE / speed; + s = Math.ceil(speed * frames); + } + var b = this.getClosest(dx * s,dy * s,frames); + var of = frames; + if(this.vehicle.area == null || this.vehicle.getHealth() <= 0) { + return; + } + if(b != null) { + var adjust = function(b1) { + if(dx > 0) { + frames = Math.min(frames,(b1.bounds.x - (_gthis.vehicle.xPos + _gthis.vehicle._width)) / speed); + } else if(dx < 0) { + var frames1 = (_gthis.vehicle.xPos - b1.bounds.get_right()) / speed; + frames = Math.min(frames,frames1); + } + if(dy > 0) { + var frames2 = (b1.bounds.y - (_gthis.vehicle.yTop() + _gthis.vehicle._height)) / speed; + frames = Math.min(frames,frames2); + } else if(dy < 0) { + var top = _gthis.vehicle.yTop(); + var bot = b1.bounds.get_bottom(); + var tx = Math.round(b1.bounds.x / com_davidmaletz_tiles_Tile.SIZE); + var ty = Math.round(b1.bounds.y / com_davidmaletz_tiles_Tile.SIZE); + if(com_davidmaletz_mining_Player._getTileBlockId(_gthis.vehicle.area,_gthis.vehicle.get_tile_x(),_gthis.vehicle.get_tile_y(),tx,ty) == -1 && (!_gthis.vehicle.aboveGround || !_gthis.vehicle.hasBackTile(tx,ty))) { + bot -= _gthis.vehicle._height - com_davidmaletz_tiles_Tile.SIZE; + } + frames = Math.min(frames,(top - bot) / speed); + } + }; + adjust(b); + if(frames == 0 && this.autoAlign) { + var tx1 = Math.round(b.bounds.x / com_davidmaletz_tiles_Tile.SIZE); + var ty1 = Math.round(b.bounds.y / com_davidmaletz_tiles_Tile.SIZE); + if(com_davidmaletz_mining_Player._getTileBlockId(this.vehicle.area,this.vehicle.get_tile_x(),this.vehicle.get_tile_y(),tx1,ty1) != -1) { + if(dx != 0) { + dx = 0; + if(this.vehicle.yTile % com_davidmaletz_tiles_Tile.SIZE != 0 && b.bounds.y < this.vehicle.yTop()) { + dy = 1; + frames = Math.min(of,(b.bounds.get_bottom() - this.vehicle.yTop()) / speed); + } else if(this.vehicle.yTop() % com_davidmaletz_tiles_Tile.SIZE != 0 && b.bounds.get_bottom() > this.vehicle.yTile + com_davidmaletz_tiles_Tile.SIZE) { + dy = -1; + frames = Math.min(of,(this.vehicle.yTile + com_davidmaletz_tiles_Tile.SIZE - b.bounds.y) / speed); + } + } else if(dy != 0) { + dy = 0; + if((this.vehicle.xPos + this.vehicle._width) % com_davidmaletz_tiles_Tile.SIZE != 0 && b.bounds.x < this.vehicle.xPos) { + dx = 1; + frames = Math.min(of,(b.bounds.get_right() - this.vehicle.xPos) / speed); + } else if(this.vehicle.xPos % com_davidmaletz_tiles_Tile.SIZE != 0 && b.bounds.get_right() > this.vehicle.xPos + this.vehicle._width) { + dx = -1; + frames = Math.min(of,(this.vehicle.xPos + this.vehicle._width - b.bounds.x) / speed); + } + } + speed = this.getSpeed(dx,dy); + s = Math.ceil(speed * frames); + var b2 = this.getClosest(dx * s,dy * s,frames); + if(this.vehicle.area == null || this.vehicle.getHealth() <= 0) { + return; + } + if(b2 != null) { + adjust(b2); + } + } + } + } + if(frames > 0) { + this.doMove(dx,dy,frames,fuel); + } else { + this.noMove(dx,dy,frames); + } + } + ,move: function(dx,dy,frames) { + if(this.vehicle.efficiency.get().second > 0 && this.vehicle.getMaxFuel() > 0 && this.vehicle.getFuel() == 0) { + if(this.vehicle.hasControl()) { + this.vehicle.info.runEvent(this.vehicle.getOwner(),"onEmpty",this); + } + this.vehicle.showWarning(com_fancyfish_faeng_common_Lang.getText("warning",this.vehicle.fuelName)); + this.playIdle(this); + return; + } + if(this.vehicle.isOverweight()) { + this.vehicle.showWarning(com_fancyfish_faeng_common_Lang.getText("vehicle","overweight")); + this.playIdle(this); + return; + } + this.onMove(dx,dy,frames,true); + } + ,turn_ct: null + ,partial: null + ,moveCost: null + ,flyAnim: function() { + if(!this.vehicle._isFlying()) { + return this.vehicle.info.xml.get("flyMove") == "true"; + } else { + return true; + } + } + ,playMove: function(dx,dy) { + if(!this.attacking && this.vehicle.getHealth() > 0) { + var a; + if(this.vehicle.info.xml.get("swimAnim") == "true" && this.vehicle.isUnderwater()) { + a = this.getAnim("swim"); + } else { + a = this.getAnim(this.vehicle.info.xml.get("flyAnim") != "false" && this.flyAnim() ? dx == 0 ? "hover" : "fly" : "move"); + } + if(this.animation != a) { + this.playAnimation(a,true); + } + } + } + ,getIdleAnim: function() { + if(this.vehicle.isMounted() || !com_davidmaletz_tiles_TileAnimation.exists(this.getAnim("empty"))) { + return "idle"; + } else { + return "empty"; + } + } + ,playIdle: function(p) { + if(this.attacking) { + return; + } + var a; + var f = this.vehicle._isFlying() && this.vehicle.info.xml.get("flyAnim") != "false"; + if(f && this.reentry != 0 && this.vehicle.get_tile_y() < this.reentry) { + a = this.getAnim("reentry"); + } else { + a = this.getAnim(this.vehicle.info.xml.get("swimAnim") == "true" && this.vehicle.isUnderwater() ? "swim" : f ? "hover" : this.getIdleAnim()); + } + if(this.animation != a) { + this.playAnimation(a,true); + } + } + ,useFuel: function(s,quiet) { + if(quiet == null) { + quiet = false; + } + if(s == 0) { + return true; + } + var stamina = this.vehicle.info.xml.get("stamina") == "true"; + if(!stamina && this.vehicle.getMaxFuel() == 0) { + return true; + } + var mc = this.moveCost + s / com_davidmaletz_tiles_Tile.SIZE; + if(mc >= 1) { + var m = Math.floor(mc); + if(stamina) { + this.vehicle.getOwner().loseStamina(m); + if(!this.vehicle.hasControl()) { + return false; + } + } else if(this.vehicle.getFuel() < m) { + if(!quiet) { + this.vehicle.showWarning(com_fancyfish_faeng_common_Lang.getText("warning",this.vehicle.fuelName)); + } + this.playIdle(this); + return false; + } else { + this.vehicle.useFuel(m); + } + this.moveCost = mc - m; + } else { + this.moveCost = mc; + } + return true; + } + ,doMove: function(dx,dy,frames,fuel) { + var s = this.getSpeed(dx,dy) * frames; + var speed = Math.floor(s); + this.partial += s - speed; + if(this.partial >= 1) { + ++speed; + this.partial -= 1; + } + if(fuel && !this.useFuel(s * this.vehicle.efficiency.get().second)) { + return; + } + if(fuel) { + this.playMove(dx,dy); + } else { + this.playIdle(this); + } + var _x = this.vehicle.xPos + dx * speed; + var _y = this.vehicle.yTile + dy * speed; + if(dy != 0 && this.vehicle._offsetY != 0 && !this.vehicle._isFlying() && this.vehicle.isFlying(_x,_y)) { + var _g = this; + _g.set_y(_g.get_y() - this.vehicle._offsetY); + _y += this.vehicle._offsetY; + } + var o = this.vehicle.getOwner(); + if(o != null) { + if(dx > 0 && this.vehicle.area.right != null && _x >= this.vehicle.area.right.fromX * com_davidmaletz_tiles_Tile.SIZE) { + this.vehicle.area.right.enter(o,_x,_y); + } else if(dx < 0 && this.vehicle.area.left != null && _x <= this.vehicle.area.left.fromX * com_davidmaletz_tiles_Tile.SIZE) { + this.vehicle.area.left.enter(o,_x,_y); + } else if(dy > 0 && this.vehicle.area.down != null && _y >= this.vehicle.area.down.fromX * com_davidmaletz_tiles_Tile.SIZE) { + this.vehicle.area.down.enter(o,_x,_y); + } else if(dy < 0 && this.vehicle.area.up != null && _y <= this.vehicle.area.up.fromX * com_davidmaletz_tiles_Tile.SIZE) { + this.vehicle.area.up.enter(o,_x,_y); + } else { + var old = com_davidmaletz_faengfl_TouchAdapter.__is_action_key; + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + this.vehicle.setPosition(_x,_y); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = old; + } + } else { + this.vehicle.setPosition(_x,_y); + } + this.lightTiles(); + } + ,lightTiles: function() { + if(this.vehicle.hasControl()) { + this.vehicle.area.lightTiles(this.vehicle.get_tile_x(),Math.floor(this.vehicle.yTop() / com_davidmaletz_tiles_Tile.SIZE),this.vehicle.getOwner().getLightRange(),Math.ceil(this.vehicle._width / com_davidmaletz_tiles_Tile.SIZE),Math.ceil(this.vehicle._height / com_davidmaletz_tiles_Tile.SIZE)); + } + } + ,equipment: null + ,updateEquipment: function(slot) { + this.attacking = false; + if(this.equipment == null) { + this.equipment = new haxe_ds_StringMap(); + } else if(this.equipment.exists(slot)) { + com_davidmaletz_faengfl_FaengFL.remove(this.equipment.get(slot)); + } + var e = this.vehicle.equipment.getItem(slot); + if(e == null || !com_davidmaletz_tiles_Tile.exists(e.info.id)) { + return; + } + var p = (js_Boot.__cast(e.info , com_davidmaletz_mining_item_Equipment)).equipOn.get(this.vehicle.info.id); + var s = new com_davidmaletz_tiles_render_PlayAnimation(com_davidmaletz_tiles_Tile.get(e.info.id),e.info.getEquipAnim(e.getNameStr(),HxOverrides.substr(this.animation,this.animation.lastIndexOf(".") + 1,null),com_davidmaletz_mining_world_vehicle_VehicleRenderer.getAppend(p)),this.fps,true,null,-0.5,-0.5); + this.equipment.set(slot,s); + if(p != null) { + s.set_x(p.x); + s.set_y(p.y); + } + this.equipmentSprite.addChild(s); + } + ,swing: function(item,weap) { + var delay = weap.xml.exists("delay") ? com_davidmaletz_mining_Main.parseInt(weap.xml.get("delay")) : 2; + this.onUseEquipment(item); + var tmp = new com_davidmaletz_lerp_AlphaKeyframe(1); + var tmp1 = Math.round(delay / (this.getFramesPerSecond() / 60)); + var a1 = this.vehicle; + var p = this.vehicle; + var a2 = item; + var a3 = weap; + var a4 = this.getFramesPerSecond(); + this.lerp(tmp,tmp1,function() { + com_davidmaletz_mining_renderer_PlayerRenderer.checkSwing(a1,p,a2,a3,a4); + }); + } + ,endAttack: function(item,p) { + this.attacking = false; + this.__endTool(item); + } + ,attackComplete: function(a,p) { + this.attacking = false; + com_davidmaletz_mining_enemy_AttackRenderer.prototype.attackComplete.call(this,a,p); + } + ,endShowEquip: function(item,p) { + this.__endTool(item); + } + ,__useTool: function(item,slot,anim,loop,complete) { + this._showEquip = item; + var p = this.equipment.get(slot); + if(p != null) { + if(p.animation != anim) { + this.vehicle.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("use_tool",new com_fancyfish_faeng_common_Pair(slot,anim))); + } + p.playAnimation(anim,loop,complete,-0.5,-0.5); + } + p.setFrame(0); + } + ,__endTool: function(item) { + var slot = item.info.xml.get("slot"); + if(this._showEquip != null) { + this.vehicle.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("end_tool",slot)); + } + this._showEquip = null; + var p = this.equipment.get(slot); + if(p != null) { + p.playAnimation(item.info.getEquipAnim(item.getNameStr(),HxOverrides.substr(this.animation,this.animation.lastIndexOf(".") + 1,null),com_davidmaletz_mining_world_vehicle_VehicleRenderer.getAppend((js_Boot.__cast(item.info , com_davidmaletz_mining_item_Equipment)).equipOn.get(this.vehicle.info.id))),true,null,-0.5,-0.5); + } + } + ,showEquip: function(slot,anim) { + if(this.equipment != null && this.equipment.exists(slot)) { + var item = this.vehicle.equipment.getItem(slot); + if(item != null) { + var f = $bind(this,this.endShowEquip); + var a1 = item; + var tmp = function(p) { + f(a1,p); + }; + this.__useTool(item,slot,item.info.getEquipAnim(item.getNameStr(),anim,com_davidmaletz_mining_world_vehicle_VehicleRenderer.getAppend((js_Boot.__cast(item.info , com_davidmaletz_mining_item_Equipment)).equipOn.get(this.vehicle.info.id))),false,tmp); + } + } + } + ,eqAttackRepeat: null + ,_showEquip: null + ,endAttackRepeat: function(item,p) { + var slot = this.vehicle.equipment.get("attack"); + var i; + var tmp; + if(slot != null) { + i = slot.get(); + tmp = i != null; + } else { + tmp = false; + } + if(tmp) { + var p1 = i.getDefaultProjectile(); + if(p1 != null) { + p1.resetProjectile(); + } + i.info.resetProjectile(); + } + var s = this.equipment.get("attack"); + s.loop = false; + s.setFrame(s.getMaxFrame() - this.eqAttackRepeat,false); + this.eqAttackRepeat = 0; + } + ,useEquipment: function(eq) { + if(eq.info.xml.exists("repeat") && eq.info.xml.get("slot") == "attack") { + this.eqAttackRepeat = com_davidmaletz_mining_Main.parseFloat(eq.info.xml.get("repeat")); + } else { + this.eqAttackRepeat = 0; + } + return this._useEquipment(eq); + } + ,onUseEquipment: function(item) { + this.playIdle(this); + var slot = item.info.xml.get("slot"); + if(this.equipment != null && this.equipment.exists(slot)) { + var f = $bind(this,this.endAttack); + var a1 = item; + var tmp = function(p) { + f(a1,p); + }; + this.__useTool(item,slot,item.info.getEquipAnim(item.getNameStr(),null,com_davidmaletz_mining_world_vehicle_VehicleRenderer.getAppend((js_Boot.__cast(item.info , com_davidmaletz_mining_item_Equipment)).equipOn.get(this.vehicle.info.id))),item.info.xml.exists("repeat"),tmp); + this.attacking = true; + } + } + ,_useEquipment: function(item,projectile) { + if(this.vehicle.area != null && this.vehicle.useEquipment(item,projectile)) { + var weap = js_Boot.__cast(item.info , com_davidmaletz_mining_item_Equipment); + if(projectile == null) { + var p = item.getDefaultProjectile(); + if(p != null) { + projectile = p; + } else if(weap.xml.elementsNamed("projectile").hasNext()) { + projectile = weap; + } + } + if(projectile != null) { + var p1 = weap.equipOn.get(this.vehicle.info.id); + var tmp; + if(p1 != null) { + var f = $bind(this,this.canFire); + var tmp1 = function() { + return f(null); + }; + tmp = com_davidmaletz_mining_renderer_PlayerRenderer.fireProjectile(this.vehicle.getOwner(),this.vehicle.area,projectile,item,this,this.getFramesPerSecond() / 60,tmp1,Math.round(this.equipmentSprite.get_x() + (p1.x + p1.projX) * this.get_scaleX()),Math.round(this.equipmentSprite.get_y() + p1.y + p1.projY),p1.delay) != null; + } else { + tmp = false; + } + if(tmp) { + this.onUseEquipment(item); + this.vehicle.equipment.increaseValue(this.vehicle,item.info.xml.get("slot"),1); + } + } else { + this.swing(item,weap); + } + return true; + } else { + return false; + } + } + ,updateProjectile: function(p) { + p.xPos += Math.round(this.equipmentSprite.get_x()); + p.yPos += Math.round(this.equipmentSprite.get_y()); + } + ,tryAttack: function(attackKey) { + var slot = this.vehicle.equipment.get(attackKey ? "attack" : "defend"); + if(slot != null && slot.get() != null) { + return this.useEquipment(slot.get()); + } + var warn = false; + var _g = 0; + var _g1 = this.attacks; + while(_g < _g1.length) { + var a = _g1[_g]; + ++_g; + if(attackKey != (a.xml != null && a.xml.get("useDefend") == "true") && this.incType(a.type)) { + if(this.canUseAttack(a)) { + this.hit_count = 0; + this.attackWith(this.getAttackTarget(a),a); + return true; + } else if(com_davidmaletz_mining_enemy_AttackRenderer.prototype.canUseAttack.call(this,a)) { + if(!warn) { + if(this.checkState(a.xml.get("state"))) { + warn = a.cost > this.vehicle.getFuel(); + } else { + warn = false; + } + } else { + warn = true; + } + } else { + this.vehicle.showWarning(com_fancyfish_faeng_common_Lang.getText("warning","cooldown")); + warn = false; + } + } + } + if(warn) { + this.vehicle.showWarning(com_fancyfish_faeng_common_Lang.getText("warning",this.vehicle.fuelName)); + } + return false; + } + ,canBlock: function(info) { + var slot = this.vehicle.equipment.get("defend"); + if(slot != null) { + var i = slot.get(); + if(i != null) { + return i.info.xml.get("use") == "block"; + } else { + return false; + } + } else { + return info.block_icon != null; + } + } + ,__playBlock: function() { + if(this.vehicle.blocking) { + if(this.shieldSprite != null) { + this.shieldSprite.set_visible(true); + } else { + this.playAnimation(this.getAnim("block"),true); + } + } else if(this.shieldSprite != null) { + this.shieldSprite.set_visible(false); + } else { + this.playIdle(this); + } + } + ,tryDefend: function() { + var info = this.vehicle.getInfo(); + if(info.hasDefendAttack) { + return this.tryAttack(false); + } else if(this.canBlock(info)) { + if(!this.blockFuel || this.vehicle.getFuel() > 0) { + this.vehicle.blocking = true; + this.__playBlock(); + return this.vehicle.info.xml.get("block_move") != "true"; + } else { + this.vehicle.showWarning(com_fancyfish_faeng_common_Lang.getText("warning",this.vehicle.fuelName)); + return false; + } + } else { + return false; + } + } + ,set_scaleX: function(value) { + return com_davidmaletz_mining_enemy_AttackRenderer.prototype.set_scaleX.call(this,value); + } + ,handleControl: function(frames) { + if(!this.attacking && com_davidmaletz_controls_Controller.instance.isPressed(10) && this.tryAttack(true)) { + return; + } + if(!this.attacking && com_davidmaletz_controls_Controller.instance.isPressed(12) && this.tryDefend()) { + return; + } + var left = com_davidmaletz_controls_Controller.instance.isPressed(4); + var right = com_davidmaletz_controls_Controller.instance.isPressed(6); + var up = com_davidmaletz_controls_Controller.instance.isPressed(0); + var down = com_davidmaletz_controls_Controller.instance.isPressed(2); + if(this.vehicle.horizontal && (left || right) && left != right) { + if(this.vehicle.info.xml.get("canFlip") != "false" && this.get_scaleX() == this.get_scaleY() != left) { + this.set_scaleX(-this.get_scaleX()); + this.vehicle.onFlip(); + this.turn_ct = 5; + } + if(this.turn_ct <= 0) { + this.move(left ? -1 : 1,0,frames); + } + } else if(this.vehicle.vertical && (up || down) && up != down) { + this.move(0,up ? -1 : 1,frames); + } else { + this.playIdle(this); + } + } + ,canControl: function() { + if(this.player != null && this.player.get_numChildren() > 0) { + return (js_Boot.__cast(this.player.getChildAt(0) , com_davidmaletz_mining_renderer_SimplePlayerRenderer)).equipComplete == null; + } else { + return true; + } + } + ,checkFrame: function(frames) { + if(!this.vehicle.canEnterTile(this.vehicle.get_tile_x(),Math.floor(this.vehicle.yTile / com_davidmaletz_tiles_Tile.SIZE))) { + var old = this.vehicle.yTile; + this.onMove(0,1,frames,false); + return old == this.vehicle.yTile; + } else { + return true; + } + } + ,second: null + ,o2partial: null + ,crushWarning: null + ,enter_frame: function(frames) { + if(!this.vehicle.hasControl() || com_davidmaletz_faengfl_Window.window_ct == 0) { + com_davidmaletz_mining_enemy_AttackRenderer.prototype.enter_frame.call(this,frames); + } + } + ,canAdvanceModal: function() { + return true; + } + ,advanceFrame: function(frames) { + if(frames > 999 || this.vehicle.renderer != this) { + this.__advanceFrame(frames); + return; + } + com_davidmaletz_mining_enemy_AttackRenderer.prototype.advanceFrame.call(this,frames); + var p = this.vehicle.getOwner(); + var wasBlocking = this.vehicle.blocking; + if(this.player != null && this.player.parent != null && this.plight != null && this.player.get_numChildren() > 0) { + var c = this.player.getChildAt(0); + var tmp = this.player.get_x(); + var tmp1 = this.player.parent == this.inner ? this.inner.get_x() : 0; + var tmp2 = c.get_x(); + this.plight.offX = tmp + tmp1 + tmp2; + var tmp3 = this.player.get_y(); + var tmp4 = this.player.parent == this.inner ? this.inner.get_y() : 0; + var tmp5 = c.get_y(); + this.plight.offY = tmp3 + tmp4 + tmp5; + if(this.plight.link == null) { + this.plight.set_x(this.plight.offX); + this.plight.set_y(this.plight.offY); + } + } + if(p != null && p != com_davidmaletz_mining_Main.getLocalPlayer()) { + if(this.bar != null) { + this.bar.set_alpha(1); + } + return; + } + if(this.shieldSprite != null) { + this.shieldSprite.set_visible(false); + } + if(this.hasTrack(com_davidmaletz_lerp_PositionKeyframe)) { + var rem = 0.0; + var k = this.getLerp(com_davidmaletz_lerp_PositionKeyframe); + if(k != null) { + rem = k.getFrame() - this.getFrame(com_davidmaletz_lerp_PositionKeyframe); + } + frames -= rem; + } + if(this.turn_ct > 0) { + this.turn_ct -= frames; + } + var control = this.vehicle.hasControl(); + if(this.bar != null) { + this.bar.set_alpha(control ? 0 : 1); + } + var canBreathe = true; + if(p != null && (p.getOxygenPercent() < 1 || !this.vehicle.hasO2) && !this.vehicle.isDrone()) { + if(this.vehicle.area == null) { + return; + } + var _x = this.vehicle.xPos; + var _y = this.vehicle.yTile; + if(this.player != null) { + _x += Math.round(this.player.get_x() - com_davidmaletz_tiles_Tile.SIZE * 0.5); + _y = this.vehicle.yTop() + Math.round(this.player.get_y() - com_davidmaletz_tiles_Tile.SIZE * 0.5); + } + if(!this.vehicle.hasO2) { + if(!this.vehicle.area.isWater(Math.round(_x / com_davidmaletz_tiles_Tile.SIZE),Math.round(_y / com_davidmaletz_tiles_Tile.SIZE))) { + canBreathe = this.vehicle.area.hasOxygen(); + } else { + canBreathe = false; + } + } else { + canBreathe = true; + } + if(canBreathe && frames > 0) { + var of = Math.floor(frames); + this.o2partial += frames - of; + if(this.o2partial >= 1) { + ++of; + this.o2partial -= 1; + } + p.addOxygen(of); + } + } + if(this.vehicle.area == null) { + return; + } + if(control) { + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + this.vehicle.objectOverlapCheck(); + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + if(this.vehicle.area == null) { + return; + } + } + if(!this.checkFrame(frames)) { + if(control && com_davidmaletz_faengfl_Window.window_ct == 0) { + this.updateScroll(false); + } + this.vehicle.blocking = false; + return; + } + this.second -= frames; + if(this.vehicle.area != null && this.vehicle.isUnderwater()) { + var d = com_davidmaletz_mining_Player._getCrushDepth(this.vehicle.area,this.vehicle.getTileCenterX(),this.vehicle.get_tile_y(),this.vehicle.max_depth.get().second); + if(d > 0) { + if(this.crushWarning == null) { + this.crushWarning = new com_davidmaletz_faengfl_ui_Popup(128.,52.,0,com_fancyfish_faeng_common_Lang.getText("warning","crush"),16720418,-16777216,20,60,20); + if(p == null) { + com_davidmaletz_faengfl_FaengFL.remove(this.crushWarning); + } + } else if(this.crushWarning.stage == null && this.second < 0) { + this.vehicle.loseHealth(d * 5); + } + } else { + this.crushWarning = null; + } + } else { + this.crushWarning = null; + } + if(this.second < 0) { + this.second += 60; + if(this.second < 0) { + this.second = 0; + } + this.vehicle.handleSecond(); + if(!canBreathe) { + p.loseOxygen(1); + } + } + if(this.vehicle.area != null && frames > 0 && control && com_davidmaletz_faengfl_Window.window_ct == 0 && this.animation != this.getAnim("mount")) { + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = true; + this.vehicle.blocking = false; + if(!this.attacking || this.vehicle.info.xml.get("attack_move") == "true") { + if(this.canControl()) { + this.handleControl(frames); + } else { + this.playIdle(this); + } + if(!this.attacking) { + this.aimX = null; + this.aimY = null; + } + } + if(this.attacking) { + if(this.currentAttack != null && this.currentAttack.type == "breath") { + var up = com_davidmaletz_controls_Controller.instance.isPressed(0); + var down = com_davidmaletz_controls_Controller.instance.isPressed(2); + if((up || down) && up != down) { + if(this.aimX == null) { + this.aimX = this.lastDX; + this.aimY = this.lastDY; + } + this.normalizeAim(); + this.aimY += up ? -50 : 50; + } + } + if(this.eqAttackRepeat > 0) { + var attacking = this.equipment.get("attack"); + var item = this.vehicle.equipment.getItem("attack"); + if(item == null || attacking == null) { + this.eqAttackRepeat = 0; + this.attacking = false; + return; + } + if(com_davidmaletz_controls_Controller.instance.isPressed(10)) { + this.eqAttackRepeat -= frames; + if(this.eqAttackRepeat <= 0) { + var f = attacking.getAnimFrame(); + if(this.useEquipment(item)) { + attacking.setFrame(f,true); + } else { + this.endAttackRepeat(item,attacking); + } + } + } else { + this.endAttackRepeat(item,attacking); + } + } + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + if(com_davidmaletz_faengfl_Window.window_ct == 0) { + this.updateScroll(false); + } + } else { + this.vehicle.blocking = false; + } + if(wasBlocking != this.vehicle.blocking) { + this.vehicle.dispatchEvent(new openfl_events_Event("blocking")); + } + } + ,__class__: com_davidmaletz_mining_world_vehicle_VehicleRenderer +}); +var com_davidmaletz_mining_world_vehicle__$Boat_BoatRenderer = function(v) { + com_davidmaletz_mining_world_vehicle_VehicleRenderer.call(this,v); + this.waterLine = v.info.xml.exists("waterLine") ? com_davidmaletz_mining_Main.parseFloat(v.info.xml.get("waterLine")) - v._height : 0; +}; +$hxClasses["com.davidmaletz.mining.world.vehicle._Boat.BoatRenderer"] = com_davidmaletz_mining_world_vehicle__$Boat_BoatRenderer; +com_davidmaletz_mining_world_vehicle__$Boat_BoatRenderer.__name__ = ["com","davidmaletz","mining","world","vehicle","_Boat","BoatRenderer"]; +com_davidmaletz_mining_world_vehicle__$Boat_BoatRenderer.__super__ = com_davidmaletz_mining_world_vehicle_VehicleRenderer; +com_davidmaletz_mining_world_vehicle__$Boat_BoatRenderer.prototype = $extend(com_davidmaletz_mining_world_vehicle_VehicleRenderer.prototype,{ + waterLine: null + ,init: function(e) { + com_davidmaletz_mining_world_vehicle_VehicleRenderer.prototype.init.call(this,e); + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.handle_frame),false,-1); + this.handle_frame(null); + } + ,destroy: function(e) { + com_davidmaletz_mining_world_vehicle_VehicleRenderer.prototype.destroy.call(this,e); + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.handle_frame)); + } + ,onKey: function(e) { + if(this.checkObjectStructure(e)) { + return; + } + if(this.vehicle.hasControl() && !this.vehicle.canDismount() && e.key == "select" && this.player != null && this.player.get_numChildren() > 0) { + var r = js_Boot.__cast(this.player.getChildAt(0) , com_davidmaletz_mining_renderer_SimplePlayerRenderer); + var p = this.vehicle.getOwner(); + var rod = p.getFishingRod(); + if(r.equipComplete == null && rod != null && this.vehicle.area.isFishable(this.vehicle.get_tile_x(),this.vehicle.get_tile_y()) == 1 && p.useEquipment(rod)) { + var eq = js_Boot.__cast(rod.info , com_davidmaletz_mining_item_Equipment); + r.useTool(eq,null,rod.getName(),"weapon"); + var f = ($_=new com_davidmaletz_mining_effects_Fishing(rod,r,this.vehicle.area,true),$bind($_,$_.start)); + r.equipComplete = function(a2) { + f(1,a2); + }; + p.increaseValue(rod,1); + var _g = 0; + var _g1 = eq.slots; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + if(p.vanity.getItemUsed(s) == null) { + r.sprite.hideSlot(s); + } + } + } + } else { + this.checkDismount(e); + } + } + ,checkFrame: function(frames) { + return true; + } + ,handle_frame: function(e) { + if(this.vehicle.area != null && this.vehicle.area.renderer != null) { + var ty = -Math.round(com_davidmaletz_mining_renderer_Parallax.getWaveHeight(this.get_x() + this.vehicle.area.renderer.get_x()) + this.waterLine); + if(this.anim_sprite != null) { + this.anim_sprite.set_y(ty); + } + if(this.inner != null) { + this.setInnerY(Math.round(ty - this.vehicle._height * 0.5)); + } + this.equipmentSprite.set_y(ty); + } + if(this.vehicle.hasControl() && (this.player == null || this.player.get_numChildren() == 0 || (js_Boot.__cast(this.player.getChildAt(0) , com_davidmaletz_mining_renderer_SimplePlayerRenderer)).equipComplete == null)) { + (js_Boot.__cast(this.vehicle , com_davidmaletz_mining_world_vehicle_Boat)).checkDismount(); + } + } + ,__class__: com_davidmaletz_mining_world_vehicle__$Boat_BoatRenderer +}); +var com_davidmaletz_mining_world_vehicle_OffsetKeyframe = function(o,_y) { + if(_y == null) { + _y = 0; + } + this.obj = o; + this.y = _y; +}; +$hxClasses["com.davidmaletz.mining.world.vehicle.OffsetKeyframe"] = com_davidmaletz_mining_world_vehicle_OffsetKeyframe; +com_davidmaletz_mining_world_vehicle_OffsetKeyframe.__name__ = ["com","davidmaletz","mining","world","vehicle","OffsetKeyframe"]; +com_davidmaletz_mining_world_vehicle_OffsetKeyframe.__interfaces__ = [com_davidmaletz_lerp_Keyframe]; +com_davidmaletz_mining_world_vehicle_OffsetKeyframe.prototype = { + obj: null + ,frame: null + ,y: null + ,set: function(from) { + var k = js_Boot.__cast(from , com_davidmaletz_mining_world_vehicle_OffsetKeyframe); + this.obj = k.obj; + this.y = k.y; + } + ,setFromObject: function(a) { + this.y = this.obj._offsetY; + } + ,getFrame: function() { + return this.frame; + } + ,setFrame: function(f) { + this.frame = f; + } + ,interp: function(track,other,f) { + var k = js_Boot.__cast(other , com_davidmaletz_mining_world_vehicle_OffsetKeyframe); + return new com_davidmaletz_mining_world_vehicle_OffsetKeyframe(this.obj,Math.round(track.interp(this.y,k.y,f))); + } + ,apply: function(a) { + this.obj.setOffsetY(this.y); + } + ,__class__: com_davidmaletz_mining_world_vehicle_OffsetKeyframe +}; +var com_davidmaletz_mining_world_vehicle_Flying = function(info,x,y) { + this._dismount = true; + com_davidmaletz_mining_world_vehicle_Vehicle.call(this,info,x,y); + this.horizontal = !this.aboveGround; +}; +$hxClasses["com.davidmaletz.mining.world.vehicle.Flying"] = com_davidmaletz_mining_world_vehicle_Flying; +com_davidmaletz_mining_world_vehicle_Flying.__name__ = ["com","davidmaletz","mining","world","vehicle","Flying"]; +com_davidmaletz_mining_world_vehicle_Flying.__super__ = com_davidmaletz_mining_world_vehicle_Vehicle; +com_davidmaletz_mining_world_vehicle_Flying.prototype = $extend(com_davidmaletz_mining_world_vehicle_Vehicle.prototype,{ + _dismount: null + ,addedToArea: function() { + com_davidmaletz_mining_world_vehicle_Vehicle.prototype.addedToArea.call(this); + if(this._isFlying()) { + this._dismount = false; + this.horizontal = true; + this.hideFlyTooltip(); + if(!this.canDismount()) { + this.hideTooltip(); + } + } + } + ,canDismount: function() { + if(this._canDismount) { + if(this.info.xml.get("dismountFlying") == "true") { + return true; + } else { + return this._dismount; + } + } else { + return false; + } + } + ,createRenderer: function() { + return new com_davidmaletz_mining_world_vehicle__$Flying_FlyingRenderer(this); + } + ,onFlight: function() { + this._dismount = false; + this.horizontal = true; + } + ,onLand: function() { + var old = this.canDismount(); + this._dismount = true; + this.horizontal = !this.aboveGround; + if(!old) { + this.showDismount(); + } + this.showFlyTooltip(); + } + ,flyWater: function() { + return this.info.xml.get("landOnWater") != "true"; + } + ,onMount: function() { + com_davidmaletz_mining_world_vehicle_Vehicle.prototype.onMount.call(this); + if(this._dismount) { + this.showFlyTooltip(); + } + } + ,onDismount: function(p) { + com_davidmaletz_mining_world_vehicle_Vehicle.prototype.onDismount.call(this,p); + if(this._isFlying()) { + this._dismount = false; + this.horizontal = true; + } else { + this._dismount = true; + this.horizontal = !this.aboveGround; + } + this.hideFlyTooltip(); + } + ,removedFromArea: function(area) { + com_davidmaletz_mining_world_vehicle_Vehicle.prototype.removedFromArea.call(this,area); + this.hideFlyTooltip(); + } + ,flyTooltip: null + ,showFlyTooltip: function() { + if(this.area == null || !this.aboveGround || !this.hasControl()) { + return; + } + this.hideFlyTooltip(); + this.flyTooltip = new com_davidmaletz_mining_ui_KeyTooltip(true,"up",128.,112,com_fancyfish_faeng_common_Lang.getText("vehicle","fly")); + this.flyTooltip.show(); + } + ,hideFlyTooltip: function() { + if(this.flyTooltip != null) { + var d = this.flyTooltip; + var tmp = function() { + com_davidmaletz_faengfl_FaengFL.remove(d); + }; + this.flyTooltip.lerp(new com_davidmaletz_lerp_AlphaKeyframe(0),10,tmp); + this.flyTooltip = null; + } + } + ,intersects: function(r,issect) { + var b = this.getBounds(); + if(this.renderer != null && (js_Boot.__cast(this.renderer , com_davidmaletz_mining_world_vehicle__$Flying_FlyingRenderer)).isOnWater()) { + var _g = b; + _g.set_bottom(_g.get_bottom() + com_davidmaletz_tiles_Tile.SIZE * 0.5); + } + return com_fancyfish_faeng_pack_AABBObjectList.intersects(r,b,issect); + } + ,__class__: com_davidmaletz_mining_world_vehicle_Flying +}); +var com_davidmaletz_mining_world_vehicle__$Flying_FlyingRenderer = function(v) { + this.__disable_init_destroy = false; + this.onWater = null; + com_davidmaletz_mining_world_vehicle_VehicleRenderer.call(this,v); + this.waterLine = v.info.xml.exists("waterLine") ? com_davidmaletz_mining_Main.parseFloat(v.info.xml.get("waterLine")) - v._height : -6; +}; +$hxClasses["com.davidmaletz.mining.world.vehicle._Flying.FlyingRenderer"] = com_davidmaletz_mining_world_vehicle__$Flying_FlyingRenderer; +com_davidmaletz_mining_world_vehicle__$Flying_FlyingRenderer.__name__ = ["com","davidmaletz","mining","world","vehicle","_Flying","FlyingRenderer"]; +com_davidmaletz_mining_world_vehicle__$Flying_FlyingRenderer.__super__ = com_davidmaletz_mining_world_vehicle_VehicleRenderer; +com_davidmaletz_mining_world_vehicle__$Flying_FlyingRenderer.prototype = $extend(com_davidmaletz_mining_world_vehicle_VehicleRenderer.prototype,{ + waterLine: null + ,onMove: function(dx,dy,frames,fuel) { + if(!this.vehicle.canFly() && dy <= 0) { + if(dy < 0) { + this.vehicle.showWarning(com_fancyfish_faeng_common_Lang.getText("vehicle","flight_height")); + } + com_davidmaletz_mining_world_vehicle_VehicleRenderer.prototype.noMove.call(this,dx,dy,frames); + return; + } + var f = js_Boot.__cast(this.vehicle , com_davidmaletz_mining_world_vehicle_Flying); + var swim = this.vehicle.info.xml.get("swimAnim") == "true"; + if(swim) { + var wasUnderwater = this.vehicle.isUnderwater(); + if(wasUnderwater) { + com_davidmaletz_mining_world_vehicle_VehicleRenderer.prototype.onMove.call(this,dx,dy,frames,fuel); + if(!this.vehicle.isUnderwater()) { + f.playAnim("toLand"); + this.vehicle.playSound("exit_sea"); + } + return; + } + } + var wasFlying = f._isFlying(); + if(!wasFlying && !this.vehicle.isAboveFlightHeight() && f.isFlying(f.xPos + Math.floor(f.getInfo().speedX * 2 + this.partial) * dx,f.yTile + Math.floor(f.getInfo().speedY * 2 + this.partial) * dy)) { + if(dy < 0) { + f.setPosition(f.xPos,Math.floor(f.yTile / com_davidmaletz_tiles_Tile.SIZE) * com_davidmaletz_tiles_Tile.SIZE); + } else if(dy > 0) { + f.setPosition(f.xPos,Math.ceil(f.yTile / com_davidmaletz_tiles_Tile.SIZE) * com_davidmaletz_tiles_Tile.SIZE); + } + f.horizontal = false; + f._dismount = false; + if(!f.canDismount()) { + f.hideTooltip(); + } + f.hideFlyTooltip(); + var f1 = $bind(this,this.onFlight); + var dx1 = dx * 2; + var dy1 = dy; + f.playAnim("takeoff",function() { + f1(dx1,dy1); + }); + this.vehicle.playSound("takeoff"); + return; + } + if(!f.horizontal && dy > 0) { + return; + } + com_davidmaletz_mining_world_vehicle_VehicleRenderer.prototype.onMove.call(this,dx,dy,frames,fuel); + if(swim && this.vehicle.isUnderwater()) { + f.playAnim("toSea"); + this.vehicle.playSound("enter_sea"); + } else if(wasFlying && !f._isFlying()) { + f.playAnim("land",$bind(f,f.onLand)); + this.vehicle.playSound("land"); + } + } + ,init: function(e) { + if(this.__disable_init_destroy) { + return; + } + com_davidmaletz_mining_world_vehicle_VehicleRenderer.prototype.init.call(this,e); + if(this.vehicle.info.xml.get("landOnWater") == "true") { + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.handle_frame),false,-1); + } + var f = js_Boot.__cast(this.vehicle , com_davidmaletz_mining_world_vehicle_Flying); + if(!f._dismount && !f._isFlying()) { + f.playAnim("land",$bind(f,f.onLand)); + } + } + ,destroy: function(e) { + if(this.__disable_init_destroy) { + return; + } + com_davidmaletz_mining_world_vehicle_VehicleRenderer.prototype.destroy.call(this,e); + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.handle_frame)); + } + ,isOnWater: function() { + return this.onWater != null; + } + ,onWater: null + ,__disable_init_destroy: null + ,handle_frame: function(e) { + if(this.vehicle.area != null && this.vehicle.area.renderer != null) { + var w = this.vehicle.area.isWater(this.vehicle.getTileCenterX(),this.vehicle.get_tile_y() + 1) && !this.vehicle._isFlying() && this.vehicle._offsetY == 0 && this.vehicle.get_tile_y() + 1 == this.vehicle.area.waterLevel; + if(w != this.isOnWater()) { + this.__disable_init_destroy = true; + if(w) { + this.onWater = this.parent; + this.vehicle.area.renderer.back.addChild(this); + } else { + this.onWater.addChild(this); + this.onWater = null; + } + this.__disable_init_destroy = false; + } + var ty = w ? -Math.round(com_davidmaletz_mining_renderer_Parallax.getWaveHeight(this.get_x() + this.vehicle.area.renderer.get_x()) + this.waterLine) : 0; + if(this.anim_sprite != null) { + this.anim_sprite.set_y(ty); + } + if(this.inner != null) { + this.setInnerY(Math.round(ty - this.vehicle._height * 0.5)); + } + this.equipmentSprite.set_y(ty); + } + } + ,onFlight: function(dx,dy) { + (js_Boot.__cast(this.vehicle , com_davidmaletz_mining_world_vehicle_Flying)).onFlight(); + com_davidmaletz_mining_world_vehicle_VehicleRenderer.prototype.onMove.call(this,dx,dy,1,false); + } + ,noMove: function(dx,dy,frames) { + if(dy < 0 && this.vehicle.isAboveFlightHeight(1)) { + this.vehicle.showWarning(com_fancyfish_faeng_common_Lang.getText("vehicle","flight_height")); + } + com_davidmaletz_mining_world_vehicle_VehicleRenderer.prototype.noMove.call(this,dx,dy,frames); + } + ,handleControl: function(frames) { + if(this.vehicle._isFlying() && !this.useFuel(frames * this.vehicle.efficiency.get().second,true) || this.vehicle.isAboveFlightHeight() && this.vehicle._isFlying()) { + var old = this.vehicle.yTile; + this.onMove(0,1,frames,false); + if(this.vehicle._isFlying()) { + if(old == this.vehicle.yTile && this.vehicle.info.xml.get("explodeCliff") != "false") { + this.vehicle.loseHealth(this.vehicle.getHealth(),6,this.vehicle); + } else { + var left = com_davidmaletz_controls_Controller.instance.isPressed(4); + var right = com_davidmaletz_controls_Controller.instance.isPressed(6); + if((left || right) && left != right) { + if(this.get_scaleX() == this.get_scaleY() != left) { + this.set_scaleX(-this.get_scaleX()); + this.vehicle.onFlip(); + this.turn_ct = 5; + } + if(this.turn_ct <= 0) { + this.onMove(left ? -1 : 1,0,frames,false); + } + } + } + } + } else if(this.animation != this.getAnim("takeoff") && this.animation != this.getAnim("land") && this.animation != this.getAnim("toLand") && this.animation != this.getAnim("toSea")) { + com_davidmaletz_mining_world_vehicle_VehicleRenderer.prototype.handleControl.call(this,frames); + } + } + ,checkFrame: function(frames) { + if(!com_davidmaletz_mining_world_vehicle_VehicleRenderer.prototype.checkFrame.call(this,frames)) { + return false; + } + if(this.vehicle.area != null && this.vehicle._isFlying() && !this.vehicle.area.isOrbit() && this.vehicle.isOverweight()) { + this.onMove(0,1,frames,false); + } + return true; + } + ,flyAnim: function() { + if(!this.vehicle._isFlying()) { + return this.vehicle.info.xml.get("flyMove") != "false"; + } else { + return true; + } + } + ,__class__: com_davidmaletz_mining_world_vehicle__$Flying_FlyingRenderer +}); +var com_davidmaletz_mining_world_vehicle_Jumping = function(info,x,y) { + info.flight_height = 10000; + com_davidmaletz_mining_world_vehicle_Vehicle.call(this,info,x,y); +}; +$hxClasses["com.davidmaletz.mining.world.vehicle.Jumping"] = com_davidmaletz_mining_world_vehicle_Jumping; +com_davidmaletz_mining_world_vehicle_Jumping.__name__ = ["com","davidmaletz","mining","world","vehicle","Jumping"]; +com_davidmaletz_mining_world_vehicle_Jumping.__super__ = com_davidmaletz_mining_world_vehicle_Vehicle; +com_davidmaletz_mining_world_vehicle_Jumping.prototype = $extend(com_davidmaletz_mining_world_vehicle_Vehicle.prototype,{ + createRenderer: function() { + return new com_davidmaletz_mining_world_vehicle__$Jumping_JumpingRenderer(this); + } + ,isFlying: function(_x,_y) { + if(this.area != null) { + var s = Math.floor(_x / com_davidmaletz_tiles_Tile.SIZE); + var e = Math.floor((_x + this._width - 1) / com_davidmaletz_tiles_Tile.SIZE) + 1; + var y = Math.ceil((_y + 1) / com_davidmaletz_tiles_Tile.SIZE); + var ct = 0; + var _g1 = s; + var _g = e; + while(_g1 < _g) { + var x = _g1++; + if((this.flyWater() || !this.area.isWater(x,y)) && this.area.getTileId(x,y,0) == -1 && !this.hasBackTile(x,y)) { + ++ct; + } + } + return ct >= e - s; + } + return false; + } + ,__class__: com_davidmaletz_mining_world_vehicle_Jumping +}); +var com_davidmaletz_mining_world_vehicle__$Jumping_JumpingRenderer = function(v) { + this.jumpPad = 0; + this.remaining = 0; + com_davidmaletz_mining_world_vehicle_VehicleRenderer.call(this,v); + this.jump_frames = v.info.xml.exists("jump") ? com_davidmaletz_mining_Main.parseFloat(v.info.xml.get("jump")) : 0; + this.autoAlign = false; + this.jumpXSpeed = v.info.xml.exists("jumpXSpeed") ? com_davidmaletz_mining_Main.parseFloat(v.info.xml.get("jumpXSpeed")) : 1; +}; +$hxClasses["com.davidmaletz.mining.world.vehicle._Jumping.JumpingRenderer"] = com_davidmaletz_mining_world_vehicle__$Jumping_JumpingRenderer; +com_davidmaletz_mining_world_vehicle__$Jumping_JumpingRenderer.__name__ = ["com","davidmaletz","mining","world","vehicle","_Jumping","JumpingRenderer"]; +com_davidmaletz_mining_world_vehicle__$Jumping_JumpingRenderer.__super__ = com_davidmaletz_mining_world_vehicle_VehicleRenderer; +com_davidmaletz_mining_world_vehicle__$Jumping_JumpingRenderer.prototype = $extend(com_davidmaletz_mining_world_vehicle_VehicleRenderer.prototype,{ + remaining: null + ,jump_frames: null + ,jumpXSpeed: null + ,jumpPad: null + ,isUp: function() { + if(!com_davidmaletz_controls_Controller.instance.isPressed(0)) { + if(!this.vehicle.canDismount()) { + return com_davidmaletz_controls_Controller.instance.isPressed(8); + } else { + return false; + } + } else { + return true; + } + } + ,handleControl: function(frames) { + var f = this.vehicle._isFlying(); + if(f) { + if(this.jumpPad > 0) { + this.jumpPad -= frames; + if(this.jumpPad < 0) { + this.remaining += this.jumpPad; + } + } else { + this.remaining -= frames; + } + } else { + this.jumpPad = 4; + this.remaining = this.jump_frames; + } + if(this.jumpPad > 0 && this.isUp()) { + this.jumpPad = 0; + this.remaining = this.jump_frames; + var oldY = this.vehicle.yTile; + this.onMove(0,-1,frames,false); + if(oldY != this.vehicle.yTile) { + var sfx = this.vehicle.info.xml.get("jump_sfx"); + if(sfx != null) { + com_davidmaletz_faengfl_adv_sound_Sound.play(sfx); + } + return; + } + } + if(f) { + if(this.remaining > 0 && this.isUp()) { + this.onMove(0,-1,frames,false); + } else { + this.remaining = 0; + var old = this.vehicle.yTile; + this.onMove(0,1,frames,false); + if(!this.vehicle._isFlying()) { + return; + } + } + var left = com_davidmaletz_controls_Controller.instance.isPressed(4); + var right = com_davidmaletz_controls_Controller.instance.isPressed(6); + if((left || right) && left != right) { + if(this.get_scaleX() == this.get_scaleY() != left) { + this.set_scaleX(-this.get_scaleX()); + this.vehicle.onFlip(); + this.turn_ct = 5; + } + if(this.turn_ct <= 0) { + this.onMove(left ? -1 : 1,0,frames * this.jumpXSpeed,false); + } + } + if(!this.attacking && this.vehicle.info.xml.get("attack_move") == "true") { + if(com_davidmaletz_controls_Controller.instance.isPressed(10) && this.tryAttack(true)) { + return; + } + if(com_davidmaletz_controls_Controller.instance.isPressed(12) && this.tryDefend()) { + return; + } + } + } else { + com_davidmaletz_mining_world_vehicle_VehicleRenderer.prototype.handleControl.call(this,frames); + } + } + ,__class__: com_davidmaletz_mining_world_vehicle__$Jumping_JumpingRenderer +}); +var com_davidmaletz_mining_world_vehicle_Mining = function(info,x,y) { + com_davidmaletz_mining_world_vehicle_Vehicle.call(this,info,x,y); +}; +$hxClasses["com.davidmaletz.mining.world.vehicle.Mining"] = com_davidmaletz_mining_world_vehicle_Mining; +com_davidmaletz_mining_world_vehicle_Mining.__name__ = ["com","davidmaletz","mining","world","vehicle","Mining"]; +com_davidmaletz_mining_world_vehicle_Mining.__super__ = com_davidmaletz_mining_world_vehicle_Vehicle; +com_davidmaletz_mining_world_vehicle_Mining.prototype = $extend(com_davidmaletz_mining_world_vehicle_Vehicle.prototype,{ + canInteract: function(o,l) { + if(o.get_alpha() > 0 && o != this) { + if(o.info.xml.get("miningVehicle") != "true") { + return this.isCollectable(o); + } else { + return true; + } + } else { + return false; + } + } + ,canInteractStructure: function(s) { + return s.info.xml.get("miningVehicle") == "true"; + } + ,updateTooltip: function() { + if(this.hasControl()) { + this.checkTooltip(); + } else { + this.hideTooltip(); + } + } + ,onPositionChanged: function() { + com_davidmaletz_mining_world_vehicle_Vehicle.prototype.onPositionChanged.call(this); + this.updateTooltip(); + } + ,onFlip: function() { + com_davidmaletz_mining_world_vehicle_Vehicle.prototype.onFlip.call(this); + this.updateTooltip(); + } + ,onMount: function() { + com_davidmaletz_mining_world_vehicle_Vehicle.prototype.onMount.call(this); + this.updateTooltip(); + } + ,__class__: com_davidmaletz_mining_world_vehicle_Mining +}); +var com_davidmaletz_mining_world_vehicle_Shield = function(xml) { + this.tile = xml.get("tile"); + this.animation = xml.get("animation"); + this.hit_front = xml.get("hit_front"); + this.hit_back = xml.get("hit_back"); + this.showBaseOnHit = xml.get("showBaseOnHit") != "false"; + this.loop_sfx = xml.get("loop"); + this.hit_sfx = xml.get("hit_sfx"); +}; +$hxClasses["com.davidmaletz.mining.world.vehicle.Shield"] = com_davidmaletz_mining_world_vehicle_Shield; +com_davidmaletz_mining_world_vehicle_Shield.__name__ = ["com","davidmaletz","mining","world","vehicle","Shield"]; +com_davidmaletz_mining_world_vehicle_Shield.prototype = { + tile: null + ,animation: null + ,loop_sfx: null + ,hit_sfx: null + ,hit_front: null + ,hit_back: null + ,showBaseOnHit: null + ,__class__: com_davidmaletz_mining_world_vehicle_Shield +}; +var com_davidmaletz_mining_world_vehicle_Spaceship = function(info,x,y) { + com_davidmaletz_mining_world_vehicle_Flying.call(this,info,x,y); + if(!info.xml.exists("hasO2")) { + this.hasO2 = true; + } +}; +$hxClasses["com.davidmaletz.mining.world.vehicle.Spaceship"] = com_davidmaletz_mining_world_vehicle_Spaceship; +com_davidmaletz_mining_world_vehicle_Spaceship.__name__ = ["com","davidmaletz","mining","world","vehicle","Spaceship"]; +com_davidmaletz_mining_world_vehicle_Spaceship.__super__ = com_davidmaletz_mining_world_vehicle_Flying; +com_davidmaletz_mining_world_vehicle_Spaceship.prototype = $extend(com_davidmaletz_mining_world_vehicle_Flying.prototype,{ + canDismount: function() { + return this._canDismount; + } + ,canJump: function() { + return this.info.xml.get("canJump") != "false"; + } + ,canFly: function() { + return this.area.canFly(); + } + ,getDefaultTooltip: function() { + return com_fancyfish_faeng_common_Lang.getText("structure.tooltip","spaceship"); + } + ,canInteract: function(o,l) { + if(!((!this.aboveGround || o.area.isEmptyTile(o.get_tile_x(),o.get_tile_y() + 1) || Std["is"](o,com_davidmaletz_mining_world_ItemObject) && !(js_Boot.__cast(o , com_davidmaletz_mining_world_ItemObject)).getInfo().item.info.hasActionId("place")) && com_davidmaletz_mining_world_vehicle_Flying.prototype.canInteract.call(this,o,l))) { + if(o.get_alpha() > 0 && o != this) { + return o.info.xml.get("spaceship") == "true"; + } else { + return false; + } + } else { + return true; + } + } + ,canInteractStructure: function(s) { + return s.info.xml.get("spaceship") == "true"; + } + ,onPositionChanged: function() { + com_davidmaletz_mining_world_vehicle_Flying.prototype.onPositionChanged.call(this); + if(this.hasControl()) { + this.checkTooltip(); + } + } + ,onFlip: function() { + com_davidmaletz_mining_world_vehicle_Flying.prototype.onFlip.call(this); + if(this.hasControl()) { + this.checkTooltip(); + } + } + ,onMount: function() { + com_davidmaletz_mining_world_vehicle_Flying.prototype.onMount.call(this); + if(this.hasControl()) { + this.checkTooltip(); + } + } + ,__class__: com_davidmaletz_mining_world_vehicle_Spaceship +}); +var com_davidmaletz_mining_world_vehicle_Submarine = function(info,x,y) { + this.oxygenWarning = true; + com_davidmaletz_mining_world_vehicle_Vehicle.call(this,info,x,y); + this.max_oxygen = info.xml.exists("oxygen") ? com_davidmaletz_mining_Main.parseInt(info.xml.get("oxygen")) : 100; + this.oxygen = this.getMaxOxygen(); + if(!this.hasO2) { + this.hasO2 = this.oxygen > 0; + } +}; +$hxClasses["com.davidmaletz.mining.world.vehicle.Submarine"] = com_davidmaletz_mining_world_vehicle_Submarine; +com_davidmaletz_mining_world_vehicle_Submarine.__name__ = ["com","davidmaletz","mining","world","vehicle","Submarine"]; +com_davidmaletz_mining_world_vehicle_Submarine.__interfaces__ = [com_davidmaletz_mining_world_IOxygen]; +com_davidmaletz_mining_world_vehicle_Submarine.__super__ = com_davidmaletz_mining_world_vehicle_Vehicle; +com_davidmaletz_mining_world_vehicle_Submarine.prototype = $extend(com_davidmaletz_mining_world_vehicle_Vehicle.prototype,{ + pos: null + ,oxygen: null + ,max_oxygen: null + ,isFlying: function(_x,_y) { + return false; + } + ,canEnterTile: function(x,y) { + return this.area.isWater(x,y); + } + ,hitTileFall: function(frames,addBounds,bot,x,y) { + if(this.area.getTileId(x,y,0) != -1) { + com_davidmaletz_mining_world_Object.rectangle.setTo(x * com_davidmaletz_tiles_Tile.SIZE,y * com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE,com_davidmaletz_tiles_Tile.SIZE); + addBounds(null,com_davidmaletz_mining_world_Object.rectangle); + } + return false; + } + ,updateFuel: function(d) { + com_davidmaletz_mining_world_vehicle_Vehicle.prototype.updateFuel.call(this,d); + if(this.hasControl()) { + if(this.canDismount()) { + if(this.tooltip == null) { + this.showDismount(); + } + } else { + this.hideTooltip(); + } + } + } + ,canDismount: function() { + if(this._canDismount && this.area != null) { + if(!(this.info.xml.get("underwaterDismount") == "true" || this.getMaxFuel() > 0 && this.fuel == 0 || this.isOverweight() || !this.area.isWater(this.get_tile_x(),this.get_tile_y()) || this.pos != null)) { + return this.isDrone(); + } else { + return true; + } + } else { + return false; + } + } + ,createRenderer: function() { + return new com_davidmaletz_mining_world_vehicle__$Submarine_SubmarineRenderer(this); + } + ,atSurface: function() { + if(this.area != null) { + return this.get_tile_y() == this.area.waterLevel; + } else { + return false; + } + } + ,canPlacePlayer: function(x,y) { + this.player.area = this.area; + var ret = this.player.canEnterTile(x,y); + this.player.area = null; + return ret; + } + ,isBack: function() { + return false; + } + ,canInteract: function(o,l) { + if(o.get_alpha() > 0 && o != this) { + if(o.info.xml.get("submarine") != "true") { + return this.isCollectable(o); + } else { + return true; + } + } else { + return false; + } + } + ,canInteractStructure: function(s) { + return s.info.xml.get("submarine") == "true"; + } + ,dismountPriority: function() { + if(!this.isDrone()) { + return this.info.xml.get("underwaterDismount") != "true"; + } else { + return false; + } + } + ,getInteractBounds: function() { + var b = this.getBounds(); + if(this.renderer != null) { + b.x -= com_fancyfish_faeng_common_Utils.sign(this.renderer.get_scaleX()) * com_davidmaletz_tiles_Tile.SIZE; + } + return b; + } + ,dismountPos: function(player) { + if(this.pos == null) { + com_davidmaletz_mining_world_vehicle_Vehicle.prototype.dismountPos.call(this,player); + } else { + player.setPosition(this.pos.x * com_davidmaletz_tiles_Tile.SIZE,this.pos.y * com_davidmaletz_tiles_Tile.SIZE); + } + } + ,checkDismount: function() { + var x = this.xPos; + var y = this.yTop(); + if(this.renderer != null && this.area != null && this.hasControl()) { + var px; + var py = Math.floor(y / com_davidmaletz_tiles_Tile.SIZE); + if(this.renderer.get_scaleX() == -this.renderer.get_scaleY()) { + px = Math.ceil((x + this._width - com_davidmaletz_tiles_Tile.SIZE + 1) / com_davidmaletz_tiles_Tile.SIZE); + } else { + px = Math.floor((x - 1) / com_davidmaletz_tiles_Tile.SIZE); + } + if(this.area.getTileId(px,py,0) == -1 && !this.area.isWater(px,py) && this.canPlacePlayer(px,py)) { + if(this.pos == null) { + this.pos = new com_fancyfish_faeng_display_IPoint2D(px,py); + } else { + this.pos.set(px,py); + } + this.checkTooltip(); + return; + } + } + if(this.pos != null) { + this.pos = null; + } + if(this.hasControl()) { + this.checkTooltip(); + } else { + this.hideTooltip(); + } + } + ,getOxygen: function() { + return this.oxygen; + } + ,getMaxOxygen: function() { + return this.max_oxygen; + } + ,getOxygenPercent: function() { + return this.getOxygen() / this.getMaxOxygen(); + } + ,oxygenWarning: null + ,addOxygen: function(o) { + o += this.oxygen; + var max = this.getMaxOxygen(); + if(o > max) { + o = max; + } + if(o != this.oxygen) { + this.oxygen = o; + this.hasO2 = o > 0; + this.oxygenWarning = true; + this.dispatchEvent(new openfl_events_Event("change_oxygen")); + } + } + ,setOxygen: function(o) { + if(o < this.oxygen) { + this.loseOxygen(this.oxygen - o); + } else { + this.addOxygen(o - this.oxygen); + } + } + ,loseOxygen: function(o) { + o = this.oxygen - o; + if(o <= 0) { + this.oxygen = 0; + this.hasO2 = false; + this.dispatchEvent(new openfl_events_Event("change_oxygen")); + } else if(o != this.oxygen) { + this.oxygen = o; + this.hasO2 = true; + this.dispatchEvent(new openfl_events_Event("change_oxygen")); + } + } + ,hasOxygen: function() { + if(this.isSurface()) { + return this.area.hasOxygen(); + } else { + return false; + } + } + ,isSurface: function() { + if(this.area == null) { + return false; + } else { + var px = this.get_tile_x(); + var py = Math.floor(this.yTop() / com_davidmaletz_tiles_Tile.SIZE); + if(this.area.getTileId(px,py,0) == -1) { + return !this.area.isWater(px,py); + } else { + return false; + } + } + } + ,onPositionChanged: function() { + com_davidmaletz_mining_world_vehicle_Vehicle.prototype.onPositionChanged.call(this); + this.checkDismount(); + } + ,onFlip: function() { + com_davidmaletz_mining_world_vehicle_Vehicle.prototype.onFlip.call(this); + this.checkDismount(); + } + ,intersects: function(r,issect) { + return com_davidmaletz_mining_world_vehicle_Vehicle.prototype.intersects.call(this,r,this.isMounted() ? issect : 0); + } + ,onMount: function() { + com_davidmaletz_mining_world_vehicle_Vehicle.prototype.onMount.call(this); + this.checkDismount(); + } + ,writeInner: function(b,mounted) { + com_davidmaletz_mining_world_vehicle_Vehicle.prototype.writeInner.call(this,b,mounted); + b.writeUInt16(this.oxygen); + } + ,readInner: function(b,version,mounted) { + com_davidmaletz_mining_world_vehicle_Vehicle.prototype.readInner.call(this,b,version,mounted); + if(version >= 55) { + this.oxygen = b.readUInt16(); + } else { + this.oxygen = 0; + } + } + ,__class__: com_davidmaletz_mining_world_vehicle_Submarine +}); +var com_davidmaletz_mining_world_vehicle__$Submarine_SubmarineRenderer = function(v) { + this.o2partial2 = 0; + this.o2second = 60; + this.flight = null; + com_davidmaletz_mining_world_vehicle_VehicleRenderer.call(this,v); + this.sub = v; +}; +$hxClasses["com.davidmaletz.mining.world.vehicle._Submarine.SubmarineRenderer"] = com_davidmaletz_mining_world_vehicle__$Submarine_SubmarineRenderer; +com_davidmaletz_mining_world_vehicle__$Submarine_SubmarineRenderer.__name__ = ["com","davidmaletz","mining","world","vehicle","_Submarine","SubmarineRenderer"]; +com_davidmaletz_mining_world_vehicle__$Submarine_SubmarineRenderer.__super__ = com_davidmaletz_mining_world_vehicle_VehicleRenderer; +com_davidmaletz_mining_world_vehicle__$Submarine_SubmarineRenderer.prototype = $extend(com_davidmaletz_mining_world_vehicle_VehicleRenderer.prototype,{ + sub: null + ,flight: null + ,init: function(e) { + com_davidmaletz_mining_world_vehicle_VehicleRenderer.prototype.init.call(this,e); + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.handle_frame),false,-1); + this.handle_frame(null); + } + ,destroy: function(e) { + com_davidmaletz_mining_world_vehicle_VehicleRenderer.prototype.destroy.call(this,e); + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.handle_frame)); + } + ,handle_frame: function(e) { + if(this.sub.area != null && this.sub.area.renderer != null) { + var ty = this.sub.atSurface() ? -Math.round(com_davidmaletz_mining_renderer_Parallax.getWaveHeight(this.get_x() + this.sub.area.renderer.get_x(),true)) : 0; + if(this.anim_sprite != null) { + this.anim_sprite.set_y(ty); + } + if(this.inner != null) { + this.setInnerY(Math.round(ty - this.vehicle._height * 0.5)); + } + this.equipmentSprite.set_y(ty); + } + if(this.sub.hasControl()) { + var f = this.sub.getOwner().getFlight(); + if(f == null) { + if(this.flight != null) { + this.flight = null; + this.sub.checkDismount(); + } + } else if(f.flight.height != this.flight) { + this.flight = f.flight.height; + this.sub.checkDismount(); + } + } + } + ,onMove: function(dx,dy,frames,fuel) { + var s = js_Boot.__cast(this.vehicle , com_davidmaletz_mining_world_vehicle_Submarine); + var wasUnderwater = s.isSurface(); + if(wasUnderwater) { + com_davidmaletz_mining_world_vehicle_VehicleRenderer.prototype.onMove.call(this,dx,dy,frames,fuel); + if(!s.isSurface()) { + s.playAnim("dive"); + this.vehicle.playSound("dive"); + } + return; + } + com_davidmaletz_mining_world_vehicle_VehicleRenderer.prototype.onMove.call(this,dx,dy,frames,fuel); + if(s.isSurface()) { + s.playAnim("surface"); + this.vehicle.playSound("surface"); + } + } + ,checkFrame: function(frames) { + if(!com_davidmaletz_mining_world_vehicle_VehicleRenderer.prototype.checkFrame.call(this,frames)) { + return false; + } + if(this.vehicle.isOverweight()) { + this.onMove(0,1,frames,false); + } + return true; + } + ,operateObject: function(o) { + com_davidmaletz_mining_world_vehicle_VehicleRenderer.prototype.operateObject.call(this,o); + var anim = this.getAnim("collect"); + if(com_davidmaletz_tiles_TileAnimation.exists(anim)) { + this.vehicle.playSound("collect"); + this.attacking = true; + this.playAnimation(anim,false,$bind(this,this._attackIdle)); + this.vehicle.dispatchEvent(new com_davidmaletz_faengfl_events_ObjectEvent("play","collect")); + } + } + ,o2second: null + ,o2partial2: null + ,advanceFrame: function(frames) { + com_davidmaletz_mining_world_vehicle_VehicleRenderer.prototype.advanceFrame.call(this,frames); + if(this.sub.getMaxOxygen() > 0 && this.sub.hasControl()) { + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = this.sub.hasControl(); + if(this.sub.hasOxygen()) { + var f = Math.floor(frames); + this.o2partial2 += frames - f; + if(this.o2partial2 >= 1) { + ++f; + this.o2partial2 -= 1; + } + this.sub.addOxygen(f); + } else if(this.sub.isMounted()) { + this.o2second -= frames; + if(this.o2second < 0) { + this.o2second += 60; + if(this.o2second < 0) { + this.o2second = 0; + } + this.sub.loseOxygen(1); + } + } + com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; + } + } + ,__class__: com_davidmaletz_mining_world_vehicle__$Submarine_SubmarineRenderer +}); +var com_davidmaletz_mining_world_vehicle__$Vehicle_VEquip = function(v,p) { + this.vehicle = v; + this.player = p; + if(v.isDrone()) { + this.inv = p.inventory; + } else { + this.inv = new com_davidmaletz_mining_item_CompoundInventory([v.inventory,p.inventory]); + } + new com_davidmaletz_faengfl_InvokeLater($bind(this,this.destroyInv),0); +}; +$hxClasses["com.davidmaletz.mining.world.vehicle._Vehicle.VEquip"] = com_davidmaletz_mining_world_vehicle__$Vehicle_VEquip; +com_davidmaletz_mining_world_vehicle__$Vehicle_VEquip.__name__ = ["com","davidmaletz","mining","world","vehicle","_Vehicle","VEquip"]; +com_davidmaletz_mining_world_vehicle__$Vehicle_VEquip.__interfaces__ = [com_davidmaletz_mining_world_IEquippable]; +com_davidmaletz_mining_world_vehicle__$Vehicle_VEquip.prototype = { + vehicle: null + ,player: null + ,inv: null + ,destroyInv: function() { + if(Std["is"](this.inv,com_davidmaletz_mining_item_CompoundInventory)) { + (js_Boot.__cast(this.inv , com_davidmaletz_mining_item_CompoundInventory)).destroy(); + } + } + ,getInventory: function() { + return this.inv; + } + ,getEquipment: function() { + return this.vehicle.getEquipment(); + } + ,getId: function() { + return this.vehicle.getId(); + } + ,getOwner: function() { + return this.player; + } + ,getXml: function() { + return this.vehicle.getXml(); + } + ,setAbility: function(a) { + this.vehicle.setAbility(a); + } + ,removeAbility: function(a) { + this.vehicle.removeAbility(a); + } + ,__class__: com_davidmaletz_mining_world_vehicle__$Vehicle_VEquip +}; +var com_davidmaletz_mining_world_vehicle_VehicleInfo = function(xml) { + com_davidmaletz_mining_world_RideableInfo.call(this,xml); + this.flight_height = xml.exists("flight_height") ? com_davidmaletz_mining_Main.parseInt(xml.get("flight_height")) : null; + this.speedX = xml.exists("speed") ? com_davidmaletz_mining_Main.parseFloat(xml.get("speed")) : 1; + this.block_icon = xml.get("block_icon"); + if(xml.exists("speedY")) { + this.speedY = com_davidmaletz_mining_Main.parseFloat(xml.get("speedY")); + } else { + this.speedY = this.speedX; + } + if(xml.exists("fuel")) { + this.fuel = com_davidmaletz_mining_Main.parseInt(xml.get("fuel")); + } else { + this.fuel = 0; + } + this.max_weight = new com_fancyfish_faeng_common_mutable_Static(xml.get("drone") != "true" && xml.exists("max_weight") ? com_davidmaletz_mining_Main.parseInt(xml.get("max_weight")) : 0); + this.bgm = xml.get("bgm"); + var i = xml.elementsNamed("shield"); + if(i.hasNext()) { + this.shield = new com_davidmaletz_mining_world_vehicle_Shield(i.next()); + } + if(xml.exists("type")) { + var cls = xml.get("type").toLowerCase(); + cls = cls.charAt(0).toUpperCase() + HxOverrides.substr(cls,1,null); + var c = Type.resolveClass("com.davidmaletz.mining.world.vehicle." + cls); + if(c != null) { + this.type = c; + } + } + var e = xml.elementsNamed("repair"); + while(e.hasNext()) { + var e1 = e.next(); + var i1 = com_davidmaletz_mining_item_ItemInfo.get(e1.get("id")); + if(i1 != null) { + if(this.repairItems == null) { + this.repairItems = []; + this.repairMap = new haxe_ds_StringMap(); + } + var val = com_davidmaletz_mining_Main.parseInt(e1.get("value")); + this.repairItems.push(new com_davidmaletz_mining_item_ItemCt(i1,val)); + this.repairMap.set(i1.id,val); + } + } + var e2 = xml.elementsNamed("fuel"); + while(e2.hasNext()) { + var e3 = e2.next(); + var i2 = com_davidmaletz_mining_item_ItemInfo.get(e3.get("id")); + if(i2 != null) { + if(this.fuelItems == null) { + this.fuelItems = []; + this.fuelMap = new haxe_ds_StringMap(); + } + var val1 = com_davidmaletz_mining_Main.parseInt(e3.get("fuel")); + this.fuelItems.push(com_davidmaletz_mining_item_Recipe.createFuel(i2,val1)); + this.fuelMap.set(i2.id,val1); + } + } + this.hasDefendAttack = false; + var _g = 0; + var _g1 = this.attacks; + while(_g < _g1.length) { + var a = _g1[_g]; + ++_g; + if(a.xml != null && a.xml.get("useDefend") == "true") { + this.hasDefendAttack = true; + } + } + var i3 = xml.elementsNamed("collectBounds"); + if(i3.hasNext()) { + this.collectBounds = com_davidmaletz_mining_renderer_Parallax.makeRect(i3.next(),1); + } + if(this.collectBounds == null && (this.type == com_davidmaletz_mining_world_vehicle_Spaceship || xml.get("collectFullBounds") == "true")) { + var t = com_davidmaletz_tiles_Tile.get(this.tile); + if(t != null) { + this.collectBounds = new openfl_geom_Rectangle(0,0,t.getWidth(),t.getHeight()); + } else if(this.tile != null) { + haxe_Log.trace("Warning: can not auto set collection bounds of " + this.id + ", tile is not set",{ fileName : "VehicleInfo.hx", lineNumber : 54, className : "com.davidmaletz.mining.world.vehicle.VehicleInfo", methodName : "new"}); + } + } + var i4 = xml.elementsNamed("operateHitbox"); + if(i4.hasNext()) { + this.operateHitbox = com_davidmaletz_mining_renderer_Parallax.makeRect(i4.next(),1); + } + var r = com_davidmaletz_mining_ui_CraftingWindow.getRecipes(null,xml); + while(r.hasNext()) { + var r1 = r.next(); + var i5 = r1.getFirstRequirement(); + if(r1.fuel > 0 && i5 != null) { + if(this.fuelMap == null) { + this.fuelMap = new haxe_ds_StringMap(); + } + this.fuelMap.set(i5.id,r1.fuel); + } + } + var e4 = xml.elementPathsNamed("ability"); + while(e4.hasNext()) { + var e5 = e4.next(); + var a1 = new com_davidmaletz_mining_world_vehicle_Ability(e5); + if(a1.hotkey >= 0) { + if(this.abilities == null) { + this.abilities = new haxe_ds_IntMap(); + } + this.abilities.set(a1.hotkey,a1); + } + } + this.max_depth = xml.exists("max_depth") ? com_davidmaletz_mining_Main.parseInt(xml.get("max_depth")) : 80; +}; +$hxClasses["com.davidmaletz.mining.world.vehicle.VehicleInfo"] = com_davidmaletz_mining_world_vehicle_VehicleInfo; +com_davidmaletz_mining_world_vehicle_VehicleInfo.__name__ = ["com","davidmaletz","mining","world","vehicle","VehicleInfo"]; +com_davidmaletz_mining_world_vehicle_VehicleInfo.__super__ = com_davidmaletz_mining_world_RideableInfo; +com_davidmaletz_mining_world_vehicle_VehicleInfo.prototype = $extend(com_davidmaletz_mining_world_RideableInfo.prototype,{ + type: null + ,flight_height: null + ,max_weight: null + ,speedX: null + ,speedY: null + ,fuel: null + ,repairItems: null + ,repairMap: null + ,shield: null + ,fuelItems: null + ,fuelMap: null + ,block_icon: null + ,operateHitbox: null + ,abilities: null + ,max_depth: null + ,hasDefendAttack: null + ,collectBounds: null + ,bgm: null + ,getRepairItems: function() { + if(this.repairItems == null) { + return new com_fancyfish_faeng_common_NullIterator(); + } else { + return HxOverrides.iter(this.repairItems); + } + } + ,getRepairAmount: function(id) { + var ret = this.repairMap == null ? null : this.repairMap.get(id); + if(ret == null) { + return 0; + } else { + return ret; + } + } + ,getFuelItems: function() { + if(this.fuelItems == null) { + return new com_fancyfish_faeng_common_NullIterator(); + } else { + return HxOverrides.iter(this.fuelItems); + } + } + ,getFuelAmount: function(id) { + var ret = this.fuelMap == null ? null : this.fuelMap.get(id); + if(ret == null) { + return 0; + } else { + return ret; + } + } + ,getSpeed: function(dx,dy) { + if(dx == 0) { + return this.speedY; + } else { + return this.speedX; + } + } + ,minSpeed: function() { + return Math.min(this.speedX,this.speedY); + } + ,getAbility: function(i) { + if(this.abilities == null) { + return null; + } else { + return this.abilities.get(i); + } + } + ,create: function(x,y) { + if(this.type == null) { + return new com_davidmaletz_mining_world_vehicle_Vehicle(this,x,y); + } else { + return Type.createInstance(this.type,[this,x,y]); + } + } + ,getType: function() { + return "vehicle"; + } + ,modifyOperateHitbox: function(r,f) { + if(this.operateHitbox != null) { + if(f > 0) { + r.x += this.operateHitbox.x; + } else { + r.x += r.width - this.operateHitbox.x - this.operateHitbox.width; + } + r.y += this.operateHitbox.y; + r.width = this.operateHitbox.width; + r.height = this.operateHitbox.height; + } + } + ,__class__: com_davidmaletz_mining_world_vehicle_VehicleInfo +}); +var com_davidmaletz_tiles_Autotile = function(xml) { + this.groups = []; + var tiles = []; + var e = xml.elementsNamed("tile"); + while(e.hasNext()) { + var e1 = e.next(); + tiles.push(new com_davidmaletz_tiles__$Autotile_TilePos(e1)); + } + if(tiles.length != 0) { + this.groups.push(tiles); + } + var g = xml.elementsNamed("group"); + while(g.hasNext()) { + var g1 = g.next(); + var tiles1 = []; + var e2 = g1.elementsNamed("tile"); + while(e2.hasNext()) { + var e3 = e2.next(); + tiles1.push(new com_davidmaletz_tiles__$Autotile_TilePos(e3)); + } + if(tiles1.length != 0) { + this.groups.push(tiles1); + } + } +}; +$hxClasses["com.davidmaletz.tiles.Autotile"] = com_davidmaletz_tiles_Autotile; +com_davidmaletz_tiles_Autotile.__name__ = ["com","davidmaletz","tiles","Autotile"]; +com_davidmaletz_tiles_Autotile.autotiles = null; +com_davidmaletz_tiles_Autotile.reset = function() { + com_davidmaletz_tiles_Autotile.autotiles = null; +}; +com_davidmaletz_tiles_Autotile.setAutotile = function(id,e) { + if(com_davidmaletz_tiles_Autotile.autotiles == null) { + com_davidmaletz_tiles_Autotile.autotiles = new haxe_ds_StringMap(); + } + if(com_davidmaletz_tiles_Autotile.autotiles.exists(id)) { + haxe_Log.trace("Overwrite Autotile: " + id,{ fileName : "Autotile.hx", lineNumber : 25, className : "com.davidmaletz.tiles.Autotile", methodName : "setAutotile"}); + } + com_davidmaletz_tiles_Autotile.autotiles.set(id,new com_davidmaletz_tiles_Autotile(e)); +}; +com_davidmaletz_tiles_Autotile.get = function(id) { + var ret = com_davidmaletz_tiles_Autotile._get(id); + if(id != null && ret == null) { + haxe_Log.trace("No Autoile found: " + id,{ fileName : "Autotile.hx", lineNumber : 28, className : "com.davidmaletz.tiles.Autotile", methodName : "get"}); + } + return ret; +}; +com_davidmaletz_tiles_Autotile._get = function(id) { + if(id == null || com_davidmaletz_tiles_Autotile.autotiles == null) { + return null; + } else { + return com_davidmaletz_tiles_Autotile.autotiles.get(id); + } +}; +com_davidmaletz_tiles_Autotile.prototype = { + groups: null + ,render: function(mask,layer,tx,ty,sheet,x,y) { + var _g = 0; + var _g1 = this.groups; + while(_g < _g1.length) { + var tiles = _g1[_g]; + ++_g; + var _g2 = 0; + while(_g2 < tiles.length) { + var t = tiles[_g2]; + ++_g2; + if(t.render(mask,layer,tx,ty,sheet,x,y)) { + break; + } + } + } + } + ,__class__: com_davidmaletz_tiles_Autotile +}; +var com_davidmaletz_tiles__$Autotile_TilePos = function(e) { + this.loadMask(e.get("neighbors")); + this.x = Std.parseInt(e.get("x")); + this.y = e.exists("y") ? Std.parseInt(e.get("y")) : 0; + if(e.exists("width")) { + this.width = Std.parseInt(e.get("width")); + } else { + this.width = 1; + } + if(e.exists("height")) { + this.height = Std.parseInt(e.get("height")); + } else { + this.height = 1; + } + if(e.exists("offsetX")) { + this.offX = Std.parseFloat(e.get("offsetX")); + } else { + this.offX = 0; + } + if(e.exists("offsetY")) { + this.offY = Std.parseFloat(e.get("offsetY")); + } else { + this.offY = 0; + } + var p = e.elementsNamed("tile"); + while(p.hasNext()) { + var p1 = p.next(); + if(this.inner == null) { + this.inner = [new com_davidmaletz_tiles__$Autotile_TilePos(p1)]; + } else { + this.inner.push(new com_davidmaletz_tiles__$Autotile_TilePos(p1)); + } + } +}; +$hxClasses["com.davidmaletz.tiles._Autotile.TilePos"] = com_davidmaletz_tiles__$Autotile_TilePos; +com_davidmaletz_tiles__$Autotile_TilePos.__name__ = ["com","davidmaletz","tiles","_Autotile","TilePos"]; +com_davidmaletz_tiles__$Autotile_TilePos.prototype = { + mask: null + ,inv_mask: null + ,x: null + ,y: null + ,width: null + ,height: null + ,offX: null + ,offY: null + ,inner: null + ,render: function(mask,layer,tx,ty,sheet,x,y) { + if((this.mask & ~mask) == 0 && (this.inv_mask & mask) == 0) { + var sz = com_davidmaletz_tiles_Tile.SIZE >> 1; + var _g1 = 0; + var _g = this.height; + while(_g1 < _g) { + var oy = _g1++; + var _g3 = 0; + var _g2 = this.width; + while(_g3 < _g2) { + var ox = _g3++; + sheet.addTile(layer.handler,x + this.x + ox,y + this.y + oy,tx + ox * sz + this.offX,ty + oy * sz + this.offY); + } + } + if(this.inner != null) { + var _g4 = 0; + var _g11 = this.inner; + while(_g4 < _g11.length) { + var t = _g11[_g4]; + ++_g4; + if(t.render(mask,layer,tx,ty,sheet,x,y)) { + break; + } + } + } + return true; + } else { + return false; + } + } + ,loadMask: function(neighbors) { + this.mask = 0; + this.inv_mask = 0; + if(neighbors == null) { + return; + } + var ar = neighbors.split(","); + var len = com_davidmaletz_tiles__$Autotile_TilePos.neighbor_names.length; + var _g = 0; + while(_g < ar.length) { + var str = ar[_g]; + ++_g; + var _g2 = 0; + var _g1 = len; + while(_g2 < _g1) { + var i = _g2++; + if(com_davidmaletz_tiles__$Autotile_TilePos.neighbor_names[i] == str) { + this.mask |= com_davidmaletz_tiles__$Autotile_TilePos.neighbor_values[i]; + break; + } + if("n" + com_davidmaletz_tiles__$Autotile_TilePos.neighbor_names[i] == str) { + this.inv_mask |= com_davidmaletz_tiles__$Autotile_TilePos.neighbor_values[i]; + break; + } + } + } + } + ,__class__: com_davidmaletz_tiles__$Autotile_TilePos +}; +var com_davidmaletz_tiles_Chunk = function(x,y) { + this.x = x; + this.y = y; + this.tiles = []; + this.clear(); +}; +$hxClasses["com.davidmaletz.tiles.Chunk"] = com_davidmaletz_tiles_Chunk; +com_davidmaletz_tiles_Chunk.__name__ = ["com","davidmaletz","tiles","Chunk"]; +com_davidmaletz_tiles_Chunk.pack = function(t,layer,tile) { + t &= ~(255 << layer * 8); + t |= (tile + 1 & 255) << layer * 8; + return t; +}; +com_davidmaletz_tiles_Chunk.read = function(b,x,y) { + var c = new com_davidmaletz_tiles_Chunk(x,y); + var e = 256; + var _g1 = 0; + var _g = e; + while(_g1 < _g) { + var i = _g1++; + c.tiles[i] = b.readInt32(); + } + return c; +}; +com_davidmaletz_tiles_Chunk.prototype = { + x: null + ,y: null + ,tiles: null + ,clear: function() { + var e = 256; + var _g1 = 0; + var _g = e; + while(_g1 < _g) { + var i = _g1++; + this.tiles[i] = 0; + } + } + ,getTile: function(x,y,layer) { + var tile = this.tiles[y * 16 + x]; + if(layer < 0) { + return tile; + } else { + return (tile >> layer * 8 & 255) - 1; + } + } + ,setTile: function(x,y,tile,layer) { + var ot = this.tiles[y * 16 + x]; + var t = ot; + if(layer < 0) { + t = tile; + } else { + t = com_davidmaletz_tiles_Chunk.pack(t,layer,tile); + } + if(t != ot) { + this.tiles[y * 16 + x] = t; + return true; + } else { + return false; + } + } + ,write: function(b) { + var e = 256; + var _g1 = 0; + var _g = e; + while(_g1 < _g) { + var i = _g1++; + b.writeInt32(this.tiles[i]); + } + } + ,__class__: com_davidmaletz_tiles_Chunk +}; +var com_davidmaletz_tiles_ChunkEvent = function(type,map,chunk,layer) { + openfl_events_Event.call(this,type); + this.map = map; + this.chunk = chunk; + this.layer = layer; +}; +$hxClasses["com.davidmaletz.tiles.ChunkEvent"] = com_davidmaletz_tiles_ChunkEvent; +com_davidmaletz_tiles_ChunkEvent.__name__ = ["com","davidmaletz","tiles","ChunkEvent"]; +com_davidmaletz_tiles_ChunkEvent.__super__ = openfl_events_Event; +com_davidmaletz_tiles_ChunkEvent.prototype = $extend(openfl_events_Event.prototype,{ + map: null + ,chunk: null + ,layer: null + ,__class__: com_davidmaletz_tiles_ChunkEvent +}); +var com_davidmaletz_tiles_Floor = function() { + this.chunks = new haxe_ds_IntMap(); + this.bounds = new com_fancyfish_faeng_common_Bounds2D_$Int(); + this.bounds.reset(); +}; +$hxClasses["com.davidmaletz.tiles.Floor"] = com_davidmaletz_tiles_Floor; +com_davidmaletz_tiles_Floor.__name__ = ["com","davidmaletz","tiles","Floor"]; +com_davidmaletz_tiles_Floor.read = function(b) { + var f = new com_davidmaletz_tiles_Floor(); + while(true) { + var x = b.readInt16(); + if(x == 32767) { + break; + } + var y = b.readInt16(); + f.bounds.add(x,y,1,1); + var i = com_fancyfish_faeng_common_Utils.getIdx(x,y); + f.chunks.set(i,com_davidmaletz_tiles_Chunk.read(b,x,y)); + } + return f; +}; +com_davidmaletz_tiles_Floor.prototype = { + chunks: null + ,bounds: null + ,hasChunk: function(x,y) { + return this.chunks.exists(com_fancyfish_faeng_common_Utils.getIdx(x,y)); + } + ,getChunk: function(x,y) { + var i = com_fancyfish_faeng_common_Utils.getIdx(x,y); + var c = this.chunks.get(i); + if(c == null) { + c = new com_davidmaletz_tiles_Chunk(x,y); + this.chunks.set(i,c); + this.bounds.add(x,y,1,1); + } + return c; + } + ,iterator: function() { + return this.chunks.iterator(); + } + ,write: function(b) { + var c = this.chunks.iterator(); + while(c.hasNext()) { + var c1 = c.next(); + b.writeInt16(c1.x); + b.writeInt16(c1.y); + c1.write(b); + } + b.writeInt16(32767); + } + ,__class__: com_davidmaletz_tiles_Floor +}; +var com_davidmaletz_tiles_Frame = function(x,y,v,offX,offY,px,py,g) { + this.x = x; + this.y = y; + this.visible = v; + this.offsetX = offX; + this.offsetY = offY; + this.parentX = px; + this.parentY = py; + this.glow = g; +}; +$hxClasses["com.davidmaletz.tiles.Frame"] = com_davidmaletz_tiles_Frame; +com_davidmaletz_tiles_Frame.__name__ = ["com","davidmaletz","tiles","Frame"]; +com_davidmaletz_tiles_Frame.prototype = { + x: null + ,y: null + ,visible: null + ,offsetX: null + ,offsetY: null + ,parentX: null + ,parentY: null + ,glow: null + ,__class__: com_davidmaletz_tiles_Frame +}; +var com_davidmaletz_tiles_Neighbors = function() { }; +$hxClasses["com.davidmaletz.tiles.Neighbors"] = com_davidmaletz_tiles_Neighbors; +com_davidmaletz_tiles_Neighbors.__name__ = ["com","davidmaletz","tiles","Neighbors"]; +com_davidmaletz_tiles_Neighbors.get = function(self,x,y,layer,map,data) { + return com_davidmaletz_tiles_Neighbors.getFunc(self,data,x,y,layer,$bind(map,map.isNeighbor)); +}; +com_davidmaletz_tiles_Neighbors.getFunc = function(self,data,x,y,layer,isNeighbor) { + var mask = 0; + if(isNeighbor(self,data,x - 1,y,layer)) { + mask |= 1; + } + if(isNeighbor(self,data,x + 1,y,layer)) { + mask |= 2; + } + if(isNeighbor(self,data,x,y - 1,layer)) { + mask |= 4; + } + if(isNeighbor(self,data,x,y + 1,layer)) { + mask |= 8; + } + if(isNeighbor(self,data,x - 1,y - 1,layer)) { + mask |= 16; + } + if(isNeighbor(self,data,x + 1,y - 1,layer)) { + mask |= 32; + } + if(isNeighbor(self,data,x - 1,y + 1,layer)) { + mask |= 64; + } + if(isNeighbor(self,data,x + 1,y + 1,layer)) { + mask |= 128; + } + return mask; +}; +var com_davidmaletz_tiles_TileData = function(b,x,y,a) { + this.offsetY = 0; + this.offsetX = 0; + this.sheet = b; + this.x = x; + this.y = y; + this.autotile = a; +}; +$hxClasses["com.davidmaletz.tiles.TileData"] = com_davidmaletz_tiles_TileData; +com_davidmaletz_tiles_TileData.__name__ = ["com","davidmaletz","tiles","TileData"]; +com_davidmaletz_tiles_TileData.fromXML = function(path,xml,inner) { + if(inner == null) { + inner = false; + } + var ret; + if(inner && xml.exists("id")) { + ret = com_davidmaletz_tiles_Tile.get(xml.get("id")).getTileBase().copy(); + } else { + ret = new com_davidmaletz_tiles_TileData(com_davidmaletz_faengfl_AutoTileBitmap.get(com_davidmaletz_faengfl_EventHandler.getResource(path,xml.get("sheet")),com_davidmaletz_tiles_Tile.SIZE),xml.exists("x") ? Std.parseInt(xml.get("x")) : 0,xml.exists("y") ? Std.parseInt(xml.get("y")) : 0,com_davidmaletz_tiles_Autotile.get(xml.get("autotile"))); + } + var n = xml.elementsNamed("neighbor"); + while(n.hasNext()) { + var n1 = n.next(); + if(ret.neighbors == null) { + ret.neighbors = new haxe_ds_StringMap(); + } + ret.neighbors.set(n1.get("id"),true); + } + ret.p = xml.exists("p") ? Std.parseFloat(xml.get("p")) : 0.0; + ret._if = xml.get("if"); + if(xml.exists("offsetX")) { + ret.offsetX += Std.parseFloat(xml.get("offsetX")); + } + if(xml.exists("offsetY")) { + ret.offsetY += Std.parseFloat(xml.get("offsetY")); + } + return ret; +}; +com_davidmaletz_tiles_TileData.prototype = { + autotile: null + ,neighbors: null + ,sheet: null + ,x: null + ,y: null + ,p: null + ,_if: null + ,offsetX: null + ,offsetY: null + ,copy: function() { + var ret = new com_davidmaletz_tiles_TileData(this.sheet,this.x,this.y,this.autotile); + ret.neighbors = this.neighbors; + ret.offsetX = this.offsetX; + ret.offsetY = this.offsetY; + return ret; + } + ,render: function(getNeighbors,layer,tx,ty,offX,offY) { + if(this.autotile != null) { + this.autotile.render(getNeighbors == null ? 0 : getNeighbors(this),layer,tx + this.offsetX,ty + this.offsetY,this.sheet,this.x + offX,this.y + offY); + } else { + this.sheet.addTile(layer.handler,this.x + offX,this.y + offY,tx + this.offsetX,ty + this.offsetY); + } + } + ,__class__: com_davidmaletz_tiles_TileData +}; +var com_davidmaletz_tiles_EmptyTile = function() { +}; +$hxClasses["com.davidmaletz.tiles.EmptyTile"] = com_davidmaletz_tiles_EmptyTile; +com_davidmaletz_tiles_EmptyTile.__name__ = ["com","davidmaletz","tiles","EmptyTile"]; +com_davidmaletz_tiles_EmptyTile.instance = null; +com_davidmaletz_tiles_EmptyTile.get = function() { + if(com_davidmaletz_tiles_EmptyTile.instance == null) { + com_davidmaletz_tiles_EmptyTile.instance = new com_davidmaletz_tiles_EmptyTile(); + } + return com_davidmaletz_tiles_EmptyTile.instance; +}; +com_davidmaletz_tiles_EmptyTile.prototype = { + render: function(getNeighbors,layer,x,y,offX,offY) { + } + ,getTileWidth: function(offX,offY) { + return com_davidmaletz_tiles_Tile.SIZE; + } + ,getTileHeight: function(offX,offY) { + return com_davidmaletz_tiles_Tile.SIZE; + } + ,__class__: com_davidmaletz_tiles_EmptyTile +}; +var com_davidmaletz_tiles_TileAnimation = function(id,xml) { + this.id = id; + this.frames = []; + this.cdf = []; + var e = xml.elementsNamed("append"); + while(e.hasNext()) { + var e1 = e.next(); + var a = new com_davidmaletz_tiles_Append(e1); + if(this.append == null) { + this.append = [a]; + } else { + this.append.push(a); + } + } + this.tile = com_davidmaletz_tiles_Tile.get(xml.get("tile")); + this.color = xml.get("color"); + this.offset = xml.get("offset"); + if(xml.exists("colorScale")) { + this.colorScale = Std.parseFloat(xml.get("colorScale")); + } else { + this.colorScale = 1; + } + if(xml.exists("rotate")) { + this.rotate = Std.parseFloat(xml.get("rotate")); + } else { + this.rotate = 0; + } + if(xml.exists("scale")) { + this.scale = Std.parseFloat(xml.get("scale")); + } else { + this.scale = 1; + } + if(xml.exists("count") || xml.exists("countY")) { + var tx = xml.exists("x") ? Std.parseInt(xml.get("x")) : 0; + var ty = xml.exists("y") ? Std.parseInt(xml.get("y")) : 0; + var visible = xml.get("visible") != "false"; + var length = xml.exists("length") ? Std.parseFloat(xml.get("length")) : 1; + var offX = xml.exists("offsetX") ? Std.parseInt(xml.get("offsetX")) : 0; + var offY = xml.exists("offsetY") ? Std.parseInt(xml.get("offsetY")) : 0; + var px = xml.exists("parentX") ? Std.parseInt(xml.get("parentX")) : 0; + var py = xml.exists("parentY") ? Std.parseInt(xml.get("parentY")) : 0; + var repeat = xml.exists("repeat") ? Std.parseInt(xml.get("repeat")) : 1; + var g = xml.get("glow") == "true"; + if(xml.exists("count")) { + var count = Std.parseInt(xml.get("count")); + var _g1 = 0; + var _g = repeat; + while(_g1 < _g) { + var r = _g1++; + var _g3 = 0; + var _g2 = count; + while(_g3 < _g2) { + var i = _g3++; + this.frames.push(new com_davidmaletz_tiles_Frame(tx + i,ty,visible,offX,offY,px,py,g)); + this.cdf.push(length); + } + } + } + if(xml.exists("countY")) { + var count1 = Std.parseInt(xml.get("countY")); + var _g11 = 0; + var _g4 = repeat; + while(_g11 < _g4) { + var r1 = _g11++; + var _g31 = 0; + var _g21 = count1; + while(_g31 < _g21) { + var i1 = _g31++; + this.frames.push(new com_davidmaletz_tiles_Frame(tx,ty + i1,visible,offX,offY,px,py,g)); + this.cdf.push(length); + } + } + } + } + var f = xml.elementsNamed("frame"); + while(f.hasNext()) { + var f1 = f.next(); + var tx1 = f1.exists("x") ? Std.parseInt(f1.get("x")) : 0; + var ty1 = f1.exists("y") ? Std.parseInt(f1.get("y")) : 0; + var visible1 = f1.get("visible") != "false"; + var count2 = f1.exists("count") ? Std.parseInt(f1.get("count")) : 1; + var length1 = f1.exists("length") ? Std.parseFloat(f1.get("length")) : 1; + var offX1 = f1.exists("offsetX") ? Std.parseInt(f1.get("offsetX")) : 0; + var offY1 = f1.exists("offsetY") ? Std.parseInt(f1.get("offsetY")) : 0; + var px1 = f1.exists("parentX") ? Std.parseInt(f1.get("parentX")) : 0; + var py1 = f1.exists("parentY") ? Std.parseInt(f1.get("parentY")) : 0; + var rev = f1.get("reverse") == "true"; + var repeat1 = f1.exists("repeat") ? Std.parseInt(f1.get("repeat")) : 1; + var g1 = f1.get("glow") == "true"; + var _g12 = 0; + var _g5 = repeat1; + while(_g12 < _g5) { + var r2 = _g12++; + var _g32 = 0; + var _g22 = count2; + while(_g32 < _g22) { + var i2 = _g32++; + var c = rev ? count2 - 1 - i2 : i2; + this.frames.push(new com_davidmaletz_tiles_Frame(tx1 + c,ty1,visible1,offX1,offY1,px1,py1,g1)); + this.cdf.push(length1); + } + } + } + if(xml.exists("shift")) { + var shift = Std.parseInt(xml.get("shift")); + while(shift > 0) { + --shift; + this.frames.unshift(this.frames.pop()); + this.cdf.unshift(this.cdf.pop()); + } + while(shift < 0) { + ++shift; + this.frames.push(this.frames.shift()); + this.cdf.push(this.cdf.shift()); + } + } + if(xml.get("reverse") == "true") { + this.frames.reverse(); + this.cdf.reverse(); + } + if(this.frames.length == 0) { + this.frames.push(new com_davidmaletz_tiles_Frame(0,0,false,0,0,0,0,false)); + this.cdf.push(1); + haxe_Log.trace("Warning: Zero-length animation: " + id,{ fileName : "TileAnimation.hx", lineNumber : 83, className : "com.davidmaletz.tiles.TileAnimation", methodName : "new"}); + } + com_fancyfish_faeng_common_Utils.pdfToCDF(this.cdf); +}; +$hxClasses["com.davidmaletz.tiles.TileAnimation"] = com_davidmaletz_tiles_TileAnimation; +com_davidmaletz_tiles_TileAnimation.__name__ = ["com","davidmaletz","tiles","TileAnimation"]; +com_davidmaletz_tiles_TileAnimation.anims = null; +com_davidmaletz_tiles_TileAnimation.setAnimation = function(id,e) { + if(com_davidmaletz_tiles_TileAnimation.anims == null) { + com_davidmaletz_tiles_TileAnimation.anims = new haxe_ds_StringMap(); + } + if(com_davidmaletz_tiles_TileAnimation.anims.exists(id)) { + haxe_Log.trace("Overwrite Animation: " + id,{ fileName : "TileAnimation.hx", lineNumber : 103, className : "com.davidmaletz.tiles.TileAnimation", methodName : "setAnimation"}); + } + if(e.exists("equals")) { + com_davidmaletz_tiles_TileAnimation.anims.set(id,com_davidmaletz_tiles_TileAnimation.anims.get(e.get("equals"))); + } else { + com_davidmaletz_tiles_TileAnimation.anims.set(id,new com_davidmaletz_tiles_TileAnimation(id,e)); + } +}; +com_davidmaletz_tiles_TileAnimation.get = function(id) { + var ret = com_davidmaletz_tiles_TileAnimation._get(id); + if(id != null && ret == null) { + haxe_Log.trace("No Animation found: " + id,{ fileName : "TileAnimation.hx", lineNumber : 107, className : "com.davidmaletz.tiles.TileAnimation", methodName : "get"}); + } + return ret; +}; +com_davidmaletz_tiles_TileAnimation._get = function(id) { + if(id == null || com_davidmaletz_tiles_TileAnimation.anims == null) { + return null; + } else { + return com_davidmaletz_tiles_TileAnimation.anims.get(id); + } +}; +com_davidmaletz_tiles_TileAnimation.exists = function(id) { + if(id != null && com_davidmaletz_tiles_TileAnimation.anims != null) { + return com_davidmaletz_tiles_TileAnimation.anims.exists(id); + } else { + return false; + } +}; +com_davidmaletz_tiles_TileAnimation.reset = function() { + com_davidmaletz_tiles_TileAnimation.anims = null; +}; +com_davidmaletz_tiles_TileAnimation.prototype = { + id: null + ,frames: null + ,cdf: null + ,append: null + ,tile: null + ,offset: null + ,color: null + ,colorScale: null + ,rotate: null + ,scale: null + ,getMaxTime: function() { + return this.cdf[this.cdf.length - 1]; + } + ,getFrameAtTime: function(f) { + if(f >= this.getMaxTime()) { + return this.cdf.length - 1; + } else { + return com_fancyfish_faeng_common_Utils.drawCDF(this.cdf,f,false); + } + } + ,getFrameCount: function() { + return this.frames.length; + } + ,createLayerForFrame: function(tile,f,offX,offY,offsets) { + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + var x = 0; + if(offsets != null && this.offset != null && offsets.exists(this.offset)) { + var o = offsets.get(this.offset); + if(o.hidden) { + var d = new openfl_display_Sprite(); + d.set_visible(false); + return d; + } + x = o.offset; + var t = com_davidmaletz_tiles_Tile.get(o.tile); + if(t != null) { + tile = t; + } + } + if(this.tile != null) { + tile = this.tile; + } + var f1 = this.frames[f]; + if(!f1.visible) { + var d1 = new openfl_display_Sprite(); + d1.set_visible(false); + return d1; + } + var w = tile.getTileWidth(f1.x + x,f1.y); + var h = tile.getTileHeight(f1.x + x,f1.y); + var l = new com_davidmaletz_faengfl_TileLayer(); + l.start(); + tile.render(null,l,0,0,f1.x + x,f1.y); + l.set_x(Math.round(offX * w + f1.offsetX)); + l.set_y(Math.round(offY * h + f1.offsetY)); + l.finish(); + if(f1.glow) { + var s = new com_davidmaletz_faengfl_GlowSprite(); + s.addChild(l); + return s; + } else { + return l; + } + } + ,getFrame: function(i) { + return this.frames[com_fancyfish_faeng_common_Utils.min(this.frames.length - 1,i)]; + } + ,__class__: com_davidmaletz_tiles_TileAnimation +}; +var com_davidmaletz_tiles_Append = function(xml) { + this.tile = xml.get("tile"); + this.animation = xml.get("animation"); + this.behind = xml.get("behind") == "true"; + this.flip = xml.get("flip") == "true"; + this.offsetX = xml.exists("offsetX") ? Std.parseFloat(xml.get("offsetX")) : 0; + this.offsetY = xml.exists("offsetY") ? Std.parseFloat(xml.get("offsetY")) : 0; + this.x = xml.exists("x") ? Std.parseFloat(xml.get("x")) : 0; + this.y = xml.exists("y") ? Std.parseFloat(xml.get("y")) : 0; + this.color = xml.get("color"); + if(xml.exists("colorScale")) { + this.colorScale = Std.parseFloat(xml.get("colorScale")); + } else { + this.colorScale = 1; + } +}; +$hxClasses["com.davidmaletz.tiles.Append"] = com_davidmaletz_tiles_Append; +com_davidmaletz_tiles_Append.__name__ = ["com","davidmaletz","tiles","Append"]; +com_davidmaletz_tiles_Append.prototype = { + tile: null + ,animation: null + ,offsetX: null + ,offsetY: null + ,behind: null + ,x: null + ,y: null + ,flip: null + ,color: null + ,colorScale: null + ,__class__: com_davidmaletz_tiles_Append +}; +var com_davidmaletz_tiles_TileDrawable = function(t) { + this.tile = t; +}; +$hxClasses["com.davidmaletz.tiles.TileDrawable"] = com_davidmaletz_tiles_TileDrawable; +com_davidmaletz_tiles_TileDrawable.__name__ = ["com","davidmaletz","tiles","TileDrawable"]; +com_davidmaletz_tiles_TileDrawable.__interfaces__ = [com_davidmaletz_faengfl_Drawable]; +com_davidmaletz_tiles_TileDrawable.prototype = { + tile: null + ,getWidth: function() { + return this.tile.getWidth(); + } + ,getHeight: function() { + return this.tile.getHeight(); + } + ,create: function(tx,ty) { + var t = com_davidmaletz_tiles_Tile.makeIcon(this.tile); + t.set_x(tx); + t.set_y(ty); + return t; + } + ,__class__: com_davidmaletz_tiles_TileDrawable +}; +var com_davidmaletz_tiles__$TileFormattedText_TileCharacter = function(id,fnt) { + com_fancyfish_faeng_text_Character.call(this,null,fnt); + var data = com_davidmaletz_tiles_TileFormattedText.getTile(id); + var tile = data.tile; + this.xoffset = 0; + this.xadvance = tile == null ? 0 : tile.getWidth(); + this.id = -1; + this.x = 0; + this.y = 0; + this.ht = tile == null ? 0 : tile.getHeight(); + if(tile == null) { + this.userData = com_davidmaletz_tiles__$TileFormattedText_TileCharacter.makeNull; + } else { + var tmp; + if(data.anim == null) { + var a1 = tile; + tmp = function() { + return com_davidmaletz_tiles_Tile.makeIcon(a1); + }; + } else { + var a11 = tile; + var a2 = data.anim; + var a3 = data.fps; + var a4 = data.flip; + tmp = function() { + return com_davidmaletz_tiles__$TileFormattedText_TileCharacter.makeAnim(a11,a2,a3,a4); + }; + } + this.userData = tmp; + } + this.updateFont(fnt); +}; +$hxClasses["com.davidmaletz.tiles._TileFormattedText.TileCharacter"] = com_davidmaletz_tiles__$TileFormattedText_TileCharacter; +com_davidmaletz_tiles__$TileFormattedText_TileCharacter.__name__ = ["com","davidmaletz","tiles","_TileFormattedText","TileCharacter"]; +com_davidmaletz_tiles__$TileFormattedText_TileCharacter.makeNull = function() { + return new openfl_display_Sprite(); +}; +com_davidmaletz_tiles__$TileFormattedText_TileCharacter.makeAnim = function(tile,anim,fps,flip) { + var s = new com_davidmaletz_tiles_render_StaticPlayAnimation(tile,anim,fps,true,null,flip ? -1 : 0); + if(flip) { + s.set_scaleX(-1); + } + return s; +}; +com_davidmaletz_tiles__$TileFormattedText_TileCharacter.__super__ = com_fancyfish_faeng_text_Character; +com_davidmaletz_tiles__$TileFormattedText_TileCharacter.prototype = $extend(com_fancyfish_faeng_text_Character.prototype,{ + ht: null + ,updateFont: function(fnt) { + this.font = fnt; + this.yoffset = Math.round(fnt.lineHeight - this.ht); + this.width = Math.round(this.xadvance / fnt.internalScale); + this.height = Math.round(this.ht / fnt.internalScale); + } + ,__class__: com_davidmaletz_tiles__$TileFormattedText_TileCharacter +}); +var com_davidmaletz_tiles__$TileFormattedText_KeyCharacter = function(id,fnt) { + com_fancyfish_faeng_text_Character.call(this,null,fnt); + this.xadvance = com_davidmaletz_faengfl_controls_AbstractKey.key_bitmap.tileWidth; + this.xoffset = 0; + this.yoffset = 0; + this.id = -1; + this.x = 0; + this.y = 0; + var id1 = id; + this.userData = function() { + return com_davidmaletz_tiles__$TileFormattedText_KeyCharacter.makeIcon(id1); + }; + this.updateFont(fnt); +}; +$hxClasses["com.davidmaletz.tiles._TileFormattedText.KeyCharacter"] = com_davidmaletz_tiles__$TileFormattedText_KeyCharacter; +com_davidmaletz_tiles__$TileFormattedText_KeyCharacter.__name__ = ["com","davidmaletz","tiles","_TileFormattedText","KeyCharacter"]; +com_davidmaletz_tiles__$TileFormattedText_KeyCharacter.makeIcon = function(id) { + var r = new com_davidmaletz_controls_KeyRenderer(id,com_davidmaletz_faengfl_controls_AbstractKey.key_bitmap.tileWidth * 0.5,com_davidmaletz_faengfl_controls_AbstractKey.key_bitmap.tileHeight * 0.5); + r.set_scaleX(r.set_scaleY(0.5)); + return r; +}; +com_davidmaletz_tiles__$TileFormattedText_KeyCharacter.__super__ = com_fancyfish_faeng_text_Character; +com_davidmaletz_tiles__$TileFormattedText_KeyCharacter.prototype = $extend(com_fancyfish_faeng_text_Character.prototype,{ + updateFont: function(fnt) { + this.font = fnt; + var ht = com_davidmaletz_faengfl_controls_AbstractKey.key_bitmap.tileHeight; + this.yoffset = Math.round(fnt.lineHeight - ht); + this.width = Math.round(this.xadvance * 0.5 / fnt.internalScale); + this.height = Math.round(ht * 0.5 / fnt.internalScale); + } + ,__class__: com_davidmaletz_tiles__$TileFormattedText_KeyCharacter +}); +var com_davidmaletz_tiles_TileIndex = function() { + this.tiles = new haxe_ds_IntMap(); +}; +$hxClasses["com.davidmaletz.tiles.TileIndex"] = com_davidmaletz_tiles_TileIndex; +com_davidmaletz_tiles_TileIndex.__name__ = ["com","davidmaletz","tiles","TileIndex"]; +com_davidmaletz_tiles_TileIndex.prototype = { + tiles: null + ,getTile: function(idx) { + return this.tiles.get(idx); + } + ,setTile: function(idx,tile) { + if(this.tiles.get(idx) != tile) { + this.tiles.set(idx,tile); + return true; + } else { + return false; + } + } + ,__class__: com_davidmaletz_tiles_TileIndex +}; +var com_davidmaletz_tiles_render_LinkedPlayAnimation = function(link,tile,anim,fps,loop,complete,offX,offY,p) { + if(p == null) { + p = false; + } + if(offY == null) { + offY = 0; + } + if(offX == null) { + offX = 0; + } + com_davidmaletz_tiles_render_PlayAnimation.call(this,tile,anim,fps,loop,complete,offX,offY); + this.link = link; + this.paused = p; +}; +$hxClasses["com.davidmaletz.tiles.render.LinkedPlayAnimation"] = com_davidmaletz_tiles_render_LinkedPlayAnimation; +com_davidmaletz_tiles_render_LinkedPlayAnimation.__name__ = ["com","davidmaletz","tiles","render","LinkedPlayAnimation"]; +com_davidmaletz_tiles_render_LinkedPlayAnimation.__super__ = com_davidmaletz_tiles_render_PlayAnimation; +com_davidmaletz_tiles_render_LinkedPlayAnimation.prototype = $extend(com_davidmaletz_tiles_render_PlayAnimation.prototype,{ + link: null + ,offX: null + ,offY: null + ,paused: null + ,init: function(e) { + if(!this.paused) { + com_davidmaletz_tiles_render_PlayAnimation.prototype.init.call(this,e); + } + this.offX = this.get_x(); + this.offY = this.get_y(); + openfl_Lib.current.stage.addEventListener("enterFrame",$bind(this,this.handle_frame),false,PriorityManager.getPriority()); + this.handle_frame(null); + } + ,destroy: function(e) { + if(!this.paused) { + com_davidmaletz_tiles_render_PlayAnimation.prototype.destroy.call(this,e); + } + if(e != null && this.onComplete != null) { + var f = this.onComplete; + this.onComplete = null; + f(this); + } + openfl_Lib.current.stage.removeEventListener("enterFrame",$bind(this,this.handle_frame)); + } + ,handle_frame: function(e) { + this.set_x(this.link.get_x() + this.offX); + this.set_y(this.link.get_y() + this.offY); + if(this.paused) { + this.enter_frame(com_davidmaletz_faengfl_FaengFL.frameTime); + } + } + ,__class__: com_davidmaletz_tiles_render_LinkedPlayAnimation +}); +var com_davidmaletz_tiles_render_TileOffsetRenderer = function(tile,offsetX,offsetY) { + this.tile = tile; + this.offsetX = offsetX; + this.offsetY = offsetY; +}; +$hxClasses["com.davidmaletz.tiles.render.TileOffsetRenderer"] = com_davidmaletz_tiles_render_TileOffsetRenderer; +com_davidmaletz_tiles_render_TileOffsetRenderer.__name__ = ["com","davidmaletz","tiles","render","TileOffsetRenderer"]; +com_davidmaletz_tiles_render_TileOffsetRenderer.prototype = { + tile: null + ,offsetX: null + ,offsetY: null + ,render: function(getNeighbors,layer,x,y,offX,offY) { + this.tile.render(getNeighbors,layer,x,y,offX + this.offsetX,offY + this.offsetY); + } + ,getTileWidth: function(offX,offY) { + return this.tile.getTileWidth(offX + this.offsetX,offY + this.offsetY); + } + ,getTileHeight: function(offX,offY) { + return this.tile.getTileHeight(offX + this.offsetX,offY + this.offsetY); + } + ,__class__: com_davidmaletz_tiles_render_TileOffsetRenderer +}; +var com_fancyfish_faeng_common_Bitmask = function() { }; +$hxClasses["com.fancyfish.faeng.common.Bitmask"] = com_fancyfish_faeng_common_Bitmask; +com_fancyfish_faeng_common_Bitmask.__name__ = ["com","fancyfish","faeng","common","Bitmask"]; +com_fancyfish_faeng_common_Bitmask.create = function(fill) { + if(fill) { + return -1; + } else { + return 0; + } +}; +com_fancyfish_faeng_common_Bitmask.get = function(mask,i) { + return (mask & 1 << i) != 0; +}; +com_fancyfish_faeng_common_Bitmask.setTrue = function(mask,i) { + return mask | 1 << i; +}; +var com_fancyfish_faeng_common_Bitmask2D = function(w,h,fill) { + this.width = w; + this.height = h; + this.mask = haxe_io_Bytes.alloc(Math.ceil(this.width * this.height / 8)); + this.fill(fill); +}; +$hxClasses["com.fancyfish.faeng.common.Bitmask2D"] = com_fancyfish_faeng_common_Bitmask2D; +com_fancyfish_faeng_common_Bitmask2D.__name__ = ["com","fancyfish","faeng","common","Bitmask2D"]; +com_fancyfish_faeng_common_Bitmask2D.prototype = { + width: null + ,height: null + ,mask: null + ,set: function(x,y,v) { + var idx = y * this.width + x; + var b = Math.floor(idx / 8); + var $byte = this.mask.get(b); + idx -= b * 8; + if(v) { + this.mask.set(b,$byte | 1 << idx); + } else { + this.mask.set(b,$byte & ~(1 << idx)); + } + } + ,get: function(x,y) { + var idx = y * this.width + x; + var b = Math.floor(idx / 8); + var $byte = this.mask.get(b); + idx -= b * 8; + return ($byte & 1 << idx) != 0; + } + ,fill: function(val) { + this.mask.fill(0,this.mask.length,val ? 255 : 0); + } + ,__class__: com_fancyfish_faeng_common_Bitmask2D +}; +var com_fancyfish_faeng_common_Bounds2D_$Float = function() { }; +$hxClasses["com.fancyfish.faeng.common.Bounds2D_Float"] = com_fancyfish_faeng_common_Bounds2D_$Float; +com_fancyfish_faeng_common_Bounds2D_$Float.__name__ = ["com","fancyfish","faeng","common","Bounds2D_Float"]; +com_fancyfish_faeng_common_Bounds2D_$Float.prototype = { + min_x: null + ,min_y: null + ,max_x: null + ,max_y: null + ,toString: function() { + return "[" + Std.string(this.min_x) + "," + Std.string(this.min_y) + "]-[" + Std.string(this.max_x) + "," + Std.string(this.max_y) + "]"; + } + ,__class__: com_fancyfish_faeng_common_Bounds2D_$Float +}; +var com_fancyfish_faeng_common_Bounds2D_$Int = function(x,y,w,h) { + if(h == null) { + h = 0; + } + if(w == null) { + w = 0; + } + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + this.set(x,y,w,h); +}; +$hxClasses["com.fancyfish.faeng.common.Bounds2D_Int"] = com_fancyfish_faeng_common_Bounds2D_$Int; +com_fancyfish_faeng_common_Bounds2D_$Int.__name__ = ["com","fancyfish","faeng","common","Bounds2D_Int"]; +com_fancyfish_faeng_common_Bounds2D_$Int.prototype = { + min_x: null + ,min_y: null + ,max_x: null + ,max_y: null + ,set: function(x,y,w,h) { + if(h == null) { + h = 0; + } + if(w == null) { + w = 0; + } + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + this.min_x = x; + this.min_y = y; + this.max_x = x + w; + this.max_y = y + h; + } + ,reset: function() { + this.min_x = 100000; + this.min_y = this.min_x; + this.max_x = -this.min_x; + this.max_y = this.max_x; + } + ,add: function(x,y,w,h) { + if(x < this.min_x) { + this.min_x = x; + } + if(y < this.min_y) { + this.min_y = y; + } + x += w; + if(x > this.max_x) { + this.max_x = x; + } + y += h; + if(y > this.max_y) { + this.max_y = y; + } + } + ,contains: function(x,y,fuzzy) { + if(fuzzy == null) { + fuzzy = 0; + } + if(x >= this.min_x - fuzzy && x < this.max_x + fuzzy && y >= this.min_y - fuzzy) { + return y < this.max_y + fuzzy; + } else { + return false; + } + } + ,toString: function() { + return "[" + Std.string(this.min_x) + "," + Std.string(this.min_y) + "]-[" + Std.string(this.max_x) + "," + Std.string(this.max_y) + "]"; + } + ,__class__: com_fancyfish_faeng_common_Bounds2D_$Int +}; +var com_fancyfish_faeng_common_CompoundIterator = function(i) { + this.iterators = i; + this.current = this.getNext(); +}; +$hxClasses["com.fancyfish.faeng.common.CompoundIterator"] = com_fancyfish_faeng_common_CompoundIterator; +com_fancyfish_faeng_common_CompoundIterator.__name__ = ["com","fancyfish","faeng","common","CompoundIterator"]; +com_fancyfish_faeng_common_CompoundIterator.prototype = { + iterators: null + ,iterator: null + ,current: null + ,hasNext: function() { + return this.current != null; + } + ,next: function() { + var ret = this.current; + this.current = this.getNext(); + return ret; + } + ,getNext: function() { + if(this.iterator != null && this.iterator.hasNext()) { + return this.iterator.next(); + } + while(this.iterators.hasNext()) { + this.iterator = this.iterators.next(); + if(this.iterator != null && this.iterator.hasNext()) { + return this.iterator.next(); + } + } + return null; + } + ,__class__: com_fancyfish_faeng_common_CompoundIterator +}; +var com_fancyfish_faeng_common_DoubleIterator = function(a,b) { + this.first = a; + this.second = b; + this.current = this.getNext(); +}; +$hxClasses["com.fancyfish.faeng.common.DoubleIterator"] = com_fancyfish_faeng_common_DoubleIterator; +com_fancyfish_faeng_common_DoubleIterator.__name__ = ["com","fancyfish","faeng","common","DoubleIterator"]; +com_fancyfish_faeng_common_DoubleIterator.prototype = { + first: null + ,second: null + ,current: null + ,hasNext: function() { + return this.current != null; + } + ,next: function() { + var ret = this.current; + this.current = this.getNext(); + return ret; + } + ,getNext: function() { + if(this.first.hasNext()) { + return this.first.next(); + } + if(this.second != null) { + this.first = this.second; + this.second = null; + return this.getNext(); + } else { + return null; + } + } + ,__class__: com_fancyfish_faeng_common_DoubleIterator +}; +var com_fancyfish_faeng_common_Dequeue = function() { + this.array = this.createArray(8); + this.head = 0; + this.tail = 0; +}; +$hxClasses["com.fancyfish.faeng.common.Dequeue"] = com_fancyfish_faeng_common_Dequeue; +com_fancyfish_faeng_common_Dequeue.__name__ = ["com","fancyfish","faeng","common","Dequeue"]; +com_fancyfish_faeng_common_Dequeue.prototype = { + array: null + ,head: null + ,tail: null + ,addFirst: function(v) { + this.head = this.head - 1 & this.array.length - 1; + this.array[this.head] = v; + if(this.head == this.tail) { + this.doubleCapacity(); + } + } + ,addLast: function(v) { + this.array[this.tail] = v; + this.tail = this.tail + 1 & this.array.length - 1; + if(this.head == this.tail) { + this.doubleCapacity(); + } + } + ,clear: function() { + this.head = 0; + this.tail = 0; + } + ,isEmpty: function() { + return this.head == this.tail; + } + ,size: function() { + return this.tail - this.head & this.array.length - 1; + } + ,getFirst: function() { + return this.array[this.head]; + } + ,set: function(i,v) { + this.array[this.head + i & this.array.length - 1] = v; + } + ,get: function(i) { + return this.array[this.head + i & this.array.length - 1]; + } + ,removeFirst: function() { + var NULL = null; + if(this.isEmpty()) { + return NULL; + } else { + var ret = this.array[this.head]; + this.array[this.head] = NULL; + this.head = this.head + 1 & this.array.length - 1; + return ret; + } + } + ,remove: function(v) { + var sz = this.size(); + var idx = -1; + var _g1 = 0; + var _g = sz; + while(_g1 < _g) { + var i = _g1++; + if(idx != -1) { + this.set(i - 1,this.get(i)); + } else if(this.get(i) == v) { + idx = i; + } + } + if(idx != -1) { + this.removeLast(); + } + } + ,removeLast: function() { + var NULL = null; + if(this.isEmpty()) { + return NULL; + } else { + this.tail = this.tail - 1 & this.array.length - 1; + var ret = this.array[this.tail]; + this.array[this.tail] = NULL; + return ret; + } + } + ,doubleCapacity: function() { + var new_array = this.createArray(this.array.length << 1); + var n = this.array.length - this.head; + var i = 0; + while(i < n) { + new_array[i] = this.array[this.head + i]; + ++i; + } + i = 0; + while(i < this.head) { + new_array[n + i] = this.array[i]; + ++i; + } + this.head = 0; + this.tail = this.array.length; + this.array = new_array; + } + ,createArray: function(len) { + var NULL = null; + var ret = []; + var i = 0; + while(i < len) { + ret.push(NULL); + ++i; + } + return ret; + } + ,iterator: function() { + return new com_fancyfish_faeng_common__$Dequeue_DequeueIterator(this); + } + ,__class__: com_fancyfish_faeng_common_Dequeue +}; +var com_fancyfish_faeng_common__$Dequeue_DequeueIterator = function(q) { + this.queue = q; + this.i = 0; +}; +$hxClasses["com.fancyfish.faeng.common._Dequeue.DequeueIterator"] = com_fancyfish_faeng_common__$Dequeue_DequeueIterator; +com_fancyfish_faeng_common__$Dequeue_DequeueIterator.__name__ = ["com","fancyfish","faeng","common","_Dequeue","DequeueIterator"]; +com_fancyfish_faeng_common__$Dequeue_DequeueIterator.prototype = { + queue: null + ,i: null + ,hasNext: function() { + return this.i < this.queue.size(); + } + ,next: function() { + return this.queue.get(this.i++); + } + ,__class__: com_fancyfish_faeng_common__$Dequeue_DequeueIterator +}; +var com_fancyfish_faeng_common_HashMap = function() { + this.map = new haxe_ds_IntMap(); +}; +$hxClasses["com.fancyfish.faeng.common.HashMap"] = com_fancyfish_faeng_common_HashMap; +com_fancyfish_faeng_common_HashMap.__name__ = ["com","fancyfish","faeng","common","HashMap"]; +com_fancyfish_faeng_common_HashMap.prototype = { + map: null + ,set: function(key,value) { + var hash = key.hashCode(); + var v = this.map.get(hash); + if(v == null) { + v = new com_fancyfish_faeng_common_Values(); + this.map.set(hash,v); + } + v.set(key,value); + return; + } + ,get: function(key) { + var v = this.map.get(key.hashCode()); + if(v == null) { + return null; + } else { + return v.get(key); + } + } + ,remove: function(key) { + var hash = key.hashCode(); + var v = this.map.get(hash); + if(v != null && v.remove(key)) { + this.map.remove(hash); + } + } + ,getKey: function(value) { + var v = this.map.iterator(); + while(v.hasNext()) { + var v1 = v.next(); + var k = v1.getKey(value); + if(k != null) { + return k; + } + } + return null; + } + ,clone: function() { + var ret = new com_fancyfish_faeng_common_HashMap(); + var k = this.map.keys(); + while(k.hasNext()) { + var k1 = k.next(); + ret.map.set(k1,this.map.get(k1).clone()); + } + return ret; + } + ,iterator: function() { + return new com_fancyfish_faeng_common_MapIterator(this.map.iterator()); + } + ,__class__: com_fancyfish_faeng_common_HashMap +}; +var com_fancyfish_faeng_common_Entry = function(k,v) { + this.key = k; + this.value = v; +}; +$hxClasses["com.fancyfish.faeng.common.Entry"] = com_fancyfish_faeng_common_Entry; +com_fancyfish_faeng_common_Entry.__name__ = ["com","fancyfish","faeng","common","Entry"]; +com_fancyfish_faeng_common_Entry.prototype = { + key: null + ,value: null + ,__class__: com_fancyfish_faeng_common_Entry +}; +var com_fancyfish_faeng_common_MapIterator = function(i) { + this.iterator = i; +}; +$hxClasses["com.fancyfish.faeng.common.MapIterator"] = com_fancyfish_faeng_common_MapIterator; +com_fancyfish_faeng_common_MapIterator.__name__ = ["com","fancyfish","faeng","common","MapIterator"]; +com_fancyfish_faeng_common_MapIterator.prototype = { + iterator: null + ,values: null + ,cur: null + ,hasNext: function() { + if(!this.iterator.hasNext()) { + if(this.values != null) { + return this.cur < this.values.keys.length; + } else { + return false; + } + } else { + return true; + } + } + ,next: function() { + if(this.values == null || this.cur >= this.values.keys.length) { + this.values = this.iterator.next(); + this.cur = 0; + } + var e = new com_fancyfish_faeng_common_Entry(this.values.keys[this.cur],this.values.values[this.cur]); + this.cur++; + return e; + } + ,__class__: com_fancyfish_faeng_common_MapIterator +}; +var com_fancyfish_faeng_common_Values = function() { + this.keys = []; + this.values = []; +}; +$hxClasses["com.fancyfish.faeng.common.Values"] = com_fancyfish_faeng_common_Values; +com_fancyfish_faeng_common_Values.__name__ = ["com","fancyfish","faeng","common","Values"]; +com_fancyfish_faeng_common_Values.prototype = { + keys: null + ,values: null + ,set: function(key,value) { + var len = this.keys.length; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + if(key.equals(this.keys[i])) { + this.values[i] = value; + return; + } + } + this.keys.push(key); + this.values.push(value); + } + ,get: function(key) { + var len = this.keys.length; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + if(key.equals(this.keys[i])) { + return this.values[i]; + } + } + return null; + } + ,remove: function(key) { + var len = this.keys.length; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + if(key.equals(this.keys[i])) { + this.keys.splice(i,1); + this.values.splice(i,1); + return this.keys.length == 0; + } + } + return false; + } + ,getKey: function(value) { + var len = this.keys.length; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + if(value == this.values[i]) { + return this.keys[i]; + } + } + return null; + } + ,clone: function() { + var ret = new com_fancyfish_faeng_common_Values(); + ret.keys = this.keys.slice(); + ret.values = this.values.slice(); + return ret; + } + ,__class__: com_fancyfish_faeng_common_Values +}; +var com_fancyfish_faeng_common_Heap = function(_lessThan) { + this.array = []; + this.lessThan = _lessThan; +}; +$hxClasses["com.fancyfish.faeng.common.Heap"] = com_fancyfish_faeng_common_Heap; +com_fancyfish_faeng_common_Heap.__name__ = ["com","fancyfish","faeng","common","Heap"]; +com_fancyfish_faeng_common_Heap.prototype = { + array: null + ,lessThan: null + ,insert: function(val) { + var idx = this.array.length; + this.array.push(val); + while(idx > 0) { + var parent = idx - 1 >> 1; + if(this.lessThan(val,this.array[parent])) { + this.array[idx] = this.array[parent]; + idx = parent; + } else { + break; + } + } + this.array[idx] = val; + } + ,remove: function() { + if(this.array.length == 0) { + return null; + } + var ret = this.array[0]; + if(this.array.length > 1) { + var low = this.array[this.array.length - 1]; + this.array.pop(); + var idx = 0; + var child = 1; + while(child < this.array.length) { + if(child < this.array.length - 1 && this.lessThan(this.array[child + 1],this.array[child])) { + ++child; + } + if(this.lessThan(this.array[child],low)) { + this.array[idx] = this.array[child]; + idx = child; + child = (idx << 1) + 1; + } else { + break; + } + } + this.array[idx] = low; + } else { + this.array.pop(); + } + return ret; + } + ,isEmpty: function() { + return this.array.length == 0; + } + ,__class__: com_fancyfish_faeng_common_Heap +}; +var com_fancyfish_faeng_common_HttpAsync = function() { }; +$hxClasses["com.fancyfish.faeng.common.HttpAsync"] = com_fancyfish_faeng_common_HttpAsync; +com_fancyfish_faeng_common_HttpAsync.__name__ = ["com","fancyfish","faeng","common","HttpAsync"]; +com_fancyfish_faeng_common_HttpAsync.send = function(http,post) { + if(post == null) { + post = false; + } + http.async = true; + http.request(post); +}; +var com_fancyfish_faeng_common_Keyboard = function(xml) { + this.keys = new haxe_ds_StringMap(); + var s = xml.elementsNamed("key"); + while(s.hasNext()) { + var s1 = s.next(); + if(s1.exists("name")) { + this.keys.set(s1.get("name"),com_fancyfish_faeng_common_Key.load(s1)); + } + } +}; +$hxClasses["com.fancyfish.faeng.common.Keyboard"] = com_fancyfish_faeng_common_Keyboard; +com_fancyfish_faeng_common_Keyboard.__name__ = ["com","fancyfish","faeng","common","Keyboard"]; +com_fancyfish_faeng_common_Keyboard.prototype = { + keys: null + ,getKey: function(name) { + var ret = this.keys.get(name); + if(ret == null) { + ret = new com_fancyfish_faeng_common_Key(0,"?" + name); + this.keys.set(name,ret); + } + return ret; + } + ,__class__: com_fancyfish_faeng_common_Keyboard +}; +var com_fancyfish_faeng_common_Key = function(t,txt,icn) { + this.type = t; + this.text = txt; + this.icon = icn; +}; +$hxClasses["com.fancyfish.faeng.common.Key"] = com_fancyfish_faeng_common_Key; +com_fancyfish_faeng_common_Key.__name__ = ["com","fancyfish","faeng","common","Key"]; +com_fancyfish_faeng_common_Key.load = function(xml) { + var type = 0; + var t = xml.get("type"); + if(t == "medium") { + type = 1; + } else if(t == "large") { + type = 2; + } + var iter = xml.iterator(); + var text = iter.hasNext() ? com_fancyfish_faeng_common_Lang.escape(iter.next().get_nodeValue()) : ""; + return new com_fancyfish_faeng_common_Key(type,text,xml.get("icon")); +}; +com_fancyfish_faeng_common_Key.prototype = { + type: null + ,text: null + ,icon: null + ,__class__: com_fancyfish_faeng_common_Key +}; +var com_fancyfish_faeng_common_Lang = function(id) { + this.name = id; + this.displayName = id; + this.sections = new haxe_ds_StringMap(); + this.keyboard = com_fancyfish_faeng_common_Lang.defaultKeyboard; + if(com_fancyfish_faeng_common_Lang.defaultFont == null) { + com_fancyfish_faeng_common_Lang.defaultFont = com_fancyfish_faeng_text_FontManager.defaultFont.get(); + } + this.font = null; +}; +$hxClasses["com.fancyfish.faeng.common.Lang"] = com_fancyfish_faeng_common_Lang; +com_fancyfish_faeng_common_Lang.__name__ = ["com","fancyfish","faeng","common","Lang"]; +com_fancyfish_faeng_common_Lang.languageIds = null; +com_fancyfish_faeng_common_Lang.languages = null; +com_fancyfish_faeng_common_Lang.defaultFont = null; +com_fancyfish_faeng_common_Lang.getFirstLanguage = function() { + if(com_fancyfish_faeng_common_Lang.languageIds == null) { + return "null"; + } else { + return com_fancyfish_faeng_common_Lang.languageIds[0]; + } +}; +com_fancyfish_faeng_common_Lang.getDefaultLanguage = function() { + if(com_fancyfish_faeng_common_Lang.languageIds == null) { + return "null"; + } else { + return com_fancyfish_faeng_common_Lang.languageIds[0]; + } +}; +com_fancyfish_faeng_common_Lang.getLanguageIdx = function() { + if(com_fancyfish_faeng_common_Lang.languageIds == null) { + return -1; + } else { + return com_fancyfish_faeng_common_Lang.languageIds.indexOf(com_fancyfish_faeng_common_Lang.lang.name); + } +}; +com_fancyfish_faeng_common_Lang.getLanguageName = function(code) { + if(com_fancyfish_faeng_common_Lang.languages == null || !com_fancyfish_faeng_common_Lang.languages.exists(code)) { + return code; + } else { + return com_fancyfish_faeng_common_Lang.languages.get(code).displayName; + } +}; +com_fancyfish_faeng_common_Lang.exists = function(code) { + if(com_fancyfish_faeng_common_Lang.languages != null) { + return com_fancyfish_faeng_common_Lang.languages.exists(code); + } else { + return false; + } +}; +com_fancyfish_faeng_common_Lang.loadLanguage = function(xml,path) { + var id = xml.get("id"); + if(id != null) { + com_fancyfish_faeng_common_Lang.getLang(id).addXml(xml,path); + } +}; +com_fancyfish_faeng_common_Lang.languageCount = function() { + if(com_fancyfish_faeng_common_Lang.languageIds == null) { + return 0; + } else { + return com_fancyfish_faeng_common_Lang.languageIds.length; + } +}; +com_fancyfish_faeng_common_Lang.getLanguage = function(i) { + return com_fancyfish_faeng_common_Lang.languageIds[i]; +}; +com_fancyfish_faeng_common_Lang.getLang = function(id) { + if(com_fancyfish_faeng_common_Lang.languages == null) { + com_fancyfish_faeng_common_Lang.languages = new haxe_ds_StringMap(); + com_fancyfish_faeng_common_Lang.languageIds = []; + } + var l = com_fancyfish_faeng_common_Lang.languages.get(id); + if(l == null) { + l = new com_fancyfish_faeng_common_Lang(id); + com_fancyfish_faeng_common_Lang.languages.set(id,l); + com_fancyfish_faeng_common_Lang.languageIds.push(id); + } + return l; +}; +com_fancyfish_faeng_common_Lang.setLang = function(id) { + var l = com_fancyfish_faeng_common_Lang.getLang(id); + if(l != com_fancyfish_faeng_common_Lang.lang) { + com_fancyfish_faeng_common_Lang.lang = l; + com_fancyfish_faeng_common_Lang.lang.setFont(); + com_fancyfish_faeng_common_Lang.dispatcher.dispatchEvent(new openfl_events_Event("lang_changed")); + com_fancyfish_faeng_common_Lang.updateCaches(); + } +}; +com_fancyfish_faeng_common_Lang.reset = function() { + com_fancyfish_faeng_common_Lang.languageIds = null; + com_fancyfish_faeng_common_Lang.languages = null; + com_fancyfish_faeng_common_Lang.lang = null; + com_fancyfish_faeng_common_Lang.keyboardCache = null; +}; +com_fancyfish_faeng_common_Lang.updateCaches = function() { + var text = com_fancyfish_faeng_common_Lang.text_cache.iterator(); + while(text.hasNext()) { + var text1 = text.next(); + text1.update(); + } + var message = com_fancyfish_faeng_common_Lang.message_cache.iterator(); + while(message.hasNext()) { + var message1 = message.next(); + message1.update(); + } + var template = com_fancyfish_faeng_common_Lang.template_cache.iterator(); + while(template.hasNext()) { + var template1 = template.next(); + template1.update(); + } + var key = com_fancyfish_faeng_common_Lang.key_cache.iterator(); + while(key.hasNext()) { + var key1 = key.next(); + key1.update(); + } +}; +com_fancyfish_faeng_common_Lang.fontCache = null; +com_fancyfish_faeng_common_Lang.getFontCached = function(id,premultiply) { + if(com_fancyfish_faeng_common_Lang.fontCache == null) { + com_fancyfish_faeng_common_Lang.fontCache = new haxe_ds_StringMap(); + } + var ret = com_fancyfish_faeng_common_Lang.fontCache.get(id); + if(ret == null) { + var txt = null; + var b = openfl_Assets.getBytes(id); + if(b == null) { + return null; + } + if(!StringTools.endsWith(id,".fnt")) { + try { + var res = new format_gz_Reader(new haxe_io_BytesInput(openfl_utils__$ByteArray_ByteArray_$Impl_$.toBytes(b))).read(); + txt = res.data.getString(0,res.data.length); + } catch( e ) { + haxe_CallStack.lastException = e; + } + } + if(txt == null) { + txt = b.readUTFBytes(openfl_utils__$ByteArray_ByteArray_$Impl_$.get_length(b)); + } + ret = new com_fancyfish_faeng_text_Font(Xml.parse(txt).firstElement(),id); + com_fancyfish_faeng_common_Lang.fontCache.set(id,ret); + } + return ret; +}; +com_fancyfish_faeng_common_Lang.keyboardCache = null; +com_fancyfish_faeng_common_Lang.getKeyboard = function(id) { + if(com_fancyfish_faeng_common_Lang.keyboardCache == null) { + com_fancyfish_faeng_common_Lang.keyboardCache = new haxe_ds_StringMap(); + } + var ret = com_fancyfish_faeng_common_Lang.keyboardCache.get(id); + if(ret == null) { + ret = new com_fancyfish_faeng_common_Keyboard(Xml.parse(openfl_Assets.getText(id)).firstElement()); + com_fancyfish_faeng_common_Lang.keyboardCache.set(id,ret); + } + return ret; +}; +com_fancyfish_faeng_common_Lang.lang = null; +com_fancyfish_faeng_common_Lang.hasText = function(section,id) { + if(com_fancyfish_faeng_common_Lang.lang != null) { + if(!com_fancyfish_faeng_common_Lang.lang._hasText(section,id)) { + if(com_fancyfish_faeng_common_Lang.lang.name != com_fancyfish_faeng_common_Lang.languageIds[0]) { + return com_fancyfish_faeng_common_Lang.languages.get(com_fancyfish_faeng_common_Lang.languageIds[0])._hasText(section,id); + } else { + return false; + } + } else { + return true; + } + } else { + return false; + } +}; +com_fancyfish_faeng_common_Lang.getText = function(section,id) { + var name = section + "." + id; + var ret = com_fancyfish_faeng_common_Lang.text_cache.get(name); + if(ret == null) { + ret = new com_fancyfish_faeng_common_MutableString(section,id); + com_fancyfish_faeng_common_Lang.text_cache.set(name,ret); + } + return ret; +}; +com_fancyfish_faeng_common_Lang.getTextFromTitle = function(title,format) { + if(title == null) { + return null; + } else if(StringTools.startsWith(title,">>")) { + return new com_fancyfish_faeng_common_mutable_Static(HxOverrides.substr(title,2,null)); + } + var s = new com_fancyfish_faeng_common_StringTokenizer(title,"{}"); + if(!s.next()) { + return null; + } + title = s.getToken(); + var i = title.indexOf(">"); + if(i == -1) { + i = title.lastIndexOf("."); + if(i == -1) { + return null; + } + } + var section = title.substring(0,i); + var id = title.substring(i + 1); + if(com_fancyfish_faeng_common_Lang.hasText(section,id)) { + var m = com_fancyfish_faeng_common_Lang.getText(section,id); + var map = null; + while(s.next()) { + var token = s.getToken(); + var idx = token.indexOf(":"); + if(idx == -1) { + continue; + } + if(map == null) { + map = new haxe_ds_StringMap(); + } + var s1 = token.substring(idx + 1); + if(s1.substring(0,2) == ">>") { + var m1 = com_fancyfish_faeng_common_Lang.getTextFromTitle(s1.substring(2),format); + if(m1 != null) { + s1 = m1.get(); + } + } + if(format != null) { + s1 = format(s1); + } + map.set("{" + token.substring(0,idx) + "}",s1); + } + if(map == null) { + return m; + } else { + return new com_fancyfish_faeng_common_mutable_MutableTemplateStatic(m,map); + } + } else { + return null; + } +}; +com_fancyfish_faeng_common_Lang.getKeyByName = function(name) { + var ret = com_fancyfish_faeng_common_Lang.key_cache.get(name); + if(ret == null) { + ret = new com_fancyfish_faeng_common_MutableKey(name); + com_fancyfish_faeng_common_Lang.key_cache.set(name,ret); + } + return ret; +}; +com_fancyfish_faeng_common_Lang.escape = function(s) { + if(s == null) { + return null; + } else { + return StringTools.trim(StringTools.replace(StringTools.replace(StringTools.replace(StringTools.replace(s,"&","&"),"<","<"),">",">"),"\\n","\n")); + } +}; +com_fancyfish_faeng_common_Lang.prototype = { + name: null + ,keyboard: null + ,font: null + ,displayName: null + ,sections: null + ,version: null + ,setFont: function() { + com_fancyfish_faeng_text_FontManager.defaultFont.set(this.font == null ? com_fancyfish_faeng_common_Lang.defaultFont : com_fancyfish_faeng_common_Lang.getFontCached(this.font,false)); + } + ,addXml: function(xml,path) { + if(xml.exists("keyboard") && openfl_Assets.exists(path + xml.get("keyboard"))) { + this.keyboard = path + xml.get("keyboard"); + } + if(xml.exists("font")) { + this.font = path + xml.get("font"); + } + if(xml.exists("name")) { + this.displayName = xml.get("name"); + } + if(xml.exists("version")) { + this.version = xml.get("version"); + } + var e = xml.elements(); + while(e.hasNext()) { + var e1 = e.next(); + if(e1.get_nodeName() == "section" && e1.exists("id")) { + var id = e1.get("id"); + var s = this.sections.get(id); + if(s == null) { + s = new com_fancyfish_faeng_common_Section(id); + this.sections.set(id,s); + } + s.load(e1,this); + } + } + } + ,_hasText: function(section,id) { + var s = this.sections.get(section); + if(s != null && s.text != null) { + return s.text.get(id) != null; + } else { + return false; + } + } + ,text: function(section,id) { + var s = this.sections.get(section); + if(s == null || s.text == null) { + return ""; + } else { + var t = s.text.get(id); + if(t == null) { + return ""; + } else { + return t; + } + } + } + ,message: function(section,id) { + var s = this.sections.get(section); + if(s == null || s.messages == null) { + return com_fancyfish_faeng_common_Message.blank(); + } else { + var m = s.messages.get(id); + if(m == null) { + return com_fancyfish_faeng_common_Message.blank(); + } else { + return m; + } + } + } + ,parse: function(str) { + return com_fancyfish_faeng_common_Lang.escape(str); + } + ,__class__: com_fancyfish_faeng_common_Lang +}; +var com_fancyfish_faeng_common_Section = function(id) { + this.id = id; +}; +$hxClasses["com.fancyfish.faeng.common.Section"] = com_fancyfish_faeng_common_Section; +com_fancyfish_faeng_common_Section.__name__ = ["com","fancyfish","faeng","common","Section"]; +com_fancyfish_faeng_common_Section.prototype = { + id: null + ,text: null + ,messages: null + ,templates: null + ,load: function(xml,lang) { + var t = xml.elementsNamed("text"); + while(t.hasNext()) { + var t1 = t.next(); + if(t1.exists("id")) { + if(this.text == null) { + this.text = new haxe_ds_StringMap(); + } + var id = t1.get("id"); + if(this.text.exists(id)) { + haxe_Log.trace("Overwrite Text: " + this.id + "." + id,{ fileName : "Lang.hx", lineNumber : 206, className : "com.fancyfish.faeng.common.Section", methodName : "load"}); + } + this.text.set(id,lang.parse(t1.firstChild().get_nodeValue())); + } + } + var m = xml.elementsNamed("message"); + while(m.hasNext()) { + var m1 = m.next(); + if(m1.exists("id")) { + if(this.messages == null) { + this.messages = new haxe_ds_StringMap(); + } + var id1 = m1.get("id"); + if(this.messages.exists(id1)) { + haxe_Log.trace("Overwrite Message: " + this.id + "." + id1,{ fileName : "Lang.hx", lineNumber : 209, className : "com.fancyfish.faeng.common.Section", methodName : "load"}); + } + this.messages.set(id1,com_fancyfish_faeng_common_Message.load(m1,lang)); + } + } + var t2 = xml.elementsNamed("template"); + while(t2.hasNext()) { + var t3 = t2.next(); + if(t3.exists("id")) { + if(this.templates == null) { + this.templates = new haxe_ds_StringMap(); + } + var id2 = t3.get("id"); + if(this.templates.exists(id2)) { + haxe_Log.trace("Overwrite Template: " + this.id + "." + id2,{ fileName : "Lang.hx", lineNumber : 212, className : "com.fancyfish.faeng.common.Section", methodName : "load"}); + } + this.templates.set(id2,t3); + } + } + } + ,__class__: com_fancyfish_faeng_common_Section +}; +var com_fancyfish_faeng_common_Message = function() { +}; +$hxClasses["com.fancyfish.faeng.common.Message"] = com_fancyfish_faeng_common_Message; +com_fancyfish_faeng_common_Message.__name__ = ["com","fancyfish","faeng","common","Message"]; +com_fancyfish_faeng_common_Message.load = function(xml,lang) { + var m = new com_fancyfish_faeng_common_Message(); + m._load(xml,lang); + return m; +}; +com_fancyfish_faeng_common_Message.blank = function() { + var m = new com_fancyfish_faeng_common_Message(); + m.text = ""; + return m; +}; +com_fancyfish_faeng_common_Message.prototype = { + title: null + ,text: null + ,voice: null + ,getText: function() { + return this.text; + } + ,_load: function(xml,lang) { + this.text = lang.parse(xml.firstChild().get_nodeValue()); + this.title = xml.get("title"); + this.voice = xml.get("voice"); + } + ,__class__: com_fancyfish_faeng_common_Message +}; +var com_fancyfish_faeng_common_MutableString = function(section,id) { + com_fancyfish_faeng_common_mutable_Mutable.call(this); + this.section = section; + this.id = id; +}; +$hxClasses["com.fancyfish.faeng.common.MutableString"] = com_fancyfish_faeng_common_MutableString; +com_fancyfish_faeng_common_MutableString.__name__ = ["com","fancyfish","faeng","common","MutableString"]; +com_fancyfish_faeng_common_MutableString.__super__ = com_fancyfish_faeng_common_mutable_Mutable; +com_fancyfish_faeng_common_MutableString.prototype = $extend(com_fancyfish_faeng_common_mutable_Mutable.prototype,{ + section: null + ,id: null + ,getValue: function() { + var ret = com_fancyfish_faeng_common_Lang.lang.text(this.section,this.id); + if(ret.length == 0) { + return com_fancyfish_faeng_common_Lang.getLang(com_fancyfish_faeng_common_Lang.getFirstLanguage()).text(this.section,this.id); + } else { + return ret; + } + } + ,__class__: com_fancyfish_faeng_common_MutableString +}); +var com_fancyfish_faeng_common_MutableMessage = function() { }; +$hxClasses["com.fancyfish.faeng.common.MutableMessage"] = com_fancyfish_faeng_common_MutableMessage; +com_fancyfish_faeng_common_MutableMessage.__name__ = ["com","fancyfish","faeng","common","MutableMessage"]; +com_fancyfish_faeng_common_MutableMessage.__super__ = com_fancyfish_faeng_common_mutable_Mutable; +com_fancyfish_faeng_common_MutableMessage.prototype = $extend(com_fancyfish_faeng_common_mutable_Mutable.prototype,{ + title: null + ,text: null + ,voice: null + ,section: null + ,id: null + ,getValue: function() { + return com_fancyfish_faeng_common_Lang.lang.message(this.section,this.id); + } + ,update: function() { + com_fancyfish_faeng_common_mutable_Mutable.prototype.update.call(this); + if(this.title != null) { + this.title.update(); + } + if(this.text != null) { + this.text.update(); + } + if(this.voice != null) { + this.voice.update(); + } + } + ,__class__: com_fancyfish_faeng_common_MutableMessage +}); +var com_fancyfish_faeng_common_MutableTitle = function() { }; +$hxClasses["com.fancyfish.faeng.common.MutableTitle"] = com_fancyfish_faeng_common_MutableTitle; +com_fancyfish_faeng_common_MutableTitle.__name__ = ["com","fancyfish","faeng","common","MutableTitle"]; +com_fancyfish_faeng_common_MutableTitle.__super__ = com_fancyfish_faeng_common_mutable_Mutable; +com_fancyfish_faeng_common_MutableTitle.prototype = $extend(com_fancyfish_faeng_common_mutable_Mutable.prototype,{ + parent: null + ,getValue: function() { + return this.parent.get().title; + } + ,__class__: com_fancyfish_faeng_common_MutableTitle +}); +var com_fancyfish_faeng_common_MutableText = function() { }; +$hxClasses["com.fancyfish.faeng.common.MutableText"] = com_fancyfish_faeng_common_MutableText; +com_fancyfish_faeng_common_MutableText.__name__ = ["com","fancyfish","faeng","common","MutableText"]; +com_fancyfish_faeng_common_MutableText.__super__ = com_fancyfish_faeng_common_mutable_Mutable; +com_fancyfish_faeng_common_MutableText.prototype = $extend(com_fancyfish_faeng_common_mutable_Mutable.prototype,{ + parent: null + ,getValue: function() { + return this.parent.get().getText(); + } + ,__class__: com_fancyfish_faeng_common_MutableText +}); +var com_fancyfish_faeng_common_MutableVoice = function() { }; +$hxClasses["com.fancyfish.faeng.common.MutableVoice"] = com_fancyfish_faeng_common_MutableVoice; +com_fancyfish_faeng_common_MutableVoice.__name__ = ["com","fancyfish","faeng","common","MutableVoice"]; +com_fancyfish_faeng_common_MutableVoice.__super__ = com_fancyfish_faeng_common_mutable_Mutable; +com_fancyfish_faeng_common_MutableVoice.prototype = $extend(com_fancyfish_faeng_common_mutable_Mutable.prototype,{ + parent: null + ,getValue: function() { + return this.parent.get().voice; + } + ,__class__: com_fancyfish_faeng_common_MutableVoice +}); +var com_fancyfish_faeng_common_MutableKey = function(name) { + com_fancyfish_faeng_common_mutable_Mutable.call(this); + this.name = name; +}; +$hxClasses["com.fancyfish.faeng.common.MutableKey"] = com_fancyfish_faeng_common_MutableKey; +com_fancyfish_faeng_common_MutableKey.__name__ = ["com","fancyfish","faeng","common","MutableKey"]; +com_fancyfish_faeng_common_MutableKey.__super__ = com_fancyfish_faeng_common_mutable_Mutable; +com_fancyfish_faeng_common_MutableKey.prototype = $extend(com_fancyfish_faeng_common_mutable_Mutable.prototype,{ + name: null + ,text: null + ,getValue: function() { + return com_fancyfish_faeng_common_Lang.getKeyboard(com_fancyfish_faeng_common_Lang.lang.keyboard).getKey(this.name); + } + ,update: function() { + com_fancyfish_faeng_common_mutable_Mutable.prototype.update.call(this); + if(this.text != null) { + this.text.update(); + } + } + ,getText: function() { + if(this.text == null) { + this.text = new com_fancyfish_faeng_common_MutableKeyText(this); + } + return this.text; + } + ,__class__: com_fancyfish_faeng_common_MutableKey +}); +var com_fancyfish_faeng_common_MutableKeyText = function(p) { + com_fancyfish_faeng_common_mutable_Mutable.call(this); + this.parent = p; +}; +$hxClasses["com.fancyfish.faeng.common.MutableKeyText"] = com_fancyfish_faeng_common_MutableKeyText; +com_fancyfish_faeng_common_MutableKeyText.__name__ = ["com","fancyfish","faeng","common","MutableKeyText"]; +com_fancyfish_faeng_common_MutableKeyText.__super__ = com_fancyfish_faeng_common_mutable_Mutable; +com_fancyfish_faeng_common_MutableKeyText.prototype = $extend(com_fancyfish_faeng_common_mutable_Mutable.prototype,{ + parent: null + ,getValue: function() { + return this.parent.get().text; + } + ,__class__: com_fancyfish_faeng_common_MutableKeyText +}); +var com_fancyfish_faeng_common_Node = function(_x,_y,p,d) { + if(d == null) { + d = 0; + } + this.x = _x; + this.y = _y; + this.parent = p; + this.depth = p == null ? d : p.depth + 1; +}; +$hxClasses["com.fancyfish.faeng.common.Node"] = com_fancyfish_faeng_common_Node; +com_fancyfish_faeng_common_Node.__name__ = ["com","fancyfish","faeng","common","Node"]; +com_fancyfish_faeng_common_Node.lessThan = function(a,b) { + return a.depth < b.depth; +}; +com_fancyfish_faeng_common_Node.getDepth = function(n) { + return n.depth; +}; +com_fancyfish_faeng_common_Node.prototype = { + x: null + ,y: null + ,parent: null + ,depth: null + ,__class__: com_fancyfish_faeng_common_Node +}; +var com_fancyfish_faeng_common_Noise = function() { }; +$hxClasses["com.fancyfish.faeng.common.Noise"] = com_fancyfish_faeng_common_Noise; +com_fancyfish_faeng_common_Noise.__name__ = ["com","fancyfish","faeng","common","Noise"]; +com_fancyfish_faeng_common_Noise.fade = function(t) { + return t * t * t * (t * (t * 6 - 15) + 10); +}; +com_fancyfish_faeng_common_Noise.grad = function(hash,x,y,z) { + var h = hash & 15; + var u = h < 8 ? x : y; + var v = h < 4 ? y : h == 12 || h == 14 ? x : z; + return ((h & 1) == 0 ? u : -u) + ((h & 2) == 0 ? v : -v); +}; +com_fancyfish_faeng_common_Noise.noise = function(x,y,z) { + var fx = Math.floor(x); + var fy = Math.floor(y); + var fz = Math.floor(z); + var ix = fx & 255; + var iy = fy & 255; + var iz = fz & 255; + x -= fx; + y -= fy; + z -= fz; + var u = com_fancyfish_faeng_common_Noise.fade(x); + var v = com_fancyfish_faeng_common_Noise.fade(y); + var w = com_fancyfish_faeng_common_Noise.fade(z); + var A = com_fancyfish_faeng_common_Noise.p_vals[ix] + iy; + var AA = com_fancyfish_faeng_common_Noise.p_vals[A] + iz; + var AB = com_fancyfish_faeng_common_Noise.p_vals[A + 1] + iz; + var B = com_fancyfish_faeng_common_Noise.p_vals[ix + 1] + iy; + var BA = com_fancyfish_faeng_common_Noise.p_vals[B] + iz; + var BB = com_fancyfish_faeng_common_Noise.p_vals[B + 1] + iz; + return com_fancyfish_faeng_common_Utils.interp(com_fancyfish_faeng_common_Utils.interp(com_fancyfish_faeng_common_Utils.interp(com_fancyfish_faeng_common_Noise.grad(com_fancyfish_faeng_common_Noise.p_vals[AA],x,y,z),com_fancyfish_faeng_common_Noise.grad(com_fancyfish_faeng_common_Noise.p_vals[BA],x - 1,y,z),u),com_fancyfish_faeng_common_Utils.interp(com_fancyfish_faeng_common_Noise.grad(com_fancyfish_faeng_common_Noise.p_vals[AB],x,y - 1,z),com_fancyfish_faeng_common_Noise.grad(com_fancyfish_faeng_common_Noise.p_vals[BB],x - 1,y - 1,z),u),v),com_fancyfish_faeng_common_Utils.interp(com_fancyfish_faeng_common_Utils.interp(com_fancyfish_faeng_common_Noise.grad(com_fancyfish_faeng_common_Noise.p_vals[AA + 1],x,y,z - 1),com_fancyfish_faeng_common_Noise.grad(com_fancyfish_faeng_common_Noise.p_vals[BA + 1],x - 1,y,z - 1),u),com_fancyfish_faeng_common_Utils.interp(com_fancyfish_faeng_common_Noise.grad(com_fancyfish_faeng_common_Noise.p_vals[AB + 1],x,y - 1,z - 1),com_fancyfish_faeng_common_Noise.grad(com_fancyfish_faeng_common_Noise.p_vals[BB + 1],x - 1,y - 1,z - 1),u),v),w); +}; +var com_fancyfish_faeng_common_NullIterator = function() { +}; +$hxClasses["com.fancyfish.faeng.common.NullIterator"] = com_fancyfish_faeng_common_NullIterator; +com_fancyfish_faeng_common_NullIterator.__name__ = ["com","fancyfish","faeng","common","NullIterator"]; +com_fancyfish_faeng_common_NullIterator.prototype = { + next: function() { + return null; + } + ,hasNext: function() { + return false; + } + ,__class__: com_fancyfish_faeng_common_NullIterator +}; +var com_fancyfish_faeng_common_Pair = function(f,s) { + this.first = f; + this.second = s; +}; +$hxClasses["com.fancyfish.faeng.common.Pair"] = com_fancyfish_faeng_common_Pair; +com_fancyfish_faeng_common_Pair.__name__ = ["com","fancyfish","faeng","common","Pair"]; +com_fancyfish_faeng_common_Pair.prototype = { + first: null + ,second: null + ,__class__: com_fancyfish_faeng_common_Pair +}; +var com_fancyfish_faeng_common_Random = function(s0,s1) { + this.state0 = s0; + this.state1 = s1; +}; +$hxClasses["com.fancyfish.faeng.common.Random"] = com_fancyfish_faeng_common_Random; +com_fancyfish_faeng_common_Random.__name__ = ["com","fancyfish","faeng","common","Random"]; +com_fancyfish_faeng_common_Random.createFromInt = function(x) { + var y = com_fancyfish_faeng_common_Random.prng(x); + var z = com_fancyfish_faeng_common_Random.prng(y); + var w = com_fancyfish_faeng_common_Random.prng(z); + if(x == 0) { + x = 1; + } + if(y == 0) { + y = 1; + } + if(z == 0) { + z = 1; + } + if(w == 0) { + w = 1; + } + var this1 = new haxe__$Int64__$_$_$Int64(x,y); + var this2 = new haxe__$Int64__$_$_$Int64(z,w); + return new com_fancyfish_faeng_common_Random(this1,this2); +}; +com_fancyfish_faeng_common_Random.create = function() { + return com_fancyfish_faeng_common_Random.createFromInt(Math.round(new Date().getTime() / 1000)); +}; +com_fancyfish_faeng_common_Random.prng = function(n) { + return n * 16807 % 2147483647; +}; +com_fancyfish_faeng_common_Random.prototype = { + state0: null + ,state1: null + ,nextFloat: function() { + var i = this.xorshift128plus(); + var lo = i.low; + var hi = i.high; + if(lo < 0) { + lo += 4294967296.0; + } + if(hi < 0) { + hi += 4294967296.0; + } + return (hi + lo / 4294967296.0) / 4294967296.0; + } + ,xorshift128plus: function() { + var x = this.state0; + var y = this.state1; + this.state0 = y; + var b = 23; + b &= 63; + var b1; + if(b == 0) { + var this1 = new haxe__$Int64__$_$_$Int64(x.high,x.low); + b1 = this1; + } else if(b < 32) { + var this2 = new haxe__$Int64__$_$_$Int64(x.high << b | x.low >>> 32 - b,x.low << b); + b1 = this2; + } else { + var this3 = new haxe__$Int64__$_$_$Int64(x.low << b - 32,0); + b1 = this3; + } + var this4 = new haxe__$Int64__$_$_$Int64(x.high ^ b1.high,x.low ^ b1.low); + x = this4; + var b2 = 17; + b2 &= 63; + var b3; + if(b2 == 0) { + var this5 = new haxe__$Int64__$_$_$Int64(x.high,x.low); + b3 = this5; + } else if(b2 < 32) { + var this6 = new haxe__$Int64__$_$_$Int64(x.high >>> b2,x.high << 32 - b2 | x.low >>> b2); + b3 = this6; + } else { + var this7 = new haxe__$Int64__$_$_$Int64(0,x.high >>> b2 - 32); + b3 = this7; + } + var this8 = new haxe__$Int64__$_$_$Int64(x.high ^ b3.high,x.low ^ b3.low); + x = this8; + var b4 = 26; + b4 &= 63; + var b5; + if(b4 == 0) { + var this9 = new haxe__$Int64__$_$_$Int64(y.high,y.low); + b5 = this9; + } else if(b4 < 32) { + var this10 = new haxe__$Int64__$_$_$Int64(y.high >>> b4,y.high << 32 - b4 | y.low >>> b4); + b5 = this10; + } else { + var this11 = new haxe__$Int64__$_$_$Int64(0,y.high >>> b4 - 32); + b5 = this11; + } + var this12 = new haxe__$Int64__$_$_$Int64(y.high ^ b5.high,y.low ^ b5.low); + var b6 = this12; + var this13 = new haxe__$Int64__$_$_$Int64(x.high ^ b6.high,x.low ^ b6.low); + x = this13; + this.state1 = x; + var high = x.high + y.high | 0; + var low = x.low + y.low | 0; + if(haxe__$Int32_Int32_$Impl_$.ucompare(low,x.low) < 0) { + var ret = high++; + high = high | 0; + } + var this14 = new haxe__$Int64__$_$_$Int64(high,low); + return this14; + } + ,__class__: com_fancyfish_faeng_common_Random +}; +var com_fancyfish_faeng_common_SingleIterator = function(v) { + this.single = v; +}; +$hxClasses["com.fancyfish.faeng.common.SingleIterator"] = com_fancyfish_faeng_common_SingleIterator; +com_fancyfish_faeng_common_SingleIterator.__name__ = ["com","fancyfish","faeng","common","SingleIterator"]; +com_fancyfish_faeng_common_SingleIterator.prototype = { + single: null + ,next: function() { + var ret = this.single; + this.single = null; + return ret; + } + ,hasNext: function() { + return this.single != null; + } + ,__class__: com_fancyfish_faeng_common_SingleIterator +}; +var com_fancyfish_faeng_common_SortedArray = function(_getSortValue) { + this.array = []; + this.getSortValue = _getSortValue; +}; +$hxClasses["com.fancyfish.faeng.common.SortedArray"] = com_fancyfish_faeng_common_SortedArray; +com_fancyfish_faeng_common_SortedArray.__name__ = ["com","fancyfish","faeng","common","SortedArray"]; +com_fancyfish_faeng_common_SortedArray.lower_bound = function(array,val,getSortValue) { + var count = array.length; + var cur = 0; + var step; + while(count > 0) { + step = count >> 1; + var v = getSortValue(array[cur + step]); + if(v < val) { + cur += step + 1; + count -= step + 1; + } else if(v == val) { + return cur + step; + } else { + count = step; + } + } + return cur; +}; +com_fancyfish_faeng_common_SortedArray.sortableValue = function(s) { + return s.getSortValue(); +}; +com_fancyfish_faeng_common_SortedArray.prototype = { + array: null + ,getSortValue: null + ,length: function() { + return this.array.length; + } + ,get: function(i) { + return this.array[i]; + } + ,getByValue: function(val) { + if(this.array.length == 0) { + return null; + } else { + var i = com_fancyfish_faeng_common_SortedArray.lower_bound(this.array,val,this.getSortValue); + return this.array[com_fancyfish_faeng_common_Utils.min(i,this.array.length - 1)]; + } + } + ,insert: function(t) { + var _this = this.array; + var pos = com_fancyfish_faeng_common_SortedArray.lower_bound(this.array,this.getSortValue(t),this.getSortValue); + _this.splice(pos,0,t); + } + ,__class__: com_fancyfish_faeng_common_SortedArray +}; +var com_fancyfish_faeng_common_StringTokenizer = function(str,delims,len) { + if(len == null) { + len = -1; + } + if(delims == null) { + delims = " \t\n\r"; + } + this.str = str; + this.delims = delims; + this.token_end = -1; + this.length = len < 0 ? str.length : len; +}; +$hxClasses["com.fancyfish.faeng.common.StringTokenizer"] = com_fancyfish_faeng_common_StringTokenizer; +com_fancyfish_faeng_common_StringTokenizer.__name__ = ["com","fancyfish","faeng","common","StringTokenizer"]; +com_fancyfish_faeng_common_StringTokenizer.prototype = { + token_start: null + ,token_end: null + ,str: null + ,delims: null + ,length: null + ,isDelim: function(c,delims) { + var len = delims.length; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + if(HxOverrides.cca(delims,i) == c) { + return true; + } + } + return false; + } + ,nextDelim: function(from,delims) { + var len = this.length; + var _g1 = from; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + if(this.isDelim(HxOverrides.cca(this.str,i),delims)) { + return i; + } + } + return len; + } + ,nextNonDelim: function(from,delims) { + var len = this.length; + var _g1 = from; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + if(!this.isDelim(HxOverrides.cca(this.str,i),delims)) { + return i; + } + } + return -1; + } + ,next: function(delims) { + if(delims == null) { + delims = this.delims; + } + this.token_start = this.nextNonDelim(this.token_end + 1,delims); + if(this.token_start == -1) { + return false; + } + this.token_end = this.nextDelim(this.token_start + 1,delims); + return true; + } + ,getToken: function() { + if(this.token_start == 0 && this.token_end == this.str.length) { + return this.str; + } else { + return this.str.substring(this.token_start,this.token_end); + } + } + ,__class__: com_fancyfish_faeng_common_StringTokenizer +}; +var com_fancyfish_faeng_common_UTFUtils = function() { }; +$hxClasses["com.fancyfish.faeng.common.UTFUtils"] = com_fancyfish_faeng_common_UTFUtils; +com_fancyfish_faeng_common_UTFUtils.__name__ = ["com","fancyfish","faeng","common","UTFUtils"]; +com_fancyfish_faeng_common_UTFUtils.writeUTF = function(b,v) { + if(v == null) { + b.writeUInt16(65535); + } else { + var bytes = haxe_io_Bytes.ofString(v); + var len = bytes.length; + b.writeUInt16(len); + b.writeFullBytes(bytes,0,len); + } +}; +com_fancyfish_faeng_common_UTFUtils.readUTF = function(b) { + var len = b.readUInt16(); + if(len == 65535) { + return null; + } + var bytes = haxe_io_Bytes.alloc(len); + b.readFullBytes(bytes,0,len); + return bytes.toString(); +}; +var com_fancyfish_faeng_common_Utils = function() { }; +$hxClasses["com.fancyfish.faeng.common.Utils"] = com_fancyfish_faeng_common_Utils; +com_fancyfish_faeng_common_Utils.__name__ = ["com","fancyfish","faeng","common","Utils"]; +com_fancyfish_faeng_common_Utils.numberOfOnes = function(i) { + i -= i >> 1 & 1431655765; + i = (i & 858993459) + (i >> 2 & 858993459); + return (i + (i >> 4) & 252645135) * 16843009 >> 24; +}; +com_fancyfish_faeng_common_Utils.numberOfTrailingZeros = function(i) { + return com_fancyfish_faeng_common_Utils.MultiplyDeBruijnBitPosition[(i & -i) * 125613361 >> 27]; +}; +com_fancyfish_faeng_common_Utils.numberOfLeadingZeros = function(i) { + i |= i >> 1; + i |= i >> 2; + i |= i >> 4; + i |= i >> 8; + i |= i >> 16; + return 32 - com_fancyfish_faeng_common_Utils.numberOfOnes(i); +}; +com_fancyfish_faeng_common_Utils.nearestPowerOf2 = function(i) { + return com_fancyfish_faeng_common_Utils.pow2(32 - com_fancyfish_faeng_common_Utils.numberOfLeadingZeros(i - 1)); +}; +com_fancyfish_faeng_common_Utils.abs = function(a) { + if(a < 0) { + return -a; + } else { + return a; + } +}; +com_fancyfish_faeng_common_Utils.min = function(a,b) { + if(a < b) { + return a; + } else { + return b; + } +}; +com_fancyfish_faeng_common_Utils.max = function(a,b) { + if(a > b) { + return a; + } else { + return b; + } +}; +com_fancyfish_faeng_common_Utils.sign = function(f,fuzzy) { + if(fuzzy == null) { + fuzzy = 0; + } + if(f > fuzzy) { + return 1; + } else if(f < -fuzzy) { + return -1; + } else { + return 0; + } +}; +com_fancyfish_faeng_common_Utils.fract = function(f) { + return f - Math.floor(f); +}; +com_fancyfish_faeng_common_Utils.clampi = function(e,l,h) { + if(e > l) { + if(e > h) { + return h; + } else { + return e; + } + } else { + return l; + } +}; +com_fancyfish_faeng_common_Utils.clamp = function(e,l,h) { + if(e > l) { + if(e > h) { + return h; + } else { + return e; + } + } else { + return l; + } +}; +com_fancyfish_faeng_common_Utils.interp = function(a,b,f) { + return a * (1 - f) + b * f; +}; +com_fancyfish_faeng_common_Utils.mod = function(a,n) { + return a - Math.floor(a / n) * n; +}; +com_fancyfish_faeng_common_Utils.smoothstep = function(edge0,edge1,x) { + var f = com_fancyfish_faeng_common_Utils.clamp((x - edge0) / (edge1 - edge0),0,1); + return f * f * (3 - 2 * f); +}; +com_fancyfish_faeng_common_Utils.toRadians = function(d) { + return d * Math.PI / 180.0; +}; +com_fancyfish_faeng_common_Utils.toDegrees = function(r) { + return r * 180.0 / Math.PI; +}; +com_fancyfish_faeng_common_Utils.luminance = function(r,g,b) { + return r * 0.299 + g * 0.587 + b * 0.114; +}; +com_fancyfish_faeng_common_Utils.luminancei = function(col) { + return com_fancyfish_faeng_common_Utils.luminance((col >> 16 & 255) / 255.0,(col >> 8 & 255) / 255.0,(col & 255) / 255.0); +}; +com_fancyfish_faeng_common_Utils.pow2 = function(i) { + return 1 << i; +}; +com_fancyfish_faeng_common_Utils.log2floor = function(i) { + i |= i >> 1; + i |= i >> 2; + i |= i >> 4; + i |= i >> 8; + i |= i >> 16; + return com_fancyfish_faeng_common_Utils.numberOfOnes(i) - 1; +}; +com_fancyfish_faeng_common_Utils.log2ceil = function(i) { + var v = i & i - 1; + v |= -v; + v >>= 31; + return com_fancyfish_faeng_common_Utils.log2floor(i) - v; +}; +com_fancyfish_faeng_common_Utils.contains = function(f,ar) { + var _g = 0; + while(_g < ar.length) { + var t = ar[_g]; + ++_g; + if(f == t) { + return true; + } + } + return false; +}; +com_fancyfish_faeng_common_Utils.drawCDF = function(cdf,r,normalized) { + if(normalized == null) { + normalized = true; + } + if(r == null) { + r = -1; + } + if(r < 0) { + r = Math.random(); + } + if(normalized) { + r *= cdf[cdf.length - 1]; + } + var count = cdf.length; + var st = 0; + var step; + while(count > 0) { + step = count >> 1; + if(r > cdf[st + step]) { + st += step + 1; + count -= step + 1; + } else { + count = step; + } + } + return st; +}; +com_fancyfish_faeng_common_Utils.pdfToCDF = function(pdf) { + var total = 0.0; + var len = pdf.length; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + total += pdf[i]; + pdf[i] = total; + } + return total; +}; +com_fancyfish_faeng_common_Utils.shuffle = function(ar,rnd) { + var i = ar.length; + while(i > 1) { + var rnd1 = Math.floor(rnd() * i); + --i; + var tmp = ar[i]; + ar[i] = ar[rnd1]; + ar[rnd1] = tmp; + } +}; +com_fancyfish_faeng_common_Utils.shuffleN = function(ar,ct,rnd) { + var i = Std["int"](ar.length / ct); + while(i > 1) { + var rnd1 = Math.floor(rnd() * i) * ct; + --i; + var idx = i * ct; + var _g1 = 0; + var _g = ct; + while(_g1 < _g) { + var j = _g1++; + var tmp = ar[idx + j]; + ar[idx + j] = ar[rnd1 + j]; + ar[rnd1 + j] = tmp; + } + } +}; +com_fancyfish_faeng_common_Utils.addCommas = function(f) { + var ret = ""; + var i = Math.floor(f); + var j = Math.round((f - i) * 100); + if(j >= 100) { + j = 0; + ++i; + } + var s = i == null ? "null" : "" + i; + var l = 0; + var len = s.length; + while(l < len - 3) { + l += 3; + ret = "," + HxOverrides.substr(s,len - l,3) + ret; + } + ret = HxOverrides.substr(s,0,len - l) + ret; + if(j != 0) { + ret += "." + (j < 10 ? "0" : "") + j; + } + return ret; +}; +com_fancyfish_faeng_common_Utils.digits4 = function(i,div) { + var f = Math.floor(i / div); + if(f < 100) { + var r = Math.floor((i - f * div) * 10 / div); + if(r == 0) { + if(f == null) { + return "null"; + } else { + return "" + f; + } + } else { + return f + "." + r; + } + } else { + return Std.string(Math.round(i / div)); + } +}; +com_fancyfish_faeng_common_Utils.largeNumberFormat = function(i) { + if(i > 999999) { + return com_fancyfish_faeng_common_Utils.digits4(i,1000000) + "M"; + } else if(i > 9999 || i >= 1000 && i % 1000 == 0) { + return com_fancyfish_faeng_common_Utils.digits4(i,1000) + "K"; + } else if(i == null) { + return "null"; + } else { + return "" + i; + } +}; +com_fancyfish_faeng_common_Utils.largeNumberFormat2 = function(i) { + if(i > 999999) { + return com_fancyfish_faeng_common_Utils.addCommas(Math.round(i / 1000)) + "K"; + } else { + return com_fancyfish_faeng_common_Utils.addCommas(i); + } +}; +com_fancyfish_faeng_common_Utils.oneDecimal = function(f) { + var i = Math.floor(f); + var j = Math.round((f - i) * 10); + if(j == 0) { + if(i == null) { + return "null"; + } else { + return "" + i; + } + } else { + return i + "." + j; + } +}; +com_fancyfish_faeng_common_Utils.twoDigits = function(i) { + if(i < 10) { + return "0" + i; + } else if(i == null) { + return "null"; + } else { + return "" + i; + } +}; +com_fancyfish_faeng_common_Utils.toSigned8 = function(u) { + if(u < 128) { + return u; + } else { + return u - 256; + } +}; +com_fancyfish_faeng_common_Utils.toSigned16 = function(u) { + if(u < 32768) { + return u; + } else { + return u - 65536; + } +}; +com_fancyfish_faeng_common_Utils.toUnsigned32 = function(u) { + if(u < 0) { + return 4294967296.0 + u; + } else { + return u; + } +}; +com_fancyfish_faeng_common_Utils.getColor = function(col,channel) { + return (col >> channel & 255) / 255.0; +}; +com_fancyfish_faeng_common_Utils.setColor = function(col,channel,val) { + return col | (Math.floor(val * 255.0 + 0.5) & 255) << channel; +}; +com_fancyfish_faeng_common_Utils.printStackTrace = function(err) { + haxe_Log.trace(Std.string(err) + haxe_CallStack.toString(haxe_CallStack.callStack()),{ fileName : "Utils.hx", lineNumber : 116, className : "com.fancyfish.faeng.common.Utils", methodName : "printStackTrace"}); +}; +com_fancyfish_faeng_common_Utils.printExceptionTrace = function(err) { + haxe_Log.trace(Std.string(err) + haxe_CallStack.toString(haxe_CallStack.exceptionStack()),{ fileName : "Utils.hx", lineNumber : 117, className : "com.fancyfish.faeng.common.Utils", methodName : "printExceptionTrace"}); +}; +com_fancyfish_faeng_common_Utils.frand = function(x) { + return com_fancyfish_faeng_common_Utils.fract(Math.sin(x * 9106.966345) * 49824.21294); +}; +com_fancyfish_faeng_common_Utils.frand2 = function(x,y) { + return com_fancyfish_faeng_common_Utils.fract(Math.sin(x * 9106.966345 + y * 3742.931314) * 49824.21294); +}; +com_fancyfish_faeng_common_Utils.frand3 = function(x,y,z) { + return com_fancyfish_faeng_common_Utils.fract(Math.sin(x * 9106.966345 + y * 3742.931314 + z * 8046.780733) * 49824.21294); +}; +com_fancyfish_faeng_common_Utils.frand4 = function(x,y,z,w) { + return com_fancyfish_faeng_common_Utils.fract(Math.sin(x * 9106.966345 + y * 3742.931314 + z * 8046.780733 + w * 2574.684771) * 49824.21294); +}; +com_fancyfish_faeng_common_Utils.getGaussian = function(rnd) { + if(isNaN(com_fancyfish_faeng_common_Utils.nextGaussian)) { + var g = com_fancyfish_faeng_common_Utils.getGaussian2(rnd); + com_fancyfish_faeng_common_Utils.nextGaussian = g.second; + return g.first; + } else { + var r = com_fancyfish_faeng_common_Utils.nextGaussian; + com_fancyfish_faeng_common_Utils.nextGaussian = NaN; + return r; + } +}; +com_fancyfish_faeng_common_Utils.getGaussian2 = function(rnd) { + var v1; + var v2; + var s; + while(true) { + v1 = 2 * rnd() - 1; + v2 = 2 * rnd() - 1; + s = v1 * v1 + v2 * v2; + if(!(s >= 1 || s == 0)) { + break; + } + } + var mul = Math.sqrt(-2 * Math.log(s) / s); + return { first : v1 * mul, second : v2 * mul}; +}; +com_fancyfish_faeng_common_Utils.clear = function(arr) { + com_fancyfish_faeng_common_Utils.resizeArray(arr,0); +}; +com_fancyfish_faeng_common_Utils.resizeArray = function(arr,sz) { + arr.length = sz; +}; +com_fancyfish_faeng_common_Utils.getIdx = function(x,y) { + return (y + 16384) * 32768 + (x + 16384); +}; +com_fancyfish_faeng_common_Utils.getX = function(idx) { + return idx % 32768 - 16384; +}; +com_fancyfish_faeng_common_Utils.getY = function(idx) { + return Math.floor(idx / 32768) - 16384; +}; +com_fancyfish_faeng_common_Utils.HSVtoRGB = function(hue,saturation,brightness) { + var r = 0; + var g = 0; + var b = 0; + saturation = com_fancyfish_faeng_common_Utils.clamp(saturation,0,1); + if(saturation == 0) { + b = Math.round(brightness * 255.0); + g = b; + r = g; + } else { + hue = com_fancyfish_faeng_common_Utils.clamp(hue,0,360); + brightness = com_fancyfish_faeng_common_Utils.clamp(brightness,0,1); + if(hue == 360) { + hue = 0; + } + var h = hue / 60; + var c = brightness * saturation; + var x = c * (1 - Math.abs(h % 2 - 1)); + var m = brightness - c; + var _g = Math.floor(h); + switch(_g) { + case 0: + r = Math.round((c + m) * 255); + g = Math.round((x + m) * 255); + b = Math.round(m * 255); + break; + case 1: + r = Math.round((x + m) * 255); + g = Math.round((c + m) * 255); + b = Math.round(m * 255); + break; + case 2: + r = Math.round(m * 255); + g = Math.round((c + m) * 255); + b = Math.round((x + m) * 255); + break; + case 3: + r = Math.round(m * 255); + g = Math.round((x + m) * 255); + b = Math.round((c + m) * 255); + break; + case 4: + r = Math.round((x + m) * 255); + g = Math.round(m * 255); + b = Math.round((c + m) * 255); + break; + case 5: + r = Math.round((c + m) * 255); + g = Math.round(m * 255); + b = Math.round((x + m) * 255); + break; + } + } + return (r & 255) << 16 | (g & 255) << 8 | b & 255; +}; +var com_fancyfish_faeng_common_mutable_Concat = function(first,second) { + com_fancyfish_faeng_common_mutable_Mutable.call(this); + this.first = first; + this.second = second; +}; +$hxClasses["com.fancyfish.faeng.common.mutable.Concat"] = com_fancyfish_faeng_common_mutable_Concat; +com_fancyfish_faeng_common_mutable_Concat.__name__ = ["com","fancyfish","faeng","common","mutable","Concat"]; +com_fancyfish_faeng_common_mutable_Concat.__super__ = com_fancyfish_faeng_common_mutable_Mutable; +com_fancyfish_faeng_common_mutable_Concat.prototype = $extend(com_fancyfish_faeng_common_mutable_Mutable.prototype,{ + first: null + ,second: null + ,getValue: function() { + return this.first.get() + this.second; + } + ,handleEvent: function(e) { + this.update(); + } + ,addEventListener: function(type,listener,useCapture,priority,useWeakReference) { + if(useWeakReference == null) { + useWeakReference = false; + } + if(priority == null) { + priority = 0; + } + if(useCapture == null) { + useCapture = false; + } + var old = this.hasEventListener("updated"); + com_fancyfish_faeng_common_mutable_Mutable.prototype.addEventListener.call(this,type,listener); + if(!old && this.hasEventListener("updated")) { + this.first.addEventListener("updated",$bind(this,this.handleEvent)); + } + } + ,removeEventListener: function(type,listener,useCapture) { + if(useCapture == null) { + useCapture = false; + } + var old = this.hasEventListener("updated"); + com_fancyfish_faeng_common_mutable_Mutable.prototype.removeEventListener.call(this,type,listener); + if(old && !this.hasEventListener("updated")) { + this.first.removeEventListener("updated",$bind(this,this.handleEvent)); + } + } + ,__class__: com_fancyfish_faeng_common_mutable_Concat +}); +var com_fancyfish_faeng_common_mutable_ListMutable = function(list,delim) { + if(delim == null) { + delim = ""; + } + com_fancyfish_faeng_common_mutable_Mutable.call(this); + this.list = list; + this.delim = delim; +}; +$hxClasses["com.fancyfish.faeng.common.mutable.ListMutable"] = com_fancyfish_faeng_common_mutable_ListMutable; +com_fancyfish_faeng_common_mutable_ListMutable.__name__ = ["com","fancyfish","faeng","common","mutable","ListMutable"]; +com_fancyfish_faeng_common_mutable_ListMutable.__super__ = com_fancyfish_faeng_common_mutable_Mutable; +com_fancyfish_faeng_common_mutable_ListMutable.prototype = $extend(com_fancyfish_faeng_common_mutable_Mutable.prototype,{ + list: null + ,delim: null + ,getValue: function() { + var b = new StringBuf(); + var first = true; + var _g = 0; + var _g1 = this.list; + while(_g < _g1.length) { + var item = _g1[_g]; + ++_g; + if(first) { + first = false; + } else { + b.add(this.delim); + } + b.add(item.get()); + } + return b.toString(); + } + ,handleEvent: function(e) { + this.update(); + } + ,addEventListener: function(type,listener,useCapture,priority,useWeakReference) { + if(useWeakReference == null) { + useWeakReference = false; + } + if(priority == null) { + priority = 0; + } + if(useCapture == null) { + useCapture = false; + } + var old = this.hasEventListener("updated"); + com_fancyfish_faeng_common_mutable_Mutable.prototype.addEventListener.call(this,type,listener); + if(!old && this.hasEventListener("updated")) { + var _g = 0; + var _g1 = this.list; + while(_g < _g1.length) { + var m = _g1[_g]; + ++_g; + m.addEventListener("updated",$bind(this,this.handleEvent)); + } + } + } + ,removeEventListener: function(type,listener,useCapture) { + if(useCapture == null) { + useCapture = false; + } + var old = this.hasEventListener("updated"); + com_fancyfish_faeng_common_mutable_Mutable.prototype.removeEventListener.call(this,type,listener); + if(old && !this.hasEventListener("updated")) { + var _g = 0; + var _g1 = this.list; + while(_g < _g1.length) { + var m = _g1[_g]; + ++_g; + m.removeEventListener("updated",$bind(this,this.handleEvent)); + } + } + } + ,__class__: com_fancyfish_faeng_common_mutable_ListMutable +}); +var com_fancyfish_faeng_common_mutable_Concat2 = function(first,second,delim) { + if(delim == null) { + delim = ""; + } + com_fancyfish_faeng_common_mutable_ListMutable.call(this,[first,second],delim); +}; +$hxClasses["com.fancyfish.faeng.common.mutable.Concat2"] = com_fancyfish_faeng_common_mutable_Concat2; +com_fancyfish_faeng_common_mutable_Concat2.__name__ = ["com","fancyfish","faeng","common","mutable","Concat2"]; +com_fancyfish_faeng_common_mutable_Concat2.__super__ = com_fancyfish_faeng_common_mutable_ListMutable; +com_fancyfish_faeng_common_mutable_Concat2.prototype = $extend(com_fancyfish_faeng_common_mutable_ListMutable.prototype,{ + __class__: com_fancyfish_faeng_common_mutable_Concat2 +}); +var com_fancyfish_faeng_common_mutable_MutableTemplate = function(mutable,templates) { + com_fancyfish_faeng_common_mutable_Mutable.call(this); + this.mutable = mutable; + this.templates = templates; +}; +$hxClasses["com.fancyfish.faeng.common.mutable.MutableTemplate"] = com_fancyfish_faeng_common_mutable_MutableTemplate; +com_fancyfish_faeng_common_mutable_MutableTemplate.__name__ = ["com","fancyfish","faeng","common","mutable","MutableTemplate"]; +com_fancyfish_faeng_common_mutable_MutableTemplate.__super__ = com_fancyfish_faeng_common_mutable_Mutable; +com_fancyfish_faeng_common_mutable_MutableTemplate.prototype = $extend(com_fancyfish_faeng_common_mutable_Mutable.prototype,{ + mutable: null + ,templates: null + ,getValue: function() { + var ret = this.mutable.get(); + var k = this.templates.keys(); + while(k.hasNext()) { + var k1 = k.next(); + ret = StringTools.replace(ret,k1,this.templates.get(k1).get()); + } + return ret; + } + ,handleEvent: function(e) { + this.update(); + } + ,addEventListener: function(type,listener,useCapture,priority,useWeakReference) { + if(useWeakReference == null) { + useWeakReference = false; + } + if(priority == null) { + priority = 0; + } + if(useCapture == null) { + useCapture = false; + } + var old = this.hasEventListener("updated"); + com_fancyfish_faeng_common_mutable_Mutable.prototype.addEventListener.call(this,type,listener); + if(!old && this.hasEventListener("updated")) { + this.mutable.addEventListener("updated",$bind(this,this.handleEvent)); + } + } + ,removeEventListener: function(type,listener,useCapture) { + if(useCapture == null) { + useCapture = false; + } + var old = this.hasEventListener("updated"); + com_fancyfish_faeng_common_mutable_Mutable.prototype.removeEventListener.call(this,type,listener); + if(old && !this.hasEventListener("updated")) { + this.mutable.removeEventListener("updated",$bind(this,this.handleEvent)); + } + } + ,__class__: com_fancyfish_faeng_common_mutable_MutableTemplate +}); +var com_fancyfish_faeng_common_mutable_MutableTemplateStatic = function(mutable,templates) { + com_fancyfish_faeng_common_mutable_Mutable.call(this); + this.mutable = mutable; + this.templates = templates; +}; +$hxClasses["com.fancyfish.faeng.common.mutable.MutableTemplateStatic"] = com_fancyfish_faeng_common_mutable_MutableTemplateStatic; +com_fancyfish_faeng_common_mutable_MutableTemplateStatic.__name__ = ["com","fancyfish","faeng","common","mutable","MutableTemplateStatic"]; +com_fancyfish_faeng_common_mutable_MutableTemplateStatic.__super__ = com_fancyfish_faeng_common_mutable_Mutable; +com_fancyfish_faeng_common_mutable_MutableTemplateStatic.prototype = $extend(com_fancyfish_faeng_common_mutable_Mutable.prototype,{ + mutable: null + ,templates: null + ,getValue: function() { + var ret = this.mutable.get(); + var k = this.templates.keys(); + while(k.hasNext()) { + var k1 = k.next(); + ret = StringTools.replace(ret,k1,this.templates.get(k1)); + } + return ret; + } + ,handleEvent: function(e) { + this.update(); + } + ,addEventListener: function(type,listener,useCapture,priority,useWeakReference) { + if(useWeakReference == null) { + useWeakReference = false; + } + if(priority == null) { + priority = 0; + } + if(useCapture == null) { + useCapture = false; + } + var old = this.hasEventListener("updated"); + com_fancyfish_faeng_common_mutable_Mutable.prototype.addEventListener.call(this,type,listener); + if(!old && this.hasEventListener("updated")) { + this.mutable.addEventListener("updated",$bind(this,this.handleEvent)); + } + } + ,removeEventListener: function(type,listener,useCapture) { + if(useCapture == null) { + useCapture = false; + } + var old = this.hasEventListener("updated"); + com_fancyfish_faeng_common_mutable_Mutable.prototype.removeEventListener.call(this,type,listener); + if(old && !this.hasEventListener("updated")) { + this.mutable.removeEventListener("updated",$bind(this,this.handleEvent)); + } + } + ,__class__: com_fancyfish_faeng_common_mutable_MutableTemplateStatic +}); +var com_fancyfish_faeng_common_mutable_Static = function(v) { + com_fancyfish_faeng_common_mutable_Mutable.call(this); + this.value = v; +}; +$hxClasses["com.fancyfish.faeng.common.mutable.Static"] = com_fancyfish_faeng_common_mutable_Static; +com_fancyfish_faeng_common_mutable_Static.__name__ = ["com","fancyfish","faeng","common","mutable","Static"]; +com_fancyfish_faeng_common_mutable_Static.__super__ = com_fancyfish_faeng_common_mutable_Mutable; +com_fancyfish_faeng_common_mutable_Static.prototype = $extend(com_fancyfish_faeng_common_mutable_Mutable.prototype,{ + update: function() { + } + ,__class__: com_fancyfish_faeng_common_mutable_Static +}); +var com_fancyfish_faeng_display_Matrix2D = function() { }; +$hxClasses["com.fancyfish.faeng.display.Matrix2D"] = com_fancyfish_faeng_display_Matrix2D; +com_fancyfish_faeng_display_Matrix2D.__name__ = ["com","fancyfish","faeng","display","Matrix2D"]; +com_fancyfish_faeng_display_Matrix2D.prototype = { + a: null + ,b: null + ,c: null + ,d: null + ,tx: null + ,ty: null + ,toString: function() { + return "Matrix2D [" + this.a + "," + this.b + "," + this.c + "," + this.d + "," + this.tx + "," + this.ty + "]"; + } + ,__class__: com_fancyfish_faeng_display_Matrix2D +}; +var com_fancyfish_faeng_display_Point2D = function() { }; +$hxClasses["com.fancyfish.faeng.display.Point2D"] = com_fancyfish_faeng_display_Point2D; +com_fancyfish_faeng_display_Point2D.__name__ = ["com","fancyfish","faeng","display","Point2D"]; +com_fancyfish_faeng_display_Point2D.prototype = { + x: null + ,y: null + ,toString: function() { + return "[" + this.x + "," + this.y + "]"; + } + ,__class__: com_fancyfish_faeng_display_Point2D +}; +var com_fancyfish_faeng_renderer_Color = function(r,g,b,a) { + if(a == null) { + a = 1; + } + if(b == null) { + b = 0; + } + if(g == null) { + g = 0; + } + if(r == null) { + r = 0; + } + this.set(r,g,b,a); +}; +$hxClasses["com.fancyfish.faeng.renderer.Color"] = com_fancyfish_faeng_renderer_Color; +com_fancyfish_faeng_renderer_Color.__name__ = ["com","fancyfish","faeng","renderer","Color"]; +com_fancyfish_faeng_renderer_Color.fromInt = function(col,incAlpha) { + if(incAlpha == null) { + incAlpha = true; + } + return new com_fancyfish_faeng_renderer_Color(com_fancyfish_faeng_common_Utils.getColor(col,16),com_fancyfish_faeng_common_Utils.getColor(col,8),com_fancyfish_faeng_common_Utils.getColor(col,0),incAlpha ? com_fancyfish_faeng_common_Utils.getColor(col,24) : 1); +}; +com_fancyfish_faeng_renderer_Color.prototype = { + r: null + ,g: null + ,b: null + ,a: null + ,set: function(r,g,b,a) { + if(a == null) { + a = 1; + } + if(b == null) { + b = 0; + } + if(g == null) { + g = 0; + } + if(r == null) { + r = 0; + } + this.r = r; + this.g = g; + this.b = b; + this.a = a; + } + ,toInt: function() { + return com_fancyfish_faeng_common_Utils.setColor(com_fancyfish_faeng_common_Utils.setColor(com_fancyfish_faeng_common_Utils.setColor(com_fancyfish_faeng_common_Utils.setColor(0,16,this.r),8,this.g),0,this.b),24,this.a); + } + ,mult: function(c) { + this.r *= c.r; + this.g *= c.g; + this.b *= c.b; + this.a *= c.a; + return this; + } + ,toString: function() { + return "Color [" + this.r + "," + this.g + "," + this.b + "," + this.a + "]"; + } + ,__class__: com_fancyfish_faeng_renderer_Color +}; +var com_fancyfish_faeng_text_CharacterPos = function(c,x,y,s,i,l) { + this.character = c; + this.set_x(x); + this.set_y(y); + this.scale = s; + this.id = i; + this.line = l; +}; +$hxClasses["com.fancyfish.faeng.text.CharacterPos"] = com_fancyfish_faeng_text_CharacterPos; +com_fancyfish_faeng_text_CharacterPos.__name__ = ["com","fancyfish","faeng","text","CharacterPos"]; +com_fancyfish_faeng_text_CharacterPos.prototype = { + character: null + ,x: null + ,y: null + ,scale: null + ,id: null + ,line: null + ,get_x: function() { + if(com_fancyfish_faeng_text_CharacterPos.ROUND) { + return Math.round(this.x); + } else { + return this.x; + } + } + ,get_y: function() { + if(com_fancyfish_faeng_text_CharacterPos.ROUND) { + return Math.round(this.y); + } else { + return this.y; + } + } + ,set_x: function(x) { + return this.x = x; + } + ,set_y: function(y) { + return this.y = y; + } + ,__class__: com_fancyfish_faeng_text_CharacterPos + ,__properties__: {set_y:"set_y",get_y:"get_y",set_x:"set_x",get_x:"get_x"} +}; +var com_fancyfish_faeng_text_Font = function(xml,path) { + this.file = xml.elementsNamed("pages").next().elementsNamed("page").next().get("file"); + this.internalScale = xml.exists("internalScale") ? Std.parseFloat(xml.get("internalScale")) : 1; + var idx = path.lastIndexOf("/"); + if(idx != -1) { + this.file = path.substring(0,idx + 1) + this.file; + } + var info = xml.elementsNamed("info").next(); + this.fontName = info.get("face"); + this.size = Std.parseFloat(info.get("size")) * this.internalScale; + var common = xml.elementsNamed("common").next(); + this.lineHeight = Std.parseFloat(common.get("lineHeight")) * this.internalScale; + this.baseline = Std.parseFloat(common.get("base")) * this.internalScale / this.lineHeight; + this.characters = new haxe_ds_IntMap(); + var chars = xml.elementsNamed("chars").next(); + var xoffset = common.exists("xoffset") ? Std.parseFloat(common.get("xoffset")) * this.internalScale : 0; + var yoffset = common.exists("yoffset") ? Std.parseFloat(common.get("yoffset")) * this.internalScale : 0; + var c = chars.elementsNamed("char"); + while(c.hasNext()) { + var c1 = c.next(); + var $char = new com_fancyfish_faeng_text_Character(c1,this); + $char.xoffset += xoffset; + $char.yoffset += yoffset; + this.characters.set($char.id,$char); + } + var kernings = xml.elementsNamed("kernings").next(); + if(kernings != null) { + var k = kernings.elementsNamed("kerning"); + while(k.hasNext()) { + var k1 = k.next(); + var char1 = this.characters.get(Std.parseInt(k1.get("second"))); + if(char1 == null) { + continue; + } + char1.addKerning(Std.parseInt(k1.get("first")),Std.parseFloat(k1.get("amount"))); + } + } +}; +$hxClasses["com.fancyfish.faeng.text.Font"] = com_fancyfish_faeng_text_Font; +com_fancyfish_faeng_text_Font.__name__ = ["com","fancyfish","faeng","text","Font"]; +com_fancyfish_faeng_text_Font.prototype = { + fontName: null + ,size: null + ,lineHeight: null + ,baseline: null + ,characters: null + ,file: null + ,userData: null + ,internalScale: null + ,getCharacter: function(id) { + if(id > 32 && !this.characters.exists(id)) { + haxe_Log.trace("Character not found: " + id,{ fileName : "Font.hx", lineNumber : 33, className : "com.fancyfish.faeng.text.Font", methodName : "getCharacter"}); + } + return this.characters.get(id); + } + ,stringWidth: function(str) { + var ret = 0; + var len = str.length; + var prev = -1; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + var id = haxe_Utf8.charCodeAt(str,i); + var c = this.getCharacter(id); + if(c != null) { + ret += c.getXAdvance(prev); + } + prev = id; + } + return ret; + } + ,iterator: function() { + return this.characters.iterator(); + } + ,__class__: com_fancyfish_faeng_text_Font +}; +var ds_AABB = function(x,y,width,height) { + if(height == null) { + height = 0; + } + if(width == null) { + width = 0; + } + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + this.minX = x; + this.minY = y; + this.maxX = x + width; + this.maxY = y + height; +}; +$hxClasses["ds.AABB"] = ds_AABB; +ds_AABB.__name__ = ["ds","AABB"]; +ds_AABB.prototype = { + minX: null + ,maxX: null + ,minY: null + ,maxY: null + ,get_x: function() { + return this.minX; + } + ,get_y: function() { + return this.minY; + } + ,get_width: function() { + return this.maxX - this.minX; + } + ,get_height: function() { + return this.maxY - this.minY; + } + ,setTo: function(x,y,width,height) { + if(height == null) { + height = 0; + } + if(width == null) { + width = 0; + } + this.minX = x; + this.minY = y; + this.maxX = x + width; + this.maxY = y + height; + } + ,inflate: function(deltaX,deltaY) { + this.minX -= deltaX; + this.minY -= deltaY; + this.maxX += deltaX; + this.maxY += deltaY; + return this; + } + ,getPerimeter: function() { + return 2 * (this.maxX - this.minX + (this.maxY - this.minY)); + } + ,asUnionOf: function(aabb1,aabb2) { + this.minX = Math.min(aabb1.minX,aabb2.minX); + this.minY = Math.min(aabb1.minY,aabb2.minY); + this.maxX = Math.max(aabb1.maxX,aabb2.maxX); + this.maxY = Math.max(aabb1.maxY,aabb2.maxY); + return this; + } + ,overlaps: function(aabb) { + return !(this.minX > aabb.maxX || this.maxX < aabb.minX || this.minY > aabb.maxY || this.maxY < aabb.minY); + } + ,contains: function(aabb) { + if(aabb.minX >= this.minX && aabb.maxX <= this.maxX && aabb.minY >= this.minY) { + return aabb.maxY <= this.maxY; + } else { + return false; + } + } + ,__class__: ds_AABB + ,__properties__: {get_height:"get_height",get_width:"get_width",get_y:"get_y",get_x:"get_x"} +}; +var ds_HitBehaviour = $hxClasses["ds.HitBehaviour"] = { __ename__ : ["ds","HitBehaviour"], __constructs__ : ["SKIP","INCLUDE","INCLUDE_AND_STOP","STOP"] }; +ds_HitBehaviour.SKIP = ["SKIP",0]; +ds_HitBehaviour.SKIP.toString = $estr; +ds_HitBehaviour.SKIP.__enum__ = ds_HitBehaviour; +ds_HitBehaviour.INCLUDE = ["INCLUDE",1]; +ds_HitBehaviour.INCLUDE.toString = $estr; +ds_HitBehaviour.INCLUDE.__enum__ = ds_HitBehaviour; +ds_HitBehaviour.INCLUDE_AND_STOP = ["INCLUDE_AND_STOP",2]; +ds_HitBehaviour.INCLUDE_AND_STOP.toString = $estr; +ds_HitBehaviour.INCLUDE_AND_STOP.__enum__ = ds_HitBehaviour; +ds_HitBehaviour.STOP = ["STOP",3]; +ds_HitBehaviour.STOP.toString = $estr; +ds_HitBehaviour.STOP.__enum__ = ds_HitBehaviour; +var ds_AABBTree = function(fattenDelta,insertStrategy,initialPoolCapacity,poolGrowthFactor) { + if(poolGrowthFactor == null) { + poolGrowthFactor = 2; + } + if(initialPoolCapacity == null) { + initialPoolCapacity = 64; + } + if(fattenDelta == null) { + fattenDelta = 10; + } + this.root = null; + this.maxId = 0; + this.numLeaves = 0; + this.fattenDelta = fattenDelta; + this.insertStrategy = insertStrategy != null ? insertStrategy : new ds_aabbtree_InsertStrategyPerimeter(); + this.pool = new ds_aabbtree_NodePool(initialPoolCapacity,poolGrowthFactor); + this.unusedIds = []; + this.nodes = []; + this.leaves = new haxe_ds_IntMap(); +}; +$hxClasses["ds.AABBTree"] = ds_AABBTree; +ds_AABBTree.__name__ = ["ds","AABBTree"]; +ds_AABBTree.assert = function(cond) { + return; +}; +ds_AABBTree.prototype = { + fattenDelta: null + ,insertStrategy: null + ,numLeaves: null + ,pool: null + ,maxId: null + ,unusedIds: null + ,root: null + ,nodes: null + ,leaves: null + ,insertLeaf: function(data,x,y,width,height) { + if(height == null) { + height = 0; + } + if(width == null) { + width = 0; + } + var leafNode = this.pool.get(x,y,width,height,data,null,this.getNextId()); + leafNode.aabb.inflate(this.fattenDelta,this.fattenDelta); + leafNode.invHeight = 0; + this.nodes[leafNode.id] = leafNode; + var v = leafNode.id; + this.leaves.set(leafNode.id,v); + this.numLeaves++; + if(this.root == null) { + this.root = leafNode; + return leafNode.id; + } + var leafAABB = leafNode.aabb; + var combinedAABB = new ds_AABB(); + var left; + var right; + var node = this.root; + try { + while(!node.isLeaf()) { + var _g = this.insertStrategy.choose(leafAABB,node); + switch(Type.enumIndex(_g)) { + case 0: + throw "__break__"; + break; + case 1: + node = node.left; + break; + case 2: + node = node.right; + break; + } + } + } catch( e ) { if( e != "__break__" ) throw e; } + var sibling = node; + var oldParent = sibling.parent; + combinedAABB.asUnionOf(leafAABB,sibling.aabb); + var newParent = this.pool.get(combinedAABB.get_x(),combinedAABB.get_y(),combinedAABB.get_width(),combinedAABB.get_height(),null,oldParent,this.getNextId()); + newParent.invHeight = sibling.invHeight + 1; + this.nodes[newParent.id] = newParent; + if(oldParent != null) { + if(oldParent.left == sibling) { + oldParent.left = newParent; + } else { + oldParent.right = newParent; + } + } else { + this.root = newParent; + } + newParent.left = sibling; + newParent.right = leafNode; + sibling.parent = newParent; + leafNode.parent = newParent; + node = leafNode.parent; + while(node != null) { + node = this.nodes[this.balance(node.id)]; + left = node.left; + right = node.right; + ds_AABBTree.assert(left != null); + ds_AABBTree.assert(right != null); + node.invHeight = 1 + Std["int"](Math.max(left.invHeight,right.invHeight)); + node.aabb.asUnionOf(left.aabb,right.aabb); + node = node.parent; + } + this.validate(); + return leafNode.id; + } + ,updateLeaf: function(leafId,x,y,width,height,dx,dy) { + if(dy == null) { + dy = 0; + } + if(dx == null) { + dx = 0; + } + if(height == null) { + height = 0; + } + if(width == null) { + width = 0; + } + var leafNode = this.nodes[leafId]; + ds_AABBTree.assert(leafNode.isLeaf()); + var newAABB = new ds_AABB(x,y,width,height); + if(leafNode.aabb.contains(newAABB)) { + return false; + } + var data = leafNode.data; + this.removeLeaf(leafId); + dx *= 2; + dy *= 2; + if(dx < 0) { + x += dx; + width -= dx; + } else { + width += dx; + } + if(dy < 0) { + y += dy; + height -= dy; + } else { + height += dy; + } + var newId = this.insertLeaf(data,x,y,width,height); + ds_AABBTree.assert(newId == leafId); + return true; + } + ,removeLeaf: function(leafId) { + var leafNode = this.nodes[leafId]; + ds_AABBTree.assert(leafNode.isLeaf()); + this.leaves.remove(leafId); + if(leafNode == this.root) { + this.disposeNode(leafId); + this.root = null; + return; + } + var parent = leafNode.parent; + var grandParent = parent.parent; + var sibling = parent.left == leafNode ? parent.right : parent.left; + if(grandParent != null) { + if(grandParent.left == parent) { + grandParent.left = sibling; + } else { + grandParent.right = sibling; + } + sibling.parent = grandParent; + var node = grandParent; + while(node != null) { + node = this.nodes[this.balance(node.id)]; + var left = node.left; + var right = node.right; + node.aabb.asUnionOf(left.aabb,right.aabb); + node.invHeight = 1 + Std["int"](Math.max(left.invHeight,right.invHeight)); + node = node.parent; + } + } else { + this.root = sibling; + this.root.parent = null; + } + ds_AABBTree.assert(parent.id != -1); + this.disposeNode(parent.id); + this.disposeNode(leafId); + var tmp = this.numLeaves; + var _g = []; + var k = this.leaves.keys(); + while(k.hasNext()) { + var k1 = k.next(); + _g.push(k1); + } + ds_AABBTree.assert(tmp == _g.length); + this.validate(); + } + ,query: function(x,y,width,height,strictMode,into,callback) { + if(strictMode == null) { + strictMode = false; + } + if(height == null) { + height = 0; + } + if(width == null) { + width = 0; + } + var res = into != null ? into : []; + if(this.root == null) { + return res; + } + var stack = [this.root]; + var queryAABB = new ds_AABB(x,y,width,height); + var cnt = 0; + while(stack.length > 0) { + var node = stack.pop(); + ++cnt; + if(queryAABB.overlaps(node.aabb)) { + if(node.isLeaf() && (!strictMode || strictMode && queryAABB.contains(node.aabb))) { + if(callback != null) { + var hitBehaviour = callback(node.data,node.id); + if(hitBehaviour == ds_HitBehaviour.INCLUDE || hitBehaviour == ds_HitBehaviour.INCLUDE_AND_STOP) { + res.push(node.data); + } + if(hitBehaviour == ds_HitBehaviour.STOP || hitBehaviour == ds_HitBehaviour.INCLUDE_AND_STOP) { + break; + } + } else { + res.push(node.data); + } + } else { + if(node.left != null) { + stack.push(node.left); + } + if(node.right != null) { + stack.push(node.right); + } + } + } + } + return res; + } + ,getNextId: function() { + var newId = this.unusedIds.length > 0 && this.unusedIds[this.unusedIds.length - 1] < this.maxId ? this.unusedIds.pop() : this.maxId++; + return newId; + } + ,disposeNode: function(id) { + ds_AABBTree.assert(this.nodes[id] != null); + var node = this.nodes[id]; + if(node.isLeaf()) { + this.numLeaves--; + } + this.nodes[node.id] = null; + this.unusedIds.push(node.id); + this.pool.put(node); + } + ,balance: function(nodeId) { + var A = this.nodes[nodeId]; + ds_AABBTree.assert(A != null); + if(A.isLeaf() || A.invHeight < 2) { + return A.id; + } + var B = A.left; + var C = A.right; + var balanceValue = C.invHeight - B.invHeight; + if(balanceValue > 1) { + return this.rotateLeft(A,B,C); + } + if(balanceValue < -1) { + return this.rotateRight(A,B,C); + } + return A.id; + } + ,rotateLeft: function(parentNode,leftNode,rightNode) { + var F = rightNode.left; + var G = rightNode.right; + rightNode.left = parentNode; + rightNode.parent = parentNode.parent; + parentNode.parent = rightNode; + if(rightNode.parent != null) { + if(rightNode.parent.left == parentNode) { + rightNode.parent.left = rightNode; + } else { + ds_AABBTree.assert(rightNode.parent.right == parentNode); + rightNode.parent.right = rightNode; + } + } else { + this.root = rightNode; + } + if(F.invHeight > G.invHeight) { + rightNode.right = F; + parentNode.right = G; + G.parent = parentNode; + parentNode.aabb.asUnionOf(leftNode.aabb,G.aabb); + rightNode.aabb.asUnionOf(parentNode.aabb,F.aabb); + parentNode.invHeight = 1 + Std["int"](Math.max(leftNode.invHeight,G.invHeight)); + rightNode.invHeight = 1 + Std["int"](Math.max(parentNode.invHeight,F.invHeight)); + } else { + rightNode.right = G; + parentNode.right = F; + F.parent = parentNode; + parentNode.aabb.asUnionOf(leftNode.aabb,F.aabb); + rightNode.aabb.asUnionOf(parentNode.aabb,G.aabb); + parentNode.invHeight = 1 + Std["int"](Math.max(leftNode.invHeight,F.invHeight)); + rightNode.invHeight = 1 + Std["int"](Math.max(parentNode.invHeight,G.invHeight)); + } + return rightNode.id; + } + ,rotateRight: function(parentNode,leftNode,rightNode) { + var D = leftNode.left; + var E = leftNode.right; + leftNode.left = parentNode; + leftNode.parent = parentNode.parent; + parentNode.parent = leftNode; + if(leftNode.parent != null) { + if(leftNode.parent.left == parentNode) { + leftNode.parent.left = leftNode; + } else { + ds_AABBTree.assert(leftNode.parent.right == parentNode); + leftNode.parent.right = leftNode; + } + } else { + this.root = leftNode; + } + if(D.invHeight > E.invHeight) { + leftNode.right = D; + parentNode.left = E; + E.parent = parentNode; + parentNode.aabb.asUnionOf(rightNode.aabb,E.aabb); + leftNode.aabb.asUnionOf(parentNode.aabb,D.aabb); + parentNode.invHeight = 1 + Std["int"](Math.max(rightNode.invHeight,E.invHeight)); + leftNode.invHeight = 1 + Std["int"](Math.max(parentNode.invHeight,D.invHeight)); + } else { + leftNode.right = E; + parentNode.left = D; + D.parent = parentNode; + parentNode.aabb.asUnionOf(rightNode.aabb,D.aabb); + leftNode.aabb.asUnionOf(parentNode.aabb,E.aabb); + parentNode.invHeight = 1 + Std["int"](Math.max(rightNode.invHeight,D.invHeight)); + leftNode.invHeight = 1 + Std["int"](Math.max(parentNode.invHeight,E.invHeight)); + } + return leftNode.id; + } + ,validate: function() { + return; + } + ,__class__: ds_AABBTree +}; +var ds_aabbtree_InsertChoice = $hxClasses["ds.aabbtree.InsertChoice"] = { __ename__ : ["ds","aabbtree","InsertChoice"], __constructs__ : ["PARENT","DESCEND_LEFT","DESCEND_RIGHT"] }; +ds_aabbtree_InsertChoice.PARENT = ["PARENT",0]; +ds_aabbtree_InsertChoice.PARENT.toString = $estr; +ds_aabbtree_InsertChoice.PARENT.__enum__ = ds_aabbtree_InsertChoice; +ds_aabbtree_InsertChoice.DESCEND_LEFT = ["DESCEND_LEFT",1]; +ds_aabbtree_InsertChoice.DESCEND_LEFT.toString = $estr; +ds_aabbtree_InsertChoice.DESCEND_LEFT.__enum__ = ds_aabbtree_InsertChoice; +ds_aabbtree_InsertChoice.DESCEND_RIGHT = ["DESCEND_RIGHT",2]; +ds_aabbtree_InsertChoice.DESCEND_RIGHT.toString = $estr; +ds_aabbtree_InsertChoice.DESCEND_RIGHT.__enum__ = ds_aabbtree_InsertChoice; +var ds_aabbtree_IInsertStrategy = function() { }; +$hxClasses["ds.aabbtree.IInsertStrategy"] = ds_aabbtree_IInsertStrategy; +ds_aabbtree_IInsertStrategy.__name__ = ["ds","aabbtree","IInsertStrategy"]; +ds_aabbtree_IInsertStrategy.prototype = { + choose: null + ,__class__: ds_aabbtree_IInsertStrategy +}; +var ds_aabbtree_InsertStrategyPerimeter = function() { + this.combinedAABB = new ds_AABB(); +}; +$hxClasses["ds.aabbtree.InsertStrategyPerimeter"] = ds_aabbtree_InsertStrategyPerimeter; +ds_aabbtree_InsertStrategyPerimeter.__name__ = ["ds","aabbtree","InsertStrategyPerimeter"]; +ds_aabbtree_InsertStrategyPerimeter.__interfaces__ = [ds_aabbtree_IInsertStrategy]; +ds_aabbtree_InsertStrategyPerimeter.prototype = { + combinedAABB: null + ,choose: function(leafAABB,parent,extraData) { + var left = parent.left; + var right = parent.right; + var perimeter = parent.aabb.getPerimeter(); + this.combinedAABB.asUnionOf(parent.aabb,leafAABB); + var combinedPerimeter = this.combinedAABB.getPerimeter(); + var costParent = 2 * combinedPerimeter; + var costDescend = 2 * (combinedPerimeter - perimeter); + this.combinedAABB.asUnionOf(leafAABB,left.aabb); + var costLeft = this.combinedAABB.getPerimeter() + costDescend; + if(!left.isLeaf()) { + costLeft -= left.aabb.getPerimeter(); + } + this.combinedAABB.asUnionOf(leafAABB,right.aabb); + var costRight = this.combinedAABB.getPerimeter() + costDescend; + if(!right.isLeaf()) { + costRight -= right.aabb.getPerimeter(); + } + if(costParent < costLeft && costParent < costRight) { + return ds_aabbtree_InsertChoice.PARENT; + } + if(costLeft < costRight) { + return ds_aabbtree_InsertChoice.DESCEND_LEFT; + } else { + return ds_aabbtree_InsertChoice.DESCEND_RIGHT; + } + } + ,__class__: ds_aabbtree_InsertStrategyPerimeter +}; +var ds_aabbtree_Node = function(aabb,data,parent,id) { + if(id == null) { + id = -1; + } + this.id = -1; + this.invHeight = -1; + this.parent = null; + this.right = null; + this.left = null; + this.aabb = aabb; + this.data = data; + this.parent = parent; + this.id = id; +}; +$hxClasses["ds.aabbtree.Node"] = ds_aabbtree_Node; +ds_aabbtree_Node.__name__ = ["ds","aabbtree","Node"]; +ds_aabbtree_Node.prototype = { + left: null + ,right: null + ,parent: null + ,aabb: null + ,invHeight: null + ,data: null + ,id: null + ,isLeaf: function() { + return this.left == null; + } + ,__class__: ds_aabbtree_Node +}; +var ds_aabbtree_NodePool = function(capacity,growthFactor) { + if(growthFactor == null) { + growthFactor = 2; + } + this.capacity = capacity; + this.growthFactor = growthFactor; + this.freeNodes = []; + var _g1 = 0; + var _g = capacity; + while(_g1 < _g) { + var i = _g1++; + this.freeNodes.push(new ds_aabbtree_Node(new ds_AABB(),null)); + } +}; +$hxClasses["ds.aabbtree.NodePool"] = ds_aabbtree_NodePool; +ds_aabbtree_NodePool.__name__ = ["ds","aabbtree","NodePool"]; +ds_aabbtree_NodePool.prototype = { + growthFactor: null + ,capacity: null + ,freeNodes: null + ,get: function(x,y,width,height,data,parent,id) { + if(id == null) { + id = -1; + } + if(height == null) { + height = 0; + } + if(width == null) { + width = 0; + } + var newNode; + if(this.freeNodes.length > 0) { + newNode = this.freeNodes.pop(); + newNode.aabb.setTo(x,y,width,height); + newNode.data = data; + newNode.parent = parent; + newNode.id = id; + } else { + newNode = new ds_aabbtree_Node(new ds_AABB(x,y,width,height),data,parent,id); + this.capacity = Std["int"](this.capacity * this.growthFactor); + this.grow(this.capacity); + } + return newNode; + } + ,put: function(node) { + this.freeNodes.push(node); + node.parent = node.left = node.right = null; + node.id = -1; + node.invHeight = -1; + node.data = null; + } + ,grow: function(n) { + var len = this.freeNodes.length; + if(n <= len) { + return; + } + var _g1 = len; + var _g = n; + while(_g1 < _g) { + var i = _g1++; + this.freeNodes.push(new ds_aabbtree_Node(new ds_AABB(),null)); + } + } + ,__class__: ds_aabbtree_NodePool +}; +var format_gz_Reader = function(i) { + this.i = i; +}; +$hxClasses["format.gz.Reader"] = format_gz_Reader; +format_gz_Reader.__name__ = ["format","gz","Reader"]; +format_gz_Reader.prototype = { + i: null + ,read: function() { + var h = this.readHeader(); + var o = new haxe_io_BytesOutput(); + this.readData(o); + return { file : h.fileName, data : o.getBytes()}; + } + ,readHeader: function() { + if(this.i.readByte() != 31 || this.i.readByte() != 139) { + throw new js__$Boot_HaxeError("Invalid GZ header"); + } + if(this.i.readByte() != 8) { + throw new js__$Boot_HaxeError("Invalid compression method"); + } + var flags = this.i.readByte(); + var mtime = this.i.read(4); + var xflags = this.i.readByte(); + var os = this.i.readByte(); + var fname = null; + var comments = null; + var xdata = null; + if((flags & 4) != 0) { + var xlen = this.i.readUInt16(); + xdata = this.i.read(xlen); + } + if((flags & 8) != 0) { + fname = this.i.readUntil(0); + } + if((flags & 16) != 0) { + comments = this.i.readUntil(0); + } + if((flags & 2) != 0) { + var hcrc = this.i.readUInt16(); + } + return { fileName : fname, comments : comments, extraData : xdata}; + } + ,readData: function(o,bufsize) { + if(bufsize == null) { + bufsize = 65536; + } + var buf = haxe_io_Bytes.alloc(bufsize); + var tsize = 0; + var inflate = new format_tools_InflateImpl(this.i,false,false); + while(true) { + var len = inflate.readBytes(buf,0,bufsize); + o.writeFullBytes(buf,0,len); + if(len < bufsize) { + break; + } + tsize += len; + } + return tsize; + } + ,__class__: format_gz_Reader +}; +var format_tools_Adler32 = function() { + this.a1 = 1; + this.a2 = 0; +}; +$hxClasses["format.tools.Adler32"] = format_tools_Adler32; +format_tools_Adler32.__name__ = ["format","tools","Adler32"]; +format_tools_Adler32.read = function(i) { + var a = new format_tools_Adler32(); + var a2a = i.readByte(); + var a2b = i.readByte(); + var a1a = i.readByte(); + var a1b = i.readByte(); + a.a1 = a1a << 8 | a1b; + a.a2 = a2a << 8 | a2b; + return a; +}; +format_tools_Adler32.prototype = { + a1: null + ,a2: null + ,update: function(b,pos,len) { + var a1 = this.a1; + var a2 = this.a2; + var _g1 = pos; + var _g = pos + len; + while(_g1 < _g) { + var p = _g1++; + var c = b.get(p); + a1 = (a1 + c) % 65521; + a2 = (a2 + a1) % 65521; + } + this.a1 = a1; + this.a2 = a2; + } + ,equals: function(a) { + if(a.a1 == this.a1) { + return a.a2 == this.a2; + } else { + return false; + } + } + ,__class__: format_tools_Adler32 +}; +var format_tools_Huffman = $hxClasses["format.tools.Huffman"] = { __ename__ : ["format","tools","Huffman"], __constructs__ : ["Found","NeedBit","NeedBits"] }; +format_tools_Huffman.Found = function(i) { var $x = ["Found",0,i]; $x.__enum__ = format_tools_Huffman; $x.toString = $estr; return $x; }; +format_tools_Huffman.NeedBit = function(left,right) { var $x = ["NeedBit",1,left,right]; $x.__enum__ = format_tools_Huffman; $x.toString = $estr; return $x; }; +format_tools_Huffman.NeedBits = function(n,table) { var $x = ["NeedBits",2,n,table]; $x.__enum__ = format_tools_Huffman; $x.toString = $estr; return $x; }; +var format_tools_HuffTools = function() { +}; +$hxClasses["format.tools.HuffTools"] = format_tools_HuffTools; +format_tools_HuffTools.__name__ = ["format","tools","HuffTools"]; +format_tools_HuffTools.prototype = { + treeDepth: function(t) { + switch(Type.enumIndex(t)) { + case 0: + return 0; + case 1: + var b = t[3]; + var a = t[2]; + var da = this.treeDepth(a); + var db = this.treeDepth(b); + return 1 + (da < db ? da : db); + case 2: + throw new js__$Boot_HaxeError("assert"); + break; + } + } + ,treeCompress: function(t) { + var d = this.treeDepth(t); + if(d == 0) { + return t; + } + if(d == 1) { + if(Type.enumIndex(t) == 1) { + var b = t[3]; + var a = t[2]; + return format_tools_Huffman.NeedBit(this.treeCompress(a),this.treeCompress(b)); + } else { + throw new js__$Boot_HaxeError("assert"); + } + } + var size = 1 << d; + var table = []; + var _g1 = 0; + var _g = size; + while(_g1 < _g) { + var i = _g1++; + table.push(format_tools_Huffman.Found(-1)); + } + this.treeWalk(table,0,0,d,t); + return format_tools_Huffman.NeedBits(d,table); + } + ,treeWalk: function(table,p,cd,d,t) { + if(Type.enumIndex(t) == 1) { + var b = t[3]; + var a = t[2]; + if(d > 0) { + this.treeWalk(table,p,cd + 1,d - 1,a); + this.treeWalk(table,p | 1 << cd,cd + 1,d - 1,b); + } else { + table[p] = this.treeCompress(t); + } + } else { + table[p] = this.treeCompress(t); + } + } + ,treeMake: function(bits,maxbits,v,len) { + if(len > maxbits) { + throw new js__$Boot_HaxeError("Invalid huffman"); + } + var idx = v << 5 | len; + if(bits.exists(idx)) { + return format_tools_Huffman.Found(bits.get(idx)); + } + v <<= 1; + ++len; + return format_tools_Huffman.NeedBit(this.treeMake(bits,maxbits,v,len),this.treeMake(bits,maxbits,v | 1,len)); + } + ,make: function(lengths,pos,nlengths,maxbits) { + var counts = []; + var tmp = []; + if(maxbits > 32) { + throw new js__$Boot_HaxeError("Invalid huffman"); + } + var _g1 = 0; + var _g = maxbits; + while(_g1 < _g) { + var i = _g1++; + counts.push(0); + tmp.push(0); + } + var _g11 = 0; + var _g2 = nlengths; + while(_g11 < _g2) { + var i1 = _g11++; + var p = lengths[i1 + pos]; + if(p >= maxbits) { + throw new js__$Boot_HaxeError("Invalid huffman"); + } + counts[p]++; + } + var code = 0; + var _g12 = 1; + var _g3 = maxbits - 1; + while(_g12 < _g3) { + var i2 = _g12++; + code = code + counts[i2] << 1; + tmp[i2] = code; + } + var bits = new haxe_ds_IntMap(); + var _g13 = 0; + var _g4 = nlengths; + while(_g13 < _g4) { + var i3 = _g13++; + var l = lengths[i3 + pos]; + if(l != 0) { + var n = tmp[l - 1]; + tmp[l - 1] = n + 1; + bits.set(n << 5 | l,i3); + } + } + return this.treeCompress(format_tools_Huffman.NeedBit(this.treeMake(bits,maxbits,0,1),this.treeMake(bits,maxbits,1,1))); + } + ,__class__: format_tools_HuffTools +}; +var format_tools__$InflateImpl_Window = function(hasCrc) { + this.buffer = haxe_io_Bytes.alloc(65536); + this.pos = 0; + if(hasCrc) { + this.crc = new format_tools_Adler32(); + } +}; +$hxClasses["format.tools._InflateImpl.Window"] = format_tools__$InflateImpl_Window; +format_tools__$InflateImpl_Window.__name__ = ["format","tools","_InflateImpl","Window"]; +format_tools__$InflateImpl_Window.prototype = { + buffer: null + ,pos: null + ,crc: null + ,slide: function() { + if(this.crc != null) { + this.crc.update(this.buffer,0,32768); + } + var b = haxe_io_Bytes.alloc(65536); + this.pos -= 32768; + b.blit(0,this.buffer,32768,this.pos); + this.buffer = b; + } + ,addBytes: function(b,p,len) { + if(this.pos + len > 65536) { + this.slide(); + } + this.buffer.blit(this.pos,b,p,len); + this.pos += len; + } + ,addByte: function(c) { + if(this.pos == 65536) { + this.slide(); + } + this.buffer.set(this.pos,c); + this.pos++; + } + ,getLastChar: function() { + return this.buffer.get(this.pos - 1); + } + ,available: function() { + return this.pos; + } + ,checksum: function() { + if(this.crc != null) { + this.crc.update(this.buffer,0,this.pos); + } + return this.crc; + } + ,__class__: format_tools__$InflateImpl_Window +}; +var format_tools__$InflateImpl_State = $hxClasses["format.tools._InflateImpl.State"] = { __ename__ : ["format","tools","_InflateImpl","State"], __constructs__ : ["Head","Block","CData","Flat","Crc","Dist","DistOne","Done"] }; +format_tools__$InflateImpl_State.Head = ["Head",0]; +format_tools__$InflateImpl_State.Head.toString = $estr; +format_tools__$InflateImpl_State.Head.__enum__ = format_tools__$InflateImpl_State; +format_tools__$InflateImpl_State.Block = ["Block",1]; +format_tools__$InflateImpl_State.Block.toString = $estr; +format_tools__$InflateImpl_State.Block.__enum__ = format_tools__$InflateImpl_State; +format_tools__$InflateImpl_State.CData = ["CData",2]; +format_tools__$InflateImpl_State.CData.toString = $estr; +format_tools__$InflateImpl_State.CData.__enum__ = format_tools__$InflateImpl_State; +format_tools__$InflateImpl_State.Flat = ["Flat",3]; +format_tools__$InflateImpl_State.Flat.toString = $estr; +format_tools__$InflateImpl_State.Flat.__enum__ = format_tools__$InflateImpl_State; +format_tools__$InflateImpl_State.Crc = ["Crc",4]; +format_tools__$InflateImpl_State.Crc.toString = $estr; +format_tools__$InflateImpl_State.Crc.__enum__ = format_tools__$InflateImpl_State; +format_tools__$InflateImpl_State.Dist = ["Dist",5]; +format_tools__$InflateImpl_State.Dist.toString = $estr; +format_tools__$InflateImpl_State.Dist.__enum__ = format_tools__$InflateImpl_State; +format_tools__$InflateImpl_State.DistOne = ["DistOne",6]; +format_tools__$InflateImpl_State.DistOne.toString = $estr; +format_tools__$InflateImpl_State.DistOne.__enum__ = format_tools__$InflateImpl_State; +format_tools__$InflateImpl_State.Done = ["Done",7]; +format_tools__$InflateImpl_State.Done.toString = $estr; +format_tools__$InflateImpl_State.Done.__enum__ = format_tools__$InflateImpl_State; +var format_tools_InflateImpl = function(i,header,crc) { + if(crc == null) { + crc = true; + } + if(header == null) { + header = true; + } + this["final"] = false; + this.htools = new format_tools_HuffTools(); + this.huffman = this.buildFixedHuffman(); + this.huffdist = null; + this.len = 0; + this.dist = 0; + this.state = header ? format_tools__$InflateImpl_State.Head : format_tools__$InflateImpl_State.Block; + this.input = i; + this.bits = 0; + this.nbits = 0; + this.needed = 0; + this.output = null; + this.outpos = 0; + this.lengths = []; + var _g = 0; + while(_g < 19) { + var i1 = _g++; + this.lengths.push(-1); + } + this.window = new format_tools__$InflateImpl_Window(crc); +}; +$hxClasses["format.tools.InflateImpl"] = format_tools_InflateImpl; +format_tools_InflateImpl.__name__ = ["format","tools","InflateImpl"]; +format_tools_InflateImpl.prototype = { + nbits: null + ,bits: null + ,state: null + ,'final': null + ,huffman: null + ,huffdist: null + ,htools: null + ,len: null + ,dist: null + ,needed: null + ,output: null + ,outpos: null + ,input: null + ,lengths: null + ,window: null + ,buildFixedHuffman: function() { + if(format_tools_InflateImpl.FIXED_HUFFMAN != null) { + return format_tools_InflateImpl.FIXED_HUFFMAN; + } + var a = []; + var _g = 0; + while(_g < 288) { + var n = _g++; + a.push(n <= 143 ? 8 : n <= 255 ? 9 : n <= 279 ? 7 : 8); + } + format_tools_InflateImpl.FIXED_HUFFMAN = this.htools.make(a,0,288,10); + return format_tools_InflateImpl.FIXED_HUFFMAN; + } + ,readBytes: function(b,pos,len) { + this.needed = len; + this.outpos = pos; + this.output = b; + if(len > 0) { + while(this.inflateLoop()) { + } + } + return len - this.needed; + } + ,getBits: function(n) { + while(this.nbits < n) { + this.bits |= this.input.readByte() << this.nbits; + this.nbits += 8; + } + var b = this.bits & (1 << n) - 1; + this.nbits -= n; + this.bits >>= n; + return b; + } + ,getBit: function() { + if(this.nbits == 0) { + this.nbits = 8; + this.bits = this.input.readByte(); + } + var b = (this.bits & 1) == 1; + this.nbits--; + this.bits >>= 1; + return b; + } + ,getRevBits: function(n) { + if(n == 0) { + return 0; + } else if(this.getBit()) { + return 1 << n - 1 | this.getRevBits(n - 1); + } else { + return this.getRevBits(n - 1); + } + } + ,resetBits: function() { + this.bits = 0; + this.nbits = 0; + } + ,addBytes: function(b,p,len) { + this.window.addBytes(b,p,len); + this.output.blit(this.outpos,b,p,len); + this.needed -= len; + this.outpos += len; + } + ,addByte: function(b) { + this.window.addByte(b); + this.output.set(this.outpos,b); + this.needed--; + this.outpos++; + } + ,addDistOne: function(n) { + var c = this.window.getLastChar(); + var _g1 = 0; + var _g = n; + while(_g1 < _g) { + var i = _g1++; + this.addByte(c); + } + } + ,addDist: function(d,len) { + this.addBytes(this.window.buffer,this.window.pos - d,len); + } + ,applyHuffman: function(h) { + switch(Type.enumIndex(h)) { + case 0: + var n = h[2]; + return n; + case 1: + var b = h[3]; + var a = h[2]; + return this.applyHuffman(this.getBit() ? b : a); + case 2: + var tbl = h[3]; + var n1 = h[2]; + return this.applyHuffman(tbl[this.getBits(n1)]); + } + } + ,inflateLengths: function(a,max) { + var i = 0; + var prev = 0; + while(i < max) { + var n = this.applyHuffman(this.huffman); + switch(n) { + case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15: + prev = n; + a[i] = n; + ++i; + break; + case 16: + var end = i + 3 + this.getBits(2); + if(end > max) { + throw new js__$Boot_HaxeError("Invalid data"); + } + while(i < end) { + a[i] = prev; + ++i; + } + break; + case 17: + i += 3 + this.getBits(3); + if(i > max) { + throw new js__$Boot_HaxeError("Invalid data"); + } + break; + case 18: + i += 11 + this.getBits(7); + if(i > max) { + throw new js__$Boot_HaxeError("Invalid data"); + } + break; + default: + throw new js__$Boot_HaxeError("Invalid data"); + } + } + } + ,inflateLoop: function() { + var _g = this.state; + switch(Type.enumIndex(_g)) { + case 0: + var cmf = this.input.readByte(); + var cm = cmf & 15; + var cinfo = cmf >> 4; + if(cm != 8) { + throw new js__$Boot_HaxeError("Invalid data"); + } + var flg = this.input.readByte(); + var fdict = (flg & 32) != 0; + if(((cmf << 8) + flg) % 31 != 0) { + throw new js__$Boot_HaxeError("Invalid data"); + } + if(fdict) { + throw new js__$Boot_HaxeError("Unsupported dictionary"); + } + this.state = format_tools__$InflateImpl_State.Block; + return true; + case 1: + this["final"] = this.getBit(); + var _g1 = this.getBits(2); + switch(_g1) { + case 0: + this.len = this.input.readUInt16(); + var nlen = this.input.readUInt16(); + if(nlen != 65535 - this.len) { + throw new js__$Boot_HaxeError("Invalid data"); + } + this.state = format_tools__$InflateImpl_State.Flat; + var r = this.inflateLoop(); + this.resetBits(); + return r; + case 1: + this.huffman = this.buildFixedHuffman(); + this.huffdist = null; + this.state = format_tools__$InflateImpl_State.CData; + return true; + case 2: + var hlit = this.getBits(5) + 257; + var hdist = this.getBits(5) + 1; + var hclen = this.getBits(4) + 4; + var _g11 = 0; + var _g2 = hclen; + while(_g11 < _g2) { + var i = _g11++; + this.lengths[format_tools_InflateImpl.CODE_LENGTHS_POS[i]] = this.getBits(3); + } + var _g3 = hclen; + while(_g3 < 19) { + var i1 = _g3++; + this.lengths[format_tools_InflateImpl.CODE_LENGTHS_POS[i1]] = 0; + } + this.huffman = this.htools.make(this.lengths,0,19,8); + var lengths = []; + var _g12 = 0; + var _g4 = hlit + hdist; + while(_g12 < _g4) { + var i2 = _g12++; + lengths.push(0); + } + this.inflateLengths(lengths,hlit + hdist); + this.huffdist = this.htools.make(lengths,hlit,hdist,16); + this.huffman = this.htools.make(lengths,0,hlit,16); + this.state = format_tools__$InflateImpl_State.CData; + return true; + default: + throw new js__$Boot_HaxeError("Invalid data"); + } + break; + case 2: + var n = this.applyHuffman(this.huffman); + if(n < 256) { + this.addByte(n); + return this.needed > 0; + } else if(n == 256) { + this.state = this["final"] ? format_tools__$InflateImpl_State.Crc : format_tools__$InflateImpl_State.Block; + return true; + } else { + n -= 257; + var extra_bits = format_tools_InflateImpl.LEN_EXTRA_BITS_TBL[n]; + if(extra_bits == -1) { + throw new js__$Boot_HaxeError("Invalid data"); + } + this.len = format_tools_InflateImpl.LEN_BASE_VAL_TBL[n] + this.getBits(extra_bits); + var dist_code = this.huffdist == null ? this.getRevBits(5) : this.applyHuffman(this.huffdist); + extra_bits = format_tools_InflateImpl.DIST_EXTRA_BITS_TBL[dist_code]; + if(extra_bits == -1) { + throw new js__$Boot_HaxeError("Invalid data"); + } + this.dist = format_tools_InflateImpl.DIST_BASE_VAL_TBL[dist_code] + this.getBits(extra_bits); + if(this.dist > this.window.available()) { + throw new js__$Boot_HaxeError("Invalid data"); + } + this.state = this.dist == 1 ? format_tools__$InflateImpl_State.DistOne : format_tools__$InflateImpl_State.Dist; + return true; + } + break; + case 3: + var rlen = this.len < this.needed ? this.len : this.needed; + var bytes = this.input.read(rlen); + this.len -= rlen; + this.addBytes(bytes,0,rlen); + if(this.len == 0) { + this.state = this["final"] ? format_tools__$InflateImpl_State.Crc : format_tools__$InflateImpl_State.Block; + } + return this.needed > 0; + case 4: + var calc = this.window.checksum(); + if(calc == null) { + this.state = format_tools__$InflateImpl_State.Done; + return true; + } + var crc = format_tools_Adler32.read(this.input); + if(!calc.equals(crc)) { + throw new js__$Boot_HaxeError("Invalid CRC"); + } + this.state = format_tools__$InflateImpl_State.Done; + return true; + case 5: + while(this.len > 0 && this.needed > 0) { + var rdist = this.len < this.dist ? this.len : this.dist; + var rlen1 = this.needed < rdist ? this.needed : rdist; + this.addDist(this.dist,rlen1); + this.len -= rlen1; + } + if(this.len == 0) { + this.state = format_tools__$InflateImpl_State.CData; + } + return this.needed > 0; + case 6: + var rlen2 = this.len < this.needed ? this.len : this.needed; + this.addDistOne(rlen2); + this.len -= rlen2; + if(this.len == 0) { + this.state = format_tools__$InflateImpl_State.CData; + } + return this.needed > 0; + case 7: + return false; + } + } + ,__class__: format_tools_InflateImpl +}; +var haxe_StackItem = $hxClasses["haxe.StackItem"] = { __ename__ : ["haxe","StackItem"], __constructs__ : ["CFunction","Module","FilePos","Method","LocalFunction"] }; +haxe_StackItem.CFunction = ["CFunction",0]; +haxe_StackItem.CFunction.toString = $estr; +haxe_StackItem.CFunction.__enum__ = haxe_StackItem; +haxe_StackItem.Module = function(m) { var $x = ["Module",1,m]; $x.__enum__ = haxe_StackItem; $x.toString = $estr; return $x; }; +haxe_StackItem.FilePos = function(s,file,line) { var $x = ["FilePos",2,s,file,line]; $x.__enum__ = haxe_StackItem; $x.toString = $estr; return $x; }; +haxe_StackItem.Method = function(classname,method) { var $x = ["Method",3,classname,method]; $x.__enum__ = haxe_StackItem; $x.toString = $estr; return $x; }; +haxe_StackItem.LocalFunction = function(v) { var $x = ["LocalFunction",4,v]; $x.__enum__ = haxe_StackItem; $x.toString = $estr; return $x; }; +var haxe_CallStack = function() { }; +$hxClasses["haxe.CallStack"] = haxe_CallStack; +haxe_CallStack.__name__ = ["haxe","CallStack"]; +haxe_CallStack.lastException = null; +haxe_CallStack.getStack = function(e) { + if(e == null) { + return []; + } + var oldValue = Error.prepareStackTrace; + Error.prepareStackTrace = function(error,callsites) { + var stack = []; + var _g = 0; + while(_g < callsites.length) { + var site = callsites[_g]; + ++_g; + if(haxe_CallStack.wrapCallSite != null) { + site = haxe_CallStack.wrapCallSite(site); + } + var method = null; + var fullName = site.getFunctionName(); + if(fullName != null) { + var idx = fullName.lastIndexOf("."); + if(idx >= 0) { + var className = HxOverrides.substr(fullName,0,idx); + var methodName = HxOverrides.substr(fullName,idx + 1,null); + method = haxe_StackItem.Method(className,methodName); + } + } + stack.push(haxe_StackItem.FilePos(method,site.getFileName(),site.getLineNumber())); + } + return stack; + }; + var a = haxe_CallStack.makeStack(e.stack); + Error.prepareStackTrace = oldValue; + return a; +}; +haxe_CallStack.wrapCallSite = null; +haxe_CallStack.callStack = function() { + try { + throw new Error(); + } catch( e ) { + haxe_CallStack.lastException = e; + if (e instanceof js__$Boot_HaxeError) e = e.val; + var a = haxe_CallStack.getStack(e); + a.shift(); + return a; + } +}; +haxe_CallStack.exceptionStack = function() { + return haxe_CallStack.getStack(haxe_CallStack.lastException); +}; +haxe_CallStack.toString = function(stack) { + var b = new StringBuf(); + var _g = 0; + while(_g < stack.length) { + var s = stack[_g]; + ++_g; + b.add("\nCalled from "); + haxe_CallStack.itemToString(b,s); + } + return b.toString(); +}; +haxe_CallStack.itemToString = function(b,s) { + switch(Type.enumIndex(s)) { + case 0: + b.add("a C function"); + break; + case 1: + var m = s[2]; + b.add("module "); + b.add(m); + break; + case 2: + var line = s[4]; + var file = s[3]; + var s1 = s[2]; + if(s1 != null) { + haxe_CallStack.itemToString(b,s1); + b.add(" ("); + } + b.add(file); + b.add(" line "); + b.add(line); + if(s1 != null) { + b.add(")"); + } + break; + case 3: + var meth = s[3]; + var cname = s[2]; + b.add(cname); + b.add("."); + b.add(meth); + break; + case 4: + var n = s[2]; + b.add("local function #"); + b.add(n); + break; + } +}; +haxe_CallStack.makeStack = function(s) { + if(s == null) { + return []; + } else if(typeof(s) == "string") { + var stack = s.split("\n"); + if(stack[0] == "Error") { + stack.shift(); + } + var m = []; + var rie10 = new EReg("^ at ([A-Za-z0-9_. ]+) \\(([^)]+):([0-9]+):([0-9]+)\\)$",""); + var _g = 0; + while(_g < stack.length) { + var line = stack[_g]; + ++_g; + if(rie10.match(line)) { + var path = rie10.matched(1).split("."); + var meth = path.pop(); + var file = rie10.matched(2); + var line1 = Std.parseInt(rie10.matched(3)); + m.push(haxe_StackItem.FilePos(meth == "Anonymous function" ? haxe_StackItem.LocalFunction() : meth == "Global code" ? null : haxe_StackItem.Method(path.join("."),meth),file,line1)); + } else { + m.push(haxe_StackItem.Module(StringTools.trim(line))); + } + } + return m; + } else { + return s; + } +}; +var haxe_IMap = function() { }; +$hxClasses["haxe.IMap"] = haxe_IMap; +haxe_IMap.__name__ = ["haxe","IMap"]; +haxe_IMap.prototype = { + get: null + ,set: null + ,exists: null + ,remove: null + ,__class__: haxe_IMap +}; +var haxe_Http = function(url) { + this.url = url; + this.headers = new List(); + this.params = new List(); + this.async = true; + this.withCredentials = false; +}; +$hxClasses["haxe.Http"] = haxe_Http; +haxe_Http.__name__ = ["haxe","Http"]; +haxe_Http.prototype = { + url: null + ,responseData: null + ,async: null + ,withCredentials: null + ,postData: null + ,headers: null + ,params: null + ,setPostData: function(data) { + this.postData = data; + return this; + } + ,req: null + ,request: function(post) { + var me = this; + me.responseData = null; + var r = this.req = js_Browser.createXMLHttpRequest(); + var onreadystatechange = function(_) { + if(r.readyState != 4) { + return; + } + var s; + try { + s = r.status; + } catch( e ) { + haxe_CallStack.lastException = e; + s = null; + } + if(s != null && "undefined" !== typeof window) { + var protocol = js_Browser.get_location().protocol.toLowerCase(); + var rlocalProtocol = new EReg("^(?:about|app|app-storage|.+-extension|file|res|widget):$",""); + var isLocal = rlocalProtocol.match(protocol); + if(isLocal) { + if(r.responseText != null) { + s = 200; + } else { + s = 404; + } + } + } + if(s == undefined) { + s = null; + } + if(s != null) { + me.onStatus(s); + } + if(s != null && s >= 200 && s < 400) { + me.req = null; + me.onData(me.responseData = r.responseText); + } else if(s == null) { + me.req = null; + me.onError("Failed to connect or resolve host"); + } else { + switch(s) { + case 12007: + me.req = null; + me.onError("Unknown host"); + break; + case 12029: + me.req = null; + me.onError("Failed to connect to host"); + break; + default: + me.req = null; + me.responseData = r.responseText; + me.onError("Http Error #" + r.status); + } + } + }; + if(this.async) { + r.onreadystatechange = onreadystatechange; + } + var uri = this.postData; + if(uri != null) { + post = true; + } else { + var p = this.params.iterator(); + while(p.hasNext()) { + var p1 = p.next(); + if(uri == null) { + uri = ""; + } else { + uri += "&"; + } + uri += StringTools.urlEncode(p1.param) + "=" + StringTools.urlEncode(p1.value); + } + } + try { + if(post) { + r.open("POST",this.url,this.async); + } else if(uri != null) { + var question = this.url.split("?").length <= 1; + r.open("GET",this.url + (question ? "?" : "&") + uri,this.async); + uri = null; + } else { + r.open("GET",this.url,this.async); + } + } catch( e1 ) { + haxe_CallStack.lastException = e1; + if (e1 instanceof js__$Boot_HaxeError) e1 = e1.val; + me.req = null; + this.onError(e1.toString()); + return; + } + r.withCredentials = this.withCredentials; + if(!Lambda.exists(this.headers,function(h) { + return h.header == "Content-Type"; + }) && post && this.postData == null) { + r.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); + } + var h1 = this.headers.iterator(); + while(h1.hasNext()) { + var h2 = h1.next(); + r.setRequestHeader(h2.header,h2.value); + } + r.send(uri); + if(!this.async) { + onreadystatechange(null); + } + } + ,onData: function(data) { + } + ,onError: function(msg) { + } + ,onStatus: function(status) { + } + ,__class__: haxe_Http +}; +var haxe__$Int32_Int32_$Impl_$ = {}; +$hxClasses["haxe._Int32.Int32_Impl_"] = haxe__$Int32_Int32_$Impl_$; +haxe__$Int32_Int32_$Impl_$.__name__ = ["haxe","_Int32","Int32_Impl_"]; +haxe__$Int32_Int32_$Impl_$.ucompare = function(a,b) { + if(a < 0) { + if(b < 0) { + return ~b - ~a | 0; + } else { + return 1; + } + } + if(b < 0) { + return -1; + } else { + return a - b | 0; + } +}; +var haxe__$Int64__$_$_$Int64 = function(high,low) { + this.high = high; + this.low = low; +}; +$hxClasses["haxe._Int64.___Int64"] = haxe__$Int64__$_$_$Int64; +haxe__$Int64__$_$_$Int64.__name__ = ["haxe","_Int64","___Int64"]; +haxe__$Int64__$_$_$Int64.prototype = { + high: null + ,low: null + ,__class__: haxe__$Int64__$_$_$Int64 +}; +var haxe_Log = function() { }; +$hxClasses["haxe.Log"] = haxe_Log; +haxe_Log.__name__ = ["haxe","Log"]; +haxe_Log.trace = function(v,infos) { + js_Boot.__trace(v,infos); +}; +var haxe_Serializer = function() { + this.buf = new StringBuf(); + this.cache = []; + this.useCache = haxe_Serializer.USE_CACHE; + this.useEnumIndex = haxe_Serializer.USE_ENUM_INDEX; + this.shash = new haxe_ds_StringMap(); + this.scount = 0; +}; +$hxClasses["haxe.Serializer"] = haxe_Serializer; +haxe_Serializer.__name__ = ["haxe","Serializer"]; +haxe_Serializer.run = function(v) { + var s = new haxe_Serializer(); + s.serialize(v); + return s.toString(); +}; +haxe_Serializer.prototype = { + buf: null + ,cache: null + ,shash: null + ,scount: null + ,useCache: null + ,useEnumIndex: null + ,toString: function() { + return this.buf.toString(); + } + ,serializeString: function(s) { + var x = this.shash.get(s); + if(x != null) { + this.buf.add("R"); + this.buf.add(x); + return; + } + this.shash.set(s,this.scount++); + this.buf.add("y"); + s = StringTools.urlEncode(s); + this.buf.add(s.length); + this.buf.add(":"); + this.buf.add(s); + } + ,serializeRef: function(v) { + var vt = typeof(v); + var _g1 = 0; + var _g = this.cache.length; + while(_g1 < _g) { + var i = _g1++; + var ci = this.cache[i]; + if(typeof(ci) == vt && ci == v) { + this.buf.add("r"); + this.buf.add(i); + return true; + } + } + this.cache.push(v); + return false; + } + ,serializeFields: function(v) { + var _g = 0; + var _g1 = Reflect.fields(v); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + this.serializeString(f); + this.serialize(Reflect.field(v,f)); + } + this.buf.add("g"); + } + ,serialize: function(v) { + var _g = Type["typeof"](v); + switch(Type.enumIndex(_g)) { + case 0: + this.buf.add("n"); + break; + case 1: + var v1 = v; + if(v1 == 0) { + this.buf.add("z"); + return; + } + this.buf.add("i"); + this.buf.add(v1); + break; + case 2: + var v2 = v; + if(isNaN(v2)) { + this.buf.add("k"); + } else if(!isFinite(v2)) { + this.buf.add(v2 < 0 ? "m" : "p"); + } else { + this.buf.add("d"); + this.buf.add(v2); + } + break; + case 3: + this.buf.add(v ? "t" : "f"); + break; + case 4: + if(Std["is"](v,Class)) { + var className = Type.getClassName(v); + this.buf.add("A"); + this.serializeString(className); + } else if(Std["is"](v,Enum)) { + this.buf.add("B"); + this.serializeString(Type.getEnumName(v)); + } else { + if(this.useCache && this.serializeRef(v)) { + return; + } + this.buf.add("o"); + this.serializeFields(v); + } + break; + case 5: + throw new js__$Boot_HaxeError("Cannot serialize function"); + break; + case 6: + var c = _g[2]; + if(c == String) { + this.serializeString(v); + return; + } + if(this.useCache && this.serializeRef(v)) { + return; + } + switch(c) { + case Array: + var ucount = 0; + this.buf.add("a"); + var l = v["length"]; + var _g1 = 0; + var _g2 = l; + while(_g1 < _g2) { + var i = _g1++; + if(v[i] == null) { + ++ucount; + } else { + if(ucount > 0) { + if(ucount == 1) { + this.buf.add("n"); + } else { + this.buf.add("u"); + this.buf.add(ucount); + } + ucount = 0; + } + this.serialize(v[i]); + } + } + if(ucount > 0) { + if(ucount == 1) { + this.buf.add("n"); + } else { + this.buf.add("u"); + this.buf.add(ucount); + } + } + this.buf.add("h"); + break; + case Date: + var d = v; + this.buf.add("v"); + this.buf.add(d.getTime()); + break; + case List: + this.buf.add("l"); + var v3 = v; + var i1 = v3.iterator(); + while(i1.hasNext()) { + var i2 = i1.next(); + this.serialize(i2); + } + this.buf.add("h"); + break; + case haxe_ds_IntMap: + this.buf.add("q"); + var v4 = v; + var k = v4.keys(); + while(k.hasNext()) { + var k1 = k.next(); + this.buf.add(":"); + this.buf.add(k1); + this.serialize(v4.get(k1)); + } + this.buf.add("h"); + break; + case haxe_ds_ObjectMap: + this.buf.add("M"); + var v5 = v; + var k2 = v5.keys(); + while(k2.hasNext()) { + var k3 = k2.next(); + var id = Reflect.field(k3,"__id__"); + Reflect.deleteField(k3,"__id__"); + this.serialize(k3); + Reflect.setField(k3,"__id__",id); + this.serialize(v5.get(k3)); + } + this.buf.add("h"); + break; + case haxe_ds_StringMap: + this.buf.add("b"); + var v6 = v; + var k4 = v6.keys(); + while(k4.hasNext()) { + var k5 = k4.next(); + this.serializeString(k5); + this.serialize(v6.get(k5)); + } + this.buf.add("h"); + break; + case haxe_io_Bytes: + var v7 = v; + this.buf.add("s"); + this.buf.add(Math.ceil(v7.length * 8 / 6)); + this.buf.add(":"); + var i3 = 0; + var max = v7.length - 2; + var b64 = haxe_Serializer.BASE64_CODES; + if(b64 == null) { + var length = haxe_Serializer.BASE64.length; + var this1 = new Array(length); + b64 = this1; + var _g11 = 0; + var _g3 = haxe_Serializer.BASE64.length; + while(_g11 < _g3) { + var i4 = _g11++; + b64[i4] = HxOverrides.cca(haxe_Serializer.BASE64,i4); + } + haxe_Serializer.BASE64_CODES = b64; + } + while(i3 < max) { + var b1 = v7.get(i3++); + var b2 = v7.get(i3++); + var b3 = v7.get(i3++); + this.buf.addChar(b64[b1 >> 2]); + this.buf.addChar(b64[(b1 << 4 | b2 >> 4) & 63]); + this.buf.addChar(b64[(b2 << 2 | b3 >> 6) & 63]); + this.buf.addChar(b64[b3 & 63]); + } + if(i3 == max) { + var b11 = v7.get(i3++); + var b21 = v7.get(i3++); + this.buf.addChar(b64[b11 >> 2]); + this.buf.addChar(b64[(b11 << 4 | b21 >> 4) & 63]); + this.buf.addChar(b64[b21 << 2 & 63]); + } else if(i3 == max + 1) { + var b12 = v7.get(i3++); + this.buf.addChar(b64[b12 >> 2]); + this.buf.addChar(b64[b12 << 4 & 63]); + } + break; + default: + if(this.useCache) { + this.cache.pop(); + } + if(v.hxSerialize != null) { + this.buf.add("C"); + this.serializeString(Type.getClassName(c)); + if(this.useCache) { + this.cache.push(v); + } + v.hxSerialize(this); + this.buf.add("g"); + } else { + this.buf.add("c"); + this.serializeString(Type.getClassName(c)); + if(this.useCache) { + this.cache.push(v); + } + this.serializeFields(v); + } + } + break; + case 7: + var e = _g[2]; + if(this.useCache) { + if(this.serializeRef(v)) { + return; + } + this.cache.pop(); + } + this.buf.add(this.useEnumIndex ? "j" : "w"); + this.serializeString(Type.getEnumName(e)); + if(this.useEnumIndex) { + this.buf.add(":"); + this.buf.add(v[1]); + } else { + this.serializeString(v[0]); + } + this.buf.add(":"); + var l1 = v["length"]; + this.buf.add(l1 - 2); + var _g12 = 2; + var _g4 = l1; + while(_g12 < _g4) { + var i5 = _g12++; + this.serialize(v[i5]); + } + if(this.useCache) { + this.cache.push(v); + } + break; + default: + throw new js__$Boot_HaxeError("Cannot serialize " + Std.string(v)); + } + } + ,__class__: haxe_Serializer +}; +var haxe__$Unserializer_DefaultResolver = function() { +}; +$hxClasses["haxe._Unserializer.DefaultResolver"] = haxe__$Unserializer_DefaultResolver; +haxe__$Unserializer_DefaultResolver.__name__ = ["haxe","_Unserializer","DefaultResolver"]; +haxe__$Unserializer_DefaultResolver.prototype = { + resolveClass: function(name) { + return Type.resolveClass(name); + } + ,resolveEnum: function(name) { + return Type.resolveEnum(name); + } + ,__class__: haxe__$Unserializer_DefaultResolver +}; +var haxe_Unserializer = function(buf) { + this.buf = buf; + this.length = buf.length; + this.pos = 0; + this.scache = []; + this.cache = []; + var r = haxe_Unserializer.DEFAULT_RESOLVER; + if(r == null) { + r = new haxe__$Unserializer_DefaultResolver(); + haxe_Unserializer.DEFAULT_RESOLVER = r; + } + this.resolver = r; +}; +$hxClasses["haxe.Unserializer"] = haxe_Unserializer; +haxe_Unserializer.__name__ = ["haxe","Unserializer"]; +haxe_Unserializer.initCodes = function() { + var codes = []; + var _g1 = 0; + var _g = haxe_Unserializer.BASE64.length; + while(_g1 < _g) { + var i = _g1++; + codes[StringTools.fastCodeAt(haxe_Unserializer.BASE64,i)] = i; + } + return codes; +}; +haxe_Unserializer.prototype = { + buf: null + ,pos: null + ,length: null + ,cache: null + ,scache: null + ,resolver: null + ,setResolver: function(r) { + if(r == null) { + this.resolver = haxe__$Unserializer_NullResolver.get_instance(); + } else { + this.resolver = r; + } + } + ,get: function(p) { + return StringTools.fastCodeAt(this.buf,p); + } + ,readDigits: function() { + var k = 0; + var s = false; + var fpos = this.pos; + while(true) { + var c = this.get(this.pos); + if(StringTools.isEof(c)) { + break; + } + if(c == 45) { + if(this.pos != fpos) { + break; + } + s = true; + this.pos++; + continue; + } + if(c < 48 || c > 57) { + break; + } + k = k * 10 + (c - 48); + this.pos++; + } + if(s) { + k *= -1; + } + return k; + } + ,readFloat: function() { + var p1 = this.pos; + while(true) { + var c = this.get(this.pos); + if(StringTools.isEof(c)) { + break; + } + if(c >= 43 && c < 58 || c == 101 || c == 69) { + this.pos++; + } else { + break; + } + } + return Std.parseFloat(HxOverrides.substr(this.buf,p1,this.pos - p1)); + } + ,unserializeObject: function(o) { + while(true) { + if(this.pos >= this.length) { + throw new js__$Boot_HaxeError("Invalid object"); + } + if(this.get(this.pos) == 103) { + break; + } + var k = this.unserialize(); + if(typeof(k) != "string") { + throw new js__$Boot_HaxeError("Invalid object key"); + } + var v = this.unserialize(); + Reflect.setField(o,k,v); + } + this.pos++; + } + ,unserializeEnum: function(edecl,tag) { + if(this.get(this.pos++) != 58) { + throw new js__$Boot_HaxeError("Invalid enum format"); + } + var nargs = this.readDigits(); + if(nargs == 0) { + return Type.createEnum(edecl,tag); + } + var args = []; + while(nargs-- > 0) args.push(this.unserialize()); + return Type.createEnum(edecl,tag,args); + } + ,unserialize: function() { + var _g = this.get(this.pos++); + switch(_g) { + case 65: + var name = this.unserialize(); + var cl = this.resolver.resolveClass(name); + if(cl == null) { + throw new js__$Boot_HaxeError("Class not found " + name); + } + return cl; + case 66: + var name1 = this.unserialize(); + var e = this.resolver.resolveEnum(name1); + if(e == null) { + throw new js__$Boot_HaxeError("Enum not found " + name1); + } + return e; + case 67: + var name2 = this.unserialize(); + var cl1 = this.resolver.resolveClass(name2); + if(cl1 == null) { + throw new js__$Boot_HaxeError("Class not found " + name2); + } + var o = Type.createEmptyInstance(cl1); + this.cache.push(o); + o.hxUnserialize(this); + if(this.get(this.pos++) != 103) { + throw new js__$Boot_HaxeError("Invalid custom data"); + } + return o; + case 77: + var h = new haxe_ds_ObjectMap(); + this.cache.push(h); + var buf = this.buf; + while(this.get(this.pos) != 104) { + var s = this.unserialize(); + h.set(s,this.unserialize()); + } + this.pos++; + return h; + case 82: + var n = this.readDigits(); + if(n < 0 || n >= this.scache.length) { + throw new js__$Boot_HaxeError("Invalid string reference"); + } + return this.scache[n]; + case 97: + var buf1 = this.buf; + var a = []; + this.cache.push(a); + while(true) { + var c = this.get(this.pos); + if(c == 104) { + this.pos++; + break; + } + if(c == 117) { + this.pos++; + var n1 = this.readDigits(); + a[a.length + n1 - 1] = null; + } else { + a.push(this.unserialize()); + } + } + return a; + case 98: + var h1 = new haxe_ds_StringMap(); + this.cache.push(h1); + var buf2 = this.buf; + while(this.get(this.pos) != 104) { + var s1 = this.unserialize(); + h1.set(s1,this.unserialize()); + } + this.pos++; + return h1; + case 99: + var name3 = this.unserialize(); + var cl2 = this.resolver.resolveClass(name3); + if(cl2 == null) { + throw new js__$Boot_HaxeError("Class not found " + name3); + } + var o1 = Type.createEmptyInstance(cl2); + this.cache.push(o1); + this.unserializeObject(o1); + return o1; + case 100: + return this.readFloat(); + case 102: + return false; + case 105: + return this.readDigits(); + case 106: + var name4 = this.unserialize(); + var edecl = this.resolver.resolveEnum(name4); + if(edecl == null) { + throw new js__$Boot_HaxeError("Enum not found " + name4); + } + this.pos++; + var index = this.readDigits(); + var tag = Type.getEnumConstructs(edecl)[index]; + if(tag == null) { + throw new js__$Boot_HaxeError("Unknown enum index " + name4 + "@" + index); + } + var e1 = this.unserializeEnum(edecl,tag); + this.cache.push(e1); + return e1; + case 107: + return NaN; + case 108: + var l = new List(); + this.cache.push(l); + var buf3 = this.buf; + while(this.get(this.pos) != 104) l.add(this.unserialize()); + this.pos++; + return l; + case 109: + return -Infinity; + case 110: + return null; + case 111: + var o2 = { }; + this.cache.push(o2); + this.unserializeObject(o2); + return o2; + case 112: + return Infinity; + case 113: + var h2 = new haxe_ds_IntMap(); + this.cache.push(h2); + var buf4 = this.buf; + var c1 = this.get(this.pos++); + while(c1 == 58) { + var i = this.readDigits(); + h2.set(i,this.unserialize()); + c1 = this.get(this.pos++); + } + if(c1 != 104) { + throw new js__$Boot_HaxeError("Invalid IntMap format"); + } + return h2; + case 114: + var n2 = this.readDigits(); + if(n2 < 0 || n2 >= this.cache.length) { + throw new js__$Boot_HaxeError("Invalid reference"); + } + return this.cache[n2]; + case 115: + var len = this.readDigits(); + var buf5 = this.buf; + if(this.get(this.pos++) != 58 || this.length - this.pos < len) { + throw new js__$Boot_HaxeError("Invalid bytes length"); + } + var codes = haxe_Unserializer.CODES; + if(codes == null) { + codes = haxe_Unserializer.initCodes(); + haxe_Unserializer.CODES = codes; + } + var i1 = this.pos; + var rest = len & 3; + var size = (len >> 2) * 3 + (rest >= 2 ? rest - 1 : 0); + var max = i1 + (len - rest); + var bytes = haxe_io_Bytes.alloc(size); + var bpos = 0; + while(i1 < max) { + var c11 = codes[StringTools.fastCodeAt(buf5,i1++)]; + var c2 = codes[StringTools.fastCodeAt(buf5,i1++)]; + bytes.set(bpos++,c11 << 2 | c2 >> 4); + var c3 = codes[StringTools.fastCodeAt(buf5,i1++)]; + bytes.set(bpos++,c2 << 4 | c3 >> 2); + var c4 = codes[StringTools.fastCodeAt(buf5,i1++)]; + bytes.set(bpos++,c3 << 6 | c4); + } + if(rest >= 2) { + var c12 = codes[StringTools.fastCodeAt(buf5,i1++)]; + var c21 = codes[StringTools.fastCodeAt(buf5,i1++)]; + bytes.set(bpos++,c12 << 2 | c21 >> 4); + if(rest == 3) { + var c31 = codes[StringTools.fastCodeAt(buf5,i1++)]; + bytes.set(bpos++,c21 << 4 | c31 >> 2); + } + } + this.pos += len; + this.cache.push(bytes); + return bytes; + case 116: + return true; + case 118: + var d; + if(this.get(this.pos) >= 48 && this.get(this.pos) <= 57 && this.get(this.pos + 1) >= 48 && this.get(this.pos + 1) <= 57 && this.get(this.pos + 2) >= 48 && this.get(this.pos + 2) <= 57 && this.get(this.pos + 3) >= 48 && this.get(this.pos + 3) <= 57 && this.get(this.pos + 4) == 45) { + d = HxOverrides.strDate(HxOverrides.substr(this.buf,this.pos,19)); + this.pos += 19; + } else { + var t = this.readFloat(); + d = new Date(t); + } + this.cache.push(d); + return d; + case 119: + var name5 = this.unserialize(); + var edecl1 = this.resolver.resolveEnum(name5); + if(edecl1 == null) { + throw new js__$Boot_HaxeError("Enum not found " + name5); + } + var e2 = this.unserializeEnum(edecl1,this.unserialize()); + this.cache.push(e2); + return e2; + case 120: + throw js__$Boot_HaxeError.wrap(this.unserialize()); + break; + case 121: + var len1 = this.readDigits(); + if(this.get(this.pos++) != 58 || this.length - this.pos < len1) { + throw new js__$Boot_HaxeError("Invalid string length"); + } + var s2 = HxOverrides.substr(this.buf,this.pos,len1); + this.pos += len1; + s2 = StringTools.urlDecode(s2); + this.scache.push(s2); + return s2; + case 122: + return 0; + default: + } + this.pos--; + throw new js__$Boot_HaxeError("Invalid char " + this.buf.charAt(this.pos) + " at position " + this.pos); + } + ,__class__: haxe_Unserializer +}; +var haxe__$Unserializer_NullResolver = function() { +}; +$hxClasses["haxe._Unserializer.NullResolver"] = haxe__$Unserializer_NullResolver; +haxe__$Unserializer_NullResolver.__name__ = ["haxe","_Unserializer","NullResolver"]; +haxe__$Unserializer_NullResolver.__properties__ = {get_instance:"get_instance"}; +haxe__$Unserializer_NullResolver.instance = null; +haxe__$Unserializer_NullResolver.get_instance = function() { + if(haxe__$Unserializer_NullResolver.instance == null) { + haxe__$Unserializer_NullResolver.instance = new haxe__$Unserializer_NullResolver(); + } + return haxe__$Unserializer_NullResolver.instance; +}; +haxe__$Unserializer_NullResolver.prototype = { + resolveClass: function(name) { + return null; + } + ,resolveEnum: function(name) { + return null; + } + ,__class__: haxe__$Unserializer_NullResolver +}; +var haxe_Utf8 = function() { }; +$hxClasses["haxe.Utf8"] = haxe_Utf8; +haxe_Utf8.__name__ = ["haxe","Utf8"]; +haxe_Utf8.charCodeAt = function(s,index) { + return HxOverrides.cca(s,index); +}; +haxe_Utf8.sub = function(s,pos,len) { + return HxOverrides.substr(s,pos,len); +}; +var haxe_io_Bytes = function(data) { + this.length = data.byteLength; + this.b = new Uint8Array(data); + this.b.bufferValue = data; + data.hxBytes = this; + data.bytes = this.b; +}; +$hxClasses["haxe.io.Bytes"] = haxe_io_Bytes; +haxe_io_Bytes.__name__ = ["haxe","io","Bytes"]; +haxe_io_Bytes.alloc = function(length) { + return new haxe_io_Bytes(new ArrayBuffer(length)); +}; +haxe_io_Bytes.ofString = function(s) { + var a = []; + var i = 0; + while(i < s.length) { + var c = StringTools.fastCodeAt(s,i++); + if(55296 <= c && c <= 56319) { + c = c - 55232 << 10 | StringTools.fastCodeAt(s,i++) & 1023; + } + if(c <= 127) { + a.push(c); + } else if(c <= 2047) { + a.push(192 | c >> 6); + a.push(128 | c & 63); + } else if(c <= 65535) { + a.push(224 | c >> 12); + a.push(128 | c >> 6 & 63); + a.push(128 | c & 63); + } else { + a.push(240 | c >> 18); + a.push(128 | c >> 12 & 63); + a.push(128 | c >> 6 & 63); + a.push(128 | c & 63); + } + } + return new haxe_io_Bytes(new Uint8Array(a).buffer); +}; +haxe_io_Bytes.ofData = function(b) { + var hb = b.hxBytes; + if(hb != null) { + return hb; + } + return new haxe_io_Bytes(b); +}; +haxe_io_Bytes.fastGet = function(b,pos) { + return b.bytes[pos]; +}; +haxe_io_Bytes.prototype = { + length: null + ,b: null + ,data: null + ,get: function(pos) { + return this.b[pos]; + } + ,set: function(pos,v) { + this.b[pos] = v & 255; + } + ,blit: function(pos,src,srcpos,len) { + if(pos < 0 || srcpos < 0 || len < 0 || pos + len > this.length || srcpos + len > src.length) { + throw new js__$Boot_HaxeError(haxe_io_Error.OutsideBounds); + } + if(srcpos == 0 && len == src.b.byteLength) { + this.b.set(src.b,pos); + } else { + this.b.set(src.b.subarray(srcpos,srcpos + len),pos); + } + } + ,fill: function(pos,len,value) { + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + this.set(pos++,value); + } + } + ,getString: function(pos,len) { + if(pos < 0 || len < 0 || pos + len > this.length) { + throw new js__$Boot_HaxeError(haxe_io_Error.OutsideBounds); + } + var s = ""; + var b = this.b; + var fcc = String.fromCharCode; + var i = pos; + var max = pos + len; + while(i < max) { + var c = b[i++]; + if(c < 128) { + if(c == 0) { + break; + } + s += fcc(c); + } else if(c < 224) { + s += fcc((c & 63) << 6 | b[i++] & 127); + } else if(c < 240) { + var c2 = b[i++]; + s += fcc((c & 31) << 12 | (c2 & 127) << 6 | b[i++] & 127); + } else { + var c21 = b[i++]; + var c3 = b[i++]; + var u = (c & 15) << 18 | (c21 & 127) << 12 | (c3 & 127) << 6 | b[i++] & 127; + s += fcc((u >> 10) + 55232); + s += fcc(u & 1023 | 56320); + } + } + return s; + } + ,toString: function() { + return this.getString(0,this.length); + } + ,getData: function() { + return this.b.bufferValue; + } + ,__class__: haxe_io_Bytes +}; +var haxe_crypto_Base64 = function() { }; +$hxClasses["haxe.crypto.Base64"] = haxe_crypto_Base64; +haxe_crypto_Base64.__name__ = ["haxe","crypto","Base64"]; +haxe_crypto_Base64.encode = function(bytes,complement) { + if(complement == null) { + complement = true; + } + var str = new haxe_crypto_BaseCode(haxe_crypto_Base64.BYTES).encodeBytes(bytes).toString(); + if(complement) { + var _g = bytes.length % 3; + switch(_g) { + case 1: + str += "=="; + break; + case 2: + str += "="; + break; + default: + } + } + return str; +}; +haxe_crypto_Base64.decode = function(str,complement) { + if(complement == null) { + complement = true; + } + if(complement) { + while(HxOverrides.cca(str,str.length - 1) == 61) str = HxOverrides.substr(str,0,-1); + } + return new haxe_crypto_BaseCode(haxe_crypto_Base64.BYTES).decodeBytes(haxe_io_Bytes.ofString(str)); +}; +var haxe_crypto_BaseCode = function(base) { + var len = base.length; + var nbits = 1; + while(len > 1 << nbits) ++nbits; + if(nbits > 8 || len != 1 << nbits) { + throw new js__$Boot_HaxeError("BaseCode : base length must be a power of two."); + } + this.base = base; + this.nbits = nbits; +}; +$hxClasses["haxe.crypto.BaseCode"] = haxe_crypto_BaseCode; +haxe_crypto_BaseCode.__name__ = ["haxe","crypto","BaseCode"]; +haxe_crypto_BaseCode.prototype = { + base: null + ,nbits: null + ,tbl: null + ,encodeBytes: function(b) { + var nbits = this.nbits; + var base = this.base; + var size = Std["int"](b.length * 8 / nbits); + var out = haxe_io_Bytes.alloc(size + (b.length * 8 % nbits == 0 ? 0 : 1)); + var buf = 0; + var curbits = 0; + var mask = (1 << nbits) - 1; + var pin = 0; + var pout = 0; + while(pout < size) { + while(curbits < nbits) { + curbits += 8; + buf <<= 8; + buf |= b.get(pin++); + } + curbits -= nbits; + out.set(pout++,base.get(buf >> curbits & mask)); + } + if(curbits > 0) { + out.set(pout++,base.get(buf << nbits - curbits & mask)); + } + return out; + } + ,initTable: function() { + var tbl = []; + var _g = 0; + while(_g < 256) { + var i = _g++; + tbl[i] = -1; + } + var _g1 = 0; + var _g2 = this.base.length; + while(_g1 < _g2) { + var i1 = _g1++; + tbl[this.base.get(i1)] = i1; + } + this.tbl = tbl; + } + ,decodeBytes: function(b) { + var nbits = this.nbits; + var base = this.base; + if(this.tbl == null) { + this.initTable(); + } + var tbl = this.tbl; + var size = b.length * nbits >> 3; + var out = haxe_io_Bytes.alloc(size); + var buf = 0; + var curbits = 0; + var pin = 0; + var pout = 0; + while(pout < size) { + while(curbits < 8) { + curbits += nbits; + buf <<= nbits; + var i = tbl[b.get(pin++)]; + if(i == -1) { + throw new js__$Boot_HaxeError("BaseCode : invalid encoded char"); + } + buf |= i; + } + curbits -= 8; + out.set(pout++,buf >> curbits & 255); + } + return out; + } + ,__class__: haxe_crypto_BaseCode +}; +var haxe_crypto_Md5 = function() { +}; +$hxClasses["haxe.crypto.Md5"] = haxe_crypto_Md5; +haxe_crypto_Md5.__name__ = ["haxe","crypto","Md5"]; +haxe_crypto_Md5.encode = function(s) { + var m = new haxe_crypto_Md5(); + var h = m.doEncode(haxe_crypto_Md5.str2blks(s)); + return m.hex(h); +}; +haxe_crypto_Md5.str2blks = function(str) { + var str1 = haxe_io_Bytes.ofString(str); + var nblk = (str1.length + 8 >> 6) + 1; + var blks = []; + var blksSize = nblk * 16; + var _g1 = 0; + var _g = blksSize; + while(_g1 < _g) { + var i = _g1++; + blks[i] = 0; + } + var i1 = 0; + var max = str1.length; + var l = max * 8; + while(i1 < max) { + blks[i1 >> 2] |= str1.get(i1) << (l + i1) % 4 * 8; + ++i1; + } + blks[i1 >> 2] |= 128 << (l + i1) % 4 * 8; + var k = nblk * 16 - 2; + blks[k] = l & 255; + blks[k] |= (l >>> 8 & 255) << 8; + blks[k] |= (l >>> 16 & 255) << 16; + blks[k] |= (l >>> 24 & 255) << 24; + return blks; +}; +haxe_crypto_Md5.prototype = { + bitOR: function(a,b) { + var lsb = a & 1 | b & 1; + var msb31 = a >>> 1 | b >>> 1; + return msb31 << 1 | lsb; + } + ,bitXOR: function(a,b) { + var lsb = a & 1 ^ b & 1; + var msb31 = a >>> 1 ^ b >>> 1; + return msb31 << 1 | lsb; + } + ,bitAND: function(a,b) { + var lsb = a & 1 & (b & 1); + var msb31 = a >>> 1 & b >>> 1; + return msb31 << 1 | lsb; + } + ,addme: function(x,y) { + var lsw = (x & 65535) + (y & 65535); + var msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return msw << 16 | lsw & 65535; + } + ,hex: function(a) { + var str = ""; + var hex_chr = "0123456789abcdef"; + var _g = 0; + while(_g < a.length) { + var num = a[_g]; + ++_g; + var _g1 = 0; + while(_g1 < 4) { + var j = _g1++; + str += hex_chr.charAt(num >> j * 8 + 4 & 15) + hex_chr.charAt(num >> j * 8 & 15); + } + } + return str; + } + ,rol: function(num,cnt) { + return num << cnt | num >>> 32 - cnt; + } + ,cmn: function(q,a,b,x,s,t) { + return this.addme(this.rol(this.addme(this.addme(a,q),this.addme(x,t)),s),b); + } + ,ff: function(a,b,c,d,x,s,t) { + return this.cmn(this.bitOR(this.bitAND(b,c),this.bitAND(~b,d)),a,b,x,s,t); + } + ,gg: function(a,b,c,d,x,s,t) { + return this.cmn(this.bitOR(this.bitAND(b,d),this.bitAND(c,~d)),a,b,x,s,t); + } + ,hh: function(a,b,c,d,x,s,t) { + return this.cmn(this.bitXOR(this.bitXOR(b,c),d),a,b,x,s,t); + } + ,ii: function(a,b,c,d,x,s,t) { + return this.cmn(this.bitXOR(c,this.bitOR(b,~d)),a,b,x,s,t); + } + ,doEncode: function(x) { + var a = 1732584193; + var b = -271733879; + var c = -1732584194; + var d = 271733878; + var step; + var i = 0; + while(i < x.length) { + var olda = a; + var oldb = b; + var oldc = c; + var oldd = d; + step = 0; + a = this.ff(a,b,c,d,x[i],7,-680876936); + d = this.ff(d,a,b,c,x[i + 1],12,-389564586); + c = this.ff(c,d,a,b,x[i + 2],17,606105819); + b = this.ff(b,c,d,a,x[i + 3],22,-1044525330); + a = this.ff(a,b,c,d,x[i + 4],7,-176418897); + d = this.ff(d,a,b,c,x[i + 5],12,1200080426); + c = this.ff(c,d,a,b,x[i + 6],17,-1473231341); + b = this.ff(b,c,d,a,x[i + 7],22,-45705983); + a = this.ff(a,b,c,d,x[i + 8],7,1770035416); + d = this.ff(d,a,b,c,x[i + 9],12,-1958414417); + c = this.ff(c,d,a,b,x[i + 10],17,-42063); + b = this.ff(b,c,d,a,x[i + 11],22,-1990404162); + a = this.ff(a,b,c,d,x[i + 12],7,1804603682); + d = this.ff(d,a,b,c,x[i + 13],12,-40341101); + c = this.ff(c,d,a,b,x[i + 14],17,-1502002290); + b = this.ff(b,c,d,a,x[i + 15],22,1236535329); + a = this.gg(a,b,c,d,x[i + 1],5,-165796510); + d = this.gg(d,a,b,c,x[i + 6],9,-1069501632); + c = this.gg(c,d,a,b,x[i + 11],14,643717713); + b = this.gg(b,c,d,a,x[i],20,-373897302); + a = this.gg(a,b,c,d,x[i + 5],5,-701558691); + d = this.gg(d,a,b,c,x[i + 10],9,38016083); + c = this.gg(c,d,a,b,x[i + 15],14,-660478335); + b = this.gg(b,c,d,a,x[i + 4],20,-405537848); + a = this.gg(a,b,c,d,x[i + 9],5,568446438); + d = this.gg(d,a,b,c,x[i + 14],9,-1019803690); + c = this.gg(c,d,a,b,x[i + 3],14,-187363961); + b = this.gg(b,c,d,a,x[i + 8],20,1163531501); + a = this.gg(a,b,c,d,x[i + 13],5,-1444681467); + d = this.gg(d,a,b,c,x[i + 2],9,-51403784); + c = this.gg(c,d,a,b,x[i + 7],14,1735328473); + b = this.gg(b,c,d,a,x[i + 12],20,-1926607734); + a = this.hh(a,b,c,d,x[i + 5],4,-378558); + d = this.hh(d,a,b,c,x[i + 8],11,-2022574463); + c = this.hh(c,d,a,b,x[i + 11],16,1839030562); + b = this.hh(b,c,d,a,x[i + 14],23,-35309556); + a = this.hh(a,b,c,d,x[i + 1],4,-1530992060); + d = this.hh(d,a,b,c,x[i + 4],11,1272893353); + c = this.hh(c,d,a,b,x[i + 7],16,-155497632); + b = this.hh(b,c,d,a,x[i + 10],23,-1094730640); + a = this.hh(a,b,c,d,x[i + 13],4,681279174); + d = this.hh(d,a,b,c,x[i],11,-358537222); + c = this.hh(c,d,a,b,x[i + 3],16,-722521979); + b = this.hh(b,c,d,a,x[i + 6],23,76029189); + a = this.hh(a,b,c,d,x[i + 9],4,-640364487); + d = this.hh(d,a,b,c,x[i + 12],11,-421815835); + c = this.hh(c,d,a,b,x[i + 15],16,530742520); + b = this.hh(b,c,d,a,x[i + 2],23,-995338651); + a = this.ii(a,b,c,d,x[i],6,-198630844); + d = this.ii(d,a,b,c,x[i + 7],10,1126891415); + c = this.ii(c,d,a,b,x[i + 14],15,-1416354905); + b = this.ii(b,c,d,a,x[i + 5],21,-57434055); + a = this.ii(a,b,c,d,x[i + 12],6,1700485571); + d = this.ii(d,a,b,c,x[i + 3],10,-1894986606); + c = this.ii(c,d,a,b,x[i + 10],15,-1051523); + b = this.ii(b,c,d,a,x[i + 1],21,-2054922799); + a = this.ii(a,b,c,d,x[i + 8],6,1873313359); + d = this.ii(d,a,b,c,x[i + 15],10,-30611744); + c = this.ii(c,d,a,b,x[i + 6],15,-1560198380); + b = this.ii(b,c,d,a,x[i + 13],21,1309151649); + a = this.ii(a,b,c,d,x[i + 4],6,-145523070); + d = this.ii(d,a,b,c,x[i + 11],10,-1120210379); + c = this.ii(c,d,a,b,x[i + 2],15,718787259); + b = this.ii(b,c,d,a,x[i + 9],21,-343485551); + a = this.addme(a,olda); + b = this.addme(b,oldb); + c = this.addme(c,oldc); + d = this.addme(d,oldd); + i += 16; + } + return [a,b,c,d]; + } + ,__class__: haxe_crypto_Md5 +}; +var haxe_ds_BalancedTree = function() { +}; +$hxClasses["haxe.ds.BalancedTree"] = haxe_ds_BalancedTree; +haxe_ds_BalancedTree.__name__ = ["haxe","ds","BalancedTree"]; +haxe_ds_BalancedTree.prototype = { + root: null + ,set: function(key,value) { + this.root = this.setLoop(key,value,this.root); + } + ,get: function(key) { + var node = this.root; + while(node != null) { + var c = this.compare(key,node.key); + if(c == 0) { + return node.value; + } + if(c < 0) { + node = node.left; + } else { + node = node.right; + } + } + return null; + } + ,remove: function(key) { + try { + this.root = this.removeLoop(key,this.root); + return true; + } catch( e ) { + haxe_CallStack.lastException = e; + if (e instanceof js__$Boot_HaxeError) e = e.val; + if( js_Boot.__instanceof(e,String) ) { + return false; + } else throw(e); + } + } + ,exists: function(key) { + var node = this.root; + while(node != null) { + var c = this.compare(key,node.key); + if(c == 0) { + return true; + } else if(c < 0) { + node = node.left; + } else { + node = node.right; + } + } + return false; + } + ,setLoop: function(k,v,node) { + if(node == null) { + return new haxe_ds_TreeNode(null,k,v,null); + } + var c = this.compare(k,node.key); + if(c == 0) { + return new haxe_ds_TreeNode(node.left,k,v,node.right,node == null ? 0 : node._height); + } else if(c < 0) { + var nl = this.setLoop(k,v,node.left); + return this.balance(nl,node.key,node.value,node.right); + } else { + var nr = this.setLoop(k,v,node.right); + return this.balance(node.left,node.key,node.value,nr); + } + } + ,removeLoop: function(k,node) { + if(node == null) { + throw new js__$Boot_HaxeError("Not_found"); + } + var c = this.compare(k,node.key); + if(c == 0) { + return this.merge(node.left,node.right); + } else if(c < 0) { + return this.balance(this.removeLoop(k,node.left),node.key,node.value,node.right); + } else { + return this.balance(node.left,node.key,node.value,this.removeLoop(k,node.right)); + } + } + ,merge: function(t1,t2) { + if(t1 == null) { + return t2; + } + if(t2 == null) { + return t1; + } + var t = this.minBinding(t2); + return this.balance(t1,t.key,t.value,this.removeMinBinding(t2)); + } + ,minBinding: function(t) { + if(t == null) { + throw new js__$Boot_HaxeError("Not_found"); + } else if(t.left == null) { + return t; + } else { + return this.minBinding(t.left); + } + } + ,removeMinBinding: function(t) { + if(t.left == null) { + return t.right; + } else { + return this.balance(this.removeMinBinding(t.left),t.key,t.value,t.right); + } + } + ,balance: function(l,k,v,r) { + var hl = l == null ? 0 : l._height; + var hr = r == null ? 0 : r._height; + if(hl > hr + 2) { + var _this = l.left; + var _this1 = l.right; + if((_this == null ? 0 : _this._height) >= (_this1 == null ? 0 : _this1._height)) { + return new haxe_ds_TreeNode(l.left,l.key,l.value,new haxe_ds_TreeNode(l.right,k,v,r)); + } else { + return new haxe_ds_TreeNode(new haxe_ds_TreeNode(l.left,l.key,l.value,l.right.left),l.right.key,l.right.value,new haxe_ds_TreeNode(l.right.right,k,v,r)); + } + } else if(hr > hl + 2) { + var _this2 = r.right; + var _this3 = r.left; + if((_this2 == null ? 0 : _this2._height) > (_this3 == null ? 0 : _this3._height)) { + return new haxe_ds_TreeNode(new haxe_ds_TreeNode(l,k,v,r.left),r.key,r.value,r.right); + } else { + return new haxe_ds_TreeNode(new haxe_ds_TreeNode(l,k,v,r.left.left),r.left.key,r.left.value,new haxe_ds_TreeNode(r.left.right,r.key,r.value,r.right)); + } + } else { + return new haxe_ds_TreeNode(l,k,v,r,(hl > hr ? hl : hr) + 1); + } + } + ,compare: function(k1,k2) { + return Reflect.compare(k1,k2); + } + ,__class__: haxe_ds_BalancedTree +}; +var haxe_ds_TreeNode = function(l,k,v,r,h) { + if(h == null) { + h = -1; + } + this.left = l; + this.key = k; + this.value = v; + this.right = r; + if(h == -1) { + var tmp; + var _this = this.left; + var _this1 = this.right; + if((_this == null ? 0 : _this._height) > (_this1 == null ? 0 : _this1._height)) { + var _this2 = this.left; + if(_this2 == null) { + tmp = 0; + } else { + tmp = _this2._height; + } + } else { + var _this3 = this.right; + if(_this3 == null) { + tmp = 0; + } else { + tmp = _this3._height; + } + } + this._height = tmp + 1; + } else { + this._height = h; + } +}; +$hxClasses["haxe.ds.TreeNode"] = haxe_ds_TreeNode; +haxe_ds_TreeNode.__name__ = ["haxe","ds","TreeNode"]; +haxe_ds_TreeNode.prototype = { + left: null + ,right: null + ,key: null + ,value: null + ,_height: null + ,__class__: haxe_ds_TreeNode +}; +var haxe_ds_EnumValueMap = function() { + haxe_ds_BalancedTree.call(this); +}; +$hxClasses["haxe.ds.EnumValueMap"] = haxe_ds_EnumValueMap; +haxe_ds_EnumValueMap.__name__ = ["haxe","ds","EnumValueMap"]; +haxe_ds_EnumValueMap.__interfaces__ = [haxe_IMap]; +haxe_ds_EnumValueMap.__super__ = haxe_ds_BalancedTree; +haxe_ds_EnumValueMap.prototype = $extend(haxe_ds_BalancedTree.prototype,{ + compare: function(k1,k2) { + var d = Type.enumIndex(k1) - Type.enumIndex(k2); + if(d != 0) { + return d; + } + var p1 = Type.enumParameters(k1); + var p2 = Type.enumParameters(k2); + if(p1.length == 0 && p2.length == 0) { + return 0; + } + return this.compareArgs(p1,p2); + } + ,compareArgs: function(a1,a2) { + var ld = a1.length - a2.length; + if(ld != 0) { + return ld; + } + var _g1 = 0; + var _g = a1.length; + while(_g1 < _g) { + var i = _g1++; + var d = this.compareArg(a1[i],a2[i]); + if(d != 0) { + return d; + } + } + return 0; + } + ,compareArg: function(v1,v2) { + if(Reflect.isEnumValue(v1) && Reflect.isEnumValue(v2)) { + return this.compare(v1,v2); + } else if((v1 instanceof Array) && v1.__enum__ == null && ((v2 instanceof Array) && v2.__enum__ == null)) { + return this.compareArgs(v1,v2); + } else { + return Reflect.compare(v1,v2); + } + } + ,__class__: haxe_ds_EnumValueMap +}); +var haxe_ds_GenericCell = function(elt,next) { + this.elt = elt; + this.next = next; +}; +$hxClasses["haxe.ds.GenericCell"] = haxe_ds_GenericCell; +haxe_ds_GenericCell.__name__ = ["haxe","ds","GenericCell"]; +haxe_ds_GenericCell.prototype = { + elt: null + ,next: null + ,__class__: haxe_ds_GenericCell +}; +var haxe_ds_GenericStack = function() { +}; +$hxClasses["haxe.ds.GenericStack"] = haxe_ds_GenericStack; +haxe_ds_GenericStack.__name__ = ["haxe","ds","GenericStack"]; +haxe_ds_GenericStack.prototype = { + head: null + ,add: function(item) { + this.head = new haxe_ds_GenericCell(item,this.head); + } + ,pop: function() { + var k = this.head; + if(k == null) { + return null; + } else { + this.head = k.next; + return k.elt; + } + } + ,isEmpty: function() { + return this.head == null; + } + ,__class__: haxe_ds_GenericStack +}; +var haxe_ds_IntMap = function() { + this.h = { }; +}; +$hxClasses["haxe.ds.IntMap"] = haxe_ds_IntMap; +haxe_ds_IntMap.__name__ = ["haxe","ds","IntMap"]; +haxe_ds_IntMap.__interfaces__ = [haxe_IMap]; +haxe_ds_IntMap.prototype = { + h: null + ,set: function(key,value) { + this.h[key] = value; + } + ,get: function(key) { + return this.h[key]; + } + ,exists: function(key) { + return this.h.hasOwnProperty(key); + } + ,remove: function(key) { + if(!this.h.hasOwnProperty(key)) { + return false; + } + delete(this.h[key]); + return true; + } + ,keys: function() { + var a = []; + for( var key in this.h ) if(this.h.hasOwnProperty(key)) { + a.push(key | 0); + } + return HxOverrides.iter(a); + } + ,iterator: function() { + return { ref : this.h, it : this.keys(), hasNext : function() { + return this.it.hasNext(); + }, next : function() { + var i = this.it.next(); + return this.ref[i]; + }}; + } + ,__class__: haxe_ds_IntMap +}; +var haxe_ds_ObjectMap = function() { + this.h = { __keys__ : { }}; +}; +$hxClasses["haxe.ds.ObjectMap"] = haxe_ds_ObjectMap; +haxe_ds_ObjectMap.__name__ = ["haxe","ds","ObjectMap"]; +haxe_ds_ObjectMap.__interfaces__ = [haxe_IMap]; +haxe_ds_ObjectMap.assignId = function(obj) { + return obj.__id__ = ++haxe_ds_ObjectMap.count; +}; +haxe_ds_ObjectMap.getId = function(obj) { + return obj.__id__; +}; +haxe_ds_ObjectMap.prototype = { + h: null + ,set: function(key,value) { + var id = haxe_ds_ObjectMap.getId(key) || haxe_ds_ObjectMap.assignId(key); + this.h[id] = value; + this.h.__keys__[id] = key; + } + ,get: function(key) { + return this.h[haxe_ds_ObjectMap.getId(key)]; + } + ,exists: function(key) { + return this.h.__keys__[haxe_ds_ObjectMap.getId(key)] != null; + } + ,remove: function(key) { + var id = haxe_ds_ObjectMap.getId(key); + if(this.h.__keys__[id] == null) { + return false; + } + delete(this.h[id]); + delete(this.h.__keys__[id]); + return true; + } + ,keys: function() { + var a = []; + for( var key in this.h.__keys__ ) { + if(this.h.hasOwnProperty(key)) { + a.push(this.h.__keys__[key]); + } + } + return HxOverrides.iter(a); + } + ,__class__: haxe_ds_ObjectMap +}; +var haxe_ds__$StringMap_StringMapIterator = function(map,keys) { + this.map = map; + this.keys = keys; + this.index = 0; + this.count = keys.length; +}; +$hxClasses["haxe.ds._StringMap.StringMapIterator"] = haxe_ds__$StringMap_StringMapIterator; +haxe_ds__$StringMap_StringMapIterator.__name__ = ["haxe","ds","_StringMap","StringMapIterator"]; +haxe_ds__$StringMap_StringMapIterator.prototype = { + map: null + ,keys: null + ,index: null + ,count: null + ,hasNext: function() { + return this.index < this.count; + } + ,next: function() { + return this.map.get(this.keys[this.index++]); + } + ,__class__: haxe_ds__$StringMap_StringMapIterator +}; +var haxe_ds_StringMap = function() { + this.h = { }; +}; +$hxClasses["haxe.ds.StringMap"] = haxe_ds_StringMap; +haxe_ds_StringMap.__name__ = ["haxe","ds","StringMap"]; +haxe_ds_StringMap.__interfaces__ = [haxe_IMap]; +haxe_ds_StringMap.prototype = { + h: null + ,rh: null + ,isReserved: function(key) { + return __map_reserved[key] != null; + } + ,set: function(key,value) { + if(this.isReserved(key)) { + this.setReserved(key,value); + } else { + this.h[key] = value; + } + } + ,get: function(key) { + if(this.isReserved(key)) { + return this.getReserved(key); + } + return this.h[key]; + } + ,exists: function(key) { + if(this.isReserved(key)) { + return this.existsReserved(key); + } + return this.h.hasOwnProperty(key); + } + ,setReserved: function(key,value) { + if(this.rh == null) { + this.rh = { }; + } + this.rh["$" + key] = value; + } + ,getReserved: function(key) { + if(this.rh == null) { + return null; + } else { + return this.rh["$" + key]; + } + } + ,existsReserved: function(key) { + if(this.rh == null) { + return false; + } + return this.rh.hasOwnProperty("$" + key); + } + ,remove: function(key) { + if(this.isReserved(key)) { + key = "$" + key; + if(this.rh == null || !this.rh.hasOwnProperty(key)) { + return false; + } + delete(this.rh[key]); + return true; + } else { + if(!this.h.hasOwnProperty(key)) { + return false; + } + delete(this.h[key]); + return true; + } + } + ,keys: function() { + return HxOverrides.iter(this.arrayKeys()); + } + ,arrayKeys: function() { + var out = []; + for( var key in this.h ) { + if(this.h.hasOwnProperty(key)) { + out.push(key); + } + } + if(this.rh != null) { + for( var key in this.rh ) { + if(key.charCodeAt(0) == 36) { + out.push(key.substr(1)); + } + } + } + return out; + } + ,iterator: function() { + return new haxe_ds__$StringMap_StringMapIterator(this,this.arrayKeys()); + } + ,__class__: haxe_ds_StringMap +}; +var haxe_ds__$Vector_Vector_$Impl_$ = {}; +$hxClasses["haxe.ds._Vector.Vector_Impl_"] = haxe_ds__$Vector_Vector_$Impl_$; +haxe_ds__$Vector_Vector_$Impl_$.__name__ = ["haxe","ds","_Vector","Vector_Impl_"]; +haxe_ds__$Vector_Vector_$Impl_$.blit = function(src,srcPos,dest,destPos,len) { + if(src == dest) { + if(srcPos < destPos) { + var i = srcPos + len; + var j = destPos + len; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var k = _g1++; + --i; + --j; + src[j] = src[i]; + } + } else if(srcPos > destPos) { + var i1 = srcPos; + var j1 = destPos; + var _g11 = 0; + var _g2 = len; + while(_g11 < _g2) { + var k1 = _g11++; + src[j1] = src[i1]; + ++i1; + ++j1; + } + } + } else { + var _g12 = 0; + var _g3 = len; + while(_g12 < _g3) { + var i2 = _g12++; + dest[destPos + i2] = src[srcPos + i2]; + } + } +}; +var haxe_io_BytesBuffer = function() { + this.b = []; +}; +$hxClasses["haxe.io.BytesBuffer"] = haxe_io_BytesBuffer; +haxe_io_BytesBuffer.__name__ = ["haxe","io","BytesBuffer"]; +haxe_io_BytesBuffer.prototype = { + b: null + ,addByte: function($byte) { + this.b.push($byte); + } + ,addBytes: function(src,pos,len) { + if(pos < 0 || len < 0 || pos + len > src.length) { + throw new js__$Boot_HaxeError(haxe_io_Error.OutsideBounds); + } + var b1 = this.b; + var b2 = src.b; + var _g1 = pos; + var _g = pos + len; + while(_g1 < _g) { + var i = _g1++; + this.b.push(b2[i]); + } + } + ,getBytes: function() { + var bytes = new haxe_io_Bytes(new Uint8Array(this.b).buffer); + this.b = null; + return bytes; + } + ,__class__: haxe_io_BytesBuffer +}; +var haxe_io_Input = function() { }; +$hxClasses["haxe.io.Input"] = haxe_io_Input; +haxe_io_Input.__name__ = ["haxe","io","Input"]; +haxe_io_Input.prototype = { + bigEndian: null + ,readByte: function() { + throw new js__$Boot_HaxeError("Not implemented"); + } + ,readBytes: function(s,pos,len) { + var k = len; + var b = s.b; + if(pos < 0 || len < 0 || pos + len > s.length) { + throw new js__$Boot_HaxeError(haxe_io_Error.OutsideBounds); + } + try { + while(k > 0) { + b[pos] = this.readByte(); + ++pos; + --k; + } + } catch( eof ) { + haxe_CallStack.lastException = eof; + if (eof instanceof js__$Boot_HaxeError) eof = eof.val; + if( js_Boot.__instanceof(eof,haxe_io_Eof) ) { + } else throw(eof); + } + return len - k; + } + ,close: function() { + } + ,readFullBytes: function(s,pos,len) { + while(len > 0) { + var k = this.readBytes(s,pos,len); + if(k == 0) { + throw new js__$Boot_HaxeError(haxe_io_Error.Blocked); + } + pos += k; + len -= k; + } + } + ,read: function(nbytes) { + var s = haxe_io_Bytes.alloc(nbytes); + var p = 0; + while(nbytes > 0) { + var k = this.readBytes(s,p,nbytes); + if(k == 0) { + throw new js__$Boot_HaxeError(haxe_io_Error.Blocked); + } + p += k; + nbytes -= k; + } + return s; + } + ,readUntil: function(end) { + var buf = new haxe_io_BytesBuffer(); + var last; + while(true) { + last = this.readByte(); + if(!(last != end)) { + break; + } + buf.addByte(last); + } + return buf.getBytes().toString(); + } + ,readFloat: function() { + return haxe_io_FPHelper.i32ToFloat(this.readInt32()); + } + ,readInt8: function() { + var n = this.readByte(); + if(n >= 128) { + return n - 256; + } + return n; + } + ,readInt16: function() { + var ch1 = this.readByte(); + var ch2 = this.readByte(); + var n = this.bigEndian ? ch2 | ch1 << 8 : ch1 | ch2 << 8; + if((n & 32768) != 0) { + return n - 65536; + } + return n; + } + ,readUInt16: function() { + var ch1 = this.readByte(); + var ch2 = this.readByte(); + if(this.bigEndian) { + return ch2 | ch1 << 8; + } else { + return ch1 | ch2 << 8; + } + } + ,readUInt24: function() { + var ch1 = this.readByte(); + var ch2 = this.readByte(); + var ch3 = this.readByte(); + if(this.bigEndian) { + return ch3 | ch2 << 8 | ch1 << 16; + } else { + return ch1 | ch2 << 8 | ch3 << 16; + } + } + ,readInt32: function() { + var ch1 = this.readByte(); + var ch2 = this.readByte(); + var ch3 = this.readByte(); + var ch4 = this.readByte(); + if(this.bigEndian) { + return ch4 | ch3 << 8 | ch2 << 16 | ch1 << 24; + } else { + return ch1 | ch2 << 8 | ch3 << 16 | ch4 << 24; + } + } + ,readString: function(len) { + var b = haxe_io_Bytes.alloc(len); + this.readFullBytes(b,0,len); + return b.toString(); + } + ,__class__: haxe_io_Input +}; +var haxe_io_BytesInput = function(b,pos,len) { + if(pos == null) { + pos = 0; + } + if(len == null) { + len = b.length - pos; + } + if(pos < 0 || len < 0 || pos + len > b.length) { + throw new js__$Boot_HaxeError(haxe_io_Error.OutsideBounds); + } + this.b = b.b; + this.pos = pos; + this.len = len; + this.totlen = len; +}; +$hxClasses["haxe.io.BytesInput"] = haxe_io_BytesInput; +haxe_io_BytesInput.__name__ = ["haxe","io","BytesInput"]; +haxe_io_BytesInput.__super__ = haxe_io_Input; +haxe_io_BytesInput.prototype = $extend(haxe_io_Input.prototype,{ + b: null + ,pos: null + ,len: null + ,totlen: null + ,readByte: function() { + if(this.len == 0) { + throw new js__$Boot_HaxeError(new haxe_io_Eof()); + } + this.len--; + return this.b[this.pos++]; + } + ,readBytes: function(buf,pos,len) { + if(pos < 0 || len < 0 || pos + len > buf.length) { + throw new js__$Boot_HaxeError(haxe_io_Error.OutsideBounds); + } + if(this.len == 0 && len > 0) { + throw new js__$Boot_HaxeError(new haxe_io_Eof()); + } + if(this.len < len) { + len = this.len; + } + var b1 = this.b; + var b2 = buf.b; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + b2[pos + i] = b1[this.pos + i]; + } + this.pos += len; + this.len -= len; + return len; + } + ,__class__: haxe_io_BytesInput +}); +var haxe_io_Output = function() { }; +$hxClasses["haxe.io.Output"] = haxe_io_Output; +haxe_io_Output.__name__ = ["haxe","io","Output"]; +haxe_io_Output.prototype = { + bigEndian: null + ,writeByte: function(c) { + throw new js__$Boot_HaxeError("Not implemented"); + } + ,writeBytes: function(s,pos,len) { + if(pos < 0 || len < 0 || pos + len > s.length) { + throw new js__$Boot_HaxeError(haxe_io_Error.OutsideBounds); + } + var b = s.b; + var k = len; + while(k > 0) { + this.writeByte(b[pos]); + ++pos; + --k; + } + return len; + } + ,flush: function() { + } + ,close: function() { + } + ,writeFullBytes: function(s,pos,len) { + while(len > 0) { + var k = this.writeBytes(s,pos,len); + pos += k; + len -= k; + } + } + ,writeFloat: function(x) { + this.writeInt32(haxe_io_FPHelper.floatToI32(x)); + } + ,writeInt8: function(x) { + if(x < -128 || x >= 128) { + throw new js__$Boot_HaxeError(haxe_io_Error.Overflow); + } + this.writeByte(x & 255); + } + ,writeInt16: function(x) { + if(x < -32768 || x >= 32768) { + throw new js__$Boot_HaxeError(haxe_io_Error.Overflow); + } + this.writeUInt16(x & 65535); + } + ,writeUInt16: function(x) { + if(x < 0 || x >= 65536) { + throw new js__$Boot_HaxeError(haxe_io_Error.Overflow); + } + if(this.bigEndian) { + this.writeByte(x >> 8); + this.writeByte(x & 255); + } else { + this.writeByte(x & 255); + this.writeByte(x >> 8); + } + } + ,writeUInt24: function(x) { + if(x < 0 || x >= 16777216) { + throw new js__$Boot_HaxeError(haxe_io_Error.Overflow); + } + if(this.bigEndian) { + this.writeByte(x >> 16); + this.writeByte(x >> 8 & 255); + this.writeByte(x & 255); + } else { + this.writeByte(x & 255); + this.writeByte(x >> 8 & 255); + this.writeByte(x >> 16); + } + } + ,writeInt32: function(x) { + if(this.bigEndian) { + this.writeByte(x >>> 24); + this.writeByte(x >> 16 & 255); + this.writeByte(x >> 8 & 255); + this.writeByte(x & 255); + } else { + this.writeByte(x & 255); + this.writeByte(x >> 8 & 255); + this.writeByte(x >> 16 & 255); + this.writeByte(x >>> 24); + } + } + ,__class__: haxe_io_Output +}; +var haxe_io_BytesOutput = function() { + this.b = new haxe_io_BytesBuffer(); +}; +$hxClasses["haxe.io.BytesOutput"] = haxe_io_BytesOutput; +haxe_io_BytesOutput.__name__ = ["haxe","io","BytesOutput"]; +haxe_io_BytesOutput.__super__ = haxe_io_Output; +haxe_io_BytesOutput.prototype = $extend(haxe_io_Output.prototype,{ + b: null + ,writeByte: function(c) { + this.b.addByte(c); + } + ,writeBytes: function(buf,pos,len) { + this.b.addBytes(buf,pos,len); + return len; + } + ,getBytes: function() { + return this.b.getBytes(); + } + ,__class__: haxe_io_BytesOutput +}); +var haxe_io_Eof = function() { +}; +$hxClasses["haxe.io.Eof"] = haxe_io_Eof; +haxe_io_Eof.__name__ = ["haxe","io","Eof"]; +haxe_io_Eof.prototype = { + toString: function() { + return "Eof"; + } + ,__class__: haxe_io_Eof +}; +var haxe_io_Error = $hxClasses["haxe.io.Error"] = { __ename__ : ["haxe","io","Error"], __constructs__ : ["Blocked","Overflow","OutsideBounds","Custom"] }; +haxe_io_Error.Blocked = ["Blocked",0]; +haxe_io_Error.Blocked.toString = $estr; +haxe_io_Error.Blocked.__enum__ = haxe_io_Error; +haxe_io_Error.Overflow = ["Overflow",1]; +haxe_io_Error.Overflow.toString = $estr; +haxe_io_Error.Overflow.__enum__ = haxe_io_Error; +haxe_io_Error.OutsideBounds = ["OutsideBounds",2]; +haxe_io_Error.OutsideBounds.toString = $estr; +haxe_io_Error.OutsideBounds.__enum__ = haxe_io_Error; +haxe_io_Error.Custom = function(e) { var $x = ["Custom",3,e]; $x.__enum__ = haxe_io_Error; $x.toString = $estr; return $x; }; +var haxe_io_FPHelper = function() { }; +$hxClasses["haxe.io.FPHelper"] = haxe_io_FPHelper; +haxe_io_FPHelper.__name__ = ["haxe","io","FPHelper"]; +haxe_io_FPHelper.i32ToFloat = function(i) { + var sign = 1 - (i >>> 31 << 1); + var exp = i >>> 23 & 255; + var sig = i & 8388607; + if(sig == 0 && exp == 0) { + return 0.0; + } + return sign * (1 + Math.pow(2,-23) * sig) * Math.pow(2,exp - 127); +}; +haxe_io_FPHelper.floatToI32 = function(f) { + if(f == 0) { + return 0; + } + var af = f < 0 ? -f : f; + var exp = Math.floor(Math.log(af) / 0.6931471805599453); + if(exp < -127) { + exp = -127; + } else if(exp > 128) { + exp = 128; + } + var sig = Math.round((af / Math.pow(2,exp) - 1) * 8388608); + if(sig == 8388608 && exp < 128) { + sig = 0; + ++exp; + } + return (f < 0 ? -2147483648 : 0) | exp + 127 << 23 | sig; +}; +haxe_io_FPHelper.i64ToDouble = function(low,high) { + var sign = 1 - (high >>> 31 << 1); + var exp = (high >> 20 & 2047) - 1023; + var sig = (high & 1048575) * 4294967296. + (low >>> 31) * 2147483648. + (low & 2147483647); + if(sig == 0 && exp == -1023) { + return 0.0; + } + return sign * (1.0 + Math.pow(2,-52) * sig) * Math.pow(2,exp); +}; +haxe_io_FPHelper.doubleToI64 = function(v) { + var i64 = haxe_io_FPHelper.i64tmp; + if(v == 0) { + i64.low = 0; + i64.high = 0; + } else if(!isFinite(v)) { + if(v > 0) { + i64.low = 0; + i64.high = 2146435072; + } else { + i64.low = 0; + i64.high = -1048576; + } + } else { + var av = v < 0 ? -v : v; + var exp = Math.floor(Math.log(av) / 0.6931471805599453); + var sig = Math.round((av / Math.pow(2,exp) - 1) * 4503599627370496.); + var sig_l = Std["int"](sig); + var sig_h = Std["int"](sig / 4294967296.0); + i64.low = sig_l; + i64.high = (v < 0 ? -2147483648 : 0) | exp + 1023 << 20 | sig_h; + } + return i64; +}; +var haxe_io_Path = function(path) { + switch(path) { + case ".":case "..": + this.dir = path; + this.file = ""; + return; + } + var c1 = path.lastIndexOf("/"); + var c2 = path.lastIndexOf("\\"); + if(c1 < c2) { + this.dir = HxOverrides.substr(path,0,c2); + path = HxOverrides.substr(path,c2 + 1,null); + this.backslash = true; + } else if(c2 < c1) { + this.dir = HxOverrides.substr(path,0,c1); + path = HxOverrides.substr(path,c1 + 1,null); + } else { + this.dir = null; + } + var cp = path.lastIndexOf("."); + if(cp != -1) { + this.ext = HxOverrides.substr(path,cp + 1,null); + this.file = HxOverrides.substr(path,0,cp); + } else { + this.ext = null; + this.file = path; + } +}; +$hxClasses["haxe.io.Path"] = haxe_io_Path; +haxe_io_Path.__name__ = ["haxe","io","Path"]; +haxe_io_Path.withoutExtension = function(path) { + var s = new haxe_io_Path(path); + s.ext = null; + return s.toString(); +}; +haxe_io_Path.prototype = { + dir: null + ,file: null + ,ext: null + ,backslash: null + ,toString: function() { + return (this.dir == null ? "" : this.dir + (this.backslash ? "\\" : "/")) + this.file + (this.ext == null ? "" : "." + this.ext); + } + ,__class__: haxe_io_Path +}; +var haxe_io_StringInput = function(s) { + haxe_io_BytesInput.call(this,haxe_io_Bytes.ofString(s)); +}; +$hxClasses["haxe.io.StringInput"] = haxe_io_StringInput; +haxe_io_StringInput.__name__ = ["haxe","io","StringInput"]; +haxe_io_StringInput.__super__ = haxe_io_BytesInput; +haxe_io_StringInput.prototype = $extend(haxe_io_BytesInput.prototype,{ + __class__: haxe_io_StringInput +}); +var haxe_xml_XmlParserException = function(message,xml,position) { + this.xml = xml; + this.message = message; + this.position = position; + this.lineNumber = 1; + this.positionAtLine = 0; + var _g1 = 0; + var _g = position; + while(_g1 < _g) { + var i = _g1++; + var c = StringTools.fastCodeAt(xml,i); + if(c == 10) { + this.lineNumber++; + this.positionAtLine = 0; + } else if(c != 13) { + this.positionAtLine++; + } + } +}; +$hxClasses["haxe.xml.XmlParserException"] = haxe_xml_XmlParserException; +haxe_xml_XmlParserException.__name__ = ["haxe","xml","XmlParserException"]; +haxe_xml_XmlParserException.prototype = { + message: null + ,lineNumber: null + ,positionAtLine: null + ,position: null + ,xml: null + ,toString: function() { + return Type.getClassName(Type.getClass(this)) + ": " + this.message + " at line " + this.lineNumber + " char " + this.positionAtLine; + } + ,__class__: haxe_xml_XmlParserException +}; +var haxe_xml_Parser = function() { }; +$hxClasses["haxe.xml.Parser"] = haxe_xml_Parser; +haxe_xml_Parser.__name__ = ["haxe","xml","Parser"]; +haxe_xml_Parser.parse = function(str,strict) { + if(strict == null) { + strict = false; + } + var doc = Xml.createDocument(); + haxe_xml_Parser.doParse(str,strict,0,doc); + return doc; +}; +haxe_xml_Parser.doParse = function(str,strict,p,parent) { + if(p == null) { + p = 0; + } + var xml = null; + var state = 1; + var next = 1; + var aname = null; + var start = 0; + var nsubs = 0; + var nbrackets = 0; + var c = StringTools.fastCodeAt(str,p); + var buf = new StringBuf(); + var escapeNext = 1; + var attrValQuote = -1; + while(!StringTools.isEof(c)) { + switch(state) { + case 0: + switch(c) { + case 9:case 10:case 13:case 32: + break; + default: + state = next; + continue; + } + break; + case 1: + if(c == 60) { + state = 0; + next = 2; + } else { + start = p; + state = 13; + continue; + } + break; + case 2: + switch(c) { + case 33: + if(StringTools.fastCodeAt(str,p + 1) == 91) { + p += 2; + if(HxOverrides.substr(str,p,6).toUpperCase() != "CDATA[") { + throw new js__$Boot_HaxeError(new haxe_xml_XmlParserException("Expected ",str,p)); + } + state = 0; + next = 12; + continue; + } + break; + case 11: + if(c == 62) { + state = 1; + } else { + throw new js__$Boot_HaxeError(new haxe_xml_XmlParserException("Expected >",str,p)); + } + break; + case 12: + if(c == 62) { + if(nsubs == 0) { + parent.addChild(Xml.createPCData("")); + } + return p; + } else { + throw new js__$Boot_HaxeError(new haxe_xml_XmlParserException("Expected >",str,p)); + } + break; + case 13: + if(c == 60) { + buf.addSub(str,start,p - start); + var child = Xml.createPCData(buf.toString()); + buf = new StringBuf(); + parent.addChild(child); + ++nsubs; + state = 0; + next = 2; + } else if(c == 38) { + buf.addSub(str,start,p - start); + state = 18; + escapeNext = 13; + start = p + 1; + } + break; + case 14: + if(c == 63 && StringTools.fastCodeAt(str,p + 1) == 62) { + ++p; + var str1 = HxOverrides.substr(str,start + 1,p - start - 2); + parent.addChild(Xml.createProcessingInstruction(str1)); + ++nsubs; + state = 1; + } + break; + case 15: + if(c == 45 && StringTools.fastCodeAt(str,p + 1) == 45 && StringTools.fastCodeAt(str,p + 2) == 62) { + parent.addChild(Xml.createComment(HxOverrides.substr(str,start,p - start))); + ++nsubs; + p += 2; + state = 1; + } + break; + case 16: + if(c == 91) { + ++nbrackets; + } else if(c == 93) { + --nbrackets; + } else if(c == 62 && nbrackets == 0) { + parent.addChild(Xml.createDocType(HxOverrides.substr(str,start,p - start))); + ++nsubs; + state = 1; + } + break; + case 17: + if(c == 93 && StringTools.fastCodeAt(str,p + 1) == 93 && StringTools.fastCodeAt(str,p + 2) == 62) { + var child1 = Xml.createCData(HxOverrides.substr(str,start,p - start)); + parent.addChild(child1); + ++nsubs; + p += 2; + state = 1; + } + break; + case 18: + if(c == 59) { + var s = HxOverrides.substr(str,start,p - start); + if(StringTools.fastCodeAt(s,0) == 35) { + var c1 = StringTools.fastCodeAt(s,1) == 120 ? Std.parseInt("0" + HxOverrides.substr(s,1,s.length - 1)) : Std.parseInt(HxOverrides.substr(s,1,s.length - 1)); + buf.addChar(c1); + } else if(!haxe_xml_Parser.escapes.exists(s)) { + if(strict) { + throw new js__$Boot_HaxeError(new haxe_xml_XmlParserException("Undefined entity: " + s,str,p)); + } + buf.add("&" + s + ";"); + } else { + buf.add(haxe_xml_Parser.escapes.get(s)); + } + start = p + 1; + state = escapeNext; + } else if(!haxe_xml_Parser.isValidChar(c) && c != 35) { + if(strict) { + throw new js__$Boot_HaxeError(new haxe_xml_XmlParserException("Invalid character in entity: " + String.fromCharCode(c),str,p)); + } + buf.addChar(38); + buf.addSub(str,start,p - start); + start = p--; + state = escapeNext; + } + break; + } + c = StringTools.fastCodeAt(str,++p); + } + if(state == 1) { + start = p; + state = 13; + } + if(state == 13) { + if(p != start || nsubs == 0) { + buf.addSub(str,start,p - start); + parent.addChild(Xml.createPCData(buf.toString())); + ++nsubs; + } + return p; + } + if(!strict && state == 18 && escapeNext == 13) { + buf.addChar(38); + buf.addSub(str,start,p - start); + parent.addChild(Xml.createPCData(buf.toString())); + ++nsubs; + return p; + } + throw new js__$Boot_HaxeError(new haxe_xml_XmlParserException("Unexpected end",str,p)); +}; +haxe_xml_Parser.isValidChar = function(c) { + if(!(c >= 97 && c <= 122 || c >= 65 && c <= 90 || c >= 48 && c <= 57 || c == 58 || c == 46 || c == 95)) { + return c == 45; + } else { + return true; + } +}; +var haxe_xml_Printer = function(pretty) { + this.output = new StringBuf(); + this.pretty = pretty; +}; +$hxClasses["haxe.xml.Printer"] = haxe_xml_Printer; +haxe_xml_Printer.__name__ = ["haxe","xml","Printer"]; +haxe_xml_Printer.print = function(xml,pretty) { + if(pretty == null) { + pretty = false; + } + var printer = new haxe_xml_Printer(pretty); + printer.writeNode(xml,""); + return printer.output.toString(); +}; +haxe_xml_Printer.prototype = { + output: null + ,pretty: null + ,writeNode: function(value,tabs) { + var _g = value.nodeType; + switch(_g) { + case 0: + this.write(tabs + "<"); + this.write(value.get_nodeName()); + var attribute = value.attributes(); + while(attribute.hasNext()) { + var attribute1 = attribute.next(); + this.write(" " + attribute1 + "=\""); + this.write(StringTools.htmlEscape(value.get(attribute1),true)); + this.write("\""); + } + if(this.hasChildren(value)) { + this.write(">"); + this.newline(); + var child = value.iterator(); + while(child.hasNext()) { + var child1 = child.next(); + this.writeNode(child1,this.pretty ? tabs + "\t" : tabs); + } + this.write(tabs + ""); + this.newline(); + } else { + this.write("/>"); + this.newline(); + } + break; + case 1: + var nodeValue = value.get_nodeValue(); + if(nodeValue.length != 0) { + this.write(tabs + StringTools.htmlEscape(nodeValue)); + this.newline(); + } + break; + case 2: + this.write(tabs + ""); + this.newline(); + break; + case 3: + var commentContent = value.get_nodeValue(); + commentContent = new EReg("[\n\r\t]+","g").replace(commentContent,""); + commentContent = ""; + this.write(tabs); + this.write(StringTools.trim(commentContent)); + this.newline(); + break; + case 4: + this.write(""); + this.newline(); + break; + case 5: + this.write(""); + this.newline(); + break; + case 6: + var child2 = value.iterator(); + while(child2.hasNext()) { + var child3 = child2.next(); + this.writeNode(child3,tabs); + } + break; + } + } + ,write: function(input) { + this.output.add(input); + } + ,newline: function() { + if(this.pretty) { + this.output.add("\n"); + } + } + ,hasChildren: function(value) { + var child = value.iterator(); + while(child.hasNext()) { + var child1 = child.next(); + var _g = child1.nodeType; + switch(_g) { + case 0:case 1: + return true; + case 2:case 3: + if(StringTools.ltrim(child1.get_nodeValue()).length != 0) { + return true; + } + break; + default: + } + } + return false; + } + ,__class__: haxe_xml_Printer +}; +var hscript_Const = $hxClasses["hscript.Const"] = { __ename__ : ["hscript","Const"], __constructs__ : ["CInt","CFloat","CString"] }; +hscript_Const.CInt = function(v) { var $x = ["CInt",0,v]; $x.__enum__ = hscript_Const; $x.toString = $estr; return $x; }; +hscript_Const.CFloat = function(f) { var $x = ["CFloat",1,f]; $x.__enum__ = hscript_Const; $x.toString = $estr; return $x; }; +hscript_Const.CString = function(s) { var $x = ["CString",2,s]; $x.__enum__ = hscript_Const; $x.toString = $estr; return $x; }; +var hscript_Expr = $hxClasses["hscript.Expr"] = { __ename__ : ["hscript","Expr"], __constructs__ : ["EConst","EIdent","EVar","EParent","EBlock","EField","EBinop","EUnop","ECall","EIf","EWhile","EFor","EBreak","EContinue","EFunction","EReturn","EArray","EArrayDecl","ENew","EThrow","ETry","EObject","ETernary","ESwitch","EDoWhile","EMeta","ECheckType"] }; +hscript_Expr.EConst = function(c) { var $x = ["EConst",0,c]; $x.__enum__ = hscript_Expr; $x.toString = $estr; return $x; }; +hscript_Expr.EIdent = function(v) { var $x = ["EIdent",1,v]; $x.__enum__ = hscript_Expr; $x.toString = $estr; return $x; }; +hscript_Expr.EVar = function(n,t,e) { var $x = ["EVar",2,n,t,e]; $x.__enum__ = hscript_Expr; $x.toString = $estr; return $x; }; +hscript_Expr.EParent = function(e) { var $x = ["EParent",3,e]; $x.__enum__ = hscript_Expr; $x.toString = $estr; return $x; }; +hscript_Expr.EBlock = function(e) { var $x = ["EBlock",4,e]; $x.__enum__ = hscript_Expr; $x.toString = $estr; return $x; }; +hscript_Expr.EField = function(e,f) { var $x = ["EField",5,e,f]; $x.__enum__ = hscript_Expr; $x.toString = $estr; return $x; }; +hscript_Expr.EBinop = function(op,e1,e2) { var $x = ["EBinop",6,op,e1,e2]; $x.__enum__ = hscript_Expr; $x.toString = $estr; return $x; }; +hscript_Expr.EUnop = function(op,prefix,e) { var $x = ["EUnop",7,op,prefix,e]; $x.__enum__ = hscript_Expr; $x.toString = $estr; return $x; }; +hscript_Expr.ECall = function(e,params) { var $x = ["ECall",8,e,params]; $x.__enum__ = hscript_Expr; $x.toString = $estr; return $x; }; +hscript_Expr.EIf = function(cond,e1,e2) { var $x = ["EIf",9,cond,e1,e2]; $x.__enum__ = hscript_Expr; $x.toString = $estr; return $x; }; +hscript_Expr.EWhile = function(cond,e) { var $x = ["EWhile",10,cond,e]; $x.__enum__ = hscript_Expr; $x.toString = $estr; return $x; }; +hscript_Expr.EFor = function(v,it,e) { var $x = ["EFor",11,v,it,e]; $x.__enum__ = hscript_Expr; $x.toString = $estr; return $x; }; +hscript_Expr.EBreak = ["EBreak",12]; +hscript_Expr.EBreak.toString = $estr; +hscript_Expr.EBreak.__enum__ = hscript_Expr; +hscript_Expr.EContinue = ["EContinue",13]; +hscript_Expr.EContinue.toString = $estr; +hscript_Expr.EContinue.__enum__ = hscript_Expr; +hscript_Expr.EFunction = function(args,e,name,ret) { var $x = ["EFunction",14,args,e,name,ret]; $x.__enum__ = hscript_Expr; $x.toString = $estr; return $x; }; +hscript_Expr.EReturn = function(e) { var $x = ["EReturn",15,e]; $x.__enum__ = hscript_Expr; $x.toString = $estr; return $x; }; +hscript_Expr.EArray = function(e,index) { var $x = ["EArray",16,e,index]; $x.__enum__ = hscript_Expr; $x.toString = $estr; return $x; }; +hscript_Expr.EArrayDecl = function(e) { var $x = ["EArrayDecl",17,e]; $x.__enum__ = hscript_Expr; $x.toString = $estr; return $x; }; +hscript_Expr.ENew = function(cl,params) { var $x = ["ENew",18,cl,params]; $x.__enum__ = hscript_Expr; $x.toString = $estr; return $x; }; +hscript_Expr.EThrow = function(e) { var $x = ["EThrow",19,e]; $x.__enum__ = hscript_Expr; $x.toString = $estr; return $x; }; +hscript_Expr.ETry = function(e,v,t,ecatch) { var $x = ["ETry",20,e,v,t,ecatch]; $x.__enum__ = hscript_Expr; $x.toString = $estr; return $x; }; +hscript_Expr.EObject = function(fl) { var $x = ["EObject",21,fl]; $x.__enum__ = hscript_Expr; $x.toString = $estr; return $x; }; +hscript_Expr.ETernary = function(cond,e1,e2) { var $x = ["ETernary",22,cond,e1,e2]; $x.__enum__ = hscript_Expr; $x.toString = $estr; return $x; }; +hscript_Expr.ESwitch = function(e,cases,defaultExpr) { var $x = ["ESwitch",23,e,cases,defaultExpr]; $x.__enum__ = hscript_Expr; $x.toString = $estr; return $x; }; +hscript_Expr.EDoWhile = function(cond,e) { var $x = ["EDoWhile",24,cond,e]; $x.__enum__ = hscript_Expr; $x.toString = $estr; return $x; }; +hscript_Expr.EMeta = function(name,args,e) { var $x = ["EMeta",25,name,args,e]; $x.__enum__ = hscript_Expr; $x.toString = $estr; return $x; }; +hscript_Expr.ECheckType = function(e,t) { var $x = ["ECheckType",26,e,t]; $x.__enum__ = hscript_Expr; $x.toString = $estr; return $x; }; +var hscript_CType = $hxClasses["hscript.CType"] = { __ename__ : ["hscript","CType"], __constructs__ : ["CTPath","CTFun","CTAnon","CTParent","CTOpt","CTNamed"] }; +hscript_CType.CTPath = function(path,params) { var $x = ["CTPath",0,path,params]; $x.__enum__ = hscript_CType; $x.toString = $estr; return $x; }; +hscript_CType.CTFun = function(args,ret) { var $x = ["CTFun",1,args,ret]; $x.__enum__ = hscript_CType; $x.toString = $estr; return $x; }; +hscript_CType.CTAnon = function(fields) { var $x = ["CTAnon",2,fields]; $x.__enum__ = hscript_CType; $x.toString = $estr; return $x; }; +hscript_CType.CTParent = function(t) { var $x = ["CTParent",3,t]; $x.__enum__ = hscript_CType; $x.toString = $estr; return $x; }; +hscript_CType.CTOpt = function(t) { var $x = ["CTOpt",4,t]; $x.__enum__ = hscript_CType; $x.toString = $estr; return $x; }; +hscript_CType.CTNamed = function(n,t) { var $x = ["CTNamed",5,n,t]; $x.__enum__ = hscript_CType; $x.toString = $estr; return $x; }; +var hscript_Error = $hxClasses["hscript.Error"] = { __ename__ : ["hscript","Error"], __constructs__ : ["EInvalidChar","EUnexpected","EUnterminatedString","EUnterminatedComment","EInvalidPreprocessor","EUnknownVariable","EInvalidIterator","EInvalidOp","EInvalidAccess","ECustom"] }; +hscript_Error.EInvalidChar = function(c) { var $x = ["EInvalidChar",0,c]; $x.__enum__ = hscript_Error; $x.toString = $estr; return $x; }; +hscript_Error.EUnexpected = function(s) { var $x = ["EUnexpected",1,s]; $x.__enum__ = hscript_Error; $x.toString = $estr; return $x; }; +hscript_Error.EUnterminatedString = ["EUnterminatedString",2]; +hscript_Error.EUnterminatedString.toString = $estr; +hscript_Error.EUnterminatedString.__enum__ = hscript_Error; +hscript_Error.EUnterminatedComment = ["EUnterminatedComment",3]; +hscript_Error.EUnterminatedComment.toString = $estr; +hscript_Error.EUnterminatedComment.__enum__ = hscript_Error; +hscript_Error.EInvalidPreprocessor = function(msg) { var $x = ["EInvalidPreprocessor",4,msg]; $x.__enum__ = hscript_Error; $x.toString = $estr; return $x; }; +hscript_Error.EUnknownVariable = function(v) { var $x = ["EUnknownVariable",5,v]; $x.__enum__ = hscript_Error; $x.toString = $estr; return $x; }; +hscript_Error.EInvalidIterator = function(v) { var $x = ["EInvalidIterator",6,v]; $x.__enum__ = hscript_Error; $x.toString = $estr; return $x; }; +hscript_Error.EInvalidOp = function(op) { var $x = ["EInvalidOp",7,op]; $x.__enum__ = hscript_Error; $x.toString = $estr; return $x; }; +hscript_Error.EInvalidAccess = function(f) { var $x = ["EInvalidAccess",8,f]; $x.__enum__ = hscript_Error; $x.toString = $estr; return $x; }; +hscript_Error.ECustom = function(msg) { var $x = ["ECustom",9,msg]; $x.__enum__ = hscript_Error; $x.toString = $estr; return $x; }; +var hscript__$Interp_Stop = $hxClasses["hscript._Interp.Stop"] = { __ename__ : ["hscript","_Interp","Stop"], __constructs__ : ["SBreak","SContinue","SReturn"] }; +hscript__$Interp_Stop.SBreak = ["SBreak",0]; +hscript__$Interp_Stop.SBreak.toString = $estr; +hscript__$Interp_Stop.SBreak.__enum__ = hscript__$Interp_Stop; +hscript__$Interp_Stop.SContinue = ["SContinue",1]; +hscript__$Interp_Stop.SContinue.toString = $estr; +hscript__$Interp_Stop.SContinue.__enum__ = hscript__$Interp_Stop; +hscript__$Interp_Stop.SReturn = ["SReturn",2]; +hscript__$Interp_Stop.SReturn.toString = $estr; +hscript__$Interp_Stop.SReturn.__enum__ = hscript__$Interp_Stop; +var hscript_Interp = function(vars) { + var _gthis = this; + this.declared = []; + this.locals = new haxe_ds_StringMap(); + this.depth = 0; + if(vars == null) { + this.variables = new haxe_ds_StringMap(); + this.variables.set("null",null); + this.variables.set("true",true); + this.variables.set("false",false); + this.variables.set("trace",Reflect.makeVarArgs(function(el) { + var inf = _gthis.posInfos(); + var v = el.shift(); + if(el.length > 0) { + inf.customParams = el; + } + haxe_Log.trace(Std.string(v),inf); + })); + } else { + this.variables = vars; + } + this.initOps(); +}; +$hxClasses["hscript.Interp"] = hscript_Interp; +hscript_Interp.__name__ = ["hscript","Interp"]; +hscript_Interp.prototype = { + variables: null + ,locals: null + ,binops: null + ,depth: null + ,inTry: null + ,declared: null + ,returnValue: null + ,posInfos: function() { + return { fileName : "hscript", lineNumber : 0}; + } + ,initOps: function() { + var me = this; + this.binops = new haxe_ds_StringMap(); + this.binops.set("+",function(e1,e2) { + return me.expr(e1) + me.expr(e2); + }); + this.binops.set("-",function(e11,e21) { + return me.expr(e11) - me.expr(e21); + }); + this.binops.set("*",function(e12,e22) { + return me.expr(e12) * me.expr(e22); + }); + this.binops.set("/",function(e13,e23) { + return me.expr(e13) / me.expr(e23); + }); + this.binops.set("%",function(e14,e24) { + return me.expr(e14) % me.expr(e24); + }); + this.binops.set("&",function(e15,e25) { + return me.expr(e15) & me.expr(e25); + }); + this.binops.set("|",function(e16,e26) { + return me.expr(e16) | me.expr(e26); + }); + this.binops.set("^",function(e17,e27) { + return me.expr(e17) ^ me.expr(e27); + }); + this.binops.set("<<",function(e18,e28) { + return me.expr(e18) << me.expr(e28); + }); + this.binops.set(">>",function(e19,e29) { + return me.expr(e19) >> me.expr(e29); + }); + this.binops.set(">>>",function(e110,e210) { + return me.expr(e110) >>> me.expr(e210); + }); + this.binops.set("==",function(e111,e211) { + return me.expr(e111) == me.expr(e211); + }); + this.binops.set("!=",function(e112,e212) { + return me.expr(e112) != me.expr(e212); + }); + this.binops.set(">=",function(e113,e213) { + return me.expr(e113) >= me.expr(e213); + }); + this.binops.set("<=",function(e114,e214) { + return me.expr(e114) <= me.expr(e214); + }); + this.binops.set(">",function(e115,e215) { + return me.expr(e115) > me.expr(e215); + }); + this.binops.set("<",function(e116,e216) { + return me.expr(e116) < me.expr(e216); + }); + this.binops.set("||",function(e117,e217) { + if(me.expr(e117) != true) { + return me.expr(e217) == true; + } else { + return true; + } + }); + this.binops.set("&&",function(e118,e218) { + if(me.expr(e118) == true) { + return me.expr(e218) == true; + } else { + return false; + } + }); + this.binops.set("=",$bind(this,this.assign)); + this.binops.set("...",function(e119,e219) { + return new IntIterator(me.expr(e119),me.expr(e219)); + }); + this.assignOp("+=",function(v1,v2) { + return v1 + v2; + }); + this.assignOp("-=",function(v11,v21) { + return v11 - v21; + }); + this.assignOp("*=",function(v12,v22) { + return v12 * v22; + }); + this.assignOp("/=",function(v13,v23) { + return v13 / v23; + }); + this.assignOp("%=",function(v14,v24) { + return v14 % v24; + }); + this.assignOp("&=",function(v15,v25) { + return v15 & v25; + }); + this.assignOp("|=",function(v16,v26) { + return v16 | v26; + }); + this.assignOp("^=",function(v17,v27) { + return v17 ^ v27; + }); + this.assignOp("<<=",function(v18,v28) { + return v18 << v28; + }); + this.assignOp(">>=",function(v19,v29) { + return v19 >> v29; + }); + this.assignOp(">>>=",function(v110,v210) { + return v110 >>> v210; + }); + } + ,assign: function(e1,e2) { + var v = this.expr(e2); + var _g = hscript_Tools.expr(e1); + switch(Type.enumIndex(_g)) { + case 1: + var id = _g[2]; + var l = this.locals.get(id); + if(l == null) { + this.variables.set(id,v); + } else { + l.r = v; + } + break; + case 5: + var f = _g[3]; + var e = _g[2]; + v = this.set(this.expr(e),f,v); + break; + case 16: + var index = _g[3]; + var e3 = _g[2]; + var arr = this.expr(e3); + var index1 = this.expr(index); + if(this.isMap(arr)) { + this.setMapValue(arr,index1,v); + } else { + arr[index1] = v; + } + break; + default: + this.error(hscript_Error.EInvalidOp("=")); + } + return v; + } + ,assignOp: function(op,fop) { + var me = this; + this.binops.set(op,function(e1,e2) { + return me.evalAssignOp(op,fop,e1,e2); + }); + } + ,evalAssignOp: function(op,fop,e1,e2) { + var v; + var _g = hscript_Tools.expr(e1); + switch(Type.enumIndex(_g)) { + case 1: + var id = _g[2]; + var l = this.locals.get(id); + v = fop(this.expr(e1),this.expr(e2)); + if(l == null) { + this.variables.set(id,v); + } else { + l.r = v; + } + break; + case 5: + var f = _g[3]; + var e = _g[2]; + var obj = this.expr(e); + v = fop(this.get(obj,f),this.expr(e2)); + v = this.set(obj,f,v); + break; + case 16: + var index = _g[3]; + var e3 = _g[2]; + var arr = this.expr(e3); + var index1 = this.expr(index); + if(this.isMap(arr)) { + v = fop(this.getMapValue(arr,index1),this.expr(e2)); + this.setMapValue(arr,index1,v); + } else { + v = fop(arr[index1],this.expr(e2)); + arr[index1] = v; + } + break; + default: + return this.error(hscript_Error.EInvalidOp(op)); + } + return v; + } + ,increment: function(e,prefix,delta) { + switch(Type.enumIndex(e)) { + case 1: + var id = e[2]; + var l = this.locals.get(id); + var v = l == null ? this.variables.get(id) : l.r; + if(prefix) { + v += delta; + if(l == null) { + this.variables.set(id,v); + } else { + l.r = v; + } + } else if(l == null) { + this.variables.set(id,v + delta); + } else { + l.r = v + delta; + } + return v; + case 5: + var f = e[3]; + var e1 = e[2]; + var obj = this.expr(e1); + var v1 = this.get(obj,f); + if(prefix) { + v1 += delta; + this.set(obj,f,v1); + } else { + this.set(obj,f,v1 + delta); + } + return v1; + case 16: + var index = e[3]; + var e2 = e[2]; + var arr = this.expr(e2); + var index1 = this.expr(index); + if(this.isMap(arr)) { + var v2 = this.getMapValue(arr,index1); + if(prefix) { + v2 += delta; + this.setMapValue(arr,index1,v2); + } else { + this.setMapValue(arr,index1,v2 + delta); + } + return v2; + } else { + var v3 = arr[index1]; + if(prefix) { + v3 += delta; + arr[index1] = v3; + } else { + arr[index1] = v3 + delta; + } + return v3; + } + break; + default: + return this.error(hscript_Error.EInvalidOp(delta > 0 ? "++" : "--")); + } + } + ,execute: function(expr,_locals) { + var d = this.depth; + var old = this.declared.length; + var ret = null; + var l = this.locals; + this.depth = 0; + this.locals = _locals == null ? new haxe_ds_StringMap() : _locals; + try { + ret = this.exprReturn(expr); + } catch( e ) { + haxe_CallStack.lastException = e; + if (e instanceof js__$Boot_HaxeError) e = e.val; + this.restore(old); + this.locals = l; + this.depth = d; + throw js__$Boot_HaxeError.wrap(e); + } + this.restore(old); + this.locals = l; + this.depth = d; + return ret; + } + ,exprReturn: function(e) { + try { + return this.expr(e); + } catch( e1 ) { + haxe_CallStack.lastException = e1; + if (e1 instanceof js__$Boot_HaxeError) e1 = e1.val; + if( js_Boot.__instanceof(e1,hscript__$Interp_Stop) ) { + switch(Type.enumIndex(e1)) { + case 0: + throw new js__$Boot_HaxeError("Invalid break"); + break; + case 1: + throw new js__$Boot_HaxeError("Invalid continue"); + break; + case 2: + var v = this.returnValue; + this.returnValue = null; + return v; + } + } else throw(e1); + } + } + ,duplicate: function(h) { + var h2 = new haxe_ds_StringMap(); + var k = h.keys(); + while(k.hasNext()) { + var k1 = k.next(); + h2.set(k1,h.get(k1)); + } + return h2; + } + ,restore: function(old) { + while(this.declared.length > old) { + var d = this.declared.pop(); + this.locals.set(d.n,d.old); + } + } + ,error: function(e,rethrow) { + if(rethrow == null) { + rethrow = false; + } + if(rethrow) { + this.rethrow(e); + } else { + throw new js__$Boot_HaxeError(e); + } + return null; + } + ,rethrow: function(e) { + throw js__$Boot_HaxeError.wrap(e); + } + ,resolve: function(id) { + var l = this.locals.get(id); + if(l != null) { + return l.r; + } + var v = this.variables.get(id); + if(v == null && !this.variables.exists(id)) { + this.error(hscript_Error.EUnknownVariable(id)); + } + return v; + } + ,expr: function(e) { + var _gthis = this; + switch(Type.enumIndex(e)) { + case 0: + var c = e[2]; + switch(Type.enumIndex(c)) { + case 0: + var v = c[2]; + return v; + case 1: + var f = c[2]; + return f; + case 2: + var s = c[2]; + return s; + } + break; + case 1: + var id = e[2]; + return this.resolve(id); + case 2: + var e1 = e[4]; + var n = e[2]; + this.declared.push({ n : n, old : this.locals.get(n)}); + this.locals.set(n,{ r : e1 == null ? null : this.expr(e1)}); + return null; + case 3: + var e2 = e[2]; + return this.expr(e2); + case 4: + var exprs = e[2]; + var old = this.declared.length; + var v1 = null; + var _g = 0; + while(_g < exprs.length) { + var e3 = exprs[_g]; + ++_g; + v1 = this.expr(e3); + } + this.restore(old); + return v1; + case 5: + var f1 = e[3]; + var e4 = e[2]; + return this.get(this.expr(e4),f1); + case 6: + var e21 = e[4]; + var e11 = e[3]; + var op = e[2]; + var fop = this.binops.get(op); + if(fop == null) { + this.error(hscript_Error.EInvalidOp(op)); + } + return fop(e11,e21); + case 7: + var e5 = e[4]; + var prefix = e[3]; + var op1 = e[2]; + switch(op1) { + case "!": + return this.expr(e5) != true; + case "++": + return this.increment(e5,prefix,1); + case "-": + return -this.expr(e5); + case "--": + return this.increment(e5,prefix,-1); + case "~": + return ~this.expr(e5); + default: + this.error(hscript_Error.EInvalidOp(op1)); + } + break; + case 8: + var params = e[3]; + var e6 = e[2]; + var args = []; + var _g1 = 0; + while(_g1 < params.length) { + var p = params[_g1]; + ++_g1; + args.push(this.expr(p)); + } + var _g2 = hscript_Tools.expr(e6); + if(Type.enumIndex(_g2) == 5) { + var f2 = _g2[3]; + var e7 = _g2[2]; + var obj = this.expr(e7); + if(obj == null) { + this.error(hscript_Error.EInvalidAccess(f2)); + } + return this.fcall(obj,f2,args); + } else { + return this.call(null,this.expr(e6),args); + } + break; + case 9: + var e22 = e[4]; + var e12 = e[3]; + var econd = e[2]; + if(this.expr(econd) == true) { + return this.expr(e12); + } else if(e22 == null) { + return null; + } else { + return this.expr(e22); + } + break; + case 10: + var e8 = e[3]; + var econd1 = e[2]; + this.whileLoop(econd1,e8); + return null; + case 11: + var e9 = e[4]; + var it = e[3]; + var v2 = e[2]; + this.forLoop(v2,it,e9); + return null; + case 12: + throw new js__$Boot_HaxeError(hscript__$Interp_Stop.SBreak); + break; + case 13: + throw new js__$Boot_HaxeError(hscript__$Interp_Stop.SContinue); + break; + case 14: + var name = e[4]; + var fexpr = e[3]; + var params1 = e[2]; + var capturedLocals = this.duplicate(this.locals); + var capturedVars = this.variables; + var me = this; + var hasOpt = false; + var minParams = 0; + var _g3 = 0; + while(_g3 < params1.length) { + var p1 = params1[_g3]; + ++_g3; + if(p1.opt) { + hasOpt = true; + } else { + minParams += 1; + } + } + var f3 = function(args1) { + if(args1.length != params1.length) { + if(args1.length < minParams) { + var str = "Invalid number of parameters. Got " + args1.length + ", required " + minParams; + if(name != null) { + str += " for function '" + name + "'"; + } + throw new js__$Boot_HaxeError(str); + } + var args2 = []; + var extraParams = args1.length - minParams; + var pos = 0; + var _g4 = 0; + while(_g4 < params1.length) { + var p2 = params1[_g4]; + ++_g4; + if(p2.opt) { + if(extraParams > 0) { + args2.push(args1[pos++]); + --extraParams; + } else { + args2.push(null); + } + } else { + args2.push(args1[pos++]); + } + } + args1 = args2; + } + var old1 = me.locals; + var oldv = me.variables; + var depth = me.depth; + var odcl = me.declared.length; + me.depth++; + me.locals = me.duplicate(capturedLocals); + me.variables = capturedVars; + var _g11 = 0; + var _g5 = params1.length; + while(_g11 < _g5) { + var i = _g11++; + me.locals.set(params1[i].name,{ r : args1[i]}); + } + var r = null; + if(_gthis.inTry) { + try { + r = me.exprReturn(fexpr); + } catch( e10 ) { + haxe_CallStack.lastException = e10; + if (e10 instanceof js__$Boot_HaxeError) e10 = e10.val; + _gthis.restore(odcl); + me.locals = old1; + me.variables = oldv; + me.depth = depth; + throw js__$Boot_HaxeError.wrap(e10); + } + } else { + try { + r = me.exprReturn(fexpr); + } catch( e13 ) { + haxe_CallStack.lastException = e13; + if (e13 instanceof js__$Boot_HaxeError) e13 = e13.val; + com_fancyfish_faeng_common_Utils.printExceptionTrace(e13); + } + } + _gthis.restore(odcl); + me.locals = old1; + me.variables = oldv; + me.depth = depth; + return r; + }; + var f4 = Reflect.makeVarArgs(f3); + if(name != null) { + if(this.depth == 0) { + this.variables.set(name,f4); + } else { + var tmp = this.declared; + var tmp1 = this.locals.get(name); + tmp.push({ n : name, old : tmp1}); + var ref = { r : f4}; + this.locals.set(name,ref); + capturedLocals.set(name,ref); + } + } + return f4; + case 15: + var e14 = e[2]; + this.returnValue = e14 == null ? null : this.expr(e14); + throw new js__$Boot_HaxeError(hscript__$Interp_Stop.SReturn); + break; + case 16: + var index = e[3]; + var e15 = e[2]; + var arr = this.expr(e15); + var index1 = this.expr(index); + if(this.isMap(arr)) { + return this.getMapValue(arr,index1); + } else { + return arr[index1]; + } + break; + case 17: + var arr1 = e[2]; + var tmp2; + if(arr1.length > 0) { + var _g6 = hscript_Tools.expr(arr1[0]); + if(Type.enumIndex(_g6) == 6) { + if(_g6[2] == "=>") { + tmp2 = true; + } else { + tmp2 = false; + } + } else { + tmp2 = false; + } + } else { + tmp2 = false; + } + if(tmp2) { + var isAllString = true; + var isAllInt = true; + var isAllObject = true; + var isAllEnum = true; + var keys = []; + var values = []; + var _g12 = 0; + while(_g12 < arr1.length) { + var e16 = arr1[_g12]; + ++_g12; + var _g21 = hscript_Tools.expr(e16); + if(Type.enumIndex(_g21) == 6) { + if(_g21[2] == "=>") { + var eValue = _g21[4]; + var eKey = _g21[3]; + var key = this.expr(eKey); + var value = this.expr(eValue); + if(isAllString) { + isAllString = typeof(key) == "string"; + } else { + isAllString = false; + } + if(isAllInt) { + if(typeof(key) == "number") { + isAllInt = ((key | 0) === key); + } else { + isAllInt = false; + } + } else { + isAllInt = false; + } + if(isAllObject) { + isAllObject = Reflect.isObject(key); + } else { + isAllObject = false; + } + if(isAllEnum) { + isAllEnum = Reflect.isEnumValue(key); + } else { + isAllEnum = false; + } + keys.push(key); + values.push(value); + } else { + throw new js__$Boot_HaxeError("=> expected"); + } + } else { + throw new js__$Boot_HaxeError("=> expected"); + } + } + var map; + if(isAllInt) { + map = new haxe_ds_IntMap(); + } else if(isAllString) { + map = new haxe_ds_StringMap(); + } else if(isAllEnum) { + map = new haxe_ds_EnumValueMap(); + } else if(isAllObject) { + map = new haxe_ds_ObjectMap(); + } else { + throw new js__$Boot_HaxeError("Inconsistent key types"); + } + var _g22 = 0; + var _g13 = keys.length; + while(_g22 < _g13) { + var n1 = _g22++; + this.setMapValue(map,keys[n1],values[n1]); + } + return map; + } else { + var a = []; + var _g14 = 0; + while(_g14 < arr1.length) { + var e17 = arr1[_g14]; + ++_g14; + a.push(this.expr(e17)); + } + return a; + } + break; + case 18: + var params2 = e[3]; + var cl = e[2]; + var a1 = []; + var _g7 = 0; + while(_g7 < params2.length) { + var e18 = params2[_g7]; + ++_g7; + a1.push(this.expr(e18)); + } + return this.cnew(cl,a1); + case 19: + var e19 = e[2]; + throw js__$Boot_HaxeError.wrap(this.expr(e19)); + break; + case 20: + var ecatch = e[5]; + var n2 = e[3]; + var e20 = e[2]; + var old2 = this.declared.length; + var oldTry = this.inTry; + try { + this.inTry = true; + var v3 = this.expr(e20); + this.restore(old2); + this.inTry = oldTry; + return v3; + } catch( $e0 ) { + haxe_CallStack.lastException = $e0; + if ($e0 instanceof js__$Boot_HaxeError) $e0 = $e0.val; + if( js_Boot.__instanceof($e0,hscript__$Interp_Stop) ) { + var err = $e0; + this.inTry = oldTry; + throw new js__$Boot_HaxeError(err); + } else { + var err1 = $e0; + this.restore(old2); + this.inTry = oldTry; + this.declared.push({ n : n2, old : this.locals.get(n2)}); + this.locals.set(n2,{ r : err1}); + var v4 = this.expr(ecatch); + this.restore(old2); + return v4; + } + } + break; + case 21: + var fl = e[2]; + var o = { }; + var _g8 = 0; + while(_g8 < fl.length) { + var f5 = fl[_g8]; + ++_g8; + this.set(o,f5.name,this.expr(f5.e)); + } + return o; + case 22: + var e23 = e[4]; + var e110 = e[3]; + var econd2 = e[2]; + if(this.expr(econd2) == true) { + return this.expr(e110); + } else { + return this.expr(e23); + } + break; + case 23: + var def = e[4]; + var cases = e[3]; + var e24 = e[2]; + var val = this.expr(e24); + var match = false; + var _g9 = 0; + while(_g9 < cases.length) { + var c1 = cases[_g9]; + ++_g9; + var _g15 = 0; + var _g23 = c1.values; + while(_g15 < _g23.length) { + var v5 = _g23[_g15]; + ++_g15; + if(this.expr(v5) == val) { + match = true; + break; + } + } + if(match) { + val = this.expr(c1.expr); + break; + } + } + if(!match) { + if(def == null) { + val = null; + } else { + val = this.expr(def); + } + } + return val; + case 24: + var e25 = e[3]; + var econd3 = e[2]; + this.doWhileLoop(econd3,e25); + return null; + case 25: + var e26 = e[4]; + return this.expr(e26); + case 26: + var e27 = e[2]; + return this.expr(e27); + } + return null; + } + ,doWhileLoop: function(econd,e) { + var old = this.declared.length; + try { + while(true) { + try { + this.expr(e); + } catch( err ) { + haxe_CallStack.lastException = err; + if (err instanceof js__$Boot_HaxeError) err = err.val; + if( js_Boot.__instanceof(err,hscript__$Interp_Stop) ) { + switch(Type.enumIndex(err)) { + case 0: + throw "__break__"; + break; + case 1: + break; + case 2: + throw new js__$Boot_HaxeError(err); + break; + } + } else throw(err); + } + if(!(this.expr(econd) == true)) { + throw "__break__"; + } + } + } catch( e ) { if( e != "__break__" ) throw e; } + this.restore(old); + } + ,whileLoop: function(econd,e) { + var old = this.declared.length; + try { + while(this.expr(econd) == true) try { + this.expr(e); + } catch( err ) { + haxe_CallStack.lastException = err; + if (err instanceof js__$Boot_HaxeError) err = err.val; + if( js_Boot.__instanceof(err,hscript__$Interp_Stop) ) { + switch(Type.enumIndex(err)) { + case 0: + throw "__break__"; + break; + case 1: + break; + case 2: + throw new js__$Boot_HaxeError(err); + break; + } + } else throw(err); + } + } catch( e ) { if( e != "__break__" ) throw e; } + this.restore(old); + } + ,makeIterator: function(v) { + try { + v = $iterator(v)(); + } catch( e ) { + haxe_CallStack.lastException = e; + } + if(v.hasNext == null || v.next == null) { + this.error(hscript_Error.EInvalidIterator(v)); + } + return v; + } + ,forLoop: function(n,it,e) { + var old = this.declared.length; + this.declared.push({ n : n, old : this.locals.get(n)}); + var it1 = this.makeIterator(this.expr(it)); + try { + while(it1.hasNext()) { + this.locals.set(n,{ r : it1.next()}); + try { + this.expr(e); + } catch( err ) { + haxe_CallStack.lastException = err; + if (err instanceof js__$Boot_HaxeError) err = err.val; + if( js_Boot.__instanceof(err,hscript__$Interp_Stop) ) { + switch(Type.enumIndex(err)) { + case 0: + throw "__break__"; + break; + case 1: + break; + case 2: + throw new js__$Boot_HaxeError(err); + break; + } + } else throw(err); + } + } + } catch( e ) { if( e != "__break__" ) throw e; } + this.restore(old); + } + ,isMap: function(o) { + return Std["is"](o,haxe_IMap); + } + ,getMapValue: function(map,key) { + return (js_Boot.__cast(map , haxe_IMap)).get(key); + } + ,setMapValue: function(map,key,value) { + (js_Boot.__cast(map , haxe_IMap)).set(key,value); + } + ,get: function(o,f) { + if(o == null) { + this.error(hscript_Error.EInvalidAccess(f)); + } + if((o instanceof Array) && o.__enum__ == null) { + if(f == "iterator") { + return $iterator((js_Boot.__cast(o , Array))); + } else if(f == "insert") { + return function(pos,x) { + (js_Boot.__cast(o , Array)).splice(pos,0,x); + }; + } else if(f == "remove") { + return function(x1) { + return HxOverrides.remove(js_Boot.__cast(o , Array),x1); + }; + } else if(f == "copy") { + return function() { + return (js_Boot.__cast(o , Array)).slice(); + }; + } else { + return hscript_SafeReflect.getProperty(o,f); + } + } else { + return hscript_SafeReflect.getProperty(o,f); + } + } + ,set: function(o,f,v) { + if(o == null) { + this.error(hscript_Error.EInvalidAccess(f)); + } + hscript_SafeReflect.setProperty(o,f,v); + return v; + } + ,fcall: function(o,f,args) { + return this.call(o,this.get(o,f),args); + } + ,call: function(o,f,args) { + return Reflect.callMethod(o,f,args); + } + ,cnew: function(cl,args) { + if(cl.indexOf(".") != -1) { + return null; + } + var c = Type.resolveClass(cl); + if(c == null) { + c = this.resolve(cl); + } + return Type.createInstance(c,args); + } + ,__class__: hscript_Interp +}; +var hscript_SafeReflect = function() { }; +$hxClasses["hscript.SafeReflect"] = hscript_SafeReflect; +hscript_SafeReflect.__name__ = ["hscript","SafeReflect"]; +hscript_SafeReflect.escape = function(f) { + return StringTools.replace(StringTools.replace(StringTools.replace(f,"application","_app"),"window","_win"),"__","uu"); +}; +hscript_SafeReflect.hasField = function(o,field) { + return Reflect.hasField(o,hscript_SafeReflect.escape(field)); +}; +hscript_SafeReflect.field = function(o,field) { + return Reflect.field(o,hscript_SafeReflect.escape(field)); +}; +hscript_SafeReflect.setField = function(o,field,value) { + Reflect.setField(o,hscript_SafeReflect.escape(field),value); +}; +hscript_SafeReflect.getProperty = function(o,field) { + return Reflect.getProperty(o,hscript_SafeReflect.escape(field)); +}; +hscript_SafeReflect.setProperty = function(o,field,value) { + Reflect.setProperty(o,hscript_SafeReflect.escape(field),value); +}; +hscript_SafeReflect.fields = function(o) { + return Reflect.fields(o); +}; +var hscript_Token = $hxClasses["hscript.Token"] = { __ename__ : ["hscript","Token"], __constructs__ : ["TEof","TConst","TId","TOp","TPOpen","TPClose","TBrOpen","TBrClose","TDot","TComma","TSemicolon","TBkOpen","TBkClose","TQuestion","TDoubleDot","TMeta","TPrepro"] }; +hscript_Token.TEof = ["TEof",0]; +hscript_Token.TEof.toString = $estr; +hscript_Token.TEof.__enum__ = hscript_Token; +hscript_Token.TConst = function(c) { var $x = ["TConst",1,c]; $x.__enum__ = hscript_Token; $x.toString = $estr; return $x; }; +hscript_Token.TId = function(s) { var $x = ["TId",2,s]; $x.__enum__ = hscript_Token; $x.toString = $estr; return $x; }; +hscript_Token.TOp = function(s) { var $x = ["TOp",3,s]; $x.__enum__ = hscript_Token; $x.toString = $estr; return $x; }; +hscript_Token.TPOpen = ["TPOpen",4]; +hscript_Token.TPOpen.toString = $estr; +hscript_Token.TPOpen.__enum__ = hscript_Token; +hscript_Token.TPClose = ["TPClose",5]; +hscript_Token.TPClose.toString = $estr; +hscript_Token.TPClose.__enum__ = hscript_Token; +hscript_Token.TBrOpen = ["TBrOpen",6]; +hscript_Token.TBrOpen.toString = $estr; +hscript_Token.TBrOpen.__enum__ = hscript_Token; +hscript_Token.TBrClose = ["TBrClose",7]; +hscript_Token.TBrClose.toString = $estr; +hscript_Token.TBrClose.__enum__ = hscript_Token; +hscript_Token.TDot = ["TDot",8]; +hscript_Token.TDot.toString = $estr; +hscript_Token.TDot.__enum__ = hscript_Token; +hscript_Token.TComma = ["TComma",9]; +hscript_Token.TComma.toString = $estr; +hscript_Token.TComma.__enum__ = hscript_Token; +hscript_Token.TSemicolon = ["TSemicolon",10]; +hscript_Token.TSemicolon.toString = $estr; +hscript_Token.TSemicolon.__enum__ = hscript_Token; +hscript_Token.TBkOpen = ["TBkOpen",11]; +hscript_Token.TBkOpen.toString = $estr; +hscript_Token.TBkOpen.__enum__ = hscript_Token; +hscript_Token.TBkClose = ["TBkClose",12]; +hscript_Token.TBkClose.toString = $estr; +hscript_Token.TBkClose.__enum__ = hscript_Token; +hscript_Token.TQuestion = ["TQuestion",13]; +hscript_Token.TQuestion.toString = $estr; +hscript_Token.TQuestion.__enum__ = hscript_Token; +hscript_Token.TDoubleDot = ["TDoubleDot",14]; +hscript_Token.TDoubleDot.toString = $estr; +hscript_Token.TDoubleDot.__enum__ = hscript_Token; +hscript_Token.TMeta = function(s) { var $x = ["TMeta",15,s]; $x.__enum__ = hscript_Token; $x.toString = $estr; return $x; }; +hscript_Token.TPrepro = function(s) { var $x = ["TPrepro",16,s]; $x.__enum__ = hscript_Token; $x.toString = $estr; return $x; }; +var hscript_Parser = function() { + this.uid = 0; + this.preprocesorValues = new haxe_ds_StringMap(); + this.line = 1; + this.opChars = "+*/-=!><&|^%~"; + this.identChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_"; + var priorities = [["%"],["*","/"],["+","-"],["<<",">>",">>>"],["|","&","^"],["==","!=",">","<",">=","<="],["..."],["&&"],["||"],["=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","&=","^=","=>"]]; + this.opPriority = new haxe_ds_StringMap(); + this.opRightAssoc = new haxe_ds_StringMap(); + this.unops = new haxe_ds_StringMap(); + var _g1 = 0; + var _g = priorities.length; + while(_g1 < _g) { + var i = _g1++; + var _g2 = 0; + var _g3 = priorities[i]; + while(_g2 < _g3.length) { + var x = _g3[_g2]; + ++_g2; + this.opPriority.set(x,i); + if(i == 9) { + this.opRightAssoc.set(x,true); + } + } + } + var _g4 = 0; + var _g11 = ["!","++","--","-","~"]; + while(_g4 < _g11.length) { + var x1 = _g11[_g4]; + ++_g4; + this.unops.set(x1,x1 == "++" || x1 == "--"); + } +}; +$hxClasses["hscript.Parser"] = hscript_Parser; +hscript_Parser.__name__ = ["hscript","Parser"]; +hscript_Parser.prototype = { + line: null + ,opChars: null + ,identChars: null + ,opPriority: null + ,opRightAssoc: null + ,unops: null + ,preprocesorValues: null + ,allowJSON: null + ,allowTypes: null + ,allowMetadata: null + ,input: null + ,'char': null + ,ops: null + ,idents: null + ,uid: null + ,tokens: null + ,error: function(err,pmin,pmax) { + throw new js__$Boot_HaxeError(err); + } + ,invalidChar: function(c) { + this.error(hscript_Error.EInvalidChar(c),-1,-1); + } + ,initParser: function(origin) { + this.preprocStack = []; + this.tokens = new haxe_ds_GenericStack(); + this["char"] = -1; + this.ops = []; + this.idents = []; + this.uid = 0; + var _g1 = 0; + var _g = this.opChars.length; + while(_g1 < _g) { + var i = _g1++; + this.ops[HxOverrides.cca(this.opChars,i)] = true; + } + var _g11 = 0; + var _g2 = this.identChars.length; + while(_g11 < _g2) { + var i1 = _g11++; + this.idents[HxOverrides.cca(this.identChars,i1)] = true; + } + } + ,parseString: function(s,origin) { + if(origin == null) { + origin = "hscript"; + } + return this.parse(new haxe_io_StringInput(s),origin); + } + ,parse: function(s,origin) { + if(origin == null) { + origin = "hscript"; + } + this.initParser(origin); + this.input = s; + var a = []; + while(true) { + var tk = this.token(); + if(tk == hscript_Token.TEof) { + break; + } + this.push(tk); + this.parseFullExpr(a); + } + if(a.length == 1) { + return a[0]; + } else { + return this.mk(hscript_Expr.EBlock(a),0); + } + } + ,unexpected: function(tk) { + this.error(hscript_Error.EUnexpected(this.tokenString(tk)),0,0); + return null; + } + ,push: function(tk) { + this.tokens.add(tk); + } + ,ensure: function(tk) { + var t = this.token(); + if(t != tk) { + this.unexpected(t); + } + } + ,ensureToken: function(tk) { + var t = this.token(); + if(!Type.enumEq(t,tk)) { + this.unexpected(t); + } + } + ,maybe: function(tk) { + var t = this.token(); + if(Type.enumEq(t,tk)) { + return true; + } + this.push(t); + return false; + } + ,getIdent: function() { + var tk = this.token(); + if(Type.enumIndex(tk) == 2) { + var id = tk[2]; + return id; + } else { + this.unexpected(tk); + return null; + } + } + ,expr: function(e) { + return e; + } + ,pmin: function(e) { + return 0; + } + ,pmax: function(e) { + return 0; + } + ,mk: function(e,pmin,pmax) { + return e; + } + ,isBlock: function(e) { + var _g = this.expr(e); + switch(Type.enumIndex(_g)) { + case 2: + var e1 = _g[4]; + var t = _g[3]; + if(e1 != null) { + return this.isBlock(e1); + } else if(t != null) { + if(t == null) { + return false; + } else if(Type.enumIndex(t) == 2) { + return true; + } else { + return false; + } + } else { + return false; + } + break; + case 6: + var e2 = _g[4]; + return this.isBlock(e2); + case 7: + var e3 = _g[4]; + var prefix = _g[3]; + if(!prefix) { + return this.isBlock(e3); + } else { + return false; + } + break; + case 9: + var e21 = _g[4]; + var e11 = _g[3]; + if(e21 != null) { + return this.isBlock(e21); + } else { + return this.isBlock(e11); + } + break; + case 10: + var e4 = _g[3]; + return this.isBlock(e4); + case 11: + var e5 = _g[4]; + return this.isBlock(e5); + case 14: + var e6 = _g[3]; + return this.isBlock(e6); + case 15: + var e7 = _g[2]; + if(e7 != null) { + return this.isBlock(e7); + } else { + return false; + } + break; + case 20: + var e8 = _g[5]; + return this.isBlock(e8); + case 4:case 21:case 23: + return true; + case 24: + var e9 = _g[3]; + return this.isBlock(e9); + case 25: + var e10 = _g[4]; + return this.isBlock(e10); + default: + return false; + } + } + ,parseFullExpr: function(exprs) { + var e = this.parseExpr(); + exprs.push(e); + var tk = this.token(); + while(true) { + var tmp; + if(tk == hscript_Token.TComma) { + var _g = this.expr(e); + if(Type.enumIndex(_g) == 2) { + tmp = true; + } else { + tmp = false; + } + } else { + tmp = false; + } + if(!tmp) { + break; + } + e = this.parseStructure("var"); + exprs.push(e); + tk = this.token(); + } + if(tk != hscript_Token.TSemicolon && tk != hscript_Token.TEof) { + if(this.isBlock(e)) { + this.push(tk); + } else { + this.unexpected(tk); + } + } + } + ,parseObject: function(p1) { + var fl = []; + try { + while(true) { + var tk = this.token(); + var id = null; + switch(Type.enumIndex(tk)) { + case 1: + var c = tk[2]; + if(!this.allowJSON) { + this.unexpected(tk); + } + if(Type.enumIndex(c) == 2) { + var s = c[2]; + id = s; + } else { + this.unexpected(tk); + } + break; + case 2: + var i = tk[2]; + id = i; + break; + case 7: + throw "__break__"; + break; + default: + this.unexpected(tk); + } + this.ensure(hscript_Token.TDoubleDot); + fl.push({ name : id, e : this.parseExpr()}); + tk = this.token(); + switch(Type.enumIndex(tk)) { + case 7: + throw "__break__"; + break; + case 9: + break; + default: + this.unexpected(tk); + } + } + } catch( e ) { if( e != "__break__" ) throw e; } + return this.parseExprNext(this.mk(hscript_Expr.EObject(fl),p1)); + } + ,parseExpr: function() { + var tk = this.token(); + switch(Type.enumIndex(tk)) { + case 1: + var c = tk[2]; + return this.parseExprNext(this.mk(hscript_Expr.EConst(c))); + case 2: + var id = tk[2]; + var e = this.parseStructure(id); + if(e == null) { + e = this.mk(hscript_Expr.EIdent(id)); + } + return this.parseExprNext(e); + case 3: + var op = tk[2]; + if(this.unops.exists(op)) { + var start = 0; + var e1 = this.parseExpr(); + if(op == "-") { + var _g = this.expr(e1); + if(Type.enumIndex(_g) == 0) { + switch(Type.enumIndex(_g[2])) { + case 0: + var i = _g[2][2]; + return this.mk(hscript_Expr.EConst(hscript_Const.CInt(-i)),start,this.pmax(e1)); + case 1: + var f = _g[2][2]; + return this.mk(hscript_Expr.EConst(hscript_Const.CFloat(-f)),start,this.pmax(e1)); + default: + } + } + } + return this.makeUnop(op,e1); + } + return this.unexpected(tk); + case 4: + var e2 = this.parseExpr(); + tk = this.token(); + switch(Type.enumIndex(tk)) { + case 5: + return this.parseExprNext(this.mk(hscript_Expr.EParent(e2),0,0)); + case 9: + var _g1 = this.expr(e2); + if(Type.enumIndex(_g1) == 1) { + var v = _g1[2]; + var tmp = this.pmin(e2); + return this.parseLambda([{ name : v}],tmp); + } + break; + case 14: + var t = this.parseType(); + tk = this.token(); + switch(Type.enumIndex(tk)) { + case 5: + return this.parseExprNext(this.mk(hscript_Expr.ECheckType(e2,t),0,0)); + case 9: + var _g2 = this.expr(e2); + if(Type.enumIndex(_g2) == 1) { + var v1 = _g2[2]; + var tmp1 = this.pmin(e2); + return this.parseLambda([{ name : v1, t : t}],tmp1); + } + break; + default: + } + break; + default: + } + return this.unexpected(tk); + case 6: + tk = this.token(); + switch(Type.enumIndex(tk)) { + case 1: + var c1 = tk[2]; + if(this.allowJSON) { + if(Type.enumIndex(c1) == 2) { + var tk2 = this.token(); + this.push(tk2); + this.push(tk); + if(Type.enumIndex(tk2) == 14) { + return this.parseExprNext(this.parseObject(0)); + } + } else { + this.push(tk); + } + } else { + this.push(tk); + } + break; + case 2: + var tk21 = this.token(); + this.push(tk21); + this.push(tk); + if(Type.enumIndex(tk21) == 14) { + return this.parseExprNext(this.parseObject(0)); + } + break; + case 7: + return this.parseExprNext(this.mk(hscript_Expr.EObject([]),0)); + default: + this.push(tk); + } + var a = []; + while(true) { + this.parseFullExpr(a); + tk = this.token(); + if(tk == hscript_Token.TBrClose) { + break; + } + this.push(tk); + } + return this.mk(hscript_Expr.EBlock(a),0); + case 11: + var a1 = []; + tk = this.token(); + while(tk != hscript_Token.TBkClose) { + this.push(tk); + a1.push(this.parseExpr()); + tk = this.token(); + if(tk == hscript_Token.TComma) { + tk = this.token(); + } + } + if(a1.length == 1) { + var _g3 = this.expr(a1[0]); + switch(Type.enumIndex(_g3)) { + case 10:case 11:case 24: + var tmp2 = "__a_" + this.uid++; + var e3 = this.mk(hscript_Expr.EBlock([this.mk(hscript_Expr.EVar(tmp2,null,this.mk(hscript_Expr.EArrayDecl([]),0)),0),this.mapCompr(tmp2,a1[0]),this.mk(hscript_Expr.EIdent(tmp2),0)]),0); + return this.parseExprNext(e3); + default: + } + } + return this.parseExprNext(this.mk(hscript_Expr.EArrayDecl(a1),0)); + case 15: + var id1 = tk[2]; + if(this.allowMetadata) { + var args = this.parseMetaArgs(); + return this.mk(hscript_Expr.EMeta(id1,args,this.parseExpr()),0); + } else { + return this.unexpected(tk); + } + break; + default: + return this.unexpected(tk); + } + } + ,parseLambda: function(args,pmin) { + try { + while(true) { + var id = this.getIdent(); + var t = this.maybe(hscript_Token.TDoubleDot) ? this.parseType() : null; + args.push({ name : id, t : t}); + var tk = this.token(); + switch(Type.enumIndex(tk)) { + case 5: + throw "__break__"; + break; + case 9: + break; + default: + this.unexpected(tk); + } + } + } catch( e ) { if( e != "__break__" ) throw e; } + this.ensureToken(hscript_Token.TOp("->")); + var eret = this.parseExpr(); + return this.mk(hscript_Expr.EFunction(args,this.mk(hscript_Expr.EReturn(eret),pmin)),pmin); + } + ,parseMetaArgs: function() { + var tk = this.token(); + if(tk != hscript_Token.TPOpen) { + this.push(tk); + return null; + } + var args = []; + tk = this.token(); + if(tk != hscript_Token.TPClose) { + this.push(tk); + try { + while(true) { + args.push(this.parseExpr()); + var _g = this.token(); + switch(Type.enumIndex(_g)) { + case 5: + throw "__break__"; + break; + case 9: + break; + default: + var tk1 = _g; + this.unexpected(tk1); + } + } + } catch( e ) { if( e != "__break__" ) throw e; } + } + return args; + } + ,mapCompr: function(tmp,e) { + var edef; + var _g = this.expr(e); + switch(Type.enumIndex(_g)) { + case 3: + var e2 = _g[2]; + edef = hscript_Expr.EParent(this.mapCompr(tmp,e2)); + break; + case 4: + if(_g[2].length == 1) { + var e1 = _g[2][0]; + edef = hscript_Expr.EBlock([this.mapCompr(tmp,e1)]); + } else { + edef = hscript_Expr.ECall(this.mk(hscript_Expr.EField(this.mk(hscript_Expr.EIdent(tmp),this.pmin(e),this.pmax(e)),"push"),this.pmin(e),this.pmax(e)),[e]); + } + break; + case 9: + var e21 = _g[4]; + var e11 = _g[3]; + var cond = _g[2]; + if(e21 == null) { + edef = hscript_Expr.EIf(cond,this.mapCompr(tmp,e11),null); + } else { + edef = hscript_Expr.ECall(this.mk(hscript_Expr.EField(this.mk(hscript_Expr.EIdent(tmp),this.pmin(e),this.pmax(e)),"push"),this.pmin(e),this.pmax(e)),[e]); + } + break; + case 10: + var e22 = _g[3]; + var cond1 = _g[2]; + edef = hscript_Expr.EWhile(cond1,this.mapCompr(tmp,e22)); + break; + case 11: + var e23 = _g[4]; + var it = _g[3]; + var v = _g[2]; + edef = hscript_Expr.EFor(v,it,this.mapCompr(tmp,e23)); + break; + case 24: + var e24 = _g[3]; + var cond2 = _g[2]; + edef = hscript_Expr.EDoWhile(cond2,this.mapCompr(tmp,e24)); + break; + default: + edef = hscript_Expr.ECall(this.mk(hscript_Expr.EField(this.mk(hscript_Expr.EIdent(tmp),this.pmin(e),this.pmax(e)),"push"),this.pmin(e),this.pmax(e)),[e]); + } + return this.mk(edef,this.pmin(e),this.pmax(e)); + } + ,makeUnop: function(op,e) { + var _g = this.expr(e); + switch(Type.enumIndex(_g)) { + case 6: + var e2 = _g[4]; + var e1 = _g[3]; + var bop = _g[2]; + return this.mk(hscript_Expr.EBinop(bop,this.makeUnop(op,e1),e2),this.pmin(e1),this.pmax(e2)); + case 22: + var e3 = _g[4]; + var e21 = _g[3]; + var e11 = _g[2]; + return this.mk(hscript_Expr.ETernary(this.makeUnop(op,e11),e21,e3),this.pmin(e11),this.pmax(e3)); + default: + return this.mk(hscript_Expr.EUnop(op,true,e),this.pmin(e),this.pmax(e)); + } + } + ,makeBinop: function(op,e1,e) { + var _g = this.expr(e); + switch(Type.enumIndex(_g)) { + case 6: + var e3 = _g[4]; + var e2 = _g[3]; + var op2 = _g[2]; + if(this.opPriority.get(op) <= this.opPriority.get(op2) && !this.opRightAssoc.exists(op)) { + return this.mk(hscript_Expr.EBinop(op2,this.makeBinop(op,e1,e2),e3),this.pmin(e1),this.pmax(e3)); + } else { + return this.mk(hscript_Expr.EBinop(op,e1,e),this.pmin(e1),this.pmax(e)); + } + break; + case 22: + var e4 = _g[4]; + var e31 = _g[3]; + var e21 = _g[2]; + if(this.opRightAssoc.exists(op)) { + return this.mk(hscript_Expr.EBinop(op,e1,e),this.pmin(e1),this.pmax(e)); + } else { + return this.mk(hscript_Expr.ETernary(this.makeBinop(op,e1,e21),e31,e4),this.pmin(e1),this.pmax(e)); + } + break; + default: + return this.mk(hscript_Expr.EBinop(op,e1,e),this.pmin(e1),this.pmax(e)); + } + } + ,parseStructure: function(id) { + switch(id) { + case "break": + return this.mk(hscript_Expr.EBreak); + case "continue": + return this.mk(hscript_Expr.EContinue); + case "do": + var e = this.parseExpr(); + var tk = this.token(); + if(Type.enumIndex(tk) == 2) { + if(tk[2] != "while") { + this.unexpected(tk); + } + } else { + this.unexpected(tk); + } + var econd = this.parseExpr(); + return this.mk(hscript_Expr.EDoWhile(econd,e),0,this.pmax(econd)); + case "else": + return this.unexpected(hscript_Token.TId(id)); + case "for": + this.ensure(hscript_Token.TPOpen); + var vname = this.getIdent(); + this.ensureToken(hscript_Token.TId("in")); + var eiter = this.parseExpr(); + this.ensure(hscript_Token.TPClose); + var e1 = this.parseExpr(); + return this.mk(hscript_Expr.EFor(vname,eiter,e1),0,this.pmax(e1)); + case "function": + var tk1 = this.token(); + var name = null; + if(Type.enumIndex(tk1) == 2) { + var id1 = tk1[2]; + name = id1; + } else { + this.push(tk1); + } + var inf = this.parseFunctionDecl(); + return this.mk(hscript_Expr.EFunction(inf.args,inf.body,name,inf.ret),0,this.pmax(inf.body)); + case "if": + this.ensure(hscript_Token.TPOpen); + var cond = this.parseExpr(); + this.ensure(hscript_Token.TPClose); + var e11 = this.parseExpr(); + var e2 = null; + var semic = false; + var tk2 = this.token(); + if(tk2 == hscript_Token.TSemicolon) { + semic = true; + tk2 = this.token(); + } + if(Type.enumEq(tk2,hscript_Token.TId("else"))) { + e2 = this.parseExpr(); + } else { + this.push(tk2); + if(semic) { + this.push(hscript_Token.TSemicolon); + } + } + return this.mk(hscript_Expr.EIf(cond,e11,e2),0,e2 == null ? 0 : this.pmax(e2)); + case "inline": + if(!this.maybe(hscript_Token.TId("function"))) { + this.unexpected(hscript_Token.TId("inline")); + } + return this.parseStructure("function"); + case "new": + var a = []; + a.push(this.getIdent()); + var next = true; + while(next) { + var tk3 = this.token(); + switch(Type.enumIndex(tk3)) { + case 4: + next = false; + break; + case 8: + a.push(this.getIdent()); + break; + default: + this.unexpected(tk3); + } + } + var args = this.parseExprList(hscript_Token.TPClose); + return this.mk(hscript_Expr.ENew(a.join("."),args),0); + case "return": + var tk4 = this.token(); + this.push(tk4); + var e3 = tk4 == hscript_Token.TSemicolon ? null : this.parseExpr(); + return this.mk(hscript_Expr.EReturn(e3),0,e3 == null ? 0 : this.pmax(e3)); + case "switch": + var e4 = this.parseExpr(); + var def = null; + var cases = []; + this.ensure(hscript_Token.TBrOpen); + try { + while(true) { + var tk5 = this.token(); + switch(Type.enumIndex(tk5)) { + case 2: + switch(tk5[2]) { + case "case": + var c = { values : [], expr : null}; + cases.push(c); + try { + while(true) { + var e5 = this.parseExpr(); + c.values.push(e5); + tk5 = this.token(); + switch(Type.enumIndex(tk5)) { + case 9: + break; + case 14: + throw "__break__"; + break; + default: + this.unexpected(tk5); + } + } + } catch( e ) { if( e != "__break__" ) throw e; } + var exprs = []; + try { + while(true) { + tk5 = this.token(); + this.push(tk5); + switch(Type.enumIndex(tk5)) { + case 2: + switch(tk5[2]) { + case "case":case "default": + throw "__break__"; + break; + default: + this.parseFullExpr(exprs); + } + break; + case 7: + throw "__break__"; + break; + default: + this.parseFullExpr(exprs); + } + } + } catch( e ) { if( e != "__break__" ) throw e; } + c.expr = exprs.length == 1 ? exprs[0] : exprs.length == 0 ? this.mk(hscript_Expr.EBlock([]),0,0) : this.mk(hscript_Expr.EBlock(exprs),this.pmin(exprs[0]),this.pmax(exprs[exprs.length - 1])); + break; + case "default": + if(def != null) { + this.unexpected(tk5); + } + this.ensure(hscript_Token.TDoubleDot); + var exprs1 = []; + try { + while(true) { + tk5 = this.token(); + this.push(tk5); + switch(Type.enumIndex(tk5)) { + case 2: + switch(tk5[2]) { + case "case":case "default": + throw "__break__"; + break; + default: + this.parseFullExpr(exprs1); + } + break; + case 7: + throw "__break__"; + break; + default: + this.parseFullExpr(exprs1); + } + } + } catch( e ) { if( e != "__break__" ) throw e; } + if(exprs1.length == 1) { + def = exprs1[0]; + } else if(exprs1.length == 0) { + def = this.mk(hscript_Expr.EBlock([]),0,0); + } else { + def = this.mk(hscript_Expr.EBlock(exprs1),this.pmin(exprs1[0]),this.pmax(exprs1[exprs1.length - 1])); + } + break; + default: + this.unexpected(tk5); + } + break; + case 7: + throw "__break__"; + break; + default: + this.unexpected(tk5); + } + } + } catch( e ) { if( e != "__break__" ) throw e; } + return this.mk(hscript_Expr.ESwitch(e4,cases,def),0,0); + case "throw": + var e6 = this.parseExpr(); + return this.mk(hscript_Expr.EThrow(e6),0,this.pmax(e6)); + case "try": + var e7 = this.parseExpr(); + this.ensureToken(hscript_Token.TId("catch")); + this.ensure(hscript_Token.TPOpen); + var vname1 = this.getIdent(); + this.ensure(hscript_Token.TDoubleDot); + var t = null; + if(this.allowTypes) { + t = this.parseType(); + } else { + this.ensureToken(hscript_Token.TId("Dynamic")); + } + this.ensure(hscript_Token.TPClose); + var ec = this.parseExpr(); + return this.mk(hscript_Expr.ETry(e7,vname1,t,ec),0,this.pmax(ec)); + case "var": + var ident = this.getIdent(); + var tk6 = this.token(); + var t1 = null; + if(tk6 == hscript_Token.TDoubleDot && this.allowTypes) { + t1 = this.parseType(); + tk6 = this.token(); + } + var e8 = null; + if(Type.enumEq(tk6,hscript_Token.TOp("="))) { + e8 = this.parseExpr(); + } else { + this.push(tk6); + } + return this.mk(hscript_Expr.EVar(ident,t1,e8),0,e8 == null ? 0 : this.pmax(e8)); + case "while": + var econd1 = this.parseExpr(); + var e9 = this.parseExpr(); + return this.mk(hscript_Expr.EWhile(econd1,e9),0,this.pmax(e9)); + default: + return null; + } + } + ,parseExprNext: function(e1) { + var tk = this.token(); + switch(Type.enumIndex(tk)) { + case 3: + var op = tk[2]; + if(this.unops.get(op)) { + var tmp; + if(!this.isBlock(e1)) { + var _g = this.expr(e1); + if(Type.enumIndex(_g) == 3) { + tmp = true; + } else { + tmp = false; + } + } else { + tmp = true; + } + if(tmp) { + this.push(tk); + return e1; + } + return this.parseExprNext(this.mk(hscript_Expr.EUnop(op,false,e1),this.pmin(e1))); + } + return this.makeBinop(op,e1,this.parseExpr()); + case 4: + return this.parseExprNext(this.mk(hscript_Expr.ECall(e1,this.parseExprList(hscript_Token.TPClose)),this.pmin(e1))); + case 8: + var field = this.getIdent(); + return this.parseExprNext(this.mk(hscript_Expr.EField(e1,field),this.pmin(e1))); + case 11: + var e2 = this.parseExpr(); + this.ensure(hscript_Token.TBkClose); + return this.parseExprNext(this.mk(hscript_Expr.EArray(e1,e2),this.pmin(e1))); + case 13: + var e21 = this.parseExpr(); + this.ensure(hscript_Token.TDoubleDot); + var e3 = this.parseExpr(); + return this.mk(hscript_Expr.ETernary(e1,e21,e3),this.pmin(e1),this.pmax(e3)); + default: + this.push(tk); + return e1; + } + } + ,parseFunctionArgs: function() { + var args = []; + var tk = this.token(); + if(tk != hscript_Token.TPClose) { + var done = false; + while(!done) { + var name = null; + var opt = false; + if(Type.enumIndex(tk) == 13) { + opt = true; + tk = this.token(); + } + if(Type.enumIndex(tk) == 2) { + var id = tk[2]; + name = id; + } else { + this.unexpected(tk); + } + var arg = { name : name}; + args.push(arg); + if(opt) { + arg.opt = true; + } + if(this.allowTypes) { + if(this.maybe(hscript_Token.TDoubleDot)) { + arg.t = this.parseType(); + } + if(this.maybe(hscript_Token.TOp("="))) { + arg.value = this.parseExpr(); + } + } + tk = this.token(); + switch(Type.enumIndex(tk)) { + case 5: + done = true; + break; + case 9: + tk = this.token(); + break; + default: + this.unexpected(tk); + } + } + } + return args; + } + ,parseFunctionDecl: function() { + this.ensure(hscript_Token.TPOpen); + var args = this.parseFunctionArgs(); + var ret = null; + if(this.allowTypes) { + var tk = this.token(); + if(tk != hscript_Token.TDoubleDot) { + this.push(tk); + } else { + ret = this.parseType(); + } + } + return { args : args, ret : ret, body : this.parseExpr()}; + } + ,parsePath: function() { + var path = [this.getIdent()]; + while(true) { + var t = this.token(); + if(t != hscript_Token.TDot) { + this.push(t); + break; + } + path.push(this.getIdent()); + } + return path; + } + ,parseType: function() { + var _gthis = this; + var t = this.token(); + switch(Type.enumIndex(t)) { + case 2: + var v = t[2]; + this.push(t); + var path = this.parsePath(); + var params = null; + t = this.token(); + if(Type.enumIndex(t) == 3) { + var op = t[2]; + if(op == "<") { + params = []; + try { + while(true) { + params.push(this.parseType()); + t = this.token(); + switch(Type.enumIndex(t)) { + case 3: + var op1 = t[2]; + if(op1 == ">") { + throw "__break__"; + } + if(HxOverrides.cca(op1,0) == 62) { + this.tokens.add(hscript_Token.TOp(HxOverrides.substr(op1,1,null))); + throw "__break__"; + } + break; + case 9: + continue; + break; + default: + } + this.unexpected(t); + } + } catch( e ) { if( e != "__break__" ) throw e; } + } else { + this.push(t); + } + } else { + this.push(t); + } + return this.parseTypeNext(hscript_CType.CTPath(path,params)); + case 4: + var a = this.token(); + var b = this.token(); + this.push(b); + this.push(a); + var withReturn = function(args) { + var _g = _gthis.token(); + if(Type.enumIndex(_g) == 3) { + if(_g[2] != "->") { + var t1 = _g; + _gthis.unexpected(t1); + } + } else { + var t2 = _g; + _gthis.unexpected(t2); + } + return hscript_CType.CTFun(args,_gthis.parseType()); + }; + switch(Type.enumIndex(a)) { + case 2: + if(Type.enumIndex(b) == 14) { + var _g1 = []; + var _g11 = 0; + var _g2 = this.parseFunctionArgs(); + while(_g11 < _g2.length) { + var arg = _g2[_g11]; + ++_g11; + var _g3 = arg.value; + if(_g3 != null) { + var v1 = _g3; + this.error(hscript_Error.ECustom("Default values not allowed in function types"),0,0); + } + _g1.push(hscript_CType.CTNamed(arg.name,arg.opt ? hscript_CType.CTOpt(arg.t) : arg.t)); + } + var args1 = _g1; + return withReturn(args1); + } else { + var t3 = this.parseType(); + var _g4 = this.token(); + switch(Type.enumIndex(_g4)) { + case 5: + return this.parseTypeNext(hscript_CType.CTParent(t3)); + case 9: + var args2 = [t3]; + while(true) { + args2.push(this.parseType()); + if(!this.maybe(hscript_Token.TComma)) { + break; + } + } + this.ensure(hscript_Token.TPClose); + return withReturn(args2); + default: + var t4 = _g4; + return this.unexpected(t4); + } + } + break; + case 5: + var _g5 = []; + var _g12 = 0; + var _g21 = this.parseFunctionArgs(); + while(_g12 < _g21.length) { + var arg1 = _g21[_g12]; + ++_g12; + var _g31 = arg1.value; + if(_g31 != null) { + var v2 = _g31; + this.error(hscript_Error.ECustom("Default values not allowed in function types"),0,0); + } + _g5.push(hscript_CType.CTNamed(arg1.name,arg1.opt ? hscript_CType.CTOpt(arg1.t) : arg1.t)); + } + var args3 = _g5; + return withReturn(args3); + default: + var t5 = this.parseType(); + var _g6 = this.token(); + switch(Type.enumIndex(_g6)) { + case 5: + return this.parseTypeNext(hscript_CType.CTParent(t5)); + case 9: + var args4 = [t5]; + while(true) { + args4.push(this.parseType()); + if(!this.maybe(hscript_Token.TComma)) { + break; + } + } + this.ensure(hscript_Token.TPClose); + return withReturn(args4); + default: + var t6 = _g6; + return this.unexpected(t6); + } + } + break; + case 6: + var fields = []; + var meta = null; + try { + while(true) { + t = this.token(); + switch(Type.enumIndex(t)) { + case 2: + if(t[2] == "var") { + var name = this.getIdent(); + this.ensure(hscript_Token.TDoubleDot); + fields.push({ name : name, t : this.parseType(), meta : meta}); + meta = null; + this.ensure(hscript_Token.TSemicolon); + } else { + var name1 = t[2]; + this.ensure(hscript_Token.TDoubleDot); + fields.push({ name : name1, t : this.parseType(), meta : meta}); + t = this.token(); + switch(Type.enumIndex(t)) { + case 7: + throw "__break__"; + break; + case 9: + break; + default: + this.unexpected(t); + } + } + break; + case 7: + throw "__break__"; + break; + case 15: + var name2 = t[2]; + if(meta == null) { + meta = []; + } + meta.push({ name : name2, params : this.parseMetaArgs()}); + break; + default: + this.unexpected(t); + } + } + } catch( e ) { if( e != "__break__" ) throw e; } + return this.parseTypeNext(hscript_CType.CTAnon(fields)); + default: + return this.unexpected(t); + } + } + ,parseTypeNext: function(t) { + var tk = this.token(); + if(Type.enumIndex(tk) == 3) { + var op = tk[2]; + if(op != "->") { + this.push(tk); + return t; + } + } else { + this.push(tk); + return t; + } + var t2 = this.parseType(); + if(Type.enumIndex(t2) == 1) { + var args = t2[2]; + args.unshift(t); + return t2; + } else { + return hscript_CType.CTFun([t],t2); + } + } + ,parseExprList: function(etk) { + var args = []; + var tk = this.token(); + if(tk == etk) { + return args; + } + this.push(tk); + while(true) { + args.push(this.parseExpr()); + tk = this.token(); + if(Type.enumIndex(tk) != 9) { + if(tk == etk) { + break; + } + this.unexpected(tk); + } + } + return args; + } + ,incPos: function() { + } + ,readChar: function() { + this.incPos(); + try { + return this.input.readByte(); + } catch( e ) { + haxe_CallStack.lastException = e; + return 0; + } + } + ,readString: function(until) { + var c = 0; + var b = new haxe_io_BytesOutput(); + var esc = false; + var old = this.line; + var s = this.input; + while(true) { + try { + this.incPos(); + c = s.readByte(); + } catch( e ) { + haxe_CallStack.lastException = e; + this.line = old; + this.error(hscript_Error.EUnterminatedString,0,0); + } + if(esc) { + esc = false; + switch(c) { + case 34:case 39:case 92: + b.writeByte(c); + break; + case 47: + if(this.allowJSON) { + b.writeByte(c); + } else { + this.invalidChar(c); + } + break; + case 110: + b.writeByte(10); + break; + case 114: + b.writeByte(13); + break; + case 116: + b.writeByte(9); + break; + case 117: + if(!this.allowJSON) { + this.invalidChar(c); + } + var code = null; + try { + this.incPos(); + this.incPos(); + this.incPos(); + this.incPos(); + code = s.readString(4); + } catch( e1 ) { + haxe_CallStack.lastException = e1; + this.line = old; + this.error(hscript_Error.EUnterminatedString,0,0); + } + var k = 0; + var _g = 0; + while(_g < 4) { + var i = _g++; + k <<= 4; + var $char = HxOverrides.cca(code,i); + if($char == null) { + this.invalidChar($char); + } else { + switch($char) { + case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57: + k += $char - 48; + break; + case 65:case 66:case 67:case 68:case 69:case 70: + k += $char - 55; + break; + case 97:case 98:case 99:case 100:case 101:case 102: + k += $char - 87; + break; + default: + this.invalidChar($char); + } + } + } + if(k <= 127) { + b.writeByte(k); + } else if(k <= 2047) { + b.writeByte(192 | k >> 6); + b.writeByte(128 | k & 63); + } else { + b.writeByte(224 | k >> 12); + b.writeByte(128 | k >> 6 & 63); + b.writeByte(128 | k & 63); + } + break; + default: + this.invalidChar(c); + } + } else if(c == 92) { + esc = true; + } else if(c == until) { + break; + } else { + if(c == 10) { + this.line++; + } + b.writeByte(c); + } + } + return b.getBytes().toString(); + } + ,token: function() { + if(!this.tokens.isEmpty()) { + return this.tokens.pop(); + } + var $char; + if(this["char"] < 0) { + $char = this.readChar(); + } else { + $char = this["char"]; + this["char"] = -1; + } + while(true) { + switch($char) { + case 0: + return hscript_Token.TEof; + case 10: + this.line++; + break; + case 9:case 13:case 32: + break; + case 35: + $char = this.readChar(); + if(this.idents[$char]) { + var id = String.fromCharCode($char); + while(true) { + $char = this.readChar(); + if(!this.idents[$char]) { + this["char"] = $char; + return this.preprocess(id); + } + id += String.fromCharCode($char); + } + } + this.invalidChar($char); + break; + case 34:case 39: + return hscript_Token.TConst(hscript_Const.CString(this.readString($char))); + case 40: + return hscript_Token.TPOpen; + case 41: + return hscript_Token.TPClose; + case 44: + return hscript_Token.TComma; + case 46: + $char = this.readChar(); + switch($char) { + case 46: + $char = this.readChar(); + if($char != 46) { + this.invalidChar($char); + } + return hscript_Token.TOp("..."); + case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57: + var n = $char - 48; + var exp = 1; + while(true) { + $char = this.readChar(); + exp *= 10; + switch($char) { + case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57: + n = n * 10 + ($char - 48); + break; + default: + this["char"] = $char; + return hscript_Token.TConst(hscript_Const.CFloat(n / exp)); + } + } + break; + default: + this["char"] = $char; + return hscript_Token.TDot; + } + break; + case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57: + var n1 = ($char - 48) * 1.0; + var exp1 = 0.; + while(true) { + $char = this.readChar(); + exp1 *= 10; + switch($char) { + case 46: + if(exp1 > 0) { + if(exp1 == 10 && this.readChar() == 46) { + this.push(hscript_Token.TOp("...")); + var i = Std["int"](n1); + return hscript_Token.TConst(i == n1 ? hscript_Const.CInt(i) : hscript_Const.CFloat(n1)); + } + this.invalidChar($char); + } + exp1 = 1.; + break; + case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57: + n1 = n1 * 10 + ($char - 48); + break; + case 69:case 101: + var tk = this.token(); + var pow = null; + switch(Type.enumIndex(tk)) { + case 1: + if(Type.enumIndex(tk[2]) == 0) { + var e = tk[2][2]; + pow = e; + } else { + this.push(tk); + } + break; + case 3: + if(tk[2] == "-") { + tk = this.token(); + if(Type.enumIndex(tk) == 1) { + if(Type.enumIndex(tk[2]) == 0) { + var e1 = tk[2][2]; + pow = -e1; + } else { + this.push(tk); + } + } else { + this.push(tk); + } + } else { + this.push(tk); + } + break; + default: + this.push(tk); + } + if(pow == null) { + this.invalidChar($char); + } + return hscript_Token.TConst(hscript_Const.CFloat(Math.pow(10,pow) / exp1 * n1 * 10)); + case 120: + if(n1 > 0 || exp1 > 0) { + this.invalidChar($char); + } + var n2 = 0; + while(true) { + $char = this.readChar(); + switch($char) { + case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57: + n2 = (n2 << 4) + $char - 48; + break; + case 65:case 66:case 67:case 68:case 69:case 70: + n2 = (n2 << 4) + ($char - 55); + break; + case 97:case 98:case 99:case 100:case 101:case 102: + n2 = (n2 << 4) + ($char - 87); + break; + default: + this["char"] = $char; + return hscript_Token.TConst(hscript_Const.CInt(n2)); + } + } + break; + default: + this["char"] = $char; + var i1 = Std["int"](n1); + return hscript_Token.TConst(exp1 > 0 ? hscript_Const.CFloat(n1 * 10 / exp1) : i1 == n1 ? hscript_Const.CInt(i1) : hscript_Const.CFloat(n1)); + } + } + break; + case 58: + return hscript_Token.TDoubleDot; + case 59: + return hscript_Token.TSemicolon; + case 61: + $char = this.readChar(); + if($char == 61) { + return hscript_Token.TOp("=="); + } else if($char == 62) { + return hscript_Token.TOp("=>"); + } + this["char"] = $char; + return hscript_Token.TOp("="); + case 63: + return hscript_Token.TQuestion; + case 64: + $char = this.readChar(); + if(this.idents[$char] || $char == 58) { + var id1 = String.fromCharCode($char); + while(true) { + $char = this.readChar(); + if(!this.idents[$char]) { + this["char"] = $char; + return hscript_Token.TMeta(id1); + } + id1 += String.fromCharCode($char); + } + } + this.invalidChar($char); + break; + case 91: + return hscript_Token.TBkOpen; + case 93: + return hscript_Token.TBkClose; + case 123: + return hscript_Token.TBrOpen; + case 125: + return hscript_Token.TBrClose; + default: + if(this.ops[$char]) { + var op = String.fromCharCode($char); + var prev = -1; + while(true) { + $char = this.readChar(); + if(!this.ops[$char] || prev == 61) { + if(HxOverrides.cca(op,0) == 47) { + return this.tokenComment(op,$char); + } + this["char"] = $char; + return hscript_Token.TOp(op); + } + prev = $char; + op += String.fromCharCode($char); + } + } + if(this.idents[$char]) { + var id2 = String.fromCharCode($char); + while(true) { + $char = this.readChar(); + if(!this.idents[$char]) { + this["char"] = $char; + return hscript_Token.TId(id2); + } + id2 += String.fromCharCode($char); + } + } + this.invalidChar($char); + } + $char = this.readChar(); + } + } + ,preprocValue: function(id) { + return this.preprocesorValues.get(id); + } + ,preprocStack: null + ,parsePreproCond: function() { + var tk = this.token(); + switch(Type.enumIndex(tk)) { + case 2: + var id = tk[2]; + return this.mk(hscript_Expr.EIdent(id),0,0); + case 3: + if(tk[2] == "!") { + return this.mk(hscript_Expr.EUnop("!",true,this.parsePreproCond()),0,0); + } else { + return this.unexpected(tk); + } + break; + case 4: + this.push(hscript_Token.TPOpen); + return this.parseExpr(); + default: + return this.unexpected(tk); + } + } + ,evalPreproCond: function(e) { + var _g = this.expr(e); + switch(Type.enumIndex(_g)) { + case 1: + var id = _g[2]; + return this.preprocValue(id) != null; + case 3: + var e1 = _g[2]; + return this.evalPreproCond(e1); + case 6: + switch(_g[2]) { + case "&&": + var e2 = _g[4]; + var e11 = _g[3]; + if(this.evalPreproCond(e11)) { + return this.evalPreproCond(e2); + } else { + return false; + } + break; + case "||": + var e21 = _g[4]; + var e12 = _g[3]; + if(!this.evalPreproCond(e12)) { + return this.evalPreproCond(e21); + } else { + return true; + } + break; + default: + this.error(hscript_Error.EInvalidPreprocessor("Can't eval " + Type.enumConstructor(this.expr(e))),0,0); + return false; + } + break; + case 7: + if(_g[2] == "!") { + var e3 = _g[4]; + return !this.evalPreproCond(e3); + } else { + this.error(hscript_Error.EInvalidPreprocessor("Can't eval " + Type.enumConstructor(this.expr(e))),0,0); + return false; + } + break; + default: + this.error(hscript_Error.EInvalidPreprocessor("Can't eval " + Type.enumConstructor(this.expr(e))),0,0); + return false; + } + } + ,preprocess: function(id) { + switch(id) { + case "else":case "elseif": + if(this.preprocStack.length > 0) { + if(this.preprocStack[this.preprocStack.length - 1].r) { + this.preprocStack[this.preprocStack.length - 1].r = false; + this.skipTokens(); + return this.token(); + } else if(id == "else") { + this.preprocStack.pop(); + this.preprocStack.push({ r : true}); + return this.token(); + } else { + this.preprocStack.pop(); + return this.preprocess("if"); + } + } else { + return hscript_Token.TPrepro(id); + } + break; + case "end": + if(this.preprocStack.length > 0) { + this.preprocStack.pop(); + return this.token(); + } else { + return hscript_Token.TPrepro(id); + } + break; + case "if": + var e = this.parsePreproCond(); + if(this.evalPreproCond(e)) { + this.preprocStack.push({ r : true}); + return this.token(); + } + this.preprocStack.push({ r : false}); + this.skipTokens(); + return this.token(); + default: + return hscript_Token.TPrepro(id); + } + } + ,skipTokens: function() { + var spos = this.preprocStack.length - 1; + var obj = this.preprocStack[spos]; + var pos = 0; + while(true) { + var tk = this.token(); + if(tk == hscript_Token.TEof) { + this.error(hscript_Error.EInvalidPreprocessor("Unclosed"),pos,pos); + } + if(this.preprocStack[spos] != obj) { + this.push(tk); + break; + } + } + } + ,tokenComment: function(op,$char) { + var c = HxOverrides.cca(op,1); + var s = this.input; + if(c == 47) { + try { + while($char != 13 && $char != 10) { + this.incPos(); + $char = s.readByte(); + } + this["char"] = $char; + } catch( e ) { + haxe_CallStack.lastException = e; + } + return this.token(); + } + if(c == 42) { + var old = this.line; + if(op == "/**/") { + this["char"] = $char; + return this.token(); + } + try { + while(true) { + while($char != 42) { + if($char == 10) { + this.line++; + } + this.incPos(); + $char = s.readByte(); + } + this.incPos(); + $char = s.readByte(); + if($char == 47) { + break; + } + } + } catch( e1 ) { + haxe_CallStack.lastException = e1; + this.line = old; + this.error(hscript_Error.EUnterminatedComment,0,0); + } + return this.token(); + } + this["char"] = $char; + return hscript_Token.TOp(op); + } + ,constString: function(c) { + switch(Type.enumIndex(c)) { + case 0: + var v = c[2]; + if(v == null) { + return "null"; + } else { + return "" + v; + } + break; + case 1: + var f = c[2]; + if(f == null) { + return "null"; + } else { + return "" + f; + } + break; + case 2: + var s = c[2]; + return s; + } + } + ,tokenString: function(t) { + switch(Type.enumIndex(t)) { + case 0: + return ""; + case 1: + var c = t[2]; + return this.constString(c); + case 2: + var s = t[2]; + return s; + case 3: + var s1 = t[2]; + return s1; + case 4: + return "("; + case 5: + return ")"; + case 6: + return "{"; + case 7: + return "}"; + case 8: + return "."; + case 9: + return ","; + case 10: + return ";"; + case 11: + return "["; + case 12: + return "]"; + case 13: + return "?"; + case 14: + return ":"; + case 15: + var id = t[2]; + return "@" + id; + case 16: + var id1 = t[2]; + return "#" + id1; + } + } + ,__class__: hscript_Parser +}; +var hscript_Tools = function() { }; +$hxClasses["hscript.Tools"] = hscript_Tools; +hscript_Tools.__name__ = ["hscript","Tools"]; +hscript_Tools.expr = function(e) { + return e; +}; +var js__$Boot_HaxeError = function(val) { + Error.call(this); + this.val = val; + this.message = String(val); + if(Error.captureStackTrace) { + Error.captureStackTrace(this,js__$Boot_HaxeError); + } +}; +$hxClasses["js._Boot.HaxeError"] = js__$Boot_HaxeError; +js__$Boot_HaxeError.__name__ = ["js","_Boot","HaxeError"]; +js__$Boot_HaxeError.wrap = function(val) { + if((val instanceof Error)) { + return val; + } else { + return new js__$Boot_HaxeError(val); + } +}; +js__$Boot_HaxeError.__super__ = Error; +js__$Boot_HaxeError.prototype = $extend(Error.prototype,{ + val: null + ,__class__: js__$Boot_HaxeError +}); +var js_Boot = function() { }; +$hxClasses["js.Boot"] = js_Boot; +js_Boot.__name__ = ["js","Boot"]; +js_Boot.__unhtml = function(s) { + return s.split("&").join("&").split("<").join("<").split(">").join(">"); +}; +js_Boot.__trace = function(v,i) { + var msg = i != null ? i.fileName + ":" + i.lineNumber + ": " : ""; + msg += js_Boot.__string_rec(v,""); + if(i != null && i.customParams != null) { + var _g = 0; + var _g1 = i.customParams; + while(_g < _g1.length) { + var v1 = _g1[_g]; + ++_g; + msg += "," + js_Boot.__string_rec(v1,""); + } + } + var d; + var tmp; + if(typeof(document) != "undefined") { + d = document.getElementById("haxe:trace"); + tmp = d != null; + } else { + tmp = false; + } + if(tmp) { + d.innerHTML += js_Boot.__unhtml(msg) + "
"; + } else if(typeof console != "undefined" && console.log != null) { + console.log(msg); + } +}; +js_Boot.isClass = function(o) { + return o.__name__; +}; +js_Boot.isEnum = function(e) { + return e.__ename__; +}; +js_Boot.getClass = function(o) { + if((o instanceof Array) && o.__enum__ == null) { + return Array; + } else { + var cl = o.__class__; + if(cl != null) { + return cl; + } + var name = js_Boot.__nativeClassName(o); + if(name != null) { + return js_Boot.__resolveNativeClass(name); + } + return null; + } +}; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (js_Boot.isClass(o) || js_Boot.isEnum(o))) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(o instanceof Array) { + if(o.__enum__) { + if(o.length == 2) { + return o[0]; + } + var str = o[0] + "("; + s += "\t"; + var _g1 = 2; + var _g = o.length; + while(_g1 < _g) { + var i = _g1++; + if(i != 2) { + str += "," + js_Boot.__string_rec(o[i],s); + } else { + str += js_Boot.__string_rec(o[i],s); + } + } + return str + ")"; + } + var l = o.length; + var i1; + var str1 = "["; + s += "\t"; + var _g11 = 0; + var _g2 = l; + while(_g11 < _g2) { + var i2 = _g11++; + str1 += (i2 > 0 ? "," : "") + js_Boot.__string_rec(o[i2],s); + } + str1 += "]"; + return str1; + } + var tostr; + try { + tostr = o.toString; + } catch( e ) { + haxe_CallStack.lastException = e; + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var k = null; + var str2 = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + for( var k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str2.length != 2) { + str2 += ", \n"; + } + str2 += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str2 += "\n" + s + "}"; + return str2; + case "string": + return o; + default: + return String(o); + } +}; +js_Boot.__interfLoop = function(cc,cl) { + if(cc == null) { + return false; + } + if(cc == cl) { + return true; + } + var intf = cc.__interfaces__; + if(intf != null) { + var _g1 = 0; + var _g = intf.length; + while(_g1 < _g) { + var i = _g1++; + var i1 = intf[i]; + if(i1 == cl || js_Boot.__interfLoop(i1,cl)) { + return true; + } + } + } + return js_Boot.__interfLoop(cc.__super__,cl); +}; +js_Boot.__instanceof = function(o,cl) { + if(cl == null) { + return false; + } + switch(cl) { + case Array: + if((o instanceof Array)) { + return o.__enum__ == null; + } else { + return false; + } + break; + case Bool: + return typeof(o) == "boolean"; + case Dynamic: + return true; + case Float: + return typeof(o) == "number"; + case Int: + if(typeof(o) == "number") { + return (o|0) === o; + } else { + return false; + } + break; + case String: + return typeof(o) == "string"; + default: + if(o != null) { + if(typeof(cl) == "function") { + if(o instanceof cl) { + return true; + } + if(js_Boot.__interfLoop(js_Boot.getClass(o),cl)) { + return true; + } + } else if(typeof(cl) == "object" && js_Boot.__isNativeObj(cl)) { + if(o instanceof cl) { + return true; + } + } + } else { + return false; + } + if(cl == Class ? o.__name__ != null : false) { + return true; + } + if(cl == Enum ? o.__ename__ != null : false) { + return true; + } + return o.__enum__ == cl; + } +}; +js_Boot.__cast = function(o,t) { + if(js_Boot.__instanceof(o,t)) { + return o; + } else { + throw new js__$Boot_HaxeError("Cannot cast " + Std.string(o) + " to " + Std.string(t)); + } +}; +js_Boot.__nativeClassName = function(o) { + var name = js_Boot.__toStr.call(o).slice(8,-1); + if(name == "Object" || name == "Function" || name == "Math" || name == "JSON") { + return null; + } + return name; +}; +js_Boot.__isNativeObj = function(o) { + return js_Boot.__nativeClassName(o) != null; +}; +js_Boot.__resolveNativeClass = function(name) { + return $global[name]; +}; +var js_html__$CanvasElement_CanvasUtil = function() { }; +$hxClasses["js.html._CanvasElement.CanvasUtil"] = js_html__$CanvasElement_CanvasUtil; +js_html__$CanvasElement_CanvasUtil.__name__ = ["js","html","_CanvasElement","CanvasUtil"]; +js_html__$CanvasElement_CanvasUtil.getContextWebGL = function(canvas,attribs) { + var _g = 0; + var _g1 = ["webgl","experimental-webgl"]; + while(_g < _g1.length) { + var name = _g1[_g]; + ++_g; + var ctx = canvas.getContext(name,attribs); + if(ctx != null) { + return ctx; + } + } + return null; +}; +var js_html_compat_ArrayBuffer = function(a) { + if((a instanceof Array) && a.__enum__ == null) { + this.a = a; + this.byteLength = a.length; + } else { + var len = a; + this.a = []; + var _g1 = 0; + var _g = len; + while(_g1 < _g) { + var i = _g1++; + this.a[i] = 0; + } + this.byteLength = len; + } +}; +$hxClasses["js.html.compat.ArrayBuffer"] = js_html_compat_ArrayBuffer; +js_html_compat_ArrayBuffer.__name__ = ["js","html","compat","ArrayBuffer"]; +js_html_compat_ArrayBuffer.sliceImpl = function(begin,end) { + var u = new Uint8Array(this,begin,end == null ? null : end - begin); + var result = new ArrayBuffer(u.byteLength); + var resultArray = new Uint8Array(result); + resultArray.set(u); + return result; +}; +js_html_compat_ArrayBuffer.prototype = { + byteLength: null + ,a: null + ,slice: function(begin,end) { + return new js_html_compat_ArrayBuffer(this.a.slice(begin,end)); + } + ,__class__: js_html_compat_ArrayBuffer +}; +var js_html_compat_DataView = function(buffer,byteOffset,byteLength) { + this.buf = buffer; + this.offset = byteOffset == null ? 0 : byteOffset; + this.length = byteLength == null ? buffer.byteLength - this.offset : byteLength; + if(this.offset < 0 || this.length < 0 || this.offset + this.length > buffer.byteLength) { + throw new js__$Boot_HaxeError(haxe_io_Error.OutsideBounds); + } + this.byteLength = this.length; + this.byteOffset = this.offset; + this.buffer = this.buf; +}; +$hxClasses["js.html.compat.DataView"] = js_html_compat_DataView; +js_html_compat_DataView.__name__ = ["js","html","compat","DataView"]; +js_html_compat_DataView.prototype = { + buf: null + ,offset: null + ,length: null + ,byteLength: null + ,byteOffset: null + ,buffer: null + ,getInt8: function(byteOffset) { + var v = this.buf.a[this.offset + byteOffset]; + if(v >= 128) { + return v - 256; + } else { + return v; + } + } + ,getUint8: function(byteOffset) { + return this.buf.a[this.offset + byteOffset]; + } + ,getInt16: function(byteOffset,littleEndian) { + var v = this.getUint16(byteOffset,littleEndian); + if(v >= 32768) { + return v - 65536; + } else { + return v; + } + } + ,getUint16: function(byteOffset,littleEndian) { + if(littleEndian) { + return this.buf.a[this.offset + byteOffset] | this.buf.a[this.offset + byteOffset + 1] << 8; + } else { + return this.buf.a[this.offset + byteOffset] << 8 | this.buf.a[this.offset + byteOffset + 1]; + } + } + ,getInt32: function(byteOffset,littleEndian) { + var p = this.offset + byteOffset; + var a = this.buf.a[p++]; + var b = this.buf.a[p++]; + var c = this.buf.a[p++]; + var d = this.buf.a[p++]; + if(littleEndian) { + return a | b << 8 | c << 16 | d << 24; + } else { + return d | c << 8 | b << 16 | a << 24; + } + } + ,getUint32: function(byteOffset,littleEndian) { + var v = this.getInt32(byteOffset,littleEndian); + if(v < 0) { + return v + 4294967296.; + } else { + return v; + } + } + ,getFloat32: function(byteOffset,littleEndian) { + return haxe_io_FPHelper.i32ToFloat(this.getInt32(byteOffset,littleEndian)); + } + ,getFloat64: function(byteOffset,littleEndian) { + var a = this.getInt32(byteOffset,littleEndian); + var b = this.getInt32(byteOffset + 4,littleEndian); + return haxe_io_FPHelper.i64ToDouble(littleEndian ? a : b,littleEndian ? b : a); + } + ,setInt8: function(byteOffset,value) { + this.buf.a[byteOffset + this.offset] = value < 0 ? value + 128 & 255 : value & 255; + } + ,setUint8: function(byteOffset,value) { + this.buf.a[byteOffset + this.offset] = value & 255; + } + ,setInt16: function(byteOffset,value,littleEndian) { + this.setUint16(byteOffset,value < 0 ? value + 65536 : value,littleEndian); + } + ,setUint16: function(byteOffset,value,littleEndian) { + var p = byteOffset + this.offset; + if(littleEndian) { + this.buf.a[p] = value & 255; + this.buf.a[p++] = value >> 8 & 255; + } else { + this.buf.a[p++] = value >> 8 & 255; + this.buf.a[p] = value & 255; + } + } + ,setInt32: function(byteOffset,value,littleEndian) { + this.setUint32(byteOffset,value,littleEndian); + } + ,setUint32: function(byteOffset,value,littleEndian) { + var p = byteOffset + this.offset; + if(littleEndian) { + this.buf.a[p++] = value & 255; + this.buf.a[p++] = value >> 8 & 255; + this.buf.a[p++] = value >> 16 & 255; + this.buf.a[p++] = value >>> 24; + } else { + this.buf.a[p++] = value >>> 24; + this.buf.a[p++] = value >> 16 & 255; + this.buf.a[p++] = value >> 8 & 255; + this.buf.a[p++] = value & 255; + } + } + ,setFloat32: function(byteOffset,value,littleEndian) { + this.setUint32(byteOffset,haxe_io_FPHelper.floatToI32(value),littleEndian); + } + ,setFloat64: function(byteOffset,value,littleEndian) { + var i64 = haxe_io_FPHelper.doubleToI64(value); + if(littleEndian) { + this.setUint32(byteOffset,i64.low); + this.setUint32(byteOffset,i64.high); + } else { + this.setUint32(byteOffset,i64.high); + this.setUint32(byteOffset,i64.low); + } + } + ,__class__: js_html_compat_DataView +}; +var js_html_compat_Float32Array = function() { }; +$hxClasses["js.html.compat.Float32Array"] = js_html_compat_Float32Array; +js_html_compat_Float32Array.__name__ = ["js","html","compat","Float32Array"]; +js_html_compat_Float32Array._new = function(arg1,offset,length) { + var arr; + if(typeof(arg1) == "number") { + arr = []; + var _g1 = 0; + var _g = arg1; + while(_g1 < _g) { + var i = _g1++; + arr[i] = 0; + } + arr.byteLength = arr.length << 2; + arr.byteOffset = 0; + var _g2 = []; + var _g21 = 0; + var _g11 = arr.length << 2; + while(_g21 < _g11) { + var i1 = _g21++; + _g2.push(0); + } + arr.buffer = new js_html_compat_ArrayBuffer(_g2); + } else if(Std["is"](arg1,js_html_compat_ArrayBuffer)) { + var buffer = arg1; + if(offset == null) { + offset = 0; + } + if(length == null) { + length = buffer.byteLength - offset >> 2; + } + arr = []; + var _g12 = 0; + var _g3 = length; + while(_g12 < _g3) { + var i2 = _g12++; + var val = buffer.a[offset++] | buffer.a[offset++] << 8 | buffer.a[offset++] << 16 | buffer.a[offset++] << 24; + arr.push(haxe_io_FPHelper.i32ToFloat(val)); + } + arr.byteLength = arr.length << 2; + arr.byteOffset = offset; + arr.buffer = buffer; + } else if((arg1 instanceof Array) && arg1.__enum__ == null) { + arr = arg1.slice(); + var buffer1 = []; + var _g4 = 0; + while(_g4 < arr.length) { + var f = arr[_g4]; + ++_g4; + var i3 = haxe_io_FPHelper.floatToI32(f); + buffer1.push(i3 & 255); + buffer1.push(i3 >> 8 & 255); + buffer1.push(i3 >> 16 & 255); + buffer1.push(i3 >>> 24); + } + arr.byteLength = arr.length << 2; + arr.byteOffset = 0; + arr.buffer = new js_html_compat_ArrayBuffer(buffer1); + } else { + throw new js__$Boot_HaxeError("TODO " + Std.string(arg1)); + } + arr.subarray = js_html_compat_Float32Array._subarray; + arr.set = js_html_compat_Float32Array._set; + return arr; +}; +js_html_compat_Float32Array._set = function(arg,offset) { + if(Std["is"](arg.buffer,js_html_compat_ArrayBuffer)) { + var a = arg; + if(arg.byteLength + offset > this.byteLength) { + throw new js__$Boot_HaxeError("set() outside of range"); + } + var _g1 = 0; + var _g = arg.byteLength; + while(_g1 < _g) { + var i = _g1++; + this[i + offset] = a[i]; + } + } else if((arg instanceof Array) && arg.__enum__ == null) { + var a1 = arg; + if(a1.length + offset > this.byteLength) { + throw new js__$Boot_HaxeError("set() outside of range"); + } + var _g11 = 0; + var _g2 = a1.length; + while(_g11 < _g2) { + var i1 = _g11++; + this[i1 + offset] = a1[i1]; + } + } else { + throw new js__$Boot_HaxeError("TODO"); + } +}; +js_html_compat_Float32Array._subarray = function(start,end) { + var a = js_html_compat_Float32Array._new(this.slice(start,end)); + a.byteOffset = start * 4; + return a; +}; +var js_html_compat_Uint8Array = function() { }; +$hxClasses["js.html.compat.Uint8Array"] = js_html_compat_Uint8Array; +js_html_compat_Uint8Array.__name__ = ["js","html","compat","Uint8Array"]; +js_html_compat_Uint8Array._new = function(arg1,offset,length) { + var arr; + if(typeof(arg1) == "number") { + arr = []; + var _g1 = 0; + var _g = arg1; + while(_g1 < _g) { + var i = _g1++; + arr[i] = 0; + } + arr.byteLength = arr.length; + arr.byteOffset = 0; + arr.buffer = new js_html_compat_ArrayBuffer(arr); + } else if(Std["is"](arg1,js_html_compat_ArrayBuffer)) { + var buffer = arg1; + if(offset == null) { + offset = 0; + } + if(length == null) { + length = buffer.byteLength - offset; + } + if(offset == 0) { + arr = buffer.a; + } else { + arr = buffer.a.slice(offset,offset + length); + } + arr.byteLength = arr.length; + arr.byteOffset = offset; + arr.buffer = buffer; + } else if((arg1 instanceof Array) && arg1.__enum__ == null) { + arr = arg1.slice(); + arr.byteLength = arr.length; + arr.byteOffset = 0; + arr.buffer = new js_html_compat_ArrayBuffer(arr); + } else { + throw new js__$Boot_HaxeError("TODO " + Std.string(arg1)); + } + arr.subarray = js_html_compat_Uint8Array._subarray; + arr.set = js_html_compat_Uint8Array._set; + return arr; +}; +js_html_compat_Uint8Array._set = function(arg,offset) { + if(Std["is"](arg.buffer,js_html_compat_ArrayBuffer)) { + var a = arg; + if(arg.byteLength + offset > this.byteLength) { + throw new js__$Boot_HaxeError("set() outside of range"); + } + var _g1 = 0; + var _g = arg.byteLength; + while(_g1 < _g) { + var i = _g1++; + this[i + offset] = a[i]; + } + } else if((arg instanceof Array) && arg.__enum__ == null) { + var a1 = arg; + if(a1.length + offset > this.byteLength) { + throw new js__$Boot_HaxeError("set() outside of range"); + } + var _g11 = 0; + var _g2 = a1.length; + while(_g11 < _g2) { + var i1 = _g11++; + this[i1 + offset] = a1[i1]; + } + } else { + throw new js__$Boot_HaxeError("TODO"); + } +}; +js_html_compat_Uint8Array._subarray = function(start,end) { + var a = js_html_compat_Uint8Array._new(this.slice(start,end)); + a.byteOffset = start; + return a; +}; +var lime_AssetCache = function() { + this.enabled = true; + this.audio = new haxe_ds_StringMap(); + this.font = new haxe_ds_StringMap(); + this.image = new haxe_ds_StringMap(); + this.version = Std["int"](Math.random() * 1000000); +}; +$hxClasses["lime.AssetCache"] = lime_AssetCache; +lime_AssetCache.__name__ = ["lime","AssetCache"]; +lime_AssetCache.prototype = { + audio: null + ,enabled: null + ,image: null + ,font: null + ,version: null + ,clear: function(prefix) { + if(prefix == null) { + this.audio = new haxe_ds_StringMap(); + this.font = new haxe_ds_StringMap(); + this.image = new haxe_ds_StringMap(); + } else { + var keys = this.audio.keys(); + var key = keys; + while(key.hasNext()) { + var key1 = key.next(); + if(StringTools.startsWith(key1,prefix)) { + this.audio.remove(key1); + } + } + var keys1 = this.font.keys(); + var key2 = keys1; + while(key2.hasNext()) { + var key3 = key2.next(); + if(StringTools.startsWith(key3,prefix)) { + this.font.remove(key3); + } + } + var keys2 = this.image.keys(); + var key4 = keys2; + while(key4.hasNext()) { + var key5 = key4.next(); + if(StringTools.startsWith(key5,prefix)) { + this.image.remove(key5); + } + } + } + } + ,__class__: lime_AssetCache +}; +var lime_app_Event_$Void_$Void = function() { + this.canceled = false; + this.__listeners = []; + this.__priorities = []; + this.__repeat = []; +}; +$hxClasses["lime.app.Event_Void_Void"] = lime_app_Event_$Void_$Void; +lime_app_Event_$Void_$Void.__name__ = ["lime","app","Event_Void_Void"]; +lime_app_Event_$Void_$Void.prototype = { + canceled: null + ,__repeat: null + ,__priorities: null + ,add: function(listener,once,priority) { + if(priority == null) { + priority = 0; + } + if(once == null) { + once = false; + } + var _g1 = 0; + var _g = this.__priorities.length; + while(_g1 < _g) { + var i = _g1++; + if(priority > this.__priorities[i]) { + this.__listeners.splice(i,0,listener); + this.__priorities.splice(i,0,priority); + this.__repeat.splice(i,0,!once); + return; + } + } + this.__listeners.push(listener); + this.__priorities.push(priority); + this.__repeat.push(!once); + } + ,remove: function(listener) { + var i = this.__listeners.length; + while(--i >= 0) if(Reflect.compareMethods(this.__listeners[i],listener)) { + this.__listeners.splice(i,1); + this.__priorities.splice(i,1); + this.__repeat.splice(i,1); + } + } + ,__listeners: null + ,dispatch: function() { + this.canceled = false; + var listeners = this.__listeners; + var repeat = this.__repeat; + var i = 0; + while(i < listeners.length) { + listeners[i](); + if(!repeat[i]) { + this.remove(listeners[i]); + } else { + ++i; + } + if(this.canceled) { + break; + } + } + } + ,__class__: lime_app_Event_$Void_$Void +}; +var lime_Assets = function() { }; +$hxClasses["lime.Assets"] = lime_Assets; +lime_Assets.__name__ = ["lime","Assets"]; +lime_Assets.exists = function(id,type) { + lime_Assets.initialize(); + if(type == null) { + type = "BINARY"; + } + var libraryName = id.substring(0,id.indexOf(":")); + var symbolName = HxOverrides.substr(id,id.indexOf(":") + 1,null); + var library = lime_Assets.getLibrary(libraryName); + if(library != null) { + return library.exists(symbolName,type); + } + return false; +}; +lime_Assets.getBytes = function(id) { + lime_Assets.initialize(); + var libraryName = id.substring(0,id.indexOf(":")); + var symbolName = HxOverrides.substr(id,id.indexOf(":") + 1,null); + var library = lime_Assets.getLibrary(libraryName); + if(library != null) { + if(library.exists(symbolName,"BINARY")) { + if(library.isLocal(symbolName,"BINARY")) { + return library.getBytes(symbolName); + } else { + haxe_Log.trace("[Assets] String or Bytes asset \"" + id + "\" exists, but only asynchronously",{ fileName : "Assets.hx", lineNumber : 171, className : "lime.Assets", methodName : "getBytes"}); + } + } else { + haxe_Log.trace("[Assets] There is no String or Bytes asset with an ID of \"" + id + "\"",{ fileName : "Assets.hx", lineNumber : 177, className : "lime.Assets", methodName : "getBytes"}); + } + } else { + haxe_Log.trace("[Assets] There is no asset library named \"" + libraryName + "\"",{ fileName : "Assets.hx", lineNumber : 183, className : "lime.Assets", methodName : "getBytes"}); + } + return null; +}; +lime_Assets.getImage = function(id,useCache) { + if(useCache == null) { + useCache = true; + } + lime_Assets.initialize(); + if(useCache && lime_Assets.cache.enabled && lime_Assets.cache.image.exists(id)) { + var image = lime_Assets.cache.image.get(id); + if(lime_Assets.isValidImage(image)) { + return image; + } + } + var libraryName = id.substring(0,id.indexOf(":")); + var symbolName = HxOverrides.substr(id,id.indexOf(":") + 1,null); + var library = lime_Assets.getLibrary(libraryName); + if(library != null) { + if(library.exists(symbolName,"IMAGE")) { + if(library.isLocal(symbolName,"IMAGE")) { + var image1 = library.getImage(symbolName); + if(useCache && lime_Assets.cache.enabled) { + lime_Assets.cache.image.set(id,image1); + } + return image1; + } else { + haxe_Log.trace("[Assets] Image asset \"" + id + "\" exists, but only asynchronously",{ fileName : "Assets.hx", lineNumber : 304, className : "lime.Assets", methodName : "getImage"}); + } + } else { + haxe_Log.trace("[Assets] There is no Image asset with an ID of \"" + id + "\"",{ fileName : "Assets.hx", lineNumber : 310, className : "lime.Assets", methodName : "getImage"}); + } + } else { + haxe_Log.trace("[Assets] There is no asset library named \"" + libraryName + "\"",{ fileName : "Assets.hx", lineNumber : 316, className : "lime.Assets", methodName : "getImage"}); + } + return null; +}; +lime_Assets.getLibrary = function(name) { + if(name == null || name == "") { + name = "default"; + } + return lime_Assets.libraries.get(name); +}; +lime_Assets.getPath = function(id) { + lime_Assets.initialize(); + var libraryName = id.substring(0,id.indexOf(":")); + var symbolName = HxOverrides.substr(id,id.indexOf(":") + 1,null); + var library = lime_Assets.getLibrary(libraryName); + if(library != null) { + if(library.exists(symbolName,null)) { + return library.getPath(symbolName); + } else { + haxe_Log.trace("[Assets] There is no asset with an ID of \"" + id + "\"",{ fileName : "Assets.hx", lineNumber : 364, className : "lime.Assets", methodName : "getPath"}); + } + } else { + haxe_Log.trace("[Assets] There is no asset library named \"" + libraryName + "\"",{ fileName : "Assets.hx", lineNumber : 370, className : "lime.Assets", methodName : "getPath"}); + } + return null; +}; +lime_Assets.getText = function(id) { + lime_Assets.initialize(); + var libraryName = id.substring(0,id.indexOf(":")); + var symbolName = HxOverrides.substr(id,id.indexOf(":") + 1,null); + var library = lime_Assets.getLibrary(libraryName); + if(library != null) { + if(library.exists(symbolName,"TEXT")) { + if(library.isLocal(symbolName,"TEXT")) { + return library.getText(symbolName); + } else { + haxe_Log.trace("[Assets] String asset \"" + id + "\" exists, but only asynchronously",{ fileName : "Assets.hx", lineNumber : 407, className : "lime.Assets", methodName : "getText"}); + } + } else { + haxe_Log.trace("[Assets] There is no String asset with an ID of \"" + id + "\"",{ fileName : "Assets.hx", lineNumber : 413, className : "lime.Assets", methodName : "getText"}); + } + } else { + haxe_Log.trace("[Assets] There is no asset library named \"" + libraryName + "\"",{ fileName : "Assets.hx", lineNumber : 419, className : "lime.Assets", methodName : "getText"}); + } + return null; +}; +lime_Assets.initialize = function() { + if(!lime_Assets.initialized) { + lime_Assets.registerLibrary("default",new DefaultAssetLibrary()); + lime_Assets.initialized = true; + } +}; +lime_Assets.isValidImage = function(buffer) { + return true; +}; +lime_Assets.list = function(type) { + lime_Assets.initialize(); + var items = []; + var library = lime_Assets.libraries.iterator(); + while(library.hasNext()) { + var library1 = library.next(); + var libraryItems = library1.list(type); + if(libraryItems != null) { + items = items.concat(libraryItems); + } + } + return items; +}; +lime_Assets.loadImage = function(id,useCache) { + if(useCache == null) { + useCache = true; + } + lime_Assets.initialize(); + var promise = new lime_app_Promise(); + if(useCache && lime_Assets.cache.enabled && lime_Assets.cache.image.exists(id)) { + var image = lime_Assets.cache.image.get(id); + if(lime_Assets.isValidImage(image)) { + promise.complete(image); + return promise.future; + } + } + var libraryName = id.indexOf(":"); + var libraryName1 = id.substring(0,libraryName); + var pos = id.indexOf(":") + 1; + var symbolName = HxOverrides.substr(id,pos,null); + var library = lime_Assets.getLibrary(libraryName1); + if(library != null) { + if(library.exists(symbolName,"IMAGE")) { + var future = library.loadImage(symbolName); + if(useCache && lime_Assets.cache.enabled) { + future.onComplete(function(image1) { + lime_Assets.cache.image.set(id,image1); + }); + } + promise.completeWith(future); + } else { + promise.error("[Assets] There is no Image asset with an ID of \"" + id + "\""); + } + } else { + promise.error("[Assets] There is no asset library named \"" + libraryName1 + "\""); + } + return promise.future; +}; +lime_Assets.registerLibrary = function(name,library) { + if(lime_Assets.libraries.exists(name)) { + if(lime_Assets.libraries.get(name) == library) { + return; + } else { + lime_Assets.unloadLibrary(name); + } + } + if(library != null) { + library.onChange.add(lime_Assets.library_onChange); + } + lime_Assets.libraries.set(name,library); +}; +lime_Assets.unloadLibrary = function(name) { + lime_Assets.initialize(); + var library = lime_Assets.libraries.get(name); + if(library != null) { + lime_Assets.cache.clear(name + ":"); + library.onChange.remove(lime_Assets.library_onChange); + library.unload(); + } + lime_Assets.libraries.remove(name); +}; +lime_Assets.library_onChange = function() { + lime_Assets.cache.clear(); + lime_Assets.onChange.dispatch(); +}; +var lime__$backend_html5_HTML5Application = function(parent) { + this.gameDeviceCache = new haxe_ds_IntMap(); + this.parent = parent; + this.currentUpdate = 0; + this.lastUpdate = 0; + this.nextUpdate = 0; + this.framePeriod = -1; +}; +$hxClasses["lime._backend.html5.HTML5Application"] = lime__$backend_html5_HTML5Application; +lime__$backend_html5_HTML5Application.__name__ = ["lime","_backend","html5","HTML5Application"]; +lime__$backend_html5_HTML5Application.prototype = { + gameDeviceCache: null + ,currentUpdate: null + ,deltaTime: null + ,framePeriod: null + ,lastUpdate: null + ,nextUpdate: null + ,parent: null + ,convertKeyCode: function(keyCode) { + if(keyCode >= 65 && keyCode <= 90) { + return keyCode + 32; + } + switch(keyCode) { + case 16: + return 1073742049; + case 17: + return 1073742048; + case 18: + return 1073742050; + case 20: + return 1073741881; + case 33: + return 1073741899; + case 34: + return 1073741902; + case 35: + return 1073741901; + case 36: + return 1073741898; + case 37: + return 1073741904; + case 38: + return 1073741906; + case 39: + return 1073741903; + case 40: + return 1073741905; + case 45: + return 1073741897; + case 46: + return 127; + case 112: + return 1073741882; + case 113: + return 1073741883; + case 114: + return 1073741884; + case 115: + return 1073741885; + case 116: + return 1073741886; + case 117: + return 1073741887; + case 118: + return 1073741888; + case 119: + return 1073741889; + case 120: + return 1073741890; + case 121: + return 1073741891; + case 122: + return 1073741892; + case 123: + return 1073741893; + case 124: + return 1073741928; + case 125: + return 1073741929; + case 126: + return 1073741930; + case 144: + return 1073741907; + case 186: + return 59; + case 187: + return 61; + case 188: + return 44; + case 189: + return 45; + case 190: + return 46; + case 191: + return 47; + case 192: + return 96; + case 219: + return 91; + case 220: + return 92; + case 221: + return 93; + case 222: + return 39; + } + return keyCode; + } + ,create: function(config) { + } + ,exec: function() { + js_Browser.get_window().addEventListener("keydown",$bind(this,this.handleKeyEvent),false); + js_Browser.get_window().addEventListener("keyup",$bind(this,this.handleKeyEvent),false); + js_Browser.get_window().addEventListener("focus",$bind(this,this.handleWindowEvent),false); + js_Browser.get_window().addEventListener("blur",$bind(this,this.handleWindowEvent),false); + js_Browser.get_window().addEventListener("resize",$bind(this,this.handleWindowEvent),false); + js_Browser.get_window().addEventListener("unload",$bind(this,this.handleWindowEvent),false); + + if (!CanvasRenderingContext2D.prototype.isPointInStroke) { + CanvasRenderingContext2D.prototype.isPointInStroke = function (path, x, y) { + return false; + }; + } + + var lastTime = 0; + var vendors = ['ms', 'moz', 'webkit', 'o']; + for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { + window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame']; + window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame']; + } + + if (!window.requestAnimationFrame) + window.requestAnimationFrame = function(callback, element) { + var currTime = new Date().getTime(); + var timeToCall = Math.max(0, 16 - (currTime - lastTime)); + var id = window.setTimeout(function() { callback(currTime + timeToCall); }, + timeToCall); + lastTime = currTime + timeToCall; + return id; + }; + + if (!window.cancelAnimationFrame) + window.cancelAnimationFrame = function(id) { + clearTimeout(id); + }; + + window.requestAnimFrame = window.requestAnimationFrame; + ; + this.lastUpdate = new Date().getTime(); + this.handleApplicationEvent(); + return 0; + } + ,exit: function() { + } + ,handleApplicationEvent: function(__) { + this.updateGameDevices(); + this.currentUpdate = new Date().getTime(); + if(this.currentUpdate >= this.nextUpdate) { + this.deltaTime = this.currentUpdate - this.lastUpdate; + this.parent.onUpdate.dispatch(Std["int"](this.deltaTime)); + if(this.parent.get_renderer() != null) { + this.parent.get_renderer().onRender.dispatch(); + this.parent.get_renderer().flip(); + } + if(this.framePeriod < 0) { + this.nextUpdate = this.currentUpdate; + this.nextUpdate = this.currentUpdate; + } else { + this.nextUpdate = this.currentUpdate + this.framePeriod; + } + this.lastUpdate = this.currentUpdate; + } + js_Browser.get_window().requestAnimationFrame($bind(this,this.handleApplicationEvent)); + } + ,handleKeyEvent: function(event) { + if(this.parent.get_window() != null) { + var keyCode = this.convertKeyCode(event.keyCode != null ? event.keyCode : event.which); + var modifier = (event.shiftKey ? 3 : 0) | (event.ctrlKey ? 192 : 0) | (event.altKey ? 768 : 0) | (event.metaKey ? 3072 : 0); + if(event.type == "keydown") { + this.parent.get_window().onKeyDown.dispatch(keyCode,modifier); + if(this.parent.get_window().onKeyDown.canceled) { + event.preventDefault(); + } + } else { + this.parent.get_window().onKeyUp.dispatch(keyCode,modifier); + if(this.parent.get_window().onKeyUp.canceled) { + event.preventDefault(); + } + } + } + } + ,handleWindowEvent: function(event) { + if(this.parent.get_window() != null) { + var _g = event.type; + switch(_g) { + case "blur": + this.parent.get_window().onFocusOut.dispatch(); + this.parent.get_window().onDeactivate.dispatch(); + break; + case "focus": + this.parent.get_window().onFocusIn.dispatch(); + this.parent.get_window().onActivate.dispatch(); + break; + case "resize": + var cacheWidth = this.parent.get_window().get_width(); + var cacheHeight = this.parent.get_window().get_height(); + this.parent.get_window().backend.handleResize(); + if(this.parent.get_window().get_width() != cacheWidth || this.parent.get_window().get_height() != cacheHeight) { + this.parent.get_window().onResize.dispatch(this.parent.get_window().get_width(),this.parent.get_window().get_height()); + } + break; + case "unload": + this.parent.get_window().onClose.dispatch(); + break; + } + } + } + ,setFrameRate: function(value) { + if(value >= 60) { + this.framePeriod = -1; + } else if(value > 0) { + this.framePeriod = 1000 / value; + } else { + this.framePeriod = 1000; + } + return value; + } + ,updateGameDevices: function() { + var devices = lime_ui_Joystick.__getDeviceData(); + if(devices == null) { + return; + } + var id; + var gamepad; + var joystick; + var data; + var cache; + var _g1 = 0; + var _g = devices.length; + while(_g1 < _g) { + var i = _g1++; + id = i; + data = devices[id]; + if(data == null) { + continue; + } + if(!this.gameDeviceCache.exists(id)) { + cache = new lime__$backend_html5_GameDeviceData(); + cache.id = id; + cache.connected = data.connected; + var _g3 = 0; + var _g2 = data.buttons.length; + while(_g3 < _g2) { + var i1 = _g3++; + cache.buttons.push(data.buttons[i1].value); + } + var _g31 = 0; + var _g21 = data.axes.length; + while(_g31 < _g21) { + var i2 = _g31++; + cache.axes.push(data.axes[i2]); + } + if(data.mapping == "standard") { + cache.isGamepad = true; + } + this.gameDeviceCache.set(id,cache); + if(data.connected) { + lime_ui_Joystick.__connect(id); + if(cache.isGamepad) { + lime_ui_Gamepad.__connect(id); + } + } + } + cache = this.gameDeviceCache.get(id); + joystick = lime_ui_Joystick.devices.get(id); + gamepad = lime_ui_Gamepad.devices.get(id); + if(data.connected) { + var button; + var value; + var _g32 = 0; + var _g22 = data.buttons.length; + while(_g32 < _g22) { + var i3 = _g32++; + value = data.buttons[i3].value; + if(value != cache.buttons[i3]) { + if(i3 == 6) { + joystick.onAxisMove.dispatch(data.axes.length,value); + if(gamepad != null) { + gamepad.onAxisMove.dispatch(4,value); + } + } else if(i3 == 7) { + joystick.onAxisMove.dispatch(data.axes.length + 1,value); + if(gamepad != null) { + gamepad.onAxisMove.dispatch(5,value); + } + } else { + if(value > 0) { + joystick.onButtonDown.dispatch(i3); + } else { + joystick.onButtonUp.dispatch(i3); + } + if(gamepad != null) { + switch(i3) { + case 0: + button = 0; + break; + case 1: + button = 1; + break; + case 2: + button = 2; + break; + case 3: + button = 3; + break; + case 4: + button = 9; + break; + case 5: + button = 10; + break; + case 8: + button = 4; + break; + case 9: + button = 6; + break; + case 10: + button = 7; + break; + case 11: + button = 8; + break; + case 12: + button = 11; + break; + case 13: + button = 12; + break; + case 14: + button = 13; + break; + case 15: + button = 14; + break; + case 16: + button = 5; + break; + default: + continue; + } + if(value > 0) { + gamepad.onButtonDown.dispatch(button); + } else { + gamepad.onButtonUp.dispatch(button); + } + } + } + cache.buttons[i3] = value; + } + } + var _g33 = 0; + var _g23 = data.axes.length; + while(_g33 < _g23) { + var i4 = _g33++; + if(data.axes[i4] != cache.axes[i4]) { + joystick.onAxisMove.dispatch(i4,data.axes[i4]); + if(gamepad != null) { + gamepad.onAxisMove.dispatch(i4,data.axes[i4]); + } + cache.axes[i4] = data.axes[i4]; + } + } + } else if(cache.connected) { + cache.connected = false; + lime_ui_Joystick.__disconnect(id); + lime_ui_Gamepad.__disconnect(id); + } + } + } + ,__class__: lime__$backend_html5_HTML5Application +}; +var lime__$backend_html5_GameDeviceData = function() { + this.connected = true; + this.buttons = []; + this.axes = []; +}; +$hxClasses["lime._backend.html5.GameDeviceData"] = lime__$backend_html5_GameDeviceData; +lime__$backend_html5_GameDeviceData.__name__ = ["lime","_backend","html5","GameDeviceData"]; +lime__$backend_html5_GameDeviceData.prototype = { + connected: null + ,id: null + ,isGamepad: null + ,buttons: null + ,axes: null + ,__class__: lime__$backend_html5_GameDeviceData +}; +var lime__$backend_html5_HTML5Mouse = function() { }; +$hxClasses["lime._backend.html5.HTML5Mouse"] = lime__$backend_html5_HTML5Mouse; +lime__$backend_html5_HTML5Mouse.__name__ = ["lime","_backend","html5","HTML5Mouse"]; +lime__$backend_html5_HTML5Mouse.__cursor = null; +lime__$backend_html5_HTML5Mouse.__hidden = null; +lime__$backend_html5_HTML5Mouse.set_cursor = function(value) { + if(lime__$backend_html5_HTML5Mouse.__cursor != value) { + if(!lime__$backend_html5_HTML5Mouse.__hidden) { + var _g = 0; + var _g1 = lime_app_Application.current.windows; + while(_g < _g1.length) { + var $window = _g1[_g]; + ++_g; + var tmp; + switch(Type.enumIndex(value)) { + case 0: + tmp = "default"; + break; + case 1: + tmp = "crosshair"; + break; + case 3: + tmp = "move"; + break; + case 4: + tmp = "pointer"; + break; + case 5: + tmp = "nesw-resize"; + break; + case 6: + tmp = "ns-resize"; + break; + case 7: + tmp = "nwse-resize"; + break; + case 8: + tmp = "ew-resize"; + break; + case 9: + tmp = "text"; + break; + case 10: + tmp = "wait"; + break; + case 11: + tmp = "wait"; + break; + default: + tmp = "auto"; + } + $window.backend.element.style.cursor = tmp; + } + } + lime__$backend_html5_HTML5Mouse.__cursor = value; + } + return lime__$backend_html5_HTML5Mouse.__cursor; +}; +var lime__$backend_html5_HTML5Renderer = function(parent) { + this.parent = parent; +}; +$hxClasses["lime._backend.html5.HTML5Renderer"] = lime__$backend_html5_HTML5Renderer; +lime__$backend_html5_HTML5Renderer.__name__ = ["lime","_backend","html5","HTML5Renderer"]; +lime__$backend_html5_HTML5Renderer.prototype = { + parent: null + ,create: function() { + this.createContext(); + var _g = this.parent.context; + if(Type.enumIndex(_g) == 0) { + this.parent.window.backend.canvas.addEventListener("webglcontextlost",$bind(this,this.handleEvent),false); + this.parent.window.backend.canvas.addEventListener("webglcontextrestored",$bind(this,this.handleEvent),false); + } + } + ,createContext: function() { + if(this.parent.window.backend.div != null) { + this.parent.context = lime_graphics_RenderContext.DOM(this.parent.window.backend.div); + this.parent.type = lime_graphics_RendererType.DOM; + } else if(this.parent.window.backend.canvas != null) { + var webgl = null; + var options = { alpha : false, antialias : Reflect.hasField(this.parent.window.config,"antialiasing") && this.parent.window.config.antialiasing > 0, depth : Reflect.hasField(this.parent.window.config,"depthBuffer") ? this.parent.window.config.depthBuffer : true, premultipliedAlpha : false, stencil : Reflect.hasField(this.parent.window.config,"stencilBuffer") && this.parent.window.config.stencilBuffer, preserveDrawingBuffer : false}; + webgl = js_html__$CanvasElement_CanvasUtil.getContextWebGL(this.parent.window.backend.canvas,options); + if(webgl == null) { + this.parent.context = lime_graphics_RenderContext.CANVAS(this.parent.window.backend.canvas.getContext("2d")); + this.parent.type = lime_graphics_RendererType.CANVAS; + } else { + lime_graphics_opengl_GL.context = webgl; + this.parent.context = lime_graphics_RenderContext.OPENGL(lime_graphics_opengl_GL.context); + this.parent.type = lime_graphics_RendererType.OPENGL; + } + } + } + ,flip: function() { + } + ,handleEvent: function(event) { + var _g = event.type; + switch(_g) { + case "webglcontextlost": + event.preventDefault(); + this.parent.context = null; + this.parent.onContextLost.dispatch(); + break; + case "webglcontextrestored": + this.createContext(); + this.parent.onContextRestored.dispatch(this.parent.context); + break; + default: + } + } + ,__class__: lime__$backend_html5_HTML5Renderer +}; +var lime__$backend_html5_HTML5Window = function(parent) { + this.unusedTouchesPool = new List(); + this.currentTouches = new haxe_ds_IntMap(); + this.parent = parent; + if(parent.config != null && Reflect.hasField(parent.config,"element")) { + this.element = parent.config.element; + } +}; +$hxClasses["lime._backend.html5.HTML5Window"] = lime__$backend_html5_HTML5Window; +lime__$backend_html5_HTML5Window.__name__ = ["lime","_backend","html5","HTML5Window"]; +lime__$backend_html5_HTML5Window.prototype = { + canvas: null + ,div: null + ,element: null + ,currentTouches: null + ,parent: null + ,primaryTouch: null + ,setHeight: null + ,setWidth: null + ,unusedTouchesPool: null + ,close: function() { + this.parent.application.removeWindow(this.parent); + } + ,create: function(application) { + this.setWidth = this.parent.get_width(); + this.setHeight = this.parent.get_height(); + this.parent.id = lime__$backend_html5_HTML5Window.windowID++; + if(Std["is"](this.element,HTMLCanvasElement)) { + this.canvas = this.element; + } else { + this.canvas = js_Browser.get_document().createElement("canvas"); + } + if(this.canvas != null) { + var style = this.canvas.style; + style.setProperty("-webkit-transform","translateZ(0)",null); + style.setProperty("transform","translateZ(0)",null); + } else if(this.div != null) { + var style1 = this.div.style; + style1.setProperty("-webkit-transform","translate3D(0,0,0)",null); + style1.setProperty("transform","translate3D(0,0,0)",null); + style1.position = "relative"; + style1.overflow = "hidden"; + style1.setProperty("-webkit-user-select","none",null); + style1.setProperty("-moz-user-select","none",null); + style1.setProperty("-ms-user-select","none",null); + style1.setProperty("-o-user-select","none",null); + } + if(this.parent.get_width() == 0 && this.parent.get_height() == 0) { + if(this.element != null) { + this.parent.set_width(this.element.clientWidth); + this.parent.set_height(this.element.clientHeight); + } else { + this.parent.set_width(js_Browser.get_window().innerWidth); + this.parent.set_height(js_Browser.get_window().innerHeight); + } + this.parent.set_fullscreen(true); + } + if(this.canvas != null) { + this.canvas.width = this.parent.get_width(); + this.canvas.height = this.parent.get_height(); + } else { + var tmp = this.parent.get_width(); + this.div.style.width = tmp + "px"; + var tmp1 = this.parent.get_height(); + this.div.style.height = tmp1 + "px"; + } + this.handleResize(); + if(this.element != null) { + if(this.canvas != null) { + if(this.element != this.canvas) { + this.element.appendChild(this.canvas); + } + } else { + this.element.appendChild(this.div); + } + var events = ["mousedown","mouseenter","mouseleave","mousemove","mouseup","wheel"]; + var _g = 0; + while(_g < events.length) { + var event = events[_g]; + ++_g; + this.element.addEventListener(event,$bind(this,this.handleMouseEvent),true); + } + js_Browser.get_document().addEventListener("dragstart",function(e) { + if(e.target.nodeName.toLowerCase() == "img") { + e.preventDefault(); + return false; + } + return true; + },false); + this.element.addEventListener("touchstart",$bind(this,this.handleTouchEvent),true); + this.element.addEventListener("touchmove",$bind(this,this.handleTouchEvent),true); + this.element.addEventListener("touchend",$bind(this,this.handleTouchEvent),true); + this.element.addEventListener("gamepadconnected",$bind(this,this.handleGamepadEvent),true); + this.element.addEventListener("gamepaddisconnected",$bind(this,this.handleGamepadEvent),true); + } + } + ,handleGamepadEvent: function(event) { + var _g = event.type; + switch(_g) { + case "gamepadconnected": + lime_ui_Joystick.__connect(event.gamepad.index); + if(event.gamepad.mapping == "standard") { + lime_ui_Gamepad.__connect(event.gamepad.index); + } + break; + case "gamepaddisconnected": + lime_ui_Joystick.__disconnect(event.gamepad.index); + lime_ui_Gamepad.__disconnect(event.gamepad.index); + break; + default: + } + } + ,handleMouseEvent: function(event) { + var x = 0.0; + var y = 0.0; + if(event.type != "wheel") { + if(this.element != null) { + if(this.canvas != null) { + var rect = this.canvas.getBoundingClientRect(); + x = (event.clientX - rect.left) * (this.parent.get_width() / rect.width); + y = (event.clientY - rect.top) * (this.parent.get_height() / rect.height); + } else if(this.div != null) { + var rect1 = this.div.getBoundingClientRect(); + x = event.clientX - rect1.left; + y = event.clientY - rect1.top; + } else { + var rect2 = this.element.getBoundingClientRect(); + x = (event.clientX - rect2.left) * (this.parent.get_width() / rect2.width); + y = (event.clientY - rect2.top) * (this.parent.get_height() / rect2.height); + } + } else { + x = event.clientX; + y = event.clientY; + } + var _g = event.type; + switch(_g) { + case "mousedown": + this.parent.onMouseDown.dispatch(x,y,event.button); + break; + case "mouseenter": + this.parent.onEnter.dispatch(); + break; + case "mouseleave": + this.parent.onLeave.dispatch(); + break; + case "mousemove": + this.parent.onMouseMove.dispatch(x,y); + break; + case "mouseup": + this.parent.onMouseUp.dispatch(x,y,event.button); + break; + default: + } + } else { + this.parent.onMouseWheel.dispatch(event.deltaX,-event.deltaY); + } + } + ,handleResize: function() { + var stretch = this.parent.get_fullscreen() || this.setWidth == 0 && this.setHeight == 0; + if(this.element != null && (this.div == null || this.div != null && stretch)) { + if(stretch) { + if(this.parent.get_width() != this.element.clientWidth || this.parent.get_height() != this.element.clientHeight) { + this.parent.set_width(this.element.clientWidth); + this.parent.set_height(this.element.clientHeight); + if(this.canvas != null) { + if(this.element != this.canvas) { + this.canvas.width = this.element.clientWidth; + this.canvas.height = this.element.clientHeight; + } + } else { + this.div.style.width = this.element.clientWidth + "px"; + this.div.style.height = this.element.clientHeight + "px"; + } + } + } else { + var scaleX = this.element.clientWidth / this.setWidth; + var scaleY = this.element.clientHeight / this.setHeight; + var currentRatio = scaleX / scaleY; + var targetRatio = Math.min(scaleX,scaleY); + if(this.canvas != null) { + if(this.element != this.canvas) { + this.canvas.style.width = this.setWidth * targetRatio + "px"; + this.canvas.style.height = this.setHeight * targetRatio + "px"; + this.canvas.style.marginLeft = (this.element.clientWidth - this.setWidth * targetRatio) / 2 + "px"; + this.canvas.style.marginTop = (this.element.clientHeight - this.setHeight * targetRatio) / 2 + "px"; + } + } else { + this.div.style.width = this.setWidth * targetRatio + "px"; + this.div.style.height = this.setHeight * targetRatio + "px"; + this.div.style.marginLeft = (this.element.clientWidth - this.setWidth * targetRatio) / 2 + "px"; + this.div.style.marginTop = (this.element.clientHeight - this.setHeight * targetRatio) / 2 + "px"; + } + } + } + } + ,handleTouchEvent: function(event) { + event.preventDefault(); + var rect = null; + if(this.element != null) { + if(this.canvas != null) { + rect = this.canvas.getBoundingClientRect(); + } else if(this.div != null) { + rect = this.div.getBoundingClientRect(); + } else { + rect = this.element.getBoundingClientRect(); + } + } + var windowWidth = this.setWidth; + var windowHeight = this.setHeight; + if(windowWidth == 0 || windowHeight == 0) { + if(rect != null) { + windowWidth = rect.width; + windowHeight = rect.height; + } else { + windowWidth = 1; + windowHeight = 1; + } + } + var _g = 0; + var _g1 = event.changedTouches; + while(_g < _g1.length) { + var data = _g1[_g]; + ++_g; + var x = 0.0; + var y = 0.0; + if(rect != null) { + x = (data.clientX - rect.left) * (windowWidth / rect.width); + y = (data.clientY - rect.top) * (windowHeight / rect.height); + } else { + x = data.clientX; + y = data.clientY; + } + var _g2 = event.type; + switch(_g2) { + case "touchend": + var touch = this.currentTouches.get(data.identifier); + if(touch != null) { + var cacheX = touch.x; + var cacheY = touch.y; + touch.x = x / windowWidth; + touch.y = y / windowHeight; + touch.dx = touch.x - cacheX; + touch.dy = touch.y - cacheY; + touch.pressure = data.force; + lime_ui_Touch.onEnd.dispatch(touch); + this.currentTouches.remove(data.identifier); + this.unusedTouchesPool.add(touch); + if(touch == this.primaryTouch) { + this.parent.onMouseUp.dispatch(x,y,0); + this.primaryTouch = null; + } + } + break; + case "touchmove": + var touch1 = this.currentTouches.get(data.identifier); + if(touch1 != null) { + var cacheX1 = touch1.x; + var cacheY1 = touch1.y; + touch1.x = x / windowWidth; + touch1.y = y / windowHeight; + touch1.dx = touch1.x - cacheX1; + touch1.dy = touch1.y - cacheY1; + touch1.pressure = data.force; + lime_ui_Touch.onMove.dispatch(touch1); + if(touch1 == this.primaryTouch) { + this.parent.onMouseMove.dispatch(x,y); + } + } + break; + case "touchstart": + var touch2 = this.unusedTouchesPool.pop(); + if(touch2 == null) { + touch2 = new lime_ui_Touch(x / windowWidth,y / windowHeight,data.identifier,0,0,data.force,this.parent.id); + } else { + touch2.x = x / windowWidth; + touch2.y = y / windowHeight; + touch2.id = data.identifier; + touch2.dx = 0; + touch2.dy = 0; + touch2.pressure = data.force; + touch2.device = this.parent.id; + } + this.currentTouches.set(data.identifier,touch2); + lime_ui_Touch.onStart.dispatch(touch2); + if(this.primaryTouch == null) { + this.primaryTouch = touch2; + } + if(touch2 == this.primaryTouch) { + this.parent.onMouseDown.dispatch(x,y,0); + } + break; + default: + } + } + } + ,resize: function(width,height) { + } + ,setFullscreen: function(value) { + return false; + } + ,__class__: lime__$backend_html5_HTML5Window +}; +var lime_app_IModule = function() { }; +$hxClasses["lime.app.IModule"] = lime_app_IModule; +lime_app_IModule.__name__ = ["lime","app","IModule"]; +lime_app_IModule.prototype = { + onGamepadAxisMove: null + ,onGamepadButtonDown: null + ,onGamepadButtonUp: null + ,onGamepadConnect: null + ,onGamepadDisconnect: null + ,onJoystickAxisMove: null + ,onJoystickButtonDown: null + ,onJoystickButtonUp: null + ,onJoystickConnect: null + ,onJoystickDisconnect: null + ,onJoystickHatMove: null + ,onJoystickTrackballMove: null + ,onKeyDown: null + ,onKeyUp: null + ,onModuleExit: null + ,onMouseDown: null + ,onMouseMove: null + ,onMouseMoveRelative: null + ,onMouseUp: null + ,onMouseWheel: null + ,onPreloadComplete: null + ,onPreloadProgress: null + ,onRenderContextLost: null + ,onRenderContextRestored: null + ,onTextEdit: null + ,onTextInput: null + ,onTouchEnd: null + ,onTouchMove: null + ,onTouchStart: null + ,onWindowActivate: null + ,onWindowClose: null + ,onWindowCreate: null + ,onWindowDeactivate: null + ,onWindowDropFile: null + ,onWindowEnter: null + ,onWindowFocusIn: null + ,onWindowFocusOut: null + ,onWindowFullscreen: null + ,onWindowLeave: null + ,onWindowMove: null + ,onWindowMinimize: null + ,onWindowResize: null + ,onWindowRestore: null + ,render: null + ,update: null + ,__class__: lime_app_IModule +}; +var lime_app_Module = function() { + this.onExit = new lime_app_Event_$Int_$Void(); +}; +$hxClasses["lime.app.Module"] = lime_app_Module; +lime_app_Module.__name__ = ["lime","app","Module"]; +lime_app_Module.__interfaces__ = [lime_app_IModule]; +lime_app_Module.prototype = { + onExit: null + ,onGamepadAxisMove: function(gamepad,axis,value) { + } + ,onGamepadButtonDown: function(gamepad,button) { + } + ,onGamepadButtonUp: function(gamepad,button) { + } + ,onGamepadConnect: function(gamepad) { + haxe_Log.trace("onGamepadConnect (module)",{ fileName : "Module.hx", lineNumber : 64, className : "lime.app.Module", methodName : "onGamepadConnect"}); + } + ,onGamepadDisconnect: function(gamepad) { + } + ,onJoystickAxisMove: function(joystick,axis,value) { + } + ,onJoystickButtonDown: function(joystick,button) { + } + ,onJoystickButtonUp: function(joystick,button) { + } + ,onJoystickConnect: function(joystick) { + } + ,onJoystickDisconnect: function(joystick) { + } + ,onJoystickHatMove: function(joystick,hat,position) { + } + ,onJoystickTrackballMove: function(joystick,trackball,value) { + } + ,onKeyDown: function(window,keyCode,modifier) { + } + ,onKeyUp: function(window,keyCode,modifier) { + } + ,onModuleExit: function(code) { + } + ,onMouseDown: function(window,x,y,button) { + } + ,onMouseMove: function(window,x,y) { + } + ,onMouseMoveRelative: function(window,x,y) { + } + ,onMouseUp: function(window,x,y,button) { + } + ,onMouseWheel: function(window,deltaX,deltaY) { + } + ,onPreloadComplete: function() { + } + ,onPreloadProgress: function(loaded,total) { + } + ,onRenderContextLost: function(renderer) { + } + ,onRenderContextRestored: function(renderer,context) { + } + ,onTextEdit: function(window,text,start,length) { + } + ,onTextInput: function(window,text) { + } + ,onTouchEnd: function(touch) { + } + ,onTouchMove: function(touch) { + } + ,onTouchStart: function(touch) { + } + ,onWindowActivate: function(window) { + } + ,onWindowClose: function(window) { + } + ,onWindowCreate: function(window) { + } + ,onWindowDeactivate: function(window) { + } + ,onWindowDropFile: function(window,file) { + } + ,onWindowEnter: function(window) { + } + ,onWindowFocusIn: function(window) { + } + ,onWindowFocusOut: function(window) { + } + ,onWindowFullscreen: function(window) { + } + ,onWindowLeave: function(window) { + } + ,onWindowMove: function(window,x,y) { + } + ,onWindowMinimize: function(window) { + } + ,onWindowResize: function(window,width,height) { + } + ,onWindowRestore: function(window) { + } + ,render: function(renderer) { + } + ,update: function(deltaTime) { + } + ,__class__: lime_app_Module +}; +var lime_app_Application = function() { + this.onUpdate = new lime_app_Event_$Int_$Void(); + lime_app_Module.call(this); + if(lime_app_Application.current == null) { + lime_app_Application.current = this; + } + this.modules = []; + this.renderers = []; + this.windows = []; + this.windowByID = new haxe_ds_IntMap(); + this.backend = new lime__$backend_html5_HTML5Application(this); + this.onExit.add($bind(this,this.onModuleExit)); + this.onUpdate.add($bind(this,this.update)); + lime_ui_Gamepad.onConnect.add($bind(this,this.__onGamepadConnect)); + lime_ui_Joystick.onConnect.add($bind(this,this.__onJoystickConnect)); + lime_ui_Touch.onStart.add($bind(this,this.onTouchStart)); + lime_ui_Touch.onMove.add($bind(this,this.onTouchMove)); + lime_ui_Touch.onEnd.add($bind(this,this.onTouchEnd)); +}; +$hxClasses["lime.app.Application"] = lime_app_Application; +lime_app_Application.__name__ = ["lime","app","Application"]; +lime_app_Application.current = null; +lime_app_Application.__super__ = lime_app_Module; +lime_app_Application.prototype = $extend(lime_app_Module.prototype,{ + config: null + ,modules: null + ,preloader: null + ,onUpdate: null + ,renderers: null + ,window: null + ,windows: null + ,backend: null + ,windowByID: null + ,addModule: function(module) { + this.modules.push(module); + if(this.windows.length > 0) { + var _g = 0; + var _g1 = this.windows; + while(_g < _g1.length) { + var $window = _g1[_g]; + ++_g; + module.onWindowCreate($window); + } + if(this.preloader == null || this.preloader.complete) { + module.onPreloadComplete(); + } + } + } + ,addRenderer: function(renderer) { + var f = $bind(this,this.render); + var a1 = renderer; + var tmp = function() { + f(a1); + }; + renderer.onRender.add(tmp); + var f1 = $bind(this,this.onRenderContextLost); + var a11 = renderer; + var tmp1 = function() { + f1(a11); + }; + renderer.onContextLost.add(tmp1); + var f2 = $bind(this,this.onRenderContextRestored); + var a12 = renderer; + var tmp2 = function(a2) { + f2(a12,a2); + }; + renderer.onContextRestored.add(tmp2); + this.renderers.push(renderer); + } + ,createWindow: function(window) { + var f = $bind(this,this.onWindowActivate); + var a1 = window; + var tmp = function() { + f(a1); + }; + window.onActivate.add(tmp); + var f1 = $bind(this,this.onWindowClose); + var a11 = window; + var tmp1 = function() { + f1(a11); + }; + window.onClose.add(tmp1); + var f2 = $bind(this,this.onWindowCreate); + var a12 = window; + var tmp2 = function() { + f2(a12); + }; + window.onCreate.add(tmp2); + var f3 = $bind(this,this.onWindowDeactivate); + var a13 = window; + var tmp3 = function() { + f3(a13); + }; + window.onDeactivate.add(tmp3); + var f4 = $bind(this,this.onWindowDropFile); + var a14 = window; + var tmp4 = function(a2) { + f4(a14,a2); + }; + window.onDropFile.add(tmp4); + var f5 = $bind(this,this.onWindowEnter); + var a15 = window; + var tmp5 = function() { + f5(a15); + }; + window.onEnter.add(tmp5); + var f6 = $bind(this,this.onWindowFocusIn); + var a16 = window; + var tmp6 = function() { + f6(a16); + }; + window.onFocusIn.add(tmp6); + var f7 = $bind(this,this.onWindowFocusOut); + var a17 = window; + var tmp7 = function() { + f7(a17); + }; + window.onFocusOut.add(tmp7); + var f8 = $bind(this,this.onWindowFullscreen); + var a18 = window; + var tmp8 = function() { + f8(a18); + }; + window.onFullscreen.add(tmp8); + var f9 = $bind(this,this.onKeyDown); + var a19 = window; + var tmp9 = function(a21,a3) { + f9(a19,a21,a3); + }; + window.onKeyDown.add(tmp9); + var f10 = $bind(this,this.onKeyUp); + var a110 = window; + var tmp10 = function(a22,a31) { + f10(a110,a22,a31); + }; + window.onKeyUp.add(tmp10); + var f11 = $bind(this,this.onWindowLeave); + var a111 = window; + var tmp11 = function() { + f11(a111); + }; + window.onLeave.add(tmp11); + var f12 = $bind(this,this.onWindowMinimize); + var a112 = window; + var tmp12 = function() { + f12(a112); + }; + window.onMinimize.add(tmp12); + var f13 = $bind(this,this.onMouseDown); + var a113 = window; + var tmp13 = function(x,y,a23) { + f13(a113,x,y,a23); + }; + window.onMouseDown.add(tmp13); + var f14 = $bind(this,this.onMouseMove); + var a114 = window; + var tmp14 = function(x1,y1) { + f14(a114,x1,y1); + }; + window.onMouseMove.add(tmp14); + var f15 = $bind(this,this.onMouseMoveRelative); + var a115 = window; + var tmp15 = function(x2,y2) { + f15(a115,x2,y2); + }; + window.onMouseMoveRelative.add(tmp15); + var f16 = $bind(this,this.onMouseUp); + var a116 = window; + var tmp16 = function(x3,y3,a24) { + f16(a116,x3,y3,a24); + }; + window.onMouseUp.add(tmp16); + var f17 = $bind(this,this.onMouseWheel); + var a117 = window; + var tmp17 = function(a25,a32) { + f17(a117,a25,a32); + }; + window.onMouseWheel.add(tmp17); + var f18 = $bind(this,this.onWindowMove); + var a118 = window; + var tmp18 = function(x4,y4) { + f18(a118,x4,y4); + }; + window.onMove.add(tmp18); + var f19 = $bind(this,this.onWindowResize); + var a119 = window; + var tmp19 = function(a26,a33) { + f19(a119,a26,a33); + }; + window.onResize.add(tmp19); + var f20 = $bind(this,this.onWindowRestore); + var a120 = window; + var tmp20 = function() { + f20(a120); + }; + window.onRestore.add(tmp20); + var f21 = $bind(this,this.onTextEdit); + var a121 = window; + var tmp21 = function(a27,a34,a4) { + f21(a121,a27,a34,a4); + }; + window.onTextEdit.add(tmp21); + var f22 = $bind(this,this.onTextInput); + var a122 = window; + var tmp22 = function(a28) { + f22(a122,a28); + }; + window.onTextInput.add(tmp22); + if(window.renderer == null) { + var renderer = new lime_graphics_Renderer(window); + this.addRenderer(renderer); + } + window.create(this); + this.windows.push(window); + this.windowByID.set(window.id,window); + window.onCreate.dispatch(); + } + ,exec: function() { + lime_app_Application.current = this; + return this.backend.exec(); + } + ,onGamepadAxisMove: function(gamepad,axis,value) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onGamepadAxisMove(gamepad,axis,value); + } + } + ,onGamepadButtonDown: function(gamepad,button) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onGamepadButtonDown(gamepad,button); + } + } + ,onGamepadButtonUp: function(gamepad,button) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onGamepadButtonUp(gamepad,button); + } + } + ,onGamepadConnect: function(gamepad) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onGamepadConnect(gamepad); + } + } + ,onGamepadDisconnect: function(gamepad) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onGamepadDisconnect(gamepad); + } + } + ,onJoystickAxisMove: function(joystick,axis,value) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onJoystickAxisMove(joystick,axis,value); + } + } + ,onJoystickButtonDown: function(joystick,button) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onJoystickButtonDown(joystick,button); + } + } + ,onJoystickButtonUp: function(joystick,button) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onJoystickButtonUp(joystick,button); + } + } + ,onJoystickConnect: function(joystick) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onJoystickConnect(joystick); + } + } + ,onJoystickDisconnect: function(joystick) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onJoystickDisconnect(joystick); + } + } + ,onJoystickHatMove: function(joystick,hat,position) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onJoystickHatMove(joystick,hat,position); + } + } + ,onJoystickTrackballMove: function(joystick,trackball,value) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onJoystickTrackballMove(joystick,trackball,value); + } + } + ,onKeyDown: function(window,keyCode,modifier) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onKeyDown(window,keyCode,modifier); + } + } + ,onKeyUp: function(window,keyCode,modifier) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onKeyUp(window,keyCode,modifier); + } + } + ,onModuleExit: function(code) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onModuleExit(code); + } + this.backend.exit(); + } + ,onMouseDown: function(window,x,y,button) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onMouseDown(window,x,y,button); + } + } + ,onMouseMove: function(window,x,y) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onMouseMove(window,x,y); + } + } + ,onMouseMoveRelative: function(window,x,y) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onMouseMoveRelative(window,x,y); + } + } + ,onMouseUp: function(window,x,y,button) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onMouseUp(window,x,y,button); + } + } + ,onMouseWheel: function(window,deltaX,deltaY) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onMouseWheel(window,deltaX,deltaY); + } + } + ,onPreloadComplete: function() { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onPreloadComplete(); + } + } + ,onPreloadProgress: function(loaded,total) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onPreloadProgress(loaded,total); + } + } + ,onRenderContextLost: function(renderer) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onRenderContextLost(renderer); + } + } + ,onRenderContextRestored: function(renderer,context) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onRenderContextRestored(renderer,context); + } + } + ,onTextEdit: function(window,text,start,length) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onTextEdit(window,text,start,length); + } + } + ,onTextInput: function(window,text) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onTextInput(window,text); + } + } + ,onTouchEnd: function(touch) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onTouchEnd(touch); + } + } + ,onTouchMove: function(touch) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onTouchMove(touch); + } + } + ,onTouchStart: function(touch) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onTouchStart(touch); + } + } + ,onWindowActivate: function(window) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onWindowActivate(window); + } + } + ,onWindowClose: function(window) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onWindowClose(window); + } + this.removeWindow(window); + } + ,onWindowCreate: function(window) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onWindowCreate(window); + } + } + ,onWindowDeactivate: function(window) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onWindowDeactivate(window); + } + } + ,onWindowDropFile: function(window,file) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onWindowDropFile(window,file); + } + } + ,onWindowEnter: function(window) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onWindowEnter(window); + } + } + ,onWindowFocusIn: function(window) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onWindowFocusIn(window); + } + } + ,onWindowFocusOut: function(window) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onWindowFocusOut(window); + } + } + ,onWindowFullscreen: function(window) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onWindowFullscreen(window); + } + } + ,onWindowLeave: function(window) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onWindowLeave(window); + } + } + ,onWindowMinimize: function(window) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onWindowMinimize(window); + } + } + ,onWindowMove: function(window,x,y) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onWindowMove(window,x,y); + } + } + ,onWindowResize: function(window,width,height) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onWindowResize(window,width,height); + } + } + ,onWindowRestore: function(window) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.onWindowRestore(window); + } + } + ,removeWindow: function(window) { + if(window != null && this.windowByID.exists(window.id)) { + HxOverrides.remove(this.windows,window); + this.windowByID.remove(window.id); + window.close(); + if(this.get_window() == window) { + this.window = null; + } + } + } + ,render: function(renderer) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.render(renderer); + } + } + ,setPreloader: function(preloader) { + if(this.preloader != null) { + this.preloader.onProgress.remove($bind(this,this.onPreloadProgress)); + this.preloader.onComplete.remove($bind(this,this.onPreloadComplete)); + } + this.preloader = preloader; + if(preloader.complete) { + this.onPreloadComplete(); + } else { + preloader.onProgress.add($bind(this,this.onPreloadProgress)); + preloader.onComplete.add($bind(this,this.onPreloadComplete)); + } + } + ,update: function(deltaTime) { + var _g = 0; + var _g1 = this.modules; + while(_g < _g1.length) { + var module = _g1[_g]; + ++_g; + module.update(deltaTime); + } + } + ,__onGamepadConnect: function(gamepad) { + this.onGamepadConnect(gamepad); + var f = $bind(this,this.onGamepadAxisMove); + var a1 = gamepad; + var tmp = function(a2,a3) { + f(a1,a2,a3); + }; + gamepad.onAxisMove.add(tmp); + var f1 = $bind(this,this.onGamepadButtonDown); + var a11 = gamepad; + var tmp1 = function(a21) { + f1(a11,a21); + }; + gamepad.onButtonDown.add(tmp1); + var f2 = $bind(this,this.onGamepadButtonUp); + var a12 = gamepad; + var tmp2 = function(a22) { + f2(a12,a22); + }; + gamepad.onButtonUp.add(tmp2); + var f3 = $bind(this,this.onGamepadDisconnect); + var a13 = gamepad; + var tmp3 = function() { + f3(a13); + }; + gamepad.onDisconnect.add(tmp3); + } + ,__onJoystickConnect: function(joystick) { + this.onJoystickConnect(joystick); + var f = $bind(this,this.onJoystickAxisMove); + var a1 = joystick; + var tmp = function(a2,a3) { + f(a1,a2,a3); + }; + joystick.onAxisMove.add(tmp); + var f1 = $bind(this,this.onJoystickButtonDown); + var a11 = joystick; + var tmp1 = function(a21) { + f1(a11,a21); + }; + joystick.onButtonDown.add(tmp1); + var f2 = $bind(this,this.onJoystickButtonUp); + var a12 = joystick; + var tmp2 = function(a22) { + f2(a12,a22); + }; + joystick.onButtonUp.add(tmp2); + var f3 = $bind(this,this.onJoystickDisconnect); + var a13 = joystick; + var tmp3 = function() { + f3(a13); + }; + joystick.onDisconnect.add(tmp3); + var f4 = $bind(this,this.onJoystickHatMove); + var a14 = joystick; + var tmp4 = function(a23,a31) { + f4(a14,a23,a31); + }; + joystick.onHatMove.add(tmp4); + var f5 = $bind(this,this.onJoystickTrackballMove); + var a15 = joystick; + var tmp5 = function(a24,a32) { + f5(a15,a24,a32); + }; + joystick.onTrackballMove.add(tmp5); + } + ,set_frameRate: function(value) { + return this.backend.setFrameRate(value); + } + ,get_renderer: function() { + return this.renderers[0]; + } + ,get_window: function() { + return this.windows[0]; + } + ,__class__: lime_app_Application + ,__properties__: {get_renderer:"get_renderer",get_window:"get_window",set_frameRate:"set_frameRate"} +}); +var lime_app_Event_$Dynamic_$Void = function() { + this.canceled = false; + this.__listeners = []; + this.__priorities = []; + this.__repeat = []; +}; +$hxClasses["lime.app.Event_Dynamic_Void"] = lime_app_Event_$Dynamic_$Void; +lime_app_Event_$Dynamic_$Void.__name__ = ["lime","app","Event_Dynamic_Void"]; +lime_app_Event_$Dynamic_$Void.prototype = { + canceled: null + ,__repeat: null + ,__priorities: null + ,add: function(listener,once,priority) { + if(priority == null) { + priority = 0; + } + if(once == null) { + once = false; + } + var _g1 = 0; + var _g = this.__priorities.length; + while(_g1 < _g) { + var i = _g1++; + if(priority > this.__priorities[i]) { + this.__listeners.splice(i,0,listener); + this.__priorities.splice(i,0,priority); + this.__repeat.splice(i,0,!once); + return; + } + } + this.__listeners.push(listener); + this.__priorities.push(priority); + this.__repeat.push(!once); + } + ,remove: function(listener) { + var i = this.__listeners.length; + while(--i >= 0) if(Reflect.compareMethods(this.__listeners[i],listener)) { + this.__listeners.splice(i,1); + this.__priorities.splice(i,1); + this.__repeat.splice(i,1); + } + } + ,__listeners: null + ,dispatch: function(a) { + this.canceled = false; + var listeners = this.__listeners; + var repeat = this.__repeat; + var i = 0; + while(i < listeners.length) { + listeners[i](a); + if(!repeat[i]) { + this.remove(listeners[i]); + } else { + ++i; + } + if(this.canceled) { + break; + } + } + } + ,__class__: lime_app_Event_$Dynamic_$Void +}; +var lime_app_Event_$Float_$Float_$Int_$Void = function() { + this.canceled = false; + this.__listeners = []; + this.__priorities = []; + this.__repeat = []; +}; +$hxClasses["lime.app.Event_Float_Float_Int_Void"] = lime_app_Event_$Float_$Float_$Int_$Void; +lime_app_Event_$Float_$Float_$Int_$Void.__name__ = ["lime","app","Event_Float_Float_Int_Void"]; +lime_app_Event_$Float_$Float_$Int_$Void.prototype = { + canceled: null + ,__repeat: null + ,__priorities: null + ,add: function(listener,once,priority) { + if(priority == null) { + priority = 0; + } + if(once == null) { + once = false; + } + var _g1 = 0; + var _g = this.__priorities.length; + while(_g1 < _g) { + var i = _g1++; + if(priority > this.__priorities[i]) { + this.__listeners.splice(i,0,listener); + this.__priorities.splice(i,0,priority); + this.__repeat.splice(i,0,!once); + return; + } + } + this.__listeners.push(listener); + this.__priorities.push(priority); + this.__repeat.push(!once); + } + ,remove: function(listener) { + var i = this.__listeners.length; + while(--i >= 0) if(Reflect.compareMethods(this.__listeners[i],listener)) { + this.__listeners.splice(i,1); + this.__priorities.splice(i,1); + this.__repeat.splice(i,1); + } + } + ,__listeners: null + ,dispatch: function(a,a1,a2) { + this.canceled = false; + var listeners = this.__listeners; + var repeat = this.__repeat; + var i = 0; + while(i < listeners.length) { + listeners[i](a,a1,a2); + if(!repeat[i]) { + this.remove(listeners[i]); + } else { + ++i; + } + if(this.canceled) { + break; + } + } + } + ,__class__: lime_app_Event_$Float_$Float_$Int_$Void +}; +var lime_app_Event_$Float_$Float_$Void = function() { + this.canceled = false; + this.__listeners = []; + this.__priorities = []; + this.__repeat = []; +}; +$hxClasses["lime.app.Event_Float_Float_Void"] = lime_app_Event_$Float_$Float_$Void; +lime_app_Event_$Float_$Float_$Void.__name__ = ["lime","app","Event_Float_Float_Void"]; +lime_app_Event_$Float_$Float_$Void.prototype = { + canceled: null + ,__repeat: null + ,__priorities: null + ,add: function(listener,once,priority) { + if(priority == null) { + priority = 0; + } + if(once == null) { + once = false; + } + var _g1 = 0; + var _g = this.__priorities.length; + while(_g1 < _g) { + var i = _g1++; + if(priority > this.__priorities[i]) { + this.__listeners.splice(i,0,listener); + this.__priorities.splice(i,0,priority); + this.__repeat.splice(i,0,!once); + return; + } + } + this.__listeners.push(listener); + this.__priorities.push(priority); + this.__repeat.push(!once); + } + ,remove: function(listener) { + var i = this.__listeners.length; + while(--i >= 0) if(Reflect.compareMethods(this.__listeners[i],listener)) { + this.__listeners.splice(i,1); + this.__priorities.splice(i,1); + this.__repeat.splice(i,1); + } + } + ,__listeners: null + ,dispatch: function(a,a1) { + this.canceled = false; + var listeners = this.__listeners; + var repeat = this.__repeat; + var i = 0; + while(i < listeners.length) { + listeners[i](a,a1); + if(!repeat[i]) { + this.remove(listeners[i]); + } else { + ++i; + } + if(this.canceled) { + break; + } + } + } + ,__class__: lime_app_Event_$Float_$Float_$Void +}; +var lime_app_Event_$Int_$Float_$Void = function() { + this.canceled = false; + this.__listeners = []; + this.__priorities = []; + this.__repeat = []; +}; +$hxClasses["lime.app.Event_Int_Float_Void"] = lime_app_Event_$Int_$Float_$Void; +lime_app_Event_$Int_$Float_$Void.__name__ = ["lime","app","Event_Int_Float_Void"]; +lime_app_Event_$Int_$Float_$Void.prototype = { + canceled: null + ,__repeat: null + ,__priorities: null + ,add: function(listener,once,priority) { + if(priority == null) { + priority = 0; + } + if(once == null) { + once = false; + } + var _g1 = 0; + var _g = this.__priorities.length; + while(_g1 < _g) { + var i = _g1++; + if(priority > this.__priorities[i]) { + this.__listeners.splice(i,0,listener); + this.__priorities.splice(i,0,priority); + this.__repeat.splice(i,0,!once); + return; + } + } + this.__listeners.push(listener); + this.__priorities.push(priority); + this.__repeat.push(!once); + } + ,remove: function(listener) { + var i = this.__listeners.length; + while(--i >= 0) if(Reflect.compareMethods(this.__listeners[i],listener)) { + this.__listeners.splice(i,1); + this.__priorities.splice(i,1); + this.__repeat.splice(i,1); + } + } + ,__listeners: null + ,dispatch: function(a,a1) { + this.canceled = false; + var listeners = this.__listeners; + var repeat = this.__repeat; + var i = 0; + while(i < listeners.length) { + listeners[i](a,a1); + if(!repeat[i]) { + this.remove(listeners[i]); + } else { + ++i; + } + if(this.canceled) { + break; + } + } + } + ,__class__: lime_app_Event_$Int_$Float_$Void +}; +var lime_app_Event_$Int_$Int_$Void = function() { + this.canceled = false; + this.__listeners = []; + this.__priorities = []; + this.__repeat = []; +}; +$hxClasses["lime.app.Event_Int_Int_Void"] = lime_app_Event_$Int_$Int_$Void; +lime_app_Event_$Int_$Int_$Void.__name__ = ["lime","app","Event_Int_Int_Void"]; +lime_app_Event_$Int_$Int_$Void.prototype = { + canceled: null + ,__repeat: null + ,__priorities: null + ,add: function(listener,once,priority) { + if(priority == null) { + priority = 0; + } + if(once == null) { + once = false; + } + var _g1 = 0; + var _g = this.__priorities.length; + while(_g1 < _g) { + var i = _g1++; + if(priority > this.__priorities[i]) { + this.__listeners.splice(i,0,listener); + this.__priorities.splice(i,0,priority); + this.__repeat.splice(i,0,!once); + return; + } + } + this.__listeners.push(listener); + this.__priorities.push(priority); + this.__repeat.push(!once); + } + ,remove: function(listener) { + var i = this.__listeners.length; + while(--i >= 0) if(Reflect.compareMethods(this.__listeners[i],listener)) { + this.__listeners.splice(i,1); + this.__priorities.splice(i,1); + this.__repeat.splice(i,1); + } + } + ,__listeners: null + ,dispatch: function(a,a1) { + this.canceled = false; + var listeners = this.__listeners; + var repeat = this.__repeat; + var i = 0; + while(i < listeners.length) { + listeners[i](a,a1); + if(!repeat[i]) { + this.remove(listeners[i]); + } else { + ++i; + } + if(this.canceled) { + break; + } + } + } + ,__class__: lime_app_Event_$Int_$Int_$Void +}; +var lime_app_Event_$Int_$Void = function() { + this.canceled = false; + this.__listeners = []; + this.__priorities = []; + this.__repeat = []; +}; +$hxClasses["lime.app.Event_Int_Void"] = lime_app_Event_$Int_$Void; +lime_app_Event_$Int_$Void.__name__ = ["lime","app","Event_Int_Void"]; +lime_app_Event_$Int_$Void.prototype = { + canceled: null + ,__repeat: null + ,__priorities: null + ,add: function(listener,once,priority) { + if(priority == null) { + priority = 0; + } + if(once == null) { + once = false; + } + var _g1 = 0; + var _g = this.__priorities.length; + while(_g1 < _g) { + var i = _g1++; + if(priority > this.__priorities[i]) { + this.__listeners.splice(i,0,listener); + this.__priorities.splice(i,0,priority); + this.__repeat.splice(i,0,!once); + return; + } + } + this.__listeners.push(listener); + this.__priorities.push(priority); + this.__repeat.push(!once); + } + ,remove: function(listener) { + var i = this.__listeners.length; + while(--i >= 0) if(Reflect.compareMethods(this.__listeners[i],listener)) { + this.__listeners.splice(i,1); + this.__priorities.splice(i,1); + this.__repeat.splice(i,1); + } + } + ,__listeners: null + ,dispatch: function(a) { + this.canceled = false; + var listeners = this.__listeners; + var repeat = this.__repeat; + var i = 0; + while(i < listeners.length) { + listeners[i](a); + if(!repeat[i]) { + this.remove(listeners[i]); + } else { + ++i; + } + if(this.canceled) { + break; + } + } + } + ,__class__: lime_app_Event_$Int_$Void +}; +var lime_app_Event_$Int_$lime_$ui_$JoystickHatPosition_$Void = function() { + this.canceled = false; + this.__listeners = []; + this.__priorities = []; + this.__repeat = []; +}; +$hxClasses["lime.app.Event_Int_lime_ui_JoystickHatPosition_Void"] = lime_app_Event_$Int_$lime_$ui_$JoystickHatPosition_$Void; +lime_app_Event_$Int_$lime_$ui_$JoystickHatPosition_$Void.__name__ = ["lime","app","Event_Int_lime_ui_JoystickHatPosition_Void"]; +lime_app_Event_$Int_$lime_$ui_$JoystickHatPosition_$Void.prototype = { + canceled: null + ,__repeat: null + ,__priorities: null + ,add: function(listener,once,priority) { + if(priority == null) { + priority = 0; + } + if(once == null) { + once = false; + } + var _g1 = 0; + var _g = this.__priorities.length; + while(_g1 < _g) { + var i = _g1++; + if(priority > this.__priorities[i]) { + this.__listeners.splice(i,0,listener); + this.__priorities.splice(i,0,priority); + this.__repeat.splice(i,0,!once); + return; + } + } + this.__listeners.push(listener); + this.__priorities.push(priority); + this.__repeat.push(!once); + } + ,__listeners: null + ,__class__: lime_app_Event_$Int_$lime_$ui_$JoystickHatPosition_$Void +}; +var lime_app_Event_$String_$Int_$Int_$Void = function() { + this.canceled = false; + this.__listeners = []; + this.__priorities = []; + this.__repeat = []; +}; +$hxClasses["lime.app.Event_String_Int_Int_Void"] = lime_app_Event_$String_$Int_$Int_$Void; +lime_app_Event_$String_$Int_$Int_$Void.__name__ = ["lime","app","Event_String_Int_Int_Void"]; +lime_app_Event_$String_$Int_$Int_$Void.prototype = { + canceled: null + ,__repeat: null + ,__priorities: null + ,add: function(listener,once,priority) { + if(priority == null) { + priority = 0; + } + if(once == null) { + once = false; + } + var _g1 = 0; + var _g = this.__priorities.length; + while(_g1 < _g) { + var i = _g1++; + if(priority > this.__priorities[i]) { + this.__listeners.splice(i,0,listener); + this.__priorities.splice(i,0,priority); + this.__repeat.splice(i,0,!once); + return; + } + } + this.__listeners.push(listener); + this.__priorities.push(priority); + this.__repeat.push(!once); + } + ,__listeners: null + ,__class__: lime_app_Event_$String_$Int_$Int_$Void +}; +var lime_app_Event_$String_$Void = function() { + this.canceled = false; + this.__listeners = []; + this.__priorities = []; + this.__repeat = []; +}; +$hxClasses["lime.app.Event_String_Void"] = lime_app_Event_$String_$Void; +lime_app_Event_$String_$Void.__name__ = ["lime","app","Event_String_Void"]; +lime_app_Event_$String_$Void.prototype = { + canceled: null + ,__repeat: null + ,__priorities: null + ,add: function(listener,once,priority) { + if(priority == null) { + priority = 0; + } + if(once == null) { + once = false; + } + var _g1 = 0; + var _g = this.__priorities.length; + while(_g1 < _g) { + var i = _g1++; + if(priority > this.__priorities[i]) { + this.__listeners.splice(i,0,listener); + this.__priorities.splice(i,0,priority); + this.__repeat.splice(i,0,!once); + return; + } + } + this.__listeners.push(listener); + this.__priorities.push(priority); + this.__repeat.push(!once); + } + ,__listeners: null + ,__class__: lime_app_Event_$String_$Void +}; +var lime_app_Event_$lime_$graphics_$RenderContext_$Void = function() { + this.canceled = false; + this.__listeners = []; + this.__priorities = []; + this.__repeat = []; +}; +$hxClasses["lime.app.Event_lime_graphics_RenderContext_Void"] = lime_app_Event_$lime_$graphics_$RenderContext_$Void; +lime_app_Event_$lime_$graphics_$RenderContext_$Void.__name__ = ["lime","app","Event_lime_graphics_RenderContext_Void"]; +lime_app_Event_$lime_$graphics_$RenderContext_$Void.prototype = { + canceled: null + ,__repeat: null + ,__priorities: null + ,add: function(listener,once,priority) { + if(priority == null) { + priority = 0; + } + if(once == null) { + once = false; + } + var _g1 = 0; + var _g = this.__priorities.length; + while(_g1 < _g) { + var i = _g1++; + if(priority > this.__priorities[i]) { + this.__listeners.splice(i,0,listener); + this.__priorities.splice(i,0,priority); + this.__repeat.splice(i,0,!once); + return; + } + } + this.__listeners.push(listener); + this.__priorities.push(priority); + this.__repeat.push(!once); + } + ,remove: function(listener) { + var i = this.__listeners.length; + while(--i >= 0) if(Reflect.compareMethods(this.__listeners[i],listener)) { + this.__listeners.splice(i,1); + this.__priorities.splice(i,1); + this.__repeat.splice(i,1); + } + } + ,__listeners: null + ,dispatch: function(a) { + this.canceled = false; + var listeners = this.__listeners; + var repeat = this.__repeat; + var i = 0; + while(i < listeners.length) { + listeners[i](a); + if(!repeat[i]) { + this.remove(listeners[i]); + } else { + ++i; + } + if(this.canceled) { + break; + } + } + } + ,__class__: lime_app_Event_$lime_$graphics_$RenderContext_$Void +}; +var lime_app_Event_$lime_$ui_$GamepadAxis_$Float_$Void = function() { + this.canceled = false; + this.__listeners = []; + this.__priorities = []; + this.__repeat = []; +}; +$hxClasses["lime.app.Event_lime_ui_GamepadAxis_Float_Void"] = lime_app_Event_$lime_$ui_$GamepadAxis_$Float_$Void; +lime_app_Event_$lime_$ui_$GamepadAxis_$Float_$Void.__name__ = ["lime","app","Event_lime_ui_GamepadAxis_Float_Void"]; +lime_app_Event_$lime_$ui_$GamepadAxis_$Float_$Void.prototype = { + canceled: null + ,__repeat: null + ,__priorities: null + ,add: function(listener,once,priority) { + if(priority == null) { + priority = 0; + } + if(once == null) { + once = false; + } + var _g1 = 0; + var _g = this.__priorities.length; + while(_g1 < _g) { + var i = _g1++; + if(priority > this.__priorities[i]) { + this.__listeners.splice(i,0,listener); + this.__priorities.splice(i,0,priority); + this.__repeat.splice(i,0,!once); + return; + } + } + this.__listeners.push(listener); + this.__priorities.push(priority); + this.__repeat.push(!once); + } + ,remove: function(listener) { + var i = this.__listeners.length; + while(--i >= 0) if(Reflect.compareMethods(this.__listeners[i],listener)) { + this.__listeners.splice(i,1); + this.__priorities.splice(i,1); + this.__repeat.splice(i,1); + } + } + ,__listeners: null + ,dispatch: function(a,a1) { + this.canceled = false; + var listeners = this.__listeners; + var repeat = this.__repeat; + var i = 0; + while(i < listeners.length) { + listeners[i](a,a1); + if(!repeat[i]) { + this.remove(listeners[i]); + } else { + ++i; + } + if(this.canceled) { + break; + } + } + } + ,__class__: lime_app_Event_$lime_$ui_$GamepadAxis_$Float_$Void +}; +var lime_app_Event_$lime_$ui_$GamepadButton_$Void = function() { + this.canceled = false; + this.__listeners = []; + this.__priorities = []; + this.__repeat = []; +}; +$hxClasses["lime.app.Event_lime_ui_GamepadButton_Void"] = lime_app_Event_$lime_$ui_$GamepadButton_$Void; +lime_app_Event_$lime_$ui_$GamepadButton_$Void.__name__ = ["lime","app","Event_lime_ui_GamepadButton_Void"]; +lime_app_Event_$lime_$ui_$GamepadButton_$Void.prototype = { + canceled: null + ,__repeat: null + ,__priorities: null + ,add: function(listener,once,priority) { + if(priority == null) { + priority = 0; + } + if(once == null) { + once = false; + } + var _g1 = 0; + var _g = this.__priorities.length; + while(_g1 < _g) { + var i = _g1++; + if(priority > this.__priorities[i]) { + this.__listeners.splice(i,0,listener); + this.__priorities.splice(i,0,priority); + this.__repeat.splice(i,0,!once); + return; + } + } + this.__listeners.push(listener); + this.__priorities.push(priority); + this.__repeat.push(!once); + } + ,remove: function(listener) { + var i = this.__listeners.length; + while(--i >= 0) if(Reflect.compareMethods(this.__listeners[i],listener)) { + this.__listeners.splice(i,1); + this.__priorities.splice(i,1); + this.__repeat.splice(i,1); + } + } + ,__listeners: null + ,dispatch: function(a) { + this.canceled = false; + var listeners = this.__listeners; + var repeat = this.__repeat; + var i = 0; + while(i < listeners.length) { + listeners[i](a); + if(!repeat[i]) { + this.remove(listeners[i]); + } else { + ++i; + } + if(this.canceled) { + break; + } + } + } + ,__class__: lime_app_Event_$lime_$ui_$GamepadButton_$Void +}; +var lime_app_Event_$lime_$ui_$Gamepad_$Void = function() { + this.canceled = false; + this.__listeners = []; + this.__priorities = []; + this.__repeat = []; +}; +$hxClasses["lime.app.Event_lime_ui_Gamepad_Void"] = lime_app_Event_$lime_$ui_$Gamepad_$Void; +lime_app_Event_$lime_$ui_$Gamepad_$Void.__name__ = ["lime","app","Event_lime_ui_Gamepad_Void"]; +lime_app_Event_$lime_$ui_$Gamepad_$Void.prototype = { + canceled: null + ,__repeat: null + ,__priorities: null + ,add: function(listener,once,priority) { + if(priority == null) { + priority = 0; + } + if(once == null) { + once = false; + } + var _g1 = 0; + var _g = this.__priorities.length; + while(_g1 < _g) { + var i = _g1++; + if(priority > this.__priorities[i]) { + this.__listeners.splice(i,0,listener); + this.__priorities.splice(i,0,priority); + this.__repeat.splice(i,0,!once); + return; + } + } + this.__listeners.push(listener); + this.__priorities.push(priority); + this.__repeat.push(!once); + } + ,remove: function(listener) { + var i = this.__listeners.length; + while(--i >= 0) if(Reflect.compareMethods(this.__listeners[i],listener)) { + this.__listeners.splice(i,1); + this.__priorities.splice(i,1); + this.__repeat.splice(i,1); + } + } + ,__listeners: null + ,dispatch: function(a) { + this.canceled = false; + var listeners = this.__listeners; + var repeat = this.__repeat; + var i = 0; + while(i < listeners.length) { + listeners[i](a); + if(!repeat[i]) { + this.remove(listeners[i]); + } else { + ++i; + } + if(this.canceled) { + break; + } + } + } + ,__class__: lime_app_Event_$lime_$ui_$Gamepad_$Void +}; +var lime_app_Event_$lime_$ui_$Joystick_$Void = function() { + this.canceled = false; + this.__listeners = []; + this.__priorities = []; + this.__repeat = []; +}; +$hxClasses["lime.app.Event_lime_ui_Joystick_Void"] = lime_app_Event_$lime_$ui_$Joystick_$Void; +lime_app_Event_$lime_$ui_$Joystick_$Void.__name__ = ["lime","app","Event_lime_ui_Joystick_Void"]; +lime_app_Event_$lime_$ui_$Joystick_$Void.prototype = { + canceled: null + ,__repeat: null + ,__priorities: null + ,add: function(listener,once,priority) { + if(priority == null) { + priority = 0; + } + if(once == null) { + once = false; + } + var _g1 = 0; + var _g = this.__priorities.length; + while(_g1 < _g) { + var i = _g1++; + if(priority > this.__priorities[i]) { + this.__listeners.splice(i,0,listener); + this.__priorities.splice(i,0,priority); + this.__repeat.splice(i,0,!once); + return; + } + } + this.__listeners.push(listener); + this.__priorities.push(priority); + this.__repeat.push(!once); + } + ,remove: function(listener) { + var i = this.__listeners.length; + while(--i >= 0) if(Reflect.compareMethods(this.__listeners[i],listener)) { + this.__listeners.splice(i,1); + this.__priorities.splice(i,1); + this.__repeat.splice(i,1); + } + } + ,__listeners: null + ,dispatch: function(a) { + this.canceled = false; + var listeners = this.__listeners; + var repeat = this.__repeat; + var i = 0; + while(i < listeners.length) { + listeners[i](a); + if(!repeat[i]) { + this.remove(listeners[i]); + } else { + ++i; + } + if(this.canceled) { + break; + } + } + } + ,__class__: lime_app_Event_$lime_$ui_$Joystick_$Void +}; +var lime_app_Event_$lime_$ui_$KeyCode_$lime_$ui_$KeyModifier_$Void = function() { + this.canceled = false; + this.__listeners = []; + this.__priorities = []; + this.__repeat = []; +}; +$hxClasses["lime.app.Event_lime_ui_KeyCode_lime_ui_KeyModifier_Void"] = lime_app_Event_$lime_$ui_$KeyCode_$lime_$ui_$KeyModifier_$Void; +lime_app_Event_$lime_$ui_$KeyCode_$lime_$ui_$KeyModifier_$Void.__name__ = ["lime","app","Event_lime_ui_KeyCode_lime_ui_KeyModifier_Void"]; +lime_app_Event_$lime_$ui_$KeyCode_$lime_$ui_$KeyModifier_$Void.prototype = { + canceled: null + ,__repeat: null + ,__priorities: null + ,add: function(listener,once,priority) { + if(priority == null) { + priority = 0; + } + if(once == null) { + once = false; + } + var _g1 = 0; + var _g = this.__priorities.length; + while(_g1 < _g) { + var i = _g1++; + if(priority > this.__priorities[i]) { + this.__listeners.splice(i,0,listener); + this.__priorities.splice(i,0,priority); + this.__repeat.splice(i,0,!once); + return; + } + } + this.__listeners.push(listener); + this.__priorities.push(priority); + this.__repeat.push(!once); + } + ,cancel: function() { + this.canceled = true; + } + ,remove: function(listener) { + var i = this.__listeners.length; + while(--i >= 0) if(Reflect.compareMethods(this.__listeners[i],listener)) { + this.__listeners.splice(i,1); + this.__priorities.splice(i,1); + this.__repeat.splice(i,1); + } + } + ,__listeners: null + ,dispatch: function(a,a1) { + this.canceled = false; + var listeners = this.__listeners; + var repeat = this.__repeat; + var i = 0; + while(i < listeners.length) { + listeners[i](a,a1); + if(!repeat[i]) { + this.remove(listeners[i]); + } else { + ++i; + } + if(this.canceled) { + break; + } + } + } + ,__class__: lime_app_Event_$lime_$ui_$KeyCode_$lime_$ui_$KeyModifier_$Void +}; +var lime_app_Event_$lime_$ui_$Touch_$Void = function() { + this.canceled = false; + this.__listeners = []; + this.__priorities = []; + this.__repeat = []; +}; +$hxClasses["lime.app.Event_lime_ui_Touch_Void"] = lime_app_Event_$lime_$ui_$Touch_$Void; +lime_app_Event_$lime_$ui_$Touch_$Void.__name__ = ["lime","app","Event_lime_ui_Touch_Void"]; +lime_app_Event_$lime_$ui_$Touch_$Void.prototype = { + canceled: null + ,__repeat: null + ,__priorities: null + ,add: function(listener,once,priority) { + if(priority == null) { + priority = 0; + } + if(once == null) { + once = false; + } + var _g1 = 0; + var _g = this.__priorities.length; + while(_g1 < _g) { + var i = _g1++; + if(priority > this.__priorities[i]) { + this.__listeners.splice(i,0,listener); + this.__priorities.splice(i,0,priority); + this.__repeat.splice(i,0,!once); + return; + } + } + this.__listeners.push(listener); + this.__priorities.push(priority); + this.__repeat.push(!once); + } + ,remove: function(listener) { + var i = this.__listeners.length; + while(--i >= 0) if(Reflect.compareMethods(this.__listeners[i],listener)) { + this.__listeners.splice(i,1); + this.__priorities.splice(i,1); + this.__repeat.splice(i,1); + } + } + ,__listeners: null + ,dispatch: function(a) { + this.canceled = false; + var listeners = this.__listeners; + var repeat = this.__repeat; + var i = 0; + while(i < listeners.length) { + listeners[i](a); + if(!repeat[i]) { + this.remove(listeners[i]); + } else { + ++i; + } + if(this.canceled) { + break; + } + } + } + ,__class__: lime_app_Event_$lime_$ui_$Touch_$Void +}; +var lime_app_Future = function(work) { + if(work != null) { + if(lime_app_Future.__threadPool == null) { + lime_app_Future.__threadPool = new lime_system_ThreadPool(); + lime_app_Future.__threadPool.doWork.add(lime_app_Future.threadPool_doWork); + lime_app_Future.__threadPool.onComplete.add(lime_app_Future.threadPool_onComplete); + lime_app_Future.__threadPool.onError.add(lime_app_Future.threadPool_onError); + } + var promise = new lime_app_Promise(); + promise.future = this; + lime_app_Future.__threadPool.queue({ promise : promise, work : work}); + } +}; +$hxClasses["lime.app.Future"] = lime_app_Future; +lime_app_Future.__name__ = ["lime","app","Future"]; +lime_app_Future.__threadPool = null; +lime_app_Future.threadPool_doWork = function(state) { + try { + var result = state.work(); + lime_app_Future.__threadPool.sendComplete({ promise : state.promise, result : result}); + } catch( e ) { + haxe_CallStack.lastException = e; + if (e instanceof js__$Boot_HaxeError) e = e.val; + lime_app_Future.__threadPool.sendError({ promise : state.promise, error : e}); + } +}; +lime_app_Future.threadPool_onComplete = function(state) { + state.promise.complete(state.result); +}; +lime_app_Future.threadPool_onError = function(state) { + state.promise.error(state.error); +}; +lime_app_Future.prototype = { + value: null + ,__completed: null + ,__completeListeners: null + ,__errored: null + ,__errorListeners: null + ,__errorMessage: null + ,__progressListeners: null + ,onComplete: function(listener) { + if(listener != null) { + if(this.__completed) { + listener(this.value); + } else if(!this.__errored) { + if(this.__completeListeners == null) { + this.__completeListeners = []; + } + this.__completeListeners.push(listener); + } + } + return this; + } + ,onError: function(listener) { + if(listener != null) { + if(this.__errored) { + listener(this.__errorMessage); + } else if(!this.__completed) { + if(this.__errorListeners == null) { + this.__errorListeners = []; + } + this.__errorListeners.push(listener); + } + } + return this; + } + ,onProgress: function(listener) { + if(listener != null) { + if(this.__progressListeners == null) { + this.__progressListeners = []; + } + this.__progressListeners.push(listener); + } + return this; + } + ,__class__: lime_app_Future +}; +var lime_app_Preloader = function() { + this.current = 0; + this.total = 0; + this.loaded = 0; + this.onProgress = new lime_app_Event_$Int_$Int_$Void(); + this.onComplete = new lime_app_Event_$Void_$Void(); + this.onProgress.add($bind(this,this.update)); +}; +$hxClasses["lime.app.Preloader"] = lime_app_Preloader; +lime_app_Preloader.__name__ = ["lime","app","Preloader"]; +lime_app_Preloader.prototype = { + complete: null + ,onComplete: null + ,onProgress: null + ,loaded: null + ,total: null + ,current: null + ,urls: null + ,create: function(config) { + } + ,load: function(urls,types) { + var url = null; + this.urls = []; + var _g1 = 0; + var _g = urls.length; + while(_g1 < _g) { + var i = _g1++; + url = urls[i]; + var _g2 = types[i]; + switch(_g2) { + case "BINARY": + if(!lime_app_Preloader.loaders.exists(url)) { + var loader = new lime_net_HTTPRequest(); + lime_app_Preloader.loaders.set(url,loader); + this.total++; + this.urls.push(url); + } + break; + case "FONT": + break; + case "IMAGE": + if(!lime_app_Preloader.images.exists(url)) { + var image = new Image(); + lime_app_Preloader.images.set(url,image); + this.total++; + this.urls.push(url); + } + break; + case "MUSIC":case "SOUND": + if(!lime_app_Preloader.sounds.exists(url)) { + lime_app_Preloader.sounds.set(url,true); + this.total++; + } + break; + case "TEXT": + if(!lime_app_Preloader.loaders.exists(url)) { + var loader1 = new lime_net_HTTPRequest(); + lime_app_Preloader.loaders.set(url,loader1); + this.total++; + this.urls.push(url); + } + break; + default: + } + } + this.offset = 0; + if(urls.length == 0) { + this.start(); + } else { + this.next(); + } + } + ,offset: null + ,loadSound: function(url) { + this.assetLoaded(); + } + ,loadSounds: function() { + this.offset = this.current; + this.urls = []; + var i = lime_app_Preloader.sounds.keys(); + while(i.hasNext()) { + var i1 = i.next(); + this.urls.push(i1); + } + if(this.urls.length == 0) { + this.start(); + } else { + this.next(); + } + } + ,next: function(count) { + if(count == null) { + count = 50; + } + var c = this.current - this.offset; + this.current += count; + var e = this.current - this.offset; + if(e > this.urls.length) { + this.current += this.urls.length - e; + e = this.urls.length; + } + var cacheVersion = lime_Assets.cache.version; + var _g1 = c; + var _g = e; + while(_g1 < _g) { + var i = _g1++; + var url = this.urls[i]; + var loader = lime_app_Preloader.loaders.get(url); + if(loader == null) { + var image = lime_app_Preloader.images.get(url); + if(image != null) { + var image1 = lime_app_Preloader.images.get(url); + image1.onload = $bind(this,this.image_onLoad); + image1.src = url + "?" + cacheVersion; + } else if(lime_app_Preloader.sounds.exists(url)) { + this.loadSound(url); + } + } else { + var loader1 = lime_app_Preloader.loaders.get(url); + var future = loader1.load(url + "?" + cacheVersion); + future.onComplete($bind(this,this.loader_onComplete)); + } + } + } + ,start: function() { + this.complete = true; + this.onComplete.dispatch(); + } + ,update: function(loaded,total) { + } + ,assetLoaded: function() { + this.loaded++; + this.onProgress.dispatch(this.loaded,this.total); + if(this.loaded - this.offset == this.urls.length) { + this.start(); + } else if(this.loaded == this.current) { + this.next(); + } + } + ,image_onLoad: function(_) { + this.assetLoaded(); + } + ,loader_onComplete: function(_) { + this.assetLoaded(); + } + ,__class__: lime_app_Preloader +}; +var lime_app_Promise = function() { + this.future = new lime_app_Future(); +}; +$hxClasses["lime.app.Promise"] = lime_app_Promise; +lime_app_Promise.__name__ = ["lime","app","Promise"]; +lime_app_Promise.prototype = { + future: null + ,complete: function(data) { + if(!this.future.__errored) { + this.future.__completed = true; + this.future.value = data; + if(this.future.__completeListeners != null) { + var _g = 0; + var _g1 = this.future.__completeListeners; + while(_g < _g1.length) { + var listener = _g1[_g]; + ++_g; + listener(data); + } + this.future.__completeListeners = null; + } + } + return this; + } + ,completeWith: function(future) { + future.onComplete($bind(this,this.complete)); + future.onError($bind(this,this.error)); + future.onProgress($bind(this,this.progress)); + return this; + } + ,error: function(msg) { + if(!this.future.__completed) { + this.future.__errored = true; + this.future.__errorMessage = msg; + if(this.future.__errorListeners != null) { + var _g = 0; + var _g1 = this.future.__errorListeners; + while(_g < _g1.length) { + var listener = _g1[_g]; + ++_g; + listener(msg); + } + this.future.__errorListeners = null; + } + } + return this; + } + ,progress: function(progress) { + if(!this.future.__errored && !this.future.__completed) { + if(this.future.__progressListeners != null) { + var _g = 0; + var _g1 = this.future.__progressListeners; + while(_g < _g1.length) { + var listener = _g1[_g]; + ++_g; + listener(progress); + } + } + } + return this; + } + ,__class__: lime_app_Promise +}; +var lime_audio_ALAudioContext = function() { }; +$hxClasses["lime.audio.ALAudioContext"] = lime_audio_ALAudioContext; +lime_audio_ALAudioContext.__name__ = ["lime","audio","ALAudioContext"]; +var lime_audio_ALCAudioContext = function() { }; +$hxClasses["lime.audio.ALCAudioContext"] = lime_audio_ALCAudioContext; +lime_audio_ALCAudioContext.__name__ = ["lime","audio","ALCAudioContext"]; +var lime_audio_AudioBuffer = function() { }; +$hxClasses["lime.audio.AudioBuffer"] = lime_audio_AudioBuffer; +lime_audio_AudioBuffer.__name__ = ["lime","audio","AudioBuffer"]; +var lime_audio_AudioContext = $hxClasses["lime.audio.AudioContext"] = { __ename__ : ["lime","audio","AudioContext"], __constructs__ : ["OPENAL","HTML5","WEB","FLASH","CUSTOM"] }; +lime_audio_AudioContext.OPENAL = function(alc,al) { var $x = ["OPENAL",0,alc,al]; $x.__enum__ = lime_audio_AudioContext; $x.toString = $estr; return $x; }; +lime_audio_AudioContext.HTML5 = function(context) { var $x = ["HTML5",1,context]; $x.__enum__ = lime_audio_AudioContext; $x.toString = $estr; return $x; }; +lime_audio_AudioContext.WEB = function(context) { var $x = ["WEB",2,context]; $x.__enum__ = lime_audio_AudioContext; $x.toString = $estr; return $x; }; +lime_audio_AudioContext.FLASH = function(context) { var $x = ["FLASH",3,context]; $x.__enum__ = lime_audio_AudioContext; $x.toString = $estr; return $x; }; +lime_audio_AudioContext.CUSTOM = function(data) { var $x = ["CUSTOM",4,data]; $x.__enum__ = lime_audio_AudioContext; $x.toString = $estr; return $x; }; +var lime_audio_AudioManager = function() { }; +$hxClasses["lime.audio.AudioManager"] = lime_audio_AudioManager; +lime_audio_AudioManager.__name__ = ["lime","audio","AudioManager"]; +lime_audio_AudioManager.context = null; +lime_audio_AudioManager.init = function(context) { + if(lime_audio_AudioManager.context == null) { + if(context == null) { + try { + window.AudioContext = window.AudioContext || window.webkitAudioContext; + lime_audio_AudioManager.context = lime_audio_AudioContext.WEB(new AudioContext ()); + } catch( e ) { + haxe_CallStack.lastException = e; + lime_audio_AudioManager.context = lime_audio_AudioContext.HTML5(new lime_audio_HTML5AudioContext()); + } + } else { + lime_audio_AudioManager.context = context; + } + } +}; +var lime_audio_AudioSource = function() { }; +$hxClasses["lime.audio.AudioSource"] = lime_audio_AudioSource; +lime_audio_AudioSource.__name__ = ["lime","audio","AudioSource"]; +lime_audio_AudioSource.prototype = { + __class__: lime_audio_AudioSource +}; +var lime_audio_FlashAudioContext = function() { }; +$hxClasses["lime.audio.FlashAudioContext"] = lime_audio_FlashAudioContext; +lime_audio_FlashAudioContext.__name__ = ["lime","audio","FlashAudioContext"]; +var lime_audio_HTML5AudioContext = function() { +}; +$hxClasses["lime.audio.HTML5AudioContext"] = lime_audio_HTML5AudioContext; +lime_audio_HTML5AudioContext.__name__ = ["lime","audio","HTML5AudioContext"]; +lime_audio_HTML5AudioContext.prototype = { + __class__: lime_audio_HTML5AudioContext +}; +var lime_graphics_ConsoleRenderContext = function() { }; +$hxClasses["lime.graphics.ConsoleRenderContext"] = lime_graphics_ConsoleRenderContext; +lime_graphics_ConsoleRenderContext.__name__ = ["lime","graphics","ConsoleRenderContext"]; +lime_graphics_ConsoleRenderContext.prototype = { + __class__: lime_graphics_ConsoleRenderContext +}; +var lime_graphics_FlashRenderContext = function() { }; +$hxClasses["lime.graphics.FlashRenderContext"] = lime_graphics_FlashRenderContext; +lime_graphics_FlashRenderContext.__name__ = ["lime","graphics","FlashRenderContext"]; +var lime_graphics_Image = function(buffer,offsetX,offsetY,width,height,color,type) { + if(height == null) { + height = -1; + } + if(width == null) { + width = -1; + } + if(offsetY == null) { + offsetY = 0; + } + if(offsetX == null) { + offsetX = 0; + } + this.offsetX = offsetX; + this.offsetY = offsetY; + this.width = width; + this.height = height; + if(type == null) { + if(lime_app_Application.current != null && lime_app_Application.current.get_renderer() != null) { + var _g = lime_app_Application.current.get_renderer().context; + var tmp; + switch(Type.enumIndex(_g)) { + case 1:case 2: + tmp = lime_graphics_ImageType.CANVAS; + break; + case 3: + tmp = lime_graphics_ImageType.FLASH; + break; + default: + tmp = lime_graphics_ImageType.DATA; + } + this.type = tmp; + } else { + this.type = lime_graphics_ImageType.DATA; + } + } else { + this.type = type; + } + if(buffer == null) { + if(width > 0 && height > 0) { + var _g1 = this.type; + switch(Type.enumIndex(_g1)) { + case 0: + this.buffer = new lime_graphics_ImageBuffer(null,width,height); + lime_graphics_utils_ImageCanvasUtil.createCanvas(this,width,height); + if(color != null) { + this.fillRect(new lime_math_Rectangle(0,0,width,height),color); + } + break; + case 1: + var elements = width * height * 4; + var this1; + if(elements != null) { + this1 = new Uint8Array(elements); + } else { + this1 = null; + } + this.buffer = new lime_graphics_ImageBuffer(this1,width,height); + if(color != null) { + this.fillRect(new lime_math_Rectangle(0,0,width,height),color); + } + break; + case 2: + break; + default: + } + } + } else { + this.__fromImageBuffer(buffer); + } +}; +$hxClasses["lime.graphics.Image"] = lime_graphics_Image; +lime_graphics_Image.__name__ = ["lime","graphics","Image"]; +lime_graphics_Image.__base64Encoder = null; +lime_graphics_Image.fromBase64 = function(base64,type,onload) { + if(base64 == null) { + return null; + } + var image = new lime_graphics_Image(); + image.__fromBase64(base64,type,onload); + return image; +}; +lime_graphics_Image.fromBytes = function(bytes,onload) { + if(bytes == null) { + return null; + } + var image = new lime_graphics_Image(); + image.__fromBytes(bytes,onload); + return image; +}; +lime_graphics_Image.fromCanvas = function(canvas) { + if(canvas == null) { + return null; + } + var buffer = new lime_graphics_ImageBuffer(null,canvas.width,canvas.height); + buffer.set_src(canvas); + return new lime_graphics_Image(buffer); +}; +lime_graphics_Image.fromFile = function(path,onload,onerror) { + var image = new lime_graphics_Image(); + image.__fromFile(path,onload,onerror); + return image; +}; +lime_graphics_Image.fromImageElement = function(image) { + if(image == null) { + return null; + } + var buffer = new lime_graphics_ImageBuffer(null,image.width,image.height); + buffer.set_src(image); + return new lime_graphics_Image(buffer); +}; +lime_graphics_Image.__base64Encode = function(bytes) { + var extension; + var _g = bytes.length % 3; + switch(_g) { + case 1: + extension = "=="; + break; + case 2: + extension = "="; + break; + default: + extension = ""; + } + if(lime_graphics_Image.__base64Encoder == null) { + lime_graphics_Image.__base64Encoder = new haxe_crypto_BaseCode(haxe_io_Bytes.ofString(lime_graphics_Image.__base64Chars)); + } + return lime_graphics_Image.__base64Encoder.encodeBytes(bytes).toString() + extension; +}; +lime_graphics_Image.__isJPG = function(bytes) { + if(bytes.get(0) == 255) { + return bytes.get(1) == 216; + } else { + return false; + } +}; +lime_graphics_Image.__isPNG = function(bytes) { + if(bytes.get(0) == 137 && bytes.get(1) == 80 && bytes.get(2) == 78 && bytes.get(3) == 71 && bytes.get(4) == 13 && bytes.get(5) == 10 && bytes.get(6) == 26) { + return bytes.get(7) == 10; + } else { + return false; + } +}; +lime_graphics_Image.__isGIF = function(bytes) { + if(bytes.get(0) == 71 && bytes.get(1) == 73 && bytes.get(2) == 70 && bytes.get(3) == 56) { + var b = bytes.get(4); + if(b == 55 || b == 57) { + return bytes.get(5) == 97; + } else { + return false; + } + } + return false; +}; +lime_graphics_Image.prototype = { + buffer: null + ,dirty: null + ,height: null + ,offsetX: null + ,offsetY: null + ,type: null + ,width: null + ,clone: function() { + if(this.buffer != null) { + if(this.type == lime_graphics_ImageType.CANVAS && this.buffer.__srcImage == null) { + lime_graphics_utils_ImageCanvasUtil.convertToCanvas(this); + lime_graphics_utils_ImageCanvasUtil.sync(this,true); + } + var image = new lime_graphics_Image(this.buffer.clone(),this.offsetX,this.offsetY,this.width,this.height,null,this.type); + image.dirty = this.dirty; + return image; + } else { + return new lime_graphics_Image(null,this.offsetX,this.offsetY,this.width,this.height,null,this.type); + } + } + ,colorTransform: function(rect,colorMatrix) { + rect = this.__clipRect(rect); + if(this.buffer == null || rect == null) { + return; + } + var _g = this.type; + switch(Type.enumIndex(_g)) { + case 0: + lime_graphics_utils_ImageCanvasUtil.colorTransform(this,rect,colorMatrix); + break; + case 1: + lime_graphics_utils_ImageCanvasUtil.convertToData(this); + lime_graphics_utils_ImageDataUtil.colorTransform(this,rect,colorMatrix); + break; + case 2: + rect.offset(this.offsetX,this.offsetY); + this.buffer.__srcBitmapData.colorTransform(rect.__toFlashRectangle(),lime_math__$ColorMatrix_ColorMatrix_$Impl_$.__toFlashColorTransform(colorMatrix)); + break; + default: + } + } + ,copyChannel: function(sourceImage,sourceRect,destPoint,sourceChannel,destChannel) { + sourceRect = this.__clipRect(sourceRect); + if(this.buffer == null || sourceRect == null) { + return; + } + if(destChannel == lime_graphics_ImageChannel.ALPHA && !this.get_transparent()) { + return; + } + if(sourceRect.width <= 0 || sourceRect.height <= 0) { + return; + } + if(sourceRect.x + sourceRect.width > sourceImage.width) { + sourceRect.width = sourceImage.width - sourceRect.x; + } + if(sourceRect.y + sourceRect.height > sourceImage.height) { + sourceRect.height = sourceImage.height - sourceRect.y; + } + var _g = this.type; + switch(Type.enumIndex(_g)) { + case 0: + lime_graphics_utils_ImageCanvasUtil.copyChannel(this,sourceImage,sourceRect,destPoint,sourceChannel,destChannel); + break; + case 1: + lime_graphics_utils_ImageCanvasUtil.convertToData(this); + lime_graphics_utils_ImageDataUtil.copyChannel(this,sourceImage,sourceRect,destPoint,sourceChannel,destChannel); + break; + case 2: + var srcChannel; + switch(Type.enumIndex(sourceChannel)) { + case 0: + srcChannel = 1; + break; + case 1: + srcChannel = 2; + break; + case 2: + srcChannel = 4; + break; + case 3: + srcChannel = 8; + break; + } + var dstChannel; + switch(Type.enumIndex(destChannel)) { + case 0: + dstChannel = 1; + break; + case 1: + dstChannel = 2; + break; + case 2: + dstChannel = 4; + break; + case 3: + dstChannel = 8; + break; + } + sourceRect.offset(sourceImage.offsetX,sourceImage.offsetY); + destPoint.offset(this.offsetX,this.offsetY); + this.buffer.__srcBitmapData.copyChannel(sourceImage.buffer.get_src(),sourceRect.__toFlashRectangle(),destPoint.__toFlashPoint(),srcChannel,dstChannel); + break; + default: + } + } + ,copyPixels: function(sourceImage,sourceRect,destPoint,alphaImage,alphaPoint,mergeAlpha) { + if(mergeAlpha == null) { + mergeAlpha = false; + } + if(this.buffer == null || sourceImage == null) { + return; + } + if(sourceRect.width <= 0 || sourceRect.height <= 0) { + return; + } + if(this.width <= 0 || this.height <= 0) { + return; + } + if(sourceRect.x + sourceRect.width > sourceImage.width) { + sourceRect.width = sourceImage.width - sourceRect.x; + } + if(sourceRect.y + sourceRect.height > sourceImage.height) { + sourceRect.height = sourceImage.height - sourceRect.y; + } + if(sourceRect.x < 0) { + sourceRect.width += sourceRect.x; + sourceRect.x = 0; + } + if(sourceRect.y < 0) { + sourceRect.height += sourceRect.y; + sourceRect.y = 0; + } + if(destPoint.x + sourceRect.width > this.width) { + sourceRect.width = this.width - destPoint.x; + } + if(destPoint.y + sourceRect.height > this.height) { + sourceRect.height = this.height - destPoint.y; + } + if(destPoint.x < 0) { + sourceRect.width += destPoint.x; + sourceRect.x = -destPoint.x; + destPoint.x = 0; + } + if(destPoint.y < 0) { + sourceRect.height += destPoint.y; + sourceRect.y = -destPoint.y; + destPoint.y = 0; + } + var _g = this.type; + switch(Type.enumIndex(_g)) { + case 0: + lime_graphics_utils_ImageCanvasUtil.convertToCanvas(this); + lime_graphics_utils_ImageCanvasUtil.copyPixels(this,sourceImage,sourceRect,destPoint,alphaImage,alphaPoint,mergeAlpha); + break; + case 1: + lime_graphics_utils_ImageCanvasUtil.convertToData(this); + lime_graphics_utils_ImageCanvasUtil.convertToData(sourceImage); + lime_graphics_utils_ImageDataUtil.copyPixels(this,sourceImage,sourceRect,destPoint,alphaImage,alphaPoint,mergeAlpha); + break; + case 2: + sourceRect.offset(sourceImage.offsetX,sourceImage.offsetY); + destPoint.offset(this.offsetX,this.offsetY); + if(alphaImage != null && alphaPoint != null) { + alphaPoint.offset(alphaImage.offsetX,alphaImage.offsetY); + } + this.buffer.__srcBitmapData.copyPixels(sourceImage.buffer.__srcBitmapData,sourceRect.__toFlashRectangle(),destPoint.__toFlashPoint(),alphaImage != null ? alphaImage.buffer.get_src() : null,alphaPoint != null ? alphaPoint.__toFlashPoint() : null,mergeAlpha); + break; + default: + } + } + ,fillRect: function(rect,color,format) { + rect = this.__clipRect(rect); + if(this.buffer == null || rect == null) { + return; + } + var _g = this.type; + switch(Type.enumIndex(_g)) { + case 0: + lime_graphics_utils_ImageCanvasUtil.fillRect(this,rect,color,format); + break; + case 1: + lime_graphics_utils_ImageCanvasUtil.convertToData(this); + if(this.buffer.data.length == 0) { + return; + } + lime_graphics_utils_ImageDataUtil.fillRect(this,rect,color,format); + break; + case 2: + rect.offset(this.offsetX,this.offsetY); + var argb; + if(format == null) { + var rgba = color; + var this1 = 0; + var argb1 = this1; + argb1 = (rgba & 255 & 255) << 24 | (rgba >> 24 & 255 & 255) << 16 | (rgba >> 16 & 255 & 255) << 8 | rgba >> 8 & 255 & 255; + argb = argb1; + } else { + switch(format) { + case 1: + argb = color; + break; + case 2: + var bgra = color; + var this2 = 0; + var argb2 = this2; + argb2 = (bgra & 255 & 255) << 24 | (bgra >> 8 & 255 & 255) << 16 | (bgra >> 16 & 255 & 255) << 8 | bgra >> 24 & 255 & 255; + argb = argb2; + break; + default: + var rgba1 = color; + var this3 = 0; + var argb3 = this3; + argb3 = (rgba1 & 255 & 255) << 24 | (rgba1 >> 24 & 255 & 255) << 16 | (rgba1 >> 16 & 255 & 255) << 8 | rgba1 >> 8 & 255 & 255; + argb = argb3; + } + } + this.buffer.__srcBitmapData.fillRect(rect.__toFlashRectangle(),argb); + break; + default: + } + } + ,getPixel: function(x,y,format) { + if(this.buffer == null || x < 0 || y < 0 || x >= this.width || y >= this.height) { + return 0; + } + var _g = this.type; + switch(Type.enumIndex(_g)) { + case 0: + return lime_graphics_utils_ImageCanvasUtil.getPixel(this,x,y,format); + case 1: + lime_graphics_utils_ImageCanvasUtil.convertToData(this); + return lime_graphics_utils_ImageDataUtil.getPixel(this,x,y,format); + case 2: + var color = this.buffer.__srcBitmapData.getPixel(x + this.offsetX,y + this.offsetY); + if(format == null) { + var this1 = 0; + var rgba = this1; + rgba = (color >> 16 & 255 & 255) << 24 | (color >> 8 & 255 & 255) << 16 | (color & 255 & 255) << 8 | color >> 24 & 255 & 255; + var rgba1 = rgba; + return rgba1; + } else { + switch(format) { + case 1: + return color; + case 2: + var this2 = 0; + var bgra = this2; + bgra = (color & 255 & 255) << 24 | (color >> 8 & 255 & 255) << 16 | (color >> 16 & 255 & 255) << 8 | color >> 24 & 255 & 255; + var bgra1 = bgra; + return bgra1; + default: + var this3 = 0; + var rgba2 = this3; + rgba2 = (color >> 16 & 255 & 255) << 24 | (color >> 8 & 255 & 255) << 16 | (color & 255 & 255) << 8 | color >> 24 & 255 & 255; + var rgba3 = rgba2; + return rgba3; + } + } + break; + default: + return 0; + } + } + ,resize: function(newWidth,newHeight) { + var _g = this.type; + switch(Type.enumIndex(_g)) { + case 0: + lime_graphics_utils_ImageCanvasUtil.resize(this,newWidth,newHeight); + break; + case 1: + lime_graphics_utils_ImageDataUtil.resize(this,newWidth,newHeight); + break; + case 2: + break; + default: + } + this.buffer.width = newWidth; + this.buffer.height = newHeight; + this.offsetX = 0; + this.offsetY = 0; + this.width = newWidth; + this.height = newHeight; + } + ,setPixel: function(x,y,color,format) { + if(this.buffer == null || x < 0 || y < 0 || x >= this.width || y >= this.height) { + return; + } + var _g = this.type; + switch(Type.enumIndex(_g)) { + case 0: + lime_graphics_utils_ImageCanvasUtil.setPixel(this,x,y,color,format); + break; + case 1: + lime_graphics_utils_ImageCanvasUtil.convertToData(this); + lime_graphics_utils_ImageDataUtil.setPixel(this,x,y,color,format); + break; + case 2: + var argb; + if(format == null) { + var rgba = color; + var this1 = 0; + var argb1 = this1; + argb1 = (rgba & 255 & 255) << 24 | (rgba >> 24 & 255 & 255) << 16 | (rgba >> 16 & 255 & 255) << 8 | rgba >> 8 & 255 & 255; + argb = argb1; + } else { + switch(format) { + case 1: + argb = color; + break; + case 2: + var bgra = color; + var this2 = 0; + var argb2 = this2; + argb2 = (bgra & 255 & 255) << 24 | (bgra >> 8 & 255 & 255) << 16 | (bgra >> 16 & 255 & 255) << 8 | bgra >> 24 & 255 & 255; + argb = argb2; + break; + default: + var rgba1 = color; + var this3 = 0; + var argb3 = this3; + argb3 = (rgba1 & 255 & 255) << 24 | (rgba1 >> 24 & 255 & 255) << 16 | (rgba1 >> 16 & 255 & 255) << 8 | rgba1 >> 8 & 255 & 255; + argb = argb3; + } + } + this.buffer.__srcBitmapData.setPixel(x + this.offsetX,y + this.offsetX,argb); + break; + default: + } + } + ,__clipRect: function(r) { + if(r == null) { + return null; + } + if(r.x < 0) { + r.width -= -r.x; + r.x = 0; + if(r.x + r.width <= 0) { + return null; + } + } + if(r.y < 0) { + r.height -= -r.y; + r.y = 0; + if(r.y + r.height <= 0) { + return null; + } + } + if(r.x + r.width >= this.width) { + r.width -= r.x + r.width - this.width; + if(r.width <= 0) { + return null; + } + } + if(r.y + r.height >= this.height) { + r.height -= r.y + r.height - this.height; + if(r.height <= 0) { + return null; + } + } + return r; + } + ,__fromBase64: function(base64,type,onload) { + var _gthis = this; + var image = new Image(); + image.crossOrigin = "Anonymous"; + var image_onLoaded = function(event) { + _gthis.buffer = new lime_graphics_ImageBuffer(null,image.width,image.height); + _gthis.buffer.__srcImage = image; + _gthis.offsetX = 0; + _gthis.offsetY = 0; + _gthis.width = _gthis.buffer.width; + _gthis.height = _gthis.buffer.height; + if(onload != null) { + onload(_gthis); + } + }; + image.addEventListener("load",image_onLoaded,false); + image.src = "data:" + type + ";base64," + base64; + } + ,__fromBytes: function(bytes,onload) { + var type = ""; + if(lime_graphics_Image.__isPNG(bytes)) { + type = "image/png"; + } else if(lime_graphics_Image.__isJPG(bytes)) { + type = "image/jpeg"; + } else if(lime_graphics_Image.__isGIF(bytes)) { + type = "image/gif"; + } else { + throw new js__$Boot_HaxeError("Image tried to read PNG/JPG Bytes, but found an invalid header."); + } + this.__fromBase64(lime_graphics_Image.__base64Encode(bytes),type,onload); + } + ,__fromFile: function(path,onload,onerror) { + var _gthis = this; + var image = new Image(); + image.crossOrigin = "Anonymous"; + image.onload = function(_) { + _gthis.buffer = new lime_graphics_ImageBuffer(null,image.width,image.height); + _gthis.buffer.__srcImage = image; + _gthis.width = image.width; + _gthis.height = image.height; + if(onload != null) { + onload(_gthis); + } + }; + image.onerror = function(_1) { + if(onerror != null) { + onerror(); + } + }; + image.src = path; + var image1 = image.complete; + } + ,__fromImageBuffer: function(buffer) { + this.buffer = buffer; + if(buffer != null) { + if(this.width == -1) { + this.width = buffer.width; + } + if(this.height == -1) { + this.height = buffer.height; + } + } + } + ,get_data: function() { + if(this.buffer.data == null && this.buffer.width > 0 && this.buffer.height > 0) { + lime_graphics_utils_ImageCanvasUtil.convertToCanvas(this); + lime_graphics_utils_ImageCanvasUtil.sync(this,false); + lime_graphics_utils_ImageCanvasUtil.createImageData(this); + } + return this.buffer.data; + } + ,get_format: function() { + return this.buffer.format; + } + ,set_format: function(value) { + if(this.buffer.format != value) { + var _g = this.type; + if(Type.enumIndex(_g) == 1) { + lime_graphics_utils_ImageDataUtil.setFormat(this,value); + } + } + return this.buffer.format = value; + } + ,get_powerOfTwo: function() { + if(this.buffer.width != 0 && (this.buffer.width & ~this.buffer.width + 1) == this.buffer.width) { + if(this.buffer.height != 0) { + return (this.buffer.height & ~this.buffer.height + 1) == this.buffer.height; + } else { + return false; + } + } else { + return false; + } + } + ,get_premultiplied: function() { + return this.buffer.premultiplied; + } + ,set_premultiplied: function(value) { + if(value && !this.buffer.premultiplied) { + var _g = this.type; + if(Type.enumIndex(_g) == 1) { + lime_graphics_utils_ImageCanvasUtil.convertToData(this); + lime_graphics_utils_ImageDataUtil.multiplyAlpha(this); + } + } else if(!value && this.buffer.premultiplied) { + var _g1 = this.type; + if(Type.enumIndex(_g1) == 1) { + lime_graphics_utils_ImageCanvasUtil.convertToData(this); + lime_graphics_utils_ImageDataUtil.unmultiplyAlpha(this); + } + } + return value; + } + ,get_rect: function() { + return new lime_math_Rectangle(0,0,this.width,this.height); + } + ,get_src: function() { + if(this.buffer.__srcCanvas == null) { + lime_graphics_utils_ImageCanvasUtil.convertToCanvas(this); + } + return this.buffer.get_src(); + } + ,get_transparent: function() { + if(this.buffer == null) { + return false; + } + return this.buffer.transparent; + } + ,set_transparent: function(value) { + if(this.buffer == null) { + return false; + } + return this.buffer.transparent = value; + } + ,__class__: lime_graphics_Image + ,__properties__: {get_rect:"get_rect",set_transparent:"set_transparent",get_transparent:"get_transparent",get_src:"get_src",set_premultiplied:"set_premultiplied",get_premultiplied:"get_premultiplied",get_powerOfTwo:"get_powerOfTwo",set_format:"set_format",get_format:"get_format",get_data:"get_data"} +}; +var lime_graphics_ImageBuffer = function(data,width,height,bitsPerPixel,format) { + if(bitsPerPixel == null) { + bitsPerPixel = 32; + } + if(height == null) { + height = 0; + } + if(width == null) { + width = 0; + } + this.data = data; + this.width = width; + this.height = height; + this.bitsPerPixel = bitsPerPixel; + this.format = format == null ? 0 : format; + this.transparent = true; +}; +$hxClasses["lime.graphics.ImageBuffer"] = lime_graphics_ImageBuffer; +lime_graphics_ImageBuffer.__name__ = ["lime","graphics","ImageBuffer"]; +lime_graphics_ImageBuffer.prototype = { + bitsPerPixel: null + ,data: null + ,format: null + ,height: null + ,premultiplied: null + ,transparent: null + ,width: null + ,__srcBitmapData: null + ,__srcCanvas: null + ,__srcContext: null + ,__srcImage: null + ,__srcImageData: null + ,clone: function() { + var buffer = new lime_graphics_ImageBuffer(this.data,this.width,this.height,this.bitsPerPixel); + if(this.data != null) { + var elements = this.data.byteLength; + var this1; + if(elements != null) { + this1 = new Uint8Array(elements); + } else { + this1 = null; + } + buffer.data = this1; + var view = this.data; + var this2; + if(view != null) { + this2 = new Uint8Array(view); + } else { + this2 = null; + } + var copy = this2; + buffer.data.set(copy); + } else if(this.__srcImageData != null) { + buffer.__srcCanvas = js_Browser.get_document().createElement("canvas"); + buffer.__srcContext = buffer.__srcCanvas.getContext("2d"); + buffer.__srcCanvas.width = this.__srcImageData.width; + buffer.__srcCanvas.height = this.__srcImageData.height; + buffer.__srcImageData = buffer.__srcContext.createImageData(this.__srcImageData.width,this.__srcImageData.height); + var copy1 = new Uint8ClampedArray(this.__srcImageData.data); + buffer.__srcImageData.data.set(copy1); + } else if(this.__srcCanvas != null) { + buffer.__srcCanvas = js_Browser.get_document().createElement("canvas"); + buffer.__srcContext = buffer.__srcCanvas.getContext("2d"); + buffer.__srcCanvas.width = this.__srcCanvas.width; + buffer.__srcCanvas.height = this.__srcCanvas.height; + buffer.__srcContext.drawImage(this.__srcCanvas,0,0); + } else { + buffer.__srcImage = this.__srcImage; + } + buffer.bitsPerPixel = this.bitsPerPixel; + buffer.format = this.format; + buffer.premultiplied = this.premultiplied; + buffer.transparent = this.transparent; + return buffer; + } + ,get_src: function() { + if(this.__srcImage != null) { + return this.__srcImage; + } + return this.__srcCanvas; + } + ,set_src: function(value) { + if(Std["is"](value,Image)) { + this.__srcImage = value; + } else if(Std["is"](value,HTMLCanvasElement)) { + this.__srcCanvas = value; + this.__srcContext = this.__srcCanvas.getContext("2d"); + } + return value; + } + ,get_stride: function() { + return this.width * 4; + } + ,__class__: lime_graphics_ImageBuffer + ,__properties__: {get_stride:"get_stride",set_src:"set_src",get_src:"get_src"} +}; +var lime_graphics_ImageChannel = $hxClasses["lime.graphics.ImageChannel"] = { __ename__ : ["lime","graphics","ImageChannel"], __constructs__ : ["RED","GREEN","BLUE","ALPHA"] }; +lime_graphics_ImageChannel.RED = ["RED",0]; +lime_graphics_ImageChannel.RED.toString = $estr; +lime_graphics_ImageChannel.RED.__enum__ = lime_graphics_ImageChannel; +lime_graphics_ImageChannel.GREEN = ["GREEN",1]; +lime_graphics_ImageChannel.GREEN.toString = $estr; +lime_graphics_ImageChannel.GREEN.__enum__ = lime_graphics_ImageChannel; +lime_graphics_ImageChannel.BLUE = ["BLUE",2]; +lime_graphics_ImageChannel.BLUE.toString = $estr; +lime_graphics_ImageChannel.BLUE.__enum__ = lime_graphics_ImageChannel; +lime_graphics_ImageChannel.ALPHA = ["ALPHA",3]; +lime_graphics_ImageChannel.ALPHA.toString = $estr; +lime_graphics_ImageChannel.ALPHA.__enum__ = lime_graphics_ImageChannel; +var lime_graphics_ImageType = $hxClasses["lime.graphics.ImageType"] = { __ename__ : ["lime","graphics","ImageType"], __constructs__ : ["CANVAS","DATA","FLASH","CUSTOM"] }; +lime_graphics_ImageType.CANVAS = ["CANVAS",0]; +lime_graphics_ImageType.CANVAS.toString = $estr; +lime_graphics_ImageType.CANVAS.__enum__ = lime_graphics_ImageType; +lime_graphics_ImageType.DATA = ["DATA",1]; +lime_graphics_ImageType.DATA.toString = $estr; +lime_graphics_ImageType.DATA.__enum__ = lime_graphics_ImageType; +lime_graphics_ImageType.FLASH = ["FLASH",2]; +lime_graphics_ImageType.FLASH.toString = $estr; +lime_graphics_ImageType.FLASH.__enum__ = lime_graphics_ImageType; +lime_graphics_ImageType.CUSTOM = ["CUSTOM",3]; +lime_graphics_ImageType.CUSTOM.toString = $estr; +lime_graphics_ImageType.CUSTOM.__enum__ = lime_graphics_ImageType; +var lime_graphics_RenderContext = $hxClasses["lime.graphics.RenderContext"] = { __ename__ : ["lime","graphics","RenderContext"], __constructs__ : ["OPENGL","CANVAS","DOM","FLASH","CAIRO","CONSOLE","CUSTOM","NONE"] }; +lime_graphics_RenderContext.OPENGL = function(gl) { var $x = ["OPENGL",0,gl]; $x.__enum__ = lime_graphics_RenderContext; $x.toString = $estr; return $x; }; +lime_graphics_RenderContext.CANVAS = function(context) { var $x = ["CANVAS",1,context]; $x.__enum__ = lime_graphics_RenderContext; $x.toString = $estr; return $x; }; +lime_graphics_RenderContext.DOM = function(element) { var $x = ["DOM",2,element]; $x.__enum__ = lime_graphics_RenderContext; $x.toString = $estr; return $x; }; +lime_graphics_RenderContext.FLASH = function(stage) { var $x = ["FLASH",3,stage]; $x.__enum__ = lime_graphics_RenderContext; $x.toString = $estr; return $x; }; +lime_graphics_RenderContext.CAIRO = function(cairo) { var $x = ["CAIRO",4,cairo]; $x.__enum__ = lime_graphics_RenderContext; $x.toString = $estr; return $x; }; +lime_graphics_RenderContext.CONSOLE = function(context) { var $x = ["CONSOLE",5,context]; $x.__enum__ = lime_graphics_RenderContext; $x.toString = $estr; return $x; }; +lime_graphics_RenderContext.CUSTOM = function(data) { var $x = ["CUSTOM",6,data]; $x.__enum__ = lime_graphics_RenderContext; $x.toString = $estr; return $x; }; +lime_graphics_RenderContext.NONE = ["NONE",7]; +lime_graphics_RenderContext.NONE.toString = $estr; +lime_graphics_RenderContext.NONE.__enum__ = lime_graphics_RenderContext; +var lime_graphics_Renderer = function(window) { + this.onRender = new lime_app_Event_$Void_$Void(); + this.onContextRestored = new lime_app_Event_$lime_$graphics_$RenderContext_$Void(); + this.onContextLost = new lime_app_Event_$Void_$Void(); + this.window = window; + this.backend = new lime__$backend_html5_HTML5Renderer(this); + this.window.renderer = this; +}; +$hxClasses["lime.graphics.Renderer"] = lime_graphics_Renderer; +lime_graphics_Renderer.__name__ = ["lime","graphics","Renderer"]; +lime_graphics_Renderer.prototype = { + context: null + ,onContextLost: null + ,onContextRestored: null + ,onRender: null + ,type: null + ,window: null + ,backend: null + ,create: function() { + this.backend.create(); + } + ,flip: function() { + this.backend.flip(); + } + ,__class__: lime_graphics_Renderer +}; +var lime_graphics_RendererType = $hxClasses["lime.graphics.RendererType"] = { __ename__ : ["lime","graphics","RendererType"], __constructs__ : ["OPENGL","CANVAS","DOM","FLASH","CAIRO","CONSOLE","CUSTOM"] }; +lime_graphics_RendererType.OPENGL = ["OPENGL",0]; +lime_graphics_RendererType.OPENGL.toString = $estr; +lime_graphics_RendererType.OPENGL.__enum__ = lime_graphics_RendererType; +lime_graphics_RendererType.CANVAS = ["CANVAS",1]; +lime_graphics_RendererType.CANVAS.toString = $estr; +lime_graphics_RendererType.CANVAS.__enum__ = lime_graphics_RendererType; +lime_graphics_RendererType.DOM = ["DOM",2]; +lime_graphics_RendererType.DOM.toString = $estr; +lime_graphics_RendererType.DOM.__enum__ = lime_graphics_RendererType; +lime_graphics_RendererType.FLASH = ["FLASH",3]; +lime_graphics_RendererType.FLASH.toString = $estr; +lime_graphics_RendererType.FLASH.__enum__ = lime_graphics_RendererType; +lime_graphics_RendererType.CAIRO = ["CAIRO",4]; +lime_graphics_RendererType.CAIRO.toString = $estr; +lime_graphics_RendererType.CAIRO.__enum__ = lime_graphics_RendererType; +lime_graphics_RendererType.CONSOLE = ["CONSOLE",5]; +lime_graphics_RendererType.CONSOLE.toString = $estr; +lime_graphics_RendererType.CONSOLE.__enum__ = lime_graphics_RendererType; +lime_graphics_RendererType.CUSTOM = ["CUSTOM",6]; +lime_graphics_RendererType.CUSTOM.toString = $estr; +lime_graphics_RendererType.CUSTOM.__enum__ = lime_graphics_RendererType; +var lime_graphics_cairo_Cairo = function() { }; +$hxClasses["lime.graphics.cairo.Cairo"] = lime_graphics_cairo_Cairo; +lime_graphics_cairo_Cairo.__name__ = ["lime","graphics","cairo","Cairo"]; +lime_graphics_cairo_Cairo.prototype = { + arc: function(xc,yc,radius,angle1,angle2) { + } + ,clip: function() { + } + ,curveTo: function(x1,y1,x2,y2,x3,y3) { + } + ,fill: function() { + } + ,identityMatrix: function() { + } + ,lineTo: function(x,y) { + } + ,moveTo: function(x,y) { + } + ,newPath: function() { + } + ,paint: function() { + } + ,paintWithAlpha: function(alpha) { + } + ,popGroupToSource: function() { + } + ,pushGroup: function() { + } + ,rectangle: function(x,y,width,height) { + } + ,restore: function() { + } + ,save: function() { + } + ,setSourceRGB: function(r,g,b) { + } + ,get_currentPoint: function() { + return null; + } + ,get_hasCurrentPoint: function() { + return false; + } + ,set_matrix: function(value) { + return value; + } + ,set_source: function(value) { + return value; + } + ,__class__: lime_graphics_cairo_Cairo + ,__properties__: {set_source:"set_source",set_matrix:"set_matrix",get_hasCurrentPoint:"get_hasCurrentPoint",get_currentPoint:"get_currentPoint"} +}; +var lime_graphics_cairo__$CairoImageSurface_CairoImageSurface_$Impl_$ = {}; +$hxClasses["lime.graphics.cairo._CairoImageSurface.CairoImageSurface_Impl_"] = lime_graphics_cairo__$CairoImageSurface_CairoImageSurface_$Impl_$; +lime_graphics_cairo__$CairoImageSurface_CairoImageSurface_$Impl_$.__name__ = ["lime","graphics","cairo","_CairoImageSurface","CairoImageSurface_Impl_"]; +lime_graphics_cairo__$CairoImageSurface_CairoImageSurface_$Impl_$.fromImage = function(image) { + return null; +}; +var lime_graphics_cairo__$CairoPattern_CairoPattern_$Impl_$ = {}; +$hxClasses["lime.graphics.cairo._CairoPattern.CairoPattern_Impl_"] = lime_graphics_cairo__$CairoPattern_CairoPattern_$Impl_$; +lime_graphics_cairo__$CairoPattern_CairoPattern_$Impl_$.__name__ = ["lime","graphics","cairo","_CairoPattern","CairoPattern_Impl_"]; +lime_graphics_cairo__$CairoPattern_CairoPattern_$Impl_$.__properties__ = {set_filter:"set_filter"}; +lime_graphics_cairo__$CairoPattern_CairoPattern_$Impl_$.createForSurface = function(surface) { + return 0; +}; +lime_graphics_cairo__$CairoPattern_CairoPattern_$Impl_$.set_filter = function(this1,value) { + return value; +}; +var lime_graphics_cairo__$CairoSurface_CairoSurface_$Impl_$ = {}; +$hxClasses["lime.graphics.cairo._CairoSurface.CairoSurface_Impl_"] = lime_graphics_cairo__$CairoSurface_CairoSurface_$Impl_$; +lime_graphics_cairo__$CairoSurface_CairoSurface_$Impl_$.__name__ = ["lime","graphics","cairo","_CairoSurface","CairoSurface_Impl_"]; +lime_graphics_cairo__$CairoSurface_CairoSurface_$Impl_$.flush = function(this1) { +}; +var lime_graphics_opengl_GL = function() { }; +$hxClasses["lime.graphics.opengl.GL"] = lime_graphics_opengl_GL; +lime_graphics_opengl_GL.__name__ = ["lime","graphics","opengl","GL"]; +lime_graphics_opengl_GL.context = null; +var lime_graphics_utils_ImageCanvasUtil = function() { }; +$hxClasses["lime.graphics.utils.ImageCanvasUtil"] = lime_graphics_utils_ImageCanvasUtil; +lime_graphics_utils_ImageCanvasUtil.__name__ = ["lime","graphics","utils","ImageCanvasUtil"]; +lime_graphics_utils_ImageCanvasUtil.colorTransform = function(image,rect,colorMatrix) { + lime_graphics_utils_ImageCanvasUtil.convertToCanvas(image); + lime_graphics_utils_ImageCanvasUtil.createImageData(image); + lime_graphics_utils_ImageDataUtil.colorTransform(image,rect,colorMatrix); +}; +lime_graphics_utils_ImageCanvasUtil.convertToCanvas = function(image) { + var buffer = image.buffer; + if(buffer.__srcImage != null) { + if(buffer.__srcCanvas == null) { + lime_graphics_utils_ImageCanvasUtil.createCanvas(image,buffer.__srcImage.width,buffer.__srcImage.height); + buffer.__srcContext.drawImage(buffer.__srcImage,0,0); + } + buffer.__srcImage = null; + } else if(buffer.data != null && buffer.__srcCanvas == null) { + lime_graphics_utils_ImageCanvasUtil.createCanvas(image,buffer.width,buffer.height); + lime_graphics_utils_ImageCanvasUtil.createImageData(image); + } else if(buffer.data == null && buffer.__srcImageData != null) { + buffer.data = buffer.__srcImageData.data; + } +}; +lime_graphics_utils_ImageCanvasUtil.convertToData = function(image) { + if(image.buffer.data == null) { + lime_graphics_utils_ImageCanvasUtil.convertToCanvas(image); + lime_graphics_utils_ImageCanvasUtil.sync(image,false); + lime_graphics_utils_ImageCanvasUtil.createImageData(image); + image.buffer.__srcCanvas = null; + image.buffer.__srcContext = null; + } +}; +lime_graphics_utils_ImageCanvasUtil.copyChannel = function(image,sourceImage,sourceRect,destPoint,sourceChannel,destChannel) { + lime_graphics_utils_ImageCanvasUtil.convertToCanvas(sourceImage); + lime_graphics_utils_ImageCanvasUtil.createImageData(sourceImage); + lime_graphics_utils_ImageCanvasUtil.convertToCanvas(image); + lime_graphics_utils_ImageCanvasUtil.createImageData(image); + lime_graphics_utils_ImageDataUtil.copyChannel(image,sourceImage,sourceRect,destPoint,sourceChannel,destChannel); +}; +lime_graphics_utils_ImageCanvasUtil.copyPixels = function(image,sourceImage,sourceRect,destPoint,alphaImage,alphaPoint,mergeAlpha) { + if(mergeAlpha == null) { + mergeAlpha = false; + } + if(destPoint == null || destPoint.x >= image.width || destPoint.y >= image.height || sourceRect == null || sourceRect.width < 1 || sourceRect.height < 1) { + return; + } + if(alphaImage != null && alphaImage.get_transparent()) { + if(alphaPoint == null) { + alphaPoint = new lime_math_Vector2(); + } + var tempData = image.clone(); + tempData.copyChannel(alphaImage,new lime_math_Rectangle(alphaPoint.x,alphaPoint.y,sourceRect.width,sourceRect.height),new lime_math_Vector2(sourceRect.x,sourceRect.y),lime_graphics_ImageChannel.ALPHA,lime_graphics_ImageChannel.ALPHA); + sourceImage = tempData; + } + lime_graphics_utils_ImageCanvasUtil.sync(image,true); + if(!mergeAlpha) { + if(image.get_transparent() && sourceImage.get_transparent()) { + image.buffer.__srcContext.clearRect(destPoint.x + image.offsetX,destPoint.y + image.offsetY,sourceRect.width + image.offsetX,sourceRect.height + image.offsetY); + } + } + lime_graphics_utils_ImageCanvasUtil.sync(sourceImage,false); + if(sourceImage.buffer.get_src() != null) { + image.buffer.__srcContext.drawImage(sourceImage.buffer.get_src(),Std["int"](sourceRect.x + sourceImage.offsetX),Std["int"](sourceRect.y + sourceImage.offsetY),Std["int"](sourceRect.width),Std["int"](sourceRect.height),Std["int"](destPoint.x + image.offsetX),Std["int"](destPoint.y + image.offsetY),Std["int"](sourceRect.width),Std["int"](sourceRect.height)); + } +}; +lime_graphics_utils_ImageCanvasUtil.createCanvas = function(image,width,height) { + var buffer = image.buffer; + if(buffer.__srcCanvas == null) { + buffer.__srcCanvas = js_Browser.get_document().createElement("canvas"); + buffer.__srcCanvas.width = width; + buffer.__srcCanvas.height = height; + if(!image.get_transparent()) { + if(!image.get_transparent()) { + buffer.__srcCanvas.setAttribute("moz-opaque","true"); + } + buffer.__srcContext = buffer.__srcCanvas.getContext ("2d", { alpha: false }); + } else { + buffer.__srcContext = buffer.__srcCanvas.getContext("2d"); + } + buffer.__srcContext.mozImageSmoothingEnabled = false; + buffer.__srcContext.msImageSmoothingEnabled = false; + buffer.__srcContext.imageSmoothingEnabled = false; + } +}; +lime_graphics_utils_ImageCanvasUtil.createImageData = function(image) { + var buffer = image.buffer; + if(buffer.__srcImageData == null) { + if(buffer.data == null) { + buffer.__srcImageData = buffer.__srcContext.getImageData(0,0,buffer.width,buffer.height); + } else { + buffer.__srcImageData = buffer.__srcContext.createImageData(buffer.width,buffer.height); + buffer.__srcImageData.data.set(buffer.data); + } + var elements = buffer.__srcImageData.data.buffer; + var this1; + if(elements != null) { + this1 = new Uint8Array(elements); + } else { + this1 = null; + } + buffer.data = this1; + } +}; +lime_graphics_utils_ImageCanvasUtil.fillRect = function(image,rect,color,format) { + lime_graphics_utils_ImageCanvasUtil.convertToCanvas(image); + lime_graphics_utils_ImageCanvasUtil.sync(image,true); + if(rect.x == 0 && rect.y == 0 && rect.width == image.width && rect.height == image.height) { + if(image.get_transparent() && (color & 255) == 0) { + image.buffer.__srcCanvas.width = image.buffer.width; + return; + } + } + var r; + var g; + var b; + var a; + if(format == 1) { + r = color >> 16 & 255; + g = color >> 8 & 255; + b = color & 255; + if(image.get_transparent()) { + a = color >> 24 & 255; + } else { + a = 255; + } + } else { + r = color >> 24 & 255; + g = color >> 16 & 255; + b = color >> 8 & 255; + if(image.get_transparent()) { + a = color & 255; + } else { + a = 255; + } + } + image.buffer.__srcContext.fillStyle = "rgba(" + r + ", " + g + ", " + b + ", " + a / 255 + ")"; + image.buffer.__srcContext.fillRect(rect.x + image.offsetX,rect.y + image.offsetY,rect.width + image.offsetX,rect.height + image.offsetY); +}; +lime_graphics_utils_ImageCanvasUtil.getPixel = function(image,x,y,format) { + lime_graphics_utils_ImageCanvasUtil.convertToCanvas(image); + lime_graphics_utils_ImageCanvasUtil.createImageData(image); + return lime_graphics_utils_ImageDataUtil.getPixel(image,x,y,format); +}; +lime_graphics_utils_ImageCanvasUtil.resize = function(image,newWidth,newHeight) { + var buffer = image.buffer; + if(buffer.__srcCanvas == null) { + lime_graphics_utils_ImageCanvasUtil.createCanvas(image,newWidth,newHeight); + buffer.__srcContext.drawImage(buffer.get_src(),0,0,newWidth,newHeight); + } else { + lime_graphics_utils_ImageCanvasUtil.sync(image,true); + var sourceCanvas = buffer.__srcCanvas; + buffer.__srcCanvas = null; + lime_graphics_utils_ImageCanvasUtil.createCanvas(image,newWidth,newHeight); + buffer.__srcContext.drawImage(sourceCanvas,0,0,newWidth,newHeight); + } +}; +lime_graphics_utils_ImageCanvasUtil.setPixel = function(image,x,y,color,format) { + lime_graphics_utils_ImageCanvasUtil.convertToCanvas(image); + lime_graphics_utils_ImageCanvasUtil.createImageData(image); + lime_graphics_utils_ImageDataUtil.setPixel(image,x,y,color,format); +}; +lime_graphics_utils_ImageCanvasUtil.sync = function(image,clear) { + if(image.dirty && image.buffer.__srcImageData != null && image.type != lime_graphics_ImageType.DATA) { + image.buffer.__srcContext.putImageData(image.buffer.__srcImageData,0,0); + image.buffer.data = null; + image.dirty = false; + } + if(clear) { + image.buffer.__srcImageData = null; + image.buffer.data = null; + } +}; +var lime_graphics_utils_ImageDataUtil = function() { }; +$hxClasses["lime.graphics.utils.ImageDataUtil"] = lime_graphics_utils_ImageDataUtil; +lime_graphics_utils_ImageDataUtil.__name__ = ["lime","graphics","utils","ImageDataUtil"]; +lime_graphics_utils_ImageDataUtil.colorTransform = function(image,rect,colorMatrix) { + var data = image.buffer.data; + if(data == null) { + return; + } + var format = image.buffer.format; + var premultiplied = image.buffer.premultiplied; + var dataView = new lime_graphics_utils__$ImageDataUtil_ImageDataView(image,rect); + var alphaTable = lime_math__$ColorMatrix_ColorMatrix_$Impl_$.getAlphaTable(colorMatrix); + var redTable = lime_math__$ColorMatrix_ColorMatrix_$Impl_$.getRedTable(colorMatrix); + var greenTable = lime_math__$ColorMatrix_ColorMatrix_$Impl_$.getGreenTable(colorMatrix); + var blueTable = lime_math__$ColorMatrix_ColorMatrix_$Impl_$.getBlueTable(colorMatrix); + var row; + var offset; + var pixel; + var _g1 = 0; + var _g = dataView.height; + while(_g1 < _g) { + var y = _g1++; + row = dataView.row(y); + var _g3 = 0; + var _g2 = dataView.width; + while(_g3 < _g2) { + var x = _g3++; + offset = row + x * 4; + switch(format) { + case 0: + pixel = (data[offset] & 255) << 24 | (data[offset + 1] & 255) << 16 | (data[offset + 2] & 255) << 8 | data[offset + 3] & 255; + break; + case 1: + pixel = (data[offset + 1] & 255) << 24 | (data[offset + 2] & 255) << 16 | (data[offset + 3] & 255) << 8 | data[offset] & 255; + break; + case 2: + pixel = (data[offset + 2] & 255) << 24 | (data[offset + 1] & 255) << 16 | (data[offset] & 255) << 8 | data[offset + 3] & 255; + break; + } + if(premultiplied) { + if((pixel & 255) != 0 && (pixel & 255) != 255) { + lime_math_color__$RGBA_RGBA_$Impl_$.unmult = 255.0 / (pixel & 255); + pixel = (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((pixel >> 24 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 24 | (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((pixel >> 16 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 16 | (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((pixel >> 8 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 8 | pixel & 255 & 255; + } + } + pixel = (redTable[pixel >> 24 & 255] & 255) << 24 | (greenTable[pixel >> 16 & 255] & 255) << 16 | (blueTable[pixel >> 8 & 255] & 255) << 8 | alphaTable[pixel & 255] & 255; + if(premultiplied) { + if((pixel & 255) == 0) { + if(pixel != 0) { + pixel = 0; + } + } else if((pixel & 255) != 255) { + lime_math_color__$RGBA_RGBA_$Impl_$.a16 = lime_math_color__$RGBA_RGBA_$Impl_$.__alpha16[pixel & 255]; + pixel = ((pixel >> 24 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.a16 >> 16 & 255) << 24 | ((pixel >> 16 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.a16 >> 16 & 255) << 16 | ((pixel >> 8 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.a16 >> 16 & 255) << 8 | pixel & 255 & 255; + } + } + switch(format) { + case 0: + data[offset] = pixel >> 24 & 255; + data[offset + 1] = pixel >> 16 & 255; + data[offset + 2] = pixel >> 8 & 255; + data[offset + 3] = pixel & 255; + break; + case 1: + data[offset] = pixel & 255; + data[offset + 1] = pixel >> 24 & 255; + data[offset + 2] = pixel >> 16 & 255; + data[offset + 3] = pixel >> 8 & 255; + break; + case 2: + data[offset] = pixel >> 8 & 255; + data[offset + 1] = pixel >> 16 & 255; + data[offset + 2] = pixel >> 24 & 255; + data[offset + 3] = pixel & 255; + break; + } + } + } + image.dirty = true; +}; +lime_graphics_utils_ImageDataUtil.copyChannel = function(image,sourceImage,sourceRect,destPoint,sourceChannel,destChannel) { + var destIdx; + switch(Type.enumIndex(destChannel)) { + case 0: + destIdx = 0; + break; + case 1: + destIdx = 1; + break; + case 2: + destIdx = 2; + break; + case 3: + destIdx = 3; + break; + } + var srcIdx; + switch(Type.enumIndex(sourceChannel)) { + case 0: + srcIdx = 0; + break; + case 1: + srcIdx = 1; + break; + case 2: + srcIdx = 2; + break; + case 3: + srcIdx = 3; + break; + } + var srcData = sourceImage.buffer.data; + var destData = image.buffer.data; + if(srcData == null || destData == null) { + return; + } + var srcView = new lime_graphics_utils__$ImageDataUtil_ImageDataView(sourceImage,sourceRect); + var destView = new lime_graphics_utils__$ImageDataUtil_ImageDataView(image,new lime_math_Rectangle(destPoint.x,destPoint.y,srcView.width,srcView.height)); + var srcFormat = sourceImage.buffer.format; + var destFormat = image.buffer.format; + var srcPremultiplied = sourceImage.buffer.premultiplied; + var destPremultiplied = image.buffer.premultiplied; + var srcPosition; + var destPosition; + var srcPixel; + var destPixel; + var value = 0; + var _g1 = 0; + var _g = destView.height; + while(_g1 < _g) { + var y = _g1++; + srcPosition = srcView.row(y); + destPosition = destView.row(y); + var _g3 = 0; + var _g2 = destView.width; + while(_g3 < _g2) { + var x = _g3++; + switch(srcFormat) { + case 0: + srcPixel = (srcData[srcPosition] & 255) << 24 | (srcData[srcPosition + 1] & 255) << 16 | (srcData[srcPosition + 2] & 255) << 8 | srcData[srcPosition + 3] & 255; + break; + case 1: + srcPixel = (srcData[srcPosition + 1] & 255) << 24 | (srcData[srcPosition + 2] & 255) << 16 | (srcData[srcPosition + 3] & 255) << 8 | srcData[srcPosition] & 255; + break; + case 2: + srcPixel = (srcData[srcPosition + 2] & 255) << 24 | (srcData[srcPosition + 1] & 255) << 16 | (srcData[srcPosition] & 255) << 8 | srcData[srcPosition + 3] & 255; + break; + } + if(srcPremultiplied) { + if((srcPixel & 255) != 0 && (srcPixel & 255) != 255) { + lime_math_color__$RGBA_RGBA_$Impl_$.unmult = 255.0 / (srcPixel & 255); + srcPixel = (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((srcPixel >> 24 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 24 | (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((srcPixel >> 16 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 16 | (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((srcPixel >> 8 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 8 | srcPixel & 255 & 255; + } + } + switch(destFormat) { + case 0: + destPixel = (destData[destPosition] & 255) << 24 | (destData[destPosition + 1] & 255) << 16 | (destData[destPosition + 2] & 255) << 8 | destData[destPosition + 3] & 255; + break; + case 1: + destPixel = (destData[destPosition + 1] & 255) << 24 | (destData[destPosition + 2] & 255) << 16 | (destData[destPosition + 3] & 255) << 8 | destData[destPosition] & 255; + break; + case 2: + destPixel = (destData[destPosition + 2] & 255) << 24 | (destData[destPosition + 1] & 255) << 16 | (destData[destPosition] & 255) << 8 | destData[destPosition + 3] & 255; + break; + } + if(destPremultiplied) { + if((destPixel & 255) != 0 && (destPixel & 255) != 255) { + lime_math_color__$RGBA_RGBA_$Impl_$.unmult = 255.0 / (destPixel & 255); + destPixel = (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((destPixel >> 24 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 24 | (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((destPixel >> 16 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 16 | (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((destPixel >> 8 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 8 | destPixel & 255 & 255; + } + } + switch(srcIdx) { + case 0: + value = srcPixel >> 24 & 255; + break; + case 1: + value = srcPixel >> 16 & 255; + break; + case 2: + value = srcPixel >> 8 & 255; + break; + case 3: + value = srcPixel & 255; + break; + } + switch(destIdx) { + case 0: + destPixel = (value & 255) << 24 | (destPixel >> 16 & 255 & 255) << 16 | (destPixel >> 8 & 255 & 255) << 8 | destPixel & 255 & 255; + break; + case 1: + destPixel = (destPixel >> 24 & 255 & 255) << 24 | (value & 255) << 16 | (destPixel >> 8 & 255 & 255) << 8 | destPixel & 255 & 255; + break; + case 2: + destPixel = (destPixel >> 24 & 255 & 255) << 24 | (destPixel >> 16 & 255 & 255) << 16 | (value & 255) << 8 | destPixel & 255 & 255; + break; + case 3: + destPixel = (destPixel >> 24 & 255 & 255) << 24 | (destPixel >> 16 & 255 & 255) << 16 | (destPixel >> 8 & 255 & 255) << 8 | value & 255; + break; + } + if(destPremultiplied) { + if((destPixel & 255) == 0) { + if(destPixel != 0) { + destPixel = 0; + } + } else if((destPixel & 255) != 255) { + lime_math_color__$RGBA_RGBA_$Impl_$.a16 = lime_math_color__$RGBA_RGBA_$Impl_$.__alpha16[destPixel & 255]; + destPixel = ((destPixel >> 24 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.a16 >> 16 & 255) << 24 | ((destPixel >> 16 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.a16 >> 16 & 255) << 16 | ((destPixel >> 8 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.a16 >> 16 & 255) << 8 | destPixel & 255 & 255; + } + } + switch(destFormat) { + case 0: + destData[destPosition] = destPixel >> 24 & 255; + destData[destPosition + 1] = destPixel >> 16 & 255; + destData[destPosition + 2] = destPixel >> 8 & 255; + destData[destPosition + 3] = destPixel & 255; + break; + case 1: + destData[destPosition] = destPixel & 255; + destData[destPosition + 1] = destPixel >> 24 & 255; + destData[destPosition + 2] = destPixel >> 16 & 255; + destData[destPosition + 3] = destPixel >> 8 & 255; + break; + case 2: + destData[destPosition] = destPixel >> 8 & 255; + destData[destPosition + 1] = destPixel >> 16 & 255; + destData[destPosition + 2] = destPixel >> 24 & 255; + destData[destPosition + 3] = destPixel & 255; + break; + } + srcPosition += 4; + destPosition += 4; + } + } + image.dirty = true; +}; +lime_graphics_utils_ImageDataUtil.copyPixels = function(image,sourceImage,sourceRect,destPoint,alphaImage,alphaPoint,mergeAlpha) { + if(mergeAlpha == null) { + mergeAlpha = false; + } + var sourceData = sourceImage.buffer.data; + var destData = image.buffer.data; + if(sourceData == null || destData == null) { + return; + } + var sourceView = new lime_graphics_utils__$ImageDataUtil_ImageDataView(sourceImage,sourceRect); + var destView = new lime_graphics_utils__$ImageDataUtil_ImageDataView(image,new lime_math_Rectangle(destPoint.x,destPoint.y,sourceView.width,sourceView.height)); + var sourceFormat = sourceImage.buffer.format; + var destFormat = image.buffer.format; + var sourcePremultiplied = sourceImage.buffer.premultiplied; + var destPremultiplied = image.buffer.premultiplied; + var sourcePosition; + var destPosition; + var sourcePixel; + if(!mergeAlpha || !sourceImage.get_transparent()) { + var _g1 = 0; + var _g = destView.height; + while(_g1 < _g) { + var y = _g1++; + sourcePosition = sourceView.row(y); + destPosition = destView.row(y); + var _g3 = 0; + var _g2 = destView.width; + while(_g3 < _g2) { + var x = _g3++; + switch(sourceFormat) { + case 0: + sourcePixel = (sourceData[sourcePosition] & 255) << 24 | (sourceData[sourcePosition + 1] & 255) << 16 | (sourceData[sourcePosition + 2] & 255) << 8 | sourceData[sourcePosition + 3] & 255; + break; + case 1: + sourcePixel = (sourceData[sourcePosition + 1] & 255) << 24 | (sourceData[sourcePosition + 2] & 255) << 16 | (sourceData[sourcePosition + 3] & 255) << 8 | sourceData[sourcePosition] & 255; + break; + case 2: + sourcePixel = (sourceData[sourcePosition + 2] & 255) << 24 | (sourceData[sourcePosition + 1] & 255) << 16 | (sourceData[sourcePosition] & 255) << 8 | sourceData[sourcePosition + 3] & 255; + break; + } + if(sourcePremultiplied) { + if((sourcePixel & 255) != 0 && (sourcePixel & 255) != 255) { + lime_math_color__$RGBA_RGBA_$Impl_$.unmult = 255.0 / (sourcePixel & 255); + sourcePixel = (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((sourcePixel >> 24 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 24 | (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((sourcePixel >> 16 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 16 | (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((sourcePixel >> 8 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 8 | sourcePixel & 255 & 255; + } + } + if(destPremultiplied) { + if((sourcePixel & 255) == 0) { + if(sourcePixel != 0) { + sourcePixel = 0; + } + } else if((sourcePixel & 255) != 255) { + lime_math_color__$RGBA_RGBA_$Impl_$.a16 = lime_math_color__$RGBA_RGBA_$Impl_$.__alpha16[sourcePixel & 255]; + sourcePixel = ((sourcePixel >> 24 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.a16 >> 16 & 255) << 24 | ((sourcePixel >> 16 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.a16 >> 16 & 255) << 16 | ((sourcePixel >> 8 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.a16 >> 16 & 255) << 8 | sourcePixel & 255 & 255; + } + } + switch(destFormat) { + case 0: + destData[destPosition] = sourcePixel >> 24 & 255; + destData[destPosition + 1] = sourcePixel >> 16 & 255; + destData[destPosition + 2] = sourcePixel >> 8 & 255; + destData[destPosition + 3] = sourcePixel & 255; + break; + case 1: + destData[destPosition] = sourcePixel & 255; + destData[destPosition + 1] = sourcePixel >> 24 & 255; + destData[destPosition + 2] = sourcePixel >> 16 & 255; + destData[destPosition + 3] = sourcePixel >> 8 & 255; + break; + case 2: + destData[destPosition] = sourcePixel >> 8 & 255; + destData[destPosition + 1] = sourcePixel >> 16 & 255; + destData[destPosition + 2] = sourcePixel >> 24 & 255; + destData[destPosition + 3] = sourcePixel & 255; + break; + } + sourcePosition += 4; + destPosition += 4; + } + } + } else { + var sourceAlpha; + var destAlpha; + var oneMinusSourceAlpha; + var blendAlpha; + var destPixel; + if(alphaImage == null) { + var _g11 = 0; + var _g4 = destView.height; + while(_g11 < _g4) { + var y1 = _g11++; + sourcePosition = sourceView.row(y1); + destPosition = destView.row(y1); + var _g31 = 0; + var _g21 = destView.width; + while(_g31 < _g21) { + var x1 = _g31++; + switch(sourceFormat) { + case 0: + sourcePixel = (sourceData[sourcePosition] & 255) << 24 | (sourceData[sourcePosition + 1] & 255) << 16 | (sourceData[sourcePosition + 2] & 255) << 8 | sourceData[sourcePosition + 3] & 255; + break; + case 1: + sourcePixel = (sourceData[sourcePosition + 1] & 255) << 24 | (sourceData[sourcePosition + 2] & 255) << 16 | (sourceData[sourcePosition + 3] & 255) << 8 | sourceData[sourcePosition] & 255; + break; + case 2: + sourcePixel = (sourceData[sourcePosition + 2] & 255) << 24 | (sourceData[sourcePosition + 1] & 255) << 16 | (sourceData[sourcePosition] & 255) << 8 | sourceData[sourcePosition + 3] & 255; + break; + } + if(sourcePremultiplied) { + if((sourcePixel & 255) != 0 && (sourcePixel & 255) != 255) { + lime_math_color__$RGBA_RGBA_$Impl_$.unmult = 255.0 / (sourcePixel & 255); + sourcePixel = (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((sourcePixel >> 24 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 24 | (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((sourcePixel >> 16 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 16 | (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((sourcePixel >> 8 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 8 | sourcePixel & 255 & 255; + } + } + switch(destFormat) { + case 0: + destPixel = (destData[destPosition] & 255) << 24 | (destData[destPosition + 1] & 255) << 16 | (destData[destPosition + 2] & 255) << 8 | destData[destPosition + 3] & 255; + break; + case 1: + destPixel = (destData[destPosition + 1] & 255) << 24 | (destData[destPosition + 2] & 255) << 16 | (destData[destPosition + 3] & 255) << 8 | destData[destPosition] & 255; + break; + case 2: + destPixel = (destData[destPosition + 2] & 255) << 24 | (destData[destPosition + 1] & 255) << 16 | (destData[destPosition] & 255) << 8 | destData[destPosition + 3] & 255; + break; + } + if(destPremultiplied) { + if((destPixel & 255) != 0 && (destPixel & 255) != 255) { + lime_math_color__$RGBA_RGBA_$Impl_$.unmult = 255.0 / (destPixel & 255); + destPixel = (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((destPixel >> 24 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 24 | (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((destPixel >> 16 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 16 | (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((destPixel >> 8 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 8 | destPixel & 255 & 255; + } + } + sourceAlpha = (sourcePixel & 255) / 255.0; + destAlpha = (destPixel & 255) / 255.0; + oneMinusSourceAlpha = 1 - sourceAlpha; + blendAlpha = sourceAlpha + destAlpha * oneMinusSourceAlpha; + if(blendAlpha == 0) { + destPixel = 0; + } else { + var value = lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round(((sourcePixel >> 24 & 255) * sourceAlpha + (destPixel >> 24 & 255) * destAlpha * oneMinusSourceAlpha) / blendAlpha)]; + destPixel = (value & 255) << 24 | (destPixel >> 16 & 255 & 255) << 16 | (destPixel >> 8 & 255 & 255) << 8 | destPixel & 255 & 255; + var value1 = lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round(((sourcePixel >> 16 & 255) * sourceAlpha + (destPixel >> 16 & 255) * destAlpha * oneMinusSourceAlpha) / blendAlpha)]; + destPixel = (destPixel >> 24 & 255 & 255) << 24 | (value1 & 255) << 16 | (destPixel >> 8 & 255 & 255) << 8 | destPixel & 255 & 255; + var value2 = lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round(((sourcePixel >> 8 & 255) * sourceAlpha + (destPixel >> 8 & 255) * destAlpha * oneMinusSourceAlpha) / blendAlpha)]; + destPixel = (destPixel >> 24 & 255 & 255) << 24 | (destPixel >> 16 & 255 & 255) << 16 | (value2 & 255) << 8 | destPixel & 255 & 255; + var value3 = lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round(blendAlpha * 255.0)]; + destPixel = (destPixel >> 24 & 255 & 255) << 24 | (destPixel >> 16 & 255 & 255) << 16 | (destPixel >> 8 & 255 & 255) << 8 | value3 & 255; + } + if(destPremultiplied) { + if((destPixel & 255) == 0) { + if(destPixel != 0) { + destPixel = 0; + } + } else if((destPixel & 255) != 255) { + lime_math_color__$RGBA_RGBA_$Impl_$.a16 = lime_math_color__$RGBA_RGBA_$Impl_$.__alpha16[destPixel & 255]; + destPixel = ((destPixel >> 24 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.a16 >> 16 & 255) << 24 | ((destPixel >> 16 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.a16 >> 16 & 255) << 16 | ((destPixel >> 8 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.a16 >> 16 & 255) << 8 | destPixel & 255 & 255; + } + } + switch(destFormat) { + case 0: + destData[destPosition] = destPixel >> 24 & 255; + destData[destPosition + 1] = destPixel >> 16 & 255; + destData[destPosition + 2] = destPixel >> 8 & 255; + destData[destPosition + 3] = destPixel & 255; + break; + case 1: + destData[destPosition] = destPixel & 255; + destData[destPosition + 1] = destPixel >> 24 & 255; + destData[destPosition + 2] = destPixel >> 16 & 255; + destData[destPosition + 3] = destPixel >> 8 & 255; + break; + case 2: + destData[destPosition] = destPixel >> 8 & 255; + destData[destPosition + 1] = destPixel >> 16 & 255; + destData[destPosition + 2] = destPixel >> 24 & 255; + destData[destPosition + 3] = destPixel & 255; + break; + } + sourcePosition += 4; + destPosition += 4; + } + } + } else { + if(alphaPoint == null) { + alphaPoint = new lime_math_Vector2(); + } + var alphaData = alphaImage.buffer.data; + var alphaFormat = alphaImage.buffer.format; + var alphaPremultiplied = alphaImage.buffer.premultiplied; + var alphaView = new lime_graphics_utils__$ImageDataUtil_ImageDataView(alphaImage,new lime_math_Rectangle(alphaPoint.x,alphaPoint.y,destView.width,destView.height)); + var alphaPosition; + var alphaPixel; + var _g12 = 0; + var _g5 = alphaView.height; + while(_g12 < _g5) { + var y2 = _g12++; + sourcePosition = sourceView.row(y2); + destPosition = destView.row(y2); + alphaPosition = alphaView.row(y2); + var _g32 = 0; + var _g22 = alphaView.width; + while(_g32 < _g22) { + var x2 = _g32++; + switch(sourceFormat) { + case 0: + sourcePixel = (sourceData[sourcePosition] & 255) << 24 | (sourceData[sourcePosition + 1] & 255) << 16 | (sourceData[sourcePosition + 2] & 255) << 8 | sourceData[sourcePosition + 3] & 255; + break; + case 1: + sourcePixel = (sourceData[sourcePosition + 1] & 255) << 24 | (sourceData[sourcePosition + 2] & 255) << 16 | (sourceData[sourcePosition + 3] & 255) << 8 | sourceData[sourcePosition] & 255; + break; + case 2: + sourcePixel = (sourceData[sourcePosition + 2] & 255) << 24 | (sourceData[sourcePosition + 1] & 255) << 16 | (sourceData[sourcePosition] & 255) << 8 | sourceData[sourcePosition + 3] & 255; + break; + } + if(sourcePremultiplied) { + if((sourcePixel & 255) != 0 && (sourcePixel & 255) != 255) { + lime_math_color__$RGBA_RGBA_$Impl_$.unmult = 255.0 / (sourcePixel & 255); + sourcePixel = (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((sourcePixel >> 24 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 24 | (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((sourcePixel >> 16 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 16 | (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((sourcePixel >> 8 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 8 | sourcePixel & 255 & 255; + } + } + switch(destFormat) { + case 0: + destPixel = (destData[destPosition] & 255) << 24 | (destData[destPosition + 1] & 255) << 16 | (destData[destPosition + 2] & 255) << 8 | destData[destPosition + 3] & 255; + break; + case 1: + destPixel = (destData[destPosition + 1] & 255) << 24 | (destData[destPosition + 2] & 255) << 16 | (destData[destPosition + 3] & 255) << 8 | destData[destPosition] & 255; + break; + case 2: + destPixel = (destData[destPosition + 2] & 255) << 24 | (destData[destPosition + 1] & 255) << 16 | (destData[destPosition] & 255) << 8 | destData[destPosition + 3] & 255; + break; + } + if(destPremultiplied) { + if((destPixel & 255) != 0 && (destPixel & 255) != 255) { + lime_math_color__$RGBA_RGBA_$Impl_$.unmult = 255.0 / (destPixel & 255); + destPixel = (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((destPixel >> 24 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 24 | (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((destPixel >> 16 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 16 | (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((destPixel >> 8 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 8 | destPixel & 255 & 255; + } + } + switch(alphaFormat) { + case 0: + alphaPixel = (alphaData[alphaPosition] & 255) << 24 | (alphaData[alphaPosition + 1] & 255) << 16 | (alphaData[alphaPosition + 2] & 255) << 8 | alphaData[alphaPosition + 3] & 255; + break; + case 1: + alphaPixel = (alphaData[alphaPosition + 1] & 255) << 24 | (alphaData[alphaPosition + 2] & 255) << 16 | (alphaData[alphaPosition + 3] & 255) << 8 | alphaData[alphaPosition] & 255; + break; + case 2: + alphaPixel = (alphaData[alphaPosition + 2] & 255) << 24 | (alphaData[alphaPosition + 1] & 255) << 16 | (alphaData[alphaPosition] & 255) << 8 | alphaData[alphaPosition + 3] & 255; + break; + } + if(alphaPremultiplied) { + if((alphaPixel & 255) != 0 && (alphaPixel & 255) != 255) { + lime_math_color__$RGBA_RGBA_$Impl_$.unmult = 255.0 / (alphaPixel & 255); + alphaPixel = (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((alphaPixel >> 24 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 24 | (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((alphaPixel >> 16 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 16 | (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((alphaPixel >> 8 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 8 | alphaPixel & 255 & 255; + } + } + sourceAlpha = (alphaPixel & 255) / 255; + destAlpha = (destPixel & 255) / 255; + oneMinusSourceAlpha = 1 - sourceAlpha; + blendAlpha = sourceAlpha + destAlpha * oneMinusSourceAlpha; + if(blendAlpha == 0) { + destPixel = 0; + } else { + var value4 = lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round(((sourcePixel >> 24 & 255) * sourceAlpha + (destPixel >> 24 & 255) * destAlpha * oneMinusSourceAlpha) / blendAlpha)]; + destPixel = (value4 & 255) << 24 | (destPixel >> 16 & 255 & 255) << 16 | (destPixel >> 8 & 255 & 255) << 8 | destPixel & 255 & 255; + var value5 = lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round(((sourcePixel >> 16 & 255) * sourceAlpha + (destPixel >> 16 & 255) * destAlpha * oneMinusSourceAlpha) / blendAlpha)]; + destPixel = (destPixel >> 24 & 255 & 255) << 24 | (value5 & 255) << 16 | (destPixel >> 8 & 255 & 255) << 8 | destPixel & 255 & 255; + var value6 = lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round(((sourcePixel >> 8 & 255) * sourceAlpha + (destPixel >> 8 & 255) * destAlpha * oneMinusSourceAlpha) / blendAlpha)]; + destPixel = (destPixel >> 24 & 255 & 255) << 24 | (destPixel >> 16 & 255 & 255) << 16 | (value6 & 255) << 8 | destPixel & 255 & 255; + var value7 = lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round(blendAlpha * 255.0)]; + destPixel = (destPixel >> 24 & 255 & 255) << 24 | (destPixel >> 16 & 255 & 255) << 16 | (destPixel >> 8 & 255 & 255) << 8 | value7 & 255; + } + if(destPremultiplied) { + if((destPixel & 255) == 0) { + if(destPixel != 0) { + destPixel = 0; + } + } else if((destPixel & 255) != 255) { + lime_math_color__$RGBA_RGBA_$Impl_$.a16 = lime_math_color__$RGBA_RGBA_$Impl_$.__alpha16[destPixel & 255]; + destPixel = ((destPixel >> 24 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.a16 >> 16 & 255) << 24 | ((destPixel >> 16 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.a16 >> 16 & 255) << 16 | ((destPixel >> 8 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.a16 >> 16 & 255) << 8 | destPixel & 255 & 255; + } + } + switch(destFormat) { + case 0: + destData[destPosition] = destPixel >> 24 & 255; + destData[destPosition + 1] = destPixel >> 16 & 255; + destData[destPosition + 2] = destPixel >> 8 & 255; + destData[destPosition + 3] = destPixel & 255; + break; + case 1: + destData[destPosition] = destPixel & 255; + destData[destPosition + 1] = destPixel >> 24 & 255; + destData[destPosition + 2] = destPixel >> 16 & 255; + destData[destPosition + 3] = destPixel >> 8 & 255; + break; + case 2: + destData[destPosition] = destPixel >> 8 & 255; + destData[destPosition + 1] = destPixel >> 16 & 255; + destData[destPosition + 2] = destPixel >> 24 & 255; + destData[destPosition + 3] = destPixel & 255; + break; + } + sourcePosition += 4; + destPosition += 4; + } + } + } + } + image.dirty = true; +}; +lime_graphics_utils_ImageDataUtil.fillRect = function(image,rect,color,format) { + var fillColor; + switch(format) { + case 1: + var argb = color; + var this1 = 0; + var rgba = this1; + rgba = (argb >> 16 & 255 & 255) << 24 | (argb >> 8 & 255 & 255) << 16 | (argb & 255 & 255) << 8 | argb >> 24 & 255 & 255; + fillColor = rgba; + break; + case 2: + var bgra = color; + var this2 = 0; + var rgba1 = this2; + rgba1 = (bgra >> 8 & 255 & 255) << 24 | (bgra >> 16 & 255 & 255) << 16 | (bgra >> 24 & 255 & 255) << 8 | bgra & 255 & 255; + fillColor = rgba1; + break; + default: + fillColor = color; + } + if(!image.get_transparent()) { + fillColor = (fillColor >> 24 & 255 & 255) << 24 | (fillColor >> 16 & 255 & 255) << 16 | (fillColor >> 8 & 255 & 255) << 8 | 255; + } + var data = image.buffer.data; + if(data == null) { + return; + } + var format1 = image.buffer.format; + var premultiplied = image.buffer.premultiplied; + var dataView = new lime_graphics_utils__$ImageDataUtil_ImageDataView(image,rect); + var row; + var _g1 = 0; + var _g = dataView.height; + while(_g1 < _g) { + var y = _g1++; + row = dataView.row(y); + var _g3 = 0; + var _g2 = dataView.width; + while(_g3 < _g2) { + var x = _g3++; + var offset = row + x * 4; + if(premultiplied) { + if((fillColor & 255) == 0) { + if(fillColor != 0) { + fillColor = 0; + } + } else if((fillColor & 255) != 255) { + lime_math_color__$RGBA_RGBA_$Impl_$.a16 = lime_math_color__$RGBA_RGBA_$Impl_$.__alpha16[fillColor & 255]; + fillColor = ((fillColor >> 24 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.a16 >> 16 & 255) << 24 | ((fillColor >> 16 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.a16 >> 16 & 255) << 16 | ((fillColor >> 8 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.a16 >> 16 & 255) << 8 | fillColor & 255 & 255; + } + } + switch(format1) { + case 0: + data[offset] = fillColor >> 24 & 255; + data[offset + 1] = fillColor >> 16 & 255; + data[offset + 2] = fillColor >> 8 & 255; + data[offset + 3] = fillColor & 255; + break; + case 1: + data[offset] = fillColor & 255; + data[offset + 1] = fillColor >> 24 & 255; + data[offset + 2] = fillColor >> 16 & 255; + data[offset + 3] = fillColor >> 8 & 255; + break; + case 2: + data[offset] = fillColor >> 8 & 255; + data[offset + 1] = fillColor >> 16 & 255; + data[offset + 2] = fillColor >> 24 & 255; + data[offset + 3] = fillColor & 255; + break; + } + } + } + image.dirty = true; +}; +lime_graphics_utils_ImageDataUtil.getPixel = function(image,x,y,format) { + var pixel; + var data = image.buffer.data; + var offset = 4 * (y + image.offsetY) * image.buffer.width + (x + image.offsetX) * 4; + var premultiplied = image.buffer.premultiplied; + switch(image.buffer.format) { + case 0: + pixel = (data[offset] & 255) << 24 | (data[offset + 1] & 255) << 16 | (data[offset + 2] & 255) << 8 | data[offset + 3] & 255; + break; + case 1: + pixel = (data[offset + 1] & 255) << 24 | (data[offset + 2] & 255) << 16 | (data[offset + 3] & 255) << 8 | data[offset] & 255; + break; + case 2: + pixel = (data[offset + 2] & 255) << 24 | (data[offset + 1] & 255) << 16 | (data[offset] & 255) << 8 | data[offset + 3] & 255; + break; + } + if(premultiplied) { + if((pixel & 255) != 0 && (pixel & 255) != 255) { + lime_math_color__$RGBA_RGBA_$Impl_$.unmult = 255.0 / (pixel & 255); + pixel = (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((pixel >> 24 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 24 | (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((pixel >> 16 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 16 | (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((pixel >> 8 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 8 | pixel & 255 & 255; + } + } + pixel = (pixel >> 24 & 255 & 255) << 24 | (pixel >> 16 & 255 & 255) << 16 | (pixel >> 8 & 255 & 255) << 8 | 0; + switch(format) { + case 1: + var this1 = 0; + var argb = this1; + argb = (pixel & 255 & 255) << 24 | (pixel >> 24 & 255 & 255) << 16 | (pixel >> 16 & 255 & 255) << 8 | pixel >> 8 & 255 & 255; + return argb; + case 2: + var this2 = 0; + var bgra = this2; + bgra = (pixel >> 8 & 255 & 255) << 24 | (pixel >> 16 & 255 & 255) << 16 | (pixel >> 24 & 255 & 255) << 8 | pixel & 255 & 255; + return bgra; + default: + return pixel; + } +}; +lime_graphics_utils_ImageDataUtil.multiplyAlpha = function(image) { + var data = image.buffer.data; + if(data == null || !image.buffer.transparent) { + return; + } + var format = image.buffer.format; + var length = Std["int"](data.length / 4); + var pixel; + var _g1 = 0; + var _g = length; + while(_g1 < _g) { + var i = _g1++; + var offset = i * 4; + switch(format) { + case 0: + pixel = (data[offset] & 255) << 24 | (data[offset + 1] & 255) << 16 | (data[offset + 2] & 255) << 8 | data[offset + 3] & 255; + break; + case 1: + pixel = (data[offset + 1] & 255) << 24 | (data[offset + 2] & 255) << 16 | (data[offset + 3] & 255) << 8 | data[offset] & 255; + break; + case 2: + pixel = (data[offset + 2] & 255) << 24 | (data[offset + 1] & 255) << 16 | (data[offset] & 255) << 8 | data[offset + 3] & 255; + break; + } + var offset1 = i * 4; + if((pixel & 255) == 0) { + if(pixel != 0) { + pixel = 0; + } + } else if((pixel & 255) != 255) { + lime_math_color__$RGBA_RGBA_$Impl_$.a16 = lime_math_color__$RGBA_RGBA_$Impl_$.__alpha16[pixel & 255]; + pixel = ((pixel >> 24 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.a16 >> 16 & 255) << 24 | ((pixel >> 16 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.a16 >> 16 & 255) << 16 | ((pixel >> 8 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.a16 >> 16 & 255) << 8 | pixel & 255 & 255; + } + switch(format) { + case 0: + data[offset1] = pixel >> 24 & 255; + data[offset1 + 1] = pixel >> 16 & 255; + data[offset1 + 2] = pixel >> 8 & 255; + data[offset1 + 3] = pixel & 255; + break; + case 1: + data[offset1] = pixel & 255; + data[offset1 + 1] = pixel >> 24 & 255; + data[offset1 + 2] = pixel >> 16 & 255; + data[offset1 + 3] = pixel >> 8 & 255; + break; + case 2: + data[offset1] = pixel >> 8 & 255; + data[offset1 + 1] = pixel >> 16 & 255; + data[offset1 + 2] = pixel >> 24 & 255; + data[offset1 + 3] = pixel & 255; + break; + } + } + image.buffer.premultiplied = true; + image.dirty = true; +}; +lime_graphics_utils_ImageDataUtil.resize = function(image,newWidth,newHeight) { + var buffer = image.buffer; + if(buffer.width == newWidth && buffer.height == newHeight) { + return; + } + var elements = newWidth * newHeight * 4; + var this1; + if(elements != null) { + this1 = new Uint8Array(elements); + } else { + this1 = null; + } + var newBuffer = new lime_graphics_ImageBuffer(this1,newWidth,newHeight); + var imageWidth = image.width; + var imageHeight = image.height; + var data = image.get_data(); + var newData = newBuffer.data; + var sourceIndex; + var sourceIndexX; + var sourceIndexY; + var sourceIndexXY; + var index; + var sourceX; + var sourceY; + var u; + var v; + var uRatio; + var vRatio; + var uOpposite; + var vOpposite; + var _g1 = 0; + var _g = newHeight; + while(_g1 < _g) { + var y = _g1++; + var _g3 = 0; + var _g2 = newWidth; + while(_g3 < _g2) { + var x = _g3++; + u = (x + 0.5) / newWidth * imageWidth - 0.5; + v = (y + 0.5) / newHeight * imageHeight - 0.5; + sourceX = Std["int"](u); + sourceY = Std["int"](v); + sourceIndex = (sourceY * imageWidth + sourceX) * 4; + if(sourceX < imageWidth - 1) { + sourceIndexX = sourceIndex + 4; + } else { + sourceIndexX = sourceIndex; + } + if(sourceY < imageHeight - 1) { + sourceIndexY = sourceIndex + imageWidth * 4; + } else { + sourceIndexY = sourceIndex; + } + if(sourceIndexX != sourceIndex) { + sourceIndexXY = sourceIndexY + 4; + } else { + sourceIndexXY = sourceIndexY; + } + index = (y * newWidth + x) * 4; + uRatio = u - sourceX; + vRatio = v - sourceY; + uOpposite = 1 - uRatio; + vOpposite = 1 - vRatio; + newData[index] = Std["int"]((_$UInt_UInt_$Impl_$.toFloat(data[sourceIndex]) * uOpposite + _$UInt_UInt_$Impl_$.toFloat(data[sourceIndexX]) * uRatio) * vOpposite + (_$UInt_UInt_$Impl_$.toFloat(data[sourceIndexY]) * uOpposite + _$UInt_UInt_$Impl_$.toFloat(data[sourceIndexXY]) * uRatio) * vRatio); + newData[index + 1] = Std["int"]((_$UInt_UInt_$Impl_$.toFloat(data[sourceIndex + 1]) * uOpposite + _$UInt_UInt_$Impl_$.toFloat(data[sourceIndexX + 1]) * uRatio) * vOpposite + (_$UInt_UInt_$Impl_$.toFloat(data[sourceIndexY + 1]) * uOpposite + _$UInt_UInt_$Impl_$.toFloat(data[sourceIndexXY + 1]) * uRatio) * vRatio); + newData[index + 2] = Std["int"]((_$UInt_UInt_$Impl_$.toFloat(data[sourceIndex + 2]) * uOpposite + _$UInt_UInt_$Impl_$.toFloat(data[sourceIndexX + 2]) * uRatio) * vOpposite + (_$UInt_UInt_$Impl_$.toFloat(data[sourceIndexY + 2]) * uOpposite + _$UInt_UInt_$Impl_$.toFloat(data[sourceIndexXY + 2]) * uRatio) * vRatio); + if(data[sourceIndexX + 3] == 0 || data[sourceIndexY + 3] == 0 || data[sourceIndexXY + 3] == 0) { + newData[index + 3] = 0; + } else { + newData[index + 3] = data[sourceIndex + 3]; + } + } + } + buffer.data = newBuffer.data; + buffer.width = newWidth; + buffer.height = newHeight; +}; +lime_graphics_utils_ImageDataUtil.setFormat = function(image,format) { + var data = image.buffer.data; + if(data == null) { + return; + } + var index; + var a16; + var length = Std["int"](data.length / 4); + var r1; + var g1; + var b1; + var a1; + var r2; + var g2; + var b2; + var a2; + var r; + var g; + var b; + var a; + var _g = image.get_format(); + switch(_g) { + case 0: + r1 = 0; + g1 = 1; + b1 = 2; + a1 = 3; + break; + case 1: + r1 = 1; + g1 = 2; + b1 = 3; + a1 = 0; + break; + case 2: + r1 = 2; + g1 = 1; + b1 = 0; + a1 = 3; + break; + } + switch(format) { + case 0: + r2 = 0; + g2 = 1; + b2 = 2; + a2 = 3; + break; + case 1: + r2 = 1; + g2 = 2; + b2 = 3; + a2 = 0; + break; + case 2: + r2 = 2; + g2 = 1; + b2 = 0; + a2 = 3; + break; + } + var _g2 = 0; + var _g1 = length; + while(_g2 < _g1) { + var i = _g2++; + index = i * 4; + r = data[index + r1]; + g = data[index + g1]; + b = data[index + b1]; + a = data[index + a1]; + data[index + r2] = r; + data[index + g2] = g; + data[index + b2] = b; + data[index + a2] = a; + } + image.buffer.format = format; + image.dirty = true; +}; +lime_graphics_utils_ImageDataUtil.setPixel = function(image,x,y,color,format) { + var pixel; + switch(format) { + case 1: + var argb = color; + var this1 = 0; + var rgba = this1; + rgba = (argb >> 16 & 255 & 255) << 24 | (argb >> 8 & 255 & 255) << 16 | (argb & 255 & 255) << 8 | argb >> 24 & 255 & 255; + pixel = rgba; + break; + case 2: + var bgra = color; + var this2 = 0; + var rgba1 = this2; + rgba1 = (bgra >> 8 & 255 & 255) << 24 | (bgra >> 16 & 255 & 255) << 16 | (bgra >> 24 & 255 & 255) << 8 | bgra & 255 & 255; + pixel = rgba1; + break; + default: + pixel = color; + } + var this3 = 0; + var source = this3; + var data = image.buffer.data; + var offset = 4 * (y + image.offsetY) * image.buffer.width + (x + image.offsetX) * 4; + var premultiplied = image.buffer.premultiplied; + switch(image.buffer.format) { + case 0: + source = (data[offset] & 255) << 24 | (data[offset + 1] & 255) << 16 | (data[offset + 2] & 255) << 8 | data[offset + 3] & 255; + break; + case 1: + source = (data[offset + 1] & 255) << 24 | (data[offset + 2] & 255) << 16 | (data[offset + 3] & 255) << 8 | data[offset] & 255; + break; + case 2: + source = (data[offset + 2] & 255) << 24 | (data[offset + 1] & 255) << 16 | (data[offset] & 255) << 8 | data[offset + 3] & 255; + break; + } + if(premultiplied) { + if((source & 255) != 0 && (source & 255) != 255) { + lime_math_color__$RGBA_RGBA_$Impl_$.unmult = 255.0 / (source & 255); + source = (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((source >> 24 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 24 | (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((source >> 16 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 16 | (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((source >> 8 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 8 | source & 255 & 255; + } + } + var value = source & 255; + pixel = (pixel >> 24 & 255 & 255) << 24 | (pixel >> 16 & 255 & 255) << 16 | (pixel >> 8 & 255 & 255) << 8 | value & 255; + var data1 = image.buffer.data; + var offset1 = 4 * (y + image.offsetY) * image.buffer.width + (x + image.offsetX) * 4; + if(image.buffer.premultiplied) { + if((pixel & 255) == 0) { + if(pixel != 0) { + pixel = 0; + } + } else if((pixel & 255) != 255) { + lime_math_color__$RGBA_RGBA_$Impl_$.a16 = lime_math_color__$RGBA_RGBA_$Impl_$.__alpha16[pixel & 255]; + pixel = ((pixel >> 24 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.a16 >> 16 & 255) << 24 | ((pixel >> 16 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.a16 >> 16 & 255) << 16 | ((pixel >> 8 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.a16 >> 16 & 255) << 8 | pixel & 255 & 255; + } + } + switch(image.buffer.format) { + case 0: + data1[offset1] = pixel >> 24 & 255; + data1[offset1 + 1] = pixel >> 16 & 255; + data1[offset1 + 2] = pixel >> 8 & 255; + data1[offset1 + 3] = pixel & 255; + break; + case 1: + data1[offset1] = pixel & 255; + data1[offset1 + 1] = pixel >> 24 & 255; + data1[offset1 + 2] = pixel >> 16 & 255; + data1[offset1 + 3] = pixel >> 8 & 255; + break; + case 2: + data1[offset1] = pixel >> 8 & 255; + data1[offset1 + 1] = pixel >> 16 & 255; + data1[offset1 + 2] = pixel >> 24 & 255; + data1[offset1 + 3] = pixel & 255; + break; + } + image.dirty = true; +}; +lime_graphics_utils_ImageDataUtil.unmultiplyAlpha = function(image) { + var data = image.buffer.data; + if(data == null) { + return; + } + var format = image.buffer.format; + var length = Std["int"](data.length / 4); + var pixel; + var _g1 = 0; + var _g = length; + while(_g1 < _g) { + var i = _g1++; + var offset = i * 4; + switch(format) { + case 0: + pixel = (data[offset] & 255) << 24 | (data[offset + 1] & 255) << 16 | (data[offset + 2] & 255) << 8 | data[offset + 3] & 255; + break; + case 1: + pixel = (data[offset + 1] & 255) << 24 | (data[offset + 2] & 255) << 16 | (data[offset + 3] & 255) << 8 | data[offset] & 255; + break; + case 2: + pixel = (data[offset + 2] & 255) << 24 | (data[offset + 1] & 255) << 16 | (data[offset] & 255) << 8 | data[offset + 3] & 255; + break; + } + if((pixel & 255) != 0 && (pixel & 255) != 255) { + lime_math_color__$RGBA_RGBA_$Impl_$.unmult = 255.0 / (pixel & 255); + pixel = (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((pixel >> 24 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 24 | (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((pixel >> 16 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 16 | (lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[Math.round((pixel >> 8 & 255) * lime_math_color__$RGBA_RGBA_$Impl_$.unmult)] & 255) << 8 | pixel & 255 & 255; + } + var offset1 = i * 4; + switch(format) { + case 0: + data[offset1] = pixel >> 24 & 255; + data[offset1 + 1] = pixel >> 16 & 255; + data[offset1 + 2] = pixel >> 8 & 255; + data[offset1 + 3] = pixel & 255; + break; + case 1: + data[offset1] = pixel & 255; + data[offset1 + 1] = pixel >> 24 & 255; + data[offset1 + 2] = pixel >> 16 & 255; + data[offset1 + 3] = pixel >> 8 & 255; + break; + case 2: + data[offset1] = pixel >> 8 & 255; + data[offset1 + 1] = pixel >> 16 & 255; + data[offset1 + 2] = pixel >> 24 & 255; + data[offset1 + 3] = pixel & 255; + break; + } + } + image.buffer.premultiplied = false; + image.dirty = true; +}; +var lime_graphics_utils__$ImageDataUtil_ImageDataView = function(image,rect) { + this.image = image; + if(rect == null) { + this.rect = image.get_rect(); + } else { + if(rect.x < 0) { + rect.x = 0; + } + if(rect.y < 0) { + rect.y = 0; + } + if(rect.x + rect.width > image.width) { + rect.width = image.width - rect.x; + } + if(rect.y + rect.height > image.height) { + rect.height = image.height - rect.y; + } + if(rect.width < 0) { + rect.width = 0; + } + if(rect.height < 0) { + rect.height = 0; + } + this.rect = rect; + } + this.stride = image.buffer.get_stride(); + this.x = Math.ceil(this.rect.x); + this.y = Math.ceil(this.rect.y); + this.width = Math.floor(this.rect.width); + this.height = Math.floor(this.rect.height); + this.offset = this.stride * (this.y + image.offsetY) + (this.x + image.offsetX) * 4; +}; +$hxClasses["lime.graphics.utils._ImageDataUtil.ImageDataView"] = lime_graphics_utils__$ImageDataUtil_ImageDataView; +lime_graphics_utils__$ImageDataUtil_ImageDataView.__name__ = ["lime","graphics","utils","_ImageDataUtil","ImageDataView"]; +lime_graphics_utils__$ImageDataUtil_ImageDataView.prototype = { + x: null + ,y: null + ,height: null + ,width: null + ,image: null + ,offset: null + ,rect: null + ,stride: null + ,row: function(y) { + return this.offset + this.stride * y; + } + ,__class__: lime_graphics_utils__$ImageDataUtil_ImageDataView +}; +var lime_math__$ColorMatrix_ColorMatrix_$Impl_$ = {}; +$hxClasses["lime.math._ColorMatrix.ColorMatrix_Impl_"] = lime_math__$ColorMatrix_ColorMatrix_$Impl_$; +lime_math__$ColorMatrix_ColorMatrix_$Impl_$.__name__ = ["lime","math","_ColorMatrix","ColorMatrix_Impl_"]; +lime_math__$ColorMatrix_ColorMatrix_$Impl_$.getAlphaTable = function(this1) { + var this2 = new Uint8Array(256); + var table = this2; + var multiplier = this1[18]; + var offset = this1[19] * 255; + var value; + var _g = 0; + while(_g < 256) { + var i = _g++; + value = Math.floor(i * multiplier + offset); + if(value > 255) { + value = 255; + } + if(value < 0) { + value = 0; + } + table[i] = value; + } + return table; +}; +lime_math__$ColorMatrix_ColorMatrix_$Impl_$.getBlueTable = function(this1) { + var this2 = new Uint8Array(256); + var table = this2; + var multiplier = this1[12]; + var offset = this1[14] * 255; + var value; + var _g = 0; + while(_g < 256) { + var i = _g++; + value = Math.floor(i * multiplier + offset); + if(value > 255) { + value = 255; + } + if(value < 0) { + value = 0; + } + table[i] = value; + } + return table; +}; +lime_math__$ColorMatrix_ColorMatrix_$Impl_$.getGreenTable = function(this1) { + var this2 = new Uint8Array(256); + var table = this2; + var multiplier = this1[6]; + var offset = this1[9] * 255; + var value; + var _g = 0; + while(_g < 256) { + var i = _g++; + value = Math.floor(i * multiplier + offset); + if(value > 255) { + value = 255; + } + if(value < 0) { + value = 0; + } + table[i] = value; + } + return table; +}; +lime_math__$ColorMatrix_ColorMatrix_$Impl_$.getRedTable = function(this1) { + var this2 = new Uint8Array(256); + var table = this2; + var multiplier = this1[0]; + var offset = this1[4] * 255; + var value; + var _g = 0; + while(_g < 256) { + var i = _g++; + value = Math.floor(i * multiplier + offset); + if(value > 255) { + value = 255; + } + if(value < 0) { + value = 0; + } + table[i] = value; + } + return table; +}; +lime_math__$ColorMatrix_ColorMatrix_$Impl_$.__toFlashColorTransform = function(this1) { + return null; +}; +var lime_math_Matrix3 = function(a,b,c,d,tx,ty) { + if(ty == null) { + ty = 0; + } + if(tx == null) { + tx = 0; + } + if(d == null) { + d = 1; + } + if(c == null) { + c = 0; + } + if(b == null) { + b = 0; + } + if(a == null) { + a = 1; + } + this.a = a; + this.b = b; + this.c = c; + this.d = d; + this.tx = tx; + this.ty = ty; +}; +$hxClasses["lime.math.Matrix3"] = lime_math_Matrix3; +lime_math_Matrix3.__name__ = ["lime","math","Matrix3"]; +lime_math_Matrix3.prototype = { + a: null + ,b: null + ,c: null + ,d: null + ,tx: null + ,ty: null + ,__class__: lime_math_Matrix3 +}; +var lime_math__$Matrix4_Matrix4_$Impl_$ = {}; +$hxClasses["lime.math._Matrix4.Matrix4_Impl_"] = lime_math__$Matrix4_Matrix4_$Impl_$; +lime_math__$Matrix4_Matrix4_$Impl_$.__name__ = ["lime","math","_Matrix4","Matrix4_Impl_"]; +lime_math__$Matrix4_Matrix4_$Impl_$._new = function(data) { + var this1; + if(data != null && data.length == 16) { + this1 = data; + } else { + var array = lime_math__$Matrix4_Matrix4_$Impl_$.__identity; + var this2; + if(array != null) { + this2 = new Float32Array(array); + } else { + this2 = null; + } + this1 = this2; + } + return this1; +}; +lime_math__$Matrix4_Matrix4_$Impl_$.clone = function(this1) { + var this2; + if(this1 != null) { + this2 = new Float32Array(this1); + } else { + this2 = null; + } + return lime_math__$Matrix4_Matrix4_$Impl_$._new(this2); +}; +lime_math__$Matrix4_Matrix4_$Impl_$.copyFrom = function(this1,other) { + this1.set(other); +}; +lime_math__$Matrix4_Matrix4_$Impl_$.transpose = function(this1) { + var this2; + if(this1 != null) { + this2 = new Float32Array(this1); + } else { + this2 = null; + } + var othis = this2; + this1[1] = othis[4]; + this1[2] = othis[8]; + this1[3] = othis[12]; + this1[4] = othis[1]; + this1[6] = othis[9]; + this1[7] = othis[13]; + this1[8] = othis[2]; + this1[9] = othis[6]; + this1[11] = othis[14]; + this1[12] = othis[3]; + this1[13] = othis[7]; + this1[14] = othis[11]; +}; +lime_math__$Matrix4_Matrix4_$Impl_$.set = function(this1,index,value) { + this1[index] = value; + return value; +}; +var lime_math_Rectangle = function(x,y,width,height) { + if(height == null) { + height = 0; + } + if(width == null) { + width = 0; + } + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + this.x = x; + this.y = y; + this.width = width; + this.height = height; +}; +$hxClasses["lime.math.Rectangle"] = lime_math_Rectangle; +lime_math_Rectangle.__name__ = ["lime","math","Rectangle"]; +lime_math_Rectangle.prototype = { + height: null + ,width: null + ,x: null + ,y: null + ,offset: function(dx,dy) { + this.x += dx; + this.y += dy; + } + ,__toFlashRectangle: function() { + return null; + } + ,__class__: lime_math_Rectangle +}; +var lime_math_Vector2 = function(x,y) { + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + this.x = x; + this.y = y; +}; +$hxClasses["lime.math.Vector2"] = lime_math_Vector2; +lime_math_Vector2.__name__ = ["lime","math","Vector2"]; +lime_math_Vector2.prototype = { + x: null + ,y: null + ,offset: function(dx,dy) { + this.x += dx; + this.y += dy; + } + ,__toFlashPoint: function() { + return null; + } + ,__class__: lime_math_Vector2 +}; +var lime_math_Vector4 = function() { }; +$hxClasses["lime.math.Vector4"] = lime_math_Vector4; +lime_math_Vector4.__name__ = ["lime","math","Vector4"]; +var lime_math_color__$RGBA_RGBA_$Impl_$ = {}; +$hxClasses["lime.math.color._RGBA.RGBA_Impl_"] = lime_math_color__$RGBA_RGBA_$Impl_$; +lime_math_color__$RGBA_RGBA_$Impl_$.__name__ = ["lime","math","color","_RGBA","RGBA_Impl_"]; +lime_math_color__$RGBA_RGBA_$Impl_$.__alpha16 = null; +lime_math_color__$RGBA_RGBA_$Impl_$.__clamp = null; +lime_math_color__$RGBA_RGBA_$Impl_$.a16 = null; +lime_math_color__$RGBA_RGBA_$Impl_$.unmult = null; +var lime_net_HTTPRequest = function() { + this.promise = new lime_app_Promise(); +}; +$hxClasses["lime.net.HTTPRequest"] = lime_net_HTTPRequest; +lime_net_HTTPRequest.__name__ = ["lime","net","HTTPRequest"]; +lime_net_HTTPRequest.prototype = { + bytes: null + ,bytesLoaded: null + ,bytesTotal: null + ,promise: null + ,load: function(url) { + var _gthis = this; + this.bytesLoaded = 0; + this.bytesTotal = 0; + var request = new XMLHttpRequest(); + request.addEventListener("progress",$bind(this,this.request_onProgress),false); + request.onreadystatechange = function() { + if(request.readyState != 4) { + return; + } + if(request.status != null && request.status >= 200 && request.status <= 400) { + _gthis.bytes = lime_utils_Bytes.ofData(request.response); + _gthis.promise.complete(_gthis.bytes); + } else { + _gthis.promise.error(request.status); + } + }; + request.open("GET",url,true); + request.responseType = "arraybuffer"; + request.send(""); + return this.promise.future; + } + ,request_onProgress: function(event) { + this.promise.progress(event.loaded / event.total); + } + ,__class__: lime_net_HTTPRequest +}; +var lime_system_System = function() { }; +$hxClasses["lime.system.System"] = lime_system_System; +lime_system_System.__name__ = ["lime","system","System"]; +lime_system_System.embed = $hx_exports["lime"]["embed"] = function(element,width,height,background,assetsPrefix) { + var htmlElement = null; + if(typeof(element) == "string") { + htmlElement = js_Browser.get_document().getElementById(js_Boot.__cast(element , String)); + } else if(element == null) { + htmlElement = js_Browser.get_document().createElement("div"); + } else { + htmlElement = element; + } + var color = null; + if(background != null) { + background = StringTools.replace(background,"#",""); + if(background.indexOf("0x") > -1) { + color = Std.parseInt(background); + } else { + color = Std.parseInt("0x" + background); + } + } + if(width == null) { + width = 0; + } + if(height == null) { + height = 0; + } + ApplicationMain.config.windows[0].background = color; + ApplicationMain.config.windows[0].element = htmlElement; + ApplicationMain.config.windows[0].width = width; + ApplicationMain.config.windows[0].height = height; + ApplicationMain.config.assetsPrefix = assetsPrefix; + ApplicationMain.create(); +}; +lime_system_System.getTimer = function() { + return new Date().getTime(); +}; +var lime_system_ThreadPool = function(minThreads,maxThreads) { + if(maxThreads == null) { + maxThreads = 1; + } + if(minThreads == null) { + minThreads = 0; + } + this.onError = new lime_app_Event_$Dynamic_$Void(); + this.onComplete = new lime_app_Event_$Dynamic_$Void(); + this.doWork = new lime_app_Event_$Dynamic_$Void(); + this.minThreads = minThreads; + this.maxThreads = maxThreads; + this.currentThreads = 0; +}; +$hxClasses["lime.system.ThreadPool"] = lime_system_ThreadPool; +lime_system_ThreadPool.__name__ = ["lime","system","ThreadPool"]; +lime_system_ThreadPool.prototype = { + currentThreads: null + ,doWork: null + ,maxThreads: null + ,minThreads: null + ,onComplete: null + ,onError: null + ,queue: function(state) { + this.doWork.dispatch(state); + } + ,sendComplete: function(state) { + this.onComplete.dispatch(state); + } + ,sendError: function(state) { + this.onError.dispatch(state); + } + ,__class__: lime_system_ThreadPool +}; +var lime_text_Font = function() { }; +$hxClasses["lime.text.Font"] = lime_text_Font; +lime_text_Font.__name__ = ["lime","text","Font"]; +var lime_ui_Gamepad = function(id) { + this.onDisconnect = new lime_app_Event_$Void_$Void(); + this.onButtonUp = new lime_app_Event_$lime_$ui_$GamepadButton_$Void(); + this.onButtonDown = new lime_app_Event_$lime_$ui_$GamepadButton_$Void(); + this.onAxisMove = new lime_app_Event_$lime_$ui_$GamepadAxis_$Float_$Void(); + this.id = id; + this.connected = true; +}; +$hxClasses["lime.ui.Gamepad"] = lime_ui_Gamepad; +lime_ui_Gamepad.__name__ = ["lime","ui","Gamepad"]; +lime_ui_Gamepad.__connect = function(id) { + if(!lime_ui_Gamepad.devices.exists(id)) { + var gamepad = new lime_ui_Gamepad(id); + lime_ui_Gamepad.devices.set(id,gamepad); + lime_ui_Gamepad.onConnect.dispatch(gamepad); + } +}; +lime_ui_Gamepad.__disconnect = function(id) { + var gamepad = lime_ui_Gamepad.devices.get(id); + if(gamepad != null) { + gamepad.connected = false; + } + lime_ui_Gamepad.devices.remove(id); + if(gamepad != null) { + gamepad.onDisconnect.dispatch(); + } +}; +lime_ui_Gamepad.prototype = { + connected: null + ,id: null + ,onAxisMove: null + ,onButtonDown: null + ,onButtonUp: null + ,onDisconnect: null + ,get_guid: function() { + var devices = lime_ui_Joystick.__getDeviceData(); + return devices[this.id].id; + } + ,get_name: function() { + var devices = lime_ui_Joystick.__getDeviceData(); + return devices[this.id].id; + } + ,__class__: lime_ui_Gamepad + ,__properties__: {get_name:"get_name",get_guid:"get_guid"} +}; +var lime_ui_Joystick = function(id) { + this.onTrackballMove = new lime_app_Event_$Int_$Float_$Void(); + this.onHatMove = new lime_app_Event_$Int_$lime_$ui_$JoystickHatPosition_$Void(); + this.onDisconnect = new lime_app_Event_$Void_$Void(); + this.onButtonUp = new lime_app_Event_$Int_$Void(); + this.onButtonDown = new lime_app_Event_$Int_$Void(); + this.onAxisMove = new lime_app_Event_$Int_$Float_$Void(); + this.id = id; + this.connected = true; +}; +$hxClasses["lime.ui.Joystick"] = lime_ui_Joystick; +lime_ui_Joystick.__name__ = ["lime","ui","Joystick"]; +lime_ui_Joystick.__connect = function(id) { + if(!lime_ui_Joystick.devices.exists(id)) { + var joystick = new lime_ui_Joystick(id); + lime_ui_Joystick.devices.set(id,joystick); + lime_ui_Joystick.onConnect.dispatch(joystick); + } +}; +lime_ui_Joystick.__disconnect = function(id) { + var joystick = lime_ui_Joystick.devices.get(id); + if(joystick != null) { + joystick.connected = false; + } + lime_ui_Joystick.devices.remove(id); + if(joystick != null) { + joystick.onDisconnect.dispatch(); + } +}; +lime_ui_Joystick.__getDeviceData = function() { + if(navigator.getGamepads) { + return navigator.getGamepads(); + } else if(navigator.webkitGetGamepads) { + return navigator.webkitGetGamepads(); + } else { + return null; + } +}; +lime_ui_Joystick.prototype = { + connected: null + ,id: null + ,onAxisMove: null + ,onButtonDown: null + ,onButtonUp: null + ,onDisconnect: null + ,onHatMove: null + ,onTrackballMove: null + ,__class__: lime_ui_Joystick +}; +var lime_ui__$KeyModifier_KeyModifier_$Impl_$ = {}; +$hxClasses["lime.ui._KeyModifier.KeyModifier_Impl_"] = lime_ui__$KeyModifier_KeyModifier_$Impl_$; +lime_ui__$KeyModifier_KeyModifier_$Impl_$.__name__ = ["lime","ui","_KeyModifier","KeyModifier_Impl_"]; +lime_ui__$KeyModifier_KeyModifier_$Impl_$.__properties__ = {get_shiftKey:"get_shiftKey",get_metaKey:"get_metaKey",get_ctrlKey:"get_ctrlKey",get_altKey:"get_altKey"}; +lime_ui__$KeyModifier_KeyModifier_$Impl_$.get_altKey = function(this1) { + if((this1 & 256) <= 0) { + return (this1 & 512) > 0; + } else { + return true; + } +}; +lime_ui__$KeyModifier_KeyModifier_$Impl_$.get_ctrlKey = function(this1) { + if((this1 & 64) <= 0) { + return (this1 & 128) > 0; + } else { + return true; + } +}; +lime_ui__$KeyModifier_KeyModifier_$Impl_$.get_metaKey = function(this1) { + if((this1 & 1024) <= 0) { + return (this1 & 2048) > 0; + } else { + return true; + } +}; +lime_ui__$KeyModifier_KeyModifier_$Impl_$.get_shiftKey = function(this1) { + if((this1 & 1) <= 0) { + return (this1 & 2) > 0; + } else { + return true; + } +}; +var lime_ui_Mouse = function() { }; +$hxClasses["lime.ui.Mouse"] = lime_ui_Mouse; +lime_ui_Mouse.__name__ = ["lime","ui","Mouse"]; +lime_ui_Mouse.__properties__ = {set_cursor:"set_cursor"}; +lime_ui_Mouse.set_cursor = function(value) { + return lime__$backend_html5_HTML5Mouse.set_cursor(value); +}; +var lime_ui_MouseCursor = $hxClasses["lime.ui.MouseCursor"] = { __ename__ : ["lime","ui","MouseCursor"], __constructs__ : ["ARROW","CROSSHAIR","DEFAULT","MOVE","POINTER","RESIZE_NESW","RESIZE_NS","RESIZE_NWSE","RESIZE_WE","TEXT","WAIT","WAIT_ARROW","CUSTOM"] }; +lime_ui_MouseCursor.ARROW = ["ARROW",0]; +lime_ui_MouseCursor.ARROW.toString = $estr; +lime_ui_MouseCursor.ARROW.__enum__ = lime_ui_MouseCursor; +lime_ui_MouseCursor.CROSSHAIR = ["CROSSHAIR",1]; +lime_ui_MouseCursor.CROSSHAIR.toString = $estr; +lime_ui_MouseCursor.CROSSHAIR.__enum__ = lime_ui_MouseCursor; +lime_ui_MouseCursor.DEFAULT = ["DEFAULT",2]; +lime_ui_MouseCursor.DEFAULT.toString = $estr; +lime_ui_MouseCursor.DEFAULT.__enum__ = lime_ui_MouseCursor; +lime_ui_MouseCursor.MOVE = ["MOVE",3]; +lime_ui_MouseCursor.MOVE.toString = $estr; +lime_ui_MouseCursor.MOVE.__enum__ = lime_ui_MouseCursor; +lime_ui_MouseCursor.POINTER = ["POINTER",4]; +lime_ui_MouseCursor.POINTER.toString = $estr; +lime_ui_MouseCursor.POINTER.__enum__ = lime_ui_MouseCursor; +lime_ui_MouseCursor.RESIZE_NESW = ["RESIZE_NESW",5]; +lime_ui_MouseCursor.RESIZE_NESW.toString = $estr; +lime_ui_MouseCursor.RESIZE_NESW.__enum__ = lime_ui_MouseCursor; +lime_ui_MouseCursor.RESIZE_NS = ["RESIZE_NS",6]; +lime_ui_MouseCursor.RESIZE_NS.toString = $estr; +lime_ui_MouseCursor.RESIZE_NS.__enum__ = lime_ui_MouseCursor; +lime_ui_MouseCursor.RESIZE_NWSE = ["RESIZE_NWSE",7]; +lime_ui_MouseCursor.RESIZE_NWSE.toString = $estr; +lime_ui_MouseCursor.RESIZE_NWSE.__enum__ = lime_ui_MouseCursor; +lime_ui_MouseCursor.RESIZE_WE = ["RESIZE_WE",8]; +lime_ui_MouseCursor.RESIZE_WE.toString = $estr; +lime_ui_MouseCursor.RESIZE_WE.__enum__ = lime_ui_MouseCursor; +lime_ui_MouseCursor.TEXT = ["TEXT",9]; +lime_ui_MouseCursor.TEXT.toString = $estr; +lime_ui_MouseCursor.TEXT.__enum__ = lime_ui_MouseCursor; +lime_ui_MouseCursor.WAIT = ["WAIT",10]; +lime_ui_MouseCursor.WAIT.toString = $estr; +lime_ui_MouseCursor.WAIT.__enum__ = lime_ui_MouseCursor; +lime_ui_MouseCursor.WAIT_ARROW = ["WAIT_ARROW",11]; +lime_ui_MouseCursor.WAIT_ARROW.toString = $estr; +lime_ui_MouseCursor.WAIT_ARROW.__enum__ = lime_ui_MouseCursor; +lime_ui_MouseCursor.CUSTOM = ["CUSTOM",12]; +lime_ui_MouseCursor.CUSTOM.toString = $estr; +lime_ui_MouseCursor.CUSTOM.__enum__ = lime_ui_MouseCursor; +var lime_ui_Touch = function(x,y,id,dx,dy,pressure,device) { + this.x = x; + this.y = y; + this.id = id; + this.dx = dx; + this.dy = dy; + this.pressure = pressure; + this.device = device; +}; +$hxClasses["lime.ui.Touch"] = lime_ui_Touch; +lime_ui_Touch.__name__ = ["lime","ui","Touch"]; +lime_ui_Touch.prototype = { + device: null + ,dx: null + ,dy: null + ,id: null + ,pressure: null + ,x: null + ,y: null + ,__class__: lime_ui_Touch +}; +var lime_ui_Window = function(config) { + this.onTextInput = new lime_app_Event_$String_$Void(); + this.onTextEdit = new lime_app_Event_$String_$Int_$Int_$Void(); + this.onRestore = new lime_app_Event_$Void_$Void(); + this.onResize = new lime_app_Event_$Int_$Int_$Void(); + this.onMove = new lime_app_Event_$Float_$Float_$Void(); + this.onMouseWheel = new lime_app_Event_$Float_$Float_$Void(); + this.onMouseUp = new lime_app_Event_$Float_$Float_$Int_$Void(); + this.onMouseMoveRelative = new lime_app_Event_$Float_$Float_$Void(); + this.onMouseMove = new lime_app_Event_$Float_$Float_$Void(); + this.onMouseDown = new lime_app_Event_$Float_$Float_$Int_$Void(); + this.onMinimize = new lime_app_Event_$Void_$Void(); + this.onLeave = new lime_app_Event_$Void_$Void(); + this.onKeyUp = new lime_app_Event_$lime_$ui_$KeyCode_$lime_$ui_$KeyModifier_$Void(); + this.onKeyDown = new lime_app_Event_$lime_$ui_$KeyCode_$lime_$ui_$KeyModifier_$Void(); + this.onFullscreen = new lime_app_Event_$Void_$Void(); + this.onFocusOut = new lime_app_Event_$Void_$Void(); + this.onFocusIn = new lime_app_Event_$Void_$Void(); + this.onEnter = new lime_app_Event_$Void_$Void(); + this.onDropFile = new lime_app_Event_$String_$Void(); + this.onDeactivate = new lime_app_Event_$Void_$Void(); + this.onCreate = new lime_app_Event_$Void_$Void(); + this.onClose = new lime_app_Event_$Void_$Void(); + this.onActivate = new lime_app_Event_$Void_$Void(); + this.config = config; + this.__width = 0; + this.__height = 0; + this.__fullscreen = false; + this.__scale = 1; + this.__x = 0; + this.__y = 0; + this.__title = ""; + this.id = -1; + if(config != null) { + if(Reflect.hasField(config,"width")) { + this.__width = config.width; + } + if(Reflect.hasField(config,"height")) { + this.__height = config.height; + } + if(Reflect.hasField(config,"x")) { + this.__x = config.x; + } + if(Reflect.hasField(config,"y")) { + this.__y = config.y; + } + if(Reflect.hasField(config,"fullscreen")) { + this.__fullscreen = config.fullscreen; + } + if(Reflect.hasField(config,"borderless")) { + this.__borderless = config.borderless; + } + if(Reflect.hasField(config,"resizable")) { + this.__resizable = config.resizable; + } + if(Reflect.hasField(config,"title")) { + this.__title = config.title; + } + } + this.backend = new lime__$backend_html5_HTML5Window(this); +}; +$hxClasses["lime.ui.Window"] = lime_ui_Window; +lime_ui_Window.__name__ = ["lime","ui","Window"]; +lime_ui_Window.prototype = { + application: null + ,config: null + ,id: null + ,onActivate: null + ,onClose: null + ,onCreate: null + ,onDeactivate: null + ,onDropFile: null + ,onEnter: null + ,onFocusIn: null + ,onFocusOut: null + ,onFullscreen: null + ,onKeyDown: null + ,onKeyUp: null + ,onLeave: null + ,onMinimize: null + ,onMouseDown: null + ,onMouseMove: null + ,onMouseMoveRelative: null + ,onMouseUp: null + ,onMouseWheel: null + ,onMove: null + ,onResize: null + ,onRestore: null + ,onTextEdit: null + ,onTextInput: null + ,renderer: null + ,stage: null + ,backend: null + ,__borderless: null + ,__fullscreen: null + ,__height: null + ,__resizable: null + ,__scale: null + ,__title: null + ,__width: null + ,__x: null + ,__y: null + ,close: function() { + this.backend.close(); + } + ,create: function(application) { + this.application = application; + this.backend.create(application); + if(this.renderer != null) { + this.renderer.create(); + } + } + ,resize: function(width,height) { + this.backend.resize(width,height); + this.__width = width; + this.__height = height; + } + ,get_fullscreen: function() { + return this.__fullscreen; + } + ,set_fullscreen: function(value) { + return this.__fullscreen = this.backend.setFullscreen(value); + } + ,get_height: function() { + return this.__height; + } + ,set_height: function(value) { + this.resize(this.__width,value); + return this.__height; + } + ,get_scale: function() { + return this.__scale; + } + ,get_width: function() { + return this.__width; + } + ,set_width: function(value) { + this.resize(value,this.__height); + return this.__width; + } + ,__class__: lime_ui_Window + ,__properties__: {get_scale:"get_scale",set_width:"set_width",get_width:"get_width",set_height:"set_height",get_height:"get_height",set_fullscreen:"set_fullscreen",get_fullscreen:"get_fullscreen"} +}; +var lime_utils_Bytes = function(length,bytesData) { + haxe_io_Bytes.call(this,bytesData); +}; +$hxClasses["lime.utils.Bytes"] = lime_utils_Bytes; +lime_utils_Bytes.__name__ = ["lime","utils","Bytes"]; +lime_utils_Bytes.alloc = function(length) { + var bytes = haxe_io_Bytes.alloc(length); + return new lime_utils_Bytes(bytes.length,bytes.getData()); +}; +lime_utils_Bytes.fastGet = function(b,pos) { + return haxe_io_Bytes.fastGet(b,pos); +}; +lime_utils_Bytes.ofData = function(b) { + var bytes = haxe_io_Bytes.ofData(b); + return new lime_utils_Bytes(bytes.length,bytes.getData()); +}; +lime_utils_Bytes.ofString = function(s) { + var bytes = haxe_io_Bytes.ofString(s); + return new lime_utils_Bytes(bytes.length,bytes.getData()); +}; +lime_utils_Bytes.__super__ = haxe_io_Bytes; +lime_utils_Bytes.prototype = $extend(haxe_io_Bytes.prototype,{ + __class__: lime_utils_Bytes +}); +var openfl_IAssetCache = function() { }; +$hxClasses["openfl.IAssetCache"] = openfl_IAssetCache; +openfl_IAssetCache.__name__ = ["openfl","IAssetCache"]; +openfl_IAssetCache.prototype = { + get_enabled: null + ,getBitmapData: null + ,getSound: null + ,hasBitmapData: null + ,hasSound: null + ,setBitmapData: null + ,__class__: openfl_IAssetCache + ,__properties__: {get_enabled:"get_enabled"} +}; +var openfl_AssetCache = function() { + this.__enabled = true; + this.bitmapData = new haxe_ds_StringMap(); + this.font = new haxe_ds_StringMap(); + this.sound = new haxe_ds_StringMap(); +}; +$hxClasses["openfl.AssetCache"] = openfl_AssetCache; +openfl_AssetCache.__name__ = ["openfl","AssetCache"]; +openfl_AssetCache.__interfaces__ = [openfl_IAssetCache]; +openfl_AssetCache.prototype = { + bitmapData: null + ,font: null + ,sound: null + ,__enabled: null + ,getBitmapData: function(id) { + return this.bitmapData.get(id); + } + ,getSound: function(id) { + return this.sound.get(id); + } + ,hasBitmapData: function(id) { + return this.bitmapData.exists(id); + } + ,hasSound: function(id) { + return this.sound.exists(id); + } + ,setBitmapData: function(id,bitmapData) { + this.bitmapData.set(id,bitmapData); + } + ,get_enabled: function() { + return this.__enabled; + } + ,__class__: openfl_AssetCache + ,__properties__: {get_enabled:"get_enabled"} +}; +var openfl_Assets = function() { }; +$hxClasses["openfl.Assets"] = openfl_Assets; +openfl_Assets.__name__ = ["openfl","Assets"]; +openfl_Assets.exists = function(id,type) { + return lime_Assets.exists(id,type); +}; +openfl_Assets.getBitmapData = function(id,useCache) { + if(useCache == null) { + useCache = true; + } + if(useCache && openfl_Assets.cache.get_enabled() && openfl_Assets.cache.hasBitmapData(id)) { + var bitmapData = openfl_Assets.cache.getBitmapData(id); + if(openfl_Assets.isValidBitmapData(bitmapData)) { + return bitmapData; + } + } + var image = lime_Assets.getImage(id,false); + if(image != null) { + var bitmapData1 = openfl_display_BitmapData.fromImage(image); + if(useCache && openfl_Assets.cache.get_enabled()) { + openfl_Assets.cache.setBitmapData(id,bitmapData1); + } + return bitmapData1; + } + return null; +}; +openfl_Assets.getBytes = function(id) { + return openfl_utils__$ByteArray_ByteArray_$Impl_$.fromBytes(lime_Assets.getBytes(id)); +}; +openfl_Assets.getSound = function(id,useCache) { + if(useCache == null) { + useCache = true; + } + if(useCache && openfl_Assets.cache.get_enabled() && openfl_Assets.cache.hasSound(id)) { + var sound = openfl_Assets.cache.getSound(id); + if(openfl_Assets.isValidSound(sound)) { + return sound; + } + } + var path = lime_Assets.getPath(id); + if(path != null) { + return new openfl_media_Sound(new openfl_net_URLRequest(path)); + } + return null; +}; +openfl_Assets.getText = function(id) { + return lime_Assets.getText(id); +}; +openfl_Assets.isValidBitmapData = function(bitmapData) { + if(bitmapData != null) { + return bitmapData.image != null; + } else { + return false; + } +}; +openfl_Assets.isValidSound = function(sound) { + return true; +}; +openfl_Assets.list = function(type) { + return lime_Assets.list(type); +}; +openfl_Assets.loadBitmapData = function(id,useCache,handler) { + if(useCache == null) { + useCache = true; + } + if(useCache == null) { + useCache = true; + } + var promise = new lime_app_Promise(); + if(handler != null) { + promise.future.onComplete(handler); + promise.future.onError(function(_) { + handler(null); + }); + } + if(useCache && openfl_Assets.cache.get_enabled() && openfl_Assets.cache.hasBitmapData(id)) { + var bitmapData = openfl_Assets.cache.getBitmapData(id); + if(openfl_Assets.isValidBitmapData(bitmapData)) { + promise.complete(bitmapData); + return promise.future; + } + } + lime_Assets.loadImage(id,false).onComplete(function(image) { + if(image != null) { + var bitmapData1 = openfl_display_BitmapData.fromImage(image); + if(useCache && openfl_Assets.cache.get_enabled()) { + openfl_Assets.cache.setBitmapData(id,bitmapData1); + } + promise.complete(bitmapData1); + } else { + promise.error("[Assets] Could not load Image \"" + id + "\""); + } + }).onError($bind(promise,promise.error)).onProgress($bind(promise,promise.progress)); + return promise.future; +}; +var openfl_display_MovieClip = function() { + openfl_display_Sprite.call(this); + this.__currentFrame = 0; + this.__currentLabels = []; + this.__totalFrames = 0; + this.enabled = true; +}; +$hxClasses["openfl.display.MovieClip"] = openfl_display_MovieClip; +openfl_display_MovieClip.__name__ = ["openfl","display","MovieClip"]; +openfl_display_MovieClip.__super__ = openfl_display_Sprite; +openfl_display_MovieClip.prototype = $extend(openfl_display_Sprite.prototype,{ + enabled: null + ,__currentFrame: null + ,__currentLabels: null + ,__totalFrames: null + ,__class__: openfl_display_MovieClip +}); +var openfl_Lib = function() { }; +$hxClasses["openfl.Lib"] = openfl_Lib; +openfl_Lib.__name__ = ["openfl","Lib"]; +openfl_Lib.application = null; +openfl_Lib.embed = $hx_exports["openfl"]["embed"] = function(elementName,width,height,background,assetsPrefix) { + lime_system_System.embed(elementName,width,height,background,assetsPrefix); +}; +openfl_Lib.getTimer = function() { + return lime_system_System.getTimer(); +}; +openfl_Lib.getURL = function(request,target) { + if(target == null) { + target = "_blank"; + } + js_Browser.get_window().open(request.url,target); +}; +var openfl_VectorData = function() { + this.length = 0; +}; +$hxClasses["openfl.VectorData"] = openfl_VectorData; +openfl_VectorData.__name__ = ["openfl","VectorData"]; +openfl_VectorData.prototype = { + data: null + ,fixed: null + ,length: null + ,__class__: openfl_VectorData +}; +var openfl__$internal_renderer_AbstractMaskManager = function(renderSession) { + this.renderSession = renderSession; +}; +$hxClasses["openfl._internal.renderer.AbstractMaskManager"] = openfl__$internal_renderer_AbstractMaskManager; +openfl__$internal_renderer_AbstractMaskManager.__name__ = ["openfl","_internal","renderer","AbstractMaskManager"]; +openfl__$internal_renderer_AbstractMaskManager.prototype = { + renderSession: null + ,pushMask: function(mask) { + } + ,pushRect: function(rect,transform) { + } + ,popMask: function() { + } + ,popRect: function() { + } + ,saveState: function() { + } + ,restoreState: function() { + } + ,__class__: openfl__$internal_renderer_AbstractMaskManager +}; +var openfl__$internal_renderer_AbstractRenderer = function(width,height) { + this.width = width; + this.height = height; +}; +$hxClasses["openfl._internal.renderer.AbstractRenderer"] = openfl__$internal_renderer_AbstractRenderer; +openfl__$internal_renderer_AbstractRenderer.__name__ = ["openfl","_internal","renderer","AbstractRenderer"]; +openfl__$internal_renderer_AbstractRenderer.prototype = { + height: null + ,width: null + ,transparent: null + ,viewport: null + ,renderSession: null + ,render: function(stage) { + } + ,setViewport: function(x,y,width,height) { + } + ,resize: function(width,height) { + } + ,__class__: openfl__$internal_renderer_AbstractRenderer +}; +var openfl__$internal_renderer_DrawCommandBuffer = function() { + this.types = []; + this.b = []; + this.i = []; + this.f = []; + this.o = []; + this.ff = []; + this.ii = []; + this.ts = []; +}; +$hxClasses["openfl._internal.renderer.DrawCommandBuffer"] = openfl__$internal_renderer_DrawCommandBuffer; +openfl__$internal_renderer_DrawCommandBuffer.__name__ = ["openfl","_internal","renderer","DrawCommandBuffer"]; +openfl__$internal_renderer_DrawCommandBuffer.prototype = { + types: null + ,b: null + ,f: null + ,ff: null + ,i: null + ,ii: null + ,o: null + ,ts: null + ,append: function(other) { + var data = new openfl__$internal_renderer_DrawCommandReader(other); + var _g = 0; + var _g1 = other.types; + while(_g < _g1.length) { + var type = _g1[_g]; + ++_g; + switch(Type.enumIndex(type)) { + case 0: + var c = data.readBeginBitmapFill(); + this.beginBitmapFill(openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_bitmap(c),openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_matrix(c),openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_repeat(c),openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_smooth(c)); + break; + case 1: + var c1 = data.readBeginFill(); + this.beginFill(openfl__$internal_renderer__$DrawCommandReader_BeginFillView_$Impl_$.get_color(c1),openfl__$internal_renderer__$DrawCommandReader_BeginFillView_$Impl_$.get_alpha(c1)); + break; + case 2: + var c2 = data.readBeginGradientFill(); + this.beginGradientFill(openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_type(c2),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_colors(c2),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_alphas(c2),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_ratios(c2),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_matrix(c2),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_spreadMethod(c2),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_interpolationMethod(c2),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_focalPointRatio(c2)); + break; + case 3: + var c3 = data.readCubicCurveTo(); + this.cubicCurveTo(openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlX1(c3),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlY1(c3),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlX2(c3),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlY2(c3),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_anchorX(c3),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_anchorY(c3)); + break; + case 4: + var c4 = data.readCurveTo(); + this.curveTo(openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_controlX(c4),openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_controlY(c4),openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_anchorX(c4),openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_anchorY(c4)); + break; + case 5: + var c5 = data.readDrawCircle(); + this.drawCircle(openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_x(c5),openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_y(c5),openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_radius(c5)); + break; + case 6: + var c6 = data.readDrawEllipse(); + this.drawEllipse(openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_x(c6),openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_y(c6),openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_width(c6),openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_height(c6)); + break; + case 7: + var c7 = data.readDrawPath(); + this.drawPath(openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.get_commands(c7),openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.get_data(c7),openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.get_winding(c7)); + break; + case 8: + var c8 = data.readDrawRect(); + this.drawRect(openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_x(c8),openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_y(c8),openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_width(c8),openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_height(c8)); + break; + case 9: + var c9 = data.readDrawRoundRect(); + this.drawRoundRect(openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_x(c9),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_y(c9),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_width(c9),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_height(c9),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_ellipseWidth(c9),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_ellipseHeight(c9)); + break; + case 10: + var c10 = data.readDrawTiles(); + this.drawTiles(openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_sheet(c10),openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_tileData(c10),openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_smooth(c10),openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_flags(c10),openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_shader(c10),openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_count(c10)); + break; + case 11: + var c11 = data.readDrawTriangles(); + this.drawTriangles(openfl__$internal_renderer__$DrawCommandReader_DrawTrianglesView_$Impl_$.get_vertices(c11),openfl__$internal_renderer__$DrawCommandReader_DrawTrianglesView_$Impl_$.get_indices(c11),openfl__$internal_renderer__$DrawCommandReader_DrawTrianglesView_$Impl_$.get_uvtData(c11),openfl__$internal_renderer__$DrawCommandReader_DrawTrianglesView_$Impl_$.get_culling(c11)); + break; + case 12: + var c12 = data.readEndFill(); + this.endFill(); + break; + case 13: + var c13 = data.readLineBitmapStyle(); + this.lineBitmapStyle(openfl__$internal_renderer__$DrawCommandReader_LineBitmapStyleView_$Impl_$.get_bitmap(c13),openfl__$internal_renderer__$DrawCommandReader_LineBitmapStyleView_$Impl_$.get_matrix(c13),openfl__$internal_renderer__$DrawCommandReader_LineBitmapStyleView_$Impl_$.get_repeat(c13),openfl__$internal_renderer__$DrawCommandReader_LineBitmapStyleView_$Impl_$.get_smooth(c13)); + break; + case 14: + var c14 = data.readLineGradientStyle(); + this.lineGradientStyle(openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_type(c14),openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_colors(c14),openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_alphas(c14),openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_ratios(c14),openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_matrix(c14),openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_spreadMethod(c14),openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_interpolationMethod(c14),openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_focalPointRatio(c14)); + break; + case 15: + var c15 = data.readLineStyle(); + this.lineStyle(openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_thickness(c15),openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_color(c15),openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_alpha(c15),openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_pixelHinting(c15),openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_scaleMode(c15),openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_caps(c15),openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_joints(c15),openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_miterLimit(c15)); + break; + case 16: + var c16 = data.readLineTo(); + this.lineTo(openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.get_x(c16),openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.get_y(c16)); + break; + case 17: + var c17 = data.readMoveTo(); + this.moveTo(openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_x(c17),openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_y(c17)); + break; + case 18: + var c18 = data.readOverrideMatrix(); + this.overrideMatrix(openfl__$internal_renderer__$DrawCommandReader_OverrideMatrixView_$Impl_$.get_matrix(c18)); + break; + default: + } + } + data.destroy(); + return other; + } + ,beginBitmapFill: function(bitmap,matrix,repeat,smooth) { + this.types.push(openfl__$internal_renderer_DrawCommandType.BEGIN_BITMAP_FILL); + this.o.push(bitmap); + this.o.push(matrix); + this.b.push(repeat); + this.b.push(smooth); + } + ,beginFill: function(color,alpha) { + this.types.push(openfl__$internal_renderer_DrawCommandType.BEGIN_FILL); + this.i.push(color); + this.f.push(alpha); + } + ,beginGradientFill: function(type,colors,alphas,ratios,matrix,spreadMethod,interpolationMethod,focalPointRatio) { + this.types.push(openfl__$internal_renderer_DrawCommandType.BEGIN_GRADIENT_FILL); + this.o.push(type); + this.ii.push(colors); + this.ff.push(alphas); + this.ii.push(ratios); + this.o.push(matrix); + this.o.push(spreadMethod); + this.o.push(interpolationMethod); + this.f.push(focalPointRatio); + } + ,clear: function() { + this.types.splice(0,this.types.length); + this.b.splice(0,this.b.length); + this.i.splice(0,this.i.length); + this.f.splice(0,this.f.length); + this.o.splice(0,this.o.length); + this.ff.splice(0,this.ff.length); + this.ii.splice(0,this.ii.length); + this.ts.splice(0,this.ts.length); + } + ,cubicCurveTo: function(controlX1,controlY1,controlX2,controlY2,anchorX,anchorY) { + this.types.push(openfl__$internal_renderer_DrawCommandType.CUBIC_CURVE_TO); + this.f.push(controlX1); + this.f.push(controlY1); + this.f.push(controlX2); + this.f.push(controlY2); + this.f.push(anchorX); + this.f.push(anchorY); + } + ,curveTo: function(controlX,controlY,anchorX,anchorY) { + this.types.push(openfl__$internal_renderer_DrawCommandType.CURVE_TO); + this.f.push(controlX); + this.f.push(controlY); + this.f.push(anchorX); + this.f.push(anchorY); + } + ,drawCircle: function(x,y,radius) { + this.types.push(openfl__$internal_renderer_DrawCommandType.DRAW_CIRCLE); + this.f.push(x); + this.f.push(y); + this.f.push(radius); + } + ,drawEllipse: function(x,y,width,height) { + this.types.push(openfl__$internal_renderer_DrawCommandType.DRAW_ELLIPSE); + this.f.push(x); + this.f.push(y); + this.f.push(width); + this.f.push(height); + } + ,drawPath: function(commands,data,winding) { + this.types.push(openfl__$internal_renderer_DrawCommandType.DRAW_PATH); + this.o.push(commands); + this.o.push(data); + this.o.push(winding); + } + ,drawRect: function(x,y,width,height) { + this.types.push(openfl__$internal_renderer_DrawCommandType.DRAW_RECT); + this.f.push(x); + this.f.push(y); + this.f.push(width); + this.f.push(height); + } + ,drawRoundRect: function(x,y,width,height,ellipseWidth,ellipseHeight) { + this.types.push(openfl__$internal_renderer_DrawCommandType.DRAW_ROUND_RECT); + this.f.push(x); + this.f.push(y); + this.f.push(width); + this.f.push(height); + this.f.push(ellipseWidth); + this.o.push(ellipseHeight); + } + ,drawTiles: function(sheet,tileData,smooth,flags,shader,count) { + this.types.push(openfl__$internal_renderer_DrawCommandType.DRAW_TILES); + this.ts.push(sheet); + this.ff.push(tileData); + this.b.push(smooth); + this.i.push(flags); + this.o.push(shader); + this.i.push(count); + } + ,drawTriangles: function(vertices,indices,uvtData,culling) { + this.types.push(openfl__$internal_renderer_DrawCommandType.DRAW_TRIANGLES); + this.o.push(vertices); + this.o.push(indices); + this.o.push(uvtData); + this.o.push(culling); + } + ,endFill: function() { + this.types.push(openfl__$internal_renderer_DrawCommandType.END_FILL); + } + ,lineBitmapStyle: function(bitmap,matrix,repeat,smooth) { + this.types.push(openfl__$internal_renderer_DrawCommandType.LINE_BITMAP_STYLE); + this.o.push(bitmap); + this.o.push(matrix); + this.b.push(repeat); + this.b.push(smooth); + } + ,lineGradientStyle: function(type,colors,alphas,ratios,matrix,spreadMethod,interpolationMethod,focalPointRatio) { + this.types.push(openfl__$internal_renderer_DrawCommandType.LINE_GRADIENT_STYLE); + this.o.push(type); + this.ii.push(colors); + this.ff.push(alphas); + this.ii.push(ratios); + this.o.push(matrix); + this.o.push(spreadMethod); + this.o.push(interpolationMethod); + this.f.push(focalPointRatio); + } + ,lineStyle: function(thickness,color,alpha,pixelHinting,scaleMode,caps,joints,miterLimit) { + this.types.push(openfl__$internal_renderer_DrawCommandType.LINE_STYLE); + this.o.push(thickness); + this.i.push(color); + this.f.push(alpha); + this.b.push(pixelHinting); + this.o.push(scaleMode); + this.o.push(caps); + this.o.push(joints); + this.f.push(miterLimit); + } + ,lineTo: function(x,y) { + this.types.push(openfl__$internal_renderer_DrawCommandType.LINE_TO); + this.f.push(x); + this.f.push(y); + } + ,moveTo: function(x,y) { + this.types.push(openfl__$internal_renderer_DrawCommandType.MOVE_TO); + this.f.push(x); + this.f.push(y); + } + ,overrideMatrix: function(matrix) { + this.types.push(openfl__$internal_renderer_DrawCommandType.OVERRIDE_MATRIX); + this.o.push(matrix); + } + ,get_length: function() { + return this.types.length; + } + ,__class__: openfl__$internal_renderer_DrawCommandBuffer + ,__properties__: {get_length:"get_length"} +}; +var openfl__$internal_renderer_DrawCommandReader = function(buffer) { + this.buffer = buffer; + this.bPos = this.iPos = this.fPos = this.oPos = this.ffPos = this.iiPos = this.tsPos = 0; + this.prev = openfl__$internal_renderer_DrawCommandType.UNKNOWN; +}; +$hxClasses["openfl._internal.renderer.DrawCommandReader"] = openfl__$internal_renderer_DrawCommandReader; +openfl__$internal_renderer_DrawCommandReader.__name__ = ["openfl","_internal","renderer","DrawCommandReader"]; +openfl__$internal_renderer_DrawCommandReader.prototype = { + buffer: null + ,bPos: null + ,iiPos: null + ,iPos: null + ,ffPos: null + ,fPos: null + ,oPos: null + ,prev: null + ,tsPos: null + ,advance: function() { + var _g = this.prev; + switch(Type.enumIndex(_g)) { + case 0: + this.oPos += 2; + this.bPos += 2; + break; + case 1: + this.iPos += 1; + this.fPos += 1; + break; + case 2: + this.oPos += 4; + this.iiPos += 2; + this.ffPos += 1; + this.fPos += 1; + break; + case 3: + this.fPos += 6; + break; + case 4: + this.fPos += 4; + break; + case 5: + this.fPos += 3; + break; + case 6: + this.fPos += 4; + break; + case 7: + this.oPos += 3; + break; + case 8: + this.fPos += 4; + break; + case 9: + this.fPos += 5; + this.oPos += 1; + break; + case 10: + this.tsPos += 1; + this.ffPos += 1; + this.bPos += 1; + this.iPos += 2; + this.oPos += 1; + break; + case 11: + this.oPos += 4; + break; + case 12: + break; + case 13: + this.oPos += 2; + this.bPos += 2; + break; + case 14: + this.oPos += 4; + this.iiPos += 2; + this.ffPos += 1; + this.fPos += 1; + break; + case 15: + this.oPos += 4; + this.iPos += 1; + this.fPos += 2; + this.bPos += 1; + break; + case 16: + this.fPos += 2; + break; + case 17: + this.fPos += 2; + break; + case 18: + this.oPos += 1; + break; + default: + } + } + ,bool: function(index) { + return this.buffer.b[this.bPos + index]; + } + ,destroy: function() { + this.buffer = null; + this.reset(); + } + ,fArr: function(index) { + return this.buffer.ff[this.ffPos + index]; + } + ,'float': function(index) { + return this.buffer.f[this.fPos + index]; + } + ,iArr: function(index) { + return this.buffer.ii[this.iiPos + index]; + } + ,'int': function(index) { + return this.buffer.i[this.iPos + index]; + } + ,obj: function(index) { + return this.buffer.o[this.oPos + index]; + } + ,readBeginBitmapFill: function() { + this.advance(); + this.prev = openfl__$internal_renderer_DrawCommandType.BEGIN_BITMAP_FILL; + return openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$._new(this); + } + ,readBeginFill: function() { + this.advance(); + this.prev = openfl__$internal_renderer_DrawCommandType.BEGIN_FILL; + return openfl__$internal_renderer__$DrawCommandReader_BeginFillView_$Impl_$._new(this); + } + ,readBeginGradientFill: function() { + this.advance(); + this.prev = openfl__$internal_renderer_DrawCommandType.BEGIN_GRADIENT_FILL; + return openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$._new(this); + } + ,readCubicCurveTo: function() { + this.advance(); + this.prev = openfl__$internal_renderer_DrawCommandType.CUBIC_CURVE_TO; + return openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$._new(this); + } + ,readCurveTo: function() { + this.advance(); + this.prev = openfl__$internal_renderer_DrawCommandType.CURVE_TO; + return openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$._new(this); + } + ,readDrawCircle: function() { + this.advance(); + this.prev = openfl__$internal_renderer_DrawCommandType.DRAW_CIRCLE; + return openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$._new(this); + } + ,readDrawEllipse: function() { + this.advance(); + this.prev = openfl__$internal_renderer_DrawCommandType.DRAW_ELLIPSE; + return openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$._new(this); + } + ,readDrawPath: function() { + this.advance(); + this.prev = openfl__$internal_renderer_DrawCommandType.DRAW_PATH; + return openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$._new(this); + } + ,readDrawRect: function() { + this.advance(); + this.prev = openfl__$internal_renderer_DrawCommandType.DRAW_RECT; + return openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$._new(this); + } + ,readDrawRoundRect: function() { + this.advance(); + this.prev = openfl__$internal_renderer_DrawCommandType.DRAW_ROUND_RECT; + return openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$._new(this); + } + ,readDrawTiles: function() { + this.advance(); + this.prev = openfl__$internal_renderer_DrawCommandType.DRAW_TILES; + return openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$._new(this); + } + ,readDrawTriangles: function() { + this.advance(); + this.prev = openfl__$internal_renderer_DrawCommandType.DRAW_TRIANGLES; + return openfl__$internal_renderer__$DrawCommandReader_DrawTrianglesView_$Impl_$._new(this); + } + ,readEndFill: function() { + this.advance(); + this.prev = openfl__$internal_renderer_DrawCommandType.END_FILL; + return openfl__$internal_renderer__$DrawCommandReader_EndFillView_$Impl_$._new(this); + } + ,readLineBitmapStyle: function() { + this.advance(); + this.prev = openfl__$internal_renderer_DrawCommandType.LINE_BITMAP_STYLE; + return openfl__$internal_renderer__$DrawCommandReader_LineBitmapStyleView_$Impl_$._new(this); + } + ,readLineGradientStyle: function() { + this.advance(); + this.prev = openfl__$internal_renderer_DrawCommandType.LINE_GRADIENT_STYLE; + return openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$._new(this); + } + ,readLineStyle: function() { + this.advance(); + this.prev = openfl__$internal_renderer_DrawCommandType.LINE_STYLE; + return openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$._new(this); + } + ,readLineTo: function() { + this.advance(); + this.prev = openfl__$internal_renderer_DrawCommandType.LINE_TO; + return openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$._new(this); + } + ,readMoveTo: function() { + this.advance(); + this.prev = openfl__$internal_renderer_DrawCommandType.MOVE_TO; + return openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$._new(this); + } + ,readOverrideMatrix: function() { + this.advance(); + this.prev = openfl__$internal_renderer_DrawCommandType.OVERRIDE_MATRIX; + return openfl__$internal_renderer__$DrawCommandReader_OverrideMatrixView_$Impl_$._new(this); + } + ,reset: function() { + this.bPos = this.iPos = this.fPos = this.oPos = this.ffPos = this.iiPos = this.tsPos = 0; + } + ,skip: function(type) { + this.advance(); + this.prev = type; + } + ,tileSheet: function(index) { + return this.buffer.ts[this.tsPos + index]; + } + ,__class__: openfl__$internal_renderer_DrawCommandReader +}; +var openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$ = {}; +$hxClasses["openfl._internal.renderer._DrawCommandReader.BeginBitmapFillView_Impl_"] = openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$; +openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.__name__ = ["openfl","_internal","renderer","_DrawCommandReader","BeginBitmapFillView_Impl_"]; +openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.__properties__ = {get_smooth:"get_smooth",get_repeat:"get_repeat",get_matrix:"get_matrix",get_bitmap:"get_bitmap"}; +openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$._new = function(d) { + var this1 = d; + return this1; +}; +openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_bitmap = function(this1) { + return this1.obj(0); +}; +openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_matrix = function(this1) { + return this1.obj(1); +}; +openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_repeat = function(this1) { + return this1.bool(0); +}; +openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_smooth = function(this1) { + return this1.bool(1); +}; +var openfl__$internal_renderer__$DrawCommandReader_BeginFillView_$Impl_$ = {}; +$hxClasses["openfl._internal.renderer._DrawCommandReader.BeginFillView_Impl_"] = openfl__$internal_renderer__$DrawCommandReader_BeginFillView_$Impl_$; +openfl__$internal_renderer__$DrawCommandReader_BeginFillView_$Impl_$.__name__ = ["openfl","_internal","renderer","_DrawCommandReader","BeginFillView_Impl_"]; +openfl__$internal_renderer__$DrawCommandReader_BeginFillView_$Impl_$.__properties__ = {get_alpha:"get_alpha",get_color:"get_color"}; +openfl__$internal_renderer__$DrawCommandReader_BeginFillView_$Impl_$._new = function(d) { + var this1 = d; + return this1; +}; +openfl__$internal_renderer__$DrawCommandReader_BeginFillView_$Impl_$.get_color = function(this1) { + return this1["int"](0); +}; +openfl__$internal_renderer__$DrawCommandReader_BeginFillView_$Impl_$.get_alpha = function(this1) { + return this1["float"](0); +}; +var openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$ = {}; +$hxClasses["openfl._internal.renderer._DrawCommandReader.BeginGradientFillView_Impl_"] = openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$; +openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.__name__ = ["openfl","_internal","renderer","_DrawCommandReader","BeginGradientFillView_Impl_"]; +openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.__properties__ = {get_focalPointRatio:"get_focalPointRatio",get_interpolationMethod:"get_interpolationMethod",get_spreadMethod:"get_spreadMethod",get_matrix:"get_matrix",get_ratios:"get_ratios",get_alphas:"get_alphas",get_colors:"get_colors",get_type:"get_type"}; +openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$._new = function(d) { + var this1 = d; + return this1; +}; +openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_type = function(this1) { + return this1.obj(0); +}; +openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_colors = function(this1) { + return this1.iArr(0); +}; +openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_alphas = function(this1) { + return this1.fArr(0); +}; +openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_ratios = function(this1) { + return this1.iArr(1); +}; +openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_matrix = function(this1) { + return this1.obj(1); +}; +openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_spreadMethod = function(this1) { + return this1.obj(2); +}; +openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_interpolationMethod = function(this1) { + return this1.obj(3); +}; +openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_focalPointRatio = function(this1) { + return this1["float"](0); +}; +var openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$ = {}; +$hxClasses["openfl._internal.renderer._DrawCommandReader.CubicCurveToView_Impl_"] = openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$; +openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.__name__ = ["openfl","_internal","renderer","_DrawCommandReader","CubicCurveToView_Impl_"]; +openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.__properties__ = {get_anchorY:"get_anchorY",get_anchorX:"get_anchorX",get_controlY2:"get_controlY2",get_controlX2:"get_controlX2",get_controlY1:"get_controlY1",get_controlX1:"get_controlX1"}; +openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$._new = function(d) { + var this1 = d; + return this1; +}; +openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlX1 = function(this1) { + return this1["float"](0); +}; +openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlY1 = function(this1) { + return this1["float"](1); +}; +openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlX2 = function(this1) { + return this1["float"](2); +}; +openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlY2 = function(this1) { + return this1["float"](3); +}; +openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_anchorX = function(this1) { + return this1["float"](4); +}; +openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_anchorY = function(this1) { + return this1["float"](5); +}; +var openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$ = {}; +$hxClasses["openfl._internal.renderer._DrawCommandReader.CurveToView_Impl_"] = openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$; +openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.__name__ = ["openfl","_internal","renderer","_DrawCommandReader","CurveToView_Impl_"]; +openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.__properties__ = {get_anchorY:"get_anchorY",get_anchorX:"get_anchorX",get_controlY:"get_controlY",get_controlX:"get_controlX"}; +openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$._new = function(d) { + var this1 = d; + return this1; +}; +openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_controlX = function(this1) { + return this1["float"](0); +}; +openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_controlY = function(this1) { + return this1["float"](1); +}; +openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_anchorX = function(this1) { + return this1["float"](2); +}; +openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_anchorY = function(this1) { + return this1["float"](3); +}; +var openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$ = {}; +$hxClasses["openfl._internal.renderer._DrawCommandReader.DrawCircleView_Impl_"] = openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$; +openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.__name__ = ["openfl","_internal","renderer","_DrawCommandReader","DrawCircleView_Impl_"]; +openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.__properties__ = {get_radius:"get_radius",get_y:"get_y",get_x:"get_x"}; +openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$._new = function(d) { + var this1 = d; + return this1; +}; +openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_x = function(this1) { + return this1["float"](0); +}; +openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_y = function(this1) { + return this1["float"](1); +}; +openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_radius = function(this1) { + return this1["float"](2); +}; +var openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$ = {}; +$hxClasses["openfl._internal.renderer._DrawCommandReader.DrawEllipseView_Impl_"] = openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$; +openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.__name__ = ["openfl","_internal","renderer","_DrawCommandReader","DrawEllipseView_Impl_"]; +openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.__properties__ = {get_height:"get_height",get_width:"get_width",get_y:"get_y",get_x:"get_x"}; +openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$._new = function(d) { + var this1 = d; + return this1; +}; +openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_x = function(this1) { + return this1["float"](0); +}; +openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_y = function(this1) { + return this1["float"](1); +}; +openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_width = function(this1) { + return this1["float"](2); +}; +openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_height = function(this1) { + return this1["float"](3); +}; +var openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$ = {}; +$hxClasses["openfl._internal.renderer._DrawCommandReader.DrawPathView_Impl_"] = openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$; +openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.__name__ = ["openfl","_internal","renderer","_DrawCommandReader","DrawPathView_Impl_"]; +openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.__properties__ = {get_winding:"get_winding",get_data:"get_data",get_commands:"get_commands"}; +openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$._new = function(d) { + var this1 = d; + return this1; +}; +openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.get_commands = function(this1) { + return this1.obj(0); +}; +openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.get_data = function(this1) { + return this1.obj(1); +}; +openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.get_winding = function(this1) { + return this1.obj(2); +}; +var openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$ = {}; +$hxClasses["openfl._internal.renderer._DrawCommandReader.DrawRectView_Impl_"] = openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$; +openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.__name__ = ["openfl","_internal","renderer","_DrawCommandReader","DrawRectView_Impl_"]; +openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.__properties__ = {get_height:"get_height",get_width:"get_width",get_y:"get_y",get_x:"get_x"}; +openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$._new = function(d) { + var this1 = d; + return this1; +}; +openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_x = function(this1) { + return this1["float"](0); +}; +openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_y = function(this1) { + return this1["float"](1); +}; +openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_width = function(this1) { + return this1["float"](2); +}; +openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_height = function(this1) { + return this1["float"](3); +}; +var openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$ = {}; +$hxClasses["openfl._internal.renderer._DrawCommandReader.DrawRoundRectView_Impl_"] = openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$; +openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.__name__ = ["openfl","_internal","renderer","_DrawCommandReader","DrawRoundRectView_Impl_"]; +openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.__properties__ = {get_ellipseHeight:"get_ellipseHeight",get_ellipseWidth:"get_ellipseWidth",get_height:"get_height",get_width:"get_width",get_y:"get_y",get_x:"get_x"}; +openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$._new = function(d) { + var this1 = d; + return this1; +}; +openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_x = function(this1) { + return this1["float"](0); +}; +openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_y = function(this1) { + return this1["float"](1); +}; +openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_width = function(this1) { + return this1["float"](2); +}; +openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_height = function(this1) { + return this1["float"](3); +}; +openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_ellipseWidth = function(this1) { + return this1["float"](4); +}; +openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_ellipseHeight = function(this1) { + return this1.obj(0); +}; +var openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$ = {}; +$hxClasses["openfl._internal.renderer._DrawCommandReader.DrawTilesView_Impl_"] = openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$; +openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.__name__ = ["openfl","_internal","renderer","_DrawCommandReader","DrawTilesView_Impl_"]; +openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.__properties__ = {get_count:"get_count",get_shader:"get_shader",get_flags:"get_flags",get_smooth:"get_smooth",get_tileData:"get_tileData",get_sheet:"get_sheet"}; +openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$._new = function(d) { + var this1 = d; + return this1; +}; +openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_sheet = function(this1) { + return this1.tileSheet(0); +}; +openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_tileData = function(this1) { + return this1.fArr(0); +}; +openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_smooth = function(this1) { + return this1.bool(0); +}; +openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_flags = function(this1) { + return this1["int"](0); +}; +openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_shader = function(this1) { + return this1.obj(0); +}; +openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_count = function(this1) { + return this1["int"](1); +}; +var openfl__$internal_renderer__$DrawCommandReader_DrawTrianglesView_$Impl_$ = {}; +$hxClasses["openfl._internal.renderer._DrawCommandReader.DrawTrianglesView_Impl_"] = openfl__$internal_renderer__$DrawCommandReader_DrawTrianglesView_$Impl_$; +openfl__$internal_renderer__$DrawCommandReader_DrawTrianglesView_$Impl_$.__name__ = ["openfl","_internal","renderer","_DrawCommandReader","DrawTrianglesView_Impl_"]; +openfl__$internal_renderer__$DrawCommandReader_DrawTrianglesView_$Impl_$.__properties__ = {get_culling:"get_culling",get_uvtData:"get_uvtData",get_indices:"get_indices",get_vertices:"get_vertices"}; +openfl__$internal_renderer__$DrawCommandReader_DrawTrianglesView_$Impl_$._new = function(d) { + var this1 = d; + return this1; +}; +openfl__$internal_renderer__$DrawCommandReader_DrawTrianglesView_$Impl_$.get_vertices = function(this1) { + return this1.obj(0); +}; +openfl__$internal_renderer__$DrawCommandReader_DrawTrianglesView_$Impl_$.get_indices = function(this1) { + return this1.obj(1); +}; +openfl__$internal_renderer__$DrawCommandReader_DrawTrianglesView_$Impl_$.get_uvtData = function(this1) { + return this1.obj(2); +}; +openfl__$internal_renderer__$DrawCommandReader_DrawTrianglesView_$Impl_$.get_culling = function(this1) { + return this1.obj(3); +}; +var openfl__$internal_renderer__$DrawCommandReader_EndFillView_$Impl_$ = {}; +$hxClasses["openfl._internal.renderer._DrawCommandReader.EndFillView_Impl_"] = openfl__$internal_renderer__$DrawCommandReader_EndFillView_$Impl_$; +openfl__$internal_renderer__$DrawCommandReader_EndFillView_$Impl_$.__name__ = ["openfl","_internal","renderer","_DrawCommandReader","EndFillView_Impl_"]; +openfl__$internal_renderer__$DrawCommandReader_EndFillView_$Impl_$._new = function(d) { + var this1 = d; + return this1; +}; +var openfl__$internal_renderer__$DrawCommandReader_LineBitmapStyleView_$Impl_$ = {}; +$hxClasses["openfl._internal.renderer._DrawCommandReader.LineBitmapStyleView_Impl_"] = openfl__$internal_renderer__$DrawCommandReader_LineBitmapStyleView_$Impl_$; +openfl__$internal_renderer__$DrawCommandReader_LineBitmapStyleView_$Impl_$.__name__ = ["openfl","_internal","renderer","_DrawCommandReader","LineBitmapStyleView_Impl_"]; +openfl__$internal_renderer__$DrawCommandReader_LineBitmapStyleView_$Impl_$.__properties__ = {get_smooth:"get_smooth",get_repeat:"get_repeat",get_matrix:"get_matrix",get_bitmap:"get_bitmap"}; +openfl__$internal_renderer__$DrawCommandReader_LineBitmapStyleView_$Impl_$._new = function(d) { + var this1 = d; + return this1; +}; +openfl__$internal_renderer__$DrawCommandReader_LineBitmapStyleView_$Impl_$.get_bitmap = function(this1) { + return this1.obj(0); +}; +openfl__$internal_renderer__$DrawCommandReader_LineBitmapStyleView_$Impl_$.get_matrix = function(this1) { + return this1.obj(1); +}; +openfl__$internal_renderer__$DrawCommandReader_LineBitmapStyleView_$Impl_$.get_repeat = function(this1) { + return this1.bool(0); +}; +openfl__$internal_renderer__$DrawCommandReader_LineBitmapStyleView_$Impl_$.get_smooth = function(this1) { + return this1.bool(1); +}; +var openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$ = {}; +$hxClasses["openfl._internal.renderer._DrawCommandReader.LineGradientStyleView_Impl_"] = openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$; +openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.__name__ = ["openfl","_internal","renderer","_DrawCommandReader","LineGradientStyleView_Impl_"]; +openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.__properties__ = {get_focalPointRatio:"get_focalPointRatio",get_interpolationMethod:"get_interpolationMethod",get_spreadMethod:"get_spreadMethod",get_matrix:"get_matrix",get_ratios:"get_ratios",get_alphas:"get_alphas",get_colors:"get_colors",get_type:"get_type"}; +openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$._new = function(d) { + var this1 = d; + return this1; +}; +openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_type = function(this1) { + return this1.obj(0); +}; +openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_colors = function(this1) { + return this1.iArr(0); +}; +openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_alphas = function(this1) { + return this1.fArr(0); +}; +openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_ratios = function(this1) { + return this1.iArr(1); +}; +openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_matrix = function(this1) { + return this1.obj(1); +}; +openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_spreadMethod = function(this1) { + return this1.obj(2); +}; +openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_interpolationMethod = function(this1) { + return this1.obj(3); +}; +openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_focalPointRatio = function(this1) { + return this1["float"](0); +}; +var openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$ = {}; +$hxClasses["openfl._internal.renderer._DrawCommandReader.LineStyleView_Impl_"] = openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$; +openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.__name__ = ["openfl","_internal","renderer","_DrawCommandReader","LineStyleView_Impl_"]; +openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.__properties__ = {get_miterLimit:"get_miterLimit",get_joints:"get_joints",get_caps:"get_caps",get_scaleMode:"get_scaleMode",get_pixelHinting:"get_pixelHinting",get_alpha:"get_alpha",get_color:"get_color",get_thickness:"get_thickness"}; +openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$._new = function(d) { + var this1 = d; + return this1; +}; +openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_thickness = function(this1) { + return this1.obj(0); +}; +openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_color = function(this1) { + return this1["int"](0); +}; +openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_alpha = function(this1) { + return this1["float"](0); +}; +openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_pixelHinting = function(this1) { + return this1.bool(0); +}; +openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_scaleMode = function(this1) { + return this1.obj(1); +}; +openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_caps = function(this1) { + return this1.obj(2); +}; +openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_joints = function(this1) { + return this1.obj(3); +}; +openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_miterLimit = function(this1) { + return this1["float"](1); +}; +var openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$ = {}; +$hxClasses["openfl._internal.renderer._DrawCommandReader.LineToView_Impl_"] = openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$; +openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.__name__ = ["openfl","_internal","renderer","_DrawCommandReader","LineToView_Impl_"]; +openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.__properties__ = {get_y:"get_y",get_x:"get_x"}; +openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$._new = function(d) { + var this1 = d; + return this1; +}; +openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.get_x = function(this1) { + return this1["float"](0); +}; +openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.get_y = function(this1) { + return this1["float"](1); +}; +var openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$ = {}; +$hxClasses["openfl._internal.renderer._DrawCommandReader.MoveToView_Impl_"] = openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$; +openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.__name__ = ["openfl","_internal","renderer","_DrawCommandReader","MoveToView_Impl_"]; +openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.__properties__ = {get_y:"get_y",get_x:"get_x"}; +openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$._new = function(d) { + var this1 = d; + return this1; +}; +openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_x = function(this1) { + return this1["float"](0); +}; +openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_y = function(this1) { + return this1["float"](1); +}; +var openfl__$internal_renderer__$DrawCommandReader_OverrideMatrixView_$Impl_$ = {}; +$hxClasses["openfl._internal.renderer._DrawCommandReader.OverrideMatrixView_Impl_"] = openfl__$internal_renderer__$DrawCommandReader_OverrideMatrixView_$Impl_$; +openfl__$internal_renderer__$DrawCommandReader_OverrideMatrixView_$Impl_$.__name__ = ["openfl","_internal","renderer","_DrawCommandReader","OverrideMatrixView_Impl_"]; +openfl__$internal_renderer__$DrawCommandReader_OverrideMatrixView_$Impl_$.__properties__ = {get_matrix:"get_matrix"}; +openfl__$internal_renderer__$DrawCommandReader_OverrideMatrixView_$Impl_$._new = function(d) { + var this1 = d; + return this1; +}; +openfl__$internal_renderer__$DrawCommandReader_OverrideMatrixView_$Impl_$.get_matrix = function(this1) { + return this1.obj(0); +}; +var openfl__$internal_renderer_DrawCommandType = $hxClasses["openfl._internal.renderer.DrawCommandType"] = { __ename__ : ["openfl","_internal","renderer","DrawCommandType"], __constructs__ : ["BEGIN_BITMAP_FILL","BEGIN_FILL","BEGIN_GRADIENT_FILL","CUBIC_CURVE_TO","CURVE_TO","DRAW_CIRCLE","DRAW_ELLIPSE","DRAW_PATH","DRAW_RECT","DRAW_ROUND_RECT","DRAW_TILES","DRAW_TRIANGLES","END_FILL","LINE_BITMAP_STYLE","LINE_GRADIENT_STYLE","LINE_STYLE","LINE_TO","MOVE_TO","OVERRIDE_MATRIX","UNKNOWN"] }; +openfl__$internal_renderer_DrawCommandType.BEGIN_BITMAP_FILL = ["BEGIN_BITMAP_FILL",0]; +openfl__$internal_renderer_DrawCommandType.BEGIN_BITMAP_FILL.toString = $estr; +openfl__$internal_renderer_DrawCommandType.BEGIN_BITMAP_FILL.__enum__ = openfl__$internal_renderer_DrawCommandType; +openfl__$internal_renderer_DrawCommandType.BEGIN_FILL = ["BEGIN_FILL",1]; +openfl__$internal_renderer_DrawCommandType.BEGIN_FILL.toString = $estr; +openfl__$internal_renderer_DrawCommandType.BEGIN_FILL.__enum__ = openfl__$internal_renderer_DrawCommandType; +openfl__$internal_renderer_DrawCommandType.BEGIN_GRADIENT_FILL = ["BEGIN_GRADIENT_FILL",2]; +openfl__$internal_renderer_DrawCommandType.BEGIN_GRADIENT_FILL.toString = $estr; +openfl__$internal_renderer_DrawCommandType.BEGIN_GRADIENT_FILL.__enum__ = openfl__$internal_renderer_DrawCommandType; +openfl__$internal_renderer_DrawCommandType.CUBIC_CURVE_TO = ["CUBIC_CURVE_TO",3]; +openfl__$internal_renderer_DrawCommandType.CUBIC_CURVE_TO.toString = $estr; +openfl__$internal_renderer_DrawCommandType.CUBIC_CURVE_TO.__enum__ = openfl__$internal_renderer_DrawCommandType; +openfl__$internal_renderer_DrawCommandType.CURVE_TO = ["CURVE_TO",4]; +openfl__$internal_renderer_DrawCommandType.CURVE_TO.toString = $estr; +openfl__$internal_renderer_DrawCommandType.CURVE_TO.__enum__ = openfl__$internal_renderer_DrawCommandType; +openfl__$internal_renderer_DrawCommandType.DRAW_CIRCLE = ["DRAW_CIRCLE",5]; +openfl__$internal_renderer_DrawCommandType.DRAW_CIRCLE.toString = $estr; +openfl__$internal_renderer_DrawCommandType.DRAW_CIRCLE.__enum__ = openfl__$internal_renderer_DrawCommandType; +openfl__$internal_renderer_DrawCommandType.DRAW_ELLIPSE = ["DRAW_ELLIPSE",6]; +openfl__$internal_renderer_DrawCommandType.DRAW_ELLIPSE.toString = $estr; +openfl__$internal_renderer_DrawCommandType.DRAW_ELLIPSE.__enum__ = openfl__$internal_renderer_DrawCommandType; +openfl__$internal_renderer_DrawCommandType.DRAW_PATH = ["DRAW_PATH",7]; +openfl__$internal_renderer_DrawCommandType.DRAW_PATH.toString = $estr; +openfl__$internal_renderer_DrawCommandType.DRAW_PATH.__enum__ = openfl__$internal_renderer_DrawCommandType; +openfl__$internal_renderer_DrawCommandType.DRAW_RECT = ["DRAW_RECT",8]; +openfl__$internal_renderer_DrawCommandType.DRAW_RECT.toString = $estr; +openfl__$internal_renderer_DrawCommandType.DRAW_RECT.__enum__ = openfl__$internal_renderer_DrawCommandType; +openfl__$internal_renderer_DrawCommandType.DRAW_ROUND_RECT = ["DRAW_ROUND_RECT",9]; +openfl__$internal_renderer_DrawCommandType.DRAW_ROUND_RECT.toString = $estr; +openfl__$internal_renderer_DrawCommandType.DRAW_ROUND_RECT.__enum__ = openfl__$internal_renderer_DrawCommandType; +openfl__$internal_renderer_DrawCommandType.DRAW_TILES = ["DRAW_TILES",10]; +openfl__$internal_renderer_DrawCommandType.DRAW_TILES.toString = $estr; +openfl__$internal_renderer_DrawCommandType.DRAW_TILES.__enum__ = openfl__$internal_renderer_DrawCommandType; +openfl__$internal_renderer_DrawCommandType.DRAW_TRIANGLES = ["DRAW_TRIANGLES",11]; +openfl__$internal_renderer_DrawCommandType.DRAW_TRIANGLES.toString = $estr; +openfl__$internal_renderer_DrawCommandType.DRAW_TRIANGLES.__enum__ = openfl__$internal_renderer_DrawCommandType; +openfl__$internal_renderer_DrawCommandType.END_FILL = ["END_FILL",12]; +openfl__$internal_renderer_DrawCommandType.END_FILL.toString = $estr; +openfl__$internal_renderer_DrawCommandType.END_FILL.__enum__ = openfl__$internal_renderer_DrawCommandType; +openfl__$internal_renderer_DrawCommandType.LINE_BITMAP_STYLE = ["LINE_BITMAP_STYLE",13]; +openfl__$internal_renderer_DrawCommandType.LINE_BITMAP_STYLE.toString = $estr; +openfl__$internal_renderer_DrawCommandType.LINE_BITMAP_STYLE.__enum__ = openfl__$internal_renderer_DrawCommandType; +openfl__$internal_renderer_DrawCommandType.LINE_GRADIENT_STYLE = ["LINE_GRADIENT_STYLE",14]; +openfl__$internal_renderer_DrawCommandType.LINE_GRADIENT_STYLE.toString = $estr; +openfl__$internal_renderer_DrawCommandType.LINE_GRADIENT_STYLE.__enum__ = openfl__$internal_renderer_DrawCommandType; +openfl__$internal_renderer_DrawCommandType.LINE_STYLE = ["LINE_STYLE",15]; +openfl__$internal_renderer_DrawCommandType.LINE_STYLE.toString = $estr; +openfl__$internal_renderer_DrawCommandType.LINE_STYLE.__enum__ = openfl__$internal_renderer_DrawCommandType; +openfl__$internal_renderer_DrawCommandType.LINE_TO = ["LINE_TO",16]; +openfl__$internal_renderer_DrawCommandType.LINE_TO.toString = $estr; +openfl__$internal_renderer_DrawCommandType.LINE_TO.__enum__ = openfl__$internal_renderer_DrawCommandType; +openfl__$internal_renderer_DrawCommandType.MOVE_TO = ["MOVE_TO",17]; +openfl__$internal_renderer_DrawCommandType.MOVE_TO.toString = $estr; +openfl__$internal_renderer_DrawCommandType.MOVE_TO.__enum__ = openfl__$internal_renderer_DrawCommandType; +openfl__$internal_renderer_DrawCommandType.OVERRIDE_MATRIX = ["OVERRIDE_MATRIX",18]; +openfl__$internal_renderer_DrawCommandType.OVERRIDE_MATRIX.toString = $estr; +openfl__$internal_renderer_DrawCommandType.OVERRIDE_MATRIX.__enum__ = openfl__$internal_renderer_DrawCommandType; +openfl__$internal_renderer_DrawCommandType.UNKNOWN = ["UNKNOWN",19]; +openfl__$internal_renderer_DrawCommandType.UNKNOWN.toString = $estr; +openfl__$internal_renderer_DrawCommandType.UNKNOWN.__enum__ = openfl__$internal_renderer_DrawCommandType; +var openfl__$internal_renderer_GraphicsPaths = function() { }; +$hxClasses["openfl._internal.renderer.GraphicsPaths"] = openfl__$internal_renderer_GraphicsPaths; +openfl__$internal_renderer_GraphicsPaths.__name__ = ["openfl","_internal","renderer","GraphicsPaths"]; +openfl__$internal_renderer_GraphicsPaths.ellipse = function(points,x,y,rx,ry,segmentCount) { + var seg = Math.PI * 2 / segmentCount; + var _g1 = 0; + var _g = segmentCount + 1; + while(_g1 < _g) { + var i = _g1++; + points.push(x + Math.sin(seg * i) * rx); + points.push(y + Math.cos(seg * i) * ry); + } +}; +openfl__$internal_renderer_GraphicsPaths.cubicCurveTo = function(points,cx,cy,cx2,cy2,x,y) { + var n = 20; + var dt = 0; + var dt2 = 0; + var dt3 = 0; + var t2 = 0; + var t3 = 0; + var fromX = points[points.length - 2]; + var fromY = points[points.length - 1]; + var px = 0; + var py = 0; + var tmp = 0; + var _g1 = 1; + var _g = n + 1; + while(_g1 < _g) { + var i = _g1++; + tmp = i / n; + dt = 1 - tmp; + dt2 = dt * dt; + dt3 = dt2 * dt; + t2 = tmp * tmp; + t3 = t2 * tmp; + px = dt3 * fromX + 3 * dt2 * tmp * cx + 3 * dt * t2 * cx2 + t3 * x; + py = dt3 * fromY + 3 * dt2 * tmp * cy + 3 * dt * t2 * cy2 + t3 * y; + points.push(px); + points.push(py); + } +}; +openfl__$internal_renderer_GraphicsPaths.curveTo = function(points,cx,cy,x,y) { + var xa = 0; + var ya = 0; + var n = 20; + var fromX = points[points.length - 2]; + var fromY = points[points.length - 1]; + var px = 0; + var py = 0; + var tmp = 0; + var _g1 = 1; + var _g = n + 1; + while(_g1 < _g) { + var i = _g1++; + tmp = i / n; + xa = fromX + (cx - fromX) * tmp; + ya = fromY + (cy - fromY) * tmp; + px = xa + (cx + (x - cx) * tmp - xa) * tmp; + py = ya + (cy + (y - cy) * tmp - ya) * tmp; + points.push(px); + points.push(py); + } +}; +openfl__$internal_renderer_GraphicsPaths.roundRectangle = function(points,x,y,width,height,rx,ry) { + var xe = x + width; + var ye = y + height; + var cx1 = -rx + rx * openfl__$internal_renderer_GraphicsPaths.SIN45; + var cx2 = -rx + rx * openfl__$internal_renderer_GraphicsPaths.TAN22; + var cy1 = -ry + ry * openfl__$internal_renderer_GraphicsPaths.SIN45; + var cy2 = -ry + ry * openfl__$internal_renderer_GraphicsPaths.TAN22; + points.push(xe); + points.push(ye - ry); + openfl__$internal_renderer_GraphicsPaths.curveTo(points,xe,ye + cy2,xe + cx1,ye + cy1); + openfl__$internal_renderer_GraphicsPaths.curveTo(points,xe + cx2,ye,xe - rx,ye); + points.push(x + rx); + points.push(ye); + openfl__$internal_renderer_GraphicsPaths.curveTo(points,x - cx2,ye,x - cx1,ye + cy1); + openfl__$internal_renderer_GraphicsPaths.curveTo(points,x,ye + cy2,x,ye - ry); + points.push(x); + points.push(y + ry); + openfl__$internal_renderer_GraphicsPaths.curveTo(points,x,y - cy2,x - cx1,y - cy1); + openfl__$internal_renderer_GraphicsPaths.curveTo(points,x - cx2,y,x + rx,y); + points.push(xe - rx); + points.push(y); + openfl__$internal_renderer_GraphicsPaths.curveTo(points,xe + cx2,y,xe + cx1,y - cy1); + openfl__$internal_renderer_GraphicsPaths.curveTo(points,xe,y - cy2,xe,y + ry); + points.push(xe); + points.push(ye - ry); +}; +var openfl__$internal_renderer_PolyK = function() { }; +$hxClasses["openfl._internal.renderer.PolyK"] = openfl__$internal_renderer_PolyK; +openfl__$internal_renderer_PolyK.__name__ = ["openfl","_internal","renderer","PolyK"]; +openfl__$internal_renderer_PolyK.triangulate = function(tgs,p) { + var sign = true; + var n = p.length >> 1; + if(n < 3) { + return []; + } + var _g = []; + var _g2 = 0; + var _g1 = n; + while(_g2 < _g1) { + var i = _g2++; + _g.push(i); + } + var avl = _g; + var i1 = 0; + var al = n; + var earFound = false; + while(al > 3) { + var i0 = avl[i1 % al]; + var i11 = avl[(i1 + 1) % al]; + var i2 = avl[(i1 + 2) % al]; + var ax = p[2 * i0]; + var ay = p[2 * i0 + 1]; + var bx = p[2 * i11]; + var by = p[2 * i11 + 1]; + var cx = p[2 * i2]; + var cy = p[2 * i2 + 1]; + earFound = false; + if(openfl__$internal_renderer_PolyK._convex(ax,ay,bx,by,cx,cy,sign)) { + earFound = true; + var _g21 = 0; + var _g11 = al; + while(_g21 < _g11) { + var j = _g21++; + var vi = avl[j]; + if(vi == i0 || vi == i11 || vi == i2) { + continue; + } + if(openfl__$internal_renderer_PolyK._PointInTriangle(p[2 * vi],p[2 * vi + 1],ax,ay,bx,by,cx,cy)) { + earFound = false; + break; + } + } + } + if(earFound) { + tgs.push(i0); + tgs.push(i11); + tgs.push(i2); + avl.splice((i1 + 1) % al,1); + --al; + i1 = 0; + } else if(i1++ > 3 * al) { + if(sign) { + tgs = []; + var _g12 = []; + var _g3 = 0; + var _g22 = n; + while(_g3 < _g22) { + var k = _g3++; + _g12.push(k); + } + avl = _g12; + i1 = 0; + al = n; + sign = false; + } else { + haxe_Log.trace("Warning: shape too complex to fill",{ fileName : "PolyK.hx", lineNumber : 104, className : "openfl._internal.renderer.PolyK", methodName : "triangulate"}); + return []; + } + } + } + tgs.push(avl[0]); + tgs.push(avl[1]); + tgs.push(avl[2]); + return tgs; +}; +openfl__$internal_renderer_PolyK._PointInTriangle = function(px,py,ax,ay,bx,by,cx,cy) { + var v0x = Std["int"](cx - ax); + var v0y = Std["int"](cy - ay); + var v1x = Std["int"](bx - ax); + var v1y = Std["int"](by - ay); + var v2x = Std["int"](px - ax); + var v2y = Std["int"](py - ay); + var dot00 = v0x * v0x + v0y * v0y; + var dot01 = v0x * v1x + v0y * v1y; + var dot02 = v0x * v2x + v0y * v2y; + var dot11 = v1x * v1x + v1y * v1y; + var dot12 = v1x * v2x + v1y * v2y; + var invDenom = 1 / (dot00 * dot11 - dot01 * dot01); + var u = (dot11 * dot02 - dot01 * dot12) * invDenom; + var v = (dot00 * dot12 - dot01 * dot02) * invDenom; + if(u >= 0 && v >= 0) { + return u + v < 1; + } else { + return false; + } +}; +openfl__$internal_renderer_PolyK._convex = function(ax,ay,bx,by,cx,cy,sign) { + return (ay - by) * (cx - bx) + (bx - ax) * (cy - by) >= 0 == sign; +}; +var openfl__$internal_renderer_RenderSession = function() { + this.activeTextures = 0; +}; +$hxClasses["openfl._internal.renderer.RenderSession"] = openfl__$internal_renderer_RenderSession; +openfl__$internal_renderer_RenderSession.__name__ = ["openfl","_internal","renderer","RenderSession"]; +openfl__$internal_renderer_RenderSession.prototype = { + cairo: null + ,context: null + ,gl: null + ,renderer: null + ,roundPixels: null + ,projectionMatrix: null + ,drawCount: null + ,currentBlendMode: null + ,activeTextures: null + ,shaderManager: null + ,maskManager: null + ,filterManager: null + ,blendModeManager: null + ,spriteBatch: null + ,stencilManager: null + ,defaultFramebuffer: null + ,__class__: openfl__$internal_renderer_RenderSession +}; +var openfl__$internal_renderer_cairo_CairoBitmap = function() { }; +$hxClasses["openfl._internal.renderer.cairo.CairoBitmap"] = openfl__$internal_renderer_cairo_CairoBitmap; +openfl__$internal_renderer_cairo_CairoBitmap.__name__ = ["openfl","_internal","renderer","cairo","CairoBitmap"]; +openfl__$internal_renderer_cairo_CairoBitmap.render = function(bitmap,renderSession) { + if(!bitmap.__renderable || bitmap.__worldAlpha <= 0) { + return; + } + var cairo = renderSession.cairo; + if(bitmap.bitmapData != null && bitmap.bitmapData.__isValid) { + if(bitmap.__mask != null) { + renderSession.maskManager.pushMask(bitmap.__mask); + } + var transform = bitmap.__renderTransform; + var scrollRect = bitmap.get_scrollRect(); + if(renderSession.roundPixels) { + var matrix = transform.__toMatrix3(); + matrix.tx = Math.round(matrix.tx); + matrix.ty = Math.round(matrix.ty); + cairo.set_matrix(matrix); + } else { + cairo.set_matrix(transform.__toMatrix3()); + } + var surface = bitmap.bitmapData.getSurface(); + if(surface != null) { + var pattern = lime_graphics_cairo__$CairoPattern_CairoPattern_$Impl_$.createForSurface(surface); + lime_graphics_cairo__$CairoPattern_CairoPattern_$Impl_$.set_filter(pattern,bitmap.smoothing ? 1 : 3); + if(scrollRect != null) { + cairo.pushGroup(); + cairo.set_source(pattern); + cairo.newPath(); + cairo.rectangle(scrollRect.x,scrollRect.y,scrollRect.width,scrollRect.height); + cairo.fill(); + cairo.popGroupToSource(); + } else { + cairo.set_source(pattern); + } + if(bitmap.__worldAlpha == 1) { + cairo.paint(); + } else { + cairo.paintWithAlpha(bitmap.__worldAlpha); + } + } + if(bitmap.__mask != null) { + renderSession.maskManager.popMask(); + } + } +}; +var openfl__$internal_renderer_cairo_CairoGraphics = function() { }; +$hxClasses["openfl._internal.renderer.cairo.CairoGraphics"] = openfl__$internal_renderer_cairo_CairoGraphics; +openfl__$internal_renderer_cairo_CairoGraphics.__name__ = ["openfl","_internal","renderer","cairo","CairoGraphics"]; +openfl__$internal_renderer_cairo_CairoGraphics.cairo = null; +openfl__$internal_renderer_cairo_CairoGraphics.drawRoundRect = function(x,y,width,height,ellipseWidth,ellipseHeight) { + if(ellipseHeight == null) { + ellipseHeight = ellipseWidth; + } + ellipseWidth *= 0.5; + ellipseHeight *= 0.5; + if(ellipseWidth > width / 2) { + ellipseWidth = width / 2; + } + if(ellipseHeight > height / 2) { + ellipseHeight = height / 2; + } + var xe = x + width; + var ye = y + height; + var cx1 = -ellipseWidth + ellipseWidth * openfl__$internal_renderer_cairo_CairoGraphics.SIN45; + var cx2 = -ellipseWidth + ellipseWidth * openfl__$internal_renderer_cairo_CairoGraphics.TAN22; + var cy1 = -ellipseHeight + ellipseHeight * openfl__$internal_renderer_cairo_CairoGraphics.SIN45; + var cy2 = -ellipseHeight + ellipseHeight * openfl__$internal_renderer_cairo_CairoGraphics.TAN22; + openfl__$internal_renderer_cairo_CairoGraphics.cairo.moveTo(xe,ye - ellipseHeight); + openfl__$internal_renderer_cairo_CairoGraphics.quadraticCurveTo(xe,ye + cy2,xe + cx1,ye + cy1); + openfl__$internal_renderer_cairo_CairoGraphics.quadraticCurveTo(xe + cx2,ye,xe - ellipseWidth,ye); + openfl__$internal_renderer_cairo_CairoGraphics.cairo.lineTo(x + ellipseWidth,ye); + openfl__$internal_renderer_cairo_CairoGraphics.quadraticCurveTo(x - cx2,ye,x - cx1,ye + cy1); + openfl__$internal_renderer_cairo_CairoGraphics.quadraticCurveTo(x,ye + cy2,x,ye - ellipseHeight); + openfl__$internal_renderer_cairo_CairoGraphics.cairo.lineTo(x,y + ellipseHeight); + openfl__$internal_renderer_cairo_CairoGraphics.quadraticCurveTo(x,y - cy2,x - cx1,y - cy1); + openfl__$internal_renderer_cairo_CairoGraphics.quadraticCurveTo(x - cx2,y,x + ellipseWidth,y); + openfl__$internal_renderer_cairo_CairoGraphics.cairo.lineTo(xe - ellipseWidth,y); + openfl__$internal_renderer_cairo_CairoGraphics.quadraticCurveTo(xe + cx2,y,xe + cx1,y - cy1); + openfl__$internal_renderer_cairo_CairoGraphics.quadraticCurveTo(xe,y - cy2,xe,y + ellipseHeight); + openfl__$internal_renderer_cairo_CairoGraphics.cairo.lineTo(xe,ye - ellipseHeight); +}; +openfl__$internal_renderer_cairo_CairoGraphics.quadraticCurveTo = function(cx,cy,x,y) { + var current = null; + if(!openfl__$internal_renderer_cairo_CairoGraphics.cairo.get_hasCurrentPoint()) { + openfl__$internal_renderer_cairo_CairoGraphics.cairo.moveTo(cx,cy); + current = new lime_math_Vector2(cx,cy); + } else { + current = openfl__$internal_renderer_cairo_CairoGraphics.cairo.get_currentPoint(); + } + var cx1 = current.x + 0.66666666666666663 * (cx - current.x); + var cy1 = current.y + 0.66666666666666663 * (cy - current.y); + var cx2 = x + 0.66666666666666663 * (cx - x); + var cy2 = y + 0.66666666666666663 * (cy - y); + openfl__$internal_renderer_cairo_CairoGraphics.cairo.curveTo(cx1,cy1,cx2,cy2,x,y); +}; +openfl__$internal_renderer_cairo_CairoGraphics.renderMask = function(graphics,renderSession) { + if(graphics.__commands.get_length() != 0) { + var cairo = renderSession.cairo; + var positionX = 0.0; + var positionY = 0.0; + var offsetX = 0; + var offsetY = 0; + var data = new openfl__$internal_renderer_DrawCommandReader(graphics.__commands); + var _g = 0; + var _g1 = graphics.__commands.types; + while(_g < _g1.length) { + var type = _g1[_g]; + ++_g; + switch(Type.enumIndex(type)) { + case 3: + var c = data.readCubicCurveTo(); + cairo.curveTo(openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlX1(c) - offsetX,openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlY1(c) - offsetY,openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlX2(c) - offsetX,openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlY2(c) - offsetY,openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_anchorX(c) - offsetX,openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_anchorY(c) - offsetY); + positionX = openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_anchorX(c); + positionY = openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_anchorX(c); + break; + case 4: + var c1 = data.readCurveTo(); + openfl__$internal_renderer_cairo_CairoGraphics.quadraticCurveTo(openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_controlX(c1) - offsetX,openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_controlY(c1) - offsetY,openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_anchorX(c1) - offsetX,openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_anchorY(c1) - offsetY); + positionX = openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_anchorX(c1); + positionY = openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_anchorY(c1); + break; + case 5: + var c2 = data.readDrawCircle(); + cairo.arc(openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_x(c2) - offsetX,openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_y(c2) - offsetY,openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_radius(c2),0,Math.PI * 2); + break; + case 6: + var c3 = data.readDrawEllipse(); + var x = openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_x(c3); + var y = openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_y(c3); + var width = openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_width(c3); + var height = openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_height(c3); + x -= offsetX; + y -= offsetY; + var kappa = .5522848; + var ox = width / 2 * kappa; + var oy = height / 2 * kappa; + var xe = x + width; + var ye = y + height; + var xm = x + width / 2; + var ym = y + height / 2; + cairo.moveTo(x,ym); + cairo.curveTo(x,ym - oy,xm - ox,y,xm,y); + cairo.curveTo(xm + ox,y,xe,ym - oy,xe,ym); + cairo.curveTo(xe,ym + oy,xm + ox,ye,xm,ye); + cairo.curveTo(xm - ox,ye,x,ym + oy,x,ym); + break; + case 8: + var c4 = data.readDrawRect(); + cairo.rectangle(openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_x(c4) - offsetX,openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_y(c4) - offsetY,openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_width(c4),openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_height(c4)); + break; + case 9: + var c5 = data.readDrawRoundRect(); + openfl__$internal_renderer_cairo_CairoGraphics.drawRoundRect(openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_x(c5) - offsetX,openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_y(c5) - offsetY,openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_width(c5),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_height(c5),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_ellipseWidth(c5),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_ellipseHeight(c5)); + break; + case 16: + var c6 = data.readLineTo(); + cairo.lineTo(openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.get_x(c6) - offsetX,openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.get_y(c6) - offsetY); + positionX = openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.get_x(c6); + positionY = openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.get_y(c6); + break; + case 17: + var c7 = data.readMoveTo(); + cairo.moveTo(openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_x(c7) - offsetX,openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_y(c7) - offsetY); + positionX = openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_x(c7); + positionY = openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_y(c7); + break; + default: + data.skip(type); + } + } + data.destroy(); + } +}; +var openfl__$internal_renderer_cairo_CairoMaskManager = function(renderSession) { + openfl__$internal_renderer_AbstractMaskManager.call(this,renderSession); +}; +$hxClasses["openfl._internal.renderer.cairo.CairoMaskManager"] = openfl__$internal_renderer_cairo_CairoMaskManager; +openfl__$internal_renderer_cairo_CairoMaskManager.__name__ = ["openfl","_internal","renderer","cairo","CairoMaskManager"]; +openfl__$internal_renderer_cairo_CairoMaskManager.__super__ = openfl__$internal_renderer_AbstractMaskManager; +openfl__$internal_renderer_cairo_CairoMaskManager.prototype = $extend(openfl__$internal_renderer_AbstractMaskManager.prototype,{ + pushMask: function(mask) { + var cairo = this.renderSession.cairo; + cairo.save(); + var transform = mask.__getWorldTransform(); + cairo.set_matrix(transform.__toMatrix3()); + cairo.newPath(); + mask.__renderCairoMask(this.renderSession); + cairo.clip(); + } + ,pushRect: function(rect,transform) { + var cairo = this.renderSession.cairo; + cairo.save(); + cairo.set_matrix(new lime_math_Matrix3(transform.a,transform.c,transform.b,transform.d,transform.tx,transform.ty)); + cairo.newPath(); + cairo.rectangle(rect.x,rect.y,rect.width,rect.height); + cairo.clip(); + } + ,popMask: function() { + this.renderSession.cairo.restore(); + } + ,popRect: function() { + this.renderSession.cairo.restore(); + } + ,__class__: openfl__$internal_renderer_cairo_CairoMaskManager +}); +var openfl__$internal_renderer_cairo_CairoRenderer = function() { }; +$hxClasses["openfl._internal.renderer.cairo.CairoRenderer"] = openfl__$internal_renderer_cairo_CairoRenderer; +openfl__$internal_renderer_cairo_CairoRenderer.__name__ = ["openfl","_internal","renderer","cairo","CairoRenderer"]; +openfl__$internal_renderer_cairo_CairoRenderer.__super__ = openfl__$internal_renderer_AbstractRenderer; +openfl__$internal_renderer_cairo_CairoRenderer.prototype = $extend(openfl__$internal_renderer_AbstractRenderer.prototype,{ + cairo: null + ,render: function(stage) { + this.cairo.identityMatrix(); + if(stage.__clearBeforeRender) { + this.cairo.setSourceRGB(stage.__colorSplit[0],stage.__colorSplit[1],stage.__colorSplit[2]); + this.cairo.paint(); + } + stage.__renderCairo(this.renderSession); + } + ,__class__: openfl__$internal_renderer_cairo_CairoRenderer +}); +var openfl__$internal_renderer_cairo_CairoShape = function() { }; +$hxClasses["openfl._internal.renderer.cairo.CairoShape"] = openfl__$internal_renderer_cairo_CairoShape; +openfl__$internal_renderer_cairo_CairoShape.__name__ = ["openfl","_internal","renderer","cairo","CairoShape"]; +openfl__$internal_renderer_cairo_CairoShape.render = function(shape,renderSession) { +}; +var openfl__$internal_renderer_canvas_CanvasBitmap = function() { }; +$hxClasses["openfl._internal.renderer.canvas.CanvasBitmap"] = openfl__$internal_renderer_canvas_CanvasBitmap; +openfl__$internal_renderer_canvas_CanvasBitmap.__name__ = ["openfl","_internal","renderer","canvas","CanvasBitmap"]; +openfl__$internal_renderer_canvas_CanvasBitmap.render = function(bitmap,renderSession) { + if(!bitmap.__renderable || bitmap.__worldAlpha <= 0) { + return; + } + var context = renderSession.context; + if(bitmap.bitmapData != null && bitmap.bitmapData.__isValid) { + if(bitmap.__mask != null) { + renderSession.maskManager.pushMask(bitmap.__mask); + } + bitmap.bitmapData.__sync(); + context.globalAlpha = bitmap.__worldAlpha; + var transform = bitmap.__renderTransform; + var scrollRect = bitmap.get_scrollRect(); + if(renderSession.roundPixels) { + context.setTransform(transform.a,transform.b,transform.c,transform.d,Std["int"](transform.tx),Std["int"](transform.ty)); + } else { + context.setTransform(transform.a,transform.b,transform.c,transform.d,transform.tx,transform.ty); + } + if(!bitmap.smoothing) { + context.mozImageSmoothingEnabled = false; + context.msImageSmoothingEnabled = false; + context.imageSmoothingEnabled = false; + } + if(scrollRect == null) { + context.drawImage(bitmap.bitmapData.image.get_src(),0,0); + } else { + context.drawImage(bitmap.bitmapData.image.get_src(),scrollRect.x,scrollRect.y,scrollRect.width,scrollRect.height,scrollRect.x,scrollRect.y,scrollRect.width,scrollRect.height); + } + if(!bitmap.smoothing) { + context.mozImageSmoothingEnabled = true; + context.msImageSmoothingEnabled = true; + context.imageSmoothingEnabled = true; + } + if(bitmap.__mask != null) { + renderSession.maskManager.popMask(); + } + } +}; +var openfl__$internal_renderer_canvas_CanvasGraphics = function() { }; +$hxClasses["openfl._internal.renderer.canvas.CanvasGraphics"] = openfl__$internal_renderer_canvas_CanvasGraphics; +openfl__$internal_renderer_canvas_CanvasGraphics.__name__ = ["openfl","_internal","renderer","canvas","CanvasGraphics"]; +openfl__$internal_renderer_canvas_CanvasGraphics.bitmapFill = null; +openfl__$internal_renderer_canvas_CanvasGraphics.bitmapRepeat = null; +openfl__$internal_renderer_canvas_CanvasGraphics.bounds = null; +openfl__$internal_renderer_canvas_CanvasGraphics.graphics = null; +openfl__$internal_renderer_canvas_CanvasGraphics.hasFill = null; +openfl__$internal_renderer_canvas_CanvasGraphics.hasStroke = null; +openfl__$internal_renderer_canvas_CanvasGraphics.hitTesting = null; +openfl__$internal_renderer_canvas_CanvasGraphics.inversePendingMatrix = null; +openfl__$internal_renderer_canvas_CanvasGraphics.pendingMatrix = null; +openfl__$internal_renderer_canvas_CanvasGraphics.context = null; +openfl__$internal_renderer_canvas_CanvasGraphics.closePath = function() { + if(openfl__$internal_renderer_canvas_CanvasGraphics.context.strokeStyle == null) { + return; + } + openfl__$internal_renderer_canvas_CanvasGraphics.context.closePath(); + openfl__$internal_renderer_canvas_CanvasGraphics.context.stroke(); + openfl__$internal_renderer_canvas_CanvasGraphics.context.beginPath(); +}; +openfl__$internal_renderer_canvas_CanvasGraphics.createBitmapFill = function(bitmap,bitmapRepeat) { + bitmap.__sync(); + return openfl__$internal_renderer_canvas_CanvasGraphics.context.createPattern(bitmap.image.get_src(),bitmapRepeat ? "repeat" : "no-repeat"); +}; +openfl__$internal_renderer_canvas_CanvasGraphics.createGradientPattern = function(type,colors,alphas,ratios,matrix,spreadMethod,interpolationMethod,focalPointRatio) { + var gradientFill = null; + switch(type) { + case 0: + var matrix1 = matrix != null ? matrix : new openfl_geom_Matrix(); + var point1 = matrix1.transformPoint(new openfl_geom_Point(-819.2,0)); + var point2 = matrix1.transformPoint(new openfl_geom_Point(819.2,0)); + gradientFill = openfl__$internal_renderer_canvas_CanvasGraphics.context.createLinearGradient(point1.x,point1.y,point2.x,point2.y); + break; + case 1: + if(matrix == null) { + matrix = new openfl_geom_Matrix(); + } + var point = matrix.transformPoint(new openfl_geom_Point(1638.4,0)); + gradientFill = openfl__$internal_renderer_canvas_CanvasGraphics.context.createRadialGradient(matrix.tx,matrix.ty,0,matrix.tx,matrix.ty,(point.x - matrix.tx) / 2); + break; + } + var _g1 = 0; + var _g = colors.length; + while(_g1 < _g) { + var i = _g1++; + var rgb = colors[i]; + var alpha = alphas[i]; + var r = (rgb & 16711680) >>> 16; + var g = (rgb & 65280) >>> 8; + var b = rgb & 255; + var ratio = ratios[i] / 255; + if(ratio < 0) { + ratio = 0; + } + if(ratio > 1) { + ratio = 1; + } + gradientFill.addColorStop(ratio,"rgba(" + r + ", " + g + ", " + b + ", " + alpha + ")"); + } + return gradientFill; +}; +openfl__$internal_renderer_canvas_CanvasGraphics.createTempPatternCanvas = function(bitmap,repeat,width,height) { + var canvas = js_Browser.get_document().createElement("canvas"); + var context = canvas.getContext("2d"); + canvas.width = width; + canvas.height = height; + var tmp = bitmap.image.get_src(); + context.fillStyle = context.createPattern(tmp,repeat ? "repeat" : "no-repeat"); + context.beginPath(); + context.moveTo(0,0); + context.lineTo(0,height); + context.lineTo(width,height); + context.lineTo(width,0); + context.lineTo(0,0); + context.closePath(); + if(!openfl__$internal_renderer_canvas_CanvasGraphics.hitTesting) { + context.fill(); + } + return canvas; +}; +openfl__$internal_renderer_canvas_CanvasGraphics.drawRoundRect = function(x,y,width,height,ellipseWidth,ellipseHeight) { + if(ellipseHeight == null) { + ellipseHeight = ellipseWidth; + } + ellipseWidth *= 0.5; + ellipseHeight *= 0.5; + if(ellipseWidth > width / 2) { + ellipseWidth = width / 2; + } + if(ellipseHeight > height / 2) { + ellipseHeight = height / 2; + } + var xe = x + width; + var ye = y + height; + var cx1 = -ellipseWidth + ellipseWidth * openfl__$internal_renderer_canvas_CanvasGraphics.SIN45; + var cx2 = -ellipseWidth + ellipseWidth * openfl__$internal_renderer_canvas_CanvasGraphics.TAN22; + var cy1 = -ellipseHeight + ellipseHeight * openfl__$internal_renderer_canvas_CanvasGraphics.SIN45; + var cy2 = -ellipseHeight + ellipseHeight * openfl__$internal_renderer_canvas_CanvasGraphics.TAN22; + openfl__$internal_renderer_canvas_CanvasGraphics.context.moveTo(xe,ye - ellipseHeight); + openfl__$internal_renderer_canvas_CanvasGraphics.context.quadraticCurveTo(xe,ye + cy2,xe + cx1,ye + cy1); + openfl__$internal_renderer_canvas_CanvasGraphics.context.quadraticCurveTo(xe + cx2,ye,xe - ellipseWidth,ye); + openfl__$internal_renderer_canvas_CanvasGraphics.context.lineTo(x + ellipseWidth,ye); + openfl__$internal_renderer_canvas_CanvasGraphics.context.quadraticCurveTo(x - cx2,ye,x - cx1,ye + cy1); + openfl__$internal_renderer_canvas_CanvasGraphics.context.quadraticCurveTo(x,ye + cy2,x,ye - ellipseHeight); + openfl__$internal_renderer_canvas_CanvasGraphics.context.lineTo(x,y + ellipseHeight); + openfl__$internal_renderer_canvas_CanvasGraphics.context.quadraticCurveTo(x,y - cy2,x - cx1,y - cy1); + openfl__$internal_renderer_canvas_CanvasGraphics.context.quadraticCurveTo(x - cx2,y,x + ellipseWidth,y); + openfl__$internal_renderer_canvas_CanvasGraphics.context.lineTo(xe - ellipseWidth,y); + openfl__$internal_renderer_canvas_CanvasGraphics.context.quadraticCurveTo(xe + cx2,y,xe + cx1,y - cy1); + openfl__$internal_renderer_canvas_CanvasGraphics.context.quadraticCurveTo(xe,y - cy2,xe,y + ellipseHeight); + openfl__$internal_renderer_canvas_CanvasGraphics.context.lineTo(xe,ye - ellipseHeight); +}; +openfl__$internal_renderer_canvas_CanvasGraphics.endFill = function() { + openfl__$internal_renderer_canvas_CanvasGraphics.context.beginPath(); + openfl__$internal_renderer_canvas_CanvasGraphics.playCommands(openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands,false); + openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands.clear(); +}; +openfl__$internal_renderer_canvas_CanvasGraphics.endStroke = function() { + openfl__$internal_renderer_canvas_CanvasGraphics.context.beginPath(); + openfl__$internal_renderer_canvas_CanvasGraphics.playCommands(openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands,true); + openfl__$internal_renderer_canvas_CanvasGraphics.context.closePath(); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.clear(); +}; +openfl__$internal_renderer_canvas_CanvasGraphics.hitTest = function(graphics,x,y) { + if(graphics.__commands.get_length() == 0 || openfl__$internal_renderer_canvas_CanvasGraphics.bounds == null || openfl__$internal_renderer_canvas_CanvasGraphics.bounds.width <= 0 || openfl__$internal_renderer_canvas_CanvasGraphics.bounds.height <= 0) { + return false; + } else { + openfl__$internal_renderer_canvas_CanvasGraphics.hitTesting = true; + x -= openfl__$internal_renderer_canvas_CanvasGraphics.bounds.x; + y -= openfl__$internal_renderer_canvas_CanvasGraphics.bounds.y; + if(graphics.__canvas == null) { + graphics.__canvas = js_Browser.get_document().createElement("canvas"); + graphics.__context = graphics.__canvas.getContext("2d"); + } + openfl__$internal_renderer_canvas_CanvasGraphics.context = graphics.__context; + openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands.clear(); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.clear(); + openfl__$internal_renderer_canvas_CanvasGraphics.hasFill = false; + openfl__$internal_renderer_canvas_CanvasGraphics.hasStroke = false; + openfl__$internal_renderer_canvas_CanvasGraphics.bitmapFill = null; + openfl__$internal_renderer_canvas_CanvasGraphics.bitmapRepeat = false; + openfl__$internal_renderer_canvas_CanvasGraphics.context.beginPath(); + var data = new openfl__$internal_renderer_DrawCommandReader(graphics.__commands); + var _g = 0; + var _g1 = graphics.__commands.types; + while(_g < _g1.length) { + var type = _g1[_g]; + ++_g; + switch(Type.enumIndex(type)) { + case 0:case 1:case 2: + openfl__$internal_renderer_canvas_CanvasGraphics.endFill(); + openfl__$internal_renderer_canvas_CanvasGraphics.endStroke(); + if(openfl__$internal_renderer_canvas_CanvasGraphics.hasFill && openfl__$internal_renderer_canvas_CanvasGraphics.context.isPointInPath(x,y)) { + data.destroy(); + return true; + } + if(openfl__$internal_renderer_canvas_CanvasGraphics.hasStroke && openfl__$internal_renderer_canvas_CanvasGraphics.context.isPointInStroke(x,y)) { + data.destroy(); + return true; + } + if(type == openfl__$internal_renderer_DrawCommandType.BEGIN_BITMAP_FILL) { + var c = data.readBeginBitmapFill(); + openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands.beginBitmapFill(openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_bitmap(c),openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_matrix(c),openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_repeat(c),openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_smooth(c)); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.beginBitmapFill(openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_bitmap(c),openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_matrix(c),openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_repeat(c),openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_smooth(c)); + } else if(type == openfl__$internal_renderer_DrawCommandType.BEGIN_GRADIENT_FILL) { + var c1 = data.readBeginGradientFill(); + openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands.beginGradientFill(openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_type(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_colors(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_alphas(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_ratios(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_matrix(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_spreadMethod(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_interpolationMethod(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_focalPointRatio(c1)); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.beginGradientFill(openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_type(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_colors(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_alphas(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_ratios(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_matrix(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_spreadMethod(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_interpolationMethod(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_focalPointRatio(c1)); + } else { + var c2 = data.readBeginFill(); + openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands.beginFill(openfl__$internal_renderer__$DrawCommandReader_BeginFillView_$Impl_$.get_color(c2),1); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.beginFill(openfl__$internal_renderer__$DrawCommandReader_BeginFillView_$Impl_$.get_color(c2),1); + } + break; + case 3: + var c3 = data.readCubicCurveTo(); + openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands.cubicCurveTo(openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlX1(c3),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlY1(c3),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlX2(c3),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlY2(c3),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_anchorX(c3),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_anchorY(c3)); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.cubicCurveTo(openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlX1(c3),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlY1(c3),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlX2(c3),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlY2(c3),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_anchorX(c3),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_anchorY(c3)); + break; + case 4: + var c4 = data.readCurveTo(); + openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands.curveTo(openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_controlX(c4),openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_controlY(c4),openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_anchorX(c4),openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_anchorY(c4)); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.curveTo(openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_controlX(c4),openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_controlY(c4),openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_anchorX(c4),openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_anchorY(c4)); + break; + case 5: + var c5 = data.readDrawCircle(); + openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands.drawCircle(openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_x(c5),openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_y(c5),openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_radius(c5)); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.drawCircle(openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_x(c5),openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_y(c5),openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_radius(c5)); + break; + case 6: + var c6 = data.readDrawEllipse(); + openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands.drawEllipse(openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_x(c6),openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_y(c6),openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_width(c6),openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_height(c6)); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.drawEllipse(openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_x(c6),openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_y(c6),openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_width(c6),openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_height(c6)); + break; + case 8: + var c7 = data.readDrawRect(); + openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands.drawRect(openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_x(c7),openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_y(c7),openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_width(c7),openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_height(c7)); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.drawRect(openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_x(c7),openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_y(c7),openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_width(c7),openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_height(c7)); + break; + case 9: + var c8 = data.readDrawRoundRect(); + openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands.drawRoundRect(openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_x(c8),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_y(c8),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_width(c8),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_height(c8),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_ellipseWidth(c8),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_ellipseHeight(c8)); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.drawRoundRect(openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_x(c8),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_y(c8),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_width(c8),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_height(c8),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_ellipseWidth(c8),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_ellipseHeight(c8)); + break; + case 12: + data.readEndFill(); + openfl__$internal_renderer_canvas_CanvasGraphics.endFill(); + openfl__$internal_renderer_canvas_CanvasGraphics.endStroke(); + if(openfl__$internal_renderer_canvas_CanvasGraphics.hasFill && openfl__$internal_renderer_canvas_CanvasGraphics.context.isPointInPath(x,y)) { + data.destroy(); + return true; + } + if(openfl__$internal_renderer_canvas_CanvasGraphics.hasStroke && openfl__$internal_renderer_canvas_CanvasGraphics.context.isPointInStroke(x,y)) { + data.destroy(); + return true; + } + openfl__$internal_renderer_canvas_CanvasGraphics.hasFill = false; + openfl__$internal_renderer_canvas_CanvasGraphics.bitmapFill = null; + break; + case 13: + var c9 = data.readLineBitmapStyle(); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.lineBitmapStyle(openfl__$internal_renderer__$DrawCommandReader_LineBitmapStyleView_$Impl_$.get_bitmap(c9),openfl__$internal_renderer__$DrawCommandReader_LineBitmapStyleView_$Impl_$.get_matrix(c9),openfl__$internal_renderer__$DrawCommandReader_LineBitmapStyleView_$Impl_$.get_repeat(c9),openfl__$internal_renderer__$DrawCommandReader_LineBitmapStyleView_$Impl_$.get_smooth(c9)); + break; + case 14: + var c10 = data.readLineGradientStyle(); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.lineGradientStyle(openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_type(c10),openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_colors(c10),openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_alphas(c10),openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_ratios(c10),openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_matrix(c10),openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_spreadMethod(c10),openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_interpolationMethod(c10),openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_focalPointRatio(c10)); + break; + case 15: + var c11 = data.readLineStyle(); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.lineStyle(openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_thickness(c11),openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_color(c11),1,openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_pixelHinting(c11),openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_scaleMode(c11),openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_caps(c11),openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_joints(c11),openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_miterLimit(c11)); + break; + case 16: + var c12 = data.readLineTo(); + openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands.lineTo(openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.get_x(c12),openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.get_y(c12)); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.lineTo(openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.get_x(c12),openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.get_y(c12)); + break; + case 17: + var c13 = data.readMoveTo(); + openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands.moveTo(openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_x(c13),openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_y(c13)); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.moveTo(openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_x(c13),openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_y(c13)); + break; + default: + data.skip(type); + } + } + if(openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands.get_length() > 0) { + openfl__$internal_renderer_canvas_CanvasGraphics.endFill(); + } + if(openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.get_length() > 0) { + openfl__$internal_renderer_canvas_CanvasGraphics.endStroke(); + } + data.destroy(); + if(openfl__$internal_renderer_canvas_CanvasGraphics.hasFill && openfl__$internal_renderer_canvas_CanvasGraphics.context.isPointInPath(x,y)) { + return true; + } + if(openfl__$internal_renderer_canvas_CanvasGraphics.hasStroke && openfl__$internal_renderer_canvas_CanvasGraphics.context.isPointInStroke(x,y)) { + return true; + } + } + return false; +}; +openfl__$internal_renderer_canvas_CanvasGraphics.isCCW = function(x1,y1,x2,y2,x3,y3) { + return (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1) < 0; +}; +openfl__$internal_renderer_canvas_CanvasGraphics.normalizeUVT = function(uvt,skipT) { + if(skipT == null) { + skipT = false; + } + var max = -Infinity; + var tmp = -Infinity; + var len = uvt.length; + var _g1 = 1; + var _g = len + 1; + while(_g1 < _g) { + var t = _g1++; + if(skipT && t % 3 == 0) { + continue; + } + tmp = uvt.data[t - 1]; + if(max < tmp) { + max = tmp; + } + } + var this1 = new openfl_VectorData(); + var this2 = new Array(0); + this1.data = this2; + this1.length = 0; + this1.fixed = false; + var result = this1; + var _g11 = 1; + var _g2 = len + 1; + while(_g11 < _g2) { + var t1 = _g11++; + if(skipT && t1 % 3 == 0) { + continue; + } + var x = uvt.data[t1 - 1] / max; + if(!result.fixed) { + result.length++; + if(result.data.length < result.length) { + var length = result.data.length + 10; + var this3 = new Array(length); + var data = this3; + haxe_ds__$Vector_Vector_$Impl_$.blit(result.data,0,data,0,result.data.length); + result.data = data; + } + result.data[result.length - 1] = x; + } + } + return { max : max, uvt : result}; +}; +openfl__$internal_renderer_canvas_CanvasGraphics.playCommands = function(commands,stroke) { + if(stroke == null) { + stroke = false; + } + openfl__$internal_renderer_canvas_CanvasGraphics.bounds = openfl__$internal_renderer_canvas_CanvasGraphics.graphics.__bounds; + var offsetX = openfl__$internal_renderer_canvas_CanvasGraphics.bounds.x; + var offsetY = openfl__$internal_renderer_canvas_CanvasGraphics.bounds.y; + var positionX = 0.0; + var positionY = 0.0; + var closeGap = false; + var startX = 0.0; + var startY = 0.0; + var data = new openfl__$internal_renderer_DrawCommandReader(commands); + var _g = 0; + var _g1 = commands.types; + while(_g < _g1.length) { + var type = _g1[_g]; + ++_g; + switch(Type.enumIndex(type)) { + case 0: + var c = data.readBeginBitmapFill(); + var tmp = openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_bitmap(c); + openfl__$internal_renderer_canvas_CanvasGraphics.context.fillStyle = openfl__$internal_renderer_canvas_CanvasGraphics.createBitmapFill(tmp,true); + openfl__$internal_renderer_canvas_CanvasGraphics.hasFill = true; + if(openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_matrix(c) != null) { + openfl__$internal_renderer_canvas_CanvasGraphics.pendingMatrix = openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_matrix(c); + openfl__$internal_renderer_canvas_CanvasGraphics.inversePendingMatrix = openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_matrix(c).clone(); + openfl__$internal_renderer_canvas_CanvasGraphics.inversePendingMatrix.invert(); + } else { + openfl__$internal_renderer_canvas_CanvasGraphics.pendingMatrix = null; + openfl__$internal_renderer_canvas_CanvasGraphics.inversePendingMatrix = null; + } + break; + case 1: + var c1 = data.readBeginFill(); + if(openfl__$internal_renderer__$DrawCommandReader_BeginFillView_$Impl_$.get_alpha(c1) < 0.005) { + openfl__$internal_renderer_canvas_CanvasGraphics.hasFill = false; + } else { + if(openfl__$internal_renderer__$DrawCommandReader_BeginFillView_$Impl_$.get_alpha(c1) == 1) { + var tmp1 = StringTools.hex(openfl__$internal_renderer__$DrawCommandReader_BeginFillView_$Impl_$.get_color(c1),6); + openfl__$internal_renderer_canvas_CanvasGraphics.context.fillStyle = "#" + tmp1; + } else { + var r = (openfl__$internal_renderer__$DrawCommandReader_BeginFillView_$Impl_$.get_color(c1) & 16711680) >>> 16; + var g = (openfl__$internal_renderer__$DrawCommandReader_BeginFillView_$Impl_$.get_color(c1) & 65280) >>> 8; + var b = openfl__$internal_renderer__$DrawCommandReader_BeginFillView_$Impl_$.get_color(c1) & 255; + var tmp2 = "rgba(" + r + ", " + g + ", " + b + ", " + openfl__$internal_renderer__$DrawCommandReader_BeginFillView_$Impl_$.get_alpha(c1); + openfl__$internal_renderer_canvas_CanvasGraphics.context.fillStyle = tmp2 + ")"; + } + openfl__$internal_renderer_canvas_CanvasGraphics.bitmapFill = null; + openfl__$internal_renderer_canvas_CanvasGraphics.hasFill = true; + } + break; + case 2: + var c2 = data.readBeginGradientFill(); + var tmp3 = openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_type(c2); + var tmp4 = openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_colors(c2); + var tmp5 = openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_alphas(c2); + var tmp6 = openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_ratios(c2); + var tmp7 = openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_matrix(c2); + var tmp8 = openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_spreadMethod(c2); + var tmp9 = openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_interpolationMethod(c2); + var tmp10 = openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_focalPointRatio(c2); + openfl__$internal_renderer_canvas_CanvasGraphics.context.fillStyle = openfl__$internal_renderer_canvas_CanvasGraphics.createGradientPattern(tmp3,tmp4,tmp5,tmp6,tmp7,tmp8,tmp9,tmp10); + openfl__$internal_renderer_canvas_CanvasGraphics.bitmapFill = null; + openfl__$internal_renderer_canvas_CanvasGraphics.hasFill = true; + break; + case 3: + var c3 = data.readCubicCurveTo(); + openfl__$internal_renderer_canvas_CanvasGraphics.context.bezierCurveTo(openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlX1(c3) - offsetX,openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlY1(c3) - offsetY,openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlX2(c3) - offsetX,openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlY2(c3) - offsetY,openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_anchorX(c3) - offsetX,openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_anchorY(c3) - offsetY); + break; + case 4: + var c4 = data.readCurveTo(); + openfl__$internal_renderer_canvas_CanvasGraphics.context.quadraticCurveTo(openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_controlX(c4) - offsetX,openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_controlY(c4) - offsetY,openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_anchorX(c4) - offsetX,openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_anchorY(c4) - offsetY); + break; + case 5: + var c5 = data.readDrawCircle(); + openfl__$internal_renderer_canvas_CanvasGraphics.context.moveTo(openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_x(c5) - offsetX + openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_radius(c5),openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_y(c5) - offsetY); + openfl__$internal_renderer_canvas_CanvasGraphics.context.arc(openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_x(c5) - offsetX,openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_y(c5) - offsetY,openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_radius(c5),0,Math.PI * 2,true); + break; + case 6: + var c6 = data.readDrawEllipse(); + var x = openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_x(c6); + var y = openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_y(c6); + var width = openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_width(c6); + var height = openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_height(c6); + x -= offsetX; + y -= offsetY; + var kappa = .5522848; + var ox = width / 2 * kappa; + var oy = height / 2 * kappa; + var xe = x + width; + var ye = y + height; + var xm = x + width / 2; + var ym = y + height / 2; + openfl__$internal_renderer_canvas_CanvasGraphics.context.moveTo(x,ym); + openfl__$internal_renderer_canvas_CanvasGraphics.context.bezierCurveTo(x,ym - oy,xm - ox,y,xm,y); + openfl__$internal_renderer_canvas_CanvasGraphics.context.bezierCurveTo(xm + ox,y,xe,ym - oy,xe,ym); + openfl__$internal_renderer_canvas_CanvasGraphics.context.bezierCurveTo(xe,ym + oy,xm + ox,ye,xm,ye); + openfl__$internal_renderer_canvas_CanvasGraphics.context.bezierCurveTo(xm - ox,ye,x,ym + oy,x,ym); + break; + case 8: + var c7 = data.readDrawRect(); + var optimizationUsed = false; + if(openfl__$internal_renderer_canvas_CanvasGraphics.bitmapFill != null) { + var st = 0; + var sr = 0; + var sb = 0; + var sl = 0; + var canOptimizeMatrix = true; + if(openfl__$internal_renderer_canvas_CanvasGraphics.pendingMatrix != null) { + if(openfl__$internal_renderer_canvas_CanvasGraphics.pendingMatrix.b != 0 || openfl__$internal_renderer_canvas_CanvasGraphics.pendingMatrix.c != 0) { + canOptimizeMatrix = false; + } else { + var stl = openfl__$internal_renderer_canvas_CanvasGraphics.inversePendingMatrix.transformPoint(new openfl_geom_Point(openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_x(c7),openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_y(c7))); + var sbr = openfl__$internal_renderer_canvas_CanvasGraphics.inversePendingMatrix.transformPoint(new openfl_geom_Point(openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_x(c7) + openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_width(c7),openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_y(c7) + openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_height(c7))); + st = stl.y; + sl = stl.x; + sb = sbr.y; + sr = sbr.x; + } + } else { + st = openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_y(c7); + sl = openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_x(c7); + sb = openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_y(c7) + openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_height(c7); + sr = openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_x(c7) + openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_width(c7); + } + if(canOptimizeMatrix && st >= 0 && sl >= 0 && sr <= openfl__$internal_renderer_canvas_CanvasGraphics.bitmapFill.width && sb <= openfl__$internal_renderer_canvas_CanvasGraphics.bitmapFill.height) { + optimizationUsed = true; + if(!openfl__$internal_renderer_canvas_CanvasGraphics.hitTesting) { + openfl__$internal_renderer_canvas_CanvasGraphics.context.drawImage(openfl__$internal_renderer_canvas_CanvasGraphics.bitmapFill.image.get_src(),sl,st,sr - sl,sb - st,openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_x(c7) - offsetX,openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_y(c7) - offsetY,openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_width(c7),openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_height(c7)); + } + } + } + if(!optimizationUsed) { + openfl__$internal_renderer_canvas_CanvasGraphics.context.rect(openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_x(c7) - offsetX,openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_y(c7) - offsetY,openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_width(c7),openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_height(c7)); + } + break; + case 9: + var c8 = data.readDrawRoundRect(); + openfl__$internal_renderer_canvas_CanvasGraphics.drawRoundRect(openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_x(c8) - offsetX,openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_y(c8) - offsetY,openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_width(c8),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_height(c8),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_ellipseWidth(c8),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_ellipseHeight(c8)); + break; + case 13: + var c9 = data.readLineBitmapStyle(); + if(stroke && openfl__$internal_renderer_canvas_CanvasGraphics.hasStroke) { + openfl__$internal_renderer_canvas_CanvasGraphics.closePath(); + } + openfl__$internal_renderer_canvas_CanvasGraphics.context.moveTo(positionX - offsetX,positionY - offsetY); + var tmp11 = openfl__$internal_renderer__$DrawCommandReader_LineBitmapStyleView_$Impl_$.get_bitmap(c9); + var tmp12 = openfl__$internal_renderer__$DrawCommandReader_LineBitmapStyleView_$Impl_$.get_repeat(c9); + openfl__$internal_renderer_canvas_CanvasGraphics.context.strokeStyle = openfl__$internal_renderer_canvas_CanvasGraphics.createBitmapFill(tmp11,tmp12); + openfl__$internal_renderer_canvas_CanvasGraphics.hasStroke = true; + break; + case 14: + var c10 = data.readLineGradientStyle(); + if(stroke && openfl__$internal_renderer_canvas_CanvasGraphics.hasStroke) { + openfl__$internal_renderer_canvas_CanvasGraphics.closePath(); + } + openfl__$internal_renderer_canvas_CanvasGraphics.context.moveTo(positionX - offsetX,positionY - offsetY); + var tmp13 = openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_type(c10); + var tmp14 = openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_colors(c10); + var tmp15 = openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_alphas(c10); + var tmp16 = openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_ratios(c10); + var tmp17 = openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_matrix(c10); + var tmp18 = openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_spreadMethod(c10); + var tmp19 = openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_interpolationMethod(c10); + var tmp20 = openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_focalPointRatio(c10); + openfl__$internal_renderer_canvas_CanvasGraphics.context.strokeStyle = openfl__$internal_renderer_canvas_CanvasGraphics.createGradientPattern(tmp13,tmp14,tmp15,tmp16,tmp17,tmp18,tmp19,tmp20); + openfl__$internal_renderer_canvas_CanvasGraphics.hasStroke = true; + break; + case 15: + var c11 = data.readLineStyle(); + if(stroke && openfl__$internal_renderer_canvas_CanvasGraphics.hasStroke) { + openfl__$internal_renderer_canvas_CanvasGraphics.context.closePath(); + if(!openfl__$internal_renderer_canvas_CanvasGraphics.hitTesting) { + openfl__$internal_renderer_canvas_CanvasGraphics.context.stroke(); + } + openfl__$internal_renderer_canvas_CanvasGraphics.context.beginPath(); + } + openfl__$internal_renderer_canvas_CanvasGraphics.context.moveTo(positionX - offsetX,positionY - offsetY); + if(openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_thickness(c11) == null) { + openfl__$internal_renderer_canvas_CanvasGraphics.hasStroke = false; + } else { + var tmp21 = openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_thickness(c11) > 0 ? openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_thickness(c11) : 1; + openfl__$internal_renderer_canvas_CanvasGraphics.context.lineWidth = tmp21; + var tmp22 = openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_joints(c11) == null ? "round" : openfl_display__$JointStyle_JointStyle_$Impl_$.toString(openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_joints(c11)).toLowerCase(); + openfl__$internal_renderer_canvas_CanvasGraphics.context.lineJoin = tmp22; + var tmp23; + if(openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_caps(c11) == null) { + tmp23 = "round"; + } else { + var _g2 = openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_caps(c11); + if(_g2 == 0) { + tmp23 = "butt"; + } else { + tmp23 = openfl_display__$CapsStyle_CapsStyle_$Impl_$.toString(openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_caps(c11)).toLowerCase(); + } + } + openfl__$internal_renderer_canvas_CanvasGraphics.context.lineCap = tmp23; + openfl__$internal_renderer_canvas_CanvasGraphics.context.miterLimit = openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_miterLimit(c11); + if(openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_alpha(c11) == 1) { + var tmp24 = StringTools.hex(openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_color(c11) & 16777215,6); + openfl__$internal_renderer_canvas_CanvasGraphics.context.strokeStyle = "#" + tmp24; + } else { + var r1 = (openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_color(c11) & 16711680) >>> 16; + var g1 = (openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_color(c11) & 65280) >>> 8; + var b1 = openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_color(c11) & 255; + var tmp25 = "rgba(" + r1 + ", " + g1 + ", " + b1 + ", " + openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_alpha(c11); + openfl__$internal_renderer_canvas_CanvasGraphics.context.strokeStyle = tmp25 + ")"; + } + openfl__$internal_renderer_canvas_CanvasGraphics.hasStroke = true; + } + break; + case 16: + var c12 = data.readLineTo(); + openfl__$internal_renderer_canvas_CanvasGraphics.context.lineTo(openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.get_x(c12) - offsetX,openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.get_y(c12) - offsetY); + positionX = openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.get_x(c12); + positionY = openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.get_y(c12); + break; + case 17: + var c13 = data.readMoveTo(); + openfl__$internal_renderer_canvas_CanvasGraphics.context.moveTo(openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_x(c13) - offsetX,openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_y(c13) - offsetY); + positionX = openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_x(c13); + positionY = openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_y(c13); + closeGap = true; + startX = openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_x(c13); + startY = openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_y(c13); + break; + default: + data.skip(type); + } + } + data.destroy(); + if(stroke && openfl__$internal_renderer_canvas_CanvasGraphics.hasStroke) { + if(openfl__$internal_renderer_canvas_CanvasGraphics.hasFill && closeGap) { + openfl__$internal_renderer_canvas_CanvasGraphics.context.lineTo(startX - offsetX,startY - offsetY); + } else if(closeGap && positionX == startX && positionY == startY) { + openfl__$internal_renderer_canvas_CanvasGraphics.context.closePath(); + } + if(!openfl__$internal_renderer_canvas_CanvasGraphics.hitTesting) { + openfl__$internal_renderer_canvas_CanvasGraphics.context.stroke(); + } + } + if(!stroke) { + if(openfl__$internal_renderer_canvas_CanvasGraphics.hasFill || openfl__$internal_renderer_canvas_CanvasGraphics.bitmapFill != null) { + openfl__$internal_renderer_canvas_CanvasGraphics.context.translate(-openfl__$internal_renderer_canvas_CanvasGraphics.bounds.x,-openfl__$internal_renderer_canvas_CanvasGraphics.bounds.y); + if(openfl__$internal_renderer_canvas_CanvasGraphics.pendingMatrix != null) { + openfl__$internal_renderer_canvas_CanvasGraphics.context.transform(openfl__$internal_renderer_canvas_CanvasGraphics.pendingMatrix.a,openfl__$internal_renderer_canvas_CanvasGraphics.pendingMatrix.b,openfl__$internal_renderer_canvas_CanvasGraphics.pendingMatrix.c,openfl__$internal_renderer_canvas_CanvasGraphics.pendingMatrix.d,openfl__$internal_renderer_canvas_CanvasGraphics.pendingMatrix.tx,openfl__$internal_renderer_canvas_CanvasGraphics.pendingMatrix.ty); + if(!openfl__$internal_renderer_canvas_CanvasGraphics.hitTesting) { + openfl__$internal_renderer_canvas_CanvasGraphics.context.fill(); + } + openfl__$internal_renderer_canvas_CanvasGraphics.context.transform(openfl__$internal_renderer_canvas_CanvasGraphics.inversePendingMatrix.a,openfl__$internal_renderer_canvas_CanvasGraphics.inversePendingMatrix.b,openfl__$internal_renderer_canvas_CanvasGraphics.inversePendingMatrix.c,openfl__$internal_renderer_canvas_CanvasGraphics.inversePendingMatrix.d,openfl__$internal_renderer_canvas_CanvasGraphics.inversePendingMatrix.tx,openfl__$internal_renderer_canvas_CanvasGraphics.inversePendingMatrix.ty); + } else if(!openfl__$internal_renderer_canvas_CanvasGraphics.hitTesting) { + openfl__$internal_renderer_canvas_CanvasGraphics.context.fill(); + } + openfl__$internal_renderer_canvas_CanvasGraphics.context.translate(openfl__$internal_renderer_canvas_CanvasGraphics.bounds.x,openfl__$internal_renderer_canvas_CanvasGraphics.bounds.y); + openfl__$internal_renderer_canvas_CanvasGraphics.context.closePath(); + } + } +}; +openfl__$internal_renderer_canvas_CanvasGraphics.render = function(graphics,renderSession) { + var directRender = false; + if(graphics.__dirty || directRender) { + openfl__$internal_renderer_canvas_CanvasGraphics.hitTesting = false; + openfl__$internal_renderer_canvas_CanvasGraphics.graphics = graphics; + openfl__$internal_renderer_canvas_CanvasGraphics.bounds = graphics.__bounds; + if(!graphics.__visible || graphics.__commands.get_length() == 0 || openfl__$internal_renderer_canvas_CanvasGraphics.bounds == null || openfl__$internal_renderer_canvas_CanvasGraphics.bounds.width <= 0 || openfl__$internal_renderer_canvas_CanvasGraphics.bounds.height <= 0) { + graphics.__canvas = null; + graphics.__context = null; + graphics.__bitmap = null; + } else { + if(directRender) { + openfl__$internal_renderer_canvas_CanvasGraphics.context = renderSession.context; + openfl__$internal_renderer_canvas_CanvasGraphics.bounds.setTo(0,0,openfl__$internal_renderer_canvas_CanvasGraphics.context.canvas.width,openfl__$internal_renderer_canvas_CanvasGraphics.context.canvas.width); + } else { + if(graphics.__canvas == null) { + graphics.__canvas = js_Browser.get_document().createElement("canvas"); + graphics.__context = graphics.__canvas.getContext("2d"); + } + openfl__$internal_renderer_canvas_CanvasGraphics.context = graphics.__context; + graphics.__canvas.width = Math.ceil(openfl__$internal_renderer_canvas_CanvasGraphics.bounds.width); + graphics.__canvas.height = Math.ceil(openfl__$internal_renderer_canvas_CanvasGraphics.bounds.height); + } + openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands.clear(); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.clear(); + openfl__$internal_renderer_canvas_CanvasGraphics.hasFill = false; + openfl__$internal_renderer_canvas_CanvasGraphics.hasStroke = false; + openfl__$internal_renderer_canvas_CanvasGraphics.bitmapFill = null; + openfl__$internal_renderer_canvas_CanvasGraphics.bitmapRepeat = false; + var data = new openfl__$internal_renderer_DrawCommandReader(graphics.__commands); + var _g = 0; + var _g1 = graphics.__commands.types; + try { + while(_g < _g1.length) { + var type = _g1[_g]; + ++_g; + switch(Type.enumIndex(type)) { + case 0:case 1:case 2: + openfl__$internal_renderer_canvas_CanvasGraphics.endFill(); + openfl__$internal_renderer_canvas_CanvasGraphics.endStroke(); + if(type == openfl__$internal_renderer_DrawCommandType.BEGIN_BITMAP_FILL) { + var c = data.readBeginBitmapFill(); + openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands.beginBitmapFill(openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_bitmap(c),openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_matrix(c),openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_repeat(c),openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_smooth(c)); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.beginBitmapFill(openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_bitmap(c),openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_matrix(c),openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_repeat(c),openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_smooth(c)); + } else if(type == openfl__$internal_renderer_DrawCommandType.BEGIN_GRADIENT_FILL) { + var c1 = data.readBeginGradientFill(); + openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands.beginGradientFill(openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_type(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_colors(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_alphas(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_ratios(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_matrix(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_spreadMethod(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_interpolationMethod(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_focalPointRatio(c1)); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.beginGradientFill(openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_type(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_colors(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_alphas(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_ratios(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_matrix(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_spreadMethod(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_interpolationMethod(c1),openfl__$internal_renderer__$DrawCommandReader_BeginGradientFillView_$Impl_$.get_focalPointRatio(c1)); + } else { + var c2 = data.readBeginFill(); + openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands.beginFill(openfl__$internal_renderer__$DrawCommandReader_BeginFillView_$Impl_$.get_color(c2),openfl__$internal_renderer__$DrawCommandReader_BeginFillView_$Impl_$.get_alpha(c2)); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.beginFill(openfl__$internal_renderer__$DrawCommandReader_BeginFillView_$Impl_$.get_color(c2),openfl__$internal_renderer__$DrawCommandReader_BeginFillView_$Impl_$.get_alpha(c2)); + } + break; + case 3: + var c3 = data.readCubicCurveTo(); + openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands.cubicCurveTo(openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlX1(c3),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlY1(c3),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlX2(c3),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlY2(c3),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_anchorX(c3),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_anchorY(c3)); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.cubicCurveTo(openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlX1(c3),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlY1(c3),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlX2(c3),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlY2(c3),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_anchorX(c3),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_anchorY(c3)); + break; + case 4: + var c4 = data.readCurveTo(); + openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands.curveTo(openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_controlX(c4),openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_controlY(c4),openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_anchorX(c4),openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_anchorY(c4)); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.curveTo(openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_controlX(c4),openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_controlY(c4),openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_anchorX(c4),openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_anchorY(c4)); + break; + case 5: + var c5 = data.readDrawCircle(); + openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands.drawCircle(openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_x(c5),openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_y(c5),openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_radius(c5)); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.drawCircle(openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_x(c5),openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_y(c5),openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_radius(c5)); + break; + case 6: + var c6 = data.readDrawEllipse(); + openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands.drawEllipse(openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_x(c6),openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_y(c6),openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_width(c6),openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_height(c6)); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.drawEllipse(openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_x(c6),openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_y(c6),openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_width(c6),openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_height(c6)); + break; + case 8: + var c7 = data.readDrawRect(); + openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands.drawRect(openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_x(c7),openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_y(c7),openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_width(c7),openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_height(c7)); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.drawRect(openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_x(c7),openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_y(c7),openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_width(c7),openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_height(c7)); + break; + case 9: + var c8 = data.readDrawRoundRect(); + openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands.drawRoundRect(openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_x(c8),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_y(c8),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_width(c8),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_height(c8),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_ellipseWidth(c8),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_ellipseHeight(c8)); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.drawRoundRect(openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_x(c8),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_y(c8),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_width(c8),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_height(c8),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_ellipseWidth(c8),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_ellipseHeight(c8)); + break; + case 10: + var c9 = data.readDrawTiles(); + var useScale = (openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_flags(c9) & 1) > 0; + var offsetX = openfl__$internal_renderer_canvas_CanvasGraphics.bounds.x; + var offsetY = openfl__$internal_renderer_canvas_CanvasGraphics.bounds.y; + var useRotation = (openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_flags(c9) & 2) > 0; + var useTransform = (openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_flags(c9) & 16) > 0; + var useRGB = (openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_flags(c9) & 4) > 0; + var useAlpha = (openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_flags(c9) & 8) > 0; + var useRect = (openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_flags(c9) & 32) > 0; + var useOrigin = (openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_flags(c9) & 64) > 0; + var useBlendAdd = (openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_flags(c9) & 65536) > 0; + if(useTransform) { + useScale = false; + useRotation = false; + } + var scaleIndex = 0; + var rotationIndex = 0; + var rgbIndex = 0; + var alphaIndex = 0; + var transformIndex = 0; + var numValues = 3; + if(useRect) { + if(useOrigin) { + numValues = 8; + } else { + numValues = 6; + } + } + if(useScale) { + scaleIndex = numValues; + ++numValues; + } + if(useRotation) { + rotationIndex = numValues; + ++numValues; + } + if(useTransform) { + transformIndex = numValues; + numValues += 4; + } + if(useRGB) { + rgbIndex = numValues; + numValues += 3; + } + if(useAlpha) { + alphaIndex = numValues; + ++numValues; + } + var totalCount = openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_tileData(c9).length; + if(openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_count(c9) >= 0 && totalCount > openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_count(c9)) { + totalCount = openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_count(c9); + } + var itemCount = Std["int"](totalCount / numValues); + var index = 0; + var rect = null; + var center = null; + var previousTileID = -1; + var surface; + openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_sheet(c9).__bitmap.__sync(); + surface = openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_sheet(c9).__bitmap.image.get_src(); + if(useBlendAdd) { + openfl__$internal_renderer_canvas_CanvasGraphics.context.globalCompositeOperation = "lighter"; + } + while(index < totalCount) { + var tileID = !useRect ? Std["int"](openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_tileData(c9)[index + 2]) : -1; + if(!useRect && tileID != previousTileID) { + rect = openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_sheet(c9).__tileRects[tileID]; + center = openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_sheet(c9).__centerPoints[tileID]; + previousTileID = tileID; + } else if(useRect) { + rect = openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_sheet(c9).__rectTile; + rect.setTo(openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_tileData(c9)[index + 2],openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_tileData(c9)[index + 3],openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_tileData(c9)[index + 4],openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_tileData(c9)[index + 5]); + center = openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_sheet(c9).__point; + if(useOrigin) { + center.setTo(openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_tileData(c9)[index + 6],openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_tileData(c9)[index + 7]); + } else { + center.setTo(0,0); + } + } + if(rect != null && rect.width > 0 && rect.height > 0 && center != null) { + openfl__$internal_renderer_canvas_CanvasGraphics.context.save(); + openfl__$internal_renderer_canvas_CanvasGraphics.context.translate(openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_tileData(c9)[index] - offsetX,openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_tileData(c9)[index + 1] - offsetY); + if(useRotation) { + openfl__$internal_renderer_canvas_CanvasGraphics.context.rotate(openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_tileData(c9)[index + rotationIndex]); + } + var scale = 1.0; + if(useScale) { + scale = openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_tileData(c9)[index + scaleIndex]; + } + if(useTransform) { + openfl__$internal_renderer_canvas_CanvasGraphics.context.transform(openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_tileData(c9)[index + transformIndex],openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_tileData(c9)[index + transformIndex + 1],openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_tileData(c9)[index + transformIndex + 2],openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_tileData(c9)[index + transformIndex + 3],0,0); + } + if(useAlpha) { + var tmp = openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_tileData(c9); + openfl__$internal_renderer_canvas_CanvasGraphics.context.globalAlpha = tmp[index + alphaIndex]; + } + openfl__$internal_renderer_canvas_CanvasGraphics.context.imageSmoothingEnabled = openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_smooth(c9); + openfl__$internal_renderer_canvas_CanvasGraphics.context.drawImage(surface,rect.x,rect.y,rect.width,rect.height,-center.x * scale,-center.y * scale,rect.width * scale,rect.height * scale); + openfl__$internal_renderer_canvas_CanvasGraphics.context.restore(); + } + index += numValues; + } + if(useBlendAdd) { + openfl__$internal_renderer_canvas_CanvasGraphics.context.globalCompositeOperation = "source-over"; + } + break; + case 11: + openfl__$internal_renderer_canvas_CanvasGraphics.endFill(); + openfl__$internal_renderer_canvas_CanvasGraphics.endStroke(); + var c10 = data.readDrawTriangles(); + var v = openfl__$internal_renderer__$DrawCommandReader_DrawTrianglesView_$Impl_$.get_vertices(c10); + var ind = openfl__$internal_renderer__$DrawCommandReader_DrawTrianglesView_$Impl_$.get_indices(c10); + var uvt = openfl__$internal_renderer__$DrawCommandReader_DrawTrianglesView_$Impl_$.get_uvtData(c10); + var pattern = null; + var colorFill = openfl__$internal_renderer_canvas_CanvasGraphics.bitmapFill == null; + if(colorFill && uvt != null) { + throw "__break__"; + } + if(!colorFill) { + if(uvt == null) { + var this1 = new openfl_VectorData(); + var this2 = new Array(0); + this1.data = this2; + this1.length = 0; + this1.fixed = false; + uvt = this1; + var _g3 = 0; + var _g2 = Std["int"](v.length / 2); + while(_g3 < _g2) { + var i = _g3++; + var x = v.data[i * 2] / openfl__$internal_renderer_canvas_CanvasGraphics.bitmapFill.width; + if(!uvt.fixed) { + uvt.length++; + if(uvt.data.length < uvt.length) { + var length = uvt.data.length + 10; + var this3 = new Array(length); + var data1 = this3; + haxe_ds__$Vector_Vector_$Impl_$.blit(uvt.data,0,data1,0,uvt.data.length); + uvt.data = data1; + } + uvt.data[uvt.length - 1] = x; + } + var x1 = v.data[i * 2 + 1] / openfl__$internal_renderer_canvas_CanvasGraphics.bitmapFill.height; + if(!uvt.fixed) { + uvt.length++; + if(uvt.data.length < uvt.length) { + var length1 = uvt.data.length + 10; + var this4 = new Array(length1); + var data2 = this4; + haxe_ds__$Vector_Vector_$Impl_$.blit(uvt.data,0,data2,0,uvt.data.length); + uvt.data = data2; + } + uvt.data[uvt.length - 1] = x1; + } + } + } + var skipT = uvt.length != v.length; + var normalizedUVT = openfl__$internal_renderer_canvas_CanvasGraphics.normalizeUVT(uvt,skipT); + var maxUVT = normalizedUVT.max; + uvt = normalizedUVT.uvt; + if(maxUVT > 1) { + pattern = openfl__$internal_renderer_canvas_CanvasGraphics.createTempPatternCanvas(openfl__$internal_renderer_canvas_CanvasGraphics.bitmapFill,openfl__$internal_renderer_canvas_CanvasGraphics.bitmapRepeat,Std["int"](openfl__$internal_renderer_canvas_CanvasGraphics.bounds.width),Std["int"](openfl__$internal_renderer_canvas_CanvasGraphics.bounds.height)); + } else { + pattern = openfl__$internal_renderer_canvas_CanvasGraphics.createTempPatternCanvas(openfl__$internal_renderer_canvas_CanvasGraphics.bitmapFill,openfl__$internal_renderer_canvas_CanvasGraphics.bitmapRepeat,openfl__$internal_renderer_canvas_CanvasGraphics.bitmapFill.width,openfl__$internal_renderer_canvas_CanvasGraphics.bitmapFill.height); + } + } + var i1 = 0; + var l = ind.length; + var a_; + var b_; + var c_; + var iax; + var iay; + var ibx; + var iby; + var icx; + var icy; + var x11; + var y1; + var x2; + var y2; + var x3; + var y3; + var uvx1; + var uvy1; + var uvx2; + var uvy2; + var uvx3; + var uvy3; + var denom; + var t1; + var t2; + var t3; + var t4; + var dx; + var dy; + while(i1 < l) { + a_ = i1; + b_ = i1 + 1; + c_ = i1 + 2; + iax = ind.data[a_] * 2; + iay = ind.data[a_] * 2 + 1; + ibx = ind.data[b_] * 2; + iby = ind.data[b_] * 2 + 1; + icx = ind.data[c_] * 2; + icy = ind.data[c_] * 2 + 1; + x11 = v.data[iax]; + y1 = v.data[iay]; + x2 = v.data[ibx]; + y2 = v.data[iby]; + x3 = v.data[icx]; + y3 = v.data[icy]; + var _g21 = openfl__$internal_renderer__$DrawCommandReader_DrawTrianglesView_$Impl_$.get_culling(c10); + switch(_g21) { + case 0: + if(openfl__$internal_renderer_canvas_CanvasGraphics.isCCW(x11,y1,x2,y2,x3,y3)) { + i1 += 3; + continue; + } + break; + case 2: + if(!openfl__$internal_renderer_canvas_CanvasGraphics.isCCW(x11,y1,x2,y2,x3,y3)) { + i1 += 3; + continue; + } + break; + default: + } + if(colorFill) { + openfl__$internal_renderer_canvas_CanvasGraphics.context.beginPath(); + openfl__$internal_renderer_canvas_CanvasGraphics.context.moveTo(x11,y1); + openfl__$internal_renderer_canvas_CanvasGraphics.context.lineTo(x2,y2); + openfl__$internal_renderer_canvas_CanvasGraphics.context.lineTo(x3,y3); + openfl__$internal_renderer_canvas_CanvasGraphics.context.closePath(); + if(!openfl__$internal_renderer_canvas_CanvasGraphics.hitTesting) { + openfl__$internal_renderer_canvas_CanvasGraphics.context.fill(); + } + i1 += 3; + continue; + } + openfl__$internal_renderer_canvas_CanvasGraphics.context.save(); + openfl__$internal_renderer_canvas_CanvasGraphics.context.beginPath(); + openfl__$internal_renderer_canvas_CanvasGraphics.context.moveTo(x11,y1); + openfl__$internal_renderer_canvas_CanvasGraphics.context.lineTo(x2,y2); + openfl__$internal_renderer_canvas_CanvasGraphics.context.lineTo(x3,y3); + openfl__$internal_renderer_canvas_CanvasGraphics.context.closePath(); + openfl__$internal_renderer_canvas_CanvasGraphics.context.clip(); + uvx1 = uvt.data[iax] * pattern.width; + uvx2 = uvt.data[ibx] * pattern.width; + uvx3 = uvt.data[icx] * pattern.width; + uvy1 = uvt.data[iay] * pattern.height; + uvy2 = uvt.data[iby] * pattern.height; + uvy3 = uvt.data[icy] * pattern.height; + denom = uvx1 * (uvy3 - uvy2) - uvx2 * uvy3 + uvx3 * uvy2 + (uvx2 - uvx3) * uvy1; + if(denom == 0) { + i1 += 3; + continue; + } + t1 = -(uvy1 * (x3 - x2) - uvy2 * x3 + uvy3 * x2 + (uvy2 - uvy3) * x11) / denom; + t2 = (uvy2 * y3 + uvy1 * (y2 - y3) - uvy3 * y2 + (uvy3 - uvy2) * y1) / denom; + t3 = (uvx1 * (x3 - x2) - uvx2 * x3 + uvx3 * x2 + (uvx2 - uvx3) * x11) / denom; + t4 = -(uvx2 * y3 + uvx1 * (y2 - y3) - uvx3 * y2 + (uvx3 - uvx2) * y1) / denom; + dx = (uvx1 * (uvy3 * x2 - uvy2 * x3) + uvy1 * (uvx2 * x3 - uvx3 * x2) + (uvx3 * uvy2 - uvx2 * uvy3) * x11) / denom; + dy = (uvx1 * (uvy3 * y2 - uvy2 * y3) + uvy1 * (uvx2 * y3 - uvx3 * y2) + (uvx3 * uvy2 - uvx2 * uvy3) * y1) / denom; + openfl__$internal_renderer_canvas_CanvasGraphics.context.transform(t1,t2,t3,t4,dx,dy); + openfl__$internal_renderer_canvas_CanvasGraphics.context.drawImage(pattern,0,0); + openfl__$internal_renderer_canvas_CanvasGraphics.context.restore(); + i1 += 3; + } + break; + case 12: + data.readEndFill(); + openfl__$internal_renderer_canvas_CanvasGraphics.endFill(); + openfl__$internal_renderer_canvas_CanvasGraphics.endStroke(); + openfl__$internal_renderer_canvas_CanvasGraphics.hasFill = false; + openfl__$internal_renderer_canvas_CanvasGraphics.bitmapFill = null; + break; + case 13: + var c11 = data.readLineBitmapStyle(); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.lineBitmapStyle(openfl__$internal_renderer__$DrawCommandReader_LineBitmapStyleView_$Impl_$.get_bitmap(c11),openfl__$internal_renderer__$DrawCommandReader_LineBitmapStyleView_$Impl_$.get_matrix(c11),openfl__$internal_renderer__$DrawCommandReader_LineBitmapStyleView_$Impl_$.get_repeat(c11),openfl__$internal_renderer__$DrawCommandReader_LineBitmapStyleView_$Impl_$.get_smooth(c11)); + break; + case 14: + var c12 = data.readLineGradientStyle(); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.lineGradientStyle(openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_type(c12),openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_colors(c12),openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_alphas(c12),openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_ratios(c12),openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_matrix(c12),openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_spreadMethod(c12),openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_interpolationMethod(c12),openfl__$internal_renderer__$DrawCommandReader_LineGradientStyleView_$Impl_$.get_focalPointRatio(c12)); + break; + case 15: + var c13 = data.readLineStyle(); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.lineStyle(openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_thickness(c13),openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_color(c13),openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_alpha(c13),openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_pixelHinting(c13),openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_scaleMode(c13),openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_caps(c13),openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_joints(c13),openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_miterLimit(c13)); + break; + case 16: + var c14 = data.readLineTo(); + openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands.lineTo(openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.get_x(c14),openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.get_y(c14)); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.lineTo(openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.get_x(c14),openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.get_y(c14)); + break; + case 17: + var c15 = data.readMoveTo(); + openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands.moveTo(openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_x(c15),openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_y(c15)); + openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.moveTo(openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_x(c15),openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_y(c15)); + break; + default: + data.skip(type); + } + } + } catch( e ) { if( e != "__break__" ) throw e; } + if(openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands.get_length() > 0) { + openfl__$internal_renderer_canvas_CanvasGraphics.endFill(); + } + if(openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands.get_length() > 0) { + openfl__$internal_renderer_canvas_CanvasGraphics.endStroke(); + } + data.destroy(); + graphics.__bitmap = openfl_display_BitmapData.fromCanvas(graphics.__canvas); + } + graphics.set___dirty(false); + } +}; +openfl__$internal_renderer_canvas_CanvasGraphics.renderMask = function(graphics,renderSession) { + if(graphics.__commands.get_length() != 0) { + openfl__$internal_renderer_canvas_CanvasGraphics.context = renderSession.context; + var positionX = 0.0; + var positionY = 0.0; + var offsetX = 0; + var offsetY = 0; + var data = new openfl__$internal_renderer_DrawCommandReader(graphics.__commands); + var _g = 0; + var _g1 = graphics.__commands.types; + while(_g < _g1.length) { + var type = _g1[_g]; + ++_g; + switch(Type.enumIndex(type)) { + case 3: + var c = data.readCubicCurveTo(); + openfl__$internal_renderer_canvas_CanvasGraphics.context.bezierCurveTo(openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlX1(c) - offsetX,openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlY1(c) - offsetY,openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlX2(c) - offsetX,openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlY2(c) - offsetY,openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_anchorX(c) - offsetX,openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_anchorY(c) - offsetY); + positionX = openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_anchorX(c); + positionY = openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_anchorY(c); + break; + case 4: + var c1 = data.readCurveTo(); + openfl__$internal_renderer_canvas_CanvasGraphics.context.quadraticCurveTo(openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_controlX(c1) - offsetX,openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_controlY(c1) - offsetY,openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_anchorX(c1) - offsetX,openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_anchorY(c1) - offsetY); + positionX = openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_anchorX(c1); + positionY = openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_anchorY(c1); + break; + case 5: + var c2 = data.readDrawCircle(); + openfl__$internal_renderer_canvas_CanvasGraphics.context.arc(openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_x(c2) - offsetX,openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_y(c2) - offsetY,openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_radius(c2),0,Math.PI * 2,true); + break; + case 6: + var c3 = data.readDrawEllipse(); + var x = openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_x(c3); + var y = openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_y(c3); + var width = openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_width(c3); + var height = openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_height(c3); + x -= offsetX; + y -= offsetY; + var kappa = .5522848; + var ox = width / 2 * kappa; + var oy = height / 2 * kappa; + var xe = x + width; + var ye = y + height; + var xm = x + width / 2; + var ym = y + height / 2; + openfl__$internal_renderer_canvas_CanvasGraphics.context.moveTo(x,ym); + openfl__$internal_renderer_canvas_CanvasGraphics.context.bezierCurveTo(x,ym - oy,xm - ox,y,xm,y); + openfl__$internal_renderer_canvas_CanvasGraphics.context.bezierCurveTo(xm + ox,y,xe,ym - oy,xe,ym); + openfl__$internal_renderer_canvas_CanvasGraphics.context.bezierCurveTo(xe,ym + oy,xm + ox,ye,xm,ye); + openfl__$internal_renderer_canvas_CanvasGraphics.context.bezierCurveTo(xm - ox,ye,x,ym + oy,x,ym); + break; + case 8: + var c4 = data.readDrawRect(); + openfl__$internal_renderer_canvas_CanvasGraphics.context.rect(openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_x(c4) - offsetX,openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_y(c4) - offsetY,openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_width(c4),openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_height(c4)); + break; + case 9: + var c5 = data.readDrawRoundRect(); + openfl__$internal_renderer_canvas_CanvasGraphics.drawRoundRect(openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_x(c5) - offsetX,openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_y(c5) - offsetY,openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_width(c5),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_height(c5),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_ellipseWidth(c5),openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_ellipseHeight(c5)); + break; + case 16: + var c6 = data.readLineTo(); + openfl__$internal_renderer_canvas_CanvasGraphics.context.lineTo(openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.get_x(c6) - offsetX,openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.get_y(c6) - offsetY); + positionX = openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.get_x(c6); + positionY = openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.get_y(c6); + break; + case 17: + var c7 = data.readMoveTo(); + openfl__$internal_renderer_canvas_CanvasGraphics.context.moveTo(openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_x(c7) - offsetX,openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_y(c7) - offsetY); + positionX = openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_x(c7); + positionY = openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_y(c7); + break; + default: + data.skip(type); + } + } + data.destroy(); + } +}; +var openfl__$internal_renderer_canvas_CanvasMaskManager = function(renderSession) { + openfl__$internal_renderer_AbstractMaskManager.call(this,renderSession); +}; +$hxClasses["openfl._internal.renderer.canvas.CanvasMaskManager"] = openfl__$internal_renderer_canvas_CanvasMaskManager; +openfl__$internal_renderer_canvas_CanvasMaskManager.__name__ = ["openfl","_internal","renderer","canvas","CanvasMaskManager"]; +openfl__$internal_renderer_canvas_CanvasMaskManager.__super__ = openfl__$internal_renderer_AbstractMaskManager; +openfl__$internal_renderer_canvas_CanvasMaskManager.prototype = $extend(openfl__$internal_renderer_AbstractMaskManager.prototype,{ + pushMask: function(mask) { + var context = this.renderSession.context; + context.save(); + var transform = mask.__getWorldTransform(); + context.setTransform(transform.a,transform.b,transform.c,transform.d,transform.tx,transform.ty); + context.beginPath(); + mask.__renderCanvasMask(this.renderSession); + context.clip(); + } + ,pushRect: function(rect,transform) { + var context = this.renderSession.context; + context.save(); + context.setTransform(transform.a,transform.b,transform.c,transform.d,transform.tx,transform.ty); + context.beginPath(); + context.rect(rect.x,rect.y,rect.width,rect.height); + context.clip(); + } + ,popMask: function() { + this.renderSession.context.restore(); + } + ,popRect: function() { + this.renderSession.context.restore(); + } + ,__class__: openfl__$internal_renderer_canvas_CanvasMaskManager +}); +var openfl__$internal_renderer_canvas_CanvasRenderer = function(width,height,context) { + openfl__$internal_renderer_AbstractRenderer.call(this,width,height); + this.context = context; + this.renderSession = new openfl__$internal_renderer_RenderSession(); + this.renderSession.context = context; + this.renderSession.roundPixels = true; + this.renderSession.renderer = this; + this.renderSession.maskManager = new openfl__$internal_renderer_canvas_CanvasMaskManager(this.renderSession); +}; +$hxClasses["openfl._internal.renderer.canvas.CanvasRenderer"] = openfl__$internal_renderer_canvas_CanvasRenderer; +openfl__$internal_renderer_canvas_CanvasRenderer.__name__ = ["openfl","_internal","renderer","canvas","CanvasRenderer"]; +openfl__$internal_renderer_canvas_CanvasRenderer.__super__ = openfl__$internal_renderer_AbstractRenderer; +openfl__$internal_renderer_canvas_CanvasRenderer.prototype = $extend(openfl__$internal_renderer_AbstractRenderer.prototype,{ + context: null + ,render: function(stage) { + this.context.setTransform(1,0,0,1,0,0); + this.context.globalAlpha = 1; + if(!stage.__transparent && stage.__clearBeforeRender) { + this.context.fillStyle = stage.__colorString; + this.context.fillRect(0,0,stage.stageWidth,stage.stageHeight); + } else if(stage.__transparent && stage.__clearBeforeRender) { + this.context.clearRect(0,0,stage.stageWidth,stage.stageHeight); + } + stage.__renderCanvas(this.renderSession); + } + ,__class__: openfl__$internal_renderer_canvas_CanvasRenderer +}); +var openfl__$internal_renderer_canvas_CanvasShape = function() { }; +$hxClasses["openfl._internal.renderer.canvas.CanvasShape"] = openfl__$internal_renderer_canvas_CanvasShape; +openfl__$internal_renderer_canvas_CanvasShape.__name__ = ["openfl","_internal","renderer","canvas","CanvasShape"]; +openfl__$internal_renderer_canvas_CanvasShape.render = function(shape,renderSession) { + if(!shape.__renderable || shape.__worldAlpha <= 0) { + return; + } + var graphics = shape.__graphics; + if(graphics != null) { + openfl__$internal_renderer_canvas_CanvasGraphics.render(graphics,renderSession); + if(graphics.__canvas != null) { + var context = renderSession.context; + var scrollRect = shape.get_scrollRect(); + if(graphics.__bounds.width > 0 && graphics.__bounds.height > 0 && (scrollRect == null || scrollRect.width > 0 && scrollRect.height > 0)) { + if(shape.__mask != null) { + renderSession.maskManager.pushMask(shape.__mask); + } + context.globalAlpha = shape.__worldAlpha; + var transform = shape.__renderTransform; + if(renderSession.roundPixels) { + context.setTransform(transform.a,transform.b,transform.c,transform.d,Std["int"](transform.tx),Std["int"](transform.ty)); + } else { + context.setTransform(transform.a,transform.b,transform.c,transform.d,transform.tx,transform.ty); + } + if(scrollRect == null) { + context.drawImage(graphics.__canvas,graphics.__bounds.x,graphics.__bounds.y); + } else { + context.drawImage(graphics.__canvas,Math.ceil(graphics.__bounds.x + scrollRect.x),Math.ceil(graphics.__bounds.y + scrollRect.y),scrollRect.width,scrollRect.height,Math.ceil(graphics.__bounds.x + scrollRect.x),Math.ceil(graphics.__bounds.y + scrollRect.y),scrollRect.width,scrollRect.height); + } + if(shape.__mask != null) { + renderSession.maskManager.popMask(); + } + } + } + } +}; +var openfl__$internal_renderer_dom_DOMMaskManager = function(renderSession) { + openfl__$internal_renderer_AbstractMaskManager.call(this,renderSession); +}; +$hxClasses["openfl._internal.renderer.dom.DOMMaskManager"] = openfl__$internal_renderer_dom_DOMMaskManager; +openfl__$internal_renderer_dom_DOMMaskManager.__name__ = ["openfl","_internal","renderer","dom","DOMMaskManager"]; +openfl__$internal_renderer_dom_DOMMaskManager.__super__ = openfl__$internal_renderer_AbstractMaskManager; +openfl__$internal_renderer_dom_DOMMaskManager.prototype = $extend(openfl__$internal_renderer_AbstractMaskManager.prototype,{ + pushMask: function(mask) { + } + ,pushRect: function(rect,transform) { + } + ,popMask: function() { + } + ,__class__: openfl__$internal_renderer_dom_DOMMaskManager +}); +var openfl__$internal_renderer_opengl_GLBitmap = function() { }; +$hxClasses["openfl._internal.renderer.opengl.GLBitmap"] = openfl__$internal_renderer_opengl_GLBitmap; +openfl__$internal_renderer_opengl_GLBitmap.__name__ = ["openfl","_internal","renderer","opengl","GLBitmap"]; +openfl__$internal_renderer_opengl_GLBitmap.render = function(bitmap,renderSession) { + if(!bitmap.__renderable || bitmap.__worldAlpha <= 0 || bitmap.bitmapData == null || !bitmap.bitmapData.__isValid) { + return; + } + renderSession.spriteBatch.renderBitmapData(bitmap.bitmapData,bitmap.smoothing,bitmap.__renderTransform,bitmap.__worldColorTransform,bitmap.__worldAlpha,bitmap.__blendMode,bitmap.__shader,bitmap.pixelSnapping); +}; +openfl__$internal_renderer_opengl_GLBitmap.pushFramebuffer = function(renderSession,texture,viewPort,smoothing,transparent,clearBuffer,powerOfTwo) { + if(powerOfTwo == null) { + powerOfTwo = true; + } + if(clearBuffer == null) { + clearBuffer = false; + } + if(transparent == null) { + transparent = true; + } + var gl = renderSession.gl; + if(gl == null) { + return null; + } + var renderer = renderSession.renderer; + var spritebatch = renderSession.spriteBatch; + var x = Std["int"](viewPort.x); + var y = Std["int"](viewPort.y); + var width = Std["int"](viewPort.width); + var height = Std["int"](viewPort.height); + spritebatch.finish(); + if(openfl__$internal_renderer_opengl_GLBitmap.fbData.length <= 0) { + openfl__$internal_renderer_opengl_GLBitmap.fbData.push({ texture : null, viewPort : null, transparent : renderer.transparent}); + } + if(texture == null) { + texture = new openfl__$internal_renderer_opengl_utils_PingPongTexture(gl,width,height,smoothing,powerOfTwo); + } + texture.resize(width,height); + renderer.transparent = transparent; + renderSession.maskManager.saveState(); + gl.bindFramebuffer(gl.FRAMEBUFFER,texture.get_framebuffer()); + renderer.setViewport(x,y,width,height); + gl.colorMask(true,true,true,true); + renderSession.blendModeManager.setBlendMode(10); + if(clearBuffer) { + texture.clear(); + } + openfl__$internal_renderer_opengl_GLBitmap.fbData.push({ texture : texture, viewPort : viewPort, transparent : transparent}); + return texture; +}; +openfl__$internal_renderer_opengl_GLBitmap.drawBitmapDrawable = function(renderSession,target,source,matrix,colorTransform,blendMode,clipRect) { + var data = openfl__$internal_renderer_opengl_GLBitmap.fbData[openfl__$internal_renderer_opengl_GLBitmap.fbData.length - 1]; + if(data == null) { + throw new js__$Boot_HaxeError("No data to draw to"); + } + var gl = renderSession.gl; + if(gl == null) { + return; + } + var viewPort = data.viewPort; + var renderer = renderSession.renderer; + var spritebatch = renderSession.spriteBatch; + var drawTarget = target != null; + var tmpRect = clipRect == null ? new openfl_geom_Rectangle(viewPort.x,viewPort.y,viewPort.width,viewPort.height) : clipRect.clone(); + spritebatch.begin(renderSession,drawTarget ? null : tmpRect); + if(drawTarget) { + target.__worldTransform.identity(); + openfl__$internal_renderer_opengl_GLBitmap.flipMatrix(target.__worldTransform,viewPort.height); + target.__renderGL(renderSession); + spritebatch.stop(); + if(target.__texture != null) { + gl.deleteTexture(target.__texture); + } + target.__texture = null; + spritebatch.start(tmpRect); + } + var ctCache = source.__worldColorTransform; + var blendModeCache = source.__blendMode; + var cached = source.__cacheAsBitmap; + var m = matrix != null ? matrix.clone() : new openfl_geom_Matrix(); + openfl__$internal_renderer_opengl_GLBitmap.flipMatrix(m,viewPort.height); + source.__worldColorTransform = colorTransform != null ? colorTransform : new openfl_geom_ColorTransform(); + source.__blendMode = blendMode; + openfl_display_DisplayObject.__cacheAsBitmapMode = true; + source.__updateTransforms(m); + source.__updateChildren(false); + source.__cacheAsBitmap = false; + source.__renderGL(renderSession); + source.__cacheAsBitmap = cached; + source.__worldColorTransform = ctCache; + source.__blendMode = blendModeCache; + openfl_display_DisplayObject.__cacheAsBitmapMode = false; + source.__updateTransforms(); + source.__updateChildren(false); +}; +openfl__$internal_renderer_opengl_GLBitmap.popFramebuffer = function(renderSession,image) { + var gl = renderSession.gl; + if(gl == null) { + return; + } + renderSession.spriteBatch.finish(); + openfl__$internal_renderer_opengl_GLBitmap.fbData.pop(); + var data = openfl__$internal_renderer_opengl_GLBitmap.fbData[openfl__$internal_renderer_opengl_GLBitmap.fbData.length - 1]; + if(data == null) { + throw new js__$Boot_HaxeError("oh"); + } + var x; + var y; + var width; + var height; + if(data.viewPort == null) { + y = 0; + x = y; + width = renderSession.renderer.width; + height = renderSession.renderer.height; + } else { + x = Math.floor(data.viewPort.x); + y = Math.floor(data.viewPort.y); + width = Math.ceil(data.viewPort.width); + height = Math.ceil(data.viewPort.height); + } + if(image != null) { + if(image.width != width || image.height != height) { + image.resize(width,height); + } + gl.readPixels(x,y,width,height,gl.RGBA,gl.UNSIGNED_BYTE,image.buffer.data); + image.dirty = false; + image.set_premultiplied(true); + } + gl.bindFramebuffer(gl.FRAMEBUFFER,data.texture == null ? renderSession.defaultFramebuffer : data.texture.get_framebuffer()); + renderSession.renderer.setViewport(x,y,width,height); + renderSession.renderer.transparent = data.transparent; + renderSession.maskManager.restoreState(); +}; +openfl__$internal_renderer_opengl_GLBitmap.flipMatrix = function(m,height) { + var tx = m.tx; + var ty = m.ty; + m.tx = 0; + m.ty = 0; + m.scale(1,-1); + m.translate(0,height); + m.tx += tx; + m.ty -= ty; +}; +var openfl__$internal_renderer_opengl_GLRenderer = function(width,height,gl,transparent,antialias,preserveDrawingBuffer) { + if(preserveDrawingBuffer == null) { + preserveDrawingBuffer = false; + } + if(antialias == null) { + antialias = false; + } + if(transparent == null) { + transparent = false; + } + if(height == null) { + height = 600; + } + if(width == null) { + width = 800; + } + this.vpHeight = 0; + this.vpWidth = 0; + this.vpY = 0; + this.vpX = 0; + openfl__$internal_renderer_AbstractRenderer.call(this,width,height); + this.transparent = transparent; + this.preserveDrawingBuffer = preserveDrawingBuffer; + this.width = width; + this.height = height; + this.viewport = new openfl_geom_Rectangle(); + this.options = { alpha : transparent, antialias : antialias, premultipliedAlpha : transparent, stencil : true, preserveDrawingBuffer : preserveDrawingBuffer}; + this._glContextId = openfl__$internal_renderer_opengl_GLRenderer.glContextId++; + this.gl = gl; + this.defaultFramebuffer = null; + openfl__$internal_renderer_opengl_GLRenderer.glContexts[this._glContextId] = gl; + this.projectionMatrix = new openfl_geom_Matrix(); + this.projection = new openfl_geom_Point(); + this.projection.x = this.width / 2; + this.projection.y = -this.height / 2; + this.offset = new openfl_geom_Point(0,0); + this.resize(this.width,this.height); + this.contextLost = false; + this.shaderManager = new openfl__$internal_renderer_opengl_utils_ShaderManager(gl); + this.spriteBatch = new openfl__$internal_renderer_opengl_utils_SpriteBatch(gl); + this.filterManager = new openfl__$internal_renderer_opengl_utils_FilterManager(gl,this.transparent); + this.stencilManager = new openfl__$internal_renderer_opengl_utils_StencilManager(gl); + this.blendModeManager = new openfl__$internal_renderer_opengl_utils_BlendModeManager(gl); + this.renderSession = new openfl__$internal_renderer_RenderSession(); + this.renderSession.gl = this.gl; + this.renderSession.drawCount = 0; + this.renderSession.shaderManager = this.shaderManager; + this.renderSession.filterManager = this.filterManager; + this.renderSession.blendModeManager = this.blendModeManager; + this.renderSession.spriteBatch = this.spriteBatch; + this.renderSession.stencilManager = this.stencilManager; + this.renderSession.renderer = this; + this.renderSession.defaultFramebuffer = this.defaultFramebuffer; + this.renderSession.projectionMatrix = this.projectionMatrix; + this.maskManager = new openfl__$internal_renderer_opengl_utils_GLMaskManager(this.renderSession); + this.renderSession.maskManager = this.maskManager; + this.shaderManager.setShader(this.shaderManager.defaultShader); + gl.disable(gl.DEPTH_TEST); + gl.disable(gl.CULL_FACE); + gl.enable(gl.BLEND); + gl.colorMask(true,true,true,true); +}; +$hxClasses["openfl._internal.renderer.opengl.GLRenderer"] = openfl__$internal_renderer_opengl_GLRenderer; +openfl__$internal_renderer_opengl_GLRenderer.__name__ = ["openfl","_internal","renderer","opengl","GLRenderer"]; +openfl__$internal_renderer_opengl_GLRenderer.__super__ = openfl__$internal_renderer_AbstractRenderer; +openfl__$internal_renderer_opengl_GLRenderer.prototype = $extend(openfl__$internal_renderer_AbstractRenderer.prototype,{ + blendModeManager: null + ,contextLost: null + ,defaultFramebuffer: null + ,filterManager: null + ,gl: null + ,_glContextId: null + ,maskManager: null + ,offset: null + ,options: null + ,preserveDrawingBuffer: null + ,projection: null + ,shaderManager: null + ,spriteBatch: null + ,stencilManager: null + ,projectionMatrix: null + ,vpX: null + ,vpY: null + ,vpWidth: null + ,vpHeight: null + ,setViewport: function(x,y,width,height) { + if(!(this.vpX == x && this.vpY == y && this.vpWidth == width && this.vpHeight == height)) { + this.vpX = x; + this.vpY = y; + this.vpWidth = width; + this.vpHeight = height; + this.gl.viewport(x,y,width,height); + this.setOrtho(x,y,width,height); + this.viewport.setTo(x,y,width,height); + } + } + ,setOrtho: function(x,y,width,height) { + var o = this.projectionMatrix; + o.identity(); + o.a = 1 / width * 2; + o.d = -1 / height * 2; + o.tx = -1 - x * o.a; + o.ty = 1 - y * o.d; + } + ,render: function(stage) { + if(this.contextLost) { + return; + } + var gl = this.gl; + this.setViewport(0,0,this.width,this.height); + gl.bindFramebuffer(gl.FRAMEBUFFER,this.defaultFramebuffer); + if(this.transparent) { + gl.clearColor(0,0,0,0); + } else { + gl.clearColor(stage.__colorSplit[0],stage.__colorSplit[1],stage.__colorSplit[2],1); + } + gl.clear(gl.COLOR_BUFFER_BIT); + this.renderDisplayObject(stage,this.projection); + } + ,renderDisplayObject: function(displayObject,projection,buffer) { + this.renderSession.blendModeManager.setBlendMode(10); + this.renderSession.drawCount = 0; + this.renderSession.currentBlendMode = null; + this.spriteBatch.begin(this.renderSession); + this.filterManager.begin(this.renderSession,buffer); + displayObject.__renderGL(this.renderSession); + this.spriteBatch.finish(); + } + ,resize: function(width,height) { + this.width = width; + this.height = height; + openfl__$internal_renderer_AbstractRenderer.prototype.resize.call(this,width,height); + this.setViewport(0,0,width,height); + this.projection.x = width / 2; + this.projection.y = -height / 2; + } + ,__class__: openfl__$internal_renderer_opengl_GLRenderer +}); +var openfl__$internal_renderer_opengl_shaders2_Shader = function(gl) { + this.wrapT = 33071; + this.wrapS = 33071; + this.compiled = false; + this.uniforms = new haxe_ds_StringMap(); + this.attributes = new haxe_ds_StringMap(); + this.ID = openfl__$internal_renderer_opengl_shaders2_Shader.UID++; + this.gl = gl; + this.program = null; +}; +$hxClasses["openfl._internal.renderer.opengl.shaders2.Shader"] = openfl__$internal_renderer_opengl_shaders2_Shader; +openfl__$internal_renderer_opengl_shaders2_Shader.__name__ = ["openfl","_internal","renderer","opengl","shaders2","Shader"]; +openfl__$internal_renderer_opengl_shaders2_Shader.compileProgram = function(gl,vertexSrc,fragmentSrc) { + var cache = openfl__$internal_renderer_opengl_utils_ShaderManager.compiledShadersCache; + var key = haxe_crypto_Md5.encode(vertexSrc + fragmentSrc); + if(cache.exists(key)) { + return cache.get(key); + } + var vertexShader = openfl__$internal_renderer_opengl_shaders2_Shader.compileShader(gl,vertexSrc,gl.VERTEX_SHADER); + var fragmentShader = openfl__$internal_renderer_opengl_shaders2_Shader.compileShader(gl,fragmentSrc,gl.FRAGMENT_SHADER); + var program = gl.createProgram(); + if(vertexShader != null && fragmentShader != null) { + gl.attachShader(program,vertexShader); + gl.attachShader(program,fragmentShader); + gl.linkProgram(program); + gl.deleteShader(vertexShader); + gl.deleteShader(fragmentShader); + if(gl.getProgramParameter(program,gl.LINK_STATUS) == 0) { + haxe_Log.trace("Could not compile the program:\n\t" + gl.getProgramInfoLog(program),{ fileName : "Shader.hx", lineNumber : 226, className : "openfl._internal.renderer.opengl.shaders2.Shader", methodName : "compileProgram"}); + haxe_Log.trace("VERTEX:\n" + vertexSrc + "\nFRAGMENT:\n" + fragmentSrc,{ fileName : "Shader.hx", lineNumber : 227, className : "openfl._internal.renderer.opengl.shaders2.Shader", methodName : "compileProgram"}); + return null; + } + } + cache.set(key,program); + return program; +}; +openfl__$internal_renderer_opengl_shaders2_Shader.compileShader = function(gl,shaderSrc,type) { + var src = shaderSrc; + var shader = gl.createShader(type); + gl.shaderSource(shader,src); + gl.compileShader(shader); + if(gl.getShaderParameter(shader,gl.COMPILE_STATUS) == 0) { + haxe_Log.trace("Could not compile the shader:\n\t" + gl.getShaderInfoLog(shader),{ fileName : "Shader.hx", lineNumber : 244, className : "openfl._internal.renderer.opengl.shaders2.Shader", methodName : "compileShader"}); + haxe_Log.trace(shaderSrc,{ fileName : "Shader.hx", lineNumber : 245, className : "openfl._internal.renderer.opengl.shaders2.Shader", methodName : "compileShader"}); + return null; + } + return shader; +}; +openfl__$internal_renderer_opengl_shaders2_Shader.prototype = { + gl: null + ,vertexSrc: null + ,fragmentSrc: null + ,attributes: null + ,uniforms: null + ,compiled: null + ,ID: null + ,program: null + ,wrapS: null + ,wrapT: null + ,smooth: null + ,blendMode: null + ,vertexString: null + ,fragmentString: null + ,init: function(force) { + if(force == null) { + force = false; + } + if(this.compiled && !force) { + return; + } + if(this.vertexSrc != null) { + this.vertexString = this.vertexSrc.join("\n"); + } + if(this.fragmentSrc != null) { + this.fragmentString = this.fragmentSrc.join("\n"); + } + if(this.vertexString == null || this.fragmentString == null) { + throw new js__$Boot_HaxeError("No vertex or fragment source provided"); + } + this.program = openfl__$internal_renderer_opengl_shaders2_Shader.compileProgram(this.gl,this.vertexString,this.fragmentString); + if(this.program != null) { + this.compiled = true; + } + } + ,destroy: function() { + if(this.program != null) { + this.gl.deleteProgram(this.program); + } + this.compiled = false; + this.attributes = null; + } + ,applyData: function(shaderData,renderSession) { + if(shaderData == null) { + return; + } + var param; + var u; + var v; + var bd; + var key = shaderData.keys(); + while(key.hasNext()) { + var key1 = key.next(); + u = this.getUniformLocation(key1); + param = shaderData.get(key1); + if(param == null) { + continue; + } + v = param.value; + bd = param.bitmap; + if(v == null && bd == null) { + continue; + } + var _g = param.internalType; + switch(_g) { + case 1: + var _g1 = param.size; + switch(_g1) { + case 1: + this.gl.uniform1i(u,Std["int"](v[0])); + break; + case 2: + this.gl.uniform2i(u,Std["int"](v[0]),Std["int"](v[1])); + break; + case 3: + this.gl.uniform3i(u,Std["int"](v[0]),Std["int"](v[1]),Std["int"](v[2])); + break; + case 4: + this.gl.uniform4i(u,Std["int"](v[0]),Std["int"](v[1]),Std["int"](v[2]),Std["int"](v[3])); + break; + } + break; + case 2: + var _g2 = param.size; + switch(_g2) { + case 1: + this.gl.uniform1f(u,v[0]); + break; + case 2: + this.gl.uniform2f(u,v[0],v[1]); + break; + case 3: + this.gl.uniform3f(u,v[0],v[1],v[2]); + break; + case 4: + this.gl.uniform4f(u,v[0],v[1],v[2],v[3]); + break; + } + break; + case 3: + var _g3 = param.size; + switch(_g3) { + case 2: + var tmp = this.gl; + var param1 = param.transpose; + var array = param.value; + var this1; + if(array != null) { + this1 = new Float32Array(array); + } else { + this1 = null; + } + tmp.uniformMatrix2fv(u,param1,this1); + break; + case 3: + var tmp1 = this.gl; + var param2 = param.transpose; + var array1 = param.value; + var this2; + if(array1 != null) { + this2 = new Float32Array(array1); + } else { + this2 = null; + } + tmp1.uniformMatrix3fv(u,param2,this2); + break; + case 4: + var tmp2 = this.gl; + var param3 = param.transpose; + var array2 = param.value; + var this3; + if(array2 != null) { + this3 = new Float32Array(array2); + } else { + this3 = null; + } + tmp2.uniformMatrix4fv(u,param3,this3); + break; + } + break; + case 4: + if(bd == null || !bd.__isValid) { + continue; + } + this.gl.activeTexture(this.gl.TEXTURE0 + renderSession.activeTextures); + this.gl.bindTexture(this.gl.TEXTURE_2D,bd.getTexture(this.gl)); + this.gl.uniform1i(u,renderSession.activeTextures); + this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,param.smooth ? this.gl.LINEAR : this.gl.NEAREST); + this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,param.smooth ? this.gl.LINEAR : this.gl.NEAREST); + this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,param.repeatX); + this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,param.repeatY); + renderSession.activeTextures++; + break; + default: + } + } + } + ,getAttribLocation: function(attribute) { + if(this.program == null) { + throw new js__$Boot_HaxeError("Shader isn't initialized"); + } + if(this.attributes.exists(attribute)) { + return this.attributes.get(attribute); + } else { + var location = this.gl.getAttribLocation(this.program,attribute); + this.attributes.set(attribute,location); + return location; + } + } + ,getUniformLocation: function(uniform) { + if(this.program == null) { + throw new js__$Boot_HaxeError("Shader isn't initialized"); + } + if(this.uniforms.exists(uniform)) { + return this.uniforms.get(uniform); + } else { + var location = this.gl.getUniformLocation(this.program,uniform); + this.uniforms.set(uniform,location); + return location; + } + } + ,enableVertexAttribute: function(attribute,stride,offset) { + var location = this.getAttribLocation(attribute.name); + this.gl.enableVertexAttribArray(location); + this.gl.vertexAttribPointer(location,attribute.components,attribute.type,attribute.normalized,stride,offset * 4); + } + ,disableVertexAttribute: function(attribute,setDefault) { + if(setDefault == null) { + setDefault = true; + } + var location = this.getAttribLocation(attribute.name); + this.gl.disableVertexAttribArray(location); + if(setDefault) { + var _g = attribute.components; + switch(_g) { + case 1: + this.gl.vertexAttrib1fv(location,attribute.defaultValue.subarray(0,1)); + break; + case 2: + this.gl.vertexAttrib2fv(location,attribute.defaultValue.subarray(0,2)); + break; + case 3: + this.gl.vertexAttrib3fv(location,attribute.defaultValue.subarray(0,3)); + break; + default: + this.gl.vertexAttrib4fv(location,attribute.defaultValue.subarray(0,4)); + } + } + } + ,bindVertexArray: function(va) { + var offset = 0; + var stride = va.get_stride(); + var _g = 0; + var _g1 = va.attributes; + while(_g < _g1.length) { + var attribute = _g1[_g]; + ++_g; + if(attribute.enabled) { + this.enableVertexAttribute(attribute,stride,offset); + offset += attribute.get_elements(); + } else { + this.disableVertexAttribute(attribute,true); + } + } + } + ,__class__: openfl__$internal_renderer_opengl_shaders2_Shader +}; +var openfl__$internal_renderer_opengl_shaders2_DefaultShader = function(gl) { + openfl__$internal_renderer_opengl_shaders2_Shader.call(this,gl); + this.vertexSrc = openfl__$internal_renderer_opengl_shaders2_DefaultShader.VERTEX_SRC; + this.fragmentSrc = ["#ifdef GL_ES","precision lowp float;","#endif","uniform sampler2D " + "openfl_uSampler0" + ";","uniform vec4 " + "openfl_uColorMultiplier" + ";","uniform vec4 " + "openfl_uColorOffset" + ";","uniform bool " + "openfl_uUseColorTransform" + ";","varying vec2 " + "openfl_vTexCoord" + ";","varying vec4 " + "openfl_vColor" + ";","vec4 colorTransform(const vec4 color, const vec4 tint, const vec4 multiplier, const vec4 offset) {","\tif(!" + "openfl_uUseColorTransform" + ") {","\t\treturn color * tint;","\t}","\tvec4 unmultiply;","\tif (color.a == 0.0) {","\t\tunmultiply = vec4(0.0, 0.0, 0.0, 0.0);","\t} else {"," \tunmultiply = vec4(color.rgb / color.a, color.a);","\t}"," vec4 result = unmultiply * tint * multiplier;"," result = result + offset;"," result = clamp(result, 0., 1.);"," result = vec4(result.rgb * result.a, result.a);"," return result;","}","void main(void) {"," vec4 tc = texture2D(" + "openfl_uSampler0" + ", " + "openfl_vTexCoord" + ");"," gl_FragColor = colorTransform(tc, " + "openfl_vColor" + ", " + "openfl_uColorMultiplier" + ", " + "openfl_uColorOffset" + ");","}"]; + this.init(); +}; +$hxClasses["openfl._internal.renderer.opengl.shaders2.DefaultShader"] = openfl__$internal_renderer_opengl_shaders2_DefaultShader; +openfl__$internal_renderer_opengl_shaders2_DefaultShader.__name__ = ["openfl","_internal","renderer","opengl","shaders2","DefaultShader"]; +openfl__$internal_renderer_opengl_shaders2_DefaultShader.__super__ = openfl__$internal_renderer_opengl_shaders2_Shader; +openfl__$internal_renderer_opengl_shaders2_DefaultShader.prototype = $extend(openfl__$internal_renderer_opengl_shaders2_Shader.prototype,{ + init: function(force) { + if(force == null) { + force = false; + } + openfl__$internal_renderer_opengl_shaders2_Shader.prototype.init.call(this,force); + this.getAttribLocation("openfl_aPosition"); + this.getAttribLocation("openfl_aTexCoord0"); + this.getAttribLocation("openfl_aColor"); + this.getUniformLocation("openfl_uProjectionMatrix"); + this.getUniformLocation("openfl_uSampler0"); + this.getUniformLocation("openfl_uColorMultiplier"); + this.getUniformLocation("openfl_uColorOffset"); + this.getUniformLocation("openfl_uUseColorTransform"); + } + ,__class__: openfl__$internal_renderer_opengl_shaders2_DefaultShader +}); +var openfl__$internal_renderer_opengl_shaders2_DrawTrianglesShader = function(gl) { + openfl__$internal_renderer_opengl_shaders2_Shader.call(this,gl); + this.vertexSrc = ["attribute vec2 " + "openfl_aPosition" + ";","attribute vec2 " + "openfl_aTexCoord0" + ";","attribute vec4 " + "openfl_aColor" + ";","uniform mat3 " + "openfl_uProjectionMatrix" + ";","varying vec2 vTexCoord;","varying vec4 vColor;","void main(void) {"," gl_Position = vec4((" + "openfl_uProjectionMatrix" + " * vec3(" + "openfl_aPosition" + ", 1.0)).xy, 0.0, 1.0);"," vTexCoord = " + "openfl_aTexCoord0" + ";"," vColor = " + "openfl_aColor" + ".bgra;","}"]; + this.fragmentSrc = ["#ifdef GL_ES","precision lowp float;","#endif","uniform sampler2D " + "openfl_uSampler0" + ";","uniform vec3 " + "openfl_uColor" + ";","uniform bool " + "openfl_uUseTexture" + ";","uniform float " + "openfl_uAlpha" + ";","uniform vec4 " + "openfl_uColorMultiplier" + ";","uniform vec4 " + "openfl_uColorOffset" + ";","varying vec2 vTexCoord;","varying vec4 vColor;","vec4 tmp;","vec4 colorTransform(const vec4 color, const vec4 tint, const vec4 multiplier, const vec4 offset) {"," vec4 unmultiply = vec4(color.rgb / color.a, color.a);"," vec4 result = unmultiply * tint * multiplier;"," result = result + offset;"," result = clamp(result, 0., 1.);"," result = vec4(result.rgb * result.a, result.a);"," return result;","}","void main(void) {"," if(" + "openfl_uUseTexture" + ") {"," tmp = texture2D(" + "openfl_uSampler0" + ", vTexCoord);"," } else {"," tmp = vec4(" + "openfl_uColor" + ", 1.);"," }"," gl_FragColor = colorTransform(tmp, vColor, " + "openfl_uColorMultiplier" + ", " + "openfl_uColorOffset" + ");","}"]; + this.init(); +}; +$hxClasses["openfl._internal.renderer.opengl.shaders2.DrawTrianglesShader"] = openfl__$internal_renderer_opengl_shaders2_DrawTrianglesShader; +openfl__$internal_renderer_opengl_shaders2_DrawTrianglesShader.__name__ = ["openfl","_internal","renderer","opengl","shaders2","DrawTrianglesShader"]; +openfl__$internal_renderer_opengl_shaders2_DrawTrianglesShader.__super__ = openfl__$internal_renderer_opengl_shaders2_Shader; +openfl__$internal_renderer_opengl_shaders2_DrawTrianglesShader.prototype = $extend(openfl__$internal_renderer_opengl_shaders2_Shader.prototype,{ + init: function(force) { + if(force == null) { + force = false; + } + openfl__$internal_renderer_opengl_shaders2_Shader.prototype.init.call(this,force); + this.getAttribLocation("openfl_aPosition"); + this.getAttribLocation("openfl_aTexCoord0"); + this.getAttribLocation("openfl_aColor"); + this.getUniformLocation("openfl_uSampler0"); + this.getUniformLocation("openfl_uProjectionMatrix"); + this.getUniformLocation("openfl_uColor"); + this.getUniformLocation("openfl_uAlpha"); + this.getUniformLocation("openfl_uUseTexture"); + this.getUniformLocation("openfl_uColorMultiplier"); + this.getUniformLocation("openfl_uColorOffset"); + } + ,__class__: openfl__$internal_renderer_opengl_shaders2_DrawTrianglesShader +}); +var openfl__$internal_renderer_opengl_shaders2_FillShader = function(gl) { + openfl__$internal_renderer_opengl_shaders2_Shader.call(this,gl); + this.vertexSrc = ["attribute vec2 " + "openfl_aPosition" + ";","uniform mat3 " + "openfl_uTranslationMatrix" + ";","uniform mat3 " + "openfl_uProjectionMatrix" + ";","uniform vec4 " + "openfl_uColor" + ";","uniform float " + "openfl_uAlpha" + ";","uniform vec4 " + "openfl_uColorMultiplier" + ";","uniform vec4 " + "openfl_uColorOffset" + ";","varying vec4 vColor;","vec4 colorTransform(const vec4 color, const float alpha, const vec4 multiplier, const vec4 offset) {"," vec4 result = color * multiplier;"," result.a *= alpha;"," result = result + offset;"," result = clamp(result, 0., 1.);"," result = vec4(result.rgb * result.a, result.a);"," return result;","}","void main(void) {"," gl_Position = vec4((" + "openfl_uProjectionMatrix" + " * " + "openfl_uTranslationMatrix" + " * vec3(" + "openfl_aPosition" + ", 1.0)).xy, 0.0, 1.0);"," vColor = colorTransform(" + "openfl_uColor" + ", " + "openfl_uAlpha" + ", " + "openfl_uColorMultiplier" + ", " + "openfl_uColorOffset" + ");","}"]; + this.fragmentSrc = ["#ifdef GL_ES","precision lowp float;","#endif","varying vec4 vColor;","void main(void) {"," gl_FragColor = vColor;","}"]; + this.init(); +}; +$hxClasses["openfl._internal.renderer.opengl.shaders2.FillShader"] = openfl__$internal_renderer_opengl_shaders2_FillShader; +openfl__$internal_renderer_opengl_shaders2_FillShader.__name__ = ["openfl","_internal","renderer","opengl","shaders2","FillShader"]; +openfl__$internal_renderer_opengl_shaders2_FillShader.__super__ = openfl__$internal_renderer_opengl_shaders2_Shader; +openfl__$internal_renderer_opengl_shaders2_FillShader.prototype = $extend(openfl__$internal_renderer_opengl_shaders2_Shader.prototype,{ + init: function(force) { + if(force == null) { + force = false; + } + openfl__$internal_renderer_opengl_shaders2_Shader.prototype.init.call(this,force); + this.getAttribLocation("openfl_aPosition"); + this.getUniformLocation("openfl_uTranslationMatrix"); + this.getUniformLocation("openfl_uProjectionMatrix"); + this.getUniformLocation("openfl_uColor"); + this.getUniformLocation("openfl_uColorMultiplier"); + this.getUniformLocation("openfl_uColorOffset"); + } + ,__class__: openfl__$internal_renderer_opengl_shaders2_FillShader +}); +var openfl__$internal_renderer_opengl_shaders2_PatternFillShader = function(gl) { + openfl__$internal_renderer_opengl_shaders2_Shader.call(this,gl); + this.vertexSrc = ["attribute vec2 " + "openfl_aPosition" + ";","uniform mat3 " + "openfl_uTranslationMatrix" + ";","uniform mat3 " + "openfl_uProjectionMatrix" + ";","uniform mat3 " + "openfl_uPatternMatrix" + ";","varying vec2 vPosition;","void main(void) {"," gl_Position = vec4((" + "openfl_uProjectionMatrix" + " * " + "openfl_uTranslationMatrix" + " * vec3(" + "openfl_aPosition" + ", 1.0)).xy, 0.0, 1.0);"," vPosition = (" + "openfl_uPatternMatrix" + " * vec3(" + "openfl_aPosition" + ", 1)).xy;","}"]; + this.fragmentSrc = ["#ifdef GL_ES","precision lowp float;","#endif","uniform float " + "openfl_uAlpha" + ";","uniform vec2 " + "openfl_uPatternTL" + ";","uniform vec2 " + "openfl_uPatternBR" + ";","uniform sampler2D " + "openfl_uSampler0" + ";","uniform vec4 " + "openfl_uColorMultiplier" + ";","uniform vec4 " + "openfl_uColorOffset" + ";","varying vec2 vPosition;","vec4 colorTransform(const vec4 color, const float alpha, const vec4 multiplier, const vec4 offset) {"," vec4 unmultiply = vec4(color.rgb / color.a, color.a);"," vec4 result = unmultiply * multiplier;"," result.a *= alpha;"," result = result + offset;"," result = clamp(result, 0., 1.);"," result = vec4(result.rgb * result.a, result.a);"," return result;","}","void main(void) {"," vec2 pos = mix(" + "openfl_uPatternTL" + ", " + "openfl_uPatternBR" + ", vPosition);"," vec4 tcol = texture2D(" + "openfl_uSampler0" + ", pos);"," gl_FragColor = colorTransform(tcol, " + "openfl_uAlpha" + ", " + "openfl_uColorMultiplier" + ", " + "openfl_uColorOffset" + ");","}"]; + this.init(); +}; +$hxClasses["openfl._internal.renderer.opengl.shaders2.PatternFillShader"] = openfl__$internal_renderer_opengl_shaders2_PatternFillShader; +openfl__$internal_renderer_opengl_shaders2_PatternFillShader.__name__ = ["openfl","_internal","renderer","opengl","shaders2","PatternFillShader"]; +openfl__$internal_renderer_opengl_shaders2_PatternFillShader.__super__ = openfl__$internal_renderer_opengl_shaders2_Shader; +openfl__$internal_renderer_opengl_shaders2_PatternFillShader.prototype = $extend(openfl__$internal_renderer_opengl_shaders2_Shader.prototype,{ + init: function(force) { + if(force == null) { + force = false; + } + openfl__$internal_renderer_opengl_shaders2_Shader.prototype.init.call(this,force); + this.getAttribLocation("openfl_aPosition"); + this.getUniformLocation("openfl_uTranslationMatrix"); + this.getUniformLocation("openfl_uPatternMatrix"); + this.getUniformLocation("openfl_uProjectionMatrix"); + this.getUniformLocation("openfl_uSampler0"); + this.getUniformLocation("openfl_uPatternTL"); + this.getUniformLocation("openfl_uPatternBR"); + this.getUniformLocation("openfl_uAlpha"); + this.getUniformLocation("openfl_uColorMultiplier"); + this.getUniformLocation("openfl_uColorOffset"); + } + ,__class__: openfl__$internal_renderer_opengl_shaders2_PatternFillShader +}); +var openfl__$internal_renderer_opengl_shaders2_PrimitiveShader = function(gl) { + openfl__$internal_renderer_opengl_shaders2_Shader.call(this,gl); + this.vertexSrc = ["attribute vec2 " + "openfl_aPosition" + ";","attribute vec4 " + "openfl_aColor" + ";","uniform mat3 " + "openfl_uTranslationMatrix" + ";","uniform mat3 " + "openfl_uProjectionMatrix" + ";","uniform vec4 " + "openfl_uColorMultiplier" + ";","uniform vec4 " + "openfl_uColorOffset" + ";","uniform float " + "openfl_uAlpha" + ";","varying vec4 vColor;","vec4 colorTransform(const vec4 color, const float alpha, const vec4 multiplier, const vec4 offset) {"," vec4 result = color * multiplier;"," result.a *= alpha;"," result = result + offset;"," result = clamp(result, 0., 1.);"," result = vec4(result.rgb * result.a, result.a);"," return result;","}","void main(void) {"," gl_Position = vec4((" + "openfl_uProjectionMatrix" + " * " + "openfl_uTranslationMatrix" + " * vec3(" + "openfl_aPosition" + ", 1.0)).xy, 0.0, 1.0);"," vColor = colorTransform(" + "openfl_aColor" + ", " + "openfl_uAlpha" + ", " + "openfl_uColorMultiplier" + ", " + "openfl_uColorOffset" + ");","}"]; + this.fragmentSrc = ["#ifdef GL_ES","precision lowp float;","#endif","varying vec4 vColor;","void main(void) {"," gl_FragColor = vColor;","}"]; + this.init(); +}; +$hxClasses["openfl._internal.renderer.opengl.shaders2.PrimitiveShader"] = openfl__$internal_renderer_opengl_shaders2_PrimitiveShader; +openfl__$internal_renderer_opengl_shaders2_PrimitiveShader.__name__ = ["openfl","_internal","renderer","opengl","shaders2","PrimitiveShader"]; +openfl__$internal_renderer_opengl_shaders2_PrimitiveShader.__super__ = openfl__$internal_renderer_opengl_shaders2_Shader; +openfl__$internal_renderer_opengl_shaders2_PrimitiveShader.prototype = $extend(openfl__$internal_renderer_opengl_shaders2_Shader.prototype,{ + init: function(force) { + if(force == null) { + force = false; + } + openfl__$internal_renderer_opengl_shaders2_Shader.prototype.init.call(this,force); + this.getAttribLocation("openfl_aPosition"); + this.getAttribLocation("openfl_aColor"); + this.getUniformLocation("openfl_uTranslationMatrix"); + this.getUniformLocation("openfl_uProjectionMatrix"); + this.getUniformLocation("openfl_uAlpha"); + this.getUniformLocation("openfl_uColorMultiplier"); + this.getUniformLocation("openfl_uColorOffset"); + } + ,__class__: openfl__$internal_renderer_opengl_shaders2_PrimitiveShader +}); +var openfl__$internal_renderer_opengl_utils_BlendModeManager = function(gl) { + this.gl = gl; + this.currentBlendMode = null; +}; +$hxClasses["openfl._internal.renderer.opengl.utils.BlendModeManager"] = openfl__$internal_renderer_opengl_utils_BlendModeManager; +openfl__$internal_renderer_opengl_utils_BlendModeManager.__name__ = ["openfl","_internal","renderer","opengl","utils","BlendModeManager"]; +openfl__$internal_renderer_opengl_utils_BlendModeManager.prototype = { + currentBlendMode: null + ,gl: null + ,setBlendMode: function(blendMode,force) { + if(force == null) { + force = false; + } + if(openfl__$internal_renderer_opengl_utils_BlendModeManager.FORCE_MODE == null) { + if(blendMode == null) { + blendMode = 10; + force = true; + } + if(!force && this.currentBlendMode == blendMode) { + return false; + } + } else { + blendMode = openfl__$internal_renderer_opengl_utils_BlendModeManager.FORCE_MODE; + } + this.currentBlendMode = blendMode; + switch(blendMode) { + case 0: + this.gl.blendEquationSeparate(32774,32774); + this.gl.blendFuncSeparate(1,1,openfl__$internal_renderer_opengl_utils_BlendModeManager.ALPHA_VALUE,771); + break; + case 3: + this.gl.blendEquationSeparate(32774,32774); + this.gl.blendFuncSeparate(775,0,openfl__$internal_renderer_opengl_utils_BlendModeManager.ALPHA_VALUE,771); + break; + case 9: + this.gl.blendEquationSeparate(32774,32774); + this.gl.blendFuncSeparate(774,771,openfl__$internal_renderer_opengl_utils_BlendModeManager.ALPHA_VALUE,771); + break; + case 12: + this.gl.blendEquationSeparate(32774,32774); + this.gl.blendFuncSeparate(1,769,openfl__$internal_renderer_opengl_utils_BlendModeManager.ALPHA_VALUE,771); + break; + case 14: + this.gl.blendEquationSeparate(32779,32774); + this.gl.blendFuncSeparate(1,1,openfl__$internal_renderer_opengl_utils_BlendModeManager.ALPHA_VALUE,771); + break; + default: + this.gl.blendEquationSeparate(32774,32774); + this.gl.blendFuncSeparate(1,771,openfl__$internal_renderer_opengl_utils_BlendModeManager.ALPHA_VALUE,771); + } + return true; + } + ,__class__: openfl__$internal_renderer_opengl_utils_BlendModeManager +}; +var openfl__$internal_renderer_opengl_utils_DrawPath = function(makeArray) { + if(makeArray == null) { + makeArray = true; + } + this.type = openfl__$internal_renderer_opengl_utils_GraphicType.Polygon; + this.points = null; + this.winding = 0; + this.isRemovable = true; + this.fillIndex = 0; + this.line = new openfl__$internal_renderer_opengl_utils_LineStyle(); + this.fill = openfl__$internal_renderer_opengl_utils_FillType.None; + if(makeArray) { + this.points = []; + } +}; +$hxClasses["openfl._internal.renderer.opengl.utils.DrawPath"] = openfl__$internal_renderer_opengl_utils_DrawPath; +openfl__$internal_renderer_opengl_utils_DrawPath.__name__ = ["openfl","_internal","renderer","opengl","utils","DrawPath"]; +openfl__$internal_renderer_opengl_utils_DrawPath.getStack = function(graphics,gl) { + return openfl__$internal_renderer_opengl_utils_PathBuiler.build(graphics,gl); +}; +openfl__$internal_renderer_opengl_utils_DrawPath.prototype = { + line: null + ,fill: null + ,fillIndex: null + ,isRemovable: null + ,winding: null + ,points: null + ,type: null + ,update: function(line,fill,fillIndex,winding) { + this.updateLine(line); + this.fill = fill; + this.fillIndex = fillIndex; + this.winding = winding; + } + ,updateLine: function(line) { + this.line.width = line.width; + this.line.color = line.color; + this.line.alpha = line.alpha == null ? 1 : line.alpha; + this.line.scaleMode = line.scaleMode == null ? 2 : line.scaleMode; + this.line.caps = line.caps == null ? 1 : line.caps; + this.line.joints = line.joints == null ? 2 : line.joints; + this.line.miterLimit = line.miterLimit; + } + ,__class__: openfl__$internal_renderer_opengl_utils_DrawPath +}; +var openfl__$internal_renderer_opengl_utils_PathBuiler = function() { }; +$hxClasses["openfl._internal.renderer.opengl.utils.PathBuiler"] = openfl__$internal_renderer_opengl_utils_PathBuiler; +openfl__$internal_renderer_opengl_utils_PathBuiler.__name__ = ["openfl","_internal","renderer","opengl","utils","PathBuiler"]; +openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath = null; +openfl__$internal_renderer_opengl_utils_PathBuiler.__drawPaths = null; +openfl__$internal_renderer_opengl_utils_PathBuiler.__line = null; +openfl__$internal_renderer_opengl_utils_PathBuiler.__fill = null; +openfl__$internal_renderer_opengl_utils_PathBuiler.closePath = function() { + var l = openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points == null ? 0 : openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points.length; + if(l <= 0) { + return; + } + if(openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.type == openfl__$internal_renderer_opengl_utils_GraphicType.Polygon && openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.fill != openfl__$internal_renderer_opengl_utils_FillType.None) { + var sx = openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points[0]; + var sy = openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points[1]; + var ex = openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points[l - 2]; + var ey = openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points[l - 1]; + if(!(sx == ex && sy == ey)) { + openfl__$internal_renderer_opengl_utils_PathBuiler.lineTo(sx,sy); + } + } +}; +openfl__$internal_renderer_opengl_utils_PathBuiler.endFill = function() { + openfl__$internal_renderer_opengl_utils_PathBuiler.__fill = openfl__$internal_renderer_opengl_utils_FillType.None; + openfl__$internal_renderer_opengl_utils_PathBuiler.__fillIndex++; +}; +openfl__$internal_renderer_opengl_utils_PathBuiler.moveTo = function(x,y) { + openfl__$internal_renderer_opengl_utils_PathBuiler.graphicDataPop(); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath = new openfl__$internal_renderer_opengl_utils_DrawPath(); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.update(openfl__$internal_renderer_opengl_utils_PathBuiler.__line,openfl__$internal_renderer_opengl_utils_PathBuiler.__fill,openfl__$internal_renderer_opengl_utils_PathBuiler.__fillIndex,openfl__$internal_renderer_opengl_utils_PathBuiler.__currentWinding); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.type = openfl__$internal_renderer_opengl_utils_GraphicType.Polygon; + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points.push(x); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points.push(y); + openfl__$internal_renderer_opengl_utils_PathBuiler.__drawPaths.push(openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath); +}; +openfl__$internal_renderer_opengl_utils_PathBuiler.lineTo = function(x,y) { + var points = openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points; + var push_point = true; + if(points.length > 1) { + var lastX = points[points.length - 2]; + var lastY = points[points.length - 1]; + if(lastX == x && lastY == y) { + push_point = false; + } + } + if(push_point == true) { + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points.push(x); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points.push(y); + } +}; +openfl__$internal_renderer_opengl_utils_PathBuiler.curveTo = function(cx,cy,x,y) { + if(openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points == null || openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points.length == 0) { + openfl__$internal_renderer_opengl_utils_PathBuiler.moveTo(0,0); + } + openfl__$internal_renderer_GraphicsPaths.curveTo(openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points,cx,cy,x,y); +}; +openfl__$internal_renderer_opengl_utils_PathBuiler.cubicCurveTo = function(cx,cy,cx2,cy2,x,y) { + if(openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points == null || openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points.length == 0) { + openfl__$internal_renderer_opengl_utils_PathBuiler.moveTo(0,0); + } + openfl__$internal_renderer_GraphicsPaths.cubicCurveTo(openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points,cx,cy,cx2,cy2,x,y); +}; +openfl__$internal_renderer_opengl_utils_PathBuiler.graphicDataPop = function() { + if(openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.isRemovable && (openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points == null || openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points.length == 0)) { + openfl__$internal_renderer_opengl_utils_PathBuiler.__drawPaths.pop(); + } else { + openfl__$internal_renderer_opengl_utils_PathBuiler.closePath(); + } +}; +openfl__$internal_renderer_opengl_utils_PathBuiler.build = function(graphics,gl) { + var glStack = null; + var bounds = graphics.__bounds; + openfl__$internal_renderer_opengl_utils_PathBuiler.__drawPaths = []; + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath = new openfl__$internal_renderer_opengl_utils_DrawPath(); + openfl__$internal_renderer_opengl_utils_PathBuiler.__line = new openfl__$internal_renderer_opengl_utils_LineStyle(); + openfl__$internal_renderer_opengl_utils_PathBuiler.__fill = openfl__$internal_renderer_opengl_utils_FillType.None; + openfl__$internal_renderer_opengl_utils_PathBuiler.__fillIndex = 0; + glStack = graphics.__glStack[openfl__$internal_renderer_opengl_GLRenderer.glContextId]; + if(glStack == null) { + glStack = graphics.__glStack[openfl__$internal_renderer_opengl_GLRenderer.glContextId] = new openfl__$internal_renderer_opengl_utils_GLStack(gl); + } + if(!(!graphics.__visible || graphics.__commands.get_length() == 0 || bounds == null || bounds.width == 0 || bounds.height == 0)) { + var data = new openfl__$internal_renderer_DrawCommandReader(graphics.__commands); + var _g = 0; + var _g1 = graphics.__commands.types; + while(_g < _g1.length) { + var type = _g1[_g]; + ++_g; + switch(Type.enumIndex(type)) { + case 0: + var c = data.readBeginBitmapFill(); + openfl__$internal_renderer_opengl_utils_PathBuiler.endFill(); + openfl__$internal_renderer_opengl_utils_PathBuiler.__fill = openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_bitmap(c) != null ? openfl__$internal_renderer_opengl_utils_FillType.Texture(openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_bitmap(c),openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_matrix(c),openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_repeat(c),openfl__$internal_renderer__$DrawCommandReader_BeginBitmapFillView_$Impl_$.get_smooth(c)) : openfl__$internal_renderer_opengl_utils_FillType.None; + if(openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points == null || openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points.length == 0) { + openfl__$internal_renderer_opengl_utils_PathBuiler.graphicDataPop(); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath = new openfl__$internal_renderer_opengl_utils_DrawPath(); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.update(openfl__$internal_renderer_opengl_utils_PathBuiler.__line,openfl__$internal_renderer_opengl_utils_PathBuiler.__fill,openfl__$internal_renderer_opengl_utils_PathBuiler.__fillIndex,openfl__$internal_renderer_opengl_utils_PathBuiler.__currentWinding); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points = []; + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.type = openfl__$internal_renderer_opengl_utils_GraphicType.Polygon; + openfl__$internal_renderer_opengl_utils_PathBuiler.__drawPaths.push(openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath); + } + break; + case 1: + var c1 = data.readBeginFill(); + openfl__$internal_renderer_opengl_utils_PathBuiler.endFill(); + openfl__$internal_renderer_opengl_utils_PathBuiler.__fill = openfl__$internal_renderer__$DrawCommandReader_BeginFillView_$Impl_$.get_alpha(c1) > 0 ? openfl__$internal_renderer_opengl_utils_FillType.Color(openfl__$internal_renderer__$DrawCommandReader_BeginFillView_$Impl_$.get_color(c1) & 16777215,openfl__$internal_renderer__$DrawCommandReader_BeginFillView_$Impl_$.get_alpha(c1)) : openfl__$internal_renderer_opengl_utils_FillType.None; + if(openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points == null || openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points.length == 0) { + openfl__$internal_renderer_opengl_utils_PathBuiler.graphicDataPop(); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath = new openfl__$internal_renderer_opengl_utils_DrawPath(); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.update(openfl__$internal_renderer_opengl_utils_PathBuiler.__line,openfl__$internal_renderer_opengl_utils_PathBuiler.__fill,openfl__$internal_renderer_opengl_utils_PathBuiler.__fillIndex,openfl__$internal_renderer_opengl_utils_PathBuiler.__currentWinding); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points = []; + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.type = openfl__$internal_renderer_opengl_utils_GraphicType.Polygon; + openfl__$internal_renderer_opengl_utils_PathBuiler.__drawPaths.push(openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath); + } + break; + case 3: + var c2 = data.readCubicCurveTo(); + openfl__$internal_renderer_opengl_utils_PathBuiler.cubicCurveTo(openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlX1(c2),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlY1(c2),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlX2(c2),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_controlY2(c2),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_anchorX(c2),openfl__$internal_renderer__$DrawCommandReader_CubicCurveToView_$Impl_$.get_anchorY(c2)); + break; + case 4: + var c3 = data.readCurveTo(); + openfl__$internal_renderer_opengl_utils_PathBuiler.curveTo(openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_controlX(c3),openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_controlY(c3),openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_anchorX(c3),openfl__$internal_renderer__$DrawCommandReader_CurveToView_$Impl_$.get_anchorY(c3)); + break; + case 5: + var c4 = data.readDrawCircle(); + openfl__$internal_renderer_opengl_utils_PathBuiler.graphicDataPop(); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath = new openfl__$internal_renderer_opengl_utils_DrawPath(); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.update(openfl__$internal_renderer_opengl_utils_PathBuiler.__line,openfl__$internal_renderer_opengl_utils_PathBuiler.__fill,openfl__$internal_renderer_opengl_utils_PathBuiler.__fillIndex,openfl__$internal_renderer_opengl_utils_PathBuiler.__currentWinding); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.type = openfl__$internal_renderer_opengl_utils_GraphicType.Circle; + var tmp = openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_x(c4); + var tmp1 = openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_y(c4); + var tmp2 = openfl__$internal_renderer__$DrawCommandReader_DrawCircleView_$Impl_$.get_radius(c4); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points = [tmp,tmp1,tmp2]; + openfl__$internal_renderer_opengl_utils_PathBuiler.__drawPaths.push(openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath); + break; + case 6: + var c5 = data.readDrawEllipse(); + openfl__$internal_renderer_opengl_utils_PathBuiler.graphicDataPop(); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath = new openfl__$internal_renderer_opengl_utils_DrawPath(); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.update(openfl__$internal_renderer_opengl_utils_PathBuiler.__line,openfl__$internal_renderer_opengl_utils_PathBuiler.__fill,openfl__$internal_renderer_opengl_utils_PathBuiler.__fillIndex,openfl__$internal_renderer_opengl_utils_PathBuiler.__currentWinding); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.type = openfl__$internal_renderer_opengl_utils_GraphicType.Ellipse; + var tmp3 = openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_x(c5); + var tmp4 = openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_y(c5); + var tmp5 = openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_width(c5); + var tmp6 = openfl__$internal_renderer__$DrawCommandReader_DrawEllipseView_$Impl_$.get_height(c5); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points = [tmp3,tmp4,tmp5,tmp6]; + openfl__$internal_renderer_opengl_utils_PathBuiler.__drawPaths.push(openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath); + break; + case 7: + var c6 = data.readDrawPath(); + openfl__$internal_renderer_opengl_utils_PathBuiler.graphicDataPop(); + var _g2 = openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.get_winding(c6); + switch(_g2) { + case "evenOdd": + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentWinding = 0; + break; + case "nonZero": + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentWinding = 1; + break; + default: + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentWinding = 0; + } + var command; + var cx; + var cy; + var cx2; + var cy2; + var ax; + var ay; + var idx = 0; + var _g4 = 0; + var _g3 = openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.get_commands(c6).length; + while(_g4 < _g3) { + var i = _g4++; + command = openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.get_commands(c6).data[i]; + switch(command) { + case 1: + ax = openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.get_data(c6).data[idx]; + ay = openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.get_data(c6).data[idx + 1]; + idx += 2; + openfl__$internal_renderer_opengl_utils_PathBuiler.moveTo(ax,ay); + break; + case 2: + ax = openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.get_data(c6).data[idx]; + ay = openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.get_data(c6).data[idx + 1]; + idx += 2; + openfl__$internal_renderer_opengl_utils_PathBuiler.lineTo(ax,ay); + break; + case 3: + cx = openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.get_data(c6).data[idx]; + cy = openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.get_data(c6).data[idx + 1]; + ax = openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.get_data(c6).data[idx + 2]; + ay = openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.get_data(c6).data[idx + 3]; + idx += 4; + openfl__$internal_renderer_opengl_utils_PathBuiler.curveTo(cx,cy,ax,ay); + break; + case 4: + ax = openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.get_data(c6).data[idx + 2]; + ay = openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.get_data(c6).data[idx + 3]; + idx += 4; + openfl__$internal_renderer_opengl_utils_PathBuiler.moveTo(ax,ay); + break; + case 5: + ax = openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.get_data(c6).data[idx + 2]; + ay = openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.get_data(c6).data[idx + 3]; + idx += 4; + openfl__$internal_renderer_opengl_utils_PathBuiler.lineTo(ax,ay); + break; + case 6: + cx = openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.get_data(c6).data[idx]; + cy = openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.get_data(c6).data[idx + 1]; + cx2 = openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.get_data(c6).data[idx + 2]; + cy2 = openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.get_data(c6).data[idx + 3]; + ax = openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.get_data(c6).data[idx + 4]; + ay = openfl__$internal_renderer__$DrawCommandReader_DrawPathView_$Impl_$.get_data(c6).data[idx + 5]; + idx += 6; + openfl__$internal_renderer_opengl_utils_PathBuiler.cubicCurveTo(cx,cy,cx2,cy2,ax,ay); + break; + default: + } + } + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentWinding = 0; + break; + case 8: + var c7 = data.readDrawRect(); + openfl__$internal_renderer_opengl_utils_PathBuiler.graphicDataPop(); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath = new openfl__$internal_renderer_opengl_utils_DrawPath(); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.update(openfl__$internal_renderer_opengl_utils_PathBuiler.__line,openfl__$internal_renderer_opengl_utils_PathBuiler.__fill,openfl__$internal_renderer_opengl_utils_PathBuiler.__fillIndex,openfl__$internal_renderer_opengl_utils_PathBuiler.__currentWinding); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.type = openfl__$internal_renderer_opengl_utils_GraphicType.Rectangle(false); + var tmp7 = openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_x(c7); + var tmp8 = openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_y(c7); + var tmp9 = openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_width(c7); + var tmp10 = openfl__$internal_renderer__$DrawCommandReader_DrawRectView_$Impl_$.get_height(c7); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points = [tmp7,tmp8,tmp9,tmp10]; + openfl__$internal_renderer_opengl_utils_PathBuiler.__drawPaths.push(openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath); + break; + case 9: + var c8 = data.readDrawRoundRect(); + var x = openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_x(c8); + var y = openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_y(c8); + var width = openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_width(c8); + var height = openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_height(c8); + var rx = openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_ellipseWidth(c8); + var ry = openfl__$internal_renderer__$DrawCommandReader_DrawRoundRectView_$Impl_$.get_ellipseHeight(c8); + if(ry == null) { + ry = rx; + } + rx *= 0.5; + ry *= 0.5; + if(rx > width / 2) { + rx = width / 2; + } + if(ry > height / 2) { + ry = height / 2; + } + openfl__$internal_renderer_opengl_utils_PathBuiler.graphicDataPop(); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath = new openfl__$internal_renderer_opengl_utils_DrawPath(); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.update(openfl__$internal_renderer_opengl_utils_PathBuiler.__line,openfl__$internal_renderer_opengl_utils_PathBuiler.__fill,openfl__$internal_renderer_opengl_utils_PathBuiler.__fillIndex,openfl__$internal_renderer_opengl_utils_PathBuiler.__currentWinding); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.type = openfl__$internal_renderer_opengl_utils_GraphicType.Rectangle(true); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points = [x,y,width,height,rx,ry]; + openfl__$internal_renderer_opengl_utils_PathBuiler.__drawPaths.push(openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath); + break; + case 10: + var c9 = data.readDrawTiles(); + openfl__$internal_renderer_opengl_utils_PathBuiler.graphicDataPop(); + openfl__$internal_renderer_opengl_utils_PathBuiler.__fillIndex++; + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath = new openfl__$internal_renderer_opengl_utils_DrawPath(false); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.update(openfl__$internal_renderer_opengl_utils_PathBuiler.__line,openfl__$internal_renderer_opengl_utils_PathBuiler.__fill,openfl__$internal_renderer_opengl_utils_PathBuiler.__fillIndex,openfl__$internal_renderer_opengl_utils_PathBuiler.__currentWinding); + var tmp11 = openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_sheet(c9); + var tmp12 = openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_tileData(c9); + var tmp13 = openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_smooth(c9); + var tmp14 = openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_flags(c9); + var tmp15 = openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_shader(c9); + var tmp16 = openfl__$internal_renderer__$DrawCommandReader_DrawTilesView_$Impl_$.get_count(c9); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.type = openfl__$internal_renderer_opengl_utils_GraphicType.DrawTiles(tmp11,tmp12,tmp13,tmp14,tmp15,tmp16); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.isRemovable = false; + openfl__$internal_renderer_opengl_utils_PathBuiler.__drawPaths.push(openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath); + break; + case 11: + var c10 = data.readDrawTriangles(); + var uvtData = openfl__$internal_renderer__$DrawCommandReader_DrawTrianglesView_$Impl_$.get_uvtData(c10); + var vertices = openfl__$internal_renderer__$DrawCommandReader_DrawTrianglesView_$Impl_$.get_vertices(c10); + var indices = openfl__$internal_renderer__$DrawCommandReader_DrawTrianglesView_$Impl_$.get_indices(c10); + var culling = openfl__$internal_renderer__$DrawCommandReader_DrawTrianglesView_$Impl_$.get_culling(c10); + var isColor; + var _g21 = openfl__$internal_renderer_opengl_utils_PathBuiler.__fill; + if(Type.enumIndex(_g21) == 1) { + isColor = true; + } else { + isColor = false; + } + if(isColor && uvtData != null) { + continue; + } + openfl__$internal_renderer_opengl_utils_PathBuiler.graphicDataPop(); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath = new openfl__$internal_renderer_opengl_utils_DrawPath(); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.update(openfl__$internal_renderer_opengl_utils_PathBuiler.__line,openfl__$internal_renderer_opengl_utils_PathBuiler.__fill,openfl__$internal_renderer_opengl_utils_PathBuiler.__fillIndex,openfl__$internal_renderer_opengl_utils_PathBuiler.__currentWinding); + if(uvtData == null) { + var this1 = new openfl_VectorData(); + var this2 = new Array(0); + this1.data = this2; + this1.length = 0; + this1.fixed = false; + uvtData = this1; + var _g31 = openfl__$internal_renderer_opengl_utils_PathBuiler.__fill; + if(Type.enumIndex(_g31) == 2) { + var b = _g31[2]; + var _g41 = 0; + var _g32 = Std["int"](vertices.length / 2); + while(_g41 < _g32) { + var i1 = _g41++; + var x1 = vertices.data[i1 * 2] / b.width; + if(!uvtData.fixed) { + uvtData.length++; + if(uvtData.data.length < uvtData.length) { + var length = uvtData.data.length + 10; + var this3 = new Array(length); + var data1 = this3; + haxe_ds__$Vector_Vector_$Impl_$.blit(uvtData.data,0,data1,0,uvtData.data.length); + uvtData.data = data1; + } + uvtData.data[uvtData.length - 1] = x1; + } + var x2 = vertices.data[i1 * 2 + 1] / b.height; + if(!uvtData.fixed) { + uvtData.length++; + if(uvtData.data.length < uvtData.length) { + var length1 = uvtData.data.length + 10; + var this4 = new Array(length1); + var data2 = this4; + haxe_ds__$Vector_Vector_$Impl_$.blit(uvtData.data,0,data2,0,uvtData.data.length); + uvtData.data = data2; + } + uvtData.data[uvtData.length - 1] = x2; + } + } + } + } + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.type = openfl__$internal_renderer_opengl_utils_GraphicType.DrawTriangles(vertices,indices,uvtData,culling,null,0); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.isRemovable = false; + openfl__$internal_renderer_opengl_utils_PathBuiler.__drawPaths.push(openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath); + break; + case 12: + var c11 = data.readEndFill(); + openfl__$internal_renderer_opengl_utils_PathBuiler.endFill(); + break; + case 15: + var c12 = data.readLineStyle(); + openfl__$internal_renderer_opengl_utils_PathBuiler.__line = new openfl__$internal_renderer_opengl_utils_LineStyle(); + if(openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_thickness(c12) == null || isNaN(openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_thickness(c12)) || openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_thickness(c12) < 0) { + openfl__$internal_renderer_opengl_utils_PathBuiler.__line.width = 0; + } else if(openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_thickness(c12) == 0) { + openfl__$internal_renderer_opengl_utils_PathBuiler.__line.width = 1; + } else { + openfl__$internal_renderer_opengl_utils_PathBuiler.__line.width = openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_thickness(c12); + } + openfl__$internal_renderer_opengl_utils_PathBuiler.graphicDataPop(); + openfl__$internal_renderer_opengl_utils_PathBuiler.__line.color = openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_color(c12); + openfl__$internal_renderer_opengl_utils_PathBuiler.__line.alpha = openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_alpha(c12); + openfl__$internal_renderer_opengl_utils_PathBuiler.__line.scaleMode = openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_scaleMode(c12); + openfl__$internal_renderer_opengl_utils_PathBuiler.__line.caps = openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_caps(c12); + openfl__$internal_renderer_opengl_utils_PathBuiler.__line.joints = openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_joints(c12); + openfl__$internal_renderer_opengl_utils_PathBuiler.__line.miterLimit = openfl__$internal_renderer__$DrawCommandReader_LineStyleView_$Impl_$.get_miterLimit(c12); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath = new openfl__$internal_renderer_opengl_utils_DrawPath(); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.update(openfl__$internal_renderer_opengl_utils_PathBuiler.__line,openfl__$internal_renderer_opengl_utils_PathBuiler.__fill,openfl__$internal_renderer_opengl_utils_PathBuiler.__fillIndex,openfl__$internal_renderer_opengl_utils_PathBuiler.__currentWinding); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.points = []; + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.type = openfl__$internal_renderer_opengl_utils_GraphicType.Polygon; + openfl__$internal_renderer_opengl_utils_PathBuiler.__drawPaths.push(openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath); + break; + case 16: + var c13 = data.readLineTo(); + openfl__$internal_renderer_opengl_utils_PathBuiler.lineTo(openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.get_x(c13),openfl__$internal_renderer__$DrawCommandReader_LineToView_$Impl_$.get_y(c13)); + break; + case 17: + var c14 = data.readMoveTo(); + openfl__$internal_renderer_opengl_utils_PathBuiler.moveTo(openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_x(c14),openfl__$internal_renderer__$DrawCommandReader_MoveToView_$Impl_$.get_y(c14)); + break; + case 18: + var c15 = data.readOverrideMatrix(); + openfl__$internal_renderer_opengl_utils_PathBuiler.graphicDataPop(); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath = new openfl__$internal_renderer_opengl_utils_DrawPath(); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.update(openfl__$internal_renderer_opengl_utils_PathBuiler.__line,openfl__$internal_renderer_opengl_utils_PathBuiler.__fill,openfl__$internal_renderer_opengl_utils_PathBuiler.__fillIndex,openfl__$internal_renderer_opengl_utils_PathBuiler.__currentWinding); + var tmp17 = openfl__$internal_renderer__$DrawCommandReader_OverrideMatrixView_$Impl_$.get_matrix(c15); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.type = openfl__$internal_renderer_opengl_utils_GraphicType.OverrideMatrix(tmp17); + openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath.isRemovable = false; + openfl__$internal_renderer_opengl_utils_PathBuiler.__drawPaths.push(openfl__$internal_renderer_opengl_utils_PathBuiler.__currentPath); + break; + default: + data.skip(type); + } + } + openfl__$internal_renderer_opengl_utils_PathBuiler.closePath(); + data.destroy(); + } + graphics.__drawPaths = openfl__$internal_renderer_opengl_utils_PathBuiler.__drawPaths; + return glStack; +}; +var openfl__$internal_renderer_opengl_utils_LineStyle = function() { + this.width = 0; + this.color = 0; + this.alpha = 1; + this.scaleMode = 2; + this.caps = 1; + this.joints = 2; + this.miterLimit = 3; +}; +$hxClasses["openfl._internal.renderer.opengl.utils.LineStyle"] = openfl__$internal_renderer_opengl_utils_LineStyle; +openfl__$internal_renderer_opengl_utils_LineStyle.__name__ = ["openfl","_internal","renderer","opengl","utils","LineStyle"]; +openfl__$internal_renderer_opengl_utils_LineStyle.prototype = { + width: null + ,color: null + ,alpha: null + ,scaleMode: null + ,caps: null + ,joints: null + ,miterLimit: null + ,__class__: openfl__$internal_renderer_opengl_utils_LineStyle +}; +var openfl__$internal_renderer_opengl_utils_FillType = $hxClasses["openfl._internal.renderer.opengl.utils.FillType"] = { __ename__ : ["openfl","_internal","renderer","opengl","utils","FillType"], __constructs__ : ["None","Color","Texture","Gradient"] }; +openfl__$internal_renderer_opengl_utils_FillType.None = ["None",0]; +openfl__$internal_renderer_opengl_utils_FillType.None.toString = $estr; +openfl__$internal_renderer_opengl_utils_FillType.None.__enum__ = openfl__$internal_renderer_opengl_utils_FillType; +openfl__$internal_renderer_opengl_utils_FillType.Color = function(color,alpha) { var $x = ["Color",1,color,alpha]; $x.__enum__ = openfl__$internal_renderer_opengl_utils_FillType; $x.toString = $estr; return $x; }; +openfl__$internal_renderer_opengl_utils_FillType.Texture = function(bitmap,matrix,repeat,smooth) { var $x = ["Texture",2,bitmap,matrix,repeat,smooth]; $x.__enum__ = openfl__$internal_renderer_opengl_utils_FillType; $x.toString = $estr; return $x; }; +openfl__$internal_renderer_opengl_utils_FillType.Gradient = ["Gradient",3]; +openfl__$internal_renderer_opengl_utils_FillType.Gradient.toString = $estr; +openfl__$internal_renderer_opengl_utils_FillType.Gradient.__enum__ = openfl__$internal_renderer_opengl_utils_FillType; +var openfl__$internal_renderer_opengl_utils_FilterManager = function(gl,transparent) { + this.transparent = transparent; + this.filterStack = []; + this.offsetX = 0; + this.offsetY = 0; + this.setContext(gl); +}; +$hxClasses["openfl._internal.renderer.opengl.utils.FilterManager"] = openfl__$internal_renderer_opengl_utils_FilterManager; +openfl__$internal_renderer_opengl_utils_FilterManager.__name__ = ["openfl","_internal","renderer","opengl","utils","FilterManager"]; +openfl__$internal_renderer_opengl_utils_FilterManager.prototype = { + buffer: null + ,colorArray: null + ,colorBuffer: null + ,defaultShader: null + ,filterStack: null + ,gl: null + ,height: null + ,indexBuffer: null + ,offsetX: null + ,offsetY: null + ,renderSession: null + ,texturePool: null + ,transparent: null + ,uvArray: null + ,uvBuffer: null + ,vertexArray: null + ,vertexBuffer: null + ,width: null + ,begin: function(renderSession,buffer) { + this.renderSession = renderSession; + this.defaultShader = renderSession.shaderManager.defaultShader; + this.width = 0; + this.height = 0; + this.buffer = buffer; + } + ,initShaderBuffers: function() { + var gl = this.gl; + this.vertexBuffer = gl.createBuffer(); + this.uvBuffer = gl.createBuffer(); + this.colorBuffer = gl.createBuffer(); + this.indexBuffer = gl.createBuffer(); + var array = [0.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0]; + var this1; + if(array != null) { + this1 = new Float32Array(array); + } else { + this1 = null; + } + this.vertexArray = this1; + gl.bindBuffer(gl.ARRAY_BUFFER,this.vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER,this.vertexArray,gl.STATIC_DRAW); + var array1 = [0.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0]; + var this2; + if(array1 != null) { + this2 = new Float32Array(array1); + } else { + this2 = null; + } + this.uvArray = this2; + gl.bindBuffer(gl.ARRAY_BUFFER,this.uvBuffer); + gl.bufferData(gl.ARRAY_BUFFER,this.uvArray,gl.STATIC_DRAW); + var array2 = [1.0,16777215,1.0,16777215,1.0,16777215,1.0,16777215]; + var this3; + if(array2 != null) { + this3 = new Float32Array(array2); + } else { + this3 = null; + } + this.colorArray = this3; + gl.bindBuffer(gl.ARRAY_BUFFER,this.colorBuffer); + gl.bufferData(gl.ARRAY_BUFFER,this.colorArray,gl.STATIC_DRAW); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,this.indexBuffer); + var gl1 = gl.ELEMENT_ARRAY_BUFFER; + var array3 = [0,1,2,1,3,2]; + var this4; + if(array3 != null) { + this4 = new Uint16Array(array3); + } else { + this4 = null; + } + gl.bufferData(gl1,this4,gl.STATIC_DRAW); + } + ,setContext: function(gl) { + this.gl = gl; + this.texturePool = []; + this.initShaderBuffers(); + } + ,__class__: openfl__$internal_renderer_opengl_utils_FilterManager +}; +var openfl__$internal_renderer_opengl_utils_GLMaskManager = function(renderSession) { + openfl__$internal_renderer_AbstractMaskManager.call(this,renderSession); + this.setContext(renderSession.gl); + this.clips = []; +}; +$hxClasses["openfl._internal.renderer.opengl.utils.GLMaskManager"] = openfl__$internal_renderer_opengl_utils_GLMaskManager; +openfl__$internal_renderer_opengl_utils_GLMaskManager.__name__ = ["openfl","_internal","renderer","opengl","utils","GLMaskManager"]; +openfl__$internal_renderer_opengl_utils_GLMaskManager.__super__ = openfl__$internal_renderer_AbstractMaskManager; +openfl__$internal_renderer_opengl_utils_GLMaskManager.prototype = $extend(openfl__$internal_renderer_AbstractMaskManager.prototype,{ + gl: null + ,clips: null + ,currentClip: null + ,savedClip: null + ,pushRect: function(rect,transform) { + if(rect == null) { + return; + } + var m = transform.clone(); + openfl__$internal_renderer_opengl_GLBitmap.flipMatrix(m,this.renderSession.renderer.viewport.height); + var clip = rect.clone(); + clip.__transform(clip,m); + if(this.currentClip != null) { + clip = this.currentClip.intersection(clip); + } + var restartBatch = this.currentClip == null || clip.isEmpty() || this.currentClip.containsRect(clip); + this.clips.push(clip); + this.currentClip = clip; + if(restartBatch) { + this.renderSession.spriteBatch.stop(); + this.renderSession.spriteBatch.start(this.currentClip); + } + } + ,pushMask: function(mask) { + this.renderSession.spriteBatch.stop(); + this.renderSession.stencilManager.pushMask(mask,this.renderSession); + this.renderSession.spriteBatch.start(this.currentClip); + } + ,popMask: function() { + this.renderSession.spriteBatch.stop(); + this.renderSession.stencilManager.popMask(null,this.renderSession); + this.renderSession.spriteBatch.start(this.currentClip); + } + ,popRect: function() { + this.renderSession.spriteBatch.stop(); + this.clips.pop(); + this.currentClip = this.clips[this.clips.length - 1]; + this.renderSession.spriteBatch.start(this.currentClip); + } + ,saveState: function() { + this.savedClip = this.currentClip; + this.currentClip = null; + } + ,restoreState: function() { + this.currentClip = this.savedClip; + this.savedClip = null; + } + ,setContext: function(gl) { + if(this.renderSession != null) { + this.renderSession.gl = gl; + } + this.gl = gl; + } + ,__class__: openfl__$internal_renderer_opengl_utils_GLMaskManager +}); +var openfl__$internal_renderer_opengl_utils_VertexAttribute = function(components,type,normalized,name,defaultValue) { + if(normalized == null) { + normalized = false; + } + this.enabled = true; + this.normalized = false; + this.components = components; + this.type = type; + this.normalized = normalized; + this.name = name; + if(defaultValue == null) { + var this1; + if(components != null) { + this1 = new Float32Array(components); + } else { + this1 = null; + } + this.defaultValue = this1; + } else { + this.defaultValue = defaultValue; + } +}; +$hxClasses["openfl._internal.renderer.opengl.utils.VertexAttribute"] = openfl__$internal_renderer_opengl_utils_VertexAttribute; +openfl__$internal_renderer_opengl_utils_VertexAttribute.__name__ = ["openfl","_internal","renderer","opengl","utils","VertexAttribute"]; +openfl__$internal_renderer_opengl_utils_VertexAttribute.prototype = { + components: null + ,normalized: null + ,type: null + ,name: null + ,enabled: null + ,defaultValue: null + ,copy: function() { + return new openfl__$internal_renderer_opengl_utils_VertexAttribute(this.components,this.type,this.normalized,this.name,this.defaultValue); + } + ,getElementsBytes: function() { + var _g = this.type; + switch(_g) { + case 5120:case 5121: + return 1; + case 5122:case 5123: + return 2; + default: + return 4; + } + } + ,get_elements: function() { + return Math.floor(this.components * this.getElementsBytes() / 4); + } + ,__class__: openfl__$internal_renderer_opengl_utils_VertexAttribute + ,__properties__: {get_elements:"get_elements"} +}; +var openfl__$internal_renderer_opengl_utils_GraphicsRenderer = function() { }; +$hxClasses["openfl._internal.renderer.opengl.utils.GraphicsRenderer"] = openfl__$internal_renderer_opengl_utils_GraphicsRenderer; +openfl__$internal_renderer_opengl_utils_GraphicsRenderer.__name__ = ["openfl","_internal","renderer","opengl","utils","GraphicsRenderer"]; +openfl__$internal_renderer_opengl_utils_GraphicsRenderer.overrideMatrix = null; +openfl__$internal_renderer_opengl_utils_GraphicsRenderer.buildCircle = function(path,glStack,localCoords) { + if(localCoords == null) { + localCoords = false; + } + var rectData = path.points; + var x = rectData[0]; + var y = rectData[1]; + var rx = rectData[2]; + var ry = rectData.length == 3 ? rx : rectData[3]; + if(path.type == openfl__$internal_renderer_opengl_utils_GraphicType.Ellipse) { + rx /= 2; + ry /= 2; + x += rx; + y += ry; + } + if(localCoords) { + x -= openfl__$internal_renderer_opengl_utils_GraphicsRenderer.objectBounds.x; + y -= openfl__$internal_renderer_opengl_utils_GraphicsRenderer.objectBounds.y; + } + var totalSegs = 40; + var seg = Math.PI * 2 / totalSegs; + var bucket = openfl__$internal_renderer_opengl_utils_GraphicsRenderer.prepareBucket(path,glStack); + var fill = bucket.getData(openfl__$internal_renderer_opengl_utils_BucketDataType.Fill); + if(fill != null) { + var verts = fill.verts; + var indices = fill.indices; + var vertPos = Std["int"](verts.length / 2); + indices.push(vertPos); + var _g1 = 0; + var _g = totalSegs + 1; + while(_g1 < _g) { + var i = _g1++; + verts.push(x); + verts.push(y); + verts.push(x + Math.sin(seg * i) * rx); + verts.push(y + Math.cos(seg * i) * ry); + indices.push(vertPos++); + indices.push(vertPos++); + } + indices.push(vertPos - 1); + } + if(path.line.width > 0) { + var tempPoints = path.points; + path.points = []; + openfl__$internal_renderer_GraphicsPaths.ellipse(path.points,x,y,rx,ry,totalSegs); + openfl__$internal_renderer_opengl_utils_GraphicsRenderer.buildLine(path,bucket); + path.points = tempPoints; + } +}; +openfl__$internal_renderer_opengl_utils_GraphicsRenderer.buildComplexPoly = function(path,glStack,localCoords) { + if(localCoords == null) { + localCoords = false; + } + var bucket = null; + if(path.points.length >= 6) { + var points = path.points.slice(); + if(localCoords) { + var _g1 = 0; + var _g = Std["int"](points.length / 2); + while(_g1 < _g) { + var i = _g1++; + points[i * 2] -= openfl__$internal_renderer_opengl_utils_GraphicsRenderer.objectBounds.x; + points[i * 2 + 1] -= openfl__$internal_renderer_opengl_utils_GraphicsRenderer.objectBounds.y; + } + } + bucket = openfl__$internal_renderer_opengl_utils_GraphicsRenderer.prepareBucket(path,glStack); + var fill = bucket.getData(openfl__$internal_renderer_opengl_utils_BucketDataType.Fill); + fill.drawMode = glStack.gl.TRIANGLE_FAN; + fill.verts = points; + var indices = fill.indices; + var length = Std["int"](points.length / 2); + var _g11 = 0; + var _g2 = length; + while(_g11 < _g2) { + var i1 = _g11++; + indices.push(i1); + } + } + if(path.line.width > 0) { + if(bucket == null) { + bucket = openfl__$internal_renderer_opengl_utils_GraphicsRenderer.prepareBucket(path,glStack); + } + openfl__$internal_renderer_opengl_utils_GraphicsRenderer.buildLine(path,bucket,localCoords); + } +}; +openfl__$internal_renderer_opengl_utils_GraphicsRenderer.buildLine = function(path,bucket,localCoords) { + if(localCoords == null) { + localCoords = false; + } + var points = path.points; + if(points.length == 0) { + return; + } + var line = bucket.getData(openfl__$internal_renderer_opengl_utils_BucketDataType.Line); + if(localCoords) { + var _g1 = 0; + var _g = Std["int"](points.length / 2); + while(_g1 < _g) { + var i = _g1++; + points[i * 2] -= openfl__$internal_renderer_opengl_utils_GraphicsRenderer.objectBounds.x; + points[i * 2 + 1] -= openfl__$internal_renderer_opengl_utils_GraphicsRenderer.objectBounds.y; + } + } + var firstPoint = new openfl_geom_Point(points[0],points[1]); + var lastPoint = new openfl_geom_Point(points[Std["int"](points.length - 2)],points[Std["int"](points.length - 1)]); + if(firstPoint.x == lastPoint.x && firstPoint.y == lastPoint.y) { + points = points.slice(); + points.pop(); + points.pop(); + lastPoint = new openfl_geom_Point(points[Std["int"](points.length - 2)],points[Std["int"](points.length - 1)]); + var midPointX = lastPoint.x + (firstPoint.x - lastPoint.x) * 0.5; + var midPointY = lastPoint.y + (firstPoint.y - lastPoint.y) * 0.5; + points.unshift(midPointY); + points.unshift(midPointX); + points.push(midPointX); + points.push(midPointY); + } + var verts = line.verts; + var indices = line.indices; + var length = Std["int"](points.length / 2); + var indexCount = points.length; + var indexStart = Std["int"](verts.length / 6); + var width = path.line.width / 2; + var color = openfl__$internal_renderer_opengl_utils_GraphicsRenderer.hex2rgb(path.line.color); + var alpha = path.line.alpha; + var r = color[0]; + var g = color[1]; + var b = color[2]; + var px; + var py; + var p1x; + var p1y; + var p2x; + var p2y; + var p3x; + var p3y; + var perpx; + var perpy; + var perp2x; + var perp2y; + var perp3x; + var perp3y; + var a1; + var b1; + var c1; + var a2; + var b2; + var c2; + var denom; + var pdist; + var dist; + p1x = points[0]; + p1y = points[1]; + p2x = points[2]; + p2y = points[3]; + perpx = -(p1y - p2y); + perpy = p1x - p2x; + dist = Math.sqrt(Math.abs(perpx * perpx + perpy * perpy)); + perpx /= dist; + perpy /= dist; + perpx *= width; + perpy *= width; + verts.push(p1x - perpx); + verts.push(p1y - perpy); + verts.push(r); + verts.push(g); + verts.push(b); + verts.push(alpha); + verts.push(p1x + perpx); + verts.push(p1y + perpy); + verts.push(r); + verts.push(g); + verts.push(b); + verts.push(alpha); + var _g11 = 1; + var _g2 = length - 1; + while(_g11 < _g2) { + var i1 = _g11++; + p1x = points[(i1 - 1) * 2]; + p1y = points[(i1 - 1) * 2 + 1]; + p2x = points[i1 * 2]; + p2y = points[i1 * 2 + 1]; + p3x = points[(i1 + 1) * 2]; + p3y = points[(i1 + 1) * 2 + 1]; + perpx = -(p1y - p2y); + perpy = p1x - p2x; + dist = Math.sqrt(Math.abs(perpx * perpx + perpy * perpy)); + perpx /= dist; + perpy /= dist; + perpx *= width; + perpy *= width; + perp2x = -(p2y - p3y); + perp2y = p2x - p3x; + dist = Math.sqrt(Math.abs(perp2x * perp2x + perp2y * perp2y)); + perp2x /= dist; + perp2y /= dist; + perp2x *= width; + perp2y *= width; + a1 = -perpy + p1y - (-perpy + p2y); + b1 = -perpx + p2x - (-perpx + p1x); + c1 = (-perpx + p1x) * (-perpy + p2y) - (-perpx + p2x) * (-perpy + p1y); + a2 = -perp2y + p3y - (-perp2y + p2y); + b2 = -perp2x + p2x - (-perp2x + p3x); + c2 = (-perp2x + p3x) * (-perp2y + p2y) - (-perp2x + p2x) * (-perp2y + p3y); + denom = a1 * b2 - a2 * b1; + if(Math.abs(denom) < 0.1) { + denom += 10.1; + verts.push(p2x - perpx); + verts.push(p2y - perpy); + verts.push(r); + verts.push(g); + verts.push(b); + verts.push(alpha); + verts.push(p2x + perpx); + verts.push(p2y + perpy); + verts.push(r); + verts.push(g); + verts.push(b); + verts.push(alpha); + continue; + } + px = (b1 * c2 - b2 * c1) / denom; + py = (a2 * c1 - a1 * c2) / denom; + pdist = (px - p2x) * (px - p2x) + (py - p2y) + (py - p2y); + if(pdist > 19600) { + perp3x = perpx - perp2x; + perp3y = perpy - perp2y; + dist = Math.sqrt(Math.abs(perp3x * perp3x + perp3y * perp3y)); + perp3x /= dist; + perp3y /= dist; + perp3x *= width; + perp3y *= width; + verts.push(p2x - perp3x); + verts.push(p2y - perp3y); + verts.push(r); + verts.push(g); + verts.push(b); + verts.push(alpha); + verts.push(p2x + perp3x); + verts.push(p2y + perp3y); + verts.push(r); + verts.push(g); + verts.push(b); + verts.push(alpha); + verts.push(p2x - perp3x); + verts.push(p2y - perp3y); + verts.push(r); + verts.push(g); + verts.push(b); + verts.push(alpha); + ++indexCount; + } else { + verts.push(px); + verts.push(py); + verts.push(r); + verts.push(g); + verts.push(b); + verts.push(alpha); + verts.push(p2x - (px - p2x)); + verts.push(p2y - (py - p2y)); + verts.push(r); + verts.push(g); + verts.push(b); + verts.push(alpha); + } + } + p1x = points[(length - 2) * 2]; + p1y = points[(length - 2) * 2 + 1]; + p2x = points[(length - 1) * 2]; + p2y = points[(length - 1) * 2 + 1]; + perpx = -(p1y - p2y); + perpy = p1x - p2x; + dist = Math.sqrt(Math.abs(perpx * perpx + perpy * perpy)); + if(!isFinite(dist)) { + haxe_Log.trace(perpx * perpx + perpy * perpy,{ fileName : "GraphicsRenderer.hx", lineNumber : 407, className : "openfl._internal.renderer.opengl.utils.GraphicsRenderer", methodName : "buildLine"}); + } + perpx /= dist; + perpy /= dist; + perpx *= width; + perpy *= width; + verts.push(p2x - perpx); + verts.push(p2y - perpy); + verts.push(r); + verts.push(g); + verts.push(b); + verts.push(alpha); + verts.push(p2x + perpx); + verts.push(p2y + perpy); + verts.push(r); + verts.push(g); + verts.push(b); + verts.push(alpha); + indices.push(indexStart); + var _g12 = 0; + var _g3 = indexCount; + while(_g12 < _g3) { + var i2 = _g12++; + indices.push(indexStart++); + } + indices.push(indexStart - 1); +}; +openfl__$internal_renderer_opengl_utils_GraphicsRenderer.buildRectangle = function(path,glStack,localCoords) { + if(localCoords == null) { + localCoords = false; + } + var rectData = path.points; + var x = rectData[0]; + var y = rectData[1]; + var width = rectData[2]; + var height = rectData[3]; + if(localCoords) { + x -= openfl__$internal_renderer_opengl_utils_GraphicsRenderer.objectBounds.x; + y -= openfl__$internal_renderer_opengl_utils_GraphicsRenderer.objectBounds.y; + } + var bucket = openfl__$internal_renderer_opengl_utils_GraphicsRenderer.prepareBucket(path,glStack); + var fill = bucket.getData(openfl__$internal_renderer_opengl_utils_BucketDataType.Fill); + if(fill != null) { + var verts = fill.verts; + var indices = fill.indices; + var vertPos = Std["int"](verts.length / 2); + verts.push(x); + verts.push(y); + verts.push(x + width); + verts.push(y); + verts.push(x); + verts.push(y + height); + verts.push(x + width); + verts.push(y + height); + indices.push(vertPos); + indices.push(vertPos); + indices.push(vertPos + 1); + indices.push(vertPos + 2); + indices.push(vertPos + 3); + indices.push(vertPos + 3); + } + if(path.line.width > 0) { + var tempPoints = path.points; + path.points = [x,y,x + width,y,x + width,y + height,x,y + height,x,y]; + openfl__$internal_renderer_opengl_utils_GraphicsRenderer.buildLine(path,bucket); + path.points = tempPoints; + } +}; +openfl__$internal_renderer_opengl_utils_GraphicsRenderer.buildRoundedRectangle = function(path,glStack,localCoords) { + if(localCoords == null) { + localCoords = false; + } + var points = path.points.slice(); + var x = points[0]; + var y = points[1]; + var width = points[2]; + var height = points[3]; + var rx = points[4]; + var ry = points[5]; + if(localCoords) { + x -= openfl__$internal_renderer_opengl_utils_GraphicsRenderer.objectBounds.x; + y -= openfl__$internal_renderer_opengl_utils_GraphicsRenderer.objectBounds.y; + } + var recPoints = []; + openfl__$internal_renderer_GraphicsPaths.roundRectangle(recPoints,x,y,width,height,rx,ry); + var bucket = openfl__$internal_renderer_opengl_utils_GraphicsRenderer.prepareBucket(path,glStack); + var fill = bucket.getData(openfl__$internal_renderer_opengl_utils_BucketDataType.Fill); + if(fill != null) { + var verts = fill.verts; + var indices = fill.indices; + var vecPos = verts.length / 2; + var triangles = []; + openfl__$internal_renderer_PolyK.triangulate(triangles,recPoints); + var i = 0; + while(i < triangles.length) { + indices.push(Std["int"](triangles[i] + vecPos)); + indices.push(Std["int"](triangles[i] + vecPos)); + indices.push(Std["int"](triangles[i + 1] + vecPos)); + indices.push(Std["int"](triangles[i + 2] + vecPos)); + indices.push(Std["int"](triangles[i + 2] + vecPos)); + i += 3; + } + i = 0; + while(i < recPoints.length) { + verts.push(recPoints[i]); + verts.push(recPoints[++i]); + ++i; + } + } + if(path.line.width > 0) { + var tempPoints = path.points; + path.points = recPoints; + openfl__$internal_renderer_opengl_utils_GraphicsRenderer.buildLine(path,bucket); + path.points = tempPoints; + } +}; +openfl__$internal_renderer_opengl_utils_GraphicsRenderer.buildDrawTriangles = function(path,object,glStack,localCoords) { + if(localCoords == null) { + localCoords = false; + } + var args = Type.enumParameters(path.type); + var vertices = args[0]; + var indices = args[1]; + var uvtData = args[2]; + var culling = args[3]; + var colors = args[4]; + var blendMode = args[5]; + var a; + var b; + var c; + var d; + var tx; + var ty; + if(localCoords) { + a = 1.0; + b = 0.0; + c = 0.0; + d = 1.0; + tx = 0.0; + ty = 0.0; + } else { + a = object.__worldTransform.a; + b = object.__worldTransform.b; + c = object.__worldTransform.c; + d = object.__worldTransform.d; + tx = object.__worldTransform.tx; + ty = object.__worldTransform.ty; + } + var hasColors = colors != null && colors.length > 0; + var bucket = openfl__$internal_renderer_opengl_utils_GraphicsRenderer.prepareBucket(path,glStack); + var fill = bucket.getData(openfl__$internal_renderer_opengl_utils_BucketDataType.Fill); + var colorAttrib = fill.vertexArray.attributes[2]; + colorAttrib.enabled = hasColors; + var array = [1,1,1,1]; + var this1; + if(array != null) { + this1 = new Float32Array(array); + } else { + this1 = null; + } + colorAttrib.defaultValue = this1; + fill.rawVerts = true; + fill.glLength = indices.length; + fill.stride = Std["int"](fill.vertexArray.get_stride() / 4); + var vertsLength = fill.glLength * fill.stride; + var verts; + if(fill.glVerts == null || fill.glVerts.length < vertsLength) { + var this2; + if(vertsLength != null) { + this2 = new Float32Array(vertsLength); + } else { + this2 = null; + } + verts = this2; + fill.glVerts = verts; + } else { + verts = fill.glVerts; + } + var buffer = verts.buffer; + var this3; + if(buffer != null) { + this3 = new Uint32Array(buffer,0); + } else { + this3 = null; + } + var glColors = this3; + var v0 = 0; + var v1 = 0; + var v2 = 0; + var i0 = 0; + var i1 = 0; + var i2 = 0; + var x0 = 0.0; + var y0 = 0.0; + var x1 = 0.0; + var y1 = 0.0; + var x2 = 0.0; + var y2 = 0.0; + var idx = 0; + var _g1 = 0; + var _g = Std["int"](indices.length / 3); + while(_g1 < _g) { + var i = _g1++; + i0 = indices.data[i * 3]; + i1 = indices.data[i * 3 + 1]; + i2 = indices.data[i * 3 + 2]; + v0 = i0 * 2; + v1 = i1 * 2; + v2 = i2 * 2; + x0 = vertices.data[v0]; + y0 = vertices.data[v0 + 1]; + x1 = vertices.data[v1]; + y1 = vertices.data[v1 + 1]; + x2 = vertices.data[v2]; + y2 = vertices.data[v2 + 1]; + if(localCoords) { + x0 -= openfl__$internal_renderer_opengl_utils_GraphicsRenderer.objectBounds.x; + y0 -= openfl__$internal_renderer_opengl_utils_GraphicsRenderer.objectBounds.y; + x1 -= openfl__$internal_renderer_opengl_utils_GraphicsRenderer.objectBounds.x; + y1 -= openfl__$internal_renderer_opengl_utils_GraphicsRenderer.objectBounds.y; + x2 -= openfl__$internal_renderer_opengl_utils_GraphicsRenderer.objectBounds.x; + y2 -= openfl__$internal_renderer_opengl_utils_GraphicsRenderer.objectBounds.y; + } + switch(culling) { + case 0: + if(openfl__$internal_renderer_opengl_utils_GraphicsRenderer.isCCW(x0,y0,x1,y1,x2,y2)) { + continue; + } + break; + case 2: + if(!openfl__$internal_renderer_opengl_utils_GraphicsRenderer.isCCW(x0,y0,x1,y1,x2,y2)) { + continue; + } + break; + default: + } + verts[idx++] = a * x0 + c * y0 + tx; + verts[idx++] = b * x0 + d * y0 + ty; + verts[idx++] = uvtData.data[v0]; + verts[idx++] = uvtData.data[v0 + 1]; + if(hasColors) { + glColors[idx++] = colors.data[i0]; + } + verts[idx++] = a * x1 + c * y1 + tx; + verts[idx++] = b * x1 + d * y1 + ty; + verts[idx++] = uvtData.data[v1]; + verts[idx++] = uvtData.data[v1 + 1]; + if(hasColors) { + glColors[idx++] = colors.data[i1]; + } + verts[idx++] = a * x2 + c * y2 + tx; + verts[idx++] = b * x2 + d * y2 + ty; + verts[idx++] = uvtData.data[v2]; + verts[idx++] = uvtData.data[v2 + 1]; + if(hasColors) { + glColors[idx++] = colors.data[i2]; + } + } +}; +openfl__$internal_renderer_opengl_utils_GraphicsRenderer.buildDrawTiles = function(path,glStack) { + openfl__$internal_renderer_opengl_utils_GraphicsRenderer.prepareBucket(path,glStack); +}; +openfl__$internal_renderer_opengl_utils_GraphicsRenderer.render = function(object,renderSession) { + var graphics = object.__graphics; + var bounds = graphics.__bounds; + var spritebatch = renderSession.spriteBatch; + var dirty = graphics.__dirty; + if(!graphics.__visible || graphics.__commands.get_length() == 0 || bounds == null || bounds.width == 0 || bounds.height == 0) { + var _g = 0; + var _g1 = graphics.__glStack; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + if(s != null) { + s.reset(); + } + } + graphics.__glStack.splice(0,graphics.__glStack.length); + return; + } + if(dirty) { + openfl__$internal_renderer_opengl_utils_GraphicsRenderer.updateGraphics(object,object.__graphics,renderSession.gl,object.get_cacheAsBitmap()); + } + openfl__$internal_renderer_opengl_utils_GraphicsRenderer.renderGraphics(object,renderSession,false); +}; +openfl__$internal_renderer_opengl_utils_GraphicsRenderer.renderGraphics = function(object,renderSession,localCoords) { + if(localCoords == null) { + localCoords = false; + } + var graphics = object.__graphics; + var gl = renderSession.gl; + var glStack = graphics.__glStack[openfl__$internal_renderer_opengl_GLRenderer.glContextId]; + if(glStack == null) { + return; + } + var bucket; + var translationMatrix; + if(localCoords) { + translationMatrix = openfl_geom_Matrix.__identity; + } else { + translationMatrix = object.__worldTransform; + } + var clipRect = renderSession.spriteBatch.clipRect; + var batchDrawing = renderSession.spriteBatch.drawing; + batchDrawing = renderSession.spriteBatch.drawing; + var _g1 = 0; + var _g = glStack.buckets.length; + while(_g1 < _g) { + var i = _g1++; + batchDrawing = renderSession.spriteBatch.drawing; + if(batchDrawing && !localCoords) { + renderSession.spriteBatch.finish(); + } + renderSession.blendModeManager.setBlendMode(object.__blendMode); + if(clipRect != null) { + gl.enable(gl.SCISSOR_TEST); + gl.scissor(Math.floor(clipRect.x),Math.floor(clipRect.y),Math.floor(clipRect.width),Math.floor(clipRect.height)); + } + bucket = glStack.buckets[i]; + var _g2 = bucket.mode; + switch(Type.enumIndex(_g2)) { + case 1:case 2: + renderSession.stencilManager.pushBucket(bucket,renderSession,translationMatrix.toArray(true)); + var shader = openfl__$internal_renderer_opengl_utils_GraphicsRenderer.prepareShader(bucket,renderSession,object,translationMatrix.toArray(true)); + openfl__$internal_renderer_opengl_utils_GraphicsRenderer.renderFill(bucket,shader,renderSession); + renderSession.stencilManager.popBucket(object,bucket,renderSession); + break; + case 5: + var shader1 = openfl__$internal_renderer_opengl_utils_GraphicsRenderer.prepareShader(bucket,renderSession,object,null); + openfl__$internal_renderer_opengl_utils_GraphicsRenderer.renderDrawTriangles(bucket,shader1,renderSession); + break; + case 6: + if(!batchDrawing) { + renderSession.spriteBatch.begin(renderSession,clipRect); + } + var args = Type.enumParameters(bucket.graphicType); + renderSession.spriteBatch.renderTiles(object,args[0],args[1],args[2],args[3],args[4],args[5]); + renderSession.spriteBatch.finish(); + break; + default: + } + var ct = object.__worldColorTransform; + var _g3 = 0; + var _g4 = bucket.lines; + while(_g3 < _g4.length) { + var line = _g4[_g3]; + ++_g3; + if(line != null && line.verts.length > 0) { + var shader2 = renderSession.shaderManager.primitiveShader; + renderSession.shaderManager.setShader(shader2); + gl.uniformMatrix3fv(shader2.getUniformLocation("openfl_uTranslationMatrix"),false,translationMatrix.toArray(true)); + gl.uniformMatrix3fv(shader2.getUniformLocation("openfl_uProjectionMatrix"),false,renderSession.projectionMatrix.toArray(true)); + gl.uniform1f(shader2.getUniformLocation("openfl_uAlpha"),1); + gl.uniform4f(shader2.getUniformLocation("openfl_uColorMultiplier"),ct.redMultiplier,ct.greenMultiplier,ct.blueMultiplier,ct.alphaMultiplier); + gl.uniform4f(shader2.getUniformLocation("openfl_uColorOffset"),ct.redOffset / 255,ct.greenOffset / 255,ct.blueOffset / 255,ct.alphaOffset / 255); + line.vertexArray.bind(); + shader2.bindVertexArray(line.vertexArray); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,line.indexBuffer); + gl.drawElements(gl.TRIANGLE_STRIP,line.indices.length,gl.UNSIGNED_SHORT,0); + } + } + if(clipRect != null) { + gl.disable(gl.SCISSOR_TEST); + } + batchDrawing = renderSession.spriteBatch.drawing; + if(!batchDrawing && !localCoords) { + renderSession.spriteBatch.begin(renderSession,clipRect); + } + } +}; +openfl__$internal_renderer_opengl_utils_GraphicsRenderer.updateGraphics = function(object,graphics,gl,localCoords) { + if(localCoords == null) { + localCoords = false; + } + openfl__$internal_renderer_opengl_utils_GraphicsRenderer.objectPosition.setTo(object.get_x(),object.get_y()); + if(graphics.__bounds == null) { + openfl__$internal_renderer_opengl_utils_GraphicsRenderer.objectBounds = new openfl_geom_Rectangle(); + } else { + openfl__$internal_renderer_opengl_utils_GraphicsRenderer.objectBounds.copyFrom(graphics.__bounds); + } + var glStack = null; + if(graphics.__dirty) { + glStack = openfl__$internal_renderer_opengl_utils_DrawPath.getStack(graphics,gl); + } + graphics.set___dirty(false); + var _g = 0; + var _g1 = glStack.buckets; + while(_g < _g1.length) { + var data = _g1[_g]; + ++_g; + data.reset(); + openfl__$internal_renderer_opengl_utils_GraphicsRenderer.bucketPool.push(data); + } + glStack.reset(); + var _g11 = glStack.lastIndex; + var _g2 = graphics.__drawPaths.length; + while(_g11 < _g2) { + var i = _g11++; + var path = graphics.__drawPaths[i]; + var _g21 = path.type; + switch(Type.enumIndex(_g21)) { + case 0: + openfl__$internal_renderer_opengl_utils_GraphicsRenderer.buildComplexPoly(path,glStack,localCoords); + break; + case 1: + var rounded = _g21[2]; + if(rounded) { + openfl__$internal_renderer_opengl_utils_GraphicsRenderer.buildRoundedRectangle(path,glStack,localCoords); + } else { + openfl__$internal_renderer_opengl_utils_GraphicsRenderer.buildRectangle(path,glStack,localCoords); + } + break; + case 2:case 3: + openfl__$internal_renderer_opengl_utils_GraphicsRenderer.buildCircle(path,glStack,localCoords); + break; + case 4: + openfl__$internal_renderer_opengl_utils_GraphicsRenderer.buildDrawTriangles(path,object,glStack,localCoords); + break; + case 5: + openfl__$internal_renderer_opengl_utils_GraphicsRenderer.buildDrawTiles(path,glStack); + break; + case 6: + var m = _g21[2]; + openfl__$internal_renderer_opengl_utils_GraphicsRenderer.overrideMatrix = m; + break; + } + glStack.lastIndex++; + } + var _g3 = 0; + var _g12 = glStack.buckets; + while(_g3 < _g12.length) { + var bucket = _g12[_g3]; + ++_g3; + if(bucket.uploadTileBuffer) { + bucket.uploadTile(Math.ceil(openfl__$internal_renderer_opengl_utils_GraphicsRenderer.objectBounds.get_left()),Math.ceil(openfl__$internal_renderer_opengl_utils_GraphicsRenderer.objectBounds.get_top()),Math.floor(openfl__$internal_renderer_opengl_utils_GraphicsRenderer.objectBounds.get_right()),Math.floor(openfl__$internal_renderer_opengl_utils_GraphicsRenderer.objectBounds.get_bottom())); + } + bucket.optimize(); + } + glStack.upload(); +}; +openfl__$internal_renderer_opengl_utils_GraphicsRenderer.prepareBucket = function(path,glStack) { + var bucket = null; + var _g = path.fill; + switch(Type.enumIndex(_g)) { + case 1: + var a = _g[3]; + var c = _g[2]; + bucket = openfl__$internal_renderer_opengl_utils_GraphicsRenderer.switchBucket(path.fillIndex,glStack,openfl__$internal_renderer_opengl_utils_BucketMode.Fill); + bucket.color = openfl__$internal_renderer_opengl_utils_GraphicsRenderer.hex2rgb(c); + bucket.color[3] = a; + bucket.uploadTileBuffer = true; + break; + case 2: + var s = _g[5]; + var r = _g[4]; + var m = _g[3]; + var b = _g[2]; + bucket = openfl__$internal_renderer_opengl_utils_GraphicsRenderer.switchBucket(path.fillIndex,glStack,openfl__$internal_renderer_opengl_utils_BucketMode.PatternFill); + bucket.bitmap = b; + bucket.textureRepeat = r; + bucket.textureSmooth = s; + bucket.texture = b.getTexture(glStack.gl); + bucket.uploadTileBuffer = true; + var pMatrix; + if(m == null) { + pMatrix = new openfl_geom_Matrix(); + } else { + pMatrix = m.clone(); + } + pMatrix.invert(); + pMatrix.scale(1 / b.width,1 / b.height); + var tx = pMatrix.tx; + var ty = pMatrix.ty; + pMatrix.tx = 0; + pMatrix.ty = 0; + bucket.textureTL.x = tx; + bucket.textureTL.y = ty; + bucket.textureBR.x = tx + 1; + bucket.textureBR.y = ty + 1; + bucket.textureMatrix = pMatrix; + break; + default: + bucket = openfl__$internal_renderer_opengl_utils_GraphicsRenderer.switchBucket(path.fillIndex,glStack,openfl__$internal_renderer_opengl_utils_BucketMode.Line); + bucket.uploadTileBuffer = false; + } + var _g1 = path.type; + switch(Type.enumIndex(_g1)) { + case 4: + bucket.mode = openfl__$internal_renderer_opengl_utils_BucketMode.DrawTriangles; + bucket.uploadTileBuffer = false; + break; + case 5: + bucket.mode = openfl__$internal_renderer_opengl_utils_BucketMode.DrawTiles; + bucket.uploadTileBuffer = false; + break; + default: + } + bucket.graphicType = path.type; + bucket.overrideMatrix = openfl__$internal_renderer_opengl_utils_GraphicsRenderer.overrideMatrix; + return bucket; +}; +openfl__$internal_renderer_opengl_utils_GraphicsRenderer.getBucket = function(glStack,mode) { + var b = openfl__$internal_renderer_opengl_utils_GraphicsRenderer.bucketPool.pop(); + if(b == null) { + b = new openfl__$internal_renderer_opengl_utils_GLBucket(glStack.gl); + } + b.mode = mode; + glStack.buckets.push(b); + return b; +}; +openfl__$internal_renderer_opengl_utils_GraphicsRenderer.switchBucket = function(fillIndex,glStack,mode) { + var bucket = null; + var _g = 0; + var _g1 = glStack.buckets; + while(_g < _g1.length) { + var b = _g1[_g]; + ++_g; + if(b.fillIndex == fillIndex) { + bucket = b; + break; + } + } + if(bucket == null) { + bucket = openfl__$internal_renderer_opengl_utils_GraphicsRenderer.getBucket(glStack,mode); + } + bucket.dirty = true; + bucket.fillIndex = fillIndex; + return bucket; +}; +openfl__$internal_renderer_opengl_utils_GraphicsRenderer.prepareShader = function(bucket,renderSession,object,translationMatrix) { + var gl = renderSession.gl; + var shader = null; + var _g = bucket.mode; + switch(Type.enumIndex(_g)) { + case 1: + shader = renderSession.shaderManager.fillShader; + break; + case 2: + shader = renderSession.shaderManager.patternFillShader; + break; + case 5: + shader = renderSession.shaderManager.drawTrianglesShader; + break; + default: + shader = null; + } + if(shader == null) { + return null; + } + var newShader = renderSession.shaderManager.setShader(shader); + gl.uniform1f(shader.getUniformLocation("openfl_uAlpha"),object.__worldAlpha); + gl.uniformMatrix3fv(shader.getUniformLocation("openfl_uProjectionMatrix"),false,renderSession.projectionMatrix.toArray(true)); + var ct = object.__worldColorTransform; + gl.uniform4f(shader.getUniformLocation("openfl_uColorMultiplier"),ct.redMultiplier,ct.greenMultiplier,ct.blueMultiplier,ct.alphaMultiplier); + gl.uniform4f(shader.getUniformLocation("openfl_uColorOffset"),ct.redOffset / 255,ct.greenOffset / 255,ct.blueOffset / 255,ct.alphaOffset / 255); + var _g1 = bucket.mode; + switch(Type.enumIndex(_g1)) { + case 1: + gl.uniformMatrix3fv(shader.getUniformLocation("openfl_uTranslationMatrix"),false,translationMatrix); + var tmp = shader.getUniformLocation("openfl_uColor"); + var array = bucket.color; + var this1; + if(array != null) { + this1 = new Float32Array(array); + } else { + this1 = null; + } + gl.uniform4fv(tmp,this1); + break; + case 2: + gl.uniformMatrix3fv(shader.getUniformLocation("openfl_uTranslationMatrix"),false,translationMatrix); + gl.uniform2f(shader.getUniformLocation("openfl_uPatternTL"),bucket.textureTL.x,bucket.textureTL.y); + gl.uniform2f(shader.getUniformLocation("openfl_uPatternBR"),bucket.textureBR.x,bucket.textureBR.y); + gl.uniformMatrix3fv(shader.getUniformLocation("openfl_uPatternMatrix"),false,bucket.textureMatrix.toArray(true)); + break; + case 5: + if(bucket.texture != null) { + gl.uniform1i(shader.getUniformLocation("openfl_uUseTexture"),1); + } else { + gl.uniform1i(shader.getUniformLocation("openfl_uUseTexture"),0); + var tmp1 = shader.getUniformLocation("openfl_uColor"); + var array1 = bucket.color; + var this2; + if(array1 != null) { + this2 = new Float32Array(array1); + } else { + this2 = null; + } + gl.uniform4fv(tmp1,this2); + } + break; + default: + } + return shader; +}; +openfl__$internal_renderer_opengl_utils_GraphicsRenderer.renderFill = function(bucket,shader,renderSession) { + var gl = renderSession.gl; + if(bucket.mode == openfl__$internal_renderer_opengl_utils_BucketMode.PatternFill && bucket.texture != null) { + openfl__$internal_renderer_opengl_utils_GraphicsRenderer.bindTexture(gl,bucket); + } + gl.bindBuffer(gl.ARRAY_BUFFER,bucket.tileBuffer); + gl.vertexAttribPointer(shader.getAttribLocation("openfl_aPosition"),4,gl.SHORT,false,0,0); + gl.drawArrays(gl.TRIANGLE_STRIP,0,4); +}; +openfl__$internal_renderer_opengl_utils_GraphicsRenderer.renderDrawTriangles = function(bucket,shader,renderSession) { + var gl = renderSession.gl; + var _g = 0; + var _g1 = bucket.fills; + while(_g < _g1.length) { + var fill = _g1[_g]; + ++_g; + if(fill.available) { + continue; + } + openfl__$internal_renderer_opengl_utils_GraphicsRenderer.bindTexture(gl,bucket); + fill.vertexArray.bind(); + shader.bindVertexArray(fill.vertexArray); + gl.drawArrays(gl.TRIANGLES,fill.glStart,fill.glLength); + } +}; +openfl__$internal_renderer_opengl_utils_GraphicsRenderer.bindTexture = function(gl,bucket) { + gl.bindTexture(gl.TEXTURE_2D,bucket.texture); + if(bucket.textureRepeat && bucket.bitmap.image.get_powerOfTwo()) { + gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.REPEAT); + gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.REPEAT); + } else { + gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE); + } + if(bucket.textureSmooth) { + gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.LINEAR); + gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.LINEAR); + } else { + gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.NEAREST); + gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.NEAREST); + } +}; +openfl__$internal_renderer_opengl_utils_GraphicsRenderer.isCCW = function(x1,y1,x2,y2,x3,y3) { + return (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1) < 0; +}; +openfl__$internal_renderer_opengl_utils_GraphicsRenderer.hex2rgb = function(hex) { + if(hex == null) { + return [1,1,1]; + } else { + return [(hex >> 16 & 255) / 255,(hex >> 8 & 255) / 255,(hex & 255) / 255]; + } +}; +var openfl__$internal_renderer_opengl_utils_GLStack = function(gl) { + this.lastIndex = 0; + this.gl = gl; + this.buckets = []; + this.lastIndex = 0; +}; +$hxClasses["openfl._internal.renderer.opengl.utils.GLStack"] = openfl__$internal_renderer_opengl_utils_GLStack; +openfl__$internal_renderer_opengl_utils_GLStack.__name__ = ["openfl","_internal","renderer","opengl","utils","GLStack"]; +openfl__$internal_renderer_opengl_utils_GLStack.prototype = { + lastIndex: null + ,buckets: null + ,gl: null + ,reset: function() { + var _g = 0; + var _g1 = this.buckets; + while(_g < _g1.length) { + var b = _g1[_g]; + ++_g; + b.dispose(); + } + this.buckets = []; + this.lastIndex = 0; + } + ,upload: function() { + var _g = 0; + var _g1 = this.buckets; + while(_g < _g1.length) { + var bucket = _g1[_g]; + ++_g; + if(bucket.dirty) { + bucket.upload(); + } + } + } + ,__class__: openfl__$internal_renderer_opengl_utils_GLStack +}; +var openfl__$internal_renderer_opengl_utils_GLBucket = function(gl) { + this.uploadTileBuffer = true; + this.textureSmooth = true; + this.textureRepeat = false; + this.lines = []; + this.fills = []; + this.fillIndex = -1; + this.gl = gl; + this.color = [0,0,0]; + this.lastIndex = 0; + this.alpha = 1; + this.dirty = true; + this.mode = openfl__$internal_renderer_opengl_utils_BucketMode.Fill; + this.textureMatrix = new openfl_geom_Matrix(); + this.textureTL = new openfl_geom_Point(); + this.textureBR = new openfl_geom_Point(1,1); +}; +$hxClasses["openfl._internal.renderer.opengl.utils.GLBucket"] = openfl__$internal_renderer_opengl_utils_GLBucket; +openfl__$internal_renderer_opengl_utils_GLBucket.__name__ = ["openfl","_internal","renderer","opengl","utils","GLBucket"]; +openfl__$internal_renderer_opengl_utils_GLBucket.prototype = { + gl: null + ,color: null + ,alpha: null + ,dirty: null + ,graphicType: null + ,lastIndex: null + ,fillIndex: null + ,mode: null + ,fills: null + ,lines: null + ,bitmap: null + ,texture: null + ,textureMatrix: null + ,textureRepeat: null + ,textureSmooth: null + ,textureTL: null + ,textureBR: null + ,overrideMatrix: null + ,tileBuffer: null + ,glTile: null + ,tile: null + ,uploadTileBuffer: null + ,getData: function(type) { + var data = Type.enumIndex(type) == 1 ? this.fills : this.lines; + var result = null; + var remove = false; + var _g = 0; + while(_g < data.length) { + var d = data[_g]; + ++_g; + if(d.available) { + result = d; + remove = true; + break; + } + } + if(result == null) { + result = new openfl__$internal_renderer_opengl_utils_GLBucketData(this.gl); + } + result.available = false; + result.parent = this; + result.type = type; + if(remove) { + HxOverrides.remove(data,result); + } + data.push(result); + switch(Type.enumIndex(type)) { + case 0: + result.vertexArray.attributes = openfl__$internal_renderer_opengl_utils_GraphicsRenderer.primitiveVertexAttributes; + break; + case 1: + var _g1 = this.mode; + switch(Type.enumIndex(_g1)) { + case 1:case 2: + result.vertexArray.attributes = openfl__$internal_renderer_opengl_utils_GraphicsRenderer.fillVertexAttributes; + break; + case 5: + var tmp = openfl__$internal_renderer_opengl_utils_GraphicsRenderer.drawTrianglesVertexAttributes.slice(); + result.vertexArray.attributes = tmp; + result.vertexArray.attributes[2] = result.vertexArray.attributes[2].copy(); + break; + default: + } + break; + } + return result; + } + ,optimize: function() { + var _gthis = this; + var data = this.lines; + if(data.length > 1) { + var result = []; + var tmp = null; + var last = null; + var idx = 0; + var vi = 0; + var ii = 0; + var before = data.length; + var _g = 0; + while(_g < data.length) { + var d = data[_g]; + ++_g; + if(d.available || d.rawVerts || d.rawIndices) { + if(tmp != null) { + result.push(tmp); + tmp = null; + } + result.push(d); + last = d; + continue; + } + if(last == null || last.drawMode == d.drawMode) { + if(tmp == null) { + tmp = d; + } else { + vi = tmp.verts.length; + ii = tmp.indices.length; + var _g2 = 0; + var _g1 = d.verts.length; + while(_g2 < _g1) { + var j = _g2++; + tmp.verts[j + vi] = d.verts[j]; + } + var _g21 = 0; + var _g11 = d.indices.length; + while(_g21 < _g11) { + var j1 = _g21++; + tmp.indices[j1 + ii] = d.indices[j1] + idx; + } + } + idx = tmp.indices[tmp.indices.length - 1] + 1; + last = d; + } else { + if(tmp != null) { + result.push(tmp); + tmp = null; + } + result.push(d); + last = d; + continue; + } + } + if(result.length == 0 && tmp != null) { + result.push(tmp); + } + if(result.length > 0) { + _gthis.lines = result; + } + } + } + ,reset: function() { + var _g = 0; + var _g1 = this.fills; + while(_g < _g1.length) { + var fill = _g1[_g]; + ++_g; + fill.reset(); + } + var _g2 = 0; + var _g11 = this.lines; + while(_g2 < _g11.length) { + var line = _g11[_g2]; + ++_g2; + line.reset(); + } + this.fillIndex = -1; + this.uploadTileBuffer = true; + this.graphicType = openfl__$internal_renderer_opengl_utils_GraphicType.Polygon; + } + ,uploadTile: function(x,y,w,h) { + if(this.tileBuffer == null) { + this.tileBuffer = this.gl.createBuffer(); + } + this.tile = [x,y,0,0,w,y,1,0,x,h,0,1,w,h,1,1]; + var array = this.tile; + var this1; + if(array != null) { + this1 = new Int16Array(array); + } else { + this1 = null; + } + this.glTile = this1; + this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.tileBuffer); + this.gl.bufferData(this.gl.ARRAY_BUFFER,this.glTile,this.gl.STATIC_DRAW); + } + ,dispose: function() { + if(this.tileBuffer != null) { + this.gl.deleteBuffer(this.tileBuffer); + this.tileBuffer = null; + } + var _g = 0; + var _g1 = this.fills; + while(_g < _g1.length) { + var fill = _g1[_g]; + ++_g; + fill.dispose(); + } + var _g2 = 0; + var _g11 = this.lines; + while(_g2 < _g11.length) { + var line = _g11[_g2]; + ++_g2; + line.dispose(); + } + this.dirty = true; + } + ,upload: function() { + if(this.mode != openfl__$internal_renderer_opengl_utils_BucketMode.Line) { + var _g = 0; + var _g1 = this.fills; + while(_g < _g1.length) { + var fill = _g1[_g]; + ++_g; + if(!fill.available) { + fill.upload(); + } + } + } + var _g2 = 0; + var _g11 = this.lines; + while(_g2 < _g11.length) { + var line = _g11[_g2]; + ++_g2; + if(!line.available) { + line.upload(); + } + } + this.dirty = false; + } + ,__class__: openfl__$internal_renderer_opengl_utils_GLBucket +}; +var openfl__$internal_renderer_opengl_utils_GLBucketData = function(gl) { + this.available = false; + this.rawIndices = false; + this.stride = 0; + this.rawVerts = false; + this.lastVertsSize = 0; + this.glStart = 0; + this.glLength = 0; + this.gl = gl; + this.drawMode = gl.TRIANGLE_STRIP; + this.verts = []; + this.indices = []; + this.vertexArray = new openfl__$internal_renderer_opengl_utils_VertexArray([]); +}; +$hxClasses["openfl._internal.renderer.opengl.utils.GLBucketData"] = openfl__$internal_renderer_opengl_utils_GLBucketData; +openfl__$internal_renderer_opengl_utils_GLBucketData.__name__ = ["openfl","_internal","renderer","opengl","utils","GLBucketData"]; +openfl__$internal_renderer_opengl_utils_GLBucketData.prototype = { + type: null + ,gl: null + ,drawMode: null + ,glLength: null + ,glStart: null + ,vertexArray: null + ,glVerts: null + ,lastVertsSize: null + ,verts: null + ,rawVerts: null + ,stride: null + ,indexBuffer: null + ,glIndices: null + ,indices: null + ,rawIndices: null + ,available: null + ,parent: null + ,reset: function() { + this.available = true; + this.verts = []; + this.indices = []; + this.glLength = 0; + this.glStart = 0; + this.stride = 0; + this.rawVerts = false; + this.rawIndices = false; + this.drawMode = this.gl.TRIANGLE_STRIP; + } + ,dispose: function() { + if(this.vertexArray.glBuffer != null) { + this.gl.deleteBuffer(this.vertexArray.glBuffer); + this.vertexArray.glBuffer = null; + } + this.lastVertsSize = 0; + if(this.indexBuffer != null) { + this.gl.deleteBuffer(this.indexBuffer); + this.indexBuffer = null; + } + } + ,upload: function() { + if(this.rawVerts && this.glVerts != null && this.glVerts.length > 0 || this.verts.length > 0) { + if(!this.rawVerts) { + var array = this.verts; + var this1; + if(array != null) { + this1 = new Float32Array(array); + } else { + this1 = null; + } + this.glVerts = this1; + } + this.vertexArray.buffer = this.glVerts.buffer; + if(this.glVerts.length <= this.lastVertsSize) { + this.vertexArray.bind(); + var end = this.glLength * this.stride; + if(this.glLength > 0 && this.lastVertsSize > end) { + var view = this.glVerts.subarray(0,end); + this.vertexArray.upload(view); + } else { + this.vertexArray.upload(this.glVerts); + } + } else { + this.vertexArray.setContext(this.gl,this.glVerts); + this.lastVertsSize = this.glVerts.length; + } + } + if(this.glLength == 0 && (this.rawIndices && this.glIndices != null && this.glIndices.length > 0 || this.indices.length > 0)) { + if(this.indexBuffer == null) { + this.indexBuffer = this.gl.createBuffer(); + } + if(!this.rawIndices) { + var array1 = this.indices; + var this2; + if(array1 != null) { + this2 = new Uint16Array(array1); + } else { + this2 = null; + } + this.glIndices = this2; + } + this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.indexBuffer); + this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER,this.glIndices,this.gl.STREAM_DRAW); + } + } + ,__class__: openfl__$internal_renderer_opengl_utils_GLBucketData +}; +var openfl__$internal_renderer_opengl_utils_BucketMode = $hxClasses["openfl._internal.renderer.opengl.utils.BucketMode"] = { __ename__ : ["openfl","_internal","renderer","opengl","utils","BucketMode"], __constructs__ : ["None","Fill","PatternFill","Line","PatternLine","DrawTriangles","DrawTiles"] }; +openfl__$internal_renderer_opengl_utils_BucketMode.None = ["None",0]; +openfl__$internal_renderer_opengl_utils_BucketMode.None.toString = $estr; +openfl__$internal_renderer_opengl_utils_BucketMode.None.__enum__ = openfl__$internal_renderer_opengl_utils_BucketMode; +openfl__$internal_renderer_opengl_utils_BucketMode.Fill = ["Fill",1]; +openfl__$internal_renderer_opengl_utils_BucketMode.Fill.toString = $estr; +openfl__$internal_renderer_opengl_utils_BucketMode.Fill.__enum__ = openfl__$internal_renderer_opengl_utils_BucketMode; +openfl__$internal_renderer_opengl_utils_BucketMode.PatternFill = ["PatternFill",2]; +openfl__$internal_renderer_opengl_utils_BucketMode.PatternFill.toString = $estr; +openfl__$internal_renderer_opengl_utils_BucketMode.PatternFill.__enum__ = openfl__$internal_renderer_opengl_utils_BucketMode; +openfl__$internal_renderer_opengl_utils_BucketMode.Line = ["Line",3]; +openfl__$internal_renderer_opengl_utils_BucketMode.Line.toString = $estr; +openfl__$internal_renderer_opengl_utils_BucketMode.Line.__enum__ = openfl__$internal_renderer_opengl_utils_BucketMode; +openfl__$internal_renderer_opengl_utils_BucketMode.PatternLine = ["PatternLine",4]; +openfl__$internal_renderer_opengl_utils_BucketMode.PatternLine.toString = $estr; +openfl__$internal_renderer_opengl_utils_BucketMode.PatternLine.__enum__ = openfl__$internal_renderer_opengl_utils_BucketMode; +openfl__$internal_renderer_opengl_utils_BucketMode.DrawTriangles = ["DrawTriangles",5]; +openfl__$internal_renderer_opengl_utils_BucketMode.DrawTriangles.toString = $estr; +openfl__$internal_renderer_opengl_utils_BucketMode.DrawTriangles.__enum__ = openfl__$internal_renderer_opengl_utils_BucketMode; +openfl__$internal_renderer_opengl_utils_BucketMode.DrawTiles = ["DrawTiles",6]; +openfl__$internal_renderer_opengl_utils_BucketMode.DrawTiles.toString = $estr; +openfl__$internal_renderer_opengl_utils_BucketMode.DrawTiles.__enum__ = openfl__$internal_renderer_opengl_utils_BucketMode; +var openfl__$internal_renderer_opengl_utils_BucketDataType = $hxClasses["openfl._internal.renderer.opengl.utils.BucketDataType"] = { __ename__ : ["openfl","_internal","renderer","opengl","utils","BucketDataType"], __constructs__ : ["Line","Fill"] }; +openfl__$internal_renderer_opengl_utils_BucketDataType.Line = ["Line",0]; +openfl__$internal_renderer_opengl_utils_BucketDataType.Line.toString = $estr; +openfl__$internal_renderer_opengl_utils_BucketDataType.Line.__enum__ = openfl__$internal_renderer_opengl_utils_BucketDataType; +openfl__$internal_renderer_opengl_utils_BucketDataType.Fill = ["Fill",1]; +openfl__$internal_renderer_opengl_utils_BucketDataType.Fill.toString = $estr; +openfl__$internal_renderer_opengl_utils_BucketDataType.Fill.__enum__ = openfl__$internal_renderer_opengl_utils_BucketDataType; +var openfl__$internal_renderer_opengl_utils_GraphicType = $hxClasses["openfl._internal.renderer.opengl.utils.GraphicType"] = { __ename__ : ["openfl","_internal","renderer","opengl","utils","GraphicType"], __constructs__ : ["Polygon","Rectangle","Circle","Ellipse","DrawTriangles","DrawTiles","OverrideMatrix"] }; +openfl__$internal_renderer_opengl_utils_GraphicType.Polygon = ["Polygon",0]; +openfl__$internal_renderer_opengl_utils_GraphicType.Polygon.toString = $estr; +openfl__$internal_renderer_opengl_utils_GraphicType.Polygon.__enum__ = openfl__$internal_renderer_opengl_utils_GraphicType; +openfl__$internal_renderer_opengl_utils_GraphicType.Rectangle = function(rounded) { var $x = ["Rectangle",1,rounded]; $x.__enum__ = openfl__$internal_renderer_opengl_utils_GraphicType; $x.toString = $estr; return $x; }; +openfl__$internal_renderer_opengl_utils_GraphicType.Circle = ["Circle",2]; +openfl__$internal_renderer_opengl_utils_GraphicType.Circle.toString = $estr; +openfl__$internal_renderer_opengl_utils_GraphicType.Circle.__enum__ = openfl__$internal_renderer_opengl_utils_GraphicType; +openfl__$internal_renderer_opengl_utils_GraphicType.Ellipse = ["Ellipse",3]; +openfl__$internal_renderer_opengl_utils_GraphicType.Ellipse.toString = $estr; +openfl__$internal_renderer_opengl_utils_GraphicType.Ellipse.__enum__ = openfl__$internal_renderer_opengl_utils_GraphicType; +openfl__$internal_renderer_opengl_utils_GraphicType.DrawTriangles = function(vertices,indices,uvtData,culling,colors,blendMode) { var $x = ["DrawTriangles",4,vertices,indices,uvtData,culling,colors,blendMode]; $x.__enum__ = openfl__$internal_renderer_opengl_utils_GraphicType; $x.toString = $estr; return $x; }; +openfl__$internal_renderer_opengl_utils_GraphicType.DrawTiles = function(sheet,tileData,smooth,flags,shader,count) { var $x = ["DrawTiles",5,sheet,tileData,smooth,flags,shader,count]; $x.__enum__ = openfl__$internal_renderer_opengl_utils_GraphicType; $x.toString = $estr; return $x; }; +openfl__$internal_renderer_opengl_utils_GraphicType.OverrideMatrix = function(matrix) { var $x = ["OverrideMatrix",6,matrix]; $x.__enum__ = openfl__$internal_renderer_opengl_utils_GraphicType; $x.toString = $estr; return $x; }; +var openfl__$internal_renderer_opengl_utils_PingPongTexture = function(gl,width,height,smoothing,powerOfTwo) { + if(powerOfTwo == null) { + powerOfTwo = true; + } + if(smoothing == null) { + smoothing = true; + } + this.__swapped = false; + this.powerOfTwo = true; + this.useOldTexture = false; + this.gl = gl; + this.width = width; + this.height = height; + this.smoothing = smoothing; + this.powerOfTwo = powerOfTwo; + this.set_renderTexture(new openfl__$internal_renderer_opengl_utils_RenderTexture(gl,width,height,smoothing,powerOfTwo)); +}; +$hxClasses["openfl._internal.renderer.opengl.utils.PingPongTexture"] = openfl__$internal_renderer_opengl_utils_PingPongTexture; +openfl__$internal_renderer_opengl_utils_PingPongTexture.__name__ = ["openfl","_internal","renderer","opengl","utils","PingPongTexture"]; +openfl__$internal_renderer_opengl_utils_PingPongTexture.prototype = { + gl: null + ,width: null + ,height: null + ,smoothing: null + ,useOldTexture: null + ,powerOfTwo: null + ,__swapped: null + ,__texture0: null + ,__texture1: null + ,swap: function() { + this.__swapped = !this.__swapped; + if(this.get_renderTexture() == null) { + this.set_renderTexture(new openfl__$internal_renderer_opengl_utils_RenderTexture(this.gl,this.width,this.height,this.smoothing,this.powerOfTwo)); + } + } + ,clear: function(r,g,b,a,mask) { + if(a == null) { + a = 0; + } + if(b == null) { + b = 0; + } + if(g == null) { + g = 0; + } + if(r == null) { + r = 0; + } + this.get_renderTexture().clear(r,g,b,a,mask); + } + ,resize: function(width,height) { + this.width = width; + this.height = height; + this.get_renderTexture().resize(width,height); + } + ,get_renderTexture: function() { + if(this.__swapped) { + return this.__texture1; + } else { + return this.__texture0; + } + } + ,set_renderTexture: function(v) { + if(this.__swapped) { + return this.__texture1 = v; + } else { + return this.__texture0 = v; + } + } + ,get_oldRenderTexture: function() { + if(this.__swapped) { + return this.__texture0; + } else { + return this.__texture1; + } + } + ,set_oldRenderTexture: function(v) { + if(this.__swapped) { + return this.__texture0 = v; + } else { + return this.__texture1 = v; + } + } + ,get_framebuffer: function() { + return this.get_renderTexture().frameBuffer; + } + ,get_texture: function() { + if(this.useOldTexture) { + return this.get___otherTexture().texture; + } else { + return this.get_renderTexture().texture; + } + } + ,get___otherTexture: function() { + if(this.__swapped) { + return this.__texture0; + } else { + return this.__texture1; + } + } + ,__class__: openfl__$internal_renderer_opengl_utils_PingPongTexture + ,__properties__: {get___otherTexture:"get___otherTexture",get_texture:"get_texture",get_framebuffer:"get_framebuffer",set_oldRenderTexture:"set_oldRenderTexture",get_oldRenderTexture:"get_oldRenderTexture",set_renderTexture:"set_renderTexture",get_renderTexture:"get_renderTexture"} +}; +var openfl__$internal_renderer_opengl_utils_RenderTexture = function(gl,width,height,smoothing,powerOfTwo) { + if(powerOfTwo == null) { + powerOfTwo = true; + } + if(smoothing == null) { + smoothing = true; + } + this.powerOfTwo = true; + this.gl = gl; + this.powerOfTwo = powerOfTwo; + this.frameBuffer = gl.createFramebuffer(); + this.texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D,this.texture); + gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,smoothing ? gl.LINEAR : gl.NEAREST); + gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,smoothing ? gl.LINEAR : gl.NEAREST); + gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE); + gl.bindFramebuffer(gl.FRAMEBUFFER,this.frameBuffer); + gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.TEXTURE_2D,this.texture,0); + this.renderBuffer = gl.createRenderbuffer(); + gl.bindRenderbuffer(gl.RENDERBUFFER,this.renderBuffer); + gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.DEPTH_STENCIL_ATTACHMENT,gl.RENDERBUFFER,this.renderBuffer); + this.resize(width,height); +}; +$hxClasses["openfl._internal.renderer.opengl.utils.RenderTexture"] = openfl__$internal_renderer_opengl_utils_RenderTexture; +openfl__$internal_renderer_opengl_utils_RenderTexture.__name__ = ["openfl","_internal","renderer","opengl","utils","RenderTexture"]; +openfl__$internal_renderer_opengl_utils_RenderTexture.prototype = { + gl: null + ,frameBuffer: null + ,renderBuffer: null + ,texture: null + ,width: null + ,height: null + ,powerOfTwo: null + ,__width: null + ,__height: null + ,__uvData: null + ,clear: function(r,g,b,a,mask) { + if(a == null) { + a = 0; + } + if(b == null) { + b = 0; + } + if(g == null) { + g = 0; + } + if(r == null) { + r = 0; + } + this.gl.clearColor(r,g,b,a); + this.gl.clear(mask == null ? this.gl.COLOR_BUFFER_BIT : mask); + } + ,resize: function(width,height) { + if(this.width == width && this.height == height) { + return; + } + this.width = width; + this.height = height; + var pow2W = width; + var pow2H = height; + if(this.powerOfTwo) { + pow2W = this.powOfTwo(width); + pow2H = this.powOfTwo(height); + } + var lastW = this.__width; + var lastH = this.__height; + this.__width = pow2W; + this.__height = pow2H; + this.createUVs(); + if(lastW == pow2W && lastH == pow2H) { + return; + } + this.gl.bindTexture(this.gl.TEXTURE_2D,this.texture); + this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.__width,this.__height,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,null); + this.gl.bindRenderbuffer(this.gl.RENDERBUFFER,this.renderBuffer); + this.gl.renderbufferStorage(this.gl.RENDERBUFFER,this.gl.DEPTH_STENCIL,this.__width,this.__height); + } + ,createUVs: function() { + if(this.__uvData == null) { + this.__uvData = new openfl_display_TextureUvs(); + } + var w = this.width / this.__width; + var h = this.height / this.__height; + this.__uvData.x0 = 0; + this.__uvData.y0 = 0; + this.__uvData.x1 = w; + this.__uvData.y1 = 0; + this.__uvData.x2 = w; + this.__uvData.y2 = h; + this.__uvData.x3 = 0; + this.__uvData.y3 = h; + } + ,powOfTwo: function(value) { + var n = 1; + while(n < value) n <<= 1; + return n; + } + ,__class__: openfl__$internal_renderer_opengl_utils_RenderTexture +}; +var openfl__$internal_renderer_opengl_utils_ShaderManager = function(gl) { + this.setContext(gl); +}; +$hxClasses["openfl._internal.renderer.opengl.utils.ShaderManager"] = openfl__$internal_renderer_opengl_utils_ShaderManager; +openfl__$internal_renderer_opengl_utils_ShaderManager.__name__ = ["openfl","_internal","renderer","opengl","utils","ShaderManager"]; +openfl__$internal_renderer_opengl_utils_ShaderManager.prototype = { + gl: null + ,currentShader: null + ,defaultShader: null + ,fillShader: null + ,patternFillShader: null + ,drawTrianglesShader: null + ,primitiveShader: null + ,setContext: function(gl) { + this.gl = gl; + this.defaultShader = new openfl__$internal_renderer_opengl_shaders2_DefaultShader(gl); + this.fillShader = new openfl__$internal_renderer_opengl_shaders2_FillShader(gl); + this.patternFillShader = new openfl__$internal_renderer_opengl_shaders2_PatternFillShader(gl); + this.drawTrianglesShader = new openfl__$internal_renderer_opengl_shaders2_DrawTrianglesShader(gl); + this.primitiveShader = new openfl__$internal_renderer_opengl_shaders2_PrimitiveShader(gl); + this.setShader(this.defaultShader,true); + } + ,setShader: function(shader,force) { + if(force == null) { + force = false; + } + if(shader == null) { + this.currentShader = null; + this.gl.useProgram(null); + return true; + } + if(this.currentShader != null && !force && this.currentShader.ID == shader.ID) { + return false; + } + this.currentShader = shader; + this.gl.useProgram(shader.program); + return true; + } + ,__class__: openfl__$internal_renderer_opengl_utils_ShaderManager +}; +var openfl__$internal_renderer_opengl_utils_SpriteBatch = function(gl,maxSprites) { + if(maxSprites == null) { + maxSprites = 2000; + } + this.colorTransform = new openfl_geom_ColorTransform(); + this.lastEnableColor = true; + this.enableColor = true; + this.attributes = []; + this.writtenVertexBytes = 0; + this.drawing = false; + this.dirty = true; + this.states = []; + this.maxSprites = maxSprites; + this.attributes.push(new openfl__$internal_renderer_opengl_utils_VertexAttribute(2,5126,false,"openfl_aPosition")); + this.attributes.push(new openfl__$internal_renderer_opengl_utils_VertexAttribute(2,5126,false,"openfl_aTexCoord0")); + this.attributes.push(new openfl__$internal_renderer_opengl_utils_VertexAttribute(4,5126,true,"openfl_aColor")); + var array = [1,1,1,1]; + var this1; + if(array != null) { + this1 = new Float32Array(array); + } else { + this1 = null; + } + this.attributes[2].defaultValue = this1; + this.maxElementsPerVertex = 0; + var _g = 0; + var _g1 = this.attributes; + while(_g < _g1.length) { + var a = _g1[_g]; + ++_g; + this.maxElementsPerVertex += a.get_elements(); + } + this.vertexArraySize = maxSprites * this.maxElementsPerVertex * 4 * 4; + this.indexArraySize = maxSprites * 6; + this.vertexArray = new openfl__$internal_renderer_opengl_utils_VertexArray(this.attributes,this.vertexArraySize,false); + var buffer = this.vertexArray.buffer; + var this2; + if(buffer != null) { + this2 = new Float32Array(buffer,0); + } else { + this2 = null; + } + this.positions = this2; + var elements = this.indexArraySize; + var this3; + if(elements != null) { + this3 = new Uint16Array(elements); + } else { + this3 = null; + } + this.indices = this3; + var i = 0; + var j = 0; + while(i < this.indexArraySize) { + this.indices[i] = j; + this.indices[i + 1] = j + 1; + this.indices[i + 2] = j + 2; + this.indices[i + 3] = j; + this.indices[i + 4] = j + 2; + this.indices[i + 5] = j + 3; + i += 6; + j += 4; + } + this.currentState = new openfl__$internal_renderer_opengl_utils__$SpriteBatch_State(); + this.dirty = true; + this.drawing = false; + this.batchedSprites = 0; + this.setContext(gl); +}; +$hxClasses["openfl._internal.renderer.opengl.utils.SpriteBatch"] = openfl__$internal_renderer_opengl_utils_SpriteBatch; +openfl__$internal_renderer_opengl_utils_SpriteBatch.__name__ = ["openfl","_internal","renderer","opengl","utils","SpriteBatch"]; +openfl__$internal_renderer_opengl_utils_SpriteBatch.prototype = { + gl: null + ,renderSession: null + ,states: null + ,currentState: null + ,vertexArray: null + ,positions: null + ,indexBuffer: null + ,indices: null + ,dirty: null + ,drawing: null + ,clipRect: null + ,maxSprites: null + ,batchedSprites: null + ,vertexArraySize: null + ,indexArraySize: null + ,maxElementsPerVertex: null + ,elementsPerVertex: null + ,writtenVertexBytes: null + ,shader: null + ,attributes: null + ,enableColor: null + ,lastEnableColor: null + ,colorTransform: null + ,begin: function(renderSession,clipRect) { + this.renderSession = renderSession; + this.shader = renderSession.shaderManager.defaultShader; + this.drawing = true; + this.start(clipRect); + } + ,finish: function() { + this.stop(); + this.clipRect = null; + this.drawing = false; + } + ,start: function(clipRect) { + if(!this.drawing) { + this.stop(); + } + this.dirty = true; + this.clipRect = clipRect; + } + ,stop: function() { + this.flush(); + } + ,renderBitmapData: function(bitmapData,smoothing,matrix,ct,alpha,blendMode,flashShader,pixelSnapping,bgra) { + if(bgra == null) { + bgra = false; + } + if(alpha == null) { + alpha = 1; + } + if(bitmapData == null) { + return; + } + var texture = bitmapData.getTexture(this.gl); + if(this.batchedSprites >= this.maxSprites) { + this.flush(); + } + var uvs = bitmapData.__uvData; + if(uvs == null) { + return; + } + this.prepareShader(flashShader,bitmapData); + var color = (Std["int"](alpha * 255) & 255) << 24 | 16777215; + this.enableAttributes(0); + var index = this.batchedSprites * 4 * this.elementsPerVertex; + this.fillVertices(index,bitmapData.width,bitmapData.height,matrix,uvs,color,pixelSnapping); + this.setState(this.batchedSprites,texture,smoothing,blendMode,ct,flashShader,true); + this.batchedSprites++; + } + ,renderTiles: function(object,sheet,tileData,smooth,flags,flashShader,count) { + if(count == null) { + count = -1; + } + if(flags == null) { + flags = 0; + } + if(smooth == null) { + smooth = false; + } + var texture = sheet.__bitmap.getTexture(this.gl); + if(texture == null) { + return; + } + var useScale = (flags & 1) > 0; + var useRotation = (flags & 2) > 0; + var useTransform = (flags & 16) > 0; + var useRGB = (flags & 4) > 0; + var useAlpha = (flags & 8) > 0; + var useRect = (flags & 32) > 0; + var useOrigin = (flags & 64) > 0; + var useRGBOffset = (flags & 128) > 0; + var blendMode; + var _g = flags & 983040; + switch(_g) { + case 65536: + blendMode = 0; + break; + case 131072: + blendMode = 9; + break; + case 262144: + blendMode = 12; + break; + case 524288: + blendMode = 14; + break; + default: + var _g1 = flags & 15728640; + switch(_g1) { + case 1048576: + blendMode = 2; + break; + case 2097152: + blendMode = 8; + break; + case 4194304: + blendMode = 11; + break; + case 8388608: + blendMode = 5; + break; + default: + var _g2 = flags & 251658240; + switch(_g2) { + case 16777216: + blendMode = 3; + break; + case 33554432: + blendMode = 6; + break; + default: + blendMode = 10; + } + } + } + if(useTransform) { + useScale = false; + useRotation = false; + } + var scaleIndex = 0; + var rotationIndex = 0; + var rgbIndex = 0; + var rgbOffsetIndex = 0; + var alphaIndex = 0; + var transformIndex = 0; + var numValues = 3; + if(useRect) { + if(useOrigin) { + numValues = 8; + } else { + numValues = 6; + } + } + if(useScale) { + scaleIndex = numValues; + ++numValues; + } + if(useRotation) { + rotationIndex = numValues; + ++numValues; + } + if(useTransform) { + transformIndex = numValues; + numValues += 4; + } + if(useRGB) { + rgbIndex = numValues; + numValues += 3; + } + if(useAlpha) { + alphaIndex = numValues; + ++numValues; + } + if(useRGBOffset) { + rgbOffsetIndex = numValues; + numValues += 4; + } + var totalCount = tileData.length; + if(count >= 0 && totalCount > count) { + totalCount = count; + } + var itemCount = Math.ceil(totalCount / numValues); + var iIndex = 0; + var tileID = -1; + var rect = sheet.__rectTile; + var tileUV = sheet.__rectUV; + var center = sheet.__point; + var x = 0.0; + var y = 0.0; + var alpha = 1.0; + var rmul = 1.0; + var gmul = 1.0; + var bmul = 1.0; + var scale = 1.0; + var rotation = 0.0; + var cosTheta = 1.0; + var sinTheta = 0.0; + var a = 0.0; + var b = 0.0; + var c = 0.0; + var d = 0.0; + var tx = 0.0; + var ty = 0.0; + var ox = 0.0; + var oy = 0.0; + var oMatrix = object.__worldTransform; + var bIndex = 0; + var tMa = 1.0; + var tMb = 0.0; + var tMc = 0.0; + var tMd = 1.0; + var tMtx = 0.0; + var tMty = 0.0; + var oMa = oMatrix.a; + var oMb = oMatrix.b; + var oMc = oMatrix.c; + var oMd = oMatrix.d; + var oMtx = oMatrix.tx; + var oMty = oMatrix.ty; + var rx = 0.0; + var ry = 0.0; + var rw = 0.0; + var rh = 0.0; + var tuvx = 0.0; + var tuvy = 0.0; + var tuvw = 0.0; + var tuvh = 0.0; + this.enableAttributes(0); + this.prepareShader(flashShader); + while(iIndex < totalCount) { + if(this.batchedSprites >= this.maxSprites) { + this.flush(); + } + x = tileData[iIndex]; + y = tileData[iIndex + 1]; + if(useRect) { + tileID = -1; + rect.x = tileData[iIndex + 2]; + rect.y = tileData[iIndex + 3]; + rect.width = tileData[iIndex + 4]; + rect.height = tileData[iIndex + 5]; + if(useOrigin) { + center.x = tileData[iIndex + 6]; + center.y = tileData[iIndex + 7]; + } else { + center.setTo(0,0); + } + rw = rect.width; + rh = rect.height; + tuvx = rect.get_left() / sheet.__bitmap.width; + tuvy = rect.get_top() / sheet.__bitmap.height; + tuvw = rect.get_right() / sheet.__bitmap.width; + tuvh = rect.get_bottom() / sheet.__bitmap.height; + } else { + tileID = Std["int"](tileData[iIndex + 2] == null ? 0 : tileData[iIndex + 2]); + rect = sheet.getTileRect(tileID); + center = sheet.getTileCenter(tileID); + tileUV = sheet.getTileUVs(tileID); + if(rect != null) { + rw = rect.width; + rh = rect.height; + tuvx = tileUV.x; + tuvy = tileUV.y; + tuvw = tileUV.width; + tuvh = tileUV.height; + } + } + if(rect != null && rect.width > 0 && rect.height > 0 && center != null) { + alpha = 1; + rmul = 1; + gmul = 1; + bmul = 1; + scale = 1.0; + rotation = 0.0; + cosTheta = 1.0; + sinTheta = 0.0; + if(useAlpha) { + alpha = tileData[iIndex + alphaIndex] * object.__worldAlpha; + } else { + alpha = object.__worldAlpha; + } + if(useRGB) { + rmul = tileData[iIndex + rgbIndex]; + gmul = tileData[iIndex + rgbIndex + 1]; + bmul = tileData[iIndex + rgbIndex + 2]; + var tmp = bmul; + bmul = rmul; + rmul = tmp; + } + var wct = object.__worldColorTransform; + this.colorTransform.redMultiplier = wct.redMultiplier; + this.colorTransform.greenMultiplier = wct.greenMultiplier; + this.colorTransform.blueMultiplier = wct.blueMultiplier; + this.colorTransform.alphaMultiplier = wct.alphaMultiplier; + this.colorTransform.redOffset = wct.redOffset; + this.colorTransform.greenOffset = wct.greenOffset; + this.colorTransform.blueOffset = wct.blueOffset; + this.colorTransform.alphaOffset = wct.alphaOffset; + if(useRGBOffset) { + this.colorTransform.redOffset += tileData[iIndex + rgbOffsetIndex]; + this.colorTransform.greenOffset += tileData[iIndex + rgbOffsetIndex + 1]; + this.colorTransform.blueOffset += tileData[iIndex + rgbOffsetIndex + 2]; + this.colorTransform.alphaOffset += tileData[iIndex + rgbOffsetIndex + 3]; + } + if(useScale) { + scale = tileData[iIndex + scaleIndex]; + } + if(useRotation) { + rotation = tileData[iIndex + rotationIndex]; + cosTheta = Math.cos(rotation); + sinTheta = Math.sin(rotation); + } + if(useTransform) { + a = tileData[iIndex + transformIndex]; + b = tileData[iIndex + transformIndex + 1]; + c = tileData[iIndex + transformIndex + 2]; + d = tileData[iIndex + transformIndex + 3]; + } else { + a = scale * cosTheta; + b = scale * sinTheta; + c = -b; + d = a; + } + ox = center.x * a + center.y * c; + oy = center.x * b + center.y * d; + tx = x - ox; + ty = y - oy; + tMa = (a * oMa + b * oMc) * rw; + tMb = (a * oMb + b * oMd) * rw; + tMc = (c * oMa + d * oMc) * rh; + tMd = (c * oMb + d * oMd) * rh; + tMtx = tx * oMa + ty * oMc + oMtx; + tMty = tx * oMb + ty * oMd + oMty; + bIndex = this.batchedSprites * 4 * this.elementsPerVertex; + this.positions[bIndex] = tMtx; + this.positions[bIndex + 1] = tMty; + this.positions[bIndex + 8] = tMa + tMtx; + this.positions[bIndex + 9] = tMb + tMty; + this.positions[bIndex + 16] = tMa + tMc + tMtx; + this.positions[bIndex + 17] = tMd + tMb + tMty; + this.positions[bIndex + 24] = tMc + tMtx; + this.positions[bIndex + 25] = tMd + tMty; + var val = this.positions[bIndex + 28] = bmul; + var val1 = this.positions[bIndex + 20] = val; + var val2 = this.positions[bIndex + 12] = val1; + this.positions[bIndex + 4] = val2; + var val3 = this.positions[bIndex + 29] = gmul; + var val4 = this.positions[bIndex + 21] = val3; + var val5 = this.positions[bIndex + 13] = val4; + this.positions[bIndex + 5] = val5; + var val6 = this.positions[bIndex + 30] = rmul; + var val7 = this.positions[bIndex + 22] = val6; + var val8 = this.positions[bIndex + 14] = val7; + this.positions[bIndex + 6] = val8; + var val9 = this.positions[bIndex + 31] = alpha; + var val10 = this.positions[bIndex + 23] = val9; + var val11 = this.positions[bIndex + 15] = val10; + this.positions[bIndex + 7] = val11; + this.positions[bIndex + 2] = tuvx; + this.positions[bIndex + 3] = tuvy; + this.positions[bIndex + 10] = tuvw; + this.positions[bIndex + 11] = tuvy; + this.positions[bIndex + 18] = tuvw; + this.positions[bIndex + 19] = tuvh; + this.positions[bIndex + 26] = tuvx; + this.positions[bIndex + 27] = tuvh; + this.writtenVertexBytes = bIndex + 32; + this.setState(this.batchedSprites,texture,smooth,blendMode,this.colorTransform,flashShader,false); + this.batchedSprites++; + } + iIndex += numValues; + } + } + ,fillVertices: function(index,width,height,matrix,uvs,color,pixelSnapping) { + if(color == null) { + color = -1; + } + var a = matrix.a; + var b = matrix.b; + var c = matrix.c; + var d = matrix.d; + var tx = matrix.tx; + var ty = matrix.ty; + if(pixelSnapping == null || pixelSnapping == 2) { + this.positions[index] = tx; + this.positions[index + 1] = ty; + this.positions[index + 8] = a * width + tx; + this.positions[index + 9] = b * width + ty; + this.positions[index + 16] = a * width + c * height + tx; + this.positions[index + 17] = d * height + b * width + ty; + this.positions[index + 24] = c * height + tx; + this.positions[index + 25] = d * height + ty; + } else { + this.positions[index] = Math.round(tx); + this.positions[index + 1] = Math.round(ty); + this.positions[index + 8] = Math.round(a * width + tx); + this.positions[index + 9] = Math.round(b * width + ty); + this.positions[index + 16] = Math.round(a * width + c * height + tx); + this.positions[index + 17] = Math.round(d * height + b * width + ty); + this.positions[index + 24] = Math.round(c * height + tx); + this.positions[index + 25] = Math.round(d * height + ty); + } + if(this.enableColor) { + var val = this.positions[index + 28] = (color & 255) / 255.0; + var val1 = this.positions[index + 20] = val; + var val2 = this.positions[index + 12] = val1; + this.positions[index + 4] = val2; + var val3 = this.positions[index + 29] = (color >> 8 & 255) / 255.0; + var val4 = this.positions[index + 21] = val3; + var val5 = this.positions[index + 13] = val4; + this.positions[index + 5] = val5; + var val6 = this.positions[index + 30] = (color >> 16 & 255) / 255.0; + var val7 = this.positions[index + 22] = val6; + var val8 = this.positions[index + 14] = val7; + this.positions[index + 6] = val8; + var val9 = this.positions[index + 31] = (color >> 24 & 255) / 255.0; + var val10 = this.positions[index + 23] = val9; + var val11 = this.positions[index + 15] = val10; + this.positions[index + 7] = val11; + } + this.positions[index + 2] = uvs.x0; + this.positions[index + 3] = uvs.y0; + this.positions[index + 10] = uvs.x1; + this.positions[index + 11] = uvs.y1; + this.positions[index + 18] = uvs.x2; + this.positions[index + 19] = uvs.y2; + this.positions[index + 26] = uvs.x3; + this.positions[index + 27] = uvs.y3; + this.writtenVertexBytes = index + 32; + } + ,enableAttributes: function(color) { + if(color == null) { + color = -1; + } + this.enableColor = color != -1; + if(this.enableColor != this.lastEnableColor) { + this.flush(); + this.lastEnableColor = this.enableColor; + } + this.attributes[2].enabled = this.lastEnableColor; + this.elementsPerVertex = this.getElementsPerVertex(); + } + ,flush: function() { + if(this.batchedSprites == 0) { + return; + } + if(this.clipRect != null) { + this.gl.enable(this.gl.SCISSOR_TEST); + this.gl.scissor(Math.floor(this.clipRect.x),Math.floor(this.clipRect.y),Math.ceil(this.clipRect.width),Math.ceil(this.clipRect.height)); + } + this.dirty = false; + this.renderSession.activeTextures = 1; + this.vertexArray.bind(); + this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.indexBuffer); + if(this.writtenVertexBytes > this.vertexArraySize * 0.5) { + this.vertexArray.upload(this.positions); + } else { + var view = this.positions.subarray(0,this.writtenVertexBytes); + this.vertexArray.upload(view); + } + var nextState; + var batchSize = 0; + var start = 0; + this.currentState.shader = null; + this.currentState.shaderData = null; + this.currentState.texture = null; + this.currentState.textureSmooth = false; + this.currentState.blendMode = this.renderSession.blendModeManager.currentBlendMode; + this.currentState.colorTransform = null; + this.currentState.skipColorTransformAlpha = false; + var _g1 = 0; + var _g = this.batchedSprites; + while(_g1 < _g) { + var i = _g1++; + nextState = this.states[i]; + this.currentState.skipColorTransformAlpha = nextState.skipColorTransformAlpha; + if(!nextState.equals(this.currentState)) { + this.renderBatch(this.currentState,batchSize,start); + start = i; + batchSize = 0; + this.currentState.shader = nextState.shader; + this.currentState.shaderData = nextState.shaderData; + this.currentState.texture = nextState.texture; + this.currentState.textureSmooth = nextState.textureSmooth; + this.currentState.blendMode = nextState.blendMode; + this.currentState.skipColorTransform = nextState.skipColorTransform; + this.currentState.colorTransform = this.currentState.skipColorTransform ? null : nextState.colorTransform; + } + ++batchSize; + } + this.renderBatch(this.currentState,batchSize,start); + this.batchedSprites = 0; + this.writtenVertexBytes = 0; + if(this.clipRect != null) { + this.gl.disable(this.gl.SCISSOR_TEST); + } + } + ,renderBatch: function(state,size,start) { + if(size == 0 || state.texture == null) { + return; + } + var shader = state.shader == null ? this.renderSession.shaderManager.defaultShader : state.shader; + this.renderSession.shaderManager.setShader(shader); + shader.bindVertexArray(this.vertexArray); + this.renderSession.blendModeManager.setBlendMode(shader.blendMode != null ? shader.blendMode : state.blendMode); + this.gl.uniformMatrix3fv(shader.getUniformLocation("openfl_uProjectionMatrix"),false,this.renderSession.projectionMatrix.toArray(true)); + if(state.colorTransform != null) { + this.gl.uniform1i(shader.getUniformLocation("openfl_uUseColorTransform"),1); + var ct = state.colorTransform; + this.gl.uniform4f(shader.getUniformLocation("openfl_uColorMultiplier"),ct.redMultiplier,ct.greenMultiplier,ct.blueMultiplier,state.skipColorTransformAlpha ? 1 : ct.alphaMultiplier); + this.gl.uniform4f(shader.getUniformLocation("openfl_uColorOffset"),ct.redOffset / 255.,ct.greenOffset / 255.,ct.blueOffset / 255.,ct.alphaOffset / 255.); + } else { + this.gl.uniform1i(shader.getUniformLocation("openfl_uUseColorTransform"),0); + this.gl.uniform4f(shader.getUniformLocation("openfl_uColorMultiplier"),1,1,1,1); + this.gl.uniform4f(shader.getUniformLocation("openfl_uColorOffset"),0,0,0,0); + } + this.gl.activeTexture(this.gl.TEXTURE0); + this.gl.bindTexture(this.gl.TEXTURE_2D,state.texture); + this.gl.uniform1i(shader.getUniformLocation("openfl_uSampler0"),0); + if(shader.smooth != null && shader.smooth || state.textureSmooth) { + this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR); + this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR); + } else { + this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.NEAREST); + this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.NEAREST); + } + this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,shader.wrapS); + this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,shader.wrapT); + shader.applyData(state.shaderData,this.renderSession); + this.gl.drawElements(this.gl.TRIANGLES,size * 6,this.gl.UNSIGNED_SHORT,start * 6 * 2); + this.renderSession.drawCount++; + } + ,setState: function(index,texture,smooth,blendMode,colorTransform,shader,skipAlpha) { + if(skipAlpha == null) { + skipAlpha = false; + } + if(smooth == null) { + smooth = false; + } + var state = this.states[index]; + if(state == null) { + state = this.states[index] = new openfl__$internal_renderer_opengl_utils__$SpriteBatch_State(); + } + state.texture = texture; + state.textureSmooth = smooth; + state.blendMode = blendMode; + state.skipColorTransform = colorTransform != null && colorTransform.__isDefault(); + if(!state.skipColorTransform) { + state.colorTransform.redMultiplier = colorTransform.redMultiplier; + state.colorTransform.greenMultiplier = colorTransform.greenMultiplier; + state.colorTransform.blueMultiplier = colorTransform.blueMultiplier; + state.colorTransform.alphaMultiplier = colorTransform.alphaMultiplier; + state.colorTransform.redOffset = colorTransform.redOffset; + state.colorTransform.greenOffset = colorTransform.greenOffset; + state.colorTransform.blueOffset = colorTransform.blueOffset; + state.colorTransform.alphaOffset = colorTransform.alphaOffset; + } + state.skipColorTransformAlpha = skipAlpha; + if(shader == null) { + state.shader = null; + state.shaderData = null; + } else { + state.shader = shader.__shader; + state.shaderData = shader.data; + } + } + ,setContext: function(gl) { + this.gl = gl; + this.vertexArray.setContext(gl,this.positions); + this.indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,this.indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER,this.indices,gl.STATIC_DRAW); + } + ,prepareShader: function(flashShader,bd) { + if(flashShader != null) { + flashShader.__init(this.gl); + flashShader.__shader.wrapS = flashShader.repeatX; + flashShader.__shader.wrapT = flashShader.repeatY; + flashShader.__shader.smooth = flashShader.smooth; + flashShader.__shader.blendMode = flashShader.blendMode; + var objSize = flashShader.data.get(openfl_display_Shader.uObjectSize); + var texSize = flashShader.data.get(openfl_display_Shader.uTextureSize); + if(bd != null) { + objSize.value[0] = bd.width; + objSize.value[1] = bd.height; + if(bd.__pingPongTexture != null) { + texSize.value[0] = bd.__pingPongTexture.get_renderTexture().__width; + texSize.value[1] = bd.__pingPongTexture.get_renderTexture().__height; + } else { + texSize.value[0] = bd.width; + texSize.value[1] = bd.height; + } + } else { + objSize.value[0] = 0; + objSize.value[1] = 0; + texSize.value[0] = 0; + texSize.value[1] = 0; + } + } + } + ,getElementsPerVertex: function() { + var r = 0; + var _g = 0; + var _g1 = this.attributes; + while(_g < _g1.length) { + var a = _g1[_g]; + ++_g; + if(a.enabled) { + r += a.get_elements(); + } + } + return r; + } + ,__class__: openfl__$internal_renderer_opengl_utils_SpriteBatch +}; +var openfl__$internal_renderer_opengl_utils__$SpriteBatch_State = function() { + this.skipColorTransformAlpha = false; + this.skipColorTransform = false; + this.colorTransform = new openfl_geom_ColorTransform(); + this.textureSmooth = true; +}; +$hxClasses["openfl._internal.renderer.opengl.utils._SpriteBatch.State"] = openfl__$internal_renderer_opengl_utils__$SpriteBatch_State; +openfl__$internal_renderer_opengl_utils__$SpriteBatch_State.__name__ = ["openfl","_internal","renderer","opengl","utils","_SpriteBatch","State"]; +openfl__$internal_renderer_opengl_utils__$SpriteBatch_State.prototype = { + texture: null + ,textureSmooth: null + ,blendMode: null + ,colorTransform: null + ,skipColorTransform: null + ,skipColorTransformAlpha: null + ,shader: null + ,shaderData: null + ,equals: function(other) { + if((this.shader == null && other.shader == null || this.shader != null && other.shader != null && this.shader.ID == other.shader.ID) && this.texture == other.texture && this.textureSmooth == other.textureSmooth && this.blendMode == other.blendMode) { + if(!(this.skipColorTransform && other.skipColorTransform)) { + if(!this.skipColorTransform && !other.skipColorTransform) { + return this.colorTransform.__equals(other.colorTransform,this.skipColorTransformAlpha); + } else { + return false; + } + } else { + return true; + } + } else { + return false; + } + } + ,__class__: openfl__$internal_renderer_opengl_utils__$SpriteBatch_State +}; +var openfl__$internal_renderer_opengl_utils_StencilManager = function(gl) { + this.stencilMask = 0; + this.setContext(gl); + this.reverse = true; + this.count = 0; +}; +$hxClasses["openfl._internal.renderer.opengl.utils.StencilManager"] = openfl__$internal_renderer_opengl_utils_StencilManager; +openfl__$internal_renderer_opengl_utils_StencilManager.__name__ = ["openfl","_internal","renderer","opengl","utils","StencilManager"]; +openfl__$internal_renderer_opengl_utils_StencilManager.prototype = { + count: null + ,gl: null + ,reverse: null + ,stencilMask: null + ,prepareGraphics: function(fill,renderSession,translationMatrix) { + var shader = renderSession.shaderManager.fillShader; + renderSession.shaderManager.setShader(shader); + this.gl.uniformMatrix3fv(shader.getUniformLocation("openfl_uTranslationMatrix"),false,translationMatrix); + this.gl.uniformMatrix3fv(shader.getUniformLocation("openfl_uProjectionMatrix"),false,renderSession.projectionMatrix.toArray(true)); + fill.vertexArray.bind(); + shader.bindVertexArray(fill.vertexArray); + this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,fill.indexBuffer); + } + ,pushBucket: function(bucket,renderSession,translationMatrix,isMask) { + if(isMask == null) { + isMask = false; + } + if(!isMask) { + this.gl.enable(this.gl.STENCIL_TEST); + this.gl.clear(this.gl.STENCIL_BUFFER_BIT); + this.gl.stencilMask(255); + this.gl.colorMask(false,false,false,false); + this.gl.stencilFunc(this.gl.NEVER,1,255); + this.gl.stencilOp(this.gl.INVERT,this.gl.KEEP,this.gl.KEEP); + this.gl.clear(this.gl.STENCIL_BUFFER_BIT); + } + var _g = 0; + var _g1 = bucket.fills; + while(_g < _g1.length) { + var fill = _g1[_g]; + ++_g; + if(fill.available) { + continue; + } + this.prepareGraphics(fill,renderSession,translationMatrix); + this.gl.drawElements(fill.drawMode,fill.glIndices.length,this.gl.UNSIGNED_SHORT,0); + } + if(!isMask) { + this.gl.colorMask(true,true,true,true); + this.gl.stencilOp(this.gl.KEEP,this.gl.KEEP,this.gl.KEEP); + this.gl.stencilFunc(this.gl.EQUAL,255,255); + } + } + ,popBucket: function(object,bucket,renderSession) { + this.gl.disable(this.gl.STENCIL_TEST); + } + ,pushMask: function(object,renderSession) { + var maskGraphics = object.__maskGraphics; + if(maskGraphics == null || maskGraphics.__commands.get_length() <= 0) { + return; + } + if(this.stencilMask == 0) { + this.gl.enable(this.gl.STENCIL_TEST); + this.gl.clear(this.gl.STENCIL_BUFFER_BIT); + } + this.stencilMask++; + if(maskGraphics.__dirty) { + openfl__$internal_renderer_opengl_utils_GraphicsRenderer.updateGraphics(object,maskGraphics,renderSession.gl); + } + var func = this.stencilMask == 1 ? this.gl.NEVER : this.gl.EQUAL; + var ref = this.stencilMask; + var mask = 255 - this.stencilMask; + this.gl.stencilMask(255); + this.gl.colorMask(false,false,false,false); + this.gl.stencilFunc(func,ref,mask); + this.gl.stencilOp(this.gl.REPLACE,this.gl.KEEP,this.gl.KEEP); + var glStack = maskGraphics.__glStack[openfl__$internal_renderer_opengl_GLRenderer.glContextId]; + var bucket; + var translationMatrix = object.__worldTransform; + var _g1 = 0; + var _g = glStack.buckets.length; + while(_g1 < _g) { + var i = _g1++; + bucket = glStack.buckets[i]; + if(bucket.overrideMatrix != null) { + translationMatrix = bucket.overrideMatrix; + } else { + translationMatrix = object.__worldTransform; + } + var _g2 = bucket.mode; + switch(Type.enumIndex(_g2)) { + case 1:case 2: + this.pushBucket(bucket,renderSession,translationMatrix.toArray(true),true); + break; + default: + } + } + this.gl.colorMask(true,true,true,true); + this.gl.stencilOp(this.gl.KEEP,this.gl.KEEP,this.gl.KEEP); + this.gl.stencilFunc(this.gl.EQUAL,this.stencilMask,255); + } + ,popMask: function(object,renderSession) { + this.stencilMask--; + if(this.stencilMask <= 0) { + this.gl.disable(this.gl.STENCIL_TEST); + this.stencilMask = 0; + } + } + ,setContext: function(gl) { + this.gl = gl; + } + ,__class__: openfl__$internal_renderer_opengl_utils_StencilManager +}; +var openfl__$internal_renderer_opengl_utils_VertexArray = function(attributes,size,isStatic) { + if(isStatic == null) { + isStatic = false; + } + if(size == null) { + size = 0; + } + this.isStatic = false; + this.size = 0; + this.attributes = []; + this.size = size; + this.attributes = attributes; + if(size > 0) { + this.buffer = new ArrayBuffer(size); + } + this.isStatic = isStatic; +}; +$hxClasses["openfl._internal.renderer.opengl.utils.VertexArray"] = openfl__$internal_renderer_opengl_utils_VertexArray; +openfl__$internal_renderer_opengl_utils_VertexArray.__name__ = ["openfl","_internal","renderer","opengl","utils","VertexArray"]; +openfl__$internal_renderer_opengl_utils_VertexArray.prototype = { + gl: null + ,glBuffer: null + ,attributes: null + ,buffer: null + ,size: null + ,isStatic: null + ,bind: function() { + this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.glBuffer); + } + ,upload: function(view) { + this.gl.bufferSubData(this.gl.ARRAY_BUFFER,0,view); + } + ,setContext: function(gl,view) { + this.gl = gl; + this.glBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER,this.glBuffer); + gl.bufferData(gl.ARRAY_BUFFER,view,this.isStatic ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW); + } + ,get_stride: function() { + var s = 0; + var _g = 0; + var _g1 = this.attributes; + while(_g < _g1.length) { + var a = _g1[_g]; + ++_g; + if(a.enabled) { + s += a.get_elements() * 4; + } + } + return s; + } + ,__class__: openfl__$internal_renderer_opengl_utils_VertexArray + ,__properties__: {get_stride:"get_stride"} +}; +var openfl_display_Application = function() { + lime_app_Application.call(this); + if(openfl_Lib.application == null) { + openfl_Lib.application = this; + } +}; +$hxClasses["openfl.display.Application"] = openfl_display_Application; +openfl_display_Application.__name__ = ["openfl","display","Application"]; +openfl_display_Application.__super__ = lime_app_Application; +openfl_display_Application.prototype = $extend(lime_app_Application.prototype,{ + create: function(config) { + this.config = config; + this.backend.create(config); + if(config != null) { + if(Reflect.hasField(config,"fps")) { + this.set_frameRate(config.fps); + } + if(Reflect.hasField(config,"windows")) { + var _g = 0; + var _g1 = config.windows; + while(_g < _g1.length) { + var windowConfig = _g1[_g]; + ++_g; + var $window = new openfl_display_Window(windowConfig); + this.createWindow($window); + break; + } + } + if(this.preloader == null || this.preloader.complete) { + this.onPreloadComplete(); + } + } + } + ,__class__: openfl_display_Application +}); +var openfl_display_Bitmap = function(bitmapData,pixelSnapping,smoothing) { + if(smoothing == null) { + smoothing = false; + } + openfl_display_DisplayObject.call(this); + this.bitmapData = bitmapData; + this.pixelSnapping = pixelSnapping; + this.smoothing = smoothing; + if(pixelSnapping == null) { + this.pixelSnapping = 1; + } +}; +$hxClasses["openfl.display.Bitmap"] = openfl_display_Bitmap; +openfl_display_Bitmap.__name__ = ["openfl","display","Bitmap"]; +openfl_display_Bitmap.__super__ = openfl_display_DisplayObject; +openfl_display_Bitmap.prototype = $extend(openfl_display_DisplayObject.prototype,{ + bitmapData: null + ,pixelSnapping: null + ,smoothing: null + ,__getBounds: function(rect,matrix) { + if(this.bitmapData != null) { + var bounds = openfl_geom_Rectangle.__temp; + bounds.setTo(0,0,this.bitmapData.width,this.bitmapData.height); + bounds.__transform(bounds,matrix); + rect.__expand(bounds.x,bounds.y,bounds.width,bounds.height); + } + } + ,__hitTest: function(x,y,shapeFlag,stack,interactiveOnly,hitObject) { + if(!hitObject.get_visible() || this.__isMask || this.bitmapData == null) { + return false; + } + if(this.get_mask() != null && !this.get_mask().__hitTestMask(x,y)) { + return false; + } + this.__getWorldTransform(); + var px = this.__worldTransform.__transformInverseX(x,y); + var py = this.__worldTransform.__transformInverseY(x,y); + if(px > 0 && py > 0 && px <= this.bitmapData.width && py <= this.bitmapData.height) { + if(stack != null && !interactiveOnly) { + stack.push(hitObject); + } + return true; + } + return false; + } + ,__hitTestMask: function(x,y) { + if(this.bitmapData == null) { + return false; + } + this.__getWorldTransform(); + var px = this.__worldTransform.__transformInverseX(x,y); + var py = this.__worldTransform.__transformInverseY(x,y); + if(px > 0 && py > 0 && px <= this.bitmapData.width && py <= this.bitmapData.height) { + return true; + } + return false; + } + ,__renderCairo: function(renderSession) { + openfl__$internal_renderer_cairo_CairoBitmap.render(this,renderSession); + } + ,__renderCairoMask: function(renderSession) { + renderSession.cairo.rectangle(0,0,this.get_width(),this.get_height()); + } + ,__renderCanvas: function(renderSession) { + openfl__$internal_renderer_canvas_CanvasBitmap.render(this,renderSession); + } + ,__renderCanvasMask: function(renderSession) { + renderSession.context.rect(0,0,this.get_width(),this.get_height()); + } + ,__renderGL: function(renderSession) { + if(this.__cacheAsBitmap) { + this.__cacheGL(renderSession); + return; + } + this.__preRenderGL(renderSession); + openfl__$internal_renderer_opengl_GLBitmap.render(this,renderSession); + this.__postRenderGL(renderSession); + } + ,__updateMask: function(maskGraphics) { + if(this.bitmapData == null) { + return; + } + maskGraphics.__commands.overrideMatrix(this.__worldTransform); + maskGraphics.beginFill(0); + maskGraphics.drawRect(0,0,this.bitmapData.width,this.bitmapData.height); + if(maskGraphics.__bounds == null) { + maskGraphics.__bounds = new openfl_geom_Rectangle(); + } + this.__getBounds(maskGraphics.__bounds,openfl_geom_Matrix.__identity); + openfl_display_DisplayObject.prototype.__updateMask.call(this,maskGraphics); + } + ,get_height: function() { + if(this.bitmapData != null) { + return this.bitmapData.height * this.get_scaleY(); + } + return 0; + } + ,get_width: function() { + if(this.bitmapData != null) { + return this.bitmapData.width * this.get_scaleX(); + } + return 0; + } + ,__class__: openfl_display_Bitmap +}); +var openfl_display_BitmapData = function(width,height,transparent,fillColor) { + if(fillColor == null) { + fillColor = -1; + } + if(transparent == null) { + transparent = true; + } + this.__forcePremultiplied = true; + this.__usingPingPongTexture = false; + this.transparent = transparent; + if(width == null) { + width = 0; + } else { + width = width; + } + if(height == null) { + height = 0; + } else { + height = height; + } + if(width < 0) { + width = 0; + } else { + width = width; + } + if(height < 0) { + height = 0; + } else { + height = height; + } + this.width = width; + this.height = height; + this.rect = new openfl_geom_Rectangle(0,0,width,height); + if(width > 0 && height > 0) { + if(transparent) { + if((fillColor & -16777216) == 0) { + fillColor = 0; + } + } else { + fillColor = -16777216 | fillColor & 16777215; + } + fillColor = fillColor << 8 | fillColor >>> 24 & 255; + this.image = new lime_graphics_Image(null,0,0,width,height,fillColor); + this.image.set_transparent(transparent); + this.__isValid = true; + } + this.__createUVs(); + this.__worldTransform = new openfl_geom_Matrix(); + this.__worldColorTransform = new openfl_geom_ColorTransform(); +}; +$hxClasses["openfl.display.BitmapData"] = openfl_display_BitmapData; +openfl_display_BitmapData.__name__ = ["openfl","display","BitmapData"]; +openfl_display_BitmapData.__interfaces__ = [openfl_display_IBitmapDrawable]; +openfl_display_BitmapData.fromBase64 = function(base64,type,onload) { + var bitmapData = new openfl_display_BitmapData(0,0,true); + bitmapData.__fromBase64(base64,type,onload); + return bitmapData; +}; +openfl_display_BitmapData.fromBytes = function(bytes,rawAlpha,onload) { + var bitmapData = new openfl_display_BitmapData(0,0,true); + bitmapData.__fromBytes(bytes,rawAlpha,onload); + return bitmapData; +}; +openfl_display_BitmapData.fromCanvas = function(canvas,transparent) { + if(transparent == null) { + transparent = true; + } + if(canvas == null) { + return null; + } + var bitmapData = new openfl_display_BitmapData(0,0,transparent); + bitmapData.__fromImage(lime_graphics_Image.fromCanvas(canvas)); + bitmapData.image.set_transparent(transparent); + return bitmapData; +}; +openfl_display_BitmapData.fromFile = function(path,onload,onerror) { + var bitmapData = new openfl_display_BitmapData(0,0,true); + bitmapData.__fromFile(path,onload,onerror); + return bitmapData; +}; +openfl_display_BitmapData.fromImage = function(image,transparent) { + if(transparent == null) { + transparent = true; + } + if(image == null || image.buffer == null) { + return null; + } + var bitmapData = new openfl_display_BitmapData(0,0,transparent); + bitmapData.__fromImage(image); + bitmapData.image.set_transparent(transparent); + return bitmapData; +}; +openfl_display_BitmapData.__asRenderTexture = function(width,height) { + if(height == null) { + height = 0; + } + if(width == null) { + width = 0; + } + var b = new openfl_display_BitmapData(0,0); + b.__resize(width,height); + return b; +}; +openfl_display_BitmapData.prototype = { + height: null + ,image: null + ,rect: null + ,transparent: null + ,width: null + ,__worldTransform: null + ,__worldColorTransform: null + ,__cacheAsBitmap: null + ,__blendMode: null + ,__shader: null + ,__isValid: null + ,__surface: null + ,__texture: null + ,__pingPongTexture: null + ,__usingPingPongTexture: null + ,__uvData: null + ,colorTransform: function(rect,colorTransform) { + if(!this.__isValid) { + return; + } + this.image.colorTransform(rect.__toLimeRectangle(),colorTransform.__toLimeColorMatrix()); + this.__usingPingPongTexture = false; + } + ,copyPixels: function(sourceBitmapData,sourceRect,destPoint,alphaBitmapData,alphaPoint,mergeAlpha) { + if(mergeAlpha == null) { + mergeAlpha = false; + } + if(!this.__isValid || sourceBitmapData == null) { + return; + } + this.image.copyPixels(sourceBitmapData.image,sourceRect.__toLimeRectangle(),destPoint.__toLimeVector2(),alphaBitmapData != null ? alphaBitmapData.image : null,alphaPoint != null ? alphaPoint.__toLimeVector2() : null,mergeAlpha); + this.__usingPingPongTexture = false; + } + ,getPixel: function(x,y) { + if(!this.__isValid) { + return 0; + } + return this.image.getPixel(x,y,1); + } + ,getSurface: function() { + if(!this.__isValid) { + return null; + } + if(this.__surface == null) { + this.__surface = lime_graphics_cairo__$CairoImageSurface_CairoImageSurface_$Impl_$.fromImage(this.image); + } + return this.__surface; + } + ,__forcePremultiplied: null + ,getTexture: function(gl) { + if(!this.__isValid) { + return null; + } + if(this.__usingPingPongTexture && this.__pingPongTexture != null) { + return this.__pingPongTexture.get_texture(); + } + if(this.__texture == null) { + this.__texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D,this.__texture); + gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.NEAREST); + gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.NEAREST); + this.image.dirty = true; + } + if(this.image != null && this.image.dirty) { + var internalFormat; + var format; + if(this.__surface != null) { + lime_graphics_cairo__$CairoSurface_CairoSurface_$Impl_$.flush(this.__surface); + } + if(this.image.buffer.bitsPerPixel == 1) { + internalFormat = gl.ALPHA; + format = gl.ALPHA; + } else { + internalFormat = gl.RGBA; + format = gl.RGBA; + } + gl.bindTexture(gl.TEXTURE_2D,this.__texture); + var textureImage = this.image; + if(this.__forcePremultiplied && (!textureImage.get_premultiplied() && textureImage.get_transparent() || textureImage.get_format() != 0)) { + textureImage = textureImage.clone(); + textureImage.set_format(0); + textureImage.set_premultiplied(true); + } + gl.texImage2D(gl.TEXTURE_2D,0,internalFormat,this.width,this.height,0,format,gl.UNSIGNED_BYTE,textureImage.get_data()); + gl.bindTexture(gl.TEXTURE_2D,null); + this.image.dirty = false; + } + return this.__texture; + } + ,setPixel: function(x,y,color) { + if(!this.__isValid) { + return; + } + this.image.setPixel(x,y,color,1); + this.__usingPingPongTexture = false; + } + ,__createUVs: function(x0,y0,x1,y1,x2,y2,x3,y3) { + if(y3 == null) { + y3 = 1; + } + if(x3 == null) { + x3 = 0; + } + if(y2 == null) { + y2 = 1; + } + if(x2 == null) { + x2 = 1; + } + if(y1 == null) { + y1 = 0; + } + if(x1 == null) { + x1 = 1; + } + if(y0 == null) { + y0 = 0; + } + if(x0 == null) { + x0 = 0; + } + if(this.__uvData == null) { + this.__uvData = new openfl_display_TextureUvs(); + } + this.__uvData.x0 = x0; + this.__uvData.y0 = y0; + this.__uvData.x1 = x1; + this.__uvData.y1 = y1; + this.__uvData.x2 = x2; + this.__uvData.y2 = y2; + this.__uvData.x3 = x3; + this.__uvData.y3 = y3; + } + ,__drawGL: function(renderSession,source,matrix,colorTransform,blendMode,clipRect,smoothing,drawSelf,clearBuffer,readPixels,powerOfTwo) { + if(powerOfTwo == null) { + powerOfTwo = true; + } + if(readPixels == null) { + readPixels = false; + } + if(clearBuffer == null) { + clearBuffer = false; + } + if(drawSelf == null) { + drawSelf = false; + } + if(smoothing == null) { + smoothing = false; + } + this.__pingPongTexture = openfl__$internal_renderer_opengl_GLBitmap.pushFramebuffer(renderSession,this.__pingPongTexture,this.rect,smoothing,this.transparent,clearBuffer,powerOfTwo); + openfl__$internal_renderer_opengl_GLBitmap.drawBitmapDrawable(renderSession,drawSelf ? this : null,source,matrix,colorTransform,blendMode,clipRect); + openfl__$internal_renderer_opengl_GLBitmap.popFramebuffer(renderSession,readPixels ? this.image : null); + var uv = this.__pingPongTexture.get_renderTexture().__uvData; + this.__createUVs(uv.x0,uv.y0,uv.x1,uv.y1,uv.x2,uv.y2,uv.x3,uv.y3); + this.__isValid = true; + this.__usingPingPongTexture = true; + } + ,__fromBase64: function(base64,type,onload) { + var _gthis = this; + lime_graphics_Image.fromBase64(base64,type,function(image) { + _gthis.__fromImage(image); + if(onload != null) { + onload(_gthis); + } + }); + } + ,__fromBytes: function(bytes,rawAlpha,onload) { + var _gthis = this; + lime_graphics_Image.fromBytes(openfl_utils__$ByteArray_ByteArray_$Impl_$.toBytes(bytes),function(image) { + _gthis.__fromImage(image); + if(rawAlpha != null) { + lime_graphics_utils_ImageCanvasUtil.convertToCanvas(image); + lime_graphics_utils_ImageCanvasUtil.createImageData(image); + var data = image.buffer.data; + var _g1 = 0; + var _g = openfl_utils__$ByteArray_ByteArray_$Impl_$.get_length(rawAlpha); + while(_g1 < _g) { + var i = _g1++; + data[i * 4 + 3] = rawAlpha.readUnsignedByte(); + } + image.dirty = true; + } + if(onload != null) { + onload(_gthis); + } + }); + } + ,__fromFile: function(path,onload,onerror) { + var _gthis = this; + lime_graphics_Image.fromFile(path,function(image) { + _gthis.__fromImage(image); + if(onload != null) { + onload(_gthis); + } + },onerror); + } + ,__fromImage: function(image) { + if(image != null && image.buffer != null) { + this.image = image; + this.width = image.width; + this.height = image.height; + this.rect = new openfl_geom_Rectangle(0,0,image.width,image.height); + this.__isValid = true; + } + } + ,__renderGL: function(renderSession) { + renderSession.spriteBatch.renderBitmapData(this,false,this.__worldTransform,this.__worldColorTransform,this.__worldColorTransform.alphaMultiplier,this.__blendMode,this.__shader); + } + ,__resize: function(width,height) { + this.width = width; + this.height = height; + this.rect.width = width; + this.rect.height = height; + } + ,__sync: function() { + lime_graphics_utils_ImageCanvasUtil.sync(this.image,false); + } + ,__updateChildren: function(transformOnly) { + } + ,__updateTransforms: function(overrideTransform) { + if(overrideTransform == null) { + this.__worldTransform.identity(); + } else { + this.__worldTransform = overrideTransform; + } + } + ,__class__: openfl_display_BitmapData +}; +var openfl_display_TextureUvs = function() { + this.y3 = 0; + this.y2 = 0; + this.y1 = 0; + this.y0 = 0; + this.x3 = 0; + this.x2 = 0; + this.x1 = 0; + this.x0 = 0; +}; +$hxClasses["openfl.display.TextureUvs"] = openfl_display_TextureUvs; +openfl_display_TextureUvs.__name__ = ["openfl","display","TextureUvs"]; +openfl_display_TextureUvs.prototype = { + x0: null + ,x1: null + ,x2: null + ,x3: null + ,y0: null + ,y1: null + ,y2: null + ,y3: null + ,__class__: openfl_display_TextureUvs +}; +var openfl_display__$CapsStyle_CapsStyle_$Impl_$ = {}; +$hxClasses["openfl.display._CapsStyle.CapsStyle_Impl_"] = openfl_display__$CapsStyle_CapsStyle_$Impl_$; +openfl_display__$CapsStyle_CapsStyle_$Impl_$.__name__ = ["openfl","display","_CapsStyle","CapsStyle_Impl_"]; +openfl_display__$CapsStyle_CapsStyle_$Impl_$.toString = function(value) { + switch(value) { + case 0: + return "none"; + case 1: + return "round"; + case 2: + return "square"; + default: + return null; + } +}; +var openfl_display_DirectRenderer = function() { }; +$hxClasses["openfl.display.DirectRenderer"] = openfl_display_DirectRenderer; +openfl_display_DirectRenderer.__name__ = ["openfl","display","DirectRenderer"]; +openfl_display_DirectRenderer.__super__ = openfl_display_DisplayObject; +openfl_display_DirectRenderer.prototype = $extend(openfl_display_DisplayObject.prototype,{ + __render: null + ,__class__: openfl_display_DirectRenderer +}); +var openfl_display_FrameLabel = function() { }; +$hxClasses["openfl.display.FrameLabel"] = openfl_display_FrameLabel; +openfl_display_FrameLabel.__name__ = ["openfl","display","FrameLabel"]; +openfl_display_FrameLabel.__super__ = openfl_events_EventDispatcher; +openfl_display_FrameLabel.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + __class__: openfl_display_FrameLabel +}); +var openfl_display_Graphics = function() { + this.__glStack = []; + this.__dirty = true; + this.__commands = new openfl__$internal_renderer_DrawCommandBuffer(); + this.__strokePadding = 0; + this.__positionX = 0; + this.__positionY = 0; + this.__hardware = true; + this.moveTo(0,0); +}; +$hxClasses["openfl.display.Graphics"] = openfl_display_Graphics; +openfl_display_Graphics.__name__ = ["openfl","display","Graphics"]; +openfl_display_Graphics.prototype = { + __hardware: null + ,__bounds: null + ,__commands: null + ,__dirty: null + ,__glStack: null + ,__drawPaths: null + ,__positionX: null + ,__positionY: null + ,__strokePadding: null + ,__transformDirty: null + ,__visible: null + ,__owner: null + ,__canvas: null + ,__context: null + ,__bitmap: null + ,beginBitmapFill: function(bitmap,matrix,repeat,smooth) { + if(smooth == null) { + smooth = false; + } + if(repeat == null) { + repeat = true; + } + this.__commands.beginBitmapFill(bitmap,matrix != null ? matrix.clone() : null,repeat,smooth); + this.__visible = true; + } + ,beginFill: function(color,alpha) { + if(alpha == null) { + alpha = 1; + } + if(color == null) { + color = 0; + } + this.__commands.beginFill(color & 16777215,alpha); + if(alpha > 0) { + this.__visible = true; + } + } + ,clear: function() { + this.__commands.clear(); + this.__strokePadding = 0; + if(this.__bounds != null) { + this.set___dirty(true); + this.__transformDirty = true; + this.__bounds = null; + } + this.__visible = false; + this.__hardware = true; + this.moveTo(0,0); + } + ,dispose: function() { + var _g = 0; + var _g1 = this.__glStack; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + if(s != null) { + s.reset(); + } + } + this.set___dirty(true); + } + ,drawRect: function(x,y,width,height) { + if(width <= 0 || height <= 0) { + return; + } + this.__inflateBounds(x - this.__strokePadding,y - this.__strokePadding); + this.__inflateBounds(x + width + this.__strokePadding,y + height + this.__strokePadding); + this.__commands.drawRect(x,y,width,height); + this.set___dirty(true); + } + ,drawTiles: function(sheet,tileData,smooth,flags,shader,count) { + if(count == null) { + count = -1; + } + if(flags == null) { + flags = 0; + } + if(smooth == null) { + smooth = false; + } + var useScale = (flags & 1) > 0; + var useRotation = (flags & 2) > 0; + var useRGB = (flags & 4) > 0; + var useAlpha = (flags & 8) > 0; + var useTransform = (flags & 16) > 0; + var useColorTransform = (flags & 128) > 0; + var useRect = (flags & 32) > 0; + var useOrigin = (flags & 64) > 0; + var rect = openfl_geom_Rectangle.__temp; + var matrix = openfl_geom_Matrix.__temp; + var numValues = 3; + var totalCount = count; + if(count < 0) { + totalCount = tileData.length; + } + if(useTransform || useScale || useRotation || useRGB || useAlpha || useColorTransform) { + var scaleIndex = 0; + var rotationIndex = 0; + var transformIndex = 0; + if(useRect) { + if(useOrigin) { + numValues = 8; + } else { + numValues = 6; + } + } + if(useScale) { + scaleIndex = numValues; + ++numValues; + } + if(useRotation) { + rotationIndex = numValues; + ++numValues; + } + if(useTransform) { + transformIndex = numValues; + numValues += 4; + } + if(useRGB) { + numValues += 3; + } + if(useAlpha) { + ++numValues; + } + if(useColorTransform) { + numValues += 4; + } + var itemCount = Std["int"](totalCount / numValues); + var index = 0; + var cacheID = -1; + var x; + var y; + var id; + var scale; + var rotation; + var tileWidth; + var tileHeight; + var originX; + var originY; + var tile = null; + var tilePoint = null; + while(index < totalCount) { + x = tileData[index]; + y = tileData[index + 1]; + if(!useRect) { + id = Std["int"](tileData[index + 2]); + } else { + id = -1; + } + scale = 1.0; + rotation = 0.0; + if(useScale) { + scale = tileData[index + scaleIndex]; + } + if(useRotation) { + rotation = tileData[index + rotationIndex]; + } + if(id < 0) { + tile = null; + } else if(!useRect && cacheID != id) { + cacheID = id; + tile = sheet.__tileRects[id]; + tilePoint = sheet.__centerPoints[id]; + } else if(useRect) { + tile = sheet.__rectTile; + tile.setTo(tileData[index + 2],tileData[index + 3],tileData[index + 4],tileData[index + 5]); + tilePoint = sheet.__point; + if(useOrigin) { + tilePoint.setTo(tileData[index + 6] / tile.width,tileData[index + 7] / tile.height); + } else { + tilePoint.setTo(0,0); + } + } + if(tile != null) { + if(useTransform) { + rect.setTo(0,0,tile.width,tile.height); + matrix.setTo(tileData[index + transformIndex],tileData[index + transformIndex + 1],tileData[index + transformIndex + 2],tileData[index + transformIndex + 3],0,0); + originX = tilePoint.x * scale; + originY = tilePoint.y * scale; + matrix.translate(x - matrix.__transformX(originX,originY),y - matrix.__transformY(originX,originY)); + rect.__transform(rect,matrix); + this.__inflateBounds(rect.x,rect.y); + this.__inflateBounds(rect.get_right(),rect.get_bottom()); + } else { + tileWidth = tile.width * scale; + tileHeight = tile.height * scale; + x -= tilePoint.x * tileWidth; + y -= tilePoint.y * tileHeight; + if(rotation != 0) { + rect.setTo(0,0,tileWidth,tileHeight); + matrix.identity(); + matrix.rotate(rotation); + matrix.translate(x,y); + rect.__transform(rect,matrix); + this.__inflateBounds(rect.x,rect.y); + this.__inflateBounds(rect.get_right(),rect.get_bottom()); + } else { + this.__inflateBounds(x,y); + this.__inflateBounds(x + tileWidth,y + tileHeight); + } + } + } + index += numValues; + } + } else { + var x1; + var y1; + var id1; + var tile1; + var centerPoint; + var originX1; + var originY1; + var rect1 = openfl_geom_Rectangle.__temp; + var index1 = 0; + while(index1 < totalCount) { + x1 = tileData[index1++]; + y1 = tileData[index1++]; + if(!useRect) { + id1 = Std["int"](tileData[index1++]); + } else { + id1 = -1; + } + originX1 = 0.0; + originY1 = 0.0; + if(useRect) { + rect1.setTo(tileData[index1++],tileData[index1++],tileData[index1++],tileData[index1++]); + if(useOrigin) { + originX1 = tileData[index1++]; + originY1 = tileData[index1++]; + } + this.__inflateBounds(x1 - originX1,y1 - originY1); + this.__inflateBounds(x1 - originX1 + rect1.width,y1 - originY1 + rect1.height); + } else { + tile1 = sheet.__tileRects[id1]; + if(tile1 != null) { + centerPoint = sheet.__centerPoints[id1]; + originX1 = centerPoint.x * tile1.width; + originY1 = centerPoint.y * tile1.height; + this.__inflateBounds(x1 - originX1,y1 - originY1); + this.__inflateBounds(x1 - originX1 + tile1.width,y1 - originY1 + tile1.height); + } + } + } + } + this.__commands.drawTiles(sheet,tileData,smooth,flags,shader,count); + this.set___dirty(true); + this.__visible = true; + } + ,endFill: function() { + this.__commands.endFill(); + } + ,lineStyle: function(thickness,color,alpha,pixelHinting,scaleMode,caps,joints,miterLimit) { + if(miterLimit == null) { + miterLimit = 3; + } + if(scaleMode == null) { + scaleMode = 2; + } + if(pixelHinting == null) { + pixelHinting = false; + } + if(alpha == null) { + alpha = 1; + } + if(color == null) { + color = 0; + } + if(thickness != null) { + if(joints == 1) { + if(thickness > this.__strokePadding) { + this.__strokePadding = thickness; + } + } else if(thickness / 2 > this.__strokePadding) { + this.__strokePadding = thickness / 2; + } + } + this.__commands.lineStyle(thickness,color,alpha,pixelHinting,scaleMode,caps,joints,miterLimit); + if(thickness != null) { + this.__visible = true; + } + } + ,lineTo: function(x,y) { + this.__inflateBounds(this.__positionX - this.__strokePadding,this.__positionY - this.__strokePadding); + this.__inflateBounds(this.__positionX + this.__strokePadding,this.__positionY + this.__strokePadding); + this.__positionX = x; + this.__positionY = y; + this.__inflateBounds(this.__positionX - this.__strokePadding,this.__positionY - this.__strokePadding); + this.__inflateBounds(this.__positionX + this.__strokePadding * 2,this.__positionY + this.__strokePadding); + this.__commands.lineTo(x,y); + this.__hardware = false; + this.set___dirty(true); + } + ,moveTo: function(x,y) { + this.__positionX = x; + this.__positionY = y; + this.__commands.moveTo(x,y); + } + ,__getBounds: function(rect,matrix) { + if(this.__bounds == null) { + return; + } + var bounds = openfl_geom_Rectangle.__temp; + this.__bounds.__transform(bounds,matrix); + rect.__expand(bounds.x,bounds.y,bounds.width,bounds.height); + } + ,__hitTest: function(x,y,shapeFlag,matrix) { + if(this.__bounds == null) { + return false; + } + var px = matrix.__transformInverseX(x,y); + var py = matrix.__transformInverseY(x,y); + if(px > this.__bounds.x && py > this.__bounds.y && this.__bounds.contains(px,py)) { + if(shapeFlag) { + return openfl__$internal_renderer_canvas_CanvasGraphics.hitTest(this,px,py); + } + return true; + } + return false; + } + ,__inflateBounds: function(x,y) { + if(this.__bounds == null) { + this.__bounds = new openfl_geom_Rectangle(x,y,0,0); + this.__transformDirty = true; + return; + } + if(x < this.__bounds.x) { + this.__bounds.width += this.__bounds.x - x; + this.__bounds.x = x; + this.__transformDirty = true; + } + if(y < this.__bounds.y) { + this.__bounds.height += this.__bounds.y - y; + this.__bounds.y = y; + this.__transformDirty = true; + } + if(x > this.__bounds.x + this.__bounds.width) { + this.__bounds.width = x - this.__bounds.x; + } + if(y > this.__bounds.y + this.__bounds.height) { + this.__bounds.height = y - this.__bounds.y; + } + } + ,set___dirty: function(value) { + if(value && this.__owner != null) { + this.__owner.__setRenderDirty(); + } + return this.__dirty = value; + } + ,__class__: openfl_display_Graphics + ,__properties__: {set___dirty:"set___dirty"} +}; +var openfl_display__$JointStyle_JointStyle_$Impl_$ = {}; +$hxClasses["openfl.display._JointStyle.JointStyle_Impl_"] = openfl_display__$JointStyle_JointStyle_$Impl_$; +openfl_display__$JointStyle_JointStyle_$Impl_$.__name__ = ["openfl","display","_JointStyle","JointStyle_Impl_"]; +openfl_display__$JointStyle_JointStyle_$Impl_$.toString = function(value) { + switch(value) { + case 0: + return "bevel"; + case 1: + return "miter"; + case 2: + return "round"; + default: + return null; + } +}; +var openfl_display_Loader = function() { }; +$hxClasses["openfl.display.Loader"] = openfl_display_Loader; +openfl_display_Loader.__name__ = ["openfl","display","Loader"]; +openfl_display_Loader.__super__ = openfl_display_DisplayObjectContainer; +openfl_display_Loader.prototype = $extend(openfl_display_DisplayObjectContainer.prototype,{ + __class__: openfl_display_Loader +}); +var openfl_display_OpenGLView = function() { }; +$hxClasses["openfl.display.OpenGLView"] = openfl_display_OpenGLView; +openfl_display_OpenGLView.__name__ = ["openfl","display","OpenGLView"]; +openfl_display_OpenGLView.__properties__ = {get_isSupported:"get_isSupported"}; +openfl_display_OpenGLView.get_isSupported = function() { + if(!window.WebGLRenderingContext) { + return false; + } + if(lime_graphics_opengl_GL.context != null) { + return true; + } else { + var canvas = js_Browser.get_document().createElement("canvas"); + var context = canvas.getContext("webgl"); + if(context == null) { + context = canvas.getContext("experimental-webgl"); + } + return context != null; + } +}; +openfl_display_OpenGLView.__super__ = openfl_display_DirectRenderer; +openfl_display_OpenGLView.prototype = $extend(openfl_display_DirectRenderer.prototype,{ + __renderCanvas: function(renderSession) { + } + ,__renderGL: function(renderSession) { + if(this.stage != null && this.__renderable) { + var rect = null; + if(this.get_scrollRect() == null) { + rect = new openfl_geom_Rectangle(0,0,this.stage.stageWidth,this.stage.stageHeight); + } else { + rect = new openfl_geom_Rectangle(this.get_x() + this.get_scrollRect().x,this.get_y() + this.get_scrollRect().y,this.get_scrollRect().width,this.get_scrollRect().height); + } + if(this.__render != null) { + this.__render(rect); + } + renderSession.shaderManager.setShader(null); + renderSession.blendModeManager.setBlendMode(null); + } + } + ,__class__: openfl_display_OpenGLView +}); +var openfl_display_Preloader = function(display) { + lime_app_Preloader.call(this); + if(display != null) { + this.display = display; + openfl_Lib.current.addChild(display); + if(Std["is"](display,NMEPreloader)) { + (js_Boot.__cast(display , NMEPreloader)).onInit(); + } + } +}; +$hxClasses["openfl.display.Preloader"] = openfl_display_Preloader; +openfl_display_Preloader.__name__ = ["openfl","display","Preloader"]; +openfl_display_Preloader.__super__ = lime_app_Preloader; +openfl_display_Preloader.prototype = $extend(lime_app_Preloader.prototype,{ + display: null + ,load: function(urls,types) { + lime_app_Preloader.prototype.load.call(this,urls,types); + } + ,loadSound: function(url) { + var sound = new openfl_media_Sound(); + sound.addEventListener("complete",$bind(this,this.sound_onComplete)); + sound.addEventListener("ioError",$bind(this,this.sound_onIOError)); + sound.load(new openfl_net_URLRequest(haxe_io_Path.withoutExtension(url) + ".ogg")); + } + ,start: function() { + if(this.display != null && Std["is"](this.display,NMEPreloader)) { + this.display.addEventListener("complete",$bind(this,this.display_onComplete)); + (js_Boot.__cast(this.display , NMEPreloader)).onLoaded(this); + } else { + lime_app_Preloader.prototype.start.call(this); + } + } + ,update: function(loaded,total) { + if(this.display != null && Std["is"](this.display,NMEPreloader)) { + (js_Boot.__cast(this.display , NMEPreloader)).onUpdate(loaded,total); + } + } + ,display_onComplete: function(event) { + this.display.removeEventListener("complete",$bind(this,this.display_onComplete)); + openfl_Lib.current.removeChild(this.display); + openfl_Lib.current.stage.set_focus(null); + this.display = null; + lime_app_Preloader.prototype.start.call(this); + } + ,sound_onComplete: function(event) { + this.assetLoaded(); + } + ,sound_onIOError: function(event) { + if(openfl_display_Preloader.soundFail != null) { + openfl_display_Preloader.soundFail(); + } + this.assetLoaded(); + } + ,__class__: openfl_display_Preloader +}); +var openfl_display_Shader = function() { + this.__dirty = true; + this.repeatY = 33071; + this.repeatX = 33071; +}; +$hxClasses["openfl.display.Shader"] = openfl_display_Shader; +openfl_display_Shader.__name__ = ["openfl","display","Shader"]; +openfl_display_Shader.prototype = { + data: null + ,repeatX: null + ,repeatY: null + ,smooth: null + ,blendMode: null + ,__dirty: null + ,__fragmentCode: null + ,__vertexCode: null + ,__shader: null + ,__init: function(gl) { + var dirty = this.__dirty; + if(dirty) { + if(this.__shader != null) { + this.__shader.destroy(); + } + this.__shader = new openfl__$internal_renderer_opengl_shaders2_Shader(gl); + var tmp = this.__vertexCode != null ? this.__vertexCode : openfl__$internal_renderer_opengl_shaders2_DefaultShader.VERTEX_SRC.join("\n"); + this.__shader.vertexString = tmp; + this.__shader.fragmentString = this.__fragmentCode; + this.__dirty = false; + } + this.__shader.init(dirty); + } + ,__class__: openfl_display_Shader +}; +var openfl_display_GLShaderParameter = function() { + this.internalType = 0; + this.transpose = false; + this.repeatY = 33071; + this.repeatX = 33071; + this.smooth = false; + this.size = 0; +}; +$hxClasses["openfl.display.GLShaderParameter"] = openfl_display_GLShaderParameter; +openfl_display_GLShaderParameter.__name__ = ["openfl","display","GLShaderParameter"]; +openfl_display_GLShaderParameter.prototype = { + size: null + ,value: null + ,bitmap: null + ,smooth: null + ,repeatX: null + ,repeatY: null + ,transpose: null + ,internalType: null + ,__class__: openfl_display_GLShaderParameter +}; +var openfl_display_Stage = function(window,color) { + openfl_display_DisplayObjectContainer.call(this); + this.application = window.application; + this.window = window; + if(color == null) { + this.__transparent = true; + this.set_color(0); + } else { + this.set_color(color); + } + this.set_name(null); + this.__deltaTime = 0; + this.__displayState = 2; + this.__mouseX = 0; + this.__mouseY = 0; + this.__lastClickTime = 0; + this.stageWidth = Std["int"](window.get_width() * window.get_scale()); + this.stageHeight = Std["int"](window.get_height() * window.get_scale()); + this.stage = this; + this.align = 6; + this.allowsFullScreen = false; + this.allowsFullScreenInteractive = false; + this.quality = 1; + this.scaleMode = 2; + this.stageFocusRect = true; + this.__macKeyboard = /AppleWebKit/.test (navigator.userAgent) && /Mobile\/\w+/.test (navigator.userAgent) || /Mac/.test (navigator.platform); + this.__clearBeforeRender = true; + this.__stack = []; + this.__mouseOutStack = []; + var this1 = new openfl_VectorData(); + var this2 = new Array(0); + this1.data = this2; + this1.length = 0; + this1.fixed = false; + this.stage3Ds = this1; + var this3 = this.stage3Ds; + var x = new openfl_display_Stage3D(); + if(!this3.fixed) { + this3.length++; + if(this3.data.length < this3.length) { + var length = this3.data.length + 10; + var this4 = new Array(length); + var data = this4; + haxe_ds__$Vector_Vector_$Impl_$.blit(this3.data,0,data,0,this3.data.length); + this3.data = data; + } + this3.data[this3.length - 1] = x; + } + if(openfl_Lib.current.stage == null) { + this.stage.addChild(openfl_Lib.current); + } +}; +$hxClasses["openfl.display.Stage"] = openfl_display_Stage; +openfl_display_Stage.__name__ = ["openfl","display","Stage"]; +openfl_display_Stage.__interfaces__ = [lime_app_IModule]; +openfl_display_Stage.__super__ = openfl_display_DisplayObjectContainer; +openfl_display_Stage.prototype = $extend(openfl_display_DisplayObjectContainer.prototype,{ + align: null + ,allowsFullScreen: null + ,allowsFullScreenInteractive: null + ,application: null + ,quality: null + ,scaleMode: null + ,stage3Ds: null + ,stageFocusRect: null + ,stageHeight: null + ,stageWidth: null + ,window: null + ,__clearBeforeRender: null + ,__color: null + ,__colorSplit: null + ,__colorString: null + ,__deltaTime: null + ,__dirty: null + ,__displayState: null + ,__dragBounds: null + ,__dragObject: null + ,__dragOffsetX: null + ,__dragOffsetY: null + ,__focus: null + ,__invalidated: null + ,__lastClickTime: null + ,__macKeyboard: null + ,__mouseDownLeft: null + ,__mouseDownMiddle: null + ,__mouseDownRight: null + ,__mouseOutStack: null + ,__mouseX: null + ,__mouseY: null + ,__renderer: null + ,__rendering: null + ,__stack: null + ,__transparent: null + ,globalToLocal: function(pos) { + return pos.clone(); + } + ,localToGlobal: function(pos) { + return pos.clone(); + } + ,onGamepadAxisMove: function(gamepad,axis,value) { + openfl_ui_GameInput.__onGamepadAxisMove(gamepad,axis,value); + } + ,onGamepadButtonDown: function(gamepad,button) { + openfl_ui_GameInput.__onGamepadButtonDown(gamepad,button); + } + ,onGamepadButtonUp: function(gamepad,button) { + openfl_ui_GameInput.__onGamepadButtonUp(gamepad,button); + } + ,onGamepadConnect: function(gamepad) { + openfl_ui_GameInput.__onGamepadConnect(gamepad); + } + ,onGamepadDisconnect: function(gamepad) { + openfl_ui_GameInput.__onGamepadDisconnect(gamepad); + } + ,onJoystickAxisMove: function(joystick,axis,value) { + } + ,onJoystickButtonDown: function(joystick,button) { + } + ,onJoystickButtonUp: function(joystick,button) { + } + ,onJoystickConnect: function(joystick) { + } + ,onJoystickDisconnect: function(joystick) { + } + ,onJoystickHatMove: function(joystick,hat,position) { + } + ,onJoystickTrackballMove: function(joystick,trackball,value) { + } + ,onKeyDown: function(window,keyCode,modifier) { + if(this.window == null || this.window != window) { + return; + } + this.__onKey("keyDown",keyCode,modifier); + } + ,onKeyUp: function(window,keyCode,modifier) { + if(this.window == null || this.window != window) { + return; + } + this.__onKey("keyUp",keyCode,modifier); + } + ,onModuleExit: function(code) { + if(this.window != null) { + var event = new openfl_events_Event("deactivate"); + this.__broadcast(event,true); + } + } + ,onMouseDown: function(window,x,y,button) { + if(this.window == null || this.window != window) { + return; + } + var type; + switch(button) { + case 1: + type = "middleMouseDown"; + break; + case 2: + type = "rightMouseDown"; + break; + default: + type = "mouseDown"; + } + this.__onMouse(type,Std["int"](x * window.get_scale()),Std["int"](y * window.get_scale()),button); + } + ,onMouseMove: function(window,x,y) { + if(this.window == null || this.window != window) { + return; + } + this.__onMouse("mouseMove",Std["int"](x * window.get_scale()),Std["int"](y * window.get_scale()),0); + } + ,onMouseMoveRelative: function(window,x,y) { + } + ,onMouseUp: function(window,x,y,button) { + if(this.window == null || this.window != window) { + return; + } + var type; + switch(button) { + case 1: + type = "middleMouseUp"; + break; + case 2: + type = "rightMouseUp"; + break; + default: + type = "mouseUp"; + } + this.__onMouse(type,Std["int"](x * window.get_scale()),Std["int"](y * window.get_scale()),button); + } + ,onMouseWheel: function(window,deltaX,deltaY) { + if(this.window == null || this.window != window) { + return; + } + this.__onMouseWheel(Std["int"](deltaX * window.get_scale()),Std["int"](deltaY * window.get_scale())); + } + ,onPreloadComplete: function() { + } + ,onPreloadProgress: function(loaded,total) { + } + ,onRenderContextLost: function(renderer) { + } + ,onRenderContextRestored: function(renderer,context) { + } + ,onTextEdit: function(window,text,start,length) { + } + ,onTextInput: function(window,text) { + if(this.window == null || this.window != window) { + return; + } + var stack = []; + if(this.__focus == null) { + this.__getInteractive(stack); + } else { + this.__focus.__getInteractive(stack); + } + var event = new openfl_events_TextEvent("textInput",true,false,text); + if(stack.length > 0) { + stack.reverse(); + this.__fireEvent(event,stack); + } else { + this.__broadcast(event,true); + } + } + ,onTouchMove: function(touch) { + this.__onTouch("touchMove",touch); + } + ,onTouchEnd: function(touch) { + this.__onTouch("touchEnd",touch); + } + ,onTouchStart: function(touch) { + this.__onTouch("touchBegin",touch); + } + ,onWindowActivate: function(window) { + if(this.window == null || this.window != window) { + return; + } + var event = new openfl_events_Event("activate"); + this.__broadcast(event,true); + } + ,onWindowClose: function(window) { + if(this.window == window) { + this.window = null; + } + } + ,onWindowCreate: function(window) { + if(this.window == null || this.window != window) { + return; + } + if(window.renderer != null) { + var _g = window.renderer.context; + switch(Type.enumIndex(_g)) { + case 0: + var gl = _g[2]; + this.__renderer = new openfl__$internal_renderer_opengl_GLRenderer(this.stageWidth,this.stageHeight,gl); + break; + case 1: + var context = _g[2]; + this.__renderer = new openfl__$internal_renderer_canvas_CanvasRenderer(this.stageWidth,this.stageHeight,context); + break; + case 2: + var element = _g[2]; + break; + case 4: + var cairo = _g[2]; + break; + case 5: + var ctx = _g[2]; + break; + default: + } + } + } + ,onWindowDeactivate: function(window) { + if(this.window == null || this.window != window) { + return; + } + var event = new openfl_events_Event("deactivate"); + this.__broadcast(event,true); + } + ,onWindowDropFile: function(window,file) { + } + ,onWindowEnter: function(window) { + } + ,onWindowFocusIn: function(window) { + if(this.window == null || this.window != window) { + return; + } + var event = new openfl_events_FocusEvent("focusIn",true,false,null,false,0); + this.__broadcast(event,true); + } + ,onWindowFocusOut: function(window) { + if(this.window == null || this.window != window) { + return; + } + var event = new openfl_events_FocusEvent("focusOut",true,false,null,false,0); + this.__broadcast(event,true); + } + ,onWindowFullscreen: function(window) { + if(this.window == null || this.window != window) { + return; + } + if(this.__displayState == 2) { + this.__displayState = 1; + } + } + ,onWindowLeave: function(window) { + if(this.window == null || this.window != window) { + return; + } + this.__dispatchEvent(new openfl_events_Event("mouseLeave")); + } + ,onWindowMinimize: function(window) { + } + ,onWindowMove: function(window,x,y) { + } + ,onWindowResize: function(window,width,height) { + if(this.window == null || this.window != window) { + return; + } + if(this.__displayState != 2 && !window.get_fullscreen()) { + this.__displayState = 2; + } + this.stageWidth = Std["int"](width * window.get_scale()); + this.stageHeight = Std["int"](height * window.get_scale()); + if(this.__renderer != null) { + this.__renderer.resize(this.stageWidth,this.stageHeight); + } + var event = new openfl_events_Event("resize"); + this.__broadcast(event,false); + } + ,onWindowRestore: function(window) { + } + ,render: function(renderer) { + if(renderer.window == null || renderer.window != this.window) { + return; + } + if(this.application != null && this.application.windows.length > 0) { + this.__setTransformDirty(); + this.__setRenderDirty(); + } + if(this.__rendering) { + return; + } + this.__rendering = true; + this.__broadcast(new openfl_events_Event("enterFrame"),true); + if(this.__invalidated) { + this.__invalidated = false; + this.__broadcast(new openfl_events_Event("render"),true); + } + this.__renderable = true; + this.__enterFrame(this.__deltaTime); + this.__deltaTime = 0; + this.__update(false,true); + if(this.__renderer != null) { + var _g = renderer.context; + if(Type.enumIndex(_g) == 4) { + var cairo = _g[2]; + (js_Boot.__cast(this.__renderer , openfl__$internal_renderer_cairo_CairoRenderer)).cairo = cairo; + this.__renderer.renderSession.cairo = cairo; + } + this.__renderer.render(this); + } + this.__rendering = false; + } + ,update: function(deltaTime) { + this.__deltaTime = deltaTime; + } + ,__drag: function(mouse) { + var parent = this.__dragObject.parent; + if(parent != null) { + mouse = parent.globalToLocal(mouse); + } + var x = mouse.x + this.__dragOffsetX; + var y = mouse.y + this.__dragOffsetY; + if(this.__dragBounds != null) { + if(x < this.__dragBounds.x) { + x = this.__dragBounds.x; + } else if(x > this.__dragBounds.get_right()) { + x = this.__dragBounds.get_right(); + } + if(y < this.__dragBounds.y) { + y = this.__dragBounds.y; + } else if(y > this.__dragBounds.get_bottom()) { + y = this.__dragBounds.get_bottom(); + } + } + this.__dragObject.set_x(x); + this.__dragObject.set_y(y); + } + ,__fireEvent: function(event,stack) { + var length = stack.length; + if(length == 0) { + event.eventPhase = 2; + event.target.__broadcast(event,false); + } else { + event.eventPhase = 1; + event.target = stack[stack.length - 1]; + var _g1 = 0; + var _g = length - 1; + while(_g1 < _g) { + var i = _g1++; + stack[i].__broadcast(event,false); + if(event.__isCanceled) { + return; + } + } + event.eventPhase = 2; + event.target.__broadcast(event,false); + if(event.__isCanceled) { + return; + } + if(event.bubbles) { + event.eventPhase = 3; + var i1 = length - 2; + while(i1 >= 0) { + stack[i1].__broadcast(event,false); + if(event.__isCanceled) { + return; + } + --i1; + } + } + } + } + ,__getInteractive: function(stack) { + if(stack != null) { + stack.push(this); + } + return true; + } + ,__onKey: function(type,keyCode,modifier) { + openfl_events_MouseEvent.__altKey = lime_ui__$KeyModifier_KeyModifier_$Impl_$.get_altKey(modifier); + openfl_events_MouseEvent.__commandKey = lime_ui__$KeyModifier_KeyModifier_$Impl_$.get_metaKey(modifier); + openfl_events_MouseEvent.__ctrlKey = lime_ui__$KeyModifier_KeyModifier_$Impl_$.get_ctrlKey(modifier); + openfl_events_MouseEvent.__shiftKey = lime_ui__$KeyModifier_KeyModifier_$Impl_$.get_shiftKey(modifier); + var stack = []; + if(this.__focus == null) { + this.__getInteractive(stack); + } else { + this.__focus.__getInteractive(stack); + } + if(stack.length > 0) { + var keyLocation = openfl_ui_Keyboard.__getKeyLocation(keyCode); + var keyCode1 = openfl_ui_Keyboard.__convertKeyCode(keyCode); + var charCode = openfl_ui_Keyboard.__getCharCode(keyCode1,lime_ui__$KeyModifier_KeyModifier_$Impl_$.get_shiftKey(modifier)); + var event = new openfl_events_KeyboardEvent(type,true,false,charCode,keyCode1,keyLocation,this.__macKeyboard ? lime_ui__$KeyModifier_KeyModifier_$Impl_$.get_ctrlKey(modifier) || lime_ui__$KeyModifier_KeyModifier_$Impl_$.get_metaKey(modifier) : lime_ui__$KeyModifier_KeyModifier_$Impl_$.get_ctrlKey(modifier),lime_ui__$KeyModifier_KeyModifier_$Impl_$.get_altKey(modifier),lime_ui__$KeyModifier_KeyModifier_$Impl_$.get_shiftKey(modifier),lime_ui__$KeyModifier_KeyModifier_$Impl_$.get_ctrlKey(modifier),lime_ui__$KeyModifier_KeyModifier_$Impl_$.get_metaKey(modifier)); + stack.reverse(); + this.__fireEvent(event,stack); + if(event.__isCanceled) { + if(type == "keyDown") { + this.window.onKeyDown.cancel(); + } else { + this.window.onKeyUp.cancel(); + } + } + } + } + ,__onMouse: function(type,x,y,button) { + if(button > 2) { + return; + } + this.__mouseX = x; + this.__mouseY = y; + var stack = []; + var target = null; + var targetPoint = new openfl_geom_Point(x,y); + if(this.__hitTest(x,y,true,stack,true,this)) { + target = stack[stack.length - 1]; + } else { + target = this; + stack = [this]; + } + if(target == null) { + target = this; + } + var clickType = null; + switch(type) { + case "middleMouseDown": + this.__mouseDownMiddle = target; + break; + case "middleMouseUp": + if(this.__mouseDownMiddle == target) { + clickType = "middleClick"; + } + this.__mouseDownMiddle = null; + break; + case "mouseDown": + if(target.get_tabEnabled()) { + this.set_focus(target); + } else { + this.set_focus(null); + } + this.__mouseDownLeft = target; + break; + case "mouseUp": + if(this.__mouseDownLeft == target) { + clickType = "click"; + } + this.__mouseDownLeft = null; + break; + case "rightMouseDown": + this.__mouseDownRight = target; + break; + case "rightMouseUp": + if(this.__mouseDownRight == target) { + clickType = "rightClick"; + } + this.__mouseDownRight = null; + break; + default: + } + this.__fireEvent(openfl_events_MouseEvent.__create(type,button,this.__mouseX,this.__mouseY,target == this ? targetPoint : target.globalToLocal(targetPoint),target),stack); + if(clickType != null) { + this.__fireEvent(openfl_events_MouseEvent.__create(clickType,button,this.__mouseX,this.__mouseY,target == this ? targetPoint : target.globalToLocal(targetPoint),target),stack); + if(type == "mouseUp" && (js_Boot.__cast(target , openfl_display_InteractiveObject)).doubleClickEnabled) { + var currentTime = openfl_Lib.getTimer(); + if(currentTime - this.__lastClickTime < 500) { + this.__fireEvent(openfl_events_MouseEvent.__create("doubleClick",button,this.__mouseX,this.__mouseY,target == this ? targetPoint : target.globalToLocal(targetPoint),target),stack); + this.__lastClickTime = 0; + } else { + this.__lastClickTime = currentTime; + } + } + } + var cursor = null; + var _g = 0; + while(_g < stack.length) { + var target1 = stack[_g]; + ++_g; + cursor = target1.__getCursor(); + if(cursor != null) { + lime_ui_Mouse.set_cursor(cursor); + break; + } + } + if(cursor == null) { + lime_ui_Mouse.set_cursor(lime_ui_MouseCursor.ARROW); + } + var event; + var localPoint; + var _g1 = 0; + var _g11 = this.__mouseOutStack; + while(_g1 < _g11.length) { + var target2 = _g11[_g1]; + ++_g1; + if(stack.indexOf(target2) == -1) { + HxOverrides.remove(this.__mouseOutStack,target2); + localPoint = target2.globalToLocal(targetPoint); + event = openfl_events_MouseEvent.__create("mouseOut",button,this.__mouseX,this.__mouseY,localPoint,target2); + event.bubbles = false; + target2.__dispatchEvent(event); + } + } + var _g2 = 0; + while(_g2 < stack.length) { + var target3 = stack[_g2]; + ++_g2; + if(this.__mouseOutStack.indexOf(target3) == -1) { + if(target3.hasEventListener("mouseOver")) { + localPoint = target3.globalToLocal(targetPoint); + event = openfl_events_MouseEvent.__create("mouseOver",button,this.__mouseX,this.__mouseY,localPoint,target3); + event.bubbles = false; + target3.__dispatchEvent(event); + } + if(target3.hasEventListener("mouseOut")) { + this.__mouseOutStack.push(target3); + } + } + } + if(this.__dragObject != null) { + this.__drag(targetPoint); + } + } + ,__onMouseWheel: function(deltaX,deltaY) { + var x = this.__mouseX; + var y = this.__mouseY; + var stack = []; + if(!this.__hitTest(x,y,false,stack,true,this)) { + stack = [this]; + } + var target = stack[stack.length - 1]; + var targetPoint = new openfl_geom_Point(x,y); + var delta = Std["int"](deltaY); + this.__fireEvent(openfl_events_MouseEvent.__create("mouseWheel",0,this.__mouseX,this.__mouseY,target == this ? targetPoint : target.globalToLocal(targetPoint),target,delta),stack); + } + ,__onTouch: function(type,touch) { + var point = new openfl_geom_Point(touch.x * this.stageWidth,touch.y * this.stageHeight); + this.__mouseX = point.x; + this.__mouseY = point.y; + var __stack = []; + if(this.__hitTest(this.__mouseX,this.__mouseY,false,__stack,true,this)) { + var target = __stack[__stack.length - 1]; + if(target == null) { + target = this; + } + var localPoint = target.globalToLocal(point); + var touchEvent = openfl_events_TouchEvent.__create(type,null,this.__mouseX,this.__mouseY,localPoint,target); + touchEvent.touchPointID = touch.id; + touchEvent.isPrimaryTouchPoint = true; + this.__fireEvent(touchEvent,__stack); + } else { + var touchEvent1 = openfl_events_TouchEvent.__create(type,null,this.__mouseX,this.__mouseY,point,this); + touchEvent1.touchPointID = touch.id; + touchEvent1.isPrimaryTouchPoint = true; + this.__fireEvent(touchEvent1,[this.stage]); + } + } + ,__update: function(transformOnly,updateChildren,maskGrahpics) { + if(transformOnly) { + if(openfl_display_DisplayObject.__worldTransformDirty > 0) { + openfl_display_DisplayObjectContainer.prototype.__update.call(this,true,updateChildren,maskGrahpics); + if(updateChildren) { + openfl_display_DisplayObject.__worldTransformDirty = 0; + this.__dirty = true; + } + } + } else if(openfl_display_DisplayObject.__worldTransformDirty > 0 || this.__dirty || openfl_display_DisplayObject.__worldRenderDirty > 0) { + openfl_display_DisplayObjectContainer.prototype.__update.call(this,false,updateChildren,maskGrahpics); + if(updateChildren) { + openfl_display_DisplayObject.__worldTransformDirty = 0; + openfl_display_DisplayObject.__worldRenderDirty = 0; + this.__dirty = false; + } + } + } + ,set_color: function(value) { + var r = (value & 16711680) >>> 16; + var g = (value & 65280) >>> 8; + var b = value & 255; + this.__colorSplit = [r / 255,g / 255,b / 255]; + this.__colorString = "#" + StringTools.hex(value,6); + return this.__color = value; + } + ,get_focus: function() { + return this.__focus; + } + ,set_focus: function(value) { + if(value != this.__focus) { + var oldFocus = this.__focus; + this.__focus = value; + if(oldFocus != null) { + var event = new openfl_events_FocusEvent("focusOut",true,false,this.__focus,false,0); + this.__stack = []; + oldFocus.__getInteractive(this.__stack); + this.__stack.reverse(); + this.__fireEvent(event,this.__stack); + } + if(this.__focus != null) { + var event1 = new openfl_events_FocusEvent("focusIn",true,false,oldFocus,false,0); + this.__stack = []; + value.__getInteractive(this.__stack); + this.__stack.reverse(); + this.__fireEvent(event1,this.__stack); + } + } + return this.__focus; + } + ,__class__: openfl_display_Stage + ,__properties__: $extend(openfl_display_DisplayObjectContainer.prototype.__properties__,{set_focus:"set_focus",get_focus:"get_focus",set_color:"set_color"}) +}); +var openfl_display_Stage3D = function() { + openfl_events_EventDispatcher.call(this); +}; +$hxClasses["openfl.display.Stage3D"] = openfl_display_Stage3D; +openfl_display_Stage3D.__name__ = ["openfl","display","Stage3D"]; +openfl_display_Stage3D.__super__ = openfl_events_EventDispatcher; +openfl_display_Stage3D.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + __class__: openfl_display_Stage3D +}); +var openfl_display_Tilesheet = function(image) { + this.__bitmap = image; + this.__centerPoints = []; + this.__tileRects = []; + this.__tileUVs = []; + this.__rectTile = new openfl_geom_Rectangle(); + this.__rectUV = new openfl_geom_Rectangle(); + this.__point = new openfl_geom_Point(); +}; +$hxClasses["openfl.display.Tilesheet"] = openfl_display_Tilesheet; +openfl_display_Tilesheet.__name__ = ["openfl","display","Tilesheet"]; +openfl_display_Tilesheet.prototype = { + __bitmap: null + ,__centerPoints: null + ,__tileRects: null + ,__tileUVs: null + ,__rectTile: null + ,__rectUV: null + ,__point: null + ,addTileRect: function(rectangle,centerPoint) { + this.__tileRects.push(rectangle); + if(centerPoint == null) { + centerPoint = openfl_display_Tilesheet.__defaultPoint; + } + this.__centerPoints.push(centerPoint); + this.__tileUVs.push(new openfl_geom_Rectangle(rectangle.get_left() / this.__bitmap.width,rectangle.get_top() / this.__bitmap.height,rectangle.get_right() / this.__bitmap.width,rectangle.get_bottom() / this.__bitmap.height)); + return this.__tileRects.length - 1; + } + ,drawTiles: function(graphics,tileData,smooth,flags,count) { + if(count == null) { + count = -1; + } + if(flags == null) { + flags = 0; + } + if(smooth == null) { + smooth = false; + } + graphics.drawTiles(this,tileData,smooth,flags,null,count); + } + ,getTileCenter: function(index) { + return this.__centerPoints[index]; + } + ,getTileRect: function(index) { + return this.__tileRects[index]; + } + ,getTileUVs: function(index) { + return this.__tileUVs[index]; + } + ,__class__: openfl_display_Tilesheet +}; +var openfl_display_Window = function(config) { + lime_ui_Window.call(this,config); +}; +$hxClasses["openfl.display.Window"] = openfl_display_Window; +openfl_display_Window.__name__ = ["openfl","display","Window"]; +openfl_display_Window.__super__ = lime_ui_Window; +openfl_display_Window.prototype = $extend(lime_ui_Window.prototype,{ + create: function(application) { + lime_ui_Window.prototype.create.call(this,application); + this.stage = new openfl_display_Stage(this,Reflect.hasField(this.config,"background") ? this.config.background : 16777215); + application.addModule(this.stage); + } + ,__class__: openfl_display_Window +}); +var openfl_errors_Error = function(message,id) { + if(id == null) { + id = 0; + } + if(message == null) { + message = ""; + } + this.message = message; + this.errorID = id; + this.name = "Error"; +}; +$hxClasses["openfl.errors.Error"] = openfl_errors_Error; +openfl_errors_Error.__name__ = ["openfl","errors","Error"]; +openfl_errors_Error.prototype = { + errorID: null + ,message: null + ,name: null + ,toString: function() { + if(this.message != null) { + return this.message; + } else { + return "Error"; + } + } + ,__class__: openfl_errors_Error +}; +var openfl_errors_IOError = function(message) { + if(message == null) { + message = ""; + } + openfl_errors_Error.call(this,message); + this.name = "IOError"; +}; +$hxClasses["openfl.errors.IOError"] = openfl_errors_IOError; +openfl_errors_IOError.__name__ = ["openfl","errors","IOError"]; +openfl_errors_IOError.__super__ = openfl_errors_Error; +openfl_errors_IOError.prototype = $extend(openfl_errors_Error.prototype,{ + __class__: openfl_errors_IOError +}); +var openfl_errors_EOFError = function() { + openfl_errors_IOError.call(this,"End of file was encountered"); + this.name = "EOFError"; + this.errorID = 2030; +}; +$hxClasses["openfl.errors.EOFError"] = openfl_errors_EOFError; +openfl_errors_EOFError.__name__ = ["openfl","errors","EOFError"]; +openfl_errors_EOFError.__super__ = openfl_errors_IOError; +openfl_errors_EOFError.prototype = $extend(openfl_errors_IOError.prototype,{ + __class__: openfl_errors_EOFError +}); +var openfl_events_ActivityEvent = function(type,bubbles,cancelable,activating) { + if(activating == null) { + activating = false; + } + if(cancelable == null) { + cancelable = false; + } + if(bubbles == null) { + bubbles = false; + } + openfl_events_Event.call(this,type,bubbles,cancelable); + this.activating = activating; +}; +$hxClasses["openfl.events.ActivityEvent"] = openfl_events_ActivityEvent; +openfl_events_ActivityEvent.__name__ = ["openfl","events","ActivityEvent"]; +openfl_events_ActivityEvent.__super__ = openfl_events_Event; +openfl_events_ActivityEvent.prototype = $extend(openfl_events_Event.prototype,{ + activating: null + ,__class__: openfl_events_ActivityEvent +}); +var openfl_events_TextEvent = function(type,bubbles,cancelable,text) { + if(text == null) { + text = ""; + } + if(cancelable == null) { + cancelable = false; + } + if(bubbles == null) { + bubbles = false; + } + openfl_events_Event.call(this,type,bubbles,cancelable); + this.text = text; +}; +$hxClasses["openfl.events.TextEvent"] = openfl_events_TextEvent; +openfl_events_TextEvent.__name__ = ["openfl","events","TextEvent"]; +openfl_events_TextEvent.__super__ = openfl_events_Event; +openfl_events_TextEvent.prototype = $extend(openfl_events_Event.prototype,{ + text: null + ,__class__: openfl_events_TextEvent +}); +var openfl_events_ErrorEvent = function(type,bubbles,cancelable,text,id) { + if(id == null) { + id = 0; + } + if(text == null) { + text = ""; + } + if(cancelable == null) { + cancelable = false; + } + if(bubbles == null) { + bubbles = false; + } + openfl_events_TextEvent.call(this,type,bubbles,cancelable,text); + this.errorID = id; +}; +$hxClasses["openfl.events.ErrorEvent"] = openfl_events_ErrorEvent; +openfl_events_ErrorEvent.__name__ = ["openfl","events","ErrorEvent"]; +openfl_events_ErrorEvent.__super__ = openfl_events_TextEvent; +openfl_events_ErrorEvent.prototype = $extend(openfl_events_TextEvent.prototype,{ + errorID: null + ,__class__: openfl_events_ErrorEvent +}); +var openfl_events__$EventDispatcher_Listener = function(callback,useCapture,priority) { + this.callback = callback; + this.useCapture = useCapture; + this.priority = priority; +}; +$hxClasses["openfl.events._EventDispatcher.Listener"] = openfl_events__$EventDispatcher_Listener; +openfl_events__$EventDispatcher_Listener.__name__ = ["openfl","events","_EventDispatcher","Listener"]; +openfl_events__$EventDispatcher_Listener.prototype = { + callback: null + ,priority: null + ,useCapture: null + ,match: function(callback,useCapture) { + if(Reflect.compareMethods(this.callback,callback)) { + return this.useCapture == useCapture; + } else { + return false; + } + } + ,__class__: openfl_events__$EventDispatcher_Listener +}; +var openfl_events_FocusEvent = function(type,bubbles,cancelable,relatedObject,shiftKey,keyCode) { + if(keyCode == null) { + keyCode = 0; + } + if(shiftKey == null) { + shiftKey = false; + } + if(cancelable == null) { + cancelable = false; + } + if(bubbles == null) { + bubbles = false; + } + openfl_events_Event.call(this,type,bubbles,cancelable); + this.keyCode = keyCode; + this.shiftKey = shiftKey; + this.relatedObject = relatedObject; +}; +$hxClasses["openfl.events.FocusEvent"] = openfl_events_FocusEvent; +openfl_events_FocusEvent.__name__ = ["openfl","events","FocusEvent"]; +openfl_events_FocusEvent.__super__ = openfl_events_Event; +openfl_events_FocusEvent.prototype = $extend(openfl_events_Event.prototype,{ + keyCode: null + ,relatedObject: null + ,shiftKey: null + ,__class__: openfl_events_FocusEvent +}); +var openfl_events_FullScreenEvent = function(type,bubbles,cancelable,fullScreen,interactive) { + if(interactive == null) { + interactive = false; + } + if(fullScreen == null) { + fullScreen = false; + } + if(cancelable == null) { + cancelable = false; + } + if(bubbles == null) { + bubbles = false; + } + openfl_events_ActivityEvent.call(this,type,bubbles,cancelable); + this.fullScreen = fullScreen; + this.interactive = interactive; +}; +$hxClasses["openfl.events.FullScreenEvent"] = openfl_events_FullScreenEvent; +openfl_events_FullScreenEvent.__name__ = ["openfl","events","FullScreenEvent"]; +openfl_events_FullScreenEvent.__super__ = openfl_events_ActivityEvent; +openfl_events_FullScreenEvent.prototype = $extend(openfl_events_ActivityEvent.prototype,{ + fullScreen: null + ,interactive: null + ,__class__: openfl_events_FullScreenEvent +}); +var openfl_events_GameInputEvent = function(type,bubbles,cancelable,device) { + if(cancelable == null) { + cancelable = false; + } + if(bubbles == null) { + bubbles = true; + } + openfl_events_Event.call(this,type,bubbles,cancelable); + this.device = device; +}; +$hxClasses["openfl.events.GameInputEvent"] = openfl_events_GameInputEvent; +openfl_events_GameInputEvent.__name__ = ["openfl","events","GameInputEvent"]; +openfl_events_GameInputEvent.__super__ = openfl_events_Event; +openfl_events_GameInputEvent.prototype = $extend(openfl_events_Event.prototype,{ + device: null + ,__class__: openfl_events_GameInputEvent +}); +var openfl_events_IOErrorEvent = function(type,bubbles,cancelable,text,id) { + if(id == null) { + id = 0; + } + if(text == null) { + text = ""; + } + if(cancelable == null) { + cancelable = false; + } + if(bubbles == null) { + bubbles = true; + } + openfl_events_ErrorEvent.call(this,type,bubbles,cancelable,text,id); +}; +$hxClasses["openfl.events.IOErrorEvent"] = openfl_events_IOErrorEvent; +openfl_events_IOErrorEvent.__name__ = ["openfl","events","IOErrorEvent"]; +openfl_events_IOErrorEvent.__super__ = openfl_events_ErrorEvent; +openfl_events_IOErrorEvent.prototype = $extend(openfl_events_ErrorEvent.prototype,{ + __class__: openfl_events_IOErrorEvent +}); +var openfl_events_KeyboardEvent = function(type,bubbles,cancelable,charCodeValue,keyCodeValue,keyLocationValue,ctrlKeyValue,altKeyValue,shiftKeyValue,controlKeyValue,commandKeyValue) { + if(commandKeyValue == null) { + commandKeyValue = false; + } + if(controlKeyValue == null) { + controlKeyValue = false; + } + if(shiftKeyValue == null) { + shiftKeyValue = false; + } + if(altKeyValue == null) { + altKeyValue = false; + } + if(ctrlKeyValue == null) { + ctrlKeyValue = false; + } + if(keyCodeValue == null) { + keyCodeValue = 0; + } + if(charCodeValue == null) { + charCodeValue = 0; + } + if(cancelable == null) { + cancelable = false; + } + if(bubbles == null) { + bubbles = false; + } + openfl_events_Event.call(this,type,bubbles,cancelable); + this.charCode = charCodeValue; + this.keyCode = keyCodeValue; + this.keyLocation = keyLocationValue != null ? keyLocationValue : 0; + this.ctrlKey = ctrlKeyValue; + this.altKey = altKeyValue; + this.shiftKey = shiftKeyValue; + this.controlKey = controlKeyValue; + this.commandKey = commandKeyValue; +}; +$hxClasses["openfl.events.KeyboardEvent"] = openfl_events_KeyboardEvent; +openfl_events_KeyboardEvent.__name__ = ["openfl","events","KeyboardEvent"]; +openfl_events_KeyboardEvent.__super__ = openfl_events_Event; +openfl_events_KeyboardEvent.prototype = $extend(openfl_events_Event.prototype,{ + altKey: null + ,charCode: null + ,ctrlKey: null + ,commandKey: null + ,controlKey: null + ,keyCode: null + ,keyLocation: null + ,shiftKey: null + ,__class__: openfl_events_KeyboardEvent +}); +var openfl_events_MouseEvent = function(type,bubbles,cancelable,localX,localY,relatedObject,ctrlKey,altKey,shiftKey,buttonDown,delta,commandKey,clickCount) { + if(clickCount == null) { + clickCount = 0; + } + if(commandKey == null) { + commandKey = false; + } + if(delta == null) { + delta = 0; + } + if(buttonDown == null) { + buttonDown = false; + } + if(shiftKey == null) { + shiftKey = false; + } + if(altKey == null) { + altKey = false; + } + if(ctrlKey == null) { + ctrlKey = false; + } + if(localY == null) { + localY = 0; + } + if(localX == null) { + localX = 0; + } + if(cancelable == null) { + cancelable = false; + } + if(bubbles == null) { + bubbles = true; + } + openfl_events_Event.call(this,type,bubbles,cancelable); + this.shiftKey = shiftKey; + this.altKey = altKey; + this.ctrlKey = ctrlKey; + this.bubbles = bubbles; + this.relatedObject = relatedObject; + this.delta = delta; + this.localX = localX; + this.localY = localY; + this.buttonDown = buttonDown; + this.commandKey = commandKey; + this.clickCount = clickCount; +}; +$hxClasses["openfl.events.MouseEvent"] = openfl_events_MouseEvent; +openfl_events_MouseEvent.__name__ = ["openfl","events","MouseEvent"]; +openfl_events_MouseEvent.__altKey = null; +openfl_events_MouseEvent.__buttonDown = null; +openfl_events_MouseEvent.__commandKey = null; +openfl_events_MouseEvent.__ctrlKey = null; +openfl_events_MouseEvent.__shiftKey = null; +openfl_events_MouseEvent.__create = function(type,button,stageX,stageY,local,target,delta) { + if(delta == null) { + delta = 0; + } + switch(type) { + case "mouseDown": + openfl_events_MouseEvent.__buttonDown = true; + break; + case "mouseUp": + openfl_events_MouseEvent.__buttonDown = false; + break; + default: + } + var event = new openfl_events_MouseEvent(type,true,false,local.x,local.y,null,openfl_events_MouseEvent.__ctrlKey,openfl_events_MouseEvent.__altKey,openfl_events_MouseEvent.__shiftKey,openfl_events_MouseEvent.__buttonDown,delta,openfl_events_MouseEvent.__commandKey); + event.stageX = stageX; + event.stageY = stageY; + event.target = target; + return event; +}; +openfl_events_MouseEvent.__super__ = openfl_events_Event; +openfl_events_MouseEvent.prototype = $extend(openfl_events_Event.prototype,{ + altKey: null + ,buttonDown: null + ,commandKey: null + ,clickCount: null + ,ctrlKey: null + ,delta: null + ,localX: null + ,localY: null + ,relatedObject: null + ,shiftKey: null + ,stageX: null + ,stageY: null + ,__class__: openfl_events_MouseEvent +}); +var openfl_events_TouchEvent = function(type,bubbles,cancelable,touchPointID,isPrimaryTouchPoint,localX,localY,sizeX,sizeY,pressure,relatedObject,ctrlKey,altKey,shiftKey,commandKey,controlKey,timestamp,touchIntent,samples,isTouchPointCanceled) { + if(isTouchPointCanceled == null) { + isTouchPointCanceled = false; + } + if(timestamp == null) { + timestamp = 0; + } + if(controlKey == null) { + controlKey = false; + } + if(commandKey == null) { + commandKey = false; + } + if(shiftKey == null) { + shiftKey = false; + } + if(altKey == null) { + altKey = false; + } + if(ctrlKey == null) { + ctrlKey = false; + } + if(pressure == null) { + pressure = 0; + } + if(sizeY == null) { + sizeY = 0; + } + if(sizeX == null) { + sizeX = 0; + } + if(localY == null) { + localY = 0; + } + if(localX == null) { + localX = 0; + } + if(isPrimaryTouchPoint == null) { + isPrimaryTouchPoint = false; + } + if(touchPointID == null) { + touchPointID = 0; + } + if(cancelable == null) { + cancelable = false; + } + if(bubbles == null) { + bubbles = true; + } + openfl_events_Event.call(this,type,bubbles,cancelable); + this.touchPointID = touchPointID; + this.isPrimaryTouchPoint = isPrimaryTouchPoint; + this.localX = localX; + this.localY = localY; + this.sizeX = sizeX; + this.sizeY = sizeY; + this.pressure = pressure; + this.relatedObject = relatedObject; + this.ctrlKey = ctrlKey; + this.altKey = altKey; + this.shiftKey = shiftKey; + this.commandKey = commandKey; + this.controlKey = controlKey; +}; +$hxClasses["openfl.events.TouchEvent"] = openfl_events_TouchEvent; +openfl_events_TouchEvent.__name__ = ["openfl","events","TouchEvent"]; +openfl_events_TouchEvent.__create = function(type,touch,stageX,stageY,local,target) { + var evt = new openfl_events_TouchEvent(type,true,false,0,true,local.x,local.y,1,1,1); + evt.stageX = stageX; + evt.stageY = stageY; + evt.target = target; + return evt; +}; +openfl_events_TouchEvent.__super__ = openfl_events_Event; +openfl_events_TouchEvent.prototype = $extend(openfl_events_Event.prototype,{ + altKey: null + ,commandKey: null + ,controlKey: null + ,ctrlKey: null + ,isPrimaryTouchPoint: null + ,localX: null + ,localY: null + ,pressure: null + ,relatedObject: null + ,shiftKey: null + ,sizeX: null + ,sizeY: null + ,stageX: null + ,stageY: null + ,touchPointID: null + ,__class__: openfl_events_TouchEvent +}); +var openfl_filters_BitmapFilter = function() { + this.__saveLastFilter = false; + this.__passes = 0; +}; +$hxClasses["openfl.filters.BitmapFilter"] = openfl_filters_BitmapFilter; +openfl_filters_BitmapFilter.__name__ = ["openfl","filters","BitmapFilter"]; +openfl_filters_BitmapFilter.__tmpRenderTexture = null; +openfl_filters_BitmapFilter.__applyFilters = function(filters,renderSession,source,target,sourceRect,destPoint) { + var same = target == source && target.__usingPingPongTexture; + if(same) { + target.__pingPongTexture.useOldTexture = true; + } + if(sourceRect == null) { + sourceRect = source.rect; + } + var lastFilterOutput = null; + var useLastFilter = false; + var srcShader = source.__shader; + var _g = 0; + while(_g < filters.length) { + var filter = filters[_g]; + ++_g; + useLastFilter = false; + if(filter.__saveLastFilter) { + target.__pingPongTexture.swap(); + target.__drawGL(renderSession,source,null,null,null,sourceRect,true,!target.__usingPingPongTexture,true); + lastFilterOutput = target.__pingPongTexture.get_oldRenderTexture(); + target.__pingPongTexture.set_oldRenderTexture(openfl_filters_BitmapFilter.__tmpRenderTexture); + } + var _g2 = 0; + var _g1 = filter.__passes; + while(_g2 < _g1) { + var pass = _g2++; + if(filter.__saveLastFilter) { + useLastFilter = filter.__useLastFilter(pass); + } else { + useLastFilter = false; + } + if(same && !useLastFilter) { + target.__pingPongTexture.swap(); + } + if(useLastFilter) { + openfl_filters_BitmapFilter.__tmpRenderTexture = target.__pingPongTexture.get_oldRenderTexture(); + target.__pingPongTexture.set_oldRenderTexture(lastFilterOutput); + } + source.__shader = filter.__preparePass(pass); + target.__drawGL(renderSession,source,null,null,null,sourceRect,true,!target.__usingPingPongTexture,!useLastFilter); + } + } + source.__shader = srcShader; + if(same) { + target.__pingPongTexture.useOldTexture = false; + } +}; +openfl_filters_BitmapFilter.__expandBounds = function(filters,rect,matrix) { + var r = openfl_geom_Rectangle.__temp; + r.setEmpty(); + var _g = 0; + while(_g < filters.length) { + var filter = filters[_g]; + ++_g; + filter.__growBounds(r); + } + r.__transform(r,matrix); + rect.__expand(r.x,r.y,r.width,r.height); +}; +openfl_filters_BitmapFilter.prototype = { + __passes: null + ,__saveLastFilter: null + ,__growBounds: function(rect) { + } + ,__preparePass: function(pass) { + return null; + } + ,__useLastFilter: function(pass) { + return false; + } + ,__class__: openfl_filters_BitmapFilter +}; +var openfl_geom_Matrix3D = function() { }; +$hxClasses["openfl.geom.Matrix3D"] = openfl_geom_Matrix3D; +openfl_geom_Matrix3D.__name__ = ["openfl","geom","Matrix3D"]; +openfl_geom_Matrix3D.prototype = { + __class__: openfl_geom_Matrix3D +}; +var openfl_geom_Transform = function(displayObject) { + this.__colorTransform = new openfl_geom_ColorTransform(); + this.concatenatedColorTransform = new openfl_geom_ColorTransform(); + this.pixelBounds = new openfl_geom_Rectangle(); + this.__displayObject = displayObject; + this.__hasMatrix = true; +}; +$hxClasses["openfl.geom.Transform"] = openfl_geom_Transform; +openfl_geom_Transform.__name__ = ["openfl","geom","Transform"]; +openfl_geom_Transform.prototype = { + concatenatedColorTransform: null + ,pixelBounds: null + ,__colorTransform: null + ,__displayObject: null + ,__hasMatrix: null + ,get_colorTransform: function() { + return this.__colorTransform; + } + ,set_colorTransform: function(value) { + if(!this.__colorTransform.__equals(value)) { + this.__colorTransform = value; + if(value != null) { + this.__displayObject.set_alpha(value.alphaMultiplier); + } + this.__displayObject.__setRenderDirty(); + } + return this.__colorTransform; + } + ,__class__: openfl_geom_Transform + ,__properties__: {set_colorTransform:"set_colorTransform",get_colorTransform:"get_colorTransform"} +}; +var openfl_geom_Vector3D = function() { }; +$hxClasses["openfl.geom.Vector3D"] = openfl_geom_Vector3D; +openfl_geom_Vector3D.__name__ = ["openfl","geom","Vector3D"]; +var openfl_media_ID3Info = function() { }; +$hxClasses["openfl.media.ID3Info"] = openfl_media_ID3Info; +openfl_media_ID3Info.__name__ = ["openfl","media","ID3Info"]; +var openfl_media_Sound = function(stream,context) { + openfl_events_EventDispatcher.call(this,this); + this.bytesLoaded = 0; + this.bytesTotal = 0; + this.id3 = null; + this.isBuffering = false; + this.url = null; + if(stream != null) { + this.load(stream,context); + } +}; +$hxClasses["openfl.media.Sound"] = openfl_media_Sound; +openfl_media_Sound.__name__ = ["openfl","media","Sound"]; +openfl_media_Sound.__super__ = openfl_events_EventDispatcher; +openfl_media_Sound.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + bytesLoaded: null + ,bytesTotal: null + ,id3: null + ,isBuffering: null + ,url: null + ,__soundID: null + ,load: function(stream,context) { + this.url = stream.url; + this.__soundID = haxe_io_Path.withoutExtension(stream.url); + if(!openfl_media_Sound.__registeredSounds.exists(this.__soundID)) { + openfl_media_Sound.__registeredSounds.set(this.__soundID,true); + createjs.Sound.addEventListener("fileload",$bind(this,this.SoundJS_onFileLoad)); + createjs.Sound.addEventListener("fileerror",$bind(this,this.SoundJS_onFileError)); + createjs.Sound.registerSound(this.url,this.__soundID); + } else { + this.dispatchEvent(new openfl_events_Event("complete")); + } + } + ,play: function(startTime,loops,sndTransform) { + if(loops == null) { + loops = 0; + } + if(startTime == null) { + startTime = 0.0; + } + if(sndTransform == null) { + sndTransform = new openfl_media_SoundTransform(1,0); + } + var pan = sndTransform.pan; + if(pan == 0) { + pan = -0.0000001; + } + var instance = loops > 1 ? createjs.Sound.play(this.__soundID,"any",0,Std["int"](startTime),loops - 1,sndTransform.volume,pan) : createjs.Sound.play(this.__soundID,"any",0,Std["int"](startTime),0,sndTransform.volume,pan); + return new openfl_media_SoundChannel(instance); + } + ,SoundJS_onFileLoad: function(event) { + if(event.id == this.__soundID) { + createjs.Sound.removeEventListener("fileload",$bind(this,this.SoundJS_onFileLoad)); + createjs.Sound.removeEventListener("fileerror",$bind(this,this.SoundJS_onFileError)); + this.dispatchEvent(new openfl_events_Event("complete")); + } + } + ,SoundJS_onFileError: function(event) { + if(event.id == this.__soundID) { + createjs.Sound.removeEventListener("fileload",$bind(this,this.SoundJS_onFileLoad)); + createjs.Sound.removeEventListener("fileerror",$bind(this,this.SoundJS_onFileError)); + this.dispatchEvent(new openfl_events_IOErrorEvent("ioError")); + } + } + ,__class__: openfl_media_Sound +}); +var openfl_media_SoundChannel = function(soundInstance) { + openfl_events_EventDispatcher.call(this,this); + this.leftPeak = 1; + this.rightPeak = 1; + if(soundInstance != null) { + this.__soundInstance = soundInstance; + this.__soundInstance.addEventListener("complete",$bind(this,this.source_onComplete)); + this.__isValid = true; + } +}; +$hxClasses["openfl.media.SoundChannel"] = openfl_media_SoundChannel; +openfl_media_SoundChannel.__name__ = ["openfl","media","SoundChannel"]; +openfl_media_SoundChannel.__super__ = openfl_events_EventDispatcher; +openfl_media_SoundChannel.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + leftPeak: null + ,rightPeak: null + ,__isValid: null + ,__source: null + ,__soundInstance: null + ,stop: function() { + if(!this.__isValid) { + return; + } + this.__soundInstance.stop(); + } + ,__dispose: function() { + if(!this.__isValid) { + return; + } + this.__soundInstance.stop(); + this.__soundInstance = null; + this.__isValid = false; + } + ,get_position: function() { + if(!this.__isValid) { + return 0; + } + return this.__soundInstance.getPosition(); + } + ,set_position: function(value) { + if(!this.__isValid) { + return 0; + } + this.__soundInstance.setPosition(Std["int"](value)); + return this.__soundInstance.getPosition(); + } + ,get_soundTransform: function() { + if(!this.__isValid) { + return new openfl_media_SoundTransform(); + } + return new openfl_media_SoundTransform(this.__soundInstance.getVolume(),this.__soundInstance.getPan()); + } + ,set_soundTransform: function(value) { + if(!this.__isValid) { + return value; + } + this.__soundInstance.setVolume(value.volume); + this.__soundInstance.setPan(value.pan); + return value; + } + ,soundInstance_onComplete: function(_) { + this.dispatchEvent(new openfl_events_Event("soundComplete")); + } + ,source_onComplete: function() { + this.__dispose(); + this.dispatchEvent(new openfl_events_Event("soundComplete")); + } + ,__class__: openfl_media_SoundChannel + ,__properties__: {set_soundTransform:"set_soundTransform",get_soundTransform:"get_soundTransform",set_position:"set_position",get_position:"get_position"} +}); +var openfl_media_SoundLoaderContext = function() { }; +$hxClasses["openfl.media.SoundLoaderContext"] = openfl_media_SoundLoaderContext; +openfl_media_SoundLoaderContext.__name__ = ["openfl","media","SoundLoaderContext"]; +var openfl_media_SoundTransform = function(vol,panning) { + if(panning == null) { + panning = 0; + } + if(vol == null) { + vol = 1; + } + this.volume = vol; + this.pan = panning; + this.leftToLeft = 0; + this.leftToRight = 0; + this.rightToLeft = 0; + this.rightToRight = 0; +}; +$hxClasses["openfl.media.SoundTransform"] = openfl_media_SoundTransform; +openfl_media_SoundTransform.__name__ = ["openfl","media","SoundTransform"]; +openfl_media_SoundTransform.prototype = { + leftToLeft: null + ,leftToRight: null + ,pan: null + ,rightToLeft: null + ,rightToRight: null + ,volume: null + ,__class__: openfl_media_SoundTransform +}; +var openfl_net_SharedObject = function() { + openfl_events_EventDispatcher.call(this); + this.client = this; + this.objectEncoding = 3; +}; +$hxClasses["openfl.net.SharedObject"] = openfl_net_SharedObject; +openfl_net_SharedObject.__name__ = ["openfl","net","SharedObject"]; +openfl_net_SharedObject.__sharedObjects = null; +openfl_net_SharedObject.getLocal = function(name,localPath,secure) { + if(secure == null) { + secure = false; + } + if(localPath == null) { + localPath = js_Browser.get_window().location.href; + } + if(openfl_net_SharedObject.__sharedObjects == null) { + openfl_net_SharedObject.__sharedObjects = new haxe_ds_StringMap(); + openfl_Lib.application.onExit.add(openfl_net_SharedObject.application_onExit); + } + var id = localPath + "/" + name; + if(!openfl_net_SharedObject.__sharedObjects.exists(id)) { + var sharedObject = new openfl_net_SharedObject(); + sharedObject.data = { }; + sharedObject.__localPath = localPath; + sharedObject.__name = name; + var encodedData = null; + try { + var storage = js_Browser.getLocalStorage(); + if(storage != null) { + encodedData = storage.getItem(localPath + ":" + name); + } + } catch( e ) { + haxe_CallStack.lastException = e; + } + if(encodedData != null && encodedData != "") { + try { + var unserializer = new haxe_Unserializer(encodedData); + unserializer.setResolver({ resolveEnum : Type.resolveEnum, resolveClass : openfl_net_SharedObject.__resolveClass}); + sharedObject.data = unserializer.unserialize(); + } catch( e1 ) { + haxe_CallStack.lastException = e1; + } + } + openfl_net_SharedObject.__sharedObjects.set(id,sharedObject); + } + return openfl_net_SharedObject.__sharedObjects.get(id); +}; +openfl_net_SharedObject.__resolveClass = function(name) { + if(name != null) { + if(StringTools.startsWith(name,"neash.")) { + name = StringTools.replace(name,"neash.","openfl."); + } + if(StringTools.startsWith(name,"native.")) { + name = StringTools.replace(name,"native.","openfl."); + } + if(StringTools.startsWith(name,"flash.")) { + name = StringTools.replace(name,"flash.","openfl."); + } + if(StringTools.startsWith(name,"openfl._v2.")) { + name = StringTools.replace(name,"openfl._v2.","openfl."); + } + if(StringTools.startsWith(name,"openfl._legacy.")) { + name = StringTools.replace(name,"openfl._legacy.","openfl."); + } + return Type.resolveClass(name); + } + return null; +}; +openfl_net_SharedObject.application_onExit = function(_) { + var sharedObject = openfl_net_SharedObject.__sharedObjects.iterator(); + while(sharedObject.hasNext()) { + var sharedObject1 = sharedObject.next(); + sharedObject1.flush(); + } +}; +openfl_net_SharedObject.__super__ = openfl_events_EventDispatcher; +openfl_net_SharedObject.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + client: null + ,data: null + ,objectEncoding: null + ,__localPath: null + ,__name: null + ,clear: function() { + this.data = { }; + try { + var storage = js_Browser.getLocalStorage(); + if(storage != null) { + storage.removeItem(this.__localPath + ":" + this.__name); + } + } catch( e ) { + haxe_CallStack.lastException = e; + } + } + ,flush: function(minDiskSpace) { + if(minDiskSpace == null) { + minDiskSpace = 0; + } + if(Reflect.fields(this.data).length == 0) { + return 0; + } + var encodedData = haxe_Serializer.run(this.data); + try { + var storage = js_Browser.getLocalStorage(); + if(storage != null) { + storage.removeItem(this.__localPath + ":" + this.__name); + storage.setItem(this.__localPath + ":" + this.__name,encodedData); + } + } catch( e ) { + haxe_CallStack.lastException = e; + return 1; + } + return 0; + } + ,__class__: openfl_net_SharedObject +}); +var openfl_net_URLRequest = function(inURL) { + if(inURL != null) { + this.url = inURL; + } + this.requestHeaders = []; + this.method = openfl_net__$URLRequestMethod_URLRequestMethod_$Impl_$.toString(1); + this.contentType = null; +}; +$hxClasses["openfl.net.URLRequest"] = openfl_net_URLRequest; +openfl_net_URLRequest.__name__ = ["openfl","net","URLRequest"]; +openfl_net_URLRequest.prototype = { + contentType: null + ,method: null + ,requestHeaders: null + ,url: null + ,__class__: openfl_net_URLRequest +}; +var openfl_net_URLRequestHeader = function() { }; +$hxClasses["openfl.net.URLRequestHeader"] = openfl_net_URLRequestHeader; +openfl_net_URLRequestHeader.__name__ = ["openfl","net","URLRequestHeader"]; +var openfl_net__$URLRequestMethod_URLRequestMethod_$Impl_$ = {}; +$hxClasses["openfl.net._URLRequestMethod.URLRequestMethod_Impl_"] = openfl_net__$URLRequestMethod_URLRequestMethod_$Impl_$; +openfl_net__$URLRequestMethod_URLRequestMethod_$Impl_$.__name__ = ["openfl","net","_URLRequestMethod","URLRequestMethod_Impl_"]; +openfl_net__$URLRequestMethod_URLRequestMethod_$Impl_$.toString = function(value) { + switch(value) { + case 0: + return "DELETE"; + case 1: + return "GET"; + case 2: + return "HEAD"; + case 3: + return "OPTIONS"; + case 4: + return "POST"; + case 5: + return "PUT"; + default: + return null; + } +}; +var openfl_system_System = function() { }; +$hxClasses["openfl.system.System"] = openfl_system_System; +openfl_system_System.__name__ = ["openfl","system","System"]; +openfl_system_System.__properties__ = {get_totalMemory:"get_totalMemory"}; +openfl_system_System.get_totalMemory = function() { + return (window.performance && window.performance.memory) ? window.performance.memory.usedJSHeapSize : 0; +}; +var openfl_text_Font = function() { }; +$hxClasses["openfl.text.Font"] = openfl_text_Font; +openfl_text_Font.__name__ = ["openfl","text","Font"]; +openfl_text_Font.__super__ = lime_text_Font; +openfl_text_Font.prototype = $extend(lime_text_Font.prototype,{ + __class__: openfl_text_Font +}); +var openfl_text_TextFormat = function() { }; +$hxClasses["openfl.text.TextFormat"] = openfl_text_TextFormat; +openfl_text_TextFormat.__name__ = ["openfl","text","TextFormat"]; +var openfl_ui_GameInput = function() { }; +$hxClasses["openfl.ui.GameInput"] = openfl_ui_GameInput; +openfl_ui_GameInput.__name__ = ["openfl","ui","GameInput"]; +openfl_ui_GameInput.__getDevice = function(gamepad) { + if(gamepad == null) { + return null; + } + if(!openfl_ui_GameInput.__devices.exists(gamepad)) { + var device = new openfl_ui_GameInputDevice(gamepad.get_guid(),gamepad.get_name()); + openfl_ui_GameInput.__deviceList.push(device); + openfl_ui_GameInput.__devices.set(gamepad,device); + openfl_ui_GameInput.numDevices = openfl_ui_GameInput.__deviceList.length; + } + return openfl_ui_GameInput.__devices.get(gamepad); +}; +openfl_ui_GameInput.__onGamepadAxisMove = function(gamepad,axis,value) { + var device = openfl_ui_GameInput.__getDevice(gamepad); + if(device == null) { + return; + } + if(device.enabled) { + if(!device.__axis.exists(axis)) { + var control; + switch(axis) { + case 0: + control = "LEFT_X"; + break; + case 1: + control = "LEFT_Y"; + break; + case 2: + control = "RIGHT_X"; + break; + case 3: + control = "RIGHT_Y"; + break; + case 4: + control = "TRIGGER_LEFT"; + break; + case 5: + control = "TRIGGER_RIGHT"; + break; + default: + control = "UNKNOWN (" + axis + ")"; + } + var control1 = new openfl_ui_GameInputControl(device,"AXIS_" + control,-1,1); + device.__axis.set(axis,control1); + device.__controls.push(control1); + } + var control2 = device.__axis.get(axis); + control2.value = value; + control2.dispatchEvent(new openfl_events_Event("change")); + } +}; +openfl_ui_GameInput.__onGamepadButtonDown = function(gamepad,button) { + var device = openfl_ui_GameInput.__getDevice(gamepad); + if(device == null) { + return; + } + if(device.enabled) { + if(!device.__button.exists(button)) { + var control; + switch(button) { + case 0: + control = "A"; + break; + case 1: + control = "B"; + break; + case 2: + control = "X"; + break; + case 3: + control = "Y"; + break; + case 4: + control = "BACK"; + break; + case 5: + control = "GUIDE"; + break; + case 6: + control = "START"; + break; + case 7: + control = "LEFT_STICK"; + break; + case 8: + control = "RIGHT_STICK"; + break; + case 9: + control = "LEFT_SHOULDER"; + break; + case 10: + control = "RIGHT_SHOULDER"; + break; + case 11: + control = "DPAD_UP"; + break; + case 12: + control = "DPAD_DOWN"; + break; + case 13: + control = "DPAD_LEFT"; + break; + case 14: + control = "DPAD_RIGHT"; + break; + default: + control = "UNKNOWN (" + button + ")"; + } + var control1 = new openfl_ui_GameInputControl(device,"BUTTON_" + control,0,1); + device.__button.set(button,control1); + device.__controls.push(control1); + } + var control2 = device.__button.get(button); + control2.value = 1; + control2.dispatchEvent(new openfl_events_Event("change")); + } +}; +openfl_ui_GameInput.__onGamepadButtonUp = function(gamepad,button) { + var device = openfl_ui_GameInput.__getDevice(gamepad); + if(device == null) { + return; + } + if(device.enabled) { + if(!device.__button.exists(button)) { + var control; + switch(button) { + case 0: + control = "A"; + break; + case 1: + control = "B"; + break; + case 2: + control = "X"; + break; + case 3: + control = "Y"; + break; + case 4: + control = "BACK"; + break; + case 5: + control = "GUIDE"; + break; + case 6: + control = "START"; + break; + case 7: + control = "LEFT_STICK"; + break; + case 8: + control = "RIGHT_STICK"; + break; + case 9: + control = "LEFT_SHOULDER"; + break; + case 10: + control = "RIGHT_SHOULDER"; + break; + case 11: + control = "DPAD_UP"; + break; + case 12: + control = "DPAD_DOWN"; + break; + case 13: + control = "DPAD_LEFT"; + break; + case 14: + control = "DPAD_RIGHT"; + break; + default: + control = "UNKNOWN (" + button + ")"; + } + var control1 = new openfl_ui_GameInputControl(device,"BUTTON_" + control,0,1); + device.__button.set(button,control1); + device.__controls.push(control1); + } + var control2 = device.__button.get(button); + control2.value = 0; + control2.dispatchEvent(new openfl_events_Event("change")); + } +}; +openfl_ui_GameInput.__onGamepadConnect = function(gamepad) { + var device = openfl_ui_GameInput.__getDevice(gamepad); + if(device == null) { + return; + } + var _g = 0; + var _g1 = openfl_ui_GameInput.__instances; + while(_g < _g1.length) { + var instance = _g1[_g]; + ++_g; + instance.dispatchEvent(new openfl_events_GameInputEvent("deviceAdded",null,null,device)); + } +}; +openfl_ui_GameInput.__onGamepadDisconnect = function(gamepad) { + var device = openfl_ui_GameInput.__devices.get(gamepad); + if(device != null) { + if(openfl_ui_GameInput.__devices.exists(gamepad)) { + HxOverrides.remove(openfl_ui_GameInput.__deviceList,openfl_ui_GameInput.__devices.get(gamepad)); + openfl_ui_GameInput.__devices.remove(gamepad); + } + openfl_ui_GameInput.numDevices = openfl_ui_GameInput.__deviceList.length; + var _g = 0; + var _g1 = openfl_ui_GameInput.__instances; + while(_g < _g1.length) { + var instance = _g1[_g]; + ++_g; + instance.dispatchEvent(new openfl_events_GameInputEvent("deviceRemoved",null,null,device)); + } + } +}; +openfl_ui_GameInput.__super__ = openfl_events_EventDispatcher; +openfl_ui_GameInput.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + __class__: openfl_ui_GameInput +}); +var openfl_ui_GameInputControl = function(device,id,minValue,maxValue,value) { + if(value == null) { + value = 0; + } + openfl_events_EventDispatcher.call(this); + this.device = device; + this.id = id; + this.minValue = minValue; + this.maxValue = maxValue; + this.value = value; +}; +$hxClasses["openfl.ui.GameInputControl"] = openfl_ui_GameInputControl; +openfl_ui_GameInputControl.__name__ = ["openfl","ui","GameInputControl"]; +openfl_ui_GameInputControl.__super__ = openfl_events_EventDispatcher; +openfl_ui_GameInputControl.prototype = $extend(openfl_events_EventDispatcher.prototype,{ + device: null + ,id: null + ,maxValue: null + ,minValue: null + ,value: null + ,__class__: openfl_ui_GameInputControl +}); +var openfl_ui_GameInputDevice = function(id,name) { + this.__controls = []; + this.__button = new haxe_ds_IntMap(); + this.__axis = new haxe_ds_IntMap(); + this.id = id; + this.name = name; + var control; + var _g = 0; + while(_g < 6) { + var i = _g++; + control = new openfl_ui_GameInputControl(this,"AXIS_" + i,-1,1); + this.__axis.set(i,control); + this.__controls.push(control); + } + var _g1 = 0; + while(_g1 < 15) { + var i1 = _g1++; + control = new openfl_ui_GameInputControl(this,"BUTTON_" + i1,0,1); + this.__button.set(i1,control); + this.__controls.push(control); + } +}; +$hxClasses["openfl.ui.GameInputDevice"] = openfl_ui_GameInputDevice; +openfl_ui_GameInputDevice.__name__ = ["openfl","ui","GameInputDevice"]; +openfl_ui_GameInputDevice.prototype = { + enabled: null + ,id: null + ,name: null + ,__axis: null + ,__button: null + ,__controls: null + ,__class__: openfl_ui_GameInputDevice +}; +var openfl_ui_Keyboard = function() { }; +$hxClasses["openfl.ui.Keyboard"] = openfl_ui_Keyboard; +openfl_ui_Keyboard.__name__ = ["openfl","ui","Keyboard"]; +openfl_ui_Keyboard.__convertKeyCode = function(key) { + switch(key) { + case 8: + return 8; + case 9: + return 9; + case 13: + return 13; + case 27: + return 27; + case 32: + return 32; + case 33: + return 49; + case 34: + return 222; + case 35: + return 51; + case 36: + return 52; + case 37: + return 53; + case 38: + return 55; + case 39: + return 222; + case 40: + return 57; + case 41: + return 48; + case 42: + return 56; + case 44: + return 188; + case 45: + return 189; + case 46: + return 190; + case 47: + return 191; + case 48: + return 48; + case 49: + return 49; + case 50: + return 50; + case 51: + return 51; + case 52: + return 52; + case 53: + return 53; + case 54: + return 54; + case 55: + return 55; + case 56: + return 56; + case 57: + return 57; + case 58: + return 186; + case 59: + return 186; + case 60: + return 60; + case 61: + return 187; + case 62: + return 190; + case 63: + return 191; + case 64: + return 50; + case 91: + return 219; + case 92: + return 220; + case 93: + return 221; + case 94: + return 54; + case 95: + return 189; + case 96: + return 192; + case 97: + return 65; + case 98: + return 66; + case 99: + return 67; + case 100: + return 68; + case 101: + return 69; + case 102: + return 70; + case 103: + return 71; + case 104: + return 72; + case 105: + return 73; + case 106: + return 74; + case 107: + return 75; + case 108: + return 76; + case 109: + return 77; + case 110: + return 78; + case 111: + return 79; + case 112: + return 80; + case 113: + return 81; + case 114: + return 82; + case 115: + return 83; + case 116: + return 84; + case 117: + return 85; + case 118: + return 86; + case 119: + return 87; + case 120: + return 88; + case 121: + return 89; + case 122: + return 90; + case 127: + return 46; + case 1073741881: + return 20; + case 1073741882: + return 112; + case 1073741883: + return 113; + case 1073741884: + return 114; + case 1073741885: + return 115; + case 1073741886: + return 116; + case 1073741887: + return 117; + case 1073741888: + return 118; + case 1073741889: + return 119; + case 1073741890: + return 120; + case 1073741891: + return 121; + case 1073741892: + return 122; + case 1073741893: + return 123; + case 1073741894: + return 301; + case 1073741895: + return 145; + case 1073741896: + return 19; + case 1073741897: + return 45; + case 1073741898: + return 36; + case 1073741899: + return 33; + case 1073741901: + return 35; + case 1073741902: + return 34; + case 1073741903: + return 39; + case 1073741904: + return 37; + case 1073741905: + return 40; + case 1073741906: + return 38; + case 1073741907: + return 144; + case 1073741908: + return 111; + case 1073741909: + return 106; + case 1073741910: + return 109; + case 1073741911: + return 107; + case 1073741912: + return 108; + case 1073741913: + return 97; + case 1073741914: + return 98; + case 1073741915: + return 99; + case 1073741916: + return 100; + case 1073741917: + return 101; + case 1073741918: + return 102; + case 1073741919: + return 103; + case 1073741920: + return 104; + case 1073741921: + return 105; + case 1073741922: + return 96; + case 1073741923: + return 110; + case 1073741925: + return 302; + case 1073741928: + return 124; + case 1073741929: + return 125; + case 1073741930: + return 126; + case 1073741982: + return 13; + case 1073742044: + return 110; + case 1073742048: + return 17; + case 1073742049: + return 16; + case 1073742050: + return 18; + case 1073742051: + return 15; + case 1073742052: + return 17; + case 1073742053: + return 16; + case 1073742054: + return 18; + case 1073742055: + return 15; + default: + return key; + } +}; +openfl_ui_Keyboard.__getCharCode = function(key,shift) { + if(shift == null) { + shift = false; + } + if(!shift) { + switch(key) { + case 8: + return 8; + case 9: + return 9; + case 13: + return 13; + case 27: + return 27; + case 32: + return 32; + case 186: + return 59; + case 187: + return 61; + case 188: + return 44; + case 189: + return 45; + case 190: + return 46; + case 191: + return 47; + case 192: + return 96; + case 219: + return 91; + case 220: + return 92; + case 221: + return 93; + case 222: + return 39; + } + if(key >= 48 && key <= 57) { + return key - 48 + 48; + } + if(key >= 65 && key <= 90) { + return key - 65 + 97; + } + } else { + switch(key) { + case 48: + return 41; + case 49: + return 33; + case 50: + return 64; + case 51: + return 35; + case 52: + return 36; + case 53: + return 37; + case 54: + return 94; + case 55: + return 38; + case 56: + return 42; + case 57: + return 40; + case 186: + return 58; + case 187: + return 43; + case 188: + return 60; + case 189: + return 95; + case 190: + return 62; + case 191: + return 63; + case 192: + return 126; + case 219: + return 123; + case 220: + return 124; + case 221: + return 125; + case 222: + return 34; + } + if(key >= 65 && key <= 90) { + return key - 65 + 65; + } + } + if(key >= 96 && key <= 105) { + return key - 96 + 48; + } + switch(key) { + case 8: + return 8; + case 13: + return 13; + case 46: + return 127; + case 106: + return 42; + case 107: + return 43; + case 108: + return 44; + case 110: + return 45; + case 111: + return 46; + } + return 0; +}; +openfl_ui_Keyboard.__getKeyLocation = function(key) { + switch(key) { + case 1073741908:case 1073741909:case 1073741910:case 1073741911:case 1073741912:case 1073741913:case 1073741914:case 1073741915:case 1073741916:case 1073741917:case 1073741918:case 1073741919:case 1073741920:case 1073741921:case 1073741922:case 1073741923:case 1073742044: + return 3; + case 1073742048:case 1073742049:case 1073742050:case 1073742051: + return 1; + case 1073742052:case 1073742053:case 1073742054:case 1073742055: + return 2; + default: + return 0; + } +}; +var openfl_utils__$ByteArray_ByteArray_$Impl_$ = {}; +$hxClasses["openfl.utils._ByteArray.ByteArray_Impl_"] = openfl_utils__$ByteArray_ByteArray_$Impl_$; +openfl_utils__$ByteArray_ByteArray_$Impl_$.__name__ = ["openfl","utils","_ByteArray","ByteArray_Impl_"]; +openfl_utils__$ByteArray_ByteArray_$Impl_$.__properties__ = {get_length:"get_length"}; +openfl_utils__$ByteArray_ByteArray_$Impl_$.fromBytes = function(bytes) { + if(Std["is"](bytes,openfl_utils_ByteArrayData)) { + return bytes; + } else { + return openfl_utils_ByteArrayData.fromBytes(bytes); + } +}; +openfl_utils__$ByteArray_ByteArray_$Impl_$.toBytes = function(byteArray) { + return byteArray; +}; +openfl_utils__$ByteArray_ByteArray_$Impl_$.get_length = function(this1) { + return this1.__length; +}; +var openfl_utils_IDataOutput = function() { }; +$hxClasses["openfl.utils.IDataOutput"] = openfl_utils_IDataOutput; +openfl_utils_IDataOutput.__name__ = ["openfl","utils","IDataOutput"]; +openfl_utils_IDataOutput.prototype = { + __class__: openfl_utils_IDataOutput +}; +var openfl_utils_IDataInput = function() { }; +$hxClasses["openfl.utils.IDataInput"] = openfl_utils_IDataInput; +openfl_utils_IDataInput.__name__ = ["openfl","utils","IDataInput"]; +openfl_utils_IDataInput.prototype = { + __class__: openfl_utils_IDataInput +}; +var openfl_utils_ByteArrayData = function(length) { + if(length == null) { + length = 0; + } + var bytes = haxe_io_Bytes.alloc(length); + haxe_io_Bytes.call(this,bytes.b.buffer); + this.__length = length; + this.set_endian(0); + this.position = 0; +}; +$hxClasses["openfl.utils.ByteArrayData"] = openfl_utils_ByteArrayData; +openfl_utils_ByteArrayData.__name__ = ["openfl","utils","ByteArrayData"]; +openfl_utils_ByteArrayData.__interfaces__ = [openfl_utils_IDataOutput,openfl_utils_IDataInput]; +openfl_utils_ByteArrayData.fromBytes = function(bytes) { + var result = new openfl_utils_ByteArrayData(); + result.__fromBytes(bytes); + return result; +}; +openfl_utils_ByteArrayData.__super__ = haxe_io_Bytes; +openfl_utils_ByteArrayData.prototype = $extend(haxe_io_Bytes.prototype,{ + position: null + ,__endian: null + ,__length: null + ,readUnsignedByte: function() { + if(this.position < this.__length) { + return this.get(this.position++); + } else { + throw new js__$Boot_HaxeError(new openfl_errors_EOFError()); + } + } + ,readUTFBytes: function(length) { + if(this.position + length > this.__length) { + throw new js__$Boot_HaxeError(new openfl_errors_EOFError()); + } + this.position += length; + return this.getString(this.position - length,length); + } + ,__fromBytes: function(bytes) { + this.__setData(bytes); + this.__length = bytes.length; + } + ,__setData: function(bytes) { + this.b = bytes.b; + this.length = bytes.length; + this.data = bytes.data; + } + ,set_endian: function(value) { + return this.__endian = value; + } + ,__class__: openfl_utils_ByteArrayData + ,__properties__: {set_endian:"set_endian"} +}); +var haxe_lang_Iterator = function() { }; +$hxClasses["haxe.lang.Iterator"] = haxe_lang_Iterator; +haxe_lang_Iterator.__name__ = ["haxe","lang","Iterator"]; +haxe_lang_Iterator.prototype = { + hasNext: null + ,next: null + ,__class__: haxe_lang_Iterator +}; +var haxe_lang_Iterable = function() { }; +$hxClasses["haxe.lang.Iterable"] = haxe_lang_Iterable; +haxe_lang_Iterable.__name__ = ["haxe","lang","Iterable"]; +haxe_lang_Iterable.prototype = { + iterator: null + ,__class__: haxe_lang_Iterable +}; +function $iterator(o) { if( o instanceof Array ) return function() { return HxOverrides.iter(o); }; return typeof(o.iterator) == 'function' ? $bind(o,o.iterator) : o.iterator; } +var $_, $fid = 0; +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $fid++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = function(){ return f.method.apply(f.scope, arguments); }; f.scope = o; f.method = m; o.hx__closures__[m.__id__] = f; } return f; } +$hxClasses["Math"] = Math; +String.prototype.__class__ = $hxClasses["String"] = String; +String.__name__ = ["String"]; +$hxClasses["Array"] = Array; +Array.__name__ = ["Array"]; +Date.prototype.__class__ = $hxClasses["Date"] = Date; +Date.__name__ = ["Date"]; +var Int = $hxClasses["Int"] = { __name__ : ["Int"]}; +var Dynamic = $hxClasses["Dynamic"] = { __name__ : ["Dynamic"]}; +var Float = $hxClasses["Float"] = Number; +Float.__name__ = ["Float"]; +var Bool = $hxClasses["Bool"] = Boolean; +Bool.__ename__ = ["Bool"]; +var Class = $hxClasses["Class"] = { __name__ : ["Class"]}; +var Enum = { }; +var __map_reserved = {}; +var ArrayBuffer = $global.ArrayBuffer || js_html_compat_ArrayBuffer; +if(ArrayBuffer.prototype.slice == null) { + ArrayBuffer.prototype.slice = js_html_compat_ArrayBuffer.sliceImpl; +} +var DataView = $global.DataView || js_html_compat_DataView; +var Float32Array = $global.Float32Array || js_html_compat_Float32Array._new; +var Uint8Array = $global.Uint8Array || js_html_compat_Uint8Array._new; +var this1 = new Uint32Array(256); +lime_math_color__$RGBA_RGBA_$Impl_$.__alpha16 = this1; +var _g = 0; +while(_g < 256) { + var i = _g++; + lime_math_color__$RGBA_RGBA_$Impl_$.__alpha16[i] = Math.ceil(i * 257.00392156862745); +} +var this2 = new Uint8Array(510); +lime_math_color__$RGBA_RGBA_$Impl_$.__clamp = this2; +var _g1 = 0; +while(_g1 < 255) { + var i1 = _g1++; + lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[i1] = i1; +} +var _g11 = 255; +var _g2 = 511; +while(_g11 < _g2) { + var i2 = _g11++; + lime_math_color__$RGBA_RGBA_$Impl_$.__clamp[i2] = 255; +} +if(window.createjs != null) { + createjs.Sound.alternateExtensions = ["ogg","mp3","wav"]; +} +openfl_events_EventDispatcher.criticalError = null; +openfl_display_DisplayObject.__instanceCount = 0; +openfl_display_DisplayObject.__worldRenderDirty = 0; +openfl_display_DisplayObject.__worldTransformDirty = 0; +openfl_display_DisplayObject.__cacheAsBitmapMode = false; +com_davidmaletz_lerp_LerpSpriteBase.UPDATE_FACING = "update_facing"; +com_davidmaletz_lerp_LerpSprite.priority = 0; +com_davidmaletz_faengfl_Application.focus = null; +com_davidmaletz_faengfl_adv_AdvApp.saves = new haxe_ds_StringMap(); +com_davidmaletz_faengfl_adv_AdvApp.shiftDown = false; +com_davidmaletz_faengfl_adv_AdvApp.ctrlDown = false; +com_davidmaletz_faengfl_adv_AdvApp.hasFocus = true; +com_davidmaletz_mining_Main.PSCALE = 2; +com_davidmaletz_mining_Main.PIRATE = false; +com_davidmaletz_mining_Main.PROGRESS_COL = 16750848; +com_davidmaletz_mining_Main.NO_COUNT = false; +com_davidmaletz_mining_Main.ALLOW_FLASH = true; +com_davidmaletz_mining_Main.allowMultiplayer = true; +com_davidmaletz_mining_Main.TOUCHSCREEN = false; +com_davidmaletz_mining_Main.error = false; +com_davidmaletz_mining_Main.temporary_remove = false; +com_davidmaletz_mining_Main.invokes = null; +PriorityManager.priority = 0; +StringTools.winMetaCharacters = [32,40,41,37,33,94,34,60,62,38,124,10,13,44,59]; +Xml.Element = 0; +Xml.PCData = 1; +Xml.CData = 2; +Xml.Comment = 3; +Xml.DocType = 4; +Xml.ProcessingInstruction = 5; +Xml.Document = 6; +com_davidmaletz_controls_ClickableHandler.globalOnCancel = null; +com_davidmaletz_controls_ClickableHandler.globalOnMove = null; +com_davidmaletz_controls_ClickableHandler.globalOnSelect = null; +com_davidmaletz_faengfl_Window.ADD_WINDOW = "add_window"; +com_davidmaletz_faengfl_Window.REM_WINDOW = "rem_window"; +com_davidmaletz_faengfl_Window.window_ct = 0; +com_davidmaletz_faengfl_Window.dispatcher = new openfl_events_EventDispatcher(); +com_davidmaletz_controls_Controller.DEADZONE = 0.5; +com_davidmaletz_controls_Controller.layout = -1; +openfl_events_Event.ACTIVATE = "activate"; +openfl_events_Event.ADDED = "added"; +openfl_events_Event.ADDED_TO_STAGE = "addedToStage"; +openfl_events_Event.CANCEL = "cancel"; +openfl_events_Event.CHANGE = "change"; +openfl_events_Event.CLOSE = "close"; +openfl_events_Event.COMPLETE = "complete"; +openfl_events_Event.CONNECT = "connect"; +openfl_events_Event.CONTEXT3D_CREATE = "context3DCreate"; +openfl_events_Event.DEACTIVATE = "deactivate"; +openfl_events_Event.ENTER_FRAME = "enterFrame"; +openfl_events_Event.ID3 = "id3"; +openfl_events_Event.INIT = "init"; +openfl_events_Event.MOUSE_LEAVE = "mouseLeave"; +openfl_events_Event.OPEN = "open"; +openfl_events_Event.REMOVED = "removed"; +openfl_events_Event.REMOVED_FROM_STAGE = "removedFromStage"; +openfl_events_Event.RENDER = "render"; +openfl_events_Event.RESIZE = "resize"; +openfl_events_Event.SCROLL = "scroll"; +openfl_events_Event.SELECT = "select"; +openfl_events_Event.SOUND_COMPLETE = "soundComplete"; +openfl_events_Event.TAB_CHILDREN_CHANGE = "tabChildrenChange"; +openfl_events_Event.TAB_ENABLED_CHANGE = "tabEnabledChange"; +openfl_events_Event.TAB_INDEX_CHANGE = "tabIndexChange"; +openfl_events_Event.UNLOAD = "unload"; +com_davidmaletz_faengfl_Button.globalOnRelease = null; +com_davidmaletz_faengfl_DeveloperConsole.promptSendReport = null; +com_davidmaletz_faengfl_TextSprite.SMOOTH = false; +com_davidmaletz_faengfl_TextSprite.data = []; +com_davidmaletz_faengfl_TextSprite.ct = 0; +com_davidmaletz_faengfl_TextSprite.chars = []; +com_davidmaletz_faengfl_TextSprite.char_ct = 0; +com_davidmaletz_faengfl_EventHandler.lastGroup = null; +com_davidmaletz_faengfl_EventHandler.lastSel = 0; +com_davidmaletz_faengfl_EventHandler.additionalVars = null; +com_davidmaletz_faengfl_FaengFL.isPaused = com_davidmaletz_faengfl_FaengFL.hasWindow; +com_davidmaletz_faengfl_FaengFL.listeners = null; +com_davidmaletz_faengfl_FaengFL.listeners_modify = null; +com_davidmaletz_faengfl_FaengFL.dispatching = false; +com_davidmaletz_faengfl_FaengFL.listeners_add = null; +com_davidmaletz_faengfl_FaengFL.lastTime = -1; +com_davidmaletz_faengfl_FaengFL.speed_mod = 1; +com_davidmaletz_faengfl_FaengFL.frameTime = 1; +openfl_geom_Rectangle.__temp = new openfl_geom_Rectangle(); +com_davidmaletz_faengfl_LayerManager.transform = new openfl_geom_ColorTransform(); +com_davidmaletz_faengfl_LayerManager.rect = new openfl_geom_Rectangle(); +com_davidmaletz_faengfl_LayerManager.point = new openfl_geom_Point(); +com_davidmaletz_faengfl_TileOffset.HIDDEN = new com_davidmaletz_faengfl_TileOffset(null,0,true); +com_davidmaletz_faengfl_RevealText.TEXT_SPEED = 4; +com_davidmaletz_faengfl_SoundManager.MAIN_VOL = 1; +com_davidmaletz_faengfl_SoundManager.bgm_vol = 0; +com_davidmaletz_faengfl_SoundManager.sound_cache = new haxe_ds_StringMap(); +com_davidmaletz_faengfl_SoundManager.music_cache = new haxe_ds_StringMap(); +com_davidmaletz_faengfl_SoundManager.musicPos = new haxe_ds_StringMap(); +com_davidmaletz_faengfl_SoundManager.sound_cooldown = new haxe_ds_StringMap(); +com_davidmaletz_faengfl_SoundManager.bgm_peak = 1; +com_davidmaletz_faengfl_TouchAdapter.__is_action_key = false; +com_davidmaletz_faengfl_achievement_Achievements.GAIN_ACHIEVEMENT = "gain_achievement"; +com_davidmaletz_faengfl_achievement_Achievements.index = 0; +com_davidmaletz_faengfl_adv_ModHandler.dispatcher = new openfl_events_EventDispatcher(); +com_davidmaletz_faengfl_adv_ModHandler.entries = []; +com_davidmaletz_faengfl_adv_ModHandler.onLoad = []; +com_davidmaletz_faengfl_adv_ModHandler.mods = []; +com_davidmaletz_faengfl_adv_ModHandler.addActionEntries = null; +com_davidmaletz_faengfl_adv_ModHandler.onReset = null; +com_davidmaletz_faengfl_adv_ModHandler.shouldEnable = com_davidmaletz_faengfl_adv_ModHandler.defaultShouldEnable; +com_davidmaletz_faengfl_adv_sound_Music.current = null; +com_davidmaletz_faengfl_controls_MouseKey.LEFT = 0; +com_davidmaletz_faengfl_controls_MouseKey.MIDDLE = 1; +com_davidmaletz_faengfl_controls_MouseKey.RIGHT = 2; +com_davidmaletz_faengfl_controls_MouseKey.FLASH_LENGTH = 30; +com_fancyfish_faeng_common_mutable_Mutable.UPDATED = "updated"; +com_fancyfish_faeng_text_FontManager.font_map = new haxe_ds_StringMap(); +com_fancyfish_faeng_text_FontManager.defaultFont = new com_fancyfish_faeng_common_mutable_Mutable(); +openfl_display_LoaderInfo.__rootURL = js_Browser.get_document().URL; +openfl_system_ApplicationDomain.currentDomain = new openfl_system_ApplicationDomain(null); +openfl_geom_Matrix.__identity = new openfl_geom_Matrix(); +openfl_geom_Matrix.__temp = new openfl_geom_Matrix(); +com_davidmaletz_faengfl_ui_FormattedTooltip.createFormattedText = com_davidmaletz_faengfl_ui_FormattedTooltip.defaultCreate; +com_davidmaletz_lerp_LerpTracks.remove = []; +com_davidmaletz_lerp_PositionKeyframe.ROUND = false; +com_davidmaletz_mining_DifficultyMode.DEFAULT = com_davidmaletz_mining_DifficultyMode.load(null); +com_davidmaletz_mining_world_BaseObject.ADD_TO_AREA = "add_to_area"; +com_davidmaletz_mining_world_BaseObject.REMOVED_FROM_AREA = "removed_from_area"; +com_davidmaletz_mining_world_BaseObject.WATER_TINT = 2662382; +com_davidmaletz_mining_world_BaseObject.POSITION_CHANGED = "position_changed"; +com_davidmaletz_mining_world_BaseObject.rectangle = new openfl_geom_Rectangle(); +com_davidmaletz_mining_world_Object.CHANGE_HEALTH = "change_health"; +com_davidmaletz_mining_world_Object.CHANGE_LABEL = "change_label"; +com_davidmaletz_mining_world_Object.HIT_EFFECT = "hit_effect"; +com_davidmaletz_mining_world_Object.STOP_WATCH = "stop_watch"; +com_davidmaletz_mining_world_Object.FLAG_CRITICAL = 1; +com_davidmaletz_mining_world_Object.FLAG_IGNORE_DEFENSE = 2; +com_davidmaletz_mining_world_Object.FLAG_HIDE_ATTACKER = 4; +com_davidmaletz_mining_world_Object.FLAG_NO_KILL = 8; +com_davidmaletz_mining_world_Object.FLAG_CHECK_CAN_HIT = 16; +com_davidmaletz_mining_world_Object.rectangle = new openfl_geom_Rectangle(); +com_davidmaletz_mining_world_Object.__current_id = 0; +com_davidmaletz_mining_world_Object.__objects = new haxe_ds_IntMap(); +com_davidmaletz_mining_world_Object.__object_ids = new openfl_events_EventDispatcher(); +com_davidmaletz_tiles_Tile.SIZE = 16; +com_davidmaletz_mining_Player.CHANGE_STAMINA = "change_stamina"; +com_davidmaletz_mining_Player.ADD_EXP = "add_exp"; +com_davidmaletz_mining_Player.ITEM_ANIM = "item_anim"; +com_davidmaletz_mining_Player.PLAY_SOUND = "play_sound"; +com_davidmaletz_mining_Player.HOTKEY_CHANGED = "hotkey_changed"; +com_davidmaletz_mining_Player.STICKY_CHANGED = "sticky_changed"; +com_davidmaletz_mining_Player.PLAY = "play"; +com_davidmaletz_mining_Player.CHANGE_OXYGEN = "change_oxygen"; +com_davidmaletz_mining_Player.MOUNT = "mount"; +com_davidmaletz_mining_Player.TELEPORT = "teleport"; +com_davidmaletz_mining_Player.SEEN_ITEM = "seen_item"; +com_davidmaletz_mining_Player.USE_TOOL = "use_tool"; +com_davidmaletz_mining_Player.END_TOOL = "end_tool"; +com_davidmaletz_mining_Player.DIG = "dig"; +com_davidmaletz_mining_Player.LOSE_HEALTH = "lose_health"; +com_davidmaletz_mining_Player.HOTKEYS = 8; +com_davidmaletz_mining_Player.NO_HAIR = 100; +com_davidmaletz_mining_Player.SHOW_HAIR = 0; +com_davidmaletz_mining_Player.DEFAULT_WEIGHT = 50; +com_davidmaletz_mining_Player.AUTO_HEAL = true; +com_davidmaletz_mining_Player.AUTO_STAMINA = true; +com_davidmaletz_mining_Player.CHANGE_EQUIP = "change_equip"; +com_davidmaletz_mining_Player.CHANGE_EQ_STATE = "change_eq_state"; +com_davidmaletz_mining_Player.CHANGE_VANITY = "change_vanity"; +com_davidmaletz_mining_Player.ADD_STORAGE = "add_storage"; +com_davidmaletz_mining_Player.OXYGEN_TO_HEALTH = 20; +com_davidmaletz_mining_Player.UPDATE_COLORS = "update_colors"; +com_davidmaletz_mining_Player.FISHING_SPOT = new com_davidmaletz_mining__$Player_FishingSpot(); +com_davidmaletz_mining_Player.WATER_EXIT = new com_davidmaletz_mining__$Player_WaterExit(); +com_davidmaletz_mining_Player.EXP_GROWTH = 1.5; +com_davidmaletz_mining_Player.EXP_BASE = 40; +com_davidmaletz_mining_Player.WALL = 999999; +com_davidmaletz_mining_Player.HIT_EFFECT_COOLDOWN = 30; +com_davidmaletz_mining_Player.MOVE_ALL = false; +com_davidmaletz_mining_Player.WARN_TOSS = true; +com_davidmaletz_mining_Player.ITEM_DISCOVER = true; +com_davidmaletz_mining_Player.BLUEPRINT_PLACE = true; +com_davidmaletz_mining_Player.TALK_QUEST = true; +com_davidmaletz_mining_Player.AUTO_COLLECT = 0; +com_davidmaletz_mining_Player.HOTKEY_SWITCH = true; +com_davidmaletz_mining_Player.STOREHOUSE_PRIORITY = false; +com_davidmaletz_mining_Player.CRUSH_TO_HEALTH = 5; +com_davidmaletz_mining_Player.PVP = false; +com_davidmaletz_mining_PlayerInfo.DEFAULT_MAX_DEPTH = 80; +com_davidmaletz_mining_Skills.SKILL_CHANGE = "skill_change"; +com_davidmaletz_mining_Stat.UPDATE_TIME = "update_time"; +com_davidmaletz_mining_State.ADD_QUEST = "add_quest"; +com_davidmaletz_mining_State.REM_QUEST = "rem_quest"; +com_davidmaletz_mining_State.COMPLETE_QUEST = "complete_quest"; +com_davidmaletz_mining_State.STATE_CHANGED = "state_changed"; +com_davidmaletz_mining_State.UPDATE_FLAG = "update_flag"; +com_davidmaletz_mining_State.UPDATE_VAR = "update_var"; +com_davidmaletz_mining_State.UPDATE_TILE = "update_tile"; +com_davidmaletz_mining_State.UPDATE_ENEMY = "update_enemy"; +com_davidmaletz_mining_State.UPDATE_STRING = "update_string"; +com_davidmaletz_mining_State.UPDATE_ACHIEVEMENT = "update_achievement"; +com_davidmaletz_mining_State.UPDATE_CONTACT = "update_contact"; +com_davidmaletz_mining_State.ADD_RECIPE = "add_recipe"; +com_davidmaletz_mining_State.FIRST_RECIPE = "first_recipe"; +com_davidmaletz_mining_State.UPDATE_TMP_VAR = "update_tmp_var"; +com_davidmaletz_mining_effects_Fishing.success = 0; +com_davidmaletz_mining_effects_Fishing.KEYS = ["select","left","right","up","down","attack"]; +com_davidmaletz_mining_effects_Scene.SHOW = "show_scene"; +com_davidmaletz_mining_npc_NPCEventHandler.__npc_talking_idle = false; +com_davidmaletz_mining_effects_Storm.instance = null; +com_davidmaletz_mining_enemy_AttackRenderer.ATTACK = "attack"; +com_davidmaletz_mining_enemy_AttackRenderer.END_ATTACK = "end_attack"; +com_davidmaletz_mining_world_AttackableObject.HIDDEN = "hidden"; +com_davidmaletz_mining_world_AttackableObject.UPDATE_DEFENSE = "update_defense"; +com_davidmaletz_mining_enemy_Enemy.ESET_TILE = "eset_tile"; +com_davidmaletz_mining_enemy_Enemy.EMOVE_TO = "emove_to"; +com_davidmaletz_mining_enemy_Enemy.DIG_TILE = "dig_tile"; +com_davidmaletz_mining_enemy_Enemy.HIDDEN = "hidden"; +com_davidmaletz_mining_enemy_Enemy.UPDATE_DEFENSE = "update_defense"; +com_davidmaletz_mining_enemy_Enemy.CATCH_ROUNDS = 7; +com_davidmaletz_mining_enemy_Enemy.point = new com_fancyfish_faeng_display_IPoint2D(); +com_davidmaletz_mining_enemy_Dragon.UPDATE_ATTACKS = "update_attacks"; +com_davidmaletz_mining_enemy__$Dragon_DragonRenderer.MAX_HEIGHT = -8 * com_davidmaletz_tiles_Tile.SIZE; +com_davidmaletz_mining_enemy_EnemySpawner.TRY_COUNT = 50; +com_davidmaletz_mining_enemy_SurfaceRenderer.rect = new openfl_geom_Rectangle(); +com_davidmaletz_mining_familiar_Familiar.PLAY = "familiar_play"; +com_davidmaletz_mining_familiar_Familiar.FLASH_CT = 15; +com_davidmaletz_mining_familiar_Flying.FLIGHT_CT = 2; +com_davidmaletz_mining_item_Action.warning = null; +com_davidmaletz_mining_item_Action.UNDERGROUND = 1; +com_davidmaletz_mining_item_Action.ON_WATER = 2; +com_davidmaletz_mining_item_Action.UNDERWATER = 4; +com_davidmaletz_mining_item_Action.ON_GRASS = 8; +com_davidmaletz_mining_item_Action.ON_AIR = 16; +com_davidmaletz_mining_item_Action.UNDERWATER_ONLY = 32; +com_davidmaletz_mining_item_Action.ALLOW_INTERIOR = 64; +com_davidmaletz_mining_item_Animal.UPDATE_ANIMAL = "update_crop"; +com_davidmaletz_mining_item_Animal.UPDATE_NAME = "update_name"; +com_davidmaletz_mining_structure_Structure.UPDATE_NAME = "update_name"; +com_davidmaletz_mining_structure_Structure.SEND_TO_BACK = "send_to_back"; +com_davidmaletz_mining_structure_Structure.NOTIFY_NPC = "notify_npc"; +com_davidmaletz_mining_structure_Structure.powerList = []; +com_davidmaletz_mining_structure_Structure.__current_id = 0; +com_davidmaletz_mining_structure_Structure.__structures = new haxe_ds_IntMap(); +com_davidmaletz_mining_structure_Structure.__structure_ids = new openfl_events_EventDispatcher(); +com_davidmaletz_mining_item_Equipment.NO_FLIGHT = 2; +com_davidmaletz_mining_item_FarmItem.UPDATE_PERCENT = "update_percent"; +com_davidmaletz_mining_item_FarmItem.FARM_SPEED = 200; +com_davidmaletz_mining_item_Inventory.ITEM_ADDED = "item_added"; +com_davidmaletz_mining_item_Item.UPDATE_VALUE = "update_value"; +com_davidmaletz_mining_item_ItemCategory.none = new com_davidmaletz_mining_item_ItemCategory(999,null,null,null,false); +com_davidmaletz_mining_item_ItemCategory.VEHICLE = new com_davidmaletz_mining_item_ItemCategory(998,"vehicle","vehicle.ico",null); +com_davidmaletz_mining_item_ItemData.oldDurability = ["iron_pickaxe","iron_sword","iron_armor","buckler","rusty_axe","steel_pickaxe","steel_sword","steel_armor","kite_shield","ice_shield","fishing_rod"]; +com_davidmaletz_mining_item_Recipe.fuelName = null; +com_davidmaletz_mining_item_SmeltQueue.UPDATE = "update"; +com_davidmaletz_mining_item_SmeltQueue.PROGRESS = "progress"; +com_davidmaletz_mining_item_SmeltQueue.ADD_ITEMS = "add_items"; +com_davidmaletz_mining_item_SmeltQueue.REMOVE_ITEMS = "remove_items"; +com_davidmaletz_mining_item_SmeltQueue.CLEAR_CURRENT = "clear_current"; +com_davidmaletz_mining_network_CloudSaves.dispatcher = new openfl_events_EventDispatcher(); +com_davidmaletz_mining_network_CloudSaves.sync = new haxe_ds_IntMap(); +com_davidmaletz_mining_network_CloudSaves.is_logging_in = false; +com_davidmaletz_mining_npc_DefaultNPCIdle.mining_speed = 1; +com_davidmaletz_mining_npc_NPC.IDLE_CANCEL = "idle_cancel"; +com_davidmaletz_mining_npc_NPC.MOVE_TO = "move_to"; +com_davidmaletz_mining_npc_NPC.BEGIN_PATH = "begin_path"; +com_davidmaletz_mining_npc_NPC.FORCE_MOVE_TO = "force_move_to"; +com_davidmaletz_mining_npc_NPC.SHOW = "show"; +com_davidmaletz_mining_npc_NPC.RUN_FROM = "run_from"; +com_davidmaletz_mining_npc_NPC.NOTIFY_AWAY = true; +com_davidmaletz_mining_renderer_AreaRenderer.point = new openfl_geom_Point(); +com_davidmaletz_mining_renderer_ParallaxLayer.dxMap = new haxe_ds_StringMap(); +com_davidmaletz_mining_renderer_PlayerRenderer.max_overweight = 1000; +com_davidmaletz_mining_renderer_PlayerRenderer.FALL_SPEED = 2; +com_davidmaletz_mining_renderer_PlayerRenderer.FLAG_NO_MINE = 1; +com_davidmaletz_mining_renderer_PlayerRenderer.FLAG_FALL = 2; +com_davidmaletz_mining_renderer_RotateSprite.lastRot = 0; +com_davidmaletz_mining_structure_Dialogue.UPDATE_TITLE = "update_title"; +com_davidmaletz_mining_structure_Door.UPDATE_LOCATION = "update_location"; +com_davidmaletz_mining_structure_Elevator.CALL_ELEVATOR = "call_elevator"; +com_davidmaletz_mining_structure_EnchantRecipe.UPDATE_RECIPE = "update_recipe"; +com_davidmaletz_mining_structure_FarmBase.ITEM_CHANGE = "item_change"; +com_davidmaletz_mining_structure_FarmBase.CROP_ADDED = "crop_added"; +com_davidmaletz_mining_structure_FarmBase.CROP_REMOVED = "crop_removed"; +com_davidmaletz_mining_structure_Fuelable.UPDATE_FUEL = "update_fuel"; +com_davidmaletz_mining_structure_Market.RESTOCK = "restock"; +com_davidmaletz_mining_structure__$Powerline_PowerlineRenderer.MAX_DIST = 11 * com_davidmaletz_tiles_Tile.SIZE; +com_davidmaletz_mining_structure_Powerplant.ANIMAL_CT = 10; +com_davidmaletz_mining_ui_CallerBox.PAD = 4; +com_davidmaletz_mining_ui_Controls.keys = ["left","right","up","down","select","cancel","attack","defend","inventory","quest","equipment","walk","hotkey1","hotkey2","hotkey3","hotkey4","hotkey5","hotkey6","hotkey7","hotkey8","chat","mute"]; +com_davidmaletz_mining_ui_Credits.prefix = "[color=" + "000066" + "]Programming & Design[/color]\n\n[tile=dev.david anim=dev.david flip] David Maletz\n\n\n[color=" + "000066" + "]Art[/color]\n\n[tile=dev.aaron anim=dev.aaron flip] Aaron Norell\n\n\n[color=" + "000066" + "]Sound & Music[/color]\n\n[tile=dev.chase anim=dev.chase flip] Chase Bethea\n\n\n[color=" + "000066" + "]Story Editing[/color]\n\n[tile=dev.natalie anim=dev.natalie flip] Natalie Maletz\n\n\n[color=" + "000066" + "]Portuguese Translator[/color]\n\nLucas Peixoto\n\n\n[color=" + "000066" + "]Russian Translator[/color]\n\nDmitry Chirtsov"; +com_davidmaletz_mining_ui_Credits.postfix = "\n\n\n(c) Fancy Fish Games 2020\n(c) SnoBox Studio 2020\n\nThank you for playing!\nWe hope to see you in the new world!"; +com_davidmaletz_mining_ui_Credits.time = 1000; +com_davidmaletz_mining_ui_GUI.FADE = 1; +com_davidmaletz_mining_ui_GUI.static_elements = []; +com_davidmaletz_mining_ui_GameOver.ITEMS = ["retry","title"]; +com_davidmaletz_mining_ui_GameplayOptions.ITEMS = [new com_davidmaletz_mining_ui__$GameplayOptions_Overweight(),new com_davidmaletz_mining_ui__$GameplayOptions_AutoHeal(),new com_davidmaletz_mining_ui__$GameplayOptions_AutoStamina(),new com_davidmaletz_mining_ui_AutoCollect(),new com_davidmaletz_mining_ui_BlueprintPlace(),new com_davidmaletz_mining_ui_TalkQuest(),new com_davidmaletz_mining_ui__$GameplayOptions_MineWalkways(),new com_davidmaletz_mining_ui_HotkeySwitch(),new com_davidmaletz_mining_ui_StorehousePriority(),new com_davidmaletz_mining_ui__$GameplayOptions_AllowFlash(),"back"]; +com_davidmaletz_mining_ui_InventoryList.BLUEPRINT_ALL = true; +com_davidmaletz_mining_ui_ModifyWindow.WIDTH = 90; +com_davidmaletz_mining_ui_MyButtonFactory.cache = new haxe_ds_IntMap(); +com_davidmaletz_mining_ui_MyButtonFactory.shrink_cache = new haxe_ds_IntMap(); +com_davidmaletz_mining_ui_NotificationQueue.OPTIONS = 0; +com_davidmaletz_mining_ui_NotificationQueue.notifications = []; +com_davidmaletz_mining_ui_Options.ITEMS = [new com_davidmaletz_mining_ui__$Options_MusicVol("music"),new com_davidmaletz_mining_ui__$Options_SFXVol("sfx"),new com_davidmaletz_mining_ui__$Options_Mute("mute"),new com_davidmaletz_mining_ui__$Options_Difficulty("difficulty"),new com_davidmaletz_mining_ui__$Options_Language("language"),"gameplay","ui","controls","back"]; +com_davidmaletz_mining_ui_Preloader.sound_fail = false; +com_davidmaletz_mining_ui_Radar.data = []; +com_davidmaletz_mining_ui_Radar.bounds = new openfl_geom_Rectangle(); +com_davidmaletz_mining_ui__$RecipeRenderer_ListButton.ALPHA = 0.5; +com_davidmaletz_mining_ui__$RepairRenderer_ListButton.ALPHA = 0.5; +com_davidmaletz_mining_ui_TextButton.WIDTH = 40; +com_davidmaletz_mining_ui_TitleScreen.WIDTH = 63; +com_davidmaletz_mining_ui_TitleScreen.COLS = 4; +com_davidmaletz_mining_ui_TitleScreen.PAD = 1; +com_davidmaletz_mining_ui_TitleScreen.ITEMS_DEMO = ["newgame","continue","options","forums","credits","options.achievements","order"]; +com_davidmaletz_mining_ui_TitleScreen.ITEMS_FULL = ["newgame","continue","options","exit","forums","credits","options.achievements","mods"]; +com_davidmaletz_mining_ui_TitleScreen.ITEMS_FULL_MP = ["newgame","continue","multiplayer.multiplayer","exit","options","credits","options.achievements","mods"]; +com_davidmaletz_mining_ui_TitleScreen.cur_version = null; +com_davidmaletz_mining_ui_UIOptions.ITEMS = [new com_davidmaletz_mining_ui__$UIOptions_TextSpeed("textspeed"),new com_davidmaletz_mining_ui__$UIOptions_HideNotifications(),new com_davidmaletz_mining_ui__$UIOptions_AwayNotifications(),new com_davidmaletz_mining_ui__$UIOptions_BlueprintAll(),new com_davidmaletz_mining_ui__$UIOptions_MoveAll(),new com_davidmaletz_mining_ui__$UIOptions_WarnToss(),new com_davidmaletz_mining_ui_ItemDiscover(),new com_davidmaletz_mining_ui__$UIOptions_PromptCount(),new com_davidmaletz_mining_ui__$UIOptions_FadeUI(),"back"]; +com_davidmaletz_mining_ui_VehicleGUI.PAD = 2; +com_davidmaletz_mining_ui_XmlButton.ALPHA = 0.5; +com_davidmaletz_mining_ui_details_Details.TEXT_ITEM = null; +com_davidmaletz_mining_world_Area.ADD_STRUCTURE = "add_structure"; +com_davidmaletz_mining_world_Area.REM_STRUCTURE = "rem_structure"; +com_davidmaletz_mining_world_Area.RUN_LOAD = "run_load"; +com_davidmaletz_mining_world_Area.ADD_PROJECTILE = "add_projectile"; +com_davidmaletz_mining_world_Area.REM_PROJECTILE = "rem_projectile"; +com_davidmaletz_mining_world_Area.TICK = "tick"; +com_davidmaletz_mining_world_Area.LOAD = "load"; +com_davidmaletz_mining_world_Area.UNLOAD = "unload"; +com_davidmaletz_mining_world_Area.INIT = "init"; +com_davidmaletz_mining_world_Area.DESTROY = "destroy"; +com_davidmaletz_mining_world_Area.SET_TILE = "set_tile"; +com_davidmaletz_mining_world_Area.UPDATE_CABLES = "update_cables"; +com_davidmaletz_mining_world_Area.UPDATE_NAME = "update_name"; +com_davidmaletz_mining_world_Area.FIRE_PROJECTILE = "fire_projectile"; +com_davidmaletz_mining_world_Area.START_STORM = "start_storm"; +com_davidmaletz_mining_world_Area.STOP_STORM = "stop_storm"; +com_davidmaletz_mining_world_Area.CHANGE_VEHICLE = "change_vehicle"; +com_davidmaletz_mining_world_Area.BASE_LAYER = 0; +com_davidmaletz_mining_world_Area.ORE_LAYER = 1; +com_davidmaletz_mining_world_Area.FLAG_LAYER = 2; +com_davidmaletz_mining_world_Area.BACK_LAYER = 3; +com_davidmaletz_mining_world_Area.FLAG_LIT = 1; +com_davidmaletz_mining_world_Area.FLAG_INVIS_BLOCK = 2; +com_davidmaletz_mining_world_Area.FLAG_WATER = 4; +com_davidmaletz_mining_world_Area.FLAG_WATER_BLOCK = 8; +com_davidmaletz_mining_world_Area.FLAG_BLOCK_NPC = 16; +com_davidmaletz_mining_world_Area.FLAG_BLOCK_VEHICLE = 32; +com_davidmaletz_mining_world_Area.FLAG_BLOCK_PLAYER = 64; +com_davidmaletz_mining_world_Area.FLAG_TRUE_WATER = 128; +com_davidmaletz_mining_world_Area.FLOOD_SPEED = 20; +com_davidmaletz_mining_world_Area.__WRITE_IDS = false; +com_davidmaletz_mining_world_Area.MINE_WALKWAYS = true; +com_davidmaletz_mining_world_Area.DROPOFF = 0.002; +com_davidmaletz_mining_world_Area.__current_id = 0; +com_davidmaletz_mining_world_Area.__areas = new haxe_ds_IntMap(); +com_davidmaletz_mining_world_Area.__area_ids = new openfl_events_EventDispatcher(); +com_davidmaletz_mining_world_Areas.ADD_AREA = "add_area"; +com_davidmaletz_mining_world_Areas.REMOVE_AREA = "remove_area"; +com_davidmaletz_mining_world_BlueprintObject.ALPHA = 0.7; +com_davidmaletz_mining_world_BlueprintObject.DEFAULT_BUILD_TIME = 20; +com_davidmaletz_mining_world_Bush.FPS = 15; +com_davidmaletz_mining_world_Bush.HARVEST = "harvest"; +com_davidmaletz_mining_world_FuelableObject.UPDATE_ON = "update_on"; +com_davidmaletz_mining_world_Generate.FRONT = 1; +com_davidmaletz_mining_world_Generate.BACK = 2; +com_davidmaletz_mining_world_Movement.CIRCLE = "movement_circle"; +com_davidmaletz_mining_world_Movement.SEEK = "movement_seek"; +com_davidmaletz_mining_world_ObjectLayer.BACK_LAYER = 0; +com_davidmaletz_mining_world_ObjectLayer.BUSH_LAYER = 1; +com_davidmaletz_mining_world_ObjectLayer.ITEM_LAYER = 2; +com_davidmaletz_mining_world_ObjectLayer.NPC_LAYER = 3; +com_davidmaletz_mining_world_ObjectLayer.ENEMY_LAYER = 4; +com_davidmaletz_mining_world_ObjectLayer.TRAP_LAYER = 5; +com_davidmaletz_mining_world_ObjectLayer.PLAYER_LAYER = 6; +com_davidmaletz_mining_world_ObjectLayer.TOP_LAYER = 7; +com_davidmaletz_mining_world_ObjectLayer.ADD_OBJECT = "add_object"; +com_davidmaletz_mining_world_ObjectLayer.REM_OBJECT = "rem_object"; +com_davidmaletz_mining_world_Projectile.FLAG_HIT_TILES = 1; +com_davidmaletz_mining_world_Projectile.FLAG_UNDERWATER = 2; +com_davidmaletz_mining_world_Projectile.FLAG_GLOW = 4; +com_davidmaletz_mining_world_Projectile.FLAG_PIERCE = 8; +com_davidmaletz_mining_world_Projectile.FLAG_IGNORE_ARMOR = 16; +com_davidmaletz_mining_world_Projectile.FLAG_HOMING = 32; +com_davidmaletz_mining_world_Projectile.FLAG_CRIT_TRUE = 64; +com_davidmaletz_mining_world_Projectile.FLAG_CRIT_FALSE = 128; +com_davidmaletz_mining_world_Projectile.__last_projectile_id = 0; +com_davidmaletz_mining_world_TrapObject.SPRING_TRAP = "spring_trap"; +com_davidmaletz_mining_world_TrapObject.DAMAGE_TRAP = "damage_trap"; +com_davidmaletz_mining_world_TrapObject.ATTEMPT_CATCH = "attempt_catch"; +com_davidmaletz_mining_world_TrapObject.REMOVE_ENEMY = "remove_enemy"; +com_davidmaletz_mining_world_Tree.FPS = 15; +com_davidmaletz_mining_world_types_Bird.MOVE = 16; +com_davidmaletz_mining_world_types_Random.MOVE = 32; +com_davidmaletz_mining_world_vehicle_Vehicle.UPDATE_FUEL = "update_fuel"; +com_davidmaletz_mining_world_vehicle_Vehicle.UPDATE_MOUNT = "update_mount"; +com_davidmaletz_mining_world_vehicle_Vehicle.BLOCKING = "blocking"; +com_davidmaletz_mining_world_vehicle_Submarine.CHANGE_OXYGEN = "change_oxygen"; +com_davidmaletz_tiles__$Autotile_TilePos.neighbor_names = ["left","right","top","bottom","topleft","topright","bottomleft","bottomright"]; +com_davidmaletz_tiles__$Autotile_TilePos.neighbor_values = [1,2,4,8,16,32,64,128]; +com_fancyfish_faeng_common_Lang.dispatcher = new openfl_events_EventDispatcher(); +com_fancyfish_faeng_common_Lang.defaultKeyboard = "data/keyboards/default.xml"; +com_fancyfish_faeng_common_Lang.text_cache = new haxe_ds_StringMap(); +com_fancyfish_faeng_common_Lang.message_cache = new haxe_ds_StringMap(); +com_fancyfish_faeng_common_Lang.template_cache = new haxe_ds_StringMap(); +com_fancyfish_faeng_common_Lang.key_cache = new haxe_ds_StringMap(); +com_fancyfish_faeng_common_Noise.p_vals = [151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180,151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180]; +com_fancyfish_faeng_common_Utils.MultiplyDeBruijnBitPosition = [0,1,28,2,29,14,24,3,30,22,20,15,25,17,4,8,31,27,13,23,21,19,16,7,26,12,18,6,11,5,10,9]; +com_fancyfish_faeng_common_Utils.RED = 16; +com_fancyfish_faeng_common_Utils.GREEN = 8; +com_fancyfish_faeng_common_Utils.BLUE = 0; +com_fancyfish_faeng_common_Utils.ALPHA = 24; +com_fancyfish_faeng_common_Utils.RAND_X = 9106.966345; +com_fancyfish_faeng_common_Utils.RAND_Y = 3742.931314; +com_fancyfish_faeng_common_Utils.RAND_Z = 8046.780733; +com_fancyfish_faeng_common_Utils.RAND_W = 2574.684771; +com_fancyfish_faeng_common_Utils.RAND_SCALAR = 49824.21294; +com_fancyfish_faeng_common_Utils.nextGaussian = NaN; +com_fancyfish_faeng_common_Utils.WIDTH = 32768; +com_fancyfish_faeng_common_Utils.OFF = 16384; +com_fancyfish_faeng_renderer_Color.WHITE = new com_fancyfish_faeng_renderer_Color(1,1,1); +com_fancyfish_faeng_renderer_Color.BLACK = new com_fancyfish_faeng_renderer_Color(0,0,0); +com_fancyfish_faeng_text_CharacterPos.ROUND = true; +format_tools_InflateImpl.LEN_EXTRA_BITS_TBL = [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,-1,-1]; +format_tools_InflateImpl.LEN_BASE_VAL_TBL = [3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258]; +format_tools_InflateImpl.DIST_EXTRA_BITS_TBL = [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,-1,-1]; +format_tools_InflateImpl.DIST_BASE_VAL_TBL = [1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577]; +format_tools_InflateImpl.CODE_LENGTHS_POS = [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]; +format_tools_InflateImpl.FIXED_HUFFMAN = null; +haxe_Serializer.USE_CACHE = false; +haxe_Serializer.USE_ENUM_INDEX = false; +haxe_Serializer.BASE64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%:"; +haxe_Serializer.BASE64_CODES = null; +haxe_Unserializer.DEFAULT_RESOLVER = new haxe__$Unserializer_DefaultResolver(); +haxe_Unserializer.BASE64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%:"; +haxe_Unserializer.CODES = null; +haxe_crypto_Base64.CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +haxe_crypto_Base64.BYTES = haxe_io_Bytes.ofString(haxe_crypto_Base64.CHARS); +haxe_ds_ObjectMap.count = 0; +haxe_io_FPHelper.i64tmp = (function($this) { + var $r; + var this1 = new haxe__$Int64__$_$_$Int64(0,0); + $r = this1; + return $r; +}(this)); +haxe_xml_Parser.escapes = (function($this) { + var $r; + var h = new haxe_ds_StringMap(); + h.set("lt","<"); + h.set("gt",">"); + h.set("amp","&"); + h.set("quot","\""); + h.set("apos","'"); + $r = h; + return $r; +}(this)); +js_Boot.__toStr = ({ }).toString; +js_html_compat_Float32Array.BYTES_PER_ELEMENT = 4; +js_html_compat_Uint8Array.BYTES_PER_ELEMENT = 1; +lime_Assets.cache = new lime_AssetCache(); +lime_Assets.libraries = new haxe_ds_StringMap(); +lime_Assets.onChange = new lime_app_Event_$Void_$Void(); +lime_Assets.initialized = false; +lime__$backend_html5_HTML5Window.windowID = 0; +lime_app_Preloader.images = new haxe_ds_StringMap(); +lime_app_Preloader.loaders = new haxe_ds_StringMap(); +lime_app_Preloader.sounds = new haxe_ds_StringMap(); +lime_graphics_Image.__base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +lime_math__$Matrix4_Matrix4_$Impl_$.__identity = [1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0]; +lime_ui_Gamepad.devices = new haxe_ds_IntMap(); +lime_ui_Gamepad.onConnect = new lime_app_Event_$lime_$ui_$Gamepad_$Void(); +lime_ui_Joystick.devices = new haxe_ds_IntMap(); +lime_ui_Joystick.onConnect = new lime_app_Event_$lime_$ui_$Joystick_$Void(); +lime_ui_Touch.onEnd = new lime_app_Event_$lime_$ui_$Touch_$Void(); +lime_ui_Touch.onMove = new lime_app_Event_$lime_$ui_$Touch_$Void(); +lime_ui_Touch.onStart = new lime_app_Event_$lime_$ui_$Touch_$Void(); +openfl_Assets.cache = new openfl_AssetCache(); +openfl_Lib.current = new openfl_display_MovieClip(); +openfl__$internal_renderer_GraphicsPaths.SIN45 = 0.70710678118654752440084436210485; +openfl__$internal_renderer_GraphicsPaths.TAN22 = 0.4142135623730950488016887242097; +openfl__$internal_renderer_cairo_CairoGraphics.SIN45 = 0.70710678118654752440084436210485; +openfl__$internal_renderer_cairo_CairoGraphics.TAN22 = 0.4142135623730950488016887242097; +openfl__$internal_renderer_canvas_CanvasGraphics.SIN45 = 0.70710678118654752440084436210485; +openfl__$internal_renderer_canvas_CanvasGraphics.TAN22 = 0.4142135623730950488016887242097; +openfl__$internal_renderer_canvas_CanvasGraphics.fillCommands = new openfl__$internal_renderer_DrawCommandBuffer(); +openfl__$internal_renderer_canvas_CanvasGraphics.strokeCommands = new openfl__$internal_renderer_DrawCommandBuffer(); +openfl__$internal_renderer_opengl_GLBitmap.fbData = []; +openfl__$internal_renderer_opengl_GLRenderer.glContextId = 0; +openfl__$internal_renderer_opengl_GLRenderer.glContexts = []; +openfl__$internal_renderer_opengl_shaders2_Shader.UID = 0; +openfl__$internal_renderer_opengl_shaders2_DefaultShader.VERTEX_SRC = ["attribute vec2 " + "openfl_aPosition" + ";","attribute vec2 " + "openfl_aTexCoord0" + ";","attribute vec4 " + "openfl_aColor" + ";","uniform mat3 " + "openfl_uProjectionMatrix" + ";","uniform bool " + "openfl_uUseColorTransform" + ";","varying vec2 " + "openfl_vTexCoord" + ";","varying vec4 " + "openfl_vColor" + ";","void main(void) {"," gl_Position = vec4((" + "openfl_uProjectionMatrix" + " * vec3(" + "openfl_aPosition" + ", 1.0)).xy, 0.0, 1.0);"," " + "openfl_vTexCoord" + " = " + "openfl_aTexCoord0" + ";"," if(" + "openfl_uUseColorTransform" + ")"," \t" + "openfl_vColor" + " = " + "openfl_aColor" + ";"," else"," \t" + "openfl_vColor" + " = vec4(" + "openfl_aColor" + ".rgb * " + "openfl_aColor" + ".a, " + "openfl_aColor" + ".a);","}"]; +openfl__$internal_renderer_opengl_utils_BlendModeManager.FORCE_MODE = null; +openfl__$internal_renderer_opengl_utils_BlendModeManager.ALPHA_VALUE = 1; +openfl__$internal_renderer_opengl_utils_PathBuiler.__currentWinding = 0; +openfl__$internal_renderer_opengl_utils_PathBuiler.__fillIndex = 0; +openfl__$internal_renderer_opengl_utils_GraphicsRenderer.fillVertexAttributes = [new openfl__$internal_renderer_opengl_utils_VertexAttribute(2,5126,false,"openfl_aPosition")]; +openfl__$internal_renderer_opengl_utils_GraphicsRenderer.drawTrianglesVertexAttributes = [new openfl__$internal_renderer_opengl_utils_VertexAttribute(2,5126,false,"openfl_aPosition"),new openfl__$internal_renderer_opengl_utils_VertexAttribute(2,5126,false,"openfl_aTexCoord0"),new openfl__$internal_renderer_opengl_utils_VertexAttribute(4,5121,true,"openfl_aColor")]; +openfl__$internal_renderer_opengl_utils_GraphicsRenderer.primitiveVertexAttributes = [new openfl__$internal_renderer_opengl_utils_VertexAttribute(2,5126,false,"openfl_aPosition"),new openfl__$internal_renderer_opengl_utils_VertexAttribute(4,5126,false,"openfl_aColor")]; +openfl__$internal_renderer_opengl_utils_GraphicsRenderer.bucketPool = []; +openfl__$internal_renderer_opengl_utils_GraphicsRenderer.objectPosition = new openfl_geom_Point(); +openfl__$internal_renderer_opengl_utils_GraphicsRenderer.objectBounds = new openfl_geom_Rectangle(); +openfl__$internal_renderer_opengl_utils_ShaderManager.compiledShadersCache = new haxe_ds_StringMap(); +openfl_display_BitmapData.__isGLES = null; +openfl_display_Preloader.soundFail = null; +openfl_display_Shader.uObjectSize = "openfl_uObjectSize"; +openfl_display_Shader.uTextureSize = "openfl_uTextureSize"; +openfl_display_Tilesheet.__defaultPoint = new openfl_geom_Point(0,0); +openfl_media_Sound.__registeredSounds = new haxe_ds_StringMap(); +openfl_ui_GameInput.numDevices = 0; +openfl_ui_GameInput.__deviceList = []; +openfl_ui_GameInput.__devices = new haxe_ds_ObjectMap(); +openfl_ui_GameInput.__instances = []; +ApplicationMain.main(); +})(typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this, typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); diff --git a/games/aground/data/core/achievements.png b/games/aground/data/core/achievements.png new file mode 100644 index 00000000..5f55f975 Binary files /dev/null and b/games/aground/data/core/achievements.png differ diff --git a/games/aground/data/core/achievements.xml b/games/aground/data/core/achievements.xml new file mode 100644 index 00000000..a7de3ff2 --- /dev/null +++ b/games/aground/data/core/achievements.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/games/aground/data/core/animals/animals.xml b/games/aground/data/core/animals/animals.xml new file mode 100644 index 00000000..90927066 --- /dev/null +++ b/games/aground/data/core/animals/animals.xml @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + object.setFuel(this.getFeed()); object.name = this.getNameStr(); f = Item.getParameter(this.getNameStr(), "f"); if(f != null) object.setHealth(Std.parseInt(f)); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + setGameScale(2) + setGameScale(1) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + +
\ No newline at end of file diff --git a/games/aground/data/core/animals/baby_dragon.png b/games/aground/data/core/animals/baby_dragon.png new file mode 100644 index 00000000..5ea5476e Binary files /dev/null and b/games/aground/data/core/animals/baby_dragon.png differ diff --git a/games/aground/data/core/animals/baby_dragon.xml b/games/aground/data/core/animals/baby_dragon.xml new file mode 100644 index 00000000..7cb214b7 --- /dev/null +++ b/games/aground/data/core/animals/baby_dragon.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/games/aground/data/core/animals/cat.png b/games/aground/data/core/animals/cat.png new file mode 100644 index 00000000..cae71599 Binary files /dev/null and b/games/aground/data/core/animals/cat.png differ diff --git a/games/aground/data/core/animals/cat.xml b/games/aground/data/core/animals/cat.xml new file mode 100644 index 00000000..7c65c68b --- /dev/null +++ b/games/aground/data/core/animals/cat.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/games/aground/data/core/animals/chicken.png b/games/aground/data/core/animals/chicken.png new file mode 100644 index 00000000..3dd511ce Binary files /dev/null and b/games/aground/data/core/animals/chicken.png differ diff --git a/games/aground/data/core/animals/cockatiel.png b/games/aground/data/core/animals/cockatiel.png new file mode 100644 index 00000000..42bba3e8 Binary files /dev/null and b/games/aground/data/core/animals/cockatiel.png differ diff --git a/games/aground/data/core/animals/cockatiel.xml b/games/aground/data/core/animals/cockatiel.xml new file mode 100644 index 00000000..c150e8a7 --- /dev/null +++ b/games/aground/data/core/animals/cockatiel.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/games/aground/data/core/animals/cow.png b/games/aground/data/core/animals/cow.png new file mode 100644 index 00000000..9a88c7a1 Binary files /dev/null and b/games/aground/data/core/animals/cow.png differ diff --git a/games/aground/data/core/animals/owl.png b/games/aground/data/core/animals/owl.png new file mode 100644 index 00000000..3ec95b4c Binary files /dev/null and b/games/aground/data/core/animals/owl.png differ diff --git a/games/aground/data/core/animals/owl.xml b/games/aground/data/core/animals/owl.xml new file mode 100644 index 00000000..50a17c46 --- /dev/null +++ b/games/aground/data/core/animals/owl.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/games/aground/data/core/animals/rat.png b/games/aground/data/core/animals/rat.png new file mode 100644 index 00000000..2be81bf7 Binary files /dev/null and b/games/aground/data/core/animals/rat.png differ diff --git a/games/aground/data/core/animals/redbreast.png b/games/aground/data/core/animals/redbreast.png new file mode 100644 index 00000000..70496bd5 Binary files /dev/null and b/games/aground/data/core/animals/redbreast.png differ diff --git a/games/aground/data/core/animals/seagull.png b/games/aground/data/core/animals/seagull.png new file mode 100644 index 00000000..0fe49200 Binary files /dev/null and b/games/aground/data/core/animals/seagull.png differ diff --git a/games/aground/data/core/animals/wolf.png b/games/aground/data/core/animals/wolf.png new file mode 100644 index 00000000..ac267576 Binary files /dev/null and b/games/aground/data/core/animals/wolf.png differ diff --git a/games/aground/data/core/elements.xml b/games/aground/data/core/elements.xml new file mode 100644 index 00000000..2453a0a2 --- /dev/null +++ b/games/aground/data/core/elements.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/games/aground/data/core/enemies/adult_dragon.png b/games/aground/data/core/enemies/adult_dragon.png new file mode 100644 index 00000000..fc83f5a5 Binary files /dev/null and b/games/aground/data/core/enemies/adult_dragon.png differ diff --git a/games/aground/data/core/enemies/adult_dragon.xml b/games/aground/data/core/enemies/adult_dragon.xml new file mode 100644 index 00000000..6b70613a --- /dev/null +++ b/games/aground/data/core/enemies/adult_dragon.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/games/aground/data/core/enemies/boar.png b/games/aground/data/core/enemies/boar.png new file mode 100644 index 00000000..83437154 Binary files /dev/null and b/games/aground/data/core/enemies/boar.png differ diff --git a/games/aground/data/core/enemies/enemies.xml b/games/aground/data/core/enemies/enemies.xml new file mode 100644 index 00000000..1cdd6020 --- /dev/null +++ b/games/aground/data/core/enemies/enemies.xml @@ -0,0 +1,287 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
this.setHidden(true); this.alpha = 1;
+
+ +
+ this.setHidden(false); this.alpha = 0; + +
+ +
+
+ + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + + + +
\ No newline at end of file diff --git a/games/aground/data/core/enemies/explosion.png b/games/aground/data/core/enemies/explosion.png new file mode 100644 index 00000000..ecb13802 Binary files /dev/null and b/games/aground/data/core/enemies/explosion.png differ diff --git a/games/aground/data/core/enemies/explosion.xml b/games/aground/data/core/enemies/explosion.xml new file mode 100644 index 00000000..fcad37b9 --- /dev/null +++ b/games/aground/data/core/enemies/explosion.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/games/aground/data/core/enemies/fire.png b/games/aground/data/core/enemies/fire.png new file mode 100644 index 00000000..0a334ca1 Binary files /dev/null and b/games/aground/data/core/enemies/fire.png differ diff --git a/games/aground/data/core/enemies/fire_bird.png b/games/aground/data/core/enemies/fire_bird.png new file mode 100644 index 00000000..2776bddd Binary files /dev/null and b/games/aground/data/core/enemies/fire_bird.png differ diff --git a/games/aground/data/core/enemies/fire_boar.png b/games/aground/data/core/enemies/fire_boar.png new file mode 100644 index 00000000..99b55c71 Binary files /dev/null and b/games/aground/data/core/enemies/fire_boar.png differ diff --git a/games/aground/data/core/enemies/fireball_small.png b/games/aground/data/core/enemies/fireball_small.png new file mode 100644 index 00000000..2122852f Binary files /dev/null and b/games/aground/data/core/enemies/fireball_small.png differ diff --git a/games/aground/data/core/enemies/flame.png b/games/aground/data/core/enemies/flame.png new file mode 100644 index 00000000..dcb53f22 Binary files /dev/null and b/games/aground/data/core/enemies/flame.png differ diff --git a/games/aground/data/core/enemies/freeze.png b/games/aground/data/core/enemies/freeze.png new file mode 100644 index 00000000..db724310 Binary files /dev/null and b/games/aground/data/core/enemies/freeze.png differ diff --git a/games/aground/data/core/enemies/ghost.png b/games/aground/data/core/enemies/ghost.png new file mode 100644 index 00000000..13c35278 Binary files /dev/null and b/games/aground/data/core/enemies/ghost.png differ diff --git a/games/aground/data/core/enemies/golem.png b/games/aground/data/core/enemies/golem.png new file mode 100644 index 00000000..59e57c46 Binary files /dev/null and b/games/aground/data/core/enemies/golem.png differ diff --git a/games/aground/data/core/enemies/icy_wind.png b/games/aground/data/core/enemies/icy_wind.png new file mode 100644 index 00000000..02ec71de Binary files /dev/null and b/games/aground/data/core/enemies/icy_wind.png differ diff --git a/games/aground/data/core/enemies/shadow_cat.png b/games/aground/data/core/enemies/shadow_cat.png new file mode 100644 index 00000000..b8a2bb32 Binary files /dev/null and b/games/aground/data/core/enemies/shadow_cat.png differ diff --git a/games/aground/data/core/enemies/shadow_cat.xml b/games/aground/data/core/enemies/shadow_cat.xml new file mode 100644 index 00000000..95e88059 --- /dev/null +++ b/games/aground/data/core/enemies/shadow_cat.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/games/aground/data/core/enemies/smoke.png b/games/aground/data/core/enemies/smoke.png new file mode 100644 index 00000000..ebdabc87 Binary files /dev/null and b/games/aground/data/core/enemies/smoke.png differ diff --git a/games/aground/data/core/enemies/smoke.xml b/games/aground/data/core/enemies/smoke.xml new file mode 100644 index 00000000..1a840d3d --- /dev/null +++ b/games/aground/data/core/enemies/smoke.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/games/aground/data/core/enemies/snowball.png b/games/aground/data/core/enemies/snowball.png new file mode 100644 index 00000000..e75f6353 Binary files /dev/null and b/games/aground/data/core/enemies/snowball.png differ diff --git a/games/aground/data/core/enemies/spider.png b/games/aground/data/core/enemies/spider.png new file mode 100644 index 00000000..5ac18d15 Binary files /dev/null and b/games/aground/data/core/enemies/spider.png differ diff --git a/games/aground/data/core/enemies/spider.xml b/games/aground/data/core/enemies/spider.xml new file mode 100644 index 00000000..262b48ba --- /dev/null +++ b/games/aground/data/core/enemies/spider.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/games/aground/data/core/enemies/traps.png b/games/aground/data/core/enemies/traps.png new file mode 100644 index 00000000..9e5ac926 Binary files /dev/null and b/games/aground/data/core/enemies/traps.png differ diff --git a/games/aground/data/core/enemies/wyrm.png b/games/aground/data/core/enemies/wyrm.png new file mode 100644 index 00000000..701ea67d Binary files /dev/null and b/games/aground/data/core/enemies/wyrm.png differ diff --git a/games/aground/data/core/enemies/yeti.png b/games/aground/data/core/enemies/yeti.png new file mode 100644 index 00000000..ad17422a Binary files /dev/null and b/games/aground/data/core/enemies/yeti.png differ diff --git a/games/aground/data/core/enemies/yeti.xml b/games/aground/data/core/enemies/yeti.xml new file mode 100644 index 00000000..6443b766 --- /dev/null +++ b/games/aground/data/core/enemies/yeti.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/games/aground/data/core/enemies/young_dragon.png b/games/aground/data/core/enemies/young_dragon.png new file mode 100644 index 00000000..0d91dc2c Binary files /dev/null and b/games/aground/data/core/enemies/young_dragon.png differ diff --git a/games/aground/data/core/enemies/young_dragon.xml b/games/aground/data/core/enemies/young_dragon.xml new file mode 100644 index 00000000..596d92a6 --- /dev/null +++ b/games/aground/data/core/enemies/young_dragon.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/games/aground/data/core/farm/cotton.png b/games/aground/data/core/farm/cotton.png new file mode 100644 index 00000000..fd885be8 Binary files /dev/null and b/games/aground/data/core/farm/cotton.png differ diff --git a/games/aground/data/core/farm/farm.xml b/games/aground/data/core/farm/farm.xml new file mode 100644 index 00000000..e67d0734 --- /dev/null +++ b/games/aground/data/core/farm/farm.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/games/aground/data/core/farm/orchard.png b/games/aground/data/core/farm/orchard.png new file mode 100644 index 00000000..9d8a6ac2 Binary files /dev/null and b/games/aground/data/core/farm/orchard.png differ diff --git a/games/aground/data/core/farm/pumpkin.png b/games/aground/data/core/farm/pumpkin.png new file mode 100644 index 00000000..d8f59f3c Binary files /dev/null and b/games/aground/data/core/farm/pumpkin.png differ diff --git a/games/aground/data/core/farm/sugar.png b/games/aground/data/core/farm/sugar.png new file mode 100644 index 00000000..7bf907c1 Binary files /dev/null and b/games/aground/data/core/farm/sugar.png differ diff --git a/games/aground/data/core/farm/wheat.png b/games/aground/data/core/farm/wheat.png new file mode 100644 index 00000000..5a95cf04 Binary files /dev/null and b/games/aground/data/core/farm/wheat.png differ diff --git a/games/aground/data/core/items/armors.png b/games/aground/data/core/items/armors.png new file mode 100644 index 00000000..dbf8a9ef Binary files /dev/null and b/games/aground/data/core/items/armors.png differ diff --git a/games/aground/data/core/items/armors.xml b/games/aground/data/core/items/armors.xml new file mode 100644 index 00000000..0ffb688a --- /dev/null +++ b/games/aground/data/core/items/armors.xml @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/games/aground/data/core/items/arrows.png b/games/aground/data/core/items/arrows.png new file mode 100644 index 00000000..1b20b5c8 Binary files /dev/null and b/games/aground/data/core/items/arrows.png differ diff --git a/games/aground/data/core/items/backpacks.png b/games/aground/data/core/items/backpacks.png new file mode 100644 index 00000000..5c597470 Binary files /dev/null and b/games/aground/data/core/items/backpacks.png differ diff --git a/games/aground/data/core/items/backpacks.xml b/games/aground/data/core/items/backpacks.xml new file mode 100644 index 00000000..c9c76241 --- /dev/null +++ b/games/aground/data/core/items/backpacks.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/games/aground/data/core/items/blueprints.xml b/games/aground/data/core/items/blueprints.xml new file mode 100644 index 00000000..ed86325a --- /dev/null +++ b/games/aground/data/core/items/blueprints.xml @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + s = area.getStructure(makeRect(x-Tile.SIZE*4, tile_y, width*0.5+Tile.SIZE*4, Tile.SIZE)); + + + s = area.getStructure(makeRect(x+width*0.5, tile_y, width*0.5+Tile.SIZE*4, Tile.SIZE)); + + + + + + + + + + + + + + + + + + s = area.getStructure(makeRect(x-Tile.SIZE*6, tile_y, width*0.5+Tile.SIZE*6, Tile.SIZE)); + + + s = area.getStructure(makeRect(x+width*0.5, tile_y, width*0.5+Tile.SIZE*6, Tile.SIZE)); + + + + + + +
+ this.structure = getStructure('warehouse_flipped') +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/games/aground/data/core/items/campfire.png b/games/aground/data/core/items/campfire.png new file mode 100644 index 00000000..a6d49c19 Binary files /dev/null and b/games/aground/data/core/items/campfire.png differ diff --git a/games/aground/data/core/items/earth_armor.png b/games/aground/data/core/items/earth_armor.png new file mode 100644 index 00000000..b831c751 Binary files /dev/null and b/games/aground/data/core/items/earth_armor.png differ diff --git a/games/aground/data/core/items/earth_armor.xml b/games/aground/data/core/items/earth_armor.xml new file mode 100644 index 00000000..61ac8d3f --- /dev/null +++ b/games/aground/data/core/items/earth_armor.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/games/aground/data/core/items/equipment.xml b/games/aground/data/core/items/equipment.xml new file mode 100644 index 00000000..d1a9f828 --- /dev/null +++ b/games/aground/data/core/items/equipment.xml @@ -0,0 +1,288 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + var coins = player.getCoins(); var d = durability; if(coins > 10000) coins = 10000; + setDurability(0); player.addCoins(d-coins); setDurability(coins); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/games/aground/data/core/items/explosion.png b/games/aground/data/core/items/explosion.png new file mode 100644 index 00000000..3dc9e34f Binary files /dev/null and b/games/aground/data/core/items/explosion.png differ diff --git a/games/aground/data/core/items/fishing.png b/games/aground/data/core/items/fishing.png new file mode 100644 index 00000000..bea062f1 Binary files /dev/null and b/games/aground/data/core/items/fishing.png differ diff --git a/games/aground/data/core/items/fishing.xml b/games/aground/data/core/items/fishing.xml new file mode 100644 index 00000000..c62cd4a8 --- /dev/null +++ b/games/aground/data/core/items/fishing.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/games/aground/data/core/items/food.xml b/games/aground/data/core/items/food.xml new file mode 100644 index 00000000..1ff72c2b --- /dev/null +++ b/games/aground/data/core/items/food.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/games/aground/data/core/items/icons.png b/games/aground/data/core/items/icons.png new file mode 100644 index 00000000..06690846 Binary files /dev/null and b/games/aground/data/core/items/icons.png differ diff --git a/games/aground/data/core/items/icons.xml b/games/aground/data/core/items/icons.xml new file mode 100644 index 00000000..a555afa4 --- /dev/null +++ b/games/aground/data/core/items/icons.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/games/aground/data/core/items/items.png b/games/aground/data/core/items/items.png new file mode 100644 index 00000000..a739327a Binary files /dev/null and b/games/aground/data/core/items/items.png differ diff --git a/games/aground/data/core/items/items.xml b/games/aground/data/core/items/items.xml new file mode 100644 index 00000000..554db184 --- /dev/null +++ b/games/aground/data/core/items/items.xml @@ -0,0 +1,313 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + this.message=result; this.showMessage(this.message); + + + + + + + + + + + + + if(area.vehicle != null) area.vehicle.name="&"+result; else area.name=result; + + + + + + + this.showMessage(area.name) + this.hideMessage() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/games/aground/data/core/items/lantern.png b/games/aground/data/core/items/lantern.png new file mode 100644 index 00000000..440d22bf Binary files /dev/null and b/games/aground/data/core/items/lantern.png differ diff --git a/games/aground/data/core/items/rails.png b/games/aground/data/core/items/rails.png new file mode 100644 index 00000000..7ca7f1ef Binary files /dev/null and b/games/aground/data/core/items/rails.png differ diff --git a/games/aground/data/core/items/shadow_cape.png b/games/aground/data/core/items/shadow_cape.png new file mode 100644 index 00000000..111fb5cd Binary files /dev/null and b/games/aground/data/core/items/shadow_cape.png differ diff --git a/games/aground/data/core/items/snowman.png b/games/aground/data/core/items/snowman.png new file mode 100644 index 00000000..18b19c05 Binary files /dev/null and b/games/aground/data/core/items/snowman.png differ diff --git a/games/aground/data/core/items/torch.png b/games/aground/data/core/items/torch.png new file mode 100644 index 00000000..af39a489 Binary files /dev/null and b/games/aground/data/core/items/torch.png differ diff --git a/games/aground/data/core/items/weps.png b/games/aground/data/core/items/weps.png new file mode 100644 index 00000000..e65d53c5 Binary files /dev/null and b/games/aground/data/core/items/weps.png differ diff --git a/games/aground/data/core/items/weps.xml b/games/aground/data/core/items/weps.xml new file mode 100644 index 00000000..680a6c0d --- /dev/null +++ b/games/aground/data/core/items/weps.xml @@ -0,0 +1,270 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/games/aground/data/core/lang/en_US.xml b/games/aground/data/core/lang/en_US.xml new file mode 100644 index 00000000..ea768220 --- /dev/null +++ b/games/aground/data/core/lang/en_US.xml @@ -0,0 +1,1643 @@ + + +
+ Blocked! + {element} Resist! + {element} Effective! + Miss! + Dodged! + Critical Hit! + No Effect + Game Saved + Save Deleted + Save corrupted! This could be because the player is in an area that doesn't exist in this version. + Save incomplete - some objects/items/areas may be missing. This is usually because you are missing a mod or the save is from a different version of the game. + Fuel + Add Fuel + Add Rations + Add Feed + All + Equipment + Carry: + Health: + Stamina: + HP + DEF + Power + Oxygen + Ok + Cancel + Yes + No + Accept + Reject + Sell + Buy + How many would you like to throw away? + How many would you like to eat? + How many would you like to drink? + How many would you like to store? + How many would you like to retrieve? + How many would you like to cancel? + How many would you like to sell? + How many would you like to buy? + -- Ingredients -- + -- Repair Cost -- + -- Creates -- + {item} repaired. + Inventory + Quest Log + Hut + Smelter + Kitchen + Workshop + Storehouse + Dockhouse + Market + Powerline + Power Plant + Warehouse + Barn + Animal Pen + Harvest + Harvest All + Manage + Feed + Laboratory + Wyrm Pen + Factory + Synthesizer + Power per Hit: + Stamina per Hit: + Stamina per Use: + Move + New Game + Continue + Options + Exit + Community + Empty + < Empty Slot > + Corrupted Slot + Are you sure you wish to overwrite this slot? + None + Fields: + {item} placed. + Level Up! + Level: + Exp: + Select Item + Set Hotkey: + Retry + Title + Move All + Add Animal + Select Feed + How many would you like to use? + Select Fertilizer + Game Muted + Game Unmuted + {npc} added {count} {item} to the {storehouse} + Used {count} {item} to restore health + Used {count} {item} to restore stamina + Used {count} {item} to restore oxygen + Are you sure you wish to throw away all your {item}? They will be gone for good. + Set [item=sign] Message: + How many would you like to turn into {into}? + Collect Complete + Toggle [tile=sticky] Sticky Item + Set First Item + There's something on the line! + It got away! + Wait for it... + Pull now! + How many would you like to craft? + How many would you like to uncraft? + Coins + {item} has broken! + {item} will break soon! + Inventory Only + Include Storehouse + {item} is hungry! + {item} is not hungry. + Set {item} Name: + Recharge + Recharge Batteries + All batteries recharged! + Recharged as many batteries as possible. + Rations + Time + Feed {item} the following?{list} + Fuel {item} with the following?{list} + Repair {item} with the following?{list} + {item} is about to break! Use the following to fix?{list} + Uses + Enchantment + Cooldown + Durability + Damage + Capture + Capture Type + Spirits + Flight Height: + Dive Depth: + Knockback: + Fight + Run Away + Complete + Remove + Time Manipulator + What time would you like to make it (24-hour format)? + This is the end of the demo for the Magic Path. Would you like to save? + This is the end of the demo for the Science Path. Would you like to save? + Credits + Buy Game! + Reset + Climb Ashore + Don't ask again + [color=ff2222]ATTN![/color] Update {version} is now available! + Select a Direction:\n\n[key=left][key=up][key=down][key=right] + Random + Efficiency + Victory! + New Item Discovered! + +{count} More... + To build this structure, you need to move or remove overlapping structures. You can do this using [item=dismantle] from your inventory. + Are you sure you wish to delete this slot? + Cannot consume items until the [tile=stat.full] timer runs out! +
+
+ View Stats + Max Health + Max Stamina + Speed + Endurance + Attack + Range + Defense + Elemental Defense + Cut + Spirit + Mine + Weight + Evasion + Critical + Fishing + Mining Speed + Sight + Bargaining + Trapping + Oxygen + {mod} for {time}s + {mod} ({current}/{max}) +
+
+ How many hits you can take before dying. + How many actions you can take before losing health. + How fast you can move. + Lowers stamina cost for movement. + Increases damage for every melee attack. + Increases range for all ranged weapons. + Lowers damage when hit. + Increases damage when cutting trees. + Allows you to mine harder tiles. + Increases base carrying capacity. + Increases enemy miss chance. + Increases melee critical hit chance. + Makes catching difficult fish easier. + Allows you to mine tiles faster. + Reveals more tiles when moving and mining. + Increases the sell cost of items. + Increases catch rate for nets. + Increases how long you can survive without breathing. +
+
+ Allocate Skill Points + Skill Points + [color=770000]Skill Maxed +
+
+ Discard + Place + Use + Craft + Equip + Unequip + Fire + Eat + Loot Corpse + Feed + Feed All + Fuel All + Repair All + Collect + Open + Carve + Switch + Transform + Repair + Rename + Fill + Synthesize + Enchant + Set Projectile + Enrage + Are you sure you want to enrage your [item=adult_dragon]? It'll become permanently hostile towards you. + Enable Attack + Disable Attack + Enable Flight + Disable Flight + Summon + Uncraft + Set Time + Reset Skills + Build + Upgrade + Plant + Combine Coins +
+
+ Wood + Coal + Iron Ore + Quartz + Gold Ore + Diamond + Sulfur + Raw Oil + Titanium + Uranium + Iron Bar + Steel Bar + Gold Bar + Meat + Apples + Wheat + Eggs + Milk + Sugar + Steak + Bread + Pie + Pancakes + Hamburger + Cheese + Pizza + Omelette + Cheeseburger + Cake + Candy Apple + Dragonblood + Stone Axe + Stone Pick + Broken Pick + Coin Purse + Iron Pick + Iron Sword + Iron Armor + Steel Pick + Steel Sword + Steel Armor + Great Armor + Bow + Recurve Bow + Arrow + Ice Arrow + Fire Arrow + Water Arrow + Drain Arrow + Backpack + Super Pack + Ultra Pack + Magic Pick + Magic Sword + Magic Pack + Magic Box + Cloth + Net + Berries + Red Berries + Ice Berries + Health Potion + Stamina Potion + Attack Potion + Defense Potion + Speed Potion + Endurance Potion + Rat + Pig + Wyrm + Cocoon + Baby Dragon + Young Dragon + Adult Dragon + Cockatiel + Tame Wolf + Cat + Boat + Fence + Torch + Trap + Workbench + Steel Workbench + Anvil + Chest + Jack O' Lantern + Sign + Name Plate + Rusty Axe + Cotton + Pumpkin + Chicken + Cow + Fishing Rod + Toothfish + Rockfish + Coral Cod + Fertilizer + Icy Fur + Shadow Fur + Fire Gem + Water Gem + Earth Gem + Ice Gem + Plant Gem + Buckler + Kite Shield + Enchanted Shield + Snowman + Ancient Axe + Fire Tusk + Silicon + Refined Oil + Battery + Drill + Revolver + Shotgun + Bullet + Ice Bullet + Fire Bullet + Water Bullet + Drain Bullet + Shell + Tank Shell + Ice Shell + Fire Shell + Water Shell + Drain Shell + Chainsaw + Fire Chainsaw + Ice Chainsaw + Water Chainsaw + Plant Chainsaw + Drain Chainsaw + Minecart + Rail + Map + Shovel + Crowbar + Landmine + Alter Gem + Focus Gem + Spirit Gem + Blood Gem + Baby Cannon + Dragonflame + Wyrm Drill + Dragon Armor + Ice Sword + Fire Sword + Water Sword + Plant Sword + Drain Sword + Ice Axe + Fire Axe + Water Axe + Plant Axe + Drain Axe + Spirit Goggles + Furnace + Campfire + Bandage + Tent + Dragon Sword + Silk + Lantern + Headlamp + Plant Eye + Plant Bag + Jetpack + Shadow Cape + Golem + Gold Golem + Amethyst Golem + Earth Armor + Earth Helm + Earth Hammer + Diode Wolf + Mecha Wyrm + Cyborg Body + Cyborg Back + Cyborg Eye + Machine Gun Arm + Electric Eel + Horn + Ice Shield + Ice Heart + Owl + Dismantle + Hut Blueprint + Storehouse Blueprint + Kitchen Blueprint + Kitchen Upgrade + Smelter Blueprint + Workshop Blueprint + Barn Blueprint + Pen Blueprint + Laboratory Blueprint + Wyrm Pen Blueprint + Dock Blueprint + Warehouse Blueprint + Wheat Seeds + Apple Seeds + Sugar Seeds + Cotton Seeds + Pumpkin Seeds + Tree Seed + Conifer Seed + Bush Seed + Red Bush Seed + Ice Bush Seed + Helium Sac + Steel Axe + Steel Hammer + Spider + Hide Slot + Spirit Detector + Power Plant Blueprint + Factory Blueprint + Elevator Blueprint + Powerline Blueprint + Purple Tree Seed +
+
+ Sail the World. + Keeps enemies out. + Smelts ore. + Cooks [item=steak]. + Contains everything. + Crafts items. + Repairs items. + Freezes enemies. + Burn + Health Drain + Health Decay + Transforms items. + Fills holes. + Pries up rails, cables and ladders. + Stores items. + Shows message. + Reveals spirits. + Rests and restores [tile=stamina] [color=006600]Stamina[/color]. + Spawns {item}. + Lights surroundings when equipped. + {value} per second. + {value} per sec in daylight. + {value} per sec in darkness. + {value} per sec daytime. + {value} per sec night. + {value} per sec injured. + {value} per sec when not full. + {value} per sec when full. + Hides the wearer. + Always gets a critical hit. + Max Weight + Reflect Damage + Fires {projectile}s + Hatches in [color=770000]Wyrm Pen[/color]. + Builds + Upgrades + Breaks down structures you have a [tile=blueprint.ico] [color=770000]Blueprint[/color] for. + Collects nearby items. + Plants + Plant Cost + Place Cost + Can rename islands when placed. + Equip On + Can be used underwater. + Passes through tiles. + Fires in front and behind. + Resists Elemental Attacks + Pierces through enemies. + Does not kill (stops at 1hp). + Detects nearby life sources. + Flying + Swimming + Builds blueprints on hit. + Allows you to see further when equipped. +
+
+ Shelter + Instant Meat + Infinite Space + Sharecropping + Apples + Metallurgy + Bon Appetit + Heavy Lifter + Crafting Time + Wyrmslayer + Rockslayer + Shiny + A Good Trade + Heavier Lifter + Get Wyrm + Milking Pigs + Mmm, Cheese + Distant Shores + Setting Sail + Experiments + Infinite Blood + Hatchling + Power Up + Industrialize + Going Up? + Justice + Shocking + Human Testing + The Full Story + Charging Up + Cyborgification + Taurus + Dragon Tamer + Queenslayer + Synthetic Steak + Forging Ahead + Techno Mage + Elementary + Whomp + Dragon Master + Rewind + Face the Enemy + Building My Way + Powering Up + Statue Smasher +
+
+ Repair the [color=ff2222]Hut[/color]. + Defeat a [color=ff2222]Boar[/color]. + Build the [color=ff2222]Storehouse[/color]. + Build the [color=ff2222]Farm[/color]. + Add an [color=ff2222]Orchard[/color] to the [color=ff2222]Farm[/color]. + Build the [color=ff2222]Smelter[/color]. + Build the [color=ff2222]Kitchen[/color]. + Get the [color=ff2222]Backpack[/color]. + Build the [color=ff2222]Workshop[/color]. + Defeat a [color=ff2222]Wyrm[/color]. + Defeat a [color=ff2222]Golem[/color]. + Mine a [color=ff2222]Diamond[/color]. + Build the [color=ff2222]Market[/color]. + Buy a [color=ff2222]Super Pack[/color]. + Now what do I do with it? + Add a [color=ff2222]Pen[/color] to the [color=ff2222]Farm[/color]. + Cook a [color=ff2222]Pizza[/color]. + Build the [color=ff2222]Dock[/color]. + Build a [color=ff2222]Boat[/color]. + Build the [color=ff2222]Laboratory[/color]. + Build the [color=ff2222]Wyrm Pen[/color]. + Hatch a [color=ff2222]Dragon[/color] from a [color=ff2222]Cocoon[/color]. + Build the [color=ff2222]Power Plant[/color]. + Build the [color=ff2222]Factory[/color]. + Build the [color=ff2222]Elevator[/color]. + Solve the [color=ff2222]Bandit[/color] problem. + Defeat a [color=ff2222]Diode Wolf[/color]. + Successfully Confront the Mirrows. + Read all the Logs. + Catch an [color=ff2222]Electric Eel[/color]. + Install a full set of Cyborg gear. + Complete the Minotaur Maze. + Fly on a [color=ff2222]Dragon[/color]. + Defeat the [color=ff2222]Wyrm Queen[/color]. + Activate the [color=ff2222]Synthesizer[/color]. + Activate the [color=ff2222]Forge[/color]. + Enchant a [color=ff2222]Chainsaw[/color]. + Capture a spirit of every element. + Chop down a [color=ff2222]Purple Tree[/color]. + Obtain a full set of dragon equipment. + Activate the [color=ff2222]Time Manipulator[/color]. + Defeat the [color=ff2222]Old One[/color]. + Build a structure with a [color=ff2222]Blueprint[/color]. + Upgrade your character with 500 or more [color=ff2222]Skill Points[/color]. + Defeat the [color=ff2222]Golemech[/color]. +
+
+ Wheat Field + Orchard + Sugar Field + Cotton Field + Pumpkin Field + Expand Farm + Build Pen + Pen + -- Produces -- + -- Slots -- + Change Crop + Fertilizer + There is something missing that's needed to activate this. + Hmm, nothing of interest here. + Found some [item=pumpkin_seed]! + Sail Boat + Manage Storage + Elevator + The [tile=boat.ico] Boat is too heavy to sail! + Rest in Boat + Would you like to use a {item} to activate this structure? + The pillar reveals this enchantment:\n{enchant} + {items} = {creates}. + The enchantment recipe has been added to the [color=770000]Forge[/color]. + Requires {item} in this lair. + The structure's power is all being drawn into that statue... + Build Golemech + Would you like to build a {structure} for the following resources? + Would you like to dismantle the {structure} for the following resources? + Would you like to plant {structure} for the following resources? + Would you like to place {structure} for the following resources? + Dragon in Lair: + Change Appearance + Activate the Forge. + Activate the Synthesizer. +
+
+ Rest in Hut + Enter Storehouse + Craft in Workshop + Smelt Ores + Cook in Kitchen + Enter Farm + Trade with Foodseller + Trade with Weapon Dealer + Trade with Ore Merchant + Enter Dockhouse + Enter Boat + Mix Potions + Manage Pen + Manage Cage + Summon Alchemist + Raise Dragons + Raise into {into} + Fly Dragon + Activate + Enter + Rest in Tent + Search + Operate Power Plant + Enter Inn + Call Elevator + Enter Warehouse + Operate Factory + Disables Golem Factory + Alert: Uncontrollable. + Read + Operate + Operate on Self + Operate on Animal + Tend Crop + Manage Pen + Summon Boat + Summon Dragon +
+
+ Pick Berries + Chop Tree + Attack + Collect {item} + Open {item} + Harvest {item} + Use {item} +
+
+ Dominant Hand: + Offhand: + Mining: + Armor: + Headgear: + Backpack: + Familiar: + Weapon: + Engine: + Select a vanity item to change your appearance without changing your actual equipment. + You cannot set a vanity item for this slot. +
+
+ Caught! + Broken! + Almost! +
+
+ Over Carrying Capacity! + Out of Stamina, Losing Health! + Out of Oxygen, Losing Health! + Below Dive Depth, Losing Health! + Still Growing! Come back later. + No addition slots remaining! + Too damaged to use! + Click for Focus + You do not have enough ingredients. + You cannot place this object below the surface. + You cannot place objects on top of objects. + You must dig out a bigger area to place this object. + You cannot place that here! + You cannot use that here! + You cannot place that this high up. + This structure cannot be built below the surface. + This structure cannot be built underwater. + This structure must be built on water. + You must dig out a bigger area to build this structure. + You cannot build structures on top of structures or crops. + This structure must be built next to a {structure}. + This structure must be built to the left of a {structure}. + This structure must be built to the right of a {structure}. + This structure must be built next to an empty coast. + You cannot build this structure inside a vehicle. + You cannot plant on top of structures or crops. + You can only plant on fertile grass tiles. + You must place this entirely in a single room. + It won't have any effect. + Would you like to throw them away instead? + Cannot fire {projectile} without {weapon}. + Cannot fire {weapon}: out of {projectile}s. + You cannot add any more items! + You cannot add any more fuel! + It is already fully repaired! + You cannot add any more rations! + You cannot add any more feed! + You cannot hold any more coins! + Something went wrong! Would you like to send a bug report? + There is no power! + Not enough battery power! + Not enough rations! + Not enough fuel! + There is no {item} here. + The {item} is too hungry to make the journey! + You cannot fill this tile! + The core game failed to load. This usually means you are missing files, re-download and extract the entire contents of the zip archive into a folder. + The core game failed to load. This usually means you are missing files, try Shift+Refresh to do a hard reload of the page. + This is incomplete. You'll have to wait for a future update. + You can't do that while flying! + You can't sleep underwater! + You can't sleep while riding a vehicle! + You are too heavy to fly with {item}! + You are too overweight to move! + You cannot equip {item}. + There is no structure here to dismantle. + There is no structure here to upgrade. + You do not have a blueprint for this structure. + You can only build one of this structure per island. + You cannot do that while riding in a vehicle. + You cannot do that while swimming. + Do you want to remove the {item}? It will be gone for good and you will have to re-install it at the surgery lab if you want it back. + Not enough {item}! + You do not have enough skill points remaining to increase this skill! + You already have that blueprint! + Are you sure you wish to remove this item? All progress will be cancelled. + You cannot add any more items! + You must wait for the attack to cooldown before you can use it again. +
+
+ Closed for the night. + We should be getting some new stock soon! + I can't believe the [color=770000]Power Plant[/color] isn't working! How can I do business like this? +
+
+ New Quest! + You have no quests at this time. + ??? + -- Requirements -- + -- Complete -- + Repair Hut + Build Storehouse + Build Storehouse + Craft Smelter + Craft Workshop + Build Kitchen + Upgrade Kitchen + Build Farm + Apple Seeds + Build Market + Build Market + Build Dock + Build Dock + Build Pig Pen + Build Boat + Magic Materials + Wyrm Pen + Hatch Dragons + Magical Axe + Hunting Boars + Perimeter + Wolf Pup + Fix Power Plant + Build Factory + Build Elevator + Confront Mirrows + Convince Mirrows + Finding Peri + Defeat Bandits + Defeat Boars + Wyrm Hive + Find Wyrm Hive + Spirit Power + Wyrm Research + Magical Energy + Laying Rails +
+
+ Repair the incomplete [color=550000]Hut[/color] to shelter from the storm. + wants to build a [color=550000]Storehouse[/color]. + Build a [color=550000]Storehouse[/color] to store all your items. + wants a [color=550000]Smelter[/color] to refine ores. + wants a [color=550000]Workshop[/color] to create metal tools. + wants to build a [color=550000]Kitchen[/color] to cook food. + wants the [color=550000]Kitchen[/color] to make [item=cheese]. + wants to build a [color=550000]Farm[/color] to grow crops. + wants to use [item=fruit] to plant an [color=550000]Orchard[/color]. + wants to build a [color=550000]Market[/color] to trade goods. + Build a [color=550000]Market[/color] to attract traders to your [color=550000]Dock[/color]. + wants a [color=550000]Dock[/color] to travel the world. + Build a [color=550000]Dock[/color] to find other survivors. + wants to add a [color=550000]Pen[/color] to house livestock. + It's time to sail the world! Build a [tile=boat.ico] Boat at the [color=550000]Dockhouse[/color]. + wants you to slay a [item=wyrm] to gain [item=dragonblood]. + wants to experiment on [item=wyrm]s. + Hatch [item=dragon]s to win the [item=adult_dragon] to your side. + wants to fix the [item=rusty_axe]. + wants you to practice using weapons. + wants to add [item=fence]s to the settlement. + wants to tame the wolf pup. + needs [item=titanium] to fix the [color=550000]Power Plant[/color]. + wants to build a [color=550000]Factory[/color] to tinker with machines. + wants to build an [color=550000]Elevator[/color] to haul ore. + wants you to negotiate with the Mirrows for him. + wants you to find something special to sway the Mirrows. + wants you to find his [item=cat] who likes [item=toothfish]. + Merchants want you to defeat bandits stealing their wares. + wants you to find the secrets of the [item=wyrm]s. + wants you to use [item=spirit_gem]s to catch spirits. + needs more help to finish his [item=wyrm] research! + wants to find the source of the magical energy spikes. + wants to set up a [item=minecart] to make mining easier. +
+
+ Dismount + Vehicle + Move up to fly. + The vehicle is too heavy to move! + Manage Items + Manage Self + Charge from Batteries + [color=770000]TIP:[/color] When riding a vehicle or animal, you can hit [key=equipment] to see details about what you're riding, and feed or fuel it. + This vehicle cannot fly any higher! + Deploy + Pack Up + If you pack up the boat now, you'll end up swimming with the fishes! + Unable to operate vehicle: another player is already operating it! +
+
+ Talk + Grab + Builder + Miner + Farmer + Trader + Alchemist + Hunter + Mechanic + Innkeeper + Fisherman +
+
+ You really expect to be able to survive here? It’s hopeless, man. + You’re good at building right? What if we built something to store the resources and food we gather? + Hmph. I guess with [var=quest.storehouse.wood] [item=wood] and [var=quest.storehouse.berries] [item=berries] I might be able to make a decent [color=770000]Storehouse[/color]. + Alright! I can find that, no problem. + Take this [item=stone_axe], if you’re so gung-ho. + I'm exhausted. You look tired too. We should rest in the [color=770000]Hut[/color] to save the game and restore our [tile=stamina] [color=006600]Stamina[/color]. + How's my old [item=stone_axe]? I bet it could chop down a tree by hitting [key=attack] next to one. + All items go into your inventory when you collect them. You can check it by hitting [key=inventory]. + If your [tile=stamina] [color=006600]Stamina[/color] runs out, you will lose [tile=health] [color=770000]Health[/color], and if your [tile=health] [color=770000]Health[/color] runs out, you will die. + That's why you need to eat a lot of [item=berries], [item=fruit] and [item=meat]. You can do this by selecting them in your inventory. + You gathered everything already? I’m impressed. + Let’s get this [color=770000]Storehouse[/color] built! + Look at that! Don’t you feel accomplished? + Yeah… actually, this will be useful. Now we can avoid getting tired from carrying too much. + We can quickly drop off all that extra weight by using the Move All buttons, and use [key=quest] to toggle starred items - starred items will stay in your inventory when you hit Move All. + We should make a deal with the [object=farmer], I bet he could help us grow some tasty food. + Did you see that [object=miner] emerge from underground? You should see what she wants. + What do you think of building a [color=770000]Kitchen[/color]? [item=meat] is good, but it’s even better cooked. + I'll need [var=quest.kitchen.wood] [item=wood] and [var=quest.kitchen.coal] [item=coal] to build the [color=770000]Kitchen[/color]. + Looks like you have everything I need. Let's get this [color=770000]Kitchen[/color] built! + You can cook food at the [color=770000]Kitchen[/color] as long as you have [item=wood] or [item=coal] to fuel it. + You know what I’m craving? Some [item=cheese]. Nothing is quite as delicious. + I could upgrade the [color=770000]Kitchen[/color] to make [item=cheese] and cook new recipes for [var=quest.kitchen2.wood] [item=wood] and [var=quest.kitchen2.steel_bar] [item=steel_bar]s. + What happened to my beautiful [color=770000]Kitchen[/color]? You better build a new one ASAP! You can build it using a [item=kitchen_blueprint]. + Looks like you have everything I need. Let's get this [color=770000]Kitchen[/color] upgraded! + Try out some of the new recipes! It almost feels civilized! + Man, I'm hungry. I hope you get that [color=770000]Farm[/color] finished soon! +
+
+ Boy am I glad to see you. Here I was thinkin’ I was all alone, just one old man in an empty world. + I still got some life in these old bones and I reckon I could help you out. Farming’s my trade, and we all need some good food to keep us going. + How about we build a barn and get a [color=770000]Farm[/color] up and runnin’? + Nice! I'll put up the barn and plant some [item=wheat_seed]! + Now we have a [color=770000]Farm[/color]! Stop by on occasion to pick up growin' crops - they will help restore your [tile=stamina] [color=006600]Stamina[/color]. Here - take some [item=bread] to keep you going while it grows. + You can get [item=wood] by chopping down trees. + If you want to grow more, simply plant more seeds! You can also manage and remove existing crops at the barn! + Look at our awesome [color=770000]Farm[/color]! It's as good as anything I used to grow back home! But if you want to grow more, I can always make more seeds. + Raw [item=wheat] isn’t very tasty, but I bet we could make something better if you and the [object=builder] made a [color=770000]Kitchen[/color]. + You know what this [color=770000]Farm[/color] needs? Some Livestock! How about capturing some [color=770000][tile=boar] Boars[/color] with a [item=net]? + I’ll add a [color=770000]Pen[/color] for [var=quest.pen.pig] [item=pig]s and [var=quest.pen.wood] [item=wood]. + Now aren't those the fattest and juiciest looking [item=pig]s you've ever seen? + With the pen, we can now produce [item=meat] and [item=milk]! + If you want to build more [color=770000]Pen[/color]s, use the [item=pen_blueprint]. + How do you get a [item=pig]? Lay a [item=net] on the ground and then lure a wounded [color=770000][tile=boar] Boar[/color] onto it, and if you're lucky, it’ll be caught and domesticated! + Milking a [item=pig]? Why not? This is a strange land. But what we could really use is some [item=cheese] - talk to the [object=builder] about improving the [color=770000]Kitchen[/color]. + I hope you don't mind, but I did a little decoratin' for the Harvest Festival! We could use a little celebrating around here. I also put some [item=jakolantern]s in the [color=770000]Storehouse[/color]. + This farm is getting pretty big! To celebrate I found some [item=sugar_seed]! Try planting a field of [item=sugar]! + I met a few traders by the [color=770000]Dock[/color] and got some [item=cotton_seed]! + There are a lot of [item=fruit] around here. With enough seeds, I could probably plant a nice [color=770000]Orchard[/color]! + Great, with this many [item=fruit] we have enough [item=orchard_seed] to plant an [color=770000]Orchard[/color]! + Let me know when you have enough [item=fruit] for the [color=770000]Orchard[/color]! + Seeds can be planted on grass tiles as long as there is enough empty space to place them. Let me know where you want to plant the [item=orchard_seed]! + You can also use seeds to change crops in the [color=770000]Barn[/color]. If you want to make new seeds, just let me know! + The first snowfall is here! That makes it as good a time as any to celebrate! I even made a magic [item=snowman] from [item=ice_berries], I hope you like it! + This place is starting to feel like home, ain't it? How about giving the place a name? + Use this here [item=area_name_sign] to change the name of this island! +
+
+ Oh, hey. Didn’t realize there were other survivors. + I’ve been underground - there’s way more to this place than meets the eye. + I’ve got an extra pickaxe if you want to check it out too. + How's the digging going? Maybe we should build a [color=770000]Smelter[/color] to melt down ores into bars. + Great! Let me know when you have enough [item=coal]! + This is the stuff. I should have a [color=770000]Smelter[/color] up in no time! + The [color=770000]Smelter[/color] can turn raw ores into bars. It requires fuel to melt them down, but luckily there is plenty of [item=coal] around to keep it running. + Well, what are you waiting for? Just hold [key=down] to dig down and find those ores! + Ore is heavy - make sure to drop them off in the [color=770000]Storehouse[/color] between trips. + It’s easy to get caught up mining, but make sure you have enough [tile=stamina] [color=006600]Stamina[/color] for the return trip. + The deeper underground you go, the better ores you will find. + If you plan on mining deep underground, make sure to bring [item=torch]es with you. They'll provide light when equipped, but will eventually burn out. + I can make [item=torch]es if you need some. + How about a [color=770000]Workshop[/color] to turn those metal bars into tools? I can make one for [var=quest.workshop.iron_bar] [item=iron_bar]s and [var=quest.workshop.wood] [item=wood]. + Alright, let's get this [color=770000]Workshop[/color] set up! + At the [color=770000]Workshop[/color], you can instantly create any tools or items that you have the ingredients to make. + You'll need to find [item=iron] to smelt into [item=iron_bar] at the [color=770000]Smelter[/color]. + [item=iron] is pretty deep underground, so take a [item=torch] to help you see. If this one burns out, talk to me and I can make more. + Once you have enough [item=iron], select [item=iron_bar] from the [color=770000]Smelter[/color] menu, and it will automatically smelt as long as there is fuel remaining. + You can add as many jobs to the [color=770000]Smelter[/color] as you have ingredients for, and it will smelt them one by one while you are away as long as it has fuel. + If you want to mine through [color=770000][tile=stone] Stone[/color] to reach [item=gold], you'll need to craft an [item=iron_pickaxe] or a [item=steel_pickaxe] at the [color=770000]Workshop[/color]. + If you want to mine through [color=770000][tile=stone] Stone[/color] to reach [item=gold], you'll need to equip an [item=iron_pickaxe] or a [item=steel_pickaxe]. Hit [key=equipment] to manage your equipment. + You can manage your equipment and pickaxes by hitting [key=equipment] to open the Equipment window. + You can also use [color=770000]Hotkeys[/color] now.\nHit [key=hotkey1], [key=hotkey2], [key=hotkey3] or [key=hotkey4] in the inventory window to set them. + One thing every miner needs is a good [item=minecart] and [item=rail] system! Ores are heavy, and having a way to easily transport them to the [color=770000]Storehouse[/color] would be amazing. + You built a [item=minecart] and [item=rail]s? Perfect, let's place them right away! + Here, I placed the [item=minecart] and a small [item=rail] system! You can expand it and move [item=rail]s using a [item=crowbar] to pry them up! +
+
+ A [item={item}] was stolen from the [color=770000]Storehouse[/color]! + The thief was caught red-handed! + It's hard enough surviving here without someone stealing our stuff! + I might have borrowed a few things. But, listen. I’ll repay you by offering my services. I have connections with many traders on other islands. + Traders? There are more survivors out there? + Yup. But I’ll need [var=quest.market.gold_bar] [item=gold_bar]s to convince them to come here. + You’re going to charge us when you were just caught stealing?! + That was that. This is business. My offer is [var=quest.market.gold_bar] [item=gold_bar]s to add this island to the trade route. + Fine. If there are other survivors out there, trading with them could get us off this island. + I’m sorry, I can’t trust a thief. Leave this island, and never come back. + There are better islands to steal from anyways. You don’t even know what you’re missing. + Perfect! I feel this is the beginning of many lucrative trades between us. + Take this [item=coin_purse]. You’ll need it to store coins for buying and selling. I recommend buying a [item=mega_backpack] as soon as you can, they are a real life-saver! + At the [color=770000]Market[/color], you can sell goods to get coins, which you can use to buy other goods. + The [color=770000]Market[/color] sometimes gets new stock too, so if you can't get what you want or they run out of inventory, check back later. + To make a [item=gold_bar], you'll need to smelt [item=gold], which is found deep underground. The [object=miner] may have some tips for mining that deep. + Are you interested in seeing the rest of the world? How about building a [color=770000]Dock[/color]? + I’ll build it for you if you give me [var=quest.dock.coins] [color=770000][tile=coin_purse.ico] Coins[/color], [var=quest.dock.wood] [item=wood], [var=quest.dock.cloth] [item=cloth] and [var=quest.dock.net] [item=net]s. + Excellent, let's get this [color=770000]Dock[/color] built! + Once you build a [tile=boat.ico] Boat at the [color=770000]Dockhouse[/color], you'll be ready to travel across the sea! + The [color=770000]Dock[/color] costs [var=quest.dock.coins] [color=770000][tile=coin_purse.ico] Coins[/color], [var=quest.dock.wood] [item=wood], [var=quest.dock.cloth] [item=cloth] and [var=quest.dock.net] [item=net]s. + Accept Offer + Send Away + Isn't it a beautiful day for sailing? + Someone stole everything! All my hard work! Who would do such a thing?! + Now that you have items spread across multiple islands, wouldn't it be nice to be able to transfer them from storehouse to storehouse? With my new shipping service, you can - for a small fee! + What island would you like to ship items from? + I can ship items from [color=770000]{area}[/color] for 0.20 [color=770000][tile=coin_purse.ico] Coins[/color] per weight. Let me know what items you want me to ship: + What island would you like to ship the selected items to for {coins} [color=770000][tile=coin_purse.ico] Coins[/color]? + The items are on their way - you should see them there the next time you visit. Let me know if there are any other items you'd like to ship, and a pleasure doing business with you! +
+
+ There is more to this planet than meets the eye. I have been doing experiments, and I believe I have discovered magic! + I am in need of more materials. If you come across a [item=wyrm], slay it and give me its [item=dragonblood] and I will make sure you are rewarded. + I knew it! This is the secret! I must set up a laboratory immediately! + Your reward? Bring materials to my lab and I will mix up a magic potion for you. + Hurry up! My research is at a standstill until I get some [item=dragonblood]! + I need more [item=dragonblood]! Bring me [var=quest.wyrm_pen.wyrm] live [item=wyrm]s and we'll have an endless supply of [item=dragonblood] to experiment with! + Excellent! Stand back while I work my magic! + Behold my brilliant invention - the [color=770000]Wyrm Pen[/color]! It's more than just a pen, it's an endless supply of [item=dragonblood]! + I bet you could capture a [item=wyrm] with a [item=net] if it was heavily wounded. But you must catch it alive! + We must experiment more on the [item=wyrm]s! What do they eat? Why do they give [item=dragonblood]? You must feed the [item=wyrm]s in the [color=770000]Wyrm Pen[/color] to find out more about their evolution! + I knew it! The [item=wyrm]s metamorphosize into [item=dragon]s! But then why are there so few [item=adult_dragon]s in this land? + I believe there is a dragon lair somewhere in the mountain. If you find it, summon me... perhaps some of these secrets can be discovered there. + Ah, an [item=adult_dragon]! Let's see what she has to say - I can translate for you with a simple spell. + Who are you, to awaken me from my slumber? + I am a seeker of truth and magic. Tell me - why are there so few dragons left in this world? + Because the old ones left. They too were seekers of truth and magic. And they betrayed my kind. + Then perhaps we can help you! All we ask for in return is knowledge. + You think you can help? Then prove it. If you can hatch and bring me [var=quest.hatch_dragons.dragon] [item=dragon]s, then we will talk. Otherwise, begone! + I knew you would betray me! Taste my wrath! + I don't think we should wake her again until we have the [item=dragon]s. + You have done it? Perhaps there is yet hope for my race. + Excellent! So, you'll tell us the secrets of magic? + Unfortunately, I do not know the secrets you seek. The old ones created us, and they built this lair to raise us. + However, answers may lie on the islands to the east. Return to this lair when you are ready, and I will fly you there. + Another dragon lair! Imagine how many dragons were once raised in lairs like these with magic! I wonder why... in any case, allow me to activate this lair. + I also built a [color=770000]Wyrm Pen[/color] here, in case we need to raise more dragons! But don't expect me to harvest [item=dragonblood] here, I've got more important things to research. + Where did you leave the dragon? I'll call it over here - try not to lose track of it. + I knew it! This lair is artificial, made by magic! It looks like its purpose was to raise dragons! + I bet I can activate it... + Aha! Done! With this lair, we can raise our own dragons. The lair seems to point east, perhaps we could fly a dragon that direction and discover more... + Let me see that [item=rusty_axe]... It's tough to spot with all the rust, but I recognize those symbols! + There is some ancient magic here, but it is worn out. If you bring me the right magical ingredient, perhaps I can repair it... + That [item=fire_tusk]... what kind of creature did you get it from? It seems to resonate with the [item=rusty_axe], perhaps that is the magical ingredient we were looking for! + I have done it! I wonder who made this [item=thunder_axe], and how old it is? If you want to make more, I added the recipe to the laboratory. + Let me see that [item=dark_fur]! It appears to exist between the world of the spirits and the world of the living... + I'll have to research it further, but I can easily turn it into a [item=shadow_cape] that will hide you from normal eyes. I added the recipe to the laboratory. + This island is overflowing with magic - we are definitely in the right place! + I’ve seen this kind of magic before. These structures are partially organic and are all hibernating. They’ll need to be awoken. + I already know how to activate this purple chamber, but the other structures will require more study. + This should be a good base of operations. I'll set up some supplies. + Clues for activating the other structures might lie with the [item=wyrm]s. + You should follow one on this island and learn their secrets, while I translate some of these markings. + Don't worry - you've dealt with [item=wyrm]s before. Following one to its den should be no problem! + What's that? There was a Wyrm Queen? That's irrelevant, look at the [item=spirit_gem] you found! I'm certain this is what we need to make a breakthrough! + Here, try these [item=goggles]. The markings helped me invent them, and while they didn't help me see the secret behind these structures, they may help you see what we are missing. + You should follow the [item=wyrm]s on the eastern island, not here! I've already studied the [item=wyrm]s here! + I need more time to study this. Why don't you rest in the purple chamber? + That forest to the east feels dangerous. I set up a [item=fence], and I recommend you don't go beyond it. + I have determined that a [item=spirit_gem] can capture a spirit of fire or water, resulting in a [item=fire_gem] or [item=water_gem]. The infused gems should allow us to activate the structures. + Having trouble finding elemental spirits? They are invisible to the naked eye, but my [item=goggles] should reveal them! + You can place [item=spirit_gem]s like traps, then capture spirits by luring them onto them! + Now all the structures are activated! I think we deserve a break in the purple chamber before we continue our research! + What are you waiting for? Use the [item=water_gem] at the blue structure to activate it! + The blue structure is a magical synthesizer! It can create items from magic! + Use [item=focus_gem]s to power the synthesizer. + We still need a [item=water_gem] to power the blue structure! Use a [item=spirit_gem] to capture a water elemental! + What are you waiting for? Use the [item=fire_gem] at the red structure to activate it! + The red structure is some sort of ancient magical forge. It can enchant items! + Try experimenting with different combinations of items and magical ingredients at the Forge - you may stumble upon something brilliant! + We still need a [item=fire_gem] to power the red structure! Use a [item=spirit_gem] to capture a fire elemental! + I’ve been in deep contemplation, trying to decode the secrets of the [item=wyrm]s. + If you bring me [var=quest.alter_gem.wyrm] [item=wyrm], [var=quest.alter_gem.fire_tusk] [item=fire_tusk] and [var=quest.alter_gem.yeti_fur] [item=yeti_fur], I will be able to finish my research. + I have done it! I have created an [item=alter_gem]! This will allow us to transform [item=wyrm]s - and probably other creatures - into usable equipment! + We must continue to explore this branch of magic! Take this [item=alter_gem] and use it on a [item=wyrm] yourself! If you need more [item=alter_gem]s, I have added the recipe to the synthesizer. + To use the [item=alter_gem], select it in your inventory, choose Transform, and choose a creature to transform. + Don’t be afraid to try [item=alter_gem]s with other creatures… like a [item=dragon]. Or, dare I suggest it - an [item=adult_dragon]?! + Running out of [item=alter_gem]s? You can find them deep underground or create them at the synthesizer. + Make sure you use [item=alter_gem]s on well-fed creatures. Hungry creatures won't stay transformed long! + You didn’t crash with the rest of us? + No, I was part of a scouting mission for the colonization program. + We were four. But, the other three died, and when they came soon after, I knew this planet was cursed. + I barely survived, using what I'd learned of magic. Perhaps if I’d had those [item=goggles] back then, things would've been different. + They were here?! After you? + Yes. I believe they were jealous of my magic. Or frightened of it? It’s hard to say for sure... + You met them on this planet ten years ago? That's before they tried to wipe out humanity and destroy Earth! + Correct. I was the first to encounter them, and the first they tried to kill. + I don't know what I could've done differently to stop the war. They arrived suddenly with their biological weapons and attacked without a word. + If only there was a way to communicate with them... + We probably could communicate with them now, using my magic translation. + But, hopefully we'll never encounter them again, now that they seem content to ignore us. + I’ve been noticing some very strange spikes in the magical energy lately. It could be nothing, but it could be one of them. + If you find it, summon me immediately. If it really is one of them, we are all in grave danger. + Alright, let’s see if my translation works! + Who are you and what are you doing here? + What right have you to ask me that? This is my home, my planet! You are the trespassers here! + That magical exoskeleton looks vaguely familiar... are you one of them? + The ones you call "them" are my foolish brethren. Long ago, they chose to abandon their homeworld, while I stayed and took a path of isolation and immortality. + Can you tell us about your magic? What are these magical energy spikes? Why did you create and raise the dragons? + Silence! We do not speak of these things with the likes of you! I have been very tolerant. Otherwise you would have been dead long ago. + But now I see that they were right about one thing. The universe would be better off without you and your kind! + You will regret choosing to disturb me! + No! + What’s wrong, didn’t we win? + We were too slow! It sent out a signal. They will know we are on this planet! + We must learn all the magic we can - and use their power against them when they come! Otherwise we are all doomed. + You are more adept at magic than I expected! This cannot be allowed, only we should wield magic. + It's sending a signal! If they hear it, they will come! I must finish this quickly! + What happened? Are you ok? + No…[pause=4] The signal was sent…[pause=4] And my life-force has been completely drained… + It is up to you now…[pause=4] Hurry!…[pause=4] Find the answers… Use their magic… + [tile=alchemist anim=alchemist.idle] I'll set up a defensive barrier and healing magic. Stay behind me while it attacks, and then hit it when it overloads. + [tile=alchemist anim=alchemist.idle] Attack it now! + [tile=alchemist anim=alchemist.idle] I'm detecting a magical energy spike! I don't think my barrier will be able to block this attack! + What are you doing here?! + I’m using the laboratory to analyze samples from the eastern island. + I mean, how did you get back here so fast? + The same way I get everywhere! By teleporting. Obviously. Now stop bothering me, I need to finish my analysis. + Gemstone synthesis… nested carapace… evolution indefinitely… [font=drachenklaue]mumbo jumbo[/font]... + You're no match for this creature. We'll need a plan if we want to survive! + Work Together + Let Alchemist Fight + Stand back! This fight is not for the inexperienced! +
+
+ So cold…[pause=1] and tired…[pause=1] I need shelter, but there’s nothing around here but fallen branches! + I can barely hold all this [item=wood]! It'll take more [tile=stamina] [color=006600]Stamina[/color] to move now, but I can't stop here, I need to find shelter! + What is this structure? It looks like someone stopped in the middle of making a shelter. I bet I could finish it with [var=quest.hut.wood] [item=wood]. + I have {count} of [var=quest.hut.wood] [item=wood] needed to finish this [color=770000]Hut[/color]. I need to gather more fallen branches. + I dropped off {added} [item=wood] at the [color=770000]Hut[/color]. I need {remaining} more to finish it! + This axe could come in handy. With it I could probably build a [color=770000]Storehouse[/color] to store the resources I gather. + I bet I could make a storehouse with [var=quest.storehouse.wood] [item=wood] and [var=quest.storehouse.berries] [item=berries]. + Alright! Let’s get this storehouse built! + Perfect. Now I can avoid getting tired out from carrying too much. + I wonder if the thief was telling the truth about other survivors? + Perhaps I should build a [color=770000]Dock[/color] to set out and find them. It'll take [var=quest.dock2.wood] [item=wood] and [var=quest.dock2.steel_bar] [item=steel_bar]s. + Alright, let's get this [color=770000]Dock[/color] built! + Maybe if I built a [color=770000]Market[/color], I'd attract traders to this dock. I can build one for [var=quest.market2.gold_bar] [item=gold_bar]s. + That's everything I need for the [color=770000]Market[/color]! + It looks like there really were traders out there! They even gave me a [item=coin_purse] to store coins for buying and selling. + Now we just need to build a [tile=boat.ico] Boat at the [color=770000]Dockhouse[/color]! + I don’t know what’s out there, but I mean to find out before I return. + Bring back some good things to eat! + Don't forget to explore below the surface, you never know what you might discover. + Don’t leave us hangin’ - come back soon. + Don’t get involved with anything too dangerous. + It's an uncertain world out there. + You're going the wrong way, the secrets are all off to the east! + It's great to be back in business! Now if only we could get rid of those thieving bandits! + You seem strong. Think you could scare them off for us? + You actually beat the bandits! Please, take this gift as a token of our appreciation. + It's our lucky day - our prey came walking right up to us! Things are going great since we ran away from those Mirrows and their nasty experiments! + This place feels weird, like I've entered another dimension. I have a feeling it will be different every time I enter. + You'll need a [item=coin_purse] if you want to trade with us. We can give you one for [var=recipe.sci1_coin_purse.sulfur] [item=sulfur]. + Trade [var=recipe.sci1_coin_purse.sulfur] [item=sulfur] for a [item=coin_purse]? + Hey kid, would you like some rare goods? You can't buy these anywhere else! + Thank you for your business. Sorry, no refunds. +
+
+ I shouldn't rest in some random person's tent! + This must be the [object=hunter]'s tent. I should leave it alone. + Hey, you! Did you see me take down that boar? + Yeah, how… how did you do that? + Simple! A bit of proper technique is all you need. + I’m trying to clear out this area. If you help me out I could teach you how to hunt. + You need to employ the element of surprise. Hit enemies from behind, and you’ll get a critical hit. + Here, have a [item=workbench] - you can use it in your inventory to make weapons of your own! + I prefer [item=bow]s so I don't have to get close to enemies, but if you want to use melee weapons, a [item=buckler] will help you block attacks! + Use [key=equipment] to equip a weapon, [key=attack] to attack with the equipped weapon, and [key=defend] to block with a shield. + Why don't you craft a [item=bow] and kill some [color=770000][tile=boar] Boars[/color]. And let me know if you need any hunting tips! + You seem dangerous. Stay out of our area! + Well, fine! I’ll just go back to the mountains then! + Ready to learn some hunting techniques? + We’ll have this area cleared of dangerous creatures in no time! + For a job well done, let me give you my old [item=backpack] - it might come in handy when you’re out in the field. + You could dig a tunnel to sneak up on boars and hit them from behind. + [item=red_berries] can be used to temporarily increase your attack power - but be careful, they’re not good for your health. + If you keep getting “blocked,” that enemy is too strong for you. You’ll need a better weapon or a stronger attack. + Setting [item=arrow]s to a hotkey lets you fire them as long as the [item=bow] is in your inventory, even if it's not equipped! + So there I was, shivering and alone on the dark mountainside, when I saw firelight! And heard laughter! It sounded so companionable... + So you came down to make friends with us? + Of course not. And I certainly wasn’t hunting boars to try and impress you. Not at all. + I simply wanted to expand my hunting range. + I’d like to know more about this place, and whether there’s anything beyond this island… + There’s other islands out there to the east. I’ve seen them, from high in the mountains. + Think we could get there? + Not sure. The coast on that end is treacherous. Plus, those islands looked plenty strange to me. Might be dangerous. + So you’re saying we should just be content with the way things are? + I’m saying that we don’t need to go borrowing trouble when life is already hard. + I’d like to keep the wildlife in check around here. + Could you use the [item=workbench] I gave you to make [var=quest.fence.fence] [item=fence]s? Then we could start setting up a perimeter. + Perfect. [color=770000][tile=boar] Boar[/color]s can't run through [item=fence]s, so we can use them to protect our settlement. + I'll place one here, place the other [item=fence]s around our base to protect it! + I've noticed a wolf pup hanging around our settlement. He seems lonely. + Doesn't he have a pack? + They must have left him behind. + With [var=quest.wolf.net] [item=net]s, [var=quest.wolf.trap] [item=trap]s and [var=quest.wolf.meat] [item=meat], we may be able to tame him. + Okay, let’s see what we can do with this pup. + Well done, he seems to trust you completely. You have a loyal companion now. + You can have the [item=wolf] follow you by using the [color=770000]Familiar[/color] slot in your [color=770000]Equipment[/color] window. +
+
+ It’s totally fried! This is awful! + What happened? + The Mirrows tried to re-route the power and almost blew the whole thing up! + Expecting us to clean up after their failed experiments… gah! + I don't even have any [item=titanium] left, so there's no way to repair it... + Wow, I didn’t expect you to really come back with [item=titanium]. + Thanks, now I can get this fixed up in no time. + Back in business! We can use [item=coal] or [item=refined_oil] to power the plant. You can also make a [item=battery] here. + Oh, and take this scrap metal from the repair as thanks for the [item=titanium]! + I'll never find any more [item=titanium], it's hopeless! + Let me know when you've made a [item=battery], as we'll be able to make some cool stuff once we have a mobile power source! + Use [item=sulfur] and a [item=steel_bar] to make a [item=battery] at the [color=770000]Power Plant[/color]. You can recharge them there, too. + Simply add a [item=battery] to your inventory to power your equipment. + Your total [tile=power] [color=444400]Power[/color] will be displayed below your [tile=health] [color=770000]Health[/color] and [tile=stamina] [color=006600]Stamina[/color] . + Now that we finally have power again, I wish we had some new machinery to play with. + If you help me get a [color=770000]Factory[/color] set up, we could manufacture all sorts of things! + This will be awesome. Finally a new project to tinker with! + Now we can refine materials and build [item=drill]s, [item=chainsaw]s, [item=shotgun]s, and other cool stuff. + I noticed you’ve been doing a lot of mining. + Wouldn’t it be convenient to have a contraption to help you haul everything back to the surface?! + Nice! Let's do this! + Going up? Or should I say down! + Need anything repaired? I’m your gal! + What is that fire-breathing creature powering the plant? It better not break it! + There are more survivors here than I expected! + Yeah? But it's not enough. If we're to survive as a species we'll need to join up with other colonies. + You think they made it? + I'm sure they're out there. We just need a way to find and reach them. + And if we're attacked on the way? + Then at least we tried! I'm not going to sit here clammed up on this planet just because it feels safe for the moment. + Hey, what’s wrong? You look down. + I tried asking the Mirrows to stop harassing everyone, but they won’t listen and I don't want to fight them. + Good of you to try. But they’re stubborn as mules, and don't listen to anything except strength. + I’m not giving up yet. It’s not fair that they can abuse their power like this. + Maybe try to learn as much as you can about the Mirrows. Have you checked out all the areas around their lab? + Are you the “C” in the Mirrows’ lab notes? Were you working with them? + No… not exactly. They’re - [pause=4]They’re my parents. + Your parents!? If you’re their daughter, maybe they’d listen to you. Will you try negotiating with them? + Believe me, I’ve tried. They won’t listen to reason. They’re too focused on their “enhancements” and won’t even consider other solutions to our problems. + We’d need something really powerful to get them to change directions. Something that can't be explained with science. + What do you think about this [item=dragon_armor]? It has the power of an [item=adult_dragon], but can be worn like armor! + That's so weird, but I definitely think it's worth a shot. Let's show it to my parents. + Back again? This time we'll turn you into a cyborg for sure! + Wait! Don't attack, it's me. + Cass? What are you doing here? + I want you to take a look at this. Maybe you don’t have to turn people into cyborgs after all. + What is this thing? Its power readings are off the charts, but it doesn’t appear man made at all! + If I tell you, will you agree to stop your human experimentation and extortion? + Of course, this could be a whole new line of research for us! + It turns out the species who originally inhabited this planet created the dragons and magical equipment. And, that species may have been - them. + We'll be using their own creations against them! What delicious irony! + Don't you know what time it is? I'm sure whatever you need can wait until morning... +
+
+ Welcome to the Golden Key! Finest (and only) room and board this side of the desert! + So this is an inn? Do you get many people through here? + A fair few come through Sunset Haven - exploring, trading, looking for a place to call home. + But if we don't get power back soon who knows if anyone will stay. I can't tell you how many times I've been tempted to go and give those Mirrows a piece of my mind! + Wonderful! The power is back! + No thanks to those darn Mirrows. I can’t believe we all still pay them dues to keep the technology running around here! + And not only do they fry the power plant, they can’t be bothered to come around and fix it?! + Can’t you just stop paying them? + I can’t leave the inn, but if someone would go to the desert and confront them about it, maybe we could back out of this unfair arrangement. + I'm afraid we can't let you stay here until the power comes back on. + Would you like to spend the night? Only 50 [color=770000][tile=coin_purse.ico] Coins[/color], and I'll include a hot meal! + Not enough money? Then I'm afraid you can't stay here. This isn't a charity you know! + I hear the main ship crashed around here somewhere? How did you survive without life pods? + That's exactly our problem. The Mirrows saved us. They did some unbelievable last minute enhancements and protected an entire sector from obliteration. So we're in their debt. + But now, they destroyed our power, and they’re letting strange creatures loose to wreak havoc. + I've even heard that some folk have gone missing in the desert, where the Mirrows were last seen. + And they expect us to put up with all this? And even pay dues to them? It’s become too much. + The Mirrows agreed to stop asking you for money and experimenting on people! + Excellent! Maybe we can finally have some peace around here now. + Here, take this as a token of my appreciation. + ... [item=coal]? + What? I’m not running a charity, you know. +
+
+ Finally back on land again! You look like you just arrived too! + Hey there! It's nice to see other survivors sailing out here! + Don't mind her, that's just Polly’s way of saying hello. Hope you don’t mind a bit of seawater on your boots! + So, have you been to this island before? + So, do you know what island lies ahead? + Sure have, this island's called Sunset Haven, and it has more survivors than any other island I've seen. + Sure do, the island's called Sunset Haven, and it has more survivors than any other island I've seen. + Makes sense too - as it is where the main ship crashed. + But watch yourself. I've heard some bad rumors about Sunset Haven lately... + Hey, my [item=cat] Peri ran away from me again! Do you think you could help me find her? + I think she’s trying to avoid sailing. Not a fan of the water. + If you help me out, I'll teach you what I know of fishing. + Awesome, thanks! Here's a spare [item=fishing_rod], talk to me if you want fishing tips! + [item=toothfish] are Peri's favorite food, maybe you can tempt her with some of those? + Hey, you found my [item=cat]! Thanks, man. + Sheesh, looks like you completely won her over. I bet she’d be happier with you. Why don’t you keep her? + The cat is too fast for you to grab! + She snatched the [item=toothfish] from my hand, but she’s too fast, I can’t catch her. + Give Peri a [item=toothfish]? + She didn’t bolt away as fast this time. + Come here Peri... that's a good girl... + One cat successfully captured! + Fishing is all about timing. Use your fishing rod at the end of the dock and then hit [key=select] when there is something on the line - too soon or too late, and you'll lose the catch! + If it says "Wait for it...", the fish needs a little more coaxing. Wait until it says "Pull now!" then hit [key=select] again! + Some fish are more difficult to catch and require more keys. Keep an eye on the tooltip, and hit the key it shows! + Me, this is all I need - a roof over my head, sunshine, and the vast ocean to fish. + And you? What’s your dream? + I’d really like to know if there’s a way off this planet. + What, why!? Do you have a death wish? Those things have no mercy. + I want to know more about them… and why things happened the way they did... + Listen my friend, I saw one firsthand before we launched from Earth. All you need to know is how to avoid them. +
+
+ Are you two the Mirrows? Why have you been tormenting Sunset Haven and creating those strange mutants? + You don't understand! We're doing this for the good of everyone! We cannot survive without ultimate weapons! + When they come to exterminate the last of us, we'll be ready! The sacrifices made have been necessary. + You can't just go around sacrificing people for a future that may never come to be! There are better ways to save everyone! + If you’re determined to work against us, we have no choice but to fight you. + I have a feeling your body is just what I need for my new Cyborg invention! + Unbelievable! Somehow you are stronger than I am, even with our advanced cybernetics! + You must tell us the secrets of your strength - you could be the key to saving humanity! + If I tell you my secrets will you agree to stop harassing the townsfolk and asking them for money? + Of course. Why would we need those dull specimens when we have you!? + This will be a whole new line of research for us! + Feel free to use our surgery lab. We’d be very interested to see how powerful you become with our cybernetic enhancements! + You can remove cybernetic enhancements at any time by selecting it in your equipment window and choosing remove. You can re-install enhancements later at the surgery lab, but it will cost more resources. + Looks like the navigation screen is still working. According to this, we are currently on Unoiks 428c. + Did the Mirrows add this note?! I have to ask them about this... + We're on the Enemy Homeworld? How do you know? + We can't be certain... but we took samples of many ruins on this planet. Not only are they a match for their technology, but they date back over a million years ago! + But they're gone now? + We haven't detected them on this planet, but even if they did leave, they are sure to return eventually. + This is why we were willing to sacrifice everything for strength... from the day we landed on this planet, a confrontation with them became inevitable. +
+
+ Not bad at all... I wonder who began building this structure... and why they stopped. It looks pretty recent... + Help…[pause=4] please…[pause=4] shelter… + Someone is outside! Can I trust them? + Thank you. I owe you my life. I had all but given up hope - I was too tired and hungry to finish this shelter. But what do we do now? + For now, we stay warm and dry. + But what about after that? How will we survive on this deserted island? + Is there even any point? We’re stuck here, there’s no going back. + At least we can try. Maybe life here won’t be as bad as you think it will. + Please…[pause=4] help… + … so when I arrived here I just started digging and didn’t even realize there was a storm. + But I’m glad you’re here. I was getting tired of eating dirt, and there’s nothing like a warm fire after a long day underground. + Do you think there are more survivors out there? + Honestly, I’m surprised anyone survived that crash. But here we are, so maybe others survived too? + Now I bet you youngin’s are thinking this here’s the end of the world, but I thought the same during World War 3 and yet here we all are. + The way I sees it, we just got to make the best of the situation, and be glad there’s food to eat and company to share. + But how long will we have to live on this god-forsaken island? + Who knows? But as long as there’s life, there’s hope. Perhaps in time this island will be as good as home. + So tell us what you know of other survivors? + Most of us were scattered across different islands, but some of the islands have more survivors and even some working technology. + I’ve even heard rumors of an island with a nearly intact ship. + Could it still fly? + As I said, all I’ve heard are rumors. But even if it could, it’d be certain death. Best to stay on this planet, they don’t seem to care about us here. + You're so good at this stuff. Were you a hunter before the crash? + Heh. Never killed an animal in my life before this. I was a scientist. Lab work. Molecules. + Wow. How'd you figure it all out then? + It's amazing what you can do when you need to survive. + You change. You become someone your old self would barely recognize. + They’ve been rebuilding technology? + Yeah, Sunset Haven has power and industrial equipment. + But the folks there aren’t too happy with the Mirrows who set it all up. + The Mirrows survived!? + You know them? + Unfortunately. We were part of the same research group back home, studying genetics. + After the attack, they started doing awful stuff like human experimentation. I could no longer work with them. + Hey, we should rebuild some technology here, too! If they can do it, why not us? + That's the spirit! This place will feel just like home in no time. +
+
+ 3/15 - We have been left with no choice but to abandon Earth. Our weapons cannot hurt them, and they pursue us with a vengeance. Perhaps, on another planet, we can finally evade their wrath. + 5/1 - The ship was heavily damaged in the escape, but the jump drive activated successfully. That should keep us ahead of pursuers, assuming the ship survives the journey. + 6/30 - Fleshed out new plan for human augmentation and survivability, including number and type of specimens necessary to achieve our goals. Mr. H has left the research group. + 8/5 - Reached target planet but cannot enter atmosphere safely and there are not enough life pods. Probability of survival low, even for augmented subjects. No sign of the enemy. + 9/2 - Hull reinforcement progressing, but survival requires augmentation. Dissidents are protesting the procedure, even though their lives depend on it. + 9/26 - Can no longer maintain orbit. Many have accepted augmentation, and some who wouldn't were launched in the life pods. Hopefully the reinforcement will be enough for the rest. + 10/4 - Emergency reinforcement was largely successful, but estimated number of survivors is far lower than hoped, even considering life pods we cannot account for. + 10/5 - Species viability is now a major concern. With only a few hundred individuals, we cannot survive without drastic intervention. Beginning new line of research. + 11/20 - Established basic infrastructure east of crash site. Gathering new specimens for experimentation. + 12/14 - Species viability research has stalled, but combat research looks promising. Cybernetic enhancements are able to turn an average civilian into a war machine. + 12/24 - C disapproves of combat research. Instead of preparing for their return and enhance species viability, C wants to return to the stars and search for other survivors. + 1/6 - C left the lab and made it clear we were no longer welcome in town. Moving base of operations into old lab in the remains of sector 22. + 1/31 - Applying Cybernetic research to ourselves due to lack of test subjects. Still no sign of the enemy, but perhaps this time we will be able to fight them. + 2/9 - Coerced townsfolk to help fund research. Also obtained new test subjects (vagabonds and outcasts). Research is progressing again. + 2/27 - Ran out of vagabonds, so had to gather test subjects from the townsfolk. If viability research is not completed soon, we will run out of test subjects again. + The panel is broken... +
+
+ Unoiks 428 +
+
+ G-type star 42 light years from Earth.\n3 confirmed exoplanets. +
+
+ Unoiks 428{char} +
+
+ An Earth-like and habitable planet, colony location #21.\n\nSuspected of being [color=ff2222]Enemy Homeworld[/color]. + A small but dense terrestrial planet close to the star. It has no atmosphere, but is likely to hold valuable ores and [item=exotic_matter]. + An ice giant with a stormy atmosphere and strong gravitational pull. +
+
+ Options + Game Paused + Music Vol: + SFX Vol: + Fullscreen: + Text Speed: + Language: + Gameplay Options + UI Options + Controls + Achievements + Return to Title + Back + Do you wish to return to the title screen? Any unsaved progress will be lost. + Keyboard + Controller + Import Save + Export Save + Can only import files on Title Screen. + To import: drag .asav file into game window, then select a slot to place the save. + Select a save file to import. + Where do you wish to export the save slot? + Cannot import: Save corrupted. + Cannot export: Save corrupted. + Auto-eat health healing food? + Auto-eat stamina healing food? + Overweight Limit: + Notifications: + Show All + Hide Bottom + Hide Element + Hide Bottom, Element + Hide Critical + Hide Bottom, Critical + Hide Element, Critical + Hide All + Enable Move All Buttons + This button will move all items from one inventory to the other. Are you sure you want to do this? + Fade UI: + Ask for crafting item counts. + Allow flashing. + NPC Notifications when Away + Show Blueprints in All tab? + Allow mining walkways? + Confirm when discarding all items. + Show new item discovered popup. + Use resources when placing blueprints. + Give NPC priority with no quests. + Auto Collect: + Switch Equipment hotkeys. + Prioritize Storehouse Inventory. + Difficulty: +
+
+ When enabled, if you're about to run out of health, you will automatically eat a health healing food (if available) from your inventory instead of dying. + When enabled, if you're about to run out of stamina, you will automatically eat a stamina healing food (if available) from your inventory instead of losing health. + Sets how much over the weight limit you have to be before the game stops you from moving (to avoid death by walking overweight). Move the slider all the way to the left to remove the limit. + What notifications to show.\nBottom are the notifications at the bottom of the screen (like NPCs putting items in your storehouse).\nElement are elemental effective/resist popups.\nCritical are critical hit, miss, dodge, and blocked notifications. + Enables the move all "<" ">" buttons in the transfer inventory window. + Sets the alpha opacity of the on-screen GUI (health bars, buttons, etc). + When enabled, the game will ask how many items you want to craft/smelt at a time, otherwise it will craft one item per selection. + Disable this if you are sensitive to flashing lights. It will disable some of the more intense flickering lights in game. Not all mods are guaranteed to handle this option. + When enabled, NPCs will notify you when they add to storehouses on any island. When disabled, they will only notify you when they add to storehouses on the current island. + Disable to make walkways unmineable so you don't collect them by accident. Enable to allow mining walkways so you can collect and re-arrange them. + Disable to place blueprints immediately and add resources to start building them later. + Disable to stop NPCs from blocking access to structures/items behind them when they have no quests to give or complete. + Automatically collects items when mining, picking berries or defeating an enemy with melee weapons. + When using a hotkey to equip an item, switch that hotkey with what was previously equipped. + Add/remove items to/from the storehouse by default, instead of the player's inventory. +
+
+ Left: + Right: + Up: + Down: + Action: + Cancel: + Items: + Quests: + Equipment: + Attack: + Defend: + Device: + Hotkey 1: + Hotkey 2: + Hotkey 3: + Hotkey 4: + Hotkey 5: + Hotkey 6: + Hotkey 7: + Hotkey 8: + Mute: + Chat: + Walk: +
+
+ Aground Cloud Login\nAground Cloud is an optional service that will sync your save files across all versions of the game. + Logging in... Please wait... + Incorrect username or password. + Cloud sync failed to connect. + Sync Failed! + Login to Aground Cloud + Logout of Aground Cloud + Not logged into Aground Cloud + Logged in as: {username} + Username: + Password: + Remember Me? + Create Account + Username must be between 3 and 24 characters. + Password must be between 3 and 40 characters. + Syncing Slots + All Saves Synced! + You have unsynced saves! + Sync Now + There are two saves in this slot!\nWhich one would you like to keep? + Your saves are currently syncing. Are you sure you wish to leave before the sync completes? + Are you sure you wish to logout? +
+
+ We use mod.io to install and manage mods. Enter your e-mail to begin! + E-Mail: + Not a valid e-mail address! + Enter the 5 digit code sent to your e-mail: + Unable to find your e-maill address on mod.io! + The code you entered was not correct! + You have successfully logged in to mod.io! Your subscribed mods will automatically download! + Version + Enable Mod + Disable Mod + Upload to Mod.io + Upload Failed + Upload Successful! + Login to Mod.io + Browse Mods + Logout of Mod.io + Not logged into Mod.io + You must add a preview image as preview.png in the mod folder before uploading! + Visit Website + Are you sure you wish to disable {mod}? + The .zip file does not have a mod.xml file or is not a valid mod. + The mod {modname} was successfully imported! + You have already imported a mod with the same name. Would you like to replace it? Note: you may have to reload the game if the mod image files were edited after replacing. +
+
+ Upload to Steam + Uploading {name} to Steam Workshop: + Notes: + ID: + Agree to the workshop terms of service. + Create New +
+
+ What would you like to name this area? + Starting Island + Sunset Haven + Eastern Island + Water Cave + Colony Ship +
+
+ Create Character + Skin Color: + Hair Color: + Eye Color: + Shirt Color: + Pant Color: + Hair Style: + Shirt Style: + Facial Hair: + Fur Color: +
+
+ Black + Brown + Dark Brown + Light Brown + Blue + Dark Blue + Light Blue + Green + Light Green + Red + Yellow + Orange + Pink + Purple + White + Gray + Teal + Blond + Dark Blond + Custom +
+
+ Open + Closed +
+
+ Easiest + Easier + Normal + Harder + Hardest + 1 Hit Death + Casual +
+
+ Select Campaign + Default + The standard version of Aground. +
+
\ No newline at end of file diff --git a/games/aground/data/core/lang/fonts/drachenklaue.fnt b/games/aground/data/core/lang/fonts/drachenklaue.fnt new file mode 100644 index 00000000..88f86864 --- /dev/null +++ b/games/aground/data/core/lang/fonts/drachenklaue.fnt @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/games/aground/data/core/lang/fonts/drachenklaue.png b/games/aground/data/core/lang/fonts/drachenklaue.png new file mode 100644 index 00000000..747f8413 Binary files /dev/null and b/games/aground/data/core/lang/fonts/drachenklaue.png differ diff --git a/games/aground/data/core/lang/fonts/uni.fnt b/games/aground/data/core/lang/fonts/uni.fnt new file mode 100644 index 00000000..784bb34f --- /dev/null +++ b/games/aground/data/core/lang/fonts/uni.fnt @@ -0,0 +1,721 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/games/aground/data/core/lang/fonts/uni.png b/games/aground/data/core/lang/fonts/uni.png new file mode 100644 index 00000000..15a88d20 Binary files /dev/null and b/games/aground/data/core/lang/fonts/uni.png differ diff --git a/games/aground/data/core/lang/languages.xml b/games/aground/data/core/lang/languages.xml new file mode 100644 index 00000000..55de92db --- /dev/null +++ b/games/aground/data/core/lang/languages.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/games/aground/data/core/lang/pt_BR.xml b/games/aground/data/core/lang/pt_BR.xml new file mode 100644 index 00000000..ac07abf8 --- /dev/null +++ b/games/aground/data/core/lang/pt_BR.xml @@ -0,0 +1,1644 @@ + + +
+ Bloqueou! + Resistente a {element}! + Fraco contra {element}! + Errou! + Esquivou! + Acerto crítico! + Nenhum efeito + Jogo salvo + Arquivo apagado + Arquivo corrompido! Isso pode acontecer porque o jogador está em uma área que não existe nesta versão. + Arquivo incompleto. Alguns objetos/itens/áreas podem estar faltando. Isso geralmente acontece porque está faltando um mod, ou o arquivo é de uma versão diferente do jogo. + Combustível + Colocar combustível + Colocar alimento + Colocar alimento + Tudo + Equipamento + Capacidade: + Vida: + Energia: + HP + DEF + Carga + Oxigênio + Ok + Cancelar + Sim + Não + Aceitar + Recusar + Vender + Comprar + Deseja jogar quantos fora? + Deseja comer quantos? + Deseja beber quantos? + Deseja guardar quantos? + Deseja retirar quantos? + Deseja cancelar quantos? + Deseja vender quantos? + Deseja comprar quantos? + -- Ingredientes -- + -- Custo do reparo -- + -- Cria -- + {item} consertado. + Inventário + Livro de missões + Cabana + Fundição + Cozinha + Oficina + Depósito + Estaleiro + Mercado + Cabo elétrico + Usina elétrica + Entreposto + Celeiro + Curral + Coletar + Coletar tudo + Gerenciar + Alimentar + Laboratório + Gaiola + Fábrica + Sintetizador + Carga por golpe: + Energia por golpe: + Energia por uso: + Andar + Novo jogo + Continuar + Opções + Sair + Comunidade + Mods + Vazio + < Espaço vazio > + Espaço corrompido + Tem certeza de que deseja substituir este espaço? + Nada + Campos: + {item} colocado. + Subiu de nível! + Nível: + Exp: + Selecionar item + Selecionar atalho: + Tentar de novo + Título + Mover tudo + Adicionar animal + Selecionar alimento + Deseja usar quantos? + Selecionar fertilizante + Jogo sem som + Jogo com som + {npc} colocou {count} unidade(s) de {item} no {storehouse} + Usei {count}x {item} para recuperar vida + Usei {count}x {item} para recuperar energia + Usei {count}x {item} para recuperar oxigênio + Tem certeza de que deseja jogar {item} fora? Não será possível recuperar. + Deixe uma mensagem na [item=sign]: + Deseja transformar quanto em {into}? + Pegar tudo + Definir como [tile=sticky] Item importante + Mover para o topo + Fisgou alguma coisa! + Fugiu! + Espere... + Puxe! + Deseja fabricar quantos? + Deseja desfabricar quantos? + Moedas + {item} quebrou! + {item} está quase quebrando! + Apenas inventário + Incluir depósito + {item} está com fome! + {item} não está com fome. + Definir o nome do {item}: + Recarregar + Recarregar baterias + Todas as baterias foram recarregadas! + Recarreguei tantas baterias quanto foi possível. + Alimento + Tempo + Alimentar {item} com estes itens?{list} + Abastecer {item} com estes itens?{list} + Consertar {item} com estes itens?{list} + {item} vai quebrar! Consertar com estes itens?{list} + Usos + Encantamento + Recuperação + Durabilidade + Dano + Captura + Tipo de captura + Espíritos + Altitude de voo: + Profundidade de mergulho: + Força de recuo: + Enfrentar + Fugir + Completo + Remover + Manipulador do tempo + Que horário você deseja definir (formato de 24h)? + Aqui termina a demonstração para quem escolheu o Caminho da Magia. Deseja salvar seu progresso? + Aqui termina a demonstração para quem escolheu o Caminho da Ciência. Deseja salvar seu progresso? + Créditos + Adquira o jogo! + Redefinir + Sair da água + Não perg. de novo + [color=ff2222]ATENÇÃO![/color] A versão {version} está disponível! + Selecione uma direção:\n\n[key=left][key=up][key=down][key=right] + Aleatório + Eficiência + Vitória! + Novo item descoberto! + Mais {count}... + Para construir esta estrutura, mova ou remova estruturas próximas. Você pode fazer isso usando [item=dismantle] em seu inventário. + Tem certeza de que deseja excluir este arquivo? + Não é possível consumir itens até que o [tile=stat.full] cronômetro acabe! +
+
+ Ver status + Vida máx. + Energia máx. + Velocidade + Vigor + Ataque + Alcance + Defesa + Def. elemental + Corte + Espírito + Mineração + Peso + Esquiva + Crítico + Pesca + Vel. mineração + Visão + Negociação + Armadilhas + Oxigênio + {mod} por {time}s + {mod} ({current}/{max}) +
+
+ Quantos golpes você suporta antes de morrer. + Quantas ações você pode fazer antes de começar a perder vida. + Sua velocidade de movimento. + Diminui o gasto de energia para se movimentar. + Aumenta o dano de ataque corpo-a-corpo. + Aumenta o alcance de todas as armas de longo alcance. + Diminui o dano do inimigo. + Aumenta a força ao cortar árvores. + Permite escavar solos mais difíceis. + Aumenta sua capacidade de carregar coisas. + Aumenta as chances de o inimigo errar. + Aumenta as chances de dano crítico em ataques corpo-a-corpo. + Facilita a pesca de peixes mais difíceis. + Permite escavar o solo mais rapidamente. + Maior alcance visual ao se movimentar e escavar. + Aumenta o valor de venda dos itens. + Aumenta as chances de captura com redes. + Aumenta seu tempo de sobrevivência sem respirar. +
+
+ Alocar pts. de habilidade + Pts. de hab. + [color=770000]Habilidade maximizada +
+
+ Descartar + Colocar + Usar + Fabricar + Equipar + Desequipar + Disparar + Comer + Saquear corpo + Alimentar + Alim. totalmente + Abast. totalmente + Repar. totalmente + Recolher + Abrir + Esculpir + Trocar + Transformar + Consertar + Renomear + Encher + Sintetizar + Encantar + Definir projétil + Enfurecer + Tem certeza de que deseja enfurecer seu [item=adult_dragon]? Ele ficará permanentemente hostil contra você. + Habilitar ataque + Desabilitar ataque + Habilitar voo + Desabilitar voo + Chamar + Desfabricar + Definir o horário + Redefinir habilidades + Construir + Aprimorar + Plantar + Combinar moedas +
+
+ Madeira + Carvão + Minério de ferro + Quartzo + Minério de ouro + Diamante + Enxofre + Óleo bruto + Titânio + Urânio + Barra de ferro + Barra de aço + Barra de ouro + Carne + Maçãs + Trigo + Ovos + Leite + Açúcar + Bife + Pão + Torta + Panquecas + Hambúrguer + Queijo + Pizza + Omelete + X-búrguer + Bolo + Maçã do amor + Sangue de dragão + Machado de pedra + Picareta de pedra + Picareta quebrada + Bolsa de moedas + Picareta de ferro + Espada de ferro + Armadura de ferro + Picareta de aço + Espada de aço + Armadura de aço + Armadura colossal + Arco + Arco recurvo + Flecha + Flecha do gelo + Flecha do fogo + Flecha da água + Flecha envenenada + Mochila + Supermochila + Ultramochila + Picareta mágica + Espada mágica + Bolsa mágica + Caixa mágica + Tecido + Rede + Frutas silvestres + Frutas vermelhas + Frutas congeladas + Poção de vida + Poção de energia + Poção de ataque + Poção de defesa + Poção de velocidade + Poção de vigor + Rato + Porco + Larva + Casulo + Dragão bebê + Dragão jovem + Dragão adulto + Calopsita + Lobo domesticado + Gato + Barco + Cerca + Tocha + Armadilha + Mesa de trabalho + Mesa de trab. de aço + Bigorna + Baú + Abóbora iluminada + Placa + Placa de identificação + Machado enferrujado + Algodão + Abóbora + Galinha + Vaca + Vara de pesca + Merluza + Peixe escorpião + Garoupa + Fertilizante + Pelugem de gelo + Pelugem sombria + Pedra do fogo + Pedra da água + Pedra da terra + Pedra do gelo + Pedra da flora + Broquel + Escudo + Escudo encantado + Boneco de neve + Machado ancião + Presa de fogo + Silício + Óleo refinado + Bateria + Broca + Revolver + Escopeta + Bala + Bala do gelo + Bala do fogo + Bala da água + Bala envenenada + Munição + Munição de tanque + Munição do gelo + Munição do fogo + Munição da água + Munição envenenada + Motosserra + Motosserra do fogo + Motosserra do gelo + Motosserra da água + Motosserra da flora + Motosserra envenenada + Carrinho de mina + Trilho + Mapa + + Pé de cabra + Mina terrestre + Pedra da mutação + Pedra focal + Pedra espiritual + Pedra de sangue + Minicanhão + Chama dracônica + Broca larval + Armadura dracônica + Espada do gelo + Espada do fogo + Espada da água + Espada da flora + Espada envenenada + Machado do gelo + Machado do fogo + Machado da água + Machado da flora + Machado envenenado + Óculos espirituais + Fornalha + Fogueira + Atadura + Barraca + Espada dracônica + Seda + Lampião + Lanterna + Broto + Saco de plantas + Mochila a jato + Capa sombria + Golem + Golem de ouro + Golem de ametista + Armadura da terra + Capacete da terra + Machado da terra + Lobo cibernético + Mecalarva + Corpo ciborgue + Dorso ciborgue + Olho ciborgue + Braço metralhadora + Enguia elétrica + Chifre + Escudo do gelo + Coração de gelo + Coruja + Desmontar + Planta da Cabana + Planta do Depósito + Planta da Cozinha + Aprimoramento da Cozinha + Planta da Fundição + Planta da Oficina + Planta do Celeiro + Planta do Curral + Planta do Laboratório + Planta da Gaiola + Planta da Doca + Planta do Entreposto + Sems. de trigo + Sems. de maçã + Sems. de açúcar + Sems. de algodão + Sems. de abóbora + Sem. de árvore + Sem. de conífera + Sem. de frutas silvestres + Sem. de frutas vermelhas + Sem. de frutas congeladas + Saco de hélio + Machado de aço + Martelo de aço + Aranha + Esconder equipamento + Detector de espíritos + Planta da Usina elétrica + Planta da Fábrica + Planta do Elevador + Planta do Cabo elétrico + Sem. de árvore roxa +
+
+ Navega pelo mundo. + Mantém inimigos distantes. + Derrete minérios. + Cozinha [item=steak]s. + Contém tudo. + Fabrica itens. + Conserta itens. + Congela inimigos. + Queima + Roubo de Vida + Perda de Vida + Transforma itens. + Tampa buracos. + Desprende trilhos, cabos e escadas. + Guarda itens. + Mostra uma mensagem. + Revela espíritos. + Descansa e restaura sua [tile=stamina] [color=006600]Energia[/color]. + Libera {item}. + Ilumina ao redor quando equipado. + {value} p/ seg. + {value} p/ seg. sob o sol. + {value} p/ seg. no escuro. + {value} p/ seg. durante o dia. + {value} p/ seg. durante a noite. + {value} p/ seg. enquanto ferido. + {value} p/ seg. quando não cheio. + {value} p/ seg. quando cheio. + Esconde o portador. + Sempre consegue acertos críticos. + Peso máximo + Dano refletido + Dispara {projectile} + Pode ser chocado na [color=770000]Gaiola[/color]. + Constrói + Aprimora + Desmonta estruturas das quais você tenha a [tile=blueprint.ico] [color=770000]Planta[/color]. + Recolhe itens próximos. + Planta + Custo de plantio + Custo de colocação + Pode mudar o nome da ilha quando colocada. + Equipa em + Pode ser usado embaixo da água. + Atravessa quadrados. + Atira para frente e para trás. + Resiste a ataques elementais. + Perfura os inimigos. + Não mata (para com 1hp). + Detecta fontes de vida próximas. + Voador + Nadador + Constrói plantas de estruturas. +
+
+ Abrigo + Carne fresca + Espaço infinito + Hora da colheita + Maçãs + Metalúrgica + Bon appetit + Peso pesado + Mãos à obra + Larvicida + Pedricida + Brilhante + Um bom negócio + Peso pesadão + Caça às larvas + Ordenhando porcos + Mmm, queijo! + Praias distantes + Içar velas + Experimentos + Sangue infinito + Choquei + Energizar + Industrialização + Vai subir? + Justiça + Eletrizante + Cobaia humana + A história completa + Recarga total + Ciborgueficação + Taurus + Domando dragões + Regicida + Filé artificial + Forjando o futuro + Tecnomagia + Elementar + Madeira! + Mestre dos dragões + Rebobinando + Encare o inimigo + Mestre de obras + Ficando monstro + Esmagador +
+
+ Conserte a [color=ff2222]Cabana[/color]. + Derrote um [color=ff2222]Javali[/color]. + Construa o [color=ff2222]Depósito[/color]. + Construa a [color=ff2222]Fazenda[/color]. + Cultive um [color=ff2222]Pomar[/color] na [color=ff2222]Fazenda[/color]. + Construa a [color=ff2222]Fundição[/color]. + Construa a [color=ff2222]Cozinha[/color]. + Obtenha a [color=ff2222]Mochila[/color]. + Construa a [color=ff2222]Oficina[/color]. + Derrote uma [color=ff2222]Larva[/color]. + Derrote um [color=ff2222]Golem[/color]. + Encontre um [color=ff2222]Diamante[/color]. + Construa o [color=ff2222]Mercado[/color]. + Compre uma [color=ff2222]Supermochila[/color]. + O que diabos eu faço com isso? + Construa um [color=ff2222]Curral[/color] na [color=ff2222]Fazenda[/color]. + Faça uma [color=ff2222]Pizza[/color]. + Construa a [color=ff2222]Doca[/color]. + Construa um [color=ff2222]Barco[/color]. + Construa o [color=ff2222]Laboratório[/color]. + Construa a [color=ff2222]Gaiola[/color]. + Crie um [color=ff2222]Dragão[/color] a partir de um [color=ff2222]Casulo[/color]. + Construa a [color=ff2222]Usina elétrica[/color]. + Construa a [color=ff2222]Fábrica[/color]. + Construa o [color=ff2222]Elevador[/color]. + Resolva o problema dos [color=ff2222]Bandidos[/color] na cidade. + Derrote um [color=ff2222]Lobo cibernético[/color]. + Vença o confronto contra os Mirrows. + Leia todos os registros. + Capture uma [color=ff2222]Enguia elétrica[/color]. + Instale um conjunto completo de equipamento ciborgue. + Conclua o Labirinto do Minotauro. + Voe num [color=ff2222]Dragão[/color]. + Derrote a [color=ff2222]Rainha das larvas[/color]. + Ative o [color=ff2222]Sintetizador[/color]. + Ative a [color=ff2222]Forja[/color]. + Encante uma [color=ff2222]Motosserra[/color]. + Capture um espírito de cada elemento. + Derrube uma [color=ff2222]Árvore roxa[/color]. + Obtenha um conjunto completo de equipamento dracônico. + Ative o [color=ff2222]Manipulador do tempo[/color]. + Derrote a [color=ff2222]Ancestral[/color]. + Construa uma estrutura a partir de uma [color=ff2222]Planta[/color]. + Aloque 500 [color=ff2222]Pontos de habilidade[/color] ou mais no seu personagem. + Derrote o [color=ff2222]Mecagolem[/color]. +
+
+ Plantação de trigo + Pomar + Plantação de açúcar + Plantação de algodão + Plantação de abóboras + Expandir fazenda + Construir curral + Curral + -- Produz -- + -- Espaços -- + Mudar plantação + Fertilizante + Você precisa de mais alguma coisa para ativar isto. + Hmm, nada de interessante aqui. + Encontrei algumas [item=pumpkin_seed]! + Navegar + Gerenciar estoque + Elevador + O [tile=boat.ico] Barco está pesado demais para navegar! + Descansar no Barco + Deseja usar {item} para ativar esta estrutura? + O pilar revelou este encantamento:\n{enchant}+{items}={creates}. + A fórmula do encantamento foi adicionada à [color=770000]Forja[/color]. + É preciso ter {item} para entrar nesta caverna. + Toda a força da estrutura está sendo absorvida por aquela estátua... + Construir Mecagolem + Deseja construir {structure} usando estes materiais? + Deseja desmontar {structure} para obter estes materiais? + Deseja plantar {structure} usando estes materiais? + Deseja colocar {structure} usando estes materiais? + Dragão no Covil: + Mudar aparência + Ativar a Forja. + Ativar o Sintetizador. +
+
+ Descansar na Cabana + Entrar no Depósito + Fabricar na Oficina + Fundir minérios + Usar a Cozinha + Entrar na Fazenda + Negociar com o Feirante + Negociar com o Ferreiro + Negociar com o Ourives + Entrar no Estaleiro + Entrar no Barco + Preparar poções + Cuidar dos animais + Cuidar da gaiola + Chamar o Alquimista + Criar dragões + Transformar em {into} + Voar no dragão + Ativar + Entrar + Descansar na barraca + Procurar + Operar a Usina elétrica + Entrar na Hospedaria + Chamar Elevador + Entrar no Entreposto + Operar a Fábrica + Desliga a Fábrica de golens + Alerta: Fora de Controle. + Ler + Operar + Operar em si + Operar em um animal + Cuidar das plantas + Cuidar dos animais + Chamar Barco + Invocar Dragão +
+
+ Coletar frutas + Cortar árvore + Atacar + Recolheu {item} + Abriu {item} + Coletou {item} + Usou {item} +
+
+ Mão dominante: + Segunda mão: + Mineração: + Armadura: + Cabeça: + Costas: + Companheiro: + Arma: + Motor: + Selecione um item cosmético e mude sua aparência sem alterar seu equipamento real. + Não é possível selecionar um item cosmético para este espaço. +
+
+ Pegou! + Quebrou! + Quase! +
+
+ Peso acima do limite! + Sem energia, perdendo vida! + Sem oxigênio, perdendo vida! + Abaixo da profundidade de mergulho, perdendo vida! + Ainda cultivando! Volte mais tarde. + Sem espaço disponível! + Está danificado demais para usar! + Clique no jogo para continuar + Você não tem os ingredientes necessários. + Não é possível colocar este objeto abaixo da superfície. + Não é possível colocar um objeto sobre outro. + Você precisa escavar uma área maior para colocar este objeto. + Não é possível colocar isso aqui! + Não é possível usar isso aqui! + Não é possível colocar isso tão alto. + Esta estrutura não pode ser construída abaixo da superfície. + Esta estrutura não pode ser construída debaixo d’água. + Esta estrutura precisa ser construída na água. + Você precisa escavar uma área maior para construir esta estrutura. + Não é possível construir estruturas em cima de outras ou de uma plantação. + Esta estrutura precisa ser construída ao lado de um(a) {structure}. + Esta estrutura precisa ser construída à esquerda de um(a) {structure}. + Esta estrutura precisa ser construída à direita de um(a) {structure}. + Esta estrutura precisa ser construída ao lado do litoral. + Não é possível construir esta estrutura dentro de um veículo. + Você não pode plantar em cima de uma estrutura ou de uma plantação. + Você só pode plantar em quadrados com grama verde. + Isto precisa ser colocado completamente dentro de um único espaço. + Não terá efeito. + Prefere jogar fora? + Não é possível disparar {projectile} sem {weapon}. + Não é possível atirar com {weapon}: está sem {projectile}. + Não é possível adicionar mais itens! + Não é possível colocar mais combustível! + Já foi consertado! + Não é possível colocar mais alimento! + Não é possível colocar mais alimento! + Não cabem mais moedas! + Algo deu errado! Deseja enviar um relatório do problema? + Não há energia! + A bateria está com pouca carga! + Alimento insuficiente! + Combustível insuficiente! + Não há {item} aqui. + O {item} está com fome demais para suportar a viagem! + Você não pode preencher este quadrado! + O carregamento do jogou falhou. Normalmente isto acontece porque faltam arquivos. Baixe-o novamente e extraia todo o conteúdo do arquivo zip dentro de uma pasta. + O carregamento do jogou falhou. Normalmente isso significa que há arquivos faltando. Tente apertar Shift+Refresh para forçar o recarregamento da página. + Indisponível. Aguarde uma atualização futura. + Não é possível fazer isso enquanto voa! + Não é possível dormir debaixo d’água! + Não é possível dormir em um veículo! + Você está muito pesado para voar com o {item}! + Você está pesado demais para se mover! + Você não pode equipar {item}. + Não há nenhuma estrutura aqui para desmontar. + Não tem nenhuma estrutura aqui para aprimorar. + Você não tem a planta desta estrutura. + Só é possível construir uma única estrutura desse tipo por ilha. + Não é possível fazer isso em um veículo. + Não é possível fazer isso enquanto nada. + Deseja remover {item}? Não será possível recuperar, e você terá que reinstalar no bloco cirúrgico se quiser de novo. + Não há o suficiente de {item}! + Não há pontos de habilidade suficientes para aumentar esta habilidade! + Você já tem esta planta! + Tem certeza de que deseja remover este item? Todo o progresso será cancelado. + Não é possível adicionar mais itens! + É preciso esperar que o ataque se recupere antes de usá-lo novamente. +
+
+ Fechado durante a noite. + Receberemos um novo carregamento em breve! + Não acredito que a [color=770000]Usina elétrica[/color] não está funcionando! Como vou manter meu negócio assim? +
+
+ Nova missão! + Você não tem missões. + ??? + -- Requisitos -- + -- Concluído -- + Reparar a cabana + Erguer o depósito + Erguer o depósito + Erguer a fundição + Erguer a oficina + Erguer a cozinha + Aprimorar cozinha + Erguer a fazenda + Semente de maçã + Erguer o mercado + Erguer o mercado + Erguer a doca + Erguer a doca + Erguer o curral + Construir o barco + Materiais mágicos + Gaiola das Larvas + Criar dragões + Machado mágico + Caçando javalis + Perímetro + Filhote de lobo + Consertar a usina + Erguer a fábrica + Construir elevador + Os Mirrows + Convencer os Mirrows + Encontrar Peri + Derrotar bandidos + Derrotar javalis + Toca das larvas + Encontrar a toca + Poder espiritual + Pesquisar larvas + Energia mágica + Colocar trilhos +
+
+ Concerte a [color=550000]Cabana[/color] para se proteger da tempestade. + quer construir um [color=550000]Depósito[/color]. + Construa um [color=550000]Depósito[/color] para guardar os seus itens. + quer uma [color=550000]Fundição[/color] para refinar minérios. + quer uma [color=550000]Oficina[/color] para criar ferramentas de metal. + quer construir uma [color=550000]Cozinha[/color] para preparar alimentos. + quer que a [color=550000]Cozinha[/color] produza [item=cheese]. + quer construir uma [color=550000]Fazenda[/color] para cultivar plantações. + quer usar as [item=fruit] para plantar um [color=550000]Pomar[/color]. + quer construir um [color=550000]Mercado[/color] para negociar produtos. + Construa um [color=550000]Mercado[/color] para atrair comerciantes para a [color=550000]Doca[/color]. + quer uma [color=550000]Doca[/color] para viajar pelo mundo. + Construa uma [color=550000]Doca[/color] para encontrar outros sobreviventes. + quer construir um [color=550000]Curral[/color] para criar animais. + Vamos velejar pelo mundo! Construa um [tile=boat.ico] Barco no [color=550000]Estaleiro[/color]. + quer o [item=dragonblood] de uma [item=wyrm]. + quer fazer experimentos com [item=wyrm]s. + Crie [item=dragon default=Dragões] para que um [item=adult_dragon] acompanhe você. + quer consertar o [item=rusty_axe]. + quer que você pratique a mira. + quer colocar [item=fence]s na vila. + quer domesticar o filhote de lobo. + precisa de [item=titanium] para reparar a [color=550000]Usina elétrica[/color]. + quer construir uma [color=550000]Fábrica[/color] para fazer máquinas. + quer um [color=550000]Elevador[/color] para transportar minério. + quer que você negocie com os Mirrows. + quer que você encontre algo especial para convencer os Mirrows. + quer que você ache a [item=cat default=Peri], que adora [item=toothfish]. + Os comerciantes querem que você derrote os bandidos. + quer que você descubra o segredo das [item=wyrm]s. + quer que você prenda espíritos em [item=spirit_gem default=Pedras espirituais]. + precisa de ajuda com a pesquisa das [item=wyrm]s! + quer descobrir a fonte dos picos de energia mágica. + quer fazer um [item=minecart]. +
+
+ Sair + Veículo + Mova-se para cima para voar. + O veículo está pesado demais para se mover! + Gerenciar itens + Gerenciar personagem + Recarregar com Baterias + [color=770000]DICA:[/color] Quando estiver em um veículo ou animal, aperte [key=equipment] para ver detalhes sobre ele, alimentá-lo ou abastecê-lo. + Este veículo não pode voar mais alto! + Coloca + Recolher + Se você recolher o barco agora, vai acabar nadando com os peixes! + Não é possível operar o veículo: outro jogador já está operando! +
+
+ Conversar + Pegar + Construtor + Mineradora + Fazendeiro + Comerciante + Alquimista + Caçador + Mecânica + Estalajadeiro + Pescador +
+
+ Você acha mesmo que vai sobreviver aqui? É inútil, cara. + Você parece bom em construir coisas. Que tal construirmos algo para guardar os materiais e alimentos que acharmos? + Humf. Acho que com [var=quest.storehouse.wood] troncos de [item=wood] e [var=quest.storehouse.berries] [item=berries], eu consigo construir um [color=770000]Depósito[/color] razoável. + Beleza! Eu consigo, sem problema. + Já que é assim, pegue este [item=stone_axe]. + Estou exausto. E parece que você também. Precisamos descansar na [color=770000]Cabana[/color] pra salvar o jogo e restaurar nossa [tile=stamina] [color=006600] Energia[/color]. + O que achou do meu velho [item=stone_axe]? Aposto que consegue derrubar uma árvore apertando [key=select] ao lado dela. + Todos os itens que você coletar vão para o inventário. Você pode abri-lo apertando [key=inventory]. + Se sua [tile=stamina] [color=006600]Energia[/color] acabar, você vai começar a perder [tile=health] [color=770000] Vida[/color], e se sua [tile=health] [color=770000] Vida[/color] chegar ao fim, você morre. + Por isso você precisa comer [item=berries], [item=fruit] e [item=meat]. Você pode fazer isso selecionando os itens no seu inventário. + Você já conseguiu tudo? Estou impressionado. + Vamos levantar esse [color=770000]Depósito[/color]! + Olha só! Não está orgulhoso? + É… vai ser bastante útil. Agora a gente não vai se cansar de carregar tanta coisa. + Podemos guardar rapidamente todo o peso extra usando os botões de Mover tudo, e apertar [key=quest] para marcar itens com uma estrela. Itens com estrela ficam no seu inventário quando você usar os botões de Mover tudo. + Devíamos conversar com o [object=farmer], aposto que ele pode nos ajudar a cultivar umas comidas gostosas. + Você viu aquela [object=miner] saindo de baixo da terra? Você devia ver o que ela quer. + O que acha de construirmos uma [color=770000]Cozinha[/color]? [item=meat] é bom, mas é melhor ainda se assarmos. + Vou precisar de [var=quest.kitchen.wood] troncos de [item=wood] e [var=quest.kitchen.coal] pedaços de [item=coal] para construir a [color=770000]Cozinha[/color]. + Parece que você está com tudo o que preciso. Hora de construir a [color=770000]Cozinha[/color]! + Você pode fazer comida na [color=770000]Cozinha[/color] enquanto tiver [item=wood] ou [item=coal] para queimar. + Sabe o que estou doido pra comer? Um pouco de [item=cheese]. Não tem nada mais delicioso! + Eu posso aprimorar a [color=770000]Cozinha[/color] para produzir [item=cheese] e criar novas receitas com [var=quest.kitchen2.wood] troncos de [item=wood] e [var=quest.kitchen2.steel_bar] [item=steel_bar default=Barras de aço]. + O que aconteceu com a minha linda [color=770000]Cozinha[/color]? É melhor você construir uma nova agora mesmo! Você pode construí-la usando uma [item=kitchen_blueprint]. + Parece que você está com tudo o que preciso. Vamos aprimorar a [color=770000]Cozinha[/color]! + Experimente as novas receitas! É quase um restaurante! + Cara, estou morto de fome. Espero que essa [color=770000]Fazenda[/color] fique pronta logo! +
+
+ Que alívio te encontrar, jovem. Pensei que estava sozinho, um velho neste mundo vazio. + Ainda tenho sangue nas veias e acho que posso te ajudar. Sei cuidar bem de uma fazenda, e todos precisamos de comida na mesa pra aguentar a labuta. + Que tal a gente construir um celeiro pra começar uma [color=770000]Fazenda[/color]? + Bacana! Vou cuidar do celeiro e plantar [item=wheat_seed]! + Agora sim temos uma [color=770000]Fazenda[/color]! Passe aqui de vez em quando pra colher plantas. Elas ajudam a recuperar sua [tile=stamina] [color=006600]Energia[/color]. Aqui. Fique com este [item=bread] pra te sustentar até a próxima colheita. + Você pode conseguir [item=wood] derrubando árvores. + Se quiser cultivar mais, basta plantar mais sementes! Você também pode cuidar das plantas e retirar plantações através do celeiro! + Olha só, que bela [color=770000]Fazenda[/color]! Tão boa quanto a que eu costumava ter lá na minha terra! Mas se você quiser plantar mais, eu posso fazer mais sementes. + [item=wheat] puro não é muito gostoso, mas aposto que a gente consegue algo melhor se você e o [object=builder] fizerem uma [color=770000]Cozinha[/color]. + Sabe do que essa [color=770000]Fazenda[/color] precisa? De animais! Que tal capturar alguns [color=770000][tile=boar] Javalis[/color] com a [item=net]? + Posso construir um [color=770000]Curral[/color] se me trouxer [var=quest.pen.pig] [item=pig]s e [var=quest.pen.wood] troncos de [item=wood]. + Esses são os [item=pig]s mais cevados e suculentos que você já viu, não acha? + Agora com o curral, podemos produzir [item=meat] e [item=milk]! + Se quiser construir mais [color=770000]Currais[/color], use a [item=pen_blueprint]. + Pra pegar um [item=pig], coloque uma [item=net] no chão e atraia um [color=770000][tile=boar] Javali[/color] ferido até ela. Com sorte, ele ficará preso e será domesticado! + Ordenhar uma [item=pig default=Porca]? Por que não? Essa é uma terra estranha. Mas bom mesmo seria se tivéssemos um pouco de [item=cheese]. Fale com o [object=builder] para aprimorar a [color=770000]Cozinha[/color]. + Espero que não se importe, mas eu fiz uma decoraçãozinha pro Festival da Colheita! Acho que uma comemoração seria boa pra nós. Eu também decorei o [color=770000]Depósito[/color] com [item=jakolantern default=Abóboras Iluminadas]. + A fazenda está crescendo bastante! Pra comemorar, eu encontrei [item=sugar_seed]! Que tal começar uma plantação de [item=sugar]? + Eu encontrei alguns comerciantes na [color=770000]Doca[/color] e consegui estas [item=cotton_seed]! + Temos muitas [item=fruit] por aqui. Com as sementes delas, acho que consigo cultivar um belo [color=770000]Pomar[/color]! + Ótimo, com esse tanto de [item=fruit], temos [item=orchard_seed] suficientes pra começar um [color=770000]Pomar[/color]! + Me avise quando tiver [item=fruit] suficientes pro [color=770000]Pomar[/color]! + Você pode plantar sementes em quadrados com grama se houver espaço vazio suficiente para colocá-las. Me mostre onde você quer plantar as [item=orchard_seed]! + Você também pode usar sementes para mudar plantações no [color=770000]Celeiro[/color]. Se quiser fazer mais sementes, é só me avisar! + A primeira neve chegou! O que é mais um bom motivo pra comemorar! Até fiz um [item=snowman] mágico com estas [item=ice_berries]. Espero que goste! + Estamos começando a nos sentir em casa aqui, não acha? Que tal dar um nome pra este lugar? + Use esta [item=area_name_sign] pra mudar o nome da ilha! +
+
+ Opa, oi! Eu não sabia que havia outros sobreviventes. + Eu estava ali embaixo. Tem muito mais coisas por lá do que se imagina. + Eu tenho outra picareta comigo se quiser dar uma olhada também. + Como vão as escavações? Talvez a gente deva construir uma [color=770000]Fundição[/color] para derreter o minério e fazer barras. + Maravilha! Me avise quando tiver [item=coal] suficiente! + Esse carvão é do bom! Vou terminar a [color=770000]Fundição[/color] num piscar de olhos! + A [color=770000]Fundição[/color] transforma o minério bruto em barras. Ela precisa de combustível para derreter o metal. Ainda bem que temos bastante [item=coal] por perto. + E aí, está esperando o quê? Aperte [key=down] e comece a cavar para encontrar minérios! + Minérios são pesados. Não esqueça de guardá-los no [color=770000]Depósito[/color] quando voltar. + É fácil se empolgar com a mineração, mas não esqueça de ter [tile=stamina] [color=006600]Energia[/color] suficiente para a volta. + Quanto mais fundo você cava, melhores são os minérios que você encontra. + Se você pretende cavar muito profundamente, é melhor levar algumas [item=torch]s. Elas iluminam a área quando equipadas, mas se apagam depois de um tempo. + Eu posso fazer algumas [item=torch]s se você precisar. + Que tal uma [color=770000]Oficina[/color] para transformar as barras de metal em ferramentas? Posso fazer uma com [var=quest.workshop.iron_bar] [item=iron_bar default=Barras de Ferro] e [var=quest.workshop.wood] troncos de [item=wood]. + Legal, vamos inaugurar a [color=770000]Oficina[/color]! + Na [color=770000]Oficina[/color], você pode criar rapidamente ferramentas ou itens, se tiver os materiais necessários. + Você precisa encontrar [item=iron] pra transformar em [item=iron_bar default=Barras de Ferro] na [color=770000]Fundição[/color]. + O [item=iron] fica bem abaixo da superfície, então leve esta [item=torch] para conseguir ver. Se ela apagar, fale comigo para eu fazer mais. + Assim que tiver [item=iron] suficiente, selecione [item=iron_bar] no menu da [color=770000]Fundição[/color] e ela fará o trabalho enquanto tiver combustível suficiente. + Você pode acrescentar tarefas à [color=770000]Fundição[/color] enquanto tiver ingredientes, e ela derreterá o minério um por um enquanto você estiver fora, desde que tenha combustível. + Se quiser escavar a [color=770000][tile=stone] Pedra[/color] para chegar ao [item=gold], você precisa fabricar uma [item=iron_pickaxe] ou uma [item=steel_pickaxe] na [color=770000]Oficina[/color]. + Se quiser escavar a [color=770000][tile=stone] Pedra[/color] para chegar ao [item=gold], você precisa equipar uma [item=iron_pickaxe] ou uma [item=steel_pickaxe]. Aperte [key=equipment] para gerenciar seu equipamento. + Você pode gerenciar seu equipamento e suas picaretas pressionando [key=equipment] para abrir a janela de Equipamentos. + Agora você também pode usar as [color=770000]Teclas de Atalho[/color].\nAperte [key=hotkey1], [key=hotkey2], [key=hotkey3] ou [key=hotkey4] na janela de inventário pra defini-las. + O que todo bom minerador precisa é de um bom [item=minecart] e de um sistema de [item=rail]s! Minérios são pesados, e seria fantástico ter uma maneira de transportá-los até o [color=770000]Depósito[/color]. + Você construiu um [item=minecart] e [item=rail]s? Perfeito! Vamos posicioná-los agora mesmo! + Veja só, eu posicionei o [item=minecart] e fiz um pequeno sistema de [item=rail]s! Você pode expandi-lo e mover os [item=rail]s usando um [item=crowbar] para desprendê-los! +
+
+ Roubaram [item={item}] do [color=770000]Depósito[/color]! + A ladra foi pega com a mão na massa! + Já é difícil sobreviver neste lugar sem ter que lidar com roubos! + Talvez eu tenha pego algumas coisas emprestadas. Mas escute. Eu posso compensar suas perdas oferecendo meus serviços. Tenho contato com muitos comerciantes de outras ilhas. + Comerciantes? Há mais sobreviventes por aí? + Aham. Mas vou precisar de [var=quest.market.gold_bar] [item=gold_bar default=Barras de ouro] para convencê-los a virem para cá. + Você vai cobrar da gente mesmo depois de nos roubar?! + Aquilo era outra coisa. Isto são negócios. Minha oferta é colocar esta ilha na rota de comércio em troca de [var=quest.market.gold_bar] [item=gold_bar default=Barras de ouro]. + Tá bom. Se há mais sobreviventes por aí, comercializar com eles pode nos ajudar a sair daqui. + Desculpe, não posso confiar numa ladra. Saia desta ilha e não volte nunca mais. + Então tá. Há outras ilhas muito melhores que esta para roubar. Você nem imagina a oportunidade que perdeu. + Perfeito! Sinto que será o começo de uma relação bastante lucrativa entre nós. + Fique com esta [item=coin_purse]. Você vai precisar de moedas para comprar e vender coisas. Recomendo comprar uma [item=mega_backpack] assim que possível, vai ser uma mão na roda! + No [color=770000]Mercado[/color], você pode trocar seus itens por moedas e usá-las para comprar o que quiser. + O [color=770000]Mercado[/color] recebe novos carregamentos de vez em quando. Se não achar o que procura, volte mais tarde que eles têm. + Para fazer uma [item=gold_bar], você precisa derreter [item=gold], que só se encontra em grandes profundidades. A [object=miner] pode te dar algumas dicas de como chegar lá. + Você está interessado em ver o resto do mundo? Que tal construir uma [color=770000]Doca[/color]? + Eu construo uma para você se me trouxer [var=quest.dock.coins] [color=770000][tile=coin_purse.ico] Moedas[/color], [var=quest.dock.wood] troncos de [item=wood], [var=quest.dock.cloth] [item=cloth]s e [var=quest.dock.net] [item=net]s. + Beleza, vamos construir essa [color=770000]Doca[/color]! + Depois que construir um [tile=boat.ico] Barco no [color=770000]Estaleiro[/color], você poderá velejar pelo mar! + A [color=770000]Doca[/color] custa [var=quest.dock.coins] [color=770000][tile=coin_purse.ico] Moedas[/color], [var=quest.dock.wood] troncos de [item=wood], [var=quest.dock.cloth] [item=cloth]s e [var=quest.dock.net] [item=net]s. + Aceitar oferta + Mandar embora + Não está um ótimo dia para velejar? + Alguém roubou tudo! Todo meu trabalho duro! Quem faria uma coisa dessas?! + Agora que você tem itens espalhados em várias ilhas, seria ótimo poder transferi-los de um depósito para outro, não acha? Com meu novo dispositivo de transporte, isso é possível - por uma pequena taxa! + De qual ilha você deseja transportar itens? + Posso transportar itens de [color=770000]{area}[/color] por 0.20 [color=770000][tile=coin_purse.ico] Moedas[/color] por unidade de peso. Me mostre quais itens você quer transportar: + Para qual ilha você deseja transportar os itens selecionados por {coins} [color=770000][tile=coin_purse.ico] Moedas[/color]? + Os itens já estão a caminho. Eles estarão lá na sua próxima visita. Me avise se quiser transportar mais itens. Foi um prazer fazer negócios com você! +
+
+ Há mais coisas neste planeta do que se imagina. Andei fazendo alguns experimentos e acho que descobri a existência de magia! + Preciso de alguns materiais. Se por acaso encontrar uma [item=wyrm], mate-a e traga o [item=dragonblood] dela para mim, e te darei uma recompensa. + Eu sabia! Este é o segredo! Preciso montar um laboratório imediatamente! + A recompensa? Traga materiais para o meu laboratório e eu farei uma poção mágica para você. + Rápido! Minha pesquisa está parada até eu conseguir o [item=dragonblood]! + Preciso de mais [item=dragonblood]! Traga-me [var=quest.wyrm_pen.wyrm] [item=wyrm]s vivas e teremos um suprimento sem fim de [item=dragonblood] para realizar experimentos! + Excelente! Fique para trás enquanto faço minha magia! + Contemple minha magnífica invenção: a [color=770000]Gaiola[/color]! Não é só uma gaiola qualquer, é uma fonte inesgotável de [item=dragonblood]! + Aposto que você consegue capturar uma [item=wyrm] com uma [item=net], se ela estiver ferida. Mas você precisa capturá-la viva! + Precisamos fazer mais experimentos com as [item=wyrm]s! O que elas comem? Por que elas nos fornecem [item=dragonblood]? Você precisa alimentar as [item=wyrm]s na [color=770000]Gaiola[/color] para descobrimos mais sobre como evoluem! + Eu sabia! As [item=wyrm]s realizam metamorfose e se transformam em [item=dragon default=Dragões]! Mas então por que há tão poucos [item=adult_dragon default=Dragões adultos] nesta ilha? + Acredito que exista um covil de dragões em algum lugar desta montanha. Se você o encontrar, me chame... Talvez possamos descobrir alguns segredos nele. + Ah, um [item=adult_dragon default=Dragão-fêmea adulto]! Vejamos o que ela tem a nos dizer. Posso traduzir para você com um feitiço simples. + Quem são vocês, que me acordam de um longo descanso? + Eu busco a verdade e a magia. Diga-me: por que não há mais tantos dragões neste mundo? + Porque os ancestrais se foram. Eles também buscavam a verdade e a magia. E eles traíram a minha espécie. + Então talvez possamos te ajudar! Tudo o que queremos em troca é sabedoria. + Acham mesmo que podem ajudar? Então provem. Se conseguirem criar [var=quest.hatch_dragons.dragon] [item=dragon default=Dragões] e trouxerem para mim, então conversaremos. Caso contrário, sumam daqui! + Eu sabia que iriam me trair! Provem da minha ira! + Acho melhor não acordar ela de novo até termos os [item=dragon default=Dragões]. + Conseguiram? Então talvez ainda haja esperança para a minha espécie. + Excelente! Então, pode nos ensinar os segredos da magia? + Infelizmente, eu não conheço os segredos que você procura. Os ancestrais nos criaram e construíram este covil para que pudéssemos crescer. + Porém, talvez haja respostas nas ilhas a leste daqui. Voltem a este covil quando estiverem preparados e levarei vocês até lá. + Outro covil de dragões! Imagine quantos dragões já foram criados em covis como este usando magia! Por que será? De qualquer forma, deixe eu ativar este covil. + Também construí uma [color=770000]Gaiola[/color] aqui, caso precisemos criar mais dragões! Mas nem pense que eu vou colher [item=dragonblood] aqui, tenho coisas importantes para pesquisar. + Onde você deixou o dragão? Vou chamá-lo para cá. Tente não perdê-lo de vista. + Eu sabia! Este covil não é natural, é feito de magia! Parece que ele foi construído com a intenção de criar dragões! + Acho que consigo reativá-lo... + Aha! Pronto! Com este covil, podemos criar nossos próprios dragões. O covil parece apontar para o leste. Quem sabe a gente possa voar com um dragão naquela direção e descobrir mais coisas... + Deixe eu dar uma olhada nesse [item=rusty_axe]... É difícil de entender com toda essa ferrugem, mas eu reconheço estes símbolos! + Há uma magia antiga nele, mas ela está se esvaindo. Se me trouxer o ingrediente mágico certo, talvez eu possa consertá-lo... + Essa [item=fire_tusk]... Com que tipo de criatura você a conseguiu? Ela parece vibrar com o [item=rusty_axe]. Talvez seja o ingrediente mágico que procuramos! + Consegui! Quem será que fabricou esse [item=thunder_axe]? E quão antigo ele é? Se quiser fazer mais machados como ele, eu deixei a fórmula no laboratório. + Deixe-me ver essa [item=dark_fur]! Parece que ela coexiste entre o mundo dos espíritos e o mundo dos vivos... + Preciso estudá-la mais a fundo. Posso facilmente transformá-la em uma [item=shadow_cape] que pode te deixar invisível aos olhos comuns. Eu acrescentei a fórmula ao laboratório. + Esta ilha transborda magia. Com toda a certeza, estamos no lugar certo! + Já vi esse tipo de magia antes. Estas estruturas são parcialmente orgânicas e estão em estado de hibernação. Vamos precisar acordá-las. + Eu já sei como ativar esta câmara púrpura, mas as outras estruturas precisam de maiores estudos. + Este local pode ser uma boa base de operações. Vou buscar suprimentos. + O segredo para ativar as outras estruturas talvez esteja com as [item=wyrm]s. + Siga uma delas nesta ilha e descubra seus segredos, enquanto eu trabalho na tradução destas marcações. + Não se preocupe. Você já lidou com [item=wyrm]s antes. Seguir uma delas até o ninho não será um problema! + O quê? Havia uma Larva rainha? Não importa, olhe esta [item=spirit_gem] que você encontrou! Estou certa de que ela é o que precisamos para descobrir algo novo! + Aqui, experimente estes [item=goggles]. Eu os inventei com a ajuda das marcações. Eles não me ajudaram a descobrir o segredo destas estruturas, mas talvez possam te ajudar a enxergar algo que ainda não percebemos. + Você precisa seguir as [item=wyrm]s na ilha ao leste, não aqui! Eu já estudei as [item=wyrm]s daqui! + Preciso de mais tempo para analisar isso. Que tal descansar na câmara púrpura? + Aquela floresta ao leste parece perigosa. Vou colocar uma [item=fence] ali e recomendo que você não a ultrapasse. + Cheguei à conclusão que uma [item=spirit_gem] pode capturar um espírito do fogo ou da água, o que nos dará uma [item=fire_gem] ou uma [item=water_gem]. Essas pedras elementais podem nos ajudar a ativar as estruturas. + Está com problemas para encontrar os espíritos elementais? Eles são invisíveis a olho nu, mas meus [item=goggles] devem revelá-los! + Você pode preparar uma armadilha colocando uma [item=spirit_gem] no chão e atraindo os espíritos até ela para capturá-los! + Agora todas as estruturas estão ativadas! Acho que merecemos um descanso na câmara púrpura antes de continuar nossas pesquisas! + O que está esperando? Use a [item=water_gem] na estrutura azul para ativá-la! + A estrutura azul é um sintetizador mágico! Ele pode criar itens usando magia! + Use [item=focus_gem default=Pedras focais] para alimentar o sintetizador. + Ainda precisamos de uma [item=water_gem] para ativar a estrutura azul! Use uma [item=spirit_gem] para capturar um elemental da água! + O que está esperando? Use a [item=fire_gem] na estrutura vermelha para ativá-la! + A estrutura vermelha parece ser uma antiga forja mágica. Ela pode encantar itens! + Experimente combinações diferentes de itens e ingredientes mágicos na Forja. Talvez você consiga criar algo interessante! + Ainda precisamos de uma [item=fire_gem] para ativar a estrutura vermelha! Use uma [item=spirit_gem] para capturar um elemental do fogo! + Eu estive meditando profundamente, tentando compreender os segredos das [item=wyrm]s. + Se você me trouxer [var=quest.alter_gem.wyrm] [item=wyrm], [var=quest.alter_gem.fire_tusk] [item=fire_tusk] e [var=quest.alter_gem.yeti_fur] [item=yeti_fur], eu poderei concluir minha pesquisa. + Consegui! Eu criei uma [item=alter_gem]! Ela nos ajudará a transformar [item=wyrm]s - e provavelmente outras criaturas - em equipamentos úteis! + Precisamos continuar a explorar esse tipo de magia! Pegue esta [item=alter_gem] e experimente usá-la em uma [item=wyrm]! Se precisar de mais [item=alter_gem default=Pedras da mutação], eu acrescentei a fórmula ao sintetizador. + Para usar a [item=alter_gem], encontre-a em seu inventário, selecione Transformar e escolha uma criatura para transformar. + Não tenha medo de experimentar [item=alter_gem default=Pedras da mutação] em outras criaturas… como um [item=dragon], por exemplo. Ou, se me permite sugerir - em um [item=adult_dragon]?! + Está quase sem [item=alter_gem default=Pedras da mutação]? Você pode encontrar mais delas em grandes profundidades ou fabricá-las no sintetizador. + Não esqueça de que as criaturas precisam estar bem alimentadas para usar uma [item=alter_gem]. A transformação não vai durar muito tempo em criaturas famintas! + Você não caiu aqui com os outros depois da colisão? + Não, eu fazia parte de uma missão de reconhecimento para o programa de colonização. + Éramos quatro. Mas os outros três morreram. Logo depois, quando eles vieram, eu percebi que este planeta estava amaldiçoado. + Sobrevivi por um fio usando a magia que aprendi. Talvez se eu tivesse os [item=goggles] na época, as coisas teriam sido diferentes. + Eles estavam aqui?! Procurando por você? + Sim. Acho que eles tinham inveja da minha magia. Ou será que era medo? Difícil dizer... + Você os encontrou neste planeta há dez anos atrás? Isso foi antes de eles tentarem dizimar a humanidade e destruir a Terra! + Exato. Eu fui o primeiro a ter contato com eles, e o primeiro a quem tentaram matar. + Eu não sei o que poderia ter feito de diferente para impedir a guerra. Eles chegaram de repente com suas armas biológicas e atacaram sem nenhum aviso. + Se ao menos houvesse uma forma de nos comunicarmos com eles... + Acho que agora poderíamos nos comunicar com eles usando meu tradutor mágico. + Mas, com sorte, nunca mais os veremos novamente, agora que parecem satisfeitos e nos ignoram. + Ultimamente tenho notado picos muito estranhos de energia mágica. Pode não ser nada, mas também pode ser algum deles. + Se descobrir algo, me chame imediatamente. Se for realmente um deles, estaremos em grande perigo. + Certo, vejamos se meu tradutor funciona! + Quem é você e o que faz aqui? + Com que direito fazei-me esta pergunta? Este é o meu lar, o meu planeta! Vós sois os invasores aqui! + Esse exoesqueleto mágico me parece familiar... Você é um deles? + Estes a quem chamais de "eles" são meus tolos irmãos. Há muito, eles decidiram abandonar o nosso planeta natal, enquanto eu permaneci e escolhi o caminho da solidão e da imortalidade. + Você pode nos falar sobre a sua magia? O que são esses picos de energia mágica? Por que decidiram criar os dragões? + Silêncio! Não falamos de tais assuntos com seres como vós! Já estaríeis mortos há muito tempo se eu não tivesse sido tão benévola. + Porém, agora percebo que meus irmãos estavam corretos sobre algo. O universo seria um lugar melhor sem vós e vossa estirpe! + Arrepender-vos-eis por me perturbar! + Não! + O que houve? Não vencemos? + Não fomos rápidos o suficiente! Ela transmitiu um sinal. Eles vão saber que estamos neste planeta! + Precisamos aprender toda a magia possível e usar este poder contra eles quando chegarem! Caso contrário, estaremos perdidos. + Vós dominais a magia mais habilmente do que eu imaginava! Isto não pode ser permitido. O domínio da magia pertence a nós! + Ela está transmitindo um sinal! Se eles receberem, virão até aqui! Preciso terminar isso rápido! + O que aconteceu? Você está bem? + Não…[pause=4] O sinal foi enviado…[pause=4] E minha força vital foi totalmente consumida… + Agora é com você…[pause=4] Vá!…[pause=4] Encontre as respostas… Use a magia deles… + [tile=alchemist anim=alchemist.idle] Vou invocar uma barreira de defesa e uma magia de cura. Fique atrás de mim quando ela atacar, e acerte-a quando ela estiver recuperando as forças. + [tile=alchemist anim=alchemist.idle] Ataque agora! + [tile=alchemist anim=alchemist.idle] Estou identificando um pico de energia mágica! Acho que minha barreira não vai suportar a força deste ataque! + O que você está fazendo aqui?! + Estou usando o laboratório para analisar as amostras da ilha do leste. + Mas... Como você voltou tão rápido? + Da mesma forma que vou a qualquer lugar! Por teletransporte, obviamente. Agora não me atrapalhe, preciso concluir minha análise. + Síntese elemental… carapaça reforçada… evolução ininterrupta… [font=drachenklaue]bla bla bla[/font]... + Você não é páreo para esta criatura. Precisaremos de um plano se quisermos sobreviver! + Trabalhar em equipe + Deixar o Alquimista lutar + Para trás! Esta luta não é para amadores! +
+
+ Estou com muito frio…[pause=1] e morrendo de cansaço…[pause=1] Preciso me abrigar, mas não tem nada aqui além de galhos no chão! + Quase não estou conseguindo carregar a [item=wood]! Agora gastarei mais [tile=stamina] [color=006600]Energia[/color] para me mover, mas não posso parar, preciso encontrar abrigo! + O que é esta estrutura? Parece que alguém começou a fazer um abrigo, mas não terminou. Acho que consigo terminá-lo com [var=quest.hut.wood] troncos de [item=wood]. + Eu tenho {count} dos [var=quest.hut.wood] troncos de [item=wood] necessários para terminar esta [color=770000]Cabana[/color]. Preciso coletar mais madeira. + Deixei {added} troncos de [item=wood] na [color=770000]Cabana[/color]. Preciso de mais {remaining} para terminá-la! + Este machado pode ser bem útil. Com ele, eu posso construir um [color=770000]Depósito[/color] para estocar os materiais que eu conseguir. + Acho que consigo fazer um depósito com [var=quest.storehouse.wood] troncos de [item=wood] e [var=quest.storehouse.berries] [item=berries]. + Beleza! Vamos erguer esse depósito! + Perfeito. Agora não precisarei me cansar carregando itens demais. + Será que a ladra estava falando a verdade sobre os outros sobreviventes? + Talvez eu deva construir uma [color=770000]Doca[/color] e tentar encontrá-los. Vou precisar de [var=quest.dock2.wood] troncos de [item=wood] e [var=quest.dock2.steel_bar] [item=steel_bar default=Barras de aço]. + Certo, vamos construir essa [color=770000]Doca[/color]! + Talvez, se eu construir um [color=770000]Mercado[/color], ele atrairá comerciantes para a doca. Eu consigo construir um com [var=quest.market2.gold_bar] [item=gold_bar default=Barras de ouro]. + Tenho tudo o que preciso para construir o [color=770000]Mercado[/color]! + Pelo visto realmente haviam comerciantes em outros lugares! Até me deram uma [item=coin_purse] para guardar moedas e usar no mercado. + Agora só precisamos construir um [tile=boat.ico] Barco no [color=770000]Estaleiro[/color]! + Eu não sei o que me espera, mas quero descobrir antes de retornar. + Traga comidas boas quando voltar! + Não se esqueça de explorar embaixo da superfície. Nunca se sabe o que pode encontrar. + Não vai esquecer a gente aqui. Volte logo! + Não se envolva em nenhuma confusão. + O mundo é estranho para além dessas águas. + Você está indo para o lado errado! Os segredos estão a leste desta ilha! + É ótimo voltar aos negócios! Mas se ao menos pudéssemos nos livrar desses malditos bandidos! + Você parece ser forte. Acha que consegue expulsá-los para nós? + Você conseguiu derrotar os bandidos! Por favor, aceite este presente como nosso agradecimento. + Que sorte a nossa! A vítima veio andando direto até nós! As coisas estão cada vez melhores desde que escapamos daqueles Mirrows e de suas experiências sinistras! + Este lugar é estranho. É como se eu tivesse entrado em outra dimensão. Acho que sempre que eu entrar aqui, será diferente de antes. + Você precisa ter uma [item=coin_purse] se quiser fazer compras aqui. Podemos te dar uma em troca de [var=recipe.sci1_coin_purse.sulfur] unidades de [item=sulfur]. + Trocar [var=recipe.sci1_coin_purse.sulfur] unidades de [item=sulfur] por uma [item=coin_purse]? + Ei, você! Está procurando alguma raridade? Não vai encontrar nada disso em outro lugar! + Foi bom fazer negócios com você. Lamento, mas não tem reembolso. +
+
+ É melhor não descansar em uma cabana de desconhecidos! + Esta deve ser a cabana do [object=hunter]. Melhor não entrar. + Ei, você! Viu como eu derrubei aquele javali? + Sim… Como você fez aquilo? + Simples! Tudo o que você precisa é de um pouco de técnica. + Estou tentando limpar essa área. Se você me ajudar, posso te ensinar como caçar. + Você precisa usar o elemento surpresa. Se atacar os inimigos pelas costas, você conseguirá um acerto crítico. + Aqui, pegue esta [item=workbench]. Você pode usá-la no seu inventário para fazer suas próprias armas! + Eu prefiro [item=bow]s porque assim não preciso chegar perto dos inimigos. Mas se quiser usar armas de corpo-a-corpo, um [item=buckler] ajudará a bloquear ataques! + Aperte [key=equipment] para equipar uma arma, [key=attack] para atacar com a arma equipada e [key=defend] para bloquear com o escudo. + Que tal fazer seu [item=bow] e matar alguns [color=770000][tile=boar] Javalis[/color]? Se precisar de algumas dicas, pode me perguntar! + Você parece perigoso. Saia do nosso território! + Ah, então tá! Vou voltar para as montanhas, então! + Pronto para aprender algumas técnicas de caça? + Vamos limpar esta área de animais perigosos rapidinho! + Aceite minha velha [item=backpack] como presente pelo trabalho bem feito. Ela pode ser bastante útil na sua jornada. + Você pode escavar um túnel e acertar os javalis pelas costas, de surpresa. + Você pode usar [item=red_berries] para aumentar seu poder de ataque temporariamente. Mas cuidado, porque elas não fazem bem para a saúde. + Se o inimigo sempre bloquear os ataques, significa que ele é muito forte para você. Você vai precisar de uma arma melhor ou um ataque mais forte. + Definir um atalho para as [item=arrow]s permitirá que você as dispare enquanto tiver o [item=bow] no inventário, mesmo sem equipá-lo! + E lá estava eu, tremendo e sozinho na montanha escura, quando avistei a claridade de uma fogueira! E ouvi risos! Me pareceu muito convidativo... + E foi aí que você desceu a montanha para falar com a gente? + Claro que não. E eu também não estava caçando javalis para impressionar vocês. Nada disso. + Eu simplesmente queria aumentar minha área de caça. + Eu quero conhecer melhor este lugar e saber se existe algo mais além desta ilha… + Há outras ilhas a leste daqui. Eu já as avistei do alto da montanha. + Acha que podemos ir até elas? + Difícil dizer. Aquele lado da ilha tem um litoral traiçoeiro. Além disso, as outras ilhas me pareceram bem estranhas. Pode ser perigoso. + Então você está dizendo que devemos nos dar por satisfeitos com a vida aqui? + Estou dizendo que não precisamos procurar mais problemas, porque a vida aqui já não é nada fácil. + Eu quero manter a vida selvagem daqui sob controle. + Use a [item=workbench] que te dei para fazer [var=quest.fence.fence] [item=fence]s, e então poderemos delimitar um perímetro. + Perfeito. Os [color=770000][tile=boar] Javalis[/color] não conseguem atravessar a [item=fence], então podemos usá-la para proteger a nossa vila. + Vou colocar uma aqui. Coloque as outras [item=fence]s ao redor da base para protegê-la! + Eu avistei um filhote de lobo vagando pela vila. Ele parece solitário. + Ele não tem uma alcateia? + Talvez tenham deixado ele para trás. + Com [var=quest.wolf.net] [item=net]s, [var=quest.wolf.trap] [item=trap]s e [var=quest.wolf.meat] pedaços de [item=meat], talvez possamos domesticá-lo. + Ok, vamos ver se conseguimos pegar o filhote. + Bom trabalho, parece que ele confia em você. Agora você tem um companheiro leal. + Se quiser que o [item=wolf] te acompanhe, defina-o como seu [color=770000]Companheiro[/color] na janela de [color=770000]Equipamentos[/color]. +
+
+ Está tudo queimado! Que porcaria! + O que aconteceu? + Os Mirrows tentaram redirecionar a energia elétrica e quase jogaram tudo pelos ares! + Eles esperam que a gente limpe a bagunça deles… humf! + Não tenho mais [item=titanium], então não consigo consertar... + Uau! Eu não imaginei que você realmente conseguiria trazer o [item=titanium]. + Obrigada, agora posso consertar tudo rapidinho. + Voltamos à ativa! Podemos usar [item=coal] ou [item=refined_oil] para abastecer a usina. Você também pode fabricar uma [item=battery] aqui. + Ah, e pode ficar com essa sucata que sobrou dos reparos como agradecimento pelo [item=titanium]! + Nunca mais vou conseguir encontrar [item=titanium], é inútil! + Me avise quando tiver feito uma [item=battery]. Poderemos fazer muitas coisas legais quando tivermos uma fonte de energia portátil! + Use [item=sulfur] e uma [item=steel_bar] na [color=770000]Usina[/color] para fabricar uma [item=battery]. Você também pode recarregar a bateria lá. + Basta adicionar uma [item=battery] ao seu inventário para alimentar seu equipamento. + Sua [tile=power] [color=444400]Carga elétrica[/color] total será mostrada logo abaixo das barras de [tile=health] [color=770000]Vida[/color] e [tile=stamina] [color=006600]Energia[/color]. + Agora que a eletricidade finalmente voltou, seria bom ter algumas máquinas para brincar. + Se você me ajudar a erguer uma [color=770000]Fábrica[/color], poderemos produzir todo tipo de coisas! + Vai ser incrível. Finalmente um novo projeto para trabalhar! + Agora podemos refinar materiais e construir [item=drill]s, [item=chainsaw]s, [item=shotgun]s e outras coisas interessantes. + Notei que você tem feito muitas escavações. + Não seria conveniente ter um mecanismo para te ajudar a trazer todos os materiais para a superfície?! + Legal! Vamos nessa! + Vai subir! Aliás: vai descer! + Precisando de reparos? Deixa comigo! + Que criatura de fogo é aquela, alimentando a usina? Se aquilo quebrar alguma coisa, vai se ver comigo! + Aqui há mais sobreviventes do que eu imaginava! + É? Mas não é suficiente. Se quisermos sobreviver como espécie, precisamos nos juntar às outras colônias. + Acha mesmo que eles sobreviveram? + Tenho certeza que eles estão em algum lugar por aí. Só precisamos encontrar um jeito de chegar até eles. + E se nos atacarem no caminho? + Então pelo menos tentamos! Eu não pretendo ficar em reclusão neste planeta só porque ele parece seguro por enquanto. + Ei, qual é o problema? Você parece triste. + Eu tentei pedir aos Mirrows que parassem de importunar as pessoas, mas eles não me ouviram, e eu não quero lutar contra eles. + Você fez bem em tentar. Mas eles são teimosos como uma mula e só mudam de ideia na base da força. + Ainda não vou desistir. Não é justo que eles abusem do poder que possuem. + Talvez seja uma boa ideia aprender o máximo que puder sobre eles. Já explorou toda a área ao redor do laboratório deles? + Você é a tal “C” nos registros do laboratório dos Mirrows? Já trabalhou para eles? + Não… Mais ou menos. Eles... [pause=4]Eles são meus pais. + Seus pais!? Se você é a filha deles, então talvez te ouçam. Você pode falar com eles? + Acredite, eu já tentei. Bom senso não é o forte deles. São obcecados pelos “aprimoramentos” deles e ignoram qualquer outra solução para os nossos problemas. + Nós precisaríamos de algo muito especial para fazê-los mudar de ideia. Algo que não pode ser explicado pela ciência. + Que tal esta [item=dragon_armor]? Ela tem o poder de um [item=adult_dragon], mas pode ser usada como uma armadura! + É muito estranha, mas com certeza vale a pena tentar. Vamos mostrá-la para os meus pais. + Já está de volta? Desta vez, finalmente transformaremos você em ciborgue! + Esperem! Não ataquem! Sou eu. + Cass? O que você está fazendo aqui? + Deem uma olhada nisso. Talvez vocês não precisem mais transformar as pessoas em ciborgues. + O que é essa coisa? O nível de poder dela é imensurável! Nem parece ter sido feita por humanos! + Se eu contar para vocês, vão parar de extorquir e fazer experimentos com as pessoas? + Claro, isso pode representar toda uma nova linha de pesquisa para nós! + Pelo visto, a espécie que habitou originalmente este planeta criou os dragões e todo o equipamento mágico. E essa espécie pode ter sido... Eles. + Vamos usar sua própria criação contra eles! Mas que bela ironia! + Você sabe que horas são? Com certeza o que você precisa pode esperar até a manhã... +
+
+ Boas-vindas à Clave Dourada! Temos os melhores (e únicos) quartos deste lado do deserto! + Então aqui é uma hospedaria? Vocês recebem muita gente aqui? + Algumas poucas pessoas passam pela Enseada do Poente, explorando, vendendo mercadorias ou procurando um novo lar. + Mas se não reativarmos a energia rápido, não sei se muitos irão querer continuar por aqui. Já perdi as contas de quantas vezes tive vontade de ir até aqueles Mirrows e dizer umas poucas e boas a eles! + Maravilha! A eletricidade voltou! + Não graças aos malditos Mirrows, né? Ainda não acredito que a gente paga uma taxa a eles para manter a tecnologia funcionando por aqui! + Como se não bastasse eles quebrarem a usina, também não podem perder seu precioso tempo e vir aqui para consertar! + Por que vocês não param de pagá-los? + Eu não posso deixar a hospedaria, mas se alguém fosse até o deserto e os enfrentasse, talvez a gente possa voltar atrás com esse acordo injusto. + Infelizmente você não pode descansar aqui enquanto a eletricidade não voltar. + Deseja passar a noite aqui? São apenas 50 [color=770000][tile=coin_purse.ico] Moedas[/color], com refeição inclusa! + Não tem dinheiro suficiente? Então infelizmente não poderá se hospedar. Não fazemos caridade aqui. + É verdade que a nave principal colidiu aqui pelas redondezas? Como vocês sobreviveram sem as cápsulas de fuga? + Esse é justamente o nosso problema. Os Mirrows nos salvaram. Foi inacreditável. Eles fizeram algumas alterações de última hora e evitaram que um setor inteiro fosse dizimado. Desde então, estamos em dívida com eles. + Mas agora eles acabaram com a nossa fonte de eletricidade e estão deixando criaturas estranhas soltas, causando estragos. + Soube até que algumas pessoas se perderam no deserto, na região onde os Mirrows foram vistos pela última vez. + E eles esperam que a gente aguente isso tudo calado? E até que pague as taxas deles? É um absurdo. + Os Mirrows concordaram em parar com a extorsão e com os experimentos! + Excelente! Quem sabe agora teremos um pouco de paz por aqui. + Aqui, pegue isto como forma de agradecimento. + ... [item=coal]? + O quê? Eu não sou o papai noel, né? +
+
+ Finalmente terra firme! Pelo visto, você também acabou de chegar! + Olá! É bom ver outros sobreviventes navegando por aqui! + Não se preocupe com ela. Esse é o jeito da Polly dizer olá. Espero que não se importe com um pouco de água nas botas! + Então, você já esteve nesta ilha antes? + Então, você sabe qual ilha está adiante? + Claro, esta ilha é chamada Enseada do Poente, e tem mais sobreviventes que qualquer outra ilha que eu já vi. + Com certeza. A ilha é chamada Enseada do Poente, e tem mais sobreviventes que qualquer outra ilha que eu já vi. + Faz sentido, já que foi nela que a nave principal colidiu. + Mas é melhor tomar cuidado. Soube de alguns rumores ruins sobre a Enseada do Poente ultimamente... + Ei, a Peri, minha [item=cat default=gata], fugiu de novo! Você pode me ajudar a encontrá-la? + Eu acho que ela está evitando viajar de barco. Ela não é muito fã da água. + Se você me ajudar, eu te ensino tudo o que sei sobre pesca. + Maravilha, muito obrigado! Tome aqui esta [item=fishing_rod]. Fale comigo se quiser dicas de como pescar! + [item=toothfish] é a comida favorita da Peri. Talvez você consiga a atenção dela com um desses peixes. + Ei, você encontrou minha [item=cat default=gata]! Obrigado, cara. + Uau, parece que você conquistou mesmo a confiança dela. Acho que ela vai ser mais feliz com você. O que acha de ficar com ela? + A gata é rápida demais para agarrar! + Ela pegou a [item=toothfish] da minha mão, mas eu não consigo pegá-la, é muito rápida. + Dar [item=toothfish] para a Peri? + Ela não saiu correndo tão rápido dessa vez. + Aqui, Peri... boa menina... + A gata foi pega com sucesso! + Pescar é uma questão de saber o momento certo. Vá até a doca, use a vara de pesca e aperte [key=select] quando perceber que fisgou algo. Se puxar cedo ou tarde demais, você perderá o peixe! + Se aparecer “Espere...”, o peixe ainda está desconfiado. Espere até aparecer “Puxe!” e então aperte [key=select] de novo! + Alguns peixes são mais difíceis de pegar e você precisará apertar outras teclas. Fique de olho na dica e aperte a tecla que aparecer! + Por mim, tenho tudo que preciso aqui. Um teto para morar, um dia ensolarado e um vasto oceano para pescar. + E você? Qual é o seu sonho? + Eu queria muito descobrir se existe uma maneira de sair deste planeta. + Ahn? Mas por quê!? Você quer se matar? Aquelas coisas não têm misericórdia. + Eu quero saber mais sobre eles… E sobre por que as coisas aconteceram dessa forma... + Escute, amigo... Eu vi um de perto antes de sairmos da Terra. Tudo o que você precisa saber é como evitá-los. +
+
+ Vocês dois são os Mirrows? Por que vivem atormentando a Enseada do Poente e criando esses mutantes estranhos? + Você não entenderia! Estamos fazendo isso pelo bem de todos! Nós não conseguiremos sobreviver sem armas poderosas! + Quando eles vierem exterminar os últimos de nós que sobreviveram, estaremos preparados! Sacrifícios são necessários. + Vocês não podem sair por aí sacrificando pessoas por um futuro que talvez nem aconteça! Há outras maneiras de salvar a todos! + Se você está disposto a nos confrontar, não temos outra escolha senão acabar com você. + Tenho a impressão de que o seu corpo é justamente o que eu preciso para a minha nova invenção ciborgue! + Inacreditável! De alguma forma, você é mais forte que eu, mesmo com toda a nossa cibernética avançada! + Você precisa nos contar o segredo de sua força. Talvez você seja a chave para salvar a humanidade! + Se eu contar meus segredos, vocês irão parar de extorquir e importunar as pessoas? + Sem dúvidas. Para que precisaríamos daquelas cobaias medíocres se tivermos você!? + É a oportunidade de abrirmos toda uma nova linha de pesquisa! + Fique à vontade para usar o nosso bloco cirúrgico. Temos muito interesse em ver o quão poderoso você vai ficar com os nossos aprimoramentos cibernéticos! + Você pode remover aprimoramentos cibernéticos a qualquer momento na sua janela de equipamentos, selecionando remover. Você pode reinstalar os aprimoramentos depois, mas isso custará mais recursos. + Parece que a tela de navegação ainda está funcionando. De acordo com os dados, estamos em Unoiks 428c. + Foram os Mirrows que inseriram esta informação?! Preciso perguntar a eles sobre isso... + Estamos no planeta natal do inimigo? Tem certeza? + Não há como saber... Mas pegamos amostras de muitas ruínas deste planeta. Elas não apenas combinam com a tecnologia deles, mas também datam de mais de um milhão de anos atrás! + Mas eles desapareceram? + Não detectamos nenhum deles no planeta, mas mesmo que não estejam mais aqui, é certo que voltarão algum dia. + É por isso que estamos dispostos a sacrificar tudo por poder... Um confronto com eles se tornou inevitável desde o dia em que pisamos neste planeta. +
+
+ Nada mal... Quem será que começou a construir essa cabana? E por que parou? Parece bem recente... + Socorro…[pause=4] por favor…[pause=4] abrigo… + Tem alguém lá fora! Será que posso confiar? + Obrigado. Te devo a minha vida. Já tinha perdido as esperanças... Estava cansado e com fome demais para terminar este abrigo. Mas o que a gente faz agora? + Por enquanto, nos mantemos secos e aquecidos. + Mas e depois? Como vamos sobreviver nesta ilha deserta? + Tem algum sentido nisso? Estamos presos e não tem como voltar. + A gente pode tentar, pelos menos. Talvez a vida aqui não seja tão ruim quanto você imagina. + Por favor…[pause=4] ajuda… + …Então quando cheguei na ilha, eu comecei a cavar e não percebi a tempestade se aproximando. + Mas ainda bem que encontrei vocês. Já estava cansada de tanta poeira. E nada melhor que uma boa fogueira depois de um longo dia no subsolo. + Você acha que há mais sobreviventes por aí? + Sinceramente, estou surpresa de terem sobrevivido àquela colisão. Mas se estamos aqui, talvez haja outros também. + Aposto que vocês jovens acham que isso aqui é o fim do mundo. Mas eu também pensava assim durante a 3ª Guerra Mundial e aqui estamos nós. + Se querem saber, eu acho que a gente só precisa fazer o possível com o que tem, e agradecer pela boa comida e companhia. + Mas quanto tempo vamos ter que viver nesta ilha no meio do nada? + Quem vai saber? Mas enquanto houver vida, há esperança. Com o tempo, talvez a gente se sinta em casa nesta ilha. + Então, o que você sabe sobre os outros sobreviventes? + Muitos de nós estão espalhados por outras ilhas. Algumas delas têm mais sobreviventes do que esta, e até mesmo mais tecnologia. + Também ouvi dizer que uma dessas ilhas tem uma embarcação praticamente intacta. + Será que ela ainda voa? + Como eu disse, só ouvi rumores. Mas mesmo se voasse, seria morte na certa. É melhor ficar neste planeta. Ees não parecem preocupados com a nossa presença. + Você é muito bom nisso. Já caçava antes da colisão? + Hah. Nunca tinha matado um animal na minha vida antes. Eu era um cientista. Trabalhava com moléculas em um laboratório. + Uau! Então como conseguiu se virar? + É incrível o que você é capaz de fazer quando precisa sobreviver. + Você muda. Se torna alguém que seu velho eu jamais reconheceria. + Eles estão recuperando as tecnologias? + Sim, a Enseada do Poente tem energia elétrica e equipamentos industriais. + Mas o pessoal de lá não está muito feliz com os Mirrows, que instalaram tudo. + Os Mirrows sobreviveram!? + Você os conhece? + Infelizmente. Nós eramos do mesmo grupo de pesquisa, estudando genética. + Depois do ataque, eles começaram a fazer coisas horríveis, como experimentos em humanos. Não dava mais para trabalhar com eles. + Ei, nós devíamos recuperar algumas tecnologias aqui, também! Se eles conseguem, por que nós não? + Esse é o espírito! Vamos nos sentir em casa aqui rapidinho. +
+
+ 15/03 - Não tivemos outra escolha senão abandonar a Terra. Nossas armas não surtem efeito e eles nos perseguem impiedosamente. Quem sabe em outro planeta possamos finalmente escapar da sua ira. + 01/05 - A nave foi seriamente danificada durante a fuga, mas o motor de salto espacial foi ativado com sucesso. Isso deve nos manter distantes de nossos algozes, supondo que a nave sobreviva à jornada. + 30/06 - Desenvolvemos um novo plano para aprimoramento e sobrevivência da raça humana, incluindo quantidade e tipos de cobaias necessárias para atingir nossos objetivos. O Sr. H deixou o grupo de pesquisa. + 05/08 - Alcançamos o planeta destino, mas não há como entrar com segurança na atmosfera, e não há cápsulas de fuga suficientes. A probabilidade de sobrevivência é baixa, até mesmo para os humanos aprimorados. Nenhum sinal do inimigo. + 02/09 - Progredimos com o reforço da fuselagem, mas a sobrevivência demanda aprimoramentos. Dissidentes estão protestando contra o procedimento, apesar de suas vidas dependerem dele. + 26/09 - Não há mais como manter a órbita. Muitos aceitaram os aprimoramentos. Alguns dos que não aceitaram foram lançados nas cápsulas de fuga. Esperamos que o reforço seja o suficiente para o resto. + 04/10 - Obtivemos grande sucesso com o reforço emergencial, mas o número estimado de sobreviventes foi bem menor do que o esperado, mesmo considerando cápsulas de fuga que não pudemos encontrar. + 05/10 - A viabilidade da espécie é agora uma grande preocupação. Com apenas algumas centenas de indivíduos, não poderemos sobreviver sem uma intervenção drástica. Iniciando uma nova linha de pesquisa. + 20/11 - Erguemos uma infraestrutura básica ao leste da área de impacto. Reunindo novos espécimes para experimentos. + 14/12 - A pesquisa de viabilidade da espécie estancou, mas a pesquisa de combate parece promissora. Os aprimoramentos cibernéticos conseguem transformar um civil comum em uma máquina de guerra. + 24/12 - C não aprova a pesquisa de combate. Ao invés de se preparar para o retorno deles e aumentar a viabilidade da espécie, C quer voltar para o espaço e procurar por outros sobreviventes. + 06/01 - C saiu do laboratório e deixou claro que não somos mais bem-vindos na cidade. Movendo a base de operações para o velho laboratório nos destroços do setor 22. + 31/01 - Aplicamos a pesquisa cibernética a nós mesmos devido à ausência de cobaias. Ainda não há sinal do inimigo, mas talvez agora possamos enfrentá-los. + 09/02 - Obrigamos os moradores a nos dar fundos para a pesquisa. Também conseguimos novas cobaias (vagabundos e rejeitados). A pesquisa voltou a progredir. + 27/02 - Acabaram as cobaias, então tivemos que buscar novos indivíduos na cidade. Se a pesquisa de viabilidade não for concluída logo, ficaremos sem cobaias de novo. + O painel quebrou... +
+
+ Unoiks 428 +
+
+ Estrela tipo G a 42 anos-luz da Terra.\n3 exoplanetas confirmados. +
+
+ Unoiks 428{char} +
+
+ Um planeta habitável semelhante à Terra. Localização da colônia #21. Suspeitamos ser o [color=ff2222]planeta natal do inimigo[/color]. + Um planeta terrestre pequeno, porém denso e próximo de uma estrela. Não há atmosfera, mas é provável que possua minérios valiosos e [item=exotic_matter]. + Um gigante gelado com atmosfera tempestuosa e forte atração gravitacional. +
+
+ Opções + Jogo pausado + Vol. música: + Vol. efeitos: + Tela cheia: + Veloc. texto: + Idioma: + Opções de jogo + Opções de interface + Controles + Conquistas + Voltar à tela inicial + Voltar + Deseja voltar à tela inicial? Qualquer progresso não salvo será perdido. + Teclado + Controle + Importar arquivo salvo + Exportar arquivo salvo + Só é possível importar arquivos na tela inicial. + Para importar, arraste o arquivo .asav para a janela do jogo e escolha um espaço para gravar o arquivo salvo. + Selecione um arquivo salvo para importar. + Para onde deseja exportar o jogo salvo? + Impossível importar: arquivo corrompido. + Impossível exportar: arquivo corrompido. + Recuperar vida automaticamente + Recuperar energia automaticamente + Excesso de peso: + Notificações: + Mostrar Tudo + Esconder Inferior + Esconder Elementos + Esconder Inferior, Elementos + Esconder Críticos + Esconder Inferior, Críticos + Esconder Elementos, Críticos + Esconder Tudo + Ativar botões de Mover tudo + Este botão moverá todos os itens de um inventário para o outro. Tem certeza de que quer fazer isso? + Transparência: + Perguntar quantidades p/ fabricação + Permitir lampejos. + Notificações de PNJs distantes + Mostrar plantas na guia Tudo + Permitir remoção de passarelas + Confirmar ao descartar todos os itens + Notificação de novo item descoberto + Usar materiais ao planejar plantas + Dar prioridade a PNJs sem missões + Recolhe auto + Trocar atalhos de equipamento + Priorizar o inventário do depósito + Dificuldade: +
+
+ Quando ativado, se sua vida estiver prestes a acabar, você automaticamente consumirá uma comida de recuperação de vida (se disponível) do seu inventário ao invés de morrer. + Quando ativado, se sua energia estiver prestes a acabar, você automaticamente consumirá uma comida de recuperação de energia (se disponível) do seu inventário ao invés de morrer. + Determina quanto acima do limite de peso você precisa estar antes do jogo impedi-lo de se mover (para evitar morte por excesso de peso). Mova o controle deslizante para a esquerda até o fim para remover o limite. + Quais notificações mostrar. \nInferior são notificações na parte inferior da tela (como PNJs colocando itens no seu Depósito). \nElementos são notificações de fraqueza/resistência contra elementos. \nCríticos são notificações de acertos críticos, erros, esquivas e bloqueios. + Ativa os botões "<" ">" de mover tudo na janela de transferência do inventário. + Determina a transparência da interface na tela (barras de vida, botões, etc.). + Quando ativado, o jogo perguntará quantos itens você quer fabricar/derreter de uma só vez; caso contrário, fabricará um item por seleção. + Desative esta opção se você for sensível a lampejos de luz. Algumas luzes mais oscilantes e intensas serão desativadas no jogo. Não há garantia de que todos os mods funcionem com essa opção. + Quando ativado, os PNJs notificarão quando adicionarem itens a depósitos em qualquer ilha. Quando desativado, os PNJs notificarão somente quando adicionarem itens a depósitos na ilha atual. + Desative para impedir a escavação de passarelas para não as recolher por acidente. Ative para permitir a escavação de passarelas para poder recolhê-las e reposicioná-las. + Desative para poder posicionar plantas imediatamente e acrescentar os materiais para construí-las mais tarde. + Desative para impedir que PNJs boqueiem o acesso a estruturas/itens atrás deles se não tiverem missões para dar ou completar. + Recolhe itens automaticamente ao minerar, recolher frutas ou derrotar um inimigo com armas de corpo-a-corpo. + Ao usar um atalho para equipar um item, troque aquele atalho com o que estava equipado anteriormente. + Acrescenta/remove itens no depósito ao invés do inventário do jogador. +
+
+ Esquerda: + Direita: + Para cima: + Para baixo: + Ação: + Cancelar: + Itens: + Missões: + Equipamento: + Atacar: + Defender: + Periférico: + Atalho 1: + Atalho 2: + Atalho 3: + Atalho 4: + Atalho 5: + Atalho 6: + Atalho 7: + Atalho 8: + Mudo: + Bate-papo: + Caminhar: +
+
+ Login no Aground Cloud\nO Aground Cloud é um serviço opcional que sincroniza seus arquivos salvos em diferentes versões do jogo. + Fazendo login... Aguarde... + Usuário ou senha incorretos. + Não foi possível conectar à nuvem. + Falha de sincronia! + Entrar no Aground Cloud + Sair do Aground Cloud + Não logado no Aground Cloud + Entrou como: {username} + Usuário: + Senha: + Lembrar? + Criar conta + O nome de usuário deve ter entre 3 e 24 caracteres. + A senha deve ter entre 3 e 40 caracteres. + Sincronizando + Arquivos salvos sincronizados! + Há arquivos não sincronizados! + Sincronizar + Existem dois arquivos salvos neste espaço!\nQual deles deseja manter? + Seus arquivos estão sincronizando. Tem certeza de que deseja sair sem concluir a sincronização? + Tem certeza de que deseja sair? +
+
+ Usamos o mod.io para instalar e gerenciar mods. Insira seu e-mail para começar! + E-mail: + Endereço de e-mail inválido! + Insira o código de 5 dígitos enviado para o seu e-mail: + Endereço de e-mail não encontrado no mod.io! + O código que você inseriu não estava correto! + Você fez login no mod.io com sucesso! Os mods cadastrados serão baixados automaticamente! + Versão + Ativar mod + Desativar mod + Fazer upload para o mod.io + O upload falhou + Upload feito com sucesso! + Fazer login no mod.io + Explorar mods + Sair do mod.io + Você não está logado no mod.io + Você precisa colocar uma imagem de prévia como preview.png na pasta do mod antes de fazer upload! + Visitar página + Tem certeza de que quer desativar {mod}? + O arquivo .zip não contém um arquivo mod.xml ou não é um mod válido. + O mod {modname} foi importado com sucesso! + Você já importou um mod com o mesmo nome. Deseja substituí-lo? Observação: pode ser necessário recarregar o jogo se os arquivos de imagem do mod tiverem sido editados antes de substituir. +
+
+ Fazer upload para o Steam + Fazendo upload de {name} para a Oficina Steam: + Observações: + ID: + Concordar com os termos de serviço da oficina. + Criar novo +
+
+ Que nome deseja dar a essa área? + Ilha Inicial + Enseada do Poente + Ilha do Leste + Caverna Aquática + Nave Colonial +
+
+ Criar personagem + Cor da pele: + Cor do cabelo: + Cor dos olhos: + Cor da camisa: + Cor das calças: + Estilo de cabelo: + Estilo da camisa: + Barba: + Cor do pelo: +
+
+ Preto + Marrom + Marrom escuro + Marrom claro + Azul + Azul escuro + Azul claro + Verde + Verde claro + Vermelho + Amarelo + Laranja + Rosa + Roxo + Branco + Cinza + Azul petróleo + Loiro + Loiro escuro + Personalizado +
+
+ Aberta + Fechada +
+
+ Mais fácil + Fácil + Normal + Difícil + Mais difícil + Morte perm. + Criativo + Morte com 1 acerto +
+
+ Selecionar campanha + Padrão + A versão padrão do Aground. +
+
\ No newline at end of file diff --git a/games/aground/data/core/lang/ru_RU.xml b/games/aground/data/core/lang/ru_RU.xml new file mode 100644 index 00000000..6d3a563e --- /dev/null +++ b/games/aground/data/core/lang/ru_RU.xml @@ -0,0 +1,1644 @@ + + +
+ Блок! + Отражено! + Сработало! + Промах! + Уклон! + Крит. удар! + Нет эффекта + Игра сохранена + Сохранение удалено + Сохранение повреждено! Возможно, вы находитесь в локации, которая отсутствует в данной версии игры. + Сохранение неполное – отсутствуют некоторые объекты, предметы или локации. Обычно это происходит, когда отсутствует мод, либо если сохранение из другой версии игры. + Горючее + Добавить горючее + Добавить продовольствие + Добавить корм + Всё + Снаряжение + Вес: + Здоровье: + Запас сил: + Здор. + Защ. + Энергия + Кислород + Ок + Отмена + Да + Нет + Принять + Отказать + Продать + Купить + Сколько выбросить? + Сколько съесть? + Сколько выпить? + Сколько выложить? + Сколько взять? + Сколько отменить? + Сколько продать? + Сколько купить? + -- Ингредиенты -- + -- Стоимость ремонта -- + -- Итог -- + Отремонтировано: {item} + Инвентарь + Журнал заданий + Хижина + Плавильня + Кухня + Мастерская + Склад + Верфь + Рынок + Линия электропередачи + Энергостанция + Прибрежный склад + Амбар + Загон для животных + Собрать + Собрать всё + Управление + Сытость/заряд + Лаборатория + Питомник для личинок + Завод + Синтезатор + Энергии за Удар: + Зап. сил за Удар: + Зап. сил за Исп. + Передвижение + Новая игра + Продолжить + Настройки + Выход + Сообщество + Моды + Пусто + < Пустой слот > + Повреждённый слот + Перезаписать слот? + Нет + Поля: + Размещено: {item}. + Новый уровень! + Уровень: + Опыт: + Выбрать предмет + Назначить гор. клав. + Ещё раз + Главное меню + Перемес- тить всё + Добавить животное + Выбрать корм + Сколько использовать? + Выбрать удобрение + Звук отключён + Звук включён + {npc} добавил(а) на {storehouse}: {count} {item} + Для восстановления здоровья использовано: {count} {item} + Для восстановления запаса сил использовано: {count} {item} + Для восстановления кислорода использовано: {count} {item} + {item} – выбросить всё? Вернуть предметы будет невозможно. + Установить [item=sign] Сообщение: + Сколько превратить в: {into}? + Собрать готовое + [tile=sticky] Закрепить предмет + Установить как первый предмет + Клюёт! + Сорвалось! + Жди... + Тащи! + Сколько скрафтить? + Сколько раскрафтить? + Монеты + Сломалось: {item} + Скоро сломается: {item} + Только инвентарь + Включая склад + Голоден: {item} + Не голоден: {item} + Переименовать {item}: + Зарядка + Зарядить батареи + Все батареи заряжены! + Заряжено максимальное количество батарей. + Продовольствие + Время + {item} – накормить/зарядить с помощью:{list} + {item} – заправить с помощью:{list} + {item} – починить с помощью:{list} + Скоро сломается: {item}. Починить с помощью: + Использований + Зачарование + Откат + Прочность + Урон + Захват + Способ захвата + Духи + Высота полёта: + Глубина: + Отброс: + Сражаться + Сбежать + Завершено + Удалить + Манипулятор времени + Какое время установить (24-часовой формат)? + Конец демо-версии для Пути магии. Сохранить игру? + Конец демо-версии для Пути науки. Сохранить игру? + Титры + Купить игру! + Сброс + Сойти на берег + Больше не спрашивать + [color=ff2222]Внимание![/color] Доступно обновление: {version}! + Выбрать направление:\n\n[key=left][key=up][key=down][key=right] + Случайно + Эффективность + Победа! + Найден новый предмет! + +{count} More... + Чтобы построить это сооружение, нужно переместить или снести существующие. Это можно сделать с помощью [item=dismantle] в инвентаре. + Удалить слот? + Нельзя употребить, пока [tile=stat.full] не истечёт! +
+
+ Характеристики + Макс. здор. + Макс. зап. сил + Скорость + Выносливость + Атака + Дистанция + Защита + Защита от элементов + Рубка + Дух + Добыча + Вес + Уклонение + Крит. удар + Рыбалка + Скор. добычи + Видимость + Торговля + Ловушки + Кислород + {mod} на {time}с + {mod} ({current}/{max}) +
+
+ Сколько ударов вы можете выдержать. + Сколько действий вы можете сделать до потери здоровья. + Насколько быстро вы двигаетесь. + Чем выше выносливость, тем меньше расходуется запас сил. + Повышает урон от атак в ближнем бою. + Повышает дистанцию стрельбы. + Снижает урон от ударов. + Повышает урон во время рубки деревьев. + Позволяет копать сквозь более прочные блоки. + Повышает базовую вместимость. + Повышает вероятность того, что противник промахнётся. + Повышает шанс критического удара в ближнем бою. + Облегчает ловлю рыбы. + Позволяет копать быстрее. + Позволяет видеть больше блоков при передвижении и добыче ресурсов. + Повышает цену продажи предметов. + Повышает улов с сетей. + Как долго вы можете провести без воздуха. +
+
+ Очки навыков + Очки навыков + [color=770000]Навык развит до конца +
+
+ Выбросить + Разместить + Использовать + Скрафтить + Экипировать + Снять + Огонь + Съесть + Обыскать труп + Корм/заряд + Корм/заряд все + Заправить всё + Починить всё + Собрать + Открыть + Вырезать + Переключиться + Превратить + Починить + Переименовать + Заполнить + Синтезировать + Зачаровать + Установить снаряд + Разозлить + [item=adult_dragon] – хотите разозлить? Существо навсегда станет к вам враждебным. + Разрешить атаку + Запретить атаку + Разрешить полёт + Запретить полёт + Призвать + Раскрафтить + Установить время + Сбросить навыки + Строить + Улучшить + Посадить + Объединить монеты +
+
+ Древесина + Уголь + Железная руда + Кварц + Золотая руда + Алмазы + Сера + Сырая нефть + Титан + Уран + Железный слиток + Стальной слиток + Золотой слиток + Мясо + Яблоки + Пшеница + Яйца + Молоко + Сахар + Стейк + Хлеб + Пирог + Оладьи + Гамбургер + Сыр + Пицца + Омлет + Чизбургер + Торт + Яблоко в карамели + Драконья кровь + Каменный топор + Каменная кирка + Сломанная кирка + Кошель + Железная кирка + Железный меч + Железная броня + Стальная кирка + Стальной меч + Стальная броня + Великая броня + Лук + Изогнутый лук + Стрела + Ледяная стрела + Огненная стрела + Водная стрела + Истощающая стрела + Рюкзак + Мегарюкзак + Ультрарюкзак + Магическая кирка + Магический меч + Магический рюкзак + Магический ящик + Ткань + Сеть + Ягоды + Красные ягоды + Ледяные ягоды + Зелье здоровья + Зелье сил + Зелье атаки + Зелье защиты + Зелье скорости + Зелье выносливости + Крыса + Свинья + Личинка + Кокон + Дракон-детёныш + Молодой дракон + Взрослый дракон + Корелла + Ручной волк + Кошка + Лодка + Забор + Факел + Ловушка + Верстак + Стальной верстак + Наковальня + Сундук + Тыква-светильник + Знак + Табличка с названием + Ржавый топор + Хлопок + Тыква + Курица + Корова + Удочка + Клыкач + Клювач + Групер + Удобрение + Ледяной мех + Мех теней + Камень огня + Камень воды + Камень земли + Камень льда + Камень растений + Баклер + Каплевидный щит + Зачарованный щит + Снеговик + Древний топор + Огненный бивень + Кремний + Очищенная нефть + Батарея + Бур + Револьвер + Ружьё + Пуля + Ледяная пуля + Огненная пуля + Водная пуля + Истощающая пуля + Заряд + Танковый заряд + Ледяной заряд + Огненный заряд + Водный заряд + Истощающий заряд + Цепная пила + Огненная цепная пила + Ледяная цепная пила + Водная цепная пила + Раст. цепная пила + Истощ. цепная пила + Вагонетка + Рельсы + Карта + Лопата + Лом + Наземная мина + Камень изменения + Камень фокусировки + Камень духов + Камень крови + Пушка-детёныш + Драконье пламя + Бур-личинка + Драконья броня + Ледяной меч + Огненный меч + Водный меч + Растительный меч + Истощающий меч + Ледяной топор + Огненный топор + Водный топор + Растительный топор + Истощающий топор + Очки духов + Печь + Костёр + Бинт + Палатка + Драконий меч + Шёлк + Фонарь + Налобный фонарь + Растительный глаз + Растительная сумка + Реактивный ранец + Теневой плащ + Голем + Золотой голем + Аметистовый голем + Земляная броня + Земляной шлем + Земляной молот + Диодный волк + Механическая личинка + Тело киборга + Спина киборга + Глаз киборга + Рука-пулемёт + Электрический угорь + Рог + Ледяной щит + Ледяное сердце + Сова + Демонтировать + Чертёж хижины + Чертёж склада + Чертёж кухни + Улучшение кухни + Чертёж плавильни + Чертёж мастерской + Чертёж амбара + Чертёж загона + Чертёж лаборатории + Чертёж питомника личинок + Чертёж пристани + Чертёж прибрежного склада + Семена пшеницы + Семена яблок + Семена сахара + Семена хлопчатника + Семена тыквы + Семя дерева + Семя хвойного дерева + Семя куста + Семя красного куста + Семя ледового куста + Гелиевый пузырь + Стальной топор + Стальной молот + Паук + Скрыть слот + Детектор духов + Чертёж энергостанции + Чертёж завода + Чертёж лифта + Чертёж энерголинии + Семя фиолет. дерева +
+
+ Вокруг света. + Не даёт врагам пройти внутрь. + Плавит руду. + Для приготовления [item=steak default=Стейков]. + Здесь всё помещается. + Крафтит предметы. + Чинит предметы. + Замораживает врагов. + Огонь + Истощение + Иссушение + Преобразует предметы. + Заполняет пустоты. + Собирает рельсы, кабели и лестницы. + Для хранения предметов. + Показывает сообщение. + Позволяет видеть духов. + Для отдыха и восстановления [tile=stamina] [color=006600]Запаса сил[/color]. + Производит: {item}. + Освещает окружение, когда экипировано. + {value}/с. + {value}/с. при дн. свете. + {value}/с. в темноте. + {value}/с. в дн. время. + {value}/с. ночью. + {value}/с., когда ранен. + {value}/с, если не сыт/заряж. + {value}/с, если сыт/заряж. + Скрывает носителя. + Все удары становятся критическими. + Макс. вес + Отражение урона + Выпускает: {projectile} + Вылупляется в [color=770000]Питомнике для личинок[/color]. + Строит + Улучшает + Разрушает сооружения, для которых есть [tile=blueprint.ico] [color=770000]Чертёж[/color]. + Собирает ближайшие предметы. + Высаживает + Стоимость высадки + Стоимость размещения + Разместите, чтобы переименовать остров. + Экипировать + Можно использовать под водой. + Проходит сквозь блоки. + Стреляет вперёд и назад. + Отражает элементальные атаки. + Пронзает врагов. + Не убивает (остаётся 1 ед. здор.). + Распознаёт источники жизни поблизости. + Летает. + Плавает. + Строит по чертежам. +
+
+ Укрытие + Ходячий обед + Много места + Издольщина + Яблоки + Металлургия + Бон аппетит + Тяжёлые веса + Пора крафтить + Гроза личинок + Гроза големов + Блестяшка + Выгодная сделка + Веса потяжелее + Изловить личинку + Свиное молоко + М-м-м, сырок + К далёким берегам + Поднять паруса + Эксперименты + Бесконечная кровь + Детёныш + Усиление + Индустриализация + Вам наверх? + Справедливость + Напряжение + Опыты на людях + Узнать всё + Подзарядка + Механизация + Минотавр + Укротитель + Гроза королев + Псевдостейк + Ударные темпы + Техномаг + Элементарно + Чпок + Владыка драконов + Перемотка + Лицом к лицу + Построй свой путь + Усиление + Сокрушитель +
+
+ Отремонтируйте [color=ff2222]Хижину[/color]. + Одолейте [color=ff2222]Кабана[/color]. + Постройте [color=ff2222]Склад[/color]. + Постройте [color=ff2222]Ферму[/color]. + Разбейте [color=ff2222]Фруктовый сад[/color] на [color=ff2222]ферме[/color]. + Постройте [color=ff2222]Плавильню[/color]. + Постройте [color=ff2222]Кухню[/color]. + Обзаведитесь [color=ff2222]Рюкзаком[/color]. + Постройте [color=ff2222]Мастерскую[/color]. + Одолейте [color=ff2222]Личинку[/color]. + Одолейте [color=ff2222]Голема[/color]. + Добудьте [color=ff2222]Алмаз[/color]. + Постройте [color=ff2222]Рынок[/color]. + Приобретите [color=ff2222]Мегарюкзак[/color]. + И что теперь с ней делать? + Добавьте [color=ff2222]Загон[/color] на [color=ff2222]Ферму[/color]. + Приготовьте [color=ff2222]Пиццу[/color]. + Постройте [color=ff2222]Пристань[/color]. + Постройте [color=ff2222]Лодку[/color]. + Постройте [color=ff2222]Лабораторию[/color]. + Постройте [color=ff2222]Питомник для личинок[/color]. + Выведите [color=ff2222]Дракона[/color] из [color=ff2222]Кокона[/color]. + Постройте [color=ff2222]Энергостанцию[/color]. + Постройте [color=ff2222]Завод[/color]. + Постройте [color=ff2222]Лифт[/color]. + Разберитесь с [color=ff2222]Разбойниками[/color]. + Одолейте [color=ff2222]Диодного волка[/color]. + Выстоять против Миррозов. + Прочтите все записи. + Поймайте [color=ff2222]Электрического угря[/color]. + Установите полный комплект снаряжения Киборга. + Пройдите лабиринт Минотавра. + Полетайте на [color=ff2222]Драконе[/color]. + Одолейте [color=ff2222]Королеву личинок[/color]. + Запустите [color=ff2222]Синтезатор[/color]. + Активируйте [color=ff2222]Кузницу[/color]. + Зачаруйте [color=ff2222]Цепную пилу[/color]. + Поймайте духа каждого элемента. + Срубите [color=ff2222]Фиолетовое дерево[/color]. + Соберите полный комплект драконьего снаряжения. + Активируйте [color=ff2222]Манипулятор времени[/color]. + Одолейте [color=ff2222]Древнюю[/color]. + Постройте здание с помощью [color=ff2222]Чертежа[/color]. + Потратьте не менее пятисот [color=ff2222]Очков навыков[/color] на развитие персонажа. + Одолейте [color=ff2222]Робоголема[/color]. +
+
+ Пшеничное поле + Фруктовый сад + Сахарное поле + Хлопковое поле + Тыквенное поле + Расширить ферму + Построить загон + Загон + -- Производит -- + -- Слоты -- + Заменить культуру + Удобрение + Для активации чего-то не хватает. + Хм, ничего интересного. + Нашёл [item=pumpkin_seed]! + Путешествовать на лодке + Управление складом + Лифт + [tile=boat.ico] Лодка перегружена! + Отдохнуть в лодке + {item} – использовать для активации сооружения? + Колонна открывает следующее зачарование:\n{enchant} + {items} = {creates}. + Рецепт зачарования добавлен в [color=770000]Кузницу[/color]. + В логове должно быть: {item}. + Энергия со всего сооружения устремляется в статую... + Построить Робоголема + {structure} – построить за следующее количество ресурсов? + {structure} – демонтировать за следующее количество ресурсов? + {structure} – посадить за следующее оличество ресурсов? + {structure} – разместить за следующее количество ресурсов? + Дракон в логове: + Изменить облик + Активировать кузницу. + Активировать синтезатор. +
+
+ Отдохнуть в хижине + Войти на склад + Работать в мастерской + Плавить руду + Готовить на кухне + Войти на ферму + Сделка с Торговцем едой + Сделка с Оружейником + Сделка с Торговцем рудой + Войти на Верфь + Сесть в лодку + Смешивать зелья + Управление загоном + Управление клеткой + Призвать Алхимика + Выращивать драконов + Вырастить в: {into} + Летать на драконе + Активировать + Войти + Отдохнуть в Палатке + Искать + Управление энергостанцией + Войти в гостиницу + Вызвать лифт + Войти на прибрежный склад + Управление заводом + Отключает Завод големов + Тревога: неуправляемый. + Читать + Управление + Операция на себе + Операция на животном + Уход за посевами + Управление загоном + Призвать лодку + Призвать дракона +
+
+ Собрать ягоды + Срубить дерево + Напасть + {item} – взять + {item} – открыть + {item} – собрать + {item} – использовать +
+
+ Ведущая рука: + Неведущая рука: + Добыча: + Броня: + Шлем: + Рюкзак: + Слуга: + Оружие: + Двигатель: + Выберите декоративный предмет, чтобы изменить внешний вид без смены снаряжения. + Для этого слота нельзя выбрать декоративный предмет. +
+
+ Поймано! + Сломано! + Почти! +
+
+ Превышен максимальный вес! + Запас сил на исходе, вы теряете здоровье! + Кислород на исходе, вы теряете здоровье! + Слишком глубоко, вы теряете здоровье! + Ещё не готово! Приходите позже. + Дополнительных слотов не осталось! + Слишком повреждено, чтобы использовать! + Окно игры неактивно + Не хватает ингредиентов. + Нельзя разместить объект под землёй. + Нельзя разместить объект поверх других объектов. + Чтобы разместить объект, необходимо расширить область. + Нельзя разместить это здесь! + Нельзя использовать это здесь! + Нельзя разместить объект так высоко. + Это сооружение нельзя построить под землёй. + Это сооружение нельзя построить под водой. + Это сооружение должно быть построено на воде. + Чтобы построить сооружение, необходимо расширить область. + Нельзя строить поверх сооружений или посевов. + Это сооружение может быть построено только рядом с: {structure}. + Это сооружение может быть построено только слева от: {structure}. + Это сооружение может быть построено только справа от: {structure}. + Это сооружение может быть построено только на пустом берегу. + Нельзя построить это внутри техники. + Нельзя высаживать поверх сооружений или посевов. + Высаживать можно только на плодородных травяных блоках. + Можно разместить только целиком в одной комнате. + Не сработает. + Выбросить вместо этого? + {projectile} – нельзя использовать без: {weapon}. + {weapon} – нельзя использовать. Не хватает: {projectile}. + Нельзя добавить больше предметов! + Нельзя добавить больше горючего! + Уже отремонтировано! + Нельзя добавить больше продовольствия! + Нельзя добавить больше корма! + Нельзя хранить больше монет! + Что-то пошло не так! Отправить отчёт об ошибке? + Нет энергии! + Не хватает мощности батарей! + Не хватает продовольствия! + Не хватает горючего! + {item} – отсутствует. + {item} – слишком голоден, чтобы отправиться в путь! + Нельзя заполнить этот блок! + Невозможно загрузить основную игру. Скорее всего, у вас отсутствует часть файлов. Перекачайте zip-архив и извлеките содержимое в папку с игрой. + Невозможно загрузить основную игру. Скорее всего, у вас отсутствует часть файлов. Нажмите Shift+Обновить, чтобы полностью перезагрузить страницу. + Не завершено. Дождитесь следующего обновления. + Невозможно во время полёта! + Нельзя спать под водой! + Нельзя спать во время поездки! + Вы слишком перегружены, чтобы лететь с: {item}! + Вы слишком перегружены, чтобы двигаться! + Нельзя экипировать: {item}. + Здесь нечего демонтировать. + Здесь нечего улучшать. + Нет чертежа. + На острове можно построить только одно такое сооружение. + Невозможно во время поездки. + Невозможно во время плавания. + {item} – демонтировать? Объект пропадёт навсегда. Если вы захотите его вернуть, придётся устанавливать заново в хирургической лаборатории. + Не хватает: {item}! + Не хватает очков для повышения навыка! + Этот чертёж уже есть! + Уничтожить предмет? Весь прогресс будет утерян. + Нельзя добавить больше предметов! + Подождите, пока атака перезарядится. +
+
+ Закрыто на ночь. + Скоро новое поступление! + Не могу поверить, что [color=770000]Энергостанция[/color] не работает! Как мне теперь вести дела? +
+
+ Новое задание! + Заданий нет. + ??? + -- Требования -- + -- Выполнено -- + Ремонт хижины + Построить склад + Построить склад + Крафт плавильни + Мастерская + Построить кухню + Улучшить кухню + Построить ферму + Семена яблони + Построить рынок + Построить рынок + Пристань + Построить пристань + Загон для свиней + Построить лодку + Магическая кровь + Питомник + Вывести дракона + Магический топор + Охота на кабанов + Периметр + Волчонок + Энергостанция + Построить завод + Построить лифт + Против Миррозов + Переубедить Миррозов + Найти Пэри + Разбойники + Одолеть кабанов + Гнездо личинок + Найти Гнездо личинок + Сила духов + Изучение личинок + Скачки энергии + Проложить рельсы +
+
+ Отремонтируйте [color=550000]Хижину[/color], чтобы укрыться от шторма. + хочет построить [color=550000]Склад[/color]. + Постройте [color=550000]Склад[/color], чтобы хранить все свои предметы. + хочет [color=550000]Плавильню[/color], чтобы плавить руду. + хочет [color=550000]Мас- терскую[/color], чтобы делать метал. инструменты. + хочет построить [color=550000]Кухню[/color], чтобы готовить еду. + хочет готовить [item=cheese] на [color=550000]Кухне[/color]. + хочет [color=550000]Ферму[/color], чтобы выращи- вать с.-х. культуры. + хочет вы- садить [color=550000]Фруктовый сад[/color] с помощью [item=fruit default=Яблок]. + хочет построить [color=550000]Рынок[/color], чтобы торговать. + Постройте [color=550000]Рынок[/color], чтобы привлечь торговцев к вашей [color=550000]Пристани[/color]. + хочет [color=550000]Пристань[/color], чтобы от- правиться в плавание. + Постройте [color=550000]Пристань[/color], чтобы отыскать других выживших. + хочет добавить [color=550000]Загон[/color], чтобы поселить туда скот. + Пора отправиться в плавание! Постройте [tile=boat.ico] лодку на [color=550000]Верфи[/color]. + просит убить [item=wyrm default=Личинку] и добыть [item=dragonblood default=Драконью кровь]. + хочет поэкспериментировать на [item=wyrm default=Личинках]. + Чтобы [item=adult_dragon] согласилась помочь, выведите [item=dragon default=Дракона-детёныша]. + хочет починить [item=rusty_axe]. + предлагает потрениро- ваться с оружием. + хочет поставить [item=fence] вокруг поселения. + хочет приручить волчонка. + чинит [color=550000]Энергостанцию[/color], и ей нужен [item=titanium]. + хочет возиться с механиз- мами на [color=550000]Заводе[/color]. + хочет построить [color=550000]Лифт[/color], чтобы поднимать руду. + хочет, чтобы вы пого- ворили с Миррозами. + хочет, чтобы вы нашли для Миррозов что-то необычное. + просит найти [item=cat default=Кошку]. Она любит [item=toothfish]ей. + Торговцы просят разо- браться с разбойника- ми, ворующими товары. + просит раскрыть тайны [item=wyrm default=Личинок]. + просит поймать духов при по- мощи [item=spirit_gem default=Камней духов]. + заканчи- вает изучать [item=wyrm default=Ли- чинок]. Надо помочь! + хочет найти источник скач- ков магич. энергии. + хочет сделать [item=minecart default=Вагонетку], чтобы облегчить процесс добычи. +
+
+ Спешиться + Техника + Нажмите «вверх», чтобы лететь. + Техника слишком перегружена, чтобы двигаться! + Управление предметами + Персонаж + Зарядиться от батарей + [color=770000]Подсказка:[/color] нажмите [key=equipment] во время поездки, чтобы посмотреть характеристики ездового животного (техники), а также чтобы произвести кормление или заправку. + Нельзя подняться выше! + Развернуть + Свернуть + Если свернёте лодку, будете плавать вместе с рыбами! + Нельзя управлять техникой: занято другим игроком! +
+
+ Говорить + Взять + Строитель + Шахтёр + Фермер + Торговец + Алхимик + Охотник + Механик + Хозяин гостиницы + Рыбак +
+
+ Ты правда думаешь, что здесь можно выжить? Это невозможно, дружище. + У тебя вроде неплохо получается строить? Может, построим что-нибудь для хранения ресурсов и провизии? + Хм. Если у меня будет [var=quest.storehouse.wood] [item=wood default=Древесины] и [var=quest.storehouse.berries] [item=berries default=Ягод], может, и получится построить хороший [color=770000]Склад[/color]. + По рукам! Я легко найду всё что нужно. + Возьми [item=stone_axe], раз такой бойкий. + Я устал. Да и ты вроде тоже из сил выбился. Давай отдохнём в [color=770000]Хижине[/color], сохраним игру и восстановим [tile=stamina] [color=006600]Запас сил[/color]. + Как тебе мой старый [item=stone_axe]? Подойди к дереву и нажми [key=attack], чтобы его срубить. Должно получиться! + Когда ты собираешь предметы, они попадают в инвентарь. Чтобы посмотреть, нажми [key=inventory]. + Если твой [tile=stamina] [color=006600]Запас сил[/color] истечёт, ты начнёшь терять [tile=health] [color=770000]Здоровье[/color], а если истечёт твоё [tile=health] [color=770000]Здоровье[/color], ты умрёшь. + Поэтому-то и надо есть [item=berries], [item=fruit] и [item=meat]. Чтобы поесть, выбери их в инвентаре. + Уже всё собрал? Ничего себе. + Самое время построить [color=770000]Склад[/color]! + Да ты только посмотри! Есть чем гордиться. + Да... это нам точно пригодится. Теперь хотя бы не будем так уставать от переноски тяжестей. + С помощью кнопки «Переместить всё» можно быстро избавиться от лишней тяжести. Чтобы отметить то, что ты хочешь оставить в инвентаре, используй [key=quest]. + Стоит заключить сделку с [object=farmer]ом. Наверняка он сможет помочь нам вырастить вкусную еду. + Видел, как из-под земли появился [object=miner]? Попробуй узнать, что ему нужно. + Может, построим [color=770000]Кухню[/color]? [item=meat] это хорошо, но если его приготовить, станет ещё лучше. + Чтобы построить [color=770000]Кухню[/color], мне нужно [var=quest.kitchen.wood] [item=wood default=Древесины] и [var=quest.kitchen.coal] [item=coal default=Угля]. + Похоже, ты принёс всё что нужно. Пора строить [color=770000]Кухню[/color]! + Ты можешь готовить на [color=770000]Кухне[/color] сколько угодно, пока у тебя есть [item=wood] или [item=coal] для поддержания огня. + Знаешь, чего бы я съел? [item=cheese]а. На свете нет ничего вкуснее. + Чтобы на [color=770000]Кухне[/color] можно было готовить [item=cheese] и другие новые блюда, её нужно улучшить. Для этого потребуется [var=quest.kitchen2.wood] [item=wood default=Древесины] и [var=quest.kitchen2.steel_bar] [item=steel_bar default=Стальных слитков]. + Что случилось с моей прекрасной [color=770000]Кухней[/color]? Ты должен построить новую как можно скорее! Используй для этого [item=kitchen_blueprint]. + Похоже, ты принёс всё что нужно. Самое время улучшить [color=770000]Кухню[/color]! + Попробуй новые рецепты! Мы уже почти как при цивилизации! + Как же есть хочется... Надеюсь, ты скоро достроишь [color=770000]Ферму[/color]! +
+
+ Как же я рад тебя видеть, парень. А я-то, старый, уж думал, что один во всём мире остался. + Я могу тебе помочь, есть ещё порох в пороховницах. Хорошая еда нам всем не помешает, а я на сельском хозяйстве собаку съел. + Может, построим амбар и организуем [color=770000]Ферму[/color]? + Отлично! Я построю амбар и посажу [item=wheat_seed]! + Теперь у нас есть [color=770000]Ферма[/color]! Заходь иногда, чтоб собирать урожай, это поможет тебе восполнить [tile=stamina] [color=006600]Запас сил[/color]. А пока урожай не поспел, возьми [item=bread]. + Сруби дерево, чтобы получить [item=wood default=Древесину]. + Если хош растить больше, сади больше семян! Управлять посевами и убирать ненужные можно в амбаре! + Только глянь, какая классная у нас [color=770000]Ферма[/color]! Всё растёт не хуже, чем дома! Но если хочешь выращивать больше, я всегда могу достать семян. + Сама по себе [item=wheat] на вкус не очень, но мы сможем сообразить что-нибудь получше, если ты и [object=builder] организуете [color=770000]Кухню[/color]. + Знаешь, чего нам на [color=770000]Ферме[/color] не хватает? Скотины! Может, возьмёшь [item=net] и поймаешь парочку [color=770000][tile=boar]Кабанов[/color]? + Я добавлю [color=770000]Загон[/color]. От тебя мне нужны [var=quest.pen.pig] [item=pig default=Свиньи] и [var=quest.pen.wood] [item=wood default=Древесины]. + Ну разве это не самые жирные и сочные [item=pig default=Свиньи], что ты видел? Ещё и не одна! + Загон позволит нам производить [item=meat] и [item=milk]! + Если захочешь построить больше [color=770000]Загонов[/color], используй [item=pen_blueprint]. + Как поймать [item=pig default=Свинью]? Положи [item=net] на землю и замани на неё раненого [color=770000][tile=boar]Кабана[/color]. Если повезёт, он попадёт в ловушку и станет ручным! + [item=pig] даёт молоко? Почему бы и нет? Это странные земли. Но [item=cheese] нам точно не помешает. Попроси [object=builder default=Строителя] улучшить [color=770000]Кухню[/color]. + Я тут малость всё украсил к Празднику урожая! Ты ж не против, да? Праздничное настроение будет весьма кстати. Ещё я положил на [color=770000]Склад[/color] [item=jakolantern default=Тыквы-светильники]. + А ферма-то растёт! В честь этого я приготовил для тебя [item=sugar_seed]! Попробуй высадить [item=sugar]ное поле! + Я тут встретил торговцев на [color=770000]пристани[/color] и взял у них [item=cotton_seed]! + [item=fruit] здесь на каждом шагу. Если раздобыть семян, можно будет высадить хороший [color=770000]Фруктовый сад[/color]! + Отлично, теперь у нас есть [item=orchard_seed]. Самое время высадить [color=770000]Фруктовый сад[/color]! + Дай знать, как соберёшь всё для [color=770000]Фруктового сада[/color]. Помни, нам нужны [item=fruit]! + Семена можно садить на травяных блоках. Главное, чтобы хватило места. Покажи мне, где посадить [item=orchard_seed]! + Используй семена, чтобы менять посевы в [color=770000]Амбаре[/color]. Если понадобятся новые семена, дай мне знать! + Первый снег! Самое время для праздника! Я даже слепил магического [item=snowman]а из [item=ice_berries default=Ледяных ягод]! Надеюсь, тебе понравится! + Я уже чувствую себя почти как дома. Может, дадим этому месту название? + Используй [item=area_name_sign default=Табличку с названием], чтобы переименовать остров! +
+
+ О, привет. Не знала, что кто-то ещё уцелел. + Я была под землёй. Оказывается, здесь столько интересного. + Если тоже хочешь посмотреть, у меня есть лишняя кирка. + Как копается? Наверное, стоит построить [color=770000]Плавильню[/color], чтобы выплавлять из руды слитки. + Отлично! Дай мне знать, когда найдёшь достаточно [item=coal default=Угля]! + То что надо. Мигом поставим [color=770000]Плавильню[/color]! + В [color=770000]Плавильне[/color] можно превращать руду в слитки. Для выплавки нужно горючее, но, к счастью, [item=coal] здесь на каждом шагу. + Чего же ты ждёшь? Чтобы начать копать и искать руду, жми [key=down]! + Руда тяжёлая. Не забывай сбрасывать лишнее на [color=770000]Склад[/color] между ходками. + В шахте легко позабыть о времени. Следи за тем, чтобы тебе хватило [tile=stamina] [color=006600]Запаса сил[/color] на обратную дорогу. + Чем глубже ты забираешься, тем лучше будет руда. + Если решил закопаться глубоко под землю, не забудь взять [item=torch]ы. Они светят, будучи экипированными, но рано или поздно тоже выгорают. + Я могу сделать [item=torch]ы, если надо. + Может, построим [color=770000]Мастерскую[/color], чтобы изготавливать из слитков инструменты? Я могу это сделать, но мне нужно [var=quest.workshop.iron_bar] [item=iron_bar default=Железных слитков] и [var=quest.workshop.wood] [item=wood default=Древесины]. + Отлично, самое время построить [color=770000]Мастерскую[/color]! + В [color=770000]Мастерской[/color] можно мгновенно создавать инструменты или предметы, если есть нужные материалы. + Чтобы получить [item=iron_bar], найди [item=iron] и расплавь её в [color=770000]Плавильне[/color]. + [item=iron] залегает довольно глубоко, поэтому возьми с собой [item=torch], чтобы освещать путь. Если выгорит, возвращайся ко мне – я сделаю ещё. + Когда у тебя будет достаточно [item=iron default=Железа], выбери в [color=770000]Плавильне[/color] [item=iron_bar], и она будет работать, пока хватает горючего. + В [color=770000]Плавильне[/color] можно делать столько заказов, на сколько хватит материалов, и она будет их выплавлять, даже когда тебя нет рядом. Главное, чтобы горючего хватило. + Чтобы прокопаться сквозь [color=770000][tile=stone]Камень[/color] и добыть [item=gold default=Золотую руду], необходима [item=iron_pickaxe] или [item=steel_pickaxe]. Их можно скрафтить в [color=770000]Мастерской[/color]. + Чтобы прокопаться сквозь [color=770000][tile=stone]Камень[/color] и добыть [item=gold default=Золотую руду], должна быть экипирована [item=iron_pickaxe] или [item=steel_pickaxe]. Нажми [key=equipment], чтобы открыть окно снаряжения. + Нажми [key=equipment], чтобы открыть окно снаряжения и экипировать кирку. + Теперь ты можешь использовать [color=770000]Горячие клавиши[/color].\nЧтобы их назначить, нажми [key=hotkey1], [key=hotkey2], [key=hotkey3] или [key=hotkey4] в инвентаре. + Что нужно каждому шахтёру, так это [item=minecart] и [item=rail]! Руда тяжёлая, и если мы сможем быстро и легко доставлять её на [color=770000]Склад[/color], это будет очень удобно. + Принёс [item=minecart default=Вагонетку] и [item=rail]? Отлично, самое время их установить! + [item=minecart] и [item=rail] установлены! Путей пока мало, но ты можешь их расширить! А чтобы снять и переместить [item=rail], используй [item=crowbar]! +
+
+ Со [color=770000]Склада[/color] украдено: [item={item}]! + Вор пойман с поличным! + Нам и так тяжко приходится, только воров не хватало! + Да, я одолжила пару вещичек, но послушайте. Взамен могу кое-что предложить. У меня есть связи с торговцами на других островах. + С торговцами? Есть и другие выжившие? + Ага. Но чтобы убедить их приехать сюда, мне потребуется [var=quest.market.gold_bar] [item=gold_bar default=Золотых слитков]. + Мы поймали тебя на краже, а ты ещё требуешь платы? + Кража кражей, а это сделка. Я предлагаю добавить ваш остров к торговому пути за [var=quest.market.gold_bar] [item=gold_bar default=Золотых слитков]. + Ладно. Если мы наладим торговлю с другими выжившими, сможем выбраться с этого острова. + Извини, конечно, но я не могу довериться вору. Покинь наш остров и больше не возвращайся. + Я-то не пропаду, воровать ведь можно не только у вас. А вот вы сами не знаете, от чего отказываетесь. + Отлично! Чувствую, впереди нас ждёт много выгодных сделок. + Возьми [item=coin_purse]. Пригодится, чтобы складывать монеты для купли-продажи. Ещё советую купить [item=mega_backpack] как можно скорее, жить сразу легче станет! + На [color=770000]Рынке[/color] можно продавать товары и получать за это монеты, которые используются для оплаты других товаров. + На [color=770000]Рынке[/color] иногда бывают новые поступления. Если не можешь найти то, что тебе нужно, или у них закончилось место в инвентаре, загляни позже. + Чтобы получить [item=gold_bar], нужно расплавить [item=gold]. Оно находится глубоко под землёй. [object=miner] наверняка может дать пару советов по добыче руды на такой глубине. + Хочешь посмотреть мир? Может, построим [color=770000]Пристань[/color]? + Я могу её построить, но мне понадобится [var=quest.dock.coins] [color=770000][tile=coin_purse.ico]Монет[/color], [var=quest.dock.wood] [item=wood default=Древесины], [var=quest.dock.cloth] [item=cloth default=Ткани] и [var=quest.dock.net] [item=net default=Сетей]. + Прекрасно, пора строить [color=770000]Пристань[/color]! + Если построить [tile=boat.ico] лодку на [color=770000]Верфи[/color], можно будет путешествовать по морю! + Материалы для [color=770000]Пристани[/color]: [var=quest.dock.coins] [color=770000][tile=coin_purse.ico]Монет[/color], [var=quest.dock.wood default=Древесины] [item=wood], [var=quest.dock.cloth] [item=cloth default=Ткани], [var=quest.dock.net] [item=net default=Сетей]. + Согласиться + Отказаться + Разве сегодня не прекрасный день для плавания? + У меня украли всё! Все мои труды насмарку! Кто это сделал? + Твои вещи теперь хранятся на разных островах. Согласись, было бы неплохо иметь возможность перемещать их со склада на склад. Моя служба доставки может с этим помочь – за небольшую плату! + С какого острова доставить вещи? + Я могу доставить вещи из [color=770000]{area}[/color] за 0.2 [color=770000][tile=coin_purse.ico]Монеты[/color] за ед. веса. Укажи, что нужно доставить: + На какой остров доставить выбранные предметы за {coins} [color=770000][tile=coin_purse.ico]Монет[/color]? + Груз в пути. Будешь на месте в следующий раз – проверь склад. Дай мне знать, если нужно будет доставить что-нибудь ещё. С тобой приятно иметь дело! +
+
+ Эта планета полна загадок! Я проводил эксперименты и, кажется, открыл магию! + Мне нужны материалы для исследований. Если тебе попадётся [item=wyrm], убей её и принеси мне [item=dragonblood default=Драконью кровь]. Я тебя награжу. + Я так и знал! Вот в чём секрет! Я должен немедленно организовать лабораторию! + Награда? Принеси мне в лабораторию материалы, и я сварю тебе волшебное зелье. + Скорее! Я не могу продолжать исследования без [item=dragonblood default=Драконьей крови]! + [item=dragonblood] кончилась! Мне нужны [var=quest.wyrm_pen.wyrm] живых [item=wyrm default=Личинки]! Тогда у нас будет бесконечный источник [item=dragonblood default=Драконьей крови] для экспериментов! + Прекрасно! Отойди в сторонку, пока я колдую! + Узри моё великолепное изобретение – [color=770000]Питомник для личинок[/color]! Это не просто питомник, это бесконечный источник [item=dragonblood default=Драконьей крови]! + [item=wyrm default=Личинку] можно поймать в [item=net], если тяжело её ранить. Но аккуратнее, она нужна мне живой! + Мы должны продолжать эксперименты над [item=wyrm default=Личинками]! Чем они питаются? Почему выделяют [item=dragonblood default=Драконью кровь]? Не забывай кормить [item=wyrm default=Личинок] в [color=770000]Питомнике для личинок[/color], чтобы больше узнать об их эволюции! + Я так и знал! [item=wyrm default=Личинки] могут превращаться в [item=dragon default=Драконов-детёнышей]! Но почему тогда [item=adult_dragon] такая редкость в этих землях? + Я уверен, что где-то в горах есть драгонье логово. Если сможешь его найти, вызови меня... возможно, там мы найдём ответы на свои вопросы. + Ох, [item=adult_dragon]! Давай послушаем, что она скажет. Я знаю простое заклинание для перевода. + Кто посмел нарушить мой сон? + Я искатель истины и волшебства. Поведай мне, почему в мире осталось так мало драконов? + Потому что древние покинули нас. Они тоже были искателями истины и волшебства. Они предали нас. + Мы готовы помочь! Взамен мы просим только знания. + Думаешь, вам по силам помочь? Докажите свои слова. Поговорим, если сумеете вывести и привести ко мне [var=quest.hatch_dragons.dragon] [item=dragon default=Драконов-детёнышей]. А пока вон с глаз моих! + Так я и знала, что вы тоже предатели! Узрите мой гнев! + Не думаю, что стоит будить её, пока у нас нет [item=dragon default=Дракона-детёныша]. + Вы сделали, что я просила? Быть может, у моего племени ещё есть надежда. + Прекрасно! Значит, ты раскроешь нам тайны магии? + К сожалению, у меня нет этих знаний. Нас создали древние. Они же построили это логово, чтобы нас выращивать. + Ответы могут скрываться на островах к востоку отсюда. Возвращайтесь, когда будете готовы, и я отнесу вас туда. + Ещё одно логово! Только представь, сколько драконов выращивали в таких местах с помощью магии! Так почему же... ну ладно, давай я активирую это логово. + Ещё я построил здесь [color=770000]Питомник для личинок[/color] на случай, если нам понадобится вырастить ещё драконов! Но я не смогу собирать здесь [item=dragonblood default=Драконью кровь], мне нужно заниматься исследованиями. + Где ты оставил дракона? Я его позову – постарайся больше не выпускать его из виду. + Так я и знал! Это искусственное логово, его создали с помощью магии! И, кажется, с целью выращивания драконов! + Думаю, я смогу его активировать... + Ага! Готово! В этом логове мы сможем выращивать драконов. Оно указывает на восток. Возможно, если слетать туда на драконе, найдём что-нибудь ещё... + Позволь осмотреть этот [item=rusty_axe]... Из-за ржавчины плохо видно, но я узнаю эти символы! + Здесь заложена древняя магия, но она уже истощилась. Думаю, я смогу её восстановить, если ты принесёшь нужный магический компонент... + [item=fire_tusk]... от какого существа ты его получил? Кажется, [item=rusty_axe] с ним резонирует. Возможно, это и есть нужный магический компонент! + Получилось! Интересно, кто сделал этот [item=thunder_axe]? Сколько ему лет? Если тебя понадобятся ещё такие, я добавил рецепт в лабораторию. + Дай взглянуть на [item=dark_fur]! Похоже, он существует между миром живых и миром духов... + Мне нужно изучить его получше, но из него легко можно сделать [item=shadow_cape], чтобы скрываться от обыкновенных глаз. Я добавил рецепт в лабораторию. + Этот остров наполнен магией. Мы на месте! + Я уже видел такую магию. Эти сооружения частично биологического происхождения и сейчас находятся в спячке. Нужно их пробудить. + Я разобрался, как активировать фиолетовую комнату, но остальные сооружения ещё нужно исследовать. + Здесь получится хорошая оперативная база. Я позабочусь обо всём необходимом. + Возможно, [item=wyrm default=Личинки] помогут нам активировать остальные объекты. + Попробуй проследить за какой-нибудь личинкой, а я пока переведу эти письмена. + Не бойся, ты ведь уже имел с [item=wyrm default=Личинками] дело. Проследить за одной из них и найти их логово будет несложно! + Что? Королева личинок...? Это сейчас неважно, взгляни лучше на [item=spirit_gem], который ты принёс! Уверен, теперь нас ждёт прорыв! + Вот, примерь [item=goggles]. Я изобрёл их, когда прочёл письмена. И хоть это и не помогло мне раскрыть тайну этих сооружений, возможно, они помогут тебе понять, что мы упустили из виду. + За [item=wyrm default=Личинкой] нужно проследить на острове к востоку, а не здесь! Здесь я их уже изучил! + Мне нужно время, чтобы это изучить. Отдохни пока в фиолетовой комнате. + Лес к востоку выглядит опасно. Я поставил [item=fence] и не советую за него заходить. + Я установил, что если поймать [item=spirit_gem] духов огня или воды, можно получить [item=fire_gem] или [item=water_gem]. Заряженные камни позволят нам активировать сооружения. + Не можешь отыскать духов элементов? Невооружённым взглядом их не увидеть, попробуй мои [item=goggles]! + [item=spirit_gem] можно размещать как ловушку, а затем заманивать туда духов! + Все сооружения активированы! Думаю, мы заслужили небольшой отдых в фиолетовой комнате. Но после – продолжим исследования! + Чего же ты ждёшь? Используй [item=water_gem], чтобы активировать синее сооружение! + Синее сооружение – это магический синтезатор! Он создаёт предметы при помощи магии! + Используй [item=focus_gem], чтобы запитать синтезатор. + Нам всё ещё нужен [item=water_gem], чтобы активировать синее сооружение! Возьми [item=spirit_gem] и поймай духа воды! + Чего же ты ждёшь? Используй [item=fire_gem], чтобы активировать красное сооружение! + Красное сооружение – это что-то вроде магической кузницы. Здесь можно зачаровывать предметы! + Поэкспериментируй с разными сочетаниями предметов и магических компонентов. Вдруг получится что-то невероятное! + Нам всё ещё нужен [item=fire_gem], чтобы активировать красное сооружение! Возьми [item=spirit_gem] и поймай духа огня! + Я всё размышляю над тем, какие ещё тайны скрывает в себе [item=wyrm]. + Чтобы я мог закончить исследование, принеси мне [var=quest.alter_gem.wyrm] [item=wyrm default=Личинку], [var=quest.alter_gem.fire_tusk] [item=fire_tusk] и [var=quest.alter_gem.yeti_fur] [item=yeti_fur]. + Получилось! Я создал [item=alter_gem]! С его помощью можно превращать [item=wyrm default=Личинок] – и, наверное, не только их – в полезное снаряжение! + Нужно продолжать изучать эту магическую отрасль! Возьми [item=alter_gem] и попробуй использовать его на [item=wyrm default=Личинке]! Если тебе понадобятся ещё [item=alter_gem default=Камни изменения], то я добавил рецепт в синтезатор. + Чтобы использовать [item=alter_gem], открой его в инвентаре, нажми Превратить, а затем выбери существо. + Не стесняйся использовать [item=alter_gem] на других существах... например, на [item=dragon default=Дракон-детёныше]. Или даже... на [item=adult_dragon default=Взрослом драконе]?! + Не хватает [item=alter_gem default=Камней изменения]? Их можно отыскать глубоко под землёй или создать в синтезаторе. + Не забывай кормить существ, прежде чем использовать [item=alter_gem default=Камни изменения]. Голодные существа быстро вернутся в норму! + Ты не потерпел крушение вместе с нами? + Нет, я состоял в разведотряде. Мы искали планеты для колонизации. + Нас было четверо, но остальные погибли. А когда пришли они, я понял, что эта планета проклята. + Мне удалось выжить только благодаря тому, что я успел хоть немного изучить их магию. Будь у меня тогда ваши [item=goggles], может, всё сложилось бы иначе. + Они были здесь? Охотились за тобой? + Да. Думаю, они завидовали моей магии. Или же боялись её? Сложно сказать наверняка... + Ты встретил их на этой планете десять лет назад? Это ещё до того, как они попытались истребить человечество и уничтожить Землю! + Верно. Я был первым, кто их встретил, и первым, кого они попытались убить. + Не знаю, как я должен был поступить, чтобы предотвратить войну. Они объявились внезапно и молча атаковали биологическим оружием. + Если бы мы только знали, как выйти с ними на контакт. + Возможно, сейчас у нас это получится. Я знаю заклинание для перевода. + Но они вроде бы решили нас игнорировать. Надеюсь, мы больше никогда их не встретим. + В последнее время я наблюдаю скачки в магической энергии. Есть вероятность, что это ложная тревога, но это может быть и один из них. + Если что-нибудь найдёшь, призови меня немедленно. Если это правда один из них, мы все в большой опасности. + Отлично, сейчас проверим, смогу ли я перевести! + Кто ты такая и что здесь делаешь? + По какому праву вы это спрашиваете? Это моя планета, мой дом! Вы здесь посторонние! + Этот магический экзоскелет выглядит знакомо... ты одна из них? + Те, кого вы называете «они»‎, это мои глупые собратья. Давным-давно они решили покинуть свой родной мир. Я же осталась здесь, избрав путь уединения и бессмертия. + Можешь рассказать нам о вашей магии? Почему происходят скачки энергии? Зачем вы создали драконов? + Молчать! Кто вы такие, чтобы я с вами это обсуждала? Если бы не моё терпение, вы давным-давно были бы мертвы. + Но теперь я вижу, что в одном они были правы. Вселенной будет лучше без вас и вам подобных! + Вы пожалеете, что потревожили меня! + Нет! + Что такое, разве мы не победили? + Мы не успели! Она отправила сигнал. Теперь они знают, что мы на этой планете! + Мы должны изучить как можно больше магии, чтобы сразиться с ними их же оружием, когда они придут! Иначе мы обречены. + Вы искуснее, чем я думала! Это недопустимо, магией владеть должны только мы. + Она отправляет сигнал! Если они его примут, то придут за нами! Я должен успеть! + Что случилось? Ты в порядке? + Нет... [pause=4] Сигнал отправлен…[pause=4] А моя жизненная сила полностью истощена… + Теперь дело за тобой…[pause=4] Поспеши!…[pause=4] Отыщи ответы… Воспользуйся их магией… + [tile=alchemist anim=alchemist.idle] Я возьму на себя защитный барьер и магию лечения. Держись позади, пока она атакует, и нападай сам, пока она перегружена. + [tile=alchemist anim=alchemist.idle] Нападай! + [tile=alchemist anim=alchemist.idle] Чувствую скачок магической энергии! Вряд ли мой барьер выдержит эту атаку! + Что ты здесь делаешь? + Работаю в лаборатории, анализирую образцы с восточного острова. + Я имел в виду, как ты так быстро вернулся? + Так же, как и всегда! Телепортировался, очевидно. А теперь не мешай, мне нужно закончить анализ. + Синтез самоцветов… встроенный панцирь… бесконечная эволюция… [font=drachenklaue]mumbo jumbo[/font]... + Тебе с ним не справиться. Если мы хотим выжить, нам нужен план! + Сражаться вместе + Позволить сражаться Алхимику + Назад! Ты слишком неопытен! +
+
+ Как холодно…[pause=1] Я так устал…[pause=1] Мне нужно укрытие, но вокруг только валежник! + [item=wood]... я едва могу её удержать! Понадобится больше [tile=stamina] [color=006600]Запаса сил[/color], чтобы двигаться, но останавливаться нельзя. Нужно найти укрытие! + Что это? Выглядит так, будто кто-то бросил строить укрытие на полпути. Будь у меня [var=quest.hut.wood] [item=wood default=Древесины], я бы мог закончить работу. + У меня есть {count} [var=quest.hut.wood] [item=wood default=Древесины]. Чтобы достроить [color=770000]Хижину[/color], нужно собрать ещё валежника. + Я оставил в [color=770000]Хижине[/color] {added} [item=wood default=Древесины]. Чтобы законить работу, мне нужно ещё {remaining}! + Этот топор мне пригодится. С его помощью я смогу построить [color=770000]Склад[/color], где буду хранить свои ресурсы. + Можно построить склад с помощью [var=quest.storehouse.wood] [item=wood default=Древесины] и [var=quest.storehouse.berries] [item=berries default=Ягод]. + Отлично! Пора строить склад! + То что надо. Теперь я не буду так уставать из-за того, что ношу всё с собой. + Интересно, правду ли говорила воровка о других выживших? + Может, стоит построить [color=770000]Пристань[/color], чтобы отправиться в плавание и отыскать их. Мне понадобится [var=quest.dock2.wood] [item=wood default=Древесины] и [var=quest.dock2.steel_bar] [item=steel_bar default=Стальных слитков]. + Отлично, пора строить [color=770000]Пристань[/color]! + Возможно, я смогу привлечь торговцев к нашей пристани, если построю [color=770000]Рынок[/color]. Для этого потребуется [var=quest.market2.gold_bar] [item=gold_bar default=Золотых слитков]. + Я собрал все материалы для постройки [color=770000]Рынка[/color]! + Я и правда нашёл торговцев! Они даже выдали мне [item=coin_purse], чтобы хранить монеты. + Осталось только построить [tile=boat.ico] лодку на [color=770000]Верфи[/color]! + Не знаю, что меня ждёт, но с пустыми руками я не вернусь. + Привези что-нибудь вкусненькое! + Не забудь исследовать под землёй тоже. Никогда не знаешь, на что можно наткнуться. + Не оставляй нас надолго – возвращайся поскорее. + Держись подальше от опасностей. + Тебя ждёт неведомый мир. + Ты плывёшь не туда, все тайны на востоке! + Наконец-то мы снова в деле! Ещё бы избавиться от этих разбойников! + А ты силён на вид. Сможешь их отпугнуть? + Ты и правда одолел разбойников! Прошу, прими это в знак благодарности. + Сегодня нам везёт – добыча сама идёт в руки! Стоило нам сбежать от Миррозов с их грязными экспериментами, как дела пошли в гору! + Странное место. Я будто оказался в другом измерении. Мне кажется, обстановка будет меняться всякий раз, когда я вхожу. + Чтобы торговать с нами, тебе нужен [item=coin_purse]. Мы можем тебе его дать за [var=recipe.sci1_coin_purse.sulfur] [item=sulfur default=Серу]. + Обменять [var=recipe.sci1_coin_purse.sulfur] [item=sulfur default=Серу] на [item=coin_purse]. + Эй, парниша, хочешь взглянуть на мои редкие товары? Такого больше нигде не купишь! + С тобой приятно иметь дело. Прости, но деньги не возвращаем. +
+
+ Не стоит отдыхать в чужой палатке! + Это, должно быть, палатка [object=hunter]а. Лучше её не трогать. + Эй! Видел, как я завалил того кабана? + Да... как тебе это удалось? + Легко! Главное – сноровка. + Я тут местность зачищаю. Если поможешь, научу тебя охотиться. + Учись использовать элемент внезапности. Атакуй врагов со спины, чтобы нанести критический удар. + Вот, держи [item=workbench]. Открой его в инвентаре, чтобы мастерить оружие! + Я предпочитаю [item=bow]и, чтобы не надо было подходить к противникам близко. Но если ты хочешь сражаться врукопашную, [item=buckler] поможет тебе блокировать атаки! + Жми [key=equipment], чтобы экипировать оружие, [key=attack], чтобы атаковать, и [key=defend], чтобы прикрыться щитом. + Попробуй сделать [item=bow] и убить парочку [color=770000][tile=boar]Кабанов[/color]. Если понадобится совет, дай мне знать! + Ты опасен. Держись подальше отсюда! + Ладно! Тогда я просто вернусь в горы! + Готов учиться охотничьим приёмам? + Мы мигом очистим эту местность от опасных созданий! + Дарю тебе свой старый [item=backpack] в награду за хорошую работу. Он не раз пригодится тебе в походе. + Можешь прокопать туннель, чтобы напасть сзади и застать кабанов врасплох. + [item=red_berries] временно повышают силу атаки. Но будь осторожен – они не слишком полезны для здоровья. + Если твои удары постоянно блокируют, значит, противник слишком силён. Найди оружие получше или используй удар посильнее. + Попробуй назначить горячую клавишу для [item=arrow default=Стрел]. Тогда ты сможешь стрелять, даже если [item=bow] не экипирован. Главное, чтобы он был в инвентаре! + Сидел я, значит, один-одинёшенек на склоне горы, как вдруг вижу костёр! И слышу смех! Он звучал так дружелюбно... + И ты решил спуститься, чтобы с нами подружиться? + Конечно нет. И на кабанов я охотился не для того, чтобы оказать на вас впечатление. Нет-нет. + Я просто хотел расширить свои охотничьи угодья. + Хочется узнать побольше об этом месте. Есть ли что-нибудь за пределами острова... + На востоке есть другие острова. Я видел их с вершины горы. + Думаешь, мы сможем туда добраться? + Не знаю. Берег с той стороны не самый надёжный. К тому же те острова показались мне странными. Там может быть опасно. + Хочешь сказать, мы должны просто смириться? + Я хочу сказать, что незачем искать неприятностей на свою голову, когда положение и так тяжёлое. + Нужно что-то делать с дикими животными. + Сделаешь [var=quest.fence.fence] [item=fence default=Забора] на [item=workbench]е? Так мы сможем огородить периметр. + Отлично. [color=770000][tile=boar]Кабанам[/color] не прорваться сквозь [item=fence], поэтому мы сможем защитить наше поселение. + Я поставлю одну секцию [item=fence]а здесь. Огради остальную часть базы, чтобы обеспечить безопасность! + Я видел волчонка неподалёку от поселения. Кажется, ему одиноко. + Где его стая? + Наверное, отбился. + Мы можем приручить его с помощью [var=quest.wolf.net] [item=net default=Сетей], [var=quest.wolf.trap] [item=trap default=Ловушек] и [var=quest.wolf.meat] [item=meat default=Мяса]. + Посмотрим, что можно сделать с этим волчонком. + Хорошо. Похоже, он тебе полностью доверяет. Теперь у тебя есть верный друг. + Ты можешь отдать приказ с помощью слота [color=770000]Cлуги[/color] в окне [color=770000]Cнаряжения[/color], и [item=wolf] будет следовать за тобой +
+
+ Всё сгорело! Какой ужас! + Что случилось? + Миррозы пытались перенаправить энергию и чуть здесь всё не взорвали! + Провалили свои эксперименты, а мы теперь должны наводить за них порядок... Пф! + Я не смогу ничего починить, у меня ведь совсем не осталось [item=titanium]а... + Ух ты. Не думала, что ты и правда раздобудешь [item=titanium]. + Спасибо, теперь я мигом всё починю. + Готово! Чтобы запитать станцию, понадобится [item=coal] или [item=refined_oil]. Ещё здесь можно изготовить [item=battery default=Батарею]. + О, у меня тут после ремонта остался металлолом, возьми его в награду за [item=titanium]! + Где мне взять ещё [item=titanium]а? Я никогда это не починю! + Дай мне знать, когда [item=battery] будет готова. Мы сможем сделать много классных штук, если у нас будет мобильный источник энергии! + На [color=770000]Энергостанции[/color] можно изготовить [item=battery default=Батарею]. Для этого тебе потребуется [item=sulfur] и [item=steel_bar]. Там же ты сможешь её перезарядить. + Пока [item=battery] находится в инвентаре, твоё снаряжение будет обеспечено энергией. + Общее количество твоей [tile=power] [color=444400]Энергии[/color] будет отображаться под [tile=health] [color=770000]Здоровьем[/color] и [tile=stamina] [color=006600]Запасом сил[/color]. + Наконец-то у нас снова появилась энергия. Эх, было бы ещё с чем повозиться из техники... + Если поможешь мне построить [color=770000]Завод[/color], будем производить всякое! + Отлично. Наконец-то будет с чем поиграться! + Теперь мы можем улучшать материалы и производить много крутых штуковин. Например, [item=drill default=Буры], [item=chainsaw default=Цепные пилы] и [item=shotgun default=Ружья]. + Я заметила, ты много копаешь. + Согласись, будь у нас механизм для того, чтобы поднимать всё наверх, было бы куда удобнее! + Идёт! За работу! + Тебе наверх? Или же вниз?! + Надо что-то починить? Ты по адресу! + Что за огнедышащее чудовище питает нашу станцию? Надеюсь, оно ничего не повредит! + Кто бы мог подумать, что выживших так много! + Да, но этого всё равно недостаточно. Чтобы спасти человечество, мы должны объединиться с другими колониями. + Думаешь, есть другие? + Наверняка есть. Нужно просто их найти способ выйти с ними на контакт. + А если в пути на нас нападут? + Хотя бы будем знать, что сдёлали всё что могли! Я не собираюсь отсиживаться на этой планете только потому, что сейчас всё спокойно. + Что случилось? Выглядишь неважно. + Я просила Миррозов перестать досаждать людям, но они отказываются слушать, а я не хочу с ними драться. + Молодец, что попыталась. Но они упрямые, как ослы, и понимают только язык силы. + Сдаваться ещё рано. Они злоупотребляют своей силой, и это неправильно. + Попробуй разузнать о Миррозах побольше. Ты уже всю местность проверил вокруг их лаборатории? + «К» в записях Миррозов это ты? Ты работала с них? + Нет... не совсем. Они [pause=4] мои родители. + Родители?! Может, они послушают собственную дочь. Попробуешь с ними поговорить? + Поверь, я пыталась. Они не слушают. Сосредоточились на своих «усовершенствованиях» и не хотят даже думать о других решениях. + Нам потребуется что-то очень убедительное, чтобы до них достучаться. Такое, что нельзя объяснить с научной точки зрения. + [item=dragon_armor] подойдёт? По силе как [item=adult_dragon], но может использоваться в качестве доспеха! + Странная штука, но попробовать точно стоит. Давай покажем это моим родителям. + Опять ты? На сей раз мы из тебя точно киборга сделаем! + Стойте! Не нападайте, это я. + Кэсс? Что ты здесь делаешь? + Хотела кое-что показать. Может, всё же не потребуется превращать людей в киборгов. + Как же так? Сделано не человеком, но показатели силы зашкаливают! + Если я расскажу, вы согласитесь прекратить эксперименты над людьми и перестать разбойничать? + Конечно, ведь это может открыть нам целую область для исследований! + По-видимому, коренные жители этой планеты создали драконов и магическое снаряжение. Возможно, это даже были они. + Мы используем их творения против них самих! Какая ирония! + Ты вообще видел, сколько времени? Не знаю, что там у тебя, но это подождёт до утра... +
+
+ Добро пожаловать в Золотой ключик! Лучшее (и единственное) место по эту сторону пустыни, где можно получить пищу и кров! + То есть это гостиница? Много людей у вас останавливается? + Через Закатный приют прибывает много народа – кто торгует, кто местность изучает, ну а кто просто ищет своё место в мире. + Но если мы не восстановим питание, вряд ли кто-то будет останавливаться. Я даже не знаю, сколько раз мне хотелось пойти к Миррозам и высказать всё, что думаю! + Прекрасно! Питание восстановлено! + Правда, Миррозы тут ни при чём. Не могу поверить, что мы до сих пор платим им за техническую поддержку! + Спалили энергостанцию и даже не удосужились её починить! + Нельзя просто перестать платить? + Я не могу оставить гостиницу без присмотра. Но если кто-нибудь сходит и поставит вопрос ребром, может, и получится отменить это нечестное соглашение. + Боюсь, мы не сможем вас поселить, пока не восстановим питание. + Желаете остановиться на ночь? Всего 50 [color=770000][tile=coin_purse.ico]Монет[/color]. В стоимость входит горячий ужин! + Не хватает денег? Боюсь, мы не сможем вас поселить. Мы же не благотворительностью занимаемся! + Я слышал, главный корабль упал где-то здесь? Как вам удалось выжить без спасательных капсул? + В этом-то и проблема. Всё благодаря Миррозам. Они чудом усовершенствовали что-то в последний момент и спасли весь наш сектор. Выходит, мы у них в долгу. + Но теперь мы лишились из-за них энергии. К тому же они стали выпускать бесчинствовать непонятных тварей. + Я даже слышал, что кто-то пропал без вести в пустыне, а неподалёку видели Миррозов. + И они думают, мы оставим всё как есть? Хотят, чтобы мы ещё и платили? Наше терпение на исходе. + Миррозы сказали, что перестанут требовать с вас деньги и экспериментировать на людях! + Отлично! Наконец-то хоть какое-то спокойствие будет. + Вот, возьми в качестве благодарности. + ... [item=coal]? + Что? Я же не благотворительностью занимаюсь. +
+
+ Наконец-то земля под ногами! Ты тоже только что прибыл? + Эй там! Приятно видеть, что другие выжившие тоже пускаются в плавание! + Не обращай внимания, Полли просто так здоровается. Недеюсь, ничего страшного, что теперь у тебя ботинки в водорослях! + Ты уже был на этом острове? + Ты знаешь, что за остров впереди? + Был, конечно. Он называется Закатный приют, там живёт больше выживших, чем на любом другом острове. + Знаю, конечно. Он называется Закатный приют, там живёт больше выживших, чем на любом другом острове. + Оно и понятно – там же главный корабль упал. + Будь осторожен. В последнее время про Закатный приют ходят недобрые слухи... + Слушай, моя [item=cat] Пэри снова убежала! Поможешь мне её найти? + Думаю, она просто не хочет снова выходить в море. Не любит воду. + Если поможешь, я научу тебя рыбачить. + Класс, спасибо! У меня есть лишняя [item=fishing_rod], держи. Нужна будет помощь в рыбалке, обращайся! + Пэри очень любит [item=toothfish]ей. Может, получится подманить её таким образом? + О, а вот и моя [item=cat]! Спасибо, дружище. + Похоже, она теперь от тебя без ума. Наверное, с тобой ей будет лучше. Оставишь себе? + Кошка слишком быстрая, не поймать! + Она выхватила [item=toothfish]а у меня из рук, но я не успел её схватить. Слишком быстрая. + Дать Пэри [item=toothfish]а? + На этот раз она не так сильно шарахается. + Иди ко мне, Пэри... хорошая девочка... + Кошка поймана! + В рыбалке главное – подгадать момент. Встань на краю пристани и воспользуйся удочкой. Затем жми [key=select], как только что-то попадётся на крючок. Поспешишь или промедлишь – ничего не поймаешь! + Если пишет «Жди...», значит нужно дать рыбе зацепиться покрепче. Дождись команды «Тащи!» и жми на [key=select] снова! + Некоторую рыбу поймать тяжелее, чем другую. Будь внимателен и жми на кнопку, когда появляются подсказки! + Крыша над головой, солнышко и огромный океан, где можно вволю рыбачить. Вот и всё что мне нужно. + А у тебя какая мечта? + Хочу выбраться с этой планеты. + Что? Зачем? Жить надоело? Они не знают пощады. + Я хочу узнать о них побольше... Разобраться, почему всё сложилось именно так... + Послушай, дружище. Я видел одного из них вблизи, когда мы улетали с Земли. Держись от них подальше – вот и всё, что тебе нужно знать. +
+
+ Вы и есть Миррозы? Зачем вы досаждаете Закатному приюту и создаёте своих мутантов? + Тебе не понять! Это ради всеобщего блага! Нам не выжить без новейшего оружия! + Мы должны быть готовы, когда они придут завершить начатое! Все жертвы были необходимы. + Нельзя приносить людей в жертву ради того, чего может и не случиться! Спасти человечество можно и другими способами! + Если ты будешь нам противостоять, мы будем вынуждены с тобой сразиться. + Что-то мне подсказывает, твоё тело идеально подойдёт для создания нового киборга! + Не могу поверить! Как ты можешь быть сильнее моего кибернетического тела? + Ты должен открыть нам секрет своей силы – это может стать ключом к спасению человечества! + Если я расскажу, вы согласны перестать досаждать людям и требовать с них деньги? + Конечно. Зачем нам эти скучные образцы, когда есть ты?! + Это же абсолютно новое направление в исследованиях! + Не стесняйся пользоваться нашей хирургической лабораторией. Нам не терпится увидеть, насколько сильнее ты станешь после наших киберусовершенствований! + Ты можешь удалить киберусовершенствование в любое время: выбери его в окне снаряжения и нажми «Удалить». Впоследствии его можно будет переустановить в хирургической лаборатории, но это потребует больше ресурсов. + Похоже, экран навигации ещё работает. Судя по всему, мы на планете Юнокс-428-С. + Миррозы добавили эту заметку?! Нужно у них уточнить... + Мы на родной планете врага? Откуда вы знаете? + Точно сказать нельзя... но мы взяли образцы руин по всей планете. Мало того, что они соответствуют их технологиям, так ещё и возрастом более миллиона лет! + Но теперь их нет? + Мы не обнаружили их на этой планете, но даже если они её покинули, рано или поздно вернутся. + Вот почему мы готовы были пожертвовать всем ради силы... Как только мы приземлились на этой планете, сражение стало вопросом времени. +
+
+ Неплохо... Интересно, кто это строил... и почему бросил. Кажется, это было недавно... + Помогите…[pause=4] пожалуйста…[pause=4] спасите… + Снаружи кто-то есть! Можно ли ему доверять? + Спасибо. Ты спас мне жизнь. Я уже почти утратил надежду. Я слишком проголодался и устал, чтобы закончить укрытие. Но что мы будем делать дальше? + Пока что – отдыхать в тепле и сухости. + А потом? Как мы будем выживать на этом пустынном острове? + Есть ли вообще смысл? Назад дороги нет, мы здесь застряли. + Попытка не пытка. Может, жить здесь будет не так уж и плохо. + Пожалуйста…[pause=4] помогите… + ...и когда я прибыла сюда, сразу же начала копать, поэтому даже не заметила шторм. + Но я рада, что встретила вас. Устала землю есть. Нет ничего лучше, чем отдохнуть в тепле после долгого дня в шахте. + Как думаешь, есть ли другие выжившие? + Честно говоря, я удивлена, что кто-то вообще пережил крушение. Но вот мы здесь, а значит наверняка есть и другие. + Вы, молодёжь, наверняка думаете, шо настал конец света. Я тож самое думал во время Третьей мировой, и ничего, сижу тут с вами живой и здоровый. + Я так скажу, над делать всё, шо в наших силах, да радоваться еде на столе и ладной компании. + Но сколько нам придётся жить на этом богом забытом острове? + Кто знает? Но надежда умирает последней. Возможно, со временем здесь станет не хуже, чем дома. + Расскажешь, что ты знаешь о других выживших? + Большинство людей разбросало по разным островам. Где-то народу больше, где-то меньше, а на некоторых островах даже кое-какие технологии в ходу. + Я даже слышала, что на каком-то из островов есть почти не повреждённый корабль. + А летать может? + Не знаю, это ведь только слухи. Но даже если может, это верная смерть. Лучше оставаться на этой планете. Пока мы здесь, им до нас вроде бы дела нет. + У тебя так хорошо получается. Ты был охотником до крушения? + Хе-хе. Никогда в жизни не убивал животных. Я учёный. Работал в лаборатории. Молекулы и всё такое. + Ух ты. Как ты тогда всему научился? + Чему только не научишься, чтобы выжить. + В таких условиях человек меняется. Настолько, что прежний ты едва бы себя узнал. + Они даже восстанавливают технологии? + Да, на Закатном приюте есть электричество и промышленность. + Но люди не очень-то довольны Миррозами, которые всё это и организовали. + Миррозы выжили?! + Ты их знаешь? + К сожалению, да. Мы раньше работали в одной лаборатории, изучали генетику. + А когда на нас напали, они начали проводить ужасные эксперименты и даже ставить опыты над людьми. Я не смог больше с ними работать. + Слушайте, нам тоже надо восстановить технологии! Раз они смогли, сможем и мы! + Вот это настрой! Совсем скоро будем чувствовать себя как дома. +
+
+ 15.03 – Мы вынуждены покинуть Землю. Наше оружие бессильно, и они упорно продолжают нас преследовать. Возможно, нам удастся избежать их гнева на другой планете. + 01.05 – Корабль сильно пострадал во время побега, но активация пространственного прыжка прошла успешно. Можно считать, что нам удалось оторваться. Если корабль выдержит путешествие, разумеется. + 30.06 – Разработали новый план по усилению человеческого тела и повышения живучести. Определили количество образцов, необходимых для достижения цели. Х. покинул научную группу. + 05.08 – Достигли планеты назначения. Войти в атмосферу невозможно, а спасательных капсул недостаточно. Вероятность выжить низкая даже для усиленных образцов. Враг не обнаружен. + 02.09 – Укрепляем обшивку корабля, но для выживания необходимо усиление. Диссиденты отказываются от операции несмотря на то, что от этого зависит их жизнь. + 26.09 – Оставаться на орбите больше невозможно. Многие согласились на усиление, а отказавшихся отправили в спасательных капсулах. Надеемся, укрепление обшивки спасёт остальных. + 04.10 – Экстренное укрепление обшивки сработало. Однако количество выживших намного ниже, чем ожидалось, даже с учётом спасательных капсул, о которых у нас нет данных. + 05.10 – Жизнеспособность вида стала главной проблемой. Нескольких сотен человек недостаточно для выживания. Требуется срочное вмешательство. Начали новое исследование. + 20.11 – Обеспечили базовую инфраструктуру к востоку от места крушения. Собираем образцы для экспериментов. + 14.12 – Исследования по жизнеспособности зашли в тупик, но военные технологии выглядят многообещающе. С помощью киберусовершенствований из обычного человека можно сделать машину смерти. + 24.12 – К. высказывается против военных исследований. Вместо того, чтобы подготовиться к их возвращению и повысить жизнеспособность вида, К. хочет вернуться к звёздам и отыскать других выживших. + 06.01 – К. покинула лабораторию, дав понять, что в городе нам больше не рады. Перенесли исследования в старую лабораторию в руинах сектора 22. + 31.01 – В силу отсутствия образцов проводим кибернетические опыты на себе. Враг по-прежнему не обнаружен. Возможно, на этот раз мы сможем дать отпор. + 09.02 – Убедили жителей города спонсировать исследования. Нашли новые образцы (бродяги и изгои). Возобновили работу. + 27.02 – Бродяги закончились, пришлось набирать образцы среди жителей. Если исследования по жизнеспособности скоро не завершатся, у нас снова кончатся образцы. + Панель сломана... +
+
+ Юнокс-428 +
+
+ Звезда класса G на расстоянии 42-х световых лет от Земли. \nОбнаружено 3 экзопланеты. +
+
+ Юнокс-428{char} +
+
+ Обитаемая планета земного типа. Зона для колонизации #21.\n\nПредположительно [color=ff2222]родная планета врага[/color]. + Небольшая твёрдая планета земного типа. Расположена близко к звезде. Не имеет атмосферы. Вероятно, содержит ценные ископаемые и [item=exotic_matter default=Экзотическую материю]. + Ледяной гигант. Обладает сильным гравитационным полем. В атмосфере преобладают бури. +
+
+ Настройки + Пауза + Громк. музыки: + Громк. звуков: + Полный экран: + Скорость текста: + Язык: + Игровой процесс + Интерфейс + Управление + Достижения + Главное меню + Назад + Вернуться в главное меню? Несохранённый прогресс будет утерян. + Клавиатура + Контроллер + Импорт сохранения + Экспорт сохранения + Импортировать можно только в главном меню. + Чтобы импортировать сохранение, перетащите файл .asav в окно игры и выберите слот. + Выберите слот для импорта сохранения. + Куда экспортировать сохранение? + Нельзя импортировать: сохранение повреждено. + Нельзя экспортировать: сохранение повреждено. + Восстанавливать здоровье едой? + Восстанавливать запас сил едой? + Макс. перегруз: + Оповещения: + Показать всё + Скрыть внизу + Скрыть элементы + Скрыть внизу, элементы + Скрыть крит. + Скрыть внизу, крит. + Скрыть элементы, крит. + Скрыть всё + Кнопки «Переместить всё» + Переместить все предметы из одного инвентаря в другой? + Прозр. интерф.: + Спрашивать, сколько скрафтить + Включить вспышки + Оповещения от NPC на расстоянии + Чертежи во вкладке «Всё» + Копать дорожки? + Спрашивать перед «Выбросить всё» + Показывать сообщения о находке + Ресурсы при размещении чертежей + Приоритет NPC без заданий + Автосбор предметов + Переключать гор. клав. для снаряж. + Приоритет складу + Сложность: +
+
+ Когда у персонажа закончится здоровье, он не умрёт, а автоматически съест еду для восстановления здоровья (при наличии) из инвентаря. + Когда у персонажа закончится запас сил, он не будет терять здоровье, а автоматически съест еду для восстановления запаса сил (при наличии) из инвентаря. + Устанавливает лимит веса, при котором персонаж перестанет двигаться (чтобы не умереть от передвижения с перегрузом). Переместите ползунок в крайнее левое положение, чтобы снять ограничение. + Какие оповещения отображать.\n«Внизу» – оповещения в нижней части экрана (например, о том, что NPC положил предметы на склад).\n«Элементы» – оповещения о срабатывании или отражении элементальных атак.\n«Крит.» – оповещения о критическом ударе, промахе, уклоне и блоке. + Включает кнопки «Переместить всё» "<" ">" в окне обмена предметами. + Устанавливает прозрачность интерфейса (полоса здоровья, кнопки и т.д.). + Вам будет предложено выбрать, сколько предметов скрафтить или расплавить за раз. В противном случае всегда будет крафтиться только один предмет. + Отключите это, если вы чувствительны к вспышкам. Функция отключит наиболее ярко мерцающие изображения в игре. Может не поддерживаться в модах. + NPC будут оповещать вас о том, что добавили предмет на склад какого-либо строва. В противном случае оповещения будут касаться только предметов на данном острове. + При отключении этой функции вы не сможете копать сквозь дорожки (что не даст вам их случайно собрать). Включите функцию, чтобы собрать и переставить дорожки. + Отключите, если хотите размещать чертежи сразу, а ресурсы для строительства добавлять позже. + Отключите, чтобы NPC не закрывали доступ к сооружениям или предметам, когда у них нет заданий. + Во время добычи ресурсов, сбора ягод или сражения с врагом предметы будут подбираться автоматически. + При использовании горячей клавиши для экипировки предмета, клавиша переназначится на тот предмет, который был экипирован ранее. + По умолчанию добавлять предметы на склад (или брать со склада), а не инвентаря игрока. +
+
+ Влево: + Вправо: + Вверх: + Вниз: + Действие: + Отмена: + Предметы: + Задания: + Снаряжение: + Атака: + Защита: + Устройство: + Гор. клав. 1: + Гор. клав. 2: + Гор. клав. 3: + Гор. клав. 4: + Гор. клав. 5: + Гор. клав. 6: + Гор. клав. 7: + Гор. клав. 8: + Без звука: + Чат: + Ходить: +
+
+ Войти в Облако Aground\nОблако Aground – это дополнительный сервис, который синхронизирует сохранения из всех версий игры. + Осуществляется вход... Пожалуйста, подождите... + Неправильный логин или пароль. + Не удалось установить соединение. + Синхронизация не удалась! + Войти в Облако Aground + Выйти из Облака Aground + Вход в Облако Aground не осуществлён + Вы вошли как: {username} + Логин: + Пароль: + Запомнить? + Создать аккаунт + Логин должен состоять из 3-24 символов. + Пароль должен состоять из 3-40 символов. + Синхронизация слотов + Все сохранения синхронизированы! + У вас есть несинхронизированные сохранения! + Синхронизировать + В этом слоте два сохранения!\nКакое оставить? + Сохранения синхронизируются. Хотите выйти до окончания синхронизации? + Отключиться? +
+
+ Мы используем Mod.io для установки и управления модами. Введите адрес вашей эл. почты, чтобы начать! + E-Mail: + Адрес эл. почты недействителен! + Введите 5-значный код, который был отправлен на ваш адрес эл. почты: + Не удалось найти адрес вашей эл. почты на mod.io! + Неверный код! + Вы вошли на Mod.io! Моды, на которые вы подписаны, загрузятся автоматически! + Версия + Включить мод + Отключить мод + Загрузить на Mod.io + Не удалось загрузить + Загрузка прошла успешно! + Войти в Mod.io + Смотреть моды + Выйти с Mod.io + Вход на Mod.io не осуществлён + Перед загрузкой вы должны добавить картинку для превью (preview.png) в папку с модом! + Посетить сайт + Хотите отключить {mod}? + Некорректный мод, либо в zip-архиве отсутствует xml-файл. + Мод {modname} успешно установлен! + Вы уже установили мод с таким именем. Хотите заменить? Если изображения из мода редактировались после замены, вам может потребоваться перезагрузить игру. +
+
+ Загрузить в Steam + Загрузить {name} в Мастерскую Steam: + Заметки: + ID: + Согласиться с условиями пользования Мастерской. + Создать +
+
+ Как назвать эту местность? + Начальный остров + Закатный приют + Восточный остров + Пещера воды + Корабль-колония +
+
+ Создать персонажа + Цвет кожи: + Цвет волос: + Цвет глаз: + Цвет рубашки: + Цвет штанов: + Причёска: + Рубашка: + Волосы на лице: + Цвет меха: +
+
+ Чёрный + Коричневый + Тёмно-коричневый + Светло-коричневый + Синий + Тёмно-синий + Голубой + Зелёный + Светло-зелёный + Красный + Жёлтый + Оранжевый + Розовый + Фиолетовый + Белый + Серый + Бирюзовый + Блонд + Тёмный блонд + Свой +
+
+ Расстёгнута + Застёгнута +
+
+ Очень легко + Лёгко + Средне + Сложно + Тяжело + Самоубийство + Креатив + Смерть от 1-го удара +
+
+ Выбрать кампанию + По умолчанию + Стандартная версия Aground. +
+
\ No newline at end of file diff --git a/games/aground/data/core/magic1/enemies/alien.png b/games/aground/data/core/magic1/enemies/alien.png new file mode 100644 index 00000000..0c40989b Binary files /dev/null and b/games/aground/data/core/magic1/enemies/alien.png differ diff --git a/games/aground/data/core/magic1/enemies/alien_fx.png b/games/aground/data/core/magic1/enemies/alien_fx.png new file mode 100644 index 00000000..62d276e0 Binary files /dev/null and b/games/aground/data/core/magic1/enemies/alien_fx.png differ diff --git a/games/aground/data/core/magic1/enemies/alien_fx.xml b/games/aground/data/core/magic1/enemies/alien_fx.xml new file mode 100644 index 00000000..ea9008d8 --- /dev/null +++ b/games/aground/data/core/magic1/enemies/alien_fx.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/games/aground/data/core/magic1/enemies/crawler.png b/games/aground/data/core/magic1/enemies/crawler.png new file mode 100644 index 00000000..5198ed8d Binary files /dev/null and b/games/aground/data/core/magic1/enemies/crawler.png differ diff --git a/games/aground/data/core/magic1/enemies/elementals.png b/games/aground/data/core/magic1/enemies/elementals.png new file mode 100644 index 00000000..d45edd93 Binary files /dev/null and b/games/aground/data/core/magic1/enemies/elementals.png differ diff --git a/games/aground/data/core/magic1/enemies/elementals.xml b/games/aground/data/core/magic1/enemies/elementals.xml new file mode 100644 index 00000000..f885380e --- /dev/null +++ b/games/aground/data/core/magic1/enemies/elementals.xml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/games/aground/data/core/magic1/enemies/enemies.xml b/games/aground/data/core/magic1/enemies/enemies.xml new file mode 100644 index 00000000..73b758e5 --- /dev/null +++ b/games/aground/data/core/magic1/enemies/enemies.xml @@ -0,0 +1,290 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + this.vars.set("pack_up", true); this.dismount(); +
+ player.inventory.addAll(this.inventory); + +
+
+ + +
+ +
+ lair.collectAnimal(player); lair.setAnimal("adult_dragon", this.fuel, this.name); lair.fadeAnimalIn(); lair.inventory.copyFrom(this.inventory); this.inventory.clear(); +
+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ this.setVulnerable(2,9); + + + this.renderer.setTile(this.tile_x+dx, this.tile_y, this.renderer.speed); + + this.endVulnerable(); +
+ this.run(); +
+ this.flip(); this.run(); + +
+ + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + this.run(); + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ area.spawner.spawn("golem", 1) + area.spawner.spawnAll("golem") +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/games/aground/data/core/magic1/enemies/fire_elemental.png b/games/aground/data/core/magic1/enemies/fire_elemental.png new file mode 100644 index 00000000..113c823c Binary files /dev/null and b/games/aground/data/core/magic1/enemies/fire_elemental.png differ diff --git a/games/aground/data/core/magic1/enemies/golemech.png b/games/aground/data/core/magic1/enemies/golemech.png new file mode 100644 index 00000000..edc4a141 Binary files /dev/null and b/games/aground/data/core/magic1/enemies/golemech.png differ diff --git a/games/aground/data/core/magic1/enemies/golemech.xml b/games/aground/data/core/magic1/enemies/golemech.xml new file mode 100644 index 00000000..009a7995 --- /dev/null +++ b/games/aground/data/core/magic1/enemies/golemech.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/games/aground/data/core/magic1/enemies/icer.png b/games/aground/data/core/magic1/enemies/icer.png new file mode 100644 index 00000000..5f3b9120 Binary files /dev/null and b/games/aground/data/core/magic1/enemies/icer.png differ diff --git a/games/aground/data/core/magic1/enemies/jelly.png b/games/aground/data/core/magic1/enemies/jelly.png new file mode 100644 index 00000000..0ce872dc Binary files /dev/null and b/games/aground/data/core/magic1/enemies/jelly.png differ diff --git a/games/aground/data/core/magic1/enemies/leech.png b/games/aground/data/core/magic1/enemies/leech.png new file mode 100644 index 00000000..812e1dc5 Binary files /dev/null and b/games/aground/data/core/magic1/enemies/leech.png differ diff --git a/games/aground/data/core/magic1/enemies/leech.xml b/games/aground/data/core/magic1/enemies/leech.xml new file mode 100644 index 00000000..a539380e --- /dev/null +++ b/games/aground/data/core/magic1/enemies/leech.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/games/aground/data/core/magic1/enemies/magic_beam.png b/games/aground/data/core/magic1/enemies/magic_beam.png new file mode 100644 index 00000000..aa9f6e2b Binary files /dev/null and b/games/aground/data/core/magic1/enemies/magic_beam.png differ diff --git a/games/aground/data/core/magic1/enemies/magic_fx.png b/games/aground/data/core/magic1/enemies/magic_fx.png new file mode 100644 index 00000000..c919e350 Binary files /dev/null and b/games/aground/data/core/magic1/enemies/magic_fx.png differ diff --git a/games/aground/data/core/magic1/enemies/magic_wyrm.png b/games/aground/data/core/magic1/enemies/magic_wyrm.png new file mode 100644 index 00000000..c2f4570e Binary files /dev/null and b/games/aground/data/core/magic1/enemies/magic_wyrm.png differ diff --git a/games/aground/data/core/magic1/enemies/oldone.xml b/games/aground/data/core/magic1/enemies/oldone.xml new file mode 100644 index 00000000..8f2f3396 --- /dev/null +++ b/games/aground/data/core/magic1/enemies/oldone.xml @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ this.alpha = 0; + +
+
+ + + + + player.heal(5) + +
+ + + var p = area.getClosestPlayer(this.getCenterX(), this.getCenterY()); while(orbs.length > 0) if(p == null) orbs.pop(); else Movement.seek(orbs.pop(), p, 4); + + function addOrb(dx, dy){ + var o = getObject("magic_orb").create(this.xPos+dx, this.yTile+dy); + area.addObject(o); Movement.circle(o, this, 1.25, 4); orbs.push(o); + } addOrb(-24, 0); addOrb(24, 0); addOrb(0, -24); addOrb(0, 24); + if(this.getHealthPercent() <= 0.5){ + addOrb(-24, -24); addOrb(24, -24); addOrb(-24, 24); addOrb(24, 24); + } + +
+ + + this.alpha = 0; + + + + + + + + + + + setFlag("oldone.hostile", true) + + + + + + + setControl(true); setFlag('oldone.begin', true) + + + + +
+ setFlag("oldone.hostile", false); setFlag("oldone.beam", false); + +
setFlag("oldone.hostile", false); setFlag("oldone.beam", false); +
+ + + + + + setFlag("oldone.hostile", true) + + this.renderer.scaleX = -this.renderer.scaleX; this.knockback(sign(this.renderer.scaleX)*128, true); + + while(orbs.length > 0) area.removeObject(orbs.pop()); + + + +
+ + var dx = sign(this.xPos-player.xPos); if(dx == 0) dx = sign(this.renderer.scaleX); else this.renderer.scaleX = dx; this.knockback(dx*128, true); + +
+ setFlag("oldone.beam", true) + +
+ + +
+ + this.setVulnerable(3,20);this.endVulnerable(); + this.renderer.scaleX = -this.renderer.scaleX; this.knockback(sign(this.renderer.scaleX)*128, true); + + +
+
+
+ +
+ + +
+ + + this.setVulnerable(3,20); + this.endVulnerable(); + + + +
+
+ var p = area.getClosestPlayer(this.getCenterX(), this.getCenterY()); if(p != null){Movement.seek(orbs.pop(), p, 4); if(orbs.length > 0 && this.getHealthPercent() <= 0.5) Movement.seek(orbs.pop(), p, 4);} + +
+
+ +
+ setFlag('oldone.begin', false) +
+
this.moveTalk(player, 0.75)
+
+
+
+
\ No newline at end of file diff --git a/games/aground/data/core/magic1/enemies/skyfish.png b/games/aground/data/core/magic1/enemies/skyfish.png new file mode 100644 index 00000000..ad6ba01c Binary files /dev/null and b/games/aground/data/core/magic1/enemies/skyfish.png differ diff --git a/games/aground/data/core/magic1/enemies/skyfish.xml b/games/aground/data/core/magic1/enemies/skyfish.xml new file mode 100644 index 00000000..bd6489dc --- /dev/null +++ b/games/aground/data/core/magic1/enemies/skyfish.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/games/aground/data/core/magic1/enemies/tree.png b/games/aground/data/core/magic1/enemies/tree.png new file mode 100644 index 00000000..3410c9f9 Binary files /dev/null and b/games/aground/data/core/magic1/enemies/tree.png differ diff --git a/games/aground/data/core/magic1/enemies/tree.xml b/games/aground/data/core/magic1/enemies/tree.xml new file mode 100644 index 00000000..f2ec6157 --- /dev/null +++ b/games/aground/data/core/magic1/enemies/tree.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/games/aground/data/core/magic1/enemies/wyrm_queen.png b/games/aground/data/core/magic1/enemies/wyrm_queen.png new file mode 100644 index 00000000..7606af27 Binary files /dev/null and b/games/aground/data/core/magic1/enemies/wyrm_queen.png differ diff --git a/games/aground/data/core/magic1/enemies/wyrm_queen.xml b/games/aground/data/core/magic1/enemies/wyrm_queen.xml new file mode 100644 index 00000000..7e45cf6c --- /dev/null +++ b/games/aground/data/core/magic1/enemies/wyrm_queen.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/games/aground/data/core/magic1/items/dragarmor.png b/games/aground/data/core/magic1/items/dragarmor.png new file mode 100644 index 00000000..710b5fe8 Binary files /dev/null and b/games/aground/data/core/magic1/items/dragarmor.png differ diff --git a/games/aground/data/core/magic1/items/dragarmor.xml b/games/aground/data/core/magic1/items/dragarmor.xml new file mode 100644 index 00000000..22b31aee --- /dev/null +++ b/games/aground/data/core/magic1/items/dragarmor.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/games/aground/data/core/magic1/items/goggles.png b/games/aground/data/core/magic1/items/goggles.png new file mode 100644 index 00000000..c99f63ef Binary files /dev/null and b/games/aground/data/core/magic1/items/goggles.png differ diff --git a/games/aground/data/core/magic1/items/items.xml b/games/aground/data/core/magic1/items/items.xml new file mode 100644 index 00000000..8982add8 --- /dev/null +++ b/games/aground/data/core/magic1/items/items.xml @@ -0,0 +1,275 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + function spirit_detector(e){runProcedure("spirit.detector", null, e.target);} + function spirit_detector_structure(s){ + if(s.info.xml.get("type") == "door" || s.info.xml.get("remove") == "false" || s.info.xml.get("type") == "dock" || s.info.xml.get("renderer") == "spirit") return -1; + else return 6; + } + function spirit_detector_object(o){ + if(o.isPlayer()) return 2; + else if(o.info.xml.get("allowModifier") == "true" || o.info.xml.nodeName() == "npc") return 3; + else if(o.attackPower(1,0,0,null,true) > 0) return 1; + else if(o.attackPower(0,0,1,null,true) > 0) return 5; + else if(o.renderer == null || o.info.xml.nodeName() == 'enemy') return -1; + else return 6; + } + + + player.addEventListener("teleport", spirit_detector); player.addEventListener("mount", spirit_detector); spirit_detector({target:player}); + player.removeEventListener("teleport", spirit_detector); player.removeEventListener("mount", spirit_detector); + + \ No newline at end of file diff --git a/games/aground/data/core/magic1/items/spirit_detector.png b/games/aground/data/core/magic1/items/spirit_detector.png new file mode 100644 index 00000000..9b047ed9 Binary files /dev/null and b/games/aground/data/core/magic1/items/spirit_detector.png differ diff --git a/games/aground/data/core/magic1/magic1.xml b/games/aground/data/core/magic1/magic1.xml new file mode 100644 index 00000000..d7799438 --- /dev/null +++ b/games/aground/data/core/magic1/magic1.xml @@ -0,0 +1,464 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + player.overlapChanged(); wyrm_pen.renderer.alpha = 0; + + + + + + + + + + + + + + + + for(i in 64...96){setOre(i, 12, "lava"); mine(i, 13, 0, "magic1.stone"); setTile(i, 12, "invisible_block");} setOre(63, 13, "lava"); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + this.inventory.addItems(Item.get("focus_gem"), 2); + + + + + + + + + + + + + + + + + + + + + + + + + + + for(y in 2...8) setTile(21, y, "invisible_block") + + + + + + + + + + + + area.spawner.spawnAll('skyfish'); setFlag('jump_water', true); + + + + area.getObject('alien').restoreHealth() + + + _x = 2.0 + + + _x += 7.5; + + area.spawner.spawnAll('skyfish'); + + for(x in 15...27) setTile(x, -7, "stone") +
+ + for(x in 69...76){setBack(x, -6, "stone"); area.setLit(x, -6);} for(x in 68...77){setBack(x, -5, "stone"); area.setLit(x, -5);} + for(y in -4...0) for(x in 68...78){setBack(x, y, "stone"); area.setLit(x, y);} setBack(78, -1, "stone"); area.setLit(78, -1); + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + for(y in 2...6) for(x in 6...10) setTile(x, y, "bedrock"); for(y in 3...5) for(x in 7...9) mine(x, y); + for(x in 10...15){for(y in 3...6) setTile(x, y, "bedrock"); mine(x, 4);} + mine(9, 4); for(x in 13...15) setTile(x, 6, "stone"); + for(x in 15...18){setTile(x, 5, "snow"); setTile(x, 6, "snow_stone");} setTile(18, 5, "snow"); + + + + + + + + + + + + + + + + + + + this.inventory.addItems(Item.get("spirit_gem"), 1); + this.inventory.addItems(Item.get("spirit_gem"), 1); + + + + + + + for(y in 1...14){setTile(0, y, "blackstone"); setTile(18, y, "blackstone");} for(x in 0...19){setTile(x, 0, "blackstone"); setTile(x, 14, "blackstone");} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + var t = toArea.getBaseTile(tx, ty); for(dy in -6...7) for(dx in -6...7){ + var _x = tx+dx; var _y = ty+dy; + if(!toArea.overlapsStructure(_x, _y, 1, 4) && !toArea.hasObjectInTile(_x, _y) && toArea.getBaseTile(_x, _y) == t) ar.push({x:_x, y:_y}); + } + + + var n = ar[randInt(0, ar.length)]; this.x = n.x*Tile.SIZE; this.y = n.y*Tile.SIZE; +
+
+
+ var s = buildStructure("wyrm_tunnel", player.tile_x, player.tile_y); s.area_id = "wyrm_tunnels"; s.x = this.xPos; s.y = this.yPos; +
+ + + setBack(48, 48, "magic1.stone"); + + + + for(i in 0...2) exits.push({area:"wyrm_tunnels", x:0, y:0}); exits.push({area:"wyrm_tunnels2", x:32, y:32}); + exits.push({area:"wyrm_hive", x:17, y:1}); exits.push({area:"magic1", x:14, y:-11}); + for(i in 0...2) exits.push({area:"wyrm_hive2", x:9, y:2}); + for(i in 0...2) exits.push({area:"magic_ore", x:randInt(2,62), y:randInt(2,15)}); + function add(area_id, x, y, w, h){ + exits.push({area:area_id, x:randInt(x, x+w), y:randInt(y, y+h)}); + } add("farming", 2, 2, 124, 9); add("water_cave", 24, 35, 7, 10); add("start", 25, 2, 21, 9); + add("start", 2, 64, 92, 30); add("start", 106, 0, 21, 9); add("start", 104, 86, 21, 8); + add("magic1", 2, 2, 32, 5); add("magic1", 2, 60, 92, 20); add("magic1", 2, 120, 92, 20); + add("science1", 140, 2, 50, 5); add("science1", (random() < 0.5)?2:70, 2, 20, 9); + add("science1", 140, 70, 50, 20); add("science1", 2, 70, 88, 20); + + + setBack(x, y, "magic1.stone"); var s = buildStructure("wyrm_tunnel", x, y); + var exit = exits[i++]; s.area_id = exit.area; s.x = exit.x*Tile.SIZE; s.y = exit.y*Tile.SIZE; + structures.push(s); + + i = 0; while(i < 2){var s1 = structures[i]; var s2 = structures[i+1]; s1.x = s2.xPos; s1.y = s2.yPos; s2.x = s1.xPos; s2.y = s1.yPos; i += 2;} + + + + for(y in 1...95){setTile(0, y, "blackstone"); setTile(95, y, "blackstone");} for(x in 0...96){setTile(x, 0, "blackstone"); setTile(x, 95, "blackstone");} + + + + for(y in 31...34) for(x in 31...34) setBack(x, y, "magic1.dirt"); + + for(i in 0...8) exits.push({area:"wyrm_tunnels2", x:0, y:0}); + exits.push({area:"lab_blueprint", x:1, y:-1}); + exits.push({area:"wyrm_pen_blueprint", x:1, y:-1}); + exits.push({area:"spirit_gem", x:5, y:-1}); + + setBack(x, y, "magic1.stone"); var exit = exits[i++]; if(exit.y < 0){ + var o = ObjectInfo.make("treasure_chest", x*Tile.SIZE, y*Tile.SIZE); area.addObject(o); + o.inventory.addItems(Item.get(exit.area), exit.x); + } else { + var s = buildStructure("wyrm_tunnel", x, y); + s.area_id = exit.area; s.x = exit.x*Tile.SIZE; s.y = exit.y*Tile.SIZE; structures.push(s); + } + + i = 0; while(i < 8){var s1 = structures[i]; var s2 = structures[i+1]; s1.x = s2.xPos; s1.y = s2.yPos; s2.x = s1.xPos; s2.y = s1.yPos; i += 2;} + + + + + for(y in 1...63){setTile(0, y, "blackstone"); setTile(63, y, "blackstone");} for(x in 0...64){setTile(x, 0, "blackstone"); setTile(x, 63, "blackstone");} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + for(x in 27...29) mine(x, 28, 0, "snow"); for(y in 27...29) for(x in 29...31) mine(x, y, 3, "snow"); + for(y in 27...30) for(x in 5...18) mine(x, y, 0, "snow"); replaceTile(5, 27, "ice_wall"); + replaceTile(8, 29, "ice_wall"); for(x in 16...18) replaceTile(x, 29, "ice_wall"); + for(y in 13...15) for(x in 4...13) mine(x, y, 0, "snow"); for(x in 4...7) mine(x, 12, 0, "snow"); + for(y in 1...3) for(x in 1...13) mine(x, y, 0, "snow"); for(y in 3...6) for(x in 11...13) mine(x, y, 0, "snow"); + for(y in 4...9) for(x in 12...18) mine(x, y, 0, "snow"); replaceTile(17, 4, "ice_wall"); + for(y in 9...11) for(x in 13...17) mine(x, y, 0, "snow"); replaceTile(13, 10, "ice_wall"); + for(x in 15...18) mine(x, 11, 0, "snow"); for(x in 1...5) mine(x, 19, 0, "snow"); + for(y in 16...23) for(x in 20...28) mine(x, y, 0, "snow"); replaceTile(27, 16, "ice_wall"); + replaceTile(20, 22, "ice_wall"); replaceTile(21, 22, "ice_wall"); mine(27, 23, 0, "snow"); mine(27, 24, 0, "snow"); + for(y in 18...22) mine(28, y, 0, "snow"); for(y in 16...21) mine(19, y, 0, "snow"); for(y in 18...21) mine(18, y, 0, "snow"); + for(y in 13...15) mine(23, y, 0, "snow"); for(x in 20...24) mine(x, 15, 0, "snow"); + + + this.inventory.addItems(Item.get("ice_arrow"), 10); + this.inventory.addItems(Item.get("ice_sword"), 1); + this.inventory.addItems(Item.get("frost_shield"), 1); + + + + + + area.spawner.spawnAll("icer") + for(x in 0...32) setTile(x, 32, "blackstone"); setBack(31, 28, "snow"); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/games/aground/data/core/magic1/npcs.xml b/games/aground/data/core/magic1/npcs.xml new file mode 100644 index 00000000..f3a7ebda --- /dev/null +++ b/games/aground/data/core/magic1/npcs.xml @@ -0,0 +1,185 @@ + + + + + + + + + + + + + + + + + + + +
+
+ + + + player.vehicle.setPosition(0, -16); player.vehicle.doDismount(true); + + + + + + + + + + + + + + + + + + this.inventory.addItems(Item.get("coal"), 8); + this.inventory.addItems(Item.get("steak"), 5); + this.inventory.addItems(Item.get("bread"), 5); + this.inventory.addItems(Item.get("net"), 2); + this.inventory.addItems(Item.get("quartz"), 5); + this.inventory.addItems(Item.get("anvil"), 1); + this.inventory.addItems(Item.get("steel_workbench"), 1); + this.inventory.addItems(Item.get("furnace"), 1); + this.inventory.addItems(Item.get("campfire"), 1); + this.inventory.addItems(Item.get("stone_pickaxe"), 1); + this.inventory.addItems(Item.get("fishing_rod"), 1); + + chest.alpha = 0; + + + + + + + + + + + + + + + +
+
+ + +
+
+
+ + + + setFlag('alchemist.shadow_cape', true) +
+
+ + + +
+
+ + + + +
+
+ + + + this.playAnimation("quest") +
+ +
+ + + + +
+ +
+
+ + +
+ +
+ + this.playAnimation("quest") +
+
+ +
+ + + +
+ + + + this.playAnimation("quest") +
+ +
+ + + + + + var i = player.inventory.selectItem(Item.get("wyrm"), 0, null); if(i != null) i.increaseValue(player.inventory, -i.value); + + +
+ + + + + + +
+
+ + + + this.playAnimation("quest") +
+ + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + +
+ + \ No newline at end of file diff --git a/games/aground/data/core/magic1/parallax/clouds.png b/games/aground/data/core/magic1/parallax/clouds.png new file mode 100644 index 00000000..f51d547d Binary files /dev/null and b/games/aground/data/core/magic1/parallax/clouds.png differ diff --git a/games/aground/data/core/magic1/parallax/clouds.xml b/games/aground/data/core/magic1/parallax/clouds.xml new file mode 100644 index 00000000..6bde51f2 --- /dev/null +++ b/games/aground/data/core/magic1/parallax/clouds.xml @@ -0,0 +1,4 @@ + + + + diff --git a/games/aground/data/core/magic1/parallax/mountains.png b/games/aground/data/core/magic1/parallax/mountains.png new file mode 100644 index 00000000..4d27aebc Binary files /dev/null and b/games/aground/data/core/magic1/parallax/mountains.png differ diff --git a/games/aground/data/core/magic1/parallax/parallax.xml b/games/aground/data/core/magic1/parallax/parallax.xml new file mode 100644 index 00000000..b5e8cf9d --- /dev/null +++ b/games/aground/data/core/magic1/parallax/parallax.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/games/aground/data/core/magic1/parallax/rocks.png b/games/aground/data/core/magic1/parallax/rocks.png new file mode 100644 index 00000000..510f1650 Binary files /dev/null and b/games/aground/data/core/magic1/parallax/rocks.png differ diff --git a/games/aground/data/core/magic1/scenes/alchemist/alchemist.png b/games/aground/data/core/magic1/scenes/alchemist/alchemist.png new file mode 100644 index 00000000..439a15da Binary files /dev/null and b/games/aground/data/core/magic1/scenes/alchemist/alchemist.png differ diff --git a/games/aground/data/core/magic1/scenes/alchemist/alchemist.xml b/games/aground/data/core/magic1/scenes/alchemist/alchemist.xml new file mode 100644 index 00000000..8aac7491 --- /dev/null +++ b/games/aground/data/core/magic1/scenes/alchemist/alchemist.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/games/aground/data/core/magic1/scenes/alchemist/bg.png b/games/aground/data/core/magic1/scenes/alchemist/bg.png new file mode 100644 index 00000000..00c080cd Binary files /dev/null and b/games/aground/data/core/magic1/scenes/alchemist/bg.png differ diff --git a/games/aground/data/core/magic1/scenes/alchemist/scene.xml b/games/aground/data/core/magic1/scenes/alchemist/scene.xml new file mode 100644 index 00000000..501a12a3 --- /dev/null +++ b/games/aground/data/core/magic1/scenes/alchemist/scene.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/games/aground/data/core/magic1/scenes/alien/alien.png b/games/aground/data/core/magic1/scenes/alien/alien.png new file mode 100644 index 00000000..979fc764 Binary files /dev/null and b/games/aground/data/core/magic1/scenes/alien/alien.png differ diff --git a/games/aground/data/core/magic1/scenes/alien/alien.xml b/games/aground/data/core/magic1/scenes/alien/alien.xml new file mode 100644 index 00000000..60798f78 --- /dev/null +++ b/games/aground/data/core/magic1/scenes/alien/alien.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/games/aground/data/core/magic1/scenes/alien/bg.png b/games/aground/data/core/magic1/scenes/alien/bg.png new file mode 100644 index 00000000..9e329dba Binary files /dev/null and b/games/aground/data/core/magic1/scenes/alien/bg.png differ diff --git a/games/aground/data/core/magic1/scenes/alien/scene.xml b/games/aground/data/core/magic1/scenes/alien/scene.xml new file mode 100644 index 00000000..c1dd7605 --- /dev/null +++ b/games/aground/data/core/magic1/scenes/alien/scene.xml @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + Movement.circle(this, alien, 1.25, 4, true) + Movement.circle(this, alien, 1.25, 4, true) + Movement.circle(this, alien, 1.25, 4, true) + Movement.circle(this, alien, 1.25, 4, true) + + Movement.seek(orb1, alchemist, 4, true) + + Movement.seek(orb2, alchemist, 4, true) + + Movement.seek(orb3, alchemist, 4, true) + + Movement.seek(orb4, alchemist, 4, true) + + + + + + setControl(true) + + + + + + + + + + + + + + + + alien.setVulnerable(3,20); + + + + + + + setFlag("oldone.hostile", false); + + + + + + + + + + </procedure> + <procedure id="magic1_end"><run procedure="magic_end" /></procedure> + <scene id="alien"> + <include id="alien.xml" includeRoot="true" /> + <tile id="alien" sheet="alien.png" x="0" y="0" /> + <animation id="alien.idle" x="14" count="14" /> + <animation id="alien.talk" x="0" count="14" /> + <animation id="signal" x="28" count="7" repeat="2" /> + <animation id="alien.signal" x="0" count="14"> + <append tile="scene.alien.alien" animation="scene.alien.signal" /> + </animation> + <layer id="bg" image="bg.png" width="256" height="144" /> + <layer id="alchemist" tile="scene.alchemist.alchemist" animation="scene.alchemist.alchemist.idle" talk="scene.alchemist.alchemist.talk" x="-10" y="0" flip="true" /> + <layer id="alien" tile="alien" animation="alien.idle" talk="alien.talk" x="50" y="0" /> + <layer id="white" color="ffffff" width="256" height="144" /> + + <show id="first"> + <layer id="bg" /> + <layer id="alchemist" /> + <layer id="alien" /><hide id="alchemist" /> + <wait seconds="2" /> + <run procedure="alien_talk" /> + <lerp object="alchemist" alpha="1" seconds="0.5" /> + <dialogue section="alchemist" id="oldone3" speaker='alchemist' /> + <dialogue section="alchemist" id="oldone4" speaker='player' /> + <dialogue section="alchemist" id="oldone5" speaker='alien' /> + <dialogue section="alchemist" id="oldone6" speaker='alchemist' /> + <dialogue section="alchemist" id="oldone7" speaker='alien' /> + <dialogue section="alchemist" id="oldone8" speaker='alchemist' /> + <dialogue section="alchemist" id="oldone9" speaker='alien' /> + <dialogue section="alchemist" id="oldone10" speaker='alien' /> + <menu section="alchemist" width="120"> + <dialogue section="alchemist" id="oldone_choice" speaker='alchemist' /> + <choice id="work_together"> + <run procedure="magic1.alien_battle" /> + </choice> + <choice id="alchemist_fight"> + <music id="boss" seconds="1" /><dialogue section="alchemist" id="battle" speaker="alchemist" /> + <run procedure="magic1.alien_setup" /> + <run procedure="magic1.alchemist_fight" if="player == getLocalPlayer()" /> + </choice> + </menu><wait seconds="1" /> + </show> + <show id="signal"> + <layer id="bg" /> + <layer id="alchemist" /> + <layer id="alien" /> + <layer id="white" /><hide id="white" /> + <wait seconds="1" /> + <dialogue section="alchemist" id="oldone11" speaker='alien' /> + <play object="alien" animation="alien.signal" loop="true" /> + <shake count="10" dx="2" seconds="2" /><sound id="magic" /> + <lerp object="white" alpha="1" seconds="0.5" /> + <hide id="alien" /> + <wait seconds="0.5" /> + <lerp object="white" alpha="0" seconds="0.5" /> + <dialogue section="alchemist" id="oldone12" speaker='alchemist' /> + <dialogue section="alchemist" id="oldone13" speaker='player' /> + <dialogue section="alchemist" id="oldone14" speaker='alchemist' /> + <dialogue section="alchemist" id="oldone15" speaker='alchemist' /> + <complete quest="oldone" /><structure id="evo_chamber" x="16" y="12" /> + <wait seconds="1" /><invokeLater seconds="2"><run procedure="magic1_end" /></invokeLater> + </show> + <show id="signal2"> + <layer id="bg" /> + <layer id="alchemist" /> + <layer id="alien" /> + <layer id="white" /><hide id="white" /> + <wait seconds="1" /> + <dialogue section="alchemist" id="oldone16" speaker='alien' /> + <play object="alien" animation="alien.signal" loop="true" /> + <shake count="1000" dx="2" seconds="200" modal="false" /> + <dialogue section="alchemist" id="oldone17" speaker='alchemist' /> + <shake count="10" dx="2" seconds="2" /><sound id="magic" /> + <lerp object="white" alpha="1" seconds="0.5" /><hide id="alien" /> + <animate id="alchemist" idle="scene.alchemist.alchemist.injured.idle" talk="scene.alchemist.alchemist.injured.talk" /> + <wait seconds="0.5" /><music id="Cutscene9" seconds="1" /> + <lerp object="white" alpha="0" seconds="0.5" /> + <dialogue section="alchemist" id="oldone18" speaker='player' /> + <dialogue section="alchemist" id="oldone19" speaker='alchemist' /> + <dialogue section="alchemist" id="oldone20" speaker='alchemist' /> + <lerp object="alchemist" alpha="0" seconds="2" /> + <set id="a" value="area.getNPC('alchemist_magic')" /><action>a.alpha = 0</action> + <remove object="area.getObject('alien')" killer="player" /><remove object="a" /><complete quest="oldone" /> + <remove object="player.areas.get('start').getNPC('alchemist')" /><structure id="evo_chamber" x="16" y="12" /> + <wait seconds="1" /><animate id="alchemist" idle="scene.alchemist.alchemist.idle" talk="scene.alchemist.alchemist.talk" /> + <action>player.removeQuestsByGiver("alchemist");</action> + <invokeLater seconds="2"><run procedure="magic1_end" /></invokeLater> + </show> + </scene> +</scenes> \ No newline at end of file diff --git a/games/aground/data/core/magic1/scenes/scenes.xml b/games/aground/data/core/magic1/scenes/scenes.xml new file mode 100644 index 00000000..78a216eb --- /dev/null +++ b/games/aground/data/core/magic1/scenes/scenes.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8" ?> +<scenes> + <include id="alchemist/scene.xml" /> + <include id="alien/scene.xml" /> +</scenes> \ No newline at end of file diff --git a/games/aground/data/core/magic1/structures/house.png b/games/aground/data/core/magic1/structures/house.png new file mode 100644 index 00000000..8c065a36 Binary files /dev/null and b/games/aground/data/core/magic1/structures/house.png differ diff --git a/games/aground/data/core/magic1/structures/ice_door.png b/games/aground/data/core/magic1/structures/ice_door.png new file mode 100644 index 00000000..18913024 Binary files /dev/null and b/games/aground/data/core/magic1/structures/ice_door.png differ diff --git a/games/aground/data/core/magic1/structures/pillar.png b/games/aground/data/core/magic1/structures/pillar.png new file mode 100644 index 00000000..26312017 Binary files /dev/null and b/games/aground/data/core/magic1/structures/pillar.png differ diff --git a/games/aground/data/core/magic1/structures/struc.png b/games/aground/data/core/magic1/structures/struc.png new file mode 100644 index 00000000..80ddd2e0 Binary files /dev/null and b/games/aground/data/core/magic1/structures/struc.png differ diff --git a/games/aground/data/core/magic1/structures/struc.xml b/games/aground/data/core/magic1/structures/struc.xml new file mode 100644 index 00000000..1bc67262 --- /dev/null +++ b/games/aground/data/core/magic1/structures/struc.xml @@ -0,0 +1,39 @@ +<sheets> +<tilesheet id='struc.1' sheet='struc.png' width='104' height='75'> + <image frame='0' x='0' y='0' width='92' height='70' offsetX='6' offsetY='5' /> + <image frame='1' x='0' y='70' width='92' height='70' offsetX='6' offsetY='5' /> + <image frame='2' x='0' y='140' width='92' height='70' offsetX='6' offsetY='5' /> + <image frame='3' x='0' y='210' width='92' height='70' offsetX='6' offsetY='5' /> + <image frame='4' x='0' y='280' width='92' height='70' offsetX='6' offsetY='5' /> + <image frame='5' x='0' y='350' width='92' height='70' offsetX='6' offsetY='5' /> + <image frame='6' x='92' y='0' width='92' height='70' offsetX='6' offsetY='5' /> + <image frame='7' x='92' y='70' width='92' height='75' offsetX='6' offsetY='0' /> + <image frame='8' x='184' y='0' width='94' height='75' offsetX='5' offsetY='0' /> + <image frame='9' x='92' y='145' width='92' height='75' offsetX='6' offsetY='0' /> + <image frame='10' x='92' y='220' width='92' height='75' offsetX='6' offsetY='0' /> + <image frame='11' x='278' y='0' width='93' height='75' offsetX='5' offsetY='0' /> + <image frame='12' x='92' y='295' width='92' height='75' offsetX='6' offsetY='0' /> + <image frame='13' x='371' y='0' width='100' height='74' offsetX='2' offsetY='1' /> + <image frame='14' x='471' y='0' width='100' height='74' offsetX='2' offsetY='1' /> + <image frame='15' x='184' y='75' width='100' height='74' offsetX='2' offsetY='1' /> + <image frame='16' x='184' y='149' width='100' height='74' offsetX='2' offsetY='1' /> + <image frame='17' x='184' y='223' width='100' height='74' offsetX='2' offsetY='1' /> + <image frame='18' x='184' y='297' width='100' height='74' offsetX='2' offsetY='1' /> + <image frame='19' x='184' y='371' width='100' height='74' offsetX='2' offsetY='1' /> +</tilesheet> +<tilesheet id='struc.2' sheet='struc.png' width='80' height='96' offsetY="-48"> + <image frame='0' x='92' y='370' width='77' height='102' offsetX='1' offsetY='42' /> + <image frame='1' x='284' y='75' width='77' height='102' offsetX='1' offsetY='42' /> + <image frame='2' x='361' y='75' width='77' height='102' offsetX='1' offsetY='42' /> + <image frame='3' x='438' y='75' width='77' height='102' offsetX='1' offsetY='42' /> + <image frame='4' x='515' y='75' width='77' height='102' offsetX='1' offsetY='42' /> + <image frame='5' x='284' y='177' width='77' height='102' offsetX='1' offsetY='42' /> + <image frame='6' x='284' y='279' width='77' height='102' offsetX='1' offsetY='42' /> + <image frame='7' x='361' y='177' width='77' height='144' offsetX='1' offsetY='0' /> + <image frame='8' x='438' y='177' width='79' height='144' offsetX='1' offsetY='0' /> + <image frame='9' x='517' y='177' width='78' height='144' offsetX='0' offsetY='0' /> + <image frame='10' x='361' y='321' width='77' height='144' offsetX='1' offsetY='0' /> + <image frame='11' x='438' y='321' width='77' height='144' offsetX='1' offsetY='0' /> + <image frame='12' x='515' y='321' width='77' height='144' offsetX='1' offsetY='0' /> +</tilesheet> +</sheets> \ No newline at end of file diff --git a/games/aground/data/core/magic1/structures/structures.xml b/games/aground/data/core/magic1/structures/structures.xml new file mode 100644 index 00000000..c12e3ed6 --- /dev/null +++ b/games/aground/data/core/magic1/structures/structures.xml @@ -0,0 +1,279 @@ +<?xml version="1.0" encoding="utf-8" ?> +<data> + <animation id="magic_house.idle" count="8" /> + <animation id="magic_house.active" x="8" count="8" glow="true" /> + <structure id="magic_house" width="60" height="55" image="house.png" name="enter" sleep="true"> + <operate> + <section if="player.areas.get('start').getStructureById('dragon_lair2') == null"> + <dialogue section="structure" id="activate_fail" /><stop /> + </section> + <action>this.loopAnimation("active"); this.playSFX("fire");</action> + <choose if="!getFlag('final_boss_defeat')"> + <scene id="alchemist" show="first" with="fade" if="player.questComplete('wyrm_hive') && !getFlag('alchemist_first')" showToAll="true"> + <action>setFlag('alchemist_first', true);</action> + </scene> + <scene id="alchemist" show="second" with="fade" if="player.questComplete('spirit_gem') && !getFlag('alchemist_second')" showToAll="true"> + <action>setFlag('alchemist_second', true);</action> + </scene> + </choose> + <action>player.restoreStamina();</action><save sleep="true" /> + </operate> + <exit><action>this.loopAnimation("idle"); this.stopSFX()</action></exit> + </structure> + + <include id="struc.xml" /> + <tile id="magic_farm" sheet="struc.1" /> + <tile id="time_manipulator" x="13" sheet="struc.1" /> + <tile id="magic_forge" sheet="struc.2" /> + + <animation id="magic_forge_off.idle" count="1" /> + <animation id="magic_forge.idle" x="1" count="6" /> + <animation id="magic_forge.active" x="7" count="6" glow="true" /> + <structure id="magic_forge_off" tile="magic_forge" name="activate"> + <operate><set id="achievement" value="'forge'" /><set id="gem" value="'fire_gem'" /><set id="into" value="'magic_forge'" /><set id="sfx" value="null" /><run procedure="activate.gem_structure" /></operate> + </structure> + + <recipe id="forge_diamond" creates="diamond" type="magic_forge"><item id="quartz" count="5" /></recipe> + <recipe id="forge_diamond2" creates="diamond" type="magic_forge"><item id="dragonblood" count="2" /></recipe> + <recipe id="forge_focus_gem" creates="focus_gem" count="4" type="magic_forge"><item id="diamond" count="1" /></recipe> + <recipe id="forge_fire_tusk" creates="fire_tusk" type="magic_forge"><type id="no_uncraft" /><item id="diamond" count="1" /></recipe> + <recipe id="forge_yeti_fur" creates="yeti_fur" type="magic_forge"><type id="no_uncraft" /><item id="ice_berries" count="20" /></recipe> + <recipe id="forge_net" creates="net" type="magic_forge" count="4"><type id="no_uncraft" /><item id="diamond" count="1" /></recipe> + <recipe id="make_ice_sword" creates="ice_sword" type="enchantments"> + <item id="steel_sword" count="1" /> + <item id="blood_gem" count="1" /> + <item id="yeti_fur" count="1" /> + </recipe> + <recipe id="repair_ice_sword" creates="ice_sword" type="enchantments" enchantOnly="true"> + <item id="ice_sword" count="1" /> + <item id="yeti_fur" count="1" /> + </recipe> + <recipe id="make_fire_sword" creates="fire_sword" type="enchantments"> + <item id="steel_sword" count="1" /> + <item id="blood_gem" count="1" /> + <item id="fire_tusk" count="1" /> + </recipe> + <recipe id="repair_fire_sword" creates="fire_sword" type="enchantments" enchantOnly="true"> + <item id="fire_sword" count="1" /> + <item id="fire_tusk" count="1" /> + </recipe> + <recipe id="make_water_sword" creates="water_sword" type="enchantments"> + <item id="steel_sword" count="1" /> + <item id="blood_gem" count="1" /> + <item id="fire_tusk" count="1" /> + <item id="yeti_fur" count="1" /> + </recipe> + <recipe id="repair_water_sword" creates="water_sword" type="enchantments" enchantOnly="true"> + <item id="water_sword" count="1" /> + <item id="fire_tusk" count="1" /> + <item id="yeti_fur" count="1" /> + </recipe> + <recipe id="make_plant_sword" creates="plant_sword" type="enchantments"> + <item id="steel_sword" count="1" /> + <item id="blood_gem" count="1" /> + <item id="plant_eye" count="1" /> + </recipe> + <recipe id="repair_plant_sword" creates="plant_sword" type="enchantments" enchantOnly="true"> + <item id="plant_sword" count="1" /> + <item id="plant_eye" count="1" /> + </recipe> + <recipe id="make_drain_sword" creates="drain_sword" type="enchantments"> + <item id="steel_sword" count="1" /> + <item id="blood_gem" count="1" /> + <item id="dragonblood" count="1" /> + </recipe> + <recipe id="repair_drain_sword" creates="drain_sword" type="enchantments" enchantOnly="true"> + <item id="drain_sword" count="1" /> + <item id="dragonblood" count="1" /> + </recipe> + <recipe id="make_ice_axe" creates="ice_axe" type="enchantments"> + <item id="steel_axe" count="1" /> + <item id="blood_gem" count="1" /> + <item id="yeti_fur" count="1" /> + </recipe> + <recipe id="repair_ice_axe" creates="ice_axe" type="enchantments" enchantOnly="true"> + <item id="ice_axe" count="1" /> + <item id="yeti_fur" count="1" /> + </recipe> + <recipe id="make_fire_axe" creates="fire_axe" type="enchantments"> + <item id="steel_axe" count="1" /> + <item id="blood_gem" count="1" /> + <item id="fire_tusk" count="1" /> + </recipe> + <recipe id="repair_fire_axe" creates="fire_axe" type="enchantments" enchantOnly="true"> + <item id="fire_axe" count="1" /> + <item id="fire_tusk" count="1" /> + </recipe> + <recipe id="make_water_axe" creates="water_axe" type="enchantments"> + <item id="steel_axe" count="1" /> + <item id="blood_gem" count="1" /> + <item id="fire_tusk" count="1" /> + <item id="yeti_fur" count="1" /> + </recipe> + <recipe id="repair_water_axe" creates="water_axe" type="enchantments" enchantOnly="true"> + <item id="water_axe" count="1" /> + <item id="fire_tusk" count="1" /> + <item id="yeti_fur" count="1" /> + </recipe> + <recipe id="make_plant_axe" creates="plant_axe" type="enchantments"> + <item id="steel_axe" count="1" /> + <item id="blood_gem" count="1" /> + <item id="plant_eye" count="1" /> + </recipe> + <recipe id="repair_plant_axe" creates="plant_axe" type="enchantments" enchantOnly="true"> + <item id="plant_axe" count="1" /> + <item id="plant_eye" count="1" /> + </recipe> + <recipe id="make_drain_axe" creates="drain_axe" type="enchantments"> + <item id="steel_axe" count="1" /> + <item id="blood_gem" count="1" /> + <item id="dragonblood" count="1" /> + </recipe> + <recipe id="repair_drain_axe" creates="drain_axe" type="enchantments" enchantOnly="true"> + <item id="drain_axe" count="1" /> + <item id="dragonblood" count="1" /> + </recipe> + <recipe id="make_fire_arrow" creates="fire_arrow" type="enchantments"> + <item id="arrow" count="1" /> + <item id="fire_tusk" count="1" /> + </recipe> + <recipe id="make_water_arrow" creates="water_arrow" type="enchantments"> + <item id="arrow" count="1" /> + <item id="fire_tusk" count="1" /> + <item id="yeti_fur" count="1" /> + </recipe> + <recipe id="make_drain_arrow" creates="drain_arrow" type="enchantments"> + <item id="arrow" count="1" /> + <item id="dragonblood" count="1" /> + </recipe> + <recipe id="make_blood_gem" creates="blood_gem" type="enchantments"> + <type id="no_uncraft" /><item id="alter_gem" count="1" /> + <item id="dragonblood" count="2" /> + </recipe> + <structure id="magic_forge" tile="magic_forge" type="enchant" slots="5" name="enter" title="actions.enchant" removeButton="structure.uproot"> + <addedToArea><action>setFlag("activate_forge", true)</action></addedToArea> + <recipe type="magic_forge" /> + <enchant type="enchantments" /> + <item id="dragonblood" /> + <item id="quartz" /> + <item id="gold" /> + <item id="diamond" /> + <item id="alter_gem" /> + <item id="focus_gem" /> + <item id="spirit_gem" /> + <item id="blood_gem" /> + <item id="fire_gem" /> + <item id="water_gem" /> + <item id="earth_gem" /> + <item id="ice_gem" /> + <item id="plant_gem" /> + <item id="yeti_fur" /> + <item id="dark_fur" /> + <item id="fire_tusk" /> + <item id="plant_eye" /> + <item id="ice_heart" /> + <item id="horn" /> + <over><action>this.loopAnimation("active")</action></over> + <out><action>this.loopAnimation("idle")</action></out> + <operate><achievement id="forge" /></operate> + <removeBy><action>this.onDismantle(player); player.addItem("forge_seed");</action></removeBy> + </structure> + + <recipe id="focus_gem" fuel="30" type="magic_fuel"><item id="focus_gem" count="1" /></recipe> + <recipe id="create_steak" creates="steak" type="magic_farm" incomplete="focus_gem"><type id="no_uncraft" /></recipe> + <recipe id="create_bread" creates="bread" type="magic_farm" incomplete="focus_gem"><type id="no_uncraft" /></recipe> + <recipe id="create_hamburger" creates="hamburger" type="magic_farm" incomplete="focus_gem"> + <type id="no_uncraft" /><item id="steak" count="1" /><item id="bread" count="1" /> + </recipe> + <recipe id="create_pie" creates="pie" type="magic_farm" incomplete="focus_gem"> + <type id="no_uncraft" /><item id="ice_berries" count="1" /> + </recipe> + <recipe id="create_pancakes" creates="pancakes" type="magic_farm" incomplete="focus_gem"> + <type id="no_uncraft" /><item id="bread" count="1" /><item id="ice_berries" count="2" /> + </recipe> + <recipe id="create_alter_gem" creates="alter_gem" type="magic_farm" incomplete="focus_gem" available="player.questComplete('alter_gem')"> + <type id="no_uncraft" /><item id="fire_tusk" count="1" /><item id="yeti_fur" count="1" /> + </recipe> + <recipe id="create_spirit_goggles" creates="goggles" type="magic_farm" incomplete="focus_gem" available="player.questComplete('wyrm_hive')"> + <type id="no_uncraft" /><item id="spirit_gem" count="2" /> + </recipe> + + <animation id="magic_farm_off.idle" count="1" /> + <animation id="magic_farm.off" x="1" count="6" /> + <animation id="magic_farm.on" x="7" count="6" glow="true" /> + <structure id="magic_farm_off" tile="magic_farm" name="activate"> + <operate><set id="achievement" value="'synthesizer'" /><set id="gem" value="'water_gem'" /><set id="into" value="'magic_farm'" /><set id="sfx" value="null" /><run procedure="activate.gem_structure" /></operate> + </structure> + <structure id="magic_farm" tile="magic_farm" type="kitchen" max_fuel="1000" name="enter" animation="magic_farm" title="common.synthesizer" display="common.synthesizer" removeButton="structure.uproot" sfx="magic"> + <addedToArea><action>setFlag("activate_synthesizer", true)</action></addedToArea> + <recipe type="magic_fuel" /> + <recipe type="magic_farm" /> + <operate><achievement id="synthesizer" /></operate> + <removeBy><action>this.onDismantle(player); player.addItem("synthesizer_seed");</action></removeBy> + </structure> + + <structure id="ice_structure" tile="time_manipulator" name="activate"> + <operate><set id="gem" value="'ice_gem'" /><set id="into" value="'time_manipulator'" /><set id="achievement" value="'time_manipulator'" /><set id="sfx" value="null" /><run procedure="activate.gem_structure" /></operate> + </structure> + + <recipe id="craft_jakolantern" creates="jakolantern"><item id="pumpkin" /></recipe> + <recipe id="craft_snowman" creates="snowman"><item id="ice_berries" /></recipe> + <recipe id="craft_fire_gem" creates="fire_gem"><item id="spirit_gem" /></recipe> + <recipe id="craft_water_gem" creates="water_gem"><item id="spirit_gem" /></recipe> + <recipe id="craft_earth_gem" creates="earth_gem"><item id="spirit_gem" /></recipe> + <recipe id="craft_ice_gem" creates="ice_gem"><item id="spirit_gem" /></recipe> + <recipe id="craft_plant_gem" creates="plant_gem"><item id="spirit_gem" /></recipe> + + <recipe id="craft_cocoon" creates="cocoon"><item id="wyrm" /></recipe> + <recipe id="craft_baby_dragon" creates="dragon"><item id="cocoon" /></recipe> + <recipe id="craft_young_dragon" creates="young_dragon"><item id="dragon" /><item id="dragonblood" count="5" /></recipe> + <recipe id="craft_adult_dragon" creates="adult_dragon"><item id="young_dragon" /><item id="fire_gem" count="1" /></recipe> + + <animation id="time_manipulator.idle" x="1" count="6" /> + <structure id="time_manipulator" tile="time_manipulator" type="smelter" sfx="magic" uncraft="true" max_fuel="300" name="enter" title="common.time_manipulator" removeButton="structure.uproot"> + <recipe type="magic_fuel" /> + <listItem icon="uncraft.ico" animation="uncraft.ico" title="actions.uncraft"> + <window type="uncraft" title="actions.uncraft" exclude="no_uncraft" includeStorehouse="true"> + <action>this.queue.addSmeltItem(recipe, count)</action> + </window> + </listItem> + <listItem icon="reset_skills.ico" animation="reset_skills.ico" title="actions.reset_skills" enabled="player.skills.points > 0" fail="this.fuel < 100?'warning.fuel':null"> + <tooltip type="requires" requires="quests.requires"> + <requirement title="common.fuel" count="this.fuel" of="100" /> + </tooltip> + <action>player.skills.reset(); this.useFuel(100)</action> + </listItem> + <listItem icon="set_time.ico" animation="set_time.ico" title="actions.set_time" fail="'warning.fuel'"> + <tooltip type="requires" requires="quests.requires"> + <requirement title="common.fuel" count="this.fuel" of="5" /> + </tooltip> + <window type="count" title="common.set_time" min="0" max="24" value="Math.round(getGameTime())"> + <action>setBGMSpeed(0.5)</action><setTime value="value" frames="80" forwards="false"><action>setBGMSpeed(1)</action></setTime><action>this.useFuel(5)</action> + </window> + </listItem> + <operate><achievement id="time_manipulator" /></operate> + <removeBy><action>this.onDismantle(player); player.addItem("time_manipulator_seed");</action></removeBy> + </structure> + + <animation id="dragon_magic.idle" equals="adult_dragon.idle" /> + <structure id="dragon_magic" tile="adult_dragon" type="fuelable" fuelName="feed" maxFuel="8000" name="fly_dragon" includeName="true" only_select="true"> + <operate> + <set id="_name" value="this.name" /> + <object id="fly_adult_dragon" x="this.xPos/Tile.SIZE" y="this.tile_y" pre="true">this.name = _name;</object> + <action>fly_adult_dragon.setFuel(this.fuel); fly_adult_dragon.onOperate(player);</action> + <remove structure="this" /><stop /> + </operate> + </structure> + + <animation id="recipe_pillar.idle" count="6" glow="true" /> + <structure id="recipe_pillar" image="pillar.png" width="40" height="80" type="enchantRecipe" message="structure.enchant_recipe" priority="-1" addTo="magic_forge" name="activate" renderer="spirit" remove="false" alpha="player.state.hasRecipe('magic_forge', this.recipe)?0.33:1"> + <addRecipe><dialogue section="structure" id="enchant_added" if="getFlag('activate_forge')" /><action>this.updateAlpha()</action></addRecipe> + <addedToArea><displayAction>if(built) this.clearInvisibleBlocks(); player.state.addEventListener("add_recipe", recipe_pillar_alpha);</displayAction></addedToArea> + <removedFromArea><displayAction>player.state.removeEventListener("add_recipe", recipe_pillar_alpha);</displayAction></removedFromArea> + <init><displayAction> + function recipe_pillar_alpha(e){this.updateAlpha();} + </displayAction></init> + </structure> + <animation id="night_recipe_pillar.idle" equals="hidden" /> + <structure id="night_recipe_pillar" extends="recipe_pillar" nightAnimation="recipe_pillar" /> +</data> \ No newline at end of file diff --git a/games/aground/data/core/magic1/structures/wyrm_door.png b/games/aground/data/core/magic1/structures/wyrm_door.png new file mode 100644 index 00000000..59e63e8d Binary files /dev/null and b/games/aground/data/core/magic1/structures/wyrm_door.png differ diff --git a/games/aground/data/core/magic1/structures/wyrm_hive.png b/games/aground/data/core/magic1/structures/wyrm_hive.png new file mode 100644 index 00000000..00cf093a Binary files /dev/null and b/games/aground/data/core/magic1/structures/wyrm_hive.png differ diff --git a/games/aground/data/core/magic1/structures/wyrm_tunnel.png b/games/aground/data/core/magic1/structures/wyrm_tunnel.png new file mode 100644 index 00000000..26db99ff Binary files /dev/null and b/games/aground/data/core/magic1/structures/wyrm_tunnel.png differ diff --git a/games/aground/data/core/mod.xml b/games/aground/data/core/mod.xml new file mode 100644 index 00000000..e6f4a942 --- /dev/null +++ b/games/aground/data/core/mod.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8" ?> +<mod> + <name>Core</name> + <description>Core files for Aground.</description> + <author>Fancy Fish Games</author> + <version>2.0.7</version> + <versionCheck>http://fancyfishgames.com/Aground/version.html</versionCheck> + <website>http://fancyfishgames.com/Aground/</website> + <disableWarning>You will not be able to play Aground without a full replacement mod if you disable Core (until you re-enable it).</disableWarning> + <init> + <include id="lang/languages.xml" /> + <include id="achievements.xml" /> + <include id="sound/sounds.xml" /> + <include id="music/music.xml" /> + <include id="items/icons.xml" /> + <include id="elements.xml" /> + <include id="items/items.xml" /> + <include id="animals/animals.xml" /> + <include id="tiles/tiles.xml" /> + <include id="farm/farm.xml" /> + <include id="structures/structures.xml" /> + <include id="player/player.xml" /> + <include id="enemies/enemies.xml" /> + <include id="trees/trees.xml" /> + <include id="npc/npcs.xml" /> + <include id="nav/navigation.xml" /> + <include id="start/start.xml" /> + <include id="science1/science1.xml" /> + <include id="magic1/magic1.xml" /> + <include id="scenes/scenes.xml" /> + <include id="specials/specials.xml" /> + </init> +</mod> \ No newline at end of file diff --git a/games/aground/data/core/music/Cutscene9.ogg b/games/aground/data/core/music/Cutscene9.ogg new file mode 100644 index 00000000..9d83bd22 Binary files /dev/null and b/games/aground/data/core/music/Cutscene9.ogg differ diff --git a/games/aground/data/core/music/boss.ogg b/games/aground/data/core/music/boss.ogg new file mode 100644 index 00000000..2f4643da Binary files /dev/null and b/games/aground/data/core/music/boss.ogg differ diff --git a/games/aground/data/core/music/game_over.ogg b/games/aground/data/core/music/game_over.ogg new file mode 100644 index 00000000..528e53dc Binary files /dev/null and b/games/aground/data/core/music/game_over.ogg differ diff --git a/games/aground/data/core/music/intro.ogg b/games/aground/data/core/music/intro.ogg new file mode 100644 index 00000000..2ecc1419 Binary files /dev/null and b/games/aground/data/core/music/intro.ogg differ diff --git a/games/aground/data/core/music/magic1.ogg b/games/aground/data/core/music/magic1.ogg new file mode 100644 index 00000000..eb79cb44 Binary files /dev/null and b/games/aground/data/core/music/magic1.ogg differ diff --git a/games/aground/data/core/music/music.xml b/games/aground/data/core/music/music.xml new file mode 100644 index 00000000..9d47bb0c --- /dev/null +++ b/games/aground/data/core/music/music.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8" ?> +<data> + <volume name="game_over" value="50" /> + + <music id="title" /> + <music id="intro" /> + <music id="boss" /> + <music id="game_over" /> + <music id="nightly"><track id="nightly" /></music> + <music id="Cutscene9" allowOverride="false" /> + <music id="start"> + <track id="underground" y="4" fade_tiles="3" /> + <track id="nightly" if="isNight()" /> + <track id="no_boundaries" /> + </music> + <music id="science1"> + <track id="underground" y="4" fade_tiles="3" /> + <track id="nightly" if="isNight()" /> + <track id="science1" /> + </music> + <music id="magic1"> + <track id="nightly" if="isNight()" /> + <track id="magic1" /> + </music> +</data> \ No newline at end of file diff --git a/games/aground/data/core/music/nightly.ogg b/games/aground/data/core/music/nightly.ogg new file mode 100644 index 00000000..edf28f52 Binary files /dev/null and b/games/aground/data/core/music/nightly.ogg differ diff --git a/games/aground/data/core/music/no_boundaries.ogg b/games/aground/data/core/music/no_boundaries.ogg new file mode 100644 index 00000000..fce31114 Binary files /dev/null and b/games/aground/data/core/music/no_boundaries.ogg differ diff --git a/games/aground/data/core/music/science1.ogg b/games/aground/data/core/music/science1.ogg new file mode 100644 index 00000000..88871ce6 Binary files /dev/null and b/games/aground/data/core/music/science1.ogg differ diff --git a/games/aground/data/core/music/title.ogg b/games/aground/data/core/music/title.ogg new file mode 100644 index 00000000..79d0929c Binary files /dev/null and b/games/aground/data/core/music/title.ogg differ diff --git a/games/aground/data/core/music/underground.ogg b/games/aground/data/core/music/underground.ogg new file mode 100644 index 00000000..264624b6 Binary files /dev/null and b/games/aground/data/core/music/underground.ogg differ diff --git a/games/aground/data/core/nav/nav.png b/games/aground/data/core/nav/nav.png new file mode 100644 index 00000000..f447df2d Binary files /dev/null and b/games/aground/data/core/nav/nav.png differ diff --git a/games/aground/data/core/nav/nav.xml b/games/aground/data/core/nav/nav.xml new file mode 100644 index 00000000..bcfeaaaf --- /dev/null +++ b/games/aground/data/core/nav/nav.xml @@ -0,0 +1,32 @@ +<tilesheet id='nav.png' width='256' height='144'> + <image frame='0' x='0' y='0' width='42' height='144' offsetX='175' offsetY='0' /> + <image frame='1' x='42' y='0' width='62' height='144' offsetX='102' offsetY='0' /> + <image frame='2' x='104' y='0' width='124' height='141' offsetX='0' offsetY='0' /> + <image frame='3' x='0' y='144' width='90' height='93' offsetX='0' offsetY='0' /> + <image frame='4' x='90' y='144' width='65' height='65' offsetX='0' offsetY='0' /> + <image frame='5' x='155' y='144' width='45' height='47' offsetX='0' offsetY='0' /> + <image frame='6' x='228' y='0' width='18' height='19' offsetX='228' offsetY='9' /> + <image frame='7' x='228' y='19' width='9' height='9' offsetX='232' offsetY='14' /> + <image frame='8' x='237' y='19' width='9' height='9' offsetX='232' offsetY='14' /> + <image frame='9' x='228' y='28' width='9' height='9' offsetX='232' offsetY='14' /> + <image frame='10' x='0' y='237' width='24' height='101' offsetX='0' offsetY='18' /> + <image frame='11' x='0' y='338' width='24' height='101' offsetX='0' offsetY='18' /> + <image frame='12' x='24' y='237' width='24' height='101' offsetX='0' offsetY='18' /> + <image frame='13' x='24' y='338' width='24' height='101' offsetX='0' offsetY='18' /> + <image frame='14' x='48' y='237' width='24' height='101' offsetX='0' offsetY='18' /> + <image frame='15' x='48' y='338' width='24' height='101' offsetX='0' offsetY='18' /> + <image frame='16' x='72' y='237' width='24' height='101' offsetX='0' offsetY='18' /> + <image frame='17' x='72' y='338' width='24' height='101' offsetX='0' offsetY='18' /> + <image frame='19' x='96' y='237' width='24' height='101' offsetX='0' offsetY='18' /> + <image frame='20' x='200' y='144' width='42' height='83' offsetX='209' offsetY='9' /> + <image frame='21' x='120' y='237' width='42' height='81' offsetX='209' offsetY='11' /> + <image frame='22' x='162' y='237' width='42' height='81' offsetX='209' offsetY='11' /> + <image frame='23' x='204' y='237' width='42' height='81' offsetX='209' offsetY='11' /> + <image frame='24' x='120' y='318' width='42' height='81' offsetX='209' offsetY='11' /> + <image frame='25' x='162' y='318' width='42' height='81' offsetX='209' offsetY='11' /> + <image frame='26' x='204' y='318' width='42' height='81' offsetX='209' offsetY='11' /> + <image frame='18' equals='12' offsetX='0' offsetY='18' /> + <image frame='27' equals='25' offsetX='209' offsetY='11' /> + <image frame='28' equals='26' offsetX='209' offsetY='11' /> + <image frame='29' equals='25' offsetX='209' offsetY='11' /> +</tilesheet> diff --git a/games/aground/data/core/nav/nav_bg.png b/games/aground/data/core/nav/nav_bg.png new file mode 100644 index 00000000..bd9dd275 Binary files /dev/null and b/games/aground/data/core/nav/nav_bg.png differ diff --git a/games/aground/data/core/nav/nav_planet.png b/games/aground/data/core/nav/nav_planet.png new file mode 100644 index 00000000..0d720b48 Binary files /dev/null and b/games/aground/data/core/nav/nav_planet.png differ diff --git a/games/aground/data/core/nav/nav_planet.xml b/games/aground/data/core/nav/nav_planet.xml new file mode 100644 index 00000000..b175120b --- /dev/null +++ b/games/aground/data/core/nav/nav_planet.xml @@ -0,0 +1,53 @@ +<tilesheet id='nav_planet.png' width='256' height='144'> + <image frame='0' x='0' y='0' width='63' height='59' offsetX='62' offsetY='33' /> + <image frame='1' x='63' y='0' width='73' height='67' offsetX='57' offsetY='29' /> + <image frame='2' x='136' y='0' width='85' height='77' offsetX='51' offsetY='24' /> + <image frame='3' x='0' y='59' width='48' height='41' offsetX='70' offsetY='42' /> + <image frame='4' x='0' y='100' width='48' height='40' offsetX='70' offsetY='42' /> + <image frame='5' x='63' y='67' width='50' height='48' offsetX='69' offsetY='38' /> + <image frame='6' x='63' y='115' width='37' height='35' offsetX='76' offsetY='44' /> + <image frame='7' x='136' y='77' width='37' height='35' offsetX='76' offsetY='45' /> + <image frame='8' x='136' y='112' width='39' height='38' offsetX='75' offsetY='43' /> + <image frame='9' x='0' y='140' width='25' height='23' offsetX='81' offsetY='50' /> + <image frame='10' x='25' y='140' width='24' height='22' offsetX='81' offsetY='50' /> + <image frame='11' x='100' y='115' width='27' height='26' offsetX='80' offsetY='48' /> + <image frame='12' x='113' y='67' width='21' height='16' offsetX='83' offsetY='53' /> + <image frame='13' x='113' y='83' width='17' height='18' offsetX='85' offsetY='52' /> + <image frame='14' x='63' y='150' width='17' height='18' offsetX='85' offsetY='52' /> + <image frame='15' x='100' y='141' width='23' height='22' offsetX='82' offsetY='50' /> + <image frame='16' x='113' y='101' width='16' height='14' offsetX='85' offsetY='53' /> + <image frame='17' x='48' y='59' width='15' height='15' offsetX='86' offsetY='53' /> + <image frame='18' x='48' y='74' width='14' height='14' offsetX='86' offsetY='54' /> + <image frame='19' x='173' y='77' width='19' height='19' offsetX='84' offsetY='51' /> + <image frame='20' x='48' y='88' width='13' height='8' offsetX='87' offsetY='57' /> + <image frame='21' x='48' y='100' width='11' height='10' offsetX='88' offsetY='56' /> + <image frame='22' x='48' y='110' width='9' height='10' offsetX='89' offsetY='56' /> + <image frame='23' x='48' y='120' width='15' height='14' offsetX='86' offsetY='54' /> + <image frame='24' x='49' y='140' width='11' height='7' offsetX='88' offsetY='58' /> + <image frame='25' x='49' y='147' width='8' height='9' offsetX='90' offsetY='57' /> + <image frame='26' x='49' y='156' width='7' height='7' offsetX='90' offsetY='58' /> + <image frame='27' x='80' y='150' width='13' height='13' offsetX='87' offsetY='55' /> + <image frame='28' x='127' y='115' width='9' height='9' offsetX='89' offsetY='57' /> + <image frame='29' x='56' y='156' width='7' height='7' offsetX='90' offsetY='58' /> + <image frame='30' x='48' y='96' width='4' height='4' offsetX='91' offsetY='59' /> + <image frame='31' x='221' y='0' width='50' height='48' offsetX='69' offsetY='38' /> + <image frame='32' x='175' y='112' width='39' height='38' offsetX='75' offsetY='43' /> + <image frame='33' x='192' y='77' width='27' height='26' offsetX='80' offsetY='48' /> + <image frame='34' x='271' y='0' width='23' height='22' offsetX='82' offsetY='50' /> + <image frame='35' x='271' y='22' width='19' height='19' offsetX='84' offsetY='51' /> + <image frame='36' x='173' y='96' width='15' height='14' offsetX='86' offsetY='54' /> + <image frame='37' x='123' y='141' width='13' height='13' offsetX='87' offsetY='55' /> + <image frame='38' x='127' y='124' width='9' height='9' offsetX='89' offsetY='57' /> + <image frame='39' x='129' y='101' width='7' height='7' offsetX='90' offsetY='58' /> + <image frame='40' x='52' y='96' width='4' height='4' offsetX='91' offsetY='59' /> + <image frame='41' x='294' y='0' width='36' height='39' offsetX='79' offsetY='30' /> + <image frame='42' x='221' y='48' width='36' height='39' offsetX='79' offsetY='30' /> + <image frame='43' x='257' y='48' width='36' height='39' offsetX='79' offsetY='30' /> + <image frame='44' x='293' y='48' width='36' height='39' offsetX='79' offsetY='30' /> + <image frame='45' x='221' y='87' width='36' height='39' offsetX='79' offsetY='30' /> + <image frame='46' x='221' y='126' width='36' height='39' offsetX='79' offsetY='30' /> + <image frame='47' x='257' y='87' width='36' height='39' offsetX='79' offsetY='30' /> + <image frame='48' x='293' y='87' width='36' height='39' offsetX='79' offsetY='30' /> + <image frame='49' x='257' y='126' width='36' height='39' offsetX='79' offsetY='30' /> + <image frame='50' x='293' y='126' width='36' height='39' offsetX='79' offsetY='30' /> +</tilesheet> diff --git a/games/aground/data/core/nav/navigation.xml b/games/aground/data/core/nav/navigation.xml new file mode 100644 index 00000000..7fea4b8b --- /dev/null +++ b/games/aground/data/core/nav/navigation.xml @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="utf-8" ?> +<data> + <include id="nav.xml" includeRoot="true" /> + <include id="nav_planet.xml" includeRoot="true" /> + <tilesheet id="nav_bg.png" width="256" height="144" /> + <tile id="nav.bg.planet" sheet="nav_bg.png"><tile sheet="nav.png" x="5" /></tile> + <tile id="nav.bg.star" sheet="nav_bg.png" /> + <tile id="nav.bg.top" sheet="nav_bg.png" x="1" /> + <tile id="nav.left" sheet="nav.png" x="10" /> + <tile id="star.select" sheet="nav.png" x="20" /> + <animation id="nav10" count="10" /><animation id="star.select" equals="nav10" /> + <animation id="nav.bg.top" count="1" length="10"><append tile="nav.left" animation="nav10" /></animation> + <tile id="nav.star" sheet="nav.png" x="6" offsetX="-236" offsetY="-18" /> + <animation id="nav.star.select" x="1" count="2" length="3" /> + <animation id="nav.star.current" equals="single" /> + <tile id="star" sheet="nav.png" x="9" offsetX="-236" offsetY="-18" /> + + <tile id="orbit1" sheet="nav.png" x="4" /> + <tile id="orbit2" sheet="nav.png" x="3" /> + <tile id="orbit3" sheet="nav.png" x="2" /> + <tile id="orbit4" sheet="nav.png" x="1" /> + <tile id="orbit5" sheet="nav.png" x="0" /> + + <tile id="planet1" sheet="nav_planet.png" x="30" /> + <tile id="planet2" sheet="nav_planet.png" x="29" /> + <tile id="planet3" sheet="nav_planet.png" x="28" /> + <tile id="planet4" sheet="nav_planet.png" x="27" /> + <tile id="planet4.land1" sheet="nav_planet.png" x="26" /> + <tile id="planet4.land2" sheet="nav_planet.png" x="25" /> + <tile id="planet4.clouds" sheet="nav_planet.png" x="24" /> + <tile id="planet5" sheet="nav_planet.png" x="23" /> + <tile id="planet5.land1" sheet="nav_planet.png" x="22" /> + <tile id="planet5.land2" sheet="nav_planet.png" x="21" /> + <tile id="planet5.clouds" sheet="nav_planet.png" x="20" /> + <tile id="planet6" sheet="nav_planet.png" x="19" /> + <tile id="planet6.land1" sheet="nav_planet.png" x="18" /> + <tile id="planet6.land2" sheet="nav_planet.png" x="17" /> + <tile id="planet6.clouds" sheet="nav_planet.png" x="16" /> + <tile id="planet7" sheet="nav_planet.png" x="15" /> + <tile id="planet7.land1" sheet="nav_planet.png" x="14" /> + <tile id="planet7.land2" sheet="nav_planet.png" x="13" /> + <tile id="planet7.clouds" sheet="nav_planet.png" x="12" /> + <tile id="planet8" sheet="nav_planet.png" x="11" /> + <tile id="planet8.gas1" sheet="nav_planet.png" x="10" /> + <tile id="planet8.gas2" sheet="nav_planet.png" x="9" /> + <tile id="planet9" sheet="nav_planet.png" x="8" /> + <tile id="planet9.gas1" sheet="nav_planet.png" x="7" /> + <tile id="planet9.gas2" sheet="nav_planet.png" x="6" /> + <tile id="planet10" sheet="nav_planet.png" x="5" /> + <tile id="planet10.gas1" sheet="nav_planet.png" x="4" /> + <tile id="planet10.gas2" sheet="nav_planet.png" x="3" /> + <tile id="planet.rings_lg" sheet="nav_planet.png" x="2" /> + <tile id="planet.rings_med" sheet="nav_planet.png" x="1" /> + <tile id="planet.rings_sm" sheet="nav_planet.png" x="0" /> + + + <tile id="planet1.shadow" sheet="nav_planet.png" x="40" /> + <tile id="planet2.shadow" sheet="nav_planet.png" x="39" /> + <tile id="planet3.shadow" sheet="nav_planet.png" x="38" /> + <tile id="planet4.shadow" sheet="nav_planet.png" x="37" /> + <tile id="planet5.shadow" sheet="nav_planet.png" x="36" /> + <tile id="planet6.shadow" sheet="nav_planet.png" x="35" /> + <tile id="planet7.shadow" sheet="nav_planet.png" x="34" /> + <tile id="planet8.shadow" sheet="nav_planet.png" x="33" /> + <tile id="planet9.shadow" sheet="nav_planet.png" x="32" /> + <tile id="planet10.shadow" sheet="nav_planet.png" x="31" /> + + <tile id="nav.select" sheet="nav_planet.png" x="41" offsetX="-98" offsetY="-47" /> + <animation id="nav.select" count="10" /> + + <animation id="planet.start"> + <append tile="planet7" animation="single" color="5380a5" colorScale="2" /> + <append tile="planet7.land1" animation="single" color="0b461f" colorScale="2" /> + <append tile="planet7.clouds" animation="single" color="ffec8e" /> + <append tile="planet7.shadow" animation="single" /><frame visible="false" /> + </animation> + + <animation id="planet.start.dwarf"> + <append tile="planet2" animation="single" color="d9c9b6" colorScale="2" /> + <append tile="planet2.shadow" animation="single" /><frame visible="false" /> + </animation> + + <animation id="planet.start.gas"> + <append tile="planet8" animation="single" color="8fa9a9" colorScale="2" /> + <append tile="planet8.gas1" animation="single" color="6a8163" colorScale="2" /> + <append tile="planet8.shadow" animation="single" /><frame visible="false" /> + </animation> +</data> \ No newline at end of file diff --git a/games/aground/data/core/npc/alchemist.png b/games/aground/data/core/npc/alchemist.png new file mode 100644 index 00000000..bca99475 Binary files /dev/null and b/games/aground/data/core/npc/alchemist.png differ diff --git a/games/aground/data/core/npc/alchemist.xml b/games/aground/data/core/npc/alchemist.xml new file mode 100644 index 00000000..7428bb56 --- /dev/null +++ b/games/aground/data/core/npc/alchemist.xml @@ -0,0 +1,116 @@ +<?xml version="1.0" encoding="utf-8" ?> +<npcs> + <tile id="alchemist" sheet="alchemist.png" x="0" y="0" /> + <animation id="alchemist.idle"> + <frame count="8" repeat="2" /> + </animation> + <animation id="alchemist.hoe" equals="alchemist.idle" /> + <animation id="alchemist.talk" count="4" x="8" /> + <animation id="alchemist.quest" count="15" x="12" /> + <animation id="alchemist.craft" count="53" x="27" /> + <animation id="alchemist.walk" count="10" x="80" /> + <animation id="alchemist.cast" count="8" x="90" /> + <animation id="alchemist.teleport" count="8" x="111"><frame count="8" x="111" reverse="true" /></animation> + <animation id="alchemist.teleport_cycle" count="8" x="119" /> + <animation id="alchemist.teleport_out" count="13" x="98"> + <append tile="alchemist" animation="alchemist.teleport" behind="true" /> + <frame visible="false" length="3" /> + </animation> + <animation id="alchemist.teleport_in"> + <append tile="alchemist" animation="alchemist.teleport" behind="true" /> + <frame visible="false" length="3" /><frame count="13" x="98" reverse="true" /> + </animation> + + <quest id="lab" giver="alchemist" exp="60" achievement="lab"> + <item id="dragonblood" count="1" /> + </quest> + <quest id="wyrm_pen" giver="alchemist" exp="250" achievement="wyrm_pen"> + <item id="wyrm" count="2" /> + </quest> + <quest id="hatch_dragons" exp="80"> + <item id="dragon" count="5" /> + </quest> + <quest id="thunder_axe" giver="alchemist" exp="80"> + <item id="rusty_axe" count="1" /> + <item id="fire_tusk" count="1" hidden="true" /> + </quest> + + <procedure id="alchemist.idle"><dialogue section="alchemist" id="muttering" speaker="this" /></procedure> + <npc id="alchemist" tile="alchemist" action="talk" animation="alchemist" talk_sfx="talking2" idle="tendFarm" farm="wyrm_pen" speed="2" operate="lab" disableAway="magic1" night="true"> + <operate> + <section if="!player.hasQuest('lab')"> + <dialogue section="alchemist" id="introduce1" speaker='this' /> + <dialogue section="alchemist" id="introduce2" speaker='this' /> + <quest id="lab" /> + <action>this.playAnimation("quest")</action> + </section> + <choose if="!player.questComplete('lab')"> + <section if="player.canCompleteQuest('lab')"> + <dialogue section="alchemist" id="lab1" speaker='this' /> + <complete quest="lab" /> + <sound id="build" /> + <structure id="lab" x="90" y="this.tile_y" with="fade" /> + <dialogue section="alchemist" id="lab2" speaker='this' /> + </section> + <dialogue section="alchemist" id="lab3" speaker='this' /> + </choose> + <section if="player.hasItemStorehouse('dark_fur') && !getFlag('alchemist.shadow_cape')"> + <quest /> + <dialogue section="alchemist" id="shadow_cape1" speaker='this' /> + <dialogue section="alchemist" id="shadow_cape2" speaker='this' /> + <action>setFlag('alchemist.shadow_cape', true)</action> + </section> + <section if="player.hasItemStorehouse('rusty_axe') && !player.hasQuest('thunder_axe')"> + <dialogue section="alchemist" id="axe1" speaker='this' /> + <dialogue section="alchemist" id="axe2" speaker='this' /> + <quest id="thunder_axe" ask="false" /> + </section> + <section if="!player.questComplete('thunder_axe') && player.canCompleteQuest('thunder_axe')"> + <dialogue section="alchemist" id="axe3" speaker='this' /> + <complete quest="thunder_axe" /> + <item id="thunder_axe" modal="true" /> + <dialogue section="alchemist" id="axe4" speaker='this' /> + </section> + <choose if="player.questComplete('market') || player.questComplete('dock2')"> + <section if="!player.hasQuest('wyrm_pen')"> + <dialogue section="alchemist" id="pen1" speaker='this' /> + <quest id="wyrm_pen" /> + </section> + <choose if="!player.questComplete('wyrm_pen')"> + <section if="player.canCompleteQuest('wyrm_pen')"> + <dialogue section="alchemist" id="pen2" speaker='this' /> + <complete quest="wyrm_pen" /> + <sound id="build" /> + <structure id="wyrm_pen" x="86" y="this.tile_y" with="fade"> + <addAnimal id="wyrm" count="2" /> + </structure> + <dialogue section="alchemist" id="pen3" speaker='this' /> + </section> + <dialogue section="alchemist" id="wyrm" speaker='this' /> + </choose> + <choose if="(area.getStructureById('wyrm_pen') != null && area.getStructureById('wyrm_pen').hasAnimal('dragon')) || player.hasItemStorehouse('dragon') || getFlag('summon_alchemist')"> + <section if="player.areas.get('start').getStructureById('dragon_lair2') == null && !player.hasQuest('hatch_dragons')"> + <quest if="!getFlag('summon_alchemist')" /> + <action>setFlag('summon_alchemist', true)</action> + <dialogue section="alchemist" id="dragon2" speaker='this' /> + <dialogue section="alchemist" id="dragon3" speaker='this' /> + </section> + <choose if="player.hasQuest('wyrm_hive') || (player.areas.exists('magic1') && player.areas.get('magic1').getObject('alchemist_magic') != null)"> + <section if="!getFlag('alchemist_return')"> + <dialogue section="alchemist" id="return1" speaker="player" /> + <dialogue section="alchemist" id="return2" speaker="this" /> + <dialogue section="alchemist" id="return3" speaker="player" /> + <dialogue section="alchemist" id="return4" speaker="this" /> + <action>setFlag('alchemist_return', true)</action> + </section> + <dialogue section="alchemist" id="wyrm6" speaker="this" if="player.hasQuest('wyrm_hive') && !player.questComplete('wyrm_hive')" /> + <run procedure="alchemist.idle" /> + </choose> + <dialogue section="alchemist" id="pen3" speaker='this' /> + </choose> + <dialogue section="alchemist" id="dragon1" speaker='this' /> + </choose> + <dialogue section="alchemist" id="lab2" speaker='this' /> + </operate> + </npc> +</npcs> \ No newline at end of file diff --git a/games/aground/data/core/npc/builder.xml b/games/aground/data/core/npc/builder.xml new file mode 100644 index 00000000..84ba9911 --- /dev/null +++ b/games/aground/data/core/npc/builder.xml @@ -0,0 +1,165 @@ +<?xml version="1.0" encoding="utf-8" ?> +<npcs> + <tile id="builder" sheet="npc.png" x="0" /> + + <animation id="builder.build" count="8" x="19" /> + + <quest id="hut" achievement="hut"> + <item id="wood" count="8" /> + </quest> + <quest id="storehouse" giver="builder" exp="6" achievement="storehouse"> + <item id="wood" count="8" /> + <item id="berries" count="4" /> + </quest> + <quest id="storehouse2" exp="6" achievement="storehouse"> + <item id="wood" count="8" /> + <item id="berries" count="4" /> + <canComplete> + <dialogue section="player" id="storehouse3" /> + <complete quest="storehouse2" /> + <structure id="storehouse" x="28" place="true" rangeX="64" rangeY="0" sfx="build" seconds="0.25" canCancel="false"> + <onPlace> + <object id="miner" x="player.tile_x < 6?player.tile_x+5:player.tile_x-5" y="2" mine="true" /> + <lerp object="object" alpha="1" seconds="0.25" /><pan toObject="player" seconds="0.25" /> + <item id="storehouse_blueprint" hidden="true" /> + <dialogue section="player" id="storehouse4" /> + </onPlace> + </structure> + </canComplete> + </quest> + <quest id="kitchen" giver="builder" exp="20" achievement="kitchen"> + <item id="wood" count="10" /> + <item id="coal" count="10" /> + </quest> + <quest id="kitchen2" giver="builder" exp="60"> + <item id="wood" count="5" /> + <item id="steel_bar" count="5" /> + </quest> + + <npc id="builder" tile="builder" action="talk" talk_sfx="talking1"> + <idle class="build"> + <collect><loot id="wood" /></collect> + <collect> + <loot p="2" /> + <loot id="berries" p="4" /> + <loot id="red_berries" p="1" /> + </collect> + </idle> + <operate> + <section if="!player.hasQuest('storehouse')"> + <dialogue section="builder" id="intro" speaker="this" /> + <dialogue section="builder" id="introduce1" speaker='player' /> + <dialogue section="builder" id="introduce2" speaker='this' /> + <quest id="storehouse"> + <dialogue section="builder" id="accept1" speaker='player' /> + <dialogue section="builder" id="accept2" speaker='this' /> + <item id="stone_axe" /><equip id="stone_axe" ifEmpty="true" /> + </quest> + </section> + <choose if="!player.questComplete('storehouse')"> + <section if="!player.hasSeenItem('stone_axe')"> + <quest /> + <dialogue section="builder" id="intro" speaker="this" /> + <dialogue section="builder" id="introduce1" speaker='player' /> + <dialogue section="builder" id="introduce2" speaker='this' /> + <dialogue section="builder" id="accept1" speaker='player' /> + <dialogue section="builder" id="accept2" speaker='this' /> + <item id="stone_axe" /><equip id="stone_axe" ifEmpty="true" /> + </section> + <section if="player.canCompleteQuest('storehouse')"> + <dialogue section="builder" id="storehouse1" speaker='this' /> + <dialogue section="builder" id="storehouse2" speaker='player' /> + <complete quest="storehouse" reserve="prepare" /> + <structure id="storehouse" x="28" place="true" rangeX="64" rangeY="0" sfx="build" seconds="0.25"> + <onPlace> + <complete quest="storehouse" reserve="finish" /> + <object id="miner" x="player.tile_x < 6?player.tile_x+5:player.tile_x-5" y="2" mine="true" /> + <lerp object="object" alpha="1" seconds="0.25" /><pan toObject="player" seconds="0.25" /> + <item id="storehouse_blueprint" hidden="true" /> + <dialogue section="builder" id="storehouse3" speaker='player' /> + <dialogue section="builder" id="storehouse4" speaker='this' /> + <dialogue section="builder" id="storehouse5" speaker="this" /> + </onPlace> + <onCancel><complete quest="storehouse" reserve="cancel" /><pan toObject="player" seconds="0.25" /></onCancel> + </structure> + </section> + <dialogue section="builder" id="stamina" if="player.getStaminaPercent() < 0.5" speaker='this' /> + <group> + <dialogue section="builder" id="wood" speaker='this' /> + <dialogue section="builder" id="hint1" speaker='this' /> + <section> + <dialogue section="builder" id="hint2" speaker='this' /> + <dialogue section="builder" id="hint3" speaker='this' /> + </section> + </group> + </choose> + <choose if="player.questComplete('smelter')"> + <choose if="player.questComplete('farm')"> + <section if="!player.hasQuest('kitchen')"> + <dialogue section="builder" id="kitchen1" speaker='this' /> + <dialogue section="builder" id="kitchen2" speaker='this' /> + <quest id="kitchen" /> + </section> + <choose if="!player.questComplete('kitchen')"> + <section if="player.canCompleteQuest('kitchen')"> + <dialogue section="builder" id="kitchen3" speaker='this' /> + <complete quest="kitchen" reserve="prepare" /> + <structure id="kitchen" x="39" place="true" rangeX="64" rangeY="0" sfx="build" seconds="0.25"> + <onPlace> + <complete quest="kitchen" reserve="finish" /> + <lerp object="object" alpha="1" seconds="0.25" /><pan toObject="player" seconds="0.25" /> + <item id="kitchen_blueprint" hidden="true" /> + <dialogue section="builder" id="kitchen4" speaker='this' /> + </onPlace> + <onCancel><complete quest="kitchen" reserve="cancel" /><pan toObject="player" seconds="0.25" /></onCancel> + </structure> + </section> + <dialogue section="builder" id="kitchen2" speaker='this' /> + </choose> + <dialogue section="builder" id="no_kitchen" if="!player.questComplete('kitchen2') && area.getStructureById('kitchen') == null" /> + <choose if="player.questComplete('market') || player.questComplete('dock2')"> + <section if="!player.hasQuest('kitchen2')"> + <dialogue section="builder" id="kitchen5" speaker='this' /> + <dialogue section="builder" id="kitchen6" speaker='this' /> + <quest id="kitchen2" /> + </section> + <choose if="!player.questComplete('kitchen2')"> + <section if="player.canCompleteQuest('kitchen2')"> + <set id="kitchen" value="area.getStructureById('kitchen')" /> + <dialogue section="builder" id="kitchen7" speaker='this' /> + <complete quest="kitchen2" /> + <pan toStructure="kitchen" seconds="0.25" /> + <sound id="build" /><wait seconds="0.5" /> + <lerp object="kitchen" alpha="0" seconds="0.25" /><structure id="kitchen2" x="kitchen.xPos/Tile.SIZE" var="kitchen2" /> + <action>kitchen2.renderer.alpha = 0;</action><lerp object="kitchen2" alpha="1" seconds="0.25" /> + <wait seconds="0.5" /><pan toObject="player" seconds="0.25" /> + <item id="kitchen_upgrade" hidden="true" /> + <dialogue section="builder" id="kitchen8" speaker='this' /> + </section> + <dialogue section="builder" id="kitchen6" speaker='this' /> + </choose> + <dialogue section="builder" id="kitchen8" speaker='this' /> + </choose> + <dialogue section="builder" id="kitchen4" speaker='this' /> + </choose> + <dialogue section="builder" id="farmer" if="!player.hasQuest('farm')" speaker='this' /> + <dialogue section="builder" id="farm" if="player.hasQuest('farm')" speaker='this' /> + </choose> + <dialogue section="builder" id="miner" if="!getFlag('pickaxe')" speaker='this' /> + <dialogue section="builder" id="stamina" speaker='this' /> + </operate> + </npc> + + <tile id="builder.corpse" sheet="builder_dead.png" /> + <animation id="builder.corpse" count="12" x="0" /> + <object id="builder.corpse" tile="builder.corpse" action="loot" animation="builder.corpse" layer="item" networkRemove="false" projectileKillCollect="true"> + <loot id="stone_axe" /> + <operate> + <action>player.seen_items.set("stone_axe", true);</action> + <remove object="this" killer="player" modal="true" /><wait seconds="1.25" modal="false" /><equip id="stone_axe" ifEmpty="true" /> + <dialogue section="player" id="storehouse1" /> + <dialogue section="player" id="storehouse2" /> + <quest id="storehouse2" ask="false" /> + </operate> + </object> +</npcs> \ No newline at end of file diff --git a/games/aground/data/core/npc/builder_dead.png b/games/aground/data/core/npc/builder_dead.png new file mode 100644 index 00000000..ee4ac460 Binary files /dev/null and b/games/aground/data/core/npc/builder_dead.png differ diff --git a/games/aground/data/core/npc/devs.png b/games/aground/data/core/npc/devs.png new file mode 100644 index 00000000..3af5ce92 Binary files /dev/null and b/games/aground/data/core/npc/devs.png differ diff --git a/games/aground/data/core/npc/devs.xml b/games/aground/data/core/npc/devs.xml new file mode 100644 index 00000000..cb14dad1 --- /dev/null +++ b/games/aground/data/core/npc/devs.xml @@ -0,0 +1,76 @@ +<tilesheet id='devs.png' width='16' height='16'> + <image frame='0' x='0' y='0' width='14' height='11' offsetX='0' offsetY='5' /> + <image frame='2' x='14' y='0' width='14' height='11' offsetX='0' offsetY='5' /> + <image frame='3' x='28' y='0' width='14' height='11' offsetX='0' offsetY='5' /> + <image frame='6' x='42' y='0' width='14' height='11' offsetX='0' offsetY='5' /> + <image frame='7' x='56' y='0' width='14' height='11' offsetX='0' offsetY='5' /> + <image frame='8' x='70' y='0' width='14' height='11' offsetX='0' offsetY='5' /> + <image frame='10' x='84' y='0' width='14' height='11' offsetX='0' offsetY='5' /> + <image frame='12' x='0' y='11' width='14' height='11' offsetX='0' offsetY='5' /> + <image frame='13' x='0' y='22' width='14' height='11' offsetX='0' offsetY='5' /> + <image frame='14' x='0' y='33' width='14' height='11' offsetX='0' offsetY='5' /> + <image frame='20' x='0' y='44' width='14' height='11' offsetX='0' offsetY='5' /> + <image frame='23' x='0' y='55' width='14' height='11' offsetX='0' offsetY='5' /> + <image frame='24' x='14' y='11' width='15' height='16' offsetX='0' offsetY='0' /> + <image frame='25' x='29' y='11' width='15' height='15' offsetX='0' offsetY='1' /> + <image frame='26' x='44' y='11' width='15' height='16' offsetX='0' offsetY='0' /> + <image frame='27' x='59' y='11' width='15' height='16' offsetX='0' offsetY='0' /> + <image frame='28' x='74' y='11' width='15' height='16' offsetX='0' offsetY='0' /> + <image frame='29' x='89' y='11' width='15' height='16' offsetX='0' offsetY='0' /> + <image frame='30' x='14' y='27' width='15' height='16' offsetX='0' offsetY='0' /> + <image frame='31' x='14' y='43' width='15' height='14' offsetX='0' offsetY='2' /> + <image frame='32' x='14' y='57' width='15' height='16' offsetX='0' offsetY='0' /> + <image frame='33' x='14' y='73' width='15' height='16' offsetX='0' offsetY='0' /> + <image frame='34' x='14' y='89' width='15' height='16' offsetX='0' offsetY='0' /> + <image frame='35' x='29' y='27' width='15' height='15' offsetX='0' offsetY='1' /> + <image frame='36' x='29' y='42' width='15' height='16' offsetX='0' offsetY='0' /> + <image frame='37' x='29' y='58' width='15' height='16' offsetX='0' offsetY='0' /> + <image frame='38' x='29' y='74' width='15' height='16' offsetX='0' offsetY='0' /> + <image frame='39' x='29' y='90' width='15' height='16' offsetX='0' offsetY='0' /> + <image frame='40' x='44' y='42' width='15' height='16' offsetX='0' offsetY='0' /> + <image frame='41' x='59' y='42' width='15' height='16' offsetX='0' offsetY='0' /> + <image frame='42' x='74' y='42' width='15' height='16' offsetX='0' offsetY='0' /> + <image frame='43' x='44' y='27' width='15' height='15' offsetX='0' offsetY='1' /> + <image frame='44' x='89' y='42' width='15' height='16' offsetX='0' offsetY='0' /> + <image frame='45' x='44' y='58' width='15' height='16' offsetX='0' offsetY='0' /> + <image frame='46' x='44' y='74' width='15' height='16' offsetX='0' offsetY='0' /> + <image frame='47' x='44' y='90' width='15' height='16' offsetX='0' offsetY='0' /> + <image frame='48' x='59' y='27' width='15' height='15' offsetX='0' offsetY='1' /> + <image frame='49' x='59' y='58' width='15' height='16' offsetX='0' offsetY='0' /> + <image frame='50' x='74' y='58' width='15' height='16' offsetX='0' offsetY='0' /> + <image frame='51' x='89' y='58' width='15' height='16' offsetX='0' offsetY='0' /> + <image frame='52' x='74' y='27' width='15' height='11' offsetX='0' offsetY='5' /> + <image frame='53' x='89' y='27' width='15' height='11' offsetX='0' offsetY='5' /> + <image frame='54' x='59' y='74' width='15' height='11' offsetX='0' offsetY='5' /> + <image frame='55' x='59' y='85' width='15' height='11' offsetX='0' offsetY='5' /> + <image frame='56' x='59' y='96' width='15' height='11' offsetX='0' offsetY='5' /> + <image frame='57' x='74' y='74' width='15' height='11' offsetX='0' offsetY='5' /> + <image frame='58' x='89' y='74' width='15' height='11' offsetX='0' offsetY='5' /> + <image frame='59' x='74' y='85' width='15' height='11' offsetX='0' offsetY='5' /> + <image frame='60' x='74' y='96' width='15' height='11' offsetX='0' offsetY='5' /> + <image frame='66' x='98' y='0' width='12' height='10' offsetX='2' offsetY='6' /> + <image frame='67' x='0' y='66' width='12' height='10' offsetX='2' offsetY='6' /> + <image frame='69' x='0' y='76' width='12' height='10' offsetX='2' offsetY='6' /> + <image frame='70' x='0' y='86' width='12' height='10' offsetX='2' offsetY='6' /> + <image frame='71' x='0' y='96' width='12' height='10' offsetX='2' offsetY='6' /> + <image frame='72' x='89' y='85' width='12' height='10' offsetX='2' offsetY='6' /> + <image frame='73' x='89' y='95' width='12' height='10' offsetX='2' offsetY='6' /> + <image frame='1' equals='0' offsetX='0' offsetY='5' /> + <image frame='4' equals='3' offsetX='0' offsetY='5' /> + <image frame='5' equals='3' offsetX='0' offsetY='5' /> + <image frame='9' equals='8' offsetX='0' offsetY='5' /> + <image frame='11' equals='3' offsetX='0' offsetY='5' /> + <image frame='15' equals='7' offsetX='0' offsetY='5' /> + <image frame='16' equals='8' offsetX='0' offsetY='5' /> + <image frame='17' equals='6' offsetX='0' offsetY='5' /> + <image frame='18' equals='6' offsetX='0' offsetY='5' /> + <image frame='19' equals='6' offsetX='0' offsetY='5' /> + <image frame='21' equals='6' offsetX='0' offsetY='5' /> + <image frame='22' equals='6' offsetX='0' offsetY='5' /> + <image frame='61' equals='52' offsetX='0' offsetY='5' /> + <image frame='62' equals='53' offsetX='0' offsetY='5' /> + <image frame='63' equals='54' offsetX='0' offsetY='5' /> + <image frame='64' equals='55' offsetX='0' offsetY='5' /> + <image frame='65' equals='56' offsetX='0' offsetY='5' /> + <image frame='68' equals='66' offsetX='2' offsetY='6' /> +</tilesheet> diff --git a/games/aground/data/core/npc/expressions.png b/games/aground/data/core/npc/expressions.png new file mode 100644 index 00000000..f9814a0f Binary files /dev/null and b/games/aground/data/core/npc/expressions.png differ diff --git a/games/aground/data/core/npc/farmer.xml b/games/aground/data/core/npc/farmer.xml new file mode 100644 index 00000000..af0a358d --- /dev/null +++ b/games/aground/data/core/npc/farmer.xml @@ -0,0 +1,149 @@ +<?xml version="1.0" encoding="utf-8" ?> +<npcs> + <tile id="farmer" sheet="npc.png" x="47" /> + <animation id="farmer.hoe" count="5" x="19" /> + + <quest id="farm" giver="farmer" exp="10" achievement="farm"> + <item id="wood" count="15" /> + </quest> + <quest id="orchard" giver="farmer" exp="10"> + <item id="fruit" count="4" /> + </quest> + <quest id="pen" giver="farmer" exp="60" achievement="pen"> + <item id="pig" count="2" /> + <item id="wood" count="8" /> + </quest> + + <recipe id="make_wheat_seed" creates="wheat_seed" type="seed"> + <item id="wheat" count="8" /> + </recipe> + <recipe id="make_apple_seed" creates="orchard_seed" type="seed"> + <item id="wood" count="4" /> + <item id="fruit" count="4" /> + </recipe> + + <procedure id="farmer.seeds"> + <choose> + <dialogue section="farmer" id="farm4" speaker='this' if="var s = player.area.getStructureById('farm'); return s != null && s.getCropCount() < 4" /> + <dialogue section="farmer" id="farm5" speaker='this' /> + </choose> + <window type="craft" includeStorehouse="true"><recipe type="seed" /></window> + </procedure> + + <npc id="farmer" tile="farmer" action="talk" talk_sfx="talking2" idle="tendFarm" farm="farm"> + <farm id="hydroponics" /> + <operate> + <section if="!player.hasQuest('farm')"> + <dialogue section="farmer" id="introduce1" speaker='this' /> + <dialogue section="farmer" id="introduce2" speaker='this' /> + <dialogue section="farmer" id="introduce3" speaker="this" /> + <quest id="farm" /> + </section> + <choose if="!player.questComplete('farm')"> + <section if="player.canCompleteQuest('farm')"> + <dialogue section="farmer" id="farm1" speaker='this' /> + <complete quest="farm" reserve="prepare" /> + <structure id="farm" x="46" place="true" rangeX="64" rangeY="0" sfx="build" seconds="0.25"> + <onPlace> + <complete quest="farm" reserve="finish" /> + <lerp object="object" alpha="1" seconds="0.25" /> + <structure id="wheat" x="object.tile_x+11" place="true" rangeX="64" rangeY="0" sfx="plant_seed" seconds="0.25"> + <onCancel><action>player.addItem("wheat_seed")</action></onCancel> + </structure> + <pan toObject="player" seconds="0.25" animate="object" /> + <item id="farm_blueprint" hidden="true" /> + <dialogue section="farmer" id="farm2" speaker='this' /> + <item id="bread" count="2" modal="true" /> + <section if="isDate(10,31,3) && !getFlag('halloween17')"> + <action>player.setFlag('halloween17', true); var s = area.getStructureById('storehouse'); if(s != null){s.inventory.addItems(Item.get('jakolantern'), 2); s.inventory.addItems(Item.get('pumpkin_seed'), 1);}</action> + <dialogue section="farmer" id="halloween" speaker="area.getNPC('farmer')" /> + </section> + </onPlace> + <onCancel><complete quest="farm" reserve="cancel" /><pan toObject="player" seconds="0.25" /></onCancel> + </structure> + </section> + <dialogue section="farmer" id="farm3" speaker='this' /> + </choose> + <section if="isDate(10,31,3) && !getFlag('halloween17')"> + <quest /><action>player.setFlag('halloween17', true); var s = area.getStructureById('storehouse'); if(s != null){s.inventory.addItems(Item.get('jakolantern'), 2); s.inventory.addItems(Item.get('pumpkin_seed'), 1);}</action> + <dialogue section="farmer" id="halloween" speaker="this" /> + </section> + <section if="isDate(12,27,7) && !getFlag('snowman')"> + <quest /><action>player.setFlag('snowman', true);</action> + <object id="snowman" x="45" /> + <dialogue section="farmer" id="snowman" speaker="this" /> + </section> + <section if="!player.hasQuest('orchard')"> + <dialogue section="farmer" id="orchard1" speaker='this' /> + <quest id="orchard" /> + </section> + <section if="(player.questComplete('dock') || player.questComplete('dock2')) && !getFlag('cotton_seed')"> + <quest /><action>setFlag('cotton_seed', true)</action> + <dialogue section="farmer" id="add_cotton" speaker="this" /><item id="cotton_seed" /> + </section> + <choose if="!player.questComplete('orchard')"> + <section if="player.canCompleteQuest('orchard')"> + <dialogue section="farmer" id="orchard2" speaker='this' /><complete quest="orchard" /> + <dialogue section="farmer" id="orchard4" speaker='this' /> + <structure id="orchard" y="-1" place="true" rangeX="64" rangeY="0" sfx="plant_seed" seconds="0.25"> + <onCancel><action>player.addItem("orchard_seed")</action></onCancel> + </structure> + <pan toObject="player" seconds="0.25" animate="object" /> + <dialogue section="farmer" id="orchard5" speaker='this' /> + </section> + <dialogue section="farmer" id="orchard3" speaker='this' /> + </choose> + <group if="!player.hasQuest('kitchen') && player.hasQuest('storehouse')"> + <dialogue section="farmer" id="kitchen" speaker='this' /> + <run procedure="farmer.seeds" /> + </group> + <choose if="player.questComplete('market') || player.questComplete('dock2')"> + <section if="!player.hasQuest('pen')"> + <dialogue section="farmer" id="pen1" speaker='this' /> + <dialogue section="farmer" id="pen2" speaker='this' /> + <quest id="pen" /> + </section> + <choose if="!player.questComplete('pen')"> + <section if="player.canCompleteQuest('pen')"> + <dialogue section="farmer" id="pen3" speaker='this' /> + <complete quest="pen" reserve="prepare" /> + <set id="farm" value="area.getStructureById('farm')" /> + <structure id="pen_placeholder" x="farm == null?53:farm.tile_x+7" place="true" rangeX="64" rangeY="0" sfx="build" seconds="0.25"> + <onPlace> + <complete quest="pen" reserve="finish" /> + <remove structure="object" /> + <structure id="stall" x="object.xPos/Tile.SIZE" var="p1"><addAnimal id="pig" /></structure> + <structure id="stall" x="object.xPos/Tile.SIZE+2" var="p2"><addAnimal id="pig" /></structure> + <action>p1.renderer.alpha = 0;</action><lerp object="p1" alpha="1" seconds="0.25" modal="false" /> + <action>p2.renderer.alpha = 0;</action><lerp object="p2" alpha="1" seconds="0.25" animate="p1" /> + <pan toObject="player" seconds="0.25" /> + <item id="pen_blueprint" hidden="true" /> + <dialogue section="farmer" id="pen5" speaker="this" /> + </onPlace> + <onCancel><complete quest="pen" reserve="cancel" /><pan toObject="player" seconds="0.25" /></onCancel> + </structure> + </section> + <group> + <dialogue section="farmer" id="pig" speaker='this' /> + <run procedure="farmer.seeds" /> + </group> + </choose> + <section if="!getFlag('area_name_sign')"> + <action>setFlag('area_name_sign', true)</action> + <dialogue section="farmer" id="sign1" speaker='this' /> + <object id="area_name_sign" x="player.tile_x" /> + <action>area_name_sign.alpha = 0;</action><lerp object="area_name_sign" alpha="1" seconds="0.25" /> + <dialogue section="farmer" id="sign2" speaker='this' /> + </section> + <group> + <choose> + <dialogue section="farmer" id="kitchen2" if="player.questComplete('storehouse') && !player.questComplete('kitchen2')" speaker='this' /> + <dialogue section="farmer" id="pen4" speaker='this' /> + </choose> + <run procedure="farmer.seeds" /> + </group> + </choose> + <run procedure="farmer.seeds" /> + </operate> + </npc> +</npcs> \ No newline at end of file diff --git a/games/aground/data/core/npc/hunter.png b/games/aground/data/core/npc/hunter.png new file mode 100644 index 00000000..6083ebe8 Binary files /dev/null and b/games/aground/data/core/npc/hunter.png differ diff --git a/games/aground/data/core/npc/hunter.xml b/games/aground/data/core/npc/hunter.xml new file mode 100644 index 00000000..ebbb4175 --- /dev/null +++ b/games/aground/data/core/npc/hunter.xml @@ -0,0 +1,195 @@ +<?xml version="1.0" encoding="utf-8" ?> +<npcs> + <include id="hunter_sheet.xml" includeRoot="true" /> + <tile id="hunter" sheet="hunter.png" x="0" y="0" /> + <tile id="hunter.idle" sheet="hunter.png" x="10" y="0"> + <tile sheet="hunter.png" x="17" y="0" /> + </tile> + <animation id="hunter.idle.top"> + <frame visible="false" length="4" /> + <frame x="18" length="2" /> + <frame visible="false" length="32" /> + <frame x="19" count="4" /> + <frame visible="false" length="12" /> + </animation> + <animation id="hunter.idle" tile="hunter.idle" x="0" count="1" length="54"> + <append tile="hunter" animation="hunter.idle.top" /> + </animation> + <animation id="hunter.talk.top" x="19" count="4"> + <frame visible="false" /> + <frame x="23" count="3" /> + </animation> + <animation id="hunter.talk" tile="hunter.idle" x="0" count="1" length="8"> + <append tile="hunter" animation="hunter.talk.top" /> + </animation> + <animation id="hunter.attack.top"> + <frame x="11" count="3" /> + <frame x="14" count="2" length="2" /> + <frame x="16" count="1" /> + </animation> + <animation id="hunter.attack" tile="hunter" x="10" count="1" length="8"> + <append tile="hunter" animation="hunter.attack.top" /> + </animation> + <animation id="hunter.walk" count="10" x="0" /> + + <npc id="hunter" tile="hunter" action="talk" talk_sfx="talking4" sleepPos="player.hasQuest('hunt')?null:[100,-7]"> + <idle class="hunt" maxWeight="5"> + <attack type="projectile" damage="2" range="7" animation="attack"> + <projectile tile="hunter_arrow" speed="3" delay="7" offsetY="4" fire_sfx="bow" hit_sfx="arrow_hit" knockback="5" /> + </attack> + </idle> + <operate> + <choose if="player.hasQuest('hunt')"> + <choose if="!player.questComplete('hunt')"> + <section if="player.canCompleteQuest('hunt')"> + <dialogue section="hunter" id="hunt1" speaker='this' /> + <dialogue section="hunter" id="hunt2" speaker='this' /> + <complete quest="hunt" useResources="false" /> + <item id="backpack" modal="true" /><equip id="backpack" ifEmpty="true" /> + </section> + <group> + <dialogue section="hunter" id="tip1" speaker='this' /> + <dialogue section="hunter" id="tip2" speaker='this' /> + <dialogue section="hunter" id="tip3" speaker='this' /> + <dialogue section="hunter" id="tip4" speaker='this' /> + </group> + </choose> + <section if="!player.hasSeenItem('backpack')"> + <quest /><dialogue section="hunter" id="hunt1" speaker='this' /> + <dialogue section="hunter" id="hunt2" speaker='this' /> + <item id="backpack" modal="true" /><equip id="backpack" ifEmpty="true" /> + </section> + <section if="player.questComplete('hunt') && player.questComplete('farm') && !player.hasQuest('fence')"> + <dialogue section="hunter" id="fence1" speaker="this" /> + <dialogue section="hunter" id="fence2" speaker='this' /> + <quest id="fence" /> + </section> + <section if="player.hasQuest('fence') && !player.questComplete('fence') && player.canCompleteQuest('fence')"> + <dialogue section="hunter" id="fence3" speaker='this' /> + <complete quest="fence" /> + <section with="fade"> + <move object="player" x="52" /> + <move object="this" to="player" /> + <object id="fence" x="52" /> + <item id="fence" count="5" hidden="true" /> + </section> + <dialogue section="hunter" id="fence4" speaker='this' /> + </section> + <section if="player.questComplete('fence') && (player.questComplete('dock') || player.questComplete('dock2')) && !player.hasQuest('wolf')"> + <dialogue section="hunter" id="wolf1" speaker="this" /> + <dialogue section="hunter" id="wolf2" speaker='player' /> + <dialogue section="hunter" id="wolf3" speaker='this' /> + <dialogue section="hunter" id="wolf4" speaker='this' /> + <quest id="wolf" /> + </section> + <section if="player.hasQuest('wolf') && !player.questComplete('wolf') && player.canCompleteQuest('wolf')"> + <scene id="hunter" show="fourth" dissolve="true" seconds="0.5" showToAll="true" /> + <complete quest="wolf" /> + </section> + <group> + <dialogue section="hunter" id="tip1" speaker='this' /> + <dialogue section="hunter" id="tip2" speaker='this' /> + <dialogue section="hunter" id="tip3" speaker='this' /> + <dialogue section="hunter" id="tip4" speaker='this' /> + </group> + </choose> + <section> + <set id="hunter" value="this" /> + <menu section="common"> + <dialogue section="hunter" id="reject3" speaker="hunter" /> + <choice id="yes"> + <run procedure="hunter.deal" /> + <lerp object="hunter" alpha="0" seconds="0.25" /> + <move object="hunter" x="95" y="-1" /> + <action>hunter.alpha = 1;</action> + </choice> + <choice id="no" /> + </menu> + </section> + </operate> + </npc> + <object id="hunter_hotspot" width="64"> + <over> + <section if="player.equipment.get('pickaxe').get() != null && !isNight()"> + <remove object="this" /> + <object id="hunter" x="98" y="-7" facing="right" /> + <object id="boar" x="hunter.tile_x+5" y="hunter.tile_y" facing="left" /> + <action>boar.renderer.run(5*Tile.SIZE)</action> + <pan toObject="hunter" seconds="1" /> + <wait seconds="3"> + <operate object="hunter" /> + <operate object="boar" /> + </wait> + <remove object="boar" /> + <facing object="hunter" dir="left" /> + <action>hunter.playAnimation("walk")</action> + <lerp object="hunter" deltaX="-1" seconds="0.125" /> + <lerp object="hunter" deltaY="2" seconds="0.25" /> + <lerp object="hunter" deltaX="-1" seconds="0.125" /> + <lerp object="hunter" deltaY="2" seconds="0.25" /> + <lerp object="hunter" deltaX="-1" seconds="0.125" /> + <lerp object="hunter" deltaY="2" seconds="0.25" /> + <move object="hunter" to="player" /> + <move object="hunter" x="hunter.xPos/Tile.SIZE" y="-1" /> + <pan toObject="player" seconds="1" /> + <wait seconds="0.25" /> + <scene id="hunter" show="first" dissolve="true" seconds="0.5" showToAll="true" /> + <section if="!player.hasQuest('hunt')"> + <facing object="hunter" dir="right" /> + <action>hunter.playAnimation("walk")</action> + <lerp object="hunter" x="95.5" y="-0.5" seconds="0.25" /> + <lerp object="hunter" deltaY="-2" seconds="0.25" /> + <lerp object="hunter" deltaX="1" seconds="0.125" /> + <lerp object="hunter" deltaY="-2" seconds="0.25" /> + <lerp object="hunter" deltaX="1" seconds="0.125" /> + <lerp object="hunter" deltaY="-2" seconds="0.25" /> + <lerp object="hunter" deltaX="1" seconds="0.125" /> + <move object="hunter" x="98" y="-7" /> + </section> + </section> + </over> + </object> + <quest id="hunt" giver="hunter" exp="30" achievement="backpack"> + <kill id="boar" name="quests.boars" count="5" /> + <item id="bow" count="1" allowEquipped="true" /> + </quest> + <quest id="fence" giver="hunter" exp="40"> + <item id="fence" count="6" /> + </quest> + <quest id="wolf" giver="hunter" exp="60"> + <item id="net" count="3" /> + <item id="trap" count="3" /> + <item id="meat" count="6" /> + </quest> + <procedure id="hunter.deal"> + <dialogue section="hunter" id="accept1" speaker='hunter' /> + <dialogue section="hunter" id="accept2" speaker='hunter' /> + <item id="workbench" modal="true" /> + <dialogue section="hunter" id="accept3" speaker='hunter' /> + <dialogue section="hunter" id="accept4" speaker='hunter' /> + <dialogue section="hunter" id="accept5" speaker='hunter' /> + <quest id="hunt" ask="false" /> + </procedure> + + <structure id="tent" tile="tent" destroyRemove="true"> + <operate> + <choose> + <choose if="!player.hasQuest('hunt')"> + <dialogue section="hunter" id="tent1" if="area.getNPC('hunter') == null" /> + <dialogue section="hunter" id="tent2" /> + </choose> + <section> + <choose if="!getFlag('final_boss_defeat') && area.getNPC('hunter') != null"> + <scene id="hunter" show="second" with="fade" if="!getFlag('hunter_tent')" showToAll="true"> + <action>setFlag('hunter_tent', true);</action> + </scene> + <scene id="hunter" show="third" with="fade" if="(player.hasQuest('market') || player.hasQuest('dock2')) && !getFlag('hunter_tent2')" showToAll="true"> + <action>setFlag('hunter_tent2', true);</action> + </scene> + </choose> + <action>player.restoreStamina();</action><save sleep="true" /> + </section> + </choose> + </operate> + </structure> +</npcs> \ No newline at end of file diff --git a/games/aground/data/core/npc/hunter_sheet.xml b/games/aground/data/core/npc/hunter_sheet.xml new file mode 100644 index 00000000..22732e5e --- /dev/null +++ b/games/aground/data/core/npc/hunter_sheet.xml @@ -0,0 +1,28 @@ +<tilesheet id='hunter.png' width='16' height='16'> + <image frame='0' x='0' y='0' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='1' x='13' y='0' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='2' x='26' y='0' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='3' x='0' y='11' width='11' height='11' offsetX='4' offsetY='5' /> + <image frame='4' x='0' y='22' width='11' height='11' offsetX='4' offsetY='5' /> + <image frame='5' x='0' y='33' width='11' height='11' offsetX='4' offsetY='5' /> + <image frame='6' x='11' y='11' width='11' height='11' offsetX='4' offsetY='5' /> + <image frame='7' x='22' y='11' width='11' height='11' offsetX='4' offsetY='5' /> + <image frame='8' x='33' y='11' width='11' height='11' offsetX='4' offsetY='5' /> + <image frame='9' x='11' y='22' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='10' x='39' y='0' width='10' height='11' offsetX='5' offsetY='5' /> + <image frame='11' x='11' y='33' width='13' height='7' offsetX='3' offsetY='8' /> + <image frame='12' x='11' y='40' width='13' height='9' offsetX='3' offsetY='6' /> + <image frame='13' x='24' y='22' width='16' height='7' offsetX='0' offsetY='8' /> + <image frame='14' x='24' y='29' width='15' height='7' offsetX='1' offsetY='8' /> + <image frame='16' x='24' y='36' width='13' height='7' offsetX='3' offsetY='8' /> + <image frame='17' x='24' y='43' width='13' height='6' offsetX='3' offsetY='9' /> + <image frame='18' x='0' y='44' width='5' height='1' offsetX='6' offsetY='9' /> + <image frame='19' x='0' y='45' width='2' height='1' offsetX='7' offsetY='11' /> + <image frame='20' x='2' y='45' width='2' height='1' offsetX='7' offsetY='11' /> + <image frame='22' x='4' y='45' width='1' height='1' offsetX='7' offsetY='11' /> + <image frame='15' equals='14' offsetX='1' offsetY='8' /> + <image frame='21' equals='20' offsetX='7' offsetY='11' /> + <image frame='23' equals='19' offsetX='7' offsetY='11' /> + <image frame='24' equals='22' offsetX='7' offsetY='11' /> + <image frame='25' equals='22' offsetX='7' offsetY='11' /> +</tilesheet> diff --git a/games/aground/data/core/npc/miner.xml b/games/aground/data/core/npc/miner.xml new file mode 100644 index 00000000..f2f5c8fd --- /dev/null +++ b/games/aground/data/core/npc/miner.xml @@ -0,0 +1,143 @@ +<?xml version="1.0" encoding="utf-8" ?> +<npcs> + <tile id="miner" sheet="npc.png" x="27" /> + <animation id="miner.mine" count="1" length="10" x="19"> + <append tile="stone_pickaxe" animation="equipment.stone_pickaxe" offsetX="-0.25" offsetY="-0.25" behind="true" /> + </animation> + + <quest id="smelter" giver="miner" exp="20" achievement="smelter"> + <item id="coal" count="15" /> + </quest> + <quest id="workshop" giver="miner" exp="40" achievement="workshop"> + <item id="wood" count="5" /> + <item id="iron_bar" count="5" /> + </quest> + + <quest id="minecart" giver="miner" exp="80"> + <item id="minecart" count="1" /> + <item id="rail" count="12" /> + </quest> + + <procedure id="miner_hints"> + <group> + <dialogue section="miner" id="hotkey" speaker='this' /> + <dialogue section="miner" id="hint1" speaker='this' /> + <dialogue section="miner" id="hint4" speaker='this' /> + <dialogue section="miner" id="hint5" speaker='this' /> + <section if="!player.questComplete('workshop')"> + <dialogue section="miner" id="hint6" speaker='this' /> + <window type="craft" includeStorehouse="true"><recipe id="craft_torch" /></window> + </section> + <dialogue section="miner" id="hint2" speaker='this' /> + <dialogue section="miner" id="hint3" speaker='this' /> + </group> + </procedure> + + <npc id="miner" tile="miner" action="talk" talk_sfx="talking7"> + <idle class="mineOre"><loot id="coal" /></idle> + <operate> + <section if="!player.hasSeenItem('stone_pickaxe') && !player.hasQuest('smelter')"> + <quest /> + <action>setFlag('pickaxe', true); setFlag('allow_hotkeys', true);</action> + <dialogue section="miner" id="introduce1" speaker='this' /> + <dialogue section="miner" id="introduce2" speaker='this' /> + <dialogue section="miner" id="introduce3" speaker='this' /> + <item id="stone_pickaxe" modal="true" /><equip id="stone_pickaxe" ifEmpty="true" /> + <dialogue section="miner" id="hint1" speaker='this' /> + </section> + <run procedure="miner_hints" if="!getFlag('miner_hut')" /> + <section if="!player.hasQuest('smelter')"> + <dialogue section="miner" id="smelter" speaker='this' /> + <quest id="smelter"> + <dialogue section="miner" id="accept1" speaker='this' /> + </quest> + </section> + <choose if="!player.questComplete('smelter')"> + <section if="player.canCompleteQuest('smelter')"> + <dialogue section="miner" id="smelter1" speaker='this' /> + <complete quest="smelter" reserve="prepare" /> + <structure id="smelter" x="23" place="true" rangeX="64" rangeY="0" sfx="build" seconds="0.25"> + <onPlace> + <complete quest="smelter" reserve="finish" /><lerp object="object" alpha="1" seconds="0.25" /> + <object id="farmer" x="46" /><pan toObject="player" seconds="0.25" /> + <item id="smelter_blueprint" hidden="true" /> + <dialogue section="miner" id="smelter2" speaker='this' /> + </onPlace> + <onCancel><complete quest="smelter" reserve="cancel" /><pan toObject="player" seconds="0.25" /></onCancel> + </structure> + </section> + <run procedure="miner_hints" /> + </choose> + <run procedure="miner_hints" if="!player.questComplete('farm')" /> + <section if="!player.hasQuest('workshop')"> + <dialogue section="miner" id="workshop1" speaker='this' /> + <quest id="workshop"> + <dialogue section="miner" id="torch" speaker='this' /> + <item id="torch" /><equip id="torch" ifEmpty="true" /> + </quest> + </section> + <section if="!player.hasSeenItem('torch')"> + <dialogue section="miner" id="torch" speaker='this' /> + <item id="torch" /><equip id="torch" ifEmpty="true" /> + </section> + <choose if="!player.questComplete('workshop')"> + <section if="player.canCompleteQuest('workshop')"> + <dialogue section="miner" id="workshop2" speaker='this' /> + <complete quest="workshop" reserve="prepare" /> + <structure id="workshop" x="17" place="true" rangeX="64" rangeY="0" sfx="build" seconds="0.25"> + <onPlace> + <complete quest="workshop" reserve="finish" /> + <lerp object="object" alpha="1" seconds="0.25" /><pan toObject="player" seconds="0.25" /> + <item id="workshop_blueprint" hidden="true" /> + <dialogue section="miner" id="workshop3" speaker='this' /> + </onPlace> + <onCancel><complete quest="workshop" reserve="cancel" /><pan toObject="player" seconds="0.25" /></onCancel> + </structure> + </section> + <group> + <section if="!player.questComplete('workshop')"> + <dialogue section="miner" id="hint6" speaker='this' /> + <window type="craft" includeStorehouse="true"><recipe id="craft_torch" /></window> + </section> + <dialogue section="miner" id="workshop4" speaker='this' /> + <dialogue section="miner" id="smelter3" speaker='this' /> + <dialogue section="miner" id="smelter4" speaker='this' /> + <dialogue section="miner" id="hint5" speaker='this' /> + </group> + </choose> + <choose if="(!player.hasQuest('minecart') || player.canCompleteQuest('minecart')) && (player.questComplete('market') || player.questComplete('dock2'))"> + <section if="!player.hasQuest('minecart')"> + <dialogue section="miner" id="minecart1" speaker='this' /> + <quest id="minecart" /> + </section> + <section if="player.canCompleteQuest('minecart')"> + <dialogue section="miner" id="minecart2" speaker='this' /> + <complete quest="minecart" /> + <section with="fade"> + <move object="player" x="30" /> + <move object="this" to="player" /> + <object id="minecart" x="30" y="0" /> + </section> + <set id="_y" value="-1" /><repeat count="7"> + <dig x="30" y="_y" speed="2" /><action>setOre(30, _y, "rail"); _y++;</action> + </repeat> + <set id="_x" value="28" /><repeat count="5"> + <dig x="_x" y="_y" speed="2" /><action>setOre(_x, _y, "rail"); _x++;</action> + </repeat> + <dialogue section="miner" id="minecart3" speaker='this' /> + </section> + </choose> + <group> + <dialogue section="miner" id="pick" if="!player.hasItem('iron_pickaxe') && !player.hasItem('steel_pickaxe') && player.getMine() < 2" speaker='this' /> + <choose> + <dialogue section="miner" id="equip1" if="(player.hasItem('iron_pickaxe') || player.hasItem('steel_pickaxe')) && player.getMine() < 2" speaker='this' /> + <dialogue section="miner" id="equip2" speaker='this' /> + </choose> + <dialogue section="miner" id="hint4" speaker='this' /> + <dialogue section="miner" id="hint5" speaker='this' /> + <dialogue section="miner" id="hint2" speaker='this' /> + <dialogue section="miner" id="hint3" speaker='this' /> + </group> + </operate> + </npc> +</npcs> \ No newline at end of file diff --git a/games/aground/data/core/npc/npc.png b/games/aground/data/core/npc/npc.png new file mode 100644 index 00000000..551d170d Binary files /dev/null and b/games/aground/data/core/npc/npc.png differ diff --git a/games/aground/data/core/npc/npcs.xml b/games/aground/data/core/npc/npcs.xml new file mode 100644 index 00000000..4a1ce5ce --- /dev/null +++ b/games/aground/data/core/npc/npcs.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="utf-8" ?> +<data> + <tilesheet id="expressions.png" width="22" height="18" /> + <tile id="expressions.scared" sheet="expressions.png" x="0" /><animation id="expressions.scared" count="4" /> + + <animation id="npc.idle"> + <frame x="1" length="4" /> + <frame x="0" length="2" /> + <frame x="1" length="32" /> + <frame x="1" count="4" /> + <frame x="1" length="12" /> + </animation> + <animation id="npc.talk" count="4" x="5"> + <frame x="1" length="4" /> + <frame x="0" length="2" /> + <frame x="1" length="4" /> + <frame x="1" count="4" /> + </animation> + <animation id="npc.walk" count="9" x="10"/> + + <include id="builder.xml" /> + <include id="farmer.xml" /> + <include id="miner.xml" /> + <include id="trader.xml" /> + <include id="alchemist.xml" /> + <include id="hunter.xml" /> + + <include id="devs.xml" includeRoot="true" /> + <tile id="dev.david" sheet="devs.png" x="52" y="0" /> + <tile id="dev.aaron" sheet="devs.png" x="0" y="0" /> + <tile id="dev.chase" sheet="devs.png" x="24" y="0" /> + <tile id="dev.natalie" sheet="devs.png" x="66" y="0" /> + <animation id="dev.david" count="14" reverse="true" /> + <animation id="dev.aaron" count="24" reverse="true" /> + <animation id="dev.chase" count="28" reverse="true" /> + <animation id="dev.natalie" count="8" reverse="true" /> + + <credits time="20" title="Beta Testers"> + Adam "Unowninator" Lapidus, Airom, Cirem52, craigpent, Etrotta, Geronimo216, Isobel A Wright, Lauren X. Pham, Luna Reweti, Mateusz Bruzda, Matt P, Preston Mott, Ramsis, ShilohAK, Thelelanator + </credits> + + <credits time="60" title="Backers"> +Andrew Dunne, Caleb Smith + +Dash Buck, Dicewolf, Donald Reynolds III, Juraj Kirchheim + +Solar Rifle, Matthew Decker + +Fractured Empiricist, Ian Glidewell, lev, NateIsAte, valkarii + +Annalisia, Filip M. Lindeberg, Fredrick Atchison + +Aaron Gipe, Alyssa Schreiber, Amemir, Austin Cottle, Bill Maletz, Bobby Loggains, Cristan Silan, Dana "Biddu" Fleming, Ebony riddle, Elis Hussey, Eoin Sheehan, Excelsior!, Guy28, Hannes Påfvelsson, Illusion-XIII, Jacky Faber, James Pacheco, Joe Sunter, Jonas D., Kenneth Montoya, Lance Kross, Laurence Goldinger, Michael Krepelka, Naïve Sprites, purpleyukari, Ratzlak, SENHOR SUPREMO DO UNIVERSO, Shawn "AstroCreep95" Matthews, sillyna, Stina Schwebke, Taylor Breckon, Troy Lowe, Tump (No, not Trump ffs.), vladspellbinder, Yitzchak Markovitz + +ABlackfyre, aimir, Alan Lewis, Alex Pugmire, Alexander, All Hail David & Crew, Allen Beck, Andrew Resnick, Andrew Topperwien, Andrzej Sylla, Brandon "Grim" Moss, Cameron "Pengo" Genard, Cody Gronseth, Colrick, craigpent, Damon Zarro, Darioon Cloudgazer, David Wildasin, Dennis Poulsen, Deonna Coakley, Elder, Enzo Petit, Eric Stevens, Essayjinx, Fairyvamp AES, Filipe JFA Almeida, Flo Fou, Frank Milliren, gASK, George Noe, House K, IA Blythe, JasonDuiuc, Joebob the VeryPeeeved, Jonatan Tagle, Jonathan Beck, Josh (Jek) Wren, Kimi Funakoshi, kpottyman, KSWu&KLY&CaitlynWu, Kulvar, Mahkii900, Makiah Woo, Mama Heyou, Marc G. Dennis, Michael Merz, Mike Sutton, MiwAuturu, Mudkrab, Nathanael Ray Durbin, Nic Jackson, Nick Mooney, Norberto Abanes, Oscar Cunningham, Per Kristian Brastad, perry charles, R3FRSH, Ray Gibbs, Rebecca Blatt, sbiron119, Sean Burnett, Silvara DeWinter, Sir Fat Pikachu of youtube land, @sj_stock, Snowydragon, Taylor Luke, TDrev, this is not a name, ThriceElite, Travis Schneider, Tri Kiet Ho, Undercover_Llama, Unowninator, Wingzerogundam00, Zuiter + +animagus_kitty, Denis Reshetniak, Jordan Hart aka Infinilude, Julia Stein, Lucas R. Brunelle, Lurofen (Jasmin K.), Mario Illinger, Mark Smallwood, Parsnipnose, Private Loli., Thibaud Galloy + +A. Maxim, Alex Friele, Alex Laitinen, Alkira Taylor, ANNA MUNAKATA, Arion Sprague, Brian Wildrick, Corentin DERVOUT, Finn Spencer, Fletcher St-Germain, Guillaume Wigno, James J Tree, Leo Zacharias Jansson, Levent B. Güngen, Malcolm Gussick, Noah Wright, RelatedGuy, Richard M. Hopple, Jr., Tapsa, Taylor C. Berrier a.k.a. thegalaxy89, Tyler Daniel + </credits> +</data> \ No newline at end of file diff --git a/games/aground/data/core/npc/trader.xml b/games/aground/data/core/npc/trader.xml new file mode 100644 index 00000000..f18cd615 --- /dev/null +++ b/games/aground/data/core/npc/trader.xml @@ -0,0 +1,143 @@ +<?xml version="1.0" encoding="utf-8" ?> +<npcs> + <tile id="trader" sheet="npc.png" x="71" /> + + <quest id="market" giver="trader" exp="60" achievement="market"> + <item id="gold_bar" count="5" /> + </quest> + <object id="market2_placeholder" tile="market_placeholder" alpha="0.5" action="build" layer="item" width="137" height="35" tileOffsetX="-45" structure_overlap="common.dismantle_tip"> + <operate> + <stop if="!Action.canPlaceStructure(player, getStructure('market_placeholder'), this.info.xml, this.xPos, this.yTile)" /> + <window type="build" structure="market_placeholder" includeStorehouse="true" requirementsXml="getQuest('market2').xml"> + <dialogue section="player" id="market2" /> + <complete quest="market2" useResources="false" /><sound id="build" /> + <structure id="market_placeholder" x="this.xPos/Tile.SIZE" var="object" /><action>object.renderer.alpha=0;</action><lerp object="object" alpha="1" seconds="0.25" /> + <remove object="this" /><remove structure="object" /><structure id="market" x="this.xPos/Tile.SIZE" /> + <dialogue section="player" id="market3" /> + <item id="coin_purse" value="0" modal="true" /> + <dialogue section="player" id="market4" /> + </window> + </operate> + </object> + <quest id="market2" exp="60" achievement="market"> + <item id="gold_bar" count="5" /> + </quest> + <quest id="dock" giver="trader" coins="500" exp="80" achievement="dock"> + <item id="wood" count="20" /> + <item id="cloth" count="5" /> + <item id="net" count="5" /> + </quest> + <object id="dock2_placeholder" tile="dockhouse" alpha="0.5" action="build" layer="item" structure_overlap="common.dismantle_tip"> + <operate> + <stop if="!Action.canPlaceStructure(player, getStructure('dockhouse'), this.info.xml, this.xPos, this.yTile)" /> + <window type="build" structure="dockhouse" includeStorehouse="true" requirementsXml="getQuest('dock2').xml"> + <dialogue section="player" id="dock3" /> + <complete quest="dock2" useResources="false" /><sound id="build" /> + <structure id="dockhouse" x="this.xPos/Tile.SIZE" var="object" /><action>object.renderer.alpha=0;</action><lerp object="object" alpha="1" seconds="0.25" /><remove object="this" /> + <structure id="dock" x="-4" /> + <item id="dock_blueprint" hidden="true" /> + <object id="market2_placeholder" x="7" /><pan toObject="market2_placeholder" seconds="0.25" /> + <dialogue section="player" id="market1" /> + <quest id="market2" ask="false" /> + <pan toObject="player" seconds="0.25" /> + </window> + </operate> + </object> + <quest id="dock2" exp="80" achievement="dock"> + <item id="wood" count="20" /> + <item id="steel_bar" count="10" /> + </quest> + <quest id="boat" recipe="boat" exp="100" achievement="boat" /> + + <npc id="trader" tile="trader" action="talk" talk_sfx="talking6"> + <idle class="wander" toX="15" /> + <operate> + <choose if="!player.questComplete('market')"> + <section if="player.canCompleteQuest('market')"> + <dialogue section="trader" id="market1" speaker='this' /> + <complete quest="market" reserve="prepare" /> + <structure id="market_placeholder" x="7" place="true" rangeX="0" rangeY="0" sfx="build" seconds="0.25" structure_overlap="common.dismantle_tip"> + <onPlace> + <complete quest="market" reserve="finish" /> + <lerp object="object" alpha="1" seconds="0.25" /><pan toObject="player" seconds="0.25" /> + <remove structure="object" /><structure id="market" x="object.xPos/Tile.SIZE" /> + <item id="coin_purse" value="0" modal="true" /> + <dialogue section="trader" id="market2" speaker='this' /> + </onPlace> + <onCancel><complete quest="market" reserve="cancel" /><pan toObject="player" seconds="0.25" /></onCancel> + </structure> + </section> + <dialogue section="trader" id="market5" speaker='this' /> + </choose> + <section if="!player.hasSeenItem('coin_purse')"> + <quest /><dialogue section="trader" id="market2" speaker='this' /> + <item id="coin_purse" value="0" /> + </section> + <choose if="player.questComplete('pen')"> + <section if="!player.hasQuest('dock')"> + <dialogue section="trader" id="dock1" speaker='this' /> + <dialogue section="trader" id="dock2" speaker='this' /> + <quest id="dock" /> + </section> + <choose if="!player.questComplete('dock')"> + <section if="player.canCompleteQuest('dock')"> + <dialogue section="trader" id="dock3" speaker='this' /> + <complete quest="dock" reserve="prepare" /> + <structure id="dockhouse" x="0" place="true" rangeX="0" rangeY="0" sfx="build" seconds="0.25" structure_overlap="common.dismantle_tip"> + <onPlace> + <complete quest="dock" reserve="finish" /> + <lerp object="object" alpha="1" seconds="0.25" /> + <structure id="dock" x="-4" var="dock" /><pan toObject="player" seconds="0.25" /> + <item id="dock_blueprint" hidden="true" /> + <dialogue section="trader" id="dock4" speaker='this' /> + </onPlace> + <onCancel><complete quest="dock" reserve="cancel" /><pan toObject="player" seconds="0.25" /></onCancel> + </structure> + </section> + <dialogue section="trader" id="dock5" speaker='this' /> + </choose> + <section if="player.questComplete('boat')"> + <action>areas = []; for(a in player.areas){var e = Area.getXML(a.id); if(e != null && e.get("planet") == "start" && !a.isOrbit() && a.getMainStorehouse(true) != null) areas.push(a);}</action> + <section if="areas.length >= 2"> + <section if="!getFlag('trader_shipping')"> + <quest /><action>setFlag('trader_shipping', true)</action> + <dialogue section="trader" id="shipping1" speaker='this' /> + </section> + <menu width="150" closeable="true" yalign="0.75"> + <dialogue section="trader" id="shipping2" /> + <choice id="value.getDisplay().get()" values="areas.iterator()"> + <action>areas.remove(value); this.inventory.clear(); from = value.getMainStorehouse(true).accessInventory();</action> + <dialogue eval="'trader.shipping3{area:'+value.getDisplay().get()+'}'" speaker='this' /> + <window type="storehouse" from="from" inventory="this.inventory" titleMutable="this.info.getDisplayName(null)" max_weight="player.getCoins()*5"> + <weight id="to" title="common.coins" div="5" /> + </window> + <stop if="!this.inventory.hasItem()" /><action>coins = Math.round(this.inventory.weight/5)</action> + <menu width="150" closeable="true" yalign="0.75" allowSingle="true"> + <dialogue eval="'trader.shipping4{coins:'+coins+'}'" /> + <choice id="value.getDisplay().get()" values="areas.iterator()"> + <section if="player.getCoins() >= coins"> + <action>player.addCoins(-coins); value.getMainStorehouse(true).accessInventory().addAll(this.inventory); this.inventory.clear();</action> + <sound id="buy" /><dialogue section="trader" id="shipping5" speaker='this' /> + </section> + </choice> + </menu> + <action>from.addAll(this.inventory); this.inventory.clear();</action> + </choice> + </menu> + <stop /> + </section> + <section if="!getFlag('trader_shipping') && player.areas.exists('science1')"> + <quest /><action>setFlag('trader_shipping', true)</action> + <dialogue section="trader" id="shipping1" speaker='this' /><stop /> + </section> + <dialogue section="trader" id="sail" speaker='this' /> + </section> + <dialogue section="trader" id="dock4" speaker='this' /> + </choose> + <section> + <dialogue section="trader" id="market3" speaker='this' /> + <dialogue section="trader" id="market4" speaker='this' /> + </section> + </operate> + </npc> +</npcs> \ No newline at end of file diff --git a/games/aground/data/core/player/death.png b/games/aground/data/core/player/death.png new file mode 100644 index 00000000..fda96801 Binary files /dev/null and b/games/aground/data/core/player/death.png differ diff --git a/games/aground/data/core/player/layers.png b/games/aground/data/core/player/layers.png new file mode 100644 index 00000000..1d3a751a Binary files /dev/null and b/games/aground/data/core/player/layers.png differ diff --git a/games/aground/data/core/player/layers.xml b/games/aground/data/core/player/layers.xml new file mode 100644 index 00000000..0ee568ff --- /dev/null +++ b/games/aground/data/core/player/layers.xml @@ -0,0 +1,1639 @@ +<tilesheet id='layers.png' width='16' height='16'> + <image frame='0' x='47' y='26' width='2' height='1' offsetX='9' offsetY='13' /> + <image frame='5' x='24' y='78' width='7' height='1' offsetX='5' offsetY='13' /> + <image frame='10' x='57' y='26' width='5' height='1' offsetX='6' offsetY='10' /> + <image frame='20' x='0' y='126' width='8' height='8' offsetX='6' offsetY='7' /> + <image frame='30' x='27' y='13' width='9' height='2' offsetX='5' offsetY='14' /> + <image frame='31' x='62' y='27' width='10' height='1' offsetX='4' offsetY='15' /> + <image frame='32' x='48' y='52' width='1' height='1' offsetX='5' offsetY='15' /> + <image frame='34' x='47' y='27' width='2' height='1' offsetX='9' offsetY='15' /> + <image frame='35' x='39' y='13' width='9' height='2' offsetX='5' offsetY='14' /> + <image frame='36' x='42' y='72' width='10' height='1' offsetX='4' offsetY='15' /> + <image frame='37' x='71' y='51' width='1' height='1' offsetX='5' offsetY='15' /> + <image frame='39' x='60' y='27' width='2' height='1' offsetX='9' offsetY='15' /> + <image frame='40' x='63' y='72' width='8' height='1' offsetX='2' offsetY='12' /> + <image frame='41' x='51' y='13' width='8' height='2' offsetX='0' offsetY='11' /> + <image frame='44' x='23' y='52' width='2' height='1' offsetX='11' offsetY='13' /> + <image frame='45' x='65' y='77' width='7' height='2' offsetX='5' offsetY='13' /> + <image frame='46' x='8' y='101' width='9' height='8' offsetX='4' offsetY='7' /> + <image frame='52' x='66' y='98' width='6' height='2' offsetX='3' offsetY='14' /> + <image frame='53' x='63' y='136' width='6' height='2' offsetX='1' offsetY='14' /> + <image frame='54' x='16' y='78' width='8' height='1' offsetX='5' offsetY='15' /> + <image frame='55' x='36' y='142' width='7' height='2' offsetX='4' offsetY='14' /> + <image frame='56' x='66' y='105' width='6' height='1' offsetX='7' offsetY='15' /> + <image frame='57' x='43' y='144' width='6' height='1' offsetX='7' offsetY='15' /> + <image frame='58' x='57' y='27' width='3' height='1' offsetX='6' offsetY='11' /> + <image frame='64' x='0' y='86' width='8' height='11' offsetX='0' offsetY='3' /> + <image frame='65' x='58' y='49' width='3' height='3' offsetX='0' offsetY='7' /> + <image frame='66' x='0' y='39' width='10' height='14' offsetX='1' offsetY='1' /> + <image frame='67' x='55' y='105' width='8' height='1' offsetX='1' offsetY='14' /> + <image frame='73' x='43' y='142' width='7' height='2' offsetX='1' offsetY='13' /> + <image frame='82' x='62' y='13' width='1' height='2' offsetX='3' offsetY='14' /> + <image frame='83' x='7' y='116' width='1' height='8' offsetX='3' offsetY='7' /> + <image frame='110' x='63' y='138' width='6' height='2' offsetX='2' offsetY='10' /> + <image frame='124' x='0' y='134' width='8' height='8' offsetX='2' offsetY='8' /> + <image frame='153' x='63' y='144' width='6' height='1' offsetX='1' offsetY='15' /> + <image frame='165' x='70' y='93' width='1' height='5' offsetX='1' offsetY='10' /> + <image frame='169' x='17' y='109' width='1' height='6' offsetX='2' offsetY='7' /> + <image frame='194' x='71' y='52' width='1' height='1' offsetX='4' offsetY='12' /> + <image frame='200' x='38' y='72' width='1' height='1' offsetX='4' offsetY='12' /> + <image frame='201' x='58' y='52' width='3' height='1' offsetX='3' offsetY='12' /> + <image frame='206' x='70' y='36' width='2' height='3' offsetX='4' offsetY='10' /> + <image frame='208' x='6' y='142' width='2' height='3' offsetX='4' offsetY='10' /> + <image frame='209' x='25' y='13' width='2' height='2' offsetX='4' offsetY='10' /> + <image frame='210' x='39' y='72' width='1' height='1' offsetX='5' offsetY='10' /> + <image frame='218' x='36' y='49' width='1' height='4' offsetX='5' offsetY='10' /> + <image frame='235' x='68' y='49' width='3' height='3' offsetX='7' offsetY='7' /> + <image frame='236' x='66' y='100' width='5' height='5' offsetX='1' offsetY='0' /> + <image frame='237' x='43' y='117' width='9' height='5' offsetX='2' offsetY='0' /> + <image frame='238' x='43' y='111' width='8' height='6' offsetX='2' offsetY='1' /> + <image frame='246' x='63' y='12' width='9' height='3' offsetX='2' offsetY='0' /> + <image frame='247' x='49' y='49' width='9' height='4' offsetX='2' offsetY='0' /> + <image frame='248' x='66' y='106' width='4' height='5' offsetX='5' offsetY='2' /> + <image frame='249' x='36' y='13' width='3' height='2' offsetX='5' offsetY='5' /> + <image frame='250' x='63' y='0' width='9' height='12' offsetX='7' offsetY='4' /> + <image frame='251' x='0' y='0' width='15' height='15' offsetX='1' offsetY='1' /> + <image frame='253' x='48' y='13' width='3' height='2' offsetX='5' offsetY='0' /> + <image frame='254' x='25' y='49' width='11' height='4' offsetX='2' offsetY='2' /> + <image frame='255' x='37' y='49' width='11' height='4' offsetX='2' offsetY='1' /> + <image frame='261' x='36' y='144' width='7' height='1' offsetX='5' offsetY='13' /> + <image frame='263' x='38' y='71' width='2' height='1' offsetX='12' offsetY='13' /> + <image frame='264' x='57' y='129' width='8' height='1' offsetX='4' offsetY='12' /> + <image frame='266' x='23' y='47' width='2' height='5' offsetX='7' offsetY='5' /> + <image frame='267' x='24' y='127' width='1' height='6' offsetX='8' offsetY='2' /> + <image frame='268' x='67' y='111' width='3' height='6' offsetX='7' offsetY='5' /> + <image frame='269' x='60' y='134' width='3' height='7' offsetX='8' offsetY='2' /> + <image frame='270' x='65' y='122' width='5' height='7' offsetX='7' offsetY='0' /> + <image frame='271' x='41' y='71' width='1' height='1' offsetX='14' offsetY='15' /> + <image frame='273' x='59' y='13' width='3' height='2' offsetX='12' offsetY='14' /> + <image frame='275' x='63' y='142' width='8' height='1' offsetX='2' offsetY='15' /> + <image frame='287' x='17' y='101' width='1' height='8' offsetX='2' offsetY='8' /> + <image frame='322' x='63' y='143' width='8' height='1' offsetX='6' offsetY='14' /> + <image frame='333' x='36' y='26' width='8' height='2' offsetX='2' offsetY='13' /> + <image frame='345' x='70' y='28' width='2' height='8' offsetX='3' offsetY='8' /> + <image frame='374' x='49' y='26' width='8' height='2' offsetX='4' offsetY='12' /> + <image frame='380' x='30' y='71' width='8' height='2' offsetX='6' offsetY='12' /> + <image frame='381' x='63' y='140' width='6' height='2' offsetX='8' offsetY='12' /> + <image frame='386' x='52' y='71' width='8' height='2' offsetX='6' offsetY='12' /> + <image frame='391' x='58' y='98' width='8' height='2' offsetX='2' offsetY='13' /> + <image frame='403' x='16' y='131' width='2' height='8' offsetX='3' offsetY='8' /> + <image frame='432' x='25' y='143' width='8' height='2' offsetX='4' offsetY='12' /> + <image frame='449' x='15' y='13' width='10' height='2' offsetX='4' offsetY='4' /> + <image frame='450' x='16' y='73' width='15' height='5' offsetX='1' offsetY='4' /> + <image frame='451' x='71' y='49' width='1' height='2' offsetX='9' offsetY='8' /> + <image frame='452' x='44' y='26' width='3' height='2' offsetX='7' offsetY='9' /> + <image frame='453' x='67' y='130' width='3' height='3' offsetX='6' offsetY='9' /> + <image frame='454' x='40' y='71' width='1' height='2' offsetX='6' offsetY='10' /> + <image frame='455' x='41' y='72' width='1' height='1' offsetX='6' offsetY='12' /> + <image frame='456' x='60' y='71' width='1' height='1' offsetX='7' offsetY='13' /> + <image frame='457' x='36' y='111' width='7' height='7' offsetX='8' offsetY='7' /> + <image frame='467' x='0' y='142' width='6' height='3' offsetX='9' offsetY='11' /> + <image frame='477' x='18' y='93' width='11' height='7' offsetX='1' offsetY='6' /> + <image frame='489' x='18' y='100' width='7' height='9' offsetX='5' offsetY='7' /> + <image frame='518' x='26' y='53' width='12' height='9' offsetX='3' offsetY='3' /> + <image frame='519' x='38' y='53' width='12' height='9' offsetX='0' offsetY='3' /> + <image frame='520' x='26' y='79' width='12' height='7' offsetX='4' offsetY='5' /> + <image frame='521' x='38' y='79' width='12' height='7' offsetX='4' offsetY='5' /> + <image frame='523' x='50' y='79' width='12' height='7' offsetX='4' offsetY='5' /> + <image frame='524' x='31' y='73' width='12' height='6' offsetX='4' offsetY='5' /> + <image frame='535' x='51' y='111' width='8' height='6' offsetX='2' offsetY='6' /> + <image frame='547' x='36' y='118' width='6' height='8' offsetX='6' offsetY='8' /> + <image frame='593' x='43' y='73' width='11' height='6' offsetX='0' offsetY='6' /> + <image frame='605' x='18' y='127' width='6' height='10' offsetX='6' offsetY='6' /> + <image frame='640' x='25' y='138' width='10' height='5' offsetX='5' offsetY='6' /> + <image frame='651' x='54' y='73' width='11' height='6' offsetX='1' offsetY='6' /> + <image frame='663' x='25' y='111' width='6' height='9' offsetX='6' offsetY='7' /> + <image frame='692' x='58' y='93' width='12' height='5' offsetX='3' offsetY='6' /> + <image frame='698' x='36' y='106' width='10' height='5' offsetX='5' offsetY='6' /> + <image frame='708' x='46' y='106' width='10' height='5' offsetX='5' offsetY='6' /> + <image frame='709' x='25' y='120' width='9' height='6' offsetX='2' offsetY='6' /> + <image frame='721' x='36' y='126' width='6' height='8' offsetX='6' offsetY='8' /> + <image frame='756' x='25' y='126' width='9' height='6' offsetX='6' offsetY='5' /> + <image frame='767' x='8' y='86' width='12' height='7' offsetX='0' offsetY='5' /> + <image frame='779' x='36' y='134' width='6' height='8' offsetX='7' offsetY='8' /> + <image frame='808' x='20' y='86' width='12' height='7' offsetX='3' offsetY='5' /> + <image frame='814' x='8' y='139' width='10' height='6' offsetX='5' offsetY='6' /> + <image frame='825' x='40' y='93' width='9' height='7' offsetX='2' offsetY='5' /> + <image frame='837' x='18' y='137' width='7' height='8' offsetX='6' offsetY='8' /> + <image frame='872' x='59' y='111' width='8' height='6' offsetX='6' offsetY='5' /> + <image frame='883' x='52' y='62' width='11' height='9' offsetX='1' offsetY='5' /> + <image frame='895' x='0' y='107' width='8' height='9' offsetX='4' offsetY='7' /> + <image frame='928' x='8' y='93' width='10' height='8' offsetX='5' offsetY='5' /> + <image frame='930' x='62' y='79' width='10' height='7' offsetX='5' offsetY='6' /> + <image frame='941' x='55' y='100' width='11' height='5' offsetX='2' offsetY='7' /> + <image frame='953' x='8' y='131' width='8' height='8' offsetX='3' offsetY='8' /> + <image frame='984' x='56' y='106' width='10' height='5' offsetX='6' offsetY='6' /> + <image frame='985' x='0' y='73' width='16' height='6' offsetX='0' offsetY='6' /> + <image frame='986' x='25' y='100' width='10' height='6' offsetX='6' offsetY='6' /> + <image frame='987' x='10' y='39' width='15' height='8' offsetX='0' offsetY='6' /> + <image frame='988' x='8' y='109' width='9' height='8' offsetX='6' offsetY='6' /> + <image frame='999' x='15' y='0' width='12' height='13' offsetX='0' offsetY='0' /> + <image frame='1011' x='61' y='39' width='11' height='10' offsetX='5' offsetY='6' /> + <image frame='1040' x='27' y='0' width='12' height='13' offsetX='3' offsetY='0' /> + <image frame='1041' x='39' y='0' width='12' height='13' offsetX='0' offsetY='0' /> + <image frame='1047' x='51' y='0' width='12' height='13' offsetX='3' offsetY='0' /> + <image frame='1048' x='0' y='15' width='12' height='13' offsetX='3' offsetY='0' /> + <image frame='1049' x='12' y='15' width='12' height='13' offsetX='3' offsetY='0' /> + <image frame='1050' x='24' y='15' width='12' height='13' offsetX='4' offsetY='0' /> + <image frame='1057' x='35' y='100' width='10' height='6' offsetX='0' offsetY='7' /> + <image frame='1069' x='18' y='109' width='7' height='9' offsetX='4' offsetY='7' /> + <image frame='1098' x='25' y='106' width='11' height='5' offsetX='2' offsetY='6' /> + <image frame='1100' x='25' y='132' width='9' height='6' offsetX='5' offsetY='6' /> + <image frame='1101' x='49' y='93' width='9' height='7' offsetX='5' offsetY='6' /> + <image frame='1104' x='8' y='117' width='10' height='7' offsetX='4' offsetY='6' /> + <image frame='1108' x='45' y='100' width='10' height='6' offsetX='4' offsetY='6' /> + <image frame='1115' x='37' y='28' width='11' height='11' offsetX='0' offsetY='1' /> + <image frame='1127' x='62' y='15' width='10' height='12' offsetX='6' offsetY='4' /> + <image frame='1156' x='13' y='28' width='12' height='11' offsetX='2' offsetY='0' /> + <image frame='1158' x='48' y='28' width='11' height='11' offsetX='4' offsetY='0' /> + <image frame='1159' x='36' y='15' width='13' height='11' offsetX='2' offsetY='0' /> + <image frame='1173' x='25' y='28' width='12' height='11' offsetX='0' offsetY='1' /> + <image frame='1179' x='0' y='62' width='10' height='11' offsetX='1' offsetY='1' /> + <image frame='1183' x='59' y='28' width='11' height='11' offsetX='1' offsetY='1' /> + <image frame='1185' x='62' y='53' width='10' height='9' offsetX='6' offsetY='7' /> + <image frame='1214' x='10' y='62' width='10' height='11' offsetX='4' offsetY='0' /> + <image frame='1217' x='20' y='62' width='10' height='11' offsetX='5' offsetY='0' /> + <image frame='1231' x='0' y='53' width='13' height='9' offsetX='0' offsetY='3' /> + <image frame='1237' x='50' y='53' width='12' height='9' offsetX='0' offsetY='3' /> + <image frame='1241' x='30' y='62' width='12' height='9' offsetX='0' offsetY='3' /> + <image frame='1243' x='0' y='116' width='7' height='10' offsetX='8' offsetY='6' /> + <image frame='1272' x='13' y='53' width='13' height='9' offsetX='2' offsetY='2' /> + <image frame='1275' x='25' y='39' width='12' height='10' offsetX='4' offsetY='2' /> + <image frame='1289' x='8' y='124' width='10' height='7' offsetX='0' offsetY='7' /> + <image frame='1295' x='32' y='86' width='12' height='7' offsetX='0' offsetY='7' /> + <image frame='1298' x='29' y='93' width='11' height='7' offsetX='0' offsetY='7' /> + <image frame='1300' x='44' y='86' width='12' height='7' offsetX='0' offsetY='7' /> + <image frame='1301' x='18' y='118' width='7' height='9' offsetX='4' offsetY='7' /> + <image frame='1330' x='56' y='86' width='12' height='7' offsetX='1' offsetY='6' /> + <image frame='1333' x='0' y='79' width='13' height='7' offsetX='3' offsetY='6' /> + <image frame='1334' x='13' y='79' width='13' height='7' offsetX='3' offsetY='6' /> + <image frame='1337' x='10' y='47' width='13' height='6' offsetX='2' offsetY='6' /> + <image frame='1347' x='49' y='15' width='13' height='11' offsetX='0' offsetY='1' /> + <image frame='1353' x='37' y='39' width='12' height='10' offsetX='0' offsetY='2' /> + <image frame='1359' x='42' y='62' width='10' height='10' offsetX='6' offsetY='6' /> + <image frame='1364' x='0' y='97' width='8' height='10' offsetX='8' offsetY='6' /> + <image frame='1384' x='63' y='62' width='9' height='10' offsetX='6' offsetY='6' /> + <image frame='1388' x='0' y='28' width='13' height='11' offsetX='1' offsetY='0' /> + <image frame='1390' x='49' y='39' width='12' height='10' offsetX='4' offsetY='1' /> + <image frame='1405' x='68' y='52' width='3' height='1' offsetX='3' offsetY='12' /> + <image frame='1417' x='48' y='49' width='1' height='3' offsetX='5' offsetY='9' /> + <image frame='1463' x='52' y='117' width='9' height='5' offsetX='0' offsetY='11' /> + <image frame='1469' x='43' y='127' width='8' height='5' offsetX='1' offsetY='11' /> + <image frame='1471' x='43' y='132' width='8' height='5' offsetX='1' offsetY='11' /> + <image frame='1472' x='43' y='137' width='8' height='5' offsetX='1' offsetY='11' /> + <image frame='1475' x='31' y='111' width='5' height='8' offsetX='2' offsetY='7' /> + <image frame='1479' x='52' y='122' width='5' height='8' offsetX='2' offsetY='7' /> + <image frame='1504' x='61' y='117' width='9' height='5' offsetX='3' offsetY='10' /> + <image frame='1505' x='43' y='122' width='9' height='5' offsetX='0' offsetY='10' /> + <image frame='1506' x='57' y='122' width='8' height='5' offsetX='5' offsetY='10' /> + <image frame='1507' x='52' y='130' width='8' height='5' offsetX='5' offsetY='10' /> + <image frame='1510' x='52' y='135' width='8' height='5' offsetX='5' offsetY='10' /> + <image frame='1511' x='52' y='140' width='8' height='5' offsetX='5' offsetY='10' /> + <image frame='1521' x='57' y='127' width='7' height='2' offsetX='1' offsetY='12' /> + <image frame='1533' x='70' y='122' width='2' height='7' offsetX='4' offsetY='7' /> + <image frame='1562' x='63' y='134' width='7' height='2' offsetX='4' offsetY='11' /> + <image frame='1579' x='61' y='49' width='7' height='4' offsetX='2' offsetY='11' /> + <image frame='1585' x='65' y='73' width='7' height='4' offsetX='2' offsetY='11' /> + <image frame='1591' x='68' y='86' width='4' height='7' offsetX='3' offsetY='8' /> + <image frame='1620' x='60' y='130' width='7' height='4' offsetX='5' offsetY='10' /> + <image frame='1' equals='0' offsetX='8' offsetY='13' /> + <image frame='2' equals='0' offsetX='8' offsetY='13' /> + <image frame='3' equals='0' offsetX='8' offsetY='13' /> + <image frame='4' equals='0' offsetX='9' offsetY='13' /> + <image frame='6' equals='5' offsetX='4' offsetY='13' /> + <image frame='7' equals='5' offsetX='4' offsetY='13' /> + <image frame='8' equals='5' offsetX='4' offsetY='13' /> + <image frame='9' equals='5' offsetX='5' offsetY='13' /> + <image frame='11' equals='10' offsetX='5' offsetY='10' /> + <image frame='12' equals='10' offsetX='5' offsetY='10' /> + <image frame='13' equals='10' offsetX='5' offsetY='10' /> + <image frame='14' equals='10' offsetX='6' offsetY='10' /> + <image frame='15' equals='10' offsetX='6' offsetY='10' /> + <image frame='16' equals='10' offsetX='5' offsetY='10' /> + <image frame='17' equals='10' offsetX='5' offsetY='10' /> + <image frame='18' equals='10' offsetX='5' offsetY='10' /> + <image frame='19' equals='10' offsetX='6' offsetY='10' /> + <image frame='21' equals='20' offsetX='5' offsetY='7' /> + <image frame='22' equals='20' offsetX='5' offsetY='7' /> + <image frame='23' equals='20' offsetX='5' offsetY='7' /> + <image frame='24' equals='20' offsetX='6' offsetY='7' /> + <image frame='25' equals='20' offsetX='6' offsetY='7' /> + <image frame='26' equals='20' offsetX='5' offsetY='7' /> + <image frame='27' equals='20' offsetX='5' offsetY='7' /> + <image frame='28' equals='20' offsetX='5' offsetY='7' /> + <image frame='29' equals='20' offsetX='6' offsetY='7' /> + <image frame='33' equals='32' offsetX='6' offsetY='15' /> + <image frame='38' equals='37' offsetX='6' offsetY='15' /> + <image frame='42' equals='40' offsetX='4' offsetY='12' /> + <image frame='43' equals='40' offsetX='3' offsetY='12' /> + <image frame='47' equals='20' offsetX='2' offsetY='7' /> + <image frame='48' equals='20' offsetX='6' offsetY='7' /> + <image frame='49' equals='46' offsetX='5' offsetY='7' /> + <image frame='50' equals='20' offsetX='6' offsetY='7' /> + <image frame='51' equals='20' offsetX='6' offsetY='7' /> + <image frame='59' equals='58' offsetX='3' offsetY='11' /> + <image frame='60' equals='58' offsetX='7' offsetY='11' /> + <image frame='61' equals='58' offsetX='7' offsetY='11' /> + <image frame='62' equals='58' offsetX='7' offsetY='11' /> + <image frame='63' equals='58' offsetX='7' offsetY='11' /> + <image frame='68' equals='67' offsetX='1' offsetY='14' /> + <image frame='69' equals='67' offsetX='1' offsetY='14' /> + <image frame='70' equals='67' offsetX='1' offsetY='14' /> + <image frame='71' equals='67' offsetX='1' offsetY='14' /> + <image frame='72' equals='67' offsetX='1' offsetY='14' /> + <image frame='74' equals='73' offsetX='1' offsetY='13' /> + <image frame='75' equals='67' offsetX='1' offsetY='14' /> + <image frame='76' equals='67' offsetX='1' offsetY='14' /> + <image frame='77' equals='67' offsetX='1' offsetY='14' /> + <image frame='78' equals='67' offsetX='1' offsetY='14' /> + <image frame='79' equals='0' offsetX='2' offsetY='15' /> + <image frame='80' equals='0' offsetX='2' offsetY='15' /> + <image frame='81' equals='0' offsetX='2' offsetY='15' /> + <image frame='84' equals='83' offsetX='3' offsetY='7' /> + <image frame='85' equals='0' offsetX='2' offsetY='15' /> + <image frame='86' equals='0' offsetX='2' offsetY='15' /> + <image frame='87' equals='0' offsetX='2' offsetY='15' /> + <image frame='88' equals='0' offsetX='2' offsetY='15' /> + <image frame='89' equals='0' offsetX='2' offsetY='15' /> + <image frame='90' equals='0' offsetX='2' offsetY='15' /> + <image frame='91' equals='0' offsetX='2' offsetY='15' /> + <image frame='92' equals='0' offsetX='2' offsetY='15' /> + <image frame='93' equals='0' offsetX='2' offsetY='15' /> + <image frame='94' equals='0' offsetX='2' offsetY='15' /> + <image frame='95' equals='0' offsetX='2' offsetY='15' /> + <image frame='96' equals='0' offsetX='2' offsetY='15' /> + <image frame='97' equals='0' offsetX='2' offsetY='15' /> + <image frame='98' equals='0' offsetX='2' offsetY='15' /> + <image frame='99' equals='0' offsetX='2' offsetY='15' /> + <image frame='100' equals='0' offsetX='2' offsetY='15' /> + <image frame='101' equals='0' offsetX='2' offsetY='15' /> + <image frame='102' equals='0' offsetX='2' offsetY='15' /> + <image frame='103' equals='0' offsetX='2' offsetY='15' /> + <image frame='104' equals='0' offsetX='2' offsetY='15' /> + <image frame='105' equals='0' offsetX='2' offsetY='15' /> + <image frame='106' equals='0' offsetX='2' offsetY='15' /> + <image frame='107' equals='0' offsetX='2' offsetY='15' /> + <image frame='108' equals='10' offsetX='2' offsetY='11' /> + <image frame='109' equals='10' offsetX='2' offsetY='11' /> + <image frame='111' equals='110' offsetX='2' offsetY='10' /> + <image frame='112' equals='20' offsetX='2' offsetY='8' /> + <image frame='113' equals='20' offsetX='2' offsetY='8' /> + <image frame='114' equals='20' offsetX='2' offsetY='8' /> + <image frame='115' equals='20' offsetX='2' offsetY='8' /> + <image frame='116' equals='20' offsetX='2' offsetY='8' /> + <image frame='117' equals='20' offsetX='2' offsetY='8' /> + <image frame='118' equals='20' offsetX='2' offsetY='8' /> + <image frame='119' equals='20' offsetX='2' offsetY='8' /> + <image frame='120' equals='20' offsetX='2' offsetY='8' /> + <image frame='121' equals='20' offsetX='2' offsetY='8' /> + <image frame='122' equals='20' offsetX='2' offsetY='8' /> + <image frame='123' equals='20' offsetX='2' offsetY='8' /> + <image frame='125' equals='124' offsetX='2' offsetY='8' /> + <image frame='126' equals='124' offsetX='2' offsetY='8' /> + <image frame='127' equals='124' offsetX='2' offsetY='8' /> + <image frame='128' equals='124' offsetX='2' offsetY='8' /> + <image frame='129' equals='124' offsetX='2' offsetY='8' /> + <image frame='130' equals='124' offsetX='2' offsetY='8' /> + <image frame='131' equals='124' offsetX='2' offsetY='8' /> + <image frame='132' equals='124' offsetX='2' offsetY='8' /> + <image frame='133' equals='124' offsetX='2' offsetY='8' /> + <image frame='134' equals='124' offsetX='2' offsetY='8' /> + <image frame='135' equals='124' offsetX='2' offsetY='8' /> + <image frame='136' equals='124' offsetX='2' offsetY='8' /> + <image frame='137' equals='124' offsetX='2' offsetY='8' /> + <image frame='138' equals='124' offsetX='2' offsetY='8' /> + <image frame='139' equals='124' offsetX='2' offsetY='8' /> + <image frame='140' equals='124' offsetX='2' offsetY='8' /> + <image frame='141' equals='124' offsetX='2' offsetY='8' /> + <image frame='142' equals='124' offsetX='2' offsetY='8' /> + <image frame='143' equals='124' offsetX='2' offsetY='8' /> + <image frame='144' equals='124' offsetX='2' offsetY='8' /> + <image frame='145' equals='124' offsetX='2' offsetY='8' /> + <image frame='146' equals='124' offsetX='2' offsetY='8' /> + <image frame='147' equals='124' offsetX='2' offsetY='8' /> + <image frame='148' equals='124' offsetX='2' offsetY='8' /> + <image frame='149' equals='124' offsetX='2' offsetY='8' /> + <image frame='150' equals='124' offsetX='2' offsetY='8' /> + <image frame='151' equals='124' offsetX='2' offsetY='8' /> + <image frame='152' equals='124' offsetX='2' offsetY='8' /> + <image frame='154' equals='153' offsetX='1' offsetY='15' /> + <image frame='155' equals='153' offsetX='1' offsetY='15' /> + <image frame='156' equals='153' offsetX='1' offsetY='15' /> + <image frame='157' equals='153' offsetX='1' offsetY='15' /> + <image frame='158' equals='153' offsetX='1' offsetY='15' /> + <image frame='159' equals='153' offsetX='1' offsetY='15' /> + <image frame='160' equals='153' offsetX='1' offsetY='15' /> + <image frame='161' equals='153' offsetX='1' offsetY='15' /> + <image frame='162' equals='153' offsetX='1' offsetY='15' /> + <image frame='163' equals='153' offsetX='1' offsetY='15' /> + <image frame='164' equals='153' offsetX='1' offsetY='15' /> + <image frame='166' equals='165' offsetX='1' offsetY='10' /> + <image frame='167' equals='165' offsetX='1' offsetY='10' /> + <image frame='168' equals='165' offsetX='1' offsetY='8' /> + <image frame='170' equals='169' offsetX='2' offsetY='7' /> + <image frame='171' equals='165' offsetX='1' offsetY='10' /> + <image frame='172' equals='165' offsetX='1' offsetY='10' /> + <image frame='173' equals='165' offsetX='1' offsetY='10' /> + <image frame='174' equals='165' offsetX='1' offsetY='10' /> + <image frame='175' equals='165' offsetX='1' offsetY='10' /> + <image frame='176' equals='165' offsetX='1' offsetY='10' /> + <image frame='177' equals='165' offsetX='1' offsetY='11' /> + <image frame='178' equals='165' offsetX='1' offsetY='11' /> + <image frame='179' equals='165' offsetX='1' offsetY='11' /> + <image frame='180' equals='165' offsetX='1' offsetY='11' /> + <image frame='181' equals='165' offsetX='1' offsetY='11' /> + <image frame='182' equals='165' offsetX='1' offsetY='10' /> + <image frame='183' equals='165' offsetX='1' offsetY='11' /> + <image frame='184' equals='165' offsetX='1' offsetY='11' /> + <image frame='185' equals='165' offsetX='1' offsetY='11' /> + <image frame='186' equals='165' offsetX='1' offsetY='11' /> + <image frame='187' equals='165' offsetX='1' offsetY='11' /> + <image frame='188' equals='165' offsetX='1' offsetY='11' /> + <image frame='189' equals='165' offsetX='1' offsetY='11' /> + <image frame='190' equals='165' offsetX='1' offsetY='11' /> + <image frame='191' equals='165' offsetX='1' offsetY='11' /> + <image frame='192' equals='165' offsetX='1' offsetY='11' /> + <image frame='193' equals='165' offsetX='1' offsetY='11' /> + <image frame='195' equals='194' offsetX='4' offsetY='12' /> + <image frame='196' equals='194' offsetX='4' offsetY='12' /> + <image frame='197' equals='194' offsetX='4' offsetY='12' /> + <image frame='198' equals='194' offsetX='4' offsetY='12' /> + <image frame='199' equals='194' offsetX='4' offsetY='12' /> + <image frame='202' equals='194' offsetX='4' offsetY='12' /> + <image frame='203' equals='194' offsetX='4' offsetY='12' /> + <image frame='204' equals='194' offsetX='4' offsetY='12' /> + <image frame='205' equals='194' offsetX='4' offsetY='12' /> + <image frame='207' equals='206' offsetX='4' offsetY='10' /> + <image frame='211' equals='210' offsetX='5' offsetY='10' /> + <image frame='212' equals='206' offsetX='4' offsetY='10' /> + <image frame='213' equals='206' offsetX='4' offsetY='10' /> + <image frame='214' equals='206' offsetX='4' offsetY='10' /> + <image frame='215' equals='206' offsetX='4' offsetY='10' /> + <image frame='216' equals='206' offsetX='4' offsetY='10' /> + <image frame='217' equals='206' offsetX='4' offsetY='10' /> + <image frame='219' equals='218' offsetX='5' offsetY='10' /> + <image frame='220' equals='218' offsetX='5' offsetY='10' /> + <image frame='221' equals='218' offsetX='5' offsetY='10' /> + <image frame='222' equals='218' offsetX='5' offsetY='10' /> + <image frame='223' equals='206' offsetX='4' offsetY='10' /> + <image frame='224' equals='218' offsetX='5' offsetY='10' /> + <image frame='225' equals='218' offsetX='5' offsetY='10' /> + <image frame='226' equals='218' offsetX='5' offsetY='10' /> + <image frame='227' equals='218' offsetX='5' offsetY='10' /> + <image frame='228' equals='218' offsetX='5' offsetY='10' /> + <image frame='229' equals='218' offsetX='5' offsetY='10' /> + <image frame='230' equals='218' offsetX='5' offsetY='10' /> + <image frame='231' equals='218' offsetX='5' offsetY='10' /> + <image frame='232' equals='218' offsetX='5' offsetY='10' /> + <image frame='233' equals='218' offsetX='5' offsetY='10' /> + <image frame='234' equals='218' offsetX='5' offsetY='10' /> + <image frame='239' equals='238' offsetX='2' offsetY='3' /> + <image frame='240' equals='235' offsetX='7' offsetY='7' /> + <image frame='241' equals='236' offsetX='1' offsetY='0' /> + <image frame='242' equals='236' offsetX='1' offsetY='0' /> + <image frame='243' equals='237' offsetX='2' offsetY='0' /> + <image frame='244' equals='238' offsetX='2' offsetY='1' /> + <image frame='245' equals='238' offsetX='2' offsetY='3' /> + <image frame='252' equals='201' offsetX='5' offsetY='0' /> + <image frame='256' equals='10' offsetX='6' offsetY='10' /> + <image frame='257' equals='20' offsetX='6' offsetY='7' /> + <image frame='258' equals='57' offsetX='7' offsetY='15' /> + <image frame='259' equals='0' offsetX='10' offsetY='13' /> + <image frame='260' equals='37' offsetX='11' offsetY='15' /> + <image frame='262' equals='261' offsetX='5' offsetY='13' /> + <image frame='265' equals='264' offsetX='4' offsetY='12' /> + <image frame='272' equals='271' offsetX='14' offsetY='15' /> + <image frame='274' equals='273' offsetX='12' offsetY='14' /> + <image frame='276' equals='275' offsetX='2' offsetY='15' /> + <image frame='277' equals='275' offsetX='2' offsetY='15' /> + <image frame='278' equals='275' offsetX='2' offsetY='15' /> + <image frame='279' equals='275' offsetX='2' offsetY='15' /> + <image frame='280' equals='275' offsetX='2' offsetY='15' /> + <image frame='281' equals='275' offsetX='2' offsetY='15' /> + <image frame='282' equals='275' offsetX='2' offsetY='15' /> + <image frame='283' equals='275' offsetX='2' offsetY='15' /> + <image frame='284' equals='275' offsetX='2' offsetY='15' /> + <image frame='285' equals='275' offsetX='2' offsetY='15' /> + <image frame='286' equals='275' offsetX='2' offsetY='15' /> + <image frame='288' equals='287' offsetX='2' offsetY='8' /> + <image frame='289' equals='287' offsetX='2' offsetY='8' /> + <image frame='290' equals='287' offsetX='2' offsetY='8' /> + <image frame='291' equals='287' offsetX='2' offsetY='8' /> + <image frame='292' equals='287' offsetX='2' offsetY='8' /> + <image frame='293' equals='287' offsetX='2' offsetY='8' /> + <image frame='294' equals='287' offsetX='2' offsetY='8' /> + <image frame='295' equals='287' offsetX='2' offsetY='8' /> + <image frame='296' equals='287' offsetX='2' offsetY='8' /> + <image frame='297' equals='287' offsetX='2' offsetY='8' /> + <image frame='298' equals='287' offsetX='2' offsetY='8' /> + <image frame='299' equals='287' offsetX='2' offsetY='8' /> + <image frame='300' equals='287' offsetX='2' offsetY='8' /> + <image frame='301' equals='287' offsetX='2' offsetY='8' /> + <image frame='302' equals='287' offsetX='2' offsetY='8' /> + <image frame='303' equals='287' offsetX='2' offsetY='8' /> + <image frame='304' equals='287' offsetX='2' offsetY='8' /> + <image frame='305' equals='287' offsetX='2' offsetY='8' /> + <image frame='306' equals='287' offsetX='2' offsetY='8' /> + <image frame='307' equals='287' offsetX='2' offsetY='8' /> + <image frame='308' equals='287' offsetX='2' offsetY='8' /> + <image frame='309' equals='287' offsetX='2' offsetY='8' /> + <image frame='310' equals='287' offsetX='2' offsetY='8' /> + <image frame='311' equals='287' offsetX='2' offsetY='8' /> + <image frame='312' equals='287' offsetX='2' offsetY='8' /> + <image frame='313' equals='287' offsetX='2' offsetY='8' /> + <image frame='314' equals='287' offsetX='2' offsetY='8' /> + <image frame='315' equals='287' offsetX='2' offsetY='8' /> + <image frame='316' equals='275' offsetX='4' offsetY='14' /> + <image frame='317' equals='275' offsetX='2' offsetY='14' /> + <image frame='318' equals='275' offsetX='6' offsetY='14' /> + <image frame='319' equals='275' offsetX='5' offsetY='14' /> + <image frame='320' equals='275' offsetX='6' offsetY='14' /> + <image frame='321' equals='275' offsetX='6' offsetY='14' /> + <image frame='323' equals='322' offsetX='6' offsetY='14' /> + <image frame='324' equals='322' offsetX='5' offsetY='14' /> + <image frame='325' equals='322' offsetX='5' offsetY='14' /> + <image frame='326' equals='322' offsetX='5' offsetY='14' /> + <image frame='327' equals='322' offsetX='6' offsetY='14' /> + <image frame='328' equals='322' offsetX='6' offsetY='14' /> + <image frame='329' equals='322' offsetX='5' offsetY='14' /> + <image frame='330' equals='322' offsetX='5' offsetY='14' /> + <image frame='331' equals='322' offsetX='5' offsetY='14' /> + <image frame='332' equals='322' offsetX='6' offsetY='14' /> + <image frame='334' equals='333' offsetX='2' offsetY='13' /> + <image frame='335' equals='333' offsetX='2' offsetY='13' /> + <image frame='336' equals='333' offsetX='2' offsetY='13' /> + <image frame='337' equals='333' offsetX='2' offsetY='13' /> + <image frame='338' equals='333' offsetX='2' offsetY='13' /> + <image frame='339' equals='333' offsetX='2' offsetY='13' /> + <image frame='340' equals='333' offsetX='2' offsetY='13' /> + <image frame='341' equals='333' offsetX='2' offsetY='13' /> + <image frame='342' equals='333' offsetX='2' offsetY='13' /> + <image frame='343' equals='333' offsetX='2' offsetY='13' /> + <image frame='344' equals='333' offsetX='2' offsetY='13' /> + <image frame='346' equals='345' offsetX='3' offsetY='8' /> + <image frame='347' equals='345' offsetX='3' offsetY='8' /> + <image frame='348' equals='345' offsetX='3' offsetY='8' /> + <image frame='349' equals='345' offsetX='3' offsetY='8' /> + <image frame='350' equals='345' offsetX='3' offsetY='8' /> + <image frame='351' equals='345' offsetX='3' offsetY='8' /> + <image frame='352' equals='345' offsetX='3' offsetY='8' /> + <image frame='353' equals='345' offsetX='3' offsetY='8' /> + <image frame='354' equals='345' offsetX='3' offsetY='8' /> + <image frame='355' equals='345' offsetX='3' offsetY='8' /> + <image frame='356' equals='345' offsetX='3' offsetY='8' /> + <image frame='357' equals='345' offsetX='3' offsetY='8' /> + <image frame='358' equals='345' offsetX='3' offsetY='8' /> + <image frame='359' equals='345' offsetX='3' offsetY='8' /> + <image frame='360' equals='345' offsetX='3' offsetY='8' /> + <image frame='361' equals='345' offsetX='3' offsetY='8' /> + <image frame='362' equals='345' offsetX='3' offsetY='8' /> + <image frame='363' equals='345' offsetX='3' offsetY='8' /> + <image frame='364' equals='345' offsetX='3' offsetY='8' /> + <image frame='365' equals='345' offsetX='3' offsetY='8' /> + <image frame='366' equals='345' offsetX='3' offsetY='8' /> + <image frame='367' equals='345' offsetX='3' offsetY='8' /> + <image frame='368' equals='345' offsetX='3' offsetY='8' /> + <image frame='369' equals='345' offsetX='3' offsetY='8' /> + <image frame='370' equals='345' offsetX='3' offsetY='8' /> + <image frame='371' equals='345' offsetX='3' offsetY='8' /> + <image frame='372' equals='345' offsetX='3' offsetY='8' /> + <image frame='373' equals='345' offsetX='3' offsetY='8' /> + <image frame='375' equals='374' offsetX='2' offsetY='12' /> + <image frame='376' equals='374' offsetX='6' offsetY='12' /> + <image frame='377' equals='374' offsetX='5' offsetY='12' /> + <image frame='378' equals='374' offsetX='6' offsetY='12' /> + <image frame='379' equals='374' offsetX='6' offsetY='12' /> + <image frame='382' equals='381' offsetX='7' offsetY='12' /> + <image frame='383' equals='381' offsetX='7' offsetY='12' /> + <image frame='384' equals='381' offsetX='7' offsetY='12' /> + <image frame='385' equals='381' offsetX='8' offsetY='12' /> + <image frame='387' equals='386' offsetX='5' offsetY='12' /> + <image frame='388' equals='386' offsetX='5' offsetY='12' /> + <image frame='389' equals='386' offsetX='5' offsetY='12' /> + <image frame='390' equals='386' offsetX='6' offsetY='12' /> + <image frame='392' equals='391' offsetX='2' offsetY='13' /> + <image frame='393' equals='391' offsetX='2' offsetY='13' /> + <image frame='394' equals='391' offsetX='2' offsetY='13' /> + <image frame='395' equals='391' offsetX='2' offsetY='13' /> + <image frame='396' equals='391' offsetX='2' offsetY='13' /> + <image frame='397' equals='391' offsetX='2' offsetY='13' /> + <image frame='398' equals='391' offsetX='2' offsetY='13' /> + <image frame='399' equals='391' offsetX='2' offsetY='13' /> + <image frame='400' equals='391' offsetX='2' offsetY='13' /> + <image frame='401' equals='391' offsetX='2' offsetY='13' /> + <image frame='402' equals='391' offsetX='2' offsetY='13' /> + <image frame='404' equals='403' offsetX='3' offsetY='8' /> + <image frame='405' equals='403' offsetX='3' offsetY='8' /> + <image frame='406' equals='403' offsetX='3' offsetY='8' /> + <image frame='407' equals='403' offsetX='3' offsetY='8' /> + <image frame='408' equals='403' offsetX='3' offsetY='8' /> + <image frame='409' equals='403' offsetX='3' offsetY='8' /> + <image frame='410' equals='403' offsetX='3' offsetY='8' /> + <image frame='411' equals='403' offsetX='3' offsetY='8' /> + <image frame='412' equals='403' offsetX='3' offsetY='8' /> + <image frame='413' equals='403' offsetX='3' offsetY='8' /> + <image frame='414' equals='403' offsetX='3' offsetY='8' /> + <image frame='415' equals='403' offsetX='3' offsetY='8' /> + <image frame='416' equals='403' offsetX='3' offsetY='8' /> + <image frame='417' equals='403' offsetX='3' offsetY='8' /> + <image frame='418' equals='403' offsetX='3' offsetY='8' /> + <image frame='419' equals='403' offsetX='3' offsetY='8' /> + <image frame='420' equals='403' offsetX='3' offsetY='8' /> + <image frame='421' equals='403' offsetX='3' offsetY='8' /> + <image frame='422' equals='403' offsetX='3' offsetY='8' /> + <image frame='423' equals='403' offsetX='3' offsetY='8' /> + <image frame='424' equals='403' offsetX='3' offsetY='8' /> + <image frame='425' equals='403' offsetX='3' offsetY='8' /> + <image frame='426' equals='403' offsetX='3' offsetY='8' /> + <image frame='427' equals='403' offsetX='3' offsetY='8' /> + <image frame='428' equals='403' offsetX='3' offsetY='8' /> + <image frame='429' equals='403' offsetX='3' offsetY='8' /> + <image frame='430' equals='403' offsetX='3' offsetY='8' /> + <image frame='431' equals='403' offsetX='3' offsetY='8' /> + <image frame='433' equals='432' offsetX='2' offsetY='12' /> + <image frame='434' equals='432' offsetX='6' offsetY='12' /> + <image frame='435' equals='432' offsetX='5' offsetY='12' /> + <image frame='436' equals='432' offsetX='6' offsetY='12' /> + <image frame='437' equals='432' offsetX='6' offsetY='12' /> + <image frame='438' equals='432' offsetX='6' offsetY='12' /> + <image frame='439' equals='432' offsetX='6' offsetY='12' /> + <image frame='440' equals='432' offsetX='5' offsetY='12' /> + <image frame='441' equals='432' offsetX='5' offsetY='12' /> + <image frame='442' equals='432' offsetX='5' offsetY='12' /> + <image frame='443' equals='432' offsetX='6' offsetY='12' /> + <image frame='444' equals='391' offsetX='6' offsetY='12' /> + <image frame='445' equals='391' offsetX='5' offsetY='12' /> + <image frame='446' equals='391' offsetX='5' offsetY='12' /> + <image frame='447' equals='391' offsetX='5' offsetY='12' /> + <image frame='448' equals='391' offsetX='6' offsetY='12' /> + <image frame='458' equals='457' offsetX='7' offsetY='7' /> + <image frame='459' equals='457' offsetX='7' offsetY='7' /> + <image frame='460' equals='457' offsetX='7' offsetY='7' /> + <image frame='461' equals='457' offsetX='8' offsetY='7' /> + <image frame='462' equals='457' offsetX='9' offsetY='7' /> + <image frame='463' equals='457' offsetX='8' offsetY='7' /> + <image frame='464' equals='457' offsetX='8' offsetY='7' /> + <image frame='465' equals='457' offsetX='8' offsetY='7' /> + <image frame='466' equals='457' offsetX='9' offsetY='7' /> + <image frame='468' equals='467' offsetX='8' offsetY='11' /> + <image frame='469' equals='467' offsetX='8' offsetY='11' /> + <image frame='470' equals='467' offsetX='8' offsetY='11' /> + <image frame='471' equals='467' offsetX='9' offsetY='11' /> + <image frame='472' equals='467' offsetX='10' offsetY='11' /> + <image frame='473' equals='467' offsetX='9' offsetY='11' /> + <image frame='474' equals='467' offsetX='9' offsetY='11' /> + <image frame='475' equals='467' offsetX='9' offsetY='11' /> + <image frame='476' equals='467' offsetX='10' offsetY='11' /> + <image frame='478' equals='477' offsetX='1' offsetY='6' /> + <image frame='479' equals='477' offsetX='1' offsetY='6' /> + <image frame='480' equals='477' offsetX='1' offsetY='6' /> + <image frame='481' equals='477' offsetX='1' offsetY='6' /> + <image frame='482' equals='477' offsetX='1' offsetY='6' /> + <image frame='483' equals='477' offsetX='1' offsetY='6' /> + <image frame='484' equals='477' offsetX='1' offsetY='6' /> + <image frame='485' equals='477' offsetX='1' offsetY='6' /> + <image frame='486' equals='477' offsetX='1' offsetY='6' /> + <image frame='487' equals='477' offsetX='1' offsetY='6' /> + <image frame='488' equals='477' offsetX='1' offsetY='6' /> + <image frame='490' equals='489' offsetX='5' offsetY='7' /> + <image frame='491' equals='489' offsetX='5' offsetY='7' /> + <image frame='492' equals='489' offsetX='5' offsetY='7' /> + <image frame='493' equals='489' offsetX='5' offsetY='7' /> + <image frame='494' equals='489' offsetX='5' offsetY='7' /> + <image frame='495' equals='489' offsetX='5' offsetY='7' /> + <image frame='496' equals='489' offsetX='5' offsetY='7' /> + <image frame='497' equals='489' offsetX='5' offsetY='7' /> + <image frame='498' equals='489' offsetX='5' offsetY='7' /> + <image frame='499' equals='489' offsetX='5' offsetY='7' /> + <image frame='500' equals='489' offsetX='5' offsetY='7' /> + <image frame='501' equals='489' offsetX='5' offsetY='7' /> + <image frame='502' equals='489' offsetX='5' offsetY='7' /> + <image frame='503' equals='489' offsetX='5' offsetY='7' /> + <image frame='504' equals='489' offsetX='5' offsetY='7' /> + <image frame='505' equals='489' offsetX='5' offsetY='7' /> + <image frame='506' equals='489' offsetX='5' offsetY='7' /> + <image frame='507' equals='489' offsetX='5' offsetY='7' /> + <image frame='508' equals='489' offsetX='5' offsetY='7' /> + <image frame='509' equals='489' offsetX='5' offsetY='7' /> + <image frame='510' equals='489' offsetX='5' offsetY='7' /> + <image frame='511' equals='489' offsetX='5' offsetY='7' /> + <image frame='512' equals='489' offsetX='5' offsetY='7' /> + <image frame='513' equals='489' offsetX='5' offsetY='7' /> + <image frame='514' equals='489' offsetX='5' offsetY='7' /> + <image frame='515' equals='489' offsetX='5' offsetY='7' /> + <image frame='516' equals='489' offsetX='5' offsetY='7' /> + <image frame='517' equals='489' offsetX='5' offsetY='7' /> + <image frame='522' equals='521' offsetX='4' offsetY='5' /> + <image frame='525' equals='524' offsetX='3' offsetY='5' /> + <image frame='526' equals='524' offsetX='3' offsetY='5' /> + <image frame='527' equals='524' offsetX='3' offsetY='5' /> + <image frame='528' equals='524' offsetX='4' offsetY='5' /> + <image frame='529' equals='524' offsetX='4' offsetY='5' /> + <image frame='530' equals='524' offsetX='3' offsetY='5' /> + <image frame='531' equals='524' offsetX='3' offsetY='5' /> + <image frame='532' equals='524' offsetX='3' offsetY='5' /> + <image frame='533' equals='524' offsetX='4' offsetY='5' /> + <image frame='534' equals='521' offsetX='4' offsetY='5' /> + <image frame='536' equals='535' offsetX='2' offsetY='6' /> + <image frame='537' equals='535' offsetX='2' offsetY='6' /> + <image frame='538' equals='535' offsetX='2' offsetY='6' /> + <image frame='539' equals='535' offsetX='2' offsetY='6' /> + <image frame='540' equals='535' offsetX='2' offsetY='6' /> + <image frame='541' equals='535' offsetX='2' offsetY='6' /> + <image frame='542' equals='535' offsetX='2' offsetY='6' /> + <image frame='543' equals='535' offsetX='2' offsetY='6' /> + <image frame='544' equals='535' offsetX='2' offsetY='6' /> + <image frame='545' equals='535' offsetX='2' offsetY='6' /> + <image frame='546' equals='535' offsetX='2' offsetY='6' /> + <image frame='548' equals='547' offsetX='6' offsetY='8' /> + <image frame='549' equals='547' offsetX='6' offsetY='8' /> + <image frame='550' equals='547' offsetX='6' offsetY='8' /> + <image frame='551' equals='547' offsetX='6' offsetY='8' /> + <image frame='552' equals='547' offsetX='6' offsetY='8' /> + <image frame='553' equals='547' offsetX='6' offsetY='8' /> + <image frame='554' equals='547' offsetX='6' offsetY='8' /> + <image frame='555' equals='547' offsetX='6' offsetY='8' /> + <image frame='556' equals='547' offsetX='6' offsetY='8' /> + <image frame='557' equals='547' offsetX='6' offsetY='8' /> + <image frame='558' equals='547' offsetX='6' offsetY='8' /> + <image frame='559' equals='547' offsetX='6' offsetY='8' /> + <image frame='560' equals='547' offsetX='6' offsetY='8' /> + <image frame='561' equals='547' offsetX='6' offsetY='8' /> + <image frame='562' equals='547' offsetX='6' offsetY='8' /> + <image frame='563' equals='547' offsetX='6' offsetY='8' /> + <image frame='564' equals='547' offsetX='6' offsetY='8' /> + <image frame='565' equals='547' offsetX='6' offsetY='8' /> + <image frame='566' equals='547' offsetX='6' offsetY='8' /> + <image frame='567' equals='547' offsetX='6' offsetY='8' /> + <image frame='568' equals='547' offsetX='6' offsetY='8' /> + <image frame='569' equals='547' offsetX='6' offsetY='8' /> + <image frame='570' equals='547' offsetX='6' offsetY='8' /> + <image frame='571' equals='547' offsetX='6' offsetY='8' /> + <image frame='572' equals='547' offsetX='6' offsetY='8' /> + <image frame='573' equals='547' offsetX='6' offsetY='8' /> + <image frame='574' equals='547' offsetX='6' offsetY='8' /> + <image frame='575' equals='547' offsetX='6' offsetY='8' /> + <image frame='576' equals='535' offsetX='5' offsetY='5' /> + <image frame='577' equals='535' offsetX='2' offsetY='5' /> + <image frame='578' equals='535' offsetX='6' offsetY='5' /> + <image frame='579' equals='535' offsetX='6' offsetY='5' /> + <image frame='580' equals='535' offsetX='6' offsetY='5' /> + <image frame='581' equals='535' offsetX='6' offsetY='5' /> + <image frame='582' equals='535' offsetX='6' offsetY='5' /> + <image frame='583' equals='535' offsetX='5' offsetY='5' /> + <image frame='584' equals='535' offsetX='5' offsetY='5' /> + <image frame='585' equals='535' offsetX='5' offsetY='5' /> + <image frame='586' equals='535' offsetX='6' offsetY='5' /> + <image frame='587' equals='535' offsetX='6' offsetY='5' /> + <image frame='588' equals='535' offsetX='5' offsetY='5' /> + <image frame='589' equals='535' offsetX='5' offsetY='5' /> + <image frame='590' equals='535' offsetX='5' offsetY='5' /> + <image frame='591' equals='535' offsetX='6' offsetY='5' /> + <image frame='592' equals='535' offsetX='6' offsetY='5' /> + <image frame='594' equals='593' offsetX='0' offsetY='6' /> + <image frame='595' equals='593' offsetX='0' offsetY='6' /> + <image frame='596' equals='593' offsetX='0' offsetY='6' /> + <image frame='597' equals='593' offsetX='0' offsetY='6' /> + <image frame='598' equals='593' offsetX='0' offsetY='6' /> + <image frame='599' equals='593' offsetX='0' offsetY='6' /> + <image frame='600' equals='593' offsetX='0' offsetY='6' /> + <image frame='601' equals='593' offsetX='0' offsetY='6' /> + <image frame='602' equals='593' offsetX='0' offsetY='6' /> + <image frame='603' equals='593' offsetX='0' offsetY='6' /> + <image frame='604' equals='593' offsetX='0' offsetY='6' /> + <image frame='606' equals='605' offsetX='6' offsetY='6' /> + <image frame='607' equals='605' offsetX='6' offsetY='6' /> + <image frame='608' equals='605' offsetX='6' offsetY='6' /> + <image frame='609' equals='605' offsetX='6' offsetY='6' /> + <image frame='610' equals='605' offsetX='6' offsetY='6' /> + <image frame='611' equals='605' offsetX='6' offsetY='6' /> + <image frame='612' equals='605' offsetX='6' offsetY='6' /> + <image frame='613' equals='605' offsetX='6' offsetY='6' /> + <image frame='614' equals='605' offsetX='6' offsetY='6' /> + <image frame='615' equals='605' offsetX='6' offsetY='6' /> + <image frame='616' equals='605' offsetX='6' offsetY='6' /> + <image frame='617' equals='605' offsetX='6' offsetY='6' /> + <image frame='618' equals='605' offsetX='6' offsetY='6' /> + <image frame='619' equals='605' offsetX='6' offsetY='6' /> + <image frame='620' equals='605' offsetX='6' offsetY='6' /> + <image frame='621' equals='605' offsetX='6' offsetY='6' /> + <image frame='622' equals='605' offsetX='6' offsetY='6' /> + <image frame='623' equals='605' offsetX='6' offsetY='6' /> + <image frame='624' equals='605' offsetX='6' offsetY='6' /> + <image frame='625' equals='605' offsetX='6' offsetY='6' /> + <image frame='626' equals='605' offsetX='6' offsetY='6' /> + <image frame='627' equals='605' offsetX='6' offsetY='6' /> + <image frame='628' equals='605' offsetX='6' offsetY='6' /> + <image frame='629' equals='605' offsetX='6' offsetY='6' /> + <image frame='630' equals='605' offsetX='6' offsetY='6' /> + <image frame='631' equals='605' offsetX='6' offsetY='6' /> + <image frame='632' equals='605' offsetX='6' offsetY='6' /> + <image frame='633' equals='605' offsetX='6' offsetY='6' /> + <image frame='634' equals='593' offsetX='3' offsetY='5' /> + <image frame='635' equals='593' offsetX='0' offsetY='5' /> + <image frame='636' equals='593' offsetX='4' offsetY='5' /> + <image frame='637' equals='593' offsetX='4' offsetY='5' /> + <image frame='638' equals='593' offsetX='4' offsetY='5' /> + <image frame='639' equals='593' offsetX='4' offsetY='5' /> + <image frame='641' equals='640' offsetX='4' offsetY='6' /> + <image frame='642' equals='640' offsetX='4' offsetY='6' /> + <image frame='643' equals='640' offsetX='4' offsetY='6' /> + <image frame='644' equals='640' offsetX='5' offsetY='6' /> + <image frame='645' equals='640' offsetX='5' offsetY='6' /> + <image frame='646' equals='640' offsetX='4' offsetY='6' /> + <image frame='647' equals='640' offsetX='4' offsetY='6' /> + <image frame='648' equals='640' offsetX='4' offsetY='6' /> + <image frame='649' equals='640' offsetX='5' offsetY='6' /> + <image frame='650' equals='640' offsetX='5' offsetY='6' /> + <image frame='652' equals='651' offsetX='1' offsetY='6' /> + <image frame='653' equals='651' offsetX='1' offsetY='6' /> + <image frame='654' equals='651' offsetX='1' offsetY='6' /> + <image frame='655' equals='651' offsetX='1' offsetY='6' /> + <image frame='656' equals='651' offsetX='1' offsetY='6' /> + <image frame='657' equals='651' offsetX='1' offsetY='6' /> + <image frame='658' equals='651' offsetX='1' offsetY='6' /> + <image frame='659' equals='651' offsetX='1' offsetY='6' /> + <image frame='660' equals='651' offsetX='1' offsetY='6' /> + <image frame='661' equals='651' offsetX='1' offsetY='6' /> + <image frame='662' equals='651' offsetX='1' offsetY='6' /> + <image frame='664' equals='663' offsetX='6' offsetY='7' /> + <image frame='665' equals='663' offsetX='6' offsetY='7' /> + <image frame='666' equals='663' offsetX='6' offsetY='7' /> + <image frame='667' equals='663' offsetX='6' offsetY='7' /> + <image frame='668' equals='663' offsetX='6' offsetY='7' /> + <image frame='669' equals='663' offsetX='6' offsetY='7' /> + <image frame='670' equals='663' offsetX='6' offsetY='7' /> + <image frame='671' equals='663' offsetX='6' offsetY='7' /> + <image frame='672' equals='663' offsetX='6' offsetY='7' /> + <image frame='673' equals='663' offsetX='6' offsetY='7' /> + <image frame='674' equals='663' offsetX='6' offsetY='7' /> + <image frame='675' equals='663' offsetX='6' offsetY='7' /> + <image frame='676' equals='663' offsetX='6' offsetY='7' /> + <image frame='677' equals='663' offsetX='6' offsetY='7' /> + <image frame='678' equals='663' offsetX='6' offsetY='7' /> + <image frame='679' equals='663' offsetX='6' offsetY='7' /> + <image frame='680' equals='663' offsetX='6' offsetY='7' /> + <image frame='681' equals='663' offsetX='6' offsetY='7' /> + <image frame='682' equals='663' offsetX='6' offsetY='7' /> + <image frame='683' equals='663' offsetX='6' offsetY='7' /> + <image frame='684' equals='663' offsetX='6' offsetY='7' /> + <image frame='685' equals='663' offsetX='6' offsetY='7' /> + <image frame='686' equals='663' offsetX='6' offsetY='7' /> + <image frame='687' equals='663' offsetX='6' offsetY='7' /> + <image frame='688' equals='663' offsetX='6' offsetY='7' /> + <image frame='689' equals='663' offsetX='6' offsetY='7' /> + <image frame='690' equals='663' offsetX='6' offsetY='7' /> + <image frame='691' equals='663' offsetX='6' offsetY='7' /> + <image frame='693' equals='692' offsetX='0' offsetY='6' /> + <image frame='694' equals='692' offsetX='4' offsetY='6' /> + <image frame='695' equals='692' offsetX='4' offsetY='6' /> + <image frame='696' equals='692' offsetX='4' offsetY='6' /> + <image frame='697' equals='692' offsetX='4' offsetY='6' /> + <image frame='699' equals='698' offsetX='4' offsetY='6' /> + <image frame='700' equals='698' offsetX='4' offsetY='6' /> + <image frame='701' equals='698' offsetX='4' offsetY='6' /> + <image frame='702' equals='698' offsetX='5' offsetY='6' /> + <image frame='703' equals='698' offsetX='5' offsetY='6' /> + <image frame='704' equals='698' offsetX='4' offsetY='6' /> + <image frame='705' equals='698' offsetX='4' offsetY='6' /> + <image frame='706' equals='698' offsetX='4' offsetY='6' /> + <image frame='707' equals='698' offsetX='5' offsetY='6' /> + <image frame='710' equals='709' offsetX='2' offsetY='6' /> + <image frame='711' equals='709' offsetX='2' offsetY='6' /> + <image frame='712' equals='709' offsetX='2' offsetY='6' /> + <image frame='713' equals='709' offsetX='2' offsetY='6' /> + <image frame='714' equals='709' offsetX='2' offsetY='6' /> + <image frame='715' equals='709' offsetX='2' offsetY='6' /> + <image frame='716' equals='709' offsetX='2' offsetY='6' /> + <image frame='717' equals='709' offsetX='2' offsetY='6' /> + <image frame='718' equals='709' offsetX='2' offsetY='6' /> + <image frame='719' equals='709' offsetX='2' offsetY='6' /> + <image frame='720' equals='709' offsetX='2' offsetY='6' /> + <image frame='722' equals='721' offsetX='6' offsetY='8' /> + <image frame='723' equals='721' offsetX='6' offsetY='8' /> + <image frame='724' equals='721' offsetX='6' offsetY='8' /> + <image frame='725' equals='721' offsetX='6' offsetY='8' /> + <image frame='726' equals='721' offsetX='6' offsetY='8' /> + <image frame='727' equals='721' offsetX='6' offsetY='8' /> + <image frame='728' equals='721' offsetX='6' offsetY='8' /> + <image frame='729' equals='721' offsetX='6' offsetY='8' /> + <image frame='730' equals='721' offsetX='6' offsetY='8' /> + <image frame='731' equals='721' offsetX='6' offsetY='8' /> + <image frame='732' equals='721' offsetX='6' offsetY='8' /> + <image frame='733' equals='721' offsetX='6' offsetY='8' /> + <image frame='734' equals='721' offsetX='6' offsetY='8' /> + <image frame='735' equals='721' offsetX='6' offsetY='8' /> + <image frame='736' equals='721' offsetX='6' offsetY='8' /> + <image frame='737' equals='721' offsetX='6' offsetY='8' /> + <image frame='738' equals='721' offsetX='6' offsetY='8' /> + <image frame='739' equals='721' offsetX='5' offsetY='8' /> + <image frame='740' equals='721' offsetX='5' offsetY='8' /> + <image frame='741' equals='721' offsetX='5' offsetY='8' /> + <image frame='742' equals='721' offsetX='5' offsetY='8' /> + <image frame='743' equals='721' offsetX='5' offsetY='8' /> + <image frame='744' equals='721' offsetX='5' offsetY='8' /> + <image frame='745' equals='721' offsetX='6' offsetY='8' /> + <image frame='746' equals='721' offsetX='6' offsetY='8' /> + <image frame='747' equals='721' offsetX='6' offsetY='8' /> + <image frame='748' equals='721' offsetX='6' offsetY='8' /> + <image frame='749' equals='721' offsetX='6' offsetY='8' /> + <image frame='750' equals='709' offsetX='5' offsetY='5' /> + <image frame='751' equals='709' offsetX='2' offsetY='5' /> + <image frame='752' equals='709' offsetX='6' offsetY='5' /> + <image frame='753' equals='709' offsetX='6' offsetY='5' /> + <image frame='754' equals='709' offsetX='6' offsetY='5' /> + <image frame='755' equals='709' offsetX='6' offsetY='5' /> + <image frame='757' equals='756' offsetX='5' offsetY='5' /> + <image frame='758' equals='756' offsetX='5' offsetY='5' /> + <image frame='759' equals='756' offsetX='5' offsetY='5' /> + <image frame='760' equals='756' offsetX='6' offsetY='5' /> + <image frame='761' equals='756' offsetX='6' offsetY='5' /> + <image frame='762' equals='756' offsetX='5' offsetY='5' /> + <image frame='763' equals='756' offsetX='5' offsetY='5' /> + <image frame='764' equals='756' offsetX='5' offsetY='5' /> + <image frame='765' equals='756' offsetX='6' offsetY='5' /> + <image frame='766' equals='756' offsetX='6' offsetY='5' /> + <image frame='768' equals='767' offsetX='0' offsetY='5' /> + <image frame='769' equals='767' offsetX='0' offsetY='5' /> + <image frame='770' equals='767' offsetX='0' offsetY='5' /> + <image frame='771' equals='767' offsetX='0' offsetY='5' /> + <image frame='772' equals='767' offsetX='0' offsetY='5' /> + <image frame='773' equals='767' offsetX='0' offsetY='5' /> + <image frame='774' equals='767' offsetX='0' offsetY='5' /> + <image frame='775' equals='767' offsetX='0' offsetY='5' /> + <image frame='776' equals='767' offsetX='0' offsetY='5' /> + <image frame='777' equals='767' offsetX='0' offsetY='5' /> + <image frame='778' equals='767' offsetX='0' offsetY='5' /> + <image frame='780' equals='779' offsetX='7' offsetY='8' /> + <image frame='781' equals='779' offsetX='7' offsetY='8' /> + <image frame='782' equals='779' offsetX='7' offsetY='8' /> + <image frame='783' equals='779' offsetX='7' offsetY='8' /> + <image frame='784' equals='779' offsetX='7' offsetY='8' /> + <image frame='785' equals='779' offsetX='7' offsetY='8' /> + <image frame='786' equals='779' offsetX='7' offsetY='8' /> + <image frame='787' equals='779' offsetX='7' offsetY='8' /> + <image frame='788' equals='779' offsetX='7' offsetY='8' /> + <image frame='789' equals='779' offsetX='7' offsetY='8' /> + <image frame='790' equals='779' offsetX='7' offsetY='8' /> + <image frame='791' equals='779' offsetX='7' offsetY='8' /> + <image frame='792' equals='779' offsetX='7' offsetY='8' /> + <image frame='793' equals='779' offsetX='7' offsetY='8' /> + <image frame='794' equals='779' offsetX='7' offsetY='8' /> + <image frame='795' equals='779' offsetX='7' offsetY='8' /> + <image frame='796' equals='779' offsetX='7' offsetY='8' /> + <image frame='797' equals='779' offsetX='7' offsetY='8' /> + <image frame='798' equals='779' offsetX='7' offsetY='8' /> + <image frame='799' equals='779' offsetX='7' offsetY='8' /> + <image frame='800' equals='779' offsetX='7' offsetY='8' /> + <image frame='801' equals='779' offsetX='7' offsetY='8' /> + <image frame='802' equals='779' offsetX='7' offsetY='8' /> + <image frame='803' equals='779' offsetX='7' offsetY='8' /> + <image frame='804' equals='779' offsetX='7' offsetY='8' /> + <image frame='805' equals='779' offsetX='7' offsetY='8' /> + <image frame='806' equals='779' offsetX='7' offsetY='8' /> + <image frame='807' equals='779' offsetX='7' offsetY='8' /> + <image frame='809' equals='808' offsetX='0' offsetY='5' /> + <image frame='810' equals='808' offsetX='4' offsetY='5' /> + <image frame='811' equals='808' offsetX='4' offsetY='5' /> + <image frame='812' equals='767' offsetX='4' offsetY='5' /> + <image frame='813' equals='767' offsetX='4' offsetY='5' /> + <image frame='815' equals='814' offsetX='4' offsetY='6' /> + <image frame='816' equals='814' offsetX='4' offsetY='6' /> + <image frame='817' equals='814' offsetX='4' offsetY='6' /> + <image frame='818' equals='814' offsetX='5' offsetY='6' /> + <image frame='819' equals='814' offsetX='5' offsetY='6' /> + <image frame='820' equals='814' offsetX='4' offsetY='6' /> + <image frame='821' equals='814' offsetX='4' offsetY='6' /> + <image frame='822' equals='814' offsetX='4' offsetY='6' /> + <image frame='823' equals='814' offsetX='5' offsetY='6' /> + <image frame='824' equals='814' offsetX='5' offsetY='6' /> + <image frame='826' equals='825' offsetX='2' offsetY='5' /> + <image frame='827' equals='825' offsetX='2' offsetY='5' /> + <image frame='828' equals='825' offsetX='2' offsetY='5' /> + <image frame='829' equals='825' offsetX='2' offsetY='5' /> + <image frame='830' equals='825' offsetX='2' offsetY='5' /> + <image frame='831' equals='825' offsetX='2' offsetY='5' /> + <image frame='832' equals='825' offsetX='2' offsetY='5' /> + <image frame='833' equals='825' offsetX='2' offsetY='5' /> + <image frame='834' equals='825' offsetX='2' offsetY='5' /> + <image frame='835' equals='825' offsetX='2' offsetY='5' /> + <image frame='836' equals='825' offsetX='2' offsetY='5' /> + <image frame='838' equals='837' offsetX='6' offsetY='8' /> + <image frame='839' equals='837' offsetX='6' offsetY='8' /> + <image frame='840' equals='837' offsetX='6' offsetY='8' /> + <image frame='841' equals='837' offsetX='6' offsetY='8' /> + <image frame='842' equals='837' offsetX='6' offsetY='8' /> + <image frame='843' equals='837' offsetX='6' offsetY='8' /> + <image frame='844' equals='837' offsetX='6' offsetY='8' /> + <image frame='845' equals='837' offsetX='6' offsetY='8' /> + <image frame='846' equals='837' offsetX='6' offsetY='8' /> + <image frame='847' equals='837' offsetX='6' offsetY='8' /> + <image frame='848' equals='837' offsetX='6' offsetY='8' /> + <image frame='849' equals='837' offsetX='6' offsetY='8' /> + <image frame='850' equals='837' offsetX='6' offsetY='8' /> + <image frame='851' equals='837' offsetX='6' offsetY='8' /> + <image frame='852' equals='837' offsetX='6' offsetY='8' /> + <image frame='853' equals='837' offsetX='6' offsetY='8' /> + <image frame='854' equals='837' offsetX='6' offsetY='8' /> + <image frame='855' equals='837' offsetX='6' offsetY='8' /> + <image frame='856' equals='837' offsetX='6' offsetY='8' /> + <image frame='857' equals='837' offsetX='6' offsetY='8' /> + <image frame='858' equals='837' offsetX='6' offsetY='8' /> + <image frame='859' equals='837' offsetX='6' offsetY='8' /> + <image frame='860' equals='837' offsetX='6' offsetY='8' /> + <image frame='861' equals='837' offsetX='6' offsetY='8' /> + <image frame='862' equals='837' offsetX='6' offsetY='8' /> + <image frame='863' equals='837' offsetX='6' offsetY='8' /> + <image frame='864' equals='837' offsetX='6' offsetY='8' /> + <image frame='865' equals='837' offsetX='6' offsetY='8' /> + <image frame='866' equals='825' offsetX='5' offsetY='4' /> + <image frame='867' equals='825' offsetX='2' offsetY='4' /> + <image frame='868' equals='825' offsetX='6' offsetY='4' /> + <image frame='869' equals='825' offsetX='6' offsetY='4' /> + <image frame='870' equals='825' offsetX='6' offsetY='4' /> + <image frame='871' equals='825' offsetX='6' offsetY='4' /> + <image frame='873' equals='872' offsetX='5' offsetY='5' /> + <image frame='874' equals='872' offsetX='5' offsetY='5' /> + <image frame='875' equals='872' offsetX='5' offsetY='5' /> + <image frame='876' equals='872' offsetX='6' offsetY='5' /> + <image frame='877' equals='872' offsetX='6' offsetY='5' /> + <image frame='878' equals='872' offsetX='5' offsetY='5' /> + <image frame='879' equals='872' offsetX='5' offsetY='5' /> + <image frame='880' equals='872' offsetX='5' offsetY='5' /> + <image frame='881' equals='872' offsetX='6' offsetY='5' /> + <image frame='882' equals='872' offsetX='6' offsetY='5' /> + <image frame='884' equals='883' offsetX='1' offsetY='5' /> + <image frame='885' equals='883' offsetX='1' offsetY='5' /> + <image frame='886' equals='883' offsetX='1' offsetY='5' /> + <image frame='887' equals='883' offsetX='1' offsetY='5' /> + <image frame='888' equals='883' offsetX='1' offsetY='5' /> + <image frame='889' equals='883' offsetX='1' offsetY='5' /> + <image frame='890' equals='883' offsetX='1' offsetY='5' /> + <image frame='891' equals='883' offsetX='1' offsetY='5' /> + <image frame='892' equals='883' offsetX='1' offsetY='5' /> + <image frame='893' equals='883' offsetX='1' offsetY='5' /> + <image frame='894' equals='883' offsetX='1' offsetY='5' /> + <image frame='896' equals='895' offsetX='4' offsetY='7' /> + <image frame='897' equals='895' offsetX='4' offsetY='7' /> + <image frame='898' equals='895' offsetX='4' offsetY='7' /> + <image frame='899' equals='895' offsetX='4' offsetY='7' /> + <image frame='900' equals='895' offsetX='4' offsetY='7' /> + <image frame='901' equals='895' offsetX='4' offsetY='7' /> + <image frame='902' equals='895' offsetX='4' offsetY='7' /> + <image frame='903' equals='895' offsetX='4' offsetY='7' /> + <image frame='904' equals='895' offsetX='4' offsetY='7' /> + <image frame='905' equals='895' offsetX='4' offsetY='7' /> + <image frame='906' equals='895' offsetX='4' offsetY='7' /> + <image frame='907' equals='895' offsetX='4' offsetY='7' /> + <image frame='908' equals='895' offsetX='4' offsetY='7' /> + <image frame='909' equals='895' offsetX='4' offsetY='7' /> + <image frame='910' equals='895' offsetX='4' offsetY='7' /> + <image frame='911' equals='895' offsetX='4' offsetY='7' /> + <image frame='912' equals='895' offsetX='4' offsetY='7' /> + <image frame='913' equals='895' offsetX='4' offsetY='7' /> + <image frame='914' equals='895' offsetX='4' offsetY='7' /> + <image frame='915' equals='895' offsetX='4' offsetY='7' /> + <image frame='916' equals='895' offsetX='4' offsetY='7' /> + <image frame='917' equals='895' offsetX='4' offsetY='7' /> + <image frame='918' equals='895' offsetX='4' offsetY='7' /> + <image frame='919' equals='895' offsetX='4' offsetY='7' /> + <image frame='920' equals='895' offsetX='4' offsetY='7' /> + <image frame='921' equals='895' offsetX='4' offsetY='7' /> + <image frame='922' equals='895' offsetX='4' offsetY='7' /> + <image frame='923' equals='895' offsetX='4' offsetY='7' /> + <image frame='924' equals='883' offsetX='4' offsetY='4' /> + <image frame='925' equals='883' offsetX='1' offsetY='4' /> + <image frame='926' equals='883' offsetX='5' offsetY='4' /> + <image frame='927' equals='883' offsetX='5' offsetY='4' /> + <image frame='929' equals='928' offsetX='5' offsetY='5' /> + <image frame='931' equals='930' offsetX='4' offsetY='6' /> + <image frame='932' equals='930' offsetX='4' offsetY='6' /> + <image frame='933' equals='930' offsetX='4' offsetY='6' /> + <image frame='934' equals='930' offsetX='5' offsetY='6' /> + <image frame='935' equals='930' offsetX='5' offsetY='6' /> + <image frame='936' equals='930' offsetX='4' offsetY='6' /> + <image frame='937' equals='930' offsetX='4' offsetY='6' /> + <image frame='938' equals='930' offsetX='4' offsetY='6' /> + <image frame='939' equals='930' offsetX='5' offsetY='6' /> + <image frame='940' equals='930' offsetX='5' offsetY='6' /> + <image frame='942' equals='941' offsetX='2' offsetY='7' /> + <image frame='943' equals='941' offsetX='2' offsetY='7' /> + <image frame='944' equals='941' offsetX='2' offsetY='7' /> + <image frame='945' equals='941' offsetX='2' offsetY='7' /> + <image frame='946' equals='941' offsetX='2' offsetY='7' /> + <image frame='947' equals='941' offsetX='2' offsetY='7' /> + <image frame='948' equals='941' offsetX='2' offsetY='7' /> + <image frame='949' equals='941' offsetX='2' offsetY='7' /> + <image frame='950' equals='941' offsetX='2' offsetY='7' /> + <image frame='951' equals='941' offsetX='2' offsetY='7' /> + <image frame='952' equals='941' offsetX='2' offsetY='7' /> + <image frame='954' equals='953' offsetX='3' offsetY='8' /> + <image frame='955' equals='953' offsetX='3' offsetY='8' /> + <image frame='956' equals='953' offsetX='3' offsetY='8' /> + <image frame='957' equals='953' offsetX='3' offsetY='8' /> + <image frame='958' equals='953' offsetX='3' offsetY='8' /> + <image frame='959' equals='953' offsetX='3' offsetY='8' /> + <image frame='960' equals='953' offsetX='3' offsetY='8' /> + <image frame='961' equals='953' offsetX='3' offsetY='8' /> + <image frame='962' equals='953' offsetX='3' offsetY='8' /> + <image frame='963' equals='953' offsetX='3' offsetY='8' /> + <image frame='964' equals='953' offsetX='3' offsetY='8' /> + <image frame='965' equals='953' offsetX='3' offsetY='8' /> + <image frame='966' equals='953' offsetX='3' offsetY='8' /> + <image frame='967' equals='953' offsetX='3' offsetY='8' /> + <image frame='968' equals='953' offsetX='3' offsetY='8' /> + <image frame='969' equals='953' offsetX='3' offsetY='8' /> + <image frame='970' equals='953' offsetX='3' offsetY='8' /> + <image frame='971' equals='953' offsetX='3' offsetY='8' /> + <image frame='972' equals='953' offsetX='3' offsetY='8' /> + <image frame='973' equals='953' offsetX='3' offsetY='8' /> + <image frame='974' equals='953' offsetX='3' offsetY='8' /> + <image frame='975' equals='953' offsetX='3' offsetY='8' /> + <image frame='976' equals='953' offsetX='3' offsetY='8' /> + <image frame='977' equals='953' offsetX='3' offsetY='8' /> + <image frame='978' equals='953' offsetX='3' offsetY='8' /> + <image frame='979' equals='953' offsetX='3' offsetY='8' /> + <image frame='980' equals='953' offsetX='3' offsetY='8' /> + <image frame='981' equals='953' offsetX='3' offsetY='8' /> + <image frame='982' equals='941' offsetX='5' offsetY='6' /> + <image frame='983' equals='941' offsetX='2' offsetY='6' /> + <image frame='989' equals='988' offsetX='5' offsetY='6' /> + <image frame='990' equals='988' offsetX='5' offsetY='6' /> + <image frame='991' equals='988' offsetX='5' offsetY='6' /> + <image frame='992' equals='988' offsetX='6' offsetY='6' /> + <image frame='993' equals='988' offsetX='6' offsetY='6' /> + <image frame='994' equals='988' offsetX='5' offsetY='6' /> + <image frame='995' equals='988' offsetX='5' offsetY='6' /> + <image frame='996' equals='988' offsetX='5' offsetY='6' /> + <image frame='997' equals='988' offsetX='6' offsetY='6' /> + <image frame='998' equals='988' offsetX='6' offsetY='6' /> + <image frame='1000' equals='999' offsetX='0' offsetY='0' /> + <image frame='1001' equals='999' offsetX='0' offsetY='0' /> + <image frame='1002' equals='999' offsetX='0' offsetY='0' /> + <image frame='1003' equals='999' offsetX='0' offsetY='0' /> + <image frame='1004' equals='999' offsetX='0' offsetY='0' /> + <image frame='1005' equals='999' offsetX='0' offsetY='0' /> + <image frame='1006' equals='999' offsetX='0' offsetY='0' /> + <image frame='1007' equals='999' offsetX='0' offsetY='0' /> + <image frame='1008' equals='999' offsetX='0' offsetY='0' /> + <image frame='1009' equals='999' offsetX='0' offsetY='0' /> + <image frame='1010' equals='999' offsetX='0' offsetY='0' /> + <image frame='1012' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1013' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1014' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1015' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1016' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1017' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1018' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1019' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1020' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1021' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1022' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1023' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1024' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1025' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1026' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1027' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1028' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1029' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1030' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1031' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1032' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1033' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1034' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1035' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1036' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1037' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1038' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1039' equals='1011' offsetX='5' offsetY='6' /> + <image frame='1042' equals='1040' offsetX='4' offsetY='0' /> + <image frame='1043' equals='999' offsetX='4' offsetY='0' /> + <image frame='1044' equals='999' offsetX='4' offsetY='0' /> + <image frame='1045' equals='999' offsetX='4' offsetY='0' /> + <image frame='1046' equals='999' offsetX='4' offsetY='0' /> + <image frame='1051' equals='999' offsetX='4' offsetY='0' /> + <image frame='1052' equals='1047' offsetX='3' offsetY='0' /> + <image frame='1053' equals='1048' offsetX='3' offsetY='0' /> + <image frame='1054' equals='1049' offsetX='3' offsetY='0' /> + <image frame='1055' equals='999' offsetX='4' offsetY='0' /> + <image frame='1056' equals='999' offsetX='4' offsetY='0' /> + <image frame='1058' equals='1057' offsetX='0' offsetY='7' /> + <image frame='1059' equals='1057' offsetX='0' offsetY='7' /> + <image frame='1060' equals='1057' offsetX='0' offsetY='7' /> + <image frame='1061' equals='1057' offsetX='0' offsetY='7' /> + <image frame='1062' equals='1057' offsetX='0' offsetY='7' /> + <image frame='1063' equals='1057' offsetX='0' offsetY='7' /> + <image frame='1064' equals='1057' offsetX='0' offsetY='7' /> + <image frame='1065' equals='1057' offsetX='0' offsetY='7' /> + <image frame='1066' equals='1057' offsetX='0' offsetY='7' /> + <image frame='1067' equals='1057' offsetX='0' offsetY='7' /> + <image frame='1068' equals='1057' offsetX='0' offsetY='7' /> + <image frame='1070' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1071' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1072' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1073' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1074' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1075' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1076' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1077' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1078' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1079' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1080' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1081' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1082' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1083' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1084' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1085' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1086' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1087' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1088' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1089' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1090' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1091' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1092' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1093' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1094' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1095' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1096' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1097' equals='1069' offsetX='4' offsetY='7' /> + <image frame='1099' equals='1057' offsetX='0' offsetY='6' /> + <image frame='1102' equals='1101' offsetX='5' offsetY='6' /> + <image frame='1103' equals='1101' offsetX='5' offsetY='6' /> + <image frame='1105' equals='1101' offsetX='4' offsetY='6' /> + <image frame='1106' equals='1101' offsetX='4' offsetY='6' /> + <image frame='1107' equals='1101' offsetX='4' offsetY='6' /> + <image frame='1109' equals='1104' offsetX='4' offsetY='6' /> + <image frame='1110' equals='1101' offsetX='4' offsetY='6' /> + <image frame='1111' equals='1101' offsetX='4' offsetY='6' /> + <image frame='1112' equals='1101' offsetX='4' offsetY='6' /> + <image frame='1113' equals='1108' offsetX='4' offsetY='6' /> + <image frame='1114' equals='1101' offsetX='5' offsetY='6' /> + <image frame='1116' equals='1115' offsetX='0' offsetY='1' /> + <image frame='1117' equals='1115' offsetX='0' offsetY='1' /> + <image frame='1118' equals='1115' offsetX='0' offsetY='1' /> + <image frame='1119' equals='1115' offsetX='0' offsetY='1' /> + <image frame='1120' equals='1115' offsetX='0' offsetY='1' /> + <image frame='1121' equals='1115' offsetX='0' offsetY='1' /> + <image frame='1122' equals='1115' offsetX='0' offsetY='1' /> + <image frame='1123' equals='1115' offsetX='0' offsetY='1' /> + <image frame='1124' equals='1115' offsetX='0' offsetY='1' /> + <image frame='1125' equals='1115' offsetX='0' offsetY='1' /> + <image frame='1126' equals='1115' offsetX='0' offsetY='1' /> + <image frame='1128' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1129' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1130' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1131' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1132' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1133' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1134' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1135' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1136' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1137' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1138' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1139' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1140' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1141' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1142' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1143' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1144' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1145' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1146' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1147' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1148' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1149' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1150' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1151' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1152' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1153' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1154' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1155' equals='1127' offsetX='6' offsetY='4' /> + <image frame='1157' equals='1115' offsetX='0' offsetY='0' /> + <image frame='1160' equals='1159' offsetX='2' offsetY='0' /> + <image frame='1161' equals='1159' offsetX='2' offsetY='0' /> + <image frame='1162' equals='1159' offsetX='2' offsetY='0' /> + <image frame='1163' equals='1159' offsetX='1' offsetY='0' /> + <image frame='1164' equals='1159' offsetX='1' offsetY='0' /> + <image frame='1165' equals='1159' offsetX='1' offsetY='0' /> + <image frame='1166' equals='1159' offsetX='2' offsetY='0' /> + <image frame='1167' equals='1159' offsetX='2' offsetY='0' /> + <image frame='1168' equals='1159' offsetX='1' offsetY='0' /> + <image frame='1169' equals='1159' offsetX='1' offsetY='0' /> + <image frame='1170' equals='1159' offsetX='1' offsetY='0' /> + <image frame='1171' equals='1159' offsetX='2' offsetY='0' /> + <image frame='1172' equals='1159' offsetX='2' offsetY='0' /> + <image frame='1174' equals='1173' offsetX='0' offsetY='1' /> + <image frame='1175' equals='1173' offsetX='0' offsetY='1' /> + <image frame='1176' equals='1173' offsetX='0' offsetY='1' /> + <image frame='1177' equals='1173' offsetX='0' offsetY='1' /> + <image frame='1178' equals='1173' offsetX='0' offsetY='1' /> + <image frame='1180' equals='1179' offsetX='1' offsetY='1' /> + <image frame='1181' equals='1179' offsetX='1' offsetY='1' /> + <image frame='1182' equals='1179' offsetX='1' offsetY='1' /> + <image frame='1184' equals='1183' offsetX='1' offsetY='1' /> + <image frame='1186' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1187' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1188' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1189' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1190' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1191' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1192' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1193' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1194' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1195' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1196' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1197' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1198' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1199' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1200' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1201' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1202' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1203' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1204' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1205' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1206' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1207' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1208' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1209' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1210' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1211' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1212' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1213' equals='1185' offsetX='6' offsetY='7' /> + <image frame='1215' equals='1173' offsetX='0' offsetY='0' /> + <image frame='1216' equals='1179' offsetX='5' offsetY='0' /> + <image frame='1218' equals='1183' offsetX='5' offsetY='0' /> + <image frame='1219' equals='1183' offsetX='5' offsetY='0' /> + <image frame='1220' equals='1183' offsetX='5' offsetY='0' /> + <image frame='1221' equals='1183' offsetX='4' offsetY='0' /> + <image frame='1222' equals='1183' offsetX='4' offsetY='0' /> + <image frame='1223' equals='1183' offsetX='4' offsetY='0' /> + <image frame='1224' equals='1183' offsetX='5' offsetY='0' /> + <image frame='1225' equals='1183' offsetX='5' offsetY='0' /> + <image frame='1226' equals='1183' offsetX='4' offsetY='0' /> + <image frame='1227' equals='1183' offsetX='4' offsetY='0' /> + <image frame='1228' equals='1183' offsetX='4' offsetY='0' /> + <image frame='1229' equals='1183' offsetX='5' offsetY='0' /> + <image frame='1230' equals='1183' offsetX='5' offsetY='0' /> + <image frame='1232' equals='1231' offsetX='0' offsetY='3' /> + <image frame='1233' equals='1231' offsetX='0' offsetY='3' /> + <image frame='1234' equals='1231' offsetX='0' offsetY='3' /> + <image frame='1235' equals='1231' offsetX='0' offsetY='3' /> + <image frame='1236' equals='1231' offsetX='0' offsetY='3' /> + <image frame='1238' equals='1237' offsetX='0' offsetY='3' /> + <image frame='1239' equals='1237' offsetX='0' offsetY='3' /> + <image frame='1240' equals='1237' offsetX='0' offsetY='3' /> + <image frame='1242' equals='1241' offsetX='0' offsetY='3' /> + <image frame='1244' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1245' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1246' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1247' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1248' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1249' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1250' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1251' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1252' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1253' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1254' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1255' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1256' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1257' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1258' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1259' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1260' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1261' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1262' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1263' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1264' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1265' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1266' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1267' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1268' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1269' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1270' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1271' equals='1243' offsetX='8' offsetY='6' /> + <image frame='1273' equals='1231' offsetX='0' offsetY='2' /> + <image frame='1274' equals='1237' offsetX='4' offsetY='2' /> + <image frame='1276' equals='1241' offsetX='4' offsetY='2' /> + <image frame='1277' equals='1241' offsetX='4' offsetY='2' /> + <image frame='1278' equals='1241' offsetX='4' offsetY='2' /> + <image frame='1279' equals='1241' offsetX='3' offsetY='2' /> + <image frame='1280' equals='1241' offsetX='3' offsetY='2' /> + <image frame='1281' equals='1241' offsetX='3' offsetY='2' /> + <image frame='1282' equals='1241' offsetX='4' offsetY='2' /> + <image frame='1283' equals='1241' offsetX='4' offsetY='2' /> + <image frame='1284' equals='1241' offsetX='3' offsetY='2' /> + <image frame='1285' equals='1241' offsetX='3' offsetY='2' /> + <image frame='1286' equals='1241' offsetX='3' offsetY='2' /> + <image frame='1287' equals='1241' offsetX='4' offsetY='2' /> + <image frame='1288' equals='1241' offsetX='4' offsetY='2' /> + <image frame='1290' equals='1289' offsetX='0' offsetY='7' /> + <image frame='1291' equals='1289' offsetX='0' offsetY='7' /> + <image frame='1292' equals='1289' offsetX='0' offsetY='7' /> + <image frame='1293' equals='1289' offsetX='0' offsetY='7' /> + <image frame='1294' equals='1289' offsetX='0' offsetY='7' /> + <image frame='1296' equals='1295' offsetX='0' offsetY='7' /> + <image frame='1297' equals='1295' offsetX='0' offsetY='7' /> + <image frame='1299' equals='1298' offsetX='0' offsetY='7' /> + <image frame='1302' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1303' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1304' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1305' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1306' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1307' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1308' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1309' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1310' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1311' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1312' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1313' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1314' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1315' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1316' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1317' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1318' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1319' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1320' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1321' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1322' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1323' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1324' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1325' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1326' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1327' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1328' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1329' equals='1301' offsetX='4' offsetY='7' /> + <image frame='1331' equals='1295' offsetX='0' offsetY='6' /> + <image frame='1332' equals='1298' offsetX='4' offsetY='6' /> + <image frame='1335' equals='1334' offsetX='3' offsetY='6' /> + <image frame='1336' equals='1334' offsetX='3' offsetY='6' /> + <image frame='1338' equals='1337' offsetX='2' offsetY='6' /> + <image frame='1339' equals='1334' offsetX='2' offsetY='6' /> + <image frame='1340' equals='1334' offsetX='3' offsetY='6' /> + <image frame='1341' equals='1334' offsetX='3' offsetY='6' /> + <image frame='1342' equals='1337' offsetX='2' offsetY='6' /> + <image frame='1343' equals='1337' offsetX='2' offsetY='6' /> + <image frame='1344' equals='1334' offsetX='2' offsetY='6' /> + <image frame='1345' equals='1334' offsetX='3' offsetY='6' /> + <image frame='1346' equals='1334' offsetX='3' offsetY='6' /> + <image frame='1348' equals='1347' offsetX='0' offsetY='1' /> + <image frame='1349' equals='1347' offsetX='0' offsetY='1' /> + <image frame='1350' equals='1347' offsetX='0' offsetY='1' /> + <image frame='1351' equals='1347' offsetX='0' offsetY='1' /> + <image frame='1352' equals='1347' offsetX='0' offsetY='1' /> + <image frame='1354' equals='1353' offsetX='0' offsetY='2' /> + <image frame='1355' equals='1353' offsetX='0' offsetY='2' /> + <image frame='1356' equals='1353' offsetX='0' offsetY='2' /> + <image frame='1357' equals='1353' offsetX='0' offsetY='2' /> + <image frame='1358' equals='1353' offsetX='0' offsetY='2' /> + <image frame='1360' equals='1359' offsetX='6' offsetY='6' /> + <image frame='1361' equals='1359' offsetX='6' offsetY='6' /> + <image frame='1362' equals='1359' offsetX='6' offsetY='6' /> + <image frame='1363' equals='1359' offsetX='6' offsetY='6' /> + <image frame='1365' equals='1359' offsetX='6' offsetY='6' /> + <image frame='1366' equals='1359' offsetX='6' offsetY='6' /> + <image frame='1367' equals='1359' offsetX='6' offsetY='6' /> + <image frame='1368' equals='1359' offsetX='6' offsetY='6' /> + <image frame='1369' equals='1359' offsetX='6' offsetY='6' /> + <image frame='1370' equals='1364' offsetX='8' offsetY='6' /> + <image frame='1371' equals='1359' offsetX='6' offsetY='6' /> + <image frame='1372' equals='1359' offsetX='6' offsetY='6' /> + <image frame='1373' equals='1359' offsetX='6' offsetY='6' /> + <image frame='1374' equals='1359' offsetX='6' offsetY='6' /> + <image frame='1375' equals='1359' offsetX='6' offsetY='6' /> + <image frame='1376' equals='1364' offsetX='8' offsetY='6' /> + <image frame='1377' equals='1359' offsetX='6' offsetY='6' /> + <image frame='1378' equals='1359' offsetX='6' offsetY='6' /> + <image frame='1379' equals='1359' offsetX='6' offsetY='6' /> + <image frame='1380' equals='1359' offsetX='6' offsetY='6' /> + <image frame='1381' equals='1359' offsetX='6' offsetY='6' /> + <image frame='1382' equals='1364' offsetX='8' offsetY='6' /> + <image frame='1383' equals='1359' offsetX='6' offsetY='6' /> + <image frame='1385' equals='1359' offsetX='6' offsetY='6' /> + <image frame='1386' equals='1359' offsetX='6' offsetY='6' /> + <image frame='1387' equals='1364' offsetX='8' offsetY='6' /> + <image frame='1389' equals='1347' offsetX='0' offsetY='0' /> + <image frame='1391' equals='1353' offsetX='4' offsetY='1' /> + <image frame='1392' equals='1353' offsetX='4' offsetY='1' /> + <image frame='1393' equals='1353' offsetX='4' offsetY='1' /> + <image frame='1394' equals='1353' offsetX='4' offsetY='1' /> + <image frame='1395' equals='1353' offsetX='3' offsetY='1' /> + <image frame='1396' equals='1353' offsetX='3' offsetY='1' /> + <image frame='1397' equals='1353' offsetX='3' offsetY='1' /> + <image frame='1398' equals='1353' offsetX='4' offsetY='1' /> + <image frame='1399' equals='1353' offsetX='4' offsetY='1' /> + <image frame='1400' equals='1353' offsetX='3' offsetY='1' /> + <image frame='1401' equals='1353' offsetX='3' offsetY='1' /> + <image frame='1402' equals='1353' offsetX='3' offsetY='1' /> + <image frame='1403' equals='1353' offsetX='4' offsetY='1' /> + <image frame='1404' equals='1353' offsetX='4' offsetY='1' /> + <image frame='1406' equals='1405' offsetX='3' offsetY='12' /> + <image frame='1407' equals='1405' offsetX='3' offsetY='12' /> + <image frame='1408' equals='1405' offsetX='3' offsetY='12' /> + <image frame='1409' equals='1405' offsetX='3' offsetY='12' /> + <image frame='1410' equals='1405' offsetX='3' offsetY='12' /> + <image frame='1411' equals='1405' offsetX='3' offsetY='12' /> + <image frame='1412' equals='1405' offsetX='3' offsetY='12' /> + <image frame='1413' equals='1405' offsetX='3' offsetY='12' /> + <image frame='1414' equals='1405' offsetX='3' offsetY='12' /> + <image frame='1415' equals='1405' offsetX='3' offsetY='12' /> + <image frame='1416' equals='1405' offsetX='3' offsetY='12' /> + <image frame='1418' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1419' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1420' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1421' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1422' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1423' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1424' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1425' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1426' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1427' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1428' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1429' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1430' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1431' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1432' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1433' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1434' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1435' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1436' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1437' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1438' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1439' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1440' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1441' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1442' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1443' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1444' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1445' equals='1417' offsetX='5' offsetY='9' /> + <image frame='1446' equals='1405' offsetX='6' offsetY='11' /> + <image frame='1447' equals='1405' offsetX='3' offsetY='11' /> + <image frame='1448' equals='1405' offsetX='7' offsetY='11' /> + <image frame='1449' equals='1405' offsetX='7' offsetY='11' /> + <image frame='1450' equals='1405' offsetX='7' offsetY='11' /> + <image frame='1451' equals='1405' offsetX='7' offsetY='11' /> + <image frame='1452' equals='1405' offsetX='7' offsetY='11' /> + <image frame='1453' equals='1405' offsetX='7' offsetY='11' /> + <image frame='1454' equals='1405' offsetX='6' offsetY='11' /> + <image frame='1455' equals='1405' offsetX='6' offsetY='11' /> + <image frame='1456' equals='1405' offsetX='6' offsetY='11' /> + <image frame='1457' equals='1405' offsetX='7' offsetY='11' /> + <image frame='1458' equals='1405' offsetX='7' offsetY='11' /> + <image frame='1459' equals='1405' offsetX='6' offsetY='11' /> + <image frame='1460' equals='1405' offsetX='6' offsetY='11' /> + <image frame='1461' equals='1405' offsetX='6' offsetY='11' /> + <image frame='1462' equals='1405' offsetX='7' offsetY='11' /> + <image frame='1464' equals='1463' offsetX='0' offsetY='11' /> + <image frame='1465' equals='1463' offsetX='0' offsetY='11' /> + <image frame='1466' equals='1463' offsetX='0' offsetY='11' /> + <image frame='1467' equals='1463' offsetX='0' offsetY='11' /> + <image frame='1468' equals='1463' offsetX='0' offsetY='11' /> + <image frame='1470' equals='1469' offsetX='1' offsetY='11' /> + <image frame='1473' equals='1472' offsetX='1' offsetY='11' /> + <image frame='1474' equals='1472' offsetX='1' offsetY='11' /> + <image frame='1476' equals='1475' offsetX='2' offsetY='7' /> + <image frame='1477' equals='1475' offsetX='2' offsetY='7' /> + <image frame='1478' equals='1475' offsetX='2' offsetY='7' /> + <image frame='1480' equals='1479' offsetX='2' offsetY='7' /> + <image frame='1481' equals='1475' offsetX='2' offsetY='7' /> + <image frame='1482' equals='1475' offsetX='2' offsetY='7' /> + <image frame='1483' equals='1475' offsetX='2' offsetY='7' /> + <image frame='1484' equals='1475' offsetX='2' offsetY='7' /> + <image frame='1485' equals='1475' offsetX='2' offsetY='7' /> + <image frame='1486' equals='1475' offsetX='2' offsetY='7' /> + <image frame='1487' equals='1475' offsetX='2' offsetY='7' /> + <image frame='1488' equals='1475' offsetX='2' offsetY='7' /> + <image frame='1489' equals='1475' offsetX='2' offsetY='7' /> + <image frame='1490' equals='1475' offsetX='2' offsetY='7' /> + <image frame='1491' equals='1475' offsetX='2' offsetY='7' /> + <image frame='1492' equals='1475' offsetX='2' offsetY='7' /> + <image frame='1493' equals='1475' offsetX='2' offsetY='7' /> + <image frame='1494' equals='1475' offsetX='2' offsetY='7' /> + <image frame='1495' equals='1475' offsetX='2' offsetY='7' /> + <image frame='1496' equals='1475' offsetX='2' offsetY='7' /> + <image frame='1497' equals='1475' offsetX='2' offsetY='7' /> + <image frame='1498' equals='1475' offsetX='2' offsetY='7' /> + <image frame='1499' equals='1475' offsetX='2' offsetY='7' /> + <image frame='1500' equals='1475' offsetX='2' offsetY='7' /> + <image frame='1501' equals='1475' offsetX='2' offsetY='7' /> + <image frame='1502' equals='1475' offsetX='2' offsetY='7' /> + <image frame='1503' equals='1475' offsetX='2' offsetY='7' /> + <image frame='1508' equals='1472' offsetX='5' offsetY='10' /> + <image frame='1509' equals='1472' offsetX='5' offsetY='10' /> + <image frame='1512' equals='1511' offsetX='4' offsetY='10' /> + <image frame='1513' equals='1511' offsetX='4' offsetY='10' /> + <image frame='1514' equals='1511' offsetX='4' offsetY='10' /> + <image frame='1515' equals='1511' offsetX='5' offsetY='10' /> + <image frame='1516' equals='1510' offsetX='5' offsetY='10' /> + <image frame='1517' equals='1510' offsetX='4' offsetY='10' /> + <image frame='1518' equals='1510' offsetX='4' offsetY='10' /> + <image frame='1519' equals='1510' offsetX='4' offsetY='10' /> + <image frame='1520' equals='1510' offsetX='5' offsetY='10' /> + <image frame='1522' equals='1521' offsetX='1' offsetY='12' /> + <image frame='1523' equals='1521' offsetX='1' offsetY='12' /> + <image frame='1524' equals='1521' offsetX='1' offsetY='12' /> + <image frame='1525' equals='1521' offsetX='1' offsetY='12' /> + <image frame='1526' equals='1521' offsetX='1' offsetY='12' /> + <image frame='1527' equals='1521' offsetX='1' offsetY='12' /> + <image frame='1528' equals='1521' offsetX='1' offsetY='12' /> + <image frame='1529' equals='1521' offsetX='1' offsetY='12' /> + <image frame='1530' equals='1521' offsetX='1' offsetY='12' /> + <image frame='1531' equals='1521' offsetX='1' offsetY='12' /> + <image frame='1532' equals='1521' offsetX='1' offsetY='12' /> + <image frame='1534' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1535' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1536' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1537' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1538' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1539' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1540' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1541' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1542' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1543' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1544' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1545' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1546' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1547' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1548' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1549' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1550' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1551' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1552' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1553' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1554' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1555' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1556' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1557' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1558' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1559' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1560' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1561' equals='1533' offsetX='4' offsetY='7' /> + <image frame='1563' equals='1562' offsetX='1' offsetY='11' /> + <image frame='1564' equals='1562' offsetX='5' offsetY='11' /> + <image frame='1565' equals='1562' offsetX='5' offsetY='11' /> + <image frame='1566' equals='1521' offsetX='5' offsetY='11' /> + <image frame='1567' equals='1521' offsetX='5' offsetY='11' /> + <image frame='1568' equals='1521' offsetX='5' offsetY='11' /> + <image frame='1569' equals='1521' offsetX='5' offsetY='11' /> + <image frame='1570' equals='1521' offsetX='4' offsetY='11' /> + <image frame='1571' equals='1521' offsetX='4' offsetY='11' /> + <image frame='1572' equals='1521' offsetX='4' offsetY='11' /> + <image frame='1573' equals='1521' offsetX='5' offsetY='11' /> + <image frame='1574' equals='1521' offsetX='5' offsetY='11' /> + <image frame='1575' equals='1521' offsetX='4' offsetY='11' /> + <image frame='1576' equals='1521' offsetX='4' offsetY='11' /> + <image frame='1577' equals='1521' offsetX='4' offsetY='11' /> + <image frame='1578' equals='1521' offsetX='5' offsetY='11' /> + <image frame='1580' equals='1579' offsetX='2' offsetY='11' /> + <image frame='1581' equals='1579' offsetX='2' offsetY='11' /> + <image frame='1582' equals='1579' offsetX='2' offsetY='11' /> + <image frame='1583' equals='1579' offsetX='2' offsetY='11' /> + <image frame='1584' equals='1579' offsetX='2' offsetY='11' /> + <image frame='1586' equals='1585' offsetX='2' offsetY='11' /> + <image frame='1587' equals='1579' offsetX='2' offsetY='11' /> + <image frame='1588' equals='1579' offsetX='2' offsetY='11' /> + <image frame='1589' equals='1579' offsetX='2' offsetY='11' /> + <image frame='1590' equals='1579' offsetX='2' offsetY='11' /> + <image frame='1592' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1593' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1594' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1595' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1596' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1597' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1598' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1599' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1600' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1601' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1602' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1603' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1604' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1605' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1606' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1607' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1608' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1609' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1610' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1611' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1612' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1613' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1614' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1615' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1616' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1617' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1618' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1619' equals='1591' offsetX='3' offsetY='8' /> + <image frame='1621' equals='1585' offsetX='2' offsetY='10' /> + <image frame='1622' equals='1585' offsetX='6' offsetY='10' /> + <image frame='1623' equals='1620' offsetX='6' offsetY='10' /> + <image frame='1624' equals='1579' offsetX='6' offsetY='10' /> + <image frame='1625' equals='1579' offsetX='6' offsetY='10' /> + <image frame='1626' equals='1579' offsetX='6' offsetY='10' /> + <image frame='1627' equals='1579' offsetX='6' offsetY='10' /> + <image frame='1628' equals='1579' offsetX='5' offsetY='10' /> + <image frame='1629' equals='1579' offsetX='5' offsetY='10' /> + <image frame='1630' equals='1579' offsetX='5' offsetY='10' /> + <image frame='1631' equals='1579' offsetX='6' offsetY='10' /> + <image frame='1632' equals='1579' offsetX='6' offsetY='10' /> + <image frame='1633' equals='1579' offsetX='5' offsetY='10' /> + <image frame='1634' equals='1579' offsetX='5' offsetY='10' /> + <image frame='1635' equals='1579' offsetX='5' offsetY='10' /> + <image frame='1636' equals='1579' offsetX='6' offsetY='10' /> +</tilesheet> diff --git a/games/aground/data/core/player/light128.png b/games/aground/data/core/player/light128.png new file mode 100644 index 00000000..29a9d8eb Binary files /dev/null and b/games/aground/data/core/player/light128.png differ diff --git a/games/aground/data/core/player/light192.png b/games/aground/data/core/player/light192.png new file mode 100644 index 00000000..0bbb615a Binary files /dev/null and b/games/aground/data/core/player/light192.png differ diff --git a/games/aground/data/core/player/light256.png b/games/aground/data/core/player/light256.png new file mode 100644 index 00000000..f9529e5b Binary files /dev/null and b/games/aground/data/core/player/light256.png differ diff --git a/games/aground/data/core/player/light32.png b/games/aground/data/core/player/light32.png new file mode 100644 index 00000000..6b743802 Binary files /dev/null and b/games/aground/data/core/player/light32.png differ diff --git a/games/aground/data/core/player/light64.png b/games/aground/data/core/player/light64.png new file mode 100644 index 00000000..4807801c Binary files /dev/null and b/games/aground/data/core/player/light64.png differ diff --git a/games/aground/data/core/player/player.xml b/games/aground/data/core/player/player.xml new file mode 100644 index 00000000..a807d3d2 --- /dev/null +++ b/games/aground/data/core/player/player.xml @@ -0,0 +1,271 @@ +<?xml version="1.0" encoding="utf-8" ?> +<data> + <include id="layers.xml" includeRoot="true" /> + <tile id="player.layers" sheet="layers.png" /> + <layers id="player" width="16" height="16" cols="11" rows="6"> + <layer tile="player.layers" color="skin"><!-- body --> + <frame x="257" length="8" /> + <frame x="20" count="10" /> + <frame x="46" count="6" /> + <frame x="112" count="41" /> + </layer> + <layer tile="player.layers" color="eyes"><!-- eyes --> + <frame x="256" /><frame visible="false" /><frame x="256" length="6" /> + <frame x="10" count="10" /> + <frame visible="false" length="10" /> + <frame x="108" count="2" /> + </layer> + <layer tile="player.layers"><!-- mouth --> + <frame visible="false" length="18" /> + <frame x="58" count="6" /> + <frame x="194" count="41" /> + </layer> + <layer tile="player.layers" color="hair" offset="hair"><!-- hair --> + <frame x="57" length="8" /> + <frame x="47" count="10" /> + <frame x="41" count="6" /> + <frame x="0" count="41" /> + </layer> + <layer tile="player.layers" color="shirt" offset="shirt"><!-- shirt --> + <frame x="47" length="8" /> + <frame x="48" count="10" /> + <frame x="41" count="6" /> + <frame x="0" count="41" /> + </layer> + <layer tile="player.layers" color="pants" offset="pants"><!-- pants --> + <frame x="47" length="8" /> + <frame x="48" count="10" /> + <frame x="41" count="6" /> + <frame x="0" count="41" /> + </layer> + <layer tile="player.layers" color="skin"><!-- arms --> + <frame x="259" length="3" /><frame visible="false" length="5" /> + <frame x="0" count="10" /> + <frame x="40" count="6" /> + <frame x="67" count="41" /> + </layer> + <layer tile="player.layers" color="skin"><!-- legs --> + <frame x="258" length="2" /><frame x="260" /><frame x="271" count="4" /><frame visible="false" /> + <frame x="30" count="10" /> + <frame x="52" count="6" /> + <frame x="153" count="41" /> + </layer> + <layer tile="player.layers"><!-- uncolored --> + <frame visible="false" length="18" /> + <frame x="64" count="2" /><frame visible="false" /><frame x="66" /><!-- hit stars --> + <frame visible="false" length="8" /> + <frame x="110" count="2" /><!-- dead eyes --> + </layer> + <layer tile="player.layers"><!-- uncolored --> + <frame visible="false" length="24" /> + <frame x="235" count="6" /><frame visible="false" /> + <frame x="241" count="11" /><frame visible="false" length="4" /> + <frame x="252" count="2" /><frame visible="false" length="4" /> + <frame x="254" count="2" /> + </layer> + </layers> + <animation id="player.idle"> + <frame x="0" length="4" /> + <frame x="1" length="2" /> + <frame x="0" length="32" /> + </animation> + <animation id="player.sleep" x="1" count="1" /> + <animation id="player.walk" count="10" x="8" /> + <animation id="player.walk.sweat"><frame visible="false" length="2" /><frame count="8" x="449" /></animation> + <animation id="player.walk.heavy" count="10" x="8"> + <append tile="player.layers" animation="player.walk.sweat" /> + </animation> + <animation id="player.swim" count="5" x="3" length="2" /> + <animation id="player.swim.arms" tile="player.layers" count="5" x="261" length="2" /> + <animation id="player.swim.top" tile="player.layers" count="5" x="266" length="2" /> + <animation id="player.mine" count="1" length="10" x="0" /> + <animation id="player.mine2" count="1" length="10" x="0" /> + <animation id="player.mine3" count="1" length="10" x="0"> + <append tile="player.layers" animation="player.walk.sweat" /> + </animation> + <animation id="player.hit" count="6" x="18" /> + <animation id="player.death" count="41" x="24" /> + <animation id="player.ride" x="2" count="1" /> + <tile id="backpack" sheet="layers.png" x="467" /> + + <tile id="death" sheet="death.png" x="0" y="0" /> + <animation id="death" count="10"> + <frame visible="false" /> + </animation> + + <skill id="health" name="stats.health" start_cost="6" cost_per_level="2"> + <stat id="health" value="10" /> + </skill> + <skill id="stamina" name="stats.stamina" start_cost="6" cost_per_level="2"> + <stat id="stamina" value="50" /> + </skill> + <skill id="weight" name="stats.weight" start_cost="8" cost_per_level="2"> + <stat id="weight" value="5" /> + </skill> + <skill id="mine_speed" name="stats.mine_speed" start_cost="20" cost_per_level="10" flag="allow_hotkeys" > + <stat id="mine_speed" value="1" /> + </skill> + <skill id="sight" name="stats.sight" start_cost="30" cost_per_level="15" flag="allow_hotkeys" > + <stat id="sight" value="1" /> + </skill> + <skill id="evasion" name="stats.evasion" start_cost="6" cost_per_level="2"> + <stat id="evasion" value="3" /> + </skill> + <skill id="critical" name="stats.critical" start_cost="6" cost_per_level="2"> + <stat id="critical" value="5" /> + </skill> + <skill id="attack" name="stats.attack" start_cost="50" cost_per_level="25"> + <stat id="attack" value="1" /> + </skill> + <skill id="cut" name="stats.cut" start_cost="50" cost_per_level="25"> + <stat id="cut" value="1" /> + </skill> + <skill id="defense" name="stats.defense" start_cost="50" cost_per_level="25"> + <stat id="defense" value="1" /> + </skill> + <skill id="range" name="stats.range" start_cost="20" cost_per_level="10"> + <stat id="range" value="1" /> + </skill> + <skill id="fishing" name="stats.fishing" start_cost="50" cost_per_level="25" flag="fisherman_intro"> + <stat id="fishing" value="1" /> + </skill> + <skill id="trap" name="stats.trap" start_cost="50" cost_per_level="25" flag="hunter_hut"> + <stat id="trap" value="1" /> + </skill> + <skill id="bargaining" name="stats.bargaining" start_cost="20" cost_per_level="0" flag="allow_hotkeys"> + <stat id="bargaining" value="1" /> + </skill> + <skill id="spellcast" name="stats.spellcast" start_cost="20" cost_per_level="10" flag="spellcast"> + <stat id="spellcast" value="1" /> + </skill> + <skill id="oxygen" name="stats.oxygen" start_cost="10" cost_per_level="5" flag="show_oxygen"> + <stat id="oxygen" value="5" /> + </skill> + <procedure id="player.addItem"> + <achievement id="full_dragon" if="player.hasSeenItem('dragon_armor') && player.hasSeenItem('dragonflame') && player.hasSeenItem('baby_cannon') && player.hasSeenItem('dragonsword')" /> + <item id="dismantle" hidden="true" if="player.hasItemType('blueprint') && !player.hasItem('dismantle')" /> + </procedure> + <procedure id="player.changeEquip"> + <achievement id="full_cyborg" if="player.hasItem('machine_gun_arm') && player.hasItem('cyborg_body') && player.hasItem('cyborg_eye') && player.hasItem('cyborg_back')" /> + </procedure> + <procedure id="player.handleSecond"><action> + var h = player.stats.getInt("regen_health"); if(h > 0) player.addHealth(h); else if(h < 0) player.loseHealth(-h); + var s = player.stats.getInt("regen_stamina"); if(s > 0) player.addStamina(s); else if(s < 0) player.loseStamina(-s); + var p = player.stats.getInt("regen_power"); if(p > 0) player.addStorage("power", p); else if(p < 0) player.losePower(-p); + </action></procedure> + <procedure id="player.init"> + <action if="player.getItemCount('hide_slot') == 0">player.inventory.addItems(getItem("hide_slot"), 20);</action> + <item id="storehouse_blueprint" hidden="true" if="!player.hasItem('storehouse_blueprint') && (player.questComplete('storehouse') || player.questComplete('storehouse2'))" /> + <item id="kitchen_blueprint" hidden="true" if="!player.hasItem('kitchen_blueprint') && player.questComplete('kitchen')" /> + <item id="kitchen_upgrade" hidden="true" if="!player.hasItem('kitchen_upgrade') && player.questComplete('kitchen2')" /> + <item id="smelter_blueprint" hidden="true" if="!player.hasItem('smelter_blueprint') && player.questComplete('smelter')" /> + <item id="workshop_blueprint" hidden="true" if="!player.hasItem('workshop_blueprint') && player.questComplete('workshop')" /> + <item id="farm_blueprint" hidden="true" if="!player.hasItem('farm_blueprint') && player.questComplete('farm')" /> + <item id="pen_blueprint" hidden="true" if="!player.hasItem('pen_blueprint') && player.questComplete('pen')" /> + <item id="dock_blueprint" hidden="true" if="!player.hasItem('dock_blueprint') && (player.questComplete('dock') || player.questComplete('dock2'))" /> + <item id="power_plant_blueprint" hidden="true" if="!player.hasItem('power_plant_blueprint') && player.questComplete('powerplant')" /> + <item id="workshop_upgrade" hidden="true" if="!player.hasItem('workshop_upgrade') && player.questComplete('factory')" /> + <item id="elevator_blueprint" hidden="true" if="!player.hasItem('elevator_blueprint') && player.questComplete('elevator')" /> + </procedure> + <onLoad><action if="player.areas.exists('science1') || player.areas.exists('magic1')">setFlag('jump_water', true)</action></onLoad> + <player id="player.ancient" layers="player" health="50" stamina="200" maxLevel="30" speed="15" talk_sfx="talking5" foundItemPopup="true" beardLayer="armor"> + <skill id="health" maxLevel="20" /><skill id="stamina" maxLevel="20" /><skill id="weight" maxLevel="20" /> + <skill id="critical" maxLevel="10" /><skill id="evasion" maxLevel="10" /> + <skill id="mine_speed" maxLevel="5" /><skill id="sight" maxLevel="3" /> + <skill id="attack" maxLevel="3" /><skill id="defense" maxLevel="3" /><skill id="cut" maxLevel="3" /> + <skill id="range" maxLevel="5" /><skill id="trap" maxLevel="3" /><skill id="bargaining" maxLevel="5" /> + <skill id="fishing" maxLevel="3" /><skill id="oxygen" maxLevel="8" /><skill id="spellcast" maxLevel="5" /> + <stat id="health" /><stat id="stamina" /><stat id="regen_health" flag="never_set" /><stat id="regen_stamina" flag="never_set" /> + <stat id="weight" /><stat id="critical" /><stat id="evasion" /> + <stat id="speed" /><stat id="endurance" /><stat id="mine_speed" flag="allow_hotkeys" /><stat id="sight" flag="allow_hotkeys" /> + <stat id="attack" /><stat id="defense" /><stat id="cut" /><stat id="mine" flag="allow_hotkeys" /> + <stat id="range" /><stat id="trap" flag="hunter_hut" /><stat id="fishing" flag="fisherman_intro" /> + <stat id="oxygen" flag="show_oxygen" /><stat id="bargaining" flag="allow_hotkeys" /> + <stat id="spellcast" flag="spellcast" /><stat id="reset" flag="never_set" /><stat id="timer" flag="never_set" /> + <stat id="regen_power" flag="never_set" /><stat id="light" flag="never_set" /> + <slot id="weapon" /><slot id="shield" renderPriority="4" /><slot id="pickaxe" flag="allow_hotkeys" /><slot id="armor" vanity="true" renderPriority="1" /> + <slot id="head" vanity="true" renderPriority="3" /><slot id="back" vanity="true" renderPriority="2" /><slot id="familiar" /><light tile="light.small" color="888888" /> + <color id="skin" /><color id="hair" /><offset id="hair" /><offset id="beard" /><color id="eyes" /> + <color id="shirt" /><offset id="shirt" /><color id="pants" /><offset id="pants" value="275" /> + <addItem><run procedure="player.addItem" /></addItem> + <changeEquip><run procedure="player.changeEquip" /></changeEquip> + <adjustSkills><achievement id="skills" if="player.getUsedSkillPoints() >= 500" /></adjustSkills> + <init><run procedure="player.init" /></init> + <handleSecond><run procedure="player.handleSecond" /></handleSecond> + </player> + + <tilesheet id="light32.png" width="32" height="32" /> + <tile id="light.small" sheet="light32.png" /> + <tilesheet id="light64.png" width="64" height="64" /> + <tile id="light.medium" sheet="light64.png" /> + <tilesheet id="light128.png" width="128" height="128" /> + <tile id="light.default" sheet="light128.png" /> + <tilesheet id="light192.png" width="192" height="192" /> + <tile id="light.large" sheet="light192.png" /> + <tile id="light.strong" x="1" sheet="light192.png" /> + <tilesheet id="light256.png" width="256" height="256" /> + <tile id="light.largest" sheet="light256.png" /> + + <colors type="skin"> + <color value="dfcbb3" /> + <color value="dbba94" /> + <color value="bd9568" /> + <color value="9c7140" /> + <color value="81592c" /> + <color value="4d3315" /> + <color value="2f1e0b" /> + <color value="1a1004" /> + </colors> + <colors type="hair"> + <color value="130e01" id="black" /> + <color value="2d2105" id="dbrown" /> + <color value="4b390d" id="lbrown" /> + <color value="9fc1bb" id="gray" /> + <color value="bfa861" id="blond" /> + <color value="b49025" id="dblond" /> + <color value="5e310d" id="brown" /> + <color value="a75719" id="red" /> + </colors> + <colors type="eyes"> + <color value="130e01" id="black" /> + <color value="2a3f47" id="dblue" /> + <color value="5ab1ea" id="lblue" /> + <color value="82ea5a" id="lgreen" /> + <color value="2f1b04" id="dbrown" /> + <color value="265cc5" id="blue" /> + <color value="0a7817" id="green"/> + <color value="f6c757" id="yellow" /> + <color value="4d2a02" id="brown" /> + <color value="3d2242" id="purple" /> + <color value="d02f2f" id="red" /> + </colors> + <colors type="shirt"> + <color value="0099cc" id="blue" /> + <color value="cf2b2b" id="red" /> + <color value="d6639d" id="pink" /> + <color value="fff3dd" id="white" /> + <color value="719510" id="green" /> + <color value="916fb5" id="purple" /> + <color value="88eeff" id="lblue" /> + <color value="8e6548" id="brown" /> + <color value="e79339" id="orange" /> + <color value="42c697" id="teal" /> + <color value="f7db63" id="yellow" /> + <color value="898989" id="gray" /> + </colors> + <colors type="pants" equals="shirt" /> + <offsets type="hair" addHidden="true"> + <offset start="477" count="16" stride="58" /> + </offsets> + <offsets type="shirt"><offset value="333" id="open" /><offset value="391" id="closed" /></offsets> + + <animation id="player.beard.idle" x="47" count="1" /> + <animation id="player.beard.walk" x="48" count="10" /> + <animation id="player.beard.hit" x="41" count="6" /> + <animation id="player.beard.death" x="0" count="41" /> + <offsets type="beard" addHidden="true"> + <offset tile="player.layers" start="1405" count="2" stride="58" /> + <offset tile="player.layers" value="1521" overBack="true" /> + <offset tile="player.layers" value="1579" /> + </offsets> +</data> \ No newline at end of file diff --git a/games/aground/data/core/scenes/hunter/forest.png b/games/aground/data/core/scenes/hunter/forest.png new file mode 100644 index 00000000..a29b1ddc Binary files /dev/null and b/games/aground/data/core/scenes/hunter/forest.png differ diff --git a/games/aground/data/core/scenes/hunter/hunter.png b/games/aground/data/core/scenes/hunter/hunter.png new file mode 100644 index 00000000..e72905db Binary files /dev/null and b/games/aground/data/core/scenes/hunter/hunter.png differ diff --git a/games/aground/data/core/scenes/hunter/hunter.xml b/games/aground/data/core/scenes/hunter/hunter.xml new file mode 100644 index 00000000..7de2b296 --- /dev/null +++ b/games/aground/data/core/scenes/hunter/hunter.xml @@ -0,0 +1,57 @@ +<tilesheet id='hunter.png' width='256' height='144'> + <image frame='0' x='0' y='0' width='111' height='97' offsetX='27' offsetY='47' /> + <image frame='1' x='111' y='0' width='111' height='97' offsetX='27' offsetY='47' /> + <image frame='2' x='222' y='0' width='111' height='97' offsetX='27' offsetY='47' /> + <image frame='3' x='333' y='0' width='111' height='97' offsetX='27' offsetY='47' /> + <image frame='4' x='444' y='0' width='111' height='97' offsetX='27' offsetY='47' /> + <image frame='7' x='555' y='0' width='111' height='97' offsetX='27' offsetY='47' /> + <image frame='11' x='0' y='97' width='152' height='97' offsetX='27' offsetY='47' /> + <image frame='12' x='0' y='194' width='152' height='97' offsetX='27' offsetY='47' /> + <image frame='13' x='0' y='291' width='152' height='97' offsetX='27' offsetY='47' /> + <image frame='16' x='0' y='388' width='152' height='97' offsetX='27' offsetY='47' /> + <image frame='17' x='0' y='485' width='151' height='97' offsetX='27' offsetY='47' /> + <image frame='19' x='0' y='582' width='151' height='97' offsetX='27' offsetY='47' /> + <image frame='22' x='152' y='97' width='151' height='97' offsetX='27' offsetY='47' /> + <image frame='23' x='152' y='194' width='151' height='99' offsetX='27' offsetY='45' /> + <image frame='24' x='303' y='194' width='151' height='99' offsetX='27' offsetY='45' /> + <image frame='25' x='454' y='194' width='151' height='99' offsetX='27' offsetY='45' /> + <image frame='26' x='605' y='194' width='151' height='99' offsetX='27' offsetY='45' /> + <image frame='27' x='152' y='293' width='151' height='99' offsetX='27' offsetY='45' /> + <image frame='28' x='303' y='293' width='152' height='99' offsetX='26' offsetY='45' /> + <image frame='29' x='303' y='392' width='155' height='102' offsetX='23' offsetY='42' /> + <image frame='30' x='455' y='293' width='154' height='99' offsetX='24' offsetY='45' /> + <image frame='31' x='303' y='97' width='155' height='97' offsetX='23' offsetY='47' /> + <image frame='32' x='458' y='97' width='151' height='97' offsetX='27' offsetY='47' /> + <image frame='33' x='609' y='97' width='151' height='97' offsetX='27' offsetY='47' /> + <image frame='34' x='152' y='392' width='151' height='97' offsetX='27' offsetY='47' /> + <image frame='35' x='609' y='293' width='152' height='97' offsetX='27' offsetY='47' /> + <image frame='36' x='303' y='494' width='152' height='97' offsetX='27' offsetY='47' /> + <image frame='37' x='303' y='591' width='152' height='97' offsetX='27' offsetY='47' /> + <image frame='38' x='458' y='392' width='152' height='97' offsetX='27' offsetY='47' /> + <image frame='39' x='152' y='489' width='151' height='97' offsetX='27' offsetY='47' /> + <image frame='40' x='152' y='586' width='151' height='97' offsetX='27' offsetY='47' /> + <image frame='41' x='610' y='392' width='151' height='97' offsetX='27' offsetY='47' /> + <image frame='42' x='458' y='489' width='151' height='97' offsetX='27' offsetY='47' /> + <image frame='43' x='609' y='489' width='151' height='97' offsetX='27' offsetY='47' /> + <image frame='45' x='666' y='0' width='74' height='92' offsetX='48' offsetY='47' /> + <image frame='46' x='0' y='679' width='74' height='92' offsetX='48' offsetY='47' /> + <image frame='47' x='74' y='679' width='74' height='92' offsetX='48' offsetY='47' /> + <image frame='48' x='458' y='586' width='74' height='92' offsetX='48' offsetY='47' /> + <image frame='49' x='458' y='678' width='74' height='92' offsetX='48' offsetY='47' /> + <image frame='50' x='532' y='586' width='74' height='92' offsetX='48' offsetY='47' /> + <image frame='51' x='532' y='678' width='74' height='92' offsetX='48' offsetY='47' /> + <image frame='52' x='606' y='586' width='74' height='92' offsetX='48' offsetY='47' /> + <image frame='53' x='680' y='586' width='74' height='92' offsetX='48' offsetY='47' /> + <image frame='54' x='606' y='678' width='74' height='92' offsetX='48' offsetY='47' /> + <image frame='5' equals='0' offsetX='27' offsetY='47' /> + <image frame='6' equals='0' offsetX='27' offsetY='47' /> + <image frame='8' equals='2' offsetX='27' offsetY='47' /> + <image frame='9' equals='4' offsetX='27' offsetY='47' /> + <image frame='10' equals='4' offsetX='27' offsetY='47' /> + <image frame='14' equals='12' offsetX='27' offsetY='47' /> + <image frame='15' equals='12' offsetX='27' offsetY='47' /> + <image frame='18' equals='17' offsetX='27' offsetY='47' /> + <image frame='20' equals='17' offsetX='27' offsetY='47' /> + <image frame='21' equals='17' offsetX='27' offsetY='47' /> + <image frame='44' equals='40' offsetX='27' offsetY='47' /> +</tilesheet> diff --git a/games/aground/data/core/scenes/hunter/scene.xml b/games/aground/data/core/scenes/hunter/scene.xml new file mode 100644 index 00000000..fe6efa57 --- /dev/null +++ b/games/aground/data/core/scenes/hunter/scene.xml @@ -0,0 +1,85 @@ +<?xml version="1.0" encoding="utf-8" ?> +<scenes> + <include id="hunter.xml" includeRoot="true" /> + <tile id="hires.hunter" sheet="hunter.png" x="0" y="0" /> + <animation id="hires.hunter.idle"> + <frame x="12" count="11" /> + <frame x="0" count="12" /> + <frame x="12" count="11" /> + </animation> + <animation id="hires.hunter.hood"> + <frame x="23" length="15" /> + <frame x="24" count="11" /> + </animation> + <animation id="hires.hunter.talk" x="35" count="10" /> + <animation id="hires.hunter.firelight" x="45" count="10" /> + + <scene id="hunter"> + <tilesheet id="wolf.png" width="98" height="94" /> + <tile id="wolf" sheet="wolf.png" x="0" y="0" /> + <animation id="wolf.idle"> + <frame x="0" y="0" length="4" /> + <frame x="1" y="0" length="2" /> + <frame x="0" y="0" length="32" /> + </animation> + <layer id="tent" image="tent.png" /> + <layer id="forest" image="forest.png" /> + <layer id="hunter" tile="hires.hunter" animation="hires.hunter.idle" talk="hires.hunter.talk" x="0" y="0" /> + <layer id="wolf" tile="wolf" animation="wolf.idle" x="152" y="50" /> + + <show id="first"> + <layer id="forest" /> + <layer id="hunter" /> + <play object="hunter" animation="hires.hunter.hood" /> + <dialogue section="hunter" id="intro1" speaker='hunter' /> + <dialogue section="hunter" id="intro2" speaker='player' /> + <dialogue section="hunter" id="intro3" speaker='hunter' /> + <menu section="trader"> + <dialogue section="hunter" id="intro4" /> + <choice id="accept"> + <run procedure="hunter.deal" /> + </choice> + <choice id="reject"> + <dialogue section="hunter" id="reject1" speaker="player" /> + <dialogue section="hunter" id="reject2" speaker="hunter" /> + </choice> + </menu> + <wait seconds="0.5" /> + </show> + <show id="second"> + <layer id="tent" /> + <layer id="hunter" /> + <wait seconds="1" /> + <dialogue section="hunter" id="tent3" speaker='hunter' /> + <dialogue section="hunter" id="tent4" speaker='player' /> + <dialogue section="hunter" id="tent5" speaker='hunter' /> + <dialogue section="hunter" id="tent6" speaker='hunter' /> + <wait seconds="1" /> + </show> + <show id="third"> + <layer id="tent" /> + <layer id="hunter" /> + <wait seconds="1" /> + <dialogue section="hunter" id="tent7" speaker='player' /> + <dialogue section="hunter" id="tent8" speaker='hunter' /> + <dialogue section="hunter" id="tent9" speaker='player' /> + <dialogue section="hunter" id="tent10" speaker='hunter' /> + <dialogue section="hunter" id="tent11" speaker='player' /> + <dialogue section="hunter" id="tent12" speaker='hunter' /> + <wait seconds="1" /> + </show> + <show id="fourth"> + <layer id="forest" /> + <layer id="hunter" /> + <layer id="wolf" /><hide id="wolf" /> + <wait seconds="1" /> + <dialogue section="hunter" id="wolf5" speaker='hunter' /> + <show id="wolf" with="fade" /> + <dialogue section="hunter" id="wolf6" speaker='hunter' /> + <item id="wolf" /><equip id="wolf" ifEmpty="true" /> + <lerp object="wolf" alpha="0" seconds="0.5" /> + <dialogue section="hunter" id="wolf7" speaker='hunter' /> + <wait seconds="1" /> + </show> + </scene> +</scenes> \ No newline at end of file diff --git a/games/aground/data/core/scenes/hunter/tent.png b/games/aground/data/core/scenes/hunter/tent.png new file mode 100644 index 00000000..f844e43f Binary files /dev/null and b/games/aground/data/core/scenes/hunter/tent.png differ diff --git a/games/aground/data/core/scenes/hunter/wolf.png b/games/aground/data/core/scenes/hunter/wolf.png new file mode 100644 index 00000000..a06092de Binary files /dev/null and b/games/aground/data/core/scenes/hunter/wolf.png differ diff --git a/games/aground/data/core/scenes/hut/alchemist.png b/games/aground/data/core/scenes/hut/alchemist.png new file mode 100644 index 00000000..cc87790e Binary files /dev/null and b/games/aground/data/core/scenes/hut/alchemist.png differ diff --git a/games/aground/data/core/scenes/hut/builder.png b/games/aground/data/core/scenes/hut/builder.png new file mode 100644 index 00000000..0e293308 Binary files /dev/null and b/games/aground/data/core/scenes/hut/builder.png differ diff --git a/games/aground/data/core/scenes/hut/farmer.png b/games/aground/data/core/scenes/hut/farmer.png new file mode 100644 index 00000000..e855b8fe Binary files /dev/null and b/games/aground/data/core/scenes/hut/farmer.png differ diff --git a/games/aground/data/core/scenes/hut/fire.png b/games/aground/data/core/scenes/hut/fire.png new file mode 100644 index 00000000..9ec6f487 Binary files /dev/null and b/games/aground/data/core/scenes/hut/fire.png differ diff --git a/games/aground/data/core/scenes/hut/hut.png b/games/aground/data/core/scenes/hut/hut.png new file mode 100644 index 00000000..7f7e3804 Binary files /dev/null and b/games/aground/data/core/scenes/hut/hut.png differ diff --git a/games/aground/data/core/scenes/hut/miner.png b/games/aground/data/core/scenes/hut/miner.png new file mode 100644 index 00000000..58070390 Binary files /dev/null and b/games/aground/data/core/scenes/hut/miner.png differ diff --git a/games/aground/data/core/scenes/hut/scene.xml b/games/aground/data/core/scenes/hut/scene.xml new file mode 100644 index 00000000..37690155 --- /dev/null +++ b/games/aground/data/core/scenes/hut/scene.xml @@ -0,0 +1,217 @@ +<?xml version="1.0" encoding="utf-8" ?> +<scenes> + <scene id="hut"> + <tilesheet id="builder.png" width="92" height="67" /> + <tile id="builder" sheet="builder.png" x="0" y="0" /> + <animation id="builder.idle" count="13"> + <frame x="13" count="24" /> + <frame x="25" count="12" /> + <frame x="1" count="12" /> + </animation> + <animation id="builder.talk" x="37" count="12" /> + + <tilesheet id="miner.png" width="77" height="60" /> + <tile id="miner" sheet="miner.png" x="0" y="0" /> + <animation id="miner.idle" count="13"> + <frame x="13" count="15" /> + <frame x="1" count="12" /> + </animation> + <animation id="miner.talk" x="28" count="12" /> + + <tilesheet id="farmer.png" width="102" height="83" /> + <tile id="farmer" sheet="farmer.png" x="0" y="0" /> + <animation id="farmer.idle" count="12"> + <frame x="12" count="15" /> + <frame x="1" count="11" /> + <frame x="12" count="15" /> + <frame x="27" count="15" /> + <frame x="27" count="15" /> + <frame x="12" count="15" /> + <frame x="1" count="11" /> + </animation> + <animation id="farmer.talk"> + <frame x="42" count="6" offsetX="-4" /> + <frame x="48" count="9" /> + </animation> + + <tilesheet id="trader.png" width="108" height="80" /> + <tile id="trader" sheet="trader.png" x="0" y="0" /> + <animation id="trader.idle" count="13"> + <frame x="13" count="8" /> + <frame x="13" count="8" /> + <frame x="1" count="12" /> + </animation> + <animation id="trader.talk" x="21" count="12" /> + + <tilesheet id="alchemist.png" width="62" height="74" /> + <tile id="alchemist" sheet="alchemist.png" x="0" y="0" /> + <animation id="alchemist.idle"> + <frame visible="false" length="20" /> + <frame x="0" count="7" /> + <frame x="7" length="4" /> + <frame x="8" length="2" /> + <frame x="7" length="4" /> + <frame x="9" count="8" repeat="2" /> + <frame x="7" length="4" /> + <frame x="8" length="2" /> + <frame x="7" length="4" /> + <frame x="9" count="8" repeat="2" /> + <frame x="7" length="4" /> + <frame x="0" count="7" reverse="true" /> + </animation> + + <tilesheet id="fire.png" width="91" height="122" /> + <tile id="fire" sheet="fire.png" x="0" y="0" /> + <animation id="fire"> + <frame x="0" y="0" offsetX="97" /> + <frame x="1" y="0" offsetX="81" /> + <frame x="2" y="0" offsetX="82" /> + <frame x="3" y="0" offsetX="74" /> + <frame x="0" y="1" offsetX="82" /> + <frame x="1" y="1" offsetX="75" /> + <frame x="2" y="1" offsetX="78" /> + <frame x="3" y="1" offsetX="79" /> + <frame x="0" y="2" offsetX="88" /> + <frame x="1" y="2" offsetX="85" /> + <frame x="2" y="2" offsetX="82" /> + <frame x="3" y="2" offsetX="96" /> + </animation> + <layer id="bg" image="hut.png" /> + <layer id="builder" tile="builder" animation="builder.idle" talk="builder.talk" x="164" y="77" /> + <layer id="miner" tile="miner" animation="miner.idle" talk="miner.talk" y="84" /> + <layer id="farmer" tile="farmer" animation="farmer.idle" talk="farmer.talk" x="48" y="61" /> + <layer id="trader" tile="trader" animation="trader.idle" talk="trader.talk" x="92" y="64" /> + <layer id="alchemist" tile="alchemist" animation="alchemist.idle" x="194" y="18" /> + <layer id="hunter" tile="hires.hunter" animation="hires.hunter.idle" talk="hires.hunter.talk" x="0" y="5" /> + <layer id="hunter_firelight" tile="hires.hunter" animation="hires.hunter.firelight" x="0" y="5" /> + <layer id="fire" tile="fire" animation="fire" y="22" /> + + <show id="first" sound="fire"> + <layer id="bg" /> + <layer id="builder" /> + <layer id="fire" /><hide id="builder" /> + <action>player.fullRestore(); mine(92, 0);</action> + <structure id="hut" x="34" /> + <wait seconds="1" /> + <dialogue section="scene.hut" id="first1" /> + <wait seconds="1" /> + <dialogue section="scene.hut" id="first2" speaker="builder" /> + <menu section="common"> + <dialogue section="scene.hut" id="first3" /> + <choice id="yes"> + <object id="builder" x="40" name="builder_object" /> + <lerp object="builder" alpha="1" seconds="0.25" /> + <dialogue section="scene.hut" id="first4" speaker='builder' /> + <dialogue section="scene.hut" id="first5" speaker="player" /> + <dialogue section="scene.hut" id="first6" speaker='builder' /> + <dialogue section="scene.hut" id="first7" speaker='builder' /> + <dialogue section="scene.hut" id="first8" speaker="player" /> + <wait seconds="1" /> + </choice> + <choice id="no"> + <object id="builder.corpse" x="40" /> + <dialogue section="scene.hut" id="first9" speaker="builder" /> + <wait seconds="2" /> + <object id="rat" x="39" facing="right" /> + <object id="rat" x="41" /> + </choice> + </menu> + <weather type="storm" stop="0" /> + <save /><setTime value="6" frames="40" /> + <runAreaLoad /> + </show> + <show id="second"> + <layer id="bg" /> + <layer id="alchemist" if="player.hasQuest('lab') && area.getNPC('alchemist') != null" /> + <layer id="farmer" if="player.hasQuest('farm')" /> + <layer id="trader" if="player.hasQuest('market')" /> + <layer id="miner" /> + <layer id="builder" if="player.hasQuest('storehouse')" /> + <layer id="fire" /> + <wait seconds="1" /> + <dialogue section="scene.hut" id="second1" speaker="miner" /> + <dialogue section="scene.hut" id="second2" speaker="miner" /> + <dialogue section="scene.hut" id="second3" speaker="player" /> + <dialogue section="scene.hut" id="second4" speaker="miner" /> + <wait seconds="1" /> + </show> + <show id="third"> + <layer id="bg" /> + <layer id="alchemist" if="player.hasQuest('lab') && area.getNPC('alchemist') != null" /> + <layer id="farmer" /> + <layer id="trader" if="player.hasQuest('market')" /> + <layer id="miner" /> + <layer id="builder" if="player.hasQuest('storehouse')" /> + <layer id="fire" /> + <wait seconds="1" /> + <dialogue section="scene.hut" id="third1" speaker="farmer" /> + <dialogue section="scene.hut" id="third2" speaker="farmer" /> + <section if="player.hasQuest('storehouse')"> + <dialogue section="scene.hut" id="third3" speaker="builder" /> + <dialogue section="scene.hut" id="third4" speaker="farmer" /> + </section> + <wait seconds="1" /> + </show> + <show id="fourth"> + <layer id="bg" /> + <layer id="alchemist" if="player.hasQuest('lab') && area.getNPC('alchemist') != null" /> + <layer id="farmer" /> + <layer id="trader" /> + <layer id="miner" /> + <layer id="builder" if="player.hasQuest('storehouse')" /> + <layer id="fire" /> + <wait seconds="1" /> + <dialogue section="scene.hut" id="fourth1" speaker="player" /> + <dialogue section="scene.hut" id="fourth2" speaker="trader" /> + <dialogue section="scene.hut" id="fourth3" speaker="trader" /> + <dialogue section="scene.hut" id="fourth4" speaker="player" /> + <dialogue section="scene.hut" id="fourth5" speaker="trader" /> + <wait seconds="1" /> + </show> + <show id="hunter"> + <layer id="bg" /> + <layer id="alchemist" if="player.hasQuest('lab') && area.getNPC('alchemist') != null" /> + <layer id="hunter" /> + <layer id="hunter_firelight" /> + <layer id="trader" if="player.hasQuest('market')" /> + <layer id="miner" /> + <layer id="builder" if="player.hasQuest('storehouse')" /> + <layer id="fire" /> + <wait seconds="1" /> + <dialogue section="scene.hut" id="hunter1" speaker="player" /> + <dialogue section="scene.hut" id="hunter2" speaker="hunter" /> + <dialogue section="scene.hut" id="hunter3" speaker="player" /> + <dialogue section="scene.hut" id="hunter4" speaker="hunter" /> + <dialogue section="scene.hut" id="hunter5" speaker="hunter" /> + <wait seconds="1" /> + </show> + <show id="mirrows"> + <layer id="bg" /> + <layer id="alchemist" if="player.hasQuest('lab') && area.getNPC('alchemist') != null" /> + <choose> + <section if="player.hasQuest('hunt') && area.getObject('hunter') != null"> + <layer id="hunter" /> + <layer id="hunter_firelight" /> + </section> + <layer id="farmer" /> + </choose> + <layer id="trader" if="player.hasQuest('market')" /> + <layer id="miner" /> + <layer id="builder" if="player.hasQuest('storehouse')" /> + <layer id="fire" /> + <wait seconds="1" /> + <dialogue section="scene.hut" id="mirrows1" speaker="player.hasQuest('storehouse')?builder:miner" /> + <dialogue section="scene.hut" id="mirrows2" speaker="player" /> + <dialogue section="scene.hut" id="mirrows3" speaker="player" /> + <section if="player.hasQuest('hunt') && area.getObject('hunter') != null"> + <dialogue section="scene.hut" id="mirrows4" speaker="hunter" /> + <dialogue section="scene.hut" id="mirrows5" speaker="player" /> + <dialogue section="scene.hut" id="mirrows6" speaker="hunter" /> + <dialogue section="scene.hut" id="mirrows7" speaker="hunter" /> + </section> + <dialogue section="scene.hut" id="mirrows8" speaker="miner" /> + <dialogue section="scene.hut" id="mirrows9" speaker="farmer" if="!player.hasQuest('hunt')" /> + <wait seconds="1" /> + </show> + </scene> +</scenes> \ No newline at end of file diff --git a/games/aground/data/core/scenes/hut/trader.png b/games/aground/data/core/scenes/hut/trader.png new file mode 100644 index 00000000..1af06c97 Binary files /dev/null and b/games/aground/data/core/scenes/hut/trader.png differ diff --git a/games/aground/data/core/scenes/intro/intro.xml b/games/aground/data/core/scenes/intro/intro.xml new file mode 100644 index 00000000..81d0e6c1 --- /dev/null +++ b/games/aground/data/core/scenes/intro/intro.xml @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="utf-8" ?> +<data> + <scene id="intro"> + <tilesheet id="sheet1.png" width="256" height="144" /> + <tilesheet id="sheet2.png" width="256" height="144" /> + <tilesheet id="sheet3.png" width="256" height="144" /> + <tilesheet id="sheet4.png" width="256" height="144" /> + <tile id="sheet1" sheet="sheet1.png" /> + <tile id="sheet2" sheet="sheet2.png" /> + <tile id="sheet3" sheet="sheet3.png" /> + <tile id="sheet4" sheet="sheet4.png" /> + + <animation id="scene1"> + <frame visible="false" /><frame x="0" /><frame visible="false" length="3" /> + <frame x="1" /><frame visible="false" length="2" /><frame x="1" /> + <frame x="2" count="14" /><frame x="1" /><frame visible="false" /> + </animation> + <animation id="scene2"> + <frame visible="false" /><frame x="0" count="5" /> + <frame visible="false" /><frame x="5" count="17" /><frame visible="false" /> + </animation> + <animation id="scene3"> + <frame visible="false" /><frame x="0" count="6" /> + <frame visible="false" /><frame x="6" count="16" /><frame visible="false" /> + </animation> + <animation id="scene4"> + <frame visible="false" /><frame x="0" count="9" /> + <frame visible="false" /><frame x="9" count="12" /><frame visible="false" /> + </animation> + <animation id="scene5"> + <frame visible="false" /><frame x="22" count="11" /> + <frame visible="false" /><frame x="33" count="11" /><frame visible="false" /> + </animation> + <animation id="scene6"> + <frame visible="false" /><frame x="21" count="23" /><frame visible="false" /> + </animation> + <layer id="sheet1" tile="sheet1" x="0" y="0" animation="single" fps="9" /> + <layer id="sheet2" tile="sheet2" x="0" y="0" animation="single" fps="9" /> + <layer id="sheet3" tile="sheet3" x="0" y="0" animation="single" fps="9" /> + <layer id="sheet4" tile="sheet4" x="0" y="0" animation="single" fps="9" /> + <layer id="black" color="0" width="256" height="144" /> + + <show id="intro"> + <music id="intro" loop="false" /><layer id="black" /> + <layer id="sheet1" /><play object="sheet1" animation="scene1" /> + <removeLayer id="sheet1" /><layer id="sheet2" /><play object="sheet2" animation="scene2" /> + <removeLayer id="sheet2" /><layer id="sheet3" /><play object="sheet3" animation="scene3" /> + <removeLayer id="sheet3" /><layer id="sheet4" /><play object="sheet4" animation="scene4" /> + <removeLayer id="sheet4" /><layer id="sheet3" /><play object="sheet3" animation="scene5" /> + <removeLayer id="sheet3" /><layer id="sheet4" /><play object="sheet4" animation="scene6" /><removeLayer id="sheet4" /> + <wait seconds="2" /> + </show> + </scene> +</data> \ No newline at end of file diff --git a/games/aground/data/core/scenes/intro/sheet1.png b/games/aground/data/core/scenes/intro/sheet1.png new file mode 100644 index 00000000..8bd9d0f1 Binary files /dev/null and b/games/aground/data/core/scenes/intro/sheet1.png differ diff --git a/games/aground/data/core/scenes/intro/sheet2.png b/games/aground/data/core/scenes/intro/sheet2.png new file mode 100644 index 00000000..519a6f03 Binary files /dev/null and b/games/aground/data/core/scenes/intro/sheet2.png differ diff --git a/games/aground/data/core/scenes/intro/sheet3.png b/games/aground/data/core/scenes/intro/sheet3.png new file mode 100644 index 00000000..5919da69 Binary files /dev/null and b/games/aground/data/core/scenes/intro/sheet3.png differ diff --git a/games/aground/data/core/scenes/intro/sheet4.png b/games/aground/data/core/scenes/intro/sheet4.png new file mode 100644 index 00000000..7183052e Binary files /dev/null and b/games/aground/data/core/scenes/intro/sheet4.png differ diff --git a/games/aground/data/core/scenes/scenes.xml b/games/aground/data/core/scenes/scenes.xml new file mode 100644 index 00000000..237fc4ca --- /dev/null +++ b/games/aground/data/core/scenes/scenes.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8" ?> +<scenes> + <include id="hut/scene.xml" /> + <include id="hunter/scene.xml" /> + <include id="intro/intro.xml" /> +</scenes> \ No newline at end of file diff --git a/games/aground/data/core/science1/enemies/bandit_combo.png b/games/aground/data/core/science1/enemies/bandit_combo.png new file mode 100644 index 00000000..2b8b0f4b Binary files /dev/null and b/games/aground/data/core/science1/enemies/bandit_combo.png differ diff --git a/games/aground/data/core/science1/enemies/bandit_combo.xml b/games/aground/data/core/science1/enemies/bandit_combo.xml new file mode 100644 index 00000000..d4794231 --- /dev/null +++ b/games/aground/data/core/science1/enemies/bandit_combo.xml @@ -0,0 +1,40 @@ +<tilesheet id='bandit_combo.png' width='16' height='16' offsetX="-16"> + <image frame='0' x='0' y='0' width='12' height='9' offsetX='19' offsetY='7' /> + <image frame='1' x='0' y='9' width='17' height='15' offsetX='10' offsetY='1' /> + <image frame='2' x='0' y='24' width='17' height='15' offsetX='10' offsetY='1' /> + <image frame='3' x='0' y='39' width='13' height='15' offsetX='19' offsetY='1' /> + <image frame='4' x='0' y='54' width='13' height='16' offsetX='19' offsetY='0' /> + <image frame='5' x='0' y='70' width='12' height='12' offsetX='19' offsetY='1' /> + <image frame='6' x='0' y='82' width='12' height='13' offsetX='17' offsetY='0' /> + <image frame='7' x='17' y='9' width='18' height='15' offsetX='9' offsetY='1' /> + <image frame='8' x='35' y='9' width='18' height='12' offsetX='9' offsetY='4' /> + <image frame='9' x='53' y='9' width='17' height='12' offsetX='13' offsetY='4' /> + <image frame='10' x='70' y='9' width='15' height='12' offsetX='16' offsetY='4' /> + <image frame='11' x='17' y='24' width='13' height='12' offsetX='19' offsetY='4' /> + <image frame='12' x='17' y='36' width='13' height='12' offsetX='19' offsetY='4' /> + <image frame='13' x='17' y='48' width='13' height='12' offsetX='19' offsetY='4' /> + <image frame='14' x='17' y='60' width='13' height='12' offsetX='19' offsetY='4' /> + <image frame='15' x='30' y='24' width='18' height='14' offsetX='16' offsetY='2' /> + <image frame='16' x='17' y='72' width='12' height='13' offsetX='19' offsetY='3' /> + <image frame='17' x='48' y='24' width='12' height='13' offsetX='19' offsetY='3' /> + <image frame='18' x='60' y='24' width='12' height='13' offsetX='19' offsetY='3' /> + <image frame='19' x='72' y='24' width='12' height='13' offsetX='19' offsetY='3' /> + <image frame='20' x='30' y='38' width='12' height='13' offsetX='19' offsetY='3' /> + <image frame='21' x='30' y='51' width='12' height='13' offsetX='19' offsetY='3' /> + <image frame='22' x='30' y='64' width='12' height='13' offsetX='19' offsetY='3' /> + <image frame='23' x='30' y='77' width='12' height='13' offsetX='20' offsetY='3' /> + <image frame='24' x='42' y='38' width='12' height='13' offsetX='20' offsetY='3' /> + <image frame='25' x='54' y='38' width='12' height='13' offsetX='20' offsetY='3' /> + <image frame='26' x='66' y='38' width='12' height='13' offsetX='20' offsetY='3' /> + <image frame='27' x='78' y='38' width='12' height='13' offsetX='20' offsetY='3' /> + <image frame='28' x='42' y='51' width='12' height='13' offsetX='19' offsetY='3' /> + <image frame='29' x='54' y='51' width='15' height='13' offsetX='17' offsetY='3' /> + <image frame='30' x='69' y='51' width='14' height='13' offsetX='17' offsetY='3' /> + <image frame='31' x='42' y='64' width='12' height='13' offsetX='19' offsetY='3' /> + <image frame='32' x='42' y='77' width='12' height='13' offsetX='19' offsetY='3' /> + <image frame='33' x='83' y='51' width='12' height='12' offsetX='19' offsetY='4' /> + <image frame='34' x='54' y='64' width='12' height='12' offsetX='19' offsetY='4' /> + <image frame='35' x='54' y='76' width='12' height='12' offsetX='19' offsetY='4' /> + <image frame='36' x='66' y='64' width='12' height='12' offsetX='19' offsetY='4' /> + <image frame='37' x='78' y='64' width='12' height='12' offsetX='19' offsetY='4' /> +</tilesheet> diff --git a/games/aground/data/core/science1/enemies/bandit_heavy.png b/games/aground/data/core/science1/enemies/bandit_heavy.png new file mode 100644 index 00000000..f7c02dd7 Binary files /dev/null and b/games/aground/data/core/science1/enemies/bandit_heavy.png differ diff --git a/games/aground/data/core/science1/enemies/bandit_knives.png b/games/aground/data/core/science1/enemies/bandit_knives.png new file mode 100644 index 00000000..103ad710 Binary files /dev/null and b/games/aground/data/core/science1/enemies/bandit_knives.png differ diff --git a/games/aground/data/core/science1/enemies/bandit_ranged.png b/games/aground/data/core/science1/enemies/bandit_ranged.png new file mode 100644 index 00000000..22984f91 Binary files /dev/null and b/games/aground/data/core/science1/enemies/bandit_ranged.png differ diff --git a/games/aground/data/core/science1/enemies/cyborg_heavy_gun.png b/games/aground/data/core/science1/enemies/cyborg_heavy_gun.png new file mode 100644 index 00000000..ed97e1a4 Binary files /dev/null and b/games/aground/data/core/science1/enemies/cyborg_heavy_gun.png differ diff --git a/games/aground/data/core/science1/enemies/cyborg_heavy_gun.xml b/games/aground/data/core/science1/enemies/cyborg_heavy_gun.xml new file mode 100644 index 00000000..27596a14 --- /dev/null +++ b/games/aground/data/core/science1/enemies/cyborg_heavy_gun.xml @@ -0,0 +1,21 @@ +<tilesheet id='cyborg_heavy_gun.png' width='16' height='16' offsetX="-16"> + <image frame='0' x='0' y='0' width='21' height='12' offsetX='10' offsetY='4' /> + <image frame='1' x='21' y='0' width='25' height='12' offsetX='6' offsetY='4' /> + <image frame='2' x='46' y='0' width='20' height='12' offsetX='11' offsetY='4' /> + <image frame='3' x='0' y='12' width='24' height='12' offsetX='7' offsetY='4' /> + <image frame='4' x='24' y='12' width='19' height='12' offsetX='12' offsetY='4' /> + <image frame='5' x='43' y='12' width='22' height='12' offsetX='9' offsetY='4' /> + <image frame='6' x='0' y='24' width='17' height='12' offsetX='14' offsetY='4' /> + <image frame='7' x='0' y='36' width='16' height='15' offsetX='16' offsetY='1' /> + <image frame='8' x='0' y='51' width='14' height='13' offsetX='17' offsetY='3' /> + <image frame='9' x='17' y='24' width='16' height='12' offsetX='15' offsetY='4' /> + <image frame='10' x='17' y='36' width='16' height='12' offsetX='15' offsetY='4' /> + <image frame='11' x='17' y='48' width='16' height='12' offsetX='15' offsetY='4' /> + <image frame='12' x='17' y='60' width='16' height='12' offsetX='15' offsetY='4' /> + <image frame='13' x='33' y='24' width='16' height='12' offsetX='15' offsetY='4' /> + <image frame='14' x='49' y='24' width='14' height='12' offsetX='16' offsetY='4' /> + <image frame='15' x='33' y='36' width='14' height='12' offsetX='16' offsetY='4' /> + <image frame='16' x='33' y='48' width='14' height='12' offsetX='16' offsetY='4' /> + <image frame='17' x='33' y='60' width='14' height='12' offsetX='16' offsetY='4' /> + <image frame='18' x='47' y='36' width='14' height='12' offsetX='16' offsetY='4' /> +</tilesheet> diff --git a/games/aground/data/core/science1/enemies/diode_wolf.png b/games/aground/data/core/science1/enemies/diode_wolf.png new file mode 100644 index 00000000..cdd97a61 Binary files /dev/null and b/games/aground/data/core/science1/enemies/diode_wolf.png differ diff --git a/games/aground/data/core/science1/enemies/enemies.xml b/games/aground/data/core/science1/enemies/enemies.xml new file mode 100644 index 00000000..f983b4d5 --- /dev/null +++ b/games/aground/data/core/science1/enemies/enemies.xml @@ -0,0 +1,258 @@ +<?xml version="1.0" encoding="utf-8" ?> +<data> + <!-- BANDITS --> + <procedure id="bandit.meet"> + <action>setFlag('bandit_fight', true);</action><dialogue section="player" id="bandits4" if="player==getLocalPlayer()" /> + </procedure> + + <tile id="bandit_heavy" sheet="bandit_heavy.png" x="0" y="0" /> + <animation id="bandit_heavy.idle"> + <frame x="0" y="0" length="4" /> + <frame x="1" y="0" length="2" /> + <frame x="0" y="0" length="16" /> + </animation> + <animation id="bandit_heavy.walk" count="10" x="2" /> + <animation id="bandit_heavy.attack" count="5" x="15"> + <frame x="12" count="3" /><frame x="0" length="3" /> + </animation> + <animation id="bandit_heavy.hit" count="1" x="20" length="3"> + <frame x="0" y="0" length="4" /> + </animation> + <enemy id="bandit_heavy" tile="bandit_heavy" health="16" damage="7" defense="1" front_defense="7" range="9" type="surface" hostileFlag="bandit_fight" death_sfx="bandit_heavy_death" attack_sfx="steel_axe"> + <loot id="kite_shield" /><inRange range="3"><run procedure="bandit.meet" if="!getFlag('bandit_fight')" /></inRange> + </enemy> + + <tile id="bandit_ranged" sheet="bandit_ranged.png" x="0" y="0" /> + <animation id="bandit_ranged.idle"> + <frame x="0" y="0" length="4" /> + <frame x="1" y="0" length="2" /> + <frame x="0" y="0" length="16" /> + </animation> + <animation id="bandit_ranged.walk" count="10" x="2" /> + <animation id="bandit_ranged.attack" count="16" x="12" /> + <animation id="bandit_ranged.hit" count="1" x="28" length="3"> + <frame x="0" y="0" length="4" /> + </animation> + + <enemy id="bandit_ranged" tile="bandit_ranged" health="16" defense="2" range="3" speed="1.5" type="surface" friendlyFire="false" passEnemies="true" hostileFlag="bandit_fight" death_sfx="bandit_ranged_death"> + <flee id="player" /><loot id="gold_bar" count="2" /><inRange range="3"><run procedure="bandit.meet" if="!getFlag('bandit_fight')" /></inRange> + <attack type="projectile" damage="10" range="8" animation="attack"> + <projectile tile="crossbow_bolt" delay="14" speed="3" offsetY="4" fire_sfx="bandit_ranged_attack" hit_sfx="bandit_ranged_hit" knockback="5" /> + </attack> + </enemy> + + <include id="bandit_combo.xml" includeRoot="true" /> + <tile id="bandit_combo" sheet="bandit_combo.png" x="0" y="0" /> + <animation id="bandit_combo.idle"> + <frame x="17" y="0" length="4" /> + <frame x="16" y="0" length="2" /> + <frame x="17" y="0" length="16" /> + </animation> + <animation id="bandit_combo.walk" count="10" x="18" /> + <animation id="bandit_combo.attack1" count="8" x="0" /> + <animation id="bandit_combo.attack2" count="7" x="8"> + <frame x="28" count="10" /> + </animation> + <animation id="bandit_combo.hit" count="1" x="15" length="3"> + <frame x="17" y="0" length="2" /> + </animation> + <enemy id="bandit_combo" tile="bandit_combo" health="25" defense="2" range="9" type="surface" hostileFlag="bandit_fight" death_sfx="bandit_combo_death" attack_sfx="sword"> + <loot id="steel_sword" /><inRange range="3"><run procedure="bandit.meet" if="!getFlag('bandit_fight')" /></inRange> + <attack type="melee" damage="5" hits="2" animation="attack1"> + <cont damage="7" animation="attack2" slide="11" knockback="5" /> + </attack> + </enemy> + + <tile id="bandit_knives" sheet="bandit_knives.png" x="0" y="0" /> + <animation id="bandit_knives.idle"> + <frame x="0" y="0" length="4" /> + <frame x="1" y="0" length="2" /> + <frame x="0" y="0" length="16" /> + </animation> + <animation id="bandit_knives.walk" count="10" x="2" /> + <animation id="bandit_knives.prepare_atk" x="0" count="1" length="4" /> + <animation id="bandit_knives.attack" count="4" x="12" /> + <animation id="bandit_knives.throw" count="4" x="16" /> + <animation id="bandit_knives.throw1" count="7" x="20" /> + <animation id="bandit_knives.throw2" count="9" x="27" /> + <animation id="bandit_knives.hit" count="1" x="36" length="3"> + <frame x="0" y="0" length="4" /> + </animation> + + <tilesheet id="throwing_knife.png" width="8" height="8" /> + <tile id="throwing_knife" sheet="throwing_knife.png" x="0" y="0" /> + <animation id="throwing_knife" count="4" x="0" /> + <enemy id="bandit_knives" tile="bandit_knives" health="10" defense="2" range="3" speed="3" fps="20" type="surface" friendlyFire="false" passEnemies="true" hostileFlag="bandit_fight" death_sfx="bandit_knives_death" attack_sfx="bandit_knives_slash"> + <loot id="diamond" /><inRange range="3"><run procedure="bandit.meet" if="!getFlag('bandit_fight')" /></inRange> + <attack type="melee" damage="7" range="1" slide="true" hitAndRun="4.5"> + <pre><play object="this" animation="prepare_atk" /></pre> + </attack> + <attack type="projectile" damage="7" range="6" hits="2" animation="throw1" sfx="bandit_knives_throw"> + <pre><play object="this" animation="throw" /></pre> + <projectile tile="throwing_knife" animation="throwing_knife" hit_sfx="bandit_knives_hit" delay="5" speed="2" offsetY="4" knockback="5" /> + <cont animation="throw2" /> + </attack> + </enemy> + <!-- MUTANTS --> + <tile id="diode_wolf" sheet="diode_wolf.png" x="0" y="0" /> + <animation id="diode_wolf.idle" count="6" /> + <animation id="diode_wolf.roar" x="6" count="8" /> + <animation id="diode_wolf.walk" x="14" count="6" /> + <animation id="diode_wolf.attack" count="6" x="20" /> + <animation id="diode_wolf.hit" count="1" length="3" x="26" /> + <enemy id="diode_wolf" tile="diode_wolf" health="30" defense="3" range="7" speed="2" type="surface" kill_achievement="diode_wolf" trapped="wolf" capture="8" attack_sfx="none" death_sfx="diode_wolf_death"> + <capture trapped="diode_wolf" minCapture="3" /> + <attack type="melee" damage="8" hitEffect="fire_lg_dot" knockback="5" sfx="diode_wolf_attack" /> + <lootSet><loot id="battery" /></lootSet> + <lootSet><loot id="meat" /></lootSet> + <run><play object="this" animation="roar" /></run> + </enemy> + + <include id="cyborg_heavy_gun.xml" includeRoot="true" /> + <tile id="cyborg_heavy_gun" sheet="cyborg_heavy_gun.png" x="0" y="0" /> + <animation id="cyborg_heavy_gun.idle" x="8" count="1" length="4" /> + <animation id="cyborg_heavy_gun.walk" x="9" count="10" /> + <animation id="cyborg_heavy_gun.attack1" count="2" /> + <animation id="cyborg_heavy_gun.attack2" count="2" x="2" /> + <animation id="cyborg_heavy_gun.attack3" count="2" x="4"> + <frame x="6" length="6" /> + </animation> + <animation id="cyborg_heavy_gun.hit" count="1" length="3" x="7" /> + <enemy id="cyborg_heavy_gun" tile="cyborg_heavy_gun" health="30" defense="3" range="3" type="surface" death_sfx="cyborg_death"> + <flee id="player" /><loot id="bullet" count="3" /> + <attack type="projectile" damage="7" range="9" hits="3" animation="attack1" sfx="machine_gun"> + <projectile tile="bullet" animation="bullet.idle" speed="5" offsetY="2" hit_sfx="bullet"> + <hitEffect tile="bullet" animation="bullet.impact" color="ffdd99" /> + </projectile> + <cont animation="attack2" /> + <cont animation="attack3" /> + </attack> + </enemy> + + <tile id="stinger" sheet="stinger.png" x="0" y="0" /> + <animation id="stinger.idle" x="0" count="8" /> + <animation id="stinger.walk" x="8" count="4" /> + <animation id="stinger.attack" x="12" count="8"> + <frame x="0" length="7" /> + </animation> + <animation id="stinger.hit" x="20" count="1" length="8" /> + <enemy id="stinger" tile="stinger" health="10" defense="3" damage="10" type="golem" speed="3" fps="20" death_sfx="stinger_death" attack_sfx="stinger_attack"> + <loot p="4" /> + <loot id="battery" p="4" /> + <loot id="refined_oil" p="16" /> + <loot id="titanium" p="1" /> + <loot id="uranium" p="1" /> + <attack type="projectile" damage="8" range="8" animation="attack" sfx="radioactive_bolt"> + <projectile tile="fireball_small" animation="fireball_small.acid" delay="6" speed="3" offsetY="1" glow="true" hit_sfx="bolt_hit" knockback="5" underwater="true"> + <light tile="light.small" color="00cc00" /> + </projectile> + </attack> + </enemy> + + <!-- OTHER --> + <tile id="steel_wyrm" sheet="steel_wyrm.png" x="0" y="0" /> + <animation id="steel_wyrm.idle" equals="single" /> + <animation id="steel_wyrm.walk" count="6" x="0" /> + <animation id="steel_wyrm.dig" count="6" x="6" /> + <animation id="steel_wyrm.attack" count="6" x="6"><frame count="1" length="10" x="0" y="0" /></animation> + <animation id="steel_wyrm.hit" count="1" length="3" x="12"> + <frame x="0" y="0" length="2" /> + </animation> + <animation id="fireball_small.acid" count="6" color="44ffff" /> + <enemy id="steel_wyrm" tile="steel_wyrm" health="20" defense="4" damage="18" type="wyrm" eatTile="desert.dirt" capture="16" death_sfx="mech_wyrm_death" attack_sfx="mecha_wyrm_attack"> + <capture trapped="steel_wyrm" minCapture="3" /> + <loot id="uranium" /> + <attack type="projectile" damage="8" range="8" animation="attack" sfx="radioactive_bolt"> + <projectile tile="fireball_small" animation="fireball_small.acid" speed="3" offsetY="4" glow="true" hit_sfx="bolt_hit" knockback="5" underwater="true"> + <light tile="light.small" color="00cc00" /> + </projectile> + </attack> + </enemy> + + <!-- MIRROWS --> + <include id="mirrows.xml" includeRoot="true" /> + <include id="lightning.xml" includeRoot="true" /> + <tile id="mirrow_d" x="9" sheet="mirrows.png" /> + <tile id="mirrow_d.legs" x="42" sheet="mirrows.png" /> + <tile id="lightning_ball" x="0" sheet="mirrows.png" /> + <animation id="lightning_ball.hit" x="0" count="3" /> + <animation id="lightning_ball.idle" x="3" count="6" /> + <tile id="lightning_ball.form" x="0" sheet="lightning.png" /> + <tile id="lightning" x="11" sheet="lightning.png" /> + <animation id="lightning_ball.form" count="11" glow="true" /> + <animation id="lightning"> + <frame x="0" glow="true" /><frame visible="false" /><frame x="1" glow="true" /><frame visible="false" /> + <frame x="2" glow="true" /><frame visible="false" /><frame x="3" glow="true" /><frame visible="false" /> + <frame x="4" glow="true" /><frame visible="false" /><frame x="5" glow="true" /> + </animation> + <animation id="mirrow_d.attack" count="11"><append tile="mirrow_d.legs" /></animation> + <animation id="mirrow_d.idle" x="11" count="10"><append tile="mirrow_d.legs" /></animation> + <animation id="mirrow_d.hit" x="67" count="1" length="3"><append tile="mirrow_d.legs" /></animation> + <animation id="mirrow_d.talk" x="21" count="12" /> + <animation id="mirrow_d.legs.walk" x="1" count="10" /> + <animation id="mirrow_d.walk" x="11" count="10"> + <append tile="mirrow_d.legs" animation="mirrow_d.legs.walk" /> + </animation> + <enemy id="mirrow_d" tile="mirrow_d" health="30" defense="4" type="surface" range="8" friendlyFire="false" passEnemies="true" vertical="true" facing="right" death_sfx="mirrow_d_death" attack_sfx="none" passFence="true"> + <attack type="melee" damage="20" range="1" sfx="mirrow_lightning"> + <effect id="lightning" offsetX="-28" offsetY="-25" /> + </attack> + <attack type="breath" damage="20" range="13" repeat="10" animation="attack" cooldown="50" sfx="mirrow_energyball" available="this.getHealthPercent()<0.75"> + <projectile tile="lightning_ball" animation="lightning_ball.idle" speed="2" offsetX="-16" offsetY="2" glow="true"> + <hitEffect tile="lightning_ball" animation="lightning_ball.hit" color="ffdd99" /> + </projectile> + <effect id="lightning_ball.form" offsetX="-28" offsetY="-25" /> + </attack> + <onDeath><object id="mirrow_d.npc" x="this.xPos/Tile.SIZE" y="this.yTile/Tile.SIZE" /><run procedure="mirrow.lab.music" /></onDeath> + </enemy> + + <tile id="mirrow_n" x="77" sheet="mirrows.png" /> + <tile id="mirrow_n.legs" x="65" sheet="mirrows.png" /> + <animation id="mirrow_n.hit" count="1" length="3"><append tile="mirrow_n.legs" /></animation> + <animation id="mirrow_n.tentacles" x="4" count="8" repeat="3" /> + <animation id="mirrow_n.tentacles.attack" x="12" count="6" /> + <animation id="mirrow_n.tentacles.attack2" x="18" count="3" /> + <animation id="mirrow_n.idle"> + <append tile="mirrow_n.legs" /> + <frame x="3" y="0" length="6" /> + <frame x="1" y="0" length="2" /> + <frame x="3" y="0" length="7" /> + <frame x="2" y="0" length="2" /> + <frame x="3" y="0" length="7" /> + </animation> + <animation id="mirrow_n.talk" x="-24" count="12" /> + <animation id="mirrow_n.attack" x="2" count="1" length="8"><append tile="mirrow_n.legs" /></animation> + <animation id="mirrow_n.legs.walk" x="1" count="10" /> + <animation id="mirrow_n.walk" x="3" count="1" length="10"> + <append tile="mirrow_n.legs" animation="mirrow_n.legs.walk" /> + </animation> + <enemy id="mirrow_n" tile="mirrow_n" health="30" defense="4" type="surface" range="8" speed="2" passEnemies="true" vertical="true" facing="right" death_sfx="mirrow_n_death" attack_sfx="none" passFence="true"> + <object tile="mirrow_n" animation="mirrow_n.tentacles" layer="player" offsetX="-11" fps="20" name="forward" /> + <object tile="mirrow_n" animation="mirrow_n.tentacles" layer="player" offsetX="-15" flip="true" fps="20"> + <over> + <sound id="mirrow_tentacle" object="this" /> + <damage object="player" attacker="this" damage="15" /><play object="this" animation="mirrow_n.tentacles.attack" /> + <play object="this" animation="mirrow_n.tentacles" loop="true" /> + </over> + </object> + <attack type="melee" damage="15" range="0.5" knockback="5" sfx="mirrow_tentacle"> + <pre><play object="this.getObjectByName('forward')" animation="mirrow_n.tentacles.attack2" loop="true" /></pre> + <post><play object="this.getObjectByName('forward')" animation="mirrow_n.tentacles" loop="true" /></post> + </attack> + <onDeath><object id="mirrow_n.npc" x="this.xPos/Tile.SIZE" y="this.yTile/Tile.SIZE" /><run procedure="mirrow.lab.music" /></onDeath> + </enemy> + + <tilesheet id="minotaur.png" width="32" height="32" /> + <tile id="minotaur" sheet="minotaur.png" x="0" y="0" /> + <animation id="minotaur.idle" x="0" count="3"><frame x="3" length="6" /></animation> + <animation id="minotaur.walk" x="4" count="5" /> + <animation id="minotaur.attack" x="4" count="5"><frame x="0" count="3" /></animation> + <animation id="minotaur.hit" x="9" count="1" length="3" /> + <enemy id="minotaur" tile="minotaur" health="50" defense="2" type="surface" range="16" speed="2" trapped="cow" capture="8" death_sfx="minotaur_death" walk_sfx="minotaur_charge" attack_sfx="minotaur_impale"> + <lootSet><loot id="meat" count="3" /></lootSet> + <lootSet><loot id="horn" count="2" /></lootSet> + <attack type="melee" damage="15" knockback="10" /> + <idle><action>this.run();</action><stop /></idle> + <hitWall><action>this.flip(); this.run();</action><stop /></hitWall> + </enemy> +</data> \ No newline at end of file diff --git a/games/aground/data/core/science1/enemies/lightning.png b/games/aground/data/core/science1/enemies/lightning.png new file mode 100644 index 00000000..d38bb069 Binary files /dev/null and b/games/aground/data/core/science1/enemies/lightning.png differ diff --git a/games/aground/data/core/science1/enemies/lightning.xml b/games/aground/data/core/science1/enemies/lightning.xml new file mode 100644 index 00000000..5e399b9a --- /dev/null +++ b/games/aground/data/core/science1/enemies/lightning.xml @@ -0,0 +1,19 @@ +<tilesheet id='lightning.png' width='32' height='32'> + <image frame='0' x='0' y='0' width='15' height='10' offsetX='6' offsetY='21' /> + <image frame='1' x='0' y='10' width='10' height='11' offsetX='5' offsetY='19' /> + <image frame='2' x='0' y='21' width='16' height='12' offsetX='6' offsetY='18' /> + <image frame='3' x='15' y='0' width='8' height='7' offsetX='6' offsetY='22' /> + <image frame='4' x='10' y='10' width='15' height='11' offsetX='6' offsetY='21' /> + <image frame='5' x='25' y='10' width='11' height='11' offsetX='4' offsetY='20' /> + <image frame='6' x='0' y='33' width='19' height='13' offsetX='2' offsetY='19' /> + <image frame='7' x='23' y='0' width='10' height='10' offsetX='4' offsetY='19' /> + <image frame='8' x='19' y='33' width='18' height='13' offsetX='3' offsetY='18' /> + <image frame='9' x='16' y='21' width='12' height='12' offsetX='4' offsetY='19' /> + <image frame='10' x='33' y='0' width='15' height='10' offsetX='6' offsetY='21' /> + <image frame='11' x='0' y='46' width='21' height='19' offsetX='0' offsetY='13' /> + <image frame='12' x='21' y='46' width='22' height='17' offsetX='0' offsetY='15' /> + <image frame='13' x='0' y='65' width='22' height='16' offsetX='0' offsetY='16' /> + <image frame='14' x='0' y='81' width='21' height='19' offsetX='0' offsetY='13' /> + <image frame='15' x='22' y='65' width='22' height='17' offsetX='0' offsetY='15' /> + <image frame='16' x='22' y='82' width='22' height='16' offsetX='0' offsetY='16' /> +</tilesheet> diff --git a/games/aground/data/core/science1/enemies/minotaur.png b/games/aground/data/core/science1/enemies/minotaur.png new file mode 100644 index 00000000..5fa739f0 Binary files /dev/null and b/games/aground/data/core/science1/enemies/minotaur.png differ diff --git a/games/aground/data/core/science1/enemies/mirrows.png b/games/aground/data/core/science1/enemies/mirrows.png new file mode 100644 index 00000000..bafb053f Binary files /dev/null and b/games/aground/data/core/science1/enemies/mirrows.png differ diff --git a/games/aground/data/core/science1/enemies/mirrows.xml b/games/aground/data/core/science1/enemies/mirrows.xml new file mode 100644 index 00000000..40b15da7 --- /dev/null +++ b/games/aground/data/core/science1/enemies/mirrows.xml @@ -0,0 +1,100 @@ +<tilesheet id='mirrows.png' width='16' height='16'> + <image frame='0' x='0' y='0' width='16' height='16' offsetX='0' offsetY='0' /> + <image frame='1' x='16' y='0' width='16' height='16' offsetX='0' offsetY='0' /> + <image frame='2' x='32' y='0' width='16' height='16' offsetX='0' offsetY='0' /> + <image frame='3' x='48' y='0' width='12' height='12' offsetX='2' offsetY='2' /> + <image frame='4' x='60' y='0' width='12' height='12' offsetX='2' offsetY='2' /> + <image frame='5' x='0' y='16' width='13' height='12' offsetX='2' offsetY='2' /> + <image frame='6' x='13' y='16' width='12' height='12' offsetX='3' offsetY='2' /> + <image frame='7' x='25' y='16' width='12' height='12' offsetX='3' offsetY='2' /> + <image frame='8' x='37' y='16' width='11' height='12' offsetX='3' offsetY='2' /> + <image frame='9' x='48' y='16' width='14' height='11' offsetX='1' offsetY='4' /> + <image frame='10' x='62' y='16' width='14' height='11' offsetX='1' offsetY='4' /> + <image frame='11' x='0' y='28' width='14' height='11' offsetX='1' offsetY='4' /> + <image frame='12' x='14' y='28' width='14' height='11' offsetX='1' offsetY='4' /> + <image frame='13' x='28' y='28' width='14' height='11' offsetX='1' offsetY='4' /> + <image frame='14' x='42' y='28' width='14' height='11' offsetX='1' offsetY='4' /> + <image frame='15' x='56' y='28' width='14' height='11' offsetX='1' offsetY='4' /> + <image frame='16' x='0' y='39' width='14' height='11' offsetX='1' offsetY='4' /> + <image frame='17' x='14' y='39' width='14' height='11' offsetX='1' offsetY='4' /> + <image frame='18' x='28' y='39' width='14' height='11' offsetX='1' offsetY='4' /> + <image frame='19' x='42' y='39' width='14' height='11' offsetX='1' offsetY='4' /> + <image frame='20' x='56' y='39' width='11' height='11' offsetX='4' offsetY='4' /> + <image frame='21' x='67' y='39' width='11' height='11' offsetX='4' offsetY='4' /> + <image frame='22' x='0' y='50' width='11' height='11' offsetX='4' offsetY='4' /> + <image frame='23' x='0' y='61' width='11' height='11' offsetX='4' offsetY='4' /> + <image frame='24' x='0' y='72' width='11' height='11' offsetX='4' offsetY='4' /> + <image frame='25' x='0' y='83' width='11' height='11' offsetX='4' offsetY='4' /> + <image frame='26' x='0' y='94' width='11' height='11' offsetX='4' offsetY='4' /> + <image frame='27' x='0' y='105' width='11' height='11' offsetX='4' offsetY='4' /> + <image frame='28' x='0' y='116' width='11' height='11' offsetX='4' offsetY='4' /> + <image frame='29' x='11' y='50' width='11' height='11' offsetX='4' offsetY='4' /> + <image frame='30' x='11' y='61' width='13' height='12' offsetX='2' offsetY='4' /> + <image frame='31' x='24' y='61' width='13' height='12' offsetX='2' offsetY='4' /> + <image frame='32' x='37' y='61' width='13' height='12' offsetX='2' offsetY='4' /> + <image frame='33' x='50' y='61' width='13' height='12' offsetX='2' offsetY='4' /> + <image frame='34' x='63' y='61' width='13' height='12' offsetX='2' offsetY='4' /> + <image frame='36' x='11' y='73' width='13' height='12' offsetX='2' offsetY='4' /> + <image frame='37' x='11' y='85' width='13' height='12' offsetX='2' offsetY='4' /> + <image frame='42' x='48' y='12' width='5' height='1' offsetX='7' offsetY='15' /> + <image frame='43' x='60' y='12' width='8' height='2' offsetX='5' offsetY='14' /> + <image frame='44' x='48' y='27' width='9' height='1' offsetX='5' offsetY='15' /> + <image frame='45' x='60' y='14' width='8' height='2' offsetX='6' offsetY='14' /> + <image frame='46' x='48' y='13' width='1' height='1' offsetX='7' offsetY='15' /> + <image frame='47' x='49' y='13' width='2' height='1' offsetX='9' offsetY='15' /> + <image frame='53' x='22' y='50' width='12' height='10' offsetX='4' offsetY='6' /> + <image frame='54' x='34' y='50' width='12' height='10' offsetX='4' offsetY='6' /> + <image frame='55' x='46' y='50' width='12' height='10' offsetX='4' offsetY='6' /> + <image frame='58' x='58' y='50' width='12' height='10' offsetX='4' offsetY='6' /> + <image frame='61' x='11' y='97' width='12' height='10' offsetX='4' offsetY='6' /> + <image frame='65' x='53' y='12' width='5' height='1' offsetX='8' offsetY='15' /> + <image frame='66' x='53' y='13' width='7' height='2' offsetX='6' offsetY='14' /> + <image frame='67' x='62' y='27' width='8' height='1' offsetX='6' offsetY='15' /> + <image frame='68' x='72' y='0' width='7' height='2' offsetX='7' offsetY='14' /> + <image frame='69' x='48' y='14' width='1' height='1' offsetX='8' offsetY='15' /> + <image frame='70' x='51' y='13' width='2' height='1' offsetX='9' offsetY='15' /> + <image frame='76' x='24' y='73' width='15' height='16' offsetX='1' offsetY='0' /> + <image frame='77' x='11' y='107' width='12' height='12' offsetX='4' offsetY='4' /> + <image frame='78' x='11' y='119' width='12' height='9' offsetX='4' offsetY='6' /> + <image frame='79' x='24' y='89' width='12' height='9' offsetX='4' offsetY='6' /> + <image frame='80' x='24' y='98' width='12' height='9' offsetX='4' offsetY='6' /> + <image frame='81' x='24' y='107' width='12' height='7' offsetX='4' offsetY='9' /> + <image frame='82' x='24' y='114' width='12' height='7' offsetX='4' offsetY='9' /> + <image frame='83' x='24' y='121' width='12' height='7' offsetX='4' offsetY='9' /> + <image frame='84' x='39' y='73' width='12' height='6' offsetX='4' offsetY='10' /> + <image frame='85' x='39' y='79' width='12' height='7' offsetX='4' offsetY='9' /> + <image frame='86' x='51' y='79' width='12' height='7' offsetX='4' offsetY='9' /> + <image frame='87' x='63' y='79' width='12' height='7' offsetX='4' offsetY='9' /> + <image frame='88' x='51' y='73' width='12' height='6' offsetX='4' offsetY='10' /> + <image frame='89' x='63' y='73' width='16' height='6' offsetX='0' offsetY='9' /> + <image frame='90' x='39' y='86' width='15' height='13' offsetX='1' offsetY='3' /> + <image frame='91' x='39' y='99' width='8' height='14' offsetX='8' offsetY='2' /> + <image frame='92' x='54' y='86' width='10' height='13' offsetX='6' offsetY='3' /> + <image frame='93' x='47' y='99' width='16' height='8' offsetX='0' offsetY='8' /> + <image frame='94' x='64' y='86' width='14' height='8' offsetX='2' offsetY='6' /> + <image frame='95' x='47' y='107' width='16' height='10' offsetX='0' offsetY='6' /> + <image frame='96' x='47' y='117' width='16' height='10' offsetX='0' offsetY='6' /> + <image frame='97' x='63' y='107' width='16' height='10' offsetX='0' offsetY='6' /> + <image frame='35' equals='31' offsetX='2' offsetY='4' /> + <image frame='38' equals='30' offsetX='2' offsetY='4' /> + <image frame='39' equals='31' offsetX='2' offsetY='4' /> + <image frame='40' equals='32' offsetX='2' offsetY='4' /> + <image frame='41' equals='33' offsetX='2' offsetY='4' /> + <image frame='48' equals='43' offsetX='5' offsetY='14' /> + <image frame='49' equals='44' offsetX='5' offsetY='15' /> + <image frame='50' equals='45' offsetX='6' offsetY='14' /> + <image frame='51' equals='46' offsetX='7' offsetY='15' /> + <image frame='52' equals='47' offsetX='9' offsetY='15' /> + <image frame='56' equals='54' offsetX='4' offsetY='6' /> + <image frame='57' equals='54' offsetX='4' offsetY='6' /> + <image frame='59' equals='54' offsetX='4' offsetY='6' /> + <image frame='60' equals='54' offsetX='4' offsetY='6' /> + <image frame='62' equals='54' offsetX='4' offsetY='6' /> + <image frame='63' equals='54' offsetX='4' offsetY='6' /> + <image frame='64' equals='61' offsetX='4' offsetY='6' /> + <image frame='71' equals='66' offsetX='6' offsetY='14' /> + <image frame='72' equals='67' offsetX='6' offsetY='15' /> + <image frame='73' equals='68' offsetX='7' offsetY='14' /> + <image frame='74' equals='69' offsetX='8' offsetY='15' /> + <image frame='75' equals='70' offsetX='9' offsetY='15' /> +</tilesheet> diff --git a/games/aground/data/core/science1/enemies/steel_wyrm.png b/games/aground/data/core/science1/enemies/steel_wyrm.png new file mode 100644 index 00000000..5e09c716 Binary files /dev/null and b/games/aground/data/core/science1/enemies/steel_wyrm.png differ diff --git a/games/aground/data/core/science1/enemies/stinger.png b/games/aground/data/core/science1/enemies/stinger.png new file mode 100644 index 00000000..1b087754 Binary files /dev/null and b/games/aground/data/core/science1/enemies/stinger.png differ diff --git a/games/aground/data/core/science1/enemies/throwing_knife.png b/games/aground/data/core/science1/enemies/throwing_knife.png new file mode 100644 index 00000000..febd6fcd Binary files /dev/null and b/games/aground/data/core/science1/enemies/throwing_knife.png differ diff --git a/games/aground/data/core/science1/items/bullets.png b/games/aground/data/core/science1/items/bullets.png new file mode 100644 index 00000000..d072cbd1 Binary files /dev/null and b/games/aground/data/core/science1/items/bullets.png differ diff --git a/games/aground/data/core/science1/items/cyborg.png b/games/aground/data/core/science1/items/cyborg.png new file mode 100644 index 00000000..2700ce34 Binary files /dev/null and b/games/aground/data/core/science1/items/cyborg.png differ diff --git a/games/aground/data/core/science1/items/cyborg.xml b/games/aground/data/core/science1/items/cyborg.xml new file mode 100644 index 00000000..a6360412 --- /dev/null +++ b/games/aground/data/core/science1/items/cyborg.xml @@ -0,0 +1,84 @@ +<tilesheet id='cyborg.png' width='16' height='16'> + <image frame='0' x='0' y='0' width='16' height='16' offsetX='0' offsetY='0' /> + <image frame='1' x='0' y='16' width='16' height='16' offsetX='0' offsetY='0' /> + <image frame='2' x='0' y='32' width='16' height='16' offsetX='0' offsetY='0' /> + <image frame='3' x='0' y='48' width='16' height='16' offsetX='0' offsetY='0' /> + <image frame='4' x='16' y='0' width='16' height='16' offsetX='0' offsetY='0' /> + <image frame='5' x='32' y='0' width='16' height='16' offsetX='0' offsetY='0' /> + <image frame='6' x='48' y='0' width='16' height='16' offsetX='0' offsetY='0' /> + <image frame='8' x='16' y='16' width='16' height='16' offsetX='0' offsetY='0' /> + <image frame='9' x='16' y='32' width='16' height='16' offsetX='0' offsetY='0' /> + <image frame='10' x='16' y='48' width='16' height='16' offsetX='0' offsetY='0' /> + <image frame='11' x='32' y='16' width='16' height='16' offsetX='0' offsetY='0' /> + <image frame='12' x='48' y='16' width='16' height='16' offsetX='0' offsetY='0' /> + <image frame='13' x='32' y='32' width='16' height='16' offsetX='0' offsetY='0' /> + <image frame='14' x='32' y='48' width='16' height='16' offsetX='0' offsetY='0' /> + <image frame='15' x='48' y='32' width='16' height='16' offsetX='0' offsetY='0' /> + <image frame='16' x='48' y='48' width='16' height='16' offsetX='0' offsetY='0' /> + <image frame='17' x='0' y='64' width='5' height='4' offsetX='9' offsetY='8' /> + <image frame='18' x='5' y='64' width='5' height='4' offsetX='9' offsetY='8' /> + <image frame='19' x='10' y='64' width='5' height='4' offsetX='9' offsetY='8' /> + <image frame='20' x='64' y='0' width='5' height='4' offsetX='9' offsetY='8' /> + <image frame='21' x='64' y='4' width='5' height='4' offsetX='9' offsetY='8' /> + <image frame='22' x='64' y='8' width='8' height='4' offsetX='2' offsetY='12' /> + <image frame='28' x='64' y='12' width='8' height='4' offsetX='2' offsetY='12' /> + <image frame='29' x='16' y='64' width='8' height='4' offsetX='3' offsetY='12' /> + <image frame='34' x='64' y='16' width='4' height='8' offsetX='2' offsetY='8' /> + <image frame='36' x='68' y='16' width='4' height='8' offsetX='2' offsetY='8' /> + <image frame='37' x='64' y='24' width='4' height='8' offsetX='2' offsetY='8' /> + <image frame='38' x='68' y='24' width='4' height='8' offsetX='2' offsetY='8' /> + <image frame='46' x='64' y='32' width='4' height='8' offsetX='2' offsetY='8' /> + <image frame='63' x='24' y='64' width='8' height='4' offsetX='4' offsetY='11' /> + <image frame='67' x='32' y='64' width='8' height='4' offsetX='6' offsetY='11' /> + <image frame='68' x='40' y='64' width='8' height='4' offsetX='6' offsetY='11' /> + <image frame='69' x='64' y='40' width='8' height='4' offsetX='6' offsetY='11' /> + <image frame='70' x='64' y='44' width='8' height='4' offsetX='5' offsetY='11' /> + <image frame='71' x='48' y='64' width='8' height='4' offsetX='5' offsetY='11' /> + <image frame='74' x='56' y='64' width='8' height='4' offsetX='6' offsetY='11' /> + <image frame='75' x='64' y='48' width='8' height='4' offsetX='5' offsetY='11' /> + <image frame='76' x='64' y='52' width='8' height='4' offsetX='5' offsetY='11' /> + <image frame='78' x='64' y='56' width='8' height='4' offsetX='6' offsetY='11' /> + <image frame='79' x='64' y='60' width='8' height='4' offsetX='6' offsetY='11' /> + <image frame='80' x='64' y='64' width='8' height='4' offsetX='6' offsetY='11' /> + <image frame='7' equals='3' offsetX='0' offsetY='0' /> + <image frame='23' equals='22' offsetX='2' offsetY='12' /> + <image frame='24' equals='22' offsetX='2' offsetY='12' /> + <image frame='25' equals='22' offsetX='2' offsetY='12' /> + <image frame='26' equals='22' offsetX='2' offsetY='12' /> + <image frame='27' equals='22' offsetX='2' offsetY='12' /> + <image frame='30' equals='22' offsetX='2' offsetY='12' /> + <image frame='31' equals='22' offsetX='2' offsetY='12' /> + <image frame='32' equals='22' offsetX='2' offsetY='12' /> + <image frame='33' equals='22' offsetX='2' offsetY='12' /> + <image frame='35' equals='34' offsetX='2' offsetY='8' /> + <image frame='39' equals='38' offsetX='2' offsetY='8' /> + <image frame='40' equals='34' offsetX='2' offsetY='8' /> + <image frame='41' equals='34' offsetX='2' offsetY='8' /> + <image frame='42' equals='34' offsetX='2' offsetY='8' /> + <image frame='43' equals='34' offsetX='2' offsetY='8' /> + <image frame='44' equals='34' offsetX='2' offsetY='8' /> + <image frame='45' equals='34' offsetX='2' offsetY='8' /> + <image frame='47' equals='46' offsetX='2' offsetY='8' /> + <image frame='48' equals='46' offsetX='2' offsetY='8' /> + <image frame='49' equals='46' offsetX='2' offsetY='8' /> + <image frame='50' equals='46' offsetX='2' offsetY='8' /> + <image frame='51' equals='46' offsetX='2' offsetY='8' /> + <image frame='52' equals='46' offsetX='2' offsetY='8' /> + <image frame='53' equals='46' offsetX='2' offsetY='8' /> + <image frame='54' equals='46' offsetX='2' offsetY='8' /> + <image frame='55' equals='46' offsetX='2' offsetY='8' /> + <image frame='56' equals='46' offsetX='2' offsetY='8' /> + <image frame='57' equals='46' offsetX='2' offsetY='8' /> + <image frame='58' equals='46' offsetX='2' offsetY='8' /> + <image frame='59' equals='46' offsetX='2' offsetY='8' /> + <image frame='60' equals='46' offsetX='2' offsetY='8' /> + <image frame='61' equals='46' offsetX='2' offsetY='8' /> + <image frame='62' equals='46' offsetX='2' offsetY='8' /> + <image frame='64' equals='63' offsetX='2' offsetY='11' /> + <image frame='65' equals='63' offsetX='6' offsetY='11' /> + <image frame='66' equals='63' offsetX='5' offsetY='11' /> + <image frame='72' equals='69' offsetX='5' offsetY='11' /> + <image frame='73' equals='70' offsetX='6' offsetY='11' /> + <image frame='77' equals='74' offsetX='5' offsetY='11' /> + <image frame='81' equals='78' offsetX='6' offsetY='11' /> +</tilesheet> diff --git a/games/aground/data/core/science1/items/cyborg_pack.png b/games/aground/data/core/science1/items/cyborg_pack.png new file mode 100644 index 00000000..f50a3c10 Binary files /dev/null and b/games/aground/data/core/science1/items/cyborg_pack.png differ diff --git a/games/aground/data/core/science1/items/cyborg_pack.xml b/games/aground/data/core/science1/items/cyborg_pack.xml new file mode 100644 index 00000000..9c4f8bde --- /dev/null +++ b/games/aground/data/core/science1/items/cyborg_pack.xml @@ -0,0 +1,22 @@ +<tilesheet id='cyborg_pack.png' width='32' height='16'> + <image frame='0' x='0' y='0' width='9' height='5' offsetX='15' offsetY='10' /> + <image frame='1' x='9' y='0' width='13' height='5' offsetX='11' offsetY='10' /> + <image frame='2' x='0' y='5' width='17' height='7' offsetX='7' offsetY='8' /> + <image frame='3' x='22' y='0' width='12' height='5' offsetX='12' offsetY='10' /> + <image frame='4' x='17' y='5' width='16' height='6' offsetX='8' offsetY='9' /> + <image frame='5' x='0' y='12' width='11' height='5' offsetX='13' offsetY='10' /> + <image frame='6' x='11' y='12' width='14' height='5' offsetX='10' offsetY='10' /> + <image frame='7' x='0' y='17' width='10' height='14' offsetX='11' offsetY='2' /> + <image frame='8' x='10' y='17' width='10' height='12' offsetX='11' offsetY='2' /> + <image frame='9' x='20' y='17' width='10' height='13' offsetX='11' offsetY='2' /> + <image frame='10' x='0' y='31' width='10' height='14' offsetX='11' offsetY='2' /> + <image frame='11' x='0' y='45' width='10' height='12' offsetX='11' offsetY='2' /> + <image frame='12' x='0' y='57' width='10' height='9' offsetX='11' offsetY='6' /> + <image frame='13' x='10' y='31' width='10' height='9' offsetX='11' offsetY='6' /> + <image frame='14' x='20' y='31' width='10' height='9' offsetX='11' offsetY='6' /> + <image frame='15' x='10' y='40' width='10' height='9' offsetX='11' offsetY='6' /> + <image frame='16' x='20' y='40' width='10' height='9' offsetX='11' offsetY='6' /> + <image frame='17' x='10' y='49' width='10' height='9' offsetX='11' offsetY='6' /> + <image frame='18' x='10' y='58' width='10' height='9' offsetX='11' offsetY='6' /> + <image frame='19' x='20' y='49' width='10' height='9' offsetX='11' offsetY='6' /> +</tilesheet> diff --git a/games/aground/data/core/science1/items/drill.png b/games/aground/data/core/science1/items/drill.png new file mode 100644 index 00000000..c8c4f0a1 Binary files /dev/null and b/games/aground/data/core/science1/items/drill.png differ diff --git a/games/aground/data/core/science1/items/drill.xml b/games/aground/data/core/science1/items/drill.xml new file mode 100644 index 00000000..a324b11b --- /dev/null +++ b/games/aground/data/core/science1/items/drill.xml @@ -0,0 +1,13 @@ +<tilesheet id='drill.png' width='32' height='16' offsetX="-8"> + <image frame='0' x='0' y='0' width='18' height='3' offsetX='14' offsetY='12' /> + <image frame='1' x='0' y='3' width='17' height='3' offsetX='15' offsetY='12' /> + <image frame='2' x='0' y='6' width='19' height='3' offsetX='13' offsetY='12' /> + <image frame='3' x='0' y='9' width='20' height='6' offsetX='12' offsetY='10' /> + <image frame='4' x='0' y='15' width='20' height='8' offsetX='12' offsetY='8' /> + <image frame='5' x='0' y='23' width='19' height='6' offsetX='13' offsetY='10' /> + <image frame='6' x='0' y='29' width='6' height='2' offsetX='21' offsetY='12' /> + <image frame='7' equals='6' offsetX='20' offsetY='12' /> + <image frame='8' equals='6' offsetX='21' offsetY='12' /> + <image frame='9' equals='6' offsetX='20' offsetY='12' /> + <image frame='10' equals='6' offsetX='21' offsetY='12' /> +</tilesheet> diff --git a/games/aground/data/core/science1/items/headlamp.png b/games/aground/data/core/science1/items/headlamp.png new file mode 100644 index 00000000..f1b85ce3 Binary files /dev/null and b/games/aground/data/core/science1/items/headlamp.png differ diff --git a/games/aground/data/core/science1/items/headlamp_light.png b/games/aground/data/core/science1/items/headlamp_light.png new file mode 100644 index 00000000..e1496da0 Binary files /dev/null and b/games/aground/data/core/science1/items/headlamp_light.png differ diff --git a/games/aground/data/core/science1/items/items.xml b/games/aground/data/core/science1/items/items.xml new file mode 100644 index 00000000..7fe98424 --- /dev/null +++ b/games/aground/data/core/science1/items/items.xml @@ -0,0 +1,137 @@ +<?xml version="1.0" encoding="utf-8" ?> +<data> + <item id="silicon" type="resource" cost="50" weight="2" icon="silicon.ico" /> + <item id="refined_oil" type="resource" cost="200" weight="2" icon="refined_oil.ico" /> + + <include id="drill.xml" includeRoot="true" /> + <tile id="drill" sheet="drill.png" x="0" y="0" /> + <animation id="equipment.drill" x="1" count="5" /> + <animation id="equipment.drill.idle" count="1" /> + <tile id="drill.arms" equals="drill" /> + <animation id="drill.arms"><frame x="7" /><frame x="6" count="5" /></animation> + <item id="drill" type="equipment" slot="pickaxe" cost="300" power="3" weight="10" mine="4" breakPower="2" icon="drill.ico" behindPlayer="false" animation="item4" fps="24" action="equip" loop="drill" movement_walk="walk_lswing" arms="drill.arms" hideOffhand="true" /> + <item id="battery" type="tool" durability="500" storage="power" cost="100" weight="2" icon="battery.ico" animation="item4" /> + + <tile id="revolver.arms" equals="equipment.arms" /> + <animation id="revolver.arms" x="25" count="8"><frame visible="false" /></animation> + <item id="revolver" type="equipment" slot="weapon" cost="170" weight="4" stamina="1" range="10" icon="revolver.ico" projectile="bullet" sfx="revolver" movement_walk="walk_rswing" arms="revolver.arms"> + <action id="equip" /><action id="setProjectile" /> + </item> + <item id="shotgun" type="equipment" slot="weapon" cost="250" weight="10" stamina="3" range="6" icon="shotgun.ico" projectile="shell" sfx="shotgun" movement_walk="walk_rswing"> + <action id="equip" /><action id="setProjectile" /><use slot="shield" /> + </item> + <tile id="revolver" sheet="{core}/items/weps.png" x="91" /> + <animation id="equipment.revolver.idle" x="8" count="1" /> + <animation id="equipment.revolver" count="9" shift="1" /> + <tile id="shotgun" sheet="{core}/items/weps.png" x="133" /> + <animation id="equipment.shotgun.idle" x="18" count="1" /> + <animation id="equipment.shotgun" count="19" shift="1" /> + + <item id="titanium_armor" type="equipment" slot="armor" cost="700" durability="750" weight="12" defense="4" icon="titanium_armor.ico" action="equip" repair="titanium" equip_anim="equipment.steel_armor" /> + + <tilesheet id="bullets.png" width="8" height="8" /> + <tile id="bullet" sheet="bullets.png" x="0" y="0" /> + <tile id="shell" sheet="bullets.png" x="6" y="0" /> + <animation id="bullet.idle" count="4" /> + <animation id="bullet.impact" x="4" count="2" /> + <animation id="shell.idle" count="3" /> + <animation id="shell.impact" x="3" count="4" /> + <hitEffect id="bullet" tile="bullet" animation="bullet.impact" color="ffdd99" /> + <item id="bullet" type="equipment" cost="18" weight="0.25" icon="bullet.ico" attack="6" action="fire" with="revolver"> + <projectile tile="bullet" animation="bullet.idle" speed="5" delay="2" offsetY="4" hit_sfx="bullet" hitEffect="bullet" /> + </item> + <item id="shell" type="equipment" cost="45" weight="0.5" icon="shell.ico" attack="8" action="fire" with="shotgun"> + <projectile tile="shell" animation="shell.idle" speed="3" delay="5" offsetY="4" hit_sfx="shell" knockback="5"> + <hitEffect tile="shell" animation="shell.impact" color="ffdd99" /> + </projectile> + </item> + + <tile id="chainsaw.arms" equals="equipment.arms" /> + <animation id="chainsaw.arms" x="6" count="12" /> + + <item id="chainsaw" type="equipment" slot="weapon" cost="850" weight="10" attack="6" cut="8" power="6" melee_range="0.25" knockback="5" stamina="1" icon="chainsaw.ico" animation="item2" action="equip" sfx="chainsaw" movement_walk="walk_rswing" arms="chainsaw.arms"> + <onHit type="tree" tile="chainsaw" animation="chainsaw.wood" /> + <onHit type="enemy" tile="chainsaw" animation="chainsaw.blood" /> + </item> + + <tile id="chainsaw" sheet="{core}/items/weps.png" x="185" /> + <animation id="equipment.chainsaw.idle" offsetX="-3" offsetY="3" x="9" count="1" /> + <animation id="equipment.chainsaw" count="12" shift="2" /> + <animation id="chainsaw.blood" x="12" count="7" /> + <animation id="chainsaw.wood" x="19" count="7" /> + + <animation id="landmine.spring"> + <frame visible="false" length="7" /> + <append tile="mine.explosion" animation="mine.explosion" /> + </animation> + + <item id="landmine" type="object" cost="300" weight="2" icon="landmine.ico" action="place" element="fire" object="trap" damage="8" hitEffect="fire_lg_dot" /> + + <item id="bandage" type="tool" cost="40" weight="1" health="60" icon="bandage.ico" action="eat" eat="common.use_count" /> + + <item id="tent" type="tool" cost="500" weight="15" durability="5" durabilityName="common.uses" icon="tent.ico"> + <action id="use" cost="(player.isFlying() || player.isUnderwater() || player.vehicle != null)?0:1" name="structure.tooltip.tent"> + <choose> + <dialogue section="warning" id="no_flying" if="player.isFlying()" /> + <dialogue section="warning" id="sleep_underwater" if="player.isUnderwater()" /> + <dialogue section="warning" id="sleep_vehicle" if="player.vehicle != null" /> + <section><action>player.restoreStamina();</action><save sleep="true" /></section> + </choose> + </action> + </item> + + <tilesheet id="headlamp_light.png" width="192" height="141" /> + <tile id="light.headlamp" sheet="headlamp_light.png" /> + <item id="headlamp" type="tool" cost="150" slot="head" block="false" action="equip" weight="1" icon="headlamp.ico"> + <light tile="light.headlamp" offsetX="-61" /><equipCost storage="power" cost="1" /> + </item> + + <tilesheet id="headlamp.png" width="9" height="4" /> + <tile id="headlamp" sheet="headlamp.png" x="0" y="0" /> + <animation id="equipment.headlamp.idle" count="1" offsetX="0.5" offsetY="0" /> + <animation id="equipment.headlamp.off" x="1" count="1" offsetX="0.5" offsetY="0" /> + + <procedure id="remove_cyborg"> + <window type="prompt" eval="'warning.remove_cyborg{item:[item='+this.id+']}'"><action>player.equipment.forceEquip(this.xml.get("slot"), player)</action></window> + </procedure> + + <include id="cyborg.xml" includeRoot="true" /> + <tile id="cyborg_body" sheet="cyborg.png" x="22" /> + <animation id="equipment.cyborg_body.idle" x="57" count="3" /> + <animation id="equipment.cyborg_body.walk" x="47" count="10" /> + <animation id="equipment.cyborg_body.hit" x="41" count="6" /> + <animation id="equipment.cyborg_body.death" x="0" count="41" /> + <item id="cyborg_body" type="none" slot="armor" cost="0" weight="0" defense="4" icon="cyborg_body.ico" unequip="false"> + <action id="use" name="common.remove" closeWindow="false"><run procedure="remove_cyborg" /></action> + <equipCost health="-5" storage="power" cost="10" injured="true" /> + </item> + + <tile id="cyborg_eye" sheet="cyborg.png" x="17" /> + <tile id="cyborg.identify" sheet="cyborg.png" x="0" /> + <animation id="cyborg.acquire" x="0" count="12" color="f62d2d" /> + <animation id="cyborg.identify" x="12" count="5" color="f62d2d" /> + <animation id="equipment.cyborg_eye.idle" x="0" count="5" /> + <item id="cyborg_eye" type="none" slot="head" cost="0" weight="0" icon="cyborg_eye.ico" unequip="false" animation="item6"> + <action id="use" name="common.remove" closeWindow="false"><run procedure="remove_cyborg" /></action> + <equipCost storage="power" cost="1" /> + <light tile="light.strong" color="ff9898" flicker="true" /><identify tile="cyborg.identify" acquire="cyborg.acquire" animation="cyborg.identify" color="f61414" /> + </item> + + <include id="cyborg_pack.xml" includeRoot="true" /> + <tile id="cyborg_back" x="7" sheet="cyborg_pack.png" /> + <animation id="equipment.cyborg_back.idle" offsetX="8" x="5" count="8" /> + <animation id="equipment.cyborg_back.fly.self" offsetX="8" offsetY="4" x="0" count="5" /> + <animation id="equipment.cyborg_back.hover.self" equals="equipment.cyborg_back.fly.self" /> + <item id="cyborg_back" type="none" slot="back" cost="0" weight="0" capacity="200" icon="cyborg_back.ico" unequip="false" animation="item4"> + <action id="use" name="common.remove" closeWindow="false"><run procedure="remove_cyborg" /></action> + <flight height="10" cost="0" speed="4" maxWeight="500"><equipCost storage="power" cost="10" /></flight> + <equipCost storage="power" cost="-5" /> + </item> + + <tile id="machine_gun_arm" x="0" sheet="cyborg_pack.png" /> + <animation id="equipment.machine_gun_arm" x="1" count="6" offsetX="-5" offsetY="1" /> + <animation id="equipment.machine_gun_arm.idle" x="0" count="1" offsetX="-5" offsetY="1" /> + <item id="machine_gun_arm" type="none" slot="shield" use="attack" cost="0" weight="0" delay="-2" movement_walk="walk_lswing" range="10" sfx="machine_gun" repeat="8" icon="machine_gun_arm.ico" unequip="false" action="setProjectile" projectile="bullet" group="revolver"> + <action id="use" name="common.remove" closeWindow="false"><run procedure="remove_cyborg" /></action> + </item> +</data> \ No newline at end of file diff --git a/games/aground/data/core/science1/npc/fisher.xml b/games/aground/data/core/science1/npc/fisher.xml new file mode 100644 index 00000000..f86d8d7e --- /dev/null +++ b/games/aground/data/core/science1/npc/fisher.xml @@ -0,0 +1,139 @@ +<?xml version="1.0" encoding="utf-8" ?> +<npcs> + <include id="fisherman.xml" includeRoot="true" /> + <tile id="fisherman" sheet="fisherman.png" x="0" y="0" /> + <animation id="fisherman.idle"> + <frame x="0" y="0" length="4" /> + <frame x="1" y="0" length="2" /> + <frame x="0" y="0" length="32" /> + </animation> + <animation id="fisherman.walk" count="10" x="30" /> + <animation id="fisherman.talk" count="8" x="22" /> + <animation id="fisherman.cast" count="4" x="2" /> + <animation id="fisherman.fishing" count="6" x="16" /> + <animation id="fisherman.catch" count="10" x="6" /> + + <tilesheet id="fisherman_boat.png" width="80" height="64" /> + <tile id="fisherman.boat" sheet="fisherman_boat.png" x="0" y="0" /> + <animation id="fisherman.boat.idle" equals="single" /> + <animation id="fisherman.boat.sail" x="1" count="8" /> + <object id="fisherman.boat" tile="fisherman.boat" animation="fisherman.boat.idle" layer="back" renderer="floating" waterLine="57"> + <tooltip section="npc" id="talk" if="!getFlag('fisherman_intro') && this.tile_x > 200" /> + <operate> + <scene id="fisherman" show="intro_water" with="fade" if="!getFlag('fisherman_intro') && this.tile_x > 200" showToAll="true"> + <action>setFlag('fisherman_intro', true);</action> + </scene> + </operate> + </object> + + <procedure id="fisherman.disembark"> + <action>area.getObject('fisherman.boat').updatePosition()</action><object id="fisherman" x="198" /> + </procedure> + + <quest id="fisherman_cat" giver="fisherman" exp="150"> + <item id="cat" count="1" /> + </quest> + + <procedure id="fisherman.tips"> + <group> + <section> + <show id="fishing_tooltip" tooltip="key" key="select" text="common.fishing_line" seconds="0.16" x="0.5" y="0.75" /> + <dialogue section="fisherman" id="tip1" speaker='this' /> + <hide id="fishing_tooltip" seconds="0.16" /> + </section> + <section> + <show id="fishing_tooltip" tooltip="key" key="select" text="common.fishing_pull" seconds="0.16" x="0.5" y="0.75" /> + <dialogue section="fisherman" id="tip2" speaker='this' /> + <hide id="fishing_tooltip" seconds="0.16" /> + </section> + <section> + <show id="fishing_tooltip" tooltip="key" key="left" text="common.fishing_pull" seconds="0.16" x="0.5" y="0.75" /> + <dialogue section="fisherman" id="tip3" speaker='this' /> + <hide id="fishing_tooltip" seconds="0.16" /> + </section> + </group> + </procedure> + + <npc id="fisherman" tile="fisherman" action="talk" talk_sfx="talking1" sleepPos="[199,-1]"> + <idle class="fishing" max_difficulty="2" storeIf="player.questComplete('fisherman_cat')" /> + <operate> + <scene id="fisherman" show="intro" with="fade" if="!getFlag('fisherman_intro')" showToAll="true"> + <action>setFlag('fisherman_intro', true);</action> + <object id="fisherman.cat" x="this.tile_x" name="cat" /><action>unlockNPC(cat);</action> + </scene> + <scene id="fisherman" show="scene" with="fade" if="getFlag('innkeeper_scene') && player.questComplete('elevator') && !getFlag('fisherman_scene')" showToAll="true"> + <action>setFlag('fisherman_scene', true);</action> + </scene> + <section if="!player.hasQuest('fisherman_cat')"> + <section if="area.getObject('fisherman.cat') == null"> + <object id="fisherman.cat" x="this.tile_x" name="cat" /><action>unlockNPC(cat);</action><wait seconds="1"><operate object="area.getObject('fisherman.cat')" /></wait> + </section> + <dialogue section="fisherman" id="cat1" speaker='this' /> + <dialogue section="fisherman" id="cat2" speaker='this' /> + <dialogue section="fisherman" id="cat3" speaker='this' /> + <quest id="fisherman_cat"> + <dialogue section="fisherman" id="cat4" speaker='this' /> + <item id="fishing_rod" modal="true" /> + <dialogue section="fisherman" id="cat5" speaker='this' /> + </quest> + </section> + <choose if="!player.questComplete('fisherman_cat')"> + <section if="getVar('fisherman_cat') >= 3 && player.canCompleteQuest('fisherman_cat')"> + <dialogue section="fisherman" id="cat6" speaker='this' /> + <complete quest="fisherman_cat" useResources="false" /> + <dialogue section="fisherman" id="cat7" speaker='this' /> + <equip id="cat" ifEmpty="true" /> + </section> + <run procedure="fisherman.tips" /> + </choose> + <run procedure="fisherman.tips" /> + </operate> + </npc> + + <npc id="fisherman.cat" tile="cat" animation="cat" action="grab" stopForPlayer="getVar('fisherman_cat') > 0 && player.hasItem('toothfish')" speed="1"> + <idle class="wander" fromX="110" toX="192" /> + <tooltip section="actions" id="feed" if="player.hasItem('toothfish')" /> + <operate> + <choose if="player.hasItem('toothfish')"> + <section if="getVar('fisherman_cat') == 0"> + <action>setVar('fisherman_cat', 1); this.idle.runFrom(player)</action> + <item id="toothfish" count="-1" /> + <wait seconds="0.25"><operate object="this" /></wait> + <dialogue section="fisherman" id="cat9" /> + </section> + <section if="getVar('fisherman_cat') == 1"> + <sound id="meow" /><wait seconds="0.5" /> + <menu section="common" showCoins="true"> + <dialogue section="fisherman" id="cat11" /> + <choice id="yes"> + <item id="toothfish" count="-1" modal="true" /> + <action>setVar('fisherman_cat', 2); this.idle.runFrom(player)</action> + <wait seconds="0.25"><operate object="this" /></wait> + <dialogue section="fisherman" id="cat12" /> + </choice> + <choice id="no"> + <action>this.idle.runFrom(player)</action> + <wait seconds="0.25"><operate object="this" /></wait> + </choice> + </menu> + </section> + <section> + <quest /> + <dialogue section="fisherman" id="cat13" speaker="player" /> + <item id="toothfish" count="-1" modal="true" /> + <sound id="purr" /><wait seconds="2" /> + <lerp object="this" alpha="0" seconds="0.25" /> + <item id="cat" name="Peri" /> + <remove object="this" /> + <dialogue section="fisherman" id="cat15" /> + <action>setVar('fisherman_cat', 3)</action> + </section> + </choose> + <section> + <action>this.idle.runFrom(player)</action> + <wait seconds="0.25"><operate object="this" /></wait> + <dialogue section="fisherman" id="cat8" /> + </section> + </operate> + </npc> +</npcs> \ No newline at end of file diff --git a/games/aground/data/core/science1/npc/fisherman.png b/games/aground/data/core/science1/npc/fisherman.png new file mode 100644 index 00000000..625a2f45 Binary files /dev/null and b/games/aground/data/core/science1/npc/fisherman.png differ diff --git a/games/aground/data/core/science1/npc/fisherman.xml b/games/aground/data/core/science1/npc/fisherman.xml new file mode 100644 index 00000000..4d38dc06 --- /dev/null +++ b/games/aground/data/core/science1/npc/fisherman.xml @@ -0,0 +1,42 @@ +<tilesheet id='fisherman.png' width='16' height='16' offsetX="-16"> + <image frame='0' x='0' y='0' width='15' height='16' offsetX='17' offsetY='0' /> + <image frame='1' x='0' y='16' width='15' height='16' offsetX='17' offsetY='0' /> + <image frame='2' x='15' y='0' width='24' height='16' offsetX='6' offsetY='0' /> + <image frame='3' x='39' y='0' width='25' height='15' offsetX='5' offsetY='1' /> + <image frame='4' x='64' y='0' width='24' height='12' offsetX='6' offsetY='4' /> + <image frame='5' x='15' y='16' width='24' height='11' offsetX='6' offsetY='5' /> + <image frame='6' x='88' y='0' width='23' height='11' offsetX='7' offsetY='5' /> + <image frame='7' x='39' y='16' width='23' height='11' offsetX='8' offsetY='5' /> + <image frame='8' x='62' y='16' width='23' height='11' offsetX='9' offsetY='5' /> + <image frame='9' x='15' y='27' width='21' height='14' offsetX='11' offsetY='2' /> + <image frame='10' x='15' y='41' width='21' height='14' offsetX='11' offsetY='2' /> + <image frame='11' x='36' y='27' width='32' height='14' offsetX='0' offsetY='2' /> + <image frame='12' x='15' y='55' width='18' height='14' offsetX='14' offsetY='2' /> + <image frame='13' x='68' y='27' width='32' height='13' offsetX='0' offsetY='3' /> + <image frame='14' x='15' y='69' width='21' height='13' offsetX='11' offsetY='3' /> + <image frame='15' x='36' y='41' width='31' height='11' offsetX='0' offsetY='5' /> + <image frame='16' x='85' y='16' width='24' height='11' offsetX='6' offsetY='5' /> + <image frame='17' x='67' y='41' width='24' height='11' offsetX='6' offsetY='5' /> + <image frame='18' x='36' y='52' width='23' height='11' offsetX='7' offsetY='5' /> + <image frame='19' x='59' y='52' width='24' height='11' offsetX='6' offsetY='5' /> + <image frame='21' x='83' y='52' width='24' height='11' offsetX='6' offsetY='5' /> + <image frame='22' x='0' y='32' width='15' height='16' offsetX='17' offsetY='0' /> + <image frame='23' x='0' y='48' width='15' height='16' offsetX='17' offsetY='0' /> + <image frame='24' x='0' y='64' width='15' height='16' offsetX='17' offsetY='0' /> + <image frame='25' x='0' y='80' width='15' height='16' offsetX='17' offsetY='0' /> + <image frame='26' x='15' y='82' width='15' height='16' offsetX='17' offsetY='0' /> + <image frame='28' x='36' y='63' width='15' height='16' offsetX='17' offsetY='0' /> + <image frame='29' x='36' y='79' width='15' height='16' offsetX='17' offsetY='0' /> + <image frame='30' x='36' y='95' width='15' height='16' offsetX='16' offsetY='0' /> + <image frame='31' x='59' y='63' width='16' height='16' offsetX='16' offsetY='0' /> + <image frame='32' x='59' y='79' width='16' height='16' offsetX='16' offsetY='0' /> + <image frame='33' x='59' y='95' width='15' height='16' offsetX='16' offsetY='0' /> + <image frame='34' x='75' y='63' width='15' height='16' offsetX='17' offsetY='0' /> + <image frame='35' x='90' y='63' width='15' height='16' offsetX='17' offsetY='0' /> + <image frame='36' x='75' y='79' width='15' height='16' offsetX='17' offsetY='0' /> + <image frame='37' x='75' y='95' width='15' height='16' offsetX='17' offsetY='0' /> + <image frame='38' x='90' y='79' width='15' height='16' offsetX='17' offsetY='0' /> + <image frame='39' x='90' y='95' width='15' height='16' offsetX='17' offsetY='0' /> + <image frame='20' equals='18' offsetX='7' offsetY='5' /> + <image frame='27' equals='25' offsetX='17' offsetY='0' /> +</tilesheet> diff --git a/games/aground/data/core/science1/npc/fisherman_boat.png b/games/aground/data/core/science1/npc/fisherman_boat.png new file mode 100644 index 00000000..df401a8a Binary files /dev/null and b/games/aground/data/core/science1/npc/fisherman_boat.png differ diff --git a/games/aground/data/core/science1/npc/lurker.png b/games/aground/data/core/science1/npc/lurker.png new file mode 100644 index 00000000..5431ebbf Binary files /dev/null and b/games/aground/data/core/science1/npc/lurker.png differ diff --git a/games/aground/data/core/science1/npc/lurker.xml b/games/aground/data/core/science1/npc/lurker.xml new file mode 100644 index 00000000..8396b40b --- /dev/null +++ b/games/aground/data/core/science1/npc/lurker.xml @@ -0,0 +1,56 @@ +<tilesheet id='lurker.png' width='16' height='16'> + <image frame='0' x='0' y='0' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='3' x='0' y='11' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='5' x='0' y='22' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='9' x='0' y='33' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='10' x='0' y='44' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='11' x='13' y='0' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='17' x='13' y='11' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='20' x='13' y='22' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='21' x='13' y='33' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='22' x='13' y='44' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='24' x='26' y='0' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='25' x='26' y='11' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='26' x='26' y='22' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='27' x='26' y='33' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='31' x='26' y='44' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='33' x='39' y='0' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='34' x='52' y='0' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='35' x='65' y='0' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='36' x='78' y='0' width='15' height='11' offsetX='1' offsetY='5' /> + <image frame='37' x='39' y='11' width='15' height='11' offsetX='1' offsetY='5' /> + <image frame='38' x='39' y='22' width='15' height='11' offsetX='1' offsetY='5' /> + <image frame='39' x='39' y='33' width='15' height='11' offsetX='1' offsetY='5' /> + <image frame='40' x='39' y='44' width='15' height='11' offsetX='1' offsetY='5' /> + <image frame='44' x='54' y='11' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='45' x='67' y='11' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='46' x='80' y='11' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='47' x='54' y='22' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='48' x='54' y='33' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='49' x='54' y='44' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='50' x='67' y='22' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='51' x='80' y='22' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='52' x='67' y='33' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='53' x='67' y='44' width='13' height='11' offsetX='3' offsetY='5' /> + <image frame='1' equals='0' offsetX='3' offsetY='5' /> + <image frame='2' equals='0' offsetX='3' offsetY='5' /> + <image frame='4' equals='3' offsetX='3' offsetY='5' /> + <image frame='6' equals='5' offsetX='3' offsetY='5' /> + <image frame='7' equals='5' offsetX='3' offsetY='5' /> + <image frame='8' equals='5' offsetX='3' offsetY='5' /> + <image frame='12' equals='0' offsetX='3' offsetY='5' /> + <image frame='13' equals='0' offsetX='3' offsetY='5' /> + <image frame='14' equals='3' offsetX='3' offsetY='5' /> + <image frame='15' equals='5' offsetX='3' offsetY='5' /> + <image frame='16' equals='5' offsetX='3' offsetY='5' /> + <image frame='18' equals='0' offsetX='3' offsetY='5' /> + <image frame='19' equals='17' offsetX='3' offsetY='5' /> + <image frame='23' equals='22' offsetX='3' offsetY='5' /> + <image frame='28' equals='26' offsetX='3' offsetY='5' /> + <image frame='29' equals='27' offsetX='3' offsetY='5' /> + <image frame='30' equals='26' offsetX='3' offsetY='5' /> + <image frame='32' equals='26' offsetX='3' offsetY='5' /> + <image frame='41' equals='35' offsetX='3' offsetY='5' /> + <image frame='42' equals='34' offsetX='3' offsetY='5' /> + <image frame='43' equals='33' offsetX='3' offsetY='5' /> +</tilesheet> diff --git a/games/aground/data/core/science1/npc/mechanic.xml b/games/aground/data/core/science1/npc/mechanic.xml new file mode 100644 index 00000000..8d8c0992 --- /dev/null +++ b/games/aground/data/core/science1/npc/mechanic.xml @@ -0,0 +1,149 @@ +<?xml version="1.0" encoding="utf-8" ?> +<npcs> + <tile id="mechanic" sheet="npcs.png" x="0" y="0" /> + <animation id="mechanic.idle"> + <frame x="0" y="0" length="4" /> + <frame x="1" y="0" length="2" /> + <frame x="0" y="0" length="32" /> + </animation> + <animation id="mechanic.walk" count="10" x="2" /> + <animation id="mechanic.talk" count="8" x="12" /> + <animation id="mechanic.repair" count="19" x="20" /> + + <quest id="powerplant" giver="mechanic" exp="150" achievement="powerplant"> + <item id="titanium" count="2" /> + </quest> + <quest id="factory" giver="mechanic" exp="200" achievement="factory"> + <item id="coal" count="15" /> + <item id="sulfur" count="10" /> + <item id="quartz" count="4" /> + </quest> + <quest id="elevator" giver="mechanic" exp="250" achievement="elevator"> + <item id="silicon" count="2" /> + <item id="titanium" count="2" /> + <item id="steel_bar" count="10" /> + <item id="chest" count="1" /> + </quest> + + <procedure id="mechanic.tips"> + <choose> + <section if="area.getStructureById('power_plant').animal != null && !getFlag('mechanic_dragon')"> + <dialogue section="mechanic" id="dragon" speaker="this" /><action>setFlag('mechanic_dragon', true);</action> + </section> + <group> + <dialogue section="mechanic" id="mirrows5" speaker="this" if="getFlag('mechanic.mirrows') && !getFlag('mirrow.defeat')" /> + <dialogue section="mechanic" id="battery" speaker='this' if="player.hasQuest('mirrows') && !player.hasQuest('factory')" /> + <dialogue section="mechanic" id="tip1" speaker='this' /> + <dialogue section="mechanic" id="tip2" speaker='this' /> + <dialogue section="mechanic" id="tip3" speaker='this' /> + </group> + </choose> + </procedure> + <procedure id="mechanic.repair"> + <choose> + <section if="area.getStructureById('power_plant').animal != null && !getFlag('mechanic_dragon')"> + <dialogue section="mechanic" id="dragon" speaker="this" /><action>setFlag('mechanic_dragon', true);</action> + </section> + <section> + <dialogue section="mechanic" id="repair" speaker='this' /> + <window type="repair" includeStorehouse="true"> + <craft><action>this.playAnimation("repair")</action></craft> + </window> + </section> + </choose> + </procedure> + + <npc id="mechanic" tile="mechanic" action="talk" talk_sfx="talking6"> + <idle class="repair"> + <repair structure="power_plant"> + <addItem id="coal" if="player.hasQuest('factory')" /> + </repair> + <repair structure="elevator" /><repair structure="factory" /><repair structure="powerline1" /><repair structure="powerline2" /><repair type="mechanic" /> + </idle> + <operate> + <section if="!player.hasQuest('powerplant')"> + <dialogue section="mechanic" id="introduce1" speaker='this' /> + <dialogue section="mechanic" id="introduce2" speaker='player' /> + <dialogue section="mechanic" id="introduce3" speaker='this' /> + <dialogue section="mechanic" id="introduce4" speaker='this' /> + <dialogue section="mechanic" id="introduce5" speaker='this' /> + <quest id="powerplant" /> + </section> + <choose if="!player.questComplete('powerplant')"> + <section if="player.canCompleteQuest('powerplant')"> + <dialogue section="mechanic" id="powerplant1" speaker='this' /> + <dialogue section="mechanic" id="powerplant2" speaker='this' /> + <set id="old" value="area.getStructureById('damaged_power_plant')" /> + <complete quest="powerplant" /><pan toStructure="old" seconds="0.25" /> + <item id="power_plant_blueprint" hidden="true" /> + <sound id="build" /><wait seconds="0.5" /> + <lerp object="old" alpha="0" seconds="0.25" /><structure id="power_plant" x="old.xPos/Tile.SIZE" var="pp" /> + <action>pp.renderer.alpha = 0;</action><lerp object="pp" alpha="1" seconds="0.25" /> + <wait seconds="0.5" /><pan toObject="player" seconds="0.25" /> + <dialogue section="mechanic" id="powerplant3" speaker='this' /> + <dialogue section="mechanic" id="powerplant4" speaker='this' /> + <item id="steel_bar" modal="true" /> + </section> + <dialogue section="mechanic" id="powerplant5" speaker='this' /> + </choose> + <section if="(player.getMaxPower() > 0 || player.questComplete('bandits')) && !player.hasQuest('factory')"> + <dialogue section="mechanic" id="factory1" speaker='this' /> + <dialogue section="mechanic" id="factory2" speaker='this' /> + <quest id="factory" /> + </section> + <section if="player.hasQuest('factory') && player.canCompleteQuest('factory')"> + <dialogue section="mechanic" id="factory3" speaker='this' /> + <complete quest="factory" reserve="prepare" /> + <structure id="factory" x="137" place="true" rangeX="64" rangeY="0" sfx="build" seconds="0.25"> + <onPlace> + <complete quest="factory" reserve="finish" /> + <lerp object="object" alpha="1" seconds="0.25" /><pan toObject="player" seconds="0.25" /> + <item id="workshop_upgrade" hidden="true" /> + <dialogue section="mechanic" id="factory4" speaker='this' /> + </onPlace> + <onCancel><complete quest="factory" reserve="cancel" /><pan toObject="player" seconds="0.25" /></onCancel> + </structure> + </section> + <dialogue section="mechanic" id="sleep" speaker="this" if="isNight()" /> + <scene id="mechanic" show="intro" if="!getFlag('mechanic.intro')" with="fade" showToAll="true" /> + <choose if="player.hasQuest('mirrows')"> + <section if="getFlag('mirrow.intro') && !getFlag('mirrow.defeat') && !getFlag('mechanic.mirrows')"> + <quest /><scene id="mechanic" show="mirrows" with="fade" showToAll="true" /> + </section> + <section if="getFlag('mirrow.intro') && getFlag('medicom.panel9.read') && getFlag('medicom.panel10.read') && !getFlag('mirrow.defeat') && !player.hasQuest('mirrows2')"> + <quest /><scene id="mechanic" show="mirrows2" with="fade" showToAll="true" /> + </section> + <section if="getFlag('mirrow.intro') && !getFlag('mirrow.defeat') && player.hasQuest('mirrows2') && !player.questComplete('mirrows2') && player.canCompleteQuest('mirrows2')"> + <complete quest="mirrows2" useResources="false" /><scene id="mechanic" show="mirrows3" with="fade" showToAll="true" /> + </section> + <run procedure="mechanic.tips" if="!player.questComplete('factory')" /> + <choose if="player.getDigCount('sci1.stone') > 0"> + <section if="!player.hasQuest('elevator')"> + <dialogue section="mechanic" id="elevator1" speaker='this' /> + <dialogue section="mechanic" id="elevator2" speaker='this' /> + <quest id="elevator" /> + </section> + <choose if="!player.questComplete('elevator')"> + <section if="player.canCompleteQuest('elevator')"> + <dialogue section="mechanic" id="elevator3" speaker='this' /> + <complete quest="elevator" reserve="prepare" /> + <structure id="elevator" x="145" place="true" rangeX="64" rangeY="0" sfx="build" seconds="0.25" alignTile="true"> + <onPlace> + <complete quest="elevator" reserve="finish" /> + <lerp object="object" alpha="1" seconds="0.25" /><pan toObject="player" seconds="0.25" /> + <item id="elevator_blueprint" hidden="true" /> + <dialogue section="mechanic" id="elevator4" speaker='this' /> + </onPlace> + <onCancel><complete quest="elevator" reserve="cancel" /><pan toObject="player" seconds="0.25" /></onCancel> + </structure> + </section> + <run procedure="mechanic.repair" /> + </choose> + <run procedure="mechanic.repair" /> + </choose> + <run procedure="mechanic.tips" /> + </choose> + <run procedure="mechanic.tips" /> + </operate> + </npc> +</npcs> \ No newline at end of file diff --git a/games/aground/data/core/science1/npc/mirrows.xml b/games/aground/data/core/science1/npc/mirrows.xml new file mode 100644 index 00000000..ffabbf32 --- /dev/null +++ b/games/aground/data/core/science1/npc/mirrows.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8" ?> +<data> + <procedure id="mirrows.npc"><choose> + <group if="getFlag('mirrow.defeat')"> + <dialogue section="mirrows" id="defeat5" speaker="this" /> + <dialogue section="mirrows" id="tip1" speaker="this" /> + </group> + <section if="area.getObject('mirrow_n') == null && area.getObject('mirrow_d') == null"> + <run procedure="mirrow.lab.music" /><scene id="mirrows" show="defeat" with="fade" showToAll="true" /> + </section> + <dialogue section="mirrows" id="defeat0" speaker="this" /> + </choose></procedure> + <npc id="mirrow_n.npc" tile="mirrow_n" action="talk" talk_sfx="talking6" animation="mirrow_n" researcher="true"> + <operate><section><action>lockNPC(area.getNPC('mirrow_d.npc'));</action><run procedure="mirrows.npc" /></section></operate> + </npc> + <npc id="mirrow_d.npc" tile="mirrow_d" action="talk" talk_sfx="talking4" animation="mirrow_d" researcher="true"> + <operate><section><action>lockNPC(area.getNPC('mirrow_n.npc'));</action><run procedure="mirrows.npc" /></section></operate> + </npc> +</data> \ No newline at end of file diff --git a/games/aground/data/core/science1/npc/npcs.png b/games/aground/data/core/science1/npc/npcs.png new file mode 100644 index 00000000..d8ed2957 Binary files /dev/null and b/games/aground/data/core/science1/npc/npcs.png differ diff --git a/games/aground/data/core/science1/npc/npcs.xml b/games/aground/data/core/science1/npc/npcs.xml new file mode 100644 index 00000000..0604a42c --- /dev/null +++ b/games/aground/data/core/science1/npc/npcs.xml @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="utf-8" ?> +<data> + <include id="mechanic.xml" /> + <include id="fisher.xml" /> + <include id="mirrows.xml" /> + + <include id="townfolk.xml" includeRoot="true" /> + <tile id="science1.townfolk" sheet="townfolk.png" /> + <layers id="science1.townfolk" width="16" height="16" cols="5" rows="2"> + <layer tile="science1.townfolk" color="skin"><!-- body --> + <frame x="8" length="10" /> + </layer> + <layer tile="science1.townfolk" color="eyes"><!-- eyes --> + <frame visible="false" /><frame x="9" length="9" /> + </layer> + <layer tile="science1.townfolk" color="hair" offset="hair"><!-- hair --> + <frame x="18" length="10" /> + </layer> + <layer tile="science1.townfolk" color="skin"><!-- legs --> + <frame x="58" length="2" /><frame x="0" count="8" /> + </layer> + <layer tile="science1.townfolk" color="shirt" offset="shirt"><!-- shirt --> + <frame x="34" length="10" /> + </layer> + <layer tile="science1.townfolk" color="pants" offset="pants"><!-- pants --> + <frame x="26" length="10" /> + </layer> + <layer tile="science1.townfolk" color="skin"><!-- arms --> + <frame x="45" length="2" /><frame x="42" count="8" /> + </layer> + <layer tile="science1.townfolk" color="hat" offset="hat"><!-- uncolored --> + <frame x="50" length="10" /> + </layer> + </layers> + + <colors type="hat" equals="shirt" /> + <animation id="science1.townfolk.idle"> + <frame x="1" y="0" length="4" /> + <frame x="0" y="0" length="2" /> + <frame x="1" y="0" length="32" /> + </animation> + <animation id="science1.townfolk.walk" count="8" x="2" /> + <npc id="science1.townfolk.base" layers="science1.townfolk" behind="true" fps="6" animation="science1.townfolk"> + <idle class="wander" flee="true" /> + <offset id="hair" count="8" /><offset id="shirt" count="8" /><offset id="pants" count="8" /><offset id="hat" count="8" hide="true" /> + <color id="skin" /><color id="hair" /><color id="eyes" /><color id="shirt" /><color id="pants" /><color id="hat" /> + </npc> + <npc id="science1.townfolk" extends="science1.townfolk.base"> + <idle class="wander" fromX="124" toX="190" flee="true" /> + </npc> + + <include id="lurker.xml" includeRoot="true" /> + <tile id="lurker" sheet="lurker.png" /> + <animation id="lurker.idle" count="18" /> + <animation id="lurker.talk" x="18" count="26"><frame count="18" /></animation> + <animation id="lurker.walk" x="44" count="10" /> + <procedure id="lurker.restock"> + <action> + this.inventory.addItems(getItem("cockatiel"), 1); this.inventory.addItems(getItem("kitchen_blueprint"), 1); this.inventory.addItems(getItem("kitchen_upgrade"), 1); + this.inventory.addItems(getItem("jetpack"), 1); this.inventory.addItems(getItem("shadow_cape"), 1); this.inventory.addItems(getItem("owl"), 1); + this.inventory.addItems(getItem("horn"), 5); if(!getFlag('bombardment')){this.inventory.addItems(getItem("titanium"), 5); this.inventory.addItems(getItem("uranium"), 3);} + this.inventory.addItems(getItem("coral_cod"), 5); this.inventory.addItems(getItem("warehouse_blueprint"), 1); + this.inventory.addItems(getItem("powerline_blueprint"), 1); + </action> + </procedure> + <npc id="lurker" tile="lurker" action="talk" talk_sfx="talking1" night="true" sleepDay="true"> + <idle class="wander" fromX="160" toX="172" /> + <operate><section> + <section if="this.inventory.hasItem()"> + <dialogue section="player" id="lurker" speaker="this" /><window type="store" inventory="this.inventory" price="5" /> + </section><dialogue section="player" id="lurker_empty" speaker="this" /> + </section></operate> + <addedToArea><action>this.inventory.clear();</action><run procedure="lurker.restock" /></addedToArea> + <awaken><action>this.inventory.clear();</action><run procedure="lurker.restock" /></awaken> + </npc> +</data> \ No newline at end of file diff --git a/games/aground/data/core/science1/npc/townfolk.png b/games/aground/data/core/science1/npc/townfolk.png new file mode 100644 index 00000000..b657b9b8 Binary files /dev/null and b/games/aground/data/core/science1/npc/townfolk.png differ diff --git a/games/aground/data/core/science1/npc/townfolk.xml b/games/aground/data/core/science1/npc/townfolk.xml new file mode 100644 index 00000000..b2d1c832 --- /dev/null +++ b/games/aground/data/core/science1/npc/townfolk.xml @@ -0,0 +1,61 @@ +<tilesheet id='townfolk.png' width='16' height='16'> + <image frame='0' x='0' y='0' width='10' height='1' offsetX='3' offsetY='15' /> + <image frame='1' x='10' y='0' width='1' height='1' offsetX='4' offsetY='15' /> + <image frame='2' x='11' y='0' width='2' height='1' offsetX='6' offsetY='15' /> + <image frame='4' x='13' y='0' width='10' height='1' offsetX='3' offsetY='15' /> + <image frame='5' x='23' y='0' width='1' height='1' offsetX='4' offsetY='15' /> + <image frame='6' x='24' y='0' width='2' height='1' offsetX='7' offsetY='15' /> + <image frame='7' x='0' y='1' width='7' height='2' offsetX='4' offsetY='14' /> + <image frame='8' x='0' y='3' width='8' height='9' offsetX='4' offsetY='6' /> + <image frame='9' x='26' y='0' width='5' height='1' offsetX='4' offsetY='10' /> + <image frame='10' x='31' y='0' width='3' height='1' offsetX='5' offsetY='11' /> + <image frame='11' x='34' y='0' width='3' height='1' offsetX='5' offsetY='11' /> + <image frame='12' x='37' y='0' width='1' height='1' offsetX='5' offsetY='11' /> + <image frame='18' x='8' y='3' width='9' height='7' offsetX='4' offsetY='5' /> + <image frame='19' x='8' y='10' width='10' height='8' offsetX='4' offsetY='4' /> + <image frame='20' x='0' y='12' width='8' height='4' offsetX='4' offsetY='5' /> + <image frame='21' x='0' y='16' width='8' height='5' offsetX='4' offsetY='6' /> + <image frame='22' x='17' y='3' width='10' height='7' offsetX='4' offsetY='6' /> + <image frame='23' x='27' y='3' width='10' height='6' offsetX='3' offsetY='6' /> + <image frame='24' x='8' y='18' width='9' height='7' offsetX='3' offsetY='6' /> + <image frame='25' x='0' y='21' width='8' height='7' offsetX='4' offsetY='6' /> + <image frame='26' x='7' y='1' width='8' height='1' offsetX='4' offsetY='14' /> + <image frame='27' x='7' y='2' width='8' height='1' offsetX='4' offsetY='14' /> + <image frame='28' x='15' y='1' width='8' height='2' offsetX='4' offsetY='14' /> + <image frame='29' x='23' y='1' width='8' height='1' offsetX='4' offsetY='14' /> + <image frame='30' x='23' y='2' width='8' height='1' offsetX='4' offsetY='14' /> + <image frame='31' x='31' y='1' width='8' height='2' offsetX='4' offsetY='14' /> + <image frame='32' x='0' y='28' width='8' height='1' offsetX='4' offsetY='14' /> + <image frame='33' x='0' y='29' width='8' height='1' offsetX='4' offsetY='14' /> + <image frame='34' x='0' y='30' width='8' height='2' offsetX='4' offsetY='12' /> + <image frame='35' x='0' y='32' width='8' height='2' offsetX='4' offsetY='12' /> + <image frame='36' x='0' y='34' width='8' height='2' offsetX='4' offsetY='12' /> + <image frame='37' x='0' y='36' width='8' height='3' offsetX='4' offsetY='12' /> + <image frame='38' x='37' y='3' width='8' height='3' offsetX='4' offsetY='12' /> + <image frame='39' x='8' y='25' width='10' height='4' offsetX='3' offsetY='11' /> + <image frame='40' x='8' y='29' width='10' height='3' offsetX='4' offsetY='11' /> + <image frame='41' x='37' y='6' width='8' height='3' offsetX='4' offsetY='12' /> + <image frame='42' x='8' y='32' width='9' height='2' offsetX='3' offsetY='12' /> + <image frame='45' x='39' y='1' width='1' height='2' offsetX='10' offsetY='12' /> + <image frame='47' x='40' y='1' width='2' height='2' offsetX='8' offsetY='12' /> + <image frame='50' x='18' y='10' width='13' height='9' offsetX='2' offsetY='0' /> + <image frame='51' x='8' y='34' width='10' height='5' offsetX='3' offsetY='3' /> + <image frame='52' x='31' y='10' width='12' height='7' offsetX='2' offsetY='1' /> + <image frame='53' x='18' y='19' width='15' height='5' offsetX='0' offsetY='5' /> + <image frame='54' x='18' y='24' width='10' height='6' offsetX='3' offsetY='4' /> + <image frame='55' x='18' y='30' width='10' height='6' offsetX='3' offsetY='5' /> + <image frame='56' x='28' y='24' width='16' height='7' offsetX='0' offsetY='1' /> + <image frame='57' x='28' y='31' width='14' height='10' offsetX='1' offsetY='1' /> + <image frame='58' x='38' y='0' width='6' height='1' offsetX='5' offsetY='15' /> + <image frame='3' equals='1' offsetX='10' offsetY='15' /> + <image frame='13' equals='12' offsetX='5' offsetY='11' /> + <image frame='14' equals='11' offsetX='5' offsetY='11' /> + <image frame='15' equals='12' offsetX='5' offsetY='11' /> + <image frame='16' equals='10' offsetX='5' offsetY='11' /> + <image frame='17' equals='11' offsetX='5' offsetY='11' /> + <image frame='43' equals='42' offsetX='3' offsetY='12' /> + <image frame='44' equals='42' offsetX='3' offsetY='12' /> + <image frame='46' equals='45' offsetX='10' offsetY='12' /> + <image frame='48' equals='47' offsetX='8' offsetY='12' /> + <image frame='49' equals='45' offsetX='10' offsetY='12' /> +</tilesheet> diff --git a/games/aground/data/core/science1/parallax/bg320.png b/games/aground/data/core/science1/parallax/bg320.png new file mode 100644 index 00000000..c43686b9 Binary files /dev/null and b/games/aground/data/core/science1/parallax/bg320.png differ diff --git a/games/aground/data/core/science1/parallax/bg320.xml b/games/aground/data/core/science1/parallax/bg320.xml new file mode 100644 index 00000000..334a577d --- /dev/null +++ b/games/aground/data/core/science1/parallax/bg320.xml @@ -0,0 +1,6 @@ +<tilesheet id='bg320.png' width='320' height='144'> + <image frame='0' x='0' y='0' width='317' height='130' offsetX='1' offsetY='14' /> + <image frame='1' x='0' y='130' width='300' height='102' offsetX='20' offsetY='42' /> + <image frame='2' x='0' y='232' width='320' height='102' offsetX='0' offsetY='42' /> + <image frame='3' x='0' y='334' width='314' height='102' offsetX='0' offsetY='42' /> +</tilesheet> diff --git a/games/aground/data/core/science1/parallax/bg640.png b/games/aground/data/core/science1/parallax/bg640.png new file mode 100644 index 00000000..2e94ab32 Binary files /dev/null and b/games/aground/data/core/science1/parallax/bg640.png differ diff --git a/games/aground/data/core/science1/parallax/bg640.xml b/games/aground/data/core/science1/parallax/bg640.xml new file mode 100644 index 00000000..1d064a7f --- /dev/null +++ b/games/aground/data/core/science1/parallax/bg640.xml @@ -0,0 +1,4 @@ +<tilesheet id='bg640.png' width='640' height='144'> + <image frame='0' x='0' y='0' width='640' height='142' offsetX='0' offsetY='2' /> + <image frame='1' x='0' y='142' width='638' height='141' offsetX='2' offsetY='3' /> +</tilesheet> diff --git a/games/aground/data/core/science1/parallax/desert.png b/games/aground/data/core/science1/parallax/desert.png new file mode 100644 index 00000000..6ab9cd81 Binary files /dev/null and b/games/aground/data/core/science1/parallax/desert.png differ diff --git a/games/aground/data/core/science1/parallax/parallax.xml b/games/aground/data/core/science1/parallax/parallax.xml new file mode 100644 index 00000000..4d1cbedc --- /dev/null +++ b/games/aground/data/core/science1/parallax/parallax.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="utf-8" ?> +<data> + <include id="bg320.xml" includeRoot="true" /> + <include id="bg640.xml" includeRoot="true" /> + <tilesheet id="town.png" width="256" height="80" /> + <tilesheet id="desert.png" width="320" height="106" /> + <procedure id="science1.doodad"> + <layer p="0.75" py="1"> + <tile sheet="town.png" x="0" y="0" offsetX="1740" loop="false" /> + <tile sheet="town.png" x="0" y="1" offsetX="2032" loop="false" /> + <tile sheet="desert.png" x="0" y="0" offsetX="64" loop="false" offsetY="-26" /> + <tile sheet="desert.png" x="0" y="2" offsetX="448" loop="false" offsetY="-26" /> + <tile sheet="desert.png" x="0" y="1" offsetX="800" loop="false" offsetY="-26" /> + </layer> + </procedure> + <parallax id="science1" mapBG="1b6a9d" mapBGHeight="80" waterLevel="0"> + <layer p="0" day="true"> + <tile sheet="{core}/start/parallax/bg.png" x="0" y="0" /> + <rect color="438a9e" x="0" y="80" width="256" height="64" /> + </layer> + <run procedure="start.bg" /> + <layer p="0.046875" py="0.1875" scroll="0.0625"><tile sheet="{core}/start/parallax/tiles256.png" x="0" /></layer> + <layer p="0.0625" py="0.25"><tile sheet="bg320.png" x="0" y="0" loop="false" dy="-6" /></layer> + <layer p="0.09375" py="0.375" scroll="0.125"><tile sheet="{core}/start/parallax/tiles256.png" x="1" dy="8" /></layer> + <layer p="0.125" py="0.5"><tile sheet="bg640.png" x="0" y="0" loop="false" dy="40" /></layer> + <layer p="0.25" py="0.75"><tile sheet="bg640.png" x="1" y="0" offsetX="320" dy="40" loop="false" /></layer> + <layer p="0.5" minLoop="2" maxLoop="4" py="1"> + <tile sheet="bg320.png" x="1" dy="54" cap="left" /> + <tile sheet="bg320.png" x="3" dy="54" cap="right" /> + <tile sheet="bg320.png" x="2" dy="54" /> + </layer> + <run procedure="science1.doodad" /> + <layer type="back" /><run procedure="start.water" /> + </parallax> + + <parallax id="underwater" mapBG="1b6a9d" mapBGHeight="80" waterLevel="0"> + <layer type="back" /><run procedure="start.water" /> + </parallax> +</data> \ No newline at end of file diff --git a/games/aground/data/core/science1/parallax/town.png b/games/aground/data/core/science1/parallax/town.png new file mode 100644 index 00000000..5053831d Binary files /dev/null and b/games/aground/data/core/science1/parallax/town.png differ diff --git a/games/aground/data/core/science1/sand.png b/games/aground/data/core/science1/sand.png new file mode 100644 index 00000000..17803a0c Binary files /dev/null and b/games/aground/data/core/science1/sand.png differ diff --git a/games/aground/data/core/science1/scenes/fisherman/bg.png b/games/aground/data/core/science1/scenes/fisherman/bg.png new file mode 100644 index 00000000..bd5bd7e8 Binary files /dev/null and b/games/aground/data/core/science1/scenes/fisherman/bg.png differ diff --git a/games/aground/data/core/science1/scenes/fisherman/scene.xml b/games/aground/data/core/science1/scenes/fisherman/scene.xml new file mode 100644 index 00000000..4ee4fdcf --- /dev/null +++ b/games/aground/data/core/science1/scenes/fisherman/scene.xml @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="utf-8" ?> +<scenes> + <include id="sheet.xml" includeRoot="true" /> + <tile id="scene.fisherman.fisherman" sheet="sheet.png" x="0" y="0" /> + <animation id="scene.fisherman.fisherman.idle"> + <frame x="24" count="12" /> + <frame x="12" count="12" /> + <frame x="0" count="12" /> + <frame x="24" count="12" /> + </animation> + <animation id="scene.fisherman.fisherman.talk" x="36" count="12" /> + <scene id="fisherman"> + <tile id="steam" sheet="sheet.png" x="48" y="0" /> + <tile id="pelican" sheet="sheet.png" x="60" y="0" /> + <animation id="steam.idle" count="12" /> + <animation id="pelican.idle" count="12" x="12" /> + <animation id="pelican.deliver"> + <frame x="24" count="12" /> + <frame x="36" count="12" /> + <frame x="0" count="12" /> + </animation> + <animation id="pelican.leave" count="10" x="48" /> + <layer id="bg" image="bg.png" /> + <layer id="fisherman" tile="fisherman" animation="fisherman.idle" talk="fisherman.talk" x="0" y="0" /> + <layer id="steam" tile="steam" animation="steam.idle" x="0" y="0" /> + <layer id="pelican" tile="pelican" animation="pelican.idle" x="0" y="0" /> + + <show id="intro"> + <layer id="bg" /> + <layer id="fisherman" /> + <layer id="steam" /> + <layer id="pelican" /> + <hide id="pelican" /> + <wait seconds="1" /> + <dialogue section="fisherman" id="intro1" speaker='fisherman' /> + <show id="pelican" /><play object="pelican" animation="pelican.deliver" /> + <item id="coral_cod" modal="true" /> + <dialogue section="fisherman" id="intro2" speaker='fisherman' /> + <dialogue section="fisherman" id="intro3" speaker='player' /> + <dialogue section="fisherman" id="intro4" speaker='fisherman' /> + <dialogue section="fisherman" id="intro5" speaker='fisherman' /> + <dialogue section="fisherman" id="intro6" speaker='fisherman' /> + <play object="pelican" animation="pelican.leave" /><hide id="pelican" /> + <wait seconds="1" /> + </show> + <show id="intro_water"> + <layer id="bg" /> + <layer id="fisherman" /> + <layer id="steam" /> + <layer id="pelican" /> + <hide id="pelican" /> + <wait seconds="1" /> + <dialogue section="fisherman" id="intro1_alt" speaker='fisherman' /> + <show id="pelican" /><play object="pelican" animation="pelican.deliver" /> + <item id="coral_cod" modal="true" /> + <dialogue section="fisherman" id="intro2" speaker='fisherman' /> + <dialogue section="fisherman" id="intro3_alt" speaker='player' /> + <dialogue section="fisherman" id="intro4_alt" speaker='fisherman' /> + <dialogue section="fisherman" id="intro5" speaker='fisherman' /> + <dialogue section="fisherman" id="intro6" speaker='fisherman' /> + <play object="pelican" animation="pelican.leave" /><hide id="pelican" /> + <wait seconds="1" /> + </show> + <show id="scene"> + <layer id="bg" /> + <layer id="fisherman" /> + <layer id="steam" /> + <layer id="pelican" /> + <wait seconds="1" /> + <dialogue section="fisherman" id="scene1" speaker='fisherman' /> + <dialogue section="fisherman" id="scene2" speaker='fisherman' /> + <dialogue section="fisherman" id="scene3" speaker='player' /> + <dialogue section="fisherman" id="scene4" speaker='fisherman' /> + <dialogue section="fisherman" id="scene5" speaker='player' /> + <dialogue section="fisherman" id="scene6" speaker='fisherman' /> + <wait seconds="1" /> + </show> + </scene> +</scenes> \ No newline at end of file diff --git a/games/aground/data/core/science1/scenes/fisherman/sheet.png b/games/aground/data/core/science1/scenes/fisherman/sheet.png new file mode 100644 index 00000000..24118edd Binary files /dev/null and b/games/aground/data/core/science1/scenes/fisherman/sheet.png differ diff --git a/games/aground/data/core/science1/scenes/fisherman/sheet.xml b/games/aground/data/core/science1/scenes/fisherman/sheet.xml new file mode 100644 index 00000000..98efb347 --- /dev/null +++ b/games/aground/data/core/science1/scenes/fisherman/sheet.xml @@ -0,0 +1,120 @@ +<tilesheet id='sheet.png' width='256' height='144'> + <image frame='0' x='0' y='0' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='2' x='99' y='0' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='3' x='198' y='0' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='7' x='297' y='0' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='8' x='396' y='0' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='9' x='495' y='0' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='10' x='594' y='0' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='12' x='0' y='85' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='13' x='0' y='170' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='14' x='0' y='255' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='15' x='0' y='340' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='16' x='0' y='425' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='17' x='0' y='510' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='18' x='0' y='595' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='19' x='99' y='85' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='20' x='198' y='85' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='21' x='297' y='85' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='22' x='396' y='85' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='23' x='495' y='85' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='24' x='594' y='85' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='26' x='99' y='170' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='34' x='99' y='255' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='36' x='99' y='340' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='37' x='99' y='425' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='38' x='99' y='510' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='39' x='99' y='595' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='40' x='198' y='170' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='42' x='297' y='170' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='46' x='396' y='170' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='47' x='495' y='170' width='99' height='85' offsetX='106' offsetY='59' /> + <image frame='48' x='594' y='170' width='20' height='45' offsetX='97' offsetY='99' /> + <image frame='49' x='594' y='215' width='18' height='32' offsetX='98' offsetY='112' /> + <image frame='50' x='614' y='170' width='18' height='38' offsetX='99' offsetY='106' /> + <image frame='51' x='614' y='208' width='15' height='34' offsetX='99' offsetY='110' /> + <image frame='52' x='632' y='170' width='17' height='40' offsetX='98' offsetY='104' /> + <image frame='53' x='649' y='170' width='14' height='34' offsetX='101' offsetY='110' /> + <image frame='54' x='663' y='170' width='14' height='36' offsetX='101' offsetY='108' /> + <image frame='55' x='632' y='210' width='16' height='43' offsetX='101' offsetY='101' /> + <image frame='56' x='198' y='255' width='17' height='47' offsetX='100' offsetY='97' /> + <image frame='57' x='198' y='302' width='15' height='46' offsetX='101' offsetY='98' /> + <image frame='58' x='677' y='170' width='15' height='31' offsetX='101' offsetY='113' /> + <image frame='59' x='648' y='210' width='16' height='40' offsetX='101' offsetY='104' /> + <image frame='60' x='215' y='255' width='92' height='59' offsetX='0' offsetY='53' /> + <image frame='61' x='307' y='255' width='103' height='77' offsetX='0' offsetY='48' /> + <image frame='62' x='307' y='332' width='132' height='93' offsetX='0' offsetY='40' /> + <image frame='63' x='439' y='332' width='162' height='91' offsetX='0' offsetY='53' /> + <image frame='64' x='215' y='314' width='71' height='65' offsetX='0' offsetY='53' /> + <image frame='65' x='215' y='379' width='68' height='59' offsetX='0' offsetY='53' /> + <image frame='66' x='215' y='438' width='75' height='59' offsetX='0' offsetY='53' /> + <image frame='67' x='215' y='497' width='61' height='58' offsetX='1' offsetY='54' /> + <image frame='68' x='215' y='555' width='57' height='58' offsetX='1' offsetY='54' /> + <image frame='70' x='215' y='613' width='57' height='58' offsetX='1' offsetY='54' /> + <image frame='72' x='410' y='255' width='57' height='58' offsetX='1' offsetY='54' /> + <image frame='77' x='467' y='255' width='57' height='58' offsetX='1' offsetY='54' /> + <image frame='84' x='272' y='555' width='34' height='56' offsetX='0' offsetY='15' /> + <image frame='85' x='524' y='255' width='45' height='63' offsetX='0' offsetY='19' /> + <image frame='87' x='569' y='255' width='49' height='59' offsetX='0' offsetY='38' /> + <image frame='88' x='618' y='255' width='59' height='59' offsetX='0' offsetY='49' /> + <image frame='89' x='601' y='332' width='74' height='58' offsetX='0' offsetY='54' /> + <image frame='91' x='307' y='425' width='74' height='58' offsetX='0' offsetY='54' /> + <image frame='92' x='307' y='483' width='58' height='58' offsetX='0' offsetY='54' /> + <image frame='93' x='307' y='541' width='58' height='58' offsetX='0' offsetY='54' /> + <image frame='94' x='307' y='599' width='58' height='58' offsetX='0' offsetY='54' /> + <image frame='95' x='381' y='425' width='57' height='58' offsetX='1' offsetY='54' /> + <image frame='96' x='381' y='483' width='57' height='58' offsetX='1' offsetY='54' /> + <image frame='97' x='381' y='541' width='57' height='58' offsetX='1' offsetY='54' /> + <image frame='98' x='381' y='599' width='57' height='58' offsetX='1' offsetY='54' /> + <image frame='99' x='438' y='425' width='57' height='58' offsetX='1' offsetY='54' /> + <image frame='100' x='495' y='425' width='57' height='58' offsetX='1' offsetY='54' /> + <image frame='101' x='552' y='425' width='57' height='58' offsetX='1' offsetY='54' /> + <image frame='102' x='609' y='425' width='57' height='58' offsetX='1' offsetY='54' /> + <image frame='103' x='438' y='483' width='57' height='58' offsetX='1' offsetY='54' /> + <image frame='104' x='438' y='541' width='57' height='58' offsetX='1' offsetY='54' /> + <image frame='105' x='438' y='599' width='57' height='58' offsetX='1' offsetY='54' /> + <image frame='106' x='495' y='483' width='57' height='58' offsetX='1' offsetY='54' /> + <image frame='107' x='552' y='483' width='57' height='58' offsetX='1' offsetY='54' /> + <image frame='108' x='609' y='483' width='68' height='51' offsetX='0' offsetY='61' /> + <image frame='109' x='495' y='541' width='68' height='71' offsetX='0' offsetY='41' /> + <image frame='110' x='495' y='612' width='60' height='49' offsetX='0' offsetY='51' /> + <image frame='111' x='563' y='541' width='56' height='66' offsetX='0' offsetY='41' /> + <image frame='112' x='619' y='541' width='54' height='49' offsetX='0' offsetY='34' /> + <image frame='113' x='563' y='607' width='39' height='71' offsetX='0' offsetY='17' /> + <image frame='114' x='602' y='607' width='42' height='49' offsetX='0' offsetY='14' /> + <image frame='115' x='272' y='613' width='35' height='64' offsetX='0' offsetY='6' /> + <image frame='116' x='664' y='210' width='16' height='43' offsetX='0' offsetY='2' /> + <image frame='117' x='680' y='210' width='13' height='15' offsetX='0' offsetY='2' /> + <image frame='1' equals='0' offsetX='106' offsetY='59' /> + <image frame='4' equals='3' offsetX='106' offsetY='59' /> + <image frame='5' equals='3' offsetX='106' offsetY='59' /> + <image frame='6' equals='0' offsetX='106' offsetY='59' /> + <image frame='11' equals='10' offsetX='106' offsetY='59' /> + <image frame='25' equals='24' offsetX='106' offsetY='59' /> + <image frame='27' equals='26' offsetX='106' offsetY='59' /> + <image frame='28' equals='26' offsetX='106' offsetY='59' /> + <image frame='29' equals='26' offsetX='106' offsetY='59' /> + <image frame='30' equals='26' offsetX='106' offsetY='59' /> + <image frame='31' equals='26' offsetX='106' offsetY='59' /> + <image frame='32' equals='26' offsetX='106' offsetY='59' /> + <image frame='33' equals='26' offsetX='106' offsetY='59' /> + <image frame='35' equals='26' offsetX='106' offsetY='59' /> + <image frame='41' equals='26' offsetX='106' offsetY='59' /> + <image frame='43' equals='26' offsetX='106' offsetY='59' /> + <image frame='44' equals='26' offsetX='106' offsetY='59' /> + <image frame='45' equals='39' offsetX='106' offsetY='59' /> + <image frame='69' equals='68' offsetX='1' offsetY='54' /> + <image frame='71' equals='68' offsetX='1' offsetY='54' /> + <image frame='73' equals='68' offsetX='1' offsetY='54' /> + <image frame='74' equals='68' offsetX='1' offsetY='54' /> + <image frame='75' equals='68' offsetX='1' offsetY='54' /> + <image frame='76' equals='68' offsetX='1' offsetY='54' /> + <image frame='78' equals='77' offsetX='1' offsetY='54' /> + <image frame='79' equals='77' offsetX='1' offsetY='54' /> + <image frame='80' equals='68' offsetX='1' offsetY='54' /> + <image frame='81' equals='68' offsetX='1' offsetY='54' /> + <image frame='82' equals='68' offsetX='1' offsetY='54' /> + <image frame='83' equals='72' offsetX='1' offsetY='54' /> + <image frame='86' equals='85' offsetX='0' offsetY='19' /> + <image frame='90' equals='89' offsetX='0' offsetY='54' /> +</tilesheet> diff --git a/games/aground/data/core/science1/scenes/inn/bg.png b/games/aground/data/core/science1/scenes/inn/bg.png new file mode 100644 index 00000000..5f1ce5d7 Binary files /dev/null and b/games/aground/data/core/science1/scenes/inn/bg.png differ diff --git a/games/aground/data/core/science1/scenes/inn/innkeeper.png b/games/aground/data/core/science1/scenes/inn/innkeeper.png new file mode 100644 index 00000000..91a63592 Binary files /dev/null and b/games/aground/data/core/science1/scenes/inn/innkeeper.png differ diff --git a/games/aground/data/core/science1/scenes/inn/innkeeper.xml b/games/aground/data/core/science1/scenes/inn/innkeeper.xml new file mode 100644 index 00000000..fc730200 --- /dev/null +++ b/games/aground/data/core/science1/scenes/inn/innkeeper.xml @@ -0,0 +1,25 @@ +<tilesheet id='innkeeper.png' width='256' height='144'> + <image frame='0' x='0' y='0' width='256' height='112' offsetX='0' offsetY='32' /> + <image frame='1' x='256' y='0' width='256' height='112' offsetX='0' offsetY='32' /> + <image frame='2' x='512' y='0' width='256' height='112' offsetX='0' offsetY='32' /> + <image frame='3' x='0' y='112' width='256' height='112' offsetX='0' offsetY='32' /> + <image frame='4' x='256' y='112' width='256' height='112' offsetX='0' offsetY='32' /> + <image frame='5' x='512' y='112' width='256' height='112' offsetX='0' offsetY='32' /> + <image frame='6' x='0' y='224' width='256' height='112' offsetX='0' offsetY='32' /> + <image frame='7' x='0' y='336' width='256' height='112' offsetX='0' offsetY='32' /> + <image frame='8' x='0' y='448' width='256' height='112' offsetX='0' offsetY='32' /> + <image frame='9' x='0' y='560' width='256' height='112' offsetX='0' offsetY='32' /> + <image frame='10' x='0' y='672' width='256' height='112' offsetX='0' offsetY='32' /> + <image frame='11' x='256' y='224' width='256' height='118' offsetX='0' offsetY='26' /> + <image frame='12' x='512' y='224' width='256' height='118' offsetX='0' offsetY='26' /> + <image frame='13' x='0' y='784' width='256' height='112' offsetX='0' offsetY='32' /> + <image frame='14' x='256' y='342' width='256' height='112' offsetX='0' offsetY='32' /> + <image frame='15' x='256' y='454' width='256' height='118' offsetX='0' offsetY='26' /> + <image frame='16' x='256' y='572' width='256' height='118' offsetX='0' offsetY='26' /> + <image frame='17' x='512' y='342' width='256' height='112' offsetX='0' offsetY='32' /> + <image frame='18' x='256' y='690' width='256' height='112' offsetX='0' offsetY='32' /> + <image frame='19' x='512' y='454' width='256' height='118' offsetX='0' offsetY='26' /> + <image frame='20' x='512' y='572' width='256' height='118' offsetX='0' offsetY='26' /> + <image frame='21' x='512' y='690' width='256' height='118' offsetX='0' offsetY='26' /> + <image frame='22' equals='12' offsetX='0' offsetY='26' /> +</tilesheet> diff --git a/games/aground/data/core/science1/scenes/inn/scene.xml b/games/aground/data/core/science1/scenes/inn/scene.xml new file mode 100644 index 00000000..48db39de --- /dev/null +++ b/games/aground/data/core/science1/scenes/inn/scene.xml @@ -0,0 +1,102 @@ +<?xml version="1.0" encoding="utf-8" ?> +<scenes> + <quest id="mirrows" giver="innkeeper" exp="500" achievement="mirrows"> + <flag id="mirrow.defeat" name="common.complete" /> + </quest> + <tile id="innkeeper" sheet="{core}/science1/npc/npcs.png" x="39" y="0" /> + <npc id="innkeeper" tile="innkeeper" animation="single" talk_sfx="talking7" action="talk" /> + <scene id="inn"> + <include id="innkeeper.xml" includeRoot="true" /> + <tile id="innkeeper" sheet="innkeeper.png" x="0" y="0" /> + <animation id="innkeeper.idle" x="0"> + <frame x="0" y="0" count="10" repeat="3" /> + <frame x="10" y="0" /> + </animation> + <animation id="innkeeper.talk" x="11" count="12" /> + <layer id="bg" image="bg.png" /> + <layer id="innkeeper" tile="innkeeper" animation="innkeeper.idle" talk="innkeeper.talk" x="0" y="0" /> + <layer id="innkeeper2" tile="innkeeper" animation="innkeeper.idle" talk="innkeeper.talk" x="30" y="10" /> + <layer id="fisherman" tile="scene.fisherman.fisherman" animation="scene.fisherman.fisherman.idle" talk="scene.fisherman.fisherman.talk" x="-60" y="0" flip="true" /> + <show id="first"> + <layer id="bg" /> + <layer id="innkeeper" /> + <wait seconds="1" /> + <choose> + <section if="area.getStructureById('inn').isPowered()"> + <dialogue section="innkeeper" id="power1" speaker='innkeeper' /> + <dialogue section="innkeeper" id="power2" speaker='innkeeper' /> + <dialogue section="innkeeper" id="power3" speaker='innkeeper' /> + <dialogue section="innkeeper" id="power4" speaker='player' /> + <dialogue section="innkeeper" id="power5" speaker='innkeeper' /> + <quest id="mirrows"><structure id="crashed_ship.door" x="44.8125" y="4.625" forceSpawn="true" /></quest> + </section> + <section> + <dialogue section="innkeeper" id="intro1" speaker='innkeeper' /> + <dialogue section="innkeeper" id="intro2" speaker='player' /> + <dialogue section="innkeeper" id="intro3" speaker='innkeeper' /> + <dialogue section="innkeeper" id="intro4" speaker='innkeeper' /> + </section> + </choose> + <action>setFlag('inn.first', true);</action> + <wait seconds="1" /> + </show> + <show id="inn"> + <layer id="bg" /> + <layer id="innkeeper" /> + <wait seconds="1" /> + <choose> + <choose if="area.getStructureById('inn').isPowered()"> + <section if="player.questComplete('pirates')"> + <dialogue section="pirates" id="stay_free" speaker="innkeeper" /> + <action>player.fullRestore(); setFlag('inn_free', true);</action> + </section> + <menu section="common" showCoins="true"> + <dialogue section="innkeeper" id="visit" /> + <choice id="yes"> + <choose> + <dialogue section="innkeeper" id="no_money" speaker='innkeeper' if="player.getCoins() < 50" /> + <section> + <section if="getFlag('fisherman_intro') && !getFlag('innkeeper_scene')" with="fade"> + <action>setFlag('innkeeper_scene', true);</action> + <dialogue section="innkeeper" id="scene1" speaker='player' /> + <dialogue section="innkeeper" id="scene2" speaker='innkeeper' /> + <dialogue section="innkeeper" id="scene3" speaker='innkeeper' /> + <dialogue section="innkeeper" id="scene4" speaker='innkeeper' /> + <dialogue section="innkeeper" id="scene5" speaker='innkeeper' /> + </section> + <action>player.addCoins(-50); player.fullRestore();</action> + </section> + </choose> + </choice> + <choice id="no" /> + </menu> + </choose> + <dialogue section="innkeeper" id="no_power" speaker='innkeeper' /> + </choose> + <wait seconds="1" /> + </show> + <show id="mirrows"> + <layer id="bg" /> + <layer id="innkeeper" /> + <wait seconds="1" /> + <dialogue section="innkeeper" id="mirrows1" speaker='player' /> + <dialogue section="innkeeper" id="mirrows2" speaker='innkeeper' /> + <dialogue section="innkeeper" id="mirrows3" speaker='innkeeper' /> + <item id="coal" count="10" modal="true" /><complete quest="mirrows" /> + <dialogue section="innkeeper" id="mirrows4" speaker='player' /> + <dialogue section="innkeeper" id="mirrows5" speaker='innkeeper' /> + <wait seconds="1" /> + </show> + <show id="pirates"> + <layer id="bg" /> + <layer id="fisherman" /> + <layer id="innkeeper2" /> + <wait seconds="1" /> + <dialogue section="pirates" id="complete2" speaker='fisherman' /> + <dialogue section="pirates" id="complete3" speaker='innkeeper2' /> + <dialogue section="pirates" id="complete4" speaker='fisherman' /> + <dialogue section="pirates" id="complete5" speaker='innkeeper2' /> + <wait seconds="1" /> + </show> + </scene> +</scenes> \ No newline at end of file diff --git a/games/aground/data/core/science1/scenes/mechanic/bg.png b/games/aground/data/core/science1/scenes/mechanic/bg.png new file mode 100644 index 00000000..87e116d5 Binary files /dev/null and b/games/aground/data/core/science1/scenes/mechanic/bg.png differ diff --git a/games/aground/data/core/science1/scenes/mechanic/mechanic.png b/games/aground/data/core/science1/scenes/mechanic/mechanic.png new file mode 100644 index 00000000..61cc8db1 Binary files /dev/null and b/games/aground/data/core/science1/scenes/mechanic/mechanic.png differ diff --git a/games/aground/data/core/science1/scenes/mechanic/mechanic.xml b/games/aground/data/core/science1/scenes/mechanic/mechanic.xml new file mode 100644 index 00000000..87f0f80e --- /dev/null +++ b/games/aground/data/core/science1/scenes/mechanic/mechanic.xml @@ -0,0 +1,67 @@ +<tilesheet id='mechanic.png' width='256' height='144'> + <image frame='0' x='0' y='0' width='71' height='76' offsetX='168' offsetY='68' /> + <image frame='11' x='71' y='0' width='71' height='76' offsetX='168' offsetY='68' /> + <image frame='12' x='142' y='0' width='38' height='50' offsetX='170' offsetY='94' /> + <image frame='13' x='180' y='0' width='33' height='49' offsetX='172' offsetY='95' /> + <image frame='14' x='0' y='76' width='37' height='49' offsetX='170' offsetY='95' /> + <image frame='15' x='142' y='50' width='37' height='9' offsetX='139' offsetY='135' /> + <image frame='16' x='37' y='76' width='38' height='20' offsetX='139' offsetY='124' /> + <image frame='17' x='142' y='59' width='23' height='9' offsetX='136' offsetY='135' /> + <image frame='18' x='75' y='76' width='40' height='14' offsetX='136' offsetY='130' /> + <image frame='19' x='75' y='90' width='40' height='22' offsetX='137' offsetY='122' /> + <image frame='20' x='37' y='96' width='38' height='10' offsetX='139' offsetY='134' /> + <image frame='21' x='180' y='49' width='27' height='8' offsetX='154' offsetY='130' /> + <image frame='22' x='142' y='68' width='21' height='6' offsetX='140' offsetY='138' /> + <image frame='23' x='165' y='59' width='13' height='3' offsetX='142' offsetY='141' /> + <image frame='24' x='165' y='62' width='15' height='12' offsetX='171' offsetY='132' /> + <image frame='25' x='180' y='57' width='13' height='4' offsetX='174' offsetY='140' /> + <image frame='26' x='193' y='57' width='15' height='9' offsetX='196' offsetY='135' /> + <image frame='27' x='115' y='76' width='22' height='22' offsetX='179' offsetY='122' /> + <image frame='28' x='115' y='98' width='22' height='23' offsetX='174' offsetY='121' /> + <image frame='29' x='0' y='125' width='77' height='76' offsetX='163' offsetY='68' /> + <image frame='30' x='77' y='125' width='78' height='76' offsetX='162' offsetY='68' /> + <image frame='35' x='0' y='201' width='78' height='76' offsetX='162' offsetY='68' /> + <image frame='37' x='78' y='201' width='76' height='76' offsetX='164' offsetY='68' /> + <image frame='41' x='0' y='277' width='71' height='76' offsetX='168' offsetY='68' /> + <image frame='42' x='0' y='353' width='71' height='76' offsetX='168' offsetY='68' /> + <image frame='53' x='71' y='277' width='71' height='76' offsetX='168' offsetY='68' /> + <image frame='54' x='142' y='277' width='71' height='76' offsetX='168' offsetY='68' /> + <image frame='56' x='71' y='353' width='71' height='76' offsetX='168' offsetY='68' /> + <image frame='57' x='142' y='353' width='71' height='76' offsetX='168' offsetY='68' /> + <image frame='1' equals='0' offsetX='168' offsetY='68' /> + <image frame='2' equals='0' offsetX='168' offsetY='68' /> + <image frame='3' equals='0' offsetX='168' offsetY='68' /> + <image frame='4' equals='0' offsetX='168' offsetY='68' /> + <image frame='5' equals='0' offsetX='168' offsetY='68' /> + <image frame='6' equals='0' offsetX='168' offsetY='68' /> + <image frame='7' equals='0' offsetX='168' offsetY='68' /> + <image frame='8' equals='0' offsetX='168' offsetY='68' /> + <image frame='9' equals='0' offsetX='168' offsetY='68' /> + <image frame='10' equals='0' offsetX='168' offsetY='68' /> + <image frame='31' equals='30' offsetX='162' offsetY='68' /> + <image frame='32' equals='30' offsetX='162' offsetY='68' /> + <image frame='33' equals='30' offsetX='162' offsetY='68' /> + <image frame='34' equals='30' offsetX='162' offsetY='68' /> + <image frame='36' equals='35' offsetX='162' offsetY='68' /> + <image frame='38' equals='37' offsetX='164' offsetY='68' /> + <image frame='39' equals='37' offsetX='164' offsetY='68' /> + <image frame='40' equals='37' offsetX='164' offsetY='68' /> + <image frame='43' equals='42' offsetX='168' offsetY='68' /> + <image frame='44' equals='42' offsetX='168' offsetY='68' /> + <image frame='45' equals='42' offsetX='168' offsetY='68' /> + <image frame='46' equals='42' offsetX='168' offsetY='68' /> + <image frame='47' equals='42' offsetX='168' offsetY='68' /> + <image frame='48' equals='42' offsetX='168' offsetY='68' /> + <image frame='49' equals='42' offsetX='168' offsetY='68' /> + <image frame='50' equals='42' offsetX='168' offsetY='68' /> + <image frame='51' equals='42' offsetX='168' offsetY='68' /> + <image frame='52' equals='42' offsetX='168' offsetY='68' /> + <image frame='55' equals='54' offsetX='168' offsetY='68' /> + <image frame='58' equals='0' offsetX='168' offsetY='68' /> + <image frame='59' equals='54' offsetX='168' offsetY='68' /> + <image frame='60' equals='42' offsetX='168' offsetY='68' /> + <image frame='61' equals='42' offsetX='168' offsetY='68' /> + <image frame='62' equals='53' offsetX='168' offsetY='68' /> + <image frame='63' equals='42' offsetX='168' offsetY='68' /> + <image frame='64' equals='42' offsetX='168' offsetY='68' /> +</tilesheet> diff --git a/games/aground/data/core/science1/scenes/mechanic/scene.xml b/games/aground/data/core/science1/scenes/mechanic/scene.xml new file mode 100644 index 00000000..0e086ba4 --- /dev/null +++ b/games/aground/data/core/science1/scenes/mechanic/scene.xml @@ -0,0 +1,116 @@ +<?xml version="1.0" encoding="utf-8" ?> +<data> + <quest id="mirrows2" giver="mechanic" exp="100"> + <item id="dragon_armor" count="1" hidden="true" defineLater="true" allowEquipped="true" /> + </quest> + <include id="mechanic.xml" includeRoot="true" /> + <tile id="scene.mechanic.mechanic" sheet="mechanic.png" x="0" y="0" /> + <animation id="scene.mechanic.mechanic.repair.top"> + <frame x="24" count="2" /><frame visible="false" length="7" /><frame x="26" count="3" /> + <frame visible="false" length="2" /><frame x="15" count="9" /><frame visible="false" length="1" /> + </animation> + <animation id="scene.mechanic.mechanic.highlights"> + <frame visible="false" length="14" /><frame x="12" /> + <frame visible="false" length="2" /><frame x="13" /> + <frame visible="false" /><frame x="14" /><frame visible="false" length="4" /> + </animation> + <animation id="scene.mechanic.mechanic.repair.top2"> + <frame visible="false" length="48" /> + <frame x="24" count="2" /><frame visible="false" length="7" /><frame x="26" count="3" /> + <frame visible="false" length="2" /><frame x="15" count="9" /><frame visible="false" length="1" /> + </animation> + <animation id="scene.mechanic.mechanic.highlights2"> + <frame visible="false" length="62" /><frame x="12" /> + <frame visible="false" length="2" /><frame x="13" /> + <frame visible="false" /><frame x="14" /><frame visible="false" length="4" /> + </animation> + <animation id="scene.mechanic.mechanic.repair"> + <append tile="scene.mechanic.mechanic" animation="scene.mechanic.mechanic.repair.top" /> + <append tile="scene.mechanic.mechanic" animation="scene.mechanic.mechanic.highlights" /> + <frame x="29" count="12" /> + <frame x="29" count="12" /> + </animation> + <animation id="scene.mechanic.mechanic.idle"> + <append tile="scene.mechanic.mechanic" animation="scene.mechanic.mechanic.repair.top2" /> + <append tile="scene.mechanic.mechanic" animation="scene.mechanic.mechanic.highlights2" /> + <frame x="0" count="12" /><frame x="0" count="12" /><frame x="41" count="12" /> + <frame x="0" count="12" /><frame x="29" count="12" /><frame x="29" count="12" /> + </animation> + <animation id="scene.mechanic.mechanic.talk" x="53" count="12" /> + <animation id="scene.mechanic.mechanic.smile" x="41" count="12" /> + <scene id="mechanic"> + <layer id="bg" image="bg.png" /> + <layer id="mechanic" tile="mechanic" animation="mechanic.idle" talk="mechanic.talk" x="0" y="0" /> + <layer id="bg_mirrows" image="{core}/science1/scenes/mirrows/bg.png" /> + <layer id="mr" tile="scene.mirrows.mr" animation="scene.mirrows.mr.idle" talk="scene.mirrows.mr.talk" sfx="talking4" x="-40" y="0" /> + <layer id="mrs" tile="scene.mirrows.mrs" animation="scene.mirrows.mrs.idle" talk="scene.mirrows.mrs.talk" sfx="talking6" x="40" y="0" flip="true" /> + <show id="intro"> + <layer id="bg" /> + <layer id="mechanic" /> + <play object="mechanic" animation="mechanic.repair" /> + <wait seconds="1" /><action>setFlag('mechanic.intro', true);</action> + <dialogue section="mechanic" id="intro1" speaker='player' /> + <dialogue section="mechanic" id="intro2" speaker='mechanic' /> + <dialogue section="mechanic" id="intro3" speaker='player' /> + <dialogue section="mechanic" id="intro4" speaker='mechanic' /> + <dialogue section="mechanic" id="intro5" speaker='player' /> + <dialogue section="mechanic" id="intro6" speaker='mechanic' /> + <wait seconds="1" /> + </show> + <show id="mirrows"> + <layer id="bg" /> + <layer id="mechanic" /> + <play object="mechanic" animation="mechanic.repair" /> + <wait seconds="1" /><action>setFlag('mechanic.mirrows', true);</action> + <dialogue section="mechanic" id="mirrows1" speaker='mechanic' /> + <dialogue section="mechanic" id="mirrows2" speaker='player' /> + <dialogue section="mechanic" id="mirrows3" speaker='mechanic' /> + <dialogue section="mechanic" id="mirrows4" speaker='player' /> + <dialogue section="mechanic" id="mirrows5" speaker='mechanic' /> + </show> + <show id="mirrows2"> + <layer id="bg" /> + <layer id="mechanic" /> + <play object="mechanic" animation="mechanic.repair" /> + <wait seconds="1" /> + <dialogue section="mechanic" id="mirrows6" speaker='player' /> + <dialogue section="mechanic" id="mirrows7" speaker='mechanic' /> + <dialogue section="mechanic" id="mirrows8" speaker='player' /> + <dialogue section="mechanic" id="mirrows9" speaker='mechanic' /> + <dialogue section="mechanic" id="mirrows10" speaker='mechanic' /> + <quest id="mirrows2" /> + </show> + <show id="mirrows3"> + <layer id="bg" /> + <layer id="bg_mirrows" /> + <layer id="mr" /><layer id="mrs" /> + <layer id="mechanic" /> + <hide id="bg_mirrows" /><hide id="mrs" /><hide id="mr" /> + <set id="mirrow_n" value="player.areas.get('mirrows_lab').getObject('mirrow_n')" /> + <set id="mirrow_d" value="player.areas.get('mirrows_lab').getObject('mirrow_d')" /> + <object id="mirrow_n.npc" x="mirrow_n.xPos/Tile.SIZE" y="mirrow_n.yTile/Tile.SIZE" area="mirrows_lab" /> + <object id="mirrow_d.npc" x="mirrow_d.xPos/Tile.SIZE" y="mirrow_d.yTile/Tile.SIZE" area="mirrows_lab" /> + <remove object="mirrow_n" /><remove object="mirrow_d" /> + <play object="mechanic" animation="mechanic.repair" /> + <wait seconds="1" /> + <dialogue section="mechanic" id="mirrows11" speaker='player' /> + <dialogue section="mechanic" id="mirrows12" speaker='mechanic' /> + <section with="fade"> + <show id="bg_mirrows" /><show id="mrs" /><show id="mr" /><hide id="mechanic" /> + <move object="player" x="46" y="4" /> + <teleport area="mirrows_lab" x="20.5" y="9" allowReturn="true" /> + </section> + <dialogue section="mechanic" id="mirrows13" speaker='mr' /> + <lerp object="mechanic" alpha="1" seconds="0.25" /> + <dialogue section="mechanic" id="mirrows14" speaker='mechanic' /> + <dialogue section="mechanic" id="mirrows15" speaker='mrs' /> + <dialogue section="mechanic" id="mirrows16" speaker='mechanic' /> + <dialogue section="mechanic" id="mirrows17" speaker='mrs' /> + <dialogue section="mechanic" id="mirrows18" speaker='player' /> + <dialogue section="mechanic" id="mirrows19" speaker='mr' /> + <dialogue section="mechanic" id="mirrows20" speaker='player' /> + <dialogue section="mechanic" id="mirrows21" speaker='mrs' /> + <action>setFlag('mirrow.defeat', true);</action> + </show> + </scene> +</data> \ No newline at end of file diff --git a/games/aground/data/core/science1/scenes/mirrows/bg.png b/games/aground/data/core/science1/scenes/mirrows/bg.png new file mode 100644 index 00000000..f93d1bf6 Binary files /dev/null and b/games/aground/data/core/science1/scenes/mirrows/bg.png differ diff --git a/games/aground/data/core/science1/scenes/mirrows/bridge.xml b/games/aground/data/core/science1/scenes/mirrows/bridge.xml new file mode 100644 index 00000000..ce028978 --- /dev/null +++ b/games/aground/data/core/science1/scenes/mirrows/bridge.xml @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="utf-8" ?> +<data> + <procedure id="science_end"> + <menu section="common"> + <dialogue section="common" id="save_prompt_science" /> + <choice id="yes"><save fakeDismount="true" /></choice> + <choice id="no" /> + </menu> + <credits /><title with="fade" /> + </procedure> + <procedure id="science1_end"><run procedure="science_end" /></procedure> + <procedure id="science1.bridge"> + <layer id="bg" /> + <layer id="planets" /> + <layer id="info" /> + <layer id="info2" /> + <text text="system.start" align="center" color="ffffff" scale="0.5" width="49" height="8" x="12" y="3" /> + <text text="system.desc.start" reveal="true" color="ffffff" scale="0.5" width="86" x="7" y="125" /> + <wait seconds="2" /> + <dialogue section="mirrows" id="nav1" /> + <layer id="location" /><hide id="location" /><lerp object="location" alpha="1" seconds="0.25" /> + <text text="system.planet.start{char:c}" align="center" color="ffffff" scale="0.5" width="69" height="8" x="183" y="97" /> + <text text="system.planet.desc.start" reveal="true" color="ffffff" scale="0.5" width="67" x="184" y="107" /> + <wait seconds="4" /> + </procedure> + <scene id="science1.bridge"> + <animation id="planets" count="1"> + <append tile="orbit2" animation="single" /><append tile="orbit4" animation="single" /> + <append tile="planet2" animation="planet.start.dwarf" x="-54" y="-15" /> + <append tile="planet7" animation="planet.start" x="-23" y="-4" /> + <append tile="planet8" animation="planet.start.gas" x="53" y="38" /> + </animation> + <layer id="bg" tile="nav.bg.planet" x="0" y="0" /> + <layer id="info" tile="nav.bg.top" animation="nav.bg.top" x="0" y="0" /> + <layer id="info2" tile="star.select" animation="star.select" x="0" y="0" /> + <layer id="planets" tile="orbit1" animation="planets" x="0" y="0" /> + <layer id="location" tile="nav.select" animation="nav.select" x="71" y="57" /> + <layer id="bg_mirrows" image="{core}/science1/scenes/mirrows/bg.png" /> + <layer id="mr" tile="scene.mirrows.mr" animation="scene.mirrows.mr.idle" talk="scene.mirrows.mr.talk" sfx="talking4" x="0" y="0" /> + <layer id="mrs" tile="scene.mirrows.mrs" animation="scene.mirrows.mrs.idle" talk="scene.mirrows.mrs.talk" sfx="talking6" x="0" y="0" /> + + <show id="screen"> + <run procedure="science1.bridge" /> + </show> + <show id="end"> + <run procedure="science1.bridge" /> + <action>setFlag('seen_nav', true)</action> + <dialogue section="mirrows" id="nav2" /> + <wait seconds="1" /> + <section with="fade"> + <removeAll /><layer id="bg_mirrows" /> + <layer id="mr" /><layer id="mrs" /> + </section> + <dialogue section="mirrows" id="nav3" speaker="player" /> + <dialogue section="mirrows" id="nav4" speaker="mr" /> + <dialogue section="mirrows" id="nav5" speaker="player" /> + <dialogue section="mirrows" id="nav6" speaker="mrs" /> + <dialogue section="mirrows" id="nav7" speaker="mr" /> + <wait seconds="1" /> + <run procedure="science1_end" /> + </show> + </scene> +</data> \ No newline at end of file diff --git a/games/aground/data/core/science1/scenes/mirrows/scene.xml b/games/aground/data/core/science1/scenes/mirrows/scene.xml new file mode 100644 index 00000000..ebc101c5 --- /dev/null +++ b/games/aground/data/core/science1/scenes/mirrows/scene.xml @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="utf-8" ?> +<scenes> + <include id="sheet.xml" includeRoot="true" /> + <tile id="scene.mirrows.mr" sheet="sheet.png" x="0" y="0" /> + <tile id="scene.mirrows.mrs" sheet="sheet.png" x="39" y="0" /> + <tile id="scene.mirrows.mr_weap" sheet="sheet.png" x="13" y="0" /> + <tile id="scene.mirrows.mrs_weap" sheet="sheet.png" x="50" y="0" /> + <animation id="scene.mirrows.mr.idle"> + <frame x="12" length="4" /> + <frame x="0" count="12" /> + <frame x="12" length="16" /> + </animation> + <animation id="scene.mirrows.mr.talk" x="18" count="12" /> + <animation id="scene.mirrows.mrs.idle"> + <frame x="10" length="8" /> + <frame x="0" count="10" /> + <frame x="10" length="12" /> + </animation> + <animation id="scene.mirrows.mrs.talk" x="17" count="10" /> + <scene id="mirrows"> + <animation id="weap.hidden"><frame visible="false" /></animation> + <animation id="mr_weap.raise" count="5" /> + <animation id="mrs_weap.raise" count="6" /> + <animation id="mr_weap.idle" count="1" x="25" /> + <animation id="mrs_weap.idle" count="1" x="31" /> + <animation id="mr_weap.active" count="8" x="17" /> + <animation id="mrs_weap.activate" count="1" x="16"> + <frame count="8" x="23" /> + </animation> + <animation id="mrs_weap.active" count="6" x="17" /> + <layer id="bg" image="bg.png" /> + <layer id="mr" tile="mr" animation="mr.idle" talk="mr.talk" sfx="talking4" x="0" y="0" /> + <layer id="mrs" tile="mrs" animation="mrs.idle" talk="mrs.talk" sfx="talking6" x="0" y="0" /> + <layer id="mr_weap" tile="mr_weap" animation="weap.hidden" x="0" y="0" /> + <layer id="mrs_weap" tile="mrs_weap" animation="weap.hidden" x="0" y="0" /> + + <show id="intro"> + <layer id="bg" /> + <layer id="mr" /> + <layer id="mrs" /> + <layer id="mr_weap" /> + <layer id="mrs_weap" /> + <section if="!getFlag('mirrow.intro')"> + <action>setFlag('mirrow.intro', true)</action> + <wait seconds="2" /> + <dialogue section="mirrows" id="intro1" speaker='player' /> + <dialogue section="mirrows" id="intro2" speaker='mr' /> + <dialogue section="mirrows" id="intro3" speaker='mrs' /> + <dialogue section="mirrows" id="intro4" speaker='player' /> + </section> + <play object="mrs_weap" animation="mrs_weap.raise" /> + <play object="mrs_weap" animation="mrs_weap.idle" loop="true" /> + <dialogue section="mirrows" id="intro5" speaker='mrs' /> + <play object="mr_weap" animation="mr_weap.raise" /> + <play object="mr_weap" animation="mr_weap.idle" loop="true" /> + <dialogue section="mirrows" id="intro6" speaker='mr' /> + <menu section="common"> + <choice id="fight"> + <save if="!player.areas.exists('mirrows_lab')" /><remove quest="mirrows2" /> + <teleport area="mirrows_lab" x="20.5" y="9" allowReturn="true" /> + <music id="boss" seconds="1" /> + <play object="mr_weap" animation="mr_weap.active" loop="true" /> + <play object="mrs_weap" animation="mrs_weap.activate" /> + <play object="mrs_weap" animation="mrs_weap.active" loop="true" /> + <wait seconds="2" /> + </choice> + <choice id="run_away" /> + </menu> + </show> + <show id="defeat"> + <layer id="bg" /> + <layer id="mr" /> + <layer id="mrs" /> + <wait seconds="1" /> + <action>setFlag('mirrow.defeat', true);</action> + <dialogue section="mirrows" id="defeat1" speaker='mrs' /> + <dialogue section="mirrows" id="defeat2" speaker='player' /> + <dialogue section="mirrows" id="defeat3" speaker='mr' /> + <dialogue section="mirrows" id="defeat4" speaker='mrs' /> + <dialogue section="mirrows" id="defeat5" speaker='mr' /> + </show> + </scene> +</scenes> \ No newline at end of file diff --git a/games/aground/data/core/science1/scenes/mirrows/sheet.png b/games/aground/data/core/science1/scenes/mirrows/sheet.png new file mode 100644 index 00000000..2df25862 Binary files /dev/null and b/games/aground/data/core/science1/scenes/mirrows/sheet.png differ diff --git a/games/aground/data/core/science1/scenes/mirrows/sheet.xml b/games/aground/data/core/science1/scenes/mirrows/sheet.xml new file mode 100644 index 00000000..98c0458c --- /dev/null +++ b/games/aground/data/core/science1/scenes/mirrows/sheet.xml @@ -0,0 +1,84 @@ +<tilesheet id='sheet.png' width='256' height='144'> + <image frame='0' x='0' y='0' width='121' height='112' offsetX='10' offsetY='32' /> + <image frame='1' x='121' y='0' width='121' height='112' offsetX='10' offsetY='32' /> + <image frame='2' x='242' y='0' width='121' height='112' offsetX='10' offsetY='32' /> + <image frame='3' x='363' y='0' width='121' height='112' offsetX='10' offsetY='32' /> + <image frame='4' x='0' y='112' width='121' height='112' offsetX='10' offsetY='32' /> + <image frame='12' x='0' y='224' width='121' height='112' offsetX='10' offsetY='32' /> + <image frame='13' x='484' y='0' width='47' height='10' offsetX='25' offsetY='134' /> + <image frame='14' x='484' y='10' width='51' height='14' offsetX='24' offsetY='130' /> + <image frame='15' x='484' y='24' width='57' height='21' offsetX='22' offsetY='123' /> + <image frame='16' x='484' y='45' width='66' height='27' offsetX='18' offsetY='117' /> + <image frame='17' x='0' y='336' width='71' height='32' offsetX='13' offsetY='112' /> + <image frame='19' x='0' y='368' width='121' height='112' offsetX='10' offsetY='32' /> + <image frame='20' x='0' y='480' width='121' height='112' offsetX='10' offsetY='32' /> + <image frame='21' x='121' y='112' width='121' height='112' offsetX='10' offsetY='32' /> + <image frame='31' x='242' y='112' width='71' height='61' offsetX='13' offsetY='83' /> + <image frame='33' x='313' y='112' width='97' height='77' offsetX='3' offsetY='67' /> + <image frame='35' x='410' y='112' width='96' height='65' offsetX='13' offsetY='79' /> + <image frame='37' x='506' y='112' width='74' height='64' offsetX='13' offsetY='80' /> + <image frame='39' x='121' y='224' width='95' height='82' offsetX='147' offsetY='62' /> + <image frame='40' x='121' y='306' width='95' height='82' offsetX='147' offsetY='62' /> + <image frame='41' x='121' y='388' width='95' height='82' offsetX='147' offsetY='62' /> + <image frame='42' x='121' y='470' width='95' height='82' offsetX='147' offsetY='62' /> + <image frame='50' x='531' y='0' width='32' height='7' offsetX='218' offsetY='137' /> + <image frame='51' x='541' y='24' width='43' height='17' offsetX='211' offsetY='127' /> + <image frame='52' x='484' y='72' width='49' height='22' offsetX='207' offsetY='122' /> + <image frame='53' x='71' y='336' width='50' height='27' offsetX='206' offsetY='117' /> + <image frame='54' x='242' y='173' width='50' height='30' offsetX='206' offsetY='114' /> + <image frame='56' x='216' y='224' width='95' height='82' offsetX='147' offsetY='62' /> + <image frame='57' x='311' y='224' width='95' height='82' offsetX='147' offsetY='62' /> + <image frame='58' x='406' y='224' width='95' height='82' offsetX='147' offsetY='62' /> + <image frame='59' x='501' y='224' width='95' height='82' offsetX='147' offsetY='62' /> + <image frame='60' x='216' y='306' width='95' height='82' offsetX='147' offsetY='62' /> + <image frame='63' x='216' y='388' width='95' height='82' offsetX='147' offsetY='62' /> + <image frame='64' x='216' y='470' width='95' height='82' offsetX='147' offsetY='62' /> + <image frame='66' x='410' y='177' width='50' height='37' offsetX='206' offsetY='107' /> + <image frame='67' x='311' y='306' width='50' height='137' offsetX='206' offsetY='7' /> + <image frame='68' x='361' y='306' width='56' height='141' offsetX='200' offsetY='3' /> + <image frame='69' x='311' y='443' width='50' height='136' offsetX='206' offsetY='8' /> + <image frame='70' x='361' y='447' width='53' height='134' offsetX='203' offsetY='10' /> + <image frame='71' x='417' y='306' width='51' height='137' offsetX='205' offsetY='7' /> + <image frame='72' x='417' y='443' width='52' height='142' offsetX='204' offsetY='2' /> + <image frame='73' x='468' y='306' width='50' height='70' offsetX='206' offsetY='74' /> + <image frame='74' x='518' y='306' width='50' height='116' offsetX='206' offsetY='28' /> + <image frame='5' equals='4' offsetX='10' offsetY='32' /> + <image frame='6' equals='4' offsetX='10' offsetY='32' /> + <image frame='7' equals='4' offsetX='10' offsetY='32' /> + <image frame='8' equals='4' offsetX='10' offsetY='32' /> + <image frame='9' equals='4' offsetX='10' offsetY='32' /> + <image frame='10' equals='4' offsetX='10' offsetY='32' /> + <image frame='11' equals='4' offsetX='10' offsetY='32' /> + <image frame='18' equals='12' offsetX='10' offsetY='32' /> + <image frame='22' equals='19' offsetX='10' offsetY='32' /> + <image frame='23' equals='12' offsetX='10' offsetY='32' /> + <image frame='24' equals='21' offsetX='10' offsetY='32' /> + <image frame='25' equals='21' offsetX='10' offsetY='32' /> + <image frame='26' equals='12' offsetX='10' offsetY='32' /> + <image frame='27' equals='20' offsetX='10' offsetY='32' /> + <image frame='28' equals='19' offsetX='10' offsetY='32' /> + <image frame='29' equals='19' offsetX='10' offsetY='32' /> + <image frame='30' equals='17' offsetX='13' offsetY='112' /> + <image frame='32' equals='17' offsetX='13' offsetY='112' /> + <image frame='34' equals='17' offsetX='13' offsetY='112' /> + <image frame='36' equals='17' offsetX='13' offsetY='112' /> + <image frame='38' equals='17' offsetX='13' offsetY='112' /> + <image frame='43' equals='42' offsetX='147' offsetY='62' /> + <image frame='44' equals='42' offsetX='147' offsetY='62' /> + <image frame='45' equals='42' offsetX='147' offsetY='62' /> + <image frame='46' equals='42' offsetX='147' offsetY='62' /> + <image frame='47' equals='42' offsetX='147' offsetY='62' /> + <image frame='48' equals='42' offsetX='147' offsetY='62' /> + <image frame='49' equals='42' offsetX='147' offsetY='62' /> + <image frame='55' equals='54' offsetX='206' offsetY='114' /> + <image frame='61' equals='56' offsetX='147' offsetY='62' /> + <image frame='62' equals='59' offsetX='147' offsetY='62' /> + <image frame='65' equals='59' offsetX='147' offsetY='62' /> + <image frame='75' equals='67' offsetX='206' offsetY='7' /> + <image frame='76' equals='68' offsetX='200' offsetY='3' /> + <image frame='77' equals='69' offsetX='206' offsetY='8' /> + <image frame='78' equals='70' offsetX='203' offsetY='10' /> + <image frame='79' equals='71' offsetX='205' offsetY='7' /> + <image frame='80' equals='72' offsetX='204' offsetY='2' /> + <image frame='81' equals='54' offsetX='206' offsetY='114' /> +</tilesheet> diff --git a/games/aground/data/core/science1/scenes/scenes.xml b/games/aground/data/core/science1/scenes/scenes.xml new file mode 100644 index 00000000..370285e5 --- /dev/null +++ b/games/aground/data/core/science1/scenes/scenes.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8" ?> +<scenes> + <include id="fisherman/scene.xml" /> + <include id="inn/scene.xml" /> + <include id="mirrows/scene.xml" /> + <include id="mirrows/bridge.xml" /> + <include id="mechanic/scene.xml" /> +</scenes> \ No newline at end of file diff --git a/games/aground/data/core/science1/science1.xml b/games/aground/data/core/science1/science1.xml new file mode 100644 index 00000000..71acc348 --- /dev/null +++ b/games/aground/data/core/science1/science1.xml @@ -0,0 +1,489 @@ +<?xml version="1.0" encoding="utf-8" ?> +<data> + <include id="parallax/parallax.xml" /> + <include id="items/items.xml" /> + <include id="enemies/enemies.xml" /> + <include id="npc/npcs.xml" /> + <include id="structures/structures.xml" /> + <include id="scenes/scenes.xml" /> + <tile id="sci1.grass" sheet="{core}/tiles/tiles.png" x="127" /> + <tile id="sci1.dirt" sheet="{core}/tiles/tiles.png" x="128" /> + <tile id="sci1.stone" sheet="{core}/tiles/tiles.png" x="129" /> + <tile id="desert.dirt" sheet="{core}/tiles/tiles.png" x="130" /> + <tile id="desert.dirt_top" sheet="{core}/tiles/tiles.png" x="130"><tile sheet="{core}/tiles/tiles.png" x="131" /></tile> + <tile id="desert.scorched" sheet="{core}/tiles/tiles.png" x="137" /> + <tile id="basalt" sheet="{core}/tiles/tiles.png" x="132" /> + <tile id="scorched.dirt" sheet="{core}/tiles/tiles.png" x="133" autotile="basic9" /> + <dig id="sci1.dirt" cost="0" /> + <dig id="sci1.grass" cost="0" grass="true" /> + <dig id="sci1.stone" cost="2" /> + <dig id="desert.dirt" cost="1" /> + <dig id="desert.dirt_top" cost="1" /> + <dig id="desert.scorched" cost="1" /> + <dig id="scorched.dirt" cost="1" /> + <dig id="basalt" cost="3" /> + + <tile id="sci1.dirt_sand1" sheet="{core}/tiles/tiles.png" x="128"><tile sheet="{core}/tiles/tiles.png" x="85" /></tile> + <tile id="sci1.dirt_sand2" sheet="{core}/tiles/tiles.png" x="128"><tile sheet="{core}/tiles/tiles.png" x="84" /></tile> + <tile id="sci1.dirt_sand3" sheet="{core}/tiles/tiles.png" x="128"><tile sheet="{core}/tiles/tiles.png" x="88" /></tile> + <dig id="sci1.dirt_sand1" cost="1" /> + <dig id="sci1.dirt_sand2" cost="1" /> + <dig id="sci1.dirt_sand3" cost="1" /> + + <tile id="desert.dirt_sand1" sheet="{core}/tiles/tiles.png" x="130"><tile sheet="{core}/tiles/tiles.png" x="85" /></tile> + <tile id="desert.dirt_sand2" sheet="{core}/tiles/tiles.png" x="130"><tile sheet="{core}/tiles/tiles.png" x="84" /></tile> + <tile id="desert.dirt_sand3" sheet="{core}/tiles/tiles.png" x="130"><tile sheet="{core}/tiles/tiles.png" x="88" /></tile> + <dig id="desert.dirt_sand1" cost="1" /> + <dig id="desert.dirt_sand2" cost="1" /> + <dig id="desert.dirt_sand3" cost="1" /> + + <tile id="ship" stride="2"> + <tile sheet="ship.png" p="40" x="0" y="0" /> + <tile sheet="ship.png" p="1" x="2" y="0" /> + <tile sheet="ship.png" p="1" x="4" y="0" /> + <tile sheet="ship.png" p="1" x="0" y="2" /> + <tile sheet="ship.png" p="1" x="2" y="2" /> + <tile sheet="ship.png" p="1" x="4" y="2" /> + <tile sheet="ship.png" p="1" x="0" y="4" /> + <tile sheet="ship.png" p="1" x="2" y="4" /> + <tile sheet="ship.png" p="1" x="4" y="4" /> + </tile> + + <procedure id="minodoor"> + <set id="cave_x" value="randInt(98, 188)" /><set id="cave_y" value="randInt(60, 92)" /> + <structure id="minodoor" x="cave_x" y="cave_y"><teleport area="labyrinth" x="32" y="33" allowReturn="true" /></structure> + <spreadTiles x="cave_x" y="cave_y" eval="'markings'+randInt(1,9)" layer="back" on="sci1.stone" count="50" /> + </procedure> + <procedure id="science1.onLoad"> + <section if="!modEnabled('newgrounds') && !getFlag('ng_tank')"> + <set id="tank" value="area.getObject('tank')" /> + <remove object="tank" if="tank != null" /> + </section> + <structure id="cave" x="20" y="33" if="area.getStructureById('cave') == null"><teleport area="water_cave" x="28" y="33" /></structure> + <run procedure="minodoor" if="area.getStructureById('minodoor') == null" /> + <object id="water_cave_entrance" x="-5" y="40" if="area.getObject('water_cave_entrance') == null" /> + <remove structure="player.areas.get('start').getStructureById('boat')" if="area.getStructureById('boat') != null" /> + <remove quest="mirrows2" if="getFlag('mirrow.defeat') && !player.questComplete('mirrows2')" /> + <action if="!area.isWater(-2, 34)"> + for(y in 34...41) for(x in -10...-2){mine(x, y); area.setWater(x, y);} + </action> + <action if="!area.isLit(-3, 38)">for(y in 34...41) for(x in -10...-2) area.setLit(x, y);</action> + <appendArea id="sea_floor" if="area.getObject('seaweed') == null"><params area_left="-250" area_right="330" area_width="192" area_height="96" /></appendArea> + <action if="area.getTileString(-5, 33, BASE_LAYER) != 'blackstone'">for(x in -5...0) setTile(x, 33, "blackstone")</action> + <action if="area.getTileString(-5, 41, BASE_LAYER) != 'blackstone'">for(x in -5...0) setTile(x, 41, 'blackstone'); for(y in 33...41) setTile(-2, y, 'blackstone');</action> + <weather type="fog" image="sand.png" alpha="0.3" color="ffdd99" x="0" y="-10" width="80" height="12" dx="4" dy="0.05" if="area.getStructureById('terraformer') == null" /> + </procedure> + <area id="science1" background="science1" planet="start" external="crashed_ship.cave1"> + <appendArea id="science1.mountain" offsetX="96" offsetY="0" /> + <appendArea id="science1.desert" offsetX="0" offsetY="0" /> + <appendArea id="science1.forest" offsetX="96" offsetY="0" /> + <appendArea id="sea_floor"><params area_left="-250" area_right="330" area_width="192" area_height="96" /></appendArea> + <structure id="cave" x="20" y="33"><teleport area="water_cave" x="28" y="33" /></structure> + <run procedure="minodoor" /> + <spawner id="metal_debris1" time="5000" count="15" fromX="-240" toX="-10" fromY="3" toY="62" underwater="true" /> + <spawner id="bandit_heavy" time="5000" count="1" fromX="100" toX="136" fromY="-1" toY="-1" enabled="player.hasQuest('bandits') && !player.questComplete('bandits') && player.getKillCount('bandit_heavy') == 0" /> + <spawner id="bandit_ranged" time="5000" count="1" fromX="100" toX="136" fromY="-1" toY="-1" enabled="player.hasQuest('bandits') && !player.questComplete('bandits') && player.getKillCount('bandit_ranged') == 0" /> + <spawner id="bandit_combo" time="5000" count="1" fromX="100" toX="136" fromY="-1" toY="-1" enabled="player.hasQuest('bandits') && !player.questComplete('bandits') && player.getKillCount('bandit_combo') == 0" /> + <spawner id="bandit_knives" time="5000" count="1" fromX="100" toX="136" fromY="-1" toY="-1" enabled="player.hasQuest('bandits') && !player.questComplete('bandits') && player.getKillCount('bandit_knives') == 0" /> + <spawner id="wood_crate" time="4000" count="3" fromX="220" toX="300" fromY="-1" toY="-1" ground="false" enabled="!player.questComplete('pirates')" /> + <spawner id="wood_debris1" time="4000" count="3" fromX="220" toX="300" fromY="-1" toY="-1" ground="false" enabled="!player.questComplete('pirates')" /> + <spawner id="wood_debris2" time="3000" count="3" fromX="220" toX="300" fromY="-1" toY="-1" ground="false" enabled="!player.questComplete('pirates')" /> + <fishing> + <loot id="toothfish" p="16" difficulty="1" /> + <loot id="rockfish" p="4" difficulty="2" /> + <loot id="coral_cod" p="1" difficulty="3" /> + </fishing> + <init><runAreaLoad /><action>setFlag('jump_water', true);</action></init> + <onLoad> + <tile id="seagull" animation="seagull.walk" x="191-random()*5" /> + <tile id="seagull" animation="seagull.fly" x="190+random()*5" y="-4" /> + <tile id="seagull" animation="seagull.fly" x="195+random()*5" y="-5" /> + <tile id="seagull" animation="seagull.fly" x="196+random()*5" y="-3" /> + <tile id="redbreast" type="bird" x="102+random()*23" fromX="102" toX="189" /> + <tile id="redbreast" type="bird" x="102+23+random()*23" fromX="102" toX="189" /> + <tile id="redbreast" type="bird" x="102+46+random()*23" fromX="102" toX="189" /> + <tile id="redbreast" type="bird" x="102+69+random()*17" fromX="102" toX="189" /> + <music id="science1" seconds="1" /><run procedure="science1.onLoad" /> + <objects id="science1.townfolk" startX="124" endX="190" minDist="10" maxDist="15" if="area.getObject('science1.townfolk') == null && player.getString('homeworld') == null" /> + <object id="lurker" x="166" if="area.getNPC('lurker') == null && player.getString('homeworld') == null" /> + </onLoad> + <connection area="start" fromX="330" toX="-240" /> + <connection area="science1" fromX="-250" toX="330" /> + </area> + <area id="science1.mountain"> + <shape type="trapezoid" bottom="64"> + <top y="-10" fromX="0" toX="1" /> + <bottom y="32" fromX="-16" toX="17" /> + </shape> + <tiles id="sci1.stone" start="0" end="1" /> + <ore id="diamond" start="0.9" end="1.0" percent="0.0025" tile="sci1.stone" /> + <ore id="iron" start="0.0" end="1.0" percent="0.0125" tile="sci1.stone" /> + <ore id="sulfur" start="0.2" end="0.9" percent="0.0125" tile="sci1.stone" /> + <ore id="gold" start="0.3" end="0.6" percent="0.0125" tile="sci1.stone" /> + </area> + <area id="science1.desert" width="96" height="96"> + <tiles id="desert.dirt_top" y="0" empty="true" /> + <tiles id="bedrock" y="95" empty="true" /> + <tiles id="desert.dirt" start="0" end="0.5" empty="true" /> + <tiles id="basalt" start="0.5" end="1" empty="true" /> + <appendArea id="science1.crater" offsetX="24" offsetY="0" /> + <shore x="-1" top="sand_top" bottom="sand" flip="true" dock="dock_empty" trans1="desert.dirt_sand1" trans2="desert.dirt_sand2" /> + <ore id="oil" start="0.0" end="0.5" percent="0.0375" tile="desert.dirt" /> + <ore id="iron" start="0.2" end="0.5" percent="0.0125" tile="desert.dirt" /> + <ore id="sulfur" start="0.4" end="0.5" percent="0.0025" tile="desert.dirt" /> + <ore id="uranium" start="0.9" end="1.0" percent="0.000625" tile="basalt" /> + <ore id="diamond" start="0.8" end="1.0" percent="0.0125" tile="basalt" /> + <ore id="gold" start="0.5" end="1.0" percent="0.0125" tile="basalt" /> + <ore id="oil" start="0.5" end="0.8" percent="0.0375" tile="basalt" /> + <objects id="treasure_chest" start="0.1" end="0.3" count="4" tile="desert.dirt"> + this.inventory.addItems(Item.get("battery"), 1); + </objects> + <objects id="treasure_chest" start="0.3" end="0.5" count="3" tile="desert.dirt"> + this.inventory.addItems(Item.get("bullet"), 15); + </objects> + <objects id="treasure_chest" start="0.5" end="1.0" count="3" tile="desert.dirt"> + this.inventory.addItems(Item.get("shell"), 15); + </objects> + <objects id="steel_wyrm" start="0.1" end="0.4" percent="0.0005" tile="desert.dirt" /> + <spawner id="steel_wyrm" time="4000" count="5" fromX="1" toX="94" fromY="3" toY="32" tile="desert.dirt" /> + <objects id="cyborg_heavy_gun" fromX="3" toX="85" count="3" /> + <spawner id="cyborg_heavy_gun" time="4000" count="3" fromX="3" toX="85" fromY="-1" toY="-1" /> + <objects id="diode_wolf" fromX="3" toX="85" count="5" /> + <spawner id="diode_wolf" time="2000" count="5" fromX="3" toX="85" fromY="-1" toY="-1" /> + <objects id="stinger" start="0.1" end="0.4" count="5" tile="desert.dirt" /> + <spawner id="stinger" time="4000" count="5" fromX="1" toX="94" fromY="3" toY="92" /> + </area> + <area id="science1.crater"> + <shape type="trapezoid"> + <top y="0" fromX="0" toX="48" /> + <bottom y="22" fromX="16" toX="32" /> + </shape> + <tiles id="scorched.dirt" start="0" end="1" /> + <appendArea id="science1.crater.mined" offsetX="0" offsetY="0" /> + <ore id="titanium" start="0.5" end="1.0" percent="0.0125" tile="scorched.dirt" /> + </area> + <area id="science1.crater.mined"> + <shape type="trapezoid"> + <top y="0" fromX="10" toX="45" /> + <bottom y="6" fromX="19" toX="29" /> + </shape> + <mine start="0" end="1" light="3" /> + <structure id="crashed_ship" x="11" y="20" /> + <structure id="crashed_ship.door.locked" x="20.8125" y="4.625" /> + <structure id="crashed_ship.crack1" x="28.8125" y="14.375" /> + <structure id="crashed_ship.crack2" x="18.125" y="17.0625" /> + </area> + <area id="science1.forest" width="96" height="96"> + <tiles id="sci1.grass" y="0" empty="true" /> + <tiles id="bedrock" y="95" empty="true" /> + <tiles id="sci1.dirt" start="0" end="0.5" empty="true" /> + <tiles id="sci1.stone" start="0.5" end="1" empty="true" /> + <shore x="96" top="sand_top" bottom="sand" dock="sci1.dock_flip" trans1="sci1.dirt_sand1" trans2="sci1.dirt_sand3" /> + <object id="fisherman.boat" x="200" /> + <ore id="quartz" start="0.4" end="0.5" percent="0.0025" tile="sci1.dirt" /> + <ore id="sulfur" start="0.2" end="0.5" percent="0.0125" tile="sci1.dirt" /> + <ore id="sulfur" start="0.1" end="0.2" percent="0.000625" tile="sci1.dirt" /> + <ore id="coal" start="0.0" end="0.4" percent="0.0375" tile="sci1.dirt" /> + <ore id="gold" start="0.4" end="0.5" percent="0.000625" tile="sci1.dirt" /> + <ore id="diamond" start="0.9" end="1.0" percent="0.0025" tile="sci1.stone" /> + <ore id="sulfur" start="0.5" end="0.9" percent="0.0125" tile="sci1.stone" /> + <ore id="iron" start="0.5" end="1.0" percent="0.0375" tile="sci1.stone" /> + <ore id="lava" start="0.7" end="0.8" percent="1" tile="sci1.stone" /> + <objects id="conifer" y="-1" startX="55" endX="6" minDist="-6" maxDist="-9" array="trees" /> + <objects id="red_bush" y="-1" between="trees" pos="0.25" altPos="0.75" percent="0.34" /> + <objects id="bush" y="-1" between="trees" pos="0.25" altPos="0.75" percent="0.67" /> + <structure id="inn" x="67" /> + <structure id="sci1.food_market" x="61" /> + <structure id="sci1.weaps_market" x="58" /> + <structure id="sci1.mineral_market" x="55" /> + <structure id="powerline1" x="75" /> + <structure id="powerline2" x="64" /> + <structure id="powerline2" x="53" /> + <structure id="powerline2" x="42" /> + <structure id="damaged_power_plant" x="77" /> + <object id="mechanic" x="78" /> + <structure id="warehouse" x="88" /> + <objects id="treasure_chest" start="0.1" end="0.3" count="8" tile="sci1.dirt"> + this.inventory.addItems(Item.get("titanium"), 2); + </objects> + <objects id="treasure_chest" start="0.3" end="0.5" count="3" tile="sci1.dirt"> + this.inventory.addItems(Item.get("steel_bar"), 3); + </objects> + <onLoad> + <set id="fisherman_boat" value="area.getObject('fisherman.boat')" /> + <action if="fisherman_boat.tile_x > 96+101 && area.getNPC('fisherman') == null"> + fisherman_boat.setTile(96+101, -1, 1, getProcedure("fisherman.disembark")); fisherman_boat.playAnimation("fisherman.boat.sail"); + </action> + </onLoad> + + </area> + <area id="crashed_ship.cave1" name="colony_ship" width="64" height="32" external="science1"> + <tiles id="ship" start="0" end="1" /> + <action>for(y in 10...24) for(x in 10...56) mine(x, y)</action> + <tiles id="desert.scorched" start="0.5" end="1" empty="true" /> + <action>for(y in 0...2) for(x in 0...6){setTile(12+x*8, 12+y*8, "ship"); setTile(13+x*8, 12+y*8, "ship"); setTile(12+x*8, 13+y*8, "ship"); setTile(13+x*8, 13+y*8, "ship");}</action> + <ore id="titanium" start="0.5" end="1.0" percent="0.0125" tile="desert.scorched" /> + <structure id="crashed_ship.crack1.ret" x="31" y="22" /> + <objects id="stinger" start="0" end="1" count="20" /> + <spawner id="stinger" time="4000" count="10" fromX="1" toX="62" fromY="1" toY="31" enabled="!getFlag('bombardment')" /> + <objects id="ship_chest" start="0" end="1" count="3"> + this.inventory.addItems(Item.get("battery"), 1); + </objects> + <objects id="ship_chest" start="0" end="1" count="2"> + this.inventory.addItems(Item.get("refined_oil"), 3); + </objects> + <objects id="ship_chest" start="0" end="1" count="2"> + this.inventory.addItems(Item.get("silicon"), 3); + </objects> + <objects id="ship_chest" start="0" end="1" count="4"> + this.inventory.addItems(Item.get("bandage"), 3); + </objects> + <objects id="ship_chest" start="0" end="1" count="2"> + this.inventory.addItems(Item.get("bullet"), 15); + </objects> + <objects id="ship_chest" start="0" end="1" count="2"> + this.inventory.addItems(Item.get("landmine"), 3); + </objects> + <objects id="ship_chest" start="0" end="1" count="2"> + this.inventory.addItems(Item.get("shell"), 15); + </objects> + <objects id="ship_chest" start="0" end="1" count="2"> + this.inventory.addItems(Item.get("uranium"), 1); + </objects> + <objects id="ship_chest" start="0" end="1" count="1"> + this.inventory.addItems(Item.get("jetpack"), 1); + </objects> + <mine x="33" y="21" light="4" /> + <init><runAreaLoad /></init> + <onLoad> + <music id="science1" seconds="1" /><action>player.prevLocation = null;</action> + </onLoad> + </area> + <area id="crashed_ship.cave2" name="colony_ship" width="64" height="32"> + <tiles id="ship" start="0" end="1" /> + <action>for(x in 2...56){mine(x, 18); mine(x, 21);} mine(55, 20); mine(55, 19);</action> + <action>for(y in 22...25) for(x in 2...6) mine(x, y); mine(2, 16); mine(2, 17); for(y in 14...16) for(x in 2...56) mine(x, y);</action> + <structure id="crashed_ship.crack2.ret" x="2" y="24" /><light x="4" y="23" size="4" /> + <objects id="cyborg_heavy_gun" startX="3" endX="54" minDist="6" maxDist="9" y="18" /> + <object id="cyborg_heavy_gun" x="2" y="18" /> + <object id="cyborg_heavy_gun" x="55" y="18" /> + <spawner id="cyborg_heavy_gun" time="4000" count="8" fromX="2" toX="55" fromY="18" toY="18" /> + <objects id="diode_wolf" startX="3" endX="53" minDist="6" maxDist="9" y="21" /> + <object id="diode_wolf" x="2" y="21" /> + <object id="diode_wolf" x="54" y="21" /> + <spawner id="diode_wolf" time="4000" count="8" fromX="2" toX="54" fromY="21" toY="21" /> + <set id="ar" value="[5,9,13,17,21,25,29,33,37,41,45,49]" /><action>shuffle(ar);</action> + <structure id="medivat1" x="ar[0]" y="15" /> + <structure id="medivat2" x="ar[1]" y="15" /> + <structure id="medivat3" x="ar[2]" y="15" /> + <structure id="medivat4" x="ar[3]" y="15" /> + <structure id="medivat.full1" x="ar[4]" y="15" /> + <structure id="medivat.full2" x="ar[5]" y="15" /> + <structure id="medivat.full3" x="ar[6]" y="15" /> + <structure id="medivat.full4" x="ar[7]" y="15" /> + <structure id="medivat1" x="ar[8]" y="15" /> + <structure id="medivat2" x="ar[9]" y="15" /> + <structure id="medivat3" x="ar[10]" y="15" /> + <structure id="medivat4" x="ar[11]" y="15" /> + <structure id="sci1.light.off" x="ar[0]-1" y="15" /> + <structure id="sci1.light.broken" x="ar[1]-1" y="15" /> + <structure id="sci1.light.broken" x="ar[2]-1" y="15" /> + <structure id="sci1.light.broken" x="ar[3]-1" y="15" /> + <structure id="sci1.light" x="ar[4]-1" y="15" /> + <structure id="sci1.light" x="ar[5]-1" y="15" /> + <structure id="sci1.light" x="ar[6]-1" y="15" /> + <structure id="sci1.light" x="ar[7]-1" y="15" /> + <structure id="sci1.light.off" x="ar[8]-1" y="15" /> + <structure id="sci1.light.broken" x="ar[9]-1" y="15" /> + <structure id="sci1.light.broken" x="ar[10]-1" y="15" /> + <structure id="sci1.light.broken" x="ar[11]-1" y="15" /> + <structure id="medicom" x="4" y="15" dialogue="medicom.panel1" /> + <structure id="medicom" x="8" y="15" dialogue="medicom.panel2" /> + <structure id="medicom" x="12" y="15" dialogue="medicom.panel3" /> + <structure id="medicom" x="16" y="15" dialogue="medicom.panel4" /> + <structure id="medicom" x="20" y="15" dialogue="medicom.panel5" /> + <structure id="medicom" x="24" y="15" dialogue="medicom.panel6" /> + <structure id="medicom" x="28" y="15" dialogue="medicom.panel7" /> + <structure id="medicom" x="32" y="15" dialogue="medicom.panel8" /> + <structure id="medicom" x="36" y="15" dialogue="medicom.panel9" /> + <structure id="medicom" x="40" y="15" dialogue="medicom.panel10" /> + <structure id="medicom" x="44" y="15" dialogue="medicom.panel11" /> + <structure id="medicom" x="48" y="15" dialogue="medicom.panel12" /> + + <structure id="diode_wolf_pen" x="53" y="15"><addAnimal id="diode_wolf" value="2000" /></structure> + </area> + + <procedure id="mirrow.lab.music"> + <choose><music id="boss" seconds="1" if="area.getObject('mirrow_n') != null || area.getObject('mirrow_d') != null" /><music id="science1" seconds="1" /></choose> + </procedure> + <area id="mirrows_lab" name="colony_ship" width="32" height="16" external="science1"> + <tiles id="ship" start="0" end="1" /> + <action>for(y in 7...10) for(x in 8...24) mine(x, y);</action> + <structure id="crashed_ship.door.exit" x="20" y="9.1" /> + <light x="20" y="8" size="3" /><light x="21" y="8" size="3" /><light x="20" y="9" size="3" /><light x="21" y="9" size="3" /> + <structure id="medicom" x="10" y="9" dialogue="medicom.panel13" /> + <structure id="operation_table" x="12" y="9" /> + <structure id="medicom" x="15" y="9" dialogue="medicom.panel14" /> + <structure id="medivat.full1" x="16" y="9" /> + <structure id="medicom" x="23" y="9" dialogue="medicom.panel15" /> + <structure id="sci1.light" x="10" y="9" /> + <structure id="sci1.light" x="14" y="9" /> + <structure id="sci1.light" x="18" y="9" /> + <structure id="sci1.light" x="22" y="9" /> + <object id="mirrow_n" x="13" y="8" /> + <object id="mirrow_d" x="13" y="9" /> + <structure id="science1.bridge.entrance" x="8" y="9.1" /> + <onLoad> + <run procedure="mirrow.lab.music" /> + <section if="area.getStructureById('science1.bridge.entrance') == null"> + <structure id="science1.bridge.entrance" x="8" y="9.1" /> + </section> + </onLoad> + </area> + + <include id="water_cave.xml" includeRoot="true" /> + <tile id="water_cave" sheet="water_cave.png" offsetX="-64" /> + <animation id="water_cave.bubbles" count="12" /> + <animation id="water_cave" x="12" count="1" length="12"><append tile="water_cave" animation="water_cave.bubbles" /></animation> + <tile id="water_cave_exit" sheet="water_cave.png" /> + <tile id="water_cave_block1" sheet="water_cave.png" x="13" /> + <tile id="water_cave_block2" sheet="water_cave.png" x="14" /> + <animation id="water_cave_exit" x="12" count="1" length="12"><append tile="water_cave_exit" animation="water_cave.bubbles" /></animation> + <object id="water_cave_exit" tile="water_cave_exit" animation="water_cave_exit" overlapVehicle="true" waterTint="false" layer="item" behind="true"> + <tile id="water_cave_block2" x="-2" y="-3.5" top="true" /> + <over><invokeLater if="player._getFacing() == 1 && player._getWidth() <= 4*Tile.SIZE"><teleport area="science1" x="player._getTileX()-9.125" y="player._getTileY()" /></invokeLater></over> + <out><invokeLater if="player._getFacing() == 1 && player.vehicle != null"><teleport area="science1" x="player._getTileX()-9.125" y="player._getTileY()" /></invokeLater></out> + </object> + <object id="water_cave_entrance" tile="water_cave" animation="water_cave" overlapVehicle="true" waterTint="false" layer="item" behind="true"> + <tile id="water_cave_block1" x="-6" y="-3.5" top="true" /> + <over><invokeLater if="player._getFacing() == -1"><teleport area="water_cave" x="player._getTileX()+9.125" y="player._getTileY()" /></invokeLater></over> + <out><run object="water_cave_entrance" event="over" if="player.vehicle != null" /></out> + </object> + <area id="water_cave" y="26" width="32" height="20" background="underwater" external="science1"> + <tiles id="desert.dirt" start="0.0" end="1" /> + <tiles id="blackstone" y="45" /><tiles id="blackstone" y="26" /><tiles id="blackstone" x="31" /> + <action> + for(y in 1...8) for(x in 1...31) mine(x, 26+y); + for(y in 0...19) for(x in 0...8) setTile(x, 26+y, "sand"); + for(y in 4...12) for(x in 8...24) setTile(x, 30+y, "sand"); + for(y in 4...11) for(x in 0...23){mine(x, 30+y); area.setWater(x, 30+y);} + </action> + <ore id="oil" start="0.5" end="1" percent="0.0375" tile="desert.dirt" /> + <ore id="iron" start="0.7" end="1" percent="0.0125" tile="desert.dirt" /> + <ore id="sulfur" start="0.9" end="1" percent="0.0025" tile="desert.dirt" /> + <structure id="cave" x="28" y="33"><teleport area="science1" x="20" y="33" /></structure> + <light x="28" y="33" size="3" /><light x="29" y="33" size="3" /><light x="28" y="32" size="3" /><light x="29" y="32" size="3" /> + <fishing> + <loot id="rockfish" p="12" difficulty="2" /> + <loot id="coral_cod" p="1" difficulty="3" /> + <loot id="electric_eel" p="4" difficulty="4" achievement="electric_eel" /> + </fishing> + <init><runAreaLoad /></init> + <onLoad> + <action if="area.isWater(-1, 44)">for(y in 6...16){setTile(-1, 30+y, y == 6?"sand_top":"sand"); area.setLit(-1, 30+y); area.setUnlit(0, 30+y);} for(y in 6...11){mine(-1, 30+y); area.setWater(-1, 30+y);}</action> + <action if="!area.isLit(1, 38)">for(y in 4...11) for(x in 0...7) area.setLit(x, 30+y);</action> + <music id="science1" seconds="1" /><object id="water_cave_exit" x="0" y="40" if="area.getObject('water_cave_exit') == null" /> + <action if="area.getTileString(7, 32, BASE_LAYER) != 'blackstone'">for(y in 27...34) setTile(7, y, 'blackstone'); for(y in 41...45) setTile(7, y, 'blackstone'); for(x in 4...7) setTile(x, 33, 'blackstone');</action> + <action if="area.getTileString(7, 26, BASE_LAYER) != 'blackstone'">for(x in 0...32){setTile(x, 26, 'blackstone'); setTile(x, 45, 'blackstone');} for(y in 0...20) setTile(31, y+26, 'blackstone');</action> + <action if="area.getTileString(4, 41, BASE_LAYER) != 'blackstone'">for(x in 4...7) setTile(x, 41, 'blackstone');</action> + </onLoad> + </area> + + <area id="labyrinth" temporary="true"> + <setTile x="32" y="32" layer="back" tile="markings1" /><structure id="minodoor" x="32" y="33" /> + <set id="ar" value="[2,2,60,2,2,60,60,60]" /><action>shuffleN(ar, 2);</action> + <setTile x="2" y="2" layer="back" tile="markings1" /><structure id="minodoor" x="ar[0]" y="ar[1]+1"> + <teleport area="labyrinth_end" x="16" y="6" /> + </structure> + <setTile x="60" y="2" layer="back" tile="markings2" /><object id="treasure_chest" x="ar[2]" y="ar[3]"> + this.inventory.addItems(Item.get("sulfur"), 20); + </object> + <setTile x="2" y="60" layer="back" tile="markings3" /><object id="treasure_chest" x="ar[4]" y="ar[5]"> + this.inventory.addItems(Item.get("refined_oil"), 10); + </object> + <setTile x="60" y="60" layer="back" tile="markings4" /><object id="treasure_chest" x="ar[6]" y="ar[7]"> + this.inventory.addItems(Item.get("cloth"), 10); this.inventory.addItems(Item.get("silk"), 5); + </object> + <maze floor="'markings'+randInt(1,9)" wall="bedrock" width="32" height="32" tilesPerCell="2" /> + <objects id="wall_trap" place="wall" length="8" fromX="0" toX="64" fromY="0" toY="64" count="64" /> + <light x="32" y="33" size="3" /><light x="33" y="33" size="3" /><light x="32" y="32" size="3" /><light x="33" y="32" size="3" /> + <spawner id="minotaur" time="5000" count="8" fromX="1" toX="62" fromY="1" toY="62" spawnWidth="128" /> + <init><action>area.spawner.spawnAll("minotaur")</action><runAreaLoad /></init> + <onLoad> + <action if="area.getTileString(0,0,BASE_LAYER) == 'bedrock'">for(y in 1...63){setTile(0, y, "blackstone"); setTile(63, y, "blackstone");} for(x in 0...64){setTile(x, 0, "blackstone"); setTile(x, 63, "blackstone");}</action> + </onLoad> + </area> + + <area id="sea_floor_full"> + <set id="_width" value="area_right-area_left-64" /><set id="_height" value="16" /><appendArea id="sea_floor_bottom" offsetX="area_left+16" offsetY="64" /> + <action>for(y in 80...90) for(x in area_left-9...area_right+9) setTile(x, y, "blackstone");</action> + </area> + <area id="labyrinth_end" width="32" height="16" background="sky" planet="start"> + <tiles id="sci1.dirt" start="0" end="1" /> + <tiles id="sci1.grass" y="0" /> + <action>for(y in 7...16) for(x in 0...32) setTile(x, y, "bedrock");</action> + <shore x="-1" top="sand_top" bottom="sand" trans1="sci1.dirt_sand1" trans2="sci1.dirt_sand2" flip="true" dock="dock_empty" /> + <shore x="32" top="sand_top" bottom="sand" trans1="sci1.dirt_sand1" trans2="sci1.dirt_sand3" dock="dock_empty_flip" /> + <appendArea id="sea_floor_full"><params area_left="-130" area_right="160" /></appendArea> + <ore id="quartz" start="0.4" end="0.5" percent="0.0025" tile="sci1.dirt" /> + <ore id="sulfur" start="0.2" end="0.5" percent="0.0125" tile="sci1.dirt" /> + <ore id="sulfur" start="0.1" end="0.2" percent="0.000625" tile="sci1.dirt" /> + <ore id="coal" start="0.0" end="0.4" percent="0.0375" tile="sci1.dirt" /> + <ore id="gold" start="0.4" end="0.5" percent="0.000625" tile="sci1.dirt" /> + <structure id="minodoor_exit" x="16" y="6" /> + <structure id="recipe_pillar" x="16" recipe="make_dragonsword" /> + <object id="minotaur" x="16" y="-1" /> + <spawner id="minotaur" time="10000" count="1" fromX="1" toX="30" fromY="-1" toY="-1" /> + <mine x="16" y="6" light="3" /><mine x="17" y="6" light="3" /><mine x="16" y="5" light="3" /><mine x="17" y="5" light="3" /> + <object id="treasure_chest" x="3">this.inventory.addItems(Item.get("cow"), 2);</object> + <object id="treasure_chest" x="15">this.inventory.addItems(Item.get("kitchen_upgrade"), 1);</object> + <object id="treasure_chest" x="28"> + this.inventory.addItems(Item.get("fire_tusk"), 4); this.inventory.addItems(Item.get("horn"), 4); + </object> + <init><runAreaLoad /></init> + <onLoad> + <action>player.prevLocation = null;</action> + <weather type="fog" x="-100" y="-64" width="232" height="84" /><music id="nightly" seconds="1" /> + <structure id="minodoor_exit" x="16" y="6" if="area.getStructureById('minodoor_exit') == null" /> + <object id="treasure_chest" x="15" if="version < 50">this.inventory.addItems(Item.get("kitchen_upgrade"), 1);</object> + <appendArea id="sea_floor_full" if="area.getObject('seaweed') == null"><params area_left="-130" area_right="160" /></appendArea> + </onLoad> + <fishing> + <loot id="toothfish" p="16" difficulty="1" /> + <loot id="rockfish" p="4" difficulty="2" /> + <loot id="coral_cod" p="1" difficulty="3" /> + </fishing> + <connection area="farming" fromX="160" toX="-240" /> + <connection area="snow_island" fromX="-130" toX="340" /> + </area> + <object id="science1.bridge.exit" layer="npc" action="structure.tooltip.enter" width="16" height="32"> + <operate><choose> + <teleport area="mirrows_lab" x="8.5" y="9" with="ellipse" if="player.areas.exists('mirrows_lab')" /> + <return with="ellipse" /> + </choose></operate> + </object> + <object id="science1.bridge.nav" layer="npc" action="structure.tooltip.operate" width="16" height="16"> + <operate><choose> + <scene id="science1.bridge" show="end" with="fade" showToAll="true" if="!getFlag('seen_nav')" /> + <scene id="science1.bridge" show="screen" with="fade" /> + </choose></operate> + </object> + <object id="science1.bridge.nav.broken" layer="npc" action="structure.tooltip.operate" width="16" height="16"> + <operate><dialogue section="medicom" id="broken" /></operate> + </object> + <area id="science1.bridge" name="colony_ship" x="-8" y="-8" width="32" height="25"> + <tiles id="desert.scorched" start="0" end="1" /> + <mine start="0" end="1" /><tiles id="empty" start="0" end="1" /> + <action> + for(x in 10...14) mine(x, 1); mine(13,2); for(y in 2...4) for(x in 7...13) mine(x, y); + mine(6, 3); for(x in 6...11) mine(x, 4); for(x in 8...11) mine(x, 5); for(x in 8...10) mine(x, 6); + </action> + <structure id="science1.bridge" x="0" y="8" /> + <object id="science1.bridge.exit" x="7" y="6" /> + <object id="science1.bridge.nav" x="5" y="4" /> + <object id="science1.bridge.nav.broken" x="6" y="2" /> + <object id="science1.bridge.nav.broken" x="11" y="4" /> + <object id="science1.bridge.nav.broken" x="14" y="1" /> + <light x="7" y="5" size="3" /><light x="7" y="6" size="3" /> + </area> +</data> \ No newline at end of file diff --git a/games/aground/data/core/science1/ship.png b/games/aground/data/core/science1/ship.png new file mode 100644 index 00000000..7c27dc80 Binary files /dev/null and b/games/aground/data/core/science1/ship.png differ diff --git a/games/aground/data/core/science1/structures/bridge.png b/games/aground/data/core/science1/structures/bridge.png new file mode 100644 index 00000000..30fefa2e Binary files /dev/null and b/games/aground/data/core/science1/structures/bridge.png differ diff --git a/games/aground/data/core/science1/structures/bridge.xml b/games/aground/data/core/science1/structures/bridge.xml new file mode 100644 index 00000000..1d43ec0c --- /dev/null +++ b/games/aground/data/core/science1/structures/bridge.xml @@ -0,0 +1,13 @@ +<tilesheet id='bridge.png' width='256' height='144'> + <image frame='0' x='0' y='0' width='255' height='142' offsetX='0' offsetY='1' /> + <image frame='1' x='255' y='0' width='1' height='1' offsetX='92' offsetY='73' /> + <image frame='5' x='255' y='1' width='5' height='5' offsetX='93' offsetY='68' /> + <image frame='6' x='255' y='6' width='7' height='6' offsetX='93' offsetY='68' /> + <image frame='7' x='255' y='12' width='20' height='19' offsetX='94' offsetY='58' /> + <image frame='8' x='260' y='1' width='6' height='5' offsetX='95' offsetY='69' /> + <image frame='9' x='255' y='31' width='15' height='20' offsetX='98' offsetY='58' /> + <image frame='10' x='266' y='1' width='2' height='2' offsetX='92' offsetY='72' /> + <image frame='2' equals='1' offsetX='92' offsetY='73' /> + <image frame='3' equals='1' offsetX='92' offsetY='73' /> + <image frame='4' equals='1' offsetX='92' offsetY='73' /> +</tilesheet> diff --git a/games/aground/data/core/science1/structures/crashed_ship.png b/games/aground/data/core/science1/structures/crashed_ship.png new file mode 100644 index 00000000..77e80885 Binary files /dev/null and b/games/aground/data/core/science1/structures/crashed_ship.png differ diff --git a/games/aground/data/core/science1/structures/dock.png b/games/aground/data/core/science1/structures/dock.png new file mode 100644 index 00000000..cee732d1 Binary files /dev/null and b/games/aground/data/core/science1/structures/dock.png differ diff --git a/games/aground/data/core/science1/structures/dock_front.png b/games/aground/data/core/science1/structures/dock_front.png new file mode 100644 index 00000000..f3f26049 Binary files /dev/null and b/games/aground/data/core/science1/structures/dock_front.png differ diff --git a/games/aground/data/core/science1/structures/elevator.png b/games/aground/data/core/science1/structures/elevator.png new file mode 100644 index 00000000..6a06cc66 Binary files /dev/null and b/games/aground/data/core/science1/structures/elevator.png differ diff --git a/games/aground/data/core/science1/structures/elevator_chain.png b/games/aground/data/core/science1/structures/elevator_chain.png new file mode 100644 index 00000000..6a1d8b48 Binary files /dev/null and b/games/aground/data/core/science1/structures/elevator_chain.png differ diff --git a/games/aground/data/core/science1/structures/elevator_winch.png b/games/aground/data/core/science1/structures/elevator_winch.png new file mode 100644 index 00000000..c53b8fc1 Binary files /dev/null and b/games/aground/data/core/science1/structures/elevator_winch.png differ diff --git a/games/aground/data/core/science1/structures/factory.png b/games/aground/data/core/science1/structures/factory.png new file mode 100644 index 00000000..58139dd6 Binary files /dev/null and b/games/aground/data/core/science1/structures/factory.png differ diff --git a/games/aground/data/core/science1/structures/food_market.png b/games/aground/data/core/science1/structures/food_market.png new file mode 100644 index 00000000..5be12cf6 Binary files /dev/null and b/games/aground/data/core/science1/structures/food_market.png differ diff --git a/games/aground/data/core/science1/structures/inn.png b/games/aground/data/core/science1/structures/inn.png new file mode 100644 index 00000000..8a666693 Binary files /dev/null and b/games/aground/data/core/science1/structures/inn.png differ diff --git a/games/aground/data/core/science1/structures/inn_door.png b/games/aground/data/core/science1/structures/inn_door.png new file mode 100644 index 00000000..b7be8992 Binary files /dev/null and b/games/aground/data/core/science1/structures/inn_door.png differ diff --git a/games/aground/data/core/science1/structures/light.png b/games/aground/data/core/science1/structures/light.png new file mode 100644 index 00000000..d0772fa4 Binary files /dev/null and b/games/aground/data/core/science1/structures/light.png differ diff --git a/games/aground/data/core/science1/structures/lights.png b/games/aground/data/core/science1/structures/lights.png new file mode 100644 index 00000000..0e13d646 Binary files /dev/null and b/games/aground/data/core/science1/structures/lights.png differ diff --git a/games/aground/data/core/science1/structures/lights.xml b/games/aground/data/core/science1/structures/lights.xml new file mode 100644 index 00000000..fa5d49a8 --- /dev/null +++ b/games/aground/data/core/science1/structures/lights.xml @@ -0,0 +1,5 @@ +<tilesheet id='lights.png' width='32' height='32'> + <image frame='0' x='0' y='0' width='24' height='14' offsetX='3' offsetY='0' /> + <image frame='1' x='0' y='14' width='26' height='7' offsetX='3' offsetY='0' /> + <image frame='2' x='0' y='21' width='32' height='14' offsetX='0' offsetY='0' /> +</tilesheet> diff --git a/games/aground/data/core/science1/structures/markets.png b/games/aground/data/core/science1/structures/markets.png new file mode 100644 index 00000000..46f49dbc Binary files /dev/null and b/games/aground/data/core/science1/structures/markets.png differ diff --git a/games/aground/data/core/science1/structures/medicom.png b/games/aground/data/core/science1/structures/medicom.png new file mode 100644 index 00000000..db37af01 Binary files /dev/null and b/games/aground/data/core/science1/structures/medicom.png differ diff --git a/games/aground/data/core/science1/structures/medivat.png b/games/aground/data/core/science1/structures/medivat.png new file mode 100644 index 00000000..787f0f99 Binary files /dev/null and b/games/aground/data/core/science1/structures/medivat.png differ diff --git a/games/aground/data/core/science1/structures/medivat.xml b/games/aground/data/core/science1/structures/medivat.xml new file mode 100644 index 00000000..aa6be639 --- /dev/null +++ b/games/aground/data/core/science1/structures/medivat.xml @@ -0,0 +1,18 @@ +<tilesheet id='medivat.png' width='32' height='32'> + <image frame='0' x='0' y='0' width='17' height='28' offsetX='0' offsetY='4' /> + <image frame='1' x='0' y='28' width='17' height='28' offsetX='0' offsetY='4' /> + <image frame='2' x='0' y='56' width='17' height='28' offsetX='0' offsetY='4' /> + <image frame='3' x='17' y='0' width='27' height='6' offsetX='0' offsetY='26' /> + <image frame='4' x='17' y='6' width='17' height='28' offsetX='0' offsetY='4' /> + <image frame='5' x='17' y='34' width='17' height='28' offsetX='0' offsetY='4' /> + <image frame='6' x='34' y='6' width='17' height='28' offsetX='0' offsetY='4' /> + <image frame='7' x='51' y='6' width='17' height='28' offsetX='0' offsetY='4' /> + <image frame='8' x='68' y='6' width='17' height='28' offsetX='0' offsetY='4' /> + <image frame='9' x='34' y='34' width='17' height='28' offsetX='0' offsetY='4' /> + <image frame='10' x='51' y='34' width='17' height='28' offsetX='0' offsetY='4' /> + <image frame='11' x='68' y='34' width='17' height='28' offsetX='0' offsetY='4' /> + <image frame='12' x='17' y='62' width='11' height='17' offsetX='2' offsetY='13' /> + <image frame='13' x='34' y='62' width='14' height='15' offsetX='1' offsetY='14' /> + <image frame='14' x='51' y='62' width='15' height='19' offsetX='0' offsetY='12' /> + <image frame='15' x='66' y='62' width='13' height='16' offsetX='1' offsetY='13' /> +</tilesheet> diff --git a/games/aground/data/core/science1/structures/minodoor.png b/games/aground/data/core/science1/structures/minodoor.png new file mode 100644 index 00000000..a70f70b1 Binary files /dev/null and b/games/aground/data/core/science1/structures/minodoor.png differ diff --git a/games/aground/data/core/science1/structures/operate.png b/games/aground/data/core/science1/structures/operate.png new file mode 100644 index 00000000..e23af49a Binary files /dev/null and b/games/aground/data/core/science1/structures/operate.png differ diff --git a/games/aground/data/core/science1/structures/operate.xml b/games/aground/data/core/science1/structures/operate.xml new file mode 100644 index 00000000..6a139d06 --- /dev/null +++ b/games/aground/data/core/science1/structures/operate.xml @@ -0,0 +1,39 @@ +<tilesheet id='operate.png' width='32' height='32'> + <image frame='0' x='0' y='0' width='32' height='18' offsetX='0' offsetY='14' /> + <image frame='1' x='0' y='18' width='32' height='30' offsetX='0' offsetY='2' /> + <image frame='2' x='32' y='18' width='32' height='30' offsetX='0' offsetY='2' /> + <image frame='3' x='64' y='18' width='32' height='30' offsetX='0' offsetY='2' /> + <image frame='4' x='0' y='48' width='32' height='30' offsetX='0' offsetY='2' /> + <image frame='5' x='0' y='78' width='32' height='30' offsetX='0' offsetY='2' /> + <image frame='6' x='0' y='108' width='32' height='30' offsetX='0' offsetY='2' /> + <image frame='7' x='32' y='48' width='32' height='30' offsetX='0' offsetY='2' /> + <image frame='8' x='64' y='48' width='32' height='30' offsetX='0' offsetY='2' /> + <image frame='9' x='32' y='78' width='32' height='30' offsetX='0' offsetY='2' /> + <image frame='10' x='32' y='108' width='32' height='30' offsetX='0' offsetY='2' /> + <image frame='11' x='64' y='78' width='32' height='30' offsetX='0' offsetY='2' /> + <image frame='12' x='64' y='108' width='32' height='30' offsetX='0' offsetY='2' /> + <image frame='13' x='32' y='0' width='22' height='10' offsetX='5' offsetY='3' /> + <image frame='14' x='54' y='0' width='22' height='10' offsetX='5' offsetY='3' /> + <image frame='15' x='76' y='0' width='22' height='10' offsetX='5' offsetY='3' /> + <image frame='16' x='96' y='18' width='23' height='10' offsetX='5' offsetY='3' /> + <image frame='17' x='96' y='28' width='23' height='10' offsetX='5' offsetY='3' /> + <image frame='18' x='96' y='38' width='23' height='10' offsetX='5' offsetY='3' /> + <image frame='19' x='96' y='48' width='22' height='11' offsetX='5' offsetY='3' /> + <image frame='20' x='96' y='59' width='23' height='10' offsetX='5' offsetY='3' /> + <image frame='21' x='96' y='78' width='23' height='11' offsetX='5' offsetY='3' /> + <image frame='22' x='96' y='89' width='22' height='10' offsetX='5' offsetY='3' /> + <image frame='23' x='96' y='108' width='23' height='10' offsetX='5' offsetY='3' /> + <image frame='24' x='96' y='118' width='23' height='10' offsetX='5' offsetY='3' /> + <image frame='25' x='32' y='10' width='21' height='8' offsetX='5' offsetY='3' /> + <image frame='26' x='54' y='10' width='21' height='8' offsetX='5' offsetY='3' /> + <image frame='27' x='76' y='10' width='21' height='8' offsetX='5' offsetY='3' /> + <image frame='28' x='98' y='0' width='21' height='8' offsetX='5' offsetY='3' /> + <image frame='29' x='96' y='69' width='22' height='8' offsetX='5' offsetY='3' /> + <image frame='30' x='98' y='8' width='21' height='2' offsetX='5' offsetY='3' /> + <image frame='31' x='98' y='10' width='21' height='2' offsetX='5' offsetY='3' /> + <image frame='32' x='98' y='12' width='21' height='2' offsetX='5' offsetY='3' /> + <image frame='34' x='98' y='14' width='20' height='2' offsetX='6' offsetY='3' /> + <image frame='35' x='98' y='16' width='20' height='2' offsetX='6' offsetY='3' /> + <image frame='33' equals='32' offsetX='5' offsetY='3' /> + <image frame='36' equals='34' offsetX='6' offsetY='3' /> +</tilesheet> diff --git a/games/aground/data/core/science1/structures/power_plant.png b/games/aground/data/core/science1/structures/power_plant.png new file mode 100644 index 00000000..c23123bc Binary files /dev/null and b/games/aground/data/core/science1/structures/power_plant.png differ diff --git a/games/aground/data/core/science1/structures/powerline1.png b/games/aground/data/core/science1/structures/powerline1.png new file mode 100644 index 00000000..61dd4ebe Binary files /dev/null and b/games/aground/data/core/science1/structures/powerline1.png differ diff --git a/games/aground/data/core/science1/structures/powerline2.png b/games/aground/data/core/science1/structures/powerline2.png new file mode 100644 index 00000000..6493d791 Binary files /dev/null and b/games/aground/data/core/science1/structures/powerline2.png differ diff --git a/games/aground/data/core/science1/structures/ship_crack1.png b/games/aground/data/core/science1/structures/ship_crack1.png new file mode 100644 index 00000000..8de8ffa2 Binary files /dev/null and b/games/aground/data/core/science1/structures/ship_crack1.png differ diff --git a/games/aground/data/core/science1/structures/ship_crack2.png b/games/aground/data/core/science1/structures/ship_crack2.png new file mode 100644 index 00000000..cc7ebf59 Binary files /dev/null and b/games/aground/data/core/science1/structures/ship_crack2.png differ diff --git a/games/aground/data/core/science1/structures/ship_door.png b/games/aground/data/core/science1/structures/ship_door.png new file mode 100644 index 00000000..2e0d605e Binary files /dev/null and b/games/aground/data/core/science1/structures/ship_door.png differ diff --git a/games/aground/data/core/science1/structures/ship_door_light.png b/games/aground/data/core/science1/structures/ship_door_light.png new file mode 100644 index 00000000..16241ac5 Binary files /dev/null and b/games/aground/data/core/science1/structures/ship_door_light.png differ diff --git a/games/aground/data/core/science1/structures/structures.xml b/games/aground/data/core/science1/structures/structures.xml new file mode 100644 index 00000000..eb25b075 --- /dev/null +++ b/games/aground/data/core/science1/structures/structures.xml @@ -0,0 +1,510 @@ +<?xml version="1.0" encoding="utf-8" ?> +<structures> + <quest id="bandits" exp="250" achievement="bandits"> + <kill id="bandit_heavy" name="quests.bandits" count="1" /> + <kill id="bandit_ranged" name="quests.bandits" count="1" /> + <kill id="bandit_combo" name="quests.bandits" count="1" /> + <kill id="bandit_knives" name="quests.bandits" count="1" /> + </quest> + <recipe id="sci1_coin_purse"><item id="sulfur" count="6" /></recipe> + <procedure id="sci1_coin_quest"> + <section if="player.getMaxCoins() == 0"> + <dialogue section="player" id="no_coin_purse" /> + <menu section="common" if="player.inventory.canCraft(player, getRecipe('sci1_coin_purse'))"> + <dialogue section="player" id="make_coin_purse" /> + <choice id="yes"> + <action>player.inventory.useIngredients(getRecipe('sci1_coin_purse'))</action> + <item id="coin_purse" value="0" /> + </choice> + <choice id="no" /> + </menu> + <stop /> + </section> + </procedure> + <procedure id="sci1_market"> + <choose> + <section if="isNight()"><dialogue section="market" id="closed" /><stop /></section> + <section if="!this.isPowered()"><dialogue section="market" id="no_power" /><stop /></section> + <section if="!player.hasQuest('bandits') && !getFlag('final_boss_defeat')"> + <dialogue section="player" id="bandits1" /> + <dialogue section="player" id="bandits2" /> + <quest id="bandits"> + <object id="bandit_knives" x="96+11" /> + <object id="bandit_ranged" x="96+10" /> + <object id="bandit_combo" x="96+12" /> + <object id="bandit_heavy" x="96+13" /> + </quest><stop /> + </section> + <section if="!player.questComplete('bandits') && player.canCompleteQuest('bandits')"> + <dialogue section="player" id="bandits3" /> + <complete quest="bandits" /> + <item id="coin_purse" value="200" modal="true" /><stop /> + </section> + <run procedure="sci1_coin_quest" /> + </choose> + </procedure> + + <animation id="inn.on" count="6" x="1" y="0" /> + <animation id="inn.off" count="1" x="0" y="0" /> + <animation id="inn.night.on" count="6" x="8" y="0" /> + <animation id="inn.night.off" count="1" x="7" y="0" /> + <tilesheet id="inn_door.png" width="24" height="23" /> + <tile id="inn_door" sheet="inn_door.png" x="0" y="0" /> + <animation id="inn_door.open"><frame visible="false" /></animation> + <animation id="inn_door.closing" count="6" shift="1" reverse="true"><frame visible="false" /></animation> + <animation id="inn_door.opening" count="6" shift="1"><frame visible="false" /></animation> + <structure id="inn" width="106" height="75" image="inn.png" powered="true" sleep="true" nightAnimation="inn.night"> + <tile id="inn_door" animation="inn_door.open" x="41/Tile.SIZE" y="52/Tile.SIZE" fps="10" /> + <operate> + <choose> + <section if="getFlag('inn_free') && this.isPowered() && !player.canCompleteQuest('mirrows')"> + <action>player.fullRestore();</action> + </section><choose> + <scene id="inn" show="first" with="fade" if="!getFlag('inn.first') || (!player.hasQuest('mirrows') && area.getStructureById('inn').isPowered())" showToAll="true" /> + <scene id="inn" show="mirrows" with="fade" if="!player.questComplete('mirrows') && player.hasQuest('mirrows') && player.canCompleteQuest('mirrows') && area.getStructureById('inn').isPowered()" showToAll="true" /> + <scene id="inn" show="inn" with="fade" /> + </choose> + </choose><save sleep="true" /> + </operate> + <over><action>var door = this.getTileById("inn_door"); if(door != null) door.playAnimation("inn_door.opening", false)</action></over> + <out><action>var door = this.getTileById("inn_door"); if(door != null) door.playAnimation("inn_door.closing", false)</action></out> + <light tile="light.small" color="e2dca7" offsetX="53" offsetY="14" ifAnim="inn.night.on" /> + <light tile="light.small" color="e2dca7" offsetX="52" offsetY="56" ifAnim="inn.night.on" /> + <light tile="light.small" color="e2dca7" offsetX="52" offsetY="66" ifAnim="inn.night.on" /> + </structure> + + <animation id="power_plant.off" count="1" x="1" y="0" /> + <animation id="power_plant.on" count="7" x="2" y="0" /> + + <recipe id="pp_fuel_coal" fuel="20" type="powerplant"><item id="coal" /></recipe> + <recipe id="pp_fuel_oil" fuel="200" type="powerplant"><item id="refined_oil" /></recipe> + <recipe id="pp_battery" creates="battery" type="powerplant"><item id="sulfur" /><item id="steel_bar" /></recipe> + + <structure id="power_plant" width="150" height="64" image="power_plant.png" type="powerplant"> + <recipe type="powerplant" /><animal id="adult_dragon" /> + <listItem icon="power" title="common.recharge_batteries" enabled="this.isPowered()" fail="warning.not_powered"> + <action>player.restorePowerFrom(this, 25)</action> + </listItem> + </structure> + + <animation id="damaged_power_plant.idle" count="1" x="0" y="0" /> + <structure id="damaged_power_plant" width="150" height="64" image="power_plant.png" /> + + <tilesheet id="powerline2.png" width="16" height="75" /> + <tile id="powerline2" sheet="powerline2.png" /> + <animation id="powerline1.disconnected"> + <frame visible="false" /><append tile="powerline2" /> + </animation> + <structure id="powerline1" width="56" height="75" image="powerline1.png" tileWidth="1" offsetX="20" type="powerline" color="474747" back="true" powered="true" destroyRemove="true"> + <line to="powerline" x="5" y="12" /><line to="structure" x="5" y="16" /> + </structure> + <structure id="powerline2" extends="powerline1" animation="powerline1" display="powerline1" /> + + <tilesheet id="dock.png" width="158" height="80" /> + <tile id="sci1.dock" sheet="dock.png" x="0" y="0" /> + <tilesheet id="dock_front.png" width="91" height="16" /> + <tile id="sci1.dock_front" sheet="dock_front.png" x="0" y="0" /> + <!--structure id="sci1.dock" extends="dock_base" tile="sci1.dock" offsetY="64" dockWidth="6" dockTopWidth="10" dockHeight="4"> + <tile id="sci1.dock_front" top="true" x="63/Tile.SIZE" y="0" /> + </structure--> + <structure id="sci1.dock_flip" extends="dock_base" tile="sci1.dock" offsetY="64" flip="true" dockWidth="6" dockTopWidth="10" dockHeight="4"> + <tile id="sci1.dock_front" top="true" x="63/Tile.SIZE" y="0" /> + </structure> + + <animation id="sci1.market.idle"> + <frame x="0" y="0" length="16" /> + <frame x="1" y="0" length="2" /> + </animation> + <animation id="sci1.market.talk" count="8" x="2" /> + <animation id="sci1.food_market.night.idle" count="1" x="10" /> + <structure id="sci1.food_market" width="41" height="50" image="food_market.png" type="market" animation="sci1.market" restock="5000" name="food_market" powered="true" show_offers="this.isPowered() && !isNight()" nightAnimation="sci1.food_market.night"> + <item id="red_berries" min="5" max="20" /> + <item id="ice_berries" min="5" max="20" /> + <item id="fruit" min="20" max="40" /> + <item id="sugar" min="10" max="20" /> + <item id="pig" min="0" max="1" /> + <item id="chicken" min="0" max="2" /> + <item id="cow" min="0" max="1" /> + <item id="pie" min="40" max="60" /> + <item id="toothfish" min="40" max="60" /> + <item id="steak" min="10" max="20" /> + <item id="bread" min="40" max="60" /> + <item id="pancakes" min="40" max="60" /> + <item id="hamburger" min="10" max="20" /> + <item id="pizza" min="10" max="20" /> + <item id="omelette" min="10" max="20" /> + <item id="cheeseburger" min="10" max="20" /> + <item id="cooking_oil" min="5" max="10" /> + <item id="cloth" min="20" max="40" /> + <item id="wheat_seed" min="2" max="4" /> + <item id="orchard_seed" min="2" max="4" /> + <item id="sugar_seed" min="1" max="1" /> + <item id="cotton_seed" min="1" max="1" /> + <item id="rice_seed" min="1" max="1" /> + <item id="bush_seed" min="0" max="1" /> + <item id="red_bush_seed" min="0" max="1" /> + <buy type="food" /><buy type="animal" /> + <over><action>this.loopAnimation("talk")</action></over> + <out><action>this.loopAnimation("idle")</action></out> + <operate><run procedure="sci1_market" /></operate> + </structure> + <tilesheet id="markets.png" width="46" height="50" /> + <tile id="sci1.weaps_market" sheet="markets.png" /> + <animation id="sci1.weaps_market.night.idle" count="1" x="10" /> + <structure id="sci1.weaps_market" tile="sci1.weaps_market" type="market" animation="sci1.market" restock="5000" name="weaps_market" powered="true" show_offers="this.isPowered() && !isNight()" nightAnimation="sci1.weaps_market.night"> + <item id="mega_backpack" min="1" max="1" achievement="bigpack" if="true" /> + <item id="ultra_backpack" min="1" max="1" if="true" /> + <item id="revolver" min="1" max="1" /> + <item id="shotgun" min="1" max="1" /> + <item id="bullet" min="20" max="40" /> + <item id="shell" min="10" max="20" /> + <item id="steel_pickaxe" min="1" max="1" /> + <item id="steel_axe" min="1" max="1" /> + <item id="steel_hammer" min="1" max="1" /> + <item id="steel_sword" min="1" max="1" /> + <item id="steel_armor" min="1" max="1" /> + <item id="kite_shield" min="1" max="1" /> + <item id="net" min="10" max="15" /> + <item id="trap" min="5" max="10" /> + <item id="map" min="1" max="1" if="player.getItemCount('map') == 0" /> + <item id="clock" min="1" max="1" if="player.getItemCount('clock') == 0" /> + <buy type="equipment" /><buy type="tool" /><buy type="object" /> + <over><action>this.loopAnimation("talk")</action></over> + <out><action>this.loopAnimation("idle")</action></out> + <operate><run procedure="sci1_market" /></operate> + </structure> + <tile id="sci1.mineral_market" sheet="markets.png" x="11" /> + <animation id="sci1.mineral_market.idle" equals="sci1.market.idle" /> + <animation id="sci1.mineral_market.talk" count="8" x="8" /> + <animation id="sci1.mineral_market.open" count="6" x="2" /> + <animation id="sci1.mineral_market.close" count="6" x="2" reverse="true" /> + <animation id="sci1.mineral_market.night.idle" count="1" x="16" /> + <structure id="sci1.mineral_market" tile="sci1.mineral_market" type="market" restock="5000" name="mineral_market" powered="true" show_offers="this.isPowered() && !isNight()" nightAnimation="sci1.mineral_market.night"> + <item id="wood" min="10" max="30" /> + <item id="coal" min="10" max="20" /> + <item id="iron" min="10" max="30" /> + <item id="quartz" min="5" max="5" /> + <item id="gold" min="5" max="5" /> + <item id="diamond" min="5" max="5" /> + <item id="iron_bar" min="5" max="5" /> + <item id="steel_bar" min="5" max="5" /> + <item id="sulfur" min="10" max="20" /> + <item id="refined_oil" min="5" max="5" /> + <buy type="resource" /> + <over><play object="this" animation="open" /><action>this.loopAnimation("talk")</action></over> + <out><play object="this" animation="close" /><action>this.loopAnimation("idle")</action></out> + <operate><run procedure="sci1_market" /></operate> + </structure> + + <animation id="elevator.idle" count="3" x="0" /> + <structure id="elevator" type="elevator" width="55" height="40" image="elevator_winch.png" tileWidth="3" powered="true" speed="2" includeInventory="true" priority="-1" only_select="true" sfx="elevator" saveItems="true"> + <chain image="elevator_chain.png" offsetX="26" offsetY="13" /> + <lift image="elevator.png" offsetX="19" floor="27" /> + <powerline x="36" y="4" /> + <operate><window type="storehouse" inventory="this.inventory" title="structure.elevator" includeStorehouse="this.elevator_dy == 0" /></operate> + </structure> + + <animation id="warehouse.idle" equals="single" /> + <animation id="warehouse.closing" count="7" reverse="true" /> + <animation id="warehouse.opening" count="7" /> + <structure id="warehouse" width="125" height="80" image="warehouse.png" type="storehouse" main="true" title="common.warehouse"> + <tooltip section="actions" id="build" if="player.getCenterX()-this.xPos > 90" /> + <tooltip id="warehouse" /> + <operate> + <action if="!player.hasItemStorehouse('stone_pickaxe')">this.inventory.addItems(Item.get("stone_pickaxe"), 1)</action> + <action if="!player.hasItemStorehouse('stone_axe')">this.inventory.addItems(Item.get("stone_axe"), 1)</action> + <section if="player.getCenterX()-this.xPos > 90"> + <window type="craft" includeStorehouse="true" spawnX="this.tile_x+9"><recipe id="boat" /><recipe type="dock" /></window><stop /> + </section> + </operate> + </structure> + <structure id="warehouse_flipped" width="125" height="80" image="warehouse.png" animation="warehouse" type="storehouse" main="true" display="warehouse" title="common.warehouse" flip="true"> + <tooltip section="actions" id="build" if="player.getCenterX()-this.xPos < 35" /> + <tooltip id="warehouse" /> + <operate> + <action if="!player.hasItemStorehouse('stone_pickaxe')">this.inventory.addItems(Item.get("stone_pickaxe"), 1)</action> + <action if="!player.hasItemStorehouse('stone_axe')">this.inventory.addItems(Item.get("stone_axe"), 1)</action> + <section if="player.getCenterX()-this.xPos < 35"> + <window type="craft" includeStorehouse="true" spawnX="this.tile_x-4"><recipe id="boat" /><recipe type="dock" /></window><stop /> + </section> + </operate> + </structure> + + <recipe id="craft_drill" creates="drill" type="factory"> + <item id="silicon" count="1" /> + <item id="steel_bar" count="3" /> + </recipe> + <recipe id="craft_chainsaw" creates="chainsaw" type="factory"> + <item id="silicon" count="2" /> + <item id="steel_bar" count="4" /> + <item id="refined_oil" count="2" /> + </recipe> + <recipe id="craft_titanium_armor" creates="titanium_armor" type="factory"> + <type id="tech_resource" /> + <item id="titanium" count="4" /> + </recipe> + <recipe id="craft_revolver" creates="revolver" type="factory"> + <item id="steel_bar" count="2" /> + <item id="wood" count="1" /> + </recipe> + <recipe id="craft_shotgun" creates="shotgun" type="factory"> + <item id="steel_bar" count="3" /> + </recipe> + <recipe id="craft_bullet" creates="bullet" count="4" type="factory"> + <item id="sulfur" count="1" /> + <item id="iron" count="1" /> + </recipe> + <recipe id="craft_shell" creates="shell" count="2" type="factory"> + <item id="sulfur" count="1" /> + <item id="iron" count="2" /> + </recipe> + <recipe id="craft_headlamp" creates="headlamp" type="factory"> + <item id="silicon" count="1" /> + <item id="steel_bar" count="1" /> + <item id="cloth" count="1" /> + </recipe> + <recipe id="craft_landmine" creates="landmine" type="factory"> + <item id="sulfur" count="2" /> + <item id="steel_bar" count="1" /> + <item id="silicon" count="1" /> + </recipe> + <recipe id="craft_bandage" creates="bandage" type="factory"> + <item id="cloth" count="2" /> + </recipe> + <recipe id="craft_silicon" creates="silicon" type="factory"> + <type id="tech_resource" /> + <item id="quartz" count="1" /> + </recipe> + <recipe id="refine_oil" creates="refined_oil" type="factory"> + <item id="oil" count="2" /> + </recipe> + <recipe id="craft_tent" creates="tent" type="factory"> + <item id="cloth" count="10" /> + <item id="net" count="5" /> + <item id="yeti_fur" count="5" /> + </recipe> + <recipe id="craft_ship_chest" creates="chest" type="factory"> + <parameter id="t" value="ship_chest.ico" /><parameter id="a" value="ship_chest" /> + <item id="chest" count="1" /> + <item id="titanium" count="1" /> + </recipe> + + <tilesheet id="factory.png" width="106" height="80" /><tile id="factory" sheet="factory.png" /> + <animation id="factory.off" count="1" x="3" /> + <animation id="factory.on" equals="factory.off" /> + <animation id="factory.operate" count="4" x="4" /> + <animation id="factory.open" count="4" x="8" /> + <animation id="factory.open.noflash" count="3" x="0" reverse="true" /> + <animation id="factory.close" count="3" x="0" /> + <tile id="factory_lights" sheet="factory.png" x="12" /> + <structure id="factory" tile="factory" powered="true" type="crafting"> + <recipe type="spfactory" /> + <recipe type="factory" /> + <recipe type="net" /> + <recipe type="workshop" /> + <recipe type="smelter" /> + <recipe type="workbench" /> + <over><play object="this" animation="allowFlash()?'open':'open.noflash'" /><action>this.loopAnimation("operate")</action></over> + <out><play object="this" animation="close" /><action>this.loopAnimation("idle")</action></out> + <operate><section if="!this.isPowered()"><dialogue section="warning" id="not_powered" /><stop /></section></operate> + <light tile="factory_lights" offsetX="53" offsetY="56" linkAnim="true" /> + </structure> + + <structure id="crashed_ship" width="512" height="388" image="crashed_ship.png" priority="-2" behind="true" remove="false" /> + <animation id="crashed_ship.door.opening" count="4" /> + <animation id="crashed_ship.door.closing" count="4" reverse="true" /> + + <tilesheet id="ship_door_light.png" width="35" height="43" /> + <tile id="ship_door_light" sheet="ship_door_light.png" x="0" y="0" /> + <animation id="ship_door_light"> + <frame x="0" offsetX="41" offsetY="30" /> + <frame x="1" offsetX="44" offsetY="34" /> + <frame x="2" offsetX="35" offsetY="15" /> + <frame x="3" offsetX="35" offsetY="15" /> + <frame x="4" offsetX="35" offsetY="15" /> + <frame x="5" offsetX="41" offsetY="24" /> + </animation> + <tilesheet id="ship_door.png" width="31" height="33" /><tile id="ship_door" sheet="ship_door.png" /> + <structure id="crashed_ship.door.locked" tile="ship_door" /> + <structure id="crashed_ship.door" tile="ship_door" name="enter"> + <operate><choose> + <scene id="mirrows" show="intro" with="fade" if="!getFlag('mirrow.defeat')" /> + <teleport area="mirrows_lab" x="20.5" y="9" allowReturn="true" with="ellipse" /> + </choose></operate> + <tile id="ship_door_light" animation="ship_door_light" fps="12" x="-3" y="-2.875" glow="true" /> + </structure> + <structure id="crashed_ship.door.exit" tile="ship_door" behind="true" remove="false"> + <tooltip id="enter" if="getFlag('mirrow.defeat')" /> + <operate><return with="ellipse" if="getFlag('mirrow.defeat')" /></operate> + <over><action if="getFlag('mirrow.defeat') && this.renderer != null">this.renderer.playAnimation("crashed_ship.door.opening", false)</action></over> + <out><action if="getFlag('mirrow.defeat') && this.renderer != null">this.renderer.playAnimation("crashed_ship.door.closing", false)</action></out> + </structure> + <structure id="science1.bridge.entrance" tile="ship_door" behind="true" remove="false"> + <tooltip id="enter" if="getFlag('mirrow.defeat') && player.areas.exists('mirrows_lab')" /> + <operate><teleport area="science1.bridge" x="8" y="5.5" with="ellipse" if="getFlag('mirrow.defeat') && player.areas.exists('mirrows_lab')" /></operate> + <over><action if="getFlag('mirrow.defeat') && this.renderer != null && player.areas.exists('mirrows_lab')">this.renderer.playAnimation("crashed_ship.door.opening", false)</action></over> + <out><action if="getFlag('mirrow.defeat') && this.renderer != null && player.areas.exists('mirrows_lab')">this.renderer.playAnimation("crashed_ship.door.closing", false)</action></out> + </structure> + + <tilesheet id="ship_crack1.png" width="89" height="93" /> + <tile id="crashed_ship.crack1" sheet="ship_crack1.png" x="0" y="0" /> + <structure id="crashed_ship.crack1.ret" tile="crashed_ship.crack1" name="enter" miningVehicle="true"> + <operate><teleport area="science1" x="55.5-((player.vehicle == null)?player._width:player.vehicle._width)/(Tile.SIZE*2)" y="12" with="ellipse" /> + <dig x="player.tile_x" y="player.tile_y" speed="2" if="player.vehicle==null" /></operate> + </structure> + <structure id="crashed_ship.crack1" tile="crashed_ship.crack1" name="enter" miningVehicle="true"> + <operate><teleport area="crashed_ship.cave1" x="33.5-((player.vehicle == null)?player._width:player.vehicle._width)/(Tile.SIZE*2)" y="21" with="ellipse" /></operate> + </structure> + + <tilesheet id="ship_crack2.png" width="58" height="71" /> + <tile id="crashed_ship.crack2" sheet="ship_crack2.png" x="0" y="0" /> + <structure id="crashed_ship.crack2.ret" tile="crashed_ship.crack2" name="enter"> + <operate><return with="ellipse" /></operate> + </structure> + <structure id="crashed_ship.crack2" tile="crashed_ship.crack2" name="enter"> + <operate><teleport area="crashed_ship.cave2" x="4" y="23" allowReturn="true" with="ellipse" /></operate> + </structure> + + <include id="medivat.xml" includeRoot="true" /> + <tile id="medivat" sheet="medivat.png" x="0" y="0" /> + <tile id="medivat.mutant1" sheet="medivat.png" x="12" /> + <tile id="medivat.mutant2" sheet="medivat.png" x="13" /> + <tile id="medivat.mutant3" sheet="medivat.png" x="14" /> + <tile id="medivat.mutant4" sheet="medivat.png" x="15" /> + <animation id="medivat1.idle" x="0" count="1" /> + <animation id="medivat2.idle" x="1" count="1" /> + <animation id="medivat3.idle" x="2" count="1" /> + <animation id="medivat4.idle" x="3" count="1" /> + <animation id="medivat.idle" x="4" count="8" glow="true" /> + <structure id="medivat1" tile="medivat" behind="true" remove="false" /> + <structure id="medivat2" tile="medivat" behind="true" remove="false" /> + <structure id="medivat3" tile="medivat" behind="true" remove="false" /> + <structure id="medivat4" tile="medivat" behind="true" remove="false" /> + <structure id="medivat.full1" tile="medivat" animation="medivat" behind="true" remove="false"><tile id="medivat.mutant1" behind="true" glow="true" offsetY="1" /></structure> + <structure id="medivat.full2" tile="medivat" animation="medivat" behind="true" remove="false"><tile id="medivat.mutant2" behind="true" glow="true" offsetY="1" /></structure> + <structure id="medivat.full3" tile="medivat" animation="medivat" behind="true" remove="false"><tile id="medivat.mutant3" behind="true" glow="true" offsetY="1" /></structure> + <structure id="medivat.full4" tile="medivat" animation="medivat" behind="true" remove="false"><tile id="medivat.mutant4" behind="true" glow="true" offsetY="1" /></structure> + + <animation id="medicom.idle" count="8" glow="true" /> + <structure id="medicom" width="11" height="12" image="medicom.png" name="read" type="dialogue"> + <afterRead> + <set id="ct" value="0" /> + <action>for(i in 1...16) if(getFlag('medicom.panel'+i+'.read')) ct++;</action> + <achievement id="medicom" if="ct == 15" /> + </afterRead> + </structure> + + <include id="operate.xml" includeRoot="true" /> + <tile id="operation_table" sheet="operate.png" /> + <animation id="operation_table.idle" count="1" glow="true" /> + <animation id="operation_table.hud" x="13" count="12" glow="true"><frame x="25" count="12" glow="true" /></animation> + <animation id="operation_table.active" x="1" count="12" repeat="2" glow="true"> + <append tile="operation_table" animation="operation_table.hud" /> + </animation> + <recipe id="machine_gun_arm" creates="machine_gun_arm" type="operation_table"> + <item id="steel_bar" count="2" /><item id="titanium" count="1" /> + </recipe> + <recipe id="cyborg_body" creates="cyborg_body" type="operation_table"> + <item id="titanium_armor" count="1" /> + <item id="silicon" count="1" /> + <item id="dragonblood" count="2" /> + </recipe> + <recipe id="cyborg_eye" creates="cyborg_eye" type="operation_table"> + <item id="titanium" count="1" /><item id="silicon" count="2" /> + </recipe> + <recipe id="cyborg_back" creates="cyborg_back" type="operation_table"> + <item id="titanium" count="4" /> + <item id="silicon" count="1" /> + <item id="uranium" count="1" /> + </recipe> + <recipe id="diode_wolf" creates="diode_wolf" type="operation_recipes"> + <item id="wolf" count="1" /><item id="silicon" count="1" /><item id="battery" count="2" /> + </recipe> + <recipe id="steel_wyrm" creates="steel_wyrm" type="operation_recipes"> + <item id="wyrm" count="1" /><item id="silicon" count="1" /><item id="uranium" count="2" /><item id="steel_bar" count="9" /> + </recipe> + <structure id="operation_table" tile="operation_table" behind="true" type="equipment" title="structure.tooltip.operate_self" craftTitle="structure.tooltip.operate_other"> + <tooltip id="operate" if="getFlag('mirrow.defeat')" /> + <equipment type="operation_table" /> + <recipe type="operation_recipes" /> + <selfItem icon="blood.ico" title="structure.change_appearance"> + <window type="character" title="structure.change_appearance" /> + </selfItem> + <operate> + <section if="player.info.id != 'player.ancient'"> + <dialogue section="warning" id="operation_table_inhuman" /> + <window type="craft" includeStorehouse="true" title="structure.tooltip.operate"> + <listItem icon="blood.ico" title="structure.change_appearance"> + <window type="character" title="structure.change_appearance" /> + </listItem> + <recipe type="operation_recipes" /> + </window><stop /> + </section> + </operate> + <over><action if="getFlag('mirrow.defeat')">this.loopAnimation("active")</action></over> + <out><action>this.loopAnimation("idle")</action></out> + </structure> + + <include id="lights.xml" includeRoot="true" /> + <tile id="sci1.lights" sheet="lights.png" /> + <tilesheet id="light.png" width="72" height="32" /> + <tile id="sci1.light" sheet="light.png" /> + <animation id="sci1.light.broken.idle" x="0" count="1" glow="true" /> + <structure id="sci1.light.broken" tile="sci1.lights" remove="false" /> + <animation id="sci1.light.off.idle" x="1" count="1" glow="true" /> + <structure id="sci1.light.off" tile="sci1.lights" remove="false" /> + <animation id="sci1.light.idle" x="2" count="1" glow="true" /> + <structure id="sci1.light" tile="sci1.lights" remove="false"> + <light tile="sci1.light" color="fdf697" offsetX="16" offsetY="16" /> + </structure> + + <animal id="diode_wolf"> + <farmable item="sulfur" min="1" max="3" time="50" /> + <tile id="diode_wolf" animation="diode_wolf.idle" x="-0.5" y="-0.875" /> + </animal> + <animal id="steel_wyrm"> + <farmable item="uranium" min="1" max="1" time="200" /> + <tile id="steel_wyrm" animation="steel_wyrm.attack" x="-0.5" y="-0.875" /> + </animal> + <structure id="diode_wolf_pen" tile="cage" animals="1" type="pen" name="cage"> + <sprite> + <animal i="0" offsetX="21" offsetY="21" /> + <tile x="0" y="0" /> + </sprite> + <animal id="diode_wolf" /> + </structure> + <animal id="golem"> + <farmable item="coal" min="2" max="5" time="20" /> + <farmable item="iron" min="1" max="1" time="20" /> + <tile id="golem" animation="golem.idle" x="-0.5" y="-0.875" /> + </animal> + <animal id="gold_golem"> + <farmable item="gold" min="1" max="1" time="30" /> + <tile id="golem" animation="gold_golem" x="-0.5" y="-0.875" /> + </animal> + <animal id="purple_golem"> + <farmable item="focus_gem" min="2" max="5" time="40" /> + <farmable item="blood_gem" min="1" max="1" time="40" /> + <tile id="golem" animation="purple_golem" x="-0.5" y="-0.875" /> + </animal> + + <animation id="minodoor.opening" count="6" /> + <animation id="minodoor.closing" count="6" reverse="true" /> + <structure id="minodoor" width="32" height="32" image="minodoor.png" name="enter" type="door"> + <operate><section if="this.area_id == 'labyrinth_end'"><setTime value="20" /><achievement id="labyrinth" /></section></operate> + </structure> + <structure id="minodoor_exit" width="32" height="32" image="minodoor.png" name="enter" animation="minodoor"> + <operate> + <section with="ellipse" ><set id="minodoor" value="player.areas.get('science1').getStructureById('minodoor')" /> + <teleport area="science1" x="minodoor.tile_x" y="minodoor.tile_y" /><dig x="player.tile_x" y="player.tile_y" speed="2" /></section> + </operate> + </structure> + + <include id="bridge.xml" includeRoot="true" /> + <tile id="science1.bridge" sheet="bridge.png" /> + <animation id="science1.bridge.nav_com" x="1" count="10" /> + <animation id="science1.bridge.idle" x="0" count="1" length="10"> + <append tile="science1.bridge" animation="science1.bridge.nav_com" /> + </animation> + <structure id="science1.bridge" tile="science1.bridge" behind="true" remove="false" allowSpawn="true" /> +</structures> \ No newline at end of file diff --git a/games/aground/data/core/science1/structures/warehouse.png b/games/aground/data/core/science1/structures/warehouse.png new file mode 100644 index 00000000..3a050749 Binary files /dev/null and b/games/aground/data/core/science1/structures/warehouse.png differ diff --git a/games/aground/data/core/science1/water_cave.png b/games/aground/data/core/science1/water_cave.png new file mode 100644 index 00000000..dd50a34e Binary files /dev/null and b/games/aground/data/core/science1/water_cave.png differ diff --git a/games/aground/data/core/science1/water_cave.xml b/games/aground/data/core/science1/water_cave.xml new file mode 100644 index 00000000..f2a4c0d5 --- /dev/null +++ b/games/aground/data/core/science1/water_cave.xml @@ -0,0 +1,17 @@ +<tilesheet id='water_cave.png' width='64' height='112'> + <image frame='0' x='0' y='0' width='46' height='72' offsetX='14' offsetY='28' /> + <image frame='1' x='0' y='72' width='47' height='76' offsetX='13' offsetY='16' /> + <image frame='2' x='46' y='0' width='27' height='56' offsetX='33' offsetY='28' /> + <image frame='3' x='0' y='148' width='29' height='79' offsetX='29' offsetY='18' /> + <image frame='4' x='73' y='0' width='36' height='47' offsetX='22' offsetY='49' /> + <image frame='5' x='109' y='0' width='36' height='50' offsetX='22' offsetY='39' /> + <image frame='6' x='145' y='0' width='37' height='66' offsetX='22' offsetY='30' /> + <image frame='7' x='182' y='0' width='34' height='63' offsetX='24' offsetY='24' /> + <image frame='8' x='47' y='72' width='46' height='85' offsetX='14' offsetY='11' /> + <image frame='9' x='0' y='227' width='45' height='55' offsetX='14' offsetY='32' /> + <image frame='10' x='47' y='157' width='43' height='73' offsetX='14' offsetY='24' /> + <image frame='11' x='47' y='230' width='46' height='77' offsetX='12' offsetY='14' /> + <image frame='12' x='93' y='72' width='83' height='112' offsetX='0' offsetY='0' /> + <image frame='13' x='176' y='72' width='64' height='112' offsetX='64' offsetY='0' /> + <image frame='14' x='93' y='184' width='63' height='112' offsetX='64' offsetY='0' /> +</tilesheet> diff --git a/games/aground/data/core/sound/achievement.ogg b/games/aground/data/core/sound/achievement.ogg new file mode 100644 index 00000000..76451614 Binary files /dev/null and b/games/aground/data/core/sound/achievement.ogg differ diff --git a/games/aground/data/core/sound/alien_death.ogg b/games/aground/data/core/sound/alien_death.ogg new file mode 100644 index 00000000..c8d51502 Binary files /dev/null and b/games/aground/data/core/sound/alien_death.ogg differ diff --git a/games/aground/data/core/sound/ancient_axe.ogg b/games/aground/data/core/sound/ancient_axe.ogg new file mode 100644 index 00000000..4a1af76e Binary files /dev/null and b/games/aground/data/core/sound/ancient_axe.ogg differ diff --git a/games/aground/data/core/sound/arrow_hit.ogg b/games/aground/data/core/sound/arrow_hit.ogg new file mode 100644 index 00000000..fb4c69ab Binary files /dev/null and b/games/aground/data/core/sound/arrow_hit.ogg differ diff --git a/games/aground/data/core/sound/attack.ogg b/games/aground/data/core/sound/attack.ogg new file mode 100644 index 00000000..3338052b Binary files /dev/null and b/games/aground/data/core/sound/attack.ogg differ diff --git a/games/aground/data/core/sound/axe.ogg b/games/aground/data/core/sound/axe.ogg new file mode 100644 index 00000000..99d3def8 Binary files /dev/null and b/games/aground/data/core/sound/axe.ogg differ diff --git a/games/aground/data/core/sound/axe_tree.ogg b/games/aground/data/core/sound/axe_tree.ogg new file mode 100644 index 00000000..1037d35c Binary files /dev/null and b/games/aground/data/core/sound/axe_tree.ogg differ diff --git a/games/aground/data/core/sound/bandit_combo_death.ogg b/games/aground/data/core/sound/bandit_combo_death.ogg new file mode 100644 index 00000000..9575a6e3 Binary files /dev/null and b/games/aground/data/core/sound/bandit_combo_death.ogg differ diff --git a/games/aground/data/core/sound/bandit_heavy_death.ogg b/games/aground/data/core/sound/bandit_heavy_death.ogg new file mode 100644 index 00000000..3f0677be Binary files /dev/null and b/games/aground/data/core/sound/bandit_heavy_death.ogg differ diff --git a/games/aground/data/core/sound/bandit_knives_death.ogg b/games/aground/data/core/sound/bandit_knives_death.ogg new file mode 100644 index 00000000..1390c478 Binary files /dev/null and b/games/aground/data/core/sound/bandit_knives_death.ogg differ diff --git a/games/aground/data/core/sound/bandit_knives_hit1.ogg b/games/aground/data/core/sound/bandit_knives_hit1.ogg new file mode 100644 index 00000000..8d670092 Binary files /dev/null and b/games/aground/data/core/sound/bandit_knives_hit1.ogg differ diff --git a/games/aground/data/core/sound/bandit_knives_hit2.ogg b/games/aground/data/core/sound/bandit_knives_hit2.ogg new file mode 100644 index 00000000..96fa7d1d Binary files /dev/null and b/games/aground/data/core/sound/bandit_knives_hit2.ogg differ diff --git a/games/aground/data/core/sound/bandit_knives_slash.ogg b/games/aground/data/core/sound/bandit_knives_slash.ogg new file mode 100644 index 00000000..4f2bf03e Binary files /dev/null and b/games/aground/data/core/sound/bandit_knives_slash.ogg differ diff --git a/games/aground/data/core/sound/bandit_knives_throw1.ogg b/games/aground/data/core/sound/bandit_knives_throw1.ogg new file mode 100644 index 00000000..bc2cf0a5 Binary files /dev/null and b/games/aground/data/core/sound/bandit_knives_throw1.ogg differ diff --git a/games/aground/data/core/sound/bandit_knives_throw2.ogg b/games/aground/data/core/sound/bandit_knives_throw2.ogg new file mode 100644 index 00000000..95ba6986 Binary files /dev/null and b/games/aground/data/core/sound/bandit_knives_throw2.ogg differ diff --git a/games/aground/data/core/sound/bandit_knives_throw3.ogg b/games/aground/data/core/sound/bandit_knives_throw3.ogg new file mode 100644 index 00000000..ca6820fa Binary files /dev/null and b/games/aground/data/core/sound/bandit_knives_throw3.ogg differ diff --git a/games/aground/data/core/sound/bandit_ranged_attack.ogg b/games/aground/data/core/sound/bandit_ranged_attack.ogg new file mode 100644 index 00000000..1960f3cc Binary files /dev/null and b/games/aground/data/core/sound/bandit_ranged_attack.ogg differ diff --git a/games/aground/data/core/sound/bandit_ranged_death.ogg b/games/aground/data/core/sound/bandit_ranged_death.ogg new file mode 100644 index 00000000..79b1fcee Binary files /dev/null and b/games/aground/data/core/sound/bandit_ranged_death.ogg differ diff --git a/games/aground/data/core/sound/bandit_ranged_hit.ogg b/games/aground/data/core/sound/bandit_ranged_hit.ogg new file mode 100644 index 00000000..aedb16c0 Binary files /dev/null and b/games/aground/data/core/sound/bandit_ranged_hit.ogg differ diff --git a/games/aground/data/core/sound/bark1.ogg b/games/aground/data/core/sound/bark1.ogg new file mode 100644 index 00000000..ee01be1f Binary files /dev/null and b/games/aground/data/core/sound/bark1.ogg differ diff --git a/games/aground/data/core/sound/bark2.ogg b/games/aground/data/core/sound/bark2.ogg new file mode 100644 index 00000000..ee3001b8 Binary files /dev/null and b/games/aground/data/core/sound/bark2.ogg differ diff --git a/games/aground/data/core/sound/blocked.ogg b/games/aground/data/core/sound/blocked.ogg new file mode 100644 index 00000000..d26255bf Binary files /dev/null and b/games/aground/data/core/sound/blocked.ogg differ diff --git a/games/aground/data/core/sound/boar_attack.ogg b/games/aground/data/core/sound/boar_attack.ogg new file mode 100644 index 00000000..623918c8 Binary files /dev/null and b/games/aground/data/core/sound/boar_attack.ogg differ diff --git a/games/aground/data/core/sound/boar_death1.ogg b/games/aground/data/core/sound/boar_death1.ogg new file mode 100644 index 00000000..de28fab7 Binary files /dev/null and b/games/aground/data/core/sound/boar_death1.ogg differ diff --git a/games/aground/data/core/sound/boar_death2.ogg b/games/aground/data/core/sound/boar_death2.ogg new file mode 100644 index 00000000..b81c2ea4 Binary files /dev/null and b/games/aground/data/core/sound/boar_death2.ogg differ diff --git a/games/aground/data/core/sound/boar_death3.ogg b/games/aground/data/core/sound/boar_death3.ogg new file mode 100644 index 00000000..6fda201e Binary files /dev/null and b/games/aground/data/core/sound/boar_death3.ogg differ diff --git a/games/aground/data/core/sound/bolt_hit.ogg b/games/aground/data/core/sound/bolt_hit.ogg new file mode 100644 index 00000000..f395a861 Binary files /dev/null and b/games/aground/data/core/sound/bolt_hit.ogg differ diff --git a/games/aground/data/core/sound/bow.ogg b/games/aground/data/core/sound/bow.ogg new file mode 100644 index 00000000..b739ab59 Binary files /dev/null and b/games/aground/data/core/sound/bow.ogg differ diff --git a/games/aground/data/core/sound/build.ogg b/games/aground/data/core/sound/build.ogg new file mode 100644 index 00000000..220b64a4 Binary files /dev/null and b/games/aground/data/core/sound/build.ogg differ diff --git a/games/aground/data/core/sound/bullet.ogg b/games/aground/data/core/sound/bullet.ogg new file mode 100644 index 00000000..b36e55d2 Binary files /dev/null and b/games/aground/data/core/sound/bullet.ogg differ diff --git a/games/aground/data/core/sound/buy.ogg b/games/aground/data/core/sound/buy.ogg new file mode 100644 index 00000000..9f447a25 Binary files /dev/null and b/games/aground/data/core/sound/buy.ogg differ diff --git a/games/aground/data/core/sound/cancel.ogg b/games/aground/data/core/sound/cancel.ogg new file mode 100644 index 00000000..cf9c7eb8 Binary files /dev/null and b/games/aground/data/core/sound/cancel.ogg differ diff --git a/games/aground/data/core/sound/chainsaw.ogg b/games/aground/data/core/sound/chainsaw.ogg new file mode 100644 index 00000000..583949e1 Binary files /dev/null and b/games/aground/data/core/sound/chainsaw.ogg differ diff --git a/games/aground/data/core/sound/chest_open.ogg b/games/aground/data/core/sound/chest_open.ogg new file mode 100644 index 00000000..1e8a969d Binary files /dev/null and b/games/aground/data/core/sound/chest_open.ogg differ diff --git a/games/aground/data/core/sound/crawler_attack1.ogg b/games/aground/data/core/sound/crawler_attack1.ogg new file mode 100644 index 00000000..25344d70 Binary files /dev/null and b/games/aground/data/core/sound/crawler_attack1.ogg differ diff --git a/games/aground/data/core/sound/crawler_attack2.ogg b/games/aground/data/core/sound/crawler_attack2.ogg new file mode 100644 index 00000000..ba2f2d74 Binary files /dev/null and b/games/aground/data/core/sound/crawler_attack2.ogg differ diff --git a/games/aground/data/core/sound/crawler_death1.ogg b/games/aground/data/core/sound/crawler_death1.ogg new file mode 100644 index 00000000..01aebf03 Binary files /dev/null and b/games/aground/data/core/sound/crawler_death1.ogg differ diff --git a/games/aground/data/core/sound/crawler_death2.ogg b/games/aground/data/core/sound/crawler_death2.ogg new file mode 100644 index 00000000..7670306f Binary files /dev/null and b/games/aground/data/core/sound/crawler_death2.ogg differ diff --git a/games/aground/data/core/sound/cyborg_death.ogg b/games/aground/data/core/sound/cyborg_death.ogg new file mode 100644 index 00000000..d00066b4 Binary files /dev/null and b/games/aground/data/core/sound/cyborg_death.ogg differ diff --git a/games/aground/data/core/sound/death.ogg b/games/aground/data/core/sound/death.ogg new file mode 100644 index 00000000..4a3919df Binary files /dev/null and b/games/aground/data/core/sound/death.ogg differ diff --git a/games/aground/data/core/sound/diode_wolf_attack1.ogg b/games/aground/data/core/sound/diode_wolf_attack1.ogg new file mode 100644 index 00000000..90a496a2 Binary files /dev/null and b/games/aground/data/core/sound/diode_wolf_attack1.ogg differ diff --git a/games/aground/data/core/sound/diode_wolf_attack2.ogg b/games/aground/data/core/sound/diode_wolf_attack2.ogg new file mode 100644 index 00000000..acff69dd Binary files /dev/null and b/games/aground/data/core/sound/diode_wolf_attack2.ogg differ diff --git a/games/aground/data/core/sound/diode_wolf_death1.ogg b/games/aground/data/core/sound/diode_wolf_death1.ogg new file mode 100644 index 00000000..bd139ac5 Binary files /dev/null and b/games/aground/data/core/sound/diode_wolf_death1.ogg differ diff --git a/games/aground/data/core/sound/diode_wolf_death2.ogg b/games/aground/data/core/sound/diode_wolf_death2.ogg new file mode 100644 index 00000000..5c63464c Binary files /dev/null and b/games/aground/data/core/sound/diode_wolf_death2.ogg differ diff --git a/games/aground/data/core/sound/diode_wolf_howl.ogg b/games/aground/data/core/sound/diode_wolf_howl.ogg new file mode 100644 index 00000000..c2106420 Binary files /dev/null and b/games/aground/data/core/sound/diode_wolf_howl.ogg differ diff --git a/games/aground/data/core/sound/dragon_atk.ogg b/games/aground/data/core/sound/dragon_atk.ogg new file mode 100644 index 00000000..fe484ed4 Binary files /dev/null and b/games/aground/data/core/sound/dragon_atk.ogg differ diff --git a/games/aground/data/core/sound/dragon_death.ogg b/games/aground/data/core/sound/dragon_death.ogg new file mode 100644 index 00000000..cb0b4220 Binary files /dev/null and b/games/aground/data/core/sound/dragon_death.ogg differ diff --git a/games/aground/data/core/sound/dragon_hit1.ogg b/games/aground/data/core/sound/dragon_hit1.ogg new file mode 100644 index 00000000..7deab1f1 Binary files /dev/null and b/games/aground/data/core/sound/dragon_hit1.ogg differ diff --git a/games/aground/data/core/sound/dragon_hit2.ogg b/games/aground/data/core/sound/dragon_hit2.ogg new file mode 100644 index 00000000..c70479a4 Binary files /dev/null and b/games/aground/data/core/sound/dragon_hit2.ogg differ diff --git a/games/aground/data/core/sound/dragon_hit3.ogg b/games/aground/data/core/sound/dragon_hit3.ogg new file mode 100644 index 00000000..678e028d Binary files /dev/null and b/games/aground/data/core/sound/dragon_hit3.ogg differ diff --git a/games/aground/data/core/sound/dragon_transform.ogg b/games/aground/data/core/sound/dragon_transform.ogg new file mode 100644 index 00000000..e6eea6e4 Binary files /dev/null and b/games/aground/data/core/sound/dragon_transform.ogg differ diff --git a/games/aground/data/core/sound/dragon_wings.ogg b/games/aground/data/core/sound/dragon_wings.ogg new file mode 100644 index 00000000..13053c7c Binary files /dev/null and b/games/aground/data/core/sound/dragon_wings.ogg differ diff --git a/games/aground/data/core/sound/dragonsword.ogg b/games/aground/data/core/sound/dragonsword.ogg new file mode 100644 index 00000000..b696a3d3 Binary files /dev/null and b/games/aground/data/core/sound/dragonsword.ogg differ diff --git a/games/aground/data/core/sound/drill.ogg b/games/aground/data/core/sound/drill.ogg new file mode 100644 index 00000000..c895202b Binary files /dev/null and b/games/aground/data/core/sound/drill.ogg differ diff --git a/games/aground/data/core/sound/drinking.ogg b/games/aground/data/core/sound/drinking.ogg new file mode 100644 index 00000000..428673ba Binary files /dev/null and b/games/aground/data/core/sound/drinking.ogg differ diff --git a/games/aground/data/core/sound/drop.ogg b/games/aground/data/core/sound/drop.ogg new file mode 100644 index 00000000..cd6094ea Binary files /dev/null and b/games/aground/data/core/sound/drop.ogg differ diff --git a/games/aground/data/core/sound/earth_spirit_attack.ogg b/games/aground/data/core/sound/earth_spirit_attack.ogg new file mode 100644 index 00000000..396286a4 Binary files /dev/null and b/games/aground/data/core/sound/earth_spirit_attack.ogg differ diff --git a/games/aground/data/core/sound/earthhammer.ogg b/games/aground/data/core/sound/earthhammer.ogg new file mode 100644 index 00000000..d940e4be Binary files /dev/null and b/games/aground/data/core/sound/earthhammer.ogg differ diff --git a/games/aground/data/core/sound/eat.ogg b/games/aground/data/core/sound/eat.ogg new file mode 100644 index 00000000..89092e0a Binary files /dev/null and b/games/aground/data/core/sound/eat.ogg differ diff --git a/games/aground/data/core/sound/elevator.ogg b/games/aground/data/core/sound/elevator.ogg new file mode 100644 index 00000000..863f183b Binary files /dev/null and b/games/aground/data/core/sound/elevator.ogg differ diff --git a/games/aground/data/core/sound/equip.ogg b/games/aground/data/core/sound/equip.ogg new file mode 100644 index 00000000..94c210a6 Binary files /dev/null and b/games/aground/data/core/sound/equip.ogg differ diff --git a/games/aground/data/core/sound/familiar_collect.ogg b/games/aground/data/core/sound/familiar_collect.ogg new file mode 100644 index 00000000..f6bb5275 Binary files /dev/null and b/games/aground/data/core/sound/familiar_collect.ogg differ diff --git a/games/aground/data/core/sound/fire.ogg b/games/aground/data/core/sound/fire.ogg new file mode 100644 index 00000000..2c239a17 Binary files /dev/null and b/games/aground/data/core/sound/fire.ogg differ diff --git a/games/aground/data/core/sound/fire_bird_death1.ogg b/games/aground/data/core/sound/fire_bird_death1.ogg new file mode 100644 index 00000000..cdae9866 Binary files /dev/null and b/games/aground/data/core/sound/fire_bird_death1.ogg differ diff --git a/games/aground/data/core/sound/fire_bird_death2.ogg b/games/aground/data/core/sound/fire_bird_death2.ogg new file mode 100644 index 00000000..b8f87fe1 Binary files /dev/null and b/games/aground/data/core/sound/fire_bird_death2.ogg differ diff --git a/games/aground/data/core/sound/fire_boar_death1.ogg b/games/aground/data/core/sound/fire_boar_death1.ogg new file mode 100644 index 00000000..2f5e690f Binary files /dev/null and b/games/aground/data/core/sound/fire_boar_death1.ogg differ diff --git a/games/aground/data/core/sound/fire_boar_death2.ogg b/games/aground/data/core/sound/fire_boar_death2.ogg new file mode 100644 index 00000000..e8787d29 Binary files /dev/null and b/games/aground/data/core/sound/fire_boar_death2.ogg differ diff --git a/games/aground/data/core/sound/fireball.ogg b/games/aground/data/core/sound/fireball.ogg new file mode 100644 index 00000000..dfadfa75 Binary files /dev/null and b/games/aground/data/core/sound/fireball.ogg differ diff --git a/games/aground/data/core/sound/fishing.ogg b/games/aground/data/core/sound/fishing.ogg new file mode 100644 index 00000000..371e090e Binary files /dev/null and b/games/aground/data/core/sound/fishing.ogg differ diff --git a/games/aground/data/core/sound/fishingrod.ogg b/games/aground/data/core/sound/fishingrod.ogg new file mode 100644 index 00000000..d902970c Binary files /dev/null and b/games/aground/data/core/sound/fishingrod.ogg differ diff --git a/games/aground/data/core/sound/flamethrower.ogg b/games/aground/data/core/sound/flamethrower.ogg new file mode 100644 index 00000000..9f53ae8f Binary files /dev/null and b/games/aground/data/core/sound/flamethrower.ogg differ diff --git a/games/aground/data/core/sound/fuel.ogg b/games/aground/data/core/sound/fuel.ogg new file mode 100644 index 00000000..00a0ebe7 Binary files /dev/null and b/games/aground/data/core/sound/fuel.ogg differ diff --git a/games/aground/data/core/sound/game_saved.ogg b/games/aground/data/core/sound/game_saved.ogg new file mode 100644 index 00000000..ac2fc791 Binary files /dev/null and b/games/aground/data/core/sound/game_saved.ogg differ diff --git a/games/aground/data/core/sound/ggolem_death1.ogg b/games/aground/data/core/sound/ggolem_death1.ogg new file mode 100644 index 00000000..3df8c88c Binary files /dev/null and b/games/aground/data/core/sound/ggolem_death1.ogg differ diff --git a/games/aground/data/core/sound/ggolem_death2.ogg b/games/aground/data/core/sound/ggolem_death2.ogg new file mode 100644 index 00000000..3f9d4917 Binary files /dev/null and b/games/aground/data/core/sound/ggolem_death2.ogg differ diff --git a/games/aground/data/core/sound/goggles.ogg b/games/aground/data/core/sound/goggles.ogg new file mode 100644 index 00000000..6af48c01 Binary files /dev/null and b/games/aground/data/core/sound/goggles.ogg differ diff --git a/games/aground/data/core/sound/goldensword.ogg b/games/aground/data/core/sound/goldensword.ogg new file mode 100644 index 00000000..3f67c342 Binary files /dev/null and b/games/aground/data/core/sound/goldensword.ogg differ diff --git a/games/aground/data/core/sound/golem.ogg b/games/aground/data/core/sound/golem.ogg new file mode 100644 index 00000000..badc496d Binary files /dev/null and b/games/aground/data/core/sound/golem.ogg differ diff --git a/games/aground/data/core/sound/golem_attack.ogg b/games/aground/data/core/sound/golem_attack.ogg new file mode 100644 index 00000000..a5b8c2b7 Binary files /dev/null and b/games/aground/data/core/sound/golem_attack.ogg differ diff --git a/games/aground/data/core/sound/golem_death1.ogg b/games/aground/data/core/sound/golem_death1.ogg new file mode 100644 index 00000000..eec55141 Binary files /dev/null and b/games/aground/data/core/sound/golem_death1.ogg differ diff --git a/games/aground/data/core/sound/golem_death2.ogg b/games/aground/data/core/sound/golem_death2.ogg new file mode 100644 index 00000000..d728ec6c Binary files /dev/null and b/games/aground/data/core/sound/golem_death2.ogg differ diff --git a/games/aground/data/core/sound/golemech_death.ogg b/games/aground/data/core/sound/golemech_death.ogg new file mode 100644 index 00000000..3b3449ef Binary files /dev/null and b/games/aground/data/core/sound/golemech_death.ogg differ diff --git a/games/aground/data/core/sound/golemech_laser.ogg b/games/aground/data/core/sound/golemech_laser.ogg new file mode 100644 index 00000000..a0def656 Binary files /dev/null and b/games/aground/data/core/sound/golemech_laser.ogg differ diff --git a/games/aground/data/core/sound/hide.ogg b/games/aground/data/core/sound/hide.ogg new file mode 100644 index 00000000..7ca6b3f9 Binary files /dev/null and b/games/aground/data/core/sound/hide.ogg differ diff --git a/games/aground/data/core/sound/icer_death.ogg b/games/aground/data/core/sound/icer_death.ogg new file mode 100644 index 00000000..988a7faa Binary files /dev/null and b/games/aground/data/core/sound/icer_death.ogg differ diff --git a/games/aground/data/core/sound/item.ogg b/games/aground/data/core/sound/item.ogg new file mode 100644 index 00000000..748edfe8 Binary files /dev/null and b/games/aground/data/core/sound/item.ogg differ diff --git a/games/aground/data/core/sound/item_found.ogg b/games/aground/data/core/sound/item_found.ogg new file mode 100644 index 00000000..29b3233d Binary files /dev/null and b/games/aground/data/core/sound/item_found.ogg differ diff --git a/games/aground/data/core/sound/kitchen.ogg b/games/aground/data/core/sound/kitchen.ogg new file mode 100644 index 00000000..28fbe33d Binary files /dev/null and b/games/aground/data/core/sound/kitchen.ogg differ diff --git a/games/aground/data/core/sound/leech_attack.ogg b/games/aground/data/core/sound/leech_attack.ogg new file mode 100644 index 00000000..d645ad5f Binary files /dev/null and b/games/aground/data/core/sound/leech_attack.ogg differ diff --git a/games/aground/data/core/sound/leech_death1.ogg b/games/aground/data/core/sound/leech_death1.ogg new file mode 100644 index 00000000..b7f4377b Binary files /dev/null and b/games/aground/data/core/sound/leech_death1.ogg differ diff --git a/games/aground/data/core/sound/leech_death2.ogg b/games/aground/data/core/sound/leech_death2.ogg new file mode 100644 index 00000000..8760874d Binary files /dev/null and b/games/aground/data/core/sound/leech_death2.ogg differ diff --git a/games/aground/data/core/sound/levelup.ogg b/games/aground/data/core/sound/levelup.ogg new file mode 100644 index 00000000..356a8241 Binary files /dev/null and b/games/aground/data/core/sound/levelup.ogg differ diff --git a/games/aground/data/core/sound/low_hp.ogg b/games/aground/data/core/sound/low_hp.ogg new file mode 100644 index 00000000..b10bcacd Binary files /dev/null and b/games/aground/data/core/sound/low_hp.ogg differ diff --git a/games/aground/data/core/sound/machine_gun.ogg b/games/aground/data/core/sound/machine_gun.ogg new file mode 100644 index 00000000..688c1758 Binary files /dev/null and b/games/aground/data/core/sound/machine_gun.ogg differ diff --git a/games/aground/data/core/sound/magic.ogg b/games/aground/data/core/sound/magic.ogg new file mode 100644 index 00000000..c2a58a8e Binary files /dev/null and b/games/aground/data/core/sound/magic.ogg differ diff --git a/games/aground/data/core/sound/magic_wyrm_death.ogg b/games/aground/data/core/sound/magic_wyrm_death.ogg new file mode 100644 index 00000000..2aed3f0f Binary files /dev/null and b/games/aground/data/core/sound/magic_wyrm_death.ogg differ diff --git a/games/aground/data/core/sound/magicwyrm_attack.ogg b/games/aground/data/core/sound/magicwyrm_attack.ogg new file mode 100644 index 00000000..c3242ab4 Binary files /dev/null and b/games/aground/data/core/sound/magicwyrm_attack.ogg differ diff --git a/games/aground/data/core/sound/map.ogg b/games/aground/data/core/sound/map.ogg new file mode 100644 index 00000000..9f852c08 Binary files /dev/null and b/games/aground/data/core/sound/map.ogg differ diff --git a/games/aground/data/core/sound/mech_wyrm_death1.ogg b/games/aground/data/core/sound/mech_wyrm_death1.ogg new file mode 100644 index 00000000..afc76722 Binary files /dev/null and b/games/aground/data/core/sound/mech_wyrm_death1.ogg differ diff --git a/games/aground/data/core/sound/mech_wyrm_death2.ogg b/games/aground/data/core/sound/mech_wyrm_death2.ogg new file mode 100644 index 00000000..2214de11 Binary files /dev/null and b/games/aground/data/core/sound/mech_wyrm_death2.ogg differ diff --git a/games/aground/data/core/sound/mecha_wyrm_attack1.ogg b/games/aground/data/core/sound/mecha_wyrm_attack1.ogg new file mode 100644 index 00000000..6e51a6fb Binary files /dev/null and b/games/aground/data/core/sound/mecha_wyrm_attack1.ogg differ diff --git a/games/aground/data/core/sound/mecha_wyrm_attack2.ogg b/games/aground/data/core/sound/mecha_wyrm_attack2.ogg new file mode 100644 index 00000000..9c47ef55 Binary files /dev/null and b/games/aground/data/core/sound/mecha_wyrm_attack2.ogg differ diff --git a/games/aground/data/core/sound/meow.ogg b/games/aground/data/core/sound/meow.ogg new file mode 100644 index 00000000..343ca9df Binary files /dev/null and b/games/aground/data/core/sound/meow.ogg differ diff --git a/games/aground/data/core/sound/minotaur_charge1.ogg b/games/aground/data/core/sound/minotaur_charge1.ogg new file mode 100644 index 00000000..d3cee164 Binary files /dev/null and b/games/aground/data/core/sound/minotaur_charge1.ogg differ diff --git a/games/aground/data/core/sound/minotaur_charge2.ogg b/games/aground/data/core/sound/minotaur_charge2.ogg new file mode 100644 index 00000000..3bfe47d3 Binary files /dev/null and b/games/aground/data/core/sound/minotaur_charge2.ogg differ diff --git a/games/aground/data/core/sound/minotaur_charge3.ogg b/games/aground/data/core/sound/minotaur_charge3.ogg new file mode 100644 index 00000000..eaf44f7d Binary files /dev/null and b/games/aground/data/core/sound/minotaur_charge3.ogg differ diff --git a/games/aground/data/core/sound/minotaur_charge4.ogg b/games/aground/data/core/sound/minotaur_charge4.ogg new file mode 100644 index 00000000..65c3dadd Binary files /dev/null and b/games/aground/data/core/sound/minotaur_charge4.ogg differ diff --git a/games/aground/data/core/sound/minotaur_death1.ogg b/games/aground/data/core/sound/minotaur_death1.ogg new file mode 100644 index 00000000..b8ce19b2 Binary files /dev/null and b/games/aground/data/core/sound/minotaur_death1.ogg differ diff --git a/games/aground/data/core/sound/minotaur_death2.ogg b/games/aground/data/core/sound/minotaur_death2.ogg new file mode 100644 index 00000000..44010988 Binary files /dev/null and b/games/aground/data/core/sound/minotaur_death2.ogg differ diff --git a/games/aground/data/core/sound/minotaur_impale.ogg b/games/aground/data/core/sound/minotaur_impale.ogg new file mode 100644 index 00000000..cd414433 Binary files /dev/null and b/games/aground/data/core/sound/minotaur_impale.ogg differ diff --git a/games/aground/data/core/sound/mirrow_d_death.ogg b/games/aground/data/core/sound/mirrow_d_death.ogg new file mode 100644 index 00000000..d7588faf Binary files /dev/null and b/games/aground/data/core/sound/mirrow_d_death.ogg differ diff --git a/games/aground/data/core/sound/mirrow_energyball.ogg b/games/aground/data/core/sound/mirrow_energyball.ogg new file mode 100644 index 00000000..aaafe786 Binary files /dev/null and b/games/aground/data/core/sound/mirrow_energyball.ogg differ diff --git a/games/aground/data/core/sound/mirrow_lightning1.ogg b/games/aground/data/core/sound/mirrow_lightning1.ogg new file mode 100644 index 00000000..8d38cd4c Binary files /dev/null and b/games/aground/data/core/sound/mirrow_lightning1.ogg differ diff --git a/games/aground/data/core/sound/mirrow_lightning2.ogg b/games/aground/data/core/sound/mirrow_lightning2.ogg new file mode 100644 index 00000000..7753a7a5 Binary files /dev/null and b/games/aground/data/core/sound/mirrow_lightning2.ogg differ diff --git a/games/aground/data/core/sound/mirrow_lightning3.ogg b/games/aground/data/core/sound/mirrow_lightning3.ogg new file mode 100644 index 00000000..d7b8d2e5 Binary files /dev/null and b/games/aground/data/core/sound/mirrow_lightning3.ogg differ diff --git a/games/aground/data/core/sound/mirrow_n_death.ogg b/games/aground/data/core/sound/mirrow_n_death.ogg new file mode 100644 index 00000000..0b5566b6 Binary files /dev/null and b/games/aground/data/core/sound/mirrow_n_death.ogg differ diff --git a/games/aground/data/core/sound/mirrow_tentacle1.ogg b/games/aground/data/core/sound/mirrow_tentacle1.ogg new file mode 100644 index 00000000..f04b6608 Binary files /dev/null and b/games/aground/data/core/sound/mirrow_tentacle1.ogg differ diff --git a/games/aground/data/core/sound/mirrow_tentacle2.ogg b/games/aground/data/core/sound/mirrow_tentacle2.ogg new file mode 100644 index 00000000..504c65a5 Binary files /dev/null and b/games/aground/data/core/sound/mirrow_tentacle2.ogg differ diff --git a/games/aground/data/core/sound/miss.ogg b/games/aground/data/core/sound/miss.ogg new file mode 100644 index 00000000..b719347d Binary files /dev/null and b/games/aground/data/core/sound/miss.ogg differ diff --git a/games/aground/data/core/sound/move.ogg b/games/aground/data/core/sound/move.ogg new file mode 100644 index 00000000..8ebedb78 Binary files /dev/null and b/games/aground/data/core/sound/move.ogg differ diff --git a/games/aground/data/core/sound/ocean_enter.ogg b/games/aground/data/core/sound/ocean_enter.ogg new file mode 100644 index 00000000..c86119c1 Binary files /dev/null and b/games/aground/data/core/sound/ocean_enter.ogg differ diff --git a/games/aground/data/core/sound/ocean_exit.ogg b/games/aground/data/core/sound/ocean_exit.ogg new file mode 100644 index 00000000..6afe756d Binary files /dev/null and b/games/aground/data/core/sound/ocean_exit.ogg differ diff --git a/games/aground/data/core/sound/oldone_beam.ogg b/games/aground/data/core/sound/oldone_beam.ogg new file mode 100644 index 00000000..f227dc3a Binary files /dev/null and b/games/aground/data/core/sound/oldone_beam.ogg differ diff --git a/games/aground/data/core/sound/oldone_open.ogg b/games/aground/data/core/sound/oldone_open.ogg new file mode 100644 index 00000000..d5fecccf Binary files /dev/null and b/games/aground/data/core/sound/oldone_open.ogg differ diff --git a/games/aground/data/core/sound/orb_impact.ogg b/games/aground/data/core/sound/orb_impact.ogg new file mode 100644 index 00000000..23d258e4 Binary files /dev/null and b/games/aground/data/core/sound/orb_impact.ogg differ diff --git a/games/aground/data/core/sound/orb_spawn.ogg b/games/aground/data/core/sound/orb_spawn.ogg new file mode 100644 index 00000000..e223cf9a Binary files /dev/null and b/games/aground/data/core/sound/orb_spawn.ogg differ diff --git a/games/aground/data/core/sound/owl1.ogg b/games/aground/data/core/sound/owl1.ogg new file mode 100644 index 00000000..28cadec1 Binary files /dev/null and b/games/aground/data/core/sound/owl1.ogg differ diff --git a/games/aground/data/core/sound/owl2.ogg b/games/aground/data/core/sound/owl2.ogg new file mode 100644 index 00000000..761d32f7 Binary files /dev/null and b/games/aground/data/core/sound/owl2.ogg differ diff --git a/games/aground/data/core/sound/pick.ogg b/games/aground/data/core/sound/pick.ogg new file mode 100644 index 00000000..56be6f1c Binary files /dev/null and b/games/aground/data/core/sound/pick.ogg differ diff --git a/games/aground/data/core/sound/place.ogg b/games/aground/data/core/sound/place.ogg new file mode 100644 index 00000000..95e7434b Binary files /dev/null and b/games/aground/data/core/sound/place.ogg differ diff --git a/games/aground/data/core/sound/plant_seed.ogg b/games/aground/data/core/sound/plant_seed.ogg new file mode 100644 index 00000000..288e5cf0 Binary files /dev/null and b/games/aground/data/core/sound/plant_seed.ogg differ diff --git a/games/aground/data/core/sound/plant_spirit_attack.ogg b/games/aground/data/core/sound/plant_spirit_attack.ogg new file mode 100644 index 00000000..96ced08a Binary files /dev/null and b/games/aground/data/core/sound/plant_spirit_attack.ogg differ diff --git a/games/aground/data/core/sound/player_death.ogg b/games/aground/data/core/sound/player_death.ogg new file mode 100644 index 00000000..eb2fcd95 Binary files /dev/null and b/games/aground/data/core/sound/player_death.ogg differ diff --git a/games/aground/data/core/sound/purple_golem_death1.ogg b/games/aground/data/core/sound/purple_golem_death1.ogg new file mode 100644 index 00000000..e888d61d Binary files /dev/null and b/games/aground/data/core/sound/purple_golem_death1.ogg differ diff --git a/games/aground/data/core/sound/purple_golem_death2.ogg b/games/aground/data/core/sound/purple_golem_death2.ogg new file mode 100644 index 00000000..de7fcec2 Binary files /dev/null and b/games/aground/data/core/sound/purple_golem_death2.ogg differ diff --git a/games/aground/data/core/sound/purr.ogg b/games/aground/data/core/sound/purr.ogg new file mode 100644 index 00000000..669b5402 Binary files /dev/null and b/games/aground/data/core/sound/purr.ogg differ diff --git a/games/aground/data/core/sound/radioactive_bolt1.ogg b/games/aground/data/core/sound/radioactive_bolt1.ogg new file mode 100644 index 00000000..c063823d Binary files /dev/null and b/games/aground/data/core/sound/radioactive_bolt1.ogg differ diff --git a/games/aground/data/core/sound/radioactive_bolt2.ogg b/games/aground/data/core/sound/radioactive_bolt2.ogg new file mode 100644 index 00000000..df9b8098 Binary files /dev/null and b/games/aground/data/core/sound/radioactive_bolt2.ogg differ diff --git a/games/aground/data/core/sound/rain.ogg b/games/aground/data/core/sound/rain.ogg new file mode 100644 index 00000000..199be2ca Binary files /dev/null and b/games/aground/data/core/sound/rain.ogg differ diff --git a/games/aground/data/core/sound/rat_death1.ogg b/games/aground/data/core/sound/rat_death1.ogg new file mode 100644 index 00000000..65823b61 Binary files /dev/null and b/games/aground/data/core/sound/rat_death1.ogg differ diff --git a/games/aground/data/core/sound/rat_death2.ogg b/games/aground/data/core/sound/rat_death2.ogg new file mode 100644 index 00000000..3688a37f Binary files /dev/null and b/games/aground/data/core/sound/rat_death2.ogg differ diff --git a/games/aground/data/core/sound/rat_death3.ogg b/games/aground/data/core/sound/rat_death3.ogg new file mode 100644 index 00000000..ab9a60ce Binary files /dev/null and b/games/aground/data/core/sound/rat_death3.ogg differ diff --git a/games/aground/data/core/sound/recurvebow.ogg b/games/aground/data/core/sound/recurvebow.ogg new file mode 100644 index 00000000..b5fc60be Binary files /dev/null and b/games/aground/data/core/sound/recurvebow.ogg differ diff --git a/games/aground/data/core/sound/revolver.ogg b/games/aground/data/core/sound/revolver.ogg new file mode 100644 index 00000000..c6b5d85b Binary files /dev/null and b/games/aground/data/core/sound/revolver.ogg differ diff --git a/games/aground/data/core/sound/rock_door.ogg b/games/aground/data/core/sound/rock_door.ogg new file mode 100644 index 00000000..6926740b Binary files /dev/null and b/games/aground/data/core/sound/rock_door.ogg differ diff --git a/games/aground/data/core/sound/sail_open.ogg b/games/aground/data/core/sound/sail_open.ogg new file mode 100644 index 00000000..af1d9e3c Binary files /dev/null and b/games/aground/data/core/sound/sail_open.ogg differ diff --git a/games/aground/data/core/sound/sailing.ogg b/games/aground/data/core/sound/sailing.ogg new file mode 100644 index 00000000..bf381551 Binary files /dev/null and b/games/aground/data/core/sound/sailing.ogg differ diff --git a/games/aground/data/core/sound/select.ogg b/games/aground/data/core/sound/select.ogg new file mode 100644 index 00000000..c8ce5c27 Binary files /dev/null and b/games/aground/data/core/sound/select.ogg differ diff --git a/games/aground/data/core/sound/shadowcat_attack.ogg b/games/aground/data/core/sound/shadowcat_attack.ogg new file mode 100644 index 00000000..a9e9ca15 Binary files /dev/null and b/games/aground/data/core/sound/shadowcat_attack.ogg differ diff --git a/games/aground/data/core/sound/shadowcat_death1.ogg b/games/aground/data/core/sound/shadowcat_death1.ogg new file mode 100644 index 00000000..0b5198a4 Binary files /dev/null and b/games/aground/data/core/sound/shadowcat_death1.ogg differ diff --git a/games/aground/data/core/sound/shadowcat_death2.ogg b/games/aground/data/core/sound/shadowcat_death2.ogg new file mode 100644 index 00000000..2d7e6e2b Binary files /dev/null and b/games/aground/data/core/sound/shadowcat_death2.ogg differ diff --git a/games/aground/data/core/sound/shell.ogg b/games/aground/data/core/sound/shell.ogg new file mode 100644 index 00000000..d15ad1c8 Binary files /dev/null and b/games/aground/data/core/sound/shell.ogg differ diff --git a/games/aground/data/core/sound/shotgun1.ogg b/games/aground/data/core/sound/shotgun1.ogg new file mode 100644 index 00000000..728de98a Binary files /dev/null and b/games/aground/data/core/sound/shotgun1.ogg differ diff --git a/games/aground/data/core/sound/shotgun2.ogg b/games/aground/data/core/sound/shotgun2.ogg new file mode 100644 index 00000000..79652508 Binary files /dev/null and b/games/aground/data/core/sound/shotgun2.ogg differ diff --git a/games/aground/data/core/sound/skyfish_death1.ogg b/games/aground/data/core/sound/skyfish_death1.ogg new file mode 100644 index 00000000..e42de86f Binary files /dev/null and b/games/aground/data/core/sound/skyfish_death1.ogg differ diff --git a/games/aground/data/core/sound/skyfish_death2.ogg b/games/aground/data/core/sound/skyfish_death2.ogg new file mode 100644 index 00000000..62a01d05 Binary files /dev/null and b/games/aground/data/core/sound/skyfish_death2.ogg differ diff --git a/games/aground/data/core/sound/skyfish_fire.ogg b/games/aground/data/core/sound/skyfish_fire.ogg new file mode 100644 index 00000000..825959a3 Binary files /dev/null and b/games/aground/data/core/sound/skyfish_fire.ogg differ diff --git a/games/aground/data/core/sound/skyfish_impact.ogg b/games/aground/data/core/sound/skyfish_impact.ogg new file mode 100644 index 00000000..73420ff3 Binary files /dev/null and b/games/aground/data/core/sound/skyfish_impact.ogg differ diff --git a/games/aground/data/core/sound/smelter.ogg b/games/aground/data/core/sound/smelter.ogg new file mode 100644 index 00000000..21aaecec Binary files /dev/null and b/games/aground/data/core/sound/smelter.ogg differ diff --git a/games/aground/data/core/sound/smelter_loop.ogg b/games/aground/data/core/sound/smelter_loop.ogg new file mode 100644 index 00000000..6f6b397b Binary files /dev/null and b/games/aground/data/core/sound/smelter_loop.ogg differ diff --git a/games/aground/data/core/sound/sounds.xml b/games/aground/data/core/sound/sounds.xml new file mode 100644 index 00000000..c545c1c7 --- /dev/null +++ b/games/aground/data/core/sound/sounds.xml @@ -0,0 +1,189 @@ +<?xml version="1.0" encoding="utf-8" ?> +<data> + <volume name="rain" value="50" /> + <volume name="low_hp" value="50" /> + <volume name="tree_felled" value="200" /> + <volume name="purr" value="200" /> + <volume name="revolver" value="200" /> + <volume name="machine_gun" value="200" /> + <volume name="elevator" value="75" /> + <volume name="bullet" value="200" /> + <volume name="shell" value="200" /> + <volume name="ancient_axe" value="120" /> + <volume name="shotgun" value="130" /> + <volume name="yeti_breath" value="70" /> + <volume name="shadowcat_attack" value="120" /> + <volume name="shadowcat_death" value="120" /> + <volume name="wyrmqueen_spawn" value="130" /> + <volume name="orb_impact" value="90" /> + <volume name="orb_spawn" value="105" /> + <volume name="oldone_open" value="125" /> + <volume name="alien_death" value="120" /> + <volume name="bandit_ranged_attack" value="115" /> + <volume name="bandit_ranged_death" value="130" /> + <volume name="bandit_ranged_hit" value="120" /> + <volume name="bandit_knives_slash" value="120" /> + <volume name="stinger_attack" value="130" /> + <volume name="mecha_wyrm_attack" value="135" /> + <volume name="fishingrod" value="180"/> + + <sound id="achievement" /> + <sound id="axe" /> + <sound id="axe_tree" /> + <sound id="blocked" /> + <sound id="player_death" /> + <sound id="bow" /> + <sound id="build" /> + <sound id="buy" /> + <sound id="cancel" /> + <sound id="chainsaw" /> + <sound id="death" /> + <sound id="dragon_atk" /> + <sound id="dragon_death" /> + <sound id="dragon_hit" /> + <sound id="drill" /> + <sound id="drop" /> + <sound id="eat" /> + <sound id="elevator" /> + <sound id="attack" /> + <sound id="fire" /> + <sound id="fireball" /> + <sound id="flamethrower" /> + <sound id="arrow_hit" /> + <sound id="item" /> + <sound id="levelup" /> + <sound id="low_hp" /> + <sound id="machine_gun" /> + <sound id="meow" /> + <sound id="miss" /> + <sound id="move" /> + <sound id="pick" /> + <sound id="purr" /> + <sound id="rain" /> + <sound id="boar_death" /> + <sound id="rat_death" /> + <sound id="fire_boar_death" /> + <sound id="golem_death" /> + <sound id="fire_bird_death" /> + <sound id="ggolem_death" /> + <sound id="revolver" /> + <sound id="rock_door" /> + <sound id="select" /> + <sound id="smelter" /> + <sound id="sword" /> + <sound id="sword_swing" /> + <sound id="talking1" /> + <sound id="talking2" /> + <sound id="talking4" /> + <sound id="talking5" /> + <sound id="talking6" /> + <sound id="talking7" /> + <sound id="thunder" /> + <sound id="tree_felled" /> + <sound id="workshop" /> + <sound id="wyrm_death" /> + <sound id="yeti_death" /> + <sound id="spider_death" /> + <sound id="shadowcat_death" /> + <sound id="crawler_death" /> + <sound id="wyrm_queen_death" /> + <sound id="leech_death" /> + <sound id="magic_wyrm_death" /> + <sound id="purple_golem_death" /> + <sound id="golemech_death" /> + <sound id="skyfish_death" /> + <sound id="alien_death" /> + <sound id="bandit_heavy_death" /> + <sound id="bandit_combo_death" /> + <sound id="bandit_ranged_death" /> + <sound id="bandit_knives_death" /> + <sound id="diode_wolf_death" /> + <sound id="cyborg_death" /> + <sound id="stinger_death" /> + <sound id="mech_wyrm_death" /> + <sound id="minotaur_death" /> + <sound id="mirrow_n_death" /> + <sound id="mirrow_d_death" /> + <sound id="icer_death" /> + <sound id="item_found" /> + + <sound id="ancient_axe" /> + <sound id="shotgun" /> + <sound id="shell" /> + <sound id="bullet" /> + <sound id="wyrm_drill" /> + <sound id="earthhammer" /> + <sound id="dragonsword" /> + <sound id="recurvebow" /> + <sound id="steel_axe" /> + <sound id="goldensword" /> + <sound id="bolt_hit" /> + + <sound id="boar_attack" /> + <sound id="wyrm_attack" /> + <sound id="yeti_breath" /> + <sound id="yeti_snowball" /> + <sound id="shadowcat_attack" /> + <sound id="spider_attack" /> + <sound id="magicwyrm_attack" /> + <sound id="wyrmqueen_spawn" /> + <sound id="bandit_knives_hit" /> + <sound id="bandit_knives_slash" /> + <sound id="bandit_knives_throw" /> + <sound id="bandit_ranged_attack" /> + <sound id="bandit_ranged_hit" /> + <sound id="crawler_attack" /> + <sound id="earth_spirit_attack" /> + <sound id="golemech_laser" /> + <sound id="golem_attack" /> + <sound id="leech_attack" /> + <sound id="mecha_wyrm_attack" /> + <sound id="oldone_beam" /> + <sound id="oldone_open" /> + <sound id="orb_impact" /> + <sound id="orb_spawn" /> + <sound id="plant_spirit_attack" /> + <sound id="radioactive_bolt" /> + <sound id="skyfish_fire" /> + <sound id="skyfish_impact" /> + <sound id="stinger_attack" /> + <sound id="mirrow_lightning" /> + <sound id="mirrow_energyball" /> + <sound id="mirrow_tentacle" /> + <sound id="minotaur_charge" /> + <sound id="minotaur_impale" /> + + <sound id="magic" /> + <sound id="summon" /> + <sound id="warning" /> + <sound id="kitchen" /> + <sound id="smelter_loop" /> + <sound id="game_saved" /> + <sound id="fishingrod" /> + <sound id="fishing" /> + + <sound id="chest_open" /> + <sound id="dragon_transform" /> + <sound id="drinking" /> + <sound id="equip" /> + <sound id="fuel" /> + <sound id="goggles" /> + <sound id="hide" /> + <sound id="map" /> + <sound id="ocean_enter" /> + <sound id="ocean_exit" /> + <sound id="place" /> + <sound id="plant_seed" /> + <sound id="sailing" /> + <sound id="whirlpool" /> + <sound id="whirlpool_portal" /> + <sound id="dragon_wings" /> + <sound id="sail_open" /> + + <sound id="bark" /> + <sound id="diode_wolf_attack" /> + <sound id="diode_wolf_howl" /> + <sound id="familiar_collect" /> + <sound id="golem" /> + <sound id="owl" /> +</data> \ No newline at end of file diff --git a/games/aground/data/core/sound/spider_attack.ogg b/games/aground/data/core/sound/spider_attack.ogg new file mode 100644 index 00000000..61abd516 Binary files /dev/null and b/games/aground/data/core/sound/spider_attack.ogg differ diff --git a/games/aground/data/core/sound/spider_death1.ogg b/games/aground/data/core/sound/spider_death1.ogg new file mode 100644 index 00000000..859e8ee0 Binary files /dev/null and b/games/aground/data/core/sound/spider_death1.ogg differ diff --git a/games/aground/data/core/sound/spider_death2.ogg b/games/aground/data/core/sound/spider_death2.ogg new file mode 100644 index 00000000..9a15a621 Binary files /dev/null and b/games/aground/data/core/sound/spider_death2.ogg differ diff --git a/games/aground/data/core/sound/steel_axe.ogg b/games/aground/data/core/sound/steel_axe.ogg new file mode 100644 index 00000000..4c509953 Binary files /dev/null and b/games/aground/data/core/sound/steel_axe.ogg differ diff --git a/games/aground/data/core/sound/stinger_attack1.ogg b/games/aground/data/core/sound/stinger_attack1.ogg new file mode 100644 index 00000000..ca3fe58a Binary files /dev/null and b/games/aground/data/core/sound/stinger_attack1.ogg differ diff --git a/games/aground/data/core/sound/stinger_attack2.ogg b/games/aground/data/core/sound/stinger_attack2.ogg new file mode 100644 index 00000000..301b4386 Binary files /dev/null and b/games/aground/data/core/sound/stinger_attack2.ogg differ diff --git a/games/aground/data/core/sound/stinger_death1.ogg b/games/aground/data/core/sound/stinger_death1.ogg new file mode 100644 index 00000000..1bb8a99b Binary files /dev/null and b/games/aground/data/core/sound/stinger_death1.ogg differ diff --git a/games/aground/data/core/sound/stinger_death2.ogg b/games/aground/data/core/sound/stinger_death2.ogg new file mode 100644 index 00000000..d5e8a83c Binary files /dev/null and b/games/aground/data/core/sound/stinger_death2.ogg differ diff --git a/games/aground/data/core/sound/summon.ogg b/games/aground/data/core/sound/summon.ogg new file mode 100644 index 00000000..89ab9660 Binary files /dev/null and b/games/aground/data/core/sound/summon.ogg differ diff --git a/games/aground/data/core/sound/sword.ogg b/games/aground/data/core/sound/sword.ogg new file mode 100644 index 00000000..6e787937 Binary files /dev/null and b/games/aground/data/core/sound/sword.ogg differ diff --git a/games/aground/data/core/sound/sword_swing.ogg b/games/aground/data/core/sound/sword_swing.ogg new file mode 100644 index 00000000..8187babe Binary files /dev/null and b/games/aground/data/core/sound/sword_swing.ogg differ diff --git a/games/aground/data/core/sound/talking1.ogg b/games/aground/data/core/sound/talking1.ogg new file mode 100644 index 00000000..83fb8d73 Binary files /dev/null and b/games/aground/data/core/sound/talking1.ogg differ diff --git a/games/aground/data/core/sound/talking2.ogg b/games/aground/data/core/sound/talking2.ogg new file mode 100644 index 00000000..2ab39ee4 Binary files /dev/null and b/games/aground/data/core/sound/talking2.ogg differ diff --git a/games/aground/data/core/sound/talking4.ogg b/games/aground/data/core/sound/talking4.ogg new file mode 100644 index 00000000..6bac4cce Binary files /dev/null and b/games/aground/data/core/sound/talking4.ogg differ diff --git a/games/aground/data/core/sound/talking5.ogg b/games/aground/data/core/sound/talking5.ogg new file mode 100644 index 00000000..72e7a924 Binary files /dev/null and b/games/aground/data/core/sound/talking5.ogg differ diff --git a/games/aground/data/core/sound/talking6.ogg b/games/aground/data/core/sound/talking6.ogg new file mode 100644 index 00000000..a3507819 Binary files /dev/null and b/games/aground/data/core/sound/talking6.ogg differ diff --git a/games/aground/data/core/sound/talking7.ogg b/games/aground/data/core/sound/talking7.ogg new file mode 100644 index 00000000..49d01b2e Binary files /dev/null and b/games/aground/data/core/sound/talking7.ogg differ diff --git a/games/aground/data/core/sound/thunder.ogg b/games/aground/data/core/sound/thunder.ogg new file mode 100644 index 00000000..42c79b28 Binary files /dev/null and b/games/aground/data/core/sound/thunder.ogg differ diff --git a/games/aground/data/core/sound/tree_felled.ogg b/games/aground/data/core/sound/tree_felled.ogg new file mode 100644 index 00000000..f317cb1f Binary files /dev/null and b/games/aground/data/core/sound/tree_felled.ogg differ diff --git a/games/aground/data/core/sound/warning.ogg b/games/aground/data/core/sound/warning.ogg new file mode 100644 index 00000000..9fb8a1fc Binary files /dev/null and b/games/aground/data/core/sound/warning.ogg differ diff --git a/games/aground/data/core/sound/whirlpool.ogg b/games/aground/data/core/sound/whirlpool.ogg new file mode 100644 index 00000000..8c20f256 Binary files /dev/null and b/games/aground/data/core/sound/whirlpool.ogg differ diff --git a/games/aground/data/core/sound/whirlpool_portal.ogg b/games/aground/data/core/sound/whirlpool_portal.ogg new file mode 100644 index 00000000..05b32a59 Binary files /dev/null and b/games/aground/data/core/sound/whirlpool_portal.ogg differ diff --git a/games/aground/data/core/sound/workshop.ogg b/games/aground/data/core/sound/workshop.ogg new file mode 100644 index 00000000..5d9e4f23 Binary files /dev/null and b/games/aground/data/core/sound/workshop.ogg differ diff --git a/games/aground/data/core/sound/wyrm_attack.ogg b/games/aground/data/core/sound/wyrm_attack.ogg new file mode 100644 index 00000000..8cdc3957 Binary files /dev/null and b/games/aground/data/core/sound/wyrm_attack.ogg differ diff --git a/games/aground/data/core/sound/wyrm_death.ogg b/games/aground/data/core/sound/wyrm_death.ogg new file mode 100644 index 00000000..29b59e2b Binary files /dev/null and b/games/aground/data/core/sound/wyrm_death.ogg differ diff --git a/games/aground/data/core/sound/wyrm_drill.ogg b/games/aground/data/core/sound/wyrm_drill.ogg new file mode 100644 index 00000000..1e91e561 Binary files /dev/null and b/games/aground/data/core/sound/wyrm_drill.ogg differ diff --git a/games/aground/data/core/sound/wyrm_queen_death.ogg b/games/aground/data/core/sound/wyrm_queen_death.ogg new file mode 100644 index 00000000..63d5e681 Binary files /dev/null and b/games/aground/data/core/sound/wyrm_queen_death.ogg differ diff --git a/games/aground/data/core/sound/wyrmqueen_spawn.ogg b/games/aground/data/core/sound/wyrmqueen_spawn.ogg new file mode 100644 index 00000000..02b0c27f Binary files /dev/null and b/games/aground/data/core/sound/wyrmqueen_spawn.ogg differ diff --git a/games/aground/data/core/sound/yeti_breath.ogg b/games/aground/data/core/sound/yeti_breath.ogg new file mode 100644 index 00000000..a76e4a64 Binary files /dev/null and b/games/aground/data/core/sound/yeti_breath.ogg differ diff --git a/games/aground/data/core/sound/yeti_death1.ogg b/games/aground/data/core/sound/yeti_death1.ogg new file mode 100644 index 00000000..3f09be79 Binary files /dev/null and b/games/aground/data/core/sound/yeti_death1.ogg differ diff --git a/games/aground/data/core/sound/yeti_death2.ogg b/games/aground/data/core/sound/yeti_death2.ogg new file mode 100644 index 00000000..df63d98b Binary files /dev/null and b/games/aground/data/core/sound/yeti_death2.ogg differ diff --git a/games/aground/data/core/sound/yeti_snowball.ogg b/games/aground/data/core/sound/yeti_snowball.ogg new file mode 100644 index 00000000..6d6bebe0 Binary files /dev/null and b/games/aground/data/core/sound/yeti_snowball.ogg differ diff --git a/games/aground/data/core/specials/ant.png b/games/aground/data/core/specials/ant.png new file mode 100644 index 00000000..4dfa8194 Binary files /dev/null and b/games/aground/data/core/specials/ant.png differ diff --git a/games/aground/data/core/specials/ant.xml b/games/aground/data/core/specials/ant.xml new file mode 100644 index 00000000..5d2cad4f --- /dev/null +++ b/games/aground/data/core/specials/ant.xml @@ -0,0 +1,23 @@ +<tilesheet id='ant.png' width='16' height='16' offsetX="-16"> + <image frame='0' x='0' y='0' width='17' height='10' offsetX='15' offsetY='6' /> + <image frame='1' x='0' y='10' width='17' height='12' offsetX='15' offsetY='4' /> + <image frame='2' x='0' y='22' width='16' height='14' offsetX='16' offsetY='2' /> + <image frame='3' x='0' y='36' width='16' height='14' offsetX='16' offsetY='2' /> + <image frame='4' x='16' y='22' width='17' height='13' offsetX='13' offsetY='3' /> + <image frame='5' x='0' y='50' width='16' height='14' offsetX='16' offsetY='2' /> + <image frame='6' x='16' y='35' width='16' height='14' offsetX='16' offsetY='2' /> + <image frame='7' x='33' y='22' width='17' height='13' offsetX='13' offsetY='3' /> + <image frame='8' x='32' y='35' width='16' height='13' offsetX='16' offsetY='3' /> + <image frame='9' x='17' y='0' width='18' height='9' offsetX='14' offsetY='7' /> + <image frame='10' x='35' y='0' width='18' height='9' offsetX='14' offsetY='7' /> + <image frame='11' x='17' y='10' width='18' height='9' offsetX='14' offsetY='7' /> + <image frame='12' x='16' y='49' width='19' height='8' offsetX='13' offsetY='8' /> + <image frame='13' x='16' y='57' width='19' height='8' offsetX='13' offsetY='8' /> + <image frame='14' x='35' y='10' width='18' height='9' offsetX='14' offsetY='7' /> + <image frame='15' x='35' y='49' width='18' height='9' offsetX='14' offsetY='7' /> + <image frame='16' x='35' y='58' width='18' height='8' offsetX='14' offsetY='8' /> + <image frame='17' x='16' y='65' width='19' height='7' offsetX='13' offsetY='9' /> + <image frame='18' equals='15' offsetX='14' offsetY='7' /> + <image frame='19' equals='16' offsetX='14' offsetY='8' /> + <image frame='20' equals='15' offsetX='14' offsetY='7' /> +</tilesheet> diff --git a/games/aground/data/core/specials/specials.xml b/games/aground/data/core/specials/specials.xml new file mode 100644 index 00000000..c31eda3b --- /dev/null +++ b/games/aground/data/core/specials/specials.xml @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="utf-8" ?> +<data> + <lang id="en_US"> + <section id="item.names"> + <text id="golden_sword">Golden Sword</text> + <text id="golden_shield">Golden Shield</text> + <text id="ant">Antpanion</text> + <text id="tank">Tank</text> + <text id="tank_gun">Tank Gun</text> + </section> + </lang> + <include id="weps.xml" /> + <tile id="golden_sword.ico" sheet="weps.2" x="1" /> + <item id="golden_sword" type="equipment" slot="weapon" cost="0" weight="10" melee_range="0.5" durability="4000" icon="golden_sword.ico" attack="6" stamina="3" action="equip" movement_walk="walk_rswing" arms="dragonsword.arms" hitEffect="bullet" repair="gold_bar" knockback="15" sfx="goldensword" /> + <tile id="golden_sword" sheet="weps.1" x="0" /> + <animation id="equipment.golden_sword" equals="equipment.dragonsword" /> + <animation id="equipment.golden_sword.idle" equals="equipment.dragonsword.idle" /> + + <tile id="golden_shield.ico" sheet="weps.2" x="9" /> + <item id="golden_shield" type="equipment" slot="shield" use="block" cost="0" weight="10" defense="4" durability="4000" icon="golden_shield.ico" animation="shield" movement_walk="walk_lswing" action="equip" repair="gold_bar" /> + + <tile id="ant.ico" sheet="weps.2" x="8" /> + <include id="ant.xml" includeRoot="true" /> + <tile id="ant" sheet="ant.png" x="0" y="0" /> + <animation id="ant.idle" count="6" x="15" /> + <animation id="ant.walk" count="6" x="9" /> + <animation id="ant.dig" count="8" x="0"><frame x="15" count="3" /></animation> + <animation id="ant.attack" equals="ant.dig" /> + <animation id="ant.hit" count="1" length="3" x="8" /> + <familiar id="ant" type="ground"> + <breakPower amount="1" /> + <attack type="melee" damage="3" /> + </familiar> + <item id="ant" type="animal" cost="0" weight="2" icon="ant.ico" slot="familiar"> + <action id="equip" /><action id="rename" /> + <familiar id="ant" tile="ant" animation="ant" fps="15" /> + </item> + <enemy id="ant" tile="ant" health="8" defense="2" damage="6" speed="2" type="wyrm" eatTile="sci1.dirt" trapped="ant" capture="6" death_sfx="spider_death" /> + + <tile id="tank_shell.ico" sheet="weps.2" x="2" /> + <tile id="tank_shell" equals="tank_shell.ico" /> + <item id="tank_shell" type="equipment" cost="300" weight="2" icon="tank_shell.ico" attack="6" animation="item6"> + <projectile tile="tank_shell" animation="item6" speed="5" delay="3" offsetX="-20" offsetY="-12" hit_sfx="arrow_hit" hitEffect="explosion_dmg" knockback="10" breakTile="3" breakPower="100" /> + </item> + <recipe id="craft_tank_shell" creates="tank_shell" type="factory" available="getFlag('ng_tank')"> + <item id="sulfur" count="3" /> + <item id="steel_bar" count="1" /> + <item id="silicon" count="1" /> + </recipe> + <tile id="tank.ico" sheet="weps.2" x="0" /> + <item id="tank_gun" type="none" slot="attack" equipOn="tank" cost="0" weight="30" range="10" icon="tank.ico" unequip="false" projectile="tank_shell"> + <action id="setProjectile" /> + </item> + + <include id="tank.xml" includeRoot="true" /> + <tile id="tank" sheet="tank.png" x="0" y="0" /> + <animation id="tank.empty" equals="single" /> + <animation id="tank.idle" equals="single" /> + <animation id="tank.smoke"><frame visible="false" /><frame x="25" count="7" /></animation> + <animation id="tank.move" count="8"><append tile="tank" animation="tank.smoke" /></animation> + <tile id="tank_gun" sheet="tank.png" x="8" /> + <tile id="tank_man" sheet="tank.png" x="17" /> + <animation id="tank_man" x="0" count="8" /> + <animation id="tank_man.ride" x="7" count="1" /> + <animation id="equipment.tank_gun.idle" x="8" count="1"><append tile="tank_man" animation="tank_man.ride" behind="true" /></animation> + <animation id="equipment.tank_gun" x="0" count="8"><append tile="tank_man" animation="tank_man" behind="true" /></animation> + <vehicle id="tank" tile="tank" health="2000" defense="6" speed="3" title="item.names.tank" fuel="5000" max_weight="5000" death_sfx="rock_door" hitDamage="4"> + <repair id="steel_bar" value="100" /><slot id="attack" /><fuel id="refined_oil" fuel="500" /> + <light tile="light.headlamp" offsetX="-61" /> + </vehicle> +</data> \ No newline at end of file diff --git a/games/aground/data/core/specials/tank.png b/games/aground/data/core/specials/tank.png new file mode 100644 index 00000000..6818c86a Binary files /dev/null and b/games/aground/data/core/specials/tank.png differ diff --git a/games/aground/data/core/specials/tank.xml b/games/aground/data/core/specials/tank.xml new file mode 100644 index 00000000..250cbff0 --- /dev/null +++ b/games/aground/data/core/specials/tank.xml @@ -0,0 +1,34 @@ +<tilesheet id='tank.png' width='64' height='32' offsetX="-64" offsetY="-32"> + <image frame='0' x='0' y='0' width='63' height='24' offsetX='65' offsetY='40' /> + <image frame='1' x='0' y='24' width='63' height='24' offsetX='65' offsetY='40' /> + <image frame='2' x='0' y='48' width='63' height='24' offsetX='65' offsetY='40' /> + <image frame='3' x='0' y='72' width='63' height='24' offsetX='65' offsetY='40' /> + <image frame='4' x='63' y='0' width='63' height='24' offsetX='65' offsetY='40' /> + <image frame='5' x='63' y='24' width='63' height='24' offsetX='65' offsetY='40' /> + <image frame='6' x='63' y='48' width='63' height='24' offsetX='65' offsetY='40' /> + <image frame='7' x='63' y='72' width='63' height='24' offsetX='65' offsetY='40' /> + <image frame='8' x='0' y='96' width='47' height='13' offsetX='65' offsetY='30' /> + <image frame='10' x='63' y='96' width='48' height='12' offsetX='65' offsetY='31' /> + <image frame='11' x='126' y='0' width='47' height='12' offsetX='65' offsetY='31' /> + <image frame='12' x='126' y='12' width='91' height='23' offsetX='21' offsetY='25' /> + <image frame='13' x='126' y='35' width='62' height='23' offsetX='50' offsetY='23' /> + <image frame='14' x='126' y='58' width='63' height='24' offsetX='49' offsetY='19' /> + <image frame='15' x='126' y='82' width='59' height='29' offsetX='53' offsetY='14' /> + <image frame='16' x='173' y='0' width='47' height='12' offsetX='65' offsetY='31' /> + <image frame='17' x='47' y='96' width='10' height='11' offsetX='97' offsetY='22' /> + <image frame='25' x='47' y='107' width='4' height='3' offsetX='109' offsetY='61' /> + <image frame='26' x='57' y='96' width='6' height='7' offsetX='111' offsetY='57' /> + <image frame='27' x='111' y='96' width='9' height='8' offsetX='112' offsetY='56' /> + <image frame='28' x='188' y='35' width='10' height='8' offsetX='113' offsetY='56' /> + <image frame='29' x='111' y='104' width='11' height='6' offsetX='116' offsetY='56' /> + <image frame='30' x='188' y='43' width='8' height='5' offsetX='120' offsetY='56' /> + <image frame='31' x='0' y='109' width='4' height='2' offsetX='124' offsetY='59' /> + <image frame='9' equals='8' offsetX='65' offsetY='30' /> + <image frame='18' equals='17' offsetX='97' offsetY='23' /> + <image frame='19' equals='17' offsetX='97' offsetY='24' /> + <image frame='20' equals='17' offsetX='97' offsetY='24' /> + <image frame='21' equals='17' offsetX='97' offsetY='24' /> + <image frame='22' equals='17' offsetX='97' offsetY='24' /> + <image frame='23' equals='17' offsetX='97' offsetY='24' /> + <image frame='24' equals='17' offsetX='97' offsetY='24' /> +</tilesheet> diff --git a/games/aground/data/core/specials/weps.png b/games/aground/data/core/specials/weps.png new file mode 100644 index 00000000..138c21ce Binary files /dev/null and b/games/aground/data/core/specials/weps.png differ diff --git a/games/aground/data/core/specials/weps.xml b/games/aground/data/core/specials/weps.xml new file mode 100644 index 00000000..ee4349b0 --- /dev/null +++ b/games/aground/data/core/specials/weps.xml @@ -0,0 +1,32 @@ +<sheets> +<tilesheet id='weps.1' sheet='weps.png' width='32' height='32' offsetX="-8" offsetY="-8"> + <image frame='0' x='0' y='0' width='19' height='16' offsetX='4' offsetY='15' /> + <image frame='1' x='0' y='16' width='19' height='16' offsetX='4' offsetY='15' /> + <image frame='2' x='0' y='32' width='19' height='11' offsetX='4' offsetY='20' /> + <image frame='3' x='0' y='43' width='19' height='5' offsetX='4' offsetY='26' /> + <image frame='4' x='0' y='48' width='19' height='5' offsetX='4' offsetY='26' /> + <image frame='5' x='19' y='0' width='14' height='14' offsetX='18' offsetY='13' /> + <image frame='10' x='0' y='53' width='5' height='19' offsetX='5' offsetY='9' /> + <image frame='6' equals='5' offsetX='18' offsetY='13' /> + <image frame='7' equals='5' offsetX='19' offsetY='13' /> + <image frame='8' equals='5' offsetX='19' offsetY='13' /> + <image frame='9' equals='5' offsetX='18' offsetY='13' /> +</tilesheet> +<tilesheet id='weps.2' sheet='weps.png' width='16' height='10'> + <image frame='0' x='19' y='16' width='16' height='9' offsetX='0' offsetY='1' /> + <image frame='1' x='19' y='25' width='16' height='5' offsetX='0' offsetY='2' /> + <image frame='2' x='19' y='32' width='8' height='5' offsetX='4' offsetY='2' /> + <image frame='3' x='19' y='37' width='8' height='5' offsetX='4' offsetY='2' /> + <image frame='4' x='27' y='32' width='8' height='5' offsetX='4' offsetY='2' /> + <image frame='5' x='27' y='37' width='8' height='5' offsetX='4' offsetY='2' /> + <image frame='6' x='19' y='43' width='8' height='5' offsetX='4' offsetY='2' /> + <image frame='7' x='27' y='43' width='8' height='5' offsetX='4' offsetY='2' /> + <image frame='8' x='5' y='53' width='16' height='9' offsetX='0' offsetY='1' /> + <image frame='9' x='5' y='62' width='7' height='10' offsetX='4' offsetY='0' /> + <image frame='10' x='12' y='62' width='7' height='10' offsetX='4' offsetY='0' /> + <image frame='11' x='21' y='53' width='7' height='10' offsetX='4' offsetY='0' /> + <image frame='12' x='28' y='53' width='7' height='10' offsetX='4' offsetY='0' /> + <image frame='13' x='21' y='63' width='7' height='10' offsetX='4' offsetY='0' /> + <image frame='14' x='28' y='63' width='7' height='10' offsetX='4' offsetY='0' /> +</tilesheet> +</sheets> \ No newline at end of file diff --git a/games/aground/data/core/start/mountain.xml b/games/aground/data/core/start/mountain.xml new file mode 100644 index 00000000..787f5465 --- /dev/null +++ b/games/aground/data/core/start/mountain.xml @@ -0,0 +1,82 @@ +<?xml version="1.0" encoding="utf-8" ?> +<areas> + <area id="mountain"> + <shape type="trapezoid"> + <top y="0" fromX="11" toX="29" /> + <bottom y="10" fromX="8" toX="31" /> + </shape> + <shape type="trapezoid" bottom="112"> + <top y="10" fromX="2" toX="31" /> + <bottom y="15" fromX="0" toX="32" /> + </shape> + <tiles id="stone" start="0" end="1" /> + <tiles id="snow" top="0" /> + <tiles id="snow_stone" top="1" /> + <tiles id="bedrock" y="111" /> + <run procedure="mountain.dragon_cave" /> + <object id="conifer_snow" x="2" y="9" /> + <objects id="conifer_snow" y="-1" startX="7" endX="28" minDist="6" maxDist="6" /> + <objects id="bush_snow" y="-1" fromX="12" toX="29" percent="0.25" /> + <objects id="red_bush_snow" y="-1" fromX="12" toX="29" percent="0.175" /> + <shore x="32" y="16" top="sand_top" bottom="sand" dock="dock_empty_flip" /> + <action> + for(i in 8...32){setOre(i, 96, "lava"); setOre(i, 98, "lava"); mine(i, 97);} + for(i in 96...111) setTile(7, i, "bedrock"); + </action> + <ore id="diamond" start="0.8" end="1.0" percent="0.0025" tile="stone" /> + <ore id="gold" start="0.3" end="1.0" percent="0.0125" tile="stone" /> + <ore id="iron" start="0.0" end="0.8" percent="0.0375" tile="stone" /> + <ore id="lava" start="0.65" end="0.75" percent="1" tile="stone" /> + <objects id="golem" start="0.7" end="1.0" percent="0.005" tile="stone" /> + <object id="yeti" x="19" y="-1" /> + <objects id="fire_bird" startX="8" endX="31" minDist="6" maxDist="9" y="97" /> + <spawner id="yeti" time="10000" count="1" fromX="13" toX="26" fromY="-1" toY="-1" /> + <spawner id="fire_bird" time="4000" count="4" fromX="8" toX="31" fromY="97" toY="97" /> + <appendArea id="mountain.rocks" offsetX="32" offsetY="16" /> + <structure id="tent" x="4" y="9" /> + <object id="hunter_hotspot" x="-4" y="15" /> + <onLoad> + <action>_x = offsetX+13</action> + <repeat count="4"> + <tile id="mountain_snow" tile_x="random()*8" x="_x" y="offsetY-2" back="true" /> + <action>_x += 4;</action> + </repeat> + <setTile x="32" y="13" tile="empty" /><action>mine(offsetX+32,offsetY+13)</action> + <repeat count="6"> + <tile id="mountain_snow" tile_x="random()*8" x="offsetX+11+random()*16" y="offsetY-2" back="true" /> + </repeat> + <structure id="dragon_lair" x="offsetX+21" y="offsetY+13" if="area.getStructureById('dragon_lair') == null && area.getStructureById('dragon_lair2') == null" /> + <section if="area.getStructureById('tent') == null"> + <removeObjects layer="tree" x="offsetX+2" y="offsetY+9" width="4" /> + <object id="conifer_snow" x="offsetX+2" y="offsetY+9" /> + <structure id="tent" x="offsetX+4" y="offsetY+9" /> + <object id="hunter_hotspot" x="offsetX-4" y="offsetY+15" /> + </section> + <section if="area.getStructureById('recipe_pillar') == null"> + <spreadTiles x="11" y="95" tile="invisible_block" on="stone" count="100" /> + <structure id="recipe_pillar" x="offsetX+11" y="offsetY+95" recipe="make_fire_arrow" /> + </section> + </onLoad> + </area> + <area id="mountain.rocks"> + <shape type="rectangle" x="5" y="-1" width="1" height="16" /> + <shape type="rectangle" x="8" y="0" width="1" height="31" /> + <tiles id="bedrock" start="0" end="1" /> + <onLoad> + <setTile x="5" y="-1" tile="bedrock" /> + <setTile x="8" y="0" tile="bedrock" /> + <setTile x="5" y="-2" tile="bedrock" /> + <setTile x="8" y="-1" tile="bedrock" /> + <setTile x="5" y="0" tile="bedrock" /> + <setTile x="8" y="1" tile="bedrock" /> + </onLoad> + </area> + <procedure id="mountain.dragon_cave"> + <action> + for(y in 8...13) for(x in 20...31) mine(x, y); + for(x in 22...28) mine(x, 7); for(y in 9...12) mine(19, y); + </action> + <object id="adult_dragon" x="23.5" y="12" /> + <structure id="dragon_lair" x="21" y="13" /> + </procedure> +</areas> \ No newline at end of file diff --git a/games/aground/data/core/start/ocean.png b/games/aground/data/core/start/ocean.png new file mode 100644 index 00000000..37a14b3e Binary files /dev/null and b/games/aground/data/core/start/ocean.png differ diff --git a/games/aground/data/core/start/ocean.xml b/games/aground/data/core/start/ocean.xml new file mode 100644 index 00000000..14a26060 --- /dev/null +++ b/games/aground/data/core/start/ocean.xml @@ -0,0 +1,53 @@ +<tilesheet id='ocean.png' width='32' height='32'> + <image frame='0' x='0' y='0' width='31' height='27' offsetX='1' offsetY='5' /> + <image frame='1' x='0' y='27' width='29' height='31' offsetX='2' offsetY='1' /> + <image frame='2' x='0' y='58' width='30' height='26' offsetX='2' offsetY='6' /> + <image frame='3' x='0' y='84' width='29' height='31' offsetX='0' offsetY='1' /> + <image frame='6' x='0' y='115' width='29' height='31' offsetX='0' offsetY='1' /> + <image frame='7' x='31' y='0' width='29' height='31' offsetX='0' offsetY='1' /> + <image frame='8' x='31' y='31' width='29' height='31' offsetX='0' offsetY='1' /> + <image frame='9' x='31' y='62' width='29' height='31' offsetX='0' offsetY='1' /> + <image frame='10' x='31' y='93' width='29' height='31' offsetX='0' offsetY='1' /> + <image frame='11' x='31' y='124' width='29' height='31' offsetX='0' offsetY='1' /> + <image frame='12' x='60' y='0' width='29' height='31' offsetX='0' offsetY='1' /> + <image frame='13' x='60' y='31' width='29' height='32' offsetX='0' offsetY='0' /> + <image frame='14' x='60' y='63' width='29' height='31' offsetX='0' offsetY='1' /> + <image frame='15' x='60' y='94' width='29' height='32' offsetX='0' offsetY='0' /> + <image frame='16' x='60' y='126' width='29' height='31' offsetX='0' offsetY='1' /> + <image frame='17' x='89' y='0' width='29' height='31' offsetX='0' offsetY='1' /> + <image frame='18' x='118' y='0' width='29' height='31' offsetX='0' offsetY='1' /> + <image frame='19' x='147' y='0' width='29' height='31' offsetX='0' offsetY='1' /> + <image frame='25' x='176' y='0' width='29' height='31' offsetX='3' offsetY='1' /> + <image frame='26' x='205' y='0' width='30' height='31' offsetX='2' offsetY='1' /> + <image frame='27' x='89' y='31' width='30' height='31' offsetX='2' offsetY='1' /> + <image frame='28' x='89' y='62' width='29' height='31' offsetX='3' offsetY='1' /> + <image frame='29' x='89' y='93' width='29' height='31' offsetX='3' offsetY='1' /> + <image frame='31' x='89' y='124' width='29' height='31' offsetX='3' offsetY='1' /> + <image frame='32' x='119' y='31' width='29' height='31' offsetX='3' offsetY='1' /> + <image frame='33' x='148' y='31' width='29' height='31' offsetX='3' offsetY='1' /> + <image frame='34' x='177' y='31' width='29' height='31' offsetX='3' offsetY='1' /> + <image frame='35' x='206' y='31' width='29' height='31' offsetX='3' offsetY='1' /> + <image frame='37' x='119' y='62' width='29' height='31' offsetX='3' offsetY='1' /> + <image frame='38' x='148' y='62' width='31' height='31' offsetX='1' offsetY='1' /> + <image frame='39' x='119' y='93' width='29' height='31' offsetX='3' offsetY='1' /> + <image frame='42' x='119' y='124' width='29' height='31' offsetX='3' offsetY='1' /> + <image frame='43' x='179' y='62' width='29' height='31' offsetX='3' offsetY='1' /> + <image frame='44' x='208' y='62' width='29' height='31' offsetX='3' offsetY='1' /> + <image frame='47' x='148' y='93' width='32' height='31' offsetX='0' offsetY='1' /> + <image frame='48' x='148' y='124' width='32' height='31' offsetX='0' offsetY='1' /> + <image frame='49' x='180' y='93' width='32' height='31' offsetX='0' offsetY='1' /> + <image frame='50' x='180' y='124' width='32' height='31' offsetX='0' offsetY='1' /> + <image frame='4' equals='3' offsetX='0' offsetY='1' /> + <image frame='5' equals='3' offsetX='0' offsetY='1' /> + <image frame='20' equals='3' offsetX='0' offsetY='1' /> + <image frame='21' equals='3' offsetX='0' offsetY='1' /> + <image frame='22' equals='3' offsetX='0' offsetY='1' /> + <image frame='23' equals='3' offsetX='0' offsetY='1' /> + <image frame='24' equals='3' offsetX='0' offsetY='1' /> + <image frame='30' equals='29' offsetX='3' offsetY='1' /> + <image frame='36' equals='29' offsetX='3' offsetY='1' /> + <image frame='40' equals='29' offsetX='3' offsetY='1' /> + <image frame='41' equals='29' offsetX='3' offsetY='1' /> + <image frame='45' equals='29' offsetX='3' offsetY='1' /> + <image frame='46' equals='29' offsetX='3' offsetY='1' /> +</tilesheet> diff --git a/games/aground/data/core/start/parallax/bg.png b/games/aground/data/core/start/parallax/bg.png new file mode 100644 index 00000000..5f49b24c Binary files /dev/null and b/games/aground/data/core/start/parallax/bg.png differ diff --git a/games/aground/data/core/start/parallax/clouds.png b/games/aground/data/core/start/parallax/clouds.png new file mode 100644 index 00000000..e2baf9d0 Binary files /dev/null and b/games/aground/data/core/start/parallax/clouds.png differ diff --git a/games/aground/data/core/start/parallax/moon1.png b/games/aground/data/core/start/parallax/moon1.png new file mode 100644 index 00000000..d80fdc35 Binary files /dev/null and b/games/aground/data/core/start/parallax/moon1.png differ diff --git a/games/aground/data/core/start/parallax/moon2.png b/games/aground/data/core/start/parallax/moon2.png new file mode 100644 index 00000000..f9cb8cac Binary files /dev/null and b/games/aground/data/core/start/parallax/moon2.png differ diff --git a/games/aground/data/core/start/parallax/night_bg.png b/games/aground/data/core/start/parallax/night_bg.png new file mode 100644 index 00000000..a56cc686 Binary files /dev/null and b/games/aground/data/core/start/parallax/night_bg.png differ diff --git a/games/aground/data/core/start/parallax/parallax.xml b/games/aground/data/core/start/parallax/parallax.xml new file mode 100644 index 00000000..004dca39 --- /dev/null +++ b/games/aground/data/core/start/parallax/parallax.xml @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="utf-8" ?> +<data> + <tilesheet id="sun.png" width="32" height="32" /> + <tile id="sun" sheet="sun.png" x="0" y="0" /> + <animation id="sun" count="10" /> + + <tilesheet id="clouds.png" width="53" height="20" /> + <tile id="cloud1" sheet="clouds.png" x="0" y="0" /> + <tile id="cloud2" sheet="clouds.png" x="1" y="0" /> + <tile id="cloud3" sheet="clouds.png" x="2" y="0" /> + + <tilesheet id="bg.png" width="256" height="80" /> + <tilesheet id="moon1.png" width="45" height="42" /> + <tilesheet id="moon2.png" width="24" height="23" /> + <tile id="start_moon1" sheet="moon1.png" /> + <tile id="start_moon2" sheet="moon2.png" /> + <include id="tiles256.xml" includeRoot="true" /> + <include id="tiles512.xml" includeRoot="true" /> + <tilesheet id="night_bg.png" width="256" height="144" /> + <procedure id="start.bg"> + <layer p="0" day="false" storm="false" glow="true"> + <tile sheet="{core}/start/parallax/night_bg.png" x="0" y="0" /> + </layer> + <layer p="0" storm="false"> + <tile id="sun" animation="sun" fps="5" rise="5" set="20" dir="left" pathHeight="96" pathTop="-16" sun="true" /> + </layer> + <layer p="0" storm="false" glow="moon"> + <tile id="start_moon1" rise="19" set="6" dir="left" pathHeight="96" pathTop="-16" /> + <tile id="start_moon2" rise="22" set="4" dir="left" pathHeight="96" pathTop="-16" /> + </layer> + <layer p="0" storm="false"> + <clouds><tile id="cloud1" /><tile id="cloud2" /><tile id="cloud3" /></clouds> + </layer> + </procedure> + <procedure id="start.water"> + <layer type="water" image="{core}/start/parallax/water.png" max_depth="80" background="0b3a5a" offsetY="12" /> + <layer type="waves" image="{core}/start/parallax/waves.png" wave_height="4" /> + <layer p="0.0625" py="0.09375" overWater="true" glow="true" scale_py="true"><tile sheet="{core}/start/parallax/tiles256.png" x="7" dy="144" /></layer> + </procedure> + <procedure id="start.doodad" /> + <parallax id="start" mapBG="1b6a9d" mapBGHeight="80" waterLevel="0"> + <layer p="0" day="true"> + <tile sheet="bg.png" x="0" y="0" /> + <rect color="438a9e" x="0" y="80" width="256" height="64" /> + </layer> + <run procedure="start.bg" /> + <layer p="0.046875" py="0.1875" scroll="0.0625"><tile sheet="tiles256.png" x="0" /></layer> + <layer p="0.0625" py="0.25"><tile sheet="tiles256.png" x="6" loop="false" offsetX="16" /></layer> + <layer p="0.09375" py="0.375" scroll="0.125"><tile sheet="tiles256.png" x="1" dy="8" /></layer> + <layer p="0.125" py="0.5"><tile sheet="tiles512.png" x="0" dy="56" loop="false" /></layer> + <layer p="0.25" py="0.75"> + <tile sheet="tiles512.png" x="2" offsetX="-256" dy="32" loop="false" /> + <tile sheet="tiles256.png" x="4" offsetX="256" dy="32" loop="false" /> + <tile sheet="tiles512.png" x="1" offsetX="512" dy="32" loop="false" /> + </layer> + <layer p="0.5" minLoop="1" maxLoop="3" py="1"> + <tile sheet="tiles256.png" x="2" dy="48" cap="left" /> + <tile sheet="tiles256.png" x="5" dy="48" cap="right" /> + <tile sheet="tiles256.png" x="3" dy="48" /> + </layer> + <run procedure="start.doodad" /> + <layer type="back" /><run procedure="start.water" /> + </parallax> + <parallax id="sky" mapBG="1b6a9d" mapBGHeight="80" waterLevel="0"> + <layer p="0" day="true"> + <tile sheet="bg.png" x="0" y="0" /> + <rect color="438a9e" x="0" y="80" width="256" height="64" /> + </layer> + <run procedure="start.bg" /> + <layer p="0.046875" py="0.1875" scroll="0.0625"><tile sheet="tiles256.png" x="0" /></layer> + <layer p="0.09375" py="0.375" scroll="0.125"><tile sheet="tiles256.png" x="1" dy="8" /></layer> + <layer type="back" /><run procedure="start.water" /> + </parallax> +</data> \ No newline at end of file diff --git a/games/aground/data/core/start/parallax/sun.png b/games/aground/data/core/start/parallax/sun.png new file mode 100644 index 00000000..745c1d0e Binary files /dev/null and b/games/aground/data/core/start/parallax/sun.png differ diff --git a/games/aground/data/core/start/parallax/tiles256.png b/games/aground/data/core/start/parallax/tiles256.png new file mode 100644 index 00000000..58431c9a Binary files /dev/null and b/games/aground/data/core/start/parallax/tiles256.png differ diff --git a/games/aground/data/core/start/parallax/tiles256.xml b/games/aground/data/core/start/parallax/tiles256.xml new file mode 100644 index 00000000..16abbbef --- /dev/null +++ b/games/aground/data/core/start/parallax/tiles256.xml @@ -0,0 +1,10 @@ +<tilesheet id='tiles256.png' width='256' height='144'> + <image frame='0' x='0' y='0' width='256' height='33' offsetX='0' offsetY='111' /> + <image frame='1' x='256' y='0' width='256' height='33' offsetX='0' offsetY='111' /> + <image frame='2' x='0' y='33' width='256' height='59' offsetX='0' offsetY='84' /> + <image frame='3' x='0' y='92' width='256' height='59' offsetX='0' offsetY='84' /> + <image frame='4' x='0' y='151' width='256' height='109' offsetX='0' offsetY='34' /> + <image frame='5' x='0' y='260' width='256' height='59' offsetX='0' offsetY='85' /> + <image frame='6' x='256' y='33' width='256' height='142' offsetX='0' offsetY='2' /> + <image frame='7' x='256' y='175' width='256' height='133' offsetX='0' offsetY='11' /> +</tilesheet> diff --git a/games/aground/data/core/start/parallax/tiles512.png b/games/aground/data/core/start/parallax/tiles512.png new file mode 100644 index 00000000..5f432911 Binary files /dev/null and b/games/aground/data/core/start/parallax/tiles512.png differ diff --git a/games/aground/data/core/start/parallax/tiles512.xml b/games/aground/data/core/start/parallax/tiles512.xml new file mode 100644 index 00000000..318ab27f --- /dev/null +++ b/games/aground/data/core/start/parallax/tiles512.xml @@ -0,0 +1,5 @@ +<tilesheet id='tiles512.png' width='512' height='144'> + <image frame='0' x='0' y='0' width='512' height='141' offsetX='0' offsetY='3' /> + <image frame='1' x='0' y='141' width='339' height='101' offsetX='0' offsetY='43' /> + <image frame='2' x='0' y='242' width='391' height='105' offsetX='121' offsetY='39' /> +</tilesheet> diff --git a/games/aground/data/core/start/parallax/water.png b/games/aground/data/core/start/parallax/water.png new file mode 100644 index 00000000..dc7ec103 Binary files /dev/null and b/games/aground/data/core/start/parallax/water.png differ diff --git a/games/aground/data/core/start/parallax/waves.png b/games/aground/data/core/start/parallax/waves.png new file mode 100644 index 00000000..9735f9dc Binary files /dev/null and b/games/aground/data/core/start/parallax/waves.png differ diff --git a/games/aground/data/core/start/start.xml b/games/aground/data/core/start/start.xml new file mode 100644 index 00000000..d1c14d98 --- /dev/null +++ b/games/aground/data/core/start/start.xml @@ -0,0 +1,496 @@ +<?xml version="1.0" encoding="utf-8" ?> +<areas> + <include id="parallax/parallax.xml" /> + <entry id="default" name="entry.default" description="entry.default_desc" player="player.ancient" area="start" x="-1" y="-1"> + <addItem id="meat" count="2" /> + </entry> + <include id="mountain.xml" /> + <procedure id="alchemist_cave"> + <set id="light" value="2" if="!exists('light')" /> + <action> + function setAlchemistCave(x, y){setTile(x, y, "bedrock"); if(random() < 0.25) setOre(x, y, "quartz");} + for(x in 90...94) setAlchemistCave(x, 1, "bedrock"); + for(x in 86...90) setAlchemistCave(x, 2, "bedrock"); for(x in 90...94) mine(x, 2, light, "bedrock"); setAlchemistCave(94, 2, "bedrock"); + for(y in 3...6){ + setAlchemistCave(85, y, "bedrock"); for(x in 86...94) mine(x, y, light, "bedrock"); setAlchemistCave(94, y, "bedrock"); + } for(x in 86...94) setAlchemistCave(x, 6, "bedrock"); mine(92, 1); setAlchemistCave(92, 0, "bedrock"); + </action> + </procedure> + <defaultFishing> + <loot id="toothfish" p="16" difficulty="1" /> + <loot id="rockfish" p="4" difficulty="2" /> + <loot id="coral_cod" p="1" difficulty="3" /> + </defaultFishing> + <area id="sea_floor_bottom" width="_width" height="_height"> + <tiles id="sand" start="0.5" end="1" /><tiles id="sand" y="_height-1" /> + <tiles id="sand_top" top="0" includeShape="false" /> + <ore id="oil" start="0.5" end="1" percent="0.0125" tile="sand" /> + <objects id="coral1" count="2" fromX="0" toX="_width" fromY="-2" toY="_height-2" width="2" height="2" underwater="true" bottom="true" /> + <objects id="coral2" count="2" fromX="0" toX="_width" fromY="-2" toY="_height-2" width="2" height="2" underwater="true" bottom="true" /> + <objects id="coral3" count="2" fromX="0" toX="_width" fromY="-2" toY="_height-2" width="2" height="2" underwater="true" bottom="true" /> + <objects id="coral4" count="2" fromX="0" toX="_width" fromY="-2" toY="_height-2" width="2" height="2" underwater="true" bottom="true" /> + <objects id="coral5" count="2" fromX="0" toX="_width" fromY="-2" toY="_height-2" width="2" height="2" underwater="true" bottom="true" /> + <objects id="seaweed" count="10" fromX="0" toX="_width" fromY="-2" toY="_height-2" width="2" height="2" underwater="true" bottom="true" /> + <objects id="treasure_chest" count="2" fromX="0" toX="_width" fromY="-2" toY="_height-2" underwater="true" bottom="true"> + if(exists('underwater_chest_items')) underwater_chest_items(this); else { + var r = random(); if(r < 0.2) this.inventory.addItems(Item.get("rusty_axe"), 1); + else if(r < 0.4) this.inventory.addItems(Item.get("gold_bar"), 2); + else if(r < 0.5) this.inventory.addItems(Item.get("sugar_seed"), 3); + else if(r < 0.6) this.inventory.addItems(Item.get("water_shell"), 5); + else if(r < 0.7) this.inventory.addItems(Item.get("water_bullet"), 10); + else if(r < 0.8) this.inventory.addItems(Item.get("water_sword"), 1); + else if(r < 0.9) this.inventory.addItems(Item.get("diamond"), 2); + else if(r < 0.95) this.inventory.addItems(Item.get("blood_gem"), 2); + else this.inventory.addItems(Item.get("electric_eel"), 1); + } + </objects> + </area> + <area id="sea_floor"> + <set id="_width" value="-area_left-32" /><set id="_height" value="16" /><appendArea id="sea_floor_bottom" offsetX="area_left+16" offsetY="64" /> + <set id="_width" value="area_right-32-area_width" /><set id="_height" value="16" /><appendArea id="sea_floor_bottom" offsetX="area_width+16" offsetY="64" /> + <action>for(y in 80...90){for(x in area_left-9...-16) setTile(x, y, "blackstone"); for(x in area_width+16...area_right+48) setTile(x, y, "blackstone");}</action> + <action>for(y in 86...area_height){setTile(-16, y, "blackstone"); setTile(area_width+15, y, "blackstone");}</action> + <action>for(x in -16...area_width+15) setTile(x, area_height-1, "blackstone");</action> + </area> + <area id="start" width="96" height="96" background="start" planet="start" runInit="!player.questComplete('hut')"> + <tiles id="dirt" start="0" end="0.5" /> + <tiles id="stone" start="0.5" end="1" /> + <tiles id="grass" y="0" /> + <tiles id="bedrock" y="95" /> + <shore x="-1" top="sand_top" bottom="sand" trans1="dirt_sand1" trans2="dirt_sand2" flip="true" dock="dock_empty" /> + <appendArea id="mountain" offsetX="96" offsetY="-16" /> + <appendArea id="sea_floor"><params area_left="-240" area_right="280" area_width="128" area_height="96" /></appendArea> + <run procedure="alchemist_cave" /> + <ore id="quartz" start="0.4" end="0.5" percent="0.0025" tile="dirt" /> + <ore id="iron" start="0.2" end="0.5" percent="0.0125" tile="dirt" /> + <ore id="iron" start="0.1" end="0.2" percent="0.000625" tile="dirt" /> + <ore id="coal" start="0.0" end="0.4" percent="0.0375" tile="dirt" /> + <ore id="gold" start="0.4" end="0.5" percent="0.000625" tile="dirt" /> + <ore id="diamond" start="0.9" end="1.0" percent="0.0025" tile="stone" /> + <ore id="gold" start="0.5" end="1.0" percent="0.0125" tile="stone" /> + <ore id="iron" start="0.5" end="0.9" percent="0.0375" tile="stone" /> + <ore id="lava" start="0.7" end="0.8" percent="1" tile="stone" /> + <object id="alchemist" x="90" y="5" /> + <objects id="tree" y="-1" startX="35" endX="92" minDist="6" maxDist="9" array="right" /> + <objects id="tree" y="-1" startX="32" endX="4" minDist="-6" maxDist="-9" array="left" /> + <objects id="wyrm" start="0.1" end="0.4" percent="0.0002" tile="dirt" /> + <objects id="golem" start="0.5" end="1.0" percent="0.0075" tile="stone" /> + <object id="treasure_chest" x="35" y="5"> + this.inventory.addItems(Item.get("rusty_axe"), 1); + </object> + <objects id="treasure_chest" start="0.1" end="0.2" count="1" tile="dirt"> + this.inventory.addItems(Item.get("iron_sword"), 1); + this.inventory.addItems(Item.get("iron_armor"), 1); + </objects> + <objects id="treasure_chest" start="0.3" end="0.4" count="1" tile="dirt"> + this.inventory.addItems(Item.get("gold_bar"), 2); + this.inventory.addItems(Item.get("diamond"), 1); + </objects> + <object id="bush" x="39" y="-1" /> + <object id="red_bush" x="30" y="-1" /> + <objects id="bush" y="-1" between="left" pos="0.25" altPos="0.75" percent="0.5" /> + <objects id="bush" y="-1" between="right" pos="0.25" altPos="0.75" percent="0.5" /> + <objects id="red_bush" y="-1" between="left" pos="0.25" altPos="0.75" percent="0.5" /> + <objects id="red_bush" y="-1" between="right" pos="0.25" altPos="0.75" percent="0.5" /> + <objects id="wood" y="-1" fromX="1" toX="36" count="7" /><object id="wood" x="37" /> + <objects id="wood" y="-1" between="right" pos="0.5" percent="0.5" /> + <objects id="rat" startX="0" endX="95" minDist="15" maxDist="25" /> + <spawner id="rat" time="1000" count="6" fromX="3" toX="95" fromY="-1" toY="-1" /> + <spawner id="boar" time="2000" count="5" fromX="3" toX="95" fromY="-1" toY="-1" enabled="player.hasQuest('storehouse') || player.hasQuest('storehouse2')" /> + <spawner id="shadow_cat" time="2000" count="2" fromX="3" toX="95" fromY="-1" toY="-1" enabled="player.questComplete('workshop') && isNight()" /> + <spawner id="spider" time="1000" count="5" fromX="3" toX="95" fromY="-1" toY="-1" enabled="player.questComplete('workshop') && isNight()" /> + <spawner id="wyrm" time="4000" count="3" fromX="1" toX="94" fromY="3" toY="32" tile="dirt" /> + <spawner id="earth_elemental" time="5000" count="1" fromX="3" toX="95" fromY="-1" toY="-1" /> + <spawner id="wood_crate" time="4000" count="3" fromX="-200" toX="-120" fromY="-1" toY="-1" ground="false" enabled="!player.questComplete('pirates')" /> + <spawner id="wood_debris1" time="4000" count="3" fromX="-200" toX="-120" fromY="-1" toY="-1" ground="false" enabled="!player.questComplete('pirates')" /> + <spawner id="wood_debris2" time="3000" count="3" fromX="-200" toX="-120" fromY="-1" toY="-1" ground="false" enabled="!player.questComplete('pirates')" /> + <spawner id="wood" time="1000" count="10" fromX="1" toX="80" fromY="-1" toY="-1" enabled="hasStorm()" /> + <structure id="hut.incomplete" x="34" /> + <run procedure="start.caves" /> + <fishing> + <loot id="rusty_axe" p="6" /> + <loot id="toothfish" p="16" difficulty="1" /> + <loot id="rockfish" p="4" difficulty="2" /> + <loot id="coral_cod" p="1" difficulty="3" /> + </fishing> + <init> + <scene id="intro" show="intro" endWith="fade" /> + <weather type="storm" start="0" power="6" /> + <action>player.renderer.x -= Tile.SIZE; player.renderer.y += Tile.SIZE; player.renderer.scaleX = -1;</action> + <lerp object="player" deltaX="1" deltaY="-1" seconds="1" modal="true" /><wait seconds="0.5" /> + <dialogue section="player" id="storm1" /> + <event overweight="true" once="true"> + <dialogue section="player" id="storm3" if="!player.questComplete('hut')" /> + </event> + </init> + <onLoad> + <tile id="seagull" animation="seagull.walk" x="random()*5" /> + <tile id="seagull" animation="seagull.fly" x="-random()*5" y="-2" /> + <tile id="seagull" animation="seagull.fly" x="-random()*5-1" y="-4" /> + <tile id="seagull" animation="seagull.fly" x="128+random()*5" y="-2" /> + <tile id="seagull" animation="seagull.fly" x="129+random()*5" y="-4" /> + <tile id="redbreast" type="bird" x="random()*23" fromX="0" toX="93" /> + <tile id="redbreast" type="bird" x="23+random()*23" fromX="0" toX="93" /> + <tile id="redbreast" type="bird" x="46+random()*23" fromX="0" toX="93" /> + <tile id="redbreast" type="bird" x="69+random()*23" fromX="0" toX="93" /> + <weather type="snow" fromY="-50" toY="isDate(12,27,7)?-1:-10" /> + <set id="smelter" value="area.getStructureById('smelter')" /> + <structure id="smelter" x="23" if="smelter != null && smelter.tile_x == 22" /> + <music id="start" seconds="1" /> + <appendArea id="sea_floor" if="area.getObject('seaweed') == null"><params area_left="-240" area_right="280" area_width="128" area_height="96" /></appendArea> + <choose> + <remove object="area.getObject('ghost')" if="!isDate(10,31,3)" /> + <object id="ghost" x="45+random()*50" if="area.getObject('ghost') == null" /> + </choose> + <set id="w" value="area.getStructureById('whirlpool')" /><remove structure="w" if="w != null && w.x == -197*Tile.SIZE" /> + <structure id="whirlpool" x="-200" if="(player.hasQuest('powerplant') || player.areas.exists('snow_island')) && area.getStructureById('whirlpool') == null"><teleport area="snow_island" x="-204" y="-1" /></structure> + <action if="version < 56">area.spawner.spawnAll('wood_crate');area.spawner.spawnAll('wood_debris1');area.spawner.spawnAll('wood_debris2');</action> + <action if="area.getObject('area_name_sign') != null">setFlag('area_name_sign', true)</action> + <action if="getFlag('halloween17') && version < 52">var s = area.getStructureById('storehouse'); if(s != null) s.inventory.addItems(Item.get('pumpkin_seed'), 1);</action> + <action if="player.questComplete('orchard') && version < 52">var s = area.getStructureById('storehouse'); if(s != null) s.inventory.addItems(Item.get('orchard_seed'), 1);</action> + <section if="player.questComplete('dock2') && !player.hasQuest('market2') && !getFlag('bombardment')"> + <dialogue section="player" id="market1" /><quest id="market2" ask="false" /> + </section> + <section if="player.hasQuest('dock2') && !player.questComplete('dock2') && area.getObject('dock2_placeholder') == null"><object id="dock2_placeholder" x="0" /></section> + <section if="player.hasQuest('market2') && !player.questComplete('market2') && area.getObject('market2_placeholder') == null"><object id="market2_placeholder" x="7" /></section> + <section if="version < 24"> + <remove structure="area.getStructureById('dock_empty_flip')" /> + <appendArea id="mountain" offsetX="96" offsetY="-16" /> + <run procedure="alchemist_cave" /> + <mine x="92" y="0" /> + </section> + <run procedure="start.caves" if="area.getStructureById('golem') == null && area.getStructureById('golem.active') == null" /> + <remove structure="player.areas.get('science1').getStructureById('boat')" if="area.getStructureById('boat') != null && player.areas.exists('science1')" /> + </onLoad> + <connection area="science1" fromX="-240" toX="330" /> + <connection area="magic1" fromX="280" toX="-250" /> + </area> + <onLoad><action if="player.hasItem('stone_pickaxe') || player.equipment.get('pickaxe').get() != null">player.setFlag('pickaxe', true); player.setFlag('allow_hotkeys', true);</action></onLoad> + <procedure id="start.caves"> + <structure id="golem" x="112" y="94" /> + <set id="cave_x" value="randInt(2, 94)" /> + <structure id="cave" x="cave_x" y="52"> + <teleport area="pumpkin_cave" x="16" y="6" allowReturn="true" /> + </structure> + <spreadTiles x="cave_x" y="52" eval="'markings'+randInt(1,9)" layer="back" on="stone" count="50" /> + <spreadTiles x="116" y="92" eval="'markings'+randInt(1,9)" layer="back" on="stone" count="200" /> + <set id="cave_x" value="randInt(2, 94)" /> + <structure id="cave" x="cave_x" y="62"> + <teleport area="ore_cave" x="32" y="32" allowReturn="true" /> + </structure> + <spreadTiles x="cave_x" y="62" eval="'markings'+randInt(1,9)" layer="back" on="stone" count="50" /> + <set id="cave_x" value="randInt(2, 94)" /> + <structure id="cave" x="cave_x" y="82"> + <teleport area="ice_cave" x="16" y="4" allowReturn="true" /> + </structure> + <spreadTiles x="cave_x" y="82" eval="'markings'+randInt(1,9)" layer="back" on="stone" count="50" /> + <set id="cave_x" value="randInt(2, 94)" /> + <structure id="doorway" x="cave_x" y="92"> + <teleport area="fire_cave" x="4" y="7" allowReturn="true" /> + </structure> + <spreadTiles x="cave_x" y="92" eval="'markings'+randInt(1,9)" layer="back" on="stone" count="50" /> + </procedure> + <structure id="pumpkin_field_dead" width="112" tile="pumpkin_field" name="search" allowSpawn="true"> + <operate> + <choose> + <section if="!player.hasItem('pumpkin_seed')"> + <dialogue section="structure" id="get_pumpkin_seeds" /> + <item id="pumpkin_seed" /> + </section> + <dialogue section="structure" id="search_fail" /> + </choose> + </operate> + </structure> + <area id="pumpkin_cave" width="32" height="8" background="black" canFly="false"> + <tiles id="dirt" start="0" end="0.5" /> + <tiles id="stone" start="0.5" end="1" /> + <tiles id="dirt" y="1" /><tiles id="stone" y="6" /> + <tiles id="dirt_sand1" y="0" /> + <tiles id="bedrock" x="0" /> + <tiles id="bedrock" x="31" /> + <tiles id="bedrock" y="7" /> + <structure id="cave" x="16" y="6" /> + <object id="fire_boar" x="16" y="-1" /> + <spawner id="fire_boar" time="10000" count="1" fromX="1" toX="30" fromY="-1" toY="-1" /> + <spawner id="ghost" time="5000" count="1" fromX="1" toX="30" fromY="-1" toY="-1" /> + <mine x="16" y="6" light="3" /><mine x="17" y="6" light="3" /><mine x="16" y="5" light="3" /><mine x="17" y="5" light="3" /> + <structure id="pumpkin_field_dead" x="2" y="-1" /> + <structure id="pumpkin_field_dead" x="9" y="-1" /> + <structure id="pumpkin_field_dead" x="16" y="-1" /> + <structure id="pumpkin_field_dead" x="23" y="-1" /> + <objects id="jakolantern" y="-1" fromX="0" toX="31" percent="0.125" /> + <init><runAreaLoad /><action>area.spawner.spawnAll('ghost', true)</action></init> + <onLoad> + <weather type="fog" /><music id="magic1" seconds="1" /> + <section if="area.getStructureById('recipe_pillar') == null"> + <structure id="recipe_pillar" x="16" y="4" recipe="make_blood_gem" /> + </section> + <action if="area.getTileString(0,0,BASE_LAYER) == 'bedrock'">for(y in 0...7){setTile(0, y, "blackstone"); setTile(31, y, "blackstone");} for(x in 0...32) setTile(x, 7, "blackstone");</action> + <remove object="area.getObject('miner')" if="area.getLiveCount('miner') > 1" /> + </onLoad> + </area> + <area id="ore_cave" width="64" height="64" background="black" temporary="true"> + <tiles id="stone" start="0" end="1" /> + <tiles id="dirt" start="0.1" end="0.3" /> + <mine start="0.45" end="0.55" /> + <tiles id="blackstone" y="0" /> + <tiles id="blackstone" y="63" /> + <tiles id="blackstone" x="0" /> + <tiles id="blackstone" x="63" /> + <ore id="quartz" start="0.1" end="0.3" percent="0.00125" tile="dirt" /> + <ore id="coal" start="0.1" end="0.3" percent="0.01875" tile="dirt" /> + <ore id="diamond" start="0.9" end="1.0" percent="0.00125" tile="stone" /> + <ore id="gold" start="0.75" end="1.0" percent="0.00625" tile="stone" /> + <ore id="iron" start="0" end="0.9" percent="0.01875" tile="stone" /> + <ore id="lava" start="0.7" end="0.8" percent="1" tile="stone" /> + <objects id="golem" start="0.0" end="1.0" percent="0.00375" tile="stone" /> + <objects id="gold_golem" start="0.45" end="0.55" percent="0.00375" /> + <structure id="cave" x="32" y="32" /> + <mine x="32" y="32" light="3" /><mine x="33" y="32" light="3" /><mine x="32" y="31" light="3" /><mine x="33" y="31" light="3" /> + <set id="chest_x" value="randInt(2, 62)" /> + <object id="treasure_chest" x="chest_x" y="60"> + this.inventory.addItems(Item.get("titanium"), 2); + </object> + <setTile tile="lava" x="chest_x-1" y="60" layer="ore" /> + <setTile tile="lava" x="chest_x+1" y="60" layer="ore" /> + <setTile tile="lava" x="chest_x" y="59" layer="ore" /> + <setTile tile="lava" x="chest_x" y="61" layer="ore" /> + <set id="pillar_x" value="randInt(4, 59)" /> + <set id="pillar_y" value="randInt(6, 57)" /> + <spreadTiles x="pillar_x" y="pillar_y" tile="invisible_block" count="100" /> + <structure id="recipe_pillar" x="pillar_x" y="pillar_y" recipe="transmute_gold" /> + <init><section if="!getFlag('ore_cave')"><action>player.setFlag('ore_cave', true);</action><dialogue section="player" id="ore_cave" /></section></init> + </area> + <area id="ice_cave" width="32" height="8" background="black" canFly="false"> + <tiles id="stone" start="0" end="1" /> + <tiles id="snow" top="0" /> + <tiles id="snow_stone" top="1" /> + <tiles id="bedrock" x="0" /> + <tiles id="bedrock" x="31" /> + <tiles id="bedrock" y="7" /> + <ore id="iron" start="0" end="0.9" percent="0.01875" tile="stone" /> + <object id="treasure_chest" x="randInt(4, 28)" y="-1"> + this.inventory.addItems(Item.get("ice_arrow"), 3); + </object> + <object id="treasure_chest" x="randInt(4, 28)" y="-1"> + this.inventory.addItems(Item.get("ice_shield"), 1); + </object> + <objects id="ice_bush" y="-1" fromX="0" toX="31" percent="0.25" /> + <objects id="yeti" startX="0" endX="31" minDist="6" maxDist="9" y="-1" /> + <spawner id="yeti" time="4000" count="4" fromX="0" toX="31" fromY="-1" toY="-1" /> + <structure id="cave" x="16" y="4" /> + <mine x="16" y="4" light="3" /><mine x="17" y="4" light="3" /><mine x="16" y="3" light="3" /><mine x="17" y="3" light="3" /> + <init><runAreaLoad /></init> + <onLoad> + <weather type="snow" fromY="-50" toY="0" /> + <action if="area.getTileString(0,0,BASE_LAYER) == 'bedrock'">for(y in 0...7){setTile(0, y, "blackstone"); setTile(31, y, "blackstone");} for(x in 0...32) setTile(x, 7, "blackstone");</action> + </onLoad> + </area> + <area id="fire_cave" width="64" height="9" background="black"> + <tiles id="stone" start="0" end="1" /> + <mine y="2" /> + <mine y="6" /> + <tiles id="bedrock" y="0" /> + <tiles id="bedrock" y="4" /> + <tiles id="bedrock" y="8" /> + <tiles id="bedrock" x="0" /> + <tiles id="bedrock" x="63" /> + <mine x="59" y="5" /><mine x="59" y="4" tile="stone" /><mine x="59" y="3" /> + <ore id="lava" start="0" end="1" percent="1" tile="stone" /> + <structure id="doorway" x="4" y="7" /> + <mine x="4" y="7" light="5" /><mine x="5" y="7" light="5" /><mine x="4" y="6" light="5" /><mine x="5" y="6" light="5" /> + <object id="treasure_chest" x="4" y="2"> + this.inventory.addItems(Item.get("fire_gem"), 1); + this.inventory.addItems(Item.get("kitchen_blueprint"), 1); + this.inventory.addItems(Item.get("diamond"), 3); + </object> + <object id="fire_elemental" x="8" y="2" /> + <spawner id="fire_elemental" time="5000" count="1" fromX="1" toX="62" fromY="2" toY="2" /> + <objects id="fire_bird" startX="2" endX="61" minDist="6" maxDist="9" y="6" /> + <object id="fire_bird" x="1" y="6" /> + <object id="fire_bird" x="62" y="6" /> + <spawner id="fire_bird" time="4000" count="8" fromX="1" toX="62" fromY="6" toY="6" /> + <objects id="fire_boar" startX="2" endX="60" minDist="6" maxDist="9" y="2" /> + <object id="fire_boar" x="1" y="2" /> + <object id="fire_boar" x="61" y="2" /> + <spawner id="fire_boar" time="4000" count="8" fromX="1" toX="61" fromY="2" toY="2" /> + <init><runAreaLoad /></init> + <onLoad> + <action if="area.getTileString(0,0,BASE_LAYER) == 'bedrock'">for(y in 1...8){setTile(0, y, "blackstone"); setTile(63, y, "blackstone");} for(x in 0...64){setTile(x, 0, "blackstone"); setTile(x, 8, "blackstone");}</action> + </onLoad> + </area> + <area id="golem_factory" width="16" height="8" background="black" external="start"> + <tiles id="stone" start="0" end="1" /> + <mine y="6" /><mine y="5" /><mine x="9" /><mine x="10" /><mine x="11" /><mine x="12" /> + <tiles id="bedrock" x="0" /> + <tiles id="bedrock" x="15" /> + <tiles id="bedrock" y="0" /> + <tiles id="bedrock" y="7" /> + <ore id="lava" start="0" end="1" percent="1" tile="stone" /> + <ore id="lava" start="0" end="1" percent="1" tile="bedrock" /> + <object id="golemech" x="5" y="6" /> + <structure id="golem_factory" x="7" y="6" /> + <structure id="doorway" x="1" y="6"> + <teleport area="start" x="115" y="94" /> + </structure> + <spawner id="golem" time="0" count="3" fromX="1" toX="14" fromY="1" toY="6" /> + <light x="2" y="5" size="4" /> + <init><runAreaLoad /></init> + <onLoad> + <action if="area.getTileString(0,0,BASE_LAYER) == 'bedrock'">for(y in 1...7){setTile(0, y, "blackstone"); setTile(15, y, "blackstone");} for(x in 0...16){setTile(x, 0, "blackstone"); setTile(x, 7, "blackstone");}</action> + </onLoad> + </area> + + <area id="farming" width="128" height="96" background="start" planet="start"> + <tiles id="dirt" start="0" end="0.5" /> + <tiles id="stone" start="0.5" end="1" /> + <tiles id="grass" y="0" /> + <tiles id="bedrock" y="95" /> + <shore x="-1" top="sand_top" bottom="sand" trans1="dirt_sand1" trans2="dirt_sand2" flip="true" dock="dock_empty" /> + <shore x="128" top="sand_top" bottom="sand" trans1="dirt_sand1" trans2="dirt_sand3" dock="dock_empty_flip" /> + <appendArea id="sea_floor"><params area_left="-240" area_right="280" area_width="128" area_height="96" /></appendArea> + <ore id="quartz" start="0.4" end="0.5" percent="0.0025" tile="dirt" /> + <ore id="iron" start="0.2" end="0.5" percent="0.0125" tile="dirt" /> + <ore id="iron" start="0.1" end="0.2" percent="0.000625" tile="dirt" /> + <ore id="coal" start="0.0" end="0.4" percent="0.0375" tile="dirt" /> + <ore id="gold" start="0.4" end="0.5" percent="0.000625" tile="dirt" /> + <ore id="diamond" start="0.9" end="1.0" percent="0.0025" tile="stone" /> + <ore id="gold" start="0.5" end="1.0" percent="0.0125" tile="stone" /> + <ore id="iron" start="0.5" end="0.9" percent="0.0375" tile="stone" /> + <ore id="lava" start="0.7" end="0.8" percent="1" tile="stone" /> + <objects id="tree" y="-1" startX="4" endX="124" minDist="6" maxDist="9" array="trees" /> + <objects id="wyrm" start="0.1" end="0.4" percent="0.0002" tile="dirt" /> + <objects id="golem" start="0.5" end="1.0" percent="0.0075" tile="stone" /> + <objects id="bush" y="-1" between="trees" pos="0.25" altPos="0.75" percent="0.5" /> + <objects id="red_bush" y="-1" between="trees" pos="0.25" altPos="0.75" percent="0.5" /> + <objects id="rat" startX="0" endX="127" minDist="15" maxDist="25" /> + <spawner id="rat" time="1000" count="6" fromX="3" toX="127" fromY="-1" toY="-1" /> + <spawner id="boar" time="3000" count="5" fromX="3" toX="127" fromY="-1" toY="-1" enabled="!isNight()" /> + <spawner id="shadow_cat" time="2000" count="2" fromX="3" toX="127" fromY="-1" toY="-1" enabled="isNight()" /> + <spawner id="spider" time="1000" count="5" fromX="3" toX="127" fromY="-1" toY="-1" enabled="isNight()" /> + <spawner id="wyrm" time="4000" count="3" fromX="1" toX="126" fromY="3" toY="32" tile="dirt" /> + <objects id="treasure_chest" start="0.05" end="0.15" count="3" tile="dirt"> + this.inventory.addItems(Item.get("wheat_seed"), 2); + </objects> + <objects id="treasure_chest" start="0.05" end="0.15" count="3" tile="dirt"> + this.inventory.addItems(Item.get("orchard_seed"), 1); + </objects> + <objects id="treasure_chest" start="0.05" end="0.15" count="2" tile="dirt"> + this.inventory.addItems(Item.get("sugar_seed"), 1); + </objects> + <objects id="treasure_chest" start="0.05" end="0.15" count="1" tile="dirt"> + this.inventory.addItems(Item.get("cotton_seed"), 1); + </objects> + <objects id="treasure_chest" start="0.05" end="0.15" count="1" tile="dirt"> + this.inventory.addItems(Item.get("rice_seed"), 1); + </objects> + <fishing> + <loot id="rusty_axe" p="6" /> + <loot id="toothfish" p="16" difficulty="1" /> + <loot id="rockfish" p="4" difficulty="2" /> + <loot id="coral_cod" p="1" difficulty="3" /> + </fishing> + <spawner id="earth_elemental" time="5000" count="1" fromX="1" toX="126" fromY="-1" toY="-1" /> + <init><runAreaLoad /></init> + <onLoad> + <tile id="seagull" animation="seagull.walk" x="random()*5" /> + <tile id="seagull" animation="seagull.fly" x="-random()*5" y="-2" /> + <tile id="seagull" animation="seagull.fly" x="-random()*5-1" y="-4" /> + <tile id="seagull" animation="seagull.walk" x="127-random()*5" /> + <tile id="seagull" animation="seagull.fly" x="128+random()*5" y="-2" /> + <tile id="seagull" animation="seagull.fly" x="129+random()*5" y="-4" /> + <tile id="redbreast" type="bird" x="random()*31" fromX="0" toX="125" /> + <tile id="redbreast" type="bird" x="31+random()*31" fromX="0" toX="125" /> + <tile id="redbreast" type="bird" x="62+random()*31" fromX="0" toX="125" /> + <tile id="redbreast" type="bird" x="93+random()*31" fromX="0" toX="125" /> + <music id="start" seconds="1" /> + <appendArea id="sea_floor" if="area.getObject('seaweed') == null"><params area_left="-240" area_right="280" area_width="128" area_height="96" /></appendArea> + </onLoad> + <connection area="labyrinth_end" fromX="-240" toX="160" /> + <connection area="labyrinth_end" fromX="280" toX="-130" /> + </area> + <area id="snow_island" width="128" height="96" background="sky" planet="start"> + <tiles id="stone" start="0" end="1" /> + <tiles id="ice" start="0.2" end="0.25" /> + <tiles id="snow" y="0" /> + <tiles id="snow_stone" y="1" /> + <tiles id="bedrock" y="95" /> + <shore x="-1" top="sand_top" bottom="sand" flip="true" dock="dock_empty" /> + <shore x="128" top="sand_top" bottom="sand" dock="dock_empty_flip" /> + <mine start="0.2" end="0.25" /> + <appendArea id="sea_floor"><params area_left="-240" area_right="340" area_width="128" area_height="96" /></appendArea> + + <ore id="diamond" start="0.8" end="1.0" percent="0.0025" tile="stone" /> + <ore id="sulfur" start="0.3" end="1.0" percent="0.0125" tile="stone" /> + <ore id="iron" start="0.0" end="0.8" percent="0.0125" tile="stone" /> + <ore id="coal" start="0.0" end="0.8" percent="0.0125" tile="stone" /> + <ore id="lava" start="0.65" end="0.75" percent="1" tile="stone" /> + + <objects id="conifer_snow" y="-1" startX="4" endX="124" minDist="6" maxDist="9" array="trees" /> + <objects id="icer" start="0.2" end="0.25" count="8" /> + <objects id="gold_golem" start="0.5" end="1.0" percent="0.0075" tile="stone" /> + <objects id="red_bush_snow" y="-1" between="trees" pos="0.25" altPos="0.75" percent="0.34" /> + <objects id="bush_snow" y="-1" between="trees" pos="0.25" altPos="0.75" percent="0.67" /> + <objects id="ice_chest" start="0.2" end="0.25" count="5"> + this.inventory.addItems(Item.get("steel_bar"), 10); setBack(this.tile_x, this.tile_y, "snow"); + </objects> + <objects id="ice_chest" start="0.2" end="0.25" count="3"> + this.inventory.addItems(Item.get("ice_arrow"), 6); setBack(this.tile_x, this.tile_y, "snow"); + </objects> + <objects id="ice_chest" start="0.2" end="0.25" count="1"> + this.inventory.addItems(Item.get("ice_sword"), 1); setBack(this.tile_x, this.tile_y, "snow"); + </objects> + <objects id="ice_chest" start="0.2" end="0.25" count="1"> + this.inventory.addItems(Item.get("hut_blueprint"), 1); setBack(this.tile_x-offsetX, this.tile_y-offsetY, "snow"); + </objects> + <action> + for(i in 0...128){setOre(i, 71, "lava"); setOre(i, 73, "lava"); mine(i, 72);} + </action> + <objects id="yeti" startX="3" endX="125" minDist="15" maxDist="25" /> + <spawner id="yeti" time="4000" count="6" fromX="3" toX="125" fromY="-1" toY="-1" /> + <objects id="fire_bird" startX="1" endX="126" minDist="12" maxDist="15" y="72" /> + <spawner id="fire_bird" time="4000" count="8" fromX="1" toX="126" fromY="72" toY="72" /> + <object id="treasure_chest" x="32" y="72">this.inventory.addItems(Item.get("fire_arrow"), 10);</object> + <object id="treasure_chest" x="95" y="72">this.inventory.addItems(Item.get("fire_sword"), 1);</object> + <object id="ice_elemental" x="91" y="-1" /> + <spawner id="ice_elemental" time="5000" count="1" fromX="3" toX="124" fromY="-1" toY="-1" /> + <set id="w" value="area.getStructureById('whirlpool')" /><remove structure="w" if="w != null && w.x == -197*Tile.SIZE" /> + <structure id="whirlpool" x="-200"><teleport area="start" x="-204" y="-1" /></structure> + <structure id="recipe_pillar" x="7" recipe="make_ice_arrow" /> + <structure id="recipe_pillar" x="117" recipe="make_ice_sword" /> + <init><runAreaLoad /></init> + <onLoad> + <music id="nightly" seconds="1" /> + <weather type="snow" fromY="-50" toY="0" /> + <repeat count="10"> + <tile id="mountain_snow" tile_x="random()*8" x="offsetX+2+random()*125" y="offsetY-2" back="true" /> + </repeat><appendArea id="sea_floor" if="area.getObject('seaweed') == null"><params area_left="-240" area_right="340" area_width="128" area_height="96" /></appendArea> + </onLoad> + <fishing> + <loot id="rusty_axe" p="6" /> + <loot id="toothfish" p="16" difficulty="1" /> + <loot id="rockfish" p="4" difficulty="2" /> + <loot id="coral_cod" p="1" difficulty="3" /> + </fishing> + <connection area="snow_island" fromX="-240" toX="-230" /> + <connection area="labyrinth_end" fromX="340" toX="-130" /> + </area> + + <include id="ocean.xml" includeRoot="true" /> + <tile id="coral1" sheet="ocean.png" /> + <tile id="coral2" x="1" sheet="ocean.png" /> + <tile id="coral3" x="2" sheet="ocean.png" /> + <tile id="coral4" x="3" sheet="ocean.png" /> + <tile id="coral5" x="25" sheet="ocean.png" /> + <animation id="coral" count="22"><frame x="21" length="12" /></animation> + <tile id="seaweed" x="47" sheet="ocean.png" /> + <animation id="seaweed" count="4" /> + <object id="seaweed" tile="seaweed" animation="seaweed" fps="5" layer="top" blocking="true" /> + <object id="coral1" tile="coral1" layer="bush" /> + <object id="coral2" tile="coral2" layer="bush" /> + <object id="coral3" tile="coral3" layer="bush" /> + <object id="coral4" tile="coral4" animation="coral" fps="10" layer="bush"> + <overSecond><action>player.addOxygen(5)</action></overSecond> + </object> + <object id="coral5" tile="coral5" animation="coral" fps="10" layer="bush" /> +</areas> \ No newline at end of file diff --git a/games/aground/data/core/structures/boat.png b/games/aground/data/core/structures/boat.png new file mode 100644 index 00000000..f666fe0a Binary files /dev/null and b/games/aground/data/core/structures/boat.png differ diff --git a/games/aground/data/core/structures/boat_rail.png b/games/aground/data/core/structures/boat_rail.png new file mode 100644 index 00000000..aae58e12 Binary files /dev/null and b/games/aground/data/core/structures/boat_rail.png differ diff --git a/games/aground/data/core/structures/cage.png b/games/aground/data/core/structures/cage.png new file mode 100644 index 00000000..86bf0a6c Binary files /dev/null and b/games/aground/data/core/structures/cage.png differ diff --git a/games/aground/data/core/structures/cave.png b/games/aground/data/core/structures/cave.png new file mode 100644 index 00000000..4b0e6ad1 Binary files /dev/null and b/games/aground/data/core/structures/cave.png differ diff --git a/games/aground/data/core/structures/crafting.xml b/games/aground/data/core/structures/crafting.xml new file mode 100644 index 00000000..8ffc0d4f --- /dev/null +++ b/games/aground/data/core/structures/crafting.xml @@ -0,0 +1,217 @@ +<?xml version="1.0" encoding="utf-8" ?> +<recipes> + <recipe id="fuel_wood" fuel="10" type="fuel"><item id="wood" /></recipe> + <recipe id="fuel_coal" fuel="20" type="fuel"><item id="coal" /></recipe> + <recipe id="smelt_iron" creates="iron_bar" type="smelter"> + <item id="iron" count="2" /> + </recipe> + <recipe id="smelt_steel" creates="steel_bar" type="smelter"> + <item id="iron_bar" count="1" /> + <item id="coal" count="2" /> + </recipe> + <recipe id="smelt_gold" creates="gold_bar" type="smelter"> + <type id="tech_resource" /> + <item id="gold" count="2" /> + </recipe> + <recipe id="smelt_coal" creates="coal" type="smelter" fuel_cost="10"><item id="wood" count="3" /></recipe> + <recipe id="craft_fence" creates="fence" type="workbench"> + <item id="wood" count="2" /> + </recipe> + <recipe id="craft_sign" creates="sign" type="workbench"> + <item id="wood" count="2" /> + </recipe> + <recipe id="craft_area_name_sign" creates="area_name_sign" type="workbench" available="getFlag('area_name_sign') || getFlag('jump_water')"> + <item id="wood" count="2" /><item id="gold_bar" count="1" /> + </recipe> + <recipe id="craft_torch" creates="torch" type="workbench"> + <item id="wood" count="1" /> + <item id="coal" count="1" /> + </recipe> + <recipe id="craft_campfire" creates="campfire" type="workbench" value="0"> + <item id="wood" count="3" /> + </recipe> + <recipe id="craft_workbench" creates="workbench" type="workbench"> + <item id="wood" count="5" /> + </recipe> + <recipe id="craft_anvil" creates="anvil" type="workbench"> + <item id="iron_bar" count="1" /> + </recipe> + <recipe id="craft_furnace" creates="furnace" type="workbench" value="0"> + <item id="steel_bar" count="5" /><item id="coal" count="2" /> + </recipe> + <recipe id="craft_chest" creates="chest" type="workbench"> + <item id="wood" count="5" /> + </recipe> + <recipe id="craft_trap" creates="trap" type="workbench"> + <item id="wood" count="1" /> + <item id="iron" count="1" /> + </recipe> + <recipe id="craft_arrow" creates="arrow" count="2" type="workbench"> + <item id="wood" count="1" /> + </recipe> + <recipe id="craft_bow" creates="bow" type="workbench"> + <item id="wood" count="4" /> + <item id="iron_bar" count="1" /> + </recipe> + <recipe id="craft_iron_pickaxe" creates="iron_pickaxe" type="workbench"> + <item id="iron_bar" count="2" /> + </recipe> + <recipe id="craft_iron_sword" creates="iron_sword" type="workbench"> + <item id="iron_bar" count="1" /> + </recipe> + <recipe id="craft_iron_armor" creates="iron_armor" type="workbench"> + <item id="iron_bar" count="3" /> + </recipe> + <recipe id="craft_buckler" creates="buckler" type="workbench"> + <item id="wood" count="2" /> + <item id="iron" count="1" /> + </recipe> + <recipe id="craft_shovel" creates="shovel" type="workbench"> + <item id="wood" count="2" /><item id="iron_bar" count="1" /> + </recipe> + <recipe id="craft_steel_pickaxe" creates="steel_pickaxe" type="workshop"> + <item id="steel_bar" count="3" /> + </recipe> + <recipe id="craft_steel_sword" creates="steel_sword" type="workshop"> + <item id="steel_bar" count="2" /> + </recipe> + <recipe id="craft_steel_axe" creates="steel_axe" type="workshop"> + <item id="steel_bar" count="2" /> + </recipe> + <recipe id="craft_steel_hammer" creates="steel_hammer" type="workshop"> + <item id="steel_bar" count="2" /> + </recipe> + <recipe id="craft_steel_armor" creates="steel_armor" type="workshop"> + <item id="steel_bar" count="4" /> + </recipe> + <recipe id="craft_recurve_bow" creates="recurve_bow" type="workshop"> + <item id="bow" count="1" /> + <item id="silk" count="4" /> + <item id="steel_bar" count="1" /> + </recipe> + <recipe id="craft_kite_shield" creates="kite_shield" type="workshop"> + <item id="steel_bar" count="2" /> + </recipe> + <recipe id="craft_coin_purse" creates="coin_purse" value="0" type="workshop" available="player.questComplete('market') || player.questComplete('market2')"> + <item id="silk" count="6" /> + </recipe> + <recipe id="craft_steel_workbench" creates="steel_workbench" type="workshop"> + <item id="workbench" count="1" /> + <item id="steel_bar" count="5" /> + </recipe> + <recipe id="craft_minecart" creates="minecart" type="workshop"> + <item id="iron_bar" count="5" /> + </recipe> + <recipe id="craft_rail" creates="rail" type="workshop" count="4"> + <item id="iron" count="1" /><item id="wood" count="1" /> + </recipe> + <recipe id="craft_crowbar" creates="crowbar" type="workshop"> + <item id="iron_bar" count="1" /> + </recipe> + <recipe id="craft_lantern" creates="lantern" type="workshop" value="0"> + <item id="iron_bar" count="2" /><item id="quartz" count="1" /> + </recipe> + <recipe id="cook_steak" creates="steak" type="kitchen"> + <item id="meat" count="1" /> + </recipe> + <recipe id="cook_bread" creates="bread" type="kitchen"> + <item id="wheat" count="2" /> + </recipe> + <recipe id="cook_hamburger" creates="hamburger" type="kitchen"> + <item id="meat" count="1" /><item id="bread" count="2" /> + </recipe> + <recipe id="cook_pie" creates="pie" type="kitchen"> + <item id="wheat" count="1" /><item id="berries" count="2" /> + </recipe> + <recipe id="cook_pancakes" creates="pancakes" type="kitchen"> + <item id="wheat" count="1" /><item id="milk" count="1" /><item id="eggs" count="1" /> + </recipe> + <recipe id="make_cheese" creates="cheese" type="kitchen2"> + <item id="milk" count="2" /> + </recipe> + <recipe id="cook_pizza" creates="pizza" type="kitchen2" achievement="pizza"> + <item id="wheat" count="2" /><item id="cheese" count="1" /> + </recipe> + <recipe id="cook_omelette" creates="omelette" type="kitchen2"> + <item id="eggs" count="2" /><item id="meat" count="1" /><item id="cheese" count="1" /> + </recipe> + <recipe id="cook_cheeseburger" creates="cheeseburger" type="kitchen2"> + <item id="meat" count="1" /><item id="bread" count="2" /><item id="cheese" count="1" /> + </recipe> + <recipe id="cook_cheeseburger2" creates="cheeseburger" type="kitchen2"> + <item id="hamburger" count="1" /><item id="cheese" count="1" /> + </recipe> + <recipe id="cook_cake" creates="cake" type="kitchen2"> + <item id="wheat" count="2" /><item id="milk" count="1" /><item id="eggs" count="1" /><item id="sugar" count="1" /> + </recipe> + <recipe id="cook_candy_apple" creates="candy_apple" type="kitchen2"> + <item id="fruit" count="1" /><item id="sugar" count="1" /> + </recipe> + <recipe id="boat" object="boat" description="item.descriptions.boat" available="(area.id != 'start' || (player.questComplete('market') || player.questComplete('market2'))) && area.getStructureById('boat') == null"> + <item id="wood" count="9" /> + <item id="steel_bar" count="9" /> + <item id="cloth" count="9" /> + <item id="net" count="9" /> + <craft> + <section if="area.id == 'start' && player.tile_x < 7 && !player.questComplete('boat')"> + <closeWindows /><complete quest="boat" inventory="inventory" /><structure id="boat" x="-4" /><stop /> + </section> + </craft> + </recipe> + <recipe id="make_cloth" creates="cloth" type="dock"> + <type id="net" /><item id="cotton" count="4" /> + </recipe> + <recipe id="make_net" creates="net" type="dock"> + <type id="net" /><item id="cloth" count="2" /> + </recipe> + <recipe id="make_fishing_rod" creates="fishing_rod" type="dock"> + <item id="wood" count="2" /> + <item id="cotton" count="1" /> + </recipe> + <recipe id="make_attack_potion" creates="attack_potion" type="lab"> + <item id="red_berries" count="4" /> + </recipe> + <recipe id="make_defense_potion" creates="defense_potion" type="lab"> + <item id="ice_berries" count="2" /> + </recipe> + <recipe id="make_health_potion" creates="health_potion" type="lab"> + <item id="dragonblood" count="1" /> + <item id="red_berries" count="2" /> + </recipe> + <recipe id="make_stamina_potion" creates="stamina_potion" type="lab"> + <item id="dragonblood" count="1" /> + <item id="berries" count="4" /> + </recipe> + <recipe id="make_speed_potion" creates="speed_potion" type="lab"> + <item id="dragonblood" count="1" /> + <item id="eggs" count="2" /> + </recipe> + <recipe id="make_endurance_potion" creates="endurance_potion" type="lab"> + <item id="dragonblood" count="1" /> + <item id="meat" count="2" /> + </recipe> + <recipe id="transmute_gold" creates="gold" type="enchantments"> + <item id="iron" count="1" /><item id="alter_gem" count="1" defineLater="true" /> + </recipe> + <recipe id="make_ice_arrow" creates="ice_arrow" type="enchantments"> + <item id="arrow" count="1" /> + <item id="yeti_fur" count="1" /> + </recipe> + <recipe id="make_shadow_cape" creates="shadow_cape" type="enchantments"> + <type id="witch" /> + <type id="lab" available="getFlag('alchemist.shadow_cape')" /> + <item id="dark_fur" count="4" /> + </recipe> + <recipe id="make_ice_shield" creates="ice_shield" type="lab"> + <type id="enchantments" /> + <item id="kite_shield" count="1" /> + <item id="dragonblood" count="1" /> + <item id="diamond" count="1" /> + </recipe> + <recipe id="make_thunder_axe" creates="thunder_axe" type="enchantments" > + <type id="lab" available="player.questComplete('thunder_axe')" /> + <item id="rusty_axe" count="1" /> + <item id="fire_tusk" count="1" /> + <item id="diamond" count="1" /> + </recipe> +</recipes> \ No newline at end of file diff --git a/games/aground/data/core/structures/dock.png b/games/aground/data/core/structures/dock.png new file mode 100644 index 00000000..d1f60057 Binary files /dev/null and b/games/aground/data/core/structures/dock.png differ diff --git a/games/aground/data/core/structures/dock_front.png b/games/aground/data/core/structures/dock_front.png new file mode 100644 index 00000000..04e46c04 Binary files /dev/null and b/games/aground/data/core/structures/dock_front.png differ diff --git a/games/aground/data/core/structures/dockhouse.png b/games/aground/data/core/structures/dockhouse.png new file mode 100644 index 00000000..9adb97c0 Binary files /dev/null and b/games/aground/data/core/structures/dockhouse.png differ diff --git a/games/aground/data/core/structures/doorway.png b/games/aground/data/core/structures/doorway.png new file mode 100644 index 00000000..5a781d2c Binary files /dev/null and b/games/aground/data/core/structures/doorway.png differ diff --git a/games/aground/data/core/structures/dragon_lair.png b/games/aground/data/core/structures/dragon_lair.png new file mode 100644 index 00000000..1ce8afd3 Binary files /dev/null and b/games/aground/data/core/structures/dragon_lair.png differ diff --git a/games/aground/data/core/structures/dragon_lair_fx.png b/games/aground/data/core/structures/dragon_lair_fx.png new file mode 100644 index 00000000..791d4e70 Binary files /dev/null and b/games/aground/data/core/structures/dragon_lair_fx.png differ diff --git a/games/aground/data/core/structures/dragon_lair_fx.xml b/games/aground/data/core/structures/dragon_lair_fx.xml new file mode 100644 index 00000000..817f96e0 --- /dev/null +++ b/games/aground/data/core/structures/dragon_lair_fx.xml @@ -0,0 +1,14 @@ +<tilesheet id='dragon_lair_fx.png' width='192' height='112'> + <image frame='0' x='0' y='0' width='119' height='84' offsetX='17' offsetY='17' /> + <image frame='1' x='119' y='0' width='123' height='83' offsetX='15' offsetY='17' /> + <image frame='2' x='0' y='84' width='123' height='89' offsetX='15' offsetY='13' /> + <image frame='3' x='0' y='173' width='120' height='94' offsetX='16' offsetY='11' /> + <image frame='4' x='0' y='267' width='121' height='90' offsetX='16' offsetY='14' /> + <image frame='5' x='123' y='84' width='121' height='85' offsetX='16' offsetY='13' /> + <image frame='6' x='123' y='169' width='65' height='98' offsetX='58' offsetY='12' /> + <image frame='7' x='123' y='267' width='64' height='101' offsetX='56' offsetY='9' /> + <image frame='8' x='188' y='169' width='71' height='100' offsetX='56' offsetY='10' /> + <image frame='9' x='188' y='269' width='69' height='101' offsetX='60' offsetY='9' /> + <image frame='10' x='259' y='169' width='69' height='103' offsetX='64' offsetY='7' /> + <image frame='11' x='259' y='272' width='68' height='99' offsetX='64' offsetY='11' /> +</tilesheet> diff --git a/games/aground/data/core/structures/farm.png b/games/aground/data/core/structures/farm.png new file mode 100644 index 00000000..ebde723a Binary files /dev/null and b/games/aground/data/core/structures/farm.png differ diff --git a/games/aground/data/core/structures/farm_halloween.png b/games/aground/data/core/structures/farm_halloween.png new file mode 100644 index 00000000..57f47eb1 Binary files /dev/null and b/games/aground/data/core/structures/farm_halloween.png differ diff --git a/games/aground/data/core/structures/food_market.png b/games/aground/data/core/structures/food_market.png new file mode 100644 index 00000000..f6f43ad8 Binary files /dev/null and b/games/aground/data/core/structures/food_market.png differ diff --git a/games/aground/data/core/structures/golem.png b/games/aground/data/core/structures/golem.png new file mode 100644 index 00000000..87e6dbb0 Binary files /dev/null and b/games/aground/data/core/structures/golem.png differ diff --git a/games/aground/data/core/structures/golemfactory.png b/games/aground/data/core/structures/golemfactory.png new file mode 100644 index 00000000..c81f3f8f Binary files /dev/null and b/games/aground/data/core/structures/golemfactory.png differ diff --git a/games/aground/data/core/structures/hut.png b/games/aground/data/core/structures/hut.png new file mode 100644 index 00000000..a84e671c Binary files /dev/null and b/games/aground/data/core/structures/hut.png differ diff --git a/games/aground/data/core/structures/kitchen.png b/games/aground/data/core/structures/kitchen.png new file mode 100644 index 00000000..f8c4f3ef Binary files /dev/null and b/games/aground/data/core/structures/kitchen.png differ diff --git a/games/aground/data/core/structures/kitchen2.png b/games/aground/data/core/structures/kitchen2.png new file mode 100644 index 00000000..b68a2ff4 Binary files /dev/null and b/games/aground/data/core/structures/kitchen2.png differ diff --git a/games/aground/data/core/structures/lab.png b/games/aground/data/core/structures/lab.png new file mode 100644 index 00000000..176a9fbf Binary files /dev/null and b/games/aground/data/core/structures/lab.png differ diff --git a/games/aground/data/core/structures/markets.png b/games/aground/data/core/structures/markets.png new file mode 100644 index 00000000..c9033540 Binary files /dev/null and b/games/aground/data/core/structures/markets.png differ diff --git a/games/aground/data/core/structures/pen.png b/games/aground/data/core/structures/pen.png new file mode 100644 index 00000000..0e69dee9 Binary files /dev/null and b/games/aground/data/core/structures/pen.png differ diff --git a/games/aground/data/core/structures/smelter.png b/games/aground/data/core/structures/smelter.png new file mode 100644 index 00000000..c3241eca Binary files /dev/null and b/games/aground/data/core/structures/smelter.png differ diff --git a/games/aground/data/core/structures/storehouse.png b/games/aground/data/core/structures/storehouse.png new file mode 100644 index 00000000..95a266ae Binary files /dev/null and b/games/aground/data/core/structures/storehouse.png differ diff --git a/games/aground/data/core/structures/structures.xml b/games/aground/data/core/structures/structures.xml new file mode 100644 index 00000000..6f7b84f7 --- /dev/null +++ b/games/aground/data/core/structures/structures.xml @@ -0,0 +1,686 @@ +<?xml version="1.0" encoding="utf-8" ?> +<structures> + <animation id="hut.idle" count="1" x="3" y="0" /> + <animation id="hut.closing" count="4" /> + <animation id="hut.opening" count="4" reverse="true" /> + <animation id="hut.fire" count="3" y="1" /> + <animation id="hut.night.idle" equals="hut.fire" /> + <animation id="hut.night.fire" equals="hut.fire" /> + <animation id="hut.night.closing" equals="hut.fire" /> + <structure id="hut" width="60" height="55" image="hut.png" sleep="true" nightAnimation="hut.night"> + <operate> + <action>this.loopAnimation("fire"); this.playSFX("fire");</action> + <choose if="area.id == 'start' && !getFlag('bombardment') && !getFlag('final_boss_defeat')"> + <scene id="hut" show="second" with="fade" if="getFlag('pickaxe') && !getFlag('miner_hut')" showToAll="true"> + <action>setFlag('miner_hut', true);</action> + </scene> + <scene id="hut" show="third" with="fade" if="player.hasQuest('farm') && !getFlag('farmer_hut')" showToAll="true"> + <action>setFlag('farmer_hut', true);</action> + </scene> + <scene id="hut" show="fourth" with="fade" if="getVar('trader_steal') == 5" showToAll="true"> + <action>setVar('trader_steal', 6);</action> + </scene> + <scene id="hut" show="hunter" with="fade" if="player.hasQuest('hunt') && !getFlag('hunter_hut') && area.getNPC('hunter') != null" showToAll="true"> + <action>setFlag('hunter_hut', true);</action> + </scene> + <scene id="hut" show="mirrows" with="fade" if="player.hasQuest('mirrows') && !getFlag('mirrows_hut')" showToAll="true"> + <action>setFlag('mirrows_hut', true);</action> + </scene> + </choose> + <action>player.restoreStamina();</action><save sleep="true" /> + </operate> + <exit><action>this.stopSFX()</action></exit> + <light tile="light.large" color="fae1b5" flicker="true" offsetX="30" offsetY="45" ifAnim="fire" /> + </structure> + + <animation id="hut.incomplete.idle" count="1" x="7" /> + <procedure id="complete.hut"> + <complete quest="hut" /> + <action>player.inventory.addAll(this.inventory);</action> + <sound id="build" /> + <scene id="hut" show="first" with="fade" showToAll="true" /> + </procedure> + <structure id="hut.incomplete" width="60" height="55" image="hut.png" type="storehouse" main="true"> + <tooltip section="actions" id="repair" /> + <operate> + <choose><section if="!player.hasQuest('hut')"> + <dialogue section="player" id="hut1" /> + <quest id="hut"> + <section if="player.getItemCount('wood') > 0"> + <action>var wood = getItem("wood"); ct = player.inventory.getItemCount(wood); if(ct > 8) ct = 8; player.inventory.addItems(wood, -ct); this.inventory.addItems(wood, ct);</action> + <dialogue eval="'player.hut3{added:'+ct+'}{remaining:'+Utils.max(0, getQuest('hut').getRequirementById('wood').count-player.getItemCountStorehouse('wood'))+'}'" /> + </section> + </quest> + <run procedure="complete.hut" if="player.canCompleteQuest('hut')" /> + </section> + <run procedure="complete.hut" if="player.canCompleteQuest('hut')" /> + <section if="player.getItemCount('wood') > 0"> + <action>var wood = getItem("wood"); ct = player.inventory.getItemCount(wood); player.inventory.addItems(wood, -ct); this.inventory.addItems(wood, ct);</action> + <dialogue eval="'player.hut3{added:'+ct+'}{remaining:'+(getQuest('hut').getRequirementById('wood').count-player.getItemCountStorehouse('wood'))+'}'" /> + </section> + <dialogue eval="'player.hut2{count:'+player.getItemCountStorehouse('wood')+'}'" /> + </choose><stop /> + </operate> + </structure> + + <animation id="storehouse.idle" equals="single" /> + <animation id="storehouse.closing" count="9" reverse="true" /> + <animation id="storehouse.opening" count="9" /> + <structure id="storehouse" width="66" height="70" image="storehouse.png" type="storehouse" main="true"> + <operate> + <action if="!player.hasItemStorehouse('stone_pickaxe') && player.getFlag('pickaxe')">this.inventory.addItems(Item.get("stone_pickaxe"), 1)</action> + <action if="!player.hasItemStorehouse('stone_axe')">this.inventory.addItems(Item.get("stone_axe"), 1)</action> + <choose> + <section if="getVar('trader_steal') > 1 && getVar('trader_steal') < 4 && player.questComplete('workshop') && !player.hasQuest('market')"> + <action>setVar('trader_steal', 4);</action> + <dialogue section="trader" id="caught" /> + <section with="fade"> + <facing object="player" dir="right" /> + <!-- NOTE: this line is to remove a duplicate trader for old saves that placed the trader before this event. --> + <action>var trader = player.area.getNPC('trader'); if(trader != null) player.area.removeObject(trader);</action> + <object id="trader" x="player.tile_x+1" /> + </section> + <dialogue section="trader" id="introduce1" speaker="player" /> + <dialogue section="trader" id="introduce2" speaker="trader" /> + <dialogue section="trader" id="introduce3" speaker="player" /> + <dialogue section="trader" id="introduce4" speaker="trader" /> + <dialogue section="trader" id="introduce5" speaker="player" /> + <menu section="trader" yalign="0.75"> + <dialogue section="trader" id="introduce6" speaker="trader" /> + <choice id="accept"> + <action>setVar('trader_steal', 5);</action> + <quest id="market" ask="false" /> + <dialogue section="trader" id="introduce7" speaker="player" /> + </choice> + <choice id="reject"> + <dialogue section="trader" id="introduce8" speaker="player" /> + <dialogue section="trader" id="introduce9" speaker="trader" /> + <lerp object="trader" alpha="0" seconds="0.25" /> + <remove object="trader" /> + <dialogue section="player" id="dock1" /> + <object id="dock2_placeholder" x="0" /><pan toObject="dock2_placeholder" seconds="0.25" /> + <dialogue section="player" id="dock2" /> + <quest id="dock2" ask="false" /><pan toObject="player" seconds="0.25" /> + </choice> + </menu> + <stop/> + </section> + <function object="this" run="stealItem" if="getVar('trader_steal') < 3 && player.questComplete('smelter') && random() < 0.75 && !player.hasQuest('market')"> + <action>setVar('trader_steal', getVar('trader_steal')+1);</action> + </function> + </choose> + </operate> + <over><action>this.playSFX("rock_door", false);</action></over> + <out><action>this.playSFX("rock_door", false);</action></out> + </structure> + + <animation id="workshop.idle" equals="single" /> + <animation id="workshop.on" count="8" x="1" y="0" /> + <structure id="workshop" width="65" height="35" image="workshop.png" type="crafting"> + <recipe type="workshop" /> + <recipe type="workbench" /> + <over><action>this.loopAnimation("on")</action></over> + <out><action>this.loopAnimation("idle")</action></out> + <craft><action>this.playSFX("workshop", false);</action></craft> + </structure> + + <animation id="smelter.off" equals="single" /> + <animation id="smelter.on" count="4" x="1" y="0" /> + <animation id="smelter.smelt" count="12" x="2" y="1" /> + <structure id="smelter" width="68" height="50" image="smelter.png" type="smelter" loop="smelter_loop"> + <recipe type="fuel" /> + <recipe type="smelter" /> + <light tile="light.default" color="fae1b5" flicker="true" offsetX="53" offsetY="42" ifAnim="!off" /> + </structure> + + <animation id="kitchen.close.off" equals="single" /> + <animation id="kitchen.open.off" count="1" x="1" y="0" /> + <animation id="kitchen.close.on" count="4" x="2" y="0" /> + <animation id="kitchen.open.on" count="4" x="1" y="1" /> + <structure id="kitchen" width="73" height="72" image="kitchen.png" type="kitchen" animation="kitchen" openable="true"> + <recipe type="fuel" /> + <recipe type="kitchen" /> + <light tile="light.small" color="ffbf00" flicker="true" offsetX="54" offsetY="68" ifAnim="*.on" /> + </structure> + + <animation id="kitchen2.off" equals="single" /> + <animation id="kitchen2.on" count="8" x="1" y="0" /> + <structure id="kitchen2" name="kitchen" width="73" height="80" image="kitchen2.png" type="kitchen" animation="kitchen2" display="item.names.kitchen_upgrade"> + <recipe type="fuel" /> + <recipe type="kitchen2" /> + <recipe type="kitchen" /> + <light tile="light.small" color="ffbf00" flicker="true" offsetX="2" offsetY="77" ifAnim="*.on" /> + <light tile="light.small" color="ffbf00" flicker="true" offsetX="32" offsetY="76" ifAnim="*.on" /> + <light tile="light.small" color="ffbf00" flicker="true" offsetX="48" offsetY="76" ifAnim="*.on" /> + <light tile="light.small" color="ffbf00" flicker="true" offsetX="64" offsetY="76" ifAnim="*.on" /> + </structure> + + <animation id="farm.idle" count="1" x="5" y="0" /> + <animation id="farm.closing" count="6" /> + <animation id="farm.opening" count="6" reverse="true" /> + <tilesheet id="wreath.png" width="19" height="20" /> + <tile id="wreath" sheet="wreath.png" x="0" y="0" /> + <structure id="farm" width="104" height="75" image="isDate(10,31,3)?'farm_halloween.png':'farm.png'" type="farm"> + <over><action>this.playSFX("rock_door", false);</action></over> + <out><action>this.playSFX("rock_door", false);</action></out> + <operate> + <choose if="area.getNPC('farmer') != null && !isNight()"> + <section if="this.getCropCount() >= 4 && !getFlag('sugar_seed')"> + <move object="area.getNPC('farmer')" to="player" /><action>setFlag('sugar_seed', true)</action> + <dialogue section="farmer" id="add_sugar" speaker="area.getNPC('farmer')" /> + <item id="sugar_seed" /> + </section> + <section if="(player.questComplete('dock') || player.questComplete('dock2')) && !getFlag('cotton_seed')"> + <move object="area.getNPC('farmer')" to="player" /><action>setFlag('cotton_seed', true)</action> + <dialogue section="farmer" id="add_cotton" speaker="area.getNPC('farmer')" /> + <item id="cotton_seed" /> + </section> + </choose> + </operate> + <tile id="wreath" x="43/Tile.SIZE" y="31/Tile.SIZE" if="isDate(12,27,7)" /> + </structure> + <structure id="stall" name="pen" width="42" height="25" image="pen.png" tileWidth="2" animals="1" type="pen" attachFarm="farm" destroyRemove="true"> + <sprite> + <tile x="1" y="0" /> + <animal i="0" offsetX="21" offsetY="23" /> + <tile x="0" y="0" /> + </sprite> + <animal id="pig" /> + <animal id="cow" /> + <animal id="chicken" /> + <animal id="spider" /> + </structure> + <compound id="pen"> + <structure id="stall" x="2" /><structure id="stall" x="0" /> + </compound> + <tile id="pen_placeholder" sheet="pen.png" x="1"><tile sheet="pen.png" x="1" offsetX="32" /><tile sheet="pen.png" x="0" /><tile sheet="pen.png" x="0" offsetX="32" /></tile> + <structure id="pen_placeholder" tile="pen_placeholder" width="64" height="25" offsetX="-16" /> + + <animation id="market.idle"> + <frame x="0" y="0" length="16" /> + <frame x="1" y="0" length="2" /> + <frame x="2" y="0" length="16" /> + <frame x="3" y="0" length="2" /> + </animation> + <animation id="market.night.idle" count="1" x="12" /> + <animation id="market.talk" count="8" x="4" /> + <procedure id="market"> + <section if="isNight()"><dialogue section="market" id="closed" /><stop /></section> + <section if="player.questComplete('market2') && !player.hasSeenItem('coin_purse')"> + <dialogue section="player" id="market3" /> + <item id="coin_purse" value="0" modal="true" /> + </section> + </procedure> + <structure id="food_market" width="41" height="35" image="food_market.png" type="market" animation="market" restock="5000" show_offers="!isNight()" nightAnimation="market.night"> + <item id="berries" min="5" max="20" /> + <item id="red_berries" min="5" max="20" /> + <item id="ice_berries" min="5" max="20" /> + <item id="meat" min="5" max="20" /> + <item id="fruit" min="5" max="20" /> + <item id="wheat" min="5" max="20" /> + <item id="sugar" min="5" max="10" /> + <item id="eggs" min="5" max="10" /> + <item id="milk" min="5" max="10" /> + <item id="pig" min="0" max="1" /> + <item id="chicken" min="0" max="2" /> + <item id="cow" min="0" max="1" /> + <item id="wheat_seed" min="2" max="4" /> + <item id="orchard_seed" min="2" max="4" /> + <item id="cotton_seed" min="1" max="1" /> + <item id="bush_seed" min="0" max="1" /> + <item id="red_bush_seed" min="0" max="1" /> + <select count="3"> + <item id="steak" min="5" max="10" /> + <item id="bread" min="5" max="10" /> + <item id="pancakes" min="5" max="10" /> + <item id="hamburger" min="5" max="10" /> + <item id="pie" min="5" max="10" /> + </select> + <buy type="food" /><buy type="animal" /> + <over><action>this.loopAnimation("talk")</action></over> + <out><action>this.loopAnimation("idle")</action></out> + <operate><run procedure="market" /></operate> + </structure> + <tilesheet id="markets.png" width="46" height="35" /> + <tile id="weaps_market" sheet="markets.png" /> + <structure id="weaps_market" tile="weaps_market" type="market" animation="market" restock="5000" show_offers="!isNight()" nightAnimation="market.night"> + <item id="mega_backpack" min="1" max="1" achievement="bigpack" if="true" /> + <item id="ultra_backpack" min="1" max="1" if="player.questComplete('boat') || player.hasQuest('wyrm_hive')" /> + <item id="net" min="10" max="15" /> + <item id="torch" min="5" max="10" /> + <item id="trap" min="5" max="10" /> + <item id="arrow" min="20" max="40" /> + <item id="fence" min="5" max="10" /> + <select count="6"> + <item id="bow" min="1" max="1" /> + <item id="iron_pickaxe" min="1" max="1" /> + <item id="iron_sword" min="1" max="1" /> + <item id="iron_armor" min="1" max="1" /> + <item id="steel_pickaxe" min="1" max="1" /> + <item id="steel_sword" min="1" max="1" /> + <item id="steel_axe" min="1" max="1" /> + <item id="steel_hammer" min="1" max="1"/> + <item id="steel_armor" min="1" max="1" /> + <item id="buckler" min="1" max="1" /> + <item id="kite_shield" min="1" max="1" /> + </select> + <buy type="equipment" /><buy type="tool" /><buy type="object" /> + <over><action>this.loopAnimation("talk")</action></over> + <out><action>this.loopAnimation("idle")</action></out> + <operate><run procedure="market" /></operate> + </structure> + <tile id="mineral_market" sheet="markets.png" x="13" /> + <structure id="mineral_market" tile="mineral_market" type="market" animation="market" restock="5000" show_offers="!isNight()" nightAnimation="market.night"> + <item id="wood" min="10" max="30" /> + <item id="coal" min="10" max="20" /> + <item id="iron" min="5" max="20" /> + <item id="cloth" min="10" max="20" /> + <select count="3"> + <item id="quartz" min="5" max="5" /> + <item id="gold" min="5" max="5" /> + <item id="diamond" min="5" max="5" /> + <item id="iron_bar" min="5" max="5" /> + <item id="steel_bar" min="5" max="5" /> + </select> + <buy type="resource" /> + <over><action>this.loopAnimation("talk")</action></over> + <out><action>this.loopAnimation("idle")</action></out> + <operate><run procedure="market" /></operate> + </structure> + <compound id="market"> + <structure id="mineral_market" x="0" /> + <structure id="weaps_market" x="3" /> + <structure id="food_market" x="6" /> + </compound> + <tile id="market_placeholder" sheet="markets.png" x="13"><tile sheet="markets.png" x="0" offsetX="48" /><tile sheet="food_market.png" x="0" offsetX="96" /></tile> + <structure id="market_placeholder" tile="market_placeholder" width="137" height="35" offsetX="-46" /> + + <animation id="dockhouse.idle" equals="single" /> + <animation id="dockhouse.closing" count="9" reverse="true" /> + <animation id="dockhouse.opening" count="9" /> + <structure id="dockhouse" width="100" height="55" image="dockhouse.png" type="crafting" spawnX="area.isWater(this.tile_x-5, this.tile_y+1)?this.tile_x-4:this.tile_x+8"> + <recipe id="boat" /><recipe type="dock" /> + <operate><quest id="boat" ask="false" if="(player.questComplete('market') || player.questComplete('market2')) && !player.questComplete('boat')" /></operate> + </structure> + <tile id="dockhouse" sheet="dockhouse.png" /> + <tilesheet id="dock.png" width="64" height="80" /> + <tile id="dock" sheet="dock.png" x="0" y="0" /> + <tile id="dock_empty" sheet="dock.png" x="0" y="1" /> + <tilesheet id="dock_front.png" width="60" height="16" /> + <tile id="dock_front" sheet="dock_front.png" x="0" y="0" /> + <action> + function isBoat(o){return o.info.xml.get("type") == "boat" && o.player == null;} + function getDock(area, right){ + for(s in area.getStructures()) if(s.info.xml.get("type") == "dock" && right == (s.info.xml.get('flip') == 'true')) return s; + return null; + } + function getBoatForDock(dock, right, player){ + if(dock == null) return null; + var rect = null; var ret = null; var area = null; + if(right && dock.area.right != null){ + var r = (dock.area.right.fromX+20)*Tile.SIZE; var f = dock.xPos; if(player != null && dock.info.xml.get("emptyDock") != "true") f += dock.info.width; + rect = makeRect(f, dock.yPos-Tile.SIZE, r-f, Tile.SIZE); area = dock.area.right.area; + } else if(dock.area.left != null){ + var l = (dock.area.left.fromX-20)*Tile.SIZE; var f = dock.xPos; if(player == null || dock.info.xml.get("emptyDock") == "true") f += dock.info.width; + rect = makeRect(l, dock.yPos-Tile.SIZE, f-l, Tile.SIZE); area = dock.area.left.area; + } if(rect != null) dock.area.getObjects(rect, function(o, r){if(isBoat(o)) ret = o; return false;}); + if(ret != null) return ret; + if(player != null && area != null){ + var a = player.areas.map.get(area); + if(a != null && a != dock.area){var b = getBoatForDock(getDock(a, !right), !right, null); if(b != null) return b;} + } return null; + } + </action> + <structure id="dock_base" type="dock" playerY="-5"> + <tooltip id="summon_boat" if="getBoatForDock(this, this.info.xml.get('flip') == 'true', player) != null" /> + <operate> + <action with="fade" if="this.area != null"> + var flip = this.info.xml.get("flip") == "true"; var b = getBoatForDock(this, flip, player); + if(b != null){ + b.setPosition(this.xPos+(flip?Tile.SIZE:this.info.width-Tile.SIZE-b._width), this.yPos); + if(b.area != this.area){b.area.removeObject(b); this.area.addObject(b);} player.clearOverlap(); player.overlapChanged(); + } + </action> + </operate> + </structure> + <structure id="dock" extends="dock_base" tile="dock" offsetY="64" dockWidth="4" dockHeight="4"> + <tile id="dock_front" top="true" x="4/Tile.SIZE" y="4/Tile.SIZE" /> + </structure> + <structure id="dock_flip" extends="dock" flip="true" /> + <structure id="dock_empty" tile="dock_empty" extends="dock_base" playerY="" offsetY="80" dockWidth="4" dockTopWidth="1" dockHeight="4" emptyDock="true" /> + <structure id="dock_empty_flip" tile="dock_empty" extends="dock_base" playerY="" offsetY="80" flip="true" dockWidth="4" dockTopWidth="1" dockHeight="4" emptyDock="true" /> + + <animation id="boat.empty" equals="single" /> + <animation id="boat.sail" count="10" x="2" /> + <tilesheet id="boat_rail.png" width="9" height="3" /> + <tile id="boat_rail" sheet="boat_rail.png" offsetX="26" offsetY="26" /> + <tilesheet id="boat.png" width="40" height="40" /> + <tile id="boat" sheet="boat.png" /> + <animation id="boat.move" equals="boat.sail" /> + <vehicle id="boat" stamina="true" efficiency="0.5" health="500" tile="boat" speed="2" type="boat" waterLine="35" max_weight="1250" title="item.names.boat" icon="boat.ico" tooltip="structure.tooltip.boat" element="plant" bgm="voyage" begin_walk_sfx="sail_open" walk_sfx="sailing" item="boat"> + <player x="30" y="20" /> + <repair id="wood" value="25" /> + <tile id="boat_rail" /> + <listItem title="vehicle.pack_up"> + <section if="!player.vehicle.canDismount()"><action>player.showWarning(getText("vehicle.boat_pack_up"))</action><stop /></section> + <closeWindows /><action>player.vehicle.dismount();</action> + <invokeLater><section if="player.vehicle == null"> + <action>player.inventory.addAll(this.inventory);</action><remove object="this" /><item id="boat" value="this.health" /> + </section></invokeLater> + </listItem> + </vehicle> + <item id="boat" type="object" cost="0" weight="50" icon="boat.ico" durability="500" durabilityName="common.health" durabilityIcon="vehicle_health"> + <action id="plant" name="vehicle.deploy" object="boat" onGrass="false" onWater="true" overlapBlueprints="true" overlapStructures="true" removeBushes="false"> + <action>object.setHealth(this.getFeed());</action> + </action> + <action id="feed" alt="feed_all" alt_name="repair_all" name="repair" full="warning.max_repair" auto="common.auto_repair" select="actions.repair" sfx="workshop" /> + <food id="wood" value="25" /> + </item> + <structure id="boat" tile="boat" type="fuelable" fuelName="rations" maxFuel="1000" renderer="floating" waterLine="35" back="true" includeInventory="true" playerY="-5" title="item.names.boat" priority="1" behind="true" remove="false" only_select="true"> + <tooltip if="getFlag('boat.structure')" /> + <tooltip id="boat" /> + <operate> + <stop if="getFlag('boat.structure')" /><action>setFlag('boat.structure', true)</action><setTime sleep="true" /> + <section if="!player.areas.exists('science1') && !getFlag('boat.farewell')"> + <set id="builder" value="area.getNPC('builder')" /> + <set id="miner" value="area.getNPC('miner')" /> + <set id="farmer" value="area.getNPC('farmer')" /> + <set id="hunter" value="(player.hasQuest('hunt'))?area.getNPC('hunter'):null" /> + <set id="trader" value="area.getNPC('trader')" /> + <set id="alchemist" value="(player.hasQuest('lab'))?area.getNPC('alchemist'):null" /> + <section with="fade"> + <action>if(builder != null) builder.alpha = 1; if(miner != null) miner.alpha = 1; if(farmer != null) farmer.alpha = 1; + if(hunter != null) hunter.alpha = 1; if(trader != null) trader.alpha = 1; if(alchemist != null) alchemist.alpha = 1;</action> + <move object="player" x="-4" /><facing object="player" dir="right" /><set id="x" value="-2" /> + <section if="builder != null"> + <set id="builder_x" value="builder.tile_x" /><set id="builder_y" value="builder.tile_y" /> + <move object="builder" x="x" /><facing object="builder" dir="left" /><set id="x" value="x+1" /> + </section> + <section if="miner != null"> + <set id="miner_x" value="miner.tile_x" /><set id="miner_y" value="miner.tile_y" /> + <move object="miner" x="x" /><facing object="miner" dir="left" /><set id="x" value="x+1" /> + </section> + <section if="farmer != null"> + <set id="farmer_x" value="farmer.tile_x" /><set id="farmer_y" value="farmer.tile_y" /> + <move object="farmer" x="x" /><facing object="farmer" dir="left" /><set id="x" value="x+1" /> + </section> + <section if="hunter != null"> + <set id="hunter_x" value="hunter.tile_x" /><set id="hunter_y" value="hunter.tile_y" /> + <move object="hunter" x="x" /><facing object="hunter" dir="left" /><set id="x" value="x+1" /> + </section> + <section if="trader != null"> + <set id="trader_x" value="trader.tile_x" /><set id="trader_y" value="trader.tile_y" /> + <move object="trader" x="x" /><facing object="trader" dir="left" /><set id="x" value="x+1" /> + </section> + <section if="alchemist != null"> + <set id="alchemist_x" value="alchemist.tile_x" /><set id="alchemist_y" value="alchemist.tile_y" /> + <move object="alchemist" x="x" /><facing object="alchemist" dir="left" /><set id="x" value="x+1" /> + </section> + </section> + <dialogue section="player" id="farewell1" speaker="player" /> + <select count="3"> + <dialogue section="player" id="farewell2" speaker="builder" if="builder != null" /> + <dialogue section="player" id="farewell3" speaker="miner" if="miner != null" /> + <dialogue section="player" id="farewell4" speaker="farmer" if="farmer != null" /> + <dialogue section="player" id="farewell5" speaker="hunter" if="hunter != null" /> + <dialogue section="player" id="farewell6" speaker="trader" if="trader != null" /> + <dialogue section="player" id="farewell7" speaker="alchemist" if="alchemist != null" /> + </select> + <section with="fade"> + <move object="builder" x="builder_x" y="builder_y" if="builder != null" /> + <move object="miner" x="miner_x" y="miner_y" if="miner != null" /> + <move object="farmer" x="farmer_x" y="farmer_y" if="farmer != null" /> + <move object="hunter" x="hunter_x" y="hunter_y" if="hunter != null" /> + <move object="trader" x="trader_x" y="trader_y" if="trader != null" /> + <move object="alchemist" x="alchemist_x" y="alchemist_y" if="alchemist != null" /> + </section> + </section> + <remove structure="this" /><object id="boat" x="this.xPos/Tile.SIZE" y="this.tile_y" /> + <action>onSailBoat(); boat.inventory.addAll(this.inventory); boat.setFuel(this.fuel);</action> + <save /><action>boat.onOperate(player)</action><stop /> + </operate> + </structure> + + <animation id="lab.idle" count="11" /> + <structure id="lab" width="64" height="64" image="lab.png" type="crafting"> + <recipe type="lab" /> + <craft> + <action if="area.getNPC('alchemist') != null">area.getNPC("alchemist").playAnimation("craft")</action> + </craft> + <light tile="light.medium" color="ffbf00" flicker="true" offsetX="3" offsetY="47" /> + <light tile="light.medium" color="ffbf00" flicker="true" offsetX="60" offsetY="47" /> + <light tile="light.small" color="ffbf00" flicker="true" offsetX="54" offsetY="62" /> + </structure> + <tilesheet id="cage.png" width="42" height="26" /><tile id="cage" sheet="cage.png" /> + <structure id="wyrm_pen" tile="cage" animals="2" type="pen" name="cage"> + <sprite> + <animal i="0" offsetX="12" offsetY="21" /> + <animal i="1" offsetX="30" offsetY="21" /> + <tile x="0" y="0" /> + </sprite> + <animal id="wyrm" /> + <animal id="cocoon" /> + <animal id="dragon" /> + <animal id="diode_wolf" /> + <animal id="steel_wyrm" /> + <animal id="golem" /> + <animal id="gold_golem" /> + <animal id="purple_golem" /> + <animal id="pig" /> + <animal id="cow" /> + <animal id="chicken" /> + <animal id="spider" /> + </structure> + + <include id="dragon_lair_fx.xml" includeRoot="true" /> + <tile id="dragon_lair_fx_bg" sheet="dragon_lair_fx.png" x="0" y="0" /> + <tile id="dragon_lair_fx_fg" sheet="dragon_lair_fx.png" x="6" y="0" /> + <animation id="dragon_lair_fx" count="6" glow="true" /> + <structure id="dragon_lair" width="192" height="112" image="dragon_lair.png" allowFlying="true"> + <tooltip id="summon_alchemist" if="var drag = area.getObject('adult_dragon'); return getFlag('summon_alchemist') && area.canGetNPC('alchemist') && (drag == null || !drag.isHostile())" /> + <operate> + <set id="alchemist" value="area.getNPC('alchemist')" /> + <move object="alchemist" to="player" /> + <play object="alchemist" animation="teleport_in" modal="true" /> + <set id="drag" value="area.getObject('adult_dragon')" /> + <choose> + <section if="drag != null"> + <section if="player.tile_x > drag.tile_x-1" with="fade"> + <move object="player" x="drag.tile_x-3" y="drag.tile_y-1" /> + <move object="alchemist" to="player" /> + </section> + <facing object="alchemist" dir="right" /> + <choose> + <section if="!player.hasQuest('hatch_dragons')"> + <dialogue section="alchemist" id="dragon4" speaker="alchemist" /> + <light x="player.tile_x" y="player.tile_y" size="10" /> + <dialogue section="alchemist" id="dragon5" speaker="drag" /> + <dialogue section="alchemist" id="dragon6" speaker="alchemist" /> + <dialogue section="alchemist" id="dragon7" speaker="drag" /> + <dialogue section="alchemist" id="dragon8" speaker="alchemist" /> + <dialogue section="alchemist" id="dragon9" speaker="drag" /> + <quest id="hatch_dragons" /> + <section if="!player.hasQuest('hatch_dragons')"> + <dialogue section="alchemist" id="dragon10" speaker="drag" /> + <action>drag.awaken()</action> + </section> + </section> + <choose if="!player.questComplete('hatch_dragons')"> + <section if="player.canCompleteQuest('hatch_dragons')"> + <dialogue section="alchemist" id="dragon12" speaker="drag" /> + <dialogue section="alchemist" id="dragon12_a" speaker="alchemist" /> + <dialogue section="alchemist" id="dragon13" speaker="drag" /> + <dialogue section="alchemist" id="dragon14" speaker="drag" /> + <complete quest="hatch_dragons" /> + <structure id="dragon_lair2" x="this.tile_x" y="this.tile_y" /> + <action>var d = area.getStructureById('dragon_lair2'); d.setAnimal("adult_dragon", 8000); drag.remove();</action> + <action>player.overlapChanged()</action> + </section> + <dialogue section="alchemist" id="dragon11" speaker='alchemist' /> + </choose> + </choose> + </section> + <section> + <remove quest="hatch_dragons" /> + <dialogue section="alchemist" id="lair1" speaker="alchemist" /> + <dialogue section="alchemist" id="lair2" speaker="alchemist" /> + <dialogue section="alchemist" id="lair3" speaker="alchemist" /> + <structure id="dragon_lair2" x="this.tile_x" y="this.tile_y" /> + <action>player.overlapChanged()</action> + </section> + </choose> + <play object="alchemist" animation="teleport_out" modal="true" /> + <move object="alchemist" structure="area.getStructureById('lab')" /> + </operate> + </structure> + <procedure id="dragon_lair.raise_dragon"> + <closeWindows /><set id="from" value="this.animal.info.getFamiliar()" /><sound id="dragon_transform" /> + <set id="to" value="getItem(into).getFamiliar()" /> + <action>this.setAnimal(into, getItem(into).getDurability(), this.animal.getNameStr()); this.animalVisible(false);</action> + <addAnimation to="this"> + <add id="bg" tile="dragon_lair_fx_bg" animation="dragon_lair_fx" alpha="0" /> + <add id="first" tile="from.get('tile')" animation="from.get('animation')+'.idle'" offsetX="-0.5" offsetY="-1" x="80" y="96" /> + <add id="second" tile="to.get('tile')" animation="to.get('animation')+'.idle'" offsetX="-0.5" offsetY="-1" x="80" y="96" alpha="0" /> + <add id="fg" tile="dragon_lair_fx_fg" animation="dragon_lair_fx" alpha="0" /> + <lerp id="bg" alpha="1" seconds="0.25" /> + <lerp id="fg" alpha="1" seconds="0.25" modal="true" /> + <lerp id="first" alpha="0" seconds="0.5" /> + <lerp id="second" alpha="1" seconds="0.5" modal="true" /> + <lerp id="bg" alpha="0" seconds="0.25" /> + <lerp id="fg" alpha="0" seconds="0.25" modal="true" /> + <action>this.animalVisible(true)</action> + </addAnimation> + </procedure> + <action> + function summonDragonForLair(player, lair, summon){ + if(lair.area == null || player == null) return false; var areas = [lair.area, (lair.area.id == "magic1")?player.areas.map.get("start"):player.areas.map.get("magic1")]; + for(area in areas){ + if(area == null) continue; for(o in area.getObjectsById("fly_adult_dragon")) if(o.player == null){ + if(summon){ + lair.setAnimal("adult_dragon", o.fuel, o.name); lair.inventory.copyFrom(o.inventory); o.inventory.clear(); o.area.removeObject(o); + } return true; + } for(s in area.getStructuresById("dragon_lair2")) if(s != lair && s.animal != null && s.animal.info.id == 'adult_dragon'){ + if(summon){ + lair.setAnimal("adult_dragon", s.animal.getFeed(), s.animal.getNameStr()); lair.inventory.copyFrom(s.inventory); s.inventory.clear(); s.setAnimal(null); + } return true; + } + } return false; + } + </action> + <structure id="dragon_lair2" width="192" height="112" image="dragon_lair.png" type="lair" title="structure.tooltip.dragon_lair2" animalX="80" animalY="96" slot="structure.dragon_lair" allowFlying="true" includeInventory="57"> + <tooltip id="dragon_lair2" if="area.getObject('adult_dragon') == null" /> + <animal id="dragon" /> + <animal id="adult_dragon" /> + <recipe type="dragon_feed" /> + <animal id="young_dragon" /> + <familiar option="actions.enrage" if="area.id == 'start' && this.animal.info.id == 'adult_dragon' && area.getObject('adult_dragon') == null"> + <window type="prompt" message="actions.enrage_prompt"> + <object id="adult_dragon" x="this.tile_x+2.5" y="this.tile_y-1" /><action>area.getObject('adult_dragon').awaken(); this.setAnimal(null);</action><closeWindows /> + </window> + </familiar> + <listItem icon="adult_dragon.ico" title="structure.tooltip.summon_dragon" enabled="this.animal == null && summonDragonForLair(player, this, false)"> + <action>if(this.animal == null) summonDragonForLair(player, this, true);</action> + </listItem> + <listItem icon="adult_dragon.ico" title="structure.tooltip.fly_dragon" fail="'warning.no_item{item:[item=adult_dragon]}'"> + <tooltip type="requires" requires="quests.requires"> + <option> + <value icon="adult_dragon.ico" title="item.names.adult_dragon" if="this.animal != null && this.animal.info.id == 'adult_dragon'" /> + <value icon="adult_dragon.ico" title="structure.place_in_lair{item:[item=adult_dragon]}" error="true" /> + </option> + </tooltip> + <closeWindows /><set id="_name" value="this.animal.getNameStr()" /> + <object id="fly_adult_dragon" x="this.tile_x+2.5" y="this.tile_y-1" pre="true">this.name = _name;</object> + <action>setFlag('jump_water', true); fly_adult_dragon.setFuel(this.animal.getFeed()); fly_adult_dragon.inventory.copyFrom(this.inventory); this.inventory.clear(); this.setAnimal(null); fly_adult_dragon.mount(player); + </action><achievement id="dragon_flight" /> + </listItem> + <listItem icon="young_dragon.ico" title="structure.tooltip.raise_into{into:[item=adult_dragon]}" fail="(this.animal != null && this.animal.info.id == 'young_dragon')?'warning.ingredients':'warning.no_item{item:[item=young_dragon]}'"> + <tooltip type="requires" requires="quests.requires"> + <option> + <value icon="young_dragon.ico" title="item.names.young_dragon" if="this.animal != null && this.animal.info.id == 'young_dragon'" /> + <value icon="young_dragon.ico" title="structure.place_in_lair{item:[item=young_dragon]}" error="true" /> + </option> + <requirement icon="fire_gem.ico" title="item.names.fire_gem" count="player.getItemCountStorehouse('fire_gem')" of="1" /> + </tooltip> + <set id="into" value="'adult_dragon'" /><item id="fire_gem" count="-1" storehouse="true" /><run procedure="dragon_lair.raise_dragon" /> + </listItem> + <listItem icon="baby_dragon.ico" title="structure.tooltip.raise_into{into:[item=young_dragon]}" fail="(this.animal != null && this.animal.info.id == 'dragon')?'warning.ingredients':'warning.no_item{item:[item=dragon]}'"> + <tooltip type="requires" requires="quests.requires"> + <option> + <value icon="baby_dragon.ico" title="item.names.dragon" if="this.animal != null && this.animal.info.id == 'dragon'" /> + <value icon="baby_dragon.ico" title="structure.place_in_lair{item:[item=dragon]}" error="true" /> + </option> + <requirement icon="dragonblood.ico" title="item.names.dragonblood" count="player.getItemCountStorehouse('dragonblood')" of="5" /> + </tooltip> + <set id="into" value="'young_dragon'" /><item id="dragonblood" count="-5" storehouse="true" /><run procedure="dragon_lair.raise_dragon" /> + </listItem> + </structure> + + <tilesheet id="tent.png" width="60" height="32" /> + <tile id="tent" sheet="tent.png" x="0" y="0" /> + + <animation id="door.idle" count="6" /> + <structure id="cave" width="32" height="32" image="cave.png" name="enter" type="door" animation="door"> + <afterTeleport><dig x="player.tile_x" y="player.tile_y" speed="2" /></afterTeleport> + </structure> + <tilesheet id="doorway.png" width="32" height="32" /><tile id="doorway" sheet="doorway.png" /> + <structure id="doorway" tile="doorway" name="enter" type="door" animation="door"> + <afterTeleport><dig x="player.tile_x" y="player.tile_y" speed="2" /></afterTeleport> + </structure> + + <tilesheet id="golem.png" width="64" height="64" /> + <tile id="golem.statue" sheet="golem.png" x="0" y="0" /> + <animation id="golem.statue.idle" count="6" offsetY="32" /> + <procedure id="activate.gem_structure"> + <choose> + <window type="prompt" message="structure.activate" item="gem" if="player.getItemCount(gem) > 0"> + <choose> + <section if="into != null" > + <item eval="gem" count="-1" /><sound eval="sfx" structure="this" if="sfx != null" /> + <play object="this" animation="activate" modal="true" /> + <structure eval="into" x="this.xPos/Tile.SIZE" y="this.yPos/Tile.SIZE" /> + <achievement eval="achievement" if="achievement != null" /> + </section> + <dialogue section="warning" id="incomplete" /> + </choose> + </window> + <dialogue section="structure" id="activate_fail" /> + </choose> + </procedure> + <structure id="golem" width="128" height="64" tile="doorway" name="activate" animation="golem.statue"> + <tile id="golem.statue" x="-3" y="0" /> + <tile id="golem.statue" x="1" y="0" /> + <operate><set id="gem" value="'earth_gem'" /><set id="into" value="'golem.active'" /><set id="achievement" value="null" /><set id="sfx" value="null" /><run procedure="activate.gem_structure" /></operate> + </structure> + <structure id="golem.active" width="128" height="64" tile="doorway" name="enter" animation="golem.statue"> + <tile id="golem.statue" name="left" lerp="true" x="-3" y="0" /> + <tile id="golem.statue" name="right" lerp="true" x="1" y="0" /> + <over> + <lerp object="this.getTileById('left')" modal="false" x="-1" seconds="1" /> + <lerp object="this.getTileById('right')" modal="false" x="1" seconds="1" /> + <action>this.playSFX("rock_door", false);</action> + </over> + <out> + <lerp object="this.getTileById('left')" modal="false" x="0" seconds="1" /> + <lerp object="this.getTileById('right')" modal="false" x="0" seconds="1" /> + <action>this.playSFX("rock_door", false);</action> + </out> + <operate><teleport area="golem_factory" x="2" y="6" with="ellipse" /></operate> + </structure> + <animation id="golem_factory.idle" count="1" /> + <animation id="golem_factory.active" count="6" x="1" glow="true" /> + <structure id="golem_factory" width="128" height="112" image="golemfactory.png" name="activate" type="crafting" title="actions.craft"> + <recipe type="golem_factory" /> + <listItem icon="golem.ico" title="structure.golemech" fail="warning.ingredients"> + <tooltip type="requires" requires="common.requires"> + <requirement icon="earth_gem.ico" title="item.names.earth_gem" count="player.getItemCount('earth_gem')" of="1" /> + <option info="true"><value title="structure.tooltip.golemech2" red="true" /></option> + <option info="true"><value title="structure.tooltip.golemech" /></option> + </tooltip> + <item id="earth_gem" count="-1" hidden="true" /><object id="golemech" x="10" y="6" /><closeWindows /> + </listItem> + <over><action if="area.getObject('golemech') == null">this.loopAnimation("active")</action></over> + <out><action>this.loopAnimation("idle")</action></out> + <operate><section if="area.getObject('golemech') != null" ><dialogue section="structure" id="golem_factory" /><stop /></section></operate> + </structure> + <include id="crafting.xml" /> +</structures> \ No newline at end of file diff --git a/games/aground/data/core/structures/tent.png b/games/aground/data/core/structures/tent.png new file mode 100644 index 00000000..bad7e185 Binary files /dev/null and b/games/aground/data/core/structures/tent.png differ diff --git a/games/aground/data/core/structures/workshop.png b/games/aground/data/core/structures/workshop.png new file mode 100644 index 00000000..9f20b352 Binary files /dev/null and b/games/aground/data/core/structures/workshop.png differ diff --git a/games/aground/data/core/structures/wreath.png b/games/aground/data/core/structures/wreath.png new file mode 100644 index 00000000..aa55d2e7 Binary files /dev/null and b/games/aground/data/core/structures/wreath.png differ diff --git a/games/aground/data/core/tiles/crack.png b/games/aground/data/core/tiles/crack.png new file mode 100644 index 00000000..b6ca0254 Binary files /dev/null and b/games/aground/data/core/tiles/crack.png differ diff --git a/games/aground/data/core/tiles/debris.png b/games/aground/data/core/tiles/debris.png new file mode 100644 index 00000000..a3e401ec Binary files /dev/null and b/games/aground/data/core/tiles/debris.png differ diff --git a/games/aground/data/core/tiles/lava_glow.png b/games/aground/data/core/tiles/lava_glow.png new file mode 100644 index 00000000..7c74bbbe Binary files /dev/null and b/games/aground/data/core/tiles/lava_glow.png differ diff --git a/games/aground/data/core/tiles/mountain_snow.png b/games/aground/data/core/tiles/mountain_snow.png new file mode 100644 index 00000000..07154941 Binary files /dev/null and b/games/aground/data/core/tiles/mountain_snow.png differ diff --git a/games/aground/data/core/tiles/tiles.png b/games/aground/data/core/tiles/tiles.png new file mode 100644 index 00000000..b4daed57 Binary files /dev/null and b/games/aground/data/core/tiles/tiles.png differ diff --git a/games/aground/data/core/tiles/tiles.xml b/games/aground/data/core/tiles/tiles.xml new file mode 100644 index 00000000..b98acd35 --- /dev/null +++ b/games/aground/data/core/tiles/tiles.xml @@ -0,0 +1,138 @@ +<?xml version="1.0" encoding="utf-8" ?> +<tiles> + <tile id="empty" /><tile id="no_place" /> + <tile id="grass" sheet="tiles.png" x="0" /> + <tile id="dirt" sheet="tiles.png" x="1" /> + <tile id="dirt_sand1" sheet="tiles.png" x="1"><tile sheet="tiles.png" x="85" /></tile> + <tile id="dirt_sand2" sheet="tiles.png" x="1"><tile sheet="tiles.png" x="84" /></tile> + <tile id="dirt_sand3" sheet="tiles.png" x="1"><tile sheet="tiles.png" x="88" /></tile> + <tile id="sand_top" sheet="tiles.png" x="86" /> + <tile id="sand" sheet="tiles.png" x="87" /> + <tile id="bedrock" sheet="tiles.png" x="89" /> + <tile id="stone" sheet="tiles.png" x="2" /> + <tile id="snow_stone" sheet="tiles.png" x="90" /> + <tile id="snow" sheet="tiles.png" x="91" /> + <tile id="ice" sheet="tiles.png" x="124" /> + <tile id="ice_wall" sheet="tiles.png" x="123" /> + <tile id="obsidian" sheet="tiles.png" x="125" /> + <tile id="blackstone" sheet="tiles.png" x="126" /> + <dig id="dirt" cost="0" /> + <dig id="grass" cost="0" grass="true" /> + <dig id="dirt_sand1" cost="0" /> + <dig id="dirt_sand2" cost="0" /> + <dig id="dirt_sand3" cost="0" /> + <dig id="stone" cost="1" /> + <dig id="snow" cost="0" /> + <dig id="snow_stone" cost="1" /> + <dig id="sand" cost="4" /> + <dig id="sand_top" cost="4" /> + <dig id="bedrock" cost="8" /> + <dig id="ice" cost="1" slide="true" shovel="false" /> + <dig id="ice_wall" cost="6" slide="true" shovel="false"/> + <dig id="obsidian" cost="4" /> + + <tile id="coal" sheet="tiles.png" x="3" /> + <tile id="iron" sheet="tiles.png" x="12" /> + <tile id="quartz" sheet="tiles.png" x="21" /> + <tile id="gold" sheet="tiles.png" x="30" /> + <tile id="diamond" sheet="tiles.png" x="39" /> + <tile id="sulfur" sheet="tiles.png" x="48" /> + <tile id="oil" sheet="tiles.png" x="57" /> + <tile id="titanium" sheet="tiles.png" x="66" /> + <tile id="uranium" sheet="tiles.png" x="75" /> + <tile id="lava" sheet="tiles.png" x="92" /> + <animation id="ore" count="9" /> + <ore id="diamond" achievement="diamond" /> + <tilesheet id="lava_glow.png" width="32" height="32" /> + <tile id="lava.light" sheet="lava_glow.png" offsetX="-8" offsetY="-8" /> + <ore id="lava" damage="6" hitEffect="fire_med" element="fire" light="lava.light" /> + + <tile id="markings1" sheet="tiles.png" x="101" /> + <tile id="markings2" sheet="tiles.png" x="102" /> + <tile id="markings3" sheet="tiles.png" x="103" /> + <tile id="markings4" sheet="tiles.png" x="104" /> + <tile id="markings5" sheet="tiles.png" x="105" /> + <tile id="markings6" sheet="tiles.png" x="106" /> + <tile id="markings7" sheet="tiles.png" x="107" /> + <tile id="markings8" sheet="tiles.png" x="108" /> + <dig id="markings1" cost="2" /> + <dig id="markings2" cost="2" /> + <dig id="markings3" cost="2" /> + <dig id="markings4" cost="2" /> + <dig id="markings5" cost="2" /> + <dig id="markings6" cost="2" /> + <dig id="markings7" cost="2" /> + <dig id="markings8" cost="2" /> + + <autotile id="water"> + <tile neighbors="ntop" x="7" /> + <tile x="0" /> + </autotile> + <tile id="water" sheet="tiles.png" x="109" autotile="water" /> + <tile id="water_alt" sheet="tiles.png" x="192" autotile="water" /> + <animation id="water" count="7" /> + + <tile id="crack" sheet="crack.png" x="0" y="0" /> + <tile id="tile_break" sheet="crack.png" x="2" y="1" /> + <animation id="crack" count="7" shift="1"> + <frame visible="false" /> + </animation> + <animation id="tile_break" count="8" /> + + <tilesheet id="mountain_snow.png" width="32" height="32" /> + <tile id="mountain_snow" sheet="mountain_snow.png" x="0" y="0" /> + + <tile id="wood_crate" sheet="debris.png" x="0" y="0" /> + <tile id="wood_debris1" sheet="debris.png" x="1" y="0" /> + <tile id="wood_debris2" sheet="debris.png" x="2" y="0" /> + <tile id="metal_debris" sheet="debris.png" x="3" y="0" /> + + <object id="wood_crate" tile="wood_crate" action="collect" layer="back" renderer="floating" waterLine="10"> + <loot id="berries" count="10" p="4" /> + <loot id="fruit" count="5" p="4" /> + <loot id="bread" count="5" p="4" /> + <loot id="cheese" count="5" p="2" /> + <loot id="pie" count="5" p="2" /> + <loot id="sugar" count="5" p="1" /> + <loot id="toothfish" count="10" p="1" /> + <operate><action>player.addLoot(this.getLoot(null,null))</action><remove object="this" /></operate> + </object> + <object id="wood_debris1" tile="wood_debris1" action="collect" layer="back" renderer="floating" waterLine="12"> + <operate><action>player.addItem("wood", 2)</action><remove object="this" /></operate> + </object> + <object id="wood_debris2" tile="wood_debris2" extends="wood_debris1" /> + <object id="metal_debris1" animation="debris3" tile="metal_debris" fps="2" action="collect" layer="item" submarine="true"> + <operate><action>player.addItem("titanium", 1)</action><remove object="this" /></operate> + </object> + + <tilesheet id="whirlpool.png" width="64" height="10" /> + <tile id="whirlpool" sheet="whirlpool.png" /> + <animation id="whirlpool.idle" count="8" offsetY="7" /> + <structure id="whirlpool" tile="whirlpool" width="32" type="door" name="enter" overlapVehicle="true"> + <initRenderer><action>this.playSFX("whirlpool")</action></initRenderer> + <over> + <section if="player.vehicle != null && player.vehicle.info.xml.get('type') == 'boat'"> + <set id="boat" value="player.vehicle" /> + <function object="player.vehicle" run="moveY" args="Tile.SIZE,50" /> + <choose> + <action if="player.vehicle != null && player.vehicle.info.xml.get('type') == 'boat'">this._onOperate(player);</action> + <section><remove object="boat" /><action>boat.renderer = null; boat._offsetY = 0; player.areas.get(this.area_id).addObject(boat);</action><move object="boat" x="this.x/Tile.SIZE" y="this.y/Tile.SIZE" /></section> + </choose> + </section> + </over> + <afterTeleport> + <section if="player.vehicle == null"><set id="oldParent" value="player.renderer.parent" /><action>area.renderer.back.addChild(player.renderer)</action></section> + <set id="object" value="player.vehicle == null?player:player.vehicle" /> + <action>if(player.vehicle != null) player.vehicle.resetY(0); object.renderer.x += Tile.SIZE*2; object.renderer.y += Tile.SIZE;</action> + <lerp object="object" deltaX="-2" deltaY="-1" seconds="0.5" modal="true" /> + <action if="player.vehicle == null">oldParent.addChild(player.renderer)</action> + </afterTeleport> + <out><action if="player.vehicle != null && player.vehicle.info.xml.get('type') == 'boat'">player.vehicle.resetY(10)</action></out> + <operate> + <section if="player.vehicle == null"> + <action>area.renderer.back.addChild(player.renderer)</action> + <lerp object="player" deltaY="2" seconds="0.5" modal="true" /> + </section><sound id="whirlpool_portal" /> + </operate> + </structure> +</tiles> \ No newline at end of file diff --git a/games/aground/data/core/tiles/whirlpool.png b/games/aground/data/core/tiles/whirlpool.png new file mode 100644 index 00000000..3871f5e5 Binary files /dev/null and b/games/aground/data/core/tiles/whirlpool.png differ diff --git a/games/aground/data/core/trees/bush.png b/games/aground/data/core/trees/bush.png new file mode 100644 index 00000000..f2e12e7e Binary files /dev/null and b/games/aground/data/core/trees/bush.png differ diff --git a/games/aground/data/core/trees/ice_bush.png b/games/aground/data/core/trees/ice_bush.png new file mode 100644 index 00000000..cf404cdb Binary files /dev/null and b/games/aground/data/core/trees/ice_bush.png differ diff --git a/games/aground/data/core/trees/red_bush.png b/games/aground/data/core/trees/red_bush.png new file mode 100644 index 00000000..36d596c6 Binary files /dev/null and b/games/aground/data/core/trees/red_bush.png differ diff --git a/games/aground/data/core/trees/tree.png b/games/aground/data/core/trees/tree.png new file mode 100644 index 00000000..027f3642 Binary files /dev/null and b/games/aground/data/core/trees/tree.png differ diff --git a/games/aground/data/core/trees/tree.xml b/games/aground/data/core/trees/tree.xml new file mode 100644 index 00000000..3c4d9f1f --- /dev/null +++ b/games/aground/data/core/trees/tree.xml @@ -0,0 +1,38 @@ +<tilesheet id='tree.png' width='100' height='80'> + <image frame='0' x='0' y='0' width='62' height='79' offsetX='20' offsetY='1' /> + <image frame='1' x='62' y='0' width='63' height='79' offsetX='19' offsetY='1' /> + <image frame='2' x='125' y='0' width='64' height='79' offsetX='19' offsetY='1' /> + <image frame='3' x='189' y='0' width='65' height='79' offsetX='18' offsetY='1' /> + <image frame='4' x='0' y='79' width='61' height='79' offsetX='22' offsetY='1' /> + <image frame='5' x='0' y='158' width='61' height='78' offsetX='22' offsetY='2' /> + <image frame='6' x='0' y='236' width='60' height='77' offsetX='22' offsetY='3' /> + <image frame='7' x='0' y='313' width='60' height='79' offsetX='22' offsetY='1' /> + <image frame='8' x='254' y='0' width='60' height='77' offsetX='22' offsetY='3' /> + <image frame='9' x='314' y='0' width='60' height='77' offsetX='22' offsetY='3' /> + <image frame='10' x='374' y='0' width='60' height='77' offsetX='22' offsetY='3' /> + <image frame='11' x='62' y='79' width='60' height='77' offsetX='22' offsetY='3' /> + <image frame='12' x='62' y='156' width='60' height='77' offsetX='22' offsetY='3' /> + <image frame='13' x='62' y='233' width='60' height='77' offsetX='22' offsetY='3' /> + <image frame='14' x='62' y='310' width='60' height='77' offsetX='22' offsetY='3' /> + <image frame='15' x='122' y='79' width='60' height='79' offsetX='22' offsetY='1' /> + <image frame='16' x='0' y='392' width='16' height='2' offsetX='44' offsetY='78' /> + <image frame='17' x='0' y='394' width='16' height='10' offsetX='44' offsetY='70' /> + <image frame='18' x='16' y='392' width='37' height='36' offsetX='35' offsetY='44' /> + <image frame='19' x='182' y='79' width='62' height='78' offsetX='20' offsetY='2' /> + <image frame='22' x='62' y='387' width='34' height='35' offsetX='36' offsetY='45' /> + <image frame='23' x='244' y='79' width='60' height='77' offsetX='22' offsetY='3' /> + <image frame='24' x='304' y='79' width='100' height='75' offsetX='0' offsetY='5' /> + <image frame='25' x='122' y='158' width='100' height='75' offsetX='0' offsetY='5' /> + <image frame='26' x='122' y='233' width='100' height='75' offsetX='0' offsetY='5' /> + <image frame='27' x='122' y='308' width='100' height='75' offsetX='0' offsetY='5' /> + <image frame='28' x='222' y='158' width='100' height='75' offsetX='0' offsetY='5' /> + <image frame='29' x='322' y='158' width='100' height='75' offsetX='0' offsetY='5' /> + <image frame='30' x='222' y='233' width='100' height='76' offsetX='0' offsetY='4' /> + <image frame='31' x='322' y='233' width='100' height='75' offsetX='0' offsetY='5' /> + <image frame='33' x='0' y='404' width='16' height='8' offsetX='44' offsetY='72' /> + <image frame='34' x='96' y='387' width='20' height='21' offsetX='42' offsetY='59' /> + <image frame='35' x='222' y='309' width='100' height='75' offsetX='0' offsetY='5' /> + <image frame='20' equals='16' offsetX='44' offsetY='78' /> + <image frame='21' equals='17' offsetX='44' offsetY='70' /> + <image frame='32' equals='16' offsetX='44' offsetY='78' /> +</tilesheet> diff --git a/games/aground/data/core/trees/trees.xml b/games/aground/data/core/trees/trees.xml new file mode 100644 index 00000000..f967fc77 --- /dev/null +++ b/games/aground/data/core/trees/trees.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="utf-8" ?> +<trees> + <include id="tree.xml" includeRoot="true" /> + <tile id="conifer" sheet="tree.png" x="0" y="0" /> + <tile id="tree" sheet="tree.png" x="24" y="0" /> + <animation id="tree.hit" x="0" count="8" /> + <animation id="tree.grow" x="8" count="4" /> + <item id="tree_seed" type="animal" cost="50" weight="1" icon="seed.ico"><action id="plant" sfx="plant_seed" object="tree" /></item> + <tree id="tree" health="5" loot="wood" min="3" max="5" collect="2" grown="3" speed="0.002" tile="tree" generateO2="0.125"> + <loot id="tree_seed" p="4" /> + <loot id="eggs" p="1" /> + <loot id="fruit" p="16" /> + </tree> + + <animation id="conifer.grow" x="20" count="4" /> + <animation id="conifer.hit" x="8" count="8" /> + <item id="conifer_seed" type="animal" cost="80" weight="1" icon="seed.ico"><action id="plant" sfx="plant_seed" object="conifer" /></item> + <tree id="conifer" health="9" loot="wood" min="4" max="6" collect="2" grown="3" speed="0.002" tile="conifer" generateO2="0.125"> + <loot id="conifer_seed" p="4" /> + <loot id="eggs" p="1" /> + <loot id="fruit" p="16" /> + </tree> + <animation id="conifer_snow.grow" x="16" count="4" /> + <animation id="conifer_snow.hit" x="0" count="8" /> + <tree id="conifer_snow" health="9" loot="wood" min="5" max="8" collect="2" grown="3" speed="0.002" hitType="conifer" tile="conifer" generateO2="0.125"> + <loot id="conifer_seed" p="4" /> + <loot id="ice_berries" p="16" /> + </tree> + + <tile id="bush" sheet="bush.png" x="0" y="0" /> + <animation id="bush.grow" count="4" reverse="true" /> + <bush id="bush" loot="berries" min="1" max="2" grown="3" speed="0.01" tile="bush" /> + <animation id="bush_snow.grow" count="4" x="4" /> + <animation id="bush_snow.harvest" x="8" count="6"> + <frame x="13" length="8" /> + </animation> + <bush id="bush_snow" loot="berries" min="1" max="2" grown="3" speed="0.02" tile="bush" /> + + <item id="bush_seed" type="animal" cost="50" weight="1" icon="seed.ico"><action id="plant" sfx="plant_seed" object="bush" /></item> + + <animation id="red_bush.grow" count="5" reverse="true" /> + <tilesheet id="red_bush.png" width="8" height="8" /> + <tile id="red_bush" sheet="red_bush.png" x="0" y="0" /> + <bush id="red_bush" loot="red_berries" min="1" max="2" grown="4" speed="0.008" tile="red_bush" /> + <animation id="red_bush_snow.harvest" x="10" count="5"> + <frame x="14" length="8" /> + </animation> + <animation id="red_bush_snow.grow" count="5" x="5" /> + <bush id="red_bush_snow" animation="red_bush" loot="red_berries" min="1" max="2" grown="4" speed="0.016" tile="red_bush" /> + + <item id="red_bush_seed" type="animal" cost="50" weight="1" icon="seed.ico"><action id="plant" sfx="plant_seed" object="red_bush" /></item> + + <tile id="ice_bush" sheet="ice_bush.png" x="0" y="0" /> + <bush id="ice_bush" loot="ice_berries" min="1" max="2" grown="3" speed="0.01" tile="ice_bush" /> + + <item id="ice_bush_seed" type="animal" cost="250" weight="1" icon="seed.ico"><action id="plant" sfx="plant_seed" object="ice_bush" /></item> +</trees> \ No newline at end of file diff --git a/games/aground/data/fonts/damage.fnt b/games/aground/data/fonts/damage.fnt new file mode 100644 index 00000000..29ff189f --- /dev/null +++ b/games/aground/data/fonts/damage.fnt @@ -0,0 +1,20 @@ +<font> + <info face="damage" size="16" bold="0" italic="0" charset="" unicode="" stretchH="100" smooth="1" aa="1" padding="2,2,2,2" spacing="0,0" outline="0"/> + <common lineHeight="10" base="7" scaleW="61" scaleH="11" pages="1" packed="0"/> + <pages> + <page id="0" file="numbers.png"/> + </pages> + <chars count="10"> + <char id="48" x="1" y="1" width="6" height="9" xoffset="0" yoffset="0" xadvance="8" page="0" chnl="15"/> + <char id="49" x="7" y="1" width="5" height="9" xoffset="0" yoffset="0" xadvance="7" page="0" chnl="15"/> + <char id="50" x="12" y="1" width="6" height="9" xoffset="0" yoffset="0" xadvance="8" page="0" chnl="15"/> + <char id="51" x="18" y="1" width="6" height="9" xoffset="0" yoffset="0" xadvance="8" page="0" chnl="15"/> + <char id="52" x="24" y="1" width="6" height="9" xoffset="0" yoffset="0" xadvance="8" page="0" chnl="15"/> + <char id="53" x="30" y="1" width="6" height="9" xoffset="0" yoffset="0" xadvance="8" page="0" chnl="15"/> + <char id="54" x="36" y="1" width="6" height="9" xoffset="0" yoffset="0" xadvance="8" page="0" chnl="15"/> + <char id="55" x="42" y="1" width="6" height="9" xoffset="0" yoffset="0" xadvance="8" page="0" chnl="15"/> + <char id="56" x="48" y="1" width="6" height="9" xoffset="0" yoffset="0" xadvance="8" page="0" chnl="15"/> + <char id="57" x="54" y="1" width="6" height="9" xoffset="0" yoffset="0" xadvance="8" page="0" chnl="15"/> + <char id="32" x="0" y="0" width="0" height="0" xoffset="0" yoffset="0" xadvance="5" page="0" chnl="15"/> + </chars> +</font> \ No newline at end of file diff --git a/games/aground/data/fonts/font.fnt b/games/aground/data/fonts/font.fnt new file mode 100644 index 00000000..982a9743 --- /dev/null +++ b/games/aground/data/fonts/font.fnt @@ -0,0 +1,307 @@ +<font> + <info face="font" size="8" bold="0" italic="0" charset="" unicode="" stretchH="100" smooth="1" aa="1" padding="2,2,2,2" spacing="0,0" outline="0"/> + <common lineHeight="10" base="11" scaleW="128" scaleH="112" pages="1" packed="0" yoffset="-3"/> + <pages> + <page id="0" file="font.png"/> + </pages> + <chars count="229"> + <char id="33" x="2" y="2" width="1" height="7" xoffset="1" yoffset="4" xadvance="3" page="0" chnl="15"/> + <char id="34" x="5" y="2" width="3" height="2" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="35" x="10" y="2" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="36" x="17" y="2" width="5" height="9" xoffset="0" yoffset="3" xadvance="6" page="0" chnl="15"/> + <char id="37" x="24" y="2" width="7" height="7" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="38" x="33" y="2" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="39" x="40" y="2" width="1" height="2" xoffset="0" yoffset="4" xadvance="2" page="0" chnl="15"/> + <char id="40" x="43" y="2" width="3" height="9" xoffset="0" yoffset="3" xadvance="4" page="0" chnl="15"/> + <char id="41" x="48" y="2" width="3" height="9" xoffset="0" yoffset="3" xadvance="4" page="0" chnl="15"/> + <char id="42" x="53" y="2" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="43" x="60" y="2" width="5" height="5" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="44" x="67" y="2" width="2" height="3" xoffset="0" yoffset="10" xadvance="3" page="0" chnl="15"/> + <char id="45" x="71" y="2" width="3" height="1" xoffset="0" yoffset="8" xadvance="4" page="0" chnl="15"/> + <char id="46" x="76" y="2" width="1" height="1" xoffset="1" yoffset="10" xadvance="3" page="0" chnl="15"/> + <char id="47" x="79" y="2" width="5" height="9" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="48" x="86" y="2" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="49" x="93" y="2" width="2" height="7" xoffset="0" yoffset="4" xadvance="3" page="0" chnl="15"/> + <char id="50" x="97" y="2" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="51" x="104" y="2" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="52" x="111" y="2" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="53" x="118" y="2" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="54" x="71" y="5" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="55" x="53" y="9" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="56" x="60" y="9" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="57" x="2" y="11" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="58" x="125" y="2" width="1" height="5" xoffset="1" yoffset="6" xadvance="3" page="0" chnl="15"/> + <char id="59" x="67" y="7" width="2" height="7" xoffset="0" yoffset="6" xadvance="3" page="0" chnl="15"/> + <char id="60" x="9" y="11" width="3" height="5" xoffset="0" yoffset="5" xadvance="4" page="0" chnl="15"/> + <char id="61" x="5" y="6" width="3" height="3" xoffset="0" yoffset="6" xadvance="4" page="0" chnl="15"/> + <char id="62" x="24" y="11" width="3" height="5" xoffset="0" yoffset="5" xadvance="4" page="0" chnl="15"/> + <char id="63" x="29" y="11" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="64" x="86" y="11" width="8" height="9" xoffset="0" yoffset="3" xadvance="9" page="0" chnl="15"/> + <char id="65" x="36" y="11" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="66" x="96" y="11" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="67" x="103" y="11" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="68" x="110" y="11" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="69" x="117" y="11" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="70" x="14" y="13" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="71" x="43" y="13" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="72" x="78" y="13" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="73" x="125" y="9" width="1" height="7" xoffset="0" yoffset="4" xadvance="2" page="0" chnl="15"/> + <char id="74" x="71" y="14" width="4" height="7" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="75" x="21" y="18" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="76" x="50" y="18" width="4" height="7" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="77" x="56" y="18" width="7" height="7" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="78" x="2" y="20" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="79" x="28" y="20" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="80" x="35" y="20" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="81" x="96" y="20" width="5" height="8" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="82" x="103" y="20" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="83" x="110" y="20" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="84" x="117" y="20" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="85" x="9" y="22" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="86" x="42" y="22" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="87" x="77" y="22" width="7" height="7" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="88" x="86" y="22" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="89" x="65" y="23" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="90" x="16" y="27" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="91" x="72" y="23" width="3" height="9" xoffset="0" yoffset="3" xadvance="4" page="0" chnl="15"/> + <char id="92" x="49" y="27" width="5" height="9" xoffset="0" yoffset="3" xadvance="6" page="0" chnl="15"/> + <char id="93" x="23" y="27" width="3" height="9" xoffset="0" yoffset="3" xadvance="4" page="0" chnl="15"/> + <char id="94" x="9" y="18" width="3" height="2" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="95" x="65" y="18" width="3" height="1" xoffset="0" yoffset="10" xadvance="4" page="0" chnl="15"/> + <char id="96" x="124" y="18" width="2" height="2" xoffset="0" yoffset="1" xadvance="3" page="0" chnl="15"/> + <char id="97" x="56" y="27" width="4" height="5" xoffset="0" yoffset="6" xadvance="5" page="0" chnl="15"/> + <char id="98" x="2" y="29" width="4" height="7" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="99" x="28" y="29" width="4" height="5" xoffset="0" yoffset="6" xadvance="5" page="0" chnl="15"/> + <char id="100" x="34" y="29" width="4" height="7" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="101" x="103" y="29" width="4" height="5" xoffset="0" yoffset="6" xadvance="5" page="0" chnl="15"/> + <char id="102" x="109" y="29" width="3" height="7" xoffset="0" yoffset="4" xadvance="3" page="0" chnl="15"/> + <char id="103" x="114" y="29" width="4" height="7" xoffset="0" yoffset="6" xadvance="5" page="0" chnl="15"/> + <char id="104" x="120" y="29" width="4" height="7" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="105" x="93" y="22" width="1" height="7" xoffset="0" yoffset="4" xadvance="2" page="0" chnl="15"/> + <char id="106" x="96" y="30" width="2" height="9" xoffset="-1" yoffset="4" xadvance="2" page="0" chnl="15"/> + <char id="107" x="8" y="31" width="4" height="7" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="108" x="62" y="27" width="1" height="7" xoffset="0" yoffset="4" xadvance="2" page="0" chnl="15"/> + <char id="109" x="40" y="31" width="7" height="5" xoffset="0" yoffset="6" xadvance="8" page="0" chnl="15"/> + <char id="110" x="77" y="31" width="4" height="5" xoffset="0" yoffset="6" xadvance="5" page="0" chnl="15"/> + <char id="111" x="83" y="31" width="4" height="5" xoffset="0" yoffset="6" xadvance="5" page="0" chnl="15"/> + <char id="112" x="89" y="31" width="4" height="7" xoffset="0" yoffset="6" xadvance="5" page="0" chnl="15"/> + <char id="113" x="65" y="32" width="4" height="7" xoffset="0" yoffset="6" xadvance="5" page="0" chnl="15"/> + <char id="114" x="56" y="34" width="3" height="5" xoffset="0" yoffset="6" xadvance="4" page="0" chnl="15"/> + <char id="115" x="71" y="34" width="3" height="5" xoffset="0" yoffset="6" xadvance="4" page="0" chnl="15"/> + <char id="116" x="14" y="36" width="3" height="7" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="117" x="28" y="36" width="4" height="5" xoffset="0" yoffset="6" xadvance="5" page="0" chnl="15"/> + <char id="118" x="100" y="36" width="4" height="5" xoffset="0" yoffset="6" xadvance="5" page="0" chnl="15"/> + <char id="119" x="19" y="38" width="7" height="5" xoffset="0" yoffset="6" xadvance="8" page="0" chnl="15"/> + <char id="120" x="2" y="38" width="4" height="5" xoffset="0" yoffset="6" xadvance="5" page="0" chnl="15"/> + <char id="121" x="34" y="38" width="4" height="7" xoffset="0" yoffset="6" xadvance="5" page="0" chnl="15"/> + <char id="122" x="40" y="38" width="3" height="5" xoffset="0" yoffset="6" xadvance="4" page="0" chnl="15"/> + <char id="123" x="45" y="38" width="3" height="9" xoffset="0" yoffset="3" xadvance="4" page="0" chnl="15"/> + <char id="124" x="61" y="36" width="1" height="9" xoffset="0" yoffset="3" xadvance="2" page="0" chnl="15"/> + <char id="125" x="50" y="38" width="3" height="9" xoffset="0" yoffset="3" xadvance="4" page="0" chnl="15"/> + <char id="126" x="76" y="38" width="4" height="2" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="161" x="106" y="36" width="1" height="7" xoffset="1" yoffset="4" xadvance="3" page="0" chnl="15"/> + <char id="162" x="82" y="38" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="163" x="109" y="38" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="164" x="116" y="38" width="5" height="5" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="165" x="89" y="40" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="166" x="123" y="38" width="1" height="9" xoffset="1" yoffset="3" xadvance="3" page="0" chnl="15"/> + <char id="167" x="8" y="40" width="4" height="9" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="168" x="16" y="22" width="3" height="1" xoffset="0" yoffset="2" xadvance="4" page="0" chnl="15"/> + <char id="169" x="64" y="41" width="8" height="9" xoffset="0" yoffset="3" xadvance="9" page="0" chnl="15"/> + <char id="170" x="55" y="41" width="3" height="3" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="171" x="74" y="42" width="6" height="5" xoffset="0" yoffset="5" xadvance="7" page="0" chnl="15"/> + <char id="172" x="28" y="43" width="3" height="3" xoffset="0" yoffset="6" xadvance="4" page="0" chnl="15"/> + <char id="174" x="96" y="43" width="8" height="9" xoffset="0" yoffset="3" xadvance="9" page="0" chnl="15"/> + <char id="175" x="2" y="45" width="3" height="1" xoffset="0" yoffset="2" xadvance="4" page="0" chnl="15"/> + <char id="176" x="14" y="45" width="3" height="3" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="177" x="19" y="45" width="5" height="5" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="178" x="116" y="45" width="4" height="5" xoffset="0" yoffset="1" xadvance="5" page="0" chnl="15"/> + <char id="179" x="55" y="46" width="4" height="5" xoffset="0" yoffset="1" xadvance="5" page="0" chnl="15"/> + <char id="180" x="124" y="22" width="2" height="2" xoffset="0" yoffset="1" xadvance="3" page="0" chnl="15"/> + <char id="181" x="33" y="47" width="4" height="7" xoffset="0" yoffset="6" xadvance="5" page="0" chnl="15"/> + <char id="182" x="82" y="47" width="5" height="9" xoffset="0" yoffset="3" xadvance="6" page="0" chnl="15"/> + <char id="183" x="40" y="6" width="1" height="1" xoffset="1" yoffset="7" xadvance="3" page="0" chnl="15"/> + <char id="184" x="40" y="45" width="2" height="2" xoffset="0" yoffset="11" xadvance="3" page="0" chnl="15"/> + <char id="185" x="106" y="47" width="2" height="5" xoffset="0" yoffset="1" xadvance="3" page="0" chnl="15"/> + <char id="186" x="110" y="47" width="3" height="3" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="187" x="39" y="49" width="6" height="5" xoffset="0" yoffset="5" xadvance="7" page="0" chnl="15"/> + <char id="188" x="2" y="51" width="9" height="9" xoffset="0" yoffset="3" xadvance="10" page="0" chnl="15"/> + <char id="189" x="13" y="52" width="10" height="9" xoffset="0" yoffset="3" xadvance="11" page="0" chnl="15"/> + <char id="190" x="61" y="52" width="10" height="9" xoffset="0" yoffset="3" xadvance="11" page="0" chnl="15"/> + <char id="191" x="26" y="48" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="192" x="47" y="49" width="5" height="10" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="193" x="74" y="49" width="5" height="10" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="194" x="89" y="49" width="5" height="10" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="195" x="110" y="52" width="5" height="10" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="196" x="117" y="52" width="5" height="9" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="197" x="54" y="53" width="5" height="11" xoffset="0" yoffset="0" xadvance="6" page="0" chnl="15"/> + <char id="198" x="96" y="54" width="9" height="7" xoffset="0" yoffset="4" xadvance="10" page="0" chnl="15"/> + <char id="199" x="33" y="56" width="5" height="9" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="200" x="40" y="56" width="5" height="10" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="201" x="25" y="57" width="5" height="10" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="202" x="81" y="58" width="5" height="10" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="203" x="47" y="61" width="5" height="9" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="204" x="124" y="49" width="2" height="10" xoffset="-1" yoffset="1" xadvance="2" page="0" chnl="15"/> + <char id="205" x="73" y="61" width="2" height="10" xoffset="0" yoffset="1" xadvance="2" page="0" chnl="15"/> + <char id="206" x="88" y="61" width="3" height="10" xoffset="-1" yoffset="1" xadvance="2" page="0" chnl="15"/> + <char id="207" x="2" y="62" width="3" height="9" xoffset="-1" yoffset="2" xadvance="2" page="0" chnl="15"/> + <char id="208" x="7" y="63" width="6" height="7" xoffset="0" yoffset="4" xadvance="7" page="0" chnl="15"/> + <char id="209" x="15" y="63" width="5" height="10" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="210" x="61" y="63" width="5" height="10" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="211" x="93" y="63" width="5" height="10" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="212" x="100" y="63" width="5" height="10" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="213" x="117" y="63" width="5" height="10" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="214" x="107" y="64" width="5" height="9" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="215" x="54" y="66" width="5" height="5" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="216" x="32" y="67" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="217" x="39" y="68" width="5" height="10" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="218" x="22" y="69" width="5" height="10" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="219" x="77" y="70" width="5" height="10" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="220" x="7" y="72" width="5" height="9" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="221" x="46" y="72" width="5" height="10" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="222" x="53" y="73" width="5" height="9" xoffset="0" yoffset="3" xadvance="6" page="0" chnl="15"/> + <char id="223" x="68" y="73" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="224" x="84" y="73" width="4" height="8" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="225" x="14" y="75" width="4" height="8" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="226" x="60" y="75" width="4" height="8" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="227" x="90" y="75" width="4" height="8" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="228" x="96" y="75" width="4" height="7" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="229" x="102" y="75" width="4" height="9" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="230" x="108" y="75" width="7" height="5" xoffset="0" yoffset="6" xadvance="8" page="0" chnl="15"/> + <char id="231" x="117" y="75" width="4" height="7" xoffset="0" yoffset="6" xadvance="5" page="0" chnl="15"/> + <char id="232" x="29" y="76" width="4" height="8" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="233" x="35" y="80" width="4" height="8" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="234" x="20" y="81" width="4" height="8" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="235" x="66" y="82" width="4" height="7" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="236" x="124" y="61" width="2" height="8" xoffset="-1" yoffset="3" xadvance="2" page="0" chnl="15"/> + <char id="237" x="68" y="63" width="2" height="8" xoffset="0" yoffset="3" xadvance="2" page="0" chnl="15"/> + <char id="238" x="2" y="73" width="3" height="8" xoffset="-1" yoffset="3" xadvance="2" page="0" chnl="15"/> + <char id="239" x="123" y="75" width="3" height="7" xoffset="-1" yoffset="4" xadvance="2" page="0" chnl="15"/> + <char id="240" x="72" y="82" width="4" height="9" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="241" x="78" y="82" width="4" height="8" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="242" x="108" y="82" width="4" height="8" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="243" x="2" y="83" width="4" height="8" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="244" x="8" y="83" width="4" height="8" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="245" x="84" y="83" width="4" height="8" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="246" x="41" y="84" width="4" height="7" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="247" x="47" y="84" width="5" height="5" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="248" x="114" y="84" width="5" height="5" xoffset="0" yoffset="6" xadvance="6" page="0" chnl="15"/> + <char id="249" x="54" y="84" width="4" height="8" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="250" x="96" y="84" width="4" height="8" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="251" x="121" y="84" width="4" height="8" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="252" x="14" y="85" width="4" height="7" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="253" x="60" y="85" width="4" height="10" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="254" x="90" y="85" width="4" height="7" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="255" x="26" y="86" width="4" height="9" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="305" x="107" y="54" width="1" height="5" xoffset="0" yoffset="6" xadvance="2" page="0" chnl="15"/> + <char id="321" x="32" y="90" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="322" x="102" y="86" width="3" height="7" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="338" x="107" y="92" width="9" height="7" xoffset="0" yoffset="4" xadvance="10" page="0" chnl="15"/> + <char id="339" x="2" y="93" width="7" height="5" xoffset="0" yoffset="6" xadvance="8" page="0" chnl="15"/> + <char id="352" x="47" y="91" width="5" height="10" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="353" x="20" y="91" width="4" height="8" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="376" x="39" y="93" width="5" height="9" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="381" x="66" y="93" width="5" height="10" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="382" x="78" y="92" width="3" height="8" xoffset="0" yoffset="3" xadvance="4" page="0" chnl="15"/> + <char id="402" x="73" y="93" width="3" height="9" xoffset="0" yoffset="3" xadvance="4" page="0" chnl="15"/> + <char id="710" x="41" y="80" width="3" height="2" xoffset="0" yoffset="1" xadvance="4" page="0" chnl="15"/> + <char id="711" x="83" y="93" width="3" height="2" xoffset="0" yoffset="1" xadvance="4" page="0" chnl="15"/> + <char id="728" x="11" y="94" width="3" height="2" xoffset="0" yoffset="1" xadvance="4" page="0" chnl="15"/> + <char id="729" x="21" y="13" width="1" height="1" xoffset="0" yoffset="2" xadvance="2" page="0" chnl="15"/> + <char id="730" x="54" y="94" width="3" height="3" xoffset="0" yoffset="0" xadvance="4" page="0" chnl="15"/> + <char id="731" x="77" y="61" width="2" height="2" xoffset="0" yoffset="11" xadvance="3" page="0" chnl="15"/> + <char id="732" x="88" y="94" width="4" height="2" xoffset="0" yoffset="1" xadvance="5" page="0" chnl="15"/> + <char id="733" x="94" y="94" width="4" height="2" xoffset="0" yoffset="1" xadvance="5" page="0" chnl="15"/> + <char id="956" x="118" y="94" width="4" height="7" xoffset="0" yoffset="6" xadvance="5" page="0" chnl="15"/> + <char id="8211" x="100" y="95" width="5" height="1" xoffset="0" yoffset="7" xadvance="6" page="0" chnl="15"/> + <char id="8212" x="11" y="98" width="7" height="1" xoffset="0" yoffset="7" xadvance="8" page="0" chnl="15"/> + <char id="8216" x="77" y="65" width="2" height="3" xoffset="0" yoffset="4" xadvance="3" page="0" chnl="15"/> + <char id="8217" x="124" y="94" width="2" height="3" xoffset="0" yoffset="4" xadvance="3" page="0" chnl="15"/> + <char id="8218" x="26" y="97" width="2" height="3" xoffset="0" yoffset="10" xadvance="3" page="0" chnl="15"/> + <char id="8220" x="59" y="97" width="4" height="3" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="8221" x="83" y="98" width="4" height="3" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="8222" x="89" y="98" width="4" height="3" xoffset="0" yoffset="10" xadvance="5" page="0" chnl="15"/> + <char id="8224" x="95" y="98" width="3" height="9" xoffset="0" yoffset="3" xadvance="4" page="0" chnl="15"/> + <char id="8225" x="100" y="98" width="3" height="9" xoffset="0" yoffset="3" xadvance="4" page="0" chnl="15"/> + <char id="8226" x="30" y="99" width="5" height="5" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="8230" x="2" y="100" width="5" height="1" xoffset="1" yoffset="10" xadvance="7" page="0" chnl="15"/> + <char id="8240" x="9" y="101" width="9" height="7" xoffset="0" yoffset="4" xadvance="10" page="0" chnl="15"/> + <char id="8249" x="54" y="99" width="3" height="5" xoffset="0" yoffset="5" xadvance="4" page="0" chnl="15"/> + <char id="8250" x="20" y="101" width="3" height="5" xoffset="0" yoffset="5" xadvance="4" page="0" chnl="15"/> + <char id="8260" x="105" y="101" width="5" height="9" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="8364" x="46" y="103" width="6" height="7" xoffset="0" yoffset="4" xadvance="7" page="0" chnl="15"/> + <char id="8482" x="78" y="103" width="6" height="3" xoffset="0" yoffset="4" xadvance="7" page="0" chnl="15"/> + <char id="8722" x="2" y="48" width="3" height="1" xoffset="0" yoffset="7" xadvance="4" page="0" chnl="15"/> + <char id="64257" x="112" y="101" width="4" height="7" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="64258" x="59" y="102" width="4" height="7" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="32" x="0" y="0" width="0" height="0" xoffset="0" yoffset="4" xadvance="3" page="0" chnl="15"/> + </chars> + <kernings count="66"> + <kerning first="47" second="47" amount="-2"/> + <kerning first="70" second="74" amount="-1"/> + <kerning first="70" second="97" amount="-1"/> + <kerning first="70" second="99" amount="-1"/> + <kerning first="70" second="100" amount="-1"/> + <kerning first="70" second="101" amount="-1"/> + <kerning first="70" second="103" amount="-1"/> + <kerning first="70" second="109" amount="-1"/> + <kerning first="70" second="110" amount="-1"/> + <kerning first="70" second="111" amount="-1"/> + <kerning first="70" second="112" amount="-1"/> + <kerning first="70" second="113" amount="-1"/> + <kerning first="70" second="114" amount="-1"/> + <kerning first="70" second="115" amount="-1"/> + <kerning first="70" second="116" amount="-1"/> + <kerning first="70" second="117" amount="-1"/> + <kerning first="70" second="118" amount="-1"/> + <kerning first="70" second="119" amount="-1"/> + <kerning first="70" second="120" amount="-1"/> + <kerning first="70" second="121" amount="-1"/> + <kerning first="70" second="122" amount="-1"/> + <kerning first="76" second="84" amount="-1"/> + <kerning first="76" second="86" amount="-1"/> + <kerning first="76" second="89" amount="-1"/> + <kerning first="80" second="74" amount="-1"/> + <kerning first="84" second="74" amount="-1"/> + <kerning first="84" second="97" amount="-1"/> + <kerning first="84" second="99" amount="-1"/> + <kerning first="84" second="100" amount="-1"/> + <kerning first="84" second="101" amount="-1"/> + <kerning first="84" second="103" amount="-1"/> + <kerning first="84" second="109" amount="-1"/> + <kerning first="84" second="110" amount="-1"/> + <kerning first="84" second="111" amount="-1"/> + <kerning first="84" second="112" amount="-1"/> + <kerning first="84" second="113" amount="-1"/> + <kerning first="84" second="114" amount="-1"/> + <kerning first="84" second="115" amount="-1"/> + <kerning first="84" second="116" amount="-1"/> + <kerning first="84" second="117" amount="-1"/> + <kerning first="84" second="118" amount="-1"/> + <kerning first="84" second="119" amount="-1"/> + <kerning first="84" second="120" amount="-1"/> + <kerning first="84" second="121" amount="-1"/> + <kerning first="84" second="122" amount="-1"/> + <kerning first="86" second="74" amount="-1"/> + <kerning first="89" second="74" amount="-1"/> + <kerning first="89" second="97" amount="-1"/> + <kerning first="89" second="99" amount="-1"/> + <kerning first="89" second="100" amount="-1"/> + <kerning first="89" second="101" amount="-1"/> + <kerning first="89" second="103" amount="-1"/> + <kerning first="89" second="109" amount="-1"/> + <kerning first="89" second="110" amount="-1"/> + <kerning first="89" second="111" amount="-1"/> + <kerning first="89" second="112" amount="-1"/> + <kerning first="89" second="113" amount="-1"/> + <kerning first="89" second="114" amount="-1"/> + <kerning first="89" second="115" amount="-1"/> + <kerning first="89" second="116" amount="-1"/> + <kerning first="89" second="117" amount="-1"/> + <kerning first="89" second="118" amount="-1"/> + <kerning first="89" second="119" amount="-1"/> + <kerning first="89" second="120" amount="-1"/> + <kerning first="89" second="121" amount="-1"/> + <kerning first="89" second="122" amount="-1"/> + </kernings> +</font> \ No newline at end of file diff --git a/games/aground/data/fonts/font.png b/games/aground/data/fonts/font.png new file mode 100644 index 00000000..99380d9b Binary files /dev/null and b/games/aground/data/fonts/font.png differ diff --git a/games/aground/data/fonts/heal.fnt b/games/aground/data/fonts/heal.fnt new file mode 100644 index 00000000..417f0852 --- /dev/null +++ b/games/aground/data/fonts/heal.fnt @@ -0,0 +1,20 @@ +<font> + <info face="heal" size="16" bold="0" italic="0" charset="" unicode="" stretchH="100" smooth="1" aa="1" padding="2,2,2,2" spacing="0,0" outline="0"/> + <common lineHeight="10" base="7" scaleW="61" scaleH="11" pages="1" packed="0"/> + <pages> + <page id="0" file="numbers.png"/> + </pages> + <chars count="10"> + <char id="48" x="1" y="12" width="6" height="9" xoffset="0" yoffset="0" xadvance="8" page="0" chnl="15"/> + <char id="49" x="7" y="12" width="5" height="9" xoffset="0" yoffset="0" xadvance="7" page="0" chnl="15"/> + <char id="50" x="12" y="12" width="6" height="9" xoffset="0" yoffset="0" xadvance="8" page="0" chnl="15"/> + <char id="51" x="18" y="12" width="6" height="9" xoffset="0" yoffset="0" xadvance="8" page="0" chnl="15"/> + <char id="52" x="24" y="12" width="6" height="9" xoffset="0" yoffset="0" xadvance="8" page="0" chnl="15"/> + <char id="53" x="30" y="12" width="6" height="9" xoffset="0" yoffset="0" xadvance="8" page="0" chnl="15"/> + <char id="54" x="36" y="12" width="6" height="9" xoffset="0" yoffset="0" xadvance="8" page="0" chnl="15"/> + <char id="55" x="42" y="12" width="6" height="9" xoffset="0" yoffset="0" xadvance="8" page="0" chnl="15"/> + <char id="56" x="48" y="12" width="6" height="9" xoffset="0" yoffset="0" xadvance="8" page="0" chnl="15"/> + <char id="57" x="54" y="12" width="6" height="9" xoffset="0" yoffset="0" xadvance="8" page="0" chnl="15"/> + <char id="32" x="0" y="0" width="0" height="0" xoffset="0" yoffset="0" xadvance="5" page="0" chnl="15"/> + </chars> +</font> \ No newline at end of file diff --git a/games/aground/data/fonts/numbers.png b/games/aground/data/fonts/numbers.png new file mode 100644 index 00000000..57a9c1bd Binary files /dev/null and b/games/aground/data/fonts/numbers.png differ diff --git a/games/aground/data/keyboards/default.xml b/games/aground/data/keyboards/default.xml new file mode 100644 index 00000000..ebbe97c9 --- /dev/null +++ b/games/aground/data/keyboards/default.xml @@ -0,0 +1,107 @@ +<?xml version="1.0" encoding="utf-8" ?> +<keyboard> + <key name="KEY_A" type="small">A</key> + <key name="KEY_B" type="small">B</key> + <key name="KEY_C" type="small">C</key> + <key name="KEY_D" type="small">D</key> + <key name="KEY_E" type="small">E</key> + <key name="KEY_F" type="small">F</key> + <key name="KEY_G" type="small">G</key> + <key name="KEY_H" type="small">H</key> + <key name="KEY_I" type="small">I</key> + <key name="KEY_J" type="small">J</key> + <key name="KEY_K" type="small">K</key> + <key name="KEY_L" type="small">L</key> + <key name="KEY_M" type="small">M</key> + <key name="KEY_N" type="small">N</key> + <key name="KEY_O" type="small">O</key> + <key name="KEY_P" type="small">P</key> + <key name="KEY_Q" type="small">Q</key> + <key name="KEY_R" type="small">R</key> + <key name="KEY_S" type="small">S</key> + <key name="KEY_T" type="small">T</key> + <key name="KEY_U" type="small">U</key> + <key name="KEY_V" type="small">V</key> + <key name="KEY_W" type="small">W</key> + <key name="KEY_X" type="small">X</key> + <key name="KEY_Y" type="small">Y</key> + <key name="KEY_Z" type="small">Z</key> + + <key name="KEY_1" type="small">1</key> + <key name="KEY_2" type="small">2</key> + <key name="KEY_3" type="small">3</key> + <key name="KEY_4" type="small">4</key> + <key name="KEY_5" type="small">5</key> + <key name="KEY_6" type="small">6</key> + <key name="KEY_7" type="small">7</key> + <key name="KEY_8" type="small">8</key> + <key name="KEY_9" type="small">9</key> + <key name="KEY_0" type="small">0</key> + + <key name="ENTER" type="medium">Enter</key> + <key name="ESCAPE" type="small">Esc</key> + <key name="BACKSPACE" type="medium">Bksp</key> + <key name="TAB" type="medium">Tab</key> + <key name="SPACE" type="large">Space</key> + + <key name="MINUS" type="small">-</key> + <key name="EQUALS" type="small">=</key> + <key name="LEFT_BRACKET" type="small">[</key> + <key name="RIGHT_BRACKET" type="small">]</key> + + <key name="LSHIFT" type="medium">Shift</key> + <key name="LCTRL" type="medium">Ctrl</key> + <key name="LALT" type="small">Alt</key> + + <key name="BACKSLASH" type="small">\</key> + + <key name="SEMICOLON" type="small">;</key> + <key name="QUOTE" type="small">'</key> + <key name="BACK_QUOTE" type="small">`</key> + + <key name="COMMA" type="small">,</key> + <key name="PERIOD" type="small">.</key> + <key name="SLASH" type="small">/</key> + + <key name="CAPS_LOCK" type="medium">Caps Lock</key> + + <key name="F1" type="small">F1</key> + <key name="F2" type="small">F2</key> + <key name="F3" type="small">F3</key> + <key name="F4" type="small">F4</key> + <key name="F5" type="small">F5</key> + <key name="F6" type="small">F6</key> + <key name="F7" type="small">F7</key> + <key name="F8" type="small">F8</key> + <key name="F9" type="small">F9</key> + <key name="F10" type="small">F10</key> + <key name="F11" type="small">F11</key> + <key name="F12" type="small">F12</key> + + <key name="PRINT_SCREEN" type="small">Print\nScreen</key> + <key name="SCROLL_LOCK" type="small">Scroll\nLock</key> + <key name="PAUSE" type="small">Pause</key> + + <key name="INSERT" type="small">Insert</key> + <key name="HOME" type="small">Home</key> + <key name="PAGE_UP" type="small">Page\nUp</key> + <key name="DELETE" type="small">Delete</key> + <key name="END" type="small">End</key> + <key name="PAGE_DOWN" type="small">Page\nDown</key> + <key name="RIGHT" type="small" icon="right_arrow" /> + <key name="LEFT" type="small" icon="left_arrow" /> + <key name="DOWN" type="small" icon="down_arrow" /> + <key name="UP" type="small" icon="up_arrow" /> + + <key name="NUM_LOCK" type="small">Num\nLock</key> + <key name="NUMPAD_1" type="small">Num 1</key> + <key name="NUMPAD_2" type="small">Num 2</key> + <key name="NUMPAD_3" type="small">Num 3</key> + <key name="NUMPAD_4" type="small">Num 4</key> + <key name="NUMPAD_5" type="small">Num 5</key> + <key name="NUMPAD_6" type="small">Num 6</key> + <key name="NUMPAD_7" type="small">Num 7</key> + <key name="NUMPAD_8" type="small">Num 8</key> + <key name="NUMPAD_9" type="small">Num 9</key> + <key name="NUMPAD_0" type="small">Num 0</key> +</keyboard> \ No newline at end of file diff --git a/games/aground/data/mods/chinese/fonts/zpix.fnt.z b/games/aground/data/mods/chinese/fonts/zpix.fnt.z new file mode 100644 index 00000000..d814805a Binary files /dev/null and b/games/aground/data/mods/chinese/fonts/zpix.fnt.z differ diff --git a/games/aground/data/mods/chinese/fonts/zpix_0.png b/games/aground/data/mods/chinese/fonts/zpix_0.png new file mode 100644 index 00000000..880e6b7e Binary files /dev/null and b/games/aground/data/mods/chinese/fonts/zpix_0.png differ diff --git a/games/aground/data/mods/chinese/mod.xml b/games/aground/data/mods/chinese/mod.xml new file mode 100644 index 00000000..abbe509b --- /dev/null +++ b/games/aground/data/mods/chinese/mod.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8" ?> +<mod> + <name>Chinese Translation</name> + <description>A chinese translation (traditional and simplified) of the core game.</description> + <author>[font=zpix]skps2010蘆筍</author> + <version>1.0.0</version> + <init multiplayerSync="false"> + <font id="zpix" path="fonts/zpix.fnt.z" /> + <include id="zh_CN.xml" includeRoot="true" /> + <include id="zh_TW.xml" includeRoot="true" /> + </init> +</mod> + diff --git a/games/aground/data/mods/chinese/zh_CN.xml b/games/aground/data/mods/chinese/zh_CN.xml new file mode 100644 index 00000000..76715d2c --- /dev/null +++ b/games/aground/data/mods/chinese/zh_CN.xml @@ -0,0 +1,628 @@ +<?xml version="1.0" encoding="utf-8" ?> +<lang id="zh_CN" name="简体中文" font="fonts/zpix.fnt.z"> + <section id="common"> + <text id="blocked">格挡!</text> + <text id="miss">未命中!</text> + <text id="critical_hit">爆击!</text> + <text id="weight">重量:</text> + <text id="save">游戏已储存</text> + <text id="del_save">删除记录</text> + <text id="save_corrupt">纪录档坏了! 正在开启新游戏。</text> + <text id="fuel">燃料</text> + <text id="add_fuel">增加燃料</text> + <text id="all">全部</text> + <text id="equipment">装备</text> + <text id="attack">攻击:</text> + <text id="range">远攻:</text> + <text id="defense">防御:</text> + <text id="cut">砍树:</text> + <text id="mine">挖掘:</text> + <text id="capacity">携带:</text> + <text id="health">生命:</text> + <text id="stamina">体力:</text> + <text id="ok">好吧</text> + <text id="cancel">取消</text> + <text id="yes">开</text> + <text id="no">关</text> + <text id="accept">同意</text> + <text id="reject">拒绝</text> + <text id="sell">卖出</text> + <text id="buy">购买</text> + <text id="drop_item">你想把多少丢掉?</text> + <text id="eat_item">你想要吃/喝多少?</text> + <text id="store_item">你想要储存多少?</text> + <text id="retrieve_item">你想要收回多少?</text> + <text id="sell_item">你想要卖出多少?</text> + <text id="buy_item">你想要购买多少?</text> + <text id="requires">-- 原料 --</text> + <text id="repair_cost">-- 修补花费 --</text> + <text id="repaired">{item} 已修理。</text> + <text id="inventory">物品栏</text> + <text id="quests">任务</text> + <text id="smelter">冶炼厂</text> + <text id="kitchen">厨房</text> + <text id="workshop">工作坊</text> + <text id="storehouse">仓库</text> + <text id="dockhouse">港口小屋</text> + <text id="harvest">收割</text> + <text id="harvest_all">收割全部</text> + <text id="manage">管理</text> + <text id="feed">喂食</text> + <text id="lab">实验室</text> + <text id="per_hit">每一击:</text> + <text id="move">移动</text> + <text id="newgame">新游戏</text> + <text id="continue">继续</text> + <text id="options">选项</text> + <text id="exit">离开</text> + <text id="forums">社群</text> + <text id="empty">空的</text> + <text id="empty_slot">< 空栏位 ></text> + <text id="corrupt_slot">毁损的栏位</text> + <text id="overwrite">你确定你想复写这个栏位?</text> + <text id="none">无</text> + <text id="addition_slots">领域:</text> + <text id="trap_overlap">[color=770000]你不能在陷阱上放陷阱![/color]</text> + <text id="placed">{item} 已放置。</text> + <text id="level_up">等级提升!</text> + <text id="level">等级:</text> + <text id="experience">经验:</text> + <text id="hotkey">选择物品</text> + <text id="set_hotkey">设定快捷键:</text> + <text id="retry">重试</text> + <text id="title">标题</text> + <text id="move_all">移动全部</text> + <text id="add_animal">新增动物</text> + <text id="select_feed">选择食物</text> + <text id="use_count">你想要用多少?</text> + <text id="select_fertilizer">选择肥料</text> + <text id="muted">游戏已静音</text> + <text id="unmuted">游戏已解除静音</text> + <text id="storehouse_add">{npc} 新增 {count} {item} 到 [color=ff2222]仓库[/color]</text> + <text id="auto_eat">吃了 {count} {item} 来回血</text> + <text id="drop_all">你确定你要丢掉所有的 {item}? 他们会永远消失。</text> + <text id="sign_message">设定 [item=sign] 讯息:</text> + <text id="transform">你想要将多少转变成 {into}?</text> + <text id="collect_complete">搜集完成</text> + <text id="set_sticky">设定 [tile=sticky] 成附随物品</text> + <text id="fishing">钓鱼:</text> + <text id="fishing_line">有东西咬勾了!</text> + <text id="fishing_fail">他走了!</text> + <text id="fishing_hooked">等待...</text> + <text id="fishing_pull">拉起来!</text> + <text id="craft">你想要製造多少?</text> + <text id="coins">钱币</text> + <text id="speed">速度:</text> + <text id="endurance">耐力:</text> + <text id="broken">{item} 已经坏了!</text> + <text id="rem_storehouse_items">只看物品栏</text> + <text id="add_storehouse_items">包括仓库</text> + <text id="hungry">{item} 饿了!</text> + <text id="not_hungry">{item} 不饿了。</text> + <text id="fed">已经喂了 {item} 。</text> + </section> + <section id="actions"> + <text id="drop">丢弃</text> + <text id="place">放置</text> + <text id="use">使用</text> + <text id="craft">製造</text> + <text id="equip">装备</text> + <text id="unequip">不装备</text> + <text id="fire">发射</text> + <text id="eat">吃</text> + <text id="loot">掠夺</text> + <text id="feed">喂</text> + <text id="collect">搜集</text> + <text id="open">打开</text> + <text id="carve">凋刻</text> + <text id="switch">切换</text> + <text id="transform">转换</text> + <text id="repair">修理</text> + </section> + <section id="item.names"> + <text id="wood">木头</text> + <text id="coal">煤炭</text> + <text id="iron">铁矿</text> + <text id="quartz">水晶</text> + <text id="gold">金矿</text> + <text id="diamond">鑽石</text> + <text id="sulfur">硫磺</text> + <text id="oil">生油</text> + <text id="titanium">钛</text> + <text id="uranium">铀</text> + <text id="iron_bar">铁条</text> + <text id="steel_bar">钢条</text> + <text id="gold_bar">金条</text> + <text id="meat">肉</text> + <text id="fruit">苹果</text> + <text id="wheat">小麦</text> + <text id="eggs">蛋</text> + <text id="milk">牛奶</text> + <text id="sugar">糖</text> + <text id="steak">肉排</text> + <text id="bread">麵包</text> + <text id="pie">馅饼</text> + <text id="pancakes">薄煎饼</text> + <text id="hamburger">汉堡</text> + <text id="cheese">起司</text> + <text id="pizza">比萨</text> + <text id="omelette">煎蛋</text> + <text id="cheeseburger">起司汉堡</text> + <text id="cake">蛋糕</text> + <text id="candy_apple">糖苹果</text> + <text id="dragonblood">龙血</text> + <text id="stone_axe">石斧</text> + <text id="stone_pickaxe">石镐</text> + <text id="broken_pickaxe">坏掉的镐</text> + <text id="coin_purse">钱包</text> + <text id="iron_pickaxe">铁镐</text> + <text id="iron_sword">铁剑</text> + <text id="iron_armor">铁甲</text> + <text id="steel_pickaxe">钢镐</text> + <text id="steel_sword">钢剑</text> + <text id="steel_armor">钢盔甲</text> + <text id="bow">弓</text> + <text id="arrow">箭头</text> + <text id="ice_arrow">冰箭</text> + <text id="backpack">背包</text> + <text id="mega_backpack">大型背包</text> + <text id="ultra_backpack">超级背包</text> + <text id="magic_pickaxe">魔法镐</text> + <text id="magic_sword">魔法剑</text> + <text id="magic_backpack">魔法背包</text> + <text id="magic_box">魔法盒</text> + <text id="cloth">布</text> + <text id="net">网子</text> + <text id="berries">浆果</text> + <text id="red_berries">红色浆果</text> + <text id="ice_berries">冰浆果</text> + <text id="health_potion">生命药水</text> + <text id="stamina_potion">体力药水</text> + <text id="attack_potion">攻击药水</text> + <text id="defense_potion">防御药水</text> + <text id="speed_potion">速度药水</text> + <text id="endurance_potion">耐力药水</text> + <text id="rat">老鼠</text> + <text id="pig">猪</text> + <text id="wyrm">地龙</text> + <text id="cocoon">茧</text> + <text id="dragon">小龙</text> + <text id="young_dragon">幼笼</text> + <text id="adult_dragon">成龙</text> + <text id="cockatiel">玄凤鹦鹉</text> + <text id="wolf">驯狼</text> + <text id="cat">猫</text> + <text id="boat">船</text> + <text id="fence">篱笆</text> + <text id="torch">火把</text> + <text id="trap">陷阱</text> + <text id="workbench">工作台</text> + <text id="anvil">铁砧</text> + <text id="chest">箱子</text> + <text id="jakolantern">南瓜灯</text> + <text id="sign">告示牌</text> + <text id="rusty_axe">生鏽的斧头</text> + <text id="cotton">棉花</text> + <text id="pumpkin">南瓜</text> + <text id="chicken">鸡</text> + <text id="cow">牛</text> + <text id="fishing_rod">钓竿</text> + <text id="toothfish">剑鱼</text> + <text id="rockfish">石斑鱼</text> + <text id="coral_cod">珊瑚鳕鱼</text> + <text id="fertilizer">肥料</text> + <text id="yeti_fur">雪人毛皮</text> + <text id="fire_gem">火宝石</text> + <text id="buckler">圆盾</text> + <text id="kite_shield">钢盾</text> + <text id="ice_shield">冰盾</text> + <text id="snowman">雪人</text> + </section> + <section id="item.descriptions"> + <text id="boat">航行世界。</text> + <text id="fence">把敌人挡在外面。</text> + <text id="torch">下20次开採+1视野。</text> + <text id="trap">陷阱:4点伤害。</text> + <text id="red_berries">15秒内+1攻击。</text> + <text id="ice_berries">30秒内+1防御。</text> + <text id="magic_box">包含一切。</text> + <text id="health_potion">+10最大生命值。</text> + <text id="stamina_potion">+20最大体力。</text> + <text id="attack_potion">30秒内+1攻击。</text> + <text id="defense_potion">30秒内+1防御。</text> + <text id="speed_potion">提高速度。</text> + <text id="endurance_potion">增加耐力。</text> + <text id="workbench">製造物品。</text> + <text id="anvil">修理物品。</text> + <text id="chest">储存无品。</text> + <text id="sign">显示消息。</text> + <text id="ice_arrow">冻结敌人。</text> + </section> + <section id="achievement.names"> + <text id="hut">庇护</text> + <text id="boar">肉的来源</text> + <text id="storehouse">无限的空间</text> + <text id="farm">佃农</text> + <text id="orchard">苹果</text> + <text id="smelter">冶铁</text> + <text id="kitchen">好胃口</text> + <text id="backpack">负重高手</text> + <text id="workshop">製作时间</text> + <text id="wyrm">地龙杀手</text> + <text id="golem">岩石杀手</text> + <text id="diamond">闪亮</text> + <text id="market">良好的贸易</text> + <text id="bigpack">负重大师</text> + <text id="capture_wyrm">得到地龙</text> + <text id="pen">为猪挤奶</text> + <text id="pizza">嗯,起司</text> + <text id="dock">遥远的海岸</text> + <text id="boat">设置风帆</text> + <text id="lab">实验</text> + <text id="wyrm_pen">无限的血液</text> + <text id="dragon">驯养</text> + </section> + <section id="achievement.descriptions"> + <text id="hut">建立[color=ff2222]小屋[/color]。</text> + <text id="boar">击败[color=ff2222]野猪[/color]。</text> + <text id="storehouse">建立[color=ff2222] 仓库 [/color]。</text> + <text id="farm">建立[color=ff2222] 农田 [/color]。</text> + <text id="orchard">添加[color=ff2222]果园[/color]到[color=ff2222]农场[/color]。</text> + <text id="smelter">建立[color=ff2222]冶炼厂[/color]。</text> + <text id="kitchen">建立[color=ff2222]厨房[/color]。</text> + <text id="backpack">获取[color=ff2222]背包[/color]。</text> + <text id="workshop">构建[color=ff2222] 工作坊 [/color]。</text> + <text id="wyrm">击败[color=ff2222]地龙[/color]。</text> + <text id="golem">击败一个[color=ff2222]魔像[/color]。</text> + <text id="diamond">我的[color=ff2222]鑽石[/color]。</text> + <text id="market">建立[color=ff2222]市场[/color]。</text> + <text id="bigpack">买一个[color=ff2222]超级背包[/color]。</text> + <text id="capture_wyrm">我要拿牠怎麽办?</text> + <text id="pen">向[color=ff2222] 农场 [/color]添加[color=ff2222] 牲畜 [/color]。</text> + <text id="pizza">煮一个[color=ff2222]披萨[/color]。</text> + <text id="dock">建立[color=ff2222] 码头 [/color]。</text> + <text id="boat">建造一艘[color=ff2222]船[/color]。</text> + <text id="lab">建立[color=ff2222]实验室[/color]。</text> + <text id="wyrm_pen">建立[color=ff2222]地龙养殖场[/color]。</text> + <text id="dragon">从[color=ff2222] Cocoon [/color]中获取 [color=ff2222] 龙 [/color]。</text> + </section> + <section id="structure"> + <text id="wheat">麦田</text> + <text id="orchard">果园</text> + <text id="sugar">甘蔗田</text> + <text id="cotton">棉田</text> + <text id="pumpkin">南瓜田</text> + <text id="add_field">新增农田</text> + <text id="add_stall">新增养殖场</text> + <text id="pen">养殖场</text> + <text id="produces">- 生产 - </text> + <text id="slots">- 栏位 - </text> + <text id="plant">更改作物</text> + <text id="fertilizer">肥料</text> + </section> + <section id="structure.tooltip"> + <text id="hut">在小屋休息</text> + <text id="storehouse">进入仓库</text> + <text id="workshop">在工作坊製作</text> + <text id="smelter">冶炼矿石</text> + <text id="kitchen">在厨房裡做饭</text> + <text id="farm">进入农场</text> + <text id="food_market">与食品贸易商交易</text> + <text id="weaps_market">与武器经销商交易</text> + <text id="mineral_market">与矿石商人交易</text> + <text id="dockhouse">进入码头小屋</text> + <text id="boat">帆船</text> + <text id="lab">溷合药水</text> + <text id="pen">管理养殖场</text> + <text id="wyrm_pen">管理龙养殖场</text> + <text id="summon_alchemist">召唤法师</text> + <text id="dragon_lair2">进化龙</text> + <text id="fly_dragon">乘龙飞翔</text> + </section> + <section id="object.tooltip"> + <text id="bush">摘莓子</text> + <text id="tree">砍树</text> + <text id="enemy">攻击</text> + <text id="collect">收集{item}</text> + <text id="open">打开{item}</text> + <text id="harvest">收穫{item}</text> + <text id="use">使用{item}</text> + </section> + <section id="equipment"> + <text id="weapon">武器:</text> + <text id="shield">盾牌:</text> + <text id="pickaxe">镐:</text> + <text id="armor">盔甲:</text> + <text id="familiar">宠物:</text> + </section> + <section id="warning"> + <text id="weight">拿太多东西了!</text> + <text id="stamina">没体力了,开始失去生命!</text> + <text id="growing">仍在增长!晚一点回来。</text> + <text id="additions">没有剩馀的栏位!</text> + <text id="focus">点击聚焦</text> + <text id="ingredients">你没有足够的原料。</text> + <text id="place_surface">您不能将物体放置在地平面下方。</text> + <text id="place_overlap">您不能将物体放置在物体之上。</text> + <text id="no_effect">它不会有任何作用。</text> + <text id="drop_instead">你想把它们扔掉吗?</text> + <text id="cannot_fire">没有{weapon}来发射{projectile}。</text> + <text id="max_items">你不能添加任何更多的物品!</text> + <text id="max_fuel">你不能添加更多的燃料!</text> + <text id="max_coins">你的钱包装不下钱币了!</text> + </section> + <section id="market"> + <text id="restock">我们应该马上得到一些新货物!</text> + </section> + <section id="quests"> + <text id="new">新任务!</text> + <text id="none">你目前没有任务。</text> + <text id="requires">- 要求 - </text> + <text id="complete">- 完成 - </text> + <text id="hut">建造小屋</text> + <text id="storehouse">建立仓库</text> + <text id="storehouse2">建立仓库</text> + <text id="smelter">製造冶炼厂</text> + <text id="backpack">背包</text> + <text id="workshop">製造工作坊</text> + <text id="kitchen">建立厨房</text> + <text id="kitchen2">升级厨房</text> + <text id="farm">建立农场</text> + <text id="orchard">苹果种子</text> + <text id="market">建立市场</text> + <text id="market2">建立市场</text> + <text id="dock">建立码头</text> + <text id="dock2">建立码头</text> + <text id="pen">建立猪圈</text> + <text id="boat">建造船</text> + <text id="lab">魔法材料</text> + <text id="wyrm_pen">龙养殖场</text> + <text id="trader_pet">贸易宠物</text> + <text id="hatch_dragons">孵化龙</text> + </section> + <section id="quest.description"> + <text id="hut">你需要建立一个[color=550000] 小屋 [/color]来躲避风暴。</text> + <text id="storehouse">想要建立一个[color=550000]仓库[/color]。</text> + <text id="storehouse2">建立一个[color=550000]仓库[/color]来存储你所有的物品。</text> + <text id="smelter">想要[color=550000]冶炼厂[/color]炼製矿石。</text> + <text id="backpack">会为了一些[item=meat]给你他的背包。</text> + <text id="workshop">想要[color=550000] 工作坊 [/color]创建金属工具。</text> + <text id="kitchen">想要建立一个[color=550000]厨房[/color]来烹饪食物。</text> + <text id="kitchen2">要[color=550000] 厨房 [/color]製作[item=cheese]。</text> + <text id="farm">想要建立一个[color=550000]农场[/color]种植庄稼。</text> + <text id="orchard">想用[item=fruit]来种植[color=550000]果园[/color]。</text> + <text id="market">想要建立一个[color=550000] 市场 [/color]来交易货物。</text> + <text id="market2">建立一个[color=550000] 市场 [/color]来吸引交易者到你的[color=550000] 码头 [/color]。</text> + <text id="dock">想要一个[color=550000] 码头 [/color]来环游世界。</text> + <text id="dock2">建立[color=550000] 码头 [/color]找到其他倖存者。</text> + <text id="pen">想要添加一个[color=550000] 养殖场 [/color]来放置家畜。</text> + <text id="boat">现在是航行世界的时候了!在[color=550000] 码头小屋 [/color]建立[item=boat]。</text> + <text id="lab">想要试验[item=dragonblood]。</text> + <text id="wyrm_pen">想试试[item=wyrm]。</text> + <text id="trader_pet">愿意交易的倖存下来的宠物!</text> + <text id="hatch_dragons">孵化 [item=dragon] 来赢取[item=adult_dragon]到你身边。</text> + </section> + <section id="npc"> + <text id="talk">交谈</text> + <text id="builder">建筑师</text> + <text id="miner">矿工</text> + <text id="farmer">农夫</text> + <text id="trader">商人</text> + <text id="alchemist">法师</text> + </section> + <section id="builder"> + <text id="intro">你真的希望能够在这裡生存?这是没有希望的,先生。</text> + <text id="introduce1">你擅长建设吗?如果我们建立一些东西来储存我们收集的资源和食物呢?</text> + <text id="introduce2">恩。我想有[var=quest.storehouse.wood] [item=wood]和[var=quest.storehouse.berries] [item=berries],我可能能够做一个体面的[color=770000] 仓库 [/color] 。</text> + <text id="accept1">好的!我可以找到,没问题。</text> + <text id="accept2">如果你是那麽的耿耿于怀,那就拿这个[item=stone_axe]吧。</text> + <text id="stamina">我精疲力尽了。你也看起来很累。我们应该在[color=770000] 小屋 [/color]中休息以保存游戏并恢復我们的[tile=stamina] [color=006600]耐力[/color]。</text> + <text id="wood">我的旧[item=stone_axe]怎麽样?我敢打赌,你可以透过按[key=select]来砍倒树。</text> + <text id="meat">尝试透过按[key=attack]来杀死一些[color=770000] [tile=boar]公猪[/color]。</text> + <text id="hint1">收集这些物品时,所有物品都会进入您的物品栏。你可以通过点击[key=inventory]来查看它。</text> + <text id="hint2">如果你的[tile=stamina] [color=006600]体力[/color]用完,你会开始失去[tile=health] [color=770000]生命[/color],如果你的[tile=health] [color=770000]生命[/color]用完了,你会死的。</text> + <text id="hint3">这就是为什麽你需要吃很多[item=berries],[item=fruit]和[item=meat]。您可以通过在物品栏中选择它们来做到。</text> + <text id="storehouse1">你已经收集了一切?让我印象深刻。</text> + <text id="storehouse2">我们来建立这个[color=770000]仓库[/color]吧!</text> + <text id="storehouse3">看那个,你不觉得有成就吗?</text> + <text id="storehouse4">是的,实际上,这将会有用的。现在我们可以避免因为携带太多而感到疲累。</text> + <text id="farmer">我们应该和[color=770000] [tile=farmer] 农夫交涉,我敢打赌,他可以帮助我们种一些美味的食物。</text> + <text id="miner">你有没有看到[color=770000] [tile=miner] 矿工 [/color]从地下冒出来?你应该看看她想要什麽</text> + <text id="kitchen1">你怎麽看待建立一个[color=770000]厨房[/color]? [item=meat]很好,但它煮熟更好。</text> + <text id="kitchen2">我需要[var=quest.kitchen.wood] [item=wood]和[var=quest.kitchen.coal] [item=coal]建立[color=770000] 厨房 [/color]。</text> + <text id="kitchen3">看起来你有我需要的一切。让我们来建立这个[color=770000]厨房[/color]!</text> + <text id="kitchen4">只要你有[item=wood]或[item=coal]来当燃料,你就可以在[color=770000]厨房裡做饭。</text> + <text id="kitchen5">你知道我渴望什麽吗?一些[item=cheese]。没有东西比他更好吃。</text> + <text id="kitchen6">我可以升级[color=770000] 厨房 [/color]来製作[item=cheese],我需要[var=quest.kitchen2.wood] [item=wood]和[var=quest.kitchen2.steel_bar] [item=steel_bar]。</text> + <text id="kitchen7">看起来你有我需要的一切。让我们来升级这个[color=770000]厨房[/color]吧!</text> + <text id="kitchen8">尝试一些新的食谱!它感觉很文明了!</text> + <text id="farm">先生,我饿了。我希望你能很快完成[color=770000]农场[/color]!</text> + <text id="backpack1">嘿,为[color=770000]冶炼厂[/color]运送所有的[item=coal]是不是很难?我可以给你我的[item=backpack]来换取[var=quest.backpack.meat] [item=meat]。</text> + <text id="backpack2">我可以杀死一些[item=meat],但是我已经给你了我的[item=stone_axe]!</text> + <text id="backpack3">非常好!谢谢你的[item=meat]!按照承诺,这是我的[item=packback]。</text> + </section> + <section id="farmer"> + <text id="introduce1">男孩,我很高兴见到你。我以为这世界只剩我一个人。</text> + <text id="introduce2">我这些老骨头还是有办法动的,我想我可以帮你。我的职业是农夫,我们都需要一些好的食物来维持体力。</text> + <text id="introduce3">要不我们建一个穀仓,然后种一块[color=770000]农田[/color]?</text> + <text id="farm1">太好了,我要去整理穀仓并种一些种子!</text> + <text id="farm2">现在我们有了一块[color=770000] 农田 [/color]!有时候来拿拿作物 - 他们会帮助恢復你的[tile=stamina][color=006600]体力 [/color]。这裡 , 拿一些[item=bread]继续前进。</text> + <text id="farm3">透过砍树,可以得到[item=wood]。</text> + <text id="farm4">如果你想种更多,我们可以增加到四个农田或果园。你可以在穀仓中添加这些。</text> + <text id="farm5">看看我们的超棒[color=770000]农场[/color]!这和我以前在家的东西一样好!</text> + <text id="kitchen">生 [item=wheat]不是很好吃,但我敢打赌,如果你和[color=770000] [tile=builder] 建筑师 [/color]做了一个[color=770000] 厨房 [/color ],我们可以做出更好的东西</text> + <text id="pen1">你知道这个[color=770000] 农场 [/color]需要什麽吗?一些家畜!要不要从[color=770000]市场[/color]买些[item=net]来捕捉一些[color=770000] [tile=boar]公猪[/color]?</text> + <text id="pen2">给我[var=quest.pen.pig] [item=pig] 和[var=quest.pen.wood] [item=wood],我会新增一个[color=770000] 养殖场 [/color]。</text> + <text id="pen3">现在那不就是你见过的最胖最可爱的东西了吗?</text> + <text id="pen4">有了养殖场,我们可以开始生产[item=meat]和[item=milk]!</text> + <text id="pig">你如何得到一隻[item=pig]?在地上放一个[item=net],然后把一隻[color=770000] [por=boar]野猪[/color]引到它上面,然后噗!它会被抓住并驯化的!</text> + <text id="kitchen2">挤猪奶[item=pig]?为什麽不要?这是一个陌生的土地。但是我们真正可以使用的是一些[item=cheese] - 跟[color=770000] [tile=builder] 建筑师 [/color]谈谈关于改进[color=770000] 厨房 [/color]的事。</text> + <text id="halloween">我希望你不要介意,但是我为收穫节做了一点修饰,我们可以在这裡小小的庆祝。我还在[color=770000] 仓库 [/color]中放了一些[item=jakolantern]。</text> + <text id="add_sugar">这个农场变得相当大了!为了庆祝,我发现了一些[item=sugar]种子,并把它们添加到了穀仓!试着种植一块[item=sugar]田!</text> + <text id="add_cotton">我透过[color=770000] 码头 [/color]遇到了几个商人,并得到了一些[item=cotton]种子!现在可以种植[item=cotton]了。</text> + <text id="orchard1">这裡有很多[item=fruit]。有了足够的种子,我可能会种植一个不错的[color=770000]果园[/color]!</text> + <text id="orchard2">太好了,真多啊!我给穀仓添加了种子,所以你现在可以在管理介面把农田改成果园。</text> + <text id="orchard3">当你有足够的[item=fruit]来建[color=770000] 果园 [/color]时,让我知道!</text> + <text id="snowman">第一场降雪来了!庆祝的时候到了!我甚至用[item=ice_berries]做了一个魔法[item=snowman],希望你喜欢!</text> + </section> + <section id="miner"> + <text id="introduce1">噢!嗨。没发现到还有其他倖存者。</text> + <text id="introduce2">我一直在地下 - 这个地方有很多的东西。</text> + <text id="introduce3">如果你想看看,我还有一个额外的镐。</text> + <text id="smelter">挖掘过程如何?也许我们应该建立一个[color=770000]冶炼厂[/color]将矿石冶製成条。</text> + <text id="accept1">太棒了!当你有足够的[item=coal]的时候,让我知道!</text> + <text id="smelter1">这就是了。我应该马上有一个[color=770000]冶炼厂[/color]!</text> + <text id="smelter2">[color=770000]冶炼厂[/color]可以将原矿变成条。它需要燃料把它们熔化,但是幸运的是有很多[item=coal]在燃烧。</text> + <text id="hint1">那麽,你还等什麽呢?只要按[key=down]来往下挖,找到那些矿石!</text> + <text id="hint2">矿石很重 - 确保在行程间把它们放在[color=770000]仓库[/color]中。</text> + <text id="hint3">挖矿很容易掌握,但要确保你有足够的耐力[/color]回来。</text> + <text id="hint4">你挖得越深,你会发现越好的矿石。</text> + <text id="workshop1">要不要盖个[color=770000] 工作坊 [/color]将这些金属条变成工具?我可以用[var=quest.workshop.iron_bar] [item=iron_bar] 和[var=quest.workshop.wood] [item=wood]来做一个。</text> + <text id="workshop2">好,让我们来设置这个[color=770000]工作坊 [/color]吧!</text> + <text id="workshop3">在[color=770000] 工作坊 [/color]中,您可以立即创建任何您需要製作的工具或物品。</text> + <text id="workshop4">您需要在[color=770000]冶炼厂[/color]中找到[item=iron]来炼成[item=iron_bar]。</text> + <text id="smelter3">当有足够的[item=iron]时,从[color=770000]工作访[/color]菜单中选择[item=iron_bar],只要有剩馀的燃料,它就会自动熔炼。</text> + <text id="smelter4">只要你有原料和燃料,您就可以添加尽可能多的工作到[color=770000]冶炼厂[/color],它会在你不在时一个一个的熔炼。</text> + <text id="pick">如果你想挖掘[color=770000] [tile=stone] 石头 [/color]来取得[item=gold],那麽你需要在[color=770000]工作坊[/color]製作一个[item=iron_pickaxe]或者一个[item=steel_pickaxe]。</text> + <text id="equip">只要你的物品栏有装备,他会自动装备上。它可以增加你的攻击力,防御力或开採速度,但要小心,因为大多数装备都有重量。</text> + <text id="hotkey">您也可以使用[color=770000]快捷键[/color]。\n在物品栏点击[key=hotkey1],[key=hotkey2],[key=hotkey3]或[key=hotkey4]来设定。</text> + </section> + <section id="trader"> + <text id="steal">有人从[color=770000] 仓库 [/color]偷走了一个[item={item}]!</text> + <text id="caught">小偷被抓到了!</text> + <text id="introduce1">在没有人偷东西的情况下已经很难生存下去了!</text> + <text id="introduce2">我也许借了些东西。但是,听着。我会通过提供我的服务来报答你。我和其他岛上的许多商人有联繫。</text> + <text id="introduce3">商人?还有更多的倖存者?</text> + <text id="introduce4">对。但是我需要[var=quest.market.gold_bar] [item=gold_bar]来说服他们来这裡。</text> + <text id="introduce5">你才刚刚被抓住,你还想跟我们要东西?!</text> + <text id="introduce6">就是这样,这是生意。我的报价是[var=quest.market.gold_bar] [item=gold_bar] 来将这个岛新增到贸易路线。</text> + <text id="introduce7">好吧。如果还有其他倖存者,与他们交易可能能让我们离开这个岛屿。</text> + <text id="introduce8">对不起,我不能相信一个小偷。离开这个岛屿,永远不要回来。</text> + <text id="introduce9">反正有更好的岛屿可以偷。你根本不知道你错过了什麽。</text> + <text id="market1">完美!我觉得这是我们之间利多交易的开始。</text> + <text id="market2">拿这个[item=coin_purse]。你需要用它储存钱币来购买和销售。我建议尽快购买[item=mega_backpack],它们是真正的省时法宝!</text> + <text id="market3">在[color=770000]市场[/color]中,您可以出售商品来获得钱币,并用它来购买其他商品。</text> + <text id="market4">[color=770000] 市场 [/color]有时也会得到新的库存,所以如果你得不到你想要的库存,或者库存不足,请稍后再回来查看。</text> + <text id="market5">要製作一个[item=gold_bar],你需要在很深的地下挖[item=gold],并熔炼他们。 [color=770000] [tile=miner] 矿工 [/color]可能会有些挖掘的技巧。</text> + <text id="dock1">你有兴趣到世界的其他地方吗?要不要盖个[color=770000] 码头 [/color]?</text> + <text id="dock2">如果你给我[var=quest.dock.coins] [color=770000] [tile=coin_purse.ico]钱币[/color],[var=quest.dock.wood] [item=wood],[var=quest.dock.cloth] [item=cloth]和[var=quest.dock.net] [item=net] ,我就会帮你盖。</text> + <text id="dock3">太棒了,让我们盖出这个[color=770000] 码头 [/color]!</text> + <text id="dock4">一旦你在[color=770000] 码头 [/color]上造了一艘[item=boat],你就已经准备好穿越大海!</text> + <text id="dock5">[color=770000] 码头 [/color]需要[var=quest.dock.coins] [color=770000] [tile=coin_purse.ico]钱币[/color],[var=quest.dock.wood] [item=wood],[var=quest.dock.cloth] [item=cloth]和[var=quest.dock.net] [item=net] 。</text> + <text id="accept">接受条件</text> + <text id="reject">赶走他</text> + <text id="pet1">看来有一些猫和狗从灾难中倖存下来!我愿意以[var=quest.trader_pet.coins] [color=770000] [tile=coin_purse.ico]钱币[/color] 卖一个给你。</text> + <text id="pet2">你想要[item=cat]还是[item=wolf]?</text> + <text id="pet3">你有足够钱时让我知道!</text> + <text id="sail">今天是个适合航行的好天气。</text> + </section> + <section id="alchemist"> + <text id="introduce1">这个星球并不像眼睛看到的那麽简单。我一直在做实验,我相信我发现了魔法!</text> + <text id="introduce2">我需要更多的材料。如果你到[item=dragonblood],给我,我确保你会得到回报。</text> + <text id="lab1">我知道了!这就是那个秘密!我必须马上建立一个实验室!</text> + <text id="lab2">你的回报?把材料带到我的实验室,我会为你溷合魔法药水。</text> + <text id="lab3">快点!我的研究一直停滞不前,除非我得到一些[item=dragonblood]!</text> + <text id="pen1">我需要更多[item=dragonblood]!给我[var=quest.wyrm_pen.wyrm] 活的 [item=wyrm],我们将有无尽的[item=dragonblood]来实验!</text> + <text id="pen2">太棒了!站远点,我要来用我的魔法。</text> + <text id="pen3">看看我的超级发明 - [color=770000]地龙养殖场[/color]!它不仅仅是个养殖场,它是[item=dragonblood]的无限供给来源!</text> + <text id="wyrm">我敢打赌你可以用[item=net]捕捉[item=dragon]。但他们必须要是活着的,没有受到伤害!</text> + <text id="dragon1">我们必须对[item=wyrm]进行更多的实验!他们吃什麽?他们为什麽会生产[item=dragonblood]?</text> + <text id="dragon2">我知道了![item=wyrm] 会长成 [item=dragon] !但是为什麽在这片土地上的[item=adult_dragon]这麽少?</text> + <text id="dragon3">我相信山上有一个龙穴。如果你找到了,召唤我...也许在那裡可以发现一些秘密。</text> + <text id="dragon4">啊,一隻[item=adult_dragon]!让我们看看她有什麽话要说 - 我可以用一个简单的咒语为你翻译。</text> + <text id="dragon5">你是谁,把我从睡梦中叫醒?</text> + <text id="dragon6">我是一个真理和魔法的追求者。告诉我 - 为什麽这个世界上的龙这麽少?</text> + <text id="dragon7">因为年长的的离开了。他们也是真理和魔法的追求者。他们离开了我。</text> + <text id="dragon8">那麽也许我们可以帮助你!我们所要求的只有知识。</text> + <text id="dragon9">你认为你可以帮忙?证明看看啊。如果你能孵化[var=quest.hatch_dragons.dragon] [item=dragon] 并带来给我,那麽我们就谈谈。否则,滚开!</text> + <text id="dragon10">我就知道你会背叛我,感受我的愤怒!</text> + <text id="dragon11">我觉得先拿到[item=dragon]再叫醒她比较好。</text> + <text id="dragon12">你做到了?也许我的种族还有希望。</text> + <text id="dragon12_a">所以,你会告诉我们魔法的秘密吗?</text> + <text id="dragon13">不幸的是,我不知道你要找的秘密。年长的创造了我们,他们建造这个巢穴来养育我们。</text> + <text id="dragon14">但是,答案可能在于东方的岛屿上。准备好后再回到这个巢穴,我会带你们飞到那裡。</text> + <text id="lair1">我知道了!这个巢穴是人造的,是由魔法造的!看起来它的目的是养龙!</text> + <text id="lair2">我敢打赌,我可以激活它...</text> + <text id="lair3">啊哈!完成了!有了这个巢穴,我们可以养自己的龙。巢穴似乎指向东方,也许我们可以乘龙飞往那个方向,发现更多东西...</text> + </section> + <section id="player"> + <text id="storm1">暴风雨越来越激烈。我需要庇护所,但这裡没有什麽东西,只有倒下的木头!</text> + <text id="storm2">我将不得不尝试建立一个[color=770000] 小屋 [/color]。 [var=quest.hut.wood] [item=wood]就足够了。</text> + <text id="storm3">好累......把这些[item=wood]全部拿起来真难。再一点点,我就可以休息在[color=770000]小屋[/color]裡。</text> + <text id="storehouse1">这把斧头可以派上用场。有了它,我大概可以建立一个[color=770000] 仓库 [/color]来存储我收集的资源。</text> + <text id="storehouse2">我打赌我可以用[var=quest.storehouse.wood] [item=wood]和[var=quest.storehouse.berries] [item=berries]来製作一个仓库。</text> + <text id="storehouse3">好的!让我们来建这个仓库吧!</text> + <text id="storehouse4">太好了。现在我可以避免因携带太多而感到疲倦。</text> + <text id="dock1">我想知道小偷讲的其他倖存者的是否真的存在?</text> + <text id="dock2">也许我应该建立一个[color=770000] 港口 [/color]来找到它们。它会需要[var=quest.dock2.wood] [item=wood]和[var=quest.dock2.steel_bar] [item=steel_bar] 。</text> + <text id="dock3">好的,让我们来建立这个[color=770000] 港口 [/color]!</text> + <text id="market1">也许如果我建立一个[color=770000] 市场 [/color],我会吸引商人到这个码头。我可以用[var=quest.market2.gold_bar] [item=gold_bar] 来创造一个。</text> + <text id="market2">这就是[color=770000] Market [/color]所需要的一切!</text> + <text id="market3">看来真的有商人在那裡!他们还给了我一个[item=coin_purse]存储钱币来买卖。</text> + <text id="market4">现在我们只需要在[color=770000] 港口 [/color]建立一艘[item=boat]!</text> + </section> + <section id="scene.hut"> + <text id="first1">不错,我的第一个庇护所。</text> + <text id="first2">救命... [pause=4]拜託... [pause=4]庇护所...</text> + <text id="first3">有人在外面,我可以信任他们吗?</text> + <text id="first4">谢谢。我救了我一命,但是我们现在做什麽?</text> + <text id="first5">现在,我们先保持温暖和乾燥。</text> + <text id="first6">那之后如何?我们将如何在这个荒凉的岛屿上生存下去?</text> + <text id="first7">还有什麽意义吗?我们被困在这裡,永远回不去</text> + <text id="first8">至少我们可以试试。也许这裡的生活不会像你想像的那样糟糕。</text> + <text id="first9">拜託... [pause=4]救命...</text> + <text id="second1">...所以当我到达这裡的时候,我就开始挖矿,甚至没有意识到有一场风暴。</text> + <text id="second2">但是我很高兴你在这裡。我已经厌倦吃土了,在地下漫长的一天之后,没有什麽比一场温暖的火更好了。</text> + <text id="second3">你认为有更多的倖存者吗?</text> + <text id="second4">老实说,我很惊讶有任何人从灾难中倖存下来。但是我们还在这裡,也许其他人也倖存下来了?</text> + <text id="third1">现在我敢打赌,你们这些年轻人都认为这是世界末日,在第三次世界大战期间我也是这麽想的,但我们还在这裡。</text> + <text id="third2">在我看来,我们只要把情况用到最好,并为有食物和团队可以分享而感到高兴。</text> + <text id="third3">但是我们要在这个被遗忘的岛屿上生活多久呢?</text> + <text id="third4">谁知道?但只要有生命,就有希望。也许这个岛会和家一样好。</text> + <text id="fourth1">那麽告诉我们你对其他倖存者的了解吗?</text> + <text id="fourth2">我们中的大多数人分散在不同的岛屿,但有些岛屿有更多的倖存者,甚至有一些在发展科技。</text> + <text id="fourth3">我甚至听说过有个岛有个几乎完好的船的传言。</text> + <text id="fourth4">它还能飞吗?</text> + <text id="fourth5">正如我所说,我听到的都是谣言。但即使可以,它也会马上坏掉。最好留在这个星球上,他们似乎并不关心在这裡的我们。</text> + </section> + <section id="options"> + <text id="options">选项</text> + <text id="paused">游戏pause</text> + <text id="music">音乐音量:</text> + <text id="sfx">SFX音量:</text> + <text id="fullscreen">全屏:</text> + <text id="textspeed">文字速度:</text> + <text id="language">语言:</text> + <text id="controls">控制</text> + <text id="achievements">成就</text> + <text id="title">返回标题</text> + <text id="back">返回</text> + <text id="quitgame">你想回到标题? 任何未保存的进度将会丢失。</text> + <text id="keyboard">键盘</text> + <text id="controller">调节器</text> + <text id="import">导入记录档</text> + <text id="export">导出纪录档</text> + </section> + <section id="controls"> + <text id="left">左:</text> + <text id="right">右:</text> + <text id="up">上:</text> + <text id="down">下:</text> + <text id="select">执行:</text> + <text id="cancel">取消:</text> + <text id="inventory">物品:</text> + <text id="quest">任务:</text> + <text id="equipment">装备:</text> + <text id="attack">攻击:</text> + <text id="defend">防御:</text> + <text id="device">设备:</text> + <text id="hotkey1">快捷键1:</text> + <text id="hotkey2">快捷键2:</text> + <text id="hotkey3">快捷键3:</text> + <text id="hotkey4">快捷键4:</text> + <text id="mute">静音:</text> + </section> + <section id="world"> + <text id="start">初始岛屿</text> + </section> +</lang> diff --git a/games/aground/data/mods/chinese/zh_TW.xml b/games/aground/data/mods/chinese/zh_TW.xml new file mode 100644 index 00000000..3e96e119 --- /dev/null +++ b/games/aground/data/mods/chinese/zh_TW.xml @@ -0,0 +1,629 @@ +<?xml version="1.0" encoding="utf-8" ?> +<lang id="zh_TW" name="正體中文" font="fonts/zpix.fnt.z"> + <section id="common"> + <text id="blocked">格擋!</text> + <text id="miss">未命中!</text> + <text id="critical_hit">爆擊!</text> + <text id="weight">重量:</text> + <text id="save">遊戲已儲存</text> + <text id="del_save">刪除記錄</text> + <text id="save_corrupt">紀錄檔壞了! 正在開啟新遊戲。</text> + <text id="fuel">燃料</text> + <text id="add_fuel">增加燃料</text> + <text id="all">全部</text> + <text id="equipment">裝備</text> + <text id="attack">攻擊:</text> + <text id="range">遠攻:</text> + <text id="defense">防禦:</text> + <text id="cut">砍樹:</text> + <text id="mine">挖掘:</text> + <text id="capacity">攜帶:</text> + <text id="health">生命:</text> + <text id="stamina">體力:</text> + <text id="ok">好吧</text> + <text id="cancel">取消</text> + <text id="yes">開</text> + <text id="no">關</text> + <text id="accept">同意</text> + <text id="reject">拒絕</text> + <text id="sell">賣出</text> + <text id="buy">購買</text> + <text id="drop_item">你想把多少丟掉?</text> + <text id="eat_item">你想要吃/喝多少?</text> + <text id="store_item">你想要儲存多少?</text> + <text id="retrieve_item">你想要收回多少?</text> + <text id="sell_item">你想要賣出多少?</text> + <text id="buy_item">你想要購買多少?</text> + <text id="requires">-- 原料 --</text> + <text id="repair_cost">-- 修補花費 --</text> + <text id="repaired">{item} 已修理。</text> + <text id="inventory">物品欄</text> + <text id="quests">任務</text> + <text id="smelter">冶煉廠</text> + <text id="kitchen">廚房</text> + <text id="workshop">工作坊</text> + <text id="storehouse">倉庫</text> + <text id="dockhouse">港口小屋</text> + <text id="harvest">收割</text> + <text id="harvest_all">收割全部</text> + <text id="manage">管理</text> + <text id="feed">餵食</text> + <text id="lab">實驗室</text> + <text id="per_hit">每一擊:</text> + <text id="move">移動</text> + <text id="newgame">新遊戲</text> + <text id="continue">繼續</text> + <text id="options">選項</text> + <text id="exit">離開</text> + <text id="forums">社群</text> + <text id="empty">空的</text> + <text id="empty_slot">< 空欄位 ></text> + <text id="corrupt_slot">毀損的欄位</text> + <text id="overwrite">你確定你想覆寫這個欄位?</text> + <text id="none">無</text> + <text id="addition_slots">領域:</text> + <text id="trap_overlap">[color=770000]你不能在陷阱上放陷阱![/color]</text> + <text id="placed">{item} 已放置。</text> + <text id="level_up">等級提升!</text> + <text id="level">等級:</text> + <text id="experience">經驗:</text> + <text id="hotkey">選擇物品</text> + <text id="set_hotkey">設定快捷鍵:</text> + <text id="retry">重試</text> + <text id="title">標題</text> + <text id="move_all">移動全部</text> + <text id="add_animal">新增動物</text> + <text id="select_feed">選擇食物</text> + <text id="use_count">你想要用多少?</text> + <text id="select_fertilizer">選擇肥料</text> + <text id="muted">遊戲已靜音</text> + <text id="unmuted">遊戲已解除靜音</text> + <text id="storehouse_add">{npc} 新增 {count} {item} 到 [color=ff2222]倉庫[/color]</text> + <text id="auto_eat">吃了 {count} {item} 來回血</text> + <text id="drop_all">你確定你要丟掉所有的 {item}? 他們會永遠消失。</text> + <text id="sign_message">設定 [item=sign] 訊息:</text> + <text id="transform">你想要將多少轉變成 {into}?</text> + <text id="collect_complete">搜集完成</text> + <text id="set_sticky">設定 [tile=sticky] 成附隨物品</text> + <text id="fishing">釣魚:</text> + <text id="fishing_line">有東西咬勾了!</text> + <text id="fishing_fail">他走了!</text> + <text id="fishing_hooked">等待...</text> + <text id="fishing_pull">拉起來!</text> + <text id="craft">你想要製造多少?</text> + <text id="coins">錢幣</text> + <text id="speed">速度:</text> + <text id="endurance">耐力:</text> + <text id="broken">{item} 已經壞了!</text> + <text id="rem_storehouse_items">只看物品欄</text> + <text id="add_storehouse_items">包括倉庫</text> + <text id="hungry">{item} 餓了!</text> + <text id="not_hungry">{item} 不餓了。</text> + <text id="fed">已經餵了 {item} 。</text> + </section> + <section id="actions"> + <text id="drop">丟棄</text> + <text id="place">放置</text> + <text id="use">使用</text> + <text id="craft">製造</text> + <text id="equip">裝備</text> + <text id="unequip">不裝備</text> + <text id="fire">發射</text> + <text id="eat">吃</text> + <text id="loot">掠奪</text> + <text id="feed">餵</text> + <text id="collect">搜集</text> + <text id="open">打開</text> + <text id="carve">雕刻</text> + <text id="switch">切換</text> + <text id="transform">轉換</text> + <text id="repair">修理</text> + </section> + <section id="item.names"> + <text id="wood">木頭</text> + <text id="coal">煤炭</text> + <text id="iron">鐵礦</text> + <text id="quartz">水晶</text> + <text id="gold">金礦</text> + <text id="diamond">鑽石</text> + <text id="sulfur">硫磺</text> + <text id="oil">生油</text> + <text id="titanium">鈦</text> + <text id="uranium">鈾</text> + <text id="iron_bar">鐵條</text> + <text id="steel_bar">鋼條</text> + <text id="gold_bar">金條</text> + <text id="meat">肉</text> + <text id="fruit">蘋果</text> + <text id="wheat">小麥</text> + <text id="eggs">蛋</text> + <text id="milk">牛奶</text> + <text id="sugar">糖</text> + <text id="steak">肉排</text> + <text id="bread">麵包</text> + <text id="pie">餡餅</text> + <text id="pancakes">薄煎餅</text> + <text id="hamburger">漢堡</text> + <text id="cheese">起司</text> + <text id="pizza">比薩</text> + <text id="omelette">煎蛋</text> + <text id="cheeseburger">起司漢堡</text> + <text id="cake">蛋糕</text> + <text id="candy_apple">糖蘋果</text> + <text id="dragonblood">龍血</text> + <text id="stone_axe">石斧</text> + <text id="stone_pickaxe">石鎬</text> + <text id="broken_pickaxe">壞掉的鎬</text> + <text id="coin_purse">錢包</text> + <text id="iron_pickaxe">鐵鎬</text> + <text id="iron_sword">鐵劍</text> + <text id="iron_armor">鐵甲</text> + <text id="steel_pickaxe">鋼鎬</text> + <text id="steel_sword">鋼劍</text> + <text id="steel_armor">鋼盔甲</text> + <text id="bow">弓</text> + <text id="arrow">箭頭</text> + <text id="ice_arrow">冰箭</text> + <text id="backpack">背包</text> + <text id="mega_backpack">大型背包</text> + <text id="ultra_backpack">超級背包</text> + <text id="magic_pickaxe">魔法鎬</text> + <text id="magic_sword">魔法劍</text> + <text id="magic_backpack">魔法背包</text> + <text id="magic_box">魔法盒</text> + <text id="cloth">布</text> + <text id="net">網子</text> + <text id="berries">漿果</text> + <text id="red_berries">紅色漿果</text> + <text id="ice_berries">冰漿果</text> + <text id="health_potion">生命藥水</text> + <text id="stamina_potion">體力藥水</text> + <text id="attack_potion">攻擊藥水</text> + <text id="defense_potion">防禦藥水</text> + <text id="speed_potion">速度藥水</text> + <text id="endurance_potion">耐力藥水</text> + <text id="rat">老鼠</text> + <text id="pig">豬</text> + <text id="wyrm">地龍</text> + <text id="cocoon">繭</text> + <text id="dragon">小龍</text> + <text id="young_dragon">幼籠</text> + <text id="adult_dragon">成龍</text> + <text id="cockatiel">玄鳳鸚鵡</text> + <text id="wolf">馴狼</text> + <text id="cat">貓</text> + <text id="boat">船</text> + <text id="fence">籬笆</text> + <text id="torch">火把</text> + <text id="trap">陷阱</text> + <text id="workbench">工作台</text> + <text id="anvil">鐵砧</text> + <text id="chest">箱子</text> + <text id="jakolantern">南瓜燈</text> + <text id="sign">告示牌</text> + <text id="rusty_axe">生鏽的斧頭</text> + <text id="cotton">棉花</text> + <text id="pumpkin">南瓜</text> + <text id="chicken">雞</text> + <text id="cow">牛</text> + <text id="fishing_rod">釣竿</text> + <text id="toothfish">劍魚</text> + <text id="rockfish">石斑魚</text> + <text id="coral_cod">珊瑚鱈魚</text> + <text id="fertilizer">肥料</text> + <text id="yeti_fur">雪人毛皮</text> + <text id="fire_gem">火寶石</text> + <text id="buckler">圓盾</text> + <text id="kite_shield">鋼盾</text> + <text id="ice_shield">冰盾</text> + <text id="snowman">雪人</text> + </section> + <section id="item.descriptions"> + <text id="boat">航行世界。</text> + <text id="fence">把敵人擋在外面。</text> + <text id="torch">下20次開採+1視野。</text> + <text id="trap">陷阱:4點傷害。</text> + <text id="red_berries">15秒內+1攻擊。</text> + <text id="ice_berries">30秒內+1防禦。</text> + <text id="magic_box">包含一切。</text> + <text id="health_potion">+10最大生命值。</text> + <text id="stamina_potion">+20最大體力。</text> + <text id="attack_potion">30秒內+1攻擊。</text> + <text id="defense_potion">30秒內+1防禦。</text> + <text id="speed_potion">提高速度。</text> + <text id="endurance_potion">增加耐力。</text> + <text id="workbench">製造物品。</text> + <text id="anvil">修理物品。</text> + <text id="chest">儲存無品。</text> + <text id="sign">顯示消息。</text> + <text id="ice_arrow">凍結敵人。</text> + </section> + <section id="achievement.names"> + <text id="hut">庇護</text> + <text id="boar">肉的來源</text> + <text id="storehouse">無限的空間</text> + <text id="farm">佃農</text> + <text id="orchard">蘋果</text> + <text id="smelter">冶鐵</text> + <text id="kitchen">好胃口</text> + <text id="backpack">負重高手</text> + <text id="workshop">製作時間</text> + <text id="wyrm">地龍殺手</text> + <text id="golem">岩石殺手</text> + <text id="diamond">閃亮</text> + <text id="market">良好的貿易</text> + <text id="bigpack">負重大師</text> + <text id="capture_wyrm">得到地龍</text> + <text id="pen">為豬擠奶</text> + <text id="pizza">嗯,起司</text> + <text id="dock">遙遠的海岸</text> + <text id="boat">設置風帆</text> + <text id="lab">實驗</text> + <text id="wyrm_pen">無限的血液</text> + <text id="dragon">馴養</text> + </section> + <section id="achievement.descriptions"> + <text id="hut">建立[color=ff2222]小屋[/color]。</text> + <text id="boar">擊敗[color=ff2222]野豬[/color]。</text> + <text id="storehouse">建立[color=ff2222] 倉庫 [/color]。</text> + <text id="farm">建立[color=ff2222] 農田 [/color]。</text> + <text id="orchard">添加[color=ff2222]果園[/color]到[color=ff2222]農場[/color]。</text> + <text id="smelter">建立[color=ff2222]冶煉廠[/color]。</text> + <text id="kitchen">建立[color=ff2222]廚房[/color]。</text> + <text id="backpack">獲取[color=ff2222]背包[/color]。</text> + <text id="workshop">構建[color=ff2222] 工作坊 [/color]。</text> + <text id="wyrm">擊敗[color=ff2222]地龍[/color]。</text> + <text id="golem">擊敗一個[color=ff2222]魔像[/color]。</text> + <text id="diamond">我的[color=ff2222]鑽石[/color]。</text> + <text id="market">建立[color=ff2222]市場[/color]。</text> + <text id="bigpack">買一個[color=ff2222]超級背包[/color]。</text> + <text id="capture_wyrm">我要拿牠怎麼辦?</text> + <text id="pen">向[color=ff2222] 農場 [/color]添加[color=ff2222] 牲畜 [/color]。</text> + <text id="pizza">煮一個[color=ff2222]披薩[/color]。</text> + <text id="dock">建立[color=ff2222] 碼頭 [/color]。</text> + <text id="boat">建造一艘[color=ff2222]船[/color]。</text> + <text id="lab">建立[color=ff2222]實驗室[/color]。</text> + <text id="wyrm_pen">建立[color=ff2222]地龍養殖場[/color]。</text> + <text id="dragon">從[color=ff2222] Cocoon [/color]中獲取 [color=ff2222] 龍 [/color]。</text> + </section> + <section id="structure"> + <text id="wheat">麥田</text> + <text id="orchard">果園</text> + <text id="sugar">甘蔗田</text> + <text id="cotton">棉田</text> + <text id="pumpkin">南瓜田</text> + <text id="add_field">新增農田</text> + <text id="add_stall">新增養殖場</text> + <text id="pen">養殖場</text> + <text id="produces">- 生產 - </text> + <text id="slots">- 欄位 - </text> + <text id="plant">更改作物</text> + <text id="fertilizer">肥料</text> + </section> + <section id="structure.tooltip"> + <text id="hut">在小屋休息</text> + <text id="storehouse">進入倉庫</text> + <text id="workshop">在工作坊製作</text> + <text id="smelter">冶煉礦石</text> + <text id="kitchen">在廚房裡做飯</text> + <text id="farm">進入農場</text> + <text id="food_market">與食品貿易商交易</text> + <text id="weaps_market">與武器經銷商交易</text> + <text id="mineral_market">與礦石商人交易</text> + <text id="dockhouse">進入碼頭小屋</text> + <text id="boat">帆船</text> + <text id="lab">混合藥水</text> + <text id="pen">管理養殖場</text> + <text id="wyrm_pen">管理龍養殖場</text> + <text id="summon_alchemist">召喚法師</text> + <text id="dragon_lair2">進化龍</text> + <text id="fly_dragon">乘龍飛翔</text> + </section> + <section id="object.tooltip"> + <text id="bush">摘莓子</text> + <text id="tree">砍樹</text> + <text id="enemy">攻擊</text> + <text id="collect">收集{item}</text> + <text id="open">打開{item}</text> + <text id="harvest">收穫{item}</text> + <text id="use">使用{item}</text> + </section> + <section id="equipment"> + <text id="weapon">武器:</text> + <text id="shield">盾牌:</text> + <text id="pickaxe">鎬:</text> + <text id="armor">盔甲:</text> + <text id="familiar">寵物:</text> + </section> + <section id="warning"> + <text id="weight">拿太多東西了!</text> + <text id="stamina">沒體力了,開始失去生命!</text> + <text id="growing">仍在增長!晚一點回來。</text> + <text id="additions">沒有剩餘的欄位!</text> + <text id="focus">點擊聚焦</text> + <text id="ingredients">你沒有足夠的原料。</text> + <text id="place_surface">您不能將物體放置在地平面下方。</text> + <text id="place_overlap">您不能將物體放置在物體之上。</text> + <text id="no_effect">它不會有任何作用。</text> + <text id="drop_instead">你想把它們扔掉嗎?</text> + <text id="cannot_fire">沒有{weapon}來發射{projectile}。</text> + <text id="max_items">你不能添加任何更多的物品!</text> + <text id="max_fuel">你不能添加更多的燃料!</text> + <text id="max_coins">你的錢包裝不下錢幣了!</text> + </section> + <section id="market"> + <text id="restock">我們應該馬上得到一些新貨物!</text> + </section> + <section id="quests"> + <text id="new">新任務!</text> + <text id="none">你目前沒有任務。</text> + <text id="requires">- 要求 - </text> + <text id="complete">- 完成 - </text> + <text id="hut">建造小屋</text> + <text id="storehouse">建立倉庫</text> + <text id="storehouse2">建立倉庫</text> + <text id="smelter">製造冶煉廠</text> + <text id="backpack">背包</text> + <text id="workshop">製造工作坊</text> + <text id="kitchen">建立廚房</text> + <text id="kitchen2">升級廚房</text> + <text id="farm">建立農場</text> + <text id="orchard">蘋果種子</text> + <text id="market">建立市場</text> + <text id="market2">建立市場</text> + <text id="dock">建立碼頭</text> + <text id="dock2">建立碼頭</text> + <text id="pen">建立豬圈</text> + <text id="boat">建造船</text> + <text id="lab">魔法材料</text> + <text id="wyrm_pen">龍養殖場</text> + <text id="trader_pet">貿易寵物</text> + <text id="hatch_dragons">孵化龍</text> + </section> + <section id="quest.description"> + <text id="hut">你需要建立一個[color=550000] 小屋 [/color]來躲避風暴。</text> + <text id="storehouse">想要建立一個[color=550000]倉庫[/color]。</text> + <text id="storehouse2">建立一個[color=550000]倉庫[/color]來存儲你所有的物品。</text> + <text id="smelter">想要[color=550000]冶煉廠[/color]煉製礦石。</text> + <text id="backpack">會為了一些[item=meat]給你他的背包。</text> + <text id="workshop">想要[color=550000] 工作坊 [/color]創建金屬工具。</text> + <text id="kitchen">想要建立一個[color=550000]廚房[/color]來烹飪食物。</text> + <text id="kitchen2">要[color=550000] 廚房 [/color]製作[item=cheese]。</text> + <text id="farm">想要建立一個[color=550000]農場[/color]種植莊稼。</text> + <text id="orchard">想用[item=fruit]來種植[color=550000]果園[/color]。</text> + <text id="market">想要建立一個[color=550000] 市場 [/color]來交易貨物。</text> + <text id="market2">建立一個[color=550000] 市場 [/color]來吸引交易者到你的[color=550000] 碼頭 [/color]。</text> + <text id="dock">想要一個[color=550000] 碼頭 [/color]來環遊世界。</text> + <text id="dock2">建立[color=550000] 碼頭 [/color]找到其他倖存者。</text> + <text id="pen">想要添加一個[color=550000] 養殖場 [/color]來放置家畜。</text> + <text id="boat">現在是航行世界的時候了!在[color=550000] 碼頭小屋 [/color]建立[item=boat]。</text> + <text id="lab">想要試驗[item=dragonblood]。</text> + <text id="wyrm_pen">想試試[item=wyrm]。</text> + <text id="trader_pet">願意交易的倖存下來的寵物!</text> + <text id="hatch_dragons">孵化 [item=dragon] 來贏取[item=adult_dragon]到你身邊。</text> + </section> + <section id="npc"> + <text id="talk">交談</text> + <text id="builder">建築師</text> + <text id="miner">礦工</text> + <text id="farmer">農夫</text> + <text id="trader">商人</text> + <text id="alchemist">法師</text> + </section> + <section id="builder"> + <text id="intro">你真的希望能夠在這裡生存?這是沒有希望的,先生。</text> + <text id="introduce1">你擅長建設嗎?如果我們建立一些東西來儲存我們收集的資源和食物呢?</text> + <text id="introduce2">恩。我想有[var=quest.storehouse.wood] [item=wood]和[var=quest.storehouse.berries] [item=berries],我可能能夠做一個體面的[color=770000] 倉庫 [/color] 。</text> + <text id="accept1">好的!我可以找到,沒問題。</text> + <text id="accept2">如果你是那麼的耿耿於懷,那就拿這個[item=stone_axe]吧。</text> + <text id="stamina">我精疲力盡了。你也看起來很累。我們應該在[color=770000] 小屋 [/color]中休息以保存遊戲並恢復我們的[tile=stamina] [color=006600]耐力[/color]。</text> + <text id="wood">我的舊[item=stone_axe]怎麼樣?我敢打賭,你可以透過按[key=select]來砍倒樹。</text> + <text id="meat">嘗試透過按[key=attack]來殺死一些[color=770000] [tile=boar]公豬[/color]。</text> + <text id="hint1">收集這些物品時,所有物品都會進入您的物品欄。你可以通過點擊[key=inventory]來查看它。</text> + <text id="hint2">如果你的[tile=stamina] [color=006600]體力[/color]用完,你會開始失去[tile=health] [color=770000]生命[/color],如果你的[tile=health] [color=770000]生命[/color]用完了,你會死的。</text> + <text id="hint3">這就是為什麼你需要吃很多[item=berries],[item=fruit]和[item=meat]。您可以通過在物品欄中選擇它們來做到。</text> + <text id="storehouse1">你已經收集了一切?讓我印象深刻。</text> + <text id="storehouse2">我們來建立這個[color=770000]倉庫[/color]吧!</text> + <text id="storehouse3">看那個,你不覺得有成就嗎?</text> + <text id="storehouse4">是的,實際上,這將會有用的。現在我們可以避免因為攜帶太多而感到疲累。</text> + <text id="farmer">我們應該和[color=770000] [tile=farmer] 農夫交涉,我敢打賭,他可以幫助我們種一些美味的食物。</text> + <text id="miner">你有沒有看到[color=770000] [tile=miner] 礦工 [/color]從地下冒出來?你應該看看她想要什麼</text> + <text id="kitchen1">你怎麼看待建立一個[color=770000]廚房[/color]? [item=meat]很好,但它煮熟更好。</text> + <text id="kitchen2">我需要[var=quest.kitchen.wood] [item=wood]和[var=quest.kitchen.coal] [item=coal]建立[color=770000] 廚房 [/color]。</text> + <text id="kitchen3">看起來你有我需要的一切。讓我們來建立這個[color=770000]廚房[/color]!</text> + <text id="kitchen4">只要你有[item=wood]或[item=coal]來當燃料,你就可以在[color=770000]廚房裡做飯。</text> + <text id="kitchen5">你知道我渴望什麼嗎?一些[item=cheese]。沒有東西比他更好吃。</text> + <text id="kitchen6">我可以升級[color=770000] 廚房 [/color]來製作[item=cheese],我需要[var=quest.kitchen2.wood] [item=wood]和[var=quest.kitchen2.steel_bar] [item=steel_bar]。</text> + <text id="kitchen7">看起來你有我需要的一切。讓我們來升級這個[color=770000]廚房[/color]吧!</text> + <text id="kitchen8">嘗試一些新的食譜!它感覺很文明了!</text> + <text id="farm">先生,我餓了。我希望你能很快完成[color=770000]農場[/color]!</text> + <text id="backpack1">嘿,為[color=770000]冶煉廠[/color]運送所有的[item=coal]是不是很難?我可以給你我的[item=backpack]來換取[var=quest.backpack.meat] [item=meat]。</text> + <text id="backpack2">我可以殺死一些[item=meat],但是我已經給你了我的[item=stone_axe]!</text> + <text id="backpack3">非常好!謝謝你的[item=meat]!按照承諾,這是我的[item=packback]。</text> + </section> + <section id="farmer"> + <text id="introduce1">男孩,我很高興見到你。我以為這世界只剩我一個人。</text> + <text id="introduce2">我這些老骨頭還是有辦法動的,我想我可以幫你。我的職業是農夫,我們都需要一些好的食物來維持體力。</text> + <text id="introduce3">要不我們建一個穀倉,然後種一塊[color=770000]農田[/color]?</text> + <text id="farm1">太好了,我要去整理穀倉並種一些種子!</text> + <text id="farm2">現在我們有了一塊[color=770000] 農田 [/color]!有時候來拿拿作物 - 他們會幫助恢復你的[tile=stamina][color=006600]體力 [/color]。這裡 , 拿一些[item=bread]繼續前進。</text> + <text id="farm3">透過砍樹,可以得到[item=wood]。</text> + <text id="farm4">如果你想種更多,我們可以增加到四個農田或果園。你可以在穀倉中添加這些。</text> + <text id="farm5">看看我們的超棒[color=770000]農場[/color]!這和我以前在家的東西一樣好!</text> + <text id="kitchen">生 [item=wheat]不是很好吃,但我敢打賭,如果你和[color=770000] [tile=builder] 建築師 [/color]做了一個[color=770000] 廚房 [/color ],我們可以做出更好的東西</text> + <text id="pen1">你知道這個[color=770000] 農場 [/color]需要什麼嗎?一些家畜!要不要從[color=770000]市場[/color]買些[item=net]來捕捉一些[color=770000] [tile=boar]公豬[/color]?</text> + <text id="pen2">給我[var=quest.pen.pig] [item=pig] 和[var=quest.pen.wood] [item=wood],我會新增一個[color=770000] 養殖場 [/color]。</text> + <text id="pen3">現在那不就是你見過的最胖最可愛的東西了嗎?</text> + <text id="pen4">有了養殖場,我們可以開始生產[item=meat]和[item=milk]!</text> + <text id="pig">你如何得到一隻[item=pig]?在地上放一個[item=net],然後把一隻[color=770000] [por=boar]野豬[/color]引到它上面,然後噗!它會被抓住並馴化的!</text> + <text id="kitchen2">擠豬奶[item=pig]?為什麼不要?這是一個陌生的土地。但是我們真正可以使用的是一些[item=cheese] - 跟[color=770000] [tile=builder] 建築師 [/color]談談關於改進[color=770000] 廚房 [/color]的事。</text> + <text id="halloween">我希望你不要介意,但是我為收穫節做了一點修飾,我們可以在這裡小小的慶祝。我還在[color=770000] 倉庫 [/color]中放了一些[item=jakolantern]。</text> + <text id="add_sugar">這個農場變得相當大了!為了慶祝,我發現了一些[item=sugar]種子,並把它們添加到了穀倉!試著種植一塊[item=sugar]田!</text> + <text id="add_cotton">我透過[color=770000] 碼頭 [/color]遇到了幾個商人,並得到了一些[item=cotton]種子!現在可以種植[item=cotton]了。</text> + <text id="orchard1">這裡有很多[item=fruit]。有了足夠的種子,我可能會種植一個不錯的[color=770000]果園[/color]!</text> + <text id="orchard2">太好了,真多啊!我給穀倉添加了種子,所以你現在可以在管理介面把農田改成果園。</text> + <text id="orchard3">當你有足夠的[item=fruit]來建[color=770000] 果園 [/color]時,讓我知道!</text> + <text id="snowman">第一場降雪來了!慶祝的時候到了!我甚至用[item=ice_berries]做了一個魔法[item=snowman],希望你喜歡!</text> + </section> + <section id="miner"> + <text id="introduce1">噢!嗨。沒發現到還有其他倖存者。</text> + <text id="introduce2">我一直在地下 - 這個地方有很多的東西。</text> + <text id="introduce3">如果你想看看,我還有一個額外的鎬。</text> + <text id="smelter">挖掘過程如何?也許我們應該建立一個[color=770000]冶煉廠[/color]將礦石冶製成條。</text> + <text id="accept1">太棒了!當你有足夠的[item=coal]的時候,讓我知道!</text> + <text id="smelter1">這就是了。我應該馬上有一個[color=770000]冶煉廠[/color]!</text> + <text id="smelter2">[color=770000]冶煉廠[/color]可以將原礦變成條。它需要燃料把它們熔化,但是幸運的是有很多[item=coal]在燃燒。</text> + <text id="hint1">那麼,你還等什麼呢?只要按[key=down]來往下挖,找到那些礦石!</text> + <text id="hint2">礦石很重 - 確保在行程間把它們放在[color=770000]倉庫[/color]中。</text> + <text id="hint3">挖礦很容易掌握,但要確保你有足夠的耐力[/color]回來。</text> + <text id="hint4">你挖得越深,你會發現越好的礦石。</text> + <text id="workshop1">要不要蓋個[color=770000] 工作坊 [/color]將這些金屬條變成工具?我可以用[var=quest.workshop.iron_bar] [item=iron_bar] 和[var=quest.workshop.wood] [item=wood]來做一個。</text> + <text id="workshop2">好,讓我們來設置這個[color=770000]工作坊 [/color]吧!</text> + <text id="workshop3">在[color=770000] 工作坊 [/color]中,您可以立即創建任何您需要製作的工具或物品。</text> + <text id="workshop4">您需要在[color=770000]冶煉廠[/color]中找到[item=iron]來煉成[item=iron_bar]。</text> + <text id="smelter3">當有足夠的[item=iron]時,從[color=770000]工作訪[/color]菜單中選擇[item=iron_bar],只要有剩餘的燃料,它就會自動熔煉。</text> + <text id="smelter4">只要你有原料和燃料,您就可以添加盡可能多的工作到[color=770000]冶煉廠[/color],它會在你不在時一個一個的熔煉。</text> + <text id="pick">如果你想挖掘[color=770000] [tile=stone] 石頭 [/color]來取得[item=gold],那麼你需要在[color=770000]工作坊[/color]製作一個[item=iron_pickaxe]或者一個[item=steel_pickaxe]。</text> + <text id="equip">只要你的物品欄有裝備,他會自動裝備上。它可以增加你的攻擊力,防禦力或開採速度,但要小心,因為大多數裝備都有重量。</text> + <text id="hotkey">您也可以使用[color=770000]快捷鍵[/color]。\n在物品欄點擊[key=hotkey1],[key=hotkey2],[key=hotkey3]或[key=hotkey4]來設定。</text> + </section> + <section id="trader"> + <text id="steal">有人從[color=770000] 倉庫 [/color]偷走了一個[item={item}]!</text> + <text id="caught">小偷被抓到了!</text> + <text id="introduce1">在沒有人偷東西的情況下已經很難生存下去了!</text> + <text id="introduce2">我也許借了些東西。但是,聽著。我會通過提供我的服務來報答你。我和其他島上的許多商人有聯繫。</text> + <text id="introduce3">商人?還有更多的倖存者?</text> + <text id="introduce4">對。但是我需要[var=quest.market.gold_bar] [item=gold_bar]來說服他們來這裡。</text> + <text id="introduce5">你才剛剛被抓住,你還想跟我們要東西?!</text> + <text id="introduce6">就是這樣,這是生意。我的報價是[var=quest.market.gold_bar] [item=gold_bar] 來將這個島新增到貿易路線。</text> + <text id="introduce7">好吧。如果還有其他倖存者,與他們交易可能能讓我們離開這個島嶼。</text> + <text id="introduce8">對不起,我不能相信一個小偷。離開這個島嶼,永遠不要回來。</text> + <text id="introduce9">反正有更好的島嶼可以偷。你根本不知道你錯過了什麼。</text> + <text id="market1">完美!我覺得這是我們之間利多交易的開始。</text> + <text id="market2">拿這個[item=coin_purse]。你需要用它儲存錢幣來購買和銷售。我建議盡快購買[item=mega_backpack],它們是真正的省時法寶!</text> + <text id="market3">在[color=770000]市場[/color]中,您可以出售商品來獲得錢幣,並用它來購買其他商品。</text> + <text id="market4">[color=770000] 市場 [/color]有時也會得到新的庫存,所以如果你得不到你想要的庫存,或者庫存不足,請稍後再回來查看。</text> + <text id="market5">要製作一個[item=gold_bar],你需要在很深的地下挖[item=gold],並熔煉他們。 [color=770000] [tile=miner] 礦工 [/color]可能會有些挖掘的技巧。</text> + <text id="dock1">你有興趣到世界的其他地方嗎?要不要蓋個[color=770000] 碼頭 [/color]?</text> + <text id="dock2">如果你給我[var=quest.dock.coins] [color=770000] [tile=coin_purse.ico]錢幣[/color],[var=quest.dock.wood] [item=wood],[var=quest.dock.cloth] [item=cloth]和[var=quest.dock.net] [item=net] ,我就會幫你蓋。</text> + <text id="dock3">太棒了,讓我們蓋出這個[color=770000] 碼頭 [/color]!</text> + <text id="dock4">一旦你在[color=770000] 碼頭 [/color]上造了一艘[item=boat],你就已經準備好穿越大海!</text> + <text id="dock5">[color=770000] 碼頭 [/color]需要[var=quest.dock.coins] [color=770000] [tile=coin_purse.ico]錢幣[/color],[var=quest.dock.wood] [item=wood],[var=quest.dock.cloth] [item=cloth]和[var=quest.dock.net] [item=net] 。</text> + <text id="accept">接受條件</text> + <text id="reject">趕走他</text> + <text id="pet1">看來有一些貓和狗從災難中倖存下來!我願意以[var=quest.trader_pet.coins] [color=770000] [tile=coin_purse.ico]錢幣[/color] 賣一個給你。</text> + <text id="pet2">你想要[item=cat]還是[item=wolf]?</text> + <text id="pet3">你有足夠錢時讓我知道!</text> + <text id="sail">今天是個適合航行的好天氣。</text> + </section> + <section id="alchemist"> + <text id="introduce1">這個星球並不像眼睛看到的那麼簡單。我一直在做實驗,我相信我發現了魔法!</text> + <text id="introduce2">我需要更多的材料。如果你到[item=dragonblood],給我,我確保你會得到回報。</text> + <text id="lab1">我知道了!這就是那個秘密!我必須馬上建立一個實驗室!</text> + <text id="lab2">你的回報?把材料帶到我的實驗室,我會為你混合魔法藥水。</text> + <text id="lab3">快點!我的研究一直停滯不前,除非我得到一些[item=dragonblood]!</text> + <text id="pen1">我需要更多[item=dragonblood]!給我[var=quest.wyrm_pen.wyrm] 活的 [item=wyrm],我們將有無盡的[item=dragonblood]來實驗!</text> + <text id="pen2">太棒了!站遠點,我要來用我的魔法。</text> + <text id="pen3">看看我的超級發明 - [color=770000]地龍養殖場[/color]!它不僅僅是個養殖場,它是[item=dragonblood]的無限供給來源!</text> + <text id="wyrm">我敢打賭你可以用[item=net]捕捉[item=dragon]。但他們必須要是活著的,沒有受到傷害!</text> + <text id="dragon1">我們必須對[item=wyrm]進行更多的實驗!他們吃什麼?他們為什麼會生產[item=dragonblood]?</text> + <text id="dragon2">我知道了![item=wyrm] 會長成 [item=dragon] !但是為什麼在這片土地上的[item=adult_dragon]這麼少?</text> + <text id="dragon3">我相信山上有一個龍穴。如果你找到了,召喚我...也許在那裡可以發現一些秘密。</text> + <text id="dragon4">啊,一隻[item=adult_dragon]!讓我們看看她有什麼話要說 - 我可以用一個簡單的咒語為你翻譯。</text> + <text id="dragon5">你是誰,把我從睡夢中叫醒?</text> + <text id="dragon6">我是一個真理和魔法的追求者。告訴我 - 為什麼這個世界上的龍這麼少?</text> + <text id="dragon7">因為年長的的離開了。他們也是真理和魔法的追求者。他們離開了我。</text> + <text id="dragon8">那麼也許我們可以幫助你!我們所要求的只有知識。</text> + <text id="dragon9">你認為你可以幫忙?證明看看啊。如果你能孵化[var=quest.hatch_dragons.dragon] [item=dragon] 並帶來給我,那麼我們就談談。否則,滾開!</text> + <text id="dragon10">我就知道你會背叛我,感受我的憤怒!</text> + <text id="dragon11">我覺得先拿到[item=dragon]再叫醒她比較好。</text> + <text id="dragon12">你做到了?也許我的種族還有希望。</text> + <text id="dragon12_a">所以,你會告訴我們魔法的秘密嗎?</text> + <text id="dragon13">不幸的是,我不知道你要找的秘密。年長的創造了我們,他們建造這個巢穴來養育我們。</text> + <text id="dragon14">但是,答案可能在於東方的島嶼上。準備好後再回到這個巢穴,我會帶你們飛到那裡。</text> + <text id="lair1">我知道了!這個巢穴是人造的,是由魔法造的!看起來它的目的是養龍!</text> + <text id="lair2">我敢打賭,我可以激活它...</text> + <text id="lair3">啊哈!完成了!有了這個巢穴,我們可以養自己的龍。巢穴似乎指向東方,也許我們可以乘龍飛往那個方向,發現更多東西...</text> + </section> + <section id="player"> + <text id="storm1">暴風雨越來越激烈。我需要庇護所,但這裡沒有什麼東西,只有倒下的木頭!</text> + <text id="storm2">我將不得不嘗試建立一個[color=770000] 小屋 [/color]。 [var=quest.hut.wood] [item=wood]就足夠了。</text> + <text id="storm3">好累......把這些[item=wood]全部拿起來真難。再一點點,我就可以休息在[color=770000]小屋[/color]裡。</text> + <text id="storehouse1">這把斧頭可以派上用場。有了它,我大概可以建立一個[color=770000] 倉庫 [/color]來存儲我收集的資源。</text> + <text id="storehouse2">我打賭我可以用[var=quest.storehouse.wood] [item=wood]和[var=quest.storehouse.berries] [item=berries]來製作一個倉庫。</text> + <text id="storehouse3">好的!讓我們來建這個倉庫吧!</text> + <text id="storehouse4">太好了。現在我可以避免因攜帶太多而感到疲倦。</text> + <text id="dock1">我想知道小偷講的其他倖存者的是否真的存在?</text> + <text id="dock2">也許我應該建立一個[color=770000] 港口 [/color]來找到它們。它會需要[var=quest.dock2.wood] [item=wood]和[var=quest.dock2.steel_bar] [item=steel_bar] 。</text> + <text id="dock3">好的,讓我們來建立這個[color=770000] 港口 [/color]!</text> + <text id="market1">也許如果我建立一個[color=770000] 市場 [/color],我會吸引商人到這個碼頭。我可以用[var=quest.market2.gold_bar] [item=gold_bar] 來創造一個。</text> + <text id="market2">這就是[color=770000] Market [/color]所需要的一切!</text> + <text id="market3">看來真的有商人在那裡!他們還給了我一個[item=coin_purse]存儲錢幣來買賣。</text> + <text id="market4">現在我們只需要在[color=770000] 港口 [/color]建立一艘[item=boat]!</text> + </section> + <section id="scene.hut"> + <text id="first1">不錯,我的第一個庇護所。</text> + <text id="first2">救命... [pause=4]拜託... [pause=4]庇護所...</text> + <text id="first3">有人在外面,我可以信任他們嗎?</text> + <text id="first4">謝謝。我救了我一命,但是我們現在做什麼?</text> + <text id="first5">現在,我們先保持溫暖和乾燥。</text> + <text id="first6">那之後如何?我們將如何在這個荒涼的島嶼上生存下去?</text> + <text id="first7">還有什麼意義嗎?我們被困在這裡,永遠回不去</text> + <text id="first8">至少我們可以試試。也許這裡的生活不會像你想像的那樣糟糕。</text> + <text id="first9">拜託... [pause=4]救命...</text> + <text id="second1">...所以當我到達這裡的時候,我就開始挖礦,甚至沒有意識到有一場風暴。</text> + <text id="second2">但是我很高興你在這裡。我已經厭倦吃土了,在地下漫長的一天之後,沒有什麼比一場溫暖的火更好了。</text> + <text id="second3">你認為有更多的倖存者嗎?</text> + <text id="second4">老實說,我很驚訝有任何人從災難中倖存下來。但是我們還在這裡,也許其他人也倖存下來了?</text> + <text id="third1">現在我敢打賭,你們這些年輕人都認為這是世界末日,在第三次世界大戰期間我也是這麼想的,但我們還在這裡。</text> + <text id="third2">在我看來,我們只要把情況用到最好,並為有食物和團隊可以分享而感到高興。</text> + <text id="third3">但是我們要在這個被遺忘的島嶼上生活多久呢?</text> + <text id="third4">誰知道?但只要有生命,就有希望。也許這個島會和家一樣好。</text> + <text id="fourth1">那麼告訴我們你對其他倖存者的了解嗎?</text> + <text id="fourth2">我們中的大多數人分散在不同的島嶼,但有些島嶼有更多的倖存者,甚至有一些在發展科技。</text> + <text id="fourth3">我甚至聽說過有個島有個幾乎完好的船的傳言。</text> + <text id="fourth4">它還能飛嗎?</text> + <text id="fourth5">正如我所說,我聽到的都是謠言。但即使可以,它也會馬上壞掉。最好留在這個星球上,他們似乎並不關心在這裡的我們。</text> + </section> + <section id="options"> + <text id="options">選項</text> + <text id="paused">遊戲pause</text> + <text id="music">音樂音量:</text> + <text id="sfx">SFX音量:</text> + <text id="fullscreen">全屏:</text> + <text id="textspeed">文字速度:</text> + <text id="language">語言:</text> + <text id="controls">控制</text> + <text id="achievements">成就</text> + <text id="title">返回標題</text> + <text id="back">返回</text> + <text id="quitgame">你想回到標題? 任何未保存的進度將會丟失。</text> + <text id="keyboard">鍵盤</text> + <text id="controller">調節器</text> + <text id="import">導入記錄檔</text> + <text id="export">導出紀錄檔</text> + </section> + <section id="controls"> + <text id="left">左:</text> + <text id="right">右:</text> + <text id="up">上:</text> + <text id="down">下:</text> + <text id="select">執行:</text> + <text id="cancel">取消:</text> + <text id="inventory">物品:</text> + <text id="quest">任務:</text> + <text id="equipment">裝備:</text> + <text id="attack">攻擊:</text> + <text id="defend">防禦:</text> + <text id="device">設備:</text> + <text id="hotkey1">快捷鍵1:</text> + <text id="hotkey2">快捷鍵2:</text> + <text id="hotkey3">快捷鍵3:</text> + <text id="hotkey4">快捷鍵4:</text> + <text id="mute">靜音:</text> + </section> + <section id="world"> + <text id="start">初始島嶼</text> + </section> +</lang> + diff --git a/games/aground/data/mods/fan_translations/de_DE.xml b/games/aground/data/mods/fan_translations/de_DE.xml new file mode 100644 index 00000000..e6525ed7 --- /dev/null +++ b/games/aground/data/mods/fan_translations/de_DE.xml @@ -0,0 +1,1385 @@ +<?xml version="1.0" encoding="utf-8" ?> +<lang id="de_DE" name="Deutsch" version="1.3.1"> + <section id="common"> + <text id="blocked">Geblockt!</text> + <text id="resist">{element} Resistent!</text> + <text id="effective">{element} Effektiv!</text> + <text id="miss">Daneben!</text> + <text id="dodged">Ausgewichen!</text> + <text id="critical_hit">Krit. Treffer!</text> + <text id="save">Spiel gespeichert</text> + <text id="del_save">Spielstand gelöscht</text> + <text id="save_corrupt">Spielstand beschädigt! Starte ein neues Spiel.</text> + <text id="fuel">Brennstoff</text> + <text id="add_fuel">Brennstoff befüllen</text> + <text id="add_rations">Rationen hinzufügen</text> + <text id="add_feed">Futter hinzufügen</text> + <text id="all">Alles</text> + <text id="equipment">Ausrüstung</text> + <text id="capacity">Traglast:</text> + <text id="health">Leben:</text> + <text id="stamina">Ausdauer:</text> + <text id="health_short">LP</text> + <text id="defense_short">VERT</text> + <text id="power">Energie</text> + <text id="ok">OK</text> + <text id="cancel">Abbruch</text> + <text id="yes">Ja</text> + <text id="no">Nein</text> + <text id="accept">Klar</text> + <text id="reject">Nö</text> + <text id="sell">Verkaufen</text> + <text id="buy">Kaufen</text> + <text id="drop_item">Wieviel möchtest du wegwerfen?</text> + <text id="eat_item">Wieviel möchtest du essen?</text> + <text id="drink_item">Wieviel möchtest du trinken?</text> + <text id="store_item">Wieviel möchtest du lagern?</text> + <text id="retrieve_item">Wieviel möchtest du entnehmen?</text> + <text id="sell_item">Wieviel möchtest du verkaufen?</text> + <text id="buy_item">Wieviel möchtest du kaufen?</text> + <text id="requires">-- Zutaten --</text> + <text id="repair_cost">-- Reparaturkosten --</text> + <text id="creates">-- Erzeugt --</text> + <text id="repaired">{item} repariert.</text> + <text id="inventory">Inventar</text> + <text id="quests">Quest Log</text> + <text id="smelter">Schmelzofen</text> + <text id="kitchen">Küche</text> + <text id="workshop">Werkstatt</text> + <text id="storehouse">Lager</text> + <text id="dockhouse">Bootshaus</text> + <text id="power_plant">Kraftwerk</text> + <text id="warehouse">Warenhaus</text> + <text id="farm">Scheune</text> + <text id="stall">Tiergehege</text> + <text id="harvest">Ernten</text> + <text id="harvest_all">Alles ernten</text> + <text id="manage">Verwalten</text> + <text id="feed">Füttern</text> + <text id="lab">Labor</text> + <text id="wyrm_pen">Wyrmgehege</text> + <text id="factory">Fabrik</text> + <text id="synthesizer">Synthesizer</text> + <text id="power_per_hit">Energie je Treffer:</text> + <text id="stamina_per_hit">Ausdauer je Treffer:</text> + <text id="move">Bewegen</text> + <text id="newgame">Neues Spiel</text> + <text id="continue">Fortfahren</text> + <text id="options">Optionen</text> + <text id="exit">Beenden</text> + <text id="forums">Community</text> + <text id="empty">Leer</text> + <text id="empty_slot">< Aufs Neue ></text> + <text id="corrupt_slot">Beschädigter Speicherstand</text> + <text id="overwrite">Willst du diesen Speicherstand wirklich überschreiben?</text> + <text id="none">Nichts</text> + <text id="addition_slots">Felder:</text> + <text id="placed">{item} platziert.</text> + <text id="level_up">Nächste Stufe!</text> + <text id="level">Stufe:</text> + <text id="experience">Erfahrung:</text> + <text id="hotkey">Gegenstand wählen</text> + <text id="set_hotkey">Hotkey setzen:</text> + <text id="retry">Nochmal</text> + <text id="title">Hauptmenü</text> + <text id="move_all">Alle bew.</text> + <text id="add_animal">Tier hinzufügen</text> + <text id="select_feed">Futter wählen</text> + <text id="use_count">Wieviel möchtest du benutzen?</text> + <text id="select_fertilizer">Dünger wählen</text> + <text id="muted">Ton aus</text> + <text id="unmuted">Ton an</text> + <text id="storehouse_add">{npc} hat {count} {item} ins [color=ff2222]Lager[/color] gebracht</text> + <text id="auto_eat">{count} {item} gegessen, um Leben aufzufüllen</text> + <text id="auto_eat_stamina">{count} {item} um Ausdauer aufzufüllen</text> + <text id="drop_all">Willst du wirklich all dein(e) {item} wegwerfen?</text> + <text id="sign_message">Schreibe [item=sign] Nachricht:</text> + <text id="transform">Wieviel möchtest du in {into} umwandeln?</text> + <text id="collect_complete">Alles entnehmen</text> + <text id="set_sticky">Gegenstand [tile=sticky] festlegen</text> + <text id="fishing_line">Etwas hat angebissen!</text> + <text id="fishing_fail">Es ist entwischt!</text> + <text id="fishing_hooked">Warte...</text> + <text id="fishing_pull">Zieh!</text> + <text id="craft">Wieviel möchtest du herstellen?</text> + <text id="uncraft">Wieviel möchtest du zerstören?</text> + <text id="coins">Münzen</text> + <text id="broken">{item} ist zerbrochen!</text> + <text id="damaged">{item} wird bald zerbrechen!</text> + <text id="rem_storehouse_items">Nur Inventar</text> + <text id="add_storehouse_items">Inklusive Lager</text> + <text id="hungry">{item} hat Hunger!</text> + <text id="not_hungry">{item} hat keinen Hunger.</text> + <text id="rename">Gib {item} einen Namen:</text> + <text id="recharge_batteries">Batterien aufladen</text> + <text id="restore_power">Batterien aufgeladen!</text> + <text id="rations">Rationen</text> + <text id="auto_feed">Füttere {item} folgendes?{list}</text> + <text id="auto_fuel">Fülle {item} mit folgendem?{list}</text> + <text id="retransform">{item} geht bald kaputt! Folgendes zum reparieren nutzen?{list}</text> + <text id="uses">Aufladungen</text> + <text id="enchantment">Zauberkraft</text> + <text id="cooldown">Cooldown</text> + <text id="durability">Haltbarkeit</text> + <text id="damage">Schaden</text> + <text id="capture">Fängt</text> + <text id="spirits">Seelen</text> + <text id="flight">Flughöhe:</text> + <text id="knockback">Rückstoß:</text> + <text id="fight">Kämpfe</text> + <text id="run_away">Fliehe</text> + <text id="complete">Erledigt</text> + <text id="remove">Entferne</text> + <text id="time_manipulator">Zeitmanipulierer</text> + <text id="set_time">Welche Uhrzeit hättest du gerne (24 Stundenformat)?</text> + <text id="save_prompt_magic">Du hast das Ende der Demo erreicht (Magischer Pfad). Möchtest du jetzt speichern?</text> + <text id="save_prompt_science">Du hast das Ende der Demo erreicht (Technischer Pfad). Möchtest du jetzt speichern?</text> + <text id="credits">Credits</text> + <text id="order">Vorbestellen</text> + <text id="reset">Standard</text> + </section> + <section id="stats"> + <text id="view">Daten anzeigen</text> + <text id="health">Max. Leben</text> + <text id="stamina">Max. Ausdauer</text> + <text id="speed">Tempo</text> + <text id="endurance">Kondition</text> + <text id="attack">Nahkampf</text> + <text id="range">Fernkampf</text> + <text id="defense">Verteidigung</text> + <text id="cut">Fällen</text> + <text id="mine">Abbauen</text> + <text id="weight">Gewicht</text> + <text id="evasion">Ausweichen</text> + <text id="critical">Kritisch</text> + <text id="fishing">Angeln</text> + <text id="mine_speed">Abbautempo</text> + <text id="sight">Sichtweite</text> + <text id="bargaining">Handel</text> + <text id="time">{mod} für {time}n</text> + <text id="max">{mod} ({current}/{max})</text> + </section> + <section id="stat.descriptions"> + <text id="health">Wieviel Schaden du aushälst bevor du stirbst.</text> + <text id="stamina">Wielange du Aktionen ausführen kannst bevor du Leben verlierst.</text> + <text id="speed">Wie schnell du dich bewegen kannst.</text> + <text id="endurance">Reduziert Ausdauerkosten beim bewegen.</text> + <text id="attack">Erhöht Schaden für jede Nahkampfattacke.</text> + <text id="range">Erhöht Schaden für jede Fernkampfattacke.</text> + <text id="defense">Reduziert Schaden wenn du getroffen wirst.</text> + <text id="cut">Erhöht Schaden beim fällen von Bäumen.</text> + <text id="mine">Erlaubt es dir härtere Materialien abzubauen.</text> + <text id="weight">Erhöht die gesamte Tragekapazität.</text> + <text id="evasion">Erhöht die Chance das der Feind dich verfehlt.</text> + <text id="critical">Erhöht die kritische Trefferchance bei Nahkampfattacken.</text> + <text id="fishing">Erleichtert das fangen von Fischen.</text> + <text id="mine_speed">Erlaubt es dir Materialien schneller abzubauen.</text> + <text id="sight">Enthüllt mehr von der Umgebung beim bewegen und abbauen.</text> + <text id="bargaining">Erhöht den Verkaufspreis für deine Gegenstände.</text> + </section> + <section id="skill"> + <text id="allocate">Skillpunkte verteilen</text> + <text id="points">Skillpunkte</text> + <text id="max">[color=770000]Maximale Stufe</text> + </section> + <section id="actions"> + <text id="drop">Wegwerfen</text> + <text id="place">Platzieren</text> + <text id="use">Benutzen</text> + <text id="craft">Herstellen</text> + <text id="equip">Ausrüsten</text> + <text id="unequip">Ablegen</text> + <text id="fire">Abfeuern</text> + <text id="eat">Essen</text> + <text id="loot">Plündern</text> + <text id="feed">Füttern</text> + <text id="collect">Einsammeln</text> + <text id="open">Öffnen</text> + <text id="carve">Schnitzen</text> + <text id="switch">Wechseln</text> + <text id="transform">Umwandeln</text> + <text id="repair">Reparieren</text> + <text id="rename">Umbenennen</text> + <text id="fill">Auffüllen</text> + <text id="synthesize">Synthetisieren</text> + <text id="enchant">Verzaubern</text> + <text id="setProjectile">Projektil wählen</text> + <text id="enrage">Erzürnen</text> + <text id="enable_attack">Aktiviere Angriff</text> + <text id="disable_attack">Deaktiviere Angriff</text> + <text id="summon">Herbeirufen</text> + <text id="uncraft">Zerstören</text> + <text id="set_time">Zeit festlegen</text> + <text id="reset_skills">Skillpunkte zurücksetzen</text> + <text id="build">Erbaue</text> + <text id="upgrade">Erweitere</text> + <text id="plant">Pflanze an</text> + </section> + <section id="item.names"> + <text id="wood">Holz</text> + <text id="coal">Kohle</text> + <text id="iron">Eisenerz</text> + <text id="quartz">Quarz</text> + <text id="gold">Golderz</text> + <text id="diamond">Diamant</text> + <text id="sulfur">Schwefel</text> + <text id="oil">Rohöl</text> + <text id="titanium">Titan</text> + <text id="uranium">Uran</text> + <text id="iron_bar">Eisenbarren</text> + <text id="steel_bar">Stahlbarren</text> + <text id="gold_bar">Goldbarren</text> + <text id="meat">Fleisch</text> + <text id="fruit">Äpfel</text> + <text id="wheat">Weizen</text> + <text id="eggs">Eier</text> + <text id="milk">Milch</text> + <text id="sugar">Zucker</text> + <text id="steak">Steak</text> + <text id="bread">Brot</text> + <text id="pie">Torte</text> + <text id="pancakes">Eierkuchen</text> + <text id="hamburger">Hamburger</text> + <text id="cheese">Käse</text> + <text id="pizza">Pizza</text> + <text id="omelette">Omelett</text> + <text id="cheeseburger">Cheeseburger</text> + <text id="cake">Kuchen</text> + <text id="candy_apple">Kandierter Apfel</text> + <text id="dragonblood">Drachenblut</text> + <text id="stone_axe">Steinaxt</text> + <text id="stone_pickaxe">Steinhacke</text> + <text id="broken_pickaxe">Zerbrochene Hacke</text> + <text id="coin_purse">Geldbeutel</text> + <text id="iron_pickaxe">Eisenhacke</text> + <text id="iron_sword">Eisenschwert</text> + <text id="iron_armor">Eisenrüstung</text> + <text id="steel_pickaxe">Stahlhacke</text> + <text id="steel_sword">Stahlschwert</text> + <text id="steel_armor">Stahlrüstung</text> + <text id="titanium_armor">Titanrüstung</text> + <text id="bow">Bogen</text> + <text id="recurve_bow">Recurve-Bogen</text> + <text id="arrow">Pfeil</text> + <text id="ice_arrow">Eispfeil</text> + <text id="fire_arrow">Feuerpfeil</text> + <text id="water_arrow">Wasserpfeil</text> + <text id="drain_arrow">Absorbierpfeil</text> + <text id="backpack">Rucksack</text> + <text id="mega_backpack">Mega Rucksack</text> + <text id="ultra_backpack">Ultra Rucksack</text> + <text id="magic_pickaxe">Magische Hacke</text> + <text id="magic_sword">Magische Klinge</text> + <text id="magic_backpack">Magier Rucksack</text> + <text id="magic_box">Magische Box</text> + <text id="cloth">Stoffballen</text> + <text id="net">Netz</text> + <text id="berries">Beeren</text> + <text id="red_berries">Rotbeeren</text> + <text id="ice_berries">Eisbeeren</text> + <text id="health_potion">Lebenstrank</text> + <text id="stamina_potion">Ausdauertrank</text> + <text id="attack_potion">Angriffstrank</text> + <text id="defense_potion">Abwehrtrank</text> + <text id="speed_potion">Tempotrank</text> + <text id="endurance_potion">Konditionstrank</text> + <text id="rat">Ratte</text> + <text id="pig">Schwein</text> + <text id="wyrm">Wyrm</text> + <text id="cocoon">Kokon</text> + <text id="dragon">Babydrache</text> + <text id="young_dragon">Jungdrache</text> + <text id="adult_dragon">Drache</text> + <text id="cockatiel">Nymphensittich</text> + <text id="wolf">Wolf</text> + <text id="cat">Katze</text> + <text id="boat">Boot</text> + <text id="fence">Zäune</text> + <text id="torch">Fackel</text> + <text id="trap">Falle</text> + <text id="workbench">Werkbank</text> + <text id="steel_workbench">Stahlwerkbank</text> + <text id="anvil">Amboss</text> + <text id="chest">Truhe</text> + <text id="jakolantern">Laterne</text> + <text id="sign">Schild</text> + <text id="area_name_sign">Namensschild</text> + <text id="rusty_axe">Rostige Axt</text> + <text id="cotton">Baumwolle</text> + <text id="pumpkin">Kürbis</text> + <text id="chicken">Huhn</text> + <text id="cow">Kuh</text> + <text id="fishing_rod">Angelrute</text> + <text id="toothfish">Seehecht</text> + <text id="rockfish">Kabeljau</text> + <text id="coral_cod">Rotbarsch</text> + <text id="fertilizer">Dünger</text> + <text id="yeti_fur">Yetifell</text> + <text id="dark_fur">Schattenfell</text> + <text id="fire_gem">Feuerjuwel</text> + <text id="water_gem">Wasserjuwel</text> + <text id="earth_gem">Erdjuwel</text> + <text id="ice_gem">Eisjuwel</text> + <text id="plant_gem">Pflanzenjuwel</text> + <text id="buckler">Rundschild</text> + <text id="kite_shield">Langschild</text> + <text id="ice_shield">Eisschild</text> + <text id="snowman">Schneemann</text> + <text id="thunder_axe">Donneraxt</text> + <text id="fire_tusk">Feuerstoßzahn</text> + <text id="silicon">Silikon</text> + <text id="refined_oil">Raffiniertes Öl</text> + <text id="battery">Batterie</text> + <text id="drill">Bohrer</text> + <text id="revolver">Revolver</text> + <text id="shotgun">Schrotflinte</text> + <text id="bullet">Munition</text> + <text id="ice_bullet">Eismunition</text> + <text id="fire_bullet">Feuermunition</text> + <text id="water_bullet">Wassermunition</text> + <text id="drain_bullet">Absorbiermunition</text> + <text id="shell">Hülse</text> + <text id="ice_shell">Eishülse</text> + <text id="fire_shell">Feuerhülse</text> + <text id="water_shell">Wasserhülse</text> + <text id="drain_shell">Absorbierhülse</text> + <text id="chainsaw">Kettensäge</text> + <text id="fire_chainsaw">Feuerkettensäge</text> + <text id="ice_chainsaw">Eiskettensäge</text> + <text id="water_chainsaw">Wasserkettensäge</text> + <text id="plant_chainsaw">Pflanzenkettensäge</text> + <text id="drain_chainsaw">Absorbierkettensäge</text> + <text id="minecart">Lore</text> + <text id="rail">Schiene</text> + <text id="map">Karte</text> + <text id="shovel">Schaufel</text> + <text id="crowbar">Brechstange</text> + <text id="landmine">Landmine</text> + <text id="alter_gem">Transformierjuwel</text> + <text id="focus_gem">Fokusjuwel</text> + <text id="spirit_gem">Seelenjuwel</text> + <text id="blood_gem">Blutjuwel</text> + <text id="baby_cannon">Babykanone</text> + <text id="dragonflame">Drachenflamme</text> + <text id="wyrm_drill">Wyrmbohrer</text> + <text id="dragon_armor">Drachenrüstung</text> + <text id="ice_sword">Eisschwert</text> + <text id="fire_sword">Feuerschwert</text> + <text id="water_sword">Wasserschwert</text> + <text id="plant_sword">Pflanzenschwert</text> + <text id="drain_sword">Absorbierschwert</text> + <text id="goggles">Rote Brille</text> + <text id="furnace">Ofen</text> + <text id="campfire">Lagerfeuer</text> + <text id="bandage">Verband</text> + <text id="tent">Zelt</text> + <text id="dragonsword">Drachenschwert</text> + <text id="silk">Seide</text> + <text id="lantern">Laterne</text> + <text id="headlamp">Stirnlampe</text> + <text id="plant_eye">Pflanzenauge</text> + <text id="plant_bag">Pflanzenrucksack</text> + <text id="jetpack">Jetpack</text> + <text id="shadow_cape">Schattenkape</text> + <text id="golem">Golem</text> + <text id="earth_armor">Erdrüstung</text> + <text id="earth_helm">Erdhelm</text> + <text id="earth_hammer">Erdhammer</text> + <text id="diode_wolf">Diodenwolf</text> + <text id="cyborg_body">Cyborgkörper</text> + <text id="cyborg_back">Cyborgrücken</text> + <text id="cyborg_eye">Cyborgauge</text> + <text id="machine_gun_arm">Gewehrarm</text> + <text id="electric_eel">Zitteraal</text> + <text id="horn">Horn</text> + <text id="frost_shield">Eisschild</text> + <text id="ice_heart">Eisherz</text> + <text id="owl">Eule</text> + <text id="dismantle">Zerlegen</text> + <text id="storehouse_blueprint">Blaupause: Lager</text> + <text id="kitchen_blueprint">Blaupause: Küche</text> + <text id="kitchen_upgrade">Küchenerweiterung</text> + <text id="smelter_blueprint">Blaupause: Schmelzofen</text> + <text id="workshop_blueprint">Blaupause: Werkstatt</text> + <text id="farm_blueprint">Blaupause: Scheune</text> + <text id="pen_blueprint">Blaupause: Tiergehege</text> + <text id="lab_blueprint">Blaupause: Labor</text> + <text id="wyrm_pen_blueprint">Blaupause: Wyrmgehege</text> + <text id="wheat_seed">Weizensamen</text> + <text id="orchard_seed">Apfelsaat</text> + <text id="sugar_seed">Zuckersaat</text> + <text id="cotton_seed">Wollsaat</text> + <text id="pumpkin_seed">Kürbissaat</text> + <text id="tree_seed">Baumsaat</text> + <text id="bush_seed">Beerensaat</text> + <text id="red_bush_seed">Rotbeerensaat</text> + </section> + <section id="item.descriptions"> + <text id="boat">Segle um die Welt.</text> + <text id="fence">Halten Feinde fern.</text> + <text id="furnace">Schmelzt Erze.</text> + <text id="campfire">Kocht [item=steak].</text> + <text id="magic_box">Enthält Alles.</text> + <text id="craft">Stellt Gegenstände her.</text> + <text id="repair">Repariert Gegenstände.</text> + <text id="freeze">Friert Gegner ein.</text> + <text id="burn">Verbrennt</text> + <text id="drain">Entzieht</text> + <text id="transform_other">Transformiert Gegenstände.</text> + <text id="fill">Füllt Löcher auf.</text> + <text id="collect_rail">Entfernt Schienen.</text> + <text id="storehouse">Lagert Gegenstände ein.</text> + <text id="sign">Schild setzen</text> + <text id="goggles">Enthüllt Seelen.</text> + <text id="tent">Füllt die [tile=stamina] [color=006600]Ausdauer[/color] auf.</text> + <text id="spawn">Erschafft {item}.</text> + <text id="light">Umgibt dich (ausgerüstet) mit Licht.</text> + <text id="cost_per_s">{value} pro Sekunde.</text> + <text id="cost_per_s_daylight">{value} pro Sek. im Tageslicht.</text> + <text id="cost_per_s_day">{value} pro Sek. tagsüber.</text> + <text id="cost_per_s_night">{value} pro Sek. nachts.</text> + <text id="cost_per_s_injured">{value} pro Sek. wenn verletzt.</text> + <text id="hide">Versteckt den Träger.</text> + <text id="critical">Immer einen kritischen Treffer landen.</text> + <text id="max_weight">Max. Gewicht</text> + <text id="reflect">Schadensreflektion</text> + <text id="fires">Feuert {projectile} ab</text> + <text id="cocoon">Schlüpft im [color=770000]Wyrmgehege[/color].</text> + <text id="builds">Erbaut</text> + <text id="upgrades">Erweitert</text> + <text id="dismantle">Zerlegt Gebäude von denen du eine [tile=blueprint.ico] [color=770000]Blaupause[/color] besitzt.</text> + <text id="collect">Sammelt Gegenstände vom Boden auf.</text> + <text id="plants">Pflanzt an</text> + <text id="area_name_sign">Kann Inseln umbennen, sobald platziert.</text> + </section> + <section id="achievement.names"> + <text id="hut">Unterschlupf</text> + <text id="boar">Instantfleisch</text> + <text id="storehouse">Unendlich Platz</text> + <text id="farm">Farmpächter</text> + <text id="orchard">Äpfel</text> + <text id="smelter">Metallurgie</text> + <text id="kitchen">Bon Appetit</text> + <text id="backpack">Rucksackträger</text> + <text id="workshop">Werkelzeit</text> + <text id="wyrm">Wyrmschlächter</text> + <text id="golem">Steinschlächter</text> + <text id="diamond">Glänzend</text> + <text id="market">Schnäppchen</text> + <text id="bigpack">Gewichtheber</text> + <text id="capture_wyrm">Wyrmfänger</text> + <text id="pen">Wollmilchsau</text> + <text id="pizza">Mmm, Käse</text> + <text id="dock">Ferne Ufer</text> + <text id="boat">Segel setzen</text> + <text id="lab">Experimente</text> + <text id="wyrm_pen">Unendlich Blut</text> + <text id="dragon">Schlüpfling</text> + <text id="powerplant">Energie</text> + <text id="factory">Industrialisierung</text> + <text id="elevator">Nach oben?</text> + <text id="bandits">Gerechtigkeit</text> + <text id="diode_wolf">Schockierend</text> + <text id="mirrows">Menschenversuche</text> + <text id="medicom">Volle Story</text> + <text id="electric_eel">Aufgeladen</text> + <text id="full_cyborg">Cyborgifizierung</text> + <text id="labyrinth">Taurenlabyrinth</text> + <text id="dragon_flight">Drachenzähmer</text> + <text id="wyrm_queen">Tod der Königin</text> + <text id="synthesizer">Magisches Steak</text> + <text id="forge">Schmiedegott</text> + <text id="enchanted_chainsaw">Kettensägenmagie</text> + <text id="elemental">Elementar</text> + <text id="purple_tree">Whomp</text> + <text id="full_dragon">Drachenmeister</text> + <text id="time_manipulator">Zurückgespult</text> + <text id="oldone">Der Uralte</text> + <text id="blueprints">Blaupausen</text> + <text id="skills">Purer Skill</text> + <text id="golemech">Golemstatue</text> + </section> + <section id="achievement.descriptions"> + <text id="hut">Baue die [color=ff2222]Hütte[/color].</text> + <text id="boar">Erlege ein [color=ff2222]Wildschwein[/color].</text> + <text id="storehouse">Baue das [color=ff2222]Lager[/color].</text> + <text id="farm">Baue die [color=ff2222]Farm[/color].</text> + <text id="orchard">Füge einen [color=ff2222]Obstgarten[/color] der [color=ff2222]Farm[/color] hinzu.</text> + <text id="smelter">Baue den [color=ff2222]Schmelzofen[/color].</text> + <text id="kitchen">Baue die [color=ff2222]Küche[/color].</text> + <text id="backpack">Erhalte den [color=ff2222]Rucksack[/color].</text> + <text id="workshop">Baue die [color=ff2222]Werkstatt[/color].</text> + <text id="wyrm">Erlege einen [color=ff2222]Wyrm[/color].</text> + <text id="golem">Erlege einen [color=ff2222]Golem[/color].</text> + <text id="diamond">Baue einen [color=ff2222]Diamanten[/color] ab.</text> + <text id="market">Baue den [color=ff2222]Markt[/color].</text> + <text id="bigpack">Kaufe einen [color=ff2222]Rucksack S[/color].</text> + <text id="capture_wyrm">Was mache ich nun damit?</text> + <text id="pen">Füge ein [color=ff2222]Gehege[/color] der [color=ff2222]Farm[/color] hinzu.</text> + <text id="pizza">Backe eine [color=ff2222]Pizza[/color].</text> + <text id="dock">Baue das [color=ff2222]Dock[/color].</text> + <text id="boat">Baue ein [color=ff2222]Boot[/color].</text> + <text id="lab">Baue das [color=ff2222]Labor[/color].</text> + <text id="wyrm_pen">Baue das [color=ff2222]Wyrmgehege[/color].</text> + <text id="dragon">Lass einen [color=ff2222]Drachen[/color] aus einem [color=ff2222]Kokon[/color] schlüpfen.</text> + <text id="powerplant">Baue das [color=ff2222]Kraftwerk[/color].</text> + <text id="factory">Baue die [color=ff2222]Fabrik[/color].</text> + <text id="elevator">Baue den [color=ff2222]Aufzug[/color].</text> + <text id="bandits">Löse das [color=ff2222]Banditenproblem[/color].</text> + <text id="diode_wolf">Besiege einen [color=ff2222]Diodenwolf[/color].</text> + <text id="mirrows">Besiege die Mirrows erfolgreich.</text> + <text id="medicom">Lies alle Nachrichten.</text> + <text id="electric_eel">Fange einen [color=ff2222]Zitteraal[/color].</text> + <text id="full_cyborg">Erhalte die ganze Cyborgausrüstung.</text> + <text id="labyrinth">Beende das Minotaurenlabyrinth.</text> + <text id="dragon_flight">Fliege auf einem [color=ff2222]Drachen[/color].</text> + <text id="wyrm_queen">Besiege die [color=ff2222]Wyrmkönigin[/color].</text> + <text id="synthesizer">Aktiviere den [color=ff2222]Synthesizer[/color].</text> + <text id="forge">Aktiviere die [color=ff2222]Schmiede[/color].</text> + <text id="enchanted_chainsaw">Verzaubere eine [color=ff2222]Kettensäge[/color].</text> + <text id="elemental">Fange je eine Seele von jedem Elementar.</text> + <text id="purple_tree">Fälle einen [color=ff2222]Tentakelbaum[/color].</text> + <text id="full_dragon">Erlange eine vollständige Drachenausrüstung.</text> + <text id="time_manipulator">Aktiviere den [color=ff2222]Zeitmanipulierer[/color].</text> + <text id="oldone">Besiege den [color=ff2222]Uralten[/color].</text> + <text id="blueprints">Baue etwas mithilfe einer [color=ff2222]Blaupause[/color].</text> + <text id="skills">Verbessere dich mit 500 oder mehr [color=ff2222]Skillpunkten[/color].</text> + <text id="golemech">Besiege den [color=ff2222]Golem[/color].</text> + </section> + <section id="structure"> + <text id="wheat">Weizenfeld</text> + <text id="orchard">Obstgarten</text> + <text id="sugar">Zuckerfeld</text> + <text id="cotton">Baumwollfeld</text> + <text id="pumpkin">Kürbisfeld</text> + <text id="add_field">Farm ausbauen</text> + <text id="add_stall">Gehege bauen</text> + <text id="pen">Gehege</text> + <text id="produces">-- Produziert --</text> + <text id="slots">-- Felder --</text> + <text id="plant">Feld ändern</text> + <text id="fertilizer">Dünger</text> + <text id="activate_fail">Nichts passiert.</text> + <text id="search_fail">Hmm, nichts Interessantes hier.</text> + <text id="get_pumpkin_seeds">Einige [item=pumpkin]samen gefunden und der Scheune hinzugefügt!</text> + <text id="sail_boat">Segeltour starten</text> + <text id="manage_storage">Lager verwalten</text> + <text id="elevator">Aufzug</text> + <text id="overweight">Das [item=boat] ist zu schwer um zu segeln!</text> + <text id="rest_boat">Im Boot ausruhen</text> + <text id="activate">Willst du {item} benutzen um diese Struktur zu aktivieren?</text> + <text id="enchant_recipe">Die Säule enthüllt folgende Verzauberung:\n{enchant}+{items}={creates}.</text> + <text id="enchant_added">Das Verzauberungsrezept wurde der [color=770000]Schmiede[/color] hinzugefügt.</text> + <text id="place_in_lair">Benötigt {item} in diesem Hort.</text> + <text id="golem_factory">Die Energie dieser Struktur wird in diese Statue übertragen...</text> + <text id="golemech">Baue Golemroboter</text> + <text id="build">Möchtest du {structure} für folgende Ressourcen erbauen?</text> + <text id="dismantle">Möchtest du {structure} für folgende Ressourcen zerlegen?</text> + <text id="dragon_lair">Derzeit im Drachenhort:</text> + </section> + <section id="structure.tooltip"> + <text id="hut">In der Hütte ausruhen</text> + <text id="storehouse">Lager betreten</text> + <text id="workshop">In der Werkstatt werkeln</text> + <text id="smelter">Erze schmelzen</text> + <text id="kitchen">In der Küche kochen</text> + <text id="farm">Farm betreten</text> + <text id="food_market">Handel mit Essenshändler</text> + <text id="weaps_market">Handel mit Waffenhändler</text> + <text id="mineral_market">Handel mit Erzhändler</text> + <text id="dockhouse">Bootshaus betreten</text> + <text id="boat">Mit dem Boot segeln</text> + <text id="lab">Tränke mischen</text> + <text id="pen">Gehege verwalten</text> + <text id="cage">Käfig verwalten</text> + <text id="summon_alchemist">Alchemist herbeirufen</text> + <text id="dragon_lair2">Drachenhort</text> + <text id="raise_into">Zu {into} züchten</text> + <text id="fly_dragon">Mit deinem Drachen fliegen</text> + <text id="activate">Aktivieren</text> + <text id="enter">Betreten</text> + <text id="tent">Im Zelt ausruhen</text> + <text id="search">Suchen</text> + <text id="power_plant">Kraftwerk nutzen</text> + <text id="inn">Gasthaus betreten</text> + <text id="elevator">Aufzug rufen</text> + <text id="warehouse">Warenhaus betreten</text> + <text id="factory">Fabrik nutzen</text> + <text id="golemech">Golemfabrik abschalten</text> + <text id="golemech2">Alarm: Unkontrollierbar.</text> + <text id="read">Lies</text> + <text id="operate">Labor nutzen</text> + </section> + <section id="object.tooltip"> + <text id="bush">Pflücke Beeren</text> + <text id="tree">Fälle Baum</text> + <text id="enemy">Angreifen</text> + <text id="collect">Sammle {item}</text> + <text id="open">Öffne {item}</text> + <text id="harvest">Ernte {item}</text> + <text id="use">Benutze {item}</text> + </section> + <section id="equipment"> + <text id="weapon">Waffenhand:</text> + <text id="shield">Schildhand:</text> + <text id="pickaxe">Bergbauwerkzeug:</text> + <text id="armor">Rüstung:</text> + <text id="head">Helm:</text> + <text id="back">Rucksack:</text> + <text id="familiar">Vertrauter:</text> + <text id="attack">Waffe:</text> + <text id="engine">Motor:</text> + </section> + <section id="capture"> + <text id="caught">Gefangen!</text> + <text id="fail">Zerbrochen!</text> + <text id="almost">Entkommen!</text> + </section> + <section id="warning"> + <text id="weight">Tragekapazität überschritten!</text> + <text id="stamina">Keine Ausdauer mehr, Lebensgefahr!</text> + <text id="growing">Wächst noch! Komm später wieder.</text> + <text id="additions">Kein Platz mehr!</text> + <text id="focus">Klicke zum Fokussieren</text> + <text id="ingredients">Du hast nicht genug Zutaten.</text> + <text id="place_surface">Du kannst keine Objekte unter der Oberfläche platzieren.</text> + <text id="place_overlap">Du kannst keine Objekte auf anderen Objekten platzieren.</text> + <text id="no_place">Kann hier nicht platziert werden!</text> + <text id="structure_surface">Dieses Gebäude kann nicht unter der Oberfläche erbaut werden.</text> + <text id="structure_tile">Du musst mehr Platz schaffen um dieses Gebäude zu erbauen.</text> + <text id="structure_overlap">Du kannst Gebäude nicht auf anderen Gebäuden oder Pflanzen errichten.</text> + <text id="structure_barn">Du kannst dieses Gebäude nicht ohne eine Scheune errichten.</text> + <text id="plant_structure">Du kannst nicht auf Gebäuden oder Pflanzen anpflanzen.</text> + <text id="plant_grass">Du kannst nur auf gedüngtem Gras anpflanzen.</text> + <text id="plant_barn">Du kannst keine Felder ohne eine Scheune anpflanzen.</text> + <text id="no_effect">Es wird keinen Effekt haben.</text> + <text id="drop_instead">Lieber wegwerfen?</text> + <text id="cannot_fire">Kann {projectile} ohne {weapon} nicht abfeuern.</text> + <text id="no_projectiles">Kann {weapon} nicht abfeuern: keine {projectile}.</text> + <text id="max_items">Du kannst keine Gegenstände mehr hinzufügen!</text> + <text id="max_fuel">Du kannst keinen Brennstoff mehr hinzufügen!</text> + <text id="max_rations">Du kannst keine Rationen mehr hinzufügen!</text> + <text id="max_feed">Du kannst nicht noch mehr füttern!</text> + <text id="max_coins">Dein Geldbeutel ist voll!</text> + <text id="send_bug_report">Etwas ist schiefgelaufen! Fehlerbericht senden?</text> + <text id="not_powered">Keine Energie!</text> + <text id="power">Nicht genug Batterien!</text> + <text id="rations">Nicht genug Rationen für die Reise!</text> + <text id="fuel">Nicht genug Brennstoff!</text> + <text id="no_item">Dir fehlt {item}.</text> + <text id="item_hungry">{item} ist zu hungrig um die Reise anzutreten!</text> + <text id="no_fill">Hier kannst du nichts auffüllen!</text> + <text id="load_fail">Hauptspiel konnte nicht geladen werden. Dies bedeutet dir fehlen Spieldaten! Lade das Spiel erneut herunter und entpacke den Inhalt des .zip-Archives in einen Ordner.</text> + <text id="load_fail_js">Hauptspiel konnte nicht geladen werden. Dies bedeutet dir fehlen Spieldaten! Versuche Umschalt+F5 um die Webseite 'komplett neu' zu laden.</text> + <text id="incomplete">Dies ist noch unvollständig. Du musst auf ein weiteres Spielupdate warten.</text> + <text id="no_pickaxe">Die Kamera fuhr aufwärts weil du keine Spitzhacke mehr angelegt hast. Du kannst eine Spitzhacke anlegen indem du [key=equipment] drückst.</text> + <text id="sleep_flying">Du kannst während dem fliegen nicht schlafen!</text> + <text id="flight_weight">Du bist zu schwer um mit {item} zu fliegen!</text> + <text id="overweight">Du bist überladen und kannst dich nicht bewegen!</text> + <text id="no_equip">Du kannst {item} nicht ausrüsten.</text> + <text id="no_structure">Es gibt hier kein Gebäude zum zerlegen.</text> + <text id="no_upgrade">Es gibt hier kein Gebäude zum erweitern.</text> + <text id="no_blueprint">Du hast für dieses Gebäude keine Blaupause.</text> + <text id="one_structure">Du kannst nur ein Gebäude dieser Art pro Insel erbauen.</text> + <text id="no_use_vehicle">Du kannst dies nicht tun während du ein Fahrzeug nutzt.</text> + </section> + <section id="market"> + <text id="closed">Nachts geschlossen.</text> + <text id="restock">Wir sollten bald neue Bestände erhalten!</text> + <text id="no_power">Ich kann es nicht glauben, das [color=770000]Kraftwerk[/color] funktioniert nicht! Wie soll ich so Geschäfte abwickeln?</text> + </section> + <section id="quests"> + <text id="new">Neue Quest!</text> + <text id="none">Du hast derzeit keine Quests.</text> + <text id="unknown_reqs">???</text> + <text id="requires">-- Benötigt --</text> + <text id="complete">-- Erledigt --</text> + <text id="hut">Die Hütte</text> + <text id="storehouse">Das Lager</text> + <text id="storehouse2">Das Lager</text> + <text id="smelter">Der Schmelzofen</text> + <text id="workshop">Die Werkstatt</text> + <text id="kitchen">Die Küche</text> + <text id="kitchen2">Bessere Küche</text> + <text id="farm">Die Farm</text> + <text id="orchard">Obstgärten</text> + <text id="market">Der Markt</text> + <text id="market2">Der Markt</text> + <text id="dock">Das Dock</text> + <text id="dock2">Das Dock</text> + <text id="pen">Schweinegehege</text> + <text id="boat">Das Boot</text> + <text id="lab">Das Labor</text> + <text id="wyrm_pen">Wyrmgehege</text> + <text id="hatch_dragons">Drachenbrut</text> + <text id="thunder_axe">Magische Axt</text> + <text id="hunt">Wildschweinjagd</text> + <text id="fence">Perimeter</text> + <text id="wolf">Wolfsblut</text> + <text id="powerplant">Das Kraftwerk</text> + <text id="factory">Die Fabrik</text> + <text id="elevator">Der Aufzug</text> + <text id="mirrows">Die Mirrows</text> + <text id="mirrows2">Überzeuge Sie</text> + <text id="fisherman_cat">Peri finden</text> + <text id="bandits">Banditenplage</text> + <text id="boars">Wildschweinplage</text> + <text id="wyrm_hive">Wyrmbau</text> + <text id="find_wyrm_hive">Wyrmbau finden</text> + <text id="alter_gem">Wyrmforschung</text> + <text id="oldone">Magische Energie</text> + </section> + <section id="quest.description"> + <text id="hut">Baue eine [color=550000]Hütte[/color], um dich vor dem Sturm zu schützen.</text> + <text id="storehouse">möchte ein [color=550000]Lager[/color] bauen.</text> + <text id="storehouse2">Baue ein [color=550000]Lager[/color], um Gegenstände zu lagern.</text> + <text id="smelter">möchte einen [color=550000]Schmelzofen[/color] bauen.</text> + <text id="workshop">möchte eine [color=550000]Werkstatt[/color] bauen.</text> + <text id="kitchen">möchte eine [color=550000]Küche[/color] bauen, um Essen zu kochen.</text> + <text id="kitchen2">möchte die [color=550000]Küche[/color], um [item=cheese] herzustellen.</text> + <text id="farm">möchte eine [color=550000]Farm[/color] errichten, um Nahrung anzubauen.</text> + <text id="orchard">möchte [item=fruit] nutzen, um einen [color=550000]Obstgarten[/color] anzupflanzen.</text> + <text id="market">möchte einen [color=550000]Markt[/color] bauen, um Handel zu treiben.</text> + <text id="market2">Baue einen [color=550000]Markt[/color], um Händler an dein [color=550000]Dock[/color] zu locken.</text> + <text id="dock">möchte ein [color=550000]Dock[/color], um die Welt zu bereisen.</text> + <text id="dock2">Baue ein [color=550000]Dock[/color], um andere Überlebende zu finden.</text> + <text id="pen">möchte ein [color=550000]Gehege[/color] bauen, um Vieh zu halten.</text> + <text id="boat">Es ist Zeit, um die Welt zu segeln! Baue ein [item=boat] im [color=550000]Bootshaus[/color].</text> + <text id="lab">möchte das du einen [item=wyrm] tötest um [item=dragonblood] zu erhalten.</text> + <text id="wyrm_pen">möchte an [item=wyrm]s experimentieren.</text> + <text id="hatch_dragons">Lass [item=dragon]n schlüpfen, um den [item=adult_dragon]n zu überzeugen.</text> + <text id="thunder_axe">möchte die [item=rusty_axe] reparieren.</text> + <text id="hunt">möchte, dass du den Umgang mit Waffen übst.</text> + <text id="fence">möchte die Siedlung mit [item=fence]n begrenzen.</text> + <text id="wolf">möchte den jungen Wolf zähmen.</text> + <text id="powerplant">benötigt [item=titanium] um das [color=550000]Kraftwerk[/color] zu reparieren.</text> + <text id="factory">will eine [color=550000]Fabrik[/color] bauen, um Maschinen zu basteln.</text> + <text id="elevator">will einen [color=550000]Aufzug[/color] bauen um Erze zu fördern.</text> + <text id="mirrows">möchte das du die Mirrows zur Rede stellst.</text> + <text id="mirrows2">möchte das du die Mirrows überzeugst.</text> + <text id="fisherman_cat">möchte das du [item=cat] findest, die [item=toothfish] mag.</text> + <text id="bandits">Händler wollen das du die Banditen besiegst.</text> + <text id="wyrm_hive">möchte [item=wyrm]geheimnisse erforschen.</text> + <text id="alter_gem">benötigt Hilfe für seine [item=wyrm]forschung!</text> + <text id="oldone">möchte die magischen Energiespitzen finden!</text> + </section> + <section id="vehicle"> + <text id="dismount">Absteigen</text> + <text id="vehicle">Fahrzeug</text> + <text id="fly">Nach oben bewegen um zu fliegen.</text> + <text id="overweight">Das Fahrzeug ist zu schwer um sich zu bewegen!</text> + <text id="manage_items">Gegenstände verwalten</text> + <text id="manage_player">Spieler verwalten</text> + <text id="battery">Mit Batterien aufladen</text> + </section> + <section id="npc"> + <text id="talk">Reden</text> + <text id="grab">Greifen</text> + <text id="builder">Bauarbeiter</text> + <text id="miner">Bergarbeiterin</text> + <text id="farmer">Farmer</text> + <text id="trader">Händlerin</text> + <text id="alchemist">Alchemist</text> + <text id="hunter">Jäger</text> + <text id="mechanic">Mechaniker</text> + <text id="innkeeper">Gastwirt</text> + <text id="fisherman">Fischer</text> + </section> + <section id="builder"> + <text id="intro">Denkst du wirklich, dass man hier überleben kann? Hoffnungslos, Mann.</text> + <text id="introduce1">Du bist gut im Bauen oder? Wie wäre es, wenn wir etwas bauen um Rohstoffe und Nahrung zu lagern?</text> + <text id="introduce2">Pfff. Ich denke mit [var=quest.storehouse.wood] [item=wood] und [var=quest.storehouse.berries] [item=berries] könnte ich ein anständiges [color=770000]Lager[/color] bauen.</text> + <text id="accept1">Alles klar! Das kann ich besorgen, kein Problem.</text> + <text id="accept2">Nimm diese [item=stone_axe] wenn du so übereifrig bist.</text> + <text id="stamina">Ich bin außer Puste. Du siehst auch müde aus. Wir sollten uns in der [color=770000]Hütte[/color] ausruhen, um das Spiel zu speichern und unsere [tile=stamina] [color=006600]Ausdauer[/color] aufzufüllen.</text> + <text id="wood">Wie ist meine alte [item=stone_axe]? Ich wette damit könntest du einen Baum fällen, wenn du neben ihm [key=select] drückst.</text> + <text id="hint1">Alle Gegenstände wandern in dein Inventar wenn du sie sammelst. Du kannst es einsehen, indem du [key=inventory] drückst.</text> + <text id="hint2">Wenn du keine [tile=stamina] [color=006600]Ausdauer[/color] mehr hast, verlierst du [tile=health] [color=770000]Leben[/color] und wenn dein [tile=health] [color=770000]Leben[/color] zur Neige geht, stirbst du.</text> + <text id="hint3">Darum musst du viele [item=berries], [item=fruit] und [item=meat] essen. Wähle deine Mahlzeit dazu einfach im Inventar aus.</text> + <text id="storehouse1">Du hast schon alles zusammen? Ich bin beeindruckt.</text> + <text id="storehouse2">Lass uns das [color=770000]Lager[/color] bauen!</text> + <text id="storehouse3">Schau dir das an! Fühlst du dich nicht großartig?</text> + <text id="storehouse4">Ja… tatsächlich, das wird nützlich sein. Jetzt können wir vermeiden, dass wir vom vielen Schleppen müde werden.</text> + <text id="farmer">Wir sollten einen Deal mit dem [color=770000][tile=farmer] Farmer[/color] machen, er könnte uns helfen leckere Nahrung anzubauen.</text> + <text id="miner">Hast du die [color=770000][tile=miner] Bergarbeiterin[/color] gesehen? Du solltest fragen was sie will.</text> + <text id="kitchen1">Was hältst du davon eine [color=770000]Küche[/color] zu bauen? [item=meat] ist gut, aber gekocht ist es noch besser.</text> + <text id="kitchen2">Ich brauche [var=quest.kitchen.wood] [item=wood] und [var=quest.kitchen.coal] [item=coal], um die [color=770000]Küche[/color] zu bauen.</text> + <text id="kitchen3">Sieht so aus als hättest du alles, was ich brauche. Lass uns die [color=770000]Küche[/color] bauen!</text> + <text id="kitchen4">Du kannst Essen in der [color=770000]Küche[/color] zubereiten, solange du [item=wood] oder [item=coal] zum befeuern hast.</text> + <text id="kitchen5">Weißt du wofür ich sterben könnte? Etwas [item=cheese]. Es gibt nichts Köstlicheres.</text> + <text id="kitchen6">Ich könnte die [color=770000]Küche[/color] verbessern, um [item=cheese] und neue Rezepte herzustellen. Ich benötige nur [var=quest.kitchen2.wood] [item=wood] und [var=quest.kitchen2.steel_bar] [item=steel_bar].</text> + <text id="kitchen7">Sieht so aus als hättest du alles, was ich brauche. Lass uns die [color=770000]Küche[/color] verbessern!</text> + <text id="kitchen8">Probier mal ein paar der neuen Rezepte aus! Fühlt sich beinahe zivilisiert an!</text> + <text id="farm">Mann, hab ich Hunger. Ich hoffe ihr seid bald mit der [color=770000]Farm[/color] fertig!</text> + </section> + <section id="farmer"> + <text id="introduce1">Junge, bin ich froh dich zu sehen. Ich dacht schon ich wäre ganz allein, ein alter Mann in einer leeren Welt.</text> + <text id="introduce2">In diesen alten Knochen steckt immer noch Leben und mich deucht, ich könnte dir helfen. Die Landwirtschaft ist mein Beruf und wir alle brauchen gutes Essen, um in Bewegung zu bleiben.</text> + <text id="introduce3">Wie wäre es wenn wir eine Scheune bauen und eine [color=770000]Farm[/color] zum Leben erwecken?</text> + <text id="farm1">Fein! Ich errichte die Scheune und bestelle ein paar Felder!</text> + <text id="farm2">Jetzt haben wir eine [color=770000]Farm[/color]! Schau ab und an mal vorbei, um Nahrung abzuholen - sie wird dir helfen deine [tile=stamina] [color=006600]Ausdauer[/color] aufzufüllen. Hier - nimm etwas [item=bread], um auf Trab zu bleiben während alles wächst.</text> + <text id="farm3">Du kannst [item=wood] erhalten indem du Bäume fällst.</text> + <text id="farm4">Wenn du mehr wachsen lassen möchtest, können wir bis zu vier Weizenfelder oder Obstgärten anbauen. Du kannst sie in der Scheune hinzufügen.</text> + <text id="farm5">Schau dir unsere tolle [color=770000]Farm[/color] an! Es ist so gut wie alles was ich auch zu Hause angebaut habe!</text> + <text id="kitchen">Roher [item=wheat] schmeckt nicht besonders aber wir könnten etwas Besseres daraus machen, wenn du und der [color=770000][tile=builder] Bauarbeiter[/color] eine [color=770000]Küche[/color] baut.</text> + <text id="pen1">Weißt du was diese [color=770000]Farm[/color] braucht? Nutzvieh! Wie wäre es wenn du ein paar [color=770000][tile=boar] Wildschweine[/color] mit einem [item=net] vom [color=770000]Markt[/color] fängst?</text> + <text id="pen2">Ich werde ein [color=770000]Gehege[/color] für [var=quest.pen.pig] [item=pig]e und [var=quest.pen.wood] [item=wood] bauen.</text> + <text id="pen3">Sind das nicht die fettesten und saftigsten [item=pig]e die du je gesehen hast?</text> + <text id="pen4">Mit dem Gehege können wir [item=meat] und [item=milk] produzieren!</text> + <text id="pen5">Hier ist eine [item=pen_blueprint] damit du mehr Gehege bauen kannst!</text> + <text id="pig">Wie du ein [item=pig] fängst? Lege ein [item=net] auf den Boden und locke ein [color=770000][tile=boar] Wildschwein[/color] hinein und schwupps! Es ist gefangen und gezähmt!</text> + <text id="kitchen2">Ein [item=pig] melken? Warum nicht? Dies ist ein merkwürdiges Land. Aber was wir wirklich gebrauchen könnten, ist etwas [item=cheese] - sprich mit dem [color=770000][tile=builder] Bauarbeiter[/color] darüber, die [color=770000]Küche[/color] zu verbessern.</text> + <text id="halloween">Ich hoffe, es macht dir nichts aus, aber ich habe ein wenig für das Erntefest umdekoriert! Wir könnten hier eine kleine Feier vertragen. Ich habe auch ein paar [item=jakolantern]n im [color=770000]Lager[/color] verstaut.</text> + <text id="add_sugar">Die Farm wächst und gedeiht! Um das zu feiern, habe ich ein paar Samen für [item=sugar] aufgetrieben und in die Scheune gebracht! Versuche ein Feld mit [item=sugar] anzubauen!</text> + <text id="add_cotton">Ich habe ein paar Händler am [color=770000]Dock[/color] getroffen und Samen für [item=cotton] bekommen! Du kannst jetzt [item=cotton] in der Scheune anbauen.</text> + <text id="orchard1">Hier gibt es eine Menge [item=fruit]. Mit genügend Apfelkernen könnte ich einen schönen [color=770000]Obstgarten[/color] anpflanzen!</text> + <text id="orchard2">Großartig, das sind genug! Ich habe die Apfelkerne in die Scheune gebracht, du kannst jetzt Felder in Obstgärten umwandeln.</text> + <text id="orchard3">Lass es mich wissen wenn du genügend [item=fruit] für den [color=770000]Obstgarten[/color] hast!</text> + <text id="orchard4">Samen können auf Gras angepflanzt werden solange genügend Platz vorhanden ist. Hier wäre doch die perfekte Stelle für die [item=orchard_seed]!</text> + <text id="orchard5">Du kannst Samen auch nutzen um Felder in der [color=770000]Scheune[/color] zu wechseln. Wenn du neue Samen erstellen möchtest, lass es mich einfach wissen!</text> + <text id="snowman">Der erste Schnee! Das sollten wir feiern! Ich habe sogar einen magischen [item=snowman] aus [item=ice_berries] gebaut, ich hoffe er gefällt dir!</text> + <text id="sign1">Dieser Ort fühlt sich langsam wie ein Zuhause an, oder? Wie wäre es ihm einen Namen zu geben?</text> + <text id="sign2">Nutze ein [item=sign] um den Namen der Insel zu ändern!</text> + </section> + <section id="miner"> + <text id="introduce1">Oh, hey. Hab gar nicht bemerkt, dass hier noch andere Überlebende sind.</text> + <text id="introduce2">Ich war unter Tage - hier gibt es viel mehr zu entdecken als man auf den ersten Blick vermuten würde.</text> + <text id="introduce3">Ich hab noch eine Spitzhacke übrig, falls du dich selbst davon überzeugen möchtest.</text> + <text id="smelter">Wie geht's mit dem Buddeln voran? Vielleicht sollten wir einen [color=770000]Schmelzofen[/color] bauen, um Erze in Barren zu schmelzen.</text> + <text id="accept1">Großartig! Lass mich wissen wenn du genügend [item=coal] hast!</text> + <text id="smelter1">Das ist das Zeug. Ich hab den [color=770000]Schmelzofen[/color] im Nu gebaut!</text> + <text id="smelter2">Der [color=770000]Schmelzofen[/color] kann Erze in Barren schmelzen. Dazu benötigt er Brennstoff aber zum Glück gibt es genug [item=coal] im Erdreich.</text> + <text id="hint1">Nun, worauf wartest du? Drücke einfach [key=down] um zu graben und Erze zu finden!</text> + <text id="hint2">Erze sind schwer - vergiss nicht sie zwischen deinen Ausflügen im [color=770000]Lager[/color] abzuliefern.</text> + <text id="hint3">Beim Graben verliert man leicht die Zeit aus den Augen, achte darauf dass du genug [tile=stamina] [color=006600]Ausdauer[/color] für den Rückweg hast.</text> + <text id="hint4">Je tiefer du gräbst desto wertvollere Erze findest du.</text> + <text id="hint5">Wenn du vor hast sehr tief zu graben solltest du [item=torch]n dabei haben. Wenn du sie ausrüstet, spenden sie dir Licht - zumindest bis sie ausgebrannt sind.</text> + <text id="hint6">Ich kann [item=torch]n herstellen falls du welche benötigst.</text> + <text id="workshop1">Wie wäre es mit einer [color=770000]Werkstatt[/color], um aus den Barren Werkzeuge herzustellen? Ich kann dir eine für [var=quest.workshop.iron_bar] [item=iron_bar] und [var=quest.workshop.wood] [item=wood] bauen.</text> + <text id="workshop2">Alles klar, lass uns die [color=770000]Werkstatt[/color] bauen!</text> + <text id="workshop3">In der [color=770000]Werkstatt[/color] kannst du Werkzeuge oder Gegenstände herstellen, wenn du die nötigen Materialien hast.</text> + <text id="workshop4">Du brauchst [item=iron], um es in [item=iron_bar] im [color=770000]Schmelzofen[/color] zu schmelzen.</text> + <text id="smelter3">Sobald du genug [item=iron] hast, wähle [item=iron_bar] im [color=770000]Schmelzofen[/color] aus und es wird automatisch in Barren geschmolzen, solange Brennstoff übrig ist.</text> + <text id="smelter4">Du kannst mehrere Aufträge im [color=770000]Schmelzofen[/color] hinzufügen und er wird sie nacheinander abarbeiten, während du unterwegs bist, solange Brennstoff vorhanden ist.</text> + <text id="pick">Wenn du dich durch [color=770000][tile=stone] Stein[/color] hacken willst um an [item=gold] zu kommen, musst du eine [item=iron_pickaxe] oder [item=steel_pickaxe] in der [color=770000]Werkstatt[/color] herstellen.</text> + <text id="equip1">Wenn du durch [color=770000][tile=stone] Stein[/color] hacken willst um an [item=gold] zu gelangen, musst du eine [item=iron_pickaxe] oder [item=steel_pickaxe] ausrüsten. Drücke [key=equipment] um deine Ausrüstung zu verwalten.</text> + <text id="equip2">Du kannst deine Ausrüstung verwalten indem du [key=equipment] drückst.</text> + <text id="hotkey">Du kannst auch [color=770000]Hotkeys[/color] benutzen.\nDrücke [key=hotkey1], [key=hotkey2], [key=hotkey3] oder [key=hotkey4] im Inventar, um sie festzulegen.</text> + </section> + <section id="trader"> + <text id="steal">Es wurde(n) [item={item}] aus dem [color=770000]Lager[/color] gestohlen!</text> + <text id="caught">Der Dieb wurde auf frischer Tat ertappt!</text> + <text id="introduce1">Es ist schwer genug hier zu überleben, auch ohne dass jemand unser Zeug klaut!</text> + <text id="introduce2">Ich habe mir lediglich ein paar Dinge geliehen. Aber hör zu. Ich mach's wieder gut, indem ich meine Dienste anbiete. Ich habe Beziehungen zu Händlern auf anderen Inseln.</text> + <text id="introduce3">Händler? Es gibt da draußen mehr Überlebende?</text> + <text id="introduce4">Genau. Aber ich brauche [var=quest.market.gold_bar] [item=gold_bar] um sie zu überreden sich hier niederzulassen.</text> + <text id="introduce5">Wir sollen dich bezahlen obwohl du gerade beim Klauen erwischt wurdest?!</text> + <text id="introduce6">Das war etwas anderes. Jetzt geht's ums Geschäft. Mein Angebot lautet [var=quest.market.gold_bar] [item=gold_bar] um diese Insel der Handelsroute hinzuzufügen.</text> + <text id="introduce7">Von mir aus. Wenn es da draußen andere Überlebende gibt, könnte der Handel mit ihnen unsere Fahrkarte von dieser Insel sein.</text> + <text id="introduce8">Tut mir leid, einem Dieb kann man nicht trauen. Verlass diese Insel und komm nie mehr zurück.</text> + <text id="introduce9">Es gibt eh bessere Inseln von denen ich stehlen kann. Du weißt nicht was dir entgeht.</text> + <text id="market1">Wunderbar! Ich fühle es - dies ist der Beginn vieler lukrativer Geschäfte zwischen uns.</text> + <text id="market2">Nimm diesen [item=coin_purse]. Du brauchst ihn um Münzen darin aufzubewahren. Ich empfehle dir so früh wie möglich einen [item=mega_backpack] zu kaufen, das sind echte Lebensretter!</text> + <text id="market3">Auf dem [color=770000]Markt[/color] kannst du Güter verkaufen um Münzen zu erhalten, mit denen du andere Güter kaufen kannst.</text> + <text id="market4">Der [color=770000]Markt[/color] bekommt in gewissen Abständen neue Waren geliefert. Wenn es das was du suchst also gerade nicht gibt oder die Bestände ausverkauft sind, schau später nochmal vorbei.</text> + <text id="market5">Um einen [item=gold_bar] herzustellen musst du [item=gold] schmelzen, welches tief im Erdreich zu finden ist. Die [color=770000][tile=miner] Bergarbeiterin[/color] hat vielleicht ein paar Tipps für dich.</text> + <text id="dock1">Bist du daran interessiert den Rest der Welt zu sehen? Wie wäre es wenn wir ein [color=770000]Dock[/color] bauen?</text> + <text id="dock2">Ich baue es für dich, wenn du mir [var=quest.dock.coins] [color=770000][tile=coin_purse.ico] Münzen[/color], [var=quest.dock.wood] [item=wood], [var=quest.dock.cloth] [item=cloth] und [var=quest.dock.net] [item=net]e bringst.</text> + <text id="dock3">Wunderbar, lass uns das [color=770000]Dock[/color] bauen!</text> + <text id="dock4">Sobald du ein [item=boat] im [color=770000]Bootshaus[/color] gebaut hast, kannst du über die Meere segeln!</text> + <text id="dock5">Das [color=770000]Dock[/color] kostet [var=quest.dock.coins] [color=770000][tile=coin_purse.ico] Münzen[/color], [var=quest.dock.wood] [item=wood], [var=quest.dock.cloth] [item=cloth] und [var=quest.dock.net] [item=net]e.</text> + <text id="accept">Akzeptieren</text> + <text id="reject">Wegschicken</text> + <text id="sail">Ist es nicht ein schöner Tag zum Segeln?</text> + </section> + <section id="alchemist"> + <text id="introduce1">Dieser Planet birgt viele Geheimnisse. Ich habe ein wenig experimentiert und glaube, ich bin auf Magie gestoßen!</text> + <text id="introduce2">Ich brauche mehr Materialien. Wenn du zufällig auf einen [item=wyrm] stößt, erlege ihn und gib mir sein [item=dragonblood] und ich werde dich belohnen.</text> + <text id="lab1">Ich wusste es! Das ist das Geheimnis! Ich muss sofort ein Labor errichten!</text> + <text id="lab2">Deine Belohnung? Bring Materialien zu mir ins Labor und ich werde dir magische Tränke mischen.</text> + <text id="lab3">Beeil dich! Meine Forschung steht still, solange ich nicht etwas [item=dragonblood] bekomme!</text> + <text id="pen1">Ich brauche mehr [item=dragonblood]! Bring mir [var=quest.wyrm_pen.wyrm] lebendige [item=wyrm]s und wir werden eine endlose Quelle für [item=dragonblood] zum Experimentieren haben!</text> + <text id="pen2">Ausgezeichnet! Tritt zurück, während ich meine Magie wirke!</text> + <text id="pen3">Sieh meine geniale Erfindung - das [color=770000]Wyrmgehege[/color]! Es ist mehr als nur ein Gehege, es ist eine endlose Quelle für [item=dragonblood]!</text> + <text id="wyrm">Ich wette, du könntest einen [item=wyrm] mit einem [item=net] fangen. Aber sie müssen lebendig und unversehrt sein!</text> + <text id="dragon1">Wir müssen mehr über die [item=wyrm]s in Erfahrung bringen! Was fressen sie? Warum erzeugen sie [item=dragonblood]?</text> + <text id="dragon2">Ich wusste es! Die [item=wyrm]s metamorphosieren zu [item=dragon]n! Aber warum gibt es dann nur so wenige ausgewachsene [item=adult_dragon]n in diesem Land?</text> + <text id="dragon3">Ich glaube, irgendwo im Berg befindet sich eine Drachenhöhle. Wenn du sie findest, rufe mich... vielleicht lassen sich dort einige dieser Geheimnisse lüften.</text> + <text id="dragon4">Ah, ein [item=adult_dragon]! Lass uns hören, was sie zu sagen hat - ich kann für dich mit einem simplen Zauber übersetzen.</text> + <text id="dragon5">Wer wagt es, meinen Schlaf zu stören?</text> + <text id="dragon6">Ich bin ein Suchender nach Wahrheit und Magie. Verrate mir - warum gibt es nur noch so wenige Drachen in dieser Welt?</text> + <text id="dragon7">Weil die Alten fort sind. Auch sie waren Suchende nach Wahrheit und Magie. Und sie verrieten meine Art.</text> + <text id="dragon8">Vielleicht können wir dir behilflich sein! Das einzige, worum wir im Gegenzug bitten, ist Wissen.</text> + <text id="dragon9">Ihr glaubt, ihr könnt helfen? Dann beweist es. Wenn ihr [var=quest.hatch_dragons.dragon] [item=dragon]n schlüpfen lassen und zu mir bringen könnt, reden wir weiter. Andernfalls, verschwindet!</text> + <text id="dragon10">Ich wusste, ihr würdet mich verraten! Spürt meinen Zorn!</text> + <text id="dragon11">Ich denke, wir sollten sie nicht erneut wecken, solange wir nicht die [item=dragon]n haben.</text> + <text id="dragon12">Ihr habt es vollbracht? Vielleicht gibt es doch noch Hoffnung für meine Art.</text> + <text id="dragon12_a">Ausgezeichnet! Du wirst uns also über die Geheimnisse der Magie unterrichten?</text> + <text id="dragon13">Leider kenne ich die Geheimnisse, nach denen ihr sucht, nicht. Die Alten erschufen uns und sie bauten diese Höhle, um uns großzuziehen.</text> + <text id="dragon14">Jedoch könntet ihr Antworten auf den Inseln im Osten finden. Kehrt zu dieser Höhle zurück, wenn ihr bereit seid, und ich werde euch dorthin bringen.</text> + <text id="call_dragon">Wo hast du den Drachen gelassen? Ich werde ihn herbeirufen - versuch ihn nicht wieder zu verlieren.</text> + <text id="lair1">Ich wusste es! Diese Höhle ist künstlich, geschaffen von Zauberhand! Scheinbar bestand ihr Zweck darin, Drachen großzuziehen!</text> + <text id="lair2">Ich wette, ich kann sie aktivieren...</text> + <text id="lair3">Aha! Es ist vollbracht! Mit dieser Höhle können wir unsere eigenen Drachen großziehen. Die Höhle scheint gen Osten zu zeigen, vielleicht könnten wir mit einem Drachen in diese Richtung fliegen und mehr entdecken...</text> + <text id="axe1">Lass mich diese [item=rusty_axe] sehen... Mit all dem Rost ist es schwer zu erkennen, aber diese Symbole kommen mir bekannt vor!</text> + <text id="axe2">Hier ist uralte Magie am Werk, aber sie ist erloschen. Wenn du mir die nötige magische Zutat bringst, kann ich sie vielleicht reparieren...</text> + <text id="axe3">Dieser [item=fire_tusk]... von welcher Art Kreatur hast du ihn? Er scheint auf die [item=rusty_axe] zu reagieren, vielleicht ist das die magische Zutat, nach der wir gesucht haben!</text> + <text id="axe4">Ich habe es vollbracht! Ich frage mich, wer diese [item=thunder_axe] geschaffen hat und wie alt sie wohl ist? Wenn du mehr herstellen möchtest, kannst du dies ab sofort im Labor tun.</text> + <text id="shadow_cape1">Lass mich dieses [item=dark_fur] sehen! Es scheint als existiere es zwischen der Welt der Seelen und den Lebenden...</text> + <text id="shadow_cape2">Ich muss es weiter erforschen, aber ich kann daraus ein [item=shadow_cape] herstellen das dich unsichtbar werden lässt.</text> + <text id="magic_intro1">Diese Insel ist von Magie quasi durchflutet - wir sind hier definitiv richtig!</text> + <text id="magic_intro2">Ich habe diese Art von Magie schon einmal gesehen. Diese Strukturen sind teilweise organisch und im Winterschlaf. Sie müssen erweckt werden.</text> + <text id="magic_intro3">Ich weiß bereits wie ich diese lilane Kammer aktivieren kann, aber die anderen Strukturen benötigen weitere Studien.</text> + <text id="magic_intro4">Dies hier sollte ein guter Stützpunkt sein. Ich werde ein paar Vorräte aufstellen.</text> + <text id="wyrm1">Hinweise wie man die anderen Strukturen aktiviert könnten wir eventuell mit Hilfe der [item=wyrm]s finden.</text> + <text id="wyrm2">Du solltest einem Wyrm hier auf dieser Insel folgen und ihre Geheimnisse herausfinden, während ich einige dieser Markierungen übersetze.</text> + <text id="wyrm3">Keine Sorge - du hast dich vorher schon mit [item=wyrm]s befasst. Einem davon zu seinem Unterschlupf zu folgen sollte kein Problem sein!</text> + <text id="wyrm4">Wie bitte? Es gab eine Wyrmkönigin? Unwichtig, sieh dir das [item=spirit_gem] an das du gefunden hast! Ich bin mir sicher dies ist genau das was wir für unseren Durchbruch benötigen!</text> + <text id="wyrm5">Hier, probiere diese [item=goggles]. Die Markierungen halfen mir bei der Entwicklung. Mir war sie leider keine Hilfe um die Geheimnisse dieser Strukturen zu lüften, aber vielleicht helfen sie dir das zu sehen was uns zur Lösung noch fehlt.</text> + <text id="sleep">Ich benötige mehr Zeit um dies zu studieren. Warum ruhst du dich nicht in der lilanen Kammer aus?</text> + <text id="forest">Der Wald im Osten scheint gefährlich zu sein. Ich habe [item=fence] aufgestellt und rate dir hinter diesen zu bleiben.</text> + <text id="elementals1">Ich habe herausgefunden das ein [item=spirit_gem] die Kraft von Feuer oder Wasser einfangen kann, dann wird daraus ein [item=fire_gem] oder ein [item=water_gem]. Diese Juwelen sollten uns erlauben die Strukturen aktivieren zu können.</text> + <text id="elementals2">Probleme beim finden von Seelen-Elementaren? Meine [item=goggles] sollte sie sichtbar machen!</text> + <text id="elementals3">Du kannst [item=spirit_gem]e wie Fallen platzieren und Seelen fangen indem du sie über die Falle lockst!</text> + <text id="magic_farm1">Worauf wartest du? Benutze das [item=water_gem] bei der blauen Struktur um diese zu aktivieren!</text> + <text id="magic_farm2">Die blaue Struktur ist ein magischer Synthesizer! Er kann Gegenstände aus Magie erstellen!</text> + <text id="magic_farm3">Benutze [item=focus_gem]e um den Synthesizer mit Energie zu versorgen.</text> + <text id="magic_farm4">Wir brauchen immer noch ein [item=water_gem] um die blaue Struktur mit Energie zu versorgen! Benutze ein [item=spirit_gem] um ein Wasserelementar zu fangen!</text> + <text id="magic_forge1">Worauf wartest du? Benutze das [item=fire_gem] bei der roten Struktur um diese zu aktivieren!</text> + <text id="magic_forge2">Die rote Struktur ist eine uralte magische Schmiede. Sie kann Gegenstände verzaubern!</text> + <text id="magic_forge3">Probiere verschiedene Kombinationen aus Gegenständen und magischen Zutaten in der Schmiede aus - vielleicht stolperst du über etwas brilliantes!</text> + <text id="magic_forge4">Wir brauchen immer noch ein [item=fire_gem] um die rote Struktur mit Energie zu versorgen! Benutze ein [item=spirit_gem] um einen Feuerelemantar zu fangen!</text> + <text id="alter_gem1">Ich war in tiefer Konzentratzion, beim Versuch die Geheimnisse der [item=wyrm]s zu entschlüsseln.</text> + <text id="alter_gem2">Bringe mir [var=quest.alter_gem.wyrm] [item=wyrm], [var=quest.alter_gem.fire_tusk] [item=fire_tusk] und [var=quest.alter_gem.yeti_fur] [item=yeti_fur], so das ich meine Forschung beenden kann.</text> + <text id="alter_gem3">Geschafft! Ich habe ein [item=alter_gem] erschaffen! Dies wird es uns erlauben [item=wyrm]s - und eventuell andere Kreaturen - in nützliche Ausrüstung umzuwandeln!</text> + <text id="alter_gem4">Wir müssen diese Art von Magie weiter erforschen! Nimm dieses [item=alter_gem] und benutze es an einem [item=wyrm]! Wenn du mehr [item=alter_gem]e benötigst, gehe zum Synthesizer - ich habe das Rezept dort hinzugefügt.</text> + <text id="alter_gem5">Um das [item=alter_gem] zu nutzen, wähle es in deinem Inventar aus, klicke auf Transformieren und wähle eine Kreatur aus die du verwandeln willst.</text> + <text id="alter_gem6">Fürchte dich nicht [item=alter_gem]e mit anderen Kreaturen zu kombinieren… wie zum Beispiel einem [item=dragon]. Oder vielleicht auch an einem [item=adult_dragon]n?!</text> + <text id="alter_gem7">Gehen dir die [item=alter_gem]e aus? Du kannst sie tief unter der Erde finden oder welche beim Synthesizer erstellen.</text> + <text id="alter_gem8">Gehe sicher das du [item=alter_gem]e an gut gefütterten Kreaturen nutzt. Hungrige Kreaturen werden nicht lange verwandelt bleiben!</text> + <text id="first1">Du bist nicht mit dem Rest von uns abgestürzt?</text> + <text id="first2">Nein, ich war Teil einer Erkundungsmission für das Kolonisationsprogramm.</text> + <text id="first3">Wir waren zu viert. Aber die anderen drei starben und als sie darauf erschienen sind, wusste ich, dass dieser Planet verflucht sein musste.</text> + <text id="first4">Ich überlebte nur knapp mit dem was ich von der Magie gelernt hatte. Hätte ich damals diese [item=goggles] gehabt, wären die Dinge wohl anders gekommen.</text> + <text id="first5">Sie waren hier?! Nach dir?</text> + <text id="first6">Ja. Ich glaube sie waren eifersüchtig auf meine Magie. Oder hatten Angst davor? Schwer zu sagen...</text> + <text id="second1">Du hast sie vor zehn Jahren auf diesem Planeten getroffen? Das war bevor sie versuchten die Menschheit auszulöschen und die Erde zu zerstören!</text> + <text id="second2">Richtig. Ich war der erste der ihnen begegnete und der Erste den sie versuchten zu töten.</text> + <text id="second3">Ich weiß nicht was ich anders hätte machen können, um den Krieg zu stoppen. Sie kamen plötzlich mit ihren biologischen Waffen und griffen ohne ein Wort an.</text> + <text id="second4">Wenn es nur eine Möglichkeit gäbe, mit ihnen zu kommunizieren...</text> + <text id="second5">Wir können uns jetzt wahrscheinlich mit ihnen verständigen, indem wir meine magische Übersetzung benutzen.</text> + <text id="second6">Aber hoffentlich werden wir ihnen nie wieder begegnen, solange sie zufrieden damit sind uns einfach zu ignorieren.</text> + <text id="oldone1">Ich habe in letzter Zeit magische Energiespitzen bemerkt. Es muss nichts bedeuten, aber es könnte einer von ihnen sein.</text> + <text id="oldone2">Wenn du die magischen Energiespitzen aufgespürt hast, rufe mich unverzüglich herbei. Wenn es wirklich einer von ihnen ist, sind wir alle in großer Gefahr.</text> + <text id="oldone3">Ok, mal sehen ob meine Übersetzung funktioniert!</text> + <text id="oldone4">Wer bist du und was machst du hier?</text> + <text id="oldone5">Wer gibt dir das Recht mich dies zu fragen? Das ist mein Zuhause, mein Planet! Ihr seid die Eindringlinge hier!</text> + <text id="oldone6">Dieses magische Exoskelett kommt mir irgendwie bekannt vor... bist du einer von ihnen?</text> + <text id="oldone7">Die, die du "Ihnen" nennst, sind meine törichten Brüder. Vor langer Zeit beschlossen sie ihre Heimatwelt zu verlassen, während ich blieb und einen Weg der Isolation und Unsterblichkeit nahm.</text> + <text id="oldone8">Kannst du uns etwas über eure Magie erzählen? Was sind diese magischen Energiespitzen? Warum hast du die Drachen erschaffen und aufgezogen?</text> + <text id="oldone9">Schweig! Wir reden nicht über solche Dinge mit euch! Ich war bis jetzt sehr tolerant, sonst wärst du schon längst tot.</text> + <text id="oldone10">Aber jetzt sehe ich, dass sie in einer Sache recht hatten. Ohne dich und deine Art wäre das Universum besser dran!</text> + <text id="oldone11">Du wirst es bereuen mich gestört zu haben!</text> + <text id="oldone12">Nein!</text> + <text id="oldone13">Was ist los, haben wir nicht gewonnen?</text> + <text id="oldone14">Wir waren zu langsam! Es hat ein Signal ausgesendet. Sie werden wissen das wir auf diesem Planeten sind!</text> + <text id="oldone15">Wir müssen all die Magie erlernen so gut wir nur können - und ihre Kraft gegen sie verwenden wenn sie kommen! Andernfalls sind wir alle verloren.</text> + <text id="oldone16">Du benutzt deine Magie besser als erwartet! Dies darf nicht sein, nur wir sollten diese Magie beherrschen.</text> + <text id="oldone17">Es sendet ein Signal! Wenn sie es hören, werden sie kommen! Ich muss dies hier rasch beenden!</text> + <text id="oldone18">Was ist passiert? Geht es dir gut?</text> + <text id="oldone19">Nein…[pause=4] Das Signal wurde gesendet…[pause=4] Und mein Lebenswille wurde komplett ausgesaugt…</text> + <text id="oldone20">Jetzt liegt es an dir…[pause=4] Beeil dich!…[pause=4] Finde die Antworten… Benutze deren Magie…</text> + <text id="oldone_tips1">Ich werde eine Verteidigungsbarriere und Heilzauber beschwören. Bleib hinter mir wenn es angreift und attackiere es wenn es sich überlädt.</text> + <text id="oldone_attack">Greif es jetzt an!</text> + <text id="oldone_beam">Ich verspüre eine starke magische Energiespitze! Ich denke nicht das meine Barriere diese Attacke aushalten wird!</text> + <text id="return1">Was machst du hier?!</text> + <text id="return2">Ich benutze das Labor um Proben von der östlichen Insel zu analysieren.</text> + <text id="return3">Ich meinte... wie hast du es so schnell hierher zurück geschafft?</text> + <text id="return4">So wie sonst auch! Ich teleportiere! Was sonst?! Nun hör auf mich zu stören, ich muss meine Analysen vollenden.</text> + <text id="muttering">Edelsteinsynthese... verschachtelter Panzer... Evolution auf unbestimmte Zeit... [font=drachenklaue]Hokuspokus[/font]...</text> + <text id="oldone_choice">Du bist keine Herausforderung für diese Kreatur. Wir brauchen einen Plan wenn wir überleben wollen!</text> + <text id="work_together">Zusammenarbeiten</text> + <text id="alchemist_fight">Alchemist kämpfen lassen</text> + <text id="battle">Zurücktreten! Dieser Kampf ist nichts für Unerfahrene!</text> + </section> + <section id="player"> + <text id="storm1">Der Sturm wird stärker. Ich brauche einen Unterschlupf, aber hier gibt es nur Äste!</text> + <text id="storm2">Ich muss versuchen, eine [color=770000]Hütte[/color] zu bauen. [var=quest.hut.wood] [item=wood] sollten genügen.</text> + <text id="storm3">So müde... kann kaum all das [item=wood] tragen. Nur noch ein bisschen und ich kann in der [color=770000]Hütte[/color] ausruhen.</text> + <text id="storehouse1">Diese Axt könnte nützlich sein. Mit ihr könnte ich vermutlich ein [color=770000]Lager[/color] bauen, um Rohstoffe zu lagern.</text> + <text id="storehouse2">Ich wette, ich könnte ein Lager mit [var=quest.storehouse.wood] [item=wood] und [var=quest.storehouse.berries] [item=berries] bauen.</text> + <text id="storehouse3">Alles klar! Lass uns das Lager bauen!</text> + <text id="storehouse4">Perfekt. Jetzt kann ich vermeiden, dass ich vom vielen Schleppen müde werde.</text> + <text id="dock1">Ich frage mich, ob der Dieb die Wahrheit gesagt hat und es tatsächlich andere Überlebende gibt?</text> + <text id="dock2">Vielleicht sollte ich ein [color=770000]Dock[/color] bauen und mich auf die Suche nach ihnen machen. Dazu brauche ich [var=quest.dock2.wood] [item=wood] und [var=quest.dock2.steel_bar] [item=steel_bar].</text> + <text id="dock3">Alles klar, lass uns das [color=770000]Dock[/color] bauen!</text> + <text id="market1">Wenn ich einen [color=770000]Markt[/color] baue, könnte ich vielleicht Händler anlocken. Dazu brauche ich [var=quest.market2.gold_bar] [item=gold_bar].</text> + <text id="market2">Das wäre alles, was ich für den [color=770000]Markt[/color] brauche!</text> + <text id="market3">Es gibt tatsächlich Händler da draußen! Sie gaben mir sogar einen [item=coin_purse], um Münzen darin aufzubewahren.</text> + <text id="market4">Jetzt müssen wir nur noch ein [item=boat] im [color=770000]Bootshaus[/color] bauen!</text> + <text id="farewell1">Ich weiß nicht was dort draußen ist, aber ich werde es herausfinden bevor ich zurückkomme.</text> + <text id="farewell2">Bring ein paar leckere Sachen zum essen mit!</text> + <text id="farewell3">Vergiss nicht auch unter der Oberfläche zu erkunden, man weiß nie was man entdeckt.</text> + <text id="farewell4">Lass uns hier nicht hängen - komm bald zurück.</text> + <text id="farewell5">Halte dich von Gefahren fern.</text> + <text id="farewell6">Es ist eine gefährliche Welt da draußen.</text> + <text id="farewell7">Du gehst in die falsche Richtung, die Geheimnisse liegen alle im Osten!</text> + <text id="bandits1">Es ist großartig wieder im Geschäft zu sein! Wenn wir nur diese diebischen Banditen loswerden könnten!</text> + <text id="bandits2">Du scheinst stark zu sein. Denkst du, du könntest sie für uns vertreiben?</text> + <text id="bandits3">Du hast die Banditen geschlagen! Bitte nimm dieses Geschenk als Zeichen unserer Wertschätzung.</text> + <text id="bandits4">Heute ist unser Glückstag - unsere Beute lief direkt zu uns! Die Dinge laufen gut seitdem wir von diesen Mirrows und ihren fiesen Experimenten entkommen sind!</text> + <text id="ore_cave">Dieser Ort fühlt sich merkwürdig an, als hätte ich eine andere Dimension betreten. Ich hab so ein Gefühl, dass sich dieser Ort jedesmal verändert wenn ich ihn betrete.</text> + <text id="no_coin_purse">Du benötigst einen [item=coin_purse] wenn du mit uns handeln willst. Wir können dir einen für [var=recipe.sci1_coin_purse.sulfur] [item=sulfur] geben.</text> + <text id="make_coin_purse">Möchtest du [var=recipe.sci1_coin_purse.sulfur] [item=sulfur] für einen [item=coin_purse] eintauschen?</text> + <text id="lurker">Hey Kumpel, interesse an ein paar Raritäten? Die kannst du nur hier kaufen!</text> + <text id="lurker_empty">Danke für's Geschäft. Keine Rückerstattungen.</text> + </section> + <section id="hunter"> + <text id="tent1">Ich sollte nicht in einem fremden Zelt ausruhen!</text> + <text id="tent2">Das muss das Zelt des [color=770000][tile=hunter] Jäger[/color]s sein. Ich sollte es in Ruhe lassen.</text> + <text id="intro1">Hey, du! Hast du gesehen, wie ich dieses Wildschwein erlegt habe?</text> + <text id="intro2">Ja, wie… wie hast du das gemacht?</text> + <text id="intro3">Ganz einfach! Du brauchst nur die richtige Technik.</text> + <text id="intro4">Ich versuche dieses Gebiet zu säubern. Wenn du mir hilfst, könnte ich dir das Jagen beibringen.</text> + <text id="accept1">Du musst das Überraschungsmoment nutzen. Greife deine Feinde von hinten an und du wirst einen kritischen Treffer landen.</text> + <text id="accept2">Der [item=bow] ist die Waffe meiner Wahl. Hier, nimm meine [item=workbench] - damit kannst du einen [item=bow] und ein paar [item=arrow]e herstellen.</text> + <text id="accept3">Nutze [key=equipment], um eine Waffe anzulegen und [key=attack], um mit der angelegten Waffe anzugreifen.</text> + <text id="accept4">Warum stellst du nicht einen [item=bow] her und erlegst ein paar [color=770000][tile=boar] Wildschweine[/color]. Und lass mich wissen, wenn du Tipps beim Jagen brauchst!</text> + <text id="reject1">Du wirkst gefährlich. Halte dich von unserem Gebiet fern!</text> + <text id="reject2">Na schön! Dann gehe ich eben zurück in die Berge!</text> + <text id="reject3">Bereit ein paar Jagdtechniken zu erlernen?</text> + <text id="hunt1">Wir werden dieses Gebiet im Nu von gefährlichen Kreaturen gesäubert haben!</text> + <text id="hunt2">Im Austausch für das [item=meat] gebe ich dir meinen alten [item=backpack] - er wird dir da draußen gute Dienste leisten.</text> + <text id="tip1">Du könntest einen Tunnel graben, um dich an Wildschweine anzupirschen und sie von hinten anzugreifen.</text> + <text id="tip2">Du kannst [item=red_berries] nutzen, um deinen Angriff vorübergehend zu erhöhen - aber sei vorsichtig, sie sind nicht gut für deine Gesundheit.</text> + <text id="tip3">Wenn deine Angriffe immer wieder “geblockt” werden, ist der Feind zu stark. Dann brauchst du eine bessere Waffe oder mehr Angriffskraft.</text> + <text id="tent3">Da war ich nun, schlotternd und allein auf dem dunklen Berghang, als ich Feuerschein erblickte! Und Lachen vernahm! Es klang so einladend...</text> + <text id="tent4">Also kamst du herunter, um dich mit uns anzufreunden?</text> + <text id="tent5">Natürlich nicht. Und ich habe die Wildschweine sicher nicht gejagt, um dich zu beeindrucken. Ganz und gar nicht.</text> + <text id="tent6">Ich wollte lediglich mein Jagdgebiet erweitern.</text> + <text id="tent7">Ich möchte mehr über diesen Ort erfahren und ob es etwas jenseits dieser Insel gibt…</text> + <text id="tent8">Es gibt andere Inseln da draußen im Osten. Ich habe sie von den Bergen aus gesehen.</text> + <text id="tent9">Denkst du, wir könnten sie erreichen?</text> + <text id="tent10">Da bin ich mir nicht so sicher. Die Küste auf dieser Seite ist tückisch. Außerdem sahen mir diese Inseln ziemlich merkwürdig aus. Sie könnten gefährlich sein.</text> + <text id="tent11">Du denkst also, wir sollten uns mit dem hier zufrieden geben?</text> + <text id="tent12">Ich denke, wir sollten es uns nicht schwerer machen als es ohnehin schon ist.</text> + <text id="fence1">Ich möchte die Fauna in dieser Gegend im Zaum halten.</text> + <text id="fence2">Könntest du die [item=workbench] nutzen, die ich dir gegeben habe, um [var=quest.fence.fence] [item=fence] herzustellen? Damit könnten wir eine Begrenzung errichten.</text> + <text id="fence3">Sehr schön. [color=770000][tile=boar] Wildschweine[/color] kommen nicht durch die [item=fence], so können wir unsere Siedlung schützen.</text> + <text id="fence4">Ich werde einen hier platzieren, platziere die anderen [item=fence] um unsere Basis herum, um sie zu schützen!</text> + <text id="wolf1">Ich habe einen jungen Wolf in der Nähe unserer Siedlung entdeckt. Er scheint einsam zu sein.</text> + <text id="wolf2">Hat er denn kein Rudel?</text> + <text id="wolf3">Sie müssen ihn zurückgelassen haben.</text> + <text id="wolf4">Mit [var=quest.wolf.net] [item=net]en, [var=quest.wolf.trap] [item=trap]n und [var=quest.wolf.meat] [item=meat], könnten wir ihn vielleicht zähmen.</text> + <text id="wolf5">Gut, mal sehen, was wir mit dem jungen Wolf anfangen können.</text> + <text id="wolf6">Gut gemacht, er scheint dir vollkommen zu vertrauen. Jetzt hast du einen treuen Begleiter.</text> + <text id="wolf7">Der [item=wolf] wird dir folgen, wenn du ihn als [color=770000]Vertrauter[/color] im Menü deiner [color=770000]Ausrüstung[/color] wählst.</text> + </section> + <section id="mechanic"> + <text id="introduce1">Es wurde komplett zerstört. Das ist schrecklich!</text> + <text id="introduce2">Was ist passiert?</text> + <text id="introduce3">Die Mirrows haben versucht die Energie neu umzuleiten und fast das ganze Ding gesprengt!</text> + <text id="introduce4">Und erwarten jetzt sogar das wir nach ihren gescheiterten Experimenten aufräumen… pah!</text> + <text id="introduce5">Ich habe nicht einmal mehr etwas [item=titanium] übrig, also gibt es keinen Weg das Kraftwerk zu reparieren...</text> + <text id="powerplant1">Wow, hätte nicht erwartet das du wirklich mit [item=titanium] zurück kommst.</text> + <text id="powerplant2">Danke - jetzt kann ich dies in Null Komma nichts reparieren.</text> + <text id="powerplant3">Wir sind wieder im Geschäft! Wir können [item=coal] oder [item=refined_oil] nutzen um Energie zu erzeugen. Du kannst hier auch [item=battery]n herstellen.</text> + <text id="powerplant4">Oh und nimm dieses Altmetall das übrig blieb als Dankeschön für das [item=titanium]!</text> + <text id="powerplant5">Ich werde nie mehr [item=titanium] finden - es ist hoffnungslos!</text> + <text id="battery">Lass es mich wissen wenn du eine [item=battery] hergestellt hast, dann können wir cooles Zeug mit dieser mobilen Energiequelle erschaffen!</text> + <text id="tip1">Benutze [item=sulfur] und einen [item=steel_bar] um eine [item=battery] beim [color=770000]Kraftwerk[/color] zu erstellen. Du kannst sie dort auch wieder aufladen.</text> + <text id="tip2">Füge eine [item=battery] deinem Inventar hinzu um deine Ausrüstung mit Energie zu versorgen.</text> + <text id="tip3">Deine gesamte [tile=power] [color=444400]Energie[/color] wird dir unter deinem [tile=health] [color=770000]Leben[/color] und deiner [tile=stamina] [color=006600]Ausdauer[/color] angezeigt.</text> + <text id="factory1">Jetzt da wir wieder Energie haben, wünschte ich das wir Maschinen zum testen hätten.</text> + <text id="factory2">Wenn du mir hilfst eine [color=770000]Fabrik[/color] zu bauen könnten wir allerlei Dinge herstellen!</text> + <text id="factory3">Das wird grandios! Endlich ein neues Projekt um herumzutüfteln!</text> + <text id="factory4">Jetzt können wir Materialien verfeinern und [item=drill], [item=chainsaw]n, [item=shotgun]n und anderes cooles Zeug bauen.</text> + <text id="elevator1">Ich habe bemerkt das du sehr viel Erze abbaust.</text> + <text id="elevator2">Wäre es nicht praktisch einen Apparat zu haben, der dir hilft, alles wieder an die Oberfläche zu bringen?!</text> + <text id="elevator3">Sauber! Legen wir los!</text> + <text id="elevator4">Nach oben? Oder sollte ich nach unten sagen?!</text> + <text id="repair">Muss irgendetwas repariert werden? Dann komm zu mir!</text> + <text id="dragon">Was ist das für eine feuerspuckende Kreatur die das Kraftwert antreibt? Es macht besser nichts kaputt!</text> + <text id="intro1">Hier gibt es mehr Überlebende als ich je vermutet hätte!</text> + <text id="intro2">Wirklich? Aber nicht genügend. Wenn wir als Spezies überleben wollen müssen wir uns mit anderen Kolonien vereinen.</text> + <text id="intro3">Du denkst andere haben es ebenfalls geschafft und sind irgendwo da draußen?</text> + <text id="intro4">Ich bin mir sicher das sie da draußen sind. Wir müssen nur einen Weg finden sie zu kontaktieren.</text> + <text id="intro5">Und wenn sie uns angreifen?</text> + <text id="intro6">Dann haben wir es immerhin versucht! Ich werde nicht auf diesem Planeten versauern, nur weil es sich hier im Moment sicher anfühlt.</text> + <text id="mirrows1">Hey, was ist los? Du siehst traurig aus.</text> + <text id="mirrows2">Ich habe versucht die Mirrows zu überzeugen endlich aufzuhören, jeden zu belästigen, aber sie hören nicht zu und ich will nicht gegen sie kämpfen.</text> + <text id="mirrows3">Gut das du es versucht hast. Aber sie sind stur wie Esel und reagieren auf nichts außer auf Macht.</text> + <text id="mirrows4">Ich gebe noch nicht auf. Es ist nicht fair, dass sie ihre Macht so missbrauchen.</text> + <text id="mirrows5">Vielleicht versuchst du so viel wie möglich über die Mirrows zu erfahren. Hast du alle Bereiche um ihr Labor ausgekundet?</text> + <text id="mirrows6">Bist du das "C" in den Labornotizen der Mirrows? Hast du mit ihnen gearbeitet?</text> + <text id="mirrows7">Nein... nicht genau. Sie sind - [Pause = 4]Sie sind meine Eltern.</text> + <text id="mirrows8">Deine Eltern!? Wenn du ihre Tochter bist werden sie dir vielleicht zuhören. Wirst du versuchen mit ihnen zu verhandeln?</text> + <text id="mirrows9">Glaub mir, ich habe es versucht. Sie reagieren nicht auf Vernunft. Sie sind zu sehr auf ihre "Verbesserungen" konzentriert und werden keine andere Lösungen für unsere Probleme in Betracht ziehen.</text> + <text id="mirrows10">Wir werden etwas wirklich spezielles brauchen, um sie dazu zu bringen ihre Meinung zu ändern.</text> + <text id="mirrows11">Was denkst du über diese [item=dragon_armor]? Sie hat die Kraft eines [item=adult_dragon]n, kann aber wie eine Rüstung getragen werden!</text> + <text id="mirrows12">Das ist merkwürdig, aber ich denke definitiv dass es einen Versuch wert ist. Zeigen wir es meinen Eltern.</text> + <text id="mirrows13">Schon zurück? Dieses Mal werden wir dich in einen Cyborg verwandeln, garantiert!</text> + <text id="mirrows14">Wartet! Greift nicht an - ich bin es.</text> + <text id="mirrows15">Cass? Was machst du hier?</text> + <text id="mirrows16">Ich möchte, dass ihr euch das anschaut. Vielleicht müsst ihr die Leute doch nicht zu Cyborgs machen.</text> + <text id="mirrows17">Was ist das? Die Leistungswerte liegen außerhalb des messbaren Bereichs, aber es scheint nicht von Menschenhand gemacht!</text> + <text id="mirrows18">Wenn ich es euch sage, hört ihr dann auf die Menschen auszubeuten und Experimente an ihnen durchzuführen?</text> + <text id="mirrows19">Natürlich! Dies würde unsere Forschungen in andere Richtungen bringen!</text> + <text id="mirrows20">Es stellte sich heraus, dass die Spezies die ursprünglich diesen Planeten bewohnte, Drachen und magische Ausrüstung erschuf. Und diese Spezies könnten - die Alten - gewesen sein.</text> + <text id="mirrows21">Wir werden ihre eigenen Kreationen gegen sie verwenden! Was für eine köstliche Ironie!</text> + </section> + <section id="innkeeper"> + <text id="intro1">Willkommen im Goldenen Schlüssel! Das Beste (und einzige) Gasthaus auf dieser Seite der Insel!</text> + <text id="intro2">Dies ist also ein Gasthaus? Kommen hier viele Leute vorbei? </text> + <text id="intro3">Ein paar schon hier in Sunset Haven - erkunden, handeln, einfach ein Platz den sie Zuhause nennen können.</text> + <text id="intro4">Wenn wir nicht bald wieder Energie bekommen wird kaum jemand bleiben. Ich kann dir nicht sagen wie oft ich schon kurz davor war diesen Mirrows mal meine Meinung zu sagen!</text> + <text id="power1">Wunderbar! Die Energie ist zurück!</text> + <text id="power2">Das haben wir sicher nicht diesen verdammten Mirrows zu verdanken. Ich fasse es nicht das wir ihnen immer noch Schulden abbezahlen damit sie die Technologie hier am laufen halten!</text> + <text id="power3">Nicht nur das sie das Kraftwerk immer wieder zerstören - nein - sie haben nicht einmal die Zeit um es dann wenigstens zu reparieren?!</text> + <text id="power4">Und wenn ihr einfach aufhört sie zu bezahlen?</text> + <text id="power5">Ich kann das Gasthaus nicht alleine lassen, aber wenn jemand in die Wüste gehen und sie konfrontieren würde... vielleicht könnten wir so aus dieser Situation kommen.</text> + <text id="no_power">Ich fürchte wir können dich hier nicht übernachten lassen, bis die Energie wieder zurück ist.</text> + <text id="visit">Möchtest du die Nacht hier verbringen? Nur 50 [color=770000][tile=coin_purse.ico] Münzen[/color] und es gibt eine warme Mahlzeit dazu!</text> + <text id="no_money">Nicht genügend Geld? Dann tut es mir leid. Ich bin keine Wohlfahrt, weißt du!</text> + <text id="scene1">Ich hörte das Mutterschiff stürzte hier ab? Wie habt ihr ohne Rettungskapseln überlebt?</text> + <text id="scene2">Das ist exakt unser Problem. Die Mirrows retteten uns. Sie haben unglaubliche Verbesserungen in letzter Minute vorgenommen und einen ganzen Sektor vor der Vernichtung geschützt. Also stehen wir in ihrer Schuld.</text> + <text id="scene3">Aber jetzt zerstören sie unsere Energie und lassen seltsame Kreaturen frei die Zerstörung anrichten.</text> + <text id="scene4">Ich habe sogar gehört, dass einige Leute in der Wüste verschwunden sind, wo die Mirrows zuletzt gesehen wurden.</text> + <text id="scene5">Und sie erwarten dass wir uns all dies gefallen lassen? Und ihnen auch noch etwas zahlen? Es ist zu viel geworden.</text> + <text id="mirrows1">Die Mirrows werden dich nicht mehr nach Geld fragen und werden die Versuche an Menschen stoppen!</text> + <text id="mirrows2">Exzellent! Vielleicht können wir jetzt endlich Frieden hier finden.</text> + <text id="mirrows3">Hier, nimm dies als Zeichen meiner Dankbarkeit.</text> + <text id="mirrows4">... [item=coal]?</text> + <text id="mirrows5">Was? Ich betreibe hier doch keine Wohlfahrt!</text> + </section> + <section id="fisherman"> + <text id="intro1">Endlich wieder an Land! Sieht aus als wärst du auch gerade angekommen!</text> + <text id="intro1_alt">Oh hallo! Es ist schön andere Überlebende hier zu treffen!</text> + <text id="intro2">Einfach nicht beachten, das ist nur Pollys Art Hallo zu sagen. Hoffe dir macht ein wenig Seewasser auf deinen Stiefeln nichts aus!</text> + <text id="intro3">Also warst du schon mal auf dieser Insel?</text> + <text id="intro3_alt">Also, weißt du welche Inseln vor uns liegen?</text> + <text id="intro4">Natürlich, diese Insel wird Sunset Haven genannt und sie hat mehr Überlebende als alle anderen Inseln die ich sah.</text> + <text id="intro4_alt">Klar, diese Insel wird Sunset Haven genannt und sie hat mehr Überlebende als alle anderen Inseln die ich sah.</text> + <text id="intro5">Macht auch Sinn - hier stürzte das Mutterschiff ab.</text> + <text id="intro6">Aber gib auf dich Acht. Ich habe in letzter Zeit einige schlechte Gerüchte über Sunset Haven gehört...</text> + <text id="cat1">Hey, meine [item=cat] Peri ist mir entflohen! Kannst du mir helfen sie zu finden?</text> + <text id="cat2">Ich denke sie versucht dem Segeln zu entgehen. Sie ist kein großer Fan von Wasser.</text> + <text id="cat3">Wenn du mir hilfst, bringe ich dir alles bei was ich über das fischen weiß.</text> + <text id="cat4">Großartig, danke! Hier hast du eine [item=fishing_rod], sprich mit mir wenn du Tipps benötigst!</text> + <text id="cat5">[item=toothfish] ist Peris Lieblingsfutter, vielleicht kannst du sie damit anlocken?</text> + <text id="cat6">Hey, du hast meine [item=cat] gefunden! Danke dir.</text> + <text id="cat7">Sheesh, sieht so aus als hättest du Eindruck hinterlassen. Ich denke sie ist mit dir glücklicher. Wieso behältst du sie nicht einfach?</text> + <text id="cat8">Die Katze ist zu schnell für dich um sie einfach so zu greifen!</text> + <text id="cat9">Sie hat den [item=toothfish] aus meiner Hand geschnappt, aber sie ist zu schnell, ich kann sie nicht fangen.</text> + <text id="cat11">Peri einen [item=toothfish] anbieten?</text> + <text id="cat12">Sie ist diesmal nicht so schnell weggerannt.</text> + <text id="cat13">Komm her Peri... gutes Mädchen...</text> + <text id="cat15">Eine Katze erfolgreich gefangen!</text> + <text id="tip1">Beim Angeln geht es ums Timing. Benutze deine Angelrute am Ende des Docks und drücke [key=select] wenn etwas an der Schnur zieht - ziehst du zu früh oder zu spät, dann wird der Fisch dir entkommen!</text> + <text id="tip2">Wenn "Warte..." erscheint, braucht der Fisch noch etwas bis er angebissen hat. Warte bis "Zieh!" erscheint, dann drücke [key=select] erneut!</text> + <text id="tip3">Einige Fische sind schwerer zu fangen als andere. Behalte ein Auge auf den Hinweisen die erscheinen und drücke die Taste die angezeigt wird!</text> + <text id="scene1">Ich? Das ist alles was ich brauche - ein Dach über meinem Kopf, Sonnenschein und das Meer um fischen zu können.</text> + <text id="scene2">Und du? Was ist dein Traum?</text> + <text id="scene3">Ich würde wirklich gern wissen ob es eine Möglichkeit gibt diesen Planeten zu verlassen.</text> + <text id="scene4">Was, warum!? Hast du einen Todeswunsch? Diese Dinger kennen keine Gnade.</text> + <text id="scene5">Ich will mehr über sie wissen… und warum Dinge passierten wie sie passierten...</text> + <text id="scene6">Hör zu Kumpel, ich sah einen davon als wir von der Erde starteten. Alles was du wissen musst ist, wie du ihnen aus dem Weg gehst.</text> + </section> + <section id="mirrows"> + <text id="intro1">Seid ihr zwei die Mirrows? Warum quält ihr Sunset Haven und habt diese seltsamen Mutanten erschaffen?</text> + <text id="intro2">Du verstehst das nicht! Wir tun das zum Wohle aller! Wir können nicht ohne ultimative Waffen überleben!</text> + <text id="intro3">Wenn sie kommen um den letzten von uns auszurotten, werden wir bereit sein! Die Opfer waren notwendig.</text> + <text id="intro4">Ihr könnt nicht einfach herumgehen und Menschen für eine Zukunft opfern, die vielleicht niemals kommen wird! Es gibt bessere Wege um alle zu retten!</text> + <text id="intro5">Wenn du gekomen bist nur um gegen uns zu arbeiten, haben wir keine andere Wahl als dich zu bekämpfen.</text> + <text id="intro6">Ich habe das Gefühl, dass dein Körper genau das ist was ich für meine neue Cyborg-Erfindung brauche!</text> + <text id="defeat0">Unglaublich! Irgendwie bist du stärker als ich, trotz unserer fortgeschrittenen Kybernetik!</text> + <text id="defeat1">Du musst uns die Geheimnisse deiner Stärke verraten - du könntest der Schlüssel zur Rettung der Menschheit sein!</text> + <text id="defeat2">Wenn ich euch meine Geheimnisse erzähle, werdet ihr dann aufhören die Bewohner zu belästigen und sie um Geld zu bitten?</text> + <text id="defeat3">Natürlich. Wozu brauchen wir diese hohlen Exemplare wenn wir dich haben!?</text> + <text id="defeat4">Dies wird unsere Forschungen in ganz andere Richtungen lenken!</text> + <text id="defeat5">Fühle dich frei unser chirurgisches Cyborglabor zu benutzen. Wir wären sehr interessiert wie mächtig du mit unseren kybernetischen Verbesserungen wirst!</text> + <text id="tip1">Du kannst cybernetische Erweiterungen nur im chirurgischem Labor entfernen. Wähle den Platz aus den du entfernen möchtest, dann klicke 'Nichts' an. Du kannst Erweiterungen später wieder anbringen, aber es wird dich mehr Ressourcen kosten.</text> + <text id="nav1">Sieht so aus als würde das Navigationssystem noch funktionieren. Demzufolge befinden wir uns derzeit auf Unoiks 428e.</text> + <text id="nav2">Haben die Mirrows diese Notiz hinzugefügt?! Ich muss sie unbedingt fragen...</text> + <text id="nav3">Wir befinden uns auf dem Heimatplaneten des Feindes? Woher wisst ihr das?</text> + <text id="nav4">Wir sind nicht ganz so sicher.. aber wir nahmen Proben von vielen Ruinen auf diesem Planeten. Nicht nur das es viele Übereinstimmungen mit deren Technologie gibt, die Ruinen sind ebenfalls mehrere Millionen Jahre alt!</text> + <text id="nav5">Aber jetzt sind sie weg?</text> + <text id="nav6">Wir haben sie bisher nicht auf diesem Planeten entdeckt, aber selbst wenn sie diesen verlassen haben werden sie eventuell irgendwann zurückkommen.</text> + <text id="nav7">Deshalb waren wir bereit alles für Stärke und Macht zu opfern... Seit dem Tag, an dem wir auf diesem Planeten gelandet sind, waren wir uns bewusst das eine Konfrontation mit ihnen unvermeidlich ist.</text> + </section> + <section id="scene.hut"> + <text id="first1">Nicht schlecht für meinen ersten Unterschlupf.</text> + <text id="first2">Hilfe…[pause=4] bitte…[pause=4] Schutz…</text> + <text id="first3">Jemand ist da draußen! Ob ich ihm trauen kann?</text> + <text id="first4">Vielen Dank. Ich schulde dir mein Leben. Aber was machen wir jetzt?</text> + <text id="first5">Fürs Erste wärmen wir uns auf und bleiben trocken.</text> + <text id="first6">Aber danach? Wie überleben wir auf dieser verlassenen Insel?</text> + <text id="first7">Hat das überhaupt Sinn? Wir sitzen hier fest, es gibt kein Zurück.</text> + <text id="first8">Wir können es wenigstens versuchen. Vielleicht lebt es sich hier gar nicht so schlecht.</text> + <text id="first9">Bitte…[pause=4] Hilfe…</text> + <text id="second1">… als ich hier ankam, fing ich einfach an zu graben und da hab ich den Sturm gar nicht bemerkt.</text> + <text id="second2">Aber ich bin froh, dass du hier bist. Ich hab es satt, Dreck zu essen und nach einem langen Tag unter der Erde gibt es nichts Besseres als ein warmes Feuer.</text> + <text id="second3">Denkst du, es gibt mehr Überlebende da draußen?</text> + <text id="second4">Ich bin überrascht, dass überhaupt jemand diesen Absturz überlebt hat. Aber hier sind wir, also haben vielleicht auch andere überlebt?</text> + <text id="third1">Ich wette, ihr jungen Leute denkt, dies sei das Ende der Welt, aber ich dachte das Gleiche während des dritten Weltkriegs und doch sind wir alle hier.</text> + <text id="third2">So wie ich das seh, müssen wir einfach das Beste aus der Situation machen und froh sein, dass wir etwas zu essen und einander haben.</text> + <text id="third3">Aber wie lange werden wir auf dieser gottverlassenen Insel leben müssen?</text> + <text id="third4">Wer weiß das schon? Aber solange es Leben gibt, gibt es Hoffnung. Vielleicht wird diese Insel mit der Zeit ein neues Zuhause.</text> + <text id="fourth1">Erzähl uns, was weißt du über andere Überlebende?</text> + <text id="fourth2">Die meisten von uns wurden über verschiedene Inseln verstreut, aber auf manchen Inseln gibt es mehr Überlebende und sogar funktionierende Technologie.</text> + <text id="fourth3">Ich habe sogar Gerüchte von einer Insel mit einem fast intakten Schiff gehört.</text> + <text id="fourth4">Könnte es noch flugfähig sein?</text> + <text id="fourth5">Wie ich schon sagte, alles was ich gehört habe, sind Gerüchte. Aber selbst wenn, wäre es der sichere Tod. Wir bleiben besser auf diesem Planeten, sie scheinen sich hier nicht um uns zu kümmern.</text> + <text id="hunter1">Du beherrschst dein Handwerk. Warst du vor dem Absturz ein Jäger?</text> + <text id="hunter2">Heh. Ich habe noch nie zuvor in meinem Leben ein Tier getötet. Ich war ein Wissenschaftler. Laborarbeit. Moleküle.</text> + <text id="hunter3">Wow. Wie hast du dir dann all diese Jagdtechniken angeeignet?</text> + <text id="hunter4">Es ist erstaunlich, wozu man in der Lage ist, wenn man überleben muss.</text> + <text id="hunter5">Du veränderst dich. Du wirst zu jemand, den dein altes Ich kaum wiedererkennt.</text> + <text id="mirrows1">Sie haben ihre Technologie neu aufgebaut?</text> + <text id="mirrows2">Ja. Sunset Haven hat Energieversorgung und industrielle Ausrüstung.</text> + <text id="mirrows3">Aber die Bewohner verstehen sich nicht sonderlich gut mit den Mirrows die alles aufgebaut haben.</text> + <text id="mirrows4">Die Mirrows haben überlebt!?</text> + <text id="mirrows5">Du kennst sie??</text> + <text id="mirrows6">Unglücklicherweiße. Wir waren in der selben Forschertruppe, haben Genetik zusammen studiert.</text> + <text id="mirrows7">Nach dem Angriff, begannen sie mit schrecklichen Dingen, Menschliche Experimente zum Beispiel. Somit konnte ich nicht länger mit ihnen zusammenarbeiten.</text> + <text id="mirrows8">Hey, wir sollten hier auch Technologie errichten! Wenn die das können, warum dann nicht auch wir?</text> + <text id="mirrows9">Das ist die richtige Einstellung! Dieser Ort wird sich bald wie Zuhause anfühlen.</text> + </section> + <section id="medicom"> + <text id="panel1">15.03. - Uns blieb keine andere Wahl, wir mussten die Erde verlassen. Unsere Waffen können ihnen nichts antun und sie verfolgen uns mit aller Macht. Vielleicht können wir uns auf einem anderen Planeten endlich ihrem Zorn entziehen.</text> + <text id="panel13">01.05. - Das Schiff wurde bei der Flucht stark beschädigt, aber der Sprungantrieb wurde erfolgreich aktiviert. Das sollte uns etwas Abstand zu unseren Verfolgern ermöglichen, vorausgesetzt das Schiff übersteht die Reise.</text> + <text id="panel2">30.06. - Ausarbeitung eines neuen Plans für die menschliche Augmentation und Überlebensfähigkeit, einschließlich Anzahl und Art der Proben, die zur Erreichung unserer Ziele notwendig sind. Herr H. hat die Forschungsgruppe verlassen.</text> + <text id="panel3">05.08. - Zielplanet erreicht, können aber nicht sicher in die Atmosphäre gelangen und es gibt nicht genügend Überlebenskapseln. Überlebenswahrscheinlichkeit niedrig, auch für augmentierte Probanden. Keine Spur des Feindes.</text> + <text id="panel4">02.09. - Reparaturen an der Schiffshülle (Verstärkungen anbringen) gehen voran, aber um zu überleben ist eine Augmentation unerlässlich. Dissidenten protestieren gegen das Verfahren, obwohl ihr Leben davon abhängt.</text> + <text id="panel5">26.09. - Können die Umlaufbahn nicht mehr länger halten. Viele haben die Augmentierung akzeptiert, die die dagegen waren wurden in die Überlebenskapseln verfrachtet und losgesandt. Hoffentlich reicht die Hüllenverstärkung für den Rest aus.</text> + <text id="panel6">04.10. - Die Notverstärkung war größtenteils erfolgreich, aber die geschätzte Anzahl der Überlebenden ist viel niedriger als erhofft, selbst unter Berücksichtigung der Überlebenskapseln, die wir aufgrund von diversen technischen Fehlern nicht in unseren Berechnungen berücksichtigen konnten.</text> + <text id="panel7">05.10 - Das Überleben der Spezies ist jetzt ein wichtiges Anliegen. Mit nur ein paar hundert Individuen können wir ohne drastische Eingriffe nicht überleben. Beginn einer neuen Forschungslinie gestartet.</text> + <text id="panel8">20.11. - Basisinfrastruktur östlich der Absturzstelle erbaut. Sammeln neuer Proben für Experimente hat begonnen.</text> + <text id="panel14">14.12. - Die Forschung damit die Spezies überlebt ist ins Stocken geraten, aber die Kampfforschung erscheint vielversprechend. Kybernetische Verbesserungen sind in der Lage, aus einem durchschnittlichen Zivilisten eine Kriegsmaschine zu machen.</text> + <text id="panel9">24.12 - "C" missbilligt Kampfforschung. Anstatt sich auf ihre Rückkehr vorzubereiten und die Lebensfähigkeit der Spezies zu verbessern, will "C" zu den Sternen zurückkehren und nach anderen Überlebenden suchen.</text> + <text id="panel10">"C" verließ das Labor und machte deutlich, dass wir in der Stadt nicht mehr willkommen sind. Umzug der Operationsbasis in ein altes Labor in den Überresten des Sektors 22.</text> + <text id="panel15">31.01. - Anwendung der kybernetischen Forschung auf uns selbst aufgrund fehlender Probanden. Immer noch kein Zeichen des Feindes, aber vielleicht werden wir dieses Mal gegen sie kämpfen können.</text> + <text id="panel11">09.02. - Haben einige Bürger zur Unterstützung der Forschung gezwungen. Desweiteren erhalten wir neue Testpersonen (Vagabunden und Ausgestoßene). Die Forschung schreitet wieder voran.</text> + <text id="panel12">27.02. - Die Vagabunden sind uns ausgegangen, also mussten wir Bürger als Testsubjekte sammeln. Wenn die Forschungen nicht bald abgeschlossen sind, werden uns die Testpersonen wieder ausgehen.</text> + <text id="broken">Dieses hier ist defekt...</text> + </section> +<section id="system"> + <text id="start">Unoiks 428</text> + </section> + <section id="system.desc"> + <text id="start">G-Typ-Stern 42 Lichtjahre von der Erde entfernt.\n6 bestätigte Exoplaneten.</text> + </section> + <section id="system.planet"> + <text id="start">Unoiks 428e</text> + </section> + <section id="system.planet.desc"> + <text id="start">Ein erdähnlicher und bewohnbarer Planet, Koloniestandort #21.\n\nVermutlich die [color=ff2222]feindliche Heimatwelt[/color].</text> + </section> + <section id="options"> + <text id="options">Optionen</text> + <text id="paused">Spiel pausiert</text> + <text id="music">Musik:</text> + <text id="sfx">Effekte:</text> + <text id="fullscreen">Vollbild:</text> + <text id="textspeed">Texttempo:</text> + <text id="language">Sprache:</text> + <text id="gameplay">Spieloptionen</text> + <text id="controls">Steuerung</text> + <text id="achievements">Erfolge</text> + <text id="title">Zurück zum Hauptmenü</text> + <text id="back">Zurück</text> + <text id="quitgame">Wirklich zum Hauptmenü zurückkehren? Nicht gespeicherter Fortschritt geht verloren.</text> + <text id="keyboard">Tastatur</text> + <text id="controller">Controller</text> + <text id="import">Spielstand importieren</text> + <text id="export">Spielstand exportieren</text> + <text id="import_save">Kann Spielstände nur im Hauptmenü importieren.</text> + <text id="import_html5">Zum importieren: ziehe die .asav-Datei in das Spielfenster und wähle dann einen leeren Speicherplatz aus.</text> + <text id="file_import">Spielstand zum importieren auswählen.</text> + <text id="file_export">Wo soll der Spielstand exportiert und gespeichert werden?</text> + <text id="import_fail">Importieren fehlgeschlagen: Spielstand defekt.</text> + <text id="export_fail">Exportieren fehlgeschlagen: Spielstand defekt.</text> + <text id="auto_heal">autom. essen um Leben zu füllen?</text> + <text id="auto_stamina">autom. essen um Ausdauer zu füllen?</text> + <text id="max_overweight">Tragekapazität:</text> + </section> + <section id="controls"> + <text id="left">Links:</text> + <text id="right">Rechts:</text> + <text id="up">Hoch:</text> + <text id="down">Runter:</text> + <text id="select">Aktion:</text> + <text id="cancel">Abbruch:</text> + <text id="inventory">Inventar:</text> + <text id="quest">Quests:</text> + <text id="equipment">Ausrüstung:</text> + <text id="attack">Angreifen:</text> + <text id="defend">Abwehren:</text> + <text id="device">Gerät:</text> + <text id="hotkey1">Hotkey 1:</text> + <text id="hotkey2">Hotkey 2:</text> + <text id="hotkey3">Hotkey 3:</text> + <text id="hotkey4">Hotkey 4:</text> + <text id="mute">Stumm:</text> + </section> + <section id="cloud"> + <text id="login">Aground Cloud Anmeldung</text> + <text id="logging_in">Anmelden... Bitte warten...</text> + <text id="login_fail">Falscher Benutzername oder Passwort.</text> + <text id="connect_fail">Die Cloud Synchronisation konnte keine Verbindung herstellen.</text> + <text id="sync_fail">Synchronisation fehlgeschlagen!</text> + <text id="button_login">Bei der Aground Cloud anmelden</text> + <text id="button_logout">Aus der Aground Cloud abmelden</text> + <text id="not_logged_in">Nicht in der Aground Cloud angemeldet</text> + <text id="logged_in">Angemeldet als: {username}</text> + <text id="username">Benutzername:</text> + <text id="password">Passwort:</text> + <text id="remember">Benutzername merken?</text> + <text id="create">Konto erstellen</text> + <text id="user_error">Benutzername muss aus 3 bis max. 24 Buchstaben bestehen.</text> + <text id="pass_error">Passwort muss aus 3 bis max. 40 Buchstaben bestehen.</text> + <text id="sync_slots">Synchronisiere Spielstände</text> + <text id="all_synced">Alle Spielstände synchronisiert!</text> + <text id="unsynced">Du hast nicht synchronisierte Spielstände!</text> + <text id="sync_now">Jetzt synchronisieren</text> + <text id="overwrite">Es gibt zwei Spielstände auf diesem Speicherplatz!\nWelchen willst du behalten?</text> + <text id="close_syncing">Deine Spielstände synchronisieren gerade. Willst du wirklich vor der Synchronisation beenden?</text> + </section> + <section id="world"> + <text id="rename">Wie willst du die Insel nennen?</text> + <text id="start">Startinsel</text> + <text id="science1">Sunset Haven</text> + <text id="magic1">Östliche Inseln</text> + </section> + <section id="create.character"> + <text id="title">Charakter erstellen</text> + <text id="skin">Hautfarbe:</text> + <text id="hair">Haarfarbe:</text> + <text id="eyes">Augenfarbe:</text> + <text id="shirt">Shirtfarbe:</text> + <text id="pants">Hosenfarbe:</text> + <text id="hair_style">Frisur:</text> + </section> + <section id="colors"> + <text id="black">Schwarz</text> + <text id="brown">Braun</text> + <text id="dbrown">Dunkelbraun</text> + <text id="lbrown">Hellbraun</text> + <text id="blue">Blau</text> + <text id="dblue">Dunkelblau</text> + <text id="lblue">Hellblau</text> + <text id="green">Grün</text> + <text id="lgreen">Hellgrün</text> + <text id="red">Rot</text> + <text id="yellow">Gelb</text> + <text id="orange">Orange</text> + <text id="pink">Pink</text> + <text id="purple">Lila</text> + <text id="white">Weiß</text> + <text id="gray">Grau</text> + <text id="teal">Blaugrün</text> + <text id="blond">Blond</text> + <text id="dblond">Dunkelblond</text> + <text id="custom">Benutzerdefiniert</text> + </section> +</lang> \ No newline at end of file diff --git a/games/aground/data/mods/fan_translations/es.xml b/games/aground/data/mods/fan_translations/es.xml new file mode 100644 index 00000000..cf333f42 --- /dev/null +++ b/games/aground/data/mods/fan_translations/es.xml @@ -0,0 +1,934 @@ +<?xml version="1.0" encoding="utf-8" ?> +<lang id="es" name="Español"> + <section id="common"> + <text id="blocked">¡Bloqueado!</text> + <text id="miss">¡Errado!</text> + <text id="critical_hit">¡Golpe crítico!</text> + <text id="weight">Peso:</text> + <text id="save">Partida guardada</text> + <text id="del_save">Partida borrada</text> + <text id="save_corrupt">¡La partida está corrupta! Iniciando partida nueva.</text> + <text id="fuel">Combustible</text> + <text id="add_fuel">Echar combustible</text> + <text id="add_rations">Guardar raciones</text> + <text id="all">Todo</text> + <text id="equipment">Equipamiento</text> + <text id="attack">Ataque:</text> + <text id="range">Rango:</text> + <text id="defense">Defensa:</text> + <text id="cut">Talar:</text> + <text id="mine">Excavar:</text> + <text id="capacity">Capacidad:</text> + <text id="health">Vida:</text> + <text id="stamina">Estamina:</text> + <text id="power">Energía:</text> + <text id="ok">Ok</text> + <text id="cancel">Cancelar</text> + <text id="yes">Sí</text> + <text id="no">No</text> + <text id="accept">Aceptar</text> + <text id="reject">Rechazar</text> + <text id="sell">Vender</text> + <text id="buy">Comprar</text> + <text id="drop_item">¿Cuánto deseas soltar</text> + <text id="eat_item">¿Cuánto deseas comer/beber?</text> + <text id="store_item">¿Cuánto deseas almacenar?</text> + <text id="retrieve_item">¿Cuánto deseas recoger?</text> + <text id="sell_item">¿Cuánto deseas vender?</text> + <text id="buy_item">¿Cuánto deseas comprar?</text> + <text id="requires">-- Ingredientes --</text> + <text id="repair_cost">-- Costo reparación --</text> + <text id="creates">-- Crea --</text> + <text id="repaired">{item} reparado.</text> + <text id="inventory">Inventario</text> + <text id="quests">Misiones</text> + <text id="smelter">Horno de fundición</text> + <text id="kitchen">Cocina</text> + <text id="workshop">Taller</text> + <text id="storehouse">Almacén</text> + <text id="dockhouse">Muelle</text> + <text id="power_plant">Planta de energía</text> + <text id="warehouse">Almacén</text> + <text id="harvest">Recolectar</text> + <text id="harvest_all">Recolectar todo</text> + <text id="manage">Administrar</text> + <text id="feed">Alimentar</text> + <text id="lab">Laboratorio</text> + <text id="factory">Fábrica</text> + <text id="synthesizer">Sintetizador</text> + <text id="per_hit">por golpe:</text> + <text id="move">Mover</text> + <text id="newgame">Nueva partida</text> + <text id="continue">Continuar</text> + <text id="options">Opciones</text> + <text id="exit">Salir</text> + <text id="forums">Comunidad</text> + <text id="empty">Vacío</text> + <text id="empty_slot">< Espacio vacío ></text> + <text id="corrupt_slot">Espacio corrupto</text> + <text id="overwrite">¿Deseas sobrescribir este espacio?</text> + <text id="none">Ninguno</text> + <text id="addition_slots">Ampliaciones:</text> + <text id="placed">{item} colocada.</text> + <text id="level_up">¡Has subido de nivel!</text> + <text id="level">Nivel:</text> + <text id="experience">Exp.</text> + <text id="hotkey">Seleccionar objeto</text> + <text id="set_hotkey">Establecer atajo:</text> + <text id="retry">Cargar partida</text> + <text id="title">Pant. principal</text> + <text id="move_all">Mo\nver todo</text> + <text id="add_animal">Agregar animal</text> + <text id="select_feed">Elegir alimento</text> + <text id="use_count">¿Cuántos deseas usar?</text> + <text id="select_fertilizer">Elegir fertilizante</text> + <text id="muted">Silencio activado</text> + <text id="unmuted">Silencio desactivado</text> + <text id="storehouse_add">{npc} agregó {count} {item} al {storehouse}</text> + <text id="auto_eat">Consumiste {count} {item} para recuperar vida</text> + <text id="drop_all">¿Seguro que deseas soltar todos tus {item}? No podrás recuperarlos.</text> + <text id="sign_message">Escribe un mensaje en el [item=sign]:</text> + <text id="transform">¿Cuántos deseas transformar en {into}?</text> + <text id="collect_complete">Recoger completos</text> + <text id="set_sticky">Alternar [tile=sticky] objeto fijo</text> + <text id="fishing">Pescar:</text> + <text id="fishing_line">¡Algo ha mordido el anzuelo!</text> + <text id="fishing_fail">¡El pez se escapó!</text> + <text id="fishing_hooked">Espera...</text> + <text id="fishing_pull">¡Tira ahora!</text> + <text id="craft">¿Cuántos deseas crear?</text> + <text id="coins">Monedas</text> + <text id="speed">Velocidad:</text> + <text id="endurance">Resistencia:</text> + <text id="broken">¡{item} se ha roto!</text> + <text id="damaged">¡{item} está a punto de romperse!</text> + <text id="rem_storehouse_items">Solo inventario</text> + <text id="add_storehouse_items">Incluir almacén</text> + <text id="hungry">¡{item} tiene hambre!</text> + <text id="not_hungry">{item} no tiene hambre.</text> + <text id="rename">Elegir nombre de {item}:</text> + <text id="recharge_batteries">Recargar baterías</text> + <text id="restore_power">¡Baterías recargadas!</text> + <text id="rations">Raciones</text> + </section> + <section id="actions"> + <text id="drop">Soltar</text> + <text id="place">Colocar</text> + <text id="use">Usar</text> + <text id="craft">Crear</text> + <text id="equip">Equipar</text> + <text id="unequip">Quitar</text> + <text id="fire">Disparar</text> + <text id="eat">Comer</text> + <text id="loot">Robar del cuerpo</text> + <text id="feed">Alimentar</text> + <text id="collect">Recoger</text> + <text id="open">Abrir</text> + <text id="carve">Tallar</text> + <text id="switch">Cambiar</text> + <text id="transform">Transformar</text> + <text id="repair">Reparar</text> + <text id="rename">Renombrar</text> + <text id="fill">Rellenar</text> + <text id="synthesize">Sintetizar</text> + <text id="enchant">Encantar</text> + </section> + <section id="item.names"> + <text id="wood">Madera</text> + <text id="coal">Carbón</text> + <text id="iron">Mineral de hierro</text> + <text id="quartz">Cuarzo</text> + <text id="gold">Mineral de oro</text> + <text id="diamond">Diamante</text> + <text id="sulfur">Azufre</text> + <text id="oil">Petróleo</text> + <text id="titanium">Titanio</text> + <text id="uranium">Uranio</text> + <text id="iron_bar">Barra de hierro</text> + <text id="steel_bar">Barra de acero</text> + <text id="gold_bar">Barra de oro</text> + <text id="meat">Carne</text> + <text id="fruit">Manzanas</text> + <text id="wheat">Trigo</text> + <text id="eggs">Huevos</text> + <text id="milk">Leche</text> + <text id="sugar">Azúcar</text> + <text id="steak">Filete</text> + <text id="bread">Pan</text> + <text id="pie">Tarta</text> + <text id="pancakes">Panqueques</text> + <text id="hamburger">Hamburguesa</text> + <text id="cheese">Queso</text> + <text id="pizza">Pizza</text> + <text id="omelette">Omelet</text> + <text id="cheeseburger">Hamburguesa de queso</text> + <text id="cake">Pastel</text> + <text id="candy_apple">Manzana dulce</text> + <text id="dragonblood">Sangre de dragón</text> + <text id="stone_axe">Hacha de piedra</text> + <text id="stone_pickaxe">Pico de piedra</text> + <text id="broken_pickaxe">Pico roto</text> + <text id="coin_purse">Monedero</text> + <text id="iron_pickaxe">Pico de hierro</text> + <text id="iron_sword">Espada de hierro</text> + <text id="iron_armor">Coraza de hierro</text> + <text id="steel_pickaxe">Pico de acero</text> + <text id="steel_sword">Espada de acero</text> + <text id="steel_armor">Coraza de acero</text> + <text id="titanium_armor">Gran coraza</text> + <text id="bow">Arco</text> + <text id="arrow">Flecha</text> + <text id="ice_arrow">Flecha de hielo</text> + <text id="fire_arrow">Flecha de fuego</text> + <text id="drain_arrow">Flecha de desangre</text> + <text id="backpack">Mochila</text> + <text id="mega_backpack">Supermochila</text> + <text id="ultra_backpack">Ultramochila</text> + <text id="magic_pickaxe">Pico mágico</text> + <text id="magic_sword">Espada mágica</text> + <text id="magic_backpack">Mochila mágica</text> + <text id="magic_box">Caja mágica</text> + <text id="cloth">Tela</text> + <text id="net">Red</text> + <text id="berries">Bayas</text> + <text id="red_berries">Bayas rojas</text> + <text id="ice_berries">Bayas de hielo</text> + <text id="health_potion">Poción de vida</text> + <text id="stamina_potion">Poción de estamina</text> + <text id="attack_potion">Poción de ataque</text> + <text id="defense_potion">Poción de defensa</text> + <text id="speed_potion">Poción de velocidad</text> + <text id="endurance_potion">Poción de resistencia</text> + <text id="rat">Rata</text> + <text id="pig">Cerdo</text> + <text id="wyrm">Wyrm</text> + <text id="cocoon">Capullo</text> + <text id="dragon">Dragón bebé</text> + <text id="young_dragon">Dragón joven</text> + <text id="adult_dragon">Dragón adulto</text> + <text id="cockatiel">Cacatúa</text> + <text id="wolf">Lobo domado</text> + <text id="cat">Gato</text> + <text id="boat">Barco</text> + <text id="fence">Cerca</text> + <text id="torch">Antorcha</text> + <text id="trap">Trampa</text> + <text id="workbench">Mesa de trabajo</text> + <text id="anvil">Yunque</text> + <text id="chest">Cofre</text> + <text id="jakolantern">Linterna</text> + <text id="sign">Letrero</text> + <text id="rusty_axe">Hacha oxidada</text> + <text id="cotton">Algodón</text> + <text id="pumpkin">Calabaza</text> + <text id="chicken">Gallina</text> + <text id="cow">Vaca</text> + <text id="fishing_rod">Caña de pescar</text> + <text id="toothfish">Merluza</text> + <text id="rockfish">Pez piedra</text> + <text id="coral_cod">Mero</text> + <text id="fertilizer">Fertilizante</text> + <text id="yeti_fur">Piel de yeti</text> + <text id="fire_gem">Gema de fuego</text> + <text id="water_gem">Gema de agua</text> + <text id="earth_gem">Gema de tierra</text> + <text id="ice_gem">Gema de hielo</text> + <text id="buckler">Broquel</text> + <text id="kite_shield">Escudo largo</text> + <text id="ice_shield">Escudo de hielo</text> + <text id="snowman">Hombre de nieve</text> + <text id="thunder_axe">Hacha antigua</text> + <text id="fire_tusk">Colmillo de fuego</text> + <text id="silicon">Silicio</text> + <text id="refined_oil">Petróleo refinado</text> + <text id="battery">Batería</text> + <text id="drill">Taladro</text> + <text id="revolver">Revólver</text> + <text id="shotgun">Escopeta</text> + <text id="bullet">Bala</text> + <text id="shell">Cartucho</text> + <text id="chainsaw">Motosierra</text> + <text id="minecart">Carro</text> + <text id="rail">Riel</text> + <text id="map">Mapa</text> + <text id="shovel">Pala</text> + <text id="crowbar">Barreta</text> + <text id="landmine">Mina</text> + <text id="alter_gem">Gema de la alteración</text> + <text id="focus_gem">Gema del foco</text> + <text id="spirit_gem">Gema del espíritu</text> + <text id="blood_gem">Gema de sangre</text> + <text id="baby_cannon">Cañón bebé</text> + <text id="dragonflame">Llama de dragón</text> + <text id="wyrm_drill">Taladro wyrm</text> + <text id="dragon_armor">Coraza de dragón</text> + <text id="ice_sword">Espada de hielo</text> + <text id="fire_sword">Espada de fuego</text> + <text id="drain_sword">Espada de desangre</text> + <text id="goggles">Gafas rojas</text> + </section> + <section id="item.descriptions"> + <text id="boat">Navegar.</text> + <text id="fence">Mantiene a los enemigos afuera.</text> + <text id="torch">+1 a la visión en los próximos 20 bloques excavados.</text> + <text id="trap">Trampa: 4 de daño.</text> + <text id="red_berries">+1 al ataque durante 15 segundos.</text> + <text id="ice_berries">+1 a la defensa durante 30 segundos</text> + <text id="magic_box">Guarda todo.</text> + <text id="health_potion">+10 al máximo de vida.</text> + <text id="stamina_potion">+20 al máximo de estamina.</text> + <text id="attack_potion">+1 al ataque durante 30 segundos.</text> + <text id="defense_potion">+1 a la defensa durante 30 segundos.</text> + <text id="speed_potion">Aumenta la velocidad.</text> + <text id="endurance_potion">Aumenta la resistencia.</text> + <text id="workbench">Crea objetos.</text> + <text id="anvil">Repara objetos.</text> + <text id="chest">Almacena objetos.</text> + <text id="sign">Muestra un mensaje.</text> + <text id="ice_arrow">Congela a los enemigos</text> + <text id="shovel">Rellena pozos.</text> + <text id="crowbar">Quita rieles.</text> + </section> + <section id="achievement.names"> + <text id="hut">Refugio</text> + <text id="boar">Cazador</text> + <text id="storehouse">Espacio infinito</text> + <text id="farm">Buena cosecha</text> + <text id="orchard">Manzanas</text> + <text id="smelter">Metalurgia</text> + <text id="kitchen">Buen provecho</text> + <text id="backpack">Peso pesado</text> + <text id="workshop">Industrial</text> + <text id="wyrm">Cazando wyrms</text> + <text id="golem">Cazando golems</text> + <text id="diamond">Brillante</text> + <text id="market">Comerciante</text> + <text id="bigpack">Caravana</text> + <text id="capture_wyrm">Mi wyrm</text> + <text id="pen">Ordeñar cerdos</text> + <text id="pizza">Mmm, queso</text> + <text id="dock">Tierras lejanas</text> + <text id="boat">Marinero</text> + <text id="lab">Experimentos</text> + <text id="wyrm_pen">Sangre infinita</text> + <text id="dragon">Recién nacido</text> + </section> + <section id="achievement.descriptions"> + <text id="hut">Construye la [color=ff2222]choza[/color].</text> + <text id="boar">Derrota a un [color=ff2222]jabalí[/color].</text> + <text id="storehouse">Construye el [color=ff2222]almacén[/color].</text> + <text id="farm">Construye la [color=ff2222]granja[/color].</text> + <text id="orchard">Añade una [color=ff2222]huerta[/color] a la [color=ff2222]granja[/color].</text> + <text id="smelter">Construye el [color=ff2222]horno de fundición[/color].</text> + <text id="kitchen">Construye la [color=ff2222]cocina[/color].</text> + <text id="backpack">Consigue la [color=ff2222]mochila[/color].</text> + <text id="workshop">Construye el [color=ff2222]taller[/color].</text> + <text id="wyrm">Derrota a un [color=ff2222]wyrm[/color].</text> + <text id="golem">Derrota a un [color=ff2222]golem[/color].</text> + <text id="diamond">Excava un [color=ff2222]diamante[/color].</text> + <text id="market">Construye el [color=ff2222]mercado[/color].</text> + <text id="bigpack">Compra una [color=ff2222]supermochila[/color].</text> + <text id="capture_wyrm">¿Y ahora qué hago con él?</text> + <text id="pen">Añade un [color=ff2222]corral[/color] a la [color=ff2222]granja[/color].</text> + <text id="pizza">Cocina una [color=ff2222]pizza[/color].</text> + <text id="dock">Construye el [color=ff2222]muelle[/color].</text> + <text id="boat">Construye un [color=ff2222]barco[/color].</text> + <text id="lab">Construye el [color=ff2222]laboratorio[/color].</text> + <text id="wyrm_pen">Construye la jaula de los [color=ff2222]wyrms[/color].</text> + <text id="dragon">Cría un [color=ff2222]dragón[/color] de un [color=ff2222]capullo[/color].</text> + </section> + <section id="structure"> + <text id="wheat">Campo de trigo</text> + <text id="orchard">Huerta</text> + <text id="sugar">Campo de azúcar</text> + <text id="cotton">Campo de algodón</text> + <text id="pumpkin">Campo de calabazas</text> + <text id="add_field">Ampliar granja</text> + <text id="add_stall">Construir corral</text> + <text id="pen">Corral</text> + <text id="produces">-- Produce --</text> + <text id="slots">-- Espacios --</text> + <text id="plant">Cambiar cultivo</text> + <text id="fertilizer">Fertilizar</text> + <text id="activate_fail">Falta algo para activar esto.</text> + <text id="search_fail">No hay nada interesante por aquí.</text> + <text id="get_pumpkin_seeds">¡Encontré semillas de [item=pumpkin] y las agregué al granero!</text> + <text id="sail_boat">Navegar</text> + <text id="manage_storage">Cargamento</text> + <text id="elevator">Ascensor</text> + <text id="overweight">¡El [item=boat] tiene demasiado peso como para navegar!</text> + <text id="rest_boat">Descansar en barco</text> + <text id="activate">¿Deseas usar un {item} para activar esta estructura?</text> + <text id="enchant_recipe">El pilar ha revelado este encantamiento:\n{enchant}+{items}={creates}.</text> + <text id="enchant_added">La receta del encantamiento ha sido agregada a la [color=770000]fragua[/color].</text> + </section> + <section id="structure.tooltip"> + <text id="hut">Descansar</text> + <text id="storehouse">Entrar al almacén</text> + <text id="workshop">Crear</text> + <text id="smelter">Fundir minerales</text> + <text id="kitchen">Cocinar</text> + <text id="farm">Entrar a la granja</text> + <text id="food_market">Vendedor de alimentos</text> + <text id="weaps_market">Vendedor de armas</text> + <text id="mineral_market">Vendedor de minerales</text> + <text id="dockhouse">Entrar al muelle</text> + <text id="boat">Entrar al barco</text> + <text id="lab">Crear pociones</text> + <text id="pen">Revisar corral</text> + <text id="wyrm_pen">Revisar jaula de los wyrms</text> + <text id="summon_alchemist">Invocar al alquimista</text> + <text id="dragon_lair2">Criar dragones</text> + <text id="fly_dragon">Volar en el dragón</text> + <text id="activate">Activar</text> + <text id="enter">Entrar</text> + <text id="tent">Descansar en la tienda</text> + <text id="search">Buscar</text> + <text id="power_plant">Operar la planta de energía</text> + <text id="inn">Entrar a la posada</text> + <text id="elevator">Llamar al ascensor</text> + <text id="warehouse">Entrar al almacén</text> + <text id="factory">Operar fábrica</text> + </section> + <section id="object.tooltip"> + <text id="bush">Recoger bayas</text> + <text id="tree">Talar árbol</text> + <text id="enemy">Atacar</text> + <text id="collect">Recoger {item}</text> + <text id="open">Abrir {item}</text> + <text id="harvest">Recolectado {item}</text> + <text id="use">Usar {item}</text> + </section> + <section id="equipment"> + <text id="weapon">Arma:</text> + <text id="shield">Escudo:</text> + <text id="pickaxe">Pico:</text> + <text id="armor">Armadura:</text> + <text id="head">Cabeza:</text> + <text id="familiar">Familiar:</text> + </section> + <section id="warning"> + <text id="weight">¡Sobrecargado!</text> + <text id="stamina">¡Sin estamina, perdiendo vida!</text> + <text id="growing">¡En producción! Regresa después.</text> + <text id="additions">¡No hay espacios disponibles!</text> + <text id="focus">Haz click para cambiar el foco</text> + <text id="ingredients">No tienes los ingredientes necesarios.</text> + <text id="place_surface">No puedes colocar objetos debajo de la superficie.</text> + <text id="place_overlap">No puedes colocar un objeto encima de otro.</text> + <text id="no_place">¡No puedes colocar eso aquí!</text> + <text id="no_effect">No tendrá efecto alguno.</text> + <text id="drop_instead">¿Deseas soltarlo?</text> + <text id="cannot_fire">No puedes disparar {projectile} sin {weapon}.</text> + <text id="no_projectiles">No puedes disparar con {weapon}: no tienes {projectile}s.</text> + <text id="max_items">¡No puedes agregar más objetos!</text> + <text id="max_fuel">¡No puedes agregar más combustible!</text> + <text id="max_rations">¡No puedes guardar más raciones!</text> + <text id="max_coins">¡No puedes guardar más monedas en tu monedero!</text> + <text id="send_bug_report">¡Algo ha salido mal! ¿Deseas enviar un reporte de error?</text> + <text id="not_powered">¡No hay energía!</text> + <text id="power">¡Baterías descargadas!</text> + <text id="rations">¡No hay raciones suficientes para viajar!</text> + <text id="no_fill">¡No puedes rellenar este cuadro!</text> + <text id="load_fail">El juego base no pudo ser cargado. Por lo general esto significa que faltan archivos. Vuelve a descargar el archivo comprimido y extrae sus contenidos en una carpeta.</text> + <text id="load_fail_js">El juego base no pudo ser cargado. Por lo general esto significa que faltan archivos. Puedes presionar Shift+Recargar para recargar la página de forma completa.</text> + <text id="flight">No es muy buena idea quitarte eso mientras vuelas...</text> + <text id="incomplete">Esto aún no está completo. Tendrás que esperar a una actualización futura.</text> + </section> + <section id="market"> + <text id="restock">¡Pronto nos reabasteceremos!</text> + <text id="no_power">¡No puedo creer que la [color=770000]planta de energía[/color] no funcione! ¿Cómo se supone que haga negocios así?</text> + </section> + <section id="quests"> + <text id="new">¡Nueva misión!</text> + <text id="none">No tienes misiones por el momento.</text> + <text id="unknown_reqs">???</text> + <text id="requires">-- Requisitos --</text> + <text id="complete">-- Completada --</text> + <text id="hut">Construir choza</text> + <text id="storehouse">Construir almacén</text> + <text id="storehouse2">Construir almacén</text> + <text id="smelter">Construir horno</text> + <text id="workshop">Construir taller</text> + <text id="kitchen">Construir cocina</text> + <text id="kitchen2">Mejorar cocina</text> + <text id="farm">Construir granja</text> + <text id="orchard">Sem. de manzanas</text> + <text id="market">Construir mercado</text> + <text id="market2">Construir mercado</text> + <text id="dock">Construir muelle</text> + <text id="dock2">Construir muelle</text> + <text id="pen">Construir corral</text> + <text id="boat">Construir barco</text> + <text id="lab">Materiales mágicos</text> + <text id="wyrm_pen">Jaula de wyrms</text> + <text id="hatch_dragons">Criar dragones</text> + <text id="thunder_axe">Hacha mágica</text> + <text id="hunt">Cazando jabalíes</text> + <text id="fence">Perímetro</text> + <text id="wolf">Cachorro de lobo</text> + <text id="powerplant">Arreglar planta de energía</text> + <text id="factory">Construir fábrica</text> + <text id="elevator">Construir ascensor</text> + <text id="mirrows">Enfrentar a los Mirrow</text> + <text id="fisherman_cat">Buscando a Peri</text> + <text id="bandits">Derrotar bandidos</text> + <text id="boars">Derrotar jabalíes</text> + <text id="wyrm_hive">Guarida de wyrms</text> + <text id="alter_gem">Investigación con wyrms</text> + <text id="oldone">Energía mágica</text> + </section> + <section id="quest.description"> + <text id="hut">Necesitas construir una [color=550000]choza[/color] para resguardarte de la tormenta.</text> + <text id="storehouse">quiere construir un [color=550000]almacén[/color].</text> + <text id="storehouse2">Construye un [color=550000]almacén[/color] para guardar tus objetos.</text> + <text id="smelter">quiere un [color=550000]horno de fundición[/color] para refinar los minerales.</text> + <text id="workshop">quiere un [color=550000]taller[/color] para crear herramientas de metal.</text> + <text id="kitchen">quiere construir una [color=550000]cocina[/color] para preparar comidas.</text> + <text id="kitchen2">quiere que la [color=550000]cocina[/color] produzca [item=cheese].</text> + <text id="farm">quiere construir una [color=550000]granja[/color] para cultivar alimentos.</text> + <text id="orchard">quiere usar [item=fruit] para plantar una [color=550000]huerta[/color].</text> + <text id="market">quiere construir un [color=550000]mercado[/color] para comerciar.</text> + <text id="market2">Construye un [color=550000]mercado[/color] para traer comerciantes a tu [color=550000]muelle[/color].</text> + <text id="dock">quiere un [color=550000]muelle[/color] para viajar por el mundo.</text> + <text id="dock2">Construye un [color=550000]muelle[/color] para buscar a otros sobrevivientes.</text> + <text id="pen">quiere construir un [color=550000]corral[/color] para criar animales.</text> + <text id="boat">¡Es hora de navegar por el mundo! Construye un [item=boat] en el [color=550000]muelle[/color].</text> + <text id="lab">quiere que consigas [item=dragonblood] de un [item=wyrm].</text> + <text id="wyrm_pen">quiere experimentar con [item=wyrm]s.</text> + <text id="hatch_dragons">Cría [item=dragon]s para ganarte la confianza del dragón.</text> + <text id="thunder_axe">quiere arreglar el [item=rusty_axe].</text> + <text id="hunt">quiere que practiques el uso de armas.</text> + <text id="fence">quiere agregar [item=fence]s al asentamiento.</text> + <text id="wolf">quiere domar al cachorro de lobo.</text> + <text id="powerplant">necesita [item=titanium] para la [color=550000]planta de energía[/color].</text> + <text id="factory">quiere construir una [color=550000]fábrica[/color].</text> + <text id="elevator">quiere construir un [color=550000]ascensor[/color].</text> + <text id="mirrows">quiere que negocies con los Mirrow por él.</text> + <text id="fisherman_cat">quiere que busques a su [item=cat], que gusta de [item=toothfish]s.</text> + <text id="bandits">Los mercaderes quieren que derrotes a los bandidos que les roban.</text> + <text id="wyrm_hive">quiere que halles los secretos de los [item=wyrm]s.</text> + <text id="alter_gem">necesita ayuda para terminar su investigación con los [item=wyrm]s.</text> + <text id="oldone">quiere encontrar la fuente de los picos de energía mágica.</text> + </section> + <section id="npc"> + <text id="talk">Hablar</text> + <text id="grab">Agarrar</text> + <text id="builder">Constructor</text> + <text id="miner">Minera</text> + <text id="farmer">Granjero</text> + <text id="trader">Comerciante</text> + <text id="alchemist">Alquimista</text> + <text id="hunter">Cazador</text> + <text id="mechanic">Mecánica</text> + <text id="innkeeper">Posadero</text> + <text id="fisherman">Pescador</text> + </section> + <section id="builder"> + <text id="intro">¿Realmente esperas sobrevivir aquí? Es inútil.</text> + <text id="introduce1">¿Tú eres bueno para construir cosas, verdad? Podríamos construir algo que nos permita almacenar los recursos y la comida.</text> + <text id="introduce2">Hmph. Supongo que con [var=quest.storehouse.wood] [item=wood] y [var=quest.storehouse.berries] [item=berries] podría construir un [color=770000]almacén[/color] decente.</text> + <text id="accept1">¡Genial! Puedo encontrar esas cosas.</text> + <text id="accept2">Toma esta [item=stone_axe], si tan entusiasmado estás.</text> + <text id="stamina">Estoy agotado. Tú te ves cansado también. Deberíamos descansar en la [color=770000]choza[/color] para guardar la partida y recuperar nuestra [tile=stamina] [color=006600]estamina[/color].</text> + <text id="wood">¿Aún tienes mi vieja [item=stone_axe]? Estoy seguro de que podría talar arboles si aprietas [key=select] junto a uno.</text> + <text id="hint1">Todos los objetos se guardan en tu inventario cuando los recoges. Puedes mirar tu inventario apretando [key=inventory].</text> + <text id="hint2">Si te quedas sin [tile=stamina] [color=006600]estamina[/color], perderás [tile=health] [color=770000]vida[/color], y si te quedas sin [tile=health] [color=770000]vida[/color], morirás.</text> + <text id="hint3">Por eso necesitas comer muchas [item=berries], [item=fruit] y [item=meat]. Para comer, selecciona la comida en tu inventario.</text> + <text id="storehouse1">¿Ya has juntado todo? Estoy impresionado.</text> + <text id="storehouse2">¡Construyamos ese [color=770000]almacén[/color]!</text> + <text id="storehouse3">¡Mira eso! ¿No sientes orgullo?</text> + <text id="storehouse4">Sí... esto será útil. Ahora podremos guardar nuestros recursos y así evitar cansarnos.</text> + <text id="farmer">Deberíamos hacer un trato con el [color=770000][tile=farmer] granjero[/color]. Seguro podría ayudarnos a cultivar alimentos.</text> + <text id="miner">¿Viste a esa [color=770000][tile=miner] minera[/color] salir de la tierra? Deberías hablarle para ver qué es lo que quiere.</text> + <text id="kitchen1">¿Qué te parece si construimos una [color=770000]cocina[/color]? La [item=meat] es rica, pero es aún más rica si la cocinas.</text> + <text id="kitchen2">Necesitaré [var=quest.kitchen.wood] [item=wood] y [var=quest.kitchen.coal] [item=coal] para construir una [color=770000]cocina[/color].</text> + <text id="kitchen3">Parece que tienes todos los elementos que necesito. ¡Construyamos nuestra [color=770000]cocina[/color]!</text> + <text id="kitchen4">Puedes cocinar la comida en la [color=770000]cocina[/color] siempre y cuando tengas [item=wood] o [item=coal] para usar como combustible.</text> + <text id="kitchen5">¿Sabes que se me antoja? [item=cheese]. No hay nada que me guste más.</text> + <text id="kitchen6">Podría mejorar la [color=770000]cocina[/color] para poder hacer [item=cheese] y cocinar nuevos alimentos con [var=quest.kitchen2.wood] [item=wood] y [var=quest.kitchen2.steel_bar] [item=steel_bar].</text> + <text id="kitchen7">Parece que tienes todos los elementos que necesito. ¡Remodelemos nuestra [color=770000]cocina[/color]!</text> + <text id="kitchen8">¡Prueba alguna de las recetas nuevas! ¡Hasta parece comida civilizada!</text> + <text id="farm">Tengo mucha hambre. ¡Espero que termines esa [color=770000]granja[/color] pronto!</text> + </section> + <section id="farmer"> + <text id="introduce1">¡Me alegro de verte! Creía ser el último sobreviviente. Un pobre viejo en un mundo desolado.</text> + <text id="introduce2">Todavía tengo algo de vitalidad, y pienso que podría ayudarte. Mi especialidad es la agricultura. Todos necesitamos comida para alimentarnos.</text> + <text id="introduce3">¿Qué tal si construimos un granero y establecemos nuestra propia [color=770000]granja[/color]?</text> + <text id="farm1">¡Perfecto! ¡Yo construiré el granero y sembraré las semillas!</text> + <text id="farm2">¡Ya tenemos una [color=770000]granja[/color]! Vuelve periódicamente para realizar la cosecha. Los alimentos te ayudarán a recuperar la [tile=stamina] [color=006600]estamina[/color]. Ten - toma algo de [item=bread] mientras crecen las plantas.</text> + <text id="farm3">Puedes obtener [item=wood] talando árboles.</text> + <text id="farm4">Si quieres aumentar la cosecha, podemos añadir hasta cuatro campos de trigo o huertas. Puedes añadirlos en el granero.</text> + <text id="farm5">¡Mira qué [color=770000]granja[/color] más maravillosa! No tiene nada que envidiarle a mi vieja granja.</text> + <text id="kitchen">El [item=wheat] sin procesar no es muy rico, pero creo que podríamos crear algo mejor si tú y el [color=770000][tile=builder] constructor[/color] hicieran una [color=770000]cocina[/color].</text> + <text id="pen1">¿Sabes que necesita esta [color=770000]granja[/color]? ¡Ganado! ¿Qué te parece si capturas [color=770000][tile=boar] jabalíes[/color] con una [item=net] del [color=770000]mercado[/color]?</text> + <text id="pen2">Podré hacer un [color=770000]corral[/color] con [var=quest.pen.pig] [item=pig] y [var=quest.pen.wood] [item=wood].</text> + <text id="pen3">¿No son esos los [item=pig]s más gordos y jugosos que hayas visto?</text> + <text id="pen4">Con el corral, ¡ahora podremos producir [item=meat] y [item=milk]!</text> + <text id="pig">¿Cómo capturar un [item=pig]? Pon una [item=net] en el suelo y lleva un [color=770000][tile=boar] jabalí[/color] hacia ella. En cuanto la toque, ¡será capturado y domesticado!</text> + <text id="kitchen2">¿Ordeñar un [item=pig]? ¿Por qué no? Este es un mundo muy extraño. Pero lo que realmente necesitamos es [item=cheese] - habla con el [color=770000][tile=builder] constructor[/color] para mejorar la [color=770000]cocina[/color].</text> + <text id="halloween">Espero que no te importe, ¡pero me tomé la libertad de decorar por el Festival de la Cosecha! Un poco de celebración no nos vendrá mal. También guardé algunas [item=jakolantern]s en el [color=770000]almacén[/color].</text> + <text id="add_sugar">¡Esta granja se está haciendo realmente grande! Para festejarlo, encontré unas semillas de [item=sugar] y las guardé en el granero. ¡Intenta plantar un campo de azúcar!</text> + <text id="add_cotton">¡Me encontré con unos comerciantes en el [color=770000]muelle[/color] y conseguí unas semillas de [item=cotton]! Ahora puedes plantar [item=cotton] en el granero.</text> + <text id="orchard1">Hay muchas [item=fruit] por aquí. Si consiguiera semillas suficientes, ¡podría plantar una [color=770000]huerta[/color]!</text> + <text id="orchard2">¡Perfecto! Esto es más que suficiente. Guardaré las semillas en el granero, así podrás cambiar los campos por huertas en la sección de administración.</text> + <text id="orchard3">¡Avísame cuando tengas suficientes [item=fruit] para la [color=770000]huerta[/color]!</text> + <text id="snowman">¡Nuestra primera nevada! Es una ocasión excelente para celebrar. Hice un [item=snowman] con [item=ice_berries], ¡espero que te guste!</text> + </section> + <section id="miner"> + <text id="introduce1">Oh, hola. No creí que hubieran otros sobrevivientes.</text> + <text id="introduce2">He estado bajo la tierra - hay mucho más de lo que parece en este lugar.</text> + <text id="introduce3">Tengo un pico de sobra por si acaso quieres averiguarlo por ti mismo.</text> + <text id="smelter">¿Cómo va la excavación? Tal vez deberíamos construir un [color=770000]horno de fundición[/color] para fundir los minerales y hacer barras de metal.</text> + <text id="accept1">¡Genial! ¡Avísame cuando tengas [item=coal] suficiente!</text> + <text id="smelter1">Sí, esto es lo que necesito. ¡El [color=770000]horno de fundición[/color] estará listo en unos momentos!</text> + <text id="smelter2">El [color=770000]horno de fundición[/color] puede convertir los minerales en barras de metal. Para ello necesita combustible. Por suerte, hay abundante [item=coal] en la tierra para alimentarlo.</text> + <text id="hint1">¿Y bien, qué esperas? ¡Aprieta [key=down] para excavar y hallar minerales!</text> + <text id="hint2">Los minerales son pesados - asegúrate de guardarlos en el [color=770000]almacén[/color] entre cada viaje.</text> + <text id="hint3">Es fácil dejarse llevar cuando uno se encuentra excavando, pero asegúrate de tener suficiente [tile=stamina] [color=006600]estamina[/color] para el viaje de regreso.</text> + <text id="hint4">Mientras más profundo caves, mejores serán los minerales que encuentres.</text> + <text id="workshop1">¿Qué me dices de un [color=770000]taller[/color] para convertir las barras de metal en herramientas? Puedo construir uno con [var=quest.workshop.iron_bar] [item=iron_bar] y [var=quest.workshop.wood] [item=wood].</text> + <text id="workshop2">Muy bien, ¡pongamos este [color=770000]taller[/color] en marcha!</text> + <text id="workshop3">En el [color=770000]taller[/color] puedes crear cualquier herramienta u objeto para el cual tengas los materiales necesarios.</text> + <text id="workshop4">Deberás buscar [item=iron] para fundirlo en [item=iron_bar] en el [color=770000]horno de fundición[/color].</text> + <text id="smelter3">Una vez que tengas [item=iron] suficiente, elige [item=iron_bar] en el menú del [color=770000]horno de fundición[/color] y automáticamente se fundirá, siempre y cuando haya combustible disponible.</text> + <text id="smelter4">Puedes dejar tantos trabajos en el [color=770000]horno de fundición[/color] como materiales disponibles tengas, y se fundirán uno por uno, incluso cuando no estés presente, siempre y cuando el horno tenga suficiente combustible.</text> + <text id="pick">Si quieres cavar en la [color=770000][tile=stone] piedra[/color] para hallar [item=gold], tendrás que crear un [item=iron_pickaxe] o un [item=steel_pickaxe] en el [color=770000]taller[/color].</text> + <text id="equip1">Si quieres cavar en la [color=770000][tile=stone] piedra[/color] para hallar [item=gold], tendrás que equipar un [item=iron_pickaxe] o un [item=steel_pickaxe]. Presiona [key=equipment] para revisar tu equipamiento.</text> + <text id="equip2">Puedes revisar tu equipamiento y picos apretando [key=equipment] para abrir la ventana de equipamiento.</text> + <text id="hotkey">Ahora también puedes usar los [color=770000]atajos[/color].\nAprieta [key=hotkey1], [key=hotkey2], [key=hotkey3] o [key=hotkey4] en el inventario para establecerlos.</text> + </section> + <section id="trader"> + <text id="steal">¡Han robado [item={item}] del [color=770000]almacén[/color]!</text> + <text id="caught">¡El ladrón ha sido sorprendido con las manos en la masa!</text> + <text id="introduce1">¡Ya es bastante difícil sobrevivir aquí como para que también nos robes nuestras cosas!</text> + <text id="introduce2">Puede que haya tomado prestadas algunas cosas. Pero, espera. Te compensaré ofreciéndote mis servicios. Tengo conexiones con muchos comerciantes de otras islas.</text> + <text id="introduce3">¿Comerciantes? ¿Hay otros sobrevivientes?</text> + <text id="introduce4">Sí. Pero voy a necesitar [var=quest.market.gold_bar] [item=gold_bar] para convencerlos de que vengan.</text> + <text id="introduce5">¿¡Vas a cobrarnos después de habernos robado!?</text> + <text id="introduce6">Ya olvídate de eso. Esto es un negocio. Mi oferta es [var=quest.market.gold_bar] [item=gold_bar] para introducir esta isla en las rutas comerciales.</text> + <text id="introduce7">Está bien. Si hay otros sobrevivientes, comerciar con ellos podría sacarnos de esta isla.</text> + <text id="introduce8">Lo siento, no puedo confiar en una ladrona. Abandona la isla, y nunca más vuelvas.</text> + <text id="introduce9">Conozco mejores islas para robar de todas formas. No sabes lo que te pierdes.</text> + <text id="market1">¡Perfecto! Creo que este es el comienzo de una relación muy lucrativa.</text> + <text id="market2">Toma este [item=coin_purse]. Lo necesitarás para guardar monedas, que puedes usar para comprar y vender objetos. Te sugiero que compres una [item=mega_backpack] cuanto antes, ¡son muy útiles!</text> + <text id="market3">Puedes vender objetos en el [color=770000]mercado[/color] a cambio de monedas, que podrás usar para comprar otros objetos.</text> + <text id="market4">Cada tanto, el [color=770000]mercado[/color] renueva su inventario. Si no consigues lo que buscas, prueba a volver más tarde.</text> + <text id="market5">Para crear una [item=gold_bar], necesitarás fundir [item=gold], que podrás encontrar en lo más profundo del subsuelo. Puede que la [color=770000][tile=miner] minera[/color] pueda darte algún consejo para excavar a esas profundidades.</text> + <text id="dock1">¿Te interesaría conocer el resto del mundo? ¿Qué te parece si construimos un [color=770000]muelle[/color]?</text> + <text id="dock2">Yo lo construiré por ti si me das [var=quest.dock.coins] [color=770000][tile=coin_purse.ico] monedas[/color], [var=quest.dock.wood] [item=wood], [var=quest.dock.cloth] [item=cloth]s y [var=quest.dock.net] [item=net]es.</text> + <text id="dock3">Excelente, ¡construyamos ese [color=770000]muelle[/color]!</text> + <text id="dock4">Una vez que construyas un [item=boat] en el [color=770000]muelle[/color], ¡estarás listo para navegar por el mar!</text> + <text id="dock5">El [color=770000]muelle[/color] cuesta [var=quest.dock.coins] [color=770000][tile=coin_purse.ico] monedas[/color], [var=quest.dock.wood] [item=wood], [var=quest.dock.cloth] [item=cloth]s y [var=quest.dock.net] [item=net]es.</text> + <text id="accept">Aceptar oferta</text> + <text id="reject">Rechazar oferta</text> + <text id="sail">¿No es un día hermoso para navegar?</text> + </section> + <section id="alchemist"> + <text id="introduce1">En este planeta hay cosas que ni te imaginarías. He estado realizando experimentos, ¡y creo haber descubierto magia!</text> + <text id="introduce2">Necesito más ingredientes. Si te encuentras con un [item=wyrm], mátalo y tráeme su [item=dragonblood], y te recompensaré.</text> + <text id="lab1">¡Lo sabía! ¡Aquí está el secreto! ¡Debo armar un laboratorio de inmediato!</text> + <text id="lab2">¿Tu recompensa? Tráeme materiales a mi laboratorio y te prepararé una poción.</text> + <text id="lab3">¡Deprisa! ¡Mi investigación no podrá continuar hasta qué tenga [item=dragonblood]!</text> + <text id="pen1">¡Necesito más [item=dragonblood]! Tráeme [var=quest.wyrm_pen.wyrm] [item=wyrm]s vivos y tendremos una fuente inagotable de [item=dragonblood] para experimentar!</text> + <text id="pen2">¡Excelente! ¡Hazte a un lado hasta que termine mi trabajo!</text> + <text id="pen3">Contemplad mi gran obra - ¡la [color=770000]jaula de los wyrms[/color]! No es solo una jaula, ¡es una reserva inagotable de [item=dragonblood]!</text> + <text id="wyrm">Estoy seguro de que puedes capturar un [item=wyrm] con una [item=net]. ¡Pero tiene que estar sano y salvo!</text> + <text id="dragon1">¡Debemos experimentar más con los [item=wyrm]s! ¿Qué es lo que comen? ¿Por qué producen [item=dragonblood]?</text> + <text id="dragon2">¡Lo sabía! ¡Los [item=wyrm]s se transforman en [item=dragon]s! Pero, ¿por qué hay tan pocos [item=adult_dragon]s en esta tierra?</text> + <text id="dragon3">Sospecho que existe una guarida de dragón en algún lugar de la montaña. Si la encuentras, invócame... a lo mejor algunos de estos enigmas puedan ser resueltos allí.</text> + <text id="dragon4">¡Ah, un [item=adult_dragon]! Veamos que nos puede decir. Puedo traducir su idioma para ti mediante un simple hechizo.</text> + <text id="dragon5">¿Quién eres tú, para despertarme de mi sueño?</text> + <text id="dragon6">Soy un buscador de la magia y la verdad. Dime, ¿por qué quedan tan pocos dragones en este mundo?</text> + <text id="dragon7">Porque los más ancianos partieron. Ellos también fueron buscadores de la magia y la verdad. Y traicionaron a mi gente.</text> + <text id="dragon8">¡Entonces quizás podamos ayudarte! Lo único que queremos a cambio es conocimiento.</text> + <text id="dragon9">¿Creen que pueden ayudarme? Pruébenlo. Si pueden criar y traerme [var=quest.hatch_dragons.dragon] [item=dragon]s, hablaremos. Y si no, ¡váyanse de aquí!</text> + <text id="dragon10">¡Sabía que me traicionarían! ¡Ahora enfrentarán mi ira!</text> + <text id="dragon11">No creo que debamos despertarla hasta tener los [item=dragon]s.</text> + <text id="dragon12">¿Lo han conseguido? Quizás todavía haya esperanza para mi especie.</text> + <text id="dragon12_a">¡Excelente! Entonces, ¿nos revelarás los secretos de la magia?</text> + <text id="dragon13">Por desgracia, no tengo conocimientos sobre los secretos que buscas. Fuimos creados por los antiguos, y ellos fueron quienes construyeron esta guarida para criarnos.</text> + <text id="dragon14">Sin embargo, puede que la respuesta se halle en las islas del este. Regresa a esta guarida cuando estés listo, y yo te llevaré volando hacia allí.</text> + <text id="lair1">¡Lo sabía! ¡Esta guarida es artificial, hecha con magia! ¡Parece que se usaba para criar dragones!</text> + <text id="lair2">Seguro que puedo activarla...</text> + <text id="lair3">¡Ajá! ¡Listo! Con esta guarida, podremos criar nuestros propios dragones. Parece que la guarida apunta hacia el este. Quizás podríamos volar con un dragón en esa dirección y descubrir más...</text> + <text id="axe1">Déjame ver esa [item=rusty_axe]... Es difícil verlos con todo este óxido, ¡pero puedo reconocer esos símbolos!</text> + <text id="axe2">Posee un tipo de magia antigua, pero ha perdido su efecto. Si me trajeras un material mágico apropiado, quizás podría repararla.</text> + <text id="axe3">Ese [item=fire_tusk]... ¿de qué criatura lo obtuviste? Parece resonar con el [item=rusty_axe]. ¡Tal vez sea el material mágico que buscamos!</text> + <text id="axe4">¡Lo hice! Me pregunto quién hizo esta [item=thunder_axe], y que tan vieja será. He agregado la receta al laboratorio, por si quieres hacer más.</text> + <text id="magic_intro1">Esta isla rebosa de magia. ¡Este es definitivamente el lugar en el que tenemos que estar!</text> + <text id="magic_intro2">Conozco este tipo de magia. Estas estructuras son parcialmente orgánicas y se encuentran hibernando. Tendrán que ser despertadas.</text> + <text id="magic_intro3">Sé como activar la cámara púrpura, pero necesitaré estudiar las otras en mayor profundidad.</text> + <text id="magic_intro4">Esta será nuestra base operativa. Buscaré algo de provisiones.</text> + <text id="wyrm1">Puede que los [item=wyrm]s nos den información sobre cómo activar las demás estructuras.</text> + <text id="wyrm2">Deberías seguir a uno en esta isla y descubrir sus secretos. Mientras tanto, yo traduciré estas marcas.</text> + <text id="wyrm3">No te preocupes, ya haz lidiado con [item=wyrm]s antes. ¡Seguir a uno a su guarida no debería representar ningún problema!</text> + <text id="wyrm4">¿Qué dices? ¿Había una reina wyrm? Eso es irrelevante, ¡mira la gema que has encontrado! Estoy seguro que es lo que necesitamos para continuar con nuestra investigación.</text> + <text id="wyrm5">Ten, ponte estas [item=goggles]. Pude inventarlas con la ayuda de las marcas, y si bien no me permitieron encontrar el secreto detrás de estas estructuras, quizás podrían revelarte aquello que no hemos podido hallar.</text> + <text id="sleep">Voy a necesitar más tiempo para estudiar esto. ¿Por qué no descansas en la cámara púrpura?</text> + <text id="forest">El bosque que está al Este parece ser peligroso. He colocado una [item=fence], y te recomendaría que no la cruces.</text> + <text id="elementals1">He llegado a la conclusión de que una [item=spirit_gem] puede capturar un espíritu de fuego o agua, dando como resultado una [item=fire_gem] o una [item=water_gem]. Esas gemas deberían servirnos para activar las estructuras.</text> + <text id="elementals2">Si no puedes encontrar los espíritus elementales, ponte mis [item=goggles]. ¡Serán descubiertos!</text> + <text id="elementals3">Puedes colocar las [item=spirit_gem] como si fueran trampas. Luego, lleva a los espíritus hacia ellas para capturarlos.</text> + <text id="magic_farm1">¿Qué esperas? ¡Usa la [item=water_gem] en la estructura azul para activarla!</text> + <text id="magic_farm2">¡La estructura azul es un sintetizador mágico! ¡Puede crear objetos a partir de la magia!</text> + <text id="magic_farm3">Usa las [item=focus_gem] para hacer funcionar el sintetizador.</text> + <text id="magic_farm4">¡Todavía necesitamos una [item=water_gem] para activar la estructura azul! Usa una [item=spirit_gem] para capturar un elemental del agua.</text> + <text id="magic_forge1">¿Qué esperas? ¡Usa la [item=fire_gem] en la estructura roja para activarla!</text> + <text id="magic_forge2">La estructura roja es una especie de fragua mágica muy antigua. ¡Puede encantar objetos!</text> + <text id="magic_forge3">Puedes experimentar con distintas combinaciones de objetos e ingredientes mágicos en la fragua. ¡Podrías encontrarte con algo espectacular!</text> + <text id="magic_forge4">¡Todavía necesitamos una [item=fire_gem] para activar la estructura roja! Usa una [item=spirit_gem] para capturar un elemental del fuego.</text> + <text id="alter_gem1">He estando meditando; intentando descifrar los secretos de los [item=wyrm]s.</text> + <text id="alter_gem2">Si me traes [var=quest.alter_gem.wyrm] [item=wyrm], [var=quest.alter_gem.fire_tusk] [item=fire_tusk] y [var=quest.alter_gem.yeti_fur] [item=yeti_fur], podré concluir mi investigación.</text> + <text id="alter_gem3">¡Lo logré! ¡He creado una [item=alter_gem]! ¡Esto nos permitirá transformar los [item=wyrm]s, y probablemente otras criaturas, en objetos útiles!</text> + <text id="alter_gem4">¡Tenemos que seguir explorando esta rama de la magia! Toma esta [item=alter_gem] y úsala en un [item=wyrm]. Si necesitas más [item=alter_gem], puedes crearlas en el sintetizador con la receta que agregué.</text> + <text id="alter_gem5">Para usar la [item=alter_gem], selecciónala en tu inventario, elige "Transformar", y elige la criatura que deseas transformar.</text> + <text id="alter_gem6">No tengas miedo de probar la [item=alter_gem] en otras criaturas... como un [item=dragon]. O incluso, ¡un [item=adult_dragon]!</text> + <text id="alter_gem7">¿Andas escaso de [item=alter_gem]? Puedes encontrarlas en las profundidades del subsuelo o crearlas en el sintetizador.</text> + <text id="alter_gem8">Asegurate de usar las [item=alter_gem] en criaturas bien alimentadas. Si la criatura tiene hambre, ¡la transformación no durará mucho!</text> + <text id="first1">¿No te estrellaste con el resto de nosotros?</text> + <text id="first2">No, yo fui parte de una misión de exploración para el programa de colonización.</text> + <text id="first3">Eramos cuatro. Pero los otros tres murieron, y, cuando regresaron al poco tiempo, me di cuenta que este planeta estaba maldito.</text> + <text id="first4">Sobreviví a duras penas, usando lo que sabía de magia. Quizás si hubiera tenido esas [item=goggles], las cosas hubieran sido distintas.</text> + <text id="first5">¡¿Estaban aquí?! ¿Buscándote?</text> + <text id="first6">Sí. Sospecho que estaban celosos de mi magia. ¿O asustados de ella, quizás? No estoy seguro.</text> + <text id="second1">¿Los encontraste en este planeta hace diez años? ¡Eso fue antes de que intentaran aniquilar a la raza humana y destruir la Tierra!</text> + <text id="second2">Correcto. Yo fui el primero en conocerlos, y el primero a quien quisieron matar.</text> + <text id="second3">No sé qué pude haber hecho distinto para detener la guerra. Llegaron de forma repentina y con sus armas biológicas, y sin decir una palabra, empezaron a atacar.</text> + <text id="second4">Si tan solo hubiera una forma de comunicarse con ellos...</text> + <text id="second5">Probablemente podríamos comunicarnos con ellos ahora, usando mi traducción mágica.</text> + <text id="second6">Pero con suerte no nos encontrarán nunca más. Parecen contentos ignorándonos.</text> + <text id="oldone1">He estado notando picos de energía mágica últimamente. Tal vez no sea nada, pero podría ser uno de ellos.</text> + <text id="oldone2">Si lo encuentras, invócamente inmediatamente. Si efectivamente es uno de ellos, estaríamos en grave peligro.</text> + <text id="oldone3">Muy bien, veamos si mi traducción funciona.</text> + <text id="oldone4">¿Quién eres tú y qué estás haciendo aquí?</text> + <text id="oldone5">¿Qué derecho tienen de preguntarme eso? ¡Este es mi hogar, mi planeta! ¡Ustedes son los intrusos!</text> + <text id="oldone6">Ese exoesqueleto mágico me resulta familiar... ¿eres uno de ellos?</text> + <text id="oldone7">Aquellos a los que llamas "ellos" son mis tontos hermanos. Hace mucho tiempo, ellos decidieron abandonar su planeta nativo, mientras que yo me quedé aquí y adopté una vida de aislamiento e inmortalidad.</text> + <text id="oldone8">¿Nos puedes contar algo sobre tu magia? ¿Qué son esos picos de energía mágica? ¿Por qué creaste y criaste a los dragones?</text> + <text id="oldone9">¡Silencio! ¡No hablamos sobre estos asuntos con gente como tú! He sido muy tolerante. De lo contrario, hubieran muerto hace mucho tiempo.</text> + <text id="oldone10">Pero ahora entiendo que ellos tenían razón en algo. ¡El universo será un lugar mejor sin ustedes y los de su clase!</text> + </section> + <section id="player"> + <text id="storm1">La tormenta se vuelve cada vez más fuerte. Necesito refugiarme, ¡pero aquí no hay más que ramas caídas!</text> + <text id="storm2">Debo intentar construir una [color=770000]choza[/color]. [var=quest.hut.wood] [item=wood] será suficiente.</text> + <text id="storm3">Estoy tan cansado... apenas si puedo sujetar toda esta [item=wood]. Solo necesito un poco más y podré descansar en la [color=770000]choza[/color].</text> + <text id="storehouse1">Esta hacha podría serme útil. Con ella podría construir un [color=770000]almacén[/color] para guardar los recursos que consiga.</text> + <text id="storehouse2">Creo que podría construir un almacén con [var=quest.storehouse.wood] [item=wood] y [var=quest.storehouse.berries] [item=berries].</text> + <text id="storehouse3">¡Bien, construyamos un almacén!</text> + <text id="storehouse4">Perfecto. Ahora puedo evitar el cansancio por cargar mucho peso.</text> + <text id="dock1">Me pregunto si lo que dijo la ladrona sobre otros sobrevivientes era cierto.</text> + <text id="dock2">Quizás debería construir un [color=770000]muelle[/color] y buscarlos. Necesitaré [var=quest.dock2.wood] [item=wood] y [var=quest.dock2.steel_bar] [item=steel_bar].</text> + <text id="dock3">¡Muy bien, construyamos el [color=770000]muelle[/color]!</text> + <text id="market1">Si construyera un mercado, a lo mejor los comerciantes vendrían a este muelle. Puedo construir uno con [var=quest.market2.gold_bar] [item=gold_bar].</text> + <text id="market2">¡Esto es todo lo que necesito para el [color=770000]mercado[/color]!</text> + <text id="market3">¡Parece que sí había comerciantes después de todo! Incluso me han dado un [item=coin_purse], que podré usar para comprar y vender objetos.</text> + <text id="market4">¡Ahora solo falta construir un [item=boat] en el [color=770000]muelle[/color]!</text> + <text id="farewell1">No sé que habrá allí afuera, pero pienso averiguarlo antes de regresar.</text> + <text id="farewell2">¡Trae cosas ricas para comer!</text> + <text id="farewell3">No olvides explorar debajo de la superficie. Nunca sabes lo que podrías encontrar.</text> + <text id="farewell4">No nos dejes esperando, ¡vuelve pronto!</text> + <text id="farewell5">No te metas en nada muy peligroso.</text> + <text id="farewell6">El mundo exterior es muy incierto.</text> + <text id="farewell7">¡Estás yendo en la dirección equivocada! ¡Los secretos están todos al Este!</text> + <text id="bandits1">Qué bueno es volver al negocio. ¡Si tan solo pudiéramos deshacernos de esos bandidos!</text> + <text id="bandits2">Tú pareces ser fuerte. ¿Crees que podrías ahuyentarlos por nosotros?</text> + <text id="bandits3">¡Haz vencido a los bandidos! Por favor acepta estos regalos como una muestra de nuestro agradecimiento.</text> + <text id="bandits4">Es nuestro día de suerte: ¡la presa viene justo a nuestras garras! Las cosas no paran de mejorar desde que nos escapamos de los Mirrow y sus horrendos experimentos.</text> + <text id="ore_cave">Este lugar es raro. Siento como si estuviera en otra dimensión. Tengo el presentimiento de que será distinto cada vez que entre.</text> + </section> + <section id="hunter"> + <text id="tent1">No debería descansar en la tienda de un desconocido.</text> + <text id="tent2">Esta debe ser la tienda del [color=770000][tile=hunter] cazador[/color]. Mejor la dejo como está.</text> + <text id="intro1">¡Ey, tú! ¿Viste como maté a ese jabalí?</text> + <text id="intro2">Sí, ¿cómo lo hiciste?</text> + <text id="intro3">¡Fácil! Con la técnica adecuada tú también podrías hacerlo.</text> + <text id="intro4">Estoy tratado de despejar esta área. Si me ayudas, yo podría enseñarte a cazar.</text> + <text id="accept1">Necesitas ser sorpresivo. Ataca a tus enemigos por detrás, y darás un golpe crítico.</text> + <text id="accept2">Los [item=bow]s son mi arma predilecta. Ten, prueba a usar mi [item=workbench]. Puedes usarlo para hacer tu propio [item=bow] y tus propias [item=arrow]s.</text> + <text id="accept3">Usa [key=equipment] para equipar un arma, y [key=attack] para atacar con el arma equipada.</text> + <text id="accept4">¿Por qué no creas un [item=bow] y cazas algunos [color=770000][tile=boar] jabalíes[/color]? Si necesitas algún consejo para cazar, no dudes en preguntarme.</text> + <text id="reject1">Pareces ser peligroso. ¡Alejate de nuestra área!</text> + <text id="reject2">Muy bien, como quieras. ¡Volveré a las montañas entonces!</text> + <text id="reject3">¿Listo para aprender a cazar?</text> + <text id="hunt1">Tendremos el área libre de criaturas peligrosas en un santiamén.</text> + <text id="hunt2">Como recompensa por tu buen trabajo, toma mi vieja [item=backpack]. Podría servirte cuando estés al descampado.</text> + <text id="tip1">Puedes cavar un túnel y atacar a los jabalíes por detrás.</text> + <text id="tip2">Puedes comer [item=red_berries] para aumentar tu ataque durante un tiempo. Pero ten cuidado: no son buenas para la salud.</text> + <text id="tip3">Si eres "bloqueado" con frecuencia, el enemigo es demasiado fuerte para ti. Necesitarás un arma mejor o un ataque más poderoso.</text> + <text id="tent3">Me encontraba solo y tembloroso en la oscuridad de la montaña, cuando de repente, ¡vi luces! Luego escuché risas. Sonaba tan agradable...</text> + <text id="tent4">¿Entonces viniste a buscar nuestra amistad?</text> + <text id="tent5">Claro que no. Y definitivamente no estaba cazando jabalíes para impresionarlos a ustedes. Para nada.</text> + <text id="tent6">Solo quería abarcar más territorio para cazar.</text> + <text id="tent7">Me gustaría saber más sobre este lugar, y si hay algo más allá de esta isla...</text> + <text id="tent8">Hay otras islas hacia el Este. Las he visto desde lo alto de las montañas.</text> + <text id="tent9">¿Tú crees que podríamos ir a esas islas?</text> + <text id="tent10">No estoy seguro. La costa allí es traicionera. Además, esas islas se ven raras. Podrían ser peligrosas.</text> + <text id="tent11">¿Entonces crees que deberíamos quedarnos aquí?</text> + <text id="tent12">Creo que ya tenemos suficientes problemas aquí como para ir a buscarlos a otro lado.</text> + <text id="fence1">Me gustaría mantener los animales salvajes a raya.</text> + <text id="fence2">¿Podrías usar el [item=workbench] que te di y crear unas [item=fence]s? Así podríamos establecer un perímetro.</text> + <text id="fence3">Perfecto. Los [color=770000][tile=boar] jabalíes[/color] no pueden atravesar las [item=fence]s, por lo que podemos usarlas para proteger nuestro asentamiento.</text> + <text id="fence4">Pondré una aquí, tú coloca las otras [item=fence]s alrededor de la base para protegerla.</text> + <text id="wolf1">He observado un cachorro de lobo merodeando por nuestro asentamiento. Parece estar solo.</text> + <text id="wolf2">¿No lo acompaña una manada?</text> + <text id="wolf3">Deben haberlo abandonado.</text> + <text id="wolf4">Con [var=quest.wolf.net] [item=net]es, [var=quest.wolf.trap] [item=trap]s y [var=quest.wolf.meat] [item=meat], podríamos domesticarlo.</text> + <text id="wolf5">Bien, veamos que podemos hacer con este cachorro.</text> + <text id="wolf6">Bien hecho, parece que confía plenamente en ti. Ahora tienes un compañero.</text> + <text id="wolf7">Puedes hacer que el [item=wolf] te siga usando el espacio para [color=770000]familiar[/color]es en la ventana de [color=770000]equipamiento[/color].</text> + </section> + <section id="mechanic"> + <text id="introduce1">¡Está completamente quemada! ¡Esto es un desastre!</text> + <text id="introduce2">¿Qué ha ocurrido?</text> + <text id="introduce3">¡Los Mirrow trataron de redireccionar la energía y casi destruyen toda la planta!</text> + <text id="introduce4">Esperan que nosotros limpiemos el desorden de sus experimentos fallidos... ¡bah!</text> + <text id="introduce5">Ni siquiera tengo algo de [item=titanium], por lo que no podré repararla...</text> + <text id="powerplant1">Vaya, realmente no esperaba que consiguieras el titanio.</text> + <text id="powerplant2">Gracias, ahora podré reparar esto enseguida.</text> + <text id="powerplant3">¡Ha vuelto a funcionar! Podemos usar [item=coal] o [item=refined_oil] como combustible. Además, aquí puedes crear [item=battery]s.</text> + <text id="powerplant4">Ah, y toma esta chatarra que me sobró de reparar la planta, como agradecimiento por el [item=titanium].</text> + <text id="powerplant5">Nunca encontraré más titanio, ¡estamos perdidos!</text> + <text id="battery">Hazme saber cuando hayas creado una [item=battery], ya que seremos capaces de crear cosas geniales una vez que tengamos una fuente de energía portátil.</text> + <text id="tip1">Usa [item=sulfur] y una [item=steel_bar] para crear una [item=battery] en la [color=770000]planta de energía[/color]. Allí también podrás recargarlas.</text> + <text id="tip2">Añade una [item=battery] a tu inventario para usar tu equipamiento eléctrico.</text> + <text id="tip3">Tu [tile=power] [color=444400]energía[/color] total será mostrada debajo de tu [tile=health] [color=770000]vida[/color] y tu [tile=stamina] [color=006600]estamina[/color] .</text> + <text id="factory1">Ahora que tenemos energía otra vez, me gustaría tener máquinas con las que entretenerme.</text> + <text id="factory2">Si me ayudas a montar una [color=770000]fábrica[/color], ¡podríamos crear todo tipo de cosas!</text> + <text id="factory3">Esto será genial. ¡Por fin un nuevo proyecto con el que jugar!</text> + <text id="factory4">Ahora podremos refinar ciertos materiales y construir [item=drill]s, [item=chainsaw]s, [item=shotgun]s, y otros objetos interesantes.</text> + <text id="elevator1">He notado que has estado minando mucho.</text> + <text id="elevator2">¿No sería útil tener algún dispositivo que te permitiera transportar los minerales a la superficie?</text> + <text id="elevator3">¡Bien! ¡Construyámoslo!</text> + <text id="elevator4">¿Subes? ¿O bajas?</text> + <text id="repair">Si necesitas reparar algo, solo házmelo saber.</text> + </section> + <section id="innkeeper"> + <text id="intro1">¡Bienvenido a la Llave Dorada! ¡La mejor (y la única) posada de este lado del desierto!</text> + <text id="intro2">¿Así que esta es una posada? ¿Recibes mucha gente aquí?</text> + <text id="intro3">Bastante gente pasa por Sunset Haven: explorando, comerciando, buscando un hogar.</text> + <text id="intro4">Pero si no recuperamos pronto la energía, quién sabe si alguien se asentará aquí. ¡He perdido la cuenta de las veces que he resistido la tentación de ir y aclararle algunas cosas a los Mirrow!</text> + <text id="power1">¡Maravilloso! ¡La energía ha vuelto!</text> + <text id="power2">No gracias a esos tontos Mirrow. ¡No puedo creer que todavía les paguemos tarifas para el mantenimiento de nuestra tecnología!</text> + <text id="power3">Y no solo arruinaron la planta de energía, ¿además no pueden tomarse la molestia de venir a arreglarla?</text> + <text id="power4">¿No pueden simplemente dejar de pagarles?</text> + <text id="power5">No puedo dejar la posada sola, pero si alguien fuera capaz de ir al desierto y enfrentarlos, quizás podríamos salirnos de este injusto acuerdo.</text> + <text id="no_power">Me temo que no podrás hospedarte mientras no tengamos energía.</text> + <text id="visit">¿Deseas una habitación para pasar la noche? Solo te costará 50 [color=770000][tile=coin_purse.ico] monedas[/color], ¡y con cena incluida!</text> + <text id="no_money">¿No tienes dinero suficiente? Entonces me temo que no podrás hospedarte. ¡Esto no es una beneficiencia!</text> + <text id="scene1">¿Es cierto que la nave principal se estrelló por aquí? ¿Cómo sobrevivieron sin cápsulas de escape?</text> + <text id="scene2">Ese es precisamente nuestro problema. Los Mirrow nos salvaron. En el último segundo, hicieron mejoras casi increíbles y protegieron al sector entero de la aniquilación. Por eso estamos en deuda.</text> + <text id="scene3">Pero ahora nos han dejado sin energía, y han estado soltando unas criaturas extrañas que provocan destrozos.</text> + <text id="scene4">Incluso he oído que algunas personas han desaparecido en el desierto, donde los Mirrow fueron vistos por última vez.</text> + <text id="scene5">¿Y esperan que soportemos todo eso? ¿Y encima que les paguemos? Ya es demasiado.</text> + </section> + <section id="fisherman"> + <text id="intro1">¡Finalmente, de vuelta en tierra firme! ¡Parece que tú también has llegado recién!</text> + <text id="intro2">No te asustes, esa es la forma de saludar de Polly. Espero que no te moleste el agua de mar en tus botas.</text> + <text id="intro3">¿Alguna vez habías estado en esta isla?</text> + <text id="intro4">Por supuesto. Esta isla se llama Sunset Haven, y en ella hay más sobrevivientes que en cualquier otra isla que haya visitado.</text> + <text id="intro5">Y con motivo: aquí es donde se estrelló la nave principal.</text> + <text id="intro6">Pero ten cuidado. He escuchado rumores nada buenos sobre Sunset Haven últimamente...</text> + <text id="cat1">¡Mi [item=cat] Peri se ha escapado otra vez! ¿Podrías ayudarme a buscarla?</text> + <text id="cat2">Creo que está evitando navegar conmigo. El agua no es de su agrado.</text> + <text id="cat3">Si me ayudas, te enseñaré lo que sé de pesca.</text> + <text id="cat4">¡Genial, gracias! Aquí tienes una [item=fishing_rod] que me sobraba. Si quieres consejos sobre cómo pescar, ¡pregúntame!</text> + <text id="cat5">Las [item=toothfish]s son la comida favorita de Peri. Quizás podrías tentarla con alguna.</text> + <text id="cat6">¡Encontraste a mi [item=cat]! Gracias, amigo.</text> + <text id="cat7">Vaya, parece que le has caído muy bien. Seguro estará más feliz contigo. ¿Por qué no te la quedas?</text> + <text id="cat8">¡La gata es demasiado rápida como para atraparla!</text> + <text id="cat9">Me ha quitado la [item=toothfish] de la mano, pero es muy rápida. No puedo atraparla.</text> + <text id="cat11">¿Dar una [item=toothfish] a Peri?</text> + <text id="cat12">Esta vez no se ha ido tan rápido.</text> + <text id="cat13">Ven aquí Peri... muy bien...</text> + <text id="cat15">¡Gata capturada!</text> + <text id="tip1">En la pesca, lo más importante es actuar en el momento adecuado. Usa tu caña de pescar en el muelle y apreta la tecla [key=select] cuando algo muerda el anzuelo. Si te apuras o tardas mucho, ¡perderás el pez!</text> + <text id="tip2">Si dice "Espera", el pez necesita algo más de tiempo. Aguarda hasta que diga "¡Tira ahora!" y luego presiona la tecla [key=select] otra vez.</text> + <text id="tip3">Algunos peces son más difíciles de pescar que otros. Mantén la vista en el mensaje, y presiona la tecla indicada.</text> + <text id="scene1">Por mi parte, esto es todo lo que necesito. Un techo, la luz del sol, y un gran océano para pescar.</text> + <text id="scene2">¿Y tú? ¿Cuál es tu sueño?</text> + <text id="scene3">Me encantaría saber si existe alguna forma de escapar de este planeta.</text> + <text id="scene4">¡¿Qué?! ¡¿Para qué?! ¿Acaso quieres morir? Esas cosas no tienen piedad.</text> + <text id="scene5">Quiero saber más sobre ellos... y por qué las cosas pasaron como pasaron.</text> + <text id="scene6">Escucha, amigo mío. Pude ver a uno de ellos antes de que despegáramos de la Tierra. Lo único que debes saber es cómo evitarlos.</text> + </section> + <section id="mirrows"> + <text id="intro1">¿Ustedes son los Mirrow? ¿Por qué han estado molestando a los habitantes de Sunset Haven y creando esos monstruos horribles?</text> + <text id="intro2">¡Es que no lo entiendes! ¡Lo hacemos por un buen motivo! ¡Lo hacemos por el bien de todos! ¡No podremos sobrevivir sin las mejores armas</text> + <text id="intro3">Cuando vengan a exterminar al último de nosotros, ¡estaremos preparados! Los sacrificios que hemos hecho han sido necesarios.</text> + <text id="intro4">¡No pueden sacrificar a la gente por un futuro que tal vez nunca llegue! ¡Hay mejores formas de salvar a todos!</text> + <text id="intro5">Si estás convencido de operar en nuestra contra, no tenemos más opción que luchar contra ti.</text> + <text id="intro6">¡Creo que tu cuerpo es justo lo que necesitaba para mi nueva invención ciborg!</text> + </section> + <section id="scene.hut"> + <text id="first1">No está mal para ser mi primer refugio.</text> + <text id="first2">Auxilio…[pause=4] por favor…[pause=4] refugio…</text> + <text id="first3">¡Hay alguien afuera! ¿Debería dejarlo entrar?</text> + <text id="first4">Gracias. Te debo la vida. ¿Pero qué haremos ahora?</text> + <text id="first5">Por el momento, mantenernos secos y calientes.</text> + <text id="first6">¿Y después? ¿Cómo sobreviviremos en esta isla desierta?</text> + <text id="first7">¿Qué sentido tiene? Estamos atrapados, no hay salida.</text> + <text id="first8">Al menos podemos intentarlo. A lo mejor vivir aquí no será tan malo como tú piensas.</text> + <text id="first9">Por favor…[pause=4] auxilio…</text> + <text id="second1">… y cuando llegué aquí empecé a cavar y nunca noté la tormenta.</text> + <text id="second2">Pero me alegro de haber venido. Ya me estaba cansando de comer tierra, y no hay nada como el calor de una fogata tras un día de estar bajo la superficie.</text> + <text id="second3">¿Crees que haya otros sobrevivientes?</text> + <text id="second4">En realidad, pienso que es increíble que alguien pudiera sobrevivir a ese accidente. Sin embargo, nosotros lo hicimos, así que puede que haya otras personas en algún lugar.</text> + <text id="third1">Seguramente ustedes jóvenes crean que esto es el fin del mundo; yo supuse lo mismo durante la Tercera Guerra Mundial y sin embargo aquí estamos.</text> + <text id="third2">En mi opinión, tendremos que arreglárnoslas con lo que tengamos, y agradecer que tenemos comida y estamos acompañados.</text> + <text id="third3">¿Pero cuánto tiempo estaremos en esta miserable isla?</text> + <text id="third4">¡Quién sabe! Pero siempre que haya vida, habrá esperanza. Quizá con el tiempo hasta podríamos sentirnos como en casa.</text> + <text id="fourth1">Cuéntanos lo que sabes acerca de otros sobrevivientes.</text> + <text id="fourth2">Casi todos fuimos desparramados por distintas islas. En algunas islas hay más sobrevivientes que en otras e incluso cuentan con algo de tecnología.</text> + <text id="fourth3">He escuchado incluso rumores sobre una isla con una nave en casi perfecto estado.</text> + <text id="fourth4">¿Podrá volar?</text> + <text id="fourth5">Repito, solo son rumores. Pero aún si pudiera, sería una muerte segura. Mejor quedarnos en este planeta. Parece que aquí no los molestamos.</text> + <text id="hunter1">Eres muy bueno en esto. ¿Eras cazador antes del accidente?</text> + <text id="hunter2">Hah. Nunca había matado un animal en mi vida antes de todo esto. Yo era un científico. Trabajaba en un laboratorio. Con moléculas.</text> + <text id="hunter3">Vaya. ¿Cómo aprendiste tanto entonces?</text> + <text id="hunter4">Es increíble lo que puedes lograr cuando debes sobrevivir.</text> + <text id="hunter5">Uno cambia. Te vuelves alguien que tu viejo yo no reconocería.</text> + </section> + <section id="options"> + <text id="options">Opciones</text> + <text id="paused">Juego pausado</text> + <text id="music">Volumen música:</text> + <text id="sfx">Volumen efectos:</text> + <text id="fullscreen">Pant. completa:</text> + <text id="textspeed">Velocidad texto:</text> + <text id="language">Idioma:</text> + <text id="controls">Controles</text> + <text id="achievements">Logros</text> + <text id="title">Regresar a la pantalla principal</text> + <text id="back">Atrás</text> + <text id="quitgame">¿Deseas regresar a la pantalla principal? Perderás todo el progreso que no haya sido guardado.</text> + <text id="keyboard">Teclado</text> + <text id="controller">Controlador</text> + <text id="import">Importar partida guardada</text> + <text id="export">Exportar partida guardada</text> + </section> + <section id="controls"> + <text id="left">Izquierda:</text> + <text id="right">Derecha:</text> + <text id="up">Arriba:</text> + <text id="down">Abajo:</text> + <text id="select">Acción:</text> + <text id="cancel">Cancelar:</text> + <text id="inventory">Objetos:</text> + <text id="quest">Misiones:</text> + <text id="equipment">Equipamiento:</text> + <text id="attack">Atacar:</text> + <text id="defend">Defender:</text> + <text id="device">Dispositivo:</text> + <text id="hotkey1">Atajo 1:</text> + <text id="hotkey2">Atajo 2:</text> + <text id="hotkey3">Atajo 3:</text> + <text id="hotkey4">Atajo 4:</text> + <text id="mute">Silencio:</text> + </section> + <section id="world"> + <text id="start">Isla Inicial</text> + <text id="science1">Sunset Haven</text> + <text id="magic1">Isla Oriental</text> + </section> +</lang> \ No newline at end of file diff --git a/games/aground/data/mods/fan_translations/fonts/uni.fnt b/games/aground/data/mods/fan_translations/fonts/uni.fnt new file mode 100644 index 00000000..784bb34f --- /dev/null +++ b/games/aground/data/mods/fan_translations/fonts/uni.fnt @@ -0,0 +1,721 @@ +<font> + <info face="uni" size="8" bold="0" italic="0" charset="" unicode="" stretchH="100" smooth="1" aa="1" padding="2,2,2,2" spacing="0,0" outline="0"/> + <common lineHeight="10" base="9" scaleW="256" scaleH="155" pages="1" packed="0" yoffset="-2" /> + <pages> + <page id="0" file="uni.png"/> + </pages> + <chars count="711"> + <char id="33" x="2" y="2" width="1" height="5" xoffset="1" yoffset="4" xadvance="3" page="0" chnl="15"/> + <char id="34" x="5" y="2" width="3" height="2" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="35" x="10" y="2" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="36" x="17" y="2" width="5" height="7" xoffset="0" yoffset="3" xadvance="6" page="0" chnl="15"/> + <char id="37" x="24" y="2" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="38" x="31" y="2" width="6" height="5" xoffset="0" yoffset="4" xadvance="7" page="0" chnl="15"/> + <char id="39" x="39" y="2" width="1" height="2" xoffset="0" yoffset="4" xadvance="2" page="0" chnl="15"/> + <char id="40" x="42" y="2" width="2" height="7" xoffset="0" yoffset="3" xadvance="3" page="0" chnl="15"/> + <char id="41" x="46" y="2" width="2" height="7" xoffset="0" yoffset="3" xadvance="3" page="0" chnl="15"/> + <char id="42" x="50" y="2" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="43" x="57" y="2" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="44" x="64" y="2" width="2" height="3" xoffset="0" yoffset="8" xadvance="3" page="0" chnl="15"/> + <char id="45" x="68" y="2" width="4" height="1" xoffset="0" yoffset="6" xadvance="5" page="0" chnl="15"/> + <char id="46" x="74" y="2" width="1" height="1" xoffset="0" yoffset="8" xadvance="2" page="0" chnl="15"/> + <char id="47" x="77" y="2" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="48" x="84" y="2" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="49" x="91" y="2" width="2" height="5" xoffset="0" yoffset="4" xadvance="3" page="0" chnl="15"/> + <char id="50" x="95" y="2" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="51" x="102" y="2" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="52" x="109" y="2" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="53" x="116" y="2" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="54" x="123" y="2" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="55" x="130" y="2" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="56" x="136" y="2" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="57" x="143" y="2" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="58" x="150" y="2" width="1" height="3" xoffset="1" yoffset="5" xadvance="4" page="0" chnl="15"/> + <char id="59" x="153" y="2" width="2" height="6" xoffset="0" yoffset="5" xadvance="4" page="0" chnl="15"/> + <char id="60" x="157" y="2" width="3" height="5" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="61" x="162" y="2" width="5" height="3" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="62" x="169" y="2" width="3" height="5" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="63" x="174" y="2" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="64" x="180" y="2" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="65" x="187" y="2" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="66" x="194" y="2" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="67" x="201" y="2" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="68" x="208" y="2" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="69" x="215" y="2" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="70" x="222" y="2" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="71" x="229" y="2" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="72" x="236" y="2" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="73" x="243" y="2" width="1" height="5" xoffset="0" yoffset="4" xadvance="2" page="0" chnl="15"/> + <char id="74" x="246" y="2" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="75" x="68" y="5" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="76" x="162" y="7" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="77" x="2" y="9" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="78" x="9" y="9" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="79" x="24" y="9" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="80" x="31" y="9" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="81" x="50" y="9" width="5" height="6" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="82" x="57" y="9" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="83" x="75" y="9" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="84" x="82" y="9" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="85" x="89" y="9" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="86" x="96" y="9" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="87" x="103" y="9" width="7" height="5" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="88" x="112" y="9" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="89" x="119" y="9" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="90" x="126" y="9" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="91" x="252" y="2" width="2" height="7" xoffset="0" yoffset="3" xadvance="3" page="0" chnl="15"/> + <char id="92" x="133" y="9" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="93" x="64" y="7" width="2" height="7" xoffset="0" yoffset="3" xadvance="3" page="0" chnl="15"/> + <char id="94" x="140" y="9" width="3" height="2" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="95" x="145" y="9" width="5" height="1" xoffset="0" yoffset="9" xadvance="6" page="0" chnl="15"/> + <char id="96" x="38" y="9" width="2" height="2" xoffset="0" yoffset="4" xadvance="3" page="0" chnl="15"/> + <char id="97" x="168" y="9" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="98" x="174" y="9" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="99" x="180" y="9" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="100" x="186" y="9" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="101" x="192" y="9" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="102" x="157" y="9" width="2" height="5" xoffset="0" yoffset="4" xadvance="3" page="0" chnl="15"/> + <char id="103" x="198" y="9" width="4" height="6" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="104" x="204" y="9" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="105" x="210" y="9" width="1" height="5" xoffset="0" yoffset="4" xadvance="2" page="0" chnl="15"/> + <char id="106" x="213" y="9" width="2" height="7" xoffset="0" yoffset="4" xadvance="3" page="0" chnl="15"/> + <char id="107" x="217" y="9" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="108" x="223" y="9" width="1" height="5" xoffset="0" yoffset="4" xadvance="2" page="0" chnl="15"/> + <char id="109" x="226" y="9" width="7" height="4" xoffset="0" yoffset="5" xadvance="8" page="0" chnl="15"/> + <char id="110" x="235" y="9" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="111" x="241" y="9" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="112" x="16" y="11" width="4" height="6" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="113" x="42" y="11" width="4" height="6" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="114" x="247" y="9" width="3" height="4" xoffset="0" yoffset="5" xadvance="4" page="0" chnl="15"/> + <char id="115" x="68" y="12" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="116" x="152" y="10" width="3" height="5" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="117" x="145" y="12" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="118" x="161" y="14" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="119" x="226" y="15" width="7" height="4" xoffset="0" yoffset="5" xadvance="8" page="0" chnl="15"/> + <char id="120" x="167" y="15" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="121" x="180" y="15" width="4" height="6" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="122" x="192" y="15" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="123" x="140" y="13" width="3" height="7" xoffset="0" yoffset="3" xadvance="4" page="0" chnl="15"/> + <char id="124" x="252" y="11" width="1" height="7" xoffset="1" yoffset="3" xadvance="4" page="0" chnl="15"/> + <char id="125" x="235" y="15" width="3" height="7" xoffset="0" yoffset="3" xadvance="4" page="0" chnl="15"/> + <char id="126" x="240" y="15" width="4" height="2" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="161" x="38" y="13" width="1" height="5" xoffset="0" yoffset="4" xadvance="3" page="0" chnl="15"/> + <char id="162" x="246" y="15" width="4" height="6" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="163" x="2" y="16" width="5" height="6" xoffset="0" yoffset="3" xadvance="6" page="0" chnl="15"/> + <char id="164" x="22" y="16" width="6" height="5" xoffset="0" yoffset="4" xadvance="7" page="0" chnl="15"/> + <char id="165" x="9" y="16" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="166" x="30" y="16" width="1" height="5" xoffset="0" yoffset="4" xadvance="2" page="0" chnl="15"/> + <char id="167" x="33" y="16" width="3" height="7" xoffset="0" yoffset="3" xadvance="4" page="0" chnl="15"/> + <char id="168" x="5" y="6" width="3" height="1" xoffset="1" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="169" x="57" y="16" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="170" x="74" y="16" width="3" height="5" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="171" x="79" y="16" width="5" height="3" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="172" x="86" y="16" width="5" height="3" xoffset="0" yoffset="6" xadvance="6" page="0" chnl="15"/> + <char id="173" x="93" y="16" width="4" height="1" xoffset="0" yoffset="6" xadvance="5" page="0" chnl="15"/> + <char id="174" x="99" y="16" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="175" x="106" y="16" width="3" height="1" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="176" x="111" y="16" width="3" height="3" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="177" x="116" y="16" width="5" height="6" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="178" x="123" y="16" width="3" height="4" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="179" x="128" y="16" width="3" height="4" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="180" x="64" y="16" width="2" height="2" xoffset="0" yoffset="4" xadvance="3" page="0" chnl="15"/> + <char id="181" x="133" y="16" width="5" height="6" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="182" x="173" y="16" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="183" x="39" y="6" width="1" height="1" xoffset="0" yoffset="6" xadvance="2" page="0" chnl="15"/> + <char id="184" x="157" y="16" width="2" height="2" xoffset="0" yoffset="9" xadvance="3" page="0" chnl="15"/> + <char id="185" x="186" y="16" width="1" height="4" xoffset="0" yoffset="4" xadvance="2" page="0" chnl="15"/> + <char id="186" x="204" y="16" width="3" height="5" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="187" x="217" y="16" width="5" height="3" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="188" x="48" y="17" width="7" height="5" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="189" x="145" y="18" width="7" height="5" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="190" x="38" y="20" width="8" height="5" xoffset="0" yoffset="4" xadvance="9" page="0" chnl="15"/> + <char id="191" x="198" y="17" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="192" x="209" y="18" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="193" x="64" y="20" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="194" x="154" y="20" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="195" x="79" y="21" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="196" x="86" y="21" width="5" height="7" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="197" x="106" y="21" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="198" x="161" y="21" width="9" height="5" xoffset="0" yoffset="4" xadvance="10" page="0" chnl="15"/> + <char id="199" x="189" y="21" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="200" x="216" y="21" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="201" x="223" y="21" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="202" x="123" y="22" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="203" x="9" y="23" width="5" height="7" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="204" x="16" y="19" width="2" height="8" xoffset="-1" yoffset="1" xadvance="2" page="0" chnl="15"/> + <char id="205" x="93" y="19" width="2" height="8" xoffset="0" yoffset="1" xadvance="2" page="0" chnl="15"/> + <char id="206" x="240" y="19" width="3" height="8" xoffset="-1" yoffset="1" xadvance="2" page="0" chnl="15"/> + <char id="207" x="230" y="21" width="3" height="7" xoffset="-1" yoffset="2" xadvance="2" page="0" chnl="15"/> + <char id="208" x="20" y="23" width="6" height="5" xoffset="0" yoffset="4" xadvance="7" page="0" chnl="15"/> + <char id="209" x="57" y="23" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="210" x="71" y="23" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="211" x="97" y="23" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="212" x="172" y="23" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="213" x="179" y="23" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="214" x="245" y="23" width="5" height="7" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="216" x="2" y="24" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="217" x="48" y="24" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="218" x="113" y="24" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="219" x="130" y="24" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="220" x="137" y="24" width="5" height="7" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="221" x="196" y="24" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="222" x="203" y="24" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="223" x="28" y="25" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="224" x="144" y="25" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="225" x="34" y="27" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="226" x="40" y="27" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="227" x="161" y="28" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="228" x="209" y="28" width="4" height="6" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="229" x="235" y="29" width="4" height="6" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="230" x="16" y="30" width="7" height="4" xoffset="0" yoffset="5" xadvance="8" page="0" chnl="15"/> + <char id="231" x="64" y="30" width="4" height="6" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="232" x="86" y="30" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="233" x="150" y="30" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="234" x="186" y="30" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="235" x="2" y="31" width="4" height="6" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="236" x="252" y="20" width="2" height="6" xoffset="-1" yoffset="3" xadvance="2" page="0" chnl="15"/> + <char id="237" x="167" y="28" width="2" height="6" xoffset="0" yoffset="3" xadvance="2" page="0" chnl="15"/> + <char id="238" x="92" y="30" width="3" height="6" xoffset="-1" yoffset="3" xadvance="2" page="0" chnl="15"/> + <char id="239" x="156" y="30" width="3" height="5" xoffset="-1" yoffset="4" xadvance="2" page="0" chnl="15"/> + <char id="240" x="78" y="31" width="4" height="6" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="241" x="104" y="31" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="242" x="203" y="31" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="243" x="215" y="31" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="244" x="221" y="31" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="245" x="227" y="31" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="246" x="8" y="32" width="4" height="6" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="247" x="25" y="32" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="248" x="120" y="32" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="249" x="241" y="32" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="250" x="247" y="32" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="251" x="55" y="33" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="252" x="70" y="33" width="4" height="6" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="254" x="97" y="33" width="4" height="7" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="255" x="137" y="33" width="4" height="8" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="256" x="171" y="33" width="5" height="7" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="257" x="178" y="33" width="4" height="6" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="258" x="46" y="34" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="259" x="110" y="34" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="260" x="126" y="34" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="261" x="143" y="34" width="4" height="6" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="262" x="192" y="34" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="263" x="14" y="36" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="264" x="32" y="36" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="265" x="39" y="36" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="266" x="156" y="37" width="5" height="7" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="267" x="209" y="36" width="4" height="6" xoffset="0" yoffset="3" xadvance="6" page="0" chnl="15"/> + <char id="268" x="163" y="37" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="269" x="233" y="37" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="270" x="61" y="38" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="271" x="116" y="38" width="6" height="5" xoffset="0" yoffset="4" xadvance="7" page="0" chnl="15"/> + <char id="272" x="20" y="39" width="6" height="5" xoffset="0" yoffset="4" xadvance="7" page="0" chnl="15"/> + <char id="273" x="2" y="39" width="4" height="6" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="274" x="76" y="39" width="5" height="7" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="275" x="83" y="39" width="4" height="6" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="276" x="89" y="39" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="277" x="149" y="39" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="278" x="184" y="39" width="5" height="7" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="279" x="8" y="40" width="4" height="6" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="280" x="103" y="40" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="281" x="199" y="40" width="4" height="6" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="282" x="215" y="40" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="283" x="222" y="40" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="284" x="68" y="41" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="285" x="178" y="41" width="4" height="9" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="286" x="239" y="41" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="287" x="246" y="41" width="4" height="9" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="288" x="53" y="42" width="5" height="7" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="289" x="96" y="42" width="4" height="8" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="290" x="170" y="42" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="291" x="143" y="42" width="4" height="9" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="292" x="124" y="43" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="293" x="110" y="43" width="4" height="8" xoffset="0" yoffset="1" xadvance="5" page="0" chnl="15"/> + <char id="294" x="131" y="43" width="7" height="5" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="295" x="45" y="44" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="296" x="191" y="44" width="4" height="8" xoffset="-1" yoffset="1" xadvance="2" page="0" chnl="15"/> + <char id="297" x="205" y="44" width="4" height="6" xoffset="-1" yoffset="3" xadvance="2" page="0" chnl="15"/> + <char id="298" x="228" y="40" width="3" height="7" xoffset="-1" yoffset="2" xadvance="2" page="0" chnl="15"/> + <char id="299" x="14" y="45" width="3" height="5" xoffset="-1" yoffset="4" xadvance="2" page="0" chnl="15"/> + <char id="300" x="39" y="45" width="3" height="8" xoffset="-1" yoffset="1" xadvance="2" page="0" chnl="15"/> + <char id="301" x="116" y="45" width="3" height="6" xoffset="-1" yoffset="3" xadvance="2" page="0" chnl="15"/> + <char id="302" x="133" y="34" width="2" height="7" xoffset="0" yoffset="4" xadvance="3" page="0" chnl="15"/> + <char id="303" x="28" y="39" width="2" height="7" xoffset="0" yoffset="4" xadvance="3" page="0" chnl="15"/> + <char id="304" x="253" y="28" width="1" height="7" xoffset="0" yoffset="2" xadvance="2" page="0" chnl="15"/> + <char id="305" x="189" y="16" width="1" height="3" xoffset="0" yoffset="6" xadvance="2" page="0" chnl="15"/> + <char id="306" x="19" y="46" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="307" x="32" y="46" width="3" height="7" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="308" x="155" y="46" width="4" height="8" xoffset="0" yoffset="1" xadvance="4" page="0" chnl="15"/> + <char id="309" x="233" y="46" width="3" height="8" xoffset="0" yoffset="3" xadvance="3" page="0" chnl="15"/> + <char id="310" x="161" y="47" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="311" x="2" y="47" width="4" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="312" x="83" y="47" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="313" x="8" y="48" width="4" height="8" xoffset="0" yoffset="1" xadvance="5" page="0" chnl="15"/> + <char id="314" x="252" y="41" width="2" height="8" xoffset="0" yoffset="1" xadvance="2" page="0" chnl="15"/> + <char id="315" x="25" y="48" width="4" height="7" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="316" x="211" y="44" width="2" height="7" xoffset="-1" yoffset="4" xadvance="1" page="0" chnl="15"/> + <char id="317" x="60" y="48" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="318" x="75" y="48" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="319" x="184" y="48" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="320" x="149" y="48" width="3" height="5" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="321" x="197" y="48" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="322" x="89" y="49" width="3" height="5" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="323" x="102" y="49" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="324" x="222" y="49" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="325" x="131" y="50" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="326" x="215" y="50" width="4" height="6" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="327" x="44" y="51" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="328" x="51" y="51" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="329" x="66" y="51" width="6" height="5" xoffset="0" yoffset="4" xadvance="7" page="0" chnl="15"/> + <char id="330" x="168" y="51" width="5" height="6" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="331" x="238" y="51" width="4" height="5" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="332" x="94" y="52" width="5" height="7" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="333" x="175" y="52" width="4" height="6" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="334" x="204" y="52" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="335" x="244" y="52" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="336" x="14" y="53" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="337" x="250" y="52" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="338" x="109" y="53" width="9" height="5" xoffset="0" yoffset="4" xadvance="10" page="0" chnl="15"/> + <char id="339" x="120" y="53" width="7" height="4" xoffset="0" yoffset="5" xadvance="8" page="0" chnl="15"/> + <char id="340" x="81" y="53" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="341" x="228" y="49" width="3" height="7" xoffset="0" yoffset="2" xadvance="4" page="0" chnl="15"/> + <char id="342" x="138" y="53" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="343" x="191" y="54" width="3" height="6" xoffset="0" yoffset="5" xadvance="4" page="0" chnl="15"/> + <char id="344" x="31" y="55" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="345" x="38" y="55" width="3" height="7" xoffset="0" yoffset="2" xadvance="4" page="0" chnl="15"/> + <char id="346" x="57" y="55" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="347" x="74" y="55" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="348" x="145" y="55" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="349" x="181" y="55" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="350" x="196" y="55" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="351" x="2" y="56" width="4" height="6" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="352" x="152" y="56" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="353" x="88" y="56" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="354" x="159" y="56" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="355" x="233" y="56" width="3" height="7" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="356" x="21" y="57" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="357" x="8" y="58" width="4" height="6" xoffset="0" yoffset="3" xadvance="4" page="0" chnl="15"/> + <char id="358" x="64" y="58" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="359" x="211" y="58" width="3" height="5" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="360" x="216" y="58" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="361" x="223" y="58" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="362" x="101" y="59" width="5" height="7" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="363" x="238" y="58" width="4" height="6" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="364" x="120" y="59" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="365" x="127" y="59" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="366" x="166" y="59" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="367" x="51" y="60" width="4" height="8" xoffset="0" yoffset="1" xadvance="5" page="0" chnl="15"/> + <char id="368" x="108" y="60" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="369" x="173" y="60" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="370" x="43" y="61" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="371" x="94" y="61" width="4" height="6" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="372" x="244" y="61" width="7" height="8" xoffset="0" yoffset="1" xadvance="8" page="0" chnl="15"/> + <char id="373" x="133" y="62" width="7" height="7" xoffset="0" yoffset="2" xadvance="8" page="0" chnl="15"/> + <char id="374" x="187" y="62" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="375" x="203" y="62" width="4" height="9" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="376" x="14" y="63" width="5" height="7" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="377" x="80" y="63" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="378" x="2" y="64" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="379" x="71" y="64" width="5" height="7" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="380" x="179" y="64" width="4" height="6" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="381" x="194" y="64" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="382" x="28" y="65" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="383" x="187" y="55" width="2" height="5" xoffset="0" yoffset="4" xadvance="3" page="0" chnl="15"/> + <char id="384" x="34" y="65" width="4" height="6" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="385" x="57" y="65" width="6" height="5" xoffset="0" yoffset="4" xadvance="7" page="0" chnl="15"/> + <char id="386" x="87" y="65" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="387" x="65" y="65" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="388" x="142" y="65" width="6" height="5" xoffset="0" yoffset="4" xadvance="7" page="0" chnl="15"/> + <char id="389" x="159" y="65" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="390" x="209" y="65" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="391" x="229" y="65" width="6" height="5" xoffset="0" yoffset="4" xadvance="7" page="0" chnl="15"/> + <char id="392" x="150" y="66" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="393" x="100" y="68" width="6" height="5" xoffset="0" yoffset="4" xadvance="7" page="0" chnl="15"/> + <char id="394" x="216" y="68" width="6" height="5" xoffset="0" yoffset="4" xadvance="7" page="0" chnl="15"/> + <char id="395" x="237" y="66" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="396" x="8" y="66" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="397" x="21" y="67" width="4" height="6" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="398" x="115" y="69" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="399" x="127" y="68" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="400" x="166" y="69" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="401" x="40" y="70" width="6" height="6" xoffset="0" yoffset="4" xadvance="7" page="0" chnl="15"/> + <char id="402" x="115" y="60" width="3" height="6" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="403" x="48" y="70" width="6" height="6" xoffset="0" yoffset="3" xadvance="7" page="0" chnl="15"/> + <char id="404" x="108" y="70" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="405" x="133" y="71" width="7" height="5" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="406" x="229" y="58" width="2" height="5" xoffset="0" yoffset="4" xadvance="3" page="0" chnl="15"/> + <char id="407" x="224" y="67" width="3" height="5" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="408" x="244" y="71" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="409" x="94" y="69" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="410" x="122" y="69" width="3" height="5" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="411" x="173" y="69" width="4" height="5" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="412" x="56" y="72" width="7" height="4" xoffset="0" yoffset="5" xadvance="8" page="0" chnl="15"/> + <char id="413" x="142" y="72" width="6" height="6" xoffset="0" yoffset="4" xadvance="7" page="0" chnl="15"/> + <char id="414" x="14" y="72" width="4" height="5" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="415" x="87" y="72" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="416" x="157" y="72" width="6" height="5" xoffset="0" yoffset="4" xadvance="7" page="0" chnl="15"/> + <char id="417" x="179" y="72" width="5" height="4" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="418" x="186" y="72" width="6" height="5" xoffset="0" yoffset="4" xadvance="7" page="0" chnl="15"/> + <char id="419" x="229" y="72" width="6" height="5" xoffset="0" yoffset="5" xadvance="7" page="0" chnl="15"/> + <char id="420" x="2" y="73" width="6" height="5" xoffset="0" yoffset="4" xadvance="7" page="0" chnl="15"/> + <char id="421" x="65" y="72" width="4" height="6" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="422" x="209" y="72" width="5" height="6" xoffset="0" yoffset="3" xadvance="6" page="0" chnl="15"/> + <char id="423" x="71" y="73" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="424" x="34" y="73" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="425" x="78" y="73" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="426" x="251" y="71" width="3" height="6" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="427" x="150" y="73" width="3" height="7" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="428" x="201" y="73" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="429" x="10" y="73" width="2" height="5" xoffset="0" yoffset="4" xadvance="3" page="0" chnl="15"/> + <char id="430" x="237" y="73" width="5" height="6" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="431" x="20" y="75" width="6" height="6" xoffset="0" yoffset="3" xadvance="7" page="0" chnl="15"/> + <char id="432" x="194" y="74" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="433" x="100" y="75" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="434" x="216" y="75" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="435" x="115" y="76" width="6" height="5" xoffset="0" yoffset="4" xadvance="7" page="0" chnl="15"/> + <char id="436" x="123" y="76" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="437" x="165" y="76" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="438" x="28" y="74" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="439" x="223" y="75" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="440" x="94" y="76" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="441" x="172" y="76" width="4" height="5" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="442" x="107" y="77" width="4" height="5" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="443" x="40" y="78" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="444" x="47" y="78" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="445" x="54" y="78" width="4" height="5" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="446" x="60" y="78" width="3" height="5" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="447" x="130" y="78" width="4" height="6" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="448" x="186" y="22" width="1" height="5" xoffset="0" yoffset="4" xadvance="2" page="0" chnl="15"/> + <char id="449" x="136" y="78" width="3" height="5" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="450" x="178" y="78" width="3" height="5" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="451" x="120" y="24" width="1" height="5" xoffset="1" yoffset="4" xadvance="3" page="0" chnl="15"/> + <char id="452" x="2" y="80" width="11" height="8" xoffset="0" yoffset="1" xadvance="12" page="0" chnl="15"/> + <char id="453" x="244" y="79" width="10" height="7" xoffset="0" yoffset="2" xadvance="11" page="0" chnl="15"/> + <char id="454" x="183" y="79" width="9" height="7" xoffset="0" yoffset="2" xadvance="10" page="0" chnl="15"/> + <char id="455" x="85" y="79" width="7" height="5" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="456" x="155" y="79" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="457" x="15" y="79" width="3" height="7" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="458" x="28" y="80" width="9" height="5" xoffset="0" yoffset="4" xadvance="10" page="0" chnl="15"/> + <char id="459" x="65" y="80" width="7" height="7" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="460" x="229" y="79" width="6" height="7" xoffset="0" yoffset="4" xadvance="7" page="0" chnl="15"/> + <char id="461" x="74" y="80" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="462" x="141" y="80" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="463" x="201" y="80" width="3" height="8" xoffset="-1" yoffset="1" xadvance="2" page="0" chnl="15"/> + <char id="464" x="206" y="80" width="3" height="6" xoffset="-1" yoffset="3" xadvance="2" page="0" chnl="15"/> + <char id="465" x="194" y="81" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="466" x="237" y="81" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="467" x="100" y="82" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="468" x="147" y="82" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="469" x="211" y="82" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="470" x="218" y="82" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="471" x="20" y="83" width="5" height="9" xoffset="0" yoffset="0" xadvance="6" page="0" chnl="15"/> + <char id="472" x="94" y="83" width="4" height="8" xoffset="0" yoffset="1" xadvance="5" page="0" chnl="15"/> + <char id="473" x="113" y="83" width="5" height="9" xoffset="0" yoffset="0" xadvance="6" page="0" chnl="15"/> + <char id="474" x="162" y="83" width="4" height="8" xoffset="0" yoffset="1" xadvance="5" page="0" chnl="15"/> + <char id="475" x="168" y="83" width="5" height="9" xoffset="0" yoffset="0" xadvance="6" page="0" chnl="15"/> + <char id="476" x="107" y="84" width="4" height="8" xoffset="0" yoffset="1" xadvance="5" page="0" chnl="15"/> + <char id="477" x="39" y="85" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="478" x="45" y="85" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="479" x="52" y="85" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="480" x="58" y="85" width="5" height="9" xoffset="0" yoffset="0" xadvance="6" page="0" chnl="15"/> + <char id="481" x="120" y="85" width="4" height="8" xoffset="0" yoffset="1" xadvance="5" page="0" chnl="15"/> + <char id="482" x="81" y="86" width="9" height="7" xoffset="0" yoffset="2" xadvance="10" page="0" chnl="15"/> + <char id="483" x="126" y="86" width="7" height="6" xoffset="0" yoffset="3" xadvance="8" page="0" chnl="15"/> + <char id="484" x="175" y="85" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="485" x="135" y="86" width="4" height="6" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="486" x="27" y="87" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="487" x="153" y="88" width="4" height="9" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="488" x="182" y="88" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="489" x="224" y="88" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="490" x="230" y="88" width="5" height="7" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="491" x="243" y="88" width="4" height="6" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="492" x="249" y="88" width="5" height="9" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="493" x="65" y="89" width="4" height="8" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="494" x="141" y="89" width="4" height="8" xoffset="0" yoffset="1" xadvance="5" page="0" chnl="15"/> + <char id="495" x="2" y="90" width="4" height="8" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="496" x="34" y="87" width="3" height="8" xoffset="-1" yoffset="3" xadvance="2" page="0" chnl="15"/> + <char id="497" x="189" y="91" width="11" height="5" xoffset="0" yoffset="4" xadvance="12" page="0" chnl="15"/> + <char id="498" x="8" y="90" width="10" height="5" xoffset="0" yoffset="4" xadvance="11" page="0" chnl="15"/> + <char id="499" x="202" y="92" width="9" height="5" xoffset="0" yoffset="4" xadvance="10" page="0" chnl="15"/> + <char id="500" x="71" y="90" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="501" x="237" y="90" width="4" height="9" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="502" x="213" y="92" width="8" height="5" xoffset="0" yoffset="4" xadvance="9" page="0" chnl="15"/> + <char id="503" x="39" y="91" width="4" height="7" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="504" x="100" y="92" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="505" x="147" y="91" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="506" x="175" y="92" width="5" height="9" xoffset="0" yoffset="0" xadvance="6" page="0" chnl="15"/> + <char id="507" x="92" y="93" width="4" height="8" xoffset="0" yoffset="1" xadvance="5" page="0" chnl="15"/> + <char id="508" x="107" y="94" width="9" height="8" xoffset="0" yoffset="1" xadvance="10" page="0" chnl="15"/> + <char id="509" x="159" y="93" width="7" height="7" xoffset="0" yoffset="2" xadvance="8" page="0" chnl="15"/> + <char id="510" x="20" y="94" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="511" x="52" y="94" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="710" x="235" y="24" width="3" height="2" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="711" x="224" y="82" width="3" height="2" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="713" x="20" y="36" width="3" height="1" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="728" x="206" y="88" width="3" height="2" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="729" x="154" y="17" width="1" height="1" xoffset="0" yoffset="6" xadvance="2" page="0" chnl="15"/> + <char id="730" x="126" y="94" width="3" height="3" xoffset="0" yoffset="5" xadvance="4" page="0" chnl="15"/> + <char id="731" x="150" y="25" width="2" height="3" xoffset="0" yoffset="8" xadvance="3" page="0" chnl="15"/> + <char id="732" x="131" y="94" width="4" height="2" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="733" x="168" y="94" width="3" height="2" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="890" x="192" y="30" width="2" height="2" xoffset="0" yoffset="9" xadvance="3" page="0" chnl="15"/> + <char id="900" x="116" y="34" width="2" height="2" xoffset="0" yoffset="4" xadvance="3" page="0" chnl="15"/> + <char id="901" x="45" y="95" width="3" height="3" xoffset="0" yoffset="3" xadvance="4" page="0" chnl="15"/> + <char id="902" x="78" y="95" width="7" height="5" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="903" x="71" y="18" width="1" height="1" xoffset="0" yoffset="6" xadvance="2" page="0" chnl="15"/> + <char id="904" x="8" y="97" width="7" height="5" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="905" x="27" y="97" width="7" height="5" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="906" x="87" y="95" width="3" height="5" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="908" x="223" y="97" width="7" height="5" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="910" x="131" y="98" width="7" height="5" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="911" x="182" y="98" width="7" height="5" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="912" x="118" y="95" width="3" height="6" xoffset="0" yoffset="3" xadvance="4" page="0" chnl="15"/> + <char id="913" x="58" y="96" width="5" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="914" x="168" y="98" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="915" x="243" y="96" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="916" x="191" y="98" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="917" x="123" y="99" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="918" x="140" y="99" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="919" x="198" y="99" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="920" x="205" y="99" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="921" x="140" y="43" width="1" height="5" xoffset="0" yoffset="4" xadvance="2" page="0" chnl="15"/> + <char id="922" x="212" y="99" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="923" x="249" y="99" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="924" x="36" y="100" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="925" x="43" y="100" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="926" x="65" y="99" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="927" x="71" y="100" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="928" x="147" y="100" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="929" x="232" y="101" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="931" x="78" y="102" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="932" x="85" y="102" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="933" x="98" y="102" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="934" x="154" y="102" width="7" height="7" xoffset="0" yoffset="3" xadvance="8" page="0" chnl="15"/> + <char id="935" x="50" y="103" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="936" x="57" y="103" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="937" x="175" y="103" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="938" x="2" y="100" width="3" height="7" xoffset="-1" yoffset="2" xadvance="2" page="0" chnl="15"/> + <char id="939" x="239" y="103" width="5" height="7" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="940" x="92" y="103" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="941" x="7" y="104" width="4" height="8" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="942" x="13" y="104" width="4" height="8" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="943" x="219" y="99" width="2" height="7" xoffset="0" yoffset="2" xadvance="3" page="0" chnl="15"/> + <char id="944" x="19" y="104" width="4" height="8" xoffset="0" yoffset="1" xadvance="5" page="0" chnl="15"/> + <char id="945" x="25" y="104" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="946" x="105" y="104" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="947" x="111" y="104" width="4" height="6" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="948" x="117" y="104" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="949" x="223" y="104" width="4" height="5" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="950" x="163" y="102" width="3" height="7" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="951" x="130" y="105" width="4" height="5" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="952" x="168" y="105" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="953" x="199" y="34" width="2" height="4" xoffset="0" yoffset="5" xadvance="3" page="0" chnl="15"/> + <char id="954" x="182" y="105" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="955" x="188" y="105" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="956" x="64" y="106" width="5" height="6" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="957" x="123" y="106" width="5" height="4" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="958" x="31" y="104" width="3" height="8" xoffset="0" yoffset="3" xadvance="4" page="0" chnl="15"/> + <char id="959" x="136" y="106" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="960" x="194" y="106" width="5" height="4" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="961" x="201" y="106" width="4" height="6" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="962" x="207" y="106" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="963" x="246" y="106" width="5" height="4" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="964" x="142" y="106" width="3" height="4" xoffset="0" yoffset="5" xadvance="4" page="0" chnl="15"/> + <char id="965" x="213" y="106" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="966" x="36" y="107" width="5" height="6" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="967" x="43" y="107" width="5" height="5" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="968" x="71" y="107" width="5" height="5" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="969" x="147" y="107" width="5" height="4" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="970" x="229" y="108" width="3" height="6" xoffset="-1" yoffset="3" xadvance="3" page="0" chnl="15"/> + <char id="971" x="78" y="109" width="4" height="6" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="972" x="84" y="109" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="973" x="98" y="109" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="974" x="50" y="110" width="5" height="7" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="1024" x="57" y="110" width="5" height="8" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="1025" x="174" y="110" width="5" height="7" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="1026" x="154" y="111" width="7" height="6" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="1027" x="25" y="110" width="4" height="8" xoffset="0" yoffset="1" xadvance="5" page="0" chnl="15"/> + <char id="1028" x="104" y="111" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1029" x="181" y="111" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1030" x="121" y="45" width="1" height="5" xoffset="0" yoffset="4" xadvance="2" page="0" chnl="15"/> + <char id="1031" x="234" y="108" width="3" height="7" xoffset="-1" yoffset="2" xadvance="2" page="0" chnl="15"/> + <char id="1032" x="117" y="111" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="1033" x="219" y="111" width="8" height="5" xoffset="0" yoffset="4" xadvance="9" page="0" chnl="15"/> + <char id="1034" x="123" y="112" width="9" height="5" xoffset="0" yoffset="4" xadvance="10" page="0" chnl="15"/> + <char id="1035" x="90" y="112" width="6" height="5" xoffset="0" yoffset="4" xadvance="7" page="0" chnl="15"/> + <char id="1036" x="134" y="112" width="5" height="7" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="1037" x="163" y="112" width="5" height="7" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="1038" x="188" y="112" width="5" height="7" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="1039" x="207" y="112" width="5" height="6" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1040" x="239" y="112" width="5" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="1041" x="246" y="112" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1042" x="141" y="113" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1043" x="111" y="112" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="1044" x="2" y="114" width="6" height="6" xoffset="-1" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="1045" x="10" y="114" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1046" x="64" y="114" width="7" height="5" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="1047" x="17" y="114" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1048" x="43" y="114" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1049" x="195" y="114" width="5" height="7" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="1050" x="31" y="115" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1051" x="73" y="117" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1052" x="229" y="117" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1053" x="80" y="118" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1054" x="98" y="118" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1055" x="181" y="118" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1056" x="214" y="118" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1057" x="221" y="118" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1058" x="50" y="119" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1059" x="87" y="119" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1060" x="105" y="119" width="7" height="7" xoffset="0" yoffset="3" xadvance="8" page="0" chnl="15"/> + <char id="1061" x="114" y="119" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1062" x="121" y="119" width="6" height="6" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1063" x="148" y="119" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1064" x="170" y="119" width="7" height="5" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="1065" x="236" y="119" width="8" height="6" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="1066" x="246" y="119" width="7" height="5" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="1067" x="202" y="120" width="7" height="5" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="1068" x="155" y="119" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1069" x="24" y="120" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1070" x="10" y="121" width="7" height="5" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="1071" x="57" y="120" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1072" x="148" y="113" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="1073" x="141" y="120" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="1074" x="38" y="121" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="1075" x="44" y="121" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="1076" x="64" y="121" width="6" height="5" xoffset="-1" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="1077" x="129" y="121" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="1078" x="162" y="121" width="5" height="4" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="1079" x="135" y="121" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="1080" x="188" y="121" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="1081" x="2" y="122" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="1082" x="31" y="122" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="1083" x="194" y="123" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="1084" x="72" y="124" width="5" height="4" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="1085" x="228" y="124" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="1086" x="79" y="125" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="1087" x="94" y="125" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="1088" x="179" y="125" width="4" height="5" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="1089" x="211" y="125" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="1090" x="217" y="125" width="5" height="4" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="1091" x="50" y="126" width="4" height="5" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="1092" x="85" y="126" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1093" x="114" y="126" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="1094" x="147" y="126" width="5" height="5" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="1095" x="154" y="126" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="1096" x="169" y="126" width="5" height="4" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="1097" x="246" y="126" width="6" height="5" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="1098" x="19" y="127" width="5" height="4" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="1099" x="56" y="127" width="6" height="4" xoffset="0" yoffset="5" xadvance="7" page="0" chnl="15"/> + <char id="1100" x="44" y="127" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="1101" x="120" y="127" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="1102" x="126" y="127" width="5" height="4" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="1103" x="141" y="127" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="1104" x="160" y="127" width="4" height="7" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="1105" x="185" y="127" width="4" height="6" xoffset="0" yoffset="3" xadvance="5" page="0" chnl="15"/> + <char id="1106" x="200" y="127" width="5" height="6" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1107" x="234" y="127" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="1108" x="240" y="127" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="1109" x="8" y="128" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="1110" x="28" y="57" width="1" height="5" xoffset="0" yoffset="4" xadvance="2" page="0" chnl="15"/> + <char id="1111" x="100" y="125" width="3" height="5" xoffset="-1" yoffset="4" xadvance="2" page="0" chnl="15"/> + <char id="1112" x="224" y="125" width="2" height="6" xoffset="-1" yoffset="4" xadvance="2" page="0" chnl="15"/> + <char id="1113" x="26" y="128" width="7" height="4" xoffset="0" yoffset="5" xadvance="8" page="0" chnl="15"/> + <char id="1114" x="35" y="128" width="7" height="4" xoffset="0" yoffset="5" xadvance="8" page="0" chnl="15"/> + <char id="1115" x="64" y="128" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1116" x="105" y="128" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="1117" x="133" y="128" width="4" height="7" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="1118" x="191" y="129" width="4" height="8" xoffset="0" yoffset="2" xadvance="5" page="0" chnl="15"/> + <char id="1119" x="71" y="130" width="5" height="5" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="1120" x="207" y="131" width="7" height="5" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="1121" x="92" y="132" width="7" height="4" xoffset="0" yoffset="5" xadvance="8" page="0" chnl="15"/> + <char id="1122" x="111" y="132" width="7" height="5" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="1123" x="216" y="131" width="6" height="5" xoffset="0" yoffset="4" xadvance="7" page="0" chnl="15"/> + <char id="1124" x="166" y="132" width="7" height="5" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="1125" x="175" y="132" width="6" height="5" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="1126" x="14" y="133" width="9" height="5" xoffset="0" yoffset="4" xadvance="10" page="0" chnl="15"/> + <char id="1127" x="44" y="133" width="7" height="4" xoffset="0" yoffset="5" xadvance="8" page="0" chnl="15"/> + <char id="1128" x="78" y="133" width="11" height="5" xoffset="0" yoffset="4" xadvance="12" page="0" chnl="15"/> + <char id="1129" x="53" y="133" width="9" height="4" xoffset="0" yoffset="5" xadvance="10" page="0" chnl="15"/> + <char id="1130" x="139" y="133" width="7" height="5" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="1131" x="126" y="133" width="5" height="4" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="1132" x="148" y="133" width="9" height="5" xoffset="0" yoffset="4" xadvance="10" page="0" chnl="15"/> + <char id="1133" x="224" y="133" width="7" height="4" xoffset="0" yoffset="5" xadvance="8" page="0" chnl="15"/> + <char id="1134" x="246" y="133" width="5" height="10" xoffset="0" yoffset="1" xadvance="6" page="0" chnl="15"/> + <char id="1135" x="2" y="131" width="4" height="10" xoffset="0" yoffset="1" xadvance="5" page="0" chnl="15"/> + <char id="1136" x="25" y="134" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1137" x="32" y="134" width="5" height="5" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="1138" x="64" y="135" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1139" x="8" y="134" width="4" height="4" xoffset="0" yoffset="5" xadvance="5" page="0" chnl="15"/> + <char id="1140" x="183" y="135" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="1141" x="197" y="135" width="5" height="4" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="1142" x="159" y="136" width="5" height="7" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="1143" x="233" y="136" width="5" height="6" xoffset="0" yoffset="3" xadvance="6" page="0" chnl="15"/> + <char id="1144" x="91" y="138" width="10" height="6" xoffset="0" yoffset="4" xadvance="11" page="0" chnl="15"/> + <char id="1145" x="204" y="138" width="9" height="5" xoffset="0" yoffset="5" xadvance="10" page="0" chnl="15"/> + <char id="1146" x="215" y="138" width="7" height="7" xoffset="0" yoffset="3" xadvance="8" page="0" chnl="15"/> + <char id="1147" x="39" y="139" width="7" height="6" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="1148" x="48" y="139" width="7" height="7" xoffset="0" yoffset="2" xadvance="8" page="0" chnl="15"/> + <char id="1149" x="103" y="139" width="7" height="6" xoffset="0" yoffset="3" xadvance="8" page="0" chnl="15"/> + <char id="1150" x="112" y="139" width="7" height="7" xoffset="0" yoffset="2" xadvance="8" page="0" chnl="15"/> + <char id="1151" x="121" y="139" width="7" height="6" xoffset="0" yoffset="3" xadvance="8" page="0" chnl="15"/> + <char id="8208" x="138" y="50" width="3" height="1" xoffset="0" yoffset="6" xadvance="4" page="0" chnl="15"/> + <char id="8209" x="228" y="130" width="4" height="1" xoffset="0" yoffset="6" xadvance="5" page="0" chnl="15"/> + <char id="8210" x="120" y="134" width="4" height="1" xoffset="0" yoffset="6" xadvance="5" page="0" chnl="15"/> + <char id="8211" x="133" y="59" width="3" height="1" xoffset="0" yoffset="6" xadvance="4" page="0" chnl="15"/> + <char id="8212" x="240" y="134" width="4" height="1" xoffset="0" yoffset="6" xadvance="5" page="0" chnl="15"/> + <char id="8216" x="61" y="33" width="1" height="2" xoffset="0" yoffset="4" xadvance="2" page="0" chnl="15"/> + <char id="8217" x="253" y="37" width="1" height="2" xoffset="0" yoffset="4" xadvance="2" page="0" chnl="15"/> + <char id="8218" x="211" y="53" width="2" height="3" xoffset="-1" yoffset="8" xadvance="2" page="0" chnl="15"/> + <char id="8220" x="232" y="97" width="3" height="2" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="8221" x="2" y="109" width="3" height="2" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="8222" x="71" y="137" width="4" height="3" xoffset="-1" yoffset="8" xadvance="4" page="0" chnl="15"/> + <char id="8224" x="214" y="112" width="3" height="4" xoffset="0" yoffset="5" xadvance="4" page="0" chnl="15"/> + <char id="8225" x="133" y="137" width="3" height="7" xoffset="0" yoffset="3" xadvance="4" page="0" chnl="15"/> + <char id="8226" x="113" y="21" width="1" height="1" xoffset="0" yoffset="6" xadvance="2" page="0" chnl="15"/> + <char id="8230" x="57" y="139" width="5" height="1" xoffset="0" yoffset="8" xadvance="6" page="0" chnl="15"/> + <char id="8240" x="166" y="139" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="8249" x="81" y="80" width="2" height="3" xoffset="0" yoffset="5" xadvance="3" page="0" chnl="15"/> + <char id="8250" x="170" y="112" width="2" height="3" xoffset="0" yoffset="5" xadvance="3" page="0" chnl="15"/> + <char id="8260" x="173" y="139" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="8364" x="224" y="139" width="6" height="5" xoffset="0" yoffset="4" xadvance="7" page="0" chnl="15"/> + <char id="8480" x="8" y="140" width="8" height="3" xoffset="0" yoffset="4" xadvance="9" page="0" chnl="15"/> + <char id="8482" x="77" y="140" width="8" height="3" xoffset="0" yoffset="4" xadvance="9" page="0" chnl="15"/> + <char id="8486" x="190" y="139" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="8592" x="18" y="140" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="8593" x="138" y="140" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="8594" x="145" y="140" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="8595" x="152" y="140" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="8596" x="25" y="141" width="9" height="5" xoffset="0" yoffset="4" xadvance="10" page="0" chnl="15"/> + <char id="8597" x="197" y="141" width="5" height="9" xoffset="0" yoffset="2" xadvance="6" page="0" chnl="15"/> + <char id="8598" x="57" y="142" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="8599" x="64" y="142" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="8600" x="180" y="142" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="8601" x="232" y="144" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="8628" x="239" y="144" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="8629" x="2" y="145" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="8672" x="9" y="145" width="7" height="5" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="8673" x="71" y="145" width="5" height="7" xoffset="0" yoffset="3" xadvance="6" page="0" chnl="15"/> + <char id="8674" x="78" y="145" width="7" height="5" xoffset="0" yoffset="4" xadvance="8" page="0" chnl="15"/> + <char id="8675" x="159" y="145" width="5" height="7" xoffset="0" yoffset="3" xadvance="6" page="0" chnl="15"/> + <char id="8706" x="240" y="137" width="3" height="5" xoffset="0" yoffset="4" xadvance="4" page="0" chnl="15"/> + <char id="8710" x="204" y="145" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="8719" x="246" y="145" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="8721" x="87" y="146" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="8722" x="71" y="142" width="4" height="1" xoffset="0" yoffset="6" xadvance="5" page="0" chnl="15"/> + <char id="8729" x="241" y="29" width="1" height="1" xoffset="0" yoffset="6" xadvance="2" page="0" chnl="15"/> + <char id="8730" x="94" y="146" width="5" height="4" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="8734" x="130" y="146" width="5" height="3" xoffset="0" yoffset="5" xadvance="6" page="0" chnl="15"/> + <char id="8747" x="166" y="146" width="3" height="7" xoffset="-1" yoffset="3" xadvance="3" page="0" chnl="15"/> + <char id="8776" x="171" y="146" width="5" height="5" xoffset="0" yoffset="3" xadvance="6" page="0" chnl="15"/> + <char id="8800" x="187" y="146" width="5" height="5" xoffset="0" yoffset="4" xadvance="6" page="0" chnl="15"/> + <char id="8804" x="224" y="146" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="8805" x="18" y="147" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="8946" x="36" y="147" width="5" height="5" xoffset="0" yoffset="3" xadvance="6" page="0" chnl="15"/> + <char id="9674" x="202" y="114" width="3" height="3" xoffset="0" yoffset="5" xadvance="4" page="0" chnl="15"/> + <char id="57344" x="101" y="147" width="4" height="4" xoffset="0" yoffset="5" xadvance="4" page="0" chnl="15"/> + <char id="61440" x="75" y="5" width="0" height="0" xoffset="0" yoffset="9" xadvance="8" page="0" chnl="15"/> + <char id="61441" x="121" y="147" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="61442" x="137" y="147" width="4" height="5" xoffset="0" yoffset="4" xadvance="5" page="0" chnl="15"/> + <char id="32" x="0" y="0" width="0" height="0" xoffset="0" yoffset="4" xadvance="3" page="0" chnl="15"/> + </chars> +</font> \ No newline at end of file diff --git a/games/aground/data/mods/fan_translations/fonts/uni.png b/games/aground/data/mods/fan_translations/fonts/uni.png new file mode 100644 index 00000000..15a88d20 Binary files /dev/null and b/games/aground/data/mods/fan_translations/fonts/uni.png differ diff --git a/games/aground/data/mods/fan_translations/fr.xml b/games/aground/data/mods/fan_translations/fr.xml new file mode 100644 index 00000000..74611120 --- /dev/null +++ b/games/aground/data/mods/fan_translations/fr.xml @@ -0,0 +1,1380 @@ +<?xml version="1.0" encoding="utf-8" ?> +<lang id="fr" name="Français" version="1.3.1"> +<!-- Translated by Monthy +<!-- Adapted for 1.3.1 -->--> + <section id="common"> + <text id="accept">Accepter</text> + <text id="add_animal">Ajouter Animal</text> + <text id="add_feed">Ajouter nourriture</text> + <text id="add_fuel">Ajouter carburant</text> + <text id="add_rations">Ajouter Rations</text> + <text id="add_storehouse_items">Inclure l'Entrepôt</text> + <text id="addition_slots">Champs:</text> + <text id="all">Tous</text> + <text id="auto_eat">Vous avez manger {count} {item} pour regagner de la vie</text> + <text id="auto_eat_stamina">Utilisé {count} {item} pour restaurer de l'énergie</text> + <text id="auto_feed">Nourrir automatiquement {item} à celui-ci?{list}</text> + <text id="auto_fuel">Alimenter {item} avec les éléments suivants? {list}</text> + <text id="blocked">Bloqué!</text> + <text id="broken">{item} est cassé!</text> + <text id="buy">Acheter</text> + <text id="buy_item">Combien en voudriez-vous acheter?</text> + <text id="cancel">Annuler</text> + <text id="capacity">Porter:</text> + <text id="capture">Capture</text> + <text id="coins">Pièce</text> + <text id="collect_complete">Récolte Complété</text> + <text id="complete">Complété</text> + <text id="continue">Continuer</text> + <text id="cooldown">Recharge</text> + <text id="corrupt_slot">Sauvegarde Corrompu</text> + <text id="craft">Combien voulez-vous fabriquer?</text> + <text id="creates">-- Créer --</text> + <text id="critical_hit">Coup Critique!</text> + <text id="cut">Couper:</text> + <text id="damage">Dégâts</text> + <text id="damaged">{item} va bientôt se briser!</text> + <text id="defense_short">DEF</text> + <text id="del_save">Sauvegarde supprimée</text> + <text id="dockhouse">Port</text> + <text id="dodged">Esquivé!</text> + <text id="drink_item">Combien voulez-vous boire?</text> + <text id="drop_all">Êtes-vous sûr de vouloir jeter tous vos {item}? Ils seront partis pour de bon.</text> + <text id="drop_item">Combien aimeriez-vous jeter?</text> + <text id="durability">Durabilité</text> + <text id="eat_item">Combien voulez-vous manger?</text> + <text id="effective">{element} Critique!</text> + <text id="empty">Libre</text> + <text id="empty_slot">< Emplacement Libre ></text> + <text id="enchantment">Enchantement</text> + <text id="equipment">Équipement</text> + <text id="exit">Quitter</text> + <text id="experience">Exp:</text> + <text id="factory">Usine</text> + <text id="feed">Nourrir</text> + <text id="fight">Combattre</text> + <text id="fishing">Pêcher:</text> + <text id="fishing_fail">Il est parti!</text> + <text id="fishing_hooked">Attendez ...</text> + <text id="fishing_line">Quelque chose tire sur la ligne!</text> + <text id="fishing_pull">Tirer maintenant!</text> + <text id="flight">Hauteur de vol:</text> + <text id="forums">Communauté</text> + <text id="fuel">Carburant</text> + <text id="harvest">Récolte</text> + <text id="harvest_all">Tout Récolter</text> + <text id="health">Vie:</text> + <text id="health_short">Vie</text> + <text id="hotkey">Sélectionner l'Objet</text> + <text id="hungry">{item} est affamé!</text> + <text id="inventory">Inventaire</text> + <text id="kitchen">Cuisine</text> + <text id="knockback">Recul:</text> + <text id="lab">Laboratoire</text> + <text id="level">Niveau:</text> + <text id="level_up">Niveau Gagné!</text> + <text id="manage">Gérer</text> + <text id="miss">Raté!</text> + <text id="move">Mouvement</text> + <text id="move_all">Bougé Tout</text> + <text id="muted">Jeu en Sourdine</text> + <text id="newgame">Nouvelle Partie</text> + <text id="no">Non</text> + <text id="none">Aucun(e)</text> + <text id="not_hungry">{item} n'est pas affamé.</text> + <text id="ok">Ok</text> + <text id="options">Options</text> + <text id="order">Pré-Commander</text> + <text id="overwrite">Êtes-vous sûr de vouloir supprimer l'emplacement?</text> + <text id="placed">{item} placé.</text> + <text id="power">Puissance</text> + <text id="power_plant">Centrale Électrique</text> + <text id="quests">Quêtes</text> + <text id="range">Portée:</text> + <text id="rations">Rations</text> + <text id="recharge_batteries">Recharger Batteries</text> + <text id="reject">Refuser</text> + <text id="rem_storehouse_items">Inventaire seulement</text> + <text id="remove">Retirer</text> + <text id="rename">Définir le nom de l'élément {item} :</text> + <text id="repair_cost">-- Coût de réparation --</text> + <text id="repaired">{item} Réparer.</text> + <text id="requires">-- Ingrédients --</text> + <text id="reset">Réinitialiser</text> + <text id="resist">Résistance {element}!</text> + <text id="restore_power">Toutes les batteries sont rechargés!</text> + <text id="retransform">{item} va bientôt se détruire! Utiliser ceci pour le fixer?{list}</text> + <text id="retrieve_item">Combien voulez-vous en retirer?</text> + <text id="retry">Recommencer</text> + <text id="run_away">S'enfuir</text> + <text id="save">Partie Sauvegardé</text> + <text id="save_corrupt">Sauvegarde corrompue! Commencer une nouvelle partie.</text> + <text id="save_prompt_magic">Ceci est la fin de la démo pour le chemin de Magie. Voudriez-vous sauvegarder?</text> + <text id="save_prompt_science">Ceci est la fin de la démo pour le chemin de Science. Voudriez-vous sauvegarder?</text> + <text id="select_feed">Sélectionner la nourriture</text> + <text id="select_fertilizer">Sélectionner l'engrais</text> + <text id="sell">Vendre</text> + <text id="sell_item">Combien voulez-vous en vendre?</text> + <text id="set_hotkey">Sélectionner le raccourci</text> + <text id="set_sticky">Associer [tile=sticky] l'item à une touche</text> + <text id="set_time">Quelle heure voudrais-tu te rendre(Format 24 heures)?</text> + <text id="sign_message">Définir le message du [item=sign]:</text> + <text id="smelter">Forge</text> + <text id="speed">Vitesse:</text> + <text id="spirits">Esprits</text> + <text id="stamina">Énergie:</text> + <text id="stamina_per_hit">Énergie par coup:</text> + <text id="store_item">Combien voulez-vous en stocker?</text> + <text id="storehouse">Entrepôt</text> + <text id="storehouse_add">{npc} a ajouter {count} {item} à l' [color=ff2222]entrepôt [/color]</text> + <text id="synthesizer">Synthétiseur</text> + <text id="time_manipulator">Manipulateur de temps</text> + <text id="title">Menu Principal</text> + <text id="transform">Combien veux-tu transformer en {into}?</text> + <text id="uncraft">Combien veux-tu dé-transformer?</text> + <text id="unmuted">Jeu bruyant</text> + <text id="use_count">Combien voulez-vous en utiliser?</text> + <text id="uses">Utilise</text> + <text id="warehouse">Entrepôt</text> + <text id="workshop">Établi</text> + <text id="wyrm_pen">Enclos à Wyrms Pen</text> + <text id="yes">Oui</text> + </section> + <section id="stats"> + <text id="attack">Attaque</text> + <text id="bargaining">Négocier</text> + <text id="critical">Critique</text> + <text id="cut">Couper</text> + <text id="defense">Défense</text> + <text id="endurance">Endurance</text> + <text id="evasion">Évasion</text> + <text id="fishing">Pêche</text> + <text id="health">Max Santé</text> + <text id="max">{mod} ({current}/{max})</text> + <text id="mine">Minage</text> + <text id="mine_speed">Vitesse Minage</text> + <text id="range">Portée</text> + <text id="sight">Vue</text> + <text id="speed">Vitesse</text> + <text id="stamina">Max énergie</text> + <text id="time">{mod} pour {time}s</text> + <text id="view">Voir Statisques</text> + <text id="weight">Poids</text> + </section> + <section id="stat.descriptions"> + <text id="attack">Augmente les dégâts pour chaque attaque de mêlée.</text> + <text id="bargaining">Augmente le coût de vente des articles.</text> + <text id="critical">Augmente les chances de coup critique de mêlée.</text> + <text id="cut">Augmente les dégâts lorsque vous coupez des arbres.</text> + <text id="defense">Diminue les dégâts en cas de coup.</text> + <text id="endurance">Diminue le coût d'endurance pour les mouvements.</text> + <text id="evasion">Augmente les chances d'échec de l'ennemi.</text> + <text id="fishing">Rend les poissons difficiles à attraper plus facile.</text> + <text id="health">Combien de coups vous pouvez prendre avant de mourir.</text> + <text id="mine">Vous permet d'extraire des dalles plus dures.</text> + <text id="mine_speed">Vous permet d'extraire les dalles plus rapidement.</text> + <text id="range">Augmente la portée pour toutes les armes à distance.</text> + <text id="sight">Révèle plus de carreaux lors du déplacement et de l'extraction.</text> + <text id="speed">À quelle vitesse vous pouvez vous déplacer.</text> + <text id="stamina">Combien d'actions pouvez-vous entreprendre avant de perdre la santé.</text> + <text id="weight">Augmente la capacité de charge de base.</text> + </section> + <section id="skill"> + <text id="allocate">Attribuer les points de compétence</text> + <text id="max">[color=770000]Compétence Perfectionnée</text> + <text id="points">Poinds de compétence</text> + </section> + <section id="actions"> + <text id="build">Construire</text> + <text id="carve">Graver</text> + <text id="collect">Collecter</text> + <text id="craft">Créer</text> + <text id="disable_attack">Désactiver Attaque</text> + <text id="drop">Jeter</text> + <text id="eat">Manger</text> + <text id="enable_attack">Activer Attaque</text> + <text id="enchant">Enchanter</text> + <text id="enrage">Enrager</text> + <text id="equip">Équiper</text> + <text id="feed">Nourrir</text> + <text id="fill">Remplir</text> + <text id="fire">Feu</text> + <text id="loot">Butin</text> + <text id="open">ouvrir</text> + <text id="place">Placer</text> + <text id="plant">Plante</text> + <text id="rename">Renommer</text> + <text id="repair">Réparer</text> + <text id="reset_skills">Réinitialiser les compétences</text> + <text id="setProjectile">Sélectionner Projectile</text> + <text id="set_time">Régler le temps</text> + <text id="summon">Invoquer</text> + <text id="switch">échanger</text> + <text id="synthesize">Synthétiseur</text> + <text id="transform">Transformer</text> + <text id="uncraft">Dé-créer</text> + <text id="unequip">Déséquiper</text> + <text id="upgrade">Améliorer</text> + <text id="use">Utiliser</text> + </section> + <section id="item.names"> + <text id="adult_dragon">Dragon Adulte</text> + <text id="alter_gem">Gemme Alter</text> + <text id="anvil">Enclume</text> + <text id="area_name_sign">Plaque d'identification</text> + <text id="arrow">Flèche</text> + <text id="attack_potion">Potion d'Attaque</text> + <text id="baby_cannon">Bébé Cannon</text> + <text id="backpack">Sac à Dos</text> + <text id="bandage">Bandage</text> + <text id="battery">Batterie</text> + <text id="berries">Baies</text> + <text id="blood_gem">Gemme de Sang</text> + <text id="boat">Bateau</text> + <text id="bow">Arc</text> + <text id="bread">Pain</text> + <text id="broken_pickaxe">Pioche cassé</text> + <text id="buckler">Bouclier</text> + <text id="bullet">Balles</text> + <text id="bush_seed">Semence de buisson</text> + <text id="cake">Gâteau</text> + <text id="campfire">Feu de camp</text> + <text id="candy_apple">Pomme bonbon</text> + <text id="cat">Chat</text> + <text id="chainsaw">Scie à chaine</text> + <text id="cheese">Fromage</text> + <text id="cheeseburger">Cheeseburger</text> + <text id="chest">Coffre</text> + <text id="chicken">Poule</text> + <text id="cloth">Tissu</text> + <text id="coal">Charbon</text> + <text id="cockatiel">Cockatiel</text> + <text id="cocoon">Cocon</text> + <text id="coin_purse">Porte-Monnaie</text> + <text id="coral_cod">Morue de corail</text> + <text id="cotton">Cotton</text> + <text id="cotton_seed">Graine de cotton</text> + <text id="cow">Vache</text> + <text id="crowbar">Dos de Cyborg</text> + <text id="cyborg_back">Dos de Cyborg</text> + <text id="cyborg_body">Corps de Cyborg</text> + <text id="cyborg_eye">œil de Cyborg</text> + <text id="dark_fur">Fourrure de l'ombre</text> + <text id="defense_potion">Potion de Défense</text> + <text id="diamond">Diamant</text> + <text id="diode_wolf">Diode loup</text> + <text id="dismantle">Démanteler</text> + <text id="dragon">Bébé Dragon</text> + <text id="dragon_armor">Armure de Dragon</text> + <text id="dragonblood">Sang de Dragon</text> + <text id="dragonflame">Flamme de Dragon</text> + <text id="dragonsword">Épée Dragon</text> + <text id="drain_arrow">Flèche Sangsue</text> + <text id="drain_bullet">Balle Sangsue</text> + <text id="drain_chainsaw">Scie à chaine Sangsue</text> + <text id="drain_shell">Obus Sangsue</text> + <text id="drain_sword">Épée Sangsue</text> + <text id="drill">Perceuse</text> + <text id="earth_armor">Armure de Terre</text> + <text id="earth_gem">Gemme de Terre</text> + <text id="earth_hammer">Marteau de Terre</text> + <text id="earth_helm">Casque de Terre</text> + <text id="eggs">Œufs</text> + <text id="electric_eel">Anguille Électrique</text> + <text id="endurance_potion">Potion d'Endurance</text> + <text id="farm_blueprint">Plan de garage</text> + <text id="fence">Barrière</text> + <text id="fertilizer">Engrais</text> + <text id="fire_arrow">Flèche de Feu</text> + <text id="fire_bullet">Balle de Feu</text> + <text id="fire_chainsaw">Scie à chaine de Feu</text> + <text id="fire_gem">Gemme de Feu</text> + <text id="fire_shell">Obus de Feu</text> + <text id="fire_sword">Épée de Feu</text> + <text id="fire_tusk">Défense de Feu</text> + <text id="fishing_rod">Canne pêche</text> + <text id="focus_gem">Gemme concentré</text> + <text id="frost_shield">Bouclier de glace</text> + <text id="fruit">Pommes</text> + <text id="furnace">Fournaise</text> + <text id="goggles">Lunette d'Esprit</text> + <text id="gold">Minerais d'Or</text> + <text id="gold_bar">Lingot d'Or</text> + <text id="golem">Golem</text> + <text id="hamburger">Hamburger</text> + <text id="headlamp">Lampe Frontale</text> + <text id="health_potion">Potion de Vie</text> + <text id="horn">Corne</text> + <text id="ice_arrow">Flèche de Glace</text> + <text id="ice_berries">Baie Givrée</text> + <text id="ice_bullet">Balle de Glace</text> + <text id="ice_chainsaw">Scie à chaine de Glace</text> + <text id="ice_gem">Gemme de Glace</text> + <text id="ice_heart">Cœur de glace</text> + <text id="ice_shell">Obus de Glace</text> + <text id="ice_shield">Bouclier Enchanté</text> + <text id="ice_sword">Épée de Glace</text> + <text id="iron">Minerais de Fer</text> + <text id="iron_armor">Armure en Fer</text> + <text id="iron_bar">LIngot de Fer</text> + <text id="iron_pickaxe">Pioche en Fer</text> + <text id="iron_sword">Épée en Fer</text> + <text id="jakolantern">lanterne de citrouille</text> + <text id="jetpack">Jetpack</text> + <text id="kitchen_blueprint">Plan de Cuisine</text> + <text id="kitchen_upgrade">Amélioration de Cuisine</text> + <text id="kite_shield">Bouclier +</text> + <text id="lab_blueprint">Plan de Laboratoire</text> + <text id="landmine">Mine souterraine</text> + <text id="lantern">Lanterne</text> + <text id="machine_gun_arm">Bras mitraillette</text> + <text id="magic_backpack">Sac Magique</text> + <text id="magic_box">Boîte Magique</text> + <text id="magic_pickaxe">Pioche magique</text> + <text id="magic_sword">Épée magique</text> + <text id="map">Carte</text> + <text id="meat">Viande</text> + <text id="mega_backpack">Méga Sac</text> + <text id="milk">Lait</text> + <text id="minecart">Chariot</text> + <text id="net">Filet</text> + <text id="oil">Huile Brut</text> + <text id="omelette">Omelette</text> + <text id="orchard_seed">Semence de Pomme</text> + <text id="owl">Hibou</text> + <text id="pancakes">Crêpes</text> + <text id="pen_blueprint">Plan d'enclos</text> + <text id="pie">Tarte</text> + <text id="pig">Cochon</text> + <text id="pizza">Pizza</text> + <text id="plant_bag">Sac Plante </text> + <text id="plant_chainsaw">Scie à chaine de Plante</text> + <text id="plant_eye">œil de Plante</text> + <text id="plant_gem">Gemme de plante</text> + <text id="plant_sword">Épée de Plante</text> + <text id="pumpkin">Citrouille</text> + <text id="pumpkin_seed">Semence de Citrouille</text> + <text id="quartz">Quartz</text> + <text id="rail">Raille</text> + <text id="rat">Rat</text> + <text id="recurve_bow">Arc Recourbé</text> + <text id="red_berries">Baie Rouge</text> + <text id="red_bush_seed">Graine de buisson rouge</text> + <text id="refined_oil">Huile Raffinée</text> + <text id="revolver">Revolver</text> + <text id="rockfish">Sébaste</text> + <text id="rusty_axe">Hache rouillé</text> + <text id="shadow_cape">Cape de l'Ombre</text> + <text id="shell">Obus</text> + <text id="shotgun">Fusil a pompe</text> + <text id="shovel">Pelle</text> + <text id="sign">Panneau</text> + <text id="silicon">Silicone</text> + <text id="silk">Soie</text> + <text id="smelter_blueprint">Plan de fonderie</text> + <text id="snowman">Bonhomme de neige</text> + <text id="speed_potion">Potion de Vitesse</text> + <text id="spirit_gem">Gemme d'Esprit</text> + <text id="stamina_potion">Potion d'Énergie</text> + <text id="steak">Steak</text> + <text id="steel_armor">Armure d'Acier</text> + <text id="steel_bar">Lingot d'Acier</text> + <text id="steel_pickaxe">Pioche d'Acier</text> + <text id="steel_sword">Épée d'Acier</text> + <text id="steel_workbench">Établi en acier</text> + <text id="stone_axe">Hache en Pierre</text> + <text id="stone_pickaxe">Pioche en Pierre</text> + <text id="storehouse_blueprint">Plan d'entrepôt</text> + <text id="sugar">Sucre</text> + <text id="sugar_seed">Semence de canne à sucre</text> + <text id="sulfur">Souffre</text> + <text id="tent">Tente</text> + <text id="thunder_axe">Ancienne Hache</text> + <text id="titanium">Titane</text> + <text id="titanium_armor">Super Armure</text> + <text id="toothfish">Légine</text> + <text id="torch">Torche</text> + <text id="trap">Piège</text> + <text id="tree_seed">Graine d'arbre</text> + <text id="ultra_backpack">Ultra Sac</text> + <text id="uranium">Uranium</text> + <text id="water_arrow">Flèche d'eau</text> + <text id="water_bullet">Balle d'eau</text> + <text id="water_chainsaw">Scie à chaine d'Eau</text> + <text id="water_gem">Gemme d'Eau</text> + <text id="water_shell">Obus d'Eau</text> + <text id="water_sword">Épée d'Eau</text> + <text id="wheat">Blé</text> + <text id="wheat_seed">Semence de Blé</text> + <text id="wolf">Chien</text> + <text id="wood">Bois</text> + <text id="workbench">Établi</text> + <text id="workshop_blueprint">Plan d'atelier</text> + <text id="wyrm">Wyrm</text> + <text id="wyrm_drill">Foreuse Wyrm</text> + <text id="wyrm_pen_blueprint">Plan d'enclos à Wyrm</text> + <text id="yeti_fur">Fourrure de Yéti</text> + <text id="young_dragon">Jeune Dragon</text> + </section> + <section id="item.descriptions"> + <text id="area_name_sign">Peut renommer les îles lorsqu'elles sont placées.</text> + <text id="boat">Explorer le Monde.</text> + <text id="builds">Construire</text> + <text id="burn">Brûlure</text> + <text id="campfire">Cuit [item=steak].</text> + <text id="cocoon">Éclots dans l'[color=770000]enclos à Wyrms[/color].</text> + <text id="collect">Collecte des objets sur le sol.</text> + <text id="collect_rail">Décrocher les rails.</text> + <text id="cost_per_s">{value} par seconde.</text> + <text id="cost_per_s_day">{value} par seconde jour.</text> + <text id="cost_per_s_daylight">{value} par seconde au soleil.</text> + <text id="cost_per_s_injured">{value} par sec blessé.</text> + <text id="cost_per_s_night">{value} par seconde nuit.</text> + <text id="craft">Fabrique des objets.</text> + <text id="critical">Obtient toujours un coup critique.</text> + <text id="dismantle">Décompose les structures pour lesquelles vous avez un .[tile=blueprint.ico] [color=770000]plan[/color] .</text> + <text id="drain">Absorbe la vie</text> + <text id="fence">Garde les ennemies éloignés.</text> + <text id="fill">Remplis des trous.</text> + <text id="fires">Tirer {projectile}s</text> + <text id="freeze">Gèles des enemies.</text> + <text id="furnace">Fond du minerai.</text> + <text id="goggles">Révèle des esprits.</text> + <text id="hide">Cache le porteur.</text> + <text id="light">Éclaire l'environnement lorsqu'elle est équipées.</text> + <text id="magic_box">Contient Tout.</text> + <text id="max_weight">Poids Maximal</text> + <text id="mine_speed">vitesse d'extraction</text> + <text id="reflect">Reflète les dégâts</text> + <text id="repair">Répares des objets.</text> + <text id="sign">Afficher un texte.</text> + <text id="spawn">Faire apparaître {item}.</text> + <text id="storehouse">Range des objets.</text> + <text id="tent">Pour se reposer et redonner de l'[tile=stamina] [color=006600]Stamina[/color].</text> + <text id="transform_other">Transforme des objets.</text> + <text id="upgrades">Améliorer</text> + </section> + <section id="achievement.names"> + <text id="backpack">Poids Lourd</text> + <text id="bandits">Justice</text> + <text id="bigpack">Gros poids lourd</text> + <text id="blueprints">Construire ma façon</text> + <text id="boar">Viande Fraîche</text> + <text id="boat">Prendre la Voile</text> + <text id="capture_wyrm">Capture un Wyrm</text> + <text id="diamond">Expérience</text> + <text id="diode_wolf">Choquant</text> + <text id="dock">La Rive Approche</text> + <text id="dragon">Éclosion</text> + <text id="dragon_flight">Dompteur de dragon</text> + <text id="electric_eel">Charger</text> + <text id="elemental">Elementaire</text> + <text id="elevator">On monte??</text> + <text id="enchanted_chainsaw">Techno Mage</text> + <text id="factory">Industrialise</text> + <text id="farm">Plantations</text> + <text id="forge">Forger de l'avant</text> + <text id="full_cyborg">Cyborgification</text> + <text id="full_dragon">Maître Dragon</text> + <text id="golem">Tueur de Pierre</text> + <text id="golemech">Destructeur de Statue</text> + <text id="hut">Abri</text> + <text id="kitchen">Bon Appétit</text> + <text id="lab">Expériences</text> + <text id="labyrinth">Taurus</text> + <text id="market">Un Bon Marché</text> + <text id="medicom">L'histoire Complète</text> + <text id="mirrows">Tests humain</text> + <text id="oldone">Face à l'ennemi</text> + <text id="orchard">Pommes</text> + <text id="pen">Lait de Cochon</text> + <text id="pizza">Mmm, Fromage</text> + <text id="powerplant">Mise sous tension</text> + <text id="purple_tree">Whomp</text> + <text id="skills">Mise sous TensionUp</text> + <text id="smelter">Métallurgie</text> + <text id="storehouse">Stockage Infinie</text> + <text id="synthesizer">Steak Synthétique</text> + <text id="time_manipulator">Retour en arrière</text> + <text id="workshop">Créons!</text> + <text id="wyrm">Tueur de Wyrm</text> + <text id="wyrm_pen">Sang Infini</text> + <text id="wyrm_queen">Tueur de Reine</text> + </section> + <section id="achievement.descriptions"> + <text id="backpack">Obtiens le [color=ff2222]Sac à Dos[/color].</text> + <text id="bandits">Résous le problème de[color=ff2222]Bandit[/color].</text> + <text id="bigpack">Obtiens le [color=ff2222]Super Sac[/color].</text> + <text id="blueprints">Construits un batîment avec un[color=ff2222]Plan[/color].</text> + <text id="boar">Tue un [color=ff2222]Sanglier[/color].</text> + <text id="boat">Construis le [color=ff2222]Bateau[/color].</text> + <text id="capture_wyrm">Et maintenant je fais quoi avec?</text> + <text id="diamond">Mine un [color=ff2222]Diamant[/color].</text> + <text id="diode_wolf">Tue un [diode] Wolf [diode = ff2222][/color].</text> + <text id="dock">Construis le [color=ff2222]Port[/color].</text> + <text id="dragon">Éclos un [color=ff2222]Dragon[/color] avec un [color=ff2222]Cocon[/color].</text> + <text id="dragon_flight">Vole sur un [color=ff2222] Dragon [/color].</text> + <text id="electric_eel">attrape une [color=ff2222]Anguille Électrique[/color].</text> + <text id="elemental">Capture un esprit de chaque élément.</text> + <text id="elevator">Construis l'ascenseur [color=ff2222] [/color].</text> + <text id="enchanted_chainsaw">Enchante une [color=ff2222] tronçonneuse [/color].</text> + <text id="factory">Construis l'usine [color=ff2222] [/color].</text> + <text id="farm">Construis la [color=ff2222]Ferme[/color].</text> + <text id="forge">Active la [color=ff2222] Forge [/color].</text> + <text id="full_dragon">Procurez-vous un équipement complet de dragon.</text> + <text id="full_cyborg">Procurez-vous un équipement complet de Cyborg .</text> + <text id="golem">Tue un [color=ff2222]Golem[/color].</text> + <text id="golemech">Tue le [color=ff2222]Golemech[/color].</text> + <text id="hut">Construis l'[color=ff2222]Abri[/color].</text> + <text id="kitchen">Construis la [color=ff2222]Cuisine[/color].</text> + <text id="lab">Construis le [color=ff2222]Laboratoire[/color].</text> + <text id="labyrinth">Complète le labyrinthe du Minotaure.</text> + <text id="market">Construis le [color=ff2222]Marché[/color].</text> + <text id="medicom">Lire tous les journaux.</text> + <text id="mirrows">Confronter avec succès les mirrows.</text> + <text id="oldone">Tue l'[color=ff2222]Ancien[/color].</text> + <text id="orchard">Ajoute un [color=ff2222]Verger[/color] à la [color=ff2222]Ferme[/color].</text> + <text id="pen">Ajoute un [color=ff2222]Enclos[/color] à la [color=ff2222]Ferme[/color].</text> + <text id="pizza">Cuisine une [color=ff2222]Pizza[/color].</text> + <text id="powerplant">Construis la [color=ff2222]Centrale Électrique[/color].</text> + <text id="purple_tree">Abats un[color=ff2222]Arbre Mauve[/color].</text> + <text id="skills">Améliorez votre personnage avec 500 points de compétence [color=ff2222]ou plus[/color].</text> + <text id="smelter">Construis la [color=ff2222]Forge[/color].</text> + <text id="storehouse">Construis l'[color=ff2222]Entrepôt[/color].</text> + <text id="synthesizer">Active le [color=ff2222]Synthétiseur[/color].</text> + <text id="time_manipulator">Active le [color=ff2222]Manipulateur de temps[/color].</text> + <text id="workshop">Construis l'[color=ff2222]Établi[/color].</text> + <text id="wyrm">Tue un [color=ff2222]Wyrm[/color].</text> + <text id="wyrm_pen">Construis l'[color=ff2222]Enclos à Wyrm[/color].</text> + <text id="wyrm_queen">Tue la [color=ff2222]Reine Wyrm[/color].</text> + </section> + <section id="structure"> + <text id="activate">Voudrais-tu utiliser un(e) {item} pour activer cette structure?</text> + <text id="activate_fail">Il manque quelque chose qui est nécessaire pour activer ça.</text> + <text id="add_field">Agrandir la Ferme</text> + <text id="add_stall">Construire un Enclos</text> + <text id="build">Voulez-vous construire un {structure} pour les ressources suivantes?</text> + <text id="cotton">Champ de Coton</text> + <text id="dismantle">Voulez-vous démonter le/la {structure} pour les ressources suivantes?</text> + <text id="dragon_lair">Dragon dans le repaire:</text> + <text id="elevator">Ascenseur</text> + <text id="enchant_added">La recette d'enchantement à été ajoutée à la [color=770000]Forge[/color].</text> + <text id="enchant_recipe">Ce pilier révèle cet enchantement:\n{enchant}+{items}={creates}.</text> + <text id="fertilizer">Engrais</text> + <text id="get_pumpkin_seeds">Trouvé des graines de [item=pumpkin] et ont été ajoutés à la ferme!</text> + <text id="golem_factory">Le pouvoir de la structure est tout en train d'être attiré dans cette statue...</text> + <text id="golemech">Construire Golemech</text> + <text id="manage_storage">Arranger le stockage</text> + <text id="orchard">Verger</text> + <text id="overweight">Le [item=boat] est trop lourd pour mettre les voiles!</text> + <text id="pen">Enclos</text> + <text id="place_in_lair">Nécessite {item} dans ce repaire.</text> + <text id="plant">Changer la plantation</text> + <text id="produces">-- Produit --</text> + <text id="pumpkin">Champ de Citrouille</text> + <text id="rest_boat">Se Reposer dans le Bateau</text> + <text id="sail_boat">Mettre les voiles</text> + <text id="search_fail">Hmm, rien d'intéressant ici.</text> + <text id="slots">-- Emplacement --</text> + <text id="sugar">Champ de Canne à Sucre</text> + <text id="wheat">Champ de Blé</text> + </section> + <section id="structure.tooltip"> + <text id="activate">Activer</text> + <text id="boat">Prendre la voile</text> + <text id="cage">Gérer Cage</text> + <text id="dockhouse">Entrer au port</text> + <text id="dragon_lair2">Élever les Dragons</text> + <text id="elevator">Appeler Ascenseur</text> + <text id="enter">Entrer</text> + <text id="factory">Opérer Usine</text> + <text id="farm">Entrer dans la Ferme</text> + <text id="fly_dragon">S'envoler sur le Dragon</text> + <text id="food_market">Marchander avec le Marchand de nourriture</text> + <text id="golemech">Désactiver l'Usine de Golem</text> + <text id="golemech2">Alert: Incontrollable.</text> + <text id="hut">Se Reposer dans l'Abri</text> + <text id="inn">Entrer dans l'Auberge</text> + <text id="kitchen">Cuisiner dans la Cuisine</text> + <text id="lab">Fabriquer des Potions</text> + <text id="mineral_market">Marchander avec le Marchand de Minerais</text> + <text id="operate">opérer</text> + <text id="pen">Gérer l'Enclos</text> + <text id="power_plant">Opérer la Centrale Électrique</text> + <text id="raise_into">Élever en {into}</text> + <text id="read">Lire</text> + <text id="search">Chercher</text> + <text id="smelter">Fondre les Minerais</text> + <text id="storehouse">Entrer dans l'Entrepôt</text> + <text id="summon_alchemist">Invoquer l'Alchemiste</text> + <text id="tent">Se Reposer dans la Tente</text> + <text id="warehouse">Entrer dans l'Entrepôt</text> + <text id="weaps_market">Marchander avec le Marchand d'Armes</text> + <text id="workshop">Fabriquer avec l'Établi</text> + </section> + <section id="object.tooltip"> + <text id="bush">Récolter les Baies</text> + <text id="collect">Collecter {item}</text> + <text id="enemy">Attaquer</text> + <text id="harvest">récolter {item}</text> + <text id="open">ouvrir {item}</text> + <text id="tree">Couper l'Arbres</text> + <text id="use">Utiliser {item}</text> + </section> + <section id="equipment"> + <text id="armor">Armure:</text> + <text id="back">Sac à Dos:</text> + <text id="engine">Machine:</text> + <text id="familiar">Familier:</text> + <text id="head">Couvre-chef:</text> + <text id="pickaxe">Pioche:</text> + <text id="shield">Bouclier:</text> + <text id="weapon">Armes:</text> + </section> + <section id="capture"> + <text id="almost">Presque!</text> + <text id="caught">Pris!</text> + <text id="fail">Brisé!</text> + </section> + <section id="warning"> + <text id="additions">Aucune place restante dans la Ferme!</text> + <text id="cannot_fire">Impossible de tirer {projectile} sans {weapon}.</text> + <text id="drop_instead">Voulez vous le jeter au sol?</text> + <text id="flight_weight">Tu es trop lourd pour voler avec{item}!</text> + <text id="focus">Cliquer pour se concentrer</text> + <text id="fuel">Pas assez de carburant!</text> + <text id="growing">Ça pousse! Reviens plus tard.</text> + <text id="incomplete">C'est incomplet. Tu devras attendre pour une mise-à-jour dans le futur.</text> + <text id="ingredients">Vous n'avez pas assez d'ingrédients.</text> + <text id="item_hungry">Le {item} est trop affamé pour faire le voyage!</text> + <text id="load_fail">Le jeu principal n'a pas pu être chargé. Cela signifie généralement qu'il vous manque des fichiers, re-téléchargez et extrayez tout le contenu de l'archive zip dans un dossier.</text> + <text id="load_fail_js">Le jeu principal n'a pas pu être chargé. Cela signifie généralement qu'il vous manque des fichiers, essayez Shift + F5 pour recharger durement la page.</text> + <text id="max_coins">Votre portefeuille ne peut contenir plus d'argents!</text> + <text id="max_feed">Tu ne peux pas le nourrir plus!</text> + <text id="max_fuel">Vous ne pouvez pas ajouter plus de carburants!</text> + <text id="max_items">Vous ne pouvez pas ajouter plus d'objets!</text> + <text id="max_rations">Tu ne peux pas ajouter plus de rations!</text> + <text id="no_blueprint">Vous n'avez pas de plan pour cette structure.</text> + <text id="no_effect">Cela n'aura aucun effets.</text> + <text id="no_equip">Tu ne peux pas équiper {item}.</text> + <text id="no_fill">Tu ne peux pas remplir cette tuile!</text> + <text id="no_item">Il n'y a pas de {item} .</text> + <text id="no_pickaxe">la camera s'est déplacé vers le haut car tu n'a plus de pioche équipé. Tu peux équiper une pioche en gérant ton équipement avec la touche [key=equipment].</text> + <text id="no_place">Tu ne peux pas placer cela ici!</text> + <text id="no_projectiles">Impossible de tirer {weapon}: aucun(e) {projectile}s.</text> + <text id="no_structure">Il n'y a pas de structure ici pour démanteler.</text> + <text id="no_upgrade">Il n'y a pas de structure ici pour améliorer.</text> + <text id="no_use_vehicle">Vous ne pouvez pas faire cela en roulant dans un véhicule.</text> + <text id="not_powered">Il n'y a pas de puissance!</text> + <text id="one_structure">Vous pouvez seulement construire une de cette structure par île.</text> + <text id="overweight">Vous êtes trop en surpoids pour bouger!</text> + <text id="place_overlap">Vous ne pouvez pas placer un objet sur un objet.</text> + <text id="place_surface">Vous ne pouvez pas placer d'objet hors de la surface.</text> + <text id="plant_barn">Vous ne pouvez pas planter des cultures sans une grange.</text> + <text id="plant_grass">Vous ne pouvez planter que sur des tuiles d'herbe fertiles.</text> + <text id="plant_structure">Vous ne pouvez pas planter sur des structures ou des cultures.</text> + <text id="power">Pas assez de puissance de la batterie!</text> + <text id="rations">Pas assez de rations pour le périple!</text> + <text id="send_bug_report">Quelque chose s'est mal passé! Souhaitez-vous envoyer un rapport de bug??</text> + <text id="sleep_flying">Vous ne pouvez pas dormir en volant!</text> + <text id="stamina">Aucune Énergie, Perte de Vie!</text> + <text id="structure_barn">Vous ne pouvez pas construire cette structure sans une grange.</text> + <text id="structure_overlap">Vous ne pouvez pas construire de structures sur des structures ou des cultures.</text> + <text id="structure_surface">Cette structure ne peut pas être construite sous la surface.</text> + <text id="structure_tile">Vous devez creuser une plus grande surface pour construire cette structure.</text> + <text id="weight">Capacité Max Atteinte!</text> + </section> + <section id="market"> + <text id="closed">Fermé pour la nuit.</text> + <text id="no_power">Je n'arrive pas à croire que la [color=770000]Centrale Électrique[/color] ne fonctionne pas! Comment est-ce que je peux faire affaire comme ça?</text> + <text id="restock">Nous aurons bientôt de nouvelles marchandises!</text> + </section> + <section id="quests"> + <text id="alter_gem">Recherche de Wyrm</text> + <text id="bandits">Vaincre les Bandits</text> + <text id="boars">Vaincre les sangliers</text> + <text id="boat">Créer le bateau</text> + <text id="complete">-- Complété --</text> + <text id="dock">Créer un Port</text> + <text id="dock2">Créer un Port</text> + <text id="elevator">Construire l'ascenseur</text> + <text id="factory">Construire une usine</text> + <text id="farm">Créer une Ferme</text> + <text id="fence">Périmètre</text> + <text id="fisherman_cat">Trouver Peri</text> + <text id="hatch_dragons">Éclore un dragon</text> + <text id="hunt">Sangliers de chasse</text> + <text id="hut">Construire un Abri</text> + <text id="kitchen">Créer une Cuisine</text> + <text id="kitchen2">Améliorer Cuisine</text> + <text id="lab">Matériaux Magiques</text> + <text id="market">Créer un Marché</text> + <text id="market2">Créer un Marché</text> + <text id="mirrows">Confronte Mirrows</text> + <text id="mirrows2">Convaincre Mirrows</text> + <text id="new">Nouvelle Quête!</text> + <text id="none">Vous n'avez actuellement aucunes quêtes.</text> + <text id="oldone">Énergie Magique</text> + <text id="orchard">Graine de Pommes</text> + <text id="pen">Ajouter Porcherie</text> + <text id="powerplant">Fixer une centrale électrique</text> + <text id="requires">-- Nécessite --</text> + <text id="smelter">Créer une Forge</text> + <text id="storehouse">Créer l'Entrepôt</text> + <text id="storehouse2">Créer l'Entrepôt</text> + <text id="thunder_axe">Hache magique</text> + <text id="unknown_reqs">???</text> + <text id="wolf">Loup Chiot</text> + <text id="workshop">Créer un Établi</text> + <text id="wyrm_hive">Ruche de Wyrms</text> + <text id="wyrm_pen">Enclos à Wyrms</text> + </section> + <section id="quest.description"> + <text id="alter_gem">a besoin de plus d'aide pour terminer sa recherche sur le [item=wyrm]!</text> + <text id="bandits">Les marchands veulent que vous battez les bandits qui volent leurs marchandises.</text> + <text id="boat">Il est temps d'explorer le monde! Construis un [item=boat] au [color=550000]Port[/color].</text> + <text id="dock">nécessite un [color=550000]Port[/color] pour naviguer à travers le monde.</text> + <text id="dock2">Construire un [color=550000]Port[/color] pour trouver d'autres survivants.</text> + <text id="elevator">Veut construire un ascenseur [color=550000] [/color] pour transporter le minerai.</text> + <text id="factory">Veut construire une [color=550000] Usine [/color] pour bricoler avec des machines.</text> + <text id="farm">nécessite une [color=550000]Ferme[/color] pour cultiver les graines.</text> + <text id="fence">Veut ajouter des [item=fence]s à la colonie.</text> + <text id="fisherman_cat">veut que vous trouviez son [item=cat] qui aime [item=toothfish].</text> + <text id="hatch_dragons">Fait éclore le [item=dragon]s pour gagner le [item=adult_dragon] à vos côtés.</text> + <text id="hunt">veut que vous vous pratiquiez avec des armes.</text> + <text id="hut">Vous devez construire un [color=550000]Abri[/color] pour vous abriter de la tempête.</text> + <text id="kitchen">nécessite une [color=550000]Cuisine[/color] pour cuisiner de la nourriture</text> + <text id="kitchen2">nécessite une [color=550000]Cuisine[/color] pour faire [item=cheese].</text> + <text id="lab">veux que vous tuez un [item=wyrm] pour gagner du [item=dragonblood] ?.</text> + <text id="market">nécessite un [color=550000]Marché[/color] pour Marchander.</text> + <text id="market2">Construis un [color=550000]Marché[/color] pour attirer les vendeurs au [color=550000]Port[/color].</text> + <text id="mirrows">veut que tu négocies avec les Mirrows pour lui.</text> + <text id="mirrows2">veut que vous trouviez quelque chose de spécial pour influencer les Mirrows.</text> + <text id="oldone">veut trouver la source des pointes d'énergie magiques.</text> + <text id="orchard">veut utiliser [item=fruit] pour planter un [color=550000][item=Orchard][/color].</text> + <text id="pen">nécessite un[color=550000]Enclos[/color] pour abriter le bétail.</text> + <text id="powerplant">besoin [article=titanium] pour fixer le [color=550000]Centrale Électrique[/color].</text> + <text id="smelter">nécessite une [color=550000]Forge[/color] pour raffiner les minerais.</text> + <text id="storehouse">nécessite un [color=550000]Entrepôt[/color].</text> + <text id="storehouse2">Construire un [color=550000]Entrepôt[/color] pour ranger toutes vos affaires.</text> + <text id="thunder_axe">veut réparer la [item=rusty_axe].</text> + <text id="wolf">veut apprivoiser le chiot loup.</text> + <text id="workshop">nécessite un [color=550000]Établi[/color] pour Créer des outils de métal.</text> + <text id="wyrm_hive">veut que vous trouviez les secrets des [item=wyrm]s.</text> + <text id="wyrm_pen">nécessite d'expérimenter avec un[item=wyrm].</text> + </section> + <section id="vehicle"> + <text id="battery">Charger à partir des batteries</text> + <text id="dismount">Descendre</text> + <text id="fly">Déplacez-vous pour voler.</text> + <text id="manage_items">Gérer les objets</text> + <text id="manage_player">Gérer soi-même</text> + <text id="overweight">Le véhicule est trop lourd pour se déplacer!</text> + <text id="vehicle">Véhicule</text> + </section> + <section id="npc"> + <text id="alchemist">Alchimiste</text> + <text id="builder">Maçon</text> + <text id="farmer">Fermier</text> + <text id="fisherman">Pêcheur</text> + <text id="grab">Prendre</text> + <text id="hunter">Chasseur</text> + <text id="innkeeper">Aubergiste</text> + <text id="mechanic">Mécanicien</text> + <text id="miner">Mineur</text> + <text id="talk">Parler</text> + <text id="trader">Commerçant</text> + </section> + <section id="builder"> + <text id="accept1">Super! Je peux trouver ça, sans problèmes.</text> + <text id="accept2">Prends cette [item=stone_axe], si t'es si gung-ho.</text> + <text id="farm">Mec, j'ai faim. J'espère que cette [color=770000]Ferme[/color]sera bientôt finie!</text> + <text id="farmer">On devrait faire un marché avec le [color=770000][tile=farmer] Fermier[/color], je parie qu'il peut nous aider à faire pousser de la bonne nourriture.</text> + <text id="hint1">Tous tes objets vont dans ton inventaire quand tu les collectes. Tu peux les voir en cliquant sur [key=inventory].</text> + <text id="hint2">Si ton [tile=stamina] [color=006600]Énergie[/color] viens à manquer, tu perdras de la [tile=health] [color=770000]Vie[/color], et si ta [tile=health] [color=770000]Vie[/color] arrive à zéros, tu mourras.</text> + <text id="hint3">C'est pourquoi tu as besoin de manger beaucoup de [item=berries], [item=fruit]s et de [item=meat]s. Tu peux le faire en les sélectionnant depuis ton inventaire.</text> + <text id="intro">Tu crois pouvoir être capable de survivre ici? C'est sans espoir, mec.</text> + <text id="introduce1">T'es bon en construction, pas vrai? Et si nous construisions quelque chose pour stocker la nourritures et les équipements?</text> + <text id="introduce2">Mouais. Je pense qu'avec [var=quest.storehouse.wood] [item=wood] et [var=quest.storehouse.berries] [item=berries]s je devrais être capable de faire un [color=770000]Entrepôt[/color].</text> + <text id="kitchen1">Qu'est-ce que tu dirais de construire une [color=770000]Cuisine[/color]? La [item=meat] crue est bonne, mais c'est encore meilleur cuisiné.</text> + <text id="kitchen2">J'aurais besoin de [var=quest.kitchen.wood] [item=wood] et de [var=quest.kitchen.coal] [item=coal]s pour faire la [color=770000]Cuisine[/color].</text> + <text id="kitchen3">On dirait que tu as tout ce que je veux. Allons faire cette [color=770000]Cuisine[/color]!</text> + <text id="kitchen4">Tu peux faire de la nourriture à la [color=770000]Cuisine[/color] tant que tu as du [item=wood] ou du [item=coal] pour l'alimenter.</text> + <text id="kitchen5">Tu sais de quoi j'ai envie? Quelques [item=cheese]s. Rien n'est plus délicieux.</text> + <text id="kitchen6">Je pourrais améliorer la [color=770000]Cuisine[/color] pour faire du [item=cheese] et cuisiner de nouvelles recettes pour [var=quest.kitchen2.wood] [item=wood] et [var=quest.kitchen2.steel_bar] [item=steel_bar]s.</text> + <text id="kitchen7">On dirait que tu as tout ce que je veux. Allons améliorer cette [color=770000]Cuisine[/color]!</text> + <text id="kitchen8">Essaye de nouvelles recettes! On se sent plus civilisé!</text> + <text id="miner">Tu as vu ce [color=770000][tile=miner] Mineur[/color] qui émerge du sol? Tu devrais voir ce qu'elle veut.</text> + <text id="stamina">Je suis épuisé. T'as l'air fatigué aussi. On devrait se reposer dans l'[color=770000]Abri[/color] pour sauvegarder et restaurer notre [tile=stamina][color=006600]Énergie[/color].</text> + <text id="storehouse1">Tu as déjà tout? Je suis impressionné.</text> + <text id="storehouse2">Allons faire cet [color=770000]Entrepôt[/color]!</text> + <text id="storehouse3">Regarde ça! Tu ne te sens pas fier?</text> + <text id="storehouse4">Ouais… en fait, ça sera utile. Maintenant, on peut éviter de s'épuiser trop à la tâche.</text> + <text id="wood">Comment va ma vieille [item=stone_axe]? Je parie qu'elle peut couper un arbre en cliquant sur [key=select] à proximité .</text> + </section> + <section id="farmer"> + <text id="add_cotton">J'ai rencontré quelque commerçants au [color=770000]Marché[/color] et j'ai eu plusieurs graines de[item=cotton] ! Tu peut maintenant planter du [item=cotton] à partir de la grange.</text> + <text id="add_sugar">Cette ferme devient vraiment grande! pour fêter cela j'ai trouver des graines de [item=sugar] et je les ai ajoutés à la grange! Essayons de planter un champ de [item=sugar]!</text> + <text id="farm1">Cool! Je fais la Grange et je plante quelques graines!</text> + <text id="farm2">Maintenant nous avons une [color=770000]Ferme[/color]! Viens ramasser les cultures - Elles restaureront ton [tile=stamina] [color=006600]Énergie[/color]. Tiens - prends quelques [item=bread]s pour te tenir en forme le temps de la pousse.</text> + <text id="farm3">Tu peux avoir du [item=wood] en coupant les arbres.</text> + <text id="farm4">Si tu veux plus de plantes, nous pouvons avoir jusqu’à quatre champs de blés ou vergers. Tu peux les ajouter depuis la grange.</text> + <text id="farm5">Regarde notre incroyable [color=770000]Ferme[/color]! C'est aussi beau que tout ce que je cultivais à la maison!</text> + <text id="halloween">J'espère que cela ne te dérange pas, mais j'ai fait une petite décoration pour le festival des récoltes! Nous pouvons utiliser une petite célébration près d'ici. J'ai aussi mis plusieurs [item=jakolantern]s dans l'[color=770000]Entrepôt[/color].</text> + <text id="introduce1">Garçon je suis heureux de te voir. Ici, je pensais que j'étais seul, juste un vielle homme dans un monde vide.</text> + <text id="introduce2">J'ai encore de la force à revendre dans ces vieux os et je pense que je pourrais t'aider. Cultiver est mon domaine, et nous avons tous besoin de bonne nourriture pour continuer de vivre.</text> + <text id="introduce3">Qu'est-ce que tu dirais de faire une grange et de rentabiliser la [color=770000]Ferme[/color]?</text> + <text id="kitchen">Le [item=wheat] n'est pas très bon, mais je parie qu'on peut avoir de meilleur choses si le [color=770000][tile=builder] Maçon[/color] fait une [color=770000]Cuisine[/color].</text> + <text id="kitchen2">Traire un [item=pig]? Pourquoi pas? C'est un monde étrange. Mais ce que nous pourrions vraiment utiliser un peu de [item=cheese] - parle au [color=770000][tile=builder] Maçon[/color] pour améliorer la [color=770000]Cuisine[/color].</text> + <text id="orchard1">Il y a beaucoup de [item=fruit]s près d'ici. Avec assez de graines, je peux probablement planter un bon [color=770000]verger[/color]!</text> + <text id="orchard2">Bien, c'est beaucoup! J'ai ajouter les graines à la grange, comme ca tu pourras changer les cultures.</text> + <text id="orchard3">Fait moi savoir quand tu auras assez de [item=fruit]s pour le [color=770000]verger[/color]!</text> + <text id="orchard4">Les graines peuvent être plantées sur des tuiles d'herbe tant qu'il y a assez d'espace vide pour les placer. Ici, il semble bon de planter la [item=orchard_seed]!</text> + <text id="orchard5">Tu peux également utiliser des graines pour changer de culture dans la [color=770000]Grange[/color]. Si tu veux faire de nouvelles graines, fait-le moi savoir!</text> + <text id="pen1">Tu sais de quoi à besoin cette [color=770000]Ferme[/color]? Du bétail! Qu'est-ce que tu dirais d'attraper quelques [color=770000][tile=boar]Sangliers[/color] avec un [item=net] depuis le [color=770000]Marché[/color]?</text> + <text id="pen2">Je vais ajouter un [color=770000]Enclos[/color] pour [var=quest.pen.pig] [item=pig]s et pour [var=quest.pen.wood] [item=wood].</text> + <text id="pen3">Maintenant, ne sont t-il pas les plus gros et les plus juteux [item=pig]s que tu n'as jamais vu?</text> + <text id="pen4">Avec l'Enclos, on peut maintenant produire de la [item=meat], et du [item=milk]!</text> + <text id="pen5">Voici un [item=pen_blueprint] pour que vous puissiez construire plus d'enclos!</text> + <text id="pig">Comment tu as un [item=pig]? Pose un [item=net]sur le sol, attire un [color=770000][tile=boar]Sanglier[/color] blessé dedans, et si tu as de la chance il sera attrapé et domestiqué!</text> + <text id="sign1">Cette place commence à ressembler à un chez-soi, n'est-ce pas? Que dit-tu de donner un nom à cet endroit?</text> + <text id="sign2">Utilise ce [item=sign] ici pour changer le nom de cette île!</text> + <text id="snowman">La premiere tombée de neige! Cela fait une aussi belle fête à célébrer que les autres! J'ai même fait un [item=snowman] magique grâces aux [item=ice_berries], j'espère que tu l'aime!</text> + </section> + <section id="miner"> + <text id="accept1">Génial! Fais moi savoir quand tu as assez de [item=coal]!</text> + <text id="equip1">Si vous voulez extraire [color=770000] [tile=stone]stone [/color] pour atteindre [item=gold], vous devrez équiper un [item=iron_pickaxe] ou un [item=steel_pickaxe]. Appuyez sur [key=equipment] pour gérer votre équipement.</text> + <text id="equip2">Vous pouvez gérer votre équipement et vos pioches en appuyant sur [key=equipment] pour ouvrir la fenêtre Equipment.</text> + <text id="hint1">Bon, qu'est-ce que t'attends? Clique juste sur [key=down] pour creuser et trouver des minerais!</text> + <text id="hint2">Les minerais sont lourds - sois sûr de les poser dans l'[color=770000]Entrepôt[/color] entre chaque voyage.</text> + <text id="hint3">C'est facile de se perdre, donc sois sûr d'avoir assez d'[tile=stamina] [color=006600]Énergie[/color] pour le retour.</text> + <text id="hint4">Plus profond tu iras, meilleur le minerais sera.</text> + <text id="hint5">Si tu prévois exploiter des mines souterraines, assure-toi d'apporter des [item=torch]es avec toi. Ils fourniront de la lumière lorsqu'ils seront équipés, mais finiront par s'éteindre.</text> + <text id="hint6">Je peux faire des [item=torch]es si tu en as besoin.</text> + <text id="hotkey">Tu peux aussi utiliser les [color=770000]Raccourcis[/color] maintenant.\nClique sur [key=hotkey1] ou sur [key=hotkey2] ou sur [key=hotkey3] ou sur [key=hotkey4] dans la fenêtre de l'inventaire pour les attribuer.</text> + <text id="introduce1">Oh, salut. Je n'avais pas réalisée qu'il y avait d'autres survivants.</text> + <text id="introduce2">J'étais sous terre - il y a beaucoup plus à cet endroit que ce que l'on croit.</text> + <text id="introduce3">J'ai une pioche en trop si tu veux aller jeter un coup d'œil.</text> + <text id="pick">Si tu veux miner à travers la [color=770000][tile=stone]Pierre[/color] pour trouver de l'[item=gold], tu devra créer une [item=iron_pickaxe] ou une [item=steel_pickaxe] à l'[color=770000]Établi[/color].</text> + <text id="smelter">Comment va le minage? On devrait peut-être faire une [color=770000]Forge[/color] pour transformer du minerais en lingot.</text> + <text id="smelter1">C'est bon. Je devrais pouvoir faire une [color=770000]Forge[/color] dans pas longtemps!</text> + <text id="smelter2">La [color=770000]Forge[/color] peut faire des lingots à partir de minerais. Cela nécessite du carburant, mais heureusement il y a beaucoup de [item=coal] pas loin pour la faire tourner.</text> + <text id="smelter3">Quand tu en auras assez de [item=iron], sélectionne [item=iron_bar] depuis le menu de la [color=770000]Forge[/color], et il sera automatiquement fondu tant qu'il y aura du carburant.</text> + <text id="smelter4">Tu peux faire plusieurs choses à la fois dans la [color=770000]Forge[/color] tant que tu as assez de ressources pour cela, ils seront fondu un par un pendant que tu es absent tant qu'il y a du carburant.</text> + <text id="workshop1">Qu'est-ce que tu dirais d'un [color=770000]Établi[/color] pour faire de ces lingots des outils? Je peux en faire un pour [var=quest.workshop.iron_bar] [item=iron_bar]s et [var=quest.workshop.wood] [item=wood].</text> + <text id="workshop2">Tout est ok, allons faire cet [color=770000]Établi[/color]!</text> + <text id="workshop3">À l'[color=770000]Établi[/color], tu peux faire instantanément tout type d'outils si tu as les ressources nécessaires.</text> + <text id="workshop4">Tu dois trouver [item=iron] pour faire des [item=iron_bar]s à la [color=770000]Forge[/color].</text> + </section> + <section id="trader"> + <text id="accept">Accepter l'offre</text> + <text id="caught">Le voleur a été attrapé la main dans le sac!</text> + <text id="dock1">Es-tu intéressé de découvrir le reste du monde? Qu'est-ce que tu dirais de construire un [color=770000]Port[/color]?</text> + <text id="dock2">Je vais le faire si tu me donnes [var=quest.dock.coins] [color=770000][tile=coin_purse.ico]d'Argent[/color], [var=quest.dock.wood] [item=wood], [var=quest.dock.cloth] [item=cloth]s et [var=quest.dock.net] [item=net]s.</text> + <text id="dock3">Excellent, allons construire ce [color=770000]Port[/color]!</text> + <text id="dock4">Quand tu auras construit un [item=boat] au [color=770000]Port[/color], tu seras prêt à traverser les mers!</text> + <text id="dock5">Le [color=770000]Port[/color] coûte [var=quest.dock.coins] [color=770000][tile=coin_purse.ico] d'Argent[/color], [var=quest.dock.wood] [item=wood], [var=quest.dock.cloth] [item=cloth]s et [var=quest.dock.net] [item=net]s.</text> + <text id="introduce1">C'est assez dur de survivre ici sans que quelqu'un vole nos affaires!</text> + <text id="introduce2">J'ai peut-être emprunter quelques trucs. Mais, écoute. Je vais me racheter en offrant mes services. J'ai des relations avec beaucoup de marchands sur d'autres îles.</text> + <text id="introduce3">Marchands? Il y a d'autres survivants à l'extérieur?</text> + <text id="introduce4">Ouaip. Mais j'aurai besoin de [var=quest.market.gold_bar] [item=gold_bar]s pour les convaincre de venir ici.</text> + <text id="introduce5">Tu veux marchander avec nous alors que tu essayais de nous voler?!</text> + <text id="introduce6">C'est ça. C'est le business. Mon offre est [var=quest.market.gold_bar] [item=gold_bar]s pour ajouter cette île sur les routes commerciales.</text> + <text id="introduce7">Bien. S'il y a d'autres survivants là dehors, marchander avec eux pourrait nous sortir de l'île.</text> + <text id="introduce8">Je suis désolé, je ne peux pas croire un voleur. Quitte cette île, et ne reviens jamais.</text> + <text id="introduce9">Il y a d'autres îles à voler de toute façon. Tu ne sais pas ce que tu rates.</text> + <text id="market1">Parfait! Je sens qu'on va faire de bonnes affaires nous deux.</text> + <text id="market2">Prends ce [item=coin_purse]. Tu as besoin de stocker ton argent quand tu achètes ou tu vends. Je te recommande d'acheter un [item=mega_backpack] dès que tu pourras, il te sauvera la vie!</text> + <text id="market3">Au [color=770000]Marché[/color], tu peux vendre des biens pour de l'argent, et ainsi en acheter d'autre.</text> + <text id="market4">Le [color=770000]Marché[/color] a de nouveaux étalages parfois, donc si tu n'as pas ce que tu cherches ou que leur produits sont épuisés, reviens plus tard.</text> + <text id="market5">Pour faire des [item=gold_bar]s, il faut faire fondre de l'[item=gold], qui se trouve enfouis profondément dans le sol. Le [color=770000][tile=miner]Mineur[/color] peut avoir quelques astuces pour l'exploitation minière aussi profonde.</text> + <text id="reject">Refuser l'offre</text> + <text id="sail">N'est-ce pas là un jour magnifique pour naviguer?</text> + <text id="steal">[item={item}] a été volé dans l'[color=770000]Entrepôt[/color]!</text> + </section> + <section id="alchemist"> + <text id="alchemist_fight">Laisser l'alchimiste se battre</text> + <text id="alter_gem1">J'ai été dans une profonde contemplation, essayant de décoder les secrets des [item=wyrm]s.</text> + <text id="alter_gem2">Si vous m'apportez [var=quest.alter_gem.wyrm] [item=wyrm], [var=quest.alter_gem.fire_tusk] [item=fire_tusk] et [var=quest.alter_gem.yeti_fur ] [item=yeti_fur], je serai capable de finir mes recherches.</text> + <text id="alter_gem3">Je l'ai fait! J'ai créé une [item=alter_gem]! Cela nous permettra de transformer [item=wyrm]s - et probablement d'autres créatures - en équipement utilisable!</text> + <text id="alter_gem4">Nous devons continuer à explorer cette branche de la magie! Prenez cette [item=alter_gem] et utilisez-le sur un [item=wyrm]! Si vous avez besoin de plus de [item=alter_gem]s, j'ai ajouté la recette au synthétiseur.</text> + <text id="alter_gem5">Pour utiliser la [item=alter_gem], sélectionnez-la dans votre inventaire, choisissez Transformer, et choisissez une créature à transformer.</text> + <text id="alter_gem6">N'ayez pas peur d'essayer la [item=alter_gem] avec d'autres créatures ... comme un [item=dragon]. Ou, oserais-je le suggérer - un [item=adult_dragon]?!</text> + <text id="alter_gem7">À court de [item=alter_gem]s? Vous pouvez les trouver en profondeur ou les créer au synthétiseur.</text> + <text id="alter_gem8">Assurez-vous d'utiliser des [item=alter_gem]s sur des créatures bien nourries. Les créatures affamées ne resteront pas longtemps transformées!</text> + <text id="axe1">Laissez-moi voir cette [item=rusty_axe] ... C'est difficile à repérer avec toute la rouille, mais je reconnais ces symboles!</text> + <text id="axe2">Il y a de la magie ancienne ici, mais elle est usée. Si vous m'apportez le bon ingrédient magique, peut-être que je peux le réparer ...</text> + <text id="axe3">Cette [item=fire_tusk] ... de quel genre de créature l'avez vous eu? Il semble résonner avec la [item=rusty_axe], peut-être que c'est l'ingrédient magique que nous cherchions!</text> + <text id="axe4">Je l'ai fait! Je me demande qui a fait cette [item=thunder_axe], et quel âge il a? Si vous voulez en faire plus, j'ai ajouté la recette au laboratoire.</text> + <text id="battle">Reculez! Ce combat n'est pas pour les inexpérimentés!</text> + <text id="dragon1">Nous devons expérimenter plus sur les [item=wyrm]s! Qu'est-ce qu'il mange ? Pourquoi donne t-il du [item=dragonblood]?</text> + <text id="dragon10">Je savais que vous me trahiriez! Goutez ma colère!</text> + <text id="dragon11">Je ne pense pas que nous devrions le réveiller avant d'avoir les [item=dragon]s.</text> + <text id="dragon12">Vous l'avez fait? Peut-être qu'il y a une lueur d'espoir pour mon espèce.</text> + <text id="dragon12_a">Excellent! Donc, allez-vous nous dire le secret de la magie?</text> + <text id="dragon13">Par malchance, je ne connais pas le secret que vous recherchez. L'ancien nous a créer, et a construit cette caverne pour nous améliorer.</text> + <text id="dragon14">Cependant, les réponses peuvent se trouver dans les îles à l'est. Revenez dans cette caverne lorsque vous serez prêt, et je vous emmènerais là-bas.</text> + <text id="dragon2">Je le savais! Les [item=wyrm]s se métamorphosent en [item=dragon]! Mais alors pourquoi y aurait-il si peut de [item=adult_dragon] dans les plaines ?</text> + <text id="dragon3">je crois qu'il y a un repaire de dragon quelque part dans la montagne. SI tu le trouve, appelle moi... peut-être certains de ces secrets peuvent être découvert ici.</text> + <text id="dragon4">Ah! Un [item=adult_dragon]! Écoutons ce qu'il pourrait nous dire - À l'aide d'un simple sort je pourrait le traduire pour toi.</text> + <text id="dragon5">Qui est tu, et comment ose-tu me réveiller?</text> + <text id="dragon6">Je suis à la recherche de vérité et de magie. Dis mois - pourquoi y a t-il si peu de dragons dans le monde?</text> + <text id="dragon7">Car les anciens sont partis. Ils étaient chercheur de vérité et de magie eux aussi. Et ils m'ont trahis.</text> + <text id="dragon8">Alors peut-être que nous pouvons vous aider! Tout ce que nous demandons en échanges c'est du savoir.</text> + <text id="dragon9">Vous pensez que vous pouvez m'aider? alors prouvez-le. Si vous êtes capable de faire naître et m'apporter [var=quest.hatch_dragons.dragon] [item=dragon]s, alors nous pourront parler. Autrement, hors de ma vue!</text> + <text id="elementals1">J'ai déterminé qu'une [item=spirit_gem] peut capturer un esprit de feu ou d'eau, résultant en [item=fire_gem] ou [item=water_gem]. Les gemmes infusées devraient nous permettre d'activer les structures.</text> + <text id="elementals2">Vous n'arrivez pas à trouver des esprits élémentaires? Ils sont invisibles à l'œil nu, mais ma [item=goggles] devrait les révéler!</text> + <text id="elementals3">Vous pouvez placer une [item=spirit_gem] comme des pièges, puis capturer les esprits en les attirant sur eux!</text> + <text id="first1">Vous ne vous êtes pas écrasés avec nous?</text> + <text id="first2">Non, je faisais partie d'une mission de reconnaissance pour le programme de colonisation.</text> + <text id="first3">Nous étions quatre. Mais, les trois autres sont morts, et quand ils sont venus peu après, je savais que cette planète était maudite.</text> + <text id="first4">J'ai survécu à peine, en utilisant ce que j'avais appris de la magie. Peut-être que si j'avais eu ces [item=goggles] à l'époque, les choses auraient été différentes.</text> + <text id="first5">Ils étaient là ?! Après vous?</text> + <text id="first6">Oui. Je crois qu'ils étaient jaloux de ma magie. Ou effrayé? C'est dur à dire à coup sûr ...</text> + <text id="forest">Cette forêt à l'est est dangereuse. J'ai mis en place une [item=fence], et je vous recommande de ne pas aller au-delà.</text> + <text id="introduce1">Il y a plus que ce que l'on peut voir sur cette planète. J'ai fais quelques expérimentations, et je crois avoir découvert la magie!</text> + <text id="introduce2">J'ai besoin de matériaux. Si tu rencontre un [item=wyrm], tue-le et rapporte moi du [item=dragonblood] et je ferais en sorte que tu sois récompensé pour cela!</text> + <text id="lab1">Je le savais! C'est un secret! Je dois faire un laboratoire immédiatement!</text> + <text id="lab2">Ta récompense? Apporte moi les matériaux à mon lab et je ferais des potions magiques rien que pour toi.</text> + <text id="lab3">Plus vite! Ma recherche est à l'arrêt jusqu'à ce que je récupère du [item=dragonblood]!</text> + <text id="lair1">je le savais! Cette caverne est artificielle, crée avec de la magie! Il semble que son but soit d'améliorer les dragons!</text> + <text id="lair2">Je pense que je peut l'activer...</text> + <text id="lair3">Aha! Fini! Avec cette caverne, nous pouvons améliorer nos propre dragons. La caverne semble pointé vers l'est.Peut-être pouvons-nous voler sur un dragons et en savoir plus...</text> + <text id="magic_farm1">Qu'attendez-vous? Utilisez la [item=water_gem] à la structure bleue pour l'activer!</text> + <text id="magic_farm2">La structure bleue est un synthétiseur magique! Il peut créer des objets de la magie!</text> + <text id="magic_farm3">Utilisez des [item=focus_gem]s pour alimenter le synthétiseur.</text> + <text id="magic_farm4">Nous avons toujours besoin d'un [item=water_gem] pour alimenter la structure bleue! Utilisez une [item=spirit_gem] pour capturer un élémentaire d'eau!</text> + <text id="magic_forge1">Qu'attendez-vous? Utilisez la [item=fire_gem] à la structure rouge pour l'activer!</text> + <text id="magic_forge2">La structure rouge est une sorte d'ancienne forge magique. Elle peut enchanter les objets!</text> + <text id="magic_forge3">Essayez d'expérimenter avec différentes combinaisons d'objets et d'ingrédients magiques à la Forge - vous tomberez peut-être sur quelque chose de génial!</text> + <text id="magic_forge4">Nous avons toujours besoin d'une [item=fire_gem] pour alimenter la structure rouge! Utilisez une [item=spirit_gem] pour capturer un élémentaire de feu!</text> + <text id="magic_intro1">Cette île déborde de magie - nous sommes définitivement au bon endroit!</text> + <text id="magic_intro2">J'ai déjà vu ce genre de magie. Ces structures sont partiellement organiques et sont toutes en hibernation. Ils auront besoin d'être réveillés.</text> + <text id="magic_intro3">Je sais déjà comment activer cette chambre pourpre, mais les autres structures nécessiteront plus d'études.</text> + <text id="magic_intro4">Cela devrait être une bonne base d'opérations. Je vais mettre en place des fournitures.</text> + <text id="muttering">Synthèse de gemmes… carapace imbriquée… évolution indéfini… [font=drachenklaue]n'importe quoi[/font]...</text> + <text id="oldone1">J'ai remarqué des pointes très étranges dans l'énergie magique ces derniers temps. Ça pourrait ne rien être, mais ça pourrait être l'un d'entre eux.</text> + <text id="oldone10">Mais maintenant je vois qu'ils avaient raison à propos d'une chose. L'univers serait mieux sans toi et ton genre!</text> + <text id="oldone11">Vous allez regrettez de choisir de me déranger!</text> + <text id="oldone12">Non!</text> + <text id="oldone13">Quel est le problème, n'avons-nous pas gagné?</text> + <text id="oldone14">Nous étions trop lents! Il a envoyé un signal. Ils sauront que nous sommes sur cette planète!</text> + <text id="oldone15">Nous devons apprendre toute la magie que nous pouvons - et utiliser leur pouvoir contre eux quand ils viennent! Sinon, nous sommes tous condamnés.</text> + <text id="oldone16">Vous êtes plus adepte de la magie que ce à quoi je m'attendais! Cela ne peut pas être autorisé, seulement nous devrions utiliser la magie.</text> + <text id="oldone17">Il envoie un signal! S'ils l'entendent, ils viendront! Je dois finir ça rapidement!</text> + <text id="oldone18">Qu'est-il arrivé? Ça va?</text> + <text id="oldone19">Non… [pause=4]Le signal a été envoyé… [pause=4]Et ma force de vie a été complètement drainée ...</text> + <text id="oldone2">Si vous le trouvez, invoquez-moi immédiatement. Si c'est vraiment l'un d'entre eux, nous sommes tous en grave danger.</text> + <text id="oldone20">C'est à vous maintenant… [pause=4] Dépêchez-vous!… [pause=4] Trouvez les réponses… Utilisez leurs magie…</text> + <text id="oldone3">Bon, voyons si ma traduction fonctionne!</text> + <text id="oldone4">Qui êtes-vous et que faites-vous ici?</text> + <text id="oldone5">Quel droit avez-vous de me demander cela? C'est ma maison, ma planète! Vous êtes les intrus ici!</text> + <text id="oldone6">Cet exosquelette magique a l'air vaguement familier ... en êtes-vous un?</text> + <text id="oldone7">Ceux que vous appelez "eux" sont mes frères fous. Il y a longtemps, ils ont choisi d'abandonner leur monde natal, pendant que je restais et prenais un chemin d'isolement et d'immortalité.</text> + <text id="oldone8">Pouvez-vous nous parler de votre magie? Quelles sont ces pointes d'énergie magiques? Pourquoi avez-vous créé et élevé les dragons?</text> + <text id="oldone9">Silence! Nous ne parlons pas de ces choses avec des gens comme vous! J'ai été très tolérant. Sinon, vous auriez été mort il y a longtemps.</text> + <text id="oldone_attack">Attaquer-le maintenant!</text> + <text id="oldone_beam">Je détecte un pic d'énergie magique! Je ne pense pas que ma barrière sera capable de bloquer cette attaque!</text> + <text id="oldone_choice">Vous n'êtes pas de taille pour cette créature. Nous aurons besoin d'un plan si nous voulons survivre!</text> + <text id="oldone_tips1">Je vais mettre en place une barrière défensive et une magie de guérison. Restez derrière moi pendant qu'il attaque, puis frappez-le quand il est surchargé.</text> + <text id="pen1">J'ai besoin de plus de [item=dragonblood]! Apportes moi [var=quest.wyrm_pen.wyrm] [item=wyrm]s vivants et on aura une source infinie de [item=dragonblood] pour expérimenter avec!</text> + <text id="pen2">Excellent! Recules pendant que je travaille ma magie!</text> + <text id="pen3">Voici ma brillante invention - l'[color=770000]Enclos à Wyrm[/color]! C'est plus qu'un simple Enclos, c'est une source infinis de [item=dragonblood]!</text> + <text id="return1">Que faites-vous ici?!</text> + <text id="return2">J'utilise le laboratoire pour analyser des échantillons de l'est de l'île.</text> + <text id="return3">Je veux dire, comment êtes-vous revenu ici si vite?</text> + <text id="return4">De la même façon que je me déplace partout! En me téléportant. Évidemment. Maintenant arrête de me déranger, je dois finir mon analyse.</text> + <text id="second1">Vous les avez rencontrés sur cette planète il y a dix ans? C'est avant qu'ils aient essayé d'éliminer l'humanité et de détruire la Terre!</text> + <text id="second2">Correct. J'ai été le premier à les rencontrer, et le premier qu'ils ont essayés de tuer.</text> + <text id="second3">Je ne sais pas ce que j'aurais pu faire différemment pour arrêter la guerre. Ils sont arrivés soudainement avec leurs armes biologiques et ont attaqué sans un mot.</text> + <text id="second4">Si seulement il y avait un moyen de communiquer avec eux ...</text> + <text id="second5">Nous pourrions probablement communiquer avec eux maintenant, en utilisant ma traduction magique.</text> + <text id="second6">Mais, espérons que nous ne les rencontrerons plus jamais, maintenant qu'ils semblent contents de nous ignorer.</text> + <text id="shadow_cape1">Laisse moi voir cette [item=dark_fur]! Il semble exister entre le monde des esprits et le monde des vivants...</text> + <text id="shadow_cape2">Je vais devoir chercher plus loin, mais je peux facilement le transformer en un [item=shadow_cape] qui te cachera des yeux normaux.</text> + <text id="sleep">J'ai besoin de plus de temps pour étudier ça. Pourquoi ne te repose-tu pas dans la chambre pourpre?</text> + <text id="work_together">Travailler ensemble</text> + <text id="wyrm">Je parie que tu peux capturer un [item=wyrm] avec un [item=net]si elle était lourdement blessé. Mais vous devez l'attraper vivant!</text> + <text id="wyrm1">Les indices permettant d'activer les autres structures peuvent se trouver dans [item=wyrm]s.</text> + <text id="wyrm2">Vous devriez en suivre un sur cette île et apprendre leurs secrets, pendant que je traduis certaines de ces marques.</text> + <text id="wyrm3">Ne vous inquiétez pas - vous vous êtes déjà occupez d'un [item=wyrm] auparavant. Le suivre à son repaire ne devrait pas poser de problème!</text> + <text id="wyrm4">Qu'est-ce que c'est? Il y avait une Reine Wyrm? C'est hors de propos, regardez la [item=spirit_gem] que vous avez trouvé! Je suis certain que c'est ce dont nous avons besoin pour faire une percée!</text> + <text id="wyrm5">Essayez ces[item=goggles]. Les marques m'ont aidé à les inventer, et bien qu'elles ne m'aident pas à voir le secret derrière ces structures, elles peuvent vous aider à voir ce qui nous manque.</text> + </section> + <section id="player"> + <text id="bandits1">C'est génial de revenir en affaires! Maintenant, si seulement nous pouvions nous débarrasser de ces bandits voleurs!</text> + <text id="bandits2">Vous semblez fort. Vous pensez pouvoir les effrayer pour nous?</text> + <text id="bandits3">Vous avez battu les bandits! S'il vous plaît, prenez ces cadeaux comme des marques de reconnaissance.</text> + <text id="bandits4">C'est notre jour de chance - notre proie est venue nous rejoindre! Les choses se passent bien depuis que nous avons fui ces Mirrows et leurs mauvaises expériences!</text> + <text id="dock1">Je me demande si le voleur disait la vérité sur les autres survivants?</text> + <text id="dock2">Peut-être que je devrais construire un [color=770000]Port[/color] pour les retrouver. Il me faudra [var=quest.dock2.wood] [item=wood], [var=quest.dock2.steel_bar] [item=steel_bar]s et [var=quest.dock2.gold_bar] [item=gold_bar]s.</text> + <text id="dock3">Bien, allons faire ce [color=770000]Port[/color]!</text> + <text id="farewell1">Je ne sais pas ce qui existe là-bas, mais je veux le savoir avant de revenir.</text> + <text id="farewell2">Rapportez de bonnes choses à manger!</text> + <text id="farewell3">N'oubliez pas d'explorer sous la surface, vous ne savez jamais ce que vous pourriez découvrir.</text> + <text id="farewell4">Ne nous laissez pas traîner - revenez bientôt.</text> + <text id="farewell5">Ne vous mêlez pas de quelque chose de trop dangereux.</text> + <text id="farewell6">C'est un monde incertain.</text> + <text id="farewell7">Vous allez dans le mauvais sens, les secrets sont tous à l'est!</text> + <text id="lurker">Hey gamin, Tu veux des produits rares? Tu ne peux pas les acheter ailleurs!</text> + <text id="lurker_empty">Merci pour les affaires. Désolé, aucun remboursement.</text> + <text id="make_coin_purse">Échanger[var=recipe.sci1_coin_purse.sulfur] [item=sulfur] pour une [item=coin_purse]?</text> + <text id="market1">Peut être que si je crée un [color=770000]Marché[/color], Cela attirera les marchands vers mon port. Je peut en construire un pour [var=quest.market2.gold_bar] [item=gold_bar]s.</text> + <text id="market2">C'est tout ce que j'avais besoins pour le [color=770000]Marché[/color]!</text> + <text id="market3">Il semblerais qu'il y ait vraiment des marchands ici! Ils m'ont même donné un [item=coin_purse] pour stocker l'argent quand je vend et achète.</text> + <text id="market4">Maintenant nous avons juste besoin de construire un [item=boat] au [color=770000]Port[/color]!</text> + <text id="no_coin_purse">Vous aurez besoin d'une [item=coin_purse] si vous voulez échanger avec nous. Nous pouvons vous en donner un pour [var=recipe.sci1_coin_purse.sulfur] [item=sulfur].</text> + <text id="ore_cave">Cet endroit est bizarre, comme si je suis entré dans une autre dimension. J'ai le sentiment que ce sera différent chaque fois que j'entre.</text> + <text id="storehouse1">Cette hache pourrait être utile. Avec ça je pourrais construire un [color=770000]Entrepôt[/color] pour stocker ce que je récupère.</text> + <text id="storehouse2">Je parie que je peux faire un Entrepôt avec [var=quest.storehouse.wood] [item=wood] et [var=quest.storehouse.berries] [item=berries]s.</text> + <text id="storehouse3">Super! Allons faire cet Entrepôt!</text> + <text id="storehouse4">Parfait. Maintenant, je peux éviter de me fatiguer à porter trop de choses.</text> + <text id="storm1">La tempête grossit. J'ai besoin d'un Abri, mais il n'y a rien autour d'ici si ce n'est que des branches tombées!</text> + <text id="storm2">Je devrais essayer de construire un [color=770000]Abri[/color]. [var=quest.hut.wood] [item=wood] devrait suffire.</text> + <text id="storm3">Tellement fatigué... Je peine à tenir tout ce [item=wood]. Juste un peu plus et je pourrait me reposer dans l'[color=770000]Abri[/color].</text> + </section> + <section id="hunter"> + <text id="accept1">Vous devez utiliser l'élément de surprise. Frappez des ennemis par derrière et vous obtiendrez un coup critique.</text> + <text id="accept2">L'[item=bow] est mon arme de prédilection. Tenez, essayez mon [item=workbench] - vous pouvez faire un [item=bow] et quelques [item=arrow]s par vous-même.</text> + <text id="accept3">Utilisez [key=equipment] pour équiper une arme, et [key=attack] pour attaquer avec l'arme équipée.</text> + <text id="accept4">Pourquoi ne pas créer un [item=bow] et tuer des [color=770000] [tile=boar]s [/color]. Et laissez-moi savoir si vous avez besoin de conseils de chasse!</text> + <text id="fence1">Je voudrais garder la faune en contrôle ici.</text> + <text id="fence2">Pourriez-vous utiliser le [item=workbench] que je vous ai donné pour faire [var=quest.fence.fence] [item=fence]s? Ensuite, nous pourrions commencer à mettre en place un périmètre.</text> + <text id="fence3">Parfait. Le [color=770000] [tile=boar]sanglier [/color]s ne peut pas traverser les [item=fence]s, donc nous pouvons les utiliser pour protéger notre périmètre.</text> + <text id="fence4">J'en placerai un ici, placez l'autre [item=fence] autour de notre base pour le protéger!</text> + <text id="hunt1">Nous ferons disparaître cette zone de créatures dangereuses en un rien de temps!</text> + <text id="hunt2">Pour un travail bien fait, laissez-moi vous donner mon ancien [item=backpack] - il pourrait être utile lorsque vous êtes sur le terrain.</text> + <text id="intro1">Hé, vous! M'avez-vous vu abattre ce sanglier?</text> + <text id="intro2">Ouais, comment ... comment avez-vous fait ça?</text> + <text id="intro3">Simple! Un peu de technique appropriée est tout ce dont vous avez besoin.</text> + <text id="intro4">J'essaie de nettoyer cette zone. Si vous m'aidez, je pourrais vous apprendre à chasser.</text> + <text id="reject1">Vous semblez dangereux. Restez en dehors de notre région!</text> + <text id="reject2">Bien, bien! Je vais juste retourner dans les montagnes alors!</text> + <text id="reject3">Prêt à apprendre des techniques de chasse?</text> + <text id="tent1">Je ne devrais pas me reposer dans la tente d'une personne au hasard!</text> + <text id="tent10">Pas sûr. La côte sur cette fin est perfide. De plus, ces îles me semblaient étranges. Peut être dangereuses.</text> + <text id="tent11">Donc, vous dites que nous devrions simplement nous contenter de la façon dont les choses sont?</text> + <text id="tent12">Je dis que nous n'avons pas besoin d'emprunter des problèmes quand la vie est déjà difficile.</text> + <text id="tent2">Ce doit être la tente du [color=770000] [tile=hunter] Chasseur [/color]. Je devrais le laisser tranquille.</text> + <text id="tent3">Alors j'étais là, frissonnant et seul sur la montagne sombre, quand j'ai vu la lumière du feu! Et entendu rire! Cela semblait tellement agréable ...</text> + <text id="tent4">Alors vous êtes venus pour devenir amis avec nous?</text> + <text id="tent5">Bien sûr que non. Et je ne chassais certainement pas des sangliers pour vous impressionner. Pas du tout.</text> + <text id="tent6">Je voulais simplement élargir mon champ de chasse.</text> + <text id="tent7">J'aimerais en savoir plus sur cet endroit et savoir s'il y a quoi que ce soit au-delà de cette île ...</text> + <text id="tent8">Il y a d'autres îles à l'est. Je les ai vus, du haut des montagnes.</text> + <text id="tent9">Pensez-vous que nous pourrions y arriver?</text> + <text id="tip1">Vous pourriez creuser un tunnel pour vous faufiler des sangliers et les frapper par derrière.</text> + <text id="tip2">Les [item=red_berries]s peut être utilisés pour augmenter temporairement votre puissance d'attaque - mais attention, ils ne sont pas bons pour votre santé.</text> + <text id="tip3">Si vous continuez à être "bloqué", cet ennemi est trop fort pour vous. Vous aurez besoin d'une meilleure arme ou d'une attaque plus forte.</text> + <text id="wolf1">J'ai remarqué qu'un chiot loup traînait autour de notre territoire. Il semble seul.</text> + <text id="wolf2">N'a-t-il pas de troupeau?</text> + <text id="wolf3">Ils doivent l'avoir laissé derrière.</text> + <text id="wolf4">Avec un [var=quest.wolf.net] [item=net]s, [var=quest.wolf.trap] [item=trap]s et [var=quest.wolf.meat] [item=meat], nous pourrions être en mesure de l'apprivoiser.</text> + <text id="wolf5">Bon, voyons ce que nous pouvons faire avec ce chiot.</text> + <text id="wolf6">Bien joué, il semble avoir entièrement confiance en vous. Vous avez un compagnon fidèle maintenant.</text> + <text id="wolf7">Vous pouvez faire en sorte que [item=wolf] vous suive en utilisant le menu [color=770000] Familier [/color] dans votre fenêtre [color=770000] Équipement [/color].</text> + </section> + <section id="mechanic"> + <text id="battery">Dites-moi quand vous avez créé une [item=battery], car nous serons en mesure de faire des choses sympas une fois que nous aurons une source d'alimentation mobile!</text> + <text id="dragon">Qu'est-ce que cette créature cracheuse de feu qui nourrit la centrale? Il vaut mieux ne pas le casser!</text> + <text id="elevator1">J'ai remarqué que vous avez fait beaucoup de minage.</text> + <text id="elevator2">Ne serait-il pas commode d'avoir un engin pour vous aider à remonter à la surface?!</text> + <text id="elevator3">Sympa! Faisons-le!</text> + <text id="elevator4">Ça avance? Ou devrais-je dire ça descend!</text> + <text id="factory1">Maintenant que nous avons de nouveau de l'énergie, j'espère que nous aurons de nouvelles machines avec lesquelles jouer.</text> + <text id="factory2">Si vous m'aidez à créer un [color=770000] Factory [/color], nous pourrions fabriquer toutes sortes de choses!</text> + <text id="factory3">Ce sera génial. Enfin un nouveau projet pour bricoler.</text> + <text id="factory4">Maintenant nous pouvons affiner les matériaux et construire des [item=drill]s, [item=chainsaw]s, [item=shotgun]s, et d'autres trucs sympas.</text> + <text id="intro1">Il y a plus de survivants ici que ce à quoi je m'attendais!</text> + <text id="intro2">Oui? Mais ce n'est pas suffisant. Si nous voulons survivre en tant qu'espèce, nous devrons rejoindre d'autres colonies.</text> + <text id="intro3">Vous pensez qu'ils l'ont fait?</text> + <text id="intro4">Je suis sûr qu'ils sont là-bas. Nous avons juste besoin d'un moyen de les trouver et de les atteindre.</text> + <text id="intro5">Et si on nous attaque en chemin?</text> + <text id="intro6">Alors au moins on a essayé! Je ne vais pas m'asseoir ici sur cette planète juste parce que je me sens en sécurité pour le moment.</text> + <text id="introduce1">C'est complètement frit! C'est affreux!</text> + <text id="introduction2">Que s'est-il passé?</text> + <text id="introduction3">Les Mirrows ont essayé de rediriger le pouvoir et ont presque tout chamboulé!</text> + <text id="introduction4">On s'attend à ce que nous nettoyons après leurs expériences ratées ... gah!</text> + <text id="introduction5">Je n'ai même plus de [item=titanium], donc il n'y a pas moyen de le réparer ...</text> + <text id="mirrows1">Hé, qu'est-ce qui ne va pas? Vous regardez vers le bas.</text> + <text id="mirrows10">Nous aurions besoin de quelque chose de vraiment spécial pour les amener à changer de direction.</text> + <text id="mirrows11">Que pensez-vous de ce [item=dragon_armor]? Il a la puissance d'un [item=adult_dragon], mais peut être porté comme une armure!</text> + <text id="mirrows12">C'est tellement bizarre, mais je pense vraiment que ça vaut le coup. Montrons-le à mes parents.</text> + <text id="mirrows13">Retour à nouveau? Cette fois, nous allons vous transformer en cyborg!</text> + <text id="mirrows14">Attendez! N'attaque pas, c'est moi.</text> + <text id="mirrows15">Cass? Que fais-tu ici?</text> + <text id="mirrows16">Je veux que vous jetiez un coup d'œil à ceci. Peut-être que vous n'avez pas à transformer les gens en cyborgs après tout.</text> + <text id="mirrows17">Quelle est cette chose? Ses lectures de puissance sont hors des charts, mais ça ne semble pas du tout fait par l'homme!</text> + <text id="mirrows18">Si je vous dis, acceptez-vous d'arrêter votre expérimentation humaine et votre extorsion?</text> + <text id="mirrows19">Bien sûr, cela pourrait être une toute nouvelle ligne de recherche pour nous!</text> + <text id="mirrows2">J'ai essayé de demander aux Mirrows d'arrêter de harceler tout le monde, mais ils n'écoutent pas et je ne veux pas les combattre.</text> + <text id="mirrows20">Il s'avère que les espèces qui habitaient à l'origine cette planète ont créé les dragons et l'équipement magique. Et, cette espèce peut avoir été - eux.</text> + <text id="mirrows21">Nous utiliserons leurs propres créations contre eux! Quelle délicieuse ironie!</text> + <text id="mirrows3">Bon à essayer. Mais ils sont têtus comme des mulets, et n'écoutent rien sauf la force.</text> + <text id="mirrows4">Je n'abandonne pas encore. Ce n'est pas juste qu'ils puissent abuser de leur pouvoir comme ça.</text> + <text id="mirrows5">Essayez peut-être d'en apprendre le plus possible sur les Mirrows. Avez-vous vérifié toutes les zones autour de leur laboratoire?</text> + <text id="mirrows6">Êtes-vous le "C" dans les notes de laboratoire des Mirrows? Travaillez-vous avec eux?</text> + <text id="mirrows7">Non ... pas exactement. Ils sont - [pause = 4] Ils sont mes parents.</text> + <text id="mirrows8">Vos parents !? Si vous êtes leur fille, peut-être qu'ils vous écouteraient. Voulez-vous essayer de négocier avec eux?</text> + <text id="mirrows9">Croyez-moi, j'ai essayé. Ils n'écouteront pas la raison. Ils sont trop concentrés sur leurs "améliorations" et ne considèrent même pas d'autres solutions à nos problèmes.</text> + <text id="powerplant1">Wow, je ne m'attendais pas à ce que tu reviennes vraiment avec du [item=titanium].</text> + <text id="powerplant2">Merci, maintenant je peux le faire réparer en un rien de temps.</text> + <text id="powerplant3">Retour en affaires! Nous pouvons utiliser [item=coal] ou [item=refined_oil] pour alimenter la plante. Vous pouvez également faire un [item=battery] ici.</text> + <text id="powerplant4">Oh, et prenez cette ferraille de la réparation en remerciement pour le [item=titanium]!</text> + <text id="powerplant5">Je ne trouverai plus jamais de [item=titanium], c'est sans espoir!</text> + <text id="repair">Besoin de quelque chose de réparé? Je suis votre fille!</text> + <text id="tip1">Utilisez du [item=sulfur] et un [item=steel_bar] pour faire une [item=battery] à la [color=770000] Centrale Électrique [/color]. Vous pouvez les recharger là aussi.</text> + <text id="tip2">Ajoutez simplement les [item=battery]s à votre inventaire pour alimenter votre équipement.</text> + <text id="tip3">Votre [tile=power] [color=444400] Énergie [/color] total sera affiché sous votre [tile=health] [color=770000]santé [/color] et [tile=stamina ] [color=006600] Endurance [/color].</text> + </section> + <section id="innkeeper"> + <text id="intro1">Bienvenue chez Golden Key! La plus belle (et la seule) chambre de ce côté du désert!</text> + <text id="intro2">Donc c'est une auberge? Avez-vous beaucoup de gens à travers ici?</text> + <text id="intro3">Quelques-uns passent par Sunset Haven - explorant, échangeant, cherchant un endroit où se loger.</text> + <text id="intro4">Mais si nous ne retrouvons pas l'électricité bientôt, qui sait si quelqu'un restera? Je ne peux pas vous dire combien de fois j'ai été tenté d'aller donner à ces Mirrows ce que je pensais!</text> + <text id="mirrows1">Les Mirrows ont accepté d'arrêter de vous demander de l'argent et d'expérimenter sur les gens!</text> + <text id="mirrows2">Excellent! Peut-être que nous pouvons enfin avoir un peu de paix ici maintenant.</text> + <text id="mirrows3">Prends ceci comme un gage de mon appréciation.</text> + <text id="mirrows4">... [item=coal]?</text> + <text id="mirrows5">Quoi? Je ne suis pas un organisme de bienfaisance, vous savez.</text> + <text id="no_money">Pas assez d'argent? Alors j'ai peur que tu ne puisses pas rester ici. Ce n'est pas une charité, vous savez!</text> + <text id="no_power">Je crains que nous ne puissions pas vous gardez ici jusqu'à ce que le courant revienne.</text> + <text id="power1">Merveilleux! Le pouvoir est de retour!</text> + <text id="power2">Non merci à ces sacrés Mirrows. Je ne peux pas croire que nous payons tous leurs cotisations pour que la technologie continue de fonctionner ici!</text> + <text id="power3">Et non seulement ils font frire la centrale électrique, ils ne peuvent pas prendre la peine de la contourner et de la réparer?!</text> + <text id="power4">Tu ne peux pas arrêter de les payer?</text> + <text id="power5">Je ne peux pas quitter l'auberge, mais si quelqu'un allait dans le désert et y faisait face, nous pourrions peut-être renoncer à cet arrangement injuste.</text> + <text id="scene1">J'entends le vaisseau principal s'écraser quelque part ici? Comment avez-vous survécu sans pods de vie?</text> + <text id="scene2">C'est exactement notre problème. Les Mirrows nous ont sauvés. Ils ont fait des améliorations de dernière minute incroyables et protégé un secteur entier de l'oblitération. Nous sommes donc endettés.</text> + <text id="scene3">Mais maintenant, ils ont détruit notre pouvoir, et ils laissent les étranges créatures libres pour faire des ravages.</text> + <text id="scene4">J'ai même entendu dire que des gens ont disparu dans le désert, où les Mirrows ont été vus pour la dernière fois.</text> + <text id="scene5">Et ils s'attendent à ce que nous supportions tout cela? Et même payer des cotisations à eux? C'est devenu trop.</text> + <text id="visit">Voulez-vous passer la nuit? Seulement 50 [color=770000] [tile=coin_purse.ico] Pièces de monnaie [/color], et je vais inclure un repas chaud!</text> + </section> + <section id="fisherman"> + <text id="cat1">Hé, mon [item=cat] Peri s'est encore enfui de moi! Pensez-vous que vous pourriez m'aider à la trouver?</text> + <text id="cat11">Donnez à Peri une [item=toothfish]?</text> + <text id="cat12">Elle n'a pas décollé aussi vite cette fois-ci.</text> + <text id="cat13">Viens ici Peri ... c'est une bonne fille ...</text> + <text id="cat15">Un chat capturé avec succès!</text> + <text id="cat2">Je pense qu'elle essaie d'éviter de naviguer. Pas un fan de l'eau.</text> + <text id="cat3">Si vous m'aidez, je vais vous apprendre ce que je sais de la pêche.</text> + <text id="cat4">Génial, merci! Voici une [item=fishing_rod] de réserve, parlez-moi si vous voulez des conseils de pêche!</text> + <text id="cat5">[item=toothfish] est la nourriture préférée de Peri, peut-être pourriez-vous la tenter avec certains d'entre eux?</text> + <text id="cat6">Hey, tu as trouvé mon [item=cat]! Merci, mec.</text> + <text id="cat7">Sheesh, on dirait que tu l'as complètement conquise. Je parie qu'elle serait plus heureuse avec toi. Pourquoi ne la gardes-tu pas?</text> + <text id="cat8">Le chat est trop rapide pour que tu l'attrape!</text> + <text id="cat9">Elle a arraché le [item=toothfish] de ma main, mais elle est trop rapide, je ne peux pas l'attraper.</text> + <text id="intro1">Enfin de retour sur terre! tu as l'air d'être arrivé aussi!</text> + <text id="intro1_alt">Hey! C'est agréable de voir d'autres survivants naviguer ici!</text> + <text id="intro2">Ne fais pas attention à elle, c'est juste la façon de dire bonjour de Polly. J'espère que cela ne te dérange pas un peu d'eau de mer sur vos bottes!</text> + <text id="intro3">Alors, as-tu déjà visité cette île?</text> + <text id="intro3_alt">Alors, savez-vous quelle île se trouve en avant?</text> + <text id="intro4">Bien sûr, cette île s'appelle Sunset Haven, et elle a plus de survivants que n'importe quelle autre île que j'ai vue.</text> + <text id="intro4_alt">Bien sûr, l'île s'appelle Sunset Haven, et il y a plus de survivants que n'importe quelle autre île que j'ai vue.</text> + <text id="intro5">Ça a du sens aussi - car c'est là que le vaisseau principal s'est écrasé.</text> + <text id="intro6">Mais regarde-toi. J'ai entendu de mauvaises rumeurs à propos de Sunset Haven dernièrement ...</text> + <text id="scene1">Moi, c'est tout ce dont j'ai besoin - un toit au-dessus de ma tête, le soleil et le vaste océan pour pêcher.</text> + <text id="scene2">Et tu? Quel est ton rêve?</text> + <text id="scene3">J'aimerais vraiment savoir s'il y a un moyen de quitter cette planète.</text> + <text id="scene4">Quoi, pourquoi !? as-tu un désir de mort? Ces choses n'ont aucune pitié.</text> + <text id="scene5">Je veux en savoir plus sur eux ... et pourquoi les choses se sont passées comme elles l'ont fait ...</text> + <text id="scene6">Écoute l'ami, j'en ai vu un de première main avant de partir de la Terre. Tout ce que tu dois savoir, c'est comment les éviter.</text> + <text id="tip1">La pêche est une question de timing. Utilise ta canne à pêche à la fin du quai, puis appuie sur [key=select] quand il y a quelque chose sur la ligne - trop tôt ou trop tard, et tu perdrez la prise!</text> + <text id="tip2">S'il est écrit "Attendez...", le poisson a besoin d'un peu plus de câlins. Attendez jusqu'à ce que ca dise "Tirez maintenant!" puis appuyez à nouveau sur [key=select]!</text> + <text id="tip3">Certains poissons sont plus difficiles à attraper et nécessitent plus de touches. Gardez un œil sur l'info-bulle et appuyez sur la touche qui s'affiche!</text> + </section> + <section id="mirrows"> + <text id="defeat0">Incroyable! D'une façon ou d'une autre, vous êtes plus fort que moi, même avec notre cybernétique avancée!</text> + <text id="defeat1">Vous devez nous dire les secrets de votre force - vous pourriez être la clé pour sauver l'humanité!</text> + <text id="defeat2">Si je vous dis mes secrets, acceptez-vous d'arrêter de harceler les citadins et de leur demander de l'argent?</text> + <text id="defeat3">Bien sûr. Pourquoi aurions-nous besoin de ces spécimens ternes quand nous vous aurons!?</text> + <text id="defeat4">Ce sera une toute nouvelle ligne de recherche pour nous!</text> + <text id="defeat5">N'hésitez pas à utiliser notre laboratoire de chirurgie. Nous serions très intéressés de voir votre puissance avec nos améliorations cybernétiques!</text> + <text id="intro1">Êtes-vous les Mirrows? Pourquoi avez-vous tourmenté Sunset Haven et créé ces étranges mutants?</text> + <text id="intro2">Vous ne comprenez pas! Nous faisons cela pour le bien de tout le monde! Nous ne pouvons pas survivre sans armes ultimes!</text> + <text id="intro3">Quand ils viendront nous exterminer, nous serons prêts! Les sacrifices faits ont été nécessaires.</text> + <text id="intro4">Vous ne pouvez pas vous contenter de sacrifier les gens pour un avenir qui ne sera peut-être jamais arrivé! Il y a de meilleurs moyens de sauver tout le monde!</text> + <text id="intro5">Si vous êtes déterminé à travailler contre nous, nous n'avons d'autre choix que de vous combattre.</text> + <text id="intro6">J'ai l'impression que votre corps est exactement ce dont j'ai besoin pour ma nouvelle invention Cyborg!</text> + <text id="nav1">On dirait que l'écran de navigation fonctionne toujours. D'après cela, nous sommes actuellement sur Unoiks 428e.</text> + <text id="nav2">Est-ce que les Mirrows ont ajouté cette note ?! Je dois leur demander à ce sujet...</text> + <text id="nav3">Nous sommes sur la terre de l'ennemi? Comment le savez-vous?</text> + <text id="nav4">Nous ne pouvons pas être certains ... mais nous avons pris des échantillons de nombreuses ruines sur cette planète. Non seulement ils correspondent à leur technologie, mais ils datent d'il y a plus d'un million d'années!</text> + <text id="nav5">Mais ils sont partis maintenant?</text> + <text id="nav6">Nous ne les avons pas détectés sur cette planète, mais même s'ils sont partis, ils sont sûrs de revenir finalement.</text> + <text id="nav7">C'est pourquoi nous étions prêts à tout sacrifier pour la force ... à partir du jour où nous avons atterri sur cette planète, une confrontation avec eux est devenue inévitable.</text> + <text id="tip1">Vous pouvez uniquement supprimer les améliorations cybernétiques au laboratoire de chirurgie. Sélectionnez l'emplacement que vous souhaitez supprimer, puis sélectionnez aucun. Vous pouvez réinstaller les améliorations plus tard, mais cela coûtera plus de ressources.</text> + </section> + <section id="scene.hut"> + <text id="first1">Pas mal pour mon premier abri.</text> + <text id="first2">Aidez-moi…[pause=4]s'il vous plaît…[pause=4] un abri…</text> + <text id="first3">Quelqu'un est dehors! Je peux lui faire confiance?</text> + <text id="first4">Merci. Je te dois la vie. Mais que fais-t-on maintenant?</text> + <text id="first5">Pour l'instant, on reste au chaud et au sec.</text> + <text id="first6">Mais après ça? Comment va-t-on survivre sur cette île déserte?</text> + <text id="first7">As-t-on un point de départ? On est bloqué ici, il n'y a pas de retour en arrière.</text> + <text id="first8">Au moins, on peut essayer. Peut-être que la vie ici ne sera pas aussi mauvaise que ce que tu penses.</text> + <text id="first9">S'il vous plaît…[pause=4] aidez-moi…</text> + <text id="fourth1">Donc dit-nous ce que tu sais sur les autres survivants?</text> + <text id="fourth2">La plupart d'entre nous ont été dispersés à travers différentes îles, mais certaines des îles ont plus de survivants et même une technologie avancée.</text> + <text id="fourth3">J'ai entendu des rumeurs comme quoi il y aurait un bateau proche intact.</text> + <text id="fourth4">Pourrait-il encore naviguer?</text> + <text id="fourth5">Comme j'ai dis, tout ce que j'ai entendu sont des rumeurs. Mais même si cela se produisait, ce serait une mort certaine. Le mieux est de rester sur cette île, ils ne semblent pas se soucier de nous ici.</text> + <text id="hunter1">Vous êtes si bon dans ce domaine. Étiez-vous un chasseur avant le crash?</text> + <text id="hunter2">Heh. Jamais tué un animal dans ma vie avant cela. J'étais un scientifique. Travail de labo. Molécules.</text> + <text id="hunter3">Wow. Comment avez-vous tout compris alors?</text> + <text id="hunter4">C'est incroyable ce que vous pouvez faire quand vous avez besoin de survivre.</text> + <text id="hunter5">Vous changez. Vous devenez quelqu'un que votre vieil individu reconnaîtrait à peine.</text> + <text id="mirrows1">Ils ont reconstruit la technologie?</text> + <text id="mirrows2">Ouaip, Sunset Haven a de l'équipement électrique et industriel.</text> + <text id="mirrows3">Mais les gens là-bas ne sont pas trop heureux avec les Mirrows qui ont tout mis en place.</text> + <text id="mirrows4">Les Mirrows ont survécu!?</text> + <text id="mirrows5">Vous les connaissez?</text> + <text id="mirrows6">Malheureusement. Nous faisions partie du même groupe de recherche à la maison, étudiant la génétique.</text> + <text id="mirrows7">Après l'attaque, ils ont commencé à faire des choses horribles comme l'expérimentation humaine. Je ne pouvais plus travailler avec eux.</text> + <text id="mirrows8">Hé, nous devrions reconstruire de la technologie ici aussi! S'ils peuvent le faire, pourquoi pas nous??</text> + <text id="mirrows9">C'est l'idée! Cet endroit se sentira comme à la maison en un rien de temps.</text> + <text id="second1">… Alors quand je suis arrivé ici, j'ai commencé à explorer et je ne savais même pas qu'il y avait une tempête.</text> + <text id="second2">Mais je suis content que tu sois là. J'en avais marre de manger de la terre, et il n'y a rien de mieux qu'un feu chaud après une longue journée sous terre.</text> + <text id="second3">Tu penses qu'il y a d'autres survivants là dehors?</text> + <text id="second4">Franchement, je suis surpris que quelqu'un ait survécu au crash. Mais on est en vie, donc peut-être qu'il y en a d'autres?</text> + <text id="third1">Maintenant, je parie que le jeunot pense que c'est la fin du monde, mais la même chose est arrivé pendant la 3eme guerre mondiale et je suis toujours là.</text> + <text id="third2">Je suis optimiste, on doit juste voir le bon côté des choses, et soyons heureux qu'il y ait de la nourriture et de la compagnie.</text> + <text id="third3">Mais combien de temps faudra-t-il vivre sur cette île délaissée?</text> + <text id="third4">Qui sait? Mais tant qu'il y de la vie, il y a de l'espoir. Peut-être qu'ici c'est aussi bien qu'à la maison.</text> + </section> + <section id="medicom"> + <text id="broken">Le panneau est brisé...</text> + <text id="panel1">3/15 - Nous n'avons eu d'autre choix que d'abandonner la Terre. Nos armes ne peuvent pas les blesser, et ils nous poursuivent avec une vengeance. Peut-être, sur une autre planète, nous pouvons enfin échapper à leur colère.</text> + <text id="panel10">1/6 - C a quitté le laboratoire et a précisé que nous n'étions plus les bienvenus en ville. Déplacement de la base des opérations dans un ancien laboratoire dans les vestiges du secteur 22.</text> + <text id="panel11">2/9 - Les citadins forcés pour aider à financer la recherche. Également obtenu de nouveaux sujets de test (vagabonds et parias). La recherche progresse à nouveau.</text> + <text id="panel12">2/27 - Ran hors de vagabonds, a donc dû rassembler des sujets de test des habitants de la ville. Si la recherche sur la viabilité n'est pas terminée bientôt, nous manquerons de nouveau de sujets de test.</text> + <text id="panel13">5/1 - Le navire a été lourdement endommagé lors de l'évasion, mais le moteur de saut a été activé avec succès. Cela devrait nous garder en avance sur les poursuivants, en supposant que le navire survit le voyage.</text> + <text id="panel14">12/14 - La recherche sur la viabilité des espèces est au point mort, mais la recherche sur le combat semble prometteuse. Les améliorations cybernétiques sont en mesure de transformer un civil moyen en une machine de guerre.</text> + <text id="panel15">1/31 - Appliquer la recherche cybernétique à nous-mêmes en raison du manque de sujets de test. Toujours aucun signe de l'ennemi, mais peut-être cette fois nous serons en mesure de les combattre.</text> + <text id="panel2">6/30 - Élaboration d'un nouveau plan pour l'augmentation et la survie humaines, y compris le nombre et le type de spécimens nécessaires pour atteindre nos objectifs. M. H a quitté le groupe de recherche.</text> + <text id="panel3">8/5 - Atteint la planète cible mais ne peut pas entrer dans l'atmosphère en toute sécurité et il n'y a pas assez de gousses de vie. Probabilité de survie faible, même pour les sujets augmentés. Aucun signe de l'ennemi.</text> + <text id="panel4">9/2 - Le renforcement de la coque progresse, mais la survie nécessite une augmentation. Les dissidents protestent contre la procédure, même si leur vie en dépend.</text> + <text id="panel5">9/26 - Ne peut plus maintenir l'orbite. Beaucoup ont accepté l'augmentation, et certains qui n'ont pas été lancés dans les gousses de vie. Espérons que le renforcement sera suffisant pour le reste.</text> + <text id="panel6">10/4 - Le renforcement d'urgence a été largement couronné de succès, mais le nombre estimé de survivants est bien inférieur à ce que l'on espérait, même en tenant compte des gousses de vie que nous ne pouvons pas expliquer..</text> + <text id="panel7">10/5 - La viabilité des espèces est maintenant une préoccupation majeure. Avec seulement quelques centaines d'individus, nous ne pouvons pas survivre sans une intervention drastique. Début d'une nouvelle ligne de recherche.</text> + <text id="panel8">11/20 - Infrastructure de base établie à l'est du site de l'écrasement. Rassembler de nouveaux spécimens pour l'expérimentation.</text> + <text id="panel9">12/24 - C désapprouve la recherche de combat. Au lieu de préparer leur retour et d'améliorer la viabilité des espèces, C veut retourner aux étoiles et chercher d'autres survivants.</text> + </section> + <section id="system"> + <text id="start">Unoiks 428</text> + </section> + <section id="system.desc"> + <text id="start">Étoile de type-G. 42 années-lumières de la Terre.\n6 Exoplanète confirmé.</text> + </section> + <section id="system.planet"> + <text id="start">Unoiks 428e</text> + </section> + <section id="system.planet.desc"> + <text id="start">Une planète semblable à la terre et habitable, emplacement de la colonie #21.\n\nsusceptible d'être[color=ff2222]Terre Natal de l'ennemi[/color].</text> + </section> + <section id="options"> + <text id="achievements">Réussites</text> + <text id="back">Retour</text> + <text id="controller">Manette</text> + <text id="controls">Contrôles</text> + <text id="export">Exporter une sauvegarde</text> + <text id="export_fail">Impossible d'exporter: Sauvegarde corrompu.</text> + <text id="file_export">Où souhaitez-vous exporter la sauvegarde?</text> + <text id="file_import">Sélectionnez une sauvegarde à importer.</text> + <text id="fullscreen">Plein Écran:</text> + <text id="import">Importer une sauvegarde</text> + <text id="import_fail">Impossible d'importer: Sauvegarde corrompu.</text> + <text id="import_html5">Pour importer: glisser un fichier .asav file dans la fenêtre de jeu, puis sélectionnez un emplacement pour placer la sauvegarde.</text> + <text id="import_save">Peut seulement importer des sauvegardes sur l'écran de titre.</text> + <text id="keyboard">Clavier</text> + <text id="language">Langage:</text> + <text id="music">Vol Musique:</text> + <text id="options">Options</text> + <text id="paused">Jeu en Pause</text> + <text id="quitgame">Souhaitez-vous retourner au menu? Toute progression non-sauvegardé sera perdue.</text> + <text id="sfx">Vol SFX:</text> + <text id="textspeed">Vitesse Texte:</text> + <text id="title">Retour au menu Principal</text> + </section> + <section id="controls"> + <text id="attack">Attaque:</text> + <text id="cancel">Annuler:</text> + <text id="defend">Defense:</text> + <text id="device">Config:</text> + <text id="down">Bas:</text> + <text id="equipment">Équipement:</text> + <text id="hotkey1">Rac 1:</text> + <text id="hotkey2">Rac 2:</text> + <text id="hotkey3">Rac 3:</text> + <text id="hotkey4">Rac 4:</text> + <text id="inventory">Sac:</text> + <text id="left">Gauche:</text> + <text id="mute">Muet:</text> + <text id="quest">Quêtes:</text> + <text id="right">Droite:</text> + <text id="select">Action:</text> + <text id="up">Haut:</text> + </section> + <section id="cloud"> + <text id="all_synced">Toutes les sauvegardes sont synchronisées!</text> + <text id="button_login">Connectez-vous à Cloud Aground</text> + <text id="button_logout">Déconnexion du Cloud Aground</text> + <text id="close_syncing">Vos sauvegardes sont en cours de synchronisation. Êtes-vous sûr de vouloir quitter avant la fin de la synchronisation?</text> + <text id="connect_fail">Echec de la synchronisation du cloud.</text> + <text id="create">Créer un compte</text> + <text id="logged_in">Connecté en tant que: {nom d'utilisateur}</text> + <text id="logging_in">Connexion ... Veuillez patienter ...</text> + <text id="login">Connexion au cloud Aground</text> + <text id="login_fail">Nom d'utilisateur ou mot de passe incorrect.</text> + <text id="not_logged_in">Non connecté à Aground Cloud</text> + <text id="overwrite">Il y a deux sauvegardes dans ce slot! \ nQue voulez-vous garder?</text> + <text id="pass_error">Le mot de passe doit comporter entre 3 et 40 caractères.</text> + <text id="password">Mot de passe:</text> + <text id="remember">Se souvenir de moi?</text> + <text id="sync_fail">La synchronisation a échoué!</text> + <text id="sync_now">Synchroniser maintenant</text> + <text id="sync_slots">Synchronisation des logements</text> + <text id="unsynced">Vous avez des sauvegardes non synchronisées!</text> + <text id="user_error">Le nom d'utilisateur doit comporter entre 3 et 24 caractères.</text> + <text id="username">Nom d'utilisateur:</text> + </section> + <section id="world"> + <text id="magic1">Îles de l'Est</text> + <text id="rename">Comment voudriez-vous nommer cette île?</text> + <text id="science1">Sunset Haven</text> + <text id="start">À l'Aventure</text> + </section> + <section id="create.character"> + <text id="eyes">Couleur des yeux:</text> + <text id="hair">Couleur des cheveux:</text> + <text id="hair_style">Style de cheveux:</text> + <text id="pants">Couleur du pantalon:</text> + <text id="shirt">Couleur de chemise:</text> + <text id="skin">Couleur de peau:</text> + <text id="title">Créer un personnage</text> + </section> + <section id="colors"> + <text id="black">noir</text> + <text id="blond">Blond</text> + <text id="blue">Bleu</text> + <text id="brown">Brun</text> + <text id="custom">Personnaliser</text> + <text id="dblond">Blond Foncé</text> + <text id="dblue">Bleu Foncé</text> + <text id="dbrown">Brun Foncé</text> + <text id="gray">Gris</text> + <text id="green">Vert</text> + <text id="lblue">Bleu Pale</text> + <text id="lbrown">Brun Pale</text> + <text id="lgreen">Vert Pale</text> + <text id="orange">Orange</text> + <text id="pink">Rose</text> + <text id="purple">Mauve</text> + <text id="red">Rouge</text> + <text id="teal">Turquoise</text> + <text id="white">Blanc</text> + <text id="yellow">Jaune</text> + </section> +</lang> \ No newline at end of file diff --git a/games/aground/data/mods/fan_translations/it_IT.xml b/games/aground/data/mods/fan_translations/it_IT.xml new file mode 100644 index 00000000..9f03c7b1 --- /dev/null +++ b/games/aground/data/mods/fan_translations/it_IT.xml @@ -0,0 +1,555 @@ +<?xml version="1.0" encoding="utf-8"?> +<lang id="it_IT" name="Italiano"> + <section id="common"> + <text id="blocked">Bloccato!</text> + <text id="miss">Mancato!</text> + <text id="critical_hit">Colpo critico!</text> + <text id="weight">Peso:</text> + <text id="save">Partita salvata</text> + <text id="del_save">Salvataggio eliminato</text> + <text id="save_corrupt">Salvataggio corrotto. Inizia una nuova partita</text> + <text id="fuel">Carburante</text> + <text id="add_fuel">Aggiungi carburante</text> + <text id="all">Tutto</text> + <text id="equipment">Equipaggiamento</text> + <text id="attack">Attacco:</text> + <text id="range">Portata:</text> + <text id="defense">Difesa:</text> + <text id="cut">Taglio:</text> + <text id="mine">Scavo:</text> + <text id="capacity">Peso trasportabile:</text> + <text id="health">Salute:</text> + <text id="stamina">Stamina:</text> + <text id="ok">Ok</text> + <text id="cancel">Cancella</text> + <text id="yes">Si</text> + <text id="no">No</text> + <text id="accept">Accetta</text> + <text id="reject">Rifiuta</text> + <text id="sell">Vendi</text> + <text id="buy">Compra</text> + <text id="drop_item">Quanti ne vuoi eliminare?</text> + <text id="eat_item">Quanti ne vuoi mangiare?</text> + <text id="store_item">Quanti ne vuoi stoccare?</text> + <text id="retrieve_item">Quanti ne vuoi prendere?</text> + <text id="sell_item">Quanti ne vuoi vendere?</text> + <text id="buy_item">Quanti ne vuoi comprare?</text> + <text id="requires">-- Ingredienti --</text> + <text id="inventory">Inventario</text> + <text id="quests">Quest Log</text> + <text id="smelter">Fonderia</text> + <text id="kitchen">Cucina</text> + <text id="workshop">Officina</text> + <text id="storehouse">Magazzino</text> + <text id="dockhouse">Porto</text> + <text id="harvest">Mieti</text> + <text id="harvest_all">Mieti tutto</text> + <text id="manage">Gestisci</text> + <text id="feed">Alimenta</text> + <text id="lab">Laboratorio</text> + <text id="coins">Monete</text> + <text id="per_hit">per Colpo:</text> + <text id="move">Muovi</text> + <text id="newgame">Nuovo gioco</text> + <text id="continue">Continua</text> + <text id="options">Opzioni</text> + <text id="exit">Esci</text> + <text id="forums">Community</text> + <text id="empty">Vuoto</text> + <text id="empty_slot">< Slot Vuoto ></text> + <text id="corrupt_slot">Slot corrotto</text> + <text id="overwrite">Sei sicuro di sovrascrivere questo slot?</text> + <text id="none">Nessuno</text> + <text id="addition_slots">Slot aggiuntivi:</text> + <text id="trap_overlap">[color=770000]Non puoi posizionare una trappola sopra un'altra![/color]</text> + <text id="placed">{item} posizionato.</text> + <text id="level_up">Level Up!</text> + <text id="level">Livello:</text> + <text id="experience">Esperienza</text> + <text id="hotkey">Seleziona oggetto</text> + <text id="set_hotkey">Imposta Hotkey:</text> + <text id="retry">Indietro</text> + <text id="title">Titolo</text> + <text id="move_all">Muovi tutto</text> + <text id="melee_equip">Attacca con {item}</text> + <text id="nonweap_equip">Usa {item}</text> + <text id="ranged_equip">Scaglia {item}</text> + <text id="add_animal">Aggiungi animale</text> + <text id="select_feed">Scegli alimentazione</text> + <text id="use_count">Quante volte vuoi usarlo?</text> + <text id="select_fertilizer">Seleziona fertilizzante</text> + <text id="muted">Gioco senza sonoro</text> + <text id="unmuted">Gioco con sonoro</text> + <text id="storehouse_add">{npc} aggiunto {count} {item} al [color=ff2222]Magazzino[/color]</text> + <text id="auto_eat">Mangia {count} {item} per recuperare salute</text> + <text id="drop_all">Sei sicuro di buttare via tutti {item}? Potrebbero tornare utili.</text> + <text id="sign_message">Scrivi [item=sign] Messaggio:</text> + <text id="transform">Quanti vuoi farli diventare in {into}?</text> + <text id="collect_complete">Raccogli completati</text> + <text id="set_sticky">Togli oggetto applicato</text> + <text id="fishing">Pesca:</text> + <text id="fishing_line">Ha abboccato qualcosa!</text> + <text id="fishing_fail">E' sfuggito!</text> + <text id="fishing_hooked">Aspetta...</text> + <text id="fishing_pull">Tira!</text> + </section> + <section id="actions"> + <text id="drop">Scarta</text> + <text id="place">Posiziona</text> + <text id="use">Usa</text> + <text id="craft">Crea</text> + <text id="equip">Equipaggia</text> + <text id="unequip">Disequipaggia</text> + <text id="fire">Spara</text> + <text id="eat">Mangia</text> + <text id="loot">Raccogli dal corpo</text> + <text id="feed">Alimenta</text> + <text id="collect">Colleziona</text> + <text id="open">Apri</text> + <text id="carve">Intaglia</text> + </section> + <section id="item.names"> + <text id="wood">Legno</text> + <text id="coal">Carbone</text> + <text id="iron">Pepita di ferro</text> + <text id="quartz">Quarzo</text> + <text id="gold">Pepita di oro</text> + <text id="diamond">Diamante</text> + <text id="sulfur">Zolfo</text> + <text id="oil">Greggio</text> + <text id="titanium">Titanio</text> + <text id="uranium">Uranio</text> + <text id="iron_bar">Barra di ferro</text> + <text id="steel_bar">Barra di acciaio</text> + <text id="gold_bar">Barra d'oro</text> + <text id="meat">Carne</text> + <text id="fruit">Mele</text> + <text id="wheat">Grano</text> + <text id="eggs">Uova</text> + <text id="milk">Latte</text> + <text id="sugar">Zucchero</text> + <text id="steak">Bistecca</text> + <text id="bread">Pane</text> + <text id="pie">Torta</text> + <text id="pancakes">Pancakes</text> + <text id="hamburger">Hamburger</text> + <text id="cheese">Formaggio</text> + <text id="pizza">Pizza</text> + <text id="omelette">Omelette</text> + <text id="cheeseburger">Cheeseburger</text> + <text id="cake">Torta</text> + <text id="candy_apple">Mela caramellata</text> + <text id="dragonblood">Sangue di drago</text> + <text id="stone_axe">Ascia di pietra</text> + <text id="stone_pickaxe">Piccone di pietra</text> + <text id="coin_purse">Borsello</text> + <text id="iron_pickaxe">Piccone di ferro</text> + <text id="iron_sword">Spada di ferro</text> + <text id="iron_armor">Armatura di ferro</text> + <text id="steel_pickaxe">Piccone di acciaio</text> + <text id="steel_sword">Spada di acciaio</text> + <text id="steel_armor">Armatura di acciaio</text> + <text id="bow">Arco</text> + <text id="arrow">Freccia</text> + <text id="backpack">Zaino</text> + <text id="mega_backpack">Zaino grande</text> + <text id="ultra_backpack">Zaino enorme</text> + <text id="magic_backpack">Zaino magico</text> + <text id="magic_box">Scatola magica</text> + <text id="cloth">Stoffa</text> + <text id="net">Rete</text> + <text id="berries">Bacche</text> + <text id="red_berries">Bacche rosse</text> + <text id="health_potion">Pozione salute</text> + <text id="stamina_potion">Pozione stamina</text> + <text id="attack_potion">Pozione attacco</text> + <text id="defense_potion">Pozione difesa</text> + <text id="speed_potion">Pozione velocità</text> + <text id="endurance_potion">Pozione resistenza</text> + <text id="pig">Maiale</text> + <text id="wyrm">Drago</text> + <text id="cocoon">Bozzolo</text> + <text id="dragon">Baby dragone</text> + <text id="boat">Barca</text> + <text id="fence">Staccionata</text> + <text id="torch">Torcia</text> + <text id="trap">Trappola</text> + <text id="workbench">Tavolo di lavoro</text> + <text id="chest">Baule</text> + <text id="jakolantern">J O' Lantern</text> + <text id="sign">Firma</text> + <text id="rusty_axe">Ascia arrugginita</text> + <text id="cotton">Cotone</text> + <text id="pumpkin">Zucca</text> + <text id="chicken">Gallina</text> + <text id="cow">Mucca</text> + <text id="fishing_rod">Canna da pesca</text> + <text id="toothfish">Merluzzo</text> + <text id="rockfish">Scorfano</text> + <text id="coral_cod">Pesce corallo</text> + <text id="fertilizer">Fertilizzante</text> + </section> + <section id="item.descriptions"> + <text id="boat">Naviga nel mondo.</text> + <text id="fence">Tiene i nemici all'esterno</text> + <text id="torch">+1 slot illuminato ogni 20 slot scavati.</text> + <text id="trap">Trappola: danno 4.</text> + <text id="red_berries">+1 atk prossimo colpo.</text> + <text id="magic_box">Capienza illimitata</text> + <text id="health_potion">+10 salute massima.</text> + <text id="stamina_potion">+20 stamina massima.</text> + <text id="attack_potion">+1 atk prossimi 2 colpi.</text> + <text id="defense_potion">+1 def prossimi 2 colpi.</text> + <text id="speed_potion">Aumenta velocità.</text> + <text id="endurance_potion">Aumenta resistenza.</text> + <text id="workbench">Crea oggetti.</text> + <text id="chest">Immagazzina oggetti.</text> + <text id="sign">Mostra messaggio.</text> + </section> + <section id="achievement.names"> + <text id="hut">Capanno</text> + <text id="boar">Carne istantanea</text> + <text id="storehouse">Spazio infinito</text> + <text id="farm">Contadino</text> + <text id="orchard">Mele</text> + <text id="smelter">Metallurgia</text> + <text id="kitchen">Buon appetito!</text> + <text id="backpack">Capiente</text> + <text id="workshop">Tempo di creazione</text> + <text id="wyrm">Wyrmslayer</text> + <text id="golem">Rockslayer</text> + <text id="diamond">Brillante</text> + <text id="market">Un buon commerciante</text> + <text id="bigpack">Più capiente</text> + <text id="capture_wyrm">Cattura drago</text> + <text id="pen">Mungi il maiale</text> + <text id="pizza">Mmm, Formaggio</text> + <text id="dock">Lidi lontani</text> + <text id="boat">Naviga</text> + <text id="lab">Esperimenti</text> + <text id="wyrm_pen">sangue infinito</text> + <text id="dragon">Cattura</text> + </section> + <section id="achievement.descriptions"> + <text id="hut">Costruisci [color=ff2222]Capanno[/color].</text> + <text id="boar">Uccidi un [color=ff2222]Cinghiale[/color].</text> + <text id="storehouse">Costruisci un [color=ff2222]Magazzino[/color].</text> + <text id="farm">Costruisci una [color=ff2222]Fattoria[/color].</text> + <text id="orchard">Aggiungi un [color=ff2222]Frutteto[/color] alla [color=ff2222]Fattoria[/color].</text> + <text id="smelter">Costruisci una [color=ff2222]Fucina[/color].</text> + <text id="kitchen">Costruisci una [color=ff2222]Cucina[/color].</text> + <text id="backpack">Prendi lo [color=ff2222]Zaino[/color].</text> + <text id="workshop">Costruisci l' [color=ff2222]Officina[/color].</text> + <text id="wyrm">Sconfiggi un [color=ff2222]drago[/color].</text> + <text id="golem">Sconfiggi un [color=ff2222]Golem[/color].</text> + <text id="diamond">Raccogli un [color=ff2222]Diamante[/color].</text> + <text id="market">Costruisci un [color=ff2222]Mercato[/color].</text> + <text id="bigpack">Compra uno [color=ff2222]Zaino grande[/color].</text> + <text id="capture_wyrm">Cosa devo fare con questo?</text> + <text id="pen">Aggiungi una [color=ff2222]Stalla[/color] alla [color=ff2222]Fattoria[/color].</text> + <text id="pizza">Cucina una [color=ff2222]Pizza[/color].</text> + <text id="dock">Costruisci il [color=ff2222]Porto[/color].</text> + <text id="boat">Costruisci una [color=ff2222]Barca[/color].</text> + <text id="lab">Costruisci il [color=ff2222]Laboratorio[/color].</text> + <text id="wyrm_pen">Costruisci una [color=ff2222]Penna di drago[/color].</text> + <text id="dragon">Fai nascere un [color=ff2222]Drago[/color] da un [color=ff2222]Bozzolo[/color].</text> + </section> + <section id="structure"> + <text id="wheat">Campo di grano</text> + <text id="orchard">Frutteto</text> + <text id="sugar">Campo di barbabietole da zucchero</text> + <text id="cotton">Campo di cotone</text> + <text id="pumpkin">Campo di zucche</text> + <text id="add_field">Allarga fattoria</text> + <text id="add_stall">Costruisci una stalla</text> + <text id="pen">Stalla</text> + <text id="produces">-- Produci --</text> + <text id="slots">-- Slots --</text> + <text id="plant">Cambia semenza</text> + <text id="fertilizer">Fertilizzante</text> + </section> + <section id="structure.tooltip"> + <text id="hut">Riposa nel capanno</text> + <text id="storehouse">Entra nel magazzino</text> + <text id="workshop">Crea in officina</text> + <text id="smelter">Fondi pepite</text> + <text id="kitchen">Cucina</text> + <text id="farm">Entra nella fattoria</text> + <text id="food_market">Commercia con il fruttivendolo</text> + <text id="weaps_market">Commercia con il venditore di armi</text> + <text id="mineral_market">Commercia con il venditore di pepite</text> + <text id="dockhouse">Entra nel porto</text> + <text id="boat">Barca a vela</text> + <text id="lab">Combina pozioni</text> + <text id="pen">Gestisci la stalla</text> + <text id="wyrm_pen">Gestisci la stalla dei draghi</text> + </section> + <section id="object.tooltip"> + <text id="bush">Raccogli bacche</text> + <text id="tree">Abbatti albero</text> + <text id="enemy">Attacca</text> + <text id="collect">Colleziona {item}</text> + <text id="open">Apri {item}</text> + <text id="harvest">Raccogli {item}</text> + </section> + <section id="warning"> + <text id="weight">Trasporti troppo peso!</text> + <text id="stamina">Stamina esaurita, perdi salute!</text> + <text id="growing">Stà crescendo! Passa dopo.</text> + <text id="additions">Non restano slot aggiuntuivi</text> + <text id="focus">Click per Focus</text> + <text id="ingredients">Non hai abbastanza ingredienti.</text> + <text id="place_surface">Non puoi posizionare oggetti sotto terra.</text> + <text id="place_overlap">Non puoi posizionare oggetti su altri oggetti.</text> + <text id="no_effect">Non avrà alcun effetto.</text> + <text id="drop_instead">Vuoi buttarli via?</text> + <text id="cannot_fire">Non puoi sparare {projectile} senza {weapon}.</text> + <text id="equip">Equipaggiando l'arma [key=select] attaccherai sempre con quella, quindi non potrai interagire con niente altro finchè non la togli (nell'inventario). Ciò significa che combatterai più facilmente, ma automaticamente attaccherai con l'arma migliore presente nell'inventario anche se non hai equipaggiato nesesun arma [key=select].</text> + <text id="max_items">Non puoi aggiungere altri oggetti.</text> + <text id="max_fuel">Non puoi aggiungere altro carburante!</text> + </section> + <section id="market"> + <text id="restock">Avremo nuovi stock presto!</text> + </section> + <section id="quests"> + <text id="new">Nuova Quest!</text> + <text id="none">Non hai Quest attive al momento!</text> + <text id="requires">-- Necessario --</text> + <text id="complete">-- Completa --</text> + <text id="hut">Costruisci capanno</text> + <text id="storehouse">Costruisci Porto</text> + <text id="storehouse2">Costruisci Magazzino</text> + <text id="smelter">Costruisci Fonderia</text> + <text id="backpack">Zaino</text> + <text id="workshop">Costruisci Officina</text> + <text id="kitchen">Costruisci Cucina</text> + <text id="kitchen2">Migliora Cucina</text> + <text id="farm">Costruisci Fattoria</text> + <text id="orchard">Semi di mela</text> + <text id="market">Costruisci Mercato</text> + <text id="market2">Costruisci Mercato</text> + <text id="dock">Costruisci Molo</text> + <text id="dock2">Costruisci Molo</text> + <text id="pen">Costruisci porcile</text> + <text id="boat">Costruisci barca</text> + <text id="lab">Materie magiche</text> + <text id="wyrm_pen">Penna di drago</text> + </section> + <section id="quest.description"> + <text id="hut">Devi costruire un [color=550000]Capanno[/color] capace di resistere alla tempesta.</text> + <text id="storehouse">Necessita un [color=550000]Magazzino[/color].</text> + <text id="storehouse2">Costruisci un [color=550000]Magazzino[/color] per immagazzinare tutti gli oggetti.</text> + <text id="smelter">Necessita una [color=550000]Fonderia[/color] per lavorare le pepite.</text> + <text id="backpack">Ti darà lo zaino per qualche [item=meat].</text> + <text id="workshop">necessita di un [color=550000]Officina[/color] per creare attrezzi in metallo.</text> + <text id="kitchen">necessita di una [color=550000]Cucina[/color] per cucinare.</text> + <text id="kitchen2">necessita una [color=550000]Cucina[/color] per fare del [item=cheese].</text> + <text id="farm">necessita di una [color=550000]Fattoria[/color] per coltivare.</text> + <text id="orchard">necessita di [item=fruit] per coltivare un [color=550000]Frutteto[/color].</text> + <text id="market">necessita di un [color=550000]Mercato[/color] per commerciare.</text> + <text id="market2">Costruisci un [color=550000]Mercato[/color] per attirare commercianti al [color=550000]Porto[/color].</text> + <text id="dock">necessita di un [color=550000]Porto[/color] per viaggiare nel mondo.</text> + <text id="dock2">Costruisci un [color=550000]Porto[/color] per trovare altri sopravvissuti.</text> + <text id="pen">necessita di una [color=550000]Stalla[/color] per allevare animali.</text> + <text id="boat">è ora di viaggiare nel mondo! Costruisci una [item=boat] al [color=550000]Molo[/color].</text> + <text id="lab">vuole sperimentare con [item=dragonblood].</text> + <text id="wyrm_pen">vuole sperimentare con [item=wyrm].</text> + </section> + <section id="npc"> + <text id="talk">Parla</text> + <text id="builder">Costruttore</text> + <text id="miner">Minatore</text> + <text id="farmer">Contadino</text> + <text id="trader">Commercainte</text> + <text id="alchemist">Alchemista</text> + </section> + <section id="builder"> + <text id="intro">Davvero si aspetta di essere in grado di sopravvivere qui? È disperato, amico.</text> + <text id="introduce1">Sei bravo a costruire, giusto? E se costruissimo un magazzino per conservare tutto ciò che raccogliamo?</text> + <text id="introduce2">Hmph. Credo che con [var=quest.storehouse.wood] [item=wood] e [var=quest.storehouse.berries] [item=berries] Potrei costruire un buon [color=770000]Magazzino[/color].</text> + <text id="accept1">OK! Lo troverò senza problemi!</text> + <text id="accept2">Prendi questa [item=stone_axe], se sei così spavaldo.</text> + <text id="stamina">Sono esausto. Anche tu sembri stanco. Dovremmo riposare al [color=770000]Capanno[/color] per salvare il gioco e recuperare [tile=stamina] [color=006600]Stamina[/color].</text> + <text id="wood">Com'è la mia vecchia [item=stone_axe]? Scommetto che puoi abbattere un albero premendo [key=select] quando sei a fianco.</text> + <text id="meat">Prova a uccidere qualche [color=770000][tile=boar] Cinghiale[/color] premendo [key=select] quando ci sei in fianco.</text> + <text id="hint1">Tutti gli oggetti che raccogli finiscono nel tuo inventario. Puoi controllarlo premendo [key=inventory].</text> + <text id="hint2">Se la tua [tile=stamina] [color=006600]Stamina[/color] finisce, inizierai a perdere [tile=health] [color=770000]Salute[/color], e se esaurisci anche la [tile=health] [color=770000]Salute[/color], morirai.</text> + <text id="hint3">Ecco perchè devi mangiare[item=berries], [item=fruit] and [item=meat]. Puoi mangiare selezionando il cibo dal tuo inventario.</text> + <text id="storehouse1">Hai già raccolto tutto? Sono stupito.</text> + <text id="storehouse2">Costruiamo questo [color=770000]Magazzino[/color]!</text> + <text id="storehouse3">Guardalo! Non sei fiero?</text> + <text id="storehouse4">Si… adesso, sarà utile. Ora potrò evitare di stancarmi troppo trasportando troppo peso.</text> + <text id="farmer">Dovremmo fare un patto con il [color=770000][tile=farmer] Contadino[/color], scommetto che può aiutarci a far crescere dei buoni ingredienti.</text> + <text id="miner">Hai visto la [color=770000][tile=miner] Minatrice[/color] spuntare da sotto terra? Dovresti vedere cosa vuole.</text> + <text id="kitchen1">Che ne dici di costruire una [color=770000]Cucina[/color]? [item=meat] la carne è buona, ma cotta è meglio!but it’s even better cooked.</text> + <text id="kitchen2">Abbiamo bisogno di [var=quest.kitchen.wood] [item=wood] e [var=quest.kitchen.coal] [item=coal] per costruire una [color=770000]Cucina[/color].</text> + <text id="kitchen3">Sembra che tu abbia tutto ciò che ho bisogno. Costruiamo questa [color=770000]Cucina[/color] !</text> + <text id="kitchen4">Puoi cucinare in [color=770000]Cucina[/color] finchè avrai [item=wood] o [item=coal] per alimentare il fuoco.</text> + <text id="kitchen5">Sai che cosa vorrei? [item=cheese]. Niente è così delizioso.</text> + <text id="kitchen6">Potrei migliorare la [color=770000]Cucina[/color] per fare del [item=cheese] e preparare nuove ricette, mi serve [var=quest.kitchen2.wood] [item=wood] e [var=quest.kitchen2.steel_bar] [item=steel_bar].</text> + <text id="kitchen7">Sembra che tu abbia tutto ciò che ho bisogno. Miglioriamo questa [color=770000]Cucina[/color] !</text> + <text id="kitchen8">Prova le nuove ricette! Ci stiamo civilizzando!</text> + <text id="farm">Signore, ho fame. Spero finisca presto di costruire la [color=770000]Fattoria[/color] !</text> + <text id="backpack1">Hey, sembra faticoso trasportare tutto quel [item=coal] per la [color=770000]Fonderia[/color]? Ti potrei dare il mio [item=backpack] se mi porti della [var=quest.backpack.meat] [item=meat].</text> + <text id="backpack2">Potrei ucciderli da solo per aver della [item=meat], ma ti ho già dato la mia[item=stone_axe]!</text> + <text id="backpack3">Ottimo! Grazie per la [item=meat]! Come promesso, ecco il mio [item=backpack].</text> + </section> + <section id="farmer"> + <text id="introduce1">Hey son contento di vederti!. Stavo pensando, ero solo un uomo, un vecchio uomo solo in un mondo vuoto.</text> + <text id="introduce3">Perchè non costruiamo un fienile per la [color=770000]Fattoria[/color]?</text> + <text id="introduce2">Ho ancora vitalità in queste vecchie ossa e posso aiutarti! La fattoria è il mio pane quotidiano, e a noi serve del buon cibo per andare avanti.</text> + <text id="farm1">Ottimo! Li metterò nel fienile e pianterò dei semi!</text> + <text id="farm2">Ora abbiamo una [color=770000]Fattoria[/color]! Fermati ogni tanto per raccogliere il grano, ti aiuteranno a recuperare [tile=stamina] [color=006600]Stamina[/color]. Ecco, prendi del [item=bread] per farti star meglio intanto che crescono.</text> + <text id="farm3">Puoi raccogliere [item=wood] abbattendo alberi.</text> + <text id="farm4">Se vuoi coltivare di più, possiamo aggiungere quattro campi di grano oppure un frutteto. Potrai metterli nel fienile.</text> + <text id="farm5">Guarda che fantastica [color=770000]Fattoria[/color]! E' ottima come tutto quello che ho usato per costruirla!</text> + <text id="kitchen">Il [item=wheat] non è molto gustoso, ma credo che se tu e il [color=770000][tile=builder] Muratore[/color] costruiste una [color=770000]Cucina[/color], cambierebbe sapore.</text> + <text id="pen1">Sai cosa servirebbe per la [color=770000]Fattoria[/color] ? Del bestiame! Puoi catturarmi dei [color=770000][tile=boar] Cinghiali[/color] con una [item=net] ? Puoi comprarla al [color=770000]Mercato[/color]?</text> + <text id="pen2">Aggiuungerò un [color=770000]Recinto[/color] per [var=quest.pen.pig] [item=pig]e [var=quest.pen.wood] [item=wood].</text> + <text id="pen3">Non sono i maiali più grassi [item=pig]che tu abbia mai visto?</text> + <text id="pen4">Con un recinto possiamo raccogliere [item=meat] e [item=milk]!</text> + <text id="pig">Come catturare un [item=pig]? Stendi una [item=net] per terra e attira un [color=770000][tile=boar] Cinghiale[/color] dentro, e oppalà! Sarà catturato e addomesticato!</text> + <text id="kitchen2">Mungere un [item=pig]? Perchè no? E' un mondo strano. Ma potremmo usarlo per fare del [item=cheese] - parla con il [color=770000][tile=builder] Muratore[/color] per migliorare la [color=770000]Cucina[/color].</text> + <text id="halloween">Spero non ti dispiaccia, ma ho fatto delle piccole decorazioni per la Festa del Raccolto! Potremmo istituirla come celebrazione. Ho preparato anche delle [item=jakolantern]e le ho messe nel [color=770000]Magazzino[/color].</text> + <text id="add_sugar">La fattoria stà diventando grande! Per celebrare ho trovato dei semi di [item=sugar] e li ho messi nel fienile! Prova a piantare un campo di [item=sugar]!</text> + <text id="add_cotton">Ho incontrato dei commercianti al [color=770000]Porto[/color] e mi hanno dato dei semi di [item=cotton] ! Ora puoi piantare del [item=cotton].</text> + <text id="orchard1">Ci sono un sacco di [item=fruit] quà intorno. Con tanti semi posso coltivare un bel [color=770000]Frutteto[/color]!</text> + <text id="orchard2">Grande, è pieno! Ho aggiunto dei semi nel fienile, ora puoi trasformare un campo in un frutteto!</text> + <text id="orchard3">Fammi sapere quando avrai dei semi di [item=fruit] per il [color=770000]Frutteto[/color]!</text> + </section> + <section id="miner"> + <text id="introduce1">Hey. Non credevo che ci fossero altri sopravvissuti!</text> + <text id="introduce2">Ero sottoterra - c'è molto di più di quanto si pensi.</text> + <text id="introduce3">Ho un piccone extra, prendilo!</text> + <text id="smelter">Come vanno gli scavi? Magari potremmo costruire una [color=770000]Fonderia[/color] per fondere le pepite in barre.</text> + <text id="accept1">Bene! Fammi sapere quando ne hai abbastanza [item=coal]!</text> + <text id="smelter1">Questo è quanto. Posso costruire una [color=770000]Fonderia[/color] in un batter d'occhio!</text> + <text id="smelter2">La [color=770000]Fonderia[/color] può trasformare le pepite in barre. Richiede carburante per fonderle, ma fortunatamente è pieno di [item=coal] qua intorno.</text> + <text id="hint1">Bene , cosa stai aspettando? Premi [key=down] per iniziare a scavare e trovare pepite!</text> + <text id="hint2">Le pepite son pesanti - assicurati di stoccarle nel [color=770000]Magazzino[/color] tra gli spostamenti.</text> + <text id="hint3">E' facile iniziare a scavare, ma assicurati di aver abbastanza [tile=stamina] [color=006600]Stamina[/color] per il ritorno.</text> + <text id="hint4">Più scavi in profondità, più pepite rare puoi trovare!</text> + <text id="workshop1">Che ne pensi di un' [color=770000]Officina[/color] per trasformare queste barre in attrezzi? Posso costruirla con [var=quest.workshop.iron_bar] [item=iron_bar] e [var=quest.workshop.wood] [item=wood].</text> + <text id="workshop2">Ok, costruiamo questa [color=770000]Officina[/color] !</text> + <text id="workshop3">All' [color=770000]Officina[/color],puoi creare istantaneamente ogni attrezzo o oggetto che vuoi se hai gli oggetti necessari.</text> + <text id="workshop4">Devi trovarmi delle [item=iron]per fonderle in [item=iron_bar] alla [color=770000]Fonderia[/color].</text> + <text id="smelter3">Quando avrai abbastanza [item=iron], seleziona [item=iron_bar] dal menù della [color=770000]Fonderia[/color], automaticamente continuerà a fondere finchè ci sarà carburante.</text> + <text id="smelter4">Potrai mettere in coda per la [color=770000]Fonderia[/color] tutti gli oggetti che potrai fondere, e continuerà finchè ci sarà carburante anche se non ci sei.</text> + <text id="pick">Se vuoi scavare nella [color=770000][tile=stone] Roccia[/color] per trovare delle [item=gold], dovrai creare un [item=iron_pickaxe] o [item=steel_pickaxe] all' [color=770000]Officina[/color].</text> + <text id="equip">Equipaggiamento rimarra equipaggiato finchè resterà nell'inventario. Potrà incrementare il tuo attacco, la difesa o la velocità di scavo, ma attenzione, ogni equipaggiamento ho un peso!</text> + <text id="hotkey">Puoi usare [color=770000]Hotkeys[/color] . Premi [key=hotkey1], [key=hotkey2], [key=hotkey3] o [key=hotkey4] nell'inventario per settarli.</text> + </section> + <section id="trader"> + <text id="steal">[item={item}] è stato rubato dal [color=770000]Magazzino[/color]!</text> + <text id="caught">Il ladro è stato colto con le mani nel sacco!</text> + <text id="introduce1">E' già abbastanza difficile sopravvivere senza che qualcuno ci rubi le nsotre scorte!</text> + <text id="introduce2">Potrei aver preso in prestito alcune cose. Ma, ascolta. Ti rimborserò offrendoti i miei servizi. Ho contatti con i commercianti su altre isole.</text> + <text id="introduce3">Commercianti? Ci sono altri sopravvissuti là fuori?</text> + <text id="introduce4">Yup. Ma ho bisogno di [var=quest.market.gold_bar] [item=gold_bar]per convincerli a venire qua.</text> + <text id="introduce5">Ci vuoi far pagare dopo che ti abbiamo sorpreso a rubare?!</text> + <text id="introduce6">Si certo. Questo è buisness. La mia richiesta è di [var=quest.market.gold_bar] [item=gold_bar]per aggiungere questa isola alla rotta dei commercianti.</text> + <text id="introduce7">Bene. Se ci sono altri sopravvissuti là fuori, il commercio con loro potrebbe portarci via da quest'isola.</text> + <text id="introduce8">Mi dispiace, non posso fidarmi di un ladro. Lascia quest'isola e non tornare mai più!</text> + <text id="introduce9">Ci sono isole migliori da svaligiare. Non sai cosa ti stai perdendo.</text> + <text id="market1">Perfetto! Sento che questo è l'inizio di molti scambi redditizi tra di noi.</text> + <text id="market2">Prendi questa [item=coin_purse]. Ne avrai bisogno per conservare le monete per comprare e vendere. Ti consiglio di acquistare un [item=mega_backpack] al più presto, they are a real life-saver!</text> + <text id="market3">Al [color=770000]Mercato[/color], puoi vendere oggetti e guadagnare monete, potrai usarle per comprare altri oggetti.</text> + <text id="market4">Ogni tanto al [color=770000]Mercato[/color] arrivano nuovi rifornimenti, quindi se non riesci a comprare ciò che vuoi o non ve ne sono abbastanza, ricontrolla più tardi.</text> + <text id="market5">Per fare un [item=gold_bar], dovrai fondere [item=gold], lo puoi trovare in profondità sotto terra. Il [color=770000][tile=miner] Minatore[/color] può darti dei consigli per come scavare così in profondità.</text> + <text id="dock1">Ti interessa vedere il resto del mondo? Che ne dici di costruire un [color=770000]Porto[/color]?</text> + <text id="dock2">Lo costruirò se mi darai [var=quest.dock.coins] [color=770000][tile=coin_purse.ico] Monete[/color], [var=quest.dock.wood] [item=wood], [var=quest.dock.cloth] [item=cloth] e [var=quest.dock.net] [item=net].</text> + <text id="dock3">Eccellente, costruiamo questo [color=770000]Porto[/color] !</text> + <text id="dock4">Quando avrai costruito una [item=boat] al [color=770000]Porto[/color], sarai in grado di navigare in mare!</text> + <text id="dock5">Il [color=770000]Porto[/color] costa [var=quest.dock.coins] [color=770000][tile=coin_purse.ico] Monete[/color], [var=quest.dock.wood] [item=wood], [var=quest.dock.cloth] [item=cloth] e [var=quest.dock.net] [item=net].</text> + <text id="accept">Accetta offerta</text> + <text id="reject">Rifiuta offerta</text> + </section> + <section id="alchemist"> + <text id="introduce1">C'è molto di più su questo pianeta di quanto non sembri. Ho fatto esperimenti e credo di aver scoperto la magia!</text> + <text id="introduce2">Ho bisogno di materiali. Se trovi [item=dragonblood], Dammelo e farò in modo che tu sia ricompensato.</text> + <text id="lab1">Lo sapevo! Questo è il segreto! Devo creare un laboratorio immediatamente!</text> + <text id="lab2">Il tuo premio? Porta materiali al mio laboratorio e io preparerò una pozione magica per te.</text> + <text id="lab3">Sbrigati! La mia ricerca è ferma finché non ne avrò un po di [item=dragonblood]!</text> + <text id="pen1">Ho bisogno di altro [item=dragonblood]! Portami un [var=quest.wyrm_pen.wyrm] vivo [item=wyrm] e avremo una fornitura illimitata di [item=dragonblood] con cui sperimentare!</text> + <text id="pen2">Eccellente! Stai indietro mentre lavoro alla mia magia!</text> + <text id="pen3">Ecco la mia geniale invenzione - la [color=770000]Penna di drago[color]! È più di una semplice penna, è una scorta infinita di [item=dragonblood]!</text> + <text id="wyrm">Scommetto che puoi catturare un [item=wyrm] con una [item=net]. Ma devono essere vivi e illesi!</text> + </section> + <section id="player"> + <text id="storm1">La tempesta stà diventando più forte. Ho bisogno di un capanno, ma qui non c'è niente, solo rami caduti!</text> + <text id="storm2">Devo provare a costruire un [color=770000]Capanno[/color]. [var=quest.hut.wood] [item=wood] dovrebbero essere sufficienti.</text> + <text id="storm3">Sono stanco... Riesco a malapena a portare questo [item=wood]. Ancora un poco e potrò riposare nel [color=770000]Capanno[/color].</text> + <text id="storehouse1">Questa ascia può tornare utile. Con questa potrei costruire un [color=770000]Magazzino[/color] per tenere gli oggetti che raccolgo.</text> + <text id="storehouse2">Scommetto che potrei costruire un magazzino con [var=quest.storehouse.wood] [item=wood] e [var=quest.storehouse.berries] [item=berries].</text> + <text id="storehouse3">Avanti! Costruiamo questo Magazzino.</text> + <text id="storehouse4">Perfetto. Ora posso evitare di portarmi dietro tutto quanto raccolgo.</text> + <text id="dock1">Mi chiedo se il ladro stava dicendo la verità riguardo ad altri sopravvissuti?</text> + <text id="dock2">Forse dovrei costruire un [color=770000]Porto[/color]. Prenderò del [var=quest.dock2.wood] [item=wood] e [var=quest.dock2.steel_bar] [item=steel_bar].</text> + <text id="dock3">Perfetto, costruiamo questo [color=770000]Porto[/color] !</text> + <text id="market1">Se costruissi un [color=770000]Mercato[/color], potrei attrarre commercianti. Posso costruirlo con [var=quest.market2.gold_bar] [item=gold_bar].</text> + <text id="market2">Ho tutto quanto serve per il [color=770000]Mercato[/color]!</text> + <text id="market3">Sembra che ci siano davvero dei commercianti là fuori! Mi hanno dato anche un [item=coin_purse] per tenere monete.</text> + <text id="market4">Ora manca solo una [item=boat] al [color=770000]Porto[/color]!</text> + </section> + <section id="scene.hut"> + <text id="first1">Non male come primo capanno.</text> + <text id="first2">Aiuto…[pause=4] per favore…[pause=4] un riparo…</text> + <text id="first3">C'è qualcuno fuori! Devo fidarmi?</text> + <text id="first4">Grazie. Ti devo la vita. Ma cosa facciamo ora?</text> + <text id="first5">Per il momento stiamo al caldo e all'asciutto.</text> + <text id="first6">E dopo? Come sopravviveremo su questa isola deserta?</text> + <text id="first7">Siamo bloccati qui, non si può tornare indietro.</text> + <text id="first8">Possiamo provarci. Magari la vita non sarà così difficile come credi.</text> + <text id="first9">Per favore…[pause=4] aiuto…</text> + <text id="second1">...quando sono arrivata qui ho iniziato a scavare, non sapevo che ci fosse stata una tempesta</text> + <text id="second2">Ma son contenta che siate qui. Ero stanca di mangiar polvere, e non c'è niente di meglio di un fuoco caldo dopo un giorno passato sotto terra.</text> + <text id="second3">Credi che ci siano altri sopravvissuti?</text> + <text id="second4">Onestamente, sono sorpreso che ci siano dei sopravvissuti dopo quel botto. Ma siamo qua, ci saranno altri sopravvissuti?</text> + <text id="third1">Scommetto che voi giovani pensate che sia la fine del mondo, ma credevo lo stesso alla fine della 3 guerra mondiale, ma siamo ancora qua.</text> + <text id="third2">Per come la vedo, dobbiamo ricavare il meglio da questa situazione, e sarei contento se ci fosse del cibo e della compagnia.</text> + <text id="third3">Ma quanto dovremo vivere su quest'isola dimenticata da Dio?</text> + <text id="third4">Chi lo sà? Ma finchè c'è vita, c'è speranza. Forse nel tempo questa isola sarà una buona casa.</text> + <text id="fourth1">Allora dicci se sai se ci sono altri sopravvissuti!</text> + <text id="fourth2">Molti di noi sono sparpagliati in altre isole, ma alcune isole hanno molti sopravvissuti e tecnologie migliori.</text> + <text id="fourth3">Ho sentito dire di un isola con una navicella quasi utilizzabile.</text> + <text id="fourth4">Può ancora volare?</text> + <text id="fourth5">Come ho detto, ho solo sentito dire. Ma se fosse vero, sarà sicuramente inutilizzabile. E' meglio stare su questo pianeta.</text> + </section> + <section id="options"> + <text id="options">Opzioni</text> + <text id="paused">In pausa</text> + <text id="music">Volume musica:</text> + <text id="sfx">Volume SFX:</text> + <text id="fullscreen">Schermo intero:</text> + <text id="textspeed">Velocità testi:</text> + <text id="language">Lingua:</text> + <text id="controls">Controlli</text> + <text id="achievements">Achievements</text> + <text id="title">Torna alla pagina iniziale</text> + <text id="back">Indietro</text> + <text id="quitgame">Vuoi tornare alla pagina iniziale? Ogni progresso non sarà salvato.</text> + <text id="keyboard">Tastiera</text> + <text id="controller">Controller</text> + <text id="import">Importa salvataggi</text> + <text id="export">Esporta salvataggi</text> + </section> + <section id="controls"> + <text id="left">Sinistra:</text> + <text id="right">Destra:</text> + <text id="up">Su:</text> + <text id="down">Giu:</text> + <text id="select">Azione:</text> + <text id="cancel">Cancella:</text> + <text id="inventory">Inventario:</text> + <text id="quest">Quests:</text> + <text id="device">Oggetto:</text> + <text id="hotkey1">Hotkey 1:</text> + <text id="hotkey2">Hotkey 2:</text> + <text id="hotkey3">Hotkey 3:</text> + <text id="hotkey4">Hotkey 4:</text> + <text id="mute">Togli suono:</text> + </section> + <section id="world"> + <text id="start">Inizio</text> + </section> +</lang> \ No newline at end of file diff --git a/games/aground/data/mods/fan_translations/mod.xml b/games/aground/data/mods/fan_translations/mod.xml new file mode 100644 index 00000000..ddfef66d --- /dev/null +++ b/games/aground/data/mods/fan_translations/mod.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8" ?> +<mod> + <name>Fan Translations</name> + <description>Includes spanish, french, german, italian, russian, and portuguese.</description> + <author>Various</author> + <version>1.0.0</version> + <init multiplayerSync="false"> + <include id="es.xml" includeRoot="true" /> + <include id="fr.xml" includeRoot="true" /> + <include id="de_DE.xml" includeRoot="true" /> + <include id="it_IT.xml" includeRoot="true" /> + </init> +</mod> + diff --git a/games/aground/data/ui/achievement_bg.png b/games/aground/data/ui/achievement_bg.png new file mode 100644 index 00000000..1a41ba4f Binary files /dev/null and b/games/aground/data/ui/achievement_bg.png differ diff --git a/games/aground/data/ui/achievement_flash.png b/games/aground/data/ui/achievement_flash.png new file mode 100644 index 00000000..3e73cb48 Binary files /dev/null and b/games/aground/data/ui/achievement_flash.png differ diff --git a/games/aground/data/ui/ancient_scroll.png b/games/aground/data/ui/ancient_scroll.png new file mode 100644 index 00000000..3009b940 Binary files /dev/null and b/games/aground/data/ui/ancient_scroll.png differ diff --git a/games/aground/data/ui/ancient_window.png b/games/aground/data/ui/ancient_window.png new file mode 100644 index 00000000..9e9f1404 Binary files /dev/null and b/games/aground/data/ui/ancient_window.png differ diff --git a/games/aground/data/ui/bar.png b/games/aground/data/ui/bar.png new file mode 100644 index 00000000..9d254afb Binary files /dev/null and b/games/aground/data/ui/bar.png differ diff --git a/games/aground/data/ui/bar_fuel.png b/games/aground/data/ui/bar_fuel.png new file mode 100644 index 00000000..e2aadc68 Binary files /dev/null and b/games/aground/data/ui/bar_fuel.png differ diff --git a/games/aground/data/ui/black.png b/games/aground/data/ui/black.png new file mode 100644 index 00000000..31d8067b Binary files /dev/null and b/games/aground/data/ui/black.png differ diff --git a/games/aground/data/ui/buttons.png b/games/aground/data/ui/buttons.png new file mode 100644 index 00000000..c7a6b7c1 Binary files /dev/null and b/games/aground/data/ui/buttons.png differ diff --git a/games/aground/data/ui/ellipse.png b/games/aground/data/ui/ellipse.png new file mode 100644 index 00000000..2bfe2755 Binary files /dev/null and b/games/aground/data/ui/ellipse.png differ diff --git a/games/aground/data/ui/equip.png b/games/aground/data/ui/equip.png new file mode 100644 index 00000000..1ec8eb33 Binary files /dev/null and b/games/aground/data/ui/equip.png differ diff --git a/games/aground/data/ui/game_over.png b/games/aground/data/ui/game_over.png new file mode 100644 index 00000000..89822367 Binary files /dev/null and b/games/aground/data/ui/game_over.png differ diff --git a/games/aground/data/ui/gradient.png b/games/aground/data/ui/gradient.png new file mode 100644 index 00000000..9063a4bd Binary files /dev/null and b/games/aground/data/ui/gradient.png differ diff --git a/games/aground/data/ui/icons.png b/games/aground/data/ui/icons.png new file mode 100644 index 00000000..a390ab5f Binary files /dev/null and b/games/aground/data/ui/icons.png differ diff --git a/games/aground/data/ui/inventory.png b/games/aground/data/ui/inventory.png new file mode 100644 index 00000000..304b99bc Binary files /dev/null and b/games/aground/data/ui/inventory.png differ diff --git a/games/aground/data/ui/keys.png b/games/aground/data/ui/keys.png new file mode 100644 index 00000000..5a9766b7 Binary files /dev/null and b/games/aground/data/ui/keys.png differ diff --git a/games/aground/data/ui/noise.png b/games/aground/data/ui/noise.png new file mode 100644 index 00000000..7d338d20 Binary files /dev/null and b/games/aground/data/ui/noise.png differ diff --git a/games/aground/data/ui/options.png b/games/aground/data/ui/options.png new file mode 100644 index 00000000..f8383d3a Binary files /dev/null and b/games/aground/data/ui/options.png differ diff --git a/games/aground/data/ui/points.png b/games/aground/data/ui/points.png new file mode 100644 index 00000000..eca09c8d Binary files /dev/null and b/games/aground/data/ui/points.png differ diff --git a/games/aground/data/ui/quest.png b/games/aground/data/ui/quest.png new file mode 100644 index 00000000..53a76696 Binary files /dev/null and b/games/aground/data/ui/quest.png differ diff --git a/games/aground/data/ui/questlog.png b/games/aground/data/ui/questlog.png new file mode 100644 index 00000000..9fe9970d Binary files /dev/null and b/games/aground/data/ui/questlog.png differ diff --git a/games/aground/data/ui/speech.png b/games/aground/data/ui/speech.png new file mode 100644 index 00000000..a0e3d87a Binary files /dev/null and b/games/aground/data/ui/speech.png differ diff --git a/games/aground/data/ui/sticky.png b/games/aground/data/ui/sticky.png new file mode 100644 index 00000000..a537aad1 Binary files /dev/null and b/games/aground/data/ui/sticky.png differ diff --git a/games/aground/data/ui/sync.png b/games/aground/data/ui/sync.png new file mode 100644 index 00000000..aa85ad98 Binary files /dev/null and b/games/aground/data/ui/sync.png differ diff --git a/games/aground/data/ui/title.png b/games/aground/data/ui/title.png new file mode 100644 index 00000000..e20434e2 Binary files /dev/null and b/games/aground/data/ui/title.png differ diff --git a/games/aground/data/ui/title_full.jpg b/games/aground/data/ui/title_full.jpg new file mode 100644 index 00000000..ebce24cb Binary files /dev/null and b/games/aground/data/ui/title_full.jpg differ diff --git a/games/aground/data/ui/ui.png b/games/aground/data/ui/ui.png new file mode 100644 index 00000000..e6c59f6c Binary files /dev/null and b/games/aground/data/ui/ui.png differ diff --git a/games/aground/data/ui/ui.xml b/games/aground/data/ui/ui.xml new file mode 100644 index 00000000..91c8844f --- /dev/null +++ b/games/aground/data/ui/ui.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8" ?> +<data> + <tile id="black" sheet="black.png" x="0" y="0" /> + <tile id="sticky" sheet="sticky.png" x="0" y="0" /> + <tilesheet id="ui.png" width="8" height="8" /> + <tile id="stamina" sheet="ui.png" x="0" /> + <tile id="health" sheet="ui.png" x="1" /> + <tile id="power" sheet="ui.png" x="2" /> + <tile id="vehicle_health" sheet="ui.png" x="3" /> + <tile id="oxygen" sheet="ui.png" x="4" /> + <bar id="power" tile="power" color="999900" /> + <bar id="fuel+progress" color="ff9900" /> + <tile id="fire.ico" sheet="ui.png" x="5" /> + <tile id="water.ico" sheet="ui.png" x="6" /> + <tile id="ice.ico" sheet="ui.png" x="7" /> + <tile id="earth.ico" sheet="ui.png" x="8" /> + <tile id="plant.ico" sheet="ui.png" x="9" /> + <tilesheet id="achievement_flash.png" width="32" height="32" /> + <tile id="achievement_flash" sheet="achievement_flash.png" x="0" y="0" /> + <animation id="achievement_flash" count="7" x="1"> + <frame visible="false" /> + </animation> + + <tilesheet id="icons.png" width="20" height="20" /> + <tile id="export_save" sheet="icons.png" /> + <tile id="delete_save" sheet="icons.png" x="10" /> + <animation id="export_save" count="10" /> + <animation id="delete_save" equals="export_save" /> + + <animation id="hidden"><frame visible="false" /></animation> + <animation id="single" count="1" /> + <tile id="inventory.bag" sheet="inventory.png" /> + <animation id="inventory.bag" count="5" /> + <tile id="locator" sheet="inventory.png" x="5" /> + + <autotile id="basic9"> + <tile neighbors="top,left,right,bottom" x="4" y="0" /> + <tile neighbors="left,bottom,right" x="1" y="0" /> + <tile neighbors="left,top,right" x="7" y="0" /> + <tile neighbors="top,right,bottom" x="3" y="0" /> + <tile neighbors="top,left,bottom" x="5" y="0" /> + <tile neighbors="bottom,right" x="0" y="0" /> + <tile neighbors="bottom,left" x="2" y="0" /> + <tile neighbors="top,right" x="6" y="0" /> + <tile neighbors="top,left" x="8" y="0" /> + </autotile> + + <difficultyMode id="creative" value="-1" maxShieldBlock="1000"> + <damage a="0" /><overweight a="0" /><capacity a="10" /> + </difficultyMode> + <difficultyMode id="easiest" value="0" maxShieldBlock="1000"> + <damage a="0.75" b="0.85" /><overweight b="0.7" /><points a="1.5" /><capacity a="1.5" /> + </difficultyMode> + <difficultyMode id="easier" value="1" maxShieldBlock="100"> + <damage b="0.85" /><overweight b="0.85" /> + </difficultyMode> + <difficultyMode id="default" value="2" /> + <difficultyMode id="harder" value="3" eatCooldown="2"><damage a="1.5" /></difficultyMode> + <difficultyMode id="hardest" value="4" eatCooldown="5"> + <damage a="2" /><capacity a="0.5" /><points a="0.5" /><overweight a="0.2" /> + </difficultyMode> + <difficultyMode id="1hko" value="5"><damage a="100000" /></difficultyMode> + <lang id="en_US" name="English"> + <section id="common"><text id="mods">Mods</text></section> + </lang> +</data> \ No newline at end of file diff --git a/games/aground/index.html b/games/aground/index.html new file mode 100644 index 00000000..f9d8a106 --- /dev/null +++ b/games/aground/index.html @@ -0,0 +1,54 @@ +<!DOCTYPE html> +<html lang="en"> + +<head> + + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> + + <title>Aground + + + + + + + + + + + + + + + +
+ + + + + + diff --git a/games/aground/lib/soundjs.min.js b/games/aground/lib/soundjs.min.js new file mode 100644 index 00000000..c186e642 --- /dev/null +++ b/games/aground/lib/soundjs.min.js @@ -0,0 +1,18 @@ +/*! +* @license SoundJS +* Visit http://createjs.com/ for documentation, updates and examples. +* +* Copyright (c) 2011-2015 gskinner.com, inc. +* +* Distributed under the terms of the MIT license. +* http://www.opensource.org/licenses/mit-license.html +* +* This notice shall be included in all copies or substantial portions of the Software. +*/ + +/**! + * SoundJS FlashAudioPlugin also includes swfobject (http://code.google.com/p/swfobject/) + */ + +this.createjs=this.createjs||{},function(){var a=createjs.SoundJS=createjs.SoundJS||{};a.version="0.6.2",a.buildDate="Thu, 26 Nov 2015 20:44:31 GMT"}(),this.createjs=this.createjs||{},createjs.extend=function(a,b){"use strict";function c(){this.constructor=a}return c.prototype=b.prototype,a.prototype=new c},this.createjs=this.createjs||{},createjs.promote=function(a,b){"use strict";var c=a.prototype,d=Object.getPrototypeOf&&Object.getPrototypeOf(c)||c.__proto__;if(d){c[(b+="_")+"constructor"]=d.constructor;for(var e in d)c.hasOwnProperty(e)&&"function"==typeof d[e]&&(c[b+e]=d[e])}return a},this.createjs=this.createjs||{},createjs.indexOf=function(a,b){"use strict";for(var c=0,d=a.length;d>c;c++)if(b===a[c])return c;return-1},this.createjs=this.createjs||{},function(){"use strict";createjs.proxy=function(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){return a.apply(b,Array.prototype.slice.call(arguments,0).concat(c))}}}(),this.createjs=this.createjs||{},function(){"use strict";function BrowserDetect(){throw"BrowserDetect cannot be instantiated"}var a=BrowserDetect.agent=window.navigator.userAgent;BrowserDetect.isWindowPhone=a.indexOf("IEMobile")>-1||a.indexOf("Windows Phone")>-1,BrowserDetect.isFirefox=a.indexOf("Firefox")>-1,BrowserDetect.isOpera=null!=window.opera,BrowserDetect.isChrome=a.indexOf("Chrome")>-1,BrowserDetect.isIOS=(a.indexOf("iPod")>-1||a.indexOf("iPhone")>-1||a.indexOf("iPad")>-1)&&!BrowserDetect.isWindowPhone,BrowserDetect.isAndroid=a.indexOf("Android")>-1&&!BrowserDetect.isWindowPhone,BrowserDetect.isBlackberry=a.indexOf("Blackberry")>-1,createjs.BrowserDetect=BrowserDetect}(),this.createjs=this.createjs||{},function(){"use strict";function EventDispatcher(){this._listeners=null,this._captureListeners=null}var a=EventDispatcher.prototype;EventDispatcher.initialize=function(b){b.addEventListener=a.addEventListener,b.on=a.on,b.removeEventListener=b.off=a.removeEventListener,b.removeAllEventListeners=a.removeAllEventListeners,b.hasEventListener=a.hasEventListener,b.dispatchEvent=a.dispatchEvent,b._dispatchEvent=a._dispatchEvent,b.willTrigger=a.willTrigger},a.addEventListener=function(a,b,c){var d;d=c?this._captureListeners=this._captureListeners||{}:this._listeners=this._listeners||{};var e=d[a];return e&&this.removeEventListener(a,b,c),e=d[a],e?e.push(b):d[a]=[b],b},a.on=function(a,b,c,d,e,f){return b.handleEvent&&(c=c||b,b=b.handleEvent),c=c||this,this.addEventListener(a,function(a){b.call(c,a,e),d&&a.remove()},f)},a.removeEventListener=function(a,b,c){var d=c?this._captureListeners:this._listeners;if(d){var e=d[a];if(e)for(var f=0,g=e.length;g>f;f++)if(e[f]==b){1==g?delete d[a]:e.splice(f,1);break}}},a.off=a.removeEventListener,a.removeAllEventListeners=function(a){a?(this._listeners&&delete this._listeners[a],this._captureListeners&&delete this._captureListeners[a]):this._listeners=this._captureListeners=null},a.dispatchEvent=function(a,b,c){if("string"==typeof a){var d=this._listeners;if(!(b||d&&d[a]))return!0;a=new createjs.Event(a,b,c)}else a.target&&a.clone&&(a=a.clone());try{a.target=this}catch(e){}if(a.bubbles&&this.parent){for(var f=this,g=[f];f.parent;)g.push(f=f.parent);var h,i=g.length;for(h=i-1;h>=0&&!a.propagationStopped;h--)g[h]._dispatchEvent(a,1+(0==h));for(h=1;i>h&&!a.propagationStopped;h++)g[h]._dispatchEvent(a,3)}else this._dispatchEvent(a,2);return!a.defaultPrevented},a.hasEventListener=function(a){var b=this._listeners,c=this._captureListeners;return!!(b&&b[a]||c&&c[a])},a.willTrigger=function(a){for(var b=this;b;){if(b.hasEventListener(a))return!0;b=b.parent}return!1},a.toString=function(){return"[EventDispatcher]"},a._dispatchEvent=function(a,b){var c,d=1==b?this._captureListeners:this._listeners;if(a&&d){var e=d[a.type];if(!e||!(c=e.length))return;try{a.currentTarget=this}catch(f){}try{a.eventPhase=b}catch(f){}a.removed=!1,e=e.slice();for(var g=0;c>g&&!a.immediatePropagationStopped;g++){var h=e[g];h.handleEvent?h.handleEvent(a):h(a),a.removed&&(this.off(a.type,h,1==b),a.removed=!1)}}},createjs.EventDispatcher=EventDispatcher}(),this.createjs=this.createjs||{},function(){"use strict";function Event(a,b,c){this.type=a,this.target=null,this.currentTarget=null,this.eventPhase=0,this.bubbles=!!b,this.cancelable=!!c,this.timeStamp=(new Date).getTime(),this.defaultPrevented=!1,this.propagationStopped=!1,this.immediatePropagationStopped=!1,this.removed=!1}var a=Event.prototype;a.preventDefault=function(){this.defaultPrevented=this.cancelable&&!0},a.stopPropagation=function(){this.propagationStopped=!0},a.stopImmediatePropagation=function(){this.immediatePropagationStopped=this.propagationStopped=!0},a.remove=function(){this.removed=!0},a.clone=function(){return new Event(this.type,this.bubbles,this.cancelable)},a.set=function(a){for(var b in a)this[b]=a[b];return this},a.toString=function(){return"[Event (type="+this.type+")]"},createjs.Event=Event}(),this.createjs=this.createjs||{},function(){"use strict";function ErrorEvent(a,b,c){this.Event_constructor("error"),this.title=a,this.message=b,this.data=c}var a=createjs.extend(ErrorEvent,createjs.Event);a.clone=function(){return new createjs.ErrorEvent(this.title,this.message,this.data)},createjs.ErrorEvent=createjs.promote(ErrorEvent,"Event")}(),this.createjs=this.createjs||{},function(){"use strict";function ProgressEvent(a,b){this.Event_constructor("progress"),this.loaded=a,this.total=null==b?1:b,this.progress=0==b?0:this.loaded/this.total}var a=createjs.extend(ProgressEvent,createjs.Event);a.clone=function(){return new createjs.ProgressEvent(this.loaded,this.total)},createjs.ProgressEvent=createjs.promote(ProgressEvent,"Event")}(window),this.createjs=this.createjs||{},function(){"use strict";function LoadItem(){this.src=null,this.type=null,this.id=null,this.maintainOrder=!1,this.callback=null,this.data=null,this.method=createjs.LoadItem.GET,this.values=null,this.headers=null,this.withCredentials=!1,this.mimeType=null,this.crossOrigin=null,this.loadTimeout=b.LOAD_TIMEOUT_DEFAULT}var a=LoadItem.prototype={},b=LoadItem;b.LOAD_TIMEOUT_DEFAULT=8e3,b.create=function(a){if("string"==typeof a){var c=new LoadItem;return c.src=a,c}if(a instanceof b)return a;if(a instanceof Object&&a.src)return null==a.loadTimeout&&(a.loadTimeout=b.LOAD_TIMEOUT_DEFAULT),a;throw new Error("Type not recognized.")},a.set=function(a){for(var b in a)this[b]=a[b];return this},createjs.LoadItem=b}(),function(){var a={};a.ABSOLUTE_PATT=/^(?:\w+:)?\/{2}/i,a.RELATIVE_PATT=/^[.\/]*?\//i,a.EXTENSION_PATT=/\/?[^\/]+\.(\w{1,5})$/i,a.parseURI=function(b){var c={absolute:!1,relative:!1};if(null==b)return c;var d=b.indexOf("?");d>-1&&(b=b.substr(0,d));var e;return a.ABSOLUTE_PATT.test(b)?c.absolute=!0:a.RELATIVE_PATT.test(b)&&(c.relative=!0),(e=b.match(a.EXTENSION_PATT))&&(c.extension=e[1].toLowerCase()),c},a.formatQueryString=function(a,b){if(null==a)throw new Error("You must specify data.");var c=[];for(var d in a)c.push(d+"="+escape(a[d]));return b&&(c=c.concat(b)),c.join("&")},a.buildPath=function(a,b){if(null==b)return a;var c=[],d=a.indexOf("?");if(-1!=d){var e=a.slice(d+1);c=c.concat(e.split("&"))}return-1!=d?a.slice(0,d)+"?"+this.formatQueryString(b,c):a+"?"+this.formatQueryString(b,c)},a.isCrossDomain=function(a){var b=document.createElement("a");b.href=a.src;var c=document.createElement("a");c.href=location.href;var d=""!=b.hostname&&(b.port!=c.port||b.protocol!=c.protocol||b.hostname!=c.hostname);return d},a.isLocal=function(a){var b=document.createElement("a");return b.href=a.src,""==b.hostname&&"file:"==b.protocol},a.isBinary=function(a){switch(a){case createjs.AbstractLoader.IMAGE:case createjs.AbstractLoader.BINARY:return!0;default:return!1}},a.isImageTag=function(a){return a instanceof HTMLImageElement},a.isAudioTag=function(a){return window.HTMLAudioElement?a instanceof HTMLAudioElement:!1},a.isVideoTag=function(a){return window.HTMLVideoElement?a instanceof HTMLVideoElement:!1},a.isText=function(a){switch(a){case createjs.AbstractLoader.TEXT:case createjs.AbstractLoader.JSON:case createjs.AbstractLoader.MANIFEST:case createjs.AbstractLoader.XML:case createjs.AbstractLoader.CSS:case createjs.AbstractLoader.SVG:case createjs.AbstractLoader.JAVASCRIPT:case createjs.AbstractLoader.SPRITESHEET:return!0;default:return!1}},a.getTypeByExtension=function(a){if(null==a)return createjs.AbstractLoader.TEXT;switch(a.toLowerCase()){case"jpeg":case"jpg":case"gif":case"png":case"webp":case"bmp":return createjs.AbstractLoader.IMAGE;case"ogg":case"mp3":case"webm":return createjs.AbstractLoader.SOUND;case"mp4":case"webm":case"ts":return createjs.AbstractLoader.VIDEO;case"json":return createjs.AbstractLoader.JSON;case"xml":return createjs.AbstractLoader.XML;case"css":return createjs.AbstractLoader.CSS;case"js":return createjs.AbstractLoader.JAVASCRIPT;case"svg":return createjs.AbstractLoader.SVG;default:return createjs.AbstractLoader.TEXT}},createjs.RequestUtils=a}(),this.createjs=this.createjs||{},function(){"use strict";function AbstractLoader(a,b,c){this.EventDispatcher_constructor(),this.loaded=!1,this.canceled=!1,this.progress=0,this.type=c,this.resultFormatter=null,this._item=a?createjs.LoadItem.create(a):null,this._preferXHR=b,this._result=null,this._rawResult=null,this._loadedItems=null,this._tagSrcAttribute=null,this._tag=null}var a=createjs.extend(AbstractLoader,createjs.EventDispatcher),b=AbstractLoader;b.POST="POST",b.GET="GET",b.BINARY="binary",b.CSS="css",b.IMAGE="image",b.JAVASCRIPT="javascript",b.JSON="json",b.JSONP="jsonp",b.MANIFEST="manifest",b.SOUND="sound",b.VIDEO="video",b.SPRITESHEET="spritesheet",b.SVG="svg",b.TEXT="text",b.XML="xml",a.getItem=function(){return this._item},a.getResult=function(a){return a?this._rawResult:this._result},a.getTag=function(){return this._tag},a.setTag=function(a){this._tag=a},a.load=function(){this._createRequest(),this._request.on("complete",this,this),this._request.on("progress",this,this),this._request.on("loadStart",this,this),this._request.on("abort",this,this),this._request.on("timeout",this,this),this._request.on("error",this,this);var a=new createjs.Event("initialize");a.loader=this._request,this.dispatchEvent(a),this._request.load()},a.cancel=function(){this.canceled=!0,this.destroy()},a.destroy=function(){this._request&&(this._request.removeAllEventListeners(),this._request.destroy()),this._request=null,this._item=null,this._rawResult=null,this._result=null,this._loadItems=null,this.removeAllEventListeners()},a.getLoadedItems=function(){return this._loadedItems},a._createRequest=function(){this._request=this._preferXHR?new createjs.XHRRequest(this._item):new createjs.TagRequest(this._item,this._tag||this._createTag(),this._tagSrcAttribute)},a._createTag=function(){return null},a._sendLoadStart=function(){this._isCanceled()||this.dispatchEvent("loadstart")},a._sendProgress=function(a){if(!this._isCanceled()){var b=null;"number"==typeof a?(this.progress=a,b=new createjs.ProgressEvent(this.progress)):(b=a,this.progress=a.loaded/a.total,b.progress=this.progress,(isNaN(this.progress)||1/0==this.progress)&&(this.progress=0)),this.hasEventListener("progress")&&this.dispatchEvent(b)}},a._sendComplete=function(){if(!this._isCanceled()){this.loaded=!0;var a=new createjs.Event("complete");a.rawResult=this._rawResult,null!=this._result&&(a.result=this._result),this.dispatchEvent(a)}},a._sendError=function(a){!this._isCanceled()&&this.hasEventListener("error")&&(null==a&&(a=new createjs.ErrorEvent("PRELOAD_ERROR_EMPTY")),this.dispatchEvent(a))},a._isCanceled=function(){return null==window.createjs||this.canceled?!0:!1},a.resultFormatter=null,a.handleEvent=function(a){switch(a.type){case"complete":this._rawResult=a.target._response;var b=this.resultFormatter&&this.resultFormatter(this);b instanceof Function?b.call(this,createjs.proxy(this._resultFormatSuccess,this),createjs.proxy(this._resultFormatFailed,this)):(this._result=b||this._rawResult,this._sendComplete());break;case"progress":this._sendProgress(a);break;case"error":this._sendError(a);break;case"loadstart":this._sendLoadStart();break;case"abort":case"timeout":this._isCanceled()||this.dispatchEvent(new createjs.ErrorEvent("PRELOAD_"+a.type.toUpperCase()+"_ERROR"))}},a._resultFormatSuccess=function(a){this._result=a,this._sendComplete()},a._resultFormatFailed=function(a){this._sendError(a)},a.buildPath=function(a,b){return createjs.RequestUtils.buildPath(a,b)},a.toString=function(){return"[PreloadJS AbstractLoader]"},createjs.AbstractLoader=createjs.promote(AbstractLoader,"EventDispatcher")}(),this.createjs=this.createjs||{},function(){"use strict";function AbstractMediaLoader(a,b,c){this.AbstractLoader_constructor(a,b,c),this.resultFormatter=this._formatResult,this._tagSrcAttribute="src",this.on("initialize",this._updateXHR,this)}var a=createjs.extend(AbstractMediaLoader,createjs.AbstractLoader);a.load=function(){this._tag||(this._tag=this._createTag(this._item.src)),this._tag.preload="auto",this._tag.load(),this.AbstractLoader_load()},a._createTag=function(){},a._createRequest=function(){this._request=this._preferXHR?new createjs.XHRRequest(this._item):new createjs.MediaTagRequest(this._item,this._tag||this._createTag(),this._tagSrcAttribute)},a._updateXHR=function(a){a.loader.setResponseType&&a.loader.setResponseType("blob")},a._formatResult=function(a){if(this._tag.removeEventListener&&this._tag.removeEventListener("canplaythrough",this._loadedHandler),this._tag.onstalled=null,this._preferXHR){var b=window.URL||window.webkitURL,c=a.getResult(!0);a.getTag().src=b.createObjectURL(c)}return a.getTag()},createjs.AbstractMediaLoader=createjs.promote(AbstractMediaLoader,"AbstractLoader")}(),this.createjs=this.createjs||{},function(){"use strict";var AbstractRequest=function(a){this._item=a},a=createjs.extend(AbstractRequest,createjs.EventDispatcher);a.load=function(){},a.destroy=function(){},a.cancel=function(){},createjs.AbstractRequest=createjs.promote(AbstractRequest,"EventDispatcher")}(),this.createjs=this.createjs||{},function(){"use strict";function TagRequest(a,b,c){this.AbstractRequest_constructor(a),this._tag=b,this._tagSrcAttribute=c,this._loadedHandler=createjs.proxy(this._handleTagComplete,this),this._addedToDOM=!1,this._startTagVisibility=null}var a=createjs.extend(TagRequest,createjs.AbstractRequest);a.load=function(){this._tag.onload=createjs.proxy(this._handleTagComplete,this),this._tag.onreadystatechange=createjs.proxy(this._handleReadyStateChange,this),this._tag.onerror=createjs.proxy(this._handleError,this);var a=new createjs.Event("initialize");a.loader=this._tag,this.dispatchEvent(a),this._hideTag(),this._loadTimeout=setTimeout(createjs.proxy(this._handleTimeout,this),this._item.loadTimeout),this._tag[this._tagSrcAttribute]=this._item.src,null==this._tag.parentNode&&(window.document.body.appendChild(this._tag),this._addedToDOM=!0)},a.destroy=function(){this._clean(),this._tag=null,this.AbstractRequest_destroy()},a._handleReadyStateChange=function(){clearTimeout(this._loadTimeout);var a=this._tag;("loaded"==a.readyState||"complete"==a.readyState)&&this._handleTagComplete()},a._handleError=function(){this._clean(),this.dispatchEvent("error")},a._handleTagComplete=function(){this._rawResult=this._tag,this._result=this.resultFormatter&&this.resultFormatter(this)||this._rawResult,this._clean(),this._showTag(),this.dispatchEvent("complete")},a._handleTimeout=function(){this._clean(),this.dispatchEvent(new createjs.Event("timeout"))},a._clean=function(){this._tag.onload=null,this._tag.onreadystatechange=null,this._tag.onerror=null,this._addedToDOM&&null!=this._tag.parentNode&&this._tag.parentNode.removeChild(this._tag),clearTimeout(this._loadTimeout)},a._hideTag=function(){this._startTagVisibility=this._tag.style.visibility,this._tag.style.visibility="hidden"},a._showTag=function(){this._tag.style.visibility=this._startTagVisibility},a._handleStalled=function(){},createjs.TagRequest=createjs.promote(TagRequest,"AbstractRequest")}(),this.createjs=this.createjs||{},function(){"use strict";function MediaTagRequest(a,b,c){this.AbstractRequest_constructor(a),this._tag=b,this._tagSrcAttribute=c,this._loadedHandler=createjs.proxy(this._handleTagComplete,this)}var a=createjs.extend(MediaTagRequest,createjs.TagRequest);a.load=function(){var a=createjs.proxy(this._handleStalled,this);this._stalledCallback=a;var b=createjs.proxy(this._handleProgress,this);this._handleProgress=b,this._tag.addEventListener("stalled",a),this._tag.addEventListener("progress",b),this._tag.addEventListener&&this._tag.addEventListener("canplaythrough",this._loadedHandler,!1),this.TagRequest_load()},a._handleReadyStateChange=function(){clearTimeout(this._loadTimeout);var a=this._tag;("loaded"==a.readyState||"complete"==a.readyState)&&this._handleTagComplete()},a._handleStalled=function(){},a._handleProgress=function(a){if(a&&!(a.loaded>0&&0==a.total)){var b=new createjs.ProgressEvent(a.loaded,a.total);this.dispatchEvent(b)}},a._clean=function(){this._tag.removeEventListener&&this._tag.removeEventListener("canplaythrough",this._loadedHandler),this._tag.removeEventListener("stalled",this._stalledCallback),this._tag.removeEventListener("progress",this._progressCallback),this.TagRequest__clean()},createjs.MediaTagRequest=createjs.promote(MediaTagRequest,"TagRequest")}(),this.createjs=this.createjs||{},function(){"use strict";function XHRRequest(a){this.AbstractRequest_constructor(a),this._request=null,this._loadTimeout=null,this._xhrLevel=1,this._response=null,this._rawResponse=null,this._canceled=!1,this._handleLoadStartProxy=createjs.proxy(this._handleLoadStart,this),this._handleProgressProxy=createjs.proxy(this._handleProgress,this),this._handleAbortProxy=createjs.proxy(this._handleAbort,this),this._handleErrorProxy=createjs.proxy(this._handleError,this),this._handleTimeoutProxy=createjs.proxy(this._handleTimeout,this),this._handleLoadProxy=createjs.proxy(this._handleLoad,this),this._handleReadyStateChangeProxy=createjs.proxy(this._handleReadyStateChange,this),!this._createXHR(a)}var a=createjs.extend(XHRRequest,createjs.AbstractRequest);XHRRequest.ACTIVEX_VERSIONS=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.5.0","Msxml2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],a.getResult=function(a){return a&&this._rawResponse?this._rawResponse:this._response},a.cancel=function(){this.canceled=!0,this._clean(),this._request.abort()},a.load=function(){if(null==this._request)return void this._handleError();null!=this._request.addEventListener?(this._request.addEventListener("loadstart",this._handleLoadStartProxy,!1),this._request.addEventListener("progress",this._handleProgressProxy,!1),this._request.addEventListener("abort",this._handleAbortProxy,!1),this._request.addEventListener("error",this._handleErrorProxy,!1),this._request.addEventListener("timeout",this._handleTimeoutProxy,!1),this._request.addEventListener("load",this._handleLoadProxy,!1),this._request.addEventListener("readystatechange",this._handleReadyStateChangeProxy,!1)):(this._request.onloadstart=this._handleLoadStartProxy,this._request.onprogress=this._handleProgressProxy,this._request.onabort=this._handleAbortProxy,this._request.onerror=this._handleErrorProxy,this._request.ontimeout=this._handleTimeoutProxy,this._request.onload=this._handleLoadProxy,this._request.onreadystatechange=this._handleReadyStateChangeProxy),1==this._xhrLevel&&(this._loadTimeout=setTimeout(createjs.proxy(this._handleTimeout,this),this._item.loadTimeout));try{this._item.values&&this._item.method!=createjs.AbstractLoader.GET?this._item.method==createjs.AbstractLoader.POST&&this._request.send(createjs.RequestUtils.formatQueryString(this._item.values)):this._request.send()}catch(a){this.dispatchEvent(new createjs.ErrorEvent("XHR_SEND",null,a))}},a.setResponseType=function(a){"blob"===a&&(a=window.URL?"blob":"arraybuffer",this._responseType=a),this._request.responseType=a},a.getAllResponseHeaders=function(){return this._request.getAllResponseHeaders instanceof Function?this._request.getAllResponseHeaders():null},a.getResponseHeader=function(a){return this._request.getResponseHeader instanceof Function?this._request.getResponseHeader(a):null},a._handleProgress=function(a){if(a&&!(a.loaded>0&&0==a.total)){var b=new createjs.ProgressEvent(a.loaded,a.total);this.dispatchEvent(b)}},a._handleLoadStart=function(){clearTimeout(this._loadTimeout),this.dispatchEvent("loadstart")},a._handleAbort=function(a){this._clean(),this.dispatchEvent(new createjs.ErrorEvent("XHR_ABORTED",null,a))},a._handleError=function(a){this._clean(),this.dispatchEvent(new createjs.ErrorEvent(a.message))},a._handleReadyStateChange=function(){4==this._request.readyState&&this._handleLoad()},a._handleLoad=function(){if(!this.loaded){this.loaded=!0;var a=this._checkError();if(a)return void this._handleError(a);if(this._response=this._getResponse(),"arraybuffer"===this._responseType)try{this._response=new Blob([this._response])}catch(b){if(window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,"TypeError"===b.name&&window.BlobBuilder){var c=new BlobBuilder;c.append(this._response),this._response=c.getBlob()}}this._clean(),this.dispatchEvent(new createjs.Event("complete"))}},a._handleTimeout=function(a){this._clean(),this.dispatchEvent(new createjs.ErrorEvent("PRELOAD_TIMEOUT",null,a))},a._checkError=function(){var a=parseInt(this._request.status);switch(a){case 404:case 0:return new Error(a)}return null},a._getResponse=function(){if(null!=this._response)return this._response;if(null!=this._request.response)return this._request.response;try{if(null!=this._request.responseText)return this._request.responseText}catch(a){}try{if(null!=this._request.responseXML)return this._request.responseXML}catch(a){}return null},a._createXHR=function(a){var b=createjs.RequestUtils.isCrossDomain(a),c={},d=null;if(window.XMLHttpRequest)d=new XMLHttpRequest,b&&void 0===d.withCredentials&&window.XDomainRequest&&(d=new XDomainRequest);else{for(var e=0,f=s.ACTIVEX_VERSIONS.length;f>e;e++){var g=s.ACTIVEX_VERSIONS[e];try{d=new ActiveXObject(g);break}catch(h){}}if(null==d)return!1}null==a.mimeType&&createjs.RequestUtils.isText(a.type)&&(a.mimeType="text/plain; charset=utf-8"),a.mimeType&&d.overrideMimeType&&d.overrideMimeType(a.mimeType),this._xhrLevel="string"==typeof d.responseType?2:1;var i=null;if(i=a.method==createjs.AbstractLoader.GET?createjs.RequestUtils.buildPath(a.src,a.values):a.src,d.open(a.method||createjs.AbstractLoader.GET,i,!0),b&&d instanceof XMLHttpRequest&&1==this._xhrLevel&&(c.Origin=location.origin),a.values&&a.method==createjs.AbstractLoader.POST&&(c["Content-Type"]="application/x-www-form-urlencoded"),b||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest"),a.headers)for(var j in a.headers)c[j]=a.headers[j];for(j in c)d.setRequestHeader(j,c[j]);return d instanceof XMLHttpRequest&&void 0!==a.withCredentials&&(d.withCredentials=a.withCredentials),this._request=d,!0},a._clean=function(){clearTimeout(this._loadTimeout),null!=this._request.removeEventListener?(this._request.removeEventListener("loadstart",this._handleLoadStartProxy),this._request.removeEventListener("progress",this._handleProgressProxy),this._request.removeEventListener("abort",this._handleAbortProxy),this._request.removeEventListener("error",this._handleErrorProxy),this._request.removeEventListener("timeout",this._handleTimeoutProxy),this._request.removeEventListener("load",this._handleLoadProxy),this._request.removeEventListener("readystatechange",this._handleReadyStateChangeProxy)):(this._request.onloadstart=null,this._request.onprogress=null,this._request.onabort=null,this._request.onerror=null,this._request.ontimeout=null,this._request.onload=null,this._request.onreadystatechange=null)},a.toString=function(){return"[PreloadJS XHRRequest]"},createjs.XHRRequest=createjs.promote(XHRRequest,"AbstractRequest")}(),this.createjs=this.createjs||{},function(){"use strict";function SoundLoader(a,b){this.AbstractMediaLoader_constructor(a,b,createjs.AbstractLoader.SOUND),createjs.RequestUtils.isAudioTag(a)?this._tag=a:createjs.RequestUtils.isAudioTag(a.src)?this._tag=a:createjs.RequestUtils.isAudioTag(a.tag)&&(this._tag=createjs.RequestUtils.isAudioTag(a)?a:a.src),null!=this._tag&&(this._preferXHR=!1)}var a=createjs.extend(SoundLoader,createjs.AbstractMediaLoader),b=SoundLoader;b.canLoadItem=function(a){return a.type==createjs.AbstractLoader.SOUND},a._createTag=function(a){var b=document.createElement("audio");return b.autoplay=!1,b.preload="none",b.src=a,b},createjs.SoundLoader=createjs.promote(SoundLoader,"AbstractMediaLoader")}(),this.createjs=this.createjs||{},function(){"use strict";var PlayPropsConfig=function(){this.interrupt=null,this.delay=null,this.offset=null,this.loop=null,this.volume=null,this.pan=null,this.startTime=null,this.duration=null},a=PlayPropsConfig.prototype={},b=PlayPropsConfig;b.create=function(a){if(a instanceof b||a instanceof Object){var c=new createjs.PlayPropsConfig;return c.set(a),c}throw new Error("Type not recognized.")},a.set=function(a){for(var b in a)this[b]=a[b];return this},a.toString=function(){return"[PlayPropsConfig]"},createjs.PlayPropsConfig=b}(),this.createjs=this.createjs||{},function(){"use strict";function Sound(){throw"Sound cannot be instantiated"}function a(a,b){this.init(a,b)}var b=Sound;b.INTERRUPT_ANY="any",b.INTERRUPT_EARLY="early",b.INTERRUPT_LATE="late",b.INTERRUPT_NONE="none",b.PLAY_INITED="playInited",b.PLAY_SUCCEEDED="playSucceeded",b.PLAY_INTERRUPTED="playInterrupted",b.PLAY_FINISHED="playFinished",b.PLAY_FAILED="playFailed",b.SUPPORTED_EXTENSIONS=["mp3","ogg","opus","mpeg","wav","m4a","mp4","aiff","wma","mid"],b.EXTENSION_MAP={m4a:"mp4"},b.FILE_PATTERN=/^(?:(\w+:)\/{2}(\w+(?:\.\w+)*\/?))?([\/.]*?(?:[^?]+)?\/)?((?:[^\/?]+)\.(\w+))(?:\?(\S+)?)?$/,b.defaultInterruptBehavior=b.INTERRUPT_NONE,b.alternateExtensions=[],b.activePlugin=null,b._masterVolume=1,Object.defineProperty(b,"volume",{get:function(){return this._masterVolume},set:function(a){if(null==Number(a))return!1;if(a=Math.max(0,Math.min(1,a)),b._masterVolume=a,!this.activePlugin||!this.activePlugin.setVolume||!this.activePlugin.setVolume(a))for(var c=this._instances,d=0,e=c.length;e>d;d++)c[d].setMasterVolume(a)}}),b._masterMute=!1,Object.defineProperty(b,"muted",{get:function(){return this._masterMute},set:function(a){if(null==a)return!1;if(this._masterMute=a,!this.activePlugin||!this.activePlugin.setMute||!this.activePlugin.setMute(a))for(var b=this._instances,c=0,d=b.length;d>c;c++)b[c].setMasterMute(a);return!0}}),Object.defineProperty(b,"capabilities",{get:function(){return null==b.activePlugin?null:b.activePlugin._capabilities},set:function(){return!1}}),b._pluginsRegistered=!1,b._lastID=0,b._instances=[],b._idHash={},b._preloadHash={},b._defaultPlayPropsHash={},b.addEventListener=null,b.removeEventListener=null,b.removeAllEventListeners=null,b.dispatchEvent=null,b.hasEventListener=null,b._listeners=null,createjs.EventDispatcher.initialize(b),b.getPreloadHandlers=function(){return{callback:createjs.proxy(b.initLoad,b),types:["sound"],extensions:b.SUPPORTED_EXTENSIONS}},b._handleLoadComplete=function(a){var c=a.target.getItem().src;if(b._preloadHash[c])for(var d=0,e=b._preloadHash[c].length;e>d;d++){var f=b._preloadHash[c][d];if(b._preloadHash[c][d]=!0,b.hasEventListener("fileload")){var a=new createjs.Event("fileload");a.src=f.src,a.id=f.id,a.data=f.data,a.sprite=f.sprite,b.dispatchEvent(a)}}},b._handleLoadError=function(a){var c=a.target.getItem().src;if(b._preloadHash[c])for(var d=0,e=b._preloadHash[c].length;e>d;d++){var f=b._preloadHash[c][d];if(b._preloadHash[c][d]=!1,b.hasEventListener("fileerror")){var a=new createjs.Event("fileerror");a.src=f.src,a.id=f.id,a.data=f.data,a.sprite=f.sprite,b.dispatchEvent(a)}}},b._registerPlugin=function(a){return a.isSupported()?(b.activePlugin=new a,!0):!1},b.registerPlugins=function(a){b._pluginsRegistered=!0;for(var c=0,d=a.length;d>c;c++)if(b._registerPlugin(a[c]))return!0;return!1},b.initializeDefaultPlugins=function(){return null!=b.activePlugin?!0:b._pluginsRegistered?!1:b.registerPlugins([createjs.WebAudioPlugin,createjs.HTMLAudioPlugin])?!0:!1},b.isReady=function(){return null!=b.activePlugin},b.getCapabilities=function(){return null==b.activePlugin?null:b.activePlugin._capabilities},b.getCapability=function(a){return null==b.activePlugin?null:b.activePlugin._capabilities[a]},b.initLoad=function(a){return b._registerSound(a)},b._registerSound=function(c){if(!b.initializeDefaultPlugins())return!1;var d;if(c.src instanceof Object?(d=b._parseSrc(c.src),d.src=c.path+d.src):d=b._parsePath(c.src),null==d)return!1;c.src=d.src,c.type="sound";var e=c.data,f=null;if(null!=e&&(isNaN(e.channels)?isNaN(e)||(f=parseInt(e)):f=parseInt(e.channels),e.audioSprite))for(var g,h=e.audioSprite.length;h--;)g=e.audioSprite[h],b._idHash[g.id]={src:c.src,startTime:parseInt(g.startTime),duration:parseInt(g.duration)},g.defaultPlayProps&&(b._defaultPlayPropsHash[g.id]=createjs.PlayPropsConfig.create(g.defaultPlayProps));null!=c.id&&(b._idHash[c.id]={src:c.src});var i=b.activePlugin.register(c);return a.create(c.src,f),null!=e&&isNaN(e)?c.data.channels=f||a.maxPerChannel():c.data=f||a.maxPerChannel(),i.type&&(c.type=i.type),c.defaultPlayProps&&(b._defaultPlayPropsHash[c.src]=createjs.PlayPropsConfig.create(c.defaultPlayProps)),i},b.registerSound=function(a,c,d,e,f){var g={src:a,id:c,data:d,defaultPlayProps:f};a instanceof Object&&a.src&&(e=c,g=a),g=createjs.LoadItem.create(g),g.path=e,null==e||g.src instanceof Object||(g.src=e+a);var h=b._registerSound(g);if(!h)return!1;if(b._preloadHash[g.src]||(b._preloadHash[g.src]=[]),b._preloadHash[g.src].push(g),1==b._preloadHash[g.src].length)h.on("complete",createjs.proxy(this._handleLoadComplete,this)),h.on("error",createjs.proxy(this._handleLoadError,this)),b.activePlugin.preload(h);else if(1==b._preloadHash[g.src][0])return!0;return g},b.registerSounds=function(a,b){var c=[];a.path&&(b?b+=a.path:b=a.path,a=a.manifest);for(var d=0,e=a.length;e>d;d++)c[d]=createjs.Sound.registerSound(a[d].src,a[d].id,a[d].data,b,a[d].defaultPlayProps);return c},b.removeSound=function(c,d){if(null==b.activePlugin)return!1;c instanceof Object&&c.src&&(c=c.src);var e;if(c instanceof Object?e=b._parseSrc(c):(c=b._getSrcById(c).src,e=b._parsePath(c)),null==e)return!1;c=e.src,null!=d&&(c=d+c);for(var f in b._idHash)b._idHash[f].src==c&&delete b._idHash[f];return a.removeSrc(c),delete b._preloadHash[c],b.activePlugin.removeSound(c),!0},b.removeSounds=function(a,b){var c=[];a.path&&(b?b+=a.path:b=a.path,a=a.manifest);for(var d=0,e=a.length;e>d;d++)c[d]=createjs.Sound.removeSound(a[d].src,b);return c},b.removeAllSounds=function(){b._idHash={},b._preloadHash={},a.removeAll(),b.activePlugin&&b.activePlugin.removeAllSounds()},b.loadComplete=function(a){if(!b.isReady())return!1;var c=b._parsePath(a);return a=c?b._getSrcById(c.src).src:b._getSrcById(a).src,void 0==b._preloadHash[a]?!1:1==b._preloadHash[a][0]},b._parsePath=function(a){"string"!=typeof a&&(a=a.toString());var c=a.match(b.FILE_PATTERN);if(null==c)return!1;for(var d=c[4],e=c[5],f=b.capabilities,g=0;!f[e];)if(e=b.alternateExtensions[g++],g>b.alternateExtensions.length)return null;a=a.replace("."+c[5],"."+e);var h={name:d,src:a,extension:e};return h},b._parseSrc=function(a){var c={name:void 0,src:void 0,extension:void 0},d=b.capabilities;for(var e in a)if(a.hasOwnProperty(e)&&d[e]){c.src=a[e],c.extension=e;break}if(!c.src)return!1;var f=c.src.lastIndexOf("/");return c.name=-1!=f?c.src.slice(f+1):c.src,c},b.play=function(a,c,d,e,f,g,h,i,j){var k;k=createjs.PlayPropsConfig.create(c instanceof Object||c instanceof createjs.PlayPropsConfig?c:{interrupt:c,delay:d,offset:e,loop:f,volume:g,pan:h,startTime:i,duration:j});var l=b.createInstance(a,k.startTime,k.duration),m=b._playInstance(l,k);return m||l._playFailed(),l},b.createInstance=function(c,d,e){if(!b.initializeDefaultPlugins())return new createjs.DefaultSoundInstance(c,d,e);var f=b._defaultPlayPropsHash[c];c=b._getSrcById(c);var g=b._parsePath(c.src),h=null; +return null!=g&&null!=g.src?(a.create(g.src),null==d&&(d=c.startTime),h=b.activePlugin.create(g.src,d,e||c.duration),f=f||b._defaultPlayPropsHash[g.src],f&&h.applyPlayProps(f)):h=new createjs.DefaultSoundInstance(c,d,e),h.uniqueId=b._lastID++,h},b.stop=function(){for(var a=this._instances,b=a.length;b--;)a[b].stop()},b.setVolume=function(a){if(null==Number(a))return!1;if(a=Math.max(0,Math.min(1,a)),b._masterVolume=a,!this.activePlugin||!this.activePlugin.setVolume||!this.activePlugin.setVolume(a))for(var c=this._instances,d=0,e=c.length;e>d;d++)c[d].setMasterVolume(a)},b.getVolume=function(){return this._masterVolume},b.setMute=function(a){if(null==a)return!1;if(this._masterMute=a,!this.activePlugin||!this.activePlugin.setMute||!this.activePlugin.setMute(a))for(var b=this._instances,c=0,d=b.length;d>c;c++)b[c].setMasterMute(a);return!0},b.getMute=function(){return this._masterMute},b.setDefaultPlayProps=function(a,c){a=b._getSrcById(a),b._defaultPlayPropsHash[b._parsePath(a.src).src]=createjs.PlayPropsConfig.create(c)},b.getDefaultPlayProps=function(a){return a=b._getSrcById(a),b._defaultPlayPropsHash[b._parsePath(a.src).src]},b._playInstance=function(a,c){var d=b._defaultPlayPropsHash[a.src]||{};if(null==c.interrupt&&(c.interrupt=d.interrupt||b.defaultInterruptBehavior),null==c.delay&&(c.delay=d.delay||0),null==c.offset&&(c.offset=a.getPosition()),null==c.loop&&(c.loop=a.loop),null==c.volume&&(c.volume=a.volume),null==c.pan&&(c.pan=a.pan),0==c.delay){var e=b._beginPlaying(a,c);if(!e)return!1}else{var f=setTimeout(function(){b._beginPlaying(a,c)},c.delay);a.delayTimeoutId=f}return this._instances.push(a),!0},b._beginPlaying=function(b,c){if(!a.add(b,c.interrupt))return!1;var d=b._beginPlaying(c);if(!d){var e=createjs.indexOf(this._instances,b);return e>-1&&this._instances.splice(e,1),!1}return!0},b._getSrcById=function(a){return b._idHash[a]||{src:a}},b._playFinished=function(b){a.remove(b);var c=createjs.indexOf(this._instances,b);c>-1&&this._instances.splice(c,1)},createjs.Sound=Sound,a.channels={},a.create=function(b,c){var d=a.get(b);return null==d?(a.channels[b]=new a(b,c),!0):!1},a.removeSrc=function(b){var c=a.get(b);return null==c?!1:(c._removeAll(),delete a.channels[b],!0)},a.removeAll=function(){for(var b in a.channels)a.channels[b]._removeAll();a.channels={}},a.add=function(b,c){var d=a.get(b.src);return null==d?!1:d._add(b,c)},a.remove=function(b){var c=a.get(b.src);return null==c?!1:(c._remove(b),!0)},a.maxPerChannel=function(){return c.maxDefault},a.get=function(b){return a.channels[b]};var c=a.prototype;c.constructor=a,c.src=null,c.max=null,c.maxDefault=100,c.length=0,c.init=function(a,b){this.src=a,this.max=b||this.maxDefault,-1==this.max&&(this.max=this.maxDefault),this._instances=[]},c._get=function(a){return this._instances[a]},c._add=function(a,b){return this._getSlot(b,a)?(this._instances.push(a),this.length++,!0):!1},c._remove=function(a){var b=createjs.indexOf(this._instances,a);return-1==b?!1:(this._instances.splice(b,1),this.length--,!0)},c._removeAll=function(){for(var a=this.length-1;a>=0;a--)this._instances[a].stop()},c._getSlot=function(a){var b,c;if(a!=Sound.INTERRUPT_NONE&&(c=this._get(0),null==c))return!0;for(var d=0,e=this.max;e>d;d++){if(b=this._get(d),null==b)return!0;if(b.playState==Sound.PLAY_FINISHED||b.playState==Sound.PLAY_INTERRUPTED||b.playState==Sound.PLAY_FAILED){c=b;break}a!=Sound.INTERRUPT_NONE&&(a==Sound.INTERRUPT_EARLY&&b.getPosition()c.getPosition())&&(c=b)}return null!=c?(c._interrupt(),this._remove(c),!0):!1},c.toString=function(){return"[Sound SoundChannel]"}}(),this.createjs=this.createjs||{},function(){"use strict";var AbstractSoundInstance=function(a,b,c,d){this.EventDispatcher_constructor(),this.src=a,this.uniqueId=-1,this.playState=null,this.delayTimeoutId=null,this._volume=1,Object.defineProperty(this,"volume",{get:this.getVolume,set:this.setVolume}),this._pan=0,Object.defineProperty(this,"pan",{get:this.getPan,set:this.setPan}),this._startTime=Math.max(0,b||0),Object.defineProperty(this,"startTime",{get:this.getStartTime,set:this.setStartTime}),this._duration=Math.max(0,c||0),Object.defineProperty(this,"duration",{get:this.getDuration,set:this.setDuration}),this._playbackResource=null,Object.defineProperty(this,"playbackResource",{get:this.getPlaybackResource,set:this.setPlaybackResource}),d!==!1&&d!==!0&&this.setPlaybackResource(d),this._position=0,Object.defineProperty(this,"position",{get:this.getPosition,set:this.setPosition}),this._loop=0,Object.defineProperty(this,"loop",{get:this.getLoop,set:this.setLoop}),this._muted=!1,Object.defineProperty(this,"muted",{get:this.getMuted,set:this.setMuted}),this._paused=!1,Object.defineProperty(this,"paused",{get:this.getPaused,set:this.setPaused})},a=createjs.extend(AbstractSoundInstance,createjs.EventDispatcher);a.play=function(a,b,c,d,e,f){var g;return g=createjs.PlayPropsConfig.create(a instanceof Object||a instanceof createjs.PlayPropsConfig?a:{interrupt:a,delay:b,offset:c,loop:d,volume:e,pan:f}),this.playState==createjs.Sound.PLAY_SUCCEEDED?(this.applyPlayProps(g),void(this._paused&&this.setPaused(!1))):(this._cleanUp(),createjs.Sound._playInstance(this,g),this)},a.stop=function(){return this._position=0,this._paused=!1,this._handleStop(),this._cleanUp(),this.playState=createjs.Sound.PLAY_FINISHED,this},a.destroy=function(){this._cleanUp(),this.src=null,this.playbackResource=null,this.removeAllEventListeners()},a.applyPlayProps=function(a){return null!=a.offset&&this.setPosition(a.offset),null!=a.loop&&this.setLoop(a.loop),null!=a.volume&&this.setVolume(a.volume),null!=a.pan&&this.setPan(a.pan),null!=a.startTime&&(this.setStartTime(a.startTime),this.setDuration(a.duration)),this},a.toString=function(){return"[AbstractSoundInstance]"},a.getPaused=function(){return this._paused},a.setPaused=function(a){return a!==!0&&a!==!1||this._paused==a||1==a&&this.playState!=createjs.Sound.PLAY_SUCCEEDED?void 0:(this._paused=a,a?this._pause():this._resume(),clearTimeout(this.delayTimeoutId),this)},a.setVolume=function(a){return a==this._volume?this:(this._volume=Math.max(0,Math.min(1,a)),this._muted||this._updateVolume(),this)},a.getVolume=function(){return this._volume},a.setMuted=function(a){return a===!0||a===!1?(this._muted=a,this._updateVolume(),this):void 0},a.getMuted=function(){return this._muted},a.setPan=function(a){return a==this._pan?this:(this._pan=Math.max(-1,Math.min(1,a)),this._updatePan(),this)},a.getPan=function(){return this._pan},a.getPosition=function(){return this._paused||this.playState!=createjs.Sound.PLAY_SUCCEEDED||(this._position=this._calculateCurrentPosition()),this._position},a.setPosition=function(a){return this._position=Math.max(0,a),this.playState==createjs.Sound.PLAY_SUCCEEDED&&this._updatePosition(),this},a.getStartTime=function(){return this._startTime},a.setStartTime=function(a){return a==this._startTime?this:(this._startTime=Math.max(0,a||0),this._updateStartTime(),this)},a.getDuration=function(){return this._duration},a.setDuration=function(a){return a==this._duration?this:(this._duration=Math.max(0,a||0),this._updateDuration(),this)},a.setPlaybackResource=function(a){return this._playbackResource=a,0==this._duration&&this._setDurationFromSource(),this},a.getPlaybackResource=function(){return this._playbackResource},a.getLoop=function(){return this._loop},a.setLoop=function(a){null!=this._playbackResource&&(0!=this._loop&&0==a?this._removeLooping(a):0==this._loop&&0!=a&&this._addLooping(a)),this._loop=a},a._sendEvent=function(a){var b=new createjs.Event(a);this.dispatchEvent(b)},a._cleanUp=function(){clearTimeout(this.delayTimeoutId),this._handleCleanUp(),this._paused=!1,createjs.Sound._playFinished(this)},a._interrupt=function(){this._cleanUp(),this.playState=createjs.Sound.PLAY_INTERRUPTED,this._sendEvent("interrupted")},a._beginPlaying=function(a){return this.setPosition(a.offset),this.setLoop(a.loop),this.setVolume(a.volume),this.setPan(a.pan),null!=a.startTime&&(this.setStartTime(a.startTime),this.setDuration(a.duration)),null!=this._playbackResource&&this._positionc;c++){var e=this._soundInstances[b][c];e.setPlaybackResource(this._audioSources[b])}},a._handlePreloadError=function(){},a._updateVolume=function(){},createjs.AbstractPlugin=AbstractPlugin}(),this.createjs=this.createjs||{},function(){"use strict";function a(a){this.AbstractLoader_constructor(a,!0,createjs.AbstractLoader.SOUND)}var b=createjs.extend(a,createjs.AbstractLoader);a.context=null,b.toString=function(){return"[WebAudioLoader]"},b._createRequest=function(){this._request=new createjs.XHRRequest(this._item,!1),this._request.setResponseType("arraybuffer")},b._sendComplete=function(){a.context.decodeAudioData(this._rawResult,createjs.proxy(this._handleAudioDecoded,this),createjs.proxy(this._sendError,this))},b._handleAudioDecoded=function(a){this._result=a,this.AbstractLoader__sendComplete()},createjs.WebAudioLoader=createjs.promote(a,"AbstractLoader")}(),this.createjs=this.createjs||{},function(){"use strict";function WebAudioSoundInstance(a,c,d,e){this.AbstractSoundInstance_constructor(a,c,d,e),this.gainNode=b.context.createGain(),this.panNode=b.context.createPanner(),this.panNode.panningModel=b._panningModel,this.panNode.connect(this.gainNode),this._updatePan(),this.sourceNode=null,this._soundCompleteTimeout=null,this._sourceNodeNext=null,this._playbackStartTime=0,this._endedHandler=createjs.proxy(this._handleSoundComplete,this)}var a=createjs.extend(WebAudioSoundInstance,createjs.AbstractSoundInstance),b=WebAudioSoundInstance;b.context=null,b._scratchBuffer=null,b.destinationNode=null,b._panningModel="equalpower",a.destroy=function(){this.AbstractSoundInstance_destroy(),this.panNode.disconnect(0),this.panNode=null,this.gainNode.disconnect(0),this.gainNode=null},a.toString=function(){return"[WebAudioSoundInstance]"},a._updatePan=function(){this.panNode.setPosition(this._pan,0,-.5)},a._removeLooping=function(){this._sourceNodeNext=this._cleanUpAudioNode(this._sourceNodeNext)},a._addLooping=function(){this.playState==createjs.Sound.PLAY_SUCCEEDED&&(this._sourceNodeNext=this._createAndPlayAudioNode(this._playbackStartTime,0))},a._setDurationFromSource=function(){this._duration=1e3*this.playbackResource.duration},a._handleCleanUp=function(){this.sourceNode&&this.playState==createjs.Sound.PLAY_SUCCEEDED&&(this.sourceNode=this._cleanUpAudioNode(this.sourceNode),this._sourceNodeNext=this._cleanUpAudioNode(this._sourceNodeNext)),0!=this.gainNode.numberOfOutputs&&this.gainNode.disconnect(0),clearTimeout(this._soundCompleteTimeout),this._playbackStartTime=0},a._cleanUpAudioNode=function(a){if(a){a.stop(0),a.disconnect(0);try{a.buffer=b._scratchBuffer}catch(c){}a=null}return a},a._handleSoundReady=function(){this.gainNode.connect(b.destinationNode);var a=.001*this._duration,c=.001*this._position;c>a&&(c=a),this.sourceNode=this._createAndPlayAudioNode(b.context.currentTime-a,c),this._playbackStartTime=this.sourceNode.startTime-c,this._soundCompleteTimeout=setTimeout(this._endedHandler,1e3*(a-c)),0!=this._loop&&(this._sourceNodeNext=this._createAndPlayAudioNode(this._playbackStartTime,0))},a._createAndPlayAudioNode=function(a,c){var d=b.context.createBufferSource();d.buffer=this.playbackResource,d.connect(this.panNode);var e=.001*this._duration;return d.startTime=a+e,d.start(d.startTime,c+.001*this._startTime,e-c),d},a._pause=function(){this._position=1e3*(b.context.currentTime-this._playbackStartTime),this.sourceNode=this._cleanUpAudioNode(this.sourceNode),this._sourceNodeNext=this._cleanUpAudioNode(this._sourceNodeNext),0!=this.gainNode.numberOfOutputs&&this.gainNode.disconnect(0),clearTimeout(this._soundCompleteTimeout)},a._resume=function(){this._handleSoundReady()},a._updateVolume=function(){var a=this._muted?0:this._volume;a!=this.gainNode.gain.value&&(this.gainNode.gain.value=a)},a._calculateCurrentPosition=function(){return 1e3*(b.context.currentTime-this._playbackStartTime)},a._updatePosition=function(){this.sourceNode=this._cleanUpAudioNode(this.sourceNode),this._sourceNodeNext=this._cleanUpAudioNode(this._sourceNodeNext),clearTimeout(this._soundCompleteTimeout),this._paused||this._handleSoundReady()},a._handleLoop=function(){this._cleanUpAudioNode(this.sourceNode),this.sourceNode=this._sourceNodeNext,this._playbackStartTime=this.sourceNode.startTime,this._sourceNodeNext=this._createAndPlayAudioNode(this._playbackStartTime,0),this._soundCompleteTimeout=setTimeout(this._endedHandler,this._duration)},a._updateDuration=function(){this.playState==createjs.Sound.PLAY_SUCCEEDED&&(this._pause(),this._resume())},createjs.WebAudioSoundInstance=createjs.promote(WebAudioSoundInstance,"AbstractSoundInstance")}(),this.createjs=this.createjs||{},function(){"use strict";function WebAudioPlugin(){this.AbstractPlugin_constructor(),this._panningModel=b._panningModel,this.context=b.context,this.dynamicsCompressorNode=this.context.createDynamicsCompressor(),this.dynamicsCompressorNode.connect(this.context.destination),this.gainNode=this.context.createGain(),this.gainNode.connect(this.dynamicsCompressorNode),createjs.WebAudioSoundInstance.destinationNode=this.gainNode,this._capabilities=b._capabilities,this._loaderClass=createjs.WebAudioLoader,this._soundInstanceClass=createjs.WebAudioSoundInstance,this._addPropsToClasses()}var a=createjs.extend(WebAudioPlugin,createjs.AbstractPlugin),b=WebAudioPlugin;b._capabilities=null,b._panningModel="equalpower",b.context=null,b._scratchBuffer=null,b._unlocked=!1,b.isSupported=function(){var a=createjs.BrowserDetect.isIOS||createjs.BrowserDetect.isAndroid||createjs.BrowserDetect.isBlackberry;return"file:"!=location.protocol||a||this._isFileXHRSupported()?(b._generateCapabilities(),null==b.context?!1:!0):!1},b.playEmptySound=function(){if(null!=b.context){var a=b.context.createBufferSource();a.buffer=b._scratchBuffer,a.connect(b.context.destination),a.start(0,0,0)}},b._isFileXHRSupported=function(){var a=!0,b=new XMLHttpRequest;try{b.open("GET","WebAudioPluginTest.fail",!1)}catch(c){return a=!1}b.onerror=function(){a=!1},b.onload=function(){a=404==this.status||200==this.status||0==this.status&&""!=this.response};try{b.send()}catch(c){a=!1}return a},b._generateCapabilities=function(){if(null==b._capabilities){var a=document.createElement("audio");if(null==a.canPlayType)return null;if(null==b.context)if(window.AudioContext)b.context=new AudioContext;else{if(!window.webkitAudioContext)return null;b.context=new webkitAudioContext}null==b._scratchBuffer&&(b._scratchBuffer=b.context.createBuffer(1,1,22050)),b._compatibilitySetUp(),"ontouchstart"in window&&"running"!=b.context.state&&(b._unlock(),document.addEventListener("mousedown",b._unlock,!0),document.addEventListener("touchend",b._unlock,!0)),b._capabilities={panning:!0,volume:!0,tracks:-1};for(var c=createjs.Sound.SUPPORTED_EXTENSIONS,d=createjs.Sound.EXTENSION_MAP,e=0,f=c.length;f>e;e++){var g=c[e],h=d[g]||g;b._capabilities[g]="no"!=a.canPlayType("audio/"+g)&&""!=a.canPlayType("audio/"+g)||"no"!=a.canPlayType("audio/"+h)&&""!=a.canPlayType("audio/"+h)}b.context.destination.numberOfChannels<2&&(b._capabilities.panning=!1)}},b._compatibilitySetUp=function(){if(b._panningModel="equalpower",!b.context.createGain){b.context.createGain=b.context.createGainNode;var a=b.context.createBufferSource();a.__proto__.start=a.__proto__.noteGrainOn,a.__proto__.stop=a.__proto__.noteOff,b._panningModel=0}},b._unlock=function(){b._unlocked||(b.playEmptySound(),"running"==b.context.state&&(document.removeEventListener("mousedown",b._unlock,!0),document.removeEventListener("touchend",b._unlock,!0),b._unlocked=!0))},a.toString=function(){return"[WebAudioPlugin]"},a._addPropsToClasses=function(){var a=this._soundInstanceClass;a.context=this.context,a._scratchBuffer=b._scratchBuffer,a.destinationNode=this.gainNode,a._panningModel=this._panningModel,this._loaderClass.context=this.context},a._updateVolume=function(){var a=createjs.Sound._masterMute?0:this._volume;a!=this.gainNode.gain.value&&(this.gainNode.gain.value=a)},createjs.WebAudioPlugin=createjs.promote(WebAudioPlugin,"AbstractPlugin")}(),this.createjs=this.createjs||{},function(){"use strict";function HTMLAudioTagPool(){throw"HTMLAudioTagPool cannot be instantiated"}function a(){this._tags=[]}var b=HTMLAudioTagPool;b._tags={},b._tagPool=new a,b._tagUsed={},b.get=function(a){var c=b._tags[a];return null==c?(c=b._tags[a]=b._tagPool.get(),c.src=a):b._tagUsed[a]?(c=b._tagPool.get(),c.src=a):b._tagUsed[a]=!0,c},b.set=function(a,c){c==b._tags[a]?b._tagUsed[a]=!1:b._tagPool.set(c)},b.remove=function(a){var c=b._tags[a];return null==c?!1:(b._tagPool.set(c),delete b._tags[a],delete b._tagUsed[a],!0)},b.getDuration=function(a){var c=b._tags[a];return null!=c&&c.duration?1e3*c.duration:0},createjs.HTMLAudioTagPool=HTMLAudioTagPool;var c=a.prototype;c.constructor=a,c.get=function(){var a;return a=0==this._tags.length?this._createTag():this._tags.pop(),null==a.parentNode&&document.body.appendChild(a),a},c.set=function(a){var b=createjs.indexOf(this._tags,a);-1==b&&(this._tags.src=null,this._tags.push(a))},c.toString=function(){return"[TagPool]"},c._createTag=function(){var a=document.createElement("audio");return a.autoplay=!1,a.preload="none",a}}(),this.createjs=this.createjs||{},function(){"use strict";function HTMLAudioSoundInstance(a,b,c,d){this.AbstractSoundInstance_constructor(a,b,c,d),this._audioSpriteStopTime=null,this._delayTimeoutId=null,this._endedHandler=createjs.proxy(this._handleSoundComplete,this),this._readyHandler=createjs.proxy(this._handleTagReady,this),this._stalledHandler=createjs.proxy(this._playFailed,this),this._audioSpriteEndHandler=createjs.proxy(this._handleAudioSpriteLoop,this),this._loopHandler=createjs.proxy(this._handleSoundComplete,this),c?this._audioSpriteStopTime=.001*(b+c):this._duration=createjs.HTMLAudioTagPool.getDuration(this.src)}var a=createjs.extend(HTMLAudioSoundInstance,createjs.AbstractSoundInstance);a.setMasterVolume=function(){this._updateVolume()},a.setMasterMute=function(){this._updateVolume()},a.toString=function(){return"[HTMLAudioSoundInstance]"},a._removeLooping=function(){null!=this._playbackResource&&(this._playbackResource.loop=!1,this._playbackResource.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_SEEKED,this._loopHandler,!1))},a._addLooping=function(){null==this._playbackResource||this._audioSpriteStopTime||(this._playbackResource.addEventListener(createjs.HTMLAudioPlugin._AUDIO_SEEKED,this._loopHandler,!1),this._playbackResource.loop=!0)},a._handleCleanUp=function(){var a=this._playbackResource;if(null!=a){a.pause(),a.loop=!1,a.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_ENDED,this._endedHandler,!1),a.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_READY,this._readyHandler,!1),a.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_STALLED,this._stalledHandler,!1),a.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_SEEKED,this._loopHandler,!1),a.removeEventListener(createjs.HTMLAudioPlugin._TIME_UPDATE,this._audioSpriteEndHandler,!1);try{a.currentTime=this._startTime}catch(b){}createjs.HTMLAudioTagPool.set(this.src,a),this._playbackResource=null}},a._beginPlaying=function(a){return this._playbackResource=createjs.HTMLAudioTagPool.get(this.src),this.AbstractSoundInstance__beginPlaying(a)},a._handleSoundReady=function(){if(4!==this._playbackResource.readyState){var a=this._playbackResource;return a.addEventListener(createjs.HTMLAudioPlugin._AUDIO_READY,this._readyHandler,!1),a.addEventListener(createjs.HTMLAudioPlugin._AUDIO_STALLED,this._stalledHandler,!1),a.preload="auto",void a.load()}this._updateVolume(),this._playbackResource.currentTime=.001*(this._startTime+this._position),this._audioSpriteStopTime?this._playbackResource.addEventListener(createjs.HTMLAudioPlugin._TIME_UPDATE,this._audioSpriteEndHandler,!1):(this._playbackResource.addEventListener(createjs.HTMLAudioPlugin._AUDIO_ENDED,this._endedHandler,!1),0!=this._loop&&(this._playbackResource.addEventListener(createjs.HTMLAudioPlugin._AUDIO_SEEKED,this._loopHandler,!1),this._playbackResource.loop=!0)),this._playbackResource.play()},a._handleTagReady=function(){this._playbackResource.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_READY,this._readyHandler,!1),this._playbackResource.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_STALLED,this._stalledHandler,!1),this._handleSoundReady()},a._pause=function(){this._playbackResource.pause()},a._resume=function(){this._playbackResource.play()},a._updateVolume=function(){if(null!=this._playbackResource){var a=this._muted||createjs.Sound._masterMute?0:this._volume*createjs.Sound._masterVolume;a!=this._playbackResource.volume&&(this._playbackResource.volume=a)}},a._calculateCurrentPosition=function(){return 1e3*this._playbackResource.currentTime-this._startTime},a._updatePosition=function(){this._playbackResource.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_SEEKED,this._loopHandler,!1),this._playbackResource.addEventListener(createjs.HTMLAudioPlugin._AUDIO_SEEKED,this._handleSetPositionSeek,!1);try{this._playbackResource.currentTime=.001*(this._position+this._startTime)}catch(a){this._handleSetPositionSeek(null)}},a._handleSetPositionSeek=function(){null!=this._playbackResource&&(this._playbackResource.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_SEEKED,this._handleSetPositionSeek,!1),this._playbackResource.addEventListener(createjs.HTMLAudioPlugin._AUDIO_SEEKED,this._loopHandler,!1))},a._handleAudioSpriteLoop=function(){this._playbackResource.currentTime<=this._audioSpriteStopTime||(this._playbackResource.pause(),0==this._loop?this._handleSoundComplete(null):(this._position=0,this._loop--,this._playbackResource.currentTime=.001*this._startTime,this._paused||this._playbackResource.play(),this._sendEvent("loop")))},a._handleLoop=function(){0==this._loop&&(this._playbackResource.loop=!1,this._playbackResource.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_SEEKED,this._loopHandler,!1))},a._updateStartTime=function(){this._audioSpriteStopTime=.001*(this._startTime+this._duration),this.playState==createjs.Sound.PLAY_SUCCEEDED&&(this._playbackResource.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_ENDED,this._endedHandler,!1),this._playbackResource.addEventListener(createjs.HTMLAudioPlugin._TIME_UPDATE,this._audioSpriteEndHandler,!1))},a._updateDuration=function(){this._audioSpriteStopTime=.001*(this._startTime+this._duration),this.playState==createjs.Sound.PLAY_SUCCEEDED&&(this._playbackResource.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_ENDED,this._endedHandler,!1),this._playbackResource.addEventListener(createjs.HTMLAudioPlugin._TIME_UPDATE,this._audioSpriteEndHandler,!1))},a._setDurationFromSource=function(){this._duration=createjs.HTMLAudioTagPool.getDuration(this.src),this._playbackResource=null},createjs.HTMLAudioSoundInstance=createjs.promote(HTMLAudioSoundInstance,"AbstractSoundInstance")}(),this.createjs=this.createjs||{},function(){"use strict";function HTMLAudioPlugin(){this.AbstractPlugin_constructor(),this.defaultNumChannels=2,this._capabilities=b._capabilities,this._loaderClass=createjs.SoundLoader,this._soundInstanceClass=createjs.HTMLAudioSoundInstance}var a=createjs.extend(HTMLAudioPlugin,createjs.AbstractPlugin),b=HTMLAudioPlugin;b.MAX_INSTANCES=30,b._AUDIO_READY="canplaythrough",b._AUDIO_ENDED="ended",b._AUDIO_SEEKED="seeked",b._AUDIO_STALLED="stalled",b._TIME_UPDATE="timeupdate",b._capabilities=null,b.isSupported=function(){return b._generateCapabilities(),null!=b._capabilities},b._generateCapabilities=function(){if(null==b._capabilities){var a=document.createElement("audio");if(null==a.canPlayType)return null;b._capabilities={panning:!1,volume:!0,tracks:-1};for(var c=createjs.Sound.SUPPORTED_EXTENSIONS,d=createjs.Sound.EXTENSION_MAP,e=0,f=c.length;f>e;e++){var g=c[e],h=d[g]||g;b._capabilities[g]="no"!=a.canPlayType("audio/"+g)&&""!=a.canPlayType("audio/"+g)||"no"!=a.canPlayType("audio/"+h)&&""!=a.canPlayType("audio/"+h)}}},a.register=function(a){var b=createjs.HTMLAudioTagPool.get(a.src),c=this.AbstractPlugin_register(a);return c.setTag(b),c},a.removeSound=function(a){this.AbstractPlugin_removeSound(a),createjs.HTMLAudioTagPool.remove(a)},a.create=function(a,b,c){var d=this.AbstractPlugin_create(a,b,c);return d.setPlaybackResource(null),d},a.toString=function(){return"[HTMLAudioPlugin]"},a.setVolume=a.getVolume=a.setMute=null,createjs.HTMLAudioPlugin=createjs.promote(HTMLAudioPlugin,"AbstractPlugin")}(); \ No newline at end of file diff --git a/games/rocket-league-2d/index.html b/games/rocket-league-2d/index.html index 4a23ad1a..a4e459f3 100644 --- a/games/rocket-league-2d/index.html +++ b/games/rocket-league-2d/index.html @@ -1,86 +1,90 @@ - - - - - - - - - - - - - Created with GameMaker: Studio - - - - - - -
- - -

Your browser doesn't support HTML5 canvas.

-
-
- - - - - - - + + + + + + + + + + + + + + Created with GameMaker: Studio + + + + + + +
+ + +

Your browser doesn't support HTML5 canvas.

+
+
+ + + + + + + diff --git a/games/station-saturn/index.html b/games/station-saturn/index.html index 11d3266e..818d9118 100644 --- a/games/station-saturn/index.html +++ b/games/station-saturn/index.html @@ -1,121 +1,123 @@ - - - - Unity WebGL Player | Station Saturn - - - - -
-

By Alex Productions / Creative Commons CC BY 3.0

- -
- -
-
-
-
-
-