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


C# MabiPacket.PutSInt方法代码示例

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


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

示例1: StatUpdate

        public static MabiPacket StatUpdate(MabiCreature creature, StatUpdateType type, params Stat[] stats)
        {
            var packet = new MabiPacket((type & StatUpdateType.Public) != 0 ? Op.StatUpdatePublic : Op.StatUpdatePrivate, creature.Id);

            packet.PutByte((byte)type);

            // Stats
            packet.PutSInt(stats.Length);
            foreach (var stat in stats)
            {
                packet.PutInt((uint)stat);
                switch (stat)
                {
                    case Stat.Height: packet.PutFloat(creature.Height); break;
                    case Stat.Weight: packet.PutFloat(creature.Weight); break;
                    case Stat.Upper: packet.PutFloat(creature.Upper); break;
                    case Stat.Lower: packet.PutFloat(creature.Lower); break;

                    case Stat.CombatPower: packet.PutFloat(creature.CombatPower); break;
                    case Stat.Level: packet.PutShort(creature.Level); break;
                    case Stat.AbilityPoints: packet.PutShort(creature.AbilityPoints); break;
                    case Stat.Experience: packet.PutLong(MabiData.ExpDb.CalculateRemaining(creature.Level, creature.Experience) * 1000); break;

                    case Stat.Life: packet.PutFloat(creature.Life); break;
                    case Stat.LifeMax: packet.PutFloat(creature.LifeMaxBaseTotal); break;
                    case Stat.LifeMaxMod: packet.PutFloat(creature.StatMods.GetMod(Stat.LifeMaxMod)); break;
                    case Stat.LifeInjured: packet.PutFloat(creature.LifeInjured); break;
                    case Stat.Mana: packet.PutFloat(creature.Mana); break;
                    case Stat.ManaMax: packet.PutFloat(creature.ManaMaxBaseTotal); break;
                    case Stat.ManaMaxMod: packet.PutFloat(creature.StatMods.GetMod(Stat.ManaMaxMod)); break;
                    case Stat.Stamina: packet.PutFloat(creature.Stamina); break;
                    case Stat.Food: packet.PutFloat(creature.StaminaHunger); break;
                    case Stat.StaminaMax: packet.PutFloat(creature.StaminaMaxBaseTotal); break;
                    case Stat.StaminaMaxMod: packet.PutFloat(creature.StatMods.GetMod(Stat.StaminaMaxMod)); break;

                    case Stat.StrMod: packet.PutFloat(creature.StatMods.GetMod(Stat.StrMod)); break;
                    case Stat.DexMod: packet.PutFloat(creature.StatMods.GetMod(Stat.DexMod)); break;
                    case Stat.IntMod: packet.PutFloat(creature.StatMods.GetMod(Stat.IntMod)); break;
                    case Stat.LuckMod: packet.PutFloat(creature.StatMods.GetMod(Stat.LuckMod)); break;
                    case Stat.WillMod: packet.PutFloat(creature.StatMods.GetMod(Stat.WillMod)); break;
                    case Stat.Str: packet.PutFloat(creature.StrBaseTotal); break;
                    case Stat.Int: packet.PutFloat(creature.IntBaseTotal); break;
                    case Stat.Dex: packet.PutFloat(creature.DexBaseTotal); break;
                    case Stat.Will: packet.PutFloat(creature.WillBaseTotal); break;
                    case Stat.Luck: packet.PutFloat(creature.LuckBaseTotal); break;

                    case Stat.DefenseBaseMod: packet.PutShort((ushort)creature.DefensePassive); break;
                    case Stat.ProtectBaseMod: packet.PutFloat(creature.ProtectionPassive * 100); break;

                    case Stat.DefenseMod: packet.PutShort((ushort)creature.StatMods.GetMod(Stat.DefenseMod)); break;
                    case Stat.ProtectMod: packet.PutFloat(creature.StatMods.GetMod(Stat.ProtectMod)); break;

                    // Client might crash with a mismatching value,
                    // take a chance and put an int by default.
                    default: packet.PutInt(1); break;
                }
            }

            // (New?) Stat regens
            packet.PutSInt(creature.StatRegens.Count);
            foreach (var mod in creature.StatRegens)
                mod.AddToPacket(packet);

            // Stat mod ids to remove?
            packet.PutInt(0);

            packet.PutInt(0);					 // ?

            if (type == StatUpdateType.Public)
            {
                packet.PutInt(0);  				 // ?

                // Stat mod ids to remove?
                packet.PutInt(0);

                packet.PutInt(0);				 // ?
            }

            return packet;
        }
