Skip to content

Commit

Permalink
NPCBots: Fix .npcbot createnew command
Browse files Browse the repository at this point in the history
  • Loading branch information
trickerer committed Jun 24, 2024
1 parent 617eea9 commit 056526c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/server/game/AI/NpcBots/botcommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3137,10 +3137,14 @@ class script_bot_commands : public CommandScript
trans->Append("DROP TEMPORARY TABLE IF EXISTS creature_template_temp_npcbot_create");
trans->Append("CREATE TEMPORARY TABLE creature_template_temp_npcbot_create ENGINE=MEMORY SELECT * FROM creature_template WHERE entry = (SELECT entry FROM creature_template_npcbot_extras WHERE class = {} LIMIT 1)", uint32(*bclass));
trans->Append("UPDATE creature_template_temp_npcbot_create SET entry = {}, name = \"{}\"", newentry, namestr.c_str());
if (modelId)
trans->Append("UPDATE creature_template_temp_npcbot_create SET modelid1 = {}", modelId);
trans->Append("INSERT INTO creature_template SELECT * FROM creature_template_temp_npcbot_create");
trans->Append("DROP TEMPORARY TABLE creature_template_temp_npcbot_create");
if (modelId)
trans->Append("DROP TEMPORARY TABLE IF EXISTS creature_template_model_temp_npcbot_create");
trans->Append("CREATE TEMPORARY TABLE creature_template_model_temp_npcbot_create ENGINE=MEMORY SELECT * FROM creature_template_model WHERE CreatureID = (SELECT entry FROM creature_template_npcbot_extras WHERE class = {} LIMIT 1)", uint32(*bclass));
trans->Append("UPDATE creature_template_model_temp_npcbot_create SET CreatureID = {}, CreatureDisplayID = {}", newentry, modelId);
trans->Append("INSERT INTO creature_template_model SELECT * FROM creature_template_model_temp_npcbot_create");
trans->Append("DROP TEMPORARY TABLE creature_template_model_temp_npcbot_create");
trans->Append("REPLACE INTO creature_template_npcbot_extras VALUES ({}, {}, {})", newentry, uint32(*bclass), uint32(*race));
trans->Append("REPLACE INTO creature_equip_template SELECT {}, 1, ids.itemID1, ids.itemID2, ids.itemID3, -1 FROM (SELECT itemID1, itemID2, itemID3 FROM creature_equip_template WHERE CreatureID = (SELECT entry FROM creature_template_npcbot_extras WHERE class = {} LIMIT 1)) ids", newentry, uint32(*bclass));
if (can_change_appearance)
Expand Down

1 comment on commit 056526c

@kissingers
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As if miss {} so there is a alarm when bulid

if (modelId)
{
trans->Append("DROP TEMPORARY TABLE IF EXISTS creature_template_model_temp_npcbot_create");
trans->Append("CREATE TEMPORARY TABLE creature_template_model_temp_npcbot_create ENGINE=MEMORY SELECT * FROM creature_template_model WHERE CreatureID = (SELECT entry FROM creature_template_npcbot_extras WHERE class = {} LIMIT 1)", uint32(*bclass));
trans->Append("UPDATE creature_template_model_temp_npcbot_create SET CreatureID = {}, CreatureDisplayID = {}", newentry, modelId);
trans->Append("INSERT INTO creature_template_model SELECT * FROM creature_template_model_temp_npcbot_create");
trans->Append("DROP TEMPORARY TABLE creature_template_model_temp_npcbot_create");
}

Please sign in to comment.