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


C# MabiPacket.PutShort方法代码示例

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


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

示例1: AgeIncrease

        /// <summary>
        /// Sends Age Increase Packet
        /// </summary>
        /// <param name="client"></param>
        /// <param name="creature"></param>
        /// <param name="age"></param>
        public static void AgeIncrease(WorldClient client, MabiPC player, ushort age)
        {
            var p = new MabiPacket(Op.AgeIncrease, player.Id);
            p.PutShort(age);

            client.Send(p);
        }
开发者ID:Fuhhue,项目名称:aura_legacy,代码行数:13,代码来源:Send.Character.cs

示例2: DyeSkillComplete

        /// <summary>
        /// Fixed dye complete
        /// </summary>
        /// <param name="client"></param>
        /// <param name="creature"></param>
        /// <param name="skillId"></param>
        /// <param name="part"></param>
        public static void DyeSkillComplete(Client client, MabiCreature creature, SkillConst skillId, uint part)
        {
            var packet = new MabiPacket(Op.SkillComplete, creature.Id);
            packet.PutShort((ushort)skillId);
            packet.PutInt(part);

            client.Send(packet);
        }
开发者ID:Fuhhue,项目名称:aura_legacy,代码行数:15,代码来源:Send.Skill.cs

示例3: ItemAmount

        /// <summary>
        /// Sends ItemAmount to creature's client.
        /// </summary>
        /// <param name="creature"></param>
        /// <param name="item"></param>
        public static void ItemAmount(MabiCreature creature, MabiItem item)
        {
            var packet = new MabiPacket(Op.ItemAmount, creature.Id);
            packet.PutLong(item.Id);
            packet.PutShort(item.Info.Amount);
            packet.PutByte(2); // ? (related to the 2 in move item?)

            creature.Client.Send(packet);
        }
开发者ID:Fuhhue,项目名称:aura_legacy,代码行数:14,代码来源:Send.Item.cs

示例4: DeadFeather

        /// <summary>
        /// Broadcasts Phoenix Feather above dead creature effect in creature's range.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="creature"></param>
        public static void DeadFeather(MabiCreature creature, DeadMenuOptions options)
        {
            var bits = (uint)options;
            var flags = new List<uint>();

            // Break down options bit by bit, and add them to flags if set.
            for (uint i = 1; bits != 0; ++i, bits >>= 1)
            {
                if ((bits & 1) != 0)
                    flags.Add(i);
            }

            var packet = new MabiPacket(Op.DeadFeather, creature.Id);

            packet.PutShort((ushort)flags.Count);
            foreach (var f in flags)
                packet.PutInt(f);

            packet.PutByte(0);

            WorldManager.Instance.Broadcast(packet, SendTargets.Range, creature);
        }
开发者ID:pjm0616,项目名称:aura,代码行数:27,代码来源:Send.World.cs

示例5: OpenNPCShop

        public static void OpenNPCShop(WorldClient client, MabiShop shop)
        {
            var packet = new MabiPacket(Op.OpenNPCShop, client.Character.Id);
            packet.PutString("shopname");
            packet.PutByte(0);
            packet.PutByte(0);
            packet.PutInt(0);
            packet.PutByte((byte)shop.Tabs.Count);
            for (var i = 0; i < shop.Tabs.Count; ++i)
            {
                packet.PutString("[{0}]{1}", i, shop.Tabs[i].Name);

                // [160200] ?
                {
                    packet.PutByte(0);
                }

                packet.PutShort((ushort)shop.Tabs[i].Items.Count);
                foreach (var item in shop.Tabs[i].Items)
                    packet.AddItemInfo(item, ItemPacketType.Private);
            }
            client.Send(packet);
        }
开发者ID:Fuhhue,项目名称:aura_legacy,代码行数:23,代码来源:Send.NPC.cs

示例6: UseMotion

        /// <summary>
        /// Broadcasts motion use. Also sends MotionCancel, if cancel is true.
        /// </summary>
        public static void UseMotion(MabiCreature creature, uint category, uint type, bool loop = false, bool cancel = false)
        {
            if (cancel)
            {
                // Cancel motion
                var cancelPacket = new MabiPacket(Op.MotionCancel, creature.Id);
                cancelPacket.PutByte(0);
                WorldManager.Instance.Broadcast(cancelPacket, SendTargets.Range, creature);
            }

            // Do motion
            var doPacket = new MabiPacket(Op.UseMotion, creature.Id);
            doPacket.PutInt(category);
            doPacket.PutInt(type);
            doPacket.PutByte(loop);
            doPacket.PutShort(0);

            WorldManager.Instance.Broadcast(doPacket, SendTargets.Range, creature);
        }
