Initialize local project and fix ranch growth synchronization
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package net.pixvi.myr.element.randomevent
|
||||
{
|
||||
public class RandomEventType
|
||||
{
|
||||
|
||||
public static var FARM_EVENT:int = 1;
|
||||
|
||||
public static var FARM_TIMER_NAME:String = "farmEventTimer";
|
||||
|
||||
public static var MON_EVENT:int = 2;
|
||||
|
||||
public static var MON_TIMER_NAME:String = "monEventTimer";
|
||||
|
||||
public static var STAGE_EVENT:int = 3;
|
||||
|
||||
public static var STAGE_TIMER_NAME:String = "stageEventTimer";
|
||||
|
||||
public static var eventTimerNames:Array = ["farmEventTimer","monEventTimer","stageEventTimer"];
|
||||
|
||||
public static var TypeName:Object = {
|
||||
"1":"牧场事件",
|
||||
"2":"魔物事件",
|
||||
"3":"关卡事件"
|
||||
};
|
||||
|
||||
public function RandomEventType()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
package net.pixvi.myr.element.randomevent
|
||||
{
|
||||
import net.pixvi.myr.center.ImgCenter;
|
||||
import net.pixvi.myr.center.Master;
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.myr.center.TimeCenter;
|
||||
|
||||
public class RandomEventVo
|
||||
{
|
||||
|
||||
public var typeId:String;
|
||||
|
||||
public function RandomEventVo()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function get des() : String
|
||||
{
|
||||
return table.des;
|
||||
}
|
||||
|
||||
public function get img() : String
|
||||
{
|
||||
return ImgCenter.farmEventImg(table.img);
|
||||
}
|
||||
|
||||
public function get eventType() : String
|
||||
{
|
||||
return table.eventType;
|
||||
}
|
||||
|
||||
public function get chance() : int
|
||||
{
|
||||
return table.chance;
|
||||
}
|
||||
|
||||
public function get table() : Object
|
||||
{
|
||||
return Table.event_table[typeId];
|
||||
}
|
||||
|
||||
public function get miniGame() : int
|
||||
{
|
||||
return table.miniGame;
|
||||
}
|
||||
|
||||
public function get storyPosition() : String
|
||||
{
|
||||
return table.storyPosition;
|
||||
}
|
||||
|
||||
public function get storyNpc() : String
|
||||
{
|
||||
if(table.storyNpc == null || table.storyNpc == "")
|
||||
{
|
||||
return "event";
|
||||
}
|
||||
return table.storyNpc;
|
||||
}
|
||||
|
||||
public function get story() : String
|
||||
{
|
||||
return table.story;
|
||||
}
|
||||
|
||||
public function get hasPositionStory() : Boolean
|
||||
{
|
||||
return hasStory && storyNpc != null && storyNpc != "";
|
||||
}
|
||||
|
||||
public function get hasStory() : Boolean
|
||||
{
|
||||
return story != null && story != "";
|
||||
}
|
||||
|
||||
public function get hasImg() : Boolean
|
||||
{
|
||||
return img != null && img != "";
|
||||
}
|
||||
|
||||
public function hasTalk(pos:String) : Boolean
|
||||
{
|
||||
var i:int = 0;
|
||||
if(eventType == RandomEventType.FARM_EVENT.toString() && Master.randomEventTimer[RandomEventType.FARM_TIMER_NAME] < (TimeCenter.timestamp - 30) * 1000)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var posArr:Array = pos.split("_");
|
||||
var sposArr:Array = storyPosition.split("_");
|
||||
if(posArr.length != sposArr.length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
i = 0;
|
||||
while(i < sposArr.length)
|
||||
{
|
||||
if(posArr[i] == null || posArr[i].indexOf(sposArr[i]) != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user