Esempio n. 1
0
	    public Npc(int id) {
		    this.id = id;
            npcDef = NpcData.forId(id);
            skills = new NpcSkills(this);
            skills.setMaxLevel(NpcSkills.SKILL.HITPOINTS, npcDef.getHitpoints()); //this must be first.
            skills.setCurLevel(NpcSkills.SKILL.HITPOINTS, npcDef.getHitpoints());
		    this.setWalkType(WalkType.RANGE);
		    this.faceDirection = FaceDirection.NORTH;
            this.updateFlags = new AppearanceUpdateFlags(this);
	    }
Esempio n. 2
0
        private static void appendUpdateBlock(Player p, PacketBuilder updateBlock, bool forceAppearance)
        {
            int mask = 0x0;

            AppearanceUpdateFlags flags = p.getUpdateFlags();

            if (flags.isChatTextUpdateRequired())
            {
                mask |= 0x80;
            }
            if (flags.isHitUpdateRequired())
            {
                mask |= 0x1;
            }
            if (flags.isEntityFocusUpdateRequired())
            {
                mask |= 0x2;
            }
            if (flags.isAppearanceUpdateRequired() || forceAppearance)
            {
                mask |= 0x4;
            }
            if (flags.isAnimationUpdateRequired())
            {
                mask |= 0x8;
            }
            if (flags.isForceTextUpdateRequired())
            {
                mask |= 0x20;
            }
            if (flags.isFaceLocationUpdateRequired())
            {
                mask |= 0x40;
            }
            if (flags.isGraphicsUpdateRequired())
            {
                mask |= 0x100;
            }
            if (flags.isHit2UpdateRequired())
            {
                mask |= 0x200;
            }
            if (flags.isForceMovementRequired())
            {
                mask |= 0x400; //mask |= 0x800;
            }

            if (mask >= 0x100) //0x100=256 [full byte], so use two bytes.
            {
                mask |= 0x10;
                updateBlock.addLEShort(mask);

                //updateBlock.addByte((byte)(mask & 0xFF));
                //updateBlock.addByte((byte)(mask >> 8));
            }
            else
            {
                updateBlock.addByte((byte)(mask & 0xFF));
            }

            if (flags.isChatTextUpdateRequired())
            {
                appendChatTextUpdate(p, updateBlock);
            }
            if (flags.isHitUpdateRequired())
            {
                appendHitUpdate(p, updateBlock);
            }
            if (flags.isAnimationUpdateRequired())
            {
                appendAnimationUpdate(p, updateBlock);
            }
            if (flags.isAppearanceUpdateRequired() || forceAppearance)
            {
                appendAppearanceUpdate(p, updateBlock);
            }
            if (flags.isEntityFocusUpdateRequired())
            {
                appendFaceEntityUpdate(p, updateBlock);
            }
            if (flags.isForceMovementRequired())
            {
                appendForceMovement(p, updateBlock);
            }
            if (flags.isForceTextUpdateRequired())
            {
                appendForceTextUpdate(p, updateBlock);
            }
            if (flags.isHit2UpdateRequired())
            {
                appendHit2Update(p, updateBlock);
            }
            if (flags.isGraphicsUpdateRequired())
            {
                appendGraphicsUpdate(p, updateBlock);
            }
            if (flags.isFaceLocationUpdateRequired())
            {
                appendFaceLocationUpdate(p, updateBlock);
            }
        }
Esempio n. 3
0
 public Player(Connection connection)
 {
     this.connection = connection; //without this, new Packets(this); wouldn't function.
     if(connection != null)
         loginDetails = connection.getLoginDetails();
     appearance = new Appearance();
     follow = new Follow(this);
     bank = new Bank(this);
     inventory = new Inventory(this);
     equipment = new Equipment(this);
     friends = new Friends(this);
     prayers = new Prayers(this);
     skills = new Skills(this);
     attackStyle = new AttackStyle();
     packets = new Packets(this);
     localEnvironment = new LocalEnvironment(this);
     updateFlags = new AppearanceUpdateFlags(this);
     walkingQueue = new WalkingQueue(this);
     specialAttack = new SpecialAttack(this);
     chat = true;
     split = false;
     mouse = true;
     aid = false;
     magicType = 1;
     achievementDiaryTab = false;
     forgeCharge = 40;
     smallPouchAmount = 0;
     mediumPouchAmount = 0;
     largePouchAmount = 0;
     giantPouchAmount = 0;
     defenderWave = 0;
     autoRetaliate = false;
     vengeance = false;
     lastVengeanceTime = 0;
     poisonAmount = 0;
     specialAmount = 100;
     skullCycles = 0;
     prayerPoints = 1;
     recoilCharges = 40;
     barrowTunnel = -1;
     barrowKillCount = 0;
     barrowBrothersKilled = new bool[6];
     slayerPoints = 0;
     removedSlayerTasks = new string[4];
     for (int i = 0; i < removedSlayerTasks.Length; i++)
     {
         removedSlayerTasks[i] = "-";
     }
     agilityArenaStatus = 0;
     taggedLastAgilityPillar = false;
     paidAgilityArena = false;
     teleblockTime = 0;
     lastHit = -1;
     superAntipoisonCycles = 0;
     antifireCycles = 0;
     tradeRequests = new List<Player>();
     duelRequests = new List<Player>();
 }