开发者ID:pjm0616,项目名称:aura,代码行数:22,代码来源:Send.World.cs

示例7: SkillPrepare

        /// <summary>
        /// Normal skill prepare response, skillId None means fail.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="creature"></param>
        /// <param name="skillId"></param>
        /// <param name="castTime"></param>
        public static void SkillPrepare(Client client, MabiCreature creature, SkillConst skillId, uint castTime)
        {
            var packet = new MabiPacket(Op.SkillPrepare, creature.Id);
            packet.PutShort((ushort)skillId);
            if (skillId != SkillConst.None)
                packet.PutInt(castTime);

            client.Send(packet);
        }
开发者ID:Fuhhue,项目名称:aura_legacy,代码行数:16,代码来源:Send.Skill.cs

示例8: SkillStackSet

        public static void SkillStackSet(Client client, MabiCreature creature, SkillConst skillId, byte stack)
        {
            var packet = new MabiPacket(Op.SkillStackSet, creature.Id);
            packet.PutBytes(creature.ActiveSkillStacks, 1);
            packet.PutShort((ushort)creature.ActiveSkillId);

            client.Send(packet);
        }
开发者ID:Fuhhue,项目名称:aura_legacy,代码行数:8,代码来源:Send.Skill.cs

示例9: RankUp

        /// <summary>
        /// Broadcasts RankUp animation in range of creature.
        /// Only includes skillId if it is > 0.
        /// </summary>
        /// <param name="creature"></param>
        /// <param name="skillId"></param>
        public static void RankUp(MabiCreature creature, ushort skillId = 0)
        {
            var packet = new MabiPacket(Op.RankUp, creature.Id);
            if (skillId > 0)
                packet.PutShort(skillId);
            packet.PutShort(1);

            WorldManager.Instance.Broadcast(packet, SendTargets.Range, creature);
        }
开发者ID:Fuhhue,项目名称:aura_legacy,代码行数:15,代码来源:Send.Character.cs

示例10: CutsceneStart

        public static void CutsceneStart(WorldClient client, MabiCutscene cutscene)
        {
            var p = new MabiPacket(Op.CutsceneStart, Id.World);
            p.PutLongs(client.Character.Id, cutscene.Leader.Id);
            p.PutString(cutscene.Name);
            p.PutSInt(cutscene.Actors.Count);
            foreach (var a in cutscene.Actors)
            {
                p.PutString(a.Item1);
                p.PutShort((ushort)a.Item2.Length);
                p.PutBin(a.Item2);
            }
            p.PutInt(1);
            p.PutLong(client.Character.Id);

            client.Send(p);
        }
开发者ID:Fuhhue,项目名称:aura_legacy,代码行数:17,代码来源:Send.Character.cs

