<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1019,6 +1019,8 @@ valid examples:
     ItemPrototype const* linkedItem;
     Quest const* linkedQuest;
     SpellEntry const *linkedSpell;
+    ItemRandomPropertiesEntry const* itemProperty;
+    ItemRandomSuffixEntry const* itemSuffix;
 
     while(!reader.eof())
     {
@@ -1027,6 +1029,8 @@ valid examples:
             linkedItem = NULL;
             linkedQuest = NULL;
             linkedSpell = NULL;
+            itemProperty = NULL;
+            itemSuffix = NULL;
 
             reader.ignore(255, '|');
         }
@@ -1143,10 +1147,48 @@ valid examples:
                         return false;
                     }
 
-                    char c = reader.peek();
+                    // the itementry is followed by several integers which describe an instance of this item
+
+                    // position relative after itemEntry
+                    const uint8 randomPropertyPosition = 6;
+
+                    int32 propertyId = 0;
+                    bool negativeNumber = false;
+                    char c;
+                    for(uint8 i=0; i&lt;randomPropertyPosition; ++i)
+                    {
+                        propertyId = 0;
+                        negativeNumber = false;
+                        while((c = reader.get())!=':')
+                        {
+                            if(c &gt;='0' &amp;&amp; c&lt;='9')
+                            {
+                                propertyId*=10;
+                                propertyId += c-'0';
+                            } else if(c == '-')
+                                negativeNumber = true;
+                            else
+                                return false;
+                        }
+                    }
+                    if (negativeNumber)
+                        propertyId *= -1;
+
+                    if (propertyId &gt; 0)
+                    {
+                        itemProperty = sItemRandomPropertiesStore.LookupEntry(propertyId);
+                        if (!itemProperty)
+                            return false;
+                    }
+                    else if(propertyId &lt; 0)
+                    {
+                        itemSuffix = sItemRandomSuffixStore.LookupEntry(-propertyId);
+                        if (!itemSuffix)
+                            return false;
+                    }
 
