Jump to content

  •  

Bug Tracker Migration

June 3rd
Good news everyone! The staff has decided that it is time to slowly kill off this Bug Tracker. We will begin the process of slowly migrating from this Bug Tracker over to our Github Issues which can be found here: https://github.com/HerculesWS/Hercules/issues

Over the next couple of days, I will be closing off any opportunity to create new reports. However, I still will keep the opportunity to reply to existing Bug Reports. Doing this will allow us to slowly fix any bug reports we have listed here so that we can easily migrate over to our Issue Tracker.

Update - June 7th 2015: Creating new bug posts has been disabled. Please use our https://github.com/HerculesWS/Hercules/issues tracker to post bugs. Users are still able to reply to existing bug posts.

- Administration

Issue Information

  • #000342

  • 3 - Medium

  • Confirmed

Issue Confirmations

  • Yes (0)No (0)
Photo

Gvg Guardian Code Removal

Posted by Hercules Bot on 01 November 2007 - 11:09 AM

Originally posted by theultramage
http://www.eathena.w...ker&showbug=342

(this is a TODO, related topic: #279)
The WoE system is a heap of unreadable spaghetti (IMG:style_emoticons/default/sleep.gif)

If you look at it closer, the entire guardian_data structure is totally redundant - all info could be extracted from a guild lookup (using guild_id). And even that wouldn't be needed because you could just look up castle info (and thus the owning guild) for the map the guardian is standing on.
This, of course, for an expense of an O(log n) lookup, where n is the ammount of guilds (a small number) or castles (a very small number). Instead, there are pages and pages of code dedicated to maintaining this 'cache' and syncing it whenever something changes.

Now to the db part. My proposal is to completely remove any mention of guardians from the castles table. Why?
The `visibleG?` columns keep track of which guardians are hired and which aren't. This in turn forces the gw script to make castle information requests from the server. If these were script variables instead, the whole mess could be removed.
The `gHP?` columns track how much current hp each guardian has. What the?! was my reaction when I realized this. To sum it up:
Some whacko decided that 'current' guardian hp values should be made persistent. So he adds it to the castle's data, and then adds hacks to spawn the mob with non-full hp. Why the hell would you want to make guardian hp persist between server restarts (only valid reason), when a priest can just go around and heal all guardians to full hp? Why give special preference to guardian mobs, which can be killed in just 10 seconds?

PS: some more minor junk to remove (this one's from jA):
The Emperium has a npc::OnAgitBreak death event wired in. Code says that for each such mob, guild_agit_break(md) is called. This function just starts a battle_config.gvg_eliminate_time timer, targeting the function guild_gvg_eliminate_timer(). This function just replaces the 'Break' part of the event name with 'Eliminate' and runs the script. Nothing more. So basically the code is doing what the script engine should be doing. The script engine can even look up the config setting using getbattleflag().

So here you go, plenty of material for code removal.

This post has been edited by theultramage: Nov 1 2007, 06:43 AM