Skip to content
This repository has been archived by the owner on Sep 3, 2022. It is now read-only.

Commit

Permalink
Secondary Navgrids/ExpCurves and Scoreboards (#1383)
Browse files Browse the repository at this point in the history
*  Packets
    - Introduced `NotifyS2C_HandleCapturePointUpdate` and `NotifyS2C_HandleGameScore`.
    - Deleted `MovementType`, as it wasn't used anymore.

* Monsters
    - Deleted the system to delay targetability during spawn animations i made but never finished.

* APIMapFunctionManager
    - Introduced `NotifyGameScore` and `NotifyHandleCapturePointUpdate`.

* MapScriptMetaData
    - Introduced `ExpCurveOverride` and `NavGridOverride`.

* MapScriptHandler
    - Moved things around in order to the `MapData`, `CollisionHandler`, `PathingHandler` and `NavigationGrid` variables only get loaded after the MapScript, so they can properly take into account the new overrides in `MapScriptMetaData`.

* Config
    - Deleted `MapData`, now all references to MapData are to the MapData located in MapScriptHandler. 

* Scripts
    - Updated Map8's `LevelScript` and `LevelScriptObjects` so it can properly handle the scoreboard (Didn't script any of the mechanics related to it).
    - Introduced `LevelScriptAscension`. Although Ascension doesn't have a separate LevelScript in League files, i believe it is different enough to deserve a deticated, standalone LevelScript.
    - I didn't do much to the Ascension script due to the lack of a replay file to take accurate information from. I only added features directly present in the Odin gamemode, such as `SpeedShrines`, `Props`, and some of the `HealthRelics`.
  • Loading branch information
