示例#1
0
	void OnKillMultiplier(const halo::s_player& player, DWORD multiplier)
	{
		PhasorCaller caller;
		AddPlayerArg(&player, caller);
		caller.AddArg(multiplier);
		caller.Call("OnKillMultiplier");
	}
示例#2
0
	/*! \todo make function so scripts can check if hash-checking is on */
	bool OnBanCheck(const std::string& hash, const std::string& ip)
	{
		PhasorCaller caller;
		caller.AddArg(hash);
		caller.AddArg(ip);
		return HandleResult<bool>(caller.Call("OnBanCheck", result_bool), true);
	}
示例#3
0
	bool OnWeaponReload(const halo::s_player* player, halo::ident weap)
	{
		PhasorCaller caller;
		AddPlayerArg(player, caller);
		AddArgIdent(weap, caller);
		return HandleResult<bool>(caller.Call("OnWeaponReload", result_bool), true);
	}
示例#4
0
	bool OnServerCommand(const halo::s_player* player, const std::string& command)
	{
		PhasorCaller caller;
		AddPlayerArg(player, caller);
		caller.AddArg(command);
		return HandleResult<bool>(caller.Call("OnServerCommand", result_bool), true);
	}
示例#5
0
	void OnPlayerSpawnEnd(const halo::s_player& player, halo::ident m_objectId)
	{
		PhasorCaller caller;
		AddPlayerArg(&player, caller);
		AddArgIdent(m_objectId, caller);
		caller.Call("OnPlayerSpawnEnd");
	}
示例#6
0
	bool OnVehicleEject(const halo::s_player& player, bool forceEjected)
	{
		PhasorCaller caller;
		AddPlayerArg(&player, caller);
		if (forceEjected) caller.ReturnValueIgnored();
		return HandleResult<bool>(caller.Call("OnVehicleEject", result_bool), true);
	}
示例#7
0
	bool OnTeamDecision(DWORD in_team, DWORD& out_team)
	{
		PhasorCaller caller;
		caller.AddArg(in_team);
		Result r = caller.Call("OnTeamDecision", result_number);
		if (r.size()) out_team = (DWORD)r.ReadNumber(0).GetValue();
		return r.size() != 0;
	}
示例#8
0
	bool OnObjectInteraction(halo::s_player& player, halo::ident objid,
		halo::ident mapid)
	{
		PhasorCaller caller;
		AddPlayerArg(&player, caller);
		AddArgIdent(objid, caller);
		AddArgIdent(mapid, caller);
		return HandleResult<bool>(caller.Call("OnObjectInteraction", result_bool), true);
	}
示例#9
0
	bool OnServerCommandAttempt(const halo::s_player& player, const std::string& command,
		const std::string& password)
	{
		PhasorCaller caller;
		AddPlayerArg(&player, caller);
		caller.AddArg(command);
		caller.AddArg(password);
		return HandleResult<bool>(caller.Call("OnServerCommandAttempt", result_bool), false);
	}
示例#10
0
	bool OnPlayerKill(const halo::s_player& victim, const halo::s_player* killer,
		DWORD mode)
	{
		PhasorCaller caller;
		AddPlayerArg(killer, caller);
		AddPlayerArg(&victim, caller);
		caller.AddArg(mode);
		return HandleResult<bool>(caller.Call("OnPlayerKill", result_bool), true);
	}
示例#11
0
	// return true to reset the timer
	virtual bool OnExpiration(Timers& timers) override
	{
		if (!still_valid()) return false;

		PhasorCaller caller;
		caller.AddArg(GetID());
		caller.AddArg(++count);
		if (userdata != nullptr) caller.AddArg(userdata->NewCopy());
		return HandleResult<bool>(caller.Call(*state, callback.c_str(), result_bool), false);
	}
示例#12
0
	bool OnDamageApplication(const halo::s_damage_info* dmg, halo::ident receiver, 
		const halo::s_hit_info* hit, bool backtap)
	{
		PhasorCaller caller;
		AddArgIdent(receiver, caller);
		AddArgIdent(dmg->causer, caller);
		AddArgIdent(dmg->tag_id, caller);
		caller.AddArg(std::string(hit->desc));
		caller.AddArg(backtap);
		return HandleResult<bool>(caller.Call("OnDamageApplication", result_bool), true);
	}
示例#13
0
	bool OnTeamChange(const halo::s_player& player, bool relevant, DWORD old_team,
		DWORD new_team)
	{
		PhasorCaller caller;
		// if we're not going to process return values, let scripts know
		if (!relevant) caller.ReturnValueIgnored();
		AddPlayerArg(&player, caller);
		caller.AddArg(old_team);
		caller.AddArg(new_team);
		return HandleResult<bool>(caller.Call("OnTeamChange", result_bool), true);
	}
