当前位置: 首页>>代码示例>>C#>>正文


C# MabiCreature.GetItem方法代码示例

本文整理汇总了C#中Aura.World.World.MabiCreature.GetItem方法的典型用法代码示例。如果您正苦于以下问题:C# MabiCreature.GetItem方法的具体用法?C# MabiCreature.GetItem怎么用?C# MabiCreature.GetItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Aura.World.World.MabiCreature的用法示例。


在下文中一共展示了MabiCreature.GetItem方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Prepare

        public override SkillResults Prepare(MabiCreature creature, MabiSkill skill, MabiPacket packet, uint castTime)
        {
            var itemId = packet.GetLong();
            var title = packet.GetString();
            var author = packet.GetString();
            var mml = packet.GetString();
            var singing = packet.GetString(); // [180300, NA166 (18.09.2013)] Singing
            var hidden = packet.GetByte();

            var item = creature.GetItem(itemId);
            if (item == null)
                return SkillResults.Failure;

            var mmlParts = mml.Split(',');

            // Check total score length
            if (mml.Length > MMLMaxLength)
                return SkillResults.Failure;
            // Melody length
            if (mmlParts[0].Length > skill.RankInfo.Var1)
                return SkillResults.Failure;
            // Harmony 1 length
            if (mmlParts.Length > 1 && mmlParts[1].Length > skill.RankInfo.Var2)
                return SkillResults.Failure;
            // Harmony 2 length
            if (mmlParts.Length > 2 && mmlParts[2].Length > skill.RankInfo.Var3)
                return SkillResults.Failure;

            creature.Temp.SkillItem1 = item;

            var level = SkillRank.Novice;

            // Score level = Musical Knowledge rank
            var knowledge = creature.Skills.Get(SkillConst.MusicalKnowledge);
            if (knowledge != null)
                level = knowledge.Rank;

            item.Tags.SetString("TITLE", title);
            item.Tags.SetString("AUTHOR", author);
            item.Tags.SetString("SCORE", MabiZip.Compress(mml));
            item.Tags.SetString("SCSING", ""); // [180300, NA166 (18.09.2013)] Singing
            item.Tags.SetByte("HIDDEN", hidden);
            item.Tags.SetShort("LEVEL", (ushort)level);

            Send.SkillUse(creature.Client, creature, skill.Id, itemId);

            return SkillResults.Okay;
        }
开发者ID:pjm0616,项目名称:aura,代码行数:48,代码来源:MusicSkillHandlers.cs

示例2: Start

        public override SkillResults Start(MabiCreature creature, MabiSkill skill, MabiTags tags)
        {
            ulong chairOId = 0;
            if (tags.Has("ITEMID"))
                chairOId = (ulong)tags.Get("ITEMID");

            if (chairOId > 0)
            {
                // Check item
                var item = creature.GetItem(chairOId);
                if (item != null && item.Type == ItemType.Misc)
                {
                    // Get chair prop id
                    var propId = 0u;
                    var chairInfo = MabiData.ChairDb.Find(item.Info.Class);
                    if (chairInfo != null)
                        propId = (!creature.IsGiant ? chairInfo.PropId : chairInfo.GiantPropId);

                    var pos = creature.GetPosition();

                    // Effect
                    if (chairInfo.Effect != 0)
                        Send.Effect(chairInfo.Effect, creature, true);

                    // Chair prop
                    var prop = new MabiProp(propId, creature.Region, pos.X, pos.Y, MabiMath.DirToRad(creature.Direction));
                    prop.State = "stand";
                    WorldManager.Instance.AddProp(prop);

                    // Move char
                    Send.AssignChair(creature, prop.Id, 1);

                    // Update chair
                    prop.ExtraData = string.Format("<xml OWNER='{0}' SITCHAR='{0}'/>", creature.Id);
                    Send.PropUpdate(prop);

                    creature.Temp.CurrentChair = chairInfo;
                    creature.Temp.SittingProp = prop;
                }
            }

            creature.State |= CreatureStates.SitDown;
            Send.SitDown(creature);

            SkillHelper.GiveSkillExp(creature, skill, 20);

            return SkillResults.Okay;
        }
开发者ID:pjm0616,项目名称:aura,代码行数:48,代码来源:RestHandler.cs

示例3: Prepare

        public override SkillResults Prepare(MabiCreature creature, MabiSkill skill, MabiPacket packet, uint castTime)
        {
            // Check item id parameter
            var parameters = packet.GetString();
            var itemOId = MabiTags.Fetch<ulong>("ITEMID", parameters);
            if (itemOId == 0)
                return SkillResults.Failure;

            // Check item
            var item = creature.GetItem(itemOId);
            if (item == null)
                return SkillResults.Failure;

            creature.Temp.SkillItem1 = item;

            Send.SkillReady(creature.Client, creature, skill.Id, "");

            return SkillResults.Okay;
        }
开发者ID:pjm0616,项目名称:aura,代码行数:19,代码来源:ResurrectionlHandler.cs


注:本文中的Aura.World.World.MabiCreature.GetItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。