cabeca1143 committed Mar 27, 2022
1 parent 023d8b6 commit b18de15
Show file tree
Hide file tree
Showing 20 changed files with 430 additions and 103 deletions.
2 changes: 1 addition & 1 deletion Content/LeagueSandbox-Default
29 changes: 21 additions & 8 deletions Content/LeagueSandbox-Scripts/Maps/Map8/CreateLevelProps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace MapScripts.Map8
{
public static class CreateLevelProps
{
public static void CreateProps(ODIN mapScript)
public static void CreateProps(ODIN mapScript = null)
{
// Level Props
AddLevelProp("LevelProp_Odin_Windmill_Gears", "Odin_Windmill_Gears", new Vector3(6946.143f, -122.93308f, 11918.931f), Vector3.Zero, new Vector3(11.1111f, 77.7777f, -122.2222f), Vector3.One);
Expand All @@ -16,16 +16,29 @@ public static void CreateProps(ODIN mapScript)
AddLevelProp("LevelProp_OdinRockSaw02", "OdinRockSaw", new Vector3(5659.9004f, -11.821701f, 1016.47925f), new Vector3(0.0f, 40.0f, 0.0f), new Vector3(233.3334f, 133.3334f, -77.7778f), Vector3.One);
AddLevelProp("LevelProp_OdinRockSaw01", "OdinRockSaw", new Vector3(2543.822f, -56.266106f, 1344.957f), Vector3.Zero, new Vector3(-122.2222f, 111.1112f, -744.4445f), Vector3.One);
AddLevelProp("LevelProp_Odin_Drill", "Odin_Drill", new Vector3(11992.028f, 343.7337f, 8547.805f), new Vector3(0.0f, 244.0f, 0.0f), new Vector3(33.3333f, 311.1111f, 0.0f), Vector3.One);
mapScript.TeamStairs.Add(TeamId.TEAM_BLUE, AddLevelProp("LevelProp_Odin_SoG_Order", "Odin_SoG_Order", new Vector3(266.77225f, 139.9266f, 3903.9998f), Vector3.Zero, new Vector3(-288.8889f, 122.2222f, -188.8889f), Vector3.One));
var Odin_SoG_Order = AddLevelProp("LevelProp_Odin_SoG_Order", "Odin_SoG_Order", new Vector3(266.77225f, 139.9266f, 3903.9998f), Vector3.Zero, new Vector3(-288.8889f, 122.2222f, -188.8889f), Vector3.One);
AddLevelProp("LevelProp_OdinClaw", "OdinClaw", new Vector3(5187.914f, 261.546f, 2122.2627f), Vector3.Zero, new Vector3(422.2223f, 255.5555f, -200.0f), Vector3.One);
mapScript.SwainBeams.Add(1, AddLevelProp("LevelProp_SwainBeam1", "SwainBeam", new Vector3(7207.073f, 461.54602f, 1995.804f), Vector3.Zero, new Vector3(-422.2222f, 355.5555f, -311.1111f), Vector3.One));
mapScript.SwainBeams.Add(2, AddLevelProp("LevelProp_SwainBeam2", "SwainBeam", new Vector3(8142.406f, 639.324f, 2716.4258f), new Vector3(0.0f, 152.0f, 0.0f), new Vector3(-222.2222f, 444.4445f, -88.8889f), Vector3.One));
mapScript.SwainBeams.Add(3, AddLevelProp("LevelProp_SwainBeam3", "SwainBeam", new Vector3(9885.076f, 350.435f, 3339.1853f), new Vector3(0.0f, 54.0f, 0.0f), new Vector3(144.4445f, 300.0f, -155.5555f), Vector3.One));
mapScript.TeamStairs.Add(TeamId.TEAM_PURPLE, AddLevelProp("LevelProp_Odin_SoG_Chaos", "Odin_SoG_Chaos", new Vector3(13623.644f, 117.7046f, 3884.6233f), Vector3.Zero, new Vector3(288.8889f, 111.1112f, -211.1111f), Vector3.One));
var SwainBeam1 = AddLevelProp("LevelProp_SwainBeam1", "SwainBeam", new Vector3(7207.073f, 461.54602f, 1995.804f), Vector3.Zero, new Vector3(-422.2222f, 355.5555f, -311.1111f), Vector3.One);
var SwainBeam2 = AddLevelProp("LevelProp_SwainBeam2", "SwainBeam", new Vector3(8142.406f, 639.324f, 2716.4258f), new Vector3(0.0f, 152.0f, 0.0f), new Vector3(-222.2222f, 444.4445f, -88.8889f), Vector3.One);
var SwainBeam3 = AddLevelProp("LevelProp_SwainBeam3", "SwainBeam", new Vector3(9885.076f, 350.435f, 3339.1853f), new Vector3(0.0f, 54.0f, 0.0f), new Vector3(144.4445f, 300.0f, -155.5555f), Vector3.One);
var Odin_SoG_Chaos = AddLevelProp("LevelProp_Odin_SoG_Chaos", "Odin_SoG_Chaos", new Vector3(13623.644f, 117.7046f, 3884.6233f), Vector3.Zero, new Vector3(288.8889f, 111.1112f, -211.1111f), Vector3.One);
AddLevelProp("LevelProp_OdinCrane", "OdinCrane", new Vector3(10287.527f, -145.15509f, 10776.917f), new Vector3(0.0f, 52.0f, 0.0f), new Vector3(-22.2222f, 66.6667f, 0.0f), Vector3.One);
AddLevelProp("LevelProp_OdinCrane1", "OdinCrane", new Vector3(9418.097f, 12105.366f, -189.59952f), new Vector3(0.0f, 118.0f, 0.0f), new Vector3(0.0f, 44.4445f, 0.0f), Vector3.One);
mapScript.Nexus.Add(TeamId.TEAM_BLUE, AddLevelProp("LevelProp_Odin_SOG_Order_Crystal", "Odin_SOG_Order_Crystal", new Vector3(1618.3121f, 336.9458f, 4357.871f), Vector3.Zero, new Vector3(-122.2222f, 277.7778f, -122.2222f), Vector3.One));
mapScript.Nexus.Add(TeamId.TEAM_PURPLE, AddLevelProp("LevelProp_Odin_SOG_Chaos_Crystal", "Odin_SOG_Chaos_Crystal", new Vector3(12307.629f, 225.8346f, 4535.6484f), new Vector3(0.0f, 214.0f, 0.0f), new Vector3(144.4445f, 222.2222f, -33.3334f), Vector3.One));
var OrderCrystal = AddLevelProp("LevelProp_Odin_SOG_Order_Crystal", "Odin_SOG_Order_Crystal", new Vector3(1618.3121f, 336.9458f, 4357.871f), Vector3.Zero, new Vector3(-122.2222f, 277.7778f, -122.2222f), Vector3.One);
var ChaosCrystal = AddLevelProp("LevelProp_Odin_SOG_Chaos_Crystal", "Odin_SOG_Chaos_Crystal", new Vector3(12307.629f, 225.8346f, 4535.6484f), new Vector3(0.0f, 214.0f, 0.0f), new Vector3(144.4445f, 222.2222f, -33.3334f), Vector3.One);

if (mapScript != null)
{
mapScript.TeamStairs.Add(TeamId.TEAM_BLUE, Odin_SoG_Order);
mapScript.TeamStairs.Add(TeamId.TEAM_PURPLE, Odin_SoG_Chaos);

mapScript.SwainBeams.Add(1, SwainBeam1);
mapScript.SwainBeams.Add(2, SwainBeam2);
mapScript.SwainBeams.Add(3, SwainBeam3);

mapScript.Nexus.Add(TeamId.TEAM_BLUE, OrderCrystal);
mapScript.Nexus.Add(TeamId.TEAM_PURPLE, ChaosCrystal);
}
}
}
}
20 changes: 6 additions & 14 deletions Content/LeagueSandbox-Scripts/Maps/Map8/LevelScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,6 @@ public class ODIN : IMapScript
}},

};
//Nexus models
public Dictionary<TeamId, string> NexusModels { get; set; } = new Dictionary<TeamId, string>
{
{TeamId.TEAM_BLUE, "OrderNexus" },
{TeamId.TEAM_PURPLE, "ChaosNexus" }
};
//Inhib models
public Dictionary<TeamId, string> InhibitorModels { get; set; } = new Dictionary<TeamId, string>
{
{TeamId.TEAM_BLUE, "OrderInhibitor" },
{TeamId.TEAM_PURPLE, "ChaosInhibitor" }
};
//Tower Models


