Advertisement
NJ5SkwAg

models.ActionBar

Feb 1st, 2016
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package models
  2. {
  3.    import com.playsaurus.model.Model;
  4.    import it.sephiroth.gettext._;
  5.    import com.playsaurus.utils.CurrentUser;
  6.    import com.playsaurus.utils.ServerTimeKeeper;
  7.    
  8.    public class ActionBar extends Model
  9.    {
  10.      
  11.       public static const DOUBLE_SKILL:int = 5;
  12.      
  13.       public static const NUM_ACTION_BUTTONS:Number = 9;
  14.      
  15.       public static const DARK_RITUAL:Number = 8;
  16.      
  17.       public static var skills:Object = {
  18.          "1":{
  19.             "name":"Clickstorm",
  20.             "description":"Automatically performs 10 Clicks Per Second for %1 seconds.",
  21.             "cooldown":600000,
  22.             "iconId":7,
  23.             "heroId":1,
  24.             "timeEndId":"skillFreeClicksEnd"
  25.          },
  26.          "2":{
  27.             "name":"Powersurge",
  28.             "description":"+100% DPS for %1 seconds.",
  29.             "cooldown":600000,
  30.             "iconId":108,
  31.             "heroId":3,
  32.             "timeEndId":"skillDpsMultiplierEnd"
  33.          },
  34.          "3":{
  35.             "name":"Lucky Strikes",
  36.             "description":"+50% chance of Critical Click for %1 seconds.",
  37.             "cooldown":1800000,
  38.             "iconId":81,
  39.             "heroId":10,
  40.             "timeEndId":"skillCriticalClickChanceEnd"
  41.          },
  42.          "4":{
  43.             "name":"Metal Detector",
  44.             "description":"+100% Gold dropped for %1 seconds.",
  45.             "cooldown":1800000,
  46.             "iconId":67,
  47.             "heroId":14,
  48.             "timeEndId":"skillGoldBonusEnd"
  49.          },
  50.          "5":{
  51.             "name":"Energize",
  52.             "description":"Doubles the effect of the next skill you use.",
  53.             "cooldown":3600000,
  54.             "iconId":112,
  55.             "heroId":23,
  56.             "timeEndId":"skillDouble"
  57.          },
  58.          "6":{
  59.             "name":"Golden Clicks",
  60.             "description":"Clicks give %2% of monster gold, for %1 seconds. (0.1% on Bosses)",
  61.             "cooldown":3600000,
  62.             "iconId":123,
  63.             "heroId":16,
  64.             "timeEndId":"skillWildGoldEnd"
  65.          },
  66.          "7":{
  67.             "name":"Super Clicks",
  68.             "description":"+200% click damage for %1 seconds.",
  69.             "cooldown":3600000,
  70.             "iconId":124,
  71.             "heroId":21,
  72.             "timeEndId":"skillClickMultiplierEnd"
  73.          },
  74.          "8":{
  75.             "name":"The Dark Ritual",
  76.             "description":_("Multiply your current DPS by 1.05 for the duration of your world."),
  77.             "descriptionMobile":"Gain 2 rubies.",
  78.             "cooldown":28800000,
  79.             "iconId":76,
  80.             "heroId":18,
  81.             "timeEndId":"nothing"
  82.          },
  83.          "9":{
  84.             "name":"Reload",
  85.             "description":"Reduce the cooldown of the last skill you used by 1 hour.",
  86.             "cooldown":3600000,
  87.             "iconId":51,
  88.             "heroId":24,
  89.             "timeEndId":"nothing"
  90.          }
  91.       };
  92.        
  93.       public function ActionBar()
  94.       {
  95.          super();
  96.       }
  97.      
  98.       public function onSkillClick(param1:Number, param2:Boolean = true) : void
  99.       {
  100.          var _loc3_:UserData = CurrentUser.instance as UserData;
  101.          _loc3_.useSkill(param1);
  102.          switch(param1)
  103.          {
  104.             case 1:
  105.                _loc3_.skillFreeClicks = 10 * (_loc3_.skillDouble?2:1);
  106.                _loc3_.skillFreeClicksEnd = ServerTimeKeeper.instance.timestamp + _loc3_.getSkillDuration(1) * 1000;
  107.                break;
  108.             case 2:
  109.                _loc3_.skillDpsMultiplier = 1 * (_loc3_.skillDouble?2:1);
  110.                _loc3_.skillDpsMultiplierEnd = ServerTimeKeeper.instance.timestamp + _loc3_.getSkillDuration(2) * 1000;
  111.                break;
  112.             case 3:
  113.                _loc3_.skillCriticalClickChance = 50 * (_loc3_.skillDouble?2:1);
  114.                _loc3_.skillCriticalClickChanceEnd = ServerTimeKeeper.instance.timestamp + _loc3_.getSkillDuration(3) * 1000;
  115.                break;
  116.             case 4:
  117.                _loc3_.skillGoldBonus = 1 * (_loc3_.skillDouble?2:1);
  118.                _loc3_.skillGoldBonusEnd = ServerTimeKeeper.instance.timestamp + _loc3_.getSkillDuration(4) * 1000;
  119.                break;
  120.             case DOUBLE_SKILL:
  121.                _loc3_.skillDouble = true;
  122.                break;
  123.             case 6:
  124.                _loc3_.skillWildGold = 1 * (_loc3_.skillDouble?2:1);
  125.                _loc3_.skillWildGoldEnd = ServerTimeKeeper.instance.timestamp + _loc3_.getSkillDuration(6) * 1000;
  126.                break;
  127.             case 7:
  128.                _loc3_.skillClickMultiplier = 2 * (_loc3_.skillDouble?2:1);
  129.                _loc3_.skillClickMultiplierEnd = ServerTimeKeeper.instance.timestamp + _loc3_.getSkillDuration(7) * 1000;
  130.                break;
  131.             case 8:
  132.                _loc3_.allDpsMultiplier = _loc3_.allDpsMultiplier * (105 + (_loc3_.skillDouble?5:0)) / 100;
  133.                _loc3_.attributes.recalculate();
  134.                _loc3_.lifetimeDarkRitualClicks++;
  135.                _loc3_.darkRitualClicks++;
  136.                _loc3_.checkAchievements();
  137.                break;
  138.             case 9:
  139.                _loc3_.skillCooldowns[_loc3_.lastSkillUsed] = _loc3_.skillCooldowns[_loc3_.lastSkillUsed] - 60 * 60 * 1000;
  140.                if(_loc3_.skillDouble)
  141.                {
  142.                   _loc3_.skillCooldowns[_loc3_.secondToLastSkillUsed] = _loc3_.skillCooldowns[_loc3_.secondToLastSkillUsed] - 60 * 60 * 1000;
  143.                }
  144.                break;
  145.             default:
  146.                throw new Error("Unknown skill \'" + param1 + "\'");
  147.          }
  148.          if(param1 != DOUBLE_SKILL)
  149.          {
  150.             _loc3_.skillDouble = false;
  151.             if(param2)
  152.             {
  153.                _loc3_.secondToLastSkillUsed = _loc3_.lastSkillUsed;
  154.                _loc3_.lastSkillUsed = param1;
  155.             }
  156.          }
  157.          if(param2)
  158.          {
  159.             _loc3_.startSkillCooldown(param1,ServerTimeKeeper.instance.timestamp);
  160.          }
  161.       }
  162.    }
  163. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement