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


C# PacketHitList.AddPacketToParty方法代码示例

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


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

示例1: AppendPartyMemberData

 public static void AppendPartyMemberData(Client member, PacketHitList hitlist, int slot)
 {
     if (!string.IsNullOrEmpty(member.Player.PartyID)) {
         Party playerParty = PartyManager.FindPlayerParty(member);
         hitlist.AddPacketToParty(playerParty, TcpPacket.CreatePacket("partymemberdata", slot.ToString(), member.Player.Name, member.Player.GetActiveRecruit().Species.ToString(), member.Player.GetActiveRecruit().Form.ToString(), ((int)member.Player.GetActiveRecruit().Shiny).ToString(), ((int)member.Player.GetActiveRecruit().Sex).ToString(),
                                               member.Player.GetActiveRecruit().Exp.ToString(), member.Player.GetActiveRecruit().GetNextLevel().ToString(),
                                               member.Player.GetActiveRecruit().HP.ToString(), member.Player.GetActiveRecruit().MaxHP.ToString()));
     }
 }
开发者ID:ScruffyKnight,项目名称:PMU-Server,代码行数:9,代码来源:PacketBuilder.cs

示例2: OnMapLoaded

        public static void OnMapLoaded(Client client, IMap map, PacketHitList packetList)
        {
            try {
                //make sure escorts and other allies aren't taken out of the dungeon
                if (map.Moral != Enums.MapMoral.None) {
                    int left = 0;
                    for (int i = 0; i < Constants.MAX_ACTIVETEAM; i++) {
                        if (client.Player.Team[i].RecruitIndex < -1) {
                            client.Player.RemoveFromTeam(i);
                            left++;
                        }
                    }
                    if (left > 1) {
                        Messenger.PlayerMsg(client, "Some members left the team.", Text.Grey);
                        client.Player.SwapActiveRecruit(0);
                    } else if (left > 0) {
                        Messenger.PlayerMsg(client, "A member left the team.", Text.Grey);
                        client.Player.SwapActiveRecruit(0);
                    }
                }
                if (exPlayer.Get(client).FirstMapLoaded) {
                    if (map.Moral == Enums.MapMoral.None && client.Player.IsInParty()) {
                        packetList.AddPacketToParty(client.Player.PartyID, PacketBuilder.CreateChatMsg("[Party]: " + client.Player.Name + " reached " + map.Name + ".", Text.Cyan));
                    }

                    for (int i = 0; i < Constants.MAX_ACTIVETEAM; i++) {
                        if (client.Player.Team[i] != null && client.Player.Team[i].Loaded) {
                            RemoveBuffs(client.Player.Team[i]);
                        }
                    }

                    //remove statuses
                    RemoveAllBondedExtraStatus(client.Player.GetActiveRecruit(), map, packetList, false);
                    for (int i = 0; i < Constants.MAX_ACTIVETEAM; i++) {
                        if (client.Player.Team[i] != null && client.Player.Team[i].Loaded) {
                            client.Player.Team[i].VolatileStatus.Clear();
                            RefreshCharacterTraits(client.Player.Team[i], map, packetList);
                        }
                    }

                    for (int j = 0; j < Constants.MAX_ACTIVETEAM; j++) {
                        if (client.Player.Team[j] != null && client.Player.Team[j].Loaded) {
                            if (HasAbility(client.Player.Team[j], "Illusion")) {
                                int selectedSlot = j;

                                for (int i = 1; i < Constants.MAX_ACTIVETEAM; i++) {
                                    if (client.Player.Team[(selectedSlot + i) % Constants.MAX_ACTIVETEAM] != null && client.Player.Team[(selectedSlot + i) % Constants.MAX_ACTIVETEAM].Loaded) {
                                        selectedSlot = (selectedSlot + i) % Constants.MAX_ACTIVETEAM;
                                        break;
                                    }
                                }
                                if (selectedSlot != j) {
                                    AddExtraStatus(client.Player.Team[j], client.Player.Map, "Illusion", client.Player.Team[selectedSlot].Species, null, "", packetList, false);
                                }
                            }

                            //set illusion
                            if (client.Player.GetActiveRecruit().HasActiveItem(213)) {
                                AddExtraStatus(client.Player.Team[j], client.Player.Map, "Illusion", 25, null, "", packetList, false);
                            }
                            if (client.Player.GetActiveRecruit().HasActiveItem(224)) {
                                AddExtraStatus(client.Player.Team[j], client.Player.Map, "Illusion", 300, null, "", packetList, false);
                            }
                            if (client.Player.GetActiveRecruit().HasActiveItem(244)) {
                                AddExtraStatus(client.Player.Team[j], client.Player.Map, "Illusion", 387, null, "", packetList, false);
                            }
                            if (client.Player.GetActiveRecruit().HasActiveItem(245)) {
                                AddExtraStatus(client.Player.Team[j], client.Player.Map, "Illusion", 390, null, "", packetList, false);
                            }
                            if (client.Player.GetActiveRecruit().HasActiveItem(246)) {
                                AddExtraStatus(client.Player.Team[j], client.Player.Map, "Illusion", 393, null, "", packetList, false);
                            }
                        }
                    }

                    if (client.Player.Map.MapType == Enums.MapType.RDungeonMap) {

                        if (HasAbility(client.Player.GetActiveRecruit(), "Honey Gather")
                            && client.Player.FindInvSlot(-1) > -1) {
                            if (Server.Math.Rand(0, 400) <= client.Player.GetActiveRecruit().Level) {
                                client.Player.GiveItem(11, 0, "");
                                packetList.AddPacket(client, PacketBuilder.CreateBattleMsg(client.Player.GetActiveRecruit().Name + " gathered honey from somewhere.", Text.WhiteSmoke));
                            }
                        }

                    if (client.Player.Map.MapType == Enums.MapType.RDungeonMap) {

                        for (int i = 0; i < Constants.MAX_ACTIVETEAM; i++) {
                           	if (client.Player.GetActiveRecruit() != null && client.Player.GetActiveRecruit().Loaded && !client.Player.Dead) {
                           		if (HasAbility(client.Player.GetActiveRecruit(), "Pickup")
                                    && client.Player.FindInvSlot(-1) > -1) {
                                    RDungeonFloor floor = RDungeonManager.RDungeons[((RDungeonMap)map).RDungeonIndex].Floors[((RDungeonMap)map).RDungeonFloor];
                                    if (floor.Items.Count > 0) {
                                        int rand = Server.Math.Rand(0, floor.Items.Count);
                                        if (Server.Math.Rand(0, 200) <= floor.Items[rand].AppearanceRate) {
                                            int amount = (floor.Items[rand].MinAmount + floor.Items[rand].MaxAmount) / 2;
                                            client.Player.GiveItem(floor.Items[rand].ItemNum, amount, floor.Items[rand].Tag);
                                            packetList.AddPacket(client, PacketBuilder.CreateBattleMsg(client.Player.GetActiveRecruit().Name + " found an item from somewhere.", Text.WhiteSmoke));
                                        }
                                    }
//.........这里部分代码省略.........
开发者ID:MandL27,项目名称:Server,代码行数:101,代码来源:Main.cs


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