using System;
using System.Collections;
using System.Net;
using System.Reflection;
using DOL.Database;
using DOL.GS.PacketHandler;
using log4net;
namespace DOL.GS.Scripts
{
public class ItemGeneratorParams
{
public string Name;
public int ModelID;
public int DPS_AF;
public int SPD_ABS;
}
public class ItemGenerator
{
/// <summary>
/// Holds the item params for each client
/// </summary>
Hashtable itemTable = new Hashtable();
public override void WhisperReceive(GameClient client, string message)
{
switch (message)
{
case "magic item":
// Initialize new item gen param object.
ItemGeneratorParams itemParams = new ItemGeneratorParams();
// Store the item params object, using the client object as the key
itemTable.Add(client, itemParams);
break;
case "some weapon":
// Retrieve our item params, using the client object as the key
ItemGeneratorParams ourParams = itemTable[client] as ItemGeneratorParams;
// Change the params around to make a big sword, or whatever.
ourParams.DPS_AF = 165;
ourParams.Name = "Big Sword";
ourParams.SPD_ABS = 52;
// Store the changed object back in the hashtable, using the client object as the key
itemTable[client] = ourParams;
break;
case "purchase item":
// Retrieve our item params, using the client object as the key
ItemGeneratorParams ourParams = itemTable[client] as ItemGeneratorParams;
// Use the params to make your item.
InventoryItem item = new InventoryItem();
item.DPS_AF = ourParams.DPS_AF;
// Do other parameters, then hand the item to the player
// Remove the item params as now the item has been made and we restart the process
itemTable.Remove(client);
break;
}
}
}
}