public static void Initialize() { MapScriptManager.Register("door1", ProcessDoor1); MapScriptManager.Register("delaydoor1", ProcessDoor1); MapScriptManager.Register("door3", ProcessDoor3); MapScriptManager.Register("delaydoor3", ProcessDoor3); MapScriptManager.Register("door7", ProcessDoor7); MapScriptManager.Register("delaydoor7", ProcessDoor7); MapScriptManager.Register("door9", ProcessDoor9); MapScriptManager.Register("delaydoor9", ProcessDoor9); MapScriptManager.Register("doorvalour1", ProcessDoorValour1); MapScriptManager.Register("doorvalour2", ProcessDoorValour2); MapScriptManager.Register("doorvalour3", ProcessDoorValour3); MapScriptManager.Register("doorvalour4", ProcessDoorValour4); MapScriptManager.Register("doorvalour5", ProcessDoorValour5); MapScriptManager.Register("doorvalour6", ProcessDoorValour6); MapScriptManager.Register("doorvalour7", ProcessDoorValour7); MapScriptManager.Register("doorvalour8", ProcessDoorValour8); }
public void ProccessMovement(IMobile mobile, Point3D location) { if (mapData[location.X, location.Y].Length < location.Z) { return; } MapData md = mapData[location.X, location.Y][location.Z]; if (!string.IsNullOrEmpty(md.Script)) { MapScriptHandler handler = MapScriptManager.GetScriptHandler(md.Script); if (handler == null) { Console.WriteLine("Unhandled Script {0}", md.Script); } else { try { handler.ProcessScript(mobile); } catch { Console.WriteLine("Error processing Script {0} for {1}", md.Script, mobile); } } } if (!string.IsNullOrEmpty(md.MapCommand)) { string mapCommand = md.MapCommand; if (mapCommand.StartsWith("W")) { string[] newLocation = mapCommand.Replace("W", "").Trim().Split(' '); int X = byte.Parse(newLocation[0]) + ((byte.Parse(newLocation[1])) * 256); int Y = byte.Parse(newLocation[2]) + ((byte.Parse(newLocation[3])) * 256); byte M = byte.Parse(newLocation[4]); byte Z = byte.Parse(newLocation[5]); IMap targetMap = MapManager.GetMap(M); Point3D targetLocation = new Point3D(X, Y, Z); mobile.WarpToLocation(targetMap, targetLocation); return; } if (mapCommand.StartsWith("B")) { mobile.OpenBank(); return; } if (mapCommand.StartsWith("!")) { return; //additional map info } if (mapCommand.StartsWith("x")) { return; //additional map info } if (mapCommand.StartsWith("z")) { return; //additional map info } if (mapCommand.StartsWith("G")) { return; //additional map info } Console.WriteLine(String.Format("Map Command \"{0}\" Not Implemented...", mapCommand)); } }