<commit_before>/*
 * CamoTask.h
 *
 *  Created on: May 23, 2012
 *      Author: da
 */

#ifndef CAMOTASK_H_
#define CAMOTASK_H_
#include "server/chat/StringIdChatParameter.h"
#include "server/zone/objects/player/PlayerObject.h"
#include "engine/core/ManagedReference.h"
#include "engine/core/ManagedWeakReference.h"
#include "system/lang/String.h"
#include "server/zone/objects/creature/CreatureObject.h"

class CamoTask : public Task {
	ManagedWeakReference<CreatureObject*> creo;
	ManagedWeakReference<CreatureObject*> targ;
	bool success;
	bool maskScent;

public:
	CamoTask(CreatureObject* cr, CreatureObject* tar, bool ms, bool succ) : Task(){
		creo = cr;
		targ = tar;
		success = succ;
		maskScent = ms;
	}

	void run() {
		int crc = String("skill_buff_mask_scent").hashCode();
		String buffMsg = "@skl_use:sys_conceal_stop";

		if (maskScent) {
			crc = String("skill_buff_mask_scent_self").hashCode();
			buffMsg = "@skl_use:sys_scentmask_break";
		}

		ManagedReference<CreatureObject*> target = targ.get();
		if (target == NULL)
			return;

		Locker tlocker(target);

		if (!success && target->hasBuff(crc)) {
			target->sendSystemMessage(buffMsg);
			target->removeBuff(crc);
		}

		ManagedReference<CreatureObject*> creature = creo.get();
		if (creature == NULL)
			return;

		Locker clocker(creature, target);

		ManagedReference<PlayerObject*> player = creature->getPlayerObject();
		if (player == NULL)
			return;

		if (!maskScent && !creature->hasSkill("outdoors_ranger_novice"))
			return;

		if (maskScent) {
			StringIdChatParameter success("skl_use", "sys_scentmask_success");
			success.setTT(target);

			target->sendSystemMessage(success);
		}

		player->addExperience("scout", (creature->getLevel() * 2), true);
	}
};


#endif /* CAMOTASK_H_ */<commit_msg>(unstable) [fixed] mask scent not awarding exp or dropping, maybe some candy<commit_after>/*
 * CamoTask.h
 *
 *  Created on: May 23, 2012
 *      Author: da
 */

#ifndef CAMOTASK_H_
#define CAMOTASK_H_
#include "server/chat/StringIdChatParameter.h"
#include "server/zone/objects/player/PlayerObject.h"
#include "engine/core/ManagedReference.h"
#include "engine/core/ManagedWeakReference.h"
#include "system/lang/String.h"
#include "server/zone/objects/creature/CreatureObject.h"

class CamoTask : public Task {
	ManagedWeakReference<CreatureObject*> creo;
	ManagedWeakReference<CreatureObject*> targ;
	bool success;
	bool maskScent;

public:
	CamoTask(CreatureObject* cr, CreatureObject* tar, bool ms, bool succ) : Task(){
		creo = cr;
		targ = tar;
		success = succ;
		maskScent = ms;
	}

	void run() {
		int crc = String("skill_buff_mask_scent").hashCode();
		String buffMsg = "@skl_use:sys_conceal_stop";

		if (maskScent) {
			crc = String("skill_buff_mask_scent_self").hashCode();
			buffMsg = "@skl_use:sys_scentmask_break";
		}

		ManagedReference<CreatureObject*> target = targ.get();
		if (target == NULL)
			return;

		ManagedReference<CreatureObject*> creature = creo.get();
		if (creature == NULL)
			return;

		Locker locker(creature);

		if (!success && creature->hasBuff(crc)) {
			creature->sendSystemMessage(buffMsg);
			creature->removeBuff(crc);
		}

		//Locker clocker(creature, target);

		ManagedReference<PlayerObject*> player = creature->getPlayerObject();
		if (player == NULL)
			return;

		if (!maskScent && !creature->hasSkill("outdoors_ranger_novice"))
			return;

		if (maskScent) {
			StringIdChatParameter success("skl_use", "sys_scentmask_success");
			success.setTT(target);

			creature->sendSystemMessage(success);
		}

		player->addExperience("scout", (target->getLevel() * 2), true);
	}
};


#endif /* CAMOTASK_H_ */
{'fraction_non_alphanumeric': 0.14101154480483782, 'fraction_numerical': 0.0038482682792743265, 'mean_word_length': 4.813099041533547, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '255687', 'n_tokens_mistral': 1403, 'n_tokens_neox': 1263, 'n_words': 245}