public void WalkToTarget(Maps.Map map, GameObject host) { // Attempt to walk, do nothing if we can't var player = map.Game.Player; var playerPoint = player.Location.Point; var hostPoint = host.Location.Point; var delta = playerPoint - hostPoint; var horizontalDirection = Directions.GetByOffset(delta.X); var verticalDirection = Directions.GetByOffset(0, delta.Y); if (horizontalDirection != null) { var action = new Actions.Walk(horizontalDirection); var result = action.Execute(this.Host); if (result) { return; } } if (verticalDirection != null) { var action = new Actions.Walk(verticalDirection); action.Execute(this.Host); } }
public bool Teleport(Maps.Map map, ushort x, ushort y) { if (!Core.Kernel.Maps.Contains(map.MapID)) { return(false); } if (Map != null) { Map.LeaveMap(this); } if (!map.EnterMap(this)) { return(false); } Target = null; this.X = x; this.Y = y; Screen.UpdateScreen(null, false); return(true); }
//TODO: Remove? Should never be null; just crash. void MapNullCheck() { if (map == null) { map = PoMDataLoader.maps[PoMDataLoader.mapMap[typeof(Maps.Plains)]].Clone(); } }
public GuildCollector(Maps.Map map, Characters.Character owner, int id) { ID = id; IsInFight = false; Guild = owner.Guild; Map = map; Map.Collector = this; Owner = owner.ID; Cell = owner.MapCell; Dir = 3; Name = new int[2] { Utilities.Basic.Rand(1, 39), Utilities.Basic.Rand(1, 71) }; timer = new Timer(); timer.Enabled = true; timer.Interval = Utilities.Basic.Rand(5000, 15000); timer.Elapsed += new ElapsedEventHandler(this.Move); timer.Start(); Map.Send(string.Concat("GM", PatternMap())); }
public Character(string name, int max_health, Maps.Map map) : base(name, map) { this.Health = new Components.Health(this, max_health); this.Display = new Components.Display(this, '@', Color.White, Color.Black); this.RegisterComponent(this.Health); this.RegisterComponent(this.Display); }
public Floor(Maps.Map map, int x, int y) : base("floor", map) { this.IsBlocking = false; this.Display = new Components.Display(this, '.', Color.Gray, Color.Black); this.RegisterComponent(this.Display); this.Location.SetPos(x, y); }
public Wall(int max_health, Maps.Map map, int x, int y) : base("wall", map) { this.Health = new Components.Health(this, max_health); this.Display = new Components.Display(this, '#', Color.Gray, Color.Black); this.RegisterComponent(this.Health); this.RegisterComponent(this.Display); this.Location.SetPos(x, y); }
public Vision(GameObject host, int radius) : base("Vision", host) { this.radius = radius; this.currentMap = this.Host.Location.Map; this.fov = new RogueSharp.FieldOfView(this.currentMap); var origin = this.Host.Location.Point; this.fov.ComputeFov(origin.X, origin.Y, this.radius, true); }
// Constructing a new MapGenerator requires the dimensions of the maps it will create // as well as the sizes and maximum number of rooms public MapGenerator(Game game, int width, int height, int maxRooms, int roomMaxSize, int roomMinSize) { _width = width; _height = height; _maxRooms = maxRooms; _roomMaxSize = roomMaxSize; _roomMinSize = roomMinSize; _map = new Maps.Map(game, width, height); }
public Drone(Maps.Map map, int x, int y) : base("Alien Drone", 10, map) { this.Display.SadEntity.Animation.SetGlyph(0, 0, 'D'); this.RegisterComponent(new Components.SimpleVision(this, 10)); this.RegisterComponent(new Components.SimpleAI(this)); // TODO This should not be here this.Location.SetPos(x, y); map.AddGameObject(this); }
public AStarPathfinder(Maps.Map map) { this.map = map; this.maxX = map.MaxX; this.maxY = map.MaxY; InitMovements(); InitSquares(); }
public AStarPathfinder(Maps.Map map) { this.map = map; maxX = map.MaxX; maxY = map.MaxY; InitMovements(); InitSquares(); }
public override void NetRecieve(BinaryReader reader) { //PathOfModifiers.Log("11"); try { map = PoMDataLoader.maps[reader.ReadInt32()].Clone(); map.NetReceive(reader); } catch (Exception e) { mod.Logger.Error(e.ToString()); } //PathOfModifiers.Log("12"); }
public override void Update(GameTime deltatime) { base.Update(deltatime); var map = this.Host.Location.Map; if (map != this.currentMap) { this.currentMap = map; this.fov = new RogueSharp.FieldOfView(this.currentMap); } var origin = this.Host.Location.Point; this.fov.ComputeFov(origin.X, origin.Y, this.radius, true); }
public void acquireTarget(Maps.Map map, GameObject host) { // Currently, only the player will be considered enemy. var vision = (SimpleVision)host.GetComponent(typeof(Components.SimpleVision)); if (vision == null) { return; } var player = map.Game.Player; var playerPoint = player.Location.Point; if (vision.CanSee(playerPoint)) { this.target = player; } }
public static void ShowThunder(Maps.Map map) { if (map.ShowThunder) { foreach (Maps.IMapObject obj in map.MapObjects.Values) { if (obj is Entities.GameClient) { using (var thunder = new Packets.StringPacket(new Packets.StringPacker("lounder1"))) { thunder.Action = Enums.StringAction.MapEffect; thunder.PositionX = (ushort)(obj.X - 20); thunder.PositionY = obj.Y; (obj as Entities.GameClient).Send(thunder); } } } } }
public void Drop(Maps.Map map, ushort MidLocationX, ushort MidLocationY) { Maps.MapPoint Location = map.CreateAvailableLocation <Data.GroundItem>(MidLocationX, MidLocationY, 10); if (Location != null) { Data.GroundItem ground = new Data.GroundItem(this); ground.DropType = Enums.DropItemType.Item; ground.X = Location.X; ground.Y = Location.Y; Location.Map.EnterMap(ground); ground.TaskID = ProjectX_V3_Lib.Threading.DelayedTask.StartDelayedTask( () => { Location.Map.LeaveMap(ground); ground.Screen.ClearScreen(); }, Core.TimeIntervals.DroppedItemRemove); ground.Screen.UpdateScreen(null); } }
public override void Load(TagCompound tag) { //PathOfModifiers.Log("5"); TagCompound mapTag = tag.GetCompound("mapTag"); var mapMod = mapTag.GetString("mapMod"); Mod mod = ModLoader.GetMod(mapMod); if (mod == null) { mod.Logger.WarnFormat("Map mod \"{0}\" not found", mapMod); return; } var mapFullName = mapTag.GetString("mapFullName"); Type type = mod.Code.GetType(mapFullName); if (type == null) { mod.Logger.WarnFormat("Map \"{0}\" not found", mapFullName); return; } map = PoMDataLoader.maps[PoMDataLoader.mapMap[type]].Clone(); map.Load(mapTag); //PathOfModifiers.Log("6"); }
public static void MovePlayer(Enums.Direction dir, bool lastMoved) { if (!Globals.GettingMap && !PlayerManager.MyPlayer.MovementLocked && !Stories.StoryProcessor.loadingStory && !PlayerManager.MyPlayer.Dead) { if (PlayerManager.MyPlayer.Confused) { dir = (Enums.Direction)(Logic.MathFunctions.Random.Next(0, 4)); } //dir = Enums.Direction.Up; //if (SdlInput.Keyboard.IsKeyPressed(IO.ControlLoader.TurnKey)) { // Players.PlayerManager.MyPlayer.Direction = dir; // Messenger.SendPlayerDir(); //} else if (GameProcessor.CanMove(dir)) { MyPlayer player = PlayerManager.MyPlayer; if (Globals.RefreshLock == false) { if (SdlInput.Keyboard.IsKeyPressed(IO.ControlLoader.RunKey) || SdlInput.Keyboard.IsKeyPressed(SdlInput.Key.RightShift)) { player.MovementSpeed = PlayerManager.MyPlayer.SpeedLimit; } else { player.MovementSpeed = Enums.MovementSpeed.Walking; if (player.MovementSpeed > PlayerManager.MyPlayer.SpeedLimit) { player.MovementSpeed = PlayerManager.MyPlayer.SpeedLimit; } } if (Maps.MapHelper.ActiveMap.Tile[player.Location.X, player.Location.Y].Type == Enums.TileType.Slippery && lastMoved) { player.MovementSpeed = Enums.MovementSpeed.Slip; } if (Maps.MapHelper.ActiveMap.Tile[player.Location.X, player.Location.Y].Type == Enums.TileType.Slow) { int mobilityList = Maps.MapHelper.ActiveMap.Tile[player.Location.X, player.Location.Y].Data1; bool slow = false; for (int i = 0; i < 16; i++) { if (mobilityList % 2 == 1 && !PlayerManager.MyPlayer.Mobility[i]) { slow = true; break; } mobilityList /= 2; } if (slow && player.MovementSpeed > (Enums.MovementSpeed)Maps.MapHelper.ActiveMap.Tile[player.Location.X, player.Location.Y].Data2) { player.MovementSpeed = (Enums.MovementSpeed)Maps.MapHelper.ActiveMap.Tile[player.Location.X, player.Location.Y].Data2; } } int x = player.X; int y = player.Y; switch (player.Direction) { case Enums.Direction.Up: if (GameProcessor.CheckLocked(dir)) { Messenger.SendPlayerCriticalMove(); player.MovementLocked = true; } else { Messenger.SendPlayerMove(); } y -= 1; if (y < 0 && Logic.Graphics.Renderers.Maps.SeamlessWorldHelper.IsMapSeamless(Enums.MapID.Up)) { Maps.Map oldActive = Maps.MapHelper.Maps[Enums.MapID.Active]; Maps.MapHelper.Maps[Enums.MapID.Active] = Maps.MapHelper.Maps[Enums.MapID.Up]; Maps.MapHelper.Maps[Enums.MapID.Down] = oldActive; player.MapID = Maps.MapHelper.Maps[Enums.MapID.Active].MapID; player.Y = Maps.MapHelper.Maps[Enums.MapID.Active].MaxY + 1; Maps.MapHelper.Maps[Enums.MapID.BottomLeft] = Maps.MapHelper.Maps[Enums.MapID.Left]; Maps.MapHelper.Maps[Enums.MapID.Left] = Maps.MapHelper.Maps[Enums.MapID.TopLeft]; Maps.MapHelper.Maps[Enums.MapID.BottomRight] = Maps.MapHelper.Maps[Enums.MapID.Right]; Maps.MapHelper.Maps[Enums.MapID.Right] = Maps.MapHelper.Maps[Enums.MapID.TopRight]; Maps.MapHelper.HandleMapDone(); } if (Maps.MapHelper.ActiveMap.Tile[player.X, player.Y - 1].Type == Enums.TileType.Warp) { Globals.GettingMap = true; } if (Globals.GettingMap == false) { player.Offset = new System.Drawing.Point(player.Offset.X, Constants.TILE_HEIGHT); player.Y -= 1; } else { player.MovementSpeed = Enums.MovementSpeed.Standing; } break; case Enums.Direction.Down: if (GameProcessor.CheckLocked(dir)) { Messenger.SendPlayerCriticalMove(); player.MovementLocked = true; } else { Messenger.SendPlayerMove(); } y += 1; if (y > Maps.MapHelper.Maps[Enums.MapID.Active].MaxY && Logic.Graphics.Renderers.Maps.SeamlessWorldHelper.IsMapSeamless(Enums.MapID.Down)) { Maps.Map oldActive = Maps.MapHelper.Maps[Enums.MapID.Active]; Maps.MapHelper.Maps[Enums.MapID.Active] = Maps.MapHelper.Maps[Enums.MapID.Down]; Maps.MapHelper.Maps[Enums.MapID.Up] = oldActive; player.MapID = Maps.MapHelper.Maps[Enums.MapID.Active].MapID; player.Y = -1; Maps.MapHelper.Maps[Enums.MapID.TopLeft] = Maps.MapHelper.Maps[Enums.MapID.Left]; Maps.MapHelper.Maps[Enums.MapID.Left] = Maps.MapHelper.Maps[Enums.MapID.BottomLeft]; Maps.MapHelper.Maps[Enums.MapID.TopRight] = Maps.MapHelper.Maps[Enums.MapID.Right]; Maps.MapHelper.Maps[Enums.MapID.Right] = Maps.MapHelper.Maps[Enums.MapID.BottomRight]; Maps.MapHelper.HandleMapDone(); } if (Maps.MapHelper.ActiveMap.Tile[player.X, player.Y + 1].Type == Enums.TileType.Warp) { Globals.GettingMap = true; } if (Globals.GettingMap == false) { player.Offset = new System.Drawing.Point(player.Offset.X, Constants.TILE_HEIGHT * -1); player.Y += 1; } else { player.MovementSpeed = Enums.MovementSpeed.Standing; } break; case Enums.Direction.Left: if (GameProcessor.CheckLocked(dir)) { Messenger.SendPlayerCriticalMove(); player.MovementLocked = true; } else { Messenger.SendPlayerMove(); } x -= 1; if (x < 0 && Logic.Graphics.Renderers.Maps.SeamlessWorldHelper.IsMapSeamless(Enums.MapID.Left)) { Maps.Map oldActive = Maps.MapHelper.Maps[Enums.MapID.Active]; Maps.MapHelper.Maps[Enums.MapID.Active] = Maps.MapHelper.Maps[Enums.MapID.Left]; player.MapID = Maps.MapHelper.Maps[Enums.MapID.Active].MapID; Maps.MapHelper.Maps[Enums.MapID.TopRight] = Maps.MapHelper.Maps[Enums.MapID.Up]; Maps.MapHelper.Maps[Enums.MapID.BottomRight] = Maps.MapHelper.Maps[Enums.MapID.Down]; Maps.MapHelper.Maps[Enums.MapID.Up] = Maps.MapHelper.Maps[Enums.MapID.TopLeft]; Maps.MapHelper.Maps[Enums.MapID.Down] = Maps.MapHelper.Maps[Enums.MapID.BottomLeft]; Maps.MapHelper.Maps[Enums.MapID.Right] = oldActive; player.X = Maps.MapHelper.Maps[Enums.MapID.Active].MaxX + 1; Maps.MapHelper.HandleMapDone(); } if (Maps.MapHelper.ActiveMap.Tile[player.X - 1, player.Y].Type == Enums.TileType.Warp) { Globals.GettingMap = true; } if (Globals.GettingMap == false) { player.Offset = new System.Drawing.Point(Constants.TILE_WIDTH, player.Offset.Y); player.X -= 1; } else { player.MovementSpeed = Enums.MovementSpeed.Standing; } break; case Enums.Direction.Right: if (GameProcessor.CheckLocked(dir)) { Messenger.SendPlayerCriticalMove(); player.MovementLocked = true; } else { Messenger.SendPlayerMove(); } x += 1; if (x > Maps.MapHelper.Maps[Enums.MapID.Active].MaxX && Logic.Graphics.Renderers.Maps.SeamlessWorldHelper.IsMapSeamless(Enums.MapID.Right)) { Maps.Map oldActive = Maps.MapHelper.Maps[Enums.MapID.Active]; Maps.MapHelper.Maps[Enums.MapID.Active] = Maps.MapHelper.Maps[Enums.MapID.Right]; player.MapID = Maps.MapHelper.Maps[Enums.MapID.Active].MapID; Maps.MapHelper.Maps[Enums.MapID.TopLeft] = Maps.MapHelper.Maps[Enums.MapID.Up]; Maps.MapHelper.Maps[Enums.MapID.BottomLeft] = Maps.MapHelper.Maps[Enums.MapID.Down]; Maps.MapHelper.Maps[Enums.MapID.Up] = Maps.MapHelper.Maps[Enums.MapID.TopRight]; Maps.MapHelper.Maps[Enums.MapID.Down] = Maps.MapHelper.Maps[Enums.MapID.BottomRight]; Maps.MapHelper.Maps[Enums.MapID.Left] = oldActive; player.X = -1; Maps.MapHelper.HandleMapDone(); } if (Maps.MapHelper.ActiveMap.Tile[player.X + 1, player.Y].Type == Enums.TileType.Warp) { Globals.GettingMap = true; } if (Globals.GettingMap == false) { player.Offset = new System.Drawing.Point(Constants.TILE_WIDTH * -1, player.Offset.Y); player.X += 1; } else { player.MovementSpeed = Enums.MovementSpeed.Standing; } break; } Logic.Graphics.Renderers.Screen.ScreenRenderer.DeactivateOffscreenSprites(); if (player.ID == PlayerManager.MyPlayer.ID) { //PlayerManager.MyPlayer.SetCurrentRoom(); } if (player.MovementSpeed > Enums.MovementSpeed.Standing && player.WalkingFrame == -1) { player.WalkingFrame = 0; player.LastWalkTime = Globals.Tick; } } } } }
public Maps.DungeonRoom GetTargetRoom() { Maps.Map map = Maps.MapHelper.ActiveMap; int targetX = X; int targetY = Y; int x1 = targetX; int y1 = targetY; int blockedCount = 0; int leftXDistance = -1; int rightXDistance = -1; int upYDistance = -1; int downYDistance = -1; int roomStartX = -1; int roomWidth = -1; int roomStartY = -1; int roomHeight = -1; while (true) { // Keep going left until we've hit a wall... x1--; blockedCount = 0; if (x1 < 0) { roomStartX = 0; break; } if (GameProcessor.IsBlocked(map, x1, targetY)) { blockedCount++; } if (GameProcessor.IsBlocked(map, x1, targetY - 1)) { blockedCount++; } if (GameProcessor.IsBlocked(map, x1, targetY + 1)) { blockedCount++; } if (blockedCount == 3 || blockedCount == 2) { // This means that a hallway was found between blocks! leftXDistance = x1; roomStartX = x1; break; } } x1 = targetX; while (true) { // Keep going right until we've hit a wall... x1++; blockedCount = 0; if (x1 > map.MaxX) { roomWidth = map.MaxX - roomStartX; break; } if (GameProcessor.IsBlocked(map, x1, targetY)) { blockedCount++; } if (GameProcessor.IsBlocked(map, x1, targetY - 1)) { blockedCount++; } if (GameProcessor.IsBlocked(map, x1, targetY + 1)) { blockedCount++; } if (blockedCount == 3 || blockedCount == 2) { // This means that a hallway was found between blocks! rightXDistance = x1; roomWidth = (x1 - targetX) + (targetX - roomStartX); break; } } while (true) { // Keep going up until we've hit a wall... y1--; blockedCount = 0; if (y1 < 0) { roomStartY = 0; break; } if (GameProcessor.IsBlocked(map, targetX, y1)) { blockedCount++; } if (GameProcessor.IsBlocked(map, targetX - 1, y1)) { blockedCount++; } if (GameProcessor.IsBlocked(map, targetX + 1, y1)) { blockedCount++; } if (blockedCount == 3 || blockedCount == 2) { // This means that a hallway was found between blocks! upYDistance = y1; roomStartY = y1; break; } } y1 = targetY; while (true) { // Keep going down until we've hit a wall... y1++; blockedCount = 0; if (y1 > map.MaxY) { roomHeight = map.MaxY - roomStartY; break; } if (GameProcessor.IsBlocked(map, targetX, y1)) { blockedCount++; } if (GameProcessor.IsBlocked(map, targetX - 1, y1)) { blockedCount++; } if (GameProcessor.IsBlocked(map, targetX + 1, y1)) { blockedCount++; } if (blockedCount == 3 || blockedCount == 2) { // This means that a hallway was found between blocks! downYDistance = y1; roomHeight = (y1 - targetY) + (targetY - roomStartY); break; } } return(new Maps.DungeonRoom(roomStartX, roomStartY, roomWidth, roomHeight)); }
public Tile(string name, Maps.Map map) : base(name, map) { }
public static void ChangeWeather(Maps.Map map) { #region null weather map.ShowThunder = false; map.Weather = Enums.Weather.Nothing; map.WeatherIntensity = Enums.WeatherIntensity.None; map.WeatherAppearance = Enums.WeatherAppearance.None; map.WeatherDirection = Enums.ConquerAngle.SouthWest; #endregion int amount = ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next(300); if (amount < 100) { #region Small Rain if (amount > 90) { map.Weather = Enums.Weather.Rain; map.WeatherIntensity = Enums.WeatherIntensity.Normal; map.WeatherAppearance = Enums.WeatherAppearance.None; map.WeatherDirection = (Enums.ConquerAngle)ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next(8); if (Calculations.BasicCalculations.ChanceSuccess(25)) { if (map.MapID == 1002 || map.MapID == 1036) // thunder can become annoying in other maps ... { map.ShowThunder = true; } } } #endregion #region Medium Rain else if (amount > 80) { map.Weather = Enums.Weather.Rain; map.WeatherIntensity = Enums.WeatherIntensity.MediumHigh; map.WeatherAppearance = Enums.WeatherAppearance.None; map.WeatherDirection = (Enums.ConquerAngle)ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next(8); if (Calculations.BasicCalculations.ChanceSuccess(50)) { if (map.MapID == 1002 || map.MapID == 1036) // thunder can become annoying in other maps ... { map.ShowThunder = true; } } } #endregion #region Hard Rain else if (amount > 70) { map.Weather = Enums.Weather.Rain; map.WeatherIntensity = Enums.WeatherIntensity.Highest; map.WeatherAppearance = Enums.WeatherAppearance.None; map.WeatherDirection = (Enums.ConquerAngle)ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next(8); if (map.MapID == 1002 || map.MapID == 1036) // thunder can become annoying in other maps ... { map.ShowThunder = true; } } #endregion #region Small Snow else if (amount > 60) { map.Weather = Enums.Weather.Snow; map.WeatherIntensity = Enums.WeatherIntensity.Normal; map.WeatherAppearance = Enums.WeatherAppearance.None; map.WeatherDirection = (Enums.ConquerAngle)ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next(8); } #endregion #region Medium Snow else if (amount > 50) { map.Weather = Enums.Weather.Snow; map.WeatherIntensity = Enums.WeatherIntensity.MediumHigh; map.WeatherAppearance = Enums.WeatherAppearance.None; map.WeatherDirection = (Enums.ConquerAngle)ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next(8); } #endregion #region Hard Snow else if (amount > 40) { map.Weather = Enums.Weather.Snow; map.WeatherIntensity = Enums.WeatherIntensity.Highest; map.WeatherAppearance = Enums.WeatherAppearance.None; map.WeatherDirection = (Enums.ConquerAngle)ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next(8); } #endregion #region Autmn Small else if (amount > 30) { map.Weather = Enums.Weather.AutumnLeaves; map.WeatherIntensity = Enums.WeatherIntensity.Low; map.WeatherAppearance = Enums.WeatherAppearance.None; map.WeatherDirection = (Enums.ConquerAngle)ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next(8); } #endregion #region Authmn Big else if (amount > 20) { map.Weather = Enums.Weather.Snow; map.WeatherIntensity = Enums.WeatherIntensity.Normal; map.WeatherAppearance = Enums.WeatherAppearance.None; map.WeatherDirection = (Enums.ConquerAngle)ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next(8); } #endregion #region Flower Small else if (amount > 10) { map.Weather = Enums.Weather.CherryBlossomPetals; map.WeatherIntensity = Enums.WeatherIntensity.Low; map.WeatherAppearance = Enums.WeatherAppearance.None; map.WeatherDirection = (Enums.ConquerAngle)ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next(8); } #endregion #region Flower Big else { map.Weather = Enums.Weather.CherryBlossomPetals; map.WeatherIntensity = Enums.WeatherIntensity.Normal; map.WeatherAppearance = Enums.WeatherAppearance.None; map.WeatherDirection = (Enums.ConquerAngle)ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next(8); } #endregion } foreach (Maps.IMapObject obj in map.MapObjects.Values) { if (obj is Entities.GameClient) { RemoveWeather((obj as Entities.GameClient)); ShowWeather((obj as Entities.GameClient)); } } }
public override bool LoadFromDB(uint guid, Maps.Map map) { throw new NotImplementedException(); }
public void LoadBot(Enums.BotType BotType, int botid, Maps.MapPoint location, Entities.GameClient Opponent) { switch (BotType) { #region afk bot case Enums.BotType.AFKBot: { using (var sql = new SqlHandler(Program.Config.ReadString("GameConnectionString"))) { using (var cmd = new SqlCommandBuilder(sql, SqlCommandType.SELECT, true)) { cmd.AddWhereValue("BotID", botid); cmd.Finish("DB_Bots"); } if (!sql.Read()) { return; } Original.Name = Core.NameGenerator.GetName(); if (string.IsNullOrEmpty(Original.Name) || string.IsNullOrWhiteSpace(Original.Name)) { return; } Original.Avatar = sql.ReadUInt16("BotAvatar"); Original.Model = sql.ReadUInt16("BotModel"); Original.HairStyle = sql.ReadUInt16("BotHairStyle"); Original.Transformation = sql.ReadUInt16("BotTransformation"); Original.Strength = sql.ReadUInt16("BotStrength"); Original.Agility = sql.ReadUInt16("BotAgility"); Original.Vitality = sql.ReadUInt16("BotVitality"); Original.Spirit = sql.ReadUInt16("BotSpirit"); Original.PKPoints = sql.ReadInt16("BotPKPoints"); Original.Level = sql.ReadByte("BotLevel"); Original.Class = (Enums.Class)Enum.Parse(typeof(Enums.Class), sql.ReadString("BotClass")); Original.PlayerTitle = (Enums.PlayerTitle)Enum.Parse(typeof(Enums.PlayerTitle), sql.ReadString("BotTitle")); Original.Reborns = sql.ReadByte("BotReborns"); Maps.Map map = location.Map; Original.Map = map; Original.LastMapID = Original.Map.MapID; Original.X = location.X; Original.Y = location.Y; Original.LastMapX = location.X; Original.LastMapY = location.Y; Original.LastX = location.X; Original.LastY = location.Y; Original.Action = Enums.ActionType.Sit; Original.Direction = (byte)ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next(8); uint entityuid = (uint)ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next(700000000, 999999999); Original.EntityUID = entityuid; if (!Original.Map.EnterMap(Original)) { return; } uint WeaponR = sql.ReadUInt32("BotWeaponR"); if (WeaponR > 0) { Data.ItemInfo item = Core.Kernel.ItemInfos[WeaponR].Copy(); Original.Equipments.Equip(item, Enums.ItemLocation.WeaponR, false, false); } uint WeaponL = sql.ReadUInt32("BotWeaponL"); if (WeaponL > 0) { Data.ItemInfo item = Core.Kernel.ItemInfos[WeaponL].Copy(); Original.Equipments.Equip(item, Enums.ItemLocation.WeaponL, false, false); } uint Armor = sql.ReadUInt32("BotArmor"); if (Armor > 0) { Data.ItemInfo item = Core.Kernel.ItemInfos[Armor].Copy(); Original.Equipments.Equip(item, Enums.ItemLocation.Armor, false, false); } uint Head = sql.ReadUInt32("BotHead"); if (Head > 0) { Data.ItemInfo item = Core.Kernel.ItemInfos[Head].Copy(); Original.Equipments.Equip(item, Enums.ItemLocation.Head, false, false); } bool UseSteed = sql.ReadBoolean("BotSteed"); if (UseSteed) { uint Steed = sql.ReadUInt32("BotSteedColor"); Data.ItemInfo item = Core.Kernel.ItemInfos[300000].Copy(); item.SocketAndRGB = Steed; Original.Equipments.Equip(item, Enums.ItemLocation.Steed, false, false); uint MountArmor = sql.ReadUInt32("BotMountArmor"); if (MountArmor > 0) { Data.ItemInfo item2 = Core.Kernel.ItemInfos[MountArmor].Copy(); Original.Equipments.Equip(item2, Enums.ItemLocation.SteedArmor, false, false); } Original.Action = Enums.ActionType.None; Original.AddStatusEffect1(Enums.Effect1.Riding); } uint Garment = sql.ReadUInt32("BotGarment"); if (Garment > 0) { Data.ItemInfo item = Core.Kernel.ItemInfos[Garment].Copy(); Original.Equipments.Equip(item, Enums.ItemLocation.Garment, false, false); } Original.LoggedIn = true; } break; } #endregion * #region duel bot case Enums.BotType.DuelBot: { if (Opponent == null) { return; } Original.Name = Core.NameGenerator.GetName(); if (string.IsNullOrEmpty(Original.Name) || string.IsNullOrWhiteSpace(Original.Name)) { return; } Original.Avatar = Opponent.Avatar; Original.Model = Opponent.Model; Original.HairStyle = Opponent.HairStyle; Original.Transformation = 0; Original.Strength = Opponent.Strength; Original.Agility = Opponent.Agility; Original.Vitality = Opponent.Vitality; Original.Spirit = Opponent.Spirit; Original.PKPoints = Opponent.PKPoints; Original.Level = Opponent.Level; Original.Class = Opponent.Class; Original.PlayerTitle = Opponent.PlayerTitle; Original.Reborns = Opponent.Reborns; Maps.Map map = Opponent.Map; Original.Map = map; Original.LastMapID = Original.Map.MapID; Original.X = Opponent.X; Original.Y = Opponent.Y; Original.LastMapX = Opponent.X; Original.LastMapY = Opponent.Y; Original.LastX = Opponent.X; Original.LastY = Opponent.Y; Original.Action = Enums.ActionType.None; Original.Direction = (byte)ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next(8); uint entityuid = (uint)ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next(700000000, 999999999); Original.EntityUID = entityuid; if (!Original.Map.EnterMap(Original)) { return; } Original.Equipments.ForceEquipments(Opponent.Equipments); Original.BaseEntity.CalculateBaseStats(); Original.HP = Original.MaxHP; Original.MP = Original.MaxMP; /* * uint WeaponR = sql.ReadUInt32("BotWeaponR"); * if (WeaponR > 0) * { * Data.ItemInfo item = Core.Kernel.ItemInfos[WeaponR].Copy(); * Original.Equipments.Equip(item, Enums.ItemLocation.WeaponR, false, false); * } * uint WeaponL = sql.ReadUInt32("BotWeaponL"); * if (WeaponL > 0) * { * Data.ItemInfo item = Core.Kernel.ItemInfos[WeaponL].Copy(); * Original.Equipments.Equip(item, Enums.ItemLocation.WeaponL, false, false); * } * uint Armor = sql.ReadUInt32("BotArmor"); * if (Armor > 0) * { * Data.ItemInfo item = Core.Kernel.ItemInfos[Armor].Copy(); * Original.Equipments.Equip(item, Enums.ItemLocation.Armor, false, false); * } * uint Head = sql.ReadUInt32("BotHead"); * if (Head > 0) * { * Data.ItemInfo item = Core.Kernel.ItemInfos[Head].Copy(); * Original.Equipments.Equip(item, Enums.ItemLocation.Head, false, false); * } * bool UseSteed = sql.ReadBoolean("BotSteed"); * if (UseSteed) * { * uint Steed = sql.ReadUInt32("BotSteedColor"); * Data.ItemInfo item = Core.Kernel.ItemInfos[300000].Copy(); * item.SocketAndRGB = Steed; * Original.Equipments.Equip(item, Enums.ItemLocation.Steed, false, false); * * uint MountArmor = sql.ReadUInt32("BotMountArmor"); * if (MountArmor > 0) * { * Data.ItemInfo item2 = Core.Kernel.ItemInfos[MountArmor].Copy(); * Original.Equipments.Equip(item2, Enums.ItemLocation.SteedArmor, false, false); * } * * Original.Action = Enums.ActionType.None; * Original.AddStatusEffect1(Enums.Effect1.Riding); * } * uint Garment = sql.ReadUInt32("BotGarment"); * if (Garment > 0) * { * Data.ItemInfo item = Core.Kernel.ItemInfos[Garment].Copy(); * Original.Equipments.Equip(item, Enums.ItemLocation.Garment, false, false); * }*/ Original.LoggedIn = true; break; } #endregion * } }
public Alien(string name, int max_health, Maps.Map map) : base(name, max_health, map) { }
public Location(GameObject host, Maps.Map map) : base("Location", host) { this.Map = map; }