示例#1
0
        private Model getAnimatedModel()
        {
            if (npcAppearance != null)
            {
                int frameId = -1;
                if (base.animation >= 0 && base.animationDelay == 0)
                {
                    frameId = AnimationSequence.animations[base.animation].primaryFrames[base.currentAnimationFrame];
                }
                else if (base.queuedAnimationId >= 0)
                {
                    frameId = AnimationSequence.animations[base.queuedAnimationId].primaryFrames[base.queuedAnimationFrame];
                }
                Model model = npcAppearance.getChildModel(-1, frameId, null);
                return(model);
            }

            long l  = appearanceOffset;
            int  k  = -1;
            int  i1 = -1;
            int  j1 = -1;
            int  k1 = -1;

            if (base.animation >= 0 && base.animationDelay == 0)
            {
                AnimationSequence animation = AnimationSequence.animations[base.animation];
                k = animation.primaryFrames[base.currentAnimationFrame];
                if (base.queuedAnimationId >= 0 && base.queuedAnimationId != base.standAnimationId)
                {
                    i1 = AnimationSequence.animations[base.queuedAnimationId].primaryFrames[base.queuedAnimationFrame];
                }
                if (animation.playerReplacementShield >= 0)
                {
                    j1 = animation.playerReplacementShield;
                    l += j1 - appearance[5] << 40;
                }

                if (animation.playerReplacementWeapon >= 0)
                {
                    k1 = animation.playerReplacementWeapon;
                    l += k1 - appearance[3] << 48;
                }
            }
            else if (base.queuedAnimationId >= 0)
            {
                k = AnimationSequence.animations[base.queuedAnimationId].primaryFrames[base.queuedAnimationFrame];
            }

            Model model_1 = (Model)mruNodes.get(l);

            if (model_1 == null)
            {
                bool flag = false;
                for (int i2 = 0; i2 < 12; i2++)
                {
                    int k2 = appearance[i2];
                    if (k1 >= 0 && i2 == 3)
                    {
                        k2 = k1;
                    }
                    if (j1 >= 0 && i2 == 5)
                    {
                        k2 = j1;
                    }
                    if (k2 >= 256 && k2 < 512 && !IdentityKit.cache[k2 - 256].bodyModelCached())
                    {
                        flag = true;
                    }
                    if (k2 >= 512 && !ItemDefinition.getDefinition(k2 - 512).equipModelCached(gender))
                    {
                        flag = true;
                    }
                }

                if (flag)
                {
                    if (aLong1697 != -1L)
                    {
                        model_1 = (Model)mruNodes.get(aLong1697);
                    }
                    if (model_1 == null)
                    {
                        return(null);
                    }
                }
            }

            if (model_1 == null)
            {
                Model[] models = new Model[12];
                int     j2     = 0;
                for (int l2 = 0; l2 < 12; l2++)
                {
                    int i3 = appearance[l2];
                    if (k1 >= 0 && l2 == 3)
                    {
                        i3 = k1;
                    }
                    if (j1 >= 0 && l2 == 5)
                    {
                        i3 = j1;
                    }
                    if (i3 >= 256 && i3 < 512)
                    {
                        Model model_3 = IdentityKit.cache[i3 - 256].getBodyModel();
                        if (model_3 != null)
                        {
                            models[j2++] = model_3;
                        }
                    }

                    if (i3 >= 512)
                    {
                        Model model_4 = ItemDefinition.getDefinition(i3 - 512).getEquippedModel(gender);
                        if (model_4 != null)
                        {
                            models[j2++] = model_4;
                        }
                    }
                }

                model_1 = new Model(j2, models);
                for (int part = 0; part < 5; part++)
                {
                    if (bodyPartColour[part] != 0)
                    {
                        model_1.recolour(ConstantData.GetAppearanceColor(part, 0),
                                         ConstantData.GetAppearanceColor(part, bodyPartColour[part]));
                        if (part == 1)
                        {
                            model_1.recolour(ConstantData.GetBeardColor(0), ConstantData.GetBeardColor(bodyPartColour[part]));
                        }
                    }
                }

                model_1.createBones();
                model_1.applyLighting(64, 850, -30, -50, -30, true);
                mruNodes.put(model_1, l);
                aLong1697 = l;
            }

            if (preventRotation)
            {
                return(model_1);
            }
            Model model_2 = Model.aModel_1621;

            model_2.replaceWithModel(model_1, Animation.isNullFrame(k) & Animation.isNullFrame(i1));
            if (k != -1 && i1 != -1)
            {
                model_2.mixAnimationFrames(AnimationSequence.animations[base.animation].flowControl, i1, k);
            }
            else if (k != -1)
            {
                model_2.applyTransformation(k);
            }
            model_2.calculateDiagonals();
            model_2.triangleSkin = null;
            model_2.vertexSkin   = null;
            return(model_2);
        }
示例#2
0
        public Model getHeadModel()
        {
            if (!visible)
            {
                return(null);
            }
            if (npcAppearance != null)
            {
                return(npcAppearance.getHeadModel());
            }
            bool flag = false;

            for (int i = 0; i < 12; i++)
            {
                int j = appearance[i];
                if (j >= 256 && j < 512 && !IdentityKit.cache[j - 256].headModelCached())
                {
                    flag = true;
                }
                if (j >= 512 && !ItemDefinition.getDefinition(j - 512).isDialogueModelCached(gender))
                {
                    flag = true;
                }
            }

            if (flag)
            {
                return(null);
            }
            Model[] models = new Model[12];
            int     k      = 0;

            for (int l = 0; l < 12; l++)
            {
                int i1 = appearance[l];
                if (i1 >= 256 && i1 < 512)
                {
                    Model model_1 = IdentityKit.cache[i1 - 256].getHeadModel();
                    if (model_1 != null)
                    {
                        models[k++] = model_1;
                    }
                }

                if (i1 >= 512)
                {
                    Model model_2 = ItemDefinition.getDefinition(i1 - 512).getDialogueModel(gender);
                    if (model_2 != null)
                    {
                        models[k++] = model_2;
                    }
                }
            }

            Model model = new Model(k, models);

            for (int j1 = 0; j1 < 5; j1++)
            {
                if (bodyPartColour[j1] != 0)
                {
                    model.recolour(ConstantData.GetAppearanceColor(j1, 0), ConstantData.GetAppearanceColor(j1, bodyPartColour[j1]));
                    if (j1 == 1)
                    {
                        model.recolour(ConstantData.GetBeardColor(0), ConstantData.GetBeardColor(bodyPartColour[j1]));
                    }
                }
            }

            return(model);
        }