Merge branch 'challenges'

This commit is contained in:
Tyler Renelle 2013-10-29 23:10:55 -07:00
commit 5c915547b0
52 changed files with 3979 additions and 13060 deletions

6
.gitignore vendored
View file

@ -1,6 +1,2 @@
node_modules
.idea
script/*.js
script/*.map
tests/*.js
tests/*.map
.idea

46
Gruntfile.js Normal file
View file

@ -0,0 +1,46 @@
module.exports = function(grunt) {
grunt.initConfig({
cssmin: {
dist: {
options: {
report: 'gzip'
},
files: {
"dist/spritesheets.css": [
"css/Mounts.css",
"css/PetEggs.css",
"css/player_sprites.css",
"css/male_sprites.css",
"css/female_sprites.css",
"css/shop_sprites.css",
"css/pet_sprites.css",
"css/achievements.css",
"css/backer.css",
"css/customizer.css"
]
}
}
},
browserify: {
dist: {
src: ["script/index.js"],
dest: "dist/habitrpg-shared.js"
},
options: {
transform: ['coffeeify']
//debug: true Huge data uri source map (400kb!)
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-browserify');
// Default task(s).
grunt.registerTask('default', ['cssmin', 'browserify']);
};

View file

@ -1,3 +0,0 @@
compile:
./node_modules/browserify/bin/cmd.js -t coffeeify ./script/index.js > browser/browser.js
./node_modules/browserify/bin/cmd.js -t coffeeify --debug ./script/index.js > browser/browser.debug.js

View file

@ -1,30 +1,30 @@
Shared resources useful for the multiple HabitRPG repositories, that way all the repositories remain in-sync with common charactaristics. Includes things like:
Shared resources useful for the multiple HabitRPG repositories, that way all the repositories remain in-sync with common characteristics. Includes things like:
* Assets - sprites, images, etc
* CSS - especially, esp. sprite-sheet mapping
* Algorithms - level up algorithm, scoring functions, etc
* View helper functions that may come in handy for multiple client MVCs
* Item definitions - weapons, armor, pets
##Installation
`npm install`
`make`
* `npm install`
* `grunt` - after you've made modifications and want to compile the dist files for browser
* Node.js
* `require ('coffee-script')`
* `var shared = require('./index.js')` or `require('./script/algos.coffee')` if you only need one file.
* `require('./script/algos.coffee')`, `require('./script/helpers.coffee')`, etc.
* Browser
* Use `<script/>` tag to include ./browser/browser.js it will export `window.habitrpgShared` object.
* Use `browser.debug.js' if you want to have sourcemaps.
* Use `<script/>` tag to include ./dist/habitrpg-shared.js it will export `window.habitrpgShared` object.
* // Use `browser.debug.js' if you want to have sourcemaps. - EDIT: Only one file now, and it has sourcemaps. Fix this
* Note how to invoke scoring function:
* algos.score = function (user, task, direction) {}
* `algos.score(user, task, direction)`, etc
* TODO document all the functions
##CSS
Shared CSS between the website and the mobile app is a fuzzy area. For now we'll have the website define canonical CSS, and share that down the mobile app.
Shared CSS between the website and the mobile app is a fuzzy area. Spritesheets definitely go in habitrpg-shared (since mobile
uses them too). Other things, like customizer buttons, *may* want to go here? As you find sharable components, (1) move them
from the website into habitrpg-shared, (2) remove from website & make sure all html/css references are updated.
To do so,
* go to the website repo
* remove the first line `@import nib/vendor` from index.styl
* `stylus styles/app/index.styl`
* copy the output index.css into this shared/css directory
* remove bootstrap @improrts, find/replace "img/" with "../img/"
Currently, all or most spritesheets are available. They're in css/*.css, but that's not what you want. You want `/spritesheets.css`
which is the concat'd file (using `grunt`) which includes all the spritesheets. I'd prefer this be in /dist/spritesheets.css
for consistency, but it's having image referencing weirdness

File diff suppressed because one or more lines are too long

View file

@ -1,4 +1,4 @@
.Mount_Head_Lion, .Mount_Body_Lion, .Mount_Head_PolarBear, .Mount_Body_PolarBear, .Mount_Head_Panda, .Mount_Body_Panda, .Mount_Head_Tiger, .Mount_Body_Tiger, .Mount_Head_Bear, .Mount_Body_Bear, .Mount_Head_EtherealLion, .Mount_Body_EtherealLion {background: url(Mount-SpriteSheet.png) no-repeat}
.Mount_Head_Lion, .Mount_Body_Lion, .Mount_Head_PolarBear, .Mount_Body_PolarBear, .Mount_Head_Panda, .Mount_Body_Panda, .Mount_Head_Tiger, .Mount_Body_Tiger, .Mount_Head_Bear, .Mount_Body_Bear, .Mount_Head_EtherealLion, .Mount_Body_EtherealLion {background: url('../img/sprites/Mount-SpriteSheet.png') no-repeat; }
.Mount_Head_Lion {background-position: 0 0; width: 105px; height: 123px}
.Mount_Body_Lion {background-position: -105 0; width: 105px; height: 123px}
.Mount_Head_PolarBear {background-position: -210 0; width: 105px; height: 123px}

View file

@ -1,4 +1,4 @@
.Pet_Egg_Wolf, .Pet_Egg_TigerCub, .Pet_Egg_PolarBear, .Pet_Egg_PandaCub, .Pet_Egg_LionCub, .Pet_Egg_Fox, .Pet_Egg_FlyingPig, .Pet_Egg_Dragon, .Pet_Egg_Cactus, .Pet_Egg_BearCub, .Pet_HatchingPotion_Base, .Pet_HatchingPotion_White, .Pet_HatchingPotion_Desert, .Pet_HatchingPotion_Red, .Pet_HatchingPotion_Shade, .Pet_HatchingPotion_Skeleton, .Pet_HatchingPotion_Zombie, .Pet_HatchingPotion_CottonCandyPink, .Pet_HatchingPotion_CottonCandyBlue, .Pet_HatchingPotion_Golden, .Pet_Currency_Gem, .Pet_Currency_Gem2x, .Pet_Currency_Gem1x {background: url("/img/sprites/Egg_Sprite_Sheet.png") no-repeat}
.Pet_Egg_Wolf, .Pet_Egg_TigerCub, .Pet_Egg_PolarBear, .Pet_Egg_PandaCub, .Pet_Egg_LionCub, .Pet_Egg_Fox, .Pet_Egg_FlyingPig, .Pet_Egg_Dragon, .Pet_Egg_Cactus, .Pet_Egg_BearCub, .Pet_HatchingPotion_Base, .Pet_HatchingPotion_White, .Pet_HatchingPotion_Desert, .Pet_HatchingPotion_Red, .Pet_HatchingPotion_Shade, .Pet_HatchingPotion_Skeleton, .Pet_HatchingPotion_Zombie, .Pet_HatchingPotion_CottonCandyPink, .Pet_HatchingPotion_CottonCandyBlue, .Pet_HatchingPotion_Golden, .Pet_Currency_Gem, .Pet_Currency_Gem2x, .Pet_Currency_Gem1x {background: url("../img/sprites/Egg_Sprite_Sheet.png") no-repeat}
.Pet_Egg_Wolf {background-position: 0px 0px; width: 48px; height: 53px; margin-left: 1.25em;}
.Pet_Egg_TigerCub {background-position: 0px -51px; width: 48px; height: 53px; margin-left: 1.25em;}
.Pet_Egg_PolarBear {background-position: 0px -102px; width: 48px; height: 53px; margin-left: 1.25em;}
@ -24,3 +24,5 @@
.Pet_Currency_Gem {background-position: 0px -510px; width: 51px; height: 45px} /* Not an egg or potion so has a different size */
.Pet_Currency_Gem2x {background-position: -55px -513px; width: 34px; height: 30px}
.Pet_Currency_Gem1x {background-position: -63px -542px; width: 19px; height: 17px}
.inline-gems {display: inline-block;}

View file

