Browse Source

LUA RemoveItem now allows quantity

Image 3 years ago
parent
commit
6ec8db5b73
1 changed files with 7 additions and 1 deletions
  1. 7 1
      EQ2/source/WorldServer/LuaFunctions.cpp

+ 7 - 1
EQ2/source/WorldServer/LuaFunctions.cpp

@@ -952,13 +952,19 @@ int EQ2Emu_lua_SummonItem(lua_State* state) {
 int EQ2Emu_lua_RemoveItem(lua_State* state) {
 	Spawn* spawn = lua_interface->GetSpawn(state);
 	int32 item_id = lua_interface->GetInt32Value(state, 2);
+	int16 quantity = lua_interface->GetInt16Value(state, 3);
+
+	// default of 1 to remove
+	if (quantity == 0)
+		quantity = 1;
+
 	Client* client;
 	Item* item;
 
 	if (spawn && spawn->IsPlayer() && item_id > 0) {
 		if ((client = spawn->GetZone()->GetClientBySpawn(spawn))) {
 			if ((item = client->GetPlayer()->item_list.GetItemFromID(item_id))) {
-				if (client->RemoveItem(item, 1)) {
+				if (client->RemoveItem(item, quantity)) {
 					lua_interface->SetBooleanValue(state, true);
 					return 1;
 				}