SHARE
TWEET

Untitled

a guest Oct 13th, 2019 256 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.ankamagames.dofus.internalDatacenter.quest
  2. {
  3.    import com.ankamagames.dofus.network.types.game.context.roleplay.treasureHunt.TreasureHuntFlag;
  4.    import com.ankamagames.dofus.network.types.game.context.roleplay.treasureHunt.TreasureHuntStep;
  5.    import com.ankamagames.dofus.network.types.game.context.roleplay.treasureHunt.TreasureHuntStepFight;
  6.    import com.ankamagames.dofus.network.types.game.context.roleplay.treasureHunt.TreasureHuntStepFollowDirection;
  7.    import com.ankamagames.dofus.network.types.game.context.roleplay.treasureHunt.TreasureHuntStepFollowDirectionToHint;
  8.    import com.ankamagames.dofus.network.types.game.context.roleplay.treasureHunt.TreasureHuntStepFollowDirectionToPOI;
  9.    import com.ankamagames.dofus.types.enums.TreasureHuntStepTypeEnum;
  10.    import com.ankamagames.jerakine.interfaces.IDataCenter;
  11.    import com.ankamagames.jerakine.logger.Log;
  12.    import com.ankamagames.jerakine.logger.Logger;
  13.    import flash.utils.getQualifiedClassName;
  14.    
  15.    public class TreasureHuntWrapper implements IDataCenter
  16.    {
  17.      
  18.       protected static const _log:Logger = Log.getLogger(getQualifiedClassName(TreasureHuntWrapper));
  19.        
  20.      
  21.       public var questType:uint;
  22.      
  23.       public var checkPointCurrent:uint;
  24.      
  25.       public var checkPointTotal:uint;
  26.      
  27.       public var totalStepCount:uint;
  28.      
  29.       public var availableRetryCount:int;
  30.      
  31.       public var stepList:Vector.<TreasureHuntStepWrapper>;
  32.      
  33.       public function TreasureHuntWrapper()
  34.       {
  35.          this.stepList = new Vector.<TreasureHuntStepWrapper>();
  36.          super();
  37.       }
  38.      
  39.       public static function create(questType:uint, startMapId:Number, checkPointCurrent:uint, checkPointTotal:uint, totalStepCount:uint, availableRetryCount:int, stepList:Vector.<TreasureHuntStep>, flags:Vector.<TreasureHuntFlag>) : TreasureHuntWrapper
  40.       {
  41.          var step:TreasureHuntStep = null;
  42.          var mapId:Number = NaN;
  43.          var flagState:int = 0;
  44.          var item:TreasureHuntWrapper = new TreasureHuntWrapper();
  45.          item.questType = questType;
  46.          item.checkPointCurrent = checkPointCurrent;
  47.          item.checkPointTotal = checkPointTotal;
  48.          item.totalStepCount = totalStepCount;
  49.          item.availableRetryCount = availableRetryCount;
  50.          var startStep:TreasureHuntStepWrapper = TreasureHuntStepWrapper.create(TreasureHuntStepTypeEnum.START,0,0,startMapId,0);
  51.          item.stepList.push(startStep);
  52.          var i:int = 0;
  53.          for each(step in stepList)
  54.          {
  55.             mapId = 0;
  56.             flagState = -1;
  57.             if(flags && flags.length > i && flags[i])
  58.             {
  59.                mapId = flags[i].mapId;
  60.                flagState = flags[i].state;
  61.             }
  62.             if(step is TreasureHuntStepFollowDirectionToPOI)
  63.             {
  64.                item.stepList.push(TreasureHuntStepWrapper.create(TreasureHuntStepTypeEnum.DIRECTION_TO_POI,i,(step as TreasureHuntStepFollowDirectionToPOI).direction,mapId,(step as TreasureHuntStepFollowDirectionToPOI).poiLabelId,flagState));
  65.             }
  66.             if(step is TreasureHuntStepFollowDirection)
  67.             {
  68.                item.stepList.push(TreasureHuntStepWrapper.create(TreasureHuntStepTypeEnum.DIRECTION,i,(step as TreasureHuntStepFollowDirection).direction,mapId,0,flagState,(step as TreasureHuntStepFollowDirection).mapCount));
  69.             }
  70.             if(step is TreasureHuntStepFollowDirectionToHint)
  71.             {
  72.                item.stepList.push(TreasureHuntStepWrapper.create(TreasureHuntStepTypeEnum.DIRECTION_TO_HINT,i,(step as TreasureHuntStepFollowDirectionToHint).direction,mapId,0,flagState,(step as TreasureHuntStepFollowDirectionToHint).npcId));
  73.             }
  74.             i++;
  75.          }
  76.          while(item.stepList.length <= totalStepCount)
  77.          {
  78.             item.stepList.push(TreasureHuntStepWrapper.create(TreasureHuntStepTypeEnum.UNKNOWN,63,0,0,0));
  79.          }
  80.          item.stepList.push(TreasureHuntStepWrapper.create(TreasureHuntStepTypeEnum.FIGHT,63,0,0,0));
  81.          return item;
  82.       }
  83.      
  84.       public function update(questType:uint, startMapId:Number, checkPointCurrent:uint, checkPointTotal:uint, availableRetryCount:int, stepList:Vector.<TreasureHuntStep>, flags:Vector.<TreasureHuntFlag>) : void
  85.       {
  86.          var step:TreasureHuntStep = null;
  87.          var mapId:Number = NaN;
  88.          var flagState:int = 0;
  89.          this.questType = questType;
  90.          this.checkPointCurrent = checkPointCurrent;
  91.          this.checkPointTotal = checkPointTotal;
  92.          this.totalStepCount = checkPointTotal;
  93.          this.availableRetryCount = availableRetryCount;
  94.          this.stepList = new Vector.<TreasureHuntStepWrapper>();
  95.          var startStep:TreasureHuntStepWrapper = TreasureHuntStepWrapper.create(TreasureHuntStepTypeEnum.START,0,0,startMapId,0);
  96.          this.stepList.push(startStep);
  97.          var i:int = 0;
  98.          for each(step in stepList)
  99.          {
  100.             mapId = 0;
  101.             flagState = -1;
  102.             if(flags && flags.length > i && flags[i])
  103.             {
  104.                mapId = flags[i].mapId;
  105.                flagState = flags[i].state;
  106.             }
  107.             if(step is TreasureHuntStepFollowDirectionToPOI)
  108.             {
  109.                this.stepList.push(TreasureHuntStepWrapper.create(TreasureHuntStepTypeEnum.DIRECTION_TO_POI,i,(step as TreasureHuntStepFollowDirectionToPOI).direction,mapId,(step as TreasureHuntStepFollowDirectionToPOI).poiLabelId,flagState));
  110.             }
  111.             else if(step is TreasureHuntStepFollowDirectionToHint)
  112.             {
  113.                this.stepList.push(TreasureHuntStepWrapper.create(TreasureHuntStepTypeEnum.DIRECTION_TO_HINT,i,(step as TreasureHuntStepFollowDirectionToHint).direction,mapId,0,flagState));
  114.             }
  115.             else if(step is TreasureHuntStepFight)
  116.             {
  117.                this.stepList.push(TreasureHuntStepWrapper.create(TreasureHuntStepTypeEnum.FIGHT,63,0,0,0));
  118.             }
  119.             i++;
  120.          }
  121.       }
  122.    }
  123. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top