|
@@ -22,7 +22,7 @@ namespace XmdsServerEdgeJS.Zone
|
|
|
{
|
|
|
private readonly Logger log;
|
|
|
private readonly ZoneService service;
|
|
|
- private readonly string instanceID;
|
|
|
+ private readonly string instanceID;
|
|
|
private readonly ServerZoneNode node;
|
|
|
|
|
|
//连斩生效时间
|
|
@@ -36,10 +36,10 @@ namespace XmdsServerEdgeJS.Zone
|
|
|
node.SendToGameServer(name, param);
|
|
|
}
|
|
|
|
|
|
- public string GetBindGameSrvId()
|
|
|
- {
|
|
|
- return node.GetBindGameSrvId();
|
|
|
- }
|
|
|
+ public string GetBindGameSrvId()
|
|
|
+ {
|
|
|
+ return node.GetBindGameSrvId();
|
|
|
+ }
|
|
|
|
|
|
internal XmdsZoneNode(ZoneService svc, string instanceId, string gameServerId)
|
|
|
{
|
|
@@ -75,11 +75,11 @@ namespace XmdsServerEdgeJS.Zone
|
|
|
int killFullNum = (config.killFullNum != null) ? (int)(config.killFullNum) : 0;
|
|
|
int killFullCollSec = (config.killFullCollSec != null) ? (int)(config.killFullCollSec) : 0;
|
|
|
|
|
|
- GSCreateAreaData gsData = new GSCreateAreaData();
|
|
|
- gsData.value1 = (config.value1 != null) ? ((int)(config.value1)) : 0;
|
|
|
- gsData.value2 = (config.value2 != null) ? ((int)(config.value2)) : 0;
|
|
|
- this.node.Start(instanceID, mapTemplateId , config.monsterHard, (byte)config.allowAutoGuard, config.calPKValue,
|
|
|
- averageLevel, floorRatio, propRatio, killInterval, killFullNum, killFullNum, config.usespaceDiv,
|
|
|
+ GSCreateAreaData gsData = new GSCreateAreaData();
|
|
|
+ gsData.value1 = (config.value1 != null) ? ((int)(config.value1)) : 0;
|
|
|
+ gsData.value2 = (config.value2 != null) ? ((int)(config.value2)) : 0;
|
|
|
+ this.node.Start(instanceID, mapTemplateId, config.monsterHard, (byte)config.allowAutoGuard, config.calPKValue,
|
|
|
+ averageLevel, floorRatio, propRatio, killInterval, killFullNum, killFullNum, config.usespaceDiv,
|
|
|
(CommonAI.Data.SceneType)sceneType, gsData, (AreaType)areaType, isteam, canRiding);
|
|
|
this.node.Zone.OnUnitDead += zone_onUnitDead;
|
|
|
//this.node.Zone.OnGameOver += zone_onGameOver;
|
|
@@ -89,6 +89,7 @@ namespace XmdsServerEdgeJS.Zone
|
|
|
this.node.Zone.OnTryPickItem += zone_onTryPickItem;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
internal void Stop(Action<XmdsZoneNode> stopped)
|
|
|
{
|
|
|
if (node.IsDisposed)
|
|
@@ -100,21 +101,33 @@ namespace XmdsServerEdgeJS.Zone
|
|
|
node.OnZoneStop += (z) => { stopped(this); };
|
|
|
node.Stop();
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ if(this.node != null && this.node.Zone != null)
|
|
|
+ {
|
|
|
+ this.node.Zone.OnUnitDead -= zone_onUnitDead;
|
|
|
+ //this.node.Zone.OnGameOver -= zone_onGameOver;
|
|
|
+ this.node.Zone.OnUnitGotInstanceItem -= zone_onUnitGotInstanceItem;
|
|
|
+ this.node.Zone.OnUnitPickUnit -= zone_onUnitPickUnit;
|
|
|
+ this.node.Zone.OnSendMessageToGS -= zone_onSendMessageToGS;
|
|
|
+ this.node.Zone.OnTryPickItem -= zone_onTryPickItem;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
//------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
private HashMap<int, TVector2> _BornPlace = null;
|
|
|
- private HashMap<String, TVector2> _BornPlaceExt = null;
|
|
|
+ private HashMap<String, TVector2> _BornPlaceExt = null;
|
|
|
|
|
|
- public TVector2 r2b_get_getBornPlace(int areaId, string pointId)
|
|
|
+ public TVector2 r2b_get_getBornPlace(int areaId, string pointId)
|
|
|
{
|
|
|
lock (this)
|
|
|
{
|
|
|
if (_BornPlace == null)
|
|
|
{
|
|
|
_BornPlace = new HashMap<int, TVector2>();
|
|
|
- _BornPlaceExt = new HashMap<string, TVector2>();
|
|
|
- List<DecorationData> Decorations = this.Node.SceneData.Decorations;
|
|
|
+ _BornPlaceExt = new HashMap<string, TVector2>();
|
|
|
+ List<DecorationData> Decorations = this.Node.SceneData.Decorations;
|
|
|
foreach (DecorationData decoration in Decorations)
|
|
|
{
|
|
|
foreach (AbilityData ability in decoration.Abilities)
|
|
@@ -125,20 +138,20 @@ namespace XmdsServerEdgeJS.Zone
|
|
|
if (!string.IsNullOrEmpty(sceneAbility.NextScenePosition))
|
|
|
{
|
|
|
string[] pos = sceneAbility.NextScenePosition.Split(new Char[] { ',' });
|
|
|
- TVector2 posInfo = new TVector2((float)Convert.ToSingle(pos[0]), (float)Convert.ToSingle(pos[1]));
|
|
|
+ TVector2 posInfo = new TVector2((float)Convert.ToSingle(pos[0]), (float)Convert.ToSingle(pos[1]));
|
|
|
|
|
|
- _BornPlace.Put(sceneAbility.NextSceneID, posInfo);
|
|
|
- _BornPlaceExt.Put(decoration.Name, posInfo);
|
|
|
- }
|
|
|
+ _BornPlace.Put(sceneAbility.NextSceneID, posInfo);
|
|
|
+ _BornPlaceExt.Put(decoration.Name, posInfo);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
TVector2 ret;
|
|
|
- if(pointId != null && _BornPlaceExt.TryGetValue(pointId, out ret))
|
|
|
- {
|
|
|
- return ret;
|
|
|
- }
|
|
|
+ if (pointId != null && _BornPlaceExt.TryGetValue(pointId, out ret))
|
|
|
+ {
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
else if (_BornPlace.TryGetValue(areaId, out ret))
|
|
|
{
|
|
|
return ret;
|
|
@@ -195,13 +208,13 @@ namespace XmdsServerEdgeJS.Zone
|
|
|
if (obj is InstancePlayer)
|
|
|
{
|
|
|
string uuid = (obj as InstancePlayer).PlayerUUID;
|
|
|
- var eventParam = new
|
|
|
- {
|
|
|
- eventName = "interActiveItem",
|
|
|
- playerId = uuid,
|
|
|
- itemId = pickable.Info.TemplateID,
|
|
|
- x = obj.X,
|
|
|
- y = obj.Y
|
|
|
+ var eventParam = new
|
|
|
+ {
|
|
|
+ eventName = "interActiveItem",
|
|
|
+ playerId = uuid,
|
|
|
+ itemId = pickable.Info.TemplateID,
|
|
|
+ x = obj.X,
|
|
|
+ y = obj.Y
|
|
|
};
|
|
|
node.SendToGameServer(EventType.playerEvent.ToString(), eventParam);
|
|
|
}
|
|
@@ -218,14 +231,14 @@ namespace XmdsServerEdgeJS.Zone
|
|
|
|
|
|
if (dropitem != null)
|
|
|
{
|
|
|
- var eventParam = new
|
|
|
- {
|
|
|
- eventName = "pickItem",
|
|
|
- instanceId = zone.UUID,
|
|
|
- playerId = uuid,
|
|
|
- itemId = dropitem.ObjID,
|
|
|
- isGuard = player.IsGuard,
|
|
|
- objectId = item.Info.ID,
|
|
|
+ var eventParam = new
|
|
|
+ {
|
|
|
+ eventName = "pickItem",
|
|
|
+ instanceId = zone.UUID,
|
|
|
+ playerId = uuid,
|
|
|
+ itemId = dropitem.ObjID,
|
|
|
+ isGuard = player.IsGuard,
|
|
|
+ objectId = item.Info.ID,
|
|
|
//type = prop.ItemType,
|
|
|
//templateID = it.Info.TemplateID
|
|
|
};
|
|
@@ -233,20 +246,20 @@ namespace XmdsServerEdgeJS.Zone
|
|
|
//u.queueEvent(new UnitGotInstanceItemEvent(u.ID, this.ID));
|
|
|
}
|
|
|
else
|
|
|
- {
|
|
|
- dynamic eventParam = new
|
|
|
- {
|
|
|
- eventName = "interActiveItem",
|
|
|
- playerId = uuid,
|
|
|
- itemId = item.Info.TemplateID,
|
|
|
- objId = item.ID,
|
|
|
- type = prop.ItemType,
|
|
|
- isRemove = item.IsPickAll(),
|
|
|
- x = item.X,
|
|
|
- y = item.Y
|
|
|
- };
|
|
|
- node.SendToGameServer(EventType.playerEvent.ToString(), eventParam);
|
|
|
- }
|
|
|
+ {
|
|
|
+ dynamic eventParam = new
|
|
|
+ {
|
|
|
+ eventName = "interActiveItem",
|
|
|
+ playerId = uuid,
|
|
|
+ itemId = item.Info.TemplateID,
|
|
|
+ objId = item.ID,
|
|
|
+ type = prop.ItemType,
|
|
|
+ isRemove = item.IsPickAll(),
|
|
|
+ x = item.X,
|
|
|
+ y = item.Y
|
|
|
+ };
|
|
|
+ node.SendToGameServer(EventType.playerEvent.ToString(), eventParam);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -325,20 +338,20 @@ namespace XmdsServerEdgeJS.Zone
|
|
|
int tpID = obj.Info.TemplateID;
|
|
|
//击杀助攻列表.
|
|
|
List<string> atkAssistantList = null;
|
|
|
- if (type == 0 && obj is XmdsInstanceMonster)
|
|
|
- {
|
|
|
- tpID = (obj as XmdsInstanceMonster).MonsterID;
|
|
|
- if (tpID <= 0)
|
|
|
- {
|
|
|
- tpID = obj.Info.TemplateID;
|
|
|
- log.Info("zone_onUnitDead单位id异常:" + obj.Info.TemplateID + ", " + obj.Info.Name + ", obj: " + obj + ", " + zone.GetSceneID());
|
|
|
- }
|
|
|
- atkAssistantList = (obj.Virtual as XmdsVirtual).mHateSystem.GetAtkAssistantList();
|
|
|
- }
|
|
|
- else if(type == 1)
|
|
|
- {
|
|
|
- atkAssistantList = (obj.Virtual as XmdsVirtual).mHateSystem.GetAtkAssistantList();
|
|
|
- }
|
|
|
+ if (type == 0 && obj is XmdsInstanceMonster)
|
|
|
+ {
|
|
|
+ tpID = (obj as XmdsInstanceMonster).MonsterID;
|
|
|
+ if (tpID <= 0)
|
|
|
+ {
|
|
|
+ tpID = obj.Info.TemplateID;
|
|
|
+ log.Info("zone_onUnitDead单位id异常:" + obj.Info.TemplateID + ", " + obj.Info.Name + ", obj: " + obj + ", " + zone.GetSceneID());
|
|
|
+ }
|
|
|
+ atkAssistantList = (obj.Virtual as XmdsVirtual).mHateSystem.GetAtkAssistantList();
|
|
|
+ }
|
|
|
+ else if (type == 1)
|
|
|
+ {
|
|
|
+ atkAssistantList = (obj.Virtual as XmdsVirtual).mHateSystem.GetAtkAssistantList();
|
|
|
+ }
|
|
|
|
|
|
if (type != 2 && playerIds.Count == 0 && (atkAssistantList == null || atkAssistantList.Count == 0))
|
|
|
{
|
|
@@ -353,43 +366,43 @@ namespace XmdsServerEdgeJS.Zone
|
|
|
int aLevel = 0;
|
|
|
string aName = "";
|
|
|
string sceneType = "";
|
|
|
- if(attacker != null)
|
|
|
- {
|
|
|
- if (attacker is XmdsInstanceMonster)
|
|
|
- {
|
|
|
- MonsterVisibleDataB2C mvd = attacker.GenSyncUnitInfo().VisibleInfo as MonsterVisibleDataB2C;
|
|
|
- sceneType = (attacker.Virtual as XmdsVirtual).GetCurSceneType();
|
|
|
-
|
|
|
- aID = attacker.Info.TemplateID;
|
|
|
- aQColor = (int)mvd.Qcolor;
|
|
|
- aName = mvd.DisplayName;
|
|
|
- aLevel = attacker.GenSyncUnitInfo().Level;
|
|
|
- }
|
|
|
- else if (attacker.IsPlayerUnit && obj.IsMonster)
|
|
|
- {
|
|
|
- InstanceUnit attackerUnit = attacker.IsPet ? attacker.Virtual.GetMasterUnit() : attacker;
|
|
|
- if (attackerUnit != null)
|
|
|
- {
|
|
|
- attackerUnit.Virtual.DispatchKillOtherEvent(attackerUnit.Virtual, obj.Virtual);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- log.Warn("zone_onUnitDead: 找不到人形攻击者:" + attacker.Info.ID + ", " + zone.GetSceneID());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //连斩数计算
|
|
|
- if(zone is EditorScene)
|
|
|
- {
|
|
|
- EditorScene scene = zone as EditorScene;
|
|
|
- if(scene != null && scene.Data.killInterval > 0 && attacker != null)
|
|
|
- {
|
|
|
+ if (attacker != null)
|
|
|
+ {
|
|
|
+ if (attacker is XmdsInstanceMonster)
|
|
|
+ {
|
|
|
+ MonsterVisibleDataB2C mvd = attacker.GenSyncUnitInfo().VisibleInfo as MonsterVisibleDataB2C;
|
|
|
+ sceneType = (attacker.Virtual as XmdsVirtual).GetCurSceneType();
|
|
|
+
|
|
|
+ aID = attacker.Info.TemplateID;
|
|
|
+ aQColor = (int)mvd.Qcolor;
|
|
|
+ aName = mvd.DisplayName;
|
|
|
+ aLevel = attacker.GenSyncUnitInfo().Level;
|
|
|
+ }
|
|
|
+ else if (attacker.IsPlayerUnit && obj.IsMonster)
|
|
|
+ {
|
|
|
+ InstanceUnit attackerUnit = attacker.IsPet ? attacker.Virtual.GetMasterUnit() : attacker;
|
|
|
+ if (attackerUnit != null)
|
|
|
+ {
|
|
|
+ attackerUnit.Virtual.DispatchKillOtherEvent(attackerUnit.Virtual, obj.Virtual);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ log.Warn("zone_onUnitDead: 找不到人形攻击者:" + attacker.Info.ID + ", " + zone.GetSceneID());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //连斩数计算
|
|
|
+ if (zone is EditorScene)
|
|
|
+ {
|
|
|
+ EditorScene scene = zone as EditorScene;
|
|
|
+ if (scene != null && scene.Data.killInterval > 0 && attacker != null)
|
|
|
+ {
|
|
|
long curTime = CommonLang.CUtils.localTimeMS;
|
|
|
|
|
|
if (continueKillsValidTime < curTime && attacker.Statistic != null &&
|
|
|
- curTime - attacker.Statistic.preKillTime < scene.Data.killInterval)
|
|
|
- {
|
|
|
+ curTime - attacker.Statistic.preKillTime < scene.Data.killInterval)
|
|
|
+ {
|
|
|
attacker.updateContinueKills();
|
|
|
|
|
|
//如果连斩有上限,并且达到上限后有一定冷却时间
|
|
@@ -397,17 +410,17 @@ namespace XmdsServerEdgeJS.Zone
|
|
|
{
|
|
|
attacker.Statistic.continueKills = 0;
|
|
|
this.continueKillsValidTime = curTime + scene.Data.killMaxCoolTime * 1000;
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
attacker.resetContinueKills();
|
|
|
}
|
|
|
- attacker.Statistic.preKillTime = curTime;
|
|
|
- }
|
|
|
- }
|
|
|
+ attacker.Statistic.preKillTime = curTime;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- XmdsVirtual vir = (obj.Virtual as XmdsVirtual);
|
|
|
+ XmdsVirtual vir = (obj.Virtual as XmdsVirtual);
|
|
|
XmdsHateSystem zhs = vir.GetHateSystem() as XmdsHateSystem;
|
|
|
InstancePlayer belongPlayer = zhs.GetHeirs() as InstancePlayer;
|
|
|
//Console.Write("attacker objId:" + aID + " aQColor:" + aQColor + " aName " + aName + " aLevel " + aLevel);
|
|
@@ -443,13 +456,13 @@ namespace XmdsServerEdgeJS.Zone
|
|
|
|
|
|
if (obj.IsPlayer)
|
|
|
{
|
|
|
- log.Warn("玩家死亡:" + (obj == null ? "null" : obj.PlayerUUID)+ ", 攻击者:" +
|
|
|
+ log.Warn("玩家死亡:" + (obj == null ? "null" : obj.PlayerUUID) + ", 攻击者:" +
|
|
|
(attacker == null ? "null" : (attacker.PlayerUUID + ", " + attacker.Info.ID)) + ", Scene:" + zone.GetSceneID());
|
|
|
}
|
|
|
node.SendToGameServer(EventType.areaEvent.ToString(), eventParam);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- #endregion
|
|
|
- }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+ }
|
|
|
}
|