Skip to content

Commit

Permalink
Merge pull request #61 from Enigmatical/feature/adjust-segs-to-15-min…
Browse files Browse the repository at this point in the history
…utes

Adjust Segs from 30 to 15 minutes
  • Loading branch information
Enigmatical committed Apr 19, 2015
2 parents 8d9a102 + 174004e commit cd8cc7a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 28 deletions.
12 changes: 6 additions & 6 deletions src/scripts/components/Adventure/GmModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,22 @@ var AdventureGmModal = React.createClass({
<div className="col-md-12">
<p className="body-header">Adjust Time</p>
<div className="col-md-2">
<AdjustTime save={save} onSave={this.props.onSave} segs={-48} disable={false} block={true}><Glyphicon glyph="backward" /> -1 Day</AdjustTime>
<AdjustTime save={save} onSave={this.props.onSave} segs={-96} disable={false} block={true}><Glyphicon glyph="backward" /> -1 Day</AdjustTime>
</div>
<div className="col-md-2">
<AdjustTime save={save} onSave={this.props.onSave} segs={-2} disable={false} block={true}><Glyphicon glyph="triangle-left" /> -1 Hour</AdjustTime>
<AdjustTime save={save} onSave={this.props.onSave} segs={-4} disable={false} block={true}><Glyphicon glyph="triangle-left" /> -1 Hour</AdjustTime>
</div>
<div className="col-md-2">
<AdjustTime save={save} onSave={this.props.onSave} segs={-1} disable={false} block={true}><Glyphicon glyph="menu-left" /> -30 Mins</AdjustTime>
<AdjustTime save={save} onSave={this.props.onSave} segs={-1} disable={false} block={true}><Glyphicon glyph="menu-left" /> -15 Mins</AdjustTime>
</div>
<div className="col-md-2">
<AdjustTime save={save} onSave={this.props.onSave} segs={1} disable={false} block={true}>+30 Mins <Glyphicon glyph="menu-right" /></AdjustTime>
<AdjustTime save={save} onSave={this.props.onSave} segs={1} disable={false} block={true}>+15 Mins <Glyphicon glyph="menu-right" /></AdjustTime>
</div>
<div className="col-md-2">
<AdjustTime save={save} onSave={this.props.onSave} segs={2} disable={false} block={true}>+1 Hour <Glyphicon glyph="triangle-right" /></AdjustTime>
<AdjustTime save={save} onSave={this.props.onSave} segs={4} disable={false} block={true}>+1 Hour <Glyphicon glyph="triangle-right" /></AdjustTime>
</div>
<div className="col-md-2">
<AdjustTime save={save} onSave={this.props.onSave} segs={48} disable={false} block={true}>+1 Day <Glyphicon glyph="forward" /></AdjustTime>
<AdjustTime save={save} onSave={this.props.onSave} segs={96} disable={false} block={true}>+1 Day <Glyphicon glyph="forward" /></AdjustTime>
</div>
</div>
</section>
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/components/Save/Inputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ var SaveInputs = React.createClass({
type="text"
name="segs"
ref="segs"
placeholder="Segs (48 = 1 Day)"
placeholder="Segs (96 = 1 Day)"
defaultValue={attrs.segs || 0}
onChange={this.handleDayTime}
addonBefore="Current Segs"
Expand Down
41 changes: 20 additions & 21 deletions src/scripts/helpers/Pathfinder.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,21 +455,21 @@ var Pathfinder = {
segs = 0;
}

var days, hours, half, dayLabel, hourLabel, halfLabel, ampmLabel;
var days, hours, partial, dayLabel, hourLabel, partialLabel, ampmLabel;

/*
Days
*/
days = parseInt(segs/48);
segs = segs - (days * 48);
days = parseInt(segs/96);
segs = segs - (days * 96);
dayLabel = 'Day ' + (days + 1);

/*
Hours
*/
hours = parseInt(segs/2);
hours = parseInt(segs/4);

segs = segs - (hours * 2);
segs = segs - (hours * 4);
if (hours === 0) {
hourLabel = '12';
ampmLabel = 'AM';
Expand All @@ -487,11 +487,10 @@ var Pathfinder = {
ampmLabel = 'PM';
}

half = parseInt(segs);
halfLabel = (half === 1) ? ':30' : ':00';
partial = parseInt(segs);
partialLabel = (partial > 0) ? ':' + (partial * 15) : ':00';

return (<span>{dayLabel}&nbsp;&nbsp;<small className="text-muted">{hourLabel + halfLabel} {ampmLabel}</small></span>);
//return (dayLabel + ', ' + hourLabel + halfLabel + ' ' + ampmLabel);
return (<span>{dayLabel}&nbsp;&nbsp;<small className="text-muted">{hourLabel + partialLabel} {ampmLabel}</small></span>);
},

getPartyLevel: function(xp, size) {
Expand Down Expand Up @@ -534,22 +533,22 @@ var Pathfinder = {
segs = 0;
}

var days, hours, half;
var dayLabel, hourLabel, halfLabel = (<span />);
var days, hours, partial;
var dayLabel, hourLabel, partialLabel = (<span />);

/*
Days
*/
days = parseInt(segs / 48);
segs = segs - (days * 48);
days = parseInt(segs / 96);
segs = segs - (days * 96);

/*
Hours
*/
hours = parseInt(segs / 2);
segs = segs - (hours * 2);
hours = parseInt(segs / 4);
segs = segs - (hours * 4);

half = parseInt(segs);
partial = parseInt(segs);

if (days > 0) {
dayLabel = (<span>{days} <small>Day{days > 1 ? 's' : ''}</small></span>);
Expand All @@ -559,11 +558,11 @@ var Pathfinder = {
hourLabel = (<span>{days > 0 ? ' ' + hours : hours} <small>Hour{hours > 1 ? 's': ''}</small></span>);
}

if (half > 0) {
halfLabel = (<span>{hours > 0 ? ' 30' : '30'} <small>Mins</small></span>);
if (partial > 0) {
partialLabel = (<span>{hours > 0 ? ' ' + (partial * 15) : (partial * 15)} <small>Mins</small></span>);
}

return (<span><span>{dayLabel}</span><span>{hourLabel}</span><span>{halfLabel}</span></span>);
return (<span><span>{dayLabel}</span><span>{hourLabel}</span><span>{partialLabel}</span></span>);
},

getTravelDistance: function(source, dest) {
Expand All @@ -576,14 +575,14 @@ var Pathfinder = {
var days = parseInt(distance/maxMilesPerDay);
var hours = parseInt((distance%maxMilesPerDay)/speed);

return (days * 48) + (hours * 2);
return (days * 96) + (hours * 4);
},

getCarriageCost: function(distance) {
//Rate @ 1gp per 1 hour
var segs = this.getTravelTime(distance, 3);

return parseInt(segs/2);
return parseInt(segs/4);
}
};

Expand Down

0 comments on commit cd8cc7a

Please sign in to comment.