mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-07-28 13:26:08 +02:00
Finished the crafting start window system. Added PassiveGuildleveQuests and refactors the Quest object. Cleaned up how zone music is handled.
This commit is contained in:
parent
f4e2280de8
commit
605b4918e2
34 changed files with 7121 additions and 4533 deletions
|
@ -143,7 +143,7 @@ namespace Meteor.Map.lua
|
|||
}
|
||||
catch (ScriptRuntimeException e)
|
||||
{
|
||||
LuaEngine.SendError(player, String.Format("OnEventUpdated: {0}", e.DecoratedMessage));
|
||||
LuaEngine.SendError(player, string.Format("OnEventUpdated: {0}", e.DecoratedMessage));
|
||||
player.EndEvent();
|
||||
}
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ namespace Meteor.Map.lua
|
|||
{
|
||||
// todo: this is probably unnecessary as im not sure there were pets for players
|
||||
if (!(actor.aiContainer.GetController<PetController>()?.GetPetMaster() is Player))
|
||||
path = String.Format("./scripts/unique/{0}/{1}/{2}.lua", actor.zone.zoneName, actor is BattleNpc ? "Monster" : "PopulaceStandard", ((Npc)actor).GetUniqueId());
|
||||
path = string.Format("./scripts/unique/{0}/{1}/{2}.lua", actor.zone.zoneName, actor is BattleNpc ? "Monster" : "PopulaceStandard", ((Npc)actor).GetUniqueId());
|
||||
}
|
||||
// dont wanna throw an error if file doesnt exist
|
||||
if (File.Exists(path))
|
||||
|
@ -358,7 +358,7 @@ namespace Meteor.Map.lua
|
|||
{
|
||||
if (target is Player)
|
||||
{
|
||||
return String.Format(FILEPATH_PLAYER);
|
||||
return string.Format(FILEPATH_PLAYER);
|
||||
}
|
||||
else if (target is Npc)
|
||||
{
|
||||
|
@ -366,25 +366,25 @@ namespace Meteor.Map.lua
|
|||
}
|
||||
else if (target is Command)
|
||||
{
|
||||
return String.Format(FILEPATH_COMMANDS, target.GetName());
|
||||
return string.Format(FILEPATH_COMMANDS, target.GetName());
|
||||
}
|
||||
else if (target is Director)
|
||||
{
|
||||
return String.Format(FILEPATH_DIRECTORS, ((Director)target).GetScriptPath());
|
||||
return string.Format(FILEPATH_DIRECTORS, ((Director)target).GetScriptPath());
|
||||
}
|
||||
else if (target is PrivateAreaContent)
|
||||
{
|
||||
return String.Format(FILEPATH_CONTENT, ((PrivateAreaContent)target).GetPrivateAreaName());
|
||||
return string.Format(FILEPATH_CONTENT, ((PrivateAreaContent)target).GetPrivateAreaName());
|
||||
}
|
||||
else if (target is Area)
|
||||
{
|
||||
return String.Format(FILEPATH_ZONE, ((Area)target).zoneName);
|
||||
return string.Format(FILEPATH_ZONE, ((Area)target).zoneName);
|
||||
}
|
||||
else if (target is Quest)
|
||||
{
|
||||
string initial = ((Quest)target).actorName.Substring(0, 3);
|
||||
string questName = ((Quest)target).actorName;
|
||||
return String.Format(FILEPATH_QUEST, initial, questName);
|
||||
return string.Format(FILEPATH_QUEST, initial, questName);
|
||||
}
|
||||
else
|
||||
return "";
|
||||
|
@ -410,18 +410,18 @@ namespace Meteor.Map.lua
|
|||
Area area = target.zone;
|
||||
if (area is PrivateArea)
|
||||
{
|
||||
if (File.Exists(String.Format("./scripts/unique/{0}/privatearea/{1}_{2}/{3}/{4}.lua", area.zoneName, ((PrivateArea)area).GetPrivateAreaName(), ((PrivateArea)area).GetPrivateAreaType(), target.className, target.GetUniqueId())))
|
||||
child = LuaEngine.LoadScript(String.Format("./scripts/unique/{0}/privatearea/{1}_{2}/{3}/{4}.lua", area.zoneName, ((PrivateArea)area).GetPrivateAreaName(), ((PrivateArea)area).GetPrivateAreaType(), target.className, target.GetUniqueId()));
|
||||
if (File.Exists(string.Format("./scripts/unique/{0}/privatearea/{1}_{2}/{3}/{4}.lua", area.zoneName, ((PrivateArea)area).GetPrivateAreaName(), ((PrivateArea)area).GetPrivateAreaType(), target.className, target.GetUniqueId())))
|
||||
child = LuaEngine.LoadScript(string.Format("./scripts/unique/{0}/privatearea/{1}_{2}/{3}/{4}.lua", area.zoneName, ((PrivateArea)area).GetPrivateAreaName(), ((PrivateArea)area).GetPrivateAreaType(), target.className, target.GetUniqueId()));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (File.Exists(String.Format("./scripts/unique/{0}/{1}/{2}.lua", area.zoneName, target.className, target.GetUniqueId())))
|
||||
child = LuaEngine.LoadScript(String.Format("./scripts/unique/{0}/{1}/{2}.lua", area.zoneName, target.className, target.GetUniqueId()));
|
||||
if (File.Exists(string.Format("./scripts/unique/{0}/{1}/{2}.lua", area.zoneName, target.className, target.GetUniqueId())))
|
||||
child = LuaEngine.LoadScript(string.Format("./scripts/unique/{0}/{1}/{2}.lua", area.zoneName, target.className, target.GetUniqueId()));
|
||||
}
|
||||
|
||||
if (parent == null && child == null)
|
||||
{
|
||||
LuaEngine.SendError(player, String.Format("ERROR: Could not find script for actor {0}.", target.GetName()));
|
||||
LuaEngine.SendError(player, string.Format("ERROR: Could not find script for actor {0}.", target.GetName()));
|
||||
}
|
||||
|
||||
//Run Script
|
||||
|
@ -458,18 +458,18 @@ namespace Meteor.Map.lua
|
|||
Area area = target.zone;
|
||||
if (area is PrivateArea)
|
||||
{
|
||||
if (File.Exists(String.Format("./scripts/unique/{0}/privatearea/{1}_{2}/{3}/{4}.lua", area.zoneName, ((PrivateArea)area).GetPrivateAreaName(), ((PrivateArea)area).GetPrivateAreaType(), target.className, target.GetUniqueId())))
|
||||
child = LuaEngine.LoadScript(String.Format("./scripts/unique/{0}/privatearea/{1}_{2}/{3}/{4}.lua", area.zoneName, ((PrivateArea)area).GetPrivateAreaName(), ((PrivateArea)area).GetPrivateAreaType(), target.className, target.GetUniqueId()));
|
||||
if (File.Exists(string.Format("./scripts/unique/{0}/privatearea/{1}_{2}/{3}/{4}.lua", area.zoneName, ((PrivateArea)area).GetPrivateAreaName(), ((PrivateArea)area).GetPrivateAreaType(), target.className, target.GetUniqueId())))
|
||||
child = LuaEngine.LoadScript(string.Format("./scripts/unique/{0}/privatearea/{1}_{2}/{3}/{4}.lua", area.zoneName, ((PrivateArea)area).GetPrivateAreaName(), ((PrivateArea)area).GetPrivateAreaType(), target.className, target.GetUniqueId()));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (File.Exists(String.Format("./scripts/unique/{0}/{1}/{2}.lua", area.zoneName, target.className, target.GetUniqueId())))
|
||||
child = LuaEngine.LoadScript(String.Format("./scripts/unique/{0}/{1}/{2}.lua", area.zoneName, target.className, target.GetUniqueId()));
|
||||
if (File.Exists(string.Format("./scripts/unique/{0}/{1}/{2}.lua", area.zoneName, target.className, target.GetUniqueId())))
|
||||
child = LuaEngine.LoadScript(string.Format("./scripts/unique/{0}/{1}/{2}.lua", area.zoneName, target.className, target.GetUniqueId()));
|
||||
}
|
||||
|
||||
if (parent == null && child == null)
|
||||
{
|
||||
LuaEngine.SendError(player, String.Format("Could not find script for actor {0}.", target.GetName()));
|
||||
LuaEngine.SendError(player, string.Format("Could not find script for actor {0}.", target.GetName()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -525,13 +525,13 @@ namespace Meteor.Map.lua
|
|||
else
|
||||
{
|
||||
if (!optional)
|
||||
SendError(player, String.Format("Could not find function '{0}' for actor {1}.", funcName, target.GetName()));
|
||||
SendError(player, string.Format("Could not find function '{0}' for actor {1}.", funcName, target.GetName()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!optional)
|
||||
SendError(player, String.Format("Could not find script for actor {0}.", target.GetName()));
|
||||
SendError(player, string.Format("Could not find script for actor {0}.", target.GetName()));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -589,13 +589,13 @@ namespace Meteor.Map.lua
|
|||
else
|
||||
{
|
||||
if (!optional)
|
||||
SendError(player, String.Format("Could not find function '{0}' for actor {1}.", funcName, target.GetName()));
|
||||
SendError(player, string.Format("Could not find function '{0}' for actor {1}.", funcName, target.GetName()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(target is Area) && !optional)
|
||||
SendError(player, String.Format("Could not find script for actor {0}.", target.GetName()));
|
||||
SendError(player, string.Format("Could not find script for actor {0}.", target.GetName()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -616,7 +616,7 @@ namespace Meteor.Map.lua
|
|||
}
|
||||
catch (ScriptRuntimeException e)
|
||||
{
|
||||
LuaEngine.SendError(player, String.Format("OnEventStarted: {0}", e.DecoratedMessage));
|
||||
LuaEngine.SendError(player, string.Format("OnEventStarted: {0}", e.DecoratedMessage));
|
||||
player.EndEvent();
|
||||
}
|
||||
}
|
||||
|
@ -660,7 +660,7 @@ namespace Meteor.Map.lua
|
|||
}
|
||||
|
||||
#region RunGMCommand
|
||||
public static void RunGMCommand(Player player, String cmd, string[] param, bool help = false)
|
||||
public static void RunGMCommand(Player player, string cmd, string[] param, bool help = false)
|
||||
{
|
||||
bool playerNull = player == null;
|
||||
|
||||
|
@ -676,7 +676,7 @@ namespace Meteor.Map.lua
|
|||
player = Server.GetWorldManager().GetPCInWorld(param[1] + " " + param[2]);
|
||||
|
||||
// load from scripts/commands/gm/ directory
|
||||
var path = String.Format("./scripts/commands/gm/{0}.lua", cmd.ToLower());
|
||||
var path = string.Format("./scripts/commands/gm/{0}.lua", cmd.ToLower());
|
||||
|
||||
// check if the file exists
|
||||
if (File.Exists(path))
|
||||
|
@ -747,7 +747,7 @@ namespace Meteor.Map.lua
|
|||
// i hate to do this, but cant think of a better way to keep !help
|
||||
else if (help)
|
||||
{
|
||||
player.SendMessage(SendMessagePacket.MESSAGE_TYPE_SYSTEM_ERROR, String.Format("[Commands] [{0}]", cmd), description);
|
||||
player.SendMessage(SendMessagePacket.MESSAGE_TYPE_SYSTEM_ERROR, string.Format("[Commands] [{0}]", cmd), description);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -851,6 +851,7 @@ namespace Meteor.Map.lua
|
|||
script.Globals["GetWorldMaster"] = (Func<Actor>)Server.GetWorldManager().GetActor;
|
||||
script.Globals["GetItemGamedata"] = (Func<uint, ItemData>)Server.GetItemGamedata;
|
||||
script.Globals["GetGuildleveGamedata"] = (Func<uint, GuildleveData>)Server.GetGuildleveGamedata;
|
||||
script.Globals["GetPassiveGLGamedata"] = (Func<uint, PassiveGuildleveData>)Server.GetPassiveGLGamedata;
|
||||
script.Globals["GetRecipeResolver"] = (Func<RecipeResolver>)Server.ResolveRecipe;
|
||||
script.Globals["GetLuaInstance"] = (Func<LuaEngine>)LuaEngine.GetInstance;
|
||||
|
||||
|
|
|
@ -26,9 +26,9 @@ namespace Meteor.Map.lua
|
|||
class LuaParam
|
||||
{
|
||||
public int typeID;
|
||||
public Object value;
|
||||
public object value;
|
||||
|
||||
public LuaParam(int type, Object value)
|
||||
public LuaParam(int type, object value)
|
||||
{
|
||||
this.typeID = type;
|
||||
this.value = value;
|
||||
|
|
|
@ -25,6 +25,7 @@ using Meteor.Map.lua;
|
|||
using MoonSharp.Interpreter;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
|
@ -158,7 +159,7 @@ namespace Meteor.Map
|
|||
isDone = true;
|
||||
continue;
|
||||
default:
|
||||
throw new ArgumentException("Unknown lua param...");
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
if (isDone)
|
||||
|
@ -287,22 +288,22 @@ namespace Meteor.Map
|
|||
foreach (LuaParam l in luaParams)
|
||||
{
|
||||
if (l.typeID == 0x1)
|
||||
writer.Write((Byte)0);
|
||||
writer.Write((byte)0);
|
||||
else
|
||||
writer.Write((Byte)l.typeID);
|
||||
writer.Write((byte)l.typeID);
|
||||
|
||||
switch (l.typeID)
|
||||
{
|
||||
case 0x0: //Int32
|
||||
writer.Write((Int32)Utils.SwapEndian((Int32)l.value));
|
||||
writer.Write((int)Utils.SwapEndian((int)l.value));
|
||||
break;
|
||||
case 0x1: //Int32
|
||||
writer.Write((UInt32)Utils.SwapEndian((UInt32)l.value));
|
||||
writer.Write((uint)Utils.SwapEndian((uint)l.value));
|
||||
break;
|
||||
case 0x2: //Null Termed String
|
||||
string sv = (string)l.value;
|
||||
writer.Write(Encoding.ASCII.GetBytes(sv), 0, Encoding.ASCII.GetByteCount(sv));
|
||||
writer.Write((Byte)0);
|
||||
writer.Write((byte)0);
|
||||
break;
|
||||
case 0x3: //Boolean True
|
||||
break;
|
||||
|
@ -311,21 +312,21 @@ namespace Meteor.Map
|
|||
case 0x5: //Nil
|
||||
break;
|
||||
case 0x6: //Actor (By Id)
|
||||
writer.Write((UInt32)Utils.SwapEndian((UInt32)l.value));
|
||||
writer.Write((uint)Utils.SwapEndian((uint)l.value));
|
||||
break;
|
||||
case 0x7: //Weird one used for inventory
|
||||
ItemRefParam type7 = (ItemRefParam)l.value;
|
||||
writer.Write((UInt32)Utils.SwapEndian((UInt32)type7.actorId));
|
||||
writer.Write((Byte)type7.unknown);
|
||||
writer.Write((Byte)type7.slot);
|
||||
writer.Write((Byte)type7.itemPackage);
|
||||
writer.Write((uint)Utils.SwapEndian((uint)type7.actorId));
|
||||
writer.Write((byte)type7.unknown);
|
||||
writer.Write((byte)type7.slot);
|
||||
writer.Write((byte)type7.itemPackage);
|
||||
break;
|
||||
case 0x9: //Two Longs (only storing first one)
|
||||
writer.Write((UInt64)Utils.SwapEndian(((Type9Param)l.value).item1));
|
||||
writer.Write((UInt64)Utils.SwapEndian(((Type9Param)l.value).item2));
|
||||
writer.Write((ulong)Utils.SwapEndian(((Type9Param)l.value).item1));
|
||||
writer.Write((ulong)Utils.SwapEndian(((Type9Param)l.value).item2));
|
||||
break;
|
||||
case 0xC: //Byte
|
||||
writer.Write((Byte)l.value);
|
||||
writer.Write((byte)l.value);
|
||||
break;
|
||||
case 0x1B: //Short?
|
||||
break;
|
||||
|
@ -334,7 +335,7 @@ namespace Meteor.Map
|
|||
}
|
||||
}
|
||||
|
||||
writer.Write((Byte)0xF);
|
||||
writer.Write((byte)0xF);
|
||||
}
|
||||
|
||||
public static List<LuaParam> CreateLuaParamList(DynValue fromScript)
|
||||
|
@ -417,7 +418,7 @@ namespace Meteor.Map
|
|||
{
|
||||
luaParams.Add(new LuaParam(0x1, (uint)o));
|
||||
}
|
||||
else if (o is Double)
|
||||
else if (o is double)
|
||||
{
|
||||
if (((double)o) % 1 == 0)
|
||||
luaParams.Add(new LuaParam(0x0, (int)(double)o));
|
||||
|
@ -481,13 +482,13 @@ namespace Meteor.Map
|
|||
switch (lParams[i].typeID)
|
||||
{
|
||||
case 0x0: //Int32
|
||||
dumpString += String.Format("0x{0:X}", (int)lParams[i].value);
|
||||
dumpString += string.Format("0x{0:X}", (int)lParams[i].value);
|
||||
break;
|
||||
case 0x1: //Int32
|
||||
dumpString += String.Format("0x{0:X}", (uint)lParams[i].value);
|
||||
dumpString += string.Format("0x{0:X}", (uint)lParams[i].value);
|
||||
break;
|
||||
case 0x2: //Null Termed String
|
||||
dumpString += String.Format("\"{0}\"", (string)lParams[i].value);
|
||||
dumpString += string.Format("\"{0}\"", (string)lParams[i].value);
|
||||
break;
|
||||
case 0x3: //Boolean True
|
||||
dumpString += "true";
|
||||
|
@ -499,25 +500,25 @@ namespace Meteor.Map
|
|||
dumpString += "nil";
|
||||
break;
|
||||
case 0x6: //Actor (By Id)
|
||||
dumpString += String.Format("0x{0:X}", (uint)lParams[i].value);
|
||||
dumpString += string.Format("0x{0:X}", (uint)lParams[i].value);
|
||||
break;
|
||||
case 0x7: //Weird one used for inventory
|
||||
ItemRefParam type7Param = ((ItemRefParam)lParams[i].value);
|
||||
dumpString += String.Format("Type7 Param: (0x{0:X}, 0x{1:X}, 0x{2:X}, 0x{3:X})", type7Param.actorId, type7Param.unknown, type7Param.slot, type7Param.itemPackage);
|
||||
dumpString += string.Format("Type7 Param: (0x{0:X}, 0x{1:X}, 0x{2:X}, 0x{3:X})", type7Param.actorId, type7Param.unknown, type7Param.slot, type7Param.itemPackage);
|
||||
break;
|
||||
case 0x8: //Weird one used for inventory
|
||||
ItemOfferParam itemOfferParam = ((ItemOfferParam)lParams[i].value);
|
||||
dumpString += String.Format("Type8 Param: (0x{0:X}, 0x{1:X}, 0x{2:X}, 0x{3:X}, 0x{4:X}, 0x{5:X}, 0x{6:X})", itemOfferParam.actorId, itemOfferParam.offerSlot, itemOfferParam.offerPackageId, itemOfferParam.unknown1, itemOfferParam.seekSlot, itemOfferParam.seekPackageId, itemOfferParam.unknown2);
|
||||
dumpString += string.Format("Type8 Param: (0x{0:X}, 0x{1:X}, 0x{2:X}, 0x{3:X}, 0x{4:X}, 0x{5:X}, 0x{6:X})", itemOfferParam.actorId, itemOfferParam.offerSlot, itemOfferParam.offerPackageId, itemOfferParam.unknown1, itemOfferParam.seekSlot, itemOfferParam.seekPackageId, itemOfferParam.unknown2);
|
||||
break;
|
||||
case 0x9: //Long (+ 8 bytes ignored)
|
||||
Type9Param type9Param = ((Type9Param)lParams[i].value);
|
||||
dumpString += String.Format("Type9 Param: (0x{0:X}, 0x{1:X})", type9Param.item1, type9Param.item2);
|
||||
dumpString += string.Format("Type9 Param: (0x{0:X}, 0x{1:X})", type9Param.item1, type9Param.item2);
|
||||
break;
|
||||
case 0xC: //Byte
|
||||
dumpString += String.Format("0x{0:X}", (byte)lParams[i].value);
|
||||
dumpString += string.Format("0x{0:X}", (byte)lParams[i].value);
|
||||
break;
|
||||
case 0x1B: //Short?
|
||||
dumpString += String.Format("0x{0:X}", (ushort)lParams[i].value);
|
||||
dumpString += string.Format("0x{0:X}", (ushort)lParams[i].value);
|
||||
break;
|
||||
case 0xF: //End
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue