From 04f08d26a72ab29b11fc2aaef65bc54078cc2086 Mon Sep 17 00:00:00 2001 From: MrSmite Date: Fri, 14 Dec 2012 00:46:36 -0500 Subject: [PATCH 01/33] Implements saving of loot (items / money) contained inside lootable inventory items. * Unlooted items / money persist across player sessions * Loot inside items is tied to the item rather than the player so if trading partially looted items becomes possible, this implementation will still work * New tables added: characters_database.sql (first time users) characters_create_item_loot.sql (existing users) Implementation Can be tested with: Watertight Trunk [21113] Bulging Sack of Gems [25422] Fat Sack of Coins [11937] Closes #2048 --- sql/base/characters_database.sql | 35 ++++ .../characters_create_item_loot.sql | 52 +++++ src/server/game/Entities/Item/Item.cpp | 196 ++++++++++++++++++ src/server/game/Entities/Item/Item.h | 9 + src/server/game/Entities/Player/Player.cpp | 21 +- src/server/game/Handlers/LootHandler.cpp | 16 +- src/server/game/Loot/LootMgr.cpp | 41 ++++ src/server/game/Loot/LootMgr.h | 16 +- .../Implementation/CharacterDatabase.cpp | 9 + .../Implementation/CharacterDatabase.h | 8 + 10 files changed, 398 insertions(+), 5 deletions(-) create mode 100644 sql/updates/characters/characters_create_item_loot.sql diff --git a/sql/base/characters_database.sql b/sql/base/characters_database.sql index d8cdd409bf7..9e16db1f381 100644 --- a/sql/base/characters_database.sql +++ b/sql/base/characters_database.sql @@ -1954,6 +1954,41 @@ LOCK TABLES `item_instance` WRITE; /*!40000 ALTER TABLE `item_instance` ENABLE KEYS */; UNLOCK TABLES; +-- +-- Table structure for table `item_loot_items` +-- + +DROP TABLE IF EXISTS `item_loot_items`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `item_loot_items` ( + `container_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'guid of container (item_instance.guid)', + `item_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'loot item entry (item_instance.itemEntry)', + `item_count` int(10) NOT NULL DEFAULT '0' COMMENT 'stack size', + `follow_rules` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'follow loot rules', + `ffa` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'free-for-all', + `blocked` tinyint(1) NOT NULL DEFAULT '0', + `counted` tinyint(1) NOT NULL DEFAULT '0', + `under_threshold` tinyint(1) NOT NULL DEFAULT '0', + `needs_quest` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'quest drop', + `rnd_prop` int(10) NOT NULL DEFAULT '0' COMMENT 'random enchantment added when originally rolled', + `rnd_suffix` int(10) NOT NULL DEFAULT '0' COMMENT 'random suffix added when originally rolled' +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `item_loot_money` +-- + +DROP TABLE IF EXISTS `item_loot_money`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `item_loot_money` ( + `container_id` int(10) NOT NULL DEFAULT '0' COMMENT 'guid of container (item_instance.guid)', + `money` int(10) NOT NULL DEFAULT '0' COMMENT 'money loot (in copper)' +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `item_refund_instance` -- diff --git a/sql/updates/characters/characters_create_item_loot.sql b/sql/updates/characters/characters_create_item_loot.sql new file mode 100644 index 00000000000..3c1529e8bdf --- /dev/null +++ b/sql/updates/characters/characters_create_item_loot.sql @@ -0,0 +1,52 @@ +/* +SQLyog Ultimate v9.63 +MySQL - 5.5.21 : Database - characters +********************************************************************* +*/ + +/*!40101 SET NAMES utf8 */; + +/*!40101 SET SQL_MODE=''*/; + +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `item_loot_items` +-- + +DROP TABLE IF EXISTS `item_loot_items`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `item_loot_items` ( + `container_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'guid of container (item_instance.guid)', + `item_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'loot item entry (item_instance.itemEntry)', + `item_count` int(10) NOT NULL DEFAULT '0' COMMENT 'stack size', + `follow_rules` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'follow loot rules', + `ffa` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'free-for-all', + `blocked` tinyint(1) NOT NULL DEFAULT '0', + `counted` tinyint(1) NOT NULL DEFAULT '0', + `under_threshold` tinyint(1) NOT NULL DEFAULT '0', + `needs_quest` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'quest drop', + `rnd_prop` int(10) NOT NULL DEFAULT '0' COMMENT 'random enchantment added when originally rolled', + `rnd_suffix` int(10) NOT NULL DEFAULT '0' COMMENT 'random suffix added when originally rolled' +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `item_loot_money` +-- + +DROP TABLE IF EXISTS `item_loot_money`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `item_loot_money` ( + `container_id` int(10) NOT NULL DEFAULT '0' COMMENT 'guid of container (item_instance.guid)', + `money` int(10) NOT NULL DEFAULT '0' COMMENT 'money loot (in copper)' +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index bdaf11ad9b8..5303fb8dc38 100644 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -378,6 +378,10 @@ void Item::SaveToDB(SQLTransaction& trans) if (!isInTransaction) CharacterDatabase.CommitTransaction(trans); + // Delete the items if this is a container + if (!loot.isLooted()) + ItemContainerDeleteLootMoneyAndLootItemsFromDB(); + delete this; return; } @@ -483,6 +487,10 @@ void Item::DeleteFromDB(SQLTransaction& trans, uint32 itemGuid) void Item::DeleteFromDB(SQLTransaction& trans) { DeleteFromDB(trans, GetGUIDLow()); + + // Delete the items if this is a container + if (!loot.isLooted()) + ItemContainerDeleteLootMoneyAndLootItemsFromDB(); } /*static*/ @@ -1198,3 +1206,191 @@ bool Item::CheckSoulboundTradeExpire() return false; } + +void Item::ItemContainerSaveLootToDB() +{ + // Saves the money and item loot associated with an openable item to the DB + + if (loot.isLooted()) // no money and no loot + return; + + uint32 container_id = GetGUIDLow(); + SQLTransaction trans = CharacterDatabase.BeginTransaction(); + + loot.containerID = container_id; // Save this for when a LootItem is removed + + // Save money + if (loot.gold > 0) + { + PreparedStatement* stmt_money = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_MONEY); + stmt_money->setUInt32(0, container_id); + trans->Append(stmt_money); + + stmt_money = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEMCONTAINER_MONEY); + stmt_money->setUInt32(0, container_id); + stmt_money->setUInt32(1, loot.gold); + trans->Append(stmt_money); + } + + // Save items + if (!loot.isLooted()) + { + + PreparedStatement* stmt_items = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_ITEMS); + stmt_items->setUInt32(0, container_id); + trans->Append(stmt_items); + + // Now insert the items + for (LootItemList::const_iterator _li = loot.items.begin(); _li != loot.items.end(); _li++) + { + // When an item is looted, it doesn't get removed from the items collection + // but we don't want to resave it. + if (!_li->canSave) + continue; + + stmt_items = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEMCONTAINER_ITEMS); + + // container_id, item_id, item_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_prop, rnd_suffix + stmt_items->setUInt32(0, container_id); + stmt_items->setUInt32(1, _li->itemid); + stmt_items->setUInt32(2, _li->count); + stmt_items->setBool(3, _li->follow_loot_rules); + stmt_items->setBool(4, _li->freeforall); + stmt_items->setBool(5, _li->is_blocked); + stmt_items->setBool(6, _li->is_counted); + stmt_items->setBool(7, _li->is_underthreshold); + stmt_items->setBool(8, _li->needs_quest); + stmt_items->setUInt32(9, _li->randomPropertyId); + stmt_items->setUInt32(10, _li->randomSuffix); + trans->Append(stmt_items); + } + } + + CharacterDatabase.CommitTransaction(trans); +} + +bool Item::ItemContainerLoadLootFromDB() +{ + // Loads the money and item loot associated with an openable item from the DB + + // Default. If there are no records for this item then it will be rolled for in Player::SendLoot() + m_lootGenerated = false; + + uint32 container_id = GetGUIDLow(); + + // Save this for later use + loot.containerID = container_id; + + // First, see if there was any money loot. This gets added directly to the container. + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEMCONTAINER_MONEY); + stmt->setUInt32(0, container_id); + PreparedQueryResult money_result = CharacterDatabase.Query(stmt); + + if (money_result) + { + Field* fields = money_result->Fetch(); + loot.gold = fields[0].GetUInt32(); + } + + // Next, load any items that were saved + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEMCONTAINER_ITEMS); + stmt->setUInt32(0, container_id); + PreparedQueryResult item_result = CharacterDatabase.Query(stmt); + + if (item_result) + { + // Get a LootTemplate for the container item. This is where + // the saved loot was originally rolled from, we will copy conditions from it + LootTemplate const* lt = LootTemplates_Item.GetLootFor(GetEntry()); + + if (lt) + { + do + { + // Create an empty LootItem + LootItem loot_item = LootItem(); + + // Fill in the rest of the LootItem from the DB + Field* fields = item_result->Fetch(); + + // item_id, itm_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_prop, rnd_suffix + loot_item.itemid = fields[0].GetUInt32(); + loot_item.count = fields[1].GetUInt32(); + loot_item.follow_loot_rules = fields[2].GetBool(); + loot_item.freeforall = fields[3].GetBool(); + loot_item.is_blocked = fields[4].GetBool(); + loot_item.is_counted = fields[5].GetBool(); + loot_item.canSave = true; + loot_item.is_underthreshold = fields[6].GetBool(); + loot_item.needs_quest = fields[7].GetBool(); + loot_item.randomPropertyId = fields[8].GetUInt32(); + loot_item.randomSuffix = fields[9].GetUInt32(); + + // Copy the extra loot conditions from the item in the loot template + lt->CopyConditions(&loot_item); + + // If container item is in a bag, add that player as an allowed looter + if (GetBagSlot()) + loot_item.allowedGUIDs.insert(GetOwner()->GetGUIDLow()); + + // Finally add the LootItem to the container + loot.items.push_back(loot_item); + + // Increment unlooted count + loot.unlootedCount++; + + } while (item_result->NextRow()); + } + } + + // Mark the item if it has loot so it won't be generated again on open + m_lootGenerated = !loot.isLooted(); + + return m_lootGenerated; +} + +void Item::ItemContainerDeleteLootItemsFromDB() +{ + // Deletes items associated with an openable item from the DB + + uint32 containerId = GetGUIDLow(); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_ITEMS); + stmt->setUInt32(0, containerId); + SQLTransaction trans = CharacterDatabase.BeginTransaction(); + trans->Append(stmt); + CharacterDatabase.CommitTransaction(trans); +} + +void Item::ItemContainerDeleteLootItemFromDB(uint32 itemID) +{ + // Deletes a single item associated with an openable item from the DB + + uint32 containerId = GetGUIDLow(); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_ITEM); + stmt->setUInt32(0, containerId); + stmt->setUInt32(1, itemID); + SQLTransaction trans = CharacterDatabase.BeginTransaction(); + trans->Append(stmt); + CharacterDatabase.CommitTransaction(trans); +} + +void Item::ItemContainerDeleteLootMoneyFromDB() +{ + // Deletes the money loot associated with an openable item from the DB + + uint32 containerId = GetGUIDLow(); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_MONEY); + stmt->setUInt32(0, containerId); + SQLTransaction trans = CharacterDatabase.BeginTransaction(); + trans->Append(stmt); + CharacterDatabase.CommitTransaction(trans); +} + +void Item::ItemContainerDeleteLootMoneyAndLootItemsFromDB() +{ + // Deletes money and items associated with an openable item from the DB + + ItemContainerDeleteLootMoneyFromDB(); + ItemContainerDeleteLootItemsFromDB(); +} + diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h index a5f9ed5c008..2e1956250f3 100644 --- a/src/server/game/Entities/Item/Item.h +++ b/src/server/game/Entities/Item/Item.h @@ -231,6 +231,15 @@ class Item : public Object static void DeleteFromDB(SQLTransaction& trans, uint32 itemGuid); virtual void DeleteFromDB(SQLTransaction& trans); static void DeleteFromInventoryDB(SQLTransaction& trans, uint32 itemGuid); + + // Lootable items and their contents + void ItemContainerSaveLootToDB(); + bool ItemContainerLoadLootFromDB(); + void ItemContainerDeleteLootItemsFromDB(); + void ItemContainerDeleteLootItemFromDB(uint32 itemID); + void ItemContainerDeleteLootMoneyFromDB(); + void ItemContainerDeleteLootMoneyAndLootItemsFromDB(); + void DeleteFromInventoryDB(SQLTransaction& trans); void SaveRefundDataToDB(); void DeleteRefundDataFromDB(SQLTransaction* trans); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index cf573ec8c5a..34d132f6dce 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -8903,7 +8903,9 @@ void Player::SendLoot(uint64 guid, LootType loot_type) loot = &item->loot; - if (!item->m_lootGenerated) + // If item doesn't already have loot, attempt to load it. If that + // fails then this is first time opening, generate loot + if (!item->m_lootGenerated && !item->ItemContainerLoadLootFromDB()) { item->m_lootGenerated = true; loot->clear(); @@ -8922,6 +8924,12 @@ void Player::SendLoot(uint64 guid, LootType loot_type) default: loot->generateMoneyLoot(item->GetTemplate()->MinMoneyLoot, item->GetTemplate()->MaxMoneyLoot); loot->FillLoot(item->GetEntry(), LootTemplates_Item, this, true, loot->gold != 0); + + // Force save the loot and money items that were just rolled + // Also saves the container item ID in Loot struct (not to DB) + if (loot->gold > 0 || loot->unlootedCount > 0) + item->ItemContainerSaveLootToDB(); + break; } } @@ -12675,6 +12683,12 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) else if (Bag* pBag = GetBagByPos(bag)) pBag->RemoveItem(slot, update); + // Delete rolled money / loot from db. + // MUST be done before RemoveFromWorld() or GetTemplate() fails + if (ItemTemplate const* pTmp = pItem->GetTemplate()) + if (pTmp->Flags & ITEM_PROTO_FLAG_OPENABLE) + pItem->ItemContainerDeleteLootMoneyAndLootItemsFromDB(); + if (IsInWorld() && update) { pItem->RemoveFromWorld(); @@ -24055,6 +24069,11 @@ void Player::StoreLootItem(uint8 lootSlot, Loot* loot) UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item->itemid, item->count); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, loot->loot_type, item->count); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM, item->itemid, item->count); + + // LootItem is being removed (looted) from the container, delete it from the DB. + if (loot->containerID > 0) + loot->DeleteLootItemFromContainerItemDB(item->itemid); + } else SendEquipError(msg, NULL, NULL, item->itemid); diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp index 752eace536b..b15636e75d2 100644 --- a/src/server/game/Handlers/LootHandler.cpp +++ b/src/server/game/Handlers/LootHandler.cpp @@ -93,6 +93,10 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData) } player->StoreLootItem(lootSlot, loot); + + // If player is removing the last LootItem, delete the empty container. + if (loot->isLooted() && IS_ITEM_GUID(lguid)) + player->GetSession()->DoLootRelease(lguid); } void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recvData*/) @@ -200,6 +204,14 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recvData*/) } loot->gold = 0; + + // Delete the money loot record from the DB + if (loot->containerID > 0) + loot->DeleteLootMoneyFromContainerItemDB(); + + // Delete container if empty + if (loot->isLooted() && IS_ITEM_GUID(guid)) + player->GetSession()->DoLootRelease(guid); } } @@ -381,8 +393,8 @@ void WorldSession::DoLootRelease(uint64 lguid) player->DestroyItemCount(pItem, count, true); } else - // FIXME: item must not be deleted in case not fully looted state. But this pre-request implement loot saving in DB at item save. Or cheating possible. - player->DestroyItem(pItem->GetBagSlot(), pItem->GetSlot(), true); + if (pItem->loot.isLooted()) // Only delete item if no loot or money (unlooted loot is saved to db) + player->DestroyItem(pItem->GetBagSlot(), pItem->GetSlot(), true); return; // item can be looted only single player } else diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index ef3d2b9fbd6..098fcc657b3 100644 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -334,6 +334,7 @@ LootItem::LootItem(LootStoreItem const& li) is_blocked = 0; is_underthreshold = 0; is_counted = 0; + canSave = true; } // Basic checks for player/item compatibility - if false no chance to see the item in the loot @@ -654,6 +655,33 @@ void Loot::generateMoneyLoot(uint32 minAmount, uint32 maxAmount) } } +void Loot::DeleteLootItemFromContainerItemDB(uint32 itemID) +{ + // Deletes a single item associated with an openable item from the DB + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_ITEM); + stmt->setUInt32(0, containerID); + stmt->setUInt32(1, itemID); + CharacterDatabase.Execute(stmt); + + // Mark the item looted to prevent resaving + for (LootItemList::iterator _itr = items.begin(); _itr != items.end(); _itr++) + { + if (!_itr->itemid == itemID) + continue; + + _itr->canSave = true; + break; + } +} + +void Loot::DeleteLootMoneyFromContainerItemDB() +{ + // Deletes money loot associated with an openable item from the DB + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_MONEY); + stmt->setUInt32(0, containerID); + CharacterDatabase.Execute(stmt); +} + LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem* *qitem, QuestItem* *ffaitem, QuestItem* *conditem) { LootItem* item = NULL; @@ -1239,6 +1267,19 @@ void LootTemplate::CopyConditions(ConditionList conditions) i->CopyConditions(conditions); } +void LootTemplate::CopyConditions(LootItem* li) const +{ + // Copies the conditions list from a template item to a LootItem + for (LootStoreItemList::const_iterator _iter = Entries.begin(); _iter != Entries.end(); ++_iter) + { + if (!_iter->itemid == li->itemid) + continue; + + li->conditions = _iter->conditions; + break; + } +} + // Rolls for every item in the template and adds the rolled items the the loot void LootTemplate::Process(Loot& loot, bool rate, uint16 lootMode, uint8 groupId) const { diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h index 45fc5c7983c..cfa5d370e3b 100644 --- a/src/server/game/Loot/LootMgr.h +++ b/src/server/game/Loot/LootMgr.h @@ -141,14 +141,17 @@ struct LootItem bool is_counted : 1; bool needs_quest : 1; // quest drop bool follow_loot_rules : 1; + bool canSave; // Constructor, copies most fields from LootStoreItem, generates random count and random suffixes/properties // Should be called for non-reference LootStoreItem entries only (mincountOrRef > 0) explicit LootItem(LootStoreItem const& li); + // Empty constructor for creating an empty LootItem to be filled in with DB data + LootItem() : canSave(true){}; + // Basic checks for player/item compatibility - if false no chance to see the item in the loot bool AllowedForPlayer(Player const* player) const; - void AddAllowedLooter(Player const* player); const AllowedLooterSet & GetAllowedLooters() const { return allowedGUIDs; } }; @@ -223,6 +226,7 @@ class LootTemplate // Rolls for every item in the template and adds the rolled items the the loot void Process(Loot& loot, bool rate, uint16 lootMode, uint8 groupId = 0) const; void CopyConditions(ConditionList conditions); + void CopyConditions(LootItem* li) const; // True if template includes at least 1 quest drop entry bool HasQuestDrop(LootTemplateMap const& store, uint8 groupId = 0) const; @@ -286,10 +290,18 @@ struct Loot uint8 unlootedCount; uint64 roundRobinPlayer; // GUID of the player having the Round-Robin ownership for the loot. If 0, round robin owner has released. LootType loot_type; // required for achievement system + + // GUIDLow of container that holds this loot (item_instance.entry) + // Only set for inventory items that can be right-click looted + uint32 containerID; - Loot(uint32 _gold = 0) : gold(_gold), unlootedCount(0), loot_type(LOOT_CORPSE) {} + Loot(uint32 _gold = 0) : gold(_gold), unlootedCount(0), loot_type(LOOT_CORPSE), containerID(0) {} ~Loot() { clear(); } + // For deleting items at loot removal since there is no backward interface to the Item() + void DeleteLootItemFromContainerItemDB(uint32 itemID); + void DeleteLootMoneyFromContainerItemDB(); + // if loot becomes invalid this reference is used to inform the listener void addLootValidatorRef(LootValidatorRef* pLootValidatorRef) { diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index 33f0cab5170..3ef94f3aafd 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -540,6 +540,15 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_DEL_CHAR_ACTION_EXCEPT_SPEC, "DELETE FROM character_action WHERE spec<>? AND guid = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_SEL_CHAR_PET_BY_ENTRY_AND_SLOT, "SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, curhappiness, abdata, savetime, CreatedBySpell, PetType FROM character_pet WHERE owner = ? AND slot = ?", CONNECTION_SYNCH); + // Items that hold loot or money + PREPARE_STATEMENT(CHAR_SEL_ITEMCONTAINER_ITEMS, "SELECT item_id, item_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_prop, rnd_suffix FROM item_loot_items WHERE container_id = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_DEL_ITEMCONTAINER_ITEMS, "DELETE FROM item_loot_items WHERE container_id = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_ITEMCONTAINER_ITEM, "DELETE FROM item_loot_items WHERE container_id = ? AND item_id = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_INS_ITEMCONTAINER_ITEMS, "INSERT INTO item_loot_items (container_id, item_id, item_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_prop, rnd_suffix) VALUES (?,?,?,?,?,?,?,?,?,?,?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_SEL_ITEMCONTAINER_MONEY, "SELECT money FROM item_loot_money WHERE container_id = ?", CONNECTION_SYNCH); + PREPARE_STATEMENT(CHAR_DEL_ITEMCONTAINER_MONEY, "DELETE FROM item_loot_money WHERE container_id = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_INS_ITEMCONTAINER_MONEY," INSERT INTO item_loot_money (container_id, money) VALUES (?,?)", CONNECTION_ASYNC); + // Calendar PREPARE_STATEMENT(CHAR_REP_CALENDAR_EVENT, "REPLACE INTO calendar_events (id, creator, title, description, type, dungeon, eventtime, flags, time2) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_DEL_CALENDAR_EVENT, "DELETE FROM calendar_events WHERE id = ?", CONNECTION_ASYNC); diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h index 181161978df..d2e69fb0d17 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.h +++ b/src/server/shared/Database/Implementation/CharacterDatabase.h @@ -505,6 +505,14 @@ enum CharacterDatabaseStatements CHAR_REP_CALENDAR_INVITE, CHAR_DEL_CALENDAR_INVITE, + CHAR_SEL_ITEMCONTAINER_ITEMS, + CHAR_DEL_ITEMCONTAINER_ITEMS, + CHAR_DEL_ITEMCONTAINER_ITEM, + CHAR_INS_ITEMCONTAINER_ITEMS, + CHAR_SEL_ITEMCONTAINER_MONEY, + CHAR_DEL_ITEMCONTAINER_MONEY, + CHAR_INS_ITEMCONTAINER_MONEY, + MAX_CHARACTERDATABASE_STATEMENTS }; From f4e7cde1b5c8e5f071c4cb650a1101e184ddf552 Mon Sep 17 00:00:00 2001 From: joschiwald Date: Wed, 19 Dec 2012 12:55:51 +0100 Subject: [PATCH 02/33] Core/Misc: - some simplifications in reputation calculation - removed aura in SPELL_AURA_LINKED should depends on SpellDifficulty - remove some unneeded variable declarations when it's already declared - remove some hacks - fix some warnings in Lfg stuff - some codestyle changes --- .../world/2012_12_19_01_world_misc.sql | 26 +++ src/server/game/Entities/Object/Object.cpp | 7 +- src/server/game/Entities/Pet/Pet.cpp | 8 +- src/server/game/Entities/Player/Player.cpp | 191 +++++++----------- src/server/game/Handlers/CharacterHandler.cpp | 18 +- src/server/game/Maps/Map.cpp | 2 +- .../game/Spells/Auras/SpellAuraEffects.cpp | 2 +- src/server/game/Tools/PlayerDump.cpp | 1 - .../Northrend/Ulduar/Ulduar/boss_ignis.cpp | 2 +- .../Ulduar/Ulduar/boss_razorscale.cpp | 2 +- src/server/scripts/Spells/spell_generic.cpp | 2 +- 11 files changed, 113 insertions(+), 148 deletions(-) create mode 100644 sql/updates/world/2012_12_19_01_world_misc.sql diff --git a/sql/updates/world/2012_12_19_01_world_misc.sql b/sql/updates/world/2012_12_19_01_world_misc.sql new file mode 100644 index 00000000000..c04965d8258 --- /dev/null +++ b/sql/updates/world/2012_12_19_01_world_misc.sql @@ -0,0 +1,26 @@ +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=17 AND `SourceEntry`=52781; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(17,0,52781,0,0,31,0,3,28610,0,0,27,0,'','Persuasive Strike - Scarlet Marksman'), +(17,0,52781,0,1,31,0,3,28939,0,0,27,0,'','Persuasive Strike - Scarlet Preacher'), +(17,0,52781,0,2,31,0,3,28940,0,0,27,0,'','Persuasive Strike - Scarlet Crusader'); + +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (32096,32098); +INSERT INTO `spell_linked_spell` (`spell_trigger`,`spell_effect`,`type`,`comment`) VALUES +(32096,32172,2,'Thrallmar''s Favor'), +(32098,32172,2,'Honor Hold''s Favor'); + +DELETE FROM `spell_area` WHERE `spell` IN (32096,32098); +INSERT INTO `spell_area` (`spell`,`area`,`autocast`) VALUES +(32096,3483,0), +(32096,3562,0), +(32096,3713,0), +(32096,3714,0), +(32096,3836,0), +(32098,3483,0), +(32098,3562,0), +(32098,3713,0), +(32098,3714,0), +(32098,3836,0); + +-- Dark / Light essence removing +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (-67222, -67223, -67224, -65686, -67176, -67177, -67178, -65684); diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 7818cdc6942..d96cf58db52 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -2336,12 +2336,7 @@ void WorldObject::SetZoneScript() if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())) m_zoneScript = bf; else - { - if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())) - m_zoneScript = bf; - else - m_zoneScript = sOutdoorPvPMgr->GetZoneScript(GetZoneId()); - } + m_zoneScript = sOutdoorPvPMgr->GetZoneScript(GetZoneId()); } } } diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 5238eed2e15..a6130f03c6e 100644 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -268,7 +268,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c { SQLTransaction trans = CharacterDatabase.BeginTransaction(); - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_PET_SLOT_BY_SLOT_EXCLUDE_ID); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_PET_SLOT_BY_SLOT_EXCLUDE_ID); stmt->setUInt8(0, uint8(PET_SAVE_NOT_IN_SLOT)); stmt->setUInt32(1, ownerid); stmt->setUInt8(2, uint8(PET_SAVE_AS_CURRENT)); @@ -333,7 +333,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c if (getPetType() == HUNTER_PET) { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_DECLINED_NAME); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_DECLINED_NAME); stmt->setUInt32(0, owner->GetGUIDLow()); stmt->setUInt32(1, GetCharmInfo()->GetPetNumber()); PreparedQueryResult result = CharacterDatabase.Query(stmt); @@ -429,7 +429,7 @@ void Pet::SavePetToDB(PetSaveMode mode) // prevent existence another hunter pet in PET_SAVE_AS_CURRENT and PET_SAVE_NOT_IN_SLOT if (getPetType() == HUNTER_PET && (mode == PET_SAVE_AS_CURRENT || mode > PET_SAVE_LAST_STABLE_SLOT)) { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_BY_SLOT); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_BY_SLOT); stmt->setUInt32(0, ownerLowGUID); stmt->setUInt8(1, uint8(PET_SAVE_AS_CURRENT)); stmt->setUInt8(2, uint8(PET_SAVE_LAST_STABLE_SLOT)); @@ -1350,7 +1350,7 @@ void Pet::_SaveAuras(SQLTransaction& trans) uint8 index = 0; - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PET_AURA); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PET_AURA); stmt->setUInt32(index++, m_charmInfo->GetPetNumber()); stmt->setUInt64(index++, casterGUID); stmt->setUInt32(index++, itr->second->GetId()); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index cf573ec8c5a..3c58e9cb467 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -4750,7 +4750,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC // We can return mail now // So firstly delete the old one - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_BY_ID); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_BY_ID); stmt->setUInt32(0, mail_id); trans->Append(stmt); @@ -4759,7 +4759,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC { if (has_items) { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM_BY_ID); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM_BY_ID); stmt->setUInt32(0, mail_id); trans->Append(stmt); } @@ -4773,7 +4773,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC if (has_items) { // Data needs to be at first place for Item::LoadFromDB - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAILITEMS); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAILITEMS); stmt->setUInt32(0, mail_id); PreparedQueryResult resultItems = CharacterDatabase.Query(stmt); if (resultItems) @@ -4988,7 +4988,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC // The character gets unlinked from the account, the name gets freed up and appears as deleted ingame case CHAR_DELETE_UNLINK: { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_DELETE_INFO); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_DELETE_INFO); stmt->setUInt32(0, guid); @@ -5725,7 +5725,7 @@ void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, floa float Player::GetBaseModValue(BaseModGroup modGroup, BaseModType modType) const { - if (modGroup >= BASEMOD_END || modType > MOD_END) + if (modGroup >= BASEMOD_END || modType >= MOD_END) { sLog->outError(LOG_FILTER_SPELLS_AURAS, "trial to access non existed BaseModGroup or wrong BaseModType!"); return 0.0f; @@ -6993,7 +6993,10 @@ int32 Player::CalculateReputationGain(ReputationSource source, uint32 creatureOr percent *= repRate; } - return int32(rep * percent / 100.0f); + if (source != REPUTATION_SOURCE_SPELL && GetsRecruitAFriendBonus(false)) + percent *= 1.0f + sWorld->getRate(RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS); + + return CalculatePct(rep, percent); } // Calculates how many reputation points player gains in victim's enemy factions @@ -7016,43 +7019,20 @@ void Player::RewardReputation(Unit* victim, float rate) // support for: Championing - http://www.wowwiki.com/Championing Map const* map = GetMap(); - if (map && map->IsDungeon()) + if (map && map->IsNonRaidDungeon()) { - InstanceTemplate const* instance = sObjectMgr->GetInstanceTemplate(map->GetId()); - if (instance) - { - AccessRequirement const* pAccessRequirement = sObjectMgr->GetAccessRequirement(map->GetId(), ((InstanceMap*)map)->GetDifficulty()); - if (pAccessRequirement) - { - if (!map->IsRaid() && pAccessRequirement->levelMin == 80) - ChampioningFaction = GetChampioningFaction(); - } - } + if (AccessRequirement const* accessRequirement = sObjectMgr->GetAccessRequirement(map->GetId(), map->GetDifficulty())) + if (accessRequirement->levelMin == 80) + ChampioningFaction = GetChampioningFaction(); } } - // Favored reputation increase START - uint32 zone = GetZoneId(); uint32 team = GetTeam(); - float favored_rep_mult = 0; - - if ((HasAura(32096) || HasAura(32098)) && (zone == 3483 || zone == 3562 || zone == 3836 || zone == 3713 || zone == 3714)) - favored_rep_mult = 0.25; // Thrallmar's Favor and Honor Hold's Favor - else if (HasAura(30754) && (Rep->RepFaction1 == 609 || Rep->RepFaction2 == 609) && !ChampioningFaction) - favored_rep_mult = 0.25; // Cenarion Favor - - if (favored_rep_mult > 0) favored_rep_mult *= 2; // Multiplied by 2 because the reputation is divided by 2 for some reason (See "donerep1 / 2" and "donerep2 / 2") -- if you know why this is done, please update/explain :) - // Favored reputation increase END - - bool recruitAFriend = GetsRecruitAFriendBonus(false); if (Rep->RepFaction1 && (!Rep->TeamDependent || team == ALLIANCE)) { int32 donerep1 = CalculateReputationGain(REPUTATION_SOURCE_KILL, victim->getLevel(), Rep->RepValue1, ChampioningFaction ? ChampioningFaction : Rep->RepFaction1); - donerep1 = int32(donerep1*(rate + favored_rep_mult)); - - if (recruitAFriend) - donerep1 = int32(donerep1 * (1 + sWorld->getRate(RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS))); + donerep1 = int32(donerep1 * rate); FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction1); uint32 current_reputation_rank1 = GetReputationMgr().GetRank(factionEntry1); @@ -7063,10 +7043,7 @@ void Player::RewardReputation(Unit* victim, float rate) if (Rep->RepFaction2 && (!Rep->TeamDependent || team == HORDE)) { int32 donerep2 = CalculateReputationGain(REPUTATION_SOURCE_KILL, victim->getLevel(), Rep->RepValue2, ChampioningFaction ? ChampioningFaction : Rep->RepFaction2); - donerep2 = int32(donerep2*(rate + favored_rep_mult)); - - if (recruitAFriend) - donerep2 = int32(donerep2 * (1 + sWorld->getRate(RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS))); + donerep2 = int32(donerep2 * rate); FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction2); uint32 current_reputation_rank2 = GetReputationMgr().GetRank(factionEntry2); @@ -7078,59 +7055,43 @@ void Player::RewardReputation(Unit* victim, float rate) // Calculate how many reputation points player gain with the quest void Player::RewardReputation(Quest const* quest) { - bool recruitAFriend = GetsRecruitAFriendBonus(false); - - // quest reputation reward/loss for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) { if (!quest->RewardFactionId[i]) continue; + + int32 rep = 0; + bool noQuestBonus = false; + if (quest->RewardFactionValueIdOverride[i]) { - int32 rep = 0; - - if (quest->IsDaily()) - rep = CalculateReputationGain(REPUTATION_SOURCE_DAILY_QUEST, GetQuestLevel(quest), quest->RewardFactionValueIdOverride[i]/100, quest->RewardFactionId[i], true); - else if (quest->IsWeekly()) - rep = CalculateReputationGain(REPUTATION_SOURCE_WEEKLY_QUEST, GetQuestLevel(quest), quest->RewardFactionValueIdOverride[i]/100, quest->RewardFactionId[i], true); - else if (quest->IsMonthly()) - rep = CalculateReputationGain(REPUTATION_SOURCE_MONTHLY_QUEST, GetQuestLevel(quest), quest->RewardFactionValueIdOverride[i]/100, quest->RewardFactionId[i], true); - else - rep = CalculateReputationGain(REPUTATION_SOURCE_QUEST, GetQuestLevel(quest), quest->RewardFactionValueIdOverride[i]/100, quest->RewardFactionId[i], true); - - if (recruitAFriend) - rep = int32(rep * (1 + sWorld->getRate(RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS))); - - if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(quest->RewardFactionId[i])) - GetReputationMgr().ModifyReputation(factionEntry, rep); + rep = quest->RewardFactionValueIdOverride[i] / 100; + noQuestBonus = true; } else { uint32 row = ((quest->RewardFactionValueId[i] < 0) ? 1 : 0) + 1; - uint32 field = abs(quest->RewardFactionValueId[i]); - - if (QuestFactionRewEntry const* pRow = sQuestFactionRewardStore.LookupEntry(row)) + if (QuestFactionRewEntry const* questFactionRewEntry = sQuestFactionRewardStore.LookupEntry(row)) { - int32 repPoints = pRow->QuestRewFactionValue[field]; - if (!repPoints) - continue; - - if (quest->IsDaily()) - repPoints = CalculateReputationGain(REPUTATION_SOURCE_DAILY_QUEST, GetQuestLevel(quest), repPoints, quest->RewardFactionId[i]); - else if (quest->IsWeekly()) - repPoints = CalculateReputationGain(REPUTATION_SOURCE_WEEKLY_QUEST, GetQuestLevel(quest), repPoints, quest->RewardFactionId[i]); - else if (quest->IsMonthly()) - repPoints = CalculateReputationGain(REPUTATION_SOURCE_MONTHLY_QUEST, GetQuestLevel(quest), repPoints, quest->RewardFactionId[i]); - else - repPoints = CalculateReputationGain(REPUTATION_SOURCE_QUEST, GetQuestLevel(quest), repPoints, quest->RewardFactionId[i]); - - if (recruitAFriend) - repPoints = int32(repPoints * (1 + sWorld->getRate(RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS))); - - if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(quest->RewardFactionId[i])) - GetReputationMgr().ModifyReputation(factionEntry, repPoints); + uint32 field = abs(quest->RewardFactionValueId[i]); + rep = questFactionRewEntry->QuestRewFactionValue[field]; } } + + if (!rep) + continue; + + if (quest->IsDaily()) + rep = CalculateReputationGain(REPUTATION_SOURCE_DAILY_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], noQuestBonus); + else if (quest->IsWeekly()) + rep = CalculateReputationGain(REPUTATION_SOURCE_WEEKLY_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], noQuestBonus); + else if (quest->IsMonthly()) + rep = CalculateReputationGain(REPUTATION_SOURCE_MONTHLY_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], noQuestBonus); + else + rep = CalculateReputationGain(REPUTATION_SOURCE_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], noQuestBonus); + + if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(quest->RewardFactionId[i])) + GetReputationMgr().ModifyReputation(factionEntry, rep); } } @@ -7431,7 +7392,7 @@ uint32 Player::GetZoneIdFromDB(uint64 guid) if (!zone) { // stored zone is zero, use generic and slow zone detection - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_POSITION_XYZ); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_POSITION_XYZ); stmt->setUInt32(0, guidLow); PreparedQueryResult result = CharacterDatabase.Query(stmt); @@ -7447,7 +7408,7 @@ uint32 Player::GetZoneIdFromDB(uint64 guid) if (zone > 0) { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ZONE); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ZONE); stmt->setUInt16(0, uint16(zone)); stmt->setUInt32(1, guidLow); @@ -8394,25 +8355,11 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 if (spellData.SpellPPMRate) { - if (spellData.SpellId == 52781) // Persuasive Strike - { - switch (target->GetEntry()) - { - default: - return; - case 28939: - case 28940: - case 28610: - break; - } - } uint32 WeaponSpeed = GetAttackTime(attType); chance = GetPPMProcChance(WeaponSpeed, spellData.SpellPPMRate, spellInfo); } else if (chance > 100.0f) - { chance = GetWeaponProcChance(); - } if (roll_chance_f(chance)) CastSpell(target, spellInfo->Id, true, item); @@ -9683,8 +9630,8 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid) instance->FillInitialWorldStates(data); else { - data << uint32(4132) << uint32(0); // 9 WORLDSTATE_SHOW_CRATES - data << uint32(4131) << uint32(0); // 10 WORLDSTATE_CRATES_REVEALED + data << uint32(4132) << uint32(0); // 9 WORLDSTATE_ALGALON_TIMER_ENABLED + data << uint32(4131) << uint32(0); // 10 WORLDSTATE_ALGALON_DESPAWN_TIMER } break; // Wintergrasp @@ -9826,11 +9773,10 @@ void Player::SetSheath(SheathState sheathed) SetVirtualItemSlot(2, NULL); break; case SHEATH_STATE_MELEE: // prepared melee weapon - { SetVirtualItemSlot(0, GetWeaponForAttack(BASE_ATTACK, true)); SetVirtualItemSlot(1, GetWeaponForAttack(OFF_ATTACK, true)); SetVirtualItemSlot(2, NULL); - }; break; + break; case SHEATH_STATE_RANGED: // prepared ranged weapon SetVirtualItemSlot(0, NULL); SetVirtualItemSlot(1, NULL); @@ -11968,7 +11914,7 @@ InventoryResult Player::CanRollForItemInLFG(ItemTemplate const* proto, WorldObje Map const* map = lootedObject->GetMap(); if (uint32 dungeonId = sLFGMgr->GetDungeon(GetGroup()->GetGUID(), true)) if (LFGDungeonData const* dungeon = sLFGMgr->GetLFGDungeon(dungeonId)) - if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == uint32(map->GetDifficulty())) + if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == map->GetDifficulty()) lootedObjectInDungeon = true; if (!lootedObjectInDungeon) @@ -12366,12 +12312,12 @@ Item* Player::EquipItem(uint16 pos, Item* pItem, bool update) switch (slot) { - case EQUIPMENT_SLOT_MAINHAND: - case EQUIPMENT_SLOT_OFFHAND: - case EQUIPMENT_SLOT_RANGED: - RecalculateRating(CR_ARMOR_PENETRATION); - default: - break; + case EQUIPMENT_SLOT_MAINHAND: + case EQUIPMENT_SLOT_OFFHAND: + case EQUIPMENT_SLOT_RANGED: + RecalculateRating(CR_ARMOR_PENETRATION); + default: + break; } } else @@ -17724,7 +17670,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F } else { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEM_REFUNDS); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEM_REFUNDS); stmt->setUInt32(0, item->GetGUIDLow()); stmt->setUInt32(1, GetGUIDLow()); if (PreparedQueryResult result = CharacterDatabase.Query(stmt)) @@ -17744,7 +17690,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F } else if (item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_BOP_TRADEABLE)) { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEM_BOP_TRADE); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEM_BOP_TRADE); stmt->setUInt32(0, item->GetGUIDLow()); if (PreparedQueryResult result = CharacterDatabase.Query(stmt)) { @@ -18348,11 +18294,12 @@ InstancePlayerBind* Player::BindToInstance(InstanceSave* save, bool permanent, b if (save) { InstancePlayerBind& bind = m_boundInstances[save->GetDifficulty()][save->GetMapId()]; - if (bind.save) + if (!load) { - // update the save when the group kills a boss - if (permanent != bind.perm || save != bind.save) - if (!load) + if (bind.save) + { + // update the save when the group kills a boss + if (permanent != bind.perm || save != bind.save) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_INSTANCE); @@ -18363,9 +18310,8 @@ InstancePlayerBind* Player::BindToInstance(InstanceSave* save, bool permanent, b CharacterDatabase.Execute(stmt); } - } - else - if (!load) + } + else { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_INSTANCE); @@ -18375,6 +18321,7 @@ InstancePlayerBind* Player::BindToInstance(InstanceSave* save, bool permanent, b CharacterDatabase.Execute(stmt); } + } if (bind.save != save) { @@ -18393,8 +18340,8 @@ InstancePlayerBind* Player::BindToInstance(InstanceSave* save, bool permanent, b sScriptMgr->OnPlayerBindToInstance(this, save->GetDifficulty(), save->GetMapId(), permanent); return &bind; } - else - return NULL; + + return NULL; } void Player::BindToInstance() @@ -19082,7 +19029,7 @@ void Player::_SaveInventory(SQLTransaction& trans) if (!item || item->GetState() == ITEM_NEW) continue; - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_ITEM); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_ITEM); stmt->setUInt32(0, item->GetGUIDLow()); trans->Append(stmt); @@ -19167,7 +19114,6 @@ void Player::_SaveInventory(SQLTransaction& trans) } } - PreparedStatement* stmt = NULL; switch (item->GetState()) { case ITEM_NEW: @@ -19204,7 +19150,7 @@ void Player::_SaveMail(SQLTransaction& trans) Mail* m = (*itr); if (m->state == MAIL_STATE_CHANGED) { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_MAIL); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_MAIL); stmt->setUInt8(0, uint8(m->HasItems() ? 1 : 0)); stmt->setUInt32(1, uint32(m->expire_time)); stmt->setUInt32(2, uint32(m->deliver_time)); @@ -19231,7 +19177,6 @@ void Player::_SaveMail(SQLTransaction& trans) { if (m->HasItems()) { - PreparedStatement* stmt = NULL; for (MailItemInfoVec::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE); @@ -20586,7 +20531,7 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type) if (type == 10) { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ALL_PETITION_SIGNATURES); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ALL_PETITION_SIGNATURES); stmt->setUInt32(0, GUID_LOPART(guid)); @@ -20594,7 +20539,7 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type) } else { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE); stmt->setUInt32(0, GUID_LOPART(guid)); stmt->setUInt8(1, uint8(type)); @@ -20652,7 +20597,7 @@ void Player::LeaveAllArenaTeams(uint64 guid) while (result->NextRow()); } -void Player::SetRestBonus (float rest_bonus_new) +void Player::SetRestBonus(float rest_bonus_new) { // Prevent resting on max level if (getLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 0e9ad902d8f..9580e1d193a 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -1806,7 +1806,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) if (recvData.GetOpcode() == CMSG_CHAR_FACTION_CHANGE) { // Delete all Flypaths - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_TAXI_PATH); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_TAXI_PATH); stmt->setUInt32(0, lowGuid); trans->Append(stmt); @@ -1851,7 +1851,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) taximaskstream << '0'; std::string taximask = taximaskstream.str(); - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_TAXIMASK); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_TAXIMASK); stmt->setString(0, taximask); stmt->setUInt32(1, lowGuid); trans->Append(stmt); @@ -1898,7 +1898,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD)) { // Reset guild - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER); stmt->setUInt32(0, lowGuid); @@ -1911,7 +1911,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND)) { // Delete Friend List - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_GUID); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_GUID); stmt->setUInt32(0, lowGuid); trans->Append(stmt); @@ -1957,7 +1957,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) uint32 achiev_alliance = it->first; uint32 achiev_horde = it->second; - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT); stmt->setUInt16(0, uint16(team == TEAM_ALLIANCE ? achiev_alliance : achiev_horde)); stmt->setUInt32(1, lowGuid); trans->Append(stmt); @@ -1975,7 +1975,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) uint32 item_alliance = it->first; uint32 item_horde = it->second; - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_INVENTORY_FACTION_CHANGE); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_INVENTORY_FACTION_CHANGE); stmt->setUInt32(0, (team == TEAM_ALLIANCE ? item_alliance : item_horde)); stmt->setUInt32(1, (team == TEAM_ALLIANCE ? item_horde : item_alliance)); stmt->setUInt32(2, guid); @@ -1988,7 +1988,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) uint32 spell_alliance = it->first; uint32 spell_horde = it->second; - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL_BY_SPELL); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL_BY_SPELL); stmt->setUInt32(0, (team == TEAM_ALLIANCE ? spell_alliance : spell_horde)); stmt->setUInt32(1, lowGuid); trans->Append(stmt); @@ -2009,7 +2009,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) uint32 oldReputation = (team == TEAM_ALLIANCE) ? reputation_horde : reputation_alliance; // select old standing set in db - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_REP_BY_FACTION); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_REP_BY_FACTION); stmt->setUInt32(0, oldReputation); stmt->setUInt32(1, lowGuid); PreparedQueryResult result = CharacterDatabase.Query(stmt); @@ -2101,7 +2101,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) for (uint32 index = 0; index < ktcount; ++index) ss << knownTitles[index] << ' '; - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_TITLES_FACTION_CHANGE); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_TITLES_FACTION_CHANGE); stmt->setString(0, ss.str().c_str()); stmt->setUInt32(1, lowGuid); trans->Append(stmt); diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 831b29c2cfd..2c8da44a963 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -2474,7 +2474,7 @@ bool InstanceMap::AddPlayerToMap(Player* player) if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true)) if (LFGDungeonData const* dungeon = sLFGMgr->GetLFGDungeon(dungeonId)) if (LFGDungeonData const* randomDungeon = sLFGMgr->GetLFGDungeon(*(sLFGMgr->GetSelectedDungeons(player->GetGUID()).begin()))) - if (uint32(dungeon->map) == GetId() && dungeon->difficulty == uint32(GetDifficulty()) && randomDungeon->type == uint32(LFG_TYPE_RANDOM)) + if (uint32(dungeon->map) == GetId() && dungeon->difficulty == GetDifficulty() && randomDungeon->type == LFG_TYPE_RANDOM) player->CastSpell(player, LFG_SPELL_LUCK_OF_THE_DRAW, true); } diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 17cb16fd6d5..ae30cf72609 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -5453,7 +5453,7 @@ void AuraEffect::HandleAuraLinked(AuraApplication const* aurApp, uint8 mode, boo { Unit* target = aurApp->GetTarget(); - uint32 triggeredSpellId = m_spellInfo->Effects[m_effIndex].TriggerSpell; + uint32 triggeredSpellId = sSpellMgr->GetSpellIdForDifficulty(m_spellInfo->Effects[m_effIndex].TriggerSpell, target); SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggeredSpellId); if (!triggeredSpellInfo) return; diff --git a/src/server/game/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp index 57986243879..23114bda12a 100644 --- a/src/server/game/Tools/PlayerDump.cpp +++ b/src/server/game/Tools/PlayerDump.cpp @@ -406,7 +406,6 @@ DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, s if (!fin) return DUMP_FILE_OPEN_ERROR; - QueryResult result = QueryResult(NULL); char newguid[20], chraccount[20], newpetid[20], currpetid[20], lastpetid[20]; // make sure the same guid doesn't already exist and is safe to use diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp index 8f68542d462..c8789d680ed 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp @@ -208,7 +208,7 @@ class boss_ignis : public CreatureScript switch (eventId) { case EVENT_JET: - me->MonsterTextEmote(EMOTE_JETS, 0, true); + Talk(EMOTE_JETS); DoCast(me, SPELL_FLAME_JETS); events.ScheduleEvent(EVENT_JET, urand(35000, 40000)); break; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp index 9643b2ec9ab..5f560ed8dd4 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp @@ -1084,7 +1084,7 @@ class achievement_quick_shave : public AchievementCriteriaScript bool OnCheck(Player* /*source*/, Unit* target) { - if (target) + if (target) if (Creature* razorscale = target->ToCreature()) if (razorscale->AI()->GetData(DATA_QUICK_SHAVE)) return true; diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 667b6841b63..77374932cbd 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1418,7 +1418,7 @@ class spell_gen_luck_of_the_draw : public SpellScriptLoader if (group->isLFGGroup()) if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true)) if (LFGDungeonData const* dungeon = sLFGMgr->GetLFGDungeon(dungeonId)) - if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == uint32(map->GetDifficulty())) + if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == map->GetDifficulty()) if (randomDungeon && randomDungeon->type == LFG_TYPE_RANDOM) return; // in correct dungeon From 200968c2dd295cd17fc470aecd8ee2bbd3ad1b39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Bla=C5=BEevi=C4=87?= Date: Wed, 19 Dec 2012 09:43:27 +0100 Subject: [PATCH 03/33] Script/AQ: Add Creature Text for Viscidus and fix model scaling --- .../world/2012_12_19_01_world_viscidus.sql | 11 +++++ .../TempleOfAhnQiraj/boss_viscidus.cpp | 45 +++++++++++++------ 2 files changed, 43 insertions(+), 13 deletions(-) create mode 100644 sql/updates/world/2012_12_19_01_world_viscidus.sql diff --git a/sql/updates/world/2012_12_19_01_world_viscidus.sql b/sql/updates/world/2012_12_19_01_world_viscidus.sql new file mode 100644 index 00000000000..16d33b80b8f --- /dev/null +++ b/sql/updates/world/2012_12_19_01_world_viscidus.sql @@ -0,0 +1,11 @@ +DELETE FROM `spell_dbc` WHERE `Id`=25893; +INSERT INTO `spell_dbc` (`Id`,`Dispel`,`Mechanic`,`Attributes`,`AttributesEx`,`AttributesEx2`,`AttributesEx3`,`AttributesEx4`,`AttributesEx5`,`AttributesEx6`,`AttributesEx7`,`Stances`,`StancesNot`,`Targets`,`CastingTimeIndex`,`AuraInterruptFlags`,`ProcFlags`,`ProcChance`,`ProcCharges`,`MaxLevel`,`BaseLevel`,`SpellLevel`,`DurationIndex`,`RangeIndex`,`StackAmount`,`EquippedItemClass`,`EquippedItemSubClassMask`,`EquippedItemInventoryTypeMask`,`Effect1`,`Effect2`,`Effect3`,`EffectDieSides1`,`EffectDieSides2`,`EffectDieSides3`,`EffectRealPointsPerLevel1`,`EffectRealPointsPerLevel2`,`EffectRealPointsPerLevel3`,`EffectBasePoints1`,`EffectBasePoints2`,`EffectBasePoints3`,`EffectMechanic1`,`EffectMechanic2`,`EffectMechanic3`,`EffectImplicitTargetA1`,`EffectImplicitTargetA2`,`EffectImplicitTargetA3`,`EffectImplicitTargetB1`,`EffectImplicitTargetB2`,`EffectImplicitTargetB3`,`EffectRadiusIndex1`,`EffectRadiusIndex2`,`EffectRadiusIndex3`,`EffectApplyAuraName1`,`EffectApplyAuraName2`,`EffectApplyAuraName3`,`EffectAmplitude1`,`EffectAmplitude2`,`EffectAmplitude3`,`EffectMultipleValue1`,`EffectMultipleValue2`,`EffectMultipleValue3`,`EffectMiscValue1`,`EffectMiscValue2`,`EffectMiscValue3`,`EffectMiscValueB1`,`EffectMiscValueB2`,`EffectMiscValueB3`,`EffectTriggerSpell1`,`EffectTriggerSpell2`,`EffectTriggerSpell3`,`EffectSpellClassMaskA1`,`EffectSpellClassMaskA2`,`EffectSpellClassMaskA3`,`EffectSpellClassMaskB1`,`EffectSpellClassMaskB2`,`EffectSpellClassMaskB3`,`EffectSpellClassMaskC1`,`EffectSpellClassMaskC2`,`EffectSpellClassMaskC3`,`MaxTargetLevel`,`SpellFamilyName`,`SpellFamilyFlags1`,`SpellFamilyFlags2`,`SpellFamilyFlags3`,`MaxAffectedTargets`,`DmgClass`,`PreventionType`,`DmgMultiplier1`,`DmgMultiplier2`,`DmgMultiplier3`,`AreaGroupId`,`SchoolMask`,`Comment`) VALUES +(25893,0,0,8388864,268435456,5,269484032,0,0,0,0,0,0,0,1,0,0,101,0,0,0,0,225,13,20,-1,0,0,6,0,0,1,0,0,0,0,0,-5,0,0,0,0,0,1,0,0,0,0,0,0,0,0,61,0,0,0,0,0,0,0,0,0,0,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,1,0,0,0,'Viscidus Shrinks'); +DELETE FROM `creature_text` WHERE `entry`=15299; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(15299, 0, 0, 'Viscidus begins to slow!', 41, 0, 100, 0, 0, 0, 'EMOTE_SLOW'), +(15299, 1, 0, 'Viscidus is freezing up!', 41, 0, 100, 0, 0, 0, 'EMOTE_FREEZE'), +(15299, 2, 0, 'Viscidus is frozen solid!', 41, 0, 100, 0, 0, 0, 'EMOTE_FROZEN'), +(15299, 3, 0, 'Viscidus begins to crack!', 41, 0, 100, 0, 0, 0, 'EMOTE_CRACK'), +(15299, 4, 0, 'Viscidus looks ready to shatter!', 41, 0, 100, 0, 0, 0, 'EMOTE_SHATTER'), +(15299, 5, 0, 'Viscidus explodes!', 41, 0, 100, 0, 0, 0, 'EMOTE_EXPLODE'); diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp index 0f575043da6..c97fd40929a 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp @@ -31,10 +31,10 @@ enum Spells SPELL_REJOIN_VISCIDUS = 25896, SPELL_VISCIDUS_EXPLODE = 25938, SPELL_VISCIDUS_SUICIDE = 26003, + SPELL_VISCIDUS_SHRINKS = 25893, // Removed from client, in world.spell_dbc SPELL_MEMBRANE_VISCIDUS = 25994, // damage reduction spell - removed from DBC SPELL_VISCIDUS_WEAKNESS = 25926, // aura which procs at damage - should trigger the slow spells - removed from DBC - SPELL_VISCIDUS_SHRINKS = 25893, // (6) Apply Aura #61: Mod Scale Value: -4 - removed from DBC SPELL_VISCIDUS_GROWS = 25897, // removed from DBC SPELL_SUMMON_GLOBS = 25885, // summons npc 15667 using spells from 25865 to 25884; All spells have target coords - removed from DBC SPELL_VISCIDUS_TELEPORT = 25904, // removed from DBC @@ -54,19 +54,26 @@ enum Phases PHASE_GLOB = 3 }; +enum Emotes +{ + EMOTE_SLOW = 0, + EMOTE_FREEZE = 1, + EMOTE_FROZEN = 2, + + EMOTE_CRACK = 3, + EMOTE_SHATTER = 4, + EMOTE_EXPLODE = 5 +}; + enum HitCounter { - HITCOUNTER_SLOW = 100, // "Viscidus begins to slow." - HITCOUNTER_SLOW_MORE = 150, // "Viscidus begins to freeze." - HITCOUNTER_FREEZE = 200, // "Viscidus is frozen solid." + HITCOUNTER_SLOW = 100, + HITCOUNTER_SLOW_MORE = 150, + HITCOUNTER_FREEZE = 200, - // 4.3.4 data - HITCOUNTER_CRACK = 50, // "Viscidus begins to crack." - HITCOUNTER_SHATTER = 100, // "Viscidus looks ready to shatter." - HITCOUNTER_EXPLODE = 150, // "Viscidus explodes." - - // 1.12 data - // HITCOUNTER_EXPLODE = 75 + HITCOUNTER_CRACK = 50, + HITCOUNTER_SHATTER = 100, + HITCOUNTER_EXPLODE = 150, }; enum MovePoints @@ -74,7 +81,7 @@ enum MovePoints ROOM_CENTER = 1 }; -Position const ViscidusCoord = { -7992.36f, 908.19f, -52.62f, 1.68f }; // TODO: Visci ain't room middle +Position const ViscidusCoord = { -7992.36f, 908.19f, -52.62f, 1.68f }; // TODO: Visci isn't in room middle float const RoomRadius = 40.0f; // TODO: Not sure if its correct class boss_viscidus : public CreatureScript @@ -102,6 +109,7 @@ class boss_viscidus : public CreatureScript if (attacker->HasUnitState(UNIT_STATE_MELEE_ATTACKING) && _hitcounter >= HITCOUNTER_EXPLODE) { + Talk(EMOTE_EXPLODE); events.Reset(); _phase = PHASE_GLOB; DoCast(me, SPELL_VISCIDUS_EXPLODE); @@ -125,6 +133,10 @@ class boss_viscidus : public CreatureScript } } } + else if (_hitcounter == HITCOUNTER_SHATTER) + Talk(EMOTE_SHATTER); + else if (_hitcounter == HITCOUNTER_CRACK) + Talk(EMOTE_CRACK); } void SpellHit(Unit* /*caster*/, SpellInfo const* spell) @@ -135,6 +147,8 @@ class boss_viscidus : public CreatureScript if (_hitcounter >= HITCOUNTER_FREEZE) { + _hitcounter = 0; + Talk(EMOTE_FROZEN); _phase = PHASE_MELEE; DoCast(me, SPELL_VISCIDUS_FREEZE); me->RemoveAura(SPELL_VISCIDUS_SLOWED_MORE); @@ -142,11 +156,15 @@ class boss_viscidus : public CreatureScript } else if (_hitcounter >= HITCOUNTER_SLOW_MORE) { + Talk(EMOTE_FREEZE); me->RemoveAura(SPELL_VISCIDUS_SLOWED); DoCast(me, SPELL_VISCIDUS_SLOWED_MORE); } else if (_hitcounter >= HITCOUNTER_SLOW) + { + Talk(EMOTE_SLOW); DoCast(me, SPELL_VISCIDUS_SLOWED); + } } } @@ -183,6 +201,7 @@ class boss_viscidus : public CreatureScript if (_phase == PHASE_GLOB && summons.empty()) { + DoResetThreat(); me->NearTeleportTo(ViscidusCoord.GetPositionX(), ViscidusCoord.GetPositionY(), ViscidusCoord.GetPositionZ(), @@ -260,7 +279,7 @@ class npc_glob_of_viscidus : public CreatureScript else { Viscidus->SetHealth(Viscidus->GetHealth() - Viscidus->GetMaxHealth() / 20); - Viscidus->SetObjectScale(Viscidus->GetFloatValue(OBJECT_FIELD_SCALE_X) - 0.05f); // TODO: Not sure if blizzlike + Viscidus->GetAI()->DoCast(Viscidus, SPELL_VISCIDUS_SHRINKS); } } } From c0ab7c8d629c852a533f31bbc55e701b9adc36d8 Mon Sep 17 00:00:00 2001 From: Pitcrawler Date: Wed, 19 Dec 2012 20:28:46 +0100 Subject: [PATCH 04/33] DB/SAI: Some minor corrections --- sql/updates/world/2012_12_19_02_world_sai.sql | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 sql/updates/world/2012_12_19_02_world_sai.sql diff --git a/sql/updates/world/2012_12_19_02_world_sai.sql b/sql/updates/world/2012_12_19_02_world_sai.sql new file mode 100644 index 00000000000..c6367e1a8ca --- /dev/null +++ b/sql/updates/world/2012_12_19_02_world_sai.sql @@ -0,0 +1,19 @@ +SET @SASHA := 26935; +SET @HORSE := 27626; + +DELETE FROM `smart_scripts` WHERE `entryorguid`=@SASHA AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@SASHA,0,0,3,38,1,100,0,0,1,0,0,1,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Sasha - On data set 0 1 (phase 1) - Say line'), +(@SASHA,0,1,3,38,1,100,0,0,2,0,0,1,1,0,0,0,0,0,7,0,0,0,0,0,0,0,'Sasha - On data set 0 2 (phase 1) - Say line'), +(@SASHA,0,2,3,38,1,100,0,0,3,0,0,1,2,0,0,0,0,0,7,0,0,0,0,0,0,0,'Sasha - On data set 0 3 (phase 1) - Say line'), +(@SASHA,0,3,0,61,0,100,0,0,0,0,0,45,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Sasha - Linked with events 0,1,2 - Set data 0 0'), +(@SASHA,0,4,5,38,0,100,0,0,4,0,0,22,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Sasha - On data set 0 4 - Set event phase 0'), +(@SASHA,0,5,0,61,0,100,0,0,0,0,0,80,@SASHA*100,2,0,0,0,0,1,0,0,0,0,0,0,0,'Sasha - On data set 0 4 - Run script'), +(@SASHA,0,6,0,25,0,100,0,0,0,0,0,22,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Sasha - On reset - Set event phase 1'), +(@SASHA,0,7,0,54,0,100,0,0,0,0,0,53,1,@SASHA,0,0,0,0,1,0,0,0,0,0,0,0,'Sasha - Just summoned - Start WP movement'), +(@SASHA,0,8,9,40,0,100,0,4,0,0,0,90,8,0,0,0,0,0,1,0,0,0,0,0,0,0,'Sasha - On WP 4 reached - Set unit_field_bytes1 (kneel)'), +(@SASHA,0,9,0,61,0,100,0,0,0,0,0,80,@SASHA*100+1,2,0,0,0,0,1,0,0,0,0,0,0,0,'Sasha - On WP 4 reached - Run script'); + +DELETE FROM `waypoints` WHERE `entry`=@HORSE AND `pointid`=19; +INSERT INTO `waypoints` (`entry`,`pointid`,`position_x`,`position_y`,`position_z`,`point_comment`) VALUES +(@HORSE,19,4056.67,-4143.688,211.3766,''); From 86230e2756fab9d8d49f6c4d7fddbbc989d75c75 Mon Sep 17 00:00:00 2001 From: Gacko Date: Wed, 19 Dec 2012 22:38:07 +0100 Subject: [PATCH 05/33] Core/Spell: Fix Shadow's Fate aura The aura proccs on unit's death. The unit should cast the credit spells to all players of the raid. I'll finish my work later. --- src/server/game/Entities/Unit/Unit.cpp | 85 +++++++++++++------------- 1 file changed, 42 insertions(+), 43 deletions(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index ab8d2eba9f9..e9a248059ec 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -5572,37 +5572,28 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // Shadow's Fate (Shadowmourne questline) case 71169: { - target = triggeredByAura->GetCaster(); - if (!target) - return false; - Player* player = target->ToPlayer(); - if (!player) - return false; - // not checking Infusion auras because its in targetAuraSpell of credit spell - if (player->GetQuestStatus(24749) == QUEST_STATUS_INCOMPLETE) // Unholy Infusion + uint32 questId = 0; + uint32 spellId = 0; + + switch (GetEntry()) { - if (GetEntry() != 36678) // Professor Putricide - return false; - CastSpell(target, 71518, true); // Quest Credit - return true; + case 36678: // NPC: Professor Putricide + spellId = 71518; // Spell: Unholy Infusion Credit + break; + case 37955: // NPC: Blood-Queen Lana'thel + spellId = 72934; // Spell: Quest Credit + break; + case 36853: // NPC: Sindragosa + spellId = 72289; // Spell: Frost Infusion Quest Credit + break; + default: + break; } - else if (player->GetQuestStatus(24756) == QUEST_STATUS_INCOMPLETE) // Blood Infusion - { - if (GetEntry() != 37955) // Blood-Queen Lana'thel - return false; - CastSpell(target, 72934, true); // Quest Credit - return true; - } - else if (player->GetQuestStatus(24757) == QUEST_STATUS_INCOMPLETE) // Frost Infusion - { - if (GetEntry() != 36853) // Sindragosa - return false; - CastSpell(target, 72289, true); // Quest Credit - return true; - } - else if (player->GetQuestStatus(24547) == QUEST_STATUS_INCOMPLETE) // A Feast of Souls - triggered_spell_id = 71203; - break; + + CastSpell((Unit*)NULL, spellId, true); + CastSpell((Unit*)NULL, 71203, true); + + return true; } // Essence of the Blood Queen case 70871: @@ -9051,23 +9042,31 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg return false; Player* player = ToPlayer(); - if (player->GetQuestStatus(24749) == QUEST_STATUS_INCOMPLETE) // Unholy Infusion + if (player->GetQuestStatus(24547) != QUEST_STATUS_INCOMPLETE) { - if (!player->HasAura(71516) || victim->GetEntry() != 36678) // Shadow Infusion && Professor Putricide + uint32 spellId = 0; + uint32 questId = 0; + switch (victim->GetEntry()) + { + case 36678: // NPC: Professor Putricide + questId = 24749; // Quest: Unholy Infusion + spellId = 71516; // Spell: Shadow Infusion + break; + case 37955: // NPC: Blood-Queen Lana'thel + questId = 24756; // Quest: Blood Infusion + spellId = 72154; // Spell: Thirst Quenched + break; + case 36853: // NPC: Sindragosa + questId = 24757; // Quest: Frost Infusion + spellId = 72290; // Spell: Frost-Imbued Blade + break; + default: + return false; + } + + if (player->GetQuestStatus(questId) != QUEST_STATUS_INCOMPLETE || !player->HasAura(spellId)) return false; } - else if (player->GetQuestStatus(24756) == QUEST_STATUS_INCOMPLETE) // Blood Infusion - { - if (!player->HasAura(72154) || victim->GetEntry() != 37955) // Thirst Quenched && Blood-Queen Lana'thel - return false; - } - else if (player->GetQuestStatus(24757) == QUEST_STATUS_INCOMPLETE) // Frost Infusion - { - if (!player->HasAura(72290) || victim->GetEntry() != 36853) // Frost-Imbued Blade && Sindragosa - return false; - } - else if (player->GetQuestStatus(24547) != QUEST_STATUS_INCOMPLETE) // A Feast of Souls - return false; if (victim->GetTypeId() != TYPEID_UNIT) return false; From 4f956d77829460cb9ed853d37e005fd5085ed420 Mon Sep 17 00:00:00 2001 From: Gacko Date: Wed, 19 Dec 2012 22:40:14 +0100 Subject: [PATCH 06/33] Core/Spell: Improve/correct last commit --- src/server/game/Entities/Unit/Unit.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index e9a248059ec..a5a36001855 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -5572,7 +5572,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // Shadow's Fate (Shadowmourne questline) case 71169: { - uint32 questId = 0; uint32 spellId = 0; switch (GetEntry()) @@ -5589,8 +5588,9 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere default: break; } + if (spellId) + CastSpell((Unit*)NULL, spellId, true); - CastSpell((Unit*)NULL, spellId, true); CastSpell((Unit*)NULL, 71203, true); return true; From 37ecd4ddf793766d23da881b6753a429494519ef Mon Sep 17 00:00:00 2001 From: Vincent_Michael Date: Thu, 20 Dec 2012 01:16:07 +0100 Subject: [PATCH 07/33] DB/Conditions: Fix door exploit with item "Filled Cerulean Vial" Closes #8716 --- sql/updates/world/2012_12_20_00_world_conditions.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 sql/updates/world/2012_12_20_00_world_conditions.sql diff --git a/sql/updates/world/2012_12_20_00_world_conditions.sql b/sql/updates/world/2012_12_20_00_world_conditions.sql new file mode 100644 index 00000000000..53fc5733e53 --- /dev/null +++ b/sql/updates/world/2012_12_20_00_world_conditions.sql @@ -0,0 +1,3 @@ +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=21885; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 1, 21885, 0, 0, 31, 0, 5, 178905, 0, 0, 0, 0, '', 'Heal Vylestem Vine - Vylestem Vine'); From 2a5fcdddd73218d7cfa6f42c97a9a9a5f2224bbf Mon Sep 17 00:00:00 2001 From: Vincent_Michael Date: Thu, 20 Dec 2012 01:38:23 +0100 Subject: [PATCH 08/33] DB/Conditions: Fix door exploit with item "Vial of Frost Oil" Closes #6658 --- sql/updates/world/2012_12_20_01_world_conditions.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 sql/updates/world/2012_12_20_01_world_conditions.sql diff --git a/sql/updates/world/2012_12_20_01_world_conditions.sql b/sql/updates/world/2012_12_20_01_world_conditions.sql new file mode 100644 index 00000000000..36f71119425 --- /dev/null +++ b/sql/updates/world/2012_12_20_01_world_conditions.sql @@ -0,0 +1,3 @@ +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=55647; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 3, 55647, 0, 0, 31, 0, 5, 191840, 0, 0, 0, 0, '', 'Frost Oil - Plagued Proto-Drake Egg'); From 13c8869c78ccc6433acd2ceb59e67a6fe8072ae8 Mon Sep 17 00:00:00 2001 From: Vincent_Michael Date: Thu, 20 Dec 2012 01:53:45 +0100 Subject: [PATCH 09/33] SQL: Fix typo in 2a5fcdddd73218d7cfa6f42c97a9a9a5f2224bbf (need sleep :/) --- sql/updates/world/2012_12_20_01_world_conditions.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/updates/world/2012_12_20_01_world_conditions.sql b/sql/updates/world/2012_12_20_01_world_conditions.sql index 36f71119425..9d1851305a3 100644 --- a/sql/updates/world/2012_12_20_01_world_conditions.sql +++ b/sql/updates/world/2012_12_20_01_world_conditions.sql @@ -1,3 +1,3 @@ DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=55647; INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES -(13, 3, 55647, 0, 0, 31, 0, 5, 191840, 0, 0, 0, 0, '', 'Frost Oil - Plagued Proto-Drake Egg'); +(13, 1, 55647, 0, 0, 31, 0, 5, 191840, 0, 0, 0, 0, '', 'Frost Oil - Plagued Proto-Drake Egg'); From 699354d8efdb95b24ca91e804885449b79c6a665 Mon Sep 17 00:00:00 2001 From: Gacko Date: Thu, 20 Dec 2012 09:55:59 +0100 Subject: [PATCH 10/33] Core/Spell: Shadow's Fate should hit every unit See #8723 for further information --- src/server/game/Entities/Unit/Unit.cpp | 38 +++----------------------- 1 file changed, 4 insertions(+), 34 deletions(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index a5a36001855..1ca40671afe 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -9038,40 +9038,10 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg // Shadow's Fate (Shadowmourne questline) case 71169: { - if (GetTypeId() != TYPEID_PLAYER) - return false; - - Player* player = ToPlayer(); - if (player->GetQuestStatus(24547) != QUEST_STATUS_INCOMPLETE) - { - uint32 spellId = 0; - uint32 questId = 0; - switch (victim->GetEntry()) - { - case 36678: // NPC: Professor Putricide - questId = 24749; // Quest: Unholy Infusion - spellId = 71516; // Spell: Shadow Infusion - break; - case 37955: // NPC: Blood-Queen Lana'thel - questId = 24756; // Quest: Blood Infusion - spellId = 72154; // Spell: Thirst Quenched - break; - case 36853: // NPC: Sindragosa - questId = 24757; // Quest: Frost Infusion - spellId = 72290; // Spell: Frost-Imbued Blade - break; - default: - return false; - } - - if (player->GetQuestStatus(questId) != QUEST_STATUS_INCOMPLETE || !player->HasAura(spellId)) - return false; - } - - if (victim->GetTypeId() != TYPEID_UNIT) - return false; - // critters are not allowed - if (victim->GetCreatureType() == CREATURE_TYPE_CRITTER) + // These lines handle on which targets the Shadow's Fate debuff could be applied to. + // The aura is already restricted to ICC, but it should not be applied to NPCs like + // bugs, rats or summons for example which don't give reputation. + if (GetTypeId() != TYPEID_PLAYER || victim->GetTypeId() != TYPEID_UNIT || victim->GetCreatureType() == CREATURE_TYPE_CRITTER) return false; break; } From 04a3939a23ea7d8a50200eb461215e06d5365332 Mon Sep 17 00:00:00 2001 From: Gacko Date: Thu, 20 Dec 2012 14:44:26 +0100 Subject: [PATCH 11/33] Core/Spell: Reimplement Shadow's Fate check --- src/server/game/Entities/Unit/Unit.cpp | 31 +++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 1ca40671afe..19f3f78fc06 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -9038,11 +9038,36 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg // Shadow's Fate (Shadowmourne questline) case 71169: { - // These lines handle on which targets the Shadow's Fate debuff could be applied to. - // The aura is already restricted to ICC, but it should not be applied to NPCs like - // bugs, rats or summons for example which don't give reputation. + // Victim needs more checks so bugs, rats or summons can not be affected by the proc. if (GetTypeId() != TYPEID_PLAYER || victim->GetTypeId() != TYPEID_UNIT || victim->GetCreatureType() == CREATURE_TYPE_CRITTER) return false; + + Player* player = ToPlayer(); + if (player->GetQuestStatus(24547) != QUEST_STATUS_INCOMPLETE) + { + uint32 spellId = 0; + uint32 questId = 0; + switch (victim->GetEntry()) + { + case 36678: // NPC: Professor Putricide + questId = 24749; // Quest: Unholy Infusion + spellId = 71516; // Spell: Shadow Infusion + break; + case 37955: // NPC: Blood-Queen Lana'thel + questId = 24756; // Quest: Blood Infusion + spellId = 72154; // Spell: Thirst Quenched + break; + case 36853: // NPC: Sindragosa + questId = 24757; // Quest: Frost Infusion + spellId = 72290; // Spell: Frost-Imbued Blade + break; + default: + return false; + } + + if (player->GetQuestStatus(questId) != QUEST_STATUS_INCOMPLETE || !player->HasAura(spellId)) + return false; + } break; } } From 852d65f7caca3215eaa16049d9f8d83c3ec3e800 Mon Sep 17 00:00:00 2001 From: Vincent_Michael Date: Thu, 20 Dec 2012 16:48:24 +0100 Subject: [PATCH 12/33] SQL: Rename SQL merged in PR --- ...tem_loot.sql => 2012_12_20_00_characters_create_item_loot.sql} | 0 ...{2012_12_19_01_world_misc.sql => 2012_12_20_02_world_misc.sql} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename sql/updates/characters/{characters_create_item_loot.sql => 2012_12_20_00_characters_create_item_loot.sql} (100%) rename sql/updates/world/{2012_12_19_01_world_misc.sql => 2012_12_20_02_world_misc.sql} (100%) diff --git a/sql/updates/characters/characters_create_item_loot.sql b/sql/updates/characters/2012_12_20_00_characters_create_item_loot.sql similarity index 100% rename from sql/updates/characters/characters_create_item_loot.sql rename to sql/updates/characters/2012_12_20_00_characters_create_item_loot.sql diff --git a/sql/updates/world/2012_12_19_01_world_misc.sql b/sql/updates/world/2012_12_20_02_world_misc.sql similarity index 100% rename from sql/updates/world/2012_12_19_01_world_misc.sql rename to sql/updates/world/2012_12_20_02_world_misc.sql From 4116ba75e3bef999c3111943c3b389ffc195b686 Mon Sep 17 00:00:00 2001 From: joschiwald Date: Thu, 20 Dec 2012 23:17:43 +0100 Subject: [PATCH 13/33] DB/Conditions: Fix typo in f4e7cde1b5c8e5f071c4cb650a1101e184ddf552 (argh .... i've failed) --- sql/updates/world/2012_12_20_0_world_conditions.sql | 1 + 1 file changed, 1 insertion(+) create mode 100644 sql/updates/world/2012_12_20_0_world_conditions.sql diff --git a/sql/updates/world/2012_12_20_0_world_conditions.sql b/sql/updates/world/2012_12_20_0_world_conditions.sql new file mode 100644 index 00000000000..f07b18ed2e4 --- /dev/null +++ b/sql/updates/world/2012_12_20_0_world_conditions.sql @@ -0,0 +1 @@ +UPDATE `conditions` SET `ConditionTarget`=1 WHERE `SourceTypeOrReferenceId`=17 AND `SourceEntry`=52781 AND `ConditionTypeOrReference`=31; From 410586cf436fa0f44ea07c1dcf4d959be8712b93 Mon Sep 17 00:00:00 2001 From: Gacko Date: Thu, 20 Dec 2012 23:55:21 +0100 Subject: [PATCH 14/33] Core/Spell: Shadow's Fate conditions Some of the quests only can be done in 25man mode --- src/server/game/Entities/Unit/Unit.cpp | 61 +++++++++++++++++--------- 1 file changed, 41 insertions(+), 20 deletions(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 19f3f78fc06..cba0767b66d 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -5572,28 +5572,42 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // Shadow's Fate (Shadowmourne questline) case 71169: { - uint32 spellId = 0; - - switch (GetEntry()) + bool ok = false; + if (GetMap()->GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL || GetMap()->GetDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC) { - case 36678: // NPC: Professor Putricide - spellId = 71518; // Spell: Unholy Infusion Credit - break; - case 37955: // NPC: Blood-Queen Lana'thel - spellId = 72934; // Spell: Quest Credit - break; - case 36853: // NPC: Sindragosa - spellId = 72289; // Spell: Frost Infusion Quest Credit - break; - default: - break; + uint32 spellId = 0; + + switch (GetEntry()) + { + case 36678: // NPC: Professor Putricide + spellId = 71518; // Spell: Unholy Infusion Credit + break; + case 37955: // NPC: Blood-Queen Lana'thel + spellId = 72934; // Spell: Quest Credit + break; + case 36853: // NPC: Sindragosa + spellId = 72289; // Spell: Frost Infusion Quest Credit + break; + default: + break; + } + + if (spellId) + CastSpell((Unit*)NULL, spellId, true); + + ok = true; } - if (spellId) - CastSpell((Unit*)NULL, spellId, true); - CastSpell((Unit*)NULL, 71203, true); + // The spell usually only hits one target, but it should hit every player + // which applied Shadows Fate at least once to the victim. + if (target->GetTypeId() == TYPEID_PLAYER && target->ToPlayer()->GetQuestStatus(24547) == QUEST_STATUS_INCOMPLETE) + { + triggered_spell_id = 71203; + ok = true; + } - return true; + if (!ok) + return false; } // Essence of the Blood Queen case 70871: @@ -9043,7 +9057,11 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg return false; Player* player = ToPlayer(); - if (player->GetQuestStatus(24547) != QUEST_STATUS_INCOMPLETE) + if (player->GetQuestStatus(24547) == QUEST_STATUS_INCOMPLETE) + { + break; + } + else if (player->GetDifficulty(true) == RAID_DIFFICULTY_25MAN_NORMAL || player->GetDifficulty(true) == RAID_DIFFICULTY_25MAN_HEROIC) { uint32 spellId = 0; uint32 questId = 0; @@ -9067,8 +9085,11 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg if (player->GetQuestStatus(questId) != QUEST_STATUS_INCOMPLETE || !player->HasAura(spellId)) return false; + + break; } - break; + else + return false; } } From a8b145348aedf0faba03a60057588b72d3b68c6c Mon Sep 17 00:00:00 2001 From: Gacko Date: Fri, 21 Dec 2012 14:14:58 +0100 Subject: [PATCH 15/33] Core/Spell: Add missing break. --- src/server/game/Entities/Unit/Unit.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index cba0767b66d..d4b276fd2db 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -5608,6 +5608,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere if (!ok) return false; + + break; } // Essence of the Blood Queen case 70871: From 3e5e3aa2e12849cd09874127568d5fa68727e0d6 Mon Sep 17 00:00:00 2001 From: Vincent_Michael Date: Fri, 21 Dec 2012 19:34:11 +0100 Subject: [PATCH 16/33] DB/Conditions: Add some conditions for spell targets --- .../world/2012_12_21_00_world_conditions.sql | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 sql/updates/world/2012_12_21_00_world_conditions.sql diff --git a/sql/updates/world/2012_12_21_00_world_conditions.sql b/sql/updates/world/2012_12_21_00_world_conditions.sql new file mode 100644 index 00000000000..eddf541eaf3 --- /dev/null +++ b/sql/updates/world/2012_12_21_00_world_conditions.sql @@ -0,0 +1,22 @@ +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (76092,75313,54047,46937,46936,46904,46903,45404,45226,45222,44608,44499,/*42178,*/40968,36546,26373,24731,11195); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 1, 76092, 0, 0, 31, 0, 5, 193963, 0, 0, 0, 0, '', '[DND] Lil'' XT - Toy Train Set'), +(13, 1, 75313, 0, 0, 31, 0, 5, 202880, 0, 0, 0, 0, '', 'Bang Ritual Gong - Ritual Gong'), +(13, 1, 54047, 0, 0, 31, 0, 5, 191445, 0, 0, 0, 0, '', 'Light Lamp - Lamp Post'), +(13, 1, 46937, 0, 0, 31, 0, 5, 179786, 0, 0, 0, 0, '', 'Check Flag Cap - Warsong Flag'), +(13, 1, 46936, 0, 0, 31, 0, 5, 179830, 0, 0, 0, 0, '', 'Check Flag Cap - Silverwing Flag'), +(13, 1, 46904, 0, 0, 31, 0, 5, 181332, 0, 0, 0, 0, '', 'Light Bonfire (Art Kit) - Flame of Stormwind'), +(13, 1, 46903, 0, 0, 31, 0, 5, 187962, 0, 0, 0, 0, '', 'Stamp Out Bonfire (Art Kit) - Horde Bonfire'), +(13, 2, 45404, 0, 0, 31, 0, 5, 187432, 0, 0, 0, 0, '', 'Crush Under Foot - Alliance Flag'), +(13, 2, 45226, 0, 0, 31, 0, 5, 187359, 0, 0, 0, 0, '', 'Banging the Gong - Strange Gong'), +(13, 2, 45222, 0, 0, 31, 0, 5, 187359, 0, 0, 0, 0, '', 'Zul''aman Object Visual - Strange Gong'), -- correct? +(13, 2, 44608, 0, 0, 31, 0, 3, 24829, 0, 0, 0, 0, '', 'Rocket Jump - Transport Bot D1->D2'), +(13, 2, 44499, 0, 0, 31, 0, 5, 186957, 0, 0, 0, 0, '', 'Iron Rune Construct Credit 01 - unknown'), +-- (13, 1, 42178, 0, 0, 31, 0, 5, 186249, 0, 0, 0, 0, '', 'Headless Horseman - Invisible Campfire, Remove - unknown'), -- missing gameObject +(13, 2, 40968, 0, 0, 31, 0, 5, 185921, 0, 0, 0, 0, '', 'Bash''ir Crystalforge: Create 1 Flask - Bash''ir Crystalforge'), +(13, 2, 40968, 0, 0, 31, 0, 5, 185922, 0, 0, 0, 0, '', 'Bash''ir Crystalforge: Create 1 Flask - Crystalforge controller'), +(13, 2, 36546, 0, 0, 31, 0, 5, 184715, 0, 0, 0, 0, '', 'Boil Bleeding Hollow Blood - Cursed Cauldron'), +(13, 2, 26373, 0, 0, 31, 0, 3, 15892, 0, 0, 0, 0, '', 'Lunar Invitation - Lunar Festival Emissary'), +(13, 1, 24731, 0, 0, 31, 0, 3, 15218, 0, 0, 0, 0, '', 'Fire Cannon - Darkmoon Faire Cannon'), +(13, 2, 24731, 0, 0, 31, 0, 5, 180452, 0, 0, 0, 0, '', 'Fire Cannon - Blastenheimer 5000 Ultra Cannon'), +(13, 1, 11195, 0, 0, 31, 0, 5, 146084, 0, 0, 0, 0, '', 'Blow Zul''Farrak Door - End Door'); From af4f42383fb939ddb23b857e8f187ba17c07d814 Mon Sep 17 00:00:00 2001 From: Vincent_Michael Date: Fri, 21 Dec 2012 20:26:50 +0100 Subject: [PATCH 17/33] DB/Conditions: Add conditions for Sigil of the Ebon Blade for only Lithe Stalker --- sql/updates/world/2012_12_21_01_world_conditions.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 sql/updates/world/2012_12_21_01_world_conditions.sql diff --git a/sql/updates/world/2012_12_21_01_world_conditions.sql b/sql/updates/world/2012_12_21_01_world_conditions.sql new file mode 100644 index 00000000000..30b9e414e78 --- /dev/null +++ b/sql/updates/world/2012_12_21_01_world_conditions.sql @@ -0,0 +1,3 @@ +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=17 AND `SourceEntry`=58151; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(17, 0, 58151, 0, 0, 31, 1, 3, 30894, 0, 0, 12, 0, '', 'Subdued Lithe Stalker - only for Lithe Stalker'); \ No newline at end of file From 10d957e3ad71cbdebe99ba092940291edc890886 Mon Sep 17 00:00:00 2001 From: Vincent_Michael Date: Fri, 21 Dec 2012 20:32:41 +0100 Subject: [PATCH 18/33] SQL: Fix "No newline at end of file" in af4f42383fb939ddb23b857e8f187ba17c07d814 --- sql/updates/world/2012_12_21_01_world_conditions.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/updates/world/2012_12_21_01_world_conditions.sql b/sql/updates/world/2012_12_21_01_world_conditions.sql index 30b9e414e78..fdc5becd963 100644 --- a/sql/updates/world/2012_12_21_01_world_conditions.sql +++ b/sql/updates/world/2012_12_21_01_world_conditions.sql @@ -1,3 +1,3 @@ DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=17 AND `SourceEntry`=58151; INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES -(17, 0, 58151, 0, 0, 31, 1, 3, 30894, 0, 0, 12, 0, '', 'Subdued Lithe Stalker - only for Lithe Stalker'); \ No newline at end of file +(17, 0, 58151, 0, 0, 31, 1, 3, 30894, 0, 0, 12, 0, '', 'Subdued Lithe Stalker - only for Lithe Stalker'); From 63ea4b1056dd6fc8b25f580331307d14bdcc26d2 Mon Sep 17 00:00:00 2001 From: Vincent_Michael Date: Fri, 21 Dec 2012 22:22:36 +0100 Subject: [PATCH 19/33] Core: Fix some codestyle in 957571e18c4d6e5874ce1052ae49e4d0d21018be --- src/server/game/Entities/Item/Item.cpp | 15 +++++++-------- src/server/game/Entities/Item/Item.h | 2 +- src/server/game/Handlers/LootHandler.cpp | 2 ++ src/server/game/Loot/LootMgr.h | 2 +- .../Database/Implementation/CharacterDatabase.cpp | 4 ++-- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index 5303fb8dc38..dd54a3d39db 100644 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -1210,7 +1210,6 @@ bool Item::CheckSoulboundTradeExpire() void Item::ItemContainerSaveLootToDB() { // Saves the money and item loot associated with an openable item to the DB - if (loot.isLooted()) // no money and no loot return; @@ -1235,7 +1234,7 @@ void Item::ItemContainerSaveLootToDB() // Save items if (!loot.isLooted()) { - + PreparedStatement* stmt_items = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_ITEMS); stmt_items->setUInt32(0, container_id); trans->Append(stmt_items); @@ -1272,7 +1271,6 @@ void Item::ItemContainerSaveLootToDB() bool Item::ItemContainerLoadLootFromDB() { // Loads the money and item loot associated with an openable item from the DB - // Default. If there are no records for this item then it will be rolled for in Player::SendLoot() m_lootGenerated = false; @@ -1335,18 +1333,19 @@ bool Item::ItemContainerLoadLootFromDB() // Finally add the LootItem to the container loot.items.push_back(loot_item); - + // Increment unlooted count loot.unlootedCount++; - } while (item_result->NextRow()); + } + while (item_result->NextRow()); } } - // Mark the item if it has loot so it won't be generated again on open - m_lootGenerated = !loot.isLooted(); + // Mark the item if it has loot so it won't be generated again on open + m_lootGenerated = !loot.isLooted(); - return m_lootGenerated; + return m_lootGenerated; } void Item::ItemContainerDeleteLootItemsFromDB() diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h index 2e1956250f3..ffe31ed765e 100644 --- a/src/server/game/Entities/Item/Item.h +++ b/src/server/game/Entities/Item/Item.h @@ -231,7 +231,7 @@ class Item : public Object static void DeleteFromDB(SQLTransaction& trans, uint32 itemGuid); virtual void DeleteFromDB(SQLTransaction& trans); static void DeleteFromInventoryDB(SQLTransaction& trans, uint32 itemGuid); - + // Lootable items and their contents void ItemContainerSaveLootToDB(); bool ItemContainerLoadLootFromDB(); diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp index b15636e75d2..92ba5237c68 100644 --- a/src/server/game/Handlers/LootHandler.cpp +++ b/src/server/game/Handlers/LootHandler.cpp @@ -393,8 +393,10 @@ void WorldSession::DoLootRelease(uint64 lguid) player->DestroyItemCount(pItem, count, true); } else + { if (pItem->loot.isLooted()) // Only delete item if no loot or money (unlooted loot is saved to db) player->DestroyItem(pItem->GetBagSlot(), pItem->GetSlot(), true); + } return; // item can be looted only single player } else diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h index cfa5d370e3b..89425e1ee66 100644 --- a/src/server/game/Loot/LootMgr.h +++ b/src/server/game/Loot/LootMgr.h @@ -290,7 +290,7 @@ struct Loot uint8 unlootedCount; uint64 roundRobinPlayer; // GUID of the player having the Round-Robin ownership for the loot. If 0, round robin owner has released. LootType loot_type; // required for achievement system - + // GUIDLow of container that holds this loot (item_instance.entry) // Only set for inventory items that can be right-click looted uint32 containerID; diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index 3ef94f3aafd..b36513ba3bb 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -544,10 +544,10 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_SEL_ITEMCONTAINER_ITEMS, "SELECT item_id, item_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_prop, rnd_suffix FROM item_loot_items WHERE container_id = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_DEL_ITEMCONTAINER_ITEMS, "DELETE FROM item_loot_items WHERE container_id = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_DEL_ITEMCONTAINER_ITEM, "DELETE FROM item_loot_items WHERE container_id = ? AND item_id = ?", CONNECTION_ASYNC); - PREPARE_STATEMENT(CHAR_INS_ITEMCONTAINER_ITEMS, "INSERT INTO item_loot_items (container_id, item_id, item_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_prop, rnd_suffix) VALUES (?,?,?,?,?,?,?,?,?,?,?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_INS_ITEMCONTAINER_ITEMS, "INSERT INTO item_loot_items (container_id, item_id, item_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_prop, rnd_suffix) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_SEL_ITEMCONTAINER_MONEY, "SELECT money FROM item_loot_money WHERE container_id = ?", CONNECTION_SYNCH); PREPARE_STATEMENT(CHAR_DEL_ITEMCONTAINER_MONEY, "DELETE FROM item_loot_money WHERE container_id = ?", CONNECTION_ASYNC); - PREPARE_STATEMENT(CHAR_INS_ITEMCONTAINER_MONEY," INSERT INTO item_loot_money (container_id, money) VALUES (?,?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_INS_ITEMCONTAINER_MONEY, "INSERT INTO item_loot_money (container_id, money) VALUES (?, ?)", CONNECTION_ASYNC); // Calendar PREPARE_STATEMENT(CHAR_REP_CALENDAR_EVENT, "REPLACE INTO calendar_events (id, creator, title, description, type, dungeon, eventtime, flags, time2) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); From 95a201352d025ba2864e12f4c01c5b753128a756 Mon Sep 17 00:00:00 2001 From: Trista Date: Sat, 22 Dec 2012 01:43:18 +0200 Subject: [PATCH 20/33] DB/SAI: Finish off converting quest_end_scripts * http://www.trinitycore.org/f/topic/7556-looking-for-people-to-convert-quest-end-scripts/ * fixup some timing errors I made on previous * someone has to kill table + core linking to it --- sql/updates/world/2012_12_19_00_world_sai.sql | 56 +-- sql/updates/world/2012_12_22_01_world_sai.sql | 365 ++++++++++++++++++ 2 files changed, 393 insertions(+), 28 deletions(-) create mode 100644 sql/updates/world/2012_12_22_01_world_sai.sql diff --git a/sql/updates/world/2012_12_19_00_world_sai.sql b/sql/updates/world/2012_12_19_00_world_sai.sql index 170028e8a68..e11891cdfbd 100644 --- a/sql/updates/world/2012_12_19_00_world_sai.sql +++ b/sql/updates/world/2012_12_19_00_world_sai.sql @@ -14,14 +14,14 @@ DELETE FROM `smart_scripts` WHERE `entryorguid`=@SCRIPT AND `source_type`=9; INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES (@DARION_MORGRAINE,0,0,0,20,0,100,0,12657,0,0,0,80,@SCRIPT,2,0,0,0,0,1,0,0,0,0,0,0,0, 'Highlord Darion Morgraine - On quest 12657 rewarded - Start action list'), (@DARION_MORGRAINE,0,1,0,1,0,100,0,60000,90000,60000,90000,4,12893,1,0,0,0,0,0,0,0,0,0,0,0,0, 'Highlord Darion Morgraine - OOC - Play sound'), -(@SCRIPT,9,0,0,0,0,100,0,16000,16000,0,0,5,22,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Highlord Darion Morgraine - Action 0 - Play emote 22'), -(@SCRIPT,9,1,0,0,0,100,0,0,0,0,0,12,28487,3,46000,0,0,0,8,0,0,0,2465.47,-5567.3,372.16,1.64, 'Highlord Darion Morgraine - Action 1 - Summon'), -(@SCRIPT,9,2,0,0,0,100,0,0,0,0,0,12,28487,3,46000,0,0,0,8,0,0,0,2434.52,-5588.56,372.16,3.26, 'Highlord Darion Morgraine - Action 2 - Summon'), -(@SCRIPT,9,3,0,0,0,100,0,0,0,0,0,12,28487,3,46000,0,0,0,8,0,0,0,2455.59,-5618.32,372.16,4.59, 'Highlord Darion Morgraine - Action 3 - Summon'), -(@SCRIPT,9,4,0,0,0,100,0,0,0,0,0,12,28487,3,46000,0,0,0,8,0,0,0,2439.31,-5608.69,372.16,3.77, 'Highlord Darion Morgraine - Action 4 - Summon'), -(@SCRIPT,9,5,0,0,0,100,0,0,0,0,0,12,28487,3,46000,0,0,0,8,0,0,0,2486.72,-5598.66,372.16,6.02, 'Highlord Darion Morgraine - Action 5 - Summon'), -(@SCRIPT,9,6,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Highlord Darion Morgraine - Action 6 - Say line 0'), -(@SCRIPT,9,7,0,0,0,100,0,16000,16000,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Highlord Darion Morgraine - Action 7 - Say line 1'); +(@SCRIPT,9,0,0,0,0,100,0,0,0,0,0,12,28487,3,46000,0,0,0,8,0,0,0,2465.47,-5567.3,372.16,1.64, 'Highlord Darion Morgraine - Action 0 - Summon'), +(@SCRIPT,9,1,0,0,0,100,0,0,0,0,0,12,28487,3,46000,0,0,0,8,0,0,0,2434.52,-5588.56,372.16,3.26, 'Highlord Darion Morgraine - Action 1 - Summon'), +(@SCRIPT,9,2,0,0,0,100,0,0,0,0,0,12,28487,3,46000,0,0,0,8,0,0,0,2455.59,-5618.32,372.16,4.59, 'Highlord Darion Morgraine - Action 2 - Summon'), +(@SCRIPT,9,3,0,0,0,100,0,0,0,0,0,12,28487,3,46000,0,0,0,8,0,0,0,2439.31,-5608.69,372.16,3.77, 'Highlord Darion Morgraine - Action 3 - Summon'), +(@SCRIPT,9,4,0,0,0,100,0,0,0,0,0,12,28487,3,46000,0,0,0,8,0,0,0,2486.72,-5598.66,372.16,6.02, 'Highlord Darion Morgraine - Action 4 - Summon'), +(@SCRIPT,9,5,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Highlord Darion Morgraine - Action 5 - Say line 0'), +(@SCRIPT,9,6,0,0,0,100,0,16000,16000,0,0,5,22,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Highlord Darion Morgraine - Action 6 - Play emote 22'), +(@SCRIPT,9,7,0,0,0,100,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Highlord Darion Morgraine - Action 7 - Say line 1'); -- Convert from db_script_string to creature_text DELETE FROM `db_script_string` WHERE `entry` IN (2000005409,2000005410); @@ -41,28 +41,28 @@ DELETE FROM `smart_scripts` WHERE `entryorguid`=@Arthorn_Windsong AND `source_ty DELETE FROM `smart_scripts` WHERE `entryorguid`=@SCRIPT AND `source_type`=9; INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES (@Arthorn_Windsong,0,0,0,20,0,100,0,10988,0,0,0,80,@SCRIPT,2,0,0,0,0,1,0,0,0,0,0,0,0, 'Captain Brandon - On quest 10988 rewarded - Start script'), -(@SCRIPT,9,0,0,0,0,100,0,30000,30000,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Arthorn Windsong - Action 0 - Say line 0'), -(@SCRIPT,9,1,0,0,0,100,0,43000,43000,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Arthorn Windsong - Action 1 - Say line 1'), -(@SCRIPT,9,2,0,0,0,100,0,43000,43000,0,0,5,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Arthorn Windsong - Action 2 - Play emote 1'), -(@SCRIPT,9,3,0,0,0,100,0,56000,56000,0,0,69,1,0,0,0,0,0,8,0,0,0,3024.32,5511.29,146.051,2.31064, 'Arthorn Windsong - Action 3 - Move to'), -(@SCRIPT,9,4,0,0,0,100,0,17000,17000,0,0,5,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Arthorn Windsong - Action 4 - Play emote 1'), -(@SCRIPT,9,5,0,0,0,100,0,17000,17000,0,0,1,2,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Arthorn Windsong - Action 5 - Say line 2'), -(@SCRIPT,9,6,0,0,0,100,0,11000,11000,0,0,5,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Arthorn Windsong - Action 6 - Play emote'), -(@SCRIPT,9,7,0,0,0,100,0,11000,11000,0,0,1,3,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Arthorn Windsong - Action 7- Say line 3'), -(@SCRIPT,9,8,0,0,0,100,0,1000,1000,0,0,1,4,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Arthorn Windsong - Action 8 - Say line 4'), -(@SCRIPT,9,9,0,0,0,100,0,11000,11000,0,0,11,39679,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Arthorn Windsong - Action 9 - Cast spell'), -(@SCRIPT,9,10,0,0,0,100,0,10000,10000,0,0,69,0,0,0,0,0,0,8,0,0,0,3044.22,5510.91,146.033,4.654, 'Windsong - Action 10 - Move to pos'), -(@SCRIPT,9,11,0,0,0,100,0,56000,56000,0,0,1,5,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Arthorn Windsong - Action 11 - Say line 5'); +(@SCRIPT,9,0,0,0,0,100,0,1000,1000,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Arthorn Windsong - Action 0 - Say line 0'), +(@SCRIPT,9,1,0,0,0,100,0,9000,9000,0,0,69,1,0,0,0,0,0,8,0,0,0,3024.22,5510.29,146.033,4.63856, 'Arthorn Windsong - Action 1 - Move to'), +(@SCRIPT,9,2,0,0,0,100,0,1000,1000,0,0,5,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Arthorn Windsong - Action 2 - Play emote 1'), +(@SCRIPT,9,3,0,0,0,100,0,0,0,0,0,11,39679,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Arthorn Windsong - Action 3 - Cast spell'), +(@SCRIPT,9,4,0,0,0,100,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Arthorn Windsong - Action 4 - Say line 1'), +(@SCRIPT,9,5,0,0,0,100,0,6000,6000,0,0,1,2,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Arthorn Windsong - Action 5 - Say line 2'), +(@SCRIPT,9,6,0,0,0,100,0,0,0,0,0,5,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Arthorn Windsong - Action 6 - Play emote 1'), +(@SCRIPT,9,7,0,0,0,100,0,13000,13000,0,0,1,3,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Arthorn Windsong - Action 7- Say line 3'), +(@SCRIPT,9,8,0,0,0,100,0,13000,13000,0,0,1,4,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Arthorn Windsong - Action 8 - Say line 4'), +(@SCRIPT,9,9,0,0,0,100,0,0,0,0,0,5,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Arthorn Windsong - Action 9 - Play emote'), +(@SCRIPT,9,10,0,0,0,100,0,14000,14000,0,0,69,0,0,0,0,0,0,8,0,0,0,3024.32,5511.29,146.051,2.31064, 'Windsong - Action 10 - Move to pos'), +(@SCRIPT,9,11,0,0,0,100,0,0,0,0,0,1,5,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Arthorn Windsong - Action 11 - Say line 5'); -- Convert from db_script_string to creature_text -DELETE FROM `db_script_string` WHERE `entry` IN (2000000073,2000000074,2000000072,2000000071,2000000070,2000000075); +DELETE FROM `db_script_string` WHERE `entry` IN (2000000070,2000000071,2000000072,2000000073,2000000074,2000000075); DELETE FROM `creature_text` WHERE `entry`=@Arthorn_Windsong; INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES -(@Arthorn_Windsong,0,0, 'There''s something else here, too. After a discription of a bloody battle and the downfall of the raven, there''s a prophecy. Anzu will haunt the dreams of his enemies, twisting them to affect a return to this world...',12,0,100,1,0,0, 'Arthorn Windsong'), -(@Arthorn_Windsong,1,0, 'The tablet has the confirmation we need, just as I thought. Now, we have to use this information to draw out and defeat this Anzu before he can do any more damage to the Emerald Dream!',12,0,100,1,0,0, 'Arthorn Windsong'), -(@Arthorn_Windsong,2,0, 'It''s all here... how the raven''s followers captured and subdued the sprints of rivals, trapping them forever within stone statues! The tablet even mentions the raven god''s name -- Anzu. I''d thought it was lost to history!',12,0,100,1,0,0, 'Arthorn Windsong'), -(@Arthorn_Windsong,3,0, 'This is it! This is really it -- the Book of the Raven!',12,0,100,1,0,0, 'Arthorn Windsong'), -(@Arthorn_Windsong,4,0, 'It would''ve taken years to find the Book of the Raven without you, young sparrowhawk. Return to your home in Nagrand with our gratitude.',12,0,100,1,0,0, 'Arthorn Windsong'), +(@Arthorn_Windsong,0,0, 'It would''ve taken years to find the Book of the Raven without you, young sparrowhawk. Return to your home in Nagrand with our gratitude.',12,0,100,1,0,0, 'Arthorn Windsong'), +(@Arthorn_Windsong,1,0, 'This is it! This is really it -- the Book of the Raven!',12,0,100,1,0,0, 'Arthorn Windsong'), +(@Arthorn_Windsong,2,0, 'There''s something else here, too. After a discription of a bloody battle and the downfall of the raven, there''s a prophecy. Anzu will haunt the dreams of his enemies, twisting them to affect a return to this world...',12,0,100,1,0,0, 'Arthorn Windsong'), +(@Arthorn_Windsong,3,0, 'It''s all here... how the raven''s followers captured and subdued the sprints of rivals, trapping them forever within stone statues! The tablet even mentions the raven god''s name -- Anzu. I''d thought it was lost to history!',12,0,100,1,0,0, 'Arthorn Windsong'), +(@Arthorn_Windsong,4,0, 'The tablet has the confirmation we need, just as I thought. Now, we have to use this information to draw out and defeat this Anzu before he can do any more damage to the Emerald Dream!',12,0,100,1,0,0, 'Arthorn Windsong'), (@Arthorn_Windsong,5,0, 'Since the sparrowhawks have proven such a success in hunting down the raven stones, Watcher Elaira has trained another one to relay my voice at a great distance. He can help us communicate as you investigate the bird spirits revealed in the tablet!',12,0,100,1,0,0, 'Arthorn Windsong'); -- Convert quest_end_script "10850" to SAI @@ -73,7 +73,7 @@ SET @Inactive_Fel_Reaver := 22293; UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@Inactive_Fel_Reaver; DELETE FROM `smart_scripts` WHERE `entryorguid`=@Inactive_Fel_Reaver AND `source_type`=0; INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES -(@Inactive_Fel_Reaver,0,0,0,20,0,100,0,10850,0,0,0,15,10855,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Inactive Fel Reaver - On quest 10850 rewarded - Call Quest Explored for invoker'); +(@Inactive_Fel_Reaver,0,0,0,20,0,100,0,10850,0,0,0,15,10855,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Inactive Fel Reaver - On quest 10850 rewarded - Call area explored events happen'); -- Convert quest_end_script "10447" to SAI -- Indexes: @@ -103,4 +103,4 @@ DELETE FROM `smart_scripts` WHERE `entryorguid`=@SCRIPT AND `source_type`=9; INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES (@Blood_Crystal,1,0,0,20,0,100,0,9565,0,0,0,80,@SCRIPT,2,0,0,0,0,1,0,0,0,0,0,0,0, 'Blood Crystal - On quest 9565 rewarded - Start actionlist'), (@SCRIPT,9,0,0,0,0,100,0,2000,2000,0,0,12,17189,3,180000,0,0,0,8,0,0,0,-3105.36,-12549.2,-1.28,4.6, 'Blood Crystal - Action 0 - Summon'), -(@SCRIPT,9,1,0,0,0,100,0,2000,2000,0,0,12,17189,3,180000,0,0,0,8,0,0,0,-3128.49,-12540.2,-2.54,1.5, 'Blood Crystal - Action 1 - Summon'); +(@SCRIPT,9,1,0,0,0,100,0,0,0,0,0,12,17189,3,180000,0,0,0,8,0,0,0,-3128.49,-12540.2,-2.54,1.5, 'Blood Crystal - Action 1 - Summon'); diff --git a/sql/updates/world/2012_12_22_01_world_sai.sql b/sql/updates/world/2012_12_22_01_world_sai.sql new file mode 100644 index 00000000000..e2a61426679 --- /dev/null +++ b/sql/updates/world/2012_12_22_01_world_sai.sql @@ -0,0 +1,365 @@ +-- Remove from quest_end_scripts +DELETE FROM `quest_end_scripts` WHERE `id` IN (7642,5158,3922,1191,1103,997,943,931,930,902,492,489,407,349,308,63); + +-- Convert quest_end_script "7642" to SAI +-- Indexes: +SET @Grimand_Elmore := 1416; +SET @SCRIPT := @Grimand_Elmore * 100; + +-- Add SAI support +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@Grimand_Elmore; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@Grimand_Elmore AND `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@SCRIPT AND `source_type`=9; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@Grimand_Elmore,0,0,0,20,0,100,0,7642,0,0,0,80,@SCRIPT,2,0,0,0,0,1,0,0,0,0,0,0,0, 'Grimand Elmore - On quest 7642 rewarded - Start action list'), +(@SCRIPT,9,0,0,0,0,100,0,2000,2000,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Grimand Elmore - Action 3 - Say line 0'), +(@SCRIPT,9,1,0,0,0,100,0,1000,1000,0,0,69,0,0,0,0,0,0,8,0,0,0,-8393.09,687.41,95.27,3.72, 'Grimand Elmore - Action 1 - Move to pos'), +(@SCRIPT,9,2,0,0,0,100,0,5000,5000,0,0,69,0,0,0,0,0,0,8,0,0,0,-8400.51,681.85,95.96,5, 'Grimand Elmore - Action 6 - Move to pos'), +(@SCRIPT,9,3,0,0,0,100,0,3000,3000,0,0,69,0,0,0,0,0,0,8,0,0,0,-8388.72,646.85,94.82,3.92, 'Grimand Elmore - Action 2 - Move to pos'), +(@SCRIPT,9,4,0,0,0,100,0,9000,9000,0,0,69,0,0,0,0,0,0,8,0,0,0,-8422.25,618.12,95.46,3.2, 'Grimand Elmore - Action 10 - Move to pos'), +(@SCRIPT,9,5,0,0,0,100,0,13000,13000,0,0,5,69,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Grimand Elmore - Action 4 - Play emote'), +(@SCRIPT,9,6,0,0,0,100,0,6000,6000,0,0,5,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Grimand Elmore - Action 5 - Play emote'), +(@SCRIPT,9,7,0,0,0,100,0,0,0,0,0,69,0,0,0,0,0,0,8,0,0,0,-8421.99,617.93,95.45,5.34, 'Grimand Elmore - Action 7 - Move to pos'), +(@SCRIPT,9,8,0,0,0,100,0,2000,2000,0,0,5,233,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Grimand Elmore - Action 8 - Play emote'), +(@SCRIPT,9,9,0,0,0,100,0,6000,6000,0,0,5,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Grimand Elmore - Action 9 - Play emote'), +(@SCRIPT,9,10,0,0,0,100,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Grimand Elmore - Action 13 - Say line 1'), +(@SCRIPT,9,11,0,0,0,100,0,4000,4000,0,0,69,0,0,0,0,0,0,8,0,0,0,-8388.72,646.85,94.82,3.92, 'Grimand Elmore - Action 11 - Move to pos'), +(@SCRIPT,9,12,0,0,0,100,0,9000,9000,0,0,69,0,0,0,0,0,0,8,0,0,0,-8400.51,681.85,95.96,5, 'Grimand Elmore - Action 12 - Move to pos'), +(@SCRIPT,9,13,0,0,0,100,0,12000,12000,0,0,69,0,0,0,0,0,0,8,0,0,0,-8393.09,687.41,95.27,3.72, 'Grimand Elmore - Action 14 - Move to pos'), +(@SCRIPT,9,14,0,0,0,100,0,15000,15000,0,0,69,0,0,0,0,0,0,8,0,0,0,-8387,685.2,95.35,2.28, 'Grimand Elmore - Action 0 - Move to pos'); +-- Convert from db_script_string to creature_text +DELETE FROM `db_script_string` WHERE `entry` IN (2000000063,2000000064); +DELETE FROM `creature_text` WHERE `entry`=@Grimand_Elmore; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@Grimand_Elmore,0,0, 'Follow me, good $C. I''ll have your barding done faster than I could down a Dwarven stout. Mmmm... stout.',12,0,100,1,0,0, 'Grimand Elmore'), +(@Grimand_Elmore,1,0, 'Well, that should do it. Come now, back to the shop to finish our business!',12,0,100,1,0,0, 'Grimand Elmore'); + +-- Convert quest_end_script "5158" to SAI +-- Indexes: +SET @Islen_Waterseer := 5901; +SET @SCRIPT := @Islen_Waterseer * 100; + +-- Add SAI support +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@Islen_Waterseer; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@Islen_Waterseer AND `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@SCRIPT AND `source_type`=9; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@Islen_Waterseer,0,0,0,20,0,100,0,5158,0,0,0,80,@SCRIPT,2,0,0,0,0,1,0,0,0,0,0,0,0, 'Islen Waterseer - On quest 5158 rewarded - Start action list'), +(@SCRIPT,9,0,0,0,0,100,0,0,0,0,0,18,33554432,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Islen Waterseer - Action 0 - Set unit flags'), +(@SCRIPT,9,1,0,0,0,100,0,1000,1000,0,0,69,0,0,0,0,0,0,8,0,0,0,-1345.16,-4065.02,-0.49,4.73, 'Islen Waterseer- Action 1 - Move to pos'), +(@SCRIPT,9,2,0,0,0,100,0,5000,5000,0,0,12,11256,3,30000,0,0,0,8,0,0,0,-1346.59,-4076.39,-1.23,1.6, 'Islen Waterseer - Action 2 - Summon'), +(@SCRIPT,9,3,0,0,0,100,0,4000,4000,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Islen Waterseer - Action 4 - Say line 0'), +(@SCRIPT,9,4,0,0,0,100,0,12000,12000,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Islen Waterseer - Action 5 - Say line 1'), +(@SCRIPT,9,5,0,0,0,100,0,2000,2000,0,0,69,0,0,0,0,0,0,8,0,0,0,-1345.0,-4048.0,6.09,4.34, 'Islen Waterseer - Action 6 - Move to pos'), +(@SCRIPT,9,6,0,0,0,100,0,6000,6000,0,0,19,33554432,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Islen Waterseer - Action 7 - Remove unit flags'); + +-- Convert from db_script_string to creature_text +DELETE FROM `db_script_string` WHERE `entry` IN (2000000057,2000000058); +DELETE FROM `creature_text` WHERE `entry`=@Islen_Waterseer; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@Islen_Waterseer,0,0, 'Spirits of Water, I give you praise, and I beg of you a favour. You have heard $N''s pleas, and I trust his inent is noble. Please, will you aid us?',42,0,100,1,0,0, 'Islen Waterseer'), +(@Islen_Waterseer,1,0, 'Thank you great spirit. Thank you!',12,0,100,1,0,0, 'Islen Waterseer'); + +-- Convert quest_end_script "3922" to SAI +-- Indexes: +SET @Wenikee_Boltbucket := 9316; +SET @SCRIPT := @Wenikee_Boltbucket * 100; + +-- Add SAI support +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@Wenikee_Boltbucket; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@Wenikee_Boltbucket AND `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@SCRIPT AND `source_type`=9; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@Wenikee_Boltbucket,0,0,0,20,0,100,0,3922,0,0,0,80,@SCRIPT,2,0,0,0,0,1,0,0,0,0,0,0,0, 'Wenikee Boltbucket - On quest 3922 rewarded - Start action list'), +(@SCRIPT,9,0,0,0,0,100,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Wenikee Boltbucket - Action 0 - Say line 0'), +(@SCRIPT,9,1,0,0,0,100,0,0,0,0,0,70,7,0,0,0,0,0,14,6579,162024,0,0,0,0,0, 'Wenikee Boltbucket - Action 1 - Respawn go guid in 7 seconds'), +(@SCRIPT,9,2,0,0,0,100,0,1000,1000,0,0,69,0,0,0,0,0,0,8,0,0,0,858.17,-2347.74,91.8282,6.06139, 'Wenikee Boltbucket - Action 2 - Move to pos'), +(@SCRIPT,9,3,0,0,0,100,0,1000,1000,0,0,5,173,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Wenikee Boltbucket - Action 3 - Play emote'), +(@SCRIPT,9,4,0,0,0,100,0,4000,4000,0,0,11,13727,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Wenikee Boltbucket - Action 4 - Cast spell'), +(@SCRIPT,9,5,0,0,0,100,0,1000,1000,0,0,69,0,0,0,0,0,0,8,0,0,0,858.14,-2347.64,91.92,2.72271, 'Wenikee Boltbucket - Action 5 - Move to pos'), +(@SCRIPT,9,6,0,0,0,100,0,1000,1000,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Wenikee Boltbucket - Action 6 - Say line 1'); + +-- Convert from db_script_string to creature_text +DELETE FROM `db_script_string` WHERE `entry` IN (2000000103,2000000104); +DELETE FROM `creature_text` WHERE `entry`=@Wenikee_Boltbucket; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@Wenikee_Boltbucket,0,0, 'Ok, let''s get started!',12,0,100,1,0,0, 'Wenikee Boltbucket'), +(@Wenikee_Boltbucket,1,0, '... oops.',12,0,100,1,0,0, 'Wenikee Boltbucket'); + +-- Convert quest_end_script "1191" to SAI +-- Indexes: +SET @Zamek := 4709; +SET @SCRIPT := @Zamek * 100; + +-- Add SAI support +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@Zamek; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@Zamek AND `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@SCRIPT AND `source_type`=9; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@Zamek,0,0,0,20,0,100,0,1191,0,0,0,80,@SCRIPT,2,0,0,0,0,1,0,0,0,0,0,0,0, 'Zamek - On quest 1191 rewarded - Start action list'), +(@SCRIPT,9,0,0,0,0,100,0,0,0,0,0,69,0,0,0,0,0,0,8,0,0,0,-6273.41,-3841.7,-58.75,1.9, 'Zamek - Action 0 - Move to pos'), +(@SCRIPT,9,1,0,0,0,100,0,30000,30000,0,0,70,600,0,0,0,0,0,14,13621,20805,0,0,0,0,0, 'Zamek - Action 1 - Respawn go'), +(@SCRIPT,9,2,0,0,0,100,0,5000,5000,0,0,69,0,0,0,0,0,0,8,0,0,0,-6224,-3945,-58.75,0.75, 'Zamek - Action 2 - Move to pos'); + +-- Convert quest_end_script "1103" to SAI +-- Indexes: +SET @Tiev_Mordune := 7007; +SET @SCRIPT := @Tiev_Mordune * 100; + +-- Add SAI support +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@Tiev_Mordune; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@Tiev_Mordune AND `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@SCRIPT AND `source_type`=9; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@Tiev_Mordune,0,0,0,20,0,100,0,1103,0,0,0,80,@SCRIPT,2,0,0,0,0,1,0,0,0,0,0,0,0, 'Tiev Vordune - On quest 1103 rewarded - Start action list'), +(@SCRIPT,9,0,0,0,0,100,0,0,0,0,0,70,30,0,0,0,0,0,14,15175,106528,0,0,0,0,0, 'Tiev Mordune - Action 0 - Respawn go'), +(@SCRIPT,9,1,0,0,0,100,0,15000,15000,0,0,12,5895,3,180000,0,0,0,8,0,0,0,417.05,1822.39,13.007,0.035, 'Tiev Vordune - Action 1 - Move to pos'), +(@SCRIPT,9,2,0,0,0,100,0,0,0,0,0,70,180,0,0,0,0,0,14,15176,106528,0,0,0,0,0, 'Tiev Mordune - Action 2 - Respawn go'); + +-- Convert quest_end_script "997"/"931"/"930" to SAI +-- Indexes: +SET @Denalan := 2080; +SET @SCRIPT := @Denalan * 100; +SET @SCRIPT1 := @SCRIPT + 1; +SET @SCRIPT2 := @SCRIPT + 2; + +-- Add SAI support +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@Denalan; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@Denalan AND `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@SCRIPT,@SCRIPT1,@SCRIPT2) AND `source_type`=9; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@Denalan,0,0,0,20,0,100,0,997,0,0,0,80,@SCRIPT,2,0,0,0,0,1,0,0,0,0,0,0,0, 'Denalan - On quest 997 rewarded - Start action list'), +(@Denalan,0,1,0,20,0,100,0,931,0,0,0,80,@SCRIPT1,2,0,0,0,0,1,0,0,0,0,0,0,0, 'Denalan - On quest 931 rewarded - Start action list 1'), +(@Denalan,0,2,0,20,0,100,0,930,0,0,0,80,@SCRIPT2,2,0,0,0,0,1,0,0,0,0,0,0,0, 'Denalan - On quest 930 rewarded - Start action list 2'), +(@SCRIPT,9,0,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Denalan - Action 0 - Say 0'), +(@SCRIPT,9,1,0,0,0,100,0,0,0,0,0,69,0,0,0,0,0,0,8,0,0,0,9505.03,719.358,1256.22,2.5643, 'Denalan - Action 1 - Move'), +(@SCRIPT,9,2,0,0,0,100,0,5000,5000,0,0,5,16,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Denalan - Action 2 - Play emote'), +(@SCRIPT,9,3,0,0,0,100,0,4000,4000,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Denalan - Action 3 - Say 1'), +(@SCRIPT,9,4,0,0,0,100,0,1000,1000,0,0,5,2,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Denalan - Action 4 - Play emote'), +(@SCRIPT,9,5,0,0,0,100,0,1000,1000,0,0,69,0,0,0,0,0,0,14,0,0,0,9505.83,712.352,1255.89,0.533, 'Denalan - Action 5 - Move'), +(@SCRIPT1,9,0,0,0,0,100,0,2000,2000,0,0,69,0,0,0,0,0,0,8,0,0,0,9508.02,715.749,1255.89,1.03055, 'Denalan - Action 0 - Move'), +(@SCRIPT1,9,1,0,0,0,100,0,0,0,0,0,1,2,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Denalan - Action 1 - Say 2'), +(@SCRIPT1,9,2,0,0,0,100,0,1000,1000,0,0,69,0,0,0,0,0,0,8,0,0,0,9507.66,718.009,1255.89,1.80417, 'Denalan - Action 2 - Move'), +(@SCRIPT1,9,3,0,0,0,100,0,1000,1000,0,0,69,0,0,0,0,0,0,8,0,0,0,9505.56,719.088,1256.2,2.65632, 'Denalan - Action 3 - Move'), +(@SCRIPT1,9,4,0,0,0,100,0,2000,2000,0,0,1,3,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Denalan - Action 4 - Say 3'), +(@SCRIPT1,9,5,0,0,0,100,0,0,0,0,0,5,16,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Denalan - Action 5 - Play emote'), +(@SCRIPT1,9,6,0,0,0,100,0,5000,5000,0,0,69,0,0,0,0,0,0,8,0,0,0,9506.92,713.766,1255.89,0.279253, 'Denalan - Action 6 - Move'), +(@SCRIPT1,9,7,0,0,0,100,0,2000,2000,0,0,70,15,0,0,0,0,0,14,67984,7510,0,0,0,0,0, 'Denalan - Action 7 - Respawn go'), +(@SCRIPT1,9,8,0,0,0,100,0,0,0,0,0,70,15,0,0,0,0,0,14,42936,7510,0,0,0,0,0, 'Denalan - Action 8 - Respawn go'), +(@SCRIPT1,9,9,0,0,0,100,0,0,0,0,0,70,15,0,0,0,0,0,14,30276,7510,0,0,0,0,0, 'Denalan - Action 9 - Respawn go'), +(@SCRIPT2,9,0,0,0,0,100,0,2000,2000,0,0,1,4,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Denalan - Action 0 - Say 4'), +(@SCRIPT2,9,1,0,0,0,100,0,0,0,0,0,1,5,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Denalan - Action 1 - Say 5'), +(@SCRIPT2,9,2,0,0,0,100,0,1000,1000,0,0,69,0,0,0,0,0,0,8,0,0,0,9508.02,715.749,1255.89,1.03055, 'Denalan - Action 2 - Move'), +(@SCRIPT2,9,3,0,0,0,100,0,1000,1000,0,0,69,0,0,0,0,0,0,8,0,0,0,9507.66,718.009,1255.89,1.80417, 'Denalan - Action 3 - Move'), +(@SCRIPT2,9,4,0,0,0,100,0,2000,2000,0,0,69,0,0,0,0,0,0,8,0,0,0,9505.56,719.088,1256.2,2.65632, 'Denalan - Action 4 - Move'), +(@SCRIPT2,9,5,0,0,0,100,0,0,0,0,0,1,6,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Denalan - Action 5 - Say 6'), +(@SCRIPT2,9,6,0,0,0,100,0,5000,5000,0,0,5,16,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Denalan - Action 6 - Play emote'), +(@SCRIPT2,9,7,0,0,0,100,0,2000,2000,0,0,69,0,0,0,0,0,0,8,0,0,0,9506.92,713.766,1255.89,0.279253, 'Denalan - Action 7 - Move'), +(@SCRIPT2,9,8,0,0,0,100,0,0,0,0,0,12,3569,3,20000,0,0,0,8,0,0,0,9505.13,722.011,1255.94,0.0244875, 'Denalan - Action 8 - Summon'), +(@SCRIPT2,9,9,0,0,0,100,0,0,0,0,0,1,7,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Denalan - Action 9 - Say 7'), +(@SCRIPT2,9,10,0,0,0,100,0,0,0,0,0,12,3569,3,20000,0,0,0,8,0,0,0,9504.09,720.294,1255.94,1.00709, 'Denalan - Action 10 - Summon'), +(@SCRIPT2,9,11,0,0,0,100,0,0,0,0,0,12,3569,3,20000,0,0,0,8,0,0,0,9504.13,721.459,1255.94,6.24727, 'Denalan - Action 11 - Summon'); + +-- Convert from db_script_string to creature_text +DELETE FROM `db_script_string` WHERE `entry` IN (2000000048,2000000049,2000000093,2000000094,2000000086,2000000087,2000000088,2000000089); +DELETE FROM `creature_text` WHERE `entry`=@Denalan; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@Denalan,0,0, 'Now let us place this rare earth in my planter...',12,0,100,1,0,0, 'Denalan'), +(@Denalan,1,0, 'Thank you again, $N. This rare earth will be very helpful in my experiments.',12,0,100,1,0,0, 'Denalan'), +(@Denalan,2,0, 'Denalan hurries to his planter.',41,0,100,1,0,0, 'Denalan'), +(@Denalan,3,0, 'I hope this frond takes root...',12,0,100,1,0,0, 'Denalan'), +(@Denalan,4,0, 'Denalan removes the seeds from the Glowing Fruit...',41,0,100,1,0,0, 'Denalan'), +(@Denalan,5,0, 'Let''s see how these seeds grow in my prepared soil...',12,0,100,1,0,0, 'Denalan'), +(@Denalan,6,0, 'Denalan plants fruit seeds.',41,0,100,1,0,0, 'Denalan'), +(@Denalan,7,0, 'Bogling rises from the soil!',41,0,100,1,0,0, 'Denalan'); + +-- Convert quest_end_script "943" to SAI +-- Indexes: +SET @Archaeologist_Flagongut := 2911; +SET @SCRIPT := @Archaeologist_Flagongut * 100; + +-- Add SAI support +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@Archaeologist_Flagongut; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@Archaeologist_Flagongut AND `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@SCRIPT AND `source_type`=9; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@Archaeologist_Flagongut,0,0,0,20,0,100,0,943,0,0,0,80,@SCRIPT,2,0,0,0,0,1,0,0,0,0,0,0,0, 'Archaeologist Flagongut - On quest 943 rewarded - Start action list'), +(@SCRIPT,9,0,0,0,0,100,0,0,0,0,0,12,3582,3,40000,0,0,0,8,0,0,0,-3809,-839,16.94,2.16, 'Archaeologist Flagongut - Action 0 - Summon'), +(@SCRIPT,9,1,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Archaeologist Flagongut - Action 1 - Say 0'), +(@SCRIPT,9,2,0,0,0,100,0,1000,1000,0,0,69,0,0,0,0,0,0,8,0,0,0,-3809,-839,16.94,2.16, 'Archaeologist Flagongut - Action 2 - Move'), +(@SCRIPT,9,3,0,0,0,100,0,24000,24000,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Archaeologist Flagongut - Action 3 - Say 1'), +(@SCRIPT,9,4,0,0,0,100,0,5000,5000,0,0,69,0,0,0,0,0,0,8,0,0,0,-3819,-821,16.94,4.7, 'Archaeologist Flagongut - Action 4 - Move'); + +-- Convert from db_script_string to creature_text +DELETE FROM `db_script_string` WHERE `entry` IN (2000000060,2000000061); +DELETE FROM `creature_text` WHERE `entry`=@Archaeologist_Flagongut; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@Archaeologist_Flagongut,0,0, 'By the stars! A spirit has been summoned!',12,0,100,1,0,0, 'Archaeologist Flagongut'), +(@Archaeologist_Flagongut,1,0, 'It''s a mystery of the past indeed! But a key to our future!',12,0,100,1,0,0, 'Archaeologist Flagongut'); + +-- Convert quest_end_script "902" to SAI +-- Indexes: +SET @Sputtervalve := 3442; +SET @SCRIPT := @Sputtervalve * 100; + +-- Add SAI support +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@Sputtervalve; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@Sputtervalve AND `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@SCRIPT AND `source_type`=9; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@Sputtervalve,0,0,0,20,0,100,0,902,0,0,0,80,@SCRIPT,2,0,0,0,0,1,0,0,0,0,0,0,0, 'Sputtervalve - On quest 902 rewarded - Start action list'), +(@SCRIPT,9,0,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Sputtervalve - Action 0 - Say 0'), +(@SCRIPT,9,1,0,0,0,100,0,1000,1000,0,0,70,13,0,0,0,0,0,14,6552,162024,0,0,0,0,0, 'Sputtervalve - Action 1 - Respawn go'), +(@SCRIPT,9,2,0,0,0,100,0,1000,1000,0,0,5,173,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Sputtervalve - Action 2 - Play emote'), +(@SCRIPT,9,3,0,0,0,100,0,6000,6000,0,0,11,13727,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Sputtervalve - Action 3 - Cast spell'), +(@SCRIPT,9,4,0,0,0,100,0,1000,1000,0,0,5,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Sputtervalve - Action 4 - Play emote none'), +(@SCRIPT,9,5,0,0,0,100,0,1000,1000,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Sputtervalve - Action 5 - Say 1'); + +-- Convert from db_script_string to creature_text +DELETE FROM `db_script_string` WHERE `entry` IN (2000000101,2000000102); +DELETE FROM `creature_text` WHERE `entry`=@Sputtervalve; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@Sputtervalve,0,0, 'Ok, let''s take a look at this thing...',12,0,100,1,0,0, 'Sputtervalve'), +(@Sputtervalve,1,0, 'Oh, darn...',12,0,100,1,0,0, 'Sputtervalve'); + +-- Convert quest_end_script "492" to SAI +-- Indexes: +SET @Kalaran_Windblade := 8479; +SET @SCRIPT := @Kalaran_Windblade * 100; + +-- Add SAI support +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@Kalaran_Windblade; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@Kalaran_Windblade AND `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@SCRIPT AND `source_type`=9; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@Kalaran_Windblade,0,0,0,20,0,100,0,492,0,0,0,80,@SCRIPT,2,0,0,0,0,1,0,0,0,0,0,0,0, 'Kalaran Windblade - On quest 492 rewarded - Start action list'), +(@SCRIPT,9,0,0,0,0,100,0,1000,1000,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Kalaran Windblade - Action 0 - Say 0'), +(@SCRIPT,9,1,0,0,0,100,0,1000,1000,0,0,5,7,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Kalaran Windblade - Action 1 - Play emote'), +(@SCRIPT,9,2,0,0,0,100,0,4000,4000,0,0,11,5,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Kalaran Windblade - Action 2 - Cast Death Touch on self'); + +-- Convert from db_script_string to creature_text +DELETE FROM `db_script_string` WHERE `entry`=2000000084; +DELETE FROM `creature_text` WHERE `entry`=@Kalaran_Windblade; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@Kalaran_Windblade,0,0, 'I raise my brew and hope to be rid of the likes of you! Cheers, you no good scoundrel, $N!',12,0,100,1,0,0, 'Kalaran Windblade'); + +-- Convert quest_end_script "489" to SAI +-- Indexes: +SET @Zenn_Foulhoof := 2150; +SET @SCRIPT := @Zenn_Foulhoof * 100; + +-- Add SAI support +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@Zenn_Foulhoof; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@Zenn_Foulhoof AND `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@SCRIPT AND `source_type`=9; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@Zenn_Foulhoof,0,0,0,20,0,100,0,492,0,0,0,80,@SCRIPT,2,0,0,0,0,1,0,0,0,0,0,0,0, 'Zenn Foulhoof - On quest 492 rewarded - Start action list'), +(@SCRIPT,9,0,0,0,0,100,0,2000,2000,0,0,11,12244,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Zenn Foulhoof - Action 0 - Cast spell'), +(@SCRIPT,9,1,0,0,0,100,0,0,0,0,0,11,3329,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Zenn Foulhoof - Action 1 - Cast spell'), +(@SCRIPT,9,2,0,0,0,100,0,1000,1000,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Zenn Foulhoof - Action 2 - Say 0'); + +-- Convert from db_script_string to creature_text +DELETE FROM `db_script_string` WHERE `entry`=2000000047; +DELETE FROM `creature_text` WHERE `entry`=@Zenn_Foulhoof; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@Zenn_Foulhoof,0,0, 'Ribbit! No!! This cannot...ribbit...be! You have duped me with...ribbit...your foul trickery! Ribbit!',12,0,100,1,0,0, 'Zenn Foulhoof'); + +-- Convert quest_end_script "407" to SAI +-- Indexes: +SET @Scarlet_Zealot := 1931; +SET @SCRIPT := @Scarlet_Zealot * 100; + +-- Add SAI support +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@Scarlet_Zealot; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@Scarlet_Zealot AND `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@SCRIPT AND `source_type`=9; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@Scarlet_Zealot,0,0,0,20,0,100,0,407,0,0,0,80,@SCRIPT,2,0,0,0,0,1,0,0,0,0,0,0,0, 'Scarlet Zealot - On quest 407 rewarded - Start action list'), +(@SCRIPT,9,0,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Scarlet Zealot - Action 0 - Say 0'), +(@SCRIPT,9,1,0,0,0,100,0,3000,3000,0,0,11,3287,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Scarlet Zealot - Action 1 - Cast spell'), +(@SCRIPT,9,2,0,0,0,100,0,0,0,0,0,69,0,0,0,0,0,0,8,0,0,0,2292,239.481,27.0892,0.693878, 'Scarlet Zealot - Action 2 - Move'), +(@SCRIPT,9,3,0,0,0,100,0,3000,3000,0,0,69,0,0,0,0,0,0,8,0,0,0,2287.97,236.253,27.0892,2.6613, 'Scarlet Zealot - Action 3 - Move'), +(@SCRIPT,9,4,0,0,0,100,0,2000,2000,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Scarlet Zealot - Action 4 - Say 1'), +(@SCRIPT,9,5,0,0,0,100,0,2000,2000,0,0,69,0,0,0,0,0,0,8,0,0,0,2292.52,235.226,27.0892,4.8345, 'Scarlet Zealot - Action 5 - Move'), +(@SCRIPT,9,6,0,0,0,100,0,3000,3000,0,0,69,0,0,0,0,0,0,8,0,0,0,2288.96,237.96,27.0892,2.48773, 'Scarlet Zealot - Action 6 - Move'), +(@SCRIPT,9,7,0,0,0,100,0,6000,6000,0,0,11,5,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Scarlet Zealot - Action 7 - Cast spell'); + +-- Convert from db_script_string to creature_text +DELETE FROM `db_script_string` WHERE `entry` IN (2000000082,2000000083); +DELETE FROM `creature_text` WHERE `entry`=@Scarlet_Zealot; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@Scarlet_Zealot,0,0, 'I. . .I. . .don''t. . .feel. . .right. . .',12,0,100,1,0,0, 'Scarlet Zealot'), +(@Scarlet_Zealot,1,0, 'My mind. . .my flesh. . .I''m. . .rotting. . . .!',12,0,100,1,0,0, 'Scarlet Zealot'); + +-- Convert quest_end_script "349" to SAI +-- Indexes: +SET @Witch_Doctor_Unbagwa := 1449; +SET @SCRIPT := @Witch_Doctor_Unbagwa * 100; + +-- Add SAI support +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@Witch_Doctor_Unbagwa; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@Witch_Doctor_Unbagwa AND `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@SCRIPT AND `source_type`=9; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@Witch_Doctor_Unbagwa,0,0,0,20,0,100,0,349,0,0,0,80,@SCRIPT,2,0,0,0,0,1,0,0,0,0,0,0,0, 'Scarlet Zealot - On quest 349 rewarded - Start action list'), +(@SCRIPT,9,0,0,0,0,100,0,2000,2000,0,0,12,1511,3,300000,0,0,0,8,0,0,0,-13743.7,-23.97,45.14,5.7, 'Witch Doctor Unbagwa - Action 0 - Summon'), +(@SCRIPT,9,1,0,0,0,100,0,28000,28000,0,0,12,1516,3,300000,0,0,0,8,0,0,0,-13743.7,-23.97,45.14,5.7, 'Witch Doctor Unbagwa - Action 1 - Summon'), +(@SCRIPT,9,2,0,0,0,100,0,20000,20000,0,0,12,1514,3,300000,0,0,0,8,0,0,0,-13743.7,-23.97,45.14,5.7, 'Witch Doctor Unbagwa - Action 2 - Summon'); + +-- Convert quest_end_script "308" to SAI +-- Indexes: +SET @Jarven_Thunderbrew := 1373; +SET @SCRIPT := @Jarven_Thunderbrew * 100; + +-- Add SAI support +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@Jarven_Thunderbrew; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@Jarven_Thunderbrew AND `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@SCRIPT AND `source_type`=9; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@Jarven_Thunderbrew,0,0,0,20,0,100,0,308,0,0,0,80,@SCRIPT,2,0,0,0,0,1,0,0,0,0,0,0,0, 'Jarven Thunderbrew - On quest 308 rewarded - Start action list'), +(@SCRIPT,9,0,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Jarven Thunderbrew - Action 0 - Say 0'), +(@SCRIPT,9,1,0,0,0,100,0,0,0,0,0,69,0,0,0,0,0,0,8,0,0,0,-5601.64,-541.38,392.42,0.5, 'Jarven Thunderbrew - Action 1 - Move'), +(@SCRIPT,9,2,0,0,0,100,0,2000,2000,0,0,69,0,0,0,0,0,0,8,0,0,0,-5597.94,-542.04,392.42,5.5, 'Jarven Thunderbrew - Action 2 - Move'), +(@SCRIPT,9,3,0,0,0,100,0,1000,1000,0,0,70,30,0,0,0,0,0,14,35875,270,0,0,0,0,0, 'Jarven Thunderbrew - Action 3 - Respawn'), +(@SCRIPT,9,4,0,0,0,100,0,0,0,0,0,69,0,0,0,0,0,0,8,0,0,0,-5597.95,-548.43,395.48,4.7, 'Jarven Thunderbrew - Action 4 - Move'), +(@SCRIPT,9,5,0,0,0,100,0,4000,4000,0,0,69,0,0,0,0,0,0,8,0,0,0,-5605.31,-549.33,399.09,3.1, 'Jarven Thunderbrew - Action 5 - Move'), +(@SCRIPT,9,6,0,0,0,100,0,3000,3000,0,0,69,0,0,0,0,0,0,8,0,0,0,-5607.55,-546.63,399.09,1.5, 'Jarven Thunderbrew - Action 6 - Move'), +(@SCRIPT,9,7,0,0,0,100,0,4000,4000,0,0,69,0,0,0,0,0,0,8,0,0,0,-5597.52,-538.75,399.09,1.5, 'Jarven Thunderbrew - Action 7 - Move'), +(@SCRIPT,9,8,0,0,0,100,0,4000,4000,0,0,69,0,0,0,0,0,0,8,0,0,0,-5597.62,-530.24,399.65,3, 'Jarven Thunderbrew - Action 8 - Move'), +(@SCRIPT,9,9,0,0,0,100,0,3000,3000,0,0,69,0,0,0,0,0,0,8,0,0,0,-5603.67,-529.91,399.65,4.2, 'Jarven Thunderbrew - Action 9 - Move'), +(@SCRIPT,9,10,0,0,0,100,0,4000,4000,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Jarven Thunderbrew - Action 10 - Say 1'), +(@SCRIPT,9,11,0,0,0,100,0,11000,11000,0,0,69,0,0,0,0,0,0,8,0,0,0,-5603.67,-529.91,399.65,4.2, 'Jarven Thunderbrew - Action 11 - Move'), +(@SCRIPT,9,12,0,0,0,100,0,3000,3000,0,0,69,0,0,0,0,0,0,8,0,0,0,-5597.62,-530.24,399.65,3, 'Jarven Thunderbrew - Action 12 - Move'), +(@SCRIPT,9,13,0,0,0,100,0,3000,3000,0,0,69,0,0,0,0,0,0,8,0,0,0,-5597.52,-538.75,399.09,1.5, 'Jarven Thunderbrew - Action 13 - Move'), +(@SCRIPT,9,14,0,0,0,100,0,3000,3000,0,0,69,0,0,0,0,0,0,8,0,0,0,-5607.55,-546.63,399.09,1.5, 'Jarven Thunderbrew - Action 14 - Move'), +(@SCRIPT,9,15,0,0,0,100,0,3000,3000,0,0,69,0,0,0,0,0,0,8,0,0,0,-5605.31,-549.33,399.09,3.1, 'Jarven Thunderbrew - Action 15 - Move'), +(@SCRIPT,9,16,0,0,0,100,0,3000,3000,0,0,69,0,0,0,0,0,0,8,0,0,0,-5597.95,-548.43,395.48,4.7, 'Jarven Thunderbrew - Action 16 - Move'), +(@SCRIPT,9,17,0,0,0,100,0,3000,3000,0,0,69,0,0,0,0,0,0,8,0,0,0,-5597.94,-542.04,392.42,5.5, 'Jarven Thunderbrew - Action 17 - Move'), +(@SCRIPT,9,18,0,0,0,100,0,1000,1000,0,0,1,2,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Jarven Thunderbrew - Action 18 - Say 2'), +(@SCRIPT,9,19,0,0,0,100,0,3000,3000,0,0,11,5,0,0,0,0,0,1,0,0,0,-5601.64,-541.38,392.42,0.5, 'Jarven Thunderbrew - Action 19 - Movel'), +(@SCRIPT,9,20,0,0,0,100,0,2000,2000,0,0,11,5,0,0,0,0,0,1,0,0,0,-5605.96,-544.45,392.43,0.9, 'Jarven Thunderbrew - Action 20 - Move'), +(@SCRIPT,9,21,0,0,0,100,0,2000,2000,0,0,1,3,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Jarven Thunderbrew - Action 21 - Say 3'); + +-- Convert from db_script_string to creature_text +DELETE FROM `db_script_string` WHERE `entry` IN (2000000077,2000000056,2000000078,2000000079); +DELETE FROM `creature_text` WHERE `entry`=@Jarven_Thunderbrew; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@Jarven_Thunderbrew,0,0, '%s gestures to the pitcher of water sitting on the edge of the well.',12,0,100,1,0,0, 'Jarven Thunderbrew'), +(@Jarven_Thunderbrew,1,0, 'Hey there, Belm! Give me a mug of Thunder Ale, and one for my good friend $N.',12,0,100,1,0,0, 'Jarven Thunderbrew'), +(@Jarven_Thunderbrew,2,0, 'How goes the barrel watching...?',12,0,100,1,0,0, 'Jarven Thunderbrew'), +(@Jarven_Thunderbrew,3,0, 'Well, back to business for me. But it sure was nice taking that short break, and it''s always nice drinking Thunder Ale!',12,0,100,1,0,0, 'Jarven Thunderbrew'); + +-- Convert quest_end_script "63" to SAI +-- Indexes: +SET @Brazier_Everfount := 113791; +SET @SCRIPT := @Brazier_Everfount * 100; + +-- Add SAI support +UPDATE `gameobject_template` SET `AIName`='SmartGameObjectAI' WHERE `entry`=@Brazier_Everfount; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@Brazier_Everfount AND `source_type`=1; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@SCRIPT AND `source_type`=9; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@Brazier_Everfount,1,0,0,20,0,100,0,63,0,0,0,80,@SCRIPT,2,0,0,0,0,1,0,0,0,0,0,0,0, 'Brazier of Everfount - On quest 63 rewarded - Start action list'), +(@SCRIPT,9,0,0,0,0,100,0,0,0,0,0,70,30,0,0,0,0,0,14,15175,106528,0,0,0,0,0, 'Brazier of Everfount - Action 0 - Respawn go'), +(@SCRIPT,9,1,0,0,0,100,0,15000,15000,0,0,70,180,0,0,0,0,0,14,15176,106529,0,0,0,0,0, 'Brazier of Everfount - Action 1 - Respawn go'), +(@SCRIPT,9,2,0,0,0,100,0,0,0,0,0,12,5895,3,180000,0,0,0,8,0,0,0,417.05,1822.39,13.007,0.035, 'Brazier of Everfount - Action 2 - Summon'); From a3b34e2894e19c3e5939b7c74e49302046a88b0c Mon Sep 17 00:00:00 2001 From: Vincent_Michael Date: Sat, 22 Dec 2012 01:13:56 +0100 Subject: [PATCH 21/33] Core: Fix more some codestyle --- src/server/game/Entities/Item/Item.cpp | 7 ------- src/server/game/Entities/Unit/Unit.cpp | 2 +- .../scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp | 2 +- src/server/scripts/Kalimdor/moonglade.cpp | 2 +- 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index dd54a3d39db..5be1bbf5290 100644 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -1234,7 +1234,6 @@ void Item::ItemContainerSaveLootToDB() // Save items if (!loot.isLooted()) { - PreparedStatement* stmt_items = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_ITEMS); stmt_items->setUInt32(0, container_id); trans->Append(stmt_items); @@ -1300,7 +1299,6 @@ bool Item::ItemContainerLoadLootFromDB() // Get a LootTemplate for the container item. This is where // the saved loot was originally rolled from, we will copy conditions from it LootTemplate const* lt = LootTemplates_Item.GetLootFor(GetEntry()); - if (lt) { do @@ -1351,7 +1349,6 @@ bool Item::ItemContainerLoadLootFromDB() void Item::ItemContainerDeleteLootItemsFromDB() { // Deletes items associated with an openable item from the DB - uint32 containerId = GetGUIDLow(); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_ITEMS); stmt->setUInt32(0, containerId); @@ -1363,7 +1360,6 @@ void Item::ItemContainerDeleteLootItemsFromDB() void Item::ItemContainerDeleteLootItemFromDB(uint32 itemID) { // Deletes a single item associated with an openable item from the DB - uint32 containerId = GetGUIDLow(); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_ITEM); stmt->setUInt32(0, containerId); @@ -1376,7 +1372,6 @@ void Item::ItemContainerDeleteLootItemFromDB(uint32 itemID) void Item::ItemContainerDeleteLootMoneyFromDB() { // Deletes the money loot associated with an openable item from the DB - uint32 containerId = GetGUIDLow(); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_MONEY); stmt->setUInt32(0, containerId); @@ -1388,8 +1383,6 @@ void Item::ItemContainerDeleteLootMoneyFromDB() void Item::ItemContainerDeleteLootMoneyAndLootItemsFromDB() { // Deletes money and items associated with an openable item from the DB - ItemContainerDeleteLootMoneyFromDB(); ItemContainerDeleteLootItemsFromDB(); } - diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index d4b276fd2db..05dd8656d9c 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -5598,7 +5598,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere ok = true; } - // The spell usually only hits one target, but it should hit every player + // The spell usually only hits one target, but it should hit every player // which applied Shadows Fate at least once to the victim. if (target->GetTypeId() == TYPEID_PLAYER && target->ToPlayer()->GetQuestStatus(24547) == QUEST_STATUS_INCOMPLETE) { diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp index c97fd40929a..14ea31a6518 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp @@ -59,7 +59,7 @@ enum Emotes EMOTE_SLOW = 0, EMOTE_FREEZE = 1, EMOTE_FROZEN = 2, - + EMOTE_CRACK = 3, EMOTE_SHATTER = 4, EMOTE_EXPLODE = 5 diff --git a/src/server/scripts/Kalimdor/moonglade.cpp b/src/server/scripts/Kalimdor/moonglade.cpp index f438275b82a..14a76cc153e 100644 --- a/src/server/scripts/Kalimdor/moonglade.cpp +++ b/src/server/scripts/Kalimdor/moonglade.cpp @@ -323,7 +323,7 @@ public: } void IsSummonedBy(Unit* /*summoner*/) - { + { std::list playerOnQuestList; Trinity::AnyPlayerInObjectRangeCheck checker(me, 5.0f); Trinity::PlayerListSearcher searcher(me, playerOnQuestList, checker); From 4c9451d54c885df3fac4be875728425ca0defa45 Mon Sep 17 00:00:00 2001 From: MrSmite Date: Fri, 21 Dec 2012 20:57:22 -0500 Subject: [PATCH 22/33] Fix pet stopping approach when attacked by another creature Fix pet placed on stay after "attack" not attacking new attackers Closes #8735 --- src/server/game/AI/CoreAI/PetAI.cpp | 4 ++++ src/server/game/Entities/Unit/Unit.cpp | 5 ++++- src/server/game/Entities/Unit/Unit.h | 18 ++++++++++++++---- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index 78c22e74f44..47cc4d12501 100644 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -106,8 +106,12 @@ void PetAI::UpdateAI(const uint32 diff) // Check before attacking to prevent pets from leaving stay position if (me->GetCharmInfo()->HasCommandState(COMMAND_STAY)) { + // Case where pet was put on stay after "attack" was clicked and it gets attacked by + // another creature. Pet can switch target if victim is out of range. if (me->GetCharmInfo()->IsCommandAttack() || (me->GetCharmInfo()->IsAtStay() && me->IsWithinMeleeRange(me->getVictim()))) DoMeleeAttackIfReady(); + else if (me->GetCharmInfo()->IsCommandAttack() || (me->GetCharmInfo()->IsAtStay() && me->IsWithinMeleeRange(me->getAttackerForHelper()))) + DoAttack(me->getAttackerForHelper(), false); } else DoMeleeAttackIfReady(); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index d4b276fd2db..4252bf1cb1f 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -12136,7 +12136,10 @@ void Unit::CombatStart(Unit* target, bool initialAggro) if (!target->isInCombat() && target->GetTypeId() != TYPEID_PLAYER && !target->ToCreature()->HasReactState(REACT_PASSIVE) && target->ToCreature()->IsAIEnabled) { - target->ToCreature()->AI()->AttackStart(this); + if (target->isPet()) + target->ToCreature()->AI()->AttackedBy(this); // PetAI has special handler before AttackStart() + else + target->ToCreature()->AI()->AttackStart(this); } SetInCombatWith(target); diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 3053d0018d4..8cb0f434907 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1261,12 +1261,22 @@ class Unit : public WorldObject } Unit* getAttackerForHelper() const // If someone wants to help, who to give them { - if (getVictim() != NULL) - return getVictim(); + if (isPet()) + { + if (!m_attackers.empty()) + return *(m_attackers.begin()); - if (!m_attackers.empty()) - return *(m_attackers.begin()); + if (getVictim() != NULL) + return getVictim(); + } + else + { + if (getVictim() != NULL) + return getVictim(); + if (!m_attackers.empty()) + return *(m_attackers.begin()); + } return NULL; } bool Attack(Unit* victim, bool meleeAttack); From 80dcf879deb61198ff2c91d71887f0eae9acad68 Mon Sep 17 00:00:00 2001 From: Trista Date: Sat, 22 Dec 2012 04:27:02 +0200 Subject: [PATCH 23/33] Core/Spells: TARGET_UNIT_MASTER passenger support * what happened before was spells casted from vehicle to passenger getting blocked by general check exceptions that state passengers to be not implicitly spell hit, however they should be ignored when caster is vehicle to master passenger * fix a lot of quests that award kill credit that was blocked before * precisely closes: #8643 and makes #5254 awardable --- src/server/game/Spells/SpellInfo.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index fcfa441455e..6631a8138b4 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -1546,11 +1546,18 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta if (unitTarget->HasUnitState(UNIT_STATE_IN_FLIGHT)) return SPELL_FAILED_BAD_TARGETS; - if (TargetAuraState && !unitTarget->HasAuraState(AuraStateType(TargetAuraState), this, caster)) - return SPELL_FAILED_TARGET_AURASTATE; + // TARGET_UNIT_MASTER gets blocked here for passengers, because the whole idea of this check is to + // not allow passengers to be implicitly hit by spells, however this target type should be an exception, + // if this is left it kills spells that award kill credit from vehicle to master and some or all* spells, + // the use of these 2 covers passenger target check + if (!(Targets & TARGET_UNIT_MASTER) && !caster->IsVehicle()) + { + if (TargetAuraState && !unitTarget->HasAuraState(AuraStateType(TargetAuraState), this, caster)) + return SPELL_FAILED_TARGET_AURASTATE; - if (TargetAuraStateNot && unitTarget->HasAuraState(AuraStateType(TargetAuraStateNot), this, caster)) - return SPELL_FAILED_TARGET_AURASTATE; + if (TargetAuraStateNot && unitTarget->HasAuraState(AuraStateType(TargetAuraStateNot), this, caster)) + return SPELL_FAILED_TARGET_AURASTATE; + } if (TargetAuraSpell && !unitTarget->HasAura(sSpellMgr->GetSpellIdForDifficulty(TargetAuraSpell, caster))) return SPELL_FAILED_TARGET_AURASTATE; From aabfa3afae128e5cc23852d6b9ddef145c6e360e Mon Sep 17 00:00:00 2001 From: Trista Date: Sat, 22 Dec 2012 06:32:45 +0200 Subject: [PATCH 24/33] Core/Spell: Properly rewrite previous change: 80dcf879deb61198ff2c91d71887f0eae9acad68 * thx to @joschiwald for noticing problem and helping, see rest info in comment or previous fix --- src/server/game/Spells/SpellInfo.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 6631a8138b4..61b92ce6f81 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -1546,11 +1546,14 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta if (unitTarget->HasUnitState(UNIT_STATE_IN_FLIGHT)) return SPELL_FAILED_BAD_TARGETS; - // TARGET_UNIT_MASTER gets blocked here for passengers, because the whole idea of this check is to - // not allow passengers to be implicitly hit by spells, however this target type should be an exception, - // if this is left it kills spells that award kill credit from vehicle to master and some or all* spells, - // the use of these 2 covers passenger target check - if (!(Targets & TARGET_UNIT_MASTER) && !caster->IsVehicle()) + /* TARGET_UNIT_MASTER gets blocked here for passengers, because the whole idea of this check is to + not allow passengers to be implicitly hit by spells, however this target type should be an exception, + if this is left it kills spells that award kill credit from vehicle to master (few spells), + the use of these 2 covers passenger target check, logically, if vehicle cast this to master it should always hit + him, because it would be it's passenger, there's no such case where this gets to fail legitimacy, this problem + cannot be solved from within the check in other way since target type cannot be called for the spell currently + Spell examples: [ID - 52864 Devour Water, ID - 52862 Devour Wind, ID - 49370 Wyrmrest Defender: Destabilize Azure Dragonshrine Effect] */ + if (!caster->IsVehicle() && !(caster->GetCharmerOrOwner() == target)) { if (TargetAuraState && !unitTarget->HasAuraState(AuraStateType(TargetAuraState), this, caster)) return SPELL_FAILED_TARGET_AURASTATE; From 8cbb3763dd3f6fb043c5c60bb81014349125b942 Mon Sep 17 00:00:00 2001 From: Gacko Date: Sat, 22 Dec 2012 16:42:46 +0100 Subject: [PATCH 25/33] Core/Spell: Shadows Fate crash fix --- src/server/game/Entities/Unit/Unit.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 05dd8656d9c..92629d286bc 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -5598,18 +5598,18 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere ok = true; } - // The spell usually only hits one target, but it should hit every player - // which applied Shadows Fate at least once to the victim. - if (target->GetTypeId() == TYPEID_PLAYER && target->ToPlayer()->GetQuestStatus(24547) == QUEST_STATUS_INCOMPLETE) + // TODO: The aura should be applieable by multiple players + Unit* caster = triggeredByAura->GetCaster(); + if (caster && caster->GetTypeId() == TYPEID_PLAYER && caster->ToPlayer()->GetQuestStatus(24547) == QUEST_STATUS_INCOMPLETE) { - triggered_spell_id = 71203; + CastSpell(caster, 71203, true); ok = true; } if (!ok) return false; - break; + return true; } // Essence of the Blood Queen case 70871: From 2302b04a063e79988fb8fae0c0c595c5fc5c8a55 Mon Sep 17 00:00:00 2001 From: Gacko Date: Sat, 22 Dec 2012 17:49:51 +0100 Subject: [PATCH 26/33] Core/Spell: Last work on Shadows Fate - Shadows Fate can now be applied by more than just one player at the same time. So on everyone who hits the unit the credit spell with the visual will be casted on death. - The AOE credit spells for the three infusion quests will be casted by the boss once. If this would be done on proc, these AOE spells could be casted up to 25 times. -> 25 AOE credit spells plus 25 Soul Feast credit spells equals Sh** --- src/server/game/Entities/Unit/Unit.cpp | 36 +------- src/server/game/Spells/SpellMgr.cpp | 3 + .../boss_blood_queen_lana_thel.cpp | 7 ++ .../boss_professor_putricide.cpp | 91 ++++++++++--------- .../IcecrownCitadel/boss_sindragosa.cpp | 9 +- .../IcecrownCitadel/icecrown_citadel.h | 3 + 6 files changed, 73 insertions(+), 76 deletions(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 92629d286bc..52515ebee8b 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -5572,44 +5572,14 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // Shadow's Fate (Shadowmourne questline) case 71169: { - bool ok = false; - if (GetMap()->GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL || GetMap()->GetDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC) - { - uint32 spellId = 0; - - switch (GetEntry()) - { - case 36678: // NPC: Professor Putricide - spellId = 71518; // Spell: Unholy Infusion Credit - break; - case 37955: // NPC: Blood-Queen Lana'thel - spellId = 72934; // Spell: Quest Credit - break; - case 36853: // NPC: Sindragosa - spellId = 72289; // Spell: Frost Infusion Quest Credit - break; - default: - break; - } - - if (spellId) - CastSpell((Unit*)NULL, spellId, true); - - ok = true; - } - - // TODO: The aura should be applieable by multiple players Unit* caster = triggeredByAura->GetCaster(); if (caster && caster->GetTypeId() == TYPEID_PLAYER && caster->ToPlayer()->GetQuestStatus(24547) == QUEST_STATUS_INCOMPLETE) { CastSpell(caster, 71203, true); - ok = true; + return true; } - - if (!ok) + else return false; - - return true; } // Essence of the Blood Queen case 70871: @@ -9055,7 +9025,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg case 71169: { // Victim needs more checks so bugs, rats or summons can not be affected by the proc. - if (GetTypeId() != TYPEID_PLAYER || victim->GetTypeId() != TYPEID_UNIT || victim->GetCreatureType() == CREATURE_TYPE_CRITTER) + if (GetTypeId() != TYPEID_PLAYER || !victim || victim->GetTypeId() != TYPEID_UNIT || victim->GetCreatureType() == CREATURE_TYPE_CRITTER) return false; Player* player = ToPlayer(); diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 3eefd969eed..d166c6f9ebf 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3413,6 +3413,9 @@ void SpellMgr::LoadDbcDataCorrections() case 71123: // Decimate (Stinky & Precious) spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_100_YARDS; // 100yd break; + case 71169: // Shadow's Fate + spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; + break; case 72378: // Blood Nova (Deathbringer Saurfang) case 73058: // Blood Nova (Deathbringer Saurfang) spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp index 2b240bc93d8..a246852c8ed 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp @@ -62,6 +62,9 @@ enum Spells SPELL_INCITE_TERROR = 73070, SPELL_BLOODBOLT_WHIRL = 71772, SPELL_ANNIHILATE = 71322, + + // Blood Infusion + SPELL_BLOOD_INFUSION_CREDIT = 72934 }; enum Shadowmourne @@ -182,6 +185,10 @@ class boss_blood_queen_lana_thel : public CreatureScript { _JustDied(); Talk(SAY_DEATH); + + if (Is25ManRaid() && me->HasAura(SPELL_SHADOWS_FATE)) + DoCastAOE(SPELL_BLOOD_INFUSION_CREDIT, true); + CleanAuras(); // Blah, credit the quest if (_creditBloodQuickening) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index 4727504a4bd..d697be214c7 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -51,62 +51,65 @@ enum ScriptTexts enum Spells { // Festergut - SPELL_RELEASE_GAS_VISUAL = 69125, - SPELL_GASEOUS_BLIGHT_LARGE = 69157, - SPELL_GASEOUS_BLIGHT_MEDIUM = 69162, - SPELL_GASEOUS_BLIGHT_SMALL = 69164, - SPELL_MALLABLE_GOO_H = 70852, + SPELL_RELEASE_GAS_VISUAL = 69125, + SPELL_GASEOUS_BLIGHT_LARGE = 69157, + SPELL_GASEOUS_BLIGHT_MEDIUM = 69162, + SPELL_GASEOUS_BLIGHT_SMALL = 69164, + SPELL_MALLABLE_GOO_H = 70852, // Rotface - SPELL_VILE_GAS_H = 69240, + SPELL_VILE_GAS_H = 69240, // Professor Putricide - SPELL_SLIME_PUDDLE_TRIGGER = 70341, - SPELL_MALLEABLE_GOO = 70852, - SPELL_UNSTABLE_EXPERIMENT = 70351, - SPELL_TEAR_GAS = 71617, // phase transition - SPELL_TEAR_GAS_CREATURE = 71618, - SPELL_TEAR_GAS_CANCEL = 71620, - SPELL_TEAR_GAS_PERIODIC_TRIGGER = 73170, - SPELL_CREATE_CONCOCTION = 71621, - SPELL_GUZZLE_POTIONS = 71893, - SPELL_OOZE_TANK_PROTECTION = 71770, // protects the tank - SPELL_CHOKING_GAS_BOMB = 71255, - SPELL_OOZE_VARIABLE = 74118, - SPELL_GAS_VARIABLE = 74119, - SPELL_UNBOUND_PLAGUE = 70911, - SPELL_UNBOUND_PLAGUE_SEARCHER = 70917, - SPELL_PLAGUE_SICKNESS = 70953, - SPELL_UNBOUND_PLAGUE_PROTECTION = 70955, - SPELL_MUTATED_PLAGUE = 72451, - SPELL_MUTATED_PLAGUE_CLEAR = 72618, + SPELL_SLIME_PUDDLE_TRIGGER = 70341, + SPELL_MALLEABLE_GOO = 70852, + SPELL_UNSTABLE_EXPERIMENT = 70351, + SPELL_TEAR_GAS = 71617, // phase transition + SPELL_TEAR_GAS_CREATURE = 71618, + SPELL_TEAR_GAS_CANCEL = 71620, + SPELL_TEAR_GAS_PERIODIC_TRIGGER = 73170, + SPELL_CREATE_CONCOCTION = 71621, + SPELL_GUZZLE_POTIONS = 71893, + SPELL_OOZE_TANK_PROTECTION = 71770, // protects the tank + SPELL_CHOKING_GAS_BOMB = 71255, + SPELL_OOZE_VARIABLE = 74118, + SPELL_GAS_VARIABLE = 74119, + SPELL_UNBOUND_PLAGUE = 70911, + SPELL_UNBOUND_PLAGUE_SEARCHER = 70917, + SPELL_PLAGUE_SICKNESS = 70953, + SPELL_UNBOUND_PLAGUE_PROTECTION = 70955, + SPELL_MUTATED_PLAGUE = 72451, + SPELL_MUTATED_PLAGUE_CLEAR = 72618, // Slime Puddle - SPELL_GROW_STACKER = 70345, - SPELL_GROW = 70347, - SPELL_SLIME_PUDDLE_AURA = 70343, + SPELL_GROW_STACKER = 70345, + SPELL_GROW = 70347, + SPELL_SLIME_PUDDLE_AURA = 70343, // Gas Cloud - SPELL_GASEOUS_BLOAT_PROC = 70215, - SPELL_GASEOUS_BLOAT = 70672, - SPELL_GASEOUS_BLOAT_PROTECTION = 70812, - SPELL_EXPUNGED_GAS = 70701, + SPELL_GASEOUS_BLOAT_PROC = 70215, + SPELL_GASEOUS_BLOAT = 70672, + SPELL_GASEOUS_BLOAT_PROTECTION = 70812, + SPELL_EXPUNGED_GAS = 70701, // Volatile Ooze - SPELL_OOZE_ERUPTION = 70492, - SPELL_VOLATILE_OOZE_ADHESIVE = 70447, - SPELL_OOZE_ERUPTION_SEARCH_PERIODIC = 70457, - SPELL_VOLATILE_OOZE_PROTECTION = 70530, + SPELL_OOZE_ERUPTION = 70492, + SPELL_VOLATILE_OOZE_ADHESIVE = 70447, + SPELL_OOZE_ERUPTION_SEARCH_PERIODIC = 70457, + SPELL_VOLATILE_OOZE_PROTECTION = 70530, // Choking Gas Bomb - SPELL_CHOKING_GAS_BOMB_PERIODIC = 71259, - SPELL_CHOKING_GAS_EXPLOSION_TRIGGER = 71280, + SPELL_CHOKING_GAS_BOMB_PERIODIC = 71259, + SPELL_CHOKING_GAS_EXPLOSION_TRIGGER = 71280, // Mutated Abomination vehicle - SPELL_ABOMINATION_VEHICLE_POWER_DRAIN = 70385, - SPELL_MUTATED_TRANSFORMATION = 70311, - SPELL_MUTATED_TRANSFORMATION_DAMAGE = 70405, - SPELL_MUTATED_TRANSFORMATION_NAME = 72401, + SPELL_ABOMINATION_VEHICLE_POWER_DRAIN = 70385, + SPELL_MUTATED_TRANSFORMATION = 70311, + SPELL_MUTATED_TRANSFORMATION_DAMAGE = 70405, + SPELL_MUTATED_TRANSFORMATION_NAME = 72401, + + // Unholy Infusion + SPELL_UNHOLY_INFUSION_CREDIT = 71518 }; #define SPELL_GASEOUS_BLOAT_HELPER RAID_MODE(70672, 72455, 72832, 72833) @@ -293,6 +296,10 @@ class boss_professor_putricide : public CreatureScript { _JustDied(); Talk(SAY_DEATH); + + if (Is25ManRaid() && me->HasAura(SPELL_SHADOWS_FATE)) + DoCastAOE(SPELL_UNHOLY_INFUSION_CREDIT, true); + DoCast(SPELL_MUTATED_PLAGUE_CLEAR); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 96cabfed918..8bdef30a711 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -82,6 +82,9 @@ enum Spells SPELL_FOCUS_FIRE = 71350, SPELL_ORDER_WHELP = 71357, SPELL_CONCUSSIVE_SHOCK = 71337, + + // Frost Infusion + SPELL_FROST_INFUSION_CREDIT = 72289 }; enum Events @@ -231,8 +234,12 @@ class boss_sindragosa : public CreatureScript void JustDied(Unit* killer) { - BossAI::JustDied(killer); + _JustDied(); Talk(SAY_DEATH); + + if (Is25ManRaid() && me->HasAura(SPELL_SHADOWS_FATE)) + DoCastAOE(SPELL_FROST_INFUSION_CREDIT, true); + } void EnterCombat(Unit* victim) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h index 4e117d9f3e3..8edaf1aa985 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h @@ -54,6 +54,9 @@ enum SharedSpells // The Lich King SPELL_ARTHAS_TELEPORTER_CEREMONY = 72915, SPELL_FROSTMOURNE_TELEPORT_VISUAL = 73078, + + // Shadowmourne questline + SPELL_SHADOWS_FATE = 71169 }; enum TeleporterSpells From 9a5b17d536c3c39f81548b1f4dca51caa6b3f48d Mon Sep 17 00:00:00 2001 From: MrSmite Date: Sat, 22 Dec 2012 12:01:51 -0500 Subject: [PATCH 27/33] Update src/server/game/AI/CoreAI/PetAI.cpp --- src/server/game/AI/CoreAI/PetAI.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index 47cc4d12501..78c22e74f44 100644 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -106,12 +106,8 @@ void PetAI::UpdateAI(const uint32 diff) // Check before attacking to prevent pets from leaving stay position if (me->GetCharmInfo()->HasCommandState(COMMAND_STAY)) { - // Case where pet was put on stay after "attack" was clicked and it gets attacked by - // another creature. Pet can switch target if victim is out of range. if (me->GetCharmInfo()->IsCommandAttack() || (me->GetCharmInfo()->IsAtStay() && me->IsWithinMeleeRange(me->getVictim()))) DoMeleeAttackIfReady(); - else if (me->GetCharmInfo()->IsCommandAttack() || (me->GetCharmInfo()->IsAtStay() && me->IsWithinMeleeRange(me->getAttackerForHelper()))) - DoAttack(me->getAttackerForHelper(), false); } else DoMeleeAttackIfReady(); From 09204f15347a4a0988e9acb8f5420d3f39eac755 Mon Sep 17 00:00:00 2001 From: MrSmite Date: Sat, 22 Dec 2012 12:04:10 -0500 Subject: [PATCH 28/33] Update src/server/game/Entities/Unit/Unit.h --- src/server/game/Entities/Unit/Unit.h | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 8cb0f434907..3053d0018d4 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1261,22 +1261,12 @@ class Unit : public WorldObject } Unit* getAttackerForHelper() const // If someone wants to help, who to give them { - if (isPet()) - { - if (!m_attackers.empty()) - return *(m_attackers.begin()); + if (getVictim() != NULL) + return getVictim(); - if (getVictim() != NULL) - return getVictim(); - } - else - { - if (getVictim() != NULL) - return getVictim(); + if (!m_attackers.empty()) + return *(m_attackers.begin()); - if (!m_attackers.empty()) - return *(m_attackers.begin()); - } return NULL; } bool Attack(Unit* victim, bool meleeAttack); From f1d960a589e1477532aae224ef8a573716ad6d9a Mon Sep 17 00:00:00 2001 From: Gacko Date: Sat, 22 Dec 2012 23:07:49 +0100 Subject: [PATCH 29/33] DB: The Crusaders Pinnacle chain. Thx @Exodius --- ..._12_22_02_world_the_crusaders_pinnacle.sql | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 sql/updates/world/2012_12_22_02_world_the_crusaders_pinnacle.sql diff --git a/sql/updates/world/2012_12_22_02_world_the_crusaders_pinnacle.sql b/sql/updates/world/2012_12_22_02_world_the_crusaders_pinnacle.sql new file mode 100644 index 00000000000..5debd41a160 --- /dev/null +++ b/sql/updates/world/2012_12_22_02_world_the_crusaders_pinnacle.sql @@ -0,0 +1,38 @@ +-- The Crusader's Pinnacle +-- The Purging Of Scourgeholme 13118 / The Restless Dead 13110 / The Stone That Started A Revolution 13130 / It Could Kill Us All 13135 / The Scourgestone 13122 +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` IN (19,20) AND `SourceEntry` IN (13118,13110,13130,13135,13122); +INSERT INTO `conditions`(`SourceTypeOrReferenceId`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`Comment`) VALUES +-- The Purging Of Scourgeholme 13118 +(19,13118,0,8,13104,'Accepting The Purging Of Scourgeholme requires Once More Unto The Breach, Hero (DK only) to be rewarded'), +(20,13118,0,8,13104,'Quest mark for The Purging Of Scourgeholme requires Once More Unto The Breach, Hero (DK only) to be rewarded'), +(19,13118,1,8,13105,'Accepting The Purging Of Scourgeholme requires Once More Unto The Breach, Hero (Non-DK) to be rewarded'), +(20,13118,1,8,13105,'Quest mark for The Purging Of Scourgeholme requires Once More Unto The Breach, Hero (Non-DK) to be rewarded'), +-- The Restless Dead 13110 +(19,13110,0,8,13104,'Accepting The Restless Dead requires Once More Unto The Breach, Hero (DK only) to be rewarded'), +(20,13110,0,8,13104,'Quest mark for The Restless Dead requires Once More Unto The Breach, Hero (DK only) to be rewarded'), +(19,13110,1,8,13105,'Accepting The Restless Dead requires Once More Unto The Breach, Hero (Non-DK) to be rewarded'), +(20,13110,1,8,13105,'Quest mark for The Restless Dead requires Once More Unto The Breach, Hero (Non-DK) to be rewarded'), +-- The Stone That Started A Revolution 13130 +(19,13130,0,8,13104,'Accepting The Stone That Started A Revolution requires Once More Unto The Breach, Hero (DK only) to be rewarded'), +(20,13130,0,8,13104,'Quest mark for The Stone That Started A Revolution requires Once More Unto The Breach, Hero (DK only) to be rewarded'), +(19,13130,1,8,13105,'Accepting The Stone That Started A Revolution requires Once More Unto The Breach, Hero (Non-DK) to be rewarded'), +(20,13130,1,8,13105,'Quest mark for The Stone That Started A Revolution requires Once More Unto The Breach, Hero (Non-DK) to be rewarded'), +-- It Could Kill Us All 13135 +(19,13135,0,8,13104,'Accepting It Could Kill Us All requires Once More Unto The Breach, Hero (DK only) to be rewarded'), +(20,13135,0,8,13104,'Quest mark for It Could Kill Us All requires Once More Unto The Breach, Hero (DK only) to be rewarded'), +(19,13135,1,8,13105,'Accepting It Could Kill Us All requires Once More Unto The Breach, Hero (Non-DK) to be rewarded'), +(20,13135,1,8,13105,'Quest mark for It Could Kill Us All requires Once More Unto The Breach, Hero (Non-DK) to be rewarded'), +-- The Scourgestone 13122 +(19,13122,0,8,13104,'Accepting The Scourgestone requires Once More Unto The Breach, Hero (DK only) to be rewarded'), +(20,13122,0,8,13104,'Quest mark for The Scourgestone requires Once More Unto The Breach, Hero (DK only) to be rewarded'), +(19,13122,1,8,13105,'Accepting The Scourgestone requires Once More Unto The Breach, Hero (Non-DK) to be rewarded'), +(20,13122,1,8,13105,'Quest mark for The Scourgestone requires Once More Unto The Breach, Hero (Non-DK) to be rewarded'); + +-- Handled in a different way now... +UPDATE `quest_template` SET `PrevQuestId`=0 WHERE `Id` IN (13118,13122,13110,13130,13135,13125); + +-- The Purging Of Scourgeholme 13118 / The Scourgestone 13122 +UPDATE `quest_template` SET `NextQuestId`=13125,`ExclusiveGroup`=-13125 WHERE `Id` IN (13118,13122); + +-- The Restless Dead 13110 / The Stone That Started A Revolution 13130 / It Could Kill Us All 13135 / The Air Stands Still 13125 +UPDATE `quest_template` SET `NextQuestId`=13139,`ExclusiveGroup`=-13139 WHERE `Id` IN (13110,13130,13135,13125); From b0c7b01b8e8850a64fcea3ae7de68beefec5e23d Mon Sep 17 00:00:00 2001 From: Kinzcool Date: Sun, 23 Dec 2012 01:18:13 -0500 Subject: [PATCH 30/33] DB/Creature Text: Added sounds for Warden Mellichar --- sql/updates/world/2012_12_23_00_creature_text.sql | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 sql/updates/world/2012_12_23_00_creature_text.sql diff --git a/sql/updates/world/2012_12_23_00_creature_text.sql b/sql/updates/world/2012_12_23_00_creature_text.sql new file mode 100644 index 00000000000..37b4d66b3fe --- /dev/null +++ b/sql/updates/world/2012_12_23_00_creature_text.sql @@ -0,0 +1,8 @@ +UPDATE `creature_text` SET `sound`=11222 WHERE `entry`=20904 AND `groupid`=0; +UPDATE `creature_text` SET `sound`=11223 WHERE `entry`=20904 AND `groupid`=1; +UPDATE `creature_text` SET `sound`=11224 WHERE `entry`=20904 AND `groupid`=2; +UPDATE `creature_text` SET `sound`=11225 WHERE `entry`=20904 AND `groupid`=3; +UPDATE `creature_text` SET `sound`=11226 WHERE `entry`=20904 AND `groupid`=4; +UPDATE `creature_text` SET `sound`=11227 WHERE `entry`=20904 AND `groupid`=5; +UPDATE `creature_text` SET `sound`=11228 WHERE `entry`=20904 AND `groupid`=6; +UPDATE `creature_text` SET `sound`=11229 WHERE `entry`=20904 AND `groupid`=7; From bb8a4c40bad9a9e07d22b94b37b53c48ac80bd0f Mon Sep 17 00:00:00 2001 From: Kinzcool Date: Sun, 23 Dec 2012 02:08:45 -0500 Subject: [PATCH 31/33] DB/Creature Text: Added sound & updated some texts with sniffed data for Millhouse Manastorm --- sql/updates/world/2012_12_23_01_creature_text.sql | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 sql/updates/world/2012_12_23_01_creature_text.sql diff --git a/sql/updates/world/2012_12_23_01_creature_text.sql b/sql/updates/world/2012_12_23_01_creature_text.sql new file mode 100644 index 00000000000..b663c5269e9 --- /dev/null +++ b/sql/updates/world/2012_12_23_01_creature_text.sql @@ -0,0 +1,13 @@ +UPDATE `creature_text` SET `sound`=11171, `text`='Where in Bonzo''s Brass Buttons am I? And who are-- yaaghh, that''s one mother of a headache!' WHERE `entry`=20977 AND `groupid`=0; +UPDATE `creature_text` SET `sound`=11172, `text`='\"Lowly\"? I don''t care who you are, friend: no one refers to the mighty Millhouse Manastorm as \"lowly\"!' WHERE `entry`=20977 AND `groupid`=1; +UPDATE `creature_text` SET `sound`=11173, `text`='I just need to get some things ready first. You guys go ahead and get started. I need to summon up some water....' WHERE `entry`=20977 AND `groupid`=2; +UPDATE `creature_text` SET `sound`=11174, `text`='Fantastic! Next, some protective spells. Yeah, now we''re cookin''!' WHERE `entry`=20977 AND `groupid`=3; +UPDATE `creature_text` SET `sound`=11175, `text`='And of course I''ll need some mana. You guys are gonna love this; just wait....' WHERE `entry`=20977 AND `groupid`=4; +UPDATE `creature_text` SET `sound`=11176 WHERE `entry`=20977 AND `groupid`=5; +UPDATE `creature_text` SET `sound`=11177 WHERE `entry`=20977 AND `groupid`=6 AND `id`=0; +UPDATE `creature_text` SET `sound`=11178 WHERE `entry`=20977 AND `groupid`=6 AND `id`=1; +UPDATE `creature_text` SET `sound`=11179 WHERE `entry`=20977 AND `groupid`=7; +UPDATE `creature_text` SET `sound`=11180 WHERE `entry`=20977 AND `groupid`=8; +UPDATE `creature_text` SET `sound`=11181 WHERE `entry`=20977 AND `groupid`=9; +UPDATE `creature_text` SET `sound`=11182 WHERE `entry`=20977 AND `groupid`=10; +UPDATE `creature_text` SET `sound`=11183 WHERE `entry`=20977 AND `groupid`=11; From 621a249188768c9aa65db70125e90670482e0152 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 23 Dec 2012 12:42:28 +0100 Subject: [PATCH 32/33] Scripts/Icecrown Citadel: Fixed a possible crash in Blood Nova spell script Closes #7046 --- .../IcecrownCitadel/boss_deathbringer_saurfang.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp index 9ee4bcea4d9..40781169f44 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -1218,6 +1218,12 @@ class spell_deathbringer_blood_nova_targeting : public SpellScriptLoader if (targetsAtRange < minTargets) targetsAtRange = std::min(targets.size() - 1, minTargets); + if (!targetsAtRange) + { + targets.clear(); + return; + } + std::list::const_iterator itr = targets.begin(); std::advance(itr, urand(0, targetsAtRange)); target = *itr; @@ -1228,10 +1234,10 @@ class spell_deathbringer_blood_nova_targeting : public SpellScriptLoader // use the same target for first and second effect void FilterTargetsSubsequent(std::list& unitList) { + unitList.clear(); if (!target) return; - unitList.clear(); unitList.push_back(target); } From 143340b38c857b2cc50ee9f8577abf9248b6317a Mon Sep 17 00:00:00 2001 From: Subv Date: Sat, 22 Dec 2012 23:03:26 -0500 Subject: [PATCH 33/33] Core/Movement: Fixed near teleports, big thanks to @Trista who basically figured this out on his own. --- src/server/game/Entities/Player/Player.cpp | 9 --------- src/server/game/Entities/Player/Player.h | 1 - src/server/game/Entities/Unit/Unit.cpp | 15 ++++++++++++++- src/server/game/Entities/Unit/Unit.h | 1 + 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index af7692b87c5..bca94517ef4 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -2067,15 +2067,6 @@ uint8 Player::GetChatTag() const return tag; } -void Player::SendTeleportPacket(Position &oldPos) -{ - WorldPacket data2(MSG_MOVE_TELEPORT, 38); - data2.append(GetPackGUID()); - BuildMovementPacket(&data2); - Relocate(&oldPos); - SendMessageToSet(&data2, false); -} - void Player::SendTeleportAckPacket() { WorldPacket data(MSG_MOVE_TELEPORT_ACK, 41); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index cc08e9c2e18..1e8b6aedb3e 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1947,7 +1947,6 @@ class Player : public Unit, public GridObject void SendMessageToSetInRange(WorldPacket* data, float dist, bool self, bool own_team_only); void SendMessageToSet(WorldPacket* data, Player const* skipped_rcvr); - void SendTeleportPacket(Position &oldPos); void SendTeleportAckPacket(); Corpse* GetCorpse() const; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 78123d2500c..6e0d76208e5 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -17325,10 +17325,23 @@ void Unit::NearTeleportTo(float x, float y, float z, float orientation, bool cas else { UpdatePosition(x, y, z, orientation, true); - SendMovementFlagUpdate(); + Position pos; // dummy, not used for creatures. + SendTeleportPacket(pos); } } +void Unit::SendTeleportPacket(Position& oldPos) +{ + WorldPacket data2(MSG_MOVE_TELEPORT, 38); + data2.append(GetPackGUID()); + BuildMovementPacket(&data2); + + if (GetTypeId() == TYPEID_PLAYER) + Relocate(&oldPos); + + SendMessageToSet(&data2, false); +} + bool Unit::UpdatePosition(float x, float y, float z, float orientation, bool teleport) { // prevent crash when a bad coord is sent by the client diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 3053d0018d4..e46fbb99a8c 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1592,6 +1592,7 @@ class Unit : public WorldObject void SendSpellDamageImmune(Unit* target, uint32 spellId); void NearTeleportTo(float x, float y, float z, float orientation, bool casting = false); + void SendTeleportPacket(Position& oldPos); virtual bool UpdatePosition(float x, float y, float z, float ang, bool teleport = false); // returns true if unit's position really changed bool UpdatePosition(const Position &pos, bool teleport = false) { return UpdatePosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teleport); }