Page 1 of 1

Item ClassType?

PostPosted: Thu Jun 03, 2010 7:47 pm
by geshi
Hey, is there a reason this is not implented? not possible or something like that? or just not worth the time?

I think it could be quite an intresting addition but just wanted to know what others thought before I started having a poke :)

Re: Item ClassType?

PostPosted: Thu Jun 03, 2010 8:22 pm
by Crazys
Hey, is there a reason this is not implented? not possible or something like that? or just not worth the time?

I think it could be quite an intresting addition but just wanted to know what others thought before I started having a poke :)

I'm not quiet sure i understand what your asking...
class restricted items do exist... unless there is something else...

Re: Item ClassType?

PostPosted: Thu Jun 03, 2010 8:46 pm
by geshi
Like there currently is for mobs, being able to create scripts for items example can have an Equip and Drop method :)

Re: Item ClassType?

PostPosted: Fri Jun 04, 2010 7:45 am
by Dunnerholl
im asking myself the same question sometimes, dont know

Re: Item ClassType?

PostPosted: Fri Jun 04, 2010 10:21 am
by Etaew
In doulbs rewrite he did have has item classes, but he passed away before it was finished. The items certainly do need an overhaul and include classes yup :-)

Re: Item ClassType?

PostPosted: Fri Jun 04, 2010 11:48 am
by Graveen
anyone interested working with reflection for this purpose ? (should be very similar to actual "gamenpc/gameplayer" class selection) (not sure playertype is working)

Re: Item ClassType?

PostPosted: Fri Jun 04, 2010 12:48 pm
by geshi
I'll try give it a go today, should I just look at how mob ClassType works and copy that for items? or is there a better way?

Re: Item ClassType?

PostPosted: Fri Jun 04, 2010 3:12 pm
by geshi
Here is my progress so far.. for some reason it does not do anything when I equip an item with DOL.GS.Items.ItemBase as the ClassType, so if anyone could give me any pointers then they would be greatly appreciated :D

New script
Code: Select all
using System;
using DOL.AI.Brain;
using DOL.Database;
using DOL.Events;
using DOL.GS.Effects;
using DOL.GS.Housing;
using DOL.GS.Keeps;
using DOL.GS.PacketHandler;
using DOL.GS.PacketHandler.Client.v168;
using DOL.GS.PlayerTitles;
using DOL.GS.PropertyCalc;
using DOL.GS.Quests;
using DOL.GS.RealmAbilities;
using DOL.GS.ServerProperties;
using DOL.GS.SkillHandler;
using DOL.GS.Spells;
using DOL.GS.Styles;
using DOL.Language;
using log4net;

namespace DOL.GS.Items
{
/// <summary>
/// This class represents an item inside the game.
/// </summary>
public class ItemBase : InventoryItem
{
public virtual bool Equip(GamePlayer player)
{
if (player == null)
{
return false;
}
player.Say("Yaaaaa i have equipped this special item of dooom");
Console.WriteLine("yeee a player equipped");
return true;
}
}
}
Added this to Itemtemplate.cs
Code: Select all

private string m_type;
public static readonly string DEFAULT_NPC_CLASSTYPE = "DOL.GS.Items.ItemBase";


/// <summary>
/// The items's ClassType
/// </summary>
[DataElement(AllowDbNull = true)]
public string ClassType
{
get
{
return m_type;
}
set
{
Dirty = true;
m_type = value;
and this into ItemTemplate()
Code: Select all
m_type = DEFAULT_NPC_CLASSTYPE;
And this into GamePlayer
Code: Select all
ItemBase itemBase = item as ItemBase;
if (itemBase != null)
{
itemBase.Equip(this);
}
in the equip code where it adds the stats from the item to the player:) please let me know as I'd love for this to be added to DOL when/if it gets finished :)

Re: Item ClassType?

PostPosted: Fri Jun 04, 2010 3:45 pm
by Dunnerholl
copy paste is evil!

Re: Item ClassType?

PostPosted: Fri Jun 04, 2010 4:37 pm
by geshi
mm? should I post as a patch so someone can hopefully take a look? :cry:

Re: Item ClassType?

PostPosted: Sat Jun 05, 2010 12:04 am
by Dunnerholl
m_type = DEFAULT_NPC_CLASSTYPE;

using DOL.AI.Brain;

...
...
...

Re: Item ClassType?

PostPosted: Sat Jun 05, 2010 9:10 am
by geshi
Yeah I copied the m_type = DEFAULT_NPC_CLASSTYPE;
bit from gameNPC and all the using :(

Re: Item ClassType?

PostPosted: Sat Jun 05, 2010 3:31 pm
by Graveen
reflection !