Exemplo n.º 1
0
        private ArrayList GetTargets(GamePlayer player)
        {
            ArrayList      list = new ArrayList();
            eBroadcastType type = (eBroadcastType)ServerProperties.Properties.BROADCAST_TYPE;

            switch (type)
            {
            case eBroadcastType.Area:
            {
                bool found = false;
                foreach (AbstractArea area in player.CurrentAreas)
                {
                    if (area.CanBroadcast)
                    {
                        found = true;
                        foreach (GameClient thisClient in WorldMgr.GetClientsOfRegion(player.CurrentRegionID))
                        {
                            if (thisClient.Player.CurrentAreas.Contains(area))
                            {
                                list.Add(thisClient.Player);
                            }
                        }
                    }
                }
                if (!found)
                {
                    player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Scripts.Players.Broadcast.NoHere"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                }
                break;
            }

            case eBroadcastType.Realm:
            {
                foreach (GameClient thisClient in WorldMgr.GetClientsOfRealm(player.Realm))
                {
                    list.Add(thisClient.Player);
                }
                break;
            }

            case eBroadcastType.Region:
            {
                foreach (GameClient thisClient in WorldMgr.GetClientsOfRegion(player.CurrentRegionID))
                {
                    list.Add(thisClient.Player);
                }
                break;
            }

            case eBroadcastType.Server:
            {
                foreach (GameClient thisClient in WorldMgr.GetAllPlayingClients())
                {
                    list.Add(thisClient.Player);
                }
                break;
            }

            case eBroadcastType.Visible:
            {
                foreach (GamePlayer p in player.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
                {
                    list.Add(p);
                }
                break;
            }

            case eBroadcastType.Zone:
            {
                foreach (GameClient thisClient in WorldMgr.GetClientsOfRegion(player.CurrentRegionID))
                {
                    if (thisClient.Player.CurrentZone == player.CurrentZone)
                    {
                        list.Add(thisClient.Player);
                    }
                }
                break;
            }
            }

            return(list);
        }