Azteco

Enable to reload item_template and creature template with co

May 7th, 2013
405
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 8.76 KB | None | 0 0
  1. # HG changeset patch
  2. # User aa@aa-HP
  3. # Date 1367929197 -10800
  4. # Node ID 9059109a3cb6c7506d22507ab8d6785602c91e1d
  5. # Parent  877211cbcfa7059f164521a1651de95b57df3959
  6. Enable to reload item_template and creature template with commands
  7.  
  8. diff -r 877211cbcfa7 -r 9059109a3cb6 src/server/scripts/Commands/cs_reload.cpp
  9. --- a/src/server/scripts/Commands/cs_reload.cpp Tue May 07 15:10:42 2013 +0300
  10. +++ b/src/server/scripts/Commands/cs_reload.cpp Tue May 07 15:19:57 2013 +0300
  11. @@ -103,6 +103,7 @@
  12.              { "gossip_menu",                  SEC_ADMINISTRATOR, true,  &HandleReloadGossipMenuCommand,                 "", NULL },
  13.              { "gossip_menu_option",           SEC_ADMINISTRATOR, true,  &HandleReloadGossipMenuOptionCommand,           "", NULL },
  14.              { "item_enchantment_template",    SEC_ADMINISTRATOR, true,  &HandleReloadItemEnchantementsCommand,          "", NULL },
  15. +           { "item_template",                SEC_ADMINISTRATOR, true,  &HandleReloadItemTemplateCommand,               "", NULL },
  16.              { "item_loot_template",           SEC_ADMINISTRATOR, true,  &HandleReloadLootTemplatesItemCommand,          "", NULL },
  17.              { "item_set_names",               SEC_ADMINISTRATOR, true,  &HandleReloadItemSetNamesCommand,               "", NULL },
  18.              { "lfg_dungeon_rewards",          SEC_ADMINISTRATOR, true,  &HandleReloadLfgRewardsCommand,                 "", NULL },
  19. @@ -314,6 +315,14 @@
  20.          HandleReloadItemEnchantementsCommand(handler, "a");
  21.          return true;
  22.      }
  23. +  
  24. +   static bool HandleReloadItemTemplateCommand(ChatHandler* handler, const char* /*args*/)
  25. +   {
  26. +       sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading item template...");
  27. +       sObjectMgr->LoadItemTemplates();
  28. +        handler->SendGlobalGMSysMessage("DB table `item_template` reloaded.");
  29. +        return true;
  30. +   }
  31.  
  32.      static bool HandleReloadAllLocalesCommand(ChatHandler* handler, const char* /*args*/)
  33.      {
  34. @@ -410,125 +419,11 @@
  35.          return true;
  36.      }
  37.  
  38. -    static bool HandleReloadCreatureTemplateCommand(ChatHandler* handler, const char* args)
  39. +    static bool HandleReloadCreatureTemplateCommand(ChatHandler* handler, const char* /*args*/)
  40.      {
  41. -        if (!*args)
  42. -            return false;
  43. -
  44. -        Tokenizer entries(std::string(args), ' ');
  45. -
  46. -        for (Tokenizer::const_iterator itr = entries.begin(); itr != entries.end(); ++itr)
  47. -        {
  48. -            uint32 entry = uint32(atoi(*itr));
  49. -
  50. -            PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_CREATURE_TEMPLATE);
  51. -            stmt->setUInt32(0, entry);
  52. -            PreparedQueryResult result = WorldDatabase.Query(stmt);
  53. -
  54. -            if (!result)
  55. -            {
  56. -                handler->PSendSysMessage(LANG_COMMAND_CREATURETEMPLATE_NOTFOUND, entry);
  57. -                continue;
  58. -            }
  59. -
  60. -            CreatureTemplate* cInfo = const_cast<CreatureTemplate*>(sObjectMgr->GetCreatureTemplate(entry));
  61. -            if (!cInfo)
  62. -            {
  63. -                handler->PSendSysMessage(LANG_COMMAND_CREATURESTORAGE_NOTFOUND, entry);
  64. -                continue;
  65. -            }
  66. -
  67. -            sLog->outInfo(LOG_FILTER_GENERAL, "Reloading creature template entry %u", entry);
  68. -
  69. -            Field* fields = result->Fetch();
  70. -
  71. -            cInfo->DifficultyEntry[0] = fields[0].GetUInt32();
  72. -            cInfo->DifficultyEntry[1] = fields[1].GetUInt32();
  73. -            cInfo->DifficultyEntry[2] = fields[2].GetUInt32();
  74. -            cInfo->KillCredit[0]      = fields[3].GetUInt32();
  75. -            cInfo->KillCredit[1]      = fields[4].GetUInt32();
  76. -            cInfo->Modelid1           = fields[5].GetUInt32();
  77. -            cInfo->Modelid2           = fields[6].GetUInt32();
  78. -            cInfo->Modelid3           = fields[7].GetUInt32();
  79. -            cInfo->Modelid4           = fields[8].GetUInt32();
  80. -            cInfo->Name               = fields[9].GetString();
  81. -            cInfo->SubName            = fields[10].GetString();
  82. -            cInfo->IconName           = fields[11].GetString();
  83. -            cInfo->GossipMenuId       = fields[12].GetUInt32();
  84. -            cInfo->minlevel           = fields[13].GetUInt8();
  85. -            cInfo->maxlevel           = fields[14].GetUInt8();
  86. -            cInfo->expansion          = fields[15].GetUInt16();
  87. -            cInfo->faction_A          = fields[16].GetUInt16();
  88. -            cInfo->faction_H          = fields[17].GetUInt16();
  89. -            cInfo->npcflag            = fields[18].GetUInt32();
  90. -            cInfo->speed_walk         = fields[19].GetFloat();
  91. -            cInfo->speed_run          = fields[20].GetFloat();
  92. -            cInfo->scale              = fields[21].GetFloat();
  93. -            cInfo->rank               = fields[22].GetUInt8();
  94. -            cInfo->mindmg             = fields[23].GetFloat();
  95. -            cInfo->maxdmg             = fields[24].GetFloat();
  96. -            cInfo->dmgschool          = fields[25].GetUInt8();
  97. -            cInfo->attackpower        = fields[26].GetUInt32();
  98. -            cInfo->dmg_multiplier     = fields[27].GetFloat();
  99. -            cInfo->baseattacktime     = fields[28].GetUInt32();
  100. -            cInfo->rangeattacktime    = fields[29].GetUInt32();
  101. -            cInfo->unit_class         = fields[30].GetUInt8();
  102. -            cInfo->unit_flags         = fields[31].GetUInt32();
  103. -            cInfo->unit_flags2        = fields[32].GetUInt32();
  104. -            cInfo->dynamicflags       = fields[33].GetUInt32();
  105. -            cInfo->family             = fields[34].GetUInt8();
  106. -            cInfo->trainer_type       = fields[35].GetUInt8();
  107. -            cInfo->trainer_spell      = fields[36].GetUInt32();
  108. -            cInfo->trainer_class      = fields[37].GetUInt8();
  109. -            cInfo->trainer_race       = fields[38].GetUInt8();
  110. -            cInfo->minrangedmg        = fields[39].GetFloat();
  111. -            cInfo->maxrangedmg        = fields[40].GetFloat();
  112. -            cInfo->rangedattackpower  = fields[41].GetUInt16();
  113. -            cInfo->type               = fields[42].GetUInt8();
  114. -            cInfo->type_flags         = fields[43].GetUInt32();
  115. -            cInfo->lootid             = fields[44].GetUInt32();
  116. -            cInfo->pickpocketLootId   = fields[45].GetUInt32();
  117. -            cInfo->SkinLootId         = fields[46].GetUInt32();
  118. -
  119. -            for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
  120. -                cInfo->resistance[i] = fields[47 + i -1].GetUInt16();
  121. -
  122. -            cInfo->spells[0]          = fields[53].GetUInt32();
  123. -            cInfo->spells[1]          = fields[54].GetUInt32();
  124. -            cInfo->spells[2]          = fields[55].GetUInt32();
  125. -            cInfo->spells[3]          = fields[56].GetUInt32();
  126. -            cInfo->spells[4]          = fields[57].GetUInt32();
  127. -            cInfo->spells[5]          = fields[58].GetUInt32();
  128. -            cInfo->spells[6]          = fields[59].GetUInt32();
  129. -            cInfo->spells[7]          = fields[60].GetUInt32();
  130. -            cInfo->PetSpellDataId     = fields[61].GetUInt32();
  131. -            cInfo->VehicleId          = fields[62].GetUInt32();
  132. -            cInfo->mingold            = fields[63].GetUInt32();
  133. -            cInfo->maxgold            = fields[64].GetUInt32();
  134. -            cInfo->AIName             = fields[65].GetString();
  135. -            cInfo->MovementType       = fields[66].GetUInt8();
  136. -            cInfo->InhabitType        = fields[67].GetUInt8();
  137. -            cInfo->HoverHeight        = fields[68].GetFloat();
  138. -            cInfo->ModHealth          = fields[69].GetFloat();
  139. -            cInfo->ModMana            = fields[70].GetFloat();
  140. -            cInfo->ModArmor           = fields[71].GetFloat();
  141. -            cInfo->RacialLeader       = fields[72].GetBool();
  142. -            cInfo->questItems[0]      = fields[73].GetUInt32();
  143. -            cInfo->questItems[1]      = fields[74].GetUInt32();
  144. -            cInfo->questItems[2]      = fields[75].GetUInt32();
  145. -            cInfo->questItems[3]      = fields[76].GetUInt32();
  146. -            cInfo->questItems[4]      = fields[77].GetUInt32();
  147. -            cInfo->questItems[5]      = fields[78].GetUInt32();
  148. -            cInfo->movementId         = fields[79].GetUInt32();
  149. -            cInfo->RegenHealth        = fields[80].GetBool();
  150. -            cInfo->MechanicImmuneMask = fields[81].GetUInt32();
  151. -            cInfo->flags_extra        = fields[82].GetUInt32();
  152. -            cInfo->ScriptID           = sObjectMgr->GetScriptId(fields[83].GetCString());
  153. -
  154. -            sObjectMgr->CheckCreatureTemplate(cInfo);
  155. -        }
  156. -
  157. -        handler->SendGlobalGMSysMessage("Creature template reloaded.");
  158. +       sLog->outInfo(LOG_FILTER_GENERAL, "Reloading creatue template...");
  159. +       sObjectMgr->LoadCreatureTemplates();
  160. +       handler->SendGlobalGMSysMessage("DB table `creature_template` reloaded.");
  161.          return true;
  162.      }
Advertisement
Add Comment
Please, Sign In to add comment