(solved)Releasing keep is not updating guilds keep count

For any problems with Dawn of Light website or game server, please direct questions and problems here.

Moderator: Support Team

(solved)Releasing keep is not updating guilds keep count

Postby ontheDOL » Sun Feb 26, 2017 8:18 pm

hi guys,
using latest revision, guild claim limit set to 1.

I can claim a keep, guards will reset with my guild name etc, which is all good.

then when you release the keep, the guards reset back to no guild, which is all good.

In the database, the keep table for "ClaimedKeepName" updates fine (adds name when claimed, removes name when released)

The problem after releasing is, /gc info shows that the guild still has control of the keep, and if you try to reclaim the keep, it says "your guild already owns a keep"


here in abstractgamekeep.cs it has the line this.Guild.ClaimedKeeps.Remove(this); but it doesnt seem to be working
Code: Select all
public virtual void Release() { this.Guild.ClaimedKeeps.Remove(this); PlayerMgr.BroadcastRelease(this); this.m_guild = null; StopDeductionTimer(); StopChangeLevelTimer(); ChangeLevel((byte)ServerProperties.Properties.STARTING_KEEP_LEVEL); foreach (GameKeepGuard guard in Guards.Values) { guard.ChangeGuild(); } foreach (GameKeepBanner banner in Banners.Values) { banner.ChangeGuild(); } this.SaveIntoDatabase(); }
Tested in new frontiers on Caer Renaris with Normal ruleset, and on pvp ruleset, both with same result.
has anyone got some insight on this?
thanks
Last edited by ontheDOL on Mon Feb 27, 2017 1:02 am, edited 1 time in total.
- Unty -
Model Showroom and DOL guides
http://losojos-001-site1.btempurl.com
User avatar
ontheDOL
Developer
 
Posts: 311
Joined: Fri May 20, 2016 4:21 am
Location: Australian abroad

Re: Releasing keep is not updating guilds keep count

Postby PlanarChaosRvrtwo » Sun Feb 26, 2017 11:19 pm

Did you released the keep with the Lord menu or with the /gc release command couse i think it could be handled diffrent but allready to tired to relook that.
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: Releasing keep is not updating guilds keep count

Postby ontheDOL » Mon Feb 27, 2017 12:11 am

tested with both methods , lord menu and the /gc commands.

i think the issue is when you claim, the claimedkeep is being added to the list twice. that is to say,
If i claim a keep, and then type /gc info , it tells me the keep i claimed twice.
ie;
your guild has currently claimed caer renaris
your guild has currently claimed caer renaris

when you release the keep, it only removes only one of these records.
so i think i need to find out why its added it twice when claimed
- Unty -
Model Showroom and DOL guides
http://losojos-001-site1.btempurl.com
User avatar
ontheDOL
Developer
 
Posts: 311
Joined: Fri May 20, 2016 4:21 am
Location: Australian abroad

Re: Releasing keep is not updating guilds keep count

Postby PlanarChaosRvrtwo » Mon Feb 27, 2017 12:57 am

Hmm could be possible for some reason 2 scripts is handling it like keepmanager and playercommandmanager (just an idea)
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: Releasing keep is not updating guilds keep count

Postby ontheDOL » Mon Feb 27, 2017 12:58 am

ok i think i fixed it
Code: Select all
public virtual void Claim(GamePlayer player) { this.m_guild = player.Guild; player.Guild.ClaimedKeeps.Add(this); if (ServerProperties.Properties.GUILDS_CLAIM_LIMIT > 1) player.Guild.SendMessageToGuildMembers("Your guild has currently claimed " + player.Guild.ClaimedKeeps.Count + " keeps of a maximum of " + ServerProperties.Properties.GUILDS_CLAIM_LIMIT, eChatType.CT_Guild, eChatLoc.CL_ChatWindow); ChangeLevel((byte)ServerProperties.Properties.STARTING_KEEP_CLAIM_LEVEL); PlayerMgr.BroadcastClaim(this); foreach (GameKeepGuard guard in Guards.Values) { guard.ChangeGuild(); } foreach (GameKeepBanner banner in Banners.Values) { banner.ChangeGuild(); } this.SaveIntoDatabase(); LoadFromDatabase(DBKeep); StartDeductionTimer(); GameEventMgr.Notify(KeepEvent.KeepClaimed, this, new KeepEventArgs(this)); }
player.Guild.ClaimedKeeps.Add(this); adds the keep to the guilds claimed list, then at the bottom is calls LoadFromDatabase(DBKeep);

in the LoadFromDatabase method
Code: Select all
public virtual void LoadFromDatabase(DataObject keep) { m_dbkeep = keep as DBKeep; InternalID = keep.ObjectId; m_difficultyLevel[0] = m_dbkeep.AlbionDifficultyLevel; m_difficultyLevel[1] = m_dbkeep.MidgardDifficultyLevel; m_difficultyLevel[2] = m_dbkeep.HiberniaDifficultyLevel; if (m_dbkeep.ClaimedGuildName != null && m_dbkeep.ClaimedGuildName != "") { Guild myguild = GuildMgr.GetGuildByName(m_dbkeep.ClaimedGuildName); if (myguild != null) { this.m_guild = myguild; this.m_guild.ClaimedKeeps.Add(this); StartDeductionTimer(); } }
it adds the keep again " this.m_guild.ClaimedKeeps.Add(this);"
so i removed the player.Guild.ClaimedKeeps.Add(this); from the Claim method , and now it works. It will save the guild in the DB and put the keep in the guilds keep list to prevent from multiple keeps captures
i tested claiming and releasing claiming releasing and it works fine.

when you reboot server, the loadfromdatabase happens again so it retains the guilds keep count.
- Unty -
Model Showroom and DOL guides
http://losojos-001-site1.btempurl.com
User avatar
ontheDOL
Developer
 
Posts: 311
Joined: Fri May 20, 2016 4:21 am
Location: Australian abroad

Re: (solved)Releasing keep is not updating guilds keep count

Postby PlanarChaosRvrtwo » Mon Feb 27, 2017 2:38 am

you should maybe merge it with current revision on github
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: (solved)Releasing keep is not updating guilds keep count

Postby Leodagan » Fri Mar 03, 2017 1:00 pm

This code is really not optimal ;)

I merged your fix for the moment, but ideally an in-game object should not interact this directly with database...

For a simple player command we have multiple direct database query (update/create and select), I think game status should be flawless and on specific timer or event : dump changed state to the DB (preferably from another thread than a player command handler or region event handler)

Thanks for your great pull request ;)
User avatar
Leodagan
Developer
 
Posts: 1350
Joined: Tue May 01, 2012 9:30 am
Website: https://daoc.freyad.net
Location: Lyon


Return to “%s” Support

Who is online

Users browsing this forum: No registered users and 1 guest