Beispiel #1
0
PyResult Command_giveisk( Client* who, CommandDB* db, PyServiceMgr* services, const Seperator& args )
{

	if( args.argCount() < 3 ) {
		throw PyException( MakeCustomError("Correct Usage: /giveisk [entityID (0=self)] [amount]") );
	}

	if( !args.isNumber( 1 ) )
		throw PyException( MakeCustomError( "Argument 1 should be an entity ID (0=self)" ) );
	uint32 entity = atoi( args.arg( 1 ).c_str() );

	if( !args.isNumber( 2 ) )
		throw PyException( MakeCustomError( "Argument 2 should be an amount of ISK" ) );
	double amount = strtod( args.arg( 2 ).c_str(), NULL );
	
	Client* tgt;
	if( 0 == entity )
		tgt = who;
	else
    {
		tgt = services->entity_list.FindCharacter( entity );
		if( NULL == tgt )
			throw PyException( MakeCustomError( "Unable to find character %u", entity ) );
	}
	
	tgt->AddBalance( amount );
	return new PyString( "Operation successful." );
}
Beispiel #2
0
void NPC::_AwardBounty(SystemEntity *who) {
	//double bounty = m_self->entityKillBounty();
    double bounty = m_self->GetAttribute(AttrEntityKillBounty).get_float();
	if(bounty <= 0) {
		return;	//no bounty to award...
	}
	
	//TODO: handle case where drone strikes fatal blow... bounty goes to master.

	//TODO: handle distribution to gangs.
	
	if(who->IsClient() == false) {
		_log(NPC__TRACE, "Refusing to award bounty on %u to non-client %u", GetID(), who->GetID());
		return;	//bounty doesn't make sense for anything other than clients.
	}

	Client *killer = who->CastToClient();

	killer->AddBalance(bounty);

	std::string reason = "Bounty";	//TODO: improve this.
	
	if(!m_services.serviceDB().GiveCash(
			killer->GetID(),
			RefType_playerDonation,	//TODO: find the proper type
			m_self->itemID(),	//probably actually a special concord item ID or something.
			killer->GetID(),
			"",	//unknown const char *argID1,
			killer->GetAccountID(),
			accountCash,
			bounty,
			killer->GetBalance(),
			reason.c_str()
	)) {
		codelog(CLIENT__ERROR, "%s: Failed to record bountry of %f from death of %u (type %u)", killer->GetName(), bounty, GetID(), m_self->typeID());
		//well.. this isnt a huge deal, so we will get over it.
	}
	
}