示例11: Prepare

        public override SkillResults Prepare(MabiCreature creature, MabiSkill skill, MabiPacket packet, uint castTime)
        {
            var rnd = RandomProvider.Get();

            // Check for instrument
            if (creature.RightHand == null || creature.RightHand.Type != ItemType.Instrument)
                return SkillResults.Failure;

            // Spawn chair for Cello
            if (creature.RightHand.DataInfo.Instrument == InstrumentType.Cello)
            {
                var pos = creature.GetPosition();

                // Chair prop
                var prop = new MabiProp((!creature.IsGiant ? CelloChair : GiantCelloChair), 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.SittingProp = prop;
            }

            // Score scrolls go into the magazine pocket and need a SCORE tag.
            // XXX: Is it possbile to play random with a low durability scroll?
            bool hasScroll = (creature.Magazine != null && creature.Magazine.Tags.Has("SCORE") && creature.Magazine.OptionInfo.Durability >= DurabilityUse);

            // Random score if no usable scroll was found.
            uint rndScore = (!hasScroll ? (uint)rnd.Next(RandomScoreMin, RandomScoreMax + 1) : 0);

            // Quality seems to go from 0 (worst) to 3 (best).
            // Should be generated based on skills + random.
            var quality = (PlayingQuality)rnd.Next((int)PlayingQuality.VeryBad, (int)PlayingQuality.VeryGood + 1);

            // Up quality by chance, based on Musical Knowledge
            var knowledge = creature.Skills.Get(SkillConst.MusicalKnowledge);
            if (knowledge != null && rnd.Next(0, 100) < knowledge.RankInfo.Var2)
                quality++;

            if (quality > PlayingQuality.VeryGood)
                quality = PlayingQuality.VeryGood;

            // Save quality before checking perfect play option,
            // we want proper skill training.
            creature.Temp.PlayingInstrumentQuality = quality;

            if (WorldConf.PerfectPlay)
            {
                quality = PlayingQuality.VeryGood;
                Send.ServerMessage(creature.Client, creature, Localization.Get("skills.perfect_play")); // Regardless of the result, perfect play will let your performance sound perfect.
            }

            // Reduce scroll's durability.
            if (hasScroll)
            {
                creature.Magazine.ReduceDurability(DurabilityUse);
                creature.Client.Send(
                    new MabiPacket(Op.ItemDurabilityUpdate, creature.Id)
                    .PutLong(creature.Magazine.Id)
                    .PutInt(creature.Magazine.OptionInfo.Durability)
                );
            }

            // Music effect
            {
                var effect = hasScroll
                    ? PacketCreator.PlayEffect(creature, creature.RightHand.DataInfo.Instrument, quality, creature.Magazine.Tags["SCORE"])
                    : PacketCreator.PlayEffect(creature, creature.RightHand.DataInfo.Instrument, quality, rndScore);
                WorldManager.Instance.Broadcast(effect, SendTargets.Range, creature);
            }

            // Use skill
            {
                var use = new MabiPacket(Op.SkillUse, creature.Id);
                use.PutShort(skill.Info.Id);
                use.PutLong(0);
                use.PutByte(hasScroll);
                if (!hasScroll)
                    use.PutInt(rndScore);
                else
                    use.PutString(creature.Magazine.Tags["SCORE"]);
                use.PutByte((byte)creature.RightHand.DataInfo.Instrument);
                use.PutByte(1);
                use.PutByte(0);
                creature.Client.Send(use);

                creature.ActiveSkillId = skill.Id;
            }

            // Change motion for Battle Mandolin (no idea if this official, but I like it =P) [exec]
            //if (creature.RightHand.Info.Class == 40367)
            //    WorldManager.Instance.CreatureUseMotion(creature, 88, 2, true);

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

示例12: SkillUseDye

        /// <summary>
        /// Fixed dye use complete.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="creature"></param>
        /// <param name="skillId"></param>
        /// <param name="part"></param>
        /// <param name="unk"></param>
        public static void SkillUseDye(Client client, MabiCreature creature, SkillConst skillId, uint part, byte unk)
        {
            var packet = new MabiPacket(Op.SkillUse, creature.Id);
            packet.PutShort((ushort)skillId);
            packet.PutInt(part);
            packet.PutByte(unk);

            client.Send(packet);
        }
开发者ID:Fuhhue,项目名称:aura_legacy,代码行数:17,代码来源:Send.Skill.cs

示例13: SkillUse

        /// <summary>
        /// Skill use with a delay?
        /// </summary>
        /// <param name="client"></param>
        /// <param name="creature"></param>
        /// <param name="skillId"></param>
        /// <param name="ms"></param>
        /// <param name="unk"></param>
        public static void SkillUse(Client client, MabiCreature creature, SkillConst skillId, uint ms, uint unk)
        {
            var packet = new MabiPacket(Op.SkillUse, creature.Id);
            packet.PutShort((ushort)skillId);
            packet.PutInts(ms, unk);

            client.Send(packet);
        }
开发者ID:Fuhhue,项目名称:aura_legacy,代码行数:16,代码来源:Send.Skill.cs

示例14: SkillStop

        /// <summary>
        /// Sends SkillStop to creature's client.
        /// </summary>
        /// <param name="creature"></param>
        /// <param name="skillId"></param>
        /// <param name="parameter"></param>
        public static void SkillStop(MabiCreature creature, SkillConst skillId, string parameter)
        {
            var packet = new MabiPacket(Op.SkillStop, creature.Id);
            packet.PutShort((ushort)skillId);
            packet.PutString(parameter);

            creature.Client.Send(packet);
        }
开发者ID:Fuhhue,项目名称:aura_legacy,代码行数:14,代码来源:Send.Skill.cs

示例15: SkillStackUpdate

        /// <summary>
        /// Updates the stack amount (how many uses left).
        /// </summary>
        /// <param name="creature"></param>
        /// <param name="skillId"></param>
        /// <param name="remaining"></param>
        /// <param name="max"></param>
        public static void SkillStackUpdate(Client client, MabiCreature creature, SkillConst skillId, byte remaining)
        {
            var packet = new MabiPacket(Op.SkillStackUpdate, creature.Id);
            packet.PutBytes(remaining, 1, 0);
            packet.PutShort((ushort)skillId);

            client.Send(packet);
        }
开发者ID:Fuhhue,项目名称:aura_legacy,代码行数:15,代码来源:Send.Skill.cs


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