コード例 #1
0
ファイル: PlayerCommands.cs プロジェクト: NecroSharper/WCell
        public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
        {
            WorldObject obj = trigger.Args.Target;

            var    zone = obj.Zone;
            string zoneStr;

            if (zone != null)
            {
                zoneStr = zone.Id.ToString();

                while ((zone = zone.ParentZone) != null)
                {
                    zoneStr += " in " + zone;
                }
            }
            else
            {
                zoneStr = "<null>";
            }

            var height = obj.TerrainHeight;

            trigger.Reply("Map: " + obj.Map + ", Zone: " + zoneStr);
            trigger.Reply("Position X: " + obj.Position.X + ", Y: " + obj.Position.Y + ", Z: " + obj.Position.Z + ", O: " + obj.Orientation +
                          "(" + Math.Abs(obj.Position.Z - height) + " yds from Ground)");

            int tileX, tileY;

            PositionUtil.GetTileXYForPos(obj.Position, out tileX, out tileY);
            trigger.ReplyFormat("Tile: X={0}, Y={1} (Collision Data {2})", tileX, tileY,
                                obj.Map.Terrain.IsAvailable(tileX, tileY) ?
                                ChatUtility.Colorize("Available", Color.Green) :
                                ChatUtility.Colorize("Unavailable", Color.Red));
        }
コード例 #2
0
ファイル: Ticket.cs プロジェクト: NecroSharper/WCell
 public void DisplayFormat(ITriggerer triggerer, string info)
 {
     triggerer.ReplyFormat("-------------");
     triggerer.ReplyFormat("| " + info + Type + " in " + m_Map.Name + " |");
     triggerer.ReplyFormat("-------------------------------------------------------------------");
     triggerer.ReplyFormat("| by " + m_ownerName + (m_owner == null ? ChatUtility.Colorize(" (Offline)", Color.Red, true) : "") + ", " + Age + " ago.");
     triggerer.ReplyFormat("-------------------------------------------------------------------");
     triggerer.ReplyFormat(Message);
     triggerer.ReplyFormat("-------------------------------------------------------------------");
 }
コード例 #3
0
 public void DisplayFormat(ITriggerer triggerer, string info)
 {
     triggerer.ReplyFormat("-------------");
     triggerer.ReplyFormat("| " + info + (object)this.Type + " in " + this.m_Map.Name + " |");
     triggerer.ReplyFormat("-------------------------------------------------------------------");
     triggerer.ReplyFormat("| by " + this.m_ownerName +
                           (this.m_owner == null
                               ? (object)ChatUtility.Colorize(" (Offline)", Color.Red, true)
                               : (object)"") + ", " + (object)this.Age + " ago.");
     triggerer.ReplyFormat("-------------------------------------------------------------------");
     triggerer.ReplyFormat(this.Message);
     triggerer.ReplyFormat("-------------------------------------------------------------------");
 }
コード例 #4
0
        public async Task Katil(string takmaAd)
        {
            if (!ChatUtility.TakmaAdGecerliMi(takmaAd))
            {
                return;
            }

            // bağlı böyle bir kullanıcı var mı?
            if (db.Kullanicilar.Any(x => x.KullaniciAd == takmaAd && x.BagliMi))
            {
                await Clients.Caller.SendAsync("TakmaAdKullanimda");

                return;
            }

            // bağlı olmayan bu isimde bir kullanıcı var mı?
            var kullanici = db.Kullanicilar.FirstOrDefault(x => x.KullaniciAd == takmaAd);

            if (kullanici == null)
            {
                kullanici = new Kullanici()
                {
                    BagliMi      = true,
                    KullaniciAd  = takmaAd,
                    ConnectionId = Context.ConnectionId,
                    GirisZamani  = DateTime.Now
                };
                db.Kullanicilar.Add(kullanici);
            }
            else
            {
                kullanici.GirisZamani  = DateTime.Now;
                kullanici.CikisZamani  = null;
                kullanici.BagliMi      = true;
                kullanici.ConnectionId = Context.ConnectionId;
            }
            db.SaveChanges();

            // kullanıcıyı genel sohbet odasına katalım
            await Groups.AddToGroupAsync(kullanici.ConnectionId, "genel");

            genelOda.Add(kullanici);
            await Clients.Caller.SendAsync("SohbeteGirildi", genelOda.OrderBy(x => x.KullaniciAd)
                                           .Select(x => x.KullaniciAd));

            await Clients.Others.SendAsync("KullaniciSohbeteGirdi", kullanici.KullaniciAd);
        }
