View Single Post
  #4  
Old 05-09-2009, 07:00 PM
demonstar55
Demi-God
 
Join Date: Apr 2008
Location: MA
Posts: 1,164
Default

Code:
Index: EQEmuServer/zone/perl_client.cpp
===================================================================
--- EQEmuServer/zone/perl_client.cpp	(revision 491)
+++ EQEmuServer/zone/perl_client.cpp	(working copy)
@@ -2656,6 +2656,34 @@
 	XSRETURN(1);
 }
 
+XS(XS_Client_GetAugmentIDAt); /* prototype to pass -Wmissing-prototypes */
+XS(XS_Client_GetAugmentIDAt)
+{
+	dXSARGS;
+	if (items != 3)
+		Perl_croak(aTHX_ "Usage: Client::GetAugmentIDAt(THIS, slot_id, augslot)");
+	{
+		Client *		THIS;
+		uint32		RETVAL;
+		dXSTARG;
+		sint16		slot_id = (sint16)SvIV(ST(1));
+		sint16		augslot = (uint8)SvIV(ST(2));
+
+		if (sv_derived_from(ST(0), "Client")) {
+			IV tmp = SvIV((SV*)SvRV(ST(0)));
+			THIS = INT2PTR(Client *,tmp);
+		}
+		else
+			Perl_croak(aTHX_ "THIS is not of type Client");
+		if(THIS == NULL)
+			Perl_croak(aTHX_ "THIS is NULL, avoiding crash.");
+
+		RETVAL = THIS->GetAugmentIDAt(slot_id, augslot);
+		XSprePUSH; PUSHu((UV)RETVAL);
+	}
+	XSRETURN(1);
+}
+
 XS(XS_Client_DeleteItemInInventory); /* prototype to pass -Wmissing-prototypes */
 XS(XS_Client_DeleteItemInInventory)
 {
@@ -3695,6 +3723,7 @@
 		newXSproto(strcpy(buf, "SetMaterial"), XS_Client_SetMaterial, file, "$$$");
 		newXSproto(strcpy(buf, "Undye"), XS_Client_Undye, file, "$");
 		newXSproto(strcpy(buf, "GetItemIDAt"), XS_Client_GetItemIDAt, file, "$$");
+		newXSproto(strcpy(buf, "GetAugmentIDAt"), XS_Client_GetAugmentIDAt, file, "$$$");
 		newXSproto(strcpy(buf, "DeleteItemInInventory"), XS_Client_DeleteItemInInventory, file, "$$;$$");
 		newXSproto(strcpy(buf, "SummonItem"), XS_Client_SummonItem, file, "$$;$");
 		newXSproto(strcpy(buf, "SetStats"), XS_Client_SetStats, file, "$$$");
Code:
Index: EQEmuServer/zone/inventory.cpp
===================================================================
--- EQEmuServer/zone/inventory.cpp	(revision 491)
+++ EQEmuServer/zone/inventory.cpp	(working copy)
@@ -218,6 +218,18 @@
 	return INVALID_ID;
 }
 
+// Returns an augment's ID that's in an item (returns INVALID_ID if not found)
+// Pass in the slot ID of the item and which augslot you want to check (0-4)
+uint32 Client::GetAugmentIDAt(sint16 slot_id, uint8 augslot) {
+	const ItemInst* inst = m_inv[slot_id];
+	if (inst)
+		if (inst->GetAugmentItemID(augslot))
+			return inst->GetAugmentItemID(augslot);
+
+	// None found
+	return INVALID_ID;
+}
+
 // Remove item from inventory
 void Client::DeleteItemInInventory(sint16 slot_id, sint8 quantity, bool client_update) {
 	#if (EQDEBUG >= 5)
Code:
Index: EQEmuServer/zone/client.h
===================================================================
--- EQEmuServer/zone/client.h	(revision 491)
+++ EQEmuServer/zone/client.h	(working copy)
@@ -616,6 +616,7 @@
 	void	SetMaterial(sint16 slot_id, uint32 item_id);
 	void	Undye();
 	uint32	GetItemIDAt(sint16 slot_id);
+	uint32	GetAugmentIDAt(sint16 slot_id, uint8 augslot);
 	bool	PutItemInInventory(sint16 slot_id, const ItemInst& inst, bool client_update = false);
 	bool	PushItemOnCursor(const ItemInst& inst, bool client_update = false);
 	void	DeleteItemInInventory(sint16 slot_id, sint8 quantity = 0, bool client_update = false);
Reply With Quote