Item ClassType?

A place to submit .patch fixes for the DOL SVN

Moderator: Developer Team

Item ClassType?

Postby geshi » Thu Jun 03, 2010 7:47 pm

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 :)
geshi
Contributor
 
Posts: 1826
Joined: Tue Oct 21, 2008 9:16 pm

Re: Item ClassType?

Postby Crazys » Thu Jun 03, 2010 8:22 pm

geshi wrote: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...
Crazys
Contributor
 
Posts: 346
Joined: Tue Nov 07, 2006 10:18 pm

Re: Item ClassType?

Postby geshi » Thu Jun 03, 2010 8:46 pm

Like there currently is for mobs, being able to create scripts for items example can have an Equip and Drop method :)
geshi
Contributor
 
Posts: 1826
Joined: Tue Oct 21, 2008 9:16 pm

Re: Item ClassType?

Postby Dunnerholl » Fri Jun 04, 2010 7:45 am

im asking myself the same question sometimes, dont know
Dunnerholl
Developer
 
Posts: 1229
Joined: Mon Sep 08, 2008 8:39 pm

Re: Item ClassType?

Postby Etaew » Fri Jun 04, 2010 10:21 am

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 :-)
Retired DOL Enthusiast | Blog
User avatar
Etaew
Inactive Staff Member
 
Posts: 7602
Joined: Mon Oct 13, 2003 5:04 pm
Website: http://etaew.net
Location: England

Re: Item ClassType?

Postby Graveen » Fri Jun 04, 2010 11:48 am

anyone interested working with reflection for this purpose ? (should be very similar to actual "gamenpc/gameplayer" class selection) (not sure playertype is working)
Image
* pm me to contribute in Dawn of Light: code, database *
User avatar
Graveen
Project Leader
 
Posts: 12660
Joined: Fri Oct 19, 2007 9:22 pm
Location: France

Re: Item ClassType?

Postby geshi » Fri Jun 04, 2010 12:48 pm

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?
geshi
Contributor
 
Posts: 1826
Joined: Tue Oct 21, 2008 9:16 pm

Re: Item ClassType?

Postby geshi » Fri Jun 04, 2010 3:12 pm

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 :)
geshi
Contributor
 
Posts: 1826
Joined: Tue Oct 21, 2008 9:16 pm

Re: Item ClassType?

Postby Dunnerholl » Fri Jun 04, 2010 3:45 pm

copy paste is evil!
Dunnerholl
Developer
 
Posts: 1229
Joined: Mon Sep 08, 2008 8:39 pm

Re: Item ClassType?

Postby geshi » Fri Jun 04, 2010 4:37 pm

mm? should I post as a patch so someone can hopefully take a look? :cry:
geshi
Contributor
 
Posts: 1826
Joined: Tue Oct 21, 2008 9:16 pm

Re: Item ClassType?

Postby Dunnerholl » Sat Jun 05, 2010 12:04 am

m_type = DEFAULT_NPC_CLASSTYPE;

using DOL.AI.Brain;

...
...
...
Dunnerholl
Developer
 
Posts: 1229
Joined: Mon Sep 08, 2008 8:39 pm

Re: Item ClassType?

Postby geshi » Sat Jun 05, 2010 9:10 am

Yeah I copied the m_type = DEFAULT_NPC_CLASSTYPE;
bit from gameNPC and all the using :(
geshi
Contributor
 
Posts: 1826
Joined: Tue Oct 21, 2008 9:16 pm

Re: Item ClassType?

Postby Graveen » Sat Jun 05, 2010 3:31 pm

reflection !
Image
* pm me to contribute in Dawn of Light: code, database *
User avatar
Graveen
Project Leader
 
Posts: 12660
Joined: Fri Oct 19, 2007 9:22 pm
Location: France


Return to “%s” DOL Code Contributions

Who is online

Users browsing this forum: No registered users and 1 guest