コード例 #5
0
ファイル: TicketCommands.cs プロジェクト: NecroSharper/WCell
            public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
            {
                var tickets = TicketMgr.Instance.GetAllTickets();

                if (tickets.Length == 0)
                {
                    trigger.Reply("There are no active tickets.");
                }
                else
                {
                    foreach (var ticket in tickets)
                    {
                        trigger.Reply("{0} by {1}{2} (age: {3})", ticket.Type, ticket.OwnerName,
                                      ticket.Owner != null ? "" : ChatUtility.Colorize(" (Offline)", Color.Red, true), ticket.Age);
                    }
                }
            }
コード例 #6
0
ファイル: Ticket.cs プロジェクト: 0xFh/Asda2-Project
 internal void OnOwnerLogin(Character chr)
 {
     TicketMgr.Instance.lck.EnterWriteLock();
     try
     {
         m_owner = chr;
         if (m_handler == null)
         {
             return;
         }
         m_handler.SendMessage("Owner of the Ticket you are handling came back -{0}-.",
                               (object)ChatUtility.Colorize("online", Color.Green));
     }
     finally
     {
         TicketMgr.Instance.lck.ExitWriteLock();
     }
 }
コード例 #7
0
 private static void NotifyException(string msg, Exception ex)
 {
     foreach (Character allCharacter in World.GetAllCharacters())
     {
         if (allCharacter.Role.Status == RoleStatus.Admin)
         {
             if (ex != null)
             {
                 allCharacter.SendSystemMessage(ChatUtility.Colorize("Exception raised: ", Color.Red));
             }
             allCharacter.SendSystemMessage(ChatUtility.Colorize(msg, Color.Red));
             if (ex != null)
             {
                 allCharacter.SendSystemMessage(ChatUtility.Colorize(ex.Message, Color.Red));
             }
         }
     }
 }
コード例 #8
0
        private static void NotifyException(string msg, Exception ex)
        {
            foreach (var chr in World.GetAllCharacters())
            {
                if (chr.Role >= ExceptionNotificationRank)
                {
                    if (ex != null)
                    {
                        chr.SendSystemMessage(ChatUtility.Colorize("Exception raised: ", Color.Red));
                    }

                    chr.SendSystemMessage(ChatUtility.Colorize(msg, Color.Red));
                    if (ex != null)
                    {
                        chr.SendSystemMessage(ChatUtility.Colorize(ex.Message, Color.Red));
                    }
                }
            }
        }
コード例 #9
0
        public static void Broadcast(IChatter broadCaster, string message)
        {
            if (broadCaster != null)
            {
                message = broadCaster.Name + ": ";
            }

            GetAllCharacters().SendSystemMessage(message);
            //ChatMgr.ChatNotify(null, message, ChatLanguage.Universal, ChatMsgType.System, null);


            s_log.Info("[Broadcast] " + ChatUtility.Strip(message));

            var evt = Broadcasted;

            if (evt != null)
            {
                evt(broadCaster, message);
            }
        }
コード例 #10
0
ファイル: Ticket.cs プロジェクト: 0xFh/Asda2-Project
 internal void OnOwnerLogout()
 {
     TicketMgr.Instance.lck.EnterWriteLock();
     try
     {
         Position = m_owner.Position;
         m_Map    = m_owner.Map;
         Phase    = m_owner.Phase;
         m_owner  = null;
         ITicketHandler handler = m_handler;
         if (handler == null)
         {
             return;
         }
         handler.SendMessage("Owner of the Ticket you are handling went -{0}-.",
                             (object)ChatUtility.Colorize("offline", Color.Red));
     }
     finally
     {
         TicketMgr.Instance.lck.ExitWriteLock();
     }
 }
コード例 #11
0
 private void OnBroadcast(IChatter sender, string message)
 {
     if (EchoBroadcasts)
     {
         foreach (var chanInfo in IrcAddonConfig.UpdatedChannelNames)
         {
             var chan = GetChannel(chanInfo);
             if (chan == null)
             {
                 continue;
             }
             if (sender != null)
             {
                 chan.Msg(sender.Name + ": " + ChatUtility.Strip(message));
             }
             else
             {
                 chan.Msg(ChatUtility.Strip(message));
             }
         }
     }
 }
コード例 #12
0
 public override void ReplyFormat(string text)
 {
     Console.WriteLine(ChatUtility.Strip(text), true);
 }
コード例 #13
0
 public override void ReplyFormat(string txt)
 {
     Console.ForegroundColor = ConsoleColor.White;
     Console.WriteLine(ChatUtility.Strip(txt));
     Console.ResetColor();
 }
