Log in

View Full Version : Retain Spells on Death


Meddera
11-23-2016, 06:56 PM
I am new to all this and recently was able to get my server up and running but I have no idea how to make any changes. I would like to stop spells from disappearing from memory upon death. I found this in the forums but needed some help on where these file locations are and what I need to use to make changes?


Thanks in advance..



in the source, delete the following from attack.cpp:


Code:
if((GetClientVersionBit() & BIT_SoFAndLater) && RuleB(Character, RespawnFromHover))
UnmemSpellAll(true);
else
UnmemSpellAll(false);

Delete from client.cpp:

UnmemSpellAll();

ghanja
11-23-2016, 11:23 PM
Get either Navicat or HeidiSQL, to make database changes. I'm not sure if EOC allows changes to the rule_values table or not, but, if you're going to begin changing things, I'd recommend a DB editor either way.

Once you've done this and connected to your database (there is a plethora of material on how to do this around here), search for all "rule_name" column occurrences of


Character:RespawnFromHover


to "true" in the corresponding "rule_name" column.

Granted this changes other behavior, but, may be the fastest. Until a new rule is added, if it's added, to the binaries.

ghanja
11-24-2016, 12:07 AM
This assumes you have DBI Perl installed (instructions are in the Wiki). And, it's by far untested (even for syntax, sorry away from my home PC for the holidays):


## global_player.pl

sub EVENT_TIMER {
if ($timer eq "RecordCharacter") {
RecordCharacterMemmedSpells($charid);
}
}

sub EVENT_SAY {
if ($text=~/#loadspells/i) {
if (defined $qglobals{"memmedspells"}) {
LoadMemmedSpells();
} else {
$client->Message(15, "You have no spell slots in custom memory!");
}
}
}

sub EVENT_CONNECT {
LoadMemmedSpells() if (defined $qglobals{"memmedspells"});
quest::settimer("RecordCharacter", 10);
}

sub LoadMemmedSpells {
$client->UnmemSpellAll(1); ## just a sanity thing
foreach my $i (0..9) { ## forget current maximum spell slots
if (defined $qglobals{"memmedspellslot$i"}) {
$client->MemSpell($qglobals{"memmedspellslot$i"}, $i, 1);
}
}
}

sub RecordCharacterMemmedSpells {
my $dbh = plugin::MySQL_Connect();
my $sth = $dbh->prepare("
SELECT slot_id, spell_id
FROM character_memmed_spells
WHERE id = ?
");
$sth->bind_param(1,$_[0]);
$sth->execute();
if ($sth->rows() > 0) {
quest::setglobal("memmedspells", 1, 5, "F");
while (my @row = $sth->fetchrow_array()) {
quest::setglobal("memmedspellslot$row[0]", $row[1], 5, "F");
}
}
$sth->finish();
$dbh->disconnect();
}


(shrug) hopefully someone comes in and gives it a look over, second+ set of eyes never hurt.

*Edit: The code above is sort of moot now after having been enlightened by Kingly's post. But will leave it for those that like Perl.

Kingly_Krab
11-24-2016, 12:16 AM
The code block is this: if (RuleB(Character, UnmemSpellsOnDeath)) {
if((ClientVersionBit() & EQEmu::versions::bit_SoFAndLater) && RuleB(Character, RespawnFromHover))
UnmemSpellAll(true);
else
UnmemSpellAll(false);
}

Simply add a rule_values entry for Character:UnmemSpellsOnDeath and set it to false. I added this a while back, not sure how people don't know. :P

Here's the commit (https://github.com/EQEmu/Server/commit/180612bb21e61c1a279dc03d50666f2fedc372e0).

ghanja
11-24-2016, 12:25 AM
Well. Damn. There you go. Follow the process in my first reply but instead "rule_name" of Character:UnmemSpellsOnDeath to a "rule_value" of false as Kingly stated.

Never was asked to enable/disable to go looking for it. However, it's not in the wiki (at the time of this post). ;)

http://wiki.eqemulator.org/p?Server_Rules

I'd add it and more, but, never got approved so, there ya go.

Meddera
11-24-2016, 10:41 AM
Ok so I do have Heidi as I was able to figure out the GM designation with it, but still not sure how to use the program so its been slow going.

I just went to rules_values and clicked on data and scrolled to the very bottom and added

Character:UnmemSpellsOnDeath and set it to false. Do I need to change the ruleset ID? It defaults as zero. And is there anything else that needs to be done for this to work?


Thanks again.

Meddera
11-24-2016, 10:53 AM
Ok I changed ruleset ID to 1 and it works!

Thanks guys! Happy Bird Day