Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BlockEventArgs"/> class. 
 ///     Initializes a new instance of the <see cref="BlockEventArgs"/>. Send a block changed event.
 /// </summary>
 /// <param name="b">
 /// The block
 /// </param>
 /// <param name="m">
 /// The raw message.
 /// </param>
 /// <param name="origin">
 /// The room where the block originated from.
 /// </param>
 internal BlockEventArgs(Block b, Message m, Room origin = null)
 {
     Origin = origin ?? Bot.CurrentRoom;
     this.placed = b;
     this.placer = b.Placer;
     RawMessage = m;
 }
Ejemplo n.º 2
0
 public RoomPortalBlock(
     int x,
     int y,
     string portalDestination,
     Player placer = null)
     : base(BlockIds.Action.Portals.WORLD, x, y, 0)
 {
     this.PortalDestination = portalDestination;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ChatEventArgs"/> class. 
        ///     The main method where the chat messages are sent. This method sets the properties in
        ///     this class to the speaker and origin of the message, where it is handed off to a delegate
        ///     later.
        /// </summary>
        /// <param name="speaker">
        /// The player who said the message.
        /// </param>
        /// <param name="origin">
        /// The room where the message originated.
        /// </param>
        internal ChatEventArgs(Player speaker, Message m, Room origin, string message)
        {
            this.origin = origin;
            if (this.Origin != null)
            {
                this.Origin.ChatLog = origin.ChatLog;
            }

            this.speaker = speaker;
            this.message = message;
            RawMessage = m;
        }
Ejemplo n.º 4
0
 public PlayerEventArgs(Player subject, Room origin, Message rawMessage)
 {
     this.subject = subject;
     this.origin = origin;
     this.rawMessage = rawMessage;
 }
Ejemplo n.º 5
0
 public BlockEventArgs(Block b, Room origin)
 {
     this.origin = origin;
     this.placed = b;
     this.placer = b.Placer;
 }
Ejemplo n.º 6
0
 public void Teleport(int newXLocation, int newYLocation, Player p = null)
 {
     if (this.Bot.Name == this.R.Owner.Name)
     {
         if (p != null)
         {
             this.Say("/teleport " + p.Name + " " + newXLocation + " " + newYLocation);
         }
         else
         {
             this.Say("/teleport " + this.Bot.Name + " " + newXLocation + " " + newYLocation);
         }
     }
 }
Ejemplo n.º 7
0
 public void SetMute(Player p, bool value)
 {
     if (this.Bot.Name == this.R.Owner.Name)
     {
         if (value)
         {
             this.Say("/mute " + p.Name);
         }
         else
         {
             this.Say("/unmute " + p.Name);
         }
     }
 }
Ejemplo n.º 8
0
 public void SetEdit(Player p)
 {
     if (this.Bot.Name == this.R.Owner.Name)
     {
         this.Say("/giveedit " + p.Name);
     }
 }
Ejemplo n.º 9
0
 public void Respawn(Player p)
 {
     if (this.Bot.Name == this.R.Owner.Name)
     {
         this.Say("/kill " + p.Name);
     }
 }
Ejemplo n.º 10
0
 public void Kick(Player p, string reason = "")
 {
     if (this.Bot.Name == this.R.Owner.Name)
     {
         this.Say("/kick " + p.Name + " " + reason);
     }
 }
Ejemplo n.º 11
0
 public ChatEventArgs(Player speaker, Room origin)
 {
     this.origin = origin;
     this.origin.ChatLog = origin.ChatLog;
     this.speaker = speaker;
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PlayerEventArgs"/> class. 
 ///     The main constructor method.
 /// </summary>
 /// <param name="subject">
 /// The player
 /// </param>
 /// <param name="origin">
 /// The room where the player is originating in.
 /// </param>
 /// <param name="rawMessage">
 /// The raw, unparsed message from the server (concerning player).
 /// </param>
 internal PlayerEventArgs(Player subject, Room origin, Message rawMessage)
 {
     this.Subject = subject;
     this.Origin = origin;
     this.RawMessage = rawMessage;
 }
Ejemplo n.º 13
0
        public int overlaps(Player param1)
        {
            List<int> _loc_8 = new List<int>();

            int _loc_11 = 0;
            if (param1.X < 0 || param1.Y < 0 || param1.X >= this.PlayingIn.Width * 16 - 8 || param1.Y >= this.PlayingIn.Height * 16 - 8)
            {
                return 1;
            }
            Player _loc_2 = this;

            if (_loc_2.IsGod || _loc_2.IsMod)
            {
                return 0;
            }

            double _loc_3 = ((_loc_2.X) / 16);
            double _loc_4 = ((_loc_2.Y) / 16);
            for (int xx = -2; xx < 1; xx++)
            {
                for (int yy = -2; yy < 1; yy++)
                {
                    if (_loc_3 + xx > 0 && _loc_3 + xx < this.PlayingIn.Width && _loc_4 + yy > 0 && _loc_4 + yy <= this.PlayingIn.Height)
                    {
                        for (int xTest = 0; xTest < 16; xTest++)
                        {
                            for (int yTest = 0; yTest < 16; yTest++)
                            {
                                if (hitTest((int)(xTest + _loc_2.X + xx * 16), (int)(yTest + _loc_2.Y + yy * 16)))
                                {
                                    double _loc_9 = _loc_4;
                                    Block currentBlock = this.PlayingIn.Map[
                                        (int)(((xx * 16) + _loc_2.X + xTest) / 16),
                                        (int)(((yy * 16) + _loc_2.Y + yTest) / 16),
                                        0];
                                    _loc_11 = currentBlock.Id;
                                    if (ItemId.IsSolid(_loc_11))
                                    {
                                        switch (_loc_11)
                                        {
                                            case 23:
                                                {
                                                    if (this.PlayingIn.RedActivated)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case 24:
                                                {
                                                    if (this.PlayingIn.GreenActivated)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case 25:
                                                {
                                                    if (this.PlayingIn.BlueActivated)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case 26:
                                                {
                                                    if (!this.PlayingIn.RedActivated)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case 27:
                                                {
                                                    if (!this.PlayingIn.GreenActivated)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case 28:
                                                {
                                                    if (!this.PlayingIn.BlueActivated)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case 156:
                                                {
                                                    if (this.PlayingIn.TimeDoorsVisible)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case 157:
                                                {
                                                    if (!this.PlayingIn.TimeDoorsVisible)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case BlockIds.Action.Doors.Switch:
                                                {
                                                    if (this.purple)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case BlockIds.Action.Gates.Switch:
                                                {
                                                    if (!this.purple)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case BlockIds.Action.Doors.Club:
                                                {
                                                    if (isclubmember)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case BlockIds.Action.Gates.Club:
                                                {
                                                    if (!isclubmember)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case BlockIds.Action.Doors.Coin:
                                                {
                                                    if (currentBlock is CoinBlock && ((CoinBlock)currentBlock).CoinsRequired <= coins)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case BlockIds.Action.Gates.Coin:
                                                {
                                                    if (currentBlock is CoinBlock && ((CoinBlock)currentBlock).CoinsRequired > coins)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case BlockIds.Action.Gates.Zombie:
                                                {
                                                    if (_zombie)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case BlockIds.Action.Doors.Zombie:
                                                {
                                                    if (!_zombie)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case 50:
                                                {
                                                    break;
                                                }
                                            case 61:
                                            case 62:
                                            case 63:
                                            case 64:
                                            case 89:
                                            case 90:
                                            case 91:
                                            case 96:
                                            case 97:
                                            case 122:
                                            case 123:
                                            case 124:
                                            case 125:
                                            case 126:
                                            case 127:
                                            case 146:
                                            case 154:
                                            case 158:
                                            case 194:
                                                {
                                                    if (_loc_2.speedY < 0 || _loc_9 <= _loc_2.overlapy)
                                                    {
                                                        if (_loc_9 != _loc_4 || _loc_2.overlapy == -1)
                                                        {
                                                            _loc_2.overlapy = (int)_loc_9;
                                                        }
                                                        break;
                                                    }
                                                    break;
                                                }
                                            case 83:
                                            case 77:
                                                {
                                                    break;
                                                }
                                            default:
                                                {
                                                    break;
                                                }
                                        }
                                        return _loc_11;
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return 0;
        }
Ejemplo n.º 14
0
 public Player(Room room, int id, string name, int smiley, double xPos, double yPos, bool isGod, bool isMod, bool hasChat, int coins, bool purple, bool isFriend, int level)
 {
     this.PlayingIn = room;
     this.Smiley = smiley;
     this.IsGod = isGod;
     this.IsMod = isMod;
     this.Id = id;
     this.hasChat = hasChat;
     this.Coins = coins;
     this.purple = purple;
     this.isFriend = isFriend;
     this.Level = level;
     this.rect2 = new Rectangle(0, 0, 16, 26);
     this.queue = new Queue<int>(Config.physics_queue_length);
     this.lastJump = new DateTime();
     this.lastPortal = new Point();
     this.that = this as Player;
     this.modrect = new Rectangle(0, 0, 64, 64);
     this.clubrect = new Rectangle(0, 0, 64, 64);
     this._currentThrust = this._maxThrust;
     this.X = xPos;
     this.Y = yPos;
     this.isme = false;
     this.Name = name;
     size = 16;
     width = 16;
     height = 16;
     this._baseDragX = Config.physics_base_drag;
     this._baseDragY = Config.physics_base_drag;
     this._no_modifier_dragX = Config.physics_no_modifier_drag;
     this._no_modifier_dragY = Config.physics_no_modifier_drag;
     this._water_drag = Config.physics_water_drag;
     this._water_buoyancy = Config.physics_water_buoyancy;
     this._mud_drag = Config.physics_mud_drag;
     this._mud_buoyancy = Config.physics_mud_buoyancy;
     this._boost = Config.physics_boost;
     this._gravity = Config.physics_gravity;
     this.mult = Config.physics_variable_multiplyer;
     this.last = DateTime.Now;
     return;
 }