//Minion models for this map
public Dictionary<TeamId, Dictionary<MinionSpawnType, string>> MinionModels { get; set; } = new Dictionary<TeamId, Dictionary<MinionSpawnType, string>>
Expand Down Expand Up @@ -159,6 +145,7 @@ public void Init(Dictionary<GameObjectTypes, List<MapObject>> mapObjects)
CreateLevelProps.CreateProps(this);
}

Dictionary<TeamId, int> TeamScores = new Dictionary<TeamId, int> { { TeamId.TEAM_BLUE, 500 }, { TeamId.TEAM_PURPLE, 500 } };
public void OnMatchStart()
{
LevelScriptObjects.OnMatchStart();
Expand All @@ -181,6 +168,11 @@ public void OnMatchStart()
AddBuff("OdinPlayerBuff", 25000, 1, null, champion, null);
}

foreach (var team in TeamScores.Keys)
{
NotifyGameScore(team, TeamScores[team]);
}

NeutralMinionSpawn.InitializeNeutrals();
}

Expand Down
121 changes: 121 additions & 0 deletions Content/LeagueSandbox-Scripts/Maps/Map8/LevelScriptAscension.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
using System;
using System.Collections.Generic;
using System.Numerics;
using GameServerCore.Domain;
using GameServerCore.Domain.GameObjects;
using GameServerCore.Enums;
using LeagueSandbox.GameServer.Content;
using LeagueSandbox.GameServer.Scripting.CSharp;
using GameServerCore.Scripting.CSharp;
using static LeagueSandbox.GameServer.API.ApiFunctionManager;
using static LeagueSandbox.GameServer.API.ApiMapFunctionManager;

