Page 1 of 3

Mythirians

PostPosted: Sat Feb 11, 2012 1:13 am
by stephenxpimentel
IIRC Mythirians are odd currently in DOL, where the item level = champion level required to equip it, but i can't seem to find any code referencing mythirians at all. If this is still the case, then could someone please direct to the code so i can fix it to rely on "LevelRequirement", and i also would like to create an ItemClass for it.

this is because the first time u equip a mythirian it binds to the player, but before that it is trade-able, and shows a spell effect.

Any thoughts / ideas please let me know. =]

Re: Mythirians

PostPosted: Sat Feb 11, 2012 1:34 am
by stephenxpimentel
something like this should be acceptible, its not tested atm, i will get around to that on like monday, but seems ok :)
Code: Select all
/*
* DAWN OF LIGHT - The first free open source DAoC server emulator
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DOL.Database;
using DOL.GS.PacketHandler;
using DOL.GS.Spells;

namespace DOL.GS.Items
{
public class GameMythirian : GameInventoryItem
{
public const ushort m_equipEffect = 8008;

private GameMythirian() { }

public GameMythirian(ItemTemplate template)
: base(template)
{
}

public GameMythirian(ItemUnique template)
: base(template)
{
}


public GameMythirian(InventoryItem item)
: base(item)
{
}

public override void Delve(List<string> delve, GamePlayer player)
{
base.Delve(delve, player);
}

public override bool CanEquip(GamePlayer player)
{
if (player.ChampionLevel >= LevelRequirement)
return base.CanEquip(player);

return false;
}

public override void OnEquipped(GamePlayer player)
{
base.OnEquipped(player);

IsTradable = false;

foreach (GamePlayer vPlayer in player.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
{
vPlayer.Out.SendSpellEffectAnimation(player, player, m_equipEffect, 0, false, 1);
}
}

}
}

Re: Mythirians

PostPosted: Sat Feb 11, 2012 1:59 am
by geshi
Hmm I think they made it so mythirians don't bind to players any more.. a few months ago? not 100% sure but it was around the time they added all those BG BP quests I think..

1.103 • The Bind on Equip item functionality has been removed from the game. All items that were once flagged as Bind on Equip, and those that have been bound to players are now tradable.

Effecte dmythirians too !

Re: Mythirians

PostPosted: Sat Feb 11, 2012 2:33 am
by stephenxpimentel
oh! thats kinda lame, i liked that they added something like that :-P i guess i needa catch up on all their patches! lol

Re: Mythirians

PostPosted: Sat Feb 11, 2012 4:25 am
by mattress
Having the CL requirement is more live like, if that's what your going for, digging around I'm thinking that a check could be added to CheckAbilityToUseItem in AbstractServerRules and an object type might need to be added to eObjectType in GlobalConstants, only the mythical slot is defined, not the items themselves.

The CL xp to level list is in GamePlayer under CLXPLevel for reference. And maybe the text CL6, CL4, CL10, etc could be the beginning of each itemtemplate, and that could be what the script uses as a basis to begin the check in first place.

Re: Mythirians

PostPosted: Sat Feb 11, 2012 12:35 pm
by Graveen
Anyhow, please keep in the core the Bind On Equip feature, it is very usefull :)

Eventually, simply use a SP to rule this behaviour

Re: Mythirians

PostPosted: Sat Feb 11, 2012 1:24 pm
by geshi
Need to find a way to do the mythirian bonuses as well..

I think only the stat cap ones overcap the overcap so you can have 108/108 dex with a +7 dex cap mythirian I think.

Re: Mythirians

PostPosted: Sat Feb 11, 2012 9:43 pm
by stephenxpimentel
Need to find a way to do the mythirian bonuses as well..

I think only the stat cap ones overcap the overcap so you can have 108/108 dex with a +7 dex cap mythirian I think.
from what i remember, the cap cap bonus increased the stat aswell as the cap of the stat. so on live +7 strength cap cap, would effectively give u 7 str and increase the cap, so its a double stat.

Re: Mythirians

PostPosted: Sat Feb 11, 2012 10:33 pm
by stephenxpimentel
wow.. ok so i made a base class for BindOnEquip items, and a class derived from it, GameMythirian.. well.. when i try to equip the item if it doesnt meet requirements (CL Level high enough), the server immediately crashes, sending a stack overflow exception. not sure why this would happen.

Note: the item works flawlessly IF you meet the requirements, so apparently returning false to CanEquip is bad, but not sure what to do about it.

If anyone (@Tola :-P) has any ideas plz let me know ;)

GameBindOnEquipItem:
Code: Select all
/*
* DAWN OF LIGHT - The first free open source DAoC server emulator
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DOL.Database;
using DOL.GS.PacketHandler;
using DOL.GS.Spells;

namespace DOL.GS.Items
{
public class GameBindOnEquipItem : GameInventoryItem
{
private GameBindOnEquipItem() { }

public GameBindOnEquipItem(ItemTemplate template)
: base(template)
{
}

public GameBindOnEquipItem(ItemUnique template)
: base(template)
{
}


public GameBindOnEquipItem(InventoryItem item)
: base(item)
{
}

public override void Delve(List<string> delve, GamePlayer player)
{
base.Delve(delve, player);
}

public override void OnEquipped(GamePlayer player)
{
base.OnEquipped(player);
IsTradable = false;
}
}
}
GameMythirian:
Code: Select all
/*
* DAWN OF LIGHT - The first free open source DAoC server emulator
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DOL.Database;
using DOL.GS.PacketHandler;
using DOL.GS.Spells;

namespace DOL.GS.Items
{
public class GameMythirian : GameBindOnEquipItem
{
public const ushort m_equipEffect = 8008;

public GameMythirian(ItemTemplate template)
: base(template)
{
}

public GameMythirian(ItemUnique template)
: base(template)
{
}


public GameMythirian(InventoryItem item)
: base(item)
{
}

public override void Delve(List<string> delve, GamePlayer player)
{
//add the delve info.
delve.Add("-Requires: Champion Level " + LevelRequirement);
delve.Add(" ");
base.Delve(delve, player);
}

public override bool CanEquip(GamePlayer player)
{
if (player.ChampionLevel >= LevelRequirement)
return true;

return false;
}

public override void OnEquipped(GamePlayer player)
{
base.OnEquipped(player);

//we don't show a visible effect if the item is already bound.
if (!IsTradable)
return;

foreach (GamePlayer vPlayer in player.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
{
vPlayer.Out.SendSpellEffectAnimation(player, player, m_equipEffect, 0, false, 1);
}
}

}
}

Re: Mythirians

PostPosted: Sun Feb 12, 2012 4:26 am
by Tolakram
Hmmm, first glance looks ok. Maybe an issue sending the effect during equip? Either that or something so obvious I can't see it.

Also, IsTradable logic looks bunk, though not a stack overflow error.

Re: Mythirians

PostPosted: Sun Feb 12, 2012 4:41 am
by Tolakram
I would create a new table for binding. PlayerBoundItem or something like that. Not compiled, may need some work.
Code: Select all
/*
* DAWN OF LIGHT - The first free open source DAoC server emulator
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
using System;
using DOL.Database.Attributes;

namespace DOL.Database
{
/// <summary>
/// Items bound to a character
/// </summary>
[DataTable(TableName = "CharacterXBoundItem")]
public class CharacterXBoundItem : DataObject
{
private int m_id;
private string m_characterID;
private string m_inventoryID

public CharacterXBoundItem()
{
}

/// <summary>
/// Create a new entry
/// </summary>
/// <param name="characterID"></param>
/// <param name="inventoryIDID"></param>
public CharacterXBoundItem(string characterID, string inventoryID)
{
m_characterID = characterID;
m_inventoryID = inventoryID;
}

[PrimaryKey(AutoIncrement=true)]
public int ID
{
get { return m_id; }
set { m_id = value; }
}

/// <summary>
/// DOLCharacters_ID of this player
/// </summary>
[DataElement(Varchar = 100, AllowDbNull = false, IndexColumns = "InventoryID")]
public string Character_ID
{
get { return m_characterID; }
set { m_characterID = value; Dirty = true; }
}

/// <summary>
/// Inventory_ID of the item
/// </summary>
[DataElement(Varchar = 200, AllowDbNull = false")]
public string Inventory_ID
{
get { return m_inventoryID; }
set { m_inventoryID = value; Dirty = true; }
}
}
}
Not really sure if this is needed or not.

Re: Mythirians

PostPosted: Sun Feb 12, 2012 7:54 pm
by stephenxpimentel
OnEquip works fine, its somewhere in CanEquip, i looked into the code for that, and its not popping out at me, because every class should be able to wear a mythi, but its wierd, i can't even find ANY code relating to mythirians, aside from the item slot. I will try to debug this later tonight and figure it out.

As for bound items, i don't think its needed, the IsTradable works fine, if u want a table i'd be glad to make 1, but don't think its needed :)

Re: Mythirians

PostPosted: Sun Feb 12, 2012 8:56 pm
by Graveen
A non-bind item is tradable, while a bound one is not.

This is a very powerful toy to regulate rare and powerful weapons, that you can sell at once, but not resell of you use them (=when you get a better one). This is also the ultimate auto-regulation of thousands of unique items, that should live or die (note to myself: discuss this for Storm itemunique ! :mrgreen:), and by extension, the sanity of inventory / itemunique table :D

I personally only would add a bool entry in ItemTemplate.BindOnEquip, and let the Inventory table keep track of the state: Inventory.BindOnEquip would be updated to the current status (Bound or not). OnEquip() 'd change this state, while the IsAllowedToTrade() 'd take care of BindOnEquip state.

We could also extend this to have, instead of BindOnEquip, EquipEvent, that could reference:
- Cast on equip (ie 1 for spell #1, 2 for spell #2
- Unremovable items (cursed)
- Binded items
- etc...

Re: Mythirians

PostPosted: Sun Feb 12, 2012 9:40 pm
by Ephemeral
wow.. ok so i made a base class for BindOnEquip items, and a class derived from it, GameMythirian.. well.. when i try to equip the item if it doesnt meet requirements (CL Level high enough), the server immediately crashes, sending a stack overflow exception. not sure why this would happen.

Note: the item works flawlessly IF you meet the requirements, so apparently returning false to CanEquip is bad, but not sure what to do about it.

If anyone (@Tola :-P) has any ideas plz let me know ;)

GameBindOnEquipItem:
Code: Select all
/*
* DAWN OF LIGHT - The first free open source DAoC server emulator
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DOL.Database;
using DOL.GS.PacketHandler;
using DOL.GS.Spells;

namespace DOL.GS.Items
{
public class GameBindOnEquipItem : GameInventoryItem
{
private GameBindOnEquipItem() { }

public GameBindOnEquipItem(ItemTemplate template)
: base(template)
{
}

public GameBindOnEquipItem(ItemUnique template)
: base(template)
{
}


public GameBindOnEquipItem(InventoryItem item)
: base(item)
{
}

public override void Delve(List<string> delve, GamePlayer player)
{
base.Delve(delve, player);
}

public override void OnEquipped(GamePlayer player)
{
base.OnEquipped(player);
IsTradable = false;
}
}
}
GameMythirian:
Code: Select all
/*
* DAWN OF LIGHT - The first free open source DAoC server emulator
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DOL.Database;
using DOL.GS.PacketHandler;
using DOL.GS.Spells;

namespace DOL.GS.Items
{
public class GameMythirian : GameBindOnEquipItem
{
public const ushort m_equipEffect = 8008;

public GameMythirian(ItemTemplate template)
: base(template)
{
}

public GameMythirian(ItemUnique template)
: base(template)
{
}


public GameMythirian(InventoryItem item)
: base(item)
{
}

public override void Delve(List<string> delve, GamePlayer player)
{
//add the delve info.
delve.Add("-Requires: Champion Level " + LevelRequirement);
delve.Add(" ");
base.Delve(delve, player);
}

public override bool CanEquip(GamePlayer player)
{
if (player.ChampionLevel >= LevelRequirement)
return true;

return false;
}

public override void OnEquipped(GamePlayer player)
{
base.OnEquipped(player);

//we don't show a visible effect if the item is already bound.
if (!IsTradable)
return;

foreach (GamePlayer vPlayer in player.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
{
vPlayer.Out.SendSpellEffectAnimation(player, player, m_equipEffect, 0, false, 1);
}
}

}
}
Thought I should point out that the effect will never actually be sent because you're calling the base's onequipped first which sets IsTradeable to false, and then returning if it is immediately after that.

Re: Mythirians

PostPosted: Mon Feb 13, 2012 12:09 am
by stephenxpimentel
Code: Select all
public override void OnEquipped(GamePlayer player)
{
base.OnEquipped(player);

//we don't show a visible effect if the item is already bound.
if (!IsTradable)
return;

foreach (GamePlayer vPlayer in player.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
{
vPlayer.Out.SendSpellEffectAnimation(player, player, m_equipEffect, 0, false, 1);
}
}

}
}
Thought I should point out that the effect will never actually be sent because you're calling the base's onequipped first which sets IsTradeable to false, and then returning if it is immediately after that.
If you look my friend, it doesn't return base, it simply calls the base functions :) thus not returning.