-                    // ignore enchants etc.
-                    while(c &gt;='0' &amp;&amp; c &lt;='9' || c==':')
+                    // ignore other integers
+                    while ((c &gt;= '0' &amp;&amp; c &lt;= '9') || c== ':')
                     {
                         reader.ignore(1);
                         c = reader.peek();
@@ -1351,22 +1393,34 @@ valid examples:
                     }
                     else if(linkedItem)
                     {
-                        if (strcmp(linkedItem-&gt;Name1, buffer) != 0)
+                        char* const* suffix = itemSuffix?itemSuffix-&gt;nameSuffix:(itemProperty?itemProperty-&gt;nameSuffix:NULL);
+
+                        std::string expectedName = std::string(linkedItem-&gt;Name1);
+                        if (suffix)
                         {
-                            ItemLocale const *il = objmgr.GetItemLocale(linkedItem-&gt;ItemId);
+                            expectedName += &quot; &quot;;
+                            expectedName += suffix[LOCALE_enUS];
+                        }
 
-                            if (!il)
-                            {
-#ifdef MANGOS_DEBUG
-                                sLog.outBasic(&quot;ChatHandler::isValidChatMessage linked item name doesn't is wrong and there is no localization&quot;);
-#endif
-                                return false;
-                            }
+                        if (expectedName != buffer)
+                        {
+                            ItemLocale const *il = objmgr.GetItemLocale(linkedItem-&gt;ItemId);
 
                             bool foundName = false;
-                            for(uint8 i=0; i&lt;il-&gt;Name.size(); ++i)
+                            for(uint8 i=LOCALE_koKR; i&lt;MAX_LOCALE; ++i)
                             {
-                                if (il-&gt;Name[i] == buffer)
+                                int8 dbIndex = objmgr.GetIndexForLocale(LocaleConstant(i));
+                                if (dbIndex == -1 || il == NULL || dbIndex &gt;= il-&gt;Name.size())
+                                    // using strange database/client combinations can lead to this case
+                                    expectedName = linkedItem-&gt;Name1;
+                                else
+                                    expectedName = il-&gt;Name[dbIndex];
+                                if (suffix)
+                                {
+                                    expectedName += &quot; &quot;;
+                                    expectedName += suffix[i];
+                                }
+                                if ( expectedName == buffer)
                                 {
                                     foundName = true;
                                     break;
@@ -2075,4 +2129,4 @@ LocaleConstant CliHandler::GetSessionDbcLocale() const
 int CliHandler::GetSessionDbLocaleIndex() const
 {
     return objmgr.GetDBCLocaleIndex();
-}
\ No newline at end of file
+}</diff>
      <filename>src/game/Chat.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -431,14 +431,14 @@ struct ItemRandomPropertiesEntry
     //char*     internalName                                // 1   unused
     uint32    enchant_id[3];                                // 2-4
                                                             // 5-6 unused, 0 only values, reserved for additional enchantments?
-    //char*     nameSuffix[16]                              // 7-22, unused
+    char*     nameSuffix[16];                               // 7-22
                                                             // 23 nameSufix flags, unused
 };
 
 struct ItemRandomSuffixEntry
 {
     uint32    ID;                                           // 0
-    //char*     name[16]                                    // 1-16 unused
+    char*     nameSuffix[16];                               // 1-16
                                                             // 17, name flags, unused
                                                             // 18  unused
     uint32    enchant_id[3];                                // 19-21</diff>
      <filename>src/game/DBCStructure.h</filename>
    </modified>
    <modified>
      <diff>@@ -58,8 +58,8 @@ const char ItemBagFamilyfmt[]=&quot;nxxxxxxxxxxxxxxxxx&quot;;
 //const char ItemDisplayTemplateEntryfmt[]=&quot;nxxxxxxxxxxixxxxxxxxxxx&quot;;
 //const char ItemCondExtCostsEntryfmt[]=&quot;xiii&quot;;
 const char ItemExtendedCostEntryfmt[]=&quot;niiiiiiiiiiiii&quot;;
-const char ItemRandomPropertiesfmt[]=&quot;nxiiixxxxxxxxxxxxxxxxxxx&quot;;
-const char ItemRandomSuffixfmt[]=&quot;nxxxxxxxxxxxxxxxxxxiiiiii&quot;;
+const char ItemRandomPropertiesfmt[]=&quot;nxiiixxssssssssssssssssx&quot;;
+const char ItemRandomSuffixfmt[]=&quot;nssssssssssssssssxxiiiiii&quot;;
 const char ItemSetEntryfmt[]=&quot;dssssssssssssssssxxxxxxxxxxxxxxxxxxiiiiiiiiiiiiiiiiii&quot;;
 const char LockEntryfmt[]=&quot;niiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx&quot;;
 const char MailTemplateEntryfmt[]=&quot;nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&quot;;</diff>
      <filename>src/game/DBCfmt.h</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>491160c9a45d3c8c71390c239dd2b98909d7f663</id>
    </parent>
  </parents>
  <author>
    <name>arrai</name>
    <email>array.of.intellect@gmail.com</email>
  </author>
  <url>http://github.com/mangos/mangos/commit/41cc487576d6c520136698a5294899837f91b2e6</url>
  <id>41cc487576d6c520136698a5294899837f91b2e6</id>
  <committed-date>2009-10-08T17:34:19-07:00</committed-date>
  <authored-date>2009-10-08T17:18:12-07:00</authored-date>
  <message>Consider random enchants in chatmessage validation

(backported from commit 30908e0)</message>
  <tree>778e4744fd1f6ee8d86cc7cfbd8b0a4210192a42</tree>
  <committer>
    <name>arrai</name>
    <email>array.of.intellect@gmail.com</email>
  </committer>
</commit>