namespace MapScripts.Map8
{
public class ASCENSION : IMapScript
{
public IMapScriptMetadata MapScriptMetadata { get; set; } = new MapScriptMetadata
{
MinionSpawnEnabled = false,
StartingGold = 1300.0f,
OverrideSpawnPoints = true,
RecallSpellItemId = 2005,
GoldPerSecond = 9.85f,
FirstGoldTime = 5 * 1000,
InitialLevel = 3,
ExpRange = 1250.0f,
GoldRange = 0.0f,
NavGridOverride = "AIPathASCENSION",
ExpCurveOverride = "ExpCurveASCENSION"
};

public virtual IGlobalData GlobalData { get; set; } = new GlobalData();
public bool HasFirstBloodHappened { get; set; } = false;
public long NextSpawnTime { get; set; } = 90 * 1000;
public string LaneMinionAI { get; set; } = "LaneMinionAI";

//Values i got the values for 5 players from replay packets, the value for 1 player is just a guess of mine by using !coords command in-game
public Dictionary<TeamId, Dictionary<int, Dictionary<int, Vector2>>> PlayerSpawnPoints { get; } = new Dictionary<TeamId, Dictionary<int, Dictionary<int, Vector2>>>
{
{TeamId.TEAM_BLUE, new Dictionary<int, Dictionary<int, Vector2>>{
{ 5, new Dictionary<int, Vector2>{
{ 1, new Vector2(687.99036f, 4281.2314f) },
{ 2, new Vector2(687.99036f, 4061.2314f) },
{ 3, new Vector2(478.79034f,3993.2314f) },
{ 4, new Vector2(349.39032f,4171.2314f) },
{ 5, new Vector2(438.79034f,4349.2314f) }
}},
{1, new Dictionary<int, Vector2>{
{ 1, new Vector2(580f, 4124f) }
}}
}},

{TeamId.TEAM_PURPLE, new Dictionary<int, Dictionary<int, Vector2>>
{ { 5, new Dictionary<int, Vector2>{
{ 1, new Vector2(13468.365f,4281.2324f) },
{ 2, new Vector2(13468.365f,4061.2324f) },
{ 3, new Vector2(13259.165f,3993.2324f) },
{ 4, new Vector2(13129.765f,4171.2324f) },
{ 5, new Vector2(13219.165f,4349.2324f) }
}},
{1, new Dictionary<int, Vector2>{
{ 1, new Vector2(13310f, 4124f) }
}}
}},

};

//Minion models for this map
public Dictionary<TeamId, Dictionary<MinionSpawnType, string>> MinionModels { get; set; } = new Dictionary<TeamId, Dictionary<MinionSpawnType, string>>
{
{TeamId.TEAM_BLUE, new Dictionary<MinionSpawnType, string>{
{MinionSpawnType.MINION_TYPE_MELEE, "Blue_Minion_Basic"},
{MinionSpawnType.MINION_TYPE_CASTER, "Blue_Minion_Wizard"},
{MinionSpawnType.MINION_TYPE_CANNON, "Blue_Minion_MechCannon"},
{MinionSpawnType.MINION_TYPE_SUPER, "Blue_Minion_MechMelee"}
}},
{TeamId.TEAM_PURPLE, new Dictionary<MinionSpawnType, string>{
{MinionSpawnType.MINION_TYPE_MELEE, "Red_Minion_Basic"},
{MinionSpawnType.MINION_TYPE_CASTER, "Red_Minion_Wizard"},
{MinionSpawnType.MINION_TYPE_CANNON, "Red_Minion_MechCannon"},
{MinionSpawnType.MINION_TYPE_SUPER, "Red_Minion_MechMelee"}
}}
};

public void Init(Dictionary<GameObjectTypes, List<MapObject>> mapObjects)
{
//TODO: Implement Dynamic Minion spawn mechanics for Map8
//SpawnEnabled = map.IsMinionSpawnEnabled();
AddSurrender(1200000.0f, 300000.0f, 30.0f);
CreateLevelProps.CreateProps();
LevelScriptObjectsAscension.LoadObjects(mapObjects);
}

Dictionary<TeamId, int> TeamScores = new Dictionary<TeamId, int> { { TeamId.TEAM_BLUE, 200}, { TeamId.TEAM_PURPLE, 200} };
public void OnMatchStart()
{
LevelScriptObjectsAscension.OnMatchStart();
NeutralMinionSpawnAscension.InitializeNeutrals();

foreach(var team in TeamScores.Keys)
{
NotifyGameScore(team, TeamScores[team]);
}
}

public void Update(float diff)
{
NeutralMinionSpawnAscension.OnUpdate(diff);
}

public void SpawnAllCamps()
{
NeutralMinionSpawnAscension.ForceCampSpawn();
}

public Vector2 GetFountainPosition(TeamId team)
{
return LevelScriptObjects.FountainList[team].Position;
}
}
}
11 changes: 9 additions & 2 deletions Content/LeagueSandbox-Scripts/Maps/Map8/LevelScriptObjects.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static class LevelScriptObjects
{
private static Dictionary<GameObjectTypes, List<MapObject>> _mapObjects;

static List<IMinion> InfoPoints = new List<IMinion>();
static Dictionary<byte, IMinion> InfoPoints = new Dictionary<byte, IMinion>();
public static Dictionary<TeamId, IFountain> FountainList = new Dictionary<TeamId, IFountain>();
static Dictionary<TeamId, List<ILaneTurret>> TurretList = new Dictionary<TeamId, List<ILaneTurret>> { { TeamId.TEAM_BLUE, new List<ILaneTurret>() }, { TeamId.TEAM_PURPLE, new List<ILaneTurret>() } };

Expand All @@ -36,6 +36,11 @@ public static void LoadObjects(Dictionary<GameObjectTypes, List<MapObject>> mapO
public static void OnMatchStart()
{
LoadShops();

foreach (var index in InfoPoints.Keys)
{
NotifyHandleCapturePointUpdate(index, InfoPoints[index].NetId, 0, 0, CapturePointUpdateCommand.AttachToObject);
}
}

public static void OnUpdate(float diff)
Expand Down Expand Up @@ -74,12 +79,14 @@ static void CreateBuildings()
AddObject(fountainTurret);
}

byte pointIndex = 0;
foreach (var infoPoint in _mapObjects[GameObjectTypes.InfoPoint])
{
var point = CreateMinion("OdinNeutralGuardian", "OdinNeutralGuardian", new Vector2(infoPoint.CentralPoint.X, infoPoint.CentralPoint.Z), ignoreCollision: true);
AddUnitPerceptionBubble(point, 800.0f, 25000.0f, TeamId.TEAM_BLUE, true, collisionArea: 120.0f, collisionOwner: point);
point.PauseAi(true);
InfoPoints.Add(point);
InfoPoints.Add(pointIndex, point);
pointIndex++;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
using GameServerCore.Domain.GameObjects;
using GameServerCore.Enums;
using static LeagueSandbox.GameServer.API.ApiMapFunctionManager;
using System.Collections.Generic;
using GameServerCore.Domain;
using System.Numerics;
using static LeagueSandbox.GameServer.API.ApiFunctionManager;

namespace MapScripts.Map8
{
public static class LevelScriptObjectsAscension
{
private static Dictionary<GameObjectTypes, List<MapObject>> _mapObjects;

static List<IMinion> InfoPoints = new List<IMinion>();
public static Dictionary<TeamId, IFountain> FountainList = new Dictionary<TeamId, IFountain>();
static Dictionary<TeamId, List<ILaneTurret>> TurretList = new Dictionary<TeamId, List<ILaneTurret>> { { TeamId.TEAM_BLUE, new List<ILaneTurret>() }, { TeamId.TEAM_PURPLE, new List<ILaneTurret>() } };

static string LaneTurretAI = "TurretAI";

public static Dictionary<TeamId, string> TowerModels { get; set; } = new Dictionary<TeamId, string>
{
{TeamId.TEAM_BLUE, "OdinOrderTurretShrine" },

{TeamId.TEAM_PURPLE, "OdinChaosTurretShrine" }
};

public static void LoadObjects(Dictionary<GameObjectTypes, List<MapObject>> mapObjects)
{
_mapObjects = mapObjects;

CreateBuildings();
LoadFountains();
}

public static void OnMatchStart()
{
LoadShops();
}

public static void OnUpdate(float diff)
{
foreach (var fountain in FountainList.Values)
{
fountain.Update(diff);
}
}

static void LoadFountains()
{
foreach (var fountain in _mapObjects[GameObjectTypes.ObjBuilding_SpawnPoint])
{
var team = fountain.GetTeamID();
FountainList.Add(team, CreateFountain(team, new Vector2(fountain.CentralPoint.X, fountain.CentralPoint.Z)));
}
}

static void LoadShops()
{
foreach (var shop in _mapObjects[GameObjectTypes.ObjBuilding_Shop])
{
NotifySpawn(CreateShop(shop.Name, new Vector2(shop.CentralPoint.X, shop.CentralPoint.Z), shop.GetTeamID()));
}
}

static void CreateBuildings()
{
foreach (var turretObj in _mapObjects[GameObjectTypes.ObjAIBase_Turret])
{
var teamId = turretObj.GetTeamID();
var position = new Vector2(turretObj.CentralPoint.X, turretObj.CentralPoint.Z);
var fountainTurret = CreateLaneTurret(turretObj.Name + "_A", TowerModels[teamId], position, teamId, TurretType.FOUNTAIN_TURRET, LaneID.NONE, LaneTurretAI, turretObj);
TurretList[teamId].Add(fountainTurret);
AddObject(fountainTurret);
}
}
}
}
Loading

0 comments on commit b18de15

Please sign in to comment.