Page 1 of 1

Belt of Moon - Incomplete

PostPosted: Sat Feb 13, 2010 7:43 am
by bluraven
Sorry guys and gals, I'm throwing in the towel on this but I'm going to share what I've done so far in case someone else feels like picking it up where I left off and getting it fully working and doesn't want to start from scratch. I've decided I don't want to work on artifacts anymore, they bore the hell out of me and frustrate me to no end and make me want to stop coding, I'd rather do what I'm good at, the encounters. (muhahaha :twisted: )

Whats done:
Summoning the items works but it should be abstracted from BeltofMoonSummon to something basic (like SummonItem) so it can be used for other spells that summon a temporary item into the players inventory.
I created the SQL entries for the moon staff and the moon mace. On live I saw there is also a Moon Warhammer (the hammer version). All of them share the same bonuses just a different item type (and maybe different weapon speeds) as far as I can tell.

What's not done:
- I couldn't get the "Moonlight" spell to quite work.
- I couldn't get the icons to show up for the spells on the items. (though the /use and /use2 seem to activate the spells properly)
- The Moon Warhammer sql entry needs to be created.
- Some characters should get the Warhammer, others should get the Moon Mace. I think all characters get the Moon Staff.
- I couldn't get the spells to show up in the items delve info.
- Need to add an event that when the player logs in that all summoned items are removed from his inventory because currently if the server crashes or is shut down while a summoned item is in a players inventory it will not be removed from his inventory like it's supposed to. Also if the player destroys the summoned item himself before logging out, there will be red text in the console (null reference exception).

Good luck to whoever feels up to it.
Belt of Moon.zip
(6.6 KiB) Downloaded 27 times
-Blu

Re: Belt of Moon - Incomplete

PostPosted: Sat Feb 13, 2010 8:06 am
by Yemla
well, Summoning items is instant no duration

therefore it wood summon them then remove them instantly

Re: Belt of Moon - Incomplete

PostPosted: Sat Feb 13, 2010 8:25 am
by bluraven
Well with the duration on the moon summon items spell it properly does the effect animation when summoning the items, without the duration it does not play the spell effect. Also the items do not get removed when the duration of the spell ends so it doesn't really matter. Maybe try a duration of 1 second just so the animation still plays. I'm sooo done with this though, I don't want to even look at the code for it anymore, lol. The belt of moon is lucky that I'm letting it see the light of day ;)

Re: Belt of Moon - Incomplete

PostPosted: Sat Feb 13, 2010 1:19 pm
by Tolakram
Please give us more encounters! Artifacts themselves will suck the life out of anyone. :)

Re: Belt of Moon - Incomplete

PostPosted: Sat Feb 13, 2010 7:17 pm
by bluraven
That's what I will enjoy doing the most, that's what I'll do :D

Re: Belt of Moon - Incomplete

PostPosted: Wed Jan 19, 2011 7:35 am
by Phen
I have begun tinkering with this, with a couple minor changes i was able to get the items to summon and delete on full logout, but everytime I cast the spell I get this error:
Code: Select all
[02:16:10,547] Error while adding data object: DataObject: ItemTemplate, ObjectI
D{MoonMace}
MySql.Data.MySqlClient.MySqlException (0x80004005): Duplicate entry 'Moon_Mace'
for key 1
at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
at MySql.Data.MySqlClient.NativeDriver.ReadResult(UInt64& affectedRows, Int64
& lastInsertId)
at MySql.Data.MySqlClient.MySqlDataReader.GetResultSet()
at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior
)
at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
at DOL.Database.Connection.DataConnection.ExecuteNonQuery(String sqlcommand)
in C:\Dawn of Light\DOLSharp\trunk\DOLDatabase\Connection\DataConnection.cs:line
233
at DOL.Database.Handlers.MySQLObjectDatabase.AddObjectImpl(DataObject dataObj
ect) in C:\Dawn of Light\DOLSharp\trunk\DOLDatabase\Handlers\MySQLObjectDatabase
.cs:line 158
[02:16:10,577] Error while adding data object: DataObject: ItemTemplate, ObjectI
D{MoonStaff}
MySql.Data.MySqlClient.MySqlException (0x80004005): Duplicate entry 'Moon_Staff'
for key 1
at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
at MySql.Data.MySqlClient.NativeDriver.ReadResult(UInt64& affectedRows, Int64
& lastInsertId)
at MySql.Data.MySqlClient.MySqlDataReader.GetResultSet()
at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior
)
at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
at DOL.Database.Connection.DataConnection.ExecuteNonQuery(String sqlcommand)
in C:\Dawn of Light\DOLSharp\trunk\DOLDatabase\Connection\DataConnection.cs:line
233
at DOL.Database.Handlers.MySQLObjectDatabase.AddObjectImpl(DataObject dataObj
ect) in C:\Dawn of Light\DOLSharp\trunk\DOLDatabase\Handlers\MySQLObjectDatabase
.cs:line 158
CommonArtifactSpells.rar
(2.95 KiB) Downloaded 15 times

