Section 1
//allbackgrounds_197 (coffeeshop_fla.allbackgrounds_197)
package coffeeshop_fla {
import flash.display.*;
public dynamic class allbackgrounds_197 extends MovieClip {
public function allbackgrounds_197(){
addFrameScript(0, frame1, 8, frame9, 18, frame19, 29, frame30);
}
function frame1(){
stop();
}
function frame19(){
stop();
}
function frame9(){
stop();
}
function frame30(){
stop();
}
}
}//package coffeeshop_fla
Section 2
//Customer_102 (coffeeshop_fla.Customer_102)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_102 extends MovieClip {
public function Customer_102(){
addFrameScript(81, frame82);
}
function frame82(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 3
//Customer_104 (coffeeshop_fla.Customer_104)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_104 extends MovieClip {
public function Customer_104(){
addFrameScript(47, frame48);
}
function frame48(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 4
//Customer_106 (coffeeshop_fla.Customer_106)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_106 extends MovieClip {
public function Customer_106(){
addFrameScript(76, frame77);
}
function frame77(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 5
//Customer_108 (coffeeshop_fla.Customer_108)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_108 extends MovieClip {
public function Customer_108(){
addFrameScript(114, frame115);
}
function frame115(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 6
//Customer_112 (coffeeshop_fla.Customer_112)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_112 extends MovieClip {
public function Customer_112(){
addFrameScript(39, frame40);
}
function frame40(){
CCustomer(parent).OnConsideringDone();
}
}
}//package coffeeshop_fla
Section 7
//Customer_114 (coffeeshop_fla.Customer_114)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_114 extends MovieClip {
public function Customer_114(){
addFrameScript(27, frame28, 74, frame75, 105, frame106, 159, frame160);
}
function frame75(){
CCustomer(parent).OnDonePurchasing();
}
function frame160(){
CCustomer(parent).OnConsumptionDone();
}
function frame106(){
CCustomer(parent).OnWalkDownDone();
}
function frame28(){
CCustomer(parent).OnPurchasing();
}
}
}//package coffeeshop_fla
Section 8
//Customer_119 (coffeeshop_fla.Customer_119)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_119 extends MovieClip {
public function Customer_119(){
addFrameScript(66, frame67);
}
function frame67(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 9
//Customer_121 (coffeeshop_fla.Customer_121)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_121 extends MovieClip {
public function Customer_121(){
addFrameScript(53, frame54);
}
function frame54(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 10
//Customer_123 (coffeeshop_fla.Customer_123)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_123 extends MovieClip {
public function Customer_123(){
addFrameScript(61, frame62);
}
function frame62(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 11
//Customer_125 (coffeeshop_fla.Customer_125)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_125 extends MovieClip {
public function Customer_125(){
addFrameScript(88, frame89);
}
function frame89(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 12
//Customer_129 (coffeeshop_fla.Customer_129)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_129 extends MovieClip {
public function Customer_129(){
addFrameScript(39, frame40);
}
function frame40(){
CCustomer(parent).OnConsideringDone();
}
}
}//package coffeeshop_fla
Section 13
//Customer_131 (coffeeshop_fla.Customer_131)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_131 extends MovieClip {
public function Customer_131(){
addFrameScript(27, frame28, 56, frame57, 87, frame88, 172, frame173);
}
function frame88(){
CCustomer(parent).OnWalkDownDone();
}
function frame173(){
CCustomer(parent).OnConsumptionDone();
}
function frame28(){
CCustomer(parent).OnPurchasing();
}
function frame57(){
CCustomer(parent).OnDonePurchasing();
}
}
}//package coffeeshop_fla
Section 14
//Customer_136 (coffeeshop_fla.Customer_136)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_136 extends MovieClip {
public function Customer_136(){
addFrameScript(38, frame39);
}
function frame39(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 15
//Customer_138 (coffeeshop_fla.Customer_138)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_138 extends MovieClip {
public function Customer_138(){
addFrameScript(43, frame44);
}
function frame44(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 16
//Customer_140 (coffeeshop_fla.Customer_140)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_140 extends MovieClip {
public function Customer_140(){
addFrameScript(46, frame47);
}
function frame47(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 17
//Customer_142 (coffeeshop_fla.Customer_142)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_142 extends MovieClip {
public function Customer_142(){
addFrameScript(57, frame58);
}
function frame58(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 18
//Customer_147 (coffeeshop_fla.Customer_147)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_147 extends MovieClip {
public function Customer_147(){
addFrameScript(39, frame40);
}
function frame40(){
CCustomer(parent).OnConsideringDone();
}
}
}//package coffeeshop_fla
Section 19
//Customer_149 (coffeeshop_fla.Customer_149)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_149 extends MovieClip {
public function Customer_149(){
addFrameScript(27, frame28, 56, frame57, 87, frame88, 141, frame142);
}
function frame88(){
CCustomer(parent).OnWalkDownDone();
}
function frame28(){
CCustomer(parent).OnPurchasing();
}
function frame57(){
CCustomer(parent).OnDonePurchasing();
}
function frame142(){
CCustomer(parent).OnConsumptionDone();
}
}
}//package coffeeshop_fla
Section 20
//Customer_156 (coffeeshop_fla.Customer_156)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_156 extends MovieClip {
public function Customer_156(){
addFrameScript(38, frame39);
}
function frame39(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 21
//Customer_158 (coffeeshop_fla.Customer_158)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_158 extends MovieClip {
public function Customer_158(){
addFrameScript(43, frame44);
}
function frame44(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 22
//Customer_160 (coffeeshop_fla.Customer_160)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_160 extends MovieClip {
public function Customer_160(){
addFrameScript(53, frame54);
}
function frame54(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 23
//Customer_162 (coffeeshop_fla.Customer_162)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_162 extends MovieClip {
public function Customer_162(){
addFrameScript(69, frame70);
}
function frame70(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 24
//Customer_167 (coffeeshop_fla.Customer_167)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_167 extends MovieClip {
public function Customer_167(){
addFrameScript(39, frame40);
}
function frame40(){
CCustomer(parent).OnConsideringDone();
}
}
}//package coffeeshop_fla
Section 25
//Customer_169 (coffeeshop_fla.Customer_169)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_169 extends MovieClip {
public function Customer_169(){
addFrameScript(27, frame28, 56, frame57, 87, frame88, 141, frame142);
}
function frame88(){
CCustomer(parent).OnWalkDownDone();
}
function frame28(){
CCustomer(parent).OnPurchasing();
}
function frame57(){
CCustomer(parent).OnDonePurchasing();
}
function frame142(){
CCustomer(parent).OnConsumptionDone();
}
}
}//package coffeeshop_fla
Section 26
//Customer_174 (coffeeshop_fla.Customer_174)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_174 extends MovieClip {
public function Customer_174(){
addFrameScript(66, frame67);
}
function frame67(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 27
//Customer_176 (coffeeshop_fla.Customer_176)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_176 extends MovieClip {
public function Customer_176(){
addFrameScript(53, frame54);
}
function frame54(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 28
//Customer_178 (coffeeshop_fla.Customer_178)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_178 extends MovieClip {
public function Customer_178(){
addFrameScript(61, frame62);
}
function frame62(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 29
//Customer_180 (coffeeshop_fla.Customer_180)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_180 extends MovieClip {
public function Customer_180(){
addFrameScript(88, frame89);
}
function frame89(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 30
//Customer_59 (coffeeshop_fla.Customer_59)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_59 extends MovieClip {
public function Customer_59(){
addFrameScript(39, frame40);
}
function frame40(){
CCustomer(parent).OnConsideringDone();
}
}
}//package coffeeshop_fla
Section 31
//Customer_61 (coffeeshop_fla.Customer_61)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_61 extends MovieClip {
public function Customer_61(){
addFrameScript(27, frame28, 59, frame60, 87, frame88, 202, frame203);
}
function frame88(){
CCustomer(parent).OnWalkDownDone();
}
function frame203(){
CCustomer(parent).OnConsumptionDone();
}
function frame28(){
CCustomer(parent).OnPurchasing();
}
function frame60(){
CCustomer(parent).OnDonePurchasing();
}
}
}//package coffeeshop_fla
Section 32
//Customer_67 (coffeeshop_fla.Customer_67)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_67 extends MovieClip {
public function Customer_67(){
addFrameScript(50, frame51);
}
function frame51(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 33
//Customer_69 (coffeeshop_fla.Customer_69)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_69 extends MovieClip {
public function Customer_69(){
addFrameScript(41, frame42);
}
function frame42(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 34
//Customer_71 (coffeeshop_fla.Customer_71)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_71 extends MovieClip {
public function Customer_71(){
addFrameScript(49, frame50);
}
function frame50(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 35
//Customer_73 (coffeeshop_fla.Customer_73)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_73 extends MovieClip {
public function Customer_73(){
addFrameScript(86, frame87);
}
function frame87(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 36
//Customer_77 (coffeeshop_fla.Customer_77)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_77 extends MovieClip {
public function Customer_77(){
addFrameScript(39, frame40);
}
function frame40(){
CCustomer(parent).OnConsideringDone();
}
}
}//package coffeeshop_fla
Section 37
//Customer_79 (coffeeshop_fla.Customer_79)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_79 extends MovieClip {
public function Customer_79(){
addFrameScript(27, frame28, 48, frame49, 79, frame80, 194, frame195);
}
function frame80(){
CCustomer(parent).OnWalkDownDone();
}
function frame195(){
CCustomer(parent).OnConsumptionDone();
}
function frame28(){
CCustomer(parent).OnPurchasing();
}
function frame49(){
CCustomer(parent).OnDonePurchasing();
}
}
}//package coffeeshop_fla
Section 38
//Customer_84 (coffeeshop_fla.Customer_84)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_84 extends MovieClip {
public function Customer_84(){
addFrameScript(56, frame57);
}
function frame57(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 39
//Customer_86 (coffeeshop_fla.Customer_86)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_86 extends MovieClip {
public function Customer_86(){
addFrameScript(103, frame104);
}
function frame104(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 40
//Customer_88 (coffeeshop_fla.Customer_88)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_88 extends MovieClip {
public function Customer_88(){
addFrameScript(49, frame50);
}
function frame50(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 41
//Customer_90 (coffeeshop_fla.Customer_90)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_90 extends MovieClip {
public function Customer_90(){
addFrameScript(101, frame102);
}
function frame102(){
CCustomer(parent).OnReactionDone();
}
}
}//package coffeeshop_fla
Section 42
//Customer_95 (coffeeshop_fla.Customer_95)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_95 extends MovieClip {
public function Customer_95(){
addFrameScript(39, frame40);
}
function frame40(){
CCustomer(parent).OnConsideringDone();
}
}
}//package coffeeshop_fla
Section 43
//Customer_97 (coffeeshop_fla.Customer_97)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Customer_97 extends MovieClip {
public function Customer_97(){
addFrameScript(27, frame28, 70, frame71, 101, frame102, 201, frame202);
}
function frame71(){
CCustomer(parent).OnDonePurchasing();
}
function frame202(){
CCustomer(parent).OnConsumptionDone();
}
function frame102(){
CCustomer(parent).OnWalkDownDone();
}
function frame28(){
CCustomer(parent).OnPurchasing();
}
}
}//package coffeeshop_fla
Section 44
//Logo_221 (coffeeshop_fla.Logo_221)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Logo_221 extends MovieClip {
public var _scrolling:MovieClip;
public var _maskA:MovieClip;
}
}//package coffeeshop_fla
Section 45
//Precacher_13 (coffeeshop_fla.Precacher_13)
package coffeeshop_fla {
import flash.display.*;
public dynamic class Precacher_13 extends MovieClip {
public function Precacher_13(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package coffeeshop_fla
Section 46
//Color (fl.motion.Color)
package fl.motion {
import flash.display.*;
import flash.geom.*;
public class Color extends ColorTransform {
private var _tintMultiplier:Number;// = 0
private var _tintColor:Number;// = 0
public function Color(_arg1:Number=1, _arg2:Number=1, _arg3:Number=1, _arg4:Number=1, _arg5:Number=0, _arg6:Number=0, _arg7:Number=0, _arg8:Number=0){
_tintColor = 0;
_tintMultiplier = 0;
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
}
public function setTint(_arg1:uint, _arg2:Number):void{
var _local3:uint;
var _local4:uint;
var _local5:uint;
this._tintColor = _arg1;
this._tintMultiplier = _arg2;
this.redMultiplier = (this.greenMultiplier = (this.blueMultiplier = (1 - _arg2)));
_local3 = ((_arg1 >> 16) & 0xFF);
_local4 = ((_arg1 >> 8) & 0xFF);
_local5 = (_arg1 & 0xFF);
this.redOffset = Math.round((_local3 * _arg2));
this.greenOffset = Math.round((_local4 * _arg2));
this.blueOffset = Math.round((_local5 * _arg2));
}
public function set tintColor(_arg1:uint):void{
this.setTint(_arg1, this.tintMultiplier);
}
public function get brightness():Number{
return ((this.redOffset) ? (1 - this.redMultiplier) : (this.redMultiplier - 1));
}
private function deriveTintColor():uint{
var _local1:Number;
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:uint;
_local1 = (1 / this.tintMultiplier);
_local2 = Math.round((this.redOffset * _local1));
_local3 = Math.round((this.greenOffset * _local1));
_local4 = Math.round((this.blueOffset * _local1));
_local5 = (((_local2 << 16) | (_local3 << 8)) | _local4);
return (_local5);
}
public function get tintMultiplier():Number{
return (this._tintMultiplier);
}
public function get tintColor():uint{
return (this._tintColor);
}
public function set brightness(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
if (_arg1 > 1){
_arg1 = 1;
} else {
if (_arg1 < -1){
_arg1 = -1;
};
};
_local2 = (1 - Math.abs(_arg1));
_local3 = 0;
if (_arg1 > 0){
_local3 = (_arg1 * 0xFF);
};
this.redMultiplier = (this.greenMultiplier = (this.blueMultiplier = _local2));
this.redOffset = (this.greenOffset = (this.blueOffset = _local3));
}
public function set tintMultiplier(_arg1:Number):void{
this.setTint(this.tintColor, _arg1);
}
private function parseXML(_arg1:XML=null):Color{
var _local2:XML;
var _local3:XML;
var _local4:String;
var _local5:uint;
if (!_arg1){
return (this);
};
_local2 = _arg1.elements()[0];
if (!_local2){
return (this);
};
for each (_local3 in _local2.attributes()) {
_local4 = _local3.localName();
if (_local4 == "tintColor"){
_local5 = (Number(_local3.toString()) as uint);
this.tintColor = _local5;
} else {
this[_local4] = Number(_local3.toString());
};
};
return (this);
}
public static function interpolateColor(_arg1:uint, _arg2:uint, _arg3:Number):uint{
var _local4:Number;
var _local5:uint;
var _local6:uint;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:uint;
var _local11:uint;
var _local12:uint;
var _local13:uint;
var _local14:uint;
var _local15:uint;
var _local16:uint;
var _local17:uint;
_local4 = (1 - _arg3);
_local5 = ((_arg1 >> 24) & 0xFF);
_local6 = ((_arg1 >> 16) & 0xFF);
_local7 = ((_arg1 >> 8) & 0xFF);
_local8 = (_arg1 & 0xFF);
_local9 = ((_arg2 >> 24) & 0xFF);
_local10 = ((_arg2 >> 16) & 0xFF);
_local11 = ((_arg2 >> 8) & 0xFF);
_local12 = (_arg2 & 0xFF);
_local13 = ((_local5 * _local4) + (_local9 * _arg3));
_local14 = ((_local6 * _local4) + (_local10 * _arg3));
_local15 = ((_local7 * _local4) + (_local11 * _arg3));
_local16 = ((_local8 * _local4) + (_local12 * _arg3));
_local17 = ((((_local13 << 24) | (_local14 << 16)) | (_local15 << 8)) | _local16);
return (_local17);
}
public static function interpolateTransform(_arg1:ColorTransform, _arg2:ColorTransform, _arg3:Number):ColorTransform{
var _local4:Number;
var _local5:ColorTransform;
_local4 = (1 - _arg3);
_local5 = new ColorTransform(((_arg1.redMultiplier * _local4) + (_arg2.redMultiplier * _arg3)), ((_arg1.greenMultiplier * _local4) + (_arg2.greenMultiplier * _arg3)), ((_arg1.blueMultiplier * _local4) + (_arg2.blueMultiplier * _arg3)), ((_arg1.alphaMultiplier * _local4) + (_arg2.alphaMultiplier * _arg3)), ((_arg1.redOffset * _local4) + (_arg2.redOffset * _arg3)), ((_arg1.greenOffset * _local4) + (_arg2.greenOffset * _arg3)), ((_arg1.blueOffset * _local4) + (_arg2.blueOffset * _arg3)), ((_arg1.alphaOffset * _local4) + (_arg2.alphaOffset * _arg3)));
return (_local5);
}
public static function fromXML(_arg1:XML):Color{
return (Color(new (Color).parseXML(_arg1)));
}
}
}//package fl.motion
Section 47
//ambient_cold (ambient_cold)
package {
import flash.media.*;
public dynamic class ambient_cold extends Sound {
}
}//package
Section 48
//ambient_fair (ambient_fair)
package {
import flash.media.*;
public dynamic class ambient_fair extends Sound {
}
}//package
Section 49
//ambient_rainy (ambient_rainy)
package {
import flash.media.*;
public dynamic class ambient_rainy extends Sound {
}
}//package
Section 50
//audio_gain (audio_gain)
package {
import flash.media.*;
public dynamic class audio_gain extends Sound {
}
}//package
Section 51
//audio_pay (audio_pay)
package {
import flash.media.*;
public dynamic class audio_pay extends Sound {
}
}//package
Section 52
//CButton (CButton)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class CButton extends MovieClip {
private var _soundOver:String;
private var _soundClicked:String;
private var _textColorOut:uint;// = 0x666666
private var _textColorOver:uint;// = 0x333333
protected var _buttonID:String;
public var _myText:TextField;
private var _isEnabled:Boolean;// = true
private var _isOver:Boolean;// = false
protected var _fnCallOnClicked:Function;
private var _textColorDisabled:uint;// = 0xCCCCCC
private var _textColorDown:uint;// = 0x333333
public function CButton(){
_isEnabled = true;
_textColorDisabled = 0xCCCCCC;
_textColorOut = 0x666666;
_textColorOver = 0x333333;
_textColorDown = 0x333333;
_isOver = false;
super();
}
public function onMouseOver(_arg1:Event):void{
if (((_isEnabled) && (!(_isOver)))){
_isOver = true;
gotoAndStop("over");
if (_myText != null){
_myText.textColor = _textColorOver;
};
if (_soundOver != null){
CCoffeeSound._instance.PlaySound(_soundOver);
};
};
}
public function SetSounds(_arg1:String, _arg2:String){
_soundOver = _arg1;
_soundClicked = _arg2;
}
public function onMouseUp(_arg1:Event):void{
if (_isEnabled){
if (_soundClicked != null){
CCoffeeSound._instance.PlaySound(_soundClicked);
};
if (_buttonID){
CMetaStatsCollector._instance.AddButtonClick(_buttonID);
};
if (_fnCallOnClicked != null){
_fnCallOnClicked();
};
onMouseOver(_arg1);
};
}
public function onMouseOut(_arg1:Event):void{
if (_isEnabled){
_isOver = false;
gotoAndStop("out");
if (_myText != null){
_myText.textColor = _textColorOut;
};
};
}
public function IsEnabled():Boolean{
return (_isEnabled);
}
public function SetEnabled(_arg1:Boolean):void{
if (_isEnabled == _arg1){
return;
};
_isEnabled = _arg1;
if (_isEnabled){
gotoAndStop("out");
_isOver = false;
if (_myText != null){
_myText.textColor = _textColorOut;
};
} else {
gotoAndStop("disabled");
if (_myText != null){
_myText.textColor = _textColorDisabled;
};
};
}
public function Initialize(_arg1:String, _arg2:Function, _arg3:String){
if (_myText != null){
_myText.text = _arg1;
_myText.textColor = _textColorOut;
};
_buttonID = _arg3;
_fnCallOnClicked = _arg2;
addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
gotoAndStop("out");
}
public function onMouseDown(_arg1:Event):void{
if (_isEnabled){
gotoAndStop("down");
if (_myText != null){
_myText.textColor = _textColorDown;
};
};
}
public function SetTextColors(_arg1:uint, _arg2:uint, _arg3:uint, _arg4:uint):void{
_textColorDisabled = _arg1;
_textColorOut = _arg2;
_textColorOver = _arg3;
_textColorDown = _arg4;
}
}
}//package
Section 53
//CButtonBack (CButtonBack)
package {
public class CButtonBack extends CButton {
public function CButtonBack(){
SetSounds("menu_button_beep2", "menu_button_beep1");
}
}
}//package
Section 54
//CButtonBuy (CButtonBuy)
package {
import flash.events.*;
import flash.text.*;
public class CButtonBuy extends CButton {
public var _textCostPerUnit:TextField;
private var _amount:Number;
private var _unitName:String;
private var _cost:int;
private var _commodity:String;
public var _textCost:TextField;
public function CButtonBuy(_arg1:String, _arg2:String, _arg3:Number, _arg4:int, _arg5:Function, _arg6:String){
var _local7:int;
super();
Initialize("", _arg5, _arg6);
SetTextColors(0x666666, 0x333333, 0xFFFFFF, 0xFFFFFF);
_commodity = _arg1;
_unitName = _arg2;
_amount = _arg3;
_cost = _arg4;
_myText.text = String(_amount);
_textCost.text = ("cost: " + CCoffeeShopApp.ConvertUnitToString("Cash", _cost));
_local7 = (_cost / _amount);
_textCostPerUnit.text = ((CCoffeeShopApp.ConvertUnitToString("Cash", _local7) + "/") + _unitName);
onMouseOut(null);
}
public function get _costPerPurchase():int{
return (_cost);
}
override public function onMouseUp(_arg1:Event):void{
if (IsEnabled()){
if (_buttonID){
CMetaStatsCollector._instance.AddButtonClick(_buttonID);
};
if (_fnCallOnClicked != null){
_fnCallOnClicked(_commodity, _amount, _cost);
};
onMouseOver(_arg1);
};
}
override public function onMouseOut(_arg1:Event):void{
_textCost.visible = false;
_textCostPerUnit.visible = false;
super.onMouseOut(_arg1);
}
override public function onMouseOver(_arg1:Event):void{
_textCost.visible = true;
_textCostPerUnit.visible = true;
super.onMouseOver(_arg1);
}
}
}//package
Section 55
//CButtonGraphStatToggle (CButtonGraphStatToggle)
package {
import flash.events.*;
import flash.display.*;
public class CButtonGraphStatToggle extends CButton {
protected var m_isSelected:Boolean;// = false
private var m_parentButton:CButtonStatFolder;
private var m_doHideWhenReachDestination:Boolean;// = false
private var m_restoreY:Number;
private var m_nextSibling:CButtonGraphStatToggle;
private var m_hierarchicalLoc:Vector2D;
private var m_destinationY:Number;
private var m_displayName:String;
protected var m_controller:CGraphControl;
public var _background:MovieClip;
public function CButtonGraphStatToggle(_arg1:CGraphControl, _arg2:String, _arg3:uint, _arg4:String, _arg5:CButtonStatFolder=null, _arg6:Number=0){
m_isSelected = false;
m_doHideWhenReachDestination = false;
m_hierarchicalLoc = new Vector2D(0, 0);
super();
addEventListener(Event.ENTER_FRAME, onEnterFrame);
m_controller = _arg1;
m_displayName = _arg2;
m_parentButton = _arg5;
SetTextColors(0x999999, 0xCCCCCC, 0xFFFFFF, 0xFFFFFF);
Initialize(_arg2, null, _arg4);
_background.gotoAndStop("unselected");
DrawLineColorBar(_arg3);
}
public function IsSelected():Boolean{
return (m_isSelected);
}
public function get _buttonX():Number{
return (m_hierarchicalLoc.x);
}
public function UpdateEnabled():Boolean{
var _local1:Array;
var _local2:Boolean;
_local1 = CCoffeeShopGame._instance._shop.GetStatsAllTime(_statName);
_local2 = ((_local1) && ((_local1.length > 1)));
SetEnabled(_local2);
return (_local2);
}
override public function onMouseUp(_arg1:Event):void{
super.onMouseUp(_arg1);
if (IsEnabled()){
ToggleSelection();
};
}
public function set _buttonY(_arg1:Number):void{
m_hierarchicalLoc.y = _arg1;
}
protected function DrawLineColorBar(_arg1:uint):void{
var _local2:MovieClip;
_local2 = new MovieClip();
_local2.graphics.lineStyle(5, _arg1, 1, true, LineScaleMode.NORMAL, CapsStyle.NONE);
_local2.graphics.moveTo(109, (height / 2));
_local2.graphics.lineTo((109 + 20), (height / 2));
addChild(_local2);
}
public function set _buttonX(_arg1:Number):void{
m_hierarchicalLoc.x = _arg1;
}
public function SetY(_arg1:Number):void{
_buttonY = _arg1;
m_restoreY = _buttonY;
m_destinationY = _buttonY;
m_doHideWhenReachDestination = false;
}
public function get _parentButton():CButtonStatFolder{
return (m_parentButton);
}
public function get _statName():String{
return (m_displayName);
}
override public function onMouseOut(_arg1:Event):void{
super.onMouseOut(_arg1);
if (IsEnabled()){
m_controller.OnButtonOut(m_displayName);
};
}
public function get _nestleHeight():Number{
return (height);
}
public function ExpandFromParent(_arg1:Boolean):void{
visible = true;
m_destinationY = m_restoreY;
m_doHideWhenReachDestination = false;
if (_arg1){
_buttonY = m_restoreY;
};
}
public function get _buttonY():Number{
return (m_hierarchicalLoc.y);
}
public function ToggleSelection():void{
SetSelected(!(m_isSelected));
}
public function get _nextSibling():CButtonGraphStatToggle{
return (m_nextSibling);
}
public function AdjustNestle(_arg1:CButtonGraphStatToggle, _arg2:Boolean=false):void{
if (_arg1){
m_destinationY = ((_arg1._destinationY + _arg1._nestleHeight) + 4);
m_doHideWhenReachDestination = false;
if (_arg2){
_buttonY = m_destinationY;
};
};
if (m_nextSibling){
m_nextSibling.AdjustNestle(this, _arg2);
};
}
public function SetNextSibling(_arg1:CButtonGraphStatToggle):void{
m_nextSibling = _arg1;
}
public function onEnterFrame(_arg1:Event):void{
if (Math.abs((_buttonY - m_destinationY)) > 2){
_buttonY = MathUtil.Lerp(_buttonY, m_destinationY, 0.4);
} else {
if (m_doHideWhenReachDestination){
visible = false;
};
};
if (m_parentButton){
x = (m_parentButton.x + _buttonX);
y = (m_parentButton.y + _buttonY);
} else {
x = _buttonX;
y = _buttonY;
};
}
public function CollapseIntoParent(_arg1:Boolean):void{
if (_parentButton){
m_destinationY = 0;
m_doHideWhenReachDestination = true;
if (_arg1){
_buttonY = m_destinationY;
visible = false;
};
};
}
public function get _destinationY():Number{
return (m_destinationY);
}
override public function onMouseOver(_arg1:Event):void{
super.onMouseOver(_arg1);
if (IsEnabled()){
m_controller.OnButtonOver(m_displayName);
};
}
public function SetSelected(_arg1:Boolean):void{
m_isSelected = _arg1;
if (m_isSelected){
_background.gotoAndStop("selected");
m_controller.OnButtonSelected(m_displayName);
} else {
_background.gotoAndStop("unselected");
m_controller.OnButtonUnselected(m_displayName);
};
}
}
}//package
Section 56
//CButtonLeaderboard (CButtonLeaderboard)
package {
import flash.events.*;
import flash.display.*;
public class CButtonLeaderboard extends MovieClip {
protected var _fnCallOnClicked:Function;
public function OnMouseUp(_arg1:MouseEvent):void{
if (_fnCallOnClicked != null){
_fnCallOnClicked();
};
OnMouseOver(_arg1);
}
public function OnMouseOut(_arg1:MouseEvent):void{
gotoAndStop("out");
}
public function OnMouseDown(_arg1:MouseEvent):void{
gotoAndStop("down");
}
public function Initialize(_arg1:Function){
_fnCallOnClicked = _arg1;
addEventListener(MouseEvent.MOUSE_OVER, OnMouseOver);
addEventListener(MouseEvent.MOUSE_OUT, OnMouseOut);
addEventListener(MouseEvent.MOUSE_DOWN, OnMouseDown);
addEventListener(MouseEvent.MOUSE_UP, OnMouseUp);
gotoAndStop("out");
}
public function OnMouseOver(_arg1:MouseEvent):void{
gotoAndStop("over");
}
}
}//package
Section 57
//CButtonLeaderboardClose (CButtonLeaderboardClose)
package {
public class CButtonLeaderboardClose extends CButtonLeaderboard {
}
}//package
Section 58
//CButtonLeaderboardExtreme (CButtonLeaderboardExtreme)
package {
public class CButtonLeaderboardExtreme extends CButtonLeaderboard {
}
}//package
Section 59
//CButtonLeaderboardStar (CButtonLeaderboardStar)
package {
public class CButtonLeaderboardStar extends CButtonLeaderboard {
}
}//package
Section 60
//CButtonLeaveEndOfDay (CButtonLeaveEndOfDay)
package {
public class CButtonLeaveEndOfDay extends CButton {
public function CButtonLeaveEndOfDay(){
SetTextColors(0x1E1E1E, 0x999999, 0xCCCCCC, 0xFFFFFF);
}
}
}//package
Section 61
//CButtonMenu (CButtonMenu)
package {
import flash.display.*;
public class CButtonMenu extends CButton {
public var _waftingBackground:MovieClip;
public function CButtonMenu(){
_waftingBackground.y = (_waftingBackground.y - y);
SetTextColors(15322031, 0x666666, 0x333333, 0x333333);
SetSounds("menu_button_beep2", "menu_button_beep1");
}
}
}//package
Section 62
//CButtonPlay (CButtonPlay)
package {
public class CButtonPlay extends CButton {
public function CButtonPlay(){
SetSounds("menu_button_beep2", "menu_button_beep1");
}
}
}//package
Section 63
//CButtonPlayCommit (CButtonPlayCommit)
package {
public class CButtonPlayCommit extends CButtonMenu {
}
}//package
Section 64
//CButtonQuit (CButtonQuit)
package {
public class CButtonQuit extends CButton {
public function CButtonQuit(){
SetTextColors(0x1E1E1E, 0x999999, 0xCCCCCC, 0xFFFFFF);
}
}
}//package
Section 65
//CButtonStartTheDay (CButtonStartTheDay)
package {
public class CButtonStartTheDay extends CButton {
public function CButtonStartTheDay(){
SetTextColors(0x1E1E1E, 0x999999, 0xCCCCCC, 0xFFFFFF);
}
}
}//package
Section 66
//CButtonStatFolder (CButtonStatFolder)
package {
public class CButtonStatFolder extends CButtonGraphStatToggle {
private var m_childButtons:Array;
private var m_initialHeight:Number;
public function CButtonStatFolder(_arg1:CGraphControl, _arg2:String, _arg3:uint, _arg4:String, _arg5:CButtonStatFolder=null, _arg6:Number=0){
m_childButtons = new Array();
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
m_initialHeight = height;
}
override public function UpdateEnabled():Boolean{
SetEnabled(true);
return (false);
}
public function AddChildButton(_arg1:CButtonGraphStatToggle, _arg2:Number){
if (m_childButtons.length > 0){
m_childButtons[(m_childButtons.length - 1)].SetNextSibling(_arg1);
};
m_childButtons.push(_arg1);
parent.addChild(_arg1);
_arg1._buttonX = 18;
_arg1.SetY(_arg2);
}
override protected function DrawLineColorBar(_arg1:uint):void{
}
override public function get _nestleHeight():Number{
var _local1:Number;
var _local2:uint;
var _local3:CButtonGraphStatToggle;
if (m_isSelected){
_local1 = 0;
_local2 = 0;
while (_local2 < m_childButtons.length) {
_local3 = m_childButtons[_local2];
_local1 = (_local1 + (_local3._nestleHeight + 4));
_local2++;
};
return ((m_initialHeight + _local1));
//unresolved jump
};
return (m_initialHeight);
}
public function FixupChildren():void{
var _local1:uint;
var _local2:CButtonGraphStatToggle;
_local1 = 0;
while (_local1 < m_childButtons.length) {
_local2 = m_childButtons[_local1];
if (parent.getChildIndex(_local2) > parent.getChildIndex(this)){
parent.swapChildren(_local2, this);
};
_local1++;
};
}
public function CollapseExpand(_arg1:Boolean, _arg2:Boolean=false):void{
var _local3:uint;
m_isSelected = !(_arg1);
_local3 = 0;
while (_local3 < m_childButtons.length) {
if (_arg1){
m_childButtons[_local3].CollapseIntoParent(_arg2);
} else {
m_childButtons[_local3].ExpandFromParent(_arg2);
};
_local3++;
};
if (_nextSibling){
_nextSibling.AdjustNestle(this, _arg2);
};
}
override public function SetSelected(_arg1:Boolean):void{
m_isSelected = _arg1;
if (m_isSelected){
_background.gotoAndStop("selected");
m_controller.UnselectAllOtherFolders(this);
} else {
_background.gotoAndStop("unselected");
};
CollapseExpand(!(m_isSelected));
}
}
}//package
Section 67
//CButtonTutorialBack (CButtonTutorialBack)
package {
public class CButtonTutorialBack extends CButton {
}
}//package
Section 68
//CButtonTutorialNext (CButtonTutorialNext)
package {
public class CButtonTutorialNext extends CButton {
}
}//package
Section 69
//CButtonUndoLastPurchase (CButtonUndoLastPurchase)
package {
public class CButtonUndoLastPurchase extends CButton {
public function CButtonUndoLastPurchase(){
SetTextColors(0x1E1E1E, 0x999999, 0xCCCCCC, 0xFFFFFF);
}
}
}//package
Section 70
//CCheckbox (CCheckbox)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class CCheckbox extends MovieClip {
public var _myText:TextField;
public var _myCheck:MovieClip;
private var _checked:Boolean;// = false
public var _myHighlight:MovieClip;
public function CCheckbox(){
_checked = false;
super();
}
public function onMouseOver(_arg1:Event):void{
_myHighlight.gotoAndStop("over");
}
public function set _isChecked(_arg1:Boolean):void{
if (_checked != _arg1){
_checked = _arg1;
};
_myCheck.visible = _checked;
}
public function onMouseUp(_arg1:Event):void{
_isChecked = !(_isChecked);
_myHighlight.gotoAndStop("over");
}
public function onMouseOut(_arg1:Event):void{
_myHighlight.gotoAndStop("out");
}
public function get _isChecked():Boolean{
return (_checked);
}
public function Initialize(_arg1:String, _arg2:Boolean){
_myText.text = _arg1;
addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
_myHighlight.gotoAndStop("out");
_isChecked = _arg2;
}
public function onMouseDown(_arg1:Event):void{
_myHighlight.gotoAndStop("down");
}
}
}//package
Section 71
//CCoffeeLoader (CCoffeeLoader)
package {
import flash.events.*;
import flash.display.*;
public class CCoffeeLoader extends MovieClip {
public var _cup:MovieClip;
public var _attractMode:MovieClip;
public function CCoffeeLoader(){
addFrameScript(20, frame21);
stop();
ConfigureListeners(parent.loaderInfo);
}
private function OnDisappearDone():void{
stop();
CCoffeeShopApp(parent).OnLoadDone();
}
private function initHandler(_arg1:Event):void{
}
private function ConfigureListeners(_arg1:IEventDispatcher):void{
_arg1.addEventListener(Event.COMPLETE, completeHandler);
_arg1.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
_arg1.addEventListener(Event.INIT, initHandler);
_arg1.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
_arg1.addEventListener(Event.OPEN, openHandler);
_arg1.addEventListener(ProgressEvent.PROGRESS, progressHandler);
}
private function httpStatusHandler(_arg1:HTTPStatusEvent):void{
}
private function progressHandler(_arg1:ProgressEvent):void{
_cup.gotoAndStop(int(((100 * _arg1.bytesLoaded) / _arg1.bytesTotal)));
}
private function ioErrorHandler(_arg1:IOErrorEvent):void{
}
function frame21(){
OnDisappearDone();
}
private function openHandler(_arg1:Event):void{
}
private function completeHandler(_arg1:Event):void{
MovieClip(parent).stop();
gotoAndPlay("disappear");
}
}
}//package
Section 72
//CCoffeeLogo (CCoffeeLogo)
package {
import flash.display.*;
public class CCoffeeLogo extends MovieClip {
public var _steamA:MovieClip;
public var _steamC:MovieClip;
public var _steamB:MovieClip;
public function CCoffeeLogo(){
_steamA._scrolling.gotoAndPlay(0);
_steamA._maskA.gotoAndPlay(0);
_steamB._scrolling.gotoAndPlay(50);
_steamB._maskA.gotoAndPlay(50);
_steamC._scrolling.gotoAndPlay(111);
_steamC._maskA.gotoAndPlay(111);
}
}
}//package
Section 73
//CCoffeeShopApp (CCoffeeShopApp)
package {
import flash.events.*;
import flash.net.*;
import flash.display.*;
import flash.text.*;
import flash.ui.*;
import flash.system.*;
public class CCoffeeShopApp extends MovieClip implements IMovieClipFreshHost {
private var m_mainLeaderboardSystem;
private var _gameOverFinalCash:int;
public var _textVersion:TextField;
private var _isGameAborted:Boolean;// = false
private var _gameOverDaysPlayed:Number;
public var _gameLoader:CCoffeeLoader;
public var _mode:String;// = "loading"
private var m_submittedPlayerName:String;
public var _submitHighScore:CLeaderboardScoreSubmitDisplay;
public var _errorAndWaitDisplay:CLeaderboardErrorWaitDisplay;
private var _isConsideredWin:Boolean;
private var _theShopName:String;// = ""
private var _doShowTutorial:Boolean;// = true
public var _menuIntro:CMenuIntro;
private var _isGameOver:Boolean;// = false
public var _game:CCoffeeShopGame;
private var m_weeklyFetchLeaderboardSystem;
private static var s_instance:CCoffeeShopApp;
public function CCoffeeShopApp(){
var _local1:Boolean;
var _local2:int;
_mode = "loading";
_theShopName = "";
_doShowTutorial = true;
_isGameOver = false;
_isGameAborted = false;
m_mainLeaderboardSystem = new CLeaderboardSystem("coffee");
m_weeklyFetchLeaderboardSystem = new CLeaderboardSystem("coffee");
super();
addFrameScript(8, frame9, 33, frame34, 48, frame49, 60, frame61, 70, frame71);
s_instance = this;
_local1 = !(HandlePlayerVersionIssues());
if (_local1){
return;
};
new CRandom(new Date().getMilliseconds());
new CCoffeeSound(this);
new CMetaStatsCollector();
_local2 = 0;
if (((!((_cookie == null))) && (_cookie.nVisits))){
_local2 = _cookie.nVisits;
};
_local2++;
CMetaStatsCollector._instance.RecordVisit(_local2, root.loaderInfo.url);
_cookie.nVisits = _local2;
if (((!((_cookie == null))) && (!((_cookie.lastLeaderboardName == null))))){
m_submittedPlayerName = _cookie.lastLeaderboardName;
};
gotoAndPlay("loaderwait");
stage.addEventListener(KeyboardEvent.KEY_UP, OnKeyUp);
}
public function get _shopName():String{
return (_theShopName);
}
public function OnGameOver(_arg1:Boolean, _arg2:int, _arg3:uint):void{
_isGameOver = true;
_isGameAborted = false;
_isConsideredWin = _arg1;
_gameOverFinalCash = _arg2;
_gameOverDaysPlayed = _arg3;
gotoAndPlay("game disappear");
}
function frame71(){
OnDoneHidingEnterHighScores();
}
public function OnAbortGame():void{
CMetaStatsCollector._instance.RecordGameAbort();
CCoffeeSound._instance.FadeAllAmbients();
_isGameOver = true;
_isGameAborted = true;
gotoAndPlay("game disappear");
}
public function GotoGame(_arg1:String, _arg2:Boolean):void{
_theShopName = _arg1;
_doShowTutorial = _arg2;
_isGameOver = false;
_mode = "game";
CMetaStatsCollector._instance.RecordGameStart();
gotoAndPlay("game");
}
function frame61(){
stop();
}
public function OnIntroMenuFrame():void{
stop();
}
public function OnChildConstructed(_arg1:CMovieClipFresh):void{
if (_arg1 == _submitHighScore){
_submitHighScore.Initialize(m_mainLeaderboardSystem, DoneEnteringHighScore, _errorAndWaitDisplay);
};
}
public function OnMenuIntroDoneInitializing(_arg1:CMenuIntro):void{
if (_isGameOver){
if (!_isGameAborted){
_arg1.JumpToHighScores();
};
_isGameOver = false;
};
}
public function get _mainLeaderboardSystem():CLeaderboardSystem{
return (m_mainLeaderboardSystem);
}
public function OnDoneHidingEnterHighScores():void{
_mode = "menu";
OnGameOverGotoHighScores();
}
public function get _showTutorial():Boolean{
return (_doShowTutorial);
}
public function get _leaderboardPlayerName():String{
return (m_submittedPlayerName);
}
public function get _weeklyFetchLeaderboardSystem():CLeaderboardSystem{
return (m_weeklyFetchLeaderboardSystem);
}
function frame9(){
OnIntroMenuFrame();
}
public function OnGameOverGotoHighScores():void{
_mode = "menu";
gotoAndStop("intromenu");
}
function frame34(){
OnGameDoneAppearing();
}
public function OnLoadDone():void{
CMetaStatsCollector._instance.RecordLoaded();
_mode = "menu";
gotoAndStop("intromenu");
}
private function OnKeyUp(_arg1:KeyboardEvent):void{
if (((((_arg1.ctrlKey) && (_arg1.shiftKey))) && ((_arg1.keyCode == Keyboard.END)))){
_textVersion.text = ("ver " + GetGameVersionString());
};
}
public function OnGameDoneDisappearing():void{
stop();
_mode = "menu";
if (((!(_isGameAborted)) && (_isConsideredWin))){
gotoAndPlay("enter high score");
} else {
OnGameOverGotoHighScores();
};
}
public function OnGameDoneAppearing():void{
stop();
_game.OnDoneAppearing();
}
public function GetGameOverScore():int{
return (_gameOverFinalCash);
}
function frame49(){
OnGameDoneDisappearing();
}
public function DoneEnteringHighScore(_arg1:int):void{
m_submittedPlayerName = _submitHighScore.GetSubmittedPlayerName();
if (m_submittedPlayerName){
_cookie.lastLeaderboardName = m_submittedPlayerName;
};
CCoffeeSound._instance.FadeAllAmbients();
gotoAndPlay("hideEnterHighScore");
}
protected function HandlePlayerVersionIssues():Boolean{
var _local1:Array;
var _local2:String;
var _local3:int;
var _local4:int;
_local1 = Capabilities.version.split(" ").join(",").split(",");
_local2 = _local1[0];
_local3 = _local1[1];
_local4 = _local1[3];
if ((((_local3 < 9)) || ((_local4 < 45)))){
_textVersion.text = (((("You have version " + _local3) + ".0.") + _local4) + ".0.");
stop();
return (false);
};
return (true);
}
protected static function GetNumberString(_arg1:Number, _arg2:int=1):String{
var _local3:Number;
_local3 = Math.pow(10, _arg2);
return (String((int((_arg1 * _local3)) / _local3)));
}
public static function GetGameVersionString():String{
return ("1.7");
}
public static function get _cookie():Object{
if (SharedObject.getLocal("CoffeeShop") != null){
return (SharedObject.getLocal("CoffeeShop").data);
};
return (null);
}
public static function get _instance():CCoffeeShopApp{
return (s_instance);
}
protected static function CashAmountToString(_arg1:int):String{
var _local2:String;
var _local3:Number;
var _local4:int;
var _local5:uint;
var _local6:Boolean;
var _local7:Number;
var _local8:int;
_local3 = MathUtil.Sign(_arg1);
_arg1 = Math.abs(_arg1);
_local4 = (_arg1 % 100);
_arg1 = (_arg1 / 100);
_local2 = ("." + ToStringPadZerosLeft(_local4, 2));
_local5 = uint(_arg1);
if (_local5 == 0){
_local2 = ("0" + _local2);
};
_local6 = true;
while (_local5 > 0) {
_local7 = (_local5 % 1000);
_local5 = (_local5 / 1000);
if (!_local6){
_local2 = ("," + _local2);
};
_local8 = 3;
if (_local5 == 0){
_local8 = 0;
};
_local2 = (ToStringPadZerosLeft(_local7, _local8) + _local2);
_local6 = false;
};
if (_local3 < 0){
_local2 = ("-" + _local2);
};
return (_local2);
}
public static function ConvertUnitToString(_arg1:String, _arg2:Number):String{
var _local3:int;
var _local4:Number;
var _local5:int;
var _local6:Number;
var _local7:String;
var _local8:String;
var _local9:String;
if (_arg1 == "Cash"){
return (("$" + CashAmountToString(_arg2)));
};
if ((((_arg1 == "Days")) || ((_arg1 == "degrees")))){
return (String(int(_arg2)));
};
if ((((((_arg1 == "tsp")) || ((_arg1 == "cups")))) || ((_arg1 == "Inventory")))){
return (GetNumberString(_arg2, 1));
};
if (_arg1 == "Reputation"){
return ((String(int((_arg2 * 100))) + "%"));
};
if (_arg1 == "Hours"){
_arg2 = (_arg2 + 6);
_local3 = int(_arg2);
if (_local3 > 12){
_local3 = (_local3 - 12);
};
return (String(_local3));
//unresolved jump
};
if (_arg1 == "TimeOfDay"){
_local4 = (7 + (_arg2 * 12));
_local5 = _local4;
_local6 = (60 * (_local4 - _local5));
_local6 = (Math.floor((_local6 / 15)) * 15);
_local7 = String(_local5);
if (_local5 > 12){
_local7 = String((_local5 - 12));
};
if (_local5 == 0){
_local7 = "12";
};
while (_local7.length < 2) {
_local7 = ("0" + _local7);
};
_local8 = ToStringPadZerosLeft(_local6, 2);
_local9 = "AM";
if (_local5 > 11){
_local9 = "PM";
};
return (((((_local7 + ":") + _local8) + " ") + _local9));
//unresolved jump
};
return (String(_arg2));
}
public static function ToStringPadZerosLeft(_arg1:uint, _arg2:uint):String{
var _local3:String;
_local3 = "";
while ((((_local3.length < _arg2)) || ((_arg1 > 0)))) {
if (_arg1 > 0){
_local3 = (String((_arg1 % 10)) + _local3);
_arg1 = (_arg1 / 10);
} else {
_local3 = ("0" + _local3);
};
};
return (_local3);
}
public static function PickFromWeightedArray(_arg1:Array):int{
var _local2:Number;
var _local3:int;
var _local4:Number;
var _local5:int;
_local2 = Math.random();
if (CRandom._instance != null){
_local2 = CRandom._instance.GetRandom();
};
_local3 = _arg1.length;
_local4 = 0;
_local5 = 0;
while (_local5 < _local3) {
_local4 = (_local4 + _arg1[_local5]._weight);
_local5++;
};
_local2 = (_local2 * _local4);
_local4 = 0;
_local5 = 0;
while (_local5 < _local3) {
_local4 = (_local4 + _arg1[_local5]._weight);
if (_local4 >= _local2){
return (_local5);
};
_local5++;
};
return (-1);
}
public static function get _stage():Stage{
return (_instance.stage);
}
}
}//package
Section 74
//CCoffeeShopGame (CCoffeeShopGame)
package {
import flash.events.*;
import fl.motion.*;
import flash.utils.*;
import flash.ui.*;
public class CCoffeeShopGame extends CMovieClipFresh {
private var _zoomServing:Number;// = 1.25
private var _flashFramesPerDay:Number;
private var _hasBegunApproachingEndOfDay:Boolean;// = false
public var _hud:CHUD;
private var _numCustomersPerDay:uint;// = 24
private var _gamePhase:String;// = "initial"
private var _tomorrowsTemperature:int;
private var _zoomPreparing:Number;// = 1
private var _realWorldSecondsPerDay:Number;// = 40
private var _theTime:Number;// = 0
public var _scene:CScene;
private var _temperature:int;// = 51
public var _tutorial:CTutorial;
private var _maxDays:uint;// = 14
private var _mapOneTimeAlertMarkers:Array;
private var _skippingToEndOfDay:Boolean;// = false
private var _temperatureWaveFrequency:Number;// = -2
private var _myShop:CShop;
private var _random:CRandom;
private static var s_instance:CCoffeeShopGame;
public function CCoffeeShopGame(){
_temperature = 51;
_temperatureWaveFrequency = -2;
_theTime = 0;
_hasBegunApproachingEndOfDay = false;
_gamePhase = "initial";
_realWorldSecondsPerDay = 40;
_flashFramesPerDay = (_realWorldSecondsPerDay * 30);
_zoomServing = 1.25;
_zoomPreparing = 1;
_skippingToEndOfDay = false;
_numCustomersPerDay = 24;
_maxDays = 14;
_mapOneTimeAlertMarkers = new Array();
super();
s_instance = this;
_random = CRandom._instance;
if (!_random){
_random = new CRandom(getTimer());
};
_temperatureWaveFrequency = _random.GetNumInRange(-2.2, -1.8);
stop();
_myShop = new CShop(CCoffeeShopApp._instance._shopName);
_hud.stop();
_hud._weatherDisplay.UpdateDisplay();
_scene.SetZoom(_zoomPreparing);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
stage.addEventListener(KeyboardEvent.KEY_UP, OnKeyUp);
}
public function get _isTimePaused():Boolean{
return (!((_gamePhase == "serving")));
}
public function get _initialCash():int{
return (3000);
}
public function EnterServingMode():void{
_hud.EnterServingMode();
_shop.OnStartOfDay();
_gamePhase = "serving";
_scene.SetTargetZoom(_zoomServing, 3);
_scene.StartMakingCustomers(_numCustomersPerDay, (_flashFramesPerDay * 0.75));
CCoffeeSound._instance.PlaySound("morning");
CCoffeeSound._instance.PlayMusic("music_bold", 0.5, 3, int.MAX_VALUE, 5219);
CCoffeeSound._instance.FadeOutMusic("music_calm", 2);
}
protected function GetProgressMessage():String{
if ((_maxDays - 2) == _dayNumber){
return ("One Day Left!\rTomorrow is your last day. Make as much money as you can!");
};
if ((((_myShop._cash >= 100000)) && ((_mapOneTimeAlertMarkers[0] == undefined)))){
_mapOneTimeAlertMarkers[0] = _theTime;
return ("Bonanza!\rYou've Cleared a Grand!");
};
if ((((_myShop._cash >= 50000)) && ((_mapOneTimeAlertMarkers[1] == undefined)))){
_mapOneTimeAlertMarkers[1] = _theTime;
return ("Wow! You've made more than\rFive Hundred Smackeroos!");
};
if ((((_myShop._cash >= (_initialCash * 10))) && ((_mapOneTimeAlertMarkers[2] == undefined)))){
_mapOneTimeAlertMarkers[2] = _theTime;
return ("Congratulations!\rYou've made Ten Times the money you started with!");
};
if ((((_myShop._cash >= 10000)) && ((_mapOneTimeAlertMarkers[3] == undefined)))){
_mapOneTimeAlertMarkers[3] = _theTime;
return ("Congratulations!\rYou broke the $100 mark!");
};
if (_myShop.GetDailyCupsSold() == 0){
return ("The Big Zilcher!\rYou sold no coffee today. Try lowering the price.");
};
if ((((_myShop._reputation <= -0.5)) && ((_mapOneTimeAlertMarkers[10] == undefined)))){
_mapOneTimeAlertMarkers[11] = _theTime;
return ("Your Reputation is Terrible!\rWord around town: You're a crook.\rLower the price or increase quality to improve your reputation.");
};
if ((((_myShop._reputation <= -0.05)) && ((_mapOneTimeAlertMarkers[12] == undefined)))){
_mapOneTimeAlertMarkers[12] = _theTime;
return ("Yuck Alert!\rCustomers say you charge too much for bad-tasting coffee.\rLower the price or increase quality to improve your reputation.");
};
if ((((_myShop._reputation >= 0.1)) && ((_mapOneTimeAlertMarkers[13] == undefined)))){
_mapOneTimeAlertMarkers[13] = _theTime;
return ("People Like You.\rCustomers say your coffee is priced just right.\rGood on ya!");
};
if ((((_myShop._reputation >= 0.5)) && ((_mapOneTimeAlertMarkers[14] == undefined)))){
_mapOneTimeAlertMarkers[14] = _theTime;
return ("You're the Talk of the Town!\rCustomers love your coffee and your prices.");
};
if (_myShop.GetNumServingsAvailable() == 0){
return ("You Ran Out of Stock.\rMake sure to buy enough inventory at the start of each day.\rOtherwise, you're just throwing away sales!");
};
if (_myShop.GetDailyProfitsLosses() >= 2000){
return ("Wow! Strong showing today.");
};
if (_myShop.GetDailyProfitsLosses() >= 1000){
return ((("Great! You made " + CCoffeeShopApp.ConvertUnitToString("Cash", _myShop.GetDailyProfitsLosses())) + " today."));
};
if (_myShop.GetDailyProfitsLosses() >= 500){
return ((("Way to go! You made " + CCoffeeShopApp.ConvertUnitToString("Cash", _myShop.GetDailyProfitsLosses())) + " today."));
};
if (_myShop.GetDailyProfitsLosses() > 0){
return ("Not bad. You better than broke even today.");
};
if (_myShop.GetDailyProfitsLosses() <= -2000){
return ((("Oh No! You lost " + CCoffeeShopApp.ConvertUnitToString("Cash", _myShop.GetDailyProfitsLosses())) + " today.\rTry to stay in the black tomorrow."));
};
if (_myShop.GetDailyProfitsLosses() <= -1000){
return ((("Rough day today. You lost " + CCoffeeShopApp.ConvertUnitToString("Cash", _myShop.GetDailyProfitsLosses())) + ".\rDon't worry - you'll turn it around."));
};
if (_myShop.GetDailyProfitsLosses() <= -500){
return ("Slow day today. Tomorrow'll be better.");
};
if (_myShop.GetDailyProfitsLosses() <= 0){
return ("Bad news: You lost money today.\rGood news: You didn't lose much.");
};
return ("You're doing great!");
}
public function OnDoneAppearing():void{
stop();
}
public function get _numDaysPerGame():uint{
return (_maxDays);
}
public function get _hour12():int{
if (_hour24 > 12){
return ((_hour24 - 12));
};
return (_hour24);
}
public function AbortGame():void{
CCoffeeSound._instance.FadeAllAmbients();
CCoffeeSound._instance.FadeOutMusic("music_bold", 3);
CCoffeeSound._instance.FadeOutMusic("music_calm", 2);
CCoffeeShopApp._instance.OnAbortGame();
}
public function GetGameOverMessage():String{
var _local1:Number;
if (IsGameWon()){
_local1 = (_myShop._cash - _initialCash);
if (_local1 > 0){
return ((((("You Win!\rYou Made " + CCoffeeShopApp.ConvertUnitToString("Cash", _local1)) + " in ") + _maxDays) + " Days!\rClick Continue to post your high score."));
};
return ((((("Well, You Survived.\rYou ended up with " + CCoffeeShopApp.ConvertUnitToString("Cash", _myShop._cash)) + " after ") + _maxDays) + " days.\rClick Continue to post your score."));
} else {
};
return (!NULL!);
}
override public function FirstFrameInitialize(_arg1:Event):void{
EnterPreparingMode();
super.FirstFrameInitialize(_arg1);
}
protected function BeginApproachingEndOfDay():void{
_scene.SetTargetZoom(_zoomPreparing, 4);
_hasBegunApproachingEndOfDay = true;
}
public function get _gameTime():Number{
return (_theTime);
}
public function get _hour24():int{
return ((7 + int((_gameTime * 12))));
}
public function IsGameOver():Boolean{
return (((IsGameWon()) || (IsGameLost())));
}
protected function UpdateTime():void{
var _local1:int;
if (!_isTimePaused){
_local1 = _hour24;
_theTime = (_theTime + (1 / _flashFramesPerDay));
if (_timeOfDay > 0.99){
OnEndOfDay();
} else {
if (_hour24 > _local1){
_shop.RecordHourlyStats();
};
if ((((_timeOfDay > 0.8)) && (!(_hasBegunApproachingEndOfDay)))){
BeginApproachingEndOfDay();
};
};
};
}
protected function OnEndOfDay():void{
var _local1:String;
var _local2:String;
_hasBegunApproachingEndOfDay = false;
_gamePhase = "end of day";
_tomorrowsTemperature = CRandom._instance.GetIntInRange(_minTemperature, _maxTemperature);
CCoffeeShopGame._instance._shop.OnEndOfDay();
_local1 = GetProgressMessage();
_local2 = DoSpoilage();
if (IsGameOver()){
_local1 = GetGameOverMessage();
_local2 = "";
};
_hud.GoToEndOfDay((_dayNumber + 1), _local1, _local2, _tomorrowsTemperature, GetDescriptionForTemperature(_tomorrowsTemperature), GetColorForTemperature(_tomorrowsTemperature));
}
protected function DoSpoilage():String{
return (_myShop.DoNightlySpoilage());
}
protected function ForceSkipToEndOfDay():void{
_skippingToEndOfDay = true;
while (_gamePhase == "serving") {
UpdateTime();
_scene.MaybeMakeCustomer();
};
_skippingToEndOfDay = false;
}
public function GetColorForTemperature(_arg1:int):uint{
return (Color.interpolateColor(8684799, 0xE68900, ((_arg1 - CCoffeeShopGame._instance._minTemperature) / (CCoffeeShopGame._instance._maxTemperature - CCoffeeShopGame._instance._minTemperature))));
}
public function get _phase():String{
return (_gamePhase);
}
public function get _dayNumber():int{
return (int(_gameTime));
}
public function IsGameWon():Boolean{
return ((_dayNumber >= (_maxDays - 1)));
}
public function get _isAnteMeridian():Boolean{
return ((_hour24 < 12));
}
public function get _maxTemperature():int{
return (80);
}
public function get _temperatureFarenheit():int{
return (_temperature);
}
public function GetDescriptionForTemperature(_arg1:int):String{
var _local2:String;
_local2 = "freezing";
if (_arg1 > 32){
_local2 = "cold";
};
if (_arg1 > 50){
_local2 = "cool";
};
if (_arg1 > 65){
_local2 = "warm";
};
return (_local2);
}
public function onEnterFrame(_arg1:Event):void{
UpdateTime();
_hud._weatherDisplay.UpdateDisplay();
}
public function IsGameLost():Boolean{
var _local1:Array;
var _local2:Array;
var _local3:Array;
var _local4:Number;
var _local5:uint;
var _local6:Number;
_local1 = _myShop.GetMinimalRecipe();
_local2 = new Array();
_local2[0] = Math.max(0, (1 - _myShop.GetInventoryAmount("Cups")));
_local2[1] = Math.max(0, (_local1["Coffee"] - _myShop.GetInventoryAmount("Coffee")));
_local2[2] = Math.max(0, (_local1["Milk"] - _myShop.GetInventoryAmount("Milk")));
_local2[3] = Math.max(0, (_local1["Sugar"] - _myShop.GetInventoryAmount("Sugar")));
_local3 = _myShop.GetBuyTiers();
_local4 = 0;
_local5 = 0;
while (_local5 < _local3.length) {
_local6 = Math.ceil((_local2[_local5] / _local3[_local5][0]._amount));
_local4 = (_local4 + (_local6 * _local3[_local5][0]._cost));
_local5++;
};
return ((_local4 > _myShop._cash));
}
public function get _isSkippingToEndOfDay():Boolean{
return (_skippingToEndOfDay);
}
public function DoneWithEndOfDay():void{
CMetaStatsCollector._instance.RecordEndOfDay(_dayNumber);
if (IsGameOver()){
CCoffeeSound._instance.FadeOutMusic("music_bold", 3);
CCoffeeShopApp._instance.OnGameOver(IsGameWon(), _myShop._cash, _dayNumber);
return;
};
EnterPreparingMode();
_theTime = Math.ceil(_theTime);
_temperature = _tomorrowsTemperature;
_scene._realScene.SetWeather(GetWeatherTagForTemperature(_temperature));
}
public function OnKeyUp(_arg1:KeyboardEvent):void{
if (((((_arg1.ctrlKey) && (_arg1.shiftKey))) && ((_arg1.keyCode == Keyboard.UP)))){
_theTime = (_theTime + 1);
};
if (_phase == "serving"){
if (((((_arg1.ctrlKey) && (_arg1.shiftKey))) && ((_arg1.keyCode == Keyboard.SPACE)))){
ForceSkipToEndOfDay();
};
};
}
public function get _shop():CShop{
return (_myShop);
}
public function get _minTemperature():int{
return (20);
}
public function GetWeatherTagForTemperature(_arg1:int):String{
var _local2:String;
_local2 = "cold";
if (_arg1 > 32){
_local2 = "rainy";
};
if (_arg1 > 50){
_local2 = "fair";
};
if (_arg1 > 65){
_local2 = "hot";
};
return (_local2);
}
public function EnterPreparingMode():void{
_hud.EnterPreparingMode();
_gamePhase = "preparing";
CCoffeeSound._instance.PlayMusic("music_calm", 0.4, 5, int.MAX_VALUE);
CCoffeeSound._instance.FadeOutMusic("music_bold", 3);
}
public function get _timeOfDay():Number{
return ((_gameTime - int(_gameTime)));
}
public static function get _instance():CCoffeeShopGame{
return (s_instance);
}
}
}//package
Section 75
//CCoffeeSound (CCoffeeSound)
package {
import flash.events.*;
import flash.media.*;
import flash.utils.*;
public class CCoffeeSound {
private var m_arrQueuedSounds:Array;
private var m_mapAmbientSounds:Array;
private var m_mapExistingSounds:Array;
private var m_mapMusicControllers:Array;
private var m_strCurrentAmbient:String;
private static var s_instance:CCoffeeSound;
public function CCoffeeSound(_arg1:IEventDispatcher){
m_mapExistingSounds = new Array();
m_mapMusicControllers = new Array();
m_mapAmbientSounds = new Array();
m_arrQueuedSounds = new Array();
super();
s_instance = this;
_arg1.addEventListener(Event.ENTER_FRAME, OnEnterFrame);
}
public function FadeAllAmbients():void{
var _local1:String;
for (_local1 in m_mapAmbientSounds) {
m_mapAmbientSounds[_local1].FadeOut(2);
};
m_strCurrentAmbient = null;
}
public function OnSoundFinished(_arg1:Event):void{
var _local2:String;
for (_local2 in m_mapExistingSounds) {
if (m_mapExistingSounds[_local2].sound == _arg1.target){
m_mapExistingSounds[_local2] = undefined;
break;
};
};
}
public function PlayAmbient(_arg1:String, _arg2:Number=0.5):void{
var sound:Sound;
var soundClass:Class;
var soundName = _arg1;
var maxVolume = _arg2;
if (m_strCurrentAmbient == soundName){
return;
};
if (m_mapAmbientSounds[m_strCurrentAmbient]){
m_mapAmbientSounds[m_strCurrentAmbient].FadeOut(2);
};
if (!m_mapAmbientSounds[soundName]){
try {
soundClass = Class(getDefinitionByName(soundName));
} catch(e:ReferenceError) {
return;
};
sound = new (soundClass);
m_mapAmbientSounds[soundName] = new CMusicController(sound, maxVolume, 2, int.MAX_VALUE);
} else {
m_mapAmbientSounds[soundName].Play(2, int.MAX_VALUE);
};
m_strCurrentAmbient = soundName;
}
public function PlayMusic(_arg1:String, _arg2:Number, _arg3:Number=0, _arg4:uint=0, _arg5:uint=0):void{
var sound:Sound;
var newMusicController:CMusicController;
var soundClass:Class;
var soundName = _arg1;
var maxVolume = _arg2;
var fadeInSeconds = _arg3;
var loopCount = _arg4;
var loopOffset = _arg5;
if (m_mapMusicControllers[soundName]){
m_mapMusicControllers[soundName].SetMaxVolume(maxVolume);
m_mapMusicControllers[soundName].Play(fadeInSeconds, loopCount, loopOffset);
return;
};
try {
soundClass = Class(getDefinitionByName(soundName));
} catch(e:ReferenceError) {
return;
};
sound = new (soundClass);
newMusicController = new CMusicController(sound, maxVolume, fadeInSeconds, loopCount, loopOffset);
m_mapMusicControllers[soundName] = newMusicController;
}
public function FadeOutMusic(_arg1:String, _arg2:Number):void{
if (m_mapMusicControllers[_arg1]){
m_mapMusicControllers[_arg1].FadeOut(_arg2);
};
}
public function OnEnterFrame(_arg1:Event):void{
var _local2:Number;
var _local3:uint;
var _local4:Object;
_local2 = (getTimer() / 1000);
_local3 = 0;
while (_local3 < m_arrQueuedSounds.length) {
_local4 = m_arrQueuedSounds[_local3];
if (_local2 >= _local4.playTime){
m_arrQueuedSounds.splice(_local3, 1);
_local3--;
PlaySound(_local4.soundName, _local4.volume, 0, _local4.quashedByPrior, _local4.interruptPrior);
};
_local3++;
};
}
public function PlaySound(_arg1:String, _arg2:Number=1, _arg3:Number=0, _arg4:Boolean=false, _arg5:Boolean=false):void{
var sound:Sound;
var newSoundChannel:SoundChannel;
var transform:SoundTransform;
var soundClass:Class;
var soundName = _arg1;
var volume = _arg2;
var leadingDelaySeconds = _arg3;
var quashedByPrior = _arg4;
var interruptPrior = _arg5;
if (leadingDelaySeconds > 0){
m_arrQueuedSounds.push({soundName:soundName, volume:volume, playTime:((getTimer() / 1000) + leadingDelaySeconds), quashedByPrior:quashedByPrior, interruptPrior:interruptPrior});
return;
};
if (quashedByPrior){
if (m_mapExistingSounds[soundName]){
return;
};
};
if (interruptPrior){
if (m_mapExistingSounds[soundName]){
m_mapExistingSounds[soundName].channel.stop();
};
};
try {
soundClass = Class(getDefinitionByName(soundName));
} catch(e:ReferenceError) {
return;
};
sound = new (soundClass);
newSoundChannel = sound.play();
transform = newSoundChannel.soundTransform;
transform.volume = volume;
newSoundChannel.soundTransform = transform;
newSoundChannel.addEventListener(Event.SOUND_COMPLETE, OnSoundFinished);
m_mapExistingSounds[soundName] = {sound:sound, channel:newSoundChannel};
}
public static function get _instance():CCoffeeSound{
return (s_instance);
}
}
}//package
Section 76
//CCustomer (CCustomer)
package {
import flash.events.*;
import flash.display.*;
public class CCustomer extends MovieClip {
private var _commitmentPrice:int;
private var _walkRateVertical:Number;// = 0
private var _considerWindowX:Number;
private var _kSatisfiedWithEquity:Number;// = 1
private var _state:String;// = "appearing"
private var _walkRate:Number;
private var _walkDirection:Number;// = 1
private static var s_idealRecipe:Array;
public function CCustomer(_arg1:Number=1, _arg2:Number=182, _arg3:Number=205, _arg4:Number=300, _arg5:Number=356, _arg6:Number=-101, _arg7:Number=96){
_walkRate = -(_lateralWalkSpeed);
_walkDirection = 1;
_walkRateVertical = 0;
_state = "appearing";
_kSatisfiedWithEquity = 1;
super();
if (s_idealRecipe == null){
s_idealRecipe = new Array();
s_idealRecipe["Coffee"] = 4;
s_idealRecipe["Milk"] = 2;
s_idealRecipe["Sugar"] = 4;
};
addEventListener(Event.ENTER_FRAME, onEnterFrame);
_considerWindowX = CRandom._instance.GetNumInRange(_arg6, _arg7);
gotoAndStop("walking");
_walkDirection = _arg1;
_walkRate = (-(_lateralWalkSpeed) * _walkDirection);
_walkRateVertical = 0;
scaleX = (scaleX * _walkDirection);
x = CRandom._instance.GetNumInRange((_walkDirection * _arg4), (_walkDirection * _arg5));
y = CRandom._instance.GetNumInRange(_arg2, _arg3);
if (((!((CCoffeeShopGame._instance == null))) && (CCoffeeShopGame._instance._isSkippingToEndOfDay))){
OnConsideringDone();
if (_state == "consuming"){
OnPurchasing();
OnConsumptionDone();
};
Destroy();
};
}
protected function GetDemand():Number{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = (1 - ((0.75 * (CCoffeeShopGame._instance._temperatureFarenheit - CCoffeeShopGame._instance._minTemperature)) / (CCoffeeShopGame._instance._maxTemperature - CCoffeeShopGame._instance._minTemperature)));
_local2 = (1 - ((CCoffeeShopGame._instance._shop._pricePerServing / 100) / (10 / 0.9)));
_local3 = CCoffeeShopGame._instance._shop._reputation;
_local4 = 0.4;
_local5 = ((_local1 * _local2) + (_local3 * _local4));
return (_local5);
}
public function NormalizePrice(_arg1:int):Number{
return (((_arg1 / 100) / 10));
}
public function get _lateralWalkSpeed():Number{
return (5);
}
public function AssessRecipeQuality(_arg1:Array):Number{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = MathUtil.Clamp((_arg1["Coffee"] / s_idealRecipe["Coffee"]), 0, 1);
_local3 = MathUtil.Clamp((_arg1["Milk"] / s_idealRecipe["Milk"]), 0, 1);
_local4 = MathUtil.Clamp((_arg1["Sugar"] / s_idealRecipe["Sugar"]), 0, 1);
_local5 = ((_local2 * _local3) * _local4);
return (_local5);
}
protected function DecideWantToPurchase():Boolean{
var _local1:Number;
var _local2:Boolean;
var _local3:String;
_local1 = GetDemand();
_local2 = (CRandom._instance.GetRandom() < _local1);
_local3 = GetDominantReasonForDemand(_local2);
CCoffeeShopGame._instance._scene.SpawnThoughtBubbleConsideration(this, _local3, _local2);
return (_local2);
}
public function OnDonePurchasing():void{
_walkRateVertical = _verticalWalkSpeed;
}
public function get _verticalWalkSpeed():Number{
return (1);
}
public function OnConsideringDone():void{
if ((((((((CCoffeeShopApp._instance._mode == "game")) && (!((CCoffeeShopGame._instance == null))))) && ((CCoffeeShopGame._instance._shop.GetNumServingsAvailable() > 0)))) && (DecideWantToPurchase()))){
_commitmentPrice = CCoffeeShopGame._instance._shop._pricePerServing;
_state = "consuming";
gotoAndStop("consuming");
_walkRateVertical = -(_verticalWalkSpeed);
} else {
_state = "exiting";
gotoAndStop("walking");
_walkRate = (-(_lateralWalkSpeed) * _walkDirection);
};
}
protected function GetDominantReasonForDemand(_arg1:Boolean):String{
var _local2:Array;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:int;
_local2 = new Array();
_local3 = (1 - ((0.75 * (CCoffeeShopGame._instance._temperatureFarenheit - CCoffeeShopGame._instance._minTemperature)) / (CCoffeeShopGame._instance._maxTemperature - CCoffeeShopGame._instance._minTemperature)));
_local4 = (1 - ((CCoffeeShopGame._instance._shop._pricePerServing / 100) / (10 / 0.9)));
_local5 = CCoffeeShopGame._instance._shop._reputation;
_local6 = 0.5;
_local2[0] = {_weight:_local3, _reason:"Weather"};
_local2[1] = {_weight:_local4, _reason:"Price"};
_local2[2] = {_weight:Math.abs((_local5 * _local6)), _reason:"Reputation"};
if (!_arg1){
_local2[0]._weight = (1 - _local2[0]._weight);
_local2[1]._weight = (1 - _local2[1]._weight);
if (_local5 > 0){
_local2[2]._weight = 0;
};
} else {
if (_local5 < 0){
_local2[2]._weight = 0;
};
};
_local7 = CCoffeeShopApp.PickFromWeightedArray(_local2);
return (_local2[_local7]._reason);
}
public function onEnterFrame(_arg1:Event):void{
var _local2:Boolean;
x = (x + _walkRate);
y = (y + _walkRateVertical);
if (_state == "appearing"){
_local2 = MathUtil.Equivalent(MathUtil.Sign((_considerWindowX - x)), _walkDirection);
if ((((CCoffeeShopApp._instance._mode == "game")) && ((((CCoffeeShopGame._instance == null)) || ((((CCoffeeShopGame._instance._shop.GetNumServingsAvailable() > 0)) && (_local2))))))){
_state = "considering";
_walkRate = 0;
gotoAndStop("considering");
};
};
if ((((((_walkRate < 0)) && ((x < -400)))) || ((((_walkRate > 0)) && ((x > 400)))))){
Destroy();
};
}
public function OnConsumptionDone():void{
var _local1:Number;
var _local2:String;
var _local3:uint;
_state = "reacting";
_walkRateVertical = 0;
_local1 = DecideReaction();
CCoffeeShopGame._instance._shop.AddReputation(_local1);
if (_local1 != 0){
_local2 = IdentifyChiefCommodityCausingReaction((_local1 < 0));
if (_local2 != ""){
CCoffeeShopGame._instance._scene.SpawnThoughtBubbleReaction(this, _local2, (_local1 > 0));
};
};
if (_local1 < -0.3){
gotoAndStop("reaction - vomiting");
_local3 = CRandom._instance.GetIntInRange(0, 4);
CCoffeeSound._instance.PlaySound(("reaction_vomit" + _local3), 0.4, 1);
} else {
if (_local1 < -0.1){
gotoAndStop("reaction - displeased");
CCoffeeSound._instance.PlaySound("reaction_displeased", 0.4, 0.75);
} else {
if (_local1 < 0.1){
gotoAndStop("reaction - middling");
CCoffeeSound._instance.PlaySound("reaction_middling", 0.2);
} else {
gotoAndStop("reaction - pleased");
CCoffeeSound._instance.PlaySound("reaction_pleased", 0.5);
};
};
};
}
public function OnWalkDownDone():void{
_walkRateVertical = 0;
}
protected function DecideReaction():Number{
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = AssessRecipeQuality(CCoffeeShopGame._instance._shop.GetRecipe());
_local2 = NormalizePrice(_commitmentPrice);
_local3 = (_local1 - (_local2 * _kSatisfiedWithEquity));
return (_local3);
}
public function Destroy():void{
visible = false;
_state = "dormant";
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
if (parent){
parent.removeChild(this);
};
}
protected function IdentifyChiefCommodityCausingReaction(_arg1:Boolean):String{
var _local2:Array;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local2 = CCoffeeShopGame._instance._shop.GetRecipe();
_local3 = MathUtil.Clamp((_local2["Coffee"] / s_idealRecipe["Coffee"]), 0, 1);
_local4 = MathUtil.Clamp((_local2["Milk"] / s_idealRecipe["Milk"]), 0, 1);
_local5 = MathUtil.Clamp((_local2["Sugar"] / s_idealRecipe["Sugar"]), 0, 1);
_local6 = 0.1;
if (_arg1){
if (((((_local4 - _local3) > _local6)) && (((_local5 - _local3) > _local6)))){
return ("Coffee");
};
if (((((_local3 - _local4) > _local6)) && (((_local5 - _local4) > _local6)))){
return ("Milk");
};
if (((((_local3 - _local5) > _local6)) && (((_local4 - _local5) > _local6)))){
return ("Sugar");
};
return ("Price");
//unresolved jump
};
if (((((_local3 - _local4) > _local6)) && (((_local3 - _local5) > _local6)))){
return ("Coffee");
};
if (((((_local4 - _local3) > _local6)) && (((_local4 - _local5) > _local6)))){
return ("Milk");
};
if (((((_local5 - _local3) > _local6)) && (((_local5 - _local4) > _local6)))){
return ("Sugar");
};
return ("Price");
}
public function OnPurchasing():void{
if (CCoffeeShopGame._instance._shop.GetNumServingsAvailable() > 0){
CCoffeeShopGame._instance._shop.PurchaseServing(_commitmentPrice);
};
_walkRateVertical = 0;
}
public function OnReactionDone():void{
_state = "exiting";
gotoAndStop("walking");
_walkRate = -(_lateralWalkSpeed);
}
}
}//package
Section 77
//CCustomerBizGirl (CCustomerBizGirl)
package {
public class CCustomerBizGirl extends CCustomer {
public function CCustomerBizGirl(_arg1:Number=1, _arg2:Number=182, _arg3:Number=205, _arg4:Number=300, _arg5:Number=356, _arg6:Number=-101, _arg7:Number=96){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7);
}
}
}//package
Section 78
//CCustomerFat (CCustomerFat)
package {
public class CCustomerFat extends CCustomer {
public function CCustomerFat(_arg1:Number=1, _arg2:Number=182, _arg3:Number=205, _arg4:Number=300, _arg5:Number=356, _arg6:Number=-101, _arg7:Number=96){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7);
}
override public function get _lateralWalkSpeed():Number{
return (4);
}
override public function get _verticalWalkSpeed():Number{
return (0.9);
}
}
}//package
Section 79
//CCustomerGranny (CCustomerGranny)
package {
public class CCustomerGranny extends CCustomer {
public function CCustomerGranny(_arg1:Number=1, _arg2:Number=182, _arg3:Number=205, _arg4:Number=300, _arg5:Number=356, _arg6:Number=-101, _arg7:Number=96){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7);
}
override public function get _lateralWalkSpeed():Number{
return (3.5);
}
override public function get _verticalWalkSpeed():Number{
return (0.8);
}
}
}//package
Section 80
//CCustomerPope (CCustomerPope)
package {
public class CCustomerPope extends CCustomer {
public function CCustomerPope(_arg1:Number=1, _arg2:Number=182, _arg3:Number=205, _arg4:Number=300, _arg5:Number=356, _arg6:Number=-101, _arg7:Number=96){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7);
}
override public function get _lateralWalkSpeed():Number{
return (3.5);
}
override public function get _verticalWalkSpeed():Number{
return (0.8);
}
}
}//package
Section 81
//CCustomerPreppie (CCustomerPreppie)
package {
public class CCustomerPreppie extends CCustomer {
public function CCustomerPreppie(_arg1:Number=1, _arg2:Number=182, _arg3:Number=205, _arg4:Number=300, _arg5:Number=356, _arg6:Number=-101, _arg7:Number=96){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7);
}
}
}//package
Section 82
//CCustomerPurseDog (CCustomerPurseDog)
package {
public class CCustomerPurseDog extends CCustomer {
public function CCustomerPurseDog(_arg1:Number=1, _arg2:Number=182, _arg3:Number=205, _arg4:Number=300, _arg5:Number=356, _arg6:Number=-101, _arg7:Number=96){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7);
}
}
}//package
Section 83
//CFreshText (CFreshText)
package {
import flash.display.*;
import flash.text.*;
public class CFreshText extends MovieClip {
public var _myText:TextField;
public function CFreshText(_arg1:String, _arg2:uint=0xFFFFFF){
_myText.text = _arg1;
_myText.textColor = _arg2;
}
}
}//package
Section 84
//CGraph (CGraph)
package {
import flash.display.*;
import flash.geom.*;
public class CGraph extends MovieClip {
private var m_originalWidth:Number;
private var _marginsMin:Vector2D;
private var _marginsMax:Vector2D;
private var m_originalHeight:Number;
private var _mcDrawContainer:MovieClip;
private var _mcTextContainer:MovieClip;
public function CGraph(){
var _local1:Rectangle;
_marginsMin = new Vector2D(10, 10);
_marginsMax = new Vector2D(10, 10);
super();
_local1 = getRect(this);
m_originalHeight = _local1.height;
m_originalWidth = _local1.width;
_mcDrawContainer = new MovieClip();
addChild(_mcDrawContainer);
_mcTextContainer = new MovieClip();
addChild(_mcTextContainer);
}
public function Clear():void{
_mcDrawContainer.graphics.clear();
removeChild(_mcTextContainer);
_mcTextContainer = new MovieClip();
addChild(_mcTextContainer);
}
public function DrawData(_arg1:Array, _arg2:uint, _arg3:Boolean, _arg4:Boolean, _arg5:Object, _arg6:String):void{
var _local7:int;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Vector2D;
var _local13:Vector2D;
var _local14:int;
var _local15:Number;
var _local16:Number;
var _local17:CFreshText;
_local7 = _arg1.length;
if (_local7 < 2){
return;
};
_local8 = ((m_originalWidth - (_marginsMin.x + _marginsMax.x)) / (_local7 - 1));
_local9 = 2;
if (_arg4){
if (_arg3){
_local9 = 4;
} else {
_local9 = 0;
};
};
_mcDrawContainer.graphics.lineStyle(_local9, _arg2);
_local14 = 0;
while (_local14 < _local7) {
_local15 = (_marginsMin.x + (_local14 * _local8));
_local16 = GetYValue(_arg1[_local14], _arg5);
if (_local14 == 0){
_mcDrawContainer.graphics.moveTo(_local15, _local16);
} else {
_mcDrawContainer.graphics.lineTo(_local15, _local16);
};
if (((!(_local12)) || ((_arg1[_local14] < _local10)))){
_local10 = _arg1[_local14];
_local12 = new Vector2D(_local15, _local16);
};
if (((!(_local13)) || ((_arg1[_local14] > _local11)))){
_local11 = _arg1[_local14];
_local13 = new Vector2D(_local15, _local16);
};
_local14++;
};
if (_arg4){
_local17 = new CFreshText(CCoffeeShopApp.ConvertUnitToString(_arg6, _local10), 0xFFFFFF);
_local17.x = _local12.x;
_local17.y = ((_local12.y - (_local17.height * 0.5)) + 5);
_mcTextContainer.addChild(_local17);
_local17 = new CFreshText(CCoffeeShopApp.ConvertUnitToString(_arg6, _local11), 0xFFFFFF);
_local17.x = _local13.x;
_local17.y = ((_local13.y + (_local17.height * 0.5)) + 5);
_mcTextContainer.addChild(_local17);
};
}
protected function GetYValue(_arg1:Number, _arg2:Object):Number{
return (((m_originalHeight - _marginsMax.y) - ((m_originalHeight - (_marginsMin.y + _marginsMax.y)) * ((_arg1 - _arg2.min) / (_arg2.max - _arg2.min)))));
}
public function BeginDraw(_arg1:String, _arg2:uint, _arg3:Number, _arg4:Number):void{
var _local5:Number;
var _local6:Number;
var _local7:uint;
var _local8:Number;
var _local9:Number;
var _local10:String;
var _local11:CFreshText;
Clear();
if (_arg2 > 1){
_local5 = (m_originalWidth - (_marginsMin.x + _marginsMax.x));
_local6 = (_local5 / (_arg2 - 1));
_local7 = 0;
while (_local7 < _arg2) {
_local8 = (_marginsMin.x + (_local7 * _local6));
_local9 = MathUtil.Lerp(_arg3, _arg4, (_local7 / Number((_arg2 - 1))));
_local10 = CCoffeeShopApp.ConvertUnitToString(_arg1, _local9);
_local11 = new CFreshText(_local10);
_local11.x = _local8;
_local11.y = 265;
_mcTextContainer.addChild(_local11);
_mcDrawContainer.graphics.lineStyle(0, 0x555555);
_mcDrawContainer.graphics.moveTo(_local8, 0);
_mcDrawContainer.graphics.lineTo(_local8, 252.9);
_local7++;
};
};
}
public function EndDraw():void{
}
}
}//package
Section 85
//CGraphControl (CGraphControl)
package {
import flash.display.*;
import flash.text.*;
public class CGraphControl {
private var m_arrStatistics:Array;
private var m_arrStatisticsNames:Array;
private var m_useAllTimeScores:Boolean;// = false
private var m_buttonFieldMin:Vector2D;
private var m_horizontalLabel:String;
private var m_noDataMessage:TextField;
private var m_textHorizontalUnit:TextField;
private var m_buttonFieldMax:Vector2D;
private var m_arrRootButtons:Array;
private var m_host:MovieClip;
private var m_graph:CGraph;
public function CGraphControl(){
m_useAllTimeScores = false;
super();
}
public function GetSettingsMemento():Object{
var _local1:Array;
var _local2:int;
var _local3:CButtonGraphStatToggle;
_local1 = new Array();
_local2 = 0;
while (_local2 < m_arrRootButtons.length) {
_local3 = CButtonGraphStatToggle(m_arrRootButtons[_local2]);
_local1[_local3._statName] = _local3.IsSelected();
_local2++;
};
return (_local1);
}
public function Refresh():void{
var _local1:Boolean;
var _local2:uint;
var _local3:CButtonGraphStatToggle;
_local1 = false;
_local2 = 0;
while (_local2 < m_host.numChildren) {
_local3 = CButtonGraphStatToggle(m_host.getChildAt(_local2));
if (!_local3){
} else {
_local1 = ((_local3.UpdateEnabled()) || (_local1));
};
_local2++;
};
if (m_noDataMessage){
m_noDataMessage.visible = !(_local1);
};
UpdateGraph();
}
public function OnButtonOver(_arg1:String):void{
if (m_arrStatistics[_arg1]){
m_arrStatistics[_arg1].isHighlighted = true;
UpdateGraph();
};
}
protected function CreateButtons():void{
var _local1:Number;
var _local2:uint;
var _local3:uint;
var _local4:String;
var _local5:Object;
var _local6:CButtonGraphStatToggle;
var _local7:CButtonStatFolder;
var _local8:Number;
var _local9:CButtonStatFolder;
_local1 = m_buttonFieldMin.y;
m_arrRootButtons = new Array();
_local2 = 0;
while (_local2 < m_arrStatisticsNames.length) {
_local4 = m_arrStatisticsNames[_local2].name;
_local5 = m_arrStatistics[_local4];
_local6 = null;
_local7 = FindFolderButton(_local5.folderName);
_local8 = 0;
if (_local7){
_local8 = (_local1 - _local7.y);
};
if (_local4.charAt(0) == "+"){
_local6 = new CButtonStatFolder(this, _local4.substr(1), _local5.color, ("stat" + _local4.substring(1)), _local7, _local8);
} else {
_local6 = new CButtonGraphStatToggle(this, _local4, _local5.color, ("stat" + _local4), _local7, _local8);
};
if (_local7){
_local7.AddChildButton(_local6, (_local1 - _local7._buttonY));
} else {
if (m_arrRootButtons.length > 0){
m_arrRootButtons[(m_arrRootButtons.length - 1)].SetNextSibling(_local6);
};
m_arrRootButtons.push(_local6);
m_host.addChild(_local6);
_local6._buttonX = m_buttonFieldMin.x;
_local6.SetY(_local1);
};
_local6.SetSelected(_local5.isSelected);
_local1 = (_local1 + (_local6.height + 4));
_local2++;
};
_local3 = 0;
while (_local3 < m_host.numChildren) {
if ((m_host.getChildAt(_local3) is CButtonStatFolder)){
_local9 = CButtonStatFolder(m_host.getChildAt(_local3));
_local9.FixupChildren();
_local9.CollapseExpand(true, true);
};
_local3++;
};
}
public function OnButtonSelected(_arg1:String):void{
if (m_arrStatistics[_arg1]){
m_arrStatistics[_arg1].isSelected = true;
UpdateGraph();
};
}
public function CalculateCashStatsRange():Object{
var _local1:Array;
var _local2:Object;
var _local3:Object;
_local1 = CCoffeeShopGame._instance._shop.GetStats(m_useAllTimeScores, "Cash");
_local2 = GetRange(_local1);
_local1 = CCoffeeShopGame._instance._shop.GetStats(m_useAllTimeScores, "Expenditures");
_local3 = null;
if (_local1){
_local3 = GetRange(_local1);
_local2.min = Math.min(_local2.min, _local3.min);
_local2.max = Math.max(_local2.max, _local3.max);
};
_local1 = CCoffeeShopGame._instance._shop.GetStats(m_useAllTimeScores, "Revenues");
if (_local1){
_local3 = GetRange(_local1);
_local2.min = Math.min(_local2.min, _local3.min);
_local2.max = Math.max(_local2.max, _local3.max);
};
_local1 = CCoffeeShopGame._instance._shop.GetStats(m_useAllTimeScores, "Profits/Losses");
if (_local1){
_local3 = GetRange(_local1);
_local2.min = Math.min(_local2.min, _local3.min);
_local2.max = Math.max(_local2.max, _local3.max);
};
_local1 = CCoffeeShopGame._instance._shop.GetStats(m_useAllTimeScores, "Price");
if (_local1){
_local3 = GetRange(_local1);
_local2.min = Math.min(_local2.min, _local3.min);
_local2.max = Math.max(_local2.max, _local3.max);
};
return (_local2);
}
public function UnselectAllOtherFolders(_arg1:CButtonStatFolder):void{
var _local2:uint;
var _local3:CButtonStatFolder;
_local2 = 0;
while (_local2 < m_host.numChildren) {
if ((m_host.getChildAt(_local2) is CButtonStatFolder)){
_local3 = CButtonStatFolder(m_host.getChildAt(_local2));
if (_local3 != _arg1){
_local3.SetSelected(false);
};
};
_local2++;
};
}
public function OnButtonUnselected(_arg1:String):void{
if (m_arrStatistics[_arg1]){
m_arrStatistics[_arg1].isSelected = false;
UpdateGraph();
};
}
public function GetRange(_arg1:Array):Object{
var _local2:Number;
var _local3:Number;
var _local4:int;
_local2 = _arg1[0];
_local3 = _local2;
_local4 = 0;
while (_local4 < _arg1.length) {
_local2 = Math.min(_local2, _arg1[_local4]);
_local3 = Math.max(_local3, _arg1[_local4]);
_local4++;
};
return ({min:_local2, max:_local3});
}
public function UpdateGraph():void{
var _local1:Object;
var _local2:uint;
var _local3:uint;
var _local4:String;
var _local5:Object;
var _local6:Array;
var _local7:Object;
_local1 = CalculateCashStatsRange();
_local2 = CCoffeeShopGame._instance._shop.GetNumStats(m_useAllTimeScores);
if (_local2 > 1){
m_textHorizontalUnit.text = m_horizontalLabel;
} else {
m_textHorizontalUnit.text = "";
};
_local3 = _local2;
while (_local3 > 20) {
_local3 = (_local3 / 2);
};
m_graph.BeginDraw(m_horizontalLabel, _local3, 1, _local2);
for (_local4 in m_arrStatistics) {
_local5 = m_arrStatistics[_local4];
if (((_local5.isSelected) || (_local5.isHighlighted))){
_local6 = CCoffeeShopGame._instance._shop.GetStats(m_useAllTimeScores, _local4);
if (!_local6){
};
_local7 = GetRange(_local6);
if (_local5.unitName == "Cash"){
_local7 = _local1;
};
m_graph.DrawData(_local6, _local5.color, _local5.isSelected, _local5.isHighlighted, _local7, _local5.unitName);
};
};
m_graph.EndDraw();
}
public function Initialize(_arg1:MovieClip, _arg2:TextField, _arg3:TextField, _arg4:CGraph, _arg5:String, _arg6:Array, _arg7:Vector2D, _arg8:Vector2D, _arg9:Boolean=true):void{
var _local10:uint;
var _local11:Object;
m_arrStatistics = new Array();
_local10 = 0;
while (_local10 < _arg6.length) {
_local11 = _arg6[_local10];
m_arrStatistics[_local11.name] = {folderName:_local11.folderName, color:_local11.color, isSelected:(((_local11.name == "Cash")) || ((_local11.name == "Reputation"))), isHighlighted:false, unitName:_local11.unitName};
_local10++;
};
m_arrStatisticsNames = _arg6;
m_host = _arg1;
m_noDataMessage = _arg2;
m_textHorizontalUnit = _arg3;
m_useAllTimeScores = _arg9;
m_graph = _arg4;
m_horizontalLabel = _arg5;
m_buttonFieldMin = _arg7.GetCopy();
m_buttonFieldMax = _arg8.GetCopy();
CreateButtons();
Refresh();
}
public function SetSettingsMemento(_arg1:Object):void{
var _local2:int;
var _local3:CButtonGraphStatToggle;
_local2 = 0;
while (_local2 < m_arrRootButtons.length) {
_local3 = CButtonGraphStatToggle(m_arrRootButtons[_local2]);
_local3.SetSelected(_arg1[_local3._statName]);
_local2++;
};
}
public function FindFolderButton(_arg1:String):CButtonStatFolder{
var _local2:uint;
var _local3:CButtonStatFolder;
if ((((_arg1 == "")) || ((_arg1 == "root")))){
return (null);
};
_local2 = 0;
while (_local2 < m_host.numChildren) {
if ((m_host.getChildAt(_local2) is CButtonStatFolder)){
_local3 = CButtonStatFolder(m_host.getChildAt(_local2));
if (((_local3) && ((_local3._statName == _arg1)))){
return (_local3);
};
};
_local2++;
};
return (null);
}
public function OnButtonOut(_arg1:String):void{
if (m_arrStatistics[_arg1]){
m_arrStatistics[_arg1].isHighlighted = false;
UpdateGraph();
};
}
}
}//package
Section 86
//CHUD (CHUD)
package {
import flash.display.*;
public class CHUD extends MovieClip {
public var _modeServing:CHUDModeServing;
public var _cashDisplay:CHUDCashDisplay;
public var _reputationDisplay:CHUDReputationDisplay;
public var _weatherDisplay:CHUDWeatherDisplay;
public var _modePreparing:CHUDModePreparing;
public var _modeEndOfDay:CHUDModeEndOfDay;
public function CHUD(){
addFrameScript(14, frame15, 30, frame31, 59, frame60, 74, frame75, 90, frame91, 109, frame110);
}
public function OnDisappearDone():void{
stop();
}
function frame75(){
OnEndOfDayAppeared();
}
public function OnPreparingModeAppeared():void{
stop();
}
public function OnAppearDone():void{
}
public function EnterServingMode():void{
_weatherDisplay.Maximize();
_modeServing.Appear();
gotoAndPlay("preparing to serving");
}
function frame91(){
gotoAndStop("preparing");
}
public function OnEndOfDayAppeared():void{
stop();
}
function frame15(){
OnAppearDone();
}
public function OnServingModeAppeared():void{
stop();
}
function frame110(){
OnDisappearDone();
}
function frame31(){
OnPreparingModeAppeared();
}
public function Appear():void{
gotoAndPlay("appear");
}
public function OnReputationChanged(_arg1:Number, _arg2:Number):void{
_reputationDisplay.OnReputationChanged(_arg1, _arg2);
}
public function GoToEndOfDay(_arg1:int, _arg2:String, _arg3:String, _arg4:int, _arg5:String, _arg6:int):void{
_weatherDisplay.Minimize();
_modeEndOfDay.SetupDisplay(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
_modeServing.Disappear();
gotoAndPlay("serving to end of day");
}
function frame60(){
OnServingModeAppeared();
}
public function EnterPreparingMode():void{
_weatherDisplay.Minimize();
_modePreparing.EnterPreparingMode();
_modeServing.Disappear();
if (CCoffeeShopGame._instance._phase == "initial"){
gotoAndPlay("appear");
} else {
if ((((CCoffeeShopGame._instance._phase == "serving")) || ((CCoffeeShopGame._instance._phase == "end of day")))){
gotoAndPlay("end of day to preparing");
};
};
}
}
}//package
Section 87
//CHUDCashDisplay (CHUDCashDisplay)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.utils.*;
public class CHUDCashDisplay extends MovieClip {
public var _textCash:TextField;
private var _amountCash:int;// = 0
public function CHUDCashDisplay(){
var _local1:Timer;
_amountCash = 0;
super();
_local1 = new Timer(100, 0);
_local1.addEventListener("timer", onTimerUpdate);
_local1.start();
}
protected function OnAmountIncreased(_arg1:int):void{
}
public function onTimerUpdate(_arg1:TimerEvent):void{
UpdateDisplay();
}
protected function OnAmountDecreased(_arg1:int):void{
}
public function UpdateDisplay():void{
var _local1:int;
var _local2:int;
if ((((CCoffeeShopGame._instance == null)) || ((CCoffeeShopGame._instance._shop == null)))){
return;
};
_local1 = CCoffeeShopGame._instance._shop._cash;
_local2 = (_local1 - _amountCash);
if (_local2 > 0){
OnAmountIncreased(_local2);
} else {
if (_local2 < 0){
OnAmountDecreased(-(_local2));
} else {
return;
};
};
_amountCash = _local1;
_textCash.text = CCoffeeShopApp.ConvertUnitToString("Cash", _amountCash);
}
}
}//package
Section 88
//CHUDModeEndOfDay (CHUDModeEndOfDay)
package {
import flash.display.*;
import flash.text.*;
public class CHUDModeEndOfDay extends MovieClip {
public var _textSummary:TextField;
public var _buttonContinue:CButtonLeaveEndOfDay;
public var _textHorizontalUnit:TextField;
public var _graph:CGraph;
public var _buttonHost:MovieClip;
public var _textTitle:TextField;
public var _textSpoilage:TextField;
private var m_graphControl:CGraphControl;
public var _textTemperature:TextField;
private static var s_graphSettings:Object;
public function CHUDModeEndOfDay(){
m_graphControl = new CGraphControl();
super();
_buttonContinue.Initialize("Continue", OnContinue, "eodContinue");
}
public function OnContinue():void{
s_graphSettings = m_graphControl.GetSettingsMemento();
_buttonContinue.SetEnabled(false);
CCoffeeShopGame._instance.DoneWithEndOfDay();
}
public function SetupDisplay(_arg1:int, _arg2:String, _arg3:String, _arg4:int, _arg5:String, _arg6:int):void{
var _local7:Array;
_textTitle.text = ("End of Day " + String(_arg1));
_textSummary.text = _arg2;
_textSpoilage.text = _arg3;
_textTemperature.text = ((String(_arg4) + "° ") + _arg5);
_textTemperature.textColor = _arg6;
_local7 = [{name:"Cash", color:0xFF00, unitName:"Cash", folderName:"root"}, {name:"Reputation", color:0xFF, unitName:"Reputation", folderName:"root"}, {name:"Cups Sold", color:0x9900, unitName:"units", folderName:"root"}, {name:"Price", color:3407701, unitName:"Cash", folderName:"root"}];
m_graphControl.Initialize(_buttonHost, null, _textHorizontalUnit, _graph, "Hours", _local7, new Vector2D(0, -2), new Vector2D((_graph.x - 20), height), false);
if (s_graphSettings != null){
m_graphControl.SetSettingsMemento(s_graphSettings);
};
_buttonContinue.SetEnabled(true);
}
}
}//package
Section 89
//CHUDModePreparing (CHUDModePreparing)
package {
public class CHUDModePreparing extends CMovieClipFresh {
public var _quitWarningBox:CQuitConfirm;
public var _buttonStartTheDay:CButtonStartTheDay;
public var _page:CHUDPreparingPage;
public function CHUDModePreparing(){
_buttonStartTheDay.Initialize("Start the Day", OnStartTheDay, "startTheDay");
_buttonStartTheDay.SetEnabled(false);
_quitWarningBox.Initialize(OnReallyQuit, OnQuitDenied);
}
public function OnQuitDenied():void{
_quitWarningBox.visible = false;
}
public function OnStartTheDay():void{
_buttonStartTheDay.SetEnabled(false);
CCoffeeShopGame._instance.EnterServingMode();
}
public function EnterPreparingMode():void{
_buttonStartTheDay.SetEnabled(false);
_page.EnterPreparingMode();
}
public function OnReallyQuit():void{
_quitWarningBox.visible = false;
CCoffeeShopGame._instance.AbortGame();
}
public function OnQuit():void{
_quitWarningBox.visible = true;
}
}
}//package
Section 90
//CHUDModeServing (CHUDModeServing)
package {
import flash.display.*;
public class CHUDModeServing extends MovieClip {
public var _inventoryDisplay:CHUDServingInventory;
public var _priceAdjustment:CHUDServingPrice;
private var _hidden:Boolean;// = true
public function CHUDModeServing(){
_hidden = true;
super();
addFrameScript(14, frame15, 24, frame25);
stop();
}
function frame15(){
stop();
}
function frame25(){
stop();
}
public function Disappear():void{
if (!_hidden){
gotoAndPlay("disappear");
_hidden = true;
_inventoryDisplay.SetAwake(false);
};
}
public function Appear():void{
if (_hidden){
gotoAndPlay("appear");
_hidden = false;
_priceAdjustment.RefreshPrice();
_inventoryDisplay.SetAwake(true);
};
}
}
}//package
Section 91
//CHUDPreparingAdjustments (CHUDPreparingAdjustments)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class CHUDPreparingAdjustments extends CMovieClipFresh {
private var _arrPurchases:Array;
public var _sliderPrice:CSlider;
private var _isDividerTargetLocked:Boolean;// = false
public var _buttonUndoLastPurchase:CButtonUndoLastPurchase;
public var _adjustmentsInventory:CHUDPreparingAdjustmentsInventory;
public var _maskRecipe:MovieClip;
public var _buttonQuit:CButtonQuit;
public var _adjustmentsRecipe:CHUDPreparingAdjustmentsRecipe;
public var _textServingLimiter:TextField;
private var _dividerHighlightArea:String;
private var _dividerTargetX:Number;// = 191
public var _maskInventory:MovieClip;
public var _divider:MovieClip;
public var _textNumServingsAvailable:TextField;
public function CHUDPreparingAdjustments(){
_dividerTargetX = 191;
_isDividerTargetLocked = false;
_arrPurchases = new Array();
super();
stop();
_buttonQuit.Initialize("Quit", CHUDModePreparing(parent.parent).OnQuit, "quit");
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function SetDividerTargetLocked(_arg1:Boolean):void{
_isDividerTargetLocked = _arg1;
}
public function get _isRecipeHighlighted():Boolean{
return ((_dividerHighlightArea == "recipe"));
}
override public function FirstFrameInitialize(_arg1:Event):void{
_adjustmentsInventory.Initialize();
_adjustmentsRecipe.Initialize();
_sliderPrice.Initialize(5, 1000, CCoffeeShopGame._instance._shop._pricePerServing, "", "", OnPriceChanged, "Cash", "prepPrice");
_sliderPrice.SetNotifyChangeWhenMoved(OnPriceChanged);
_buttonUndoLastPurchase.Initialize("Undo Purchase", OnUndoLastPurchase, "undo");
_buttonUndoLastPurchase.SetEnabled(false);
EnterPreparingMode();
super.FirstFrameInitialize(_arg1);
}
public function OnInventoryPurchase(_arg1:String, _arg2:Number, _arg3:Number){
_arrPurchases.push({commodity:_arg1, amount:_arg2, cost:_arg3});
_buttonUndoLastPurchase.SetEnabled(((_arrPurchases) && ((_arrPurchases.length > 0))));
OnInventoryChanged();
}
public function RefreshPrice():void{
if (CCoffeeShopGame._instance != null){
_sliderPrice._value = CCoffeeShopGame._instance._shop._pricePerServing;
};
}
public function OnInventoryOrRecipeChanged():void{
var _local1:int;
if (CCoffeeShopGame._instance == null){
return;
};
_local1 = CCoffeeShopGame._instance._shop.GetNumServingsAvailable();
_textNumServingsAvailable.text = String(_local1);
_textServingLimiter.text = CCoffeeShopGame._instance._shop.GetNumServingsLimiter();
CHUDModePreparing(parent.parent)._buttonStartTheDay.SetEnabled((_local1 > 0));
}
public function RefreshValuesFromShop():void{
RefreshPrice();
_adjustmentsInventory.UpdateValuesFromShop();
_adjustmentsRecipe.UpdateValuesFromShop();
OnInventoryOrRecipeChanged();
}
public function OnRecipeChanged():void{
OnInventoryOrRecipeChanged();
}
public function onEnterFrame(_arg1:Event):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
if (!_isDividerTargetLocked){
_local2 = (119 - -195);
_local3 = (74 - 6);
_local4 = (mouseX + _local2);
_local5 = (mouseY + _local3);
if ((((((((_local5 > 364)) || ((_local5 < 72)))) || ((_local4 < 119)))) || ((_local4 > 592)))){
} else {
if (_local4 < 220){
_dividerHighlightArea = "inventory";
_dividerTargetX = 191;
} else {
if (_local4 > 510){
_dividerHighlightArea = "recipe";
_dividerTargetX = -86;
};
};
};
};
_divider.x = MathUtil.Lerp(_divider.x, _dividerTargetX, 0.5);
_maskInventory.x = ((_divider.x - (_divider.width * 0.5)) - _maskInventory.width);
_maskRecipe.x = (_divider.x + (_divider.width * 0.5));
}
public function OnPriceChanged():void{
CCoffeeShopGame._instance._shop._pricePerServing = _sliderPrice._value;
}
public function get _isInventoryHighlighted():Boolean{
return ((_dividerHighlightArea == "inventory"));
}
public function OnInventoryChanged():void{
OnInventoryOrRecipeChanged();
}
public function OnUndoLastPurchase():void{
var _local1:Object;
if (((_arrPurchases) && ((_arrPurchases.length > 0)))){
_local1 = _arrPurchases.pop();
_adjustmentsInventory.UndoPurchase(_local1.commodity, _local1.amount, _local1.cost);
_buttonUndoLastPurchase.SetEnabled(((_arrPurchases) && ((_arrPurchases.length > 0))));
};
}
public function EnterPreparingMode():void{
_arrPurchases.splice(0);
_buttonUndoLastPurchase.SetEnabled(false);
RefreshValuesFromShop();
OnInventoryOrRecipeChanged();
}
}
}//package
Section 92
//CHUDPreparingAdjustmentsInventory (CHUDPreparingAdjustmentsInventory)
package {
import flash.display.*;
import flash.text.*;
public class CHUDPreparingAdjustmentsInventory extends MovieClip {
public var _textAmtCoffee:TextField;
public var _textAmtCups:TextField;
public var _textAmtMilk:TextField;
public var _textAmtSugar:TextField;
public function UndoPurchase(_arg1:String, _arg2:Number, _arg3:Number):void{
CCoffeeSound._instance.PlaySound("audio_gain", 0.5);
CCoffeeShopGame._instance._shop.Gain(_arg3);
UpdateBuyButtonEnablement();
CCoffeeShopGame._instance._shop.AddInventoryAmount(_arg1, -(_arg2));
CHUDPreparingAdjustments(parent).OnInventoryChanged();
TextField(this[("_textAmt" + _arg1)]).text = CCoffeeShopApp.ConvertUnitToString("Inventory", CCoffeeShopGame._instance._shop.GetInventoryAmount(_arg1));
}
public function UpdateBuyButtonEnablement():void{
var _local1:int;
var _local2:int;
var _local3:DisplayObject;
var _local4:CButtonBuy;
_local1 = CCoffeeShopGame._instance._shop._cash;
_local2 = 0;
while (_local2 < numChildren) {
_local3 = getChildAt(_local2);
if ((_local3 is CButtonBuy)){
_local4 = CButtonBuy(_local3);
_local4.SetEnabled((_local1 >= _local4._costPerPurchase));
};
_local2++;
};
}
public function UpdateValuesFromShop():void{
if (CCoffeeShopGame._instance == null){
return;
};
_textAmtCups.text = CCoffeeShopApp.ConvertUnitToString("units", CCoffeeShopGame._instance._shop.GetInventoryAmount("Cups"));
_textAmtCoffee.text = CCoffeeShopApp.ConvertUnitToString("tsp", CCoffeeShopGame._instance._shop.GetInventoryAmount("Coffee"));
_textAmtMilk.text = CCoffeeShopApp.ConvertUnitToString("cups", CCoffeeShopGame._instance._shop.GetInventoryAmount("Milk"));
_textAmtSugar.text = CCoffeeShopApp.ConvertUnitToString("tsp", CCoffeeShopGame._instance._shop.GetInventoryAmount("Sugar"));
UpdateBuyButtonEnablement();
}
public function Initialize():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Array;
var _local6:Array;
var _local7:Array;
var _local8:int;
var _local9:String;
var _local10:String;
var _local11:Number;
var _local12:int;
var _local13:Object;
var _local14:CButtonBuy;
_local1 = 146.1;
_local2 = 24.4;
_local3 = (221.1 - _local1);
_local4 = (81.5 - _local2);
_local5 = new Array();
_local5.push("Cups");
_local5.push("Coffee");
_local5.push("Milk");
_local5.push("Sugar");
_local6 = new Array();
_local6.push("unit");
_local6.push("tsp");
_local6.push("cup");
_local6.push("tsp");
_local7 = CCoffeeShopGame._instance._shop.GetBuyTiers();
_local8 = 0;
while (_local8 < _local5.length) {
_local9 = _local5[_local8];
_local10 = _local6[_local8];
_local11 = _local1;
_local12 = 0;
while (_local12 < 3) {
_local13 = _local7[_local8][_local12];
_local14 = new CButtonBuy(_local9, _local10, _local13._amount, _local13._cost, OnBuyButtonClicked, (("buy" + _local9) + _local13._amount));
_local14.x = _local1;
_local14.y = _local2;
addChild(_local14);
_local1 = (_local1 + _local3);
_local12++;
};
_local1 = _local11;
_local2 = (_local2 + _local4);
_local8++;
};
UpdateValuesFromShop();
}
public function OnBuyButtonClicked(_arg1:String, _arg2:Number, _arg3:int):void{
if (CCoffeeShopGame._instance._shop._cash >= _arg3){
CCoffeeShopGame._instance._shop.Pay(_arg3);
UpdateBuyButtonEnablement();
CCoffeeShopGame._instance._shop.AddInventoryAmount(_arg1, _arg2);
CHUDPreparingAdjustments(parent).OnInventoryPurchase(_arg1, _arg2, _arg3);
TextField(this[("_textAmt" + _arg1)]).text = CCoffeeShopApp.ConvertUnitToString("Inventory", CCoffeeShopGame._instance._shop.GetInventoryAmount(_arg1));
};
}
}
}//package
Section 93
//CHUDPreparingAdjustmentsRecipe (CHUDPreparingAdjustmentsRecipe)
package {
import flash.display.*;
import flash.text.*;
public class CHUDPreparingAdjustmentsRecipe extends MovieClip {
public var _sliderCoffee:CSlider;
public var _textAmtCoffee:TextField;
public var _sliderSugar:CSlider;
public var _sliderMilk:CSlider;
public var _textAmtMilk:TextField;
public var _textAmtSugar:TextField;
public function OnSugarChanged():void{
CCoffeeShopGame._instance._shop.SetRecipeAmount("Sugar", _sliderSugar._value);
_textAmtSugar.text = CCoffeeShopApp.ConvertUnitToString("Inventory", _sliderSugar._value);
CHUDPreparingAdjustments(parent).OnRecipeChanged();
}
public function UpdateValuesFromShop():void{
if (CCoffeeShopGame._instance == null){
return;
};
_sliderCoffee._value = CCoffeeShopGame._instance._shop.GetRecipeAmount("Coffee");
_sliderMilk._value = CCoffeeShopGame._instance._shop.GetRecipeAmount("Milk");
_sliderSugar._value = CCoffeeShopGame._instance._shop.GetRecipeAmount("Sugar");
_textAmtCoffee.text = CCoffeeShopApp.ConvertUnitToString("tsp", _sliderCoffee._value);
_textAmtMilk.text = CCoffeeShopApp.ConvertUnitToString("cups", _sliderMilk._value);
_textAmtSugar.text = CCoffeeShopApp.ConvertUnitToString("tsp", _sliderSugar._value);
}
public function OnCoffeeChanged():void{
CCoffeeShopGame._instance._shop.SetRecipeAmount("Coffee", _sliderCoffee._value);
_textAmtCoffee.text = CCoffeeShopApp.ConvertUnitToString("Inventory", _sliderCoffee._value);
CHUDPreparingAdjustments(parent).OnRecipeChanged();
}
public function OnMilkChanged():void{
CCoffeeShopGame._instance._shop.SetRecipeAmount("Milk", _sliderMilk._value);
_textAmtMilk.text = CCoffeeShopApp.ConvertUnitToString("Inventory", _sliderMilk._value);
CHUDPreparingAdjustments(parent).OnRecipeChanged();
}
public function Initialize():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = CCoffeeShopGame._instance._shop.GetRecipeAmount("Coffee");
_local2 = CCoffeeShopGame._instance._shop.GetRecipeAmount("Milk");
_local3 = CCoffeeShopGame._instance._shop.GetRecipeAmount("Sugar");
_textAmtCoffee.text = CCoffeeShopApp.ConvertUnitToString("Inventory", _local1);
_textAmtMilk.text = CCoffeeShopApp.ConvertUnitToString("Inventory", _local2);
_textAmtSugar.text = CCoffeeShopApp.ConvertUnitToString("Inventory", _local3);
_sliderCoffee.Initialize(CCoffeeShopGame._instance._shop.GetMinRecipeAmount("Coffee"), CCoffeeShopGame._instance._shop.GetMaxRecipeAmount("Coffee"), _local1, "weak", "strong", OnCoffeeChanged, "Inventory", "recipCoffee");
_sliderMilk.Initialize(CCoffeeShopGame._instance._shop.GetMinRecipeAmount("Milk"), CCoffeeShopGame._instance._shop.GetMaxRecipeAmount("Milk"), _local2, "black", "creamy", OnMilkChanged, "Inventory", "recipMilk");
_sliderSugar.Initialize(CCoffeeShopGame._instance._shop.GetMinRecipeAmount("Sugar"), CCoffeeShopGame._instance._shop.GetMaxRecipeAmount("Sugar"), _local3, "bitter", "sweet", OnSugarChanged, "Inventory", "recipSugar");
}
}
}//package
Section 94
//CHUDPreparingPage (CHUDPreparingPage)
package {
import flash.events.*;
public class CHUDPreparingPage extends CMovieClipFresh {
public var _tabs:CPageTabs;
public var _stats:CHUDPreparingStats;
public var _adjustments:CHUDPreparingAdjustments;
public function CHUDPreparingPage(){
stop();
}
public function OnTabStats():void{
_tabs.BringForwardTab("Stats");
_adjustments.visible = false;
_stats.visible = true;
}
override public function FirstFrameInitialize(_arg1:Event):void{
super.FirstFrameInitialize(_arg1);
_tabs.AddTab("Adjustments", OnTabAdjustments);
_tabs.BringForwardTab("Adjustments");
}
public function OnTabAdjustments():void{
_tabs.BringForwardTab("Adjustments");
_adjustments.visible = true;
_stats.visible = false;
}
public function EnterPreparingMode():void{
_adjustments.EnterPreparingMode();
if (CCoffeeShopGame._instance._dayNumber == 1){
_tabs.AddTab("Stats", OnTabStats);
};
_stats.EnterPreparingMode();
OnTabAdjustments();
}
}
}//package
Section 95
//CHUDPreparingStats (CHUDPreparingStats)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class CHUDPreparingStats extends CMovieClipFresh {
public var _textHorizontalUnit:TextField;
public var _graph:CGraph;
public var _noDataMessage:TextField;
public var _buttonHost:MovieClip;
private var m_graphControl:CGraphControl;
public function CHUDPreparingStats(){
m_graphControl = new CGraphControl();
super();
}
override public function FirstFrameInitialize(_arg1:Event):void{
var _local2:Array;
super.FirstFrameInitialize(_arg1);
_local2 = [{name:"Cash", color:0xFF00, unitName:"Cash", folderName:"root"}, {name:"Reputation", color:0xFF, unitName:"Reputation", folderName:"root"}, {name:"Weather", color:0xFFFFFF, unitName:"degrees", folderName:"root"}, {name:"+Finances", color:0xFF00, unitName:"", folderName:"root"}, {name:"Cups Sold", color:0x9900, unitName:"units", folderName:"Finances"}, {name:"Price", color:3407701, unitName:"Cash", folderName:"Finances"}, {name:"Expenditures", color:0x999900, unitName:"Cash", folderName:"Finances"}, {name:"Revenues", color:10092373, unitName:"Cash", folderName:"Finances"}, {name:"Profits/Losses", color:0xCC00, unitName:"Cash", folderName:"Finances"}, {name:"+Recipe", color:10066431, unitName:"", folderName:"root"}, {name:"Recipe - Coffee", color:85, unitName:"tsp", folderName:"Recipe"}, {name:"Recipe - Milk", color:10066431, unitName:"cups", folderName:"Recipe"}, {name:"Recipe - Sugar", color:11184895, unitName:"tsp", folderName:"Recipe"}, {name:"+Inventory", color:0xFF0099, unitName:"", folderName:"root"}, {name:"Inventory - Cups", color:0xFF0033, unitName:"units", folderName:"Inventory"}, {name:"Inventory - Coffee", color:0x550000, unitName:"tsp", folderName:"Inventory"}, {name:"Inventory - Milk", color:16724940, unitName:"cups", folderName:"Inventory"}, {name:"Inventory - Sugar", color:0xFF5500, unitName:"tsp", folderName:"Inventory"}];
m_graphControl.Initialize(_buttonHost, _noDataMessage, _textHorizontalUnit, _graph, "Days", _local2, new Vector2D(0, -2), new Vector2D((_graph.x - 20), height));
}
public function EnterPreparingMode():void{
m_graphControl.Refresh();
}
}
}//package
Section 96
//CHUDReputationDisplay (CHUDReputationDisplay)
package {
import flash.display.*;
import flash.geom.*;
public class CHUDReputationDisplay extends MovieClip {
public var _barReputation:MovieClip;
public function OnReputationChanged(_arg1:Number, _arg2:Number):void{
var _local3:ColorTransform;
_barReputation.x = 254.1;
_barReputation.scaleX = (_arg2 * 0.8);
_local3 = _barReputation.transform.colorTransform;
if (_arg2 >= 0){
_local3.color = 0xFF00;
} else {
_local3.color = 0xFF0000;
};
_barReputation.transform.colorTransform = _local3;
}
}
}//package
Section 97
//CHUDServingInventory (CHUDServingInventory)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import fl.motion.*;
import flash.geom.*;
public class CHUDServingInventory extends MovieClip {
public var _textAmtCoffee:TextField;
public var _textAmtCups:TextField;
private var _mapInitialAmounts:Array;
private var _isAwake:Boolean;// = false
public var _textAmtMilk:TextField;
public var _barCups:MovieClip;
public var _barCoffee:MovieClip;
public var _barSugar:MovieClip;
private var _mapNominalValues:Array;
public var _barMilk:MovieClip;
public var _textAmtSugar:TextField;
public function CHUDServingInventory(){
_isAwake = false;
super();
_mapNominalValues = new Array();
_mapNominalValues["Cups"] = 10;
_mapNominalValues["Coffee"] = 10;
_mapNominalValues["Milk"] = 10;
_mapNominalValues["Sugar"] = 10;
}
public function SetAwake(_arg1:Boolean):void{
var _local2:CShop;
_isAwake = _arg1;
if (_isAwake){
addEventListener(Event.ENTER_FRAME, onEnterFrame);
_local2 = CCoffeeShopGame._instance._shop;
_mapInitialAmounts = new Array();
_mapInitialAmounts["Cups"] = Math.max(_mapNominalValues["Cups"], _local2.GetInventoryAmount("Cups"));
_mapInitialAmounts["Coffee"] = Math.max(_mapNominalValues["Coffee"], _local2.GetInventoryAmount("Coffee"));
_mapInitialAmounts["Milk"] = Math.max(_mapNominalValues["Milk"], _local2.GetInventoryAmount("Milk"));
_mapInitialAmounts["Sugar"] = Math.max(_mapNominalValues["Sugar"], _local2.GetInventoryAmount("Sugar"));
} else {
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
};
}
public function onEnterFrame(_arg1:Event):void{
var _local2:CShop;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:ColorTransform;
_local2 = CCoffeeShopGame._instance._shop;
_local3 = _local2.GetInventoryAmount("Cups");
_local4 = _local2.GetInventoryAmount("Coffee");
_local5 = _local2.GetInventoryAmount("Milk");
_local6 = _local2.GetInventoryAmount("Sugar");
_textAmtCups.text = String(int(_local3));
_textAmtCoffee.text = String(int(_local4));
_textAmtMilk.text = String(int(_local5));
_textAmtSugar.text = String(int(_local6));
_local7 = Math.min(100, ((_local3 / _mapInitialAmounts["Cups"]) * 100));
_local8 = Math.min(100, ((_local4 / _mapInitialAmounts["Coffee"]) * 100));
_local9 = Math.min(100, ((_local5 / _mapInitialAmounts["Milk"]) * 100));
_local10 = Math.min(100, ((_local6 / _mapInitialAmounts["Sugar"]) * 100));
_barCups.width = _local7;
_barCoffee.width = _local8;
_barMilk.width = _local9;
_barSugar.width = _local10;
_textAmtCups.x = (_local7 - 139);
_textAmtCoffee.x = (_local8 - 139);
_textAmtMilk.x = (_local9 - 139);
_textAmtSugar.x = (_local10 - 139);
_local11 = MathUtil.Clamp((1 - (_local3 / _mapNominalValues["Cups"])), 0, 1);
_local12 = MathUtil.Clamp((1 - (_local4 / _mapNominalValues["Coffee"])), 0, 1);
_local13 = MathUtil.Clamp((1 - (_local5 / _mapNominalValues["Milk"])), 0, 1);
_local14 = MathUtil.Clamp((1 - (_local6 / _mapNominalValues["Sugar"])), 0, 1);
_textAmtCups.textColor = Color.interpolateColor(0xFFFFFF, 0xFF0000, _local11);
_textAmtCoffee.textColor = Color.interpolateColor(0xFFFFFF, 0xFF0000, _local12);
_textAmtMilk.textColor = Color.interpolateColor(0xFFFFFF, 0xFF0000, _local13);
_textAmtSugar.textColor = Color.interpolateColor(0xFFFFFF, 0xFF0000, _local14);
_local15 = _barCups.transform.colorTransform;
_local15.color = _textAmtCups.textColor;
_barCups.transform.colorTransform = _local15;
_local15 = _barCoffee.transform.colorTransform;
_local15.color = _textAmtCoffee.textColor;
_barCoffee.transform.colorTransform = _local15;
_local15 = _barMilk.transform.colorTransform;
_local15.color = _textAmtMilk.textColor;
_barMilk.transform.colorTransform = _local15;
_local15 = _barSugar.transform.colorTransform;
_local15.color = _textAmtSugar.textColor;
_barSugar.transform.colorTransform = _local15;
}
}
}//package
Section 98
//CHUDServingPrice (CHUDServingPrice)
package {
import flash.events.*;
import flash.text.*;
public class CHUDServingPrice extends CMovieClipFresh {
public var _slider:CSliderPrice;
public var _textPrice:TextField;
override public function FirstFrameInitialize(_arg1:Event):void{
_slider.Initialize(5, 1000, CCoffeeShopGame._instance._shop._pricePerServing, "", "", OnPriceChanged, "Cash", "servPrice");
_textPrice.text = _slider.GetValueString();
_slider.SetNotifyChangeWhenMoved(OnPriceChanged);
super.FirstFrameInitialize(_arg1);
}
public function RefreshPrice():void{
_slider._value = CCoffeeShopGame._instance._shop._pricePerServing;
_textPrice.text = _slider.GetValueString();
}
public function OnPriceChanged():void{
CCoffeeShopGame._instance._shop._pricePerServing = _slider._value;
_textPrice.text = CCoffeeShopApp.ConvertUnitToString("Cash", CCoffeeShopGame._instance._shop._pricePerServing);
}
}
}//package
Section 99
//CHUDTab (CHUDTab)
package {
public class CHUDTab extends CButton {
public function CHUDTab(){
SetTextColors(0, 0x999999, 0xCCCCCC, 0xFFFFFF);
}
}
}//package
Section 100
//CHUDWeatherDisplay (CHUDWeatherDisplay)
package {
import flash.display.*;
import flash.text.*;
public class CHUDWeatherDisplay extends MovieClip {
public var _textDegreesSymbol:TextField;
public var _textDescription:TextField;
public var _textDayNumber:TextField;
public var _textTemperature:TextField;
public var _textTime:TextField;
public function CHUDWeatherDisplay(){
addFrameScript(12, frame13, 24, frame25);
gotoAndStop("minimized");
}
public function Maximize():void{
gotoAndPlay("maximize");
}
public function OnMinimized():void{
gotoAndStop("minimized");
}
function frame25(){
OnMaximized();
}
public function UpdateWeatherDisplay():void{
var _local1:int;
var _local2:uint;
if (CCoffeeShopGame._instance == null){
return;
};
if ((((((_textTemperature == null)) || ((_textDescription == null)))) || ((_textDegreesSymbol == null)))){
return;
};
_local1 = CCoffeeShopGame._instance._temperatureFarenheit;
_textTemperature.text = (String(_local1) + "°");
_textDescription.text = CCoffeeShopGame._instance.GetDescriptionForTemperature(_local1);
_local2 = CCoffeeShopGame._instance.GetColorForTemperature(_local1);
_textTemperature.textColor = _local2;
_textDegreesSymbol.textColor = _local2;
}
function frame13(){
OnMinimized();
}
public function UpdateDisplay():void{
UpdateWeatherDisplay();
UpdateTimeDisplay();
}
public function Minimize():void{
gotoAndPlay("minimize");
}
public function UpdateTimeDisplay():void{
var _local1:int;
var _local2:Number;
if (CCoffeeShopGame._instance == null){
return;
};
if ((((_textTime == null)) || ((_textDayNumber == null)))){
return;
};
_local1 = CCoffeeShopGame._instance._dayNumber;
_textDayNumber.text = ("DAY " + String((_local1 + 1)));
_local2 = CCoffeeShopGame._instance._timeOfDay;
_textTime.text = CCoffeeShopApp.ConvertUnitToString("TimeOfDay", _local2);
}
public function OnMaximized():void{
gotoAndStop("maximized");
}
}
}//package
Section 101
//CLeaderboardDisplay (CLeaderboardDisplay)
package {
import flash.display.*;
public class CLeaderboardDisplay extends MovieClip {
private var m_arrRows:Array;
private var m_lastSubmittedPlayerName:String;
public var btn_pageDown:CButtonLeaderboard;
public var btn_me:CButtonLeaderboardStar;
private var m_firstScoreToDisplay:int;// = 0
public var btn_end:CButtonLeaderboardExtreme;
private var m_numScoresToDisplay:int;// = 10
private var m_leaderboardSystem:CLeaderboardSystem;
public var btn_pageUp:CButtonLeaderboard;
private var m_errorAndWaitDisplay:CLeaderboardErrorWaitDisplay;
private var m_isWeekly:Boolean;// = false
public var btn_home:CButtonLeaderboardExtreme;
public var mc_scoreTableHost:MovieClip;
private var m_nScoresInDatabase:int;
public function CLeaderboardDisplay(){
m_isWeekly = false;
m_firstScoreToDisplay = 0;
m_numScoresToDisplay = 10;
super();
btn_home.Initialize(GoToTop);
btn_end.Initialize(GoToBottom);
btn_pageUp.Initialize(PageUp);
btn_pageDown.Initialize(PageDown);
btn_me.Initialize(GoToLastSubmitted);
btn_me.visible = false;
}
public function FetchScoresNearPlayer():void{
var _local1:int;
var _local2:Boolean;
if (!m_lastSubmittedPlayerName){
return;
};
_local1 = ((-(m_numScoresToDisplay) / 2) + 1);
_local2 = m_leaderboardSystem.FetchScoresFromServerByPlayerName(m_lastSubmittedPlayerName, m_numScoresToDisplay, _local1, OnFetchComplete, OnFetchError, m_isWeekly);
if (!_local2){
m_errorAndWaitDisplay.ReportError("Could not access server for refresh");
} else {
m_errorAndWaitDisplay.StartServerWait("Fetching scores");
};
}
public function IsAtTop():Boolean{
return ((((m_firstScoreToDisplay == 0)) || (!(m_nScoresInDatabase))));
}
public function GoToLastSubmitted():void{
if (m_lastSubmittedPlayerName){
FetchScoresNearPlayer();
};
}
public function SetRow(_arg1:int, _arg2:int, _arg3:String, _arg4:String):void{
m_arrRows[_arg1].Set(_arg2, _arg3, ("$" + _arg4));
}
public function FetchScoresFromServer():void{
var _local1:Boolean;
_local1 = m_leaderboardSystem.FetchScoresFromServerByRank(m_firstScoreToDisplay, m_numScoresToDisplay, OnFetchComplete, OnFetchError, m_isWeekly);
if (!_local1){
m_errorAndWaitDisplay.ReportError("Could not access server for refresh");
} else {
m_errorAndWaitDisplay.StartServerWait("Fetching scores");
};
}
public function OnFetchComplete(_arg1:uint, _arg2:uint, _arg3:Object):void{
var _local4:Number;
var _local5:Number;
m_errorAndWaitDisplay.EndServerWait();
_local4 = 0;
while (_local4 < GetNumRows()) {
_local5 = ((_arg1 + _local4) + 1);
if (_arg3[("name" + _local4)]){
SetRow(_local4, _local5, _arg3[("name" + _local4)], _arg3[("score" + _local4)]);
} else {
ClearRow(_local4);
};
_local4++;
};
m_nScoresInDatabase = _arg2;
m_firstScoreToDisplay = _arg1;
if (m_lastSubmittedPlayerName){
HighlightRowByName(m_lastSubmittedPlayerName);
};
if (((m_isWeekly) && (_arg3.periodType))){
CMenuHighScores(parent)._textPeriodTitle.text = _arg3.periodType;
};
}
public function GetNumRows():int{
return (m_arrRows.length);
}
public function ClearRow(_arg1:int):void{
m_arrRows[_arg1].Clear();
}
public function HighlightRow(_arg1:int):void{
if ((((_arg1 >= 0)) && ((_arg1 < m_arrRows.length)))){
m_arrRows[_arg1].Highlight();
};
}
public function get _spaceBetweenRows():Number{
return (1);
}
public function IsAtBottom():Boolean{
return (((!(m_nScoresInDatabase)) || (((m_firstScoreToDisplay + m_numScoresToDisplay) >= m_nScoresInDatabase))));
}
public function Initialize(_arg1:CLeaderboardSystem, _arg2:CLeaderboardErrorWaitDisplay, _arg3:int, _arg4:Boolean=false):void{
var _local5:CLeaderboardRow;
if (!mc_scoreTableHost){
return;
};
m_leaderboardSystem = _arg1;
m_errorAndWaitDisplay = _arg2;
m_isWeekly = _arg4;
m_numScoresToDisplay = _arg3;
m_arrRows = new Array();
while (_arg3 > 0) {
_local5 = new CLeaderboardRow();
mc_scoreTableHost.addChild(_local5);
_local5.y = (m_arrRows.length * (_local5.height + _spaceBetweenRows));
m_arrRows.push(_local5);
_arg3--;
};
FetchScoresFromServer();
}
public function PageUp():void{
m_firstScoreToDisplay = (m_firstScoreToDisplay - m_numScoresToDisplay);
if (m_firstScoreToDisplay < 0){
m_firstScoreToDisplay = 0;
};
FetchScoresFromServer();
}
public function GoToBottom():void{
if (!m_nScoresInDatabase){
m_firstScoreToDisplay = 0;
return;
};
m_firstScoreToDisplay = Math.max(0, (m_nScoresInDatabase - m_numScoresToDisplay));
FetchScoresFromServer();
}
public function GoToTop():void{
m_firstScoreToDisplay = 0;
FetchScoresFromServer();
}
public function SetSubmittedPlayerName(_arg1:String):void{
m_lastSubmittedPlayerName = _arg1;
btn_me.visible = ((!((_arg1 == null))) && ((_arg1.length > 0)));
if (m_lastSubmittedPlayerName){
FetchScoresNearPlayer();
};
}
public function LineUp():void{
m_firstScoreToDisplay--;
if (m_firstScoreToDisplay < 0){
m_firstScoreToDisplay = 0;
};
FetchScoresFromServer();
}
public function get _nScoresInDatabase():int{
return (m_nScoresInDatabase);
}
public function OnFetchError(_arg1:String):void{
m_errorAndWaitDisplay.EndServerWait();
if (_arg1){
m_errorAndWaitDisplay.ReportError(_arg1);
};
}
public function LineDown():void{
if (!m_nScoresInDatabase){
m_firstScoreToDisplay = 0;
return;
};
m_firstScoreToDisplay++;
if (m_firstScoreToDisplay >= m_nScoresInDatabase){
m_firstScoreToDisplay = (m_nScoresInDatabase - 1);
};
FetchScoresFromServer();
}
public function HighlightRowByName(_arg1:String):void{
var _local2:int;
_local2 = 0;
while (_local2 < m_arrRows.length) {
if (m_arrRows[_local2]._textName.text == _arg1){
m_arrRows[_local2].Highlight();
} else {
m_arrRows[_local2].UnHighlight();
};
_local2++;
};
}
public function PageDown():void{
if (!m_nScoresInDatabase){
m_firstScoreToDisplay = 0;
return;
};
if ((m_firstScoreToDisplay + m_numScoresToDisplay) < m_nScoresInDatabase){
m_firstScoreToDisplay = (m_firstScoreToDisplay + m_numScoresToDisplay);
};
FetchScoresFromServer();
}
}
}//package
Section 102
//CLeaderboardErrorBox (CLeaderboardErrorBox)
package {
import flash.display.*;
import flash.text.*;
public class CLeaderboardErrorBox extends MovieClip {
public var _textError:TextField;
public var btn_close:CButtonLeaderboardClose;
public function CLeaderboardErrorBox(){
btn_close.Initialize(OnClose);
}
public function OnClose():void{
visible = false;
}
}
}//package
Section 103
//CLeaderboardErrorWaitDisplay (CLeaderboardErrorWaitDisplay)
package {
import flash.display.*;
public class CLeaderboardErrorWaitDisplay extends MovieClip {
public var _errorBox:CLeaderboardErrorBox;
public var _waitBox:CLeaderboardWaitBox;
public function CLeaderboardErrorWaitDisplay(){
_waitBox.visible = false;
_errorBox.visible = false;
}
public function ReportError(_arg1:String):void{
_errorBox.visible = true;
_errorBox._textError.text = _arg1;
EndServerWait();
}
public function EndServerWait():void{
_waitBox.visible = false;
}
public function StartServerWait(_arg1:String):void{
_waitBox.visible = true;
_waitBox._textWaitMessage.text = (_arg1 + "...");
}
}
}//package
Section 104
//CLeaderboardRow (CLeaderboardRow)
package {
import flash.display.*;
import flash.text.*;
import flash.geom.*;
public class CLeaderboardRow extends MovieClip {
public var _textRank:TextField;
public var _textName:TextField;
public var _textScore:TextField;
public function CLeaderboardRow(){
Clear();
}
public function Clear():void{
_textRank.text = "";
_textName.text = "";
_textScore.text = "";
visible = false;
}
public function Set(_arg1:Number, _arg2:String, _arg3:String):void{
_textRank.text = _arg1.toString();
_textName.text = _arg2;
_textScore.text = _arg3;
visible = true;
UnHighlight();
}
public function UnHighlight():void{
var _local1:ColorTransform;
_local1 = transform.colorTransform;
_local1.redOffset = 0;
_local1.greenOffset = 0;
_local1.blueOffset = 0;
_local1.redMultiplier = 1;
_local1.greenMultiplier = 1;
_local1.blueMultiplier = 1;
transform.colorTransform = _local1;
}
public function Highlight():void{
var _local1:ColorTransform;
_local1 = transform.colorTransform;
_local1.redOffset = -40;
_local1.greenOffset = -40;
_local1.blueOffset = -40;
_local1.redMultiplier = 0.96;
_local1.greenMultiplier = 0.96;
_local1.blueMultiplier = 0.96;
transform.colorTransform = _local1;
}
}
}//package
Section 105
//CLeaderboardScoreSubmitDisplay (CLeaderboardScoreSubmitDisplay)
package {
import flash.text.*;
public class CLeaderboardScoreSubmitDisplay extends CMovieClipFresh {
private var m_fnCallback:Function;
public var _textName:TextField;
private var m_errorAndWaitDisplay:CLeaderboardErrorWaitDisplay;
private var m_leaderboardSystem:CLeaderboardSystem;
public var _buttonSubmit:CButton;
private var m_lastSubmittedName:String;
public var _textScore:TextField;
public function CLeaderboardScoreSubmitDisplay(){
_textName.restrict = "A-Z a-z";
_buttonSubmit.Initialize("Submit", OnSubmit, "hsSubmit");
}
public function OnSubmit():void{
var _local1:Object;
var _local2:Boolean;
if (!CLeaderboardSystem.IsLegalName(_textName.text)){
m_errorAndWaitDisplay.ReportError("This name is not permitted. Please choose another.");
return;
};
_buttonSubmit.SetEnabled(false);
_local1 = {name:_textName.text, score:GetNumericScore()};
_local2 = m_leaderboardSystem.SubmitScore(_local1, OnSubmitSuccessful, OnSubmitFailed);
if (_local2){
m_lastSubmittedName = _local1.name;
m_errorAndWaitDisplay.StartServerWait("Uploading score");
};
}
public function OnSubmitFailed(_arg1:int, _arg2:String):void{
var _local3:Boolean;
m_errorAndWaitDisplay.EndServerWait();
_local3 = !((_arg1 == 3));
m_lastSubmittedName = null;
if (_arg2){
m_errorAndWaitDisplay.ReportError(_arg2);
};
if (((!((m_fnCallback == null))) && (_local3))){
m_fnCallback(-1);
};
_buttonSubmit.SetEnabled(true);
}
public function GetSubmittedPlayerName():String{
return (m_lastSubmittedName);
}
public function Initialize(_arg1:CLeaderboardSystem, _arg2:Function, _arg3:CLeaderboardErrorWaitDisplay):void{
m_leaderboardSystem = _arg1;
m_fnCallback = _arg2;
m_errorAndWaitDisplay = _arg3;
}
public function GetNumericScore():Number{
return (Number(_textScore.text));
}
public function OnSubmitSuccessful(_arg1:int):void{
m_errorAndWaitDisplay.EndServerWait();
if (m_fnCallback != null){
m_fnCallback(_arg1);
};
}
}
}//package
Section 106
//CLeaderboardSystem (CLeaderboardSystem)
package {
import flash.events.*;
import flash.net.*;
import flash.utils.*;
public class CLeaderboardSystem {
private var m_fnCallbackSubmitSuccess:Function;
private var m_fnCallbackSubmitError:Function;
private var m_fnCallbackFetchSuccess:Function;
private var m_fnCallbackFetchError:Function;
private var m_nChallengeAttempts:int;// = 0
private var m_lastScoreInfo:Object;
private var m_loader:URLLoader;
private var m_gameName:String;
private var m_currentChallenge:Number;// = 0
public function CLeaderboardSystem(_arg1:String){
m_currentChallenge = 0;
m_nChallengeAttempts = 0;
super();
m_gameName = _arg1;
}
public function FetchScoresFromServerByBaseScore(_arg1:Number, _arg2:uint, _arg3:Function, _arg4:Function, _arg5:Boolean=false):Boolean{
var _local6:URLVariables;
_local6 = new URLVariables();
_local6.baseScore = _arg1;
return (FetchScoresFromServer(_local6, _arg2, _arg3, _arg4, _arg5));
}
private function EncodeSeed(_arg1:Number, _arg2:Number):Number{
_arg2 = Math.floor((_arg2 * 100));
_arg1 = (_arg1 ^ _arg2);
_arg1 = (_arg1 * 7);
_arg1 = (_arg1 + 7);
_arg1 = (_arg1 / 13);
_arg1 = (_arg1 * 37);
_arg1 = (_arg1 - 121);
_arg1 = (_arg1 - 11);
_arg1 = Math.abs(Math.floor(_arg1));
return (_arg1);
}
public function FetchScoresFromServer(_arg1:URLVariables, _arg2:uint, _arg3:Function, _arg4:Function, _arg5:Boolean=false, _arg6:int=0):Boolean{
var _local7:String;
if (!m_gameName){
return (false);
};
m_fnCallbackFetchSuccess = _arg3;
m_fnCallbackFetchError = _arg4;
_arg1.game = m_gameName;
_arg1.ver = CCoffeeShopApp.GetGameVersionString();
_arg1.numScoresToDisplay = _arg2;
_arg1.offset = _arg6;
if (_arg5){
_arg1.weekly = 1;
};
_local7 = (((_serverURL + _leaderboardPhpURL) + "?cacheClear=") + getTimer());
SendAndLoad(_local7, _arg1, OnFetchComplete, OnFetchError);
return (true);
}
public function UpdateChallenge(_arg1:Number):void{
m_currentChallenge = _arg1;
m_nChallengeAttempts++;
if (m_nChallengeAttempts > 3){
return;
};
if (m_lastScoreInfo){
SubmitScore(m_lastScoreInfo, m_fnCallbackSubmitSuccess, m_fnCallbackSubmitError);
};
}
public function FetchScoresFromServerByRank(_arg1:uint, _arg2:uint, _arg3:Function, _arg4:Function, _arg5:Boolean=false):Boolean{
var _local6:URLVariables;
_local6 = new URLVariables();
_local6.firstScoreToDisplay = _arg1;
return (FetchScoresFromServer(_local6, _arg2, _arg3, _arg4, _arg5));
}
public function OnFetchError(_arg1:Event):void{
if (m_fnCallbackFetchError != null){
m_fnCallbackFetchError(_arg1["text"]);
};
}
public function OnSubmitComplete(_arg1:Event):void{
if (m_loader.dataFormat == "text"){
if (m_fnCallbackSubmitError != null){
m_fnCallbackSubmitError(2000, ("SERVER ERROR: " + m_loader.data));
};
return;
};
if (m_loader.data.faultyResponse){
UpdateChallenge(int(m_loader.data.challenge));
return;
};
if (m_loader.data.error != undefined){
if (m_fnCallbackSubmitError != null){
m_fnCallbackSubmitError(m_loader.data.error, m_loader.data.errorReason);
};
return;
} else {
OnSubmitSuccessful(m_loader.data.playerRank);
};
}
public function OnFetchComplete(_arg1:Event):void{
if (((!((m_fnCallbackFetchSuccess == null))) && (m_loader.data))){
m_fnCallbackFetchSuccess(m_loader.data.firstScoreDisplayed, m_loader.data.numRecords, m_loader.data);
};
}
protected function SendAndLoad(_arg1:String, _arg2:URLVariables, _arg3:Function, _arg4:Function):void{
var _local5:URLRequest;
m_loader = new URLLoader();
m_loader.dataFormat = URLLoaderDataFormat.VARIABLES;
m_loader.addEventListener(Event.COMPLETE, _arg3);
m_loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, _arg4);
m_loader.addEventListener(IOErrorEvent.IO_ERROR, _arg4);
_local5 = new URLRequest(_arg1);
_local5.data = _arg2;
_local5.method = URLRequestMethod.POST;
m_loader.load(_local5);
}
public function OnSubmitError(_arg1:Event):void{
if (m_fnCallbackSubmitError != null){
m_fnCallbackSubmitError(1000, _arg1["text"]);
};
}
public function FetchScoresFromServerByPlayerName(_arg1:String, _arg2:uint, _arg3:int, _arg4:Function, _arg5:Function, _arg6:Boolean=false):Boolean{
var _local7:URLVariables;
_local7 = new URLVariables();
_local7.searchName = _arg1;
return (FetchScoresFromServer(_local7, _arg2, _arg4, _arg5, _arg6, _arg3));
}
public function get _serverURL():String{
return ("http://stats.armorgames.com/coffee/");
}
public function OnSubmitSuccessful(_arg1:int):void{
m_nChallengeAttempts = 0;
if (m_fnCallbackSubmitSuccess != null){
m_fnCallbackSubmitSuccess(_arg1);
};
}
public function get _leaderboardPhpURL():String{
return ((m_gameName + "_leaderboard.php"));
}
public function SubmitScore(_arg1:Object, _arg2:Function, _arg3:Function):Boolean{
var _local4:URLVariables;
var _local5:String;
var _local6:String;
m_fnCallbackSubmitSuccess = _arg2;
m_fnCallbackSubmitError = _arg3;
if (!m_gameName){
return (false);
};
if (!_arg1.name){
_arg3("Please enter a user name to submit.", false);
return (false);
};
if (!IsLegalName(_arg1.name)){
_arg3("This name is not permitted. Please choose another.", false);
return (false);
};
_local4 = new URLVariables();
_local4.game = m_gameName;
_local4.ver = CCoffeeShopApp.GetGameVersionString();
_local4.password = "9Ecu7HUz";
_local4.response = EncodeSeed(m_currentChallenge, _arg1.score);
for (_local5 in _arg1) {
_local4[_local5] = _arg1[_local5];
};
m_lastScoreInfo = _arg1;
_local6 = (((_serverURL + _leaderboardPhpURL) + "?cacheClear=") + getTimer());
SendAndLoad(_local6, _local4, OnSubmitComplete, OnSubmitError);
return (true);
}
public static function IsLegalName(_arg1:String):Boolean{
var _local2:Array;
var _local3:int;
if (!_arg1){
return (false);
};
_local2 = new Array();
_local2.push("fuck");
_local2.push("shit");
_local2.push("ass");
_local2.push("sh1t");
_local2.push("4ss");
_local2.push("bitch");
_local2.push("b1tch");
_local2.push("nigger");
_local2.push("n1gger");
_local2.push("pussy");
_local2.push("cunt");
_local2.push("clit");
_local2.push("twat");
_local2.push("penis");
_local2.push("cock");
_local2.push("sperm");
_local2.push("damn");
_local2.push("jesus");
_local2.push("satan");
_local2.push("god");
_local2.push("whore");
_local2.push("bastard");
_arg1 = _arg1.toLowerCase();
_local3 = 0;
while (_local3 < _local2.length) {
if (_arg1.indexOf(_local2[_local3]) != -1){
return (false);
};
_local3++;
};
return (true);
}
}
}//package
Section 107
//CLeaderboardWaitBox (CLeaderboardWaitBox)
package {
import flash.display.*;
import flash.text.*;
public class CLeaderboardWaitBox extends MovieClip {
public var _textWaitMessage:TextField;
}
}//package
Section 108
//CMenuCredits (CMenuCredits)
package {
import flash.display.*;
public class CMenuCredits extends MovieClip {
}
}//package
Section 109
//CMenuEnterHighScore (CMenuEnterHighScore)
package {
public class CMenuEnterHighScore extends CLeaderboardScoreSubmitDisplay {
public var _buttonSkip:CButton;
public function CMenuEnterHighScore(){
_textScore.text = CCoffeeShopApp.ConvertUnitToString("Cash", CCoffeeShopApp._instance.GetGameOverScore());
_buttonSkip.Initialize("Skip", OnSkip, "hsSkip");
}
public function OnSkip():void{
_buttonSubmit.SetEnabled(false);
_buttonSkip.SetEnabled(false);
OnSubmitSuccessful(-1);
}
override public function GetNumericScore():Number{
var _local1:String;
_local1 = _textScore.text.substr(1);
_local1 = _local1.split(",").join("");
return (Number(_local1));
}
}
}//package
Section 110
//CMenuHighScores (CMenuHighScores)
package {
import flash.text.*;
public class CMenuHighScores extends CMovieClipFresh {
public var _textPeriodTitle:TextField;
public var _leaderboardAllTime:CLeaderboardDisplay;
public var _leaderboardWeekly:CLeaderboardDisplay;
public function CMenuHighScores(){
var _local1:String;
super();
_leaderboardAllTime.Initialize(CCoffeeShopApp._instance._mainLeaderboardSystem, CCoffeeShopApp._instance._errorAndWaitDisplay, 10);
_leaderboardWeekly.Initialize(CCoffeeShopApp._instance._weeklyFetchLeaderboardSystem, CCoffeeShopApp._instance._errorAndWaitDisplay, 10, true);
_local1 = CCoffeeShopApp._instance._leaderboardPlayerName;
if (_local1){
_leaderboardAllTime.SetSubmittedPlayerName(_local1);
_leaderboardWeekly.SetSubmittedPlayerName(_local1);
};
}
}
}//package
Section 111
//CMenuIntro (CMenuIntro)
package {
import flash.events.*;
import flash.net.*;
import flash.display.*;
import flash.utils.*;
public class CMenuIntro extends CMovieClipFresh {
public var _buttonBack:CButtonBack;
public var _buttonCredits:CButton;
public var _buttonMoreGames:CButton;
public var _innerMenuHost:MovieClip;
public var _buttonPlay:CButtonPlay;
private var _fnCallAfterMinimize:Function;
public var _letterboxLowerA:MovieClip;
public var _letterboxLowerD:MovieClip;
public var _letterboxLowerB:MovieClip;
public var _customerHost:MovieClip;
private var _customerSpawnTimer:Timer;
public var _buttonHighScores:CButton;
private var _gameSettingsShowTutorial:Boolean;// = true
private var _gameSettingsShopName:String;
public function CMenuIntro(){
_gameSettingsShowTutorial = true;
super();
addFrameScript(15, frame16, 149, frame150, 182, frame183, 214, frame215, 277, frame278);
gotoAndPlay("appear");
_letterboxLowerA.gotoAndPlay(50);
_letterboxLowerB.gotoAndPlay(100);
_letterboxLowerD.gotoAndPlay(130);
SetupButtons();
}
function frame150(){
OnDoneAppearing();
}
private function OnHighScoresReally():void{
}
public function OnDoneAppearing(){
stop();
}
private function OnCreditsReally():void{
}
override public function FirstFrameInitialize(_arg1:Event):void{
if (CCoffeeShopApp._instance){
CCoffeeShopApp._instance.OnMenuIntroDoneInitializing(this);
};
CCoffeeSound._instance.PlayMusic("music_menu", 0.75, 3, int.MAX_VALUE);
_customerSpawnTimer = new Timer(CRandom._instance.GetIntInRange(5000, 6000), int.MAX_VALUE);
_customerSpawnTimer.addEventListener("timer", OnTimer);
_customerSpawnTimer.start();
super.FirstFrameInitialize(_arg1);
}
function frame278(){
OnGotoPlayDone();
}
public function OnMoreGames():void{
navigateToURL(new URLRequest("http://www.armorgames.com"));
}
function frame215(){
OnRestoreDone();
}
public function Play(_arg1:String, _arg2:Boolean):void{
_gameSettingsShopName = _arg1;
_gameSettingsShowTutorial = _arg2;
CCoffeeSound._instance.FadeOutMusic("music_menu", 3);
_customerSpawnTimer.removeEventListener("timer", OnTimer);
gotoAndPlay("gotoplay");
}
function frame183(){
OnMinimizeDone();
}
protected function SetupButtons():void{
_buttonPlay.Initialize("Play", OnPlay, "menuPlay");
_buttonMoreGames.Initialize("More Games...", OnMoreGames, "moreGames");
_buttonHighScores.Initialize("High Scores", OnHighScores, "highScores");
_buttonCredits.Initialize("Credits", OnCredits, "credits");
_buttonBack.Initialize("", OnBack, "back");
}
public function ShowPlayOptions():void{
}
function frame16(){
OnMinimizeDone();
}
public function OnTimer(_arg1:TimerEvent):void{
var _local2:CCustomer;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
_local2 = null;
_local3 = CRandom._instance.GetIntInRange(0, 5);
_local4 = 1;
_local5 = 399;
_local6 = 399;
_local7 = 40;
_local8 = 250;
_local9 = -150;
_local10 = 150;
if (CRandom._instance.GetBoolean()){
_local4 = -1;
};
if (_local3 == 0){
_local2 = new CCustomer(_local4, _local7, _local8, _local5, _local6, _local9, _local10);
} else {
if (_local3 == 1){
_local2 = new CCustomerFat(_local4, _local7, _local8, _local5, _local6, _local9, _local10);
} else {
if (_local3 == 2){
_local2 = new CCustomerGranny(_local4, _local7, _local8, _local5, _local6, _local9, _local10);
} else {
if (_local3 == 3){
_local2 = new CCustomerPreppie(_local4, _local7, _local8, _local5, _local6, _local9, _local10);
} else {
if (_local3 == 4){
_local2 = new CCustomerBizGirl(_local4, _local7, _local8, _local5, _local6, _local9, _local10);
} else {
if (_local3 == 5){
_local2 = new CCustomerPurseDog(_local4, _local7, _local8, _local5, _local6, _local9, _local10);
};
};
};
};
};
};
_customerHost.addChild(_local2);
_customerSpawnTimer.delay = CRandom._instance.GetIntInRange(500, 12000);
}
public function OnBack():void{
gotoAndPlay("restore");
_buttonBack.SetEnabled(false);
EnableMainButtons(true);
}
public function OnRestoreDone():void{
gotoAndStop("shown");
}
public function JumpToHighScores():void{
_buttonBack.SetEnabled(true);
_innerMenuHost.addChild(new CMenuHighScores());
gotoAndPlay("appear minimized");
_letterboxLowerA.gotoAndPlay(50);
_letterboxLowerB.gotoAndPlay(100);
_letterboxLowerD.gotoAndPlay(130);
}
public function OnCredits():void{
Minimize(OnCreditsReally);
_innerMenuHost.addChild(new CMenuCredits());
}
public function Minimize(_arg1:Function):void{
_fnCallAfterMinimize = _arg1;
EnableMainButtons(false);
gotoAndPlay("minimize");
_buttonBack.SetEnabled(true);
}
public function OnHighScores():void{
Minimize(OnHighScoresReally);
_innerMenuHost.addChild(new CMenuHighScores());
}
public function OnPlay():void{
Minimize(ShowPlayOptions);
_innerMenuHost.addChild(new CMenuPlayOptions());
}
protected function EnableMainButtons(_arg1:Boolean):void{
_buttonPlay.SetEnabled(_arg1);
_buttonMoreGames.SetEnabled(_arg1);
_buttonHighScores.SetEnabled(_arg1);
_buttonCredits.SetEnabled(_arg1);
}
public function OnMinimizeDone():void{
if (_fnCallAfterMinimize != null){
_fnCallAfterMinimize();
_fnCallAfterMinimize = null;
};
stop();
}
public function OnGotoPlayDone():void{
stop();
CCoffeeShopApp._instance.GotoGame(_gameSettingsShopName, _gameSettingsShowTutorial);
}
}
}//package
Section 112
//CMenuPlayOptions (CMenuPlayOptions)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class CMenuPlayOptions extends MovieClip {
public var _checkboxShowTutorial:CCheckbox;
public var _buttonPlayCommit:CButtonPlayCommit;
public var _textShopName:TextField;
public function CMenuPlayOptions(){
var _local1:Boolean;
var _local2:Array;
super();
_buttonPlayCommit.Initialize("Play!", OnPlay, "reallyPlay");
_local1 = true;
if (((!((CCoffeeShopApp._cookie == null))) && (!((CCoffeeShopApp._cookie.wantsTutorials == undefined))))){
_local1 = CCoffeeShopApp._cookie.wantsTutorials;
};
_checkboxShowTutorial.Initialize("Show tutorial", _local1);
_local2 = ["The Coffee Mug", "Cafe Krazy", "Cafe Calypso", "Coffee Galore", "Jitter's"];
if (((!((CCoffeeShopApp._cookie == null))) && (CCoffeeShopApp._cookie.shopName))){
_textShopName.text = CCoffeeShopApp._cookie.shopName;
} else {
_textShopName.text = _local2[int((Math.random() * _local2.length))];
};
_textShopName.addEventListener(MouseEvent.CLICK, onShopNameFocus);
}
public function onShopNameFocus(_arg1:Event):void{
if (_textShopName.selectionBeginIndex == _textShopName.selectionEndIndex){
_textShopName.setSelection(0, _textShopName.text.length);
};
}
public function OnPlay():void{
CCoffeeShopApp._cookie.shopName = _textShopName.text;
CCoffeeShopApp._cookie.wantsTutorials = _checkboxShowTutorial._isChecked;
CMenuIntro(parent.parent).Play(_textShopName.text, _checkboxShowTutorial._isChecked);
}
}
}//package
Section 113
//CMetaStatsCollector (CMetaStatsCollector)
package {
import flash.events.*;
import flash.net.*;
import flash.utils.*;
public class CMetaStatsCollector {
private var m_loader:URLLoader;
private var m_mapButtons:Array;
private static var s_instance:CMetaStatsCollector;
public function CMetaStatsCollector(){
m_mapButtons = new Array();
super();
s_instance = this;
}
public function ClearButtonStats():void{
m_mapButtons = new Array();
}
protected function OnSendFailed(_arg1:Event):void{
}
protected function MakeVariables():URLVariables{
var _local1:URLVariables;
_local1 = new URLVariables();
_local1.password = "9Ecu7HUz";
return (_local1);
}
protected function SetButtonStats(_arg1:URLVariables):void{
var _local2:int;
var _local3:String;
return;
}
public function get _serverURL():String{
return ("http://stats.armorgames.com/coffee/coffee_stats_submit.php");
}
protected function OnSendSucceeded(_arg1:Event):void{
}
public function RecordGameAbort():void{
var _local1:URLVariables;
_local1 = MakeVariables();
_local1.gameAbort = 1;
SetButtonStats(_local1);
ClearButtonStats();
}
public function AddButtonClick(_arg1:String):void{
if (m_mapButtons[_arg1]){
var _local2 = m_mapButtons;
var _local3 = _arg1;
var _local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
} else {
m_mapButtons[_arg1] = 1;
};
}
public function RecordLoaded():void{
var _local1:URLVariables;
_local1 = MakeVariables();
_local1.load = 1;
SendStats(_local1);
}
protected function SendStats(_arg1:URLVariables):void{
var _local2:URLRequest;
m_loader = new URLLoader();
m_loader.dataFormat = URLLoaderDataFormat.VARIABLES;
m_loader.addEventListener(Event.COMPLETE, OnSendSucceeded);
m_loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, OnSendFailed);
m_loader.addEventListener(IOErrorEvent.IO_ERROR, OnSendFailed);
_local2 = new URLRequest(((_serverURL + "?cacheClear=") + getTimer()));
_local2.data = _arg1;
_local2.method = URLRequestMethod.POST;
m_loader.load(_local2);
}
public function RecordVisit(_arg1:int, _arg2:String):void{
var _local3:URLVariables;
_local3 = MakeVariables();
_local3.visit = _arg1;
_local3.hostURL = _arg2;
SendStats(_local3);
}
public function RecordEndOfDay(_arg1:int):void{
var _local2:URLVariables;
_local2 = MakeVariables();
_local2.dayEnd = _arg1;
SetButtonStats(_local2);
ClearButtonStats();
}
public function RecordGameStart():void{
var _local1:URLVariables;
_local1 = MakeVariables();
_local1.gameStart = 1;
}
public static function get _instance():CMetaStatsCollector{
return (s_instance);
}
}
}//package
Section 114
//CMovieClipFresh (CMovieClipFresh)
package {
import flash.events.*;
import flash.display.*;
public class CMovieClipFresh extends MovieClip {
public function CMovieClipFresh(){
addEventListener(Event.ENTER_FRAME, FirstFrameInitialize);
}
public function FirstFrameInitialize(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, FirstFrameInitialize);
if ((parent is IMovieClipFreshHost)){
IMovieClipFreshHost(parent).OnChildConstructed(this);
};
}
}
}//package
Section 115
//CMusicController (CMusicController)
package {
import flash.events.*;
import flash.media.*;
import flash.utils.*;
public class CMusicController {
private var _fadeOutSeconds:Number;// = 0
private var _startPlaySeconds:Number;// = 0
private var _sound:Sound;
private var _soundChannel:SoundChannel;
private var _maxVolume:Number;// = 1
private var _isPlaying:Boolean;// = false
private var _numLoops:uint;// = 0
private var _fadeOutMaxVolume:Number;// = 1
private var _startFadeOutSeconds:Number;// = 0
private var _loopOffset:uint;// = 0
private var _fadeInSeconds:Number;// = 0
public function CMusicController(_arg1:Sound, _arg2:Number=1, _arg3:Number=0, _arg4:uint=0, _arg5:uint=0){
_maxVolume = 1;
_startPlaySeconds = 0;
_fadeInSeconds = 0;
_startFadeOutSeconds = 0;
_fadeOutSeconds = 0;
_fadeOutMaxVolume = 1;
_isPlaying = false;
_loopOffset = 0;
_numLoops = 0;
super();
_sound = _arg1;
SetMaxVolume(_arg2);
Play(_arg3, _arg4, _arg5);
}
public function SetMaxVolume(_arg1:Number):void{
_maxVolume = _arg1;
}
public function OnMusicComplete(_arg1:Event):void{
if (_numLoops > 0){
_channel = _sound.play(_loopOffset, (_numLoops - 1));
SetVolume(_maxVolume);
} else {
CCoffeeShopApp._stage.removeEventListener(Event.ENTER_FRAME, OnEnterFrame);
_isPlaying = false;
};
}
protected function set _channel(_arg1:SoundChannel):void{
if (_soundChannel != null){
_soundChannel.removeEventListener(Event.SOUND_COMPLETE, OnMusicComplete);
};
_soundChannel = _arg1;
}
public function FadeOut(_arg1:Number):void{
_fadeOutSeconds = _arg1;
_fadeOutMaxVolume = GetVolume();
_startFadeOutSeconds = (getTimer() / 1000);
}
public function Play(_arg1:Number=0, _arg2:uint=0, _arg3:uint=0){
_fadeInSeconds = _arg1;
_fadeOutSeconds = 0;
if (!_isPlaying){
_channel = _sound.play(0, 0);
CCoffeeShopApp._stage.addEventListener(Event.ENTER_FRAME, OnEnterFrame);
};
_numLoops = _arg2;
_loopOffset = _arg3;
_startPlaySeconds = (getTimer() / 1000);
if (_fadeInSeconds > 0){
SetVolume(0);
} else {
SetVolume(_maxVolume);
};
_isPlaying = true;
_soundChannel.addEventListener(Event.SOUND_COMPLETE, OnMusicComplete);
}
public function OnEnterFrame(_arg1:Event):void{
var _local2:Number;
_local2 = 0;
if (_fadeOutSeconds > 0){
_local2 = (((getTimer() / 1000) - _startFadeOutSeconds) / _fadeOutSeconds);
_local2 = Math.max(0, Math.min(1, _local2));
SetVolume(((1 - _local2) * _fadeOutMaxVolume));
if (_local2 >= 1){
_soundChannel.stop();
_fadeOutSeconds = 0;
_isPlaying = false;
CCoffeeShopApp._stage.removeEventListener(Event.ENTER_FRAME, OnEnterFrame);
};
} else {
if (_fadeInSeconds > 0){
_local2 = (((getTimer() / 1000) - _startPlaySeconds) / _fadeInSeconds);
_local2 = Math.max(0, Math.min(1, _local2));
SetVolume((_local2 * _maxVolume));
if (_local2 >= 1){
_fadeInSeconds = 0;
};
};
};
}
protected function GetVolume():Number{
return (_soundChannel.soundTransform.volume);
}
protected function SetVolume(_arg1:Number):void{
var _local2:SoundTransform;
_local2 = _soundChannel.soundTransform;
_local2.volume = _arg1;
_soundChannel.soundTransform = _local2;
}
}
}//package
Section 116
//consideration_bad (consideration_bad)
package {
import flash.media.*;
public dynamic class consideration_bad extends Sound {
}
}//package
Section 117
//consideration_good (consideration_good)
package {
import flash.media.*;
public dynamic class consideration_good extends Sound {
}
}//package
Section 118
//CPageTabs (CPageTabs)
package {
import flash.display.*;
public class CPageTabs extends MovieClip {
private var _nTabs:uint;// = 0
private var _tabXOffset:int;// = 112
public function CPageTabs(){
_nTabs = 0;
_tabXOffset = 112;
super();
}
public function AddTab(_arg1:String, _arg2:Function):void{
var _local3:*;
_local3 = new CHUDTab();
_local3.Initialize(_arg1, _arg2, ("tab" + _arg1));
_local3.name = _arg1;
addChild(_local3);
_local3.x = (_nTabs * _tabXOffset);
_nTabs++;
}
public function BringForwardTab(_arg1:String):void{
var _local2:*;
_local2 = CHUDTab(getChildByName(_arg1));
if (_local2){
setChildIndex(_local2, (numChildren - 1));
};
}
}
}//package
Section 119
//CQuitConfirm (CQuitConfirm)
package {
import flash.display.*;
public class CQuitConfirm extends MovieClip {
private var m_fnCallbackYes:Function;
private var m_fnCallbackNo:Function;
public var _buttonYes:CButtonMenu;
public var _buttonNo:CButtonMenu;
public function CQuitConfirm(){
visible = false;
_buttonYes.Initialize("Yes", OnYes, "quitYes");
_buttonNo.Initialize("No", OnNo, "quitNo");
}
public function OnNo():void{
if (m_fnCallbackNo != null){
m_fnCallbackNo();
};
}
public function OnYes():void{
if (m_fnCallbackYes != null){
m_fnCallbackYes();
};
}
public function Initialize(_arg1:Function, _arg2:Function):void{
m_fnCallbackYes = _arg1;
m_fnCallbackNo = _arg2;
}
}
}//package
Section 120
//CRandom (CRandom)
package {
class CRandom {
private var _seed:Number;// = 0
private static var s_instance:CRandom;
function CRandom(_arg1:Number){
_seed = 0;
super();
if (s_instance){
throw ("Illegal second CRandom singleton instantiated.");
};
s_instance = this;
SetSeed(_arg1);
}
function SetSeed(_arg1:Number):void{
_seed = _arg1;
}
function GetBoolean():Boolean{
return ((GetRandom() < 0.5));
}
function GetIntInRange(_arg1:int, _arg2:int):int{
return (int((_arg1 + (GetRandom() * ((_arg2 - _arg1) + 1)))));
}
function GetNumInRange(_arg1:Number, _arg2:Number):Number{
return ((_arg1 + (GetRandom() * ((_arg2 - _arg1) + 1))));
}
function GetRandom():Number{
_seed = (((_seed * 9301) + 49297) % 233280);
return ((_seed / 233280));
}
static function get _instance():CRandom{
return (s_instance);
}
}
}//package
Section 121
//CScene (CScene)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class CScene extends MovieClip {
public var _realScene:CSceneReal;
private var _lastFrameCustomerMade;// = -1
private var _zoomTargetScale:Number;// = 1
private var _framesPerCustomer:Number;// = 0
private var _zoomDuration:Number;// = 1000
private var _zoomStartScale:Number;
private var _nCustomersMade:int;// = 0
private var _nFrames:int;// = 0
private var _zoomStartTime:uint;
private var _nCustomersToMake:int;// = 0
public function CScene(){
_zoomTargetScale = 1;
_zoomDuration = 1000;
_nFrames = 0;
_lastFrameCustomerMade = -1;
_nCustomersMade = 0;
_nCustomersToMake = 0;
_framesPerCustomer = 0;
super();
_zoomTargetScale = (_zoomStartScale = scaleX);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function SetZoom(_arg1:Number):void{
scaleX = (scaleY = (_zoomTargetScale = (_zoomStartScale = _arg1)));
}
public function MaybeMakeCustomer():void{
_nFrames++;
if ((((_nCustomersMade < _nCustomersToMake)) && ((_nFrames > (_lastFrameCustomerMade + _framesPerCustomer))))){
_realScene.CreateCustomer();
_nCustomersMade++;
_lastFrameCustomerMade = _nFrames;
};
}
protected function UpdateZoom():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = MathUtil.Clamp(((getTimer() - _zoomStartTime) / _zoomDuration), 0, 1);
_local2 = ((1 - Math.cos((_local1 * Math.PI))) * 0.5);
_local3 = MathUtil.Lerp(_zoomStartScale, _zoomTargetScale, _local2);
if (scaleX != _local3){
scaleX = (scaleY = _local3);
};
}
public function SpawnThoughtBubbleConsideration(_arg1:CCustomer, _arg2:String, _arg3:Boolean):CThoughtBubbleConsideration{
var _local4:CThoughtBubbleConsideration;
if (CCoffeeShopGame._instance._isSkippingToEndOfDay){
return (null);
};
_local4 = new CThoughtBubbleConsideration(_arg1, _arg2, _arg3);
addChild(_local4);
_local4.onEnterFrame(null);
return (_local4);
}
public function SpawnThoughtBubbleReaction(_arg1:CCustomer, _arg2:String, _arg3:Boolean):CThoughtBubble{
var _local4:CThoughtBubble;
if (CCoffeeShopGame._instance._isSkippingToEndOfDay){
return (null);
};
_local4 = new CThoughtBubble(_arg1, _arg2, _arg3);
addChild(_local4);
_local4.onEnterFrame(null);
return (_local4);
}
public function onEnterFrame(_arg1:Event):void{
MaybeMakeCustomer();
}
public function StartMakingCustomers(_arg1:int, _arg2:int):void{
_lastFrameCustomerMade = -1;
_nCustomersMade = 0;
_nCustomersToMake = _arg1;
_framesPerCustomer = (Number(_arg2) / Number(_arg1));
}
public function SetTargetZoom(_arg1:Number, _arg2:Number):void{
_zoomTargetScale = _arg1;
_zoomDuration = (_arg2 * 1000);
_zoomStartScale = scaleX;
_zoomStartTime = getTimer();
}
}
}//package
Section 122
//CSceneReal (CSceneReal)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import fl.motion.*;
import flash.geom.*;
public class CSceneReal extends CMovieClipFresh {
public var _weatherSnow:MovieClip;
public var _playerCharacter:MovieClip;
private var _middayTransform:ColorTransform;
private var _nightTransform:ColorTransform;
public var _customerHost:MovieClip;
public var _storeName:TextField;
public var _backdrop:MovieClip;
private var _dawnTransform:ColorTransform;
private var _duskTransform:ColorTransform;
public var _weatherRain:MovieClip;
public var _soldOutSign:MovieClip;
public function CSceneReal(){
_nightTransform = new ColorTransform(0.41, 0.41, 0.41, 1, 0, 0, 30);
_dawnTransform = new ColorTransform(0.67, 0.67, 0.67, 1, 84, 0, 0);
_middayTransform = new ColorTransform();
_duskTransform = new ColorTransform(0.67, 0.67, 0.67, 1, 67, 50, 0);
_soldOutSign.visible = false;
_weatherRain.visible = false;
_weatherSnow.visible = false;
SetWeather("fair");
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function CreateCustomer():void{
var _local1:CCustomer;
var _local2:Number;
var _local3:int;
_local1 = null;
if (CCoffeeShopGame._instance._shop._reputation > 0.5){
_local2 = (CRandom._instance.GetRandom() * 400);
if (_local2 < CCoffeeShopGame._instance._shop._reputation){
_local1 = new CCustomerPope();
};
};
if (!_local1){
_local3 = CRandom._instance.GetIntInRange(0, 5);
if (_local3 == 0){
_local1 = new CCustomer();
} else {
if (_local3 == 1){
_local1 = new CCustomerFat();
} else {
if (_local3 == 2){
_local1 = new CCustomerGranny();
} else {
if (_local3 == 3){
_local1 = new CCustomerPreppie();
} else {
if (_local3 == 4){
_local1 = new CCustomerBizGirl();
} else {
if (_local3 == 5){
_local1 = new CCustomerPurseDog();
};
};
};
};
};
};
};
_customerHost.addChild(_local1);
}
override public function FirstFrameInitialize(_arg1:Event):void{
super.FirstFrameInitialize(_arg1);
_storeName.text = CCoffeeShopGame._instance._shop.GetName();
}
public function SortCustomers():void{
var _local1:Array;
var _local2:uint;
var _local3:int;
_local1 = new Array();
_local2 = 0;
while (_local2 < _customerHost.numChildren) {
if ((_customerHost.getChildAt(_local2) is CCustomer)){
_local1.push(_customerHost.getChildAt(_local2));
};
_local2++;
};
_local1.sortOn("y", Array.NUMERIC);
_local3 = (_local1.length - 1);
while (_local3 >= 0) {
if (_customerHost.getChildAt(_local3) != _local1[_local3]){
_customerHost.setChildIndex(_local1[_local3], _local3);
};
_local3--;
};
}
public function SetWeather(_arg1:String):void{
_backdrop.gotoAndStop(_arg1);
CCoffeeSound._instance.PlayAmbient(("ambient_" + _arg1));
}
protected function UpdateTimeOfDayEffects(_arg1:Number):void{
var _local2:Number;
var _local3:ColorTransform;
var _local4:ColorTransform;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:ColorTransform;
_local2 = 0;
_local3 = null;
_local4 = null;
_local5 = 0.1;
_local6 = 0.25;
_local7 = 0.8;
_local8 = 0.98;
if (_arg1 < _local5){
_local2 = (_arg1 / _local5);
_local3 = _nightTransform;
_local4 = _dawnTransform;
} else {
if (_arg1 < _local6){
_local2 = ((_arg1 - _local5) / (_local6 - _local5));
_local3 = _dawnTransform;
_local4 = _middayTransform;
} else {
if (_arg1 < _local7){
_local2 = ((_arg1 - _local6) / (_local7 - _local6));
_local3 = _middayTransform;
_local4 = _duskTransform;
} else {
if (_arg1 < _local8){
_local2 = ((_arg1 - _local7) / (_local8 - _local7));
_local3 = _duskTransform;
_local4 = _nightTransform;
} else {
_local2 = 0;
_local3 = _nightTransform;
_local4 = _nightTransform;
};
};
};
};
_local9 = Color.interpolateTransform(_local3, _local4, _local2);
transform.colorTransform = _local9;
}
public function onEnterFrame(_arg1:Event):void{
SortCustomers();
_soldOutSign.visible = ((!(CCoffeeShopGame._instance._isTimePaused)) && ((CCoffeeShopGame._instance._shop.GetNumServingsAvailable() <= 0)));
}
}
}//package
Section 123
//CShop (CShop)
package {
public class CShop {
private var _shopName:String;// = ""
private var _mapRecipeAmounts:Array;
private var _amountCashAtStartOfDay:int;
private var _mapStatsDaily:Array;
private var _mapStatsAllTime:Array;
private var _myReputation:Number;// = 0
private var _maxCustommerAffectOnReputationPerPurchase:Number;// = 0.04
private var _numCupsSold:uint;// = 0
private var _amountCash:int;
private var _mapInventoryAmounts:Array;
private var _price:int;// = 200
private var _myReputationAtStartOfDay;// = 0
private var _cupsSoldAtStartOfDay:uint;// = 0
public function CShop(_arg1:String){
_numCupsSold = 0;
_cupsSoldAtStartOfDay = 0;
_shopName = "";
_amountCash = CCoffeeShopGame._instance._initialCash;
_price = 200;
_myReputation = 0;
_myReputationAtStartOfDay = 0;
_maxCustommerAffectOnReputationPerPurchase = 0.04;
_mapStatsAllTime = new Array();
_mapStatsDaily = new Array();
super();
_shopName = _arg1;
_mapInventoryAmounts = new Array();
_mapInventoryAmounts["Cups"] = 0;
_mapInventoryAmounts["Coffee"] = 0;
_mapInventoryAmounts["Milk"] = 0;
_mapInventoryAmounts["Sugar"] = 0;
_mapRecipeAmounts = new Array();
_mapRecipeAmounts["Coffee"] = 2;
_mapRecipeAmounts["Milk"] = 0.25;
_mapRecipeAmounts["Sugar"] = 2;
CCoffeeShopGame._instance._hud.OnReputationChanged(0, _myReputation);
RecordInitialStats();
}
public function Pay(_arg1:int):void{
_amountCash = Math.max(0, (_amountCash - _arg1));
CCoffeeSound._instance.PlaySound("audio_pay");
}
public function GetStats(_arg1:Boolean, _arg2:String):Array{
if (_arg1){
return (GetStatsAllTime(_arg2));
};
return (GetStatsDaily(_arg2));
}
public function GetDailyCupsSold():int{
return ((_numCupsSold - _cupsSoldAtStartOfDay));
}
public function GetLastStatAllTime(_arg1:String):Number{
var _local2:Array;
_local2 = GetStatsAllTime(_arg1);
return (_local2[(_local2.length - 1)]);
}
public function GetStatsDaily(_arg1:String):Array{
return (_mapStatsDaily[_arg1]);
}
public function get _cash():int{
return (_amountCash);
}
public function AddInventoryAmount(_arg1:String, _arg2:Number):void{
_mapInventoryAmounts[_arg1] = Math.max(0, (_mapInventoryAmounts[_arg1] + _arg2));
}
public function GetNumStats(_arg1:Boolean):uint{
if (_arg1){
return (GetNumStatsAllTime());
};
return (GetNumStatsDaily());
}
public function get _reputation():Number{
return (_myReputation);
}
public function get _pricePerServing():int{
return (_price);
}
public function Gain(_arg1:int):void{
_amountCash = Math.max(0, (_amountCash + _arg1));
}
public function GetLastStatDaily(_arg1:String):Number{
var _local2:Array;
_local2 = GetStatsDaily(_arg1);
return (_local2[(_local2.length - 1)]);
}
public function GetNumServingsAvailable():int{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local1 = GetInventoryAmount("Cups");
_local2 = (GetInventoryAmount("Coffee") / GetRecipeAmount("Coffee"));
_local3 = (GetInventoryAmount("Milk") / GetRecipeAmount("Milk"));
_local4 = (GetInventoryAmount("Sugar") / GetRecipeAmount("Sugar"));
if (isNaN(_local2)){
_local2 = Number.POSITIVE_INFINITY;
};
if (isNaN(_local3)){
_local3 = Number.POSITIVE_INFINITY;
};
if (isNaN(_local4)){
_local4 = Number.POSITIVE_INFINITY;
};
return (Math.round(Math.min(_local1, Math.min(_local2, Math.min(_local3, Math.min(_local4))))));
}
public function DoNightlySpoilage():String{
var _local1:String;
var _local2:Number;
var _local3:int;
_local1 = "";
_mapInventoryAmounts["Milk"] = 0;
_local1 = "All your milk has spoiled.\r";
if (CCoffeeShopGame._instance._dayNumber == 0){
return (_local1);
};
_local2 = 0;
_local3 = 0;
if (CRandom._instance.GetRandom() < (1 / 4)){
_local2 = CRandom._instance.GetRandom();
_local2 = (Math.round((_local2 * 10)) / 10);
_mapInventoryAmounts["Coffee"] = (_mapInventoryAmounts["Coffee"] * _local2);
_local3 = int(((1 - _local2) * 100));
_local1 = (_local1 + (String(_local3) + "% of your coffee has gone stale.\r"));
};
if (CRandom._instance.GetRandom() < (1 / 6)){
_local2 = CRandom._instance.GetRandom();
_local2 = (Math.round((_local2 * 10)) / 10);
_mapInventoryAmounts["Sugar"] = (_mapInventoryAmounts["Sugar"] * _local2);
_local3 = int(((1 - _local2) * 100));
_local1 = (_local1 + (("Ants have invaded your sugar! You lost " + String(_local3)) + "% of your sugar.\r"));
};
return (_local1);
}
public function PurchaseServing(_arg1:int=-1, _arg2:int=1):Boolean{
if (_arg1 < 0){
_arg1 = _price;
};
if (GetNumServingsAvailable() >= _arg2){
Gain((_arg2 * _arg1));
AddInventoryAmount("Cups", (_arg2 * -1));
AddInventoryAmount("Coffee", (_arg2 * -(GetRecipeAmount("Coffee"))));
AddInventoryAmount("Milk", (_arg2 * -(GetRecipeAmount("Milk"))));
AddInventoryAmount("Sugar", (_arg2 * -(GetRecipeAmount("Sugar"))));
_numCupsSold = (_numCupsSold + _arg2);
CCoffeeSound._instance.PlaySound("purchase");
return (true);
};
return (false);
}
public function GetDailyReputationChange():Number{
return ((_myReputation - _myReputationAtStartOfDay));
}
public function GetNumServingsLimiter():String{
var _local1:Array;
var _local2:String;
var _local3:uint;
var _local4:String;
_local1 = new Array();
_local1["Cups"] = GetInventoryAmount("Cups");
_local1["Coffee"] = (GetInventoryAmount("Coffee") / GetRecipeAmount("Coffee"));
_local1["Milk"] = (GetInventoryAmount("Milk") / GetRecipeAmount("Milk"));
_local1["Sugar"] = (GetInventoryAmount("Sugar") / GetRecipeAmount("Sugar"));
_local2 = null;
_local3 = int.MAX_VALUE;
for (_local4 in _local1) {
if (((!(isNaN(_local1[_local4]))) && ((((_local2 == null)) || ((_local1[_local4] < _local3)))))){
_local2 = _local4;
_local3 = _local1[_local4];
};
};
return (_local2);
}
public function set _pricePerServing(_arg1:int):void{
var _local2:int;
_local2 = (_arg1 % 5);
if (_local2 >= 3){
_local2 = 5;
} else {
_local2 = 0;
};
_price = MathUtil.Clamp((_arg1 + _local2), 5, 1000);
}
public function AddStatDaily(_arg1:String, _arg2:Number):void{
if (_mapStatsDaily[_arg1] == undefined){
_mapStatsDaily[_arg1] = new Array();
};
_mapStatsDaily[_arg1].push(_arg2);
}
public function GetInventoryAmount(_arg1:String):Number{
return (_mapInventoryAmounts[_arg1]);
}
public function GetBuyTiers():Array{
var _local1:Array;
_local1 = new Array();
_local1[0] = new Array();
_local1[0][0] = {_amount:10, _cost:200};
_local1[0][1] = {_amount:25, _cost:400};
_local1[0][2] = {_amount:50, _cost:600};
_local1[1] = new Array();
_local1[1][0] = {_amount:20, _cost:1000};
_local1[1][1] = {_amount:40, _cost:1400};
_local1[1][2] = {_amount:60, _cost:1800};
_local1[2] = new Array();
_local1[2][0] = {_amount:10, _cost:100};
_local1[2][1] = {_amount:20, _cost:180};
_local1[2][2] = {_amount:40, _cost:200};
_local1[3] = new Array();
_local1[3][0] = {_amount:10, _cost:300};
_local1[3][1] = {_amount:20, _cost:500};
_local1[3][2] = {_amount:50, _cost:800};
return (_local1);
}
public function GetStatsAllTime(_arg1:String):Array{
return (_mapStatsAllTime[_arg1]);
}
public function ClearStatsDaily():void{
_mapStatsDaily = new Array();
}
public function OnEndOfDay():void{
AddStatAllTime("Cash", _amountCash);
AddStatAllTime("Reputation", _myReputation);
AddStatAllTime("Revenues", (_amountCash - _amountCashAtStartOfDay));
AddStatAllTime("Profits/Losses", (GetLastStatAllTime("Revenues") - GetLastStatAllTime("Expenditures")));
AddStatAllTime("Weather", CCoffeeShopGame._instance._temperatureFarenheit);
AddStatAllTime("Cups Sold", (_numCupsSold - _cupsSoldAtStartOfDay));
AddStatAllTime("Price", _pricePerServing);
AddStatAllTime("Recipe - Coffee", GetRecipeAmount("Coffee"));
AddStatAllTime("Recipe - Milk", GetRecipeAmount("Milk"));
AddStatAllTime("Recipe - Sugar", GetRecipeAmount("Sugar"));
AddStatAllTime("Inventory - Cups", GetInventoryAmount("Cups"));
AddStatAllTime("Inventory - Coffee", GetInventoryAmount("Coffee"));
AddStatAllTime("Inventory - Milk", GetInventoryAmount("Milk"));
AddStatAllTime("Inventory - Sugar", GetInventoryAmount("Sugar"));
}
public function GetNumStatsDaily():uint{
if (_mapStatsDaily){
return (_mapStatsDaily["Cash"].length);
};
return (0);
}
public function RecordInitialStats():void{
AddStatAllTime("Cash", _amountCash);
AddStatAllTime("Expenditures", 0);
AddStatAllTime("Reputation", _myReputation);
AddStatAllTime("Revenues", 0);
AddStatAllTime("Profits/Losses", 0);
AddStatAllTime("Weather", CCoffeeShopGame._instance._temperatureFarenheit);
AddStatAllTime("Cups Sold", 0);
AddStatAllTime("Price", _pricePerServing);
AddStatAllTime("Recipe - Coffee", GetRecipeAmount("Coffee"));
AddStatAllTime("Recipe - Milk", GetRecipeAmount("Milk"));
AddStatAllTime("Recipe - Sugar", GetRecipeAmount("Sugar"));
AddStatAllTime("Inventory - Cups", GetInventoryAmount("Cups"));
AddStatAllTime("Inventory - Coffee", GetInventoryAmount("Coffee"));
AddStatAllTime("Inventory - Milk", GetInventoryAmount("Milk"));
AddStatAllTime("Inventory - Sugar", GetInventoryAmount("Sugar"));
}
public function AddStatAllTime(_arg1:String, _arg2:Number):void{
if (_mapStatsAllTime[_arg1] == undefined){
_mapStatsAllTime[_arg1] = new Array();
};
_mapStatsAllTime[_arg1].push(_arg2);
}
public function AddReputation(_arg1:Number):void{
var _local2:Number;
_local2 = (_maxCustommerAffectOnReputationPerPurchase * _arg1);
_myReputation = MathUtil.Clamp((_myReputation + _local2), -1, 1);
CCoffeeShopGame._instance._hud.OnReputationChanged(_local2, _myReputation);
}
public function GetRecipeAmount(_arg1:String):Number{
return (_mapRecipeAmounts[_arg1]);
}
public function GetDailyProfitsLosses():Number{
return (GetLastStatAllTime("Profits/Losses"));
}
public function GetLastStat(_arg1:Boolean, _arg2:String):Number{
if (_arg1){
return (GetLastStatAllTime(_arg2));
};
return (GetLastStatDaily(_arg2));
}
public function GetName():String{
return (_shopName);
}
public function GetMinRecipeAmount(_arg1:String):Number{
if (_arg1 == "Coffee"){
return (1);
};
if (_arg1 == "Milk"){
return (0);
};
if (_arg1 == "Sugar"){
return (0);
};
return (NaN);
}
public function GetRecipe():Array{
return (_mapRecipeAmounts);
}
public function SetRecipeAmount(_arg1:String, _arg2:Number):void{
_mapRecipeAmounts[_arg1] = _arg2;
}
public function OnStartOfDay():void{
var _local1:Number;
_local1 = GetLastStatAllTime("Cash");
AddStatAllTime("Expenditures", (_local1 - _amountCash));
_amountCashAtStartOfDay = _amountCash;
_cupsSoldAtStartOfDay = _numCupsSold;
_myReputation = (_myReputation * 0.9);
_myReputationAtStartOfDay = _myReputation;
ClearStatsDaily();
AddStatDaily("Cash", _amountCash);
AddStatDaily("Reputation", _myReputation);
AddStatDaily("Cups Sold", 0);
AddStatDaily("Price", _pricePerServing);
}
public function GetMaxRecipeAmount(_arg1:String):Number{
if (_arg1 == "Coffee"){
return (4);
};
if (_arg1 == "Milk"){
return (2);
};
if (_arg1 == "Sugar"){
return (4);
};
return (NaN);
}
public function AddStat(_arg1:Boolean, _arg2:String, _arg3:Number):void{
if (_arg1){
AddStatAllTime(_arg2, _arg3);
} else {
AddStatDaily(_arg2, _arg3);
};
}
public function GetMinimalRecipe():Array{
var _local1:Array;
_local1 = new Array();
_local1["Coffee"] = GetMinRecipeAmount("Coffee");
_local1["Milk"] = GetMinRecipeAmount("Milk");
_local1["Sugar"] = GetMinRecipeAmount("Sugar");
return (_local1);
}
public function RecordHourlyStats():void{
AddStatDaily("Cash", _amountCash);
AddStatDaily("Reputation", _myReputation);
AddStatDaily("Cups Sold", (_numCupsSold - _cupsSoldAtStartOfDay));
AddStatDaily("Price", _pricePerServing);
}
public function GetNumStatsAllTime():uint{
if (_mapStatsAllTime){
return (_mapStatsAllTime["Cash"].length);
};
return (0);
}
}
}//package
Section 124
//CSlider (CSlider)
package {
import flash.display.*;
import flash.text.*;
public class CSlider extends MovieClip {
public var _textMaxima:TextField;
public var _textMaximaDescrip:TextField;
public var _textMinima:TextField;
public var _handle:CSliderHandle;
public var _textMinimaDescrip:TextField;
public function set _value(_arg1:Number):void{
_handle._value = _arg1;
}
public function SetNotifyChangeWhenMoved(_arg1:Function):void{
_handle.SetNotifyChangeWhenMoved(_arg1);
}
public function get _value():Number{
return (_handle._value);
}
public function Initialize(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:String, _arg5:String, _arg6:Function, _arg7:String, _arg8:String):void{
_textMinima.text = CCoffeeShopApp.ConvertUnitToString(_arg7, _arg1);
_textMaxima.text = CCoffeeShopApp.ConvertUnitToString(_arg7, _arg2);
_textMinimaDescrip.text = _arg4;
_textMaximaDescrip.text = _arg5;
_handle.InitializeHandle(_arg1, _arg2, _arg3, 25.6, 237.6, _arg6, _arg7, _arg8);
}
public function GetValueString():String{
return (_handle.GetValueString());
}
}
}//package
Section 125
//CSliderHandle (CSliderHandle)
package {
import flash.events.*;
public class CSliderHandle extends CButton {
private var _isDragging:Boolean;// = false
private var _unitType:String;
private var _initialY:Number;
protected var _minX:Number;
protected var _maxX:Number;
protected var _minValue:Number;
private var _fnCallbackWhenChanged:Function;
private var _dragPointX:Number;
protected var _maxValue:Number;
public function CSliderHandle(){
_initialY = y;
_isDragging = false;
super();
SetTextColors(0xCCCCCC, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF);
}
public function set _value(_arg1:Number):void{
x = ((((_arg1 - _minValue) / (_maxValue - _minValue)) * (_maxX - _minX)) + _minX);
_myText.text = GetValueString();
}
public function SetNotifyChangeWhenMoved(_arg1:Function):void{
_fnCallbackWhenChanged = _arg1;
}
override public function onMouseUp(_arg1:Event):void{
if (_isDragging){
y = _initialY;
x = MathUtil.Clamp(x, _minX, _maxX);
_isDragging = false;
if ((parent.parent.parent is CHUDPreparingAdjustments)){
CHUDPreparingAdjustments(parent.parent.parent).SetDividerTargetLocked(false);
};
super.onMouseUp(_arg1);
};
}
override public function onMouseOut(_arg1:Event):void{
if (!_isDragging){
super.onMouseOut(_arg1);
};
}
public function get _value():Number{
return (((((x - _minX) / (_maxX - _minX)) * (_maxValue - _minValue)) + _minValue));
}
public function onEnterFrame(_arg1:Event):void{
var _local2:Number;
var _local3:Number;
if (_isDragging){
_local2 = x;
_local3 = (parent.mouseX - _dragPointX);
x = MathUtil.Clamp(_local3, _minX, _maxX);
if (((!((_fnCallbackWhenChanged == null))) && (!((x == _local2))))){
_fnCallbackWhenChanged();
};
_myText.text = GetValueString();
};
}
public function onStageMouseUp(_arg1:MouseEvent):void{
onMouseUp(_arg1);
stage.removeEventListener(MouseEvent.MOUSE_UP, onStageMouseUp);
}
public function GetValueString():String{
return (CCoffeeShopApp.ConvertUnitToString(_unitType, _value));
}
override public function onMouseDown(_arg1:Event):void{
if (IsEnabled()){
_isDragging = true;
_dragPointX = mouseX;
if ((parent.parent.parent is CHUDPreparingAdjustments)){
CHUDPreparingAdjustments(parent.parent.parent).SetDividerTargetLocked(true);
};
};
stage.addEventListener(MouseEvent.MOUSE_UP, onStageMouseUp);
super.onMouseDown(_arg1);
}
public function InitializeHandle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Function, _arg7:String, _arg8:String){
_minValue = _arg1;
_maxValue = _arg2;
_minX = _arg4;
_maxX = _arg5;
_unitType = _arg7;
_value = _arg3;
super.Initialize(GetValueString(), _arg6, _arg8);
SetNotifyChangeWhenMoved(_arg6);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
}
}//package
Section 126
//CSliderHandlePrice (CSliderHandlePrice)
package {
public class CSliderHandlePrice extends CSliderHandle {
override public function get _value():Number{
var _local1:Number;
_local1 = ((((x - _minX) / (_maxX - _minX)) * (_maxValue - _minValue)) + _minValue);
_local1 = MathUtil.Clamp((Math.round((_local1 * (1 / 5))) / (1 / 5)), _minValue, _maxValue);
return (_local1);
}
override public function GetValueString():String{
return (CCoffeeShopApp.ConvertUnitToString("Cash", _value));
}
}
}//package
Section 127
//CSliderPrice (CSliderPrice)
package {
public class CSliderPrice extends CSlider {
}
}//package
Section 128
//CThoughtBubble (CThoughtBubble)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
public class CThoughtBubble extends MovieClip {
private var _timeSpawned:Number;
private var _spawner:MovieClip;// = null
private var _isMouseOver:Boolean;// = false
public var _border:MovieClip;
protected var _toolTip:CTooltip;
protected var _lifeSpan:Number;// = 4
public var _back:MovieClip;
public function CThoughtBubble(_arg1:MovieClip, _arg2:String, _arg3:Boolean){
_lifeSpan = 4;
_spawner = null;
_timeSpawned = (getTimer() / 1000);
_isMouseOver = false;
super();
_spawner = _arg1;
addEventListener(Event.ENTER_FRAME, onEnterFrame);
addEventListener(MouseEvent.MOUSE_OUT, OnMouseOut);
addEventListener(MouseEvent.MOUSE_OVER, OnMouseOver);
CreateSymbols(_arg2, _arg3);
CreateToolTip(_arg2, _arg3);
}
protected function CreateToolTip(_arg1:String, _arg2:Boolean):void{
var _local3:String;
_local3 = "";
if (_arg1 == "Coffee"){
if (_arg2){
_local3 = "Yum! Nice and strong";
} else {
_local3 = "Needs more coffee!";
};
} else {
if (_arg1 == "Milk"){
if (_arg2){
_local3 = "Yum! Creamy!";
} else {
_local3 = "Needs more milk!";
};
} else {
if (_arg1 == "Sugar"){
if (_arg2){
_local3 = "Sweet!";
} else {
_local3 = "Needs more sugar!";
};
} else {
if (_arg1 == "Price"){
if (_arg2){
_local3 = "Good quality for the price!";
} else {
_local3 = "Yuck! Not worth what I paid for it";
};
};
};
};
};
_local3 = (("\"" + _local3) + "\"");
_toolTip = new CTooltip(_local3);
addChild(_toolTip);
}
protected function CreateSymbols(_arg1:String, _arg2:Boolean):void{
var _local3:MovieClip;
var _local4:MovieClip;
var _local5:ColorTransform;
_local3 = null;
_local4 = null;
if (_arg1 == "Coffee"){
_local3 = new mcSymbolCoffee();
if (!_arg2){
_local4 = new mcSymbolIncrease();
};
} else {
if (_arg1 == "Milk"){
_local3 = new mcSymbolMilk();
if (!_arg2){
_local4 = new mcSymbolIncrease();
};
} else {
if (_arg1 == "Sugar"){
_local3 = new mcSymbolSugar();
if (!_arg2){
_local4 = new mcSymbolIncrease();
};
} else {
if (_arg1 == "Price"){
_local3 = new mcSymbolPrice();
if (!_arg2){
_local4 = new mcSymbolDecrease();
};
};
};
};
};
addChild(_local3);
if (_local4){
_local3.x = -5.2;
_local3.y = -54.1;
_local3.scaleX = (_local3.scaleY = 1.2);
_local4.x = 8.4;
_local4.y = -64.5;
addChild(_local4);
} else {
_local3.x = 0;
_local3.y = -56;
_local3.scaleX = (_local3.scaleY = 1.35);
};
_local5 = _border.transform.colorTransform;
if (_arg2){
_local5.greenOffset = 192;
} else {
_local5.redOffset = 192;
};
_border.transform.colorTransform = _local5;
}
private function OnMouseOut(_arg1:MouseEvent):void{
var _local2:Number;
_isMouseOver = false;
_toolTip.Hide();
_local2 = (getTimer() / 1000);
if ((((_lifeSpan >= 0)) && (((_timeSpawned + _lifeSpan) < _local2)))){
_lifeSpan = ((_local2 + 4) - _timeSpawned);
};
}
public function onEnterFrame(_arg1:Event):void{
var _local2:Number;
_local2 = (getTimer() / 1000);
if (((((!(_isMouseOver)) && ((_lifeSpan >= 0)))) && (((_timeSpawned + _lifeSpan) < _local2)))){
Destroy();
return;
};
if ((((((_spawner == null)) || ((_spawner.parent == null)))) || ((_spawner.parent.parent == null)))){
Destroy();
return;
};
x = ((_spawner.x * _spawner.parent.parent.scaleX) + (_spawner.parent.parent.x * _spawner.parent.parent.scaleX));
y = (((_spawner.y * _spawner.parent.parent.scaleY) + _spawner.parent.parent.y) - 50);
}
public function Destroy():void{
visible = false;
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
parent.removeChild(this);
}
private function OnMouseOver(_arg1:MouseEvent):void{
_isMouseOver = true;
_toolTip.Show();
}
}
}//package
Section 129
//CThoughtBubbleConsideration (CThoughtBubbleConsideration)
package {
import flash.display.*;
import flash.geom.*;
public class CThoughtBubbleConsideration extends CThoughtBubble {
public function CThoughtBubbleConsideration(_arg1:MovieClip, _arg2:String, _arg3:Boolean){
super(_arg1, _arg2, _arg3);
_lifeSpan = 2;
CCoffeeSound._instance.PlaySound(("consideration_" + (_arg3) ? "good" : "bad"), 0.3);
}
override protected function CreateSymbols(_arg1:String, _arg2:Boolean):void{
var _local3:MovieClip;
var _local4:MovieClip;
var _local5:ColorTransform;
_local3 = null;
_local4 = null;
if (_arg1 == "Weather"){
if (_arg2){
_local4 = new mcSymbolWeatherCold();
} else {
_local4 = new mcSymbolWeather();
};
} else {
if (_arg1 == "Price"){
_local4 = new mcSymbolPrice();
if (!_arg2){
_local3 = new mcSymbolDecrease();
};
} else {
if (_arg1 == "Reputation"){
_local4 = new mcSymbolReputation();
};
};
};
addChild(_local4);
if (_local3){
_local4.x = -5.2;
_local4.y = -54.1;
_local4.scaleX = (_local4.scaleY = 1.2);
_local3.x = 8.4;
_local3.y = -64.5;
addChild(_local3);
} else {
_local4.x = 0;
_local4.y = -56;
_local4.scaleX = (_local4.scaleY = 1.35);
};
_local5 = _border.transform.colorTransform;
if (_arg2){
_local5.greenOffset = 192;
} else {
_local5.redOffset = 192;
};
_border.transform.colorTransform = _local5;
}
override protected function CreateToolTip(_arg1:String, _arg2:Boolean):void{
var _local3:String;
_local3 = "";
if (_arg1 == "Weather"){
if (_arg2){
_local3 = "Brrrr! Need coffee to warm me up!";
} else {
_local3 = "I don't need coffee: I feel warm enough";
};
} else {
if (_arg1 == "Price"){
if (_arg2){
_local3 = "The price looks right";
} else {
_local3 = "I won't pay that much today";
};
} else {
if (_arg1 == "Reputation"){
if (_arg2){
_local3 = "I'll buy today because I hear this place is good";
} else {
_local3 = "I'm passing by because I hear this place rips you off";
};
};
};
};
_local3 = (("\"" + _local3) + "\"");
_toolTip = new CTooltip(_local3);
addChild(_toolTip);
}
}
}//package
Section 130
//CTooltip (CTooltip)
package {
import flash.display.*;
import flash.text.*;
import flash.utils.*;
public class CTooltip extends MovieClip {
private var m_lifespan:Number;// = -1
private var m_textFieldMsg:TextField;
private var m_message:String;
private var m_showDelay:Number;// = -1
private var m_showStarTime:Number;// = -1
public function CTooltip(_arg1:String, _arg2:Number=0, _arg3:Number=8){
var _local4:TextFormat;
m_textFieldMsg = new TextField();
m_showStarTime = -1;
m_showDelay = -1;
m_lifespan = -1;
super();
m_textFieldMsg = new TextField();
m_textFieldMsg.autoSize = TextFieldAutoSize.CENTER;
m_textFieldMsg.embedFonts = true;
m_textFieldMsg.selectable = false;
m_textFieldMsg.background = true;
m_textFieldMsg.backgroundColor = 16777164;
m_textFieldMsg.border = true;
m_textFieldMsg.borderColor = 0;
_local4 = new TextFormat();
_local4.font = "Calibri";
_local4.color = 0;
_local4.size = 15;
m_textFieldMsg.defaultTextFormat = _local4;
addChild(m_textFieldMsg);
SetMessage(_arg1);
visible = false;
m_showDelay = _arg2;
m_lifespan = _arg3;
}
public function Show():void{
if (m_showDelay > 0){
setInterval(ReallyShow, (m_showDelay * 1000));
} else {
ReallyShow();
};
}
public function Hide():void{
visible = false;
}
private function ReallyShow():void{
visible = true;
if (m_lifespan >= 0){
setInterval(Hide, (m_lifespan * 1000));
};
}
public function SetMessage(_arg1:String):void{
m_message = _arg1;
m_textFieldMsg.text = m_message;
m_textFieldMsg.x = (-(m_textFieldMsg.width) * 0.5);
m_textFieldMsg.y = -120;
}
}
}//package
Section 131
//CTutorial (CTutorial)
package {
import flash.events.*;
public class CTutorial extends CMovieClipFresh {
private var _fnWhenSituationTrue:Function;
private var _fnEvaluateSituation:Function;
public function CTutorial(){
if (!CCoffeeShopApp._instance._showTutorial){
visible = false;
return;
};
}
public function IsInventoryExpanded():Boolean{
return (CCoffeeShopGame._instance._hud._modePreparing._page._adjustments._isInventoryHighlighted);
}
override public function FirstFrameInitialize(_arg1:Event):void{
super.FirstFrameInitialize(_arg1);
if (!CCoffeeShopApp._instance._showTutorial){
visible = false;
return;
};
CreateInitialBook();
}
public function OnServingAvailable():void{
var _local1:CTutorialBook;
CCoffeeShopGame._instance._hud._modePreparing._buttonStartTheDay.SetEnabled(false);
_local1 = new CTutorialBook(this);
_local1.AddPage(new CTutorialPage("Stocked Up", "<p>Excellent! You bought enough inventory so that you can serve some coffee when customers start arriving.</p>"));
_local1.AddPage(new CTutorialPage("Recipe and Price", "<p>Before leaving Prep Mode you'll want to adjust the <b>recipe</b> used to make your coffee, as well as the <b>price</b> you charge customers for each serving.</p>"));
_local1.AddPage(new CTutorialPage("Recipe", (("<p>Your <b>recipe</b> determines how expensive your coffee is to make. Your recipe also determines how well your customers like your coffee.</p><br/>" + "<p>You can adjust how much <b>coffee</b>, <b>milk</b>, and <b>sugar</b> you put into each <b>cup</b> of coffee.</p><br/>") + "<p>Generally speaking, customers like more of everything and are willing to pay a higher price for it!</p>")));
_local1.AddPage(new CTutorialPage("Price", ((("<p>Pay close attention to your <b>price.</b> This is the amount you charge for each cup of coffee.</p><br/>" + "<p>High-priced coffee earns you more money, but customers won't buy your coffee if they think it's too expensive.</p><br/>") + "<p>They'll pay more on cold days and less on warm ones.</p><br/>") + "<p>Adjusting your price each day is a crucial skill in running a successful business!</p>")));
_local1.AddPage(new CTutorialPage("Starting the Day", "<p>Try adjusting your recipe and price now. Then, when you're ready, just click <b>Start the Day</b> to open your shop and start selling coffee!</p>"));
_local1.AddCloseAction(OnRecipePriceClose);
addChild(_local1);
}
public function OnBookClose(_arg1:CTutorialBook, _arg2:Boolean=false):void{
removeChild(_arg1);
if (_arg2){
DisableTutorials();
};
}
public function OnCalloutClose(_arg1:CTutorialCallout):void{
removeChild(_arg1);
}
public function OnIntroClose():void{
var _local1:CTutorialCallout;
_local1 = new CTutorialCallout(this, "Move your mouse over the <b>Inventory</b> area to buy ingredients for the day.", IsInventoryExpanded);
_local1.AddCloseAction(OnInventoryCalloutClosed);
_local1.x = ((415.1 - x) - 319.9);
_local1.y = ((233.1 - y) - 206.4);
addChild(_local1);
}
protected function WaitForSituation(_arg1:Function, _arg2:Function):void{
StopWaitingForSituation();
_fnEvaluateSituation = _arg1;
_fnWhenSituationTrue = _arg2;
addEventListener(Event.ENTER_FRAME, OnEnterFrame);
}
public function DoesShopHaveServingAvailable():Boolean{
return ((CCoffeeShopGame._instance._shop.GetNumServingsAvailable() > 0));
}
public function OnRecipePriceClose():void{
CCoffeeShopGame._instance._hud._modePreparing._buttonStartTheDay.SetEnabled(DoesShopHaveServingAvailable());
}
protected function CreateInitialBook():void{
var _local1:CTutorialBook;
_local1 = new CTutorialBook(this);
_local1.AddPage(new CTutorialPage("Getting Started", ((((("<p>Congratulations! You've opened your own coffee stand, <b>" + CCoffeeShopApp._instance._shopName) + ".</b></p><br/>") + "<p>Your goal is to make as much money as you can in ") + CCoffeeShopGame._instance._numDaysPerGame) + " days.</p>")));
_local1.AddPage(new CTutorialPage("Starting the Day", "<p>Each day begins in <b>Prep Mode.</b> In Prep Mode you buy <b>ingredients</b>, adjust your <b>recipe</b>, and set your <b>price.</b></p>"));
_local1.AddPage(new CTutorialPage("Ingredients", ((((("<p>Before you can make coffee you have to buy the ingredients that go into it. Coffee has just four ingredients:</p><br/>" + "<ul><li><b>Cups</b> - You can't sell coffee without a cup to serve it in!</li>") + "<li><b>Coffee</b> - Dark-roasted ground coffee beans keep customers coming.</li>") + "<li><b>Milk</b> - Customers like their coffee creamy.</li>") + "<li><b>Sugar</b> - What's a cup of coffee without a little sweetener?</li><ul><br/>") + "<p>Click <b>Next</b> to look at your inventory of ingredients and buy more.</p>")));
_local1.AddCloseAction(OnIntroClose);
addChild(_local1);
}
public function OnInventoryCalloutClosed():void{
WaitForSituation(DoesShopHaveServingAvailable, OnServingAvailable);
}
protected function StopWaitingForSituation():void{
_fnEvaluateSituation = null;
_fnWhenSituationTrue = null;
removeEventListener(Event.ENTER_FRAME, OnEnterFrame);
}
public function OnEnterFrame(_arg1:Event):void{
if (_fnEvaluateSituation != null){
if (_fnEvaluateSituation()){
_fnWhenSituationTrue();
StopWaitingForSituation();
};
};
}
public function DisableTutorials():void{
visible = false;
}
}
}//package
Section 132
//CTutorialBook (CTutorialBook)
package {
import flash.text.*;
public class CTutorialBook extends CTutorialChild {
public var _buttonBack:CButtonTutorialBack;
public var _buttonNext:CButtonTutorialNext;
public var _textPageNumber:TextField;
private var _arrPages:Array;
public var _checkboxShowTutorial:CCheckbox;
private var _curPage:uint;// = 0
public function CTutorialBook(_arg1:CTutorial){
_curPage = 0;
_arrPages = new Array();
super(_arg1);
_checkboxShowTutorial.Initialize("Show tutorial", true);
_buttonBack.Initialize("Back", OnBack, "tutBack");
_buttonBack.visible = false;
_buttonNext.Initialize("Next", OnNext, "tutNext");
_textPageNumber.text = "";
}
public function OnNext():void{
if ((((_curPage >= (_arrPages.length - 1))) || (!(_checkboxShowTutorial._isChecked)))){
CCoffeeShopApp._cookie.wantsTutorials = _checkboxShowTutorial._isChecked;
Close();
} else {
_arrPages[_curPage].visible = false;
_curPage++;
_arrPages[_curPage].visible = true;
UpdateNextBackButtons();
};
}
public function OnBack():void{
if (!_checkboxShowTutorial._isChecked){
CCoffeeShopApp._cookie.wantsTutorials = false;
Close();
} else {
if (_curPage > 0){
_arrPages[_curPage].visible = false;
_curPage--;
_arrPages[_curPage].visible = true;
UpdateNextBackButtons();
};
};
}
public function AddPage(_arg1:CTutorialPage):void{
addChild(_arg1);
_arrPages.push(_arg1);
_arg1.visible = (_arrPages.length == 1);
UpdateNextBackButtons();
}
protected function UpdateNextBackButtons():void{
_buttonBack.visible = (_curPage > 0);
_textPageNumber.text = ((String((_curPage + 1)) + "/") + String(_arrPages.length));
}
override public function Close():void{
super.Close();
_tutorial.OnBookClose(this, !(_checkboxShowTutorial._isChecked));
}
}
}//package
Section 133
//CTutorialCallout (CTutorialCallout)
package {
import flash.events.*;
import flash.text.*;
public class CTutorialCallout extends CTutorialChild {
public var _buttonNext:CButtonTutorialNext;
public var _textMessage:TextField;
private var _fnCloseWhenTrue:Function;
public function CTutorialCallout(_arg1:CTutorial, _arg2:String, _arg3:Function){
super(_arg1);
_buttonNext.Initialize("Close", Close, "tutClose");
_fnCloseWhenTrue = _arg3;
_buttonNext.visible = (_fnCloseWhenTrue == null);
_textMessage.htmlText = _arg2;
if (_fnCloseWhenTrue != null){
addEventListener(Event.ENTER_FRAME, OnEnterFrame);
};
}
override public function Close():void{
super.Close();
_fnCloseWhenTrue = null;
removeEventListener(Event.ENTER_FRAME, OnEnterFrame);
_tutorial.OnCalloutClose(this);
}
public function OnEnterFrame(_arg1:Event):void{
if (_fnCloseWhenTrue != null){
if (_fnCloseWhenTrue()){
Close();
};
};
}
}
}//package
Section 134
//CTutorialChild (CTutorialChild)
package {
import flash.display.*;
public class CTutorialChild extends MovieClip {
protected var _tutorial:CTutorial;
private var _arrCloseActions:Array;
public function CTutorialChild(_arg1:CTutorial){
_arrCloseActions = new Array();
super();
_tutorial = _arg1;
}
public function Close():void{
ProcessCloseActions();
visible = false;
}
public function AddCloseAction(_arg1:Function):void{
_arrCloseActions.push(_arg1);
}
protected function ProcessCloseActions():void{
var _local1:uint;
if (((_tutorial) && (_tutorial.visible))){
_local1 = 0;
while (_local1 < _arrCloseActions.length) {
var _local2 = _arrCloseActions;
_local2[_local1]();
_local1++;
};
};
}
}
}//package
Section 135
//CTutorialPage (CTutorialPage)
package {
import flash.display.*;
import flash.text.*;
public class CTutorialPage extends MovieClip {
public var _textMessage:TextField;
public var _textTitle:TextField;
public function CTutorialPage(_arg1:String, _arg2:String){
var _local3:StyleSheet;
super();
_local3 = new StyleSheet();
_textMessage.styleSheet = _local3;
_textTitle.text = _arg1;
_textMessage.htmlText = _arg2;
}
}
}//package
Section 136
//IMovieClipFreshHost (IMovieClipFreshHost)
package {
interface IMovieClipFreshHost {
function OnChildConstructed(_arg1:CMovieClipFresh):void;
}
}//package
Section 137
//MathUtil (MathUtil)
package {
public class MathUtil {
static function MinAbs(_arg1:Number, _arg2:Number):Number{
if (Math.abs(_arg1) < Math.abs(_arg2)){
return (_arg1);
};
return (_arg2);
}
static function VectorLerp(_arg1:Vector2D, _arg2:Vector2D, _arg3:Number):Vector2D{
return (_arg1.GetAdd(_arg2.GetSubtract(_arg1).GetMultiplyScalar(_arg3)));
}
static function RGBtoHSV(_arg1:Number, _arg2:Number, _arg3:Number):Object{
var _local4:Object;
var _local5:*;
var _local6:*;
var _local7:*;
_arg1 = (_arg1 / 0xFF);
_arg2 = (_arg2 / 0xFF);
_arg3 = (_arg3 / 0xFF);
_local4 = new Object();
_local5 = Math.min(_arg1, Math.min(_arg2, _arg3));
_local6 = Math.max(_arg1, Math.max(_arg2, _arg3));
_local4.v = _local6;
_local7 = (_local6 - _local5);
if (_local6 != 0){
_local4.s = (_local7 / _local6);
} else {
_local4.s = 0;
_local4.h = undefined;
return (_local4);
};
if (_arg1 == _local6){
_local4.h = ((_arg2 - _arg3) / _local7);
} else {
if (_arg2 == _local6){
_local4.h = (2 + ((_arg3 - _arg1) / _local7));
} else {
_local4.h = (4 + ((_arg1 - _arg2) / _local7));
};
};
_local4.h = (_local4.h * 60);
if (_local4.h < 0){
_local4.h = (_local4.h + 360);
};
return (_local4);
}
static function AngleDelta(_arg1:Number, _arg2:Number):Number{
return (GetNormalizedAngle((_arg1 - _arg2)));
}
static function SignNoZero(_arg1:Number):Number{
return (((_arg1)>=0) ? 1 : -1);
}
static function HSVtoRGB(_arg1:Number, _arg2:Number, _arg3:Number):Object{
var _local4:Object;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
_arg1 = MathUtil.Wrap(_arg1, 0, 360);
_local4 = new Object();
if (_arg2 == 0){
_local4.r = (_local4.g = (_local4.b = (_arg3 * 0xFF)));
return (_local4);
};
_arg1 = (_arg1 / 60);
_local5 = Math.floor(_arg1);
_local6 = (_arg1 - _local5);
_local7 = (_arg3 * (1 - _arg2));
_local8 = (_arg3 * (1 - (_arg2 * _local6)));
_local9 = (_arg3 * (1 - (_arg2 * (1 - _local6))));
switch (_local5){
case 0:
_local4.r = _arg3;
_local4.g = _local9;
_local4.b = _local7;
break;
case 1:
_local4.r = _local8;
_local4.g = _arg3;
_local4.b = _local7;
break;
case 2:
_local4.r = _local7;
_local4.g = _arg3;
_local4.b = _local9;
break;
case 3:
_local4.r = _local7;
_local4.g = _local8;
_local4.b = _arg3;
break;
case 4:
_local4.r = _local9;
_local4.g = _local7;
_local4.b = _arg3;
break;
default:
_local4.r = _arg3;
_local4.g = _local7;
_local4.b = _local8;
break;
};
_local4.r = (_local4.r * 0xFF);
_local4.g = (_local4.g * 0xFF);
_local4.b = (_local4.b * 0xFF);
return (_local4);
}
static function Bounce(_arg1:Number, _arg2:Number, _arg3:Number):Number{
if (_arg2 == _arg3){
return (_arg2);
};
while ((((_arg1 > _arg3)) || ((_arg1 < _arg2)))) {
if (_arg1 > _arg3){
_arg1 = (_arg3 - (_arg1 - _arg3));
} else {
_arg1 = (_arg2 + (_arg2 - _arg1));
};
};
return (_arg1);
}
static function Wrap(_arg1:Number, _arg2:Number, _arg3:Number):Number{
var _local4:Number;
_local4 = ((_arg1 - _arg2) % (_arg3 - _arg2));
return (((_local4 < 0)) ? (_arg3 + _local4) : (_arg2 + _local4));
}
static function GetNormalizedAngle(_arg1:Number):Number{
return (Wrap(_arg1, -180, 180));
}
static function MaxAbs(_arg1:Number, _arg2:Number):Number{
if (Math.abs(_arg1) > Math.abs(_arg2)){
return (_arg1);
};
return (_arg2);
}
static function DegreesToRadians(_arg1:Number):Number{
return (((_arg1 / 180) * Math.PI));
}
static function Equivalent(_arg1:Number, _arg2:Number, _arg3=1E-5):Boolean{
return ((Math.abs((_arg1 - _arg2)) < _arg3));
}
static function Lerp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return ((_arg1 + ((_arg2 - _arg1) * _arg3)));
}
static function RandRange(_arg1:Number, _arg2:Number):Number{
return ((_arg1 + (Math.random() * (_arg2 - _arg1))));
}
static function AngleLerp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return (GetNormalizedAngle((_arg1 + (AngleDelta(_arg2, _arg1) * _arg3))));
}
static function RadiansToDegrees(_arg1:Number):Number{
return (((_arg1 / Math.PI) * 180));
}
static function Clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return (Math.max(Math.min(_arg1, _arg3), _arg2));
}
static function Sign(_arg1:Number):Number{
return (((_arg1)>0) ? 1 : ((_arg1)<0) ? -1 : 0);
}
}
}//package
Section 138
//mcSymbolCoffee (mcSymbolCoffee)
package {
import flash.display.*;
public dynamic class mcSymbolCoffee extends MovieClip {
}
}//package
Section 139
//mcSymbolDecrease (mcSymbolDecrease)
package {
import flash.display.*;
public dynamic class mcSymbolDecrease extends MovieClip {
}
}//package
Section 140
//mcSymbolIncrease (mcSymbolIncrease)
package {
import flash.display.*;
public dynamic class mcSymbolIncrease extends MovieClip {
}
}//package
Section 141
//mcSymbolMilk (mcSymbolMilk)
package {
import flash.display.*;
public dynamic class mcSymbolMilk extends MovieClip {
}
}//package
Section 142
//mcSymbolPrice (mcSymbolPrice)
package {
import flash.display.*;
public dynamic class mcSymbolPrice extends MovieClip {
}
}//package
Section 143
//mcSymbolReputation (mcSymbolReputation)
package {
import flash.display.*;
public dynamic class mcSymbolReputation extends MovieClip {
}
}//package
Section 144
//mcSymbolSugar (mcSymbolSugar)
package {
import flash.display.*;
public dynamic class mcSymbolSugar extends MovieClip {
}
}//package
Section 145
//mcSymbolThumbsUp (mcSymbolThumbsUp)
package {
import flash.display.*;
public dynamic class mcSymbolThumbsUp extends MovieClip {
}
}//package
Section 146
//mcSymbolWeather (mcSymbolWeather)
package {
import flash.display.*;
public dynamic class mcSymbolWeather extends MovieClip {
}
}//package
Section 147
//mcSymbolWeatherCold (mcSymbolWeatherCold)
package {
import flash.display.*;
public dynamic class mcSymbolWeatherCold extends MovieClip {
}
}//package
Section 148
//mcSymbolYuck (mcSymbolYuck)
package {
import flash.display.*;
public dynamic class mcSymbolYuck extends MovieClip {
}
}//package
Section 149
//menu_button_beep1 (menu_button_beep1)
package {
import flash.media.*;
public dynamic class menu_button_beep1 extends Sound {
}
}//package
Section 150
//menu_button_beep2 (menu_button_beep2)
package {
import flash.media.*;
public dynamic class menu_button_beep2 extends Sound {
}
}//package
Section 151
//morning (morning)
package {
import flash.media.*;
public dynamic class morning extends Sound {
}
}//package
Section 152
//music_bold (music_bold)
package {
import flash.media.*;
public dynamic class music_bold extends Sound {
}
}//package
Section 153
//music_calm (music_calm)
package {
import flash.media.*;
public dynamic class music_calm extends Sound {
}
}//package
Section 154
//music_menu (music_menu)
package {
import flash.media.*;
public dynamic class music_menu extends Sound {
}
}//package
Section 155
//purchase (purchase)
package {
import flash.media.*;
public dynamic class purchase extends Sound {
}
}//package
Section 156
//reaction_displeased (reaction_displeased)
package {
import flash.media.*;
public dynamic class reaction_displeased extends Sound {
}
}//package
Section 157
//reaction_middling (reaction_middling)
package {
import flash.media.*;
public dynamic class reaction_middling extends Sound {
}
}//package
Section 158
//reaction_pleased (reaction_pleased)
package {
import flash.media.*;
public dynamic class reaction_pleased extends Sound {
}
}//package
Section 159
//reaction_vomit0 (reaction_vomit0)
package {
import flash.media.*;
public dynamic class reaction_vomit0 extends Sound {
}
}//package
Section 160
//reaction_vomit1 (reaction_vomit1)
package {
import flash.media.*;
public dynamic class reaction_vomit1 extends Sound {
}
}//package
Section 161
//reaction_vomit2 (reaction_vomit2)
package {
import flash.media.*;
public dynamic class reaction_vomit2 extends Sound {
}
}//package
Section 162
//reaction_vomit3 (reaction_vomit3)
package {
import flash.media.*;
public dynamic class reaction_vomit3 extends Sound {
}
}//package
Section 163
//reaction_vomit4 (reaction_vomit4)
package {
import flash.media.*;
public dynamic class reaction_vomit4 extends Sound {
}
}//package
Section 164
//Vector2D (Vector2D)
package {
class Vector2D {
var x:Number;// = 0
var y:Number;// = 0
function Vector2D(_arg1:Number, _arg2:Number){
x = 0;
y = 0;
super();
x = _arg1;
y = _arg2;
}
function SubtractScalar(_arg1:Number):void{
x = (x - _arg1);
y = (y - _arg1);
}
function Set(_arg1:Vector2D):void{
x = _arg1.x;
y = _arg1.y;
}
function GetNormal():Vector2D{
var _local1:Vector2D;
_local1 = new Vector2D(x, y);
_local1.Normalize();
return (_local1);
}
function GetSubtractScalar(_arg1:Number):Vector2D{
var _local2:Vector2D;
_local2 = new Vector2D(x, y);
_local2.SubtractScalar(_arg1);
return (_local2);
}
function DotProduct(_arg1:Vector2D):Number{
return (((x * _arg1.x) + (y * _arg1.y)));
}
function Add(_arg1:Vector2D):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
}
function GetMultiply(_arg1:Vector2D):Vector2D{
var _local2:Vector2D;
_local2 = new Vector2D((x * _arg1.x), (y * _arg1.y));
return (_local2);
}
function IsEqual(_arg1:Vector2D):Boolean{
return ((((_arg1.x == x)) && ((_arg1.y == y))));
}
function GetStringForm():String{
return ((((("( " + x) + ", ") + y) + " )"));
}
function GetAngle():Number{
return (Math.atan2(y, x));
}
function AddScalar(_arg1:Number):void{
x = (x + _arg1);
y = (y + _arg1);
}
function SetToRandomNormal():void{
SetToAngleNormal(((CRandom._instance.GetRandom() * Math.PI) * 2));
}
function MultiplyScalar(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
}
function GetCopy():Vector2D{
return (new Vector2D(x, y));
}
function Multiply(_arg1:Vector2D):void{
x = (x * _arg1.x);
y = (y * _arg1.y);
}
function SnapToMinorAxis():void{
if (Math.abs(x) < Math.abs(y)){
y = 0;
} else {
x = 0;
};
Normalize();
}
function GetMultiplyScalar(_arg1:Number):Vector2D{
var _local2:Vector2D;
_local2 = new Vector2D(x, y);
_local2.MultiplyScalar(_arg1);
return (_local2);
}
function MagnitudeSquared():Number{
return (((x * x) + (y * y)));
}
function IsZero(_arg1:Number):Boolean{
return ((((x <= _arg1)) && ((y <= _arg1))));
}
function GetDistance(_arg1:Vector2D):Number{
return (GetSubtract(_arg1).MagnitudeSafe());
}
function GetDivideScalar(_arg1:Number):Vector2D{
var _local2:Vector2D;
_local2 = new Vector2D(x, y);
_local2.DivideScalar(_arg1);
return (_local2);
}
function GetDistanceSquared(_arg1:Vector2D):Number{
return (GetSubtract(_arg1).MagnitudeSquared());
}
function MagnitudeSafe():Number{
var _local1:*;
_local1 = MagnitudeSquared();
if (_local1 > 0){
return (Math.sqrt(_local1));
};
return (0);
}
function GetAddScalar(_arg1:Number):Vector2D{
var _local2:Vector2D;
_local2 = new Vector2D(x, y);
_local2.AddScalar(_arg1);
return (_local2);
}
function Floor():void{
x = Math.floor(x);
y = Math.floor(y);
}
function Transpose():void{
var _local1:*;
_local1 = x;
x = y;
y = _local1;
}
function GetInverse():Vector2D{
return (new Vector2D(-(x), -(y)));
}
function GetAdd(_arg1:Vector2D):Vector2D{
var _local2:Vector2D;
_local2 = new Vector2D((x + _arg1.x), (y + _arg1.y));
return (_local2);
}
function SetToZero():void{
x = (y = 0);
}
function Divide(_arg1:Vector2D):void{
x = (x / _arg1.x);
y = (y / _arg1.y);
}
function GetAngleDegrees():Number{
return (((Math.atan2(y, x) / Math.PI) * 180));
}
function DivideScalar(_arg1:Number):void{
x = (x / _arg1);
y = (y / _arg1);
}
function Normalize():void{
var _local1:Number;
_local1 = Magnitude();
if (_local1 > 0){
x = (x / _local1);
y = (y / _local1);
};
}
function GetSubtract(_arg1:Vector2D):Vector2D{
var _local2:Vector2D;
_local2 = new Vector2D((x - _arg1.x), (y - _arg1.y));
return (_local2);
}
function Subtract(_arg1:Vector2D):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
}
function SnapToMajorAxis():void{
if (Math.abs(x) > Math.abs(y)){
y = 0;
} else {
x = 0;
};
Normalize();
}
function Invert():void{
x = -(x);
y = -(y);
}
function Magnitude():Number{
return (Math.sqrt(MagnitudeSquared()));
}
function Rotate(_arg1:Number):void{
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
_local2 = Math.cos(_arg1);
_local3 = Math.sin(_arg1);
_local4 = ((_local2 * x) - (_local3 * y));
_local5 = ((_local3 * x) + (_local2 * y));
x = _local4;
y = _local5;
}
function SetToAngleNormal(_arg1:Number):void{
x = Math.cos(_arg1);
y = Math.sin(_arg1);
}
}
}//package