Esempio n. 1
0
        public int overlaps(SynchronizedObject param1)
        {
            List<int> _loc_8 = new List<int>();
            //int _loc_10 = 0;
            int _loc_11 = 0;
            if (param1.x < 0 || param1.y < 0 || param1.x >= bot.Room.Width * 16 - 8 || param1.y >= bot.Room.Height * 16 - 8)
            {
                //
                //WriteLine("returning 1, worldborder, " + name + " " + param1.x / 16 + " " + param1.y / 16);
                return 1;
            }
            //else
            //Console.WriteLine("NOT returning 1, worldborder, " + name + " " + param1.x / 16 + " " + param1.y / 16);
            PhysicsPlayer _loc_2 = this;

            if (_loc_2.isgod || _loc_2.ismod)
            {
                //Console.WriteLine("returning 0, isgod");
                return 0;
            }

            double _loc_3 = ((_loc_2.x) / 16);
            double _loc_4 = ((_loc_2.y) / 16);
            //double _loc_5 = (param1.x + param1.height) / 16;
            //Console.WriteLine(_loc_3 + " - "  +_loc_5);
            //double _loc_6 = (param1.y + param1.width) / 16;
            //bool _loc_7 = false;
            for (int xx = -2; xx < 1; xx++)
            {
                for (int yy = -2; yy < 1; yy++)
                {
                    if (_loc_3 + xx > 0 && _loc_3 + xx < bot.Room.Width && _loc_4 + yy > 0 && _loc_4 + yy <= bot.Room.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;

                                    IBlock currentBlock = bot.Room.getBlock(0, (int)(((xx * 16) + _loc_2.x + xTest) / 16), (int)(((yy * 16) + _loc_2.y + yTest) / 16));
                                    if (currentBlock == null)
                                        continue;
                                    _loc_11 = currentBlock.Id;

                                    if (ItemId.isSolid(_loc_11))
                                    {
                                        switch (_loc_11)
                                        {
                                            case 23:
                                                {
                                                    if (bot.Room.HideRed)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case 24:
                                                {
                                                    if (bot.Room.HideGreen)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case 25:
                                                {
                                                    if (bot.Room.HideBlue)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case 26:
                                                {
                                                    if (!bot.Room.HideRed)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case 27:
                                                {
                                                    if (!bot.Room.HideGreen)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case 28:
                                                {
                                                    if (!bot.Room.HideBlue)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case 156:
                                                {
                                                    if (bot.Room.HideTimeDoor)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case 157:
                                                {
                                                    if (!bot.Room.HideTimeDoor)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case ItemId.DOOR_PURPLE:
                                                {
                                                    if (this.purple)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case ItemId.GATE_PURPLE:
                                                {
                                                    if (!this.purple)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case ItemId.DOOR_CLUB:
                                                {
                                                    if (isclubmember)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case ItemId.GATE_CLUB:
                                                {
                                                    if (!isclubmember)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case ItemId.COINDOOR:
                                                {
                                                    if (currentBlock is BlockCoinDoor && ((BlockCoinDoor)currentBlock).coins <= coins)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case ItemId.COINGATE:
                                                {
                                                    if (currentBlock is BlockCoinGate && ((BlockCoinGate)currentBlock).coins > coins)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case ItemId.ZOMBIE_GATE:
                                                {
                                                    if (_zombie)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case ItemId.ZOMBIE_DOOR:
                                                {
                                                    if (!_zombie)
                                                    {
                                                        continue;
                                                    }
                                                    break;
                                                }
                                            case 50:
                                                {
                                                    /*if (_loc_2.isme)
                                                    {
                                                        knownSecrets[_loc_10 + "x" + _loc_9] = true;
                                                    }*/
                                                    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;
                                                        }
                                                        //_loc_7 = true;
                                                        break;
                                                    }
                                                    break;
                                                }
                                            case 83:
                                            case 77:
                                                {
                                                    break;
                                                }
                                            default:
                                                {
                                                    break;
                                                }
                                        }
                                        return _loc_11;
                                    }
                                }
                            }
                        }
                    }
                }
            }

            //_loc_11 = Form1.blockMap[_loc_3, _loc_4].ID;
            /*while (_loc_9 < _loc_6)
            {

                _loc_8.Clear();
                for (int i = 0; i < Form1.worldSize.X; i++)
                {
                    _loc_8.Add(Form1.blockMap[i, _loc_9].ID);
                }
                _loc_10 = _loc_3;
                while (_loc_10 < _loc_5)
                {
                    if (_loc_8.Count != 0)
                    {
                        _loc_11 = _loc_8[_loc_10];
                        if (ItemId.isSolid(_loc_11))
                        {
                            switch(_loc_11)
                            {
                                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 = _loc_9;
                                        }
                                        _loc_7 = true;
                                        break;
                                    }
                                    break;
                                }
                                case 83:
                                case 77:
                                {
                                    break;
                                }
                                default:
                                {
                                    break;
                                }
                            }
                            if (_loc_11 != 9)
                            Console.WriteLine("returning " + _loc_11 + ", collision");
                            return _loc_11;
                        }
                    }
                    _loc_10++;
                }
                _loc_9++;
            }
            if (!_loc_7)
            {
                _loc_2.overlapy = -1;
            }*/
            return 0;
        }
Esempio n. 2
0
 public PhysicsPlayer(IBot bot, int id, string name, int smiley, double xPos, double yPos, bool isGod, bool isMod, bool hasChat, int coins, bool purple, bool isFriend, int level)
     : base(null, 16)
 {
     this.bot = bot;
     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.Ding = Player_Ding;
     //this.Crown = Player_Crown;
     //this.CrownSilver = Player_CrownSilver;
     //this.Aura = Player_Aura;
     //this.ModAura = Player_ModAura;
     //this.FireAura = Player_FireAura;
     //this.LevitationEffect = Player_LevitationEffect;
     //this.ding = new this.Ding();
     //this.crown = new this.Crown().bitmapData;
     //this.crown_silver = new this.CrownSilver().bitmapData;
     //this.aura = new this.Aura().bitmapData;
     //this.modaura = new this.ModAura().bitmapData;
     ///this.fireAura = new this.FireAura().bitmapData;
     //this.invulnerableAura = AnimationManager.animProtection;
     //this.levitationAnimaitonBitmapData = new this.LevitationEffect().bitmapData;
     //this.clubaura = AnimationManager.animClubAura;
     this.rect2 = new Rectangle(0, 0, 16, 26);
     //this.fireAnimation = new BlSprite(this.fireAura, 0, 0, 26, 26, 6);
     //this.protectionAnimation = new BlSprite(this.invulnerableAura, 0, 0, 26, 26, 24);
     //this.levitationAnimation = new BlSprite(this.levitationAnimaitonBitmapData, 0, 0, 26, 26, 32);
     this.queue = new Queue<int>(Config.physics_queue_length);
     this.lastJump = new DateTime();
     this.lastPortal = new Point();
     this.that = this as SynchronizedObject;
     this.modrect = new Rectangle(0, 0, 64, 64);
     this.clubrect = new Rectangle(0, 0, 64, 64);
     //this.touchpotions = {};
     this._currentThrust = this._maxThrust;
     //super(ItemManager.smiliesBMD);
     //this.state = param5;
     //this.connection = param4;
     //this.world = param1;
     //this.hitmap = param1;
     this.x = xPos;
     this.y = yPos;
     this.isme = false;
     this.name = name;
     //this.chat = new Chat(param2.indexOf(" ") != -1 ? ("") : (param2));
     size = 16;
     width = 16;
     height = 16;
     return;
 }