Exemple #1
0
 public CypherStringChatBuilder(WorldObject obj, ChatMsg msgType, CypherStrings textId, WorldObject target = null, object[] args = null)
 {
     _source  = obj;
     _msgType = msgType;
     _textId  = textId;
     _target  = target;
     _args    = args;
 }
        static void NotifyModification(CommandHandler handler, Unit target, CypherStrings resourceMessage, CypherStrings resourceReportMessage, params object[] args)
        {
            Player player = target.ToPlayer();

            if (player)
            {
                handler.SendSysMessage(resourceMessage, new object[] { handler.GetNameLink(player) }.Combine(args));
                if (handler.needReportToTarget(player))
                {
                    player.SendSysMessage(resourceReportMessage, new object[] { handler.GetNameLink() }.Combine(args));
                }
            }
        }
Exemple #3
0
        public bool SendSysMessage(CypherStrings str, params object[] args)
        {
            string input   = ObjMgr.GetCypherString(str);
            string pattern = @"%(\d+(\.\d+)?)?(d|f|s|u)";

            int    count  = 0;
            string result = Regex.Replace(input, pattern, m =>
            {
                return(String.Concat("{", count++, "}"));
            });

            return(SendSysMessage(result, args));
        }
Exemple #4
0
        public virtual InternalRelationshipBuilder Apply(InternalRelationshipBuilder relationshipBuilder)
        {
            Check.NotNull(relationshipBuilder, nameof(relationshipBuilder));

            var fk = relationshipBuilder.Metadata;

            var fromDeclaring = FindRelationshipAttributeOnProperty(
                fk.DeclaringEntityType,
                fk.DependentToPrincipal?.Name
                );

            var fromPrincipal = FindRelationshipAttributeOnProperty(
                fk.PrincipalEntityType,
                fk.PrincipalToDependent?.Name
                );

            if (!(fromDeclaring is null) && !(fromPrincipal is null))
            {
                throw new InvalidOperationException(
                          CypherStrings.DuplicateRelationshipAttribute(
                              fk.DeclaringEntityType.DisplayName(),
                              fk.DependentToPrincipal?.Name,
                              fk.PrincipalEntityType.DisplayName(),
                              fk.PrincipalToDependent?.Name
                              )
                          );
            }

            if (!(fromDeclaring is null))
            {
                relationshipBuilder
                .Cypher(ConfigurationSource.DataAnnotation)
                .HasRelationship(
                    fromDeclaring.Name ?? fromDeclaring.Type.DisplayName(),
                    fk.DeclaringEntityType.Name ?? fk.DeclaringEntityType.ClrType.DisplayName()
                    );
            }

            if (!(fromPrincipal is null))
            {
                relationshipBuilder
                .Cypher(ConfigurationSource.DataAnnotation)
                .HasRelationship(
                    fromPrincipal.Name ?? fromPrincipal.Type.DisplayName(),
                    fk.PrincipalEntityType.Name ?? fk.PrincipalEntityType.ClrType.DisplayName()
                    );
            }

            return(relationshipBuilder);
        }
Exemple #5
0
 public void SendNotification(CypherStrings str, params object[] args)
 {
     _session.SendNotification(str, args);
 }
Exemple #6
0
 public void SendSysMessage(CypherStrings cypherString, params object[] args)
 {
     SendSysMessage(string.Format(Global.ObjectMgr.GetCypherString(cypherString), args));
 }
Exemple #7
0
 public string GetParsedString(CypherStrings cypherString, params object[] args)
 {
     return(string.Format(Global.ObjectMgr.GetCypherString(cypherString), args));
 }
Exemple #8
0
 public string GetCypherString(CypherStrings str)
 {
     return(Global.ObjectMgr.GetCypherString(str));
 }
Exemple #9
0
 public void SendNotification(CypherStrings str, params object[] args)
 {
     SendNotification(Global.ObjectMgr.GetCypherString(str), args);
 }
Exemple #10
0
        public static void SendSysMessage(WorldSession session, CypherStrings message, params object[] args)
        {
            string msg = string.Format(ObjMgr.GetCypherString(message), args);

            SendChatMessage(session, ChatMsg.System, Language.Universal, msg);
        }
Exemple #11
0
 public static void SendSysMessage(WorldObject obj, CypherStrings message, params object[] args)
 {
     SendSysMessage(obj.GetSession(), ObjMgr.GetCypherString(message), args);
 }