@ -1,3 +0,0 @@
When updates are made to the main site's css / styl files, copy them in here & run `stylus index.styl`. The css doesn't map directly, so this is a temporary workflow.
TODO bring in pets, eggs, etc. (they're in /img/sprites/*)

33
css/achievements.css Normal file
View file

@ -0,0 +1,33 @@
.achievements-container {
margin: 20px;
}
.achievement {
background: url('../img/sprites/achievements.png') no-repeat;
width: 24px;
height: 26px;
float:left;
clear:right;
margin-right: 10px;
}
.achievement-sword {background-position:0px 0px}
.achievement-tree {background-position:-24px 0px}
.achievement-rat {background-position:-48px 0px}
.achievement-comment {background-position:-72px 0px}
.achievement-armor {background-position:-96px 0px}
.achievement-cave {background-position:-120px 0px}
.achievement-sun {background-position:-144px 0px}
.achievement-boot {background-position:-168px 0px}
.achievement-coffin {background-position:-192px 0px}
.achievement-alien {background-position:-216px 0px}
.achievement-ninja {background-position:-240px 0px}
.achievement-cactus {background-position:-264px 0px}
.achievement-bow {background-position:-288px 0px}
.achievement-heart {background-position:-312px 0px}
.achievement-shield {background-position:-336px 0px}
.achievement-thermometer {background-position:-360px 0px}
.achievement-helm {background-position:-384px 0px}
.achievement-firefox {background-position:0px -26px}
.achievement-cake {background-position:-24px -26px}
.achievement-karaoke {background-position:-48px -26px}

2
css/archive/README.md Normal file
View file

@ -0,0 +1,2 @@
These are files which I'm not sure if we need. Either we replaced them with something, or they're in conflict with
other spritesheets, etc. Delete them individually when we're sure in fact we don't need them.

View file

@ -1,4 +1,4 @@
weapon_6, weapon_5, weapon_4, weapon_3, weapon_2, weapon_1, weapon_0, shield_5, shield_4, shield_3, shield_2, shield_1, head_5_v2, head_5_v1, head_4_v2, head_4_v1, head_3_v2, head_3_v1, head_2_v2, head_2_v1, head_1, head_0, hair_white, hair_brown, hair_black, hair_blond, armor_5, armor_4, armor_3, armor_2, armor_1, armor_0_v2, armor_0_v1, skin_dead, skin_orc, skin_asian, skin_black, skin_white {background: url(female_sprites.png) no-repeat}
weapon_6, weapon_5, weapon_4, weapon_3, weapon_2, weapon_1, weapon_0, shield_5, shield_4, shield_3, shield_2, shield_1, head_5_v2, head_5_v1, head_4_v2, head_4_v1, head_3_v2, head_3_v1, head_2_v2, head_2_v1, head_1, head_0, hair_white, hair_brown, hair_black, hair_blond, armor_5, armor_4, armor_3, armor_2, armor_1, armor_0_v2, armor_0_v1, skin_dead, skin_orc, skin_asian, skin_black, skin_white { background: url('../../img/sprites/female_sprites.png') no-repeat; }
weapon_6 {background-position: 0 0; width: 90px; height: 90px}
weapon_5 {background-position: -90px 0; width: 90px; height: 90px}
weapon_4 {background-position: -180px 0; width: 90px; height: 90px}

View file

@ -1,4 +1,4 @@
weapon_6, weapon_5, weapon_4, weapon_3, weapon_2, weapon_1, weapon_0, shield_5, shield_4, shield_3, shield_2, shield_1, head_5, head_4, head_3, head_2, head_1, head_0, hair blond, hair black, hair brown, hair white, armor_5, armor_4, armor_3, armor_2, armor_1, armor_0, skin_dead, skin_orc, skin_asian, skin_black, skin_white {background: url(male_sprites.png) no-repeat}
weapon_6, weapon_5, weapon_4, weapon_3, weapon_2, weapon_1, weapon_0, shield_5, shield_4, shield_3, shield_2, shield_1, head_5, head_4, head_3, head_2, head_1, head_0, hair blond, hair black, hair brown, hair white, armor_5, armor_4, armor_3, armor_2, armor_1, armor_0, skin_dead, skin_orc, skin_asian, skin_black, skin_white {background: url('../../img/sprites/male_sprites.png') no-repeat; }
weapon_6 {background-position: 0 0; width: 90px; height: 90px}
weapon_5 {background-position: -90px 0; width: 90px; height: 90px}
weapon_4 {background-position: -180px 0; width: 90px; height: 90px}

View file

@ -1,4 +1,4 @@
weapon_6, weapon_5, weapon_4, weapon_3, weapon_2, weapon_1, shield_5, shield_4, shield_3, shield_2, shield_1, head_5, head_4, head_3, head_2, head_1, armor_5, armor_4, armor_3, armor_2, armor_1, reroll, potion, copper, silver, gold {background: url(shop_sprites.css) no-repeat}
weapon_6, weapon_5, weapon_4, weapon_3, weapon_2, weapon_1, shield_5, shield_4, shield_3, shield_2, shield_1, head_5, head_4, head_3, head_2, head_1, armor_5, armor_4, armor_3, armor_2, armor_1, reroll, potion, copper, silver, gold {background: url("../img/sprites/shope_sprites.png") no-repeat}
weapon_6 {background-position: 0 0; width: 40px; height: 40px}
weapon_5 {background-position: -40px 0; width: 40px; height: 40px}
weapon_4 {background-position: -80px 0; width: 40px; height: 40px}

View file

@ -1,4 +1,4 @@
item-goldensword, item-redsword, item-bluesword, item-morningstar, item-axe, item-sword2, item-sword1, f_shield_5, f_shield_4, f_shield_3, f_shield_2, f_shield_1, m_shield_5, m_shield_4, m_shield_3, m_shield_2, m_shield_1, m_head_5, m_head_4, m_head_3, m_head_2, m_head_1, m_head_0, f_head_5_v2, f_head_5_v1, f_head_4_v2, f_head_4_v1, f_head_3_v2, f_head_3_v1, f_head_2_v2, f_head_2_v1, f_head_1, f_head_0, f_hair_white, f_hair_brown, f_hair_black, f_hair_blond, m_hair blond, m_hair black, m_hair brown, m_hair white, f_armor_5, f_armor_4, f_armor_3, f_armor_2, f_armor_1, f_armor_0_v2, f_armor_0_v1, m_armor_5, m_armor_4, m_armor_3, m_armor_2, m_armor_1, m_armor_0, f_skin_dead, f_skin_orc, f_skin_asian, f_skin_black, f_skin_white, m_skin_dead, m_skin_orc, m_skin_asian, m_skin_black, m_skin_white {background: url(css_sprite.png) no-repeat}
item-goldensword, item-redsword, item-bluesword, item-morningstar, item-axe, item-sword2, item-sword1, f_shield_5, f_shield_4, f_shield_3, f_shield_2, f_shield_1, m_shield_5, m_shield_4, m_shield_3, m_shield_2, m_shield_1, m_head_5, m_head_4, m_head_3, m_head_2, m_head_1, m_head_0, f_head_5_v2, f_head_5_v1, f_head_4_v2, f_head_4_v1, f_head_3_v2, f_head_3_v1, f_head_2_v2, f_head_2_v1, f_head_1, f_head_0, f_hair_white, f_hair_brown, f_hair_black, f_hair_blond, m_hair blond, m_hair black, m_hair brown, m_hair white, f_armor_5, f_armor_4, f_armor_3, f_armor_2, f_armor_1, f_armor_0_v2, f_armor_0_v1, m_armor_5, m_armor_4, m_armor_3, m_armor_2, m_armor_1, m_armor_0, f_skin_dead, f_skin_orc, f_skin_asian, f_skin_black, f_skin_white, m_skin_dead, m_skin_orc, m_skin_asian, m_skin_black, m_skin_white {background: url('../../img/sprites/css_sprite.png') no-repeat; }
item-goldensword {background-position: 0 0; width: 90px; height: 90px}
item-redsword {background-position: -90px 0; width: 90px; height: 90px}
item-bluesword {background-position: -180px 0; width: 90px; height: 90px}

View file

@ -1,60 +0,0 @@
/* herobox & avatar
======================
* this is the canonical `herobox` avatar component
* it can be placed anywhere on the site and look the
* way it's supposed to. TODO: add variables for show/
* or hiding user metadata in different situations
Seeing as the sprites might change drastically in the
future re: pets and whatnot, this is just temporary.
---------------------------------------------------- */
// basic herobox styles
.herobox
position: relative
// the hero's info frame
.herobox:after
content: attr(data-name) //" " "lvl " attr(data-level) // " " attr(data-class)
position: absolute
top: 0
display: block
width: 100%
line-height: 2
color: black
text-align: center
border-bottom: 1px solid rgba(0,0,0,0.1)
transition: opacity 0.2s ease-out
.character-sprites span
position: absolute
#profileStable
.active
border 1px solid black
// vertically center avatar sprite
// depending on if they have a pet
.herobox[data-checkpet="hasPet"]
padding-top: 2em
.herobox:not([data-checkpet="hasPet"])
padding-top: 1.75em
// if it is the user's avatar, check if
// they have a pet and pad accordingly
.herobox[data-checkpet="hasPet"][data-checkuser="isUser"]
padding-top: 3.25em
// if not user's avatar, remove lines for party unity
.herobox:not([data-checkuser="isUser"])
outline: 0
// positioning the sprites, etc
.herobox
.character-sprites
width: 6.428571429em // 90px
height: 6.428571429em
margin: 0 auto
.character-sprites span, .pet
position: absolute

37
css/backer.css Normal file
View file

@ -0,0 +1,37 @@
.weapon_7, .armor_6, .head_6, .shield_6 {
/*background: url("../img/sprites/backer-only/BackerOnly-SpriteSheet.png") no-repeat*/
width: 105px;
height: 105px;
/*FIXME - not he best way of handling the alignment issues*/
margin-left: -3px;
margin-top: -18px;
}
.head_6 {
background: url("../img/sprites/backer-only/BackerOnly-Equip-ShadeHelmet.gif") no-repeat;
}
.armor_6 {
background: url("../img/sprites/backer-only/BackerOnly-Equip-ShadeArmor.gif") no-repeat;
}
.shield_6 {
background: url("../img/sprites/backer-only/BackerOnly-Shield-TormentedSkull.gif") no-repeat;
}
.weapon_7 {
background: url("../img/sprites/backer-only/BackerOnly-Weapon-DarkSoulsBlade.gif") no-repeat;
}
.Pet-Wolf-Cerberus {
width: 105px;
height: 72px;
background: url("../img/sprites/backer-only/BackerOnly-Pet-CerberusPup.gif") no-repeat;
}
.shop_shield_6 {background-position: -1040px 0}
.shop_weapon_7 {background-position: -1080px 0}
.shop_armor_6 {background-position: -1160px 0}
.shop_head_6 {background-position: -1120px 0}

74
css/customizer.css Normal file
View file

@ -0,0 +1,74 @@
/* Female */
.customize-menu .f_head_0 {width: 60px; height: 60px; background-position: -1917px -9px;}
.customize-menu .f_armor_0_v2 {width: 60px; height: 60px; background-position: -2819px -38px;}
.customize-menu .f_armor_0_v1 {width: 60px; height: 60px; background-position: -2909px -38px;}
.customize-menu .f_hair_white {width: 60px; height: 60px; background-position: -2009px -8px;}
.customize-menu .f_hair_brown {width: 60px; height: 60px; background-position: -2099px -8px;}
.customize-menu .f_hair_black {width: 60px; height: 60px; background-position: -2189px -8px;}
.customize-menu .f_hair_blond {width: 60px; height: 60px; background-position: -2279px -8px;}
.customize-menu .f_hair_red {width: 60px; height: 60px; background-position: -4979px -8px;}
.customize-menu .f_skin_dead {width: 60px; height: 60px; background-position: -2997px -20px;}
.customize-menu .f_skin_orc {width: 60px; height: 60px; background-position: -3087px -20px;}
.customize-menu .f_skin_asian {width: 60px; height: 60px; background-position: -3177px -20px;}
.customize-menu .f_skin_black {width: 60px; height: 60px; background-position: -3267px -20px;}
.customize-menu .f_skin_white {width: 60px; height: 60px; background-position: -3357px -20px;}
.customize-menu .f_skin_ea8349 {width: 60px; height: 60px; background-position: -3448px -21px;}
.customize-menu .f_skin_c06534 {width: 60px; height: 60px; background-position: -3539px -21px;}
.customize-menu .f_skin_98461a {width: 60px; height: 60px; background-position: -3629px -21px;}
.customize-menu .f_skin_eb052b {width: 60px; height: 60px; background-position: -3719px -20px;}
.customize-menu .f_skin_f69922 {width: 60px; height: 60px; background-position: -3809px -20px;}
.customize-menu .f_skin_f5d70f {width: 60px; height: 60px; background-position: -3899px -20px;}
.customize-menu .f_skin_0ff591 {width: 60px; height: 60px; background-position: -3989px -20px;}
.customize-menu .f_skin_2b43f6 {width: 60px; height: 60px; background-position: -4079px -20px;}
.customize-menu .f_skin_d7a9f7 {width: 60px; height: 60px; background-position: -4169px -21px;}
.customize-menu .f_skin_800ed0 {width: 60px; height: 60px; background-position: -4259px -21px;}
.customize-menu .f_skin_rainbow {width: 60px; height: 60px; background-position: -4349px -21px;}
.customize-menu .f_skin_monster {width: 60px; height: 60px; background-position: -4439px -20px;}
.customize-menu .f_skin_pumpkin {width: 60px; height: 60px; background-position: -4529px -20px;}
.customize-menu .f_skin_skeleton {width: 60px; height: 60px; background-position: -4619px -20px;}
.customize-menu .f_skin_zombie {width: 60px; height: 60px; background-position: -4709px -20px;}
.customize-menu .f_skin_ghost {width: 60px; height: 60px; background-position: -4799px -20px;}
.customize-menu .f_skin_shadow {width: 60px; height: 60px; background-position: -4889px -21px;}
/* Male */
.customize-menu .m_head_0 {width: 60px; height: 60px; background-position: -1557px -9px;}
.customize-menu .m_hair_blond {width: 60px; height: 60px; background-position: -1649px -6px;}
.customize-menu .m_hair_black {width: 60px; height: 60px; background-position: -1737px -6px;}
.customize-menu .m_hair_brown {width: 60px; height: 60px; background-position: -1827px -6px;}
.customize-menu .m_hair_white {width: 60px; height: 60px; background-position: -1917px -6px;}
.customize-menu .m_hair_red {width: 60px; height: 60px; background-position: -4528px -6px;}
.customize-menu .m_skin_dead {width: 60px; height: 60px; background-position: -2547px -20px;}
.customize-menu .m_skin_orc {width: 60px; height: 60px; background-position: -2637px -20px;}
.customize-menu .m_skin_asian {width: 60px; height: 60px; background-position: -2727px -20px;}
.customize-menu .m_skin_black {width: 60px; height: 60px; background-position: -2817px -20px;}
.customize-menu .m_skin_white {width: 60px; height: 60px; background-position: -2907px -20px;}
.customize-menu .m_skin_ea8349 {width: 60px; height: 60px; background-position: -2999px -20px;}
.customize-menu .m_skin_c06534 {width: 60px; height: 60px; background-position: -3087px -20px;}
.customize-menu .m_skin_98461a {width: 60px; height: 60px; background-position: -3178px -20px;}
.customize-menu .m_skin_eb052b {width: 60px; height: 60px; background-position: -3268px -20px;}
.customize-menu .m_skin_f69922 {width: 60px; height: 60px; background-position: -3358px -20px;}
.customize-menu .m_skin_f5d70f {width: 60px; height: 60px; background-position: -3448px -20px;}
.customize-menu .m_skin_0ff591 {width: 60px; height: 60px; background-position: -3538px -20px;}
.customize-menu .m_skin_2b43f6 {width: 60px; height: 60px; background-position: -3628px -20px;}
.customize-menu .m_skin_d7a9f7 {width: 60px; height: 60px; background-position: -3718px -20px;}
.customize-menu .m_skin_800ed0 {width: 60px; height: 60px; background-position: -3808px -20px;}
.customize-menu .m_skin_rainbow {width: 60px; height: 60px; background-position: -3898px -20px;}
.customize-menu .m_skin_monster {width: 60px; height: 60px; background-position: -3988px -20px;}
.customize-menu .m_skin_pumpkin {width: 60px; height: 60px; background-position: -4078px -20px;}
.customize-menu .m_skin_skeleton {width: 60px; height: 60px; background-position: -4168px -20px;}
.customize-menu .m_skin_zombie {width: 60px; height: 60px; background-position: -4258px -20px;}
.customize-menu .m_skin_ghost {width: 60px; height: 60px; background-position: -4348px -20px;}
.customize-menu .m_skin_shadow {width: 60px; height: 60px; background-position: -4438px -20px;}
/* Both */
.customize-menu .locked {
background-color: #727272;
}

View file

@ -35,8 +35,29 @@
.f_skin_orc,
.f_skin_asian,
.f_skin_black,
.f_skin_white
background: url("../img/sprites/female_sprites.png") no-repeat
.f_skin_white,
.f_skin_ea8349,
.f_skin_c06534,
.f_skin_98461a,
.f_skin_eb052b,
.f_skin_eb052b,
.f_skin_f69922,
.f_skin_f5d70f,
.f_skin_0ff591,
.f_skin_2b43f6,
.f_skin_d7a9f7,
.f_skin_800ed0,
.f_skin_rainbow,
.f_skin_monster,
.f_skin_pumpkin,
.f_skin_skeleton,
.f_skin_zombie,
.f_skin_ghost,
.f_skin_shadow,
.f_hair_red
{
background: url("../img/sprites/female_sprites.png") no-repeat;
}
.f_weapon_6 {background-position: 0 0; width: 90px; height: 90px}
.f_weapon_5 {background-position: -90px 0; width: 90px; height: 90px}
@ -71,49 +92,34 @@
.f_armor_1 {background-position: -2700px 0; width: 90px; height: 90px}
.f_armor_0_v2 {background-position: -2790px 0; width: 90px; height: 90px}
.f_armor_0_v1 {background-position: -2880px 0; width: 90px; height: 90px}
/* Basic Skin */
.f_skin_dead {background-position: -2970px 0; width: 90px; height: 90px}
.f_skin_orc {background-position: -3060px 0; width: 90px; height: 90px}
.f_skin_asian {background-position: -3150px 0; width: 90px; height: 90px}
.f_skin_black {background-position: -3240px 0; width: 90px; height: 90px}
.f_skin_white {background-position: -3330px 0; width: 90px; height: 90px}
.f_skin_ea8349 {background-position: -3420px 0; width: 90px; height: 90px}
.f_skin_c06534 {background-position: -3510px 0; width: 90px; height: 90px}
.f_skin_98461a {background-position: -3600px 0; width: 90px; height: 90px}
/* Crazy Skin */
.f_skin_eb052b {background-position: -3690px 0; width: 90px; height: 90px}
.f_skin_f69922 {background-position: -3780px 0; width: 90px; height: 90px}
.f_skin_f5d70f {background-position: -3870px 0; width: 90px; height: 90px}
.f_skin_0ff591 {background-position: -3960px 0; width: 90px; height: 90px}
.f_skin_2b43f6 {background-position: -4050px 0; width: 90px; height: 90px}
.f_skin_d7a9f7 {background-position: -4140px 0; width: 90px; height: 90px}
.f_skin_800ed0 {background-position: -4230px 0; width: 90px; height: 90px}
.f_skin_rainbow {background-position: -4320px 0; width: 90px; height: 90px}
/* Halloween Skin */
.f_skin_monster {background-position: -4410px 0; width: 90px; height: 90px}
.f_skin_pumpkin {background-position: -4500px 0; width: 90px; height: 90px}
.f_skin_skeleton {background-position: -4590px 0; width: 90px; height: 90px}
.f_skin_zombie {background-position: -4680px 0; width: 90px; height: 90px}
.f_skin_ghost {background-position: -4770px 0; width: 90px; height: 90px}
.f_skin_shadow {background-position: -4860px 0; width: 90px; height: 90px}
// narrower spriting for customize modal
.customize-menu
// shared option-box styles
[class^="f_hair"], [class^="f_skin"], [class^="f_armor"], .f_head_0
width: 60px;
height: 60px;
// head
.f_head_0
background-position: -1917px -9px;
// hair
.f_hair_white
background-position: -2009px -8px;
.f_hair_brown
background-position: -2099px -8px;
.f_hair_black
background-position: -2189px -8px;
.f_hair_blond
background-position: -2279px -8px;
// skin
.f_skin_dead
background-position: -2997px -20px;
.f_skin_orc
background-position: -3087px -20px;
.f_skin_asian
background-position: -3177px -20px;
.f_skin_black
background-position: -3267px -20px;
.f_skin_white
background-position: -3357px -20px;
// starting armor
.f_armor_0_v2
background-position: -2819px -38px;
.f_armor_0_v1
background-position: -2909px -38px;
/* Red Hair */
.f_hair_red {background-position: -4950px 0; width: 90px; height: 90px}

View file

@ -1,551 +0,0 @@
.herobox {
position: relative;
}
.herobox:after {
content: attr(data-name);
position: absolute;
top: 0;
display: block;
width: 100%;
line-height: 2;
color: #000;
text-align: center;
border-bottom: 1px solid rgba(0,0,0,0.1);
transition: opacity 0.2s ease-out;
}
.character-sprites span,
position: absolute,
#profileStable,
.active,
border 1pxsolid black,
,
.herobox[data-checkpet="hasPet"] {
padding-top: 2em;
}
.herobox:not([data-checkpet="hasPet"]) {
padding-top: 1.75em;
}
.herobox[data-checkpet="hasPet"][data-checkuser="isUser"] {
padding-top: 3.25em;
}
.herobox:not([data-checkuser="isUser"]) {
outline: 0;
}
.herobox .character-sprites {
width: 6.428571429em;
height: 6.428571429em;
margin: 0 auto;
}
.herobox .character-sprites span,
.herobox .pet {
position: absolute;
}
.f_weapon_6,
.f_weapon_5,
.f_weapon_4,
.f_weapon_3,
.f_weapon_2,
.f_weapon_1,
.f_weapon_0,
.f_shield_5,
.f_shield_4,
.f_shield_3,
.f_shield_2,
.f_shield_1,
.f_head_5_v2,
.f_head_5_v1,
.f_head_4_v2,
.f_head_4_v1,
.f_head_3_v2,
.f_head_3_v1,
.f_head_2_v2,
.f_head_2_v1,
.f_head_1,
.f_head_0,
.f_hair_white,
.f_hair_brown,
.f_hair_black,
.f_hair_blond,
.f_armor_5,
.f_armor_4,
.f_armor_3,
.f_armor_2,
.f_armor_1,
.f_armor_0_v2,
.f_armor_0_v1,
.f_skin_dead,
.f_skin_orc,
.f_skin_asian,
.f_skin_black,
.f_skin_white {
background: url("../img/sprites/female_sprites.png") no-repeat;
}
.f_weapon_6 {
background-position: 0 0;
width: 90px;
height: 90px;
}
.f_weapon_5 {
background-position: -90px 0;
width: 90px;
height: 90px;
}
.f_weapon_4 {
background-position: -180px 0;
width: 90px;
height: 90px;
}
.f_weapon_3 {
background-position: -270px 0;
width: 90px;
height: 90px;
}
.f_weapon_2 {
background-position: -360px 0;
width: 90px;
height: 90px;
}
.f_weapon_1 {
background-position: -450px 0;
width: 90px;
height: 90px;
}
.f_weapon_0 {
background-position: -540px 0;
width: 90px;
height: 90px;
}
.f_shield_5 {
background-position: -630px 0;
width: 90px;
height: 90px;
}
.f_shield_4 {
background-position: -720px 0;
width: 90px;
height: 90px;
}
.f_shield_3 {
background-position: -810px 0;
width: 90px;
height: 90px;
}
.f_shield_2 {
background-position: -900px 0;
width: 90px;
height: 90px;
}
.f_shield_1 {
background-position: -990px 0;
width: 90px;
height: 90px;
}
.f_head_5_v2 {
background-position: -1080px 0;
width: 90px;
height: 90px;
}
.f_head_5_v1 {
background-position: -1170px 0;
width: 90px;
height: 90px;
}
.f_head_4_v2 {
background-position: -1260px 0;
width: 90px;
height: 90px;
}
.f_head_4_v1 {
background-position: -1350px 0;
width: 90px;
height: 90px;
}
.f_head_3_v2 {
background-position: -1440px 0;
width: 90px;
height: 90px;
}
.f_head_3_v1 {
background-position: -1530px 0;
width: 90px;
height: 90px;
}
.f_head_2_v2 {
background-position: -1620px 0;
width: 90px;
height: 90px;
}
.f_head_2_v1 {
background-position: -1710px 0;
width: 90px;
height: 90px;
}
.f_head_1 {
background-position: -1800px 0;
width: 90px;
height: 90px;
}
.f_head_0 {
background-position: -1890px 0;
width: 90px;
height: 90px;
}
.f_hair_white {
background-position: -1980px 0;
width: 90px;
height: 90px;
}
.f_hair_brown {
background-position: -2070px 0;
width: 90px;
height: 90px;
}
.f_hair_black {
background-position: -2160px 0;
width: 90px;
height: 90px;
}
.f_hair_blond {
background-position: -2250px 0;
width: 90px;
height: 90px;
}
.f_armor_5 {
background-position: -2340px 0;
width: 90px;
height: 90px;
}
.f_armor_4 {
background-position: -2430px 0;
width: 90px;
height: 90px;
}
.f_armor_3 {
background-position: -2520px 0;
width: 90px;
height: 90px;
}
.f_armor_2 {
background-position: -2610px 0;
width: 90px;
height: 90px;
}
.f_armor_1 {
background-position: -2700px 0;
width: 90px;
height: 90px;
}
.f_armor_0_v2 {
background-position: -2790px 0;
width: 90px;
height: 90px;
}
.f_armor_0_v1 {
background-position: -2880px 0;
width: 90px;
height: 90px;
}
.f_skin_dead {
background-position: -2970px 0;
width: 90px;
height: 90px;
}
.f_skin_orc {
background-position: -3060px 0;
width: 90px;
height: 90px;
}
.f_skin_asian {
background-position: -3150px 0;
width: 90px;
height: 90px;
}
.f_skin_black {
background-position: -3240px 0;
width: 90px;
height: 90px;
}
.f_skin_white {
background-position: -3330px 0;
width: 90px;
height: 90px;
}
.customize-menu [class^="f_hair"],
.customize-menu [class^="f_skin"],
.customize-menu [class^="f_armor"],
.customize-menu .f_head_0 {
width: 60px;
height: 60px;
}
.customize-menu .f_head_0 {
background-position: -1917px -9px;
}
.customize-menu .f_hair_white {
background-position: -2009px -8px;
}
.customize-menu .f_hair_brown {
background-position: -2099px -8px;
}
.customize-menu .f_hair_black {
background-position: -2189px -8px;
}
.customize-menu .f_hair_blond {
background-position: -2279px -8px;
}
.customize-menu .f_skin_dead {
background-position: -2997px -20px;
}
.customize-menu .f_skin_orc {
background-position: -3087px -20px;
}
.customize-menu .f_skin_asian {
background-position: -3177px -20px;
}
.customize-menu .f_skin_black {
background-position: -3267px -20px;
}
.customize-menu .f_skin_white {
background-position: -3357px -20px;
}
.customize-menu .f_armor_0_v2 {
background-position: -2819px -38px;
}
.customize-menu .f_armor_0_v1 {
background-position: -2909px -38px;
}
.m_weapon_6,
.m_weapon_5,
.m_weapon_4,
.m_weapon_3,
.m_weapon_2,
.m_weapon_1,
.m_weapon_0,
.m_shield_5,
.m_shield_4,
.m_shield_3,
.m_shield_2,
.m_shield_1,
.m_head_5,
.m_head_4,
.m_head_3,
.m_head_2,
.m_head_1,
.m_head_0,
.m_hair_blond,
.m_hair_black,
.m_hair_brown,
.m_hair_white,
.m_armor_5,
.m_armor_4,
.m_armor_3,
.m_armor_2,
.m_armor_1,
.m_armor_0,
.m_skin_dead,
.m_skin_orc,
.m_skin_asian,
.m_skin_black,
.m_skin_white {
background: url("../img/sprites/male_sprites.png") no-repeat;
}
.m_weapon_6 {
background-position: 0 0;
width: 90px;
height: 90px;
}
.m_weapon_5 {
background-position: -90px 0;
width: 90px;
height: 90px;
}
.m_weapon_4 {
background-position: -180px 0;
width: 90px;
height: 90px;
}
.m_weapon_3 {
background-position: -270px 0;
width: 90px;
height: 90px;
}
.m_weapon_2 {
background-position: -360px 0;
width: 90px;
height: 90px;
}
.m_weapon_1 {
background-position: -450px 0;
width: 90px;
height: 90px;
}
.m_weapon_0 {
background-position: -540px 0;
width: 90px;
height: 90px;
}
.m_shield_5 {
background-position: -630px 0;
width: 90px;
height: 90px;
}
.m_shield_4 {
background-position: -720px 0;
width: 90px;
height: 90px;
}
.m_shield_3 {
background-position: -810px 0;
width: 90px;
height: 90px;
}
.m_shield_2 {
background-position: -900px 0;
width: 90px;
height: 90px;
}
.m_shield_1 {
background-position: -990px 0;
width: 90px;
height: 90px;
}
.m_head_5 {
background-position: -1080px 0;
width: 90px;
height: 90px;
}
.m_head_4 {
background-position: -1170px 0;
width: 90px;
height: 90px;
}
.m_head_3 {
background-position: -1260px 0;
width: 90px;
height: 90px;
}
.m_head_2 {
background-position: -1350px 0;
width: 90px;
height: 90px;
}
.m_head_1 {
background-position: -1440px 0;
width: 90px;
height: 90px;
}
.m_head_0 {
background-position: -1530px 0;
width: 90px;
height: 90px;
}
.m_hair_blond {
background-position: -1620px 0;
width: 90px;
height: 90px;
}
.m_hair_black {
background-position: -1710px 0;
width: 90px;
height: 90px;
}
.m_hair_brown {
background-position: -1800px 0;
width: 90px;
height: 90px;
}
.m_hair_white {
background-position: -1890px 0;
width: 90px;
height: 90px;
}
.m_armor_5 {
background-position: -1980px 0;
width: 90px;
height: 90px;
}
.m_armor_4 {
background-position: -2070px 0;
width: 90px;
height: 90px;
}
.m_armor_3 {
background-position: -2160px 0;
width: 90px;
height: 90px;
}
.m_armor_2 {
background-position: -2250px 0;
width: 90px;
height: 90px;
}
.m_armor_1 {
background-position: -2340px 0;
width: 90px;
height: 90px;
}
.m_armor_0 {
background-position: -2430px 0;
width: 90px;
height: 90px;
}
.m_skin_dead {
background-position: -2520px 0;
width: 90px;
height: 90px;
}
.m_skin_orc {
background-position: -2610px 0;
width: 90px;
height: 90px;
}
.m_skin_asian {
background-position: -2700px 0;
width: 90px;
height: 90px;
}
.m_skin_black {
background-position: -2790px 0;
width: 90px;
height: 90px;
}
.m_skin_white {
background-position: -2880px 0;
width: 90px;
height: 90px;
}
.customize-menu [class^="m_hair"],
.customize-menu [class^="m_skin"],
.customize-menu .m_head_0 {
width: 60px;
height: 60px;
}
.customize-menu .m_head_0 {
background-position: -1557px -9px;
}
.customize-menu .m_hair_blond {
background-position: -1647px -4px;
}
.customize-menu .m_hair_black {
background-position: -1737px -4px;
}
.customize-menu .m_hair_brown {
background-position: -1827px -4px;
}
.customize-menu .m_hair_white {
background-position: -1917px -4px;
}
.customize-menu .m_skin_dead {
background-position: -2547px -20px;
}
.customize-menu .m_skin_orc {
background-position: -2637px -20px;
}
.customize-menu .m_skin_asian {
background-position: -2727px -20px;
}
.customize-menu .m_skin_black {
background-position: -2817px -20px;
}
.customize-menu .m_skin_white {
background-position: -2907px -20px;
}

View file

@ -1,3 +0,0 @@
@import './avatar.styl';
@import './female_sprites.styl';
@import './male_sprites.styl';

View file

@ -30,8 +30,28 @@
.m_skin_orc,
.m_skin_asian,
.m_skin_black,
.m_skin_white
background: url("../img/sprites/male_sprites.png") no-repeat
.m_skin_white,
.m_skin_ea8349,
.m_skin_c06534,
.m_skin_98461a,
.m_skin_eb052b,
.m_skin_f69922,
.m_skin_f5d70f,
.m_skin_0ff591,
.m_skin_2b43f6,
.m_skin_d7a9f7,
.m_skin_800ed0,
.m_skin_rainbow,
.m_skin_monster,
.m_skin_pumpkin,
.m_skin_skeleton,
.m_skin_zombie,
.m_skin_ghost,
.m_skin_shadow,
.m_hair_red
{
background: url("../img/sprites/male_sprites.png") no-repeat;
}
.m_weapon_6 {background-position: 0 0; width: 90px; height: 90px}
.m_weapon_5 {background-position: -90px 0; width: 90px; height: 90px}
@ -61,43 +81,34 @@
.m_armor_2 {background-position: -2250px 0; width: 90px; height: 90px}
.m_armor_1 {background-position: -2340px 0; width: 90px; height: 90px}
.m_armor_0 {background-position: -2430px 0; width: 90px; height: 90px}
/* Basic Skins */
.m_skin_dead {background-position: -2520px 0; width: 90px; height: 90px}
.m_skin_orc {background-position: -2610px 0; width: 90px; height: 90px}
.m_skin_asian {background-position: -2700px 0; width: 90px; height: 90px}
.m_skin_black {background-position: -2790px 0; width: 90px; height: 90px}
.m_skin_white {background-position: -2880px 0; width: 90px; height: 90px}
.m_skin_ea8349 {background-position: -2970px 0; width: 90px; height: 90px}
.m_skin_c06534 {background-position: -3060px 0; width: 90px; height: 90px}
.m_skin_98461a {background-position: -3150px 0; width: 90px; height: 90px}
/* Crazy Skins */
.m_skin_eb052b {background-position: -3240px 0; width: 90px; height: 90px}
.m_skin_f69922 {background-position: -3330px 0; width: 90px; height: 90px}
.m_skin_f5d70f {background-position: -3420px 0; width: 90px; height: 90px}
.m_skin_0ff591 {background-position: -3510px 0; width: 90px; height: 90px}
.m_skin_2b43f6 {background-position: -3600px 0; width: 90px; height: 90px}
.m_skin_d7a9f7 {background-position: -3690px 0; width: 90px; height: 90px}
.m_skin_800ed0 {background-position: -3780px 0; width: 90px; height: 90px}
.m_skin_rainbow {background-position: -3870px 0; width: 90px; height: 90px}
/* Halloween Skins */
.m_skin_monster {background-position: -3960px 0; width: 90px; height: 90px}
.m_skin_pumpkin {background-position: -4050px 0; width: 90px; height: 90px}
.m_skin_skeleton {background-position: -4140px 0; width: 90px; height: 90px}
.m_skin_zombie {background-position: -4230px 0; width: 90px; height: 90px}
.m_skin_ghost {background-position: -4320px 0; width: 90px; height: 90px}
.m_skin_shadow {background-position: -4410px 0; width: 90px; height: 90px}
// narrower spriting for customize modal
.customize-menu
// shared option-box styles
[class^="m_hair"], [class^="m_skin"], .m_head_0
width: 60px;
height: 60px;
// head
.m_head_0
background-position: -1557px -9px;
// hair
.m_hair_blond
background-position: -1647px -4px;
.m_hair_black
background-position: -1737px -4px;
.m_hair_brown
background-position: -1827px -4px;
.m_hair_white
background-position: -1917px -4px;
// skin
.m_skin_dead
background-position: -2547px -20px;
.m_skin_orc
background-position: -2637px -20px;
.m_skin_asian
background-position: -2727px -20px;
.m_skin_black
background-position: -2817px -20px;
.m_skin_white
background-position: -2907px -20px;
/* Red Hair */
.m_hair_red {background-position: -4500px 0; width: 90px; height: 90px}

View file

@ -1,4 +1,4 @@
.Pet-Wolf-Zombie, .Pet-Wolf-White, .Pet-Wolf-Veteran, .Pet-Wolf-Skeleton, .Pet-Wolf-Shade, .Pet-Wolf-Red, .Pet-Wolf-Golden, .Pet-Wolf-Desert, .Pet-Wolf-CottonCandyPink, .Pet-Wolf-CottonCandyBlue, .Pet-TigerCub-Zombie, .Pet-TigerCub-White, .Pet-TigerCub-Skeleton, .Pet-TigerCub-Shade, .Pet-TigerCub-Red, .Pet-TigerCub-Golden, .Pet-TigerCub-Desert, .Pet-TigerCub-CottonCandyPink, .Pet-TigerCub-CottonCandyBlue, .Pet-TigerCub-Base, .Pet-PolarBearCub-Base, .Pet-PandaCub-Zombie, .Pet-PandaCub-White, .Pet-PandaCub-Skeleton, .Pet-PandaCub-Shade, .Pet-PandaCub-Red, .Pet-PandaCub-Golden, .Pet-PandaCub-Desert, .Pet-PandaCub-CottonCandyPink, .Pet-PandaCub-CottonCandyBlue, .Pet-PandaCub-Base, .Pet-LionCub-Zombie, .Pet-LionCub-White, .Pet-LionCub-Skeleton, .Pet-LionCub-Shade, .Pet-LionCub-Red, .Pet-LionCub-Golden, .Pet-LionCub-Desert, .Pet-LionCub-CottonCandyPink, .Pet-LionCub-CottonCandyBlue, .Pet-LionCub-Base, .Pet-Fox-Zombie, .Pet-Fox-White, .Pet-Fox-Skeleton, .Pet-Fox-Shade, .Pet-Fox-Red, .Pet-Fox-Golden, .Pet-Fox-Desert, .Pet-Fox-CottonCandyPink, .Pet-Fox-CottonCandyBlue, .Pet-Fox-Base, .Pet-FlyingPig-Zombie, .Pet-FlyingPig-White, .Pet-FlyingPig-Skeleton, .Pet-FlyingPig-Shade, .Pet-FlyingPig-Red, .Pet-FlyingPig-Golden, .Pet-FlyingPig-Desert, .Pet-FlyingPig-CottonCandyPink, .Pet-FlyingPig-CottonCandyBlue, .Pet-FlyingPig-Base, .Pet-Dragon-Zombie, .Pet-Dragon-White, .Pet-Dragon-Skeleton, .Pet-Dragon-Shade, .Pet-Dragon-Red, .Pet-Dragon-Golden, .Pet-Dragon-Desert, .Pet-Dragon-CottonCandyPink, .Pet-Dragon-CottonCandyBlue, .Pet-Dragon-Base, .Pet-Cactus-Skeleton, .Pet-Cactus-Red, .Pet-Cactus-Zombie, .Pet-Cactus-Shade, .Pet-Cactus-Golden, .Pet-Cactus-White, .Pet-Cactus-CottonCandyPink, .Pet-Cactus-CottonCandyBlue, .Pet-Cactus-Desert, .Pet-Cactus-Base, .Pet-BearCub-Zombie, .Pet-BearCub-White, .Pet-BearCub-Skeleton, .Pet-BearCub-Shade, .Pet-BearCub-Red, .Pet-BearCub-Golden, .Pet-BearCub-Desert, .Pet-BearCub-CottonCandyPink, .Pet-BearCub-CottonCandyBlue, .Pet-BearCub-Base, .Pet-Wolf-Base {background: url("/img/sprites/pet_sprites.png") no-repeat}
.Pet-Wolf-Zombie, .Pet-Wolf-White, .Pet-Wolf-Veteran, .Pet-Wolf-Skeleton, .Pet-Wolf-Shade, .Pet-Wolf-Red, .Pet-Wolf-Golden, .Pet-Wolf-Desert, .Pet-Wolf-CottonCandyPink, .Pet-Wolf-CottonCandyBlue, .Pet-TigerCub-Zombie, .Pet-TigerCub-White, .Pet-TigerCub-Skeleton, .Pet-TigerCub-Shade, .Pet-TigerCub-Red, .Pet-TigerCub-Golden, .Pet-TigerCub-Desert, .Pet-TigerCub-CottonCandyPink, .Pet-TigerCub-CottonCandyBlue, .Pet-TigerCub-Base, .Pet-PolarBearCub-Base, .Pet-PandaCub-Zombie, .Pet-PandaCub-White, .Pet-PandaCub-Skeleton, .Pet-PandaCub-Shade, .Pet-PandaCub-Red, .Pet-PandaCub-Golden, .Pet-PandaCub-Desert, .Pet-PandaCub-CottonCandyPink, .Pet-PandaCub-CottonCandyBlue, .Pet-PandaCub-Base, .Pet-LionCub-Zombie, .Pet-LionCub-White, .Pet-LionCub-Skeleton, .Pet-LionCub-Shade, .Pet-LionCub-Red, .Pet-LionCub-Golden, .Pet-LionCub-Desert, .Pet-LionCub-CottonCandyPink, .Pet-LionCub-CottonCandyBlue, .Pet-LionCub-Base, .Pet-Fox-Zombie, .Pet-Fox-White, .Pet-Fox-Skeleton, .Pet-Fox-Shade, .Pet-Fox-Red, .Pet-Fox-Golden, .Pet-Fox-Desert, .Pet-Fox-CottonCandyPink, .Pet-Fox-CottonCandyBlue, .Pet-Fox-Base, .Pet-FlyingPig-Zombie, .Pet-FlyingPig-White, .Pet-FlyingPig-Skeleton, .Pet-FlyingPig-Shade, .Pet-FlyingPig-Red, .Pet-FlyingPig-Golden, .Pet-FlyingPig-Desert, .Pet-FlyingPig-CottonCandyPink, .Pet-FlyingPig-CottonCandyBlue, .Pet-FlyingPig-Base, .Pet-Dragon-Zombie, .Pet-Dragon-White, .Pet-Dragon-Skeleton, .Pet-Dragon-Shade, .Pet-Dragon-Red, .Pet-Dragon-Golden, .Pet-Dragon-Desert, .Pet-Dragon-CottonCandyPink, .Pet-Dragon-CottonCandyBlue, .Pet-Dragon-Base, .Pet-Cactus-Skeleton, .Pet-Cactus-Red, .Pet-Cactus-Zombie, .Pet-Cactus-Shade, .Pet-Cactus-Golden, .Pet-Cactus-White, .Pet-Cactus-CottonCandyPink, .Pet-Cactus-CottonCandyBlue, .Pet-Cactus-Desert, .Pet-Cactus-Base, .Pet-BearCub-Zombie, .Pet-BearCub-White, .Pet-BearCub-Skeleton, .Pet-BearCub-Shade, .Pet-BearCub-Red, .Pet-BearCub-Golden, .Pet-BearCub-Desert, .Pet-BearCub-CottonCandyPink, .Pet-BearCub-CottonCandyBlue, .Pet-BearCub-Base, .Pet-Wolf-Base {background: url("../img/sprites/pet_sprites.png") no-repeat}
.Pet-Wolf-Zombie {background-position: 0 0; width: 81px; height: 99px}
.Pet-Wolf-White {background-position: -81px 0; width: 81px; height: 99px}
@ -92,5 +92,5 @@
.Pet-BearCub-CottonCandyBlue {background-position: -7209px 0; width: 81px; height: 99px}
.Pet-BearCub-Base {background-position: -7290px 0; width: 81px; height: 99px}
.Pet-Wolf-Base {background-position: -7371px 0; width: 81px; height: 99px}
.Pet-Egg {background: url("/img/sprites/egg.png") no-repeat; width: 39px; height: 42px;}
.Gems{background: url("/img/sprites/Egg_Sprite_Sheet.png"); background-position: -57px 50px; display:inline-block; margin-right:5px;border-style:none; width: 30px; height: 30px}
.Pet-Egg {background: url("../img/sprites/egg.png") no-repeat; width: 39px; height: 42px;}
.Gems{background: url("../img/sprites/Egg_Sprite_Sheet.png"); background-position: -57px 50px; display:inline-block; margin-right:5px;border-style:none; width: 30px; height: 30px}

View file

@ -1,4 +1,4 @@
.weapon_6, .weapon_5, .weapon_4, .weapon_3, .weapon_2, .weapon_1, .weapon_0, .skin_white, .skin_pale, .skin_orc, .skin_dead, .skin_black, .skin_asian, .shield_5_v1, .shield_5_v0, .shield_4_v0, .shield_3_v1, .shield_3_v0, .shield_2_v1, .shield_2_v0, .shield_1_v1, .shield_1_v0, _shield_4_v1, .nh_hair_white_v1, .nh_hair_white_v0, .nh_hair_brown_v1, .nh_hair_brown_v0, .nh_hair_blond_v1, .nh_hair_blond_v0, .nh_hair_black_v1, .nh_hair_black_v0, .head_5_v2, .head_5_v1, .head_5_v0, .head_4_v2, .head_4_v1, .head_4_v0, .head_3_v2, .head_3_v1, .head_3_v0, .head_2_v2, .head_2_v1, .head_2_v0, .head_1_v1, .head_1_v0, .head_0_v1, .head_0_v0, .hair_white_v1, .hair_white_v0, .hair_brown_v1, .hair_brown_v0, .hair_blond_v1, .hair_blond_v0, .hair_black_v1, .hair_black_v0, .armor_5_v1, .armor_5_v0, .armor_4_v1, .armor_4_v0, .armor_3_v1, .armor_3_v0, .armor_2_v0, .armor_1_v1, .armor_1_v0, .armor_0_v11, .armor_0_v10, .armor_0_v9, .armor_0_v8, .armor_0_v7, .armor_0_v6, .armor_0_v5, .armor_0_v4, .armor_0_v3, .armor_0_v2, .armor_0_v1, .armor_0_v0 {background: url(player_sprites.png) no-repeat}
.weapon_6, .weapon_5, .weapon_4, .weapon_3, .weapon_2, .weapon_1, .weapon_0, .skin_white, .skin_pale, .skin_orc, .skin_dead, .skin_black, .skin_asian, .shield_5_v1, .shield_5_v0, .shield_4_v0, .shield_3_v1, .shield_3_v0, .shield_2_v1, .shield_2_v0, .shield_1_v1, .shield_1_v0, _shield_4_v1, .nh_hair_white_v1, .nh_hair_white_v0, .nh_hair_brown_v1, .nh_hair_brown_v0, .nh_hair_blond_v1, .nh_hair_blond_v0, .nh_hair_black_v1, .nh_hair_black_v0, .head_5_v2, .head_5_v1, .head_5_v0, .head_4_v2, .head_4_v1, .head_4_v0, .head_3_v2, .head_3_v1, .head_3_v0, .head_2_v2, .head_2_v1, .head_2_v0, .head_1_v1, .head_1_v0, .head_0_v1, .head_0_v0, .hair_white_v1, .hair_white_v0, .hair_brown_v1, .hair_brown_v0, .hair_blond_v1, .hair_blond_v0, .hair_black_v1, .hair_black_v0, .armor_5_v1, .armor_5_v0, .armor_4_v1, .armor_4_v0, .armor_3_v1, .armor_3_v0, .armor_2_v0, .armor_1_v1, .armor_1_v0, .armor_0_v11, .armor_0_v10, .armor_0_v9, .armor_0_v8, .armor_0_v7, .armor_0_v6, .armor_0_v5, .armor_0_v4, .armor_0_v3, .armor_0_v2, .armor_0_v1, .armor_0_v0 {background: url(../img/sprites/player_sprites.png) no-repeat}
.weapon_6 {background-position: 0 0; width: 90px; height: 90px}
.weapon_5 {background-position: -90px 0; width: 90px; height: 90px}
.weapon_4 {background-position: -180px 0; width: 90px; height: 90px}

96
css/shop_sprites.css Normal file
View file

@ -0,0 +1,96 @@
[class^="shop_"], [class^="zzz"] {
background: url("../img/sprites/shop_sprites.png") no-repeat;
}
[class^="shop_weapon_"], [class^="shop_shield_"], [class^="shop_head_"], [class^="shop_armor_"], [class^="zzz"] {
width: 40px;
height: 40px;
}
/*Selector matching isn't working in mobile*/
.shop_weapon_6,
.shop_weapon_5,
.shop_weapon_4,
.shop_weapon_3,
.shop_weapon_2,
.shop_weapon_1,
.shop_shield_5,
.shop_shield_4,
.shop_shield_3,
.shop_shield_2,
.shop_shield_1,
.shop_head_5,
.shop_head_4,
.shop_head_3,
.shop_head_2,
.shop_head_1,
.shop_armor_5,
.shop_armor_4,
.shop_armor_3,
.shop_armor_2,
.shop_armor_1,
.shop_reroll,
.shop_potion,
.shop_copper,
.shop_silver,
.shop_gold,
.zzz,
.zzz_light {
background: url("../img/sprites/shop_sprites.png") no-repeat;
}
.shop_weapon_6,
.shop_weapon_5,
.shop_weapon_4,
.shop_weapon_3,
.shop_weapon_2,
.shop_weapon_1,
.shop_shield_5,
.shop_shield_4,
.shop_shield_3,
.shop_shield_2,
.shop_shield_1,
.shop_head_5,
.shop_head_4,
.shop_head_3,
.shop_head_2,
.shop_head_1,
.shop_armor_5,
.shop_armor_4,
.shop_armor_3,
.shop_armor_2,
.shop_armor_1,
.zzz,
.zzz_light {
width: 40px;
height: 40px;
}
.shop_weapon_6 {background-position: 0 0}
.shop_weapon_5 {background-position: -40px 0}
.shop_weapon_4 {background-position: -80px 0}
.shop_weapon_3 {background-position: -120px 0}
.shop_weapon_2 {background-position: -160px 0}
.shop_weapon_1 {background-position: -200px 0}
.shop_shield_5 {background-position: -240px 0}
.shop_shield_4 {background-position: -280px 0}
.shop_shield_3 {background-position: -320px 0}
.shop_shield_2 {background-position: -360px 0}
.shop_shield_1 {background-position: -400px 0}
.shop_head_5 {background-position: -440px 0}
.shop_head_4 {background-position: -480px 0}
.shop_head_3 {background-position: -520px 0}
.shop_head_2 {background-position: -560px 0}
.shop_head_1 {background-position: -600px 0}
.shop_armor_5 {background-position: -640px 0}
.shop_armor_4 {background-position: -680px 0}
.shop_armor_3 {background-position: -720px 0}
.shop_armor_2 {background-position: -760px 0}
.shop_armor_1 {background-position: -800px 0}
.shop_reroll {background-position: -840px 0; width: 40px; height: 40px}
.shop_potion {background-position: -880px 0; width: 40px; height: 40px}
.shop_copper {background-position: -923px -8px; width: 32px; height: 22px}
.shop_silver {background-position: -963px -8px; width: 32px; height: 22px}
.shop_gold {background-position: -1003px -8px; width: 32px; height: 22px}
.zzz{background-position: -1200px 0}
.zzz_light{background-position: -1280px 0}

File diff suppressed because it is too large Load diff

1
dist/spritesheets.css vendored Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
img/npcs/halloween/alex.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
img/npcs/halloween/matt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View file

@ -1,8 +0,0 @@
module.exports.items = require('./script/items.coffee');
module.exports.helpers = require('./script/helpers.coffee');
module.exports.algos = require('./script/algos.coffee');
try {
window;
window.habitrpgShared = exports;
} catch(e) {}

View file

@ -2,7 +2,7 @@
"name": "habitrpg-shared",
"version": "0.0.0",
"dependencies": {
"browserify": "~2.14.1",
"browserify": "~2.34.3",
"coffeeify": "0.4.0",
"coffee-script": "1.6.2",
"relative-date": "~1.1.1",
@ -11,7 +11,11 @@
},
"devDependencies": {
"mocha": "*",
"expect.js": "*"
"expect.js": "*",
"sinon": "~1.7.3",
"grunt": "~0.4.1",
"grunt-contrib-cssmin": "~0.6.2",
"grunt-browserify": "~1.2.4"
},
"scripts": {
"test": "mocha --compilers coffee:coffee-script tests/algos.mocha.coffee"

59
script/HISTORY_PREEN.js Normal file
View file

@ -0,0 +1,59 @@
// FIXME this needs to be ported into algos.cron so it's run for each individual user on the server. It used to be a migration script
/**
* Preen history for users with > 7 history entries
* This takes an infinite array of single day entries [day day day day day...], and turns it into a condensed array
* of averages, condensing more the further back in time we go. Eg, 7 entries each for last 7 days; 4 entries for last
* 4 weeks; 12 entries for last 12 months; 1 entry per year before that: [day*7 week*4 month*12 year*infinite]
*/
function preenHistory(history) {
history = _.filter(history, function(h) {return !!h}); // discard nulls (corrupted somehow)
var newHistory = [];
function preen(amount, groupBy) {
var groups, avg, start;
groups = _(history)
.groupBy(function(h) { return moment(h.date).format(groupBy) }) // get date groupings to average against
.sortBy(function(h,k) {return k;}) // sort by date
.value(); // turn into an array
amount++; // if we want the last 4 weeks, we're going 4 weeks back excluding this week. so +1 to account for exclusion
start = (groups.length - amount > 0) ? groups.length - amount : 0;
groups = groups.slice(start, groups.length - 1)
_.each(groups, function(group){
avg = _.reduce(group, function(mem, obj){ return mem + obj.value }, 0) / group.length;
newHistory.push({date: +moment(group[0].date), value: avg});
return true;
})
}
preen(50, 'YYYY'); // last 50 years
preen(12, 'YYYYMM'); // last 12 months
preen(4, 'YYYYww'); // last 4 weeks
newHistory = newHistory.concat(history.slice(-7)); // last 7 days
return newHistory;
}
var minHistLen = 7;
db.users.find({
// Registered users with some history
$or: [
{ 'auth.local': { $exists: true }},
{ 'auth.facebook': { $exists: true }}
],
'history': {$exists: true}
}).forEach(function(user) {
var update = {$set:{}};
_.each(user.tasks, function(task) {
if ( task.history && task.history.length > minHistLen )
update['$set']['tasks.' + task.id + '.history'] = preenHistory(task.history);
return true;
})
if (user.history.exp && user.history.exp.length > minHistLen)
update['$set']['history.exp'] = preenHistory(user.history.exp);
if (user.history.todos && user.history.todos.length > minHistLen)
update['$set']['history.todos'] = preenHistory(user.history.todos);
if (!_.isEmpty(update['$set'])) db.users.update({_id: user._id}, update);
});

View file

@ -89,7 +89,7 @@ obj.gpModifier = (value, modifier, priority = '!', streak, user) ->
if streak and user
streakBonus = streak / 100 + 1 # eg, 1-day streak is 1.1, 2-day is 1.2, etc
afterStreak = val * streakBonus
(user._tmp?={}).streakBonus = afterStreak - val if (val > 0) # keep this on-hand for later, so we can notify streak-bonus
user._tmp.streakBonus = afterStreak - val if (val > 0) # keep this on-hand for later, so we can notify streak-bonus
return afterStreak
else
return val
@ -177,7 +177,7 @@ randomDrop = (user, delta, priority, streak = 0, options={}) ->
# if they've dropped something, we want the consuming client to know so they can notify the user. See how the Derby
# app handles it for example. Would this be better handled as an emit() ?
(user._tmp?={}).drop = drop
user._tmp.drop = drop
user.items.lastDrop.date = +new Date
user.items.lastDrop.count++
@ -187,6 +187,11 @@ randomDrop = (user, delta, priority, streak = 0, options={}) ->
# {task} task you want to score
# {direction} 'up' or 'down'
obj.score = (user, task, direction, options={}) ->
# This is for setting one-time temporary flags, such as streakBonus or itemDropped. Useful for notifying
# the API consumer, then cleared afterwards
user._tmp = {}
[gp, hp, exp, lvl] = [+user.stats.gp, +user.stats.hp, +user.stats.exp, ~~user.stats.lvl]
[type, value, streak, priority] = [task.type, +task.value, ~~task.streak, task.priority or '!']
[paths, times, cron] = [options.paths || {}, options.times || 1, options.cron || false]
@ -249,9 +254,21 @@ obj.score = (user, task, direction, options={}) ->
addPoints() # obviously for delta>0, but also a trick to undo accidental checkboxes
if direction is 'up'
streak = if streak then streak + 1 else 1
# Give a streak achievement when the streak is a multiple of 21
if (streak % 21) is 0
user.achievements.streak = if user.achievements.streak then user.achievements.streak + 1 else 1
paths["achievements.streak"] = true
else
# Remove a streak achievement if streak was a multiple of 21 and the daily was undone
if (streak % 21) is 0
user.achievements.streak = if user.achievements.streak then user.achievements.streak - 1 else 0
paths["achievements.streak"] = true
streak = if streak then streak - 1 else 0
task.streak = streak
paths["tasks.#{task.id}.streak"] = true
when 'todo'
@ -277,8 +294,9 @@ obj.score = (user, task, direction, options={}) ->
task.value = value; paths["tasks.#{task.id}.value"] = true
updateStats user, { hp, exp, gp }, {paths: paths}
# Drop system #FIXME
randomDrop(user, delta, priority, streak, {paths: paths}) if direction is 'up'
# Drop system (don't run on the client, as it would only be discarded since ops are sent to the API, not the results)
if typeof window is 'undefined'
randomDrop(user, delta, priority, streak, {paths: paths}) if direction is 'up'
return delta
@ -365,6 +383,11 @@ obj.cron = (user, options={}) ->
user.lastCron = now; paths['lastCron'] = true
# Reset the lastDrop count to zero
if user.items.lastDrop.count > 0
user.items.lastDrop.count = 0
paths['items.lastDrop'] = true
# User is resting at the inn. Used to be we un-checked each daily without performing calculation (see commits before fb29e35)
# but to prevent abusing the inn (http://goo.gl/GDb9x) we now do *not* calculate dailies, and simply set lastCron to today
return if user.flags.rest is true

View file

@ -71,7 +71,9 @@ module.exports =
task.value ?= if task.type is 'reward' then 10 else 0
task
newUser: (isDerby=false) ->
# FIXME - should we remove this completely, since all defaults are accounted for in mongoose?
# Or should we keep it so mobile can create an offline new user in the future?
newUser: () ->
userSchema =
# _id / id handled by Racer
stats: { gp: 0, exp: 0, lvl: 1, hp: 50 }
@ -87,17 +89,10 @@ module.exports =
ads: 'show'
tags: []
if isDerby
userSchema.habitIds = []
userSchema.dailyIds = []
userSchema.todoIds = []
userSchema.rewardIds = []
userSchema.tasks = {}
else
userSchema.habits = []
userSchema.dailys = []
userSchema.todos = []
userSchema.rewards = []
userSchema.habits = []
userSchema.dailys = []
userSchema.todos = []
userSchema.rewards = []
# deep clone, else further new users get duplicate objects
newUser = _.cloneDeep userSchema
@ -126,11 +121,7 @@ module.exports =
for task in defaultTasks
guid = task.id = uuid()
if isDerby
newUser.tasks[guid] = task
newUser["#{task.type}Ids"].push guid
else
newUser["#{task.type}s"].push task
newUser["#{task.type}s"].push task
for tag in defaultTags
tag.id = uuid()
@ -150,16 +141,22 @@ module.exports =
###
dotSet: (path, val, obj) ->
return if ~path.indexOf('undefined')
arr = path.split('.')
_.reduce arr, (curr, next, index) ->
if (arr.length - 1) == index
curr[next] = val
curr[next]
, obj
try
arr = path.split('.')
_.reduce arr, (curr, next, index) ->
if (arr.length - 1) == index
curr[next] = val
(curr[next] ?= {})
, obj
catch err
console.error {err, path, val, _id:obj._id}
dotGet: (path, obj) ->
return undefined if ~path.indexOf('undefined')
_.reduce path.split('.'), ((curr, next) -> curr[next]), obj
try
_.reduce path.split('.'), ((curr, next) -> curr?[next]), obj
catch err
console.error {err, path, val, _id:obj._id}
daysSince: daysSince
startOfWeek: startOfWeek
@ -254,7 +251,7 @@ module.exports =
###
gold: (num) ->
if num
return (num).toFixed(1).split('.')[0]
return Math.floor num
else
return "0"
@ -263,14 +260,14 @@ module.exports =
###
silver: (num) ->
if num
(num).toFixed(2).split('.')[1]
("0" + Math.floor (num - Math.floor(num))*100).slice -2
else
return "00"
###
Task classes given everything about the class
###
taskClasses: (task, filters, dayStart, lastCron, showCompleted=false, main) ->
taskClasses: (task, filters=[], dayStart=0, lastCron=+new Date, showCompleted=false, main=false) ->
return unless task
{type, completed, value, repeat} = task

View file

@ -2,7 +2,12 @@ exports.algos = require('./algos.coffee');
exports.items = require('./items.coffee');
exports.helpers = require('./helpers.coffee');
var moment = require('moment');
var _ = require('lodash');
try {
window;
window.habitrpgShared = exports;
window._ = _;
window.moment = moment;
} catch(e) {}

View file

@ -88,6 +88,8 @@ module.exports.buyItem = (user, type, options={}) ->
options.paths['stats.hp'] = true
else
user.items[type] = ~~nextItem.index
if user.items.weapon >= 6 and user.items.armor >= 5 and user.items.head >= 5 and user.items.shield >= 5
user.achievements.ultimateGear = true;
options.paths["items.#{type}"] = true
user.stats.gp -= +nextItem.value
options.paths['stats.gp'] = true

View file

@ -1,5 +1,6 @@
_ = require 'lodash'
expect = require 'expect.js'
sinon = require 'sinon'
moment = require 'moment'
# Custom modules
@ -59,8 +60,14 @@ expectDayResetNoDamage = (b,a) ->
# hack so we can compare user before/after obj equality sans effected paths
_.each ['dailys','todos','history','lastCron'], (path) ->
_.each [before,after], (obj) -> delete obj[path]
delete after._tmp
expect(after).to.eql before
cycle = (array)->
n = -1
->
n++
return array[n % array.length]
###### Specs ######
@ -71,7 +78,7 @@ describe 'User', ->
expect(user.items).to.eql { weapon: 0, armor: 0, head: 0, shield: 0 }
expect(user.preferences).to.eql { gender: 'm', skin: 'white', hair: 'blond', armorSet: 'v1', dayStart:0, showHelm: true }
expect(user.balance).to.eql 0
expect(user.lastCron).to.eql 'new'
expect(user.lastCron).to.be.greaterThan 0
expect(user.flags).to.eql {partyEnabled: false, itemsEnabled: false, ads: 'show'}
expectStrings(user, ['apiToken'])
expectStrings(user.habits[0], ['text','id'])
@ -82,6 +89,73 @@ describe 'User', ->
expectStrings(user.tags[1], ['name','id'])
expectStrings(user.tags[2], ['name','id'])
it 'revives correctly', ->
user = helpers.newUser()
user.stats = { gp: 10, exp: 100, lvl: 2, hp: 1 }
user.weapon = 1
algos.revive user
expect(user.stats).to.eql { gp: 0, exp: 0, lvl: 1, hp: 50 }
expect(user.items).to.eql { weapon: 0, armor: 0, head: 0, shield: 0 }
describe 'store', ->
it 'recovers hp buying potions', ->
user = helpers.newUser()
user.stats.hp = 30
user.stats.gp = 50
expect(items.buyItem user, 'potion').to.be true
expect(user.stats.hp).to.eql 45
expect(user.stats.gp).to.eql 25
expect(items.buyItem user, 'potion').to.be true
expect(user.stats.hp).to.eql 50 # don't exceed max hp
expect(user.stats.gp).to.eql 0
it 'buys equipment', ->
user = helpers.newUser()
user.stats.gp = 31
expect(items.buyItem user, 'armor').to.be true
expect(user.items.armor).to.eql 1
expect(user.stats.gp).to.eql 1
it 'do not buy equipment without enough money', ->
user = helpers.newUser()
user.stats.gp = 1
expect(items.buyItem user, 'armor').to.be false
expect(user.items.armor).to.eql 0
expect(user.stats.gp).to.eql 1
describe 'drop system', ->
user = null
beforeEach ->
user = helpers.newUser()
user.flags.dropsEnabled = true
# too many Math.random calls to stub, let's return the last element
sinon.stub(helpers, 'randomVal', (x)->x[x.length-1])
it 'gets a golden potion', ->
sinon.stub(Math, 'random').returns 0
algos.score(user, user.dailys[0], 'up')
expect(user.items.eggs).to.eql undefined
expect(user.items.hatchingPotions).to.eql ['Golden']
it 'gets a bear cub egg', ->
sinon.stub(Math, 'random', cycle [0, 0.6])
algos.score(user, user.dailys[0], 'up')
expect(user.items.eggs.length).to.eql 1
expect(user.items.eggs[0].name).to.eql 'BearCub'
expect(user.items.hatchingPotions).to.eql undefined
it 'does not get a drop', ->
sinon.stub(Math, 'random').returns 0.5
algos.score(user, user.dailys[0], 'up')
expect(user.items.eggs).to.eql undefined
expect(user.items.hatchingPotions).to.eql undefined
afterEach ->
Math.random.restore()
helpers.randomVal.restore()
describe 'Simple Scoring', ->
it 'Habits : Up', ->
@ -109,7 +183,7 @@ describe 'Cron', ->
it 'computes shouldCron', ->
user = helpers.newUser()
paths = {};algos.cron user, {paths}
expect(paths.lastCron).to.be true # handlomg lastCron='new'
expect(paths.lastCron).to.be undefined # handlomg lastCron='new'
paths = {};algos.cron user, {paths}
expect(paths.lastCron).to.not.be.ok # it setup the cron property now
@ -238,5 +312,23 @@ describe 'Cron', ->
now = helpers.startOfDay {dayStart: dayStart-1}
expect(helpers.daysSince(yesterday, {now, dayStart})).to.eql 0
now = moment().startOf('day').add('h', dayStart).add('m', 1)
console.log {yesterday,now}
expect(helpers.daysSince(yesterday, {now, dayStart})).to.eql 1
describe 'Helper', ->
it 'calculates gold coins', ->
expect(helpers.gold(10)).to.eql 10
expect(helpers.gold(1.957)).to.eql 1
expect(helpers.gold()).to.eql 0
it 'calculates silver coins', ->
expect(helpers.silver(10)).to.eql 0
expect(helpers.silver(1.957)).to.eql 95
expect(helpers.silver(0.01)).to.eql "01"
expect(helpers.silver()).to.eql "00"
it 'calculates experience to next level', ->
expect(algos.tnl 1).to.eql 150
expect(algos.tnl 2).to.eql 160
expect(algos.tnl 10).to.eql 260
expect(algos.tnl 99).to.eql 3580
expect(algos.tnl 100).to.eql 0