data/scripts/modules/bestiary_charms.lua
my bad, it's data/scripts/creaturescripts/others/bestiary_kill.lua
local bestiaryOnKill = CreatureEvent("BestiaryOnKill")
function bestiaryOnKill.onKill(player, creature, lastHit)
if not player:isPlayer() or not creature:isMonster() or creature:hasBeenSummoned() or creature:isPlayer() then
return true
end
for cid, damage in pairs(creature:getDamageMap()) do
local participant = Player(cid)
if participant and participant:isPlayer() then
participant:addBestiaryKill(creature:getName())
end
end
return true
end
bestiaryOnKill:register()
This is my script, but i don't think i could change for double or 3x..
LUA:local bestiaryOnKill = CreatureEvent("BestiaryOnKill") function bestiaryOnKill.onKill(player, creature, lastHit) if not player:isPlayer() or not creature:isMonster() or creature:hasBeenSummoned() or creature:isPlayer() then return true end for cid, damage in pairs(creature:getDamageMap()) do local participant = Player(cid) if participant and participant:isPlayer() then participant:addBestiaryKill(creature:getName()) end end return true end bestiaryOnKill:register()
participant:addBestiaryKill(creature:getName(), 3)
void IOBestiary::addBestiaryKill(Player* player, MonsterType* mtype, uint32_t amount /*= 1*/)
{
uint16_t raceid = mtype->info.raceid;
if (raceid == 0) {
return;
}
uint32_t curCount = player->getBestiaryKillCount(raceid);
std::ostringstream ss;
player->addBestiaryKillCount(raceid, amount);
if (curCount == 0) {
player->sendBestiaryEntryChanged(raceid);
ss << "You unlocked details for the creature '" << mtype->name << "'";
player->sendTextMessage(MESSAGE_STATUS, ss.str());
return;
}
curCount += amount;
if ((curCount == mtype->info.bestiaryFirstUnlock) || (curCount == mtype->info.bestiarySecondUnlock)) {
ss << "You unlocked details for the creature '" << mtype->name << "'";
player->sendTextMessage(MESSAGE_STATUS, ss.str());
player->sendBestiaryEntryChanged(raceid);
} else if ((curCount >= mtype->info.bestiaryToUnlock) && curCount <= mtype->info.bestiaryToUnlock + 3) {
ss << "You unlocked details for the creature '" << mtype->name << "'";
player->sendTextMessage(MESSAGE_STATUS, ss.str());
addCharmPoints(player, mtype->info.bestiaryCharmsPoints);
player->sendBestiaryEntryChanged(raceid);
}
std::list<MonsterType*> trackerList = player->getBestiaryTrackerList();
for (MonsterType* mType : trackerList) {
if (raceid == mType->info.raceid) {
player->refreshBestiaryTracker(trackerList);
}
}
}