Re: Belt of Moon - Incomplete

PostPosted: Wed Jan 19, 2011 7:40 am
by Graveen
Hey i remember designing itemunique in this way too: create an itemunique and never save it, it'll disappear at logout

Re: Belt of Moon - Incomplete

PostPosted: Wed Jan 19, 2011 7:42 am
by Tolakram
It's trying to save the object, which you don't want. Take a look at GameInventoryRelic.cs ... make something similar like GameInventorySummonedItem and have it return false to persist, so it never tries to save in the db.


... or itemunique, as grav says. hmmm, should have done this with relics.

Re: Belt of Moon - Incomplete

PostPosted: Wed Jan 19, 2011 1:21 pm
by Tolakram
I'm a little more awake now.

Even though item uniques won't save GamePlayerInventory will still save them as inventory and generate an error the next time the player logs in. The nice thing about the new persist flag on GameInventoryItems is they will never save.

My suggestion is creating GameInventorySummoned
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.Reflection;
using System.Collections;
using System.Collections.Generic;
using DOL.Language;
using DOL.GS.PacketHandler;
using DOL.Database;
using DOL.GS.Spells;
using log4net;

namespace DOL.GS
{
/// <summary>
/// This class represents a summoned item in a players inventory
/// </summary>
public class GameInventorySummoned : GameInventoryItem
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

public GameInventorySummoned()
: base()
{
}

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

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

public GameInventorySummoned(InventoryItem item)
: base(item)
{
OwnerID = item.OwnerID;
ObjectId = item.ObjectId;
}

/// <summary>
/// Can this item be saved or loaded from the database?
/// </summary>
public override bool CanPersist
{
get { return false; } // summoned items can never be saved
}
}
}

Re: Belt of Moon - Incomplete

PostPosted: Thu Jan 20, 2011 4:12 pm
by Yemla
I'm a little more awake now.

Even though item uniques won't save GamePlayerInventory will still save them as inventory and generate an error the next time the player logs in. The nice thing about the new persist flag on GameInventoryItems is they will never save.

My suggestion is creating GameInventorySummoned
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.Reflection;
using System.Collections;
using System.Collections.Generic;
using DOL.Language;
using DOL.GS.PacketHandler;
using DOL.Database;
using DOL.GS.Spells;
using log4net;

namespace DOL.GS
{
/// <summary>
/// This class represents a summoned item in a players inventory
/// </summary>
public class GameInventorySummoned : GameInventoryItem
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

public GameInventorySummoned()
: base()
{
}

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

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

public GameInventorySummoned(InventoryItem item)
: base(item)
{
OwnerID = item.OwnerID;
ObjectId = item.ObjectId;
}

/// <summary>
/// Can this item be saved or loaded from the database?
/// </summary>
public override bool CanPersist
{
get { return false; } // summoned items can never be saved
}
}
}
Summoned items do save though thats the problem...on live you get 15minutes to log back on before the summon items disappear...which is basically on login, it checks for summoned items and if you have a summoned item and your login is greater than 15mins than your LastPlayed info in DoLCharacters table...the method is there just need someone whose more experienced with code involving that because i believe LastPlayed modifies ever save in-game so idk if on log-in it will modify LastPlayed

isn't there a way to just removed each summoned item on login based on lastplayed using a foreach method or some suitable method?

Re: Belt of Moon - Incomplete

PostPosted: Thu Jan 20, 2011 4:23 pm
by Tolakram
If someone wants to take the time to write a rather complex script that includes saving the summoned time with the item, go for it! A simple no-save seems like a good enough implementation for me.

Re: Belt of Moon - Incomplete

PostPosted: Thu Jan 20, 2011 11:38 pm
by Yemla
nooooo its not that complex...im not talking about creating a summoned time

im talking about on login creating a check if the character being logged in Contains a SummonItem than it would call to check if the last time that character LastPlayed was greater than 15minutes of current gametime, so to speak....basically on login checking if LastPlayed > 15min + gametime = removal of summoned item if that makes sense

Re: Belt of Moon - Incomplete

PostPosted: Fri Jan 21, 2011 6:25 pm
by elcotek
Hello :wink:

Remove from CommonArtifactSpells.cs:
Code: Select all
GameServer.Database.AddObject(template);


And Add Tolas Code on the end of Script:)