Modifying HP on spawn for custom boss - azerothcore

I have created my own custom boss by inserting my own entry into creature_template table. I can spawn the boss just fine and adjust HP and boss attributes as per creature_template settings.
What I really need is to have this custom boss spawn with 50% of its max HP. I've looked through possible GM commands and it looks what I want to do is not possible through existing commands. How can I achieve this? Thanks in advance.

The easiest way I found was with a script. Adding a script for the boss and overloading the Reset() function (like below) using ScriptedAI interface, can set the HP to whatever % you want. However, you need to turn off the health regen in the creature_template table for that or the boss will quickly regen to 100% after it's been spawned.
void Reset() override
{
me->SetHealth(me->CountPctFromMaxHealth(40));
}
Edit: Please update if there is an easier way/more effective way to this. Thanks!

Related

Version control of big data tables (iceberg)

I'm building a Iceberg tables on the top of a data lake. These tables are used for reporting tools. I'm trying to figure out what is the best way to control a version/deploy changes to these tables in CI/CD process. E.g. I could like to add a column to the Iceberg table. To do that I have to write a ALTER TABLE statement, save it to the git repository and deploy via CI/CD pipeline. Tables are accessible via AWS Glue Catalog.
I couldn't find to much info about this in google so if anyone could share some knowledge, it would be much appreciated.
Cheers.
Version control of Iceberg tables.
Agree with #Fokko Driesprong. This is a supplement only.
Sometimes, table changes are considered as part of task version changes. That is, table change statements, ALTER TABLE, are bound to task upgrades.
Tasks are sometimes automatically deployed. So it often executes a table change statement first, and then deploys a new task. If the change is disruptive, then we need to stop the old task first and then deploy the new one.
Corresponding to the upgrade, we also have a rollback script, of course, the corresponding table change statement.
thanks for asking this question. I don't think there is a definitive way of doing this. In practice I see most people bundling this as part of the job that writing to the Iceberg table. This way you can make sure that new columns are populated right away with the new version of the job. If you don't do any breaking changes (such as deletion of column), then the downstream jobs won't break. Hope this helps!

asterisk PAGI dynamic node interruptable

im developing dialplan using asterisk and PAGI (PHP asterisk gateway interface)
but i cant find a way to create node which can have dynamic number of annoucements depends on result from database.
I found a way to do this by adding annoucements in loop in method called executeAfterRun
but when Im trying to interrupt node by pressing anything it interrupts only current annoucement and going to playing next one.
I want this whole node to be interruptable not just current annoucement.
can anyone help me with this problem ?
thanks in advance for any help
best regards
You have create in your php code string like
announce1&announce2&announce3
using loop. After that you can use that string for Playback command, it will work like one large file.

Auto-Incrementing (Unique) ID in Alfresco

i am trying to extend alfresco's document management by running a script. So far, i have managed to create a Custom Model with a Custom Type and Property as seen below:
the said Custom Type is under this Custom Model (never mind the Custom Aspect for now)
the custom type is working so far, i managed to apply it to a certain document as you can see below (Notice the Control Code Field)
now what i want to do is to add an auto incrementing function that will be set as the value of the Control Code Property (ie: [FILE0012])
i tried utilizing the scripts rule from alfresco but it seems like the commands are limited to that of alfresco's functionalities. not even alert() or console.log functions work. i thought that if i can make a script that could call an ajax to my php server, i can extract the document's property, and insert it to my database and get the rowid then attach it to a word "FILE" so it becomes the Control Code Property (ie: a document was inserted to my database at row 1996, then the Control code is [FILE1996], this is because i joined '[FILE' and 1996 and ']'
but like i said, what happened was, the javascript commands are limited to that of alfresco's needs.
i tried to make my research but i've only bumped on 2 outdated (and i mean outdated) threads dating back to 2006-2010. which does not help me quite well with Alfresco's current build structure.
i hope someone can help me with here. connecting to the database is not mandatory, but if i can make it do as such then it'll give me quite a rather amazing results.
Take a look at the "cm:countable" aspect. You do not have uniqueness guaranteed OOTB, so take that into account.
Example:
http://www.avantec.se/howto-create-an-auto-increment-field-on-an-object-in-alfresco/

Run a code snippet before and after tests with testthat

I have a set of R functions which get called from a Ruby application and would like to test them. The R functions access data from a Postgres database so to write tests I need to populate a test database with some sample data.
I would like to avoid cleaning up the database within every test case. It would be nice if I could start a transaction before every test and rollback the transaction after.
The last paragraph of the "Writing Tests" section of this page http://r-pkgs.had.co.nz/tests.html makes me think that it's not possible to execute a block of code before every test case.
Does anyone know of any creative work arounds? I'm considering forking the project and adding the functionality but wanted to make sure I'm not reinventing the wheel.
For anyone who stumbles upon this, I ended up creating a wrapper function for test_that() which I use when getting data from postgres. Below is my solution:
db.test_that <- function(description, test_code) {
dbGetQuery(database_connection, 'BEGIN TRANSACTION')
test_that(description, test_code)
dbRollback(database_connection)
}

What interesting things can be done with dcop?

I have been using UNIX for years and the dcop command only recently came to my attention. What is its primary purpose and is using it in any process a sign of poor design?
is using it in any process a sign of poor design?
Probably not, as long as you're using DCOP to perform some task that would ordinarily be done with a mouse click or hotkey. It's certainly way better design than trying to control the mouse to do what you want to do with the program!
But if you use DCOP to do something really simple that could be done directly with a shell command or a few lines of C code, without invoking a KDE application at all, it's probably better to just do it the direct way. (e.g. don't use DCOP to tell Konqueror to remove a directory tree, just run rm -rf)
I suspect it mainly exists because everything in UNIX ought to be accessible from the command line.
The Wikipedia article on dcop is worth a read.
It's great for any scripts to use to control processes, there's also good information on controlling Amarok via dcop.

Resources