Odd LootGenerator behaviour for Glass and Scales

Discussions on various DOL development features

Moderator: Support Team

Odd LootGenerator behaviour for Glass and Scales

Postby tegstewart » Tue Mar 14, 2017 10:34 pm

I'm seeing some really odd behaviour when adding SI dragon dungeons and Atlantis areas to the LootGenerator table using DOL.GS.LootGeneratorDragonscales and DOL.GS.LootGeneratorAtlanteanGlass respectively.

The first time you get either item, it fails to display them and shoves a bunch of errors in the server log. If you log out and back in again, it will show a single stack of the items and work fine from that point forward. I suspect what is happening is that it's trying to add six stacks of 10 into inventory at once rather than adding the first stack and increasing the count on it for the remaining five.

One mob dropping multiple stacks at once rather than one stack with a higher count is probably the issue here. Changing the ExclusivePriority from 0 to 1 didn't appear to change the behaviour at all. The mobs I'm testing on don't have either glass or scales in their loottemplate entries. They have dropcount set to 1 in mobxloottemplate.

Here is one of the clusters of errors, with the columns in the queries cut out for length. I'm seeing these in batches of five in under a second, so the first stack added doesn't seem to be leaving them.
Code: Select all
2017-03-14 15:25:33,043 - [RegionTime2] - ERROR - DOL.Database.Handlers.MySQLObjectDatabase - ExecuteNonQueryImpl: Constraint Violation for raw query "INSERT INTO `ItemTemplate` (...) VALUES(...)" MySql.Data.MySqlClient.MySqlException (0x80004005): Duplicate entry 'atlanteanglass' for key 'PRIMARY' at MySql.Data.MySqlClient.MySqlStream.ReadPacket() at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId) at MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int64& insertedId) at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force) at MySql.Data.MySqlClient.MySqlDataReader.NextResult() at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery() at DOL.Database.Handlers.MySQLObjectDatabase.ExecuteNonQueryImpl(String SQLCommand, IEnumerable`1 parameters) at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo) at System.Environment.get_StackTrace() at DOL.Database.Handlers.MySQLObjectDatabase.ExecuteNonQueryImpl(String SQLCommand, IEnumerable`1 parameters) at DOL.Database.SQLObjectDatabase.AddObjectImpl(DataTableHandler tableHandler, IEnumerable`1 dataObjects) at DOL.Database.ObjectDatabase.SaveObjectRelations(DataTableHandler tableHandler, IEnumerable`1 dataObjects) at DOL.Database.ObjectDatabase.AddObject(IEnumerable`1 dataObjects) at DOL.Database.ObjectDatabase.AddObject(DataObject dataObject) at DOL.GS.GamePlayerInventory.AddItem(eInventorySlot slot, InventoryItem item, Boolean addObject) at DOL.GS.GamePlayerInventory.AddItem(eInventorySlot slot, InventoryItem item) at DOL.GS.GameLivingInventory.AddTemplate(InventoryItem sourceItem, Int32 count, eInventorySlot minSlot, eInventorySlot maxSlot) at DOL.GS.GamePlayer.PickupObject(GameObject floorObject, Boolean checkRange) at DOL.GS.GameNPC.DropLoot(GameObject killer) at DOL.GS.GameNPC.Die(GameObject killer) at DOL.GS.GameLiving.TakeDamage(GameObject source, eDamageType damageType, Int32 damageAmount, Int32 criticalAmount) at DOL.GS.GameObject.TakeDamage(AttackData ad) at DOL.GS.GameLiving.DealDamage(AttackData ad) at DOL.GS.Spells.SpellHandler.DamageTarget(AttackData ad, Boolean showEffectAnimation, Int32 attackResult) at DOL.GS.Spells.SpellHandler.DamageTarget(AttackData ad, Boolean showEffectAnimation) at DOL.GS.Spells.DirectDamageSpellHandler.DealDamage(GameLiving target, Double effectiveness) at DOL.GS.Spells.DirectDamageSpellHandler.OnDirectEffect(GameLiving target, Double effectiveness) at DOL.GS.Spells.SpellHandler.ApplyEffectOnTarget(GameLiving target, Double effectiveness) at DOL.GS.Spells.SpellHandler.StartSpell(GameLiving target) at DOL.GS.Spells.SpellHandler.FinishSpellCast(GameLiving target) at DOL.GS.Spells.DirectDamageSpellHandler.FinishSpellCast(GameLiving target) at DOL.GS.Spells.SpellHandler.DelayedCastTimer.OnTick() at DOL.GS.GameTimer.TimeManager.TimeThread() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() 2017-03-14 15:25:33,046 - [RegionTime2] - ERROR - DOL.Database.ObjectDatabase - Error adding data object into ItemTemplate Object = DataObject: ItemTemplate, ObjectId{f24b8562-fe9b-4193-8bc5-368a7200eb1f} Query = INSERT INTO `ItemTemplate` (...) VALUES(...) 2017-03-14 15:25:33,047 - [RegionTime2] - ERROR - DOL.Database.ObjectDatabase - SaveObjectRelations: Adding Relation (DOL.Database.ItemTemplate) of DataObject (DataObject: Inventory, ObjectId{fb2f7571-c09d-4bb7-9cfe-199bfbab84cb}, Name{Atlantean Glass}, OwnerID{fad99f32-3e4a-4a13-997b-aa369dc5ea7d}, SlotPosition{46}, Count{10}) failed for Object (DataObject: ItemTemplate, ObjectId{f24b8562-fe9b-4193-8bc5-368a7200eb1f}) 2017-03-14 15:25:33,048 - [RegionTime2] - ERROR - DOL.GS.GamePlayerInventory - Error adding item atlanteanglass:Atlantean Glass for player Vampiir into the database during AddItem!
Thoughts?
tegstewart
Developer
 
Posts: 102
Joined: Sun Dec 13, 2009 11:46 pm

Re: Odd LootGenerator behaviour for Glass and Scales

Postby PlanarChaosRvrtwo » Wed Mar 15, 2017 1:50 am

I think the issue is more simpler couse had same issues before as i edited the dragonscale itemtemplate i changed the stack to 20 as default and incrased max stack size to 2k then it worked
DOL dint only gaved me the data to start my server,
it also gaved me 16 amazing years with nice peeps,
and now its on me to return the favor.
User avatar
PlanarChaosRvrtwo
Database Team
 
Posts: 517
Joined: Thu Jul 07, 2016 6:21 am

Re: Odd LootGenerator behaviour for Glass and Scales

Postby tegstewart » Wed Mar 15, 2017 4:07 am

Max size is 2k for both scales and glass. I tried setting pack size to 10 and 20 without any difference. Is there somewhere else I should be looking for the default?
tegstewart
Developer
 
Posts: 102
Joined: Sun Dec 13, 2009 11:46 pm

Re: Odd LootGenerator behaviour for Glass and Scales

Postby PlanarChaosRvrtwo » Wed Mar 15, 2017 5:11 am

hmm no clue then maybe you should check the lootgen script
DOL dint only gaved me the data to start my server,
it also gaved me 16 amazing years with nice peeps,
and now its on me to return the favor.
User avatar
PlanarChaosRvrtwo
Database Team
 
Posts: 517
Joined: Thu Jul 07, 2016 6:21 am

Re: Odd LootGenerator behaviour for Glass and Scales

Postby Leodagan » Wed Mar 15, 2017 8:50 am

ItemTemplate table should NEVER be modified during runtime...

I don't know what you tried but there is multiple insert in ItemTemplate table with the same Key (id_nb) which is typically the "custom currency" you're trying to loot !

Even if you change stack size or other value dynamically they shouldn't be saved to ItemTemplate table because this would affect all further loot stack...

By instinct I would say you're trying to handle ItemTemplate DataObject when you should be handling Inventory DataObject :P
User avatar
Leodagan
Developer
 
Posts: 1350
Joined: Tue May 01, 2012 9:30 am
Website: https://daoc.freyad.net
Location: Lyon

Re: Odd LootGenerator behaviour for Glass and Scales

Postby tegstewart » Wed Mar 15, 2017 3:28 pm

I haven't changed the code at all, just added the entries into the LootGenerator table. I'm using Autobuild 1.9.7.3598.
tegstewart
Developer
 
Posts: 102
Joined: Sun Dec 13, 2009 11:46 pm

Re: Odd LootGenerator behaviour for Glass and Scales

Postby Leodagan » Thu Mar 16, 2017 9:51 pm

My bad, I understood that you tried to alter the loot generator stacks in code :s

So it looks like there is some trouble around Database "SaveRelation" Method, probably my recent upgrade to DB driver code...

I'll have to investigate it further, probably an auto-save for relations of Inventory Object that shouldn't be triggering in there !
User avatar
Leodagan
Developer
 
Posts: 1350
Joined: Tue May 01, 2012 9:30 am
Website: https://daoc.freyad.net
Location: Lyon

Re: Odd LootGenerator behaviour for Glass and Scales

Postby tegstewart » Thu Mar 16, 2017 10:09 pm

No worries.

It doesn't seem to be triggering for faction ids in the loot generator table. I'll do some more testing with that and let you know what I find. No point diving into the code over one issue when there may be a second issue in the same place.
tegstewart
Developer
 
Posts: 102
Joined: Sun Dec 13, 2009 11:46 pm

Re: Odd LootGenerator behaviour for Glass and Scales

Postby tegstewart » Fri Mar 17, 2017 3:05 am

I did some more testing tonight, and it does drop scales using MobName, MobGuild, and RegionID properly. FactionID doesn't appear to work.

I initially changed mob.GuildName rather than npctemplate.Guild, which obviously didn't work, but it got me thinking. It looks like the loot generators put the loot lists together inside one large try/catch. If something about the database driver code update is throwing an unhandled exception when checking the factionid, the loot generator would catch it and then return an empty list without logging the exception.

This is a shot in the dark, but... The /mob info command doesn't display faction ids, so I don't have a way to check them live. Is it possible that the mob object is trying to pull factionid from the npctemplate table instead of the mob table? That would throw an exception, but if it's caught and not logged it would give the all mobs a null faction id. That would definitely stop any faction based entries in lootgenerator from working, and it's a minor enough detail that I could see it not being noticed.


As a hacky temporary solution, I can just give all the mobs I want to drop scales GuildName "Scales" and slap that in lootgenerator. :-p
tegstewart
Developer
 
Posts: 102
Joined: Sun Dec 13, 2009 11:46 pm

Re: Odd LootGenerator behaviour for Glass and Scales

Postby Leodagan » Fri Mar 17, 2017 8:08 am

I remember when I needed to configure scale loot generator for all "Epic Zone Mobs" I made a special query that list all unique mob name in a given "ZoneId" (you need to make some specific position computation to match mob in a Zone, there is no field for that...) then using an aggregation method making a single string with all names separated by comma :)

It was a huge list but it was easy to update by running the same query again manually from time to time ;)
User avatar
Leodagan
Developer
 
Posts: 1350
Joined: Tue May 01, 2012 9:30 am
Website: https://daoc.freyad.net
Location: Lyon

Re: Odd LootGenerator behaviour for Glass and Scales

Postby PlanarChaosRvrtwo » Fri Mar 17, 2017 9:23 am

Wouldnt it be easier to update that script so you can just enter regionids n such also?
DOL dint only gaved me the data to start my server,
it also gaved me 16 amazing years with nice peeps,
and now its on me to return the favor.
User avatar
PlanarChaosRvrtwo
Database Team
 
Posts: 517
Joined: Thu Jul 07, 2016 6:21 am

Re: Odd LootGenerator behaviour for Glass and Scales

Postby Leodagan » Fri Mar 17, 2017 10:21 am

Please don't mess up between notions of Zone and Region :P

Regions are the entire area were a player can move without having any "loading screen"

Zones are purely "abstract" area that are not used in anyway server-side to match the position of an object, Zone is a notion that is used mostly by the client to load graphic assets by subsets, the server doesn't care if an object is really in an existing zone, as long as it is in Region bounds the object can have a position... (but a lot of rules code will fail with exceptions if the object have a null Zone...)

So there is actually a Mapping of LootGenerator to a given RegionId, this allows to easily map Loot Generator to Dungeon (because Dungeon can only be a single zone, the RegionId is enough to match the whole area) but if you map Loot Generator to "open" Region like Classic / Atlantis / Shrouded Isles, every mob in the open will use this generator...

We could add a ZoneId Mapping to the LootGenerator Table indeed, but it's not really smooth for every area, ok for Epic Zones they are clearly delimited, there is a wide NPC gap between Sheeroe Hill and Bog of Cullen and a single corridor way to enter the Zone, but if you want to map a Loot Generator to other Area it could be weird, imagine you add a "Lough Derg Mud" Generator to the Entire Lough Derg ZoneId, as soon as you cross the Zone Limit only some units away the Generator won't trigger anymore, and if you have a "Lough Derg Mob" Spot on the edge of two Zones some could loot, some other won't, really not smooth because it doesn't match a "Mob Spot" but the exact Zone "Square" like on Client Map ;)

You could also run in the opposite problem, you have some "themed Mob" from the next Zone (Imagine most Mob specific to Cliff of Moher) that are on the Edge of the previous Zone (Connacht...) and could receive the Loot Generator specific to the neighbor Zone when they are not in anyway related to the neighbor Zone "Lore" !

So I don't like to rely on Zone to try to match Spots, you will find very few relations to "Zone" in Database Tables fields...

For me the best way to improve Loot Generator Mapping would be to make it compatible with regular expressions (Regex), DAoC "Lore" revolve around NPC Name, for Mob they are mostly unique for each type of encountered creature, for NPC it's also mostly unique to each encountered character, even slight variation of Mobs (like Young, Cub, Pup Mob versus Old, Wild, Adult Mob variant...) have their name changed.

With Regex you could match any mob with common "name particle", you could match all skeleton to drop bones, all wolf to drop fur, and also some "Faction Name", like you can match Siabra or Glimmer or Azure easily this way :)

So I'll probably research this area instead of building an ugly Zone Matching that would only fit a pretty few use case ;)
User avatar
Leodagan
Developer
 
Posts: 1350
Joined: Tue May 01, 2012 9:30 am
Website: https://daoc.freyad.net
Location: Lyon

Re: Odd LootGenerator behaviour for Glass and Scales

Postby PlanarChaosRvrtwo » Fri Mar 17, 2017 10:25 am

I know what regions are i just thougt on df seal drop could be solved same way so i also mentioned regions
( i just meant the code should handle zone / region / mob guild / faction / class / level )
Couse this way df can be done ether by region wait what happen then with saphs and diamonds so combined level/zone can handle it
On other hand by class we could stop realmguards drop uniq loot couse they not meant to drop it
But also the epic encounters in few regions are meant to drop more glass and such
The faction of drakulv are meant to drop less scales then svartalfs (same with stonecrushs/granite giant) and (Azure/glimmer)
And at last the toa bosses meant to drop special rog loot that could be also handled by such a script ether with level or with guild epic encounter but level would be more livelike
so there are many reasons to improve this script
DOL dint only gaved me the data to start my server,
it also gaved me 16 amazing years with nice peeps,
and now its on me to return the favor.
User avatar
PlanarChaosRvrtwo
Database Team
 
Posts: 517
Joined: Thu Jul 07, 2016 6:21 am

Re: Odd LootGenerator behaviour for Glass and Scales

Postby Leodagan » Fri Mar 17, 2017 10:50 am

Yes there are many reason to improve the Loot Generator Mapping :)

But I don't think Zone Match should be in there, "Class" could be a great addition, "Level" should definitely be a range so something more like "LevelMin" / "LevelMax"

There is only 1 "Zone" in Darkness Fall, so I don't understand how Zone/Level relation could solve Seals Drops, maybe you meant "Area" that are specific "Places" in the game like villages when you see "You are entering [Village]" message ?
User avatar
Leodagan
Developer
 
Posts: 1350
Joined: Tue May 01, 2012 9:30 am
Website: https://daoc.freyad.net
Location: Lyon

Re: Odd LootGenerator behaviour for Glass and Scales

Postby PlanarChaosRvrtwo » Fri Mar 17, 2017 12:04 pm

No i just mean region add not needed yet but over seals to glasses to scales show us not long till we need it why we shouldnt enable a possibility before we need it?
DOL dint only gaved me the data to start my server,
it also gaved me 16 amazing years with nice peeps,
and now its on me to return the favor.
User avatar
PlanarChaosRvrtwo
Database Team
 
Posts: 517
Joined: Thu Jul 07, 2016 6:21 am


Return to “%s” DOL Development Discussion

Who is online

Users browsing this forum: No registered users and 0 guests