View Single Post
  #7  
Old 07-14-2012, 09:52 AM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

Can anyone give me pointers on this? I want to send a 'Fake Item' to the client at a specific slot number, but the best I've suceeded in doing is
crashing zone...

(I've already updated command.h and the command_init portions.)

Code:
void command_zitemtest(Client *c, const Seperator *sep)
{
	if (!sep->argnum==2)
		c->Message(0, "Usage: #zitemtest [slot id] [item id]");
	else if (!sep->IsNumber(1) && !sep->IsNumber(2))
			c->Message(0, "Usage: #zitemtest [slot id] [item id]");
	else {
		sint16 slotid = atoi(sep->arg[1]);
		int32 itemid = atoi(sep->arg[2]);
		
		ItemInst* FakeItem;

		FakeItem->SetItem(database.GetItem(itemid));
		
		if (!FakeItem) {
			c->Message(0, "Error: Item [%u] is not a valid item number.", itemid);
			return;
		}
				
		if (database.GetItemStatus(itemid) > c->Admin()) {
			c->Message(13, "Error: Insufficient status to summon this item.");
			return;
		}

		FakeItem->SetCharges(1);
		c->SendItemPacket(slotid, FakeItem, ItemPacketTrade);
		}
}
I know it's my lack of understanding of item and packet structures, but I can't seem to find a similar method to follow.

I just basically want to send the client an item packet for the specified slot, without the server being updated, so I can watch client behavior.


Thanks!
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote