Initialize local project and fix ranch growth synchronization
This commit is contained in:
@@ -0,0 +1,248 @@
|
||||
package net.pixvi.myr.element.npc
|
||||
{
|
||||
import net.pixvi.myr.center.Master;
|
||||
import net.pixvi.myr.center.StageCenter;
|
||||
import net.pixvi.myr.center.TaskCenter;
|
||||
import net.pixvi.myr.center.TimeCenter;
|
||||
import net.pixvi.myr.element.task.TaskVo;
|
||||
import net.pixvi.myrloader.center.MyrCenter;
|
||||
import net.pixvi.pfw.utils.Calendar;
|
||||
|
||||
public class ConditionVo
|
||||
{
|
||||
|
||||
public var finishTask:Array;
|
||||
|
||||
public var unfinishTask:Array;
|
||||
|
||||
public var passStage:Array;
|
||||
|
||||
public var unlockStage:Array;
|
||||
|
||||
public var startTime:int;
|
||||
|
||||
public var endTime:int;
|
||||
|
||||
public var week:Array = [0,1,2,3,4,5,6];
|
||||
|
||||
public var startTimestamp:uint = 0;
|
||||
|
||||
public var endTimestamp:uint = 0;
|
||||
|
||||
public var minLevel:int;
|
||||
|
||||
public var maxLevel:int;
|
||||
|
||||
public var close:Boolean = false;
|
||||
|
||||
public var platform:String = "all";
|
||||
|
||||
public var channel:String = "all";
|
||||
|
||||
public var lang:String = "all";
|
||||
|
||||
public function ConditionVo(data:Object = null)
|
||||
{
|
||||
super();
|
||||
normal();
|
||||
if(data != null)
|
||||
{
|
||||
ondata(data);
|
||||
}
|
||||
}
|
||||
|
||||
public static function checkCondition(conObj:Object) : Boolean
|
||||
{
|
||||
var coon:ConditionVo = new ConditionVo(conObj);
|
||||
return coon.check();
|
||||
}
|
||||
|
||||
public function ondata(data:Object) : void
|
||||
{
|
||||
if(data == null)
|
||||
{
|
||||
normal();
|
||||
return;
|
||||
}
|
||||
if(data.platform != null)
|
||||
{
|
||||
platform = data.platform;
|
||||
}
|
||||
if(data.channel != null)
|
||||
{
|
||||
channel = data.channel;
|
||||
}
|
||||
finishTask = data.finishTask;
|
||||
unfinishTask = data.unfinishTask;
|
||||
startTime = data.startTime;
|
||||
if(data.endTime == null)
|
||||
{
|
||||
endTime = 2147483647;
|
||||
}
|
||||
else
|
||||
{
|
||||
endTime = data.endTime;
|
||||
}
|
||||
if(data.close != null)
|
||||
{
|
||||
this.close = data.close;
|
||||
}
|
||||
if(data.week != null)
|
||||
{
|
||||
week = data.week;
|
||||
}
|
||||
if(data.minLevel != null)
|
||||
{
|
||||
minLevel = data.minLevel;
|
||||
}
|
||||
else
|
||||
{
|
||||
minLevel = 0;
|
||||
}
|
||||
if(data.passStage == null)
|
||||
{
|
||||
passStage = data.passStage;
|
||||
}
|
||||
else
|
||||
{
|
||||
passStage = [];
|
||||
}
|
||||
if(data.unlockStage == null)
|
||||
{
|
||||
unlockStage = [];
|
||||
}
|
||||
else
|
||||
{
|
||||
unlockStage = data.unlockStage;
|
||||
}
|
||||
if(data.maxLevel == null)
|
||||
{
|
||||
maxLevel = 2147483647;
|
||||
}
|
||||
else
|
||||
{
|
||||
maxLevel = data.maxLevel;
|
||||
}
|
||||
if(data.startTimestamp != null)
|
||||
{
|
||||
startTimestamp = data.startTimestamp;
|
||||
}
|
||||
if(data.endTimestamp != null)
|
||||
{
|
||||
endTimestamp = data.endTimestamp;
|
||||
}
|
||||
else
|
||||
{
|
||||
endTimestamp = 2147483647;
|
||||
}
|
||||
}
|
||||
|
||||
public function normal() : void
|
||||
{
|
||||
finishTask = [];
|
||||
unfinishTask = [];
|
||||
passStage = [];
|
||||
unlockStage = [];
|
||||
startTime = 0;
|
||||
endTime = 2400;
|
||||
week = [0,1,2,3,4,5,6];
|
||||
minLevel = 0;
|
||||
maxLevel = 99999;
|
||||
startTimestamp = 0;
|
||||
endTimestamp = 2147483647;
|
||||
}
|
||||
|
||||
public function check() : Boolean
|
||||
{
|
||||
var taskTypeId:String = null;
|
||||
var i:int = 0;
|
||||
var j:int = 0;
|
||||
var taskvo:TaskVo = null;
|
||||
var k:int = 0;
|
||||
var k2:int = 0;
|
||||
var level:int = int(Master.level);
|
||||
if(minLevel > level || maxLevel < level || close)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(platform != null && platform != "all" && platform != MyrCenter.platform)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(channel != null && channel != "all" && channel != MyrCenter.channel)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(lang != null && lang != "all" && lang != MyrCenter.lang)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(finishTask != null)
|
||||
{
|
||||
for(i = 0; i < finishTask.length; )
|
||||
{
|
||||
taskTypeId = finishTask[i];
|
||||
if(Master.history.passTask[taskTypeId] != true)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if(unfinishTask != null)
|
||||
{
|
||||
for(j = 0; j < unfinishTask.length; )
|
||||
{
|
||||
taskTypeId = unfinishTask[j];
|
||||
taskvo = TaskCenter.getIns().getTaskByType(taskTypeId);
|
||||
if(Master.history.passTask[taskTypeId] == true || taskvo != null && taskvo.recieved)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
if(passStage != null && passStage.length > 0)
|
||||
{
|
||||
for(k = 0; k < passStage.length; )
|
||||
{
|
||||
if(!StageCenter.getIns().isStagePass(passStage[k]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
k++;
|
||||
}
|
||||
}
|
||||
if(unlockStage != null && unlockStage.length > 0)
|
||||
{
|
||||
for(k2 = 0; k2 < unlockStage.length; )
|
||||
{
|
||||
if(!StageCenter.getIns().isStageUnlock(unlockStage[k2]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
k2++;
|
||||
}
|
||||
}
|
||||
var curshowdata:Date = Calendar.getShowDate();
|
||||
if(week != null)
|
||||
{
|
||||
if(week.indexOf(curshowdata.day) == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
var curTime:int = curshowdata.hours * 100 + curshowdata.minutes;
|
||||
if(curTime < startTime || curTime > endTime)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(TimeCenter.timestamp < startTimestamp || TimeCenter.timestamp > endTimestamp)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
package net.pixvi.myr.element.npc
|
||||
{
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.myr.center.MonsterCenter;
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.myr.element.mon.MonsterVo;
|
||||
|
||||
public class NPCVo
|
||||
{
|
||||
|
||||
public var type:String;
|
||||
|
||||
public function NPCVo()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function get darkMode() : Boolean
|
||||
{
|
||||
if(getTable() != null && getTable().darkMode == true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get name() : String
|
||||
{
|
||||
var montype:String = null;
|
||||
var mon:MonsterVo = null;
|
||||
if(type.indexOf("jb_") == 0)
|
||||
{
|
||||
montype = type.substr(3);
|
||||
mon = MonsterCenter.getIns().getEntangleMonByType(int(montype));
|
||||
return mon.name;
|
||||
}
|
||||
return getTable().name;
|
||||
}
|
||||
|
||||
public function get des() : String
|
||||
{
|
||||
if(type.indexOf("jb_") == 0)
|
||||
{
|
||||
return lang("羁绊魔物");
|
||||
}
|
||||
return getTable().des;
|
||||
}
|
||||
|
||||
public function getTable() : Object
|
||||
{
|
||||
return Table.npc_info[type];
|
||||
}
|
||||
|
||||
public function exsist() : Boolean
|
||||
{
|
||||
if(type.indexOf("jb_") == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return Table.npc_info[type] != null;
|
||||
}
|
||||
|
||||
public function img_avatar() : String
|
||||
{
|
||||
var montype:String = null;
|
||||
montype = null;
|
||||
if(type.indexOf("jb_") == 0)
|
||||
{
|
||||
montype = type.substr(3);
|
||||
return "data/img/monster/ta/" + montype + "_ta_0.png";
|
||||
}
|
||||
if(getTable().avatar.indexOf("mon_") == 0)
|
||||
{
|
||||
montype = getTable().avatar.substr(4);
|
||||
return "data/img/monster/ta/" + montype + "_ta_0.png";
|
||||
}
|
||||
return "data/img/avatar/" + getTable().avatar;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package net.pixvi.myr.element.npc
|
||||
{
|
||||
import net.pixvi.pfw.utils.Random;
|
||||
|
||||
public class PositionNPC
|
||||
{
|
||||
|
||||
public var npc:String;
|
||||
|
||||
public var position:String;
|
||||
|
||||
public var random:Number;
|
||||
|
||||
public var storys:Array;
|
||||
|
||||
public var condition:ConditionVo;
|
||||
|
||||
public function PositionNPC()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function ondata(data:Object) : void
|
||||
{
|
||||
npc = data.npc;
|
||||
position = data.position;
|
||||
random = data.random;
|
||||
storys = data.storys;
|
||||
condition = new ConditionVo();
|
||||
condition.ondata(data.condition);
|
||||
}
|
||||
|
||||
public function getStory() : String
|
||||
{
|
||||
return Random.element(storys) as String;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user