コード例 #14
0
        /// <summary>
        /// Checks whether the client is allowed to login and -if so- logs it in
        /// </summary>
        /// <remarks>Executed in IO-Context.</remarks>
        /// <param name="client"></param>
        /// <param name="charLowId"></param>
        private static void LoginCharacter(IRealmClient client, uint charLowId)
        {
            var acc = client.Account;

            if (acc == null)
            {
                return;
            }

            var record = client.Account.GetCharacterRecord(charLowId);

            if (record == null)
            {
                log.Error(String.Format(WCell_RealmServer.CharacterNotFound, charLowId, acc.Name));

                SendCharacterLoginFail(client, LoginErrorCode.CHAR_LOGIN_NO_CHARACTER);
            }
            else if (record.CharacterFlags.HasAnyFlag(CharEnumFlags.NeedsRename | CharEnumFlags.LockedForBilling))
            {
                // TODO: Check in Char Enum?
                SendCharacterLoginFail(client, LoginErrorCode.AUTH_BILLING_EXPIRED);
            }
            else if (client.ActiveCharacter == null)
            {
                Character chr = null;
                try
                {
                    var evt = BeforeLogin;
                    if (evt != null)
                    {
                        record = evt(client, record);
                        if (record == null)
                        {
                            throw new ArgumentNullException("record", "BeforeLogin returned null");
                        }
                    }
                    chr = record.CreateCharacter();
                    chr.Create(acc, record, client);
                    chr.LoadAndLogin();

                    var message = String.Format("Welcome to " + RealmServer.FormattedTitle);

                    //chr.SendSystemMessage(message);
                    MiscHandler.SendMotd(client, message);

                    if (CharacterHandler.NotifyPlayerStatus)
                    {
                        World.Broadcast("{0} is now " + ChatUtility.Colorize("Online", Color.Green) + ".", chr.Name);
                    }
                }
                catch (Exception ex)
                {
                    LogUtil.ErrorException(ex, "Failed to load Character from Record: " + record);
                    if (chr != null)
                    {
                        // Force client to relog
                        chr.Dispose();
                        client.Disconnect();
                    }
                }
            }
        }
コード例 #15
0
        internal void DoFinishLogout()
        {
            if (!m_isLoggingOut)
            {
                // cancel if logout was cancelled
                return;
            }

            var evt = LoggingOut;

            if (evt != null)
            {
                evt(this);
            }

            // take Player out of world context
            if (!World.RemoveCharacter(this))
            {
                // was already removed
                return;
            }

            // client might now do other things
            m_client.ActiveCharacter = null;
            Account.ActiveCharacter  = null;

            // set to false so it can't be cancelled anymore
            m_isLoggingOut = false;

            // get rid of any minions, totems and their summons
            RemoveSummonedEntourage();

            // jump out of vehicle
            DetatchFromVechicle();

            // remove from the channels they're in
            for (var i = ChatChannels.Count - 1; i >= 0; i--)
            {
                ChatChannels[i].Leave(this, true);
            }

            if (Ticket != null)
            {
                Ticket.OnOwnerLogout();
                Ticket = null;
            }

            if (m_TaxiMovementTimer != null)
            {
                m_TaxiMovementTimer.Stop();
            }

            GroupMgr.Instance.OnCharacterLogout(m_groupMember);
            GuildMgr.Instance.OnCharacterLogout(m_guildMember);
            RelationMgr.Instance.OnCharacterLogout(this);
            InstanceMgr.OnCharacterLogout(this);
            Battlegrounds.OnLogout();

            LastLogout = DateTime.Now;

            // delete and re-spawn corpses and pets when logging back in
            if (m_corpse != null)
            {
                m_corpse.Delete();
            }

            CancelAllActions();
            m_auras.CleanupAuras();

            m_Map.RemoveObjectNow(this);

            //if (!IsPlayerLogout)
            if (!Account.IsActive)
            {
                // Character has been banned
                m_client.Disconnect();
            }
            else
            {
                CharacterHandler.SendPlayerImmediateLogoutReply(m_client);
            }

            if (CharacterHandler.NotifyPlayerStatus)
            {
                World.Broadcast("{0} is now " + ChatUtility.Colorize("Offline", Color.Red) + ".", Name);
            }

            m_initialized = false;

            Dispose();
        }
コード例 #16
0
 public override void ReplyFormat(string txt)
 {
     Reply(ChatUtility.Strip(txt));
 }