mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
add some more locks, fixed typo in AddHP, add missing ability
This commit is contained in:
parent
c79b5c9992
commit
54af893570
@ -113,51 +113,54 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
{
|
{
|
||||||
if (!mActorList.ContainsKey(actor.actorId))
|
if (!mActorList.ContainsKey(actor.actorId))
|
||||||
mActorList.Add(actor.actorId, actor);
|
mActorList.Add(actor.actorId, actor);
|
||||||
|
|
||||||
|
|
||||||
|
int gridX = (int)actor.positionX / boundingGridSize;
|
||||||
|
int gridY = (int)actor.positionZ / boundingGridSize;
|
||||||
|
|
||||||
|
gridX += halfWidth;
|
||||||
|
gridY += halfHeight;
|
||||||
|
|
||||||
|
//Boundries
|
||||||
|
if (gridX < 0)
|
||||||
|
gridX = 0;
|
||||||
|
if (gridX >= numXBlocks)
|
||||||
|
gridX = numXBlocks - 1;
|
||||||
|
if (gridY < 0)
|
||||||
|
gridY = 0;
|
||||||
|
if (gridY >= numYBlocks)
|
||||||
|
gridY = numYBlocks - 1;
|
||||||
|
|
||||||
|
lock (mActorBlock)
|
||||||
|
mActorBlock[gridX, gridY].Add(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
int gridX = (int)actor.positionX / boundingGridSize;
|
|
||||||
int gridY = (int)actor.positionZ / boundingGridSize;
|
|
||||||
|
|
||||||
gridX += halfWidth;
|
|
||||||
gridY += halfHeight;
|
|
||||||
|
|
||||||
//Boundries
|
|
||||||
if (gridX < 0)
|
|
||||||
gridX = 0;
|
|
||||||
if (gridX >= numXBlocks)
|
|
||||||
gridX = numXBlocks - 1;
|
|
||||||
if (gridY < 0)
|
|
||||||
gridY = 0;
|
|
||||||
if (gridY >= numYBlocks)
|
|
||||||
gridY = numYBlocks - 1;
|
|
||||||
|
|
||||||
lock (mActorBlock)
|
|
||||||
mActorBlock[gridX, gridY].Add(actor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveActorFromZone(Actor actor)
|
public void RemoveActorFromZone(Actor actor)
|
||||||
{
|
{
|
||||||
lock (mActorList)
|
lock (mActorList)
|
||||||
|
{
|
||||||
mActorList.Remove(actor.actorId);
|
mActorList.Remove(actor.actorId);
|
||||||
|
|
||||||
int gridX = (int)actor.positionX / boundingGridSize;
|
int gridX = (int)actor.positionX / boundingGridSize;
|
||||||
int gridY = (int)actor.positionZ / boundingGridSize;
|
int gridY = (int)actor.positionZ / boundingGridSize;
|
||||||
|
|
||||||
gridX += halfWidth;
|
gridX += halfWidth;
|
||||||
gridY += halfHeight;
|
gridY += halfHeight;
|
||||||
|
|
||||||
//Boundries
|
//Boundries
|
||||||
if (gridX < 0)
|
if (gridX < 0)
|
||||||
gridX = 0;
|
gridX = 0;
|
||||||
if (gridX >= numXBlocks)
|
if (gridX >= numXBlocks)
|
||||||
gridX = numXBlocks - 1;
|
gridX = numXBlocks - 1;
|
||||||
if (gridY < 0)
|
if (gridY < 0)
|
||||||
gridY = 0;
|
gridY = 0;
|
||||||
if (gridY >= numYBlocks)
|
if (gridY >= numYBlocks)
|
||||||
gridY = numYBlocks - 1;
|
gridY = numYBlocks - 1;
|
||||||
|
|
||||||
lock (mActorBlock)
|
lock (mActorBlock)
|
||||||
mActorBlock[gridX, gridY].Remove(actor);
|
mActorBlock[gridX, gridY].Remove(actor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateActorPosition(Actor actor)
|
public void UpdateActorPosition(Actor actor)
|
||||||
@ -421,75 +424,84 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
|
|
||||||
public void SpawnActor(SpawnLocation location)
|
public void SpawnActor(SpawnLocation location)
|
||||||
{
|
{
|
||||||
ActorClass actorClass = Server.GetWorldManager().GetActorClass(location.classId);
|
lock (mActorList)
|
||||||
|
{
|
||||||
|
ActorClass actorClass = Server.GetWorldManager().GetActorClass(location.classId);
|
||||||
|
|
||||||
if (actorClass == null)
|
if (actorClass == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint zoneId;
|
uint zoneId;
|
||||||
|
|
||||||
if (this is PrivateArea)
|
if (this is PrivateArea)
|
||||||
zoneId = ((PrivateArea)this).GetParentZone().actorId;
|
zoneId = ((PrivateArea)this).GetParentZone().actorId;
|
||||||
else
|
else
|
||||||
zoneId = actorId;
|
zoneId = actorId;
|
||||||
|
|
||||||
Npc npc = new Npc(mActorList.Count + 1, actorClass, location.uniqueId, this, location.x, location.y, location.z, location.rot, location.state, location.animId, null);
|
Npc npc = new Npc(mActorList.Count + 1, actorClass, location.uniqueId, this, location.x, location.y, location.z, location.rot, location.state, location.animId, null);
|
||||||
|
|
||||||
|
|
||||||
npc.LoadEventConditions(actorClass.eventConditions);
|
npc.LoadEventConditions(actorClass.eventConditions);
|
||||||
|
|
||||||
AddActorToZone(npc);
|
AddActorToZone(npc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Npc SpawnActor(uint classId, string uniqueId, float x, float y, float z, float rot = 0, ushort state = 0, uint animId = 0, bool isMob = true)
|
public Npc SpawnActor(uint classId, string uniqueId, float x, float y, float z, float rot = 0, ushort state = 0, uint animId = 0, bool isMob = true)
|
||||||
{
|
{
|
||||||
ActorClass actorClass = Server.GetWorldManager().GetActorClass(classId);
|
lock (mActorList)
|
||||||
|
{
|
||||||
|
ActorClass actorClass = Server.GetWorldManager().GetActorClass(classId);
|
||||||
|
|
||||||
if (actorClass == null)
|
if (actorClass == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
uint zoneId;
|
uint zoneId;
|
||||||
|
|
||||||
if (this is PrivateArea)
|
if (this is PrivateArea)
|
||||||
zoneId = ((PrivateArea)this).GetParentZone().actorId;
|
zoneId = ((PrivateArea)this).GetParentZone().actorId;
|
||||||
else
|
else
|
||||||
zoneId = actorId;
|
zoneId = actorId;
|
||||||
|
|
||||||
Npc npc;
|
Npc npc;
|
||||||
|
|
||||||
if(isMob)
|
if (isMob)
|
||||||
npc = new BattleNpc(mActorList.Count + 1, actorClass, uniqueId, this, x, y, z, rot, state, animId, null);
|
npc = new BattleNpc(mActorList.Count + 1, actorClass, uniqueId, this, x, y, z, rot, state, animId, null);
|
||||||
else
|
else
|
||||||
npc = new Npc(mActorList.Count + 1, actorClass, uniqueId, this, x, y, z, rot, state, animId, null);
|
npc = new Npc(mActorList.Count + 1, actorClass, uniqueId, this, x, y, z, rot, state, animId, null);
|
||||||
|
|
||||||
npc.LoadEventConditions(actorClass.eventConditions);
|
npc.LoadEventConditions(actorClass.eventConditions);
|
||||||
|
|
||||||
AddActorToZone(npc);
|
AddActorToZone(npc);
|
||||||
|
|
||||||
return npc;
|
return npc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Npc SpawnActor(uint classId, string uniqueId, float x, float y, float z, uint regionId, uint layoutId)
|
public Npc SpawnActor(uint classId, string uniqueId, float x, float y, float z, uint regionId, uint layoutId)
|
||||||
{
|
{
|
||||||
ActorClass actorClass = Server.GetWorldManager().GetActorClass(classId);
|
lock (mActorList)
|
||||||
|
{
|
||||||
|
ActorClass actorClass = Server.GetWorldManager().GetActorClass(classId);
|
||||||
|
|
||||||
if (actorClass == null)
|
if (actorClass == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
uint zoneId;
|
uint zoneId;
|
||||||
|
|
||||||
if (this is PrivateArea)
|
if (this is PrivateArea)
|
||||||
zoneId = ((PrivateArea)this).GetParentZone().actorId;
|
zoneId = ((PrivateArea)this).GetParentZone().actorId;
|
||||||
else
|
else
|
||||||
zoneId = actorId;
|
zoneId = actorId;
|
||||||
|
|
||||||
Npc npc = new Npc(mActorList.Count + 1, actorClass, uniqueId, this, x, y, z, 0, regionId, layoutId);
|
Npc npc = new Npc(mActorList.Count + 1, actorClass, uniqueId, this, x, y, z, 0, regionId, layoutId);
|
||||||
|
|
||||||
npc.LoadEventConditions(actorClass.eventConditions);
|
npc.LoadEventConditions(actorClass.eventConditions);
|
||||||
|
|
||||||
AddActorToZone(npc);
|
AddActorToZone(npc);
|
||||||
|
|
||||||
return npc;
|
return npc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DespawnActor(string uniqueId)
|
public void DespawnActor(string uniqueId)
|
||||||
|
@ -40,16 +40,19 @@ namespace FFXIVClassic_Map_Server.actors.area
|
|||||||
|
|
||||||
public void CheckDestroy()
|
public void CheckDestroy()
|
||||||
{
|
{
|
||||||
if (isContentFinished)
|
lock (mActorList)
|
||||||
{
|
{
|
||||||
bool noPlayersLeft = true;
|
if (isContentFinished)
|
||||||
foreach (Actor a in mActorList.Values)
|
|
||||||
{
|
{
|
||||||
if (a is Player)
|
bool noPlayersLeft = true;
|
||||||
noPlayersLeft = false;
|
foreach (Actor a in mActorList.Values)
|
||||||
|
{
|
||||||
|
if (a is Player)
|
||||||
|
noPlayersLeft = false;
|
||||||
|
}
|
||||||
|
if (noPlayersLeft)
|
||||||
|
GetParentZone().DeleteContentArea(this);
|
||||||
}
|
}
|
||||||
if (noPlayersLeft)
|
|
||||||
GetParentZone().DeleteContentArea(this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,21 +119,24 @@ namespace FFXIVClassic_Map_Server.actors.area
|
|||||||
|
|
||||||
public Actor FindActorInZone(uint id)
|
public Actor FindActorInZone(uint id)
|
||||||
{
|
{
|
||||||
if (!mActorList.ContainsKey(id))
|
lock (mActorList)
|
||||||
{
|
{
|
||||||
foreach(Dictionary<uint, PrivateArea> paList in privateAreas.Values)
|
if (!mActorList.ContainsKey(id))
|
||||||
{
|
{
|
||||||
foreach(PrivateArea pa in paList.Values)
|
foreach (Dictionary<uint, PrivateArea> paList in privateAreas.Values)
|
||||||
{
|
{
|
||||||
Actor actor = pa.FindActorInArea(id);
|
foreach (PrivateArea pa in paList.Values)
|
||||||
if (actor != null)
|
{
|
||||||
return actor;
|
Actor actor = pa.FindActorInArea(id);
|
||||||
|
if (actor != null)
|
||||||
|
return actor;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
return null;
|
else
|
||||||
|
return mActorList[id];
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return mActorList[id];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PrivateAreaContent CreateContentArea(Player starterPlayer, string areaClassPath, string contentScript, string areaName, string directorName, params object[] args)
|
public PrivateAreaContent CreateContentArea(Player starterPlayer, string areaClassPath, string contentScript, string areaName, string directorName, params object[] args)
|
||||||
|
@ -213,26 +213,9 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
if ((updateFlags & ActorUpdateFlags.HpTpMp) != 0)
|
if ((updateFlags & ActorUpdateFlags.HpTpMp) != 0)
|
||||||
{
|
{
|
||||||
var propPacketUtil = new ActorPropertyPacketUtil("charaWork.parameterSave", this);
|
var propPacketUtil = new ActorPropertyPacketUtil("charaWork.parameterSave", this);
|
||||||
|
|
||||||
//Parameters
|
|
||||||
|
|
||||||
propPacketUtil.AddProperty("charaWork.parameterSave.hp[0]");
|
|
||||||
propPacketUtil.AddProperty("charaWork.parameterSave.hpMax[0]");
|
|
||||||
propPacketUtil.AddProperty("charaWork.parameterSave.mp");
|
propPacketUtil.AddProperty("charaWork.parameterSave.mp");
|
||||||
propPacketUtil.AddProperty("charaWork.parameterSave.mpMax");
|
propPacketUtil.AddProperty("charaWork.parameterSave.mpMax");
|
||||||
propPacketUtil.AddProperty("charaWork.parameterTemp.tp");
|
propPacketUtil.AddProperty("charaWork.parameterTemp.tp");
|
||||||
propPacketUtil.AddProperty("charaWork.parameterSave.state_mainSkill[0]");
|
|
||||||
propPacketUtil.AddProperty("charaWork.parameterSave.state_mainSkillLevel");
|
|
||||||
|
|
||||||
//General Parameters
|
|
||||||
for (int i = 3; i < charaWork.battleTemp.generalParameter.Length; i++)
|
|
||||||
{
|
|
||||||
if (charaWork.battleTemp.generalParameter[i] != 0)
|
|
||||||
propPacketUtil.AddProperty(String.Format("charaWork.battleTemp.generalParameter[{0}]", i));
|
|
||||||
}
|
|
||||||
|
|
||||||
propPacketUtil.AddProperty("charaWork.battleTemp.castGauge_speed[0]");
|
|
||||||
propPacketUtil.AddProperty("charaWork.battleTemp.castGauge_speed[1]");
|
|
||||||
packets.AddRange(propPacketUtil.Done());
|
packets.AddRange(propPacketUtil.Done());
|
||||||
}
|
}
|
||||||
base.PostUpdate(tick, packets);
|
base.PostUpdate(tick, packets);
|
||||||
|
@ -97,7 +97,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
|||||||
if (target is Player)
|
if (target is Player)
|
||||||
((Player)target).SendPacket("139_attack");
|
((Player)target).SendPacket("139_attack");
|
||||||
}
|
}
|
||||||
target.AddHP((short)damage);
|
target.DelHP((short)damage);
|
||||||
attackTime = attackTime.AddMilliseconds(owner.GetAttackDelayMs());
|
attackTime = attackTime.AddMilliseconds(owner.GetAttackDelayMs());
|
||||||
owner.LookAt(target);
|
owner.LookAt(target);
|
||||||
//this.errorPacket = BattleActionX01Packet.BuildPacket(target.actorId, owner.actorId, target.actorId, 0, effectId, 0, (ushort)BattleActionX01PacketCommand.Attack, (ushort)damage, 0);
|
//this.errorPacket = BattleActionX01Packet.BuildPacket(target.actorId, owner.actorId, target.actorId, 0, effectId, 0, (ushort)BattleActionX01PacketCommand.Attack, (ushort)damage, 0);
|
||||||
|
@ -12,6 +12,7 @@ using FFXIVClassic_Map_Server.actors.chara.ai;
|
|||||||
using FFXIVClassic_Map_Server.actors.chara.ai.controllers;
|
using FFXIVClassic_Map_Server.actors.chara.ai.controllers;
|
||||||
using FFXIVClassic_Map_Server.packets.send.actor;
|
using FFXIVClassic_Map_Server.packets.send.actor;
|
||||||
using FFXIVClassic_Map_Server.actors.chara.ai.state;
|
using FFXIVClassic_Map_Server.actors.chara.ai.state;
|
||||||
|
using FFXIVClassic_Map_Server.utils;
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.Actors
|
namespace FFXIVClassic_Map_Server.Actors
|
||||||
{
|
{
|
||||||
@ -67,6 +68,25 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
this.statusEffects.Update(tick);
|
this.statusEffects.Update(tick);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void PostUpdate(DateTime tick, List<SubPacket> packets = null)
|
||||||
|
{
|
||||||
|
// todo: should probably add another flag for battleTemp since all this uses reflection
|
||||||
|
packets = new List<SubPacket>();
|
||||||
|
if ((updateFlags & ActorUpdateFlags.HpTpMp) != 0)
|
||||||
|
{
|
||||||
|
var propPacketUtil = new ActorPropertyPacketUtil("charaWork.parameterSave", this);
|
||||||
|
|
||||||
|
propPacketUtil.AddProperty("charaWork.parameterSave.hp[0]");
|
||||||
|
propPacketUtil.AddProperty("charaWork.parameterSave.hpMax[0]");
|
||||||
|
propPacketUtil.AddProperty("charaWork.parameterSave.state_mainSkill[0]");
|
||||||
|
propPacketUtil.AddProperty("charaWork.parameterSave.state_mainSkillLevel");
|
||||||
|
|
||||||
|
propPacketUtil.AddProperty("charaWork.battleTemp.castGauge_speed[0]");
|
||||||
|
propPacketUtil.AddProperty("charaWork.battleTemp.castGauge_speed[1]");
|
||||||
|
packets.AddRange(propPacketUtil.Done());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override bool CanAttack()
|
public override bool CanAttack()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1715,6 +1715,19 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
|
|
||||||
public override void PostUpdate(DateTime tick, List<SubPacket> packets = null)
|
public override void PostUpdate(DateTime tick, List<SubPacket> packets = null)
|
||||||
{
|
{
|
||||||
|
// todo: should probably add another flag for battleTemp since all this uses reflection
|
||||||
|
packets = new List<SubPacket>();
|
||||||
|
if ((updateFlags & ActorUpdateFlags.HpTpMp) != 0)
|
||||||
|
{
|
||||||
|
var propPacketUtil = new ActorPropertyPacketUtil("charaWork.parameterSave", this);
|
||||||
|
|
||||||
|
propPacketUtil.AddProperty($"charaWork.parameterSave.hp[{currentJob}]");
|
||||||
|
propPacketUtil.AddProperty($"charaWork.parameterSave.hpMax[{currentJob}]");
|
||||||
|
propPacketUtil.AddProperty($"charaWork.parameterSave.state_mainSkill[{currentJob}]");
|
||||||
|
|
||||||
|
packets.AddRange(propPacketUtil.Done());
|
||||||
|
}
|
||||||
|
|
||||||
base.PostUpdate(tick);
|
base.PostUpdate(tick);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1741,7 +1754,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
addHp = addHp.Clamp(short.MinValue, charaWork.parameterSave.hpMax[currentJob]);
|
addHp = addHp.Clamp(short.MinValue, charaWork.parameterSave.hpMax[currentJob]);
|
||||||
charaWork.parameterSave.hp[currentJob] = (short)addHp;
|
charaWork.parameterSave.hp[currentJob] = (short)addHp;
|
||||||
|
|
||||||
if (charaWork.parameterSave.hp[0] < 1)
|
if (charaWork.parameterSave.hp[currentJob] < 1)
|
||||||
Die(Program.Tick);
|
Die(Program.Tick);
|
||||||
|
|
||||||
updateFlags |= ActorUpdateFlags.HpTpMp;
|
updateFlags |= ActorUpdateFlags.HpTpMp;
|
||||||
|
@ -86,6 +86,7 @@ INSERT INTO `abilities` VALUES (27146,'cover',16,30,0,0,0,1,0,0,5,0,15,0,0,60,0,
|
|||||||
INSERT INTO `abilities` VALUES (27147,'divine_veil',16,35,0,0,0,1,0,0,5,0,20,0,0,60,0,0,14,713,2,2);
|
INSERT INTO `abilities` VALUES (27147,'divine_veil',16,35,0,0,0,1,0,0,5,0,20,0,0,60,0,0,14,713,2,2);
|
||||||
INSERT INTO `abilities` VALUES (27148,'hallowed_ground',16,50,0,0,0,1,0,0,5,0,0,0,0,900,0,0,14,709,2,2);
|
INSERT INTO `abilities` VALUES (27148,'hallowed_ground',16,50,0,0,0,1,0,0,5,0,0,0,0,900,0,0,14,709,2,2);
|
||||||
INSERT INTO `abilities` VALUES (27149,'holy_succor',16,40,0,0,0,1,0,0,15,0,0,0,2,10,100,0,1,701,1,2);
|
INSERT INTO `abilities` VALUES (27149,'holy_succor',16,40,0,0,0,1,0,0,15,0,0,0,2,10,100,0,1,701,1,2);
|
||||||
|
INSERT INTO `abilities` VALUES (27150,'fast_blade',3,1,1,32,0,1,1,0,5,0,0,0,0,10,0,1000,18,1023,1,2);
|
||||||
INSERT INTO `abilities` VALUES (27151,'flat_blade',3,26,1,32,0,1,0,0,5,0,0,0,0,10,0,1500,18,1024,2,2);
|
INSERT INTO `abilities` VALUES (27151,'flat_blade',3,26,1,32,0,1,0,0,5,0,0,0,0,10,0,1500,18,1024,2,2);
|
||||||
INSERT INTO `abilities` VALUES (27152,'savage_blade',3,10,1,32,0,1,0,0,5,0,0,0,0,30,0,1000,18,1025,1,2);
|
INSERT INTO `abilities` VALUES (27152,'savage_blade',3,10,1,32,0,1,0,0,5,0,0,0,0,30,0,1000,18,1025,1,2);
|
||||||
INSERT INTO `abilities` VALUES (27153,'goring_blade',3,50,8,32,0,1,2,0,5,30,0,0,0,60,0,3000,18,1026,301,2);
|
INSERT INTO `abilities` VALUES (27153,'goring_blade',3,50,8,32,0,1,2,0,5,30,0,0,0,60,0,3000,18,1026,301,2);
|
||||||
@ -210,4 +211,4 @@ commit;
|
|||||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||||
|
|
||||||
-- Dump completed on 2017-08-22 19:57:25
|
-- Dump completed on 2017-08-23 3:05:29
|
||||||
|
Loading…
Reference in New Issue
Block a user