diff --git a/CreatureMethods.h b/CreatureMethods.h
index 2dc8d84..0942f82 100644
--- a/CreatureMethods.h
+++ b/CreatureMethods.h
@@ -634,6 +634,17 @@ namespace LuaCreature
* Returns a target from the [Creature]'s threat list based on the
* supplied arguments.
*
+ *
+ * enum SelectAggroTarget
+ * {
+ * SELECT_TARGET_RANDOM = 0, //Just selects a random target
+ * SELECT_TARGET_TOPAGGRO, //Selects targets from top aggro to bottom
+ * SELECT_TARGET_BOTTOMAGGRO, //Selects targets from bottom aggro to top
+ * SELECT_TARGET_NEAREST,
+ * SELECT_TARGET_FARTHEST
+ * };
+ *
+ *
* For example, if you wanted to select the third-farthest [Player]
* within 50 yards that has the [Aura] "Corrupted Blood" (ID 24328),
* you could use this function like so:
diff --git a/PlayerMethods.h b/PlayerMethods.h
index 3b8cd1b..01b5267 100644
--- a/PlayerMethods.h
+++ b/PlayerMethods.h
@@ -1972,10 +1972,23 @@ namespace LuaPlayer
{
uint32 itemId = Eluna::CHECKVAL(L, 2);
uint32 itemCount = Eluna::CHECKVAL(L, 3);
+
#ifndef TRINITY
- Eluna::Push(L, player->StoreNewItemInInventorySlot(itemId, itemCount) ? true : false);
+ Eluna::Push(L, player->StoreNewItemInInventorySlot(itemId, itemCount));
#else
- Eluna::Push(L, player->AddItem(itemId, itemCount));
+ uint32 noSpaceForCount = 0;
+ ItemPosCountVec dest;
+ InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, itemCount, &noSpaceForCount);
+ if (msg != EQUIP_ERR_OK)
+ itemCount -= noSpaceForCount;
+
+ if (itemCount == 0 || dest.empty())
+ return 1;
+
+ Item* item = player->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
+ if (item)
+ player->SendNewItem(item, itemCount, true, false);
+ Eluna::Push(L, item);
#endif
return 1;
}
diff --git a/docs/MERGING.md b/docs/MERGING.md
index 943482f..94a53fb 100644
--- a/docs/MERGING.md
+++ b/docs/MERGING.md
@@ -1,10 +1,16 @@
-#Merging
-1. You should have/get the source code of TrinityCore or MaNGOS.
-2. Open `git bash` in the source folder.
-3. Create a remote to our Eluna core repository with `git remote add Eluna `, for example for TC WoTLK it would be
-`git remote add Eluna https://github.com/ElunaLuaEngine/Eluna-TC-Wotlk.git`.
-4. Pull (fetch and merge) the eluna core repository to your TC or MaNGOS source with `git pull Eluna master`.
-5. Open `git bash` and do
-`git submodule init`
-`git submodule update`
-6. Compile the core normally (use cmake if needed)
+#Merging Eluna with MaNGOS
+Eluna is already merged with official MaNGOS by default
+
+#Merging Eluna with TC
+```
+git clone https://github.com/TrinityCore/TrinityCore.git
+cd TrinityCore
+git pull --recurse-submodules https://github.com/ElunaLuaEngine/ElunaTrinityWotlk.git
+```
+Steps explained:
+
+1. clone TrinityCore
+2. go to the source folder
+3. pull (fetch and merge) Eluna with the source.
+ * recurse-submodules will automatically pull the submodule (Eluna repo)
+ * Adding Eluna core repository as a remote is recommended