mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-10 14:34:32 +02:00
Merge branch 'ioncannon/quest_system' into Jorge/quest_system
This commit is contained in:
commit
4e5a07afa4
64 changed files with 429 additions and 526 deletions
|
@ -62,7 +62,7 @@ namespace Meteor.Map.Actors
|
|||
public uint actorId;
|
||||
public string actorName;
|
||||
|
||||
public uint displayNameId = 0xFFFFFFFF;
|
||||
public int displayNameId = -1;
|
||||
public string customDisplayName;
|
||||
|
||||
public ushort currentMainState = SetActorStatePacket.MAIN_STATE_PASSIVE;
|
||||
|
@ -74,12 +74,10 @@ namespace Meteor.Map.Actors
|
|||
public ushort moveState, oldMoveState;
|
||||
public float[] moveSpeeds = new float[4];
|
||||
|
||||
public uint zoneId, zoneId2;
|
||||
public string privateArea;
|
||||
public uint privateAreaType;
|
||||
public Area zone = null;
|
||||
public Area CurrentArea { set; get; }
|
||||
public bool IsZoneing { set; get; }
|
||||
|
||||
public Area zone2 = null;
|
||||
public bool isZoning = false;
|
||||
|
||||
public bool spawnedFirstTime = false;
|
||||
|
||||
|
@ -463,7 +461,7 @@ namespace Meteor.Map.Actors
|
|||
positionY = pos.Y;
|
||||
positionZ = pos.Z;
|
||||
|
||||
zone.UpdateActorPosition(this);
|
||||
CurrentArea.UpdateActorPosition(this);
|
||||
|
||||
//Program.Server.GetInstance().mLuaEngine.OnPath(actor, position, positionUpdates)
|
||||
}
|
||||
|
@ -495,7 +493,7 @@ namespace Meteor.Map.Actors
|
|||
|
||||
updateFlags = ActorUpdateFlags.None;
|
||||
}
|
||||
zone.BroadcastPacketsAroundActor(this, packets);
|
||||
CurrentArea.BroadcastPacketsAroundActor(this, packets);
|
||||
}
|
||||
|
||||
public void GenerateActorName(int actorNumber)
|
||||
|
@ -511,7 +509,7 @@ namespace Meteor.Map.Actors
|
|||
className = Char.ToLowerInvariant(className[0]) + className.Substring(1);
|
||||
|
||||
//Format Zone Name
|
||||
string zoneName = zone.zoneName.Replace("Field", "Fld")
|
||||
string zoneName = CurrentArea.ZoneName.Replace("Field", "Fld")
|
||||
.Replace("Dungeon", "Dgn")
|
||||
.Replace("Town", "Twn")
|
||||
.Replace("Battle", "Btl")
|
||||
|
@ -519,7 +517,7 @@ namespace Meteor.Map.Actors
|
|||
.Replace("Event", "Evt")
|
||||
.Replace("Ship", "Shp")
|
||||
.Replace("Office", "Ofc");
|
||||
if (zone is PrivateArea)
|
||||
if (CurrentArea is PrivateArea)
|
||||
{
|
||||
//Check if "normal"
|
||||
zoneName = zoneName.Remove(zoneName.Length - 1, 1) + "P";
|
||||
|
@ -537,10 +535,8 @@ namespace Meteor.Map.Actors
|
|||
string classNumber = Utils.ToStringBase63(actorNumber);
|
||||
|
||||
//Get stuff after @
|
||||
uint zoneId = zone.actorId;
|
||||
uint privLevel = 0;
|
||||
if (zone is PrivateArea)
|
||||
privLevel = ((PrivateArea)zone).GetPrivateAreaType();
|
||||
uint zoneId = CurrentArea.ZoneId;
|
||||
int privLevel = CurrentArea.GetPrivateAreaType();
|
||||
|
||||
actorName = String.Format("{0}_{1}_{2}@{3:X3}{4:X2}", className, zoneName, classNumber, zoneId, privLevel);
|
||||
}
|
||||
|
@ -629,13 +625,14 @@ namespace Meteor.Map.Actors
|
|||
#region positioning
|
||||
public List<float> GetPos()
|
||||
{
|
||||
List<float> pos = new List<float>();
|
||||
|
||||
pos.Add(positionX);
|
||||
pos.Add(positionY);
|
||||
pos.Add(positionZ);
|
||||
pos.Add(rotation);
|
||||
pos.Add(zoneId);
|
||||
List<float> pos = new List<float>
|
||||
{
|
||||
positionX,
|
||||
positionY,
|
||||
positionZ,
|
||||
rotation,
|
||||
CurrentArea.ZoneId
|
||||
};
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
@ -658,17 +655,7 @@ namespace Meteor.Map.Actors
|
|||
rotation = rot;
|
||||
|
||||
// todo: handle zone?
|
||||
zone.BroadcastPacketAroundActor(this, MoveActorToPositionPacket.BuildPacket(actorId, x, y, z, rot, moveState));
|
||||
}
|
||||
|
||||
public Area GetZone()
|
||||
{
|
||||
return zone;
|
||||
}
|
||||
|
||||
public uint GetZoneID()
|
||||
{
|
||||
return zoneId;
|
||||
CurrentArea.BroadcastPacketAroundActor(this, MoveActorToPositionPacket.BuildPacket(actorId, x, y, z, rot, moveState));
|
||||
}
|
||||
|
||||
public void LookAt(Actor actor)
|
||||
|
|
|
@ -34,8 +34,9 @@ namespace Meteor.Map.Actors
|
|||
{
|
||||
class Area : Actor
|
||||
{
|
||||
public string zoneName;
|
||||
public ushort regionId;
|
||||
public string ZoneName { get; private set; }
|
||||
public uint ZoneId { get; private set; }
|
||||
public ushort RegionId { get; private set; }
|
||||
public bool isIsolated, canStealth, isInn, canRideChocobo, isInstanceRaid;
|
||||
public ushort weatherNormal, weatherCommon, weatherRare;
|
||||
public ushort bgmDay, bgmNight, bgmBattle;
|
||||
|
@ -59,12 +60,13 @@ namespace Meteor.Map.Actors
|
|||
|
||||
LuaScript areaScript;
|
||||
|
||||
public Area(uint id, string zoneName, ushort regionId, string classPath, ushort bgmDay, ushort bgmNight, ushort bgmBattle, bool isIsolated, bool isInn, bool canRideChocobo, bool canStealth, bool isInstanceRaid)
|
||||
: base(id)
|
||||
public Area(uint zoneId, string zoneName, ushort regionId, string classPath, ushort bgmDay, ushort bgmNight, ushort bgmBattle, bool isIsolated, bool isInn, bool canRideChocobo, bool canStealth, bool isInstanceRaid)
|
||||
: base((4 << 28 | zoneId << 19 | ((uint)1)))
|
||||
{
|
||||
ZoneName = zoneName;
|
||||
ZoneId = zoneId;
|
||||
RegionId = regionId;
|
||||
|
||||
this.zoneName = zoneName;
|
||||
this.regionId = regionId;
|
||||
this.canStealth = canStealth;
|
||||
this.isIsolated = isIsolated;
|
||||
this.isInn = isInn;
|
||||
|
@ -77,7 +79,7 @@ namespace Meteor.Map.Actors
|
|||
|
||||
this.displayNameId = 0;
|
||||
this.customDisplayName = "_areaMaster";
|
||||
this.actorName = String.Format("_areaMaster@{0:X5}", id << 8);
|
||||
this.actorName = String.Format("_areaMaster@{0:X5}", zoneId << 8);
|
||||
|
||||
this.classPath = classPath;
|
||||
this.className = classPath.Substring(classPath.LastIndexOf("/") + 1);
|
||||
|
@ -97,10 +99,20 @@ namespace Meteor.Map.Actors
|
|||
}
|
||||
}
|
||||
|
||||
public virtual string GetPrivateAreaName()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public virtual int GetPrivateAreaType()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override SubPacket CreateScriptBindPacket()
|
||||
{
|
||||
List<LuaParam> lParams;
|
||||
lParams = LuaUtils.CreateLuaParamList(classPath, false, true, zoneName, "/Area/Zone/ZoneDefault", -1, (byte)1, true, false, false, false, false, false, false, false);
|
||||
lParams = LuaUtils.CreateLuaParamList(classPath, false, true, ZoneName, "/Area/Zone/ZoneDefault", -1, (byte)1, true, false, false, false, false, false, false, false);
|
||||
return ActorInstantiatePacket.BuildPacket(actorId, actorName, "ZoneDefault", lParams);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,32 +30,31 @@ namespace Meteor.Map.actors.area
|
|||
{
|
||||
class PrivateArea : Area
|
||||
{
|
||||
private Zone parentZone;
|
||||
private string privateAreaName;
|
||||
private uint privateAreaType;
|
||||
private readonly Zone ParentZone;
|
||||
private readonly string PrivateAreaName;
|
||||
private readonly int PrivateAreaType;
|
||||
|
||||
public PrivateArea(Zone parent, uint id, string classPath, string privateAreaName, uint privateAreaType, ushort bgmDay, ushort bgmNight, ushort bgmBattle)
|
||||
: base(id, parent.zoneName, parent.regionId, classPath, bgmDay, bgmNight, bgmBattle, parent.isIsolated, parent.isInn, parent.canRideChocobo, parent.canStealth, true)
|
||||
public PrivateArea(Zone parent, string classPath, string privateAreaName, int privateAreaType, ushort bgmDay, ushort bgmNight, ushort bgmBattle)
|
||||
: base(parent.ZoneId, parent.ZoneName, parent.RegionId, classPath, bgmDay, bgmNight, bgmBattle, parent.isIsolated, parent.isInn, parent.canRideChocobo, parent.canStealth, true)
|
||||
{
|
||||
this.parentZone = parent;
|
||||
this.zoneName = parent.zoneName;
|
||||
this.privateAreaName = privateAreaName;
|
||||
this.privateAreaType = privateAreaType;
|
||||
this.ParentZone = parent;
|
||||
this.PrivateAreaName = privateAreaName;
|
||||
this.PrivateAreaType = privateAreaType;
|
||||
}
|
||||
|
||||
public string GetPrivateAreaName()
|
||||
public override string GetPrivateAreaName()
|
||||
{
|
||||
return privateAreaName;
|
||||
return PrivateAreaName;
|
||||
}
|
||||
|
||||
public uint GetPrivateAreaType()
|
||||
public override int GetPrivateAreaType()
|
||||
{
|
||||
return privateAreaType;
|
||||
return PrivateAreaType;
|
||||
}
|
||||
|
||||
public Zone GetParentZone()
|
||||
{
|
||||
return parentZone;
|
||||
return ParentZone;
|
||||
}
|
||||
|
||||
public override SubPacket CreateScriptBindPacket()
|
||||
|
@ -66,7 +65,7 @@ namespace Meteor.Map.actors.area
|
|||
|
||||
string realClassName = className.Substring(className.LastIndexOf("/") + 1);
|
||||
|
||||
lParams = LuaUtils.CreateLuaParamList(classPath, false, true, zoneName, privateAreaName, privateAreaType, canRideChocobo ? (byte)1 : (byte)0, canStealth, isInn, false, false, false, false, false, false);
|
||||
lParams = LuaUtils.CreateLuaParamList(classPath, false, true, ZoneName, PrivateAreaName, PrivateAreaType, canRideChocobo ? (byte)1 : (byte)0, canStealth, isInn, false, false, false, false, false, false);
|
||||
ActorInstantiatePacket.BuildPacket(actorId, actorName, realClassName, lParams).DebugPrintSubPacket();
|
||||
return ActorInstantiatePacket.BuildPacket(actorId, actorName, realClassName, lParams);
|
||||
}
|
||||
|
|
|
@ -37,8 +37,8 @@ namespace Meteor.Map.actors.area
|
|||
return null;
|
||||
}
|
||||
|
||||
public PrivateAreaContent(Zone parent, string classPath, string privateAreaName, uint privateAreaType, Director director, Player contentStarter) //TODO: Make it a list
|
||||
: base(parent, parent.actorId, classPath, privateAreaName, privateAreaType, 0, 0, 0)
|
||||
public PrivateAreaContent(Zone parent, string classPath, string privateAreaName, int privateAreaType, Director director, Player contentStarter) //TODO: Make it a list
|
||||
: base(parent, classPath, privateAreaName, privateAreaType, 0, 0, 0)
|
||||
{
|
||||
currentDirector = director;
|
||||
LuaEngine.GetInstance().CallLuaFunction(contentStarter, this, "onCreate", false, currentDirector);
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace Meteor.Map.actors.area
|
|||
public string uniqueId;
|
||||
public uint zoneId;
|
||||
public string privAreaName;
|
||||
public uint privAreaLevel;
|
||||
public int privAreaLevel;
|
||||
public float x;
|
||||
public float y;
|
||||
public float z;
|
||||
|
@ -35,7 +35,7 @@ namespace Meteor.Map.actors.area
|
|||
public ushort state;
|
||||
public uint animId;
|
||||
|
||||
public SpawnLocation(uint classId, string uniqueId, uint zoneId, string privAreaName, uint privAreaLevel, float x, float y, float z, float rot, ushort state, uint animId)
|
||||
public SpawnLocation(uint classId, string uniqueId, uint zoneId, string privAreaName, int privAreaLevel, float x, float y, float z, float rot, ushort state, uint animId)
|
||||
{
|
||||
this.classId = classId;
|
||||
this.uniqueId = uniqueId;
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace Meteor.Map.actors.area
|
|||
{
|
||||
class Zone : Area
|
||||
{
|
||||
Dictionary<string, Dictionary<uint, PrivateArea>> privateAreas = new Dictionary<string, Dictionary<uint, PrivateArea>>();
|
||||
Dictionary<string, Dictionary<int, PrivateArea>> privateAreas = new Dictionary<string, Dictionary<int, PrivateArea>>();
|
||||
Dictionary<string, List<PrivateAreaContent>> contentAreas = new Dictionary<string, List<PrivateAreaContent>>();
|
||||
Object contentAreasLock = new Object();
|
||||
|
||||
|
@ -68,18 +68,20 @@ namespace Meteor.Map.actors.area
|
|||
privateAreas[pa.GetPrivateAreaName()][pa.GetPrivateAreaType()] = pa;
|
||||
else
|
||||
{
|
||||
privateAreas[pa.GetPrivateAreaName()] = new Dictionary<uint, PrivateArea>();
|
||||
privateAreas[pa.GetPrivateAreaName()][pa.GetPrivateAreaType()] = pa;
|
||||
privateAreas[pa.GetPrivateAreaName()] = new Dictionary<int, PrivateArea>
|
||||
{
|
||||
[pa.GetPrivateAreaType()] = pa
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public PrivateArea GetPrivateArea(string type, uint number)
|
||||
public PrivateArea GetPrivateArea(string name, int type)
|
||||
{
|
||||
if (privateAreas.ContainsKey(type))
|
||||
if (privateAreas.ContainsKey(name))
|
||||
{
|
||||
Dictionary<uint, PrivateArea> instances = privateAreas[type];
|
||||
if (instances.ContainsKey(number))
|
||||
return instances[number];
|
||||
Dictionary<int, PrivateArea> instances = privateAreas[name];
|
||||
if (instances.ContainsKey(type))
|
||||
return instances[type];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
@ -92,7 +94,7 @@ namespace Meteor.Map.actors.area
|
|||
bool isEntranceDesion = false;
|
||||
|
||||
List<LuaParam> lParams;
|
||||
lParams = LuaUtils.CreateLuaParamList(classPath, false, true, zoneName, "", -1, canRideChocobo ? (byte)1 : (byte)0, canStealth, isInn, false, false, false, true, isInstanceRaid, isEntranceDesion);
|
||||
lParams = LuaUtils.CreateLuaParamList(classPath, false, true, ZoneName, "", -1, canRideChocobo ? (byte)1 : (byte)0, canStealth, isInn, false, false, false, true, isInstanceRaid, isEntranceDesion);
|
||||
return ActorInstantiatePacket.BuildPacket(actorId, actorName, className, lParams);
|
||||
}
|
||||
|
||||
|
@ -103,14 +105,14 @@ namespace Meteor.Map.actors.area
|
|||
{
|
||||
if (privateAreas.ContainsKey(spawn.privAreaName))
|
||||
{
|
||||
Dictionary<uint, PrivateArea> levels = privateAreas[spawn.privAreaName];
|
||||
Dictionary<int, PrivateArea> levels = privateAreas[spawn.privAreaName];
|
||||
if (levels.ContainsKey(spawn.privAreaLevel))
|
||||
levels[spawn.privAreaLevel].AddSpawnLocation(spawn);
|
||||
else
|
||||
Program.Log.Error("Tried to add a spawn location to non-existing private area level \"{0}\" in area {1} in zone {2}", spawn.privAreaName, spawn.privAreaLevel, zoneName);
|
||||
Program.Log.Error("Tried to add a spawn location to non-existing private area level \"{0}\" in area {1} in zone {2}", spawn.privAreaName, spawn.privAreaLevel, ZoneName);
|
||||
}
|
||||
else
|
||||
Program.Log.Error("Tried to add a spawn location to non-existing private area \"{0}\" in zone {1}", spawn.privAreaName, zoneName);
|
||||
Program.Log.Error("Tried to add a spawn location to non-existing private area \"{0}\" in zone {1}", spawn.privAreaName, ZoneName);
|
||||
}
|
||||
else
|
||||
mSpawnLocations.Add(spawn);
|
||||
|
@ -123,7 +125,7 @@ namespace Meteor.Map.actors.area
|
|||
|
||||
if (doPrivAreas)
|
||||
{
|
||||
foreach (Dictionary<uint, PrivateArea> areas in privateAreas.Values)
|
||||
foreach (var areas in privateAreas.Values)
|
||||
{
|
||||
foreach (PrivateArea pa in areas.Values)
|
||||
pa.SpawnAllActors();
|
||||
|
@ -137,7 +139,7 @@ namespace Meteor.Map.actors.area
|
|||
{
|
||||
if (!mActorList.ContainsKey(id))
|
||||
{
|
||||
foreach (Dictionary<uint, PrivateArea> paList in privateAreas.Values)
|
||||
foreach (var paList in privateAreas.Values)
|
||||
{
|
||||
foreach (PrivateArea pa in paList.Values)
|
||||
{
|
||||
|
|
|
@ -335,7 +335,7 @@ namespace Meteor.Map.actors.chara.ai
|
|||
return false;
|
||||
}
|
||||
|
||||
if (target.zone != user.zone)
|
||||
if (target.CurrentArea != user.CurrentArea)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace Meteor.Map.actors.chara.ai.controllers
|
|||
contentGroupCharas = new List<Character>(owner.currentContentGroup.GetMemberCount());
|
||||
foreach (var charaId in owner.currentContentGroup.GetMembers())
|
||||
{
|
||||
var chara = owner.zone.FindActorInArea<Character>(charaId);
|
||||
var chara = owner.CurrentArea.FindActorInArea<Character>(charaId);
|
||||
|
||||
if (chara != null)
|
||||
contentGroupCharas.Add(chara);
|
||||
|
|
|
@ -98,7 +98,7 @@ namespace Meteor.Map.actors.chara.ai.controllers
|
|||
{
|
||||
if (!owner.neutral && owner.IsAlive())
|
||||
{
|
||||
foreach (var chara in owner.zone.GetActorsAroundActor<Character>(owner, 50))
|
||||
foreach (var chara in owner.CurrentArea.GetActorsAroundActor<Character>(owner, 50))
|
||||
{
|
||||
if (chara.allegiance == owner.allegiance)
|
||||
continue;
|
||||
|
@ -276,7 +276,7 @@ namespace Meteor.Map.actors.chara.ai.controllers
|
|||
{
|
||||
if (owner.target is Player)
|
||||
{
|
||||
foreach (var chara in owner.zone.GetActorsAroundActor<Character>(owner, 1))
|
||||
foreach (var chara in owner.CurrentArea.GetActorsAroundActor<Character>(owner, 1))
|
||||
{
|
||||
if (chara == owner)
|
||||
continue;
|
||||
|
@ -404,7 +404,7 @@ namespace Meteor.Map.actors.chara.ai.controllers
|
|||
|
||||
public virtual bool CanSeePoint(float x, float y, float z)
|
||||
{
|
||||
return NavmeshUtils.CanSee((Zone)owner.zone, owner.positionX, owner.positionY, owner.positionZ, x, y, z);
|
||||
return NavmeshUtils.CanSee((Zone)owner.CurrentArea, owner.positionX, owner.positionY, owner.positionZ, x, y, z);
|
||||
}
|
||||
|
||||
protected virtual void HandleHate()
|
||||
|
@ -420,7 +420,7 @@ namespace Meteor.Map.actors.chara.ai.controllers
|
|||
owner.currentLockedTarget = target?.actorId ?? Actor.INVALID_ACTORID;
|
||||
owner.currentTarget = target?.actorId ?? Actor.INVALID_ACTORID;
|
||||
|
||||
foreach (var player in owner.zone.GetActorsAroundActor<Player>(owner, 50))
|
||||
foreach (var player in owner.CurrentArea.GetActorsAroundActor<Player>(owner, 50))
|
||||
player.QueuePacket(owner.GetHateTypePacket(player));
|
||||
|
||||
base.ChangeTarget(target);
|
||||
|
|
|
@ -55,17 +55,17 @@ namespace Meteor.Map.actors.chara.ai
|
|||
{
|
||||
PreparePath(dest.X, dest.Y, dest.Z, stepSize, maxPath, polyRadius);
|
||||
}
|
||||
|
||||
//TODO: Verify pathfind with new area setup
|
||||
public void PreparePath(float x, float y, float z, float stepSize = 1.25f, int maxPath = 40, float polyRadius = 0.0f)
|
||||
{
|
||||
var pos = new Vector3(owner.positionX, owner.positionY, owner.positionZ);
|
||||
var dest = new Vector3(x, y, z);
|
||||
|
||||
Zone zone;
|
||||
if (owner.GetZone() is PrivateArea || owner.GetZone() is PrivateAreaContent)
|
||||
zone = (Zone)((PrivateArea)owner.GetZone()).GetParentZone();
|
||||
if (owner.CurrentArea is PrivateArea || owner.CurrentArea is PrivateAreaContent)
|
||||
zone = (Zone)((PrivateArea)owner.CurrentArea).GetParentZone();
|
||||
else
|
||||
zone = (Zone)owner.GetZone();
|
||||
zone = (Zone)owner.CurrentArea;
|
||||
|
||||
var sw = new System.Diagnostics.Stopwatch();
|
||||
sw.Start();
|
||||
|
|
|
@ -285,7 +285,7 @@ namespace Meteor.Map.actors.chara.ai
|
|||
{
|
||||
foreach (var actorId in party.members)
|
||||
{
|
||||
AddTarget(owner.zone.FindActorInArea<Character>(actorId), withPet);
|
||||
AddTarget(owner.CurrentArea.FindActorInArea<Character>(actorId), withPet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ namespace Meteor.Map.actors.chara.ai
|
|||
private void AddAllBattleNpcs(Character target, bool withPet)
|
||||
{
|
||||
int dist = (int)maxDistance;
|
||||
var actors = owner.zone.GetActorsAroundActor<BattleNpc>(target, dist);
|
||||
var actors = owner.CurrentArea.GetActorsAroundActor<BattleNpc>(target, dist);
|
||||
|
||||
foreach (BattleNpc actor in actors)
|
||||
{
|
||||
|
@ -309,7 +309,7 @@ namespace Meteor.Map.actors.chara.ai
|
|||
|
||||
private void AddAllInZone(Character target, bool withPet)
|
||||
{
|
||||
var actors = owner.zone.GetAllActors<Character>();
|
||||
var actors = owner.CurrentArea.GetAllActors<Character>();
|
||||
foreach (Character actor in actors)
|
||||
{
|
||||
AddTarget(actor, withPet);
|
||||
|
@ -319,7 +319,7 @@ namespace Meteor.Map.actors.chara.ai
|
|||
private void AddAllInRange(Character target, bool withPet)
|
||||
{
|
||||
int dist = (int)maxDistance;
|
||||
var actors = owner.zone.GetActorsAroundActor<Character>(target, dist);
|
||||
var actors = owner.CurrentArea.GetActorsAroundActor<Character>(target, dist);
|
||||
|
||||
foreach (Character actor in actors)
|
||||
{
|
||||
|
@ -408,7 +408,7 @@ namespace Meteor.Map.actors.chara.ai
|
|||
return false;
|
||||
}
|
||||
|
||||
if (/*target.isZoning || owner.isZoning || */target.zone != owner.zone)
|
||||
if (/*target.isZoning || owner.isZoning || */target.CurrentArea != owner.CurrentArea)
|
||||
return false;
|
||||
|
||||
if (validTarget == ValidTarget.Self && aoeType == TargetFindAOEType.None && owner != target)
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace Meteor.Map.actors.chara.ai.state
|
|||
public override bool Update(DateTime tick)
|
||||
{
|
||||
if ((target == null || owner.target != target || owner.target?.actorId != owner.currentLockedTarget) && owner.isAutoAttackEnabled)
|
||||
owner.aiContainer.ChangeTarget(target = owner.zone.FindActorInArea<Character>(owner.currentTarget));
|
||||
owner.aiContainer.ChangeTarget(target = owner.CurrentArea.FindActorInArea<Character>(owner.currentTarget));
|
||||
|
||||
if (target == null || target.IsDead())
|
||||
{
|
||||
|
@ -91,7 +91,7 @@ namespace Meteor.Map.actors.chara.ai.state
|
|||
// todo: send paralyzed/sleep message etc.
|
||||
if (errorResult != null)
|
||||
{
|
||||
owner.zone.BroadcastPacketAroundActor(owner, CommandResultX01Packet.BuildPacket(errorResult.targetId, errorResult.animation, 0x765D, errorResult));
|
||||
owner.CurrentArea.BroadcastPacketAroundActor(owner, CommandResultX01Packet.BuildPacket(errorResult.targetId, errorResult.animation, 0x765D, errorResult));
|
||||
errorResult = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -215,7 +215,7 @@ namespace Meteor.Map.Actors
|
|||
|
||||
ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("charaWork/currentContentGroup", this);
|
||||
propPacketUtil.AddProperty("charaWork.currentContentGroup");
|
||||
zone.BroadcastPacketsAroundActor(this, propPacketUtil.Done());
|
||||
CurrentArea.BroadcastPacketsAroundActor(this, propPacketUtil.Done());
|
||||
}
|
||||
|
||||
//This logic isn't correct, order of GetStatusEffects() is not necessarily the same as the actual effects in game. Also sending every time at once isn't needed
|
||||
|
@ -243,17 +243,17 @@ namespace Meteor.Map.Actors
|
|||
((Player)this).QueuePacket(PlayAnimationOnActorPacket.BuildPacket(actorId, animId));
|
||||
}
|
||||
else
|
||||
zone.BroadcastPacketAroundActor(this, PlayAnimationOnActorPacket.BuildPacket(actorId, animId));
|
||||
CurrentArea.BroadcastPacketAroundActor(this, PlayAnimationOnActorPacket.BuildPacket(actorId, animId));
|
||||
}
|
||||
|
||||
public void DoBattleAction(ushort commandId, uint animationId)
|
||||
{
|
||||
zone.BroadcastPacketAroundActor(this, CommandResultX00Packet.BuildPacket(actorId, animationId, commandId));
|
||||
CurrentArea.BroadcastPacketAroundActor(this, CommandResultX00Packet.BuildPacket(actorId, animationId, commandId));
|
||||
}
|
||||
|
||||
public void DoBattleAction(ushort commandId, uint animationId, CommandResult result)
|
||||
{
|
||||
zone.BroadcastPacketAroundActor(this, CommandResultX01Packet.BuildPacket(actorId, animationId, commandId, result));
|
||||
CurrentArea.BroadcastPacketAroundActor(this, CommandResultX01Packet.BuildPacket(actorId, animationId, commandId, result));
|
||||
}
|
||||
|
||||
public void DoBattleAction(ushort commandId, uint animationId, CommandResult[] results)
|
||||
|
@ -263,12 +263,12 @@ namespace Meteor.Map.Actors
|
|||
while (true)
|
||||
{
|
||||
if (results.Length - currentIndex >= 10)
|
||||
zone.BroadcastPacketAroundActor(this, CommandResultX18Packet.BuildPacket(actorId, animationId, commandId, results, ref currentIndex));
|
||||
CurrentArea.BroadcastPacketAroundActor(this, CommandResultX18Packet.BuildPacket(actorId, animationId, commandId, results, ref currentIndex));
|
||||
else if (results.Length - currentIndex > 1)
|
||||
zone.BroadcastPacketAroundActor(this, CommandResultX10Packet.BuildPacket(actorId, animationId, commandId, results, ref currentIndex));
|
||||
CurrentArea.BroadcastPacketAroundActor(this, CommandResultX10Packet.BuildPacket(actorId, animationId, commandId, results, ref currentIndex));
|
||||
else if (results.Length - currentIndex == 1)
|
||||
{
|
||||
zone.BroadcastPacketAroundActor(this, CommandResultX01Packet.BuildPacket(actorId, animationId, commandId, results[currentIndex]));
|
||||
CurrentArea.BroadcastPacketAroundActor(this, CommandResultX01Packet.BuildPacket(actorId, animationId, commandId, results[currentIndex]));
|
||||
currentIndex++;
|
||||
}
|
||||
else
|
||||
|
@ -283,12 +283,12 @@ namespace Meteor.Map.Actors
|
|||
while (true)
|
||||
{
|
||||
if (results.Count - currentIndex >= 10)
|
||||
zone.BroadcastPacketAroundActor(this, CommandResultX18Packet.BuildPacket(actorId, animationId, commandId, results, ref currentIndex));
|
||||
CurrentArea.BroadcastPacketAroundActor(this, CommandResultX18Packet.BuildPacket(actorId, animationId, commandId, results, ref currentIndex));
|
||||
else if (results.Count - currentIndex > 1)
|
||||
zone.BroadcastPacketAroundActor(this, CommandResultX10Packet.BuildPacket(actorId, animationId, commandId, results, ref currentIndex));
|
||||
CurrentArea.BroadcastPacketAroundActor(this, CommandResultX10Packet.BuildPacket(actorId, animationId, commandId, results, ref currentIndex));
|
||||
else if (results.Count - currentIndex == 1)
|
||||
{
|
||||
zone.BroadcastPacketAroundActor(this, CommandResultX01Packet.BuildPacket(actorId, animationId, commandId, results[currentIndex]));
|
||||
CurrentArea.BroadcastPacketAroundActor(this, CommandResultX01Packet.BuildPacket(actorId, animationId, commandId, results[currentIndex]));
|
||||
currentIndex++;
|
||||
}
|
||||
else
|
||||
|
@ -504,7 +504,7 @@ namespace Meteor.Map.Actors
|
|||
}
|
||||
//if (targid != 0)
|
||||
{
|
||||
aiContainer.Engage(zone.FindActorInArea<Character>(targid));
|
||||
aiContainer.Engage(CurrentArea.FindActorInArea<Character>(targid));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -535,19 +535,19 @@ namespace Meteor.Map.Actors
|
|||
public virtual void Cast(uint spellId, uint targetId = 0)
|
||||
{
|
||||
if (aiContainer.CanChangeState())
|
||||
aiContainer.Cast(zone.FindActorInArea<Character>(targetId == 0 ? currentTarget : targetId), spellId);
|
||||
aiContainer.Cast(CurrentArea.FindActorInArea<Character>(targetId == 0 ? currentTarget : targetId), spellId);
|
||||
}
|
||||
|
||||
public virtual void Ability(uint abilityId, uint targetId = 0)
|
||||
{
|
||||
if (aiContainer.CanChangeState())
|
||||
aiContainer.Ability(zone.FindActorInArea<Character>(targetId == 0 ? currentTarget : targetId), abilityId);
|
||||
aiContainer.Ability(CurrentArea.FindActorInArea<Character>(targetId == 0 ? currentTarget : targetId), abilityId);
|
||||
}
|
||||
|
||||
public virtual void WeaponSkill(uint skillId, uint targetId = 0)
|
||||
{
|
||||
if (aiContainer.CanChangeState())
|
||||
aiContainer.WeaponSkill(zone.FindActorInArea<Character>(targetId == 0 ? currentTarget : targetId), skillId);
|
||||
aiContainer.WeaponSkill(CurrentArea.FindActorInArea<Character>(targetId == 0 ? currentTarget : targetId), skillId);
|
||||
}
|
||||
|
||||
public virtual void Spawn(DateTime tick)
|
||||
|
@ -806,7 +806,7 @@ namespace Meteor.Map.Actors
|
|||
|
||||
foreach (CommandResult action in actions)
|
||||
{
|
||||
if (zone.FindActorInArea<Character>(action.targetId) is Character)
|
||||
if (CurrentArea.FindActorInArea<Character>(action.targetId) is Character)
|
||||
{
|
||||
//BattleUtils.HandleHitType(this, chara, action);
|
||||
//BattleUtils.DoAction(this, chara, action, DamageTakenType.Magic);
|
||||
|
@ -822,7 +822,7 @@ namespace Meteor.Map.Actors
|
|||
foreach (CommandResult action in actions)
|
||||
{
|
||||
//Should we just store the character insteado f having to find it again?
|
||||
if (zone.FindActorInArea<Character>(action.targetId) is Character)
|
||||
if (CurrentArea.FindActorInArea<Character>(action.targetId) is Character)
|
||||
{
|
||||
//BattleUtils.DoAction(this, chara, action, DamageTakenType.Weaponskill);
|
||||
}
|
||||
|
@ -835,7 +835,7 @@ namespace Meteor.Map.Actors
|
|||
{
|
||||
foreach (var action in actions)
|
||||
{
|
||||
if (zone.FindActorInArea<Character>(action.targetId) is Character)
|
||||
if (CurrentArea.FindActorInArea<Character>(action.targetId) is Character)
|
||||
{
|
||||
//BattleUtils.DoAction(this, chara, action, DamageTakenType.Ability);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace Meteor.Map.actors.chara.npc
|
|||
{
|
||||
public readonly uint actorClassId;
|
||||
public readonly string classPath;
|
||||
public readonly uint displayNameId;
|
||||
public readonly int displayNameId;
|
||||
public readonly uint propertyFlags;
|
||||
public readonly string eventConditions;
|
||||
|
||||
|
@ -33,7 +33,7 @@ namespace Meteor.Map.actors.chara.npc
|
|||
public readonly ushort pushCommandSub;
|
||||
public readonly byte pushCommandPriority;
|
||||
|
||||
public ActorClass(uint id, string classPath, uint nameId, uint propertyFlags, string eventConditions, ushort pushCommand, ushort pushCommandSub, byte pushCommandPriority)
|
||||
public ActorClass(uint id, string classPath, int nameId, uint propertyFlags, string eventConditions, ushort pushCommand, ushort pushCommandSub, byte pushCommandPriority)
|
||||
{
|
||||
this.actorClassId = id;
|
||||
this.classPath = classPath;
|
||||
|
|
|
@ -263,8 +263,8 @@ namespace Meteor.Map.Actors
|
|||
|
||||
this.isMovingToSpawn = false;
|
||||
this.hateContainer.ClearHate();
|
||||
zone.BroadcastPacketsAroundActor(this, GetSpawnPackets(null, 0x01));
|
||||
zone.BroadcastPacketsAroundActor(this, GetInitPackets());
|
||||
CurrentArea.BroadcastPacketsAroundActor(this, GetSpawnPackets(null, 0x01));
|
||||
CurrentArea.BroadcastPacketsAroundActor(this, GetInitPackets());
|
||||
RecalculateStats();
|
||||
|
||||
OnSpawn();
|
||||
|
@ -292,7 +292,7 @@ namespace Meteor.Map.Actors
|
|||
{
|
||||
foreach (var memberId in ((Party)lastAttacker.currentParty).members)
|
||||
{
|
||||
var partyMember = zone.FindActorInArea<Character>(memberId);
|
||||
var partyMember = CurrentArea.FindActorInArea<Character>(memberId);
|
||||
// onDeath(monster, player, killer)
|
||||
lua.LuaEngine.CallLuaBattleFunction(this, "onDeath", this, partyMember, lastAttacker);
|
||||
|
||||
|
@ -320,7 +320,7 @@ namespace Meteor.Map.Actors
|
|||
}
|
||||
else
|
||||
{
|
||||
var err = String.Format("[{0}][{1}] {2} {3} {4} {5} tried to die ded", actorId, GetUniqueId(), positionX, positionY, positionZ, GetZone().GetName());
|
||||
var err = String.Format("[{0}][{1}] {2} {3} {4} {5} tried to die ded", actorId, GetUniqueId(), positionX, positionY, positionZ, CurrentArea.GetName());
|
||||
Program.Log.Error(err);
|
||||
//throw new Exception(err);
|
||||
}
|
||||
|
@ -385,7 +385,7 @@ namespace Meteor.Map.Actors
|
|||
|
||||
if (GetMobMod((uint)MobModifier.SpellScript) != 0)
|
||||
foreach (var action in actions)
|
||||
lua.LuaEngine.CallLuaBattleFunction(this, "onCast", this, zone.FindActorInArea<Character>(action.targetId), ((MagicState)state).GetSpell(), action);
|
||||
lua.LuaEngine.CallLuaBattleFunction(this, "onCast", this, CurrentArea.FindActorInArea<Character>(action.targetId), ((MagicState)state).GetSpell(), action);
|
||||
}
|
||||
|
||||
public override void OnAbility(State state, CommandResult[] actions, BattleCommand ability, ref CommandResult[] errors)
|
||||
|
@ -405,7 +405,7 @@ namespace Meteor.Map.Actors
|
|||
|
||||
if (GetMobMod((uint)MobModifier.WeaponSkillScript) != 0)
|
||||
foreach (var action in actions)
|
||||
lua.LuaEngine.CallLuaBattleFunction(this, "onWeaponSkill", this, zone.FindActorInArea<Character>(action.targetId), ((WeaponSkillState)state).GetWeaponSkill(), action);
|
||||
lua.LuaEngine.CallLuaBattleFunction(this, "onWeaponSkill", this, CurrentArea.FindActorInArea<Character>(action.targetId), ((WeaponSkillState)state).GetWeaponSkill(), action);
|
||||
}
|
||||
|
||||
public override void OnSpawn()
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace Meteor.Map.Actors
|
|||
public NpcSpawnType npcSpawnType;
|
||||
|
||||
public Npc(int actorNumber, ActorClass actorClass, string uniqueId, Area spawnedArea, float posX, float posY, float posZ, float rot, ushort actorState, uint animationId, string customDisplayName)
|
||||
: base((4 << 28 | spawnedArea.actorId << 19 | (uint)actorNumber))
|
||||
: base((4 << 28 | spawnedArea.actorId << 19 | ((uint)actorNumber + 5)))
|
||||
{
|
||||
this.positionX = posX;
|
||||
this.positionY = posY;
|
||||
|
@ -72,8 +72,7 @@ namespace Meteor.Map.Actors
|
|||
|
||||
this.uniqueIdentifier = uniqueId;
|
||||
|
||||
this.zoneId = spawnedArea.actorId;
|
||||
this.zone = spawnedArea;
|
||||
CurrentArea = spawnedArea;
|
||||
|
||||
this.actorClassId = actorClass.actorClassId;
|
||||
|
||||
|
@ -133,8 +132,7 @@ namespace Meteor.Map.Actors
|
|||
|
||||
this.uniqueIdentifier = uniqueId;
|
||||
|
||||
this.zoneId = spawnedArea.actorId;
|
||||
this.zone = spawnedArea;
|
||||
CurrentArea = spawnedArea;
|
||||
|
||||
this.actorClassId = actorClass.actorClassId;
|
||||
|
||||
|
@ -298,7 +296,7 @@ namespace Meteor.Map.Actors
|
|||
public void ChangeNpcAppearance(uint id)
|
||||
{
|
||||
LoadNpcAppearance(id);
|
||||
zone.BroadcastPacketAroundActor(this, CreateAppearancePacket());
|
||||
CurrentArea.BroadcastPacketAroundActor(this, CreateAppearancePacket());
|
||||
}
|
||||
|
||||
public void LoadNpcAppearance(uint id)
|
||||
|
@ -431,7 +429,7 @@ namespace Meteor.Map.Actors
|
|||
|
||||
public void Despawn()
|
||||
{
|
||||
zone.DespawnActor(this);
|
||||
CurrentArea.DespawnActor(this);
|
||||
}
|
||||
|
||||
public override void Update(DateTime tick)
|
||||
|
@ -463,7 +461,7 @@ namespace Meteor.Map.Actors
|
|||
|
||||
public override void OnDespawn()
|
||||
{
|
||||
zone.BroadcastPacketAroundActor(this, RemoveActorPacket.BuildPacket(this.actorId));
|
||||
CurrentArea.BroadcastPacketAroundActor(this, RemoveActorPacket.BuildPacket(this.actorId));
|
||||
QueuePositionUpdate(spawnX, spawnY, spawnZ);
|
||||
LuaEngine.CallLuaBattleFunction(this, "onDespawn", this);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace Meteor.Map.actors.chara.npc
|
|||
private Player ownerPlayer;
|
||||
|
||||
public Retainer(uint retainerId, ActorClass actorClass, Player player, float posX, float posY, float posZ, float rot)
|
||||
: base(0, actorClass, "myretainer", player.GetZone(), posX, posY, posZ, rot, 0, 0, null)
|
||||
: base(0, actorClass, "myretainer", player.CurrentArea, posX, posY, posZ, rot, 0, 0, null)
|
||||
{
|
||||
this.retainerId = retainerId;
|
||||
this.ownerPlayer = player;
|
||||
|
|
|
@ -397,7 +397,7 @@ namespace Meteor.Map.Actors
|
|||
subpackets.Add(SetCurrentMountGoobbuePacket.BuildPacket(actorId, 1));
|
||||
|
||||
//Inn Packets (Dream, Cutscenes, Armoire)
|
||||
if (zone.isInn)
|
||||
if (CurrentArea.isInn)
|
||||
{
|
||||
SetCutsceneBookPacket cutsceneBookPacket = new SetCutsceneBookPacket();
|
||||
for (int i = 0; i < 2048; i++)
|
||||
|
@ -578,7 +578,7 @@ namespace Meteor.Map.Actors
|
|||
|
||||
public void SendSeamlessZoneInPackets()
|
||||
{
|
||||
QueuePacket(SetMusicPacket.BuildPacket(actorId, zone.bgmDay, SetMusicPacket.EFFECT_FADEIN));
|
||||
QueuePacket(SetMusicPacket.BuildPacket(actorId, CurrentArea.bgmDay, SetMusicPacket.EFFECT_FADEIN));
|
||||
QueuePacket(SetWeatherPacket.BuildPacket(actorId, SetWeatherPacket.WEATHER_CLEAR, 1));
|
||||
}
|
||||
|
||||
|
@ -601,11 +601,11 @@ namespace Meteor.Map.Actors
|
|||
}
|
||||
}
|
||||
else
|
||||
QueuePacket(SetMusicPacket.BuildPacket(actorId, zone.bgmDay, 0x01)); //Zone
|
||||
QueuePacket(SetMusicPacket.BuildPacket(actorId, CurrentArea.bgmDay, 0x01)); //Zone
|
||||
|
||||
QueuePacket(SetWeatherPacket.BuildPacket(actorId, SetWeatherPacket.WEATHER_CLEAR, 1));
|
||||
|
||||
QueuePacket(SetMapPacket.BuildPacket(actorId, zone.regionId, zone.actorId));
|
||||
QueuePacket(SetMapPacket.BuildPacket(actorId, CurrentArea.RegionId, CurrentArea.ZoneId));
|
||||
|
||||
QueuePackets(GetSpawnPackets(this, spawnType));
|
||||
|
||||
|
@ -623,7 +623,7 @@ namespace Meteor.Map.Actors
|
|||
|
||||
playerSession.QueuePacket(GetInitPackets());
|
||||
|
||||
List<SubPacket> areaMasterSpawn = zone.GetSpawnPackets();
|
||||
List<SubPacket> areaMasterSpawn = CurrentArea.GetSpawnPackets();
|
||||
List<SubPacket> debugSpawn = world.GetDebugActor().GetSpawnPackets();
|
||||
List<SubPacket> worldMasterSpawn = world.GetActor().GetSpawnPackets();
|
||||
|
||||
|
@ -631,9 +631,9 @@ namespace Meteor.Map.Actors
|
|||
playerSession.QueuePacket(debugSpawn);
|
||||
playerSession.QueuePacket(worldMasterSpawn);
|
||||
|
||||
if (zone.GetWeatherDirector() != null)
|
||||
if (CurrentArea.GetWeatherDirector() != null)
|
||||
{
|
||||
playerSession.QueuePacket(zone.GetWeatherDirector().GetSpawnPackets());
|
||||
playerSession.QueuePacket(CurrentArea.GetWeatherDirector().GetSpawnPackets());
|
||||
}
|
||||
|
||||
foreach (Director director in ownedDirectors)
|
||||
|
@ -758,7 +758,7 @@ namespace Meteor.Map.Actors
|
|||
|
||||
public void ChangeAnimation(uint animId)
|
||||
{
|
||||
Actor a = zone.FindActorInArea(currentTarget);
|
||||
Actor a = CurrentArea.FindActorInArea(currentTarget);
|
||||
if (a is Npc)
|
||||
((Npc)a).animationId = animId;
|
||||
}
|
||||
|
@ -783,7 +783,7 @@ namespace Meteor.Map.Actors
|
|||
playerSession.LockUpdates(true);
|
||||
|
||||
//Remove actor from zone and main server list
|
||||
zone.RemoveActorFromZone(this);
|
||||
CurrentArea.RemoveActorFromZone(this);
|
||||
|
||||
//Set Destination to 0
|
||||
this.destinationZone = 0;
|
||||
|
@ -810,7 +810,7 @@ namespace Meteor.Map.Actors
|
|||
playerSession.LockUpdates(true);
|
||||
|
||||
//Remove actor from zone and main server list
|
||||
zone.RemoveActorFromZone(this);
|
||||
CurrentArea.RemoveActorFromZone(this);
|
||||
|
||||
//Clean up parties
|
||||
RemoveFromCurrentPartyAndCleanup();
|
||||
|
@ -831,11 +831,6 @@ namespace Meteor.Map.Actors
|
|||
Database.SavePlayerStatusEffects(this);
|
||||
}
|
||||
|
||||
public Area GetZone()
|
||||
{
|
||||
return zone;
|
||||
}
|
||||
|
||||
public void SendMessage(uint logType, string sender, string message)
|
||||
{
|
||||
QueuePacket(SendMessagePacket.BuildPacket(actorId, logType, sender, message));
|
||||
|
@ -844,7 +839,7 @@ namespace Meteor.Map.Actors
|
|||
//Only use at logout since it's intensive
|
||||
private byte GetInnCode()
|
||||
{
|
||||
if (zone.isInn)
|
||||
if (CurrentArea.isInn)
|
||||
{
|
||||
Vector3 position = new Vector3(positionX, 0, positionZ);
|
||||
if (Utils.Distance(position, new Vector3(0, 0, 0)) <= 20f)
|
||||
|
@ -989,7 +984,7 @@ namespace Meteor.Map.Actors
|
|||
public void BroadcastWorldMessage(ushort worldMasterId, params object[] msgParams)
|
||||
{
|
||||
//SubPacket worldMasterMessage =
|
||||
//zone.BroadcastPacketAroundActor(this, worldMasterMessage);
|
||||
//CurrentArea.BroadcastPacketAroundActor(this, worldMasterMessage);
|
||||
}
|
||||
|
||||
public void GraphicChange(uint slot, uint graphicId)
|
||||
|
@ -1677,7 +1672,7 @@ namespace Meteor.Map.Actors
|
|||
{
|
||||
Quest defaultTalk = null;
|
||||
|
||||
switch (npc.zone.regionId)
|
||||
switch (npc.CurrentArea.RegionId)
|
||||
{
|
||||
case 101:
|
||||
defaultTalk = (Quest) Server.GetStaticActors("DftSea");
|
||||
|
@ -1971,8 +1966,8 @@ namespace Meteor.Map.Actors
|
|||
//Update Instance
|
||||
List<Actor> aroundMe = new List<Actor>();
|
||||
|
||||
if (zone != null)
|
||||
aroundMe.AddRange(zone.GetActorsAroundActor(this, 50));
|
||||
if (CurrentArea != null)
|
||||
aroundMe.AddRange(CurrentArea.GetActorsAroundActor(this, 50));
|
||||
if (zone2 != null)
|
||||
aroundMe.AddRange(zone2.GetActorsAroundActor(this, 50));
|
||||
playerSession.UpdateInstance(aroundMe, force);
|
||||
|
@ -2137,7 +2132,7 @@ namespace Meteor.Map.Actors
|
|||
{
|
||||
rentalExpireTime = 0;
|
||||
rentalMinLeft = 0;
|
||||
ChangeMusic(GetZone().bgmDay);
|
||||
ChangeMusic(CurrentArea.bgmDay);
|
||||
SetMountState(0);
|
||||
ChangeSpeed(0.0f, 2.0f, 5.0f, 5.0f);
|
||||
ChangeState(0);
|
||||
|
@ -2400,7 +2395,7 @@ namespace Meteor.Map.Actors
|
|||
public override void Cast(uint spellId, uint targetId = 0)
|
||||
{
|
||||
if (aiContainer.CanChangeState())
|
||||
aiContainer.Cast(zone.FindActorInArea<Character>(targetId == 0 ? currentTarget : targetId), spellId);
|
||||
aiContainer.Cast(CurrentArea.FindActorInArea<Character>(targetId == 0 ? currentTarget : targetId), spellId);
|
||||
else if (aiContainer.IsCurrentState<MagicState>())
|
||||
// You are already casting.
|
||||
SendGameMessage(Server.GetWorldManager().GetActor(), 32536, 0x20);
|
||||
|
@ -2412,7 +2407,7 @@ namespace Meteor.Map.Actors
|
|||
public override void Ability(uint abilityId, uint targetId = 0)
|
||||
{
|
||||
if (aiContainer.CanChangeState())
|
||||
aiContainer.Ability(zone.FindActorInArea<Character>(targetId == 0 ? currentTarget : targetId), abilityId);
|
||||
aiContainer.Ability(CurrentArea.FindActorInArea<Character>(targetId == 0 ? currentTarget : targetId), abilityId);
|
||||
else
|
||||
// Please wait a moment and try again.
|
||||
SendGameMessage(Server.GetWorldManager().GetActor(), 32535, 0x20);
|
||||
|
@ -2421,7 +2416,7 @@ namespace Meteor.Map.Actors
|
|||
public override void WeaponSkill(uint skillId, uint targetId = 0)
|
||||
{
|
||||
if (aiContainer.CanChangeState())
|
||||
aiContainer.WeaponSkill(zone.FindActorInArea<Character>(targetId == 0 ? currentTarget : targetId), skillId);
|
||||
aiContainer.WeaponSkill(CurrentArea.FindActorInArea<Character>(targetId == 0 ? currentTarget : targetId), skillId);
|
||||
else
|
||||
// Please wait a moment and try again.
|
||||
SendGameMessage(Server.GetWorldManager().GetActor(), 32535, 0x20);
|
||||
|
|
|
@ -46,11 +46,10 @@ namespace Meteor.Map.actors.director
|
|||
private Coroutine currentCoroutine;
|
||||
|
||||
public Director(uint id, Area zone, string directorPath, bool hasContentGroup, params object[] args)
|
||||
: base((6 << 28 | zone.actorId << 19 | (uint)id))
|
||||
: base((6 << 28 | zone.CurrentArea.ZoneId << 19 | (uint)id))
|
||||
{
|
||||
directorId = id;
|
||||
this.zone = zone;
|
||||
this.zoneId = zone.actorId;
|
||||
CurrentArea = zone;
|
||||
directorScriptPath = directorPath;
|
||||
|
||||
LoadLuaScript();
|
||||
|
@ -172,7 +171,7 @@ namespace Meteor.Map.actors.director
|
|||
((Player)player).RemoveDirector(this);
|
||||
members.Clear();
|
||||
isDeleted = true;
|
||||
Server.GetWorldManager().GetZone(zoneId).DeleteDirector(actorId);
|
||||
Server.GetWorldManager().GetArea(CurrentArea.ZoneId).DeleteDirector(actorId);
|
||||
}
|
||||
|
||||
public void AddMember(Actor actor)
|
||||
|
@ -242,7 +241,7 @@ namespace Meteor.Map.actors.director
|
|||
className = Char.ToLowerInvariant(className[0]) + className.Substring(1);
|
||||
|
||||
//Format Zone Name
|
||||
string zoneName = zone.zoneName.Replace("Field", "Fld")
|
||||
string zoneName = CurrentArea.ZoneName.Replace("Field", "Fld")
|
||||
.Replace("Dungeon", "Dgn")
|
||||
.Replace("Town", "Twn")
|
||||
.Replace("Battle", "Btl")
|
||||
|
@ -250,7 +249,7 @@ namespace Meteor.Map.actors.director
|
|||
.Replace("Event", "Evt")
|
||||
.Replace("Ship", "Shp")
|
||||
.Replace("Office", "Ofc");
|
||||
if (zone is PrivateArea)
|
||||
if (CurrentArea is PrivateArea)
|
||||
{
|
||||
//Check if "normal"
|
||||
zoneName = zoneName.Remove(zoneName.Length - 1, 1) + "P";
|
||||
|
@ -268,10 +267,8 @@ namespace Meteor.Map.actors.director
|
|||
string classNumber = Utils.ToStringBase63(actorNumber);
|
||||
|
||||
//Get stuff after @
|
||||
uint zoneId = zone.actorId;
|
||||
uint privLevel = 0;
|
||||
if (zone is PrivateArea)
|
||||
privLevel = ((PrivateArea)zone).GetPrivateAreaType();
|
||||
uint zoneId = CurrentArea.ZoneId;
|
||||
int privLevel = CurrentArea.GetPrivateAreaType();
|
||||
|
||||
actorName = String.Format("{0}_{1}_{2}@{3:X3}{4:X2}", className, zoneName, classNumber, zoneId, privLevel);
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ namespace Meteor.Map.actors.director
|
|||
|
||||
if (wasCompleted)
|
||||
{
|
||||
Npc aetheryteNode = zone.SpawnActor(1200040, String.Format("{0}:warpExit", guildleveOwner.actorName), guildleveOwner.positionX, guildleveOwner.positionY, guildleveOwner.positionZ);
|
||||
Npc aetheryteNode = CurrentArea.SpawnActor(1200040, String.Format("{0}:warpExit", guildleveOwner.actorName), guildleveOwner.positionX, guildleveOwner.positionY, guildleveOwner.positionZ);
|
||||
AddMember(aetheryteNode);
|
||||
|
||||
foreach (Actor a in GetPlayerMembers())
|
||||
|
@ -168,7 +168,7 @@ namespace Meteor.Map.actors.director
|
|||
foreach (Actor p in GetPlayerMembers())
|
||||
{
|
||||
Player player = (Player)p;
|
||||
player.ChangeMusic(player.GetZone().bgmDay);
|
||||
player.ChangeMusic(player.CurrentArea.bgmDay);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -119,26 +119,26 @@ namespace Meteor.Map.actors.group
|
|||
ulong time = Utils.MilisUnixTimeStampUTC();
|
||||
List<GroupMember> members = BuildMemberList(session.id);
|
||||
|
||||
session.QueuePacket(GroupHeaderPacket.buildPacket(session.id, session.GetActor().zoneId, time, this));
|
||||
session.QueuePacket(GroupMembersBeginPacket.buildPacket(session.id, session.GetActor().zoneId, time, this));
|
||||
session.QueuePacket(GroupHeaderPacket.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, this));
|
||||
session.QueuePacket(GroupMembersBeginPacket.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, this));
|
||||
|
||||
int currentIndex = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (GetMemberCount() - currentIndex >= 64)
|
||||
session.QueuePacket(ContentMembersX64Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex));
|
||||
session.QueuePacket(ContentMembersX64Packet.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, members, ref currentIndex));
|
||||
else if (GetMemberCount() - currentIndex >= 32)
|
||||
session.QueuePacket(ContentMembersX32Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex));
|
||||
session.QueuePacket(ContentMembersX32Packet.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, members, ref currentIndex));
|
||||
else if (GetMemberCount() - currentIndex >= 16)
|
||||
session.QueuePacket(ContentMembersX16Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex));
|
||||
session.QueuePacket(ContentMembersX16Packet.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, members, ref currentIndex));
|
||||
else if (GetMemberCount() - currentIndex > 0)
|
||||
session.QueuePacket(ContentMembersX08Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex));
|
||||
session.QueuePacket(ContentMembersX08Packet.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, members, ref currentIndex));
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
session.QueuePacket(GroupMembersEndPacket.buildPacket(session.id, session.GetActor().zoneId, time, this));
|
||||
session.QueuePacket(GroupMembersEndPacket.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, this));
|
||||
}
|
||||
|
||||
public override uint GetTypeId()
|
||||
|
@ -160,7 +160,7 @@ namespace Meteor.Map.actors.group
|
|||
Session s = Server.GetServer().GetSession(members[i]);
|
||||
if (s != null)
|
||||
s.GetActor().SetCurrentContentGroup(null);
|
||||
Actor a = director.GetZone().FindActorInArea(members[i]);
|
||||
Actor a = director.CurrentArea.FindActorInArea(members[i]);
|
||||
if (a is Npc)
|
||||
((Npc)a).Despawn();
|
||||
members.Remove(members[i]);
|
||||
|
|
|
@ -141,8 +141,8 @@ namespace Meteor.Map.actors.group
|
|||
ulong time = Utils.MilisUnixTimeStampUTC();
|
||||
List<GroupMember> members = BuildMemberList(session.id);
|
||||
|
||||
session.QueuePacket(GroupHeaderPacket.buildPacket(session.id, session.GetActor().zoneId, time, this));
|
||||
session.QueuePacket(GroupMembersBeginPacket.buildPacket(session.id, session.GetActor().zoneId, time, this));
|
||||
session.QueuePacket(GroupHeaderPacket.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, this));
|
||||
session.QueuePacket(GroupMembersBeginPacket.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, this));
|
||||
|
||||
int currentIndex = 0;
|
||||
|
||||
|
@ -150,18 +150,18 @@ namespace Meteor.Map.actors.group
|
|||
{
|
||||
int memberCount = Math.Min(GetMemberCount(), members.Count);
|
||||
if (memberCount - currentIndex >= 64)
|
||||
session.QueuePacket(GroupMembersX64Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex));
|
||||
session.QueuePacket(GroupMembersX64Packet.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, members, ref currentIndex));
|
||||
else if (memberCount - currentIndex >= 32)
|
||||
session.QueuePacket(GroupMembersX32Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex));
|
||||
session.QueuePacket(GroupMembersX32Packet.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, members, ref currentIndex));
|
||||
else if (memberCount - currentIndex >= 16)
|
||||
session.QueuePacket(GroupMembersX16Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex));
|
||||
session.QueuePacket(GroupMembersX16Packet.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, members, ref currentIndex));
|
||||
else if (memberCount - currentIndex > 0)
|
||||
session.QueuePacket(GroupMembersX08Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex));
|
||||
session.QueuePacket(GroupMembersX08Packet.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, members, ref currentIndex));
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
session.QueuePacket(GroupMembersEndPacket.buildPacket(session.id, session.GetActor().zoneId, time, this));
|
||||
session.QueuePacket(GroupMembersEndPacket.buildPacket(session.id, session.GetActor().CurrentArea.ZoneId, time, this));
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue