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


C# IMap.GetClients方法代码示例

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


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

示例1: GetSurroundingClients

 public IEnumerable<Client> GetSurroundingClients(IMap map)
 {
     // Return all of the clients on the current map
     foreach (Client i in map.GetClients()) {
         yield return i;
     }
     // Return all of the clients on the surrounding maps
     for (int n = 1; n < 9; n++) {
         bool borderingMapActive = MapManager.IsBorderingMapLoaded(map, (Enums.MapID)n);
         if (borderingMapActive && SeamlessWorldHelper.IsMapSeamless(map, (Enums.MapID)n)) {
             IMap borderingMap = MapManager.RetrieveBorderingMap(map, (Enums.MapID)n, true);
             if (borderingMap != null) {
                 foreach (Client i in borderingMap.GetClients()) {
                     yield return i;
                 }
             }
         }
     }
 }
开发者ID:MandL27,项目名称:Server,代码行数:19,代码来源:BasicMap.cs

示例2: AddPacketToPlayersInSightBut

        public void AddPacketToPlayersInSightBut(Client sender, IMap centralMap, TcpPacket packet, int sourceX, int sourceY, int range)
        {
            if (centralMap != null) {

                if (!cachingEnabled) {
                    foreach (Client i in centralMap.GetClients()) {
                        AddPacketToPlayersInSightButInternal(sender, centralMap, packet, sourceX, sourceY, range, centralMap, Enums.MapID.Active, i);
                    }
                    // Go through all of the clients on the surrounding maps
                    for (int n = 1; n < 9; n++) {
                        string borderingMapID = MapManager.RetrieveBorderingMapID(centralMap, (Enums.MapID)n);
                        if (!string.IsNullOrEmpty(borderingMapID)) {
                            IMap borderingMap = MapManager.RetrieveActiveMap(borderingMapID);
                            if (borderingMap != null && SeamlessWorldHelper.IsMapSeamless(centralMap, borderingMap)) {
                                foreach (Client i in borderingMap.GetClients()) {
                                    AddPacketToPlayersInSightButInternal(sender, centralMap, packet, sourceX, sourceY, range, borderingMap, (Enums.MapID)n, i);
                                }
                            }
                        }
                    }

                } else {
                    hitListCache.AddCacheItem(new object[] { PacketHitListTargets.PlayersInSightBut, sender, centralMap, packet, sourceX, sourceY, range });
                }
            }
        }
开发者ID:pzaps,项目名称:Server,代码行数:26,代码来源:PacketHitList.cs

示例3: GetMapClients

 private IEnumerable<Client> GetMapClients(ListPair<IMap, List<Client>> clientCollection, IMap map)
 {
     int mapIndex = clientCollection.IndexOfKey(map);
     if (mapIndex > -1) {
         List<Client> clients = clientCollection.ValueByIndex(mapIndex);
         foreach (Client client in clients) {
             yield return client;
         }
     } else {
         List<Client> clients = new List<Client>();
         foreach (Client client in map.GetClients()) {
             clients.Add(client);
             yield return client;
         }
         clientCollection.Add(map, clients);
     }
 }
开发者ID:pzaps,项目名称:Server,代码行数:17,代码来源:PacketHitListCache.cs

示例4: AppendNpcMove

 public static void AppendNpcMove(IMap map, Combat.ICharacter target, PacketHitList hitlist, int data)
 {
     if (map != null) {
         TcpPacket packet = TcpPacket.CreatePacket("nm", data.ToString(), map.MapID);
         // Go through all of the clients on the current map
         foreach (Client i in map.GetClients()) {
             AppendNpcMoveInternal(map, target, hitlist, packet, map, Enums.MapID.Active, i);
         }
         // Go through all of the clients on the surrounding maps
         for (int n = 1; n < 9; n++) {
             string borderingMapID = MapManager.RetrieveBorderingMapID(map, (Enums.MapID)n);
             if (!string.IsNullOrEmpty(borderingMapID)) {
                 IMap borderingMap = MapManager.RetrieveActiveMap(borderingMapID);
                 if (borderingMap != null && SeamlessWorldHelper.IsMapSeamless(map, borderingMap)) {
                     foreach (Client i in borderingMap.GetClients()) {
                         AppendNpcMoveInternal(map, target, hitlist, packet, borderingMap, (Enums.MapID)n, i);
                     }
                 }
             }
         }
     }
 }
开发者ID:ScruffyKnight,项目名称:PMU-Server,代码行数:22,代码来源:PacketBuilder.cs

示例5: AddPacketToMapBut

 public void AddPacketToMapBut(Client client, IMap map, TcpPacket packet, int sourceX, int sourceY, int range)
 {
     if (map != null) {
         if (!cachingEnabled) {
             foreach (Client i in map.GetClients()) {
                 if (client == null || i.TcpID != client.TcpID) {
                     if (range == -1 || IsInRange(range, sourceX, sourceY, i.Player.X, i.Player.Y)) {
                         AddPacket(i, packet);
                     }
                 }
             }
         } else {
             hitListCache.AddCacheItem(new object[] { PacketHitListTargets.RangedMapBut, client, map, packet, sourceX, sourceY, range });
         }
     }
 }
开发者ID:pzaps,项目名称:Server,代码行数:16,代码来源:PacketHitList.cs

示例6: OnMapTick

        public static void OnMapTick(IMap map)
        {
            bool pointReached = false;
            try {

                PacketHitList hitlist = null;
                PacketHitList.MethodStart(ref hitlist);

                MapStatus status;
                if (!map.ProcessingPaused) {
                    status = map.TempStatus.GetStatus("TrickRoom");
                    if (status != null) {
                        status.Counter--;
                        if (status.Counter <= 0) {
                            RemoveMapStatus(map, "TrickRoom", hitlist);
                        }
                    }
                    status = map.TempStatus.GetStatus("Gravity");
                    if (status != null) {
                        status.Counter--;
                        if (status.Counter <= 0) {
                            RemoveMapStatus(map, "Gravity", hitlist);
                        }
                    }
                    status = map.TempStatus.GetStatus("WonderRoom");
                    if (status != null) {
                        status.Counter--;
                        if (status.Counter <= 0) {
                            RemoveMapStatus(map, "WonderRoom", hitlist);
                        }
                    }
                    status = map.TempStatus.GetStatus("MagicRoom");
                    if (status != null) {
                        status.Counter--;
                        if (status.Counter <= 0) {
                            RemoveMapStatus(map, "MagicRoom", hitlist);
                        }
                    }
                    status = map.TempStatus.GetStatus("Flash");
                    if (status != null) {
                        status.Counter--;
                        if (status.Counter <= 0) {
                            RemoveMapStatus(map, "Flash", hitlist);
                        }
                    }

                    status = map.TempStatus.GetStatus("Wind");

                    if (status != null) {

                        status.Counter++;
                        if (map.TimeLimit <= 0) {

                        } else if (status.Counter > map.TimeLimit) {
                            int victims = 0;

                            foreach (Client client in map.GetClients()) {
                                if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) {

                                    HandleGameOver(client, Enums.KillType.Other);
                                    victims++;
                                }
                            }
                            if (victims > 0) {
                                hitlist.AddPacketToMap(map, PacketBuilder.CreateSoundPacket("magic203.wav"));
                                hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("You were blown out by a mysterious force...", Text.Black));
                            }
                        } else if (status.Counter == map.TimeLimit - 6) {
                            hitlist.AddPacketToMap(map, PacketBuilder.CreateSoundPacket("magic855.wav"));
                            hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("It's right nearby!  It's gusting hard!", Text.BrightRed));
                            hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleDivider());
                            hitlist.AddPacketToMap(map, PacketBuilder.CreateChatMsg("It's right nearby!  It's gusting hard!", Text.BrightRed));
                        } else if (status.Counter == map.TimeLimit - 60) {
                            hitlist.AddPacketToMap(map, PacketBuilder.CreateSoundPacket("magic854.wav"));
                            hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("...It's getting closer!", Text.Blue));
                            hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleDivider());
                            hitlist.AddPacketToMap(map, PacketBuilder.CreateChatMsg("...It's getting closer!", Text.Blue));
                        } else if (status.Counter == map.TimeLimit - 120) {
                            hitlist.AddPacketToMap(map, PacketBuilder.CreateSoundPacket("magic579.wav"));
                            hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("Something's approaching...", Text.BrightBlue));
                            hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleDivider());
                            hitlist.AddPacketToMap(map, PacketBuilder.CreateChatMsg("Something's approaching...", Text.BrightBlue));
                        } else if (status.Counter == map.TimeLimit - 240) {
                            hitlist.AddPacketToMap(map, PacketBuilder.CreateSoundPacket("magic434.wav"));
                            hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("Something's stirring...", Text.BrightCyan));
                            hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleDivider());
                            hitlist.AddPacketToMap(map, PacketBuilder.CreateChatMsg("Something's stirring...", Text.BrightCyan));
                        }
                    } else if (map.Moral != Enums.MapMoral.House) {
                        AddMapStatus(map, "Wind", 0, "", -1, hitlist);
                    }

                    //semi-invulnerable attacks
                    TargetCollection targets = MoveProcessor.GetTargetsInRange(Enums.MoveRange.Floor, 0, map, null, 0, 0, Enums.Direction.Up, true, true, false);
                    pointReached = true;
                    foreach (ICharacter i in targets.Foes) {
                        ExtraStatus extraStatus = i.VolatileStatus.GetStatus("SemiInvul");
                        if (extraStatus != null) {
                            extraStatus.Counter--;
                            if (extraStatus.Counter <= 0) {
//.........这里部分代码省略.........
开发者ID:pzaps,项目名称:Server,代码行数:101,代码来源:MapInteractions.cs

示例7: RefreshMapTraits

        public static void RefreshMapTraits(IMap map, PacketHitList hitlist)
        {
            map.Darkness = map.OriginalDarkness;

            if (map.TempStatus.GetStatus("Luminous") != null) {
                map.Darkness = -1;
            }

            if (map.TempStatus.GetStatus("Flash") != null && map.Darkness != -1 && map.Darkness < 17) {
                map.Darkness = 17;
            }

            foreach (Client client in map.GetClients()) {
                PacketBuilder.AppendMapDarkness(client, hitlist, map);
            }
        }
开发者ID:MandL27,项目名称:Server,代码行数:16,代码来源:StatusScript.cs

示例8: OnNpcSpawn

        public static void OnNpcSpawn(IMap map, MapNpcPreset npc, MapNpc spawnedNpc, PacketHitList hitlist)
        {
            try {
                if (spawnedNpc.Num == 0) return;
                bool listed = false;
                for (int i = 0; i < map.Npc.Count; i++) {
                    if (map.Npc[i].NpcNum == spawnedNpc.Num) {
                        listed = true;
                        break;
                    }
                }
                if (!listed && map.MapType == Enums.MapType.RDungeonMap) {
                    //Messenger.AdminMsg("[Admin] An unlisted NPC " + NpcManager.Npcs[spawnedNpc.Num].Name + " spawned on " + map.Name, Text.Red);
                    //map.ActiveNpc[spawnedNpc.MapSlot] = new MapNpc(map.MapID, spawnedNpc.MapSlot);
                    //hitlist.AddPacketToMap(map, TcpPacket.CreatePacket("npcdead", spawnedNpc.MapSlot));
                }
                Client sprinko = ClientManager.FindClient("Sprinko");
                if (sprinko != null && sprinko.Player.Map == map) {
                    Messenger.PlayerMsg(sprinko, "Npc Spawned:" + spawnedNpc.Num, Text.Pink);

                }

                switch (spawnedNpc.Num) {
                    case 33:
                    case 230:
                    case 244:
                    case 245: {//friendly npcs
                            AddExtraStatus(spawnedNpc, map, "Immobilize", 0, null, "", hitlist, false);
                        }
                        break;
                    case 32: {//kecleon

                            map.Npc.Remove(npc);
                        }
                        break;
                    case 1233: {//hitmonchan

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpDefBuff = 3;
                            spawnedNpc.MaxHPBonus = 300;
                            spawnedNpc.AttackBuff = 1;
                            spawnedNpc.SpeedBuff = 8;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1234: {//hitmonlee

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.MaxHPBonus = 340;
                            spawnedNpc.AttackBuff = 3;
                            spawnedNpc.SpeedBuff = 8;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1235: {//hitmontop

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpDefBuff = 3;
                            spawnedNpc.MaxHPBonus = 480;
                            spawnedNpc.AttackBuff = 3;
                            spawnedNpc.SpeedBuff = 10;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 306: {//regice
                            foreach (Client n in map.GetClients()) {
                                StoryManager.PlayStory(n, 259);
                            }
                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 10;
                            spawnedNpc.SpDefBuff = 10;
                            spawnedNpc.MaxHPBonus = 550;
                            spawnedNpc.SpAtkBuff = 5;
                            spawnedNpc.SpeedBuff = 10;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1401: {//Vespiquen (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.MaxHPBonus = 150;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1402: {//Roselia (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpDefBuff = 1;
//.........这里部分代码省略.........
开发者ID:MandL27,项目名称:Server,代码行数:101,代码来源:Main.cs

示例9: OnWeatherChange

        public static void OnWeatherChange(IMap map, Enums.Weather oldWeather, Enums.Weather newWeather)
        {
            try {
                foreach (Client i in map.GetClients()) {
                    RefreshCharacterTraits(i.Player.GetActiveRecruit(), map, null);
                }

                foreach (MapNpc n in map.ActiveNpc) {
                    if (n.Num > 0) {
                        RefreshCharacterTraits(n, map, null);
                    }
                }
            } catch (Exception ex) {
                Messenger.AdminMsg("Error: OnWeatherChange", Text.Black);
            }
        }
开发者ID:MandL27,项目名称:Server,代码行数:16,代码来源:Main.cs

示例10: OnMapLoaded


//.........这里部分代码省略.........
                    if (map.Moral == Enums.MapMoral.None
                        || map.Moral == Enums.MapMoral.NoPenalty
                        || (client.Player.GetActiveRecruit().X >= 0 && client.Player.GetActiveRecruit().X <= map.MaxX
                        && client.Player.GetActiveRecruit().Y >= 0 && client.Player.GetActiveRecruit().Y <= map.MaxY
                        && map.Tile[client.Player.GetActiveRecruit().X, client.Player.GetActiveRecruit().Y].Type == Enums.TileType.Arena
                        && !client.Player.Dead)) {
                        if (HasAbility(client.Player.GetActiveRecruit(), "Sand Stream")) {
                            SetMapWeather(map, Enums.Weather.Sandstorm, packetList);
                        } else if (HasAbility(client.Player.GetActiveRecruit(), "Snow Warning")) {
                            SetMapWeather(map, Enums.Weather.Hail, packetList);
                        } else if (HasAbility(client.Player.GetActiveRecruit(), "Drizzle")) {
                            SetMapWeather(map, Enums.Weather.Raining, packetList);
                        } else if (HasAbility(client.Player.GetActiveRecruit(), "Drought")) {
                            SetMapWeather(map, Enums.Weather.Sunny, packetList);
                        } else if (HasAbility(client.Player.GetActiveRecruit(), "Air Lock")) {
                            SetMapWeather(map, Enums.Weather.None, packetList);
                        } else if (HasAbility(client.Player.GetActiveRecruit(), "Cloud Nine")) {
                            SetMapWeather(map, Enums.Weather.None, packetList);
                        }
                    }

                    int totalDef = 0;
                    int totalSpDef = 0;
                    TargetCollection targets = MoveProcessor.GetTargetsInRange(Enums.MoveRange.Floor, 0, map, client.Player.GetActiveRecruit(), client.Player.GetActiveRecruit().X, client.Player.GetActiveRecruit().Y, Enums.Direction.Up, true, false, false);
                    for (int i = 0; i < targets.Foes.Count; i++) {
                        totalDef += targets.Foes[i].Def;
                        totalSpDef += targets.Foes[i].SpclDef;
                    }
                    for (int i = 0; i < Constants.MAX_ACTIVETEAM; i++) {
                       	if (client.Player.Team[i] != null && client.Player.Team[i].Loaded
                       		&& HasAbility(client.Player.Team[i], "Download")) {
                           	if (totalDef < totalSpDef) {
                               	ChangeAttackBuff(client.Player.Team[i], map, 1, packetList);
                           	} else {
                               	ChangeSpAtkBuff(client.Player.Team[i], map, 1, packetList);
                           	}
                       	}
                    }

                    //if (HasAbility(client.Player.GetActiveRecruit(), "Natural Cure") && !CheckStatusProtection(client.Player.GetActiveRecruit(), map, Enums.StatusAilment.OK.ToString(), false, packetList)) {
                    //    packetList.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(client.Player.GetActiveRecruit().Name + "'s Natural Cure cured its status problem!", Text.WhiteSmoke), client.Player.X, client.Player.Y, 10);
                    //    SetStatusAilment(client.Player.GetActiveRecruit(), map, Enums.StatusAilment.OK, 0, packetList);
                    //}
                    for (int i = 0; i < Constants.MAX_ACTIVETEAM; i++) {
                        if (client.Player.Team[i] != null && client.Player.Team[i].Loaded) {
                            if (HasAbility(client.Player.Team[i], "Natural Cure") && !CheckStatusProtection(client.Player.Team[i], map, Enums.StatusAilment.OK.ToString(), false, packetList)) {
                                packetList.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(client.Player.Team[i].Name + "'s Natural Cure cured its status problem!", Text.WhiteSmoke), client.Player.X, client.Player.Y, 10);
                                SetStatusAilment(client.Player.Team[i], map, Enums.StatusAilment.OK, 0, packetList);
                            }

                        }
                    }

                    //if (HasAbility(client.Player.GetActiveRecruit(), "Regenerator") && client.Player.GetActiveRecruit().HP < client.Player.GetActiveRecruit().MaxHP) {
                    //    HealCharacter(client.Player.GetActiveRecruit(), map, client.Player.GetActiveRecruit().MaxHP / 3, packetList);
                    //}

                    for (int i = 0; i < Constants.MAX_ACTIVETEAM; i++) {
                        if (client.Player.Team[i] != null && client.Player.Team[i].Loaded) {
                            if (HasAbility(client.Player.Team[i], "Regenerator") && client.Player.Team[i].HP < client.Player.Team[i].MaxHP) {
                                HealCharacter(client.Player.Team[i], map, client.Player.Team[i].MaxHP / 3, packetList);
                            }

                        }
                    }

                    if (map.MapType == Enums.MapType.Instanced) {
                        //Messenger.AdminMsg("Players:"+map.PlayersOnMap.Count + " / " + BossBattles.IsBossBattleMap(client), Text.Pink);
                        if (BossBattles.IsBossBattleMap(client)) {
                            foreach (Client n in map.GetClients()) {
                                if (client == n) {
                                    BossBattles.StartBossBattle(n, (InstancedMap)map);
                                }
                                break;
                            }
                        }
                    }

                } else {

                    //if (Ranks.IsAllowed(client, Enums.Rank.Admin)) {
                    //	Messenger.PlayerMsg(client, "!", Text.Black);
                    //}
                }
                exPlayer.Get(client).FirstMapLoaded = true;

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

                   		RefreshCharacterTraits(client.Player.Team[i], map, packetList);
                  	}
                }

                StoryHelper.OnMapLoaded(client, map, packetList);
            } catch (Exception ex) {
                Messenger.AdminMsg("Error: OnMapLoaded", Text.Black);
                Messenger.AdminMsg("Map: " + map.Name + "Client: " + client.Player.Name, Text.Black);
                //Messenger.AdminMsg(ex.ToString(), Text.Black);
            }
        }
开发者ID:MandL27,项目名称:Server,代码行数:101,代码来源:Main.cs

示例11: IsInRangeOfFoes

 public bool IsInRangeOfFoes(IMap currentMap, Move move, int moveSlot)
 {
     // Check if any players are in range
     foreach (Client i in currentMap.GetClients()) {
         // Check if the target player is in range
         if (MoveProcessor.IsInRange(move.RangeType, move.Range, this.X, this.Y,
             this.Direction,
             i.Player.X, i.Player.Y)) {
             // They are in range, attack them
             return true;
         }
     }
     return false;
 }
开发者ID:pzaps,项目名称:Server,代码行数:14,代码来源:MapNpc.cs

示例12: ScriptedTile


//.........这里部分代码省略.........
                        }
                        break;
                    case 24: {//Admin-only
                            if (client != null) {
                                if (Ranks.IsDisallowed(client, Enums.Rank.Moniter)) {
                                    BlockPlayer(client);
                                    Messenger.PlayerMsg(client, "You must be an Admin to get through!", Text.BrightRed);
                                }
                            }
                        }
                        break;
                    case 25: {//mud trap
                            if (WillTrapActivate(character, map, character.X, character.Y)) {
                                RevealTrap(map, character.X, character.Y, hitlist);
                                hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on a Mud Trap!", Text.BrightRed), character.X, character.Y, 10);
                                ActivateTrap(map, character.X, character.Y, script, hitlist);
                                if (Server.Math.Rand(0, 10) + 2 < map.Tile[character.X, character.Y].Data2) {
                                    RemoveTrap(map, character.X, character.Y, hitlist);
                                }
                            }
                        }
                        break;
                    case 26: {//wonder tile
                            if (WillTrapActivate(character, map, character.X, character.Y)) {
                                RevealTrap(map, character.X, character.Y, hitlist);
                                hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on a Wonder Tile!", Text.BrightGreen), character.X, character.Y, 10);
                                ActivateTrap(map, character.X, character.Y, script, hitlist);
                            }
                        }
                        break;
                    case 27: {//activation
                            if (client != null) {
                                List<int> switches = new List<int>();
                                foreach (Client i in map.GetClients()) {
                                    if (i.Player.Map.Tile[i.Player.X, i.Player.Y].Type == Enums.TileType.Scripted
                                    && i.Player.Map.Tile[i.Player.X, i.Player.Y].Data1 == 27) {
                                        if (!switches.Contains(i.Player.Map.Tile[i.Player.X, i.Player.Y].Data2)) {
                                            switches.Add(i.Player.Map.Tile[i.Player.X, i.Player.Y].Data2);
                                        }
                                    }

                                }

                                hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on a switch!", Text.BrightGreen), character.X, character.Y, 50);

                                if (switches.Count >= param1.ToInt()) {
                                    for (int x = 0; x < map.MaxX; x++) {
                                        for (int y = 0; y < map.MaxY; y++) {
                                            if (map.Tile[x, y].Type == Enums.TileType.RDungeonGoal) {
                                                map.Tile[x, y].Mask2Set = 4;
                                                map.Tile[x, y].Mask2 = 1;
                                                map.Tile[x, y].Data1 = 1;
                                                map.TempChange = true;
                                                hitlist.AddPacketToMap(map, PacketBuilder.CreateTilePacket(x, y, map));
                                            } else if (map.Tile[x, y].Type == Enums.TileType.Scripted && map.Tile[x, y].Data1 == 27) {
                                                map.Tile[x, y].Type = Enums.TileType.Walkable;
                                                map.Tile[x, y].Fringe = 0;
                                                map.Tile[x, y].FAnim = 0;
                                                hitlist.AddPacketToMap(map, PacketBuilder.CreateTilePacket(x, y, map));
                                            }
                                        }
                                    }
                                    hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("The passage to the next floor was opened!", Text.BrightGreen), character.X, character.Y, 50);
                                    hitlist.AddPacketToMap(map, PacketBuilder.CreateSoundPacket("Magic127.wav"), character.X, character.Y, 50);
                                    hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleDivider(), character.X, character.Y, 50);
                                } else if (param1.ToInt() - switches.Count == 1) {
开发者ID:Festivo,项目名称:Scripts,代码行数:67,代码来源:ScriptedTiles.cs

示例13: GetTargetsInRange

        public static TargetCollection GetTargetsInRange(Enums.MoveRange rangeType, int range, IMap map, ICharacter user, int userX, int userY, Enums.Direction userDir, bool hitsFoes, bool hitsAllies, bool hitsSelf)
        {
            TargetCollection targetlist = new TargetCollection();

            switch (rangeType) {
                case Enums.MoveRange.Floor: {
                        #region Floor
                        foreach (Client i in map.GetClients()) {
                            if (user == i.Player.GetActiveRecruit() && hitsSelf || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                targetlist.Add(i.Player.GetActiveRecruit(), GetMatchupWith(user, i.Player.GetActiveRecruit()));
                            }
                        }
                        for (int i = 0; i < map.ActiveNpc.Length; i++) {
                            if (map.ActiveNpc[i].Num > 0) {
                                if (user == map.ActiveNpc[i] && hitsSelf || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                    targetlist.Add(map.ActiveNpc[i], GetMatchupWith(user, map.ActiveNpc[i]));
                                }
                            }
                        }
                        #endregion
                    }
                    break;
                case Enums.MoveRange.FrontOfUser: {
                        #region FrontOfUser
                        foreach (Client i in map.GetClients()) {
                            if (IsInFront(range, userDir, userX, userY, i.Player.X, i.Player.Y)) {
                                if (user == i.Player.GetActiveRecruit() && hitsSelf || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                    targetlist.Add(i.Player.GetActiveRecruit(), GetMatchupWith(user, i.Player.GetActiveRecruit()));
                                }
                            }
                        }
                        for (int i = 0; i < map.ActiveNpc.Length; i++) {
                            if (map.ActiveNpc[i].Num > 0 && IsInFront(range, userDir, userX, userY, map.ActiveNpc[i].X, map.ActiveNpc[i].Y)) {
                                if (user == map.ActiveNpc[i] && hitsSelf || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                    targetlist.Add(map.ActiveNpc[i], GetMatchupWith(user, map.ActiveNpc[i]));
                                }
                            }
                        }
                        #endregion
                    }
                    break;
                case Enums.MoveRange.FrontOfUserUntil: {
                        #region FrontOfUserUntil
                        bool stopattile = false;
                        for (int r = 0; r <= range; r++) {
                            foreach (Client i in map.GetClients()) {
                                Enums.CharacterMatchup matchup = GetMatchupWith(user, i.Player.GetActiveRecruit());
                                if (user != i.Player.GetActiveRecruit() && IsInFront(r, userDir, userX, userY, i.Player.X, i.Player.Y) &&
                                    (matchup == Enums.CharacterMatchup.Friend && hitsAllies || matchup == Enums.CharacterMatchup.Foe && hitsFoes)) {
                                    targetlist.Add(i.Player.GetActiveRecruit(), matchup);
                                    stopattile = true;
                                }
                            }
                            for (int i = 0; i < map.ActiveNpc.Length; i++) {
                                Enums.CharacterMatchup matchup = GetMatchupWith(user, map.ActiveNpc[i]);
                                if (map.ActiveNpc[i].Num > 0 && user != map.ActiveNpc[i] && IsInFront(r, userDir, userX, userY, map.ActiveNpc[i].X, map.ActiveNpc[i].Y) &&
                                    (matchup == Enums.CharacterMatchup.Friend && hitsAllies || matchup == Enums.CharacterMatchup.Foe && hitsFoes)) {
                                    targetlist.Add(map.ActiveNpc[i], matchup);
                                    stopattile = true;
                                }
                            }
                            if (stopattile) {
                                break;
                            }
                        }

            #endregion
                    }
                    break;
                case Enums.MoveRange.Room: {
                        #region Room
                        foreach (Client i in map.GetClients()) {
                            if (IsInAreaRange(range, userX, userY, i.Player.X, i.Player.Y)) {
                                if (user == i.Player.GetActiveRecruit() && hitsSelf || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, i.Player.GetActiveRecruit()) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                    targetlist.Add(i.Player.GetActiveRecruit(), GetMatchupWith(user, i.Player.GetActiveRecruit()));
                                }
                            }
                        }
                    for (int i = 0; i < map.ActiveNpc.Length; i++) {
                        if (map.ActiveNpc[i].Num > 0 && IsInAreaRange(range, userX, userY, map.ActiveNpc[i].X, map.ActiveNpc[i].Y)) {
                            if (user == map.ActiveNpc[i] && hitsSelf || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Friend && hitsAllies || GetMatchupWith(user, map.ActiveNpc[i]) == Enums.CharacterMatchup.Foe && hitsFoes) {
                                targetlist.Add(map.ActiveNpc[i], GetMatchupWith(user, map.ActiveNpc[i]));
                            }
                            }
                        }
            #endregion
                    }
                    break;
                case Enums.MoveRange.ArcThrow: {
                        #region ArcThrow
                        bool stopAtTile = false;
                        for (int r = 0; r <= range; r++) {
                            //check directly forward
                            foreach (Client i in map.GetClients()) {
                                Enums.CharacterMatchup matchup = GetMatchupWith(user, i.Player.GetActiveRecruit());
                                if (user != i.Player.GetActiveRecruit() && IsInFront(r, userDir, userX, userY, i.Player.X, i.Player.Y) &&
                                    (matchup == Enums.CharacterMatchup.Friend && hitsAllies || matchup == Enums.CharacterMatchup.Foe && hitsFoes)) {
                                    targetlist.Add(i.Player.GetActiveRecruit(), matchup);
                                    stopAtTile = true;
                                }
//.........这里部分代码省略.........
开发者ID:pzaps,项目名称:Server,代码行数:101,代码来源:MoveProcessor.cs

示例14: CanNpcMove

        public static bool CanNpcMove(IMap map, int mapNpcNum, Enums.Direction direction)
        {
            // Check for subscript out of range
            if (mapNpcNum < 0 || mapNpcNum > Constants.MAX_MAP_NPCS || direction < Enums.Direction.Up || direction > Enums.Direction.Right) {
                return false;
            }

            //check movement-limiting status
            if (map.ActiveNpc[mapNpcNum].StatusAilment == Enums.StatusAilment.Freeze || map.ActiveNpc[mapNpcNum].StatusAilment == Enums.StatusAilment.Sleep) {
                return false;
            }

            //check attack cooldown
            if (map.ActiveNpc[mapNpcNum].AttackTimer.Tick > Core.GetTickCount().Tick) {
                return false;
            }

            //scramble intended movement if comfused
            if (map.ActiveNpc[mapNpcNum].Confused) {
                direction = (Enums.Direction)Math.Rand(0, 4);

            }

            int X = map.ActiveNpc[mapNpcNum].X;
            int Y = map.ActiveNpc[mapNpcNum].Y;

            switch (direction) {
                case Enums.Direction.Up:
                    // Check to make sure not outside of boundries
                    if (Y > 0) {
                        Y--;
                    } else {
                        return false;
                    }
                    break;
                case Enums.Direction.Down:
                    // Check to make sure not outside of boundries
                    if (Y < map.MaxY) {
                        Y++;
                    } else {
                        return false;
                    }
                    break;
                case Enums.Direction.Left:
                    // Check to make sure not outside of boundries
                    if (X > 0) {
                        X--;
                    } else {
                        return false;
                    }
                    break;
                case Enums.Direction.Right:
                    // Check to make sure not outside of boundries
                    if (X < map.MaxX) {
                        X++;
                    } else {
                        return false;
                    }
                    break;
            }

            // Check to make sure that the tile is walkable
            if (map.Tile[X, Y].Type == Enums.TileType.MobileBlock || map.Tile[X, Y].Type == Enums.TileType.Slippery || map.Tile[X, Y].Type == Enums.TileType.Slow) {
                int mobilityList = map.Tile[X, Y].Data1;
                for (int i = 0; i < 16; i++) {
                    if (mobilityList % 2 == 1 && !map.ActiveNpc[mapNpcNum].Mobility[i]) {
                        return false;
                    }
                    mobilityList /= 2;
                }
            } else if (map.Tile[X, Y].Type != Enums.TileType.Hallway && map.Tile[X, Y].Type != Enums.TileType.Walkable && map.Tile[X, Y].Type != Enums.TileType.Item && map.Tile[X, Y].Type != Enums.TileType.Scripted) {
                return false;
            }

            // Check to make sure that there is not a player in the way
            foreach (Client i in map.GetClients()) {
                if ((i.Player.X == X) && (i.Player.Y == Y)) {
                    return false;
                }
            }

            // Check to make sure that there is not another npc in the way
            for (int i = 0; i < Constants.MAX_MAP_NPCS; i++) {
                if ((i != mapNpcNum) && (map.ActiveNpc[i].Num > 0) && (map.ActiveNpc[i].X == X) && (map.ActiveNpc[i].Y == Y)) {
                    return false;
                }
            }

            //change direction
            map.ActiveNpc[mapNpcNum].Direction = direction;

            return true;
        }
开发者ID:ScruffyKnight,项目名称:PMU-Server,代码行数:93,代码来源:MovementProcessor.cs


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