开发者ID:nvrlcky,项目名称:aura,代码行数:80,代码来源:PacketCreator.cs

示例2: StatRegenStop

        // tmp
        public static MabiPacket StatRegenStop(MabiCreature creature, StatUpdateType type, params MabiStatRegen[] stats)
        {
            var packet = new MabiPacket((type & StatUpdateType.Public) != 0 ? Op.StatUpdatePublic : Op.StatUpdatePrivate, creature.Id);

            packet.PutByte((byte)type);
            packet.PutSInt(0); // Stats
            packet.PutInt(0); // Regens

            // Stat mod ids to remove
            packet.PutSInt(stats.Count());
            foreach (var mod in stats)
                packet.PutInt(mod.ModId);

            packet.PutInt(0);

            if (type == StatUpdateType.Public)
            {
                packet.PutInt(0);

                // Stat mod ids to remove
                packet.PutSInt(stats.Count());
                foreach (var mod in stats)
                    packet.PutInt(mod.ModId);

                packet.PutInt(0);
            }

            return packet;
        }
开发者ID:nvrlcky,项目名称:aura,代码行数:30,代码来源:PacketCreator.cs

示例3: 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

示例4: SystemMessage

        public static void SystemMessage(Client client, MabiCreature target, string from, string format, params object[] args)
        {
            var packet = new MabiPacket(Op.Chat, target.Id);
            packet.PutByte(0);
            packet.PutString(from);
            packet.PutString(format, args);
            packet.PutByte(1);
            packet.PutSInt(-32640);
            packet.PutInt(0);
            packet.PutByte(0);

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

示例5: GetPacket

        public MabiPacket GetPacket()
        {
            var p = new MabiPacket(Op.CombatActionBundle, Id.Broadcast);
            p.PutInt(this.CombatActionId);
            p.PutInt(this.PrevCombatActionId);
            p.PutByte(this.Hit);
            p.PutByte(this.HitsMax);
            p.PutByte(0);

            p.PutSInt(this.Actions.Count);
            foreach (var action in this.Actions)
            {
                p.PutIntBin(action.GetPacket(this.CombatActionId).Build(false));
            }

            return p;
        }
开发者ID:Fuhhue,项目名称:aura_legacy,代码行数:17,代码来源:CombatAction.cs

示例6: CharacterInfo

        /// <summary>
        /// Sends character info. 
        /// </summary>
        /// <param name="client"></param>
        /// <param name="character"></param>
        public static void CharacterInfo(LoginClient client, uint op, Character character, IEnumerable<Item> items)
        {
            var packet = new MabiPacket(op, Id.Login);
            if (character != null)
            {
                packet.PutByte(true);
                packet.PutString(character.Server);
                packet.PutLong(character.Id);
                packet.PutByte(1);
                packet.PutString(character.Name);
                packet.PutString("");
                packet.PutString("");
                packet.PutInt(character.Race);
                packet.PutByte(character.SkinColor);
                packet.PutByte(character.Eye);
                packet.PutByte(character.EyeColor);
                packet.PutByte(character.Mouth);
                packet.PutInt(0);
                packet.PutFloat(character.Height);
                packet.PutFloat(character.Weight);
                packet.PutFloat(character.Upper);
                packet.PutFloat(character.Lower);
                packet.PutInt(0);
                packet.PutInt(0);
                packet.PutInt(0);
                packet.PutByte(0);
                packet.PutInt(0);
                packet.PutByte(0);
                packet.PutInt(character.Color1);
                packet.PutInt(character.Color2);
                packet.PutInt(character.Color3);
                packet.PutFloat(0.0f);
                packet.PutString("");
                packet.PutFloat(49.0f);
                packet.PutFloat(49.0f);
                packet.PutFloat(0.0f);
                packet.PutFloat(49.0f);
                packet.PutInt(0);
                packet.PutInt(0);
                packet.PutShort(0);
                packet.PutLong(0);
                packet.PutString("");
                packet.PutByte(0);

                packet.PutSInt(items.Count());
                foreach (var item in items)
                {
                    packet.PutLong(item.Id);
                    packet.PutBin(item.Info);
                }

                packet.PutInt(0);  // PetRemainingTime
                packet.PutLong(0); // PetLastTime
                packet.PutLong(0); // PetExpireTime
            }
            else
            {
                packet.PutByte(false);
            }

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


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