Initialize local project and fix ranch growth synchronization
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
package net.pixvi.myr.element.task
|
||||
{
|
||||
public class TaskStatusType
|
||||
{
|
||||
|
||||
public static var KILL_MONSTER:String = "killMonster";
|
||||
|
||||
public static var GET_MONSTER:String = "getMonster";
|
||||
|
||||
public static var GET_MONEY:String = "getMoney";
|
||||
|
||||
public static var GET_ITEM:String = "getItem";
|
||||
|
||||
public static var PASS_STAGE:String = "passStage";
|
||||
|
||||
public static var PASS_LEVEL:String = "passLevel";
|
||||
|
||||
public static var UNLOCK_MONSTER:String = "unlockMonster";
|
||||
|
||||
public static var NONE:String = "none";
|
||||
|
||||
public static var SYS_LOCK:String = "sysLock";
|
||||
|
||||
public static var BATTLE:String = "battle";
|
||||
|
||||
public static var FirstTypeObject:Object = {
|
||||
"none":{},
|
||||
"getMonster":{
|
||||
"type":2001050,
|
||||
"num":1,
|
||||
"mode":2,
|
||||
"remove":true
|
||||
},
|
||||
"getItem":{
|
||||
"type":30001,
|
||||
"num":1,
|
||||
"remove":true
|
||||
},
|
||||
"passStage":{
|
||||
"stage":"0101",
|
||||
"level":1
|
||||
},
|
||||
"passLevel":{"level":1},
|
||||
"killMonster":{
|
||||
"type":2001050,
|
||||
"num":1,
|
||||
"mode":-1
|
||||
},
|
||||
"unlockMonster":{"type":2001050},
|
||||
"sysLock":{"key":"lockname"},
|
||||
"getMoney":{
|
||||
"money":100,
|
||||
"remove":true
|
||||
},
|
||||
"battle":{"monExp":10}
|
||||
};
|
||||
|
||||
public static var FirstStatusValue:Object = {
|
||||
"none":{},
|
||||
"getMonster":{"num":0},
|
||||
"passStage":{},
|
||||
"passLevel":{},
|
||||
"killMonster":{"num":0},
|
||||
"unlockMonster":{},
|
||||
"sysLock":{},
|
||||
"getMoney":{"money":0},
|
||||
"battle":{}
|
||||
};
|
||||
|
||||
public static var TypeTips:Object = {
|
||||
"none":" 无条件,会直接指示进入对话或者战斗",
|
||||
"getMonster":" 【蛋条件已转移到getItem】获取{type}魔物成年体{num}个时候达成条件,{remove}决定是否回收目标数量的魔物。\n 任务最好安排在前置条件-解锁某个怪物图鉴之后。\n 该step中不可有战斗",
|
||||
"getItem":" 获取{type}物品{num}个时候达成条件,{remove}决定是否回收目标数量的物品。\n 该step中不可有战斗。",
|
||||
"passLevel":" 农场等级达到{level}时完成。",
|
||||
"passStage":" 完成关卡{stage}难度{level}时完成。",
|
||||
"killMonster":" 在任何胜利的战斗中累计狩猎{mode}形态的{type}人外{num}只时完成,如果不限定状态,状态填-1",
|
||||
"unlockMonster":" 图鉴解锁了人外{type}时完成。",
|
||||
"sysLock":" 系统锁定,等待系统通过该状态。",
|
||||
"getMoney":" 持有{money}金币时达成条件,{remove}决定是否回收金币。",
|
||||
"battle":" 完成任务战斗。"
|
||||
};
|
||||
|
||||
public function TaskStatusType()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function isNone(type:String) : Boolean
|
||||
{
|
||||
if(type == "none" || type == "passStage" || type == "battle")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,316 @@
|
||||
package net.pixvi.myr.element.task
|
||||
{
|
||||
import net.pixvi.common.utils.PiObject;
|
||||
import net.pixvi.myr.center.BagCenter;
|
||||
import net.pixvi.myr.center.GuideCenter;
|
||||
import net.pixvi.myr.center.LibCenter;
|
||||
import net.pixvi.myr.center.Master;
|
||||
import net.pixvi.myr.center.MonsterCenter;
|
||||
import net.pixvi.myr.center.StageCenter;
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.myr.center.TaskCenter;
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
import net.pixvi.myr.element.npc.ConditionVo;
|
||||
import net.pixvi.pfw.utils.Paster;
|
||||
|
||||
public class TaskStepVo extends PiObject
|
||||
{
|
||||
|
||||
public var taskid:int;
|
||||
|
||||
public var taskStep:int;
|
||||
|
||||
public var taskTypeId:String = "";
|
||||
|
||||
public var isStartStep:Boolean = false;
|
||||
|
||||
public var stepFlag:int = 0;
|
||||
|
||||
public var statusComplete:Boolean = false;
|
||||
|
||||
public function TaskStepVo()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function get name() : String
|
||||
{
|
||||
return table().name;
|
||||
}
|
||||
|
||||
public function get des() : String
|
||||
{
|
||||
var monType:String = null;
|
||||
var monName:String = null;
|
||||
var mon:MonsterVo = null;
|
||||
var des:String = table().des;
|
||||
if(getTaskVo().type == TaskType.ENTANGLE_TASK)
|
||||
{
|
||||
monType = taskTypeId.toString().substr(1,7);
|
||||
if(Table.setting.entangleTaskToMonTypeFix != null && Table.setting.entangleTaskToMonTypeFix[taskTypeId] != null)
|
||||
{
|
||||
monType = Table.setting.entangleTaskToMonTypeFix[taskTypeId];
|
||||
}
|
||||
monName = "Error";
|
||||
mon = MonsterCenter.getIns().getEntangleMonByType(int(monType));
|
||||
if(mon != null)
|
||||
{
|
||||
monName = mon.name;
|
||||
}
|
||||
des = Paster.replace(des,"{monName}",monName);
|
||||
}
|
||||
return des;
|
||||
}
|
||||
|
||||
public function get position() : String
|
||||
{
|
||||
return table().position;
|
||||
}
|
||||
|
||||
public function get npc() : String
|
||||
{
|
||||
return table().npc;
|
||||
}
|
||||
|
||||
public function get story() : String
|
||||
{
|
||||
return table().story;
|
||||
}
|
||||
|
||||
public function get afterStory() : String
|
||||
{
|
||||
return table().afterStory;
|
||||
}
|
||||
|
||||
public function get auto() : Boolean
|
||||
{
|
||||
return table().auto;
|
||||
}
|
||||
|
||||
public function get statusType() : String
|
||||
{
|
||||
return table().statusType;
|
||||
}
|
||||
|
||||
public function get statusValue() : Object
|
||||
{
|
||||
return table().statusValue;
|
||||
}
|
||||
|
||||
public function passGuide() : Boolean
|
||||
{
|
||||
if(table().passGuide == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return GuideCenter.getIns().checkFin(table().passGuide);
|
||||
}
|
||||
|
||||
public function canShow() : Boolean
|
||||
{
|
||||
return passGuide();
|
||||
}
|
||||
|
||||
public function isStageBattle() : Object
|
||||
{
|
||||
if(statusType == TaskStatusType.PASS_STAGE)
|
||||
{
|
||||
return {
|
||||
"stageid":statusValue.stage,
|
||||
"level":statusValue.level
|
||||
};
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function get battle() : Object
|
||||
{
|
||||
if(statusType == TaskStatusType.PASS_STAGE)
|
||||
{
|
||||
return StageCenter.getIns().getStageBattle(statusValue.stage,statusValue.level);
|
||||
}
|
||||
if(statusType == TaskStatusType.BATTLE)
|
||||
{
|
||||
return table().battle;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get reward() : Object
|
||||
{
|
||||
if(statusType == TaskStatusType.PASS_STAGE)
|
||||
{
|
||||
return StageCenter.getIns().getStageReward(statusValue.stage,statusValue.level);
|
||||
}
|
||||
if(table().reward.rewards == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return table().reward;
|
||||
}
|
||||
|
||||
public function hasBattle() : Boolean
|
||||
{
|
||||
if(statusType == TaskStatusType.PASS_STAGE || statusType == TaskStatusType.BATTLE)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function hasReward() : Boolean
|
||||
{
|
||||
if(reward == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function hasTalk(pos:String) : Boolean
|
||||
{
|
||||
if(getPassCondition() == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if((story != "" || statusType == TaskStatusType.BATTLE) && pos == position)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function get unlockStages() : Array
|
||||
{
|
||||
return table().unlockStages;
|
||||
}
|
||||
|
||||
public function isStatusComplete() : Boolean
|
||||
{
|
||||
switch(statusType)
|
||||
{
|
||||
case TaskStatusType.BATTLE:
|
||||
case TaskStatusType.PASS_STAGE:
|
||||
case TaskStatusType.NONE:
|
||||
break;
|
||||
case TaskStatusType.GET_MONSTER:
|
||||
if(int(statusValue.mode) == 0)
|
||||
{
|
||||
return MonsterCenter.getIns().taskHasEggNum(statusValue.type) >= statusValue.num;
|
||||
}
|
||||
return MonsterCenter.getIns().taskHasMonster(statusValue.type,statusValue.mode).length >= statusValue.num;
|
||||
break;
|
||||
case TaskStatusType.GET_ITEM:
|
||||
return BagCenter.getIns().getNum(statusValue.type) >= statusValue.num;
|
||||
case TaskStatusType.KILL_MONSTER:
|
||||
if(Master.history.numKillMonsters[statusValue.type] == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Master.history.numKillMonsters[statusValue.type] >= getTaskVo().stepValue;
|
||||
break;
|
||||
case TaskStatusType.PASS_LEVEL:
|
||||
return Master.level >= statusValue.level;
|
||||
case TaskStatusType.UNLOCK_MONSTER:
|
||||
return LibCenter.getIns().checkUnlock(statusValue.type);
|
||||
case TaskStatusType.GET_MONEY:
|
||||
return Master.money >= statusValue.money;
|
||||
case TaskStatusType.SYS_LOCK:
|
||||
return Master.history.guide_record[statusValue.key] == true;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function statusProcess() : Array
|
||||
{
|
||||
var targetnum:int = 0;
|
||||
var curnum:int = 0;
|
||||
switch(statusType)
|
||||
{
|
||||
case TaskStatusType.GET_MONSTER:
|
||||
if(int(statusValue.mode) == 0)
|
||||
{
|
||||
curnum = MonsterCenter.getIns().taskHasEggNum(statusValue.type);
|
||||
}
|
||||
else
|
||||
{
|
||||
curnum = int(MonsterCenter.getIns().taskHasMonster(statusValue.type,statusValue.mode).length);
|
||||
}
|
||||
targetnum = int(statusValue.num);
|
||||
break;
|
||||
case TaskStatusType.GET_ITEM:
|
||||
curnum = BagCenter.getIns().getNum(statusValue.type);
|
||||
targetnum = int(statusValue.num);
|
||||
break;
|
||||
case TaskStatusType.KILL_MONSTER:
|
||||
curnum = statusValue.num - (getTaskVo().stepValue - Master.history.numKillMonsters[statusValue.type]);
|
||||
targetnum = int(statusValue.num);
|
||||
break;
|
||||
case TaskStatusType.GET_MONEY:
|
||||
curnum = int(Master.money);
|
||||
targetnum = int(statusValue.money);
|
||||
break;
|
||||
case TaskStatusType.PASS_LEVEL:
|
||||
curnum = int(Master.level);
|
||||
targetnum = int(statusValue.level);
|
||||
}
|
||||
if(targetnum == 0 && curnum == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if(curnum > targetnum)
|
||||
{
|
||||
curnum = targetnum;
|
||||
}
|
||||
return [curnum,targetnum];
|
||||
}
|
||||
|
||||
public function getTaskVo() : TaskVo
|
||||
{
|
||||
return TaskCenter.getIns().getTaskById(taskid);
|
||||
}
|
||||
|
||||
public function canStepComplete() : Boolean
|
||||
{
|
||||
if(isStatusComplete() && afterStory == "")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getCondition() : ConditionVo
|
||||
{
|
||||
var c:ConditionVo = null;
|
||||
if(table().condition == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
c = new ConditionVo();
|
||||
c.ondata(table().condition);
|
||||
return c;
|
||||
}
|
||||
|
||||
public function getPassCondition() : Boolean
|
||||
{
|
||||
var c:ConditionVo = getCondition();
|
||||
if(c == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return c.check();
|
||||
}
|
||||
|
||||
public function table() : Object
|
||||
{
|
||||
if(isStartStep)
|
||||
{
|
||||
return Table.task_info[taskTypeId].startStep;
|
||||
}
|
||||
return Table.task_info[taskTypeId].steps[taskStep];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package net.pixvi.myr.element.task
|
||||
{
|
||||
public class TaskType
|
||||
{
|
||||
|
||||
public static var STORY_MAIN:int = 1;
|
||||
|
||||
public static var STORY_SUB:int = 2;
|
||||
|
||||
public static var EVENT_TASK:int = 3;
|
||||
|
||||
public static var LOOP_TASK:int = 4;
|
||||
|
||||
public static var ENTANGLE_TASK:int = 5;
|
||||
|
||||
public static var TYPENAME:Object = {
|
||||
"1":"主线任务",
|
||||
"2":"支线任务",
|
||||
"3":"活动任务",
|
||||
"4":"循环任务",
|
||||
"5":"羁绊任务"
|
||||
};
|
||||
|
||||
public function TaskType()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,252 @@
|
||||
package net.pixvi.myr.element.task
|
||||
{
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.common.utils.PiObject;
|
||||
import net.pixvi.myr.center.Master;
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.myr.center.TaskCenter;
|
||||
import net.pixvi.myr.element.reward.RewardVo;
|
||||
import net.pixvi.pfw.utils.Paster;
|
||||
|
||||
public class TaskVo extends PiObject
|
||||
{
|
||||
|
||||
public var id:int;
|
||||
|
||||
public var typeId:String;
|
||||
|
||||
public var step:int = 0;
|
||||
|
||||
public var stepVo:TaskStepVo;
|
||||
|
||||
public var stepValue:int;
|
||||
|
||||
public var complete:Boolean = false;
|
||||
|
||||
public var recieved:Boolean = false;
|
||||
|
||||
private var cityCache:int = -1;
|
||||
|
||||
public function TaskVo()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function checkTaskCity(taskTypeId:String) : int
|
||||
{
|
||||
var startpos:String = null;
|
||||
var steppos:String = null;
|
||||
if(Table.task_info[taskTypeId].startStep != null)
|
||||
{
|
||||
startpos = Table.task_info[taskTypeId].startStep.position;
|
||||
if(startpos.indexOf("city") == 0)
|
||||
{
|
||||
return int(startpos.split("_")[0].replace("city",""));
|
||||
}
|
||||
}
|
||||
if(Table.task_info[taskTypeId].steps[0] != null)
|
||||
{
|
||||
steppos = Table.task_info[taskTypeId].steps[0].position;
|
||||
if(steppos.indexOf("city") == 0)
|
||||
{
|
||||
return int(steppos.split("_")[0].replace("city",""));
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function get name() : String
|
||||
{
|
||||
return table().name;
|
||||
}
|
||||
|
||||
public function get curName() : String
|
||||
{
|
||||
var process:Array = null;
|
||||
var curname:String = table().name;
|
||||
if(process == null || stepVo == null)
|
||||
{
|
||||
return curname;
|
||||
}
|
||||
process = stepVo.statusProcess();
|
||||
if(process[0] >= process[1])
|
||||
{
|
||||
curname += Paster.font(lang("(完成)"),"#00c93b",16,true);
|
||||
}
|
||||
else
|
||||
{
|
||||
curname += " (" + Paster.font(process[0],"#00c9c4",null,true) + "/" + process[1] + ")";
|
||||
}
|
||||
return curname;
|
||||
}
|
||||
|
||||
public function get des() : String
|
||||
{
|
||||
return table().des;
|
||||
}
|
||||
|
||||
public function get shortDes() : String
|
||||
{
|
||||
if(table().des2 == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return table().des2;
|
||||
}
|
||||
|
||||
public function get steps() : Array
|
||||
{
|
||||
if(table() == null)
|
||||
{
|
||||
Alert.showMsg("can\'t find taskSteps【" + typeId + "】");
|
||||
return [];
|
||||
}
|
||||
return table().steps;
|
||||
}
|
||||
|
||||
public function get unlockStages() : Array
|
||||
{
|
||||
return table().unlockStages;
|
||||
}
|
||||
|
||||
public function get startStep() : TaskStepVo
|
||||
{
|
||||
var stepvo:TaskStepVo = new TaskStepVo();
|
||||
stepvo.taskid = id;
|
||||
stepvo.taskTypeId = typeId;
|
||||
stepvo.isStartStep = true;
|
||||
return stepvo;
|
||||
}
|
||||
|
||||
public function get closed() : Boolean
|
||||
{
|
||||
return table().closed;
|
||||
}
|
||||
|
||||
public function get hasStartStep() : Boolean
|
||||
{
|
||||
if(type == TaskType.ENTANGLE_TASK)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if(table().startStep != null && table().startStep.position != "" && table().startStep.npc != "")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function get type() : int
|
||||
{
|
||||
return table().type;
|
||||
}
|
||||
|
||||
public function get nextTasks() : Array
|
||||
{
|
||||
return table().nextTasks;
|
||||
}
|
||||
|
||||
public function get unlockTasks() : Array
|
||||
{
|
||||
return table().unlockTasks;
|
||||
}
|
||||
|
||||
public function getNpcCharaImgSrc() : String
|
||||
{
|
||||
return "data/img/avatar/tx_" + startStep.npc + ".png";
|
||||
}
|
||||
|
||||
public function get reward() : RewardVo
|
||||
{
|
||||
var r:RewardVo = new RewardVo();
|
||||
r.setByObject(table().reward);
|
||||
return r;
|
||||
}
|
||||
|
||||
public function get taskLevel() : int
|
||||
{
|
||||
if(table().taskLevel == null)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return table().taskLevel;
|
||||
}
|
||||
|
||||
public function get isMain() : Boolean
|
||||
{
|
||||
if(type == TaskType.STORY_MAIN)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function get tip() : String
|
||||
{
|
||||
if(canFinish())
|
||||
{
|
||||
return lang("任务完成!");
|
||||
}
|
||||
return stepVo.des;
|
||||
}
|
||||
|
||||
public function getStepVo(taskStep:int = -1) : TaskStepVo
|
||||
{
|
||||
if(taskStep == -1)
|
||||
{
|
||||
taskStep = this.step;
|
||||
}
|
||||
var t:TaskStepVo = new TaskStepVo();
|
||||
t.taskid = this.id;
|
||||
t.taskTypeId = typeId;
|
||||
t.taskStep = taskStep;
|
||||
return t;
|
||||
}
|
||||
|
||||
public function canFinish() : Boolean
|
||||
{
|
||||
if(!complete)
|
||||
{
|
||||
if(step >= steps.length && steps.length != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function finish() : Boolean
|
||||
{
|
||||
if(canFinish() || Master.history.passTask[typeId] != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function table() : Object
|
||||
{
|
||||
return Table.task_info[typeId];
|
||||
}
|
||||
|
||||
public function isget() : Boolean
|
||||
{
|
||||
if(TaskCenter.getIns().getLocalTaskByTypeId(typeId) != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function get taskCity() : int
|
||||
{
|
||||
if(cityCache == -1)
|
||||
{
|
||||
cityCache = checkTaskCity(typeId);
|
||||
}
|
||||
return cityCache;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user