示例#14
0
	bool OnWeaponAssignment(halo::s_player* player, halo::ident owner, DWORD order,
		halo::ident weap_id, halo::ident& out)
	{
		PhasorCaller caller;
		AddPlayerArg(player, caller);
		AddArgIdent(owner, caller);
		caller.AddArg(order);
		AddArgIdent(weap_id, caller); 
		Result r = caller.Call("OnWeaponAssignment", result_number);
		if (!r.size()) return false; // no results
		out = halo::make_ident((unsigned long)r.ReadNumber(0).GetValue());
		return true;
	}
示例#15
0
	bool OnDamageLookup(halo::s_damage_info* dmg, void* metaData,
		halo::ident receiver, halo::damage_script_options& out)
	{
		odl::setData(&out, dmg, receiver);
		PhasorCaller caller;
		AddArgIdent(receiver, caller);
		AddArgIdent(dmg->causer, caller);
		AddArgIdent(dmg->tag_id, caller);
		caller.AddArg((DWORD)metaData);
		bool b = HandleResult<bool>(caller.Call("OnDamageLookup", result_bool), true);
		odl::reset();
		return b;
	}
示例#16
0
	bool OnVehicleEntry(const halo::s_player& player, halo::ident veh_id,
		DWORD seat, bool relevant)
	{
		halo::objects::s_halo_object* obj = (halo::objects::s_halo_object*)
			halo::objects::GetObjectAddress(veh_id);
		if (!obj) return true;

		PhasorCaller caller;
		AddPlayerArg(&player, caller);
		AddArgIdent(veh_id, caller);
		caller.AddArg(seat);		
		AddArgIdent(obj->map_id, caller);
		if (!relevant) caller.ReturnValueIgnored();
		return HandleResult<bool>(caller.Call("OnVehicleEntry", result_bool), true);
	}
示例#17
0
	bool OnNameRequest(const std::string& hash, const std::string& name, 
		std::string& change_name)
	{
		using namespace Common;
		static const scripting::results_t expected = {TYPE_BOOL, TYPE_STRING};

		PhasorCaller caller;
		caller.AddArg(hash);
		caller.AddArg(name);

		Result r = caller.Call("OnNameRequest", expected);
		if (r.size() == 0) return true; // no scripts returned anything
		if (r.size() == 2) change_name = r.ReadString(1).GetValue();
		
		return r.ReadBool(0).GetValue();
	}
示例#18
0
	e_ident_or_bool OnObjectCreationAttempt(const halo::objects::s_object_creation_disposition* info,
		halo::ident& change_id, bool& allow)
	{
		PhasorCaller caller;
		AddArgIdent(info->map_id, caller);
		AddArgIdent(info->parent, caller);
		if (info->player_ident.valid()) caller.AddArg((DWORD)info->player_ident.slot);
		else caller.AddArgNil();

		e_ident_bool_empty r =  HandleResultIdentOrBool(
			caller.Call("OnObjectCreationAttempt", result_number),
			change_id, allow);

		if (r == e_ident_bool_empty::kEmptySet){
			allow = true;
			return e_ident_or_bool::kBool;
		} else if (r == e_ident_bool_empty::kBoolSet) {
			return e_ident_or_bool::kBool;
		} else {
			return e_ident_or_bool::kIdent;
		}
	}
示例#19
0
	bool OnServerChat(const halo::s_player* sender, const std::string& msg,
		halo::server::chat::e_chat_types& type, std::string& change_msg)
	{
		using namespace Common;
		static const scripting::results_t expected = {TYPE_BOOL, TYPE_STRING, TYPE_NUMBER};
		
		PhasorCaller caller;
		AddPlayerArg(sender, caller);
		caller.AddArg(type);
		caller.AddArg(msg);
		Result r = caller.Call("OnServerChat", expected);
		if (r.size() == 0) return true; // no scripts returned anything, use defualt
		if (r.size() > 1) change_msg = r.ReadString(1).GetValue();
		if (r.size() > 2 && type != halo::server::chat::e_chat_types::kChatServer) {
			using namespace halo::server::chat;
			int chat_type = (int)r.ReadNumber(2).GetValue();
			if (chat_type >= (int)e_chat_types::kChatAll && 
				chat_type < (int)e_chat_types::kChatPrivate)
				type = (e_chat_types)chat_type;
		}
		return r.ReadBool(0).GetValue();
	}
示例#20
0
	void OnClientUpdate(const halo::s_player& player)
	{
		PhasorCaller caller;
		AddPlayerArg(&player, caller);
		caller.Call("OnClientUpdate");
	}
示例#21
0
	void OnObjectCreation(halo::ident m_objectId)
	{
		PhasorCaller caller;
		AddArgIdent(m_objectId, caller);
		caller.Call("OnObjectCreation");
	}
示例#22
0
	void OnGameEnd(DWORD stage)
	{
		PhasorCaller caller;
		caller.AddArg(stage);
		caller.Call("OnGameEnd");
	}
示例#23
0
	void OnNewGame(const std::string& map)
	{
		PhasorCaller caller;
		caller.AddArg(map);
		caller.Call("OnNewGame");
	}
示例#24
0
	void OnPlayerLeave(const halo::s_player& player)
	{
		PhasorCaller caller;
		AddPlayerArg(&player, caller);
		caller.Call("OnPlayerLeave");
	}