mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
Removed spawn locations warping. Fixed event packet str len. Fixed some scripts. Fixed doors not working.
This commit is contained in:
parent
ff074c8394
commit
3ad30460d8
@ -26,11 +26,11 @@ vertical = {
|
|||||||
|
|
||||||
function onTrigger(player, argc, arg1, arg2)
|
function onTrigger(player, argc, arg1, arg2)
|
||||||
local pos = player:GetPos();
|
local pos = player:GetPos();
|
||||||
local x = pos[0];
|
local x = pos[1];
|
||||||
local y = pos[1];
|
local y = pos[2];
|
||||||
local z = pos[2];
|
local z = pos[3];
|
||||||
local rot = pos[3];
|
local rot = pos[4];
|
||||||
local zone = pos[4];
|
local zone = pos[5];
|
||||||
local angle = rot + (math.pi/2);
|
local angle = rot + (math.pi/2);
|
||||||
|
|
||||||
local worldManager = GetWorldManager();
|
local worldManager = GetWorldManager();
|
||||||
|
@ -23,16 +23,18 @@ function onTrigger(player, argc, animation, regionId, layoutId, maxLayoutId)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local pos = player:GetPos();
|
local pos = player:GetPos();
|
||||||
local x = pos[0];
|
local x = pos[1];
|
||||||
local y = pos[1];
|
local y = pos[2];
|
||||||
local z = pos[2];
|
local z = pos[3];
|
||||||
local zone = pos[4];
|
local zone = pos[5];
|
||||||
|
|
||||||
actorClassId = tonumber(actorClassId);
|
actorClassId = tonumber(actorClassId);
|
||||||
|
|
||||||
if (actorClassId ~= nil) then
|
if (actorClassId ~= nil) then
|
||||||
zone = player:GetZone();
|
zone = player:GetZone();
|
||||||
actor = zone:SpawnActor(actorClassId, "mapobj", pos[0], pos[1], pos[2], tonumber(regionId), tonumber(layoutId));
|
actor = zone:SpawnActor(actorClassId, "mapobj", pos[1], pos[2], pos[3], tonumber(regionId), tonumber(layoutId));
|
||||||
|
|
||||||
|
print("test");
|
||||||
wait(0.8);
|
wait(0.8);
|
||||||
actor:PlayMapObjAnimation(player, animation);
|
actor:PlayMapObjAnimation(player, animation);
|
||||||
zone:DespawnActor("mapobj");
|
zone:DespawnActor("mapobj");
|
||||||
|
@ -38,6 +38,7 @@ using System.Threading;
|
|||||||
using Meteor.Map.actors.chara.ai;
|
using Meteor.Map.actors.chara.ai;
|
||||||
using Meteor.Map.actors.chara.ai.controllers;
|
using Meteor.Map.actors.chara.ai.controllers;
|
||||||
using Meteor.Map.DataObjects;
|
using Meteor.Map.DataObjects;
|
||||||
|
using Meteor.Map.actors.chara.player;
|
||||||
|
|
||||||
namespace Meteor.Map.lua
|
namespace Meteor.Map.lua
|
||||||
{
|
{
|
||||||
@ -64,17 +65,23 @@ namespace Meteor.Map.lua
|
|||||||
luaTimer = new Timer(new TimerCallback(PulseSleepingOnTime),
|
luaTimer = new Timer(new TimerCallback(PulseSleepingOnTime),
|
||||||
null, TimeSpan.Zero, TimeSpan.FromMilliseconds(50));
|
null, TimeSpan.Zero, TimeSpan.FromMilliseconds(50));
|
||||||
|
|
||||||
|
UserData.RegistrationPolicy = InteropRegistrationPolicy.Automatic;
|
||||||
|
|
||||||
|
/*
|
||||||
UserData.RegisterType<LuaEngine>();
|
UserData.RegisterType<LuaEngine>();
|
||||||
UserData.RegisterType<Player>();
|
UserData.RegisterType<Player>();
|
||||||
UserData.RegisterType<Command>();
|
UserData.RegisterType<Command>();
|
||||||
UserData.RegisterType<Npc>();
|
UserData.RegisterType<Npc>();
|
||||||
UserData.RegisterType<Quest>();
|
UserData.RegisterType<Quest>();
|
||||||
UserData.RegisterType<Zone>();
|
UserData.RegisterType<Zone>();
|
||||||
|
UserData.RegisterType<InventoryItem>();
|
||||||
|
UserData.RegisterType<ItemPackage>();
|
||||||
UserData.RegisterType<PrivateArea>();
|
UserData.RegisterType<PrivateArea>();
|
||||||
UserData.RegisterType<PrivateAreaContent>();
|
UserData.RegisterType<PrivateAreaContent>();
|
||||||
UserData.RegisterType<Director>();
|
UserData.RegisterType<Director>();
|
||||||
UserData.RegisterType<WorldManager>();
|
UserData.RegisterType<WorldManager>();
|
||||||
UserData.RegisterType<WorldMaster>();
|
UserData.RegisterType<WorldMaster>();
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LuaEngine GetInstance()
|
public static LuaEngine GetInstance()
|
||||||
@ -425,18 +432,20 @@ namespace Meteor.Map.lua
|
|||||||
Area area = target.zone;
|
Area area = target.zone;
|
||||||
if (area is PrivateArea)
|
if (area is PrivateArea)
|
||||||
{
|
{
|
||||||
if (File.Exists(String.Format($"{ConfigConstants.OPTIONS_SCRIPTPATH}/unique/{0}/privatearea/{1}_{2}/{3}/{4}.lua", area.zoneName, ((PrivateArea)area).GetPrivateAreaName(), ((PrivateArea)area).GetPrivateAreaType(), target.className, target.GetUniqueId())))
|
string path = $"{ConfigConstants.OPTIONS_SCRIPTPATH}/unique/{area.zoneName}/privatearea/{((PrivateArea)area).GetPrivateAreaName()}_{((PrivateArea)area).GetPrivateAreaType()}/{target.className}/{target.GetUniqueId()}.lua";
|
||||||
child = LuaEngine.LoadScript(String.Format($"{ConfigConstants.OPTIONS_SCRIPTPATH}/unique/{0}/privatearea/{1}_{2}/{3}/{4}.lua", area.zoneName, ((PrivateArea)area).GetPrivateAreaName(), ((PrivateArea)area).GetPrivateAreaType(), target.className, target.GetUniqueId()), ref errorMsg);
|
if (File.Exists(path))
|
||||||
|
child = LuaEngine.LoadScript(path, ref errorMsg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (File.Exists(String.Format($"{ConfigConstants.OPTIONS_SCRIPTPATH}/unique/{0}/{1}/{2}.lua", area.zoneName, target.className, target.GetUniqueId())))
|
string path = $"{ConfigConstants.OPTIONS_SCRIPTPATH}/unique/{area.zoneName}/{target.className}/{target.GetUniqueId()}.lua";
|
||||||
child = LuaEngine.LoadScript(String.Format($"{ConfigConstants.OPTIONS_SCRIPTPATH}/unique/{0}/{1}/{2}.lua", area.zoneName, target.className, target.GetUniqueId()), ref errorMsg);
|
if (File.Exists(path))
|
||||||
|
child = LuaEngine.LoadScript(path, ref errorMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parent == null && child == null)
|
if (parent == null && child == null)
|
||||||
{
|
{
|
||||||
LuaEngine.SendError(player, String.Format("ERROR: Could not find script for actor {0}.", target.GetName()));
|
LuaEngine.SendError(player, $"ERROR: Could not find script for actor {target.GetName()}.");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Run Script
|
//Run Script
|
||||||
|
@ -40,9 +40,10 @@ namespace Meteor.Map.packets.send.actor.events
|
|||||||
{
|
{
|
||||||
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
||||||
{
|
{
|
||||||
binWriter.Write((Byte)condition.unknown1); //4
|
binWriter.Write((Byte)4); //Id type? Priority
|
||||||
binWriter.Write((UInt16)condition.emoteId); //82, 76, 6E
|
binWriter.Write((Byte)condition.unknown2);
|
||||||
binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(condition.conditionName));
|
binWriter.Write((UInt16)condition.emoteId); //82, 76, 6E are emotes used in captures
|
||||||
|
binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(condition.conditionName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ namespace Meteor.Map.packets.send.actor.events
|
|||||||
{
|
{
|
||||||
binWriter.Write((Byte)condition.unknown1); //Seen: 0, 1, E
|
binWriter.Write((Byte)condition.unknown1); //Seen: 0, 1, E
|
||||||
binWriter.Write((Byte)condition.unknown2); //Seen: 0, 1
|
binWriter.Write((Byte)condition.unknown2); //Seen: 0, 1
|
||||||
binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(condition.conditionName));
|
binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(condition.conditionName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,6 @@ namespace Meteor.Map
|
|||||||
|
|
||||||
mWorldManager = new WorldManager(this);
|
mWorldManager = new WorldManager(this);
|
||||||
mWorldManager.LoadZoneList();
|
mWorldManager.LoadZoneList();
|
||||||
mWorldManager.LoadZoneEntranceList();
|
|
||||||
mWorldManager.LoadSeamlessBoundryList();
|
mWorldManager.LoadSeamlessBoundryList();
|
||||||
mWorldManager.LoadActorClasses();
|
mWorldManager.LoadActorClasses();
|
||||||
mWorldManager.LoadSpawnLocations();
|
mWorldManager.LoadSpawnLocations();
|
||||||
|
@ -49,7 +49,6 @@ namespace Meteor.Map
|
|||||||
private WorldMaster worldMaster = new WorldMaster();
|
private WorldMaster worldMaster = new WorldMaster();
|
||||||
private Dictionary<uint, Zone> zoneList;
|
private Dictionary<uint, Zone> zoneList;
|
||||||
private Dictionary<uint, List<SeamlessBoundry>> seamlessBoundryList;
|
private Dictionary<uint, List<SeamlessBoundry>> seamlessBoundryList;
|
||||||
private Dictionary<uint, ZoneEntrance> zoneEntranceList;
|
|
||||||
private Dictionary<uint, ActorClass> actorClasses = new Dictionary<uint,ActorClass>();
|
private Dictionary<uint, ActorClass> actorClasses = new Dictionary<uint,ActorClass>();
|
||||||
private Dictionary<ulong, Party> currentPlayerParties = new Dictionary<ulong, Party>(); //GroupId, Party object
|
private Dictionary<ulong, Party> currentPlayerParties = new Dictionary<ulong, Party>(); //GroupId, Party object
|
||||||
private Dictionary<uint, StatusEffect> statusEffectList = new Dictionary<uint, StatusEffect>();
|
private Dictionary<uint, StatusEffect> statusEffectList = new Dictionary<uint, StatusEffect>();
|
||||||
@ -184,57 +183,6 @@ namespace Meteor.Map
|
|||||||
Program.Log.Info(String.Format("Loaded {0} zones and {1} private areas.", count1, count2));
|
Program.Log.Info(String.Format("Loaded {0} zones and {1} private areas.", count1, count2));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadZoneEntranceList()
|
|
||||||
{
|
|
||||||
zoneEntranceList = new Dictionary<uint, ZoneEntrance>();
|
|
||||||
int count = 0;
|
|
||||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
conn.Open();
|
|
||||||
|
|
||||||
string query = @"
|
|
||||||
SELECT
|
|
||||||
id,
|
|
||||||
zoneId,
|
|
||||||
spawnType,
|
|
||||||
spawnX,
|
|
||||||
spawnY,
|
|
||||||
spawnZ,
|
|
||||||
spawnRotation,
|
|
||||||
privateAreaName
|
|
||||||
FROM server_zones_spawnlocations";
|
|
||||||
|
|
||||||
MySqlCommand cmd = new MySqlCommand(query, conn);
|
|
||||||
|
|
||||||
using (MySqlDataReader reader = cmd.ExecuteReader())
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
|
||||||
uint id = reader.GetUInt32(0);
|
|
||||||
string privArea = null;
|
|
||||||
|
|
||||||
if (!reader.IsDBNull(7))
|
|
||||||
privArea = reader.GetString(7);
|
|
||||||
|
|
||||||
ZoneEntrance entance = new ZoneEntrance(reader.GetUInt32(1), privArea, 1, reader.GetByte(2), reader.GetFloat(3), reader.GetFloat(4), reader.GetFloat(5), reader.GetFloat(6));
|
|
||||||
zoneEntranceList[id] = entance;
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (MySqlException e)
|
|
||||||
{ Console.WriteLine(e); }
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
conn.Dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Program.Log.Info(String.Format("Loaded {0} zone spawn locations.", count));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LoadSeamlessBoundryList()
|
public void LoadSeamlessBoundryList()
|
||||||
{
|
{
|
||||||
seamlessBoundryList = new Dictionary<uint, List<SeamlessBoundry>>();
|
seamlessBoundryList = new Dictionary<uint, List<SeamlessBoundry>>();
|
||||||
@ -881,26 +829,13 @@ namespace Meteor.Map
|
|||||||
return xIsGood && yIsGood;
|
return xIsGood && yIsGood;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Moves actor to new zone, and sends packets to spawn at the given zone entrance
|
|
||||||
public void DoZoneChange(Player player, uint zoneEntrance)
|
|
||||||
{
|
|
||||||
if (!zoneEntranceList.ContainsKey(zoneEntrance))
|
|
||||||
{
|
|
||||||
Program.Log.Error("Given zone entrance was not found: " + zoneEntrance);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ZoneEntrance ze = zoneEntranceList[zoneEntrance];
|
|
||||||
DoZoneChange(player, ze.zoneId, ze.privateAreaName, ze.privateAreaType, ze.spawnType, ze.spawnX, ze.spawnY, ze.spawnZ, ze.spawnRotation);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Moves actor to new zone, and sends packets to spawn at the given coords.
|
//Moves actor to new zone, and sends packets to spawn at the given coords.
|
||||||
public void DoZoneChange(Player player, uint destinationZoneId, string destinationPrivateArea, int destinationPrivateAreaType, byte spawnType, float spawnX, float spawnY, float spawnZ, float spawnRotation)
|
public void DoZoneChange(Player player, uint destinationZoneId, string destinationPrivateArea, int destinationPrivateAreaType, byte spawnType, float spawnX, float spawnY, float spawnZ, float spawnRotation)
|
||||||
{
|
{
|
||||||
//Add player to new zone and update
|
//Add player to new zone and update
|
||||||
Area newArea;
|
Area newArea;
|
||||||
|
|
||||||
if (destinationPrivateArea == null)
|
if (destinationPrivateArea == null || destinationPrivateArea.Equals(""))
|
||||||
newArea = GetZone(destinationZoneId);
|
newArea = GetZone(destinationZoneId);
|
||||||
else //Add check for -1 if it is a instance
|
else //Add check for -1 if it is a instance
|
||||||
newArea = GetZone(destinationZoneId).GetPrivateArea(destinationPrivateArea, (uint)destinationPrivateAreaType);
|
newArea = GetZone(destinationZoneId).GetPrivateArea(destinationPrivateArea, (uint)destinationPrivateAreaType);
|
||||||
@ -965,23 +900,6 @@ namespace Meteor.Map
|
|||||||
LuaEngine.GetInstance().CallLuaFunction(player, newArea, "onZoneIn", true);
|
LuaEngine.GetInstance().CallLuaFunction(player, newArea, "onZoneIn", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Moves actor within zone to spawn position
|
|
||||||
public void DoPlayerMoveInZone(Player player, uint zoneEntrance)
|
|
||||||
{
|
|
||||||
if (!zoneEntranceList.ContainsKey(zoneEntrance))
|
|
||||||
{
|
|
||||||
Program.Log.Error("Given zone entrance was not found: " + zoneEntrance);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ZoneEntrance ze = zoneEntranceList[zoneEntrance];
|
|
||||||
|
|
||||||
if (ze.zoneId != player.zoneId)
|
|
||||||
return;
|
|
||||||
|
|
||||||
DoPlayerMoveInZone(player, ze.spawnX, ze.spawnY, ze.spawnZ, ze.spawnRotation, ze.spawnType);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Moves actor within the zone
|
//Moves actor within the zone
|
||||||
public void DoPlayerMoveInZone(Player player, float spawnX, float spawnY, float spawnZ, float spawnRotation, byte spawnType = 0xF)
|
public void DoPlayerMoveInZone(Player player, float spawnX, float spawnY, float spawnZ, float spawnRotation, byte spawnType = 0xF)
|
||||||
{
|
{
|
||||||
@ -1947,14 +1865,6 @@ namespace Meteor.Map
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ZoneEntrance GetZoneEntrance(uint entranceId)
|
|
||||||
{
|
|
||||||
if (zoneEntranceList.ContainsKey(entranceId))
|
|
||||||
return zoneEntranceList[entranceId];
|
|
||||||
else
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ActorClass GetActorClass(uint id)
|
public ActorClass GetActorClass(uint id)
|
||||||
{
|
{
|
||||||
if (actorClasses.ContainsKey(id))
|
if (actorClasses.ContainsKey(id))
|
||||||
|
Loading…
Reference in New Issue
Block a user