public static List <Room> ListOfRooms() { var areas = new List <Room> { Ambush.TutorialRoom1(), Ambush.TutorialRoom2(), Ambush.TutorialLostInTheWoods(), Ambush.TutorialLostInTheWoods2(), Ambush.TutorialLostInTheWoods3(), Ambush.TutorialLostInTheWoods4(), Ambush.TutorialLostInTheWoods5(), Ambush.TutorialLostInTheWoods6(), Ambush.TutorialGoblinCamp(), Ambush.TutorialGoblinCampTentNorth(), Ambush.TutorialGoblinCampTentSouth(), Anker.Anker.VillageSquare(), Anker.Anker.SquareWalkOutsideTavern(), Anker.Anker.SquareWalkOutsideStables(), Anker.Anker.RedLionStables(), Anker.Anker.SquareWalkCommerceCorner(), Anker.Anker.SquareWalkEastOfCentre(), Anker.Anker.SquareWalkEntrance(), Anker.Anker.SquareWalkSouthWestOfCentre(), Anker.Anker.SquareWalkWestOfCentre(), Anker.Anker.SquareWalkSouthOfCentre(), Anker.Anker.DrunkenSailor(), Anker.Anker.GeneralStore(), Anker.Anker.MetalMedley(), Anker.Anker.VillageHall(), Anker.Anker.VillageHallEntrance(), Anker.Anker.VillageHallEldersRoom(), Anker.Anker.TempleRoad(), Anker.Anker.TempleRoad2(), Anker.Anker.TempleEntrance(), Anker.Anker.PathToTheSquare(), Anker.Anker.AnkerLane(), Anker.Anker.AnkerLaneWest21(), Anker.Anker.AnkerLaneWest25(), Anker.Anker.AnkerLaneWest37(), Anker.Anker.AnkerLaneEast22(), Anker.Anker.AnkerLaneEast23(), Anker.Anker.AnkerLaneEast24(), Anker.Anker.AnkerHome(), Anker.Anker.AnkerHome2(), Anker.Anker.AnkerHome3(), Anker.Anker.AnkerHome4(), Anker.Anker.AnkerHome5(), Anker.Anker.AnkerHome6(), Anker.Anker.AnkerHome31(), Anker.Anker.AnkerHome32(), Anker.Anker.AnkerHome33(), Anker.Anker.AnkerHome34(), Anker.Anker.AnkerHome35(), Anker.Anker.AnkerHome36(), }; return(areas); }
//////////////// protected override void Receive() { var myworld = ModContent.GetInstance <AmbushesWorld>(); Ambush ambush = Ambush.CreateType(this.AmbushType, this.TilePositionX, this.TilePositionY, this.IsEntrapment); myworld.AmbushMngr.ArmAmbush(ambush); }
private AmbushAddProtocol(Ambush ambush) { var ab = ambush as BrambleEnclosureAmbush; this.AmbushType = Ambush.GetAmbushCode(ambush); this.AmbushType = Ambush.GetAmbushCode(ambush); this.IsEntrapment = ab?.IsEntrapping ?? false; this.TilePositionX = ambush.TileY; this.TilePositionY = ambush.TileY; }
public void Construct(Ambush ambush) { this.triggerRange = ambush.triggerRange; this.spawnRange = ambush.spawnRange; this.spawns = ambush.spawns; this.telegraphs = new GameObject[spawns.Length]; cc.radius = triggerRange; cc.enabled = true; }
//////////////// protected override void ReceiveReply() { var myworld = ModContent.GetInstance <AmbushesWorld>(); Ambush ambush; for (int i = 0; i < this.AmbushTypes.Length; i++) { ambush = Ambush.CreateType(this.AmbushTypes[i], this.TilePositionXs[i], this.TilePositionYs[i], this.IsEntrapments[i]); myworld.AmbushMngr.ArmAmbush(ambush); } }
//////////////// protected override void InitializeServerSendData(int who) { var myworld = ModContent.GetInstance <AmbushesWorld>(); IEnumerable <Ambush> ambushes = myworld.AmbushMngr.GetAllAmbushes(); int count = ambushes.Count(); this.AmbushTypes = new int[count]; this.IsEntrapments = new bool[count]; this.TilePositionXs = new int[count]; this.TilePositionYs = new int[count]; int i = 0; foreach (Ambush ambush in ambushes) { var ab = ambush as BrambleEnclosureAmbush; this.AmbushTypes[i] = Ambush.GetAmbushCode(ambush); this.IsEntrapments[i] = ab?.IsEntrapping ?? false; this.TilePositionXs[i] = ambush.TileY; this.TilePositionYs[i] = ambush.TileY; i++; } }
public static void QuickSendToClients(Ambush ambush) { var protocol = new AmbushAddProtocol(ambush); protocol.SendToClient(-1, -1); }
public static List <Room> ListOfRooms() { var areas = new List <Room> { Ambush.TutorialRoom1(), Ambush.TutorialRoom2(), Ambush.TutorialLostInTheWoods(), Ambush.TutorialLostInTheWoods2(), Ambush.TutorialLostInTheWoods3(), Ambush.TutorialLostInTheWoods4(), Ambush.TutorialLostInTheWoods5(), Ambush.TutorialLostInTheWoods6(), Ambush.TutorialGoblinCamp(), Ambush.TutorialGoblinCampTentNorth(), Ambush.TutorialGoblinCampTentSouth(), Awakening.TempleOfTyr(), Anker.Anker.VillageSquare(), Anker.Anker.SquareWalkOutsideTavern(), Anker.Anker.SquareWalkOutsideStables(), Anker.Anker.RedLionStables(), Anker.Anker.SquareWalkCommerceCorner(), Anker.Anker.SquareWalkEastOfCentre(), Anker.Anker.SquareWalkEntrance(), Anker.Anker.SquareWalkSouthWestOfCentre(), Anker.Anker.SquareWalkWestOfCentre(), Anker.Anker.SquareWalkSouthOfCentre(), Anker.Anker.DrunkenSailor(), Anker.Anker.GeneralStore(), Anker.Anker.MetalMedley(), Anker.Anker.VillageHall(), Anker.Anker.VillageHallEntrance(), Anker.Anker.VillageHallEldersRoom(), Anker.Anker.TempleRoad(), Anker.Anker.TempleRoad2(), Anker.Anker.TempleRoad3(), Anker.Anker.TempleEntrance(), Anker.Anker.TempleOfTyr(), Anker.Anker.TempleRoad4(), Anker.Anker.TempleGraveyard(), Anker.Anker.TempleGraveyard1(), Anker.Anker.TempleGraveyard2(), Anker.Anker.TempleGraveyard3(), Anker.Anker.TempleGraveyard4(), Anker.Anker.TempleGraveyard5(), Anker.Anker.TempleGraveyard6(), Anker.Anker.PathToTheSquare(), Anker.Anker.AnkerLane(), Anker.Anker.AnkerLaneWest21(), Anker.Anker.AnkerLaneWest25(), Anker.Anker.AnkerLaneWest37(), Anker.Anker.AnkerLaneEast22(), Anker.Anker.AnkerLaneEast23(), Anker.Anker.AnkerLaneEast24(), Anker.Anker.AnkerHome(), Anker.Anker.AnkerHome2(), Anker.Anker.AnkerHome3(), Anker.Anker.AnkerHome4(), Anker.Anker.AnkerHome5(), Anker.Anker.AnkerHome6(), Anker.Anker.AnkerHome31(), Anker.Anker.AnkerHome32(), Anker.Anker.AnkerHome33(), Anker.Anker.AnkerHome34(), Anker.Anker.AnkerHome35(), Anker.Anker.AnkerHome36(), Anker.Anker.AnkerLaneEast40(), Anker.Anker.AnkerLaneGate(), Anker.AnkerFarm.AnkerRoad(), Anker.AnkerFarm.RoadThroughFarm(), Anker.AnkerFarm.Farm(), Anker.AnkerFarm.Windmill(), Anker.AnkerFarm.CropFields(), Anker.AnkerFarm.CropFields1(), Anker.AnkerFarm.CropFields2(), Anker.AnkerFarm.CropFields3(), Anker.AnkerFarm.AnkerRoad1(), Anker.AnkerFarm.AnkerRoad2(), Anker.AnkerFarm.AnkerRoad3(), Anker.AnkerFarm.RiverBank(), Anker.AnkerFarm.SawMill(), Anker.AnkerFarm.Pasture(), Anker.AnkerFarm.TheBridge(), Anker.AnkerFarm.PalusRiver(), Anker.AnkerFarm.PalusRiver0(), Anker.AnkerFarm.PalusRiver1(), Anker.AnkerFarm.PalusRiver2(), Anker.AnkerFarm.PalusRiver3(), Anker.AnkerFarm.HermitsHome(), }; return(areas); }
static void Main(string[] args) { //TODO: Clean up :) using (var db = new LiteDatabase(@"C:\MyData.db")) { var col = db.GetCollection <Room>("Room"); Console.WriteLine("Cleaning DB"); db.DropCollection("Room"); Console.WriteLine("Compiling Areas."); var areaSpeed = new Stopwatch(); areaSpeed.Start(); var areas = new List <Room> { Ambush.TutorialRoom1(), Ambush.TutorialRoom2(), Ambush.TutorialLostInTheWoods(), Ambush.TutorialLostInTheWoods2(), Ambush.TutorialLostInTheWoods3(), Ambush.TutorialLostInTheWoods4(), Ambush.TutorialLostInTheWoods5(), Ambush.TutorialLostInTheWoods6(), Ambush.TutorialGoblinCamp(), Ambush.TutorialGoblinCampTentNorth(), Ambush.TutorialGoblinCampTentSouth(), Awakening.TempleOfTyr(), Anker.VillageSquare(), Anker.SquareWalkOutsideTavern(), Anker.SquareWalkOutsideStables(), Anker.RedLionStables(), Anker.SquareWalkCommerceCorner(), Anker.SquareWalkEastOfCentre(), Anker.SquareWalkEntrance(), Anker.SquareWalkSouthWestOfCentre(), Anker.SquareWalkWestOfCentre(), Anker.SquareWalkSouthOfCentre(), Anker.DrunkenSailor(), Anker.GeneralStore(), Anker.MetalMedley(), Anker.VillageHall(), Anker.VillageHallEntrance(), Anker.VillageHallEldersRoom(), Anker.TempleRoad(), Anker.TempleRoad2(), Anker.TempleRoad3(), Anker.TempleEntrance(), Anker.PathToTheSquare(), Anker.AnkerLane(), Anker.AnkerLaneWest21(), Anker.AnkerLaneWest25(), Anker.AnkerLaneWest37(), Anker.AnkerLaneEast22(), Anker.AnkerLaneEast23(), Anker.AnkerLaneEast24(), Anker.AnkerHome(), Anker.AnkerHome2(), Anker.AnkerHome3(), Anker.AnkerHome4(), Anker.AnkerHome5(), Anker.AnkerHome6(), Anker.AnkerHome31(), Anker.AnkerHome32(), Anker.AnkerHome33(), Anker.AnkerHome34(), Anker.AnkerHome35(), Anker.AnkerHome36(), }; areaSpeed.Stop(); Console.WriteLine("Compiling Areas Completed in {0}ms.", areaSpeed.Elapsed.Milliseconds); //check areas for duplicate ids Console.WriteLine("Adding Area's to Database"); var addSpeed = new Stopwatch(); addSpeed.Start(); foreach (var area in areas) { Console.WriteLine("Added {0}", area.title); col.Insert(Guid.NewGuid(), area); } addSpeed.Stop(); Console.WriteLine("Adding Area's to Database Completed in {0}ms.", addSpeed.Elapsed.Milliseconds); Console.WriteLine("{0} Areas added", areas.Count); Console.ReadLine(); } }
static void Main(string[] args) { //TODO: Clean up :) const string ConnectionString = "mongodb://*****:*****@ds052968.mlab.com:52968/mimdb"; // Create a MongoClient object by using the connection string var client = new MongoClient(ConnectionString); //Use the MongoClient to access the server var database = client.GetDatabase("mimdb"); var roomCollection = database.GetCollection <Room>("Room"); Console.WriteLine("Cleaning DB"); database.DropCollection("Room"); Console.WriteLine("Compiling Areas."); var areaSpeed = new Stopwatch(); areaSpeed.Start(); var areas = new List <Room> { Ambush.TutorialRoom1(), Ambush.TutorialRoom2(), Awakening.TempleOfTyr(), Anker.VillageSquare(), Anker.SquareWalkOutsideTavern(), Anker.SquareWalkOutsideStables(), Anker.RedLionStables(), Anker.SquareWalkCommerceCorner(), Anker.SquareWalkEastOfCentre(), Anker.SquareWalkEntrance(), Anker.SquareWalkSouthWestOfCentre(), Anker.SquareWalkWestOfCentre(), Anker.SquareWalkSouthOfCentre(), Anker.DrunkenSailor(), Anker.GeneralStore(), Anker.MetalMedley(), Anker.VillageHall(), Anker.VillageHallEntrance(), Anker.VillageHallEldersRoom(), Anker.TempleRoad(), Anker.TempleRoad2(), Anker.TempleEntrance(), Anker.PathToTheSquare(), Anker.AnkerLane(), Anker.AnkerLaneWest21(), Anker.AnkerLaneWest25(), Anker.AnkerLaneWest37(), Anker.AnkerLaneEast22(), Anker.AnkerLaneEast23(), Anker.AnkerLaneEast24(), Anker.AnkerHome(), Anker.AnkerHome2(), Anker.AnkerHome3(), Anker.AnkerHome4(), Anker.AnkerHome5(), Anker.AnkerHome6(), Anker.AnkerHome31(), Anker.AnkerHome32(), Anker.AnkerHome33(), Anker.AnkerHome34(), Anker.AnkerHome35(), Anker.AnkerHome36(), }; areaSpeed.Stop(); Console.WriteLine("Compiling Areas Completed in {0}ms.", areaSpeed.Elapsed.Milliseconds); //check areas for duplicate ids Console.WriteLine("Adding Area's to Database"); var addSpeed = new Stopwatch(); addSpeed.Start(); foreach (var area in areas) { Console.WriteLine("Added {0}", area.title); roomCollection.InsertOne(area); } addSpeed.Stop(); Console.WriteLine("Adding Area's to Database Completed in {0}ms.", addSpeed.Elapsed.Milliseconds); Console.WriteLine("{0} Areas added", areas.Count); Console.ReadLine(); }