Jump to content

Item_Template


Guest demonmage

Recommended Posts

Hello, Can anyone please post an example of how an item_template would look if lets say, you did it in notepad (not really) and made a quick item from that then uploaded it to the mangos database as an update/edit to it, im bored and still learning C# so im making a program which i will put some of the info in there and it will create a .sql file with the item info in it so i could upload it to the mysql database =]. Thanks

Link to comment
Share on other sites

ok it should be something like:

insert into `item_template` (`entry`, `class`, `subclass`, `unk0`, `name`, `displayid`, `Quality`, `Flags`, `Flags2`, `BuyCount`, `BuyPrice`, `SellPrice`, `InventoryType`, `AllowableClass`, `AllowableRace`, `ItemLevel`, `RequiredLevel`, `RequiredSkill`, `RequiredSkillRank`, `requiredspell`, `requiredhonorrank`, `RequiredCityRank`, `RequiredReputationFaction`, `RequiredReputationRank`, `maxcount`, `stackable`, `ContainerSlots`, `StatsCount`, `stat_type1`, `stat_value1`, `stat_type2`, `stat_value2`, `stat_type3`, `stat_value3`, `stat_type4`, `stat_value4`, `stat_type5`, `stat_value5`, `stat_type6`, `stat_value6`, `stat_type7`, `stat_value7`, `stat_type8`, `stat_value8`, `stat_type9`, `stat_value9`, `stat_type10`, `stat_value10`, `ScalingStatDistribution`, `ScalingStatValue`, `dmg_min1`, `dmg_max1`, `dmg_type1`, `dmg_min2`, `dmg_max2`, `dmg_type2`, `armor`, `holy_res`, `fire_res`, `nature_res`, `frost_res`, `shadow_res`, `arcane_res`, `delay`, `ammo_type`, `RangedModRange`, `spellid_1`, `spelltrigger_1`, `spellcharges_1`, `spellppmRate_1`, `spellcooldown_1`, `spellcategory_1`, `spellcategorycooldown_1`, `spellid_2`, `spelltrigger_2`, `spellcharges_2`, `spellppmRate_2`, `spellcooldown_2`, `spellcategory_2`, `spellcategorycooldown_2`, `spellid_3`, `spelltrigger_3`, `spellcharges_3`, `spellppmRate_3`, `spellcooldown_3`, `spellcategory_3`, `spellcategorycooldown_3`, `spellid_4`, `spelltrigger_4`, `spellcharges_4`, `spellppmRate_4`, `spellcooldown_4`, `spellcategory_4`, `spellcategorycooldown_4`, `spellid_5`, `spelltrigger_5`, `spellcharges_5`, `spellppmRate_5`, `spellcooldown_5`, `spellcategory_5`, `spellcategorycooldown_5`, `bonding`, `description`, `PageText`, `LanguageID`, `PageMaterial`, `startquest`, `lockid`, `Material`, `sheath`, `RandomProperty`, `RandomSuffix`, `block`, `itemset`, `MaxDurability`, `area`, `Map`, `BagFamily`, `TotemCategory`, `socketColor_1`, `socketContent_1`, `socketColor_2`, `socketContent_2`, `socketColor_3`, `socketContent_3`, `socketBonus`, `GemProperties`, `RequiredDisenchantSkill`, `ArmorDamageModifier`, `Duration`, `ItemLimitCategory`, `HolidayId`, `ScriptName`, `DisenchantID`, `FoodType`, `minMoneyLoot`, `maxMoneyLoot`, `ExtraFlags`) values('99999','2','7','-1','My Sword','1542','1','0','0','1','36','7','21','-1','-1','2','1','0','0','0','0','0','0','0','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','1','3','0','0','0','0','0','0','0','0','0','0','0','1900','0','0','0','0','0','0','-1','0','-1','0','0','0','0','-1','0','-1','0','0','0','0','-1','0','-1','0','0','0','0','-1','0','-1','0','0','0','0','-1','0','-1','0','','0','1','0','0','0','1','3','0','0','0','0','20','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','0','0','0','','0','0','0','0','0');

There are a lot of columns.

Link to comment
Share on other sites

yeah, i was realizing how long this is going to be due to the fact that im making this work for both Mangos and Trinity, so thats DOUBBLE the variables im using and which it takes 2 lines of code just to declare one of the variables.... /UGH not to mention the part which makes it put all the info into the text will require basically all the same info all over again =[

edit: lol nevermind my other edit i was looking at the wrong database....my bad.

Link to comment
Share on other sites

   public class SQL
   {
       // Download DLL: mysql.data (mysql site)

       MySql.Data.MySqlClient.MySqlConnection Conn;
       MySql.Data.MySqlClient.MySqlCommand Cmd;
       MySql.Data.MySqlClient.MySqlDataReader Reader;

       //===========================================================================================

       ~SQL()
       {
           // Garbage Collection
           System.GC.Collect(System.GC.GetGeneration(this), System.GCCollectionMode.Forced);
       }

       public SQL(string address, string db, string user, string pass)
       {
           try
           {
               Conn = new MySql.Data.MySqlClient.MySqlConnection("SERVER=" + address + "; DATABASE=" + db + "; UID=" + user + "; PASSWORD=" + pass + ";");
               Cmd = Conn.CreateCommand();
               Cmd.CommandTimeout = 1000;
           }
           catch (MySql.Data.MySqlClient.MySqlException)
           {
               // debug
           }

           // Garbage Collection
           System.GC.Collect(System.GC.GetGeneration(this), System.GCCollectionMode.Forced);
       }

       //===========================================================================================

       public string RunQuery(string cmdquery)
       {
           Cmd.CommandText = string.Empty;
           string query_result = string.Empty;
           int rowsAffected = 0;
           //---->
           try
           {
               Cmd.CommandText = cmdquery;
               //---->
               Conn.Open();
               Reader = Cmd.ExecuteReader();
               //---->
               while (Reader.Read())
               {
                   // [FIX] Multi-Threading - 100% CPU
                   System.Threading.Thread.Sleep(1);

                   if (rowsAffected > 0) query_result += ",";
                   rowsAffected++;
                   //---->
                   for (int i = 0; i < Reader.FieldCount; i++)
                   {
                       if (i == 0) query_result += ((Reader.GetValue(i).ToString() != "") ? Reader.GetValue(i).ToString() : "Null");
                       else query_result += "," + ((Reader.GetValue(i).ToString() != "") ? Reader.GetValue(i).ToString() : "Null");
                   }
               }
               //---->
               if (query_result.Trim() == string.Empty)
                   query_result = rowsAffected.ToString();
           }
           catch (MySql.Data.MySqlClient.MySqlException)
           {
               // debug

               // Garbage Collection
               System.GC.Collect(System.GC.GetGeneration(this), System.GCCollectionMode.Forced);
           }
           //---->
           Conn.Close();

           return query_result;
       }
   }

Why not insert directly into the database instead of create a file?

In this way saves time ^_^

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use